late binding of shared libs for C functions - Mailing list pgsql-hackers

From Geoff Winkless
Subject late binding of shared libs for C functions
Date
Msg-id CAEzk6fe4LT09U+aQDU9zOi-RvNScXHpnjHCqz_i_wXq+X=GV+Q@mail.gmail.com
Whole thread Raw
Responses Re: late binding of shared libs for C functions
Re: late binding of shared libs for C functions
List pgsql-hackers
Hi All

Is it possible to use CREATE FUNCTION to link a shared library that
doesn't yet exist? I don't think it is, but I might be missing
something.

If not, would it be something that people would be open to a patch
for? I'm thinking of e.g.

CREATE [ OR REPLACE ] FUNCTION
    name ( [ [ argmode ] [ argname ] argtype [ { DEFAULT | = }
default_expr ] [, ...] ] )
    [ RETURNS rettype
      | RETURNS TABLE ( column_name column_type [, ...] ) ]
  { LANGUAGE lang_name
    | TRANSFORM { FOR TYPE type_name } [, ... ]
    | WINDOW
    | IMMUTABLE | STABLE | VOLATILE | [ NOT ] LEAKPROOF
    | CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT
    | [ EXTERNAL ] SECURITY INVOKER | [ EXTERNAL ] SECURITY DEFINER
    | PARALLEL { UNSAFE | RESTRICTED | SAFE }
    | COST execution_cost
    | ROWS result_rows
    | SET configuration_parameter { TO value | = value | FROM CURRENT }
    | AS 'definition'
-    | AS 'obj_file', 'link_symbol'
+    | AS 'obj_file', 'link_symbol' [UNBOUNDED]
 } ...
    [ WITH ( attribute [, ...] ) ]


(I know UNBOUNDED isn't quite the word - BINDLATE would be better -
but I figured I should try to use an existing reserved keyword...)

We run our SQL scripts before we install binaries (because our
binaries are started by the installer, so having the database in place
is a Good Thing). The binary installer includes the .so. We're now
stuck in a catch-22 where I can't run the SQL script because it
requires the .so to be in place, but I can't run the binary installer
because if I do the SQL won't be updated...

This specific problem is obviously workaround-able, but it occurred to
me that since the libraries are bound late anyway it seems like this
wouldn't cause any serious problems.

Of course chances are I've missed something...

Geoff


pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Proposal: Partitioning Advisor for PostgreSQL
Next
From: Andrew Dunstan
Date:
Subject: Re: Does logical replication supports cross platform servers?