Friday, June 20, 2008

Re: [GENERAL] Need to update all entries of one table based on an earlier backup

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/ ----

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

No comments: