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 1r49zz-007cTn-Tf for pgsql-jdbc@arkaria.postgresql.org; Sat, 18 Nov 2023 01:19:51 +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 1r49zw-00H792-0r for pgsql-jdbc@arkaria.postgresql.org; Sat, 18 Nov 2023 01:19:48 +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 1r49zv-00H78u-NS for pgsql-jdbc@lists.postgresql.org; Sat, 18 Nov 2023 01:19:47 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r49zo-006zNK-Li for pgsql-jdbc@lists.postgresql.org; Sat, 18 Nov 2023 01:19:47 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-54553e4888bso3638654a12.2 for ; Fri, 17 Nov 2023 17:19:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700270378; x=1700875178; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=ay/CwlFlx9VcfR5w7pLv/RMrVkuueqf4iXNfd8gU3F0=; b=TORmMiyuLfsMdeTK6VU65k6Zj9aIHFDUxw4LOf5HQxzsF8KudqRGlI4Hi9jGIk9nIe AjBHrs0+drOo73A2dI+wDBLV99SOAWYv2rLPoJEDbWL2+tE81FwILIwvF3wAFf8fN94P 6QHmGcPXbCMbYvH2ZM5sL1vNBMB/ETPBSzz1YRxyvLKjsFKwGNMfOHDOdIRXeL73bk87 WzAJWMAd/RevyVN3JrlVlDEEDWic/7k1mcJtQDllDirOiBEdL1Rv17zq6NbpAUE2kxQG WpBpwpv1GAZT/eBiJlcZxaaOj6oT4T39jxf/mvSvNkTgYNsNpXiUB4HwFn5LjPrIg5VH 4C5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700270378; x=1700875178; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ay/CwlFlx9VcfR5w7pLv/RMrVkuueqf4iXNfd8gU3F0=; b=i9dLpwLGwlueVY3Nk9FCxaGGP9QVc/Nrq7Fn2BKTscd92/H39B3/chVSjLmrProg0Q m2QOflnZCve+J9u9PK9gv8eYN1QA/03L70/oXfFhxgk7JgYfewKJrfgl3kOwgVGsE95j PLB3SsFbVWmOaG8M86/y6w5/Sl2wxDOYMQ3rj/OlrwfE+jwO3OZ+PNHknjsJ8ukRKWGi rqOE52a7sk7wTfZDb1qOaJZtKeSMUGwSCgpxTdkinDri83w4JyT/mEGDUReonJSXf4M0 UFQAqQYhhavhiVkhak84oFhptpSPd4UsS47/Vvbunnd6zjUCsj3M/0vvwhl+k2spOtok gBkw== X-Gm-Message-State: AOJu0YytEtAHftQdS2grb57AYb0a8agoWQwMyUQP+vpwgIN8eYS0Js1M B/6PdxCxIvVSvbTTU+i8GTRlb+3Hv9ebG2Q0gz0PRyUemGc= X-Google-Smtp-Source: AGHT+IHwS88+gVeEL/lP+Wuq66j8WnoEfg4wkyTyRS6npFpjQJO4D4jiuHGObE3BYxhB4JACOFqoWWyfr8B4T+DaK10= X-Received: by 2002:a05:6402:1a54:b0:543:7f7d:4a3f with SMTP id bf20-20020a0564021a5400b005437f7d4a3fmr505539edb.30.1700270377812; Fri, 17 Nov 2023 17:19:37 -0800 (PST) MIME-Version: 1.0 From: Ben Horowitz Date: Fri, 17 Nov 2023 17:19:26 -0800 Message-ID: Subject: Mapping of timestamptz to TIMESTAMP vs. TIMESTAMP_WITH_TIMEZONE To: pgsql-jdbc@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000e44673060a630b84" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e44673060a630b84 Content-Type: text/plain; charset="UTF-8" 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 --000000000000e44673060a630b84 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

Apologies if this is a d= uplicate 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=C2=A0timestamp= tz is getting mapped to the type java.sql.Types.TIMESTAMP [1] . It seems li= ke it should be mapped to java.sql.Types.TIMESTAMP_WITH_TIMEZONE.

<= /div>
TIMESTAMP_WITH_TIMEZONE was introduced in Java 8 (2014). Is the m= apping of timestamptz to TIMESTAMP intentional for reasons of backwards com= patibility?

I found the behavior surprising, and a= lso found a question on Stack Overflow where someone else was surprised [2]= .

Thanks very much,
Ben
--000000000000e44673060a630b84--