Re: [PATCH] Avoid open and lock the table Extendend Statistics (src/backend/commands/statscmds.c)

2022-02-13 Thread Tom Lane
Tomas Vondra writes: > On 2/13/22 22:43, Andres Freund wrote: >> Having looked briefly at it, I don't understand what the locking scheme is? > I don't recall the details of the discussion (if at all), but if you try > to do concurrent ALTER STATISTICS, that'll end up with: > ERROR: tuple concur

Re: [PATCH] Avoid open and lock the table Extendend Statistics (src/backend/commands/statscmds.c)

2022-02-13 Thread Tomas Vondra
On 2/13/22 22:43, Andres Freund wrote: > Hi, > > On 2022-02-13 18:21:38 -0300, Ranier Vilela wrote: >> Why open and lock the table Extended Statistics if it is not the owner. >> Check and return to avoid this. > > I was about to say that this opens up time-to-check-time-to-use type > issues. But

Re: [PATCH] Avoid open and lock the table Extendend Statistics (src/backend/commands/statscmds.c)

2022-02-13 Thread Ranier Vilela
Em dom., 13 de fev. de 2022 às 18:43, Andres Freund escreveu: > Hi, > > On 2022-02-13 18:21:38 -0300, Ranier Vilela wrote: > > Why open and lock the table Extended Statistics if it is not the owner. > > Check and return to avoid this. > > I was about to say that this opens up time-to-check-time-t

Re: [PATCH] Avoid open and lock the table Extendend Statistics (src/backend/commands/statscmds.c)

2022-02-13 Thread Andres Freund
Hi, On 2022-02-13 18:21:38 -0300, Ranier Vilela wrote: > Why open and lock the table Extended Statistics if it is not the owner. > Check and return to avoid this. I was about to say that this opens up time-to-check-time-to-use type issues. But it's the wrong thing to lock to prevent those. Havin

[PATCH] Avoid open and lock the table Extendend Statistics (src/backend/commands/statscmds.c)

2022-02-13 Thread Ranier Vilela
Hi, Commit https://github.com/postgres/postgres/commit/6d554e3fcd6fb8be2dbcbd3521e2947ed7a552cb has fixed the bug, but still has room for improvement. Why open and lock the table Extended Statistics if it is not the owner. Check and return to avoid this. trivial patch attached. regards, Ranier