Search code examples
stored-proceduresruntime-errorvoltdb

Error while trying to run an andhoc insert query using voltQueueSQLExperimental


I am getting an error while trying to execute a dynamic insert query in volt db using the voltQueueSQLExperimental() function. The SQL is fine as i ran it separately on the volt web studio. The error is as follows:

Error: VOLTDB ERROR: USER ABORT Attempted to queue DML adhoc sql 'insert into volt_temp_constraints (asset_id,config_id,session_id,sam_id) values (12,13,'abc',12)' from read only procedure at procedures.testPrcUpdateConstraint.run(testPrcUpdateConstraint.java:155)

Please note that the SQL generated is dynamic and adhoc and this cannot be generated statically before hand.


Solution

  • Documentation is not their strength... ;), but I could reproduce your bug.

    As I see it VoltDB marks compiled Procedures as read-writer or read-only. As one can infer from here. Unfortunately there currently does not seem to be any other way around it other than creating a INSERT/UPDTE/UPSERT SQLStatement as a Object Property and simply not using it.

    Maybe you can contact one of the developers to add a some way on confutation for this.

    By the way, the Exception can be found here: https://github.com/VoltDB/voltdb/blob/master/src/frontend/org/voltdb/ProcedureRunner.java in line 620