Package: postgresql-contrib
Version: 7.4.7-6sarge2
Severity: critical
Justification: causes serious data loss


Hello,

using version 7.4.7-6sarge2 of postgresql-contrib cause trouble in
database replication using /usr/lib/postgresql/bin/DBMirror.pl

The problem I have found is if there is a ' character (the single quote)
in the data. In this case, the single quote (') is replaced by two
single quotes ('') in the table PendingData. This cause the replication
process to stop with a message "Error in PendingData Sequence Id XXX".

To replicate the non-replicated data, I have run a patched version of
DBMirror.pl. Here is my patch (mainly replacing the two single quotes by
a backslash and one single quote, this mean '' -> \'. Execepted if there
is a equal before, this mean don't replace ='') :

--- /usr/lib/postgresql/bin/DBMirror.pl 2005-05-18 10:33:34.000000000 +0200
+++ ./DBMirror.pl       2006-06-08 11:53:39.000000000 +0200
@@ -827,6 +827,9 @@
   $fnumber = 4;
   my $dataField = $pendingResult->getvalue($currentTuple,$fnumber);
 
+  # replace all the '' to \' in the texts
+  $dataField =~ s/([^=])\'\'/\1\\\'/g;
+
   while(length($dataField)>0) {
     # Extract the field name that is surronded by double quotes
     $dataField =~ m/(\".*?\")/s;

I'm sure this patch is not enough, because this don't take in account if
the data has in it something like "=''". I think the part to patch is
not the DBMirror.pl, but the "recordchange" procedure called by the
trigger on each data change.

Reverting postgresql-contrib to version 7.4.7-6sarge1 correct the
problem only if you have nothing in the Pending table.

Thanks for your attention, and have a nice day.

                Oliver

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.22
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages postgresql-contrib depends on:
ii  libc6                 2.3.2.ds1-22sarge3 GNU C Library: Shared libraries an
ii  libdbd-pg-perl        1.41-3             a PostgreSQL interface for Perl 5 
ii  libkrb53              1.3.6-2sarge2      MIT Kerberos runtime libraries
ii  libpam0g              0.76-22            Pluggable Authentication Modules l
ii  libpg-perl            1:2.0.2-4          Perl modules for PostgreSQL
ii  libpq3                7.4.7-6sarge2      PostgreSQL C client library
ii  libreadline4          4.3-11             GNU readline and history libraries
ii  libssl0.9.7           0.9.7e-3sarge1     SSL shared libraries
ii  libxml2               2.6.16-7           GNOME XML library
ii  postgresql            7.4.7-6sarge2      object-relational SQL database man
ii  zlib1g                1:1.2.2-4.sarge.2  compression library - runtime

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to