I need to update table in my database. For sake of simplicity lets assume that table's name is tab and it has 2 columns: id (PRIMARY KEY, NOT NULL) and col (UNIQUE VARCHAR(300)). I need to update table this way:
id col
----------------------------------------------------
1 'One two three'
2 'One twothree'
3 'One two three'
4 'Remove white spaces'
5 'Something'
6 'Remove whitespaces '
to:
id col
----------------------------------------------------
1 'Onetwothree'
2 'Removewhitespaces'
3 'Something'
Id numbers and order of the rows after update is not important and can be different. I use PostgreSQL. Some of the columns are FOREIGN KEYs. That's why dropping UNIQUE constraint from col would be troublesome.
UNIQUE, that is sufficient for a FK constraint referencingcol. For an FK constraint pointing the other way, you don't need either. Unfortunately, the Q is unclear about the direction of the FK constraint.