Skip to content

Contributing to General SQL Parser .NET

We welcome contributions to General SQL Parser .NET. This page covers the development environment, build commands, and the regression-test workflow you should follow before opening a PR.

Repository layout

Top-level structure:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
gsp_dotnet/
  Directory.Build.props       # shared MSBuild defaults
  gsp_dotnet.slnx             # SDK-style solution file
  docs/                       # TFM strategy + upgrade guide (Chinese)
  gsp_dotnet_core/            # the library
    src/gsqlparser/           # source + csproj (canonical .NET layout)
    src/ConsoleApp/           # helper exe
    tests/                    # core-lib tests
      common/                 # per-vendor fixture suite
      formatsql/              # formatter tests
      scriptWriter/           # AST round-trip tests
      testDBVendors/          # smoke test
    doc/                      # changes.txt, history_dotnet.txt
  gsp_demo_dotnet/            # ~18 sample programs
    src/demos/                # formatsql, dataFlowAnalyzer, etc.
    tests/                    # demo-dependent tests
  gsp_dotnet_parser/          # SQL grammar sources (.l/.y) + lex/yacc toolchain
  gsp_sqlfiles/               # 6000+ fixture SQL files for regression tests

Development environment

Prerequisites

  • .NET 10 SDK. On Ubuntu 24.04: sudo apt-get install -y dotnet-sdk-10.0. Verify with dotnet --info (should show 10.0.x).
  • Git with LFS support (for the binary parser tables).
  • An IDE with C# support (Rider, Visual Studio, or VS Code with the C# Dev Kit).

Build the whole solution

1
2
3
4
5
6
7
dotnet restore gsp_dotnet.slnx
dotnet build gsp_dotnet.slnx -c Release \
  /p:includeDB2=true /p:includeGreenplum=true /p:includeHive=true \
  /p:includeImpala=true /p:includeInformix=true /p:includeMdx=true \
  /p:includeMssql=true /p:includeMySQL=true /p:includeNetezza=true \
  /p:includeOracle=true /p:includePostgreSQL=true /p:includeRedshift=true \
  /p:includeSnowflake=true /p:includeSybase=true /p:includeTeradata=true

Omit any /p:includeXxx=true flag to compile a library without that dialect's parser tables. Every project builds on Linux — there are no Windows-only projects.

Run the regression suite

1
2
3
4
5
6
dotnet test gsp_dotnet_core/tests/common/test.common.csproj -c Release --no-build \
  /p:includeDB2=true /p:includeGreenplum=true /p:includeHive=true \
  /p:includeImpala=true /p:includeInformix=true /p:includeMdx=true \
  /p:includeMssql=true /p:includeMySQL=true /p:includeNetezza=true \
  /p:includeOracle=true /p:includePostgreSQL=true /p:includeRedshift=true \
  /p:includeSnowflake=true /p:includeSybase=true /p:includeTeradata=true

The fixture suite parses ~3000 real SQL files across every supported dialect. The current baseline is 0 failures — your PR must keep it that way.

Run a demo

1
2
dotnet run --project gsp_demo_dotnet/src/demos/formatsql/demos.formatsql.csproj \
    -c Release -- /f path/to/script.sql /t oracle

Mandatory regression check before committing parser changes

Any change that can alter parser behaviour (grammar edits, hand-edits to source files in gsp_dotnet_core/src/gsqlparser/) must be followed by:

  1. A clean full-solution build with all dialects enabled (0 Errors)
  2. The full fixture suite passing (Failed: 0)

The library is a SQL parser — most bugs are silent (a query parses to a subtly different AST). Compiling cleanly is nowhere near sufficient. The fixture suite is the only thing that catches these regressions early. Do not commit until the suite passes.

Commit message style

Follow the repository's commit convention:

  • Subject line: ~50 chars, imperative mood, capitalised, no trailing period
  • Scope tag in brackets when relevant: [Oracle], [PostgreSQL, Redshift], [build], [docs], [parser]
  • Wrap body at 72 chars; explain what and why, not how

Good examples:

1
2
3
[Impala] Accept NOT LIKE in predicate list
[PostgreSQL, Greenplum] Support SET DATA TYPE in ALTER TABLE
[build] Bump library <Version> to 3.5.1

Reporting bugs

Use the issue tracker at https://www.sqlparser.com/bugs/mantisbt (free registration). Include:

  • Full failing SQL
  • Vendor (and version, if relevant)
  • The error from parser.Errormessage
  • GSP .NET version
  • Expected vs actual

Getting help

Thank you for contributing to General SQL Parser .NET.