Thread: [HACKERS] operator_precedence_warning vs make installcheck

[HACKERS] operator_precedence_warning vs make installcheck

From
Jeff Janes
Date:
make installcheck fails against a server running with operator_precedence_warning = on.

The difference is in update.out, and consists of an error-locating carat getting moved over by one position.  I've attached the regression diff.

I don't know why the setting of this GUC causes the carat to move around, that seems odd.  If it can't be fixed at the source, it should be easy enough to just override the setting in update.sql.

Cheers,

Jeff
Attachment

Re: [HACKERS] operator_precedence_warning vs make installcheck

From
Tom Lane
Date:
Jeff Janes <jeff.janes@gmail.com> writes:
> make installcheck fails against a server running with
> operator_precedence_warning = on.

> The difference is in update.out, and consists of an error-locating carat
> getting moved over by one position.  I've attached the regression diff.

> I don't know why the setting of this GUC causes the carat to move around,
> that seems odd.

The reason is that with operator_precedence_warning = on, there's an
explicit raw-parse-tree node for the parenthesis pair, which otherwise
there is not, so that exprLocation reports a different result for the
location of the subexpression.

We could possibly prevent the difference by having exprLocation look
through such nodes.  I'm not sure offhand if there are cases where
that would be worse than before.  We've definitely made some other
hacks to hide the difference between operator_precedence_warning on
and off.
        regards, tom lane



Re: [HACKERS] operator_precedence_warning vs make installcheck

From
Tom Lane
Date:
I wrote:
> We could possibly prevent the difference by having exprLocation look
> through such nodes.  I'm not sure offhand if there are cases where
> that would be worse than before.  We've definitely made some other
> hacks to hide the difference between operator_precedence_warning on
> and off.

After some study I concluded the best fix is just to make the AEXPR_PAREN
node have the same reportable location as its child node to begin with.
None of the code dealing with precedence errors was using the location
of the left parenthesis, so there's no good reason to store that.

Pushed a fix along that line.
        regards, tom lane



Re: [HACKERS] operator_precedence_warning vs make installcheck

From
Jeff Janes
Date:
On Wed, Feb 15, 2017 at 11:47 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I wrote:
> We could possibly prevent the difference by having exprLocation look
> through such nodes.  I'm not sure offhand if there are cases where
> that would be worse than before.  We've definitely made some other
> hacks to hide the difference between operator_precedence_warning on
> and off.

After some study I concluded the best fix is just to make the AEXPR_PAREN
node have the same reportable location as its child node to begin with.
None of the code dealing with precedence errors was using the location
of the left parenthesis, so there's no good reason to store that.

Pushed a fix along that line.

                        regards, tom lane

Thanks.