ildus / clickhouse_fdw

ClickHouse FDW for PostgreSQL
Apache License 2.0
255 stars 55 forks source link

Functions that do not support in where clause #72

Closed wucheong closed 3 years ago

wucheong commented 3 years ago

Hello guys!

Recently I am working some SQL script which using PostgreSQL function "strpos". It do works in select part of SQL. SELECT id, name, strpos(name, 'John') FROM dummy_table

However, when I try to use it in a where clause, it will directly pass "strpos" function to Clickhouse which clickhouse did not support. In clickhouse, there some function with different name "position" which only name difference.

SELECT id, name, FROM dummy_table WHERE strpos(name, 'John')>0

DB::Exception: Unknown function strpos:

I know there is a work around which using "LIKE" in where clause. But due to some integration reason, I would like try to work on this.

May I ask if below is the part I need to work with?

https://github.com/adjust/clickhouse_fdw/blob/fd1f3ec585b73ed61afcd3334db535e79969fb83/src/adjust.c#L116-L149

wucheong commented 3 years ago

After some of research, the function should be F_TEXTPOS

ildus commented 3 years ago

Added

wucheong commented 3 years ago

Added

Thanks for feature added. Faster than me starting to work with. :)