Developing a Schema - Mailing list pgsql-admin

From Steven Pennie
Subject Developing a Schema
Date
Msg-id s8b3ac5d.087@165.201.21.73
Whole thread Raw
List pgsql-admin
I am working on SQLs to be used to develope a "schema" of whatever database I am using.  I thought I would start by
mimicingthe "\d" command and build on from there.  What is the SQL that generates the "\d" description?  What I have so
faris: 
SELECT relname,typrelid,attname,tableowner,relowner,
 reltype,reltuples,relhasindex,relukeys,relfkeys,relhasrules
 FROM pg_class c, pg_tables t, pg_type y, pg_attribute a
 WHERE relname NOT LIKE 'pg_%' AND relname=tablename  AND
       typname=relname AND attrelid=typrelid AND attnum > 0
 ORDER BY relname;"

I noticed that pg_class.reltuples didn't always gave me the number of rows in a table, several times it had 1000
instead

Steven Pennie
Application Programmer/Analyst III
KDOT Materials & Research Center
(785) 291-3863 - Fax (785) 296-2526
steven@ksdot.org


pgsql-admin by date:

Previous
From: Peter Vazsonyi
Date:
Subject: more performance on some aggregates
Next
From: "Hernan J. Gonzalez"
Date:
Subject: bug with serial field?