Re: creating array of integer[] out of query - how?

From: "Massa, Harald Armin" <chef(at)ghum(dot)de>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: creating array of integer[] out of query - how?
Date: 2009-09-02 09:50:38
Message-ID: e3e180dc0909020250l475e380m834d1c5c083e4096@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sam,

No, as depesz says it's not doing that. Depending on what you want out
> you can get most of the way by having an array of ROWs that contain an
> array of integers. You just need to change:
>
> the sad thing is:

select array(
> select x from (
> select array[2,3] as a
> union
> select array[3,4] as a ) x);
>
> ERROR: could not find array type for datatype record

... I remember being there before :( arrays of rows are also not available.

To all: is there a deeper reason why there is no array type for datatype
record available?

[1] http://www.postgresql.org/docs/current/static/sql-createtype.html
>
> Thanks for the hint with CREATE TYPE, especially the lines

"""
Whenever a user-defined type is created, PostgreSQL automatically creates an
associated array type,
"""
fills me with joy. ;)

Thanks to depesz & you,

Harald

--
GHUM Harald Massa
persuadere et programmare
Harald Armin Massa
Spielberger Straße 49
70435 Stuttgart
0173/9409607
no fx, no carrier pigeon
-
LASIK good, steroids bad?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-09-02 10:03:33 Re: creating array of integer[] out of query - how?
Previous Message Markus Wanner 2009-09-02 09:41:12 PostgreSQL Conference 2009 Japan