Re: Create/alter policy and exclusive table lock

2020-01-14 Thread Tom Lane
Konstantin Knizhnik writes: > But let me ask you one more question: why do we obtaining snapshot twice > in exec_simple_query: > first for analyze (pg_analyze_and_rewrite) and one for execution > (PortalStart)? That would happen anyway if the plan is cached. If we were to throw away all plan c

Re: Create/alter policy and exclusive table lock

2020-01-14 Thread Konstantin Knizhnik
On 14.01.2020 17:40, Tom Lane wrote: Konstantin Knizhnik writes: Right now changing policies (create/alter policy statements) requires exclusive lock of target table: Yup. I wonder why do we really need exclusive lock here? Because it affects the behavior of a SELECT. May be I missed s

Re: Create/alter policy and exclusive table lock

2020-01-14 Thread Tom Lane
Konstantin Knizhnik writes: > Right now changing policies (create/alter policy statements) requires > exclusive lock of target table: Yup. > I wonder why do we really need exclusive lock here? Because it affects the behavior of a SELECT. > May be I missed something, but why we can not rely on

Create/alter policy and exclusive table lock

2020-01-14 Thread Konstantin Knizhnik
Hi hackers, Right now changing policies (create/alter policy statements) requires exclusive lock of target table:     /* Get id of table.  Also handles permissions checks. */     table_id = RangeVarGetRelidExtended(stmt->table, AccessExclusiveLock,                                         0,