Add some opr_sanity checks that the lengths of the various argument-info

arrays in a pg_proc entry match.  Seems like an easy mistake to make when
manually adjusting these values in a pg_proc.h entry.
This commit is contained in:
Tom Lane 2009-11-29 18:53:54 +00:00
parent e527d5010b
commit c19781ac3d
2 changed files with 81 additions and 0 deletions

View File

@ -275,6 +275,55 @@ WHERE p1.prorettype = 'internal'::regtype AND NOT
2304 | internal_in 2304 | internal_in
(1 row) (1 row)
-- Check for length inconsistencies between the various argument-info arrays.
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proallargtypes IS NOT NULL AND
array_length(proallargtypes,1) < array_length(proargtypes,1);
oid | proname
-----+---------
(0 rows)
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proargmodes IS NOT NULL AND
array_length(proargmodes,1) < array_length(proargtypes,1);
oid | proname
-----+---------
(0 rows)
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proargnames IS NOT NULL AND
array_length(proargnames,1) < array_length(proargtypes,1);
oid | proname
-----+---------
(0 rows)
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proallargtypes IS NOT NULL AND proargmodes IS NOT NULL AND
array_length(proallargtypes,1) <> array_length(proargmodes,1);
oid | proname
-----+---------
(0 rows)
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proallargtypes IS NOT NULL AND proargnames IS NOT NULL AND
array_length(proallargtypes,1) <> array_length(proargnames,1);
oid | proname
-----+---------
(0 rows)
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proargmodes IS NOT NULL AND proargnames IS NOT NULL AND
array_length(proargmodes,1) <> array_length(proargnames,1);
oid | proname
-----+---------
(0 rows)
-- **************** pg_cast **************** -- **************** pg_cast ****************
-- Catch bogus values in pg_cast columns (other than cases detected by -- Catch bogus values in pg_cast columns (other than cases detected by
-- oidjoins test). -- oidjoins test).

View File

@ -218,6 +218,38 @@ FROM pg_proc as p1
WHERE p1.prorettype = 'internal'::regtype AND NOT WHERE p1.prorettype = 'internal'::regtype AND NOT
'internal'::regtype = ANY (p1.proargtypes); 'internal'::regtype = ANY (p1.proargtypes);
-- Check for length inconsistencies between the various argument-info arrays.
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proallargtypes IS NOT NULL AND
array_length(proallargtypes,1) < array_length(proargtypes,1);
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proargmodes IS NOT NULL AND
array_length(proargmodes,1) < array_length(proargtypes,1);
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proargnames IS NOT NULL AND
array_length(proargnames,1) < array_length(proargtypes,1);
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proallargtypes IS NOT NULL AND proargmodes IS NOT NULL AND
array_length(proallargtypes,1) <> array_length(proargmodes,1);
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proallargtypes IS NOT NULL AND proargnames IS NOT NULL AND
array_length(proallargtypes,1) <> array_length(proargnames,1);
SELECT p1.oid, p1.proname
FROM pg_proc as p1
WHERE proargmodes IS NOT NULL AND proargnames IS NOT NULL AND
array_length(proargmodes,1) <> array_length(proargnames,1);
-- **************** pg_cast **************** -- **************** pg_cast ****************