File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 77 *
88 *
99 * IDENTIFICATION
10- * $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.16 2009/05/21 12:54:27 meskes Exp $
10+ * $PostgreSQL: pgsql/src/backend/utils/adt/tsvector.c,v 1.17 2009/05/21 20:09:36 teodor Exp $
1111 *
1212 *-------------------------------------------------------------------------
1313 */
@@ -451,6 +451,7 @@ tsvectorrecv(PG_FUNCTION_ARGS)
451451 * WordEntries */
452452 Size hdrlen ;
453453 Size len ; /* allocated size of vec */
454+ bool needSort = 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}
You can’t perform that action at this time.
0 commit comments