/usr/bin/slonik_drop_sequence is in slony1-2-bin 2.0.7-3build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #!/usr/bin/perl
#
# Author: Mark Stosberg
# Based on work by: Christopher Browne
# Parts Copyright 2008 Summerault, LLC
# Parts Copyright 2004-2009 Afilias Canada
use Getopt::Long;
$CONFIG_FILE = '/etc/slony1/slon_tools.conf';
$SHOW_USAGE = 0;
# Read command-line options
GetOptions("config=s" => \$CONFIG_FILE,
"help" => \$SHOW_USAGE);
my $USAGE =
"Usage: slonik_drop_sequence [--config file] sequence_id set
sequence_id The ID of the sequence to be dropped from replication
set The name or ID of the set to drop the sequence from
You can get the sequence_id with a query like this:
SELECT seq_id,seq_relname from _MY_CLUSTER.sl_sequence where seq_relname = 'MY_SEQUENCE';
No application-visible locking should take place.
";
if ($SHOW_USAGE) {
print $USAGE;
exit 0;
}
require '/usr/share/slony1/slon-tools.pm';
require $CONFIG_FILE;
my ($SEQ_ID,$set) = @ARGV;
$SET_ID = get_set($set);
unless ($SEQ_ID && $SET_ID) {
die $USAGE;
}
my $slonik = '';
$slonik .= genheader();
# DROP TABLE
$slonik .= "\n";
$slonik .= "# DROP SEQUENCE \n";
$slonik .= " try {\n";
$slonik .= " SET DROP SEQUENCE (id = $SEQ_ID, origin = $SET_ORIGIN);\n";
$slonik .= " } on error {\n";
$slonik .= " echo 'Could not drop sequence $SEQ_ID for $CLUSTER_NAME!';\n";
$slonik .= " exit -1;\n";
$slonik .= " }\n";
run_slonik_script($slonik, 'DROP SEQUENCE');
|