Re: Select for update - Mailing list pgsql-sql

From David G. Johnston
Subject Re: Select for update
Date
Msg-id CAKFQuwYiJyPu2vezTJHzDNqM0+Er-NMf_doDjhiZmWToVhJttQ@mail.gmail.com
Whole thread Raw
In response to Select for update  (Yambu <hyambu@gmail.com>)
Responses Re: Select for update  (Yambu <hyambu@gmail.com>)
List pgsql-sql

On Wednesday, May 26, 2021, Yambu <hyambu@gmail.com> wrote:
Hello

May i know if i run the update below  if the row select in SELECT FOR UPDATE will not be available for selection during update?

UPDATE table1 set status_id=13 WHERE id= ( SELECT id FROM table2 where status_id=1 LIMIT 1) RETURNING id into v_id;

Which update?   The way it works is by locking - Ihe row is available but locked and may require waiting.

David J.

pgsql-sql by date:

Previous
From: Yambu
Date:
Subject: Select for update
Next
From: Yambu
Date:
Subject: Re: Select for update