Re: BUG #3822: Nonstandard precedence for comparison operators - Mailing list pgsql-bugs

From Michael Glaesemann
Subject Re: BUG #3822: Nonstandard precedence for comparison operators
Date
Msg-id F7FD54CC-6091-4F99-AF53-BBD4B13ABF5F@seespotcode.net
Whole thread Raw
In response to Re: BUG #3822: Nonstandard precedence for comparison operators  (Pedro Gimeno <pgsql-001@personal.formauri.es>)
Responses Re: BUG #3822: Nonstandard precedence for comparison operators
List pgsql-bugs
On Dec 29, 2007, at 14:09 , Pedro Gimeno wrote:

> variants of which I think can be
> relatively common compared to e.g. applications that build a boolean
> array using expr1 <> expr2 || boolean_value.

I'm probably being dense, but I don't see how this is an issue. || is
string concatenation, not a logical OR. You're going to throw an
error because || isn't a boolean operator, not because of any strange
precedence rules.

test=# select 1 <> 2 || true;
ERROR:  operator does not exist: boolean || boolean
LINE 1: select 1 <> 2 || true;
                       ^
HINT:  No operator matches the given name and argument type(s). You
may need to add explicit type casts.

test=# select 'foo'::text <> 'bar'::text || true;
ERROR:  operator does not exist: boolean || boolean
LINE 1: select 'foo'::text <> 'bar'::text || true;
                                           ^
HINT:  No operator matches the given name and argument type(s). You
may need to add explicit type casts.

Michael Glaesemann
grzm seespotcode net

pgsql-bugs by date:

Previous
From: Pedro Gimeno
Date:
Subject: Re: BUG #3822: Nonstandard precedence for comparison operators
Next
From: Tom Lane
Date:
Subject: Re: BUG #3822: Nonstandard precedence for comparison operators