public inbox for [email protected]  
help / color / mirror / Atom feed
From: Zsolt Parragi <[email protected]>
To: [email protected]
Subject: Re: Fix bug of CHECK constraint enforceability recursion
Date: Thu, 4 Jun 2026 12:08:02 -0700
Message-ID: <CAN4CZFNjnR-7hPBO=v=9h4CdDogUueYoPqpPvR9k3X5Z9-=+TA@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]>

The new version looks correct, I don't see any logic problem with it,
however, I do have a performance question:

+				/*
+				 * A parent listed in changing_conids is being changed by the
+				 * same ALTER, but it may not have been updated yet.  For
+				 * regular inheritance, recurse upward to check whether an
+				 * equivalent enforced parent outside the ALTER will make it
+				 * remain enforced.  Partitions cannot have multiple parents,
+				 * so they do not need this check.
+				 */
+				if (!rel->rd_rel->relispartition &&
+					list_member_oid(changing_conids, parentcon->oid))

Shouldn't the parent lookup use some form of caching? Otherwise we'll
end up reevaluating the same parents multiple times. I'm not sure if
it is needed or not, how much of a performance impact this can have in
a real-world server.






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]
  Subject: Re: Fix bug of CHECK constraint enforceability recursion
  In-Reply-To: <CAN4CZFNjnR-7hPBO=v=9h4CdDogUueYoPqpPvR9k3X5Z9-=+TA@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