PostgreSqlSegmentStore: set core solutions flag

Set the solutions flag on a core when storing solutions. Also use a
single query when storing solutions (~10% improvement in performance).