| From: | vignesh C <vignesh21(at)gmail(dot)com> |
|---|---|
| To: | mingjie(dot)gmj(at)gmail(dot)com |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: [PATCH] Check domain constraints for NULLs in logical replication |
| Date: | 2026-11-23 10:21:49 |
| Message-ID: | CALDaNm2yp0rfpQ-kHxAx8VjKwB5xvsEkdr98GXF6QYh2Q8=uFQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, 17 Nov 2026 at 17:34, <mingjie(dot)gmj(at)gmail(dot)com> wrote:
>
> The patch also adds tests for domain NOT NULL and CHECK constraints in
> text and binary modes, along with key updates, unchanged TOAST values
> and subscriber-only defaults. The full subscription test suite passed
> with the patch.
>
> I'm not sure if this is the right way to fix it, or if there are cases
> I've missed. I'd appreciate your thoughts on the approach. If it looks
> reasonable, I can continue to improve the patch and add more tests.
Thanks for the patch.
The issue is fixed only when the publisher sends values for the NOT
NULL domain columns. However, if the publisher does not have the
column and the subscriber needs to assign its default value, the NOT
NULL constraint is not validated.
Here is a test for the same:
--pub
CREATE TABLE tab_req (a int PRIMARY KEY);
INSERT INTO tab_req (a) VALUES (1)
CREATE PUBLICATION pub1 FOR TABLE tab_req;
--sub
CREATE DOMAIN required_int AS int NOT NULL;
CREATE TABLE tab_req (a int PRIMARY KEY, extra required_int);
--subscriber insert fails
INSERT INTO tab_req (a) VALUES (1)
--sub
CREATE SUBSCRIPTION orders_subscription
CONNECTION '<publisher connection string>'
PUBLICATION pub1 WITH (disable_on_error = true);
-- sub
postgres=# select * from tab_req ;
a | extra
---+-------
1 |
(1 row)
Should we call domain_check to see if the domain type does not allow
null values in these cases?
Regards,
Vignesh
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Salma Elsayed | 2026-11-23 10:27:43 | Re: PoC: Simplify recovery after dropping a table by LOGGING the restore LSN |
| Previous Message | Bertrand Drouvot | 2026-11-23 10:00:01 | Re: Detect mismatched subscription and replication slot properties |