ildus / clickhouse_fdw

ClickHouse FDW for PostgreSQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Functions that do not support in where clause

wucheong opened this issue · comments

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

After some of research, the function should be F_TEXTPOS

Added

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