microsoft / microsoft/sqlmanagementobjects

Internal Parser Error when trying to parse (legit) syntax

Aperta
#55 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
143
Fork
28
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Using the below SMO version:

    <PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" Version="161.46367.54" />

The below code throws SqlParserInternalParserError:

            var sql = @"SELECT * FROM n as n1, e, n as n2 WHERE MATCH (n1-(e)->n2)";

            Microsoft.SqlServer.Management.SqlParser.Parser.ParseOptions resultOptions;
            var res = Microsoft.SqlServer.Management.SqlParser.Parser.Parser.Parse(sql,
                new ParseOptions("GO",
                true,
                Microsoft.SqlServer.Management.SqlParser.Common.DatabaseCompatibilityLevel.Azure,
                Microsoft.SqlServer.Management.SqlParser.Common.TransactSqlVersion.Azure),
                out resultOptions);

Here is the associated call stack:

Unhandled exception. Microsoft.SqlServer.Management.SqlParser.SqlParserInternalParserError: Internal Parser Error
 ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.SetParentPointers()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.SetParentPointers()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.SetParentPointers()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.SetParentPointers()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlStatement.SetParentPointers()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.SetParentPointers()
   at Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlCodeObject.SetParentPointers()
   at Microsoft.SqlServer.Management.SqlParser.Parser.Internals.VersionedParserBase.Parse(Boolean isIncremental, String sql, SqlScript prevScript, ParseOptions options, ParseOptions& resultOptions)
   --- End of inner exception stack trace ---
   at Microsoft.SqlServer.Management.SqlParser.Parser.Internals.VersionedParserBase.Parse(Boolean isIncremental, String sql, SqlScript prevScript, ParseOptions options, ParseOptions& resultOptions)
   at Microsoft.SqlServer.Management.SqlParser.Parser.Parser.Parse(Boolean isIncremental, String sql, ParseResult prevResult, ParseOptions options, ParseOptions& resultOptions)
   at Microsoft.SqlServer.Management.SqlParser.Parser.Parser.Parse(String sql, ParseOptions options, ParseOptions& resultOptions)

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal punto di ingresso Parser.Parser.Parse e dall’istruzione SQL e da ParseOptions forniti. Segui l’errore attraverso VersionedParserBase.Parse e SqlCodeDom.SqlCodeObject.SetParentPointers, usando lo stack delle chiamate per identificare l’oggetto nullo. Il lavoro è completato quando la query sul grafo mostrata viene analizzata senza SqlParserInternalParserError e un test di regressione la copre.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, sql
Ambito
compilers, databases
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.