v3-0001-timezone_volatility.patch
application/octet-stream
Filename: v3-0001-timezone_volatility.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
Series: patch v3-0001
| File | + | − |
|---|---|---|
| src/backend/utils/adt/date.c | 4 | 4 |
| src/include/catalog/catversion.h | 1 | 1 |
| src/include/catalog/pg_proc.dat | 1 | 1 |
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 0bea16cb67..b9ee5319de 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -3068,8 +3068,8 @@ timetz_zone(PG_FUNCTION_ARGS)
}
else if (type == DYNTZ)
{
- /* dynamic-offset abbreviation, resolve using current time */
- pg_time_t now = (pg_time_t) time(NULL);
+ /* dynamic-offset abbreviation, resolve using transaction start time */
+ pg_time_t now = timestamptz_to_time_t(GetCurrentTransactionStartTimestamp());
struct pg_tm *tm;
tm = pg_localtime(&now, tzp);
@@ -3081,8 +3081,8 @@ timetz_zone(PG_FUNCTION_ARGS)
tzp = pg_tzset(tzname);
if (tzp)
{
- /* Get the offset-from-GMT that is valid today for the zone */
- pg_time_t now = (pg_time_t) time(NULL);
+ /* Get the offset from now() that is valid for the zone */
+ pg_time_t now = timestamptz_to_time_t(GetCurrentTransactionStartTimestamp());
struct pg_tm *tm;
tm = pg_localtime(&now, tzp);
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 21b6648f5a..493d9e2a64 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -53,6 +53,6 @@
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202108311
+#define CATALOG_VERSION_NO 202109011
#endif
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 4f170eaf48..1a74d78330 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -5953,7 +5953,7 @@
proname => 'timestamp_larger', prorettype => 'timestamp',
proargtypes => 'timestamp timestamp', prosrc => 'timestamp_larger' },
{ oid => '2037', descr => 'adjust time with time zone to new zone',
- proname => 'timezone', provolatile => 'v', prorettype => 'timetz',
+ proname => 'timezone', provolatile => 's', prorettype => 'timetz',
proargtypes => 'text timetz', prosrc => 'timetz_zone' },
{ oid => '2038', descr => 'adjust time with time zone to new zone',
proname => 'timezone', prorettype => 'timetz',