""Greg Sabino Mullane"" <greg(at)turnstep(dot)com>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> | UPDATE
> | orderby SET orderby = orderby +10
> | WHERE groupid = 1;
> | -> FAILS because of UNIQUE INDEX
>
> One workaround is to do it in two steps, assuming that
> orderby is > 0 for all rows you are changing:
>
> BEGIN;
> UPDATE mytable SET orderby = -orderby WHERE groupid = 1;
> UPDATE mytable SET orderby = -orderby+10 WHERE groupid = 1;
> COMMIT;
Should we invent something to defer the check of uniqueness
to the end of the SQL command?
Regards,
William ZHANG