Order By查询忽略标点符号 [英] Order By query ignores punctuation marks

查看:61
本文介绍了Order By查询忽略标点符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是与Postgresql一起使用的.

This is with Postgresql.

表中的一列包含带标点的字符串值.值为"aac",.aaa","aa_b"等.当按order by子句指定此列时,结果的顺序几乎是随机的.以句点开头的字符串应出现在顶部,但不会发生.它们出现在中间的某个地方.

A column in a table contains string values with punctuations. The values are "aac", ".aaa", "aa_b", etc. When this column is specified in order by clause, the order of results is almost random. The strings starting with a period should appear at the top, which doesn't happen. They appear somewhere in the middle.

令人惊讶的是,只有一个数据库可以看到此行为.相同的查询可以在其他主机上的数据库上正常工作.

Surprisingly, this behavior is seen with only one database. The same query works fine on database on other host.

这可能是什么原因?

推荐答案

排序依据"(字符串比较)行为取决于

The "order by" (string comparison) behaviour depends on the cluster's locale.

这篇关于Order By查询忽略标点符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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