1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Update oidjoins regression test for v13.

We seem to have forgotten to do this in the v12 cycle, so add it as
a task in the RELEASE_CHANGES list, in hopes we won't forget again.

While here, fix findoidjoins.c so that it actually works in the
new dispensation where OID is a regular column, and change it to only
consider system relations (this avoids being fooled by the OID column
in the brintest test table).

Also tweak the largeobject test so that the somewhat-recently-added
manual creation of a LO with an OID in the system range doesn't
fool findoidjoins.c.  For the moment I just made that use an unused
OID, but we might have to find a more robust solution someday.
This commit is contained in:
Tom Lane
2020-05-09 13:05:08 -04:00
parent 89a7d21dfc
commit 6c298881c2
8 changed files with 101 additions and 14 deletions

View File

@ -80,6 +80,8 @@ but there may be reasons to do them at other times as well.
* Update Unicode data: Edit UNICODE_VERSION and CLDR_VERSION in
src/Makefile.global.in, run make update-unicode, and commit.
* Update the oidjoins regression test (see src/tools/findoidjoins/).
Starting a New Development Cycle
================================

View File

@ -180,15 +180,22 @@ Join pg_catalog.pg_statistic.staop2 => pg_catalog.pg_operator.oid
Join pg_catalog.pg_statistic.staop3 => pg_catalog.pg_operator.oid
Join pg_catalog.pg_statistic.staop4 => pg_catalog.pg_operator.oid
Join pg_catalog.pg_statistic.staop5 => pg_catalog.pg_operator.oid
Join pg_catalog.pg_statistic.stacoll1 => pg_catalog.pg_collation.oid
Join pg_catalog.pg_statistic.stacoll2 => pg_catalog.pg_collation.oid
Join pg_catalog.pg_statistic.stacoll3 => pg_catalog.pg_collation.oid
Join pg_catalog.pg_statistic.stacoll4 => pg_catalog.pg_collation.oid
Join pg_catalog.pg_statistic.stacoll5 => pg_catalog.pg_collation.oid
Join pg_catalog.pg_statistic_ext.stxrelid => pg_catalog.pg_class.oid
Join pg_catalog.pg_statistic_ext.stxnamespace => pg_catalog.pg_namespace.oid
Join pg_catalog.pg_statistic_ext.stxowner => pg_catalog.pg_authid.oid
Join pg_catalog.pg_statistic_ext_data.stxoid => pg_catalog.pg_statistic_ext.oid
Join pg_catalog.pg_tablespace.spcowner => pg_catalog.pg_authid.oid
Join pg_catalog.pg_transform.trftype => pg_catalog.pg_type.oid
Join pg_catalog.pg_transform.trflang => pg_catalog.pg_language.oid
Join pg_catalog.pg_transform.trffromsql => pg_catalog.pg_proc.oid
Join pg_catalog.pg_transform.trftosql => pg_catalog.pg_proc.oid
Join pg_catalog.pg_trigger.tgrelid => pg_catalog.pg_class.oid
Join pg_catalog.pg_trigger.tgparentid => pg_catalog.pg_trigger.oid
Join pg_catalog.pg_trigger.tgfoid => pg_catalog.pg_proc.oid
Join pg_catalog.pg_trigger.tgconstrrelid => pg_catalog.pg_class.oid
Join pg_catalog.pg_trigger.tgconstrindid => pg_catalog.pg_class.oid

View File

@ -7,6 +7,7 @@
*/
#include "postgres_fe.h"
#include "access/transam.h"
#include "catalog/pg_class_d.h"
#include "fe_utils/connect.h"
@ -55,18 +56,20 @@ main(int argc, char **argv)
}
PQclear(res);
/* Get a list of relations that have OIDs */
/* Get a list of system relations that have OIDs */
printfPQExpBuffer(&sql, "%s",
printfPQExpBuffer(&sql,
"SET search_path = public;"
"SELECT c.relname, (SELECT nspname FROM "
"pg_catalog.pg_namespace n WHERE n.oid = c.relnamespace) AS nspname "
"FROM pg_catalog.pg_class c "
"WHERE c.relkind = " CppAsString2(RELKIND_RELATION)
" AND c.oid < '%u'"
" AND EXISTS(SELECT * FROM pg_attribute a"
" WHERE a.attrelid = c.oid AND a.attname = 'oid' "
" AND a.atttypid = 'oid'::regtype)"
"ORDER BY nspname, c.relname"
"ORDER BY nspname, c.relname",
FirstNormalObjectId
);
res = PQexec(conn, sql.data);
@ -77,15 +80,17 @@ main(int argc, char **argv)
}
pkrel_res = res;
/* Get a list of columns of OID type (or any OID-alias type) */
/* Get a list of system columns of OID type (or any OID-alias type) */
printfPQExpBuffer(&sql, "%s",
printfPQExpBuffer(&sql,
"SELECT c.relname, "
"(SELECT nspname FROM pg_catalog.pg_namespace n WHERE n.oid = c.relnamespace) AS nspname, "
"a.attname "
"FROM pg_catalog.pg_class c, pg_catalog.pg_attribute a "
"WHERE a.attnum > 0"
" AND a.attname != 'oid'"
" AND c.relkind = " CppAsString2(RELKIND_RELATION)
" AND c.oid < '%u'"
" AND a.attrelid = c.oid"
" AND a.atttypid IN ('pg_catalog.oid'::regtype, "
" 'pg_catalog.regclass'::regtype, "
@ -96,7 +101,8 @@ main(int argc, char **argv)
" 'pg_catalog.regtype'::regtype, "
" 'pg_catalog.regconfig'::regtype, "
" 'pg_catalog.regdictionary'::regtype) "
"ORDER BY nspname, c.relname, a.attnum"
"ORDER BY nspname, c.relname, a.attnum",
FirstNormalObjectId
);
res = PQexec(conn, sql.data);