mirror of
https://github.com/postgres/postgres.git
synced 2025-12-01 12:18:01 +03:00
Fix tsvectorout() and tsqueryout() to escape backslesh, add test of that.
Patch by Bruce Momjian <bruce@momjian.us> Backpatch is needed, but it's impossible to apply it directly
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/tsquery.c,v 1.10 2007/11/15 22:25:16 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/tsquery.c,v 1.11 2007/11/16 15:05:59 teodor Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -614,6 +614,11 @@ infix(INFIX *in, bool first)
|
||||
*(in->cur) = '\'';
|
||||
in->cur++;
|
||||
}
|
||||
else if (t_iseq(op, '\\'))
|
||||
{
|
||||
*(in->cur) = '\\';
|
||||
in->cur++;
|
||||
}
|
||||
COPYCHAR(in->cur, op);
|
||||
|
||||
clen = pg_mblen(op);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.8 2007/11/15 22:25:16 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.9 2007/11/16 15:05:59 teodor Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -345,6 +345,8 @@ tsvectorout(PG_FUNCTION_ARGS)
|
||||
|
||||
if (t_iseq(curin, '\''))
|
||||
*curout++ = '\'';
|
||||
else if (t_iseq(curin, '\\'))
|
||||
*curout++ = '\\';
|
||||
|
||||
while (len--)
|
||||
*curout++ = *curin++;
|
||||
|
||||
Reference in New Issue
Block a user