mirror of https://github.com/postgres/postgres
This improves readbility of diffs a lot.pull/220/head
parent
908d0776ba
commit
832cbb4f4d
@ -1,16 +1,32 @@ |
||||
CREATE EXTENSION IF NOT EXISTS pg_tde; |
||||
SELECT pg_tde_add_database_key_provider_file('file-provider', json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8888/hello' )); |
||||
1 |
||||
pg_tde_add_database_key_provider_file |
||||
--------------------------------------- |
||||
1 |
||||
(1 row) |
||||
|
||||
SELECT pg_tde_set_key_using_database_key_provider('test-db-key','file-provider'); |
||||
pg_tde_set_key_using_database_key_provider |
||||
-------------------------------------------- |
||||
|
||||
(1 row) |
||||
|
||||
CREATE TABLE test_enc2(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap; |
||||
INSERT INTO test_enc2 (k) VALUES (5),(6); |
||||
SELECT * FROM test_enc2 ORDER BY id ASC; |
||||
1|5 |
||||
2|6 |
||||
id | k |
||||
----+--- |
||||
1 | 5 |
||||
2 | 6 |
||||
(2 rows) |
||||
|
||||
-- server restart |
||||
SELECT * FROM test_enc2 ORDER BY id ASC; |
||||
1|5 |
||||
2|6 |
||||
id | k |
||||
----+--- |
||||
1 | 5 |
||||
2 | 6 |
||||
(2 rows) |
||||
|
||||
DROP TABLE test_enc2; |
||||
DROP EXTENSION pg_tde; |
||||
|
@ -1,16 +1,32 @@ |
||||
CREATE EXTENSION IF NOT EXISTS pg_tde; |
||||
SELECT pg_tde_add_database_key_provider_file('file-provider', json_object( 'type' VALUE 'file', 'path' VALUE '/tmp/datafile-location' )); |
||||
1 |
||||
pg_tde_add_database_key_provider_file |
||||
--------------------------------------- |
||||
1 |
||||
(1 row) |
||||
|
||||
SELECT pg_tde_set_key_using_database_key_provider('test-db-key','file-provider'); |
||||
pg_tde_set_key_using_database_key_provider |
||||
-------------------------------------------- |
||||
|
||||
(1 row) |
||||
|
||||
CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap; |
||||
INSERT INTO test_enc1 (k) VALUES (5),(6); |
||||
SELECT * FROM test_enc1 ORDER BY id ASC; |
||||
1|5 |
||||
2|6 |
||||
id | k |
||||
----+--- |
||||
1 | 5 |
||||
2 | 6 |
||||
(2 rows) |
||||
|
||||
-- server restart |
||||
SELECT * FROM test_enc1 ORDER BY id ASC; |
||||
1|5 |
||||
2|6 |
||||
id | k |
||||
----+--- |
||||
1 | 5 |
||||
2 | 6 |
||||
(2 rows) |
||||
|
||||
DROP TABLE test_enc1; |
||||
DROP EXTENSION pg_tde; |
||||
|
@ -1,16 +1,32 @@ |
||||
CREATE EXTENSION IF NOT EXISTS pg_tde; |
||||
SELECT pg_tde_add_database_key_provider_vault_v2('vault-provider', json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8889/token' ), json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8889/url' ), to_json('secret'::text), NULL); |
||||
1 |
||||
pg_tde_add_database_key_provider_vault_v2 |
||||
------------------------------------------- |
||||
1 |
||||
(1 row) |
||||
|
||||
SELECT pg_tde_set_key_using_database_key_provider('test-db-key','vault-provider'); |
||||
pg_tde_set_key_using_database_key_provider |
||||
-------------------------------------------- |
||||
|
||||
(1 row) |
||||
|
||||
CREATE TABLE test_enc2(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap; |
||||
INSERT INTO test_enc2 (k) VALUES (5),(6); |
||||
SELECT * FROM test_enc2 ORDER BY id ASC; |
||||
1|5 |
||||
2|6 |
||||
id | k |
||||
----+--- |
||||
1 | 5 |
||||
2 | 6 |
||||
(2 rows) |
||||
|
||||
-- server restart |
||||
SELECT * FROM test_enc2 ORDER BY id ASC; |
||||
1|5 |
||||
2|6 |
||||
id | k |
||||
----+--- |
||||
1 | 5 |
||||
2 | 6 |
||||
(2 rows) |
||||
|
||||
DROP TABLE test_enc2; |
||||
DROP EXTENSION pg_tde; |
||||
|
@ -1,49 +1,85 @@ |
||||
CREATE EXTENSION IF NOT EXISTS pg_tde; |
||||
SELECT pg_tde_add_global_key_provider_file('file-keyring-010','/tmp/pg_tde_test_keyring010.per'); |
||||
-1 |
||||
pg_tde_add_global_key_provider_file |
||||
------------------------------------- |
||||
-1 |
||||
(1 row) |
||||
|
||||
SELECT pg_tde_set_server_key_using_global_key_provider('server-key', 'file-keyring-010'); |
||||
pg_tde_set_server_key_using_global_key_provider |
||||
------------------------------------------------- |
||||
|
||||
(1 row) |
||||
|
||||
ALTER SYSTEM SET pg_tde.wal_encrypt = on; |
||||
-- server restart with wal encryption |
||||
SHOW pg_tde.wal_encrypt; |
||||
on |
||||
pg_tde.wal_encrypt |
||||
-------------------- |
||||
on |
||||
(1 row) |
||||
|
||||
SELECT slot_name FROM pg_create_logical_replication_slot('tde_slot', 'test_decoding'); |
||||
tde_slot |
||||
slot_name |
||||
----------- |
||||
tde_slot |
||||
(1 row) |
||||
|
||||
CREATE TABLE test_wal (id SERIAL, k INTEGER, PRIMARY KEY (id)); |
||||
INSERT INTO test_wal (k) VALUES (1), (2); |
||||
ALTER SYSTEM SET pg_tde.wal_encrypt = off; |
||||
-- server restart without wal encryption |
||||
SHOW pg_tde.wal_encrypt; |
||||
off |
||||
pg_tde.wal_encrypt |
||||
-------------------- |
||||
off |
||||
(1 row) |
||||
|
||||
INSERT INTO test_wal (k) VALUES (3), (4); |
||||
ALTER SYSTEM SET pg_tde.wal_encrypt = on; |
||||
-- server restart with wal encryption |
||||
SHOW pg_tde.wal_encrypt; |
||||
on |
||||
pg_tde.wal_encrypt |
||||
-------------------- |
||||
on |
||||
(1 row) |
||||
|
||||
INSERT INTO test_wal (k) VALUES (5), (6); |
||||
-- server restart with still wal encryption |
||||
SHOW pg_tde.wal_encrypt; |
||||
on |
||||
pg_tde.wal_encrypt |
||||
-------------------- |
||||
on |
||||
(1 row) |
||||
|
||||
INSERT INTO test_wal (k) VALUES (7), (8); |
||||
SELECT data FROM pg_logical_slot_get_changes('tde_slot', NULL, NULL); |
||||
BEGIN 739 |
||||
COMMIT 739 |
||||
BEGIN 740 |
||||
table public.test_wal: INSERT: id[integer]:1 k[integer]:1 |
||||
table public.test_wal: INSERT: id[integer]:2 k[integer]:2 |
||||
COMMIT 740 |
||||
BEGIN 741 |
||||
table public.test_wal: INSERT: id[integer]:3 k[integer]:3 |
||||
table public.test_wal: INSERT: id[integer]:4 k[integer]:4 |
||||
COMMIT 741 |
||||
BEGIN 742 |
||||
table public.test_wal: INSERT: id[integer]:5 k[integer]:5 |
||||
table public.test_wal: INSERT: id[integer]:6 k[integer]:6 |
||||
COMMIT 742 |
||||
BEGIN 743 |
||||
table public.test_wal: INSERT: id[integer]:7 k[integer]:7 |
||||
table public.test_wal: INSERT: id[integer]:8 k[integer]:8 |
||||
COMMIT 743 |
||||
data |
||||
----------------------------------------------------------- |
||||
BEGIN 739 |
||||
COMMIT 739 |
||||
BEGIN 740 |
||||
table public.test_wal: INSERT: id[integer]:1 k[integer]:1 |
||||
table public.test_wal: INSERT: id[integer]:2 k[integer]:2 |
||||
COMMIT 740 |
||||
BEGIN 741 |
||||
table public.test_wal: INSERT: id[integer]:3 k[integer]:3 |
||||
table public.test_wal: INSERT: id[integer]:4 k[integer]:4 |
||||
COMMIT 741 |
||||
BEGIN 742 |
||||
table public.test_wal: INSERT: id[integer]:5 k[integer]:5 |
||||
table public.test_wal: INSERT: id[integer]:6 k[integer]:6 |
||||
COMMIT 742 |
||||
BEGIN 743 |
||||
table public.test_wal: INSERT: id[integer]:7 k[integer]:7 |
||||
table public.test_wal: INSERT: id[integer]:8 k[integer]:8 |
||||
COMMIT 743 |
||||
(18 rows) |
||||
|
||||
SELECT pg_drop_replication_slot('tde_slot'); |
||||
pg_drop_replication_slot |
||||
-------------------------- |
||||
|
||||
(1 row) |
||||
|
||||
DROP EXTENSION pg_tde; |
||||
|
Loading…
Reference in new issue