You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
transaction_name
Is the name assigned to the transaction. transaction_name must conform to the rules for identifiers, but identifiers longer than 32 characters are not allowed. Use transaction names only on the outermost pair of nested BEGIN...COMMIT or BEGIN...ROLLBACK statements. transaction_name is always case sensitive, even when the instance of SQL Server is not case sensitive.
@mickhansen Thanks for the update. i dunno what to do, i kind of implemented most of database operation using sequelizejs. is there work around for this.
@bboysathish I unfortunately don't have time to implement this, but as @mickhansen has stated you can certainly try to tackle it yourself. TBH, transactions were never really supported with the MSSQL dialect for sequelize though they do work for more basic cases, you will run into tons of locking issues with anything approaching a complicated schema.
AFAICT, the fix for your problem might be as simple as manually naming all your transactions, rather than using one generated by sequelize.
What happens there is that, in the absence of an existing transaction id, we generate a uuid.v4() which is too long for the MSSQL spec. An immediate solution would be to change that line to check the current dialect and use if it's MSSQL. A better solution would be to add a function to the AbstractDialect, e.g. generateTransactionId, which by default would just return a uuid.v4() and be overloaded for something unique and useful for MSSQL.
Activity
sathishsoundharajan commentedon Jul 13, 2015
Hi Any one working on this issue, me too facing the same.
Please update me.
mickhansen commentedon Jul 13, 2015
@mbroadst who sort-of maintains MSSQL is very busy i believe, so unless volunteers provide pull requests no work is being done.
sathishsoundharajan commentedon Jul 13, 2015
@mickhansen Thanks for the update. i dunno what to do, i kind of implemented most of database operation using sequelizejs. is there work around for this.
mickhansen commentedon Jul 13, 2015
No idea, i have no MSSQL experience.
You are welcome to fork and provide a PR that uses another strategy for transaction naming.
mbroadst commentedon Jul 13, 2015
@bboysathish I unfortunately don't have time to implement this, but as @mickhansen has stated you can certainly try to tackle it yourself. TBH, transactions were never really supported with the MSSQL dialect for sequelize though they do work for more basic cases, you will run into tons of locking issues with anything approaching a complicated schema.
AFAICT, the fix for your problem might be as simple as manually naming all your transactions, rather than using one generated by sequelize.
sathishsoundharajan commentedon Jul 13, 2015
@mbroadst Can i pass cls option? As mentioned here http://docs.sequelizejs.com/en/latest/docs/transactions/.
The problem is transaction is working once, not working on another.
mickhansen commentedon Jul 13, 2015
You can likely overwrite
transaction.idandtransaction.name.sathishsoundharajan commentedon Jul 13, 2015
Please correct me, so i can overwrite transaction id and name like this,
is it mentioned anywhere in the docs?
mickhansen commentedon Jul 13, 2015
No afraid not, you have to overwrite the props on the transaction object you receive from
sequelize.transaction().Not mentioned anywhere in the docs cause it's not official API, it's a workaround hack suggestion: https://github.com/sequelize/sequelize/blob/master/lib/transaction.js
sathishsoundharajan commentedon Jul 13, 2015
@mickhansen will try this out. Thanks for the suggestion. :)
mbroadst commentedon Jul 13, 2015
@mickhansen I think he can indeed just do:
Or am I misreading the source?
mickhansen commentedon Jul 13, 2015
@mbroadst ah, that might work, but it might infer since it leads it to believe it's a the child of another transaction.
mbroadst commentedon Jul 13, 2015
@bboysathish @cdmcnamara incidentally, @mickhansen has pointed you exactly to where you would want to change this behavior for MSSQL: https://github.com/sequelize/sequelize/blob/master/lib/transaction.js#L26
What happens there is that, in the absence of an existing transaction id, we generate a uuid.v4() which is too long for the MSSQL spec. An immediate solution would be to change that line to check the current dialect and use if it's MSSQL. A better solution would be to add a function to the AbstractDialect, e.g. generateTransactionId, which by default would just return a uuid.v4() and be overloaded for something unique and useful for MSSQL.
8 remaining items
Vishal-Isharani commentedon May 24, 2016
@janmeier
I am bit confuse with @mickhansen 's comment "That error is unrelated to transaction naming."
I am moving forward with solution provided by @mbroadst
mickhansen commentedon May 24, 2016
@Vishal-Isharani Look at the comment i'm referring to, the error he's describing there doesn't appear to have anything to do with this issue.
govi2010 commentedon May 24, 2016
@manchicken Sorry my mistake, I did not see you were replying to bboysathish . I will implement that and get back to you
mssql supports only 32 charecter long key.
govi2010 commentedon May 24, 2016
@mickhansen and @janmeier here it comes.
GHLabs@4466dcb
This fix is working for my database.
Thank you for your help.
Let me know if i am doing anything wrong.
if there is anything else in which you need resource we would like to contribute.
Regards
GHLABS IT SOLUTIONS
mickhansen commentedon May 24, 2016
@govi2010 Please don't change the whitespace, makes the commit impossible to read, please also remove stuff like debugger statements or logging.
After that please open a pull request!
So i have created function with 24 character GUID and use that functi…
govi2010 commentedon May 25, 2016
@mickhansen we are new to this github so went to pull request on this repository but then i am blank ...
mickhansen commentedon May 25, 2016
@govi2010 fork sequelize, branch fork, commit & push changes to branch then there should be a PR button on the main sequelize branch.
Resolves sequelize#3950 - mssql transaction name error. Also removes …
sheeput commentedon Oct 18, 2016
Just curious if anyone is working on this issue? I am currently experiencing the same issue. It looks like it was solved, but not finished?
Thanks.
govi2010 commentedon Oct 19, 2016
Yes. There are small changes needed but never accepted my pull request.
On Wed, Oct 19, 2016 at 2:55 AM, sheeput [email protected] wrote:
Contact# : 9426442084
Skype : govinda.alwani
Thank you
with best regards.
felixfbecker commentedon Oct 19, 2016
@govi2010 could you link that pull request please? If it was not accepted there is probably a reason for it 😉
govi2010 commentedon Oct 19, 2016
@felixfbecker i think problem was coding standered liske spaces and etc....
GHLabs@4466dcb