SQLite

Artifact [a12c51a2]
Login

Artifact a12c51a20c2cfac820ad7e37cc67e315c9873252:

Ticket change [a12c51a2] - New ticket [d6b36be3] Sub-select in LIMIT clause may access db without locks.. by dan 2012-12-07 18:57:01.
D 2012-12-07T18:57:01.421
J comment When\sSQLite\sprocesses\sa\sSELECT\sstatement\sfor\swhich\sthe\sFROM\sclause\scontains\sa\r\nsingle\ssub-select\sthat\sis\snot\seligible\sfor\sthe\sflattening\soptimization,\sit\r\ncreates\sa\sco-routine\sthat\sreturns\sone\srow\seach\stime\sit\sis\sinvoked\sto\r\nimplement\sthe\ssub-select.\r\n\r\nThe\svdbe\scode\sis:\r\n\r\n\s\s\s*\sJump\sto\sstart\sof\smain\sroutine,\r\n\s\s\s*\sBody\sof\sco-routine,\r\n\s\s\s*\sMain\sroutine\s(invokes\ssub-routine).\r\n\s\s\s*\sVerifyCookie\sroutine.\r\n\r\nBecause\sof\sthe\sway\sthe\sSQL\scompiler\sworks,\sthe\sVerifyCookie\sroutine\sis\r\ncurrently\sbeing\sinvoked\sthe\sfirst\stime\sthe\sco-routine\sis\sinvoked,\snot\sby\sthe\r\nstart\sof\sthe\smain\sroutine.\sIf\sthe\smain\sroutine\sattempts\sto\saccess\sthe\sdatabase\r\nbefore\sthe\sco-routine\sis\sinvoked,\sthen\sit\sis\san\serror.\sThis\smay\soccur\sif\seither\r\nthe\sLIMIT\sor\sthe\sOFFSET\sexpression\sof\sthe\smain\sSELECT\sare\sthemselves\r\nsub-selects\sthat\saccess\sthe\sdatabase.\sFor\sexample:\r\n\r\n<verbatim>\r\n\s\sCREATE\sTABLE\sabc(a,\sb,\sc);\r\n\s\sCREATE\sTABLE\sdef(a,\sb,\sc);\r\n\r\n\s\sSELECT\s*\sFROM\s(SELECT\s*\sFROM\sdef\sLIMIT\s1\sOFFSET\s1)\sLIMIT\s(SELECT\s20\sFROM\sabc)\r\n</verbatim>
J detected Stress_Testing
J foundin trunk
J severity Critical
J status Open
J subsystem Code_Generator
J title Sub-select\sin\sLIMIT\sclause\smay\saccess\sdb\swithout\slocks.
J type Code_Defect
K d6b36be38a06c0525731e6357125e6a35ecc4b79
U dan
Z 9a6e9671a6f341c1a0f6445129f71c81