Re: BUG #5740: contrib/spi/moddatetime.c doesn't work with timezones. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #5740: contrib/spi/moddatetime.c doesn't work with timezones.
Date
Msg-id 20091.1288842928@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #5740: contrib/spi/moddatetime.c doesn't work with timezones.  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
Responses Re: BUG #5740: contrib/spi/moddatetime.c doesn't work with timezones.  (Dimitri Fontaine <dimitri@2ndQuadrant.fr>)
Re: BUG #5740: contrib/spi/moddatetime.c doesn't work with timezones.  (Dirk Heinrichs <dirk.heinrichs@altum.de>)
List pgsql-bugs
Dimitri Fontaine <dimitri@2ndQuadrant.fr> writes:
> Dirk Heinrichs <dirk.heinrichs@altum.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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #5743: Regexp engine fails to case-insensitively match multi-byte codepoints
Next
From: Dimitri Fontaine
Date:
Subject: Re: BUG #5740: contrib/spi/moddatetime.c doesn't work with timezones.