# PostgreSQL Type for tsvector (full-text searching)

**URL:** <https://discourse.rom-rb.org/t/postgresql-type-for-tsvector-full-text-searching/705>\
**Category:** Issues\
**Created:** [December 1, 2025, 8:27pm UTC](https://discourse.rom-rb.org/t/postgresql-type-for-tsvector-full-text-searching/705 "2025-12-01T20:27:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandbergja](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@sandbergja](https://discourse.rom-rb.org/u/sandbergja)\
**Post date:** [December 1, 2025, 8:27pm UTC](https://discourse.rom-rb.org/t/postgresql-type-for-tsvector-full-text-searching/705/1 "2025-12-01T20:27:04Z")

</div>

Hello! I have a table in my Postgres database like so:

```auto
CREATE TABLE public.library_database_records (
    id bigint NOT NULL,
    libguides_id bigint NOT NULL,
    name character varying NOT NULL,
    description character varying,
    alt_names character varying[],
    alt_names_concat character varying,
    url character varying,
    friendly_url character varying,
    subjects character varying[],
    subjects_concat character varying,
    created_at timestamp(6) without time zone NOT NULL,
    updated_at timestamp(6) without time zone NOT NULL,
    searchable tsvector GENERATED ALWAYS AS ((((setweight(to_tsvector('public.unaccented_dict'::regconfig, (COALESCE(name, ''::character varying))::text), 'A'::"char") || setweight(to_tsvector('public.unaccented_dict'::regconfig, (COALESCE(alt_names_concat, ''::character varying))::text), 'B'::"char")) || setweight(to_tsvector('public.unaccented_dict'::regconfig, (COALESCE(description, ''::character varying))::text), 'C'::"char")) || setweight(to_tsvector('public.unaccented_dict'::regconfig, (COALESCE(subjects_concat, ''::character varying))::text), 'D'::"char"))) STORED
);

```

If I try to create a relation with an auto-generated schema:

```auto
class LibraryDatabaseRelation < ROM::Relation[:sql]
    schema :library_database_records, infer: true
end

```

I get the following:

```auto
ROM::Schema::Inferrer::MissingAttributesError:
  Following attributes in :library_database_records schema cannot be inferred and have to be defined explicitly: :searchable

```

I noticed that ROM defines [certain PostgreSQL types](https://rom-rb.org/learn/sql/3.3/schemas/#postgresql-types) for us, but tsvector is not one of those types. Should I file an issue and/or PR to define it in rom-sql? Or would it make more sense to define it in my application?

Thanks for your help!
