dead assignment src/bin/scripts/print.c line 421

Started by Laurent Labordeover 10 years ago3 messages
#1Laurent Laborde
kerdezixe@gmail.com

Friendly greetings !

in file src/bin/scripts/print.c line 421 :
need_recordsep = false;
then set to true line 424.

Now i'm pretty sure it's a meaningless "bug" without any consequence (the
commit that introduced it is 15 years old).

There is a lot of (apparently) dead assignment here and there but some
assigment could be used for debugging purpose so ... why not. But this one ?

--
Laurent "ker2x" Laborde
DBA gandi.net \o/

#2Laurent Laborde
kerdezixe@gmail.com
In reply to: Laurent Laborde (#1)
Re: dead assignment src/bin/scripts/print.c line 421

Should have been sent to the bugs ML sorry :-/

On Mon, Jul 13, 2015 at 3:56 PM, Laurent Laborde <kerdezixe@gmail.com>
wrote:

Friendly greetings !

in file src/bin/scripts/print.c line 421 :
need_recordsep = false;
then set to true line 424.

Now i'm pretty sure it's a meaningless "bug" without any consequence (the
commit that introduced it is 15 years old).

There is a lot of (apparently) dead assignment here and there but some
assigment could be used for debugging purpose so ... why not. But this one ?

--
Laurent "ker2x" Laborde
DBA gandi.net \o/

--
Laurent "ker2x" Laborde

#3Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Laurent Laborde (#1)
Re: dead assignment src/bin/scripts/print.c line 421

On 07/13/2015 04:56 PM, Laurent Laborde wrote:

Friendly greetings !

in file src/bin/scripts/print.c line 421 :
need_recordsep = false;
then set to true line 424.

Now i'm pretty sure it's a meaningless "bug" without any consequence (the
commit that introduced it is 15 years old).

There is a lot of (apparently) dead assignment here and there but some
assigment could be used for debugging purpose so ... why not. But this one ?

The code in question looks like this:

for (f = footers; f; f = f->next)
{
if (need_recordsep)
{
print_separator(cont->opt->recordSep, fout);
need_recordsep = false;
}
fputs(f->data, fout);
need_recordsep = true;
}

Hmm. It does kind of make sense. Right after printing the separator, you
don't need to print a separator because you just printed one. But as
soon as you print the field, you need a separator again. It would be
quite understandable without that dead assignment too, and that's
probably how I would've written it in the first place. But since that's
how it is and has been for 15 years, I'm inclined to just leave it so.

- Heikki

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers