From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Piotr Findeisen <piotr(dot)findeisen(at)starburstdata(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Is _<typename> a supported way to create a column of array type? |
Date: | 2019-04-26 14:11:19 |
Message-ID: | 31432.1556287879@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Piotr Findeisen <piotr(dot)findeisen(at)starburstdata(dot)com> writes:
> Do you have any plans to support arrays with different number of dimensions
> in the type system?
Mmm ... don't hold your breath. People have speculated about that,
but I haven't seen any actual proposals, and it's hard to see how
we could do it without creating compatibility problems that would
outweigh the value of the feature.
In very late-model Postgres (I think just 11 and up) you can sort
of fake it by using arrays of domains:
regression=# create domain intarray as int4[];
CREATE DOMAIN
regression=# create table foo (f1 intarray[]);
CREATE TABLE
regression=# insert into foo values(array[array[4]]);
ERROR: column "f1" is of type intarray[] but expression is of type integer[]
LINE 1: insert into foo values(array[array[4]]);
^
HINT: You will need to rewrite or cast the expression.
regression=# insert into foo values(array[array[4]::intarray]);
INSERT 0 1
But as this example shows, it's not exactly a transparent solution.
It might be possible to make this specific case work better, but
I think you'd inevitably end up needing lots of explicit casts.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-04-26 14:17:04 | Re: TCP Resets when closing connection opened via SSL |
Previous Message | Laurenz Albe | 2019-04-26 13:29:40 | Re: 9.6.9 Default configuration for a default installation but different with-krb-srvnam |