Skip to content

Name the table in foreign key errors instead of undefined (part of #2663) - #2664

Merged
mathiasrw merged 1 commit into
developfrom
fix/2663
Oct 20, 2026
Merged

mathiasrw merged 1 commit into
developfrom
fix/2663

Conversation

@mathiasrw

Copy link
Copy Markdown
Member

Part of #2663.

The "Invalid foreign key on table ..." errors read table.tableid, and the table object has no tableid, so the message said undefined. Both places (at CREATE TABLE and on INSERT) now use the table's name.

Statement Before After
INSERT INTO c VALUES (1, NULL) with a composite foreign key on c Invalid foreign key on table undefined Invalid foreign key on table c

Behaviour is unchanged: a composite key with NULL in some columns is still refused (MATCH FULL, as test807 asserts). Accepting it (MATCH SIMPLE, as SQL's default and SQLite) is a breaking change and stays in #2663 for 5.0.

test/test2663.js: the message at INSERT and at CREATE TABLE, and that a full key is still checked. Full suite: 2344 pass, 213 skip, 0 fail.

@mathiasrw
mathiasrw merged commit c612bc3 into develop Oct 20, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant