Bryonclark described the problem as occuring during this function because of multiple
simultaneous database operations causing corruption against a pgsqlConn object.
(closes issue ASTERISK-17811)
Reported by: byronclark
Patches:
pgsql_find_table_locking.patch uploaded by byronclark (license 1200)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@323730 65c4cc65-6c06-0410-ace0-fbb531ad65f3
ast_str_set(&sql,0,"SELECT a.attname, t.typname, a.attlen, a.attnotnull, d.adsrc, a.atttypmod 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",orig_tablename);
}
ast_mutex_lock(&pgsql_lock);
if(!pgsql_reconnect(database)){
AST_LIST_UNLOCK(&psql_tables);
ast_mutex_unlock(&pgsql_lock);
returnNULL;
}
result=PQexec(pgsqlConn,ast_str_buffer(sql));
ast_debug(1,"Query of table structure complete. Now retrieving results.\n");