pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Carlos Alves <carlos.alves@tecnisys.com.br>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Question about tuple´s lock
Date: Tue, 24 Oct 2023 16:31:47 -0400
Message-ID: <849349.1698179507@sss.pgh.pa.us> (raw)
In-Reply-To: <2fa29bee5e4a7c369f54f02198423814@tecnisys.com.br>
References: <2fa29bee5e4a7c369f54f02198423814@tecnisys.com.br>

Carlos Alves <carlos.alves@tecnisys.com.br> writes:
> I need some help to understand why a transaction wiht a row delete
> aquire a AccessExclusiveLock and a row update a ExclusiveLock. 

UPDATE can use the weaker lock type if it's not modifying any
column that is part of a unique index.  This is to allow concurrency
with foreign-key checks that might wish to grab a read-only (shared)
lock on such a tuple.

A DELETE, or an UPDATE that is modifying key columns, has to
conflict with foreign-key checks.

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <849349.1698179507@sss.pgh.pa.us>
Permalink:  ../849349.1698179507@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/849349.1698179507@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, carlos.alves@tecnisys.com.br
  Subject: Re: Question about tuple´s lock
  In-Reply-To: <849349.1698179507@sss.pgh.pa.us>
  References: <2fa29bee5e4a7c369f54f02198423814@tecnisys.com.br> <849349.1698179507@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox