Nun möchte ich die folgende Funktion auf eine Tabelle anwenden.
CREATE OR REPLACE FUNCTION tst (text) RETURNS record AS $$ DECLARE result record; BEGIN SELECT INTO result 5 AS id, $1 AS name, 'C'::char AS typ; return result; END; $$ LANGUAGE 'plpgsql';
CREATE TABLE tsttab( tsttext text );INSERT INTO tsttab (tsttext) VALUES ('TestText');
Ein
SELECT tst(tsttext) FROM tsttab;
erzeugt natürlich nur
tst
(5,TestText,C)
Aussehen soll es wieder so.
id | name | typ
----±---------±----
5 | TestText | C
Dank und Gruß - Ronny