lundi 20 avril 2015

current_timestamp in select clause with postgresql

SELECT id, … , current_timestamp as *select_timestamp* FROM TABLE_A ;

And then

SELECT id, ... FROM TABLE_A WHERE updated_on > *select_timestamp*

Can I trust that no other client can change data on TABLE_A while I’m running (first) SELECT? This would be an alternative to write lock : if the value of current_timestamp in (first) SELECT where greater than updated_on value of a row, that was inserted while select was running, second SELECT would miss that row.

Aucun commentaire:

Enregistrer un commentaire