forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit3dd287c
committed
Print the correct aliases for DML target tables in ruleutils.
ruleutils.c blindly printed the user-given alias (or nothing if therehadn't been one) for the target table of INSERT/UPDATE/DELETE queries.That works a large percentage of the time, but not always: for queriesappearing in WITH, it's possible that we chose a different alias toavoid conflict with outer-scope names. Since the chosen alias wouldbe used in any Var references to the target table, this'd lead to aninconsistent printout with consequences such as dump/restore failures.The correct logic for printing (or not) a relation alias was embeddedin get_from_clause_item. Factor it out to a separate function so thatwe don't need a jointree node to use it. (Only a limited part of thatfunction can be reached from these new call sites, but this seems likethe cleanest non-duplicative factorization.)In passing, I got rid of a redundant "\d+ rules_src" step in rules.sql.Initial report from Jonathan Katz; thanks to Vignesh C for analysis.This has been broken for a long time, so back-patch to all supportedbranches.Discussion:https://postgr.es/m/e947fa21-24b2-f922-375a-d4f763ef3e4b@postgresql.orgDiscussion:https://postgr.es/m/CALDaNm1MMntjmT_NJGp-Z=xbF02qHGAyuSHfYHias3TqQbPF2w@mail.gmail.com1 parenta40e7b7 commit3dd287c
File tree
3 files changed
+126
-79
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+126
-79
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
| 455 | + | |
| 456 | + | |
455 | 457 | | |
456 | 458 | | |
457 | 459 | | |
| |||
6255 | 6257 | | |
6256 | 6258 | | |
6257 | 6259 | | |
6258 | | - | |
| 6260 | + | |
6259 | 6261 | | |
6260 | | - | |
6261 | | - | |
6262 | | - | |
6263 | | - | |
| 6262 | + | |
| 6263 | + | |
| 6264 | + | |
| 6265 | + | |
| 6266 | + | |
| 6267 | + | |
6264 | 6268 | | |
6265 | 6269 | | |
6266 | 6270 | | |
| |||
6442 | 6446 | | |
6443 | 6447 | | |
6444 | 6448 | | |
6445 | | - | |
6446 | | - | |
6447 | | - | |
| 6449 | + | |
| 6450 | + | |
| 6451 | + | |
| 6452 | + | |
6448 | 6453 | | |
6449 | 6454 | | |
6450 | 6455 | | |
| |||
6651 | 6656 | | |
6652 | 6657 | | |
6653 | 6658 | | |
6654 | | - | |
6655 | | - | |
6656 | | - | |
| 6659 | + | |
| 6660 | + | |
| 6661 | + | |
6657 | 6662 | | |
6658 | 6663 | | |
6659 | 6664 | | |
| |||
10105 | 10110 | | |
10106 | 10111 | | |
10107 | 10112 | | |
10108 | | - | |
10109 | 10113 | | |
10110 | 10114 | | |
10111 | | - | |
10112 | 10115 | | |
10113 | 10116 | | |
10114 | 10117 | | |
| |||
10245 | 10248 | | |
10246 | 10249 | | |
10247 | 10250 | | |
10248 | | - | |
10249 | | - | |
10250 | | - | |
10251 | | - | |
10252 | | - | |
10253 | | - | |
10254 | | - | |
10255 | | - | |
10256 | | - | |
10257 | | - | |
10258 | | - | |
10259 | | - | |
10260 | | - | |
10261 | | - | |
10262 | | - | |
10263 | | - | |
10264 | | - | |
10265 | | - | |
10266 | | - | |
10267 | | - | |
10268 | | - | |
10269 | | - | |
10270 | | - | |
10271 | | - | |
10272 | | - | |
10273 | | - | |
10274 | | - | |
10275 | | - | |
10276 | | - | |
10277 | | - | |
10278 | | - | |
10279 | | - | |
10280 | | - | |
10281 | | - | |
10282 | | - | |
10283 | | - | |
10284 | | - | |
10285 | | - | |
10286 | | - | |
10287 | | - | |
10288 | | - | |
10289 | | - | |
10290 | | - | |
10291 | | - | |
10292 | | - | |
10293 | | - | |
10294 | | - | |
10295 | | - | |
| 10251 | + | |
10296 | 10252 | | |
10297 | 10253 | | |
10298 | 10254 | | |
| |||
10426 | 10382 | | |
10427 | 10383 | | |
10428 | 10384 | | |
| 10385 | + | |
| 10386 | + | |
| 10387 | + | |
| 10388 | + | |
| 10389 | + | |
| 10390 | + | |
| 10391 | + | |
| 10392 | + | |
| 10393 | + | |
| 10394 | + | |
| 10395 | + | |
| 10396 | + | |
| 10397 | + | |
| 10398 | + | |
| 10399 | + | |
| 10400 | + | |
| 10401 | + | |
| 10402 | + | |
| 10403 | + | |
| 10404 | + | |
| 10405 | + | |
| 10406 | + | |
| 10407 | + | |
| 10408 | + | |
| 10409 | + | |
| 10410 | + | |
| 10411 | + | |
| 10412 | + | |
| 10413 | + | |
| 10414 | + | |
| 10415 | + | |
| 10416 | + | |
| 10417 | + | |
| 10418 | + | |
| 10419 | + | |
| 10420 | + | |
| 10421 | + | |
| 10422 | + | |
| 10423 | + | |
| 10424 | + | |
| 10425 | + | |
| 10426 | + | |
| 10427 | + | |
| 10428 | + | |
| 10429 | + | |
| 10430 | + | |
| 10431 | + | |
| 10432 | + | |
| 10433 | + | |
| 10434 | + | |
| 10435 | + | |
| 10436 | + | |
| 10437 | + | |
| 10438 | + | |
| 10439 | + | |
| 10440 | + | |
| 10441 | + | |
| 10442 | + | |
| 10443 | + | |
| 10444 | + | |
| 10445 | + | |
| 10446 | + | |
| 10447 | + | |
| 10448 | + | |
| 10449 | + | |
| 10450 | + | |
| 10451 | + | |
10429 | 10452 | | |
10430 | 10453 | | |
10431 | 10454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2971 | 2971 | | |
2972 | 2972 | | |
2973 | 2973 | | |
2974 | | - | |
2975 | | - | |
2976 | | - | |
2977 | | - | |
2978 | | - | |
2979 | | - | |
2980 | | - | |
2981 | | - | |
2982 | | - | |
2983 | | - | |
2984 | | - | |
2985 | | - | |
2986 | | - | |
2987 | | - | |
2988 | | - | |
2989 | | - | |
2990 | | - | |
2991 | 2974 | | |
2992 | 2975 | | |
2993 | 2976 | | |
2994 | 2977 | | |
2995 | 2978 | | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
2996 | 2989 | | |
2997 | 2990 | | |
2998 | 2991 | | |
| |||
3017 | 3010 | | |
3018 | 3011 | | |
3019 | 3012 | | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
3020 | 3033 | | |
3021 | 3034 | | |
3022 | 3035 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1034 | 1034 | | |
1035 | 1035 | | |
1036 | 1036 | | |
1037 | | - | |
1038 | 1037 | | |
1039 | 1038 | | |
1040 | 1039 | | |
1041 | 1040 | | |
1042 | 1041 | | |
1043 | 1042 | | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
1044 | 1055 | | |
1045 | 1056 | | |
1046 | 1057 | | |
| |||
0 commit comments
Comments
(0)