forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0736a8e
committed
Use a safer outfuncs/readfuncs representation for BitStrings.
For a long time, our outfuncs.c code has supposed that the stringcontents of a BitString node could just be printed literally withno concern for quoting/escaping. Now, that's okay if the stringliteral contains only valid binary or hex digits ... but our lexerdoesn't check that, preferring to let bitin() be the sole authorityon what's valid. So we could have raw parse trees that containincorrect BitString literals, and that can result in failures whenWRITE_READ_PARSE_PLAN_TREES debugging is enabled.Fix by using outToken() to print the string field, and debackslash()to read it. This results in a change in the emitted representationonly in cases that would have failed before, and don't represent validSQL in the first place. Between that and the fact that we don't storeraw parse trees in the catalogs, I judge this safe to apply without acatversion bump.Per bug #18340 from Alexander Lakhin. Back-patch to v16; before that,we lacked readfuncs support for BitString nodes, so that the problemwas only cosmetic.Discussion:https://postgr.es/m/18340-4aa1ae6ed4121912@postgresql.org1 parentc1fc502 commit0736a8e
File tree
4 files changed
+32
-10
lines changed- src
- backend/nodes
- test/regress
- expected
- sql
4 files changed
+32
-10
lines changedLines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
680 | 680 |
| |
681 | 681 |
| |
682 | 682 |
| |
683 |
| - | |
684 |
| - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
685 | 690 |
| |
686 | 691 |
| |
687 | 692 |
| |
|
Lines changed: 3 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
498 | 498 |
| |
499 | 499 |
| |
500 | 500 |
| |
501 |
| - | |
502 |
| - | |
503 |
| - | |
504 |
| - | |
505 |
| - | |
506 |
| - | |
507 |
| - | |
508 |
| - | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
509 | 504 |
| |
510 | 505 |
| |
511 | 506 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
43 | 60 |
| |
44 | 61 |
| |
45 | 62 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
29 | 29 |
| |
30 | 30 |
| |
31 | 31 |
| |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 |
| |
33 | 38 |
| |
34 | 39 |
| |
|
0 commit comments
Comments
(0)