Re: array variables

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Marcin Krawczyk" <jankes(dot)mk(at)gmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: array variables
Date: 2008-11-13 13:47:05
Message-ID: 162867790811130547h7d19aec3if6d8514244563e40@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2008/11/13 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> writes:
>> 2008/11/13 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>>> Sure you can, if you're using a version new enough to have arrays of
>>> composite types.
>
>> I don't expect so user use devel version ;)
>
> My example was done in 8.3.
>
>> - and result is array of
>> some composite type, not two dimensional array
>

I tested it with error:

postgres=# create table f(a int, b int);
CREATE TABLE
postgres=# insert into f values(10,20);
INSERT 0 1
postgres=# select array(select row(a,b) from f);
ERROR: could not find array type for datatype record
postgres=# select version();
version
----------------------------------------------------------------------------------------------------
PostgreSQL 8.3.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC)
4.1.2 20070925 (Red Hat 4.1.2-33)
(1 row)

I forgot on casting, so I was confused.

Regards
Pavel Stehule

> Well, if the columns are of different types then you'll never be able to
> represent them as a 2-D array, so I thought this was a more general answer.

ok

>
> regards, tom lane
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2008-11-13 13:52:33 Re: array variables
Previous Message Tom Lane 2008-11-13 13:42:21 Re: array variables