[ejabberd] src/odbc/mysql.sql patch

Badlop badlop at gmail.com
Mon Mar 7 13:54:00 MSK 2011

2011/3/5 bekanosky <bekanosky at gmail.com>:
> Hi,
> When i import mysql.sql from git master, it give me error:

In ejabberd master branch, the tables are created automatically by ejabberd.
I don't find this explanation in the ejabberd Guide, so I've created
this ticket:

You only need to create the database, grant access to a user, and configure in
ejabberd.cfg the option
{odbc_server, ....}.

> ERROR 1072 (42000) at line 50: Key column 'username' doesn't exist in table.
> The patch below solve the import problem. But i don't know if this is the
> correct solution or not.
> diff --git a/src/odbc/mysql.sql b/src/odbc/mysql.sql
> index 2e2d672..55cd3d2 100644
> --- a/src/odbc/mysql.sql
> +++ b/src/odbc/mysql.sql
> @@ -49,7 +49,7 @@ CREATE TABLE last (
>  CREATE TABLE rosteritem (
>     host varchar(250) NOT NULL,
> -    user varchar(250) NOT NULL,
> +    username varchar(250) NOT NULL,
>     jid varchar(250) NOT NULL,
>     name text,
>     subscription text NOT NULL,

In reality, the field 'username' in table rosteritem was renamed to 'user'.
I found several other parts of the sql that are obsolete.

In case you wonder about other potentially erroneous database tables,
please check the comments at the beginning of modules,
because I try those comments to be the most uptodate.
For example, in mod_roster.erl you will find
%%% 3.0.0-alpha / odbc / rosteritem
%%%  user = varchar250
%%%  host = varchar250
%%%  jid = varchar250

Anyway, thanks for alpha-testing ejabberd master, and reporting a
possible bug :)


More information about the ejabberd mailing list