I am getting "WARNING: There is no transaction in progress" error as explained here. When I checked out the logs, I saw that my sails waterline ORM is causing "statement" word to appear on the logs if I use its Model.query method and "execute" word appears in front of queries that are issued via its model methods like .insert, .update etc. Is there any difference between them regarding how they behave inside a transaction? Or, what is the difference between "statement" and "execute" in the logs?
2015-02-18 21:31:03 UTC [6810-35] vdsr@sails LOG: statement: start transaction
2015-02-18 21:31:03 UTC [6813-33] vdsr@sails LOG: execute <unnamed>: INSERT INTO "groups" ("name", "notes", "isCompany", "parentGroupRef", "companyRef", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7) RETURNING *
2015-02-18 21:31:03 UTC [6813-34] vdsr@sails DETAIL: parameters: $1 = 'bbbb', $2 = 'fdf', $3 = 't', $4 = '1', $5 = '1', $6 = '2015-02-18 21:31:03+00', $7 = '2015-02-18 21:31:03+00'
2015-02-18 21:31:03 UTC [6814-33] vdsr@sails LOG: execute <unnamed>: INSERT INTO "users" ("firstName", "lastName", "email", "companyRef", "isMainUser", "password", "middleName", "createdAt", "updatedAt") values ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING *
2015-02-18 21:31:03 UTC [6814-34] vdsr@sails DETAIL: parameters: $1 = 'ffff', $2 = 'ffdd', $3 = 'ffdfd@ds.com', $4 = '19', $5 = 't', $6 = 'cc5ce3a7addcb4512c7af12a6594af91', $7 = '', $8 = '2015-02-18 21:31:03+00', $9 = '2015-02-18 21:31:03+00'
2015-02-18 21:31:03 UTC [6805-53] vdsr@sails LOG: execute <unnamed>: INSERT INTO "roles" ("name", "companyRef", "createdAt", "updatedAt") values ($1, $2, $3, $4) RETURNING *
2015-02-18 21:31:03 UTC [6805-54] vdsr@sails DETAIL: parameters: $1 = 'Master', $2 = '19', $3 = '2015-02-18 21:31:03+00', $4 = '2015-02-18 21:31:03+00'
2015-02-18 21:31:03 UTC [6809-37] vdsr@sails LOG: execute <unnamed>: INSERT INTO "userroles" ("roleRef", "userRef", "createdAt", "updatedAt") values ($1, $2, $3, $4) RETURNING *
2015-02-18 21:31:03 UTC [6809-38] vdsr@sails DETAIL: parameters: $1 = '12', $2 = '16', $3 = '2015-02-18 21:31:03+00', $4 = '2015-02-18 21:31:03+00'
2015-02-18 21:31:03 UTC [6808-37] vdsr@sails LOG: execute <unnamed>: INSERT INTO "rolepermissions" ("roleRef", "permissionRef", "createdAt", "updatedAt") values ($1, $2, $3, $4) RETURNING *
2015-02-18 21:31:03 UTC [6808-38] vdsr@sails DETAIL: parameters: $1 = '12', $2 = '24', $3 = '2015-02-18 21:31:03+00', $4 = '2015-02-18 21:31:03+00'
2015-02-18 21:31:03 UTC [6811-35] vdsr@sails LOG: execute <unnamed>: INSERT INTO "rolepermissions" ("roleRef", "permissionRef", "createdAt", "updatedAt") values ($1, $2, $3, $4) RETURNING *
2015-02-18 21:31:03 UTC [6811-36] vdsr@sails DETAIL: parameters: $1 = '12', $2 = '22', $3 = '2015-02-18 21:31:03+00', $4 = '2015-02-18 21:31:03+00'
2015-02-18 21:31:03 UTC [6806-41] vdsr@sails LOG: execute <unnamed>: SELECT "groups"."name", "groups"."notes", "groups"."parentGroupRef", "groups"."isCompany", "groups"."hierPos", "groups"."companyRef", "groups"."id", "groups"."createdAt", "groups"."updatedAt" FROM "groups" AS "groups" WHERE "groups"."companyRef" = $1
2015-02-18 21:31:03 UTC [6806-42] vdsr@sails DETAIL: parameters: $1 = '1'
2015-02-18 21:31:03 UTC [6807-41] vdsr@sails LOG: statement: update groups set "hierPos" = case id when 2 then '1' when 3 then '2' when 4 then '3' when 5 then '4' when 6 then '4.1' when 10 then '4.1.1' when 18 then '4.2' when 13 then '5' when 17 then '6' when 19 then '7' else "hierPos" end where id in (2,3,4,5,6,10,18,13,17,19)
2015-02-18 21:31:03 UTC [6812-35] vdsr@sails LOG: statement: commit
2015-02-18 21:31:03 UTC [6812-36] vdsr@sails WARNING: there is no transaction in progress
Most likely you a running your queries in autocommit mode. In this mode every statement has its own small transaction. The WARNING
was issued because all statements were already commited and commit
statement did not "see" them.
As for "execute" vs"statement": one of them seems to be a prepared statement with parameters. The other one is just a simple query without additional parameters.