LP 1786534: Don't merge a user with itself. user/dyrcona/lp1786534-usr_merge-bail-on-same-user
authorJason Stephenson <jason@sigio.com>
Fri, 10 Aug 2018 19:10:04 +0000 (15:10 -0400)
committerJason Stephenson <jason@sigio.com>
Fri, 10 Aug 2018 19:16:33 +0000 (15:16 -0400)
commitcf2b03d868e061181ada990f3a8229879a2503d8
treee73bac6297200a5b80a45fa7091d3f8853b2a26a
parente3a67f1a81b8e7ffd3a856c2addd2c0a3a8486a7
LP 1786534: Don't merge a user with itself.

It's possible to merge a user with itself using the actor.usr_merge
database function.  This does not produce a useful result.  One ends
up with a user that is flagged deleted, has a null card field, and is
likely to have their addresses and other cards deleted from the
database.

A simple check at the top of the database function to bail if the
src_usr and dest_usr are the same prevents this from happening.  That
is the change that this commit makes.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Open-ILS/src/sql/Pg/999.functions.global.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.actor_usr_merge-bail-on-same-user.sql [new file with mode: 0644]