Skip site navigation (1) Skip section navigation (2)

Re: comparing rows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Don Baccus <dhogaza(at)pacifier(dot)com>
Cc: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, Magnus Hagander <mha(at)sollentuna(dot)net>, Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: comparing rows
Date: 2000-08-03 14:23:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Don Baccus <dhogaza(at)pacifier(dot)com> writes:
> If foo = NULL is illegal, doesn't this make it rather difficult to
> say things like table1.i = table2.i for tables that contain NULLs
> in column i?

Thomas is not saying that the *operation* is illegal.  His point is
purely a syntactic one: SQL92 allows the keyword "NULL" only in certain
specified contexts, and out on its own as a component of an arithmetic
expression ain't one of them.  You could legally write the same thing in
at least two ways, though:


	foo = (CAST NULL AS somedatatype)

It may be that the SQL92 authors intended this restriction to avoid
having to figure out what datatype an unadorned NULL is.  Unfortunately
they blew it in the CASE case :-(, so you still have to have a way of
deciding that.

As far as I can see, allowing NULL as a general-purpose literal is a
perfectly reasonable spec extension that *everybody* does, including us.
Thomas may be the only person anywhere who is bothered by it ;-)

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Bruce MomjianDate: 2000-08-03 14:24:28
Subject: Re: comparing rows
Previous:From: Bruce MomjianDate: 2000-08-03 14:22:37
Subject: Re: comparing rows

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group