【发布时间】:2017-11-04 04:48:08
【问题描述】:
我发现 PostgreSQL 类似于 operator 的工作有点奇怪。我不小心在下面的查询中检查了空间,但对结果感到惊讶。
select 'Device Reprocessing' similar to '%( )%' --return true
select 'Device Reprocessing' similar to '%()%' --return true
select 'DeviceReprocessing' similar to '%()%' --return true
为什么第二个和第三个查询返回 true?空模式总是返回 true 吗?
我对 SIMILAR TO 运算符的理解是根据其模式是否与给定字符串匹配返回 true 或 false。
【问题讨论】:
-
使用
SIMILAR TO没有意义。曾经。我改用LIKE或正则表达式。 stackoverflow.com/questions/12452395/…
标签: postgresql