不要怂,就是干,撸起袖子干!

Commit 328e2bb7 by Marcel Pursche Committed by Jan Aagaard Meier

Force quoting of savepoint identifiers in the postgres adapter.

1 parent 1d43fb3c
......@@ -1697,7 +1697,8 @@ var QueryGenerator = {
*/
startTransactionQuery: function(transaction) {
if (transaction.parent) {
return 'SAVEPOINT ' + this.quoteIdentifier(transaction.name) + ';';
// force quoting of savepoint identifiers for postgres
return 'SAVEPOINT ' + this.quoteIdentifier(transaction.name, true) + ';';
}
return 'START TRANSACTION;';
......@@ -1739,7 +1740,8 @@ var QueryGenerator = {
*/
rollbackTransactionQuery: function(transaction) {
if (transaction.parent) {
return 'ROLLBACK TO SAVEPOINT ' + this.quoteIdentifier(transaction.name) + ';';
// force quoting of savepoint identifiers for postgres
return 'ROLLBACK TO SAVEPOINT ' + this.quoteIdentifier(transaction.name, true) + ';';
}
return 'ROLLBACK;';
......
......@@ -862,6 +862,42 @@ if (dialect.match(/^postgres/)) {
expectation: 'DROP INDEX IF EXISTS mySchema.user_foo_bar',
context: {options: {quoteIdentifiers: false}}
}
],
startTransactionQuery: [
{
arguments: [{}],
expectation: 'START TRANSACTION;',
context: {options: {quoteIdentifiers: false}}
},
{
arguments: [{parent: 'MockTransaction', name: 'transaction-uid'}],
expectation: 'SAVEPOINT \"transaction-uid\";',
context: {options: {quoteIdentifiers: false}}
},
{
arguments: [{parent: 'MockTransaction', name: 'transaction-uid'}],
expectation: 'SAVEPOINT \"transaction-uid\";',
context: {options: {quoteIdentifiers: true}}
}
],
rollbackTransactionQuery: [
{
arguments: [{}],
expectation: 'ROLLBACK;',
context: {options: {quoteIdentifiers: false}}
},
{
arguments: [{parent: 'MockTransaction', name: 'transaction-uid'}],
expectation: 'ROLLBACK TO SAVEPOINT \"transaction-uid\";',
context: {options: {quoteIdentifiers: false}}
},
{
arguments: [{parent: 'MockTransaction', name: 'transaction-uid'}],
expectation: 'ROLLBACK TO SAVEPOINT \"transaction-uid\";',
context: {options: {quoteIdentifiers: true}}
}
]
};
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!