[
https://issues.apache.org/jira/browse/CALCITE-3504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16974902#comment-16974902
]
Pressenna commented on CALCITE-3504:
------------------------------------
here's a quick check in postgresql:
{code:sql}
postgres=# create table arr (id int, ia int[]);
CREATE TABLE
postgres=# insert into arr values(1, [1]);
ERROR: syntax error at or near "["
LINE 1: insert into arr values(1, [1]);
^
postgres=# insert into arr values(1, array[1]);
INSERT 0 1
postgres=# insert into arr values(0, array[]);
ERROR: cannot determine type of empty array
LINE 1: insert into arr values(0, array[]);
^
HINT: Explicitly cast to the desired type, for example ARRAY[]::integer[].
postgres=# insert into arr values(0, cast(array[] as int[]));
INSERT 0 1
postgres=# update arr set ia=array[] where id = 1;
ERROR: cannot determine type of empty array
LINE 1: update arr set ia=array[] where id = 1;
^
HINT: Explicitly cast to the desired type, for example ARRAY[]::integer[].
postgres=# update arr set ia=cast(array[] as int[]) where id = 1;
UPDATE 1
postgres=# update arr set ia=cast(array[] as bool[]) where id = 1;
ERROR: column "ia" is of type integer[] but expression is of type boolean[]
LINE 1: update arr set ia=cast(array[] as bool[]) where id = 1;
^
HINT: You will need to rewrite or cast the expression.
{code}
> allow empty ARRAY[] literals
> ----------------------------
>
> Key: CALCITE-3504
> URL: https://issues.apache.org/jira/browse/CALCITE-3504
> Project: Calcite
> Issue Type: Wish
> Affects Versions: 1.21.0
> Reporter: Pressenna
> Priority: Major
>
> Currently an ARRAY expression requires at least one element.
> Please allow empty ARRAY expressions.
> {code:sql}
> SELECT ARRAY[] FROM foo;
> -- or more concise for updates:
> UPDATE food set array_column = ARRAY[];
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)