Files
email-tracker/external/duckdb/test/extension/autoloading_copy_function.test
2025-10-24 19:21:19 -05:00

44 lines
1.3 KiB
SQL

# name: test/extension/autoloading_copy_function.test
# description: Tests for autoloading with copy functions
# group: [extension]
# This test assumes parquet to be available in the LOCAL_EXTENSION_REPO and NOT linked into duckdb statically
# -> this should be the case for our autoloading tests where we have the local_extension_repo variable set
require-env LOCAL_EXTENSION_REPO
require parquet
# Ensure we have a clean extension directory without any preinstalled extensions
statement ok
set extension_directory='__TEST_DIR__/autoloading_types'
### No autoloading nor installing: throw error with installation hint
statement ok
set autoload_known_extensions=false
statement ok
set autoinstall_known_extensions=false
statement maybe
copy (select 1337 as edgy_hacker_number) TO '__TEST_DIR__/test1337.parquet'
----
Catalog Error: Copy Function with name "parquet" is not in the catalog, but it exists in the parquet extension.
### With autoloading, install and correct repo
statement ok
set autoload_known_extensions=true
statement ok
set autoinstall_known_extensions=true
statement ok
set autoinstall_extension_repository='${LOCAL_EXTENSION_REPO}';
statement ok
copy (select 1337 as edgy_hacker_number) TO '__TEST_DIR__/test1337.parquet'
query I
select * from '__TEST_DIR__/test1337.parquet';
----
1337