Received: from 165.201.21.73 (dt99fn22.dot.state.ks.us [165.201.21.73]) by hub.org (8.9.3/8.9.3) with SMTP id KAA58478 for ; Wed, 23 Feb 2000 10:47:12 -0500 (EST) (envelope-from Steven@ksdot.org) Received: from DTGATE-Message_Server by 165.201.21.73 with Novell_GroupWise; Wed, 23 Feb 2000 09:46:05 -0600 Message-Id: X-Mailer: Novell GroupWise 5.5.2 Date: Wed, 23 Feb 2000 09:45:55 -0600 From: "Steven Pennie" To: Subject: Developing a Schema Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.org id KAA58514 I am working on SQLs to be used to develope a "schema" of whatever database I am using. I thought I would start by mimicing the "\d" command and build on from there. What is the SQL that generates the "\d" description? What I have so far is: 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