Commit

In order for the changes to be visible for other sessions (or users), it is necessary to perform the operation using the COMMIT statement:

COMMIT;
COMMIT WORK;
COMMIT TRANSACTION;

After executing the COMMIT statement, PostgreSQL also guarantees that if a crash occurs, the change will be permanent.

If we use all these syntaxes together:

-- Start the transaction
BEGIN;

-- insert a new row into the table
INSERT INTO calculates(name, balance) VALUES('AHMET', 3550);

-- commit the change
COMMIT;

Example:

BEGIN;
UPDATE hesaplar SET bakiye = bakiye + 1200 WHERE id = 1;
UPDATE hesaplar SET bakiye = bakiye - 250 WHERE id = 2;
SELECT id, ad, bakiye FROM hesaplar;

**Change is seen in the current session, we cannot see it when we check it with another session.

commit; The same result is seen in all sessions with the execution of the command.