sqldelight / sqldelight/sql-psi

Test fixtures aren't not valid ansi sql

Open
#538 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Kotlin
Stars
104
Forks
35
Avg merge
1h 11m
Merged PRs (30d)
14

Description

Dialect

SQLite

Failing SQL
SELECT 42 WHERE 1 = ?1;
Description

Unfortunately, there is no real ANSI sql standard, because the standard itself is not very strict and every vendor has custom dialects. But the test fixtures should be dialect agnostic as possible.

This includes:

  • No ?1 because this syntax isn't supported by all dialects (eg PostgreSQL R2DBC or DB2)
  • Always add a FROM clause. While almost all dialects do support omitting the FROM clause, DB2 does not.

One simple option split the test fixtures and the variable into ansi sql and common sql (name to be discussed), which contains the failing test fixtures.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the SQL test fixtures containing SELECT 42 WHERE 1 = ?1 and inspect how dialect-specific fixture groups are organized. Run the relevant fixture or parser tests, then ensure ANSI fixtures avoid numbered parameters and include a FROM clause, with the tests passing for the supported dialects.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.