pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Array of Arrays of int
3+ messages / 2 participants
[nested] [flat]

* Array of Arrays of int
@ 2005-05-02 03:50  Leo Fink <leo.fink@gmx.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Leo Fink @ 2005-05-02 03:50 UTC (permalink / raw)
  To: pgsql-sql

Why does

select array(select array[1,2]);

give me an error: "could not find array type for data type integer[]"?

Is there a type-cast missing, or is this generally impossible? I was 
expecting something like

{{1,2}}

In my real-world application, the subquery returns more than one pair 
of ints, but I think it all boils down to this simpler example. I am 
using version 7.4 of PostgreSQL.

Thanks a lot,
Leo




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Array of Arrays of int
@ 2005-05-02 04:11  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Leo Fink <leo.fink@gmx.net>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2005-05-02 04:11 UTC (permalink / raw)
  To: Leo Fink <leo.fink@gmx.net>; +Cc: pgsql-sql

Leo Fink <leo.fink@gmx.net> writes:
> Why does
> select array(select array[1,2]);
> give me an error: "could not find array type for data type integer[]"?

We don't do arrays of arrays.  You seem to be hoping for a 2-D array,
which is something fundamentally different (even though some programming
languages consider them the same ;-))

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Array of Arrays of int
@ 2005-05-02 04:26  Leo Fink <leo.fink@gmx.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Leo Fink @ 2005-05-02 04:26 UTC (permalink / raw)
  To: pgsql-sql

Hello Tom.

Am 02.05.2005 um 06:11 schrieb Tom Lane:

> Leo Fink <leo.fink@gmx.net> writes:
>> Why does
>> select array(select array[1,2]);
>> give me an error: "could not find array type for data type integer[]"?
>
> We don't do arrays of arrays.  You seem to be hoping for a 2-D array,
> which is something fundamentally different (even though some 
> programming
> languages consider them the same ;-))

Actually, I don't. In my application I can work around the problem by 
using an array of string representations of these pairs, or by using 
two arrays of ints. I just thought that was less elegant and I was 
missing something obvious.

Thanks for your quick response.

Best,
Leo




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2005-05-02 04:26 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-02 03:50 Array of Arrays of int Leo Fink <leo.fink@gmx.net>
2005-05-02 04:11 ` Tom Lane <tgl@sss.pgh.pa.us>
2005-05-02 04:26   ` Leo Fink <leo.fink@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox