diff options
| author | Peter Eisentraut <peter_e@gmx.net> | 2017-06-20 12:25:07 -0400 |
|---|---|---|
| committer | Peter Eisentraut <peter_e@gmx.net> | 2017-06-20 12:35:02 -0400 |
| commit | a2141c42f9ebc51b4501a4fafea9dd3fb7eda23d (patch) | |
| tree | 6a273b7f730515593cdd6ba0e6fa8e19575d3e59 /src/include/catalog/pg_proc.h | |
| parent | 20d7d68b098dde6106e6c382e787c8b10c4403df (diff) | |
| download | postgresql-a2141c42f9ebc51b4501a4fafea9dd3fb7eda23d.tar.gz | |
Tweak publication fetching in psql
Viewing a table with \d in psql also shows the publications at table is
in. If a publication is concurrently dropped, this shows an error,
because the view pg_publication_tables internally uses
pg_get_publication_tables(), which uses a catalog snapshot. This can be
particularly annoying if a for-all-tables publication is concurrently
dropped.
To avoid that, write the query in psql differently. Expose the function
pg_relation_is_publishable() to SQL and write the query using that.
That still has a risk of being affected by concurrent catalog changes,
but in this case it would be a table drop that causes problems, and then
the psql \d command wouldn't be interesting anymore anyway.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Diffstat (limited to 'src/include/catalog/pg_proc.h')
| -rw-r--r-- | src/include/catalog/pg_proc.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 73ce026d89..f22cc4f472 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -5436,6 +5436,8 @@ DESCR("get progress for all replication origins"); /* publications */ DATA(insert OID = 6119 ( pg_get_publication_tables PGNSP PGUID 12 1 1000 0 0 f f f f t t s s 1 0 26 "25" "{25,26}" "{i,o}" "{pubname,relid}" _null_ _null_ pg_get_publication_tables _null_ _null_ _null_ )); DESCR("get OIDs of tables in a publication"); +DATA(insert OID = 6121 ( pg_relation_is_publishable PGNSP PGUID 12 1 0 0 0 f f f f t f s s 1 0 16 "2205" _null_ _null_ _null_ _null_ _null_ pg_relation_is_publishable _null_ _null_ _null_ )); +DESCR("returns whether a relation can be part of a publication"); /* rls */ DATA(insert OID = 3298 ( row_security_active PGNSP PGUID 12 1 0 0 0 f f f f t f s s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ row_security_active _null_ _null_ _null_ )); |
