On Tue, Jul 7, 2020 at 4:41 AM Robert Inder <rob...@interactive.co.uk> wrote:
> So how should I structure my chunks of SQL so that I can have "safe" > (all-or-nothing) blocks, > AND use them from within one another? > While there are more advanced constructs that may aid here I would suggest just following two rules: top-level scripts handle transactions - usually just a single BEGIN/COMMIT at the top/bottom of the script respectively. These are scripts you are allowed to name on the psql command line. support scripts don't handle transactions - these are scripts you include into the main script with \i or \ir David J.