Commit 96d175e3 authored by Tom Lane's avatar Tom Lane

Fix findoidjoins to recognize oidvector columns.

Somehow we'd never noticed this oversight, even though it means
that such basic columns as pg_proc.proargtypes were not being
validated by the oidjoins test.  Correct the query and update
the test script with the newly-found dependencies.
parent ebeb3dea
...@@ -1401,6 +1401,46 @@ WHERE conexclop != 0 AND ...@@ -1401,6 +1401,46 @@ WHERE conexclop != 0 AND
------+----------- ------+-----------
(0 rows) (0 rows)
SELECT ctid, indcollation
FROM (SELECT ctid, unnest(indcollation) AS indcollation FROM pg_catalog.pg_index) fk
WHERE indcollation != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.indcollation);
ctid | indcollation
------+--------------
(0 rows)
SELECT ctid, indclass
FROM (SELECT ctid, unnest(indclass) AS indclass FROM pg_catalog.pg_index) fk
WHERE indclass != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opclass pk WHERE pk.oid = fk.indclass);
ctid | indclass
------+----------
(0 rows)
SELECT ctid, partclass
FROM (SELECT ctid, unnest(partclass) AS partclass FROM pg_catalog.pg_partitioned_table) fk
WHERE partclass != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opclass pk WHERE pk.oid = fk.partclass);
ctid | partclass
------+-----------
(0 rows)
SELECT ctid, partcollation
FROM (SELECT ctid, unnest(partcollation) AS partcollation FROM pg_catalog.pg_partitioned_table) fk
WHERE partcollation != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.partcollation);
ctid | partcollation
------+---------------
(0 rows)
SELECT ctid, proargtypes
FROM (SELECT ctid, unnest(proargtypes) AS proargtypes FROM pg_catalog.pg_proc) fk
WHERE proargtypes != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.proargtypes);
ctid | proargtypes
------+-------------
(0 rows)
SELECT ctid, proallargtypes SELECT ctid, proallargtypes
FROM (SELECT ctid, unnest(proallargtypes) AS proallargtypes FROM pg_catalog.pg_proc) fk FROM (SELECT ctid, unnest(proallargtypes) AS proallargtypes FROM pg_catalog.pg_proc) fk
WHERE proallargtypes != 0 AND WHERE proallargtypes != 0 AND
......
...@@ -701,6 +701,26 @@ SELECT ctid, conexclop ...@@ -701,6 +701,26 @@ SELECT ctid, conexclop
FROM (SELECT ctid, unnest(conexclop) AS conexclop FROM pg_catalog.pg_constraint) fk FROM (SELECT ctid, unnest(conexclop) AS conexclop FROM pg_catalog.pg_constraint) fk
WHERE conexclop != 0 AND WHERE conexclop != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.conexclop); NOT EXISTS(SELECT 1 FROM pg_catalog.pg_operator pk WHERE pk.oid = fk.conexclop);
SELECT ctid, indcollation
FROM (SELECT ctid, unnest(indcollation) AS indcollation FROM pg_catalog.pg_index) fk
WHERE indcollation != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.indcollation);
SELECT ctid, indclass
FROM (SELECT ctid, unnest(indclass) AS indclass FROM pg_catalog.pg_index) fk
WHERE indclass != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opclass pk WHERE pk.oid = fk.indclass);
SELECT ctid, partclass
FROM (SELECT ctid, unnest(partclass) AS partclass FROM pg_catalog.pg_partitioned_table) fk
WHERE partclass != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_opclass pk WHERE pk.oid = fk.partclass);
SELECT ctid, partcollation
FROM (SELECT ctid, unnest(partcollation) AS partcollation FROM pg_catalog.pg_partitioned_table) fk
WHERE partcollation != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_collation pk WHERE pk.oid = fk.partcollation);
SELECT ctid, proargtypes
FROM (SELECT ctid, unnest(proargtypes) AS proargtypes FROM pg_catalog.pg_proc) fk
WHERE proargtypes != 0 AND
NOT EXISTS(SELECT 1 FROM pg_catalog.pg_type pk WHERE pk.oid = fk.proargtypes);
SELECT ctid, proallargtypes SELECT ctid, proallargtypes
FROM (SELECT ctid, unnest(proallargtypes) AS proallargtypes FROM pg_catalog.pg_proc) fk FROM (SELECT ctid, unnest(proallargtypes) AS proallargtypes FROM pg_catalog.pg_proc) fk
WHERE proallargtypes != 0 AND WHERE proallargtypes != 0 AND
......
...@@ -235,6 +235,11 @@ Join pg_catalog.pg_constraint.conpfeqop []=> pg_catalog.pg_operator.oid ...@@ -235,6 +235,11 @@ Join pg_catalog.pg_constraint.conpfeqop []=> pg_catalog.pg_operator.oid
Join pg_catalog.pg_constraint.conppeqop []=> pg_catalog.pg_operator.oid Join pg_catalog.pg_constraint.conppeqop []=> pg_catalog.pg_operator.oid
Join pg_catalog.pg_constraint.conffeqop []=> pg_catalog.pg_operator.oid Join pg_catalog.pg_constraint.conffeqop []=> pg_catalog.pg_operator.oid
Join pg_catalog.pg_constraint.conexclop []=> pg_catalog.pg_operator.oid Join pg_catalog.pg_constraint.conexclop []=> pg_catalog.pg_operator.oid
Join pg_catalog.pg_index.indcollation []=> pg_catalog.pg_collation.oid
Join pg_catalog.pg_index.indclass []=> pg_catalog.pg_opclass.oid
Join pg_catalog.pg_partitioned_table.partclass []=> pg_catalog.pg_opclass.oid
Join pg_catalog.pg_partitioned_table.partcollation []=> pg_catalog.pg_collation.oid
Join pg_catalog.pg_proc.proargtypes []=> pg_catalog.pg_type.oid
Join pg_catalog.pg_proc.proallargtypes []=> pg_catalog.pg_type.oid Join pg_catalog.pg_proc.proallargtypes []=> pg_catalog.pg_type.oid
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
......
...@@ -59,7 +59,6 @@ main(int argc, char **argv) ...@@ -59,7 +59,6 @@ main(int argc, char **argv)
/* Get a list of system relations that have OIDs */ /* Get a list of system relations that have OIDs */
printfPQExpBuffer(&sql, printfPQExpBuffer(&sql,
"SET search_path = public;"
"SELECT c.relname, (SELECT nspname FROM " "SELECT c.relname, (SELECT nspname FROM "
"pg_catalog.pg_namespace n WHERE n.oid = c.relnamespace) AS nspname " "pg_catalog.pg_namespace n WHERE n.oid = c.relnamespace) AS nspname "
"FROM pg_catalog.pg_class c " "FROM pg_catalog.pg_class c "
...@@ -170,6 +169,7 @@ main(int argc, char **argv) ...@@ -170,6 +169,7 @@ main(int argc, char **argv)
" AND c.relkind = " CppAsString2(RELKIND_RELATION) " AND c.relkind = " CppAsString2(RELKIND_RELATION)
" AND a.attrelid = c.oid" " AND a.attrelid = c.oid"
" AND a.atttypid IN ('pg_catalog.oid[]'::regtype, " " AND a.atttypid IN ('pg_catalog.oid[]'::regtype, "
" 'pg_catalog.oidvector'::regtype, "
" 'pg_catalog.regclass[]'::regtype, " " 'pg_catalog.regclass[]'::regtype, "
" 'pg_catalog.regoper[]'::regtype, " " 'pg_catalog.regoper[]'::regtype, "
" 'pg_catalog.regoperator[]'::regtype, " " 'pg_catalog.regoperator[]'::regtype, "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment