Skip site navigation (1) Skip section navigation (2)

Re: Timezones (in 8.5?)

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, hernan gonzalez <hgonzalez(at)gmail(dot)com>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Timezones (in 8.5?)
Date: 2009-11-29 18:58:35
Message-ID: 162867790911291058u4e3dbf87i7e84d940bba82284@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
2009/11/29 David E. Wheeler <david(at)kineticode(dot)com>:
> On Nov 28, 2009, at 5:40 PM, Bruce Momjian wrote:
>
>> I think there is general agreement that we should have a timezone data
>> type which validates against pg_timezone_names().name.  It might be
>> enough to just document how users can create such a domain data type,
>> but I don't know of a way to do that.  Is this a TODO?
>
> From http://justatheory.com/computers/databases/postgresql/citext-patch-submitted.html
>
> CREATE OR REPLACE FUNCTION is_timezone( tz TEXT ) RETURNS BOOLEAN as $$
> BEGIN
>  PERFORM now() AT TIME ZONE tz;
>  RETURN TRUE;
> EXCEPTION WHEN invalid_parameter_value THEN
>  RETURN FALSE;
> END;
> $$ language plpgsql STABLE;
>
> CREATE DOMAIN timezone AS CITEXT
> CHECK ( is_timezone( value ) );
>
> It could also be TEXT I suppose, but "America/Los_Angeles" and "america/los_angeles" should be considered the same.

nice :)

Pavel

>
> Best,
>
> David
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

pgsql-hackers by date

Next:From: Kurt HarrimanDate: 2009-11-29 19:11:04
Subject: Patch: Remove gcc dependency in definition of inline functions
Previous:From: David E. WheelerDate: 2009-11-29 18:49:48
Subject: Re: Timezones (in 8.5?)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group