X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 0EE159DC94B for ; Sat, 25 Mar 2006 23:11:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83970-02 for ; Sat, 25 Mar 2006 23:11:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from ll.mit.edu (LLMAIL.LL.MIT.EDU [129.55.12.40]) by postgresql.org (Postfix) with ESMTP id F41509DC832 for ; Sat, 25 Mar 2006 23:11:11 -0400 (AST) Received: (from smtp@localhost) by ll.mit.edu (8.12.10/8.8.8) id k2Q3BFel021076 for ; Sat, 25 Mar 2006 22:11:15 -0500 (EST) Received: from UNKNOWN( ), claiming to be "sty.llan" via SMTP by llmail, id smtpdAAAzvai0O; Sat Mar 25 22:11:03 2006 Date: Sat, 25 Mar 2006 22:11:02 -0500 From: george young To: pgsql-sql@postgresql.org Subject: Re: Expressing a result set as an array (and vice versa)? Message-Id: <20060325221102.31de88d7.gry@ll.mit.edu> In-Reply-To: References: Reply-To: gry@ll.mit.edu Organization: MIT Lincoln Laboratory X-Mailer: Sylpheed version 2.0.1 (GTK+ 2.8.0; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.105 required=5 tests=[AWL=0.104, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.105 X-Spam-Level: X-Archive-Number: 200603/409 X-Sequence-Number: 24755 On Thu, 23 Mar 2006 11:44:32 -0800 Don Maier 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)