pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Extend DomainHasConstraints() to optionally check constraint vol
Date: Thu, 12 Mar 2026 22:06:31 +0000
Message-ID: <E1w0oAp-003fmV-2Q@gemulon.postgresql.org> (raw)

Extend DomainHasConstraints() to optionally check constraint volatility

Add an optional bool *has_volatile output parameter to
DomainHasConstraints().  When non-NULL, the function checks whether any
CHECK constraint contains a volatile expression.  Callers that don't
need this information pass NULL and get the same behavior as before.

This is needed by a subsequent commit that enables the fast default
optimization for domains with non-volatile constraints: we can safely
evaluate such constraints once at ALTER TABLE time, but volatile
constraints require a full table rewrite.

Author: Jian He <jian.universality@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Reviewed-by: Viktor Holmberg <viktor.holmberg@aiven.io>
Discussion: https://postgr.es/m/CACJufxE_+iZBR1i49k_AHigppPwLTJi6km8NOsC7FWvKdEmmXg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/487cf2cbd2f5a32cf9756eb9bd6dbf9f3956c8b7

Modified Files
--------------
src/backend/commands/copyfrom.c      |  2 +-
src/backend/commands/tablecmds.c     |  4 ++--
src/backend/executor/execExpr.c      |  2 +-
src/backend/optimizer/util/clauses.c |  2 +-
src/backend/parser/parse_expr.c      |  2 +-
src/backend/utils/cache/typcache.c   | 27 +++++++++++++++++++++++++--
src/include/utils/typcache.h         |  2 +-
7 files changed, 32 insertions(+), 9 deletions(-)



Message-ID: <E1w0oAp-003fmV-2Q@gemulon.postgresql.org>
Permalink:  ../E1w0oAp-003fmV-2Q@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w0oAp-003fmV-2Q@gemulon.postgresql.org

 · 

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: pgsql-committers@postgresql.org
  Cc: andrew@dunslane.net, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Extend DomainHasConstraints() to optionally check constraint vol
  In-Reply-To: <E1w0oAp-003fmV-2Q@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox