diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-09-06 11:03:56 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-09-06 11:03:56 -0400 |
commit | 388e71af880d579212c2489686903c2cfdea9032 (patch) | |
tree | a9cccdcd9c5a5409eaec1191487a9ec800ca19c3 /src/backend/utils/adt/tsquery_gist.c | |
parent | 78aa616be74a13156f4fc8db3a131f1fdc2cce47 (diff) | |
download | postgresql-388e71af880d579212c2489686903c2cfdea9032.tar.gz postgresql-388e71af880d579212c2489686903c2cfdea9032.zip |
Make timetz_zone() stable, and correct a bug for DYNTZ abbreviations.
Historically, timetz_zone() has used time(NULL) as the reference point
for deciding whether DST is active. That means its result can change
intra-statement, requiring it to be marked VOLATILE (cf. 35979e6c3).
But that definition is pretty inconsistent with the way we deal with
timestamps elsewhere. Let's make it use the transaction start time
("now()") as the reference point instead. That lets it be marked
STABLE, and also saves a kernel call per invocation.
While at it, remove the function's use of pg_time_t and pg_localtime.
Those are inconsistent with the other code in this area, which indeed
created a bug: timetz_zone() delivered completely wrong answers if
the zone was specified by a dynamic TZ abbreviation. (We need to do
something about that in the back branches, but the fix will look
different from this.)
Aleksander Alekseev and Tom Lane
Discussion: https://postgr.es/m/CAJ7c6TOMG8zSNEZtCn5SPe+cCk3Lfxb71ZaQwT2F4T7PJ_t=KA@mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/tsquery_gist.c')
0 files changed, 0 insertions, 0 deletions