PostgreSQL 9.3 Amazon RDS 在使用 UUID-OSSP 扩展生成 uuid 时出错

Ram*_* RV 6 postgresql postgresql-9.2 postgresql-9.3 rails postgresql-extensions

我在 RDS 上创建了数据库实例并使用了以下功能。它在本地开发机器上使用相同的 PostgreSQL 版本时出错。

create or replace function uuid() returns uuid as 'uuid-ossp', 'uuid_generate_v1' volatile strict language C;
Run Code Online (Sandbox Code Playgroud)

这是错误日志:

ERROR:  permission denied for language c
********** Error **********

ERROR: permission denied for language c
SQL state: 42501
Run Code Online (Sandbox Code Playgroud)

我在 ruby​​ on rails 3.2 中使用此函数为我的模式生成 uuid。

Cra*_*ger 8

您似乎试图通过直接加载 .sql 文件来加载 uuid-ossp 扩展名。你不应该在任何现代 PostgreSQL 上这样做,它在 RDS 上不起作用。

CREATE EXTENSION "uuid-ossp";
Run Code Online (Sandbox Code Playgroud)

反而。