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
|
# name: test/sql/attach/attach_new_compression.test
# description: Tests attaching database files and using new compression methods
# group: [attach]
statement ok
PRAGMA enable_verification
statement ok
ATTACH '__TEST_DIR__/test_new_compression.db' AS db1 (STORAGE_VERSION 'v1.0.0');
statement ok
SET force_compression='roaring'
statement ok
CREATE TABLE db1.tbl AS SELECT CASE WHEN i%2=0 THEN NULL ELSE i END i FROM range(10000) t(i);
statement ok
SET force_compression='zstd';
statement ok
CREATE TABLE db1.str_tbl AS SELECT STRING_AGG('long_string_' || i, '-') FROM range(1000) t(i);
# verify new compression methods are not used when attaching with a low storage version
query I
SELECT COUNT(*)>0 FROM pragma_storage_info('db1.tbl') WHERE compression='Roaring'
----
false
query I
SELECT COUNT(*)>0 FROM pragma_storage_info('db1.str_tbl') WHERE compression='ZSTD'
----
false
statement ok
DETACH db1
# attach with a new storage version and re-write the table
statement ok
ATTACH '__TEST_DIR__/test_new_compression.db' AS db1 (STORAGE_VERSION 'v1.2.0');
statement ok
SET force_compression='roaring'
statement ok
CREATE TABLE db1.tbl2 AS FROM db1.tbl
statement ok
CHECKPOINT db1
statement ok
SET force_compression='zstd';
statement ok
CREATE TABLE db1.str_tbl2 AS FROM db1.str_tbl
statement ok
CHECKPOINT db1
# roaring is used now
query I
SELECT COUNT(*)>0 FROM pragma_storage_info('db1.tbl2') WHERE compression='Roaring'
----
true
query I
SELECT COUNT(*)>0 FROM pragma_storage_info('db1.str_tbl2') WHERE compression='ZSTD'
----
true
|