From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Chris Dunlop <chris(at)onthe(dot)net(dot)au>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Australian timezone configure option |
Date: | 2001-06-12 15:18:29 |
Message-ID: | 200106121518.f5CFITr10589@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > OK, this patch makes Australian_timezones a GUC option. It can be set
> > anytime in psql. The code uses a static variable to check if the GUC
> > setting has changed and adjust the C struct accordingly.
>
> This is a horrid approach. What if you get an error partway through
> scribbling on the static table? Then you've got inconsistent data.
I have set the variable to -1 on entry so it will reload on failure,
though it is only doing C lookups on a static table so it is hard to see
how it would fail.
> Nor do I much care for having to execute a check subroutine before any
> use of the lookup table (quite aside from speed, are you sure it's being
> called before *every* use of the table? how will you make sure that
> people remember to call it when they add new routines that use the
> table?). If you're going to scribble on the table, ISTM you should
> drive that off an assignment-hook callback from the GUC stuff.
But we don't have such hooks so I did it with as little code as
possible. The table itself is 'static' so it is only called in this
function. (The old patch had the static removed because I thought I was
going to have to do this stuff in the guc files but now it is all in the
same file.)
> Besides which, you forgot to mark the control variable static...
> so it doesn't actually reflect the state of the table.
Fixed. I had that in an ealier version but forgot to add it when I
moved it out to a separate function.
> It would be a lot cleaner to extend the lookup table structure so that
> you don't need to change the table contents to track the Aussie-rules
> setting.
Yes, when we do that we can remove the call and call it instead from the
GUC setting.
Here is a new version of the patch. I found I didn't need to clear the
date cache.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 13.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-06-12 15:19:36 | Re: inet/cidr wierdness (casting) |
Previous Message | Thomas Lockhart | 2001-06-12 15:04:52 | Re: Australian timezone configure option |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-06-12 15:21:16 | Re: Australian timezone configure option |
Previous Message | Bruce Momjian | 2001-06-12 15:14:15 | Re: 7.1 odbc bug & patch |