forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfadff3f
committed
Prevent mis-encoding of "trailing junk after numeric literal" errors.
Since commit2549f06, we reject an identifier immediately followinga numeric literal (without separating whitespace), because that risksambiguity with hex/octal/binary integers. However, that patch usedtoken patterns like "{integer}{ident_start}", which is problematicbecause {ident_start} matches only a single byte. If the firstcharacter after the integer is a multibyte character, this ends upwith flex reporting an error message that includes a partial multibytecharacter. That can cause assorted bad-encoding problems downstream,both in the report to the client and in the postmaster log file.To fix, use {identifier} not {ident_start} in the "junk" tokenpatterns, so that they will match complete multibyte characters.This seems generally better user experience quite aside from theencoding problem: for "123abc" the error message will now say thatthe error appeared at or near "123abc" instead of "123a".While at it, add some commentary about why these patterns existand how they work.Report and patch by Karina Litskevich; review by Pavel Borisov.Back-patch to v15 where the problem came in.Discussion:https://postgr.es/m/CACiT8iZ_diop=0zJ7zuY3BXegJpkKK1Av-PU7xh0EDYHsa5+=g@mail.gmail.com1 parent85837b8 commitfadff3f
File tree
4 files changed
+74
-62
lines changed- src
- backend/parser
- fe_utils
- interfaces/ecpg/preproc
- test/regress/expected
4 files changed
+74
-62
lines changedLines changed: 23 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
412 | 412 |
| |
413 | 413 |
| |
414 | 414 |
| |
415 |
| - | |
416 |
| - | |
417 |
| - | |
418 |
| - | |
419 |
| - | |
420 |
| - | |
421 |
| - | |
422 | 415 |
| |
423 | 416 |
| |
424 |
| - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
425 | 439 |
| |
426 | 440 |
| |
427 | 441 |
| |
| |||
1055 | 1069 |
| |
1056 | 1070 |
| |
1057 | 1071 |
| |
1058 |
| - | |
1059 |
| - | |
1060 |
| - | |
1061 |
| - | |
1062 |
| - | |
1063 |
| - | |
1064 |
| - | |
1065 |
| - | |
1066 |
| - | |
1067 |
| - | |
1068 |
| - | |
1069 |
| - | |
1070 |
| - | |
| 1072 | + | |
1071 | 1073 |
| |
1072 | 1074 |
| |
1073 | 1075 |
| |
|
Lines changed: 23 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
348 | 348 |
| |
349 | 349 |
| |
350 | 350 |
| |
351 |
| - | |
352 |
| - | |
353 |
| - | |
354 |
| - | |
355 |
| - | |
356 |
| - | |
357 |
| - | |
358 | 351 |
| |
359 | 352 |
| |
360 |
| - | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
361 | 375 |
| |
362 | 376 |
| |
363 | 377 |
| |
| |||
898 | 912 |
| |
899 | 913 |
| |
900 | 914 |
| |
901 |
| - | |
902 |
| - | |
903 |
| - | |
904 |
| - | |
905 |
| - | |
906 |
| - | |
907 |
| - | |
908 |
| - | |
909 |
| - | |
910 |
| - | |
| 915 | + | |
911 | 916 |
| |
912 | 917 |
| |
913 | 918 |
| |
|
Lines changed: 23 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
381 | 381 |
| |
382 | 382 |
| |
383 | 383 |
| |
384 |
| - | |
385 |
| - | |
386 |
| - | |
387 |
| - | |
388 |
| - | |
389 |
| - | |
390 |
| - | |
391 | 384 |
| |
392 | 385 |
| |
393 |
| - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
394 | 408 |
| |
395 | 409 |
| |
396 | 410 |
| |
| |||
1023 | 1037 |
| |
1024 | 1038 |
| |
1025 | 1039 |
| |
1026 |
| - | |
1027 |
| - | |
1028 |
| - | |
1029 |
| - | |
1030 |
| - | |
1031 |
| - | |
1032 |
| - | |
1033 |
| - | |
1034 |
| - | |
1035 |
| - | |
| 1040 | + | |
1036 | 1041 |
| |
1037 | 1042 |
| |
1038 | 1043 |
| |
|
Lines changed: 5 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
174 |
| - | |
| 174 | + | |
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
| |||
322 | 322 |
| |
323 | 323 |
| |
324 | 324 |
| |
325 |
| - | |
| 325 | + | |
326 | 326 |
| |
327 | 327 |
| |
328 | 328 |
| |
| |||
334 | 334 |
| |
335 | 335 |
| |
336 | 336 |
| |
337 |
| - | |
| 337 | + | |
338 | 338 |
| |
339 | 339 |
| |
340 | 340 |
| |
341 | 341 |
| |
342 | 342 |
| |
343 | 343 |
| |
344 | 344 |
| |
345 |
| - | |
| 345 | + | |
346 | 346 |
| |
347 | 347 |
| |
348 | 348 |
| |
349 |
| - | |
| 349 | + | |
350 | 350 |
| |
351 | 351 |
| |
352 | 352 |
| |
|
0 commit comments
Comments
(0)