postgresql/contrib/sepgsql
Tom Lane 2d7d946cd3 Clean up the behavior and API of catalog.c's is-catalog-relation tests.
The right way for IsCatalogRelation/Class to behave is to return true
for OIDs less than FirstBootstrapObjectId (not FirstNormalObjectId),
without any of the ad-hoc fooling around with schema membership.

The previous code was wrong because (1) it claimed that
information_schema tables were not catalog relations but their toast
tables were, which is silly; and (2) if you dropped and recreated
information_schema, which is a supported operation, the behavior
changed.  That's even sillier.  With this definition, "catalog
relations" are exactly the ones traceable to the postgres.bki data,
which seems like what we want.

With this simplification, we don't actually need access to the pg_class
tuple to identify a catalog relation; we only need its OID.  Hence,
replace IsCatalogClass with "IsCatalogRelationOid(oid)".  But keep
IsCatalogRelation as a convenience function.

This allows fixing some arguably-wrong semantics in contrib/sepgsql and
ReindexRelationConcurrently, which were using an IsSystemNamespace test
where what they really should be using is IsCatalogRelationOid.  The
previous coding failed to protect toast tables of system catalogs, and
also was not on board with the general principle that user-created tables
do not become catalogs just by virtue of being renamed into pg_catalog.
We can also get rid of a messy hack in ReindexMultipleTables.

While we're at it, also rename IsSystemNamespace to IsCatalogNamespace,
because the previous name invited confusion with the more expansive
semantics used by IsSystemRelation/Class.

Also improve the comments in catalog.c.

There are a few remaining places in replication-related code that are
special-casing OIDs below FirstNormalObjectId.  I'm inclined to think
those are wrong too, and if there should be any special case it should
just extend to FirstBootstrapObjectId.  But first we need to debate
whether a FOR ALL TABLES publication should include information_schema.

Discussion: https://postgr.es/m/21697.1557092753@sss.pgh.pa.us
Discussion: https://postgr.es/m/15150.1557257111@sss.pgh.pa.us
2019-05-08 23:27:38 -04:00
..
expected Fix sepgsql regression test. 2019-01-21 15:39:14 -05:00
sql Remove WITH OIDS support, change oid catalog column visibility. 2018-11-20 16:00:17 -08:00
.gitignore Minor sepgsql regression test fixes. 2011-02-02 23:46:51 -05:00
Makefile Add file version information to most installed Windows binaries. 2014-07-14 14:07:52 -04:00
database.c Move generic snapshot related code from tqual.h to snapmgr.h. 2019-01-21 17:06:41 -08:00
dml.c Clean up the behavior and API of catalog.c's is-catalog-relation tests. 2019-05-08 23:27:38 -04:00
hooks.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
label.c Remove superfluous tqual.h includes. 2019-01-21 12:15:02 -08:00
launcher Update copyright for 2019 2019-01-02 12:44:25 -05:00
proc.c Move generic snapshot related code from tqual.h to snapmgr.h. 2019-01-21 17:06:41 -08:00
relation.c Move generic snapshot related code from tqual.h to snapmgr.h. 2019-01-21 17:06:41 -08:00
schema.c Move generic snapshot related code from tqual.h to snapmgr.h. 2019-01-21 17:06:41 -08:00
selinux.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
sepgsql-regtest.te Fix sepgsql regression tests. 2015-08-30 11:09:05 -07:00
sepgsql.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
sepgsql.sql.in sepgsql_setcon(). 2012-03-15 16:08:40 -04:00
test_sepgsql Fix omission of -X (--no-psqlrc) in some psql invocations. 2015-12-28 11:46:43 -05:00
uavc.c Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00