Dear n8n team,
I tried to search for this but without results in forum or docs;
is there a way to start a Postgres transaction, execute some queries in more then one Postgres node, and finally commit if all is ok or rollback if an error occurred after the begin transaction node, ALL in the same transaction?
This is because I need to write data to several tables in a single transaction, and sometimes the input is not ok or db is not available, so some insert can fail. If this happens all data written after the transaction needs to be rolled back.
In the Postgres node (using insert operation) the mode can be set to “Transaction” (execute all queries in a single transaction), but does this mean that ALL other Postgres nodes in the workflow that have the mode set to “Transaction” will be in the same transaction during the execution of the workflow or only THIS node will use a transaction when inserting the data?
Moreover, the “insert” operation for a Postgres means that only ONE row will be added to the given table, so if I must insert, say, 5 rows the previous node needs to provide 5 elements (if I understand correctly). Is there a way to insert the 5 rows on a single query using the “insert” operation, having the previous node return only one element (and not the generic “execute query”)?
Thanks for the support!