diff --git a/contrib/dolphin/expected/builtin_funcs/b_compatibility_time_funcs3.out b/contrib/dolphin/expected/builtin_funcs/b_compatibility_time_funcs3.out index 5c9231c91dc99f35bd1466ed11f8e44a9308d99f..43959a97af6c0e625079d93443cd8895e02db623 100644 --- a/contrib/dolphin/expected/builtin_funcs/b_compatibility_time_funcs3.out +++ b/contrib/dolphin/expected/builtin_funcs/b_compatibility_time_funcs3.out @@ -2554,6 +2554,21 @@ NOTICE: RESULT COL :4714-11-23 08:00:00-08t NOTICE: RESULT COL :4714-11-24 00:00:00t NOTICE: RESULT COL :11:11:11+08t NOTICE: RESULT COL :11:11:11t +CREATE TABLE t_timestamp(id int, start_time timestamp(3) without time zone, endtime timestamp(3) with time zone); +insert into t_timestamp values (1, '2024-10-10 10:10:10.100', '2024-10-10 10:10:10.100'); +select id from t_timestamp where start_time >= '2024-10-10 10:10:10.100'::varchar and start_time <= '2024-10-10 10:10:10.100'::varchar; + id +---- + 1 +(1 row) + +select id from t_timestamp where endtime >= '2024-10-10 10:10:10.100'::varchar and endtime <= '2024-10-10 10:10:10.100'::varchar; + id +---- + 1 +(1 row) + +drop table t_timestamp; drop table test_time; drop table t_time; drop schema b_time_funcs3 cascade; diff --git a/contrib/dolphin/plugin_utils/adt/timestamp.cpp b/contrib/dolphin/plugin_utils/adt/timestamp.cpp index 69ecf04eb6bd133e6ff00dfa6800cd8ddeaf7c73..734aa1872af0ddb5f9da1be7766914a9748aace4 100644 --- a/contrib/dolphin/plugin_utils/adt/timestamp.cpp +++ b/contrib/dolphin/plugin_utils/adt/timestamp.cpp @@ -1290,7 +1290,7 @@ Datum convert_text_datetime(PG_FUNCTION_ARGS) char* str = NULL; TimeErrorType time_error_type = TIME_CORRECT; str = DatumGetCString(DirectFunctionCall1(textout, textValue)); - Datum result = timestamp_internal(fcinfo, str, TIME_IN, &time_error_type); + Datum result = timestamp_internal(fcinfo, str, TEXT_TIME_EXPLICIT, &time_error_type); pfree_ext(str); PG_RETURN_TIMESTAMP(result); } @@ -1301,7 +1301,7 @@ Datum convert_text_timestamptz(PG_FUNCTION_ARGS) char* str = NULL; TimeErrorType time_error_type = TIME_CORRECT; str = DatumGetCString(DirectFunctionCall1(textout, textValue)); - Datum result = timestamptz_internal(fcinfo, str, TIME_IN, &time_error_type); + Datum result = timestamptz_internal(fcinfo, str, TEXT_TIME_EXPLICIT, &time_error_type); pfree_ext(str); PG_RETURN_TIMESTAMPTZ(result); } diff --git a/contrib/dolphin/sql/builtin_funcs/b_compatibility_time_funcs3.sql b/contrib/dolphin/sql/builtin_funcs/b_compatibility_time_funcs3.sql index 5d65e8baf4e558bd7ee2523f51ce8617b959cba3..29b3e08c3583a9c02c77390f0cda64e5815a0481 100644 --- a/contrib/dolphin/sql/builtin_funcs/b_compatibility_time_funcs3.sql +++ b/contrib/dolphin/sql/builtin_funcs/b_compatibility_time_funcs3.sql @@ -631,6 +631,11 @@ raise notice 'RESULT COL :%t', d; end; / +CREATE TABLE t_timestamp(id int, start_time timestamp(3) without time zone, endtime timestamp(3) with time zone); +insert into t_timestamp values (1, '2024-10-10 10:10:10.100', '2024-10-10 10:10:10.100'); +select id from t_timestamp where start_time >= '2024-10-10 10:10:10.100'::varchar and start_time <= '2024-10-10 10:10:10.100'::varchar; +select id from t_timestamp where endtime >= '2024-10-10 10:10:10.100'::varchar and endtime <= '2024-10-10 10:10:10.100'::varchar; +drop table t_timestamp; drop table test_time; drop table t_time;