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/

Attachment: v8-0001-Minor-refactoring-for-v8.nocfbot
Description: Binary data

Reply via email to