summaryrefslogtreecommitdiff
path: root/src/backend/tcop
diff options
context:
space:
mode:
authorTom Lane2005-07-10 21:14:00 +0000
committerTom Lane2005-07-10 21:14:00 +0000
commitd78397d301172cccce14d5d789f296c47dd47c5e (patch)
tree4104dc887976aee14286c0c0a7be03f84af43b7d /src/backend/tcop
parent2e330699fae72c40f5237ce0f4fc210c483d2816 (diff)
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.
Diffstat (limited to 'src/backend/tcop')
-rw-r--r--src/backend/tcop/fastpath.c12
-rw-r--r--src/backend/tcop/postgres.c7
2 files changed, 11 insertions, 8 deletions
diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c
index bd9b490378..a870f2c9c8 100644
--- a/src/backend/tcop/fastpath.c
+++ b/src/backend/tcop/fastpath.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.80 2005/05/01 18:56:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/fastpath.c,v 1.81 2005/07/10 21:13:58 tgl Exp $
*
* NOTES
* This cruft is the server side of PQfn.
@@ -493,9 +493,10 @@ parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip,
/* Call the argument type's binary input converter */
getTypeBinaryInputInfo(fip->argtypes[i], &typreceive, &typioparam);
- fcinfo->arg[i] = OidFunctionCall2(typreceive,
+ fcinfo->arg[i] = OidFunctionCall3(typreceive,
PointerGetDatum(&abuf),
- ObjectIdGetDatum(typioparam));
+ ObjectIdGetDatum(typioparam),
+ Int32GetDatum(-1));
/* Trouble if it didn't eat the whole buffer */
if (abuf.cursor != abuf.len)
@@ -579,9 +580,10 @@ parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info * fip,
/* Call the argument type's binary input converter */
getTypeBinaryInputInfo(fip->argtypes[i], &typreceive, &typioparam);
- fcinfo->arg[i] = OidFunctionCall2(typreceive,
+ fcinfo->arg[i] = OidFunctionCall3(typreceive,
PointerGetDatum(&abuf),
- ObjectIdGetDatum(typioparam));
+ ObjectIdGetDatum(typioparam),
+ Int32GetDatum(-1));
/* Trouble if it didn't eat the whole buffer */
if (abuf.cursor != abuf.len)
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 6973e9d3b3..038a482239 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.452 2005/07/04 04:51:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.453 2005/07/10 21:13:58 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -1571,9 +1571,10 @@ exec_bind_message(StringInfo input_message)
getTypeBinaryInputInfo(ptype, &typreceive, &typioparam);
params[i].value =
- OidFunctionCall2(typreceive,
+ OidFunctionCall3(typreceive,
PointerGetDatum(&pbuf),
- ObjectIdGetDatum(typioparam));
+ ObjectIdGetDatum(typioparam),
+ Int32GetDatum(-1));
/* Trouble if it didn't eat the whole buffer */
if (pbuf.cursor != pbuf.len)