SQLite

Artifact [1ef35260]
Login

Artifact 1ef35260c9e915837167ad06e6debaeee6d5433d:

Ticket change [1ef35260] - Fixed ticket [d06a25c8]: Incorrect result from a UNION with an ORDER BY plus 6 other changes by drh 2016-02-09 14:12:17.
D 2016-02-09T14:12:17.638
J icomment The\sproblem\swas\stwo\sco-routines\susing\sthe\ssame\stemporary\sregisters\sand\r\nexpecting\sthose\stemporary\sregisters\sto\sbe\spreserved\sacross\sa\sYield.\s\sThe\r\nsolution\sis\sto\sensure\sthat\severy\sco-routine\shas\sits\sown\sset\sof\stemporary\r\nregisters\sthat\sare\snot\sshared\swith\sthe\smain\sthread\sor\sother\sco-routines.\r\n\r\nIn\sthe\sdemonstration\squery\sshown\sin\sthe\sproblem\sdescription,\seach\sSELECT\r\nstatement\sis\sevaluated\sby\sa\sseparate\sco-routine\sthat\sincludes\san\sORDER\sBY.\r\nThe\smain\sthread\shandles\sthe\sUNION\sby\srunning\seach\sco-routine\slong\senough\r\nto\sgenerate\sa\ssingle\srow,\sthen\schoosing\sthe\ssmaller\sof\sthe\stwo\r\nrows\sto\soutput\sand\srunning\sthe\scorresponding\sco-routine\sto\sgenerate\sthe\r\nnext\srow\sfor\sthat\sSELECT.\s\sEach\sco-routine\sevaluates\sits\squery\sas\sa\snested\r\nloop\swith\st0\sbeing\sthe\souter\sloop\sand\st1\sbeing\sthe\sinner\sloop.\s\sThe\st0.a\r\nand\st0.b\svalues\sare\sstored\sin\stemporary\sregisters\sin\sthe\souter\sloop,\sand\r\nthose\svalue\sare\sexpected\sto\sremain\sintact\seven\sthough\sa\sYield\soccurs\safter\r\neach\siteration\sof\sthe\sinner\sloop.\s\sPrior\sto\sthe\sfix\sof\r\ncheck-in\s[ca72be8618e5d466]\sboth\sco-routines\swere\susing\sthe\ssame\stemporary\r\nregisters\sfor\stheir\st0.a\sand\st0.b\svalues,\swhich\smeans\sthat\srunning\sone\r\nco-routine\swould\sdisrupt\sthe\sother.\s\sAfter\scheck-in\s[ca72be8618e5d466]\sthe\r\ntwo\sco-routines\suse\sdifferent\stemporary\sregisters\sfor\sholding\st0.a\sand\r\nt0.b\sso\sthey\sno\slonger\sinterfere\swith\sone\sanother.
J login drh
J mimetype text/x-fossil-wiki
J priority Immediate
J resolution Fixed
J status Fixed
J subsystem Code_Generator
K d06a25c84454a372be4e4c970c3c4d4363197219
U drh
Z 3135337e6fdb8450c6db11091dfcbd89