Skip to content

fix(clipboard): quote SQL INSERT identifiers with the driver's quote character - #1051

Open
jay23606 wants to merge 2 commits into
TabularisDB:mainfrom
jay23606:fix/sql-insert-quoting
Open

jay23606 wants to merge 2 commits into
TabularisDB:mainfrom
jay23606:fix/sql-insert-quoting

Conversation

@jay23606

Copy link
Copy Markdown

Fixes #1027

Summary

  • Copy as SQL INSERT and the column copy always quoted identifiers with MySQL backticks, so copied SQL for PostgreSQL or SQLite did not run on those databases.
  • The copy helpers take the active driver and quote identifiers with `quoteIdentifier`, which already knows each driver's quote character. `DataGrid` passes `activeDriver`.
  • With no driver, output keeps backticks, so existing callers behave as before.

Test

  • `src/utils/clipboard-sql.test.ts`: Postgres uses double quotes, MySQL keeps backticks, and no driver keeps backticks. The Postgres case fails on `main` and passes with this change.
  • `tsc --noEmit` passes. The clipboard unit tests pass.

🤖 Generated with Claude Code

…character

Copy as SQL INSERT and Copy quoted name always used MySQL backticks, so a
PostgreSQL or SQLite copy produced identifiers the target database rejects.

Pass the active driver through the copy helpers and quote identifiers with
quoteIdentifier. Without a driver the output keeps backticks as before. Add
tests for Postgres, MySQL and the no-driver default.

Fixes TabularisDB#1027
csvIncludeHeaders,
csvDelimiter,
tableName,
driver: activeDriver,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[WARNING]: activeDriver is captured but missing from the useCallback dependency array

copySelectedColumns now reads activeDriver, but its dependency array (lines 1897-1907) does not include it. react-hooks/exhaustive-deps is enabled via reactHooks.configs.flat.recommended in eslint.config.js, so this is a new lint warning. It is also a stale-closure risk: if the active driver changes while the listed deps stay unchanged (for example a panel-scoped connection switch via PanelDatabaseProvider), the memoized callback keeps quoting identifiers with the previous driver's quote character, reintroducing the cross-database quoting bug this PR fixes. Add activeDriver to the dependency array, matching the existing convention for activeSchema at lines 908 and 1250.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

csvIncludeHeaders,
csvDelimiter,
tableName,
driver: activeDriver,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[WARNING]: activeDriver is captured but missing from the useCallback dependency array

copyCellRange now reads activeDriver, but its dependency array (lines 1933-1943) does not include it. react-hooks/exhaustive-deps is enabled via reactHooks.configs.flat.recommended in eslint.config.js, so this is a new lint warning. It is also a stale-closure risk: if the active driver changes while the listed deps stay unchanged (for example a panel-scoped connection switch via PanelDatabaseProvider), the memoized callback keeps quoting identifiers with the previous driver's quote character, reintroducing the cross-database quoting bug this PR fixes. Add activeDriver to the dependency array, matching the existing convention for activeSchema at lines 908 and 1250.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

delimiter: csvDelimiter,
includeHeader: csvIncludeHeaders,
tableName: tableName ?? "table",
driver: activeDriver,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[WARNING]: activeDriver is captured but missing from the useCallback dependency array

copyColumnValues now reads activeDriver, but its dependency array (lines 1962-1972) does not include it. react-hooks/exhaustive-deps is enabled via reactHooks.configs.flat.recommended in eslint.config.js, so this is a new lint warning. It is also a stale-closure risk: if the active driver changes while the listed deps stay unchanged (for example a panel-scoped connection switch via PanelDatabaseProvider), the memoized callback keeps quoting identifiers with the previous driver's quote character, reintroducing the cross-database quoting bug this PR fixes. Add activeDriver to the dependency array, matching the existing convention for activeSchema at lines 908 and 1250.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • src/components/ui/DataGrid.tsx - previous issues resolved
Previous Review Summary (commit c7502b5)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit c7502b5)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 3
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/components/ui/DataGrid.tsx 1893 activeDriver captured in copySelectedColumns but missing from its useCallback dependency array — stale driver quoting after a connection switch; new react-hooks/exhaustive-deps warning
src/components/ui/DataGrid.tsx 1927 activeDriver captured in copyCellRange but missing from its useCallback dependency array — stale driver quoting after a connection switch; new react-hooks/exhaustive-deps warning
src/components/ui/DataGrid.tsx 1958 activeDriver captured in copyColumnValues but missing from its useCallback dependency array — stale driver quoting after a connection switch; new react-hooks/exhaustive-deps warning
Files Reviewed (3 files)
  • src/components/ui/DataGrid.tsx - 3 issues
  • src/utils/clipboard.ts - no issues (driver threading and quoteIdentifier integration verified correct for postgres/mysql/no-driver)
  • src/utils/clipboard-sql.test.ts - no issues (expectations match actual quoteIdentifier output)

Fix these issues in Kilo Cloud


Reviewed by free · Input: 76.8K · Output: 1.1K · Cached: 56.2K

This branch has not been deployed

No deployments
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.

[Bug]: Copy as SQL INSERT and "Copy quoted name" always use MySQL backticks

1 participant