Re: Avoid unused value (src/fe_utils/print.c)

Поиск
Список
Период
Сортировка
От Ranier Vilela
Тема Re: Avoid unused value (src/fe_utils/print.c)
Дата
Msg-id CAEudQAo0GPWdg5Rf=xjPQ37+OsGDxMaNCE=YOfc1dqppoRZ5zQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Avoid unused value (src/fe_utils/print.c)  (Alexander Lakhin <exclusion@gmail.com>)
Список pgsql-hackers
Em dom., 4 de jun. de 2023 às 01:00, Alexander Lakhin <exclusion@gmail.com> escreveu:
Hi Michael,

04.06.2023 01:42, Michael Paquier wrote:
> On Sat, Jun 03, 2023 at 03:00:01PM +0300, Alexander Lakhin wrote:
>> Clang' scan-build detects 58 errors "Dead assignment", including that one.
>> Maybe it would be more sensible to eliminate all errors of this class?
> Depends on if this makes any code changed a bit easier to understand I
> guess, so that would be a case-by-case analysis.  Saying that, the
> proposed patch seems right while it makes slightly easier to
> understand the footer print part.

It also aligns the code with print_unaligned_vertical(), but I can't see why
need_recordsep = true;
is a no-op here (scan-build dislikes only need_recordsep = false;).
I suspect that removing that line will change the behaviour in cases when
need_recordsep = false after the loop "print cells" and the loop
"for (footers)" is executed.
Not sure about this.
I tested with patch and the results is:

psql -U postgres --no-align
psql (16beta1)
WARNING: Console code page (850) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgres=# select * from pgbench_accounts limit 100;
aid|bid|abalance|filler
1|1|0|
2|1|0|
3|1|0|
4|1|0|
5|1|0|
6|1|0|
7|1|0|
8|1|0|
9|1|0|
etc, etc

psql -U postgres --no-align -P recordsep=";"
psql (16beta1)
WARNING: Console code page (850) differs from Windows code page (1252)
         8-bit characters might not work correctly. See psql reference
         page "Notes for Windows users" for details.
Type "help" for help.

postgres=# select * from pgbench_accounts limit 100;
aid|bid|abalance|filler;1|1|0|                                                                                    ;2|1|0|                                                                                    ;3|1|0|                                                                                    ;4|1|0|                                                                                    ;5|1|0|                                                                                    ;6|1|0|                                                                                    ;7|1|0|                                                                                    ;8|1|0|                                                                                    ;9|1|0|                                                                                    ;10|1|0|                                                                                    ;11|1|0|                                                                                    ;12|1|0|                                                                                    ;13|1|0|                                                                                    ;14|1|0|                                                                                    ;15|1|0|                                                                                    ;16|1|0|                                                                                    ;17|1|0|
etc, etc

regards,
Ranier Vilela
 

Best regards,
Alexander

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

Предыдущее
От: Dmitry Dolgov
Дата:
Сообщение: Re: LLVM 16 (opaque pointers)
Следующее
От: Ranier Vilela
Дата:
Сообщение: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)