Skip to content

Commit d22a6ac

Browse files
add test
1 parent 881841f commit d22a6ac

File tree

1 file changed

+17
-0
lines changed
  • tests/integration/test_storage_postgresql

1 file changed

+17
-0
lines changed

tests/integration/test_storage_postgresql/test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,23 @@ def _create_and_fill_table(table):
869869
cursor.execute(f'DROP TABLE "{table}\'"')
870870

871871

872+
def test_postgres_datetime(started_cluster):
873+
cursor = started_cluster.postgres_conn.cursor()
874+
cursor.execute(f"DROP TABLE IF EXISTS test_datetime")
875+
cursor.execute("CREATE TABLE test_datetime AS (SELECT '2025-01-02 03:04:05.678900'::timestamptz AS ts, '2025-01-02'::date as d)")
876+
877+
node1.query("DROP TABLE IF EXISTS test_datetime")
878+
node1.query(
879+
f"CREATE TABLE test_datetime (ts DateTime64(6, 'UTC'), d Date) ENGINE = PostgreSQL('postgres1:5432', 'postgres', 'test_datetime', 'postgres', '{pg_pass}')"
880+
)
881+
882+
result = node1.query("SELECT ts FROM test_datetime WHERE ts > '2025-01-01'::DateTime")
883+
assert result == "2025-01-02 03:04:05.678900\n"
884+
885+
result = node1.query("SELECT ts FROM test_datetime WHERE ts > '2025-01-01'::DateTime64")
886+
assert result == "2025-01-02 03:04:05.678900\n"
887+
888+
872889
if __name__ == "__main__":
873890
cluster.start()
874891
input("Cluster created, press any key to destroy...")

0 commit comments

Comments
 (0)