Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit03a25ce

Browse files
committed
Issue a WARNING about invalid rule file format in contrib/unaccent.
We were already issuing a WARNING, albeit only elog not ereport, forduplicate source strings; so warning rather than just being stoicallysilent seems like the best thing to do here. Arguably both of thesecomplaints should be upgraded to ERRORs, but that might be morebehavioral change than people want.Note: the faulty line is already printed via an errcontext hook,so there's no need for more information than these messages provide.
1 parent1b24887 commit03a25ce

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎contrib/unaccent/unaccent.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ placeChar(TrieChar *node, const unsigned char *str, int lenstr,
6363
if (lenstr <=1)
6464
{
6565
if (curnode->replaceTo)
66-
elog(WARNING,"duplicate source strings, first one will be used");
66+
ereport(WARNING,
67+
(errcode(ERRCODE_CONFIG_FILE_ERROR),
68+
errmsg("duplicate source strings, first one will be used")));
6769
else
6870
{
6971
curnode->replacelen=replacelen;
@@ -128,7 +130,7 @@ initTrie(char *filename)
128130
*2in whitespace after src
129131
*3in trg
130132
*4in whitespace after trg
131-
*-1syntax error detected (line will be ignored)
133+
*-1syntax error detected
132134
*----------
133135
*/
134136
intstate;
@@ -192,6 +194,10 @@ initTrie(char *filename)
192194
rootTrie=placeChar(rootTrie,
193195
(unsignedchar*)src,srclen,
194196
trg,trglen);
197+
elseif (state<0)
198+
ereport(WARNING,
199+
(errcode(ERRCODE_CONFIG_FILE_ERROR),
200+
errmsg("invalid syntax: more than two strings in unaccent rule")));
195201

196202
pfree(line);
197203
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp