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. A UDx is considered to be the same if its name and signature match.

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

If a UDx function that is present in the original library is not present in the updated library, it is automatically dropped. This can result in loss of data if that function is in use, for example if a table depends on it to populate a column.

Syntax

ALTER LIBRARY [[database.]schema.]name [DEPENDS 'depends-path'] AS 'path';

Arguments

schema

Database and schema. The default schema is public. If you specify a database, it must be the current database.

name

The name of an existing library created with CREATE LIBRARY.

DEPENDS 'depends-path'

Files or libraries on which this library depends. The value is one or more absolute paths to these dependencies on the initiator node.

DEPENDS is ignored for libraries written in R, because R packages must be installed locally on each node, including external dependencies.

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 a 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 path

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

Privileges

Superuser, or UDXDEVELOPER and CREATE on the schema. Non-superusers must explicitly enable the UDXDEVELOPER role. See CREATE LIBRARY for examples.

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 the 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 named myFunctions with a new file.

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

See Also

Developing User-Defined Extensions (UDxs)