Search Postgresql Archives

Re: Update field to a column from another table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/21/2016 11:52 AM, drum.lucas@xxxxxxxxx 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@xxxxxxxxxxx


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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux