Re: Fuzzy thinking in is_publishable_class

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Fuzzy thinking in is_publishable_class
Date: 2019-05-09 14:20:17
Message-ID: 3957.1557411617@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com> writes:
> I think we need a better way of identifying what's part of system and
> what's user created in general. The FirstNormalObjectId seems somewhat
> okay approximation, but then we have plenty of other ways for checking,
> maybe it's time to consolidate it into some extra column in pg_class?

I'd be on board with adding "bool relpublishable" or the like to pg_class.
We'd also need infrastructure for setting that, of course, so it's not
a five-minute fix. In the meantime I guess we have to leave the
is_publishable_class test like it is.

I am thinking though that the replication code's tests of type OIDs
against FirstNormalObjectId are broken. The essential property that
those are after, IIUC, is "will the remote server certainly have the
same definition of this type as the local one?" That is *absolutely
not guaranteed* for types defined in information_schema, because
their OIDs aren't locked down and could plausibly be different across
installations. I forget whether we load collations before or after
information_schema, so this might or might not be a live bug today,
but it's certainly something waiting to bite us on the rear.

Actually --- that's for logical replication, isn't it? And we allow
logical replication across versions, don't we? If so, it is a live
bug. Only hand-assigned type OIDs should be trusted to hold still
across major versions.

In short I think we'd better s/FirstNormalObjectId/FirstGenbkiObjectId/
in logical/relation.c and pgoutput/pgoutput.c, and I think that's
probably a back-patchable bug fix of some urgency.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2019-05-09 14:34:15 Re: Inconsistency between table am callback and table function names
Previous Message Tom Lane 2019-05-09 13:47:34 Re: Unexpected "shared memory block is still in use"