Re: Is _<typename> a supported way to create a column of array type?

From: Piotr Findeisen <piotr(dot)findeisen(at)starburstdata(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 10:50:01
Message-ID: CAMrFzbvjWgjUuvRCz9b1ukQrwLU3P8SG_D4vZcHF-rOyWxKO1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Tom,

I think I understand now.

Postgres type system does not distinguish between array types with different
number of dimensions. int[], int[][] and int[][][][][][] are all equivalent
to the type system.

Number of dimensions is part of the value though and execution takes care
of it.
If I subscript an array with wrong "number of brackets" (as in
`select (array[1,2,3])[1][1][1]`) I get NULL.

Presto type system however distinguishes array(integer),
array(array(integer))...
(using Presto therms). And execution is (expectedly) not as flexible.

We can inspect number of brackets that were written in the table creation
command but that's inferring (and enforcing) strong typing for something
that is
not strongly typed. Thus, we can fail at execution.

Do you have any plans to support arrays with different number of dimensions
in the type system?

Best,
Piotr

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2019-04-26 12:15:51 Re: Is _<typename> a supported way to create a column of array type?
Previous Message Rainer Pruy 2019-04-26 08:19:48 Re: TCP Resets when closing connection opened via SSL