X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.192]) by svr1.postgresql.org (Postfix) with ESMTP id 093BFCCE3B for ; Fri, 18 Jul 2003 22:37:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr4.postgresql.org [64.117.224.192]) (amavisd-new, port 10024) with ESMTP id 75564-01 for ; Fri, 18 Jul 2003 22:37:34 +0000 (GMT) Received: from mail2.n2bb.com (mail2.n2bb.com [66.0.13.202]) by svr1.postgresql.org (Postfix) with ESMTP id 92697CBA17 for ; Fri, 18 Jul 2003 19:37:03 -0300 (ADT) Received: from poopelstilskin.it.n2bb.com ([10.250.10.96] unverified) by mail2.n2bb.com with Microsoft SMTPSVC(5.0.2195.4905); Fri, 18 Jul 2003 18:38:51 -0400 Content-Type: text/plain; charset="iso-8859-1" From: Mike Rylander Reply-To: miker@n2bb.com Organization: N2 Broadband To: Joe Conway Subject: Re: casting to arrays Date: Fri, 18 Jul 2003 18:29:38 -0400 User-Agent: KMail/1.4.3 Cc: pgsql-sql@postgresql.org References: <200307181707.48441.miker@n2bb.com> <3F1867F3.7000109@joeconway.com> In-Reply-To: <3F1867F3.7000109@joeconway.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200307181829.38160.miker@n2bb.com> X-OriginalArrivalTime: 18 Jul 2003 22:38:51.0867 (UTC) FILETIME=[5CBD5AB0:01C34D7D] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/264 X-Sequence-Number: 14378 Thank you! This is great news. Is there a projected release date for 7.4? Also, is there a published roadmap, or should I just get on the developers list? Thanks again. --- Mike Rylander On Friday 18 July 2003 05:34 pm, Joe Conway wrote: > Mike Rylander wrote: > > I have a rather odd table structure that I would like to simplify to be a > > view (for some definition of simplify). The current idea I have is to > > shovel values from multiple rows in one table into an array in the view. > > The tables look something like this: > > > > > Is anything like this possible? I know this may not be good form, but > > unfortunately (or perhaps fortunately, since it means I have a job) there > > are business reasons for this, supporting old apps and such. > > Not possible in current releases, but it will be in 7.4 (about to start > beta). It looks like this: > > create table person (id integer, name varchar); > insert into person values(1,'Bob'); > insert into person values(2,'Sue'); > > create table stuff (person_id integer, stuff_name text); > insert into stuff values(1,'chair'); > insert into stuff values(1,'couch'); > insert into stuff values(1,'lamp'); > insert into stuff values(2,'table'); > insert into stuff values(2,'shirt'); > > create or replace view person_with_stuff as select p.id as id, p.name as > name, ARRAY(select s.stuff_name from stuff s where s.person_id = p.id) > as stuff from person p; > > regression=# select * from person_with_stuff; > id | name | stuff > ----+------+-------------------- > 1 | Bob | {chair,couch,lamp} > 2 | Sue | {table,shirt} > (2 rows) > > HTH, > > Joe