From 833e84621cf0ed48f1f5537aa5b569f333e02105 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sun, 21 May 2006 19:57:40 +0000 Subject: [PATCH] Change \' to '', for SQL standards compliance. Backpatch to 7.3, 7.4, and 8.0. Later releases already patched. --- contrib/dbmirror/DBMirror.pl | 8 +++---- contrib/dbmirror/pending.c | 6 +++--- contrib/tsearch/expected/tsearch.out | 26 +++++++++++----------- contrib/tsearch/sql/tsearch.sql | 26 +++++++++++----------- contrib/tsearch2/expected/tsearch2.out | 30 +++++++++++++------------- contrib/tsearch2/sql/tsearch2.sql | 30 +++++++++++++------------- src/backend/utils/adt/ruleutils.c | 6 +++--- src/bin/initdb/initdb.c | 4 ++-- src/bin/pg_dump/pg_dump.c | 4 ++-- src/bin/psql/large_obj.c | 4 ++-- src/interfaces/ecpg/test/test1.pgc | 2 +- src/interfaces/libpq/fe-exec.c | 4 ++-- src/pl/plpgsql/src/gram.y | 4 ++-- src/tutorial/funcs.source | 6 +++--- 14 files changed, 80 insertions(+), 80 deletions(-) diff --git a/contrib/dbmirror/DBMirror.pl b/contrib/dbmirror/DBMirror.pl index 63b009b68fc..cdeafc59da8 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.4.1 2006/05/21 19:57:38 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 48e91acd782..c7dc41f9013 100644 --- a/contrib/dbmirror/pending.c +++ b/contrib/dbmirror/pending.c @@ -1,7 +1,7 @@ /**************************************************************************** * pending.c - * $Id: pending.c,v 1.20 2004/09/10 04:31:06 neilc Exp $ - * $PostgreSQL: pgsql/contrib/dbmirror/pending.c,v 1.20 2004/09/10 04:31:06 neilc Exp $ + * $Id: pending.c,v 1.20.4.1 2006/05/21 19:57:38 momjian Exp $ + * $PostgreSQL: pgsql/contrib/dbmirror/pending.c,v 1.20.4.1 2006/05/21 19:57:38 momjian Exp $ * * This file contains a trigger for Postgresql-7.x to record changes to tables * to a pending table for mirroring. @@ -546,7 +546,7 @@ packageData(HeapTuple tTupleData, TupleDesc tTupleDesc, Oid tableOid, } if (*cpUnFormatedPtr == '\\' || *cpUnFormatedPtr == '\'') { - *cpFormatedPtr = '\\'; + *cpFormatedPtr = *cpUnFormatedPtr; cpFormatedPtr++; iUsedDataBlock++; } diff --git a/contrib/tsearch/expected/tsearch.out b/contrib/tsearch/expected/tsearch.out index e3e687ebc1f..59e3144eb6e 100644 --- a/contrib/tsearch/expected/tsearch.out +++ b/contrib/tsearch/expected/tsearch.out @@ -46,31 +46,31 @@ SELECT '1 2'::txtidx; '1' '2' (1 row) -SELECT '\'1 2\''::txtidx; +SELECT '''1 2'''::txtidx; txtidx -------- '1 2' (1 row) -SELECT '\'1 \\\'2\''::txtidx; +SELECT '''1 \\''2'''::txtidx; txtidx --------- '1 \'2' (1 row) -SELECT '\'1 \\\'2\'3'::txtidx; +SELECT '''1 \\''2''3'::txtidx; txtidx ------------- '3' '1 \'2' (1 row) -SELECT '\'1 \\\'2\' 3'::txtidx; +SELECT '''1 \\''2'' 3'::txtidx; txtidx ------------- '3' '1 \'2' (1 row) -SELECT '\'1 \\\'2\' \' 3\' 4 '::txtidx; +SELECT '''1 \\''2'' '' 3'' 4 '::txtidx; txtidx ------------------ '4' ' 3' '1 \'2' @@ -101,13 +101,13 @@ SELECT ' 1 '::query_txt; '1' (1 row) -SELECT '\'1 2\''::query_txt; +SELECT '''1 2'''::query_txt; query_txt ----------- '1 2' (1 row) -SELECT '\'1 \\\'2\''::query_txt; +SELECT '''1 \\''2'''::query_txt; query_txt ----------- '1 \'2' @@ -305,7 +305,7 @@ SELECT '1&(2&(4&(5|!6)))'::query_txt; '1' & '2' & '4' & ( '5' | !'6' ) (1 row) -SELECT '1&(\'2\'&(\' 4\'&(\\|5 | \'6 \\\' !|&\')))'::query_txt; +SELECT '1&(''2''&('' 4''&(\\|5 | ''6 \\'' !|&'')))'::query_txt; query_txt ------------------------------------------ '1' & '2' & ' 4' & ( '|5' | '6 \' !|&' ) @@ -335,13 +335,13 @@ SELECT ' 1 '::mquery_txt; '1' (1 row) -SELECT '\'1 2\''::mquery_txt; +SELECT '''1 2'''::mquery_txt; mquery_txt ------------ '1' & '2' (1 row) -SELECT '\'1 \\\'2\''::mquery_txt; +SELECT '''1 \\''2'''::mquery_txt; mquery_txt ------------ '1' & '2' @@ -539,7 +539,7 @@ SELECT '1&(2&(4&(5|!6)))'::mquery_txt; '1' & '2' & '4' & ( '5' | !'6' ) (1 row) -SELECT '1&(\'2\'&(\' 4\'&(\\|5 | \'6 \\\' !|&\')))'::mquery_txt; +SELECT '1&(''2''&('' 4''&(\\|5 | ''6 \\'' !|&'')))'::mquery_txt; mquery_txt --------------------------------- '1' & '2' & '4' & ( '5' | '6' ) @@ -698,7 +698,7 @@ SELECT count(*) FROM test_txtidx WHERE a ## '(eq|yt)&(wR|qh)'; 11 (1 row) -SELECT txt2txtidx('345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +SELECT txt2txtidx('345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty'); txt2txtidx @@ -712,7 +712,7 @@ SELECT txtidxsize(txt2txtidx('345 qw')); 2 (1 row) -SELECT txtidxsize(txt2txtidx('345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +SELECT txtidxsize(txt2txtidx('345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty')); txtidxsize diff --git a/contrib/tsearch/sql/tsearch.sql b/contrib/tsearch/sql/tsearch.sql index 70ab3a3b007..3bb3cc980c2 100644 --- a/contrib/tsearch/sql/tsearch.sql +++ b/contrib/tsearch/sql/tsearch.sql @@ -12,19 +12,19 @@ SELECT '1 '::txtidx; SELECT ' 1'::txtidx; SELECT ' 1 '::txtidx; SELECT '1 2'::txtidx; -SELECT '\'1 2\''::txtidx; -SELECT '\'1 \\\'2\''::txtidx; -SELECT '\'1 \\\'2\'3'::txtidx; -SELECT '\'1 \\\'2\' 3'::txtidx; -SELECT '\'1 \\\'2\' \' 3\' 4 '::txtidx; +SELECT '''1 2'''::txtidx; +SELECT '''1 \\''2'''::txtidx; +SELECT '''1 \\''2''3'::txtidx; +SELECT '''1 \\''2'' 3'::txtidx; +SELECT '''1 \\''2'' '' 3'' 4 '::txtidx; --query_txt SELECT '1'::query_txt; SELECT '1 '::query_txt; SELECT ' 1'::query_txt; SELECT ' 1 '::query_txt; -SELECT '\'1 2\''::query_txt; -SELECT '\'1 \\\'2\''::query_txt; +SELECT '''1 2'''::query_txt; +SELECT '''1 \\''2'''::query_txt; SELECT '!1'::query_txt; SELECT '1|2'::query_txt; SELECT '1|!2'::query_txt; @@ -57,13 +57,13 @@ SELECT '1&(2&(4&(5&6)))'::query_txt; SELECT '1&2&4&5&6'::query_txt; SELECT '1&(2&(4&(5|6)))'::query_txt; SELECT '1&(2&(4&(5|!6)))'::query_txt; -SELECT '1&(\'2\'&(\' 4\'&(\\|5 | \'6 \\\' !|&\')))'::query_txt; +SELECT '1&(''2''&('' 4''&(\\|5 | ''6 \\'' !|&'')))'::query_txt; SELECT '1'::mquery_txt; SELECT '1 '::mquery_txt; SELECT ' 1'::mquery_txt; SELECT ' 1 '::mquery_txt; -SELECT '\'1 2\''::mquery_txt; -SELECT '\'1 \\\'2\''::mquery_txt; +SELECT '''1 2'''::mquery_txt; +SELECT '''1 \\''2'''::mquery_txt; SELECT '!1'::mquery_txt; SELECT '1|2'::mquery_txt; SELECT '1|!2'::mquery_txt; @@ -96,7 +96,7 @@ SELECT '1&(2&(4&(5&6)))'::mquery_txt; SELECT '1&2&4&5&6'::mquery_txt; SELECT '1&(2&(4&(5|6)))'::mquery_txt; SELECT '1&(2&(4&(5|!6)))'::mquery_txt; -SELECT '1&(\'2\'&(\' 4\'&(\\|5 | \'6 \\\' !|&\')))'::mquery_txt; +SELECT '1&(''2''&('' 4''&(\\|5 | ''6 \\'' !|&'')))'::mquery_txt; SELECT 'querty-fgries | http://www.google.com/index.html | www.rambler.ru/index.shtml'::mquery_txt; CREATE TABLE test_txtidx( t text, a txtidx ); @@ -133,13 +133,13 @@ SELECT count(*) FROM test_txtidx WHERE a ## 'eq|yt'; SELECT count(*) FROM test_txtidx WHERE a ## '(eq&yt)|(wR&qh)'; SELECT count(*) FROM test_txtidx WHERE a ## '(eq|yt)&(wR|qh)'; -SELECT txt2txtidx('345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +SELECT txt2txtidx('345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty'); SELECT txtidxsize(txt2txtidx('345 qw')); -SELECT txtidxsize(txt2txtidx('345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +SELECT txtidxsize(txt2txtidx('345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty')); diff --git a/contrib/tsearch2/expected/tsearch2.out b/contrib/tsearch2/expected/tsearch2.out index 9e050ae2793..bdc0f639e25 100644 --- a/contrib/tsearch2/expected/tsearch2.out +++ b/contrib/tsearch2/expected/tsearch2.out @@ -47,37 +47,37 @@ SELECT '1 2'::tsvector; '1' '2' (1 row) -SELECT '\'1 2\''::tsvector; +SELECT '''1 2'''::tsvector; tsvector ---------- '1 2' (1 row) -SELECT '\'1 \\\'2\''::tsvector; +SELECT '''1 \\''2'''::tsvector; tsvector ---------- '1 \'2' (1 row) -SELECT '\'1 \\\'2\'3'::tsvector; +SELECT '''1 \\''2''3'::tsvector; tsvector ------------- '3' '1 \'2' (1 row) -SELECT '\'1 \\\'2\' 3'::tsvector; +SELECT '''1 \\''2'' 3'::tsvector; tsvector ------------- '3' '1 \'2' (1 row) -SELECT '\'1 \\\'2\' \' 3\' 4 '::tsvector; +SELECT '''1 \\''2'' '' 3'' 4 '::tsvector; tsvector ------------------ '4' ' 3' '1 \'2' (1 row) -select '\'w\':4A,3B,2C,1D,5 a:8'; +select '''w'':4A,3B,2C,1D,5 a:8'; ?column? ----------------------- 'w':4A,3B,2C,1D,5 a:8 @@ -126,13 +126,13 @@ SELECT ' 1 '::tsquery; '1' (1 row) -SELECT '\'1 2\''::tsquery; +SELECT '''1 2'''::tsquery; tsquery --------- '1 2' (1 row) -SELECT '\'1 \\\'2\''::tsquery; +SELECT '''1 \\''2'''::tsquery; tsquery --------- '1 \'2' @@ -330,13 +330,13 @@ SELECT '1&(2&(4&(5|!6)))'::tsquery; '1' & '2' & '4' & ( '5' | !'6' ) (1 row) -SELECT '1&(\'2\'&(\' 4\'&(\\|5 | \'6 \\\' !|&\')))'::tsquery; +SELECT '1&(''2''&('' 4''&(\\|5 | ''6 \\'' !|&'')))'::tsquery; tsquery ------------------------------------------ '1' & '2' & ' 4' & ( '|5' | '6 \' !|&' ) (1 row) -SELECT '\'the wether\':dc & \' sKies \':BC & a:d b:a'; +SELECT '''the wether'':dc & '' sKies '':BC & a:d b:a'; ?column? ------------------------------------------ 'the wether':dc & ' sKies ':BC & a:d b:a @@ -382,7 +382,7 @@ select * from token_type('default'); 23 | entity | HTML Entity (23 rows) -select * from parse('default', '345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +select * from parse('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty'); tokid | token @@ -529,7 +529,7 @@ select * from parse('default', '345 qwe@efd.r \' http://www.com/ http://aew.werc 1 | qwerty (138 rows) -SELECT to_tsvector('default', '345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +SELECT to_tsvector('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty'); to_tsvector @@ -543,7 +543,7 @@ SELECT length(to_tsvector('default', '345 qw')); 2 (1 row) -SELECT length(to_tsvector('default', '345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +SELECT length(to_tsvector('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty')); length @@ -563,7 +563,7 @@ select to_tsquery('simple', 'qwe & sKies '); 'qwe' & 'skies' (1 row) -select to_tsquery('default', '\'the wether\':dc & \' sKies \':BC '); +select to_tsquery('default', '''the wether'':dc & '' sKies '':BC '); to_tsquery ------------------------ 'wether':CD & 'sky':BC @@ -729,7 +729,7 @@ SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); (1 row) drop trigger tsvectorupdate on test_tsvector; -create function wow(text) returns text as 'select $1 || \' copyright\'; ' language sql; +create function wow(text) returns text as 'select $1 || '' copyright''; ' language sql; create trigger tsvectorupdate before update or insert on test_tsvector for each row execute procedure tsearch2(a, wow, t); insert into test_tsvector (t) values ('345 qwerty'); diff --git a/contrib/tsearch2/sql/tsearch2.sql b/contrib/tsearch2/sql/tsearch2.sql index 0a980608f7c..d6192579ff6 100644 --- a/contrib/tsearch2/sql/tsearch2.sql +++ b/contrib/tsearch2/sql/tsearch2.sql @@ -12,12 +12,12 @@ SELECT '1 '::tsvector; SELECT ' 1'::tsvector; SELECT ' 1 '::tsvector; SELECT '1 2'::tsvector; -SELECT '\'1 2\''::tsvector; -SELECT '\'1 \\\'2\''::tsvector; -SELECT '\'1 \\\'2\'3'::tsvector; -SELECT '\'1 \\\'2\' 3'::tsvector; -SELECT '\'1 \\\'2\' \' 3\' 4 '::tsvector; -select '\'w\':4A,3B,2C,1D,5 a:8'; +SELECT '''1 2'''::tsvector; +SELECT '''1 \\''2'''::tsvector; +SELECT '''1 \\''2''3'::tsvector; +SELECT '''1 \\''2'' 3'::tsvector; +SELECT '''1 \\''2'' '' 3'' 4 '::tsvector; +select '''w'':4A,3B,2C,1D,5 a:8'; select 'a:3A b:2a'::tsvector || 'ba:1234 a:1B'; select setweight('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd zxc:81,567,222A'::tsvector, 'c'); select strip('w:12B w:13* w:12,5,6 a:1,3* a:3 w asd:1dc asd'::tsvector); @@ -28,8 +28,8 @@ SELECT '1'::tsquery; SELECT '1 '::tsquery; SELECT ' 1'::tsquery; SELECT ' 1 '::tsquery; -SELECT '\'1 2\''::tsquery; -SELECT '\'1 \\\'2\''::tsquery; +SELECT '''1 2'''::tsquery; +SELECT '''1 \\''2'''::tsquery; SELECT '!1'::tsquery; SELECT '1|2'::tsquery; SELECT '1|!2'::tsquery; @@ -62,31 +62,31 @@ SELECT '1&(2&(4&(5&6)))'::tsquery; SELECT '1&2&4&5&6'::tsquery; SELECT '1&(2&(4&(5|6)))'::tsquery; SELECT '1&(2&(4&(5|!6)))'::tsquery; -SELECT '1&(\'2\'&(\' 4\'&(\\|5 | \'6 \\\' !|&\')))'::tsquery; -SELECT '\'the wether\':dc & \' sKies \':BC & a:d b:a'; +SELECT '1&(''2''&('' 4''&(\\|5 | ''6 \\'' !|&'')))'::tsquery; +SELECT '''the wether'':dc & '' sKies '':BC & a:d b:a'; select lexize('simple', 'ASD56 hsdkf'); select lexize('en_stem', 'SKIES Problems identity'); select * from token_type('default'); -select * from parse('default', '345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +select * from parse('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty'); -SELECT to_tsvector('default', '345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +SELECT to_tsvector('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty'); SELECT length(to_tsvector('default', '345 qw')); -SELECT length(to_tsvector('default', '345 qwe@efd.r \' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 +SELECT length(to_tsvector('default', '345 qwe@efd.r '' http://www.com/ http://aew.werc.ewr/?ad=qwe&dw 1aew.werc.ewr/?ad=qwe&dw 2aew.werc.ewr http://3aew.werc.ewr/?ad=qwe&dw http://4aew.werc.ewr http://5aew.werc.ewr:8100/? ad=qwe&dw 6aew.werc.ewr:8100/?ad=qwe&dw 7aew.werc.ewr:8100/?ad=qwe&dw=%20%32 +4.0e-10 qwe qwe qwqwe 234.435 455 5.005 teodor@stack.net qwe-wer asdf qwer jf sdjk ewr1> ewri2 /usr/local/fff /awdf/dwqe/4325 rewt/ewr wefjn /wqe-324/ewr gist.h gist.h.c gist.c. readline 4.2 4.2. 4.2, readline-4.2 readline-4.2. 234 wow < jqw <> qwerty')); select to_tsquery('default', 'qwe & sKies '); select to_tsquery('simple', 'qwe & sKies '); -select to_tsquery('default', '\'the wether\':dc & \' sKies \':BC '); +select to_tsquery('default', '''the wether'':dc & '' sKies '':BC '); select to_tsquery('default', 'asd&(and|fghj)'); select to_tsquery('default', '(asd&and)|fghj'); select to_tsquery('default', '(asd&!and)|fghj'); @@ -135,7 +135,7 @@ UPDATE test_tsvector SET t = null WHERE t = '345 qwerty'; SELECT count(*) FROM test_tsvector WHERE a @@ to_tsquery('345&qwerty'); drop trigger tsvectorupdate on test_tsvector; -create function wow(text) returns text as 'select $1 || \' copyright\'; ' language sql; +create function wow(text) returns text as 'select $1 || '' copyright''; ' language sql; create trigger tsvectorupdate before update or insert on test_tsvector for each row execute procedure tsearch2(a, wow, t); insert into test_tsvector (t) values ('345 qwerty'); diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index d35529c72e8..3113dfa09ea 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -3,7 +3,7 @@ * back to source text * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.188.4.4 2006/01/26 17:08:34 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.188.4.5 2006/05/21 19:57:39 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -568,7 +568,7 @@ pg_get_triggerdef(PG_FUNCTION_ARGS) { /* escape quotes and backslashes */ if (*p == '\'' || *p == '\\') - appendStringInfoChar(&buf, '\\'); + appendStringInfoChar(&buf, *p); appendStringInfoChar(&buf, *p++); } p++; @@ -3699,7 +3699,7 @@ get_const_expr(Const *constval, deparse_context *context) if (ch == '\'' || ch == '\\') { - appendStringInfoChar(buf, '\\'); + appendStringInfoChar(buf, ch); appendStringInfoChar(buf, ch); } else if (((unsigned char) ch) < ((unsigned char) ' ')) diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index a4c8b70ccbe..d44e3cdbe53 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -39,7 +39,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * Portions taken from FreeBSD. * - * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.73.4.3 2006/02/24 00:54:27 adunstan Exp $ + * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.73.4.4 2006/05/21 19:57:39 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -1955,7 +1955,7 @@ escape_quotes(const char *src) for (i = 0, j = 0; i < len; i++) { if (src[i] == '\'' || src[i] == '\\') - result[j++] = '\\'; + result[j++] = src[i]; result[j++] = src[i]; } result[j] = '\0'; diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index f71d41a2394..a99b83372f0 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -12,7 +12,7 @@ * by PostgreSQL * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.400.4.6 2006/01/09 21:16:37 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.400.4.7 2006/05/21 19:57:39 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -7553,7 +7553,7 @@ dumpTrigger(Archive *fout, TriggerInfo *tginfo) while (s < p) { if (*s == '\'') - appendPQExpBufferChar(query, '\\'); + appendPQExpBufferChar(query, '\''); appendPQExpBufferChar(query, *s++); } appendPQExpBufferChar(query, '\''); diff --git a/src/bin/psql/large_obj.c b/src/bin/psql/large_obj.c index 2b2a730f5b0..dff8cad571e 100644 --- a/src/bin/psql/large_obj.c +++ b/src/bin/psql/large_obj.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/large_obj.c,v 1.35 2005/01/01 05:43:08 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/large_obj.c,v 1.35.4.1 2006/05/21 19:57:39 momjian Exp $ */ #include "postgres_fe.h" #include "large_obj.h" @@ -178,7 +178,7 @@ do_lo_import(const char *filename_arg, const char *comment_arg) for (i = 0; i < slen; i++) { if (comment_arg[i] == '\'' || comment_arg[i] == '\\') - *bufptr++ = '\\'; + *bufptr++ = comment_arg[i]; *bufptr++ = comment_arg[i]; } strcpy(bufptr, "'"); diff --git a/src/interfaces/ecpg/test/test1.pgc b/src/interfaces/ecpg/test/test1.pgc index 753c0abae5d..f44c6fe0b8a 100644 --- a/src/interfaces/ecpg/test/test1.pgc +++ b/src/interfaces/ecpg/test/test1.pgc @@ -84,7 +84,7 @@ exec sql end declare section; exec sql execute immediate :command; printf("New tuple got OID = %ld\n", sqlca.sqlerrd[1]); - sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: \\\'mm\\\'', 2, 't')"); + sprintf(command, "insert into \"Test\" (name, amount, letter) values ('db: ''mm''', 2, 't')"); exec sql execute immediate :command; strcpy(msg, "execute insert 2"); diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 3b8d9629328..f24d5f4439d 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.166 2004/12/31 22:03:50 pgsql Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.166.4.1 2006/05/21 19:57:39 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -2433,7 +2433,7 @@ PQescapeBytea(const unsigned char *bintext, size_t binlen, size_t *bytealen) } else if (*vp == '\'') { - rp[0] = '\\'; + rp[0] = '\''; rp[1] = '\''; rp += 2; } diff --git a/src/pl/plpgsql/src/gram.y b/src/pl/plpgsql/src/gram.y index a4fa1546b90..4e4ff9af70e 100644 --- a/src/pl/plpgsql/src/gram.y +++ b/src/pl/plpgsql/src/gram.y @@ -4,7 +4,7 @@ * procedural language * * IDENTIFICATION - * $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.64.4.3 2005/02/08 18:21:59 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.64.4.4 2006/05/21 19:57:39 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -389,7 +389,7 @@ decl_statement : decl_varname decl_const decl_datatype decl_notnull decl_defval while (*cp1 != '\0') { if (*cp1 == '\\' || *cp1 == '\'') - *cp2++ = '\\'; + *cp2++ = *cp1; *cp2++ = *cp1++; } strcpy(cp2, "'::refcursor"); diff --git a/src/tutorial/funcs.source b/src/tutorial/funcs.source index 4dfdf278333..1c981e1f3ac 100644 --- a/src/tutorial/funcs.source +++ b/src/tutorial/funcs.source @@ -6,7 +6,7 @@ -- -- Copyright (c) 1994-5, Regents of the University of California -- --- $PostgreSQL: pgsql/src/tutorial/funcs.source,v 1.7 2003/11/29 22:41:33 pgsql Exp $ +-- $PostgreSQL: pgsql/src/tutorial/funcs.source,v 1.7.4.1 2006/05/21 19:57:40 momjian Exp $ -- --------------------------------------------------------------------------- @@ -76,10 +76,10 @@ WHERE EMP.cubicle ~= '(2,1)'::point; -- columns of EMP. CREATE FUNCTION new_emp() RETURNS EMP - AS 'SELECT \'None\'::text AS name, + AS 'SELECT ''None''::text AS name, 1000 AS salary, 25 AS age, - \'(2,2)\'::point AS cubicle' + ''(2,2)''::point AS cubicle' LANGUAGE 'sql'; -- you can then project a column out of resulting the tuple by using the -- 2.39.5