mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Extend pg_publication_tables to display column list and row filter.
Commit923def9a53and52e4f0cd47allowed to specify column lists and row filters for publication tables. This commit extends the pg_publication_tables view and pg_get_publication_tables function to display that information. This information will be useful to users and we also need this for the later commit that prohibits combining multiple publications with different column lists for the same table. Author: Hou Zhijie Reviewed By: Amit Kapila, Alvaro Herrera, Shi Yu, Takamichi Osumi Discussion: https://postgr.es/m/202204251548.mudq7jbqnh7r@alvherre.pgsql
This commit is contained in:
@@ -795,15 +795,12 @@ fetch_remote_table_info(char *nspname, char *relname,
|
||||
resetStringInfo(&cmd);
|
||||
appendStringInfo(&cmd,
|
||||
"SELECT DISTINCT unnest"
|
||||
" FROM pg_publication p"
|
||||
" LEFT OUTER JOIN pg_publication_rel pr"
|
||||
" ON (p.oid = pr.prpubid AND pr.prrelid = %u)"
|
||||
" LEFT OUTER JOIN unnest(pr.prattrs) ON TRUE,"
|
||||
" FROM pg_publication p,"
|
||||
" LATERAL pg_get_publication_tables(p.pubname) gpt"
|
||||
" LEFT OUTER JOIN unnest(gpt.attrs) ON TRUE"
|
||||
" WHERE gpt.relid = %u"
|
||||
" AND p.pubname IN ( %s )",
|
||||
lrel->remoteid,
|
||||
lrel->remoteid,
|
||||
pub_names.data);
|
||||
|
||||
pubres = walrcv_exec(LogRepWorkerWalRcvConn, cmd.data,
|
||||
@@ -965,15 +962,12 @@ fetch_remote_table_info(char *nspname, char *relname,
|
||||
/* Check for row filters. */
|
||||
resetStringInfo(&cmd);
|
||||
appendStringInfo(&cmd,
|
||||
"SELECT DISTINCT pg_get_expr(pr.prqual, pr.prrelid)"
|
||||
" FROM pg_publication p"
|
||||
" LEFT OUTER JOIN pg_publication_rel pr"
|
||||
" ON (p.oid = pr.prpubid AND pr.prrelid = %u),"
|
||||
"SELECT DISTINCT pg_get_expr(gpt.qual, gpt.relid)"
|
||||
" FROM pg_publication p,"
|
||||
" LATERAL pg_get_publication_tables(p.pubname) gpt"
|
||||
" WHERE gpt.relid = %u"
|
||||
" AND p.pubname IN ( %s )",
|
||||
lrel->remoteid,
|
||||
lrel->remoteid,
|
||||
pub_names.data);
|
||||
|
||||
res = walrcv_exec(LogRepWorkerWalRcvConn, cmd.data, 1, qualRow);
|
||||
|
||||
Reference in New Issue
Block a user