From: | "raajarshi (dot)" <raajarshi(at)sify(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | postgres C function returning SETOF record gives RECORD TYPE NOT REGISTERED |
Date: | 2009-06-04 22:23:46 |
Message-ID: | d82985110906041523p651e299et624f460892381a91@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi,
I am a rather new user of Postgresql. I have a problem with writing a C
function that returns a SETOF records.
My function will take a query as its lone parameter and will process this
query to create a new one. This new query will be executed and the results
returned.
I have written a C function which returns a SETOF record and takes a varchar
as input. There are no OUT parameters. I use SPI to execute the final query.
After that I have the tuple descriptor and an array of rows to return. When
I go to return the rows, I get the error 'RECORD TYPE HAS NOT BEEN
REGISTERED'.
I want to know if there is a way to dynamically determine the return type(
and to tell the caller function what to expect from this call) when I am
already inside the function. As far as I can see (though it is not too far)
we have all the information like result type etc after executing the final
query.
Are there any functions which take the tuple descriptor and OID of a
function and fill up all the leftover bits and pieces so that by the time
the function returns, every other thing is in place.
If someone thinks this solution can be implemented in some other way, please
suggest. Just to remind, the function will accept ANY query of any kind but
run a transformed query. So at the time of calling, we do not know what is
going to actually run but once we run it and have the results, we know
everything that is of consequence.
thanks
rajarshi
From | Date | Subject | |
---|---|---|---|
Next Message | raajarshi . | 2009-06-04 22:42:39 | Re: postgres C function returning SETOF record gives RECORD TYPE NOT REGISTERED |
Previous Message | Mohlomi Moloi | 2009-06-03 14:40:11 | Re: DatabaseMetaData |