Re: underscore split to alias

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Erik Rijkers" <er(at)xs4all(dot)nl>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: underscore split to alias
Date: 2010-05-14 23:08:40
Message-ID: 10608.1273878520@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Erik Rijkers" <er(at)xs4all(dot)nl> writes:
> I am not sure this is a bug, but I was surprised by the following behaviour
> in HEAD and 8.4.4 (instances built today, 2010.05.14):

> Invalid (?) values like 123_456 are split before the underscore and interpreted as
> 123 as "456":

All versions of postgres will parse 123_456 as an integer (123)
immediately followed by an identifier (_456). In the particular context
that this is all of a top-level SELECT item, the SQL spec requires that
we parse this as an integer and a column alias (with an implied AS).
We failed to do that before 8.4, but now honor the spec requirement
that AS can be omitted. Personally I think that's one of the stupider,
more error-prone aspects of the spec's syntax, but nonetheless it's
required by spec ....

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joseph Adams 2010-05-15 02:35:21 Re: JSON manipulation functions
Previous Message Erik Rijkers 2010-05-14 22:55:57 underscore split to alias