From: | h012(at)ied(dot)com |
---|---|
To: | Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: expressions operating on arrays |
Date: | 2002-08-09 07:12:22 |
Message-ID: | no.Yo.N.nN.0208090252110.2280-100000@business.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)ied(dot)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
--
-- Gospel of Jesus is the saving power of God for all who believe --
## To some, nothing is impossible. ##
http://Honza.Vicherek.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2002-08-09 07:30:33 | Re: expressions operating on arrays |
Previous Message | Achilleus Mantzios | 2002-08-09 06:17:06 | Re: expressions operating on arrays |