On 6/9/17 11:45, Tom Lane wrote:
> What we've done in many comparable situations is to allow a
> catalog-probing function to return NULL instead of failing
> when handed an OID or other identifier that it can't locate.
> Here it seems like pg_get_publication_tables() needs to use
> missing_ok = TRUE and then return zero rows for a null result.
Why is it that dropping a publication in another session makes our local
view of things change in middle of a single SQL statement? Is there
something we can change to address that?
> BTW, isn't the above command a hugely inefficient way of finding
> the publications for the target rel? Unless you've got a rather
> small number of rather restricted publications, seems like it's
> going to take a long time. Maybe we don't care too much about
> manual invocations of \d+, but I bet somebody will carp if there's
> not a better way to find this out. Maybe a better answer is to
> define a more suitable function pg_publications_for_table(relid)
> and let it have the no-error-for-bad-OID behavior.
That would possibly be better (the current function was written for a
different use case), but it could have the same concurrency problem as
above.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services