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

MySqlPlatform::getListTableColumnsSQL() is not escaping names #2436

Closed
sadortun opened this issue Jul 3, 2016 · 5 comments
Closed

MySqlPlatform::getListTableColumnsSQL() is not escaping names #2436

sadortun opened this issue Jul 3, 2016 · 5 comments

Comments

@sadortun
Copy link

sadortun commented Jul 3, 2016

Hi !

When creating by accident a table that contain a \ in the name, abc\ The migration fail to read and escape correctly the table names.

$ php app/console oro:platform:update --env dev --force
Process migrations...

[Doctrine\DBAL\Exception\SyntaxErrorException]
An exception occurred while executing 'SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA
 AS E  xtra, COLUMN_COMMENT AS Comment, CHARACTER_SET_NAME AS CharacterSet,  OLLATION_NAME AS Collation FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'asdf' AND TABLE   _NAME = ''abc\'':

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the ri
ght syntax to use near ''oro_tag_taxonomy\'' at line 1
@Deltachaos
Copy link
Contributor

Deltachaos commented Jul 5, 2016

@sadortun i think this has todo with the behaivor of the quote strategy which is not escaping reserved fieldnames per default. This behaivor may change due to doctrine/orm#5903.
Beside that i think migrations are a feature of the ORM.

Or i am wrong @Majkl578 @deeky666 ?

@sadortun
Copy link
Author

sadortun commented Jul 5, 2016

@Deltachaos Thanks. Please me know if you believe it's an internal issue, or an issue with the library client. If it's the case i'll re-open the bug on their side

@deeky666
Copy link
Member

deeky666 commented Jul 6, 2016

This is an edge that has to be dealt with in DBAL. This is not about reserved keywords but about escape characters in column names passed into the metadata SQL (it seems).

@deeky666
Copy link
Member

deeky666 commented Jul 7, 2016

Fix supplied in #2442

@github-actions
Copy link

github-actions bot commented Aug 7, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants