Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clickhouse adapts to postgresql #56729

Closed
src-slu opened this issue Nov 14, 2023 · 8 comments · Fixed by #56456
Closed

clickhouse adapts to postgresql #56729

src-slu opened this issue Nov 14, 2023 · 8 comments · Fixed by #56456
Assignees
Labels
comp-postgresql potential bug To be reviewed by developers and confirmed/rejected.

Comments

@src-slu
Copy link

src-slu commented Nov 14, 2023

When I use the ch table and the table imported by the PostgreSql table (pg_algo_input_customer) engine as views, I filter the fields in pg_algo_input_customer. Clickhouse embedded the condition in the pg_algo_input_customer table sql as where 1, but the syntax of where 1 is not supported in pgsql, how do I make this view sql valid using the pg table engine?

The sql statement:
select date, customer, level
from pg_algo_input_customer
where level != 'ZZ'.

The view contains the 'level' above, And when i used 'level' column, ch embeds 'and 1' into sql: WHERE ("level" != 'ZZ') AND 1), then throw this error 'std::exception. Code: 1001, type: pqxx::sql_error, e.what() = ERROR: argument of AND must be type boolean, not type integer'.
image

Tasks

No tasks being tracked yet.
@src-slu src-slu added the potential bug To be reviewed by developers and confirmed/rejected. label Nov 14, 2023
@src-slu
Copy link
Author

src-slu commented Nov 14, 2023

ch version: 23.4.2.11

@src-slu
Copy link
Author

src-slu commented Nov 15, 2023

I'm sorry I opened it agent. I installed the latest version of ch-server today and used the same way to create views, this problem occurs again when there is custom parameter data in the view (for example, level = '全档'). I have tried other numbers, English, it will be like this.

image

@lampjian
Copy link

lampjian commented Nov 19, 2023

Try to replace "and 1" with "and true", note that newer version after 22 can deal with boolean type.

@nickitat
Copy link
Member

full stack trace plz

@evillique
Copy link
Member

Could you also please provide SHOW CREATE for pg_algo_input_customer table?

@fiend19961
Copy link

full stack trace plz

DROP TABLE IF EXISTS sys_nic;
CREATE TABLE IF NOT EXISTS sys_nic
(
id UInt64,
type Int16
) ENGINE = PostgreSQL(own_pg, table='sys_nic');

DROP TABLE IF EXISTS proxy.sys_nic;
CREATE TABLE IF NOT EXISTS proxy.sys_nic AS default.sys_nic
ENGINE = Distributed('setus','default','sys_nic',rand());
when execute sql like this :
SELECT * from proxy.sys_nic where id>0 and _shard_num >0;
ERROR FROM pg:
select * from sys_nic WHERE ("id" > 0) AND 1) , The argument for "AND" must be of type boolean, not type integer.

@fiend19961
Copy link

Could you also please provide SHOW CREATE for pg_algo_input_customer table?

I met the same problem
#57253

@ucasfl ucasfl self-assigned this Nov 28, 2023
@ucasfl
Copy link
Collaborator

ucasfl commented Nov 28, 2023

It should have been fixed in #56456 recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-postgresql potential bug To be reviewed by developers and confirmed/rejected.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants