Move provariadic sanity check to a more appropriate place
authorPeter Eisentraut <peter@eisentraut.org>
Thu, 15 Dec 2022 06:49:30 +0000 (07:49 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Thu, 15 Dec 2022 06:54:48 +0000 (07:54 +0100)
35f059e9bdfb3b14ac9d22a9e159d36ec0ccf804 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.

src/test/regress/expected/opr_sanity.out
src/test/regress/expected/type_sanity.out
src/test/regress/sql/opr_sanity.sql
src/test/regress/sql/type_sanity.sql

index 330eb0f7656bf6fdfb2bf10410c1c3d7b29a760f..02f5348ab1b5e8e9e25e186eef2df056d1da97b5 100644 (file)
@@ -472,6 +472,37 @@ WHERE proallargtypes IS NOT NULL AND
 -----+---------+-------------+----------------+-------------
 (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,
+-- ANYCOMPATIBLEOID if the type of the last element is ANYCOMPATIBLEARRAYOID,
+-- 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 '"any"'::regtype THEN '"any"'::regtype
+   WHEN 'anyarray'::regtype THEN 'anyelement'::regtype
+   WHEN 'anycompatiblearray'::regtype THEN 'anycompatible'::regtype
+   ELSE (SELECT t.oid
+         FROM pg_type t
+         WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
+   END  != provariadic;
+ oid | provariadic | proargtypes 
+-----+-------------+-------------
+(0 rows)
+
+-- Check that all and only those functions with a variadic type have
+-- a variadic argument.
+SELECT oid::regprocedure, proargmodes, provariadic
+FROM pg_proc
+WHERE (proargmodes IS NOT NULL AND 'v' = any(proargmodes))
+    IS DISTINCT FROM
+    (provariadic != 0);
+ oid | proargmodes | provariadic 
+-----+-------------+-------------
+(0 rows)
+
 -- Check for prosupport functions with the wrong signature
 SELECT p1.oid, p1.proname, p2.oid, p2.proname
 FROM pg_proc AS p1, pg_proc AS p2
index d3ac08c9ee3ee9e74c7a15ab74b2cac42e60abc8..a640cfc47694b4af676f2d92610054f979203d09 100644 (file)
@@ -132,37 +132,6 @@ WHERE t1.typinput = p1.oid AND NOT
 -----+---------+-----+---------
 (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,
--- ANYCOMPATIBLEOID if the type of the last element is ANYCOMPATIBLEARRAYOID,
--- 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 '"any"'::regtype THEN '"any"'::regtype
-   WHEN 'anyarray'::regtype THEN 'anyelement'::regtype
-   WHEN 'anycompatiblearray'::regtype THEN 'anycompatible'::regtype
-   ELSE (SELECT t.oid
-         FROM pg_type t
-         WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
-   END  != provariadic;
- oid | provariadic | proargtypes 
------+-------------+-------------
-(0 rows)
-
--- Check that all and only those functions with a variadic type have
--- a variadic argument.
-SELECT oid::regprocedure, proargmodes, provariadic
-FROM pg_proc
-WHERE (proargmodes IS NOT NULL AND 'v' = any(proargmodes))
-    IS DISTINCT FROM
-    (provariadic != 0);
- oid | proargmodes | provariadic 
------+-------------+-------------
-(0 rows)
-
 -- As of 8.0, this check finds refcursor, which is borrowing
 -- other types' I/O routines
 SELECT t1.oid, t1.typname, p1.oid, p1.proname
index 2b292851e3a1fea614fb635a813978000f5582ad..56b54ba9883dd27be415af311fc169d28e7e12e4 100644 (file)
@@ -344,6 +344,32 @@ WHERE proallargtypes IS NOT NULL AND
         FROM generate_series(1, array_length(proallargtypes, 1)) g(i)
         WHERE proargmodes IS NULL OR proargmodes[i] IN ('i', 'b', 'v'));
 
+-- 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,
+-- ANYCOMPATIBLEOID if the type of the last element is ANYCOMPATIBLEARRAYOID,
+-- 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 '"any"'::regtype THEN '"any"'::regtype
+   WHEN 'anyarray'::regtype THEN 'anyelement'::regtype
+   WHEN 'anycompatiblearray'::regtype THEN 'anycompatible'::regtype
+   ELSE (SELECT t.oid
+         FROM pg_type t
+         WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
+   END  != provariadic;
+
+-- Check that all and only those functions with a variadic type have
+-- a variadic argument.
+SELECT oid::regprocedure, proargmodes, provariadic
+FROM pg_proc
+WHERE (proargmodes IS NOT NULL AND 'v' = any(proargmodes))
+    IS DISTINCT FROM
+    (provariadic != 0);
+
 -- Check for prosupport functions with the wrong signature
 SELECT p1.oid, p1.proname, p2.oid, p2.proname
 FROM pg_proc AS p1, pg_proc AS p2
index 5edc1f1f6ed06b6df47e6b0092164e7220a79c98..79ec410a6ca0d02c2917684a6088d684d3ece512 100644 (file)
@@ -105,32 +105,6 @@ WHERE t1.typinput = p1.oid AND NOT
       p1.proargtypes[1] = 'oid'::regtype AND
       p1.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,
--- ANYCOMPATIBLEOID if the type of the last element is ANYCOMPATIBLEARRAYOID,
--- 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 '"any"'::regtype THEN '"any"'::regtype
-   WHEN 'anyarray'::regtype THEN 'anyelement'::regtype
-   WHEN 'anycompatiblearray'::regtype THEN 'anycompatible'::regtype
-   ELSE (SELECT t.oid
-         FROM pg_type t
-         WHERE t.typarray = proargtypes[array_length(proargtypes, 1)-1])
-   END  != provariadic;
-
--- Check that all and only those functions with a variadic type have
--- a variadic argument.
-SELECT oid::regprocedure, proargmodes, provariadic
-FROM pg_proc
-WHERE (proargmodes IS NOT NULL AND 'v' = any(proargmodes))
-    IS DISTINCT FROM
-    (provariadic != 0);
-
 -- As of 8.0, this check finds refcursor, which is borrowing
 -- other types' I/O routines
 SELECT t1.oid, t1.typname, p1.oid, p1.proname