PostgreSQL 编译安装 ossp-uuid 插件

PostgreSQL UUID About 948 words

编译配置

编译PostgreSQL时指定参数--with-uuid=ossp,如果已经执行过./configure也可以再次执行。

./configure --prefix=/home/postgresql/16.1 --with-libxml --with-libxslt --with-uuid=ossp

可能报错

configure: error: library 'ossp-uuid' or 'uuid' is required for OSSP UUID

解决方法

对于CentOS可以直接yum安装uuid-devel

yum install uuid-devel

编译插件

进入目录,插件目录都在PostgreSQL源码文件的contrib下。

cd /home/postgres/postgresql-16.1/contrib/uuid-ossp

执行编译安装,安装好后无需再编译PostgreSQL,也无需重启PostgreSQL

make & make install

查看可用插件

postgres=# select * from pg_available_extensions;
   name    | default_version | installed_version |                     comment                     
-----------+-----------------+-------------------+-------------------------------------------------
 plpgsql   | 1.0             | 1.0               | PL/pgSQL procedural language
 uuid-ossp | 1.1             |                   | generate universally unique identifiers (UUIDs)
(2 rows)

使用插件

create extension if not exists "uuid-ossp";
Views: 50 · Posted: 2024-06-10

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh