| From: | Brent Wood <b(dot)wood(at)niwa(dot)co(dot)nz> |
|---|---|
| To: | Jonathan Vanasco <postgres(at)2xlp(dot)com> |
| Cc: | pgsql general <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: question on renaming a foreign key |
| Date: | 2006-10-12 00:37:09 |
| Message-ID: | 452D8E35.5020909@niwa.co.nz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Jonathan Vanasco wrote:
>
> I made a HUGE mistake, and used 'UK' as the abbreviation for the
> united kingdom ( the ISO abbv is 'GB' )
>
> I've got a database where 8 tables have an FKEY on a table
> 'location_country' , using the text 'uk' as the value -- so i've got
> 9 tables that I need to swap data out on
>
> can anyone suggest a non-nightmarish way for me to do this ?
Umm, I think this should work, & isn't all that bad:
insert a 'gb' record in location_country
update <each of 8 tables> set country='gb' where country='uk'
delete the 'uk' record from location_country
Brent Wood
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Merlin Moncure | 2006-10-12 01:38:11 | Re: more anti-postgresql FUD |
| Previous Message | Ron Johnson | 2006-10-12 00:34:47 | Re: question on renaming a foreign key |