Re: BUG #5740: contrib/spi/moddatetime.c doesn't work with timezones.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
Cc: Dirk Heinrichs <dirk(dot)heinrichs(at)altum(dot)de>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5740: contrib/spi/moddatetime.c doesn't work with timezones.
Date: 2010-11-04 03:55:28
Message-ID: 20091.1288842928@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr> writes:
> Dirk Heinrichs <dirk(dot)heinrichs(at)altum(dot)de> writes:
>> Please find the patch attached. It's against 8.4.5.
>>
>> extern Datum moddatetime(PG_FUNCTION_ARGS);
>> +extern Datum moddatetimetz(PG_FUNCTION_ARGS);
> [...]
>> +CREATE OR REPLACE FUNCTION moddatetimetz()
>> +RETURNS trigger
>> +AS 'MODULE_PATHNAME'
>> +LANGUAGE C;

> You can also do AS 'MODULE_PATHNAME', 'c_function_name' and maintain a
> single C function that copes with both timestamp and timestamptz
> arguments, that's what I had in mind: you still declare two functions at
> the SQL level, though.

I don't actually see any point in having two functions at all. Since
the trigger is examining the column type internally, it could perfectly
well do the right thing at runtime depending on column type.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dimitri Fontaine 2010-11-04 08:18:35 Re: BUG #5740: contrib/spi/moddatetime.c doesn't work with timezones.
Previous Message Tom Lane 2010-11-04 03:52:09 Re: BUG #5743: Regexp engine fails to case-insensitively match multi-byte codepoints