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 13:47:53
Message-ID: e3e180dc0909020647l63c59cfcsb0cbf9fc0434111a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 :)

I guess I will try to solve my challenge without arrays of arrays or records
:)

Thanks for trying,

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 14:17:24 Re: creating array of integer[] out of query - how?
Previous Message Gordon Ross 2009-09-02 13:28:52 PL/SQL & unset custom variable