Durumdara <durumdara@xxxxxxxxx> writes: > In autocommit mode, when I start a simple update or select, it is one > transaction, so if something fails, the whole modification is rolled back > (there is no "half update", or "only first record updated"). > What will happen with complex statements, like PLPGSQL stored procedure, or > trigger? It's one transaction unless you take steps to make it something else. In plpgsql, you can make "sub transactions" with BEGIN/EXCEPTION blocks (an exception rolls back only side-effects that happened since BEGIN). Or, if it's a procedure not a function, you can explicitly COMMIT what's been done so far, and then your next action starts a new transaction. But without such measures, all actions executed by a function are part of the same transaction as the calling statement. regards, tom lane