Re: Need to update all entries of one table based on an earlier backup - Mailing list pgsql-general

From Thomas Pundt
Subject Re: Need to update all entries of one table based on an earlier backup
Date
Msg-id 200806201240.05432.mlists@rp-online.de
Whole thread Raw
In response to Need to update all entries of one table based on an earlier backup  ("Gregory Williamson" <Gregory.Williamson@digitalglobe.com>)
List pgsql-general
On Freitag, 20. Juni 2008, Gregory Williamson wrote:
| For reasons best left unmentioned, I need to update entries in a table from
| a backup; I need to do all entries.
|
| For reasons eluding my sleep deprived eyes this fails in every variation I
| can think of:
|
| update foo set foo.foo_name2=foo_old.foo_name2 where foo.foo_id =
| foo_old.foo_id; ERROR:  missing FROM-clause entry for table "foo_old"

Does

update foo
   set foo.foo_name2 = foo_old.foo_name2
  from foo_old
 where foo.foo_id = foo_old.foo_id;

work for you?

| Could someone please hit me with a clue-stick ? This is crucial and yet I
| am stumbling over something. Since I am not updating foo_old I am baffled
| as to what this messsage really means. I've tried "where foo_old.foo_id =
| foo.foo_id ... same message.

Ciao,
Thomas

--
Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/ ----

pgsql-general by date:

Previous
From: "Gregory Williamson"
Date:
Subject: Re: Need to update all entries of one table based on an earlier backup
Next
From: "Willy-Bas Loos"
Date:
Subject: test aggregate functions without a dummy table