mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Convert tsqueryin and tsvectorin to report errors softly.
This is slightly tedious because the adjustments cascade through a couple of levels of subroutines, but it's not very hard. I chose to avoid changing function signatures more than absolutely necessary, by passing the escontext pointer in existing structs where possible. tsquery's nuisance NOTICEs about empty queries are suppressed in soft-error mode, since they're not errors and we surely don't want them to be shown to the user anyway. Maybe that whole behavior should be reconsidered. Discussion: https://postgr.es/m/3824377.1672076822@sss.pgh.pa.us
This commit is contained in:
@ -25,11 +25,13 @@
|
||||
struct TSVectorParseStateData; /* opaque struct in tsvector_parser.c */
|
||||
typedef struct TSVectorParseStateData *TSVectorParseState;
|
||||
|
||||
/* flag bits that can be passed to init_tsvector_parser: */
|
||||
#define P_TSV_OPR_IS_DELIM (1 << 0)
|
||||
#define P_TSV_IS_TSQUERY (1 << 1)
|
||||
#define P_TSV_IS_WEB (1 << 2)
|
||||
|
||||
extern TSVectorParseState init_tsvector_parser(char *input, int flags);
|
||||
extern TSVectorParseState init_tsvector_parser(char *input, int flags,
|
||||
Node *escontext);
|
||||
extern void reset_tsvector_parser(TSVectorParseState state, char *input);
|
||||
extern bool gettoken_tsvector(TSVectorParseState state,
|
||||
char **strval, int *lenval,
|
||||
@ -58,13 +60,15 @@ typedef void (*PushFunction) (Datum opaque, TSQueryParserState state,
|
||||
* QueryOperand struct */
|
||||
bool prefix);
|
||||
|
||||
/* flag bits that can be passed to parse_tsquery: */
|
||||
#define P_TSQ_PLAIN (1 << 0)
|
||||
#define P_TSQ_WEB (1 << 1)
|
||||
|
||||
extern TSQuery parse_tsquery(char *buf,
|
||||
PushFunction pushval,
|
||||
Datum opaque,
|
||||
int flags);
|
||||
int flags,
|
||||
Node *escontext);
|
||||
|
||||
/* Functions for use by PushFunction implementations */
|
||||
extern void pushValue(TSQueryParserState state,
|
||||
@ -222,7 +226,7 @@ extern int32 tsCompareString(char *a, int lena, char *b, int lenb, bool prefix);
|
||||
* TSQuery Utilities
|
||||
*/
|
||||
extern QueryItem *clean_NOT(QueryItem *ptr, int32 *len);
|
||||
extern TSQuery cleanup_tsquery_stopwords(TSQuery in);
|
||||
extern TSQuery cleanup_tsquery_stopwords(TSQuery in, bool noisy);
|
||||
|
||||
typedef struct QTNode
|
||||
{
|
||||
|
Reference in New Issue
Block a user