Summary: | ASTERISK-05892: [patch] Voicemail storage with ODBC and PostgreSQL fails due to bad SQL queries. | ||
Reporter: | mihai (mihai) | Labels: | |
Date Opened: | 2005-12-22 14:26:32.000-0600 | Date Closed: | 2005-12-22 21:57:38.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Applications/app_voicemail |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 20051222__bug6050.diff.txt | |
Description: | I'm trying to store voicemail to a PostgreSQL 7.4 DB using unixodbc 2.2.11. I'm running svn trunk, but the problem is present in 1.2 branch as well. I get the following error message: Dec 22 16:09:49 WARNING[4119]: res_odbc.c:171 odbc_smart_execute: SQL Execute returned an error -1: HY000: ERROR: column "%default/2020/INBOX" does not exist (51) Dec 22 16:09:49 WARNING[4119]: res_odbc.c:171 odbc_smart_execute: SQL Execute returned an error -1: 00000: ERROR: column "%default/2020/INBOX" does not exist (51) Dec 22 16:09:49 WARNING[4119]: app_voicemail.c:2017 messagecount: SQL Execute error! [SELECT COUNT(*) FROM voicemessages WHERE dir like "%default/2020/INBOX"] I traced it to the use of double quotes in apps/app_voicemail.c in line 2008. Double quotes are used in lines 2041 and 2108 as well, so these spots could also generate some problems. As far as I know SQL standard requires single quotes for values. Fixed the code and it works (well, I run into some other unrelated issues but I need more research before submitting further reports) | ||
Comments: | By: Jason Parker (jparker) 2005-12-22 15:03:57.000-0600 Are you able to submit a (properly disclaimed) patch? If you can't, let me know, and I'll post mine - I've had to do the same thing for mssql/freetds. I also had to do some hacking on the char columns - when you pass empty strings, freetds gladly passes char(0) to mssql, which promptly throws an error. You don't want to know how I got around this...it's VERY ugly (and mostly unrelated to this bug). I'd like to see some testing done on mysql and others, if anybody is up for it. By: mihai (mihai) 2005-12-22 15:17:28.000-0600 Fixed now in SVN. Thanks for the prompt patch. |