Thread: pgsql: Attached patch gets rid of the global timezone in the following

pgsql: Attached patch gets rid of the global timezone in the following

From
momjian@svr1.postgresql.org (Bruce Momjian)
Date:
Log Message:
-----------
Attached patch gets rid of the global timezone in the following steps:

* Changes the APIs to the timezone functions to take a pg_tz pointer as
an argument, representing the timezone to use for the selected
operation.

* Adds a global_timezone variable that represents the current timezone
in the backend as set by SET TIMEZONE (or guc, or env, etc).

* Implements a hash-table cache of loaded tables, so we don't have to
read and parse the TZ file everytime we change a timezone. While not
necesasry now (we don't change timezones very often), I beleive this
will be necessary (or at least good) when "multiple timezones in the
same query" is eventually implemented. And code-wise, this was the time
to do it.


There are no user-visible changes at this time. Implementing the
"multiple zones in one query" is a later step...

This also gets rid of some of the cruft needed to "back out a timezone
change", since we previously couldn't check a timezone unless it was
activated first.

Passes regression tests on win32, linux (slackware 10) and solaris x86.

Magnus Hagander

Modified Files:
--------------
    pgsql/src/backend/commands:
        variable.c (r1.105 -> r1.106)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/variable.c.diff?r1=1.105&r2=1.106)
    pgsql/src/backend/postmaster:
        syslogger.c (r1.14 -> r1.15)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/postmaster/syslogger.c.diff?r1=1.14&r2=1.15)
    pgsql/src/backend/utils/adt:
        datetime.c (r1.137 -> r1.138)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/datetime.c.diff?r1=1.137&r2=1.138)
        nabstime.c (r1.127 -> r1.128)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/nabstime.c.diff?r1=1.127&r2=1.128)
        timestamp.c (r1.118 -> r1.119)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/timestamp.c.diff?r1=1.118&r2=1.119)
    pgsql/src/include:
        pgtime.h (r1.6 -> r1.7)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/pgtime.h.diff?r1=1.6&r2=1.7)
    pgsql/src/timezone:
        localtime.c (r1.9 -> r1.10)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/localtime.c.diff?r1=1.9&r2=1.10)
        pgtz.c (r1.29 -> r1.30)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/pgtz.c.diff?r1=1.29&r2=1.30)
        pgtz.h (r1.10 -> r1.11)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/pgtz.h.diff?r1=1.10&r2=1.11)
        strftime.c (r1.5 -> r1.6)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/strftime.c.diff?r1=1.5&r2=1.6)
        zic.c (r1.13 -> r1.14)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/timezone/zic.c.diff?r1=1.13&r2=1.14)