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: tushar <tushar.ahuja@enterprisedb.com>
Reviewed-by: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Reviewed-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
{
printfPQExpBuffer(&buf,
"SELECT pub.pubname\n"
- " FROM pg_catalog.pg_publication pub\n"
- " LEFT JOIN pg_catalog.pg_publication_rel pr\n"
- " ON (pr.prpubid = pub.oid)\n"
- "WHERE pr.prrelid = '%s' OR pub.puballtables\n"
+ " FROM pg_catalog.pg_publication pub,\n"
+ " pg_catalog.pg_get_publication_tables(pub.pubname)\n"
+ "WHERE relid = '%s'\n"
"ORDER BY 1;",
oid);