diff options
| author | Tom Lane | 2008-03-20 21:42:48 +0000 |
|---|---|---|
| committer | Tom Lane | 2008-03-20 21:42:48 +0000 |
| commit | 6b0706ac33ab5da815980c642a9cde9a4cd86b6b (patch) | |
| tree | 511ad4743ad55a095cbacea0713b437af36ba9ce /src/test | |
| parent | 8759b79d0fe8b9937b7cbebfed78480b3e6a94b2 (diff) | |
Arrange for an explicit cast applied to an ARRAY[] constructor to be applied
directly to all the member expressions, instead of the previous implementation
where the ARRAY[] constructor would infer a common element type and then we'd
coerce the finished array after the fact. This has a number of benefits,
one being that we can allow an empty ARRAY[] construct so long as its
element type is specified by such a cast.
Brendan Jurd, minor fixes by me.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/arrays.out | 9 | ||||
| -rw-r--r-- | src/test/regress/sql/arrays.sql | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/test/regress/expected/arrays.out b/src/test/regress/expected/arrays.out index 0f611bf7d78..c82cd3919b9 100644 --- a/src/test/regress/expected/arrays.out +++ b/src/test/regress/expected/arrays.out @@ -785,6 +785,9 @@ select '{}}'::text[]; ERROR: malformed array literal: "{}}" select '{ }}'::text[]; ERROR: malformed array literal: "{ }}" +select array[]; +ERROR: cannot determine type of empty array +HINT: Explicitly cast to the desired type, for example ARRAY[]::integer[]. -- none of the above should be accepted -- all of the following should be accepted select '{}'::text[]; @@ -826,6 +829,12 @@ select '{ {"@ 0","@ 1 hour 42 mins 20 secs"} (1 row) +select array[]::text[]; + array +------- + {} +(1 row) + -- all of the above should be accepted -- tests for array aggregates CREATE TEMP TABLE arraggtest ( f1 INT[], f2 TEXT[][], f3 FLOAT[]); diff --git a/src/test/regress/sql/arrays.sql b/src/test/regress/sql/arrays.sql index a60bf560fa8..192648a39b6 100644 --- a/src/test/regress/sql/arrays.sql +++ b/src/test/regress/sql/arrays.sql @@ -280,6 +280,7 @@ select E'{{1,2},\\{2,3}}'::text[]; select '{{"1 2" x},{3}}'::text[]; select '{}}'::text[]; select '{ }}'::text[]; +select array[]; -- none of the above should be accepted -- all of the following should be accepted @@ -292,6 +293,7 @@ select '{ 0 second, @ 1 hour @ 42 minutes @ 20 seconds }'::interval[]; +select array[]::text[]; -- all of the above should be accepted -- tests for array aggregates |
