From the documentation, my understanding is that when a ROLLBACK command is issued in a transaction, PostgreSQL typically employs the Write-Ahead Logging (WAL) mechanism to undo the changes made within that transaction. However, because changes made to UNLOGGED tables bypass the WAL, rolling back changes made to an unlogged table should theoretically have no effect. I attempted to replicate this scenario, yet I found that the changes were indeed rolled back.
DROP TABLE IF EXISTS test;
CREATE UNLOGGED TABLE test(
id SERIAL PRIMARY KEY,
first_name VARCHAR(32) NOT NULL,
last_name VARCHAR(32) NOT NULL
);
INSERT INTO test(first_name,last_name)
VALUES ('Joe', 'Doe'), ('Sam', 'Fenjero'), ('Victoria', 'Rais');
BEGIN;
UPDATE test SET first_name = 'X';
UPDATE test SET last_name = 'Y';
ROLLBACK;
Where might the issue lie?