CVS User Account cvsuser
Mon May 15 07:47:14 PDT 2006
Log Message:
-----------
Guard the log trigger against old PK values being NULL

Jan

Modified Files:
--------------
    slony1-engine/src/backend:
        slony1_funcs.c (r1.41 -> r1.42)

-------------- next part --------------
Index: slony1_funcs.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -Lsrc/backend/slony1_funcs.c -Lsrc/backend/slony1_funcs.c -u -w -r1.41 -r1.42
--- src/backend/slony1_funcs.c
+++ src/backend/slony1_funcs.c
@@ -796,6 +796,9 @@
 				continue;
 			col_ident = (char *)slon_quote_identifier(SPI_fname(tupdesc, i + 1));
 			col_value = slon_quote_literal(SPI_getvalue(old_row, tupdesc, i + 1));
+			if (col_value == NULL)
+				elog(ERROR, "Slony-I: old key column %s.%s IS NULL on UPDATE", 
+					NameStr(tg->tg_relation->rd_rel->relname), col_ident);
 
 			cmddata_need = (cp - (char *)(cs->cmddata_buf)) + 16 +
 				(len_ident = strlen(col_ident)) +
@@ -860,6 +863,9 @@
 				continue;
 			col_ident = (char *)slon_quote_identifier(SPI_fname(tupdesc, i + 1));
 			col_value = slon_quote_literal(SPI_getvalue(old_row, tupdesc, i + 1));
+			if (col_value == NULL)
+				elog(ERROR, "Slony-I: old key column %s.%s IS NULL on DELETE", 
+					NameStr(tg->tg_relation->rd_rel->relname), col_ident);
 
 			cmddata_need = (cp - (char *)(cs->cmddata_buf)) + 16 +
 				(len_ident = strlen(col_ident)) +
@@ -1056,6 +1062,9 @@
 	int			len;
 	int			wl;
 
+	if (str == NULL)
+		return NULL;
+
 	len = strlen(str);
 	result = palloc(len * 2 + 3);
 	cp1 = str;



More information about the Slony1-commit mailing list