apache / shardingsphere

Empowering Data Intelligence with Distributed SQL for Sharding, Scalability, and Security Across All Databases.
Apache License 2.0
19.91k stars 6.73k forks source link

exec postgresql range type construcor function faild, error: no viable alternative at input xxxxxxxx tsrange #24862

Open weibiansanjue opened 1 year ago

weibiansanjue commented 1 year ago

Question

weibiansanjue commented 1 year ago

test case use quotes, success


/** int4range  **/
select '[400,500]'::"int4range";

select null::"int4range";
select "int4range"(null);
select 'empty'::"int4range";
select "int4range"('empty');

select "int4range"('[400,500]');
select "int4range"(400, 500, '[]');

/** int8range — bigint的范围  **/
select '[400000000000,500000000000]'::"int8range";

select null::"int8range";
select "int8range"(null);
select 'empty'::"int8range";
select "int8range"('empty');

select "int8range"('[400000000000,500000000000]');
select "int8range"(400000000000, 500000000000, '[]');

/** numrange  **/
select '[11.11, 22.22]'::"numrange";

select null::"numrange";
select "numrange"(null);
select 'empty'::"numrange";
select "numrange"('empty');

select "numrange"('[11.11, 22.22]');
select "numrange"(11.11, 22.22, '[]');

/** tsrange  **/
select '[2023-01-01 14:30, 2023-03-01 15:30]'::"tsrange";

select null::"tsrange";
select "tsrange"(null);
select 'empty'::"tsrange";
select "tsrange"('empty');

select "tsrange"('[2023-01-01 14:30, 2023-03-01 15:30]');
select "tsrange"(now()::timestamp(0)without time zone, now()::timestamp(0)without time zone, '[]');

/** tstzrange **/
select '[2023-01-01 14:30, 2023-03-01 15:30]'::"tstzrange";

select null::"tstzrange";
select "tstzrange"(null);
select 'empty'::"tstzrange";
select "tstzrange"('empty');

select "tstzrange"(now(), now(), '[]');

/** daterange  **/
select '[2023-01-01, 2023-03-31)'::"daterange";

select null::"daterange";
select "daterange"(null);
select 'empty'::"daterange";
select "daterange"('empty');

select "daterange"('2023-01-01', '2023-03-31', '[]');
select "daterange"(current_date-1, current_date, '[]');
RaigorJiang commented 1 year ago

Hi @weibiansanjue Thanks for your feedback, are you interested in submitting a PR to improve it?

weibiansanjue commented 1 year ago

Hi @weibiansanjue Thanks for your feedback, are you interested in submitting a PR to improve it?

Hi @RaigorJiang, I'm sorry, I find this question, but I'm not capable of solving this problem for the time being. if you have time, could you please help me? thanks a lot.

RaigorJiang commented 1 year ago

Ok, I'll mark it as volunteer wanted, see if anyone is interested.