Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: wrangler d1 execute cannot create tables with reserved words in double quotes #5876

Closed
joshthoward opened this issue May 20, 2024 · 1 comment
Labels
bug Something that isn't working d1 Relating to D1

Comments

@joshthoward
Copy link
Contributor

Which Cloudflare product(s) does this pertain to?

D1

What version(s) of the tool(s) are you using?

3.57.0 Wrangler

What version of Node are you using?

v20.6.1

What operating system and version are you using?

Mac Sonoma

Describe the Bug

Observed behavior

d1 execute <db_name> --command="CREATE TABLE myTable ("group" TEXT);" throws the error ✘ [ERROR] near "group": syntax error at offset 22

Expected behavior

This is valid SQLite syntax and shouldn't throw.

Steps to reproduce

N/A

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

@joshthoward joshthoward added the bug Something that isn't working label May 20, 2024
@penalosa penalosa added the d1 Relating to D1 label May 22, 2024
@penalosa
Copy link
Contributor

This is probably because of your shell's quoting behaviour. If the exact command you're running is wrangler d1 execute <db_name> --command="CREATE TABLE myTable ("group" TEXT);" then Wrangler will see the string CREATE TABLE myTable (group TEXT); (without the quotes).

To make this work as expected, you'll need to escape the inner quotes: wrangler d1 execute <db_name> --command="CREATE TABLE myTable (\"group\" TEXT);".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working d1 Relating to D1
Projects
Status: Done
Development

No branches or pull requests

2 participants