[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
обсуждение исходный текст
Ответы Re: [GENERAL] Does a row lock taken out in a CTE stay in place?
Re: [GENERAL] Does a row lock taken out in a CTE stay in place?
Список pgsql-general
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"
Дата:
Сообщение: Re: [GENERAL] Imperative Query Languages
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [GENERAL] Does a row lock taken out in a CTE stay in place?