mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #49043 from RoryCrispin/dict-lifetime-validation
Validate direct dictionary lifetime is unset during creation
This commit is contained in:
commit
b2b6720737
@ -572,11 +572,24 @@ 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
|
||||
getDictionaryConfigurationFromAST(const ASTCreateQuery & query, ContextPtr context, const std::string & database_)
|
||||
{
|
||||
checkAST(query);
|
||||
checkLifetime(query);
|
||||
|
||||
AutoPtr<Poco::XML::Document> xml_document(new Poco::XML::Document());
|
||||
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