[Home]

Summary:ASTERISK-13202: cdr_pgsql does not work in asterisk 1.6.0.x
Reporter:Alexander Nosov (navis)Labels:
Date Opened:2008-12-11 03:46:35.000-0600Date Closed:2008-12-15 12:09:54.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:CDR/cdr_pgsql
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:cdr_pgsql not write data to the table. Clearly, the request is not formed correctly

[Dec 11 11:31:07] ERROR[7770]: cdr_pgsql.c:309 pgsql_log: cdr_pgsql: Failed to insert call detail record into database!
[Dec 11 11:31:07] ERROR[7770]: cdr_pgsql.c:310 pgsql_log: cdr_pgsql: Reason: ERROR:  syntax error at or near ")"
LINE 1: INSERT INTO public.cdr ) VALUES )


****** ADDITIONAL INFORMATION ******

Checked versions asterisk 1.6.0 and 1.6.0.3-rc1
Comments:By: Tilghman Lesher (tilghman) 2008-12-11 11:04:57.000-0600

This would typically happen when upon startup, the query to discover the table structure failed.  What version of PostgreSQL are you running?

By: Tilghman Lesher (tilghman) 2008-12-11 11:06:34.000-0600

The query to discover the table structure is as follows:
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

If you run this query on your psql command line, what error do you get back?

By: Alexander Nosov (navis) 2008-12-12 02:28:19.000-0600

Thank you for a help.  A problem appeared in that in the file of cdr_pgsql.conf the name of table was indicated in the format of schema_name.table_name. In asterisk 1.4 it worked normally. I replaced table=public.cdr on table=cdr and all works fine.

By: Digium Subversion (svnbot) 2008-12-15 12:09:54.000-0600

Repository: asterisk
Revision: 164349

U   trunk/cdr/cdr_pgsql.c

------------------------------------------------------------------------
r164349 | tilghman | 2008-12-15 12:09:53 -0600 (Mon, 15 Dec 2008) | 4 lines

When querying for the structure of the CDR table, remove the schema, if it
exists.
(Closes issue ASTERISK-13202)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=164349