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

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

On Wed, Sep 2, 2009 at 9:47 AM, Massa, Harald Armin<chef(at)ghum(dot)de> wrote:
> Sam,
>
>> To all: is there a deeper reason why there is no array type for datatype
>> record available?
>>
>> Not enough demand :)
>
> seams reasonable :)
>
>>
>> Try:
>>
>>  CREATE TYPE intarr AS (arr int[]);
>>  SELECT array(
>>    SELECT x::intarr FROM (
>>      SELECT array[2,3]
>>      UNION ALL
>>      SELECT array[3,4]) x(a));
>>
>> and it should do the right thing in 8.3.
>
> not exactly :)
> ibox=# CREATE TYPE intarr AS (arr int[]);
> CREATE TYPE
> ibox=#  SELECT array(
>       SELECT x::intarr FROM (
>       SELECT array[2,3]
>       UNION ALL
>       SELECT array[3,4]) x(a));
>            ?column?
> -------------------------------
>  {"(\"{2,3}\")","(\"{3,4}\")"}
> (1 Zeile)
>
> .... the result seems to be an array with two strings containing escaped
> string-represenations of arrays :)

nope...it's an array of composite types, each type with one field, and
array of two ints. this is waht you wanted? what are you trying to do
exactly?

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2009-09-02 14:39:29 Re: PL/SQL & unset custom variable
Previous Message Wellmann, Harald 2009-09-02 14:24:47 Subselect problem