Insertion into tables with generated columns causes shape termination
To reproduce, add the following https://github.com/electric-sql/electric/compare/main...AntonOfTheWoods:electric:generated_bug and do a normal run of the todo-app example. Any insertion (e.g, via the demo web interface) causes the following message in the log:
01:12:57.837 pid=<0.3097.0> shape_handle=91872063-1737681148357 [info] Schema for the table "public"."todos" changed - terminating shape 91872063-1737681148357
This, in turn, causes a must-revalidate on all clients and the obligatory re-syncing of the entire shape
Electric does not handle generated columns and seems unlikely that it will since they are skipped in logical replication https://www.postgresql.org/docs/current/ddl-generated-columns.html. We need to look into the messages in the replication stream to see if we can handle the special case.
Seems to be coming in Postgres 18! https://www.postgresql.fastware.com/pzone/2025-04-logical-replication-of-generated-columns https://www.postgresql.org/docs/18/logical-replication-gencols.html
Oooh, that’s great!