如何在RDS Postgres 9.3.1 / 9.3.2 / 9.3.3中获取用户创建时间戳

时间:2014-07-24 18:42:49

标签: postgresql timestamp amazon-redshift postgresql-9.3

我可以在Amazon Redshift中获取用户创建时间戳,如下所示:

redshiftpocdb6=# select username,recordtime,valuntil from stl_userlog where username = 'u002';
                      username                      |         recordtime         |           valuntil
----------------------------------------------------+----------------------------+------------------------------
 u002                                               | 2014-07-23 14:36:11.314898 | 294277-01-09 04:00:54.775807
(1 row)

如何在RDS Postgres 9.3.3中获取相同的信息?上表不存在。

1 个答案:

答案 0 :(得分:0)

PostgreSQL中有没有自动配置。您需要自己添加一个每个表默认值的列:

ALTER TABLE stl_userlog ADD column created_at timestamp DEFAULT now()

对于已存在的行不起作用。那艘船航行了......