Do postgres use implicit transaction in UPDATE ... RETURNING queries? - Mailing list pgsql-admin

From Debraj Manna
Subject Do postgres use implicit transaction in UPDATE ... RETURNING queries?
Date
Msg-id CAF6DVKNEbSXLVOs=BBNxhQ_+pjQJL8uMrwx9GWHNyAZyvirvmA@mail.gmail.com
Whole thread Raw
Responses Re: Do postgres use implicit transaction in UPDATE ... RETURNING queries?
List pgsql-admin

Can someone let me know if Postgres 15 uses implicit transactions for UPDATE...RETURNING queries?

For example, is there any differences between the two queries

BEGIN;
UPDATE counter
SET value = value + 1
RETURNING value;
COMMIT;

and

UPDATE counter
SET value = value + 1
RETURNING value;

Table is like below

CREATE TABLE IF NOT EXISTS counter
(    value      bigint PRIMARY KEY NOT NULL DEFAULT 0,    updated_at TIMESTAMPTZ        NOT NULL DEFAULT CURRENT_TIMESTAMP
);

pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Out of Memory error triggering replica to transition into recovery mode
Next
From: Laurenz Albe
Date:
Subject: Re: Do postgres use implicit transaction in UPDATE ... RETURNING queries?