From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906233

In the current version missing command line options for the
read-only psql call (in pgsql_ro_query) prevents usage of
kamctl for PostgreSQL backend, e.g. when adding a new user:

root@debian9 ~ # kamctl add phone_u phone_p
database engine 'PGSQL' loaded
Control engine 'FIFO' loaded
is_user: user counter=1
INFO: user 'phone_u' already exists

This is because the psql query returns the correct result
(0 in this case) but the pgsql_ro_query function lacks the
psql options -A -q -t as defined.

As a result the query contains the result and the coloumn name and
footer,e.g. in this case:

root@debian9 ~ # /usr/bin/psql -h localhost -U kamailioro kamailio \
-c "select count(*) from subscriber where username='phone_u';"
 count
 -------
      0
      (1 row)

In this example the "kamctl add" command looks at the last line of the
output to check if the user is already defined and misinterprets the
result as it expectes "0" as the result.

This affect not only the "kamctl add" command but most calls that calls
$DBROCMD in kamctl.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.