ClickHouse / ClickHouse/clickhouse-odbc
OracleDB read data from ClickHouse via clickhouse-odbc error because of 2 long columns.
- Dominant language
- C
- Stars
- 285
- Forks
- 105
- Avg merge
- 3h 56m
- Merged PRs (30d)
- 3
Description
OracleDB doesn't allow to have more than 1 LONG column (It's big string datatype in Oracle)
https://stackoverflow.com/questions/11646124/how-i-can-create-a-table-having-two-long-columns
And for
```
INSERT INTO oracle_table SELECT * FROM clickhouse_table
```
OracleDB run query to get ClickHouse table column datatype.
Because this mapping is static
https://github.com/ClickHouse/clickhouse-odbc/blob/35394e53319a60d4ae9404117059813d76d28bd7/driver/utils/type_info.h#L27
odbc setting `StringMaxLength` doesn't have any affect on it.
https://github.com/ClickHouse/clickhouse-odbc/blob/35394e53319a60d4ae9404117059813d76d28bd7/driver/config/ini_defines.h#L31
Looks like it can manually fixed by applying this patch (if all your strings no longer than 4000 chars) and build clickhouse-odbc.
```
--- a/driver/utils/type_info.h
+++ b/driver/utils/type_info.h
@@ -24,7 +24,7 @@ struct TypeInfo {
int32_t column_size; // max width of value in textual represntation, e.g. number of decimal digits for numeric types.
int32_t octet_length; // max binary size of value in memory.
- static constexpr auto string_max_size = 0xFFFFFF;
+ static constexpr auto string_max_size = 0x000FA0;
inline bool isIntegerType() const noexcept {
return sql_type == SQL_TINYINT || sql_type == SQL_SMALLINT || sql_type == SQL_INTEGER || sql_type == SQL_BIGINT;
help xxxx
| TABLE_CAT | TABLE_SCHEM | TABLE_NAME | COLUMN_NAME | DATA_TYPE| TYPE_NAME | COLUMN_SIZE| BUFFER_LENGTH| DECIMAL_DIGITS| NUM_PREC_RADIX| NULLABLE| REMARKS| COLUMN_DEF| SQL_DATA_TYPE| SQL_DATETIME_SUB| CHAR_OCTET_LENGTH| ORDINAL_POSITION| IS_NULLABLE|
| default | | xxxx | key | 12 | TEXT | 4000 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 0 | 4000 | 0 | 0 |
```
But it will be very nice to be able to override it via settings.
Contributor guide
Research direction
Start by reading driver/utils/type_info.h to understand the current string type mapping, then inspect driver/config/ini_defines.h and the StringMaxLength setting referenced in the issue. Define how an override should affect reported metadata, and verify that configured string lengths avoid multiple Oracle LONG columns without changing unrelated types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100