SUBSTRING_INDEX()结果“忽略";在LOWER()中使用时的字符 [英] SUBSTRING_INDEX() results "omit" character when used inside LOWER()

查看:217
本文介绍了SUBSTRING_INDEX()结果“忽略";在LOWER()中使用时的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MySQL中发现了一个非常奇怪的错误,该错误已在此处报告:

I found a very strange bug in MySQL that i've reported here:

错误#60166

  • 谁能向我确认这是一个错误,而不是了解MySQL如何工作的问题?( Valeriy Kravchuk :谢谢您的错误报告.已验证就像描述的一样)
  • 此错误的原因是什么?
  • 除了我在错误报告中所描述的以外,是否还有其他人可以提供一些建议来解决此问题?
  • 尽管 Bug#45549 ,我会非常非常感谢!
  • Can anyone confirm to me that this is a bug, and not an understanding problem of how work MySQL? (Valeriy Kravchuk: Thank you for the bug report. Verified just as described)
  • What is the reason of this bug???
  • Is there anybody to provide some advice to solve this issue other than that I described in the bug report?
  • And if somebody can help me to install MySQL UDF on Windows with MySQL 5.5.8 despites the Bug #45549, I'll will be very gratefull!

无论如何,关于错误#42404 ,似乎SUBSTRING_INDEX()会有非常奇怪的行为.

Anyway, in regard of the Bug #42404, SUBSTRING_INDEX() seems to have a very strange behavior.

在此先感谢您的帮助!

在这里,我已经在错误报告中给出了可能的解决方案:

建议的修补程序:

  • 使用:

  • Use:

mysql> SELECT SUBSTRING_INDEX(LOWER(@user_at_host), '@', -1);

mysql> SELECT SUBSTRING_INDEX(LOWER(@user_at_host), '@', -1);

代替:

mysql> SELECT LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1));

mysql> SELECT LOWER(SUBSTRING_INDEX(@user_at_host, '@', -1));

避免使用此错误功能(请参阅已存在一年以上的错误) #42404 ),并且:

Avoid using of this buggy function (see the more than one year old bug #42404), and:

  • Use preg_* UDF from http://www.mysqludf.org/ But for now,This solution is unavailable on Windows / Mysql 5.5.8 because of the 8 month old bug #45549

推荐答案

select substring_index(lower(@user_at_host), '@', -1);

select lower(substring(@user_at_host, locate('@', @user_at_host)+1));

这篇关于SUBSTRING_INDEX()结果“忽略";在LOWER()中使用时的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆