Bug 237 - drop set does not remove truncate triggers
Summary: drop set does not remove truncate triggers
Status: RESOLVED FIXED
Alias: None
Product: Slony-I
Classification: Unclassified
Component: stored procedures (show other bugs)
Version: devel
Hardware: PC Linux
: low enhancement
Assignee: Jan Wieck
URL: https://github.com/wieck/slony1-engin...
Depends on:
Blocks:
 
Reported: 2011-08-31 12:42 UTC by Steve Singer
Modified: 2011-11-08 10:58 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Singer 2011-08-31 12:42:22 UTC
14: PGRES_FATAL_ERROR lock table "_disorder_replica".sl_config_lock;select "_disorder_replica".setAddTable(4, 9, 'disorder.do_config', 'do_config_pkey', 'disorder.do_config');  - ERROR:  trigger "_disorder_replica_truncatetrigger" for relation "do_config" already exists


The above error happens if you try to add a table to replication that was previously part of a replication set that was dropped.

alterTableDropTriggers does not remove the truncate trigger from the table.

This bug is new in 2.1.0 and is present in 2.1.0 rc1
Comment 1 Jan Wieck 2011-10-03 16:21:52 UTC
Please review patch.
Comment 2 Christopher Browne 2011-10-06 12:48:32 UTC
I have revised the "legacy" regression tests to check this, with success:

https://github.com/cbbrowne/slony1-engine/commit/b06c96faaa06bd42d18f355759851700b07ec2f4

Here is a preliminary "clustertest" regression test; the parts that actually run TRUNCATE need to be filled in.

https://github.com/cbbrowne/slony1-engine/commit/eb85c6dfa63832838d79db801f3f3749c597192b

Here is a revision to release notes for this change:

https://github.com/cbbrowne/slony1-engine/commit/b06c96faaa06bd42d18f355759851700b07ec2f4

I suggest taking my first and third patch as part of the release candidate.

I'll pursue getting the "clustertest" test set up with Steven; that shouldn't hold up release.
Comment 3 Steve Singer 2011-10-06 13:51:18 UTC
I have a question about this part of the patch (Jan's original patch).

-  perform @NAMESPACE@.add_truncate_triggers();
-
+  -- 2.0 was the only 2.x version without truncate support
+  if p_old like '2.0.%' then
+    perform @NAMESPACE@.upgradeSchemaAddTruncateTriggers();
+  end if;


With the 2.1 version prior to this patch if I upgrade an 8.3 server to a 8.4 server and run the slonik 'update functions' command everything works and truncate triggers get added.  With this patch that won't happen anymore correct?
Comment 4 Christopher Browne 2011-10-06 15:21:23 UTC
A couple more commits to draw in...

1.  Spelling fix

https://github.com/cbbrowne/slony1-engine/commit/45f7547f0f9a1be57dd0127ff439205aa6ce07be

2.  Filling in the regression tests for truncation

https://github.com/cbbrowne/slony1-engine/commit/c68dcbdd5e9cbf4f482e27bf7e32849fdf16e6ed
Comment 5 Jan Wieck 2011-10-07 07:11:14 UTC
I removed the 2.0 check as per Steve's comment and merged in Chris' commits.

https://github.com/wieck/slony1-engine/commit/661c6e82167515a203bc8574c7e3f17d1c9f5cce
Comment 6 Steve Singer 2011-11-08 10:58:45 UTC
This was merged into 2.1.0 
6838c614d10368500abce2c12490935bdea0da3d