Skip to content

SQL Language Option - Apostrophe ' in Square Brackets [] not escaped #13160

@KeithHenselNOV

Description

@KeithHenselNOV

Description of the Issue

Apostrophes are not escaped in square brackets, resulting in the syntax highlighting for .sql files breaking.

Steps to Reproduce the Issue

The below code adds a column with an apostrophe in the name.
--alter table Default_Test_Table add [bad_column'] nvarchar NULL
update Default_Test_Table set [bad_column'] = 'asdf'
update Default_Test_Table set [bad_column''] = 'asdf'

Expected Behavior

In other editors like SSMS (tested with SQL Server Management Studio 19), this code will have the proper syntax highlighting, and the second line will execute correctly.

Actual Behavior

Notepad++ doesn't escape the ', resulting in syntax highlighting breaking after that point in the file (in the above example, the third line will display incorrectly).

Debug Information

Notepad++ v8.4.9 (64-bit)
Build time : Jan 27 2023 - 03:11:16
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : "C:[REDACTED].sql"
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 21H2
OS Build : 19044.2604
Current ANSI codepage : 1252
Plugins :
mimeTools (2.9)
NppConverter (4.5)
NppExport (0.4)

First screenshot is Notepad++ (third line not displaying correctly)
NPP_01

Second is SSMS (displaying correctly)
NPP_02

Metadata

Metadata

Assignees

No one assigned

    Labels

    language-supportIssues or PRs related to programming languages (also e.g. in styles, themes)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions