Fix runtime with postgresql 9.2.

From JG Pailloncy, thanks!
This commit is contained in:
landry 2013-05-09 01:50:12 +00:00
parent 74990b3998
commit d046114732
4 changed files with 64 additions and 6 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.12 2013/03/11 11:23:50 espie Exp $
# $OpenBSD: Makefile,v 1.13 2013/05/09 01:50:12 landry Exp $
COMMENT = mail server storing messages in a database
DISTNAME = archiveopteryx-3.1.3
REVISION = 7
REVISION = 8
CATEGORIES = mail databases
HOMEPAGE = http://www.archiveopteryx.org/

View File

@ -1,11 +1,11 @@
$OpenBSD: patch-db_database_cpp,v 1.1 2011/04/03 09:04:54 landry Exp $
$OpenBSD: patch-db_database_cpp,v 1.2 2013/05/09 01:50:12 landry Exp $
Backport c3d5d52ad084a98cc161
Fix crash when connection to postgres fails.
--- db/database.cpp.orig
+++ db/database.cpp
--- db/database.cpp.orig Wed Mar 10 13:17:56 2010
+++ db/database.cpp Thu May 9 03:37:13 2013
@@ -339,6 +339,8 @@ void Database::removeHandle( Database * d )
return;
handles->remove( d );
+ if ( !totalDbConnections )
+ totalDbConnections = new GraphableNumber( "total-db-connections" );

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-db_postgres_cpp,v 1.1 2013/05/09 01:50:12 landry Exp $
Fix with psql 9.2
--- db/postgres.cpp.orig Wed Mar 10 13:17:56 2010
+++ db/postgres.cpp Thu May 9 03:38:52 2013
@@ -77,12 +77,12 @@ class PgData (public)
Scope x( log() );
q = new Query(
"select h.pid::int, a.xact_start::text,"
- " a.client_addr::text, a.current_query::text,"
+ " a.client_addr::text, a.query::text,"
" a.usename::text, a.client_addr,"
- " a.current_query,"
+ " a.query,"
" w.locktype::text "
"from pg_locks h join pg_locks w using (locktype) "
- "join pg_stat_activity a on (h.pid=a.procpid) "
+ "join pg_stat_activity a on (h.pid=a.pid) "
"where h.granted and not w.granted and w.pid=$1 and "
"coalesce(h.relation, h.page, h.tuple, h.transactionid, h.virtualxid)="
"coalesce(w.relation, w.page, w.tuple, w.transactionid, w.virtualxid)",
@@ -100,7 +100,7 @@ class PgData (public)
"Transaction start time: " + r->getEString( "xact_start" ) + " "
"Username: " + r->getEString( "usename" ) + " "
"Client address: " + r->getEString( "client_addr" ) + " "
- "Current query: " + r->getEString( "current_query" ).quoted(),
+ "Current query: " + r->getEString( "query" ).quoted(),
Log::Significant );
}
}

View File

@ -0,0 +1,29 @@
$OpenBSD: patch-db_schema_cpp,v 1.1 2013/05/09 01:50:12 landry Exp $
Fix with psql 9.2
--- db/schema.cpp.orig Wed Mar 10 13:17:56 2010
+++ db/schema.cpp Thu May 9 03:38:52 2013
@@ -142,13 +142,13 @@ void Schema::execute()
{
if ( d->state == 0 ) {
d->lockSanity = new Query(
- "select relname::text,pid::int,mode,granted,current_query,"
+ "select relname::text,l.pid::int,mode,granted,query,"
"extract(epoch from current_timestamp-a.query_start)::int "
"as lock_age "
"from pg_locks l "
"join pg_database d on (d.oid=l.database) "
"join pg_class c on (l.relation=c.oid) "
- "join pg_stat_activity a on (l.pid=a.procpid) "
+ "join pg_stat_activity a on (l.pid=a.pid) "
"where d.datname=$1 and not relname like 'pg_%'", this );
d->lockSanity->bind( 1, Configuration::text( Configuration::DbName ) );
d->lockSanity->execute();
@@ -183,7 +183,7 @@ void Schema::execute()
" PID: " + fn( r->getInt( "pid" ) ) +
" Mode: " + r->getEString( "mode" ).quoted() +
" Granted: " + ( r->getBoolean( "granted" ) ? "yes" : "no" ) +
- " Query: " + r->getEString( "current_query" ).quoted() +
+ " Query: " + r->getEString( "query" ).quoted() +
" Lock age: " + age,
Log::Significant );
}