Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGo8B-0002xk-9n for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 16:09:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGo88-00027G-Vy for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 16:09:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGo87-000276-QM for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 16:09:20 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGo81-0003IL-5v for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 16:09:19 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3C5F020D6E; Thu, 10 May 2018 12:09:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 10 May 2018 12:09:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=relops.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=FBKmDCS3oio4zXAKiBKwY3k4bC EJ2KIcf9hNyLytPEY=; b=DEKblSHcsrKv+LSUz7o7soXsiCanSHbtUsSk/JTD84 gHw3DwR4i9dRGvKNc1yIEWFdtgYkbJgiUOlQnbJ8EScsnJ+Q6q3p8Sm0lWrt2j1i Ef/WCZ8vlyM0YqS4cTS+XIUSC/QxdAPP3au5kVeWhERmBWPsMe3fVtyRK7rTyuUj k= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=FBKmDC S3oio4zXAKiBKwY3k4bCEJ2KIcf9hNyLytPEY=; b=mgGeLuJTAOmvtgJftAog2k 2qHQsS7pPnWGpUARs0rd5dCBdB5IadjLP27z5Wis9kDHPHf9t6J7iXw07UQC74Zx Nn9gLMLqBdtTAD5oJXqMMZQ0dlyyVacL/Iu1jOLke90gp8t2qi660iGxXPL6omtj hs1/iRjaMovIKMJ3jH4uVesdpdtMojexZ90zxbpApo4FZeAXWfdMVr7qCbWDyBqN djMjvAZ6wicT7QSsFH5OS/5rBqyh9bkHisfp+Bk/4Wzan8LKIfNZrn4gtKAQ6UDw XFdxp+dzPniQs6UdVjGIrH+2eIn9Ga7yt7O3o7cstbvSTXNOBi0c0CDcAW/SkyLQ == X-ME-Sender: Received: from [192.168.15.94] (unknown [161.12.41.14]) by mail.messagingengine.com (Postfix) with ESMTPA id 8A6FFE44F3 for ; Thu, 10 May 2018 12:09:10 -0400 (EDT) From: Ben Hood Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: Domain based on TIMEZONE WITH TIME ZONE Date: Thu, 10 May 2018 17:09:08 +0100 References: <06EAD729-DC35-4E48-AB25-C42F7FA19C28@relops.com> <188A0270-0A9A-4ADE-A928-9067E99AE7B7@relops.com> <20180510103608.GB3622@hermes.hilbert.loc> To: pgsql-general@lists.postgresql.org In-Reply-To: Message-Id: <5188949D-FEDD-45C6-85CA-2E2AAC5CF1C9@relops.com> X-Mailer: Apple Mail (2.3445.6.18) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On 10 May 2018, at 14:41, Adrian Klaver = wrote: >> OK, so by using TIMESTAMP WITH TIME ZONE, you force all apps to = submit timezone qualified timestamps in what language they are written = in. >=20 > Not really: >=20 > https://www.postgresql.org/docs/10/static/datatype-datetime.html >=20 > "For timestamp with time zone, the internally stored value is always = in UTC (Universal Coordinated Time, traditionally known as Greenwich = Mean Time, GMT). An input value that has an explicit time zone specified = is converted to UTC using the appropriate offset for that time zone. If = no time zone is stated in the input string, then it is assumed to be in = the time zone indicated by the system's TimeZone parameter, and is = converted to UTC using the offset for the timezone zone.=E2=80=9D Many thanks for this clarification. So therefore you can=E2=80=99t rely = on the TIMESTAMP WITH TIME ZONE forcing the app to explicitly specify = the offset. This is is because if the app is not specific, then the = server will default back to its configured timezone. So to get deterministic timestamps, you could either: a) make sure the server is always configured to run in UTC; b) issue SET TIME ZONE =E2=80=98UTC=E2=80=99; at the beginning of any = application session=20 >=20 >>> After all, it is always converted to UTC >>> servside anyway ? >> And because of the internal UTC representation, there is no room for = ambiguous timezones. >=20 > Define ambiguous timezone? What I meant to say that is there should be no possibility for an = effective timezone to arise implicitly. For example, if you (1) didn=E2=80=99t control the db server config and (2) and you forgot to enforce UTC at a client driver level and (3) didn=E2=80=99t set the offset in the app session Then the only way to know what the effective zone offset will be is to = find out what the server default is. Is this plausible?