Re: SHOW - Mailing list pgsql-general

From Doug McNaught
Subject Re: SHOW
Date
Msg-id m3g0a3owh0.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to Re: SHOW  (bpalmer <bpalmer@crimelabs.net>)
Responses Re: SHOW
List pgsql-general
Stephan Bergmann <sb@ows.es> writes:

> Hi Joe.
>
> >
> > Start up psql with the -E on the command line. Then do \d TABLE. This will
> > show you the actual SQL commands used by psql.
>
> Doesn't change nothing.

Hmm, works for me.  What version of Postgres are you using?

Example:

[doug@scooby doug]$ psql -E template1
********* QUERY *********
SELECT usesuper FROM pg_user WHERE usename = 'doug'
*************************

Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

template1=# \d
********* QUERY *********
SELECT c.relname as "Name", 'table'::text as "Type", u.usename as "Owner"
FROM pg_class c, pg_user u
WHERE c.relowner = u.usesysid AND c.relkind = 'r'
  AND c.relname !~ '^pg_'
UNION
SELECT c.relname as "Name", 'table'::text as "Type", NULL as "Owner"
FROM pg_class c
WHERE c.relkind = 'r'
  AND not exists (select 1 from pg_user where usesysid = c.relowner)
  AND c.relname !~ '^pg_'

UNION

[more query here...]


--
Free Dmitry Sklyarov!
http://www.freesklyarov.org/

We will return to our regularly scheduled signature shortly.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: how do functional indices work?
Next
From: Jerry Asher
Date:
Subject: Re: upgrade from 7.1.2 to 7.1.3 and uh, where are my