2ndQuadrant / pglogical

Logical Replication extension for PostgreSQL 17, 16, 15, 14, 13, 12, 11, 10, 9.6, 9.5, 9.4 (Postgres), providing much faster replication than Slony, Bucardo or Londiste, as well as cross-version upgrades.
http://2ndquadrant.com/en/resources/pglogical/
Other
1.02k stars 154 forks source link

Optionally skip executing DDL locally in replicate_ddl_command #395

Closed morse-coder95 closed 2 years ago

morse-coder95 commented 2 years ago

2nd Quadrant,

We have a use case where we don't want replicate_ddl_command to execute locally. Our custom event triggers are capturing all DDL and then call replicate_ddl_command. This fails because the DDL is being executed twice - once by the SQL statement itself, and once by replicate_ddl_command in the event trigger.

This change adds an execute_locally argument in replicate_ddl_command that defaults to true for backwards compatibility. I verified this works like I would expect it to in both cases, but if there are greater impacts under the hood that I'm not seeing please let me know. I only knew enough C to make this minor change and have not made contributions to other open source projects so this is a bit of a first for me.