Commit 8272749
committed
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.cz1 parent 797e313 commit 8272749
File tree
9 files changed
+111
-9
lines changed- src
- backend
- catalog
- commands
- parser
- include
- catalog
- parser
- test/regress
- expected
- sql
- tools
9 files changed
+111
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
39 | | - | |
| 44 | + | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
43 | | - | |
44 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
45 | 52 | | |
46 | 53 | | |
47 | 54 | | |
| |||
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
105 | 124 | | |
106 | 125 | | |
107 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1526 | 1526 | | |
1527 | 1527 | | |
1528 | 1528 | | |
| 1529 | + | |
| 1530 | + | |
1529 | 1531 | | |
1530 | 1532 | | |
1531 | 1533 | | |
| |||
1603 | 1605 | | |
1604 | 1606 | | |
1605 | 1607 | | |
1606 | | - | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
1607 | 1611 | | |
1608 | 1612 | | |
1609 | 1613 | | |
| |||
1617 | 1621 | | |
1618 | 1622 | | |
1619 | 1623 | | |
1620 | | - | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
1621 | 1627 | | |
1622 | 1628 | | |
1623 | 1629 | | |
| |||
1756 | 1762 | | |
1757 | 1763 | | |
1758 | 1764 | | |
1759 | | - | |
1760 | | - | |
| 1765 | + | |
| 1766 | + | |
1761 | 1767 | | |
1762 | 1768 | | |
1763 | 1769 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1705 | 1705 | | |
1706 | 1706 | | |
1707 | 1707 | | |
1708 | | - | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
1709 | 1711 | | |
1710 | 1712 | | |
1711 | 1713 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2993 | 2993 | | |
2994 | 2994 | | |
2995 | 2995 | | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
2996 | 3012 | | |
2997 | 3013 | | |
2998 | 3014 | | |
2999 | 3015 | | |
3000 | 3016 | | |
| 3017 | + | |
| 3018 | + | |
3001 | 3019 | | |
3002 | 3020 | | |
3003 | 3021 | | |
| |||
3061 | 3079 | | |
3062 | 3080 | | |
3063 | 3081 | | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
3064 | 3085 | | |
3065 | 3086 | | |
3066 | 3087 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
| 99 | + | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
0 commit comments