Re: (Comment)Bug in CteScanNext

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: (Comment)Bug in CteScanNext
Дата
Msg-id 20931.1472927453@sss.pgh.pa.us
обсуждение исходный текст
Ответ на (Comment)Bug in CteScanNext  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Ответы Re: (Comment)Bug in CteScanNext  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-hackers
Jim Nasby <Jim.Nasby@BlueTreble.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [sqlsmith] Failed assertion in numeric aggregate
Следующее
От: Vik Fearing
Дата:
Сообщение: Re: sequence data type