unreachable code in partition.c

Started by Jeevan Ladheover 8 years ago2 messages
#1Jeevan Ladhe
jeevan.ladhe@enterprisedb.com
1 attachment(s)

Hi,

Following code in function get_qual_for_list(partition.c) is not reachable.

else
result = list_make1(opexpr);

Attached is the patch that removes this dead code.

Regards,
Jeevan Ladhe

Attachments:

partition_remove_dead_code.patchapplication/octet-stream; name=partition_remove_dead_code.patchDownload
diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c
index 7304f6c..01a43e0 100644
--- a/src/backend/catalog/partition.c
+++ b/src/backend/catalog/partition.c
@@ -1383,15 +1383,13 @@ get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec)
 
 	if (nulltest1)
 		result = list_make2(nulltest1, opexpr);
-	else if (nulltest2)
+	else
 	{
 		Expr	   *or;
 
 		or = makeBoolExpr(OR_EXPR, list_make2(nulltest2, opexpr), -1);
 		result = list_make1(or);
 	}
-	else
-		result = list_make1(opexpr);
 
 	return result;
 }
#2Robert Haas
robertmhaas@gmail.com
In reply to: Jeevan Ladhe (#1)
Re: unreachable code in partition.c

On Tue, May 23, 2017 at 2:06 PM, Jeevan Ladhe
<jeevan.ladhe@enterprisedb.com> wrote:

Following code in function get_qual_for_list(partition.c) is not reachable.

else
result = list_make1(opexpr);

Attached is the patch that removes this dead code.

Committed, but I added an Assert() as future-proofing.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers