Merge pull request #20712 from kssenii/add-test

Add test for already fixed odbc Postgres date type conversion
This commit is contained in:
Kruglov Pavel 2021-02-18 13:43:17 +03:00 committed by GitHub
commit 419962dbfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -342,3 +342,25 @@ def test_bridge_dies_with_parent(started_cluster):
assert clickhouse_pid is None
assert bridge_pid is None
def test_odbc_postgres_date_data_type(started_cluster):
conn = get_postgres_conn();
cursor = conn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS clickhouse.test_date (column1 integer, column2 date)")
cursor.execute("INSERT INTO clickhouse.test_date VALUES (1, '2020-12-01')")
cursor.execute("INSERT INTO clickhouse.test_date VALUES (2, '2020-12-02')")
cursor.execute("INSERT INTO clickhouse.test_date VALUES (3, '2020-12-03')")
conn.commit()
node1.query(
'''
CREATE TABLE test_date (column1 UInt64, column2 Date)
ENGINE=ODBC('DSN=postgresql_odbc; Servername=postgre-sql.local', 'clickhouse', 'test_date')''')
expected = '1\t2020-12-01\n2\t2020-12-02\n3\t2020-12-03\n'
result = node1.query('SELECT * FROM test_date');
assert(result == expected)