diff options
author | Tom Lane | 2003-02-01 22:09:41 +0000 |
---|---|---|
committer | Tom Lane | 2003-02-01 22:09:41 +0000 |
commit | d77c6396bbd84429c3bdf773c76c7b25c23734a2 (patch) | |
tree | 0a467f432b02267380c84efcc3f5b70d1e416b1b | |
parent | af30b9561841ccbeb1adb7fe7e8d15635a29211d (diff) |
Remove restriction that cast functions cannot be volatile. This
restriction was debatable to begin with, but it has now become obvious
that it breaks forward-porting of user-defined types; contrib/lo being
the most salient example.
-rw-r--r-- | doc/src/sgml/ref/create_cast.sgml | 4 | ||||
-rw-r--r-- | src/backend/commands/functioncmds.c | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/doc/src/sgml/ref/create_cast.sgml b/doc/src/sgml/ref/create_cast.sgml index 172b988a6af..34c36a6318e 100644 --- a/doc/src/sgml/ref/create_cast.sgml +++ b/doc/src/sgml/ref/create_cast.sgml @@ -1,4 +1,4 @@ -<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.6 2002/10/04 22:08:44 tgl Exp $ --> +<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.6.2.1 2003/02/01 22:09:41 tgl Exp $ --> <refentry id="SQL-CREATECAST"> <refmeta> @@ -143,7 +143,7 @@ SELECT 'The time is ' || CAST(now() AS text); 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 or stable. + the cast. </para> </listitem> </varlistentry> diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index 2e660d7f61a..0af5ebd0765 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.24 2002/11/01 19:19:58 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/functioncmds.c,v 1.24.2.1 2003/02/01 22:09:41 tgl Exp $ * * DESCRIPTION * These routines take the parse tree and pick out the @@ -745,8 +745,15 @@ 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"); + /* + * Restricting the volatility of a cast function may or may not be + * a good idea in the abstract, but it definitely breaks many old + * user-defined types. Disable this check --- tgl 2/1/03 + */ +#ifdef NOT_USED if (procstruct->provolatile == PROVOLATILE_VOLATILE) elog(ERROR, "cast function must not be volatile"); +#endif if (procstruct->proisagg) elog(ERROR, "cast function must not be an aggregate function"); if (procstruct->proretset) |