Skip to content

Correctly escape backticks in MySQL identifiers#357

Open
jonasfj wants to merge 1 commit into
masterfrom
mysql-backtick-escaping-fix-10846423631410528515
Open

Correctly escape backticks in MySQL identifiers#357
jonasfj wants to merge 1 commit into
masterfrom
mysql-backtick-escaping-fix-10846423631410528515

Conversation

@jonasfj

@jonasfj jonasfj commented Mar 27, 2026

Copy link
Copy Markdown
Member

The escape function in mysql_dialect.dart was incorrectly wrapping identifiers in backticks without escaping any existing backticks within the identifier string. This fix updates the function to double any backticks found in the name before wrapping it in backticks, which is the standard MySQL requirement for escaping identifiers. A new unit test file, typed_sql/test/dialect/mysql_escape_test.dart, was added to verify the fix and prevent future regressions. Verification was performed with a standalone Dart script as the package test environment was experiencing timeouts.


PR created automatically by Jules for task 10846423631410528515 started by @jonasfj

Update the `escape` function in `mysql_dialect.dart` to escape
backticks by doubling them, adhering to MySQL identifier escaping rules.

This also adds a unit test in `typed_sql/test/dialect/mysql_escape_test.dart`
to verify the correct behavior.

Co-authored-by: jonasfj <149732+jonasfj@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

});

test('multiple backticks', () {
expect(escape('`a``b`'), '```a````b```');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

@isoos

isoos commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

I think generated files may need an update.

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