Re: Support logical replication of DDLs
shveta malik <shveta.malik@gmail.com>
From: shveta malik <shveta.malik@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>,
"Wei Wang (Fujitsu)" <wangw.fnst@fujitsu.com>, "Yu Shi (Fujitsu)" <shiy.fnst@fujitsu.com>, vignesh C <vignesh21@gmail.com>, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>,
Ajin Cherian <itsajin@gmail.com>, Runqi Tian <runqidev@gmail.com>, Peter Smith <smithpb2250@gmail.com>,
Tom Lane <tgl@sss.pgh.pa.us>, li jie <ggysxcq@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>,
Masahiko Sawada <sawada.mshk@gmail.com>, Japin Li <japinli@hotmail.com>, rajesh singarapu <rajesh.rs0541@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Zheng Li <zhengli10@gmail.com>, shveta malik <shveta.malik@gmail.com>
Date: 2023-06-30T07:06:07Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add a run_as_owner option to subscriptions.
- 482675987bcd 16.0 cited
-
Refactor pgoutput_change().
- da324d6cd45b 16.0 cited
-
Print the correct aliases for DML target tables in ruleutils.
- df931e9ab35b 11.20 landed
- c8a5f1685fb7 15.3 landed
- 4efb4f0d4878 13.11 landed
- 3dd287c14fac 12.15 landed
- 393430f57544 16.0 landed
- 14345f3c6a7b 14.8 landed
-
Fix object identity string for transforms
- 9a312562314a 16.0 landed
-
Add grantable MAINTAIN privilege and pg_maintain role.
- 60684dd834a2 16.0 cited
-
Get rid of recursion-marker values in enum AlterTableType
- 840ff5f451cd 16.0 cited
-
Release cache tuple when no longer needed
- ed0fbc8e5ac9 15.0 cited
-
Empty search_path in logical replication apply worker and walsender.
- 11da97024abb 14.0 cited
-
Refactor format_type APIs to be more modular
- a26116c6cbf4 11.0 cited
-
Use wrappers of PG_DETOAST_DATUM_PACKED() more.
- 3a0d473192b2 10.0 cited
Attachments
- 0003-Enhance-the-event-trigger-to-support-DDL--2023_06_30.patch (application/octet-stream) patch 0003
- 0002-Deparser-for-Alter-Table-DDL-commands-2023_06_30.patch (application/octet-stream) patch 0002
- 0001-Deparser-for-Create-And-Drop-Table-DDL-co-2023_06_30.patch (application/octet-stream) patch 0001
- 0005-Apply-the-DDL-change-as-that-same-user-th-2023_06_30.patch (application/octet-stream) patch 0005
- 0004-DDL-replication-for-Table-DDL-commands-2023_06_30.patch (application/octet-stream) patch 0004
On Thu, Jun 22, 2023 at 9:39 AM shveta malik <shveta.malik@gmail.com> wrote: > > On Mon, Jun 19, 2023 at 3:04 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > > In insert_table_elements(), sometimes we access system twice for each > > of the columns and this is to identify the above case where no > > elements are present. Would it be better if simply for zero element > > object array in this case and detect the same on the receiving side? > > If this is feasible then we can simply name the function as > > add_table_elems/add_table_elements. Also, in this context, can we > > change the variable name telems to telems_present to make it bit easy > > to follow. > > Modified telems to telems_present. I am reviewing the first part. > Please allow some more time. > Fixed this. Now we always add table_elements array. If there are no elements then it will be empty []. Regarding '()' around table-elements, we take a call once we are done adding table-elements. We peek into jsonb parse-state to figure out if we have actually added anything and then decide what goes to "fmt" string. Different scenarios are mentioned in code-comments in add_table_elems(). Apart from this, addressed below: 1) Fixed a bug where tables with serial columns (sequences) were not replicated. Thanks Ajin for providing the fix. 2) Fixed a few more things: a) Removed 'toJsonb' from all function names. Earlier it was this way to distinguish from object-tree functions since we were maintaining both the patches. b) Renamed and moved a few helper functions which were not actually for deparsing purposes to relevant files. c) Removed role_to_jsonb_element(), 'myowner' can now be added like any other key-value pair using new_jsonb_VA(). d) Optimized and refactored code at many places. e) Improved/corrected comments. The given patches do not include Vignesh's auto-generation work in [1], but if there is interest from reviewers, we can rebase those as well. [1]: https://www.postgresql.org/message-id/CALDaNm0Rvv2EWOOQeGc_1j3b3ENceDRO8jd%2Bgbf0Y_J7d1FGGw%40mail.gmail.com thanks Shveta