forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6c0373a
committed
Allow table-qualified variable names in ON CONFLICT ... WHERE.
Previously you could only use unqualified variable names here.While that's not a functional deficiency, since only the targettable can be referenced, it's a surprising inconsistency with therules for partial-index predicates, on which this syntax issupposedly modeled.The fix for that is no harder than passing addToRelNameSpace = trueto addNSItemToQuery. However, it's really pretty bogus fortransformOnConflictArbiter and transformOnConflictClause to bemessing with the namespace item for the target table at all.It's not theirs to manage, it results in duplicative creations ofnamespace items, and transformOnConflictClause wasn't even doingit quite correctly (that coding resulted in two nsitems for thetarget table, since it hadn't cleaned out the existing one).Hence, make transformInsertStmt responsible for setting up thetarget nsitem once for both these clauses and RETURNING.Also, arrange for ON CONFLICT ... UPDATE's "excluded" pseudo-relationto be added to the rangetable before we run transformOnConflictArbiter.This produces a more helpful HINT if someone writes "excluded.col"in the arbiter expression.Per bug #16958 from Lukas Eder. Although I agree this is a bug,the consequences are hardly severe, so no back-patch.Discussion:https://postgr.es/m/16958-963f638020de271c@postgresql.org1 parente8c435a commit6c0373a
File tree
4 files changed
+52
-48
lines changed- src
- backend/parser
- test/regress
- expected
- sql
4 files changed
+52
-48
lines changedLines changed: 49 additions & 32 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
869 | 869 |
| |
870 | 870 |
| |
871 | 871 |
| |
872 |
| - | |
873 |
| - | |
874 |
| - | |
875 |
| - | |
876 |
| - | |
877 | 872 |
| |
878 |
| - | |
879 |
| - | |
880 |
| - | |
| 873 | + | |
| 874 | + | |
881 | 875 |
| |
882 | 876 |
| |
883 |
| - | |
| 877 | + | |
884 | 878 |
| |
885 | 879 |
| |
886 | 880 |
| |
887 | 881 |
| |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
888 | 891 |
| |
889 | 892 |
| |
890 |
| - | |
891 | 893 |
| |
892 | 894 |
| |
893 | 895 |
| |
| |||
1014 | 1016 |
| |
1015 | 1017 |
| |
1016 | 1018 |
| |
| 1019 | + | |
1017 | 1020 |
| |
1018 | 1021 |
| |
1019 | 1022 |
| |
| |||
1023 | 1026 |
| |
1024 | 1027 |
| |
1025 | 1028 |
| |
1026 |
| - | |
1027 |
| - | |
1028 |
| - | |
1029 |
| - | |
1030 |
| - | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
1031 | 1035 |
| |
1032 | 1036 |
| |
1033 | 1037 |
| |
1034 |
| - | |
1035 | 1038 |
| |
1036 | 1039 |
| |
1037 |
| - | |
1038 |
| - | |
1039 |
| - | |
1040 |
| - | |
1041 |
| - | |
1042 |
| - | |
1043 |
| - | |
1044 |
| - | |
1045 |
| - | |
1046 |
| - | |
1047 |
| - | |
1048 |
| - | |
1049 | 1040 |
| |
1050 | 1041 |
| |
1051 | 1042 |
| |
| |||
1054 | 1045 |
| |
1055 | 1046 |
| |
1056 | 1047 |
| |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
1057 | 1053 |
| |
1058 | 1054 |
| |
1059 | 1055 |
| |
1060 | 1056 |
| |
1061 | 1057 |
| |
1062 | 1058 |
| |
1063 | 1059 |
| |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
1064 | 1075 |
| |
1065 | 1076 |
| |
1066 |
| - | |
1067 |
| - | |
| 1077 | + | |
| 1078 | + | |
1068 | 1079 |
| |
1069 | 1080 |
| |
1070 |
| - | |
1071 |
| - | |
1072 | 1081 |
| |
1073 | 1082 |
| |
1074 | 1083 |
| |
| |||
1079 | 1088 |
| |
1080 | 1089 |
| |
1081 | 1090 |
| |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
1082 | 1099 |
| |
1083 | 1100 |
| |
1084 | 1101 |
| |
|
Lines changed: 0 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3222 | 3222 |
| |
3223 | 3223 |
| |
3224 | 3224 |
| |
3225 |
| - | |
3226 |
| - | |
3227 |
| - | |
3228 |
| - | |
3229 |
| - | |
3230 |
| - | |
3231 |
| - | |
3232 |
| - | |
3233 |
| - | |
3234 |
| - | |
3235 |
| - | |
3236 | 3225 |
| |
3237 | 3226 |
| |
3238 | 3227 |
| |
| |||
3245 | 3234 |
| |
3246 | 3235 |
| |
3247 | 3236 |
| |
3248 |
| - | |
3249 |
| - | |
3250 | 3237 |
| |
3251 | 3238 |
| |
3252 | 3239 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
248 | 248 |
| |
249 | 249 |
| |
250 | 250 |
| |
251 |
| - | |
| 251 | + | |
252 | 252 |
| |
253 | 253 |
| |
254 | 254 |
| |
| |||
373 | 373 |
| |
374 | 374 |
| |
375 | 375 |
| |
376 |
| - | |
| 376 | + | |
377 | 377 |
| |
378 | 378 |
| |
379 | 379 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
214 | 214 |
| |
215 | 215 |
| |
216 | 216 |
| |
217 |
| - | |
| 217 | + | |
218 | 218 |
| |
219 | 219 |
| |
220 | 220 |
| |
|
0 commit comments
Comments
(0)