Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the toasted column in encrypted table causes the crash #82

Closed
codeforall opened this issue Dec 4, 2023 · 0 comments · Fixed by #142
Closed

Updating the toasted column in encrypted table causes the crash #82

codeforall opened this issue Dec 4, 2023 · 0 comments · Fixed by #142
Assignees
Labels
bug Something isn't working

Comments

@codeforall
Copy link
Collaborator

Trying to update a toasted column causes the server crash. Only happens when there is another column proceeds the toasted column


DROP TABLE indtoasttest;
CREATE TABLE indtoasttest(descr text, cnt int DEFAULT 0, f1 text, f2 text) using pg_tde;
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||'-' ;


@codeforall codeforall added the bug Something isn't working label Dec 4, 2023
@codeforall codeforall self-assigned this Dec 4, 2023
codeforall added a commit to codeforall/postgres-tde-ext that referenced this issue Jan 19, 2024
…ona#82)

pg_tde_toast_insert_or_update calls pg_tde_deform_tuple  on old-tuple from
within and tries to dereference the toast columns. Passing the encrypted tuple
as part of the old tuple renders the toast data pointer (the encrypted value
of the actual pointer) invalid, and anything can happen if it gets
dereferenced as it is.
The solution is to pass the decrypted old tuple pg_tde_toast_insert_or_update
function from pg_tde_update.
codeforall added a commit to codeforall/postgres-tde-ext that referenced this issue Jan 19, 2024
…ona#82)

pg_tde_toast_insert_or_update calls pg_tde_deform_tuple  on old-tuple from
within and tries to dereference the toast columns. Passing the encrypted tuple
as part of the old tuple renders the toast data pointer (the encrypted value
of the actual pointer) invalid, and anything can happen if it gets
dereferenced as it is.
The solution is to pass the decrypted old tuple pg_tde_toast_insert_or_update
function from pg_tde_update.
hqakhtar pushed a commit that referenced this issue Jan 25, 2024
…#103)

pg_tde_toast_insert_or_update calls pg_tde_deform_tuple  on old-tuple from
within and tries to dereference the toast columns. Passing the encrypted tuple
as part of the old tuple renders the toast data pointer (the encrypted value
of the actual pointer) invalid, and anything can happen if it gets
dereferenced as it is.
The solution is to pass the decrypted old tuple pg_tde_toast_insert_or_update
function from pg_tde_update.
@hqakhtar hqakhtar added this to the Tech Preview - 1.0 Release milestone Jan 30, 2024
@ImTheKai ImTheKai changed the title updating the toasted column in encrypted table causes the crash Updating the toasted column in encrypted table causes the crash Mar 4, 2024
@codeforall codeforall linked a pull request Mar 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants