Commit 2d460179 authored by Peter Eisentraut's avatar Peter Eisentraut

psql: Fix display of whether table is part of publication

If a FOR ALL TABLES publication was present, \d of a table would claim
for each table that it was part of the publication, even for tables that
are ignored for this purpose, such as system tables and unlogged tables.
Fix the query by using the function pg_get_publication_tables(), which
was intended for this purpose.
Reported-by: default avatartushar <tushar.ahuja@enterprisedb.com>
Reviewed-by: default avatarAmit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Reviewed-by: default avatarKuntal Ghosh <kuntalghosh.2007@gmail.com>
parent f112f175
...@@ -2537,10 +2537,9 @@ describeOneTableDetails(const char *schemaname, ...@@ -2537,10 +2537,9 @@ describeOneTableDetails(const char *schemaname,
{ {
printfPQExpBuffer(&buf, printfPQExpBuffer(&buf,
"SELECT pub.pubname\n" "SELECT pub.pubname\n"
" FROM pg_catalog.pg_publication pub\n" " FROM pg_catalog.pg_publication pub,\n"
" LEFT JOIN pg_catalog.pg_publication_rel pr\n" " pg_catalog.pg_get_publication_tables(pub.pubname)\n"
" ON (pr.prpubid = pub.oid)\n" "WHERE relid = '%s'\n"
"WHERE pr.prrelid = '%s' OR pub.puballtables\n"
"ORDER BY 1;", "ORDER BY 1;",
oid); oid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment