I see support for MODIFY_PRIMARY_KEY in ASTAlterQuery.h
https://github.com/yandex/ClickHouse/blob/72d65029ff7cf32ea1894f6cb39d2bb26a25e49b/dbms/src/Parsers/ASTAlterQuery.h#L27
but i dont see manuals how to use it...
(I'm looking at https://github.com/yandex/ClickHouse/blob/72d65029ff7cf32ea1894f6cb39d2bb26a25e49b/dbms/src/Parsers/ASTAlterQuery.h#L11 and https://clickhouse.yandex/docs/en/single/)
UP:
I find code parsing for MODIFY_PRIMARY_KEY https://github.com/yandex/ClickHouse/blob/2a9088060227f0d63957b95fcb12c9a9e71517a4/dbms/src/Interpreters/InterpreterAlterQuery.cpp#L166 but https://github.com/yandex/ClickHouse/issues/147 dont closed...can i use it in production?
And how can I be sure that primary key has been modified after execution code (DESCRIBE TABLE ${TABLENAME} dont have info about primary key and i did not find it in tables of system database)
Generally it's something very specific. You can't really change primary key columns with that command. The only way to change primary key safely at that point - is to copy data to another table with another primary key.
ALTER TABLE xxx MODIFY PRIMARY KEY (...) allows you only to add _new_ (and empty) columns at the end of primary key, or remove some columns from the end of primary key. So generally the operations tgat does not require real data reordering.
Check the test:
https://github.com/yandex/ClickHouse/blob/master/dbms/tests/queries/0_stateless/00329_alter_primary_key.sql
and reference results
https://github.com/yandex/ClickHouse/blob/master/dbms/tests/queries/0_stateless/00329_alter_primary_key.reference
Support for MODIFY PRIMARY KEY undocumented feature was removed.
Most helpful comment
Generally it's something very specific. You can't really change primary key columns with that command. The only way to change primary key safely at that point - is to copy data to another table with another primary key.
ALTER TABLE xxx MODIFY PRIMARY KEY (...)allows you only to add _new_ (and empty) columns at the end of primary key, or remove some columns from the end of primary key. So generally the operations tgat does not require real data reordering.Check the test:
https://github.com/yandex/ClickHouse/blob/master/dbms/tests/queries/0_stateless/00329_alter_primary_key.sql
and reference results
https://github.com/yandex/ClickHouse/blob/master/dbms/tests/queries/0_stateless/00329_alter_primary_key.reference