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:
@@ -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
|
||||
--
|
||||
|
Reference in New Issue
Block a user