Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > How does psql a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 15218 of 17602
Post > Topic >>

How does psql actually implement the \d commands

by Andrew Falanga <af300wsm@[EMAIL PROTECTED] > Apr 8, 2008 at 10:02 AM

Hi,

I know about the -E option to psql and did that to get the following,
which is what psql does for a \d <tablename>:

********* QUERY **********
SELECT c.oid,
  n.nspname,
  c.relname
FROM pg_catalog.pg_class c
     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE pg_catalog.pg_table_is_visible(c.oid)
      AND c.relname ~ '^(personaldata)$'
ORDER BY 2, 3;
**************************

********* QUERY **********
SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules
FROM pg_catalog.pg_class WHERE oid = '17408'
**************************

********* QUERY **********
SELECT a.attname,
  pg_catalog.format_type(a.atttypid, a.atttypmod),
  (SELECT substring(d.adsrc for 128) FROM pg_catalog.pg_attrdef d
   WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND
a.atthasdef),
  a.attnotnull, a.attnum
FROM pg_catalog.pg_attribute a
WHERE a.attrelid = '17408' AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
**************************

********* QUERY **********
SELECT c.relname FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i
WHERE c.oid=i.inhparent AND i.inhrelid = '17408' ORDER BY inhseqno ASC
**************************

Now, I tried to execute these queries one at a time and they failed,
somewhat miserably.  In what order does PostgreSQL actually execute
them?  Are they implemented as sub-queries?  If so, in what order are
they executed?

Andy
 




 5 Posts in Topic:
How does psql actually implement the \d commands
Andrew Falanga <af300w  2008-04-08 10:02:33 
Re: How does psql actually implement the \d commands
laurenz.albe@[EMAIL PROTE  2008-04-09 13:51:57 
Re: How does psql actually implement the \d commands
Andrew Falanga <af300w  2008-04-10 20:09:07 
Re: How does psql actually implement the \d commands
laurenz.albe@[EMAIL PROTE  2008-04-11 13:45:06 
Re: How does psql actually implement the \d commands
Andrew Falanga <af300w  2008-04-11 08:35:15 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 19:16:49 CST 2008.