Make the world safe for atttypmod=0 ... this didn't use to mean anything,

but timestamp now wants it to mean something.
This commit is contained in:
Tom Lane 2001-10-04 17:52:24 +00:00
parent dd154dde59
commit 38633cf891
2 changed files with 8 additions and 9 deletions

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.62 2001/10/03 05:29:12 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.63 2001/10/04 17:52:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -284,10 +284,9 @@ coerce_type_typmod(ParseState *pstate, Node *node,
Oid oid_array[FUNC_MAX_ARGS]; Oid oid_array[FUNC_MAX_ARGS];
/* /*
* We assume that only typmod values greater than 0 indicate a forced * A negative typmod is assumed to mean that no coercion is wanted.
* conversion is necessary.
*/ */
if ((atttypmod <= 0) || (atttypmod == exprTypmod(node))) if (atttypmod < 0 || atttypmod == exprTypmod(node))
return node; return node;
funcname = typeidTypeName(targetTypeId); funcname = typeidTypeName(targetTypeId);

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.17 2001/10/03 18:32:42 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.18 2001/10/04 17:52:24 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -201,7 +201,7 @@ format_type_internal(Oid type_oid, int32 typemod, bool allow_invalid)
break; break;
case TIMEOID: case TIMEOID:
if (with_typemod && typemod > 0) if (with_typemod)
buf = psnprintf(50, "time(%d) without time zone", buf = psnprintf(50, "time(%d) without time zone",
typemod); typemod);
else else
@ -209,7 +209,7 @@ format_type_internal(Oid type_oid, int32 typemod, bool allow_invalid)
break; break;
case TIMETZOID: case TIMETZOID:
if (with_typemod && typemod > 0) if (with_typemod)
buf = psnprintf(50, "time(%d) with time zone", buf = psnprintf(50, "time(%d) with time zone",
typemod); typemod);
else else
@ -217,7 +217,7 @@ format_type_internal(Oid type_oid, int32 typemod, bool allow_invalid)
break; break;
case TIMESTAMPOID: case TIMESTAMPOID:
if (with_typemod && typemod > 0) if (with_typemod)
buf = psnprintf(50, "timestamp(%d) without time zone", buf = psnprintf(50, "timestamp(%d) without time zone",
typemod); typemod);
else else
@ -225,7 +225,7 @@ format_type_internal(Oid type_oid, int32 typemod, bool allow_invalid)
break; break;
case TIMESTAMPTZOID: case TIMESTAMPTZOID:
if (with_typemod && typemod > 0) if (with_typemod)
buf = psnprintf(50, "timestamp(%d) with time zone", buf = psnprintf(50, "timestamp(%d) with time zone",
typemod); typemod);
else else