postgresql - 函数 uuid_generate_v4() 不存在 postgres 11

标签 postgresql postgresql-11

我正在尝试使用 node-pg-migrate并运行迁移以在我的节点项目中创建表。
当我运行迁移时,我得到函数 uuid_generate_v4() 不存在。

我确实检查了我的扩展并且 uuid-ossp 可用。

extname  | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition 
-----------+----------+--------------+----------------+------------+-----------+--------------
 plpgsql   |       10 |           11 | f              | 1.0        |           | 
 uuid-ossp |    16384 |         2200 | t              | 1.1        |           | 
(2 rows)


我希望我的迁移能够运行,但它失败了。我在 Mac 上使用 Postgres 11。
Postgres 从这里安装 - https://postgresapp.com/

最佳答案

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

关于postgresql - 函数 uuid_generate_v4() 不存在 postgres 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56411055/

相关文章:

sql - 使用 Outer Join 有困难

javascript - 尽管将字段类型设置为 Float,但仍然需要 Integer 进行 Sequelize

postgresql - 将 PostgreSQL 间隔转换为秒会产生错误的值

python - 并行运行测试时出错

windows - 大量空间,但 - [53100] 错误 : could not write block …: No space left on device

sql - PostgreSQL 搜索中的特殊字符

SQL select 语句 - 返回字段的最大值

sql - 在具有多列的单行中显示来自多行的数据

sql - Postgresql 11 - 按整数数组索引排序

sql - 是否可以在 postgres 11.x 中创建小整数的 ENUM?