Chris Browne cbbrowne at lists.slony.info
Fri Oct 26 11:23:07 PDT 2007
Update of /home/cvsd/slony1/slony1-engine/tools/altperl
In directory main.slony.info:/tmp/cvs-serv28401

Modified Files:
	slonik_build_env.pl 
Log Message:
From: Bernd Helmle <mailings at oopsware.de>

--On Donnerstag, Oktober 25, 2007 13:11:49 -0700 slony at estrider.com wrote:
>    There is a flaw in the slonik_build_env.pl script. The print test
> should be >=1 and not > 1. It currently will not print databases where
> there are only single tables or sequences.
>

You're right. I've created a patch with your changes plus a fix to
repair the -schema option, which was broken, too, and cc'ed
slony1-patches so someone can review and apply it.

Note that slonik_build_environment is called slonik_build_env only,
the former was removed.

-- 
 Thanks

                    Bernd
-------------------------------------------------
Looks good to me - applied to HEAD branch...


Index: slonik_build_env.pl
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/tools/altperl/slonik_build_env.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** slonik_build_env.pl	13 Dec 2006 22:19:55 -0000	1.2
--- slonik_build_env.pl	26 Oct 2007 18:23:04 -0000	1.3
***************
*** 25,29 ****
  Default schema is \"public\"\n";
  
! &usage if(!GetOptions('node=s@'=>\@nodes));
  
  die "At least one node is required" if ( scalar(@nodes) < 1 );
--- 25,29 ----
  Default schema is \"public\"\n";
  
! &usage if(!GetOptions('node=s@'=>\@nodes, 'schema=s' => \$schema));
  
  die "At least one node is required" if ( scalar(@nodes) < 1 );
***************
*** 69,72 ****
--- 69,73 ----
  die "prepare(tableQuery): $DBI::errstr" if ( !defined($tableQuery) || $DBI::err );
  die "execute(tableQuery): $DBI::errstr" if ( !$tableQuery->execute() );
+ die "No objects to replicate found in schema \"$schema\"\n" if ($tableQuery->rows <= 0);
  
  my @tablesWithIndexes;
***************
*** 84,88 ****
  $dbh->disconnect();
  
! if ( scalar(@tablesWithIndexes) > 1 ) {
    print '@KEYEDTABLES=(' . "\n";
    foreach my $table (sort @tablesWithIndexes) {
--- 85,89 ----
  $dbh->disconnect();
  
! if ( scalar(@tablesWithIndexes) >= 1 ) {
    print '@KEYEDTABLES=(' . "\n";
    foreach my $table (sort @tablesWithIndexes) {
***************
*** 91,95 ****
    print ");\n";
  }
! if ( scalar(@tablesWithoutIndexes) > 1 ) {
    print '@SERIALTABLES=(' . "\n";
    foreach my $table (sort @tablesWithoutIndexes) {
--- 92,96 ----
    print ");\n";
  }
! if ( scalar(@tablesWithoutIndexes) >= 1 ) {
    print '@SERIALTABLES=(' . "\n";
    foreach my $table (sort @tablesWithoutIndexes) {
***************
*** 98,102 ****
    print ");\n";
  }
! if ( scalar(@sequences) > 1 ) {
    print '@SEQUENCES=(' . "\n";
    foreach my $table (sort @sequences) {
--- 99,103 ----
    print ");\n";
  }
! if ( scalar(@sequences) >= 1 ) {
    print '@SEQUENCES=(' . "\n";
    foreach my $table (sort @sequences) {



More information about the Slony1-commit mailing list