You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test coverage for CONSTRAINT support to close#2360 (#2373)
Column-level Foreign Key NULL Handling
**Location:** `src/60createtable.js:169-184`
**Problem:** Foreign keys rejected NULL values (treated NaN as invalid)
**Fix:** Updated to check for `undefined`, `null`, and `NaN` to properly allow NULL in foreign keys
Column-level Foreign Key `fk` Flag
**Location:** `src/60createtable.js:183`
**Problem:** Column-level foreign keys missing `fk: true` flag
**Fix:** Added flag for consistency with table-level foreign keys
CHECK Constraint NULL Semantics
- `src/50expression.js:510` - Expression NULL detection
- `src/60createtable.js:377-384,647-655` - CHECK validation logic
CHECK constraints failed when NULL was involved
- Updated expression compiler to recognize NaN as NULL
- Changed validation from `if (!check.fn(r))` to `if (check.fn(r) === false)` per SQL-99 standard
CHECK/FK Function Signatures
**Location:** `src/60createtable.js:125-129,218-219`
**Problem:** CHECK functions couldn't access `alasql` object for built-in functions
**Fix:** Updated signatures from `(r)` to `(r,params,alasql)` with matching call sites
Test SQL Syntax
**Location:** `test/test325.js:14-37`
**Problem:** Missing comma between constraints
**Fix:** Corrected SQL syntax, kept NONCLUSTERED/CLUSTERED (SQL Server extensions that parser supports)
CURRENT_TIMESTAMP Test Robustness
**Location:** `test/test324.js:158-163`
**Problem:** Test assumed CURRENT_TIMESTAMP always returns string, but can return Date object
**Fix:** Updated test to handle both string (when dateAsString=true) and Date object formats
SOURCE Command Bug Fix
**Location:** `src/15utility.js:352`
**Problem:** ReferenceError - catch block referenced undefined variable 'err' instead of 'e'
**Fix:** Changed `error(err, null)` to `error(e, null)` to use the caught exception variable
Test324 Test 20 Enabled
**Location:** `test/test324.js:175-180`, `test/test324.sql`
**Problem:** Test skipped due to SOURCE bug and SQL syntax incompatibilities
**Fix:**
- Fixed SOURCE command bug
- Created tempdb database before SOURCE
- Removed SQL Server-specific `$` prefix from MONEY values in test324.sql
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
0 commit comments