[SQL] How does this query work.....?
Hi, I am using the following query to find the attributes of a given table, and their datatypes: select typname,attname from pg_class c, pg_attribute a,pg_type t where relname = 'table_name' and attrelid = c.oid and atttypid = t.oid and attnum > 0; Can anybody explain how this query actually works - I cannot figure it. Thanks in advance. Rob Burne.
[SQL] Can anyone explain how this works?
Hi, I recently posted this same question a few weeks back but lost the reply someone kindly sent. The question again how exactly does this query work: it will return all attributes and respective data types of a given table': select attname, typname from pg_class c, pg_attribute a, pg_type t where relname = relation_name and attrelid = c.oid and atttypid = t.oid and attnum > 0 order by attnum; Many thanks, Rob Burne.