I’m trying to use asterisk realtime with postgreSQL but getting the following error:
[Jun 4 10:39:13] ERROR[3352312]: res_odbc.c:280 ast_odbc_find_table: Unable to query database columns on connection ‘postgres’.
[Jun 4 10:39:13] WARNING[3352312]: res_odbc.c:538 ast_odbc_print_errors: SQL Execute returned an error: 42601: ERROR: syntax error at or near “WHERE”; Error while preparing parameters
it appears to be working as expected apart from receiving lots of the above errors (2 every time there is a registration).
odbcinst.ini
[ODBC]
Trace = yes
TraceFile = /tmp/odbctrace.log
[FreeTDS]
Description=FreeTDS MSSQL Driver
Driver=/usr/lib64/libtdsodbc.so.0
UsageCount=1
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib64/psqlodbc.so
UsageCount = 2
odbc.ini
[postgres-connector]
Driver=PostgreSQL
Description=postgres IVR database
Servername=server.server.net
Port=5432
Database=asterisk
sslmode=require
TraceFile = /tmp/odbc.trace
Trace = 1
ShowOidColumn = No
Protocol = 7.4+
res_odbc.ini
[postgres]
enabled => yes
dsn => postgres-connector
pooling => yes
limit => 50
username => -----------
password => ----------
pre-connect => yes
backslash_is_escape => yes
extconfig.conf
[settings]
sippeers => odbc,postgres,registration.sip_conf
This is on asterisk version 16.18.0, unixODBC version 2.3.7-1, postgresql-odbc version 10.03.0000-2
any help / advice would be much appreciated.
After some more investigation it’s looking more likely to be an issue with unixODBC or postgres-odbc rather then asterisk itself…
connecting using isql and running “help roles” I get the following error:
[S1000]Error while executing the query
[ISQL]ERROR: Could not SQLColumns
looking through asterisk source it’s a failing call to SQLColumns which is causing the error to appear in the CLI (res_odbc.c line 277)
anyone else experienced a similar issue?