Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit074db86

Browse files
committed
Fix incorrect Datum conversion in timestamptz_trunc_internal()
The code used a PG_RETURN_TIMESTAMPTZ() where the return type isTimestampTz and not a Datum.On 64-bit systems, there is no effect since this just ends up casting64-bit integers back and forth. On 32-bit systems, timestamptz ispass-by-reference. PG_RETURN_TIMESTAMPTZ() allocates new memory andreturns the address, meaning that the caller could interpret this as atimestamp value.The effect is using "date_trunc(..., 'infinity'::timestamptz) willreturn random values (instead of the correct return value 'infinity').Bug introduced in commitd85ce01.Author: Peter Eisentraut <peter@eisentraut.org>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/2d320b6f-b4af-4fbc-9eec-5d0fa15d187b@eisentraut.orgDiscussion:https://postgr.es/m/4bf60a84-2862-4a53-acd5-8eddf134a60e@eisentraut.orgBackpatch-through: 18
1 parentce13bb9 commit074db86

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/backend/utils/adt/timestamp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4954,7 +4954,7 @@ timestamptz_trunc_internal(text *units, TimestampTz timestamp, pg_tz *tzp)
49544954
caseDTK_SECOND:
49554955
caseDTK_MILLISEC:
49564956
caseDTK_MICROSEC:
4957-
PG_RETURN_TIMESTAMPTZ(timestamp);
4957+
returntimestamp;
49584958
break;
49594959

49604960
default:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp