From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Amul Sul <sulamul(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com> |
Subject: | Re: Dump-restore loosing 'attnotnull' bit for DEFERRABLE PRIMARY KEY column(s). |
Date: | 2024-03-08 11:18:41 |
Message-ID: | CAEZATCU_cUjgrgVHQTy8V8hmFA3fya8hTJjoj=feachJDeJLBA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 7 Mar 2024 at 17:32, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> This seems to work okay.
>
Yes, this looks good. I tested it against CREATE TABLE ... LIKE, and
it worked as expected. It might be worth adding a test case for that,
to ensure that it doesn't get broken in the future. Do we also want a
test case that does what pg_dump would do:
- Add a NOT NULL constraint
- Add a deferrable PK constraint
- Drop the NOT NULL constraint
- Check the column is still not nullable
Looking at rel.h, I think that the new field should probably come
after rd_pkindex, under the comment "data managed by
RelationGetIndexList", and have its own comment.
Also, if I'm nitpicking, the new field and local variables should use
the term "deferrable" rather than "deferred". A DEFERRABLE constraint
can be set to be either DEFERRED or IMMEDIATE within a transaction,
but "deferrable" is the right term to use to describe the persistent
property of an index/constraint that can be deferred. (The same
objection applies to the field name "indimmediate", but it's too late
to change that.)
Also, for neatness/consistency, the new field should probably be reset
in load_relcache_init_file(), alongside rd_pkindex, though I don't
think it can matter in practice.
Regards,
Dean
From | Date | Subject | |
---|---|---|---|
Next Message | Jelte Fennema-Nio | 2024-03-08 11:25:28 | Re: Support a wildcard in backtrace_functions |
Previous Message | Michael Paquier | 2024-03-08 11:12:39 | Re: Add new error_action COPY ON_ERROR "log" |