Skip to content

Default for new column can lead to divergence #80

@zaneduffield

Description

@zaneduffield

One edge case not addressed in the README is the use of DEFAULT on ALTER TABLE ... ADD COLUMN with a volatile function.

For example, if you run this statement on the publisher

ALTER TABLE tab ADD COLUMN col timestamp DEFAULT CURRENT_TIMESTAMP;

then the subscriber will (probably) populate the new column with a different value.

There are simple workarounds in this case (although they are less efficient on the publisher), and I understand that there may be no way to solve this without changes in core postgres, but I think this should result in either an error or a warning from the extension.

For comparison, EDB's PGD has support DDL replication, in with their implementation if you tried my example above you would get the error

ERROR: ALTER TABLE ... ADD COLUMN ... (mutable) DEFAULT may not affect replicated tables on a BDR node
CONTEXT: "xact rep": true, "ddl rep": true, "ddl locking": all

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions