Bug #1144 regexp fails when using nested functions
Submitted: 26 Aug 2003 9:41 Modified: 27 Aug 2003 2:31
Reporter: Edward Leafe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:MySQL 4.1.0-alpha-standard-log OS:Linux (RH Linux 8.0)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[26 Aug 2003 9:41] Edward Leafe
Description:
Queries that worked in 3.23 now fail in 4.1alpha. The defining characteristic seems to be nesting 
two or more functions around the string to use to match against the regexp.

How to repeat:
Run the following query in 3.23 and 4.1a:

select trim(upper('foo'))  regexp ('^foo$') as trimUpper,
upper('foo')  regexp ('^foo$') as justUpper,
trim('foo')  regexp ('^foo$') as justTrim,
trim(upper('foo'))  as trimUpperFoo,
upper('foo')  as upperFoo,
trim('foo')  as trimFoo ;

	Using 3.23, I get:

+-----------+-----------+----------+--------------+----------+---------+
| trimUpper | justUpper | justTrim | trimUpperFoo | upperFoo | trimFoo |
+-----------+-----------+----------+--------------+----------+---------+
|         1 |         1 |        1 | FOO          | FOO      | foo     |
+-----------+-----------+----------+--------------+----------+---------+
1 row in set (0.37 sec)

	Running this under 4.1a, I get:

+-----------+-----------+----------+--------------+----------+---------+
| trimUpper | justUpper | justTrim | trimUpperFoo | upperFoo | trimFoo |
+-----------+-----------+----------+--------------+----------+---------+
|         0 |         1 |        1 | FOO          | FOO      | foo     |
+-----------+-----------+----------+--------------+----------+---------+
 1 row in set (0.00 sec)
[27 Aug 2003 2:30] Ramil Kalimullin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

using the latest 4.1 source tree I've got
the proper result 
(query select trim(upper('foo'))  regexp ('^foo$');)