diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-05-05 19:43:32 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-05-05 19:43:32 -0400 |
commit | 0b9a23443283f9ffb17a39c25f74adefdb72cae1 (patch) | |
tree | 56052b02be0943f6d658469a3a5dbc8283e618f6 /src/backend/utils/adt/tsvector_op.c | |
parent | 2f38b986fa8ff048c7226f1ca212e12084c715cf (diff) | |
download | postgresql-0b9a23443283f9ffb17a39c25f74adefdb72cae1.tar.gz postgresql-0b9a23443283f9ffb17a39c25f74adefdb72cae1.zip |
Rename tsvector delete() to ts_delete(), and filter() to ts_filter().
The similarity of the original names to SQL keywords seems like a bad
idea. Rename them before we're stuck with 'em forever.
In passing, minor code and docs cleanup.
Discussion: <4875.1462210058@sss.pgh.pa.us>
Diffstat (limited to 'src/backend/utils/adt/tsvector_op.c')
-rw-r--r-- | src/backend/utils/adt/tsvector_op.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index b138bf10ca1..591e59cf990 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -506,7 +506,7 @@ tsvector_delete_by_indices(TSVector tsv, int *indices_to_delete, /* * Delete given lexeme from tsvector. - * Implementation of user-level delete(tsvector, text). + * Implementation of user-level ts_delete(tsvector, text). */ Datum tsvector_delete_str(PG_FUNCTION_ARGS) @@ -530,7 +530,7 @@ tsvector_delete_str(PG_FUNCTION_ARGS) /* * Delete given array of lexemes from tsvector. - * Implementation of user-level delete(tsvector, text[]). + * Implementation of user-level ts_delete(tsvector, text[]). */ Datum tsvector_delete_arr(PG_FUNCTION_ARGS) @@ -757,7 +757,7 @@ array_to_tsvector(PG_FUNCTION_ARGS) } /* - * Leave only elements with given weights from tsvector. + * ts_filter(): keep only lexemes with given weights in tsvector. */ Datum tsvector_filter(PG_FUNCTION_ARGS) @@ -771,15 +771,15 @@ tsvector_filter(PG_FUNCTION_ARGS) *dataout; Datum *dweights; bool *nulls; - int nweigths; + int nweights; int i, j; int cur_pos = 0; char mask = 0; deconstruct_array(weights, CHAROID, 1, true, 'c', - &dweights, &nulls, &nweigths); + &dweights, &nulls, &nweights); - for (i = 0; i < nweigths; i++) + for (i = 0; i < nweights; i++) { char char_weight; @@ -804,8 +804,9 @@ tsvector_filter(PG_FUNCTION_ARGS) mask = mask | 1; break; default: - /* internal error */ - elog(ERROR, "unrecognized weight: %c", char_weight); + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("unrecognized weight: \"%c\"", char_weight))); } } |