Re: Assign the system timezone to a variable in a function?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Steve Murphy <smurphy(at)intorrent(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Assign the system timezone to a variable in a function?
Date: 2011-05-24 13:59:41
Message-ID: BANLkTikYH=_WvcVgTm_MKtjEYnbrTuTdOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, May 24, 2011 at 8:49 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Merlin Moncure <mmoncure(at)gmail(dot)com> writes:
>> On Tue, May 24, 2011 at 8:09 AM, Steve Murphy <smurphy(at)intorrent(dot)com> wrote:
>>> Take the result of "show timezone", and assign it to a variable
>>> in a function.
>
>> I was about to suggest querying the pg_settings table, then noticed
>> there was no 'timezone' record in it, which is pretty odd imo.  You
>> can look at the log_timezone record however, which might be correct.
>
> It's spelled "TimeZone" for historical reasons.  See also the
> current_setting() function.

whoops! I should have known... :-). Yeah, the current_setting()
function is just a hair faster than grepping the pg_settings view for
the right answer, and so is really the better way to go anyways. It
also is case agnostic apparently.

merlin

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Chris Campbell 2011-05-26 19:22:10 UTF8 and Accented Characters
Previous Message Tom Lane 2011-05-24 13:49:20 Re: Assign the system timezone to a variable in a function?