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

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid unused value (src/fe_utils/print.c)
Date: 2023-06-04 11:59:00
Message-ID: CAEudQAo0GPWdg5Rf=xjPQ37+OsGDxMaNCE=YOfc1dqppoRZ5zQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em dom., 4 de jun. de 2023 às 01:00, Alexander Lakhin <exclusion(at)gmail(dot)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
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2023-06-04 12:42:22 Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c)
Previous Message Dmitry Dolgov 2023-06-04 09:33:42 Re: LLVM 16 (opaque pointers)