From 9a27f72b37e89f71653292c9be853ad15b84d93f Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 19 May 2006 02:39:04 +0000 Subject: [PATCH] Use SQL standard '' rather than \' in /contrib. Backpatch to 8.1.X. --- contrib/dbmirror/DBMirror.pl | 8 ++++---- contrib/dbmirror/pending.c | 6 +++--- contrib/earthdistance/earthdistance.sql.in | 2 +- contrib/tsearch2/query.c | 2 +- contrib/tsearch2/tsvector.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/dbmirror/DBMirror.pl b/contrib/dbmirror/DBMirror.pl index 63b009b68fc..345a250e1e0 100755 --- a/contrib/dbmirror/DBMirror.pl +++ b/contrib/dbmirror/DBMirror.pl @@ -33,7 +33,7 @@ # # ############################################################################## -# $PostgreSQL: pgsql/contrib/dbmirror/DBMirror.pl,v 1.10 2004/07/02 00:58:09 joe Exp $ +# $PostgreSQL: pgsql/contrib/dbmirror/DBMirror.pl,v 1.10.6.1 2006/05/19 02:39:04 momjian Exp $ # ############################################################################## @@ -437,7 +437,7 @@ sub mirrorInsert($$$$$) { if(defined $recordValues{$column}) { my $quotedValue = $recordValues{$column}; $quotedValue =~ s/\\/\\\\/g; - $quotedValue =~ s/'/\\'/g; + $quotedValue =~ s/'/''/g; $valuesQuery .= "'$quotedValue'"; } else { @@ -617,7 +617,7 @@ sub mirrorUpdate($$$$$) { if(defined $currentValue ) { $quotedValue = $currentValue; $quotedValue =~ s/\\/\\\\/g; - $quotedValue =~ s/'/\\'/g; + $quotedValue =~ s/'/''/g; $updateQuery .= "'$quotedValue'"; } else { @@ -639,7 +639,7 @@ sub mirrorUpdate($$$$$) { if(defined $currentValue) { $quotedValue = $currentValue; $quotedValue =~ s/\\/\\\\/g; - $quotedValue =~ s/'/\\'/g; + $quotedValue =~ s/'/''/g; $updateQuery .= "'$quotedValue'"; } else { diff --git a/contrib/dbmirror/pending.c b/contrib/dbmirror/pending.c index f0204f73aaa..26381b01fe0 100644 --- a/contrib/dbmirror/pending.c +++ b/contrib/dbmirror/pending.c @@ -1,7 +1,7 @@ /**************************************************************************** * pending.c - * $Id: pending.c,v 1.23 2005/10/15 02:49:04 momjian Exp $ - * $PostgreSQL: pgsql/contrib/dbmirror/pending.c,v 1.23 2005/10/15 02:49:04 momjian Exp $ + * $Id: pending.c,v 1.23.2.1 2006/05/19 02:39:04 momjian Exp $ + * $PostgreSQL: pgsql/contrib/dbmirror/pending.c,v 1.23.2.1 2006/05/19 02:39:04 momjian Exp $ * * This file contains a trigger for Postgresql-7.x to record changes to tables * to a pending table for mirroring. @@ -541,7 +541,7 @@ packageData(HeapTuple tTupleData, TupleDesc tTupleDesc, Oid tableOid, } if (*cpUnFormatedPtr == '\\' || *cpUnFormatedPtr == '\'') { - *cpFormatedPtr = '\\'; + *cpFormatedPtr = *cpUnFormatedPtr; cpFormatedPtr++; iUsedDataBlock++; } diff --git a/contrib/earthdistance/earthdistance.sql.in b/contrib/earthdistance/earthdistance.sql.in index b5de7534434..4a08cd93694 100644 --- a/contrib/earthdistance/earthdistance.sql.in +++ b/contrib/earthdistance/earthdistance.sql.in @@ -9,7 +9,7 @@ SET search_path = public; CREATE OR REPLACE FUNCTION earth() RETURNS float8 LANGUAGE 'sql' IMMUTABLE -AS 'SELECT \'6378168\'::float8'; +AS 'SELECT ''6378168''::float8'; -- Astromers may want to change the earth function so that distances will be -- returned in degrees. To do this comment out the above definition and diff --git a/contrib/tsearch2/query.c b/contrib/tsearch2/query.c index 0a1805e0e75..10da22c035f 100644 --- a/contrib/tsearch2/query.c +++ b/contrib/tsearch2/query.c @@ -723,7 +723,7 @@ infix(INFIX * in, bool first) { if (*op == '\'') { - *(in->cur) = '\\'; + *(in->cur) = '\''; in->cur++; } *(in->cur) = *op; diff --git a/contrib/tsearch2/tsvector.c b/contrib/tsearch2/tsvector.c index cfed6e428a3..38770dd61c9 100644 --- a/contrib/tsearch2/tsvector.c +++ b/contrib/tsearch2/tsvector.c @@ -526,7 +526,7 @@ tsvector_out(PG_FUNCTION_ARGS) outbuf = (char *) repalloc((void *) outbuf, ++lenbuf); curout = outbuf + pos; - *curout++ = '\\'; + *curout++ = '\''; } *curout++ = *curin++; }