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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-hackers by date

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