- Notifications
You must be signed in to change notification settings - Fork5
Commit1f7c85b
committed
Fix ruleutils.c's dumping of ScalarArrayOpExpr containing an EXPR_SUBLINK.
When we shoehorned "x op ANY (array)" into the SQL syntax, we created afundamental ambiguity as to the proper treatment of a sub-SELECT on therighthand side: perhaps what's meant is to compare x against each row ofthe sub-SELECT's result, or perhaps the sub-SELECT is meant as a scalarsub-SELECT that delivers a single array value whose members should becompared against x. The grammar resolves it as the former case wheneverthe RHS is a select_with_parens, making the latter case hard to reach ---but you can get at it, with tricks such as attaching a no-op cast to thesub-SELECT. Parse analysis would throw away the no-op cast, leaving aparsetree with an EXPR_SUBLINK SubLink directly under a ScalarArrayOpExpr.ruleutils.c was not clued in on this fine point, and would naively emit"x op ANY ((SELECT ...))", which would be parsed as the first alternative,typically leading to errors like "operator does not exist: text = text[]"during dump/reload of a view or rule containing such a construct. To fix,emit a no-op cast when dumping such a parsetree. This might well beexactly what the user wrote to get the construct accepted in the firstplace; and even if she got there with some other dodge, it is a validrepresentation of the parsetree.Per report from Karl Czajkowski. He mentioned only a case involvingRLS policies, but actually the problem is very old, so back-patch toall supported branches.Report: <20160421001832.GB7976@moraine.isi.edu>1 parentc4a586c commit1f7c85b
File tree
3 files changed
+57
-0
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+57
-0
lines changedLines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7209 | 7209 |
| |
7210 | 7210 |
| |
7211 | 7211 |
| |
| 7212 | + | |
| 7213 | + | |
| 7214 | + | |
| 7215 | + | |
| 7216 | + | |
| 7217 | + | |
| 7218 | + | |
| 7219 | + | |
| 7220 | + | |
| 7221 | + | |
| 7222 | + | |
| 7223 | + | |
| 7224 | + | |
| 7225 | + | |
| 7226 | + | |
| 7227 | + | |
| 7228 | + | |
| 7229 | + | |
7212 | 7230 |
| |
7213 | 7231 |
| |
7214 | 7232 |
| |
|
Lines changed: 28 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1502 | 1502 |
| |
1503 | 1503 |
| |
1504 | 1504 |
| |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
1505 | 1533 |
| |
1506 | 1534 |
| |
1507 | 1535 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
496 | 496 |
| |
497 | 497 |
| |
498 | 498 |
| |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
499 | 510 |
| |
500 | 511 |
| |
501 | 512 |
| |
|
0 commit comments
Comments
(0)