/ Artifact Content
Login

Artifact fc35a8b205d8e834b88322e2c79eb5e6d8b0b778:

Ticket change [fc35a8b2] - New ticket [f97c4637] Incorrect ordering with ORDER BY and LIMIT. by drh 2015-01-19 15:31:16.
D 2015-01-19T15:31:16.191
J foundin 3.8.8
J icomment The\sfollowing\sSQL\soutputs\srows\sin\sthe\sincorrect\sorder\sfor\sSQLite\r\nversions\s3.8.7\sand\s3.8.8:\r\n\r\n<blockquote><verbatim>\r\nCREATE\sTABLE\st1(x);\r\nINSERT\sINTO\st1(x)\sVALUES(1),(5),(3),(4),(2);\r\nSELECT\r\n\s\s\sx,\s01,\s02,\s03,\s04,\s05,\s06,\s07,\s08,\s09,\r\n\s\s10,\s11,\s12,\s13,\s14,\s15,\s16,\s17,\s18,\s19,\r\n\s\s20,\s21,\s22,\s23,\s24,\s25,\s26,\s27,\s28,\s29,\r\n\s\s30,\s31,\s32,\s33,\s34,\s35,\s36,\s37,\s38,\s39,\r\n\s\s40,\s41,\s42,\s43,\s44,\s45,\s46,\s47,\s48,\s49,\r\n\s\s50,\s51,\s52,\s53,\s54,\s55,\s56,\s57,\s58,\s59,\s60\r\nFROM\st1\r\nORDER\sBY\sx\r\nLIMIT\s-1;\r\n</verbatim></blockquote>\r\n\r\nIn\sorder\sto\shit\sthis\sbug,\sthere\smust\sbe\san\sORDER\sBY\sclause\sand\sa\sLIMIT\r\nclause\sand\sthe\snumber\sof\scolumns\sin\sthe\squery\splus\sthe\snumber\sof\ssort\r\nkeys\sneeds\sto\ssum\sto\sexactly\s62.\s\sAdding\sor\sremoving\sa\ssingle\scolumn\r\nfrom\sthe\sresult\sset\syields\sthe\scorrect\sanswer.\r\n\r\nThis\sbug\sfirst\sappeared\sin\scheck-in\s[b1c0f0bc1bd8a]\swhich\sis\swhen\sthe\r\nmulti-threaded\ssorter\swas\sintroduced.
J login drh
J mimetype text/x-fossil-wiki
J severity Severe
J status Open
J title Incorrect\sordering\swith\sORDER\sBY\sand\sLIMIT
J type Code_Defect
K f97c4637102a3ae72b7911167e1d4da12ce60722
U drh
Z 61d0cd70f239c2e570fb0f01dc207b6e