pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oleg Bartunov <oleg@sai.msu.su>
To: h012@ied.com
Cc: Achilleus Mantzios <achill@matrix.gatewaynet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: expressions operating on arrays
Date: Fri, 9 Aug 2002 17:57:08 +0300 (GMT)
Message-ID: <Pine.GSO.4.44.0208091755380.3786-100000@ra.sai.msu.su> (raw)
In-Reply-To: <no.Yo.N.nN.0208090252110.2280-100000@business.com>

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




view thread (7+ messages)  latest in thread

Message-ID: <Pine.GSO.4.44.0208091755380.3786-100000@ra.sai.msu.su>
Permalink:  ../Pine.GSO.4.44.0208091755380.3786-100000@ra.sai.msu.su/
Also on:    postgresql.org/message-id/Pine.GSO.4.44.0208091755380.3786-100000@ra.sai.msu.su

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: oleg@sai.msu.su, h012@ied.com, achill@matrix.gatewaynet.com
  Subject: Re: expressions operating on arrays
  In-Reply-To: <Pine.GSO.4.44.0208091755380.3786-100000@ra.sai.msu.su>
  References: <no.Yo.N.nN.0208090252110.2280-100000@business.com> <Pine.GSO.4.44.0208091755380.3786-100000@ra.sai.msu.su>

* 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