From: Alessio B. <al...@al...> - 2001-02-23 08:45:26
|
Brian Aker wrote: > I know about using \dt while in psql, > but what does it want for SQL to do this? use psql -E to echo the internal query. > SHOW TABLES LIKE "$table" village=# \dt ********* QUERY ********* SELECT c.relname as "Name", 'table'::text as "Type", u.usename as "Owner" FROM pg_class c, pg_user u WHERE c.relowner = u.usesysid AND c.relkind = 'r' AND c.relname !~ '^pg_' UNION SELECT c.relname as "Name", 'table'::text as "Type", NULL as "Owner" FROM pg_class c WHERE c.relkind = 'r' AND not exists (select 1 from pg_user where usesysid = c.relowner) AND c.relname !~ '^pg_' ORDER BY "Name" ************************* > SHOW COLUMNS FROM $table village=# \d TABLE ********* QUERY ********* SELECT a.attname, format_type(a.atttypid, a.atttypmod), a.attnotnull, a.atthasdef, a.attnum FROM pg_class c, pg_attribute a WHERE c.relname = 'TABLE' AND a.attnum > 0 AND a.attrelid = c.oid ORDER BY a.attnum ************************* -- Alessio F. Bragadini al...@al... APL Financial Services http://village.albourne.com Nicosia, Cyprus phone: +357-2-755750 "It is more complicated than you think" -- The Eighth Networking Truth from RFC 1925 |