Git Product home page Git Product logo

Comments (8)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
The error message will be
  ERROR:  current transaction is aborted, commands ignored until end of transaction block
on Revision: 5049be9218a9.

However, you cannot continue transactions on SQL errors although the error can 
be caught.
There is no relationship between "try" in JavaScript and SAVEPOINT in postgres.
We don't make a SAVEPOINT at "try" block.

We need to decide how to handle transaction-level errors in JavaScript.
I have 3 ideas about the issue:

  A. Make SQL errors uncaught-able because users cannot ignore the error. 
  B. Support sub-transactions via making SAVEPOINTs for every "try" block. 
  C. Support sub-transactions via some special functions, like:
      prepareTransaction(name);
      try { ... }
      catch (e) { rollbackToSavePoint(name); }

Comments and/or any better ideas?

Original comment by [email protected] on 10 Nov 2011 at 2:07

  • Changed state: Started

from plv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
If we have no way to handle transaction in current implementation, I'd think 
it's a good chance, so B. But what was drawback of B compared with C? It seems 
to me that auto-transaction has kind of overhead.

Original comment by [email protected] on 13 Nov 2011 at 7:01

from plv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
It seems plpython makes subtransactions for each SPI execution. I think it's 
better than B.

Original comment by [email protected] on 13 Feb 2012 at 10:10

from plv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
We might have an option for SPI exectuion something like ON_ERROR_ROLLBACK in 
psql.

Original comment by [email protected] on 13 Feb 2012 at 11:13

from plv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024

Original comment by [email protected] on 6 Mar 2012 at 8:55

from plv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
I don't like to introduce any options to users here.  Do you mean introducing a 
GUC to let users to choose the behavior??

Original comment by [email protected] on 6 Mar 2012 at 9:10

from plv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
I'm going to implement subtransaction() rather than try-catch.

subtransaction(function(){
  executeSql(...)
})

BTW, I'm inclined to define a global object, plv8, to separate builtin function 
namespace.  Thoughts?

Original comment by [email protected] on 18 Mar 2012 at 7:43

from plv8.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 20, 2024
Pushed 485c509a9f3e5f9fd7425bc72970002618cbe217

Now executeSql runs the statement in a sub-transaction always.  If the 
statement fails, the sub-transaction is aborted and exception is thrown.  
Subsequent process is allowed to run another SQL instead of SPI_finish() 
failure or top-transaction abortion message.

Also like I said above, I added subtransaction function to let users make 
explicit sub-transaction block.  Since executeSql() now runs in its own 
sub-transaction, users need explicit sub-transaction block when needed.

Original comment by [email protected] on 23 Mar 2012 at 7:45

  • Changed state: Fixed

from plv8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.