[Bug 424067] New: MySQL ignores ORDER BY when query has GROUP BY primary key
https://bugzilla.novell.com/show_bug.cgi?id=424067 Summary: MySQL ignores ORDER BY when query has GROUP BY primary key Product: openSUSE 11.0 Version: Final Platform: Other OS/Version: Other Status: NEW Severity: Major Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: suse-beta@cboltz.de QAContact: qa@suse.de Found By: --- After migrating a typo3 website to a server with openSUSE 11.0, I noticed that the news feed shows the oldest instead of the newest news :-( After some googling, I found out that this is a known problem with MySQL 5.0.51, see http://www.typo3.net/index.php?id=13&action=list_post&tid=71875&page=1 SELECT tt_news.* FROM tt_news WHERE tt_news.pid IN (2) AND 1=1 AND tt_news.sys_language_uid IN (0,-1) AND tt_news.deleted=0 AND tt_news.t3ver_state<=0 AND tt_news.hidden=0 AND (tt_news.starttime<=1220715540) AND (tt_news.endtime=0 OR tt_news.endtime>1220715540) AND (tt_news.fe_group='' OR tt_news.fe_group IS NULL OR tt_news.fe_group='0' OR (tt_news.fe_group LIKE '%,0,%' OR tt_news.fe_group LIKE '0,%' OR tt_news.fe_group LIKE '%,0' OR tt_news.fe_group='0') OR (tt_news.fe_group LIKE '%,-1,%' OR tt_news.fe_group LIKE '-1,%' OR tt_news.fe_group LIKE '%,-1' OR tt_news.fe_group='-1')) GROUP BY tt_news.uid ORDER BY datetime DESC This query gives the same result and order when replacing "DESC" with "ASC". The bug is still reproducable with the following simplified query: SELECT tt_news.* FROM tt_news GROUP BY tt_news.uid ORDER BY datetime DESC # or ASC ------------------------------------------------------------------------------- So far, so good. But I don't expect you to do a typo3 installation just to find a MySQL bug ;-) I narrowed down the problem to a simple test table: CREATE TABLE `grouporder` ( `i` int(11) NOT NULL, `x` int(11) NOT NULL, PRIMARY KEY (`i`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `grouporder` (`i`, `x`) VALUES (1, 1), (2, 2); SELECT * FROM grouporder GROUP BY i ORDER BY x ASC -> Result: 1, 2 SELECT * FROM grouporder GROUP BY i ORDER BY x DESC -> Result: 1, 2 BTW: i must be defined as _primary key_ or _unique key_ to make this bug happen. It does not happen when I drop the primary key and create a "normal" index on the `i` column. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=424067 User suse-beta@cboltz.de added comment https://bugzilla.novell.com/show_bug.cgi?id=424067#c1 --- Comment #1 from Christian Boltz <suse-beta@cboltz.de> 2008-09-06 10:27:07 MDT --- After some more searching, I found out that this is already fixed upstream: - http://bugs.mysql.com/bug.php?id=32202 - http://lists.mysql.com/commits/37447 Can you please prepare an online update to fix this? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=424067 Christian Boltz <suse-beta@cboltz.de> changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|bnc-team-screening@forge.provo.novell.com |mmarek@novell.com -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=424067 User mmarek@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=424067#c2 Michal Marek <mmarek@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #2 from Michal Marek <mmarek@novell.com> 2008-09-08 05:30:24 MDT --- server:database has a fixed 5.0.67. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=424067 Michal Marek <mmarek@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 - None |P4 - Low -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=424067 User mmarek@novell.com added comment https://bugzilla.novell.com/show_bug.cgi?id=424067#c3 Michal Marek <mmarek@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #3 from Michal Marek <mmarek@novell.com> 2008-09-17 08:57:50 MDT --- Will be in next update. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=424067 User suse-beta@cboltz.de added comment https://bugzilla.novell.com/show_bug.cgi?id=424067#c4 --- Comment #4 from Christian Boltz <suse-beta@cboltz.de> 2008-09-20 02:42:44 MDT --- Good to know, thanks. Two questions: - do you have any timeframe when the update will be released? - in case I use the package from server:database, can I easily switch back to the "official" update when it is released or will I hit problems (like a changed on-disk format)? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=424067 User suse-beta@cboltz.de added comment https://bugzilla.novell.com/show_bug.cgi?id=424067#c5 Christian Boltz <suse-beta@cboltz.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |VERIFIED --- Comment #5 from Christian Boltz <suse-beta@cboltz.de> 2009-03-08 14:10:35 MST --- VERIFIED in 11.1 final -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com