From: David Rowley <dgrowle...@gmail.com>
> On Wed, 21 Jul 2021 at 13:39, James Coleman <jtc...@gmail.com> wrote:
> > Thanks for doing the math measuring how much we could impact things.
> >
> > I'm +lots on getting this committed as is.
> 
> Ok good. I plan on taking a final look at the v10 patch tomorrow morning NZ
> time (about 12 hours from now) and if all is well, I'll push it.
> 
> If anyone feels differently, please let me know before then.
Hi,

I noticed a minor thing about the v10 patch.

-
-               for (;;)
+               if (node->datumSort)
                {
-                       slot = ExecProcNode(outerNode);
-
-                       if (TupIsNull(slot))
-                               break;
-
-                       tuplesort_puttupleslot(tuplesortstate, slot);
+                       for (;;)
+                       {
+                               slot = ExecProcNode(outerNode);
+
+                               if (TupIsNull(slot))
+                                       break;
+                               slot_getsomeattrs(slot, 1);
+                               tuplesort_putdatum(tuplesortstate,
+                                                                  
slot->tts_values[0],
+                                                                  
slot->tts_isnull[0]);
+                       }
+               }
+               else
+               {
+                       for (;;)
+                       {
+                               slot = ExecProcNode(outerNode);
+
+                               if (TupIsNull(slot))
+                                       break;
+                               tuplesort_puttupleslot(tuplesortstate, slot);
+                       }

The above seems can be shorter like the following ?

for (;;)
{
        slot = ExecProcNode(outerNode);
        if (TupIsNull(slot))
                break;
        if (node->datumSort)
        {
                slot_getsomeattrs(slot, 1);
                tuplesort_putdatum(tuplesortstate,
                                        slot->tts_values[0],
                                        slot->tts_isnull[0]);
        }
        else
                tuplesort_puttupleslot(tuplesortstate, slot);
}

Best regards,
houzj

Reply via email to