v 7.1.0.112 bug
jsreynolds1
Posts: 94 Silver 2
Hello,
version 7.1.0.112 (beta).
Basically "THROW;" gets placed into brackets.
If I reformat this:
I get this:
version 7.1.0.112 (beta).
Basically "THROW;" gets placed into brackets.
If I reformat this:
SET NOCOUNT ON; BEGIN TRY BEGIN TRANSACTION; COMMIT TRANSACTION; END TRY BEGIN CATCH IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION THROW; END CATCH;
I get this:
SET NOCOUNT ON; BEGIN TRY BEGIN TRANSACTION; COMMIT TRANSACTION; END TRY BEGIN CATCH IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION [THROW]; END CATCH;
Comments
This mirrors the behaviour of SQL Server.
Because the THROW is right after the ROLLBACK TRANSACTION, it thinks that THROW is the name of the transaction you want to rollback.
If you put a semicolon after ROLLBACK TRANSACTION, it should work as expected.
Best regards,
David
One ponders who would create a transaction called, "THROW", but then...
It seems weird, but I feel that Prompt shouldn't make assumptions about what the writer meant.
There are however requests to add in static analysis rules (one request is here). A semicolon after ROLLBACK TRANSACTION could be shown as a hint.
Best regards,
David