Adding one CheckTableNotInUse() for REINDEX CONCURRENTLY

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Adding one CheckTableNotInUse() for REINDEX CONCURRENTLY
Date: 2020-01-28 06:26:07
Message-ID: 20200128062607.GA145179@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

As mentioned on the thread dealing with concurrent indexing for
temporary relations, it sounds like a good thing to make the code more
defensive if attempting to do a REINDEX CONCURRENTLY with a backend
still holding references to the indexes worked on:
https://www.postgresql.org/message-id/20191212213709.neopqccvdo724eha@alap3.anarazel.de

One thing is that as REINDEX CONCURRENTLY cannot be used in
transaction blocks, this cannot be triggered in the context of a
function call, say with this patch:
+ERROR: REINDEX CONCURRENTLY cannot be executed from a function
+CONTEXT: SQL statement "REINDEX INDEX CONCURRENTLY reindex_ind_ref"
+PL/pgSQL function reindex_func_ref() line 3 at EXECUTE

Attached is a patch to do that. I am not sure if the test added in
the patch has much additional value, but feel free to look at it. Any
thoughts?
--
Michael

Attachment Content-Type Size
reindex_conc_inuse.patch text/x-diff 3.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2020-01-28 06:28:02 Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions
Previous Message Peter Griggs 2020-01-28 06:23:33 Re: [QUESTION/PROPOSAL] loose quadtree in spgist