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

未关闭
#84 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
csharp, postgresql, sqlite

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.
主要语言
C#
星标
68
派生
4
平均合并
50 分钟
30 天内合并 PR
2

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Nimblesite/DataProvider 的其他 Issue

查看 Nimblesite/DataProvider 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。