Unknown function btrim
fantom0005 opened this issue · comments
Anton Shvetsov commented
Hi guys.
I tried to use function trim in "where" block in postgres and got the error message: "Unknown function btrim QUERY:SELECT field FROM "default".test_table WHERE ((btrim(field) <> ''))"
How to reproduce:
- Create table in ClickHouse
create table test_table (field String) engine = MergeTree() ORDER BY (field);
- Add value to table
insert into test_table values ('213');
- Create fdw table in postgres
create foreign table test_table ("field" text) server clickhouse_svr;
- Select data and use function trim in where
select * from test_table where trim(field) <> '';
I checked on versions:
- PostgreSQL 12.3 (Debian 12.3-1.pgdg110+1+b1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 9.3.0-14) 9.3.0, 64-bit
- ClickHouse Verion 20.5.4.40
Anton Shvetsov commented
I found workaround. But it's very strange
You can use functions ltrim, rtrim together. It works.
select * from test_table where ltrim(rtrim(field)) <> '';
Ildus Kurbangaliev commented
It's not strange, clickhouse already has ltrim
and rtrim
functions, but not btrim
. I haved added translation to trimBoth
.