diff --git a/.github/workflows/MainDistributionPipeline.yml b/.github/workflows/MainDistributionPipeline.yml index 15712c7c9..66c17d011 100644 --- a/.github/workflows/MainDistributionPipeline.yml +++ b/.github/workflows/MainDistributionPipeline.yml @@ -14,7 +14,7 @@ jobs: name: Build extension binaries uses: duckdb/extension-ci-tools/.github/workflows/_extension_distribution.yml@main with: - duckdb_version: dfd87550849406b1823812222ef92525724780d3 + duckdb_version: 326202015f4e5ed031c898ab1bc0860cd614cac1 ci_tools_version: main extension_name: postgres_scanner exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_mingw' @@ -27,7 +27,7 @@ jobs: uses: duckdb/extension-ci-tools/.github/workflows/_extension_deploy.yml@main secrets: inherit with: - duckdb_version: dfd87550849406b1823812222ef92525724780d3 + duckdb_version: 326202015f4e5ed031c898ab1bc0860cd614cac1 ci_tools_version: main extension_name: postgres_scanner exclude_archs: 'wasm_mvp;wasm_eh;wasm_threads;windows_amd64_mingw' diff --git a/database-connector b/database-connector index 81b374045..8cf8cf10b 160000 --- a/database-connector +++ b/database-connector @@ -1 +1 @@ -Subproject commit 81b3740451d17cddc8d6fd56b5d501785f2e9854 +Subproject commit 8cf8cf10b1221824f44031670cd1b66a016edbc3 diff --git a/duckdb b/duckdb index dfd875508..326202015 160000 --- a/duckdb +++ b/duckdb @@ -1 +1 @@ -Subproject commit dfd87550849406b1823812222ef92525724780d3 +Subproject commit 326202015f4e5ed031c898ab1bc0860cd614cac1 diff --git a/scripts/win_resources.patch b/scripts/win_resources.patch index ca35ead6a..f2a65b72e 100644 --- a/scripts/win_resources.patch +++ b/scripts/win_resources.patch @@ -1,8 +1,8 @@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 24afa3db42..d3f04aed2d 100644 +index 9dd2ea45d2..a583df2d9a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -130,7 +130,6 @@ if(WIN32 AND NOT MINGW) +@@ -132,7 +132,6 @@ if(WIN32 AND NOT MINGW) set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -D DUCKDB_DEV_ITERATION=\"${RC_DEV_ITERATION}\"") @@ -11,14 +11,14 @@ index 24afa3db42..d3f04aed2d 100644 install( diff --git a/tools/shell/CMakeLists.txt b/tools/shell/CMakeLists.txt -index 0d26359008..04c5c7f01f 100644 +index 7c376be703..956a2df514 100644 --- a/tools/shell/CMakeLists.txt +++ b/tools/shell/CMakeLists.txt -@@ -77,7 +77,6 @@ if(WIN32 AND NOT MINGW) +@@ -74,7 +74,6 @@ if(WIN32 AND NOT MINGW) "${CMAKE_RC_FLAGS} -D DUCKDB_DEV_ITERATION=\"${RC_DEV_ITERATION}\"") set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -D DUCKDB_COPYRIGHT_YEAR=\"${DUCKDB_COPYRIGHT_YEAR}\"") - target_sources(shell PRIVATE rc/duckdb.rc) - endif() - - set_target_properties(shell PROPERTIES OUTPUT_NAME duckdb) + # Opt into the Windows Segment Heap to avoid the default NT heap's lock + # contention under multi-threaded allocation (see #24027). CMake merges + # .manifest sources into the linker manifest via mt.exe. diff --git a/src/include/storage/postgres_catalog.hpp b/src/include/storage/postgres_catalog.hpp index 94a8c0f0b..a9cf029c0 100644 --- a/src/include/storage/postgres_catalog.hpp +++ b/src/include/storage/postgres_catalog.hpp @@ -47,7 +47,7 @@ class PostgresCatalog : public Catalog { string GetCatalogType() override { return "postgres"; } - string GetDefaultSchema() const override { + Identifier GetDefaultSchema() const override { return default_schema.empty() ? "public" : default_schema; } @@ -147,7 +147,7 @@ class PostgresCatalog : public Catalog { PostgresVersion version; PostgresSchemaSet schemas; shared_ptr connection_pool; - string default_schema; + Identifier default_schema; SecretStorageTable secret_storage_table; //! Overrides what the shell prompt displays for this catalog - see GetConnectDisplay string connect_display; diff --git a/src/postgres_attach.cpp b/src/postgres_attach.cpp index 67e633319..36d04a24f 100644 --- a/src/postgres_attach.cpp +++ b/src/postgres_attach.cpp @@ -22,7 +22,7 @@ struct AttachFunctionData : public TableFunctionData { }; static unique_ptr AttachBind(ClientContext &context, TableFunctionBindInput &input, - vector &return_types, vector &names) { + vector &return_types, vector &names) { auto result = make_uniq(); result->dsn = input.inputs[0].GetValue(); diff --git a/src/postgres_binary_copy.cpp b/src/postgres_binary_copy.cpp index dd3aeb235..4b951826d 100644 --- a/src/postgres_binary_copy.cpp +++ b/src/postgres_binary_copy.cpp @@ -157,7 +157,7 @@ static void PostgresBinaryReadScan(ClientContext &context, TableFunctionInput &d } static unique_ptr ReadPostgresBinaryBind(ClientContext &context, TableFunctionBindInput &input, - vector &return_types, vector &names) { + vector &return_types, vector &names) { auto result = make_uniq(); result->file_path = input.inputs[0].GetValue(); @@ -173,12 +173,12 @@ static unique_ptr ReadPostgresBinaryBind(ClientContext &context, T auto col_type_str = column_map[i].GetValue(); auto col_type = TransformStringToLogicalType(col_type_str, context); - names.push_back(col_name.GetIdentifierName()); + names.push_back(col_name); return_types.push_back(col_type); result->postgres_types.push_back(PostgresUtils::CreateEmptyPostgresType(col_type)); } - result->names = names; + result->names = IdentifiersToStrings(names); result->types = return_types; if (input.named_parameters.count("buffer_size")) { diff --git a/src/postgres_hstore.cpp b/src/postgres_hstore.cpp index c1fe02ada..860e74e18 100644 --- a/src/postgres_hstore.cpp +++ b/src/postgres_hstore.cpp @@ -216,10 +216,12 @@ void PostgresHstoreToJsonFun(DataChunk &args, ExpressionState &state, Vector &re void RegisterHstoreFunctions(ExtensionLoader &loader) { auto hstore_get = ScalarFunction("postgres_hstore_get", {LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::VARCHAR, PostgresHstoreGetFun); + hstore_get.SetFallible(); loader.RegisterFunction(hstore_get); auto hstore_to_json = ScalarFunction("postgres_hstore_to_json", {LogicalType::VARCHAR}, LogicalType::JSON(), PostgresHstoreToJsonFun); + hstore_to_json.SetFallible(); loader.RegisterFunction(hstore_to_json); } diff --git a/src/postgres_query.cpp b/src/postgres_query.cpp index 0da01f142..10f5e0a65 100644 --- a/src/postgres_query.cpp +++ b/src/postgres_query.cpp @@ -23,7 +23,7 @@ static bool ExtractFlag(TableFunctionBindInput &input, const string &name, bool } static unique_ptr PGQueryBind(ClientContext &context, TableFunctionBindInput &input, - vector &return_types, vector &names) { + vector &return_types, vector &names) { auto result = make_uniq(context); if (input.inputs[0].IsNull() || input.inputs[1].IsNull()) { @@ -99,11 +99,11 @@ static unique_ptr PGQueryBind(ClientContext &context, TableFunctio input.table_function.call_return_type = StatementReturnType::NOTHING; } return_types.emplace_back(LogicalType::BIGINT); - names.emplace_back("rowcount"); + names.emplace_back(Identifier("rowcount")); result->SetCatalog(pg_catalog); result->dsn = con.GetDSN(); result->types = return_types; - result->names = names; + result->names.emplace_back(names[0].GetIdentifierName()); result->read_only = false; result->sql = std::move(sql); result->use_transaction = use_transaction; @@ -136,7 +136,9 @@ static unique_ptr PGQueryBind(ClientContext &context, TableFunctio result->SetCatalog(pg_catalog); result->dsn = con.GetDSN(); result->types = return_types; - result->names = names; + for (auto &nm : names) { + result->names.emplace_back(nm.GetIdentifierName()); + } result->read_only = false; result->sql = std::move(sql); result->params = PostgresParameters(std::move(param_types), std::move(param_values)); diff --git a/src/postgres_scanner.cpp b/src/postgres_scanner.cpp index 7414cccbe..49d82257c 100644 --- a/src/postgres_scanner.cpp +++ b/src/postgres_scanner.cpp @@ -171,7 +171,7 @@ void PostgresBindData::SetTable(PostgresTableEntry &table) { } static unique_ptr PostgresBind(ClientContext &context, TableFunctionBindInput &input, - vector &return_types, vector &names) { + vector &return_types, vector &names) { auto bind_data = make_uniq(context); bind_data->dsn = input.inputs[0].GetValue(); @@ -186,7 +186,7 @@ static unique_ptr PostgresBind(ClientContext &context, TableFuncti bind_data->postgres_types = info->postgres_types; for (auto &col : info->create_info->columns.Logical()) { - names.push_back(col.GetName().GetIdentifierName()); + names.push_back(col.GetName()); return_types.push_back(col.GetType()); } bind_data->names = info->postgres_names; diff --git a/src/postgres_utils.cpp b/src/postgres_utils.cpp index de683b6bd..f3d405de8 100644 --- a/src/postgres_utils.cpp +++ b/src/postgres_utils.cpp @@ -371,9 +371,7 @@ LogicalType PostgresUtils::ToPostgresType(const LogicalType &input) { auto &type = StructType::GetChildType(input, c); new_types.push_back(make_pair(name, ToPostgresType(type))); } - auto result = LogicalType::STRUCT(std::move(new_types)); - result.SetAlias(input.GetAlias()); - return result; + return LogicalType::STRUCT(std::move(new_types)).WithAlias(input.GetAlias()); } case LogicalTypeId::TIMESTAMP_SEC: case LogicalTypeId::TIMESTAMP_MS: diff --git a/src/storage/postgres_catalog.cpp b/src/storage/postgres_catalog.cpp index 91f8f005e..f0aa3179f 100644 --- a/src/storage/postgres_catalog.cpp +++ b/src/storage/postgres_catalog.cpp @@ -89,7 +89,7 @@ PostgresCatalog::PostgresCatalog(ClientContext &ctx, AttachedDatabase &db_p, str : Catalog(db_p), attach_path(std::move(attach_path_p)), access_mode(access_mode), isolation_level(isolation_level), text_protocol_mode(text_protocol_mode), schemas(*this, schemas_to_load), connection_pool(make_shared_ptr(*this, ctx)), - default_schema(schemas_to_load.size() > 0 ? schemas_to_load[0] : std::string()), + default_schema(schemas_to_load.size() > 0 ? Identifier(schemas_to_load[0]) : Identifier()), secret_storage_table(std::move(secret_storage_table_p)), connect_display(std::move(connect_display_p)) { auto secret_entry = GetSecretEntry(ctx, secret_name); this->rds_token_config = PostgresAws::ExtractTokenConfigFromSecret(secret_entry); diff --git a/src/storage/postgres_clear_cache.cpp b/src/storage/postgres_clear_cache.cpp index 58cfa3bbd..980a45916 100644 --- a/src/storage/postgres_clear_cache.cpp +++ b/src/storage/postgres_clear_cache.cpp @@ -14,7 +14,7 @@ struct ClearCacheFunctionData : public TableFunctionData { }; static unique_ptr ClearCacheBind(ClientContext &context, TableFunctionBindInput &input, - vector &return_types, vector &names) { + vector &return_types, vector &names) { auto result = make_uniq(); return_types.push_back(LogicalType::BOOLEAN); names.emplace_back("Success"); diff --git a/src/storage/postgres_type_set.cpp b/src/storage/postgres_type_set.cpp index c92f25c26..3d5105df1 100644 --- a/src/storage/postgres_type_set.cpp +++ b/src/storage/postgres_type_set.cpp @@ -60,8 +60,7 @@ void PostgresTypeSet::CreateEnum(PostgresTransaction &transaction, PostgresResul for (idx_t enum_idx = 0; enum_idx < enum_count; enum_idx++) { duckdb_levels.SetValue(enum_idx, result.GetString(start_row + enum_idx, 3)); } - info.type = LogicalType::ENUM(duckdb_levels, enum_count); - info.type.SetAlias(info.GetTypeName().GetIdentifierName()); + info.type = LogicalType::ENUM(duckdb_levels, enum_count).WithAlias(info.GetTypeName().GetIdentifierName()); auto type_entry = make_shared_ptr(catalog, schema, info, postgres_type); CreateEntry(transaction, std::move(type_entry)); } @@ -128,8 +127,7 @@ void PostgresTypeSet::CreateCompositeType(PostgresTransaction &transaction, Post Identifier(type_name), PostgresUtils::TypeToLogicalType(&transaction, &schema, type_data, child_type))); postgres_type.children.push_back(std::move(child_type)); } - info.type = LogicalType::STRUCT(std::move(child_types)); - info.type.SetAlias(info.GetTypeName().GetIdentifierName()); + info.type = LogicalType::STRUCT(std::move(child_types)).WithAlias(info.GetTypeName().GetIdentifierName()); auto type_entry = make_shared_ptr(catalog, schema, info, postgres_type); CreateEntry(transaction, std::move(type_entry)); } @@ -207,7 +205,7 @@ optional_ptr PostgresTypeSet::CreateType(PostgresTransaction &tran auto create_sql = GetCreateTypeSQL(info); conn.Execute(transaction.GetContext(), create_sql); - info.type.SetAlias(info.GetTypeName().GetIdentifierName()); + info.type = info.type.WithAlias(info.GetTypeName().GetIdentifierName()); auto pg_type = PostgresUtils::CreateEmptyPostgresType(info.type); auto type_entry = make_shared_ptr(catalog, schema, info, pg_type); return CreateEntry(transaction, std::move(type_entry));