Re: [HACKERS] Possible bug in parsing

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [HACKERS] Possible bug in parsing
Дата
Msg-id 350FDDDB.ACB3940@alumni.caltech.edu
обсуждение исходный текст
Ответ на Possible bug in parsing  (Hannu Krosing <hannu@trust.ee>)
Список pgsql-hackers
> > > I understand the 'there is more than one operator' errors, but
> > > what is so different between operators + and || ?
>
> Yes I know that, but why are they so different that I can have
>  ARG1 op ARG2 op ARG3
> with + but not with ||

Ah! I *thought* that was a silly question, and as usual that's because I
didn't understand the question :)

They behave differently because the "+" operator is allowed to be
"left-associative", since its behavior is well-defined mathematically,
while the "||" operator falls into a broad class of multi-character
operators in the parser which are "non-associative". So, the parser does
not know whether to evaluate left-to-right or right-to-left and throws
an error instead.

> I actually found this while trying to find out how characters in
> strings are escaped and if \0 is supported in them.
>
> Is there some docs on escaping characters, and if not then where do
> you think it should go in docs ?

I believe that there are no docs on escaping characters and I would
suggest that docs for it should go into the user's guide in the section
on character data types (since it applies to all of them). That would be
in doc/src/sgml/datatype.sgml, probably in a "Sect2" at the end of the
"Sect1" on "Character Types" and just before the "Sect1" on "Date/Time
Types".

If you find it difficult to work with that source document, you can just
type the information and I can help to integrate it into the doc.

btw, I think that the escape conventions for strings need some work; the
fact that the characters are re-escaped when output makes it easy to do
a dump/reload but sort of defeats the usefulness of escaping anything in
the first place.

                           - Tom

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Re: [QUESTIONS] MySQL benchmark page
Следующее
От: Michael Meskes
Дата:
Сообщение: another standards question