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

Re: comparing rows

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: comparing rows
Date: 2000-08-03 01:36:38
Message-ID: 3491.965266598@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp> writes:
> test=# select (1,2,null) = (1,2,null);
> ERROR:  Unable to identify an operator '=' for types 'unknown' and 'unknown'
> 	You will have to retype this query using an explicit cast

Well, there's no basis for deciding what the datatype of the third
column is.

The only reason you don't get the same error from the non-row case

regression=# select null = null;
 ?column?
----------
 t
(1 row)

is that we have an ugly, horrible kluge in the parser to (mis) interpret
"foo = null" as meaning "foo ISNULL", in order to be compatible with
broken Microsoft SQL implementations.  If you try any other operator
you get

regression=# select null <> null;
ERROR:  Unable to identify an operator '<>' for types 'unknown' and 'unknown'
        You will have to retype this query using an explicit cast

I'd certainly not vote to propagate the "= null" kluge into the
row-equality code...

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Thomas SwanDate: 2000-08-03 03:23:07
Subject: Re: [HACKERS] random() function produces wrong range
Previous:From: Tatsuo IshiiDate: 2000-08-03 01:09:07
Subject: comparing rows

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