Re: [HACKERS] Some surprising precedence behavior in PG's grammar

2011-05-05 Thread Tom Lane
I wrote: Andrew Dunstan and...@dunslane.net writes: If we do need a precedence setting for NULL_P, then I think it should probably be on its own and not sharing one with IS. Yeah, I was thinking that too. If we put %prec on the IS [NOT] NULL productions then there is no need for NULL_P to

[HACKERS] Some surprising precedence behavior in PG's grammar

2011-05-04 Thread Tom Lane
While looking at the grammar's operator-precedence declarations in connection with a recent pgsql-docs question, it struck me that this declaration is a foot-gun waiting to go off: %nonassoc IS NULL_P TRUE_P FALSE_P UNKNOWN /* sets precedence for IS NULL, etc */ The only terminal that we

Re: [HACKERS] Some surprising precedence behavior in PG's grammar

2011-05-04 Thread Andrew Dunstan
On 05/04/2011 07:39 PM, Tom Lane wrote: While looking at the grammar's operator-precedence declarations in connection with a recent pgsql-docs question, it struck me that this declaration is a foot-gun waiting to go off: %nonassoc IS NULL_P TRUE_P FALSE_P UNKNOWN /* sets precedence for

Re: [HACKERS] Some surprising precedence behavior in PG's grammar

2011-05-04 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: On 05/04/2011 07:39 PM, Tom Lane wrote: If you try the experiment, you find out that the first interpretation is preferred by the current grammar: ERROR: operator does not exist: integer %% unknown Yeah, IIRC the default action for a shift/reduce

Re: [HACKERS] Some surprising precedence behavior in PG's grammar

2011-05-04 Thread Greg Stark
On Thu, May 5, 2011 at 12:39 AM, Tom Lane t...@sss.pgh.pa.us wrote: So I'd still like to get rid of the precedence markings for TRUE_P, FALSE_P, and UNKNOWN, and will do so unless somebody has a really good reason not to.  (It looks like we could avoid marking ZONE, too.)  But I would be

Re: [HACKERS] Some surprising precedence behavior in PG's grammar

2011-05-04 Thread Tom Lane
Greg Stark gsst...@mit.edu writes: Isn't there already some gadget which forces postfix operators to be discouraged compared to some other interpretation in other cases? Yeah. I'm not unhappy with the current grammar's behavior in this case. What's bothering me is that the implementation seems

Re: [HACKERS] Some surprising precedence behavior in PG's grammar

2011-05-04 Thread Greg Stark
On Thu, May 5, 2011 at 4:03 AM, Tom Lane t...@sss.pgh.pa.us wrote: Greg Stark gsst...@mit.edu writes: Isn't there already some gadget which forces postfix operators to be discouraged compared to some other interpretation in other cases? Yeah.  I'm not unhappy with the current grammar's