Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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);
postgres=# insert into f values(10,20);
postgres=# select array(select row(a,b) from f);
ERROR:  could not find array type for datatype record
postgres=# select 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.

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.


>                        regards, tom lane

In response to


pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group