Re: [HACKERS] Unary % operator is broken in current sources

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Unary % operator is broken in current sources
Дата
Msg-id 7395.922031711@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Unary % operator is broken in current sources  (Bruce Momjian <maillist@candle.pha.pa.us>)
Ответы Re: [HACKERS] Unary % operator is broken in current sources  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> Not sure.  I know I only changed % to have precedence like /.  No one is
> complaining, and I think the problems are restricted to +,-,*,/, and %. 
> Should I fix any of these other ones?

Right now I think % is the only problem, since it's the only operator
that has all three syntaxes (infix, prefix, postfix):

regression=> select distinct p1.oprname, p1.oprkind, p2.oprkind from
regression-> pg_operator as p1, pg_operator as p2
regression-> where p1.oprname = p2.oprname and p1.oprkind < p2.oprkind;
oprname|oprkind|oprkind
-------+-------+-------
#      |b      |l
%      |b      |l
%      |b      |r
%      |l      |r
-      |b      |l
?-     |b      |l
?|     |b      |l
@      |b      |l
(8 rows)

Having both infix and prefix syntaxes doesn't seem to confuse the
parser --- at least, we have regress tests of both prefix @ and
infix @ (likewise #) and they're not complaining.  Probably you need
a postfix syntax plus one or both of the other syntaxes to yield an
ambiguity that will confuse the parser.  I haven't tried to track it
down in the grammar, however.

My concern with hacking in a special case for '%' in the grammar
is that we'll need to do it again anytime someone adds an operator
with the right set of syntaxes.  It'd be better to understand *why*
the parser is having a hard time with this all of a sudden, and fix it
without reference to any particular operator.  Postgres is supposed to
be extensible after all...
        regards, tom lane


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

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: [HACKERS] non existing table error message changed?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] min() and max() causing aborts