mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Change CREATE TYPE to require datatype output and send functions to have
only one argument. (Per recent discussion, the option to accept multiple arguments is pretty useless for user-defined types, and would be a likely source of security holes if it was used.) Simplify call sites of output/send functions to not bother passing more than one argument.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.137 2005/03/29 02:53:53 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.138 2005/05/01 18:56:18 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -632,9 +632,7 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
|
||||
result;
|
||||
bool isnull;
|
||||
Oid typoid,
|
||||
foutoid,
|
||||
typioparam;
|
||||
int32 typmod;
|
||||
foutoid;
|
||||
bool typisvarlena;
|
||||
|
||||
SPI_result = 0;
|
||||
@ -651,17 +649,11 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
|
||||
return NULL;
|
||||
|
||||
if (fnumber > 0)
|
||||
{
|
||||
typoid = tupdesc->attrs[fnumber - 1]->atttypid;
|
||||
typmod = tupdesc->attrs[fnumber - 1]->atttypmod;
|
||||
}
|
||||
else
|
||||
{
|
||||
typoid = (SystemAttributeDefinition(fnumber, true))->atttypid;
|
||||
typmod = -1;
|
||||
}
|
||||
|
||||
getTypeOutputInfo(typoid, &foutoid, &typioparam, &typisvarlena);
|
||||
getTypeOutputInfo(typoid, &foutoid, &typisvarlena);
|
||||
|
||||
/*
|
||||
* If we have a toasted datum, forcibly detoast it here to avoid
|
||||
@ -672,10 +664,8 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
|
||||
else
|
||||
val = origval;
|
||||
|
||||
result = OidFunctionCall3(foutoid,
|
||||
val,
|
||||
ObjectIdGetDatum(typioparam),
|
||||
Int32GetDatum(typmod));
|
||||
result = OidFunctionCall1(foutoid,
|
||||
val);
|
||||
|
||||
/* Clean up detoasted copy, if any */
|
||||
if (val != origval)
|
||||
|
Reference in New Issue
Block a user