Re: SELECT of pseudo hex value gives unexpected result

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT of pseudo hex value gives unexpected result
Дата
Msg-id 7563.1548779969@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SELECT of pseudo hex value gives unexpected result  ("Gunnar \"Nick\" Bluth" <gunnar.bluth@pro-open.de>)
Ответы Re: SELECT of pseudo hex value gives unexpected result  ("Gunnar \"Nick\" Bluth" <gunnar.bluth@pro-open.de>)
Список pgsql-general
"Gunnar \"Nick\" Bluth" <gunnar.bluth@pro-open.de> 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


В списке pgsql-general по дате отправления:

Предыдущее
От: "Gunnar \"Nick\" Bluth"
Дата:
Сообщение: SELECT of pseudo hex value gives unexpected result
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: SELECT of pseudo hex value gives unexpected result