Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2802F47546C for ; Fri, 9 Aug 2002 02:31:58 -0400 (EDT) Received: from ra.sai.msu.su (ra.sai.msu.su [158.250.29.2]) by postgresql.org (Postfix) with ESMTP id 0BE3D475452 for ; Fri, 9 Aug 2002 02:31:57 -0400 (EDT) Received: from ra (ra [158.250.29.2]) by ra.sai.msu.su (8.9.3/8.9.3) with ESMTP id KAA28993; Fri, 9 Aug 2002 10:30:33 +0300 (GMT) Date: Fri, 9 Aug 2002 10:30:33 +0300 (GMT) From: Oleg Bartunov X-X-Sender: megera@ra.sai.msu.su To: h012@ied.com Cc: pgsql-sql@postgresql.org Subject: Re: expressions operating on arrays In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/160 X-Sequence-Number: 9006 Look at contrib/intarray. You'll get an index access as a bonus Oleg On Fri, 9 Aug 2002 h012@ied.com wrote: > > > Hi, > > I would like to say: > > create table test1 (array1 int4[]); > insert into test1 values ('{123,234,345}'); > insert into test1 values ('{456,567,678}'); > > now what I don't know how to do: > > -- consider contents of array: > select * from test1 where array1 CONTAINS 567; > > -- APPEND '789' to array in second row: > update test1 set array1=(select array1 from test1 where array1 CONTAINS > '567' UNION select '789'); > > > How do I go about expressing and operating on the contents of an array ? > > > Thanks, > > John > > Regards, Oleg _____________________________________________________________ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83