pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Create an RTE field to record the query's lock mode for each rel 3+ messages / 2 participants [nested] [flat]
* pgsql: Create an RTE field to record the query's lock mode for each rel @ 2018-09-30 17:55 Tom Lane <tgl@sss.pgh.pa.us> 2018-10-01 23:37 ` Re: pgsql: Create an RTE field to record the query's lock mode for each rel Andres Freund <andres@anarazel.de> 0 siblings, 1 reply; 3+ messages in thread From: Tom Lane @ 2018-09-30 17:55 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Create an RTE field to record the query's lock mode for each rel 2018-09-30 17:55 pgsql: Create an RTE field to record the query's lock mode for each rel Tom Lane <tgl@sss.pgh.pa.us> @ 2018-10-01 23:37 ` Andres Freund <andres@anarazel.de> 2018-10-01 23:43 ` Re: pgsql: Create an RTE field to record the query's lock mode for each rel Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 1 reply; 3+ messages in thread From: Andres Freund @ 2018-10-01 23:37 UTC (permalink / raw) To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org On 2018-09-30 17:55:57 +0000, Tom Lane wrote: > Create an RTE field to record the query's lock mode for each relation. > Details > ------- > https://git.postgresql.org/pg/commitdiff/fdba460a26af919c0b366755d119f384706e670a This triggers a new warning for me, when building without asserts: /home/andres/src/postgresql/src/backend/executor/execMain.c: In function ‘InitPlan’: /home/andres/src/postgresql/src/backend/executor/execMain.c:963:12: warning: variable ‘rellockmode’ set but not used [-Wunused-but-set-variable] LOCKMODE rellockmode; ^~~~~~~~~~~ Greetings, Andres Freund ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Create an RTE field to record the query's lock mode for each rel 2018-09-30 17:55 pgsql: Create an RTE field to record the query's lock mode for each rel Tom Lane <tgl@sss.pgh.pa.us> 2018-10-01 23:37 ` Re: pgsql: Create an RTE field to record the query's lock mode for each rel Andres Freund <andres@anarazel.de> @ 2018-10-01 23:43 ` Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2018-10-01 23:43 UTC (permalink / raw) To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org Andres Freund <andres@anarazel.de> writes: > On 2018-09-30 17:55:57 +0000, Tom Lane wrote: >> Create an RTE field to record the query's lock mode for each relation. > This triggers a new warning for me, when building without asserts: > /home/andres/src/postgresql/src/backend/executor/execMain.c: In function ‘InitPlan’: > /home/andres/src/postgresql/src/backend/executor/execMain.c:963:12: warning: variable ‘rellockmode’ set but not used [-Wunused-but-set-variable] > LOCKMODE rellockmode; > ^~~~~~~~~~~ Yeah, I knew it would do that. I didn't think it was worth working around, because that issue will go away in the next phase of the patch (probably tomorrow). regards, tom lane ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-10-01 23:43 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2018-09-30 17:55 pgsql: Create an RTE field to record the query's lock mode for each rel Tom Lane <tgl@sss.pgh.pa.us> 2018-10-01 23:37 ` Andres Freund <andres@anarazel.de> 2018-10-01 23:43 ` Tom Lane <tgl@sss.pgh.pa.us>
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