[GENERAL] Does a row lock taken out in a CTE stay in place?

Поиск
Список
Период
Сортировка
Искать
От
Seamus Abshere
Тема
[GENERAL] Does a row lock taken out in a CTE stay in place?
Дата
Msg-id
1499787377.3420973.1037421528.6AC1E2E3@webmail.messagingengine.com
Список
Дерево обсуждения
[GENERAL] Does a row lock taken out in a CTE stay in place? Seamus Abshere <seamus@abshere.net>
Re: [GENERAL] Does a row lock taken out in a CTE stay in place? Tom Lane <tgl@sss.pgh.pa.us>
Re: [GENERAL] Does a row lock taken out in a CTE stay in place? "David G. Johnston" <david.g.johnston@gmail.com>
Given an update that uses CTEs like this:

WITH
lock_rows AS (
  SELECT 1 FROM tbl WHERE [...] FOR UPDATE
)
UPDATE [...]

Will the rows in `tbl` remain locked until the UPDATE is finished?

Also, does it matter if `lock_rows` is referenced? (IIUC the query
wouldn't be run if the CTE isn't referenced if it was for a SELECT, but
since it's an UPDATE, it will be run anyway)

Thanks!
Seamus

--
Seamus Abshere, SCEA
https://github.com/seamusabshere
https://linkedin.com/in/seamusabshere
https://www.faraday.io

В списке pgsql-general по дате отправления
От: dandl
Дата:
От: Tom Lane
Дата:
FAQ