-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PG-979: Run SQL tests with both tde_heap and tde_heap_basic
- Loading branch information
Showing
69 changed files
with
4,016 additions
and
2,403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ __pycache__ | |
/Makefile | ||
/autom4te.cache | ||
/configure~ | ||
t/results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
\set tde_am tde_heap_basic | ||
\i sql/change_access_method.inc | ||
CREATE EXTENSION pg_tde; | ||
SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per'); | ||
pg_tde_add_key_provider_file | ||
------------------------------ | ||
1 | ||
(1 row) | ||
|
||
SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault'); | ||
pg_tde_set_principal_key | ||
-------------------------- | ||
t | ||
(1 row) | ||
|
||
CREATE TABLE country_table ( | ||
country_id serial primary key, | ||
country_name text unique not null, | ||
continent text not null | ||
) using :tde_am; | ||
|
||
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_is_encrypted('country_table'); | ||
pg_tde_is_encrypted | ||
--------------------- | ||
t | ||
(1 row) | ||
|
||
-- Try changing the encrypted table to an unencrypted table | ||
ALTER TABLE country_table SET access method heap; | ||
-- Insert some more data | ||
INSERT INTO country_table (country_name, continent) | ||
VALUES ('France', 'Europe'), | ||
('Germany', 'Europe'), | ||
('Canada', 'North America'); | ||
SELECT * FROM country_table; | ||
country_id | country_name | continent | ||
------------+--------------+--------------- | ||
1 | Japan | Asia | ||
2 | UK | Europe | ||
3 | USA | North America | ||
4 | France | Europe | ||
5 | Germany | Europe | ||
6 | Canada | North America | ||
(6 rows) | ||
|
||
SELECT pg_tde_is_encrypted('country_table'); | ||
pg_tde_is_encrypted | ||
--------------------- | ||
f | ||
(1 row) | ||
|
||
-- Change it back to encrypted | ||
ALTER TABLE country_table SET access method :tde_am; | ||
INSERT INTO country_table (country_name, continent) | ||
VALUES ('China', 'Asia'), | ||
('Brazil', 'South America'), | ||
('Australia', 'Oceania'); | ||
SELECT * FROM country_table; | ||
country_id | country_name | continent | ||
------------+--------------+--------------- | ||
1 | Japan | Asia | ||
2 | UK | Europe | ||
3 | USA | North America | ||
4 | France | Europe | ||
5 | Germany | Europe | ||
6 | Canada | North America | ||
7 | China | Asia | ||
8 | Brazil | South America | ||
9 | Australia | Oceania | ||
(9 rows) | ||
|
||
SELECT pg_tde_is_encrypted('country_table'); | ||
pg_tde_is_encrypted | ||
--------------------- | ||
t | ||
(1 row) | ||
|
||
DROP TABLE country_table; | ||
DROP EXTENSION pg_tde; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
\set tde_am tde_heap_basic | ||
\i sql/insert_update_delete.inc | ||
CREATE EXTENSION pg_tde; | ||
SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per'); | ||
pg_tde_add_key_provider_file | ||
------------------------------ | ||
1 | ||
(1 row) | ||
|
||
SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault'); | ||
pg_tde_set_principal_key | ||
-------------------------- | ||
t | ||
(1 row) | ||
|
||
CREATE TABLE albums ( | ||
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, | ||
artist VARCHAR(256), | ||
title TEXT NOT NULL, | ||
released DATE NOT NULL | ||
) USING :tde_am; | ||
INSERT INTO albums (artist, title, released) VALUES | ||
('Graindelavoix', 'Jisquin The Undead', '2021-06-12'), | ||
('Graindelavoix', 'Tenebrae Responsoria - Carlo Gesualdo', '2019-08-06'), | ||
('Graindelavoix', 'Cypriot Vespers', '2015-12-20'), | ||
('John Coltrane', 'Blue Train', '1957-09-15'), | ||
('V/A Analog Africa', 'Space Echo - The Mystery Behind the Cosmic Sound of Cabo Verde Finally Revealed', '2016-05-27'), | ||
('Incapacitants', 'As Loud As Possible', '2022-09-15'), | ||
('Chris Corsano & Bill Orcutt', 'Made Out Of Sound', '2021-03-26'), | ||
('Jürg Frey (Quatuor Bozzini / Konus Quartett)', 'Continuité, fragilité, résonance', '2023-04-01'), | ||
('clipping.', 'Visions of Bodies Being Burned', '2020-10-23'), | ||
('clipping.', 'There Existed an Addiction to Blood', '2019-10-19'), | ||
('Autechre', 'elseq 1–5', '2016-05-19'), | ||
('Decapitated', 'Winds of Creation', '2000-04-17'), | ||
('Ulthar', 'Anthronomicon', '2023-02-17'), | ||
('Τζίμης Πανούσης', 'Κάγκελα Παντού', '1986-01-01'), | ||
('Воплі Відоплясова', 'Музіка', '1997-01-01'); | ||
SELECT * FROM albums; | ||
id | artist | title | released | ||
----+----------------------------------------------+---------------------------------------------------------------------------------+------------ | ||
1 | Graindelavoix | Jisquin The Undead | 06-12-2021 | ||
2 | Graindelavoix | Tenebrae Responsoria - Carlo Gesualdo | 08-06-2019 | ||
3 | Graindelavoix | Cypriot Vespers | 12-20-2015 | ||
4 | John Coltrane | Blue Train | 09-15-1957 | ||
5 | V/A Analog Africa | Space Echo - The Mystery Behind the Cosmic Sound of Cabo Verde Finally Revealed | 05-27-2016 | ||
6 | Incapacitants | As Loud As Possible | 09-15-2022 | ||
7 | Chris Corsano & Bill Orcutt | Made Out Of Sound | 03-26-2021 | ||
8 | Jürg Frey (Quatuor Bozzini / Konus Quartett) | Continuité, fragilité, résonance | 04-01-2023 | ||
9 | clipping. | Visions of Bodies Being Burned | 10-23-2020 | ||
10 | clipping. | There Existed an Addiction to Blood | 10-19-2019 | ||
11 | Autechre | elseq 1–5 | 05-19-2016 | ||
12 | Decapitated | Winds of Creation | 04-17-2000 | ||
13 | Ulthar | Anthronomicon | 02-17-2023 | ||
14 | Τζίμης Πανούσης | Κάγκελα Παντού | 01-01-1986 | ||
15 | Воплі Відоплясова | Музіка | 01-01-1997 | ||
(15 rows) | ||
|
||
DELETE FROM albums WHERE id % 4 = 0; | ||
SELECT * FROM albums; | ||
id | artist | title | released | ||
----+-----------------------------+---------------------------------------------------------------------------------+------------ | ||
1 | Graindelavoix | Jisquin The Undead | 06-12-2021 | ||
2 | Graindelavoix | Tenebrae Responsoria - Carlo Gesualdo | 08-06-2019 | ||
3 | Graindelavoix | Cypriot Vespers | 12-20-2015 | ||
5 | V/A Analog Africa | Space Echo - The Mystery Behind the Cosmic Sound of Cabo Verde Finally Revealed | 05-27-2016 | ||
6 | Incapacitants | As Loud As Possible | 09-15-2022 | ||
7 | Chris Corsano & Bill Orcutt | Made Out Of Sound | 03-26-2021 | ||
9 | clipping. | Visions of Bodies Being Burned | 10-23-2020 | ||
10 | clipping. | There Existed an Addiction to Blood | 10-19-2019 | ||
11 | Autechre | elseq 1–5 | 05-19-2016 | ||
13 | Ulthar | Anthronomicon | 02-17-2023 | ||
14 | Τζίμης Πανούσης | Κάγκελα Παντού | 01-01-1986 | ||
15 | Воплі Відоплясова | Музіка | 01-01-1997 | ||
(12 rows) | ||
|
||
UPDATE albums SET title='Jisquin The Undead: Laments, Deplorations and Dances of Death', released='2021-10-01' WHERE id=1; | ||
UPDATE albums SET released='2020-04-01' WHERE id=2; | ||
SELECT * FROM albums; | ||
id | artist | title | released | ||
----+-----------------------------+---------------------------------------------------------------------------------+------------ | ||
3 | Graindelavoix | Cypriot Vespers | 12-20-2015 | ||
5 | V/A Analog Africa | Space Echo - The Mystery Behind the Cosmic Sound of Cabo Verde Finally Revealed | 05-27-2016 | ||
6 | Incapacitants | As Loud As Possible | 09-15-2022 | ||
7 | Chris Corsano & Bill Orcutt | Made Out Of Sound | 03-26-2021 | ||
9 | clipping. | Visions of Bodies Being Burned | 10-23-2020 | ||
10 | clipping. | There Existed an Addiction to Blood | 10-19-2019 | ||
11 | Autechre | elseq 1–5 | 05-19-2016 | ||
13 | Ulthar | Anthronomicon | 02-17-2023 | ||
14 | Τζίμης Πανούσης | Κάγκελα Παντού | 01-01-1986 | ||
15 | Воплі Відоплясова | Музіка | 01-01-1997 | ||
1 | Graindelavoix | Jisquin The Undead: Laments, Deplorations and Dances of Death | 10-01-2021 | ||
2 | Graindelavoix | Tenebrae Responsoria - Carlo Gesualdo | 04-01-2020 | ||
(12 rows) | ||
|
||
DROP TABLE albums; | ||
DROP EXTENSION pg_tde; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
\set tde_am tde_heap_basic | ||
\i sql/keyprovider_dependency.inc | ||
CREATE EXTENSION pg_tde; | ||
SELECT pg_tde_add_key_provider_file('mk-file','/tmp/pg_tde_test_keyring.per'); | ||
pg_tde_add_key_provider_file | ||
------------------------------ | ||
1 | ||
(1 row) | ||
|
||
SELECT pg_tde_add_key_provider_file('free-file','/tmp/pg_tde_test_keyring_2.per'); | ||
pg_tde_add_key_provider_file | ||
------------------------------ | ||
2 | ||
(1 row) | ||
|
||
SELECT pg_tde_add_key_provider_vault_v2('V2-vault','vault-token','percona.com/vault-v2/percona','/mount/dev','ca-cert-auth'); | ||
pg_tde_add_key_provider_vault_v2 | ||
---------------------------------- | ||
3 | ||
(1 row) | ||
|
||
SELECT * FROM pg_tde_list_all_key_providers(); | ||
id | provider_name | provider_type | options | ||
----+---------------+---------------+----------------------------------------------------------------------------------------------------------------------------------------------- | ||
1 | mk-file | file | {"type" : "file", "path" : "/tmp/pg_tde_test_keyring.per"} | ||
2 | free-file | file | {"type" : "file", "path" : "/tmp/pg_tde_test_keyring_2.per"} | ||
3 | V2-vault | vault-v2 | {"type" : "vault-v2", "url" : "percona.com/vault-v2/percona", "token" : "vault-token", "mountPath" : "/mount/dev", "caPath" : "ca-cert-auth"} | ||
(3 rows) | ||
|
||
SELECT pg_tde_set_principal_key('test-db-principal-key','mk-file'); | ||
pg_tde_set_principal_key | ||
-------------------------- | ||
t | ||
(1 row) | ||
|
||
DROP EXTENSION pg_tde; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.