1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

When the right table in a LEFT OUTER JOIN contains an INTEGER PRIMARY KEY

make sure that key is NULL if there is no row in the right table that
matches the current row in the left table.  Tickets #246 and #247. (CVS 873)

FossilOrigin-Name: 6a45fe3bd7e19cf9c20fc6cb65b0269cdd704490
This commit is contained in:
drh
2003-02-20 01:48:12 +00:00
parent e6da3c1816
commit 50cceb36b6
4 changed files with 36 additions and 10 deletions

View File

@ -12,7 +12,7 @@
#
# This file implements tests for joins, including outer joins.
#
# $Id: join.test,v 1.7 2002/10/27 19:35:35 drh Exp $
# $Id: join.test,v 1.8 2003/02/20 01:48:13 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -352,4 +352,29 @@ do_test join-6.8 {
} {1 2 3 2 3 4 2 3 4 3 4 5 3 4 5 {} {} {}}
# A test for ticket #247.
#
do_test join-7.1 {
execsql {
CREATE TABLE t7 (x, y);
INSERT INTO t7 VALUES ("pa1", 1);
INSERT INTO t7 VALUES ("pa2", NULL);
INSERT INTO t7 VALUES ("pa3", NULL);
INSERT INTO t7 VALUES ("pa4", 2);
INSERT INTO t7 VALUES ("pa30", 131);
INSERT INTO t7 VALUES ("pa31", 130);
INSERT INTO t7 VALUES ("pa28", NULL);
CREATE TABLE t8 (a integer primary key, b);
INSERT INTO t8 VALUES (1, "pa1");
INSERT INTO t8 VALUES (2, "pa4");
INSERT INTO t8 VALUES (3, NULL);
INSERT INTO t8 VALUES (4, NULL);
INSERT INTO t8 VALUES (130, "pa31");
INSERT INTO t8 VALUES (131, "pa30");
SELECT coalesce(t8.a,999) from t7 LEFT JOIN t8 on y=a;
}
} {1 999 999 2 131 130 999}
finish_test