On 4/18/15 12:47 AM, David G. Johnston wrote:
If you could find a way to pass a value of type some_table into the
function - instead of the name/text 'some_table‘ - you could possibly
use polymorphic pseudotypes...just imagining here...
Oh, I didn't think about that. Maybe I'll try it.
What I ended up with is this:
CREATE FUNCTION ... (
) RETURNS SETOF text ...
...
RETURN QUERY EXECUTE format(
'SELECT row(t.*)::text FROM %I.%I AS t'
, ...
);
So the function is getting a record and casting it to text. To call the
function you have to...
SELECT (function(...))::name_of_table).*
that gives you the same output as if you'd selected directly from the table.
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general