OK, I figure the easiest way to explain what I propose wrt. case-folding is to
supply a patch. No changes to the DB functions, just a small change in
slon_tools.pm and slonik_create_set.pl
If you define:
foldCase => 1,
in slon_tools.conf, object names (including schema - wasn't sure if that was
wise or not) will be folded to lower case.
The default is 0, so no change to existing behaviour unless you specifically
say so.
I also changed 'table1' -> 'TABLE1' in the sample conf to illustrate the
difference.
Would this be acceptable?
Regards, Philip.
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan
-----------------
Utiba Pty Ltd
This message has been scanned for viruses and
dangerous content by Utiba mail server and is
believed to be clean.
Index: slon-tools.pm
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slon-tools.pm,v
retrieving revision 1.25
diff -c -r1.25 slon-tools.pm
*** slon-tools.pm 23 Sep 2005 15:44:32 -0000 1.25
--- slon-tools.pm 27 Oct 2005 02:24:52 -0000
***************
*** 246,251 ****
--- 246,252 ----
%KEYEDTABLES = %{$match->{"keyedtables"}};
@SERIALTABLES = @{$match->{"serialtables"}};
@SEQUENCES = @{$match->{"sequences"}};
+ $FOLD_CASE = ($match->{"foldCase"} or 0);
return $match->{"set_id"};
}
Index: slon_tools.conf-sample
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slon_tools.conf-sample,v
retrieving revision 1.6
diff -c -r1.6 slon_tools.conf-sample
*** slon_tools.conf-sample 25 Jul 2005 21:47:52 -0000 1.6
--- slon_tools.conf-sample 27 Oct 2005 02:24:52 -0000
***************
*** 94,99 ****
--- 94,109 ----
#
# "origin" => 1,
+ # If this is set to 1, table and sequence names will be folded to lower-case
+ # to match the way that PostgreSQL handles unquoted names.
+ # For example, CREATE TABLE ACCOUNT(...) actually turns into CREATE TABLE account(...);
+ # unless you put quotes around the table name
+ # Slony always quotes object names, so you may get a mis-match between the table-name
+ # as PostgreSQL understands it, and as Slony represents it.
+ # default value is 0
+ #
+ # foldCase => 0,
+
# The first ID to use for tables and sequences that are added
# to the replication cluster. This must be unique across the
# cluster.
***************
*** 108,114 ****
# This array contains a list of tables that already have
# primary keys.
"pkeyedtables" => [
! 'table1',
'table2',
],
--- 118,124 ----
# This array contains a list of tables that already have
# primary keys.
"pkeyedtables" => [
! 'TABLE1',
'table2',
],
Index: slonik_create_set.pl
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slonik_create_set.pl,v
retrieving revision 1.2
diff -c -r1.2 slonik_create_set.pl
*** slonik_create_set.pl 7 Sep 2005 19:49:27 -0000 1.2
--- slonik_create_set.pl 27 Oct 2005 02:24:52 -0000
***************
*** 1,4 ****
--- 1,5 ----
#!@@PERL@@
+
# $Id: slonik_create_set.pl,v 1.2 2005/09/07 19:49:27 cbbrowne Exp $
# Author: Christopher Browne
# Copyright 2004 Afilias Canada
***************
*** 42,47 ****
--- 43,49 ----
print SLONIK "# TABLE ADD KEY\n";
foreach my $table (@SERIALTABLES) {
$table = ensure_namespace($table);
+ $table = lc($table) if $FOLD_CASE;
print SLONIK " echo ' Adding unique key to table $table...';\n";
print SLONIK " table add key (\n";
print SLONIK " node id = $SET_ORIGIN,\n";
***************
*** 69,74 ****
--- 71,77 ----
foreach my $table (@SERIALTABLES) {
$table = ensure_namespace($table);
+ $table = lc($table) if $FOLD_CASE;
print SLONIK " set add table (set id = $SET_ID, origin = $SET_ORIGIN, id = $TABLE_ID,\n";
print SLONIK " full qualified name = '$table', key=serial,\n";
print SLONIK " comment = 'Table $table without primary key');\n";
***************
*** 78,83 ****
--- 81,87 ----
foreach my $table (@PKEYEDTABLES) {
$table = ensure_namespace($table);
+ $table = lc($table) if $FOLD_CASE;
print SLONIK " set add table (set id = $SET_ID, origin = $SET_ORIGIN, id = $TABLE_ID,\n";
print SLONIK " full qualified name = '$table',\n";
print SLONIK " comment = 'Table $table with primary key');\n";
***************
*** 88,93 ****
--- 92,98 ----
foreach my $table (keys %KEYEDTABLES) {
my $key = $KEYEDTABLES{$table};
$table = ensure_namespace($table);
+ $table = lc($table) if $FOLD_CASE;
print SLONIK " set add table (set id = $SET_ID, origin = $SET_ORIGIN, id = $TABLE_ID,\n";
print SLONIK " full qualified name = '$table', key='$key',\n";
print SLONIK " comment = 'Table $table with candidate primary key $key');\n";
***************
*** 103,108 ****
--- 108,114 ----
$SEQUENCE_ID = 1 if $SEQUENCE_ID < 1;
foreach my $seq (@SEQUENCES) {
$seq = ensure_namespace($seq);
+ $seq = lc($seq) if $FOLD_CASE;
print SLONIK " set add sequence (set id = $SET_ID, origin = $SET_ORIGIN, id = $SEQUENCE_ID,\n";
print SLONIK " full qualified name = '$seq',\n";
print SLONIK " comment = 'Sequence $seq');\n";
_______________________________________________
Slony1-general mailing list
[email protected]
http://gborg.postgresql.org/mailman/listinfo/slony1-general