The following bug has been logged online:
Bug reference: 2212
Logged by: Walter Roeland
Email address: wroeland@marcatel.net
PostgreSQL version: 8.1.2
Operating system: Windows XP professional
Description: Extracting array from 2 dim array may be incorrect
Details:
Select (Array[5,8,1])[2] as E;
returns 8 (ok, dimension is lowerd from 1 to 0).
Select (Array[Array[3,2,2],Array[7,4,4],Array[5,8,1]])[3:3] as V;
returns {{5,8,1}} (I suppose this is ok, same dimension).
But:
Select (Array[Array[3,2,2],Array[7,4,4],Array[5,8,1]])[3] as V;
Returns Null, as far I understand it should return {5,8,1}, i.e. lowering
dimension from 2 to 1.
Note: the documentation is not specific about when extracting an element
lowers the dimension (eg. using [2]) and when not (e.g. using [2:2]).