在亚马逊ec2 RDS Postgresql上:

=> SHOW rds.extensions;

rds.extensions                                                                                                                                 
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 btree_gin,btree_gist,chkpass,citext,cube,dblink,dict_int,dict_xsyn,earthdistance,fuzzystrmatch,hstore,intagg,intarray,isn,ltree,pgcrypto,pgrowlocks,pg_trgm,plperl,plpgsql,pltcl,postgis,postgis_tiger_geocoder,postgis_topology,sslinfo,tablefunc,tsearch2,unaccent,uuid-ossp
(1 row)

正如你所见,uuid-ossp扩展确实存在.然而,当我调用uuid_v4代的函数时,它失败了:

CREATE TABLE my_table (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    name character varying(32) NOT NULL,

);

这怎么了?

推荐答案

在这个数据库中,扩展名是available,但不是installed.

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

Postgresql相关问答推荐

在postgres中查找多个表中不同列的计数和总和

正在应用序列化迁移,但数据库没有更改

将整数(以毫秒为单位的epoch时间)转换为PrimitiveDateTime

Rust中使用sqlx的多线程postgres操作的惯用方法是什么?

如何返回old_ids和重复行的映射';来自PostgreSQL函数的s new_id

为什么我的唯一索引在 Postgresql 中不起作用?

在 jOOQ 中使用 $$ 引用字符串

PostgreSQL:如何从另一列的 json 值替换为一列?

AGE Graph 实际上存储为 postgreSQL 表,对吧?如何检索该表(不是图表)?

为什么不能超过 10 个并发连接到 Postgres RDS 数据库

为什么 postgresql 可以在这个查询中高效地使用索引?

如何将 NULL 值插入 UUID 而不是零

在 postgres 中删除所有共享相同前缀的表

Postgres 默认按 id 排序 - worldship

python pip install psycopg2 安装错误

PostgreSQL 表变量

Postgres 数据库文件保存在 ubuntu 中的什么位置?

如何在 redshift 中对字段进行 GROUP BY 和 CONCATENATE

PostgreSQL 9.1:如何连接数组中的行而不重复,加入另一个表

如何为本地 Rails 元素设置 Postgres 数据库?