# Copyright (c) 2003-2004, PostgreSQL Global Development Group
# Author: Jan Wieck, Afilias USA INC.
#
-# $Id: Makefile,v 1.26 2007-06-07 13:01:10 wieck Exp $
+# $Id: Makefile,v 1.26.2.1 2009-07-21 21:15:51 cbbrowne Exp $
# ----------
slony_subdir = src/backend
BASE_83 = slony1_base.v83.sql
FUNCS_83 = slony1_funcs.v83.sql
+BASE_84 = slony1_base.v84.sql
+FUNCS_84 = slony1_funcs.v84.sql
SQL_NAMES = \
$(BASE_COMMON) \
$(FUNCS_COMMON) \
$(BASE_83) \
- $(FUNCS_83)
+ $(BASE_84) \
+ $(FUNCS_83) \
+ $(FUNCS_84)
DISTFILES = Makefile README README.events $(wildcard *.sql) $(wildcard *.in) $(wildcard *.c)
-- Copyright (c) 2003-2004, PostgreSQL Global Development Group
-- Author: Jan Wieck, Afilias USA INC.
--
--- $Id: slony1_base.sql,v 1.40.2.1 2009-02-23 17:23:55 cbbrowne Exp $
+-- $Id: slony1_base.sql,v 1.40.2.2 2009-07-21 21:15:51 cbbrowne Exp $
-- ----------------------------------------------------------------------
-- ----------------------------------------------------------------------
create sequence @NAMESPACE@.sl_event_seq;
comment on sequence @NAMESPACE@.sl_event_seq is 'The sequence for numbering events originating from this node.';
+select setval('@NAMESPACE@.sl_event_seq', 5000000000);
-- ----------------------------------------------------------------------
-- SEQUENCE sl_action_seq
';
comment on column @NAMESPACE@.sl_config_lock.dummy is 'No data ever goes in this table so the contents never matter. Indeed, this column does not really need to exist.';
-create type @NAMESPACE@.vactables as (nspname name, relname name);
-
-comment on type @NAMESPACE@.vactables is 'used as return type for SRF function TablesToVacuum';
-
-- ----------------------------------------------------------------------
-- TABLE sl_archive_counter
--
-- Copyright (c) 2007, PostgreSQL Global Development Group
-- Author: Jan Wieck, Afilias USA INC.
--
--- $Id: slony1_base.v83.sql,v 1.1 2007-05-31 18:55:28 wieck Exp $
+-- $Id: slony1_base.v83.sql,v 1.1.2.1 2009-07-21 21:15:51 cbbrowne Exp $
-- ----------------------------------------------------------------------
+create type @NAMESPACE@.vactables as (nspname name, relname name);
+
+comment on type @NAMESPACE@.vactables is 'used as return type for SRF function TablesToVacuum';
+
--- /dev/null
+-- ----------------------------------------------------------------------
+-- slony1_base.v83.sql
+--
+-- Version 8.3 specific parts of the basic replication schema.
+--
+-- Copyright (c) 2007, PostgreSQL Global Development Group
+-- Author: Jan Wieck, Afilias USA INC.
+--
+-- $Id: slony1_base.v84.sql,v 1.1.2.1 2009-07-21 21:15:51 cbbrowne Exp $
+-- ----------------------------------------------------------------------
+
+create type @NAMESPACE@.vactables as (nspname name, relname name);
+
+comment on type @NAMESPACE@.vactables is 'used as return type for SRF function TablesToVacuum';
+
+
-- Copyright (c) 2003-2007, PostgreSQL Global Development Group
-- Author: Jan Wieck, Afilias USA INC.
--
--- $Id: slony1_funcs.sql,v 1.145.2.12 2009-07-14 19:09:00 cbbrowne Exp $
+-- $Id: slony1_funcs.sql,v 1.145.2.13 2009-07-21 21:15:51 cbbrowne Exp $
-- ----------------------------------------------------------------------
-- **********************************************************************
comment on function @NAMESPACE@.finishTableAfterCopy(int4) is
'Reenable index maintenance and reindex the table';
-
--- ----------------------------------------------------------------------
--- FUNCTION ShouldSlonyVacuumTable (nspname, tabname)
---
--- Returns 't' if the table needs to be vacuumed by Slony-I
--- Returns 'f' if autovac handles the table, so Slony-I should not
--- or if the table is not needful altogether
--- ----------------------------------------------------------------------
-create or replace function @NAMESPACE@.ShouldSlonyVacuumTable (name, name) returns boolean as
-$$
-declare
- i_nspname alias for $1;
- i_tblname alias for $2;
- c_table oid;
- c_namespace oid;
- c_enabled boolean;
- v_dummy int4;
-begin
- select 1 into v_dummy from "pg_catalog".pg_settings where name = 'autovacuum' and setting = 'on';
- if not found then
- return 't'::boolean; -- If autovac is turned off, then we gotta vacuum
- end if;
-
- select into c_namespace oid from "pg_catalog".pg_namespace where nspname = i_nspname;
- if not found then
- raise exception 'Slony-I: namespace % does not exist', i_nspname;
- end if;
- select into c_table oid from "pg_catalog".pg_class where relname = i_tblname and relnamespace = c_namespace;
- if not found then
- raise warning 'Slony-I: table % does not exist in namespace %/%', tblname, c_namespace, i_nspname;
- return 'f'::boolean;
- end if;
-
- -- So, the table is legit; try to look it up for autovacuum policy
- select enabled into c_enabled from "pg_catalog".pg_autovacuum where vacrelid = c_table;
-
- if not found then
- return 'f'::boolean; -- Autovac is turned on, and this table has no overriding handling
- end if;
-
- if c_enabled then
- return 'f'::boolean; -- Autovac is expressly turned on for this table
- end if;
-
- return 't'::boolean;
-end;$$ language plpgsql;
-
-comment on function @NAMESPACE@.ShouldSlonyVacuumTable (name, name) is
-'returns false if autovacuum handles vacuuming of the table, or if the table does not exist; returns true if Slony-I should manage it';
-
create or replace function @NAMESPACE@.setup_vactables_type () returns integer as $$
begin
if not exists (select 1 from pg_catalog.pg_type t, pg_catalog.pg_namespace n
--- /dev/null
+-- ----------------------------------------------------------------------
+-- slony1_funcs.v83.sql
+--
+-- Version 8.3 specific part of the replication support functions.
+--
+-- Copyright (c) 2007, PostgreSQL Global Development Group
+-- Author: Jan Wieck, Afilias USA INC.
+--
+-- $Id: slony1_funcs.v84.sql,v 1.1.2.1 2009-07-21 21:15:51 cbbrowne Exp $
+-- ----------------------------------------------------------------------
+
+-- ----------------------------------------------------------------------
+-- FUNCTION ShouldSlonyVacuumTable (nspname, tabname)
+--
+-- Returns 't' if the table needs to be vacuumed by Slony-I
+-- Returns 'f' if autovac handles the table, so Slony-I should not
+-- or if the table is not needful altogether
+-- ----------------------------------------------------------------------
+create or replace function @NAMESPACE@.ShouldSlonyVacuumTable (name, name) returns boolean as
+$$
+declare
+ i_nspname alias for $1;
+ i_tblname alias for $2;
+ c_table oid;
+ c_namespace oid;
+ c_enabled boolean;
+ v_dummy int4;
+begin
+ select 1 into v_dummy from "pg_catalog".pg_settings where name = 'autovacuum' and setting = 'on';
+ if not found then
+ return 't'::boolean; -- If autovac is turned off, then we gotta vacuum
+ end if;
+
+ select into c_namespace oid from "pg_catalog".pg_namespace where nspname = i_nspname;
+ if not found then
+ raise exception 'Slony-I: namespace % does not exist', i_nspname;
+ end if;
+ select into c_table oid from "pg_catalog".pg_class where relname = i_tblname and relnamespace = c_namespace;
+ if not found then
+ raise warning 'Slony-I: table % does not exist in namespace %/%', tblname, c_namespace, i_nspname;
+ return 'f'::boolean;
+ end if;
+
+ -- So, the table is legit; try to look it up for autovacuum policy
+ if exists (select 1 from pg_class where 'autovacuum_enabled=off' = any (reloptions) and oid = c_table) then
+ return 't'::boolean; -- Autovac is turned on, but this table is disabled
+ end if;
+
+ return 'f'::boolean;
+
+end;$$ language plpgsql;
+
+comment on function @NAMESPACE@.ShouldSlonyVacuumTable (name, name) is
+'returns false if autovacuum handles vacuuming of the table, or if the table does not exist; returns true if Slony-I should manage it';
+
* Copyright (c) 2003-2004, PostgreSQL Global Development Group
* Author: Jan Wieck, Afilias USA INC.
*
- * $Id: dbutils.c,v 1.30.2.1 2009-07-20 22:30:10 cbbrowne Exp $
+ * $Id: dbutils.c,v 1.30.2.2 2009-07-21 21:15:51 cbbrowne Exp $
* ----------------------------------------------------------------------
*/
slon_log(SLON_CONFIG,
"version for \"%s\" is %d\n", conninfo, conn->pg_version);
- if (conn->pg_version >= 80100)
+ if (conn->pg_version >= 80300)
{
slon_mkquery(&query, "set escape_string_warning to 'off'");
res = PQexec(dbconn, dstring_data(&query));
slon_log(SLON_ERROR, "Unable to set escape_string_warning to off\n");
}
PQclear(res);
- }
- if (conn->pg_version >= 80200)
- {
+
slon_mkquery(&query, "set standard_conforming_strings to 'off'");
res = PQexec(dbconn, dstring_data(&query));
if (!(PQresultStatus(res) == PGRES_COMMAND_OK))
* Copyright (c) 2003-2004, PostgreSQL Global Development Group
* Author: Jan Wieck, Afilias USA INC.
*
- * $Id: slonik.c,v 1.91.2.3 2009-07-14 19:09:00 cbbrowne Exp $
+ * $Id: slonik.c,v 1.91.2.4 2009-07-21 21:15:51 cbbrowne Exp $
*-------------------------------------------------------------------------
*/
else if ((adminfo->pg_version >= 80400) && (adminfo->pg_version < 80500)) /* 8.4 */
{
use_major = 8;
- use_minor = 3; /* at this point, there's nothing specifically different in 8.4 from 8.3 */
+ use_minor = 4; /* at this point, there's nothing specifically different in 8.4 from 8.3 */
}
else /* above 8.4 ??? */
{
use_major = 8;
- use_minor = 3;
+ use_minor = 4;
printf("%s:%d: Possible unsupported PostgreSQL "
- "version (%d) %d.%d, defaulting to 8.3 support\n",
+ "version (%d) %d.%d, defaulting to 8.4 support\n",
stmt->stmt_filename, stmt->stmt_lno, adminfo->pg_version,
(adminfo->pg_version/10000), ((adminfo->pg_version%10000)/100));
}