Removed unused param isSlice of function transformAssignmentSubscripts

Started by Zhang Mingliover 3 years ago3 messages
#1Zhang Mingli
zmlpostgres@gmail.com
1 attachment(s)

Hi,

Param isSlice was once used to identity targetTypeId for transformAssignmentIndirection.

In commit c7aba7c14e, the evaluation was pushed down to transformContainerSubscripts.

No need to keep isSlice around transformAssignmentSubscripts.

Attach a patch to remove it.

Regards,
Zhang Mingli

Attachments:

vn-0001-Removed-unused-param-isSlice.patchapplication/octet-streamDownload
From fc86c118d317578fda025130f54b55dd50c987ef Mon Sep 17 00:00:00 2001
From: Mingli Zhang <avamingli@gmail.com>
Date: Tue, 13 Sep 2022 11:18:52 +0800
Subject: [PATCH vn] Removed unused param isSlice of function
 transformAssignmentSubscripts

Param isSlice was once used to identity targetTypeId for transformAssignmentIndirection.
In commit c7aba7c14e, the evaluation was pushed down to transformContainerSubscripts.
No need to keep isSlice around transformAssignmentSubscripts.
---
 src/backend/parser/parse_target.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index 4e1593d900..bd8057bc3e 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -41,7 +41,6 @@ static Node *transformAssignmentSubscripts(ParseState *pstate,
 										   int32 targetTypMod,
 										   Oid targetCollation,
 										   List *subscripts,
-										   bool isSlice,
 										   List *indirection,
 										   ListCell *next_indirection,
 										   Node *rhs,
@@ -697,7 +696,6 @@ transformAssignmentIndirection(ParseState *pstate,
 {
 	Node	   *result;
 	List	   *subscripts = NIL;
-	bool		isSlice = false;
 	ListCell   *i;
 
 	if (indirection_cell && !basenode)
@@ -727,11 +725,7 @@ transformAssignmentIndirection(ParseState *pstate,
 		Node	   *n = lfirst(i);
 
 		if (IsA(n, A_Indices))
-		{
 			subscripts = lappend(subscripts, n);
-			if (((A_Indices *) n)->is_slice)
-				isSlice = true;
-		}
 		else if (IsA(n, A_Star))
 		{
 			ereport(ERROR,
@@ -763,7 +757,6 @@ transformAssignmentIndirection(ParseState *pstate,
 													 targetTypMod,
 													 targetCollation,
 													 subscripts,
-													 isSlice,
 													 indirection,
 													 i,
 													 rhs,
@@ -853,7 +846,6 @@ transformAssignmentIndirection(ParseState *pstate,
 											 targetTypMod,
 											 targetCollation,
 											 subscripts,
-											 isSlice,
 											 indirection,
 											 NULL,
 											 rhs,
@@ -907,7 +899,6 @@ transformAssignmentSubscripts(ParseState *pstate,
 							  int32 targetTypMod,
 							  Oid targetCollation,
 							  List *subscripts,
-							  bool isSlice,
 							  List *indirection,
 							  ListCell *next_indirection,
 							  Node *rhs,
-- 
2.34.1

#2Richard Guo
guofenglinux@gmail.com
In reply to: Zhang Mingli (#1)
Re: Removed unused param isSlice of function transformAssignmentSubscripts

On Tue, Sep 13, 2022 at 11:35 AM Zhang Mingli <zmlpostgres@gmail.com> wrote:

Param isSlice was once used to identity targetTypeId for
transformAssignmentIndirection.

In commit c7aba7c14e, the evaluation was pushed down to
transformContainerSubscripts.

No need to keep isSlice around transformAssignmentSubscripts.

Attach a patch to remove it.

+1. Good catch.

Thanks
Richard

#3Michael Paquier
michael@paquier.xyz
In reply to: Richard Guo (#2)
Re: Removed unused param isSlice of function transformAssignmentSubscripts

On Tue, Sep 13, 2022 at 03:20:01PM +0800, Richard Guo wrote:

+1. Good catch.

Yes, you are right that this comes from c7aba7c that has changed the
transform logic and the check on slicing support, and this makes the
code easier to follow. So, applied.
--
Michael