Repository navigation
MaterializedPostgreSQL: Support "generated columns" and default values - #57568
Conversation
|
This is an automated comment for commit 1e4d61d with description of existing statuses. It's updated for the latest CI running ⏳ Click here to open a full report in a separate page Successful checks
|
|
No related failures:
00180_no_seek_avoiding_when_reading_from_cache
00180_no_seek_avoiding_when_reading_from_cache
00180_no_seek_avoiding_when_reading_from_cache |
…-issue-with-generated-columns
| auto tmp_nested_table_id = StorageID(table_id.database_name, getNestedTableName()); | ||
| LOG_DEBUG(log, "Creating clickhouse table for postgresql table {}", table_id.getNameForLogs()); | ||
| LOG_DEBUG(log, "Creating clickhouse table for postgresql table {} (ast: {})", | ||
| table_id.getNameForLogs(), serializeAST(*ast_create)); |
There was a problem hiding this comment.
BTW, we have IAST::formatForLogging that formats ast with settings suitable for logging (oneline, hide secrets, etc)
Line 283 in efb82a9
Doesn't make to much difference here, but just in case.
| assertBlocksHaveEqualStructure(input->getPort().getHeader(), block_io.pipeline.getHeader(), "postgresql replica load from snapshot"); | ||
| block_io.pipeline.complete(Pipe(std::move(input))); | ||
|
|
||
| /// TODO: make a test when we fail in the middle of inserting data from source. |
There was a problem hiding this comment.
Perhaps introducing a fail point can make it easier to reproduce
ClickHouse/src/Common/FailPoint.cpp
Line 41 in efb82a9
There was a problem hiding this comment.
Wow, cool, did not know about that, thanks.
Though this comment can be removed, because a test to which this comment is referring was added in #57567.
| columns_.begin(), columns_.end(), | ||
| [](const auto & col) { return col.name == "_sign" || col.name == "_version"; })) | ||
| { | ||
| throw Exception(ErrorCodes::LOGICAL_ERROR, |
There was a problem hiding this comment.
Can't user create a columns with such names somehow?
There was a problem hiding this comment.
Yes, he can of course, this code checks if they were added during ALTER query after MaterializedPostgreSQL table was created successfully as there. But it is written in doc that these column names are reserved for internal usage.
There was a problem hiding this comment.
Shouldn't it be another error code then LOGICAL_ERROR that indicated bug in out code?
| return; | ||
| } | ||
|
|
||
| auto log_table_structure_changed = [&](std::string_view reason) |
There was a problem hiding this comment.
I'm not entirely sure, but it seems like there might be a potential issue with the lifetime of the temporary std::string object returned by fmt::format.
| auto log_table_structure_changed = [&](std::string_view reason) | |
| auto log_table_structure_changed = [&](const std::string & reason) |
|
Looks like it breaks |
| columns.push_back(NameAndTypePair(std::get<0>(row), data_type)); | ||
| columns.push_back(NameAndTypePair(column_name, data_type)); | ||
| auto attgenerated = std::get<6>(row); | ||
| LOG_TEST(&Poco::Logger::get("kssenii"), "KSSENII: attgenerated: {}", attgenerated); |
`argMaxMany(N)(arg, val)` returns an `Array` of the N `arg` values corresponding to the N largest `val` values, sorted by `val` descending. `argMinMany(N)(arg, val)` is the symmetric counterpart: it returns the N `arg` values for the N smallest `val` values, sorted ascending. Null `val` values are skipped (consistent with `argMax`/`argMin`). When fewer than N rows are present all rows are returned. Motivation: ClickHouse#57568
`argMaxMany(N)(arg, val)` returns an `Array` of the N `arg` values corresponding to the N largest `val` values, sorted by `val` descending. `argMinMany(N)(arg, val)` is the symmetric counterpart: it returns the N `arg` values for the N smallest `val` values, sorted ascending. Null `val` values are skipped (consistent with `argMax`/`argMin`). When fewer than N rows are present all rows are returned. Motivation: ClickHouse#57568
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Support PostgreSQL generated columns and default column values in
MaterializedPostgreSQL. Closes #40449.