diff --git a/.gitignore b/.gitignore index 684ce242..d7aeb36f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ __pycache__ /Makefile /autom4te.cache /configure~ +t/results diff --git a/Makefile.in b/Makefile.in index 21ede5e2..c5c818f0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -6,19 +6,19 @@ EXTENSION = pg_tde DATA = pg_tde--1.0.sql REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/pg_tde/pg_tde.conf -REGRESS = toast_decrypt \ -toast_extended_storage \ -move_large_tuples \ -non_sorted_off_compact \ -update_compare_indexes \ -pg_tde_is_encrypted \ -test_issue_153_fix \ -multi_insert \ -trigger_on_view \ -change_access_method \ -insert_update_delete \ -keyprovider_dependency \ -vault_v2_test +REGRESS = toast_decrypt_basic \ +toast_extended_storage_basic \ +move_large_tuples_basic \ +non_sorted_off_compact_basic \ +update_compare_indexes_basic \ +pg_tde_is_encrypted_basic \ +test_issue_153_fix_basic \ +multi_insert_basic \ +trigger_on_view_basic \ +change_access_method_basic \ +insert_update_delete_basic \ +keyprovider_dependency_basic \ +vault_v2_test_basic TAP_TESTS = 1 OBJS = src/encryption/enc_tde.o \ diff --git a/expected/change_access_method.out b/expected/change_access_method.out index f24cf6b8..9e86ebf2 100644 --- a/expected/change_access_method.out +++ b/expected/change_access_method.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\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 @@ -11,13 +13,13 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault'); t (1 row) - CREATE TABLE country_table ( +CREATE TABLE country_table ( country_id serial primary key, country_name text unique not null, continent text not null - ) using tde_heap_basic; +) using :tde_am; - INSERT INTO country_table (country_name, continent) +INSERT INTO country_table (country_name, continent) VALUES ('Japan', 'Asia'), ('UK', 'Europe'), ('USA', 'North America'); @@ -60,7 +62,7 @@ SELECT pg_tde_is_encrypted('country_table'); (1 row) -- Change it back to encrypted -ALTER TABLE country_table SET access method tde_heap_basic; +ALTER TABLE country_table SET access method :tde_am; INSERT INTO country_table (country_name, continent) VALUES ('China', 'Asia'), ('Brazil', 'South America'), diff --git a/expected/change_access_method_basic.out b/expected/change_access_method_basic.out new file mode 100644 index 00000000..e5c0bb7f --- /dev/null +++ b/expected/change_access_method_basic.out @@ -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; diff --git a/expected/insert_update_delete.out b/expected/insert_update_delete.out index 7e9ab60b..0a363b67 100644 --- a/expected/insert_update_delete.out +++ b/expected/insert_update_delete.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\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 @@ -16,7 +18,7 @@ CREATE TABLE albums ( artist VARCHAR(256), title TEXT NOT NULL, released DATE NOT NULL -) USING tde_heap_basic; +) 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'), diff --git a/expected/insert_update_delete_basic.out b/expected/insert_update_delete_basic.out new file mode 100644 index 00000000..6ca59cae --- /dev/null +++ b/expected/insert_update_delete_basic.out @@ -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; diff --git a/expected/keyprovider_dependency.out b/expected/keyprovider_dependency.out index d02736dc..7254b08d 100644 --- a/expected/keyprovider_dependency.out +++ b/expected/keyprovider_dependency.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\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 diff --git a/expected/keyprovider_dependency_basic.out b/expected/keyprovider_dependency_basic.out new file mode 100644 index 00000000..f0613a83 --- /dev/null +++ b/expected/keyprovider_dependency_basic.out @@ -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; diff --git a/expected/move_large_tuples.out b/expected/move_large_tuples.out index a86c0734..9ffac997 100644 --- a/expected/move_large_tuples.out +++ b/expected/move_large_tuples.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\i sql/move_large_tuples.inc -- test pg_tde_move_encrypted_data() CREATE EXTENSION pg_tde; SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per'); @@ -16,7 +18,7 @@ CREATE TABLE sbtest2( id SERIAL, k TEXT STORAGE PLAIN, PRIMARY KEY (id) - ) USING tde_heap_basic; + ) USING :tde_am; INSERT INTO sbtest2(k) VALUES(repeat('a', 2500)); INSERT INTO sbtest2(k) VALUES(repeat('b', 2500)); INSERT INTO sbtest2(k) VALUES(repeat('c', 2500)); diff --git a/expected/move_large_tuples_basic.out b/expected/move_large_tuples_basic.out new file mode 100644 index 00000000..6d1e235e --- /dev/null +++ b/expected/move_large_tuples_basic.out @@ -0,0 +1,61 @@ +\set tde_am tde_heap_basic +\i sql/move_large_tuples.inc +-- test pg_tde_move_encrypted_data() +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 sbtest2( + id SERIAL, + k TEXT STORAGE PLAIN, + PRIMARY KEY (id) + ) USING :tde_am; +INSERT INTO sbtest2(k) VALUES(repeat('a', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('b', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('c', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('d', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('e', 2500)); +DELETE FROM sbtest2 WHERE id IN (2,3,4); +VACUUM sbtest2; +SELECT * FROM sbtest2; + id | k +----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 1 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + 5 | eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +(2 rows) + +INSERT INTO sbtest2(k) VALUES(repeat('b', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('c', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('d', 2500)); +DELETE FROM sbtest2 WHERE id IN (7); +VACUUM sbtest2; +SELECT * FROM sbtest2; + id | k +----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 1 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + 6 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + 8 | dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd + 5 | eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +(4 rows) + +VACUUM FULL sbtest2; +SELECT * FROM sbtest2; + id | k +----+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + 1 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + 6 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + 8 | dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd + 5 | eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee +(4 rows) + +DROP TABLE sbtest2; +DROP EXTENSION pg_tde; diff --git a/expected/multi_insert.out b/expected/multi_insert.out index 4d359a72..feb9ad35 100644 --- a/expected/multi_insert.out +++ b/expected/multi_insert.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\i sql/multi_insert.inc -- trigger multi_insert path -- CREATE EXTENSION pg_tde; @@ -18,7 +20,7 @@ CREATE TABLE albums ( artist_id INTEGER, title TEXT NOT NULL, released DATE NOT NULL -) USING tde_heap_basic; +) USING :tde_am; COPY albums FROM stdin CSV HEADER; SELECT * FROM albums; album_id | artist_id | title | released @@ -69,7 +71,7 @@ CREATE TABLE Towns ( name TEXT NOT NULL, department VARCHAR(4) NOT NULL, UNIQUE (code, department) -) USING tde_heap_basic; +) USING :tde_am; COPY towns (id, code, article, name, department) FROM stdin; SELECT count(*) FROM towns; count diff --git a/expected/multi_insert_basic.out b/expected/multi_insert_basic.out new file mode 100644 index 00000000..6662449e --- /dev/null +++ b/expected/multi_insert_basic.out @@ -0,0 +1,105 @@ +\set tde_am tde_heap_basic +\i sql/multi_insert.inc +-- trigger multi_insert path +-- +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 ( + album_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + artist_id INTEGER, + title TEXT NOT NULL, + released DATE NOT NULL +) USING :tde_am; +COPY albums FROM stdin CSV HEADER; +SELECT * FROM albums; + album_id | artist_id | title | released +----------+-----------+--------------------+------------ + 1 | 1 | Mirror | 06-24-2009 + 2 | 2 | Pretzel Logic | 02-20-1974 + 3 | 3 | Under Construction | 11-12-2002 + 4 | 4 | Return to Wherever | 07-11-2019 + 5 | 5 | The Nightfly | 10-01-1982 + 6 | 6 | It's Alive | 10-15-2013 + 7 | 7 | Pure Ella | 02-15-1994 +(7 rows) + +SELECT * FROM albums where album_id > 5; + album_id | artist_id | title | released +----------+-----------+------------+------------ + 6 | 6 | It's Alive | 10-15-2013 + 7 | 7 | Pure Ella | 02-15-1994 +(2 rows) + +-- On replica: +-- SELECT * FROM albums; +-- album_id | artist_id | title | released +-- ----------+-----------+--------------------+------------ +-- 1 | 1 | Mirror | 2009-06-24 +-- 2 | 2 | Pretzel Logic | 1974-02-20 +-- 3 | 3 | Under Construction | 2002-11-12 +-- 4 | 4 | Return to Wherever | 2019-07-11 +-- 5 | 5 | The Nightfly | 1982-10-01 +-- 6 | 6 | It's Alive | 2013-10-15 +-- 7 | 7 | Pure Ella | 1994-02-15 +-- (7 rows) +-- +-- SELECT * FROM albums where album_id > 5; +-- album_id | artist_id | title | released +-- ----------+-----------+------------+------------ +-- 6 | 6 | It's Alive | 2013-10-15 +-- 7 | 7 | Pure Ella | 1994-02-15 +-- (2 rows) +-- +DROP TABLE albums; +-- multi_insert2 +-- more data to take multiple pages +CREATE TABLE Towns ( + id SERIAL UNIQUE NOT NULL, + code VARCHAR(10) NOT NULL, + article TEXT, + name TEXT NOT NULL, + department VARCHAR(4) NOT NULL, + UNIQUE (code, department) +) USING :tde_am; +COPY towns (id, code, article, name, department) FROM stdin; +SELECT count(*) FROM towns; + count +------- + 1313 +(1 row) + +SELECT * FROM towns where id in (13, 666); + id | code | article | name | department +-----+------+-----------+----------------+------------ + 13 | 014 | some_text | Arbent | 01 + 666 | 252 | some_text | Cuissy-et-Geny | 02 +(2 rows) + +-- ON REPLICA +-- +-- select count(*) from towns; +-- count +-- ------- +-- 1313 +-- (1 row) +-- +-- select * from towns where id in (13, 666); +-- id | code | article | name | department +-- -----+------+-----------+----------------+------------ +-- 13 | 014 | some_text | Arbent | 01 +-- 666 | 252 | some_text | Cuissy-et-Geny | 02 +-- (2 rows) +-- +DROP TABLE towns; +DROP EXTENSION pg_tde; diff --git a/expected/non_sorted_off_compact.out b/expected/non_sorted_off_compact.out index fa3b343b..559689a0 100644 --- a/expected/non_sorted_off_compact.out +++ b/expected/non_sorted_off_compact.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\i sql/non_sorted_off_compact.inc -- A test case for https://github.com/Percona-Lab/pg_tde/pull/21 -- CREATE EXTENSION pg_tde; @@ -14,12 +16,12 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault'); (1 row) DROP TABLE IF EXISTS sbtest1; -NOTICE: table "sbtest1" does not exist, skipping +psql:sql/non_sorted_off_compact.inc:8: NOTICE: table "sbtest1" does not exist, skipping CREATE TABLE sbtest1( id SERIAL, k INTEGER DEFAULT '0' NOT NULL, PRIMARY KEY (id) - ) USING tde_heap_basic; + ) USING :tde_am; INSERT INTO sbtest1(k) VALUES (1), (2), diff --git a/expected/non_sorted_off_compact_basic.out b/expected/non_sorted_off_compact_basic.out new file mode 100644 index 00000000..1e3552bc --- /dev/null +++ b/expected/non_sorted_off_compact_basic.out @@ -0,0 +1,61 @@ +\set tde_am tde_heap_basic +\i sql/non_sorted_off_compact.inc +-- A test case for https://github.com/Percona-Lab/pg_tde/pull/21 +-- +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) + +DROP TABLE IF EXISTS sbtest1; +psql:sql/non_sorted_off_compact.inc:8: NOTICE: table "sbtest1" does not exist, skipping +CREATE TABLE sbtest1( + id SERIAL, + k INTEGER DEFAULT '0' NOT NULL, + PRIMARY KEY (id) + ) USING :tde_am; +INSERT INTO sbtest1(k) VALUES +(1), +(2), +(3), +(4), +(5), +(6), +(7), +(8), +(9), +(10); +DELETE FROM sbtest1 WHERE id IN (4,5,6); +VACUUM sbtest1; +INSERT INTO sbtest1(k) VALUES +(11), +(12), +(13); +-- Line pointers (lp) point to non-sorted offsets (lp_off): +-- CREATE EXTENSION pageinspect; +-- SELECT lp, lp_off, t_ctid FROM heap_page_items(get_raw_page('sbtest1', 0)); +-- lp | lp_off | t_ctid +-- ----+--------+-------- +-- 1 | 8160 | (0,1) +-- 2 | 8128 | (0,2) +-- 3 | 8096 | (0,3) +-- 4 | 7936 | (0,4) +-- 5 | 7904 | (0,5) +-- 6 | 7872 | (0,6) +-- 7 | 8064 | (0,7) +-- 8 | 8032 | (0,8) +-- 9 | 8000 | (0,9) +-- 10 | 7968 | (0,10) +---- Trigger comapction +delete from sbtest1 where id in (2); +VACUUM sbtest1; +DROP TABLE sbtest1; +DROP EXTENSION pg_tde; diff --git a/expected/pg_tde_is_encrypted.out b/expected/pg_tde_is_encrypted.out index 755de7b8..527d93ec 100644 --- a/expected/pg_tde_is_encrypted.out +++ b/expected/pg_tde_is_encrypted.out @@ -1,6 +1,8 @@ +\set tde_am tde_heap +\i sql/pg_tde_is_encrypted.inc CREATE EXTENSION pg_tde; SELECT * FROM pg_tde_principal_key_info(); -ERROR: Principal key does not exists for the database +psql:sql/pg_tde_is_encrypted.inc:3: ERROR: Principal key does not exists for the database HINT: Use set_principal_key interface to set the principal key CONTEXT: SQL function "pg_tde_principal_key_info" statement 1 SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per'); @@ -19,16 +21,16 @@ CREATE TABLE test_enc( id SERIAL, k INTEGER DEFAULT '0' NOT NULL, PRIMARY KEY (id) - ) USING tde_heap_basic; + ) USING :tde_am; CREATE TABLE test_norm( id SERIAL, k INTEGER DEFAULT '0' NOT NULL, PRIMARY KEY (id) ) USING heap; SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE relname = 'test_enc'; - amname ----------------- - tde_heap_basic + amname +---------- + tde_heap (1 row) SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE relname = 'test_norm'; diff --git a/expected/pg_tde_is_encrypted_basic.out b/expected/pg_tde_is_encrypted_basic.out new file mode 100644 index 00000000..94d47c15 --- /dev/null +++ b/expected/pg_tde_is_encrypted_basic.out @@ -0,0 +1,63 @@ +\set tde_am tde_heap_basic +\i sql/pg_tde_is_encrypted.inc +CREATE EXTENSION pg_tde; +SELECT * FROM pg_tde_principal_key_info(); +psql:sql/pg_tde_is_encrypted.inc:3: ERROR: Principal key does not exists for the database +HINT: Use set_principal_key interface to set the principal key +CONTEXT: SQL function "pg_tde_principal_key_info" statement 1 +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 test_enc( + id SERIAL, + k INTEGER DEFAULT '0' NOT NULL, + PRIMARY KEY (id) + ) USING :tde_am; +CREATE TABLE test_norm( + id SERIAL, + k INTEGER DEFAULT '0' NOT NULL, + PRIMARY KEY (id) + ) USING heap; +SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE relname = 'test_enc'; + amname +---------------- + 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'; + amname +-------- + heap +(1 row) + +SELECT pg_tde_is_encrypted('test_enc'); + pg_tde_is_encrypted +--------------------- + t +(1 row) + +SELECT pg_tde_is_encrypted('test_norm'); + pg_tde_is_encrypted +--------------------- + f +(1 row) + +SELECT key_provider_id, key_provider_name, principal_key_name + FROM pg_tde_principal_key_info(); + key_provider_id | key_provider_name | principal_key_name +-----------------+-------------------+----------------------- + 1 | file-vault | test-db-principal-key +(1 row) + +DROP TABLE test_enc; +DROP TABLE test_norm; +DROP EXTENSION pg_tde; diff --git a/expected/test_issue_153_fix.out b/expected/test_issue_153_fix.out index 2fcd82f2..bcbb15a1 100644 --- a/expected/test_issue_153_fix.out +++ b/expected/test_issue_153_fix.out @@ -1,7 +1,9 @@ +\set tde_am tde_heap +\i sql/test_issue_153_fix.inc CREATE EXTENSION pg_tde; SET datestyle TO 'iso, dmy'; SELECT * FROM pg_tde_principal_key_info(); -ERROR: Principal key does not exists for the database +psql:sql/test_issue_153_fix.inc:4: ERROR: Principal key does not exists for the database HINT: Use set_principal_key interface to set the principal key CONTEXT: SQL function "pg_tde_principal_key_info" statement 1 SELECT pg_tde_add_key_provider_file('file-ring','/tmp/pg_tde_test_keyring.per'); @@ -32,7 +34,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 tde_heap_basic; +)using :tde_am; -- -- Create the 'emp' table -- @@ -46,7 +48,7 @@ CREATE TABLE emp ( comm NUMERIC(7,2), deptno NUMERIC(2) CONSTRAINT emp_ref_dept_fk REFERENCES dept(deptno) -)using tde_heap_basic; +)using :tde_am; -- -- Create the 'jobhist' table -- @@ -65,7 +67,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 tde_heap_basic; +)using :tde_am; -- -- Create the 'salesemp' view -- @@ -518,31 +520,31 @@ SELECT * FROM jobhist; -- Now test the crash fix DELETE FROM emp WHERE empno = 7934; -INFO: Deleting employee 7934 -INFO: ..Old salary: 1300.00 -INFO: User deleted employee(s) on +psql:sql/test_issue_153_fix.inc:465: INFO: Deleting employee 7934 +psql:sql/test_issue_153_fix.inc:465: INFO: ..Old salary: 1300.00 +psql:sql/test_issue_153_fix.inc:465: INFO: User deleted employee(s) on DELETE FROM emp WHERE empno = 7698; -INFO: Deleting employee 7698 -INFO: ..Old salary: 2850.00 -INFO: User deleted employee(s) on +psql:sql/test_issue_153_fix.inc:466: INFO: Deleting employee 7698 +psql:sql/test_issue_153_fix.inc:466: INFO: ..Old salary: 2850.00 +psql:sql/test_issue_153_fix.inc:466: INFO: User deleted employee(s) on DELETE FROM emp WHERE empno = 7782; -INFO: Deleting employee 7782 -INFO: ..Old salary: 2450.00 -INFO: User deleted employee(s) on +psql:sql/test_issue_153_fix.inc:467: INFO: Deleting employee 7782 +psql:sql/test_issue_153_fix.inc:467: INFO: ..Old salary: 2450.00 +psql:sql/test_issue_153_fix.inc:467: INFO: User deleted employee(s) on DELETE FROM emp WHERE empno = 7788; -INFO: Deleting employee 7788 -INFO: ..Old salary: 3000.00 -INFO: User deleted employee(s) on +psql:sql/test_issue_153_fix.inc:468: INFO: Deleting employee 7788 +psql:sql/test_issue_153_fix.inc:468: INFO: ..Old salary: 3000.00 +psql:sql/test_issue_153_fix.inc:468: INFO: User deleted employee(s) on DELETE FROM emp WHERE empno = 7838; -INFO: User deleted employee(s) on +psql:sql/test_issue_153_fix.inc:469: INFO: User deleted employee(s) on DELETE FROM emp WHERE empno = 7900; -INFO: Deleting employee 7900 -INFO: ..Old salary: 950.00 -INFO: User deleted employee(s) on +psql:sql/test_issue_153_fix.inc:470: INFO: Deleting employee 7900 +psql:sql/test_issue_153_fix.inc:470: INFO: ..Old salary: 950.00 +psql:sql/test_issue_153_fix.inc:470: INFO: User deleted employee(s) on DELETE FROM emp WHERE empno = 7654; -INFO: Deleting employee 7654 -INFO: ..Old salary: 1250.00 -INFO: User deleted employee(s) on +psql:sql/test_issue_153_fix.inc:471: INFO: Deleting employee 7654 +psql:sql/test_issue_153_fix.inc:471: INFO: ..Old salary: 1250.00 +psql:sql/test_issue_153_fix.inc:471: INFO: User deleted employee(s) on DELETE FROM dept WHERE deptno = 40; SELECT * FROM emp; empno | ename | job | mgr | hiredate | sal | comm | deptno @@ -580,6 +582,8 @@ SELECT * FROM jobhist; DROP TABLE jobhist CASCADE; DROP TABLE emp CASCADE; -NOTICE: drop cascades to view salesemp +psql:sql/test_issue_153_fix.inc:480: NOTICE: drop cascades to view salesemp DROP TABLE dept CASCADE; +DROP SEQUENCE next_empno; +DROP TYPE emp_query_type; DROP EXTENSION pg_tde CASCADE; diff --git a/expected/test_issue_153_fix_basic.out b/expected/test_issue_153_fix_basic.out new file mode 100644 index 00000000..66f293e9 --- /dev/null +++ b/expected/test_issue_153_fix_basic.out @@ -0,0 +1,589 @@ +\set tde_am tde_heap_basic +\i sql/test_issue_153_fix.inc +CREATE EXTENSION pg_tde; +SET datestyle TO 'iso, dmy'; +SELECT * FROM pg_tde_principal_key_info(); +psql:sql/test_issue_153_fix.inc:4: ERROR: Principal key does not exists for the database +HINT: Use set_principal_key interface to set the principal key +CONTEXT: SQL function "pg_tde_principal_key_info" statement 1 +SELECT pg_tde_add_key_provider_file('file-ring','/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-ring'); + pg_tde_set_principal_key +-------------------------- + t +(1 row) + +-- +-- Script that creates the 'sample' tde encrypted tables, views +-- functions, triggers, etc. +-- +-- Start new transaction - commit all or nothing +-- +BEGIN; +-- +-- Create and load tables used in the documentation examples. +-- +-- Create the 'dept' table +-- +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 :tde_am; +-- +-- Create the 'emp' table +-- +CREATE TABLE emp ( + empno NUMERIC(4) NOT NULL CONSTRAINT emp_pk PRIMARY KEY, + ename VARCHAR(10), + job VARCHAR(9), + mgr NUMERIC(4), + hiredate DATE, + sal NUMERIC(7,2) CONSTRAINT emp_sal_ck CHECK (sal > 0), + comm NUMERIC(7,2), + deptno NUMERIC(2) CONSTRAINT emp_ref_dept_fk + REFERENCES dept(deptno) +)using :tde_am; +-- +-- Create the 'jobhist' table +-- +CREATE TABLE jobhist ( + empno NUMERIC(4) NOT NULL, + startdate TIMESTAMP(0) NOT NULL, + enddate TIMESTAMP(0), + job VARCHAR(9), + sal NUMERIC(7,2), + comm NUMERIC(7,2), + deptno NUMERIC(2), + chgdesc VARCHAR(80), + CONSTRAINT jobhist_pk PRIMARY KEY (empno, startdate), + CONSTRAINT jobhist_ref_emp_fk FOREIGN KEY (empno) + REFERENCES emp(empno) ON DELETE CASCADE, + CONSTRAINT jobhist_ref_dept_fk FOREIGN KEY (deptno) + REFERENCES dept (deptno) ON DELETE SET NULL, + CONSTRAINT jobhist_date_chk CHECK (startdate <= enddate) +)using :tde_am; +-- +-- Create the 'salesemp' view +-- +CREATE OR REPLACE VIEW salesemp AS + SELECT empno, ename, hiredate, sal, comm FROM emp WHERE job = 'SALESMAN'; +-- +-- Sequence to generate values for function 'new_empno'. +-- +CREATE SEQUENCE next_empno START WITH 8000 INCREMENT BY 1; +-- +-- Issue PUBLIC grants +-- +GRANT ALL ON emp TO PUBLIC; +GRANT ALL ON dept TO PUBLIC; +GRANT ALL ON jobhist TO PUBLIC; +GRANT ALL ON salesemp TO PUBLIC; +GRANT ALL ON next_empno TO PUBLIC; +-- +-- Load the 'dept' table +-- +INSERT INTO dept VALUES (10,'ACCOUNTING','NEW YORK'); +INSERT INTO dept VALUES (20,'RESEARCH','DALLAS'); +INSERT INTO dept VALUES (30,'SALES','CHICAGO'); +INSERT INTO dept VALUES (40,'OPERATIONS','BOSTON'); +-- +-- Load the 'emp' table +-- +INSERT INTO emp VALUES (7369,'SMITH','CLERK',7902,'17-DEC-80',800,NULL,20); +INSERT INTO emp VALUES (7499,'ALLEN','SALESMAN',7698,'20-FEB-81',1600,300,30); +INSERT INTO emp VALUES (7521,'WARD','SALESMAN',7698,'22-FEB-81',1250,500,30); +INSERT INTO emp VALUES (7566,'JONES','MANAGER',7839,'02-APR-81',2975,NULL,20); +INSERT INTO emp VALUES (7654,'MARTIN','SALESMAN',7698,'28-SEP-81',1250,1400,30); +INSERT INTO emp VALUES (7698,'BLAKE','MANAGER',7839,'01-MAY-81',2850,NULL,30); +INSERT INTO emp VALUES (7782,'CLARK','MANAGER',7839,'09-JUN-81',2450,NULL,10); +INSERT INTO emp VALUES (7788,'SCOTT','ANALYST',7566,'19-APR-87',3000,NULL,20); +INSERT INTO emp VALUES (7839,'KING','PRESIDENT',NULL,'17-NOV-81',5000,NULL,10); +INSERT INTO emp VALUES (7844,'TURNER','SALESMAN',7698,'08-SEP-81',1500,0,30); +INSERT INTO emp VALUES (7876,'ADAMS','CLERK',7788,'23-MAY-87',1100,NULL,20); +INSERT INTO emp VALUES (7900,'JAMES','CLERK',7698,'03-DEC-81',950,NULL,30); +INSERT INTO emp VALUES (7902,'FORD','ANALYST',7566,'03-DEC-81',3000,NULL,20); +INSERT INTO emp VALUES (7934,'MILLER','CLERK',7782,'23-JAN-82',1300,NULL,10); +-- +-- Load the 'jobhist' table +-- +INSERT INTO jobhist VALUES (7369,'17-DEC-80',NULL,'CLERK',800,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7499,'20-FEB-81',NULL,'SALESMAN',1600,300,30,'New Hire'); +INSERT INTO jobhist VALUES (7521,'22-FEB-81',NULL,'SALESMAN',1250,500,30,'New Hire'); +INSERT INTO jobhist VALUES (7566,'02-APR-81',NULL,'MANAGER',2975,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7654,'28-SEP-81',NULL,'SALESMAN',1250,1400,30,'New Hire'); +INSERT INTO jobhist VALUES (7698,'01-MAY-81',NULL,'MANAGER',2850,NULL,30,'New Hire'); +INSERT INTO jobhist VALUES (7782,'09-JUN-81',NULL,'MANAGER',2450,NULL,10,'New Hire'); +INSERT INTO jobhist VALUES (7788,'19-APR-87','12-APR-88','CLERK',1000,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7788,'13-APR-88','04-MAY-89','CLERK',1040,NULL,20,'Raise'); +INSERT INTO jobhist VALUES (7788,'05-MAY-90',NULL,'ANALYST',3000,NULL,20,'Promoted to Analyst'); +INSERT INTO jobhist VALUES (7839,'17-NOV-81',NULL,'PRESIDENT',5000,NULL,10,'New Hire'); +INSERT INTO jobhist VALUES (7844,'08-SEP-81',NULL,'SALESMAN',1500,0,30,'New Hire'); +INSERT INTO jobhist VALUES (7876,'23-MAY-87',NULL,'CLERK',1100,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7900,'03-DEC-81','14-JAN-83','CLERK',950,NULL,10,'New Hire'); +INSERT INTO jobhist VALUES (7900,'15-JAN-83',NULL,'CLERK',950,NULL,30,'Changed to Dept 30'); +INSERT INTO jobhist VALUES (7902,'03-DEC-81',NULL,'ANALYST',3000,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7934,'23-JAN-82',NULL,'CLERK',1300,NULL,10,'New Hire'); +-- +-- Populate statistics table and view (pg_statistic/pg_stats) +-- +ANALYZE dept; +ANALYZE emp; +ANALYZE jobhist; +-- +-- Function that lists all employees' numbers and names +-- from the 'emp' table using a cursor. +-- +CREATE OR REPLACE FUNCTION list_emp() RETURNS VOID +AS $$ +DECLARE + v_empno NUMERIC(4); + v_ename VARCHAR(10); + emp_cur CURSOR FOR + SELECT empno, ename FROM emp ORDER BY empno; +BEGIN + OPEN emp_cur; + RAISE INFO 'EMPNO ENAME'; + RAISE INFO '----- -------'; + LOOP + FETCH emp_cur INTO v_empno, v_ename; + EXIT WHEN NOT FOUND; + RAISE INFO '% %', v_empno, v_ename; + END LOOP; + CLOSE emp_cur; + RETURN; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function that selects an employee row given the employee +-- number and displays certain columns. +-- +CREATE OR REPLACE FUNCTION select_emp ( + p_empno NUMERIC +) RETURNS VOID +AS $$ +DECLARE + v_ename emp.ename%TYPE; + v_hiredate emp.hiredate%TYPE; + v_sal emp.sal%TYPE; + v_comm emp.comm%TYPE; + v_dname dept.dname%TYPE; + v_disp_date VARCHAR(10); +BEGIN + SELECT INTO + v_ename, v_hiredate, v_sal, v_comm, v_dname + ename, hiredate, sal, COALESCE(comm, 0), dname + FROM emp e, dept d + WHERE empno = p_empno + AND e.deptno = d.deptno; + IF NOT FOUND THEN + RAISE INFO 'Employee % not found', p_empno; + RETURN; + END IF; + v_disp_date := TO_CHAR(v_hiredate, 'MM/DD/YYYY'); + RAISE INFO 'Number : %', p_empno; + RAISE INFO 'Name : %', v_ename; + RAISE INFO 'Hire Date : %', v_disp_date; + RAISE INFO 'Salary : %', v_sal; + RAISE INFO 'Commission: %', v_comm; + RAISE INFO 'Department: %', v_dname; + RETURN; +EXCEPTION + WHEN OTHERS THEN + RAISE INFO 'The following is SQLERRM : %', SQLERRM; + RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; + RETURN; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- A RECORD type used to format the return value of +-- function, 'emp_query'. +-- +CREATE TYPE emp_query_type AS ( + empno NUMERIC, + ename VARCHAR(10), + job VARCHAR(9), + hiredate DATE, + sal NUMERIC +); +-- +-- Function that queries the 'emp' table based on +-- department number and employee number or name. Returns +-- employee number and name as INOUT parameters and job, +-- hire date, and salary as OUT parameters. These are +-- returned in the form of a record defined by +-- RECORD type, 'emp_query_type'. +-- +CREATE OR REPLACE FUNCTION emp_query ( + IN p_deptno NUMERIC, + INOUT p_empno NUMERIC, + INOUT p_ename VARCHAR, + OUT p_job VARCHAR, + OUT p_hiredate DATE, + OUT p_sal NUMERIC +) +AS $$ +BEGIN + SELECT INTO + p_empno, p_ename, p_job, p_hiredate, p_sal + empno, ename, job, hiredate, sal + FROM emp + WHERE deptno = p_deptno + AND (empno = p_empno + OR ename = UPPER(p_ename)); +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function to call 'emp_query_caller' with IN and INOUT +-- parameters. Displays the results received from INOUT and +-- OUT parameters. +-- +CREATE OR REPLACE FUNCTION emp_query_caller() RETURNS VOID +AS $$ +DECLARE + v_deptno NUMERIC; + v_empno NUMERIC; + v_ename VARCHAR; + v_rows INTEGER; + r_emp_query EMP_QUERY_TYPE; +BEGIN + v_deptno := 30; + v_empno := 0; + v_ename := 'Martin'; + r_emp_query := emp_query(v_deptno, v_empno, v_ename); + RAISE INFO 'Department : %', v_deptno; + RAISE INFO 'Employee No: %', (r_emp_query).empno; + RAISE INFO 'Name : %', (r_emp_query).ename; + RAISE INFO 'Job : %', (r_emp_query).job; + RAISE INFO 'Hire Date : %', (r_emp_query).hiredate; + RAISE INFO 'Salary : %', (r_emp_query).sal; + RETURN; +EXCEPTION + WHEN OTHERS THEN + RAISE INFO 'The following is SQLERRM : %', SQLERRM; + RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; + RETURN; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function to compute yearly compensation based on semimonthly +-- salary. +-- +CREATE OR REPLACE FUNCTION emp_comp ( + p_sal NUMERIC, + p_comm NUMERIC +) RETURNS NUMERIC +AS $$ +BEGIN + RETURN (p_sal + COALESCE(p_comm, 0)) * 24; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function that gets the next number from sequence, 'next_empno', +-- and ensures it is not already in use as an employee number. +-- +CREATE OR REPLACE FUNCTION new_empno() RETURNS INTEGER +AS $$ +DECLARE + v_cnt INTEGER := 1; + v_new_empno INTEGER; +BEGIN + WHILE v_cnt > 0 LOOP + SELECT INTO v_new_empno nextval('next_empno'); + SELECT INTO v_cnt COUNT(*) FROM emp WHERE empno = v_new_empno; + END LOOP; + RETURN v_new_empno; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function that adds a new clerk to table 'emp'. +-- +CREATE OR REPLACE FUNCTION hire_clerk ( + p_ename VARCHAR, + p_deptno NUMERIC +) RETURNS NUMERIC +AS $$ +DECLARE + v_empno NUMERIC(4); + v_ename VARCHAR(10); + v_job VARCHAR(9); + v_mgr NUMERIC(4); + v_hiredate DATE; + v_sal NUMERIC(7,2); + v_comm NUMERIC(7,2); + v_deptno NUMERIC(2); +BEGIN + v_empno := new_empno(); + INSERT INTO emp VALUES (v_empno, p_ename, 'CLERK', 7782, + CURRENT_DATE, 950.00, NULL, p_deptno); + SELECT INTO + v_empno, v_ename, v_job, v_mgr, v_hiredate, v_sal, v_comm, v_deptno + empno, ename, job, mgr, hiredate, sal, comm, deptno + FROM emp WHERE empno = v_empno; + RAISE INFO 'Department : %', v_deptno; + RAISE INFO 'Employee No: %', v_empno; + RAISE INFO 'Name : %', v_ename; + RAISE INFO 'Job : %', v_job; + RAISE INFO 'Manager : %', v_mgr; + RAISE INFO 'Hire Date : %', v_hiredate; + RAISE INFO 'Salary : %', v_sal; + RAISE INFO 'Commission : %', v_comm; + RETURN v_empno; +EXCEPTION + WHEN OTHERS THEN + RAISE INFO 'The following is SQLERRM : %', SQLERRM; + RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; + RETURN -1; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function that adds a new salesman to table 'emp'. +-- +CREATE OR REPLACE FUNCTION hire_salesman ( + p_ename VARCHAR, + p_sal NUMERIC, + p_comm NUMERIC +) RETURNS NUMERIC +AS $$ +DECLARE + v_empno NUMERIC(4); + v_ename VARCHAR(10); + v_job VARCHAR(9); + v_mgr NUMERIC(4); + v_hiredate DATE; + v_sal NUMERIC(7,2); + v_comm NUMERIC(7,2); + v_deptno NUMERIC(2); +BEGIN + v_empno := new_empno(); + INSERT INTO emp VALUES (v_empno, p_ename, 'SALESMAN', 7698, + CURRENT_DATE, p_sal, p_comm, 30); + SELECT INTO + v_empno, v_ename, v_job, v_mgr, v_hiredate, v_sal, v_comm, v_deptno + empno, ename, job, mgr, hiredate, sal, comm, deptno + FROM emp WHERE empno = v_empno; + RAISE INFO 'Department : %', v_deptno; + RAISE INFO 'Employee No: %', v_empno; + RAISE INFO 'Name : %', v_ename; + RAISE INFO 'Job : %', v_job; + RAISE INFO 'Manager : %', v_mgr; + RAISE INFO 'Hire Date : %', v_hiredate; + RAISE INFO 'Salary : %', v_sal; + RAISE INFO 'Commission : %', v_comm; + RETURN v_empno; +EXCEPTION + WHEN OTHERS THEN + RAISE INFO 'The following is SQLERRM : %', SQLERRM; + RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; + RETURN -1; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Rule to INSERT into view 'salesemp' +-- +CREATE OR REPLACE RULE salesemp_i AS ON INSERT TO salesemp +DO INSTEAD + INSERT INTO emp VALUES (NEW.empno, NEW.ename, 'SALESMAN', 7698, + NEW.hiredate, NEW.sal, NEW.comm, 30); +-- +-- Rule to UPDATE view 'salesemp' +-- +CREATE OR REPLACE RULE salesemp_u AS ON UPDATE TO salesemp +DO INSTEAD + UPDATE emp SET empno = NEW.empno, + ename = NEW.ename, + hiredate = NEW.hiredate, + sal = NEW.sal, + comm = NEW.comm + WHERE empno = OLD.empno; +-- +-- Rule to DELETE from view 'salesemp' +-- +CREATE OR REPLACE RULE salesemp_d AS ON DELETE TO salesemp +DO INSTEAD + DELETE FROM emp WHERE empno = OLD.empno; +-- +-- After statement-level trigger that displays a message after +-- an insert, update, or deletion to the 'emp' table. One message +-- per SQL command is displayed. +-- +CREATE OR REPLACE FUNCTION user_audit_trig() RETURNS TRIGGER +AS $$ +DECLARE + v_action VARCHAR(24); + v_text TEXT; +BEGIN + IF TG_OP = 'INSERT' THEN + v_action := ' added employee(s) on '; + ELSIF TG_OP = 'UPDATE' THEN + v_action := ' updated employee(s) on '; + ELSIF TG_OP = 'DELETE' THEN + v_action := ' deleted employee(s) on '; + END IF; +-- v_text := 'User ' || USER || v_action || CURRENT_DATE; Changing this as we need consistent output for regression + v_text := 'User ' || v_action ; + RAISE INFO ' %', v_text; + RETURN NULL; +END; +$$ LANGUAGE 'plpgsql'; +CREATE TRIGGER user_audit_trig + AFTER INSERT OR UPDATE OR DELETE ON emp + FOR EACH STATEMENT EXECUTE PROCEDURE user_audit_trig(); +-- +-- Before row-level trigger that displays employee number and +-- salary of an employee that is about to be added, updated, +-- or deleted in the 'emp' table. +-- +CREATE OR REPLACE FUNCTION emp_sal_trig() RETURNS TRIGGER +AS $$ +DECLARE + sal_diff NUMERIC(7,2); +BEGIN + IF TG_OP = 'INSERT' THEN + RAISE INFO 'Inserting employee %', NEW.empno; + RAISE INFO '..New salary: %', NEW.sal; + RETURN NEW; + END IF; + IF TG_OP = 'UPDATE' THEN + sal_diff := NEW.sal - OLD.sal; + RAISE INFO 'Updating employee %', OLD.empno; + RAISE INFO '..Old salary: %', OLD.sal; + RAISE INFO '..New salary: %', NEW.sal; + RAISE INFO '..Raise : %', sal_diff; + RETURN NEW; + END IF; + IF TG_OP = 'DELETE' THEN + RAISE INFO 'Deleting employee %', OLD.empno; + RAISE INFO '..Old salary: %', OLD.sal; + RETURN OLD; + END IF; +END; +$$ LANGUAGE 'plpgsql'; +CREATE TRIGGER emp_sal_trig + BEFORE DELETE OR INSERT OR UPDATE ON emp + FOR EACH ROW EXECUTE PROCEDURE emp_sal_trig(); +COMMIT; +SELECT * FROM emp; + empno | ename | job | mgr | hiredate | sal | comm | deptno +-------+--------+-----------+------+------------+---------+---------+-------- + 7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800.00 | | 20 + 7499 | ALLEN | SALESMAN | 7698 | 1981-02-20 | 1600.00 | 300.00 | 30 + 7521 | WARD | SALESMAN | 7698 | 1981-02-22 | 1250.00 | 500.00 | 30 + 7566 | JONES | MANAGER | 7839 | 1981-04-02 | 2975.00 | | 20 + 7654 | MARTIN | SALESMAN | 7698 | 1981-09-28 | 1250.00 | 1400.00 | 30 + 7698 | BLAKE | MANAGER | 7839 | 1981-05-01 | 2850.00 | | 30 + 7782 | CLARK | MANAGER | 7839 | 1981-06-09 | 2450.00 | | 10 + 7788 | SCOTT | ANALYST | 7566 | 1987-04-19 | 3000.00 | | 20 + 7839 | KING | PRESIDENT | | 1981-11-17 | 5000.00 | | 10 + 7844 | TURNER | SALESMAN | 7698 | 1981-09-08 | 1500.00 | 0.00 | 30 + 7876 | ADAMS | CLERK | 7788 | 1987-05-23 | 1100.00 | | 20 + 7900 | JAMES | CLERK | 7698 | 1981-12-03 | 950.00 | | 30 + 7902 | FORD | ANALYST | 7566 | 1981-12-03 | 3000.00 | | 20 + 7934 | MILLER | CLERK | 7782 | 1982-01-23 | 1300.00 | | 10 +(14 rows) + +SELECT * FROM dept; + deptno | dname | loc +--------+------------+---------- + 10 | ACCOUNTING | NEW YORK + 20 | RESEARCH | DALLAS + 30 | SALES | CHICAGO + 40 | OPERATIONS | BOSTON +(4 rows) + +SELECT * FROM jobhist; + empno | startdate | enddate | job | sal | comm | deptno | chgdesc +-------+---------------------+---------------------+-----------+---------+---------+--------+--------------------- + 7369 | 1980-12-17 00:00:00 | | CLERK | 800.00 | | 20 | New Hire + 7499 | 1981-02-20 00:00:00 | | SALESMAN | 1600.00 | 300.00 | 30 | New Hire + 7521 | 1981-02-22 00:00:00 | | SALESMAN | 1250.00 | 500.00 | 30 | New Hire + 7566 | 1981-04-02 00:00:00 | | MANAGER | 2975.00 | | 20 | New Hire + 7654 | 1981-09-28 00:00:00 | | SALESMAN | 1250.00 | 1400.00 | 30 | New Hire + 7698 | 1981-05-01 00:00:00 | | MANAGER | 2850.00 | | 30 | New Hire + 7782 | 1981-06-09 00:00:00 | | MANAGER | 2450.00 | | 10 | New Hire + 7788 | 1987-04-19 00:00:00 | 1988-04-12 00:00:00 | CLERK | 1000.00 | | 20 | New Hire + 7788 | 1988-04-13 00:00:00 | 1989-05-04 00:00:00 | CLERK | 1040.00 | | 20 | Raise + 7788 | 1990-05-05 00:00:00 | | ANALYST | 3000.00 | | 20 | Promoted to Analyst + 7839 | 1981-11-17 00:00:00 | | PRESIDENT | 5000.00 | | 10 | New Hire + 7844 | 1981-09-08 00:00:00 | | SALESMAN | 1500.00 | 0.00 | 30 | New Hire + 7876 | 1987-05-23 00:00:00 | | CLERK | 1100.00 | | 20 | New Hire + 7900 | 1981-12-03 00:00:00 | 1983-01-14 00:00:00 | CLERK | 950.00 | | 10 | New Hire + 7900 | 1983-01-15 00:00:00 | | CLERK | 950.00 | | 30 | Changed to Dept 30 + 7902 | 1981-12-03 00:00:00 | | ANALYST | 3000.00 | | 20 | New Hire + 7934 | 1982-01-23 00:00:00 | | CLERK | 1300.00 | | 10 | New Hire +(17 rows) + +-- Now test the crash fix +DELETE FROM emp WHERE empno = 7934; +psql:sql/test_issue_153_fix.inc:465: INFO: Deleting employee 7934 +psql:sql/test_issue_153_fix.inc:465: INFO: ..Old salary: 1300.00 +psql:sql/test_issue_153_fix.inc:465: INFO: User deleted employee(s) on +DELETE FROM emp WHERE empno = 7698; +psql:sql/test_issue_153_fix.inc:466: INFO: Deleting employee 7698 +psql:sql/test_issue_153_fix.inc:466: INFO: ..Old salary: 2850.00 +psql:sql/test_issue_153_fix.inc:466: INFO: User deleted employee(s) on +DELETE FROM emp WHERE empno = 7782; +psql:sql/test_issue_153_fix.inc:467: INFO: Deleting employee 7782 +psql:sql/test_issue_153_fix.inc:467: INFO: ..Old salary: 2450.00 +psql:sql/test_issue_153_fix.inc:467: INFO: User deleted employee(s) on +DELETE FROM emp WHERE empno = 7788; +psql:sql/test_issue_153_fix.inc:468: INFO: Deleting employee 7788 +psql:sql/test_issue_153_fix.inc:468: INFO: ..Old salary: 3000.00 +psql:sql/test_issue_153_fix.inc:468: INFO: User deleted employee(s) on +DELETE FROM emp WHERE empno = 7838; +psql:sql/test_issue_153_fix.inc:469: INFO: User deleted employee(s) on +DELETE FROM emp WHERE empno = 7900; +psql:sql/test_issue_153_fix.inc:470: INFO: Deleting employee 7900 +psql:sql/test_issue_153_fix.inc:470: INFO: ..Old salary: 950.00 +psql:sql/test_issue_153_fix.inc:470: INFO: User deleted employee(s) on +DELETE FROM emp WHERE empno = 7654; +psql:sql/test_issue_153_fix.inc:471: INFO: Deleting employee 7654 +psql:sql/test_issue_153_fix.inc:471: INFO: ..Old salary: 1250.00 +psql:sql/test_issue_153_fix.inc:471: INFO: User deleted employee(s) on +DELETE FROM dept WHERE deptno = 40; +SELECT * FROM emp; + empno | ename | job | mgr | hiredate | sal | comm | deptno +-------+--------+-----------+------+------------+---------+--------+-------- + 7369 | SMITH | CLERK | 7902 | 1980-12-17 | 800.00 | | 20 + 7499 | ALLEN | SALESMAN | 7698 | 1981-02-20 | 1600.00 | 300.00 | 30 + 7521 | WARD | SALESMAN | 7698 | 1981-02-22 | 1250.00 | 500.00 | 30 + 7566 | JONES | MANAGER | 7839 | 1981-04-02 | 2975.00 | | 20 + 7839 | KING | PRESIDENT | | 1981-11-17 | 5000.00 | | 10 + 7844 | TURNER | SALESMAN | 7698 | 1981-09-08 | 1500.00 | 0.00 | 30 + 7876 | ADAMS | CLERK | 7788 | 1987-05-23 | 1100.00 | | 20 + 7902 | FORD | ANALYST | 7566 | 1981-12-03 | 3000.00 | | 20 +(8 rows) + +SELECT * FROM dept; + deptno | dname | loc +--------+------------+---------- + 10 | ACCOUNTING | NEW YORK + 20 | RESEARCH | DALLAS + 30 | SALES | CHICAGO +(3 rows) + +SELECT * FROM jobhist; + empno | startdate | enddate | job | sal | comm | deptno | chgdesc +-------+---------------------+---------+-----------+---------+--------+--------+---------- + 7369 | 1980-12-17 00:00:00 | | CLERK | 800.00 | | 20 | New Hire + 7499 | 1981-02-20 00:00:00 | | SALESMAN | 1600.00 | 300.00 | 30 | New Hire + 7521 | 1981-02-22 00:00:00 | | SALESMAN | 1250.00 | 500.00 | 30 | New Hire + 7566 | 1981-04-02 00:00:00 | | MANAGER | 2975.00 | | 20 | New Hire + 7839 | 1981-11-17 00:00:00 | | PRESIDENT | 5000.00 | | 10 | New Hire + 7844 | 1981-09-08 00:00:00 | | SALESMAN | 1500.00 | 0.00 | 30 | New Hire + 7876 | 1987-05-23 00:00:00 | | CLERK | 1100.00 | | 20 | New Hire + 7902 | 1981-12-03 00:00:00 | | ANALYST | 3000.00 | | 20 | New Hire +(8 rows) + +DROP TABLE jobhist CASCADE; +DROP TABLE emp CASCADE; +psql:sql/test_issue_153_fix.inc:480: NOTICE: drop cascades to view salesemp +DROP TABLE dept CASCADE; +DROP SEQUENCE next_empno; +DROP TYPE emp_query_type; +DROP EXTENSION pg_tde CASCADE; diff --git a/expected/toast_decrypt.out b/expected/toast_decrypt.out index 4bba552f..ac47626f 100644 --- a/expected/toast_decrypt.out +++ b/expected/toast_decrypt.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\i sql/toast_decrypt.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 @@ -11,7 +13,7 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault'); t (1 row) -CREATE TABLE src (f1 TEXT STORAGE EXTERNAL) USING tde_heap_basic; +CREATE TABLE src (f1 TEXT STORAGE EXTERNAL) USING :tde_am; INSERT INTO src VALUES(repeat('abcdeF',1000)); SELECT * FROM src; f1 diff --git a/expected/toast_decrypt_basic.out b/expected/toast_decrypt_basic.out new file mode 100644 index 00000000..1e273d44 --- /dev/null +++ b/expected/toast_decrypt_basic.out @@ -0,0 +1,25 @@ +\set tde_am tde_heap_basic +\i sql/toast_decrypt.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 src (f1 TEXT STORAGE EXTERNAL) USING :tde_am; +INSERT INTO src VALUES(repeat('abcdeF',1000)); +SELECT * FROM src; + f1 +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + abcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeFabcdeF +(1 row) + +DROP TABLE src; +DROP EXTENSION pg_tde; diff --git a/expected/toast_extended_storage.out b/expected/toast_extended_storage.out index 6400491e..6d6b74da 100644 --- a/expected/toast_extended_storage.out +++ b/expected/toast_extended_storage.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\i sql/toast_extended_storage.inc -- test https://github.com/Percona-Lab/pg_tde/issues/63 CREATE EXTENSION pg_tde; SELECT pg_tde_add_key_provider_file('file-vault','/tmp/pg_tde_test_keyring.per'); @@ -12,7 +14,7 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault'); t (1 row) -CREATE TEMP TABLE src (f1 text) USING tde_heap_basic; +CREATE TEMP TABLE src (f1 text) USING :tde_am; -- Crash on INSERT INSERT INTO src VALUES('0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454'); @@ -23,7 +25,7 @@ SELECT * FROM src; (1 row) DROP TABLE src; -CREATE TABLE src2 (f1 TEXT) USING tde_heap_basic; +CREATE TABLE src2 (f1 TEXT) USING :tde_am; INSERT INTO src2 VALUES('0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454'); SELECT * FROM src2; @@ -34,7 +36,7 @@ SELECT * FROM src2; DROP TABLE src2; -- https://github.com/Percona-Lab/pg_tde/issues/82 -CREATE TABLE indtoasttest(descr text, cnt int DEFAULT 0, f1 text, f2 text) using tde_heap_basic; +CREATE TABLE indtoasttest(descr text, cnt int DEFAULT 0, f1 text, f2 text) using :tde_am; INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-compressed', repeat('1234567890',1000), repeat('1234567890',1000)); INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-toasted', repeat('1234567890',30000), repeat('1234567890',50000)); INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-compressed,one-null', NULL, repeat('1234567890',1000)); @@ -78,7 +80,7 @@ UPDATE indtoasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(indtoastte UPDATE indtoasttest SET f2 = '+'||f2||'-' ; DROP TABLE indtoasttest; -- Test substr with toasted externalized bytea values -CREATE TABLE toasttest(t bytea STORAGE EXTERNAL) using tde_heap_basic; +CREATE TABLE toasttest(t bytea STORAGE EXTERNAL) using :tde_am; INSERT INTO toasttest VALUES (decode(repeat('1234567890',10000), 'escape')); SET bytea_output = 'escape'; SELECT substring(t, 1, 10) FROM toasttest; diff --git a/expected/toast_extended_storage_basic.out b/expected/toast_extended_storage_basic.out new file mode 100644 index 00000000..4554bead --- /dev/null +++ b/expected/toast_extended_storage_basic.out @@ -0,0 +1,105 @@ +\set tde_am tde_heap_basic +\i sql/toast_extended_storage.inc +-- test https://github.com/Percona-Lab/pg_tde/issues/63 +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 TEMP TABLE src (f1 text) USING :tde_am; +-- Crash on INSERT +INSERT INTO src +VALUES('0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454'); +SELECT * FROM src; + f1 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454 +(1 row) + +DROP TABLE src; +CREATE TABLE src2 (f1 TEXT) USING :tde_am; +INSERT INTO src2 +VALUES('0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454'); +SELECT * FROM src2; + f1 +--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + 0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454 +(1 row) + +DROP TABLE src2; +-- https://github.com/Percona-Lab/pg_tde/issues/82 +CREATE TABLE indtoasttest(descr text, cnt int DEFAULT 0, f1 text, f2 text) using :tde_am; +INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-compressed', repeat('1234567890',1000), repeat('1234567890',1000)); +INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-toasted', repeat('1234567890',30000), repeat('1234567890',50000)); +INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-compressed,one-null', NULL, repeat('1234567890',1000)); +INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-toasted,one-null', NULL, repeat('1234567890',50000)); +UPDATE indtoasttest SET cnt = cnt +1 RETURNING substring(indtoasttest::text, 1, 200); + substring +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + (two-compressed,1,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 + (two-toasted,1,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 + ("one-compressed,one-null",1,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 + ("one-toasted,one-null",1,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 +(4 rows) + +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1 RETURNING substring(indtoasttest::text, 1, 200); + substring +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + (two-compressed,2,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 + (two-toasted,2,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 + ("one-compressed,one-null",2,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 + ("one-toasted,one-null",2,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 +(4 rows) + +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(indtoasttest::text, 1, 200); + substring +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + (two-compressed,3,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 + (two-toasted,3,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 + ("one-compressed,one-null",3,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 + ("one-toasted,one-null",3,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 +(4 rows) + +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(indtoasttest::text, 1, 200); + substring +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + (two-compressed,4,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 + (two-toasted,4,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345 + ("one-compressed,one-null",4,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 + ("one-toasted,one-null",4,,12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123 +(4 rows) + +UPDATE indtoasttest SET f2 = '+'||f2||'-' ; +DROP TABLE indtoasttest; +-- Test substr with toasted externalized bytea values +CREATE TABLE toasttest(t bytea STORAGE EXTERNAL) using :tde_am; +INSERT INTO toasttest VALUES (decode(repeat('1234567890',10000), 'escape')); +SET bytea_output = 'escape'; +SELECT substring(t, 1, 10) FROM toasttest; + substring +------------ + 1234567890 +(1 row) + +SELECT substring(t, 50001, 10) FROM toasttest; + substring +------------ + 1234567890 +(1 row) + +SELECT substring(t, 99991) FROM toasttest; + substring +------------ + 1234567890 +(1 row) + +DROP TABLE toasttest; +DROP EXTENSION pg_tde; diff --git a/expected/trigger_on_view.out b/expected/trigger_on_view.out index cd2f9f6e..33cdc5f1 100644 --- a/expected/trigger_on_view.out +++ b/expected/trigger_on_view.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\i sql/trigger_on_view.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 @@ -14,18 +16,20 @@ 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 'tde_heap_basic'; +SET default_table_access_method TO ':tde_am'; +psql:sql/trigger_on_view.inc:9: ERROR: invalid value for parameter "default_table_access_method": ":tde_am" +DETAIL: Table access method ":tde_am" does not exist. DROP VIEW IF EXISTS city_view CASCADE; -NOTICE: view "city_view" does not exist, skipping +psql:sql/trigger_on_view.inc:11: NOTICE: view "city_view" does not exist, skipping DROP TABLE IF exists country_table CASCADE; -NOTICE: table "country_table" does not exist, skipping +psql:sql/trigger_on_view.inc:12: NOTICE: table "country_table" does not exist, skipping DROP TABLE IF exists city_table cascade; -NOTICE: table "city_table" does not exist, skipping +psql:sql/trigger_on_view.inc:13: NOTICE: table "city_table" does not exist, skipping CREATE TABLE country_table ( country_id serial primary key, country_name text unique not null, continent text not null - ) using tde_heap_basic; + ) using :tde_am; INSERT INTO country_table (country_name, continent) VALUES ('Japan', 'Asia'), @@ -45,7 +49,7 @@ NOTICE: table "city_table" does not exist, skipping city_name text not null, population bigint, country_id int references country_table - ) using tde_heap_basic; + ) using :tde_am; CREATE VIEW city_view AS SELECT city_id, city_name, population, country_name, continent @@ -155,7 +159,7 @@ CREATE OR REPLACE FUNCTION city_insert() RETURNS trigger LANGUAGE plpgsql AS $$ -- UPDATE .. RETURNING UPDATE city_view SET country_name = 'Japon' WHERE city_name = 'Tokyo'; -- error -ERROR: No such country: "Japon" +psql:sql/trigger_on_view.inc:118: ERROR: No such country: "Japon" CONTEXT: PL/pgSQL function city_update() line 9 at RAISE UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Takyo'; -- no match UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Tokyo' RETURNING *; -- OK @@ -206,7 +210,7 @@ CONTEXT: PL/pgSQL function city_update() line 9 at RAISE DROP extension pg_tde CASCADE; -NOTICE: drop cascades to 3 other objects +psql:sql/trigger_on_view.inc:133: NOTICE: drop cascades to 3 other objects DETAIL: drop cascades to table country_table drop cascades to table city_table drop cascades to view city_view diff --git a/expected/trigger_on_view_basic.out b/expected/trigger_on_view_basic.out new file mode 100644 index 00000000..e01bd0e9 --- /dev/null +++ b/expected/trigger_on_view_basic.out @@ -0,0 +1,216 @@ +\set tde_am tde_heap_basic +\i sql/trigger_on_view.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) + +-- +-- 2 -- Test triggers on a join view +-- +SET default_table_access_method TO ':tde_am'; +psql:sql/trigger_on_view.inc:9: ERROR: invalid value for parameter "default_table_access_method": ":tde_am" +DETAIL: Table access method ":tde_am" does not exist. +DROP VIEW IF EXISTS city_view CASCADE; +psql:sql/trigger_on_view.inc:11: NOTICE: view "city_view" does not exist, skipping +DROP TABLE IF exists country_table CASCADE; +psql:sql/trigger_on_view.inc:12: NOTICE: table "country_table" does not exist, skipping +DROP TABLE IF exists city_table cascade; +psql:sql/trigger_on_view.inc:13: NOTICE: table "city_table" does not exist, skipping + 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') + RETURNING *; + country_id | country_name | continent +------------+--------------+--------------- + 1 | Japan | Asia + 2 | UK | Europe + 3 | USA | North America +(3 rows) + + + CREATE TABLE city_table ( + city_id serial primary key, + city_name text not null, + population bigint, + country_id int references country_table + ) using :tde_am; + + CREATE VIEW city_view AS + SELECT city_id, city_name, population, country_name, continent + FROM city_table ci + LEFT JOIN country_table co ON co.country_id = ci.country_id; + +CREATE OR REPLACE FUNCTION city_insert() RETURNS trigger LANGUAGE plpgsql AS $$ + declare + ctry_id int; + begin + if NEW.country_name IS NOT NULL then + SELECT country_id, continent INTO ctry_id, NEW.continent + FROM country_table WHERE country_name = NEW.country_name; + if NOT FOUND then + raise exception 'No such country: "%"', NEW.country_name; + end if; + else + NEW.continent := NULL; + end if; + + if NEW.city_id IS NOT NULL then + INSERT INTO city_table + VALUES(NEW.city_id, NEW.city_name, NEW.population, ctry_id); + else + INSERT INTO city_table(city_name, population, country_id) + VALUES(NEW.city_name, NEW.population, ctry_id) + RETURNING city_id INTO NEW.city_id; + end if; + + RETURN NEW; + end; + $$; + CREATE TRIGGER city_insert_trig INSTEAD OF INSERT ON city_view + FOR EACH ROW EXECUTE PROCEDURE city_insert(); + + CREATE OR REPLACE FUNCTION city_delete() RETURNS trigger LANGUAGE plpgsql AS $$ + begin + DELETE FROM city_table WHERE city_id = OLD.city_id; + if NOT FOUND then RETURN NULL; end if; + RETURN OLD; + end; + $$; + + CREATE TRIGGER city_delete_trig INSTEAD OF DELETE ON city_view + FOR EACH ROW EXECUTE PROCEDURE city_delete(); + + CREATE OR REPLACE FUNCTION city_update() RETURNS trigger LANGUAGE plpgsql AS $$ + declare + ctry_id int; + begin + if NEW.country_name IS DISTINCT FROM OLD.country_name then + SELECT country_id, continent INTO ctry_id, NEW.continent + FROM country_table WHERE country_name = NEW.country_name; + if NOT FOUND then + raise exception 'No such country: "%"', NEW.country_name; + end if; + + UPDATE city_table SET city_name = NEW.city_name, + population = NEW.population, + country_id = ctry_id + WHERE city_id = OLD.city_id; + else + UPDATE city_table SET city_name = NEW.city_name, + population = NEW.population + WHERE city_id = OLD.city_id; + NEW.continent := OLD.continent; + end if; + + if NOT FOUND then RETURN NULL; end if; + RETURN NEW; + end; + $$; + CREATE TRIGGER city_update_trig INSTEAD OF UPDATE ON city_view + FOR EACH ROW EXECUTE PROCEDURE city_update(); + +-- INSERT .. RETURNING + INSERT INTO city_view(city_name) VALUES('Tokyo') RETURNING *; + city_id | city_name | population | country_name | continent +---------+-----------+------------+--------------+----------- + 1 | Tokyo | | | +(1 row) + + INSERT INTO city_view(city_name, population) VALUES('London', 7556900) RETURNING *; + city_id | city_name | population | country_name | continent +---------+-----------+------------+--------------+----------- + 2 | London | 7556900 | | +(1 row) + + INSERT INTO city_view(city_name, country_name) VALUES('Washington DC', 'USA') RETURNING *; + city_id | city_name | population | country_name | continent +---------+---------------+------------+--------------+--------------- + 3 | Washington DC | | USA | North America +(1 row) + + INSERT INTO city_view(city_id, city_name) VALUES(123456, 'New York') RETURNING *; + city_id | city_name | population | country_name | continent +---------+-----------+------------+--------------+----------- + 123456 | New York | | | +(1 row) + + INSERT INTO city_view VALUES(234567, 'Birmingham', 1016800, 'UK', 'EU') RETURNING *; + city_id | city_name | population | country_name | continent +---------+------------+------------+--------------+----------- + 234567 | Birmingham | 1016800 | UK | Europe +(1 row) + + + -- UPDATE .. RETURNING + UPDATE city_view SET country_name = 'Japon' WHERE city_name = 'Tokyo'; -- error +psql:sql/trigger_on_view.inc:118: ERROR: No such country: "Japon" +CONTEXT: PL/pgSQL function city_update() line 9 at RAISE + UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Takyo'; -- no match + UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Tokyo' RETURNING *; -- OK + city_id | city_name | population | country_name | continent +---------+-----------+------------+--------------+----------- + 1 | Tokyo | | Japan | Asia +(1 row) + + + UPDATE city_view SET population = 13010279 WHERE city_name = 'Tokyo' RETURNING *; + city_id | city_name | population | country_name | continent +---------+-----------+------------+--------------+----------- + 1 | Tokyo | 13010279 | Japan | Asia +(1 row) + + UPDATE city_view SET country_name = 'UK' WHERE city_name = 'New York' RETURNING *; + city_id | city_name | population | country_name | continent +---------+-----------+------------+--------------+----------- + 123456 | New York | | UK | Europe +(1 row) + + UPDATE city_view SET country_name = 'USA', population = 8391881 WHERE city_name = 'New York' RETURNING *; + city_id | city_name | population | country_name | continent +---------+-----------+------------+--------------+--------------- + 123456 | New York | 8391881 | USA | North America +(1 row) + + UPDATE city_view SET continent = 'EU' WHERE continent = 'Europe' RETURNING *; + city_id | city_name | population | country_name | continent +---------+------------+------------+--------------+----------- + 234567 | Birmingham | 1016800 | UK | Europe +(1 row) + + UPDATE city_view v1 SET country_name = v2.country_name FROM city_view v2 + WHERE v2.city_name = 'Birmingham' AND v1.city_name = 'London' RETURNING *; + city_id | city_name | population | country_name | continent | city_id | city_name | population | country_name | continent +---------+-----------+------------+--------------+-----------+---------+------------+------------+--------------+----------- + 2 | London | 7556900 | UK | Europe | 234567 | Birmingham | 1016800 | UK | Europe +(1 row) + + + -- DELETE .. RETURNING + DELETE FROM city_view WHERE city_name = 'Birmingham' RETURNING *; + city_id | city_name | population | country_name | continent +---------+------------+------------+--------------+----------- + 234567 | Birmingham | 1016800 | UK | Europe +(1 row) + + +DROP extension pg_tde CASCADE; +psql:sql/trigger_on_view.inc:133: NOTICE: drop cascades to 3 other objects +DETAIL: drop cascades to table country_table +drop cascades to table city_table +drop cascades to view city_view diff --git a/expected/update_compare_indexes.out b/expected/update_compare_indexes.out index 112baa98..3e21417f 100644 --- a/expected/update_compare_indexes.out +++ b/expected/update_compare_indexes.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\i sql/update_compare_indexes.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 @@ -12,8 +14,8 @@ SELECT pg_tde_set_principal_key('test-db-principal-key','file-vault'); (1 row) DROP TABLE IF EXISTS pvactst; -NOTICE: table "pvactst" does not exist, skipping -CREATE TABLE pvactst (i INT, a INT[], p POINT) USING tde_heap_basic; +psql:sql/update_compare_indexes.inc:6: NOTICE: table "pvactst" does not exist, skipping +CREATE TABLE pvactst (i INT, a INT[], p POINT) USING :tde_am; 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; diff --git a/expected/update_compare_indexes_basic.out b/expected/update_compare_indexes_basic.out new file mode 100644 index 00000000..0840810e --- /dev/null +++ b/expected/update_compare_indexes_basic.out @@ -0,0 +1,24 @@ +\set tde_am tde_heap_basic +\i sql/update_compare_indexes.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) + +DROP TABLE IF EXISTS pvactst; +psql:sql/update_compare_indexes.inc:6: NOTICE: table "pvactst" does not exist, skipping +CREATE TABLE pvactst (i INT, a INT[], p POINT) USING :tde_am; +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; +-- crash! +DROP TABLE pvactst; +DROP EXTENSION pg_tde; diff --git a/expected/vault_v2_test.out b/expected/vault_v2_test.out index 76145eb2..789a6ec7 100644 --- a/expected/vault_v2_test.out +++ b/expected/vault_v2_test.out @@ -1,3 +1,5 @@ +\set tde_am tde_heap +\i sql/vault_v2_test.inc CREATE EXTENSION pg_tde; \getenv root_token ROOT_TOKEN SELECT pg_tde_add_key_provider_vault_v2('vault-v2',:'root_token','http://127.0.0.1:8200','secret',NULL); @@ -16,7 +18,7 @@ CREATE TABLE test_enc( id SERIAL, k INTEGER DEFAULT '0' NOT NULL, PRIMARY KEY (id) - ) USING tde_heap_basic; + ) USING :tde_am; INSERT INTO test_enc (k) VALUES (1); INSERT INTO test_enc (k) VALUES (2); INSERT INTO test_enc (k) VALUES (3); diff --git a/expected/vault_v2_test_basic.out b/expected/vault_v2_test_basic.out new file mode 100644 index 00000000..c3cc0204 --- /dev/null +++ b/expected/vault_v2_test_basic.out @@ -0,0 +1,34 @@ +\set tde_am tde_heap_basic +\i sql/vault_v2_test.inc +CREATE EXTENSION pg_tde; +\getenv root_token ROOT_TOKEN +SELECT pg_tde_add_key_provider_vault_v2('vault-v2',:'root_token','http://127.0.0.1:8200','secret',NULL); + pg_tde_add_key_provider_vault_v2 +---------------------------------- + 1 +(1 row) + +SELECT pg_tde_set_principal_key('vault-v2-principal-key','vault-v2'); + pg_tde_set_principal_key +-------------------------- + t +(1 row) + +CREATE TABLE test_enc( + id SERIAL, + k INTEGER DEFAULT '0' NOT NULL, + PRIMARY KEY (id) + ) USING :tde_am; +INSERT INTO test_enc (k) VALUES (1); +INSERT INTO test_enc (k) VALUES (2); +INSERT INTO test_enc (k) VALUES (3); +SELECT * from test_enc; + id | k +----+--- + 1 | 1 + 2 | 2 + 3 | 3 +(3 rows) + +DROP TABLE test_enc; +DROP EXTENSION pg_tde; diff --git a/meson.build b/meson.build index aa45a232..05067b04 100644 --- a/meson.build +++ b/meson.build @@ -82,12 +82,25 @@ install_data( kwargs: contrib_data_args, ) -tests += { - 'name': 'pg_tde', - 'sd': meson.current_source_dir(), - 'bd': meson.current_build_dir(), - 'regress': { - 'sql': [ + +sql_tests = [ + 'toast_decrypt_basic', + 'toast_extended_storage_basic', + 'move_large_tuples_basic', + 'non_sorted_off_compact_basic', + 'update_compare_indexes_basic', + 'pg_tde_is_encrypted_basic', + 'test_issue_153_fix_basic', + 'multi_insert_basic', + 'keyprovider_dependency_basic', + 'trigger_on_view_basic', + 'change_access_method_basic', + 'insert_update_delete_basic', + 'vault_v2_test_basic', +] + +if get_variable('percona_ext', false) + sql_tests += [ 'toast_decrypt', 'toast_extended_storage', 'move_large_tuples', @@ -101,7 +114,15 @@ tests += { 'change_access_method', 'insert_update_delete', 'vault_v2_test', - ], + ] +endif + +tests += { + 'name': 'pg_tde', + 'sd': meson.current_source_dir(), + 'bd': meson.current_build_dir(), + 'regress': { + 'sql': sql_tests, 'regress_args': ['--temp-config', files('pg_tde.conf')], 'runningcheck': false, }, diff --git a/sql/change_access_method.inc b/sql/change_access_method.inc new file mode 100644 index 00000000..0849e681 --- /dev/null +++ b/sql/change_access_method.inc @@ -0,0 +1,43 @@ +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 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; + +SELECT pg_tde_is_encrypted('country_table'); + +-- 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; +SELECT pg_tde_is_encrypted('country_table'); + +-- 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; +SELECT pg_tde_is_encrypted('country_table'); + +DROP TABLE country_table; +DROP EXTENSION pg_tde; diff --git a/sql/change_access_method.sql b/sql/change_access_method.sql index 102096b5..e9c1d765 100644 --- a/sql/change_access_method.sql +++ b/sql/change_access_method.sql @@ -1,43 +1,2 @@ -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 country_table ( - country_id serial primary key, - country_name text unique not null, - continent text not null - ) using tde_heap_basic; - - INSERT INTO country_table (country_name, continent) - VALUES ('Japan', 'Asia'), - ('UK', 'Europe'), - ('USA', 'North America'); - -SELECT * FROM country_table; - -SELECT pg_tde_is_encrypted('country_table'); - --- 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; -SELECT pg_tde_is_encrypted('country_table'); - --- Change it back to encrypted -ALTER TABLE country_table SET access method tde_heap_basic; - -INSERT INTO country_table (country_name, continent) - VALUES ('China', 'Asia'), - ('Brazil', 'South America'), - ('Australia', 'Oceania'); -SELECT * FROM country_table; -SELECT pg_tde_is_encrypted('country_table'); - -DROP TABLE country_table; -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/change_access_method.inc diff --git a/sql/change_access_method_basic.sql b/sql/change_access_method_basic.sql new file mode 100644 index 00000000..9cd4a58e --- /dev/null +++ b/sql/change_access_method_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/change_access_method.inc diff --git a/sql/insert_update_delete.inc b/sql/insert_update_delete.inc new file mode 100644 index 00000000..23acc279 --- /dev/null +++ b/sql/insert_update_delete.inc @@ -0,0 +1,41 @@ +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 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; + +DELETE FROM albums WHERE id % 4 = 0; +SELECT * FROM albums; + +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; + +DROP TABLE albums; +DROP EXTENSION pg_tde; diff --git a/sql/insert_update_delete.sql b/sql/insert_update_delete.sql index 83b07ecc..76a81e26 100644 --- a/sql/insert_update_delete.sql +++ b/sql/insert_update_delete.sql @@ -1,41 +1,2 @@ -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 albums ( - id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, - artist VARCHAR(256), - title TEXT NOT NULL, - released DATE NOT NULL -) 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'), - ('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; - -DELETE FROM albums WHERE id % 4 = 0; -SELECT * FROM albums; - -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; - -DROP TABLE albums; -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/insert_update_delete.inc \ No newline at end of file diff --git a/sql/insert_update_delete_basic.sql b/sql/insert_update_delete_basic.sql new file mode 100644 index 00000000..c77ba273 --- /dev/null +++ b/sql/insert_update_delete_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/insert_update_delete.inc \ No newline at end of file diff --git a/sql/keyprovider_dependency.inc b/sql/keyprovider_dependency.inc new file mode 100644 index 00000000..26575ecd --- /dev/null +++ b/sql/keyprovider_dependency.inc @@ -0,0 +1,11 @@ +CREATE EXTENSION pg_tde; + +SELECT pg_tde_add_key_provider_file('mk-file','/tmp/pg_tde_test_keyring.per'); +SELECT pg_tde_add_key_provider_file('free-file','/tmp/pg_tde_test_keyring_2.per'); +SELECT pg_tde_add_key_provider_vault_v2('V2-vault','vault-token','percona.com/vault-v2/percona','/mount/dev','ca-cert-auth'); + +SELECT * FROM pg_tde_list_all_key_providers(); + +SELECT pg_tde_set_principal_key('test-db-principal-key','mk-file'); + +DROP EXTENSION pg_tde; diff --git a/sql/keyprovider_dependency.sql b/sql/keyprovider_dependency.sql index 26575ecd..03eebf0d 100644 --- a/sql/keyprovider_dependency.sql +++ b/sql/keyprovider_dependency.sql @@ -1,11 +1,2 @@ -CREATE EXTENSION pg_tde; - -SELECT pg_tde_add_key_provider_file('mk-file','/tmp/pg_tde_test_keyring.per'); -SELECT pg_tde_add_key_provider_file('free-file','/tmp/pg_tde_test_keyring_2.per'); -SELECT pg_tde_add_key_provider_vault_v2('V2-vault','vault-token','percona.com/vault-v2/percona','/mount/dev','ca-cert-auth'); - -SELECT * FROM pg_tde_list_all_key_providers(); - -SELECT pg_tde_set_principal_key('test-db-principal-key','mk-file'); - -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/keyprovider_dependency.inc \ No newline at end of file diff --git a/sql/keyprovider_dependency_basic.sql b/sql/keyprovider_dependency_basic.sql new file mode 100644 index 00000000..9832915c --- /dev/null +++ b/sql/keyprovider_dependency_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/keyprovider_dependency.inc \ No newline at end of file diff --git a/sql/move_large_tuples.inc b/sql/move_large_tuples.inc new file mode 100644 index 00000000..36d09077 --- /dev/null +++ b/sql/move_large_tuples.inc @@ -0,0 +1,36 @@ +-- test pg_tde_move_encrypted_data() +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 sbtest2( + id SERIAL, + k TEXT STORAGE PLAIN, + PRIMARY KEY (id) + ) USING :tde_am; + +INSERT INTO sbtest2(k) VALUES(repeat('a', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('b', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('c', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('d', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('e', 2500)); + +DELETE FROM sbtest2 WHERE id IN (2,3,4); +VACUUM sbtest2; +SELECT * FROM sbtest2; + +INSERT INTO sbtest2(k) VALUES(repeat('b', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('c', 2500)); +INSERT INTO sbtest2(k) VALUES(repeat('d', 2500)); + +DELETE FROM sbtest2 WHERE id IN (7); +VACUUM sbtest2; + +SELECT * FROM sbtest2; + +VACUUM FULL sbtest2; +SELECT * FROM sbtest2; + +DROP TABLE sbtest2; +DROP EXTENSION pg_tde; diff --git a/sql/move_large_tuples.sql b/sql/move_large_tuples.sql index f674ab24..1b6e7f8a 100644 --- a/sql/move_large_tuples.sql +++ b/sql/move_large_tuples.sql @@ -1,36 +1,2 @@ --- test pg_tde_move_encrypted_data() -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 sbtest2( - id SERIAL, - k TEXT STORAGE PLAIN, - PRIMARY KEY (id) - ) 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)); -INSERT INTO sbtest2(k) VALUES(repeat('d', 2500)); -INSERT INTO sbtest2(k) VALUES(repeat('e', 2500)); - -DELETE FROM sbtest2 WHERE id IN (2,3,4); -VACUUM sbtest2; -SELECT * FROM sbtest2; - -INSERT INTO sbtest2(k) VALUES(repeat('b', 2500)); -INSERT INTO sbtest2(k) VALUES(repeat('c', 2500)); -INSERT INTO sbtest2(k) VALUES(repeat('d', 2500)); - -DELETE FROM sbtest2 WHERE id IN (7); -VACUUM sbtest2; - -SELECT * FROM sbtest2; - -VACUUM FULL sbtest2; -SELECT * FROM sbtest2; - -DROP TABLE sbtest2; -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/move_large_tuples.inc \ No newline at end of file diff --git a/sql/move_large_tuples_basic.sql b/sql/move_large_tuples_basic.sql new file mode 100644 index 00000000..9e5df21d --- /dev/null +++ b/sql/move_large_tuples_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/move_large_tuples.inc \ No newline at end of file diff --git a/sql/multi_insert.inc b/sql/multi_insert.inc new file mode 100644 index 00000000..88b92060 --- /dev/null +++ b/sql/multi_insert.inc @@ -0,0 +1,1396 @@ +-- trigger multi_insert path +-- +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 albums ( + album_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + artist_id INTEGER, + title TEXT NOT NULL, + released DATE NOT NULL +) USING :tde_am; + +COPY albums FROM stdin CSV HEADER; +album_id,artist_id,title,released +1,1,"Mirror",2009-06-24 +2,2,"Pretzel Logic",1974-02-20 +3,3,"Under Construction",2002-11-12 +4,4,"Return to Wherever",2019-07-11 +5,5,"The Nightfly",1982-10-01 +6,6,"It's Alive",2013-10-15 +7,7,"Pure Ella",1994-02-15 +\. + +SELECT * FROM albums; +SELECT * FROM albums where album_id > 5; +-- On replica: +-- SELECT * FROM albums; +-- album_id | artist_id | title | released +-- ----------+-----------+--------------------+------------ +-- 1 | 1 | Mirror | 2009-06-24 +-- 2 | 2 | Pretzel Logic | 1974-02-20 +-- 3 | 3 | Under Construction | 2002-11-12 +-- 4 | 4 | Return to Wherever | 2019-07-11 +-- 5 | 5 | The Nightfly | 1982-10-01 +-- 6 | 6 | It's Alive | 2013-10-15 +-- 7 | 7 | Pure Ella | 1994-02-15 +-- (7 rows) +-- +-- SELECT * FROM albums where album_id > 5; +-- album_id | artist_id | title | released +-- ----------+-----------+------------+------------ +-- 6 | 6 | It's Alive | 2013-10-15 +-- 7 | 7 | Pure Ella | 1994-02-15 +-- (2 rows) +-- +DROP TABLE albums; + +-- multi_insert2 +-- more data to take multiple pages +CREATE TABLE Towns ( + id SERIAL UNIQUE NOT NULL, + code VARCHAR(10) NOT NULL, + article TEXT, + name TEXT NOT NULL, + department VARCHAR(4) NOT NULL, + UNIQUE (code, department) +) USING :tde_am; + +COPY towns (id, code, article, name, department) FROM stdin; +1 001 some_text Abergement-Clémenciat 01 +2 002 some_text Abergement-de-Varey 01 +3 004 some_text Ambérieu-en-Bugey 01 +4 005 some_text Ambérieux-en-Dombes 01 +5 006 some_text Ambléon 01 +6 007 some_text Ambronay 01 +7 008 some_text Ambutrix 01 +8 009 some_text Andert-et-Condon 01 +9 010 some_text Anglefort 01 +10 011 some_text Apremont 01 +11 012 some_text Aranc 01 +12 013 some_text Arandas 01 +13 014 some_text Arbent 01 +14 015 some_text Arbignieu 01 +15 016 some_text Arbigny 01 +16 017 some_text Argis 01 +17 019 some_text Armix 01 +18 021 some_text Ars-sur-Formans 01 +19 022 some_text Artemare 01 +20 023 some_text Asnières-sur-Saône 01 +21 024 some_text Attignat 01 +22 025 some_text Bâgé-la-Ville 01 +23 026 some_text Bâgé-le-Châtel 01 +24 027 some_text Balan 01 +25 028 some_text Baneins 01 +26 029 some_text Beaupont 01 +27 030 some_text Beauregard 01 +28 031 some_text Bellignat 01 +29 032 some_text Béligneux 01 +30 033 some_text Bellegarde-sur-Valserine 01 +31 034 some_text Belley 01 +32 035 some_text Belleydoux 01 +33 036 some_text Belmont-Luthézieu 01 +34 037 some_text Bénonces 01 +35 038 some_text Bény 01 +36 039 some_text Béon 01 +37 040 some_text Béréziat 01 +38 041 some_text Bettant 01 +39 042 some_text Bey 01 +40 043 some_text Beynost 01 +41 044 some_text Billiat 01 +42 045 some_text Birieux 01 +43 046 some_text Biziat 01 +44 047 some_text Blyes 01 +45 049 some_text Boisse 01 +46 050 some_text Boissey 01 +47 051 some_text Bolozon 01 +48 052 some_text Bouligneux 01 +49 053 some_text Bourg-en-Bresse 01 +50 054 some_text Bourg-Saint-Christophe 01 +51 056 some_text Boyeux-Saint-Jérôme 01 +52 057 some_text Boz 01 +53 058 some_text Brégnier-Cordon 01 +54 059 some_text Brénaz 01 +55 060 some_text Brénod 01 +56 061 some_text Brens 01 +57 062 some_text Bressolles 01 +58 063 some_text Brion 01 +59 064 some_text Briord 01 +60 065 some_text Buellas 01 +61 066 some_text Burbanche 01 +62 067 some_text Ceignes 01 +63 068 some_text Cerdon 01 +64 069 some_text Certines 01 +65 071 some_text Cessy 01 +66 072 some_text Ceyzériat 01 +67 073 some_text Ceyzérieu 01 +68 074 some_text Chalamont 01 +69 075 some_text Chaleins 01 +70 076 some_text Chaley 01 +71 077 some_text Challes 01 +72 078 some_text Challex 01 +73 079 some_text Champagne-en-Valromey 01 +74 080 some_text Champdor 01 +75 081 some_text Champfromier 01 +76 082 some_text Chanay 01 +77 083 some_text Chaneins 01 +78 084 some_text Chanoz-Châtenay 01 +79 085 some_text Chapelle-du-Châtelard 01 +80 087 some_text Charix 01 +81 088 some_text Charnoz-sur-Ain 01 +82 089 some_text Château-Gaillard 01 +83 090 some_text Châtenay 01 +84 091 some_text Châtillon-en-Michaille 01 +85 092 some_text Châtillon-la-Palud 01 +86 093 some_text Châtillon-sur-Chalaronne 01 +87 094 some_text Chavannes-sur-Reyssouze 01 +88 095 some_text Chavannes-sur-Suran 01 +89 096 some_text Chaveyriat 01 +90 097 some_text Chavornay 01 +91 098 some_text Chazey-Bons 01 +92 099 some_text Chazey-sur-Ain 01 +93 100 some_text Cheignieu-la-Balme 01 +94 101 some_text Chevillard 01 +95 102 some_text Chevroux 01 +96 103 some_text Chevry 01 +97 104 some_text Chézery-Forens 01 +98 105 some_text Civrieux 01 +99 106 some_text Cize 01 +100 107 some_text Cleyzieu 01 +101 108 some_text Coligny 01 +102 109 some_text Collonges 01 +103 110 some_text Colomieu 01 +104 111 some_text Conand 01 +105 112 some_text Condamine 01 +106 113 some_text Condeissiat 01 +107 114 some_text Confort 01 +108 115 some_text Confrançon 01 +109 116 some_text Contrevoz 01 +110 117 some_text Conzieu 01 +111 118 some_text Corbonod 01 +112 119 some_text Corcelles 01 +113 121 some_text Corlier 01 +114 122 some_text Cormaranche-en-Bugey 01 +115 123 some_text Cormoranche-sur-Saône 01 +116 124 some_text Cormoz 01 +117 125 some_text Corveissiat 01 +118 127 some_text Courmangoux 01 +119 128 some_text Courtes 01 +120 129 some_text Crans 01 +121 130 some_text Cras-sur-Reyssouze 01 +122 133 some_text Cressin-Rochefort 01 +123 134 some_text Crottet 01 +124 135 some_text Crozet 01 +125 136 some_text Cruzilles-lès-Mépillat 01 +126 138 some_text Culoz 01 +127 139 some_text Curciat-Dongalon 01 +128 140 some_text Curtafond 01 +129 141 some_text Cuzieu 01 +130 142 some_text Dagneux 01 +131 143 some_text Divonne-les-Bains 01 +132 144 some_text Dommartin 01 +133 145 some_text Dompierre-sur-Veyle 01 +134 146 some_text Dompierre-sur-Chalaronne 01 +135 147 some_text Domsure 01 +136 148 some_text Dortan 01 +137 149 some_text Douvres 01 +138 150 some_text Drom 01 +139 151 some_text Druillat 01 +140 152 some_text Échallon 01 +141 153 some_text Échenevex 01 +142 154 some_text Étrez 01 +143 155 some_text Évosges 01 +144 156 some_text Faramans 01 +145 157 some_text Fareins 01 +146 158 some_text Farges 01 +147 159 some_text Feillens 01 +148 160 some_text Ferney-Voltaire 01 +149 162 some_text Flaxieu 01 +150 163 some_text Foissiat 01 +151 165 some_text Francheleins 01 +152 166 some_text Frans 01 +153 167 some_text Garnerans 01 +154 169 some_text Genouilleux 01 +155 170 some_text Géovreissiat 01 +156 171 some_text Géovreisset 01 +157 172 some_text Germagnat 01 +158 173 some_text Gex 01 +159 174 some_text Giron 01 +160 175 some_text Gorrevod 01 +161 176 some_text Grand-Abergement 01 +162 177 some_text Grand-Corent 01 +163 179 some_text Grièges 01 +164 180 some_text Grilly 01 +165 181 some_text Groissiat 01 +166 182 some_text Groslée 01 +167 183 some_text Guéreins 01 +168 184 some_text Hautecourt-Romanèche 01 +169 185 some_text Hauteville-Lompnes 01 +170 186 some_text Hostias 01 +171 187 some_text Hotonnes 01 +172 188 some_text Illiat 01 +173 189 some_text Injoux-Génissiat 01 +174 190 some_text Innimond 01 +175 191 some_text Izenave 01 +176 192 some_text Izernore 01 +177 193 some_text Izieu 01 +178 194 some_text Jassans-Riottier 01 +179 195 some_text Jasseron 01 +180 196 some_text Jayat 01 +181 197 some_text Journans 01 +182 198 some_text Joyeux 01 +183 199 some_text Jujurieux 01 +184 200 some_text Labalme 01 +185 202 some_text Lagnieu 01 +186 203 some_text Laiz 01 +187 204 some_text Lalleyriat 01 +188 205 some_text Lancrans 01 +189 206 some_text Lantenay 01 +190 207 some_text Lapeyrouse 01 +191 208 some_text Lavours 01 +192 209 some_text Léaz 01 +193 210 some_text Lélex 01 +194 211 some_text Lent 01 +195 212 some_text Lescheroux 01 +196 213 some_text Leyment 01 +197 214 some_text Leyssard 01 +198 215 some_text Lhôpital 01 +199 216 some_text Lhuis 01 +200 218 some_text Lochieu 01 +201 219 some_text Lompnas 01 +202 221 some_text Lompnieu 01 +203 224 some_text Loyettes 01 +204 225 some_text Lurcy 01 +205 227 some_text Magnieu 01 +206 228 some_text Maillat 01 +207 229 some_text Malafretaz 01 +208 230 some_text Mantenay-Montlin 01 +209 231 some_text Manziat 01 +210 232 some_text Marboz 01 +211 233 some_text Marchamp 01 +212 234 some_text Marignieu 01 +213 235 some_text Marlieux 01 +214 236 some_text Marsonnas 01 +215 237 some_text Martignat 01 +216 238 some_text Massieux 01 +217 239 some_text Massignieu-de-Rives 01 +218 240 some_text Matafelon-Granges 01 +219 241 some_text Meillonnas 01 +220 242 some_text Mérignat 01 +221 243 some_text Messimy-sur-Saône 01 +222 244 some_text Meximieux 01 +223 245 some_text Bohas-Meyriat-Rignat 01 +224 246 some_text Mézériat 01 +225 247 some_text Mijoux 01 +226 248 some_text Mionnay 01 +227 249 some_text Miribel 01 +228 250 some_text Misérieux 01 +229 252 some_text Mogneneins 01 +230 254 some_text Montagnat 01 +231 255 some_text Montagnieu 01 +232 257 some_text Montanges 01 +233 258 some_text Montceaux 01 +234 259 some_text Montcet 01 +235 260 some_text Montellier 01 +236 261 some_text Monthieux 01 +237 262 some_text Montluel 01 +238 263 some_text Montmerle-sur-Saône 01 +239 264 some_text Montracol 01 +240 265 some_text Montréal-la-Cluse 01 +241 266 some_text Montrevel-en-Bresse 01 +242 267 some_text Nurieux-Volognat 01 +243 268 some_text Murs-et-Gélignieux 01 +244 269 some_text Nantua 01 +245 271 some_text Nattages 01 +246 272 some_text Neuville-les-Dames 01 +247 273 some_text Neuville-sur-Ain 01 +248 274 some_text Neyrolles 01 +249 275 some_text Neyron 01 +250 276 some_text Niévroz 01 +251 277 some_text Nivollet-Montgriffon 01 +252 279 some_text Oncieu 01 +253 280 some_text Ordonnaz 01 +254 281 some_text Ornex 01 +255 282 some_text Outriaz 01 +256 283 some_text Oyonnax 01 +257 284 some_text Ozan 01 +258 285 some_text Parcieux 01 +259 286 some_text Parves 01 +260 288 some_text Péron 01 +261 289 some_text Péronnas 01 +262 290 some_text Pérouges 01 +263 291 some_text Perrex 01 +264 292 some_text Petit-Abergement 01 +265 293 some_text Peyriat 01 +266 294 some_text Peyrieu 01 +267 295 some_text Peyzieux-sur-Saône 01 +268 296 some_text Pirajoux 01 +269 297 some_text Pizay 01 +270 298 some_text Plagne 01 +271 299 some_text Plantay 01 +272 300 some_text Poizat 01 +273 301 some_text Polliat 01 +274 302 some_text Pollieu 01 +275 303 some_text Poncin 01 +276 304 some_text Pont-d'Ain 01 +277 305 some_text Pont-de-Vaux 01 +278 306 some_text Pont-de-Veyle 01 +279 307 some_text Port 01 +280 308 some_text Pougny 01 +281 309 some_text Pouillat 01 +282 310 some_text Prémeyzel 01 +283 311 some_text Prémillieu 01 +284 312 some_text Pressiat 01 +285 313 some_text Prévessin-Moëns 01 +286 314 some_text Priay 01 +287 316 some_text Pugieu 01 +288 317 some_text Ramasse 01 +289 318 some_text Rancé 01 +290 319 some_text Relevant 01 +291 320 some_text Replonges 01 +292 321 some_text Revonnas 01 +293 322 some_text Reyrieux 01 +294 323 some_text Reyssouze 01 +295 325 some_text Rignieux-le-Franc 01 +296 328 some_text Romans 01 +297 329 some_text Rossillon 01 +298 330 some_text Ruffieu 01 +299 331 some_text Saint-Alban 01 +300 332 some_text Saint-André-de-Bâgé 01 +301 333 some_text Saint-André-de-Corcy 01 +302 334 some_text Saint-André-d'Huiriat 01 +303 335 some_text Saint-André-le-Bouchoux 01 +304 336 some_text Saint-André-sur-Vieux-Jonc 01 +305 337 some_text Saint-Bénigne 01 +306 338 some_text Saint-Benoît 01 +307 339 some_text Saint-Bernard 01 +308 340 some_text Saint-Bois 01 +309 341 some_text Saint-Champ 01 +310 342 some_text Sainte-Croix 01 +311 343 some_text Saint-Cyr-sur-Menthon 01 +312 344 some_text Saint-Denis-lès-Bourg 01 +313 345 some_text Saint-Denis-en-Bugey 01 +314 346 some_text Saint-Didier-d'Aussiat 01 +315 347 some_text Saint-Didier-de-Formans 01 +316 348 some_text Saint-Didier-sur-Chalaronne 01 +317 349 some_text Saint-Éloi 01 +318 350 some_text Saint-Étienne-du-Bois 01 +319 351 some_text Saint-Étienne-sur-Chalaronne 01 +320 352 some_text Saint-Étienne-sur-Reyssouze 01 +321 353 some_text Sainte-Euphémie 01 +322 354 some_text Saint-Genis-Pouilly 01 +323 355 some_text Saint-Genis-sur-Menthon 01 +324 356 some_text Saint-Georges-sur-Renon 01 +325 357 some_text Saint-Germain-de-Joux 01 +326 358 some_text Saint-Germain-les-Paroisses 01 +327 359 some_text Saint-Germain-sur-Renon 01 +328 360 some_text Saint-Jean-de-Gonville 01 +329 361 some_text Saint-Jean-de-Niost 01 +330 362 some_text Saint-Jean-de-Thurigneux 01 +331 363 some_text Saint-Jean-le-Vieux 01 +332 364 some_text Saint-Jean-sur-Reyssouze 01 +333 365 some_text Saint-Jean-sur-Veyle 01 +334 366 some_text Sainte-Julie 01 +335 367 some_text Saint-Julien-sur-Reyssouze 01 +336 368 some_text Saint-Julien-sur-Veyle 01 +337 369 some_text Saint-Just 01 +338 370 some_text Saint-Laurent-sur-Saône 01 +339 371 some_text Saint-Marcel 01 +340 372 some_text Saint-Martin-de-Bavel 01 +341 373 some_text Saint-Martin-du-Frêne 01 +342 374 some_text Saint-Martin-du-Mont 01 +343 375 some_text Saint-Martin-le-Châtel 01 +344 376 some_text Saint-Maurice-de-Beynost 01 +345 378 some_text Saint-Maurice-de-Gourdans 01 +346 379 some_text Saint-Maurice-de-Rémens 01 +347 380 some_text Saint-Nizier-le-Bouchoux 01 +348 381 some_text Saint-Nizier-le-Désert 01 +349 382 some_text Sainte-Olive 01 +350 383 some_text Saint-Paul-de-Varax 01 +351 384 some_text Saint-Rambert-en-Bugey 01 +352 385 some_text Saint-Rémy 01 +353 386 some_text Saint-Sorlin-en-Bugey 01 +354 387 some_text Saint-Sulpice 01 +355 388 some_text Saint-Trivier-de-Courtes 01 +356 389 some_text Saint-Trivier-sur-Moignans 01 +357 390 some_text Saint-Vulbas 01 +358 391 some_text Salavre 01 +359 392 some_text Samognat 01 +360 393 some_text Sandrans 01 +361 396 some_text Sault-Brénaz 01 +362 397 some_text Sauverny 01 +363 398 some_text Savigneux 01 +364 399 some_text Ségny 01 +365 400 some_text Seillonnaz 01 +366 401 some_text Sergy 01 +367 402 some_text Sermoyer 01 +368 403 some_text Serrières-de-Briord 01 +369 404 some_text Serrières-sur-Ain 01 +370 405 some_text Servas 01 +371 406 some_text Servignat 01 +372 407 some_text Seyssel 01 +373 408 some_text Simandre-sur-Suran 01 +374 409 some_text Songieu 01 +375 410 some_text Sonthonnax-la-Montagne 01 +376 411 some_text Souclin 01 +377 412 some_text Sulignat 01 +378 413 some_text Surjoux 01 +379 414 some_text Sutrieu 01 +380 415 some_text Talissieu 01 +381 416 some_text Tenay 01 +382 417 some_text Thézillieu 01 +383 418 some_text Thil 01 +384 419 some_text Thoiry 01 +385 420 some_text Thoissey 01 +386 421 some_text Torcieu 01 +387 422 some_text Tossiat 01 +388 423 some_text Toussieux 01 +389 424 some_text Tramoyes 01 +390 425 some_text Tranclière 01 +391 426 some_text Treffort-Cuisiat 01 +392 427 some_text Trévoux 01 +393 428 some_text Valeins 01 +394 429 some_text Vandeins 01 +395 430 some_text Varambon 01 +396 431 some_text Vaux-en-Bugey 01 +397 432 some_text Verjon 01 +398 433 some_text Vernoux 01 +399 434 some_text Versailleux 01 +400 435 some_text Versonnex 01 +401 436 some_text Vesancy 01 +402 437 some_text Vescours 01 +403 439 some_text Vésines 01 +404 441 some_text Vieu-d'Izenave 01 +405 442 some_text Vieu 01 +406 443 some_text Villars-les-Dombes 01 +407 444 some_text Villebois 01 +408 445 some_text Villemotier 01 +409 446 some_text Villeneuve 01 +410 447 some_text Villereversure 01 +411 448 some_text Villes 01 +412 449 some_text Villette-sur-Ain 01 +413 450 some_text Villieu-Loyes-Mollon 01 +414 451 some_text Viriat 01 +415 452 some_text Virieu-le-Grand 01 +416 453 some_text Virieu-le-Petit 01 +417 454 some_text Virignin 01 +418 456 some_text Vongnes 01 +419 457 some_text Vonnas 01 +420 001 some_text Abbécourt 02 +421 002 some_text Achery 02 +422 003 some_text Acy 02 +423 004 some_text Agnicourt-et-Séchelles 02 +424 005 some_text Aguilcourt 02 +425 006 some_text Aisonville-et-Bernoville 02 +426 007 some_text Aizelles 02 +427 008 some_text Aizy-Jouy 02 +428 009 some_text Alaincourt 02 +429 010 some_text Allemant 02 +430 011 some_text Ambleny 02 +431 012 some_text Ambrief 02 +432 013 some_text Amifontaine 02 +433 014 some_text Amigny-Rouy 02 +434 015 some_text Ancienville 02 +435 016 some_text Andelain 02 +436 017 some_text Anguilcourt-le-Sart 02 +437 018 some_text Anizy-le-Château 02 +438 019 some_text Annois 02 +439 020 some_text Any-Martin-Rieux 02 +440 021 some_text Archon 02 +441 022 some_text Arcy-Sainte-Restitue 02 +442 023 some_text Armentières-sur-Ourcq 02 +443 024 some_text Arrancy 02 +444 025 some_text Artemps 02 +445 026 some_text Artonges 02 +446 027 some_text Assis-sur-Serre 02 +447 028 some_text Athies-sous-Laon 02 +448 029 some_text Attilly 02 +449 030 some_text Aubencheul-aux-Bois 02 +450 031 some_text Aubenton 02 +451 032 some_text Aubigny-aux-Kaisnes 02 +452 033 some_text Aubigny-en-Laonnois 02 +453 034 some_text Audignicourt 02 +454 035 some_text Audigny 02 +455 036 some_text Augy 02 +456 037 some_text Aulnois-sous-Laon 02 +457 038 some_text Autels 02 +458 039 some_text Autremencourt 02 +459 040 some_text Autreppes 02 +460 041 some_text Autreville 02 +461 042 some_text Azy-sur-Marne 02 +462 043 some_text Bagneux 02 +463 044 some_text Bancigny 02 +464 046 some_text Barenton-Bugny 02 +465 047 some_text Barenton-Cel 02 +466 048 some_text Barenton-sur-Serre 02 +467 049 some_text Barisis 02 +468 050 some_text Barzy-en-Thiérache 02 +469 051 some_text Barzy-sur-Marne 02 +470 052 some_text Bassoles-Aulers 02 +471 053 some_text Baulne-en-Brie 02 +472 054 some_text Bazoches-sur-Vesles 02 +473 055 some_text Beaumé 02 +474 056 some_text Beaumont-en-Beine 02 +475 057 some_text Beaurevoir 02 +476 058 some_text Beaurieux 02 +477 059 some_text Beautor 02 +478 060 some_text Beauvois-en-Vermandois 02 +479 061 some_text Becquigny 02 +480 062 some_text Belleau 02 +481 063 some_text Bellenglise 02 +482 064 some_text Belleu 02 +483 065 some_text Bellicourt 02 +484 066 some_text Benay 02 +485 067 some_text Bergues-sur-Sambre 02 +486 068 some_text Berlancourt 02 +487 069 some_text Berlise 02 +488 070 some_text Bernot 02 +489 071 some_text Berny-Rivière 02 +490 072 some_text Berrieux 02 +491 073 some_text Berry-au-Bac 02 +492 074 some_text Bertaucourt-Epourdon 02 +493 075 some_text Berthenicourt 02 +494 076 some_text Bertricourt 02 +495 077 some_text Berzy-le-Sec 02 +496 078 some_text Besmé 02 +497 079 some_text Besmont 02 +498 080 some_text Besny-et-Loizy 02 +499 081 some_text Béthancourt-en-Vaux 02 +500 082 some_text Beugneux 02 +501 083 some_text Beuvardes 02 +502 084 some_text Bézu-le-Guéry 02 +503 085 some_text Bézu-Saint-Germain 02 +504 086 some_text Bichancourt 02 +505 087 some_text Bieuxy 02 +506 088 some_text Bièvres 02 +507 089 some_text Billy-sur-Aisne 02 +508 090 some_text Billy-sur-Ourcq 02 +509 091 some_text Blanzy-lès-Fismes 02 +510 093 some_text Blérancourt 02 +511 094 some_text Blesmes 02 +512 095 some_text Bohain-en-Vermandois 02 +513 096 some_text Bois-lès-Pargny 02 +514 097 some_text Boncourt 02 +515 098 some_text Bonneil 02 +516 099 some_text Bonnesvalyn 02 +517 100 some_text Bony 02 +518 101 some_text Bosmont-sur-Serre 02 +519 102 some_text Bouconville-Vauclair 02 +520 103 some_text Boué 02 +521 104 some_text Bouffignereux 02 +522 105 some_text Bouresches 02 +523 106 some_text Bourg-et-Comin 02 +524 107 some_text Bourguignon-sous-Coucy 02 +525 108 some_text Bourguignon-sous-Montbavin 02 +526 109 some_text Bouteille 02 +527 110 some_text Braine 02 +528 111 some_text Brancourt-en-Laonnois 02 +529 112 some_text Brancourt-le-Grand 02 +530 114 some_text Brasles 02 +531 115 some_text Braye-en-Laonnois 02 +532 116 some_text Braye-en-Thiérache 02 +533 117 some_text Bray-Saint-Christophe 02 +534 118 some_text Braye 02 +535 119 some_text Brécy 02 +536 120 some_text Brenelle 02 +537 121 some_text Breny 02 +538 122 some_text Brie 02 +539 123 some_text Brissay-Choigny 02 +540 124 some_text Brissy-Hamégicourt 02 +541 125 some_text Brumetz 02 +542 126 some_text Brunehamel 02 +543 127 some_text Bruyères-sur-Fère 02 +544 128 some_text Bruyères-et-Montbérault 02 +545 129 some_text Bruys 02 +546 130 some_text Bucilly 02 +547 131 some_text Bucy-le-Long 02 +548 132 some_text Bucy-lès-Cerny 02 +549 133 some_text Bucy-lès-Pierrepont 02 +550 134 some_text Buire 02 +551 135 some_text Buironfosse 02 +552 136 some_text Burelles 02 +553 137 some_text Bussiares 02 +554 138 some_text Buzancy 02 +555 139 some_text Caillouël-Crépigny 02 +556 140 some_text Camelin 02 +557 141 some_text Capelle 02 +558 142 some_text Castres 02 +559 143 some_text Catelet 02 +560 144 some_text Caulaincourt 02 +561 145 some_text Caumont 02 +562 146 some_text Celles-lès-Condé 02 +563 147 some_text Celle-sous-Montmirail 02 +564 148 some_text Celles-sur-Aisne 02 +565 149 some_text Cerizy 02 +566 150 some_text Cerny-en-Laonnois 02 +567 151 some_text Cerny-lès-Bucy 02 +568 152 some_text Cerseuil 02 +569 153 some_text Cessières 02 +570 154 some_text Chacrise 02 +571 155 some_text Chaillevois 02 +572 156 some_text Chalandry 02 +573 157 some_text Chambry 02 +574 158 some_text Chamouille 02 +575 159 some_text Champs 02 +576 160 some_text Chaourse 02 +577 161 some_text Chapelle-Monthodon 02 +578 162 some_text Chapelle-sur-Chézy 02 +579 163 some_text Charly 02 +580 164 some_text Charmel 02 +581 165 some_text Charmes 02 +582 166 some_text Chartèves 02 +583 167 some_text Chassemy 02 +584 168 some_text Château-Thierry 02 +585 169 some_text Châtillon-lès-Sons 02 +586 170 some_text Châtillon-sur-Oise 02 +587 171 some_text Chaudardes 02 +588 172 some_text Chaudun 02 +589 173 some_text Chauny 02 +590 174 some_text Chavignon 02 +591 175 some_text Chavigny 02 +592 176 some_text Chavonne 02 +593 177 some_text Chérêt 02 +594 178 some_text Chermizy-Ailles 02 +595 179 some_text Chéry-Chartreuve 02 +596 180 some_text Chéry-lès-Pouilly 02 +597 181 some_text Chéry-lès-Rozoy 02 +598 182 some_text Chevennes 02 +599 183 some_text Chevregny 02 +600 184 some_text Chevresis-Monceau 02 +601 185 some_text Chézy-en-Orxois 02 +602 186 some_text Chézy-sur-Marne 02 +603 187 some_text Chierry 02 +604 188 some_text Chigny 02 +605 189 some_text Chivres-en-Laonnois 02 +606 190 some_text Chivres-Val 02 +607 191 some_text Chivy-lès-Étouvelles 02 +608 192 some_text Chouy 02 +609 193 some_text Cierges 02 +610 194 some_text Cilly 02 +611 195 some_text Ciry-Salsogne 02 +612 196 some_text Clacy-et-Thierret 02 +613 197 some_text Clairfontaine 02 +614 198 some_text Clamecy 02 +615 199 some_text Clastres 02 +616 200 some_text Clermont-les-Fermes 02 +617 201 some_text Cœuvres-et-Valsery 02 +618 203 some_text Coincy 02 +619 204 some_text Coingt 02 +620 205 some_text Colligis-Crandelain 02 +621 206 some_text Colonfay 02 +622 207 some_text Commenchon 02 +623 208 some_text Concevreux 02 +624 209 some_text Condé-en-Brie 02 +625 210 some_text Condé-sur-Aisne 02 +626 211 some_text Condé-sur-Suippe 02 +627 212 some_text Condren 02 +628 213 some_text Connigis 02 +629 214 some_text Contescourt 02 +630 215 some_text Corbeny 02 +631 216 some_text Corcy 02 +632 217 some_text Coucy-le-Château-Auffrique 02 +633 218 some_text Coucy-lès-Eppes 02 +634 219 some_text Coucy-la-Ville 02 +635 220 some_text Coulonges-Cohan 02 +636 221 some_text Coupru 02 +637 222 some_text Courbes 02 +638 223 some_text Courboin 02 +639 224 some_text Courcelles-sur-Vesles 02 +640 225 some_text Courchamps 02 +641 226 some_text Courmelles 02 +642 227 some_text Courmont 02 +643 228 some_text Courtemont-Varennes 02 +644 229 some_text Courtrizy-et-Fussigny 02 +645 230 some_text Couvrelles 02 +646 231 some_text Couvron-et-Aumencourt 02 +647 232 some_text Coyolles 02 +648 233 some_text Cramaille 02 +649 234 some_text Craonne 02 +650 235 some_text Craonnelle 02 +651 236 some_text Crécy-au-Mont 02 +652 237 some_text Crécy-sur-Serre 02 +653 238 some_text Crépy 02 +654 239 some_text Crézancy 02 +655 240 some_text Croix-Fonsommes 02 +656 241 some_text Croix-sur-Ourcq 02 +657 242 some_text Crouttes-sur-Marne 02 +658 243 some_text Crouy 02 +659 244 some_text Crupilly 02 +660 245 some_text Cuffies 02 +661 246 some_text Cugny 02 +662 248 some_text Cuirieux 02 +663 249 some_text Cuiry-Housse 02 +664 250 some_text Cuiry-lès-Chaudardes 02 +665 251 some_text Cuiry-lès-Iviers 02 +666 252 some_text Cuissy-et-Geny 02 +667 253 some_text Cuisy-en-Almont 02 +668 254 some_text Cutry 02 +669 255 some_text Cys-la-Commune 02 +670 256 some_text Dagny-Lambercy 02 +671 257 some_text Dallon 02 +672 258 some_text Dammard 02 +673 259 some_text Dampleux 02 +674 260 some_text Danizy 02 +675 261 some_text Dercy 02 +676 262 some_text Deuillet 02 +677 263 some_text Dhuizel 02 +678 264 some_text Dizy-le-Gros 02 +679 265 some_text Dohis 02 +680 266 some_text Dolignon 02 +681 267 some_text Dommiers 02 +682 268 some_text Domptin 02 +683 269 some_text Dorengt 02 +684 270 some_text Douchy 02 +685 271 some_text Dravegny 02 +686 272 some_text Droizy 02 +687 273 some_text Dury 02 +688 274 some_text Ébouleau 02 +689 275 some_text Effry 02 +690 276 some_text Englancourt 02 +691 277 some_text Épagny 02 +692 278 some_text Éparcy 02 +693 279 some_text Épaux-Bézu 02 +694 280 some_text Épieds 02 +695 281 some_text Épine-aux-Bois 02 +696 282 some_text Eppes 02 +697 283 some_text Erlon 02 +698 284 some_text Erloy 02 +699 286 some_text Esquéhéries 02 +700 287 some_text Essigny-le-Grand 02 +701 288 some_text Essigny-le-Petit 02 +702 289 some_text Essises 02 +703 290 some_text Essômes-sur-Marne 02 +704 291 some_text Estrées 02 +705 292 some_text Étampes-sur-Marne 02 +706 293 some_text Étaves-et-Bocquiaux 02 +707 294 some_text Étouvelles 02 +708 295 some_text Étréaupont 02 +709 296 some_text Étreillers 02 +710 297 some_text Étrépilly 02 +711 298 some_text Étreux 02 +712 299 some_text Évergnicourt 02 +713 301 some_text Faucoucourt 02 +714 302 some_text Faverolles 02 +715 303 some_text Fayet 02 +716 304 some_text Fère 02 +717 305 some_text Fère-en-Tardenois 02 +718 306 some_text Ferté-Chevresis 02 +719 307 some_text Ferté-Milon 02 +720 308 some_text Fesmy-le-Sart 02 +721 309 some_text Festieux 02 +722 310 some_text Fieulaine 02 +723 311 some_text Filain 02 +724 312 some_text Flamengrie 02 +725 313 some_text Flavigny-le-Grand-et-Beaurain 02 +726 315 some_text Flavy-le-Martel 02 +727 316 some_text Fleury 02 +728 317 some_text Fluquières 02 +729 318 some_text Folembray 02 +730 319 some_text Fonsommes 02 +731 320 some_text Fontaine-lès-Clercs 02 +732 321 some_text Fontaine-lès-Vervins 02 +733 322 some_text Fontaine-Notre-Dame 02 +734 323 some_text Fontaine-Uterte 02 +735 324 some_text Fontenelle 02 +736 325 some_text Fontenelle-en-Brie 02 +737 326 some_text Fontenoy 02 +738 327 some_text Foreste 02 +739 328 some_text Fossoy 02 +740 329 some_text Fourdrain 02 +741 330 some_text Francilly-Selency 02 +742 331 some_text Franqueville 02 +743 332 some_text Fresnes-en-Tardenois 02 +744 333 some_text Fresnes 02 +745 334 some_text Fresnoy-le-Grand 02 +746 335 some_text Fressancourt 02 +747 336 some_text Frières-Faillouël 02 +748 337 some_text Froidestrées 02 +749 338 some_text Froidmont-Cohartille 02 +750 339 some_text Gandelu 02 +751 340 some_text Gauchy 02 +752 341 some_text Gercy 02 +753 342 some_text Gergny 02 +754 343 some_text Germaine 02 +755 344 some_text Gernicourt 02 +756 345 some_text Gibercourt 02 +757 346 some_text Gizy 02 +758 347 some_text Gland 02 +759 348 some_text Glennes 02 +760 349 some_text Goudelancourt-lès-Berrieux 02 +761 350 some_text Goudelancourt-lès-Pierrepont 02 +762 351 some_text Goussancourt 02 +763 352 some_text Gouy 02 +764 353 some_text Grandlup-et-Fay 02 +765 354 some_text Grandrieux 02 +766 355 some_text Gricourt 02 +767 356 some_text Grisolles 02 +768 357 some_text Gronard 02 +769 358 some_text Grougis 02 +770 359 some_text Grugies 02 +771 360 some_text Guignicourt 02 +772 361 some_text Guise 02 +773 362 some_text Guivry 02 +774 363 some_text Guny 02 +775 364 some_text Guyencourt 02 +776 366 some_text Hannapes 02 +777 367 some_text Happencourt 02 +778 368 some_text Haramont 02 +779 369 some_text Harcigny 02 +780 370 some_text Hargicourt 02 +781 371 some_text Harly 02 +782 372 some_text Hartennes-et-Taux 02 +783 373 some_text Hary 02 +784 374 some_text Lehaucourt 02 +785 375 some_text Hautevesnes 02 +786 376 some_text Hauteville 02 +787 377 some_text Haution 02 +788 378 some_text Hérie 02 +789 379 some_text Hérie-la-Viéville 02 +790 380 some_text Hinacourt 02 +791 381 some_text Hirson 02 +792 382 some_text Holnon 02 +793 383 some_text Homblières 02 +794 384 some_text Houry 02 +795 385 some_text Housset 02 +796 386 some_text Iron 02 +797 387 some_text Itancourt 02 +798 388 some_text Iviers 02 +799 389 some_text Jaulgonne 02 +800 390 some_text Jeancourt 02 +801 391 some_text Jeantes 02 +802 392 some_text Joncourt 02 +803 393 some_text Jouaignes 02 +804 395 some_text Jumencourt 02 +805 396 some_text Jumigny 02 +806 397 some_text Jussy 02 +807 398 some_text Juvigny 02 +808 399 some_text Juvincourt-et-Damary 02 +809 400 some_text Laffaux 02 +810 401 some_text Laigny 02 +811 402 some_text Lanchy 02 +812 403 some_text Landifay-et-Bertaignemont 02 +813 404 some_text Landouzy-la-Cour 02 +814 405 some_text Landouzy-la-Ville 02 +815 406 some_text Landricourt 02 +816 407 some_text Laniscourt 02 +817 408 some_text Laon 02 +818 409 some_text Lappion 02 +819 410 some_text Largny-sur-Automne 02 +820 411 some_text Latilly 02 +821 412 some_text Launoy 02 +822 413 some_text Laval-en-Laonnois 02 +823 414 some_text Lavaqueresse 02 +824 415 some_text Laversine 02 +825 416 some_text Lemé 02 +826 417 some_text Lempire 02 +827 418 some_text Lerzy 02 +828 419 some_text Leschelles 02 +829 420 some_text Lesdins 02 +830 421 some_text Lesges 02 +831 422 some_text Lesquielles-Saint-Germain 02 +832 423 some_text Leuilly-sous-Coucy 02 +833 424 some_text Leury 02 +834 425 some_text Leuze 02 +835 426 some_text Levergies 02 +836 427 some_text Lhuys 02 +837 428 some_text Licy-Clignon 02 +838 429 some_text Lierval 02 +839 430 some_text Liesse-Notre-Dame 02 +840 431 some_text Liez 02 +841 432 some_text Limé 02 +842 433 some_text Lislet 02 +843 434 some_text Lizy 02 +844 435 some_text Logny-lès-Aubenton 02 +845 438 some_text Longpont 02 +846 439 some_text Longueval-Barbonval 02 +847 440 some_text Lor 02 +848 441 some_text Louâtre 02 +849 442 some_text Loupeigne 02 +850 443 some_text Lucy-le-Bocage 02 +851 444 some_text Lugny 02 +852 445 some_text Luzoir 02 +853 446 some_text Ly-Fontaine 02 +854 447 some_text Maast-et-Violaine 02 +855 448 some_text Mâchecourt 02 +856 449 some_text Macogny 02 +857 450 some_text Macquigny 02 +858 451 some_text Magny-la-Fosse 02 +859 452 some_text Maissemy 02 +860 453 some_text Maizy 02 +861 454 some_text Malmaison 02 +862 455 some_text Malzy 02 +863 456 some_text Manicamp 02 +864 457 some_text Marchais 02 +865 458 some_text Marchais-en-Brie 02 +866 459 some_text Marcy 02 +867 460 some_text Marcy-sous-Marle 02 +868 461 some_text Marest-Dampcourt 02 +869 462 some_text Mareuil-en-Dôle 02 +870 463 some_text Marfontaine 02 +871 464 some_text Margival 02 +872 465 some_text Marigny-en-Orxois 02 +873 466 some_text Marizy-Sainte-Geneviève 02 +874 467 some_text Marizy-Saint-Mard 02 +875 468 some_text Marle 02 +876 469 some_text Marly-Gomont 02 +877 470 some_text Martigny 02 +878 471 some_text Martigny-Courpierre 02 +879 472 some_text Mauregny-en-Haye 02 +880 473 some_text Mayot 02 +881 474 some_text Mennessis 02 +882 475 some_text Menneville 02 +883 476 some_text Mennevret 02 +884 477 some_text Mercin-et-Vaux 02 +885 478 some_text Merlieux-et-Fouquerolles 02 +886 479 some_text Merval 02 +887 480 some_text Mesbrecourt-Richecourt 02 +888 481 some_text Mesnil-Saint-Laurent 02 +889 482 some_text Meurival 02 +890 483 some_text Mézières-sur-Oise 02 +891 484 some_text Mézy-Moulins 02 +892 485 some_text Missy-aux-Bois 02 +893 486 some_text Missy-lès-Pierrepont 02 +894 487 some_text Missy-sur-Aisne 02 +895 488 some_text Molain 02 +896 489 some_text Molinchart 02 +897 490 some_text Monampteuil 02 +898 491 some_text Monceau-le-Neuf-et-Faucouzy 02 +899 492 some_text Monceau-lès-Leups 02 +900 493 some_text Monceau-le-Waast 02 +901 494 some_text Monceau-sur-Oise 02 +902 495 some_text Mondrepuis 02 +903 496 some_text Monnes 02 +904 497 some_text Mons-en-Laonnois 02 +905 498 some_text Montaigu 02 +906 499 some_text Montbavin 02 +907 500 some_text Montbrehain 02 +908 501 some_text Montchâlons 02 +909 502 some_text Montcornet 02 +910 503 some_text Mont-d'Origny 02 +911 504 some_text Montescourt-Lizerolles 02 +912 505 some_text Montfaucon 02 +913 506 some_text Montgobert 02 +914 507 some_text Montgru-Saint-Hilaire 02 +915 508 some_text Monthenault 02 +916 509 some_text Monthiers 02 +917 510 some_text Monthurel 02 +918 511 some_text Montigny-en-Arrouaise 02 +919 512 some_text Montigny-l'Allier 02 +920 513 some_text Montigny-le-Franc 02 +921 514 some_text Montigny-Lengrain 02 +922 515 some_text Montigny-lès-Condé 02 +923 516 some_text Montigny-sous-Marle 02 +924 517 some_text Montigny-sur-Crécy 02 +925 518 some_text Montlevon 02 +926 519 some_text Montloué 02 +927 520 some_text Mont-Notre-Dame 02 +928 521 some_text Montreuil-aux-Lions 02 +929 522 some_text Mont-Saint-Jean 02 +930 523 some_text Mont-Saint-Martin 02 +931 524 some_text Mont-Saint-Père 02 +932 525 some_text Morcourt 02 +933 526 some_text Morgny-en-Thiérache 02 +934 527 some_text Morsain 02 +935 528 some_text Mortefontaine 02 +936 529 some_text Mortiers 02 +937 530 some_text Moulins 02 +938 531 some_text Moussy-Verneuil 02 +939 532 some_text Moÿ-de-l'Aisne 02 +940 533 some_text Muret-et-Crouttes 02 +941 534 some_text Muscourt 02 +942 535 some_text Nampcelles-la-Cour 02 +943 536 some_text Nampteuil-sous-Muret 02 +944 537 some_text Nanteuil-la-Fosse 02 +945 538 some_text Nanteuil-Notre-Dame 02 +946 539 some_text Nauroy 02 +947 540 some_text Nesles-la-Montagne 02 +948 541 some_text Neufchâtel-sur-Aisne 02 +949 542 some_text Neuflieux 02 +950 543 some_text Neuilly-Saint-Front 02 +951 544 some_text Neuve-Maison 02 +952 545 some_text Neuville-Bosmont 02 +953 546 some_text Neuville-en-Beine 02 +954 547 some_text Neuville-Housset 02 +955 548 some_text Neuville-lès-Dorengt 02 +956 549 some_text Neuville-Saint-Amand 02 +957 550 some_text Neuville-sur-Ailette 02 +958 551 some_text Neuville-sur-Margival 02 +959 552 some_text Neuvillette 02 +960 553 some_text Nizy-le-Comte 02 +961 554 some_text Nogentel 02 +962 555 some_text Nogent-l'Artaud 02 +963 556 some_text Noircourt 02 +964 557 some_text Noroy-sur-Ourcq 02 +965 558 some_text Nouvion-en-Thiérache 02 +966 559 some_text Nouvion-et-Catillon 02 +967 560 some_text Nouvion-le-Comte 02 +968 561 some_text Nouvion-le-Vineux 02 +969 562 some_text Nouvron-Vingré 02 +970 563 some_text Noyales 02 +971 564 some_text Noyant-et-Aconin 02 +972 565 some_text Œuilly 02 +973 566 some_text Ognes 02 +974 567 some_text Ohis 02 +975 568 some_text Oigny-en-Valois 02 +976 569 some_text Oisy 02 +977 570 some_text Ollezy 02 +978 571 some_text Omissy 02 +979 572 some_text Orainville 02 +980 573 some_text Orgeval 02 +981 574 some_text Origny-en-Thiérache 02 +982 575 some_text Origny-Sainte-Benoite 02 +983 576 some_text Osly-Courtil 02 +984 577 some_text Ostel 02 +985 578 some_text Oulches-la-Vallée-Foulon 02 +986 579 some_text Oulchy-la-Ville 02 +987 580 some_text Oulchy-le-Château 02 +988 581 some_text Paars 02 +989 582 some_text Paissy 02 +990 583 some_text Pancy-Courtecon 02 +991 584 some_text Papleux 02 +992 585 some_text Parcy-et-Tigny 02 +993 586 some_text Parfondeval 02 +994 587 some_text Parfondru 02 +995 588 some_text Pargnan 02 +996 589 some_text Pargny-Filain 02 +997 590 some_text Pargny-la-Dhuys 02 +998 591 some_text Pargny-les-Bois 02 +999 592 some_text Parpeville 02 +1000 593 some_text Pasly 02 +1001 594 some_text Passy-en-Valois 02 +1002 595 some_text Passy-sur-Marne 02 +1003 596 some_text Pavant 02 +1004 597 some_text Perles 02 +1005 598 some_text Pernant 02 +1006 599 some_text Pierremande 02 +1007 600 some_text Pierrepont 02 +1008 601 some_text Pignicourt 02 +1009 602 some_text Pinon 02 +1010 604 some_text Pithon 02 +1011 605 some_text Pleine-Selve 02 +1012 606 some_text Plessier-Huleu 02 +1013 607 some_text Ploisy 02 +1014 608 some_text Plomion 02 +1015 609 some_text Ployart-et-Vaurseine 02 +1016 610 some_text Pommiers 02 +1017 612 some_text Pont-Arcy 02 +1018 613 some_text Pontavert 02 +1019 614 some_text Pontru 02 +1020 615 some_text Pontruet 02 +1021 616 some_text Pont-Saint-Mard 02 +1022 617 some_text Pouilly-sur-Serre 02 +1023 618 some_text Prémont 02 +1024 619 some_text Prémontré 02 +1025 620 some_text Presles-et-Boves 02 +1026 621 some_text Presles-et-Thierny 02 +1027 622 some_text Priez 02 +1028 623 some_text Prisces 02 +1029 624 some_text Proisy 02 +1030 625 some_text Proix 02 +1031 626 some_text Prouvais 02 +1032 627 some_text Proviseux-et-Plesnoy 02 +1033 628 some_text Puiseux-en-Retz 02 +1034 629 some_text Puisieux-et-Clanlieu 02 +1035 631 some_text Quierzy 02 +1036 632 some_text Quincy-Basse 02 +1037 633 some_text Quincy-sous-le-Mont 02 +1038 634 some_text Raillimont 02 +1039 635 some_text Ramicourt 02 +1040 636 some_text Regny 02 +1041 637 some_text Remaucourt 02 +1042 638 some_text Remies 02 +1043 639 some_text Remigny 02 +1044 640 some_text Renansart 02 +1045 641 some_text Renneval 02 +1046 642 some_text Résigny 02 +1047 643 some_text Ressons-le-Long 02 +1048 644 some_text Retheuil 02 +1049 645 some_text Reuilly-Sauvigny 02 +1050 646 some_text Révillon 02 +1051 647 some_text Ribeauville 02 +1052 648 some_text Ribemont 02 +1053 649 some_text Rocourt-Saint-Martin 02 +1054 650 some_text Rocquigny 02 +1055 651 some_text Rogécourt 02 +1056 652 some_text Rogny 02 +1057 653 some_text Romeny-sur-Marne 02 +1058 654 some_text Romery 02 +1059 655 some_text Ronchères 02 +1060 656 some_text Roucy 02 +1061 657 some_text Rougeries 02 +1062 658 some_text Roupy 02 +1063 659 some_text Rouvroy 02 +1064 660 some_text Rouvroy-sur-Serre 02 +1065 661 some_text Royaucourt-et-Chailvet 02 +1066 662 some_text Rozet-Saint-Albin 02 +1067 663 some_text Rozières-sur-Crise 02 +1068 664 some_text Rozoy-Bellevalle 02 +1069 665 some_text Grand-Rozoy 02 +1070 666 some_text Rozoy-sur-Serre 02 +1071 667 some_text Saconin-et-Breuil 02 +1072 668 some_text Sains-Richaumont 02 +1073 669 some_text Saint-Agnan 02 +1074 670 some_text Saint-Algis 02 +1075 671 some_text Saint-Aubin 02 +1076 672 some_text Saint-Bandry 02 +1077 673 some_text Saint-Christophe-à-Berry 02 +1078 674 some_text Saint-Clément 02 +1079 675 some_text Sainte-Croix 02 +1080 676 some_text Saint-Erme-Outre-et-Ramecourt 02 +1081 677 some_text Saint-Eugène 02 +1082 678 some_text Sainte-Geneviève 02 +1083 679 some_text Saint-Gengoulph 02 +1084 680 some_text Saint-Gobain 02 +1085 681 some_text Saint-Gobert 02 +1086 682 some_text Saint-Mard 02 +1087 683 some_text Saint-Martin-Rivière 02 +1088 684 some_text Saint-Michel 02 +1089 685 some_text Saint-Nicolas-aux-Bois 02 +1090 686 some_text Saint-Paul-aux-Bois 02 +1091 687 some_text Saint-Pierre-Aigle 02 +1092 688 some_text Saint-Pierre-lès-Franqueville 02 +1093 689 some_text Saint-Pierremont 02 +1094 690 some_text Sainte-Preuve 02 +1095 691 some_text Saint-Quentin 02 +1096 693 some_text Saint-Rémy-Blanzy 02 +1097 694 some_text Saint-Simon 02 +1098 695 some_text Saint-Thibaut 02 +1099 696 some_text Saint-Thomas 02 +1100 697 some_text Samoussy 02 +1101 698 some_text Sancy-les-Cheminots 02 +1102 699 some_text Saponay 02 +1103 701 some_text Saulchery 02 +1104 702 some_text Savy 02 +1105 703 some_text Seboncourt 02 +1106 704 some_text Selens 02 +1107 705 some_text Selve 02 +1108 706 some_text Septmonts 02 +1109 707 some_text Septvaux 02 +1110 708 some_text Sequehart 02 +1111 709 some_text Serain 02 +1112 710 some_text Seraucourt-le-Grand 02 +1113 711 some_text Serches 02 +1114 712 some_text Sergy 02 +1115 713 some_text Seringes-et-Nesles 02 +1116 714 some_text Sermoise 02 +1117 715 some_text Serval 02 +1118 716 some_text Servais 02 +1119 717 some_text Séry-lès-Mézières 02 +1120 718 some_text Silly-la-Poterie 02 +1121 719 some_text Sinceny 02 +1122 720 some_text Sissonne 02 +1123 721 some_text Sissy 02 +1124 722 some_text Soissons 02 +1125 723 some_text Soize 02 +1126 724 some_text Sommelans 02 +1127 725 some_text Sommeron 02 +1128 726 some_text Sommette-Eaucourt 02 +1129 727 some_text Sons-et-Ronchères 02 +1130 728 some_text Sorbais 02 +1131 729 some_text Soucy 02 +1132 730 some_text Soupir 02 +1133 731 some_text Sourd 02 +1134 732 some_text Surfontaine 02 +1135 733 some_text Suzy 02 +1136 734 some_text Taillefontaine 02 +1137 735 some_text Tannières 02 +1138 736 some_text Tartiers 02 +1139 737 some_text Tavaux-et-Pontséricourt 02 +1140 738 some_text Tergnier 02 +1141 739 some_text Terny-Sorny 02 +1142 740 some_text Thenailles 02 +1143 741 some_text Thenelles 02 +1144 742 some_text Thiernu 02 +1145 743 some_text Thuel 02 +1146 744 some_text Torcy-en-Valois 02 +1147 745 some_text Toulis-et-Attencourt 02 +1148 746 some_text Travecy 02 +1149 747 some_text Trefcon 02 +1150 748 some_text Trélou-sur-Marne 02 +1151 749 some_text Troësnes 02 +1152 750 some_text Trosly-Loire 02 +1153 751 some_text Trucy 02 +1154 752 some_text Tugny-et-Pont 02 +1155 753 some_text Tupigny 02 +1156 754 some_text Ugny-le-Gay 02 +1157 755 some_text Urcel 02 +1158 756 some_text Urvillers 02 +1159 757 some_text Vadencourt 02 +1160 758 some_text Vailly-sur-Aisne 02 +1161 759 some_text Vallée-au-Blé 02 +1162 760 some_text Vallée-Mulâtre 02 +1163 761 some_text Variscourt 02 +1164 762 some_text Vassens 02 +1165 763 some_text Vasseny 02 +1166 764 some_text Vassogne 02 +1167 765 some_text Vaucelles-et-Beffecourt 02 +1168 766 some_text Vaudesson 02 +1169 767 some_text Vauxrezis 02 +1170 768 some_text Vauxaillon 02 +1171 769 some_text Vaux-Andigny 02 +1172 770 some_text Vauxbuin 02 +1173 771 some_text Vauxcéré 02 +1174 772 some_text Vaux-en-Vermandois 02 +1175 773 some_text Vauxtin 02 +1176 774 some_text Vendelles 02 +1177 775 some_text Vendeuil 02 +1178 776 some_text Vendhuile 02 +1179 777 some_text Vendières 02 +1180 778 some_text Vendresse-Beaulne 02 +1181 779 some_text Vénérolles 02 +1182 780 some_text Venizel 02 +1183 781 some_text Verdilly 02 +1184 782 some_text Verguier 02 +1185 783 some_text Grand-Verly 02 +1186 784 some_text Petit-Verly 02 +1187 785 some_text Vermand 02 +1188 786 some_text Verneuil-sous-Coucy 02 +1189 787 some_text Verneuil-sur-Serre 02 +1190 788 some_text Versigny 02 +1191 789 some_text Vervins 02 +1192 790 some_text Vesles-et-Caumont 02 +1193 791 some_text Veslud 02 +1194 792 some_text Veuilly-la-Poterie 02 +1195 793 some_text Vézaponin 02 +1196 794 some_text Vézilly 02 +1197 795 some_text Vic-sur-Aisne 02 +1198 796 some_text Vichel-Nanteuil 02 +1199 797 some_text Viel-Arcy 02 +1200 798 some_text Viels-Maisons 02 +1201 799 some_text Vierzy 02 +1202 800 some_text Viffort 02 +1203 801 some_text Vigneux-Hocquet 02 +1204 802 some_text Ville-aux-Bois-lès-Dizy 02 +1205 803 some_text Ville-aux-Bois-lès-Pontavert 02 +1206 804 some_text Villemontoire 02 +1207 805 some_text Villeneuve-Saint-Germain 02 +1208 806 some_text Villeneuve-sur-Fère 02 +1209 807 some_text Villequier-Aumont 02 +1210 808 some_text Villeret 02 +1211 809 some_text Villers-Agron-Aiguizy 02 +1212 810 some_text Villers-Cotterêts 02 +1213 811 some_text Villers-en-Prayères 02 +1214 812 some_text Villers-Hélon 02 +1215 813 some_text Villers-le-Sec 02 +1216 814 some_text Villers-lès-Guise 02 +1217 815 some_text Villers-Saint-Christophe 02 +1218 816 some_text Villers-sur-Fère 02 +1219 817 some_text Ville-Savoye 02 +1220 818 some_text Villiers-Saint-Denis 02 +1221 819 some_text Vincy-Reuil-et-Magny 02 +1222 820 some_text Viry-Noureuil 02 +1223 821 some_text Vivaise 02 +1224 822 some_text Vivières 02 +1225 823 some_text Voharies 02 +1226 824 some_text Vorges 02 +1227 826 some_text Voulpaix 02 +1228 827 some_text Voyenne 02 +1229 828 some_text Vregny 02 +1230 829 some_text Vuillery 02 +1231 830 some_text Wassigny 02 +1232 831 some_text Watigny 02 +1233 832 some_text Wiège-Faty 02 +1234 833 some_text Wimy 02 +1235 834 some_text Wissignicourt 02 +1236 001 some_text Abrest 03 +1237 002 some_text Agonges 03 +1238 003 some_text Ainay-le-Château 03 +1239 004 some_text Andelaroche 03 +1240 005 some_text Archignat 03 +1241 006 some_text Arfeuilles 03 +1242 007 some_text Arpheuilles-Saint-Priest 03 +1243 008 some_text Arronnes 03 +1244 009 some_text Aubigny 03 +1245 010 some_text Audes 03 +1246 011 some_text Aurouër 03 +1247 012 some_text Autry-Issards 03 +1248 013 some_text Avermes 03 +1249 014 some_text Avrilly 03 +1250 015 some_text Bagneux 03 +1251 016 some_text Barberier 03 +1252 017 some_text Barrais-Bussolles 03 +1253 018 some_text Bayet 03 +1254 019 some_text Beaulon 03 +1255 020 some_text Beaune-d'Allier 03 +1256 021 some_text Bègues 03 +1257 022 some_text Bellenaves 03 +1258 023 some_text Bellerive-sur-Allier 03 +1259 024 some_text Bert 03 +1260 025 some_text Bessay-sur-Allier 03 +1261 026 some_text Besson 03 +1262 027 some_text Bézenet 03 +1263 028 some_text Billezois 03 +1264 029 some_text Billy 03 +1265 030 some_text Biozat 03 +1266 031 some_text Bizeneuille 03 +1267 032 some_text Blomard 03 +1268 033 some_text Bost 03 +1269 034 some_text Boucé 03 +1270 035 some_text Bouchaud 03 +1271 036 some_text Bourbon-l'Archambault 03 +1272 037 some_text Braize 03 +1273 038 some_text Bransat 03 +1274 039 some_text Bresnay 03 +1275 040 some_text Bressolles 03 +1276 041 some_text Brethon 03 +1277 042 some_text Breuil 03 +1278 043 some_text Broût-Vernet 03 +1279 044 some_text Brugheas 03 +1280 045 some_text Busset 03 +1281 046 some_text Buxières-les-Mines 03 +1282 047 some_text Celle 03 +1283 048 some_text Cérilly 03 +1284 049 some_text Cesset 03 +1285 050 some_text Chabanne 03 +1286 051 some_text Chambérat 03 +1287 052 some_text Chamblet 03 +1288 053 some_text Chantelle 03 +1289 054 some_text Chapeau 03 +1290 055 some_text Chapelaude 03 +1291 056 some_text Chapelle 03 +1292 057 some_text Chapelle-aux-Chasses 03 +1293 058 some_text Chappes 03 +1294 059 some_text Chareil-Cintrat 03 +1295 060 some_text Charmeil 03 +1296 061 some_text Charmes 03 +1297 062 some_text Charroux 03 +1298 063 some_text Chassenard 03 +1299 064 some_text Château-sur-Allier 03 +1300 065 some_text Châtel-de-Neuvre 03 +1301 066 some_text Châtel-Montagne 03 +1302 067 some_text Châtelperron 03 +1303 068 some_text Châtelus 03 +1304 069 some_text Châtillon 03 +1305 070 some_text Chavenon 03 +1306 071 some_text Chavroches 03 +1307 072 some_text Chazemais 03 +1308 073 some_text Chemilly 03 +1309 074 some_text Chevagnes 03 +1310 075 some_text Chezelle 03 +1311 076 some_text Chézy 03 +1312 077 some_text Chirat-l'Église 03 +1313 078 some_text Chouvigny 03 +\. + +SELECT count(*) FROM towns; +SELECT * FROM towns where id in (13, 666); +-- ON REPLICA +-- +-- select count(*) from towns; +-- count +-- ------- +-- 1313 +-- (1 row) +-- +-- select * from towns where id in (13, 666); +-- id | code | article | name | department +-- -----+------+-----------+----------------+------------ +-- 13 | 014 | some_text | Arbent | 01 +-- 666 | 252 | some_text | Cuissy-et-Geny | 02 +-- (2 rows) +-- + +DROP TABLE towns; +DROP EXTENSION pg_tde; diff --git a/sql/multi_insert.sql b/sql/multi_insert.sql index 2fc19590..51ca82ad 100644 --- a/sql/multi_insert.sql +++ b/sql/multi_insert.sql @@ -1,1396 +1,2 @@ --- trigger multi_insert path --- -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 albums ( - album_id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, - artist_id INTEGER, - title TEXT NOT NULL, - released DATE NOT NULL -) USING tde_heap_basic; - -COPY albums FROM stdin CSV HEADER; -album_id,artist_id,title,released -1,1,"Mirror",2009-06-24 -2,2,"Pretzel Logic",1974-02-20 -3,3,"Under Construction",2002-11-12 -4,4,"Return to Wherever",2019-07-11 -5,5,"The Nightfly",1982-10-01 -6,6,"It's Alive",2013-10-15 -7,7,"Pure Ella",1994-02-15 -\. - -SELECT * FROM albums; -SELECT * FROM albums where album_id > 5; --- On replica: --- SELECT * FROM albums; --- album_id | artist_id | title | released --- ----------+-----------+--------------------+------------ --- 1 | 1 | Mirror | 2009-06-24 --- 2 | 2 | Pretzel Logic | 1974-02-20 --- 3 | 3 | Under Construction | 2002-11-12 --- 4 | 4 | Return to Wherever | 2019-07-11 --- 5 | 5 | The Nightfly | 1982-10-01 --- 6 | 6 | It's Alive | 2013-10-15 --- 7 | 7 | Pure Ella | 1994-02-15 --- (7 rows) --- --- SELECT * FROM albums where album_id > 5; --- album_id | artist_id | title | released --- ----------+-----------+------------+------------ --- 6 | 6 | It's Alive | 2013-10-15 --- 7 | 7 | Pure Ella | 1994-02-15 --- (2 rows) --- -DROP TABLE albums; - --- multi_insert2 --- more data to take multiple pages -CREATE TABLE Towns ( - id SERIAL UNIQUE NOT NULL, - code VARCHAR(10) NOT NULL, - article TEXT, - name TEXT NOT NULL, - department VARCHAR(4) NOT NULL, - UNIQUE (code, department) -) USING tde_heap_basic; - -COPY towns (id, code, article, name, department) FROM stdin; -1 001 some_text Abergement-Clémenciat 01 -2 002 some_text Abergement-de-Varey 01 -3 004 some_text Ambérieu-en-Bugey 01 -4 005 some_text Ambérieux-en-Dombes 01 -5 006 some_text Ambléon 01 -6 007 some_text Ambronay 01 -7 008 some_text Ambutrix 01 -8 009 some_text Andert-et-Condon 01 -9 010 some_text Anglefort 01 -10 011 some_text Apremont 01 -11 012 some_text Aranc 01 -12 013 some_text Arandas 01 -13 014 some_text Arbent 01 -14 015 some_text Arbignieu 01 -15 016 some_text Arbigny 01 -16 017 some_text Argis 01 -17 019 some_text Armix 01 -18 021 some_text Ars-sur-Formans 01 -19 022 some_text Artemare 01 -20 023 some_text Asnières-sur-Saône 01 -21 024 some_text Attignat 01 -22 025 some_text Bâgé-la-Ville 01 -23 026 some_text Bâgé-le-Châtel 01 -24 027 some_text Balan 01 -25 028 some_text Baneins 01 -26 029 some_text Beaupont 01 -27 030 some_text Beauregard 01 -28 031 some_text Bellignat 01 -29 032 some_text Béligneux 01 -30 033 some_text Bellegarde-sur-Valserine 01 -31 034 some_text Belley 01 -32 035 some_text Belleydoux 01 -33 036 some_text Belmont-Luthézieu 01 -34 037 some_text Bénonces 01 -35 038 some_text Bény 01 -36 039 some_text Béon 01 -37 040 some_text Béréziat 01 -38 041 some_text Bettant 01 -39 042 some_text Bey 01 -40 043 some_text Beynost 01 -41 044 some_text Billiat 01 -42 045 some_text Birieux 01 -43 046 some_text Biziat 01 -44 047 some_text Blyes 01 -45 049 some_text Boisse 01 -46 050 some_text Boissey 01 -47 051 some_text Bolozon 01 -48 052 some_text Bouligneux 01 -49 053 some_text Bourg-en-Bresse 01 -50 054 some_text Bourg-Saint-Christophe 01 -51 056 some_text Boyeux-Saint-Jérôme 01 -52 057 some_text Boz 01 -53 058 some_text Brégnier-Cordon 01 -54 059 some_text Brénaz 01 -55 060 some_text Brénod 01 -56 061 some_text Brens 01 -57 062 some_text Bressolles 01 -58 063 some_text Brion 01 -59 064 some_text Briord 01 -60 065 some_text Buellas 01 -61 066 some_text Burbanche 01 -62 067 some_text Ceignes 01 -63 068 some_text Cerdon 01 -64 069 some_text Certines 01 -65 071 some_text Cessy 01 -66 072 some_text Ceyzériat 01 -67 073 some_text Ceyzérieu 01 -68 074 some_text Chalamont 01 -69 075 some_text Chaleins 01 -70 076 some_text Chaley 01 -71 077 some_text Challes 01 -72 078 some_text Challex 01 -73 079 some_text Champagne-en-Valromey 01 -74 080 some_text Champdor 01 -75 081 some_text Champfromier 01 -76 082 some_text Chanay 01 -77 083 some_text Chaneins 01 -78 084 some_text Chanoz-Châtenay 01 -79 085 some_text Chapelle-du-Châtelard 01 -80 087 some_text Charix 01 -81 088 some_text Charnoz-sur-Ain 01 -82 089 some_text Château-Gaillard 01 -83 090 some_text Châtenay 01 -84 091 some_text Châtillon-en-Michaille 01 -85 092 some_text Châtillon-la-Palud 01 -86 093 some_text Châtillon-sur-Chalaronne 01 -87 094 some_text Chavannes-sur-Reyssouze 01 -88 095 some_text Chavannes-sur-Suran 01 -89 096 some_text Chaveyriat 01 -90 097 some_text Chavornay 01 -91 098 some_text Chazey-Bons 01 -92 099 some_text Chazey-sur-Ain 01 -93 100 some_text Cheignieu-la-Balme 01 -94 101 some_text Chevillard 01 -95 102 some_text Chevroux 01 -96 103 some_text Chevry 01 -97 104 some_text Chézery-Forens 01 -98 105 some_text Civrieux 01 -99 106 some_text Cize 01 -100 107 some_text Cleyzieu 01 -101 108 some_text Coligny 01 -102 109 some_text Collonges 01 -103 110 some_text Colomieu 01 -104 111 some_text Conand 01 -105 112 some_text Condamine 01 -106 113 some_text Condeissiat 01 -107 114 some_text Confort 01 -108 115 some_text Confrançon 01 -109 116 some_text Contrevoz 01 -110 117 some_text Conzieu 01 -111 118 some_text Corbonod 01 -112 119 some_text Corcelles 01 -113 121 some_text Corlier 01 -114 122 some_text Cormaranche-en-Bugey 01 -115 123 some_text Cormoranche-sur-Saône 01 -116 124 some_text Cormoz 01 -117 125 some_text Corveissiat 01 -118 127 some_text Courmangoux 01 -119 128 some_text Courtes 01 -120 129 some_text Crans 01 -121 130 some_text Cras-sur-Reyssouze 01 -122 133 some_text Cressin-Rochefort 01 -123 134 some_text Crottet 01 -124 135 some_text Crozet 01 -125 136 some_text Cruzilles-lès-Mépillat 01 -126 138 some_text Culoz 01 -127 139 some_text Curciat-Dongalon 01 -128 140 some_text Curtafond 01 -129 141 some_text Cuzieu 01 -130 142 some_text Dagneux 01 -131 143 some_text Divonne-les-Bains 01 -132 144 some_text Dommartin 01 -133 145 some_text Dompierre-sur-Veyle 01 -134 146 some_text Dompierre-sur-Chalaronne 01 -135 147 some_text Domsure 01 -136 148 some_text Dortan 01 -137 149 some_text Douvres 01 -138 150 some_text Drom 01 -139 151 some_text Druillat 01 -140 152 some_text Échallon 01 -141 153 some_text Échenevex 01 -142 154 some_text Étrez 01 -143 155 some_text Évosges 01 -144 156 some_text Faramans 01 -145 157 some_text Fareins 01 -146 158 some_text Farges 01 -147 159 some_text Feillens 01 -148 160 some_text Ferney-Voltaire 01 -149 162 some_text Flaxieu 01 -150 163 some_text Foissiat 01 -151 165 some_text Francheleins 01 -152 166 some_text Frans 01 -153 167 some_text Garnerans 01 -154 169 some_text Genouilleux 01 -155 170 some_text Géovreissiat 01 -156 171 some_text Géovreisset 01 -157 172 some_text Germagnat 01 -158 173 some_text Gex 01 -159 174 some_text Giron 01 -160 175 some_text Gorrevod 01 -161 176 some_text Grand-Abergement 01 -162 177 some_text Grand-Corent 01 -163 179 some_text Grièges 01 -164 180 some_text Grilly 01 -165 181 some_text Groissiat 01 -166 182 some_text Groslée 01 -167 183 some_text Guéreins 01 -168 184 some_text Hautecourt-Romanèche 01 -169 185 some_text Hauteville-Lompnes 01 -170 186 some_text Hostias 01 -171 187 some_text Hotonnes 01 -172 188 some_text Illiat 01 -173 189 some_text Injoux-Génissiat 01 -174 190 some_text Innimond 01 -175 191 some_text Izenave 01 -176 192 some_text Izernore 01 -177 193 some_text Izieu 01 -178 194 some_text Jassans-Riottier 01 -179 195 some_text Jasseron 01 -180 196 some_text Jayat 01 -181 197 some_text Journans 01 -182 198 some_text Joyeux 01 -183 199 some_text Jujurieux 01 -184 200 some_text Labalme 01 -185 202 some_text Lagnieu 01 -186 203 some_text Laiz 01 -187 204 some_text Lalleyriat 01 -188 205 some_text Lancrans 01 -189 206 some_text Lantenay 01 -190 207 some_text Lapeyrouse 01 -191 208 some_text Lavours 01 -192 209 some_text Léaz 01 -193 210 some_text Lélex 01 -194 211 some_text Lent 01 -195 212 some_text Lescheroux 01 -196 213 some_text Leyment 01 -197 214 some_text Leyssard 01 -198 215 some_text Lhôpital 01 -199 216 some_text Lhuis 01 -200 218 some_text Lochieu 01 -201 219 some_text Lompnas 01 -202 221 some_text Lompnieu 01 -203 224 some_text Loyettes 01 -204 225 some_text Lurcy 01 -205 227 some_text Magnieu 01 -206 228 some_text Maillat 01 -207 229 some_text Malafretaz 01 -208 230 some_text Mantenay-Montlin 01 -209 231 some_text Manziat 01 -210 232 some_text Marboz 01 -211 233 some_text Marchamp 01 -212 234 some_text Marignieu 01 -213 235 some_text Marlieux 01 -214 236 some_text Marsonnas 01 -215 237 some_text Martignat 01 -216 238 some_text Massieux 01 -217 239 some_text Massignieu-de-Rives 01 -218 240 some_text Matafelon-Granges 01 -219 241 some_text Meillonnas 01 -220 242 some_text Mérignat 01 -221 243 some_text Messimy-sur-Saône 01 -222 244 some_text Meximieux 01 -223 245 some_text Bohas-Meyriat-Rignat 01 -224 246 some_text Mézériat 01 -225 247 some_text Mijoux 01 -226 248 some_text Mionnay 01 -227 249 some_text Miribel 01 -228 250 some_text Misérieux 01 -229 252 some_text Mogneneins 01 -230 254 some_text Montagnat 01 -231 255 some_text Montagnieu 01 -232 257 some_text Montanges 01 -233 258 some_text Montceaux 01 -234 259 some_text Montcet 01 -235 260 some_text Montellier 01 -236 261 some_text Monthieux 01 -237 262 some_text Montluel 01 -238 263 some_text Montmerle-sur-Saône 01 -239 264 some_text Montracol 01 -240 265 some_text Montréal-la-Cluse 01 -241 266 some_text Montrevel-en-Bresse 01 -242 267 some_text Nurieux-Volognat 01 -243 268 some_text Murs-et-Gélignieux 01 -244 269 some_text Nantua 01 -245 271 some_text Nattages 01 -246 272 some_text Neuville-les-Dames 01 -247 273 some_text Neuville-sur-Ain 01 -248 274 some_text Neyrolles 01 -249 275 some_text Neyron 01 -250 276 some_text Niévroz 01 -251 277 some_text Nivollet-Montgriffon 01 -252 279 some_text Oncieu 01 -253 280 some_text Ordonnaz 01 -254 281 some_text Ornex 01 -255 282 some_text Outriaz 01 -256 283 some_text Oyonnax 01 -257 284 some_text Ozan 01 -258 285 some_text Parcieux 01 -259 286 some_text Parves 01 -260 288 some_text Péron 01 -261 289 some_text Péronnas 01 -262 290 some_text Pérouges 01 -263 291 some_text Perrex 01 -264 292 some_text Petit-Abergement 01 -265 293 some_text Peyriat 01 -266 294 some_text Peyrieu 01 -267 295 some_text Peyzieux-sur-Saône 01 -268 296 some_text Pirajoux 01 -269 297 some_text Pizay 01 -270 298 some_text Plagne 01 -271 299 some_text Plantay 01 -272 300 some_text Poizat 01 -273 301 some_text Polliat 01 -274 302 some_text Pollieu 01 -275 303 some_text Poncin 01 -276 304 some_text Pont-d'Ain 01 -277 305 some_text Pont-de-Vaux 01 -278 306 some_text Pont-de-Veyle 01 -279 307 some_text Port 01 -280 308 some_text Pougny 01 -281 309 some_text Pouillat 01 -282 310 some_text Prémeyzel 01 -283 311 some_text Prémillieu 01 -284 312 some_text Pressiat 01 -285 313 some_text Prévessin-Moëns 01 -286 314 some_text Priay 01 -287 316 some_text Pugieu 01 -288 317 some_text Ramasse 01 -289 318 some_text Rancé 01 -290 319 some_text Relevant 01 -291 320 some_text Replonges 01 -292 321 some_text Revonnas 01 -293 322 some_text Reyrieux 01 -294 323 some_text Reyssouze 01 -295 325 some_text Rignieux-le-Franc 01 -296 328 some_text Romans 01 -297 329 some_text Rossillon 01 -298 330 some_text Ruffieu 01 -299 331 some_text Saint-Alban 01 -300 332 some_text Saint-André-de-Bâgé 01 -301 333 some_text Saint-André-de-Corcy 01 -302 334 some_text Saint-André-d'Huiriat 01 -303 335 some_text Saint-André-le-Bouchoux 01 -304 336 some_text Saint-André-sur-Vieux-Jonc 01 -305 337 some_text Saint-Bénigne 01 -306 338 some_text Saint-Benoît 01 -307 339 some_text Saint-Bernard 01 -308 340 some_text Saint-Bois 01 -309 341 some_text Saint-Champ 01 -310 342 some_text Sainte-Croix 01 -311 343 some_text Saint-Cyr-sur-Menthon 01 -312 344 some_text Saint-Denis-lès-Bourg 01 -313 345 some_text Saint-Denis-en-Bugey 01 -314 346 some_text Saint-Didier-d'Aussiat 01 -315 347 some_text Saint-Didier-de-Formans 01 -316 348 some_text Saint-Didier-sur-Chalaronne 01 -317 349 some_text Saint-Éloi 01 -318 350 some_text Saint-Étienne-du-Bois 01 -319 351 some_text Saint-Étienne-sur-Chalaronne 01 -320 352 some_text Saint-Étienne-sur-Reyssouze 01 -321 353 some_text Sainte-Euphémie 01 -322 354 some_text Saint-Genis-Pouilly 01 -323 355 some_text Saint-Genis-sur-Menthon 01 -324 356 some_text Saint-Georges-sur-Renon 01 -325 357 some_text Saint-Germain-de-Joux 01 -326 358 some_text Saint-Germain-les-Paroisses 01 -327 359 some_text Saint-Germain-sur-Renon 01 -328 360 some_text Saint-Jean-de-Gonville 01 -329 361 some_text Saint-Jean-de-Niost 01 -330 362 some_text Saint-Jean-de-Thurigneux 01 -331 363 some_text Saint-Jean-le-Vieux 01 -332 364 some_text Saint-Jean-sur-Reyssouze 01 -333 365 some_text Saint-Jean-sur-Veyle 01 -334 366 some_text Sainte-Julie 01 -335 367 some_text Saint-Julien-sur-Reyssouze 01 -336 368 some_text Saint-Julien-sur-Veyle 01 -337 369 some_text Saint-Just 01 -338 370 some_text Saint-Laurent-sur-Saône 01 -339 371 some_text Saint-Marcel 01 -340 372 some_text Saint-Martin-de-Bavel 01 -341 373 some_text Saint-Martin-du-Frêne 01 -342 374 some_text Saint-Martin-du-Mont 01 -343 375 some_text Saint-Martin-le-Châtel 01 -344 376 some_text Saint-Maurice-de-Beynost 01 -345 378 some_text Saint-Maurice-de-Gourdans 01 -346 379 some_text Saint-Maurice-de-Rémens 01 -347 380 some_text Saint-Nizier-le-Bouchoux 01 -348 381 some_text Saint-Nizier-le-Désert 01 -349 382 some_text Sainte-Olive 01 -350 383 some_text Saint-Paul-de-Varax 01 -351 384 some_text Saint-Rambert-en-Bugey 01 -352 385 some_text Saint-Rémy 01 -353 386 some_text Saint-Sorlin-en-Bugey 01 -354 387 some_text Saint-Sulpice 01 -355 388 some_text Saint-Trivier-de-Courtes 01 -356 389 some_text Saint-Trivier-sur-Moignans 01 -357 390 some_text Saint-Vulbas 01 -358 391 some_text Salavre 01 -359 392 some_text Samognat 01 -360 393 some_text Sandrans 01 -361 396 some_text Sault-Brénaz 01 -362 397 some_text Sauverny 01 -363 398 some_text Savigneux 01 -364 399 some_text Ségny 01 -365 400 some_text Seillonnaz 01 -366 401 some_text Sergy 01 -367 402 some_text Sermoyer 01 -368 403 some_text Serrières-de-Briord 01 -369 404 some_text Serrières-sur-Ain 01 -370 405 some_text Servas 01 -371 406 some_text Servignat 01 -372 407 some_text Seyssel 01 -373 408 some_text Simandre-sur-Suran 01 -374 409 some_text Songieu 01 -375 410 some_text Sonthonnax-la-Montagne 01 -376 411 some_text Souclin 01 -377 412 some_text Sulignat 01 -378 413 some_text Surjoux 01 -379 414 some_text Sutrieu 01 -380 415 some_text Talissieu 01 -381 416 some_text Tenay 01 -382 417 some_text Thézillieu 01 -383 418 some_text Thil 01 -384 419 some_text Thoiry 01 -385 420 some_text Thoissey 01 -386 421 some_text Torcieu 01 -387 422 some_text Tossiat 01 -388 423 some_text Toussieux 01 -389 424 some_text Tramoyes 01 -390 425 some_text Tranclière 01 -391 426 some_text Treffort-Cuisiat 01 -392 427 some_text Trévoux 01 -393 428 some_text Valeins 01 -394 429 some_text Vandeins 01 -395 430 some_text Varambon 01 -396 431 some_text Vaux-en-Bugey 01 -397 432 some_text Verjon 01 -398 433 some_text Vernoux 01 -399 434 some_text Versailleux 01 -400 435 some_text Versonnex 01 -401 436 some_text Vesancy 01 -402 437 some_text Vescours 01 -403 439 some_text Vésines 01 -404 441 some_text Vieu-d'Izenave 01 -405 442 some_text Vieu 01 -406 443 some_text Villars-les-Dombes 01 -407 444 some_text Villebois 01 -408 445 some_text Villemotier 01 -409 446 some_text Villeneuve 01 -410 447 some_text Villereversure 01 -411 448 some_text Villes 01 -412 449 some_text Villette-sur-Ain 01 -413 450 some_text Villieu-Loyes-Mollon 01 -414 451 some_text Viriat 01 -415 452 some_text Virieu-le-Grand 01 -416 453 some_text Virieu-le-Petit 01 -417 454 some_text Virignin 01 -418 456 some_text Vongnes 01 -419 457 some_text Vonnas 01 -420 001 some_text Abbécourt 02 -421 002 some_text Achery 02 -422 003 some_text Acy 02 -423 004 some_text Agnicourt-et-Séchelles 02 -424 005 some_text Aguilcourt 02 -425 006 some_text Aisonville-et-Bernoville 02 -426 007 some_text Aizelles 02 -427 008 some_text Aizy-Jouy 02 -428 009 some_text Alaincourt 02 -429 010 some_text Allemant 02 -430 011 some_text Ambleny 02 -431 012 some_text Ambrief 02 -432 013 some_text Amifontaine 02 -433 014 some_text Amigny-Rouy 02 -434 015 some_text Ancienville 02 -435 016 some_text Andelain 02 -436 017 some_text Anguilcourt-le-Sart 02 -437 018 some_text Anizy-le-Château 02 -438 019 some_text Annois 02 -439 020 some_text Any-Martin-Rieux 02 -440 021 some_text Archon 02 -441 022 some_text Arcy-Sainte-Restitue 02 -442 023 some_text Armentières-sur-Ourcq 02 -443 024 some_text Arrancy 02 -444 025 some_text Artemps 02 -445 026 some_text Artonges 02 -446 027 some_text Assis-sur-Serre 02 -447 028 some_text Athies-sous-Laon 02 -448 029 some_text Attilly 02 -449 030 some_text Aubencheul-aux-Bois 02 -450 031 some_text Aubenton 02 -451 032 some_text Aubigny-aux-Kaisnes 02 -452 033 some_text Aubigny-en-Laonnois 02 -453 034 some_text Audignicourt 02 -454 035 some_text Audigny 02 -455 036 some_text Augy 02 -456 037 some_text Aulnois-sous-Laon 02 -457 038 some_text Autels 02 -458 039 some_text Autremencourt 02 -459 040 some_text Autreppes 02 -460 041 some_text Autreville 02 -461 042 some_text Azy-sur-Marne 02 -462 043 some_text Bagneux 02 -463 044 some_text Bancigny 02 -464 046 some_text Barenton-Bugny 02 -465 047 some_text Barenton-Cel 02 -466 048 some_text Barenton-sur-Serre 02 -467 049 some_text Barisis 02 -468 050 some_text Barzy-en-Thiérache 02 -469 051 some_text Barzy-sur-Marne 02 -470 052 some_text Bassoles-Aulers 02 -471 053 some_text Baulne-en-Brie 02 -472 054 some_text Bazoches-sur-Vesles 02 -473 055 some_text Beaumé 02 -474 056 some_text Beaumont-en-Beine 02 -475 057 some_text Beaurevoir 02 -476 058 some_text Beaurieux 02 -477 059 some_text Beautor 02 -478 060 some_text Beauvois-en-Vermandois 02 -479 061 some_text Becquigny 02 -480 062 some_text Belleau 02 -481 063 some_text Bellenglise 02 -482 064 some_text Belleu 02 -483 065 some_text Bellicourt 02 -484 066 some_text Benay 02 -485 067 some_text Bergues-sur-Sambre 02 -486 068 some_text Berlancourt 02 -487 069 some_text Berlise 02 -488 070 some_text Bernot 02 -489 071 some_text Berny-Rivière 02 -490 072 some_text Berrieux 02 -491 073 some_text Berry-au-Bac 02 -492 074 some_text Bertaucourt-Epourdon 02 -493 075 some_text Berthenicourt 02 -494 076 some_text Bertricourt 02 -495 077 some_text Berzy-le-Sec 02 -496 078 some_text Besmé 02 -497 079 some_text Besmont 02 -498 080 some_text Besny-et-Loizy 02 -499 081 some_text Béthancourt-en-Vaux 02 -500 082 some_text Beugneux 02 -501 083 some_text Beuvardes 02 -502 084 some_text Bézu-le-Guéry 02 -503 085 some_text Bézu-Saint-Germain 02 -504 086 some_text Bichancourt 02 -505 087 some_text Bieuxy 02 -506 088 some_text Bièvres 02 -507 089 some_text Billy-sur-Aisne 02 -508 090 some_text Billy-sur-Ourcq 02 -509 091 some_text Blanzy-lès-Fismes 02 -510 093 some_text Blérancourt 02 -511 094 some_text Blesmes 02 -512 095 some_text Bohain-en-Vermandois 02 -513 096 some_text Bois-lès-Pargny 02 -514 097 some_text Boncourt 02 -515 098 some_text Bonneil 02 -516 099 some_text Bonnesvalyn 02 -517 100 some_text Bony 02 -518 101 some_text Bosmont-sur-Serre 02 -519 102 some_text Bouconville-Vauclair 02 -520 103 some_text Boué 02 -521 104 some_text Bouffignereux 02 -522 105 some_text Bouresches 02 -523 106 some_text Bourg-et-Comin 02 -524 107 some_text Bourguignon-sous-Coucy 02 -525 108 some_text Bourguignon-sous-Montbavin 02 -526 109 some_text Bouteille 02 -527 110 some_text Braine 02 -528 111 some_text Brancourt-en-Laonnois 02 -529 112 some_text Brancourt-le-Grand 02 -530 114 some_text Brasles 02 -531 115 some_text Braye-en-Laonnois 02 -532 116 some_text Braye-en-Thiérache 02 -533 117 some_text Bray-Saint-Christophe 02 -534 118 some_text Braye 02 -535 119 some_text Brécy 02 -536 120 some_text Brenelle 02 -537 121 some_text Breny 02 -538 122 some_text Brie 02 -539 123 some_text Brissay-Choigny 02 -540 124 some_text Brissy-Hamégicourt 02 -541 125 some_text Brumetz 02 -542 126 some_text Brunehamel 02 -543 127 some_text Bruyères-sur-Fère 02 -544 128 some_text Bruyères-et-Montbérault 02 -545 129 some_text Bruys 02 -546 130 some_text Bucilly 02 -547 131 some_text Bucy-le-Long 02 -548 132 some_text Bucy-lès-Cerny 02 -549 133 some_text Bucy-lès-Pierrepont 02 -550 134 some_text Buire 02 -551 135 some_text Buironfosse 02 -552 136 some_text Burelles 02 -553 137 some_text Bussiares 02 -554 138 some_text Buzancy 02 -555 139 some_text Caillouël-Crépigny 02 -556 140 some_text Camelin 02 -557 141 some_text Capelle 02 -558 142 some_text Castres 02 -559 143 some_text Catelet 02 -560 144 some_text Caulaincourt 02 -561 145 some_text Caumont 02 -562 146 some_text Celles-lès-Condé 02 -563 147 some_text Celle-sous-Montmirail 02 -564 148 some_text Celles-sur-Aisne 02 -565 149 some_text Cerizy 02 -566 150 some_text Cerny-en-Laonnois 02 -567 151 some_text Cerny-lès-Bucy 02 -568 152 some_text Cerseuil 02 -569 153 some_text Cessières 02 -570 154 some_text Chacrise 02 -571 155 some_text Chaillevois 02 -572 156 some_text Chalandry 02 -573 157 some_text Chambry 02 -574 158 some_text Chamouille 02 -575 159 some_text Champs 02 -576 160 some_text Chaourse 02 -577 161 some_text Chapelle-Monthodon 02 -578 162 some_text Chapelle-sur-Chézy 02 -579 163 some_text Charly 02 -580 164 some_text Charmel 02 -581 165 some_text Charmes 02 -582 166 some_text Chartèves 02 -583 167 some_text Chassemy 02 -584 168 some_text Château-Thierry 02 -585 169 some_text Châtillon-lès-Sons 02 -586 170 some_text Châtillon-sur-Oise 02 -587 171 some_text Chaudardes 02 -588 172 some_text Chaudun 02 -589 173 some_text Chauny 02 -590 174 some_text Chavignon 02 -591 175 some_text Chavigny 02 -592 176 some_text Chavonne 02 -593 177 some_text Chérêt 02 -594 178 some_text Chermizy-Ailles 02 -595 179 some_text Chéry-Chartreuve 02 -596 180 some_text Chéry-lès-Pouilly 02 -597 181 some_text Chéry-lès-Rozoy 02 -598 182 some_text Chevennes 02 -599 183 some_text Chevregny 02 -600 184 some_text Chevresis-Monceau 02 -601 185 some_text Chézy-en-Orxois 02 -602 186 some_text Chézy-sur-Marne 02 -603 187 some_text Chierry 02 -604 188 some_text Chigny 02 -605 189 some_text Chivres-en-Laonnois 02 -606 190 some_text Chivres-Val 02 -607 191 some_text Chivy-lès-Étouvelles 02 -608 192 some_text Chouy 02 -609 193 some_text Cierges 02 -610 194 some_text Cilly 02 -611 195 some_text Ciry-Salsogne 02 -612 196 some_text Clacy-et-Thierret 02 -613 197 some_text Clairfontaine 02 -614 198 some_text Clamecy 02 -615 199 some_text Clastres 02 -616 200 some_text Clermont-les-Fermes 02 -617 201 some_text Cœuvres-et-Valsery 02 -618 203 some_text Coincy 02 -619 204 some_text Coingt 02 -620 205 some_text Colligis-Crandelain 02 -621 206 some_text Colonfay 02 -622 207 some_text Commenchon 02 -623 208 some_text Concevreux 02 -624 209 some_text Condé-en-Brie 02 -625 210 some_text Condé-sur-Aisne 02 -626 211 some_text Condé-sur-Suippe 02 -627 212 some_text Condren 02 -628 213 some_text Connigis 02 -629 214 some_text Contescourt 02 -630 215 some_text Corbeny 02 -631 216 some_text Corcy 02 -632 217 some_text Coucy-le-Château-Auffrique 02 -633 218 some_text Coucy-lès-Eppes 02 -634 219 some_text Coucy-la-Ville 02 -635 220 some_text Coulonges-Cohan 02 -636 221 some_text Coupru 02 -637 222 some_text Courbes 02 -638 223 some_text Courboin 02 -639 224 some_text Courcelles-sur-Vesles 02 -640 225 some_text Courchamps 02 -641 226 some_text Courmelles 02 -642 227 some_text Courmont 02 -643 228 some_text Courtemont-Varennes 02 -644 229 some_text Courtrizy-et-Fussigny 02 -645 230 some_text Couvrelles 02 -646 231 some_text Couvron-et-Aumencourt 02 -647 232 some_text Coyolles 02 -648 233 some_text Cramaille 02 -649 234 some_text Craonne 02 -650 235 some_text Craonnelle 02 -651 236 some_text Crécy-au-Mont 02 -652 237 some_text Crécy-sur-Serre 02 -653 238 some_text Crépy 02 -654 239 some_text Crézancy 02 -655 240 some_text Croix-Fonsommes 02 -656 241 some_text Croix-sur-Ourcq 02 -657 242 some_text Crouttes-sur-Marne 02 -658 243 some_text Crouy 02 -659 244 some_text Crupilly 02 -660 245 some_text Cuffies 02 -661 246 some_text Cugny 02 -662 248 some_text Cuirieux 02 -663 249 some_text Cuiry-Housse 02 -664 250 some_text Cuiry-lès-Chaudardes 02 -665 251 some_text Cuiry-lès-Iviers 02 -666 252 some_text Cuissy-et-Geny 02 -667 253 some_text Cuisy-en-Almont 02 -668 254 some_text Cutry 02 -669 255 some_text Cys-la-Commune 02 -670 256 some_text Dagny-Lambercy 02 -671 257 some_text Dallon 02 -672 258 some_text Dammard 02 -673 259 some_text Dampleux 02 -674 260 some_text Danizy 02 -675 261 some_text Dercy 02 -676 262 some_text Deuillet 02 -677 263 some_text Dhuizel 02 -678 264 some_text Dizy-le-Gros 02 -679 265 some_text Dohis 02 -680 266 some_text Dolignon 02 -681 267 some_text Dommiers 02 -682 268 some_text Domptin 02 -683 269 some_text Dorengt 02 -684 270 some_text Douchy 02 -685 271 some_text Dravegny 02 -686 272 some_text Droizy 02 -687 273 some_text Dury 02 -688 274 some_text Ébouleau 02 -689 275 some_text Effry 02 -690 276 some_text Englancourt 02 -691 277 some_text Épagny 02 -692 278 some_text Éparcy 02 -693 279 some_text Épaux-Bézu 02 -694 280 some_text Épieds 02 -695 281 some_text Épine-aux-Bois 02 -696 282 some_text Eppes 02 -697 283 some_text Erlon 02 -698 284 some_text Erloy 02 -699 286 some_text Esquéhéries 02 -700 287 some_text Essigny-le-Grand 02 -701 288 some_text Essigny-le-Petit 02 -702 289 some_text Essises 02 -703 290 some_text Essômes-sur-Marne 02 -704 291 some_text Estrées 02 -705 292 some_text Étampes-sur-Marne 02 -706 293 some_text Étaves-et-Bocquiaux 02 -707 294 some_text Étouvelles 02 -708 295 some_text Étréaupont 02 -709 296 some_text Étreillers 02 -710 297 some_text Étrépilly 02 -711 298 some_text Étreux 02 -712 299 some_text Évergnicourt 02 -713 301 some_text Faucoucourt 02 -714 302 some_text Faverolles 02 -715 303 some_text Fayet 02 -716 304 some_text Fère 02 -717 305 some_text Fère-en-Tardenois 02 -718 306 some_text Ferté-Chevresis 02 -719 307 some_text Ferté-Milon 02 -720 308 some_text Fesmy-le-Sart 02 -721 309 some_text Festieux 02 -722 310 some_text Fieulaine 02 -723 311 some_text Filain 02 -724 312 some_text Flamengrie 02 -725 313 some_text Flavigny-le-Grand-et-Beaurain 02 -726 315 some_text Flavy-le-Martel 02 -727 316 some_text Fleury 02 -728 317 some_text Fluquières 02 -729 318 some_text Folembray 02 -730 319 some_text Fonsommes 02 -731 320 some_text Fontaine-lès-Clercs 02 -732 321 some_text Fontaine-lès-Vervins 02 -733 322 some_text Fontaine-Notre-Dame 02 -734 323 some_text Fontaine-Uterte 02 -735 324 some_text Fontenelle 02 -736 325 some_text Fontenelle-en-Brie 02 -737 326 some_text Fontenoy 02 -738 327 some_text Foreste 02 -739 328 some_text Fossoy 02 -740 329 some_text Fourdrain 02 -741 330 some_text Francilly-Selency 02 -742 331 some_text Franqueville 02 -743 332 some_text Fresnes-en-Tardenois 02 -744 333 some_text Fresnes 02 -745 334 some_text Fresnoy-le-Grand 02 -746 335 some_text Fressancourt 02 -747 336 some_text Frières-Faillouël 02 -748 337 some_text Froidestrées 02 -749 338 some_text Froidmont-Cohartille 02 -750 339 some_text Gandelu 02 -751 340 some_text Gauchy 02 -752 341 some_text Gercy 02 -753 342 some_text Gergny 02 -754 343 some_text Germaine 02 -755 344 some_text Gernicourt 02 -756 345 some_text Gibercourt 02 -757 346 some_text Gizy 02 -758 347 some_text Gland 02 -759 348 some_text Glennes 02 -760 349 some_text Goudelancourt-lès-Berrieux 02 -761 350 some_text Goudelancourt-lès-Pierrepont 02 -762 351 some_text Goussancourt 02 -763 352 some_text Gouy 02 -764 353 some_text Grandlup-et-Fay 02 -765 354 some_text Grandrieux 02 -766 355 some_text Gricourt 02 -767 356 some_text Grisolles 02 -768 357 some_text Gronard 02 -769 358 some_text Grougis 02 -770 359 some_text Grugies 02 -771 360 some_text Guignicourt 02 -772 361 some_text Guise 02 -773 362 some_text Guivry 02 -774 363 some_text Guny 02 -775 364 some_text Guyencourt 02 -776 366 some_text Hannapes 02 -777 367 some_text Happencourt 02 -778 368 some_text Haramont 02 -779 369 some_text Harcigny 02 -780 370 some_text Hargicourt 02 -781 371 some_text Harly 02 -782 372 some_text Hartennes-et-Taux 02 -783 373 some_text Hary 02 -784 374 some_text Lehaucourt 02 -785 375 some_text Hautevesnes 02 -786 376 some_text Hauteville 02 -787 377 some_text Haution 02 -788 378 some_text Hérie 02 -789 379 some_text Hérie-la-Viéville 02 -790 380 some_text Hinacourt 02 -791 381 some_text Hirson 02 -792 382 some_text Holnon 02 -793 383 some_text Homblières 02 -794 384 some_text Houry 02 -795 385 some_text Housset 02 -796 386 some_text Iron 02 -797 387 some_text Itancourt 02 -798 388 some_text Iviers 02 -799 389 some_text Jaulgonne 02 -800 390 some_text Jeancourt 02 -801 391 some_text Jeantes 02 -802 392 some_text Joncourt 02 -803 393 some_text Jouaignes 02 -804 395 some_text Jumencourt 02 -805 396 some_text Jumigny 02 -806 397 some_text Jussy 02 -807 398 some_text Juvigny 02 -808 399 some_text Juvincourt-et-Damary 02 -809 400 some_text Laffaux 02 -810 401 some_text Laigny 02 -811 402 some_text Lanchy 02 -812 403 some_text Landifay-et-Bertaignemont 02 -813 404 some_text Landouzy-la-Cour 02 -814 405 some_text Landouzy-la-Ville 02 -815 406 some_text Landricourt 02 -816 407 some_text Laniscourt 02 -817 408 some_text Laon 02 -818 409 some_text Lappion 02 -819 410 some_text Largny-sur-Automne 02 -820 411 some_text Latilly 02 -821 412 some_text Launoy 02 -822 413 some_text Laval-en-Laonnois 02 -823 414 some_text Lavaqueresse 02 -824 415 some_text Laversine 02 -825 416 some_text Lemé 02 -826 417 some_text Lempire 02 -827 418 some_text Lerzy 02 -828 419 some_text Leschelles 02 -829 420 some_text Lesdins 02 -830 421 some_text Lesges 02 -831 422 some_text Lesquielles-Saint-Germain 02 -832 423 some_text Leuilly-sous-Coucy 02 -833 424 some_text Leury 02 -834 425 some_text Leuze 02 -835 426 some_text Levergies 02 -836 427 some_text Lhuys 02 -837 428 some_text Licy-Clignon 02 -838 429 some_text Lierval 02 -839 430 some_text Liesse-Notre-Dame 02 -840 431 some_text Liez 02 -841 432 some_text Limé 02 -842 433 some_text Lislet 02 -843 434 some_text Lizy 02 -844 435 some_text Logny-lès-Aubenton 02 -845 438 some_text Longpont 02 -846 439 some_text Longueval-Barbonval 02 -847 440 some_text Lor 02 -848 441 some_text Louâtre 02 -849 442 some_text Loupeigne 02 -850 443 some_text Lucy-le-Bocage 02 -851 444 some_text Lugny 02 -852 445 some_text Luzoir 02 -853 446 some_text Ly-Fontaine 02 -854 447 some_text Maast-et-Violaine 02 -855 448 some_text Mâchecourt 02 -856 449 some_text Macogny 02 -857 450 some_text Macquigny 02 -858 451 some_text Magny-la-Fosse 02 -859 452 some_text Maissemy 02 -860 453 some_text Maizy 02 -861 454 some_text Malmaison 02 -862 455 some_text Malzy 02 -863 456 some_text Manicamp 02 -864 457 some_text Marchais 02 -865 458 some_text Marchais-en-Brie 02 -866 459 some_text Marcy 02 -867 460 some_text Marcy-sous-Marle 02 -868 461 some_text Marest-Dampcourt 02 -869 462 some_text Mareuil-en-Dôle 02 -870 463 some_text Marfontaine 02 -871 464 some_text Margival 02 -872 465 some_text Marigny-en-Orxois 02 -873 466 some_text Marizy-Sainte-Geneviève 02 -874 467 some_text Marizy-Saint-Mard 02 -875 468 some_text Marle 02 -876 469 some_text Marly-Gomont 02 -877 470 some_text Martigny 02 -878 471 some_text Martigny-Courpierre 02 -879 472 some_text Mauregny-en-Haye 02 -880 473 some_text Mayot 02 -881 474 some_text Mennessis 02 -882 475 some_text Menneville 02 -883 476 some_text Mennevret 02 -884 477 some_text Mercin-et-Vaux 02 -885 478 some_text Merlieux-et-Fouquerolles 02 -886 479 some_text Merval 02 -887 480 some_text Mesbrecourt-Richecourt 02 -888 481 some_text Mesnil-Saint-Laurent 02 -889 482 some_text Meurival 02 -890 483 some_text Mézières-sur-Oise 02 -891 484 some_text Mézy-Moulins 02 -892 485 some_text Missy-aux-Bois 02 -893 486 some_text Missy-lès-Pierrepont 02 -894 487 some_text Missy-sur-Aisne 02 -895 488 some_text Molain 02 -896 489 some_text Molinchart 02 -897 490 some_text Monampteuil 02 -898 491 some_text Monceau-le-Neuf-et-Faucouzy 02 -899 492 some_text Monceau-lès-Leups 02 -900 493 some_text Monceau-le-Waast 02 -901 494 some_text Monceau-sur-Oise 02 -902 495 some_text Mondrepuis 02 -903 496 some_text Monnes 02 -904 497 some_text Mons-en-Laonnois 02 -905 498 some_text Montaigu 02 -906 499 some_text Montbavin 02 -907 500 some_text Montbrehain 02 -908 501 some_text Montchâlons 02 -909 502 some_text Montcornet 02 -910 503 some_text Mont-d'Origny 02 -911 504 some_text Montescourt-Lizerolles 02 -912 505 some_text Montfaucon 02 -913 506 some_text Montgobert 02 -914 507 some_text Montgru-Saint-Hilaire 02 -915 508 some_text Monthenault 02 -916 509 some_text Monthiers 02 -917 510 some_text Monthurel 02 -918 511 some_text Montigny-en-Arrouaise 02 -919 512 some_text Montigny-l'Allier 02 -920 513 some_text Montigny-le-Franc 02 -921 514 some_text Montigny-Lengrain 02 -922 515 some_text Montigny-lès-Condé 02 -923 516 some_text Montigny-sous-Marle 02 -924 517 some_text Montigny-sur-Crécy 02 -925 518 some_text Montlevon 02 -926 519 some_text Montloué 02 -927 520 some_text Mont-Notre-Dame 02 -928 521 some_text Montreuil-aux-Lions 02 -929 522 some_text Mont-Saint-Jean 02 -930 523 some_text Mont-Saint-Martin 02 -931 524 some_text Mont-Saint-Père 02 -932 525 some_text Morcourt 02 -933 526 some_text Morgny-en-Thiérache 02 -934 527 some_text Morsain 02 -935 528 some_text Mortefontaine 02 -936 529 some_text Mortiers 02 -937 530 some_text Moulins 02 -938 531 some_text Moussy-Verneuil 02 -939 532 some_text Moÿ-de-l'Aisne 02 -940 533 some_text Muret-et-Crouttes 02 -941 534 some_text Muscourt 02 -942 535 some_text Nampcelles-la-Cour 02 -943 536 some_text Nampteuil-sous-Muret 02 -944 537 some_text Nanteuil-la-Fosse 02 -945 538 some_text Nanteuil-Notre-Dame 02 -946 539 some_text Nauroy 02 -947 540 some_text Nesles-la-Montagne 02 -948 541 some_text Neufchâtel-sur-Aisne 02 -949 542 some_text Neuflieux 02 -950 543 some_text Neuilly-Saint-Front 02 -951 544 some_text Neuve-Maison 02 -952 545 some_text Neuville-Bosmont 02 -953 546 some_text Neuville-en-Beine 02 -954 547 some_text Neuville-Housset 02 -955 548 some_text Neuville-lès-Dorengt 02 -956 549 some_text Neuville-Saint-Amand 02 -957 550 some_text Neuville-sur-Ailette 02 -958 551 some_text Neuville-sur-Margival 02 -959 552 some_text Neuvillette 02 -960 553 some_text Nizy-le-Comte 02 -961 554 some_text Nogentel 02 -962 555 some_text Nogent-l'Artaud 02 -963 556 some_text Noircourt 02 -964 557 some_text Noroy-sur-Ourcq 02 -965 558 some_text Nouvion-en-Thiérache 02 -966 559 some_text Nouvion-et-Catillon 02 -967 560 some_text Nouvion-le-Comte 02 -968 561 some_text Nouvion-le-Vineux 02 -969 562 some_text Nouvron-Vingré 02 -970 563 some_text Noyales 02 -971 564 some_text Noyant-et-Aconin 02 -972 565 some_text Œuilly 02 -973 566 some_text Ognes 02 -974 567 some_text Ohis 02 -975 568 some_text Oigny-en-Valois 02 -976 569 some_text Oisy 02 -977 570 some_text Ollezy 02 -978 571 some_text Omissy 02 -979 572 some_text Orainville 02 -980 573 some_text Orgeval 02 -981 574 some_text Origny-en-Thiérache 02 -982 575 some_text Origny-Sainte-Benoite 02 -983 576 some_text Osly-Courtil 02 -984 577 some_text Ostel 02 -985 578 some_text Oulches-la-Vallée-Foulon 02 -986 579 some_text Oulchy-la-Ville 02 -987 580 some_text Oulchy-le-Château 02 -988 581 some_text Paars 02 -989 582 some_text Paissy 02 -990 583 some_text Pancy-Courtecon 02 -991 584 some_text Papleux 02 -992 585 some_text Parcy-et-Tigny 02 -993 586 some_text Parfondeval 02 -994 587 some_text Parfondru 02 -995 588 some_text Pargnan 02 -996 589 some_text Pargny-Filain 02 -997 590 some_text Pargny-la-Dhuys 02 -998 591 some_text Pargny-les-Bois 02 -999 592 some_text Parpeville 02 -1000 593 some_text Pasly 02 -1001 594 some_text Passy-en-Valois 02 -1002 595 some_text Passy-sur-Marne 02 -1003 596 some_text Pavant 02 -1004 597 some_text Perles 02 -1005 598 some_text Pernant 02 -1006 599 some_text Pierremande 02 -1007 600 some_text Pierrepont 02 -1008 601 some_text Pignicourt 02 -1009 602 some_text Pinon 02 -1010 604 some_text Pithon 02 -1011 605 some_text Pleine-Selve 02 -1012 606 some_text Plessier-Huleu 02 -1013 607 some_text Ploisy 02 -1014 608 some_text Plomion 02 -1015 609 some_text Ployart-et-Vaurseine 02 -1016 610 some_text Pommiers 02 -1017 612 some_text Pont-Arcy 02 -1018 613 some_text Pontavert 02 -1019 614 some_text Pontru 02 -1020 615 some_text Pontruet 02 -1021 616 some_text Pont-Saint-Mard 02 -1022 617 some_text Pouilly-sur-Serre 02 -1023 618 some_text Prémont 02 -1024 619 some_text Prémontré 02 -1025 620 some_text Presles-et-Boves 02 -1026 621 some_text Presles-et-Thierny 02 -1027 622 some_text Priez 02 -1028 623 some_text Prisces 02 -1029 624 some_text Proisy 02 -1030 625 some_text Proix 02 -1031 626 some_text Prouvais 02 -1032 627 some_text Proviseux-et-Plesnoy 02 -1033 628 some_text Puiseux-en-Retz 02 -1034 629 some_text Puisieux-et-Clanlieu 02 -1035 631 some_text Quierzy 02 -1036 632 some_text Quincy-Basse 02 -1037 633 some_text Quincy-sous-le-Mont 02 -1038 634 some_text Raillimont 02 -1039 635 some_text Ramicourt 02 -1040 636 some_text Regny 02 -1041 637 some_text Remaucourt 02 -1042 638 some_text Remies 02 -1043 639 some_text Remigny 02 -1044 640 some_text Renansart 02 -1045 641 some_text Renneval 02 -1046 642 some_text Résigny 02 -1047 643 some_text Ressons-le-Long 02 -1048 644 some_text Retheuil 02 -1049 645 some_text Reuilly-Sauvigny 02 -1050 646 some_text Révillon 02 -1051 647 some_text Ribeauville 02 -1052 648 some_text Ribemont 02 -1053 649 some_text Rocourt-Saint-Martin 02 -1054 650 some_text Rocquigny 02 -1055 651 some_text Rogécourt 02 -1056 652 some_text Rogny 02 -1057 653 some_text Romeny-sur-Marne 02 -1058 654 some_text Romery 02 -1059 655 some_text Ronchères 02 -1060 656 some_text Roucy 02 -1061 657 some_text Rougeries 02 -1062 658 some_text Roupy 02 -1063 659 some_text Rouvroy 02 -1064 660 some_text Rouvroy-sur-Serre 02 -1065 661 some_text Royaucourt-et-Chailvet 02 -1066 662 some_text Rozet-Saint-Albin 02 -1067 663 some_text Rozières-sur-Crise 02 -1068 664 some_text Rozoy-Bellevalle 02 -1069 665 some_text Grand-Rozoy 02 -1070 666 some_text Rozoy-sur-Serre 02 -1071 667 some_text Saconin-et-Breuil 02 -1072 668 some_text Sains-Richaumont 02 -1073 669 some_text Saint-Agnan 02 -1074 670 some_text Saint-Algis 02 -1075 671 some_text Saint-Aubin 02 -1076 672 some_text Saint-Bandry 02 -1077 673 some_text Saint-Christophe-à-Berry 02 -1078 674 some_text Saint-Clément 02 -1079 675 some_text Sainte-Croix 02 -1080 676 some_text Saint-Erme-Outre-et-Ramecourt 02 -1081 677 some_text Saint-Eugène 02 -1082 678 some_text Sainte-Geneviève 02 -1083 679 some_text Saint-Gengoulph 02 -1084 680 some_text Saint-Gobain 02 -1085 681 some_text Saint-Gobert 02 -1086 682 some_text Saint-Mard 02 -1087 683 some_text Saint-Martin-Rivière 02 -1088 684 some_text Saint-Michel 02 -1089 685 some_text Saint-Nicolas-aux-Bois 02 -1090 686 some_text Saint-Paul-aux-Bois 02 -1091 687 some_text Saint-Pierre-Aigle 02 -1092 688 some_text Saint-Pierre-lès-Franqueville 02 -1093 689 some_text Saint-Pierremont 02 -1094 690 some_text Sainte-Preuve 02 -1095 691 some_text Saint-Quentin 02 -1096 693 some_text Saint-Rémy-Blanzy 02 -1097 694 some_text Saint-Simon 02 -1098 695 some_text Saint-Thibaut 02 -1099 696 some_text Saint-Thomas 02 -1100 697 some_text Samoussy 02 -1101 698 some_text Sancy-les-Cheminots 02 -1102 699 some_text Saponay 02 -1103 701 some_text Saulchery 02 -1104 702 some_text Savy 02 -1105 703 some_text Seboncourt 02 -1106 704 some_text Selens 02 -1107 705 some_text Selve 02 -1108 706 some_text Septmonts 02 -1109 707 some_text Septvaux 02 -1110 708 some_text Sequehart 02 -1111 709 some_text Serain 02 -1112 710 some_text Seraucourt-le-Grand 02 -1113 711 some_text Serches 02 -1114 712 some_text Sergy 02 -1115 713 some_text Seringes-et-Nesles 02 -1116 714 some_text Sermoise 02 -1117 715 some_text Serval 02 -1118 716 some_text Servais 02 -1119 717 some_text Séry-lès-Mézières 02 -1120 718 some_text Silly-la-Poterie 02 -1121 719 some_text Sinceny 02 -1122 720 some_text Sissonne 02 -1123 721 some_text Sissy 02 -1124 722 some_text Soissons 02 -1125 723 some_text Soize 02 -1126 724 some_text Sommelans 02 -1127 725 some_text Sommeron 02 -1128 726 some_text Sommette-Eaucourt 02 -1129 727 some_text Sons-et-Ronchères 02 -1130 728 some_text Sorbais 02 -1131 729 some_text Soucy 02 -1132 730 some_text Soupir 02 -1133 731 some_text Sourd 02 -1134 732 some_text Surfontaine 02 -1135 733 some_text Suzy 02 -1136 734 some_text Taillefontaine 02 -1137 735 some_text Tannières 02 -1138 736 some_text Tartiers 02 -1139 737 some_text Tavaux-et-Pontséricourt 02 -1140 738 some_text Tergnier 02 -1141 739 some_text Terny-Sorny 02 -1142 740 some_text Thenailles 02 -1143 741 some_text Thenelles 02 -1144 742 some_text Thiernu 02 -1145 743 some_text Thuel 02 -1146 744 some_text Torcy-en-Valois 02 -1147 745 some_text Toulis-et-Attencourt 02 -1148 746 some_text Travecy 02 -1149 747 some_text Trefcon 02 -1150 748 some_text Trélou-sur-Marne 02 -1151 749 some_text Troësnes 02 -1152 750 some_text Trosly-Loire 02 -1153 751 some_text Trucy 02 -1154 752 some_text Tugny-et-Pont 02 -1155 753 some_text Tupigny 02 -1156 754 some_text Ugny-le-Gay 02 -1157 755 some_text Urcel 02 -1158 756 some_text Urvillers 02 -1159 757 some_text Vadencourt 02 -1160 758 some_text Vailly-sur-Aisne 02 -1161 759 some_text Vallée-au-Blé 02 -1162 760 some_text Vallée-Mulâtre 02 -1163 761 some_text Variscourt 02 -1164 762 some_text Vassens 02 -1165 763 some_text Vasseny 02 -1166 764 some_text Vassogne 02 -1167 765 some_text Vaucelles-et-Beffecourt 02 -1168 766 some_text Vaudesson 02 -1169 767 some_text Vauxrezis 02 -1170 768 some_text Vauxaillon 02 -1171 769 some_text Vaux-Andigny 02 -1172 770 some_text Vauxbuin 02 -1173 771 some_text Vauxcéré 02 -1174 772 some_text Vaux-en-Vermandois 02 -1175 773 some_text Vauxtin 02 -1176 774 some_text Vendelles 02 -1177 775 some_text Vendeuil 02 -1178 776 some_text Vendhuile 02 -1179 777 some_text Vendières 02 -1180 778 some_text Vendresse-Beaulne 02 -1181 779 some_text Vénérolles 02 -1182 780 some_text Venizel 02 -1183 781 some_text Verdilly 02 -1184 782 some_text Verguier 02 -1185 783 some_text Grand-Verly 02 -1186 784 some_text Petit-Verly 02 -1187 785 some_text Vermand 02 -1188 786 some_text Verneuil-sous-Coucy 02 -1189 787 some_text Verneuil-sur-Serre 02 -1190 788 some_text Versigny 02 -1191 789 some_text Vervins 02 -1192 790 some_text Vesles-et-Caumont 02 -1193 791 some_text Veslud 02 -1194 792 some_text Veuilly-la-Poterie 02 -1195 793 some_text Vézaponin 02 -1196 794 some_text Vézilly 02 -1197 795 some_text Vic-sur-Aisne 02 -1198 796 some_text Vichel-Nanteuil 02 -1199 797 some_text Viel-Arcy 02 -1200 798 some_text Viels-Maisons 02 -1201 799 some_text Vierzy 02 -1202 800 some_text Viffort 02 -1203 801 some_text Vigneux-Hocquet 02 -1204 802 some_text Ville-aux-Bois-lès-Dizy 02 -1205 803 some_text Ville-aux-Bois-lès-Pontavert 02 -1206 804 some_text Villemontoire 02 -1207 805 some_text Villeneuve-Saint-Germain 02 -1208 806 some_text Villeneuve-sur-Fère 02 -1209 807 some_text Villequier-Aumont 02 -1210 808 some_text Villeret 02 -1211 809 some_text Villers-Agron-Aiguizy 02 -1212 810 some_text Villers-Cotterêts 02 -1213 811 some_text Villers-en-Prayères 02 -1214 812 some_text Villers-Hélon 02 -1215 813 some_text Villers-le-Sec 02 -1216 814 some_text Villers-lès-Guise 02 -1217 815 some_text Villers-Saint-Christophe 02 -1218 816 some_text Villers-sur-Fère 02 -1219 817 some_text Ville-Savoye 02 -1220 818 some_text Villiers-Saint-Denis 02 -1221 819 some_text Vincy-Reuil-et-Magny 02 -1222 820 some_text Viry-Noureuil 02 -1223 821 some_text Vivaise 02 -1224 822 some_text Vivières 02 -1225 823 some_text Voharies 02 -1226 824 some_text Vorges 02 -1227 826 some_text Voulpaix 02 -1228 827 some_text Voyenne 02 -1229 828 some_text Vregny 02 -1230 829 some_text Vuillery 02 -1231 830 some_text Wassigny 02 -1232 831 some_text Watigny 02 -1233 832 some_text Wiège-Faty 02 -1234 833 some_text Wimy 02 -1235 834 some_text Wissignicourt 02 -1236 001 some_text Abrest 03 -1237 002 some_text Agonges 03 -1238 003 some_text Ainay-le-Château 03 -1239 004 some_text Andelaroche 03 -1240 005 some_text Archignat 03 -1241 006 some_text Arfeuilles 03 -1242 007 some_text Arpheuilles-Saint-Priest 03 -1243 008 some_text Arronnes 03 -1244 009 some_text Aubigny 03 -1245 010 some_text Audes 03 -1246 011 some_text Aurouër 03 -1247 012 some_text Autry-Issards 03 -1248 013 some_text Avermes 03 -1249 014 some_text Avrilly 03 -1250 015 some_text Bagneux 03 -1251 016 some_text Barberier 03 -1252 017 some_text Barrais-Bussolles 03 -1253 018 some_text Bayet 03 -1254 019 some_text Beaulon 03 -1255 020 some_text Beaune-d'Allier 03 -1256 021 some_text Bègues 03 -1257 022 some_text Bellenaves 03 -1258 023 some_text Bellerive-sur-Allier 03 -1259 024 some_text Bert 03 -1260 025 some_text Bessay-sur-Allier 03 -1261 026 some_text Besson 03 -1262 027 some_text Bézenet 03 -1263 028 some_text Billezois 03 -1264 029 some_text Billy 03 -1265 030 some_text Biozat 03 -1266 031 some_text Bizeneuille 03 -1267 032 some_text Blomard 03 -1268 033 some_text Bost 03 -1269 034 some_text Boucé 03 -1270 035 some_text Bouchaud 03 -1271 036 some_text Bourbon-l'Archambault 03 -1272 037 some_text Braize 03 -1273 038 some_text Bransat 03 -1274 039 some_text Bresnay 03 -1275 040 some_text Bressolles 03 -1276 041 some_text Brethon 03 -1277 042 some_text Breuil 03 -1278 043 some_text Broût-Vernet 03 -1279 044 some_text Brugheas 03 -1280 045 some_text Busset 03 -1281 046 some_text Buxières-les-Mines 03 -1282 047 some_text Celle 03 -1283 048 some_text Cérilly 03 -1284 049 some_text Cesset 03 -1285 050 some_text Chabanne 03 -1286 051 some_text Chambérat 03 -1287 052 some_text Chamblet 03 -1288 053 some_text Chantelle 03 -1289 054 some_text Chapeau 03 -1290 055 some_text Chapelaude 03 -1291 056 some_text Chapelle 03 -1292 057 some_text Chapelle-aux-Chasses 03 -1293 058 some_text Chappes 03 -1294 059 some_text Chareil-Cintrat 03 -1295 060 some_text Charmeil 03 -1296 061 some_text Charmes 03 -1297 062 some_text Charroux 03 -1298 063 some_text Chassenard 03 -1299 064 some_text Château-sur-Allier 03 -1300 065 some_text Châtel-de-Neuvre 03 -1301 066 some_text Châtel-Montagne 03 -1302 067 some_text Châtelperron 03 -1303 068 some_text Châtelus 03 -1304 069 some_text Châtillon 03 -1305 070 some_text Chavenon 03 -1306 071 some_text Chavroches 03 -1307 072 some_text Chazemais 03 -1308 073 some_text Chemilly 03 -1309 074 some_text Chevagnes 03 -1310 075 some_text Chezelle 03 -1311 076 some_text Chézy 03 -1312 077 some_text Chirat-l'Église 03 -1313 078 some_text Chouvigny 03 -\. - -SELECT count(*) FROM towns; -SELECT * FROM towns where id in (13, 666); --- ON REPLICA --- --- select count(*) from towns; --- count --- ------- --- 1313 --- (1 row) --- --- select * from towns where id in (13, 666); --- id | code | article | name | department --- -----+------+-----------+----------------+------------ --- 13 | 014 | some_text | Arbent | 01 --- 666 | 252 | some_text | Cuissy-et-Geny | 02 --- (2 rows) --- - -DROP TABLE towns; -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/multi_insert.inc \ No newline at end of file diff --git a/sql/multi_insert_basic.sql b/sql/multi_insert_basic.sql new file mode 100644 index 00000000..4d34e977 --- /dev/null +++ b/sql/multi_insert_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/multi_insert.inc \ No newline at end of file diff --git a/sql/non_sorted_off_compact.inc b/sql/non_sorted_off_compact.inc new file mode 100644 index 00000000..7bba2bea --- /dev/null +++ b/sql/non_sorted_off_compact.inc @@ -0,0 +1,56 @@ +-- A test case for https://github.com/Percona-Lab/pg_tde/pull/21 +-- +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'); + +DROP TABLE IF EXISTS sbtest1; +CREATE TABLE sbtest1( + id SERIAL, + k INTEGER DEFAULT '0' NOT NULL, + PRIMARY KEY (id) + ) USING :tde_am; + +INSERT INTO sbtest1(k) VALUES +(1), +(2), +(3), +(4), +(5), +(6), +(7), +(8), +(9), +(10); +DELETE FROM sbtest1 WHERE id IN (4,5,6); + +VACUUM sbtest1; + +INSERT INTO sbtest1(k) VALUES +(11), +(12), +(13); + +-- Line pointers (lp) point to non-sorted offsets (lp_off): +-- CREATE EXTENSION pageinspect; +-- SELECT lp, lp_off, t_ctid FROM heap_page_items(get_raw_page('sbtest1', 0)); +-- lp | lp_off | t_ctid +-- ----+--------+-------- +-- 1 | 8160 | (0,1) +-- 2 | 8128 | (0,2) +-- 3 | 8096 | (0,3) +-- 4 | 7936 | (0,4) +-- 5 | 7904 | (0,5) +-- 6 | 7872 | (0,6) +-- 7 | 8064 | (0,7) +-- 8 | 8032 | (0,8) +-- 9 | 8000 | (0,9) +-- 10 | 7968 | (0,10) + +---- Trigger comapction +delete from sbtest1 where id in (2); +VACUUM sbtest1; + +DROP TABLE sbtest1; +DROP EXTENSION pg_tde; diff --git a/sql/non_sorted_off_compact.sql b/sql/non_sorted_off_compact.sql index 712bb81d..d36399eb 100644 --- a/sql/non_sorted_off_compact.sql +++ b/sql/non_sorted_off_compact.sql @@ -1,56 +1,2 @@ --- A test case for https://github.com/Percona-Lab/pg_tde/pull/21 --- -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'); - -DROP TABLE IF EXISTS sbtest1; -CREATE TABLE sbtest1( - id SERIAL, - k INTEGER DEFAULT '0' NOT NULL, - PRIMARY KEY (id) - ) USING tde_heap_basic; - -INSERT INTO sbtest1(k) VALUES -(1), -(2), -(3), -(4), -(5), -(6), -(7), -(8), -(9), -(10); -DELETE FROM sbtest1 WHERE id IN (4,5,6); - -VACUUM sbtest1; - -INSERT INTO sbtest1(k) VALUES -(11), -(12), -(13); - --- Line pointers (lp) point to non-sorted offsets (lp_off): --- CREATE EXTENSION pageinspect; --- SELECT lp, lp_off, t_ctid FROM heap_page_items(get_raw_page('sbtest1', 0)); --- lp | lp_off | t_ctid --- ----+--------+-------- --- 1 | 8160 | (0,1) --- 2 | 8128 | (0,2) --- 3 | 8096 | (0,3) --- 4 | 7936 | (0,4) --- 5 | 7904 | (0,5) --- 6 | 7872 | (0,6) --- 7 | 8064 | (0,7) --- 8 | 8032 | (0,8) --- 9 | 8000 | (0,9) --- 10 | 7968 | (0,10) - ----- Trigger comapction -delete from sbtest1 where id in (2); -VACUUM sbtest1; - -DROP TABLE sbtest1; -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/non_sorted_off_compact.inc \ No newline at end of file diff --git a/sql/non_sorted_off_compact_basic.sql b/sql/non_sorted_off_compact_basic.sql new file mode 100644 index 00000000..f9edfc46 --- /dev/null +++ b/sql/non_sorted_off_compact_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/non_sorted_off_compact.inc \ No newline at end of file diff --git a/sql/pg_tde_is_encrypted.inc b/sql/pg_tde_is_encrypted.inc new file mode 100644 index 00000000..ec3e3d9a --- /dev/null +++ b/sql/pg_tde_is_encrypted.inc @@ -0,0 +1,32 @@ +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_enc( + id SERIAL, + k INTEGER DEFAULT '0' NOT NULL, + PRIMARY KEY (id) + ) USING :tde_am; + +CREATE TABLE test_norm( + id SERIAL, + k INTEGER DEFAULT '0' NOT NULL, + PRIMARY KEY (id) + ) USING heap; + +SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE relname = 'test_enc'; +SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE relname = 'test_norm'; + +SELECT pg_tde_is_encrypted('test_enc'); +SELECT pg_tde_is_encrypted('test_norm'); + +SELECT key_provider_id, key_provider_name, principal_key_name + FROM pg_tde_principal_key_info(); + +DROP TABLE test_enc; +DROP TABLE test_norm; + +DROP EXTENSION pg_tde; diff --git a/sql/pg_tde_is_encrypted.sql b/sql/pg_tde_is_encrypted.sql index 60e6a817..c464a316 100644 --- a/sql/pg_tde_is_encrypted.sql +++ b/sql/pg_tde_is_encrypted.sql @@ -1,32 +1,2 @@ -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_enc( - id SERIAL, - k INTEGER DEFAULT '0' NOT NULL, - PRIMARY KEY (id) - ) USING tde_heap_basic; - -CREATE TABLE test_norm( - id SERIAL, - k INTEGER DEFAULT '0' NOT NULL, - PRIMARY KEY (id) - ) USING heap; - -SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE relname = 'test_enc'; -SELECT amname FROM pg_class INNER JOIN pg_am ON pg_am.oid = pg_class.relam WHERE relname = 'test_norm'; - -SELECT pg_tde_is_encrypted('test_enc'); -SELECT pg_tde_is_encrypted('test_norm'); - -SELECT key_provider_id, key_provider_name, principal_key_name - FROM pg_tde_principal_key_info(); - -DROP TABLE test_enc; -DROP TABLE test_norm; - -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/pg_tde_is_encrypted.inc \ No newline at end of file diff --git a/sql/pg_tde_is_encrypted_basic.sql b/sql/pg_tde_is_encrypted_basic.sql new file mode 100644 index 00000000..e260192c --- /dev/null +++ b/sql/pg_tde_is_encrypted_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/pg_tde_is_encrypted.inc \ No newline at end of file diff --git a/sql/test_issue_153_fix.inc b/sql/test_issue_153_fix.inc new file mode 100644 index 00000000..72eb4497 --- /dev/null +++ b/sql/test_issue_153_fix.inc @@ -0,0 +1,486 @@ +CREATE EXTENSION pg_tde; +SET datestyle TO 'iso, dmy'; + +SELECT * FROM pg_tde_principal_key_info(); + +SELECT pg_tde_add_key_provider_file('file-ring','/tmp/pg_tde_test_keyring.per'); +SELECT pg_tde_set_principal_key('test-db-principal-key','file-ring'); + +-- +-- Script that creates the 'sample' tde encrypted tables, views +-- functions, triggers, etc. +-- +-- Start new transaction - commit all or nothing +-- +BEGIN; +-- +-- Create and load tables used in the documentation examples. +-- +-- Create the 'dept' table +-- +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 :tde_am; +-- +-- Create the 'emp' table +-- +CREATE TABLE emp ( + empno NUMERIC(4) NOT NULL CONSTRAINT emp_pk PRIMARY KEY, + ename VARCHAR(10), + job VARCHAR(9), + mgr NUMERIC(4), + hiredate DATE, + sal NUMERIC(7,2) CONSTRAINT emp_sal_ck CHECK (sal > 0), + comm NUMERIC(7,2), + deptno NUMERIC(2) CONSTRAINT emp_ref_dept_fk + REFERENCES dept(deptno) +)using :tde_am; +-- +-- Create the 'jobhist' table +-- +CREATE TABLE jobhist ( + empno NUMERIC(4) NOT NULL, + startdate TIMESTAMP(0) NOT NULL, + enddate TIMESTAMP(0), + job VARCHAR(9), + sal NUMERIC(7,2), + comm NUMERIC(7,2), + deptno NUMERIC(2), + chgdesc VARCHAR(80), + CONSTRAINT jobhist_pk PRIMARY KEY (empno, startdate), + CONSTRAINT jobhist_ref_emp_fk FOREIGN KEY (empno) + REFERENCES emp(empno) ON DELETE CASCADE, + CONSTRAINT jobhist_ref_dept_fk FOREIGN KEY (deptno) + REFERENCES dept (deptno) ON DELETE SET NULL, + CONSTRAINT jobhist_date_chk CHECK (startdate <= enddate) +)using :tde_am; +-- +-- Create the 'salesemp' view +-- +CREATE OR REPLACE VIEW salesemp AS + SELECT empno, ename, hiredate, sal, comm FROM emp WHERE job = 'SALESMAN'; +-- +-- Sequence to generate values for function 'new_empno'. +-- +CREATE SEQUENCE next_empno START WITH 8000 INCREMENT BY 1; +-- +-- Issue PUBLIC grants +-- +GRANT ALL ON emp TO PUBLIC; +GRANT ALL ON dept TO PUBLIC; +GRANT ALL ON jobhist TO PUBLIC; +GRANT ALL ON salesemp TO PUBLIC; +GRANT ALL ON next_empno TO PUBLIC; +-- +-- Load the 'dept' table +-- +INSERT INTO dept VALUES (10,'ACCOUNTING','NEW YORK'); +INSERT INTO dept VALUES (20,'RESEARCH','DALLAS'); +INSERT INTO dept VALUES (30,'SALES','CHICAGO'); +INSERT INTO dept VALUES (40,'OPERATIONS','BOSTON'); +-- +-- Load the 'emp' table +-- +INSERT INTO emp VALUES (7369,'SMITH','CLERK',7902,'17-DEC-80',800,NULL,20); +INSERT INTO emp VALUES (7499,'ALLEN','SALESMAN',7698,'20-FEB-81',1600,300,30); +INSERT INTO emp VALUES (7521,'WARD','SALESMAN',7698,'22-FEB-81',1250,500,30); +INSERT INTO emp VALUES (7566,'JONES','MANAGER',7839,'02-APR-81',2975,NULL,20); +INSERT INTO emp VALUES (7654,'MARTIN','SALESMAN',7698,'28-SEP-81',1250,1400,30); +INSERT INTO emp VALUES (7698,'BLAKE','MANAGER',7839,'01-MAY-81',2850,NULL,30); +INSERT INTO emp VALUES (7782,'CLARK','MANAGER',7839,'09-JUN-81',2450,NULL,10); +INSERT INTO emp VALUES (7788,'SCOTT','ANALYST',7566,'19-APR-87',3000,NULL,20); +INSERT INTO emp VALUES (7839,'KING','PRESIDENT',NULL,'17-NOV-81',5000,NULL,10); +INSERT INTO emp VALUES (7844,'TURNER','SALESMAN',7698,'08-SEP-81',1500,0,30); +INSERT INTO emp VALUES (7876,'ADAMS','CLERK',7788,'23-MAY-87',1100,NULL,20); +INSERT INTO emp VALUES (7900,'JAMES','CLERK',7698,'03-DEC-81',950,NULL,30); +INSERT INTO emp VALUES (7902,'FORD','ANALYST',7566,'03-DEC-81',3000,NULL,20); +INSERT INTO emp VALUES (7934,'MILLER','CLERK',7782,'23-JAN-82',1300,NULL,10); +-- +-- Load the 'jobhist' table +-- +INSERT INTO jobhist VALUES (7369,'17-DEC-80',NULL,'CLERK',800,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7499,'20-FEB-81',NULL,'SALESMAN',1600,300,30,'New Hire'); +INSERT INTO jobhist VALUES (7521,'22-FEB-81',NULL,'SALESMAN',1250,500,30,'New Hire'); +INSERT INTO jobhist VALUES (7566,'02-APR-81',NULL,'MANAGER',2975,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7654,'28-SEP-81',NULL,'SALESMAN',1250,1400,30,'New Hire'); +INSERT INTO jobhist VALUES (7698,'01-MAY-81',NULL,'MANAGER',2850,NULL,30,'New Hire'); +INSERT INTO jobhist VALUES (7782,'09-JUN-81',NULL,'MANAGER',2450,NULL,10,'New Hire'); +INSERT INTO jobhist VALUES (7788,'19-APR-87','12-APR-88','CLERK',1000,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7788,'13-APR-88','04-MAY-89','CLERK',1040,NULL,20,'Raise'); +INSERT INTO jobhist VALUES (7788,'05-MAY-90',NULL,'ANALYST',3000,NULL,20,'Promoted to Analyst'); +INSERT INTO jobhist VALUES (7839,'17-NOV-81',NULL,'PRESIDENT',5000,NULL,10,'New Hire'); +INSERT INTO jobhist VALUES (7844,'08-SEP-81',NULL,'SALESMAN',1500,0,30,'New Hire'); +INSERT INTO jobhist VALUES (7876,'23-MAY-87',NULL,'CLERK',1100,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7900,'03-DEC-81','14-JAN-83','CLERK',950,NULL,10,'New Hire'); +INSERT INTO jobhist VALUES (7900,'15-JAN-83',NULL,'CLERK',950,NULL,30,'Changed to Dept 30'); +INSERT INTO jobhist VALUES (7902,'03-DEC-81',NULL,'ANALYST',3000,NULL,20,'New Hire'); +INSERT INTO jobhist VALUES (7934,'23-JAN-82',NULL,'CLERK',1300,NULL,10,'New Hire'); +-- +-- Populate statistics table and view (pg_statistic/pg_stats) +-- +ANALYZE dept; +ANALYZE emp; +ANALYZE jobhist; +-- +-- Function that lists all employees' numbers and names +-- from the 'emp' table using a cursor. +-- +CREATE OR REPLACE FUNCTION list_emp() RETURNS VOID +AS $$ +DECLARE + v_empno NUMERIC(4); + v_ename VARCHAR(10); + emp_cur CURSOR FOR + SELECT empno, ename FROM emp ORDER BY empno; +BEGIN + OPEN emp_cur; + RAISE INFO 'EMPNO ENAME'; + RAISE INFO '----- -------'; + LOOP + FETCH emp_cur INTO v_empno, v_ename; + EXIT WHEN NOT FOUND; + RAISE INFO '% %', v_empno, v_ename; + END LOOP; + CLOSE emp_cur; + RETURN; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function that selects an employee row given the employee +-- number and displays certain columns. +-- +CREATE OR REPLACE FUNCTION select_emp ( + p_empno NUMERIC +) RETURNS VOID +AS $$ +DECLARE + v_ename emp.ename%TYPE; + v_hiredate emp.hiredate%TYPE; + v_sal emp.sal%TYPE; + v_comm emp.comm%TYPE; + v_dname dept.dname%TYPE; + v_disp_date VARCHAR(10); +BEGIN + SELECT INTO + v_ename, v_hiredate, v_sal, v_comm, v_dname + ename, hiredate, sal, COALESCE(comm, 0), dname + FROM emp e, dept d + WHERE empno = p_empno + AND e.deptno = d.deptno; + IF NOT FOUND THEN + RAISE INFO 'Employee % not found', p_empno; + RETURN; + END IF; + v_disp_date := TO_CHAR(v_hiredate, 'MM/DD/YYYY'); + RAISE INFO 'Number : %', p_empno; + RAISE INFO 'Name : %', v_ename; + RAISE INFO 'Hire Date : %', v_disp_date; + RAISE INFO 'Salary : %', v_sal; + RAISE INFO 'Commission: %', v_comm; + RAISE INFO 'Department: %', v_dname; + RETURN; +EXCEPTION + WHEN OTHERS THEN + RAISE INFO 'The following is SQLERRM : %', SQLERRM; + RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; + RETURN; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- A RECORD type used to format the return value of +-- function, 'emp_query'. +-- +CREATE TYPE emp_query_type AS ( + empno NUMERIC, + ename VARCHAR(10), + job VARCHAR(9), + hiredate DATE, + sal NUMERIC +); +-- +-- Function that queries the 'emp' table based on +-- department number and employee number or name. Returns +-- employee number and name as INOUT parameters and job, +-- hire date, and salary as OUT parameters. These are +-- returned in the form of a record defined by +-- RECORD type, 'emp_query_type'. +-- +CREATE OR REPLACE FUNCTION emp_query ( + IN p_deptno NUMERIC, + INOUT p_empno NUMERIC, + INOUT p_ename VARCHAR, + OUT p_job VARCHAR, + OUT p_hiredate DATE, + OUT p_sal NUMERIC +) +AS $$ +BEGIN + SELECT INTO + p_empno, p_ename, p_job, p_hiredate, p_sal + empno, ename, job, hiredate, sal + FROM emp + WHERE deptno = p_deptno + AND (empno = p_empno + OR ename = UPPER(p_ename)); +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function to call 'emp_query_caller' with IN and INOUT +-- parameters. Displays the results received from INOUT and +-- OUT parameters. +-- +CREATE OR REPLACE FUNCTION emp_query_caller() RETURNS VOID +AS $$ +DECLARE + v_deptno NUMERIC; + v_empno NUMERIC; + v_ename VARCHAR; + v_rows INTEGER; + r_emp_query EMP_QUERY_TYPE; +BEGIN + v_deptno := 30; + v_empno := 0; + v_ename := 'Martin'; + r_emp_query := emp_query(v_deptno, v_empno, v_ename); + RAISE INFO 'Department : %', v_deptno; + RAISE INFO 'Employee No: %', (r_emp_query).empno; + RAISE INFO 'Name : %', (r_emp_query).ename; + RAISE INFO 'Job : %', (r_emp_query).job; + RAISE INFO 'Hire Date : %', (r_emp_query).hiredate; + RAISE INFO 'Salary : %', (r_emp_query).sal; + RETURN; +EXCEPTION + WHEN OTHERS THEN + RAISE INFO 'The following is SQLERRM : %', SQLERRM; + RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; + RETURN; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function to compute yearly compensation based on semimonthly +-- salary. +-- +CREATE OR REPLACE FUNCTION emp_comp ( + p_sal NUMERIC, + p_comm NUMERIC +) RETURNS NUMERIC +AS $$ +BEGIN + RETURN (p_sal + COALESCE(p_comm, 0)) * 24; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function that gets the next number from sequence, 'next_empno', +-- and ensures it is not already in use as an employee number. +-- +CREATE OR REPLACE FUNCTION new_empno() RETURNS INTEGER +AS $$ +DECLARE + v_cnt INTEGER := 1; + v_new_empno INTEGER; +BEGIN + WHILE v_cnt > 0 LOOP + SELECT INTO v_new_empno nextval('next_empno'); + SELECT INTO v_cnt COUNT(*) FROM emp WHERE empno = v_new_empno; + END LOOP; + RETURN v_new_empno; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function that adds a new clerk to table 'emp'. +-- +CREATE OR REPLACE FUNCTION hire_clerk ( + p_ename VARCHAR, + p_deptno NUMERIC +) RETURNS NUMERIC +AS $$ +DECLARE + v_empno NUMERIC(4); + v_ename VARCHAR(10); + v_job VARCHAR(9); + v_mgr NUMERIC(4); + v_hiredate DATE; + v_sal NUMERIC(7,2); + v_comm NUMERIC(7,2); + v_deptno NUMERIC(2); +BEGIN + v_empno := new_empno(); + INSERT INTO emp VALUES (v_empno, p_ename, 'CLERK', 7782, + CURRENT_DATE, 950.00, NULL, p_deptno); + SELECT INTO + v_empno, v_ename, v_job, v_mgr, v_hiredate, v_sal, v_comm, v_deptno + empno, ename, job, mgr, hiredate, sal, comm, deptno + FROM emp WHERE empno = v_empno; + RAISE INFO 'Department : %', v_deptno; + RAISE INFO 'Employee No: %', v_empno; + RAISE INFO 'Name : %', v_ename; + RAISE INFO 'Job : %', v_job; + RAISE INFO 'Manager : %', v_mgr; + RAISE INFO 'Hire Date : %', v_hiredate; + RAISE INFO 'Salary : %', v_sal; + RAISE INFO 'Commission : %', v_comm; + RETURN v_empno; +EXCEPTION + WHEN OTHERS THEN + RAISE INFO 'The following is SQLERRM : %', SQLERRM; + RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; + RETURN -1; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Function that adds a new salesman to table 'emp'. +-- +CREATE OR REPLACE FUNCTION hire_salesman ( + p_ename VARCHAR, + p_sal NUMERIC, + p_comm NUMERIC +) RETURNS NUMERIC +AS $$ +DECLARE + v_empno NUMERIC(4); + v_ename VARCHAR(10); + v_job VARCHAR(9); + v_mgr NUMERIC(4); + v_hiredate DATE; + v_sal NUMERIC(7,2); + v_comm NUMERIC(7,2); + v_deptno NUMERIC(2); +BEGIN + v_empno := new_empno(); + INSERT INTO emp VALUES (v_empno, p_ename, 'SALESMAN', 7698, + CURRENT_DATE, p_sal, p_comm, 30); + SELECT INTO + v_empno, v_ename, v_job, v_mgr, v_hiredate, v_sal, v_comm, v_deptno + empno, ename, job, mgr, hiredate, sal, comm, deptno + FROM emp WHERE empno = v_empno; + RAISE INFO 'Department : %', v_deptno; + RAISE INFO 'Employee No: %', v_empno; + RAISE INFO 'Name : %', v_ename; + RAISE INFO 'Job : %', v_job; + RAISE INFO 'Manager : %', v_mgr; + RAISE INFO 'Hire Date : %', v_hiredate; + RAISE INFO 'Salary : %', v_sal; + RAISE INFO 'Commission : %', v_comm; + RETURN v_empno; +EXCEPTION + WHEN OTHERS THEN + RAISE INFO 'The following is SQLERRM : %', SQLERRM; + RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; + RETURN -1; +END; +$$ LANGUAGE 'plpgsql'; +-- +-- Rule to INSERT into view 'salesemp' +-- +CREATE OR REPLACE RULE salesemp_i AS ON INSERT TO salesemp +DO INSTEAD + INSERT INTO emp VALUES (NEW.empno, NEW.ename, 'SALESMAN', 7698, + NEW.hiredate, NEW.sal, NEW.comm, 30); +-- +-- Rule to UPDATE view 'salesemp' +-- +CREATE OR REPLACE RULE salesemp_u AS ON UPDATE TO salesemp +DO INSTEAD + UPDATE emp SET empno = NEW.empno, + ename = NEW.ename, + hiredate = NEW.hiredate, + sal = NEW.sal, + comm = NEW.comm + WHERE empno = OLD.empno; +-- +-- Rule to DELETE from view 'salesemp' +-- +CREATE OR REPLACE RULE salesemp_d AS ON DELETE TO salesemp +DO INSTEAD + DELETE FROM emp WHERE empno = OLD.empno; +-- +-- After statement-level trigger that displays a message after +-- an insert, update, or deletion to the 'emp' table. One message +-- per SQL command is displayed. +-- +CREATE OR REPLACE FUNCTION user_audit_trig() RETURNS TRIGGER +AS $$ +DECLARE + v_action VARCHAR(24); + v_text TEXT; +BEGIN + IF TG_OP = 'INSERT' THEN + v_action := ' added employee(s) on '; + ELSIF TG_OP = 'UPDATE' THEN + v_action := ' updated employee(s) on '; + ELSIF TG_OP = 'DELETE' THEN + v_action := ' deleted employee(s) on '; + END IF; +-- v_text := 'User ' || USER || v_action || CURRENT_DATE; Changing this as we need consistent output for regression + v_text := 'User ' || v_action ; + RAISE INFO ' %', v_text; + RETURN NULL; +END; +$$ LANGUAGE 'plpgsql'; +CREATE TRIGGER user_audit_trig + AFTER INSERT OR UPDATE OR DELETE ON emp + FOR EACH STATEMENT EXECUTE PROCEDURE user_audit_trig(); +-- +-- Before row-level trigger that displays employee number and +-- salary of an employee that is about to be added, updated, +-- or deleted in the 'emp' table. +-- +CREATE OR REPLACE FUNCTION emp_sal_trig() RETURNS TRIGGER +AS $$ +DECLARE + sal_diff NUMERIC(7,2); +BEGIN + IF TG_OP = 'INSERT' THEN + RAISE INFO 'Inserting employee %', NEW.empno; + RAISE INFO '..New salary: %', NEW.sal; + RETURN NEW; + END IF; + IF TG_OP = 'UPDATE' THEN + sal_diff := NEW.sal - OLD.sal; + RAISE INFO 'Updating employee %', OLD.empno; + RAISE INFO '..Old salary: %', OLD.sal; + RAISE INFO '..New salary: %', NEW.sal; + RAISE INFO '..Raise : %', sal_diff; + RETURN NEW; + END IF; + IF TG_OP = 'DELETE' THEN + RAISE INFO 'Deleting employee %', OLD.empno; + RAISE INFO '..Old salary: %', OLD.sal; + RETURN OLD; + END IF; +END; +$$ LANGUAGE 'plpgsql'; +CREATE TRIGGER emp_sal_trig + BEFORE DELETE OR INSERT OR UPDATE ON emp + FOR EACH ROW EXECUTE PROCEDURE emp_sal_trig(); +COMMIT; + +SELECT * FROM emp; +SELECT * FROM dept; +SELECT * FROM jobhist; + +-- Now test the crash fix +DELETE FROM emp WHERE empno = 7934; +DELETE FROM emp WHERE empno = 7698; +DELETE FROM emp WHERE empno = 7782; +DELETE FROM emp WHERE empno = 7788; +DELETE FROM emp WHERE empno = 7838; +DELETE FROM emp WHERE empno = 7900; +DELETE FROM emp WHERE empno = 7654; + +DELETE FROM dept WHERE deptno = 40; + +SELECT * FROM emp; +SELECT * FROM dept; +SELECT * FROM jobhist; + +DROP TABLE jobhist CASCADE; +DROP TABLE emp CASCADE; +DROP TABLE dept CASCADE; + +DROP SEQUENCE next_empno; +DROP TYPE emp_query_type; + +DROP EXTENSION pg_tde CASCADE; diff --git a/sql/test_issue_153_fix.sql b/sql/test_issue_153_fix.sql index 0dce687d..389e6701 100644 --- a/sql/test_issue_153_fix.sql +++ b/sql/test_issue_153_fix.sql @@ -1,483 +1,2 @@ -CREATE EXTENSION pg_tde; -SET datestyle TO 'iso, dmy'; - -SELECT * FROM pg_tde_principal_key_info(); - -SELECT pg_tde_add_key_provider_file('file-ring','/tmp/pg_tde_test_keyring.per'); -SELECT pg_tde_set_principal_key('test-db-principal-key','file-ring'); - --- --- Script that creates the 'sample' tde encrypted tables, views --- functions, triggers, etc. --- --- Start new transaction - commit all or nothing --- -BEGIN; --- --- Create and load tables used in the documentation examples. --- --- Create the 'dept' table --- -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 tde_heap_basic; --- --- Create the 'emp' table --- -CREATE TABLE emp ( - empno NUMERIC(4) NOT NULL CONSTRAINT emp_pk PRIMARY KEY, - ename VARCHAR(10), - job VARCHAR(9), - mgr NUMERIC(4), - hiredate DATE, - sal NUMERIC(7,2) CONSTRAINT emp_sal_ck CHECK (sal > 0), - comm NUMERIC(7,2), - deptno NUMERIC(2) CONSTRAINT emp_ref_dept_fk - REFERENCES dept(deptno) -)using tde_heap_basic; --- --- Create the 'jobhist' table --- -CREATE TABLE jobhist ( - empno NUMERIC(4) NOT NULL, - startdate TIMESTAMP(0) NOT NULL, - enddate TIMESTAMP(0), - job VARCHAR(9), - sal NUMERIC(7,2), - comm NUMERIC(7,2), - deptno NUMERIC(2), - chgdesc VARCHAR(80), - CONSTRAINT jobhist_pk PRIMARY KEY (empno, startdate), - CONSTRAINT jobhist_ref_emp_fk FOREIGN KEY (empno) - REFERENCES emp(empno) ON DELETE CASCADE, - CONSTRAINT jobhist_ref_dept_fk FOREIGN KEY (deptno) - REFERENCES dept (deptno) ON DELETE SET NULL, - CONSTRAINT jobhist_date_chk CHECK (startdate <= enddate) -)using tde_heap_basic; --- --- Create the 'salesemp' view --- -CREATE OR REPLACE VIEW salesemp AS - SELECT empno, ename, hiredate, sal, comm FROM emp WHERE job = 'SALESMAN'; --- --- Sequence to generate values for function 'new_empno'. --- -CREATE SEQUENCE next_empno START WITH 8000 INCREMENT BY 1; --- --- Issue PUBLIC grants --- -GRANT ALL ON emp TO PUBLIC; -GRANT ALL ON dept TO PUBLIC; -GRANT ALL ON jobhist TO PUBLIC; -GRANT ALL ON salesemp TO PUBLIC; -GRANT ALL ON next_empno TO PUBLIC; --- --- Load the 'dept' table --- -INSERT INTO dept VALUES (10,'ACCOUNTING','NEW YORK'); -INSERT INTO dept VALUES (20,'RESEARCH','DALLAS'); -INSERT INTO dept VALUES (30,'SALES','CHICAGO'); -INSERT INTO dept VALUES (40,'OPERATIONS','BOSTON'); --- --- Load the 'emp' table --- -INSERT INTO emp VALUES (7369,'SMITH','CLERK',7902,'17-DEC-80',800,NULL,20); -INSERT INTO emp VALUES (7499,'ALLEN','SALESMAN',7698,'20-FEB-81',1600,300,30); -INSERT INTO emp VALUES (7521,'WARD','SALESMAN',7698,'22-FEB-81',1250,500,30); -INSERT INTO emp VALUES (7566,'JONES','MANAGER',7839,'02-APR-81',2975,NULL,20); -INSERT INTO emp VALUES (7654,'MARTIN','SALESMAN',7698,'28-SEP-81',1250,1400,30); -INSERT INTO emp VALUES (7698,'BLAKE','MANAGER',7839,'01-MAY-81',2850,NULL,30); -INSERT INTO emp VALUES (7782,'CLARK','MANAGER',7839,'09-JUN-81',2450,NULL,10); -INSERT INTO emp VALUES (7788,'SCOTT','ANALYST',7566,'19-APR-87',3000,NULL,20); -INSERT INTO emp VALUES (7839,'KING','PRESIDENT',NULL,'17-NOV-81',5000,NULL,10); -INSERT INTO emp VALUES (7844,'TURNER','SALESMAN',7698,'08-SEP-81',1500,0,30); -INSERT INTO emp VALUES (7876,'ADAMS','CLERK',7788,'23-MAY-87',1100,NULL,20); -INSERT INTO emp VALUES (7900,'JAMES','CLERK',7698,'03-DEC-81',950,NULL,30); -INSERT INTO emp VALUES (7902,'FORD','ANALYST',7566,'03-DEC-81',3000,NULL,20); -INSERT INTO emp VALUES (7934,'MILLER','CLERK',7782,'23-JAN-82',1300,NULL,10); --- --- Load the 'jobhist' table --- -INSERT INTO jobhist VALUES (7369,'17-DEC-80',NULL,'CLERK',800,NULL,20,'New Hire'); -INSERT INTO jobhist VALUES (7499,'20-FEB-81',NULL,'SALESMAN',1600,300,30,'New Hire'); -INSERT INTO jobhist VALUES (7521,'22-FEB-81',NULL,'SALESMAN',1250,500,30,'New Hire'); -INSERT INTO jobhist VALUES (7566,'02-APR-81',NULL,'MANAGER',2975,NULL,20,'New Hire'); -INSERT INTO jobhist VALUES (7654,'28-SEP-81',NULL,'SALESMAN',1250,1400,30,'New Hire'); -INSERT INTO jobhist VALUES (7698,'01-MAY-81',NULL,'MANAGER',2850,NULL,30,'New Hire'); -INSERT INTO jobhist VALUES (7782,'09-JUN-81',NULL,'MANAGER',2450,NULL,10,'New Hire'); -INSERT INTO jobhist VALUES (7788,'19-APR-87','12-APR-88','CLERK',1000,NULL,20,'New Hire'); -INSERT INTO jobhist VALUES (7788,'13-APR-88','04-MAY-89','CLERK',1040,NULL,20,'Raise'); -INSERT INTO jobhist VALUES (7788,'05-MAY-90',NULL,'ANALYST',3000,NULL,20,'Promoted to Analyst'); -INSERT INTO jobhist VALUES (7839,'17-NOV-81',NULL,'PRESIDENT',5000,NULL,10,'New Hire'); -INSERT INTO jobhist VALUES (7844,'08-SEP-81',NULL,'SALESMAN',1500,0,30,'New Hire'); -INSERT INTO jobhist VALUES (7876,'23-MAY-87',NULL,'CLERK',1100,NULL,20,'New Hire'); -INSERT INTO jobhist VALUES (7900,'03-DEC-81','14-JAN-83','CLERK',950,NULL,10,'New Hire'); -INSERT INTO jobhist VALUES (7900,'15-JAN-83',NULL,'CLERK',950,NULL,30,'Changed to Dept 30'); -INSERT INTO jobhist VALUES (7902,'03-DEC-81',NULL,'ANALYST',3000,NULL,20,'New Hire'); -INSERT INTO jobhist VALUES (7934,'23-JAN-82',NULL,'CLERK',1300,NULL,10,'New Hire'); --- --- Populate statistics table and view (pg_statistic/pg_stats) --- -ANALYZE dept; -ANALYZE emp; -ANALYZE jobhist; --- --- Function that lists all employees' numbers and names --- from the 'emp' table using a cursor. --- -CREATE OR REPLACE FUNCTION list_emp() RETURNS VOID -AS $$ -DECLARE - v_empno NUMERIC(4); - v_ename VARCHAR(10); - emp_cur CURSOR FOR - SELECT empno, ename FROM emp ORDER BY empno; -BEGIN - OPEN emp_cur; - RAISE INFO 'EMPNO ENAME'; - RAISE INFO '----- -------'; - LOOP - FETCH emp_cur INTO v_empno, v_ename; - EXIT WHEN NOT FOUND; - RAISE INFO '% %', v_empno, v_ename; - END LOOP; - CLOSE emp_cur; - RETURN; -END; -$$ LANGUAGE 'plpgsql'; --- --- Function that selects an employee row given the employee --- number and displays certain columns. --- -CREATE OR REPLACE FUNCTION select_emp ( - p_empno NUMERIC -) RETURNS VOID -AS $$ -DECLARE - v_ename emp.ename%TYPE; - v_hiredate emp.hiredate%TYPE; - v_sal emp.sal%TYPE; - v_comm emp.comm%TYPE; - v_dname dept.dname%TYPE; - v_disp_date VARCHAR(10); -BEGIN - SELECT INTO - v_ename, v_hiredate, v_sal, v_comm, v_dname - ename, hiredate, sal, COALESCE(comm, 0), dname - FROM emp e, dept d - WHERE empno = p_empno - AND e.deptno = d.deptno; - IF NOT FOUND THEN - RAISE INFO 'Employee % not found', p_empno; - RETURN; - END IF; - v_disp_date := TO_CHAR(v_hiredate, 'MM/DD/YYYY'); - RAISE INFO 'Number : %', p_empno; - RAISE INFO 'Name : %', v_ename; - RAISE INFO 'Hire Date : %', v_disp_date; - RAISE INFO 'Salary : %', v_sal; - RAISE INFO 'Commission: %', v_comm; - RAISE INFO 'Department: %', v_dname; - RETURN; -EXCEPTION - WHEN OTHERS THEN - RAISE INFO 'The following is SQLERRM : %', SQLERRM; - RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; - RETURN; -END; -$$ LANGUAGE 'plpgsql'; --- --- A RECORD type used to format the return value of --- function, 'emp_query'. --- -CREATE TYPE emp_query_type AS ( - empno NUMERIC, - ename VARCHAR(10), - job VARCHAR(9), - hiredate DATE, - sal NUMERIC -); --- --- Function that queries the 'emp' table based on --- department number and employee number or name. Returns --- employee number and name as INOUT parameters and job, --- hire date, and salary as OUT parameters. These are --- returned in the form of a record defined by --- RECORD type, 'emp_query_type'. --- -CREATE OR REPLACE FUNCTION emp_query ( - IN p_deptno NUMERIC, - INOUT p_empno NUMERIC, - INOUT p_ename VARCHAR, - OUT p_job VARCHAR, - OUT p_hiredate DATE, - OUT p_sal NUMERIC -) -AS $$ -BEGIN - SELECT INTO - p_empno, p_ename, p_job, p_hiredate, p_sal - empno, ename, job, hiredate, sal - FROM emp - WHERE deptno = p_deptno - AND (empno = p_empno - OR ename = UPPER(p_ename)); -END; -$$ LANGUAGE 'plpgsql'; --- --- Function to call 'emp_query_caller' with IN and INOUT --- parameters. Displays the results received from INOUT and --- OUT parameters. --- -CREATE OR REPLACE FUNCTION emp_query_caller() RETURNS VOID -AS $$ -DECLARE - v_deptno NUMERIC; - v_empno NUMERIC; - v_ename VARCHAR; - v_rows INTEGER; - r_emp_query EMP_QUERY_TYPE; -BEGIN - v_deptno := 30; - v_empno := 0; - v_ename := 'Martin'; - r_emp_query := emp_query(v_deptno, v_empno, v_ename); - RAISE INFO 'Department : %', v_deptno; - RAISE INFO 'Employee No: %', (r_emp_query).empno; - RAISE INFO 'Name : %', (r_emp_query).ename; - RAISE INFO 'Job : %', (r_emp_query).job; - RAISE INFO 'Hire Date : %', (r_emp_query).hiredate; - RAISE INFO 'Salary : %', (r_emp_query).sal; - RETURN; -EXCEPTION - WHEN OTHERS THEN - RAISE INFO 'The following is SQLERRM : %', SQLERRM; - RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; - RETURN; -END; -$$ LANGUAGE 'plpgsql'; --- --- Function to compute yearly compensation based on semimonthly --- salary. --- -CREATE OR REPLACE FUNCTION emp_comp ( - p_sal NUMERIC, - p_comm NUMERIC -) RETURNS NUMERIC -AS $$ -BEGIN - RETURN (p_sal + COALESCE(p_comm, 0)) * 24; -END; -$$ LANGUAGE 'plpgsql'; --- --- Function that gets the next number from sequence, 'next_empno', --- and ensures it is not already in use as an employee number. --- -CREATE OR REPLACE FUNCTION new_empno() RETURNS INTEGER -AS $$ -DECLARE - v_cnt INTEGER := 1; - v_new_empno INTEGER; -BEGIN - WHILE v_cnt > 0 LOOP - SELECT INTO v_new_empno nextval('next_empno'); - SELECT INTO v_cnt COUNT(*) FROM emp WHERE empno = v_new_empno; - END LOOP; - RETURN v_new_empno; -END; -$$ LANGUAGE 'plpgsql'; --- --- Function that adds a new clerk to table 'emp'. --- -CREATE OR REPLACE FUNCTION hire_clerk ( - p_ename VARCHAR, - p_deptno NUMERIC -) RETURNS NUMERIC -AS $$ -DECLARE - v_empno NUMERIC(4); - v_ename VARCHAR(10); - v_job VARCHAR(9); - v_mgr NUMERIC(4); - v_hiredate DATE; - v_sal NUMERIC(7,2); - v_comm NUMERIC(7,2); - v_deptno NUMERIC(2); -BEGIN - v_empno := new_empno(); - INSERT INTO emp VALUES (v_empno, p_ename, 'CLERK', 7782, - CURRENT_DATE, 950.00, NULL, p_deptno); - SELECT INTO - v_empno, v_ename, v_job, v_mgr, v_hiredate, v_sal, v_comm, v_deptno - empno, ename, job, mgr, hiredate, sal, comm, deptno - FROM emp WHERE empno = v_empno; - RAISE INFO 'Department : %', v_deptno; - RAISE INFO 'Employee No: %', v_empno; - RAISE INFO 'Name : %', v_ename; - RAISE INFO 'Job : %', v_job; - RAISE INFO 'Manager : %', v_mgr; - RAISE INFO 'Hire Date : %', v_hiredate; - RAISE INFO 'Salary : %', v_sal; - RAISE INFO 'Commission : %', v_comm; - RETURN v_empno; -EXCEPTION - WHEN OTHERS THEN - RAISE INFO 'The following is SQLERRM : %', SQLERRM; - RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; - RETURN -1; -END; -$$ LANGUAGE 'plpgsql'; --- --- Function that adds a new salesman to table 'emp'. --- -CREATE OR REPLACE FUNCTION hire_salesman ( - p_ename VARCHAR, - p_sal NUMERIC, - p_comm NUMERIC -) RETURNS NUMERIC -AS $$ -DECLARE - v_empno NUMERIC(4); - v_ename VARCHAR(10); - v_job VARCHAR(9); - v_mgr NUMERIC(4); - v_hiredate DATE; - v_sal NUMERIC(7,2); - v_comm NUMERIC(7,2); - v_deptno NUMERIC(2); -BEGIN - v_empno := new_empno(); - INSERT INTO emp VALUES (v_empno, p_ename, 'SALESMAN', 7698, - CURRENT_DATE, p_sal, p_comm, 30); - SELECT INTO - v_empno, v_ename, v_job, v_mgr, v_hiredate, v_sal, v_comm, v_deptno - empno, ename, job, mgr, hiredate, sal, comm, deptno - FROM emp WHERE empno = v_empno; - RAISE INFO 'Department : %', v_deptno; - RAISE INFO 'Employee No: %', v_empno; - RAISE INFO 'Name : %', v_ename; - RAISE INFO 'Job : %', v_job; - RAISE INFO 'Manager : %', v_mgr; - RAISE INFO 'Hire Date : %', v_hiredate; - RAISE INFO 'Salary : %', v_sal; - RAISE INFO 'Commission : %', v_comm; - RETURN v_empno; -EXCEPTION - WHEN OTHERS THEN - RAISE INFO 'The following is SQLERRM : %', SQLERRM; - RAISE INFO 'The following is SQLSTATE: %', SQLSTATE; - RETURN -1; -END; -$$ LANGUAGE 'plpgsql'; --- --- Rule to INSERT into view 'salesemp' --- -CREATE OR REPLACE RULE salesemp_i AS ON INSERT TO salesemp -DO INSTEAD - INSERT INTO emp VALUES (NEW.empno, NEW.ename, 'SALESMAN', 7698, - NEW.hiredate, NEW.sal, NEW.comm, 30); --- --- Rule to UPDATE view 'salesemp' --- -CREATE OR REPLACE RULE salesemp_u AS ON UPDATE TO salesemp -DO INSTEAD - UPDATE emp SET empno = NEW.empno, - ename = NEW.ename, - hiredate = NEW.hiredate, - sal = NEW.sal, - comm = NEW.comm - WHERE empno = OLD.empno; --- --- Rule to DELETE from view 'salesemp' --- -CREATE OR REPLACE RULE salesemp_d AS ON DELETE TO salesemp -DO INSTEAD - DELETE FROM emp WHERE empno = OLD.empno; --- --- After statement-level trigger that displays a message after --- an insert, update, or deletion to the 'emp' table. One message --- per SQL command is displayed. --- -CREATE OR REPLACE FUNCTION user_audit_trig() RETURNS TRIGGER -AS $$ -DECLARE - v_action VARCHAR(24); - v_text TEXT; -BEGIN - IF TG_OP = 'INSERT' THEN - v_action := ' added employee(s) on '; - ELSIF TG_OP = 'UPDATE' THEN - v_action := ' updated employee(s) on '; - ELSIF TG_OP = 'DELETE' THEN - v_action := ' deleted employee(s) on '; - END IF; --- v_text := 'User ' || USER || v_action || CURRENT_DATE; Changing this as we need consistent output for regression - v_text := 'User ' || v_action ; - RAISE INFO ' %', v_text; - RETURN NULL; -END; -$$ LANGUAGE 'plpgsql'; -CREATE TRIGGER user_audit_trig - AFTER INSERT OR UPDATE OR DELETE ON emp - FOR EACH STATEMENT EXECUTE PROCEDURE user_audit_trig(); --- --- Before row-level trigger that displays employee number and --- salary of an employee that is about to be added, updated, --- or deleted in the 'emp' table. --- -CREATE OR REPLACE FUNCTION emp_sal_trig() RETURNS TRIGGER -AS $$ -DECLARE - sal_diff NUMERIC(7,2); -BEGIN - IF TG_OP = 'INSERT' THEN - RAISE INFO 'Inserting employee %', NEW.empno; - RAISE INFO '..New salary: %', NEW.sal; - RETURN NEW; - END IF; - IF TG_OP = 'UPDATE' THEN - sal_diff := NEW.sal - OLD.sal; - RAISE INFO 'Updating employee %', OLD.empno; - RAISE INFO '..Old salary: %', OLD.sal; - RAISE INFO '..New salary: %', NEW.sal; - RAISE INFO '..Raise : %', sal_diff; - RETURN NEW; - END IF; - IF TG_OP = 'DELETE' THEN - RAISE INFO 'Deleting employee %', OLD.empno; - RAISE INFO '..Old salary: %', OLD.sal; - RETURN OLD; - END IF; -END; -$$ LANGUAGE 'plpgsql'; -CREATE TRIGGER emp_sal_trig - BEFORE DELETE OR INSERT OR UPDATE ON emp - FOR EACH ROW EXECUTE PROCEDURE emp_sal_trig(); -COMMIT; - -SELECT * FROM emp; -SELECT * FROM dept; -SELECT * FROM jobhist; - --- Now test the crash fix -DELETE FROM emp WHERE empno = 7934; -DELETE FROM emp WHERE empno = 7698; -DELETE FROM emp WHERE empno = 7782; -DELETE FROM emp WHERE empno = 7788; -DELETE FROM emp WHERE empno = 7838; -DELETE FROM emp WHERE empno = 7900; -DELETE FROM emp WHERE empno = 7654; - -DELETE FROM dept WHERE deptno = 40; - -SELECT * FROM emp; -SELECT * FROM dept; -SELECT * FROM jobhist; - -DROP TABLE jobhist CASCADE; -DROP TABLE emp CASCADE; -DROP TABLE dept CASCADE; - -DROP EXTENSION pg_tde CASCADE; +\set tde_am tde_heap +\i sql/test_issue_153_fix.inc \ No newline at end of file diff --git a/sql/test_issue_153_fix_basic.sql b/sql/test_issue_153_fix_basic.sql new file mode 100644 index 00000000..8cca8508 --- /dev/null +++ b/sql/test_issue_153_fix_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/test_issue_153_fix.inc \ No newline at end of file diff --git a/sql/toast_decrypt.inc b/sql/toast_decrypt.inc new file mode 100644 index 00000000..b41a2731 --- /dev/null +++ b/sql/toast_decrypt.inc @@ -0,0 +1,12 @@ +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 :tde_am; +INSERT INTO src VALUES(repeat('abcdeF',1000)); +SELECT * FROM src; + +DROP TABLE src; + +DROP EXTENSION pg_tde; diff --git a/sql/toast_decrypt.sql b/sql/toast_decrypt.sql index ce9476a6..7b62e4f4 100644 --- a/sql/toast_decrypt.sql +++ b/sql/toast_decrypt.sql @@ -1,12 +1,2 @@ -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 tde_heap_basic; -INSERT INTO src VALUES(repeat('abcdeF',1000)); -SELECT * FROM src; - -DROP TABLE src; - -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/toast_decrypt.inc \ No newline at end of file diff --git a/sql/toast_decrypt_basic.sql b/sql/toast_decrypt_basic.sql new file mode 100644 index 00000000..6f4e8471 --- /dev/null +++ b/sql/toast_decrypt_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/toast_decrypt.inc \ No newline at end of file diff --git a/sql/toast_extended_storage.inc b/sql/toast_extended_storage.inc new file mode 100644 index 00000000..67c4aaab --- /dev/null +++ b/sql/toast_extended_storage.inc @@ -0,0 +1,49 @@ +-- test https://github.com/Percona-Lab/pg_tde/issues/63 +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 TEMP TABLE src (f1 text) USING :tde_am; +-- Crash on INSERT +INSERT INTO src +VALUES('0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454'); +SELECT * FROM src; + +DROP TABLE src; + +CREATE TABLE src2 (f1 TEXT) USING :tde_am; +INSERT INTO src2 +VALUES('0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454'); +SELECT * FROM src2; + +DROP TABLE src2; + +-- https://github.com/Percona-Lab/pg_tde/issues/82 +CREATE TABLE indtoasttest(descr text, cnt int DEFAULT 0, f1 text, f2 text) using :tde_am; + +INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-compressed', repeat('1234567890',1000), repeat('1234567890',1000)); +INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-toasted', repeat('1234567890',30000), repeat('1234567890',50000)); +INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-compressed,one-null', NULL, repeat('1234567890',1000)); +INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-toasted,one-null', NULL, repeat('1234567890',50000)); + +UPDATE indtoasttest SET cnt = cnt +1 RETURNING substring(indtoasttest::text, 1, 200); +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1 RETURNING substring(indtoasttest::text, 1, 200); +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(indtoasttest::text, 1, 200); +UPDATE indtoasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(indtoasttest::text, 1, 200); +UPDATE indtoasttest SET f2 = '+'||f2||'-' ; + +DROP TABLE indtoasttest; + +-- Test substr with toasted externalized bytea values +CREATE TABLE toasttest(t bytea STORAGE EXTERNAL) using :tde_am; +INSERT INTO toasttest VALUES (decode(repeat('1234567890',10000), 'escape')); + +SET bytea_output = 'escape'; +SELECT substring(t, 1, 10) FROM toasttest; +SELECT substring(t, 50001, 10) FROM toasttest; +SELECT substring(t, 99991) FROM toasttest; + +DROP TABLE toasttest; + +DROP EXTENSION pg_tde; diff --git a/sql/toast_extended_storage.sql b/sql/toast_extended_storage.sql index 86aba3e4..5951dc64 100644 --- a/sql/toast_extended_storage.sql +++ b/sql/toast_extended_storage.sql @@ -1,49 +1,2 @@ --- test https://github.com/Percona-Lab/pg_tde/issues/63 -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 TEMP TABLE src (f1 text) USING tde_heap_basic; --- Crash on INSERT -INSERT INTO src -VALUES('0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454'); -SELECT * FROM src; - -DROP TABLE src; - -CREATE TABLE src2 (f1 TEXT) USING tde_heap_basic; -INSERT INTO src2 -VALUES('0.55859909742449630.44658969494913570.54075930161272720.173117157913014630.61483029376206380.65764492874377220.341317552838924730.367982528684053230.175345977931963270.168412839608874880.00154803678245296620.82706532396263290.74748634462447190.090831815264683650.390919315685386960.99951082699941550.9977981693287330.6988579613645320.310754450662202640.90325242484683190.75374800591547490.26680100643896230.55751915566773990.57902456214791110.36183153154123460.63524053266029830.78389378855711180.19584445869629020.199333924650425760.82155191593829560.7371944732869880.183910466357891660.0147813222233452720.3747022411129810.49101561236565550.95483453706535880.35594888092451550.43381965349401440.46361549602747920.50604155870332760.86586716524835540.63478889357891990.77509493569207090.86665305443338790.64852060828658550.50280760242256580.21800585609741340.096173392125813220.0261400320036884180.33800342276157360.485498510272187160.69492885593869610.14719438590370170.57633710730539910.6854376608363930.162803430883830650.28902094699378880.93884121928877070.4124819510126210.69895400258256470.61386295568035320.019902272612943640.85235316437206570.0940431968488260.272794218757168140.61549039934229780.422575394607501930.67002314675933960.465323258961145570.163191821055387760.0126060416991824460.40893698240906830.31893797439819460.15469713662310670.55528689194077320.66788769570588440.71025660771475390.38117379415620990.0220335908759561330.107673951160519810.71950609969184590.54341042925206180.024053937929693570.74203099973156790.035064651259838710.86887319172737380.335093303911782050.7483180995321150.97612135845236070.084654394261215680.76508793255901520.68191364158327270.64505339286832350.448618338317764650.335092422718133550.55149498651635520.9413160253094210.9168195414285170.98684856309613790.60400653549636750.85646368669913330.58837858335250370.9799739681795840.48079146876587030.218616079813109820.9302335200895790.4780449500011730.424050492872935840.063479437634682330.98094393207488960.335273138834828230.48560551700566790.139203310225991970.62595627061874380.71122415168232940.152848330691444540.89199132936279750.27800941859127290.95439564372772280.84837555269067490.75100083734460510.362767538265398760.235976384421268110.61187422491548470.9495830853409060.89514971758309940.26872924068443680.74626444803809160.139587450203541460.302395254482703770.78411327172089250.38966191620694680.198917136896949340.64377926785777470.293260719678428260.44648764937475450.37420519795286180.92220518748025750.0073108929093146370.93143459249930790.61565949670551650.95409849589104280.70559701135921380.80911223952124960.78688763724234260.0143429787186462040.47314838377612680.220085013432371750.74895079799389160.34241785580036590.377476662711184960.55856596798903090.72300200663394070.93372512510565420.48213601319131170.98122442024471220.346628953420145660.74820202768550950.36134870838736320.53096217018068880.91813333111021930.16912775074741670.37503790891484610.9532471869686030.125924225709406650.481359293779658250.49808987733380960.292530386328931250.87891128070888010.190872215535672130.8880398891158570.312849610687170760.83382258936561130.88683286703304340.54819728672968980.55198306885689990.94518489093830830.82370179536934040.39422249429194810.88920643110698830.100781813305392380.156896688655811630.176728786940858470.418953555096873260.49179322828441930.6482244643731250.50630017133792920.96824089562929780.48649962422895390.224128640753047840.65318604085187480.0277597024087572470.269592268429819760.078229807252904630.12959218454427490.76024146340840760.53005245019718040.208874546770384530.55257426353213910.5937585938899110.80002298982932360.176800500254526760.80793461098073150.73215202402765760.89330730727462560.0317516822834684740.160090174689148550.51532774354845980.70921991745912830.138735433408188950.57752467002560.403150487295366840.40749394747573110.66251587358165880.35063881167575020.9599596099677250.445932818660210060.287245889223862740.8257369856611840.70400052356170930.30353378134511090.393039351875958730.362370380599912560.388471172945746850.365472631694610860.54200112719970450.314895026881156560.95277396387790940.65717791763685370.190656024871326270.97805817247168080.82424428074710860.90092118424733720.87158730600807480.92974051731450720.65817976419118640.53290189661821690.39921764010135830.437371129418732130.54880953388242660.68460757473144040.79353167169486190.76018043252842250.86776754557471510.154812009703990.43513822113626890.27237032901240730.319453093144346440.71805913046337030.36559454463692820.744352905917590.104333806358574810.436173275549234240.32527834767622110.267847234273361550.57084377650998520.104177751155159590.33089495199934650.63225317492672660.74723541122747060.494332985433825640.69567541211602820.25175339015164710.63155410904344930.85261979776189520.213947072087478540.116500925662627930.0179480357425600980.174284134096331030.033176454827700930.74261681843758920.87530858693430760.7475446944895350.94056404731337580.63391517780623240.19782412222947120.294298476924694350.078590228180988490.94544551154725580.309740808480930330.58151178351223430.54279813541957210.15899402561489050.220517609114043940.87020048815449540.453872032347550470.152859165096062450.61074979931058640.144888238626858620.99041812532331260.54156908920795370.04165813661344120.52106850675663050.70979862294325490.309423192717801940.104759377449733520.100241108871801820.57623244475946890.89685838695066630.090179331203737560.459757127631922560.91055597599411020.062652892151061620.3957549469001820.20930474506823660.100267794939050910.088485558336314440.48902516637998940.28887564989109650.57153819581046220.55892890575540880.0560891728851322660.7344804208424660.148907757489083360.76957143272000830.154868098317315180.81159315420869630.44133537433804590.37278761862448160.60591287657588920.063302672508175340.053306086212437710.46220266749901540.128985239698984570.85633874521839260.067996420502524520.0284232841636806730.29836261032579190.39154315471529990.222267341457545120.263539428271130970.62778609185857850.60776229183174580.77080401415726360.265763132444866160.242504428121770750.96329054224533460.97762540147621140.89131212200180630.60898765857225670.67429141511349160.60523963808397350.246266851399476350.403945416969184070.57685155716036270.0057898216945795330.461298136292183970.109095726379537130.64108109155126210.52729468037839820.429250823991674140.0461429365458496670.78701739169339650.486744604809777660.67408253928102060.245631501779759680.97499790194550550.85293571370140420.67698635446231050.412067250333180370.97482534007991070.76365268652784390.60843248596980670.325432520881775430.53749708721485770.355229569948804170.42115127519206050.90879701384812690.32908069089866520.33023841256557950.77756498707736620.18756301506162210.52706375281054750.73173435691423450.00241391828323744840.251433710269416850.80702906815626530.2638196814093130.38270953033148090.118473162701491220.83001470395355550.85223182629553640.033022814590289110.9965499529438340.67054036405993680.68755543955027210.208611605942402580.87914323433706860.165905178807298270.182595893077931450.21513996146425130.089552155874880410.314779054365917240.79612735879776710.42602975925430940.90633195438770240.74836824537341370.36821330725304760.56473312465489340.301758528313859740.257557183799996150.52175015048395750.34437531739733030.12803644333956510.58152344614280870.81024139869387970.92151339563803970.9419794316846240.14518928800493570.51509222411904320.88433839509613280.7043713958444770.57844071347444470.82142787881797560.361182666192116030.401080783630624940.00360516170878111280.50992311937912050.48592820943372070.049224043025032140.33757691441461060.63122825460216840.217143314204432780.075532976986801610.88692098500172280.3939705645440310.76987032912433540.42978415521497990.39660803881931270.195834795264905770.68952908520953130.64390116049496760.283061853701023660.75959274948839410.115863202690749350.62027371986814180.61505352340231130.475082412351449430.055534471845069430.36852323404335950.94079455836769110.378262424582432640.76888703633139490.40316203479605360.0618512243941680140.410221022783130660.166202503621515780.77605355493809180.0238360080265551670.58146598984882970.5724057644768230.98836532669660770.317241629857772930.6076338271910620.169824116669973660.235329859686410180.89812158420926110.91911037909535540.89566442642084640.96017124223141990.136805494040843630.29922151617189940.084129285069876050.142322258309026670.331958796010522360.77195152983670480.28065178532813340.34929560908190840.36412919524028410.20623600253013440.98231558166537920.109411601043275520.420751361534868140.25398188076793350.73210274229522860.35523027622504390.56017854324865990.035906773682321980.458594285249765750.429186356476820130.29376322396731270.28620072549417430.81755145809453760.7648289441362690.107720329547366770.312164929559409550.98654986130775990.240209261278337750.71102263928954420.025219566132762550.347013891045537150.94806739585158150.033290356497574390.37228908363793820.50679372610177960.42006058974112090.88192213558663360.9608866193956920.58474979630793890.042227994641621080.0252720756429745120.33045360424017420.073186012566550.51188944632792530.88119389097831840.62135241206234930.273771472557474250.0521672174874079350.221245186496503930.24687691656478240.147320124390813770.190792370597731240.69355122216463560.086056706966926690.82310172842897770.32887183166387790.6268252443986260.63323066430150310.303226019288216350.64636790914559760.62172489249387520.8906208337615320.53724750507000230.91256347427921550.105726509492241270.234224425962393120.59141778297622790.46983523949980890.65062949305891320.8405190258421960.204788284824616750.48877759819797960.206091190201679760.41069264808958360.81763373366381420.5084606548014940.0287355170596057530.262703166966945960.69636550335784660.296805576443307740.33823549021164090.55206402049435740.048599135591500310.180280693104786230.39809430050236940.85783149110582780.59856943049089170.73083898331960610.39115620101771540.97510738320707180.49832685663478360.83969482573285580.81263903325462290.175900457406543480.25362717481604390.4086176886942350.94859118189175340.72728673793949540.86000363710178670.72991922087398780.144146361114049880.137307127131112820.95837138870799480.30464143430607680.60549385299218940.25589131494997110.202879664003428270.64344113573378990.086028307747932020.2162077473738040.133179303093533540.63276918975496830.223612877608330820.090979780540967560.47248850309212910.42497534390669990.54265927351340330.78026452844579630.47617580145072560.52025111760824120.455497539401685140.84750943622097340.209294366697259760.16819707470244150.48476513425161640.57983872920100280.474382158984199660.254874470253334540.52585380692307830.25590342041928180.53444932407398720.2467763723907610.3873669403624920.95841821859258450.63836466385929370.416529458114704760.5385547032325060.55113853218554860.78536228490082220.0423541444084443160.61104340251074580.25024327522581060.8968304236004010.91708646839265830.89986432305046280.244670466125564980.91990842319302280.61089716025359750.64165798316833510.150486815632834280.302656874235680550.77299688751490070.06442465730779690.170187735350043170.96092925877515610.073569446403604080.71566156948489470.41688213041932330.106009564676631920.77772746604669680.40420283080528850.53720781701369490.80248755232571470.9067255270263550.66110396909102160.74198258125295680.100036449910233530.53372181079229670.195456372245575770.36778542134467540.52677015412378260.0046158429404739020.3573129258646650.70710429286692180.7590453334083040.080069319066503390.13645177032718280.75294433071330950.30623120284457350.124939879649973660.74666367922779210.27283546392438620.0249682284310672740.231418455110220080.18240016991642350.94835900483274790.8185585957416810.88227138571932670.5763656518909330.041425729831589430.156495692422954140.383434359444130960.33191761135630470.73429826375351340.70196127414686390.4176693994178480.51798783115477140.133000437723328920.99183781995588590.62038035159226260.70230630180648260.48149294093471930.071032611375611680.316692539064261650.72180762218821220.33585192016184260.2450197225961710.381209315857462760.86065931604870150.20926776488396760.150989235950110820.034414934269560330.202697791930762650.256674769360348830.83792620592924920.115132877456959550.99550359751178990.96660022265996550.215495131403689920.56092083988834850.5414241305269070.94699295816500210.57836049825443240.126634069691756950.34139212995839420.81123452422299750.395502066337996670.02784202585389850.70054461921525820.0251629273855515920.400088495101414750.042343479053726930.255385456379162430.115323214180639290.86052868405649410.80679786790456510.185724249636432410.70225407591357740.58488866880594670.78797295634420.060463509837799690.94239615039764080.390925469140910530.61930394909062090.00242977964733892550.03832342462305660.236127432526586520.85665946639165140.63819586647921330.41918198781161540.8806863111437020.30998197088794630.5091071836721230.85148740830823380.479261121128822240.5493687561286420.406746809922069460.67766155839030540.68582761943917790.6213998619846040.40003951756032510.50012334946657160.86347241702015310.498562514425627160.43387154606222890.43072796203442290.84431096858734240.91556206059139990.075531540204718530.34637779857456620.09803193830141810.113257180770137910.471363081925707750.386860589489405270.84006043516887830.147215521084850480.99494822829120370.8993747317254130.28745440228503780.61276005847955250.472781788642338440.276861272513734940.117763298225837860.215988090000936550.55739417150262690.82256884249839920.24319530989306770.65012212094836630.200740656294019710.94765111093963530.41269728851781330.71225577084735250.400411906058890.95872905170228840.34550901391959330.153222305223898130.95864777832062950.70017440926415330.74467979235810430.96637701524562810.95769716263556770.67722900525357280.277538733464677060.25299627181338760.49175435775497920.444808352839532350.95159141856708640.3290512494095710.261643308927478340.58005405681136550.81668091542356950.5806116903806480.45714437436937770.0562933316045919340.6300438974448530.188623906862750880.21760948467363360.89388938998057510.116537571134564640.95150737833507870.04176692770659640.33629030272703230.90835370155068820.71473766853785060.63270822261999630.093062154612900240.020562706895957740.66910006911490850.211929290423362280.055661110765969690.39836223634887480.94083417838387410.55424792517495880.470869449244478270.87337609853183710.103244217533338570.55321869490207120.54172435809406090.25695314878723720.16631015046142150.76331973383241340.1899178641120980.56554122983082840.89321305405550010.55793973112074410.251214203805392170.88801755321451090.126348423024250640.51313501961726040.71355373012135170.2438577330041840.35699645637431330.67578064396352120.276489256552760350.33298881202684960.00126232159337602570.91768198017511730.389940479426011950.0071034111941941090.485440276060289830.99044697362439730.28868605183053340.092549576897248410.67042684484907470.107407998478450620.386642394768174750.6602118447246730.87454861233932890.17018753511598960.94127747210143740.80321960491334640.97873131544938460.69885414797191640.491085091427780.0256061015472428540.98781509496584550.78234026806900130.77366145515249270.86292229329185880.18141135788276520.53115418675967780.0204720611536368670.78466124297385130.79878337673937040.64676938370403090.66340028659503990.0172587732682336630.50643826587851070.304259859706085050.231148535265845560.72913383643661760.96056196839458270.103726581164883540.723319718296590.96256253881580080.84915058756499540.29326902056361060.060498267997478150.233590322887418770.82394353907746120.35836913871068310.42868318857439360.92620906123748360.428856383380940.0128858422895083980.5897482329242330.74346123509463720.71392134263184510.7922870515385190.45034578460346420.220713070657383660.50036576077936770.33315150965670970.153791141264383760.081628549271551610.50269544524849260.79871301529344190.62880130752812930.61514733085654270.133290598379500750.98622715267453280.236064344707098250.96733120263385030.474023712962884370.31380358511415230.424555265473760770.467924922792159360.0251235794683071220.6759587091182420.182943144737917730.403016682666544670.91099124492879270.282707871188664140.60257089242009630.41189844877838810.24765897575224960.87111564743408910.441703916151838570.224931920602724930.11202177846435290.074042088708803360.73892123885173520.1665949066403940.061017078562687120.47880792614354870.66027786637404670.8643395969145260.372093701089625030.81660163351184290.227518457861348060.81823518538645380.6354593624513880.130643509274014360.49431668684029950.151986269119320340.37132344164127120.7617103369919940.056864798294056440.73540879564125850.65732925913024020.7251631704649990.91258109596924930.80117253974860940.133379923360126050.69118582098829440.87788183388539290.78718370446488680.5781924355256240.72830873052270830.418725353291123260.113458368474375740.72741570241218830.246127795989631970.52988627694727030.52435244304811570.416120042667790240.78792656042796350.67466269717410140.48713989424384320.99027893964726040.57471525724853150.207240278538425530.94860445376822540.38937980296276420.85939650190469960.227749538284571780.91513558546019280.83968344275887110.81636768367206390.89891236927292930.05689027675212710.362862092800543270.86873922271553240.72174266199009860.73772646324074520.82771531001742020.27083109056695510.41648068011031960.089699268759771970.215544913134742220.5868214136880710.310309893365539270.417081436339563850.41264633416121030.94632759256888210.52903739330871650.156591953331768560.63323741807498650.028415091408658720.67147107229582550.237939421790171360.71193150247025860.30796382253117940.4538868452261180.0082861042382491590.83517541288095280.175955384389067770.307543514998160460.382878090844856130.6418790117085420.86507915169740610.94224842628676790.164135522294932780.09486941194495690.157102263729585360.5742678522826350.50625991475584970.131334532205562130.78874937990440010.78110607600549380.7682254095530070.032657183065025520.004936553383318110.6419535543045420.410641505575076060.213250252801446160.54995289118616460.22467936776999430.245124565834815340.8678620340425454'); -SELECT * FROM src2; - -DROP TABLE src2; - --- https://github.com/Percona-Lab/pg_tde/issues/82 -CREATE TABLE indtoasttest(descr text, cnt int DEFAULT 0, f1 text, f2 text) using tde_heap_basic; - -INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-compressed', repeat('1234567890',1000), repeat('1234567890',1000)); -INSERT INTO indtoasttest(descr, f1, f2) VALUES('two-toasted', repeat('1234567890',30000), repeat('1234567890',50000)); -INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-compressed,one-null', NULL, repeat('1234567890',1000)); -INSERT INTO indtoasttest(descr, f1, f2) VALUES('one-toasted,one-null', NULL, repeat('1234567890',50000)); - -UPDATE indtoasttest SET cnt = cnt +1 RETURNING substring(indtoasttest::text, 1, 200); -UPDATE indtoasttest SET cnt = cnt +1, f1 = f1 RETURNING substring(indtoasttest::text, 1, 200); -UPDATE indtoasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(indtoasttest::text, 1, 200); -UPDATE indtoasttest SET cnt = cnt +1, f1 = f1||'' RETURNING substring(indtoasttest::text, 1, 200); -UPDATE indtoasttest SET f2 = '+'||f2||'-' ; - -DROP TABLE indtoasttest; - --- Test substr with toasted externalized bytea values -CREATE TABLE toasttest(t bytea STORAGE EXTERNAL) using tde_heap_basic; -INSERT INTO toasttest VALUES (decode(repeat('1234567890',10000), 'escape')); - -SET bytea_output = 'escape'; -SELECT substring(t, 1, 10) FROM toasttest; -SELECT substring(t, 50001, 10) FROM toasttest; -SELECT substring(t, 99991) FROM toasttest; - -DROP TABLE toasttest; - -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/toast_extended_storage.inc \ No newline at end of file diff --git a/sql/toast_extended_storage_basic.sql b/sql/toast_extended_storage_basic.sql new file mode 100644 index 00000000..4e079b0c --- /dev/null +++ b/sql/toast_extended_storage_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/toast_extended_storage.inc \ No newline at end of file diff --git a/sql/trigger_on_view.inc b/sql/trigger_on_view.inc new file mode 100644 index 00000000..b229d1b9 --- /dev/null +++ b/sql/trigger_on_view.inc @@ -0,0 +1,133 @@ +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'); + +-- +-- 2 -- Test triggers on a join view +-- +SET default_table_access_method TO ':tde_am'; + +DROP VIEW IF EXISTS city_view CASCADE; +DROP TABLE IF exists country_table CASCADE; +DROP TABLE IF exists city_table cascade; + + 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') + RETURNING *; + + CREATE TABLE city_table ( + city_id serial primary key, + city_name text not null, + population bigint, + country_id int references country_table + ) using :tde_am; + + CREATE VIEW city_view AS + SELECT city_id, city_name, population, country_name, continent + FROM city_table ci + LEFT JOIN country_table co ON co.country_id = ci.country_id; + +CREATE OR REPLACE FUNCTION city_insert() RETURNS trigger LANGUAGE plpgsql AS $$ + declare + ctry_id int; + begin + if NEW.country_name IS NOT NULL then + SELECT country_id, continent INTO ctry_id, NEW.continent + FROM country_table WHERE country_name = NEW.country_name; + if NOT FOUND then + raise exception 'No such country: "%"', NEW.country_name; + end if; + else + NEW.continent := NULL; + end if; + + if NEW.city_id IS NOT NULL then + INSERT INTO city_table + VALUES(NEW.city_id, NEW.city_name, NEW.population, ctry_id); + else + INSERT INTO city_table(city_name, population, country_id) + VALUES(NEW.city_name, NEW.population, ctry_id) + RETURNING city_id INTO NEW.city_id; + end if; + + RETURN NEW; + end; + $$; + + CREATE TRIGGER city_insert_trig INSTEAD OF INSERT ON city_view + FOR EACH ROW EXECUTE PROCEDURE city_insert(); + + CREATE OR REPLACE FUNCTION city_delete() RETURNS trigger LANGUAGE plpgsql AS $$ + begin + DELETE FROM city_table WHERE city_id = OLD.city_id; + if NOT FOUND then RETURN NULL; end if; + RETURN OLD; + end; + $$; + + CREATE TRIGGER city_delete_trig INSTEAD OF DELETE ON city_view + FOR EACH ROW EXECUTE PROCEDURE city_delete(); + + CREATE OR REPLACE FUNCTION city_update() RETURNS trigger LANGUAGE plpgsql AS $$ + declare + ctry_id int; + begin + if NEW.country_name IS DISTINCT FROM OLD.country_name then + SELECT country_id, continent INTO ctry_id, NEW.continent + FROM country_table WHERE country_name = NEW.country_name; + if NOT FOUND then + raise exception 'No such country: "%"', NEW.country_name; + end if; + + UPDATE city_table SET city_name = NEW.city_name, + population = NEW.population, + country_id = ctry_id + WHERE city_id = OLD.city_id; + else + UPDATE city_table SET city_name = NEW.city_name, + population = NEW.population + WHERE city_id = OLD.city_id; + NEW.continent := OLD.continent; + end if; + + if NOT FOUND then RETURN NULL; end if; + RETURN NEW; + end; + $$; + + CREATE TRIGGER city_update_trig INSTEAD OF UPDATE ON city_view + FOR EACH ROW EXECUTE PROCEDURE city_update(); + +-- INSERT .. RETURNING + INSERT INTO city_view(city_name) VALUES('Tokyo') RETURNING *; + INSERT INTO city_view(city_name, population) VALUES('London', 7556900) RETURNING *; + INSERT INTO city_view(city_name, country_name) VALUES('Washington DC', 'USA') RETURNING *; + INSERT INTO city_view(city_id, city_name) VALUES(123456, 'New York') RETURNING *; + INSERT INTO city_view VALUES(234567, 'Birmingham', 1016800, 'UK', 'EU') RETURNING *; + + -- UPDATE .. RETURNING + UPDATE city_view SET country_name = 'Japon' WHERE city_name = 'Tokyo'; -- error + UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Takyo'; -- no match + UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Tokyo' RETURNING *; -- OK + + UPDATE city_view SET population = 13010279 WHERE city_name = 'Tokyo' RETURNING *; + UPDATE city_view SET country_name = 'UK' WHERE city_name = 'New York' RETURNING *; + UPDATE city_view SET country_name = 'USA', population = 8391881 WHERE city_name = 'New York' RETURNING *; + UPDATE city_view SET continent = 'EU' WHERE continent = 'Europe' RETURNING *; + UPDATE city_view v1 SET country_name = v2.country_name FROM city_view v2 + WHERE v2.city_name = 'Birmingham' AND v1.city_name = 'London' RETURNING *; + + -- DELETE .. RETURNING + DELETE FROM city_view WHERE city_name = 'Birmingham' RETURNING *; + + +DROP extension pg_tde CASCADE; diff --git a/sql/trigger_on_view.sql b/sql/trigger_on_view.sql index 1444ddf4..ad69ba86 100644 --- a/sql/trigger_on_view.sql +++ b/sql/trigger_on_view.sql @@ -1,133 +1,2 @@ -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'); - --- --- 2 -- Test triggers on a join view --- -SET default_table_access_method TO 'tde_heap_basic'; - -DROP VIEW IF EXISTS city_view CASCADE; -DROP TABLE IF exists country_table CASCADE; -DROP TABLE IF exists city_table cascade; - - CREATE TABLE country_table ( - country_id serial primary key, - country_name text unique not null, - continent text not null - ) using tde_heap_basic; - - INSERT INTO country_table (country_name, continent) - VALUES ('Japan', 'Asia'), - ('UK', 'Europe'), - ('USA', 'North America') - RETURNING *; - - CREATE TABLE city_table ( - city_id serial primary key, - city_name text not null, - population bigint, - country_id int references country_table - ) using tde_heap_basic; - - CREATE VIEW city_view AS - SELECT city_id, city_name, population, country_name, continent - FROM city_table ci - LEFT JOIN country_table co ON co.country_id = ci.country_id; - -CREATE OR REPLACE FUNCTION city_insert() RETURNS trigger LANGUAGE plpgsql AS $$ - declare - ctry_id int; - begin - if NEW.country_name IS NOT NULL then - SELECT country_id, continent INTO ctry_id, NEW.continent - FROM country_table WHERE country_name = NEW.country_name; - if NOT FOUND then - raise exception 'No such country: "%"', NEW.country_name; - end if; - else - NEW.continent := NULL; - end if; - - if NEW.city_id IS NOT NULL then - INSERT INTO city_table - VALUES(NEW.city_id, NEW.city_name, NEW.population, ctry_id); - else - INSERT INTO city_table(city_name, population, country_id) - VALUES(NEW.city_name, NEW.population, ctry_id) - RETURNING city_id INTO NEW.city_id; - end if; - - RETURN NEW; - end; - $$; - - CREATE TRIGGER city_insert_trig INSTEAD OF INSERT ON city_view - FOR EACH ROW EXECUTE PROCEDURE city_insert(); - - CREATE OR REPLACE FUNCTION city_delete() RETURNS trigger LANGUAGE plpgsql AS $$ - begin - DELETE FROM city_table WHERE city_id = OLD.city_id; - if NOT FOUND then RETURN NULL; end if; - RETURN OLD; - end; - $$; - - CREATE TRIGGER city_delete_trig INSTEAD OF DELETE ON city_view - FOR EACH ROW EXECUTE PROCEDURE city_delete(); - - CREATE OR REPLACE FUNCTION city_update() RETURNS trigger LANGUAGE plpgsql AS $$ - declare - ctry_id int; - begin - if NEW.country_name IS DISTINCT FROM OLD.country_name then - SELECT country_id, continent INTO ctry_id, NEW.continent - FROM country_table WHERE country_name = NEW.country_name; - if NOT FOUND then - raise exception 'No such country: "%"', NEW.country_name; - end if; - - UPDATE city_table SET city_name = NEW.city_name, - population = NEW.population, - country_id = ctry_id - WHERE city_id = OLD.city_id; - else - UPDATE city_table SET city_name = NEW.city_name, - population = NEW.population - WHERE city_id = OLD.city_id; - NEW.continent := OLD.continent; - end if; - - if NOT FOUND then RETURN NULL; end if; - RETURN NEW; - end; - $$; - - CREATE TRIGGER city_update_trig INSTEAD OF UPDATE ON city_view - FOR EACH ROW EXECUTE PROCEDURE city_update(); - --- INSERT .. RETURNING - INSERT INTO city_view(city_name) VALUES('Tokyo') RETURNING *; - INSERT INTO city_view(city_name, population) VALUES('London', 7556900) RETURNING *; - INSERT INTO city_view(city_name, country_name) VALUES('Washington DC', 'USA') RETURNING *; - INSERT INTO city_view(city_id, city_name) VALUES(123456, 'New York') RETURNING *; - INSERT INTO city_view VALUES(234567, 'Birmingham', 1016800, 'UK', 'EU') RETURNING *; - - -- UPDATE .. RETURNING - UPDATE city_view SET country_name = 'Japon' WHERE city_name = 'Tokyo'; -- error - UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Takyo'; -- no match - UPDATE city_view SET country_name = 'Japan' WHERE city_name = 'Tokyo' RETURNING *; -- OK - - UPDATE city_view SET population = 13010279 WHERE city_name = 'Tokyo' RETURNING *; - UPDATE city_view SET country_name = 'UK' WHERE city_name = 'New York' RETURNING *; - UPDATE city_view SET country_name = 'USA', population = 8391881 WHERE city_name = 'New York' RETURNING *; - UPDATE city_view SET continent = 'EU' WHERE continent = 'Europe' RETURNING *; - UPDATE city_view v1 SET country_name = v2.country_name FROM city_view v2 - WHERE v2.city_name = 'Birmingham' AND v1.city_name = 'London' RETURNING *; - - -- DELETE .. RETURNING - DELETE FROM city_view WHERE city_name = 'Birmingham' RETURNING *; - - -DROP extension pg_tde CASCADE; +\set tde_am tde_heap +\i sql/trigger_on_view.inc \ No newline at end of file diff --git a/sql/trigger_on_view_basic.sql b/sql/trigger_on_view_basic.sql new file mode 100644 index 00000000..085d2dc3 --- /dev/null +++ b/sql/trigger_on_view_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/trigger_on_view.inc \ No newline at end of file diff --git a/sql/update_compare_indexes.inc b/sql/update_compare_indexes.inc new file mode 100644 index 00000000..6cc54ac6 --- /dev/null +++ b/sql/update_compare_indexes.inc @@ -0,0 +1,14 @@ +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'); + +DROP TABLE IF EXISTS pvactst; +CREATE TABLE pvactst (i INT, a INT[], p POINT) USING :tde_am; +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; +-- crash! + +DROP TABLE pvactst; +DROP EXTENSION pg_tde; diff --git a/sql/update_compare_indexes.sql b/sql/update_compare_indexes.sql index e11cd83f..98cbdd66 100644 --- a/sql/update_compare_indexes.sql +++ b/sql/update_compare_indexes.sql @@ -1,14 +1,2 @@ -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'); - -DROP TABLE IF EXISTS pvactst; -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; --- crash! - -DROP TABLE pvactst; -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/update_compare_indexes.inc \ No newline at end of file diff --git a/sql/update_compare_indexes_basic.sql b/sql/update_compare_indexes_basic.sql new file mode 100644 index 00000000..7d8f79e5 --- /dev/null +++ b/sql/update_compare_indexes_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/update_compare_indexes.inc \ No newline at end of file diff --git a/sql/vault_v2_test.inc b/sql/vault_v2_test.inc new file mode 100644 index 00000000..221e6390 --- /dev/null +++ b/sql/vault_v2_test.inc @@ -0,0 +1,21 @@ +CREATE EXTENSION pg_tde; + +\getenv root_token ROOT_TOKEN +SELECT pg_tde_add_key_provider_vault_v2('vault-v2',:'root_token','http://127.0.0.1:8200','secret',NULL); +SELECT pg_tde_set_principal_key('vault-v2-principal-key','vault-v2'); + +CREATE TABLE test_enc( + id SERIAL, + k INTEGER DEFAULT '0' NOT NULL, + PRIMARY KEY (id) + ) USING :tde_am; + +INSERT INTO test_enc (k) VALUES (1); +INSERT INTO test_enc (k) VALUES (2); +INSERT INTO test_enc (k) VALUES (3); + +SELECT * from test_enc; + +DROP TABLE test_enc; + +DROP EXTENSION pg_tde; diff --git a/sql/vault_v2_test.sql b/sql/vault_v2_test.sql index 46cc56bd..4e411977 100644 --- a/sql/vault_v2_test.sql +++ b/sql/vault_v2_test.sql @@ -1,21 +1,2 @@ -CREATE EXTENSION pg_tde; - -\getenv root_token ROOT_TOKEN -SELECT pg_tde_add_key_provider_vault_v2('vault-v2',:'root_token','http://127.0.0.1:8200','secret',NULL); -SELECT pg_tde_set_principal_key('vault-v2-principal-key','vault-v2'); - -CREATE TABLE test_enc( - id SERIAL, - k INTEGER DEFAULT '0' NOT NULL, - PRIMARY KEY (id) - ) 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); - -SELECT * from test_enc; - -DROP TABLE test_enc; - -DROP EXTENSION pg_tde; +\set tde_am tde_heap +\i sql/vault_v2_test.inc \ No newline at end of file diff --git a/sql/vault_v2_test_basic.sql b/sql/vault_v2_test_basic.sql new file mode 100644 index 00000000..ad8f5652 --- /dev/null +++ b/sql/vault_v2_test_basic.sql @@ -0,0 +1,2 @@ +\set tde_am tde_heap_basic +\i sql/vault_v2_test.inc \ No newline at end of file diff --git a/t/005_multiple_extensions.pl b/t/005_multiple_extensions.pl index 8cba8f09..e8b499e3 100644 --- a/t/005_multiple_extensions.pl +++ b/t/005_multiple_extensions.pl @@ -14,7 +14,7 @@ my $PG_VERSION_STRING = `pg_config --version`; -if (index(lc($PG_VERSION_STRING), lc("percona")) == -1) +if (index(lc($PG_VERSION_STRING), lc("Percona Distribution")) == -1) { plan skip_all => "pg_tde test case only for PPG server package install with extensions."; }