Обсуждение: pgsql/doc/src/sgml syntax.sgml

Поиск
Список
Период
Сортировка

pgsql/doc/src/sgml syntax.sgml

От
Peter Eisentraut - PostgreSQL
Дата:
CVSROOT:    /home/projects/pgsql/cvsroot
Module name:    pgsql
Changes by:    petere@hub.org    01/02/24 13:09:57

Modified files:
    doc/src/sgml   : syntax.sgml

Log message:
    Choose a more suitable example for the operator precedence mis-parsing
    example.


Re: pgsql/doc/src/sgml syntax.sgml

От
Tom Lane
Дата:
Peter Eisentraut - PostgreSQL <petere@hub.org> writes:
> Modified files:
>     doc/src/sgml   : syntax.sgml
> Log message:
>     Choose a more suitable example for the operator precedence mis-parsing
>     example.

I disagree with this change.  The new example may be a more "useful"
computation than the old example, but it does not generate the desired
error message.  Before, we got:

SELECT 5 ! ~ 6;
ERROR:  Unable to identify an operator '!' for types 'int4' and 'int4'
        You will have to retype this query using an explicit cast

The new example produces

SELECT 5 ! + 6;
ERROR:  Unable to identify a left operator '+' for type 'int4'
        You may need to add parentheses or an explicit cast

which would distract a reader from the primary point, namely that
the ambiguity between postfix and infix for '!' is what causes the
problem.

How do you feel about "SELECT 5 ! - 6;" as a compromise?

            regards, tom lane

Re: pgsql/doc/src/sgml syntax.sgml

От
Peter Eisentraut
Дата:
Tom Lane writes:

> How do you feel about "SELECT 5 ! - 6;" as a compromise?

Perfect.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/