Diesel: DLL error on OSX and PostgreSQL

Created on 18 May 2016  ·  3Comments  ·  Source: diesel-rs/diesel

Trying out the diesel_demo on an OSX 10.11.4 laptop running postgresql.

Everything works up to the migration:

$ diesel migration run
thread '<main>' panicked at 'Error creating timestamp helper functions for Pg: DatabaseError("ERROR:  could not load library \"/usr/local/lib/postgresql/plpgsql.so\": dlopen(/usr/local/lib/postgresql/plpgsql.so, 10): Symbol not found: _DatumIsReadWriteExpandedObject\n  Referenced from: /usr/local/lib/postgresql/plpgsql.so\n  Expected in: /usr/local/opt/postgresql/bin/postgres\n in /usr/local/lib/postgresql/plpgsql.so\n")', ../src/libcore/result.rs:785
note: Run with `RUST_BACKTRACE=1` for a backtrace.
$ otool -l `which diesel` | grep libpq
 name /usr/local/opt/postgresql/lib/libpq.5.dylib (offset 24)

As you can see diesel is linked to libpq.5.dylib but is looking for plpgsql.so (which would make sense on linux but not osx). I can only assume somewhere the path is hardcoded for a linux install.

Most helpful comment

For anyone running into this in the future, this is caused by having postgres 9.5 installed, but pointed at a data directory for 9.4 (likely because you haven't run pg_upgrade yet)

All 3 comments

Things were configured wrong on my side - fixed.

For anyone running into this in the future, this is caused by having postgres 9.5 installed, but pointed at a data directory for 9.4 (likely because you haven't run pg_upgrade yet)

@sgrif can you show me how to check what data directory postgres is pointing to?

Would something like this work?

// check installed version
$ postgres --version
postgres (PostgreSQL) 10.4

// check directory version
$ psql development_env
# select version();
                                                   version                                                    
--------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.5.3 on x86_64-apple-darwin14.5.0, compiled by Apple LLVM version 7.0.2 (clang-700.1.81), 64-bit
(1 row)
Was this page helpful?
0 / 5 - 0 ratings