[Home]

Summary:ASTERISK-25628: res_config_pgsql: should match the behavior of other drivers so that queue_log can disable adaptive logging
Reporter:Dmitry Wagin (dmitry2004@yandex.ru)Labels:
Date Opened:2015-12-15 08:12:57.000-0600Date Closed:2017-03-01 10:57:49.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_config_pgsql
Versions:13.6.0 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 0001-res_config_pgsql-Return-1-if-we-can-t-find-a-column.patch
( 1) patch.txt
Description:When column not exist in database require_pgsql() return 0
and other code does not work properly (for example in main/logger.c logger_queue_rt_start()).

res_config_sqlite3 if column not exist and equirements option is set to "warn" return -1.
IMHO need inform other code about troubles.
queue_log do alternative scenario if require return -1
Comments:By: Asterisk Team (asteriskteam) 2015-12-15 08:12:59.651-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Rusty Newton (rnewton) 2015-12-24 13:16:41.421-0600

Often users that are searching the issue tracker are not developers. You need to provide a describe of expected behavior and the behavior you encountered. I don't see either here.



By: Dmitry Wagin (dmitry2004@yandex.ru) 2015-12-24 13:39:22.809-0600

when column does not exist and requirements=warn require_pgsql() return 0 (not -1)
so it does not work correctly logging queue = incorrectly selected column for insert and =>

res_config_pgsql.c:168 in int _pgsql_exec(): PostgreSQL RealTime: Query Failed: INSERT INTO asterisk.queue_log (time, data5, data4, data3, data2, data1, event, agent, queuename, callid) VALUES (...)

res_config_pgsql.c:169 in int _pgsql_exec(): PostgreSQL RealTime: Query Failed because: ERROR:  column "data5" of relation "queue_log" does not exist LINE 1: INSERT INTO asterisk.queue_log ...




By: Joshua C. Colp (jcolp) 2015-12-28 10:19:37.838-0600

When the requirements option is set to "warn" the Postgresql driver outputs a warning and does nothing else. This is what this value is supposed to do. If something subsequently uses the table and expects a column to exist that doesn't then it won't work. If you use the "createclose" or "createchar" values then it will attempt to alter the table to add the column.

What are you expecting to happen in this situation instead?

By: Dmitry Wagin (dmitry2004@yandex.ru) 2015-12-28 10:37:15.288-0600

res_config_sqlite3 if column not exist and equirements option is set to "warn" return -1.
IMHO need inform other code about troubles.
queue_log do alternative scenario if require return -1

By: Joshua C. Colp (jcolp) 2015-12-28 10:46:46.704-0600

Okay, so you are saying that res_config_pgsql should match the behavior of other drivers so that queue_log can disable adaptive logging. Understood now!

By: Dmitry Wagin (dmitry2004@yandex.ru) 2015-12-28 10:50:54.828-0600

IMHO it is logical behavior

By: Rusty Newton (rnewton) 2015-12-29 09:46:16.208-0600

[~dmitry2004@yandex.ru] I'm opening the issue up. Be aware that res_config_pgsql is under extended support. This means it is up to the broader community to provide a patch and walk it through the testing and review process. If you can provide a patch that will typically be the fastest path to resolution.

In the meantime and if you cannot provide a patch then you may consider using res_config_odbc if that works for you.

By: Sean Bright (seanbright) 2017-02-28 12:35:30.423-0600

Please try the attached patch and let us know if it resolves your problem.

By: Dmitry Wagin (dmitry2004@yandex.ru) 2017-03-01 07:20:02.120-0600

Yes, that's what I meant

By: Friendly Automation (friendly-automation) 2017-03-01 10:57:50.855-0600

Change 5111 merged by zuul:
res_config_pgsql: Make 'require' return consistent with other backends

[https://gerrit.asterisk.org/5111|https://gerrit.asterisk.org/5111]

By: Friendly Automation (friendly-automation) 2017-03-01 11:25:26.277-0600

Change 5112 merged by Joshua Colp:
res_config_pgsql: Make 'require' return consistent with other backends

[https://gerrit.asterisk.org/5112|https://gerrit.asterisk.org/5112]

By: Friendly Automation (friendly-automation) 2017-03-01 11:25:45.276-0600

Change 5110 merged by Joshua Colp:
res_config_pgsql: Make 'require' return consistent with other backends

[https://gerrit.asterisk.org/5110|https://gerrit.asterisk.org/5110]