clickhouse_fdw icon indicating copy to clipboard operation
clickhouse_fdw copied to clipboard

Array insert error (HV004)

Open aabdulgalimov opened this issue 5 years ago • 3 comments

Getting an error when attempting to insert array data type.

ClickHouse (19.14.3.3):

CREATE TABLE arr_test (
    ts Date, 
    arr Array(Nullable(String))
) ENGINE = MergeTree() PARTITION BY toYYYYMM(ts) ORDER BY (ts)

PostgreSQL (12.2):

CREATE SCHEMA click;
IMPORT FOREIGN SCHEMA "default" LIMIT TO ("arr_test") 
    FROM SERVER clickhouse_svr INTO click;
INSERT INTO click.arr_test SELECT now()::date, '{test}'::text[];

Message:

ERROR:  cannot convert constant value to clickhouse value
HINT:  Constant value data type: 1009
SQL state: HV004

aabdulgalimov avatar May 04 '20 15:05 aabdulgalimov

Is this on binary or http protocol?

ildus avatar May 05 '20 11:05 ildus

http

aabdulgalimov avatar May 05 '20 12:05 aabdulgalimov

Sorry that the answer took so long. http for now supports only basic types for inserting, you can try binary protocol. I will add the support of more complex types to http eventually. Changing to binary is easy, just run the command ALTER SERVER server OPTIONS (SET driver 'binary'). But it requires checking with your clickhouse server. Some clickhouse versions are quite buggy.

ildus avatar May 15 '20 22:05 ildus