首页 > 数据库 > SQLite > 正文

SQLite 3.3.13 中执行查询时的BUG

2020-02-10 17:55:06
字体:
来源:转载
供稿:网友

Under latest release 3.3.13 query results in crash (used to run fine)

To create tables/data, run this:
  CREATE TABLE inmk(
cls TEXT,
sec INTEGER,
inst INTEGER
);
INSERT INTO inmk VALUES ('ORD', 2751, 2750);
CREATE TABLE clss(
hrar TEXT,
cls TEXT,
PRIMARY KEY (hrar, cls)
);
CREATE TABLE rels(
prnt_inst INTEGER,
chld_inst INTEGER
);

Then run this query:

  SELECT I.sec
FROM inmk I
LEFT JOIN
rels R ON R.prnt_inst = I.inst
LEFT JOIN
inmk UI ON UI.inst = R.chld_inst
LEFT JOIN
clss C1U ON C1U.cls = UI.cls AND C1U.hrar = 'STH'
LEFT JOIN
clss C10U ON C10U.hrar = c1u.hrar AND C10U.cls IN (C1U.cls)
WHERE I.sec = 2751;

The crash only happens in the latest 3.3.13 build.

Observations

If "C10U.cls IN (C1U.cls)" is replaced with "C10U.cls = C1U.cls", the query does not result in a crash but obviously this is not how the original query look like. In the original one, be it

   ...AND C10U.cls IN (C1U.cls, C2U.cls...)

or

  AND (C10U.cls = C1U.cls OR C10U.cls = C2U.cls...)

is immaterial and the crash still results.

The presence of the primary key in 'clss' table also seems to be important for the crash to occur.

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选