Christopher Browne cbbrowne at ca.afilias.info
Wed Jul 22 09:03:50 PDT 2009
Christopher Browne <cbbrowne at ca.afilias.info> writes:
> In view of the "noise", I'm taking a look at how challenging it is to
> get 8.4 support into the 1.2 branch...

... Bits Jan's looking at elided ...

> There's another pretty visible 8.4 issue...  src/slon/cleanup_thread.c
> has a reference to pg_autovacuum.

The patch for this for 8.4 seems pretty small...  

This is decidedly not tested, as the issues with xxid.c/slony1_funcs.c
prevent installation at this point.

But this bit, at least, is hardly scary.

Index: cleanup_thread.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slon/cleanup_thread.c,v
retrieving revision 1.33.2.4
diff -c -u -r1.33.2.4 cleanup_thread.c
--- cleanup_thread.c	22 Aug 2007 21:20:23 -0000	1.33.2.4
+++ cleanup_thread.c	22 Jul 2009 16:00:07 -0000
@@ -302,11 +302,22 @@
 				sprintf(tstring, table_list[t], rtcfg_namespace);
 				if (a_vac==1)
 				{
-					slon_mkquery(&query3,"select (case when pga.enabled ISNULL THEN true ELSE pga.enabled END) "
-						"from \"pg_catalog\".pg_namespace PGN, \"pg_catalog\".pg_class PGC LEFT OUTER JOIN "
-						"\"pg_catalog\".pg_autovacuum pga ON (PGC.oid = pga.vacrelid) where PGC.relnamespace = PGN.oid "
-						"and %s.slon_quote_input('%s')=%s.slon_quote_brute(PGN.nspname) || '.' || %s.slon_quote_brute(PGC.relname);",
-					 	rtcfg_namespace,tstring, rtcfg_namespace, rtcfg_namespace);
+					if (conn->pg_version < 80400) {
+						slon_mkquery(&query3,"select (case when pga.enabled ISNULL THEN true ELSE pga.enabled END) "
+									 "from \"pg_catalog\".pg_namespace PGN, \"pg_catalog\".pg_class PGC LEFT OUTER JOIN "
+									 "\"pg_catalog\".pg_autovacuum pga ON (PGC.oid = pga.vacrelid) where PGC.relnamespace = PGN.oid "
+									 "and %s.slon_quote_input('%s')=%s.slon_quote_brute(PGN.nspname) || '.' || %s.slon_quote_brute(PGC.relname);",
+									 rtcfg_namespace,tstring, rtcfg_namespace, rtcfg_namespace);
+
+					} else {
+						/* PostgreSQL 8.4 */
+						slon_mkquery (&query3, 
+									  "select coalesce ('autovacuum_enabled=on' = any(reloptions), 't'::boolean) "
+									  "from \"pg_catalog\".pg_class pgc, \"pg_catalog\".pg_namespace pgn "
+									  "where pgc.relnamespace = pgn.oid and %s.slon_quote_input('%s')= "
+									  " %s.slon_quote_brute(PGN.nspname) || '.' || %s.slon_quote_brute(PGC.relname);",
+									  rtcfg_namespace,tstring, rtcfg_namespace, rtcfg_namespace);
+					}
 
 					res = PQexec(dbconn, dstring_data(&query3));
 					if (PQresultStatus(res) != PGRES_TUPLES_OK)  /* query error */

-- 
"cbbrowne","@","ca.afilias.info"
<http://dba2.int.libertyrms.com/>
Christopher Browne
(416) 673-4124 (land)
"Bother,"  said Pooh,  "Eeyore, ready  two photon  torpedoes  and lock
phasers on the Heffalump, Piglet, meet me in transporter room three"


More information about the Slony1-general mailing list