Search code examples
postgresqlejabberd

ejabberd and "call to undefined function pgsql:squery"


I'm using ejabberd 18.04 on debian 9 and postgresql. I can create a user and I see it in the users table. I can log in through the client and through webadmin. Hence ejabberd and postgresql work. But when I try to add a user to the roster (module mod_roster is connected), I get the following output:

...
11:49:35.760 [error] gen_fsm <0.397.0> in state session_established terminated with reason: call to undefined function pgsql:squery(<0.418.0>, [<<"begin;">>], 59000)
11:49:35.760 [error] CRASH REPORT Process <0.397.0> with 0 neighbours exited with reason: call to undefined function pgsql:squery(<0.418.0>, [<<"begin;">>], 59000) in p1_fsm:terminate/8 line 760
11:49:35.761 [error] Supervisor 'ejabberd_sql_sup_192.168.56.111' had child 6 started with ejabberd_sql:start_link(<<"192.168.56.111">>, 30000) at <0.397.0> exit with reason call to undefined function pgsql:squery(<0.418.0>, [<<"begin;">>], 59000) in context child_terminated
11:49:35.761 [error] gen_fsm <0.401.0> in state session_established terminated with reason: call to undefined function pgsql:squery(<0.422.0>, [<<"begin;">>], 59000)
11:49:35.765 [error] CRASH REPORT Process <0.401.0> with 0 neighbours exited with reason: call to undefined function pgsql:squery(<0.422.0>, [<<"begin;">>], 59000) in p1_fsm:terminate/8 line 760
11:49:35.776 [error] Supervisor 'ejabberd_sql_sup_192.168.56.111' had child 10 started with ejabberd_sql:start_link(<<"192.168.56.111">>, 30000) at <0.401.0> exit with reason call to undefined function pgsql:squery(<0.422.0>, [<<"begin;">>], 59000) in context child_terminated
...

What does it mean?


Solution

  • I suppose, the error has the answer:

    terminated with reason: call to undefined function pgsql:squery

    This mean that you call undefined function. You need to check:

    1. is included a module or app pgsql in your project
    2. in app or module pgsql try find function squery
    3. Also, need to check documentation of app pgsql, possibly the feature is deprecated or has been removed from versions which you are trying to use.

    Perhaps this function is in pgsql, but it is used in the wrong way, by eg: let's say there is an exported function of the squery with 2 arguments, but in your project it is called with 3 arguments, in this case you will also get an error like - terminated with reason: call to undefined function pgsql:squery.