On CONFLICT DO UPDATE statement on tde table, corrupt the data and sometimes even crash the server.
Below is the reproducable test case.
DROP TABLE if exists UNIQUE_TBL;
CREATE TABLE UNIQUE_TBL (i int UNIQUE, t text) using pg_tde;
INSERT INTO UNIQUE_TBL VALUES (1, 'one');
INSERT INTO UNIQUE_TBL VALUES (2, 'two');
INSERT INTO UNIQUE_TBL VALUES (1, 'three'); --ERROR
INSERT INTO UNIQUE_TBL (t) VALUES ('seven');
INSERT INTO UNIQUE_TBL VALUES (5, 'five-upsert-insert') ON CONFLICT (i) DO UPDATE SET t = 'five-upsert-update';
INSERT INTO UNIQUE_TBL VALUES (6, 'six-upsert-insert') ON CONFLICT (i) DO UPDATE SET t = 'six-upsert-update';
SELECT * FROM UNIQUE_TBL;
-- should fail
INSERT INTO UNIQUE_TBL VALUES (1, 'a'), (2, 'b'), (2, 'b') ON CONFLICT (i) DO UPDATE SET t = 'fails';
SELECT * FROM UNIQUE_TBL;
On CONFLICT DO UPDATE statement on tde table, corrupt the data and sometimes even crash the server.
Below is the reproducable test case.