forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4e703d6
committed
Make some minor improvements in the regex code.
Push some hopefully-uncontroversial bits extracted from an upcomingpatch series, to remove non-relevant clutter from the main patches.In compact(), return immediately after setting REG_ASSERT error;continuing the loop would just lead to assertion failure below.(Ask me how I know.)In parseqatom(), remove assertion that moresubs() did its job.When moresubs actually did its job, this is redundant with thatfunction's final assert; but when it failed on OOM, this is anassertion crash. We could avoid the crash by adding a NOERR()check before the assertion, but it seems better to subtract codethan add it. (Note that there's a NOERR exit a few lines furtherdown, and nothing else between here and there requires moresubsto have succeeded. So we don't really need an extra error exit.)This is a live bug in assert-enabled builds, but given the verylow likelihood of OOM in moresub's tiny allocation, I don't thinkit's worth back-patching.On the other hand, it seems worthwhile to add an assertion thatour intended v->subs[subno] target is still null by the time weare ready to insert into it, since there's a recursion in between.In pg_regexec, ensure we fflush any debug output on the way out,and try to make MDEBUG messages more uniform and helpful. (Inparticular, ensure that all of them are prefixed with the subre'sid number, so one can match up entry and exit reports.)Add some test cases in test_regex to improve coverage of lookaheadand lookbehind constraints. Adding these now is mainly to establishthat this is indeed the existing behavior.Discussion:https://postgr.es/m/1340281.1613018383@sss.pgh.pa.us1 parentf40c696 commit4e703d6
File tree
5 files changed
+99
-27
lines changed- src
- backend/regex
- test/modules/test_regex
- expected
- sql
5 files changed
+99
-27
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2902 | 2902 |
| |
2903 | 2903 |
| |
2904 | 2904 |
| |
2905 |
| - | |
| 2905 | + | |
2906 | 2906 |
| |
2907 | 2907 |
| |
2908 | 2908 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
942 | 942 |
| |
943 | 943 |
| |
944 | 944 |
| |
945 |
| - | |
946 | 945 |
| |
947 | 946 |
| |
948 | 947 |
| |
| |||
960 | 959 |
| |
961 | 960 |
| |
962 | 961 |
| |
| 962 | + | |
963 | 963 |
| |
964 | 964 |
| |
965 | 965 |
| |
|
Lines changed: 36 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
324 | 324 |
| |
325 | 325 |
| |
326 | 326 |
| |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
327 | 332 |
| |
328 | 333 |
| |
329 | 334 |
| |
| |||
668 | 673 |
| |
669 | 674 |
| |
670 | 675 |
| |
671 |
| - | |
| 676 | + | |
672 | 677 |
| |
673 | 678 |
| |
674 | 679 |
| |
| |||
697 | 702 |
| |
698 | 703 |
| |
699 | 704 |
| |
700 |
| - | |
| 705 | + | |
701 | 706 |
| |
702 | 707 |
| |
703 | 708 |
| |
| |||
779 | 784 |
| |
780 | 785 |
| |
781 | 786 |
| |
782 |
| - | |
| 787 | + | |
783 | 788 |
| |
784 | 789 |
| |
785 | 790 |
| |
786 | 791 |
| |
787 | 792 |
| |
788 | 793 |
| |
789 |
| - | |
| 794 | + | |
790 | 795 |
| |
791 | 796 |
| |
792 | 797 |
| |
| |||
801 | 806 |
| |
802 | 807 |
| |
803 | 808 |
| |
804 |
| - | |
| 809 | + | |
805 | 810 |
| |
806 | 811 |
| |
807 | 812 |
| |
| |||
814 | 819 |
| |
815 | 820 |
| |
816 | 821 |
| |
817 |
| - | |
| 822 | + | |
818 | 823 |
| |
819 | 824 |
| |
820 | 825 |
| |
821 | 826 |
| |
822 | 827 |
| |
823 | 828 |
| |
824 | 829 |
| |
825 |
| - | |
| 830 | + | |
826 | 831 |
| |
827 | 832 |
| |
828 | 833 |
| |
| |||
857 | 862 |
| |
858 | 863 |
| |
859 | 864 |
| |
860 |
| - | |
| 865 | + | |
861 | 866 |
| |
862 | 867 |
| |
863 | 868 |
| |
864 | 869 |
| |
865 | 870 |
| |
866 | 871 |
| |
867 |
| - | |
| 872 | + | |
868 | 873 |
| |
869 | 874 |
| |
870 | 875 |
| |
| |||
879 | 884 |
| |
880 | 885 |
| |
881 | 886 |
| |
882 |
| - | |
| 887 | + | |
883 | 888 |
| |
884 | 889 |
| |
885 | 890 |
| |
| |||
892 | 897 |
| |
893 | 898 |
| |
894 | 899 |
| |
895 |
| - | |
| 900 | + | |
896 | 901 |
| |
897 | 902 |
| |
898 | 903 |
| |
899 | 904 |
| |
900 | 905 |
| |
901 | 906 |
| |
902 | 907 |
| |
903 |
| - | |
| 908 | + | |
904 | 909 |
| |
905 | 910 |
| |
906 | 911 |
| |
| |||
935 | 940 |
| |
936 | 941 |
| |
937 | 942 |
| |
938 |
| - | |
| 943 | + | |
| 944 | + | |
939 | 945 |
| |
940 | 946 |
| |
941 | 947 |
| |
| |||
952 | 958 |
| |
953 | 959 |
| |
954 | 960 |
| |
955 |
| - | |
| 961 | + | |
956 | 962 |
| |
957 | 963 |
| |
958 | 964 |
| |
| |||
962 | 968 |
| |
963 | 969 |
| |
964 | 970 |
| |
965 |
| - | |
| 971 | + | |
966 | 972 |
| |
967 | 973 |
| |
968 | 974 |
| |
| |||
989 | 995 |
| |
990 | 996 |
| |
991 | 997 |
| |
992 |
| - | |
| 998 | + | |
993 | 999 |
| |
994 | 1000 |
| |
995 | 1001 |
| |
| |||
1011 | 1017 |
| |
1012 | 1018 |
| |
1013 | 1019 |
| |
1014 |
| - | |
| 1020 | + | |
1015 | 1021 |
| |
1016 | 1022 |
| |
1017 | 1023 |
| |
1018 | 1024 |
| |
1019 | 1025 |
| |
1020 |
| - | |
| 1026 | + | |
1021 | 1027 |
| |
1022 | 1028 |
| |
1023 | 1029 |
| |
| |||
1054 | 1060 |
| |
1055 | 1061 |
| |
1056 | 1062 |
| |
| 1063 | + | |
| 1064 | + | |
1057 | 1065 |
| |
1058 | 1066 |
| |
1059 | 1067 |
| |
| |||
1092 | 1100 |
| |
1093 | 1101 |
| |
1094 | 1102 |
| |
1095 |
| - | |
1096 | 1103 |
| |
1097 | 1104 |
| |
1098 | 1105 |
| |
| |||
1182 | 1189 |
| |
1183 | 1190 |
| |
1184 | 1191 |
| |
1185 |
| - | |
| 1192 | + | |
1186 | 1193 |
| |
1187 | 1194 |
| |
1188 | 1195 |
| |
| |||
1223 | 1230 |
| |
1224 | 1231 |
| |
1225 | 1232 |
| |
1226 |
| - | |
| 1233 | + | |
1227 | 1234 |
| |
1228 | 1235 |
| |
1229 | 1236 |
| |
1230 |
| - | |
| 1237 | + | |
1231 | 1238 |
| |
1232 | 1239 |
| |
1233 | 1240 |
| |
| |||
1255 | 1262 |
| |
1256 | 1263 |
| |
1257 | 1264 |
| |
| 1265 | + | |
| 1266 | + | |
1258 | 1267 |
| |
1259 | 1268 |
| |
1260 | 1269 |
| |
| |||
1264 | 1273 |
| |
1265 | 1274 |
| |
1266 | 1275 |
| |
| 1276 | + | |
| 1277 | + | |
1267 | 1278 |
| |
| 1279 | + | |
1268 | 1280 |
| |
1269 | 1281 |
| |
1270 | 1282 |
| |
| |||
1293 | 1305 |
| |
1294 | 1306 |
| |
1295 | 1307 |
| |
1296 |
| - | |
1297 | 1308 |
| |
1298 | 1309 |
| |
1299 | 1310 |
| |
| |||
1389 | 1400 |
| |
1390 | 1401 |
| |
1391 | 1402 |
| |
1392 |
| - | |
| 1403 | + | |
1393 | 1404 |
| |
1394 | 1405 |
| |
1395 | 1406 |
| |
| |||
1415 | 1426 |
| |
1416 | 1427 |
| |
1417 | 1428 |
| |
1418 |
| - | |
| 1429 | + | |
1419 | 1430 |
| |
1420 | 1431 |
| |
1421 | 1432 |
| |
|
Lines changed: 48 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3315 | 3315 |
| |
3316 | 3316 |
| |
3317 | 3317 |
| |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
3318 | 3333 |
| |
3319 | 3334 |
| |
3320 | 3335 |
| |
| |||
3376 | 3391 |
| |
3377 | 3392 |
| |
3378 | 3393 |
| |
| 3394 | + | |
| 3395 | + | |
| 3396 | + | |
| 3397 | + | |
| 3398 | + | |
| 3399 | + | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + | |
| 3422 | + | |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
3379 | 3427 |
| |
3380 | 3428 |
| |
3381 | 3429 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1049 | 1049 |
| |
1050 | 1050 |
| |
1051 | 1051 |
| |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
1052 | 1056 |
| |
1053 | 1057 |
| |
1054 | 1058 |
| |
| |||
1068 | 1072 |
| |
1069 | 1073 |
| |
1070 | 1074 |
| |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
1071 | 1084 |
| |
1072 | 1085 |
| |
1073 | 1086 |
| |
|
0 commit comments
Comments
(0)