public inbox for [email protected]help / color / mirror / Atom feed
[PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). 262+ messages / 1 participants [nested] [flat]
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
* [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). @ 2026-05-14 16:42 Nathan Bossart <[email protected]> 0 siblings, 0 replies; 262+ messages in thread From: Nathan Bossart @ 2026-05-14 16:42 UTC (permalink / raw) While the refint documentation advises marking the primary key columns NOT NULL, an UPDATE statement that triggered check_foreign_key(..., 'cascade', ...) and that set a key value to NULL accidentally worked before commit 260e97733b because sprintf() inserted "(null)" into the internally-generated SQL statement. After commit 260e97733b, the new key value is first passed to quote_literal_cstr(), which seg-faults for a NULL argument. To fix, skip quoting when a new key value is NULL and insert "NULL" instead. Reported-by: Nikita Kalinin <[email protected]> Author: Ayush Tiwari <[email protected]> Reviewed-by: Pierre Forstmann <[email protected]> Discussion: https://postgr.es/m/19476-bd04ea6241345303%40postgresql.org Backpatch-through: 14 --- contrib/spi/refint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index c44c87bcd96..48512a664d2 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -487,7 +487,8 @@ check_foreign_key(PG_FUNCTION_ARGS) nv = SPI_getvalue(newtuple, tupdesc, fn); appendStringInfo(&sql, " %s = %s ", - args2[k], quote_literal_cstr(nv)); + args2[k], + nv ? quote_literal_cstr(nv) : "NULL"); if (k < nkeys) appendStringInfoString(&sql, ", "); } -- 2.50.1 (Apple Git-155) --CN4uTtA78AYCFRt1-- ^ permalink raw reply [nested|flat] 262+ messages in thread
end of thread, other threads:[~2026-05-14 16:42 UTC | newest] Thread overview: 262+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]> 2026-05-14 16:42 [PATCH v3 1/1] refint: Fix seg-fault in check_foreign_key(). Nathan Bossart <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox