ALTER LIBRARY

Replaces the library file that is currently associated with a UDx library in the Vertica catalog. Vertica automatically distributes copies of the updated file to all cluster nodes. UDxs defined in the catalog that reference the updated library automatically start using the updated library file.

The current and replacement libraries must be developed in the same language.

Syntax

ALTER LIBRARY [[database.]schema.]library‑name  [DEPENDS 'support‑path'] AS 'library‑path';

Parameters

schema

Specifies a schema, by default public. If schema is any schema other than public, you must supply the schema name. For example:

myschema.thisDbObject

If you specify a database, it must be the current database.

library‑name

The name of an existing library created with CREATE LIBRARY.

DEPENDS 'support‑path'

Indicates that the UDx library depends on one or more files or libraries, where support‑path specifies one or more absolute paths to these dependencies on the initiator node.

DEPENDS is ignored for R, as R packages must be installed locally on each node, including external dependencies.

For example, the following statement specifies a single dependency:

=> CREATE LIBRARY mylib AS '/path/to/java_udx' DEPENDS '/path/to/jar/this.jar' LANGUAGE 'Java';

DEPENDS can specify multiple support paths as follows:

  • Separate multiple paths with colons (:). For example:
    => CREATE LIBRARY mylib AS '/path/to/java_udx' 
         DEPENDS '/path/to/jars/this.jar:/path/to/jars/that.jar' LANGUAGE 'Java';
  • Specify a directory that contains multiple libraries with a trailing slash (/), optionally followed by asterisk wildcard (*). For example, the following DEPENDS clauses are identical: 
    DEPENDS '/home/mydir/mylibs/'
    DEPENDS '/home/mydir/mylibs/*'
    

DEPENDS can specify libraries with multiple directory levels.  For details, see Multi-level Library Dependencies.

The performance of CREATE LIBRARY is liable to degrade in Eon Mode, in proportion to the number and depth of dependencies specified by the DEPENDS clause.

AS library‑path

The absolute path on the initiator node file system of the replacement library file.

Privileges

Superuser

Requirements

The original and replacement libraries must comply with the following requirements, otherwise ALTER LIBRARY returns with an error:

  • The libraries must be developed in the same programming language.
  • Function signatures must match.

Multi-level Library Dependencies

If a DEPENDS clause specifies a library with multiple directory levels, Vertica follows the library path to include all subdirectories of that library. For example, the following CREATE LIBRARY statement enables UDx library mylib to import all Python packages and modules that it finds in subdirectories of site‑packages:

=> CREATE LIBRARY mylib AS '/path/to/python_udx' DEPENDS '/path/to/python/site-packages' LANGUAGE 'Python';

DEPENDS can specify Java library dependencies that are up to 100 levels deep.

Examples

This example shows how to update an already-defined library myFunctions with a new file.

=> ALTER LIBRARY myFunctions AS '/home/dbadmin/my_new_functions.so';

See Also

Developing User-Defined Extensions (UDxs)