Re: PATCH: Add REINDEX tag to event triggers

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: Garrett Thornburg <film42(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: PATCH: Add REINDEX tag to event triggers
Date: 2023-09-01 16:10:11
Message-ID: CACJufxG7KqTS0KW3XJhkkTMiFUkOvpF_6PTDL_fUwzmQBX+2LQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 1, 2023 at 6:40 PM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
>
> On 01.09.23 11:23, jian he wrote:
> > because the change made in here:
> > https://git.postgresql.org/cgit/postgresql.git/diff/src/backend/commands/indexcmds.c?id=11af63fb48d278b86aa948a5b57f136ef03c2bb7
> >
> > I manually slight edited the patch content:
> > from
> > static List *ChooseIndexColumnNames(List *indexElems);
> > static void ReindexIndex(RangeVar *indexRelation, ReindexParams *params,
> > bool isTopLevel);
> > to
> > static List *ChooseIndexColumnNames(const List *indexElems);
> > static void ReindexIndex(const RangeVar *indexRelation, const
> > ReindexParams *params,
> > bool isTopLevel);
> >
> > can you try the attached one.
>
> The patch applies cleanly. However, now the compiler complains about a
> qualifier mismatch
>
> indexcmds.c:2707:33: warning: assignment discards ‘const’ qualifier from
> pointer target type [-Wdiscarded-qualifiers]
> 2707 | c
>
>
> Perhaps 'const ReindexStmt *currentReindexStatement'?
>
> Tests also work just fine. I also tested it against unique and partial
> indexes, and it worked as expected.
>
> Jim
>

Thanks for pointing this out!
also due to commit
https://git.postgresql.org/cgit/postgresql.git/commit/?id=11af63fb48d278b86aa948a5b57f136ef03c2bb7
ExecReindex function input arguments also changed. so we need to
rebase this patch.

change to
currentReindexStatement = unconstify(ReindexStmt*, stmt);
seems to work for me. I tested it, no warning. But I am not 100% sure.

anyway I refactored the patch, making it git applyable
also change from "currentReindexStatement = stmt;" to
"currentReindexStatement = unconstify(ReindexStmt*, stmt);" due to
ExecReindex function changes.

Attachment Content-Type Size
v3-0001-Add-REINDEX-tag-to-event-triggers.patch text/x-patch 21.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tristan Partin 2023-09-01 16:31:07 Casual Meson fixups
Previous Message David Steele 2023-09-01 15:39:24 Add const qualifiers