SupabaseS
Supabase3y ago
Eva

FTS Generated Column using data from multiple tables

The Supabase Docs have this handy guide to full text search. https://supabase.com/docs/guides/database/full-text-search#searchable-columns

It includes this example of creating a generated column to use when searching:

alter table
  books
add column
  fts tsvector generated always as (to_tsvector('english', description || ' ' || title)) stored;

create index books_fts on books using gin (fts); -- generate the index

select id, fts
from books;


How would you modify this example to fetch data from a table that isn't books? For example if books included author_id and you wanted to look up some columns from a separate authors table.
How to use full text search in PostgreSQL.
Was this page helpful?