mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
psql: Add option for procedures to \df
This commit is contained in:
@ -15,14 +15,6 @@ LANGUAGE SQL
|
||||
AS $$
|
||||
INSERT INTO cp_test VALUES (1, x);
|
||||
$$;
|
||||
SELECT ptest1('x'); -- error
|
||||
ERROR: ptest1(unknown) is a procedure
|
||||
LINE 1: SELECT ptest1('x');
|
||||
^
|
||||
HINT: To call a procedure, use CALL.
|
||||
CALL ptest1('a'); -- ok
|
||||
CALL ptest1('xy' || 'zzy'); -- ok, constant-folded arg
|
||||
CALL ptest1(substring(random()::numeric(20,15)::text, 1, 1)); -- ok, volatile arg
|
||||
\df ptest1
|
||||
List of functions
|
||||
Schema | Name | Result data type | Argument data types | Type
|
||||
@ -41,6 +33,30 @@ SELECT pg_get_functiondef('ptest1'::regproc);
|
||||
|
||||
(1 row)
|
||||
|
||||
-- show only normal functions
|
||||
\dfn public.*test*1
|
||||
List of functions
|
||||
Schema | Name | Result data type | Argument data types | Type
|
||||
--------+--------------+------------------+---------------------+------
|
||||
public | cp_testfunc1 | integer | a integer | func
|
||||
(1 row)
|
||||
|
||||
-- show only procedures
|
||||
\dfp public.*test*1
|
||||
List of functions
|
||||
Schema | Name | Result data type | Argument data types | Type
|
||||
--------+--------+------------------+---------------------+------
|
||||
public | ptest1 | | x text | proc
|
||||
(1 row)
|
||||
|
||||
SELECT ptest1('x'); -- error
|
||||
ERROR: ptest1(unknown) is a procedure
|
||||
LINE 1: SELECT ptest1('x');
|
||||
^
|
||||
HINT: To call a procedure, use CALL.
|
||||
CALL ptest1('a'); -- ok
|
||||
CALL ptest1('xy' || 'zzy'); -- ok, constant-folded arg
|
||||
CALL ptest1(substring(random()::numeric(20,15)::text, 1, 1)); -- ok, volatile arg
|
||||
SELECT * FROM cp_test ORDER BY b COLLATE "C";
|
||||
a | b
|
||||
---+-------
|
||||
|
@ -11,14 +11,20 @@ AS $$
|
||||
INSERT INTO cp_test VALUES (1, x);
|
||||
$$;
|
||||
|
||||
\df ptest1
|
||||
SELECT pg_get_functiondef('ptest1'::regproc);
|
||||
|
||||
-- show only normal functions
|
||||
\dfn public.*test*1
|
||||
|
||||
-- show only procedures
|
||||
\dfp public.*test*1
|
||||
|
||||
SELECT ptest1('x'); -- error
|
||||
CALL ptest1('a'); -- ok
|
||||
CALL ptest1('xy' || 'zzy'); -- ok, constant-folded arg
|
||||
CALL ptest1(substring(random()::numeric(20,15)::text, 1, 1)); -- ok, volatile arg
|
||||
|
||||
\df ptest1
|
||||
SELECT pg_get_functiondef('ptest1'::regproc);
|
||||
|
||||
SELECT * FROM cp_test ORDER BY b COLLATE "C";
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user