|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Gregor Kling (gregor.kling
dvz.fh-giessen.de)
Date: Thu Oct 28 2010 - 09:43:16 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 10/28/2010 03:34 PM, misiaQ wrote:
> Works fine on 5.0.87 (rows returned as expected).
>
> Confirmed on 5.1.51-log.
>
> Most likely problem with VARCHAR behavior, because this one works fine:
> select * from test_nkomp_admin where host_id=6 and trim(admin_id)='luke';
>
The thing with the varchar was also my first guess, what could be wrong
after dumping the database.
So I tested it like this (just to be sure not having whitespaces in the
data):
mysql> select * into outfile "/tmp/out.txt" fields enclosed by "'" from
test_nkomp_admin where host_id=6;
Query OK, 2 rows affected (0.00 sec)
shell> cat /tmp/out.txt
'6' 'luke'
'6' 'yoda'
yes, this one works also for me.
And this one:
mysql> select * from test_nkomp_admin where host_id=6 and admin_id like
'luke%';
+---------+----------+
| host_id | admin_id |
+---------+----------+
| 6 | luke |
+---------+----------+
1 row in set (0.00 sec)
And this one:
mysql> select * from test_nkomp_admin where host_id=6 and admin_id like
'%luke';
+---------+----------+
| host_id | admin_id |
+---------+----------+
| 6 | luke |
+---------+----------+
1 row in set (0.00 sec)
But not this one:
mysql> select * from test_nkomp_admin where host_id=6 and admin_id like
'luke';
Empty set (0.00 sec)
So I guess, I should bag a bugreport ...
cheers
gregor
> Regards,
> m
>
> -----Original Message-----
> From: gregor kling [mailto:gregor.kling
dvz.fh-giessen.de]
> Sent: Thursday, October 28, 2010 1:54 PM
> To: mysql
lists.mysql.com
> Subject: strange behavior in mysql-server 5.1.49 and 5.1.51
>
> Hello list,
> I fight a strange behavior in mysql versions 5.1.49 and 5.1.51 -
> maybe a fight against myself ;-)
>
> The following query works exactly as assumed in version 5.1.41 with
> the given testbed:
> select * from test_nkomp_admin where host_id=6 and admin_id="yoda";
>
> /* version 5.1.41 ubuntu 10.04 */
> mysql> select * from test_nkomp_admin where host_id=6 and
> admin_id="yoda" ;
> +---------+----------+
> | host_id | admin_id |
> +---------+----------+
> | 6 | yoda |
> +---------+----------+
> 1 row in set (0.00 sec)
>
> whereas in versions 5.1.49 (ubuntu 10.10) and 5.1.51 (package from
> debian experimental,os ubuntu 10.10) the resultset is:
> mysql> select * from test_nkomp_admin where host_id=6 and
> admin_id="yoda" ;
> Empty set (0.00 sec)
>
> prove:
> select * from test_nkomp_admin where host_id=6 ;
> +---------+----------+
> | host_id | admin_id |
> +---------+----------+
> | 6 | luke |
> | 6 | yoda |
> +---------+----------+
> 2 rows in set (0.00 sec)
>
> Could anyone prove this behavior, or can give hint what the problem
> might be ?
>
>
> /* testbed */
> drop table if exists test_nkomp_admin;
> drop table if exists test_nkomp;
> drop table if exists test_admin;
>
> create table test_nkomp
> (
> host_id int unsigned auto_increment not null primary key
> )engine=innodb;
>
> create table test_admin
> (
> admin_id varchar(15) not null primary key
> )engine=innodb;
>
> create table test_nkomp_admin
> (
> host_id int unsigned,
> admin_id varchar(15),
> foreign key (host_id) references test_nkomp (host_id) on delete
> cascade on update cascade,
> foreign key (admin_id) references test_admin (admin_id) on delete
> cascade on update cascade
>
> )engine=innodb;
>
> insert into test_nkomp (host_id) values (1),(2),(3),(4),(5),(6);
>
> insert into test_admin (admin_id) values
> ('luke'),('yoda'),('anakin'),('leia'),('r2'),('obi'),('han');
>
> insert into test_nkomp_admin (host_id,admin_id) values
> (1,'luke'),(1,'yoda'),(1,'anakin'),(1,'leia'),(1,'r2'),(1,'obi'),(1,'han');
>
> insert into test_nkomp_admin (host_id,admin_id) values
> (2,'luke'),(2,'yoda'),(2,'anakin'),(2,'leia'),(2,'r2'),(2,'obi');
>
> insert into test_nkomp_admin (host_id,admin_id) values
> (3,'luke'),(3,'yoda'),(3,'anakin'),(3,'leia'),(3,'r2');
>
> insert into test_nkomp_admin (host_id,admin_id) values
> (4,'luke'),(4,'yoda'),(4,'anakin'),(4,'leia');
>
> insert into test_nkomp_admin (host_id,admin_id) values
> (5,'luke'),(5,'yoda'),(5,'anakin');
>
> insert into test_nkomp_admin (host_id,admin_id) values
> (6,'luke'),(6,'yoda');
>
> cheers
> gregor
>
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]