From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Karina Litskevich <litskevichkarina(at)gmail(dot)com> |
Cc: | Alexander Lakhin <exclusion(at)gmail(dot)com>, 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-30 16:15:48 |
Message-ID: | CAEudQAoo4yZ-prY4UU8GBST+-DJzPb-czAEuhL05Vtv0PcKRxg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Em sex., 30 de jun. de 2023 às 11:26, Karina Litskevich <
litskevichkarina(at)gmail(dot)com> escreveu:
> Hi,
>
> Alexander wrote:
>
> > 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.
>
> Hi Karina,
> As I understand cont->cells is supoused to have all cont->ncolumns *
> cont->nrows
> entries filled so the loop "print cells" always assigns need_recordsep =
> true,
> except when there are no cells at all or cancel_pressed == true.
> If cancel_pressed == true then footers are not printed. So to have
> need_recordsep == false before the loop "for (footers)" table should be
> empty,
> and need_recordsep should be false before the loop "print cells". It can
> only
> be false there when cont->opt->start_table == true and opt_tuples_only ==
> true
> so that headers are not printed. But when opt_tuples_only == true footers
> are
> not printed either.
>
> So technically removing "need_recordsep = true;" won't change the outcome.
Thanks for the confirmation.
> But
> it's not obvious, so I also have doubts about removing this line. If
> someday
> print options are changed, for example to support printing footers and not
> printing headers, or anything else changes in this function, the output
> might
> be unexpected with this line removed.
That part I didn't understand.
How are we going to make this function less readable by removing the
complicating part.
best regards,
Ranier Vilela
From | Date | Subject | |
---|---|---|---|
Next Message | Ranier Vilela | 2023-06-30 16:20:10 | Re: Avoid unused value (src/fe_utils/print.c) |
Previous Message | Alexander Lakhin | 2023-06-30 16:00:00 | Re: Avoid unused value (src/fe_utils/print.c) |