Re: [SQL] INSERT and UPDATE with non-atomic values - Mailing list pgsql-sql

From Chris Bitmead
Subject Re: [SQL] INSERT and UPDATE with non-atomic values
Date
Msg-id 372C1490.5ED90AE1@bigfoot.com
Whole thread Raw
In response to INSERT and UPDATE with non-atomic values  (Martin Jackson <mjackson@deskmedia.com>)
List 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@deskmedia.com
> ++++++++++++++++++++++++++++++++++++++
> Computer Info. Science Major
> Minnesota State University, Mankato
> ++++++++++++++++++++++++++++++++++++++

-- 
Chris Bitmead
http://www.bigfoot.com/~chris.bitmead
mailto:chris.bitmead@bigfoot.com


pgsql-sql by date:

Previous
From: Michael J Davis
Date:
Subject: RE: [SQL] Update problem I cannot work out
Next
From: M Simms
Date:
Subject: Re: [SQL] Update problem I cannot work out