Updating Arrays

From: "Bob Pawley" <rjpawley(at)shaw(dot)ca>
To: "Postgresql" <pgsql-general(at)postgresql(dot)org>
Subject: Updating Arrays
Date: 2011-08-22 17:54:54
Message-ID: 707FB95957B14DB880D259EE0011F29F@BobPC
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I exploring the use of arrays.

So far I have created a table and inserted a row and updated the row with an array
Update library.compare
set _base =
'{2, 0.764149497122068, 4.8886}'
where process_id = 2;
– successfully.

However when I attempt to update a specific element of the array

Update library.compare
set _base[2] =
'{2}'
where process_id = 2;
I get an error “invalid input syntax for type numeric: "{2}"”

Bob

Create table library.compare (
id serial UNIQUE,
process_id int4,
device_id int4,
_base decimal[]
);
Insert into library.compare (process_id)
values ('2');

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2011-08-22 18:03:09 Re: Updating Arrays
Previous Message John R Pierce 2011-08-22 17:54:23 Re: securing the sql server ?