Re: how to determine which types take a length argument
От | Robert Treat |
---|---|
Тема | Re: how to determine which types take a length argument |
Дата | |
Msg-id | 200608091320.41481.xzilla@users.sourceforge.net обсуждение исходный текст |
Ответ на | Re: how to determine which types take a length argument (Martijn van Oosterhout <kleptog@svana.org>) |
Ответы |
Re: how to determine which types take a length argument
|
Список | pgsql-hackers |
On Wednesday 09 August 2006 10:53, Martijn van Oosterhout wrote: > On Wed, Aug 09, 2006 at 10:44:22AM -0400, Robert Treat wrote: > > Is there a way to determine which datatypes take a length argument (eg. > > varchar, time, etc...) by looking in the system catalogs? pg_type doesnt > > seem to have the info... or is there a single place in the back end code > > that contains this info? > > Sure, wherever the typlen column in pg_type is -1. In that column, > positive is fixed length, -1 is a verlena type and -2 is null > terminated (for cstring). > pagila=# select now()::varchar(3), now()::time(3);now | now -----+--------------200 | 13:19:34.339 (1 row) pagila=# select typname, typlen from pg_type where typname in ('varchar', 'time');typname | typlen ---------+--------varchar | -1time | 8 (2 rows) Both time and varchar take an argument, but they have different typlen values. I don't think the docs are wrong here, I think they just don't tell me what I am looking for. -- Robert Treat Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL
В списке pgsql-hackers по дате отправления: