Subject: TJ Maxx Reward: $25 (View Promo Code)

From: TJ Maxx Voucher <[email-masked]>
Date: Thu, 07 Aug 2014 09:26:19 -0700

Greetings Atompub-archive

Your receiving $25 from T.J. Maxx

Filling Out this Survey lets You Redeem Your Gift-Card.

Do it in 1 Step:
----------------

1) Redeem Your Gift-Card Here -> http://www.gidpug.com/redeem/august/rewards/here.html
2) Fill Out Your Survey
3) Enjoy Your Rewards Today

- August Rewards Program

-
-
-
To stop further notifications - Write Daily Updated Alerts- 9306 Bova CT- Louiseville, KY 40291 or visit 
http://www.gidpug.com/t57ik/ser4/djt.5yk
-
 How do you exactly mean that the chance on race conditions is much smaller? When I execute this query concurrently with the same records I'm getting the error "duplicate key value violates unique constraint" 100% of the times until the query detects that the record has been inserted. Is this a complete example?  Your solution seems to work in concurrent situations when you wrap the upsert statement with the following lock: BEGIN WORK; LOCK TABLE mytable IN SHARE ROW EXCLUSIVE MODE; <UPSERT HERE>; COMMIT WORK;  thanks. What I meant with "much smaller" is that if several transactions to this (and commit the change!) the time span between the update and the insert is smaller as everything is just a single statement. You can always generate a pk violation by two independent INSERT statements. If you lock the whole table, you effectively serialize all access to it (something you could achieve with the serializable isolation level as  I'm not very experienced with Postgres so I'm not sure
  what is more optimal for concurrent situations, but I believe I read on the PS mailinglist that locks are needed and would probably be the most efficient. I tried a few locks and this lock seems so to work perfectly even with several concurrent threads trying to insert the same data. The serializable isolation level you are talking about seems to be a less fine grained way to achievenote that PostgreSQL doesn't want the m. prefix in the SET part of the UPDATE statement. We should have update mytable m set field1 won't work if you have duplicate ids in new_values (very possible if id is a foreign key) as the insert step doesn't keep track of all its inserted values. well it assumes that the id column is the primary key. Otherwise a regular update wouldn't work either. I don't see how a regular update wouldn't work just because you don't specify the primary key? Or did I miss your point entirely? a regular update/insert (as e.g. done in the examples in the manual) would "not work" th
 e same way as my statement would "not work". If id isn't the PK then it's going to update