Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AF77D47546C for ; Fri, 9 Aug 2002 16:51:20 -0400 (EDT) Received: from ferda.ied.com (xtreme10-98.aci.on.ca [209.50.81.98]) by postgresql.org (Postfix) with ESMTP id 694BC4750F5 for ; Fri, 9 Aug 2002 16:51:19 -0400 (EDT) Received: from [127.0.0.2] (localhost.localdomain [127.0.0.1]) by ferda.ied.com (8.11.6/8.11.6) with ESMTP id g79Kn9R05252; Fri, 9 Aug 2002 16:49:09 -0400 Date: Fri, 9 Aug 2002 16:49:07 -0400 (EDT) From: h012@ied.com To: Oleg Bartunov Cc: Achilleus Mantzios , 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/165 X-Sequence-Number: 9011 Great ! I'll try patching it. Thanks Oleg & Teodor for doing all this great work ! Long live PostgreSQL ! see yea, John On Fri, 9 Aug 2002, Oleg Bartunov wrote: > Hmm, > > you dont' need to use GiST supporting functions ! > We've posted a patch to current CVS, it has everything you need. > Please, check http://www.sai.msu.su/~megera/postgres/gist/code/7.3/README.intarray > > It looks like that patch should works with 7.2 also. > > Oleg > On Fri, 9 Aug 2002 h012@ied.com wrote: > > > > > thanks for the pointer, I'm now able to use the operators in expressions! > > > > w.r.t. modifying the array contents: I looked through > > /usr/lib/pgsql/contrib/intarray/_int.sql.in , but it didn't make me any > > smarter. Are the "..._union" and "..._picksplit" functions supposed to add > > into and remove elements from the arrays ? How would one update a row, > > then, to add an element into one array and remove an element from another? > > > > create table t(id int4[], txt text[]); > > update t set id=g_int_union(t.id, '{555}') where t.id *= 444; -- ?? > > update t set text=g_int_picksplit(t.text, '{"removeme"}') where t.text *= "removeme"; -- ?? > > > > thx, > > > > John > > > > On Fri, 9 Aug 2002, Oleg Bartunov wrote: > > > > > Look at contrib/intarray. You'll get an index access as a bonus > > > > > > Oleg > > > > On Fri, 9 Aug 2002, Achilleus Mantzios wrote: > > > > > > > > look at /usr/local/src/postgresql-7.2.1/contrib/intarray > > > > > > > > > > > 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 > -- -- Gospel of Jesus is the saving power of God for all who believe -- ## To some, nothing is impossible. ## http://Honza.Vicherek.com/