From 7fdab046b56b051c86090e07bd169e9c430b71fa Mon Sep 17 00:00:00 2001 From: kssenii Date: Mon, 29 Mar 2021 14:25:15 +0000 Subject: [PATCH] Add test for cyrillic + varchar(n) from issue --- .../integration/test_odbc_interaction/test.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_odbc_interaction/test.py b/tests/integration/test_odbc_interaction/test.py index d563a9346d5..61b2e56ea9e 100644 --- a/tests/integration/test_odbc_interaction/test.py +++ b/tests/integration/test_odbc_interaction/test.py @@ -386,7 +386,7 @@ def test_odbc_postgres_date_data_type(started_cluster): def test_odbc_postgres_conversions(started_cluster): - conn = get_postgres_conn(); + conn = get_postgres_conn() cursor = conn.cursor() cursor.execute( @@ -424,3 +424,30 @@ def test_odbc_postgres_conversions(started_cluster): cursor.execute("DROP TABLE IF EXISTS clickhouse.test_types") assert(result == expected) + +def test_odbc_cyrillic_with_varchar(started_cluster): + conn = get_postgres_conn() + cursor = conn.cursor() + + cursor.execute("DROP TABLE IF EXISTS clickhouse.test_cyrillic") + cursor.execute("CREATE TABLE clickhouse.test_cyrillic (name varchar(11))") + + node1.query(''' + CREATE TABLE test_cyrillic (name String) + ENGINE = ODBC('DSN=postgresql_odbc; Servername=postgre-sql.local', 'clickhouse', 'test_cyrillic')''') + + cursor.execute("INSERT INTO clickhouse.test_cyrillic VALUES ('A-nice-word')") + cursor.execute("INSERT INTO clickhouse.test_cyrillic VALUES ('Красивенько')") + + result = node1.query(''' SELECT * FROM test_cyrillic ORDER BY name''') + + assert(result == 'A-nice-word\nКрасивенько\n') + + node1.query(''' INSERT INTO TABLE FUNCTION + odbc('DSN=postgresql_odbc; Servername=postgre-sql.local', 'clickhouse', 'test_cyrillic') + VALUES ('Красивенько')''') + + result = node1.query(''' + SELECT name FROM odbc('DSN=postgresql_odbc; Servername=postgre-sql.local', 'clickhouse', 'test_cyrillic') ''') + assert(result == 'A-nice-word\nКрасивенько\nКрасивенько\n') +