Skip to content

fix(sqllab): quote autocomplete table names that need it#41199

Open
jesperct wants to merge 1 commit into
apache:masterfrom
jesperct:fix/sqllab-autocomplete-quote-table-name
Open

fix(sqllab): quote autocomplete table names that need it#41199
jesperct wants to merge 1 commit into
apache:masterfrom
jesperct:fix/sqllab-autocomplete-quote-table-name

Conversation

@jesperct

@jesperct jesperct commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

SQL Lab autocomplete inserted table names exactly as stored. When a name isn't a simple identifier (it contains spaces or punctuation, or starts with a digit), inserting it verbatim produces invalid SQL. Picking a table like COVID Vaccines from the dropdown gave SELECT * FROM COVID Vaccines, which fails to parse.

This quotes the inserted value with double quotes when the name isn't a simple identifier, doubling any embedded quotes so names containing " stay valid. Simple identifiers are still inserted as-is, and the human-readable label shown in the dropdown is unchanged.

Quoting uses ANSI double-quote identifiers. Dialect-specific quote characters (e.g. backticks on MySQL) would be a reasonable follow-up.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE:
sc102556-before

AFTER:
sc102556-after

TESTING INSTRUCTIONS

  1. In SQL Lab, connect to a database/schema that has a table whose name needs quoting (for example, a name containing a space such as COVID Vaccines).
  2. Start typing the table name in the editor and pick it from the autocomplete dropdown.
    • Before: the name is inserted unquoted (FROM COVID Vaccines) and the query fails to parse.
    • After: the name is inserted quoted (FROM "COVID Vaccines") and runs.
  3. Confirm a normal table name (e.g. simple_table) is still inserted without quotes.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
  • Introduces new feature or API
  • Removes existing feature or API

SQL Lab autocomplete inserted table names verbatim, so picking a name
with spaces or other non-identifier characters (e.g. "COVID Vaccines")
produced invalid SQL. Quote the inserted value with double quotes (and
double any embedded quotes) when the name isn't a simple identifier;
simple names are still inserted as-is. The display label is unchanged.
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.33%. Comparing base (c218dc4) to head (8c307be).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #41199   +/-   ##
=======================================
  Coverage   64.33%   64.33%           
=======================================
  Files        2651     2651           
  Lines      144766   144771    +5     
  Branches    33401    33403    +2     
=======================================
+ Hits        93131    93136    +5     
  Misses      49965    49965           
  Partials     1670     1670           
Flag Coverage Δ
javascript 68.49% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jesperct jesperct marked this pull request as ready for review June 18, 2026 13:44
@dosubot dosubot Bot added the sqllab Namespace | Anything related to the SQL Lab label Jun 18, 2026
@bito-code-review

bito-code-review Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #f1a006

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 8c307be..8c307be
    • superset-frontend/src/SqlLab/components/EditorWrapper/useKeywords.test.ts
    • superset-frontend/src/SqlLab/components/EditorWrapper/useKeywords.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M sqllab Namespace | Anything related to the SQL Lab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant