Re: PostgreSQL vs SQL Standard

Поиск
Список
Период
Сортировка
От Brad DeJong
Тема Re: PostgreSQL vs SQL Standard
Дата
Msg-id CAJnrtnxrV_Nbfs1SZD6CmfB0dfAtGfKGLmLOED02M47RzdOZwg@mail.gmail.com
обсуждение исходный текст
Ответ на PostgreSQL vs SQL Standard  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Список pgsql-hackers
On Sat, Jun 9, 2018 at 8:37 PM, Andrew Gierth <andrew@tao11.riddles.org.uk> wrote:
> I think I got all the issues I currently know of, but there may be
> more, and others may disagree with my classification of issues or the
> rationales for violating the spec. Any feedback?

Related to, but I think distinct from

    "Trailing spaces in character(n)"
        Trailing spaces in char(n) values are removed in contexts where the spec requires they be kept.

E021-03 Character literals subclause 5.3, "<literal>": <quote> [ <character representation>... ] <quote>

In subclause 5.3 (SQL standard 2011 part 2: foundation), <character string literal> is defined (ignoring
the character set specifier and the weird multi-line continuations) as 

    <character string literal> ::=  <quote> [ <character representation>... ] <quote>

syntax rule 17 states

    "The declared type of a <character string literal> is fixed-length character string."

In PostgreSQL, the same syntax (<quote> [ <character representation>... ] <quote>) is a string constant and in
the PostgreSQL documentation, section 4.1.2 constants, it says that string constants are one
of the three kinds of implicitly typed constants.

Where you see the difference is that trailing spaces in a string constant are retained when the type
is resolved to text, but if the constant was typed as bpchar and then cast to text, the trailing spaces
would be trimmed.


You also see that the type of a string constant is implicit in cases where PostgreSQL is
unable to determine the type of a string constant from its context.


I could be reading some of this incorrectly, but putting it all together, it looks to me like
PostgreSQL does not meet a strict interpretation of E021-03.

I'd put it in the WONTFIX section.

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

Предыдущее
От: Arseny Sher
Дата:
Сообщение: Re: pgsql: Fix "base" snapshot handling in logical decoding
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: Fix to not check included columns in ANALYZE on indexes