From: | Kirill Reshke <reshkekirill(at)gmail(dot)com> |
---|---|
To: | hugo <2689496754(at)qq(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Useless field ispartitioned in CreateStmtContext |
Date: | 2024-10-30 09:07:41 |
Message-ID: | CALdSSPgXT71KQ79H_Xv1bno1uq_E-ivqsVDLXdUMy-BR7ttOtQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi
On Thu, 24 Oct 2024, 18:08 hugo, <2689496754(at)qq(dot)com> wrote:
> Hi!
>
> When looking at the partition-related code, I found that the
> ispartitioned
>
> field in CreateStmtContext is not used. It looks like we can safely remove
> it and
>
> avoid invalid assignment logic.
>
>
>
> Here's a very simple fix, any suggestion?
>
>
>
> diff --git a/src/backend/parser/parse_utilcmd.c
> b/src/backend/parser/parse_utilcmd.c
>
> index 1e15ce10b48..6dea85cc2dc 100644
>
> --- a/src/backend/parser/parse_utilcmd.c
>
> +++ b/src/backend/parser/parse_utilcmd.c
>
> @@ -89,7 +89,6 @@ typedef struct
>
> List *alist; /* "after list" of things
> to do after creating
>
> * the
> table */
>
> IndexStmt *pkey; /* PRIMARY KEY index, if
> any */
>
> - bool ispartitioned; /* true if table is partitioned */
>
> PartitionBoundSpec *partbound; /* transformed FOR VALUES */
>
> bool ofType; /* true if statement
> contains OF typename */
>
> } CreateStmtContext;
>
> @@ -246,7 +245,6 @@ transformCreateStmt(CreateStmt *stmt, const char
> *queryString)
>
> cxt.blist = NIL;
>
> cxt.alist = NIL;
>
> cxt.pkey = NULL;
>
> - cxt.ispartitioned = stmt->partspec != NULL;
>
> cxt.partbound = stmt->partbound;
>
> cxt.ofType = (stmt->ofTypename != NULL);
>
> @@ -3401,7 +3399,6 @@ transformAlterTableStmt(Oid relid, AlterTableStmt
> *stmt,
>
> cxt.blist = NIL;
>
> cxt.alist = NIL;
>
> cxt.pkey = NULL;
>
> - cxt.ispartitioned = (rel->rd_rel->relkind ==
> RELKIND_PARTITIONED_TABLE);
>
> cxt.partbound = NULL;
>
> cxt.ofType = false;
>
>
>
> --
>
> Best regards,
>
> hugozhang
>
I don't see any cf entry for this patch, so I created one[1]. I added Alena
and myself as reviewers. I can't find your account on cf, please add
yourself as author
[1] https://commitfest.postgresql.org/50/5340/
>
From | Date | Subject | |
---|---|---|---|
Next Message | Anthonin Bonnefoy | 2024-10-30 09:14:55 | Consider pipeline implicit transaction as a transaction block |
Previous Message | Jelte Fennema-Nio | 2024-10-30 09:04:41 | Re: protocol-level wait-for-LSN |