Received: from mail01.phoenixdsl.com (mail.phoenixdsl.com [216.178.151.24]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f0PKvIq22686 for ; Thu, 25 Jan 2001 15:57:19 -0500 (EST) (envelope-from mdavis@sevainc.com) Received: (qmail 57572 invoked by uid 89); 25 Jan 2001 20:57:14 -0000 Received: from unknown (HELO SALLY) (64.32.157.45) by 0 with SMTP; 25 Jan 2001 20:57:14 -0000 Received: by localhost with Microsoft MAPI; Thu, 25 Jan 2001 13:57:13 -0700 Message-ID: <01C086D6.B80EB9B0.mdavis@sevainc.com> From: Michael Davis Reply-To: "mdavis@sevainc.com" To: "'Mike D'Agosta'" , "pgsql-sql@postgresql.org" Subject: RE: Is there anything like DESCRIBE? Date: Thu, 25 Jan 2001 13:57:08 -0700 Organization: Seva Inc. X-Mailer: Microsoft Internet E-mail/MAPI - 8.0.0.4211 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Archive-Number: 200101/368 X-Sequence-Number: 1041 This works for me: SELECT DISTINCT c.relname as table_name, a.attname as column_name, t.typname, pa.adsrc as default FROM (pg_attribute a join pg_class c on a.attrelid = c.oid join pg_type t on a.atttypid = t.oid) left join pg_attrdef pa on c.oid = pa.adrelid AND a.attnum = pa.adnum where exists (select * from pg_tables where tablename = c.relname and substr(tablename,1,2) <> 'pg') order by c.relname, a.attname; -----Original Message----- From: Mike D'Agosta [SMTP:mdagosta@earthtribe.net] Sent: Wednesday, January 24, 2001 12:01 PM To: pgsql-sql@postgresql.org Subject: Is there anything like DESCRIBE? Hi, I have a number of empty tables and I want to get the column names and data types with an SQL statement. I want to do this procedurally, not interactively (so I can't use \d in psql). Postgres doesn't support DESCRIBE... is there any other way to do this? Thanks! Mike