## Mike Martin (redtux1@gmail.com):
> Subject: Problem with commit in function
You can't commit inside a FUNCTION - and there's an obvious ERROR if
you try to do that: "invalid transaction termination".
Only since version 11 you can use a PROCEDURE and COMMIT/ROLLBACK
inside that - and the procedure must be written in PL/pgSQL (you
don't get transaction control in SQL procedures - but beside the
LANGUAGE marker, your code would be the same).
See
https://www.postgresql.org/docs/current/static/sql-createprocedure.htmlhttps://www.postgresql.org/docs/current/static/plpgsql-transactions.html
> truncate table postgres_log_tmp ;
You might want to look into temporary tables (perhaps even unlogged
ones) - that will save you the hassle of truncating (temporary tables
are even automatically removed), and with an unlogged temp table it
will save you some WAL I/O.
> --COMMIT;
So, is this on or not?
Oh, and please pay attention to the errors PostgreSQL throws at
you - they're significant.
Regards,
Christoph
--
Spare Space