pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steven Pennie <Steven@ksdot.org>
To: pgsql-admin@postgresql.org
Subject: Developing a Schema
Date: Wed, 23 Feb 2000 09:45:55 -0600
Message-ID: <s8b3ac5d.087@165.201.21.73> (raw)

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




Message-ID: <s8b3ac5d.087@165.201.21.73>
Permalink:  ../s8b3ac5d.087@165.201.21.73/
Also on:    postgresql.org/message-id/s8b3ac5d.087@165.201.21.73

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: Steven@ksdot.org
  Subject: Re: Developing a Schema
  In-Reply-To: <s8b3ac5d.087@165.201.21.73>
  References: <s8b3ac5d.087@165.201.21.73>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox