Improve the error message for logical replication of regular column to generated column.
Shubham Khanna <khannashubham1197@gmail.com>
From: Shubham Khanna <khannashubham1197@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-11-14T06:18:39Z
Lists: pgsql-hackers
Attachments
- v1-0001-Error-message-improvement.patch (application/octet-stream) patch v1-0001
Hi all, Recently there was an issue reported by Kuroda-san on a different thread [1]. I have created this thread to discuss the issue separately. Currently, the ERROR message for the replication of a regular column on the publisher node to a generated column on the subscriber node is:- ERROR: logical replication target relation \"%s.%s\" is missing replicated columns: %s For example:- test_pub=# CREATE TABLE t1(c1 int, c2 int GENERATED ALWAYS AS (c1 * 2) STORED); test_pub=# CREATE PUBLICATION pub1 for table t1(c1, c2, c3); test_pub=# INSERT INTO t1 VALUES (1); test_sub=# CREATE TABLE t1(c1 int, c2 int GENERATED ALWAYS AS (c1 + 2) STORED, c3 int GENERATED ALWAYS AS (c1 + 2) STORED); test_sub=# CREATE SUBSCRIPTION sub1 CONNECTION '$publisher_connstr' PUBLICATION pub1; -> ERROR: logical replication target relation "t1" is missing replicated column: "c2","c3" The error message was misleading, as it failed to clarify that the replication of a regular column on the publisher to the corresponding generated column on the subscriber is not supported. To avoid and solve the issue, we can update the ERROR message stating that the replication of the generated column on the subscriber is not supported. I have attached a patch for the same. [1]: https://www.postgresql.org/message-id/TYCPR01MB5693AF061D62E55189490D2DF5562%40TYCPR01MB5693.jpnprd01.prod.outlook.com Thanks and Regards, Shubham Khanna.
Commits
-
Fix buildfarm failure from commit 8fcd80258b.
- 9d7aa406d04c 18.0 landed
-
Improve error message for replication of generated columns.
- 8fcd80258bcf 18.0 landed