diff artifact-database/src/main/resources/sql/org-postgresql-driver.properties @ 242:b35d32e507b6

Fix for flys/issue9 artifacts/trunk@1677 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 13 Apr 2011 11:26:53 +0000
parents 202b6ae2fcad
children 33b9cc23ac9b
line wrap: on
line diff
--- a/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Wed Apr 13 10:57:45 2011 +0000
+++ b/artifact-database/src/main/resources/sql/org-postgresql-driver.properties	Wed Apr 13 11:26:53 2011 +0000
@@ -15,7 +15,10 @@
     AND id NOT IN ($LOCKED_IDS$) \
     LIMIT 50
 
-artifacts.select.gid=SELECT id, last_access, ttl, factory, data FROM artifacts WHERE gid = ?::uuid
+artifacts.select.gid=SELECT id, ttl, factory, data FROM artifacts WHERE gid = ?::uuid \
+    AND (ttl IS NULL \
+    OR  (CURRENT_TIMESTAMP - last_access <= (ttl || ' microseconds')::interval) \
+    OR  id IN (SELECT artifact_id FROM collection_items))
 
 artifacts.get.id=SELECT id FROM artifacts WHERE gid = ?::uuid
 

http://dive4elements.wald.intevation.org