1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Convert contrib/ltree's input functions to report errors softly

Reviewed by Tom Lane and Amul Sul

Discussion: https://postgr.es/m/49e598c2-cfe8-0928-b6fb-d0cc51aab626@dunslane.net
This commit is contained in:
Andrew Dunstan
2022-12-28 09:58:04 -05:00
parent 3b76622e04
commit 7a05425d96
4 changed files with 137 additions and 50 deletions

View File

@ -382,3 +382,18 @@ SELECT count(*) FROM _ltreetest WHERE t ~ '23.*{1}.1' ;
SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.1' ;
SELECT count(*) FROM _ltreetest WHERE t ~ '23.*.2' ;
SELECT count(*) FROM _ltreetest WHERE t ? '{23.*.1,23.*.2}' ;
-- test non-error-throwing input
SELECT str as "value", typ as "type",
pg_input_is_valid(str,typ) as ok,
pg_input_error_message(str,typ) as errmsg
FROM (VALUES ('.2.3', 'ltree'),
('1.2.', 'ltree'),
('1.2.3','ltree'),
('@.2.3','lquery'),
(' 2.3', 'lquery'),
('1.2.3','lquery'),
('$tree & aWdf@*','ltxtquery'),
('!tree & aWdf@*','ltxtquery'))
AS a(str,typ);