Verbosity of column definition mismatch error

From: Brendan Jurd <blakjak(at)blakjak(dot)sytes(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Verbosity of column definition mismatch error
Date: 2005-01-10 21:51:08
Message-ID: 41E2F8CC.8060101@blakjak.sytes.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Originally posted in psql-general, submitted here as a prospective RFE:

When using a row-returning function (RETURNS SETOF record) in the FROM
clause of a query, you have to supply a column definition list. I was
recently attempting to use a row-returning function in a query and
received the following error message:

ERROR: query-specified return row and actual function return row do not
match

The function in question returned 8 columns, some of which used fairly
lengthy expressions, and it took me quite a while to track down the
problem -- it turned out that a column I was expecting to be 'text' was
actually 'varchar(10)'. In complex queries, isolating a single type
mismatch can be something of a chore.

With that in mind, I'd like to submit a request, that the verbosity of
this error message be increased to explain which ordinal column position
the error occurred at, and, if possible, the details of the mismatch.
In my case, a secondary message saying something like "function foo()
column 4 returned type varchar(10), but column definition specifies type
text" would have made the debugging process very smooth.

Is this a reasonable suggestion?

Regards
BJ

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2005-01-10 22:30:36 Returning multiple rowsets from a function
Previous Message Tom Lane 2005-01-10 19:37:44 Re: PG 8.0: the launch clock is running