pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Inconsistent time zone handling in timetz
2+ messages / 2 participants
[nested] [flat]

* Inconsistent time zone handling in timetz
@ 2026-11-18 10:56  miracee <sho@miracee.de>
  0 siblings, 1 reply; 2+ messages in thread

From: miracee @ 2026-11-18 10:56 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

Hi,

I came across this issue yesterday during one of my PostgreSQL training courses. We were using PostgreSQL 18.7.

I used PostgreSQL 17.9 to reproduce the issue.

# SELECT '10:00 CET'::timetz;

   timetz
-------------
 10:00:00+01
(1 row)

# SELECT '10:00 Europe/Berlin'::timetz;

ERROR: invalid input syntax for type time with time zone: "10:00 Europe/Berlin"
LINE 1: SELECT '10:00 Europe/Berlin'::timetz;

There is another issue with timetz.

The session time zone is set to UTC:

# SHOW timezone;

 TimeZone
----------
 Etc/UTC

With timestamptz, both time zone specifications work correctly:

# SELECT '2026-11-17 10:00 CET'::timestamptz;

      timestamptz
------------------------
 2026-11-17 09:00:00+00

# SELECT '2026-11-17 10:00 Europe/Berlin'::timestamptz;

      timestamptz
------------------------
 2026-11-17 09:00:00+00

However, with timetz:

# SELECT '10:00 CET'::timetz;

   timetz
-------------
 10:00:00+01
(1 row)

I would expect 09:00:00+00 rather than 10:00:00+01, as the session time zone is set to UTC.

Best regards,

miracee (Susanne)










^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Inconsistent time zone handling in timetz
@ 2026-11-18 18:10  Tom Lane <tgl@sss.pgh.pa.us>
  parent: miracee <sho@miracee.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2026-11-18 18:10 UTC (permalink / raw)
  To: miracee <sho@miracee.de>; +Cc: pgsql-bugs@lists.postgresql.org

miracee <sho@miracee.de> writes:
> # SELECT '10:00 CET'::timetz;

>    timetz
> -------------
>  10:00:00+01
> (1 row)

> # SELECT '10:00 Europe/Berlin'::timetz;

> ERROR: invalid input syntax for type time with time zone: "10:00 Europe/Berlin"
> LINE 1: SELECT '10:00 Europe/Berlin'::timetz;

This is documented, no? [1]

    ... You can also specify a date but it will be ignored, except when
    you use a time zone name that involves a daylight-savings rule,
    such as America/New_York. In this case specifying the date is
    required in order to determine whether standard or
    daylight-savings time applies. The appropriate time zone offset is
    recorded in the time with time zone value and is output as stored;
    it is not adjusted to the active time zone.

I'd agree that the error message is pretty nonspecific :-(.  However,
the view this project takes is that timetz is a type with little if
any real-world use, so we're unlikely to put much effort into making
it more user-friendly.

			regards, tom lane

[1] https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-DATETIME-INPUT-TIMES






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-11-18 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 10:56 Inconsistent time zone handling in timetz miracee <sho@miracee.de>
2026-11-18 18:10 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox