13
13
#include < Interpreters/DatabaseCatalog.h>
14
14
#include < base/getFQDNOrHostName.h>
15
15
#include < Common/scope_guard_safe.h>
16
- #include < Interpreters/UserDefinedSQLObjectsLoader.h>
17
16
#include < Interpreters/Session.h>
18
17
#include < Access/AccessControl.h>
19
18
#include < Common/Exception.h>
32
31
#include < Parsers/IAST.h>
33
32
#include < Parsers/ASTInsertQuery.h>
34
33
#include < Common/ErrorHandlers.h>
34
+ #include < Functions/UserDefined/IUserDefinedSQLObjectsLoader.h>
35
35
#include < Functions/registerFunctions.h>
36
36
#include < AggregateFunctions/registerAggregateFunctions.h>
37
37
#include < TableFunctions/registerTableFunctions.h>
@@ -602,21 +602,13 @@ void LocalServer::processConfig()
602
602
global_context->setCurrentDatabase (default_database);
603
603
applyCmdOptions (global_context);
604
604
605
- bool enable_objects_loader = false ;
606
-
607
605
if (config ().has (" path" ))
608
606
{
609
607
String path = global_context->getPath ();
610
608
611
609
// / Lock path directory before read
612
610
status.emplace (fs::path (path) / " status" , StatusFile::write_full_info);
613
611
614
- LOG_DEBUG (log , " Loading user defined objects from {}" , path);
615
- Poco::File (path + " user_defined/" ).createDirectories ();
616
- UserDefinedSQLObjectsLoader::instance ().loadObjects (global_context);
617
- enable_objects_loader = true ;
618
- LOG_DEBUG (log , " Loaded user defined objects." );
619
-
620
612
LOG_DEBUG (log , " Loading metadata from {}" , path);
621
613
loadMetadataSystem (global_context);
622
614
attachSystemTablesLocal (global_context, *createMemoryDatabaseIfNotExists (global_context, DatabaseCatalog::SYSTEM_DATABASE));
@@ -630,6 +622,9 @@ void LocalServer::processConfig()
630
622
DatabaseCatalog::instance ().loadDatabases ();
631
623
}
632
624
625
+ // / For ClickHouse local if path is not set the loader will be disabled.
626
+ global_context->getUserDefinedSQLObjectsLoader ().loadObjects ();
627
+
633
628
LOG_DEBUG (log , " Loaded metadata." );
634
629
}
635
630
else if (!config ().has (" no-system-tables" ))
@@ -639,9 +634,6 @@ void LocalServer::processConfig()
639
634
attachInformationSchema (global_context, *createMemoryDatabaseIfNotExists (global_context, DatabaseCatalog::INFORMATION_SCHEMA_UPPERCASE));
640
635
}
641
636
642
- // / Persist SQL user defined objects only if user_defined folder was created
643
- UserDefinedSQLObjectsLoader::instance ().enable (enable_objects_loader);
644
-
645
637
server_display_name = config ().getString (" display_name" , getFQDNOrHostName ());
646
638
prompt_by_server_display_name = config ().getRawString (" prompt_by_server_display_name.default" , " {display_name} :) " );
647
639
std::map<String, String> prompt_substitutions{{" display_name" , server_display_name}};
0 commit comments