For those who need to know the fields that a certain table has in a postgresql database, here is the SQL statement: SELECT DISTINCT attname, relname FROM pg_attribute pa, pg_class pc, pg_tables pt WHERE pa.attrelid=pc.oid AND pc.relname=pt.tablename AND pt.schemaname='public' AND attstattarget=-1 AND relname IN (SELECT tablename FROM pg_tables WHERE schemaname='public') ORDER BY relname; Notice that you can replace ***relname IN (SELECT tablename FROM pg_tables WHERE schemaname='public')*** with ***relname='your_desired_tablename'*** and will do the work only for an specific table. For the newbies: you can specify the schemaname if needed. Daniel ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your message can get through to the mailing list cleanly