vscode-sqltools: MySQL/MariaDB Error: Cannot destructure property 'name' of 'undefined' as it is undefined

Issuehunt badges

OS: Windows 10 Pro 64 bit MariaDB: 10.3.12 VSCode: 1.50.1 SQLTools: 0.23.0 SQLTools MySQL/MariaDB: 0.2.0

Description A ~250 line (with comments) SQL script was working correctly in both the MySQL console (mysql command) and in SQLTools (SQLT).

I then added a simple “print status” type command in the script, of the form-

SELECT CONCAT(
	'Output written to: ', @OutputDirectory, @FileName
)  AS  '';

Originally I had a syntax error, so the script was failing in both environments, but having fixed the error, the script runs ok in the console but continues to fail when run from VSCode with the error:

Cannot destructure property 'name' of 'undefined' as it is undefined

Note: If I try to copy+paste the text of the console error into this bug report the result is: [object Object] not sure if that is significant?

To Reproduce (see attachment)

Expected behavior Script runs and writes the text to the console:

+-------------------------------------------------------------------------------------+
|                                                                                     |
+-------------------------------------------------------------------------------------+
| Output written to: C:/Windows/Temp/der2_cciRefset_RefsetDescriptorDelta_GB_20201024 |
+-------------------------------------------------------------------------------------+

VSTools test case.sql.txt


IssueHunt Summary

Backers (Total: $10.00)

Become a backer now!

Or submit a pull request to get the deposits!

Tips

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 7
  • Comments: 22

Commits related to this issue

Most upvoted comments

Really enjoy SQL tools in vs-code. Just running basic select statements with 1 join and a where/ group by and the only way not to get the error: Cannot destructor property ‘name’ of ‘undefined’ as it is undefined Is to take the comments out. Not to bad on small queries but with my longer complex queries and procedures I have to comment through out the script. Going to send a small donation and prayer this gets resolved cause I love the platform and the extension.

This error occurred to me when I try to execute CREATE TABLE statements. The interesting part is, that table was CREATED. So SQL executed successfully. I think it’s a problem with display of results.

it seems this extension has probably been abandoned.

It hasn’t been abandoned. I am one of the new maintainers, and the original developer is still involved as far as his day job and non-work life permits.

Did this have a solution? Has anyone successfully removed that warning? I have problems even with the code CREATE TABLE ... But the table was created successfully, so what does that mean?

I believe it means the code is running correctly but the extension is failing to parse the data being returned by the server correctly. Unfortunately I don’t see any responses from the developer here so it seems this extension has probably been abandoned.

Something that I just discovered…SQLTools does not seem to like Commenting. I’ve been watching this tutorial which introduced me to SQLTools and it works fine in the tutorial but did not for me. https://www.youtube.com/watch?v=Cz3WcZLRaWc What I was doing however was commenting out the previous tests, to save them so I could go back and look at them later. Then I would put the new code ABOVE the commented text, assuming it would ignore everything that was commented out.

Apparently NOT. When I moved the NEW code underneath the commented out code it worked with out the error we are all experiencing. See my code below.

Interestingly, because I was so familiar with using PHP and MySQL and using PHPMyAdmin to check things I found that even with some of those errors, like the INSERT INTO, it still did do the INSERT, even with the error. (I checked PHPMyAdmin).

So this might help some of you, although it is still a bug, all comments should be ignored. Most of you just post the code that is failing but not your full code do I don’t know if you have comments before your code.

If I put the SELECT * right under the – @BLOCK it fails.

I hope this helps some of you.

UPDATE: (A Few minutes later) - I used the code block but it didn’t appear as code so attached is a pic of my code. vscodesqltools

-- @BLOCK -- CREATE TABLE Users( -- id INT PRIMARY KEY AUTO_INCREMENT, -- email VARCHAR(255) NOT NULL UNIQUE, -- bio TEXT, -- country VARCHAR(2CREATE TABLE Users( -- id INT PRIMARY KEY AUTO_INCREMENT, -- email VARCHAR(255) NOT NULL UNIQUE, -- bio TEXT, -- country VARCHAR(2) -- );) -- ); -- SELECT * FROM Users; -- INSERT INTO Users (email, bio, country) -- VALUES -- ('hellow2@world.com', 'foo', 'MX'), -- ('dewi1@lorddewi.com', 'Dewi', 'US'), -- ('david1@daviddevaneyjr.com', 'David', 'US'); SELECT * FROM Users;