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

Asterisk Team (JIRA) noreply at issues.asterisk.org
Thu Dec 12 05:54:35 CST 2019


     [ https://issues.asterisk.org/jira/browse/ASTERISK-28571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asterisk Team updated ASTERISK-28571:
-------------------------------------

    Target Release Version/s: 17.1.0

> 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: GIT, 16.6.0
>         Environment: PostgreSQL server version: 12.0
> affects all Asterisk versions (including git master branch)
>            Reporter: Christoph Moench-Tegeder
>            Assignee: Christoph Moench-Tegeder
>            Severity: Minor
>              Labels: patch
>      Target Release: 13.30.0, 16.7.0, 17.1.0
>
>         Attachments: cdr_pgsql_pg_get_expr.diff
>
>
> 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.
> See:
> https://www.postgresql.org/docs/8.0/catalog-pg-attrdef.html
> https://www.postgresql.org/docs/12/catalog-pg-attrdef.html
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=fe5038236c6b99d48c2faa2247b5cec9703add2a
> https://www.postgresql.org/docs/11/functions-info.html#FUNCTIONS-INFO-CATALOG-TABLE
> 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
(v6.2#6252)



More information about the asterisk-bugs mailing list