aboutsummaryrefslogtreecommitdiff
path: root/contrib/tablefunc/tablefunc.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tablefunc/tablefunc.c')
-rw-r--r--contrib/tablefunc/tablefunc.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c
index 622164b91b5..3eccebf476f 100644
--- a/contrib/tablefunc/tablefunc.c
+++ b/contrib/tablefunc/tablefunc.c
@@ -351,7 +351,6 @@ crosstab(PG_FUNCTION_ARGS)
TupleDesc ret_tupdesc;
int call_cntr;
int max_calls;
- TupleTableSlot *slot;
AttInMetadata *attinmeta;
SPITupleTable *spi_tuptable = NULL;
TupleDesc spi_tupdesc;
@@ -429,10 +428,10 @@ crosstab(PG_FUNCTION_ARGS)
if (functyptype == 'c')
{
- /* Build a tuple description for a functypeid tuple */
+ /* Build a tuple description for a named composite type */
tupdesc = TypeGetTupleDesc(functypeid, NIL);
}
- else if (functyptype == 'p' && functypeid == RECORDOID)
+ else if (functypeid == RECORDOID)
{
if (fcinfo->nargs != 2)
ereport(ERROR,
@@ -461,12 +460,6 @@ crosstab(PG_FUNCTION_ARGS)
errmsg("return and sql tuple descriptions are " \
"incompatible")));
- /* allocate a slot for a tuple with this tupdesc */
- slot = TupleDescGetSlot(tupdesc);
-
- /* assign slot to function context */
- funcctx->slot = slot;
-
/*
* Generate attribute metadata needed later to produce tuples from
* raw C strings
@@ -499,9 +492,6 @@ crosstab(PG_FUNCTION_ARGS)
call_cntr = funcctx->call_cntr;
max_calls = funcctx->max_calls;
- /* return slot for our tuple */
- slot = funcctx->slot;
-
/* user context info */
fctx = (crosstab_fctx *) funcctx->user_fctx;
lastrowid = fctx->lastrowid;
@@ -621,7 +611,7 @@ crosstab(PG_FUNCTION_ARGS)
tuple = BuildTupleFromCStrings(attinmeta, values);
/* make the tuple into a datum */
- result = TupleGetDatum(slot, tuple);
+ result = HeapTupleGetDatum(tuple);
/* Clean up */
for (i = 0; i < num_categories + 1; i++)
@@ -1675,7 +1665,7 @@ make_crosstab_tupledesc(TupleDesc spi_tupdesc, int num_categories)
strcpy(attname, "rowname");
TupleDescInitEntry(tupdesc, attnum, attname, sql_atttypid,
- -1, 0, false);
+ -1, 0);
/* now the category values columns */
sql_attr = spi_tupdesc->attrs[2];
@@ -1687,7 +1677,7 @@ make_crosstab_tupledesc(TupleDesc spi_tupdesc, int num_categories)
sprintf(attname, "category_%d", i + 1);
TupleDescInitEntry(tupdesc, attnum, attname, sql_atttypid,
- -1, 0, false);
+ -1, 0);
}
return tupdesc;