[asterisk-bugs] [Asterisk 0016000]: [patch] Schema problem with res_pgsql

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Oct 1 16:50:58 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16000 
====================================================================== 
Reported By:                jamicque
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   16000
Category:                   Resources/res_config_pgsql
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           1.6.1.6 
JIRA:                        
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-10-01 06:37 CDT
Last Modified:              2009-10-01 16:50 CDT
====================================================================== 
Summary:                    [patch] Schema problem with res_pgsql
Description: 
When you are using reltime with pgsql, asterisk on every connect check the
table and it's columns. 
For example it's made by querry (for meetme):

SELECT a.attname, t.typname, a.attlen, a.attnotnull, d.adsrc, a.atttypmod
FROM pg_class c, pg_type t, pg_attribute a LEFT OUTER JOIN pg_attrdef d ON
a.atthasdef AND d.adrelid = a.attrelid AND d.adnum = a.attnum WHERE c.oid =
a.attrelid AND a.atttypid = t.oid AND (a.attnum > 0) AND c.relname =
'meetme' ORDER BY c.relname, attnum

The problem is that it does not check the schema. If you have two
different schemas and in every one table meetme, in result Asterisk will
try to insert double statements into one table, which will result in an
error.


======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
has duplicate       0016001 schema problem
====================================================================== 

---------------------------------------------------------------------- 
 (0111759) jamicque (reporter) - 2009-10-01 16:50
 https://issues.asterisk.org/view.php?id=16000#c111759 
---------------------------------------------------------------------- 
i was patching the file from 1.6.1.6, and here is the output:

wget
'https://issues.asterisk.org/file_download.php?file_id=24037&type=bug' -O -
| patch -p0
--2009-10-01 23:42:09-- 
https://issues.asterisk.org/file_download.php?file_id=24037&type=bug
Translacja issues.asterisk.org... 76.164.171.231
??czenie si? z issues.asterisk.org|76.164.171.231|:443... po??czono.
??danie HTTP wys?ano, oczekiwanie na odpowied?... 200 OK
D?ugo??: 5373 (5,2K) [text/plain]
Zapis do: `STDOUT'

100%[=======================================================================================================================================>]
5.373       33,3K/s   w  0,2s

2009-10-01 23:42:10 (33,3 KB/s) - zapisano `-' [5373/5373]

patching file res/res_config_pgsql.c
Hunk https://issues.asterisk.org/view.php?id=1 FAILED at 50.
Hunk https://issues.asterisk.org/view.php?id=2 succeeded at 101 (offset -13
lines).
Hunk https://issues.asterisk.org/view.php?id=3 succeeded at 113 with fuzz 2
(offset -13 lines).
Hunk https://issues.asterisk.org/view.php?id=4 FAILED at 122.
Hunk https://issues.asterisk.org/view.php?id=5 FAILED at 195.
Hunk https://issues.asterisk.org/view.php?id=6 succeeded at 214 (offset -13
lines).
Hunk https://issues.asterisk.org/view.php?id=7 succeeded at 1353 (offset -117
lines).


I have a question, will your changes update all the tables in different
schemas during the insert, or only one? 
In my opinion it should do the querry on only one table. (which you should
define in config).
What would happen if you have two schemas with tables let's say meetme,
where on would be the proper one for asterisk and the second will be a
different table (not for asterisk usage, with different structure)? 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-10-01 16:50 jamicque       Note Added: 0111759                          
======================================================================




More information about the asterisk-bugs mailing list