首页 > 解决方案 > 即使启用了 pgcrypto 扩展,AWS RDS Postgres Crypto 函数也不起作用

问题描述

我有新的 AWS RDS Postgres (v 11) 实例。我已经安装了pgcrypto扩展程序,但它不允许再次这样做:

CREATE EXTENSION pgcrypto;
Error in query (7): ERROR: extension "pgcrypto" already exists

但我不能使用扩展功能:

select gen_salt('bf');
Error in query (7): ERROR: function gen_salt(unknown) does not exist
LINE 1: select gen_salt('bf')
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

我做错了什么?

标签: postgresqlamazon-web-servicesamazon-rdspgcrypto

解决方案


问题是扩展可能是在模式处于活动状态时添加的。感谢@Antti Haapala 提供指向同一问题的链接:https ://dba.stackexchange.com/questions/135093/in-rds-digest-function-is-undefined-after-creating-pgcrypto-extension 。

当没有选择架构时,我做了以下操作:

DROP EXTENSION pgcrypto;
Query executed OK, 0 rows affected. (0.031 s)

CREATE EXTENSION pgcrypto;
Query executed OK, 0 rows affected. (0.046 s)

SELECT gen_salt('bf');
gen_salt
$2a$06$kyj11fcRtpwxrqgCfZEIaO

现在一切正常。


推荐阅读