- Notifications
You must be signed in to change notification settings - Fork5
Commit529cb26
committed
Improve handling of domains over arrays.
This patch eliminates various bizarre behaviors caused by sloppy thinkingabout the difference between a domain type and its underlying array type.In particular, the operation of updating one element of such an arrayhas to be considered as yielding a value of the underlying array type,*not* a value of the domain, because there's no assurance that thedomain's CHECK constraints are still satisfied. If we're intending tostore the result back into a domain column, we have to re-cast to thedomain type so that constraints are re-checked.For similar reasons, such a domain can't be blindly matched to an ANYARRAYpolymorphic parameter, because the polymorphic function is likely to applyarray-ish operations that could invalidate the domain constraints. For themoment, we just forbid such matching. We might later wish to insert anautomatic downcast to the underlying array type, but such a change shouldalso change matching of domains to ANYELEMENT for consistency.To ensure that all such logic is rechecked, this patch removes the originalhack of setting a domain's pg_type.typelem field to match its base type;the typelem will always be zero instead. In those places where it's reallyokay to look through the domain type with no other logic changes, use thenewly added get_base_element_type function in place of get_element_type.catversion bumped due to change in pg_type contents.Per bug #5717 from Richard Huxton and subsequent discussion.1 parent572ab1a commit529cb26
File tree
21 files changed
+439
-101
lines changed- doc/src/sgml
- src
- backend
- commands
- parser
- utils
- adt
- cache
- fmgr
- include
- catalog
- parser
- utils
- pl/plpgsql/src
- test/regress
- expected
- sql
21 files changed
+439
-101
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5698 | 5698 | | |
5699 | 5699 | | |
5700 | 5700 | | |
5701 | | - | |
5702 | | - | |
5703 | | - | |
| 5701 | + | |
| 5702 | + | |
5704 | 5703 | | |
5705 | 5704 | | |
5706 | 5705 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1657 | 1657 | | |
1658 | 1658 | | |
1659 | 1659 | | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
1660 | 1677 | | |
1661 | 1678 | | |
1662 | 1679 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
528 | 532 | | |
529 | 533 | | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | 534 | | |
537 | 535 | | |
538 | 536 | | |
| |||
746 | 744 | | |
747 | 745 | | |
748 | 746 | | |
749 | | - | |
750 | 747 | | |
751 | 748 | | |
752 | 749 | | |
| |||
831 | 828 | | |
832 | 829 | | |
833 | 830 | | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | 831 | | |
838 | 832 | | |
839 | 833 | | |
| |||
1033 | 1027 | | |
1034 | 1028 | | |
1035 | 1029 | | |
1036 | | - | |
| 1030 | + | |
1037 | 1031 | | |
1038 | 1032 | | |
1039 | 1033 | | |
| |||
1670 | 1664 | | |
1671 | 1665 | | |
1672 | 1666 | | |
1673 | | - | |
| 1667 | + | |
1674 | 1668 | | |
1675 | 1669 | | |
1676 | 1670 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1908 | 1908 | | |
1909 | 1909 | | |
1910 | 1910 | | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
1911 | 1914 | | |
1912 | 1915 | | |
1913 | 1916 | | |
| |||
1921 | 1924 | | |
1922 | 1925 | | |
1923 | 1926 | | |
1924 | | - | |
| 1927 | + | |
1925 | 1928 | | |
1926 | 1929 | | |
1927 | 1930 | | |
| |||
2001 | 2004 | | |
2002 | 2005 | | |
2003 | 2006 | | |
2004 | | - | |
2005 | | - | |
2006 | | - | |
2007 | | - | |
| 2007 | + | |
| 2008 | + | |
2008 | 2009 | | |
2009 | 2010 | | |
2010 | 2011 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
164 | 172 | | |
165 | 173 | | |
166 | 174 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 175 | | |
178 | 176 | | |
179 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
201 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
202 | 209 | | |
203 | 210 | | |
204 | | - | |
| 211 | + | |
205 | 212 | | |
| 213 | + | |
206 | 214 | | |
207 | 215 | | |
208 | 216 | | |
209 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
210 | 227 | | |
211 | | - | |
| 228 | + | |
212 | 229 | | |
213 | | - | |
| 230 | + | |
214 | 231 | | |
215 | 232 | | |
216 | 233 | | |
| |||
220 | 237 | | |
221 | 238 | | |
222 | 239 | | |
223 | | - | |
| 240 | + | |
224 | 241 | | |
225 | 242 | | |
226 | 243 | | |
| |||
241 | 258 | | |
242 | 259 | | |
243 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
244 | 265 | | |
245 | 266 | | |
246 | | - | |
| 267 | + | |
| 268 | + | |
247 | 269 | | |
248 | 270 | | |
249 | | - | |
250 | | - | |
| 271 | + | |
251 | 272 | | |
252 | 273 | | |
253 | 274 | | |
| |||
256 | 277 | | |
257 | 278 | | |
258 | 279 | | |
259 | | - | |
| 280 | + | |
260 | 281 | | |
261 | 282 | | |
262 | 283 | | |
| |||
266 | 287 | | |
267 | 288 | | |
268 | 289 | | |
269 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
270 | 295 | | |
271 | | - | |
| 296 | + | |
272 | 297 | | |
273 | 298 | | |
274 | 299 | | |
| |||
356 | 381 | | |
357 | 382 | | |
358 | 383 | | |
359 | | - | |
| 384 | + | |
360 | 385 | | |
361 | 386 | | |
362 | 387 | | |
| |||
378 | 403 | | |
379 | 404 | | |
380 | 405 | | |
381 | | - | |
| 406 | + | |
382 | 407 | | |
383 | 408 | | |
384 | 409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| |||
906 | 906 | | |
907 | 907 | | |
908 | 908 | | |
909 | | - | |
| 909 | + | |
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
| |||
0 commit comments
Comments
(0)