[sr-dev] [kamailio/kamailio] Missing options for psql in pgsql_ro_query prevents usage of kamctl (#1750)

Victor Seva notifications at github.com
Mon Dec 3 12:07:26 CET 2018


>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 at 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 at 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 or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1750
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20181203/b8ef1fa9/attachment.html>


More information about the sr-dev mailing list