Skip to content

BUG: Double-quoted identifiers not supported in non-SELECT statements (UPDATE/INSERT/DELETE/DROP/TRUNCATE/CREATE)Β #200

@ilxqx

Description

@ilxqx

First of all, thank you for creating such an amazing SQL parser library! GoSQLX is truly impressive with its high performance and comprehensive feature set. I really appreciate your hard work and dedication to this project. πŸ™

Bug Description

GoSQLX correctly supports double-quoted identifiers in SELECT statements, but fails to parse them in other SQL statement types (UPDATE, INSERT, DELETE, DROP, TRUNCATE, CREATE).

According to ANSI SQL standard, double-quoted identifiers should be supported in all SQL statement types.

Reproduction

package main

import (
    "fmt"
    "github.com/ajitpratap0/GoSQLX/pkg/gosqlx"
)

func main() {
    tests := []string{
        `SELECT * FROM "users"`,           // βœ… Works
        `DROP TABLE "users"`,              // ❌ Fails
        `DELETE FROM "users" WHERE id=1`,  // ❌ Fails
        `UPDATE "users" SET name='test'`,  // ❌ Fails
        `INSERT INTO "users" (name) VALUES ('test')`, // ❌ Fails
        `TRUNCATE TABLE "users"`,          // ❌ Fails
        `CREATE TABLE "users" (id INT)`,   // ❌ Fails
    }

    for _, sql := range tests {
        _, err := gosqlx.Parse(sql)
        if err != nil {
            fmt.Printf("❌ %s\n   Error: %v\n", sql, err)
        } else {
            fmt.Printf("βœ… %s\n", sql)
        }
    }
}

Output

βœ… SELECT * FROM "users"
❌ DROP TABLE "users"
   Error: parsing failed: Error E2002 at line 0, column 0: expected object name, got DOUBLE_QUOTED_STRING
❌ DELETE FROM "users" WHERE id=1
   Error: parsing failed: Error E2002 at line 0, column 0: expected table name, got DOUBLE_QUOTED_STRING
❌ UPDATE "users" SET name='test'
   Error: parsing failed: Error E2002 at line 0, column 0: expected table name, got DOUBLE_QUOTED_STRING
❌ INSERT INTO "users" (name) VALUES ('test')
   Error: parsing failed: Error E2002 at line 0, column 0: expected table name, got DOUBLE_QUOTED_STRING
❌ TRUNCATE TABLE "users"
   Error: parsing failed: Error E2002 at line 0, column 0: expected object name, got DOUBLE_QUOTED_STRING
❌ CREATE TABLE "users" (id INT)
   Error: parsing failed: Error E2002 at line 0, column 0: expected object name, got DOUBLE_QUOTED_STRING

Expected Behavior

Double-quoted identifiers should be supported in all SQL statement types per ANSI SQL standard. This is critical for compatibility with:

  • PostgreSQL (uses double quotes by default)
  • ORMs like bun, GORM (generate double-quoted SQL)

Environment

  • GoSQLX version: v1.6.0
  • Go version: 1.25.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions