Re: BUG #2913: Subscript on multidimensional array yields no value

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Roman Nowak <roman_nowak(at)poczta(dot)onet(dot)pl>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2913: Subscript on multidimensional array yields no value
Date: 2007-01-31 03:44:17
Message-ID: 14949.1170215057@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-docs pgsql-patches

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Tom Lane wrote:
>> This is not a bug, this is a definitional disagreement, and your TODO
>> entry presupposes an answer that I don't particularly agree with.

> Well, our documentation suggests thaat [1] is the same as [1:1]:
> http://www.postgresql.org/docs/8.2/static/arrays.html#AEN5791

It says absolutely no such thing. A subscript expression involving m:n
produces a "slice", hence an array of different dimensionality from the
original, whereas a subscript expression not involving any colon
produces a single element --- that is, not an array at all.

You could make a fair case that the (ARRAY[[1,2],[3,4]])[1] example
should throw an error instead of returning null. But to claim it is
the same as a slice expression is a typing violation.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2007-01-31 04:07:11 Re: [BUGS] BUG #2913: Subscript on multidimensional array yields no value
Previous Message Bruce Momjian 2007-01-31 02:00:28 Re: BUG #2913: Subscript on multidimensional array yields no value

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2007-01-31 04:07:11 Re: [BUGS] BUG #2913: Subscript on multidimensional array yields no value
Previous Message Bruce Momjian 2007-01-31 02:00:28 Re: BUG #2913: Subscript on multidimensional array yields no value

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-01-31 04:07:11 Re: [BUGS] BUG #2913: Subscript on multidimensional array yields no value
Previous Message Bruce Momjian 2007-01-31 02:00:28 Re: BUG #2913: Subscript on multidimensional array yields no value