Re: BUG: pg_class.relchecks overflow, making table undroppable

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG: pg_class.relchecks overflow, making table undroppable
Date: 2026-09-25 08:52:00
Message-ID: CACJufxEc=59a1+KRNzW4HKWYP8YifnRYK6F8KaCTOdXYTdwqrg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 25, 2026 at 4:41 PM Bertrand Drouvot
<bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
>
> numchecks++;
> +
> + if (numchecks >= PG_INT16_MAX)
> + ereport(ERROR,
> + errmsg("too many check constraints on relation \"%s\"",
> + RelationGetQualifiedRelationName(rel)));
>
Hi.

In MergeWithExistingConstraint, we have
```
else if (pg_add_s16_overflow(con->coninhcount, 1,
&con->coninhcount))
ereport(ERROR,
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("too many inheritance parents"));
```

here, we can also use pg_add_s16_overflow?

--
jian
https://www.enterprisedb.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-09-25 08:54:38 Re: WAL segment file descriptor leak on read errors can PANIC the server
Previous Message Bertrand Drouvot 2026-09-25 08:41:38 Re: BUG: pg_class.relchecks overflow, making table undroppable