Updating 457 rows in a table - Mailing list pgsql-general

From Rich Shepard
Subject Updating 457 rows in a table
Date
Msg-id 164b3681-7a42-1e5-6a7b-80196ed33ded@appl-ecosys.com
Whole thread Raw
Responses Re: Updating 457 rows in a table
Re: Updating 457 rows in a table
Re: Updating 457 rows in a table
List pgsql-general
Searching the postgresql doc for UPDATE the examples I find show updating
one or a few rows in a table. I have 457 rows to update in a table.

I could write a .sql script with 457 lines, each updating one row of the
table. My web search for `sql: update table rows from a file of column
values' finds pages for single row updates and updating a table from another
table, but neither is what I want.

I want to change a column value in a table based on the value of a different
column in that same table.

Specifically, in the 'people' table I want to change the column 'active'
from false to true for 457 specific person_id row numbers.

Is there a way to do this without manually writing 457 'update ...' rows in
a .sql file?

TIA,

Rich




pgsql-general by date:

Previous
From: PetSerAl
Date:
Subject: pg_dump and not MVCC-safe commands
Next
From: Christophe Pettus
Date:
Subject: Re: Updating 457 rows in a table