Document formerly-undocumented WITH clause of CREATE FUNCTION.
authorTom Lane
Sat, 2 Oct 1999 21:27:49 +0000 (21:27 +0000)
committerTom Lane
Sat, 2 Oct 1999 21:27:49 +0000 (21:27 +0000)
doc/src/sgml/ref/create_function.sgml
doc/src/sgml/xfunc.sgml

index b22b9e4088f893a82870649cf044000f8b055187..3fb87b57f83b0e701bc4cc6a973b2164a1b4eab9 100644 (file)
@@ -1,5 +1,5 @@
 
 
@@ -20,19 +20,21 @@ Postgres documentation
  
  
   
-   1999-07-20
+   1999-10-02
   
   
 CREATE FUNCTION name ( [ ftype [, ...] ] )
     RETURNS rtype
+    [ WITH ( attribute [, ...] ) ]
     AS definition   
     LANGUAGE 'langname'
 
 
 CREATE FUNCTION name ( [ ftype [, ...] ] )
     RETURNS rtype
+    [ WITH ( attribute [, ...] ) ]
     AS obj_file , link_symbol  
-    LANGUAGE 'c'
+    LANGUAGE 'C'
   
   
   
@@ -79,6 +81,22 @@ CREATE FUNCTION name ( [ 
        
       
      
+     
+      attribute
+      
+       
+        An optional piece of information about the function, used for
+   optimization.  The only attribute currently supported is
+   iscachable.
+   iscachable indicates that the function always
+   returns the same result when given the same input values (i.e.,
+   it does not do database lookups or otherwise use information not
+   directly present in its parameter list).  The optimizer uses
+   iscachable to know whether it is safe to
+   pre-evaluate a call of the function.
+       
+      
+     
      
       definition
       
@@ -113,8 +131,7 @@ CREATE FUNCTION name ( [ 
    'internal'
    or 'plname',
    where 'plname'
-   is the name of a created procedural
-   language. See
+   is the name of a created procedural language. See
    
    for details.
        
index ea7f085f49346ad3d0792bc7742df0efe2069305..127cc2f93d1c87f73e1b0fc05678bf6a102eb1e6 100644 (file)
@@ -369,8 +369,8 @@ WARN::function declared to return type EMP does not retrieve (EMP.*)
     has the same name as the C source function the first form of the
     statement is used. The string argument in the AS clause is the
     full pathname of the file that contains the dynamically loadable
-    compiled object.  If the name of C function is different from the
-    name of the SQL function, then the second form is used. In this
+    compiled object.  If the name of the C function is different from the
+    desired name of the SQL function, then the second form is used. In this
     form the AS clause takes two string arguments, the first is the
     full pathname of the dynamically loadable object file, and the
     second is the link symbol that the dynamic loader should search
@@ -392,7 +392,7 @@ WARN::function declared to return type EMP does not retrieve (EMP.*)
     code file for the function, bracketed by quotation marks.  If a
     link symbol is used in the AS clause, the link symbol should also be
     bracketed by single quotation marks, and should be exactly the
-    same as the name of function in the C source code. On UNIX systems
+    same as the name of the function in the C source code. On UNIX systems
     the command nm will print all of the link
     symbols in a dynamically loadable object.
     (Postgres will not compile a function
@@ -991,7 +991,7 @@ memmove(destination->data, buffer, 40);
     
 
     
-     Pre-v6.<span class="marked">5</span>
+     Pre-v6.<span class="marked">6</span>
 
      
       For functions written in C, the SQL name declared in
@@ -1029,7 +1029,9 @@ memmove(destination->data, buffer, 40);
       they can be declared with the same SQL names (as long as their
       argument types differ, of course).  This way avoids the overhead of
       an SQL wrapper function, at the cost of more effort to prepare a
-      custom backend executable.
+      custom backend executable.  (This option is only available in version
+      6.5 and later, since prior versions required internal functions to
+      have the same name in SQL as in the C code.)