Re: What's the fastest way to do this?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: What's the fastest way to do this?
Дата
Msg-id 20011112125042.Y75520-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re: What's the fastest way to do this?  (Orion <o2@trustcommerce.com>)
Список pgsql-general
On Mon, 12 Nov 2001, Orion wrote:

> UPDATE test
>         SET description = x.description
>         FROM test AS rt, test_tmp AS x
>         WHERE rt.code = x.code;

> So (A) is this a bug or (B) do I totally misunderstand that UPDATE statement
> above.  I appears that it should update each row in table 'test' with the
> description corresponding to the code in test_tmp.  If this is not the
> proper way to do this, what is?

The above update isn't doing what you're expecting.  You're updating
test, you don't need the test as rt in the from unless you are attempting
a self-join.

Try:
update test
 set description = x.description
 from test_tmp as x
 where test.code=x.code;


В списке pgsql-general по дате отправления:

Предыдущее
От: Manuel Duran Aguete
Дата:
Сообщение: Strange Performance Problem.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: What's the fastest way to do this?