Re: comparing NEW and OLD (any good this way?) - Mailing list pgsql-general

From Sam Mason
Subject Re: comparing NEW and OLD (any good this way?)
Date
Msg-id 20090818104220.GM5407@samason.me.uk
Whole thread Raw
In response to Re: comparing NEW and OLD (any good this way?)  ("Daniel Verite" <daniel@manitou-mail.org>)
Responses Re: comparing NEW and OLD (any good this way?)  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-general
On Tue, Aug 18, 2009 at 10:32:35AM +0200, Daniel Verite wrote:
> Sam Mason wrote:
> > I've just realized another case where it's not consistent; why does the
> > following return true:
> >
> >   SELECT row(null) IS NULL;
> >
> > and yet the following false:
> >
> >   SELECT row(row(null)) IS NULL;
>
> You're intentionally assuming that row(null) IS NULL evaluating to true
> implies that row(null) can be replaced by NULL. As discussed upthread, this
> is not the case.

But you've still not said how is this useful!  I can reformulate maths
so that 1+0 <> 1+(0), but this is not useful behavior.  Programmers
need logical abstractions upon which to build and without them you end
up with even more bugs.

> > I think I'm saying that PG should be deliberately breaking specified
> > behavior and go back to pre-8.2 behavior in this regard.
>
> But let's run your example with 8.1:
>
> # SELECT row(null) IS NULL;
>  ?column?
> ----------
>  t
>
> # SELECT row(row(null)) IS NULL;
>  ?column?
> ----------
>  f
>
> These are the same results that you say are inconsistant, so pre-8.2 behavior
> doesn't help here...

Doh, that'll learn me--I never actually tried older versions.  I was
just repeating what the docs said about the behavior changing in 8.2.

  http://www.postgresql.org/docs/current/static/functions-comparison.html#AEN7444

and was mis-interpreting what it was saying.

--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: design, plpgsql and sql injection in dynamically generated sql
Next
From: Sam Mason
Date:
Subject: Re: 2 versions of Postgres on the same machine