DEV Community

Franck Pachot for YugabyteDB Distributed PostgreSQL Database

Posted on • Edited on

Quickly testing an extension from docker image

In this series about PostgreSQL extensions on YugabyteDB here is a way to test quickly an extension by taking its files from a docker image. This is what I did to test Apache AGE.

The following starts a container from an image with PostgreSQL and the extension we want, and extract them into a tarball (I take files with pattern age* as I know those are the files from Apache AGE extension):

docker run --rm -i apache/age bash -c '
mkdir -p stage/share/extension stage/lib 
mv $(pg_config --pkglibdir)/age* stage/lib
mv $(pg_config --sharedir)/extension/age* stage/share/extension
tar -C stage -zcvf - lib share
' > age.tgz
Enter fullscreen mode Exit fullscreen mode

I start YugabyteDB with the extension files extracted in the right place, and test a CREATE EXTENSION:

docker run --rm -i yugabytedb/yugabyte bash -c '
cd $YB_HOME/postgres
tar --skip-old-files -zxvf -
yugabyted start --advertise_address=0.0.0.0
until $YB_HOME/postgres/bin/pg_isready ; do sleep 1 ; done | uniq
ysqlsh -e <<SQL
create extension age;
SQL
' < age.tgz
Enter fullscreen mode Exit fullscreen mode

In this case, it fails immediately because OIDs are not supported yet:

Starting yugabyted...
/tmp:5433 - accepting connections
create extension age;
ERROR:  OIDs are not supported for user tables.
Enter fullscreen mode Exit fullscreen mode

It would have been a waste of time to compile the extension. Getting the files from a RPM or Docker image is the fastest way to quickly check the CREATE EXTENSION.

This is also a good example to show that not all extensions are immediately compatible with YugabyteDB. When it deals with the storage that is specific to PostgreSQL (and OID is an internal object identifier) it may require some modifications. Doing it depends on the roadmap priorities but open source contributions are welcome.

Top comments (0)