[asterisk-bugs] [Asterisk 0016001]: schema problem

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Oct 1 08:49:24 CDT 2009


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16001 
====================================================================== 
Reported By:                jamicque
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   16001
Category:                   CDR/cdr_pgsql
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     feedback
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:39 CDT
Last Modified:              2009-10-01 08:49 CDT
====================================================================== 
Summary:                    schema problem
Description: 
When you are using reltime cdr with pgsql, asterisk on every connect check
the table and it's columns. 
For example it's made by querry:

select a.attname, t.typname, a.attlen, a.attnotnull, d.adsrc 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 = 'cdr' 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 cdr, in result Asterisk will try
to insert double statements into one table, which will result in an error.

======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0016000 Schema problem when using realtime with...
====================================================================== 

---------------------------------------------------------------------- 
 (0111709) jamicque (reporter) - 2009-10-01 08:49
 https://issues.asterisk.org/view.php?id=16001#c111709 
---------------------------------------------------------------------- 
When you configure asterisk to write CDR's thru cdr_pgsql or to use
realtime res_pgsql, asterisk on every start makes the select query stated
in the main post. The query is bad, becouse when you have multimple schemas
and in every schema you have a table cdr, the above querry gives duplicated
results about the table columns. In result when asterisk is going to write
CDR to postgres it trying to make a bed insert. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-10-01 08:49 jamicque       Note Added: 0111709                          
======================================================================




More information about the asterisk-bugs mailing list