| From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
|---|---|
| To: | pgsql-committers(at)postgresql(dot)org |
| Subject: | pgsql: Tweak publication fetching in psql |
| Date: | 2017-06-20 16:36:20 |
| Message-ID: | E1dNM8a-0001Dd-MB@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)sss(dot)pgh(dot)pa(dot)us>
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a2141c42f9ebc51b4501a4fafea9dd3fb7eda23d
Modified Files
--------------
src/backend/catalog/pg_publication.c | 24 ++++++++++++++++++++++++
src/bin/psql/describe.c | 14 +++++++++-----
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_proc.h | 2 ++
4 files changed, 36 insertions(+), 6 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2017-06-20 17:03:43 | pgsql: Don't downcase entries within shared_preload_libraries et al. |
| Previous Message | Bruce Momjian | 2017-06-20 15:04:40 | pgsql: doc: adjust wal_level pg_upgrade patch |