mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +03:00
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.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.127 2005/07/10 04:54:30 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.128 2005/07/10 21:13:59 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -299,6 +299,10 @@ textrecv(PG_FUNCTION_ARGS)
|
||||
int nbytes;
|
||||
|
||||
str = pq_getmsgtext(buf, buf->len - buf->cursor, &nbytes);
|
||||
|
||||
/* verify encoding */
|
||||
pg_verifymbstr(str, nbytes, false);
|
||||
|
||||
result = (text *) palloc(nbytes + VARHDRSZ);
|
||||
VARATT_SIZEP(result) = nbytes + VARHDRSZ;
|
||||
memcpy(VARDATA(result), str, nbytes);
|
||||
|
Reference in New Issue
Block a user