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:
@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.40 1998/01/19 02:37:32 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.41 1998/02/10 04:00:45 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -563,8 +563,6 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
*/
|
||||
tupdesc = CreateTupleDescCopy(tupType);
|
||||
|
||||
setAtttypmodForCreateTable(tupdesc, targetList, rangeTable);
|
||||
|
||||
intoRelationId = heap_create_with_catalog(intoName, tupdesc);
|
||||
|
||||
FreeTupleDesc(tupdesc);
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.15 1998/01/07 21:02:48 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.16 1998/02/10 04:00:50 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -986,7 +986,8 @@ ExecTypeFromTL(List *targetList)
|
||||
resdom->resno,
|
||||
resdom->resname,
|
||||
/* fix for SELECT NULL ... */
|
||||
typeidTypeName(restype ? restype : UNKNOWNOID),
|
||||
(restype ? restype : UNKNOWNOID),
|
||||
resdom->restypmod,
|
||||
0,
|
||||
false);
|
||||
|
||||
@ -1019,7 +1020,8 @@ ExecTypeFromTL(List *targetList)
|
||||
TupleDescInitEntry(typeInfo,
|
||||
fjRes->resno,
|
||||
fjRes->resname,
|
||||
typeidTypeName(restype),
|
||||
restype,
|
||||
fjRes->restypmod,
|
||||
0,
|
||||
false);
|
||||
/*
|
||||
@ -1042,7 +1044,8 @@ ExecTypeFromTL(List *targetList)
|
||||
TupleDescInitEntry(typeInfo,
|
||||
fjRes->resno,
|
||||
fjRes->resname,
|
||||
typeidTypeName(restype),
|
||||
restype,
|
||||
fjRes->restypmod,
|
||||
0,
|
||||
false);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
* columns. (ie. tuples from the same group are consecutive)
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.14 1998/01/31 04:38:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.15 1998/02/10 04:00:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -417,9 +417,11 @@ sameGroup(TupleTableSlot *oldslot,
|
||||
continue;
|
||||
|
||||
val1 = fmgr(typoutput, attr1,
|
||||
gettypelem(tupdesc->attrs[att - 1]->atttypid));
|
||||
gettypelem(tupdesc->attrs[att - 1]->atttypid),
|
||||
(int)tupdesc->attrs[att - 1]->atttypmod);
|
||||
val2 = fmgr(typoutput, attr2,
|
||||
gettypelem(tupdesc->attrs[att - 1]->atttypid));
|
||||
gettypelem(tupdesc->attrs[att - 1]->atttypid),
|
||||
(int)tupdesc->attrs[att - 1]->atttypmod);
|
||||
|
||||
/*
|
||||
* now, val1 and val2 are ascii representations so we can use
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.12 1998/01/31 04:38:31 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.13 1998/02/10 04:00:55 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -196,8 +196,12 @@ ExecUnique(Unique *node)
|
||||
{
|
||||
if (isNull1) /* both are null, they are equal */
|
||||
continue;
|
||||
val1 = fmgr(typoutput, attr1, gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid));
|
||||
val2 = fmgr(typoutput, attr2, gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid));
|
||||
val1 = fmgr(typoutput, attr1,
|
||||
gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
|
||||
(int)tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
|
||||
val2 = fmgr(typoutput, attr2,
|
||||
gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
|
||||
(int)tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
|
||||
|
||||
/*
|
||||
* now, val1 and val2 are ascii representations so we can
|
||||
|
@ -430,7 +430,9 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
return (fmgr(foutoid, val, gettypelem(tupdesc->attrs[fnumber - 1]->atttypid)));
|
||||
return (fmgr(foutoid, val,
|
||||
gettypelem(tupdesc->attrs[fnumber - 1]->atttypid),
|
||||
(int)tupdesc->attrs[fnumber - 1]->atttypmod));
|
||||
}
|
||||
|
||||
Datum
|
||||
|
Reference in New Issue
Block a user