woryzower
woryzower

Reputation: 976

Sql insertion via insensitive unique key

I have a column on my table which has unique key property, but i also want it to be unique in an insensitive manner.What happens is if there is a key like xyz, insert statement with values Xyz,xYZ works properly, which I want to prevent. What can i use to achieve this? (I am using postgresql.)

Upvotes: 0

Views: 61

Answers (1)

Joe G Joseph
Joe G Joseph

Reputation: 24086

I think you could do something like this:

create unique index on tableName (lower(columnName))

Upvotes: 1

Related Questions