Languages

In the object hierarchy of every database, you will find Languages. Languages can be added by selecting CREATE LANGUAGE from the Languages context menu. Once a language has been created, it can also be dropped. This section describes how to create and drop a language with RHDB Administrator.

Creating a New Language

When creating a language, the only required parameter is a unique name for the new language. However, there are several optional parameters that you can set:

Handler

The name of the handler function for the language. This corresponds to the call_handler parameter to 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.

Compiler

The compiler for the language.

Trusted

This corresponds to the TRUSTED keyword for CREATE LANGUAGE.

Procedural

This corresponds to the PROCEDURAL keyword for CREATE LANGUAGE.

Refer to the CREATE LANGUAGE and CREATE FUNCTION sections in the Red Hat Database SQL Guide and Reference for more information on these parameters and keywords.

This example describes how to define the trusted procedural language plpgsql in a database.

  1. 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 + beside the database name).

  2. Right-click on Languages and select CREATE LANGUAGE. The CREATE LANGUAGE dialog appears.

  3. For the language name, type: plpgsql

  4. For the handler name, type: plpgsql_call_handler()

  5. For the handler location name, type: /usr/lib/pgsql/plpgsql.so

  6. Enable the attributes: Trusted and Procedural.

  7. For the Compiler, type: PL/pgSQL.

    Figure 4-32. The CREATE LANGUAGE Dialog

  8. Click OK to define the new language.

Figure 4-33. The Languages Tree View and Detailed View

Note that the function plpgsql_call_handler() has been added under the Functions node in the Tree View and the language plpgsql has been added under the Languages node.

Creating a Language with "Manage Supported Languages"

The Manage Supported Languages dialog enables you to create and drop the supported languages and their language handlers in RHDB Administrator. In RHDB Administrator Version 1.0, the supported languages are plperl, plpgsql, pltcl, and pltclu.

Figure 4-34. The Manage Supported Languages Dialog

To create 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 will be created automatically.

RHDB Administrator also enables you to drop existing languages in two ways:

  • To drop a language without dropping its language handler, right-click on it and select DROP LANGUAGE. Select the language you want to drop from Languages Installed, click Remove, then click OK. If View -> Ask For Confirmations is enabled, you are asked to confirm that you want the language dropped; if it is disabled, the language is dropped immediately. This action cannot be undone.

  • To drop a language and its language handler, right-click on Languages and select MANAGE SUPPORTED LANGUAGES. Select the languages you want to drop, click Remove, then click OK. If View -> Ask For Confirmations is enabled, you are asked to confirm that you want the languages dropped; if it is disabled, the languages and their handlers are dropped immediately. This action cannot be undone.

    Note

    If a language's handler function has already been dropped, you cannot use MANAGE SUPPORTED LANGUAGE to drop a language—you must use DROP LANGUAGE instead.