processone / processone/ejabberd

importing sql give ERROR 1364 (HY000) at line : Field 'server_host' or 'type' doesn't have a default value

Open
#4,548 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Erlang
Stars
6.7k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Before creating a ticket, please consider if this should fit the discussion forum better.

Environment

  • ejabberd version: 23.10
  • Erlang version: erl +V
  • OS: Linux (Arch)
  • Installed from: official binary installer

Configuration (only if needed): grep -Ev '^$|^\s*#' ejabberd.yml

loglevel: 4
...

Errors from error.log/crash.log

No errors

Bug description

I'm stuck still here : https://github.com/processone/ejabberd/issues/4199

I don't know if is right that is fault of the environment as stated by "mremond" . Now i have a full machine (no virtualization) . I copied the 32.10 installation in the new system and it work fine.
Some day ago I faced the error of conversations that basically claim that the ejabberd version is too old (TLS stuff).
So I keep some courage and tried to export the database Mnesia to a SQL file following this guide:
https://www.process-one.net/blog/install-and-configure-mariadb-with-ejabberd/
Everything go fine till the import of the /tmp/mnesia.sql
To say the true I have to use the option --no-timeout during the exportation of the db otherwise was reported an error of timeout) Then...
When I import the database I receive this error:

[root@arch-nas bin]# mariadb -h localhost -D ejabberd -u ejabberd -p < /tmp/mnesia.sql
Enter password:
--------------
INSERT INTO users(username, password) VALUES ('daniele', 'xxxx')
--------------

ERROR 1364 (HY000) at line 5: Field '**type**' doesn't have a default value
[root@arch-nas bin]#

If I do not import the schema before launching ejabberd , but instead I launch ejabberd with the option "update_sql_schema: true" and "new_sql_schema: true" It create a schema (probably not really updated) and ejabber do start regularly (but empty) and if I try to import the /tmp/mnesia.sql the error is similar :

[root@arch-nas bin]# mariadb -h localhost -D ejabberd -u ejabberd -p < /tmp/mnesia.sql
Enter password: 
--------------
INSERT INTO users(username, password) VALUES ('daniele', 'xxxx')
--------------

ERROR 1364 (HY000) at line 5: Field '**server_host**' doesn't have a default value
[root@arch-nas bin]# 

If I try to update the schema with the command : [root@arch-nas bin]# ./ejabberdctl update_sql /tmp/mnesia.sql
I got his :
Unhandled exception occurred executing the command: ** exception error: bad argument in function lists:member/2 called as lists:member(gen_mod,undefined) *** argument 2: not a list in call from ejabberd_ctl:print_usage_command2/4 (src/ejabberd_ctl.erl, line 882) in call from ejabberd_ctl:process/2 (src/ejabberd_ctl.erl, line 198) in call from ejabberd_ctl:call_command/4 (src/ejabberd_ctl.erl, line 345) in call from ejabberd_ctl:try_call_command/4 (src/ejabberd_ctl.erl, line 295) in call from ejabberd_ctl:process2/4 (src/ejabberd_ctl.erl, line 235) in call from ejabberd_ctl:process/2 (src/ejabberd_ctl.erl, line 213) in call from erpc:execute_call/4 (erpc.erl, line 589)

I read this : https://docs.ejabberd.im/admin/configuration/database/#database-schema
And also this : https://docs.ejabberd.im/developer/sql-schema/

I'm trapped in the fact that I cannot upgrade the sql schema exported from the mnesia db and consequently I cannot import the sql file in the mysql database (MariaDB).
There is a way to upgrade this sql ?
I don't know how to manually modify the /tmp/mnesia.sql file to match the new requirements.
(ps: now I'm using the Mnesia db. Any attempt to install any newer release make ejabberd stuck at launch without errors , as in the past , see old post) . So i cannot update ejabberd , nor the database.
Any help will be really appreciated :-)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated /tmp/mnesia.sql, the documented SQL schema, and the ejabberdctl update_sql entry point; reproduce the MariaDB import with the reported server_host/type errors. Inspect src/ejabberd_ctl.erl around the reported line 882 and determine what successful schema migration and import should look like.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang, mariadb, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.