Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit35f059e

Browse files
committed
Add sanity check for pg_proc.provariadic
Check that the values from pg_proc.h match what ProcedureCreate wouldhave done.Robert Haas and Amul SulDiscussion:http://postgr.es/m/CA+TgmoZ_UGXfq5ygeDDMdUSJ4J_VX7nFnjC6mfY6BgOJ3qZCmw@mail.gmail.com
1 parent86182b1 commit35f059e

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

‎src/test/regress/expected/type_sanity.out

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,24 @@ WHERE p1.typinput = p2.oid AND NOT
129129
-----+---------+-----+---------
130130
(0 rows)
131131

132+
-- Check for type of the variadic array parameter's elements.
133+
-- provariadic should be ANYOID if the type of the last element is ANYOID,
134+
-- ANYELEMENTOID if the type of the last element is ANYARRAYOID, and otherwise
135+
-- the element type corresponding to the array type.
136+
SELECT oid::regprocedure, provariadic::regtype, proargtypes::regtype[]
137+
FROM pg_proc
138+
WHERE provariadic != 0
139+
AND case proargtypes[array_length(proargtypes, 1)-1]
140+
WHEN 2276 THEN 2276 -- any -> any
141+
WHEN 2277 THEN 2283 -- anyarray -> anyelement
142+
ELSE (SELECT t.oid
143+
FROM pg_type t
144+
WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
145+
END != provariadic;
146+
oid | provariadic | proargtypes
147+
-----+-------------+-------------
148+
(0 rows)
149+
132150
-- As of 8.0, this check finds refcursor, which is borrowing
133151
-- other types' I/O routines
134152
SELECT p1.oid, p1.typname, p2.oid, p2.proname

‎src/test/regress/sql/type_sanity.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,22 @@ WHERE p1.typinput = p2.oid AND NOT
104104
p2.proargtypes[1]='oid'::regtypeAND
105105
p2.proargtypes[2]='int4'::regtype));
106106

107+
-- Check for type of the variadic array parameter's elements.
108+
-- provariadic should be ANYOID if the type of the last element is ANYOID,
109+
-- ANYELEMENTOID if the type of the last element is ANYARRAYOID, and otherwise
110+
-- the element type corresponding to the array type.
111+
112+
SELECToid::regprocedure, provariadic::regtype, proargtypes::regtype[]
113+
FROM pg_proc
114+
WHERE provariadic!=0
115+
AND case proargtypes[array_length(proargtypes,1)-1]
116+
WHEN2276 THEN2276-- any -> any
117+
WHEN2277 THEN2283-- anyarray -> anyelement
118+
ELSE (SELECTt.oid
119+
FROM pg_type t
120+
WHEREt.typarray= proargtypes[array_length(proargtypes,1)-1])
121+
END!= provariadic;
122+
107123
-- As of 8.0, this check finds refcursor, which is borrowing
108124
-- other types' I/O routines
109125
SELECTp1.oid,p1.typname,p2.oid,p2.proname

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp