търсихте това DO
изявление:
CREATE TABLE p1(a INT, b TEXT);
CREATE OR REPLACE FUNCTION authenticate() RETURNS SETOF p1 as '
DECLARE
player_row p1;
BEGIN
-- query is more complicated but always returns zero or one rows
SELECT p.* INTO player_row
FROM p1 p;
IF FOUND THEN
RETURN NEXT player_row;
-- more code in here..
END IF;
RETURN;
END;' LANGUAGE plpgsql ROWS 1;
ALTER TABLE p1 ADD COLUMN c VARCHAR(2);
INSERT INTO p1 VALUES(1,'a', 'c');
do $$ begin execute pg_get_functiondef('authenticate'::regproc); end; $$;
SELECT * FROM AUTHENTICATE();
но както подсказва a_horse_with_no_name, можете просто \c
за да се свържете отново с psql