Re: Add support for AT LOCAL

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: Add support for AT LOCAL
Дата
Msg-id ef0aa5f1-8ea6-088c-3a3a-5804c12f79b1@postgresfriends.org
обсуждение исходный текст
Ответ на Re: Add support for AT LOCAL  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: Add support for AT LOCAL  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-hackers
On 6/6/23 03:56, Laurenz Albe wrote:
> On Mon, 2023-06-05 at 23:13 -0400, Vik Fearing wrote:
>> The Standard defines time zone conversion as follows:
>>
>> <datetime factor> ::=
>>     <datetime primary> [ <time zone> ]
>>
>> <time zone> ::=
>>     AT <time zone specifier>
>>
>> <time zone specifier> ::=
>>       LOCAL
>>     | TIME ZONE <interval primary>
>>
>>
>> While looking at something else, I noticed we do not support AT LOCAL.
>> The local time zone is defined as that of *the session*, not the server,
>> which can make this quite interesting in views where the view will
>> automatically adjust to the session's time zone.
>>
>> Patch against 3f1aaaa180 attached.
> 
> +1 on the idea; it should be faily trivial, if not very useful.

Thanks.

> At a quick glance, it looks like you resolve "timezone" at the time
> the query is parsed.  Shouldn't the resolution happen at query
> execution time?

current_setting(text) is stable, and my tests show that it is calculated 
at execution time.


postgres=# prepare x as values (now() at local);
PREPARE
postgres=# set timezone to 'UTC';
SET
postgres=# execute x;
           column1
----------------------------
  2023-06-06 08:23:02.088634
(1 row)

postgres=# set timezone to 'Asia/Pyongyang';
SET
postgres=# execute x;
           column1
----------------------------
  2023-06-06 17:23:14.837219
(1 row)


Am I missing something?
-- 
Vik Fearing




В списке pgsql-hackers по дате отправления:

Предыдущее
От: 謝東霖
Дата:
Сообщение: Re: Improve join_search_one_level readibilty (one line change)
Следующее
От: Alexander Lakhin
Дата:
Сообщение: Re: TRAP: FailedAssertion("prev_first_lsn < cur_txn->first_lsn", File: "reorderbuffer.c", Line: 927, PID: 568639)