Honor run_as_owner option in tablesync worker.
authorMasahiko Sawada <msawada@postgresql.org>
Fri, 9 Jun 2023 01:43:03 +0000 (10:43 +0900)
committerMasahiko Sawada <msawada@postgresql.org>
Fri, 9 Jun 2023 01:43:03 +0000 (10:43 +0900)
commita83edeaf684a70da02fa2bce8b7e3aefa3f906f5
tree0d5cc97af81c521754ca0ac919de5a4ae835e7d3
parent26eaf82e7138890022d5d06b77eb745524542fb7
Honor run_as_owner option in tablesync worker.

Commit 482675987 introduced "run_as_owner" subscription option so that
subscription runs with either the permissions of the subscription
owner or the permission of the table owner. However, tablesync workers
did not use this option for the initial data copy.

With this change, tablesync workers run with appropriate permissions
based on "run_as_owner" option.

Ajin Cherian, with changes and regression tests added by me.

Reported-By: Amit Kapila
Author: Ajin Cherian, Masahiko Sawada
Reviewed-by: Ajin Cherian, Amit Kapila
Discussion: https://postgr.es/m/CAA4eK1L=qzRHPEn+qeMoKQGFBzqGoLBzt_ov0A89iFFiut+ppA@mail.gmail.com
src/backend/replication/logical/tablesync.c
src/test/subscription/t/033_run_as_table_owner.pl