Skip to content

TimeZone configuration is set per connection, not the system as documented #2315

Description

@era127

The TimeZone configuration setting is documented to be for the database system but I have replicated an example in both the rust and Julia api where the TimeZone configuration setting is per connection, not the database. In the example below I update the configuration setting in on connection to demonstrate the change, but a new connection does not use that setting.

If the TimeZone configuration setting is expected to be set per connection and not the database, then maybe we could add something to the documentation to explain that detail. Thanks.

using DuckDB
db = DuckDB.DB()
DuckDB.execute(db, "LOAD icu;")
con = DuckDB.connect(db)

# demonstrate the change in behavior of make_timestamptz when the timezone is set
println(DuckDB.execute(con, "SELECT make_timestamptz(2000,01,20,03,30,59)")) # "2000-01-20T08:30:59"
println(DuckDB.execute(con, "SET TimeZone = 'UTC'"))
println(DuckDB.execute(con, "SELECT make_timestamptz(2000,01,20,03,30,59)")) # "2000-01-20T03:30:59"

# The second connection does not use the timezone that was previously set for the system.
con2 = DuckDB.connect(db)
println(DuckDB.execute(con2, "SELECT make_timestamptz(2000,01,20,03,30,59)")) # "2000-01-20T08:30:59"

Metadata

Metadata

Assignees

No one assigned

    Labels

    datetimedate / time / datetime / icu-related issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions