我试图创建一个简单的视图,但我得到了错误,因为该视图是用拉丁1而不是utf8创建的。
视图如下所示:
create or replace view
my_view
as
select * from my_table
group by some_field
collate utf8_unicode_ci
;
我得到的错误是:
COLLATION 'utf8_unicode_ci' is not valid for CHARACTER SET 'latin1'
我做的是检查多个配置选项:
全球的
show variables like "%char%";
character_set_client,utf8
character_set_connection,utf8
character_set_database,utf8
character_set_filesystem,binary
character_set_results,utf8
character_set_server,utf8
character_set_system,utf8
用于创建视图的表:
SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, TABLE_COLLATION
FROM INFORMATION_SCHEMA.TABLES
where TABLE_NAME in ('my_table');
;
def,my_database,my_table,utf8_unicode_ci
该表的列:
SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLLATION_NAME
FROM INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME in ('my_table');
def,my_database,my_table,id,null
def,my_database,my_table,active,null
def,my_database,my_table,title,utf8_unicode_ci
暂无答案!
目前还没有任何答案,快来回答吧!