RE: Table locking during backup - Mailing list pgsql-general

From Artur Zając
Subject RE: Table locking during backup
Date
Msg-id 02b701d57da3$57bea1f0$073be5d0$@ang.com.pl
Whole thread Raw
In response to Re: Table locking during backup  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: Table locking during backup
List pgsql-general
> Not sure why would it matter that the pg_dump connection is read-only, this is about locking because
> pg_dump needs to ensure the schema does not change while it's running.
> pg_dump does not do
>
>   LOCK TABLE gm.tableabc;
>
> but
>
>   LOCK TABLE gm.tableabc IN ACCESS SHARE MODE;
>
> Which should be visible in pg_locks system view. And it does conflict with the ACCESS EXCLUSIVE mode, > used by the
secondquery. 

My mistake. I cited the log incorrectly - of course should be (and there was) LOCK TABLE gm.tableabc IN ACCESS SHARE
MODE. 
After all, your answer does not explain everything. I tried to reproduce the minimum commands:

First session:

BEGIN;
set transaction isolation level repeatable read, read only;
lock TABLE gm.tableabc IN access share mode;


Second session:
BEGIN;
CREATE TEMP TABLE IF NOT EXISTS tableabc (Id BIGINT DEFAULT random()) INHERITS (gm.tableabc);

"CREATE TEMP TABLE" does not wait for anything. Waiting state is only when I start third session with the same queries
asin second. 

Maybe "LOCK TABLE ... IN ACCESS SHARE MODE" is the answer, but with correlation with some other query or setting setted
bypg_backup. 

Table gm.tableabc is created with "create table gm.tableabc (x int default random());"

AZ




pgsql-general by date:

Previous
From: Konstantin Izmailov
Date:
Subject: Re: COPY command returns "ERROR: invalid XML content"
Next
From: "Arnaud L."
Date:
Subject: Re: psql \copy hanging