Re: Expressing a result set as an array (and vice versa)?

From: george young <gry(at)ll(dot)mit(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Expressing a result set as an array (and vice versa)?
Date: 2006-03-26 03:11:02
Message-ID: 20060325221102.31de88d7.gry@ll.mit.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 23 Mar 2006 11:44:32 -0800
Don Maier <dMaier(at)genome(dot)stanford(dot)edu> threw this fish to the penguins:

> Is it possible to construct an array from an appropriate select
> expression that generates a result set of unknown cardinality?
> To focus on the simple case: Is it possible to construct a one-
> dimensional array from a select of a single column in a table with an
> unknown number of rows?

select array(select some_int_field from my_table where something);

produces an array of integers. No user defined function is required.

> Conversely, is it possible to construct a (single column) result set
> from a select expression on a one-dimensional array with an unknown
> number of elements?
Not so easy without a custom function.

> Thanks for any hints!
>
> Regards,
> Don Maier
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>

--
"Are the gods not just?" "Oh no, child.
What would become of us if they were?" (CSL)

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Volkan YAZICI 2006-03-26 05:56:25 Re: Expressing a result set as an array (and vice versa)?
Previous Message Daniel CAUNE 2006-03-25 12:38:29 Re: Index on nullable column