Convert range_in and multirange_in to report errors softly.
Tom Lane <tgl@sss.pgh.pa.us>
Convert range_in and multirange_in to report errors softly. This is mostly straightforward, except that if the range type has a canonical function, that might throw an error during range input. (Such errors probably only occur for edge cases: in the in-core canonical functions, it happens only if a bound has the maximum valid value for the underlying type.) Hence, this patch extends the soft-error regime to allow canonical functions to return errors softly as well. Extensions implementing range canonical functions will need modification anyway because of the API change for range_serialize(); while at it, they might want to do something similar to what's been done here in the in-core canonical functions. Discussion: https://postgr.es/m/3284599.1671075185@sss.pgh.pa.us
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/multirangetypes.c | modified | +18 −11 |
| src/backend/utils/adt/multirangetypes_selfuncs.c | modified | +2 −1 |
| src/backend/utils/adt/rangetypes.c | modified | +142 −48 |
| src/backend/utils/adt/rangetypes_gist.c | modified | +1 −1 |
| src/backend/utils/adt/rangetypes_selfuncs.c | modified | +1 −1 |
| src/backend/utils/adt/rangetypes_spgist.c | modified | +1 −1 |
| src/backend/utils/adt/rangetypes_typanalyze.c | modified | +2 −1 |
| src/include/utils/rangetypes.h | modified | +4 −2 |
| src/test/regress/expected/multirangetypes.out | modified | +31 −0 |
| src/test/regress/expected/rangetypes.out | modified | +67 −0 |
| src/test/regress/sql/multirangetypes.sql | modified | +7 −0 |
| src/test/regress/sql/rangetypes.sql | modified | +13 −0 |
Discussion
- Error-safe user functions 175 messages · 2022-10-03 → 2023-01-03