pgsql: Convert a few datatype input functions to use "soft" error repor

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Convert a few datatype input functions to use "soft" error repor
Date: 2022-12-09 15:15:04
Message-ID: E1p3f5c-002gaX-1A@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Convert a few datatype input functions to use "soft" error reporting.

This patch converts the input functions for bool, int2, int4, int8,
float4, float8, numeric, and contrib/cube to the new soft-error style.
array_in and record_in are also converted. There's lots more to do,
but this is enough to provide proof-of-concept that the soft-error
API is usable, as well as reference examples for how to convert
input functions.

This patch is mostly by me, but it owes very substantial debt to
earlier work by Nikita Glukhov, Andrew Dunstan, and Amul Sul.
Thanks to Andres Freund for review.

Discussion: https://postgr.es/m/3bbbb0df-7382-bf87-9737-340ba096e034@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ccff2d20ed9622815df2a7deffce8a7b14830965

Modified Files
--------------
contrib/cube/cube.c | 3 +-
contrib/cube/cubedata.h | 7 +-
contrib/cube/cubeparse.y | 76 +++++++++----
contrib/cube/cubescan.l | 8 +-
contrib/cube/expected/cube.out | 25 +++++
contrib/cube/sql/cube.sql | 6 +
src/backend/utils/adt/arrayfuncs.c | 125 ++++++++++++---------
src/backend/utils/adt/arrayutils.c | 31 ++++-
src/backend/utils/adt/bool.c | 5 +-
src/backend/utils/adt/float.c | 96 ++++++----------
src/backend/utils/adt/geo_ops.c | 6 +-
src/backend/utils/adt/int.c | 4 +-
src/backend/utils/adt/int8.c | 2 +-
src/backend/utils/adt/jsonpath_exec.c | 29 ++---
src/backend/utils/adt/numeric.c | 98 ++++++++++------
src/backend/utils/adt/numutils.c | 57 +++++++---
src/backend/utils/adt/rowtypes.c | 49 ++++++--
src/include/utils/array.h | 4 +
src/include/utils/builtins.h | 3 +
src/include/utils/float.h | 6 +-
src/test/regress/expected/arrays.out | 25 +++++
src/test/regress/expected/boolean.out | 19 ++++
.../regress/expected/float4-misrounded-input.out | 25 +++++
src/test/regress/expected/float4.out | 25 +++++
src/test/regress/expected/float8.out | 25 +++++
src/test/regress/expected/int2.out | 25 +++++
src/test/regress/expected/int4.out | 25 +++++
src/test/regress/expected/int8.out | 25 +++++
src/test/regress/expected/numeric.out | 43 +++++++
src/test/regress/expected/rowtypes.out | 31 +++++
src/test/regress/sql/arrays.sql | 6 +
src/test/regress/sql/boolean.sql | 5 +
src/test/regress/sql/float4.sql | 6 +
src/test/regress/sql/float8.sql | 6 +
src/test/regress/sql/int2.sql | 6 +
src/test/regress/sql/int4.sql | 6 +
src/test/regress/sql/int8.sql | 6 +
src/test/regress/sql/numeric.sql | 9 ++
src/test/regress/sql/rowtypes.sql | 7 ++
39 files changed, 727 insertions(+), 238 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-12-09 15:43:51 pgsql: Const-ify a couple of datetime parsing subroutines.
Previous Message Alexander Korotkov 2022-12-09 10:55:56 pgsql: Fix invalid role names introduced in 096dd80f3c