2020-01-09 12:13:36 +00:00
|
|
|
select substring('abcdefgh', 2, -2);
|
|
|
|
select substring('abcdefgh', materialize(2), -2);
|
|
|
|
select substring('abcdefgh', 2, materialize(-2));
|
|
|
|
select substring('abcdefgh', materialize(2), materialize(-2));
|
|
|
|
|
|
|
|
select '-';
|
|
|
|
|
|
|
|
select substring(cast('abcdefgh' as FixedString(8)), 2, -2);
|
|
|
|
select substring(cast('abcdefgh' as FixedString(8)), materialize(2), -2);
|
|
|
|
select substring(cast('abcdefgh' as FixedString(8)), 2, materialize(-2));
|
|
|
|
select substring(cast('abcdefgh' as FixedString(8)), materialize(2), materialize(-2));
|
|
|
|
|
|
|
|
select '-';
|
|
|
|
|
2020-01-09 12:52:17 +00:00
|
|
|
drop table if exists t;
|
2020-01-09 12:13:36 +00:00
|
|
|
create table t (s String, l Int8, r Int8) engine = Memory;
|
|
|
|
insert into t values ('abcdefgh', 2, -2), ('12345678', 3, -3);
|
|
|
|
|
|
|
|
select substring(s, 2, -2) from t;
|
|
|
|
select substring(s, l, -2) from t;
|
|
|
|
select substring(s, 2, r) from t;
|
|
|
|
select substring(s, l, r) from t;
|
|
|
|
|
|
|
|
select '-';
|
|
|
|
|
2020-01-09 12:52:17 +00:00
|
|
|
drop table if exists t;
|
2020-01-09 12:13:36 +00:00
|
|
|
create table t (s FixedString(8), l Int8, r Int8) engine = Memory;
|
|
|
|
insert into t values ('abcdefgh', 2, -2), ('12345678', 3, -3);
|
|
|
|
|
|
|
|
select substring(s, 2, -2) from t;
|
|
|
|
select substring(s, l, -2) from t;
|
|
|
|
select substring(s, 2, r) from t;
|
|
|
|
select substring(s, l, r) from t;
|
|
|
|
|
2020-01-09 12:52:17 +00:00
|
|
|
drop table if exists t;
|
2020-01-09 12:13:36 +00:00
|
|
|
|