/ Artifact [a444fa6b]
Login

Artifact a444fa6b9bb777649d9ce5698f3fad0eb800551c:

Ticket change [a444fa6b] - New ticket [4c86b126] Incorrect query result with SQLITE_ENABLE_STAT4. by drh 2014-02-10 22:46:11.
D 2014-02-10T22:46:11.766
J foundin 3.8.3
J icomment When\sSQLite\sis\scompiled\susing\sSQLITE_ENABLE_STAT3\sor\sSQLITE_ENABLE_STAT4,\sit\r\ngets\sthe\swrong\sanswer\sfor\sthe\sfirst\sof\sthe\stwo\squeries\sbelow:\r\n\r\n<blockquote><verbatim>\r\nCREATE\sTABLE\snodes(\r\n\s\s\slocal_relpath\s\sTEXT\sPRIMARY\sKEY,\r\n\s\s\smoved_to\s\sTEXT\r\n);\r\nINSERT\sINTO\snodes\sVALUES('A',NULL);\r\nINSERT\sINTO\snodes\sVALUES('A/B',NULL);\r\nINSERT\sINTO\snodes\sVALUES('',NULL);\r\nINSERT\sINTO\snodes\sVALUES('A/B/C-move',NULL);\r\nINSERT\sINTO\snodes\sVALUES('A/B/C','A/B/C-move');\r\nINSERT\sINTO\snodes\sVALUES('A/B-move',NULL);\r\nINSERT\sINTO\snodes\sVALUES('A/B-move/C-move',NULL);\r\nINSERT\sINTO\snodes\sVALUES('A/B-move/C','x');\r\n\r\nSELECT\slocal_relpath,\smoved_to\r\n\sFROM\snodes\r\nWHERE\s(local_relpath\s=\s'A/B'\sOR\s((local_relpath\s>\s'A/B/')\sAND\s(local_relpath\s<\s'A/B0')))\r\n\s\sAND\smoved_to\sIS\sNOT\sNULL;\r\n\r\n.print\s------------------------------------------------\r\n\r\nSELECT\slocal_relpath,\smoved_to\r\n\sFROM\snodes\r\nWHERE\s(+local_relpath\s=\s'A/B'\sOR\s((local_relpath\s>\s'A/B/')\sAND\s(local_relpath\s<\s'A/B0')))\r\n\s\sAND\smoved_to\sIS\sNOT\sNULL;\r\n</verbatim></blockquote>\r\n\r\nThe\sbug\sappears\sto\shave\sbeen\sinserted\sinto\strunk\swith\sthe\sSTAT4\schanges\r\nof\scheck-in\s[a32af0abe5fa6d]\swhich\soccurred\sjust\safter\sthe\srelease\sof\r\n3.8.0.\s\sThe\sbug\sfirst\sappeared\sin\s3.8.1.\r\n\r\nNote\sthat\sit\sis\snot\snecessary\sto\srun\r\nANALYZE\sor\sto\shave\ssqlite_stat3\sor\ssqlite_stat4\stables\sin\sthe\sdatabase.\r\nThe\sonly\srequirement\sis\sto\scompile\swith\sSQLITE_ENABLE_STAT3\sor\r\nSQLITE_ENABLE_STAT4.\s\s\r\n\r\nThe\sextra\sunary\s"+"\soperator\sin\sthe\ssecond\squeries\sdisable\sthe\sOR\soptimization\r\nand\senables\sthe\ssecond\squery\sto\sget\sthe\scorrect\sanswer\sregardless.\r\n\r\nThis\sbug\swas\sdiscovered\sin\sthe\swild\sby\sthe\sSVN\sdevelopers.
J login drh
J mimetype text/x-fossil-wiki
J severity Critical
J status Open
J title Incorrect\squery\sresult\swith\sSQLITE_ENABLE_STAT4
J type Code_Defect
K 4c86b126f22ad548fee0125337bdc9366912d9ac
U drh
Z bd329429f75faa94a31ddc6b8f947103