mirror of https://github.com/postgres/postgres
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.0 KiB
63 lines
2.0 KiB
SET allow_in_place_tablespaces = true; CREATE TABLESPACE test_tblspace LOCATION '';
|
|
CREATE DATABASE tbc TABLESPACE = test_tblspace;
|
|
CREATE EXTENSION pg_tde;
|
|
SELECT pg_tde_add_database_key_provider_file('file-vault', '/tmp/key_rotate_tablespace.per');
|
|
pg_tde_add_database_key_provider_file
|
|
---------------------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT pg_tde_create_key_using_database_key_provider('test-db-key', 'file-vault');
|
|
pg_tde_create_key_using_database_key_provider
|
|
-----------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT pg_tde_set_key_using_database_key_provider('test-db-key', 'file-vault');
|
|
pg_tde_set_key_using_database_key_provider
|
|
--------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
CREATE TABLE country_table (
|
|
country_id serial primary key,
|
|
country_name text unique not null,
|
|
continent text not null
|
|
) USING tde_heap;
|
|
INSERT INTO country_table (country_name, continent)
|
|
VALUES ('Japan', 'Asia'),
|
|
('UK', 'Europe'),
|
|
('USA', 'North America');
|
|
SELECT * FROM country_table;
|
|
country_id | country_name | continent
|
|
------------+--------------+---------------
|
|
1 | Japan | Asia
|
|
2 | UK | Europe
|
|
3 | USA | North America
|
|
(3 rows)
|
|
|
|
SELECT pg_tde_create_key_using_database_key_provider('new-k', 'file-vault');
|
|
pg_tde_create_key_using_database_key_provider
|
|
-----------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
SELECT pg_tde_set_key_using_database_key_provider('new-k', 'file-vault');
|
|
pg_tde_set_key_using_database_key_provider
|
|
--------------------------------------------
|
|
|
|
(1 row)
|
|
|
|
-- server restart
|
|
SELECT * FROM country_table;
|
|
country_id | country_name | continent
|
|
------------+--------------+---------------
|
|
1 | Japan | Asia
|
|
2 | UK | Europe
|
|
3 | USA | North America
|
|
(3 rows)
|
|
|
|
DROP EXTENSION pg_tde CASCADE;
|
|
psql:<stdin>:1: NOTICE: drop cascades to table country_table
|
|
DROP DATABASE tbc;
|
|
DROP TABLESPACE test_tblspace;
|
|
|