In the object hierarchy of every database are Languages. Languages can be added by selecting CREATE LANGUAGE from the Languages context menu. Once a language has been created, it can be dropped. This section describes how to create and drop a language with Administrator.
When creating a language, the only required parameters are a unique name for the new language and a handler.
The Handler is the name of the handler function for the language. This corresponds to the call_handler parameter of CREATE LANGUAGE.
If the handler function has not yet been defined in the database, the handler location (the path to the file containing the dynamically loadable object) must also be input (this implicitly creates the handler function in the database). If the handler function already exists in the database, a handler location need not be entered.
In addition to those required parameters, there are several optional parameters that you can set:
The name of the validator function for the language. This corresponds to the valfunction parameter of CREATE LANGUAGE.
This corresponds to the TRUSTED keyword for CREATE LANGUAGE.
This corresponds to the PROCEDURAL keyword for CREATE LANGUAGE.
Refer to the CREATE LANGUAGE and CREATE FUNCTION sections in the PostgreSQL 7.3 Reference Manual for more information on these parameters and keywords.
This example describes how to define the trusted procedural language plpgsql in a database.
A language is an object under a database, so to create a language, first expand the database under which you wish to create the language (click the [O-] beside the database name).
Right-click on Languages and select CREATE LANGUAGE. The CREATE LANGUAGE dialog appears.
For the language name, type: plpgsql
For the handler name, type: plpgsql_call_handler()
For the handler location name, type: /usr/lib/pgsql/plpgsql.so
Enable the attributes: Trusted and Procedural.
Leave the Validator field blank.
Click OK to define the new language.
Note that the language plpgsql has been added under the Languages node.
The Manage Supported Languages dialog enables you to install and drop the supported languages and their language handlers in Administrator. The supported languages are plperl, plpgsql, pltcl, and pltclu.
Administrator looks for the binaries for these supported languages in /usr/lib, so ensure that the compatible binaries are there.
To install a language, select the languages you want to install from Languages Available, click Add to add them to the list of languages to be installed, then click OK. The language handler is created automatically.
Administrator also enables you to perform the following operations on existing languages:
To drop a language without dropping its language handler, right-click on it and select either DROP RESTRICT or DROP CASCADE. DROP RESTRICT will not drop the language if there are any dependent objects. DROP CASCADE automatically drops the language and all objects that depend on it.
If Preferences => Ask For Confirmations is enabled, you are asked to confirm that you want the language dropped (and all the dependent objects in case of a DROP CASCADE); if it is disabled, the language is dropped immediately (along with its dependent objects if DROP CASCADE was selected). This action cannot be undone.