On PG 14’s documentation, in the CREATE FUNCTION section, the manual says that the body of a LANGUAGE SQL function can either be a single statement
or a block
BEGIN ATOMIC statement; statement; ... statement; END
without giving any explanation of the semantics of that block. This looks similar to a BEGIN … END; block in PL/pgSQL, but seems to be something different.
What’s the difference between writing a set of statements within or without BEGIN ATOMIC … END? When is it necessary to use such a block? Is the ATOMIC keyword mandatory?