From ee8ed85da3b0548eba96f2ec68fa7ba577bba586 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 13 Aug 2001 21:34:54 +0000 Subject: Make LANCOMPILER clause in CREATE LANGUAGE optional. Allow "identifier" syntax for language names (instead of 'string'). createlang now handles the case where a second language uses the same call handler as an already installed language (e.g., plperl/plperlu). droplang now handles the reverse case, i.e., dropping a language where the call handler is still used by another language. Moreover, droplang can now be used to drop any user-defined language, not just the supplied ones. --- doc/src/sgml/ref/create_function.sgml | 23 ++++++++++++----------- doc/src/sgml/ref/create_language.sgml | 30 +++++++++--------------------- doc/src/sgml/ref/drop_language.sgml | 9 +++++---- doc/src/sgml/xplang.sgml | 16 +++++++--------- 4 files changed, 33 insertions(+), 45 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index 2a28925dff5..aa6552dca7d 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -1,5 +1,5 @@ @@ -18,12 +18,12 @@ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_function.sgml,v 1.24 2001/06/04 CREATE FUNCTION name ( [ argtype [, ...] ] ) RETURNS rettype AS 'definition' - LANGUAGE 'langname' + LANGUAGE langname [ WITH ( attribute [, ...] ) ] CREATE FUNCTION name ( [ argtype [, ...] ] ) RETURNS rettype AS 'obj_file', 'link_symbol' - LANGUAGE 'langname' + LANGUAGE langname [ WITH ( attribute [, ...] ) ] @@ -123,13 +123,14 @@ CREATE FUNCTION name ( [ - May be 'sql', 'C', - 'internal', or 'plname', where 'plname' is the name of a + May be SQL, C, + internal, or plname, where plname is the name of a created procedural language. See - for details. + for details. For backward compatibility, the name may be + enclosed by single quotes. @@ -261,7 +262,7 @@ CREATE FUNCTION name ( [ CREATE FUNCTION one() RETURNS integer AS 'SELECT 1 AS RESULT;' - LANGUAGE 'sql'; + LANGUAGE SQL; SELECT one() AS answer; @@ -281,7 +282,7 @@ SELECT one() AS answer; CREATE FUNCTION ean_checkdigit(char, char) RETURNS boolean - AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c'; + AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE C; CREATE TABLE product ( id char(8) PRIMARY KEY, @@ -306,7 +307,7 @@ CREATE TABLE product ( CREATE FUNCTION point(complex) RETURNS point AS '/home/bernie/pgsql/lib/complex.so', 'complex_to_point' - LANGUAGE 'c'; + LANGUAGE C; The C declaration of the function could be: diff --git a/doc/src/sgml/ref/create_language.sgml b/doc/src/sgml/ref/create_language.sgml index f5e1c6ffa90..73dd7773e81 100644 --- a/doc/src/sgml/ref/create_language.sgml +++ b/doc/src/sgml/ref/create_language.sgml @@ -1,5 +1,5 @@ @@ -23,9 +23,8 @@ Postgres documentation 1999-07-20 -CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE 'langname' +CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE langname HANDLER call_handler - LANCOMPILER 'comment' @@ -62,6 +61,10 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE 'langn language cannot override one of the built-in languages of Postgres. + + For backward compatibility, the name may be enclosed by single + quotes. + @@ -77,20 +80,6 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE 'langn - - comment - - - The LANCOMPILER argument is the - string that will be - inserted in the LANCOMPILER attribute - of the new - pg_language entry. At present, - Postgres does not use - this attribute in any way. - - - @@ -346,10 +335,9 @@ plsample_call_handler(PG_FUNCTION_ARGS) CREATE FUNCTION plsample_call_handler () RETURNS opaque AS '/usr/local/pgsql/lib/plsample.so' - LANGUAGE 'C'; -CREATE PROCEDURAL LANGUAGE 'plsample' - HANDLER plsample_call_handler - LANCOMPILER 'PL/Sample'; + LANGUAGE C; +CREATE LANGUAGE plsample + HANDLER plsample_call_handler; diff --git a/doc/src/sgml/ref/drop_language.sgml b/doc/src/sgml/ref/drop_language.sgml index 4bfd95861df..45331c6ae1f 100644 --- a/doc/src/sgml/ref/drop_language.sgml +++ b/doc/src/sgml/ref/drop_language.sgml @@ -1,5 +1,5 @@ @@ -23,7 +23,7 @@ Postgres documentation 1999-07-20 -DROP [ PROCEDURAL ] LANGUAGE 'name' +DROP [ PROCEDURAL ] LANGUAGE name @@ -40,7 +40,8 @@ DROP [ PROCEDURAL ] LANGUAGE 'name' name - The name of an existing procedural language. + The name of an existing procedural language. For backward + compatibility, the name may be enclosed by single quotes. @@ -132,7 +133,7 @@ ERROR: Language "name" doesn't exis This command removes the PL/Sample language: -DROP PROCEDURAL LANGUAGE 'plsample'; +DROP LANGUAGE plsample; diff --git a/doc/src/sgml/xplang.sgml b/doc/src/sgml/xplang.sgml index 46a59c6172f..6118836c545 100644 --- a/doc/src/sgml/xplang.sgml +++ b/doc/src/sgml/xplang.sgml @@ -1,5 +1,5 @@ @@ -79,7 +79,7 @@ createlang plpgsql template1 CREATE FUNCTION handler_function_name () RETURNS OPAQUE AS - 'path-to-shared-object' LANGUAGE 'C'; + 'path-to-shared-object' LANGUAGE C; The special return type of OPAQUE tells the database that this function does not return one of @@ -92,9 +92,8 @@ CREATE FUNCTION handler_function_name () The PL must be declared with the command -CREATE TRUSTED PROCEDURAL LANGUAGE 'language-name' - HANDLER handler_function_name - LANCOMPILER 'description'; +CREATE TRUSTED PROCEDURAL LANGUAGE language-name + HANDLER handler_function_name; The optional key word TRUSTED tells whether ordinary database users that have no superuser @@ -130,7 +129,7 @@ CREATE TRUSTED PROCEDURAL LANGUAGE ' CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS - '$libdir/plpgsql' LANGUAGE 'C'; + '$libdir/plpgsql' LANGUAGE C; @@ -139,9 +138,8 @@ CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS The command -CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql' - HANDLER plpgsql_call_handler - LANCOMPILER 'PL/pgSQL'; +CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql + HANDLER plpgsql_call_handler; then defines that the previously declared call handler function should be invoked for functions and trigger procedures where the -- cgit v1.2.3