0

I want all of the entries in my relation to be lower case.

I tried

ALTER TABLE tableName
SET (columnName = lower(columnName)); 

but it didn't seem to work. Could someone point me in the right direction?

user3377890
  • 67
  • 1
  • 6
  • 1
    If you *always* want to treat your data case-insensitive, consider the data type [`citext`](http://www.postgresql.org/docs/current/interactive/citext.html), provided by the additional module of the same name. [More details.](http://stackoverflow.com/questions/16905867/deferrable-case-insensitive-unique-constraint/16907381#16907381) – Erwin Brandstetter Mar 14 '14 at 02:35

1 Answers1

2
UPDATE TABLE tableName
SET columnName = lower(columnName);

Should work better :)

Edit:

The data you insert is up to you to insert lowercase, it wont be changed. If you need to do that, you can do it in a trigger or rule.

Björn Nilsson
  • 3,703
  • 1
  • 24
  • 29