Skip to content

csv-table-name: reject invalid SQLite identifiers up front#1044

Open
c-tonneslan wants to merge 1 commit into
tursodatabase:mainfrom
c-tonneslan:fix/csv-table-name-validate
Open

csv-table-name: reject invalid SQLite identifiers up front#1044
c-tonneslan wants to merge 1 commit into
tursodatabase:mainfrom
c-tonneslan:fix/csv-table-name-validate

Conversation

@c-tonneslan
Copy link
Copy Markdown

Closes the validation half of #810 (the hex-stderr half is in #1042).

`.import` interpolates the table name directly into a `CREATE TABLE` statement, so passing a name with a dash or a quote produced a cryptic sqlite syntax error that the user had to decode. Validate the name as a conventional unquoted SQLite identifier (letter or underscore, then letters / digits / underscores) before invoking sqlite3 so the user gets an actionable error instead.

.import interpolates the table name directly into a CREATE TABLE
statement, so passing something with a dash or a quote produced a
cryptic sqlite syntax error that the user had to decode. Validate
the name as a conventional unquoted SQLite identifier (letter or
underscore, then letters / digits / underscores) before invoking
sqlite3 so the message is actionable.

Closes the validation half of tursodatabase#810.

Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
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.

1 participant