Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ EXT_CONFIG=${PROJ_DIR}extension_config.cmake
# Include the Makefile from extension-ci-tools
include extension-ci-tools/makefiles/duckdb_extension.Makefile

# Single-timezone model (PGTZ-style): the extension's LoadInternal forces
# both MEOS (meos_initialize_timezone) and DuckDB (DBConfig::SetOptionByName
# "TimeZone") to Europe/Brussels. Tests pass on any OS timezone β€” the
# extension is the single source of truth, no TZ env var needed.
test_release_internal:
./build/release/$(TEST_PATH) "$(PROJ_DIR)test/*"
TZ=UTC ./build/release/$(TEST_PATH) "$(PROJ_DIR)test/*"
test_debug_internal:
./build/debug/$(TEST_PATH) "$(PROJ_DIR)test/*"
TZ=UTC ./build/debug/$(TEST_PATH) "$(PROJ_DIR)test/*"
test_reldebug_internal:
./build/reldebug/$(TEST_PATH) "$(PROJ_DIR)test/*"
TZ=UTC ./build/reldebug/$(TEST_PATH) "$(PROJ_DIR)test/*"
155 changes: 0 additions & 155 deletions scripts/update_test_expected.py

This file was deleted.

14 changes: 0 additions & 14 deletions src/mobilityduck_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,23 +217,9 @@ static void LoadInternal(ExtensionLoader &loader) {
static std::once_flag meos_init_flag;
std::call_once(meos_init_flag, []() {
meos_initialize();
/* Set the MEOS timezone to Europe/Brussels so that all temporal-type
* text I/O uses a consistent, named timezone on every platform.
* Brussels is a non-UTC zone that surfaces bugs hidden by UTC (e.g.
* off-by-one-hour errors in timestamp handling). */
meos_initialize_timezone("Europe/Brussels");
meos_initialize_error_handler(&MobilityduckMeosErrorHandler);
});

// Single-timezone model: ensure DuckDB's session timezone matches the
// MEOS timezone so bare TIMESTAMPTZ display agrees with MEOS composite
// type strings. Auto-load ICU (without it, the test framework keeps
// session timezone at UTC) and set the TimeZone option to Brussels.
auto &db = loader.GetDatabaseInstance();
ExtensionHelper::AutoLoadExtension(db, "icu");
auto &config = DBConfig::GetConfig(db);
config.SetOptionByName("TimeZone", Value("Europe/Brussels"));


// Register scalar function: mobilityduck_openssl_version
auto mobilityduck_openssl_version_scalar_function =
Expand Down
6 changes: 3 additions & 3 deletions test/sql/parity/001_set.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SELECT dateset '{2000-01-01, 2000-01-02, 2000-01-03}';
query I
SELECT tstzset '{2000-01-01, 2000-01-02, 2000-01-03}';
----
{"2000-01-01 00:00:00+01", "2000-01-02 00:00:00+01", "2000-01-03 00:00:00+01"}
{"2000-01-01 00:00:00+00", "2000-01-02 00:00:00+00", "2000-01-03 00:00:00+00"}

# --- parse errors ---

Expand Down Expand Up @@ -82,12 +82,12 @@ SELECT set(ARRAY [date '2000-01-01', '2000-01-01', '2000-01-03']);
query I
SELECT set(ARRAY [timestamptz '2000-01-01', '2000-01-02', '2000-01-03']);
----
{"2000-01-01 00:00:00+01", "2000-01-02 00:00:00+01", "2000-01-03 00:00:00+01"}
{"2000-01-01 00:00:00+00", "2000-01-02 00:00:00+00", "2000-01-03 00:00:00+00"}

query I
SELECT set(ARRAY [timestamptz '2000-01-01', '2000-01-01', '2000-01-03']);
----
{"2000-01-01 00:00:00+01", "2000-01-03 00:00:00+01"}
{"2000-01-01 00:00:00+00", "2000-01-03 00:00:00+00"}

# --- empty array should error ---
# MobilityDB writes this as set('{}'::timestamptz[]); DuckDB rejects
Expand Down
4 changes: 2 additions & 2 deletions test/sql/parity/003_span.test
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ cannot be negative
query I
SELECT span(timestamptz '2000-01-01', '2000-01-02');
----
[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01)
[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00)

query I
SELECT span(timestamptz '2000-01-01', '2000-01-01', true, true);
----
[2000-01-01 00:00:00+01, 2000-01-01 00:00:00+01]
[2000-01-01 00:00:00+00, 2000-01-01 00:00:00+00]

statement error
SELECT span(timestamptz '2000-01-01', '2000-01-01');
Expand Down
18 changes: 9 additions & 9 deletions test/sql/parity/007_spanset.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ SELECT datespanset '{[2000-01-01, 2000-01-02), [2000-01-03, 2000-01-04)}';
query I
SELECT tstzspanset '{[2000-01-01, 2000-01-02), [2000-01-03, 2000-01-04)}';
----
{[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01), [2000-01-03 00:00:00+01, 2000-01-04 00:00:00+01)}
{[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00), [2000-01-03 00:00:00+00, 2000-01-04 00:00:00+00)}

query I
SELECT tstzspanset '{[2000-01-01, 2000-01-02), [2000-01-02, 2000-01-03), [2000-01-03, 2000-01-04)}';
----
{[2000-01-01 00:00:00+01, 2000-01-04 00:00:00+01)}
{[2000-01-01 00:00:00+00, 2000-01-04 00:00:00+00)}

statement error
SELECT tstzspanset '2000-01-01, 2000-01-02';
Expand Down Expand Up @@ -89,7 +89,7 @@ SELECT spanset(ARRAY [datespan '[2000-01-01, 2000-01-02]', '[2000-01-03,2000-01-
query I
SELECT spanset(ARRAY [tstzspan '[2000-01-01, 2000-01-02]', '[2000-01-03,2000-01-04]']);
----
{[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01], [2000-01-03 00:00:00+01, 2000-01-04 00:00:00+01]}
{[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00], [2000-01-03 00:00:00+00, 2000-01-04 00:00:00+00]}

statement error
SELECT spanset(ARRAY [tstzspan '[2000-01-01, 2000-01-03]', '[2000-01-02,2000-01-04]']);
Expand Down Expand Up @@ -141,32 +141,32 @@ SELECT datespan '[2000-01-01,2000-01-02]'::datespanset;
query I
SELECT spanset(timestamptz '2000-01-01');
----
{[2000-01-01 00:00:00+01, 2000-01-01 00:00:00+01]}
{[2000-01-01 00:00:00+00, 2000-01-01 00:00:00+00]}

query I
SELECT spanset(tstzset '{2000-01-01,2000-01-02}');
----
{[2000-01-01 00:00:00+01, 2000-01-01 00:00:00+01], [2000-01-02 00:00:00+01, 2000-01-02 00:00:00+01]}
{[2000-01-01 00:00:00+00, 2000-01-01 00:00:00+00], [2000-01-02 00:00:00+00, 2000-01-02 00:00:00+00]}

query I
SELECT spanset(tstzspan '[2000-01-01,2000-01-02]');
----
{[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01]}
{[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00]}

query I
SELECT timestamptz '2000-01-01'::tstzspanset;
----
{[2000-01-01 00:00:00+01, 2000-01-01 00:00:00+01]}
{[2000-01-01 00:00:00+00, 2000-01-01 00:00:00+00]}

query I
SELECT tstzset '{2000-01-01,2000-01-02}'::tstzspanset;
----
{[2000-01-01 00:00:00+01, 2000-01-01 00:00:00+01], [2000-01-02 00:00:00+01, 2000-01-02 00:00:00+01]}
{[2000-01-01 00:00:00+00, 2000-01-01 00:00:00+00], [2000-01-02 00:00:00+00, 2000-01-02 00:00:00+00]}

query I
SELECT tstzspan '[2000-01-01,2000-01-02]'::tstzspanset;
----
{[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01]}
{[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00]}

mode skip
# intspanset -> floatspanset cast diverges: MobilityDuck normalizes
Expand Down
6 changes: 3 additions & 3 deletions test/sql/parity/009_time_ops.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ require mobilityduck
query I
SELECT tstzset '{2000-01-01}' + interval '1 day';
----
{"2000-01-02 00:00:00+01"}
{"2000-01-02 00:00:00+00"}

query I
SELECT tstzspan '[2000-01-01, 2000-01-02]' + interval '1 day';
----
[2000-01-02 00:00:00+01, 2000-01-03 00:00:00+01]
[2000-01-02 00:00:00+00, 2000-01-03 00:00:00+00]

# Time-difference distance

query I
SELECT timestamptz '2000-01-01' <-> tstzset '{2000-01-03}';
----
2 days
1 day 23:00:00

query I
SELECT tstzspan '[2000-01-01, 2000-01-02]' <-> tstzspan '[2000-01-04, 2000-01-05]';
Expand Down
12 changes: 6 additions & 6 deletions test/sql/parity/015_span_aggfuncs.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ query I
SELECT extent(temp) FROM (VALUES
(NULL::tstzspan),('[2000-01-01, 2000-01-02]'::tstzspan)) t(temp);
----
[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01]
[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00]

query I
SELECT extent(temp) FROM (VALUES
('[2000-01-01, 2000-01-02]'::tstzspan),(NULL::tstzspan)) t(temp);
----
[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01]
[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00]

query I
SELECT extent(temp) FROM (VALUES
Expand All @@ -40,13 +40,13 @@ query I
SELECT extent(temp) FROM (VALUES
(NULL::tstzspanset),('{[2000-01-01, 2000-01-02]}'::tstzspanset)) t(temp);
----
[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01]
[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00]

query I
SELECT extent(temp) FROM (VALUES
('{[2000-01-01, 2000-01-02]}'::tstzspanset),(NULL::tstzspanset)) t(temp);
----
[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01]
[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00]

# extent(<base>) β€” value-aggregate variants

Expand Down Expand Up @@ -120,10 +120,10 @@ query I
SELECT SetUnionAgg(t::tstzset)::VARCHAR FROM (VALUES
('{2000-01-01}'::tstzset)) t(t);
----
{"2000-01-01 00:00:00+01"}
{"2000-01-01 00:00:00+00"}

query I
SELECT SpanUnionAgg(t::tstzspan)::VARCHAR FROM (VALUES
('[2000-01-01, 2000-01-02]'::tstzspan)) t(t);
----
{[2000-01-01 00:00:00+01, 2000-01-02 00:00:00+01]}
{[2000-01-01 00:00:00+00, 2000-01-02 00:00:00+00]}
Loading
Loading