← 输入框|github.com|刷新
Skip to content

[SQL] Escape SQL identifiers in generated Rust string literals - #7776

Merged
mihaibudiu merged 1 commit into
mainfrom
escape-rust-identifiers
Nov 1, 2026
Merged

mihaibudiu merged 1 commit into
mainfrom
escape-rust-identifiers

Conversation

@mihaibudiu

Copy link
Copy Markdown
Contributor

Although we already have functions to escape identifiers in generated code, we were not using them everywhere.

Checklist

  • Unit tests added/updated

Signed-off-by: Mihai Budiu <mbudiu@feldera.com>
@mythical-fred-oss

Copy link
Copy Markdown
Contributor

LGTM.

What I ran

  • ./build.sh and mvn test -pl SQL-compiler -Dtest=CatalogTests: 43/43 passed. This includes the new identifierEscaping test, whose generated Rust is also compiled by the batched Rust check.
  • Utilities.rustRawString in jshell, all correct:
Input Output
abc r#"abc"#
a"#b r##"a"#b"##
a"##b"# r###"…"###
trailing " r#"a""#
contains CR falls back to the escaped "a\\rb"
" followed by 254 / 255 # 255 hashes / falls back to the escaped form

I also looked for other places that write user-controlled strings into generated Rust. Preprocessor and postprocessor names are already rejected unless they are valid Rust identifiers. Merkle and operator hashes are generated internally, so they cannot carry user text.

@mihaibudiu
mihaibudiu added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 1cf8a65 Nov 1, 2026
3 checks passed
@mihaibudiu
mihaibudiu deleted the escape-rust-identifiers branch November 1, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants