restore from url breaks SQL formatter
The below script causes SQL Formatter rules to fail with the error "Script parsing error(s) ... Incorrect syntax near url. ... Failed refactorings: Insert semicolons (Script parsing errors)"
create database foo;
go
backup database foo
to url = N'https://foocorp.blob.core.windows.net/backups/foo/foo_1.bak';
go
restore database foo
from url = N'https://foocorp.blob.core.windows.net/backups/foo/foo_1.bak';
go
SSMS Parse (ctrl+F5
) reveals that this snippet parses correctly. When replaced with a valid URL target, this syntax also executes without error.
Please update the semicolon rule and any other necessary rules to handle for backup/restore from URL as a valid formattable syntax.
(possibly related? https://redgate.uservoice.com/forums/94413-sql-prompt/suggestions/40184173-format-sql-backup-to-url-with-credential-breaks-co)
-
PeterVandivier_vgg commented
Please note also that removing the "Insert Semicolons" rule still causes the error to throw at the "Apply layout (format SQL)" step. Removing the "Apply layout (format SQL)" step removes the error but then... why would I bother to format ¯\_(ツ)_/¯
-
PeterVandivier_vgg commented
n.b. this behaviour also occurs with the syntax
```sql
alter availability group [ag1]
modify replica on 'sql1'
with (
backup_priority = 10
);
```Note _including_ `apply_delay` in the above statement does not prevent the error, only _removing_ `backup_priority`.