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

Re: Inconsistent Errors on Row Comparisons

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inconsistent Errors on Row Comparisons
Date: 2009-06-30 18:00:26
Message-ID: 22966.1246384826@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
"David E. Wheeler" <david(at)kineticode(dot)com> writes:
> On Jun 30, 2009, at 10:28 AM, Tom Lane wrote:
>> Not for me:
>> 
>> regression=# VALUES (1, 2), (3, 4) EXCEPT VALUES (1), (3);
>> ERROR:  each EXCEPT query must have the same number of columns

> Turn on verbosity:

> try=# \set VERBOSITY verbose
> try=# VALUES (1, 2), (3, 4) EXCEPT VALUES (1), (3);
> ERROR:  42601: each EXCEPT query must have the same number of columns
> LOCATION:  transformSetOperationTree, analyze.c:1502

> 42601 is a SYNTAX ERROR.

Oh, you're complaining about the SQLSTATE not the error text.
I guess that to the extent that any actual thought went into it
(which may not have been much) the reasoning was that you'd have to
change the syntax of your query in order to fix this.  But I guess
a case could be made for ERRCODE_DATATYPE_MISMATCH there.  I definitely
do not agree with your suggestion of ERRCODE_TOO_MANY_COLUMNS --- that's
from Program Limit Exceeded category which is 100% the wrong thing.

The other errors are coming from within record_eq(), where what it's
got is two composite values that don't match as to structure.  It
seems fairly clear that DATATYPE_MISMATCH is the right thing there.

So if we feel that these errors should match, I'd vote for changing to
DATATYPE_MISMATCH, not changing to SYNTAX_ERROR.  But I'm not entirely
convinced that there's a reason to make them match.  I'm not sure that
they really have the same cause when you look at it concretely.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Heikki LinnakangasDate: 2009-06-30 18:04:23
Subject: Re: 8.5 development schedule
Previous:From: Heikki LinnakangasDate: 2009-06-30 17:57:49
Subject: Re: 8.5 development schedule

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