Re: bug when apply fast default mechanism for adding new column over domain with default value
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: jian he <jian.universality@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-03-01T06:43:44Z
Lists: pgsql-hackers
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
Commits
-
Need to do CommandCounterIncrement after StoreAttrMissingVal.
- dd34cbfce296 13.21 landed
- d31d39cfe4f5 14.18 landed
- bd178960c69b 18.0 landed
- 2d6cfb0cddd3 15.13 landed
- 0941aadcd55b 17.5 landed
- 053222a97b13 16.9 landed
-
Simplify some logic around setting pg_attribute.atthasdef.
- 35c8dd9e1176 18.0 landed
-
Remove now-dead code in StoreAttrDefault().
- 4528768d98f8 18.0 landed
-
Fix broken handling of domains in atthasmissing logic.
- 95f650674d2c 18.0 landed
- edc3bccd0dc7 16.9 landed
- d6dd2a02bae0 17.5 landed
- c75c830e2392 14.18 landed
- aac07b56256e 13.21 landed
- 1d180931cc3b 15.13 landed