1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Add procedure support to pg_get_functiondef

This also makes procedures work in psql's \ef and \sf commands.

Reported-by: Pavel Stehule <pavel.stehule@gmail.com>
This commit is contained in:
Peter Eisentraut
2018-02-13 10:34:04 -05:00
parent 7cd56f218d
commit 7a32ac8a66
5 changed files with 38 additions and 14 deletions

View File

@ -30,6 +30,17 @@ CALL ptest1(substring(random()::text, 1, 1)); -- ok, volatile arg
public | ptest1 | | x text | proc
(1 row)
SELECT pg_get_functiondef('ptest1'::regproc);
pg_get_functiondef
---------------------------------------------------
CREATE OR REPLACE PROCEDURE public.ptest1(x text)+
LANGUAGE sql +
AS $procedure$ +
INSERT INTO cp_test VALUES (1, x); +
$procedure$ +
(1 row)
SELECT * FROM cp_test ORDER BY b COLLATE "C";
a | b
---+-------

View File

@ -17,6 +17,7 @@ CALL ptest1('xy' || 'zzy'); -- ok, constant-folded arg
CALL ptest1(substring(random()::text, 1, 1)); -- ok, volatile arg
\df ptest1
SELECT pg_get_functiondef('ptest1'::regproc);
SELECT * FROM cp_test ORDER BY b COLLATE "C";