1小时后postgresql更新

use*_*539 5 postgresql

CREATE TABLE em_user
(
  user_id character(10),
  last_attempt integer,
  last_unsuccessfull_login timestamp with time zone,
  is_locked boolean DEFAULT false);

UPDATE em_user
SET is_locked = TRUE
           WHERE last_attempt >3 AND last_unsuccessfull_login=last_unsuccessfull_login+'2 minutes';     
Run Code Online (Sandbox Code Playgroud)

我想在postgresql中1小时后更新我的表.

edz*_*dze 4

pgAgent 就是您所需要的。看看这里: http: //www.pgadmin.org/docs/1.8/pgagent.html

您可以创建每小时、每 15 分钟等执行一次的作业。

编辑:

在您的具体情况下,最好在登录失败数次后立即通过触发器锁定用户。

下一步是每 15 分钟运行一次 pgAgent 作业。通过此作业,您可以再次解锁该已锁定超过 15 分钟的帐户。这样您就可以防止 DoS 攻击,这种攻击会锁定您的所有用户。