diff options
author | Amit Kapila <akapila@postgresql.org> | 2022-05-19 08:20:55 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2022-05-19 08:20:55 +0530 |
commit | 0ff20288e1cb3282efb43401896a939916fceb4d (patch) | |
tree | c92b34d13bd072e0c06127b3a8640a25ea4dc917 /src/backend/replication/logical/tablesync.c | |
parent | 62221ef187b0098c8f331f804b7c63859e5ee6ff (diff) | |
download | postgresql-0ff20288e1cb3282efb43401896a939916fceb4d.tar.gz postgresql-0ff20288e1cb3282efb43401896a939916fceb4d.zip |
Extend pg_publication_tables to display column list and row filter.
Commit 923def9a53 and 52e4f0cd47 allowed 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
Diffstat (limited to 'src/backend/replication/logical/tablesync.c')
-rw-r--r-- | src/backend/replication/logical/tablesync.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index b03e0f5aac2..994c7a09d92 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -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); |