pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: george young <gry@ll.mit.edu>
To: pgsql-sql@postgresql.org
Subject: Re: Expressing a result set as an array (and vice versa)?
Date: Sat, 25 Mar 2006 22:11:02 -0500
Message-ID: <20060325221102.31de88d7.gry@ll.mit.edu> (raw)
In-Reply-To: <F3E0C44C-6118-41C6-AC71-2B19258F4F07@genome.stanford.edu>
References: <F3E0C44C-6118-41C6-AC71-2B19258F4F07@genome.stanford.edu>

On Thu, 23 Mar 2006 11:44:32 -0800
Don Maier <dMaier@genome.stanford.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@postgresql.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)



view thread (6+ messages)  latest in thread

Message-ID: <20060325221102.31de88d7.gry@ll.mit.edu>
Permalink:  ../20060325221102.31de88d7.gry@ll.mit.edu/
Also on:    postgresql.org/message-id/20060325221102.31de88d7.gry@ll.mit.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gry@ll.mit.edu
  Subject: Re: Expressing a result set as an array (and vice versa)?
  In-Reply-To: <20060325221102.31de88d7.gry@ll.mit.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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