Emulating "\d" Output

Started by Nonameover 25 years ago3 messagesgeneral
Jump to latest
#1Noname
mjp@ornl.gov

Hi,

Is there a way of generating the same output as \d <tablename>
with a single SELECT statement using the Postgres
system table(s?

Thanks,
Morey Parang
ORNL

#2Charles Tassell
ctassell@isn.net
In reply to: Noname (#1)
Re: Emulating "\d" Output

I think this is in the FAQ somewhere. If you start psql with the -E option
it will show all the queries it uses for any commands, including \d So
just do something like:

psql -E mydb
\d

And you should see it. The actual query for \d is
QUERY: SELECT usename, relname, relkind, relhasrules FROM pg_class, pg_user
WHERE usesysid = relowner and ( relkind = 'r' OR relkind = 'i' OR relkind =
'S') and relname !~ '^pg_' and (relkind != 'i' OR relname !~
'^xinx') ORDER BY relname

At 02:03 PM 7/21/00, you wrote:

Show quoted text

Hi,

Is there a way of generating the same output as \d <tablename>
with a single SELECT statement using the Postgres
system table(s?

Thanks,
Morey Parang
ORNL

#3Noname
mjp@ornl.gov
In reply to: Charles Tassell (#2)
Re: Emulating "\d" Output

Thanks, Charles. I just tried and it works great.

Morey

Show quoted text

On Fri, Jul 21, 2000 at 02:17:03PM -0300, Charles Tassell wrote:

I think this is in the FAQ somewhere. If you start psql with the -E option
it will show all the queries it uses for any commands, including \d So
just do something like:

psql -E mydb
\d

And you should see it. The actual query for \d is
QUERY: SELECT usename, relname, relkind, relhasrules FROM pg_class, pg_user
WHERE usesysid = relowner and ( relkind = 'r' OR relkind = 'i' OR relkind =
'S') and relname !~ '^pg_' and (relkind != 'i' OR relname !~
'^xinx') ORDER BY relname

At 02:03 PM 7/21/00, you wrote:

Hi,

Is there a way of generating the same output as \d <tablename>
with a single SELECT statement using the Postgres
system table(s?

Thanks,
Morey Parang
ORNL