forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc034b62
committed
Change type "char"'s I/O format for non-ASCII characters.
Previously, a byte with the high bit set was just transmittedas-is by charin() and charout(). This is problematic if thedatabase encoding is multibyte, because the result of charout()won't be validly encoded, which breaks various stuff thatexpects all text strings to be validly encoded. We'vepreviously decided to enforce encoding validity rather than tryto individually harden each place that might have a problem withsuch strings, so it's time to do something about "char".To fix, represent high-bit-set characters as \ooo (backslashand three octal digits), following the ancient "escape" formatfor bytea. charin() will continue to accept the old way as well,though that is only reachable in single-byte encodings.Add some test cases just so there is coverage for this code.We'll otherwise leave this question undocumented as it was before,because we don't really want to encourage end-user use of "char".For the moment, back-patch into v15 so that this change appearsin 15beta3. If there's not great pushback we should considerabsorbing this change into the older branches.Discussion:https://postgr.es/m/2318797.1638558730@sss.pgh.pa.us1 parent5b94d3c commitc034b62
File tree
6 files changed
+263
-28
lines changed- doc/src/sgml
- src
- backend/utils/adt
- test/regress
- expected
- sql
6 files changed
+263
-28
lines changedLines changed: 6 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1338 | 1338 |
| |
1339 | 1339 |
| |
1340 | 1340 |
| |
1341 |
| - | |
1342 |
| - | |
1343 |
| - | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
1344 | 1345 |
| |
1345 | 1346 |
| |
1346 | 1347 |
| |
1347 | 1348 |
| |
1348 | 1349 |
| |
1349 | 1350 |
| |
1350 | 1351 |
| |
1351 |
| - | |
| 1352 | + | |
| 1353 | + | |
1352 | 1354 |
| |
1353 | 1355 |
| |
1354 | 1356 |
| |
|
Lines changed: 56 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 |
| |
24 | 29 |
| |
25 | 30 |
| |
26 | 31 |
| |
27 | 32 |
| |
28 | 33 |
| |
29 | 34 |
| |
30 |
| - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 |
| |
32 | 39 |
| |
33 | 40 |
| |
34 | 41 |
| |
35 | 42 |
| |
36 | 43 |
| |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
37 | 50 |
| |
38 | 51 |
| |
39 | 52 |
| |
40 | 53 |
| |
41 | 54 |
| |
42 | 55 |
| |
43 |
| - | |
44 |
| - | |
45 |
| - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
46 | 61 |
| |
47 | 62 |
| |
48 | 63 |
| |
49 | 64 |
| |
50 | 65 |
| |
51 |
| - | |
| 66 | + | |
52 | 67 |
| |
53 |
| - | |
54 |
| - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
55 | 82 |
| |
56 | 83 |
| |
57 | 84 |
| |
| |||
176 | 203 |
| |
177 | 204 |
| |
178 | 205 |
| |
| 206 | + | |
179 | 207 |
| |
180 | 208 |
| |
181 | 209 |
| |
182 |
| - | |
183 |
| - | |
184 |
| - | |
| 210 | + | |
| 211 | + | |
185 | 212 |
| |
186 |
| - | |
187 |
| - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
188 | 220 |
| |
189 | 221 |
| |
190 | 222 |
| |
| |||
195 | 227 |
| |
196 | 228 |
| |
197 | 229 |
| |
198 |
| - | |
| 230 | + | |
199 | 231 |
| |
200 | 232 |
| |
201 |
| - | |
202 |
| - | |
| 233 | + | |
| 234 | + | |
203 | 235 |
| |
204 |
| - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
205 | 245 |
| |
206 | 246 |
| |
207 | 247 |
| |
|
Lines changed: 61 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 |
| - | |
5 |
| - | |
| 4 | + | |
| 5 | + | |
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + |
Lines changed: 61 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 |
| - | |
5 |
| - | |
| 4 | + | |
| 5 | + | |
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + |
Lines changed: 61 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 |
| - | |
5 |
| - | |
| 4 | + | |
| 5 | + | |
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + |
0 commit comments
Comments
(0)