Don't create Object type if use_json_alias_for_old_object_type=1 but allow_experimental_object_type=0

This commit is contained in:
avogar 2024-09-02 13:20:27 +00:00
parent a7d0a5991e
commit 457db103c0
3 changed files with 5 additions and 1 deletions

View File

@ -519,7 +519,7 @@ static DataTypePtr createJSON(const ASTPtr & arguments)
if (!context)
context = Context::getGlobalContextInstance();
if (context->getSettingsRef().use_json_alias_for_old_object_type)
if (context->getSettingsRef().allow_experimental_object_type && context->getSettingsRef().use_json_alias_for_old_object_type)
{
if (arguments && !arguments->children.empty())
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Experimental Object type doesn't support any arguments. If you want to use new JSON type, set setting allow_experimental_json_type = 1");

View File

@ -1,2 +1,3 @@
{"a":"42"} JSON
{"a":42} Object(\'json\')
{"a":"42"} JSON

View File

@ -6,3 +6,6 @@ set use_json_alias_for_old_object_type=1;
select '{"a" : 42}'::JSON as json, toTypeName(json);
select '{"a" : 42}'::JSON(max_dynamic_paths=100) as json, toTypeName(json); -- {serverError BAD_ARGUMENTS}
set allow_experimental_object_type = 0;
select materialize('{"a" : 42}')::JSON as json, toTypeName(json);