Parsing issue with T-SQL in sonarqube developer edition 9.5.0

Hi Team,
The following are the configuration I have been using:
Sonarqube 9.5.0.56709 Developer edition
SonarScanner 4.7.0.2747
Java 11.0.11 Red Hat, Inc. (64-bit)
Linux 3.10.0-1160.25.1.el7.x86_64 amd64
Auto-configuring with CI ‘Jenkins’

Recently I have opted for free trail developer edition in order to get additional benefits which it provides and one of that is to have TSQL analyzer.
While I was analyzing our project repo which has T-SQL scripts in it, I was able to see the parse errors.

The following was the error I have been encountered as part of analysis.
WARN: Unable to parse file …/ at line so and so.
I would like to list and highlight all the parse errors which I have found as part of analysis.

  • DROP VIEW IF EXISTS view_name CASCADE ;
  • CREATE TABLE IF NOT EXISTS table_name
  • CREATE TABLE IF NOT EXISTS table_name
  • start_date TIMESTAMP WITHOUT TIME ZONE
  • DROP INDEX IF EXISTS table_name ; (error at the semi-colon)

I would be glad if someone would take a look at this and help me out on this.

Hey there.

In order to pass this information on to developers, we would need the full analysis logs (at least the part of the analysis logs that include the complete parsing error messages)

Hi Team,
The following is the file attached which contains full analysis logs which was generated as part of Jenkins CI. Please take some time to look into these logs and help me on fixing those.

sonarlogs_imp.txt (57.2 KB)

Hello @ aadi,

I looked into your examples and it looks like the examples are PostgreSQL and not T-SQL:

  • DROP VIEW IF EXISTS view_name CASCADE: CASCADE is not part of the T-SQL grammar
  • CREATE TABLE IF NOT EXISTS: IF NOT EXISTS is not part of the T-SQL grammar
  • start_date TIMESTAMP WITHOUT TIME ZONE: WITHOUT TIME ZONE seems to be PostgressSQL. T-SQL has an AT TIME ZONE clause which is supported.
  • DROP INDEX IF EXISTS table_name: We support qualified names for indexes like so DROP INDEX IF EXISTS dbo.indexName.

It looks like you run the analysis on a dialect of T-SQL we don’t support. Therefore parsing errors are expected. You may still find value in running the analysis even though you may encounter false positives or incomplete results.

Best regards, Martin

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.