Search Postgresql Archives

Re: SELECT of pseudo hex value gives unexpected result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Gunnar \"Nick\" Bluth" <gunnar.bluth@xxxxxxxxxxx> writes:
> Tried
> SELECT 0x5e73266725;

> and received:
> -[ RECORD 1 ]--
> x5e73266725 | 0

> That was not what I expected... is this expected/documented behaviour?

Well, there are no hex literals in (PG's notion of) SQL, so that isn't
a valid token.  But it's the concatenation of two valid tokens.  So
what you wrote is the same as

SELECT 0 x5e73266725;

which is an abbreviation for

SELECT 0 AS x5e73266725;

and that's the result you got.

I think that the SQL standard considers adjacent tokens to be invalid
unless one of them is punctuation (e.g. 1+2), but our lexer is a bit
less rigid about that.

			regards, tom lane




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux