Exemplo n.º 1
0
Datum
to_tsquery(PG_FUNCTION_ARGS)
{
	text	   *in = PG_GETARG_TEXT_P(1);
	char	   *str;
	QUERYTYPE  *query;
	ITEM	   *res;
	int4		len;

	SET_FUNCOID();

	str = text2char(in);
	PG_FREE_IF_COPY(in, 1);

	query = queryin(str, pushval_morph, PG_GETARG_INT32(0));
	res = clean_fakeval_v2(GETQUERY(query), &len);
	if (!res)
	{
		query->len = HDRSIZEQT;
		query->size = 0;
		PG_RETURN_POINTER(query);
	}
	memcpy((void *) GETQUERY(query), (void *) res, len * sizeof(ITEM));
	pfree(res);
	PG_RETURN_POINTER(query);
}
Exemplo n.º 2
0
/*
 * in without morphology
 */
Datum
tsquery_in(PG_FUNCTION_ARGS)
{
	SET_FUNCOID();
	PG_RETURN_POINTER(queryin((char *) PG_GETARG_POINTER(0), pushval_asis, 0));
}
Exemplo n.º 3
0
/*
 * in without morphology
 */
Datum
ltxtq_in(PG_FUNCTION_ARGS)
{
	PG_RETURN_POINTER(queryin((char *) PG_GETARG_POINTER(0)));
}