22#include "utils/fmgrprotos.h"
178 Node *escontext = fcinfo->context;
213 errmsg(
"word is too long (%d bytes, max %d bytes)",
220 errmsg(
"string is too long for tsvector (%ld bytes, max %ld bytes)",
274 errmsg(
"string is too long for tsvector (%d bytes, max %d bytes)", buflen,
MAXSTRPOS)));
288 if (arr[
i].entry.haspos)
291 if (arr[
i].poslen > 0xFFFF)
327 for (
i = 0;
i < out->
size;
i++)
335 for (
i = 0;
i < out->
size;
i++)
418 for (
i = 0;
i <
vec->size;
i++)
436 for (
j = 0;
j < npos;
j++)
467 vec->size = nentries;
470 for (
i = 0;
i < nentries;
i++)
483 elog(
ERROR,
"invalid tsvector: lexeme too long");
486 elog(
ERROR,
"invalid tsvector: maximum total lexeme length exceeded");
489 elog(
ERROR,
"unexpected number of tsvector positions");
503 vec->entries[
i].haspos = (npos > 0) ? 1 : 0;
505 vec->entries[
i].pos = datalen;
512 &
vec->entries[
i - 1],
536 for (
j = 0;
j < npos;
j++)
540 elog(
ERROR,
"position information is misordered");
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define palloc_array(type, count)
#define PG_FREE_IF_COPY(ptr, n)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define PG_GETARG_CSTRING(n)
#define CALCDATASIZE(x, lenstr)
static int pg_cmp_s32(int32 a, int32 b)
int pg_database_encoding_max_length(void)
int pg_mblen(const char *mbstr)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
void * palloc0(Size size)
#define SOFT_ERROR_OCCURRED(escontext)
static char buf[DEFAULT_XLOG_SEG_SIZE]
void qsort_arg(void *base, size_t nel, size_t elsize, qsort_arg_comparator cmp, void *arg)
#define qsort(a, b, c, d)
struct StringInfoData * StringInfo
#define PG_GETARG_TSVECTOR(n)
#define PG_RETURN_TSVECTOR(x)
#define WEP_SETWEIGHT(x, v)
Datum tsvectorout(PG_FUNCTION_ARGS)
static int uniquePos(WordEntryPos *a, int l)
Datum tsvectorrecv(PG_FUNCTION_ARGS)
static int compareentry(const void *va, const void *vb, void *arg)
Datum tsvectorin(PG_FUNCTION_ARGS)
int compareWordEntryPos(const void *a, const void *b)
Datum tsvectorsend(PG_FUNCTION_ARGS)
static int uniqueentry(WordEntryIN *a, int l, char *buf, int *outbuflen)
int32 tsCompareString(char *a, int lena, char *b, int lenb, bool prefix)
void close_tsvector_parser(TSVectorParseState state)
bool gettoken_tsvector(TSVectorParseState state, char **strval, int *lenval, WordEntryPos **pos_ptr, int *poslen, char **endptr)
TSVectorParseState init_tsvector_parser(char *input, int flags, Node *escontext)
static void SET_VARSIZE(void *PTR, Size len)
static StringInfoData tmpbuf