[PATCH] Fix expressions always false
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.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t41705psql -h localhost -U postgresBuilt from patchset v3 (message #3), September 22, 2026 at 06:01 PM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t41705_3 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t41705_3 && git checkout t41705_3Patchset v3 (message #3) is on t41705_3
More about expressions always false.
1. /src/backend/executor/execExprInterp.c
ndims <= 0 neve be negative, because ndims aways is added up +1
2. src/backend/utils/adt/formatting.c
result is declared long. Comparison with int limits is always false.
3. src/backend/utils/adt/jsonfuncs.c
lindex is declared long. . Comparison with int limits is always false.
4. src/backend/utils/adt/network.c
ip_addrsize is macro and awlays return 4 or 16
regards,
Ranier Vilela
Attachments:
always_false_v1.patchtext/x-patch; charset=US-ASCII; name=always_false_v1.patchDownload+8-10
Ranier Vilela <ranier.vf@gmail.com> writes:
More about expressions always false.
2. src/backend/utils/adt/formatting.c
result is declared long. Comparison with int limits is always false.
3. src/backend/utils/adt/jsonfuncs.c
lindex is declared long. . Comparison with int limits is always false.
1) long is 64 bits on Unix-like platforms
2) checking a long against LONG_MIN/LONG_MAX is _definitely_ pointless
3) it's being cast to an int for the from_char_set_int() call below
Please take your time to read the whole context of the code you're
changing, and consider other platforms than just Windows.
- ilmari
--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen
1) long is 64 bits on Unix-like platforms
2) checking a long against LONG_MIN/LONG_MAX is _definitely_ pointless
3) it's being cast to an int for the from_char_set_int() call below
Please take your time to read the whole context of the code you're
changing, and consider other platforms than just Windows.
Thank you for point me, about this.
regards,
Ranier Vilela
Em qui., 19 de dez. de 2019 às 20:58, Dagfinn Ilmari Mannsåker <
ilmari@ilmari.org> escreveu:
Show quoted text
Ranier Vilela <ranier.vf@gmail.com> writes:
More about expressions always false.
2. src/backend/utils/adt/formatting.c
result is declared long. Comparison with int limits is always false.
3. src/backend/utils/adt/jsonfuncs.c
lindex is declared long. . Comparison with int limits is always false.1) long is 64 bits on Unix-like platforms
2) checking a long against LONG_MIN/LONG_MAX is _definitely_ pointless
3) it's being cast to an int for the from_char_set_int() call belowPlease take your time to read the whole context of the code you're
changing, and consider other platforms than just Windows.- ilmari
--
"A disappointingly low fraction of the human race is,
at any given time, on fire." - Stig Sandbeck Mathisen