> begin;
> set constraints all immediate;
> update users set id=<new_userid> where login = 'customerA';
> set constraints all deferred;
> delete from users where login = 'custmerA';
> update users set id=<new_userid> where login = 'custmerB';
> delete from users where login = 'customerB';
> insert into users values (<new_id>, 'merged_customer_login', ...);
> commit;
>
> This should take care about rerouting all the depending entries to the
> new user *as long as you have your FKs setup properly*, of course.
Interesting. After reading this I went back to the docs and found what I
haven't found before:
"Analogous to ON DELETE there is also ON UPDATE which is invoked when a
primary key is changed (updated). The possible actions are the same."
I was under the impression that cascades only applied to deletes.
Something new to chew on.
Thanks!
Jon