duckdb 0.6.2-dev2405.0 → 0.6.2-dev2420.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "duckdb",
3
3
  "main": "./lib/duckdb.js",
4
4
  "types": "./lib/duckdb.d.ts",
5
- "version": "0.6.2-dev2405.0",
5
+ "version": "0.6.2-dev2420.0",
6
6
  "description": "DuckDB node.js API",
7
7
  "gypfile": true,
8
8
  "dependencies": {
@@ -1,8 +1,8 @@
1
1
  #ifndef DUCKDB_VERSION
2
- #define DUCKDB_VERSION "0.6.2-dev2405"
2
+ #define DUCKDB_VERSION "0.6.2-dev2420"
3
3
  #endif
4
4
  #ifndef DUCKDB_SOURCE_ID
5
- #define DUCKDB_SOURCE_ID "2eb46acc6e"
5
+ #define DUCKDB_SOURCE_ID "b3259573b1"
6
6
  #endif
7
7
  #include "duckdb/function/table/system_functions.hpp"
8
8
  #include "duckdb/main/database.hpp"
@@ -26,7 +26,23 @@ BindResult ExpressionBinder::BindExpression(FunctionExpression &function, idx_t
26
26
  return BindUnnest(function, depth);
27
27
  }
28
28
  auto func = Catalog::GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY, function.catalog, function.schema,
29
- function.function_name, false, error_context);
29
+ function.function_name, true, error_context);
30
+ if (!func) {
31
+ // function was not found - check if we this is a table function
32
+ auto table_func = Catalog::GetEntry(context, CatalogType::TABLE_FUNCTION_ENTRY, function.catalog,
33
+ function.schema, function.function_name, true, error_context);
34
+ if (table_func) {
35
+ throw BinderException(binder.FormatError(
36
+ function,
37
+ StringUtil::Format("Function \"%s\" is a table function but it was used as a scalar function. This "
38
+ "function has to be called in a FROM clause (similar to a table).",
39
+ function.function_name)));
40
+ }
41
+ // not a table function - search again without if_exists to throw the error
42
+ Catalog::GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY, function.catalog, function.schema,
43
+ function.function_name, false, error_context);
44
+ throw InternalException("Catalog::GetEntry for scalar function did not throw a second time");
45
+ }
30
46
 
31
47
  if (func->type != CatalogType::AGGREGATE_FUNCTION_ENTRY &&
32
48
  (function.distinct || function.filter || !function.order_bys->orders.empty())) {
@@ -31,11 +31,11 @@ void MainHeader::Serialize(Serializer &ser) {
31
31
  void MainHeader::CheckMagicBytes(FileHandle &handle) {
32
32
  data_t magic_bytes[MAGIC_BYTE_SIZE];
33
33
  if (handle.GetFileSize() < MainHeader::MAGIC_BYTE_SIZE + MainHeader::MAGIC_BYTE_OFFSET) {
34
- throw IOException("The file is not a valid DuckDB database file!");
34
+ throw IOException("The file \"%s\" exists, but it is not a valid DuckDB database file!", handle.path);
35
35
  }
36
36
  handle.Read(magic_bytes, MainHeader::MAGIC_BYTE_SIZE, MainHeader::MAGIC_BYTE_OFFSET);
37
37
  if (memcmp(magic_bytes, MainHeader::MAGIC_BYTES, MainHeader::MAGIC_BYTE_SIZE) != 0) {
38
- throw IOException("The file is not a valid DuckDB database file!");
38
+ throw IOException("The file \"%s\" exists, but it is not a valid DuckDB database file!", handle.path);
39
39
  }
40
40
  }
41
41