Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALTER TABLE companies
- ADD COLUMN tsq tsquery;
- CREATE INDEX tsv_idx ON documents USING gin(tsq);
- UPDATE companies
- SET tsq = to_tsquery(CAST(tin AS text)) ||
- CASE
- WHEN numnode(plainto_tsquery('simple', "legalName")) > 0
- THEN phraseto_tsquery('simple', replace("legalName", '"', ''))
- ELSE '' END ||
- CASE
- WHEN numnode(plainto_tsquery('simple', "shortName")) > 0
- THEN phraseto_tsquery('simple', replace("shortName", '"', ''))
- ELSE '' END
- WHERE id > 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement