LQL→PostgreSQL transpiler emits unquoted column identifiers in pipeline SQL (mixed-case columns case-fold)

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

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
csharp, postgresql, sqlite

Direzione di ricerca

Start at RlsPredicateTranspiler.TranslateExistsSubquery and inspect RlsPredicateTranspiler.TriggerGuard.cs, including the QuotePipelineIdentifiersForPostgres workaround. Compare the transpiled PostgreSQL identifiers with the existing DDL quoting, then run PgTriggerGuard_PascalCaseIdentifiers_EnforcedAtRuntime and add the described RLS parity coverage. Done means mixed-case columns work on both SQLite and PostgreSQL and the workaround can be removed.

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

Descrizione

bug

Problem

LQL is database platform INDEPENDENT and must behave identically on every platform it transpiles to (CLAUDE.md mandate). The LQL→PostgreSQL transpilation path emits unquoted column identifiers in pipeline SQL (e.g. filter(fn(m) => m.TenantId = ...) → m.TenantId). PostgreSQL case-folds unquoted identifiers to lowercase, so any schema with mixed-case (quoted) column names fails at runtime with 42703 column does not exist — while the identical LQL works fine on SQLite (case-insensitive identifiers).

Where it bites today

  • RLS policy predicates (RlsPredicateTranspiler.TranslateExistsSubquery): the exists() pipeline path emits bare identifiers. Latent bug for any RLS schema using PascalCase columns on Postgres.
  • Declarative trigger guards (issue #82): hit this during E2E testing. Worked around in RlsPredicateTranspiler.TriggerGuard.cs via QuotePipelineIdentifiersForPostgres, which post-processes the transpiled subquery SQL to quote bare identifiers. See regression test PgTriggerGuard_PascalCaseIdentifiers_EnforcedAtRuntime in PostgresDeclarativeTriggerE2ETests.

Correct fix

The core LQL→SQL transpiler should quote all identifiers it emits for PostgreSQL (matching how the DDL generators already quote), so:

  1. The QuotePipelineIdentifiersForPostgres workaround in the trigger-guard path can be deleted.
  2. The RLS policy exists() path gets the same fix (currently unprotected).
  3. SQLite/Postgres behaviour is provably identical for mixed-case schemas (add parity E2E tests).

Acceptance

  • Same LQL predicate over a PascalCase-column table produces working SQL on both SQLite and Postgres.
  • Trigger-guard workaround removed; PgTriggerGuard_PascalCaseIdentifiers_EnforcedAtRuntime still green.
  • New RLS parity test with PascalCase columns green on both platforms.
Lingua principale
C#
Stelle
68
Fork
4
Merge medio
50m
PR unite (30g)
2

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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.

Altre issue di Nimblesite/DataProvider

Tutte le issue di Nimblesite/DataProvider

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.