Re:BUG #19625: SQL/JSON boolean DEFAULT expression silently replaced with 'false'

Started by zengman2 months ago3 messagesbugs
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.

appliessuccessCI history

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:t253456
psql -h localhost -U postgres

Built from patchset v2 (message #2), October 24, 2026 at 02:16 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 t253456_2 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t253456_2 && git checkout t253456_2

Patchset v2 (message #2) is on t253456_2

Jump to latest
#1zengman
zengman@halodbtech.com

Hi,

The formatting above seems a bit messed up, so I am re-attaching the diff file.

--
Regards,
Man Zeng

Attachments:

t253456_1
json-bool-default-fix.patchapplication/octet-stream; charset=gb18030; name=json-bool-default-fix.patchDownload+9-12
#2zengman
zengman@halodbtech.com
In reply to: zengman (#1)

Added regression tests and rebased.

--
Regards,
Man Zeng

Attachments:

t253456_2
0002-json-bool-default-fix.patchapplication/octet-stream; charset=gb18030; name=0002-json-bool-default-fix.patchDownload+33-12
#3QQ Mail
781408517@qq.com
In reply to: zengman (#2)
Re: BUG #19625: SQL/JSON boolean DEFAULT expression silently replaced with 'false'

Hi Man,

Thank you for the updated patch. This review was prepared with AI assistance, including the local build and test execution.

Your 0002-json-bool-default-fix.patch applied without modification to PostgreSQL commit 9e7d152488f197e96f171f0714459c227c3f7693.

An independent 40-case test matrix went from 13 passing before the patch to all 40 passing afterward. Coverage included NULL boolean defaults; JSON_VALUE/JSON_QUERY with ON ERROR and ON EMPTY; domains and constraints; varchar length enforcement; JSON_TABLE; and volatile defaults evaluated only when needed, including repeated prepared-statement execution.

All nine JSON-related regression tests passed. Testing used Linux, GCC 14.2, --enable-cassert, and CFLAGS='-O0 -g0'. This was not a full PostgreSQL regression run or cross-platform validation.

No blocking issue was found within that scope. Could the regression tests also cover NULL::boolean, JSON_QUERY with ON EMPTY, and a nonconstant boolean default? These exercise distinct failures beyond the three added JSON_VALUE constant tests.