[PATCH] src\backend\utils\adt\numeric.c copy and past error

Started by Ranier Vilelaover 6 years ago4 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

never appliedCI history
Jump to latest
#1Ranier Vilela
ranier.vf@gmail.com

Hi,
Possible copy and past error, found in numeric.c.
I believe I believe that the author's intention was to return const_zero.

regards,
Ranier Vilela

Attachments:

numeric.patchapplication/octet-stream; name=numeric.patchDownload+1-1
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ranier Vilela (#1)
Re: [PATCH] src\backend\utils\adt\numeric.c copy and past error

Ranier Vilela <ranier.vf@gmail.com> writes:

Possible copy and past error, found in numeric.c.
I believe I believe that the author's intention was to return const_zero.

Did you read the comment just above there?

regards, tom lane

#3Ranier Vilela
ranier.vf@gmail.com
In reply to: Tom Lane (#2)
Re: [PATCH] src\backend\utils\adt\numeric.c copy and past error

Hi,
Yes, but the comment it does not clarify that the return of the variable
"const_one" is intentional, instead of "const_zero".
Anybody with reads the source, can think which is a copy and paste mistake.

regards
Ranier Vilela

Em dom., 19 de jan. de 2020 às 21:22, Tom Lane <tgl@sss.pgh.pa.us> escreveu:

Show quoted text

Ranier Vilela <ranier.vf@gmail.com> writes:

Possible copy and past error, found in numeric.c.
I believe I believe that the author's intention was to return const_zero.

Did you read the comment just above there?

regards, tom lane

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ranier Vilela (#3)
Re: [PATCH] src\backend\utils\adt\numeric.c copy and past error

Ranier Vilela <ranier.vf@gmail.com> writes:

Yes, but the comment it does not clarify that the return of the variable
"const_one" is intentional, instead of "const_zero".

I'm not sure which part of "NaN ^ 0 = 1" doesn't clarify for you that
the intended result is 1.

Even without the comment, if you'd bothered to run the regression tests
you'd have noted a failure of a test case clearly intended to test
exactly this behavior.

regards, tom lane