mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-13 09:57:02 +08:00
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
This commit is contained in:
@ -36,6 +36,12 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('5. 0');
|
||||
INSERT INTO FLOAT4_TBL(f1) VALUES (' - 3.0');
|
||||
INSERT INTO FLOAT4_TBL(f1) VALUES ('123 5');
|
||||
|
||||
-- Also try it with non-error-throwing API
|
||||
SELECT pg_input_is_valid('34.5', 'float4');
|
||||
SELECT pg_input_is_valid('xyz', 'float4');
|
||||
SELECT pg_input_is_valid('1e400', 'float4');
|
||||
SELECT pg_input_error_message('1e400', 'float4');
|
||||
|
||||
-- special inputs
|
||||
SELECT 'NaN'::float4;
|
||||
SELECT 'nan'::float4;
|
||||
|
||||
Reference in New Issue
Block a user