From a75f2d21a8366aece67b8aa144a8644f6195e75f Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Tue, 29 Dec 1998 02:24:47 +0000 Subject: Clean up to ensure tag completion as required by the newest versions of Norm's Modular Style Sheets and jade/docbook. From Vince Vielhaber . --- doc/src/sgml/ref/create_function.sgml | 126 ++++++++++++++++++---------------- 1 file changed, 66 insertions(+), 60 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 e639845a7c5..f5a27adb308 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -12,7 +12,7 @@ Defines a new function - + 1998-09-09 @@ -66,30 +66,31 @@ CREATE FUNCTION name ( [ path - - - - May be either an SQL-query or an absolute path to an - object file. - - - - - - langname - - - - may be 'C', 'sql', - 'internal' - or 'plname', - where 'plname' - is the name of a created procedural - language. See CREATE LANGUAGE for details. - - - - + + + + May be either an SQL-query or an absolute path to an + object file. + + + + + + langname + + + + may be 'C', 'sql', + 'internal' + or 'plname', + where 'plname' + is the name of a created procedural + language. See CREATE LANGUAGE for details. + + + + + @@ -100,16 +101,20 @@ CREATE FUNCTION name ( [ - - - - - CREATE - - - - This is returned if the command completes successfully. - + + + + + CREATE + + + + This is returned if the command completes successfully. + + + + + @@ -122,8 +127,8 @@ CREATE FUNCTION name ( [ CREATE FUNCTION allows a -Postgres user -to register a function + Postgres user + to register a function with a database. Subsequently, this user is treated as the owner of the function. @@ -138,13 +143,14 @@ to register a function Refer to the chapter on functions in the PostgreSQL Programmer's Guide - for further information. + for further information. Use DROP FUNCTION to drop user-defined functions. + @@ -154,17 +160,17 @@ in the <citetitle>PostgreSQL Programmer's Guide</citetitle> To create a simple SQL function: </PARA> <ProgramListing> -CREATE FUNCTION one() RETURNS int4 - AS 'SELECT 1 AS RESULT' - LANGUAGE 'sql'; - -SELECT one() AS answer; - -<computeroutput> -answer ------- -1 -</computeroutput> + CREATE FUNCTION one() RETURNS int4 + AS 'SELECT 1 AS RESULT' + LANGUAGE 'sql'; + + SELECT one() AS answer; + + <computeroutput> + answer + ------ + 1 + </computeroutput> </ProgramListing> <para> To create a C function, calling a routine from a user-created @@ -173,18 +179,18 @@ answer is correct. It is intended for use in a CHECK contraint. </para> <programlisting> -<userinput> -CREATE FUNCTION ean_checkdigit(bpchar, bpchar) RETURNS bool + <userinput> + 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)) -);</userinput> + + 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)) + );</userinput> </programlisting> </REFSECT1> -- cgit v1.2.3