[Home]

Summary:ASTERISK-14920: schema problem
Reporter:Maciej Krajewski (jamicque)Labels:
Date Opened:2009-10-01 06:39:52Date Closed:2009-10-01 08:57:34
Priority:MinorRegression?No
Status:Closed/CompleteComponents:CDR/cdr_pgsql
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
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.
Comments:By: Leif Madsen (lmadsen) 2009-10-01 08:37:38

Can you elaborate a bit more? Perhaps Tilghman will understand what you're talking about, but right now I'm kinda confused. Are you saying that select statement is run by Asterisk?

By: Maciej Krajewski (jamicque) 2009-10-01 08:49:24

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.

By: Leif Madsen (lmadsen) 2009-10-01 08:57:33

Per IRC:

<Corydon76-dig> They are duplicates, and the issue is really in res_pgsql.c