Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints
От | Rushabh Lathia |
---|---|
Тема | Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints |
Дата | |
Msg-id | CAGPqQf3FJV26wx9qwtyY01hqgXvJ_Z-ZFB5bDW=O2+mBYATOBQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Support NOT VALID / VALIDATE constraint options for named NOT NULL constraints (Alvaro Herrera <alvherre@alvh.no-ip.org>) |
Список | pgsql-hackers |
> ------------------------------------------------------------------------
> i think your patch messed up with pg_constraint.conislocal.
> for example:
>
> CREATE TABLE parted (id bigint default 1,id_abc bigint) PARTITION BY LIST (id);
> alter TABLE parted add CONSTRAINT dummy_constr not null id not valid;
> CREATE TABLE parted_1 (id bigint default 1,id_abc bigint);
> alter TABLE parted_1 add CONSTRAINT dummy_constr not null id;
> ALTER TABLE parted ATTACH PARTITION parted_1 FOR VALUES IN ('1');
It's still not clear to me what to do to fix this problem. But while
trying to understand it, I had the chance to rework the pg_dump code
somewhat, so here it is. Feel free to propose fixes on top of this.
(BTW, I think the business of assigning to tbinfo->checkexprs both the
block for check constraints and the one for not-null constraints is
bogus. I didn't find what this breaks, but it looks wrong. We probably
need another struct _constraintInfo pointer in TableInfo.)
I fail to understand the issue here. I tested the scenario both with and without the patch,
and the behavior remained the same in both cases. While testing without the patch,
I ensured that I created valid constraints.
I ran the script below with and without the patch, and the output was the same in both cases.
------------------------------------------------------------------
CREATE TABLE parted (id bigint default 1,id_abc bigint) PARTITION BY LIST (id);
alter TABLE parted add CONSTRAINT dummy_constr not null id;
select conrelid::regclass, conname, conislocal
from pg_constraint where conname = 'dummy_constr';
CREATE TABLE parted_1 (id bigint default 1,id_abc bigint);
alter TABLE parted_1 add CONSTRAINT dummy_constr not null id;
select conrelid::regclass, conname, conislocal
from pg_constraint where conname = 'dummy_constr';
ALTER TABLE parted ATTACH PARTITION parted_1 FOR VALUES IN ('1');
select conrelid::regclass, conname, conislocal
from pg_constraint where conname = 'dummy_constr';
alter TABLE parted add CONSTRAINT dummy_constr not null id;
select conrelid::regclass, conname, conislocal
from pg_constraint where conname = 'dummy_constr';
CREATE TABLE parted_1 (id bigint default 1,id_abc bigint);
alter TABLE parted_1 add CONSTRAINT dummy_constr not null id;
select conrelid::regclass, conname, conislocal
from pg_constraint where conname = 'dummy_constr';
ALTER TABLE parted ATTACH PARTITION parted_1 FOR VALUES IN ('1');
select conrelid::regclass, conname, conislocal
from pg_constraint where conname = 'dummy_constr';
------------------------------------------------------------------
Are we expecting conislocal status to be different when it's NOT NULL NOT VALID?
Thanks & Regards
Rushabh Lathia
В списке pgsql-hackers по дате отправления: