From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
Cc: | Paul McGarry <paul(at)paulmcgarry(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output. |
Date: | 2019-09-24 19:44:32 |
Message-ID: | 91469459-36f7-41a4-09e9-c88d693cccef@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 9/23/19 7:40 PM, Andrew Gierth wrote:
>>>>>> "Adrian" == Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
>
> Adrian> This has come up before and the general suggestion has been to
> Adrian> have a column for a naive(timestamp w/o tz) timestamp and a
> Adrian> column for the timezone.
>
> No, that's usually (not always) backwards, and in any event wouldn't
> solve this particular issue.
>
The issue is unclear so I am not sure you can discount this as a
solution. The OP had:
CREATE TABLE users (
user_id biginit,
user_timezone text, -- Eg 'Australia/Sydney','Asia/Hong_Kong'
);
CREATE TABLE data (
id bigint,
user_id bigint,
datetime timestamp with time zone,
);
INSERT INTO users (1,'Australia/Sydney');
INSERT INTO users (2,'Asia/Hong_Kong');
INSERT INTO data (5,1,'2020-04-05 02:00:00');
INSERT INTO data (6,2,'2020-04-05 02:00:00');
and:
"Therefore whatever renders the offset needs to be capable of doing it
per row, independently of the server/session time zone."
There is no indication of what the server timezone is set to or where
the timestamps being assigned to date.datetime are coming from. Do they
originate as local time(per user) or are they being generated server side?
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Paul McGarry | 2019-09-25 00:12:17 | Re: How to get timezone offset in timestamp with time zone AT TIME ZONE output. |
Previous Message | Kevin Brannen | 2019-09-24 19:42:21 | RE: can't install pg 12 beta on centos 6 |