Postgresql: ERROR: type "citext" does not exist

Solution 1:

Ok figured it out. I have several databases and CREATE EXTENSION citext has to be run for each db to install the extension in that DB. You must do on psql prompt:

psql =# \c db_1
CREATE EXTENSION citext;

psql =# \c db_2
CREATE EXTENSION citext;

Hope it helps others. Thank you.

Solution 2:

@NullException is correct that the extension needs to be created in each database. If you want to automatically have an extension created, you can create it in the template1 database which (by default, at least) is the database used as a model for "create database", so with appropriate permissions, in psql:

\c template1
create extension citext;

Then new databases will include citext by default.