[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:51:47 CDT 2019
[ https://issues.asterisk.org/jira/browse/ASTERISK-28571?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=248302#comment-248302 ]
Christoph Moench-Tegeder commented on ASTERISK-28571:
-----------------------------------------------------
[~seanbright] yes, in both, now that you mention it. That looks like quite some code duplication (including suport for pre-7.3-postgresql)... anyways, grep doesn't show more (other than cdr_pgsql.c, cel_pgsql.c, res_config_pgsql.c) references to adsrc.
I'll update the patch when I get arround to gerrit.
> 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