RE: Extracting metadata about attributes from catalog
От | Bernardo Pons |
---|---|
Тема | RE: Extracting metadata about attributes from catalog |
Дата | |
Msg-id | LOBBIBBGKNPMBFIKNEGGCEIACCAA.bernardo@atlas-iap.es обсуждение исходный текст |
Ответ на | Re: Extracting metadata about attributes from catalog (Alex Pilosov <alex@pilosoft.com>) |
Ответы |
RE: Extracting metadata about attributes from catalog
|
Список | pgsql-hackers |
> Do 'psql -E ...', it will display actual queries used by psql. I already do it. At the end of my first message there was an example with exactly the query you suggested. > Your particular query is: > SELECT a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull, > a.atthasdef, a.attnum > 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 a.attnum > > And pg_type has all information you need. But, I'm afraid pg_type has not the information I need. Just in case I missed something you have seen I wrote down a query showing all attributes of the pg_type SELECT a.attname, t.typname, t.typowner, t.typlen, t.typprtlen, t.typbyval, t.typtype, t.typisdefined, t.typdelim, t.typrelid, t.typelem, t.typinput, t.typoutput, t.typreceive, t.typsend, t.typalign, t.typdefault, a.atttypmod, a.attnum 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 a.attnum; but there's neither a field showing me, for example, a value 100 for a varchar(100) field nor two fields showing value 6 and 2 for a numeric(6,2) field. Maybe I'm missing something from your answer? Regards, -- Bernardo Pons
В списке pgsql-hackers по дате отправления: