[PATCH] Tiny optmization. - Mailing list pgsql-hackers

From Ranier Vilela
Subject [PATCH] Tiny optmization.
Date
Msg-id MN2PR18MB2927DF45F7F53BB76ED4A3F4E3490@MN2PR18MB2927.namprd18.prod.outlook.com
Whole thread Raw
Responses Re: [PATCH] Tiny optmization.  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
Hi,
Maybe it doesn't matter, but, I think it's worth discussing.
The expression "if(pstate)" is redundant or is possible null dereference.

Best regards.
Ranier Vilela

--- \dll\postgresql-12.0\a\backend\commands\copy.c    Mon Sep 30 17:06:55 2019
+++ copy.c    Fri Nov 22 18:33:05 2019
@@ -3426,8 +3426,7 @@
     cstate->raw_buf_index = cstate->raw_buf_len = 0;

     /* Assign range table, we'll need it in CopyFrom. */
-    if (pstate)
-        cstate->range_table = pstate->p_rtable;
+    cstate->range_table = pstate->p_rtable;

     tupDesc = RelationGetDescr(cstate->rel);
     num_phys_attrs = tupDesc->natts;

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: TAP tests aren't using the magic words for Windows file access
Next
From: Ranier Vilela
Date:
Subject: [PATCH] Tiny optmization or is a bug?