Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r563t-00Blm2-0V for pgsql-jdbc@arkaria.postgresql.org; Mon, 20 Nov 2023 15:19:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r563r-008wHn-Ei for pgsql-jdbc@arkaria.postgresql.org; Mon, 20 Nov 2023 15:19:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r563r-008wHf-71 for pgsql-jdbc@lists.postgresql.org; Mon, 20 Nov 2023 15:19:43 +0000 Received: from pgintl.fastcrypt.com ([149.56.129.164]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r563n-007ReM-RM for pgsql-jdbc@lists.postgresql.org; Mon, 20 Nov 2023 15:19:42 +0000 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by pgintl.fastcrypt.com (Postfix) with ESMTPSA id C1B8A20033 for ; Mon, 20 Nov 2023 10:19:36 -0500 (EST) Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-548f0b7ab11so84492a12.1 for ; Mon, 20 Nov 2023 07:19:36 -0800 (PST) X-Gm-Message-State: AOJu0YzIzWc1DeZ9SJtGuVa57nfl/x8P7Uwcb2jWrEljIi98M6bpa/Qb K+whme9vvmjMG15Q4ghhK97XqyNtQOPd7dI7sjs= X-Google-Smtp-Source: AGHT+IF6kskD29XhEtIVmGflWlwUeFVLYwsN6orpIwbphReeuq73kDq665i8vpsJ5csHoL0WvGc9HDLA8gHBjeOssWU= X-Received: by 2002:a05:6402:602:b0:53d:b839:2045 with SMTP id n2-20020a056402060200b0053db8392045mr5498825edv.25.1700493575807; Mon, 20 Nov 2023 07:19:35 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dave Cramer Date: Mon, 20 Nov 2023 10:19:19 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Mapping of timestamptz to TIMESTAMP vs. TIMESTAMP_WITH_TIMEZONE To: Ben Horowitz Cc: pgsql-jdbc@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000008769d9060a97033e" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000008769d9060a97033e Content-Type: text/plain; charset="UTF-8" Probably should be. Care to provide a Pull Request ? Dave Cramer www.postgres.rocks On Fri, 17 Nov 2023 at 20:19, Ben Horowitz wrote: > Hi, > > Apologies if this is a duplicate of an answered question. I searched in > the mailing list archives, Stack Overflow, etc., and didn't find anything. > > At the line linked below in TypeInfoCache, it appears that > type timestamptz is getting mapped to the type java.sql.Types.TIMESTAMP [1] > . It seems like it should be mapped to > java.sql.Types.TIMESTAMP_WITH_TIMEZONE. > > TIMESTAMP_WITH_TIMEZONE was introduced in Java 8 (2014). Is the mapping of > timestamptz to TIMESTAMP intentional for reasons of backwards compatibility? > > I found the behavior surprising, and also found a question on Stack > Overflow where someone else was surprised [2]. > > Thanks very much, > Ben > > [1] > https://github.com/pgjdbc/pgjdbc/blob/65f158ed8e06ffea77ca7f3b8413847817a7831f/pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java#L106 > > [2] > https://stackoverflow.com/questions/60451102/for-postgresql-resultsetmetadata-getcolumntype-function-returns-same-value-ty > --0000000000008769d9060a97033e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Probably should be. Care to provide a Pull Request ?
Dave Cramer
www.postgres.rocks


On Fri, 17 Nov 2023 at 20:19, Ben Horowitz <bhorowit@gmail.com> wrote:
= Hi,

Apologies if this is a duplicate of an answere= d question. I searched in the mailing list archives, Stack Overflow, etc., = and didn't find anything.

At the line linked below = in TypeInfoCache, it appears that type=C2=A0timestamptz is getting mapped t= o the type java.sql.Types.TIMESTAMP [1] . It seems like it should be mapped= to java.sql.Types.TIMESTAMP_WITH_TIMEZONE.

TIMESTAMP_WI= TH_TIMEZONE was introduced in Java 8 (2014). Is the mapping of timestamptz = to TIMESTAMP intentional for reasons of backwards compatibility?
=
I found the behavior surprising, and also found a question o= n Stack Overflow where someone else was surprised [2].

=
Thanks very much,
Ben


--0000000000008769d9060a97033e--