Re: vecor/list INSERT or UPDATE

From: Richard Huxton <dev(at)archonet(dot)com>
To: Adam Kornick <akornick(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: vecor/list INSERT or UPDATE
Date: 2001-02-24 10:49:15
Message-ID: 3A9791AB.749D86A5@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adam Kornick wrote:
>
> SQL Gurus,
>
> I want to update a specific set of rows in a column with a list or
> vector. Something like,
>
> UPDATE some_table SET col = [1 2 3 4 5]
> WHERE some_condition_limits_to_five_rows;

Sorry mate - no, not on any system I can think of either. How is the
system supposed to know which row gets which value? What happens when
your condition returns six rows?

You've got two options: wrap five update statements in a transaction (if
you want to know they all succeed/fail as a group) or build some
procedural solution.

- Richard Huxton

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-02-24 10:58:41 Re: Re: postmaster question
Previous Message Bela Lantos 2001-02-24 10:22:18 Newbie question :-)