Commit c4939f1
committed
Clean up dubious error handling in wellformed_xml().
This ancient bit of code was summarily trapping any ereport longjmp
whatsoever and assuming that it must represent an invalid-XML report.
It's not really appropriate to handle OOM-like situations that way:
maybe the input is valid or maybe not, but we couldn't find out.
And it'd be a seriously bad idea to ignore, say, a query cancel
error that way. (Perhaps that can't happen because there is no
CHECK_FOR_INTERRUPTS anywhere within xml_parse, but even if that's
true today it's obviously a very fragile assumption.)
But in the wake of the previous commit, we can drop the PG_TRY
here altogether, and use the soft error mechanism to catch only
the kinds of errors that are legitimate to treat as invalid-XML.
(This is our first use of the soft error mechanism for something
not directly related to a datatype input function. It won't be
the last.)
xml_is_document can be converted in the same way. That one is
not actively broken, because it was checking specifically for
ERRCODE_INVALID_XML_DOCUMENT rather than trapping everything;
but the code is still shorter and probably faster this way.
Discussion: https://postgr.es/m/3564577.1671142683@sss.pgh.pa.us1 parent 37bef84 commit c4939f1
1 file changed
+17
-47
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
894 | 895 | | |
895 | 896 | | |
896 | 897 | | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
| 898 | + | |
| 899 | + | |
927 | 900 | | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
928 | 906 | | |
929 | 907 | | |
930 | 908 | | |
931 | | - | |
| 909 | + | |
932 | 910 | | |
933 | 911 | | |
934 | 912 | | |
| |||
4320 | 4298 | | |
4321 | 4299 | | |
4322 | 4300 | | |
4323 | | - | |
4324 | | - | |
4325 | | - | |
4326 | | - | |
4327 | | - | |
4328 | | - | |
4329 | | - | |
4330 | | - | |
4331 | | - | |
4332 | | - | |
4333 | | - | |
4334 | | - | |
4335 | | - | |
4336 | | - | |
4337 | | - | |
| 4301 | + | |
| 4302 | + | |
4338 | 4303 | | |
| 4304 | + | |
| 4305 | + | |
| 4306 | + | |
| 4307 | + | |
| 4308 | + | |
4339 | 4309 | | |
4340 | 4310 | | |
4341 | 4311 | | |
4342 | | - | |
| 4312 | + | |
4343 | 4313 | | |
4344 | 4314 | | |
4345 | 4315 | | |
| |||
0 commit comments