Re: DESCRIBE for composite type?
От | Richard Broersma |
---|---|
Тема | Re: DESCRIBE for composite type? |
Дата | |
Msg-id | 396486430810050813j7db2debawc649143306ad5ee7@mail.gmail.com обсуждение исходный текст |
Ответ на | DESCRIBE for composite type? ("Nikita Koselev" <koselev@gmail.com>) |
Список | pgsql-novice |
On Sat, Oct 4, 2008 at 11:54 PM, Nikita Koselev <koselev@gmail.com> wrote: > How can I get description of this composite type later (field names > and values)? Is there something in pgsql like DESCRIBE statement in > oracle? In the psql client, you simple called the client function \d <functionname>. Notice also, the queries that psql sends to the PostgreSQL server inorder to produce the desired results. testdb=# \d requirement_vo ********* QUERY ********** SELECT c.oid, n.nspname, c.relname FROM pg_catalog.pg_class c LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE c.relname ~ '^(requirement_vo)$' AND pg_catalog.pg_table_is_visible(c.oid) ORDER BY 2, 3; ************************** ********* QUERY ********** SELECT relhasindex, relkind, relchecks, reltriggers, relhasrules, relhasoids , reltablespace FROM pg_catalog.pg_class WHERE oid = '26098' ************************** ********* QUERY ********** SELECT a.attname, pg_catalog.format_type(a.atttypid, a.atttypmod), (SELECT substring(pg_catalog.pg_get_expr(d.adbin, d.adrelid) for 128) FROM pg_catalog.pg_attrdef d WHERE d.adrelid = a.attrelid AND d.adnum = a.attnum AND a.atthasdef), a.attnotnull, a.attnum FROM pg_catalog.pg_attribute a WHERE a.attrelid = '26098' AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum ************************** Composite type "testschema.requirement_vo" Column | Type ---------------------+----------------------- name | character varying(20) description | character varying(20) requirement_id | integer requirement_type_id | integer priority_id | integer necessity_id | integer lower_limit | double precision upper_limit | double precision testdb=# -- Regards, Richard Broersma Jr. Visit the Los Angeles PostgreSQL Users Group (LAPUG) http://pugs.postgresql.org/lapug
В списке pgsql-novice по дате отправления: