I don't have internet access at home, also the mysqlbug script could not send
the mail automaticaly, but have edited the output and included it as
attachement.
and once again:
there is a problem with 'select distinct' in some case (distinct+join+order by)
the problem is to see in attached file mysqldistinctbug.script, there are some
comment and output from me.
it is posible to run
mysql -vvv test <mysqldistinctbug.script
but first look in the file, as you know what to expected
tested on:
server version: 3.23.32-log
binary distribution from original mysql web site
-rw-r--r-- 1 root 5714323 Jan 22 14:08 MySQL-3.23.32-1.i386.rpm
-rw-r--r-- 1 root 1377767 Jan 22 15:23 MySQL-client-3.23.32-1.i386.rpm
-rw-r--r-- 1 root 628156 Jan 22 15:23 MySQL-devel-3.23.32-1.i386.rpm
-rw-r--r-- 1 root 228747 Jan 22 15:23 MySQL-shared-3.23.32-1.i386.rpm
platform PC, amd k6-2, 128MB RAM
RedHat Linux 7.0
for libraries version see rpm -qa (attached)
kernel 2.4.0
/etc/my.cnf attached
--
[EMAIL PROTECTED] http://sorry.vse.cz/~xrihp01/speccy
======================================================================
# Example mysql config file.
# You can copy this to one of:
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# One can use all long options that the program supports.
# Run the program with --help to get a list of available options
# This will be passed to all mysql clients
[client]
#password = my_password
port = 3306
socket = /var/lib/mysql/mysql.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# The MySQL server
[mysqld]
language=czech
user=mysql
skip-networking
port = 3306
socket = /var/lib/mysql/mysql.sock
datadir = /mnt/data/mysql
#pid-file = /var/lib/mysql/mysqld.pid
skip-locking
#neresolvuj jmena, nech IP
skip-name-resolve
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = thread_stack=128K
set-variable = wait_timeout=300
# Start logging
#log #logovani pristupu a dotazu
log-update = /var/log/mysql/mysql_update_log
[mysqldump]
quick
set-variable = max_allowed_packet=16M
[mysql]
#no-auto-rehash
[isamchk]
set-variable = key_buffer=16M
SEND-PR: -*- send-pr -*-
SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
SEND-PR: will all comments (text enclosed in `<' and `>').
SEND-PR:
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: bug in DISTINCT & JOIN & ORDER BY
>Description:
in some case (see my example), 'select distinct' doesn't work!
it must be:
select distinct
join
order by other_col_then_selected
I have see this problem on older version of MySQL and Linux too, but not
documented
>How-To-Repeat:
I have prepared a example, see my file mysqldistinctbug.script
there are some comment, but the SQL say all ;) I hope
There are (as comments) results from me and my status comments (OK|BAD)
>Fix:
make distinct from last result, not from grouped row (from order by) ??
>Submitter-Id: <submitter ID>
>Originator: Pavel Riha
>Organization:
<organization of PR author (multiple lines)>
>MySQL support: none
>Synopsis: problem with distinct when join and order by is used
>Severity: non-critical
>Priority: medium
>Category: mysql
>Class: sw-bug
>Release: mysql-3.23.32 (Official MySQL RPM)
>Server: /usr/bin/mysqladmin Ver 8.14 Distrib 3.23.32, for pc-linux-gnu on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license
Server version 3.23.32-log
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 8 hours 15 min 26 sec
Threads: 1 Questions: 1355 Slow queries: 0 Opens: 104 Flush tables: 1 Open
tables: 60 Queries per second avg: 0.046
>Environment:
amd k6-2 400MHz
128MB RAM
RH linux 7.0
rpm -qa (see attachement)
System: Linux wotrok.doma.cz 2.4.0-3 #3 Fri Jan 26 21:41:30 CET 2001 i586 unknown
Architecture: i586
Some paths: /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.0)
Compilation info: CC='egcs' CFLAGS='-O6 -fomit-frame-pointer -mpentium' CXX='egcs'
CXXFLAGS='-O6 -fomit-frame-pointer -felide-constructors
-fno-exceptions -fno-rtti -mpentium' LDFLAGS=''
LIBC:
lrwxrwxrwx 1 root root 14 Oct 28 11:28 /lib/libc.so.6 ->
libc-2.1.92.so
-rwxr-xr-x 1 root root 4686077 Aug 30 23:17 /lib/libc-2.1.92.so
-rw-r--r-- 1 root root 22607104 Aug 30 23:15 /usr/lib/libc.a
-rw-r--r-- 1 root root 178 Aug 30 23:15 /usr/lib/libc.so
Configure command: ./configure --disable-shared --with-mysqld-ldflags=-all-static
--with-client-ldflags=-all-static --enable-assembler --with-mysqld-user=mysql
--with-unix-socket-path=/var/lib/mysql/mysql.sock --prefix=/
--with-extra-charsets=complex --exec-prefix=/usr --libexecdir=/usr/sbin
--sysconfdir=/etc --datadir=/usr/share --localstatedir=/var/lib/mysql
--infodir=/usr/info --includedir=/usr/include --mandir=/usr/man --without-berkeley-db
'--with-comment=Official MySQL RPM'
#first the tables A and B and it's data:
drop table if exists a,b;
# MySQL dump 8.12
#
# Host: localhost Database: test
#--------------------------------------------------------
# Server version 3.23.32-log
#
# Table structure for table 'a'
#
CREATE TABLE a (
id int(11) NOT NULL auto_increment,
text char(30) default NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Dumping data for table 'a'
#
INSERT INTO a VALUES (1,'aaa');
INSERT INTO a VALUES (2,'aaa');
#
# Table structure for table 'b'
#
CREATE TABLE b (
id int(11) NOT NULL auto_increment,
id_a int(11) default NULL,
x char(30) default NULL,
PRIMARY KEY (id)
) TYPE=MyISAM;
#
# Dumping data for table 'b'
#
INSERT INTO b VALUES (1,1,'bbb');
INSERT INTO b VALUES (2,1,'bbb');
INSERT INTO b VALUES (3,2,'bbb');
INSERT INTO b VALUES (4,2,'bbb');
#==================end of dump=====================
#now the queries:
#1. (OK)
select text, x from a,b where a.id=b.id_a;
#+------+------+
#| text | x |
#+------+------+
#| aaa | bbb |
#| aaa | bbb |
#| aaa | bbb |
#| aaa | bbb |
#+------+------+
#2. (OK)
select distinct text, x from a,b where a.id=b.id_a;
#+------+------+
#| text | x |
#+------+------+
#| aaa | bbb |
#+------+------+
#3. (OK)
select distinct text, x from a,b where a.id=b.id_a order by a.text;
#+------+------+
#| text | x |
#+------+------+
#| aaa | bbb |
#+------+------+
#4. (!!! BAD !!!) ORDER BY A.ID
select distinct text, x from a,b where a.id=b.id_a order by a.id;
#+------+------+
#| text | x |
#+------+------+
#| aaa | bbb |
#| aaa | bbb |
#+------+------+
#5. (!!! BAD !!!) ORDER BY B.ID_A
select distinct text, x from a,b where a.id=b.id_a order by b.id_a;
#+------+------+
#| text | x |
#+------+------+
#| aaa | bbb |
#| aaa | bbb |
#+------+------+
#6. (!!! BAD !!!) ORDER BY B.ID
select distinct text, x from a,b where a.id=b.id_a order by b.id;
#+------+------+
#| text | x |
#+------+------+
#| aaa | bbb |
#| aaa | bbb |
#| aaa | bbb |
#| aaa | bbb |
#+------+------+
#7. (!!! BAD !!!) ORDER BY B.ID
select distinct text from a,b where a.id=b.id_a order by b.id;
#+------+
#| text |
#+------+
#| aaa |
#| aaa |
#| aaa |
#| aaa |
#+------+
#8. (!!! BAD !!!) ORDER BY A.ID
select distinct text from a,b where a.id=b.id_a order by a.id;
#+------+
#| text |
#+------+
#| aaa |
#| aaa |
#+------+
#9. (OK) single table
select distinct text from a order by a.id;
#+------+
#| text |
#+------+
#| aaa |
#+------+
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php