From: Tom Lane <tgl@sss.pgh.pa.us>
To: jian he <jian.universality@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: bug when apply fast default mechanism for adding new column over domain with default value
Date: Sat, 01 Mar 2025 01:43:44 -0500
Message-ID: <2901599.1740811424@sss.pgh.pa.us> (raw)
In-Reply-To: <CACJufxHFssPvkP1we7WMhPD_1kwgbG52o=kQgL+TnVoX5LOyCQ@mail.gmail.com>
References: <CACJufxHFssPvkP1we7WMhPD_1kwgbG52o=kQgL+TnVoX5LOyCQ@mail.gmail.com>
jian he <jian.universality@gmail.com> writes:
> then I think I found a bug for applying fast default over domain with
> default value.
Yeah, that's definitely a bug: it worked correctly in versions
before we invented the attmissingval mechanism.
> column b type is domain int_domain3, which has a constraint.
> As a result, adding column b triggers a table rewrite, ensuring the
> domain default value is successfully applied.
I do not believe that case should require a table rewrite.
Both the default and the check constraint are immutable,
so we ought to be able to apply the check once and then
use the default as the attmissingval.
> Attach a patch to fix this issue by cause it to table rewrite.
I see no attached patch, but in any case forcing a table rewrite
seems like the wrong direction...
regards, tom lane
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-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, jian.universality@gmail.com
Subject: Re: bug when apply fast default mechanism for adding new column over domain with default value
In-Reply-To: <2901599.1740811424@sss.pgh.pa.us>
* 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