public inbox for [email protected]
help / color / mirror / Atom feedFrom: jian he <[email protected]>
To: Chao Li <[email protected]>
Cc: Zsolt Parragi <[email protected]>
Cc: [email protected]
Subject: Re: Fix bug of CHECK constraint enforceability recursion
Date: Mon, 8 Jun 2026 18:28:55 +0800
Message-ID: <CACJufxE2B6nrfV9inubVifY-8Y6hObBAtyXHEAtPLA6JATXjgA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CACJufxGRkCSqqRwd+3MMVFbosKXHv=Jc+KyGK+NM3YAHN7eu+g@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<CACJufxGxY=1mxcNz8-bjp6R+ZoCRE3O7DYt2ZqObv-Le+aMOqw@mail.gmail.com>
<[email protected]>
<CACJufxFwJH5K1jgL1ryckYX8gxp1sfqz_2ypey1sYtWZ5u45oQ@mail.gmail.com>
<[email protected]>
<[email protected]>
<CACJufxHbVuY683j3DHEU4LSswo8DTzLJbTvhv2Uj6gqN8pJs7Q@mail.gmail.com>
<[email protected]>
<[email protected]>
<CACJufxGgSKFGWja=JPv3-zq3whON5cESLp7Z5=OsYvZOaRGnGw@mail.gmail.com>
<[email protected]>
<CAN4CZFOOhDAWdnY1OXB1wfG_=C4g_dw0gC2HCApz_3F7EFpqJA@mail.gmail.com>
<[email protected]>
<CAN4CZFNjnR-7hPBO=v=9h4CdDogUueYoPqpPvR9k3X5Z9-=+TA@mail.gmail.com>
<[email protected]>
<CAN4CZFPkeF+=sk9KxxncuzGb-Q2NsMG4zoUgff-TiHeEdzwU+w@mail.gmail.com>
<[email protected]>
On Sat, Jun 6, 2026 at 11:06 AM Chao Li <[email protected]> wrote:
>
> PFA v8: 0001 and 0003 unchanged. 0002 addressed Zsolt’s comment.
>
drop table root_t cascade;
create table root_t (a int constraint c check (a > 0) enforced);
create table p2 (a int constraint c check (a > 0) enforced);
create table d () inherits (root_t, p2);
create table e () inherits (d);
CREATE OR REPLACE PROCEDURE create_table(i int) AS $$
DECLARE
r int;
query text;
BEGIN
FOR i IN 20..$1 LOOP
query := 'create table f' || i || '() inherits (e)';
raise notice 'query: %', query;
EXECUTE query;
END LOOP;
END; $$ LANGUAGE plpgsql;
call create_table(1000);
alter table root_t alter constraint c not enforced;
ATCheckCheckConstrHasEnforcedParent invoked 996070 times
ATCheckCheckConstrHasEnforcedParent will call itself, so I think we
need check_stack_depth() on it.
I also made a minor refactoring to reduce unnecessary work in
ATCheckCheckConstrHasEnforcedParent().
A single call to table_open(parentoid, ...) is enough.
Keep errmsg() messages on a single line to improve grepability.
--
jian
https://www.enterprisedb.com/
Attachments:
[application/octet-stream] v8-0001-Minor-refactoring-for-v8.nocfbot (2.8K, 2-v8-0001-Minor-refactoring-for-v8.nocfbot)
download
view thread (32+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Fix bug of CHECK constraint enforceability recursion
In-Reply-To: <CACJufxE2B6nrfV9inubVifY-8Y6hObBAtyXHEAtPLA6JATXjgA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox