node-red / node-red/node-red-nodes
Unexpected parsing error in MySQL node
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 13h 57m
- Merged PRs (30d)
- 3
Description
Which node are you reporting an issue on?
MySQL
What are the steps to reproduce?
Set this query as tobic and run:
INSERT INTO homeassistant.entity_attributes_import (entity_id, attribute, value) VALUES ('media_player.skynetone', 'entity_picture', '/api/media_player_proxy/media_player.skynetone?token=1452c5572b1d7c02b1530d22f002cf7f135ee1d8ef8d429772ea052922ac8f41&cache=0f2f2623bb4719af');
SQL to create the table:
CREATE TABLE
entity_attributes_import (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
entity_id varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
attribute varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
value varchar(4000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
createTime timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (id),
UNIQUE KEY entity_attribute_value (entity_id, attribute, value) USING HASH,
UNIQUE KEY attribute_value_entity (attribute, value, entity_id) USING HASH
) ENGINE = InnoDB AUTO_INCREMENT = 398 DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci
What happens?
I get an error:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'media_player.skynetone', 'entity_picture', '/api/media_player_proxy/media_pla...' at line 1
What do you expect to happen?
There is no error in the syntax (afaik) and the query runs just fine from other tools (copy pasted) so it should run
Please tell us about your environment:
- Node-RED version: 3.0.2 (home assistant)
- node.js version: Unknown
- npm version: Unknown
- Platform/OS: (Home Assistant)
- Browser: (chrome)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the MySQL node and reproduce the reported INSERT query using the supplied table definition and MariaDB environment details. Compare the query that runs in other tools with what the node sends; done means the same valid query runs without a SQL syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mysql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100