1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Pass attypmod through to executor by adding to Var and Resdom.

This commit is contained in:
Bruce Momjian
1998-02-10 04:02:59 +00:00
parent 2535fcde2a
commit 2c482cdbf2
40 changed files with 212 additions and 201 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.27 1998/02/07 06:11:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.28 1998/02/10 04:00:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -1179,46 +1179,3 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
if (econtext != NULL)
pfree(econtext);
}
/* ----------------------------------------------------------------
* setAtttyplenForCreateTable -
* called when we do a SELECT * INTO TABLE tab
* needed for attributes that have atttypmod like bpchar and
* varchar
* ----------------------------------------------------------------
*/
void
setAtttypmodForCreateTable(TupleDesc tupType, List *targetList,
List *rangeTable)
{
List *tl;
TargetEntry *tle;
Node *expr;
int varno;
tl = targetList;
for (varno = 0; varno < tupType->natts; varno++)
{
tle = lfirst(tl);
if (USE_ATTTYPMOD(tupType->attrs[varno]->atttypid))
{
expr = tle->expr;
if (expr && IsA(expr, Var))
{
Var *var;
RangeTblEntry *rtentry;
var = (Var *) expr;
rtentry = rt_fetch(var->varnoold, rangeTable);
tupType->attrs[varno]->atttypmod =
get_atttypmod(rtentry->relid, var->varoattno);
}
else
elog(ERROR, "setAtttypmodForCreateTable: can't get atttypmod for field (for length, etc.)");
}
tl = lnext(tl);
}
}