1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

Further tightening of the array literal parser. Prevent junk

from being accepted after the outer right brace. Per report from
Markus Bertheau.

Also add regression test cases for this change, and for previous
recent array literal parser changes.
This commit is contained in:
Joe Conway
2004-08-28 19:31:29 +00:00
parent f444dafab0
commit f900af7961
3 changed files with 107 additions and 6 deletions

View File

@ -192,3 +192,28 @@ select 'foo' not like any (array['%a', '%b']); -- t
select 'foo' not like all (array['%a', '%o']); -- f
select 'foo' ilike any (array['%A', '%O']); -- t
select 'foo' ilike all (array['F%', '%O']); -- t
--
-- General array parser tests
--
-- none of the following should be accepted
select '{{1,{2}},{2,3}}'::text[];
select '{{},{}}'::text[];
select '{{1,2},\\{2,3}}'::text[];
select '{{"1 2" x},{3}}'::text[];
select '{}}'::text[];
select '{ }}'::text[];
-- none of the above should be accepted
-- all of the following should be accepted
select '{}'::text[];
select '{{{1,2,3,4},{2,3,4,5}},{{3,4,5,6},{4,5,6,7}}}'::text[];
select '{0 second ,0 second}'::interval[];
select '{ { "," } , { 3 } }'::text[];
select ' { { " 0 second " , 0 second } }'::text[];
select '{
0 second,
@ 1 hour @ 42 minutes @ 20 seconds
}'::interval[];
-- all of the above should be accepted