pg_upgrade with C-language extensions?

From: Craig James <cjames(at)emolecules(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: pg_upgrade with C-language extensions?
Date: 2014-08-15 16:56:40
Message-ID: CAFwQ8rdJ1guX8Og3d6GAi8VMjO=1L+mzgAqwPav=dyKm4fgK8A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I can't figure out how to get pg_upgrade to work when I have my own
C-language extension.

Say I have this:

CREATE OR REPLACE FUNCTION my_foo() RETURNS integer
AS '/usr/local/mycompany/lib/libmystuff_pg.so', 'my_foo'
LANGUAGE c VOLATILE;

When I run "pg_upgrade ... --check", it complains that it won't be able to
do the update because libmystuff_pg.so isn't available.

OK, fair enough. But ... pg_upgrade has to be able to run both 8.4.17 and
9.5.3 at the same time. So if I compile libmystuff_pg.so against 9.3.5, it
won't work for 8.4.17, and vice versa. On the other hand, if I compile two
versions of libmystuff_pg.so, one for 8.4.17 and one for 9.3.5, then the
"CREATE OR REPLACE" will have the wrong path for one or the other.

How is this supposed to be done? The only thing I can think of is maybe I
should put libmystuff_pg.so into the Postgres lib directory and then leave
the path off of the "CREATE OR REPLACE" statement. I don't like mixing my
code with Postgres code, but is that the only way?

Thanks,
Craig

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Matheus de Oliveira 2014-08-15 18:35:53 Re: pg_upgrade with C-language extensions?
Previous Message jayknowsunix 2014-08-14 17:30:05 Re: pg_upgrade hangs