]> granicus.if.org Git - postgresql/commitdiff
Cast functions can be immutable or stable.
authorPeter Eisentraut <peter_e@gmx.net>
Sun, 15 Sep 2002 13:04:16 +0000 (13:04 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Sun, 15 Sep 2002 13:04:16 +0000 (13:04 +0000)
doc/src/sgml/ref/create_cast.sgml
src/backend/commands/functioncmds.c

index 00a44719662595ff27e430e3f5e1c64afea0398b..bc9f71e566ea78e38b3eff460497bacdcc2800d5 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.3 2002/09/01 02:37:02 tgl Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.4 2002/09/15 13:04:16 petere Exp $ -->
 
 <refentry id="SQL-CREATECAST">
  <refmeta>
@@ -117,7 +117,7 @@ INSERT INTO foo(f1) VALUES(42);
        be schema-qualified.  If it is not, the function will be looked
        up in the path.  The argument type must be identical to the
        source type, the result data type must match the target type of
-       the cast.  Cast functions must be marked immutable.
+       the cast.  Cast functions must be marked immutable or stable.
       </para>
      </listitem>
     </varlistentry>
index 47ebe0d76127b9c909f3e9a73780480de2bd6e4b..a935dae7e6e7f07f9dc09b6ec9cafbc86821736b 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.19 2002/09/04 20:31:15 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.20 2002/09/15 13:04:16 petere Exp $
  *
  * DESCRIPTION
  *       These routines take the parse tree and pick out the
@@ -676,8 +676,8 @@ CreateCast(CreateCastStmt *stmt)
                        elog(ERROR, "argument of cast function must match source data type");
                if (procstruct->prorettype != targettypeid)
                        elog(ERROR, "return data type of cast function must match target data type");
-               if (procstruct->provolatile != PROVOLATILE_IMMUTABLE)
-                       elog(ERROR, "cast function must be immutable");
+               if (procstruct->provolatile == PROVOLATILE_VOLATILE)
+                       elog(ERROR, "cast function must not be volatile");
                if (procstruct->proisagg)
                        elog(ERROR, "cast function must not be an aggregate function");
                if (procstruct->proretset)