mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-13 13:28:34 +00:00
cdr_pgsql cel_pgsql res_config_pgsql: compatibility with PostgreSQL 12
PostgreSQL 12 finally removed column adsrc from table pg_catalog.pg_attrdef (column default values), which has been deprecated since version 8.0. Since then, the official/correct/supported way to retrieve the column default value from the catalog is function pg_catalog.pg_get_expr(). This change breaks compatibility with pre-8.0 PostgreSQL servers, but has reached end-of-support more than a decade ago. cdr_pgsql and res_config_pgsql still have support for pre-7.3 servers, but cleaning that up is perhaps a topic for a major release, not this bugfix. ASTERISK-28571 Change-Id: I834cb3addf1937e19e87ede140bdd16cea531ebe
This commit is contained in:
committed by
George Joseph
parent
32c52b7dda
commit
a7749f4fcd
@@ -567,7 +567,7 @@ static int process_my_load_module(struct ast_config *cfg)
|
||||
}
|
||||
|
||||
/* Query the columns */
|
||||
snprintf(sqlcmd, sizeof(sqlcmd), "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 = '%s' order by c.relname, attnum", tableptr);
|
||||
snprintf(sqlcmd, sizeof(sqlcmd), "select a.attname, t.typname, a.attlen, a.attnotnull, pg_catalog.pg_get_expr(d.adbin, d.adrelid) 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 = '%s' order by c.relname, attnum", tableptr);
|
||||
result = PQexec(conn, sqlcmd);
|
||||
if (PQresultStatus(result) != PGRES_TUPLES_OK) {
|
||||
pgerror = PQresultErrorMessage(result);
|
||||
|
||||
Reference in New Issue
Block a user