trouble selecting from array - Mailing list pgsql-general

From brian
Subject trouble selecting from array
Date
Msg-id 47EC2FF5.3080303@zijn-digital.com
Whole thread Raw
Responses Re: trouble selecting from array  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Using 8.3

I have a table which has a column (tdr_tags) defined as integer[][]. The
table description shows the column as integer[]. I understand from the
docs that this is normal ("declaring number of dimensions or sizes in
CREATE TABLE is simply documentation").

If I select the column as tdr_tags I get:

{{161377},{32}}
{{206507},{39}}
{{232972,292831},{45,51}}
...

But, wanting just the 2nd inner array, if I try tdr_tags[2] I get NULL.
In fact, if use any array index at all I get back NULL. What I was
aiming to do was to select into a record in pl/pgsql and loop over the
content of the 2nd array.

Also, is there anything special required to load array data using COPY?
Does it require quoting? If so, is there any reason why pg_dump wouldn't
quote each array?

I've been searching online and haven't come across anything at all
related to this. I've never used arrays in Postgres before and this
particular instance will be a one-off.



pgsql-general by date:

Previous
From: Greg Smith
Date:
Subject: Re: Survey: renaming/removing script binaries (createdb, createuser...)
Next
From: Sam Mason
Date:
Subject: Re: dunction issue