Re: [SQL] INSERT and UPDATE with non-atomic values

From: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>
To: pgsql-sql(at)hub(dot)org
Subject: Re: [SQL] INSERT and UPDATE with non-atomic values
Date: 1999-05-02 09:02:08
Message-ID: 372C1490.5ED90AE1@bigfoot.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


create table foo (bar int4[]);
insert into foo values('{1,2,3}');
update foo set bar[2] = 4;
update foo set bar = '{5,4,4,4,5}';

I don't think you can extend a dynamic array without setting the entire
array (like the last example), which is probably a bit unfortunate.

If you're using arrays you may want to check out the stuff in
pgsql/contrib/array as well.

Martin Jackson wrote:
>
> Hello all,
>
> I am using PostgreSQL in large part because it supports arrays as
> attributes. I have spent the better part of the last couple days trying
> to figure out how one would UPDATE dynamically sized arrays. Also, is
> there an easy way of getting the size of a dynamic array?
>
> Thanks in advance.
>
> --
> Martin Jackson: mjackson(at)deskmedia(dot)com
> ++++++++++++++++++++++++++++++++++++++
> Computer Info. Science Major
> Minnesota State University, Mankato
> ++++++++++++++++++++++++++++++++++++++

--
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris(dot)bitmead(at)bigfoot(dot)com

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message M Simms 1999-05-02 12:24:16 Re: [SQL] Update problem I cannot work out
Previous Message Michael J Davis 1999-05-02 03:13:16 RE: [SQL] Update problem I cannot work out