Tue Nov 15 18:10:08 PST 2005
- Previous message: [Slony1-commit] By cbbrowne: Many revisions to automated test bed...
- Next message: [Slony1-commit] By cbbrowne: New Directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message:
-----------
Support case-folding - Philip Yarra <philip at utiba.com>
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.
Modified Files:
--------------
slony1-engine/tools/altperl:
slon-tools.pm (r1.25 -> r1.26)
slon_tools.conf-sample (r1.6 -> r1.7)
slonik_create_set.pl (r1.2 -> r1.3)
-------------- next part --------------
Index: slon-tools.pm
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slon-tools.pm,v
retrieving revision 1.25
retrieving revision 1.26
diff -Ltools/altperl/slon-tools.pm -Ltools/altperl/slon-tools.pm -u -w -r1.25 -r1.26
--- tools/altperl/slon-tools.pm
+++ tools/altperl/slon-tools.pm
@@ -246,6 +246,7 @@
%KEYEDTABLES = %{$match->{"keyedtables"}};
@SERIALTABLES = @{$match->{"serialtables"}};
@SEQUENCES = @{$match->{"sequences"}};
+ $FOLD_CASE = ($match->{"foldCase"} or 0);
return $match->{"set_id"};
}
Index: slonik_create_set.pl
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slonik_create_set.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -Ltools/altperl/slonik_create_set.pl -Ltools/altperl/slonik_create_set.pl -u -w -r1.2 -r1.3
--- tools/altperl/slonik_create_set.pl
+++ tools/altperl/slonik_create_set.pl
@@ -1,4 +1,5 @@
#!@@PERL@@
+
# $Id$
# Author: Christopher Browne
# Copyright 2004 Afilias Canada
@@ -42,6 +43,7 @@
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,6 +71,7 @@
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,6 +81,7 @@
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,6 +92,7 @@
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,6 +108,7 @@
$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";
Index: slon_tools.conf-sample
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/tools/altperl/slon_tools.conf-sample,v
retrieving revision 1.6
retrieving revision 1.7
diff -Ltools/altperl/slon_tools.conf-sample -Ltools/altperl/slon_tools.conf-sample -u -w -r1.6 -r1.7
--- tools/altperl/slon_tools.conf-sample
+++ tools/altperl/slon_tools.conf-sample
@@ -94,6 +94,16 @@
#
# "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,7 +118,7 @@
# This array contains a list of tables that already have
# primary keys.
"pkeyedtables" => [
- 'table1',
+ 'TABLE1',
'table2',
],
- Previous message: [Slony1-commit] By cbbrowne: Many revisions to automated test bed...
- Next message: [Slony1-commit] By cbbrowne: New Directory
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list