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

mariadb 10.2 syntax error #5774

Closed
panayotb opened this issue May 28, 2017 · 3 comments
Closed

mariadb 10.2 syntax error #5774

panayotb opened this issue May 28, 2017 · 3 comments

Comments

@panayotb
Copy link

Roundcube 1.2.5
MariaDB 10.2

MariaDB does not like when 'rows' is used as column name. The query is in rcube_contacts.php
in "private function _count()"

Error log:

26-May-2017 19:59:33 +0300]: DB Error: [1064] 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 'rows FROM contacts AS c WHERE c.del <> 1 AND c.user_id = '2' AND ((((emai' at line 1 (SQL Query: SELECT COUNT(c.contact_id) AS rows FROM contacts AS c WHERE c.del <> 1 AND c.user_id = '2' AND ((((emailLIKE '[email protected]' ORemailLIKE '[email protected],%' ORemailLIKE '%,[email protected],%' ORemail` LIKE '%,[email protected]'))))) in /var/www/roundcube/program/lib/Roundcube/rcube_db.php

@alecpl
Copy link
Member

alecpl commented May 28, 2017

It is indeed reserved word in MySQL. I suppose we can just rename that alias to cnt.

@alecpl
Copy link
Member

alecpl commented May 28, 2017

Fixed.

@andipfaff
Copy link

The correct syntax if using reserved words should be:
... AS rows FROM contacts ...

use backticks to enclose reserved word

markscarbrough added a commit to markscarbrough/roundcubemail that referenced this issue Jul 3, 2019
Backported from 1.3 release to the 1.1 LTS release.
markscarbrough added a commit to markscarbrough/roundcubemail that referenced this issue Jul 3, 2019
Fix SQL syntax error on MariaDB 10.2 (roundcube#5774), backported from 1.3 release to the 1.1 LTS release.
alecpl pushed a commit that referenced this issue Aug 10, 2019
Backported from 1.3 release to the 1.1 LTS release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants