Renamed access methods again

pull/209/head
Zsolt Parragi 1 year ago
parent a5bef05403
commit bf936b0a10
  1. 6
      README.md
  2. 2
      documentation/docs/release-notes/release-notes.md
  3. 8
      documentation/docs/test.md
  4. 4
      expected/change_access_method.out
  5. 2
      expected/insert_update_delete.out
  6. 2
      expected/move_large_tuples.out
  7. 4
      expected/multi_insert.out
  8. 2
      expected/non_sorted_off_compact.out
  9. 6
      expected/pg_tde_is_encrypted.out
  10. 6
      expected/test_issue_153_fix.out
  11. 2
      expected/toast_decrypt.out
  12. 6
      expected/toast_extended_storage.out
  13. 6
      expected/trigger_on_view.out
  14. 2
      expected/update_compare_indexes.out
  15. 2
      expected/vault_v2_test.out
  16. 10
      pg_tde--1.0.sql
  17. 4
      sql/change_access_method.sql
  18. 2
      sql/insert_update_delete.sql
  19. 2
      sql/move_large_tuples.sql
  20. 4
      sql/multi_insert.sql
  21. 2
      sql/non_sorted_off_compact.sql
  22. 2
      sql/pg_tde_is_encrypted.sql
  23. 6
      sql/test_issue_153_fix.sql
  24. 2
      sql/toast_decrypt.sql
  25. 6
      sql/toast_extended_storage.sql
  26. 6
      sql/trigger_on_view.sql
  27. 2
      sql/update_compare_indexes.sql
  28. 2
      sql/vault_v2_test.sql
  29. 4
      src/common/pg_tde_utils.c
  30. 2
      src/pg_tde_event_capture.c
  31. 2
      sysbench/oltp_common_tde.lua
  32. 4
      t/001_basic.pl
  33. 4
      t/002_rotate_key.pl
  34. 2
      t/003_remote_config.pl
  35. 2
      t/004_file_config.pl
  36. 2
      t/005_multiple_extensions.pl
  37. 2
      t/expected/001_basic.out
  38. 2
      t/expected/002_rotate_key.out
  39. 2
      t/expected/003_remote_config.out
  40. 2
      t/expected/004_file_config.out
  41. 2
      t/expected/005_multiple_extensions.out
  42. 16
      t/results/001_basic.out
  43. 25
      t/results/002_rotate_key.out
  44. 12
      t/results/003_remote_config.out
  45. 12
      t/results/004_file_config.out

@ -76,7 +76,7 @@ FUNCTION pg_tde_set_principal_key (
SELECT pg_tde_set_principal_key('my-principal-key','file');
```
7. You are all set to create encrypted tables. For that, specify `USING pg_tde_basic` access method in the `CREATE TABLE` statement.
7. You are all set to create encrypted tables. For that, specify `USING tde_heap_basic` access method in the `CREATE TABLE` statement.
**For example**:
```sql
CREATE TABLE albums (
@ -84,7 +84,7 @@ CREATE TABLE albums (
artist_id INTEGER,
title TEXT NOT NULL,
released DATE NOT NULL
) USING pg_tde_basic;
) USING tde_heap_basic;
```
## Build from source
@ -166,7 +166,7 @@ The extension provides the following helper functions:
### pg_tde_is_encrypted(tablename)
Returns `t` if the table is encrypted (uses the pg_tde_basic access method), or `f` otherwise.
Returns `t` if the table is encrypted (uses the tde_heap_basic access method), or `f` otherwise.
## Base commit

@ -6,7 +6,7 @@
## Beta (2024-06-30)
With this version, the access method for `pg_tde` extension is renamed `pg_tde_basic`. Use this access method name to create tables. Find guidelines in [Test TDE](../test.md) tutorial.
With this version, the access method for `pg_tde` extension is renamed `tde_heap_basic`. Use this access method name to create tables. Find guidelines in [Test TDE](../test.md) tutorial.
The Beta version introduces the following bug fixes and improvements:

@ -2,18 +2,18 @@
To check if the data is encrypted, do the following:
1. Create a table in the database for which you have [enabled `pg_tde`](setup.md). Enabling `pg_tde` extension creates the table access method `pg_tde_basic`. To enable data encryption, create the table using this access method as follows:
1. Create a table in the database for which you have [enabled `pg_tde`](setup.md). Enabling `pg_tde` extension creates the table access method `tde_heap_basic`. To enable data encryption, create the table using this access method as follows:
```sql
CREATE TABLE <table_name> (<field> <datatype>) USING pg_tde_basic;
CREATE TABLE <table_name> (<field> <datatype>) USING tde_heap_basic;
```
!!! hint
You can enable data encryption by default by setting the `default_table_access_method` to `pg_tde_basic`:
You can enable data encryption by default by setting the `default_table_access_method` to `tde_heap_basic`:
```sql
SET default_table_access_method = pg_tde_basic;
SET default_table_access_method = tde_heap_basic;
```
2. Run the following function:

@ -15,7 +15,7 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');
country_id serial primary key,
country_name text unique not null,
continent text not null
) using pg_tde_basic;
) using tde_heap_basic;
INSERT INTO country_table (country_name, continent)
VALUES ('Japan', 'Asia'),
@ -60,7 +60,7 @@ SELECT pg_tde_is_encrypted('country_table');
(1 row)
-- Change it back to encrypted
ALTER TABLE country_table SET access method pg_tde_basic;
ALTER TABLE country_table SET access method tde_heap_basic;
INSERT INTO country_table (country_name, continent)
VALUES ('China', 'Asia'),
('Brazil', 'South America'),

@ -16,7 +16,7 @@ CREATE TABLE albums (
artist VARCHAR(256),
title TEXT NOT NULL,
released DATE NOT NULL
) USING pg_tde_basic;
) USING tde_heap_basic;
INSERT INTO albums (artist, title, released) VALUES
('Graindelavoix', 'Jisquin The Undead', '2021-06-12'),
('Graindelavoix', 'Tenebrae Responsoria - Carlo Gesualdo', '2019-08-06'),

@ -16,7 +16,7 @@ CREATE TABLE sbtest2(
id SERIAL,
k TEXT STORAGE PLAIN,
PRIMARY KEY (id)
) USING pg_tde_basic;
) USING tde_heap_basic;
INSERT INTO sbtest2(k) VALUES(repeat('a', 2500));
INSERT INTO sbtest2(k) VALUES(repeat('b', 2500));
INSERT INTO sbtest2(k) VALUES(repeat('c', 2500));

@ -18,7 +18,7 @@ CREATE TABLE albums (
artist_id INTEGER,
title TEXT NOT NULL,
released DATE NOT NULL
) USING pg_tde_basic;
) USING tde_heap_basic;
COPY albums FROM stdin CSV HEADER;
SELECT * FROM albums;
album_id | artist_id | title | released
@ -69,7 +69,7 @@ CREATE TABLE Towns (
name TEXT NOT NULL,
department VARCHAR(4) NOT NULL,
UNIQUE (code, department)
) USING pg_tde_basic;
) USING tde_heap_basic;
COPY towns (id, code, article, name, department) FROM stdin;
SELECT count(*) FROM towns;
count

@ -19,7 +19,7 @@ CREATE TABLE sbtest1(
id SERIAL,
k INTEGER DEFAULT '0' NOT NULL,
PRIMARY KEY (id)
) USING pg_tde_basic;
) USING tde_heap_basic;
INSERT INTO sbtest1(k) VALUES
(1),
(2),

@ -19,7 +19,7 @@ CREATE TABLE test_enc(
id SERIAL,
k INTEGER DEFAULT '0' NOT NULL,
PRIMARY KEY (id)
) USING pg_tde_basic;
) USING tde_heap_basic;
CREATE TABLE test_norm(
id SERIAL,
k INTEGER DEFAULT '0' NOT NULL,
@ -27,8 +27,8 @@ CREATE TABLE test_norm(
) USING heap;
SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE relname = 'test_enc';
amname
--------------
pg_tde_basic
----------------
tde_heap_basic
(1 row)
SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE relname = 'test_norm';

@ -32,7 +32,7 @@ CREATE TABLE dept (
deptno NUMERIC(2) NOT NULL CONSTRAINT dept_pk PRIMARY KEY,
dname VARCHAR(14) CONSTRAINT dept_dname_uq UNIQUE,
loc VARCHAR(13)
)using pg_tde_basic;
)using tde_heap_basic;
--
-- Create the 'emp' table
--
@ -46,7 +46,7 @@ CREATE TABLE emp (
comm NUMERIC(7,2),
deptno NUMERIC(2) CONSTRAINT emp_ref_dept_fk
REFERENCES dept(deptno)
)using pg_tde_basic;
)using tde_heap_basic;
--
-- Create the 'jobhist' table
--
@ -65,7 +65,7 @@ CREATE TABLE jobhist (
CONSTRAINT jobhist_ref_dept_fk FOREIGN KEY (deptno)
REFERENCES dept (deptno) ON DELETE SET NULL,
CONSTRAINT jobhist_date_chk CHECK (startdate <= enddate)
)using pg_tde_basic;
)using tde_heap_basic;
--
-- Create the 'salesemp' view
--

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -14,7 +14,7 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');
--
-- 2 -- Test triggers on a join view
--
SET default_table_access_method TO 'pg_tde_basic';
SET default_table_access_method TO 'tde_heap_basic';
DROP VIEW IF EXISTS city_view CASCADE;
NOTICE: view "city_view" does not exist, skipping
DROP TABLE IF exists country_table CASCADE;
@ -25,7 +25,7 @@ NOTICE: table "city_table" does not exist, skipping
country_id serial primary key,
country_name text unique not null,
continent text not null
) using pg_tde_basic;
) using tde_heap_basic;
INSERT INTO country_table (country_name, continent)
VALUES ('Japan', 'Asia'),
@ -45,7 +45,7 @@ NOTICE: table "city_table" does not exist, skipping
city_name text not null,
population bigint,
country_id int references country_table
) using pg_tde_basic;
) using tde_heap_basic;
CREATE VIEW city_view AS
SELECT city_id, city_name, population, country_name, continent

@ -13,7 +13,7 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');
DROP TABLE IF EXISTS pvactst;
NOTICE: table "pvactst" does not exist, skipping
CREATE TABLE pvactst (i INT, a INT[], p POINT) USING pg_tde_basic;
CREATE TABLE pvactst (i INT, a INT[], p POINT) USING tde_heap_basic;
INSERT INTO pvactst SELECT i, array[1,2,3], point(i, i+1) FROM generate_series(1,1000) i;
CREATE INDEX spgist_pvactst ON pvactst USING spgist (p);
UPDATE pvactst SET i = i WHERE i < 1000;

@ -16,7 +16,7 @@ CREATE TABLE test_enc(
id SERIAL,
k INTEGER DEFAULT '0' NOT NULL,
PRIMARY KEY (id)
) USING pg_tde_basic;
) USING tde_heap_basic;
INSERT INTO test_enc (k) VALUES (1);
INSERT INTO test_enc (k) VALUES (2);
INSERT INTO test_enc (k) VALUES (3);

@ -129,7 +129,7 @@ SELECT EXISTS (
SELECT 1
FROM pg_catalog.pg_class
WHERE relname = table_name
AND relam = (SELECT oid FROM pg_catalog.pg_am WHERE amname = 'pg_tde_basic')
AND relam = (SELECT oid FROM pg_catalog.pg_am WHERE amname = 'tde_heap_basic')
)$$
LANGUAGE SQL;
@ -199,8 +199,8 @@ LANGUAGE SQL;
CREATE FUNCTION pg_tde_version() RETURNS TEXT AS 'MODULE_PATHNAME' LANGUAGE C;
-- Access method
CREATE ACCESS METHOD pg_tde_basic TYPE TABLE HANDLER pg_tdeam_basic_handler;
COMMENT ON ACCESS METHOD pg_tde_basic IS 'pg_tde table access method';
CREATE ACCESS METHOD tde_heap_basic TYPE TABLE HANDLER pg_tdeam_basic_handler;
COMMENT ON ACCESS METHOD tde_heap_basic IS 'pg_tde table access method';
DO $$
BEGIN
@ -210,8 +210,8 @@ DO $$
AS 'MODULE_PATHNAME'
LANGUAGE C;
CREATE ACCESS METHOD pg_tde TYPE TABLE HANDLER pg_tdeam_handler;
COMMENT ON ACCESS METHOD pg_tde IS 'pg_tde table access method';
CREATE ACCESS METHOD tde_heap TYPE TABLE HANDLER pg_tdeam_handler;
COMMENT ON ACCESS METHOD tde_heap IS 'tde_heap table access method';
CREATE OR REPLACE FUNCTION pg_tde_ddl_command_start_capture()
RETURNS event_trigger

@ -7,7 +7,7 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');
country_id serial primary key,
country_name text unique not null,
continent text not null
) using pg_tde_basic;
) using tde_heap_basic;
INSERT INTO country_table (country_name, continent)
VALUES ('Japan', 'Asia'),
@ -30,7 +30,7 @@ SELECT * FROM country_table;
SELECT pg_tde_is_encrypted('country_table');
-- Change it back to encrypted
ALTER TABLE country_table SET access method pg_tde_basic;
ALTER TABLE country_table SET access method tde_heap_basic;
INSERT INTO country_table (country_name, continent)
VALUES ('China', 'Asia'),

@ -8,7 +8,7 @@ CREATE TABLE albums (
artist VARCHAR(256),
title TEXT NOT NULL,
released DATE NOT NULL
) USING pg_tde_basic;
) USING tde_heap_basic;
INSERT INTO albums (artist, title, released) VALUES
('Graindelavoix', 'Jisquin The Undead', '2021-06-12'),

@ -8,7 +8,7 @@ CREATE TABLE sbtest2(
id SERIAL,
k TEXT STORAGE PLAIN,
PRIMARY KEY (id)
) USING pg_tde_basic;
) USING tde_heap_basic;
INSERT INTO sbtest2(k) VALUES(repeat('a', 2500));
INSERT INTO sbtest2(k) VALUES(repeat('b', 2500));

@ -10,7 +10,7 @@ CREATE TABLE albums (
artist_id INTEGER,
title TEXT NOT NULL,
released DATE NOT NULL
) USING pg_tde_basic;
) USING tde_heap_basic;
COPY albums FROM stdin CSV HEADER;
album_id,artist_id,title,released
@ -56,7 +56,7 @@ CREATE TABLE Towns (
name TEXT NOT NULL,
department VARCHAR(4) NOT NULL,
UNIQUE (code, department)
) USING pg_tde_basic;
) USING tde_heap_basic;
COPY towns (id, code, article, name, department) FROM stdin;
1 001 some_text Abergement-Clémenciat 01

@ -10,7 +10,7 @@ CREATE TABLE sbtest1(
id SERIAL,
k INTEGER DEFAULT '0' NOT NULL,
PRIMARY KEY (id)
) USING pg_tde_basic;
) USING tde_heap_basic;
INSERT INTO sbtest1(k) VALUES
(1),

@ -9,7 +9,7 @@ CREATE TABLE test_enc(
id SERIAL,
k INTEGER DEFAULT '0' NOT NULL,
PRIMARY KEY (id)
) USING pg_tde_basic;
) USING tde_heap_basic;
CREATE TABLE test_norm(
id SERIAL,

@ -22,7 +22,7 @@ CREATE TABLE dept (
deptno NUMERIC(2) NOT NULL CONSTRAINT dept_pk PRIMARY KEY,
dname VARCHAR(14) CONSTRAINT dept_dname_uq UNIQUE,
loc VARCHAR(13)
)using pg_tde_basic;
)using tde_heap_basic;
--
-- Create the 'emp' table
--
@ -36,7 +36,7 @@ CREATE TABLE emp (
comm NUMERIC(7,2),
deptno NUMERIC(2) CONSTRAINT emp_ref_dept_fk
REFERENCES dept(deptno)
)using pg_tde_basic;
)using tde_heap_basic;
--
-- Create the 'jobhist' table
--
@ -55,7 +55,7 @@ CREATE TABLE jobhist (
CONSTRAINT jobhist_ref_dept_fk FOREIGN KEY (deptno)
REFERENCES dept (deptno) ON DELETE SET NULL,
CONSTRAINT jobhist_date_chk CHECK (startdate <= enddate)
)using pg_tde_basic;
)using tde_heap_basic;
--
-- Create the 'salesemp' view
--

@ -3,7 +3,7 @@ CREATE EXTENSION pg_tde;
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 src (f1 TEXT STORAGE EXTERNAL) USING pg_tde_basic;
CREATE TABLE src (f1 TEXT STORAGE EXTERNAL) USING tde_heap_basic;
INSERT INTO src VALUES(repeat('abcdeF',1000));
SELECT * FROM src;

File diff suppressed because one or more lines are too long

@ -6,7 +6,7 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');
--
-- 2 -- Test triggers on a join view
--
SET default_table_access_method TO 'pg_tde_basic';
SET default_table_access_method TO 'tde_heap_basic';
DROP VIEW IF EXISTS city_view CASCADE;
DROP TABLE IF exists country_table CASCADE;
@ -16,7 +16,7 @@ DROP TABLE IF exists city_table cascade;
country_id serial primary key,
country_name text unique not null,
continent text not null
) using pg_tde_basic;
) using tde_heap_basic;
INSERT INTO country_table (country_name, continent)
VALUES ('Japan', 'Asia'),
@ -29,7 +29,7 @@ DROP TABLE IF exists city_table cascade;
city_name text not null,
population bigint,
country_id int references country_table
) using pg_tde_basic;
) using tde_heap_basic;
CREATE VIEW city_view AS
SELECT city_id, city_name, population, country_name, continent

@ -4,7 +4,7 @@ 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');
DROP TABLE IF EXISTS pvactst;
CREATE TABLE pvactst (i INT, a INT[], p POINT) USING pg_tde_basic;
CREATE TABLE pvactst (i INT, a INT[], p POINT) USING tde_heap_basic;
INSERT INTO pvactst SELECT i, array[1,2,3], point(i, i+1) FROM generate_series(1,1000) i;
CREATE INDEX spgist_pvactst ON pvactst USING spgist (p);
UPDATE pvactst SET i = i WHERE i < 1000;

@ -8,7 +8,7 @@ CREATE TABLE test_enc(
id SERIAL,
k INTEGER DEFAULT '0' NOT NULL,
PRIMARY KEY (id)
) USING pg_tde_basic;
) USING tde_heap_basic;
INSERT INTO test_enc (k) VALUES (1);
INSERT INTO test_enc (k) VALUES (2);

@ -31,13 +31,13 @@
Oid
get_tde_basic_table_am_oid(void)
{
return get_table_am_oid("pg_tde_basic", false);
return get_table_am_oid("tde_heap_basic", false);
}
Oid
get_tde_table_am_oid(void)
{
return get_table_am_oid("pg_tde", false);
return get_table_am_oid("tde_heap", false);
}
/*

@ -101,7 +101,7 @@ pg_tde_ddl_command_start_capture(PG_FUNCTION_ARGS)
tdeCurrentCreateEvent.eventType = TDE_TABLE_CREATE_EVENT;
tdeCurrentCreateEvent.relation = stmt->relation;
if (stmt->accessMethod && !strcmp(stmt->accessMethod, "pg_tde"))
if (stmt->accessMethod && !strcmp(stmt->accessMethod, "tde_heap"))
{
tdeCurrentCreateEvent.encryptMode = true;
}

@ -191,7 +191,7 @@ CREATE TABLE sbtest%d(
c CHAR(120) DEFAULT '' NOT NULL,
pad CHAR(60) DEFAULT '' NOT NULL,
%s (id)
) USING pg_tde_basic %s %s]],
) USING tde_heap_basic %s %s]],
table_num, id_def, id_index_def, engine_def, extra_table_options)
con:query(query)

@ -31,7 +31,7 @@ ok($cmdret == 0, "CREATE PGTDE EXTENSION");
PGTDE::append_to_file($stdout);
$rt_value = $node->psql('postgres', 'CREATE TABLE test_enc(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;', extra_params => ['-a']);
$rt_value = $node->psql('postgres', 'CREATE TABLE test_enc(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;', extra_params => ['-a']);
ok($rt_value == 3, "Failing query");
@ -45,7 +45,7 @@ ok($rt_value == 1, "Restart Server");
$rt_value = $node->psql('postgres', "SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per');", extra_params => ['-a']);
$rt_value = $node->psql('postgres', "SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');", extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc(id SERIAL,k VARCHAR(32),PRIMARY KEY (id)) USING pg_tde_basic;', extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc(id SERIAL,k VARCHAR(32),PRIMARY KEY (id)) USING tde_heap_basic;', extra_params => ['-a']);
PGTDE::append_to_file($stdout);
$stdout = $node->safe_psql('postgres', 'INSERT INTO test_enc (k) VALUES (\'foobar\'),(\'barfoo\');', extra_params => ['-a']);

@ -31,7 +31,7 @@ ok($cmdret == 0, "CREATE PGTDE EXTENSION");
PGTDE::append_to_file($stdout);
$rt_value = $node->psql('postgres', 'CREATE TABLE test_enc(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;', extra_params => ['-a']);
$rt_value = $node->psql('postgres', 'CREATE TABLE test_enc(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;', extra_params => ['-a']);
ok($rt_value == 3, "Failing query");
@ -46,7 +46,7 @@ $rt_value = $node->psql('postgres', "SELECT pg_tde_add_key_provider_file('file-v
$rt_value = $node->psql('postgres', "SELECT pg_tde_add_key_provider_file('file-2','/tmp/pg_tde_test_keyring_2.per');", extra_params => ['-a']);
$rt_value = $node->psql('postgres', "SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault');", extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;', extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;', extra_params => ['-a']);
PGTDE::append_to_file($stdout);
$stdout = $node->safe_psql('postgres', 'INSERT INTO test_enc (k) VALUES (5),(6);', extra_params => ['-a']);

@ -73,7 +73,7 @@ PGTDE::append_to_file($stdout);
$rt_value = $node->psql('postgres', "SELECT pg_tde_add_key_provider_file('file-provider', json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8888/hello' ));", extra_params => ['-a']);
$rt_value = $node->psql('postgres', "SELECT pg_tde_set_principal_key('test-db-principal-key','file-provider');", extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc2(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;', extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc2(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;', extra_params => ['-a']);
PGTDE::append_to_file($stdout);
$stdout = $node->safe_psql('postgres', 'INSERT INTO test_enc2 (k) VALUES (5),(6);', extra_params => ['-a']);

@ -37,7 +37,7 @@ PGTDE::append_to_file($stdout);
$rt_value = $node->psql('postgres', "SELECT pg_tde_add_key_provider_file('file-provider', json_object( 'type' VALUE 'file', 'path' VALUE '/tmp/datafile-location' ));", extra_params => ['-a']);
$rt_value = $node->psql('postgres', "SELECT pg_tde_set_principal_key('test-db-principal-key','file-provider');", extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;', extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;', extra_params => ['-a']);
PGTDE::append_to_file($stdout);
$stdout = $node->safe_psql('postgres', 'INSERT INTO test_enc1 (k) VALUES (5),(6);', extra_params => ['-a']);

@ -89,7 +89,7 @@ PGTDE::append_to_debug_file($stdout);
$rt_value = $node->psql('postgres', "SELECT pg_tde_add_key_provider_file('file-provider', json_object( 'type' VALUE 'file', 'path' VALUE '/tmp/datafile-location' ));", extra_params => ['-a']);
$rt_value = $node->psql('postgres', "SELECT pg_tde_set_principal_key('test-db-principal-key','file-provider');", extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;', extra_params => ['-a']);
$stdout = $node->safe_psql('postgres', 'CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;', extra_params => ['-a']);
PGTDE::append_to_file($stdout);
$stdout = $node->safe_psql('postgres', 'INSERT INTO test_enc1 (k) VALUES (5),(6);', extra_params => ['-a']);

@ -1,6 +1,6 @@
CREATE EXTENSION pg_tde;
-- server restart
CREATE TABLE test_enc(id SERIAL,k VARCHAR(32),PRIMARY KEY (id)) USING pg_tde_basic;
CREATE TABLE test_enc(id SERIAL,k VARCHAR(32),PRIMARY KEY (id)) USING tde_heap_basic;
INSERT INTO test_enc (k) VALUES ('foobar'),('barfoo');
SELECT * FROM test_enc ORDER BY id ASC;
1|foobar

@ -1,6 +1,6 @@
CREATE EXTENSION pg_tde;
-- server restart
CREATE TABLE test_enc(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;
CREATE TABLE test_enc(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;
INSERT INTO test_enc (k) VALUES (5),(6);
SELECT * FROM test_enc ORDER BY id ASC;
1|5

@ -1,5 +1,5 @@
CREATE EXTENSION pg_tde;
CREATE TABLE test_enc2(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;
CREATE TABLE test_enc2(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;
INSERT INTO test_enc2 (k) VALUES (5),(6);
SELECT * FROM test_enc2 ORDER BY id ASC;
1|5

@ -1,5 +1,5 @@
CREATE EXTENSION pg_tde;
CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;
CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;
INSERT INTO test_enc1 (k) VALUES (5),(6);
SELECT * FROM test_enc1 ORDER BY id ASC;
1|5

@ -1,5 +1,5 @@
CREATE EXTENSION pg_tde;
CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING pg_tde_basic;
CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;
INSERT INTO test_enc1 (k) VALUES (5),(6);
SELECT * FROM test_enc1 ORDER BY id ASC;
1|5

@ -0,0 +1,16 @@
CREATE EXTENSION pg_tde;
-- server restart
CREATE TABLE test_enc(id SERIAL,k VARCHAR(32),PRIMARY KEY (id)) USING tde_heap_basic;
INSERT INTO test_enc (k) VALUES ('foobar'),('barfoo');
SELECT * FROM test_enc ORDER BY id ASC;
1|foobar
2|barfoo
-- server restart
SELECT * FROM test_enc ORDER BY id ASC;
1|foobar
2|barfoo
TABLEFILE FOUND: yes
CONTAINS FOO (should be empty):
DROP TABLE test_enc;
DROP EXTENSION pg_tde;

@ -0,0 +1,25 @@
CREATE EXTENSION pg_tde;
-- server restart
CREATE TABLE test_enc(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;
INSERT INTO test_enc (k) VALUES (5),(6);
SELECT * FROM test_enc ORDER BY id ASC;
1|5
2|6
-- ROTATE KEY pg_tde_rotate_principal_key('rotated-principal-key','file-2');
SELECT * FROM test_enc ORDER BY id ASC;
1|5
2|6
-- server restart
SELECT * FROM test_enc ORDER BY id ASC;
1|5
2|6
-- ROTATE KEY pg_tde_rotate_principal_key();
SELECT * FROM test_enc ORDER BY id ASC;
1|5
2|6
-- server restart
SELECT * FROM test_enc ORDER BY id ASC;
1|5
2|6
DROP TABLE test_enc;
DROP EXTENSION pg_tde;

@ -0,0 +1,12 @@
CREATE EXTENSION pg_tde;
CREATE TABLE test_enc2(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;
INSERT INTO test_enc2 (k) VALUES (5),(6);
SELECT * FROM test_enc2 ORDER BY id ASC;
1|5
2|6
-- server restart
SELECT * FROM test_enc2 ORDER BY id ASC;
1|5
2|6
DROP TABLE test_enc2;
DROP EXTENSION pg_tde;

@ -0,0 +1,12 @@
CREATE EXTENSION pg_tde;
CREATE TABLE test_enc1(id SERIAL,k INTEGER,PRIMARY KEY (id)) USING tde_heap_basic;
INSERT INTO test_enc1 (k) VALUES (5),(6);
SELECT * FROM test_enc1 ORDER BY id ASC;
1|5
2|6
-- server restart
SELECT * FROM test_enc1 ORDER BY id ASC;
1|5
2|6
DROP TABLE test_enc1;
DROP EXTENSION pg_tde;
Loading…
Cancel
Save