libinjection icon indicating copy to clipboard operation
libinjection copied to clipboard

False negative on no whitespace before and/or after "*" or delimited identifier in SELECT list

Open srutzky opened this issue 5 years ago • 0 comments

Little known fact, but at least some SQL dialects, such as T-SQL, don't require whitespace before or after certain characters in the SELECT list:

  • *
  • [
  • ]
  • (
  • )

The following are all completely valid T-SQL and I just confirmed that they all return the expected results without any errors:

SELECT*FROM sys.objects
SELECT *FROM sys.objects
SELECT* FROM sys.objects

SELECT[name]FROM sys.objects
SELECT [name]FROM sys.objects
SELECT[name] FROM sys.objects

SELECT*,[name]FROM sys.objects
SELECT[name],*FROM sys.objects

SELECT([name])FROM sys.objects

P.S. I'm not sure if this behavior relates to Issue #100 or not (in terms of how the * is handled).

Take care, Solomon... https://SqlQuantumLift.com/ https://SqlQuantumLeap.com/ https://SQLsharp.com/

srutzky avatar Oct 30 '20 05:10 srutzky