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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to