From: Neil Conway <[EMAIL PROTECTED]>
To: Pavel Stehule <[EMAIL PROTECTED]>
Subject: Re: [PATCHES] return can contains any row or record functions
Date: Mon, 07 Nov 2005 18:10:13 -0500
I'm confused by this part of the patch, circa line 1835 of pl_exec.c:
/* coerce type if needed */
if (estate->rsi && IsA(estate->rsi, ReturnSetInfo) &&
estate->rsi->expectedDesc != NULL &&
estate->retval = (Datum) make_tuple_from_tuple(estate,
if (estate->retval == PointerGetDatum(NULL))
estate->rettupdesc = estate->rsi->expectedDesc;
estate->retval = (Datum) heap_copytuple(&td);
estate->rettupdesc = in_tupdesc;
This is for the "tuple returning function" case of RETURN. estate->rsi
seems to contain information for set-returning functions -- why do we
need to use it to obtain the expected tupledesc of the function's return
value? I'm just wondering if we ought to be fetching this from somewhere
create anyfce() returns record|type ....
select anyfce0(); -- ok without conversion
select * from anyfce0() as (RSIX) --> PROBLEM1 without conversion (I have
rsix or rsiy)
create anyfce1() returns record ..
return next anyfce0()
select * from anyfce1() as (RSIY) --> PROBLEM2 without conversion
PL/pgSQL haven't statement for corversion, and I have to do it. I added
last this conversion when I did regress test. Generally I don't need this
variability without one exception: working with trigger variables NEW, OLD.
As it stands, this seems plainly wrong:
create type __trt as (x integer, y integer, z text);
create or replace function return_row4() returns __trt as $$
$$ language plpgsql;
the situation is clean in this example, but when I forward any diferent row
I can have problems. When I allowed only row function or row expression ()
all was ok. But it's havy limit, and I allowed any row or record function
--> need implicit conversion. And it's very propably so return next will
contain row function, no?
Sorry for my ugly english.
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly