mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
validate direct dictionary lifetime is unset during creation
This commit is contained in:
parent
8bc0a3a899
commit
006af1dfa1
@ -571,11 +571,23 @@ void checkPrimaryKey(const AttributeNameToConfiguration & all_attrs, const Names
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkLifetime(const ASTCreateQuery & query)
|
||||||
|
{
|
||||||
|
if (query.dictionary -> layout && query.dictionary->layout->layout_type == "direct") {
|
||||||
|
if (query.dictionary -> lifetime)
|
||||||
|
throw Exception(
|
||||||
|
ErrorCodes::BAD_ARGUMENTS,
|
||||||
|
"'lifetime' parameter is redundant for the dictionary' of layout '{}'",
|
||||||
|
query.dictionary->layout->layout_type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DictionaryConfigurationPtr
|
DictionaryConfigurationPtr
|
||||||
getDictionaryConfigurationFromAST(const ASTCreateQuery & query, ContextPtr context, const std::string & database_)
|
getDictionaryConfigurationFromAST(const ASTCreateQuery & query, ContextPtr context, const std::string & database_)
|
||||||
{
|
{
|
||||||
checkAST(query);
|
checkAST(query);
|
||||||
|
checkLifetime(query);
|
||||||
|
|
||||||
AutoPtr<Poco::XML::Document> xml_document(new Poco::XML::Document());
|
AutoPtr<Poco::XML::Document> xml_document(new Poco::XML::Document());
|
||||||
AutoPtr<Poco::XML::Element> document_root(xml_document->createElement("dictionaries"));
|
AutoPtr<Poco::XML::Element> document_root(xml_document->createElement("dictionaries"));
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS dict_source (key UInt64, value String) ENGINE=MergeTree ORDER BY key;
|
||||||
|
|
||||||
|
CREATE DICTIONARY dict(`key` UInt64,`value` String) PRIMARY KEY key SOURCE(CLICKHOUSE(table 'dict_source')) LAYOUT(DIRECT()) LIFETIME(0); -- { serverError 36 }
|
Loading…
Reference in New Issue
Block a user