Re: Precedence of standard comparison operators

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Greg Stark <stark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Simon Riggs <simon(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Precedence of standard comparison operators
Date: 2015-03-11 22:19:39
Message-ID: 1197458545.112014.1426112379999.JavaMail.yahoo@mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> Can you, or can anyone, show a plausible example of something
> that would work under the old rules and work under the new rules
> but with a different meaning? I have to admit that I'm having
> some difficulty imagining exactly when that happens. Tom's
> examples upthread were not things that seemed all that likely.

I think very few will see any problems. At Wisconsin Courts we had
millions of lines of code when we moved to PostgreSQL and saw one
or two queries which had problems with this. The example I gave
earlier on this thread was:

| test=# select 'f'::boolean = 'f'::boolean >= 'f'::boolean;
| ?column?
| ----------
| f
| (1 row)

Now, that was a simple case for purposes of illustration, but
imagine that the first two literals are column names in a complex
query and it becomes slightly less ridiculous. Imagine they are
being passed in to some plpgsql function which accepts different
types, and the statement is run through EXECUTE and it may be
somewhat reasonable.

The upshot is that for at least 99% of shops turning this on will
not generate any warnings at all. So, the question is what is
better for the cases where it will actually matter?

Either way it is like leaving the barn door open so that horses are
capable of running out. We have an alarm that lets you know when
something is going through the barn door; the question is whether
to default that alarm on or off.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2015-03-11 22:22:24 Re: procost for to_tsvector
Previous Message Tomas Vondra 2015-03-11 22:14:52 Re: using CustomScan to inject nodes into the plan