From d78397d301172cccce14d5d789f296c47dd47c5e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 10 Jul 2005 21:14:00 +0000 Subject: Change typreceive function API so that receive functions get the same optional arguments as text input functions, ie, typioparam OID and atttypmod. Make all the datatypes that use typmod enforce it the same way in typreceive as they do in typinput. This fixes a problem with failure to enforce length restrictions during COPY FROM BINARY. --- src/backend/utils/adt/numeric.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/backend/utils/adt/numeric.c') diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 8b39bb4248c..4aa631ee577 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -14,7 +14,7 @@ * Copyright (c) 1998-2005, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.84 2005/06/04 14:12:50 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.85 2005/07/10 21:13:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -383,6 +383,10 @@ Datum numeric_recv(PG_FUNCTION_ARGS) { StringInfo buf = (StringInfo) PG_GETARG_POINTER(0); +#ifdef NOT_USED + Oid typelem = PG_GETARG_OID(1); +#endif + int32 typmod = PG_GETARG_INT32(2); NumericVar value; Numeric res; int len, @@ -419,6 +423,8 @@ numeric_recv(PG_FUNCTION_ARGS) value.digits[i] = d; } + apply_typmod(&value, typmod); + res = make_result(&value); free_var(&value); -- cgit v1.2.3