Re: Updating Arrays

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Bob Pawley <rjpawley(at)shaw(dot)ca>, Postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Updating Arrays
Date: 2011-08-23 02:54:58
Message-ID: 14610.1314068098@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
> On Mon, Aug 22, 2011 at 8:49 PM, Bob Pawley <rjpawley(at)shaw(dot)ca> wrote:
>> I'm not sure what you mean.
>> _base -- not base -- is the column name.

> oops. anyways, the important point is on the right side of the equals sign.
> Update library.compare set _base[2] = 2 where process_id = 2;

Right. If you assign to _base[2], you must provide a single numeric
value. Not a one-element array.

OTOH, if you were to assign to _base[2:2] (an array slice containing
just that one element), you must provide a one-element numeric array on
the righthand side. So if there's some reason why you need to write
'{2}' and not just '2', you can accommodate that by adjusting what
you're assigning to.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jayadevan M 2011-08-23 03:37:20 Re: Getting value of bind variables
Previous Message David Johnston 2011-08-23 02:12:20 Re: Updating Arrays