diff --git a/Makefile.in b/Makefile.in index 33c45b60a02..c6dca6752d8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,7 +22,8 @@ insert_update_delete_basic \ keyprovider_dependency_basic \ vault_v2_test_basic \ alter_index_basic \ -merge_join_basic +merge_join_basic \ +tablespace_basic TAP_TESTS = 1 OBJS = src/encryption/enc_tde.o \ diff --git a/expected/tablespace.out b/expected/tablespace.out new file mode 100644 index 00000000000..0ffdd02fcbc --- /dev/null +++ b/expected/tablespace.out @@ -0,0 +1 @@ +// TODO \ No newline at end of file diff --git a/meson.build b/meson.build index acead4c453c..83afc2be142 100644 --- a/meson.build +++ b/meson.build @@ -126,6 +126,7 @@ if get_variable('percona_ext', false) 'trigger_on_view', 'change_access_method', 'insert_update_delete', + 'tablespace', 'vault_v2_test', 'alter_index', 'merge_join', diff --git a/sql/tablespace.sql b/sql/tablespace.sql new file mode 100644 index 00000000000..ecd7aa326db --- /dev/null +++ b/sql/tablespace.sql @@ -0,0 +1,26 @@ +CREATE EXTENSION pg_tde; + +SELECT * FROM pg_tde_principal_key_info(); + +SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per'); +SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault'); + + +CREATE TABLE test(num1 bigint, num2 double precision, t text); +INSERT INTO test(num1, num2, t) + SELECT round(random()*100), random(), 'text' + FROM generate_series(1, 10) s(i); +CREATE INDEX test_idx ON test(num1); + +SET allow_in_place_tablespaces = true; +CREATE TABLESPACE test_tblspace LOCATION ''; + +ALTER TABLE test SET TABLESPACE test_tblspace; +ALTER TABLE test SET TABLESPACE pg_default; + +REINDEX (TABLESPACE test_tblspace, CONCURRENTLY) TABLE test; +INSERT INTO test VALUES (10, 2); + +DROP TABLE test; +DROP TABLESPACE test_tblspace; +DROP EXTENSION pg_tde; diff --git a/src/access/pg_tde_slot.c b/src/access/pg_tde_slot.c index 6850d7115eb..1635b2e7ebb 100644 --- a/src/access/pg_tde_slot.c +++ b/src/access/pg_tde_slot.c @@ -531,6 +531,9 @@ PGTdeExecStoreBufferHeapTuple(Relation rel, if (rel->rd_rel->relkind != RELKIND_TOASTVALUE) { RelKeyData *key = get_current_slot_relation_key(bslot, rel); + + Assert(key != NULL); + slot_copytuple(bslot->decrypted_buffer, tuple); PG_TDE_DECRYPT_TUPLE_EX(tuple, (HeapTuple)bslot->decrypted_buffer, key, "ExecStoreBuffer"); tuple->t_data = ((HeapTuple)bslot->decrypted_buffer)->t_data;