How are we able to rollback transactions
How are we able to rollback transactions made within the Neon rest api?
14 Replies
genetic-orange•13mo ago
Do you mind sharing more details?
What type of transactions?
wise-white•13mo ago
SQL transactions. For example
- An external API request failed
- Rollback internal postgres commits
genetic-orange•13mo ago
So the Neon REST API is used to manage resources (e.g. projects, branches, etc.)
Transactions where you do
BEGIN..COMMIT..ROLLBACK
are supported at the database levelwise-white•13mo ago
I'm referencing the Neon REST API for interfacting with the database directly
genetic-orange•13mo ago
hmm, which one exactly
can you share a link?
wise-white•13mo ago
Trying to find it in our codebase now
<databaseurl>/sql
genetic-orange•13mo ago
Typically you would be using the Neon Serverless Driver and you wouldn't be querying the endpoint directly, which is why I was confused haha.
Transactions aren't supported when querying your database this way
You would need to use a regular Postgres driver
wise-white•13mo ago
Issue is simply that the Serverless Driver doesn't support Java
Ah so even if we could use the serverless driver it wouldn't support it
Is that right?
genetic-orange•13mo ago
yup
genetic-orange•13mo ago
GitHub
GitHub - neondatabase/serverless: Connect to Neon PostgreSQL from s...
Connect to Neon PostgreSQL from serverless/worker/edge functions - neondatabase/serverless
wise-white•13mo ago
That is really quite unfortunate - is it in anyway possible to properly handle rollbacks without these transactions?
genetic-orange•13mo ago
Unfortunately no
you would need to write the rollback logic
wise-white•13mo ago
yikes. Is their any plan for future support?
genetic-orange•13mo ago
Unfortunately no plans to support transactions when connecting over HTTP. You need a regular postgres connection to be able to use transactions