Re: Selecting field names?
От | Charles Tassell |
---|---|
Тема | Re: Selecting field names? |
Дата | |
Msg-id | 4.2.0.58.20000410002305.009c95d0@mailer.isn.net обсуждение исходный текст |
Ответ на | Selecting field names? (Michael Hall <michael@inteltec.com>) |
Список | pgsql-general |
Yes, if you start psql with the -E switch (ie, psql -E -h dbserver database) then do a \d tablename it will show you the SQL query that's used to display the table definition. You can then use this to do your selects. Here is what I get when I do the above: QUERY: SELECT a.attnum, a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull, a.atthasdef FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = 'tablename' and a.attnum > 0 and a.attrelid = c.oid and a.atttypid = t.oid ORDER BY attnum QUERY: SELECT viewname, definition FROM pg_views WHERE viewname like 'tablename' At 12:57 PM 4/9/00, Michael Hall wrote: >Is there a way to 'select' the names of the fields and the field types >of a table? > >-- >Michael J. Hall, CCA Intelligence Technologies Int'l >michael@inteltec.com http://www.inteltec.com >secure: mikehall@leo.gov
В списке pgsql-general по дате отправления: