Possible mistake in new array syntax

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Possible mistake in new array syntax
Date: 2003-06-27 19:52:27
Message-ID: Pine.LNX.4.44.0306271802160.5890-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

The documentation says the following is allowed:

INSERT INTO sal_emp
VALUES ('Bill',
ARRAY[10000, 10000, 10000, 10000],
ARRAY[['meeting', 'lunch'], ['','']]);

I cannot find justification for this in the standard. According to my
reading, it should be

INSERT INTO sal_emp
VALUES ('Bill',
ARRAY[10000, 10000, 10000, 10000],
ARRAY[ARRAY['meeting', 'lunch'], ARRAY['','']]);

--
Peter Eisentraut peter_e(at)gmx(dot)net


From: Joe Conway <mail(at)joeconway(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Possible mistake in new array syntax
Date: 2003-06-27 22:09:35
Message-ID: 3EFCC09F.5070706@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut wrote:
> The documentation says the following is allowed:
>
> INSERT INTO sal_emp
> VALUES ('Bill',
> ARRAY[10000, 10000, 10000, 10000],
> ARRAY[['meeting', 'lunch'], ['','']]);
>
> I cannot find justification for this in the standard. According to my
> reading, it should be
>
> INSERT INTO sal_emp
> VALUES ('Bill',
> ARRAY[10000, 10000, 10000, 10000],
> ARRAY[ARRAY['meeting', 'lunch'], ARRAY['','']]);
>

This parallels my question on the last post. I don't see any
justification for multidimensional arrays at all, so my thought was that
we have a free hand to define it. It seemed much nicer to write:
ARRAY[[[[[[1]]]]]]
for a 6 dimensional array, than this:
ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[1]]]]]]
and actually, both do work:

regression=# select ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[ARRAY[1]]]]]];
array
---------------
{{{{{{1}}}}}}
(1 row)

regression=# select ARRAY[[[[[[1]]]]]];
array
---------------
{{{{{{1}}}}}}
(1 row)

Joe


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Possible mistake in new array syntax
Date: 2003-06-28 00:18:35
Message-ID: 14345.1056759515@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> The documentation says the following is allowed:
> INSERT INTO sal_emp
> VALUES ('Bill',
> ARRAY[10000, 10000, 10000, 10000],
> ARRAY[['meeting', 'lunch'], ['','']]);

> I cannot find justification for this in the standard. According to my
> reading, it should be

> INSERT INTO sal_emp
> VALUES ('Bill',
> ARRAY[10000, 10000, 10000, 10000],
> ARRAY[ARRAY['meeting', 'lunch'], ARRAY['','']]);

If it's an extension, it seems like a pretty reasonable one ...

regards, tom lane