I’m just starting testing yugabyte using the yugabyted script. Trying to see if it can replace our current postgresql implementation. The server is running RHEL 8 Linux. I’m getting an error when trying to load a custom function. Any advice would be appreciated.
The shared object named in the CREATE FUNCTION statement seems to be found, but the error message complains that a library it depends on (libmcpdb.so.1) cannot be found. However that library is in the correct directory and is present in the ldconfig cache. The function loads without a problem in postgresql.
# ./bin/ysqlsh -p5432 pcm_production
ysqlsh (11.2-YB-2.19.0.0-b0)
Type "help" for help.
pcm_production=# CREATE OR REPLACE FUNCTION pcm_match_encrypt_str( TEXT, TEXT )
pcm_production-# RETURNS BOOLEAN
pcm_production-# AS '/usr/lib/libpcmdbcrypt.so.1.0', 'pcm_match_encrypt_str'
pcm_production-# LANGUAGE C
pcm_production-# IMMUTABLE;
ERROR: could not load library "/usr/lib/libpcmdbcrypt.so.1.0": libpcmdb.so.1: cannot open shared object file: No such file or directory
pcm_production=# q
# ldd /usr/lib/libpcmdbcrypt.so.1.0
linux-vdso.so.1 (0x00007ffd5bfe0000)
libpq.so.5 => /lib64/libpq.so.5 (0x00007fd34abb1000)
libpcmdb.so.1 => /lib/libpcmdb.so.1 (0x00007fd34a94e000)
libc.so.6 => /lib64/libc.so.6 (0x00007fd34a58b000)
# ls -l /lib/libpcmdb*
-rwxr-xr-x 1 root root 14480 Aug 8 14:22 /lib/libpcmdbcrypt.so.1.0
lrwxrwxrwx. 1 root root 24 Oct 9 2020 /lib/libpcmdb.so -> /usr/lib/libpcmdb.so.1.0
lrwxrwxrwx. 1 root root 24 Oct 9 2020 /lib/libpcmdb.so.1 -> /usr/lib/libpcmdb.so.1.0
-r-xr-xr-x. 1 root root 759432 Oct 5 2020 /lib/libpcmdb.so.1.0
# ldconfig -p | grep libpcmdb
libpcmdbcrypt.so.1.0 (libc6,x86-64) => /lib/libpcmdbcrypt.so.1.0
libpcmdb.so.1 (libc6,x86-64) => /lib/libpcmdb.so.1
libpcmdb.so (libc6,x86-64) => /lib/libpcmdb.so
For extensions, PostgreSQL expects the .so files to be under its own directory and not on the system library path.
For refernec you can see https://docs.yugabyte.com/preview/explore/ysql-language-features/pg-extensions/#pgsql-postal-example for steps for setting up custom plugin
In this case, just put the .so
file in the directory $(yugabyte/postgres/bin/pg_config --pkglibdir)
. Additionally if there are .control
and .sql
files should be copied to directory$(yugabyte/postgres/bin/pg_config --sharedir)/extension
.