@@ -139,6 +139,10 @@ optional_ptr<CatalogEntry> Catalog::CreateTable(ClientContext &context, unique_p
139139
140140optional_ptr<CatalogEntry> Catalog::CreateTable (CatalogTransaction transaction, SchemaCatalogEntry &schema,
141141 BoundCreateTableInfo &info) {
142+ auto supports_create_table = SupportsCreateTable (info);
143+ if (supports_create_table.HasError ()) {
144+ supports_create_table.Throw ();
145+ }
142146 return schema.CreateTable (transaction, info);
143147}
144148
@@ -520,8 +524,7 @@ bool Catalog::TryAutoLoad(ClientContext &context, const string &original_name) n
520524 return true ;
521525 }
522526#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
523- auto &dbconfig = DBConfig::GetConfig (context);
524- if (!dbconfig.options .autoload_known_extensions ) {
527+ if (!Settings::Get<AutoloadKnownExtensionsSetting>(context)) {
525528 return false ;
526529 }
527530 try {
@@ -537,8 +540,7 @@ bool Catalog::TryAutoLoad(ClientContext &context, const string &original_name) n
537540
538541String Catalog::AutoloadExtensionByConfigName (ClientContext &context, const String &configuration_name) {
539542#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
540- auto &dbconfig = DBConfig::GetConfig (context);
541- if (dbconfig.options .autoload_known_extensions ) {
543+ if (Settings::Get<AutoloadKnownExtensionsSetting>(context)) {
542544 auto extension_name =
543545 ExtensionHelper::FindExtensionInEntries (configuration_name.ToStdString (), EXTENSION_SETTINGS);
544546 if (ExtensionHelper::CanAutoloadExtension (extension_name)) {
@@ -594,8 +596,7 @@ static bool CompareCatalogTypes(CatalogType type_a, CatalogType type_b) {
594596
595597bool Catalog::AutoLoadExtensionByCatalogEntry (DatabaseInstance &db, CatalogType type, const string &entry_name) {
596598#ifndef DUCKDB_DISABLE_EXTENSION_LOAD
597- auto &dbconfig = DBConfig::GetConfig (db);
598- if (dbconfig.options .autoload_known_extensions ) {
599+ if (Settings::Get<AutoloadKnownExtensionsSetting>(db)) {
599600 string extension_name;
600601 if (IsAutoloadableFunction (type)) {
601602 auto lookup_result = ExtensionHelper::FindExtensionInFunctionEntries (entry_name, EXTENSION_FUNCTIONS);
@@ -640,7 +641,7 @@ CatalogException Catalog::UnrecognizedConfigurationError(ClientContext &context,
640641 // the setting is not in an extension
641642 // get a list of all options
642643 vector<string> potential_names = DBConfig::GetOptionNames ();
643- for (auto &entry : DBConfig::GetConfig (context).extension_parameters ) {
644+ for (auto &entry : DBConfig::GetConfig (context).GetExtensionSettings () ) {
644645 potential_names.push_back (entry.first );
645646 }
646647 throw CatalogException::MissingEntry (" configuration parameter" , name, potential_names);
@@ -651,7 +652,7 @@ CatalogException Catalog::CreateMissingEntryException(CatalogEntryRetriever &ret
651652 const reference_set_t <SchemaCatalogEntry> &schemas) {
652653 auto &context = retriever.GetContext ();
653654 auto entries = SimilarEntriesInSchemas (context, lookup_info, schemas);
654- auto max_schema_count = DBConfig::GetSetting <CatalogErrorMaxSchemasSetting>(context);
655+ auto max_schema_count = Settings::Get <CatalogErrorMaxSchemasSetting>(context);
655656
656657 reference_set_t <SchemaCatalogEntry> unseen_schemas;
657658 auto &db_manager = DatabaseManager::Get (context);
@@ -1211,6 +1212,25 @@ optional_ptr<DependencyManager> Catalog::GetDependencyManager() {
12111212 return nullptr ;
12121213}
12131214
1215+ ErrorData Catalog::SupportsCreateTable (BoundCreateTableInfo &info) {
1216+ auto &base = info.Base ().Cast <CreateTableInfo>();
1217+ if (!base.partition_keys .empty ()) {
1218+ return ErrorData (
1219+ ExceptionType::CATALOG,
1220+ StringUtil::Format (" PARTITIONED BY is not supported for tables in a %s catalog" , GetCatalogType ()));
1221+ }
1222+ if (!base.sort_keys .empty ()) {
1223+ return ErrorData (ExceptionType::CATALOG,
1224+ StringUtil::Format (" SORTED BY is not supported for tables in a %s catalog" , GetCatalogType ()));
1225+ }
1226+ if (!base.options .empty ()) {
1227+ return ErrorData (
1228+ ExceptionType::CATALOG,
1229+ StringUtil::Format (" WITH clause is not supported for tables in a %s catalog" , GetCatalogType ()));
1230+ }
1231+ return ErrorData ();
1232+ }
1233+
12141234string Catalog::GetDefaultSchema () const {
12151235 return DEFAULT_SCHEMA;
12161236}
0 commit comments