Re: vecor/list INSERT or UPDATE - Mailing list pgsql-general

From Richard Huxton
Subject Re: vecor/list INSERT or UPDATE
Date
Msg-id 3A9791AB.749D86A5@archonet.com
Whole thread Raw
In response to vecor/list INSERT or UPDATE  (Adam Kornick <akornick@yahoo.com>)
List 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

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: ...lame use of casting, looking for workaround...
Next
From: Doug McNaught
Date:
Subject: Re: PostgreSQL packages for Debian potato