]> granicus.if.org Git - postgresql/commitdiff
Pass around typmod as int16.
authorBruce Momjian <bruce@momjian.us>
Tue, 10 Feb 1998 16:04:38 +0000 (16:04 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 10 Feb 1998 16:04:38 +0000 (16:04 +0000)
27 files changed:
src/backend/access/common/printtup.c
src/backend/access/common/tupdesc.c
src/backend/commands/copy.c
src/backend/executor/nodeGroup.c
src/backend/executor/nodeUnique.c
src/backend/executor/spi.c
src/backend/libpq/be-dumpdata.c
src/backend/nodes/makefuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/readfuncs.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/parser/parse_node.c
src/backend/parser/parse_target.c
src/backend/parser/parse_type.c
src/backend/utils/adt/varchar.c
src/backend/utils/cache/lsyscache.c
src/include/access/tupdesc.h
src/include/catalog/pg_attribute.h
src/include/catalog/pg_type.h
src/include/nodes/makefuncs.h
src/include/nodes/parsenodes.h
src/include/nodes/primnodes.h
src/include/parser/parse_expr.h
src/include/parser/parse_type.h
src/include/utils/builtins.h
src/include/utils/lsyscache.h

index 8181b17401abe110c32b3efe6c3717f46c85b75e..c91768e3daf8ab5c7fcbb6e8efe3c5b503805211 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.24 1998/02/10 04:00:12 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.25 1998/02/10 16:02:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -124,7 +124,7 @@ printtup(HeapTuple tuple, TupleDesc typeinfo)
                {
                        outputstr = fmgr(typoutput, attr,
                                                         gettypelem(typeinfo->attrs[i]->atttypid),
-                                                                               (int)typeinfo->attrs[i]->atttypmod);
+                                                                               typeinfo->attrs[i]->atttypmod);
                        pq_putint(strlen(outputstr) + VARHDRSZ, VARHDRSZ);
                        pq_putnchar(outputstr, strlen(outputstr));
                        pfree(outputstr);
@@ -191,7 +191,7 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo)
                {
                        value = fmgr(typoutput, attr,
                                                 gettypelem(typeinfo->attrs[i]->atttypid),
-                                                          (int)typeinfo->attrs[i]->atttypmod);
+                                                                       typeinfo->attrs[i]->atttypmod);
                        printatt((unsigned) i + 1, typeinfo->attrs[i], value);
                        pfree(value);
                }
index 440084062b66c46a1c7bd0c689eb71ee657e18bc..be1418e701f5de0220f1a059b5e8ff7c0f08bd91 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.34 1998/02/10 04:00:14 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.35 1998/02/10 16:02:46 momjian Exp $
  *
  * NOTES
  *       some of the executor utility code such as "ExecTypeFromTL" should be
@@ -255,7 +255,7 @@ TupleDescInitEntry(TupleDesc desc,
                                   AttrNumber attributeNumber,
                                   char *attributeName,
                                   Oid typeid,
-                                  int typmod,
+                                  int16 typmod,
                                   int attdim,
                                   bool attisset)
 {
@@ -448,7 +448,7 @@ BuildDescForRelation(List *schema, char *relname)
        TupleConstr *constr = (TupleConstr *) palloc(sizeof(TupleConstr));
        char       *attname;
        char       *typename;
-       int                     atttypmod;
+       int16           atttypmod;
        int                     attdim;
        int                     ndef = 0;
        bool            attisset;
index d1dfa31dc5b44ad82928802c9b0b6149140a028e..f5b06d12de2ed91b7cb846b45011e63646e86266 100644 (file)
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.40 1998/01/31 04:38:18 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.41 1998/02/10 16:02:51 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -65,7 +65,7 @@ static void CopyAttributeOut(FILE *fp, char *string, char *delim);
 static int     CountTuples(Relation relation);
 
 extern FILE *Pfout,
-                  *Pfin;
+                       *Pfin;
 
 static int     lineno;
 
@@ -205,6 +205,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
        FmgrInfo   *out_functions;
        Oid                     out_func_oid;
        Oid                *elements;
+       int16      *typmod;
        Datum           value;
        bool            isnull;                 /* The attribute we are copying is null */
        char       *nulls;
@@ -230,11 +231,13 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
        {
                out_functions = (FmgrInfo *) palloc(attr_count * sizeof(FmgrInfo));
                elements = (Oid *) palloc(attr_count * sizeof(Oid));
+               typmod = (int16 *) palloc(attr_count * sizeof(int16));
                for (i = 0; i < attr_count; i++)
                {
                        out_func_oid = (Oid) GetOutputFunction(attr[i]->atttypid);
                        fmgr_info(out_func_oid, &out_functions[i]);
                        elements[i] = GetTypeElement(attr[i]->atttypid);
+                       typmod[i] = attr[i]->atttypmod;
                }
                nulls = NULL;                   /* meaningless, but compiler doesn't know
                                                                 * that */
@@ -242,6 +245,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
        else
        {
                elements = NULL;
+               typmod = NULL;
                out_functions = NULL;
                nulls = (char *) palloc(attr_count);
                for (i = 0; i < attr_count; i++)
@@ -271,7 +275,8 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
                        {
                                if (!isnull)
                                {
-                                       string = (char *) (*fmgr_faddr(&out_functions[i])) (value, elements[i]);
+                                       string = (char *) (*fmgr_faddr(&out_functions[i]))
+                                                       (value, elements[i], typmod[i]);
                                        CopyAttributeOut(fp, string, delim);
                                        pfree(string);
                                }
@@ -345,6 +350,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
        {
                pfree(out_functions);
                pfree(elements);
+               pfree(typmod);
        }
 
        heap_close(rel);
@@ -376,6 +382,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
                                tuples_read = 0;
        bool            reading_to_eof = true;
        Oid                *elements;
+       int16      *typmod;
        FuncIndexInfo *finfo,
                          **finfoP = NULL;
        TupleDesc  *itupdescArr;
@@ -498,17 +505,20 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
        {
                in_functions = (FmgrInfo *) palloc(attr_count * sizeof(FmgrInfo));
                elements = (Oid *) palloc(attr_count * sizeof(Oid));
+               typmod = (int16 *) palloc(attr_count * sizeof(int16));
                for (i = 0; i < attr_count; i++)
                {
                        in_func_oid = (Oid) GetInputFunction(attr[i]->atttypid);
                        fmgr_info(in_func_oid, &in_functions[i]);
                        elements[i] = GetTypeElement(attr[i]->atttypid);
+                       typmod[i] = attr[i]->atttypmod;
                }
        }
        else
        {
                in_functions = NULL;
                elements = NULL;
+               typmod = NULL;
                fread(&ntuples, sizeof(int32), 1, fp);
                if (ntuples != 0)
                        reading_to_eof = false;
@@ -574,7 +584,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
                                        values[i] =
                                                (Datum) (*fmgr_faddr(&in_functions[i])) (string,
                                                                                                   elements[i],
-                                                                                                  attr[i]->atttypmod);
+                                                                                                  typmod[i]);
 
                                        /*
                                         * Sanity check - by reference attributes cannot
@@ -801,9 +811,13 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
                        done = true;
        }
        pfree(values);
+       pfree(nulls);
        if (!binary)
+       {
                pfree(in_functions);
-       pfree(nulls);
+               pfree(elements);
+               pfree(typmod);
+       }
        pfree(byval);
        heap_close(rel);
 }
index da9f8c06a1aea05b5a19fe6603a50e2a0d2db710..59e1e0c20441e616d864bd808da4e3a65a59d3be 100644 (file)
@@ -13,7 +13,7 @@
  *       columns. (ie. tuples from the same group are consecutive)
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.15 1998/02/10 04:00:53 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.16 1998/02/10 16:02:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -418,10 +418,10 @@ sameGroup(TupleTableSlot *oldslot,
 
                        val1 = fmgr(typoutput, attr1,
                                                gettypelem(tupdesc->attrs[att - 1]->atttypid),
-                                                     (int)tupdesc->attrs[att - 1]->atttypmod);
+                                                          tupdesc->attrs[att - 1]->atttypmod);
                        val2 = fmgr(typoutput, attr2,
                                                gettypelem(tupdesc->attrs[att - 1]->atttypid),
-                                                         (int)tupdesc->attrs[att - 1]->atttypmod);
+                                                                  tupdesc->attrs[att - 1]->atttypmod);
 
                        /*
                         * now, val1 and val2 are ascii representations so we can use
index 52f3f247c9b29bb2c7225f9aba696b2fbbe214a2..abdf44bc89071bb40de7c1e44b9f296ba1d85607 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.13 1998/02/10 04:00:55 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.14 1998/02/10 16:03:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -198,10 +198,10 @@ ExecUnique(Unique *node)
                                        continue;
                                val1 = fmgr(typoutput, attr1,
                                        gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
-                                                 (int)tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
+                                                          tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
                                val2 = fmgr(typoutput, attr2,
                                        gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
-                                                 (int)tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
+                                                          tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
 
                                /*
                                 * now, val1 and val2 are ascii representations so we can
index 103f40ac9f23a708b9fc834f83a8aa6209b9749e..f1dfe837e24874c48313c960d48575a11a466242 100644 (file)
@@ -432,7 +432,7 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
 
        return (fmgr(foutoid, val,
                        gettypelem(tupdesc->attrs[fnumber - 1]->atttypid),
-                                 (int)tupdesc->attrs[fnumber - 1]->atttypmod));
+                                          tupdesc->attrs[fnumber - 1]->atttypmod));
 }
 
 Datum
index 212ec397a964ecebae8207652d2023369cf2ef75..f662282898906658efbccb439fc061722f6a5db7 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.12 1998/02/10 04:00:58 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.13 1998/02/10 16:03:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -314,7 +314,7 @@ be_printtup(HeapTuple tuple, TupleDesc typeinfo)
                {
                        values[i] = fmgr(typoutput, attr,
                                        gettypelem(typeinfo->attrs[i]->atttypid),
-                                                 (int)typeinfo->attrs[i]->atttypmod);
+                                                          typeinfo->attrs[i]->atttypmod);
                }
                else
                        values[i] = NULL;
index 8dcfdd8e364b8fea442a1e272cb308427dd8e72d..638e89cd3ac72605c94b5b03d853d97fd67b828c 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.6 1998/02/10 04:00:50 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.7 1998/02/10 16:03:17 momjian Exp $
  *
  * NOTES
  *       Creator functions in POSTGRES 4.2 are generated automatically. Most of
@@ -53,7 +53,7 @@ Var              *
 makeVar(Index varno,
                AttrNumber varattno,
                Oid vartype,
-               int vartypmod,
+               int16 vartypmod,
                Index varlevelsup,
                Index varnoold,
                AttrNumber varoattno)
@@ -78,7 +78,7 @@ makeVar(Index varno,
 Resdom    *
 makeResdom(AttrNumber resno,
                   Oid restype,
-                  int restypmod,
+                  int16 restypmod,
                   char *resname,
                   Index reskey,
                   Oid reskeyop,
index 48ed8cfd3834dbac4f407a3337dd5035f2d99fcd..1bf18ec19186dad2e5be35cd47e383a4f96fcf25 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.28 1998/02/10 04:00:57 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.29 1998/02/10 16:03:21 momjian Exp $
  *
  * NOTES
  *       Every (plan) node in POSTGRES has an associated "out" routine which
@@ -698,7 +698,7 @@ _outVar(StringInfo str, Var *node)
        appendStringInfo(str, buf);
        sprintf(buf, " :vartype %u ", node->vartype);
        appendStringInfo(str, buf);
-       sprintf(buf, " :vartypmod %u ", node->vartypmod);
+       sprintf(buf, " :vartypmod %d ", node->vartypmod);
        appendStringInfo(str, buf);
        sprintf(buf, " :varlevelsup %u ", node->varlevelsup);
        appendStringInfo(str, buf);
index 4406d9e89d8606bde966931b0d5b7dabdce95530..8a74e01c0f349173994f70df6d728e7f1df8ab73 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.23 1998/02/10 04:01:03 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.24 1998/02/10 16:03:23 momjian Exp $
  *
  * NOTES
  *       Most of the read functions for plan nodes are tested. (In fact, they
@@ -816,7 +816,7 @@ _readVar()
 
        token = lsptok(NULL, &length);          /* eat :vartypmod */
        token = lsptok(NULL, &length);          /* get vartypmod */
-       local_node->vartypmod = (Oid) atol(token);
+       local_node->vartypmod = atoi(token);
 
        token = lsptok(NULL, &length);          /* eat :varlevelsup */
        token = lsptok(NULL, &length);          /* get varlevelsup */
index b202ff4e9e587266f2035436ef4a6ad5be9d8f08..dde624848867996e5a5c84ec8d069f5cbb30e205 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.18 1998/02/07 06:11:30 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.19 1998/02/10 16:03:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -31,7 +31,7 @@
 #include "parser/parse_target.h"
 #include "utils/builtins.h"
 
-static Node *parser_typecast(Value *expr, TypeName *typename, int atttypmod);
+static Node *parser_typecast(Value *expr, TypeName *typename, int16 atttypmod);
 
 /*
  * transformExpr -
@@ -393,7 +393,7 @@ exprType(Node *expr)
 }
 
 static Node       *
-parser_typecast(Value *expr, TypeName *typename, int atttypmod)
+parser_typecast(Value *expr, TypeName *typename, int16 atttypmod)
 {
        /* check for passing non-ints */
        Const      *adt;
@@ -471,7 +471,7 @@ parser_typecast(Value *expr, TypeName *typename, int atttypmod)
 }
 
 Node      *
-parser_typecast2(Node *expr, Oid exprType, Type tp, int atttypmod)
+parser_typecast2(Node *expr, Oid exprType, Type tp, int16 atttypmod)
 {
        /* check for passing non-ints */
        Const      *adt;
index 79a97826409c51763339171c7c0b8e9816110a0b..e1a7e52d4689fcd82a713c7042851331e6fdb0f6 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.13 1998/02/10 04:01:52 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.14 1998/02/10 16:03:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1056,7 +1056,7 @@ setup_tlist(char *attname, Oid relid)
        Resdom     *resnode;
        Var                *varnode;
        Oid                     typeid;
-       int                     type_mod;
+       int16           type_mod;
        int                     attno;
 
        attno = get_attnum(relid, attname);
index 3b46ae212aab6ae8d568856cb6371ed53d585a70..b4ffeeb21a34efbea151db1b2f65554c6b690246 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.11 1998/02/10 04:01:55 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.12 1998/02/10 16:03:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -246,7 +246,7 @@ make_var(ParseState *pstate, Oid relid, char *refname,
        int                     vnum,
                                attid;
        Oid                     vartypeid;
-       int                     type_mod;
+       int16           type_mod;
        int                     sublevels_up;
 
        vnum = refnameRangeTablePosn(pstate, refname, &sublevels_up);
index 271645573e0f04401c259136a592d5312481d93b..559360cb9d706d4f2191a288417c60bcac94b3f8 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.8 1998/02/10 04:01:57 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.9 1998/02/10 16:03:41 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,7 +55,7 @@ transformTargetList(ParseState *pstate, List *targetlist)
                                {
                                        Node       *expr;
                                        Oid                     type_id;
-                                       int                     type_mod;
+                                       int16           type_mod;
                                        char       *identname;
                                        char       *resname;
 
@@ -194,7 +194,7 @@ transformTargetList(ParseState *pstate, List *targetlist)
                        case T_Attr:
                                {
                                        Oid                     type_id;
-                                       int                     type_mod;
+                                       int16           type_mod;
                                        Attr       *att = (Attr *) res->val;
                                        Node       *result;
                                        char       *attrname;
@@ -332,7 +332,7 @@ make_targetlist_expr(ParseState *pstate,
 {
        Oid                     type_id,
                                attrtype;
-       int                     type_mod,
+       int16           type_mod,
                                attrtypmod;
        int                     resdomno;
        Relation        rd;
index 4562623808edb3f24d18110be8c55ebade5eb703..0f69f62bf9c73332fe04d632c57b399d09d9b2a7 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.4 1998/01/16 23:20:23 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.5 1998/02/10 16:03:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -136,7 +136,7 @@ typeTypeFlag(Type t)
 /* Given a type structure and a string, returns the internal form of
    that string */
 char *
-stringTypeString(Type tp, char *string, int atttypmod)
+stringTypeString(Type tp, char *string, int16 atttypmod)
 {
        Oid                     op;
        Oid                     typelem;
index ce87c1a78ccb7e8418518ff4dcf089e34236b450..a7b6abdaeb1a964054d5a73325b1f98b21238131 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.26 1998/02/07 06:11:38 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.27 1998/02/10 16:03:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -50,7 +50,7 @@
  *       because we pass typelem as the second argument for array_in.)
  */
 char *
-bpcharin(char *s, int dummy, int atttypmod)
+bpcharin(char *s, int dummy, int16 atttypmod)
 {
        char       *result,
                           *r;
@@ -124,7 +124,7 @@ bpcharout(char *s)
  *       because we pass typelem as the second argument for array_in.)
  */
 char *
-varcharin(char *s, int dummy, int atttypmod)
+varcharin(char *s, int dummy, int16 atttypmod)
 {
        char       *result;
        int                     len;
index 8b0a7784a791892590ea7d2a6de952fe3c282e42..c5f325a2fdb7386df94308f83569b36f441d3997 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.11 1998/01/29 03:23:09 scrappy Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.12 1998/02/10 16:03:51 momjian Exp $
  *
  * NOTES
  *       Eventually, the index information should go through here, too.
@@ -161,7 +161,7 @@ get_attisset(Oid relid, char *attname)
  *             return the "atttypmod" field from the attribute relation.
  *
  */
-int
+int16 
 get_atttypmod(Oid relid, AttrNumber attnum)
 {
        FormData_pg_attribute att_tup;
index 4871745be04999639509295fde64dddb55bb1587..4af802706846deefb9edc553b0e39d562b43320d 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tupdesc.h,v 1.14 1998/02/10 04:02:13 momjian Exp $
+ * $Id: tupdesc.h,v 1.15 1998/02/10 16:03:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -69,7 +69,7 @@ extern bool TupleDescInitEntry(TupleDesc desc,
                                   AttrNumber attributeNumber,
                                   char *attributeName,
                                   Oid typeid,
-                                  int typmod,
+                                  int16 typmod,
                                   int attdim,
                                   bool attisset);
 
index a4a9dc3884e7cb919393e6a2b491687dcb340874..6a075dad57df700a27b18695cd1bacd724619683 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_attribute.h,v 1.26 1998/02/10 04:02:16 momjian Exp $
+ * $Id: pg_attribute.h,v 1.27 1998/02/10 16:04:03 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -89,12 +89,6 @@ CATALOG(pg_attribute) BOOTSTRAP
        /*
         * atttypmod records type-specific modifications supplied at table
      * creation time.
-     * This is not integrated into all areas of the source.  It is in
-        * TypeName to pass typmod info from the parser during table creation
-        * time, and it is used in the parser when converting a string to a
-        * typed constant associated with a variable.  We also have a hack in
-        * execMain.c/execUtils.c that uses atttypmod to properly create tables
-        * for SELECT * INTO TABLE test2 FROM test;
         */
 
        bool            attbyval;
index 56065752a863b042f748da195e2d015d75aa704f..f3e68b9f37247fe6d2228c062d8599baa36ca803 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_type.h,v 1.32 1998/02/10 04:02:17 momjian Exp $
+ * $Id: pg_type.h,v 1.33 1998/02/10 16:04:10 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -367,7 +367,6 @@ DESCR("limited-range ISO-format date and time");
 #define TIMESTAMPOID   1296
 
 
-#define USE_ATTTYPMOD(typeid)  ((typeid) == BPCHAROID || (typeid) == VARCHAROID)
 #define VARLENA_FIXED_SIZE(attr)       ((attr)->atttypid == BPCHAROID && (attr)->atttypmod > 0)
 
 /*
index 8b7cb299e03e934cdaadd69d06edf0e5b0062654..6fefdce5f39b9b00c3cd54b8f9e3412cd1aa228c 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: makefuncs.h,v 1.8 1998/02/10 04:02:23 momjian Exp $
+ * $Id: makefuncs.h,v 1.9 1998/02/10 16:04:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -25,14 +25,14 @@ extern Oper * makeOper(Oid opno,
 extern Var * makeVar(Index varno,
                AttrNumber varattno,
                Oid vartype,
-               int vartypmod,
+               int16 vartypmod,
                Index varlevelsup,
                Index varnoold,
                AttrNumber varoattno);
 
 extern Resdom * makeResdom(AttrNumber resno,
                   Oid restype,
-                  int restypmod,
+                  int16 restypmod,
                   char *resname,
                   Index reskey,
                   Oid reskeyop,
index fc30cbf3e0a81a06bdd7a464111b7abbe55ad2f7..108949f8c783eadc80d5175235dbfd6934b23963 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.46 1998/01/17 04:53:40 momjian Exp $
+ * $Id: parsenodes.h,v 1.47 1998/02/10 16:04:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -643,7 +643,7 @@ typedef struct TypeName
        char       *name;                       /* name of the type */
        bool            timezone;               /* timezone specified? */
        bool            setof;                  /* is a set? */
-       int           typmod;                 /* type modifier */
+       int16           typmod;                 /* type modifier */
        List       *arrayBounds;        /* array bounds */
 } TypeName;
 
index 3907e457c3aa536bb5b7a69ccba73126c0eeff2f..6a37bc1b204bb07358637d72d4011fd180be42c2 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: primnodes.h,v 1.17 1998/02/10 04:02:32 momjian Exp $
+ * $Id: primnodes.h,v 1.18 1998/02/10 16:04:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -41,7 +41,7 @@ typedef struct Resdom
        NodeTag         type;
        AttrNumber      resno;
        Oid                     restype;
-       int                     restypmod;
+       int16           restypmod;
        char       *resname;
        Index           reskey;
        Oid                     reskeyop;
@@ -124,7 +124,7 @@ typedef struct Var
        Index           varno;
        AttrNumber      varattno;
        Oid                     vartype;
-       int                     vartypmod;
+       int16           vartypmod;
        Index           varlevelsup;    /* erased by upper optimizer */
        Index           varnoold;               /* only used by optimizer */
        AttrNumber      varoattno;              /* only used by optimizer */
index b328cc5e5cafa25cbfcfc894cb986a6297a04ffe..e533741ec25a28ca7b0752e28c18214d15294e21 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_expr.h,v 1.6 1998/01/20 05:04:47 momjian Exp $
+ * $Id: parse_expr.h,v 1.7 1998/02/10 16:04:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,7 +21,7 @@
 extern Node *transformExpr(ParseState *pstate, Node *expr, int precedence);
 extern Node *transformIdent(ParseState *pstate, Node *expr, int precedence);
 extern Oid exprType(Node *expr);
-extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int attypmod);
+extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int16 attypmod);
 
 #endif                                                 /* PARSE_EXPR_H */
 
index 22a81c4994f3eeb7802d5688f8ee1e8547473627..cca43855c510367599f51a41ad5f447b1e2ae2de 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_type.h,v 1.3 1998/01/16 23:21:03 momjian Exp $
+ * $Id: parse_type.h,v 1.4 1998/02/10 16:04:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,7 +26,7 @@ extern int16 typeLen(Type t);
 extern bool typeByVal(Type t);
 extern char *typeTypeName(Type t);
 extern char typeTypeFlag(Type t);
-extern char *stringTypeString(Type tp, char *string, int atttypmod);
+extern char *stringTypeString(Type tp, char *string, int16 atttypmod);
 extern Oid typeidRetoutfunc(Oid type_id);
 extern Oid typeidTypeRelid(Oid type_id);
 extern Oid typeTypeRelid(Type typ);
index c37d95fa87ea3aa208b830f69ae7123ddfcd5264..7ff819940b755c0b282f4080219cf369f36701de 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: builtins.h,v 1.35 1998/02/02 03:11:37 scrappy Exp $
+ * $Id: builtins.h,v 1.36 1998/02/10 16:04:36 momjian Exp $
  *
  * NOTES
  *       This should normally only be included by fmgr.h.
@@ -445,7 +445,7 @@ DateTime   *timestamp_datetime(time_t timestamp);
 time_t         datetime_timestamp(DateTime *datetime);
 
 /* varchar.c */
-extern char *bpcharin(char *s, int dummy, int atttypmod);
+extern char *bpcharin(char *s, int dummy, int16 atttypmod);
 extern char *bpcharout(char *s);
 extern bool bpchareq(char *arg1, char *arg2);
 extern bool bpcharne(char *arg1, char *arg2);
@@ -457,7 +457,7 @@ extern int32 bpcharcmp(char *arg1, char *arg2);
 extern int32 bpcharlen(char *arg);
 extern uint32 hashbpchar(struct varlena * key);
 
-extern char *varcharin(char *s, int dummy, int atttypmod);
+extern char *varcharin(char *s, int dummy, int16 atttypmod);
 extern char *varcharout(char *s);
 extern bool varchareq(char *arg1, char *arg2);
 extern bool varcharne(char *arg1, char *arg2);
index 1d411cfbe53709e62df564d8784d61c75d2f2a67..b1b402d897b430b7d55e7fbc90242e72bbd5a864 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: lsyscache.h,v 1.8 1998/01/24 22:50:48 momjian Exp $
+ * $Id: lsyscache.h,v 1.9 1998/02/10 16:04:38 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,7 +21,7 @@ extern char *get_attname(Oid relid, AttrNumber attnum);
 extern AttrNumber get_attnum(Oid relid, char *attname);
 extern Oid     get_atttype(Oid relid, AttrNumber attnum);
 extern bool get_attisset(Oid relid, char *attname);
-extern int get_atttypmod(Oid relid, AttrNumber attnum);
+extern int16 get_atttypmod(Oid relid, AttrNumber attnum);
 extern RegProcedure get_opcode(Oid opid);
 extern char *get_opname(Oid opid);
 extern bool op_mergesortable(Oid opid, Oid ltype, Oid rtype,