[SR-Users] kamailio 4.3v partition column name is reserved word in mysq ndbcluster engine

Daniel-Constantin Mierla miconda at gmail.com
Tue Jul 21 13:48:05 CEST 2015


I updated the wiki page putting backticks around column names.

Mysql keep adding to the list of reserved keywords, so using backticks
is the safest in the long term, as current named columns can become
keywords in the future -- e.g., partition was not reserved before v5.6

Cheers,
Daniel

On 20/07/15 19:32, José Seabra wrote:
> I found the root cause of this issue, as i copied the mysql commands
> from this link
> http://www.kamailio.org/wiki/install/upgrade/4.2.x-to-4.3.0 and pasted
> it in mysql client, apparently that was my issue, what i did to fix
> this issue was drop the column and add it again but with this mysql
> command:  
>
> ALTER TABLE location ADD COLUMN `partition` INT(11) DEFAULT 0 NOT NULL;
>
> The difference between  this  mysql command  is that I'm using quotes
> in column name and the mysql commands that are in the link specified
> above doesn't have the quotes in column names.
>
> I shouldn't have copy these commands without fix it.
>
> Thank you for your help.
>
> BR
> José Seabra
>
>
>
> 2015-07-20 17:46 GMT+01:00 José Seabra <joseseabra4 at gmail.com
> <mailto:joseseabra4 at gmail.com>>:
>
>     I changed the column name in the database table from partition to
>     partitionusrloc, and i added a new modparam (partition_col)
>     in modules/usrloc/ul_mod.c  file:
>
>     {"partition_col",       PARAM_STR, &partition_col},
>
>
>     in order to be able to configure the name of this column from
>     partition to partitionusrloc in kamailio module configuration
>     section, with following configuration:
>
>     modparam("usrloc", "partition_col", "partitionusrloc")
>
>     I will enable the mysql log then collect the query log, and reply
>     back to you with this information.
>
>     BR
>     Thank you.
>
>     2015-07-20 17:24 GMT+01:00 Daniel-Constantin Mierla
>     <miconda at gmail.com <mailto:miconda at gmail.com>>:
>
>         Hello,
>
>         the backticks should be added for columns in where condition.
>         Can you enable logging the query in mysql server logs and send
>         it over to see how it looks?
>
>         Or maybe I didn't understand your problem properly and you
>         changed the name in the database table for column partition,
>         but there was no way to change that to usrloc module?
>
>         Cheers,
>         Daniel
>
>
>         On 20/07/15 18:04, José Seabra wrote:
>>         Hello Daniel,
>>
>>         Result of command kamailio -v
>>
>>         version: kamailio 4.3.1 (x86_64/linux) f38e67-dirty
>>         flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS,
>>         USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK,
>>         SHM_MEM, SHM_MMAP, PKG_MALLOC, F_MALLOC, DBG_F_MALLOC,
>>         USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE,
>>         USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
>>         ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144,
>>         MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT
>>         PKG_SIZE 8MB
>>         poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
>>         id: f38e67 -dirty
>>         compiled on 15:56:29 Jul 20 2015 with gcc 4.4.7
>>
>>         Thank you for your support
>>
>>         BR
>>         José Seabra
>>
>>         2015-07-20 16:58 GMT+01:00 Daniel-Constantin Mierla
>>         <miconda at gmail.com <mailto:miconda at gmail.com>>:
>>
>>             Hello,
>>
>>             the names of columns should be quoted in order to be safe
>>             against
>>             reserved keywords.
>>
>>             What is the exact version you are using (kamailio -v)?
>>
>>             Cheers,
>>             Daniel
>>
>>             On 20/07/15 17:37, José Seabra wrote:
>>             > Hello Daniel,
>>             >
>>             > After update my kamailio to version 4.3 and change the
>>             table location
>>             > as required in migration process, kamailio start giving
>>             some errors:
>>             >
>>             > [root at ccp1 kamailio]# 35(7637) ERROR: db_mysql
>>             [km_dbase.c:121]:
>>             > db_mysql_submit_query(): driver error on query: Unknown
>>             column
>>             > 'partition' in 'where clause'
>>             > 35(7637) ERROR: <core> [db_query.c:132]:
>>             db_do_query_internal(): error
>>             > while submitting query
>>             >
>>             > that's is because the column name "partition" is
>>             reserved word
>>             > (http://dev.mysql.com/doc/refman/5.6/en/keywords.html)
>>             in mysql
>>             > ndbcluster engine, so what i did to fix this issue was
>>             add a new
>>             > modparam in
>>             > modules/usrloc/ul_mod.c file:
>>             >
>>             > {"partition_col",       PARAM_STR, &partition_col},
>>             >
>>             >
>>             > with this i can configure what name i want for this
>>             column in kamailio
>>             > module configuration and configure a diferent column
>>             name in  table
>>             > location(ex: modparam("usrloc", "partition_col",
>>             "partitionusrloc") ),
>>             >  Can you please check out if what i did is the correct
>>             way to fix it,
>>             > in order to avoid damage something else.
>>             >
>>             > Best regards
>>             > --
>>             > Cumprimentos
>>             > José Seabra
>>
>>             --
>>             Daniel-Constantin Mierla
>>             http://twitter.com/#!/miconda
>>             <http://twitter.com/#%21/miconda> -
>>             http://www.linkedin.com/in/miconda
>>             Book: SIP Routing With Kamailio - http://www.asipto.com
>>
>>
>>
>>
>>         -- 
>>         Cumprimentos
>>         José Seabra
>
>         -- 
>         Daniel-Constantin Mierla
>         http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> - http://www.linkedin.com/in/miconda
>         Book: SIP Routing With Kamailio - http://www.asipto.com
>
>
>
>
>     -- 
>     Cumprimentos
>     José Seabra
>
>
>
>
> -- 
> Cumprimentos
> José Seabra

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Book: SIP Routing With Kamailio - http://www.asipto.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150721/216308eb/attachment.html>


More information about the sr-users mailing list