postgresql/src/include/catalog
Tom Lane edc3bccd0d Fix broken handling of domains in atthasmissing logic.
If a domain type has a default, adding a column of that type (without
any explicit DEFAULT clause) failed to install the domain's default
value in existing rows, instead leaving the new column null.  This
is unexpected, and it used to work correctly before v11.  The cause
is confusion in the atthasmissing mechanism about which default value
to install: we'd only consider installing an explicitly-specified
default, and then we'd decide that no table rewrite is needed.

To fix, take the responsibility for filling attmissingval out of
StoreAttrDefault, and instead put it into ATExecAddColumn's existing
logic that derives the correct value to fill the new column with.
Also, centralize the logic that determines the need for
default-related table rewriting there, instead of spreading it over
four or five places.

In the back branches, we'll leave the attmissingval-filling code
in StoreAttrDefault even though it's now dead, for fear that some
extension may be depending on that functionality to exist there.
A separate HEAD-only patch will clean up the now-useless code.

Reported-by: jian he <jian.universality@gmail.com>
Author: jian he <jian.universality@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CACJufxHFssPvkP1we7WMhPD_1kwgbG52o=kQgL+TnVoX5LOyCQ@mail.gmail.com
Backpatch-through: 13
2025-03-03 12:43:29 -05:00
..
.gitignore Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
binary_upgrade.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
catalog.h Cope with inplace update making catcache stale during TOAST fetch. 2024-06-27 19:21:10 -07:00
catversion.h Revert MAINTAIN privilege and pg_maintain predefined role. 2023-07-07 11:25:23 -07:00
dependency.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
duplicate_oids Update copyright for 2023 2023-01-02 15:00:37 -05:00
genbki.h Update DECLARE_INDEX documentation 2023-08-24 14:00:36 +02:00
heap.h Fix broken handling of domains in atthasmissing logic. 2025-03-03 12:43:29 -05:00
index.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
indexing.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
Makefile Update copyright for 2023 2023-01-02 15:00:37 -05:00
meson.build meson: Add dependencies to perl modules to various script invocations 2023-06-09 20:12:16 -07:00
namespace.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
objectaccess.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
objectaddress.h In REASSIGN OWNED of a database, lock the tuple as mandated. 2024-12-28 07:16:26 -08:00
partition.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_aggregate.dat Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
pg_aggregate.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_am.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_am.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_amop.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_amop.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_amproc.dat Dissociate btequalimage() from interval_ops, ending its deduplication. 2023-10-14 16:33:54 -07:00
pg_amproc.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_attrdef.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_attribute.h Save a few bytes in pg_attribute 2023-03-28 10:05:56 +02:00
pg_auth_members.h Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
pg_authid.dat Revert MAINTAIN privilege and pg_maintain predefined role. 2023-07-07 11:25:23 -07:00
pg_authid.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_cast.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_cast.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_class.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_class.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_collation.dat Move definition of standard collations from initdb to pg_collation.dat 2023-03-29 09:45:21 +02:00
pg_collation.h Allow tailoring of ICU locales with custom rules 2023-03-08 16:56:37 +01:00
pg_constraint.h Revert "Catalog NOT NULL constraints" and fallout 2023-04-12 19:29:21 +02:00
pg_control.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_conversion.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_conversion.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_database.dat Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
pg_database.h Handle DROP DATABASE getting interrupted 2023-07-13 13:03:30 -07:00
pg_db_role_setting.h Revert "Add USER SET parameter values for pg_db_role_setting" 2023-05-17 20:28:57 +03:00
pg_default_acl.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_depend.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_description.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_enum.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_event_trigger.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_extension.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_foreign_data_wrapper.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_foreign_server.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_foreign_table.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_index.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_inherits.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_init_privs.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_language.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_language.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_largeobject.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_largeobject_metadata.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_namespace.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_namespace.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_opclass.dat Ensure we allocate NAMEDATALEN bytes for names in Index Only Scans 2024-05-01 13:21:50 +12:00
pg_opclass.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_operator.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_operator.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_opfamily.dat Dissociate btequalimage() from interval_ops, ending its deduplication. 2023-10-14 16:33:54 -07:00
pg_opfamily.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_parameter_acl.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_partitioned_table.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_policy.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_proc.dat Expand some more uses of "deleg" to "delegation" or "delegated". 2023-05-21 10:55:18 -04:00
pg_proc.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_publication.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_publication_namespace.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_publication_rel.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_range.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_range.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_replication_origin.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_rewrite.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_seclabel.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_sequence.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_shdepend.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_shdescription.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_shseclabel.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_statistic.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_statistic_ext.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_statistic_ext_data.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_subscription.h Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
pg_subscription_rel.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_tablespace.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_tablespace.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_transform.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_trigger.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_config.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_config.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_config_map.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_config_map.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_dict.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_dict.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_parser.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_parser.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_template.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_ts_template.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_type.dat Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_type.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_user_mapping.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
reformat_dat_file.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
renumber_oids.pl Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
storage.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
storage_xlog.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
toasting.h Update copyright for 2023 2023-01-02 15:00:37 -05:00
unused_oids Update copyright for 2023 2023-01-02 15:00:37 -05:00