- Notifications
You must be signed in to change notification settings - Fork5
Commit906bfca
committed
Improve handling of "UPDATE ... SET (column_list) = row_constructor".
Previously, the right-hand side of a multiple-column assignment, if itwasn't a sub-SELECT, had to be a simple parenthesized expression list,because gram.y was responsible for "bursting" the construct intoindependent column assignments. This had the minor defect that youcouldn't write ROW (though you should be able to, since the standard saysthis is a row constructor), and the rather larger defect that unlike otheruses of row constructors, we would not expand a "foo.*" item into multiplecolumns.Fix that by changing the RHS to be just "a_expr" in the grammar, leavingit to transformMultiAssignRef to separate the elements of a RowExpr;which it will do only after performing standard transformation of theRowExpr, so that "foo.*" behaves as expected.The key reason we didn't do that before was the hard-wired handling ofDEFAULT tokens (SetToDefault nodes). This patch deals with that issue byallowing DEFAULT in any a_expr and having parse analysis throw an errorif SetToDefault is found in an unexpected place. That's an improvementanyway since the error can be more specific than just "syntax error".The SQL standard suggests that the RHS could be any a_expr yielding asuitable row value. This patch doesn't really move the goal posts in thatrespect --- you're still limited to RowExpr or a sub-SELECT --- but it doesfix the grammar restriction, so it provides some tangible progress towardsa full implementation. And the limitation is now documented by an expliciterror message rather than an unhelpful "syntax error".Discussion: <8542.1479742008@sss.pgh.pa.us>1 parente8ac886 commit906bfca
File tree
8 files changed
+230
-182
lines changed- doc/src/sgml/ref
- src
- backend/parser
- include/parser
- test/regress
- expected
- sql
8 files changed
+230
-182
lines changedLines changed: 7 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 |
| - | |
| 27 | + | |
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
| |||
420 | 420 |
| |
421 | 421 |
| |
422 | 422 |
| |
423 |
| - | |
424 |
| - | |
425 |
| - | |
426 |
| - | |
427 |
| - | |
428 |
| - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
429 | 429 |
| |
430 | 430 |
| |
431 | 431 |
|
Lines changed: 20 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
644 | 644 |
| |
645 | 645 |
| |
646 | 646 |
| |
647 |
| - | |
648 |
| - | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
649 | 653 |
| |
650 | 654 |
| |
651 | 655 |
| |
| |||
752 | 756 |
| |
753 | 757 |
| |
754 | 758 |
| |
755 |
| - | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
756 | 763 |
| |
757 | 764 |
| |
758 |
| - | |
| 765 | + | |
| 766 | + | |
759 | 767 |
| |
760 | 768 |
| |
761 | 769 |
| |
| |||
1293 | 1301 |
| |
1294 | 1302 |
| |
1295 | 1303 |
| |
1296 |
| - | |
1297 |
| - | |
1298 |
| - | |
| 1304 | + | |
1299 | 1305 |
| |
1300 | 1306 |
| |
1301 | 1307 |
| |
| |||
1305 | 1311 |
| |
1306 | 1312 |
| |
1307 | 1313 |
| |
1308 |
| - | |
1309 |
| - | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
1310 | 1320 |
| |
1311 | 1321 |
| |
1312 | 1322 |
| |
| |||
1329 | 1339 |
| |
1330 | 1340 |
| |
1331 | 1341 |
| |
1332 |
| - | |
| 1342 | + | |
1333 | 1343 |
| |
1334 | 1344 |
| |
1335 | 1345 |
| |
1336 | 1346 |
| |
1337 | 1347 |
| |
1338 |
| - | |
1339 |
| - | |
1340 |
| - | |
1341 |
| - | |
1342 |
| - | |
1343 | 1348 |
| |
1344 | 1349 |
| |
1345 | 1350 |
| |
|
Lines changed: 31 additions & 94 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
365 | 365 |
| |
366 | 366 |
| |
367 | 367 |
| |
368 |
| - | |
369 |
| - | |
| 368 | + | |
| 369 | + | |
370 | 370 |
| |
371 | 371 |
| |
372 | 372 |
| |
| |||
454 | 454 |
| |
455 | 455 |
| |
456 | 456 |
| |
457 |
| - | |
458 | 457 |
| |
459 | 458 |
| |
460 | 459 |
| |
| |||
466 | 465 |
| |
467 | 466 |
| |
468 | 467 |
| |
469 |
| - | |
| 468 | + | |
470 | 469 |
| |
471 | 470 |
| |
472 | 471 |
| |
| |||
9914 | 9913 |
| |
9915 | 9914 |
| |
9916 | 9915 |
| |
9917 |
| - | |
9918 |
| - | |
9919 |
| - | |
9920 |
| - | |
9921 |
| - | |
9922 |
| - | |
9923 |
| - | |
9924 |
| - | |
9925 |
| - | |
9926 |
| - | |
9927 |
| - | |
9928 |
| - | |
9929 |
| - | |
9930 |
| - | |
9931 |
| - | |
9932 |
| - | |
9933 |
| - | |
9934 |
| - | |
9935 |
| - | |
9936 |
| - | |
9937 |
| - | |
9938 |
| - | |
| 9916 | + | |
9939 | 9917 |
| |
9940 |
| - | |
9941 |
| - | |
9942 |
| - | |
9943 |
| - | |
9944 |
| - | |
9945 |
| - | |
9946 |
| - | |
9947 |
| - | |
9948 |
| - | |
9949 |
| - | |
9950 |
| - | |
9951 |
| - | |
9952 |
| - | |
9953 |
| - | |
9954 |
| - | |
9955 |
| - | |
9956 |
| - | |
9957 |
| - | |
9958 |
| - | |
9959 |
| - | |
9960 |
| - | |
9961 |
| - | |
9962 |
| - | |
| 9918 | + | |
| 9919 | + | |
9963 | 9920 |
| |
9964 |
| - | |
| 9921 | + | |
9965 | 9922 |
| |
9966 |
| - | |
9967 | 9923 |
| |
9968 | 9924 |
| |
9969 | 9925 |
| |
9970 | 9926 |
| |
9971 |
| - | |
9972 |
| - | |
9973 |
| - | |
9974 |
| - | |
9975 |
| - | |
9976 |
| - | |
9977 |
| - | |
9978 |
| - | |
9979 | 9927 |
| |
9980 | 9928 |
| |
9981 | 9929 |
| |
9982 | 9930 |
| |
9983 | 9931 |
| |
9984 | 9932 |
| |
9985 |
| - | |
| 9933 | + | |
9986 | 9934 |
| |
9987 | 9935 |
| |
9988 | 9936 |
| |
| |||
10641 | 10589 |
| |
10642 | 10590 |
| |
10643 | 10591 |
| |
| 10592 | + | |
| 10593 | + | |
| 10594 | + | |
| 10595 | + | |
| 10596 | + | |
10644 | 10597 |
| |
10645 |
| - | |
| 10598 | + | |
10646 | 10599 |
| |
10647 | 10600 |
| |
10648 |
| - | |
| 10601 | + | |
10649 | 10602 |
| |
10650 | 10603 |
| |
10651 |
| - | |
| 10604 | + | |
10652 | 10605 |
| |
10653 | 10606 |
| |
10654 |
| - | |
| 10607 | + | |
10655 | 10608 |
| |
10656 | 10609 |
| |
10657 | 10610 |
| |
| |||
12042 | 11995 |
| |
12043 | 11996 |
| |
12044 | 11997 |
| |
| 11998 | + | |
| 11999 | + | |
| 12000 | + | |
| 12001 | + | |
| 12002 | + | |
| 12003 | + | |
| 12004 | + | |
| 12005 | + | |
| 12006 | + | |
| 12007 | + | |
| 12008 | + | |
| 12009 | + | |
| 12010 | + | |
| 12011 | + | |
12045 | 12012 |
| |
12046 | 12013 |
| |
12047 | 12014 |
| |
| |||
13297 | 13264 |
| |
13298 | 13265 |
| |
13299 | 13266 |
| |
13300 |
| - | |
13301 |
| - | |
13302 |
| - | |
13303 |
| - | |
13304 |
| - | |
13305 |
| - | |
13306 |
| - | |
13307 |
| - | |
13308 |
| - | |
13309 |
| - | |
13310 |
| - | |
13311 |
| - | |
13312 |
| - | |
13313 |
| - | |
13314 |
| - | |
13315 |
| - | |
13316 |
| - | |
13317 |
| - | |
13318 |
| - | |
13319 |
| - | |
13320 |
| - | |
13321 |
| - | |
13322 |
| - | |
13323 |
| - | |
13324 |
| - | |
13325 |
| - | |
13326 |
| - | |
13327 |
| - | |
13328 |
| - | |
13329 |
| - | |
13330 | 13267 |
| |
13331 | 13268 |
| |
13332 | 13269 |
| |
|
0 commit comments
Comments
(0)