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

quoted words reserved by mysql #159

Closed
wants to merge 1 commit into from
Closed

quoted words reserved by mysql #159

wants to merge 1 commit into from

Conversation

odombrovskyi-dev
Copy link

Word partition is reserved by mysql. During the database creation this error appears:

ERROR 1064 (42000) at line 2: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'partition INT(11) DEFAULT 0 NOT NULL,
    CONSTRAINT ruid_idx UNIQUE (ruid)
)' at line 24
ERROR: Creating core tables failed at registrar!

@linuxmaniac
Copy link
Member

Those files are automatically generated, so I would say that we should fix the building process and add quotes by default

@odombrovskyi-dev
Copy link
Author

So, why some files have quoted columns some of the not?

@miconda
Copy link
Member

miconda commented May 13, 2015

Hmm, so partition was introduced as reserved word in mysql 5.6 -- I tested with 5.5. I wouldn't have added it with such name just to avoid headaches with other applications. For that reason, wondering if should be renamed now as we don't have a stable release out with this column name.

And yes, we should fix the tool generating the sql script for mysql to quote table and column names. That will be safe for future when other column names may become reserved.

@miconda
Copy link
Member

miconda commented May 13, 2015

@adombrovsky have you seen sql creation scripts quoted? Checked just few, but none had quoted column names.

We quote them inside Kamailio C code when we do operations.

@juha-h
Copy link
Contributor

juha-h commented May 13, 2015 via email

@odombrovskyi-dev
Copy link
Author

@miconda yes i've seen. For example this file has quoted columns

kamailio/utils/kamctl/mysql/dialog_ng-create.sql

@miconda
Copy link
Member

miconda commented May 13, 2015

@adombrovsky that's an ims module and apparently the IMS devs pushed the sql script directly, not via db schema

@kamailio-sync
Copy link

On 13/05/15 16:14, juha-h wrote:

Daniel-Constantin Mierla writes:

Hmm, so partition was introduced as reserved word in mysql 5.6 -- I
tested with 5.5. I wouldn't have added it with such name just to avoid
headaches with other applications. For that reason, wondering if
should be renamed now as we don't have a stable release out with this
column name.

I would prefer possibility to add the quotes automatically, since
different words may be reserved in different db engines and things can
change from version to version as we have witnessed.

I have all my upgrade scripts done and would not like to see any more
changes in db schema.

Yes, adding quotes has to be done for sure.

I asked about the rename as life using other tools may become easier and
see the opinion of other devs.

Cheers,
Daniel

Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com

@odombrovskyi-dev
Copy link
Author

Guys, i have found another bug related to the partition column. Take a look at this log from kamailio:

May 13 16:22:01 localhost /usr/local/sbin/kamailio[24862]: ERROR: db_mysql [km_dbase.c:121]: db_mysql_submit_query(): driver error on query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'partition ) values ('1000','sip:1000@89.209.124.148:64403;transport=tcp','2015-0' at line 1
May 13 16:22:01 localhost /usr/local/sbin/kamailio[24862]: ERROR: <core> [db_query.c:233]: db_do_insert_cmd(): error while submitting query
May 13 16:22:01 localhost /usr/local/sbin/kamailio[24862]: ERROR: usrloc [ucontact.c:683]: db_insert_ucontact(): inserting contact in db failed
May 13 16:22:01 localhost /usr/local/sbin/kamailio[24862]: ERROR: usrloc [urecord.c:580]: insert_ucontact(): failed to insert in database
May 13 16:22:01 localhost /usr/local/sbin/kamailio[24862]: ERROR: registrar [save.c:507]: insert_contacts(): failed to insert contact
May 13 16:22:17 localhost /usr/local/sbin/kamailio[24861]: ERROR: db_mysql [km_dbase.c:121]: db_mysql_submit_query(): driver error on query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'partition ) values ('1000','sip:1000@89.209.124.148:64403;transport=tcp','2015-0' at line 1
May 13 16:22:17 localhost /usr/local/sbin/kamailio[24861]: ERROR: <core> [db_query.c:233]: db_do_insert_cmd(): error while submitting query
May 13 16:22:17 localhost /usr/local/sbin/kamailio[24861]: ERROR: usrloc [ucontact.c:683]: db_insert_ucontact(): inserting contact in db failed
May 13 16:22:17 localhost /usr/local/sbin/kamailio[24861]: ERROR: usrloc [urecord.c:580]: insert_ucontact(): failed to insert in database
May 13 16:22:17 localhost /usr/local/sbin/kamailio[24861]: ERROR: registrar [save.c:507]: insert_contacts(): failed to insert contact
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: db_mysql [km_dbase.c:121]: db_mysql_submit_query(): driver error on query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'partition ) values ('1000','sip:1000@89.209.124.148:64403;transport=tcp','2015-0' at line 1
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: <core> [db_query.c:233]: db_do_insert_cmd(): error while submitting query
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: usrloc [ucontact.c:683]: db_insert_ucontact(): inserting contact in db failed
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: usrloc [urecord.c:580]: insert_ucontact(): failed to insert in database
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: registrar [save.c:507]: insert_contacts(): failed to insert contact
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: db_mysql [km_dbase.c:121]: db_mysql_submit_query(): driver error on query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'partition ) values ('1000','sip:1000@89.209.124.148:64403;transport=tcp','2015-0' at line 1
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: <core> [db_query.c:233]: db_do_insert_cmd(): error while submitting query
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: usrloc [ucontact.c:683]: db_insert_ucontact(): inserting contact in db failed
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: usrloc [urecord.c:580]: insert_ucontact(): failed to insert in database
May 13 16:22:23 localhost /usr/local/sbin/kamailio[24861]: ERROR: registrar [save.c:507]: insert_contacts(): failed to insert contact
May 13 16:22:24 localhost /usr/local/sbin/kamailio[24861]: ERROR: db_mysql [km_dbase.c:121]: db_mysql_submit_query(): driver error on query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'partition ) values ('1000','sip:1000@89.209.124.148:64403;transport=tcp','2015-0' at line 1
May 13 16:22:24 localhost /usr/local/sbin/kamailio[24861]: ERROR: <core> [db_query.c:233]: db_do_insert_cmd(): error while submitting query
May 13 16:22:24 localhost /usr/local/sbin/kamailio[24861]: ERROR: usrloc [ucontact.c:683]: db_insert_ucontact(): inserting contact in db failed
May 13 16:22:24 localhost /usr/local/sbin/kamailio[24861]: ERROR: usrloc [urecord.c:580]: insert_ucontact(): failed to insert in database
May 13 16:22:24 localhost /usr/local/sbin/kamailio[24861]: ERROR: registrar [save.c:507]: insert_contacts(): failed to insert contact
May 13 16:23:24 localhost /usr/local/sbin/kamailio[24862]: ERROR: db_mysql [km_dbase.c:121]: db_mysql_submit_query(): driver error on query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'partition ) values ('1000','sip:1000@89.209.124.148:64403;transport=tcp','2015-0' at line 1
May 13 16:23:24 localhost /usr/local/sbin/kamailio[24862]: ERROR: <core> [db_query.c:233]: db_do_insert_cmd(): error while submitting query
May 13 16:23:24 localhost /usr/local/sbin/kamailio[24862]: ERROR: usrloc [ucontact.c:683]: db_insert_ucontact(): inserting contact in db failed
May 13 16:23:24 localhost /usr/local/sbin/kamailio[24862]: ERROR: usrloc [urecord.c:580]: insert_ucontact(): failed to insert in database
May 13 16:23:24 localhost /usr/local/sbin/kamailio[24862]: ERROR: registrar [save.c:507]: insert_contacts(): failed to insert contact

@miconda
Copy link
Member

miconda commented May 13, 2015

Closing this pull request, it will not be merged. The discussion will continue on the issue #160

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants