vous cherchiez ce DO
déclaration :
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();
mais comme le suggère a_horse_with_no_name, vous pouvez simplement \c
pour se reconnecter avec psql