mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Repair oidvectorrecv and int2vectorrecv, which I broke while changing
them to use array_recv :-(. Per report from Tim Kordas.
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.68 2005/10/15 02:49:28 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/int.c,v 1.68.2.1 2006/03/02 21:13:11 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -212,13 +212,28 @@ Datum
|
|||||||
int2vectorrecv(PG_FUNCTION_ARGS)
|
int2vectorrecv(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
|
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
|
||||||
|
FunctionCallInfoData locfcinfo;
|
||||||
int2vector *result;
|
int2vector *result;
|
||||||
|
|
||||||
result = (int2vector *)
|
/*
|
||||||
DatumGetPointer(DirectFunctionCall3(array_recv,
|
* Normally one would call array_recv() using DirectFunctionCall3,
|
||||||
PointerGetDatum(buf),
|
* but that does not work since array_recv wants to cache some data
|
||||||
ObjectIdGetDatum(INT2OID),
|
* using fcinfo->flinfo->fn_extra. So we need to pass it our own
|
||||||
Int32GetDatum(-1)));
|
* flinfo parameter.
|
||||||
|
*/
|
||||||
|
InitFunctionCallInfoData(locfcinfo, fcinfo->flinfo, 3, NULL, NULL);
|
||||||
|
|
||||||
|
locfcinfo.arg[0] = PointerGetDatum(buf);
|
||||||
|
locfcinfo.arg[1] = ObjectIdGetDatum(INT2OID);
|
||||||
|
locfcinfo.arg[2] = Int32GetDatum(-1);
|
||||||
|
locfcinfo.argnull[0] = false;
|
||||||
|
locfcinfo.argnull[1] = false;
|
||||||
|
locfcinfo.argnull[2] = false;
|
||||||
|
|
||||||
|
result = (int2vector *) DatumGetPointer(array_recv(&locfcinfo));
|
||||||
|
|
||||||
|
Assert(!locfcinfo.isnull);
|
||||||
|
|
||||||
/* sanity checks: int2vector must be 1-D, no nulls */
|
/* sanity checks: int2vector must be 1-D, no nulls */
|
||||||
if (result->ndim != 1 ||
|
if (result->ndim != 1 ||
|
||||||
result->flags != 0 ||
|
result->flags != 0 ||
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.64.2.1 2005/11/22 18:23:21 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.64.2.2 2006/03/02 21:13:11 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -254,13 +254,28 @@ Datum
|
|||||||
oidvectorrecv(PG_FUNCTION_ARGS)
|
oidvectorrecv(PG_FUNCTION_ARGS)
|
||||||
{
|
{
|
||||||
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
|
StringInfo buf = (StringInfo) PG_GETARG_POINTER(0);
|
||||||
|
FunctionCallInfoData locfcinfo;
|
||||||
oidvector *result;
|
oidvector *result;
|
||||||
|
|
||||||
result = (oidvector *)
|
/*
|
||||||
DatumGetPointer(DirectFunctionCall3(array_recv,
|
* Normally one would call array_recv() using DirectFunctionCall3,
|
||||||
PointerGetDatum(buf),
|
* but that does not work since array_recv wants to cache some data
|
||||||
ObjectIdGetDatum(OIDOID),
|
* using fcinfo->flinfo->fn_extra. So we need to pass it our own
|
||||||
Int32GetDatum(-1)));
|
* flinfo parameter.
|
||||||
|
*/
|
||||||
|
InitFunctionCallInfoData(locfcinfo, fcinfo->flinfo, 3, NULL, NULL);
|
||||||
|
|
||||||
|
locfcinfo.arg[0] = PointerGetDatum(buf);
|
||||||
|
locfcinfo.arg[1] = ObjectIdGetDatum(OIDOID);
|
||||||
|
locfcinfo.arg[2] = Int32GetDatum(-1);
|
||||||
|
locfcinfo.argnull[0] = false;
|
||||||
|
locfcinfo.argnull[1] = false;
|
||||||
|
locfcinfo.argnull[2] = false;
|
||||||
|
|
||||||
|
result = (oidvector *) DatumGetPointer(array_recv(&locfcinfo));
|
||||||
|
|
||||||
|
Assert(!locfcinfo.isnull);
|
||||||
|
|
||||||
/* sanity checks: oidvector must be 1-D, no nulls */
|
/* sanity checks: oidvector must be 1-D, no nulls */
|
||||||
if (result->ndim != 1 ||
|
if (result->ndim != 1 ||
|
||||||
result->flags != 0 ||
|
result->flags != 0 ||
|
||||||
|
Reference in New Issue
Block a user