From a0f9358149b78c62871a0b7d3c167b78f9b2c77e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 23 Apr 2014 21:21:05 -0400 Subject: Fix incorrect pg_proc.proallargtypes entries for two built-in functions. pg_sequence_parameters() and pg_identify_object() have had incorrect proallargtypes entries since 9.1 and 9.3 respectively. This was mostly masked by the correct information in proargtypes, but a few operations such as pg_get_function_arguments() (and thus psql's \df display) would show the wrong data types for these functions' input parameters. In HEAD, fix the wrong info, bump catversion, and add an opr_sanity regression test to catch future mistakes of this sort. In the back branches, just fix the wrong info so that installations initdb'd with future minor releases will have the right data. We can't force an initdb, and it doesn't seem like a good idea to add a regression test that will fail on existing installations. Andres Freund --- src/test/regress/expected/opr_sanity.out | 12 ++++++++++++ src/test/regress/sql/opr_sanity.sql | 9 +++++++++ 2 files changed, 21 insertions(+) (limited to 'src/test') diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index 42f712790ba..886e68a603c 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -364,6 +364,18 @@ WHERE proargmodes IS NOT NULL AND proargnames IS NOT NULL AND -----+--------- (0 rows) +-- Check that proallargtypes matches proargtypes +SELECT p1.oid, p1.proname, p1.proargtypes, p1.proallargtypes, p1.proargmodes +FROM pg_proc as p1 +WHERE proallargtypes IS NOT NULL AND + ARRAY(SELECT unnest(proargtypes)) <> + ARRAY(SELECT proallargtypes[i] + FROM generate_series(1, array_length(proallargtypes, 1)) g(i) + WHERE proargmodes IS NULL OR proargmodes[i] IN ('i', 'b', 'v')); + oid | proname | proargtypes | proallargtypes | proargmodes +-----+---------+-------------+----------------+------------- +(0 rows) + -- Check for protransform functions with the wrong signature SELECT p1.oid, p1.proname, p2.oid, p2.proname FROM pg_proc AS p1, pg_proc AS p2 diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql index 2cf6fc8ac32..a932ff2788b 100644 --- a/src/test/regress/sql/opr_sanity.sql +++ b/src/test/regress/sql/opr_sanity.sql @@ -276,6 +276,15 @@ FROM pg_proc as p1 WHERE proargmodes IS NOT NULL AND proargnames IS NOT NULL AND array_length(proargmodes,1) <> array_length(proargnames,1); +-- Check that proallargtypes matches proargtypes +SELECT p1.oid, p1.proname, p1.proargtypes, p1.proallargtypes, p1.proargmodes +FROM pg_proc as p1 +WHERE proallargtypes IS NOT NULL AND + ARRAY(SELECT unnest(proargtypes)) <> + ARRAY(SELECT proallargtypes[i] + FROM generate_series(1, array_length(proallargtypes, 1)) g(i) + WHERE proargmodes IS NULL OR proargmodes[i] IN ('i', 'b', 'v')); + -- Check for protransform functions with the wrong signature SELECT p1.oid, p1.proname, p2.oid, p2.proname FROM pg_proc AS p1, pg_proc AS p2 -- cgit v1.2.3