In article <AANLkTims+x5BpfAXF+9_cOHiaGa7=B_NpN=hw99kGxsK(at)mail(dot)gmail(dot)com>,
Marcelo de Moraes Serpa <celoserpa(at)gmail(dot)com> writes:
> Some good souls hinted me at the prefix extension, but
> how would I use it?
Like this:
CREATE TABLE users (
id serial NOT NULL,
name text NOT NULL,
reversed_domain prefix_range NULL,
PRIMARY KEY (id)
);
CREATE INDEX users_dom_ix ON users USING gist (reversed_domain);
SELECT id, name, reversed_domain
FROM users
WHERE reversed_domain @> 'com.app.mycompany';