Set proargmodes for satisfies_hash_partition.
authorRobert Haas <rhaas@postgresql.org>
Fri, 17 Nov 2017 16:53:00 +0000 (11:53 -0500)
committerRobert Haas <rhaas@postgresql.org>
Fri, 17 Nov 2017 16:53:00 +0000 (11:53 -0500)
It appears that proargmodes should always be set for variadic
functions, but satifies_hash_partition had it as NULL.  In addition to
fixing the problem, add a regression test to guard against future
mistakes of this type.

src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/test/regress/expected/type_sanity.out
src/test/regress/sql/type_sanity.sql

index bd4014a69d0bb57d2cd4db901077c11ac8ac050a..a30ce6b81d88265d69d22e0f3b77847ecbcf003c 100644 (file)
@@ -53,6 +53,6 @@
  */
 
 /*                         yyyymmddN */
-#define CATALOG_VERSION_NO 201711092
+#define CATALOG_VERSION_NO 201711171
 
 #endif
index 0330c04f169b914537c9fb3af9df82d65a38ec73..c9693759811f70a051ce28d0d2a513dfdccba087 100644 (file)
@@ -5523,7 +5523,7 @@ DATA(insert OID = 3354 (  pg_ls_waldir                 PGNSP PGUID 12 10 20 0 0 f f f f t t
 DESCR("list of files in the WAL directory");
 
 /* hash partitioning constraint function */
-DATA(insert OID = 5028 ( satisfies_hash_partition PGNSP PGUID 12 1 0 2276 0 f f f f f f i s 4 0 16 "26 23 23 2276" _null_ _null_ _null_ _null_ _null_ satisfies_hash_partition _null_ _null_ _null_ ));
+DATA(insert OID = 5028 ( satisfies_hash_partition PGNSP PGUID 12 1 0 2276 0 f f f f f f i s 4 0 16 "26 23 23 2276" _null_ "{i,i,i,v}" _null_ _null_ _null_ satisfies_hash_partition _null_ _null_ _null_ ));
 DESCR("hash partition CHECK constraint");
 
 /*
index c6440060dcbd3beccde10eda98d689a1fc3fa56b..b1419d4bc21dbd5b520a2cac69a740205e9dac63 100644 (file)
@@ -147,6 +147,17 @@ AND case proargtypes[array_length(proargtypes, 1)-1]
 -----+-------------+-------------
 (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 p1.oid, p1.typname, p2.oid, p2.proname
index 428c2d324dd9abb069bc7222dcd6c0c9239606a6..f9aeea32144f204427830ecf0cf95227a7a1c0fc 100644 (file)
@@ -120,6 +120,14 @@ AND case proargtypes[array_length(proargtypes, 1)-1]
          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 p1.oid, p1.typname, p2.oid, p2.proname