Re: Update field to a column from another table

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Update field to a column from another table
Дата
Msg-id 57193E9B.5060808@aklaver.com
обсуждение исходный текст
Ответ на Re: Update field to a column from another table  ("drum.lucas@gmail.com" <drum.lucas@gmail.com>)
Ответы Re: Update field to a column from another table  ("drum.lucas@gmail.com" <drum.lucas@gmail.com>)
Список pgsql-general
On 04/21/2016 11:52 AM, drum.lucas@gmail.com wrote:
> So when I run:
>
>     UPDATE ja_jobs t2
>     SET time_job = t1.time_job
>     FROM junk.ja_test t1
>     WHERE t2.id <http://t2.id> = t1.id <http://t1.id>
>     AND t2.time_job IS DISTINCT FROM t1.time_job;
>
>
> I get:
>
>     UPDATE 2202
>
> So I check the data by doing:
>
>     select * FROM public.ja_jobs WHERE id = 14574527
>
>
> And the "time_job" field is null....

First idea:

Are you doing this in two different sessions at the same time, so
something like this?:

     Session 1
     BEGIN;
     UPDATE ja_jobs t2
     SET time_job = t1.time_job
     FROM junk.ja_test t1
     WHERE t2.id = t1.id
     AND t2.time_job IS DISTINCT FROM t1.time_job;

     Session 2
     select * FROM public.ja_jobs WHERE id = 14574527


Where Session 2 is not seeing the UPDATE in Session 1 because the
transaction has not been COMMITed.

Second idea:

Does id = 14574527 meet the criteria AND t2.time_job IS DISTINCT FROM
t1.time_job?

>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: John McKown
Дата:
Сообщение: Re: Proper relational database?
Следующее
От: Gavin Flower
Дата:
Сообщение: Re: disable ipv6?