pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor code in tablecmds.c to check and process tablespace mov
Date: Wed, 27 Jan 2021 02:55:02 +0000
Message-ID: <E1l4az0-0000uQ-Mz@gemulon.postgresql.org> (raw)

Refactor code in tablecmds.c to check and process tablespace moves

Two code paths of tablecmds.c (for relations with storage and without
storage) use the same logic to check if the move of a relation to a
new tablespace is allowed or not and to update pg_class.reltablespace
and pg_class.relfilenode.

A potential TABLESPACE clause for REINDEX, CLUSTER and VACUUM FULL needs
similar checks to make sure that nothing is moved around in illegal ways
(no mapped relations, shared relations only in pg_global, no move of
temp tables owned by other backends).

This reorganizes the existing code of ALTER TABLE so as all this logic
is controlled by two new routines that can be reused for the other
commands able to move relations across tablespaces, limiting the number
of code paths in need of the same protections.  This also removes some
code that was duplicated for tables with and without storage for ALTER
TABLE.

Author: Alexey Kondratov, Michael Paquier
Discussion: https://postgr.es/m/YA+9mAMWYLXJMVPL@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4c9c359d38ff1e2de388eedd860785be6a49201c

Modified Files
--------------
src/backend/commands/tablecmds.c | 211 ++++++++++++++++++++++-----------------
src/include/commands/tablecmds.h |   4 +
2 files changed, 124 insertions(+), 91 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1l4az0-0000uQ-Mz@gemulon.postgresql.org>
Permalink:  ../E1l4az0-0000uQ-Mz@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1l4az0-0000uQ-Mz@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Refactor code in tablecmds.c to check and process tablespace mov
  In-Reply-To: <E1l4az0-0000uQ-Mz@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