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

Christoph Moench-Tegeder (JIRA) noreply at issues.asterisk.org
Tue Oct 8 10:11:47 CDT 2019


    [ https://issues.asterisk.org/jira/browse/ASTERISK-28571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=248299#comment-248299 ] 

Christoph Moench-Tegeder commented on ASTERISK-28571:
-----------------------------------------------------

I had to wait for the License Agreement to pass your legal department. If Guido doesn't beat me to it, I'll try my luck with Gerrit later today or tomorrow. For the time being, see the attachment.
I'm propably not the first to say this, but getting this patch through to you is much more work than fixing the problem in the first place.

> 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
>         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