Re: Domain based on TIMEZONE WITH TIME ZONE

Поиск
Список
Период
Сортировка
От Ben Hood
Тема Re: Domain based on TIMEZONE WITH TIME ZONE
Дата
Msg-id D03AF820-9FFF-414F-8747-B3589FBB9224@relops.com
обсуждение исходный текст
Ответ на Re: Domain based on TIMEZONE WITH TIME ZONE  (Francisco Olarte <folarte@peoplecall.com>)
Ответы Re: Domain based on TIMEZONE WITH TIME ZONE  ("Peter J. Holzer" <hjp-pgsql@hjp.at>)
Re: Domain based on TIMEZONE WITH TIME ZONE  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Domain based on TIMEZONE WITH TIME ZONE  (Francisco Olarte <folarte@peoplecall.com>)
Список pgsql-general


On 10 May 2018, at 16:33, Francisco Olarte <folarte@peoplecall.com> wrote:

For what you want to do I think you'll have to parse the text value,
maybe by definig a view with a text columns and using some
rule/trigger magic for insert / updates.

Sorry for being unclear - the solution I have in production appears to work with 

CREATE DOMAIN UTC_TIMESTAMP AS TIMESTAMP WITH TIME ZONE CHECK (EXTRACT(TIMEZONE FROM VALUE) = 0);

This raises an exception when an app doesn’t use UTC.


It seems you want to force your users to use an explcit time zone.
This may be better handled above the database.

This is what I wanted to achieve and the approach so far seems to work.

It is just that most people think the approach is weird. And this is the reason for the OP - a knowledgable person on a different list saw this approach, thought it was weird and suggested that I should educate myself. Which led me to asking on this list.

And the consensus appears to be that the approach is weird and that there are other ways to achieve timezone explicitness, one of which is to gain a deep understanding of how Postgres handles and stores timestamps.

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

Предыдущее
От: Karsten Hilbert
Дата:
Сообщение: Re: Domain based on TIMEZONE WITH TIME ZONE
Следующее
От: Steven Lembark
Дата:
Сообщение: Re: Selecting strict, immutable text for a composite type.