[OpenSIPS-Users] Osipconsole doesn't support Postgres :-(

Gordon Ross gr306 at ucs.cam.ac.uk
Wed Jul 1 22:15:33 CEST 2009


I've been (trying) to play with OpenSIPS with the Postgres database. Unfortunately, I've come to an unhappy conclusion. osipconsole doesn't actually work with Postgres. However, opensipctl works fine.

The problem is the use of the double & single quote characters to enclose strings in SQL queries. osipconsole uses double quotes: e.g.

SELECT * FROM SUBSCRIBERS WHERE username = "1234";

Whereas opensipctl uses single quotes:

SELECT * FROM SUBSCRIBERS WHERE username = '1234';

For postgres, string values need to be enclosed in single quotes, not double quotes. Double quotes indicates a column name.

Look at the simple command below:

OpenSIPS$:add 1234 at blah 1234
Used database is PostgreSQL
1234 blah
Entry could not be retrieved from tableERROR:  column "1234" does not exist

	Query results:
================================================

Retrieving user 1234 at blah from dbaliases failedERROR:  column "1234" does not exist

	Query results:
================================================
Alias 1234 at blah does not exist!
Introducing the new user 1234 at blah to subscriber table failedERROR:  column "1234" does not exist


Doing the same with opensipctl:

vm3:~ # /usr/local/sbin/opensipsctl add 2345 at blah 1234
pgsql_query: /usr/bin/psql  -A -q -t -P fieldsep='	' -h localhost -U opensips opensips -c 'insert into subscriber (username,				domain,ha1,ha1b,password) 			values ('2345','blah','6bc52aec50b4af97f338b0d406234afa','5cb004acd453ef4e8548dfb19ab23ae4','1234');'
new user '2345 at blah' added


I manually changed a couple of SQL queries in osipconsole to prove this hypotheses, and with the quote characters changes, osipconsole works fine.

I've logged this as a bug in the tracker (ID 2815413)

GTG


More information about the Users mailing list