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

Commit7881bb1

Browse files
committed
Correctly cast types to Datum and back in compareDatetime()
Discussion:https://postgr.es/m/CAPpHfdteFKW6MLpXM4md99m55YAuXs0n9_P2wiTq_EmG09doUA%40mail.gmail.com
1 parentb81a9c2 commit7881bb1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
25922592
break;
25932593

25942594
caseTIMESTAMPOID:
2595-
val1=date2timestamp_opt_error(val1,have_error);
2595+
val1=TimestampGetDatum(date2timestamp_opt_error(DatumGetDateADT(val1),have_error));
25962596
if (have_error&&*have_error)
25972597
return0;
25982598
cmpfunc=timestamp_cmp;
@@ -2606,7 +2606,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
26062606
errmsg("cannot convert value from %s to %s without timezone usage",
26072607
"date","timestamptz"),
26082608
errhint("use *_tz() function for timezone support")));
2609-
val1=date2timestamptz_opt_error(val1,have_error);
2609+
val1=TimestampTzGetDatum(date2timestamptz_opt_error(DatumGetDateADT(val1),have_error));
26102610
if (have_error&&*have_error)
26112611
return0;
26122612
cmpfunc=timestamp_cmp;
@@ -2680,7 +2680,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
26802680
switch (typid2)
26812681
{
26822682
caseDATEOID:
2683-
val2=date2timestamp_opt_error(val2,have_error);
2683+
val2=TimestampGetDatum(date2timestamp_opt_error(DatumGetDateADT(val2),have_error));
26842684
if (have_error&&*have_error)
26852685
return0;
26862686
cmpfunc=timestamp_cmp;
@@ -2699,7 +2699,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
26992699
errmsg("cannot convert value from %s to %s without timezone usage",
27002700
"timestamp","timestamptz"),
27012701
errhint("use *_tz() function for timezone support")));
2702-
val1=timestamp2timestamptz_opt_error(val1,have_error);
2702+
val1=TimestampTzGetDatum(timestamp2timestamptz_opt_error(DatumGetTimestamp(val1),have_error));
27032703
if (have_error&&*have_error)
27042704
return0;
27052705
cmpfunc=timestamp_cmp;
@@ -2723,7 +2723,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
27232723
errmsg("cannot convert value from %s to %s without timezone usage",
27242724
"date","timestamptz"),
27252725
errhint("use *_tz() function for timezone support")));
2726-
val2=date2timestamptz_opt_error(val2,have_error);
2726+
val2=TimestampTzGetDatum(date2timestamptz_opt_error(DatumGetDateADT(val2),have_error));
27272727
if (have_error&&*have_error)
27282728
return0;
27292729
cmpfunc=timestamp_cmp;
@@ -2737,7 +2737,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
27372737
errmsg("cannot convert value from %s to %s without timezone usage",
27382738
"timestamp","timestamptz"),
27392739
errhint("use *_tz() function for timezone support")));
2740-
val2=timestamp2timestamptz_opt_error(val2,have_error);
2740+
val2=TimestampTzGetDatum(timestamp2timestamptz_opt_error(DatumGetTimestamp(val2),have_error));
27412741
if (have_error&&*have_error)
27422742
return0;
27432743
cmpfunc=timestamp_cmp;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp