Skip to content

Postgres generated columns #379

@rkistner

Description

@rkistner

Since Postgres 18, generated columns can be used by configuring a flag on the publication:

https://www.postgresql.org/docs/current/sql-createpublication.html#SQL-CREATEPUBLICATION-PARAMS-WITH-PUBLISH-GENERATED-COLUMNS

This means it is now possible to use generated columns in PowerSync, with no further modifications required. However, we should:

  1. Document the flag, perhaps even recommending it for all users when creating the publication.
  2. Add a check when replicating tables with generated columns, to confirm that Postgres 18 is used and the flag is configured; logging a warning otherwise.
  3. Re-check behavior of REPLICA IDENTITY FULL when using generated columns. This currently causes consistency issues when the above flag is not set. This could be solved by changing our internal replica identity to use the primary key rather than the entire row, if available.

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