Commit c65ea0e0 authored by Bruce Momjian's avatar Bruce Momjian

New pg_attribute.atttypmod for type-specific information like

varchar length.

Cleans up code so attlen is always length.

Removed varchar() hack added earlier.

Will fix bug in selecting varchar() fields, and varchar() can be
variable length.
parent d7427e48
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.31 1998/01/07 21:00:45 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.32 1998/01/16 23:19:16 momjian Exp $
* *
* NOTES * NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be * some of the executor utility code such as "ExecTypeFromTL" should be
...@@ -301,11 +301,12 @@ TupleDescInitEntry(TupleDesc desc, ...@@ -301,11 +301,12 @@ TupleDescInitEntry(TupleDesc desc,
att->attdisbursion = 0; /* dummy value */ att->attdisbursion = 0; /* dummy value */
att->attcacheoff = -1; att->attcacheoff = -1;
att->atttypmod = 0;
att->attnum = attributeNumber; att->attnum = attributeNumber;
att->attnelems = attdim; att->attnelems = attdim;
att->attisset = attisset; att->attisset = attisset;
att->attnotnull = false; att->attnotnull = false;
att->atthasdef = false; att->atthasdef = false;
...@@ -512,17 +513,7 @@ BuildDescForRelation(List *schema, char *relname) ...@@ -512,17 +513,7 @@ BuildDescForRelation(List *schema, char *relname)
typename); typename);
} }
/* desc->attrs[attnum - 1]->atttypmod = entry->typename->typmod;
* this is for char() and varchar(). When an entry is of type
* char() or varchar(), typlen is set to the appropriate length,
* which we'll use here instead. (The catalog lookup only returns
* the length of bpchar and varchar which is not what we want!) -
* ay 6/95
*/
if (entry->typename->typlen > 0)
{
desc->attrs[attnum - 1]->attlen = entry->typename->typlen;
}
/* This is for constraints */ /* This is for constraints */
if (entry->is_not_null) if (entry->is_not_null)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.12 1998/01/06 19:42:26 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.13 1998/01/16 23:19:23 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -190,16 +190,9 @@ fillatt(TupleDesc tupleDesc) ...@@ -190,16 +190,9 @@ fillatt(TupleDesc tupleDesc)
* and byval, since those were already set in * and byval, since those were already set in
* TupleDescInitEntry. In fact, this seems redundant here, * TupleDescInitEntry. In fact, this seems redundant here,
* but who knows what I'll break if I take it out... * but who knows what I'll break if I take it out...
*
* same for char() and varchar() stuff. I share the same
* sentiments. This function is poorly written anyway. -ay
* 6/95
*/ */
if (!(*attributeP)->attisset && if (!(*attributeP)->attisset)
(*attributeP)->atttypid != BPCHAROID &&
(*attributeP)->atttypid != VARCHAROID)
{ {
typp = (TypeTupleForm) GETSTRUCT(tuple); /* XXX */ typp = (TypeTupleForm) GETSTRUCT(tuple); /* XXX */
(*attributeP)->attlen = typp->typlen; (*attributeP)->attlen = typp->typlen;
(*attributeP)->attbyval = typp->typbyval; (*attributeP)->attbyval = typp->typbyval;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.35 1998/01/15 19:42:27 pgsql Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.36 1998/01/16 23:19:27 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -107,6 +107,7 @@ DefaultBuild(Relation heapRelation, Relation indexRelation, ...@@ -107,6 +107,7 @@ DefaultBuild(Relation heapRelation, Relation indexRelation,
* AttrNumber attnum; * AttrNumber attnum;
* uint32 attnelems; * uint32 attnelems;
* int32 attcacheoff; * int32 attcacheoff;
* int16 atttypmod;
* bool attbyval; * bool attbyval;
* bool attisset; * bool attisset;
* char attalign; * char attalign;
...@@ -117,12 +118,12 @@ DefaultBuild(Relation heapRelation, Relation indexRelation, ...@@ -117,12 +118,12 @@ DefaultBuild(Relation heapRelation, Relation indexRelation,
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
static FormData_pg_attribute sysatts[] = { static FormData_pg_attribute sysatts[] = {
{0l, {"ctid"}, 27l, 0l, 6, -1, 0, -1, '\0', '\0', 'i', '\0', '\0'}, {0l, {"ctid"}, 27l, 0l, 6, -1, 0, -1, 0, '\0', '\0', 'i', '\0', '\0'},
{0l, {"oid"}, 26l, 0l, 4, -2, 0, -1, '\001', '\0', 'i', '\0', '\0'}, {0l, {"oid"}, 26l, 0l, 4, -2, 0, -1, 0, '\001', '\0', 'i', '\0', '\0'},
{0l, {"xmin"}, 28l, 0l, 4, -3, 0, -1, '\0', '\0', 'i', '\0', '\0'}, {0l, {"xmin"}, 28l, 0l, 4, -3, 0, -1, 0, '\0', '\0', 'i', '\0', '\0'},
{0l, {"cmin"}, 29l, 0l, 4, -4, 0, -1, '\001', '\0', 'i', '\0', '\0'}, {0l, {"cmin"}, 29l, 0l, 4, -4, 0, -1, 0, '\001', '\0', 'i', '\0', '\0'},
{0l, {"xmax"}, 28l, 0l, 4, -5, 0, -1, '\0', '\0', 'i', '\0', '\0'}, {0l, {"xmax"}, 28l, 0l, 4, -5, 0, -1, 0, '\0', '\0', 'i', '\0', '\0'},
{0l, {"cmax"}, 29l, 0l, 4, -6, 0, -1, '\001', '\0', 'i', '\0', '\0'}, {0l, {"cmax"}, 29l, 0l, 4, -6, 0, -1, 0, '\001', '\0', 'i', '\0', '\0'},
}; };
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
...@@ -436,6 +437,7 @@ ConstructTupleDescriptor(Oid heapoid, ...@@ -436,6 +437,7 @@ ConstructTupleDescriptor(Oid heapoid,
((AttributeTupleForm) to)->attnotnull = false; ((AttributeTupleForm) to)->attnotnull = false;
((AttributeTupleForm) to)->atthasdef = false; ((AttributeTupleForm) to)->atthasdef = false;
((AttributeTupleForm) to)->atttypmod = 0;
/* /*
* if the keytype is defined, we need to change the tuple form's * if the keytype is defined, we need to change the tuple form's
...@@ -454,11 +456,11 @@ ConstructTupleDescriptor(Oid heapoid, ...@@ -454,11 +456,11 @@ ConstructTupleDescriptor(Oid heapoid,
((AttributeTupleForm) to)->atttypid = tup->t_oid; ((AttributeTupleForm) to)->atttypid = tup->t_oid;
((AttributeTupleForm) to)->attbyval = ((AttributeTupleForm) to)->attbyval =
((TypeTupleForm) ((char *) tup + tup->t_hoff))->typbyval; ((TypeTupleForm) ((char *) tup + tup->t_hoff))->typbyval;
if (IndexKeyType->typlen > 0)
((AttributeTupleForm) to)->attlen = IndexKeyType->typlen; ((AttributeTupleForm) to)->attlen =
else
((AttributeTupleForm) to)->attlen =
((TypeTupleForm) ((char *) tup + tup->t_hoff))->typlen; ((TypeTupleForm) ((char *) tup + tup->t_hoff))->typlen;
((AttributeTupleForm) to)->atttypmod = IndexKeyType->typmod;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.23 1998/01/05 16:38:44 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.24 1998/01/16 23:19:33 momjian Exp $
* *
* NOTES * NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated * The PortalExecutorHeapMemory crap needs to be eliminated
...@@ -482,11 +482,8 @@ PerformAddAttribute(char *relationName, ...@@ -482,11 +482,8 @@ PerformAddAttribute(char *relationName,
} }
namestrcpy(&(attribute->attname), (char *) key[1].sk_argument); namestrcpy(&(attribute->attname), (char *) key[1].sk_argument);
attribute->atttypid = typeTuple->t_oid; attribute->atttypid = typeTuple->t_oid;
if (colDef->typename->typlen > 0) attribute->attlen = form->typlen;
attribute->attlen = colDef->typename->typlen; attribute->atttypmod = colDef->typename->typmod;
else
/* bpchar, varchar, text */
attribute->attlen = form->typlen;
attribute->attnum = i; attribute->attnum = i;
attribute->attbyval = form->typbyval; attribute->attbyval = form->typbyval;
attribute->attnelems = attnelems; attribute->attnelems = attnelems;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.38 1998/01/15 19:42:36 pgsql Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.39 1998/01/16 23:19:40 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -574,7 +574,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim) ...@@ -574,7 +574,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
values[i] = values[i] =
(Datum) (*fmgr_faddr(&in_functions[i])) (string, (Datum) (*fmgr_faddr(&in_functions[i])) (string,
elements[i], elements[i],
attr[i]->attlen); attr[i]->atttypmod);
/* /*
* Sanity check - by reference attributes cannot * Sanity check - by reference attributes cannot
......
...@@ -98,6 +98,7 @@ DefineSequence(CreateSeqStmt *seq) ...@@ -98,6 +98,7 @@ DefineSequence(CreateSeqStmt *seq)
typnam = makeNode(TypeName); typnam = makeNode(TypeName);
typnam->setof = FALSE; typnam->setof = FALSE;
typnam->arrayBounds = NULL; typnam->arrayBounds = NULL;
typnam->typmod = 0;
coldef = makeNode(ColumnDef); coldef = makeNode(ColumnDef);
coldef->typename = typnam; coldef->typename = typnam;
coldef->defval = NULL; coldef->defval = NULL;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.15 1998/01/16 05:03:45 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.16 1998/01/16 23:19:47 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -42,7 +42,6 @@ ...@@ -42,7 +42,6 @@
#include "access/genam.h" #include "access/genam.h"
#include "access/heapam.h" #include "access/heapam.h"
#include "catalog/heap.h" #include "catalog/heap.h"
#include "catalog/pg_type.h"
static Pointer static Pointer
ExecBeginScan(Relation relation, int nkeys, ScanKey skeys, ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
...@@ -125,31 +124,6 @@ ExecOpenR(Oid relationOid, bool isindex) ...@@ -125,31 +124,6 @@ ExecOpenR(Oid relationOid, bool isindex)
if (relation == NULL) if (relation == NULL)
elog(DEBUG, "ExecOpenR: relation == NULL, heap_open failed."); elog(DEBUG, "ExecOpenR: relation == NULL, heap_open failed.");
{
int i;
Relation trel = palloc(sizeof(RelationData));
TupleDesc tdesc = palloc(sizeof(struct tupleDesc));
AttributeTupleForm *tatt =
palloc(sizeof(AttributeTupleForm*)*relation->rd_att->natts);
memcpy(trel, relation, sizeof(RelationData));
memcpy(tdesc, relation->rd_att, sizeof(struct tupleDesc));
trel->rd_att = tdesc;
tdesc->attrs = tatt;
for (i = 0; i < relation->rd_att->natts; i++)
{
if (relation->rd_att->attrs[i]->atttypid != VARCHAROID)
tdesc->attrs[i] = relation->rd_att->attrs[i];
else
{
tdesc->attrs[i] = palloc(sizeof(FormData_pg_attribute));
memcpy(tdesc->attrs[i], relation->rd_att->attrs[i],
sizeof(FormData_pg_attribute));
tdesc->attrs[i]->attlen = -1;
}
}
}
return relation; return relation;
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.38 1998/01/14 15:48:09 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.39 1998/01/16 23:19:49 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -563,13 +563,8 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate) ...@@ -563,13 +563,8 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
*/ */
tupdesc = CreateTupleDescCopy(tupType); tupdesc = CreateTupleDescCopy(tupType);
/* fixup to prevent zero-length columns in create */
setVarAttrLenForCreateTable(tupdesc, targetList, rangeTable);
intoRelationId = heap_create_with_catalog(intoName, tupdesc); intoRelationId = heap_create_with_catalog(intoName, tupdesc);
#ifdef NOT_USED /* it's copy ... */
resetVarAttrLenForCreateTable(tupdesc);
#endif
FreeTupleDesc(tupdesc); FreeTupleDesc(tupdesc);
/* ---------------- /* ----------------
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.23 1998/01/07 21:02:50 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.24 1998/01/16 23:19:52 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1177,76 +1177,3 @@ ExecInsertIndexTuples(TupleTableSlot *slot, ...@@ -1177,76 +1177,3 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
if (econtext != NULL) if (econtext != NULL)
pfree(econtext); pfree(econtext);
} }
/* ----------------------------------------------------------------
* setVarAttrLenForCreateTable -
* called when we do a SELECT * INTO TABLE tab
* needed for attributes that have a defined length, like bpchar and
* varchar
* ----------------------------------------------------------------
*/
void
setVarAttrLenForCreateTable(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 (tupType->attrs[varno]->atttypid == BPCHAROID ||
tupType->attrs[varno]->atttypid == VARCHAROID)
{
expr = tle->expr;
if (expr && IsA(expr, Var))
{
Var *var;
RangeTblEntry *rtentry;
Relation rd;
var = (Var *) expr;
rtentry = rt_fetch(var->varnoold, rangeTable);
rd = heap_open(rtentry->relid);
/* set length to that defined in relation */
tupType->attrs[varno]->attlen =
(*rd->rd_att->attrs[var->varoattno - 1]).attlen;
heap_close(rd);
}
else
elog(ERROR, "setVarAttrLenForCreateTable: can't get length for variable-length field");
}
tl = lnext(tl);
}
}
#ifdef NOT_USED /* look at execMain.c */
/* ----------------------------------------------------------------
* resetVarAttrLenForCreateTable -
* called when we do a SELECT * INTO TABLE tab
* needed for attributes that have a defined length, like bpchar and
* varchar
* resets length to -1 for those types
* ----------------------------------------------------------------
*/
void
resetVarAttrLenForCreateTable(TupleDesc tupType)
{
int varno;
for (varno = 0; varno < tupType->natts; varno++)
{
if (tupType->attrs[varno]->atttypid == BPCHAROID ||
tupType->attrs[varno]->atttypid == VARCHAROID)
/* set length to original -1 */
tupType->attrs[varno]->attlen = -1;
}
}
#endif
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.30 1998/01/15 18:59:20 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.31 1998/01/16 23:19:56 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1480,8 +1480,8 @@ _copyTypeName(TypeName *from) ...@@ -1480,8 +1480,8 @@ _copyTypeName(TypeName *from)
newnode->name = pstrdup(from->name); newnode->name = pstrdup(from->name);
newnode->timezone = from->timezone; newnode->timezone = from->timezone;
newnode->setof = from->setof; newnode->setof = from->setof;
newnode->typmod = from->typmod;
Node_Copy(from, newnode, arrayBounds); Node_Copy(from, newnode, arrayBounds);
newnode->typlen = from->typlen;
return newnode; return newnode;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.21 1998/01/15 18:59:26 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.22 1998/01/16 23:19:59 momjian Exp $
* *
* NOTES * NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which * Every (plan) node in POSTGRES has an associated "out" routine which
...@@ -137,11 +137,11 @@ _outTypeName(StringInfo str, TypeName *node) ...@@ -137,11 +137,11 @@ _outTypeName(StringInfo str, TypeName *node)
appendStringInfo(str, (node->timezone ? "true" : "false")); appendStringInfo(str, (node->timezone ? "true" : "false"));
appendStringInfo(str, " :setof "); appendStringInfo(str, " :setof ");
appendStringInfo(str, (node->setof ? "true" : "false")); appendStringInfo(str, (node->setof ? "true" : "false"));
appendStringInfo(str, " :typmod ");
sprintf(buf," %d ", node->typmod);
appendStringInfo(str, buf);
appendStringInfo(str, " :arrayBounds "); appendStringInfo(str, " :arrayBounds ");
_outNode(str, node->arrayBounds); _outNode(str, node->arrayBounds);
appendStringInfo(str, " :typlen ");
sprintf(buf," %d ", node->typlen);
appendStringInfo(str, buf);
} }
static void static void
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.6 1997/11/25 22:00:06 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.7 1998/01/16 23:20:09 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -278,13 +278,9 @@ new_relation_targetlist(Oid relid, Index rt_index, NodeTag node_type) ...@@ -278,13 +278,9 @@ new_relation_targetlist(Oid relid, Index rt_index, NodeTag node_type)
*/ */
attisset = get_attisset( /* type_id, */ relid, attname); attisset = get_attisset( /* type_id, */ relid, attname);
if (attisset) if (attisset)
{
typlen = typeLen(typeidType(OIDOID)); typlen = typeLen(typeidType(OIDOID));
}
else else
{
typlen = get_typlen(atttype); typlen = get_typlen(atttype);
}
switch (node_type) switch (node_type)
{ {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.90 1998/01/11 20:01:59 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.91 1998/01/16 23:20:14 momjian Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -2754,7 +2754,7 @@ Character: character '(' Iconst ')' ...@@ -2754,7 +2754,7 @@ Character: character '(' Iconst ')'
* between this and "text" is that we blank-pad and * between this and "text" is that we blank-pad and
* truncate where necessary * truncate where necessary
*/ */
$$->typlen = VARHDRSZ + $3; $$->typmod = VARHDRSZ + $3;
} }
| character | character
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.6 1998/01/05 03:32:27 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.7 1998/01/16 23:20:18 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "parser/parse_target.h" #include "parser/parse_target.h"
#include "utils/builtins.h" #include "utils/builtins.h"
static Node *parser_typecast(Value *expr, TypeName *typename, int typlen); static Node *parser_typecast(Value *expr, TypeName *typename, int atttypmod);
/* /*
* transformExpr - * transformExpr -
...@@ -403,7 +403,7 @@ handleNestedDots(ParseState *pstate, Attr *attr, int *curr_resno, int precedence ...@@ -403,7 +403,7 @@ handleNestedDots(ParseState *pstate, Attr *attr, int *curr_resno, int precedence
} }
static Node * static Node *
parser_typecast(Value *expr, TypeName *typename, int typlen) parser_typecast(Value *expr, TypeName *typename, int atttypmod)
{ {
/* check for passing non-ints */ /* check for passing non-ints */
Const *adt; Const *adt;
...@@ -492,7 +492,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen) ...@@ -492,7 +492,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen)
} }
#endif #endif
cp = stringTypeString(tp, const_string, typlen); cp = stringTypeString(tp, const_string, atttypmod);
if (!typeByVal(tp)) if (!typeByVal(tp))
{ {
...@@ -540,7 +540,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen) ...@@ -540,7 +540,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen)
} }
Node * Node *
parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen) parser_typecast2(Node *expr, Oid exprType, Type tp, int atttypmod)
{ {
/* check for passing non-ints */ /* check for passing non-ints */
Const *adt; Const *adt;
...@@ -627,8 +627,7 @@ parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen) ...@@ -627,8 +627,7 @@ parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen)
return ((Node *) adt); return ((Node *) adt);
} }
cp = stringTypeString(tp, const_string, typlen); cp = stringTypeString(tp, const_string, atttypmod);
if (!typeByVal(tp)) if (!typeByVal(tp))
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.6 1998/01/15 20:54:28 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.7 1998/01/16 23:20:20 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -401,9 +401,9 @@ unary_oper_get_candidates(char *op, ...@@ -401,9 +401,9 @@ unary_oper_get_candidates(char *op,
*candidates = NULL; *candidates = NULL;
fmgr_info(NameEqualRegProcedure, (func_ptr *) &opKey[0].sk_func); fmgr_info(NameEqualRegProcedure, (FmgrInfo *) &opKey[0].sk_func);
opKey[0].sk_argument = NameGetDatum(op); opKey[0].sk_argument = NameGetDatum(op);
fmgr_info(CharacterEqualRegProcedure, (func_ptr *) &opKey[1].sk_func); fmgr_info(CharacterEqualRegProcedure, (FmgrInfo *) &opKey[1].sk_func);
opKey[1].sk_argument = CharGetDatum(rightleft); opKey[1].sk_argument = CharGetDatum(rightleft);
/* currently, only "unknown" can be coerced */ /* currently, only "unknown" can be coerced */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.5 1998/01/05 03:32:30 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.6 1998/01/16 23:20:21 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -430,10 +430,15 @@ checkTargetTypes(ParseState *pstate, char *target_colname, ...@@ -430,10 +430,15 @@ checkTargetTypes(ParseState *pstate, char *target_colname,
elog(ERROR, "Type of %s does not match target column %s", elog(ERROR, "Type of %s does not match target column %s",
colname, target_colname); colname, target_colname);
if ((attrtype_id == BPCHAROID || attrtype_id == VARCHAROID) && if (attrtype_id == BPCHAROID &&
rd->rd_att->attrs[resdomno_id - 1]->attlen != rd->rd_att->attrs[resdomno_id - 1]->atttypmod !=
pstate->p_target_relation->rd_att->attrs[resdomno_target - 1]->attlen) pstate->p_target_relation->rd_att->attrs[resdomno_target - 1]->atttypmod)
elog(ERROR, "Length of %s does not match length of target column %s", elog(ERROR, "Length of %s is longer than length of target column %s",
colname, target_colname);
if (attrtype_id == VARCHAROID &&
rd->rd_att->attrs[resdomno_id - 1]->atttypmod >
pstate->p_target_relation->rd_att->attrs[resdomno_target - 1]->atttypmod)
elog(ERROR, "Length of %s is longer than length of target column %s",
colname, target_colname); colname, target_colname);
heap_close(rd); heap_close(rd);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.5 1998/01/05 03:32:31 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.6 1998/01/16 23:20:22 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -326,7 +326,8 @@ make_targetlist_expr(ParseState *pstate, ...@@ -326,7 +326,8 @@ make_targetlist_expr(ParseState *pstate,
Oid type_id, Oid type_id,
attrtype; attrtype;
int type_len, int type_len,
attrlen; attrlen,
attrtypmod;
int resdomno; int resdomno;
Relation rd; Relation rd;
bool attrisset; bool attrisset;
...@@ -360,14 +361,8 @@ make_targetlist_expr(ParseState *pstate, ...@@ -360,14 +361,8 @@ make_targetlist_expr(ParseState *pstate,
attrtype = attnumTypeId(rd, resdomno); attrtype = attnumTypeId(rd, resdomno);
if ((arrayRef != NIL) && (lfirst(arrayRef) == NIL)) if ((arrayRef != NIL) && (lfirst(arrayRef) == NIL))
attrtype = GetArrayElementType(attrtype); attrtype = GetArrayElementType(attrtype);
if (attrtype == BPCHAROID || attrtype == VARCHAROID) attrlen = typeLen(typeidType(attrtype));
{ attrtypmod = rd->rd_att->attrs[resdomno - 1]->atttypmod;
attrlen = rd->rd_att->attrs[resdomno - 1]->attlen;
}
else
{
attrlen = typeLen(typeidType(attrtype));
}
#if 0 #if 0
if (Input_is_string && Typecast_ok) if (Input_is_string && Typecast_ok)
{ {
...@@ -438,13 +433,13 @@ make_targetlist_expr(ParseState *pstate, ...@@ -438,13 +433,13 @@ make_targetlist_expr(ParseState *pstate,
expr = (Node *) parser_typecast2(expr, expr = (Node *) parser_typecast2(expr,
type_id, type_id,
typeidType(typelem), typeidType(typelem),
attrlen); attrtypmod);
} }
else else
expr = (Node *) parser_typecast2(expr, expr = (Node *) parser_typecast2(expr,
type_id, type_id,
typeidType(attrtype), typeidType(attrtype),
attrlen); attrtypmod);
} }
else else
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.3 1998/01/05 03:32:33 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.4 1998/01/16 23:20:23 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -136,15 +136,14 @@ typeTypeFlag(Type t) ...@@ -136,15 +136,14 @@ typeTypeFlag(Type t)
/* Given a type structure and a string, returns the internal form of /* Given a type structure and a string, returns the internal form of
that string */ that string */
char * char *
stringTypeString(Type tp, char *string, int typlen) stringTypeString(Type tp, char *string, int atttypmod)
{ {
Oid op; Oid op;
Oid typelem; Oid typelem;
op = ((TypeTupleForm) GETSTRUCT(tp))->typinput; op = ((TypeTupleForm) GETSTRUCT(tp))->typinput;
typelem = ((TypeTupleForm) GETSTRUCT(tp))->typelem; /* XXX - used for array_in */ typelem = ((TypeTupleForm) GETSTRUCT(tp))->typelem; /* XXX - used for array_in */
/* typlen is for bpcharin() and varcharin() */ return ((char *) fmgr(op, string, typelem, atttypmod));
return ((char *) fmgr(op, string, typelem, typlen));
} }
/* Given a type id, returns the out-conversion function of the type */ /* Given a type id, returns the out-conversion function of the type */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.23 1998/01/08 06:18:18 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.24 1998/01/16 23:20:34 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
* because we pass typelem as the second argument for array_in.) * because we pass typelem as the second argument for array_in.)
*/ */
char * char *
bpcharin(char *s, int dummy, int typlen) bpcharin(char *s, int dummy, int atttypmod)
{ {
char *result, char *result,
*r; *r;
...@@ -60,23 +60,23 @@ bpcharin(char *s, int dummy, int typlen) ...@@ -60,23 +60,23 @@ bpcharin(char *s, int dummy, int typlen)
if (s == NULL) if (s == NULL)
return ((char *) NULL); return ((char *) NULL);
if (typlen == -1) if (atttypmod == -1)
{ {
/* /*
* this is here because some functions can't supply the typlen * this is here because some functions can't supply the atttypmod
*/ */
len = strlen(s); len = strlen(s);
typlen = len + VARHDRSZ; atttypmod = len + VARHDRSZ;
} }
else else
len = typlen - VARHDRSZ; len = atttypmod - VARHDRSZ;
if (len > 4096) if (len > 4096)
elog(ERROR, "bpcharin: length of char() must be less than 4096"); elog(ERROR, "bpcharin: length of char() must be less than 4096");
result = (char *) palloc(typlen); result = (char *) palloc(atttypmod);
VARSIZE(result) = typlen; VARSIZE(result) = atttypmod;
r = VARDATA(result); r = VARDATA(result);
for (i = 0; i < len; i++, r++, s++) for (i = 0; i < len; i++, r++, s++)
{ {
...@@ -124,7 +124,7 @@ bpcharout(char *s) ...@@ -124,7 +124,7 @@ bpcharout(char *s)
* because we pass typelem as the second argument for array_in.) * because we pass typelem as the second argument for array_in.)
*/ */
char * char *
varcharin(char *s, int dummy, int typlen) varcharin(char *s, int dummy, int atttypmod)
{ {
char *result; char *result;
int len; int len;
...@@ -133,8 +133,8 @@ varcharin(char *s, int dummy, int typlen) ...@@ -133,8 +133,8 @@ varcharin(char *s, int dummy, int typlen)
return ((char *) NULL); return ((char *) NULL);
len = strlen(s) + VARHDRSZ; len = strlen(s) + VARHDRSZ;
if (typlen != -1 && len > typlen) if (atttypmod != -1 && len > atttypmod)
len = typlen; /* clip the string at max length */ len = atttypmod; /* clip the string at max length */
if (len > 4096) if (len > 4096)
elog(ERROR, "varcharin: length of char() must be less than 4096"); elog(ERROR, "varcharin: length of char() must be less than 4096");
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.59 1997/12/26 08:45:27 vadim Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.60 1998/01/16 23:20:39 momjian Exp $
* *
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* *
...@@ -924,8 +924,8 @@ clearTableInfo(TableInfo *tblinfo, int numTables) ...@@ -924,8 +924,8 @@ clearTableInfo(TableInfo *tblinfo, int numTables)
if (tblinfo[i].typnames[j]) if (tblinfo[i].typnames[j])
free(tblinfo[i].typnames[j]); free(tblinfo[i].typnames[j]);
} }
if (tblinfo[i].attlen) if (tblinfo[i].atttypmod)
free((int *) tblinfo[i].attlen); free((int *) tblinfo[i].atttypmod);
if (tblinfo[i].inhAttrs) if (tblinfo[i].inhAttrs)
free((int *) tblinfo[i].inhAttrs); free((int *) tblinfo[i].inhAttrs);
if (tblinfo[i].attnames) if (tblinfo[i].attnames)
...@@ -1613,7 +1613,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) ...@@ -1613,7 +1613,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
char q[MAXQUERYLEN]; char q[MAXQUERYLEN];
int i_attname; int i_attname;
int i_typname; int i_typname;
int i_attlen; int i_atttypmod;
int i_attnotnull; int i_attnotnull;
int i_atthasdef; int i_atthasdef;
PGresult *res; PGresult *res;
...@@ -1638,7 +1638,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) ...@@ -1638,7 +1638,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
tblinfo[i].relname, tblinfo[i].relname,
g_comment_end); g_comment_end);
sprintf(q, "SELECT a.attnum, a.attname, t.typname, a.attlen, " sprintf(q, "SELECT a.attnum, a.attname, t.typname, a.atttypmod, "
"a.attnotnull, a.atthasdef " "a.attnotnull, a.atthasdef "
"from pg_attribute a, pg_type t " "from pg_attribute a, pg_type t "
"where a.attrelid = '%s'::oid and a.atttypid = t.oid " "where a.attrelid = '%s'::oid and a.atttypid = t.oid "
...@@ -1656,14 +1656,14 @@ getTableAttrs(TableInfo *tblinfo, int numTables) ...@@ -1656,14 +1656,14 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
i_attname = PQfnumber(res, "attname"); i_attname = PQfnumber(res, "attname");
i_typname = PQfnumber(res, "typname"); i_typname = PQfnumber(res, "typname");
i_attlen = PQfnumber(res, "attlen"); i_atttypmod = PQfnumber(res, "atttypmod");
i_attnotnull = PQfnumber(res, "attnotnull"); i_attnotnull = PQfnumber(res, "attnotnull");
i_atthasdef = PQfnumber(res, "atthasdef"); i_atthasdef = PQfnumber(res, "atthasdef");
tblinfo[i].numatts = ntups; tblinfo[i].numatts = ntups;
tblinfo[i].attnames = (char **) malloc(ntups * sizeof(char *)); tblinfo[i].attnames = (char **) malloc(ntups * sizeof(char *));
tblinfo[i].typnames = (char **) malloc(ntups * sizeof(char *)); tblinfo[i].typnames = (char **) malloc(ntups * sizeof(char *));
tblinfo[i].attlen = (int *) malloc(ntups * sizeof(int)); tblinfo[i].atttypmod = (int *) malloc(ntups * sizeof(int));
tblinfo[i].inhAttrs = (int *) malloc(ntups * sizeof(int)); tblinfo[i].inhAttrs = (int *) malloc(ntups * sizeof(int));
tblinfo[i].notnull = (bool *) malloc(ntups * sizeof(bool)); tblinfo[i].notnull = (bool *) malloc(ntups * sizeof(bool));
tblinfo[i].adef_expr = (char **) malloc(ntups * sizeof(char *)); tblinfo[i].adef_expr = (char **) malloc(ntups * sizeof(char *));
...@@ -1673,9 +1673,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables) ...@@ -1673,9 +1673,7 @@ getTableAttrs(TableInfo *tblinfo, int numTables)
{ {
tblinfo[i].attnames[j] = strdup(PQgetvalue(res, j, i_attname)); tblinfo[i].attnames[j] = strdup(PQgetvalue(res, j, i_attname));
tblinfo[i].typnames[j] = strdup(PQgetvalue(res, j, i_typname)); tblinfo[i].typnames[j] = strdup(PQgetvalue(res, j, i_typname));
tblinfo[i].attlen[j] = atoi(PQgetvalue(res, j, i_attlen)); tblinfo[i].atttypmod[j] = atoi(PQgetvalue(res, j, i_atttypmod));
if (tblinfo[i].attlen[j] > 0)
tblinfo[i].attlen[j] = tblinfo[i].attlen[j] - VARHDRSZ;
tblinfo[i].inhAttrs[j] = 0; /* this flag is set in tblinfo[i].inhAttrs[j] = 0; /* this flag is set in
* flagInhAttrs() */ * flagInhAttrs() */
tblinfo[i].notnull[j] = (PQgetvalue(res, j, i_attnotnull)[0] == 't') ? true : false; tblinfo[i].notnull[j] = (PQgetvalue(res, j, i_attnotnull)[0] == 't') ? true : false;
...@@ -2321,11 +2319,9 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables, ...@@ -2321,11 +2319,9 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
(actual_atts > 0) ? ", " : "", (actual_atts > 0) ? ", " : "",
fmtId(tblinfo[i].attnames[j])); fmtId(tblinfo[i].attnames[j]));
/* stored length can be -1 (variable) */ sprintf(q, "%s(%d)",
if (tblinfo[i].attlen[j] > 0) q,
sprintf(q, "%s(%d)", tblinfo[i].atttypmod[j]-VARHDRSZ);
q,
tblinfo[i].attlen[j]);
actual_atts++; actual_atts++;
} }
else if (!strcmp(tblinfo[i].typnames[j], "varchar")) else if (!strcmp(tblinfo[i].typnames[j], "varchar"))
...@@ -2336,11 +2332,9 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables, ...@@ -2336,11 +2332,9 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables,
fmtId(tblinfo[i].attnames[j]), fmtId(tblinfo[i].attnames[j]),
tblinfo[i].typnames[j]); tblinfo[i].typnames[j]);
/* stored length can be -1 (variable) */ sprintf(q, "%s(%d)",
if (tblinfo[i].attlen[j] > 0) q,
sprintf(q, "%s(%d)", tblinfo[i].atttypmod[j]-VARHDRSZ);
q,
tblinfo[i].attlen[j]);
actual_atts++; actual_atts++;
} }
else else
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_dump.h,v 1.28 1997/12/04 01:31:28 scrappy Exp $ * $Id: pg_dump.h,v 1.29 1998/01/16 23:20:43 momjian Exp $
* *
* Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2
* *
...@@ -86,7 +86,7 @@ typedef struct _tableInfo ...@@ -86,7 +86,7 @@ typedef struct _tableInfo
* needed because the SQL tables will not * needed because the SQL tables will not
* have the same order of attributes as * have the same order of attributes as
* the POSTQUEL tables */ * the POSTQUEL tables */
int *attlen; /* attribute lengths */ int *atttypmod; /* type-specific type modifier */
char *usename; char *usename;
int ncheck; /* # of CHECK expressions */ int ncheck; /* # of CHECK expressions */
char **check_expr; /* [CONSTRAINT name] CHECK expressions */ char **check_expr; /* [CONSTRAINT name] CHECK expressions */
......
This diff is collapsed.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: pg_class.h,v 1.17 1997/12/04 00:27:50 scrappy Exp $ * $Id: pg_class.h,v 1.18 1998/01/16 23:20:52 momjian Exp $
* *
* NOTES * NOTES
* ``pg_relation'' is being replaced by ``pg_class''. currently * ``pg_relation'' is being replaced by ``pg_class''. currently
...@@ -119,11 +119,11 @@ typedef FormData_pg_class *Form_pg_class; ...@@ -119,11 +119,11 @@ typedef FormData_pg_class *Form_pg_class;
DATA(insert OID = 1247 ( pg_type 71 PGUID 0 0 0 f f r 16 0 0 f _null_ )); DATA(insert OID = 1247 ( pg_type 71 PGUID 0 0 0 f f r 16 0 0 f _null_ ));
DESCR(""); DESCR("");
DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 0 0 f f r 16 0 0 f _null_ )); DATA(insert OID = 1249 ( pg_attribute 75 PGUID 0 0 0 f f r 14 0 0 f _null_ ));
DESCR(""); DESCR("");
DATA(insert OID = 1255 ( pg_proc 81 PGUID 0 0 0 f f r 16 0 0 f _null_ )); DATA(insert OID = 1255 ( pg_proc 81 PGUID 0 0 0 f f r 16 0 0 f _null_ ));
DESCR(""); DESCR("");
DATA(insert OID = 1259 ( pg_class 83 PGUID 0 0 0 f f r 18 0 0 f _null_ )); DATA(insert OID = 1259 ( pg_class 83 PGUID 0 0 0 f f r 14 0 0 f _null_ ));
DESCR(""); DESCR("");
DATA(insert OID = 1260 ( pg_user 86 PGUID 0 0 0 f t r 8 0 0 f _null_ )); DATA(insert OID = 1260 ( pg_user 86 PGUID 0 0 0 f t r 8 0 0 f _null_ ));
DESCR(""); DESCR("");
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: parsenodes.h,v 1.44 1998/01/15 19:00:11 momjian Exp $ * $Id: parsenodes.h,v 1.45 1998/01/16 23:20:55 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -642,8 +642,8 @@ typedef struct TypeName ...@@ -642,8 +642,8 @@ typedef struct TypeName
char *name; /* name of the type */ char *name; /* name of the type */
bool timezone; /* timezone specified? */ bool timezone; /* timezone specified? */
bool setof; /* is a set? */ bool setof; /* is a set? */
int2 typmod; /* type modifier */
List *arrayBounds; /* array bounds */ List *arrayBounds; /* array bounds */
int typlen; /* length for char() and varchar() */
} TypeName; } TypeName;
/* /*
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: parse_expr.h,v 1.4 1998/01/04 04:31:41 momjian Exp $ * $Id: parse_expr.h,v 1.5 1998/01/16 23:21:01 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -23,7 +23,7 @@ extern Node *transformIdent(ParseState *pstate, Node *expr, int precedence); ...@@ -23,7 +23,7 @@ extern Node *transformIdent(ParseState *pstate, Node *expr, int precedence);
extern Oid exprType(Node *expr); extern Oid exprType(Node *expr);
extern Node *handleNestedDots(ParseState *pstate, Attr *attr, extern Node *handleNestedDots(ParseState *pstate, Attr *attr,
int *curr_resno, int precedence); int *curr_resno, int precedence);
extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen); extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int attypmod);
#endif /* PARSE_EXPR_H */ #endif /* PARSE_EXPR_H */
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: parse_type.h,v 1.2 1997/11/26 01:14:14 momjian Exp $ * $Id: parse_type.h,v 1.3 1998/01/16 23:21:03 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -26,7 +26,7 @@ extern int16 typeLen(Type t); ...@@ -26,7 +26,7 @@ extern int16 typeLen(Type t);
extern bool typeByVal(Type t); extern bool typeByVal(Type t);
extern char *typeTypeName(Type t); extern char *typeTypeName(Type t);
extern char typeTypeFlag(Type t); extern char typeTypeFlag(Type t);
extern char *stringTypeString(Type tp, char *string, int typlen); extern char *stringTypeString(Type tp, char *string, int atttypmod);
extern Oid typeidRetoutfunc(Oid type_id); extern Oid typeidRetoutfunc(Oid type_id);
extern Oid typeidTypeRelid(Oid type_id); extern Oid typeidTypeRelid(Oid type_id);
extern Oid typeTypeRelid(Type typ); extern Oid typeTypeRelid(Type typ);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: builtins.h,v 1.33 1998/01/01 05:42:40 thomas Exp $ * $Id: builtins.h,v 1.34 1998/01/16 23:21:07 momjian Exp $
* *
* NOTES * NOTES
* This should normally only be included by fmgr.h. * This should normally only be included by fmgr.h.
...@@ -445,7 +445,7 @@ DateTime *timestamp_datetime(time_t timestamp); ...@@ -445,7 +445,7 @@ DateTime *timestamp_datetime(time_t timestamp);
time_t datetime_timestamp(DateTime *datetime); time_t datetime_timestamp(DateTime *datetime);
/* varchar.c */ /* varchar.c */
extern char *bpcharin(char *s, int dummy, int typlen); extern char *bpcharin(char *s, int dummy, int atttypmod);
extern char *bpcharout(char *s); extern char *bpcharout(char *s);
extern bool bpchareq(char *arg1, char *arg2); extern bool bpchareq(char *arg1, char *arg2);
extern bool bpcharne(char *arg1, char *arg2); extern bool bpcharne(char *arg1, char *arg2);
...@@ -457,7 +457,7 @@ extern int32 bpcharcmp(char *arg1, char *arg2); ...@@ -457,7 +457,7 @@ extern int32 bpcharcmp(char *arg1, char *arg2);
extern int32 bpcharlen(char *arg); extern int32 bpcharlen(char *arg);
extern uint32 hashbpchar(struct varlena * key); extern uint32 hashbpchar(struct varlena * key);
extern char *varcharin(char *s, int dummy, int typlen); extern char *varcharin(char *s, int dummy, int atttypmod);
extern char *varcharout(char *s); extern char *varcharout(char *s);
extern bool varchareq(char *arg1, char *arg2); extern bool varchareq(char *arg1, char *arg2);
extern bool varcharne(char *arg1, char *arg2); extern bool varcharne(char *arg1, char *arg2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment