Richard Huxton <dev@archonet.com> writes:
> Anyone got anything more elegant?
Seems to me that no document should have an empty dup_set. If it's not
a match to any existing document, then immediately assign a new dup_set
number to it.
regards, tom lane