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

Commitc6c458e

Browse files
committed
Resort tsvector's lexemes in tsvectorrecv instead of emmiting an error.
Basically, it's needed to support binary dump from 8.3 because ordering rulewas changed.Per discussion with Bruce.
1 parentab9981c commitc6c458e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

‎src/backend/utils/adt/tsvector.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.16 2009/05/2112:54:27 meskes Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.17 2009/05/2120:09:36 teodor Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -451,6 +451,7 @@ tsvectorrecv(PG_FUNCTION_ARGS)
451451
* WordEntries */
452452
Sizehdrlen;
453453
Sizelen;/* allocated size of vec */
454+
boolneedSort= false;
454455

455456
nentries=pq_getmsgint(buf,sizeof(int32));
456457
if (nentries<0||nentries> (MaxAllocSize /sizeof(WordEntry)))
@@ -507,7 +508,7 @@ tsvectorrecv(PG_FUNCTION_ARGS)
507508
if (i>0&&WordEntryCMP(&vec->entries[i],
508509
&vec->entries[i-1],
509510
STRPTR(vec)) <=0)
510-
elog(ERROR,"lexemes are misordered");
511+
needSort= true;
511512

512513
/* Receive positions */
513514
if (npos>0)
@@ -542,5 +543,9 @@ tsvectorrecv(PG_FUNCTION_ARGS)
542543

543544
SET_VARSIZE(vec,hdrlen+datalen);
544545

546+
if (needSort)
547+
qsort_arg((void*)ARRPTR(vec),vec->size,sizeof(WordEntry),
548+
compareentry, (void*)STRPTR(vec));
549+
545550
PG_RETURN_TSVECTOR(vec);
546551
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp