From d2a907c6ad28413bf85660ea590e0e21e0d7016c Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Wed, 16 Sep 1998 14:43:12 +0000 Subject: Markup and editing adjustments... --- doc/src/sgml/ref/create_function.sgml | 132 +++++++++++++++++----------------- 1 file changed, 68 insertions(+), 64 deletions(-) (limited to 'doc/src/sgml/ref/create_function.sgml') diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index 62fe39652f..96cce89bd9 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -15,30 +15,23 @@ - 1998-04-15 + 1998-09-09 - CREATE FUNCTION name ([ftype [, ...]]) - RETURNS rtype - AS path - LANGUAGE 'langname' +CREATE FUNCTION name ( [ ftype [, ...] ] ) + RETURNS rtype + AS path + LANGUAGE 'langname' - 1998-04-15 + 1998-09-09 Inputs - - - - - - - @@ -87,21 +80,21 @@ - may be 'c', 'sql', 'internal' or 'plname'. - (where 'plname' is the language name of a created procedural - language. See CREATE LANGUAGE for details). + may be 'C', 'sql', + 'internal' + or 'plname', + where 'plname' + is the name of a created procedural + language. See CREATE LANGUAGE for details. - - - - 1998-04-15 + 1998-09-09 Outputs @@ -111,6 +104,7 @@ <VARIABLELIST> <VARLISTENTRY> <TERM> +<replaceable>status</replaceable> </TERM> <LISTITEM> <PARA> @@ -134,32 +128,34 @@ <REFSECT1 ID="R1-SQL-CREATEFUNCTION-1"> <REFSECT1INFO> - <DATE>1998-04-15</DATE> + <DATE>1998-09-09</DATE> </REFSECT1INFO> <TITLE> Description - With this command, a PostgreSQL user can register a function - with PostgreSQL. Subsequently, this user is treated as the + CREATE FUNCTION allows a +Postgres user +to register a function + with a database. Subsequently, this user is treated as the owner of the function. - 1998-04-15 + 1998-09-09 Notes - Refer to PostgreSQL User's Guide chapter 6 for further information. - This reference needs to be corrected. + Refer to the chapter on functions +in the PostgreSQL Programmer's Guide + for further information. - Refer to the - DROP FUNCTION - statement to drop functions. + Use DROP FUNCTION + to drop user-defined functions. @@ -171,15 +167,17 @@ To create a simple SQL function: - CREATE FUNCTION one() RETURNS int4 - AS 'SELECT 1 AS RESULT' - LANGUAGE 'sql'; +CREATE FUNCTION one() RETURNS int4 + AS 'SELECT 1 AS RESULT' + LANGUAGE 'sql'; - SELECT one() AS answer; +SELECT one() AS answer; - answer - ------ - 1 + +answer +------ +1 + To create a C function, calling a routine from a user-created @@ -188,17 +186,18 @@ is correct. It is intended for use in a CHECK contraint. - CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool - AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c'; + +CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool + AS '/usr1/proj/bray/sql/funcs.so' LANGUAGE 'c'; - CREATE TABLE product - ( - id char(8) PRIMARY KEY, - eanprefix char(8) CHECK (eanprefix ~ '[0-9]{2}-[0-9]{5}') - REFERENCES brandname(ean_prefix), - eancode char(6) CHECK (eancode ~ '[0-9]{6}'), - CONSTRAINT ean CHECK (ean_checkdigit(eanprefix, eancode)) - ); +CREATE TABLE product +( + id char(8) PRIMARY KEY, + eanprefix char(8) CHECK (eanprefix ~ '[0-9]{2}-[0-9]{5}') + REFERENCES brandname(ean_prefix), + eancode char(6) CHECK (eancode ~ '[0-9]{6}'), + CONSTRAINT ean CHECK (ean_checkdigit(eanprefix, eancode)) +); @@ -216,39 +215,44 @@ Compatibility - The CREATE FUNCTION statement is a PostgreSQL language extension. + CREATE FUNCTION is + a Postgres language extension. - 1998-04-15 + 1998-09-09 - SQL/PSM<footnote> + SQL/PSM + + + + - PSM stands for Persistent Stored Modules, it is a procedural + PSM stands for Persistent Stored Modules. It is a procedural language and it was originally hoped that PSM would be ratified - as an official standard by late 1996. However PSM will + as an official standard by late 1996. As of mid-1998, this +has not yet happened, but it is hoped that PSM will eventually become a standard. - - - - The SQL/PSM CREATE FUNCTION statement has the following syntax: - - CREATE FUNCTION name - ( [ [IN|OUT|INOUT] parm type [, ...] ]) - RETURNS rtype - LANGUAGE 'langname' - ESPECIFIC routine - SQL-statement - + + +SQL/PSM CREATE FUNCTION has the following syntax: + +CREATE FUNCTION name + ( [ [ IN | OUT | INOUT ] parm type [, ...] ] ) + RETURNS rtype + LANGUAGE 'langname' + ESPECIFIC routine + SQL-statement + + -