aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/arrays.out
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/expected/arrays.out')
-rw-r--r--src/test/regress/expected/arrays.out101
1 files changed, 95 insertions, 6 deletions
diff --git a/src/test/regress/expected/arrays.out b/src/test/regress/expected/arrays.out
index dcc9e9c1abb..da218f0047c 100644
--- a/src/test/regress/expected/arrays.out
+++ b/src/test/regress/expected/arrays.out
@@ -63,9 +63,9 @@ SELECT a[1:3],
FROM arrtest;
a | b | c | d
------------+-----------------+-----------+---------------
- {1,2,3} | {{{0,0},{1,2}}} | |
- {11,12,23} | | {foobar} | {{elt1,elt2}}
- | | {foo,bar} |
+ {1,2,3} | {{{0,0},{1,2}}} | {} | {}
+ {11,12,23} | {} | {foobar} | {{elt1,elt2}}
+ {} | {} | {foo,bar} | {}
(3 rows)
SELECT array_dims(a) AS a,array_dims(b) AS b,array_dims(c) AS c
@@ -111,9 +111,36 @@ SELECT a[1:3],
FROM arrtest;
a | b | c | d
------------+-----------------------+-------------------+----------
- {16,25,3} | {{{113,142},{1,147}}} | |
- | | {foo,new_word} |
- {16,25,23} | | {foobar,new_word} | {{elt2}}
+ {16,25,3} | {{{113,142},{1,147}}} | {} | {}
+ {} | {} | {foo,new_word} | {}
+ {16,25,23} | {} | {foobar,new_word} | {{elt2}}
+(3 rows)
+
+INSERT INTO arrtest(a) VALUES('{1,null,3}');
+SELECT a FROM arrtest;
+ a
+---------------
+ {16,25,3,4,5}
+ {}
+ {16,25,23}
+ {1,NULL,3}
+(4 rows)
+
+UPDATE arrtest SET a[4] = NULL WHERE a[2] IS NULL;
+SELECT a FROM arrtest WHERE a[2] IS NULL;
+ a
+-----------------
+ [4:4]={NULL}
+ {1,NULL,3,NULL}
+(2 rows)
+
+DELETE FROM arrtest WHERE a[2] IS NULL AND b IS NULL;
+SELECT a,b,c FROM arrtest;
+ a | b | c
+---------------+-----------------------+-------------------
+ {16,25,3,4,5} | {{{113,142},{1,147}}} | {}
+ {16,25,23} | {{3,4},{4,5}} | {foobar,new_word}
+ [4:4]={NULL} | {3,4} | {foo,new_word}
(3 rows)
--
@@ -176,6 +203,19 @@ SELECT ARRAY(select f2 from arrtest_f order by f2) AS "ARRAY";
{1.15,1.15,1.18,1.21,1.24,1.26,1.26,1.3,1.32}
(1 row)
+-- with nulls
+SELECT '{1,null,3}'::int[];
+ int4
+------------
+ {1,NULL,3}
+(1 row)
+
+SELECT ARRAY[1,NULL,3];
+ array
+------------
+ {1,NULL,3}
+(1 row)
+
-- functions
SELECT array_append(array[42], 6) AS "{42,6}";
{42,6}
@@ -355,6 +395,55 @@ select 33 * any ('{1,2,3}');
ERROR: op ANY/ALL (array) requires operator to yield boolean
select 33 * any (44);
ERROR: op ANY/ALL (array) requires array on right side
+-- nulls
+select 33 = any (null::int[]);
+ ?column?
+----------
+
+(1 row)
+
+select null::int = any ('{1,2,3}');
+ ?column?
+----------
+
+(1 row)
+
+select 33 = any ('{1,null,3}');
+ ?column?
+----------
+
+(1 row)
+
+select 33 = any ('{1,null,33}');
+ ?column?
+----------
+ t
+(1 row)
+
+select 33 = all (null::int[]);
+ ?column?
+----------
+
+(1 row)
+
+select null::int = all ('{1,2,3}');
+ ?column?
+----------
+
+(1 row)
+
+select 33 = all ('{1,null,3}');
+ ?column?
+----------
+ f
+(1 row)
+
+select 33 = all ('{33,null,33}');
+ ?column?
+----------
+
+(1 row)
+
-- test indexes on arrays
create temp table arr_tbl (f1 int[] unique);
NOTICE: CREATE TABLE / UNIQUE will create implicit index "arr_tbl_f1_key" for table "arr_tbl"