1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-09 13:09:39 +03:00

Convert enum_in() to report errors softly.

I missed this in my initial survey, probably because I examined
the contents of pg_type in the postgres database, which lacks
any enumerated types.

Discussion: https://postgr.es/m/CAAJ_b97KeDWUdpTKGOaFYPv0OicjOu6EW+QYWj-Ywrgj_aEy1g@mail.gmail.com
This commit is contained in:
Tom Lane
2022-12-25 14:32:02 -05:00
parent 361ec4368b
commit 442e25d248
3 changed files with 40 additions and 3 deletions

View File

@@ -15,6 +15,12 @@ SELECT COUNT(*) FROM pg_enum WHERE enumtypid = 'rainbow'::regtype;
SELECT 'red'::rainbow;
SELECT 'mauve'::rainbow;
-- Also try it with non-error-throwing API
SELECT pg_input_is_valid('red', 'rainbow');
SELECT pg_input_is_valid('mauve', 'rainbow');
SELECT pg_input_error_message('mauve', 'rainbow');
SELECT pg_input_error_message(repeat('too_long', 32), 'rainbow');
--
-- adding new values
--