Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 328e2bb7
authored
Mar 08, 2016
by
Marcel Pursche
Committed by
Jan Aagaard Meier
Mar 30, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Force quoting of savepoint identifiers in the postgres adapter.
1 parent
1d43fb3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
lib/dialects/abstract/query-generator.js
test/unit/dialects/postgres/query-generator.test.js
lib/dialects/abstract/query-generator.js
View file @
328e2bb
...
...
@@ -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;'
;
...
...
test/unit/dialects/postgres/query-generator.test.js
View file @
328e2bb
...
...
@@ -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
}}
}
]
};
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment