postgres=# \dx
List of installed extensions
Name | Version | Schema | Description
---------+---------+------------+------------------------------
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language
(1 row)
可以看到postgresql目前没有安装uuid-ossp扩展。
2.检查是否有可用来安装的扩展uuid-ossp
--查看当前可用的扩展
postgres=# select * from pg_available_extensions;
name | default_version | installed_version | comment
postgres=# create extension "uuid-ossp";
ERROR: could not open extension control file "/postgres/pg14/share/extension/uuid-ossp.control": No such file or directory
postgres=#
注意:
要用双引号将uuid-ossp引起来,因为有个中划线“-”。
3.PG安装uuid选项
注意:以ROOT用户去编译
su - root
cd /postgresql/soft/postgresql-14.8/
./configure --prefix=/postgresql/pg14 --with-uuid=ossp #prefix 安装目录
该操作只是在已安装完PG后,把uuid-ossp编译安装进了PG,不影响现有库。
4.源码编译UUID
#进入扩展目录
# cd /postgresql/soft/postgresql-14.8/contrib/uuid-ossp