Khan / Khan/live-editor

Escaping table names in SQL environment does not work.

Open
#336 0 comments 0 reactions 0 assignees View on GitHub
bug sql
Dominant language
JavaScript
Stars
776
Forks
180
PR merge metrics
No merged PRs in 30d

Description

Reported on ZenDesk.

"It appears that the ability to escape a table name in a CREATE TABLE statement has either been disabled or has suffered a bug. Escaping appears to work correctly for column names and for table names in the INSERT and SELECT statements. For example, none of the following work (but should):

CREATE TABLE [my Table1](id INTEGER);
CREATE TABLE 'my Table2' (id INTEGER);
CREATE TABLE "my Table3" (id INTEGER);
CREATE TABLE `my Table4` (id INTEGER);

Column escaping appears to be working well:
CREATE TABLE test ('my id' INTEGER);
INSERT INTO test VALUES (123);
SELECT [my id], "my id", `my id` FROM test;

The following appears as though it would work, except that it can't find the named table:
INSERT INTO [my Table1] VALUES (1);
INSERT INTO 'my Table2' VALUES (2);
SELECT \* FROM "my Table3";
SELECT \* FROM `my Table4`;"

CREATE TABLE [my Table1](id INTEGER);
CREATE TABLE 'my Table2' (id INTEGER);
CREATE TABLE "my Table3" (id INTEGER);
CREATE TABLE `my Table4` (id INTEGER);
"

It does seem to work on http://kripken.github.io/sql.js/GUI/, so it is likely an issue in our code somewhere.

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is identified in the report. Start by locating the SQL CREATE TABLE handling in the browser-based live coding environment and reproduce the four quoted table-name cases; compare with the stated column-name behavior and the sql.js GUI. Done means bracketed, single-quoted, double-quoted, and backtick-quoted table names can be created and then referenced.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, sql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.