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

Better error message for select_common_type()

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Better error message for select_common_type()
Date: 2007-04-23 20:55:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
So I was informed today that UNION types integer and text cannot be 
matched.  Alright, but it failed to tell which particular expressions 
in this 3-branch, 30-columns-each UNION clause in a 100-line statement 
it was talking about.  So I made the attached patch to give some better 
pointers.  Example:

peter=# values(0,1), (1::bigint,2), ('text'::text,3);
ERROR:  42804: VALUES types bigint at position 2 and text at position 3 
cannot be matched in instance 1

I'm not sure about the terminology "position" and "instance"; they're 
just two coordinates to get at the problem.

None of this will help if you have multiple unrelated clauses that 
invoke select_common_type(), but that might be better handled using the 
parser location mechanism.


Peter Eisentraut

Attachment: select-common-type-with-position.patch
Description: text/x-diff (6.7 KB)


pgsql-hackers by date

Next:From: William LawranceDate: 2007-04-23 21:02:04
Subject: Re: BUG #3244: problem with PREPARE
Previous:From: Neil ConwayDate: 2007-04-23 20:49:20
Subject: Re: Improving deadlock error messages

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