Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | When a table is part of a LEFT JOIN and should be a completely NULL row due to the semantics of a LEFT JOIN, make sure any generated columns on that row evaluate to NULL. Ticket [3b84b42943644d6f] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
0271491438ad2a985aeff355173a8d0f |
User & Date: | drh 2019-12-16 16:52:22 |
Context
2019-12-17
| ||
12:03 | Clean up the ExprList that holds the names of columns in a CTE before checking for unused references in the ALTER TABLE implementation. (check-in: 8223e79f user: drh tags: trunk) | |
2019-12-16
| ||
16:52 | When a table is part of a LEFT JOIN and should be a completely NULL row due to the semantics of a LEFT JOIN, make sure any generated columns on that row evaluate to NULL. Ticket [3b84b42943644d6f] (check-in: 02714914 user: drh tags: trunk) | |
2019-12-15
| ||
02:49 | Ensure that all ON CONFLICT REPLACE indexes are sorted to the end of the list of indexes for a table, even for weird cases where the same UNIQUE constraint occurs twice with the ON CONFLICT REPLACE clause only on the second one. This avoids an out-of-order contraint processing problem that can arise due to the optimization of check-in [469a62ca33081854]. (check-in: 1e3918ca user: drh tags: trunk) | |
Changes
Changes to src/expr.c.
︙ | ︙ | |||
3404 3405 3406 3407 3408 3409 3410 3411 3412 | ** and store the result in register regOut */ void sqlite3ExprCodeGeneratedColumn( Parse *pParse, Column *pCol, int regOut ){ sqlite3ExprCode(pParse, pCol->pDflt, regOut); if( pCol->affinity>=SQLITE_AFF_TEXT ){ | > > > > > > > > > < | > | 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 | ** and store the result in register regOut */ void sqlite3ExprCodeGeneratedColumn( Parse *pParse, Column *pCol, int regOut ){ int iAddr; Vdbe *v = pParse->pVdbe; assert( v!=0 ); assert( pParse->iSelfTab!=0 ); if( pParse->iSelfTab>0 ){ iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut); }else{ iAddr = 0; } sqlite3ExprCode(pParse, pCol->pDflt, regOut); if( pCol->affinity>=SQLITE_AFF_TEXT ){ sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1); } if( iAddr ) sqlite3VdbeJumpHere(v, iAddr); } #endif /* SQLITE_OMIT_GENERATED_COLUMNS */ /* ** Generate code to extract the value of the iCol-th column of a table. */ void sqlite3ExprCodeGetColumnOfTable( |
︙ | ︙ |
Changes to test/gencol1.test.
︙ | ︙ | |||
414 415 416 417 418 419 420 421 422 | | end c27.db }]} {} do_execsql_test gencol1-15.20 { PRAGMA writable_schema=ON; REPLACE INTO t1 VALUES(9); SELECT a, quote(b) FROM t1 } {9 NULL} finish_test | > > > > > > > > > > > > > > > > > > > > > > > > | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 | | end c27.db }]} {} do_execsql_test gencol1-15.20 { PRAGMA writable_schema=ON; REPLACE INTO t1 VALUES(9); SELECT a, quote(b) FROM t1 } {9 NULL} # 2019-12-16 ticket 3b84b42943644d6f # When a table is the right table of a LEFT JOIN and the ON clause is # false, make sure any generated columns evaluate to NULL. reset_db do_execsql_test gencol1-16.10 { CREATE TABLE t0(c0); CREATE TABLE t1(c1, c2 AS(1)); INSERT INTO t0 VALUES(0); SELECT c0, c1, c2 FROM t0 LEFT JOIN t1; } {0 {} {}} do_execsql_test gencol1-16.20 { DROP TABLE t1; CREATE TABLE t1(c1, c2 AS (c1 ISNULL)); SELECT c0, c1, c2 FROM t0 LEFT JOIN t1; } {0 {} {}} do_execsql_test gencol1-16.30 { INSERT INTO t1(c1) VALUES(1),(NULL); SELECT * FROM t1; } {1 0 {} 1} do_execsql_test gencol1-16.40 { SELECT c0, c1, c2 FROM t0 LEFT JOIN t1 ON c0=c1; } {0 {} {}} finish_test |