mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-02 03:21:14 +02:00
Add sanity check for pg_proc.provariadic
Check that the values from pg_proc.h match what ProcedureCreate would have done. Robert Haas and Amul Sul Discussion: http://postgr.es/m/CA+TgmoZ_UGXfq5ygeDDMdUSJ4J_VX7nFnjC6mfY6BgOJ3qZCmw@mail.gmail.com
This commit is contained in:
parent
86182b1895
commit
35f059e9bd
@ -129,6 +129,24 @@ WHERE p1.typinput = p2.oid AND NOT
|
|||||||
-----+---------+-----+---------
|
-----+---------+-----+---------
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
|
-- Check for type of the variadic array parameter's elements.
|
||||||
|
-- provariadic should be ANYOID if the type of the last element is ANYOID,
|
||||||
|
-- ANYELEMENTOID if the type of the last element is ANYARRAYOID, and otherwise
|
||||||
|
-- the element type corresponding to the array type.
|
||||||
|
SELECT oid::regprocedure, provariadic::regtype, proargtypes::regtype[]
|
||||||
|
FROM pg_proc
|
||||||
|
WHERE provariadic != 0
|
||||||
|
AND case proargtypes[array_length(proargtypes, 1)-1]
|
||||||
|
WHEN 2276 THEN 2276 -- any -> any
|
||||||
|
WHEN 2277 THEN 2283 -- anyarray -> anyelement
|
||||||
|
ELSE (SELECT t.oid
|
||||||
|
FROM pg_type t
|
||||||
|
WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
|
||||||
|
END != provariadic;
|
||||||
|
oid | provariadic | proargtypes
|
||||||
|
-----+-------------+-------------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
-- As of 8.0, this check finds refcursor, which is borrowing
|
-- As of 8.0, this check finds refcursor, which is borrowing
|
||||||
-- other types' I/O routines
|
-- other types' I/O routines
|
||||||
SELECT p1.oid, p1.typname, p2.oid, p2.proname
|
SELECT p1.oid, p1.typname, p2.oid, p2.proname
|
||||||
|
@ -104,6 +104,22 @@ WHERE p1.typinput = p2.oid AND NOT
|
|||||||
p2.proargtypes[1] = 'oid'::regtype AND
|
p2.proargtypes[1] = 'oid'::regtype AND
|
||||||
p2.proargtypes[2] = 'int4'::regtype));
|
p2.proargtypes[2] = 'int4'::regtype));
|
||||||
|
|
||||||
|
-- Check for type of the variadic array parameter's elements.
|
||||||
|
-- provariadic should be ANYOID if the type of the last element is ANYOID,
|
||||||
|
-- ANYELEMENTOID if the type of the last element is ANYARRAYOID, and otherwise
|
||||||
|
-- the element type corresponding to the array type.
|
||||||
|
|
||||||
|
SELECT oid::regprocedure, provariadic::regtype, proargtypes::regtype[]
|
||||||
|
FROM pg_proc
|
||||||
|
WHERE provariadic != 0
|
||||||
|
AND case proargtypes[array_length(proargtypes, 1)-1]
|
||||||
|
WHEN 2276 THEN 2276 -- any -> any
|
||||||
|
WHEN 2277 THEN 2283 -- anyarray -> anyelement
|
||||||
|
ELSE (SELECT t.oid
|
||||||
|
FROM pg_type t
|
||||||
|
WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
|
||||||
|
END != provariadic;
|
||||||
|
|
||||||
-- As of 8.0, this check finds refcursor, which is borrowing
|
-- As of 8.0, this check finds refcursor, which is borrowing
|
||||||
-- other types' I/O routines
|
-- other types' I/O routines
|
||||||
SELECT p1.oid, p1.typname, p2.oid, p2.proname
|
SELECT p1.oid, p1.typname, p2.oid, p2.proname
|
||||||
|
Loading…
Reference in New Issue
Block a user