[asterisk-bugs] [JIRA] (ASTERISK-28571) cdr_pgsql: accesses obsolete (and finally removed) column

Christoph Moench-Tegeder (JIRA) noreply at issues.asterisk.org
Mon Oct 7 08:55:48 CDT 2019

Christoph Moench-Tegeder created ASTERISK-28571:

             Summary: cdr_pgsql: accesses obsolete (and finally removed) column
                 Key: ASTERISK-28571
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-28571
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: CDR/cdr_pgsql
    Affects Versions: 16.6.0, GIT
         Environment: PostgreSQL server version: 12.0
affects all Asterisk versions (including git master branch)
            Reporter: Christoph Moench-Tegeder
            Severity: Minor

In cdr/cdr_pgsql.c function config_module() discovers the configured cdr table's schema. The SQL statement in there accesses pg_catalog.pg_attrdef.adsrc - a column which has been obsolete sind PostgreSQL 8.0 (released January 2005) and finally removed in PostgreSQL 12 (released Oct 3rd 2019).

Initialization of the cdr_pgsql module against a PostgreSQL 12 server fails with message
  cdr_pgsql.c: Failed to query database columns: ERROR:  column d.adsrc does not exist
and no CDRs will be logged.

Fortunately, the same information which once was stored in adsrc is accessable via column adbin and function pg_catalog.pg_get_expr, which is the recommended way since PostgreSQL 8.0. I'll attach a patch.
Using that patch, cdr_pgsql initializes fine again and I get my CDRs logged to the database as with older PostgreSQL versions.


On a side note, there's code supporting very old PostgreSQL releases in cdr_pgsql ("before version 7.3", which is end-of-life for over a decade) which I do not touch in this issue but should perhaps removed.

See: https://www.postgresql.org/support/versioning/

This message was sent by Atlassian JIRA

More information about the asterisk-bugs mailing list