<p>From <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906233" rel="nofollow">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906233</a></p>
<blockquote>
<p>In the current version missing command line options for the<br>
read-only psql call (in pgsql_ro_query) prevents usage of<br>
kamctl for PostgreSQL backend, e.g. when adding a <em>new</em> user:</p>
</blockquote>
<blockquote>
<p>root@debian9 ~ # kamctl add phone_u phone_p<br>
database engine 'PGSQL' loaded<br>
Control engine 'FIFO' loaded<br>
is_user: user counter=1<br>
INFO: user 'phone_u' already exists</p>
</blockquote>
<blockquote>
<p>This is because the psql query returns the correct result<br>
(0 in this case) but the pgsql_ro_query function lacks the<br>
psql options -A -q -t as defined.</p>
</blockquote>
<blockquote>
<p>As a result the query contains the result and the coloumn name and<br>
footer,e.g. in this case:</p>
</blockquote>
<pre><code>root@debian9 ~ # /usr/bin/psql -h localhost -U kamailioro kamailio \
-c "select count(*) from subscriber where username='phone_u';"
 count
 -------
      0
      (1 row)
</code></pre>
<blockquote>
<p>In this example the "kamctl add" command looks at the last line of the<br>
output to check if the user is already defined and misinterprets the<br>
result as it expectes "0" as the result.</p>
</blockquote>
<blockquote>
<p>This affect not only the "kamctl add" command but most calls that calls<br>
$DBROCMD in kamctl.</p>
</blockquote>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1750">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZU2juSe0TN8Gudt5bQl3wVmVPZmTks5u1QXugaJpZM4Y-W4W">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZbF74QMBJloZ1UdO7NiI_GlUueDjks5u1QXugaJpZM4Y-W4W.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Missing options for psql in pgsql_ro_query prevents usage of kamctl (#1750)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1750"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1750",
"url": "https://github.com/kamailio/kamailio/issues/1750",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "Missing options for psql in pgsql_ro_query prevents usage of kamctl (#1750)",
"sections": [
{
"text": "",
"activityTitle": "**Victor Seva**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@linuxmaniac",
"facts": [
{
"name": "Repository: ",
"value": "kamailio/kamailio"
},
{
"name": "Issue #: ",
"value": 1750
}
]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1750,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1750\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/kamailio/kamailio/issues/1750"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 418999830\n}"
}
],
"themeColor": "26292E"
}
]</script>