Skip to content

Commit 2df7d33

Browse files
committed
vendor: Update vendored sources to duckdb/duckdb@03dc8da
feat: include catalog and schema names in function serialization (duckdb/duckdb#17512) Bump HTTPFS again (duckdb/duckdb#17511) Update more extensions (duckdb/duckdb#17510) Remove spatial from OSX Relassert (duckdb/duckdb#17509) Fix typos (duckdb/duckdb#17478)
1 parent 6122e3f commit 2df7d33

File tree

11 files changed

+108
-32
lines changed

11 files changed

+108
-32
lines changed

src/duckdb/src/catalog/catalog_entry/scalar_function_catalog_entry.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#include "duckdb/catalog/catalog_entry/scalar_function_catalog_entry.hpp"
22
#include "duckdb/common/vector.hpp"
33
#include "duckdb/parser/parsed_data/alter_scalar_function_info.hpp"
4+
#include "duckdb/main/attached_database.hpp"
45

56
namespace duckdb {
67

78
ScalarFunctionCatalogEntry::ScalarFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema,
89
CreateScalarFunctionInfo &info)
910
: FunctionEntry(CatalogType::SCALAR_FUNCTION_ENTRY, catalog, schema, info), functions(info.functions) {
11+
for (auto &function : functions.functions) {
12+
function.catalog_name = catalog.GetAttached().GetName();
13+
function.schema_name = schema.name;
14+
}
1015
}
1116

1217
unique_ptr<CatalogEntry> ScalarFunctionCatalogEntry::AlterEntry(CatalogTransaction transaction, AlterInfo &info) {

src/duckdb/src/catalog/catalog_entry/table_function_catalog_entry.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#include "duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp"
22
#include "duckdb/parser/parsed_data/alter_table_function_info.hpp"
3+
#include "duckdb/main/attached_database.hpp"
34

45
namespace duckdb {
56

67
TableFunctionCatalogEntry::TableFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema,
78
CreateTableFunctionInfo &info)
89
: FunctionEntry(CatalogType::TABLE_FUNCTION_ENTRY, catalog, schema, info), functions(std::move(info.functions)) {
910
D_ASSERT(this->functions.Size() > 0);
11+
for (auto &function : functions.functions) {
12+
function.catalog_name = catalog.GetAttached().GetName();
13+
function.schema_name = schema.name;
14+
}
1015
}
1116

1217
unique_ptr<CatalogEntry> TableFunctionCatalogEntry::AlterEntry(CatalogTransaction transaction, AlterInfo &info) {

src/duckdb/src/common/exception/binder_exception.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,23 @@ BinderException BinderException::ColumnNotFound(const string &name, const vector
2323
StringUtil::Format("Referenced column \"%s\" not found in FROM clause!%s", name, candidate_str), extra_info);
2424
}
2525

26-
BinderException BinderException::NoMatchingFunction(const string &name, const vector<LogicalType> &arguments,
26+
BinderException BinderException::NoMatchingFunction(const string &catalog_name, const string &schema_name,
27+
const string &name, const vector<LogicalType> &arguments,
2728
const vector<string> &candidates) {
2829
auto extra_info = Exception::InitializeExtraInfo("NO_MATCHING_FUNCTION", optional_idx());
2930
// no matching function was found, throw an error
30-
string call_str = Function::CallToString(name, arguments);
31+
string call_str = Function::CallToString(catalog_name, schema_name, name, arguments);
3132
string candidate_str;
3233
for (auto &candidate : candidates) {
3334
candidate_str += "\t" + candidate + "\n";
3435
}
3536
extra_info["name"] = name;
37+
if (!catalog_name.empty()) {
38+
extra_info["catalog"] = catalog_name;
39+
}
40+
if (!schema_name.empty()) {
41+
extra_info["schema"] = schema_name;
42+
}
3643
extra_info["call"] = call_str;
3744
if (!candidates.empty()) {
3845
extra_info["candidates"] = StringUtil::Join(candidates, ",");

src/duckdb/src/function/function.cpp

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ SimpleFunction::~SimpleFunction() {
4949
}
5050

5151
string SimpleFunction::ToString() const {
52-
return Function::CallToString(name, arguments, varargs);
52+
return Function::CallToString(catalog_name, schema_name, name, arguments, varargs);
5353
}
5454

5555
bool SimpleFunction::HasVarArgs() const {
@@ -65,7 +65,7 @@ SimpleNamedParameterFunction::~SimpleNamedParameterFunction() {
6565
}
6666

6767
string SimpleNamedParameterFunction::ToString() const {
68-
return Function::CallToString(name, arguments, named_parameters);
68+
return Function::CallToString(catalog_name, schema_name, name, arguments, named_parameters);
6969
}
7070

7171
bool SimpleNamedParameterFunction::HasNamedParameters() const {
@@ -84,7 +84,7 @@ BaseScalarFunction::~BaseScalarFunction() {
8484
}
8585

8686
string BaseScalarFunction::ToString() const {
87-
return Function::CallToString(name, arguments, varargs, return_type);
87+
return Function::CallToString(catalog_name, schema_name, name, arguments, varargs, return_type);
8888
}
8989

9090
// add your initializer for new functions here
@@ -113,8 +113,18 @@ hash_t BaseScalarFunction::Hash() const {
113113
return hash;
114114
}
115115

116-
string Function::CallToString(const string &name, const vector<LogicalType> &arguments, const LogicalType &varargs) {
117-
string result = name + "(";
116+
static bool RequiresCatalogAndSchemaNamePrefix(const string &catalog_name, const string &schema_name) {
117+
return !catalog_name.empty() && catalog_name != SYSTEM_CATALOG && !schema_name.empty() &&
118+
schema_name != DEFAULT_SCHEMA;
119+
}
120+
121+
string Function::CallToString(const string &catalog_name, const string &schema_name, const string &name,
122+
const vector<LogicalType> &arguments, const LogicalType &varargs) {
123+
string result;
124+
if (RequiresCatalogAndSchemaNamePrefix(catalog_name, schema_name)) {
125+
result += catalog_name + "." + schema_name + ".";
126+
}
127+
result += name + "(";
118128
vector<string> string_arguments;
119129
for (auto &arg : arguments) {
120130
string_arguments.push_back(arg.ToString());
@@ -126,14 +136,16 @@ string Function::CallToString(const string &name, const vector<LogicalType> &arg
126136
return result + ")";
127137
}
128138

129-
string Function::CallToString(const string &name, const vector<LogicalType> &arguments, const LogicalType &varargs,
139+
string Function::CallToString(const string &catalog_name, const string &schema_name, const string &name,
140+
const vector<LogicalType> &arguments, const LogicalType &varargs,
130141
const LogicalType &return_type) {
131-
string result = CallToString(name, arguments, varargs);
142+
string result = CallToString(catalog_name, schema_name, name, arguments, varargs);
132143
result += " -> " + return_type.ToString();
133144
return result;
134145
}
135146

136-
string Function::CallToString(const string &name, const vector<LogicalType> &arguments,
147+
string Function::CallToString(const string &catalog_name, const string &schema_name, const string &name,
148+
const vector<LogicalType> &arguments,
137149
const named_parameter_type_map_t &named_parameters) {
138150
vector<string> input_arguments;
139151
input_arguments.reserve(arguments.size() + named_parameters.size());
@@ -143,7 +155,11 @@ string Function::CallToString(const string &name, const vector<LogicalType> &arg
143155
for (auto &kv : named_parameters) {
144156
input_arguments.push_back(StringUtil::Format("%s : %s", kv.first, kv.second.ToString()));
145157
}
146-
return StringUtil::Format("%s(%s)", name, StringUtil::Join(input_arguments, ", "));
158+
string prefix = "";
159+
if (RequiresCatalogAndSchemaNamePrefix(catalog_name, schema_name)) {
160+
prefix = StringUtil::Format("%s.%s.", catalog_name, schema_name);
161+
}
162+
return StringUtil::Format("%s%s(%s)", prefix, name, StringUtil::Join(input_arguments, ", "));
147163
}
148164

149165
void Function::EraseArgument(SimpleFunction &bound_function, vector<unique_ptr<Expression>> &arguments,

src/duckdb/src/function/function_binder.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,33 @@ vector<idx_t> FunctionBinder::BindFunctionsFromArguments(const string &name, Fun
106106
if (!best_function.IsValid()) {
107107
// no matching function was found, throw an error
108108
vector<string> candidates;
109+
string catalog_name;
110+
string schema_name;
109111
for (auto &f : functions.functions) {
112+
if (catalog_name.empty() && !f.catalog_name.empty()) {
113+
catalog_name = f.catalog_name;
114+
}
115+
if (schema_name.empty() && !f.schema_name.empty()) {
116+
schema_name = f.schema_name;
117+
}
110118
candidates.push_back(f.ToString());
111119
}
112-
error = ErrorData(BinderException::NoMatchingFunction(name, arguments, candidates));
120+
error = ErrorData(BinderException::NoMatchingFunction(catalog_name, schema_name, name, arguments, candidates));
113121
return candidate_functions;
114122
}
115123
candidate_functions.push_back(best_function.GetIndex());
116124
return candidate_functions;
117125
}
118126

119127
template <class T>
120-
optional_idx FunctionBinder::MultipleCandidateException(const string &name, FunctionSet<T> &functions,
128+
optional_idx FunctionBinder::MultipleCandidateException(const string &catalog_name, const string &schema_name,
129+
const string &name, FunctionSet<T> &functions,
121130
vector<idx_t> &candidate_functions,
122131
const vector<LogicalType> &arguments, ErrorData &error) {
123132
D_ASSERT(functions.functions.size() > 1);
124133
// there are multiple possible function definitions
125134
// throw an exception explaining which overloads are there
126-
string call_str = Function::CallToString(name, arguments);
135+
string call_str = Function::CallToString(catalog_name, schema_name, name, arguments);
127136
string candidate_str;
128137
for (auto &conf : candidate_functions) {
129138
T f = functions.GetFunctionByOffset(conf);
@@ -153,7 +162,10 @@ optional_idx FunctionBinder::BindFunctionFromArguments(const string &name, Funct
153162
throw ParameterNotResolvedException();
154163
}
155164
}
156-
return MultipleCandidateException(name, functions, candidate_functions, arguments, error);
165+
auto catalog_name = functions.functions.size() > 0 ? functions.functions[0].catalog_name : "";
166+
auto schema_name = functions.functions.size() > 0 ? functions.functions[0].schema_name : "";
167+
return MultipleCandidateException(catalog_name, schema_name, name, functions, candidate_functions, arguments,
168+
error);
157169
}
158170
return candidate_functions[0];
159171
}

src/duckdb/src/function/table/version/pragma_version.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#ifndef DUCKDB_PATCH_VERSION
2-
#define DUCKDB_PATCH_VERSION "0-dev3593"
2+
#define DUCKDB_PATCH_VERSION "0-dev3604"
33
#endif
44
#ifndef DUCKDB_MINOR_VERSION
55
#define DUCKDB_MINOR_VERSION 3
@@ -8,10 +8,10 @@
88
#define DUCKDB_MAJOR_VERSION 1
99
#endif
1010
#ifndef DUCKDB_VERSION
11-
#define DUCKDB_VERSION "v1.3.0-dev3593"
11+
#define DUCKDB_VERSION "v1.3.0-dev3604"
1212
#endif
1313
#ifndef DUCKDB_SOURCE_ID
14-
#define DUCKDB_SOURCE_ID "44d0856021"
14+
#define DUCKDB_SOURCE_ID "03dc8da3ea"
1515
#endif
1616
#include "duckdb/function/table/system_functions.hpp"
1717
#include "duckdb/main/database.hpp"

src/duckdb/src/include/duckdb/catalog/catalog_entry/aggregate_function_catalog_entry.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "duckdb/catalog/catalog_set.hpp"
1313
#include "duckdb/function/function.hpp"
1414
#include "duckdb/parser/parsed_data/create_aggregate_function_info.hpp"
15+
#include "duckdb/main/attached_database.hpp"
1516

1617
namespace duckdb {
1718

@@ -24,6 +25,10 @@ class AggregateFunctionCatalogEntry : public FunctionEntry {
2425
public:
2526
AggregateFunctionCatalogEntry(Catalog &catalog, SchemaCatalogEntry &schema, CreateAggregateFunctionInfo &info)
2627
: FunctionEntry(CatalogType::AGGREGATE_FUNCTION_ENTRY, catalog, schema, info), functions(info.functions) {
28+
for (auto &function : functions.functions) {
29+
function.catalog_name = catalog.GetAttached().GetName();
30+
function.schema_name = schema.name;
31+
}
2732
}
2833

2934
//! The aggregate functions

src/duckdb/src/include/duckdb/common/exception/binder_exception.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class BinderException : public Exception {
4444

4545
static BinderException ColumnNotFound(const string &name, const vector<string> &similar_bindings,
4646
QueryErrorContext context = QueryErrorContext());
47-
static BinderException NoMatchingFunction(const string &name, const vector<LogicalType> &arguments,
48-
const vector<string> &candidates);
47+
static BinderException NoMatchingFunction(const string &catalog_name, const string &schema_name, const string &name,
48+
const vector<LogicalType> &arguments, const vector<string> &candidates);
4949
static BinderException Unsupported(ParsedExpression &expr, const string &message);
5050
};
5151

src/duckdb/src/include/duckdb/function/function.hpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,24 @@ class Function {
105105
//! Additional Information to specify function from it's name
106106
string extra_info;
107107

108+
// Optional catalog name of the function
109+
string catalog_name;
110+
111+
// Optional schema name of the function
112+
string schema_name;
113+
108114
public:
109115
//! Returns the formatted string name(arg1, arg2, ...)
110-
DUCKDB_API static string CallToString(const string &name, const vector<LogicalType> &arguments,
116+
DUCKDB_API static string CallToString(const string &catalog_name, const string &schema_name, const string &name,
117+
const vector<LogicalType> &arguments,
111118
const LogicalType &varargs = LogicalType::INVALID);
112119
//! Returns the formatted string name(arg1, arg2..) -> return_type
113-
DUCKDB_API static string CallToString(const string &name, const vector<LogicalType> &arguments,
114-
const LogicalType &varargs, const LogicalType &return_type);
120+
DUCKDB_API static string CallToString(const string &catalog_name, const string &schema_name, const string &name,
121+
const vector<LogicalType> &arguments, const LogicalType &varargs,
122+
const LogicalType &return_type);
115123
//! Returns the formatted string name(arg1, arg2.., np1=a, np2=b, ...)
116-
DUCKDB_API static string CallToString(const string &name, const vector<LogicalType> &arguments,
124+
DUCKDB_API static string CallToString(const string &catalog_name, const string &schema_name, const string &name,
125+
const vector<LogicalType> &arguments,
117126
const named_parameter_type_map_t &named_parameters);
118127

119128
//! Used in the bind to erase an argument from a function

src/duckdb/src/include/duckdb/function/function_binder.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class FunctionBinder {
8484
const vector<LogicalType> &arguments, ErrorData &error);
8585

8686
template <class T>
87-
optional_idx MultipleCandidateException(const string &name, FunctionSet<T> &functions,
88-
vector<idx_t> &candidate_functions, const vector<LogicalType> &arguments,
89-
ErrorData &error);
87+
optional_idx MultipleCandidateException(const string &catalog_name, const string &schema_name, const string &name,
88+
FunctionSet<T> &functions, vector<idx_t> &candidate_functions,
89+
const vector<LogicalType> &arguments, ErrorData &error);
9090

9191
template <class T>
9292
optional_idx BindFunctionFromArguments(const string &name, FunctionSet<T> &functions,

0 commit comments

Comments
 (0)