PostgreSqlSliceStore: make robust to concurrency

The previous duplicate insert ignore behavior using RULE..DO INSTEAD
NOTHING does not properly apply row-wise and was not robust to
concurrent manipulation. Instead use table locking to insert only new
rows. Minimize performance penalty by inserting to a temporary table
before locking, so all operations within the lock are local to the
database.  Also removes the transmission of some redundant information
such as slice hashes.
PostgreSqlSegmentStore: fix segment clearing

Fix a typo in clearing the association between blocks and segments.
PostgreSqlSegmentStore: query cleanup (minor)

Remove needless characters from query, which consume significant space
when repeated for each segment.