Re: Name column
От | Heikki Linnakangas |
---|---|
Тема | Re: Name column |
Дата | |
Msg-id | 4C9C7EF7.2010107@enterprisedb.com обсуждение исходный текст |
Ответ на | Name column (Vlad Arkhipov <arhipov@dc.baikal.ru>) |
Ответы |
Re: Name column
|
Список | pgsql-hackers |
On 24/09/10 13:02, Vlad Arkhipov wrote: > I have just come across a weird thing. It works for any table and seems > to be not documented. > > SELECT c.name FROM (VALUES(1, 'A', true)) c; > SELECT c.name FROM pg_class c; > > And it does not work in these cases: > > SELECT name FROM (VALUES(1, 'A', true)); > SELECT name FROM pg_class; For historical reasons PostgreSQL supports calling a function with a single argument like "column.function", in addition to "function(column)". There is a function "name(text)" that casts the input to the 'name' datatype, so your example casts the row to text and from text to name. It is mentioned in the documentation at http://www.postgresql.org/docs/8.4/interactive/xfunc-sql.html Section "34.4.2. SQL Functions on Composite Types". -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: