我发现PostgreSQL类似于运营商的作品有点奇怪。我不小心检查了下面查询中的空间,但对结果感到惊讶。PostgreSQL类似于运营商行为
select 'Device Reprocessing' similar to '%()%' --return true select 'Device Reprocessing' similar to '%()%' --return true select 'DeviceReprocessing' similar to '%()%' --return true
为什么第2和第3个查询返回true?空模式总是返回true吗?
我对SIMILAR TO操作符的理解是返回true或false,取决于它的模式是否与给定的字符串匹配。
有使用'相似TO'没有意义的。永远。我使用'LIKE'或正则表达式代替。 https://stackoverflow.com/questions/12452395/difference-between-like-and-in-postgres/12459689#12459689 –