postgresql/src/include/catalog
Tom Lane c35b714caf Fix misbehavior with expression indexes on ON COMMIT DELETE ROWS tables.
We implement ON COMMIT DELETE ROWS by truncating tables marked that
way, which requires also truncating/rebuilding their indexes.  But
RelationTruncateIndexes asks the relcache for up-to-date copies of any
index expressions, which may cause execution of eval_const_expressions
on them, which can result in actual execution of subexpressions.
This is a bad thing to have happening during ON COMMIT.  Manuel Rigger
reported that use of a SQL function resulted in crashes due to
expectations that ActiveSnapshot would be set, which it isn't.
The most obvious fix perhaps would be to push a snapshot during
PreCommit_on_commit_actions, but I think that would just open the door
to more problems: CommitTransaction explicitly expects that no
user-defined code can be running at this point.

Fortunately, since we know that no tuples exist to be indexed, there
seems no need to use the real index expressions or predicates during
RelationTruncateIndexes.  We can set up dummy index expressions
instead (we do need something that will expose the right data type,
as there are places that build index tupdescs based on this), and
just ignore predicates and exclusion constraints.

In a green field it'd likely be better to reimplement ON COMMIT DELETE
ROWS using the same "init fork" infrastructure used for unlogged
relations.  That seems impractical without catalog changes though,
and even without that it'd be too big a change to back-patch.
So for now do it like this.

Per private report from Manuel Rigger.  This has been broken forever,
so back-patch to all supported branches.
2019-12-01 13:09:26 -05:00
..
.gitignore Replace our traditional initial-catalog-data format with a better design. 2018-04-08 13:17:27 -04:00
binary_upgrade.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
catalog.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
catversion.h Stabilize the results of pg_notification_queue_usage(). 2019-11-24 14:09:33 -05:00
dependency.h Install dependencies to prevent dropping partition key columns. 2019-07-22 14:55:40 -04:00
duplicate_oids Update copyright for 2019 2019-01-02 12:44:25 -05:00
genbki.h Move the built-in conversions into the initial catalog data. 2019-01-03 19:47:53 -05:00
heap.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
index.h Fix misbehavior with expression indexes on ON COMMIT DELETE ROWS tables. 2019-12-01 13:09:26 -05:00
indexing.h Rework the pg_statistic_ext catalog 2019-06-16 01:20:31 +02:00
Makefile Minor improvements for reformat_dat_file.pl. 2019-03-08 11:48:49 -05:00
namespace.h Fix inconsistencies and typos in the tree, take 10 2019-08-13 13:53:41 +09:00
objectaccess.h Add object TRUNCATE hook 2019-11-23 10:39:20 -05:00
objectaddress.h Don't include utils/array.h from acl.h. 2019-08-16 10:33:30 -07:00
opfam_internal.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
partition.h Fix more typos and inconsistencies in the tree 2019-06-17 16:13:16 +09:00
pg_aggregate.dat Add min() and max() aggregates for pg_lsn 2019-07-05 12:21:11 +09:00
pg_aggregate.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pg_am.dat tableam: introduce table AM infrastructure. 2019-03-06 09:54:38 -08:00
pg_am.h tableam: introduce table AM infrastructure. 2019-03-06 09:54:38 -08:00
pg_amop.dat Add support for <-> (box, point) operator to SP-GiST box_ops 2019-07-14 15:09:23 +03:00
pg_amop.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_amproc.dat Add sort support routine for the inet data type. 2019-08-01 09:34:14 -07:00
pg_amproc.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_attrdef.h Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
pg_attribute.h Generated columns 2019-03-30 08:15:57 +01:00
pg_auth_members.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_authid.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_authid.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_cast.dat Add support for multivariate MCV lists 2019-03-27 18:32:18 +01:00
pg_cast.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_class.dat Generated columns 2019-03-30 08:15:57 +01:00
pg_class.h Add BKI_DEFAULT to pg_class.relrewrite 2019-03-14 21:25:39 +01:00
pg_collation.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_collation.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pg_constraint.h Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
pg_control.h Remove configure --disable-float4-byval 2019-11-21 18:29:21 +01:00
pg_conversion.dat Remove dead encoding-conversion functions. 2019-07-05 14:17:27 -04:00
pg_conversion.h Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
pg_database.dat Remove remaining hard-wired OID references in the initial catalog data. 2019-03-12 12:30:35 -04:00
pg_database.h Remove remaining hard-wired OID references in the initial catalog data. 2019-03-12 12:30:35 -04:00
pg_db_role_setting.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pg_default_acl.h Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
pg_depend.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_description.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_enum.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pg_event_trigger.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_extension.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_foreign_data_wrapper.h Fix more typos and inconsistencies in the tree 2019-06-17 16:13:16 +09:00
pg_foreign_server.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_foreign_table.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_index.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_inherits.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pg_init_privs.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_language.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_language.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_largeobject.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_largeobject_metadata.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_namespace.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_namespace.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_opclass.dat Fix up handling of nondeterministic collations with pattern_ops opclasses. 2019-09-21 16:29:17 -04:00
pg_opclass.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_operator.dat Reduce match_pattern_prefix()'s dependencies on index opfamilies. 2019-11-20 14:13:04 -05:00
pg_operator.h Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
pg_opfamily.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_opfamily.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_partitioned_table.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_pltemplate.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_pltemplate.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_policy.h Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
pg_proc.dat Stabilize the results of pg_notification_queue_usage(). 2019-11-24 14:09:33 -05:00
pg_proc.h Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
pg_publication.h Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
pg_publication_rel.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_range.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_range.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pg_replication_origin.h Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
pg_rewrite.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_seclabel.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_sequence.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_shdepend.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_shdescription.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_shseclabel.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_statistic.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_statistic_ext.h Allow setting statistics target for extended statistics 2019-09-11 00:25:51 +02:00
pg_statistic_ext_data.h pgindent run prior to branching v12. 2019-07-01 12:37:52 -04:00
pg_subscription.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_subscription_rel.h Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
pg_tablespace.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_tablespace.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_transform.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_trigger.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_ts_config.dat Remove remaining hard-wired OID references in the initial catalog data. 2019-03-12 12:30:35 -04:00
pg_ts_config.h Remove remaining hard-wired OID references in the initial catalog data. 2019-03-12 12:30:35 -04:00
pg_ts_config_map.dat Remove remaining hard-wired OID references in the initial catalog data. 2019-03-12 12:30:35 -04:00
pg_ts_config_map.h Remove remaining hard-wired OID references in the initial catalog data. 2019-03-12 12:30:35 -04:00
pg_ts_dict.dat Remove remaining hard-wired OID references in the initial catalog data. 2019-03-12 12:30:35 -04:00
pg_ts_dict.h Remove remaining hard-wired OID references in the initial catalog data. 2019-03-12 12:30:35 -04:00
pg_ts_parser.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_ts_parser.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_ts_template.dat Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_ts_template.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
pg_type.dat Remove configure --disable-float4-byval 2019-11-21 18:29:21 +01:00
pg_type.h Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
pg_user_mapping.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
reformat_dat_file.pl Minor improvements for reformat_dat_file.pl. 2019-03-08 11:48:49 -05:00
renumber_oids.pl Create a script that can renumber manually-assigned OIDs. 2019-03-12 10:50:48 -04:00
storage.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
storage_xlog.h Fix several recently introduced issues around handling new relation forks. 2019-04-29 19:28:05 -07:00
toasting.h Rework the pg_statistic_ext catalog 2019-06-16 01:20:31 +02:00
unused_oids Show specific OID suggestion in unused_oids output. 2019-08-05 11:47:34 -07:00