pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Create an RTE field to record the query's lock mode for each rel
Date: Sun, 30 Sep 2018 17:55:57 +0000
Message-ID: <E1g6fwj-0003Cs-F2@gemulon.postgresql.org> (raw)

Create an RTE field to record the query's lock mode for each relation.

Add RangeTblEntry.rellockmode, which records the appropriate lock mode for
each RTE_RELATION rangetable entry (either AccessShareLock, RowShareLock,
or RowExclusiveLock depending on the RTE's role in the query).

This patch creates the field and makes all creators of RTE nodes fill it
in reasonably, but for the moment nothing much is done with it.  The plan
is to replace assorted post-parser logic that re-determines the right
lockmode to use with simple uses of rte->rellockmode.  For now, just add
Asserts in each of those places that the rellockmode matches what they are
computing today.  (In some cases the match isn't perfect, so the Asserts
are weaker than you might expect; but this seems OK, as per discussion.)

This passes check-world for me, but it seems worth pushing in this state
to see if the buildfarm finds any problems in cases I failed to test.

catversion bump due to change of stored rules.

Amit Langote, reviewed by David Rowley and Jesper Pedersen,
and whacked around a bit more by me

Discussion: https://postgr.es/m/468c85d9-540e-66a2-1dde-fec2b741e688@lab.ntt.co.jp

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fdba460a26af919c0b366755d119f384706e670a

Modified Files
--------------
src/backend/catalog/dependency.c                 |  1 +
src/backend/catalog/heap.c                       |  1 +
src/backend/commands/copy.c                      |  9 +++---
src/backend/commands/createas.c                  |  1 +
src/backend/commands/policy.c                    | 23 +++++++++-----
src/backend/commands/tablecmds.c                 |  3 +-
src/backend/commands/trigger.c                   |  2 ++
src/backend/commands/view.c                      |  4 ++-
src/backend/executor/execMain.c                  | 11 +++++++
src/backend/executor/execUtils.c                 | 20 +++++++++---
src/backend/nodes/copyfuncs.c                    |  1 +
src/backend/nodes/equalfuncs.c                   |  1 +
src/backend/nodes/outfuncs.c                     |  1 +
src/backend/nodes/readfuncs.c                    |  1 +
src/backend/optimizer/plan/planner.c             |  2 ++
src/backend/parser/analyze.c                     |  1 +
src/backend/parser/parse_clause.c                |  1 +
src/backend/parser/parse_relation.c              | 28 +++++++++++++++--
src/backend/parser/parse_utilcmd.c               |  9 +++++-
src/backend/replication/logical/tablesync.c      |  3 +-
src/backend/replication/logical/worker.c         |  1 +
src/backend/rewrite/rewriteHandler.c             | 39 ++++++++++++++++++------
src/backend/utils/adt/ri_triggers.c              |  2 ++
src/backend/utils/adt/ruleutils.c                |  3 ++
src/backend/utils/cache/plancache.c              |  6 +++-
src/include/catalog/catversion.h                 |  2 +-
src/include/nodes/parsenodes.h                   | 12 ++++++++
src/include/parser/parse_relation.h              |  1 +
src/test/modules/test_rls_hooks/test_rls_hooks.c |  8 ++---
29 files changed, 159 insertions(+), 38 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1g6fwj-0003Cs-F2@gemulon.postgresql.org>
Permalink:  ../E1g6fwj-0003Cs-F2@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1g6fwj-0003Cs-F2@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Create an RTE field to record the query's lock mode for each rel
  In-Reply-To: <E1g6fwj-0003Cs-F2@gemulon.postgresql.org>
  References: <E1g6fwj-0003Cs-F2@gemulon.postgresql.org>

* 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