Skip to content

column names are not escaped when creating indexes #259

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

Closed
ernie58 opened this issue Apr 14, 2017 · 2 comments
Closed

column names are not escaped when creating indexes #259

ernie58 opened this issue Apr 14, 2017 · 2 comments
Assignees
Labels

Comments

@ernie58
Copy link

ernie58 commented Apr 14, 2017

Description/Steps to reproduce

  • Make a model with a property named 'from' (e.g. in a Message-Model)
  • Add an index for the property in the JSON definition file
  • run autoupdate on the datasource

Mysql errors with a PARSE_ERROR

Expected result

CREATE TABLE `Message` (
  `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `conversation` VARCHAR(512) NULL,
  `text` VARCHAR(512) NOT NULL,
  `created` DATETIME NOT NULL,
  `from` INT(11) NULL,
  `lastUpdated` DATETIME NULL,
  `deleted` TINYINT(1) NOT NULL,
   INDEX  `from_index` (`from`),
   INDEX  `conversation_index` (conversation)
)

Actual result which causes PARSE_ERROR by not escaping from

CREATE TABLE `Message` (
  `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `conversation` VARCHAR(512) NULL,
  `text` VARCHAR(512) NOT NULL,
  `created` DATETIME NOT NULL,
  `from` INT(11) NULL,
  `lastUpdated` DATETIME NULL,
  `deleted` TINYINT(1) NOT NULL,
   INDEX  `from_index` (from),
   INDEX  `conversation_index` (conversation)
)
@ssh24
Copy link
Contributor

ssh24 commented Apr 19, 2017

Seems like a bug to me. Here is a list of reserved keywords in MYSQL and from is one of them.

@ernie58 Are you willing to submit a patch to fix this?

@ssh24 ssh24 added the bug label Apr 19, 2017
darknos referenced this issue Apr 27, 2017
* Fixed the different column name in datasource

Issue #250

* Added test to change the nullable property

* moved the code from the function into test block
@ssh24 ssh24 self-assigned this May 9, 2017
@kjdelisle kjdelisle added this to the Sprint 36 - Apex milestone May 15, 2017
@ssh24
Copy link
Contributor

ssh24 commented May 19, 2017

Closing this ticket. Issue should be fixed on the next available mysql connector release.

@ssh24 ssh24 closed this as completed May 19, 2017
@ssh24 ssh24 removed the review label May 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants