storage icon indicating copy to clipboard operation
storage copied to clipboard

Web SQL Query Client Errors

Open fullnelson14 opened this issue 2 years ago • 4 comments

Using the Web Query Client for Vercel Storage, in the Data section, I cannot run any SQL queries. At first, I thought it may be the syntax of the queries as the (very short) error message suggests, although the queries were generated with a SQL dump tool.

That doesn't appear to be the case, as I ran the SQL query through several online SQL validators, all of which claimed that the query is valid SQL for Postgres. Now, I am by no means experienced in Postgres, so perhaps there is something I am missing, but as it stands, I don't understand why the query won't work. The tables exist, as can be seen in the 'Browse' tab.

Here's a screenshot: image

And here's an example query that doesn't work:

INSERT INTO `Block`(`id`,`moduleId`,`type`,`content`,`link`,`imgPublicId`,`linkLabel`) VALUES
(23,15,0,"Congrats on completing the introduction to custom keyboards! You should now be ranked as a \"Rookie\". See the rest of our paths for more specific journeys!","",NULL,"Click Here"),
(24,14,0,"Custom Keys are one of the main reasons that people choose to make a custom keyboard. See these few links to learn about the main types of custom keys: MX Cherrys, and Chocos","",NULL,"Click Here"),
(25,14,1,"","https://www.cherrymx.de/en",NULL,"Click Here");

fullnelson14 avatar Jul 29 '24 22:07 fullnelson14

I tried taking out the tick marks, as the error suggests, and still no dice. Perhaps there is something special about this SQL client?

fullnelson14 avatar Jul 29 '24 22:07 fullnelson14

Hey @fullnelson14 here's a query that will work for you (AI fixed!):

INSERT INTO Block (id, moduleId, type, content, link, imgPublicId, linkLabel) VALUES
(23, 15, 0, 'Congrats on completing the introduction to custom keyboards! You should now be ranked as a \"Rookie\". See the rest of our paths for more specific journeys!', '', NULL, 'Click Here'),
(24, 14, 0, 'Custom Keys are one of the main reasons that people choose to make a custom keyboard. See these few links to learn about the main types of custom keys: MX Cherrys, and Chocos', '', NULL, 'Click Here'),
(25, 14, 1, '', 'https://www.cherrymx.de/en', NULL, 'Click Here');

vvo avatar Jul 31 '24 10:07 vvo

Thanks for the direction!

For anyone that may need it: This doesn't actually work still, although its a step in the right direction.

  1. All of the backtick marks needed to be removed.
  2. Change all of the double quotes within the data to be single quotes.
  3. The table name needed to be surrounded in double quotes (in this case "Block").
  4. Any capital lettering found in a column name meant that that specific column name needed to be surrounded in double quotes (in this case: id, "moduleId", type, content, link, "imgPublicId", "linkLabel").

While I don't know the ins and outs of SQL, it looks like any word with capital letters in it needed to be surrounded by double quotes. I'm not sure if this is a SQL thing, a PostgreSQL thing, a Vercel thing, or a mix of all of them. Anyway, it is finally working to put in data on the web console.

fullnelson14 avatar Jul 31 '24 21:07 fullnelson14

Hey @fullnelson14 thanks for the detailed answer here. For some reason you said This doesn't actually work still but I was able to make it work with the exact query I sent in the issue answer. Example:

https://github.com/user-attachments/assets/8bc1ce19-8425-4f7d-be4c-abe0035f0755

Perhaps something else broke on your side? Thanks 👍

vvo avatar Aug 01 '24 08:08 vvo