sqldelight / sqldelight/sql-psi

Multiline SQL comments are not consistently supported

Open
#236 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Dialect:

SQLite

Problem
Multiline SQL comments (aka, C-style comments: /*...*/) are not consistently supported.

SQLite, MySQL, and PostgreSQL each permit multiline, C-style comments.

Context in which observed
Issue noticed while using Sqldelight in connection with Sqldelight Issue 2166, where inclusion of C-style comments in an .sqm migration file resulted in a parsing failure.

@AlecStrong's comment there notes that single-line SQL comments (--) should be preferred. Filing this issue in case we want to reconsider permitting multi-line comments across the board, should others assume as I did that they're fair game. (But, of course, deferring to the wisdom of the spl-psi contributors.)

By my (perhaps overly artful) phrase 'not consistently supported,' I mean in particular that C-style comments are allowed in Sqldelight's .sq files but not in its .sqm files.

I've filed this issue under sql-psi as directed by the Sqldelight issue tracker.

Build Environment
SQLDelight version: 1.4.5 (pre-release)
OS: Android
Gradle version: 6.8.2
Kotlin version: 1.4.21
AGP Version (if applicable): 4.1.0

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

Reproduce the parsing difference with a minimal C-style comment in a .sq file and an .sqm migration, using the SQLDelight issue 2166 context as background. Read the sql-psi parser entry points involved in both file types and determine whether multiline comments should be accepted consistently; done requires a decided behavior and coverage for it.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin, sql
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.