Add PostgreSQL table function, dictionary source, database engine#18554
Add PostgreSQL table function, dictionary source, database engine#18554alexey-milovidov merged 52 commits intoClickHouse:masterfrom
Conversation
| auto parsed_host_port = parseAddress(args[0]->as<ASTLiteral &>().value.safeGet<String>(), 5432); | ||
| remote_table_name = args[2]->as<ASTLiteral &>().value.safeGet<String>(); | ||
|
|
||
| connection_str = fmt::format("dbname={} host={} port={} user={} password={}", |
There was a problem hiding this comment.
It can be unsafe, need to check it...
| } | ||
|
|
||
|
|
||
| /// Cannot just use serializeAsText for array data type even though it converts perfectly |
There was a problem hiding this comment.
BTW Postgres supports array[1, 2, 3] syntax:
http://sqlfiddle.com/#!17/0a28f/359
There was a problem hiding this comment.
But it fails with copy command:
E helpers.client.QueryRuntimeException: Client failed! Return code: 233, stderr: Received exception from server (version 21.1.1):
E Code: 1001. DB::Exception: Received from 172.21.0.3:9000. DB::Exception: pqxx::data_exception: ERROR: malformed array literal: "array['2000-05-12','2000-05-12']"
E DETAIL: Array value must start with "{" or dimension information.
E CONTEXT: COPY test_array_dimensions, line 1, column a: "array['2000-05-12','2000-05-12']"
E helpers.client.QueryRuntimeException: Client failed! Return code: 233, stderr: Received exception from server (version 21.1.1):
E Code: 1001. DB::Exception: Received from 172.21.0.3:9000. DB::Exception: pqxx::data_exception: ERROR: malformed array literal: "array[[[1,1],[1,1]],[[3,3],[3,3]],[[4,4],[5,5]]]"
E DETAIL: Array value must start with "{" or dimension information.
E CONTEXT: COPY array_columns, line 1, column b: "array[[[1,1],[1,1]],[[3,3],[3,3]],[[4,4],[5,5]]]"
|
|
||
| /// Conversion is done via column casting because with writeText(Array..) got incorrect conversion | ||
| /// of Date and DateTime data types and it added extra quotes for values inside array. | ||
| static std::string clickhouseToPostgresArray(const Array & array_field, const DataTypePtr & data_type) |
There was a problem hiding this comment.
FieldVisitorToString may also suffice.
|
After this commit darwin build failed. See also #19277 |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Added PostgreSQL table engine (both select/insert, with support for multidimensional arrays), also as table function. Added PostgreSQL dictionary source. Added PostgreSQL database engine.