Closed
Description
I'm working on a project where I need to implement distributed transactions. After some research, we came to the conclusion that we should use postgresql's prepared transactions.
But the problem is, begin
does not support prepared transactions. So I tried, e.g:
sql.unsafe(`begin; insert into users (username) values (${username}); prepare transaction 'insert_user';`)
But this gives the following error:
Uncaught Error: UNSAFE_TRANSACTION: Only use sql.begin or max: 1
Is it possible to use prepared transactions at all? If yes, how?
Thanks