CVS User Account cvsuser
Thu Jul 6 10:00:38 PDT 2006
Log Message:
-----------
change to setAddTable_int(): Reject the table if the proposed PK
candidate contains any nullable columns.

Modified Files:
--------------
    slony1-engine/src/backend:
        slony1_funcs.sql (r1.87 -> r1.88)

-------------- next part --------------
Index: slony1_funcs.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.87
retrieving revision 1.88
diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.87 -r1.88
--- src/backend/slony1_funcs.sql
+++ src/backend/slony1_funcs.sql
@@ -2648,6 +2648,8 @@
 	v_sub_provider		int4;
 	v_relkind		char;
 	v_tab_reloid		oid;
+	v_pkcand_nn		boolean;
+	v_prec			record;
 begin
 	-- ----
 	-- Grab the central configuration lock
@@ -2704,6 +2706,22 @@
 				p_fqname, p_tab_idxname;
 	end if;
 
+	v_pkcand_nn := ''f'';
+	for v_prec in select attname from "pg_catalog".pg_attribute where attrelid = 
+                        (select oid from "pg_catalog".pg_class where oid = v_tab_reloid) 
+                    and attname in (select attname from "pg_catalog".pg_attribute where 
+                                    attrelid = (select oid from "pg_catalog".pg_class PGC, 
+                                    "pg_catalog".pg_index PGX where 
+                                    PGC.relname = p_tab_idxname and PGX.indexrelid=PGC.oid and
+                                    PGX.indrelid = v_tab_reloid)) and attnotnull <> ''t''
+	loop
+		raise notice ''Slony-I: setAddTable_int: table % PK column % nullable'', p_fqname, v_prec.attname;
+		v_pkcand_nn := ''t'';
+	end loop;
+	if v_pkcand_nn then
+		raise exception ''Slony-I: setAddTable_int: table % not replicable!'', p_fqname;
+	end if;
+
 	-- ----
 	-- Add the table to sl_table and create the trigger on it.
 	-- ----



More information about the Slony1-commit mailing list