Re: (Comment)Bug in CteScanNext

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: (Comment)Bug in CteScanNext
Date: 2016-09-03 18:30:53
Message-ID: 20931.1472927453@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> In CteScanNext():
> /*
> * If we are not at the end of the tuplestore, or are going
> backwards, try
> * to fetch a tuple from tuplestore.
> */
> eof_tuplestore = tuplestore_ateof(tuplestorestate);

> if (!forward && eof_tuplestore)

> For the comment to be correct, wouldn't the condition need to be
> (!forward || !eof_tuplestore)?

No. The comment is describing the overall strategy for the next ~30
lines. That first if-test is dealing with a sub-case, ie reversing
direction after reaching EOF. The code's fine, and the comments are
okay as far as they go, but maybe some rearrangement would be in order.
Or we could add something like "But first, we must deal with the special
case of reversing direction after reaching EOF."

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2016-09-03 18:41:24 Re: sequence data type
Previous Message Tom Lane 2016-09-03 17:59:32 Re: [sqlsmith] Failed assertion in numeric aggregate