aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y4
-rw-r--r--src/backend/parser/parse_expr.c13
-rw-r--r--src/backend/parser/parse_oper.c6
-rw-r--r--src/backend/parser/parse_relation.c15
-rw-r--r--src/backend/parser/parse_target.c19
-rw-r--r--src/backend/parser/parse_type.c7
6 files changed, 31 insertions, 33 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index d2ed0d2633f..77a2e0b7c29 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -10,7 +10,7 @@
*
*
* 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
* AUTHOR DATE MAJOR EVENT
@@ -2754,7 +2754,7 @@ Character: character '(' Iconst ')'
* between this and "text" is that we blank-pad and
* truncate where necessary
*/
- $$->typlen = VARHDRSZ + $3;
+ $$->typmod = VARHDRSZ + $3;
}
| character
{
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index c17c3e9d48e..00efc044dcd 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -7,7 +7,7 @@
*
*
* 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 @@
#include "parser/parse_target.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 -
@@ -403,7 +403,7 @@ handleNestedDots(ParseState *pstate, Attr *attr, int *curr_resno, int precedence
}
static Node *
-parser_typecast(Value *expr, TypeName *typename, int typlen)
+parser_typecast(Value *expr, TypeName *typename, int atttypmod)
{
/* check for passing non-ints */
Const *adt;
@@ -492,7 +492,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen)
}
#endif
- cp = stringTypeString(tp, const_string, typlen);
+ cp = stringTypeString(tp, const_string, atttypmod);
if (!typeByVal(tp))
{
@@ -540,7 +540,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen)
}
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 */
Const *adt;
@@ -627,8 +627,7 @@ parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen)
return ((Node *) adt);
}
- cp = stringTypeString(tp, const_string, typlen);
-
+ cp = stringTypeString(tp, const_string, atttypmod);
if (!typeByVal(tp))
{
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index 66961ca79ac..253fed7ced4 100644
--- a/src/backend/parser/parse_oper.c
+++ b/src/backend/parser/parse_oper.c
@@ -7,7 +7,7 @@
*
*
* 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,
*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);
- fmgr_info(CharacterEqualRegProcedure, (func_ptr *) &opKey[1].sk_func);
+ fmgr_info(CharacterEqualRegProcedure, (FmgrInfo *) &opKey[1].sk_func);
opKey[1].sk_argument = CharGetDatum(rightleft);
/* currently, only "unknown" can be coerced */
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index dc5a11a8df5..692b1eb116e 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -7,7 +7,7 @@
*
*
* 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,
elog(ERROR, "Type of %s does not match target column %s",
colname, target_colname);
- if ((attrtype_id == BPCHAROID || attrtype_id == VARCHAROID) &&
- rd->rd_att->attrs[resdomno_id - 1]->attlen !=
- pstate->p_target_relation->rd_att->attrs[resdomno_target - 1]->attlen)
- elog(ERROR, "Length of %s does not match length of target column %s",
+ if (attrtype_id == BPCHAROID &&
+ 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);
+ 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);
heap_close(rd);
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index eccdbda6b4e..895411aa1da 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -7,7 +7,7 @@
*
*
* 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,
Oid type_id,
attrtype;
int type_len,
- attrlen;
+ attrlen,
+ attrtypmod;
int resdomno;
Relation rd;
bool attrisset;
@@ -360,14 +361,8 @@ make_targetlist_expr(ParseState *pstate,
attrtype = attnumTypeId(rd, resdomno);
if ((arrayRef != NIL) && (lfirst(arrayRef) == NIL))
attrtype = GetArrayElementType(attrtype);
- if (attrtype == BPCHAROID || attrtype == VARCHAROID)
- {
- attrlen = rd->rd_att->attrs[resdomno - 1]->attlen;
- }
- else
- {
- attrlen = typeLen(typeidType(attrtype));
- }
+ attrlen = typeLen(typeidType(attrtype));
+ attrtypmod = rd->rd_att->attrs[resdomno - 1]->atttypmod;
#if 0
if (Input_is_string && Typecast_ok)
{
@@ -438,13 +433,13 @@ make_targetlist_expr(ParseState *pstate,
expr = (Node *) parser_typecast2(expr,
type_id,
typeidType(typelem),
- attrlen);
+ attrtypmod);
}
else
expr = (Node *) parser_typecast2(expr,
type_id,
typeidType(attrtype),
- attrlen);
+ attrtypmod);
}
else
{
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index ef238f9fd07..4562623808e 100644
--- a/src/backend/parser/parse_type.c
+++ b/src/backend/parser/parse_type.c
@@ -7,7 +7,7 @@
*
*
* 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)
/* Given a type structure and a string, returns the internal form of
that string */
char *
-stringTypeString(Type tp, char *string, int typlen)
+stringTypeString(Type tp, char *string, int atttypmod)
{
Oid op;
Oid typelem;
op = ((TypeTupleForm) GETSTRUCT(tp))->typinput;
typelem = ((TypeTupleForm) GETSTRUCT(tp))->typelem; /* XXX - used for array_in */
- /* typlen is for bpcharin() and varcharin() */
- return ((char *) fmgr(op, string, typelem, typlen));
+ return ((char *) fmgr(op, string, typelem, atttypmod));
}
/* Given a type id, returns the out-conversion function of the type */