forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7f56eaf
committed
SQL/JSON: Fix casting for integer EXISTS columns in JSON_TABLE
The current method of coercing the boolean result value ofJsonPathExists() to the target type specified for an EXISTS column,which is to call the type's input function via json_populate_type(),leads to an error when the target type is integer, because theinteger input function doesn't recognize boolean literal values asvalid.Instead use the boolean-to-integer cast function for coercion in thatcase so that using integer or domains thereof as type for EXISTScolumns works. Note that coercion for ON ERROR values TRUE and FALSEalready works like that because the parser creates a cast expressionincluding the cast function, but the coercion of the actual resultvalue is not handled by the parser.Tests by Jian He.Reported-by: Jian He <jian.universality@gmail.com>Author: Jian He <jian.universality@gmail.com>Author: Amit Langote <amitlangote09@gmail.com>Discussion:https://postgr.es/m/CACJufxEo4sUjKCYtda0_qt9tazqqKPmF1cqhW9KBOUeJFqQd2g@mail.gmail.comBackpatch-through: 171 parent74c9669 commit7f56eaf
File tree
5 files changed
+102
-16
lines changed- src
- backend/executor
- include/executor
- test/regress
- expected
- sql
5 files changed
+102
-16
lines changedLines changed: 15 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
93 | 93 |
| |
94 | 94 |
| |
95 | 95 |
| |
| 96 | + | |
96 | 97 |
| |
97 | 98 |
| |
98 | 99 |
| |
| |||
4329 | 4330 |
| |
4330 | 4331 |
| |
4331 | 4332 |
| |
4332 |
| - | |
| 4333 | + | |
| 4334 | + | |
| 4335 | + | |
4333 | 4336 |
| |
4334 | 4337 |
| |
4335 | 4338 |
| |
| |||
4410 | 4413 |
| |
4411 | 4414 |
| |
4412 | 4415 |
| |
4413 |
| - | |
| 4416 | + | |
| 4417 | + | |
4414 | 4418 |
| |
4415 | 4419 |
| |
4416 | 4420 |
| |
| |||
4466 | 4470 |
| |
4467 | 4471 |
| |
4468 | 4472 |
| |
4469 |
| - | |
| 4473 | + | |
| 4474 | + | |
4470 | 4475 |
| |
4471 | 4476 |
| |
4472 | 4477 |
| |
| |||
4502 | 4507 |
| |
4503 | 4508 |
| |
4504 | 4509 |
| |
| 4510 | + | |
4505 | 4511 |
| |
4506 | 4512 |
| |
4507 | 4513 |
| |
| |||
4512 | 4518 |
| |
4513 | 4519 |
| |
4514 | 4520 |
| |
4515 |
| - | |
| 4521 | + | |
4516 | 4522 |
| |
4517 | 4523 |
| |
| 4524 | + | |
| 4525 | + | |
| 4526 | + | |
| 4527 | + | |
| 4528 | + | |
4518 | 4529 |
| |
4519 | 4530 |
|
Lines changed: 38 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4303 | 4303 |
| |
4304 | 4304 |
| |
4305 | 4305 |
| |
4306 |
| - | |
4307 |
| - | |
4308 |
| - | |
4309 |
| - | |
4310 |
| - | |
4311 |
| - | |
4312 |
| - | |
| 4306 | + | |
4313 | 4307 |
| |
4314 | 4308 |
| |
4315 | 4309 |
| |
| |||
4550 | 4544 |
| |
4551 | 4545 |
| |
4552 | 4546 |
| |
| 4547 | + | |
| 4548 | + | |
| 4549 | + | |
| 4550 | + | |
| 4551 | + | |
| 4552 | + | |
| 4553 | + | |
| 4554 | + | |
| 4555 | + | |
| 4556 | + | |
| 4557 | + | |
| 4558 | + | |
| 4559 | + | |
| 4560 | + | |
| 4561 | + | |
| 4562 | + | |
| 4563 | + | |
| 4564 | + | |
| 4565 | + | |
| 4566 | + | |
| 4567 | + | |
| 4568 | + | |
| 4569 | + | |
| 4570 | + | |
| 4571 | + | |
| 4572 | + | |
| 4573 | + | |
| 4574 | + | |
| 4575 | + | |
| 4576 | + | |
| 4577 | + | |
| 4578 | + | |
| 4579 | + | |
| 4580 | + | |
| 4581 | + | |
| 4582 | + | |
4553 | 4583 |
| |
4554 | 4584 |
| |
4555 | 4585 |
| |
4556 |
| - | |
| 4586 | + | |
4557 | 4587 |
| |
4558 | 4588 |
| |
4559 | 4589 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
708 | 708 |
| |
709 | 709 |
| |
710 | 710 |
| |
711 |
| - | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
712 | 716 |
| |
713 | 717 |
| |
714 | 718 |
| |
|
Lines changed: 32 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
178 |
| - | |
| 178 | + | |
179 | 179 |
| |
180 | 180 |
| |
181 | 181 |
| |
| |||
549 | 549 |
| |
550 | 550 |
| |
551 | 551 |
| |
552 |
| - | |
| 552 | + | |
553 | 553 |
| |
554 | 554 |
| |
555 | 555 |
| |
556 | 556 |
| |
557 | 557 |
| |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
558 | 564 |
| |
559 | 565 |
| |
560 | 566 |
| |
| |||
588 | 594 |
| |
589 | 595 |
| |
590 | 596 |
| |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
591 | 621 |
| |
592 | 622 |
| |
593 | 623 |
| |
|
Lines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
262 | 262 |
| |
263 | 263 |
| |
264 | 264 |
| |
265 |
| - | |
| 265 | + | |
| 266 | + | |
266 | 267 |
| |
267 | 268 |
| |
268 | 269 |
| |
| |||
273 | 274 |
| |
274 | 275 |
| |
275 | 276 |
| |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
276 | 287 |
| |
277 | 288 |
| |
278 | 289 |
| |
|
0 commit comments
Comments
(0)