This commit is contained in:
kssenii 2022-02-25 16:04:11 +01:00
parent c39efd8006
commit 92d2cff045
3 changed files with 10 additions and 4 deletions

View File

@ -149,8 +149,6 @@ void ODBCSource::insertValue(
DateTime64 time = 0; DateTime64 time = 0;
const auto * datetime_type = assert_cast<const DataTypeDateTime64 *>(data_type.get()); const auto * datetime_type = assert_cast<const DataTypeDateTime64 *>(data_type.get());
readDateTime64Text(time, datetime_type->getScale(), in, datetime_type->getTimeZone()); readDateTime64Text(time, datetime_type->getScale(), in, datetime_type->getTimeZone());
if (time < 0)
time = 0;
assert_cast<DataTypeDateTime64::ColumnType &>(column).insertValue(time); assert_cast<DataTypeDateTime64::ColumnType &>(column).insertValue(time);
break; break;
} }

View File

@ -108,8 +108,6 @@ void insertPostgreSQLValue(
ReadBufferFromString in(value); ReadBufferFromString in(value);
DateTime64 time = 0; DateTime64 time = 0;
readDateTime64Text(time, 6, in, assert_cast<const DataTypeDateTime64 *>(data_type.get())->getTimeZone()); readDateTime64Text(time, 6, in, assert_cast<const DataTypeDateTime64 *>(data_type.get())->getTimeZone());
if (time < 0)
time = 0;
assert_cast<DataTypeDateTime64::ColumnType &>(column).insertValue(time); assert_cast<DataTypeDateTime64::ColumnType &>(column).insertValue(time);
break; break;
} }

View File

@ -447,6 +447,16 @@ def test_where_false(started_cluster):
cursor.execute("DROP TABLE test") cursor.execute("DROP TABLE test")
def test_datetime64(started_cluster):
cursor = started_cluster.postgres_conn.cursor()
cursor.execute("drop table if exists test")
cursor.execute("create table test (ts timestamp)")
cursor.execute("insert into test select '1960-01-01 20:00:00';")
result = node1.query("select * from postgresql(postgres1, table='test')")
assert(result.strip() == '1960-01-01 20:00:00.000000')
if __name__ == '__main__': if __name__ == '__main__':
cluster.start() cluster.start()
input("Cluster created, press any key to destroy...") input("Cluster created, press any key to destroy...")