Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
0c4f2894
Commit
0c4f2894
authored
Sep 02, 2006
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use '' rather than \' for literal single quotes in strings in
/contrib/tsearch2. Teodor Sigaev
parent
4b636e35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
28 deletions
+43
-28
contrib/tsearch2/expected/tsearch2.out
contrib/tsearch2/expected/tsearch2.out
+6
-6
contrib/tsearch2/query.c
contrib/tsearch2/query.c
+2
-2
contrib/tsearch2/tsvector.c
contrib/tsearch2/tsvector.c
+35
-20
No files found.
contrib/tsearch2/expected/tsearch2.out
View file @
0c4f2894
...
...
@@ -59,25 +59,25 @@ SELECT '''1 2'''::tsvector;
SELECT E'''1 \\''2'''::tsvector;
tsvector
----------
'1
\'2'
'1
''2'
(1 row)
SELECT E'''1 \\''2''3'::tsvector;
tsvector
-------------
'3' '1
\
'2'
'3' '1
'
'2'
(1 row)
SELECT E'''1 \\''2'' 3'::tsvector;
tsvector
-------------
'3' '1
\
'2'
'3' '1
'
'2'
(1 row)
SELECT E'''1 \\''2'' '' 3'' 4 '::tsvector;
tsvector
------------------
'4' ' 3' '1
\
'2'
'4' ' 3' '1
'
'2'
(1 row)
select '''w'':4A,3B,2C,1D,5 a:8';
...
...
@@ -138,7 +138,7 @@ SELECT '''1 2'''::tsquery;
SELECT E'''1 \\''2'''::tsquery;
tsquery
---------
'1
\
'2'
'1
'
'2'
(1 row)
SELECT '!1'::tsquery;
...
...
@@ -336,7 +336,7 @@ SELECT '1&(2&(4&(5|!6)))'::tsquery;
SELECT E'1
&
(''2''
&
('' 4''
&
(\\|5 | ''6 \\'' !|
&'')))'::tsquery;
tsquery
------------------------------------------
'1'
&
'2'
&
' 4'
&
( '|5' | '6
\
' !|
&
' )
'1'
&
'2'
&
' 4'
&
( '|5' | '6
'
' !|
&
' )
(1 row)
SELECT '''the wether'':dc
&
'' sKies '':BC
&
a:d b:a';
...
...
contrib/tsearch2/query.c
View file @
0c4f2894
...
...
@@ -604,7 +604,7 @@ findoprnd(ITEM * ptr, int4 *pos)
* input
*/
static
QUERYTYPE
*
queryin
(
char
*
buf
,
void
(
*
pushval
)
(
QPRS_STATE
*
,
int
,
char
*
,
int
,
int2
),
int
cfg_id
,
bool
isplain
)
queryin
(
char
*
buf
,
void
(
*
pushval
)
(
QPRS_STATE
*
,
int
,
char
*
,
int
,
int2
),
int
cfg_id
,
bool
isplain
)
{
QPRS_STATE
state
;
int4
i
;
...
...
@@ -748,7 +748,7 @@ infix(INFIX * in, bool first)
{
if
(
t_iseq
(
op
,
'\''
)
)
{
*
(
in
->
cur
)
=
'\
\
'
;
*
(
in
->
cur
)
=
'\
'
'
;
in
->
cur
++
;
}
COPYCHAR
(
in
->
cur
,
op
);
...
...
contrib/tsearch2/tsvector.c
View file @
0c4f2894
...
...
@@ -164,13 +164,14 @@ uniqueentry(WordEntryIN * a, int4 l, char *buf, int4 *outbuflen)
return
res
+
1
-
a
;
}
#define WAITWORD 1
#define WAITENDWORD 2
#define WAITWORD
1
#define WAITENDWORD
2
#define WAITNEXTCHAR 3
#define WAITENDCMPLX 4
#define WAITPOSINFO 5
#define INPOSINFO 6
#define WAITPOSINFO
5
#define INPOSINFO
6
#define WAITPOSDELIM 7
#define WAITCHARCMPLX 8
#define RESIZEPRSBUF \
do { \
...
...
@@ -270,21 +271,8 @@ gettoken_tsvector(TI_IN_STATE * state)
}
else
if
(
state
->
state
==
WAITENDCMPLX
)
{
if
(
t_iseq
(
state
->
prsbuf
,
'\''
)
)
{
RESIZEPRSBUF
;
*
(
state
->
curpos
)
=
'\0'
;
if
(
state
->
curpos
==
state
->
word
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"syntax error"
)));
if
(
state
->
oprisdelim
)
{
state
->
prsbuf
+=
pg_mblen
(
state
->
prsbuf
);
return
1
;
}
else
state
->
state
=
WAITPOSINFO
;
if
(
t_iseq
(
state
->
prsbuf
,
'\''
)
)
{
state
->
state
=
WAITCHARCMPLX
;
}
else
if
(
t_iseq
(
state
->
prsbuf
,
'\\'
)
)
{
...
...
@@ -302,6 +290,31 @@ gettoken_tsvector(TI_IN_STATE * state)
state
->
curpos
+=
pg_mblen
(
state
->
prsbuf
);
}
}
else
if
(
state
->
state
==
WAITCHARCMPLX
)
{
if
(
t_iseq
(
state
->
prsbuf
,
'\''
)
)
{
RESIZEPRSBUF
;
COPYCHAR
(
state
->
curpos
,
state
->
prsbuf
);
state
->
curpos
+=
pg_mblen
(
state
->
prsbuf
);
state
->
state
=
WAITENDCMPLX
;
}
else
{
RESIZEPRSBUF
;
*
(
state
->
curpos
)
=
'\0'
;
if
(
state
->
curpos
==
state
->
word
)
ereport
(
ERROR
,
(
errcode
(
ERRCODE_SYNTAX_ERROR
),
errmsg
(
"syntax error"
)));
if
(
state
->
oprisdelim
)
{
/* state->prsbuf+=pg_mblen(state->prsbuf); */
return
1
;
}
else
state
->
state
=
WAITPOSINFO
;
continue
;
/* recheck current character */
}
}
else
if
(
state
->
state
==
WAITPOSINFO
)
{
if
(
t_iseq
(
state
->
prsbuf
,
':'
)
)
...
...
@@ -385,6 +398,8 @@ gettoken_tsvector(TI_IN_STATE * state)
else
/* internal error */
elog
(
ERROR
,
"internal error"
);
/* get next char */
state
->
prsbuf
+=
pg_mblen
(
state
->
prsbuf
);
}
...
...
@@ -529,7 +544,7 @@ tsvector_out(PG_FUNCTION_ARGS)
outbuf
=
(
char
*
)
repalloc
((
void
*
)
outbuf
,
++
lenbuf
);
curout
=
outbuf
+
pos
;
*
curout
++
=
'\
\
'
;
*
curout
++
=
'\
'
'
;
}
while
(
len
--
)
*
curout
++
=
*
curin
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment