pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: pgsql-bugs@postgresql.org
Cc: Rikard Pavelic <rikard.pavelic@zg.htnet.hr>
Subject: Re: BUG #6701: IS NOT NULL doesn't work on complex composites
Date: Thu, 21 Jun 2012 14:27:53 -0500
Message-ID: <4FE32F6902000025000488BD@gw.wicourts.gov> (raw)
In-Reply-To: <29240.1340303032@sss.pgh.pa.us>
References: <E1ShNDt-00005k-8t@wrigleys.postgresql.org>
	<2782.1340219454@sss.pgh.pa.us>
	<4FE267D7.9080202@zg.htnet.hr>
	<CAFj8pRC461r19_JJ8n=O4XZsTqhjnH+nHTY723C+_FuGoRYAGg@mail.gmail.com>
	<4FE2B6FC.5070301@zg.htnet.hr>
	<4FE2E9710200002500048881@gw.wicourts.gov>
	<26035.1340292130@sss.pgh.pa.us>
	<4FE316E602000025000488B1@gw.wicourts.gov>
	<29240.1340303032@sss.pgh.pa.us>

Tom Lane <tgl@sss.pgh.pa.us> wrote:
 
> The reason I mentioned arrays is that it seems clear to me that
> nobody sane would consider ARRAY[NULL,NULL]::int[] to be
> equivalent to NULL::int[].
 
I will defer on that to anyone who has been in a position where the
former has any meaningful semantics in a SQL environment; that is a
set of people which does not include me.
 
> So I think the standard is not being very bright by conflating a
> null container with a container full of nulls in the ROW case.
 
I'm pretty sure that Codd argued that any attempt to create such a
row within a relation should be treated as an error; I tend to
agree.  I'm far less clear on the semantics of a row value which is
not a top-level tuple of a relation.  That seems like it's in a gray
area between set theory and practical details of procedural
programming.  There are bound to be a few things in that realm which
don't make sense when viewed from one perspective or the other. 
While I might not have chosen to draw the lines where the standard
does, they did make choices that allow reasonable things to be done
in a wide variety of cases, which is, IMO, the most important thing.
 
> I'm willing to hold my nose and do what they say for the specific
> case of "foo IS NULL" and "foo IS NOT NULL" expressions, but I'm
> not eager to let that confusion propagate anyplace else.
 
Not having used arrays in SQL, I don't feel able to offer much
opinion on implementation details; just the general opinion that we
should try to allow reasonable things to be done in a wide variety
of cases.  Where it's possible to do that and have behavior which is
easy to explain, all the better.  The vast majority of problematic
SQL code that I've seen is a direct consequence of programmers using
procedural code where they could have used declarative code, so I
would tend to stress clean and complete set operations over
concessions to procedural coding.
 
I'll stop waving my hands around now.
 
-Kevin



view thread (14+ messages)

Message-ID: <4FE32F6902000025000488BD@gw.wicourts.gov>
Permalink:  ../4FE32F6902000025000488BD@gw.wicourts.gov/
Also on:    postgresql.org/message-id/4FE32F6902000025000488BD@gw.wicourts.gov

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, tgl@sss.pgh.pa.us, pavel.stehule@gmail.com, rikard.pavelic@zg.htnet.hr
  Subject: Re: BUG #6701: IS NOT NULL doesn't work on complex composites
  In-Reply-To: <4FE32F6902000025000488BD@gw.wicourts.gov>
  References: <E1ShNDt-00005k-8t@wrigleys.postgresql.org> <2782.1340219454@sss.pgh.pa.us> <4FE267D7.9080202@zg.htnet.hr> <CAFj8pRC461r19_JJ8n=O4XZsTqhjnH+nHTY723C+_FuGoRYAGg@mail.gmail.com> <4FE2B6FC.5070301@zg.htnet.hr> <4FE2E9710200002500048881@gw.wicourts.gov> <26035.1340292130@sss.pgh.pa.us> <4FE316E602000025000488B1@gw.wicourts.gov> <29240.1340303032@sss.pgh.pa.us> <4FE32F6902000025000488BD@gw.wicourts.gov>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox