Skip to content

Commit 2613dec

Browse files
committed
Move provariadic sanity check to a more appropriate place
35f059e put the provariadic sanity check into type_sanity.sql, even though it's not about types, and moreover in the middle of some connected test group, which makes it all very confusing. Move it to opr_sanity.sql, where it is in better company.
1 parent 3b9d2de commit 2613dec

File tree

4 files changed

+57
-57
lines changed

4 files changed

+57
-57
lines changed

src/test/regress/expected/opr_sanity.out

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,37 @@ WHERE proallargtypes IS NOT NULL AND
472472
-----+---------+-------------+----------------+-------------
473473
(0 rows)
474474

475+
-- Check for type of the variadic array parameter's elements.
476+
-- provariadic should be ANYOID if the type of the last element is ANYOID,
477+
-- ANYELEMENTOID if the type of the last element is ANYARRAYOID,
478+
-- ANYCOMPATIBLEOID if the type of the last element is ANYCOMPATIBLEARRAYOID,
479+
-- and otherwise the element type corresponding to the array type.
480+
SELECT oid::regprocedure, provariadic::regtype, proargtypes::regtype[]
481+
FROM pg_proc
482+
WHERE provariadic != 0
483+
AND case proargtypes[array_length(proargtypes, 1)-1]
484+
WHEN '"any"'::regtype THEN '"any"'::regtype
485+
WHEN 'anyarray'::regtype THEN 'anyelement'::regtype
486+
WHEN 'anycompatiblearray'::regtype THEN 'anycompatible'::regtype
487+
ELSE (SELECT t.oid
488+
FROM pg_type t
489+
WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
490+
END != provariadic;
491+
oid | provariadic | proargtypes
492+
-----+-------------+-------------
493+
(0 rows)
494+
495+
-- Check that all and only those functions with a variadic type have
496+
-- a variadic argument.
497+
SELECT oid::regprocedure, proargmodes, provariadic
498+
FROM pg_proc
499+
WHERE (proargmodes IS NOT NULL AND 'v' = any(proargmodes))
500+
IS DISTINCT FROM
501+
(provariadic != 0);
502+
oid | proargmodes | provariadic
503+
-----+-------------+-------------
504+
(0 rows)
505+
475506
-- Check for prosupport functions with the wrong signature
476507
SELECT p1.oid, p1.proname, p2.oid, p2.proname
477508
FROM pg_proc AS p1, pg_proc AS p2

src/test/regress/expected/type_sanity.out

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -132,37 +132,6 @@ WHERE t1.typinput = p1.oid AND NOT
132132
-----+---------+-----+---------
133133
(0 rows)
134134

135-
-- Check for type of the variadic array parameter's elements.
136-
-- provariadic should be ANYOID if the type of the last element is ANYOID,
137-
-- ANYELEMENTOID if the type of the last element is ANYARRAYOID,
138-
-- ANYCOMPATIBLEOID if the type of the last element is ANYCOMPATIBLEARRAYOID,
139-
-- and otherwise the element type corresponding to the array type.
140-
SELECT oid::regprocedure, provariadic::regtype, proargtypes::regtype[]
141-
FROM pg_proc
142-
WHERE provariadic != 0
143-
AND case proargtypes[array_length(proargtypes, 1)-1]
144-
WHEN '"any"'::regtype THEN '"any"'::regtype
145-
WHEN 'anyarray'::regtype THEN 'anyelement'::regtype
146-
WHEN 'anycompatiblearray'::regtype THEN 'anycompatible'::regtype
147-
ELSE (SELECT t.oid
148-
FROM pg_type t
149-
WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
150-
END != provariadic;
151-
oid | provariadic | proargtypes
152-
-----+-------------+-------------
153-
(0 rows)
154-
155-
-- Check that all and only those functions with a variadic type have
156-
-- a variadic argument.
157-
SELECT oid::regprocedure, proargmodes, provariadic
158-
FROM pg_proc
159-
WHERE (proargmodes IS NOT NULL AND 'v' = any(proargmodes))
160-
IS DISTINCT FROM
161-
(provariadic != 0);
162-
oid | proargmodes | provariadic
163-
-----+-------------+-------------
164-
(0 rows)
165-
166135
-- As of 8.0, this check finds refcursor, which is borrowing
167136
-- other types' I/O routines
168137
SELECT t1.oid, t1.typname, p1.oid, p1.proname

src/test/regress/sql/opr_sanity.sql

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,32 @@ WHERE proallargtypes IS NOT NULL AND
344344
FROM generate_series(1, array_length(proallargtypes, 1)) g(i)
345345
WHERE proargmodes IS NULL OR proargmodes[i] IN ('i', 'b', 'v'));
346346

347+
-- Check for type of the variadic array parameter's elements.
348+
-- provariadic should be ANYOID if the type of the last element is ANYOID,
349+
-- ANYELEMENTOID if the type of the last element is ANYARRAYOID,
350+
-- ANYCOMPATIBLEOID if the type of the last element is ANYCOMPATIBLEARRAYOID,
351+
-- and otherwise the element type corresponding to the array type.
352+
353+
SELECT oid::regprocedure, provariadic::regtype, proargtypes::regtype[]
354+
FROM pg_proc
355+
WHERE provariadic != 0
356+
AND case proargtypes[array_length(proargtypes, 1)-1]
357+
WHEN '"any"'::regtype THEN '"any"'::regtype
358+
WHEN 'anyarray'::regtype THEN 'anyelement'::regtype
359+
WHEN 'anycompatiblearray'::regtype THEN 'anycompatible'::regtype
360+
ELSE (SELECT t.oid
361+
FROM pg_type t
362+
WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
363+
END != provariadic;
364+
365+
-- Check that all and only those functions with a variadic type have
366+
-- a variadic argument.
367+
SELECT oid::regprocedure, proargmodes, provariadic
368+
FROM pg_proc
369+
WHERE (proargmodes IS NOT NULL AND 'v' = any(proargmodes))
370+
IS DISTINCT FROM
371+
(provariadic != 0);
372+
347373
-- Check for prosupport functions with the wrong signature
348374
SELECT p1.oid, p1.proname, p2.oid, p2.proname
349375
FROM pg_proc AS p1, pg_proc AS p2

src/test/regress/sql/type_sanity.sql

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -105,32 +105,6 @@ WHERE t1.typinput = p1.oid AND NOT
105105
p1.proargtypes[1] = 'oid'::regtype AND
106106
p1.proargtypes[2] = 'int4'::regtype));
107107

108-
-- Check for type of the variadic array parameter's elements.
109-
-- provariadic should be ANYOID if the type of the last element is ANYOID,
110-
-- ANYELEMENTOID if the type of the last element is ANYARRAYOID,
111-
-- ANYCOMPATIBLEOID if the type of the last element is ANYCOMPATIBLEARRAYOID,
112-
-- and otherwise the element type corresponding to the array type.
113-
114-
SELECT oid::regprocedure, provariadic::regtype, proargtypes::regtype[]
115-
FROM pg_proc
116-
WHERE provariadic != 0
117-
AND case proargtypes[array_length(proargtypes, 1)-1]
118-
WHEN '"any"'::regtype THEN '"any"'::regtype
119-
WHEN 'anyarray'::regtype THEN 'anyelement'::regtype
120-
WHEN 'anycompatiblearray'::regtype THEN 'anycompatible'::regtype
121-
ELSE (SELECT t.oid
122-
FROM pg_type t
123-
WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
124-
END != provariadic;
125-
126-
-- Check that all and only those functions with a variadic type have
127-
-- a variadic argument.
128-
SELECT oid::regprocedure, proargmodes, provariadic
129-
FROM pg_proc
130-
WHERE (proargmodes IS NOT NULL AND 'v' = any(proargmodes))
131-
IS DISTINCT FROM
132-
(provariadic != 0);
133-
134108
-- As of 8.0, this check finds refcursor, which is borrowing
135109
-- other types' I/O routines
136110
SELECT t1.oid, t1.typname, p1.oid, p1.proname

0 commit comments

Comments
 (0)