Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

obfuscate: MSSQL-style bracketed parameters to AS result in odd behaviour #475

Closed
gbbr opened this issue Sep 24, 2018 · 0 comments
Closed
Labels

Comments

@gbbr
Copy link
Contributor

gbbr commented Sep 24, 2018

The sql quantizer is doing this to MSSQL queries:
(note that [Blogs] AS [b] becomes [ Blogs ] b ], so now the left brackets don't match the right brackets)

SELECT [b].[BlogId], [b].[Name]
FROM [Blogs] AS [b]
ORDER BY [b].[Name]

into

SELECT [ b ] . [ BlogId ], [ b ] . [ Name ]
FROM [ Blogs ] b ]
ORDER BY [ b ] . [ Name ]

Square brackets are used to delimit or escape identifiers in Microsoft SQL Server. It's required if a column name is a SQL keyword or has spaces, for example, but some developers use them even when not required. IIRC, it's equivalent to the backtick ` in MySQL or double quotes " in ANSI SQL.

These specific queries were created by Entity Framework, the most popular ORM for .NET.

https://docs.microsoft.com/en-us/sql/relational-databases/databases/database-identifiers?view=sql-server-2017

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

No branches or pull requests

1 participant