mirror of
https://github.com/postgres/postgres.git
synced 2025-10-28 11:55:03 +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:
@@ -594,7 +594,8 @@ to_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
query = parse_tsquery(text_to_cstring(in),
|
||||
pushval_morph,
|
||||
PointerGetDatum(&data),
|
||||
0);
|
||||
0,
|
||||
NULL);
|
||||
|
||||
PG_RETURN_TSQUERY(query);
|
||||
}
|
||||
@@ -630,7 +631,8 @@ plainto_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
query = parse_tsquery(text_to_cstring(in),
|
||||
pushval_morph,
|
||||
PointerGetDatum(&data),
|
||||
P_TSQ_PLAIN);
|
||||
P_TSQ_PLAIN,
|
||||
NULL);
|
||||
|
||||
PG_RETURN_POINTER(query);
|
||||
}
|
||||
@@ -667,7 +669,8 @@ phraseto_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
query = parse_tsquery(text_to_cstring(in),
|
||||
pushval_morph,
|
||||
PointerGetDatum(&data),
|
||||
P_TSQ_PLAIN);
|
||||
P_TSQ_PLAIN,
|
||||
NULL);
|
||||
|
||||
PG_RETURN_TSQUERY(query);
|
||||
}
|
||||
@@ -704,7 +707,8 @@ websearch_to_tsquery_byid(PG_FUNCTION_ARGS)
|
||||
query = parse_tsquery(text_to_cstring(in),
|
||||
pushval_morph,
|
||||
PointerGetDatum(&data),
|
||||
P_TSQ_WEB);
|
||||
P_TSQ_WEB,
|
||||
NULL);
|
||||
|
||||
PG_RETURN_TSQUERY(query);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user