Re: CREATE TYPE with array - Mailing list pgsql-novice

From Tom Lane
Subject Re: CREATE TYPE with array
Date
Msg-id 13054.1058971953@sss.pgh.pa.us
Whole thread Raw
In response to Re: CREATE TYPE with array  (Wolfgang Drotschmann <drotschm@fgan.de>)
List pgsql-novice
Wolfgang Drotschmann <drotschm@fgan.de> writes:
> create table xs ( a char(5), l int4array[]);
> CREATE TABLE
> insert into xs values('abcde', '{1,2,3,4}');
> ERROR:  array_in: Need to specify dimension

int4array is already an array; I don't think you want to make an array
of arrays.  It might work if you wrote the value as something like

    '{''{1,2,3}'',''{4,5,6}''}'

(not sure that I have the quoting quite right here) but that sure seems
like the hard way compared to using a multidimensional array.

In short, declare l as int4array not int4array[].

            regards, tom lane

pgsql-novice by date:

Previous
From: Joepie Platteau
Date:
Subject: PSQL locks records in the table...
Next
From: Tom Lane
Date:
Subject: Re: Struggling with set-returning functions, seeking advice