RE: Extracting metadata about attributes from catalog
От | Alex Pilosov |
---|---|
Тема | RE: Extracting metadata about attributes from catalog |
Дата | |
Msg-id | Pine.BSO.4.10.10106241102590.9446-100000@spider.pilosoft.com обсуждение исходный текст |
Ответ на | RE: Extracting metadata about attributes from catalog ("Bernardo Pons" <bernardo@atlas-iap.es>) |
Список | pgsql-hackers |
On Sun, 24 Jun 2001, Bernardo Pons wrote: > > > 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 Sorry about that. For parameterized types (like numeric, varchar), atttypmod contains specific information. For varchar-like parameters, its length of the field+4 (54 means varchar(50), for example). For numeric paremeter (numeric(a,b)), its 327680*b+a I'm not sure if there's a better (and more documented) way to decode those numbers, though.....
В списке pgsql-hackers по дате отправления: