Wed Nov 21 08:28:34 PST 2007
- Previous message: [Slony1-general] Slony Newbie Question
- Next message: [Slony1-general] Patch for shorter attkind
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
The following very quick patch (against 1.2.12) provides the following changes:
- when scanning attributes looking for key columns (in UPDATEs and
DELETEs), stop when we reach the end of the attkind string
- when creating the triggers, final "v"s are stripped
Result:
- one can add columns (without defaults, constraints, etc.) to tables
(destinations first, origin last) without changing the logtrigger and
without using EXECUTE SCRIPT
- as a bonus we save a few cycles in updates and deletes
Comments welcome!
Jacque.
--- src/backend/slony1_funcs.c.orig Wed Nov 21 15:43:24 2007
+++ src/backend/slony1_funcs.c Wed Nov 21 15:45:13 2007
@@ -821,6 +821,8 @@
continue;
attkind_idx++;
+ if (!attkind[attkind_idx])
+ break;
if (attkind[attkind_idx] != 'k')
continue;
col_ident = (char
*)slon_quote_identifier(SPI_fname(tupdesc, i + 1));
@@ -888,6 +890,8 @@
continue;
attkind_idx++;
+ if (!attkind[attkind_idx])
+ break;
if (attkind[attkind_idx] != 'k')
continue;
col_ident = (char
*)slon_quote_identifier(SPI_fname(tupdesc, i + 1));
--- src/backend/slony1_funcs.sql.orig Wed Nov 21 15:45:35 2007
+++ src/backend/slony1_funcs.sql Wed Nov 21 15:53:11 2007
@@ -5029,6 +5029,11 @@
end loop;
--
+ -- Strip final 'v's as these are not needed by the logtrigger
+ --
+ v_attkind := regexp_replace(v_attkind,''v*$'','''');
+
+ --
-- Return the resulting attkind
--
return v_attkind;
- Previous message: [Slony1-general] Slony Newbie Question
- Next message: [Slony1-general] Patch for shorter attkind
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list