LOAD

Name

LOAD  --  Dynamically loads an object file

Synopsis

LOAD filename
  

Inputs

filename

Object file for dynamic loading.

Outputs

LOAD

Message returned on successful completion.

ERROR: LOAD: could not open file 'filename'

Message returned if the specified file is not found. The file must be visible to the PostgreSQL backend, with the appropriate full path name specified, to avoid this message.

Description

Loads a shared library file into the PostgreSQL backend's address space. If the file had been loaded previously, it is first unloaded. This command is primarily useful to unload and reload a shared library file that has been changed since the backend first loaded it. To make use of the shared library, function(s) in it need to be declared using the CREATE FUNCTION command.

The file name is specified in the same way as for shared library names in CREATE FUNCTION; in particular, one may rely on a search path and automatic addition of the system's standard shared library file name extension.

Notes

Functions in loaded object files should not call functions in other object files loaded through the LOAD command. For example, all functions in file A should call each other, functions in the standard or math libraries, or in PostgreSQL itself. They should not call functions defined in a different loaded file B. This is because if B is reloaded, the PostgreSQL loader is not able to relocate the calls from the functions in A into the new address space of B. If B is not reloaded, however, there will not be a problem.

Object files must be compiled to contain position-independent code.

Usage

Load the file /usr/postgres/demo/circle.o:
LOAD '/usr/postgres/demo/circle.o'

Compatibility

SQL92

There is no LOAD statement in SQL92.