aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/jsonpath_exec.c
diff options
context:
space:
mode:
authorAlexander Korotkov <akorotkov@postgresql.org>2019-09-26 02:06:45 +0300
committerAlexander Korotkov <akorotkov@postgresql.org>2019-09-26 02:09:01 +0300
commit7881bb14f4b23e8dc8671938cfb3f34117c12d8b (patch)
treeebb4fc9b5ec09994153e52acfda112e8f548a26d /src/backend/utils/adt/jsonpath_exec.c
parentb81a9c2fc52509025c635fa08ecaec1bad21441b (diff)
downloadpostgresql-7881bb14f4b23e8dc8671938cfb3f34117c12d8b.tar.gz
postgresql-7881bb14f4b23e8dc8671938cfb3f34117c12d8b.zip
Correctly cast types to Datum and back in compareDatetime()
Discussion: https://postgr.es/m/CAPpHfdteFKW6MLpXM4md99m55YAuXs0n9_P2wiTq_EmG09doUA%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/jsonpath_exec.c')
-rw-r--r--src/backend/utils/adt/jsonpath_exec.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/utils/adt/jsonpath_exec.c b/src/backend/utils/adt/jsonpath_exec.c
index 2738439eb37..a35f718b96e 100644
--- a/src/backend/utils/adt/jsonpath_exec.c
+++ b/src/backend/utils/adt/jsonpath_exec.c
@@ -2592,7 +2592,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
break;
case TIMESTAMPOID:
- val1 = date2timestamp_opt_error(val1, have_error);
+ val1 = TimestampGetDatum(date2timestamp_opt_error(DatumGetDateADT(val1), have_error));
if (have_error && *have_error)
return 0;
cmpfunc = timestamp_cmp;
@@ -2606,7 +2606,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
errmsg("cannot convert value from %s to %s without timezone usage",
"date", "timestamptz"),
errhint("use *_tz() function for timezone support")));
- val1 = date2timestamptz_opt_error(val1, have_error);
+ val1 = TimestampTzGetDatum(date2timestamptz_opt_error(DatumGetDateADT(val1), have_error));
if (have_error && *have_error)
return 0;
cmpfunc = timestamp_cmp;
@@ -2680,7 +2680,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
switch (typid2)
{
case DATEOID:
- val2 = date2timestamp_opt_error(val2, have_error);
+ val2 = TimestampGetDatum(date2timestamp_opt_error(DatumGetDateADT(val2), have_error));
if (have_error && *have_error)
return 0;
cmpfunc = timestamp_cmp;
@@ -2699,7 +2699,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
errmsg("cannot convert value from %s to %s without timezone usage",
"timestamp", "timestamptz"),
errhint("use *_tz() function for timezone support")));
- val1 = timestamp2timestamptz_opt_error(val1, have_error);
+ val1 = TimestampTzGetDatum(timestamp2timestamptz_opt_error(DatumGetTimestamp(val1), have_error));
if (have_error && *have_error)
return 0;
cmpfunc = timestamp_cmp;
@@ -2723,7 +2723,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
errmsg("cannot convert value from %s to %s without timezone usage",
"date", "timestamptz"),
errhint("use *_tz() function for timezone support")));
- val2 = date2timestamptz_opt_error(val2, have_error);
+ val2 = TimestampTzGetDatum(date2timestamptz_opt_error(DatumGetDateADT(val2), have_error));
if (have_error && *have_error)
return 0;
cmpfunc = timestamp_cmp;
@@ -2737,7 +2737,7 @@ compareDatetime(Datum val1, Oid typid1, Datum val2, Oid typid2,
errmsg("cannot convert value from %s to %s without timezone usage",
"timestamp", "timestamptz"),
errhint("use *_tz() function for timezone support")));
- val2 = timestamp2timestamptz_opt_error(val2, have_error);
+ val2 = TimestampTzGetDatum(timestamp2timestamptz_opt_error(DatumGetTimestamp(val2), have_error));
if (have_error && *have_error)
return 0;
cmpfunc = timestamp_cmp;