Re: storing TZ along timestamps

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: storing TZ along timestamps
Date: 2011-07-19 21:20:55
Message-ID: CABFD9BF-10EA-49C3-807A-4573E14A6E26@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jul 19, 2011, at 2:06 PM, Josh Berkus wrote:

> I am strongly in favor of having a *timezone* data type and some system
> whereby we can uniquely identify timezones in the Zic database.

CREATE OR REPLACE FUNCTION is_timezone(
tz CITEXT
) RETURNS BOOLEAN LANGUAGE plpgsql STABLE AS $$
BEGIN
PERFORM NOW() AT TIME ZONE tz;
RETURN TRUE;
EXCEPTION WHEN invalid_parameter_value THEN
RETURN FALSE;
END;
$$;

CREATE DOMAIN timezone AS CITEXT CHECK ( is_timezone( VALUE ) );

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2011-07-19 22:02:25 PgWest CFP closes in two weeks
Previous Message Josh Berkus 2011-07-19 21:06:58 Re: storing TZ along timestamps