1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
# name: test/sql/attach/attach_encryption_block_header.test
# group: [attach]
# workaround - alternative verify always forces the latest storage
require no_alternative_verify
# We need httpfs to do encrypted writes
require httpfs
statement error
ATTACH '__TEST_DIR__/encrypted.duckdb' AS encrypted (ENCRYPTION_KEY '');
----
Binder Error: Not a valid key. A key cannot be empty
statement error
ATTACH '__TEST_DIR__/encrypted.duckdb' AS encrypted (ENCRYPTION_KEY 42);
----
Binder Error: "42" is not a valid key. A key must be of type VARCHAR
# We need httpfs to write encrypted database files
require httpfs
statement ok
ATTACH '__TEST_DIR__/encrypted.duckdb' AS encrypted (ENCRYPTION_KEY 'asdf');
statement ok
ATTACH '__TEST_DIR__/unencrypted.duckdb' (STORAGE_VERSION 'v1.0.0');
statement ok
CREATE OR REPLACE TABLE encrypted.tbl AS SELECT * FROM range(10) t(i);
statement ok
CREATE OR REPLACE TABLE unencrypted.tbl AS SELECT * FROM range(10) t(i);
query I
SELECT SUM(i) FROM encrypted.tbl
----
45
query I
SELECT SUM(i) FROM unencrypted.tbl
----
45
statement ok
DETACH encrypted
statement ok
DETACH unencrypted
statement error
ATTACH '__TEST_DIR__/encrypted.duckdb' AS encrypted
----
statement error
ATTACH '__TEST_DIR__/unencrypted.duckdb' AS unencrypted (ENCRYPTION_KEY 'asdf');
----
statement ok
ATTACH '__TEST_DIR__/unencrypted.duckdb';
statement ok
ATTACH '__TEST_DIR__/encrypted.duckdb' AS encrypted (ENCRYPTION_KEY 'asdf');
query I
SELECT SUM(i) FROM encrypted.tbl
----
45
query I
SELECT tags FROM duckdb_databases() WHERE database_name LIKE '%encrypted%' ORDER BY database_name;
----
{storage_version=v1.5.0+}
{storage_version=v1.0.0+}
statement ok
DETACH encrypted
statement ok
DETACH unencrypted
statement error
ATTACH '__TEST_DIR__/incompatible_parameters.duckdb' (ENCRYPTION_KEY 'asdf', STORAGE_VERSION 'v1.2.0');
----
Invalid Input Error: Explicit provided STORAGE_VERSION ("v1.2.0") and ENCRYPTION_KEY (storage >= v1.4.0) are not compatible
statement ok
ATTACH '__TEST_DIR__/compatible_parameters.duckdb' (ENCRYPTION_KEY 'asdf', STORAGE_VERSION 'v1.4.0');
|