↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Functions / Text Search Functions And Operators

Replaces occurrences of target with substitute within the query.

Reading PG 18current·documented in 20 of 27 versions, 8.3 to 20

Signatures & examples

ts_rewrite ( query tsquery, target tsquery, substitute tsquery ) → tsquery
Replaces occurrences of target with substitute within the query. See Section 12.4.2.1 for details.
ts_rewrite('a & b'::tsquery, 'a'::tsquery, 'foo|bar'::tsquery) → 'b' & ( 'foo' | 'bar' )
ts_rewrite ( query tsquery, select text ) → tsquery
Replaces portions of the query according to target(s) and substitute(s) obtained by executing a SELECT command. See Section 12.4.2.1 for details.
SELECT ts_rewrite('a & b'::tsquery, 'SELECT t,s FROM aliases') → 'b' & ( 'foo' | 'bar' )
Version history 2
  1. 12 → 13 changed
  2. 8.2 → 8.3 added

Definition snapshot: b7bd9cda · English manual source