Add an ability to reset custom setting to default and remove it from table's metadata.
This will allow to rollback the change without knowing the system/config's default.
Signed-off-by: Aleksei Semiglazov <asemiglazov@cloudflare.com>
add the FIRST keyword to the ADD INDEX command to be able to add index in the beginning of the list.
Signed-off-by: Aleksei Semiglazov <asemiglazov@cloudflare.com>
TODO (suggested by Nikolai)
1. Build query plan fro current query (inside storage::read) up to WithMergableState
2. Check, that plan is simple enough: Aggregating - Expression - Filter - ReadFromStorage (or simplier)
3. Check, that filter is the same as filter in projection, and also expression calculates the same aggregation keys as in projection
4. Return WithMergableState if projection applies
3 will be easier to do with ActionsDAG, cause it sees all functions, and dependencies are direct (but it is possible with ExpressionActions also)
Also need to figure out how prewhere works for projections, and
row_filter_policies.
wip
* Use only |name_parts| as primary name source
* Restore legacy logic for table restoration
* Fix build
* Fix tests
* Add pytest server config
* Fix tests
* Fixes due to review
This commit adds checks in place during table creation
and updates to ensure that we don't allow `CODEC` for
ALIAS (`default_type` column) like:
```sql
CREATE TABLE compression_codec_on_alias
(
`c0` ALIAS c1 CODEC(ZSTD),
`c1` UInt64
)
ENGINE = MergeTree()
PARTITION BY c0
ORDER BY c1;
```
After these safeguards in place, when trying to create/update column
codec, we will get excaptions like this:
```sql
-- create
CREATE TABLE compression_codec_on_alias
(
`c0` ALIAS c1 CODEC(ZSTD),
`c1` UInt64
)
ENGINE = MergeTree()
PARTITION BY c0
ORDER BY c1
Received exception from server (version 20.8.1):
Code: 377. DB::Exception: Received from localhost:9000. DB::Exception: Cannot specify codec for column type ALIAS.
0 rows in set. Elapsed: 0.006 sec.
-- modify
ALTER TABLE compression_codec_on_alias
ADD COLUMN `c3` ALIAS c2 CODEC(ZSTD) AFTER c2
Received exception from server (version 20.8.1):
Code: 377. DB::Exception: Received from localhost:9000. DB::Exception: Cannot specify codec for column type ALIAS.
0 rows in set. Elapsed: 0.005 sec.
```