Escaped, open square bracket '[[' not decoded - Microsoft.SqlServer.TransactSql.ScriptDom.Identifier.DecodeIdentifier()
Actual behavior:
Microsoft.SqlServer.TransactSql.ScriptDom.Identifier.DecodeIdentifier("[[[As]]]", out _) == "[[As]"
Expected behavior
Microsoft.SqlServer.TransactSql.ScriptDom.Identifier.DecodeIdentifier("[[[As]]]", out _) == "[As]"
Obviously Replace("[[", "[") is missing when decoding an identifier with QuoteType.SquareBracket
Microsoft.SqlServer.TransactSql.ScriptDom 14.0.3811.1

2 comments
-
Solomon Rutzky commented
P.S. I am only voting for this issue because this horrible UserVoice system does not provide any other mechanism for getting notifications for changes or comments on items you did not submit 😾 .
-
Solomon Rutzky commented
Hello Niklas. You are misunderstanding how square brackets are escaped in delimited identifiers that use square brackets as the delimiter. It is _only_ the right square brackets that are escaped; left square brackets are _not_ escaped. Hence, the "actual behavior" is correct, and the "expected behavior" is an invalid expectation.
For example, the following query:
--------------------------------------------------------------
SELECT 1 AS [[[As]]], 2 AS [[[[[Bt]]]]];
--------------------------------------------------------------returns:
--------------------------------------------------------------
[[As] ..... [[[[Bt]]
1 ............ 2
--------------------------------------------------------------For a comprehensive list of rules describing how identifiers behave, please see:
"Completely Complete List of Rules for T-SQL Identifiers" ( https://sqlquantumleap.com/reference/completely-complete-list-of-rules-for-t-sql-identifiers )
This item is a non-issue and can be closed.
Take care,
Solomon ( https://SqlQuantumLeap.com/ )
SQL# SQLCLR Library ( https://SQLsharp.com/ )