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

Đang mở
#84 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
csharp, postgresql, sqlite
Lĩnh vực
compilers, databases

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
C#
Star
68
Fork
4
Merge trung bình
50 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Nimblesite/DataProvider

Tất cả issue của Nimblesite/DataProvider

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.