title: case insensitive Foreign Key PostgreSQL
body: <p>Need to know if I can add a case insensitive foreign key constraint to a table in PostgreSQL. I am converting a DB from MySQL to PostgreSQL. The foreign keys were already created in MySQL and I did not face any problems because MySQL was not case sensitive. When I load all the data from MySQL to PostgreSQL and then try to add foreign keys to the tables, I get an error in Postgres. For example:</p>
  
  <p>Table A had 2 columns:
  ID (int) and Name(varchar(25))</p>
  
  <p><code>Entry1: ID  = 1 , Name = 'America'
  Entry2: ID = 2 , Name = 'Canada'</code></p>
  
  <p>Table B had 2 columns:
  ID (int) and Name(varchar(25))</p>
  
  <p><code>Entry1: ID(int) = 10 , Name(Varchar(25)) = 'AmeRiCA'
  Entry1: ID = 1 , Name = 'Canada'</code></p>
  
  <p>in MySQL, the foreign key was created between Table A and Table B on column "Name", however in Postgres, because of the case sensitive nature I get an error.</p>
  
  <p>I do not have an option to Alter the table and change Varchar to citext. is there anyway I can define a case insensitive foreign key in PG.</p>
  
  <p>Any suggestions?</p>
  
  <p>Thanks</p>