postgresql/src/backend/catalog
Tom Lane 8272749e8c Record dependencies of a cast on other casts that it requires.
When creating a cast that uses a conversion function, we've
historically allowed the input and result types to be
binary-compatible with the function's input and result types,
rather than necessarily being identical.  This means that the new
cast is logically dependent on the binary-compatible cast or casts
that it references: if those are defined by pg_cast entries, and you
try to restore the new cast without having defined them, it'll fail.
Hence, we should make pg_depend entries to record these dependencies
so that pg_dump knows that there is an ordering requirement.

This is not the only place where we allow such shortcuts; aggregate
functions for example are similarly lax, and in principle should gain
similar dependencies.  However, for now it seems sufficient to fix
the cast-versus-cast case, as pg_dump's other ordering heuristics
should keep it out of trouble for other object types.

Per report from David Turoň; thanks also to Robert Haas for
preliminary investigation.  I considered back-patching, but
seeing that this issue has existed for many years without
previous reports, it's not clear it's worth the trouble.
Moreover, back-patching wouldn't be enough to ensure that the
new pg_depend entries exist in existing databases anyway.

Discussion: https://postgr.es/m/OF0A160F3E.578B15D1-ONC12588DA.003E4857-C12588DA.0045A428@notes.linuxbox.cz
2022-10-17 14:02:05 -04:00
..
.gitignore Build in some knowledge about foreign-key relationships in the catalogs. 2021-02-02 17:11:55 -05:00
Catalog.pm Make eval statement naturally proof against perltidy 2022-09-12 11:59:43 +07:00
Makefile Allow granting SET and ALTER SYSTEM privileges on GUC parameters. 2022-04-06 13:24:33 -04:00
aclchk.c Harmonize parameter names in storage and AM code. 2022-09-19 19:18:36 -07:00
catalog.c Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
dependency.c Change some errdetail() to errdetail_internal() 2022-09-28 17:14:53 +02:00
genbki.pl Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
heap.c Rename shadowed local variables 2022-10-05 21:01:41 +13:00
index.c Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
indexing.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
information_schema.sql Fix bogus dependency handling for GENERATED expressions. 2022-03-21 14:58:49 -04:00
meson.build meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
namespace.c Rename shadowed local variables 2022-10-05 21:01:41 +13:00
objectaccess.c Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
objectaddress.c Tighten pg_get_object_address argument checking 2022-09-21 09:42:35 -04:00
partition.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_aggregate.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_attrdef.c Fix typos. 2022-09-19 14:21:39 +05:30
pg_cast.c Record dependencies of a cast on other casts that it requires. 2022-10-17 14:02:05 -04:00
pg_class.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_collation.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
pg_constraint.c Fix self-referencing foreign keys with partitioned tables 2022-10-07 19:37:48 +02:00
pg_conversion.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_db_role_setting.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_depend.c Avoid using list_length() to test for empty list. 2022-08-17 11:12:35 -04:00
pg_enum.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_inherits.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_largeobject.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_namespace.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_operator.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
pg_parameter_acl.c Split up guc.c for better build speed and ease of maintenance. 2022-09-13 11:11:45 -04:00
pg_proc.c Add construct_array_builtin, deconstruct_array_builtin 2022-07-01 11:23:15 +02:00
pg_publication.c Message style improvements 2022-09-24 18:41:25 -04:00
pg_range.c Update copyright for 2022 2022-01-07 19:04:57 -05:00
pg_shdepend.c Fix bug in DROP OWNED BY. 2022-09-28 10:42:07 -04:00
pg_subscription.c Move common catalog cache access routines to lsyscache.c 2022-08-02 10:47:22 +05:30
pg_type.c In extensions, don't replace objects not belonging to the extension. 2022-08-08 11:12:31 -04:00
sql_feature_packages.txt Cleanup in SQL features files 2020-03-28 08:46:18 +01:00
sql_features.txt Revert SQL/JSON features 2022-09-01 17:07:14 -04:00
storage.c Revert 56-bit relfilenode change and follow-up commits. 2022-09-28 09:55:28 -04:00
system_functions.sql Support pg_read_[binary_]file (filename, missing_ok). 2022-07-29 15:38:49 -04:00
system_views.sql pgstat: Track time of the last scan of a relation 2022-10-14 11:11:34 -07:00
toasting.c Add UNIQUE null treatment option 2022-02-03 11:48:21 +01:00