Re: Name column
От
Heikki Linnakangas
Тема
Re: Name column
Дата
Msg-id
4C9C7EF7.2010107@enterprisedb.com
Ответ на
Name column (Vlad Arkhipov)
Список
Дерево обсуждения
Name column Vlad Arkhipov <arhipov@dc.baikal.ru>
Re: Name column Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Re: Name column Robert Haas <robertmhaas@gmail.com>
Re: Name column André Fernandes<andre.de.camargo.fernandes@hotmail.com>
Re: Name column Tom Lane <tgl@sss.pgh.pa.us>
Re: Name column Robert Haas <robertmhaas@gmail.com>
Re: Name column Tom Lane <tgl@sss.pgh.pa.us>
Re: Name column Robert Haas <robertmhaas@gmail.com>
Re: Name column Tom Lane <tgl@sss.pgh.pa.us>
Re: Name column Pavel Stehule <pavel.stehule@gmail.com>
Re: Name column Pavel Stehule <pavel.stehule@gmail.com>
Re: Name column Tom Lane <tgl@sss.pgh.pa.us>
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 по дате отправления