postgresql/src/include/catalog
Tom Lane 1635e80d30 Use a blacklist to distinguish original from add-on enum values.
Commit 15bc038f9 allowed ALTER TYPE ADD VALUE to be executed inside
transaction blocks, by disallowing the use of the added value later
in the same transaction, except under limited circumstances.  However,
the test for "limited circumstances" was heuristic and could reject
references to enum values that were created during CREATE TYPE AS ENUM,
not just later.  This breaks the use-case of restoring pg_dump scripts
in a single transaction, as reported in bug #14825 from Balazs Szilfai.

We can improve this by keeping a "blacklist" table of enum value OIDs
created by ALTER TYPE ADD VALUE during the current transaction.  Any
visible-but-uncommitted value whose OID is not in the blacklist must
have been created by CREATE TYPE AS ENUM, and can be used safely
because it could not have a lifespan shorter than its parent enum type.

This change also removes the restriction that a renamed enum value
can't be used before being committed (unless it was on the blacklist).

Andrew Dunstan, with cosmetic improvements by me.
Back-patch to v10.

Discussion: https://postgr.es/m/20170922185904.1448.16585@wrigleys.postgresql.org
2017-09-26 13:14:46 -04:00
..
.gitignore
binary_upgrade.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
catalog.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
catversion.h Remove no-op GiST support functions in the core GiST opclasses. 2017-09-19 23:32:59 -04:00
dependency.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
duplicate_oids
genbki.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
heap.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
index.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
indexing.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
namespace.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
objectaccess.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
objectaddress.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
opfam_internal.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
partition.h Allow a partitioned table to have a default partition. 2017-09-08 17:28:04 -04:00
pg_aggregate.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_am.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_amop.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_amproc.h Remove no-op GiST support functions in the core GiST opclasses. 2017-09-19 23:32:59 -04:00
pg_attrdef.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_attribute.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_auth_members.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_authid.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_cast.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_class.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_collation_fn.h Rethink behavior of pg_import_system_collations(). 2017-06-23 14:19:58 -04:00
pg_collation.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_constraint_fn.h Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
pg_constraint.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_control.h Make WAL segment size configurable at initdb time. 2017-09-19 22:03:48 -07:00
pg_conversion_fn.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_conversion.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_database.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_db_role_setting.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_default_acl.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_depend.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_description.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_enum.h Use a blacklist to distinguish original from add-on enum values. 2017-09-26 13:14:46 -04:00
pg_event_trigger.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_extension.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_foreign_data_wrapper.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_foreign_server.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_foreign_table.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_index.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_inherits_fn.h Fix transition tables for partition/inheritance. 2017-06-28 18:55:03 +01:00
pg_inherits.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_init_privs.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_language.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_largeobject_metadata.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_largeobject.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_namespace.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_opclass.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_operator_fn.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_operator.h Distinguish selectivity of < from <= and > from >=. 2017-09-13 11:12:39 -04:00
pg_opfamily.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_partitioned_table.h Allow a partitioned table to have a default partition. 2017-09-08 17:28:04 -04:00
pg_pltemplate.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_policy.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_proc_fn.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_proc.h Remove no-op GiST support functions in the core GiST opclasses. 2017-09-19 23:32:59 -04:00
pg_publication_rel.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_publication.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_range.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_replication_origin.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_rewrite.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_seclabel.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_sequence.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_shdepend.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_shdescription.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_shseclabel.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_statistic_ext.h Message style fixes 2017-09-11 11:21:27 -04:00
pg_statistic.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_subscription_rel.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_subscription.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_tablespace.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_transform.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_trigger.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_ts_config_map.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_ts_config.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_ts_dict.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_ts_parser.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_ts_template.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_type_fn.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_type.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_user_mapping.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
storage_xlog.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
storage.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
toasting.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
unused_oids