Bug #957 "select" query that containing in "where field" char "space", - result invalid

Submitted: 30 Jul 2003 8:20 Modified: 30 Jul 2003 10:19
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.012 OS:FreeBSD (FreeBSD5.0)
Assigned to: CPU Architecture:Any

[30 Jul 2003 8:20] [ name withheld ]
Description:
"select" query that containing char "space", executing search of result on value UP TO a space char not including him

Example: 
create table `Table` (`Field` varchar(20) not null);
insert into `Table` set `Field` = 'Hello';
insert into `Table` set `Field` = 'World';

select `Field` from `Table` where `Field` = 'Hello    ';
+-------+
| Field |
+-------+
| Hello |
+-------+
1 row in set (0.00 sec)

When table contain lot of fields and rows will be possible this:
select `Field` from `Table` where `Field` = 'Hello World';
+-------+
| Field |
+-------+
| Hello |
+-------+
1 row in set (0.00 sec)

How to repeat:
Probably problem in comparing strings
[30 Jul 2003 10:19] Indrek Siitan
The first one is completely expected behaviour - in such search, the trailing
spaces are stripped, so it's equivalent to:

  select `Field` from `Table` where `Field` = 'Hello';

The second case will not happen.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.047 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.