Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALTER EVENT SESSION statement cannot be used inside a user transaction #2879

Closed
anake1 opened this issue Jul 14, 2020 · 5 comments
Closed

ALTER EVENT SESSION statement cannot be used inside a user transaction #2879

anake1 opened this issue Jul 14, 2020 · 5 comments
Assignees
Milestone

Comments

@anake1
Copy link

anake1 commented Jul 14, 2020

Which version and edition of Flyway are you using?

flyway-commandline-6.5.1-windows-x64

If this is not the latest version, can you reproduce the issue with the latest one as well?

(Many bugs are fixed in newer releases and upgrading will often resolve the issue)
Latest.

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

flyway.cmd

Which database are you using (type & version)?

Microsoft SQL Server 2019 15.0.4023.6 (X64)

Which operating system are you using?

Windows Server 2016 Standard 10.0

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)

ALTER EVENT SESSION [AlwaysOn_health] ON SERVER ADD EVENT sqlserver.alwayson_ddl_executed(SET collect_statement=(1) ACTION(sqlserver.nt_username));

What did you expect to see?

Clean execution.

What did you see instead?

SQL State : S0000
Error Code : 574
Message : ALTER EVENT SESSION statement cannot be used inside a user transaction.
Line : 1
Statement : ALTER EVENT SESSION [AlwaysOn_health] ON SERVER ADD EVENT sqlserver.alwayson_ddl_executed(SET collect_statement=(1) ACTION(sqlserver.nt_username));

@MikielAgutu
Copy link

MikielAgutu commented Jul 14, 2020

This may be a bug as Flyway should detect non-transacitonal statements. In the meantime you can force this migraiton to run outside of a transaciton with the executeInTransaction script config file option.

@MikielAgutu MikielAgutu self-assigned this Jul 14, 2020
@MikielAgutu MikielAgutu added this to the Flyway 6.5.2 milestone Jul 14, 2020
@anake1
Copy link
Author

anake1 commented Jul 14, 2020

I understand that parameter executeInTransaction=false should be added and that is all. If yes I still get the same error.

@MikielAgutu
Copy link

MikielAgutu commented Jul 15, 2020

Ok, we'll have to investigate further. We'll aim to get a fix in the next release.

@MikielAgutu MikielAgutu removed their assignment Jul 16, 2020
@juliahayward juliahayward self-assigned this Jul 16, 2020
@juliahayward
Copy link
Member

juliahayward commented Jul 16, 2020

I'm not able to reproduce the problem - would you be able to send me the script .sql file and associated .sql.conf file? You can mail to support@flywaydb.org or julia.hayward@red-gate.com if you prefer not to post here.

@juliahayward
Copy link
Member

juliahayward commented Jul 16, 2020

Ok, it seems to be a weakness in the documentation telling you how to use this feature. I'll update it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants