Re: Use of backslash in tsearch2 - Mailing list pgsql-patches
| From | Bruce Momjian |
|---|---|
| Subject | Re: Use of backslash in tsearch2 |
| Date | |
| Msg-id | 200608220048.k7M0m6x10224@momjian.us Whole thread Raw |
| In response to | Use of backslash in tsearch2 (Bruce Momjian <bruce@momjian.us>) |
| Responses |
Re: Use of backslash in tsearch2
|
| List | pgsql-patches |
Bruce Momjian wrote:
> Bruce Momjian wrote:
> >
> > I backed out the patch, attached, and it has fixed the regression
> > problem. What has me confused is that is looks like it is checking for
> > ', then putting \, which doesn't make a lot of sense, but the regression
> > output is corrected, so I just don't get it. Here is an example:
> >
> > test=> SELECT E'''1 \\''2''';
> > ?column?
> > ----------
> > '1 \'2'
> >
> > My only guess is that the output is somehow a single-quoted string
> > itself, and in fact \' should become ''. Is that right? Basically they
> > are doing \' in their output, and it should be doing '', but then the
> > query above would be wrong and shouldn't be using \'.
>
> As part of the move to support standard-conforming strings and treat
> backslash literally, I reviewed the tsearch2 code and found two place
> that seemed to use \' rather than '', and generated the attached patch.
> ('' is standards conforming.) However, when I fixed the code, the
> regression tests failed.
>
> Teodor, are the new attached regression results correct? If so, I will
> apply the patch and update the expected file.
Updated patch attached. The previous one was reversed.
--
Bruce Momjian bruce@momjian.us
EnterpriseDB http://www.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Index: contrib/tsearch2/query.c
===================================================================
RCS file: /cvsroot/pgsql/contrib/tsearch2/query.c,v
retrieving revision 1.26
diff -c -c -r1.26 query.c
*** contrib/tsearch2/query.c 19 May 2006 04:39:47 -0000 1.26
--- contrib/tsearch2/query.c 21 Aug 2006 23:58:20 -0000
***************
*** 748,754 ****
{
if ( t_iseq(op, '\'') )
{
! *(in->cur) = '\\';
in->cur++;
}
COPYCHAR(in->cur,op);
--- 748,754 ----
{
if ( t_iseq(op, '\'') )
{
! *(in->cur) = '\'';
in->cur++;
}
COPYCHAR(in->cur,op);
Index: contrib/tsearch2/tsvector.c
===================================================================
RCS file: /cvsroot/pgsql/contrib/tsearch2/tsvector.c,v
retrieving revision 1.20
diff -c -c -r1.20 tsvector.c
*** contrib/tsearch2/tsvector.c 11 Jul 2006 18:26:10 -0000 1.20
--- contrib/tsearch2/tsvector.c 21 Aug 2006 23:58:20 -0000
***************
*** 529,535 ****
outbuf = (char *) repalloc((void *) outbuf, ++lenbuf);
curout = outbuf + pos;
! *curout++ = '\\';
}
while(len--)
*curout++ = *curin++;
--- 529,535 ----
outbuf = (char *) repalloc((void *) outbuf, ++lenbuf);
curout = outbuf + pos;
! *curout++ = '\'';
}
while(len--)
*curout++ = *curin++;
pgsql-patches by date: