collation

“Illegal mix of collations” error from MySql while running rails test suite

你离开我真会死。 提交于 2019-12-21 12:55:07
问题 I've recently dusted off an old Ruby on Rails project of mine. In the past, I've never had any problems getting all the tests to pass, but now there is one test that gives me the following error: ActiveRecord::StatementInvalid: Mysql::Error: #HY000Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=': SELECT * FROM cards WHERE (cards.l1_description = '是' AND cards.l2_word = '') So I go to my test db and ask: mysql> use flashcard_test Reading

How I can obtain the collation of a specific table in a database?

心已入冬 提交于 2019-12-21 12:18:16
问题 How I can obtain the collation of a specific table in a database? Is it possible that a table have different collation in db? 回答1: Collation at the table level is on a per column basis, so it is possible to have a collation different than the database. If the collation is not defined at the column level, it defaults to the database collation setting. SQL Server 2000: SELECT c.name, c.collation FROM SYSCOLUMNS c WHERE [id] = OBJECT_ID('your_table_name') SQL Server 2005+: SELECT c.name, c

How to change the connection collation of Mysql

做~自己de王妃 提交于 2019-12-21 04:24:08
问题 How can I change connection collation of mysql database? I am using Mysql workbench 5.5 and mysql 5.5 in ubuntu 14. When I execute a stored procedure, an error occurs: Error Code: 1267. Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation '=' I have search though the internet, which has a temp solution that is to amend COLLATE utf8_unicode_ci; in the stored procedure. But I want to fix this problem for all stored procedures in the future. I have

Add case insensitive collation to PostgreSQL

…衆ロ難τιáo~ 提交于 2019-12-21 03:42:47
问题 By default, PostgreSQL comes without case insensitive collations. Its documentation describes a way to add new collations based on OS locales, e.g.: http://www.postgresql.org/docs/9.1/static/sql-createcollation.html however the created collations are case sensitive. My question is: How to add a case INsensitive collation to a PostgreSQL server ? Can somebody describe a workflow ? I was not able to find any references on the net, while some people mention that it is possible. I've tested with

What .NET StringComparer is equivalent SQL's Latin1_General_CI_AS

筅森魡賤 提交于 2019-12-20 18:10:34
问题 I am implementing a caching layer between my database and my C# code. The idea is to cache the results of certain DB queries based on the parameters to the query. The database is using the default collation - either SQL_Latin1_General_CP1_CI_AS or Latin1_General_CI_AS , which I believe based on some brief googling are equivalent for equality, just different for sorting. I need a .NET StringComparer that can give me the same behavior, at least for equality testing and hashcode generation, as

Why is ' 2' > '10'?

↘锁芯ラ 提交于 2019-12-20 17:29:34
问题 Why is ' 2' with an initial space bigger than '10'? select ' 2' > '10'; ?column? ---------- t (1 row) I tried it with both latin1 and utf8 english collations: List of databases Name | Owner | Encoding | Collation | Ctype | Access privileges -----------+------------+-----------+------------------+------------------+----------------------- cpn | cpn | UTF8 | en_US.UTF-8 | en_US.UTF-8 | teste | cpn | LATIN1 | en_US.ISO-8859-1 | en_US.ISO-8859-1 | I know it has to do with the type because when it

Is there any way to sort strings in all languages?

自古美人都是妖i 提交于 2019-12-20 12:22:04
问题 I have this code. It sorts correctly in French and Russian. I used Locale.US and it seems to be right. Is this solution do right with all languages out there? Does it work with other languages? For example: Chinese, Korean, Japanese... If not, what is the better solution? public class CollationTest { public static void main(final String[] args) { final Collator collator = Collator.getInstance(Locale.US); final SortedSet<String> set = new TreeSet<String>(collator); set.add("abîmer"); set.add(

Unix sort treatment of underscore character

我与影子孤独终老i 提交于 2019-12-20 12:07:05
问题 I have two linux machines, on which unix sort seems to behave differently. I believe I've narrowed it down to the treatment of the underscore character. If I run sort tmp , where tmp contains the following two lines: aa_d_hh aa_dh_ey one machine outputs aa_d_hh aa_dh_ey (i.e. '_' precedes 'h') while the other outputs aa_dh_ey aa_d_hh (i.e. 'h' precedes '_'). I need these machines to behave together (as I use sort -m later, to merge very large files). Is there any way I can force sort to

Temp Table collation conflict - Error : Cannot resolve the collation conflict between Latin1* and SQL_Latin1*

情到浓时终转凉″ 提交于 2019-12-20 10:24:02
问题 I can't update temp table. This is my query CREATE TABLE #temp_po(IndentID INT, OIndentDetailID INT, OD1 VARCHAR(50), OD2 VARCHAR(50), OD3 VARCHAR(50), ORD VARCHAR(50), NIndentDetailID INT, ND1 VARCHAR(50), ND2 VARCHAR(50), ND3 VARCHAR(50), NRD VARCHAR(50), Quantity DECIMAL(15,3)) INSERT INTO #temp_po(IndentID, OIndentDetailID, OD1, OD2, OD3, ORD) SELECT ID.IndentID, ID.IndentDetailID, ID.D1, ID.D2, ID.D3, ID.RandomDimension FROM STR_IndentDetail ID WHERE ID.IndentID = @IndentID UPDATE t SET

PHPMyAdmin forces to use ut8mb4 as default collation

大城市里の小女人 提交于 2019-12-20 04:48:34
问题 Ok, so I've spent the morning trying to change the default collation on my XAMPP setup. Here's the problem: I'm using Format() in a view, to convert a double into a string CREATE VIEW `test` AS SELECT Format(some_data_table.double_number,0) AS string_result FROM some_data_table; When I look at the returned column, its showing as utf8mb4_general_ci. I've tried all manner of settings in my.ini and phpMyAdmin's config.inc.php to no avail. As a last resort, I'm prepared to add the collation