Re: Problem with return type of function ??? (corrected)

From: Denis BUCHER <dbucherml(at)hsolutions(dot)ch>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem with return type of function ??? (corrected)
Date: 2009-10-22 15:15:20
Message-ID: 4AE07708.7020506@hsolutions.ch
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Tom,

Another question :

Tom Lane a écrit :
> Denis BUCHER <dbucherml(at)hsolutions(dot)ch> writes:
>> I have a strange problem, because it worked in a fonction for a table,
>> and now I created the same (?) function for another table and it doesn't
>> work...
>
>> The function is accepted but at runtime I get :
>
>> ERREUR: wrong record type supplied in RETURN NEXT
>> CONTEXTE : PL/pgSQL function "find_sn_live" line 26 at return next
>
> Does that table have any dropped columns? If you don't remember
> whether you ever dropped any columns, a quick look into pg_attribute
> will tell you:
> select attname from pg_attribute where attrelid = 'rma.serial_number'::regclass;
>
> plpgsql isn't tremendously good with rowtypes that contain dropped
> columns. I believe this particular case is fixed in CVS HEAD, but the
> patch was a bit invasive and won't get back-ported to existing releases.
> The workaround is to drop and recreate the table without any dropped
> columns.

To do this it will be a little complicated because of table
dependencies... And it could bug again at the next DROP COLUMN... Is
there a way to change my function (RETURN SETOF part) to specify the
column names/types ?

Thanks a lot again

Denis

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2009-10-22 15:47:13 Re: Problem with return type of function ??? (corrected)
Previous Message Richard Huxton 2009-10-22 15:06:47 Re: Problem with return type of function ??? (corrected)