Re: Reduce lock level for ALTER TABLE ... ADD CHECK .. NOT VALID
| От | John Naylor |
|---|---|
| Тема | Re: Reduce lock level for ALTER TABLE ... ADD CHECK .. NOT VALID |
| Дата | |
| Msg-id | CAFBsxsH4=TT7zv3R4d7-JKrLymG6Ow8GaiwBvVcVsQG8YwJf0g@mail.gmail.com обсуждение исходный текст |
| Ответ на | Reduce lock level for ALTER TABLE ... ADD CHECK .. NOT VALID (Simon Riggs <simon.riggs@enterprisedb.com>) |
| Ответы |
Re: Reduce lock level for ALTER TABLE ... ADD CHECK .. NOT VALID
|
| Список | pgsql-hackers |
On Thu, Apr 22, 2021 at 8:01 AM Simon Riggs <simon.riggs@enterprisedb.com> wrote:
>
> 897795240cfaaed724af2f53ed2c50c9862f951f forgot to reduce the lock
> level for CHECK constraints when allowing them to be NOT VALID.
>
> This is simple and safe, since check constraints are not used in
> planning until validated.
The patch also reduces the lock level when NOT VALID is not specified, which didn't seem to be the intention.
# begin;
BEGIN
*# alter table alterlock2 add check (f1 > 0);
ALTER TABLE
*# select * from my_locks order by 1;
relname | max_lockmode
------------+-----------------------
alterlock2 | ShareRowExclusiveLock
(1 row)
--
John Naylor
EDB: http://www.enterprisedb.com
BEGIN
*# alter table alterlock2 add check (f1 > 0);
ALTER TABLE
*# select * from my_locks order by 1;
relname | max_lockmode
------------+-----------------------
alterlock2 | ShareRowExclusiveLock
(1 row)
--
John Naylor
EDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: