forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2d04277
committed
Make serialization of Nodes' scalar-array fields more robust.
When the ability to print variable-length-array fields was firstadded to outfuncs.c, there was no corresponding read capability,as it was used only for debug dumps of planner-internal Nodes.Not a lot of thought seems to have been put into the output format:it's just the space-separated array elements and nothing else.Later such fields appeared in Plan nodes, and still later we grewread support so that Plans could be transferred to parallel workers,but the original text format wasn't rethought. It seems inadequateto me because (a) no cross-check is possible that we got the rightnumber of array entries, (b) we can't tell the difference betweena NULL pointer and a zero-length array, and (c) except forWRITE_INDEX_ARRAY, we'd crash if a non-zero length is specifiedwhen the pointer is NULL, a situation that can arise in some fieldsthat we currently conveniently avoid printing.Since we're currently in a campaign to make the Node infrastructuregenerally more it-just-works-without-thinking-about-it, now seemslike a good time to improve this.Let's adopt a format similar to that used for Lists, that is "<>"for a NULL pointer or "(item item item)" otherwise. Also retoolthe code to not have so many copies of the identical logic.I bumped catversion out of an abundance of caution, although I thinkthat we don't use any such array fields in Nodes that can get intothe catalogs.Discussion:https://postgr.es/m/1528424.1658272135@sss.pgh.pa.us1 parentf77ff08 commit2d04277
File tree
3 files changed
+88
-123
lines changed- src
- backend/nodes
- include/catalog
3 files changed
+88
-123
lines changedLines changed: 48 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
| 19 | + | |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
| |||
96 | 97 |
| |
97 | 98 |
| |
98 | 99 |
| |
| 100 | + | |
99 | 101 |
| |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
| 102 | + | |
| 103 | + | |
105 | 104 |
| |
| 105 | + | |
106 | 106 |
| |
107 |
| - | |
108 |
| - | |
109 |
| - | |
110 |
| - | |
111 |
| - | |
| 107 | + | |
| 108 | + | |
112 | 109 |
| |
113 |
| - | |
114 |
| - | |
115 |
| - | |
116 |
| - | |
| 110 | + | |
117 | 111 |
| |
118 |
| - | |
119 |
| - | |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
124 |
| - | |
125 |
| - | |
| 112 | + | |
| 113 | + | |
126 | 114 |
| |
| 115 | + | |
127 | 116 |
| |
128 |
| - | |
129 |
| - | |
130 |
| - | |
131 |
| - | |
132 |
| - | |
| 117 | + | |
| 118 | + | |
133 | 119 |
| |
| 120 | + | |
134 | 121 |
| |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
139 |
| - | |
140 |
| - | |
| 122 | + | |
| 123 | + | |
141 | 124 |
| |
142 | 125 |
| |
143 | 126 |
| |
| |||
196 | 179 |
| |
197 | 180 |
| |
198 | 181 |
| |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
199 | 214 |
| |
200 | 215 |
| |
201 | 216 |
| |
|
Lines changed: 39 additions & 89 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
502 | 502 |
| |
503 | 503 |
| |
504 | 504 |
| |
505 |
| - | |
506 |
| - | |
507 |
| - | |
508 |
| - | |
509 |
| - | |
510 |
| - | |
511 |
| - | |
512 |
| - | |
513 |
| - | |
514 |
| - | |
515 |
| - | |
516 |
| - | |
517 |
| - | |
518 |
| - | |
519 |
| - | |
520 |
| - | |
521 |
| - | |
522 |
| - | |
523 |
| - | |
524 |
| - | |
525 |
| - | |
526 |
| - | |
527 |
| - | |
528 |
| - | |
529 |
| - | |
530 |
| - | |
531 |
| - | |
532 |
| - | |
533 |
| - | |
534 |
| - | |
535 |
| - | |
536 |
| - | |
537 |
| - | |
538 |
| - | |
539 |
| - | |
540 |
| - | |
541 |
| - | |
542 |
| - | |
543 |
| - | |
544 |
| - | |
545 |
| - | |
546 |
| - | |
547 |
| - | |
548 |
| - | |
549 |
| - | |
550 |
| - | |
551 |
| - | |
552 |
| - | |
553 |
| - | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
554 | 511 |
| |
555 |
| - | |
556 |
| - | |
557 |
| - | |
558 |
| - | |
559 |
| - | |
560 |
| - | |
561 |
| - | |
562 |
| - | |
563 |
| - | |
564 |
| - | |
565 |
| - | |
566 |
| - | |
567 |
| - | |
568 |
| - | |
569 |
| - | |
570 |
| - | |
571 |
| - | |
572 |
| - | |
573 |
| - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
574 | 537 |
| |
575 | 538 |
| |
576 | 539 |
| |
577 |
| - | |
| 540 | + | |
| 541 | + | |
578 | 542 |
| |
579 |
| - | |
580 |
| - | |
581 |
| - | |
582 |
| - | |
583 |
| - | |
584 |
| - | |
585 |
| - | |
586 |
| - | |
587 |
| - | |
588 |
| - | |
589 |
| - | |
590 |
| - | |
591 |
| - | |
592 |
| - | |
593 |
| - | |
594 |
| - | |
595 |
| - | |
596 |
| - | |
597 |
| - | |
598 |
| - | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + |
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 |
| - | |
| 60 | + | |
61 | 61 |
| |
62 | 62 |
|
0 commit comments
Comments
(0)