Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit edd3668

Browse files
committed
Atttypmod cleanup.
1 parent ce88b9b commit edd3668

File tree

8 files changed

+33
-32
lines changed

8 files changed

+33
-32
lines changed

src/backend/commands/copy.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.41 1998/02/10 16:02:51 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.42 1998/02/13 19:45:38 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -48,8 +48,7 @@ static Oid GetOutputFunction(Oid type);
4848
static Oid GetTypeElement(Oid type);
4949
static Oid GetInputFunction(Oid type);
5050
static Oid IsTypeByVal(Oid type);
51-
static void
52-
GetIndexRelations(Oid main_relation_oid,
51+
static void GetIndexRelations(Oid main_relation_oid,
5352
int *n_indices,
5453
Relation **index_rels);
5554

src/backend/parser/parse_node.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.12 1998/02/10 16:03:39 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.13 1998/02/13 19:45:43 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -79,7 +79,7 @@ make_operand(char *opname,
7979
Assert(nodeTag(result) == T_Const);
8080
val = (Datum) textout((struct varlena *)
8181
con->constvalue);
82-
infunc = typeidRetinfunc(true_typeId);
82+
infunc = typeidInfunc(true_typeId);
8383
con = makeNode(Const);
8484
con->consttype = true_typeId;
8585
con->constlen = typeLen(true_type);
@@ -185,10 +185,10 @@ make_op(char *opname, Node *ltree, Node *rtree)
185185
CONVERTABLE_TYPE(rtypeId) && nodeTag(rtree) == T_Const &&
186186
!((Const *) rtree)->constiscast)
187187
{
188-
outfunc = typeidRetoutfunc(rtypeId);
189-
infunc = typeidRetinfunc(ltypeId);
188+
outfunc = typeidOutfunc(rtypeId);
189+
infunc = typeidInfunc(ltypeId);
190190
outstr = (char *) fmgr(outfunc, ((Const *) rtree)->constvalue);
191-
((Const *) rtree)->constvalue = (Datum) fmgr(infunc, outstr);
191+
((Const *) rtree)->constvalue = (Datum) fmgr(infunc, outstr, -1);
192192
pfree(outstr);
193193
((Const *) rtree)->consttype = rtypeId = ltypeId;
194194
newtype = typeidType(rtypeId);
@@ -200,10 +200,10 @@ make_op(char *opname, Node *ltree, Node *rtree)
200200
CONVERTABLE_TYPE(ltypeId) && nodeTag(ltree) == T_Const &&
201201
!((Const *) ltree)->constiscast)
202202
{
203-
outfunc = typeidRetoutfunc(ltypeId);
204-
infunc = typeidRetinfunc(rtypeId);
203+
outfunc = typeidOutfunc(ltypeId);
204+
infunc = typeidInfunc(rtypeId);
205205
outstr = (char *) fmgr(outfunc, ((Const *) ltree)->constvalue);
206-
((Const *) ltree)->constvalue = (Datum) fmgr(infunc, outstr);
206+
((Const *) ltree)->constvalue = (Datum) fmgr(infunc, outstr, -1);
207207
pfree(outstr);
208208
((Const *) ltree)->consttype = ltypeId = rtypeId;
209209
newtype = typeidType(ltypeId);

src/backend/parser/parse_target.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.9 1998/02/10 16:03:41 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.10 1998/02/13 19:45:44 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -394,7 +394,7 @@ make_targetlist_expr(ParseState *pstate,
394394
lnext(expr) =
395395
makeConst(attrtype,
396396
attrlen,
397-
(Datum) fmgr(typeidRetinfunc(attrtype),
397+
(Datum) fmgr(typeidInfunc(attrtype),
398398
val, typeidTypElem(attrtype), -1),
399399
false,
400400
true /* Maybe correct-- 80% chance */ ,

src/backend/parser/parse_type.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.5 1998/02/10 16:03:42 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.6 1998/02/13 19:45:45 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -148,7 +148,7 @@ stringTypeString(Type tp, char *string, int16 atttypmod)
148148

149149
/* Given a type id, returns the out-conversion function of the type */
150150
Oid
151-
typeidRetoutfunc(Oid type_id)
151+
typeidOutfunc(Oid type_id)
152152
{
153153
HeapTuple typeTuple;
154154
TypeTupleForm type;
@@ -158,7 +158,7 @@ typeidRetoutfunc(Oid type_id)
158158
ObjectIdGetDatum(type_id),
159159
0, 0, 0);
160160
if (!HeapTupleIsValid(typeTuple))
161-
elog(ERROR, "typeidRetoutfunc: Invalid type - oid = %u", type_id);
161+
elog(ERROR, "typeidOutfunc: Invalid type - oid = %u", type_id);
162162

163163
type = (TypeTupleForm) GETSTRUCT(typeTuple);
164164
outfunc = type->typoutput;
@@ -241,7 +241,7 @@ GetArrayElementType(Oid typearray)
241241

242242
/* Given a type id, returns the in-conversion function of the type */
243243
Oid
244-
typeidRetinfunc(Oid type_id)
244+
typeidInfunc(Oid type_id)
245245
{
246246
HeapTuple typeTuple;
247247
TypeTupleForm type;
@@ -251,7 +251,7 @@ typeidRetinfunc(Oid type_id)
251251
ObjectIdGetDatum(type_id),
252252
0, 0, 0);
253253
if (!HeapTupleIsValid(typeTuple))
254-
elog(ERROR, "typeidRetinfunc: Invalid type - oid = %u", type_id);
254+
elog(ERROR, "typeidInfunc: Invalid type - oid = %u", type_id);
255255

256256
type = (TypeTupleForm) GETSTRUCT(typeTuple);
257257
infunc = type->typinput;

src/backend/utils/adt/arrayfuncs.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.24 1998/01/15 19:45:01 pgsql Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.25 1998/02/13 19:45:53 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -43,11 +43,10 @@
4343

4444
/*-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-*/
4545
static int _ArrayCount(char *str, int dim[], int typdelim);
46-
static char *
47-
_ReadArrayStr(char *arrayStr, int nitems, int ndim, int dim[],
46+
static char *_ReadArrayStr(char *arrayStr, int nitems, int ndim, int dim[],
4847
FmgrInfo *inputproc, Oid typelem, char typdelim,
4948
int typlen, bool typbyval, char typalign,
50-
int *nbytes);
49+
int *nbytes, int16 typmod);
5150

5251
#ifdef LOARRAY
5352
static char *
@@ -93,7 +92,8 @@ static char *array_seek(char *ptr, int eltsize, int nitems);
9392
*/
9493
char *
9594
array_in(char *string, /* input array in external form */
96-
Oid element_type) /* type OID of an array element */
95+
Oid element_type, /* type OID of an array element */
96+
int16 typmod)
9797
{
9898
int typlen;
9999
bool typbyval,
@@ -208,7 +208,7 @@ array_in(char *string, /* input array in external form */
208208
/* array not a large object */
209209
dataPtr =
210210
(char *) _ReadArrayStr(p, nitems, ndim, dim, &inputproc, typelem,
211-
typdelim, typlen, typbyval, typalign,
211+
typmod, typdelim, typlen, typbyval, typalign,
212212
&nbytes);
213213
nbytes += ARR_OVERHEAD(ndim);
214214
retval = (ArrayType *) palloc(nbytes);
@@ -369,6 +369,7 @@ _ReadArrayStr(char *arrayStr,
369369
FmgrInfo *inputproc, /* function used for the
370370
* conversion */
371371
Oid typelem,
372+
int16 typmod,
372373
char typdelim,
373374
int typlen,
374375
bool typbyval,
@@ -460,7 +461,7 @@ _ReadArrayStr(char *arrayStr,
460461
*q = '\0';
461462
if (i >= nitems)
462463
elog(ERROR, "array_in: illformed array constant");
463-
values[i] = (*fmgr_faddr(inputproc)) (p, typelem);
464+
values[i] = (*fmgr_faddr(inputproc)) (p, typelem, typmod);
464465
p = ++q;
465466
if (!eoArray)
466467

src/include/catalog/pg_attribute.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_attribute.h,v 1.27 1998/02/10 16:04:03 momjian Exp $
10+
* $Id: pg_attribute.h,v 1.28 1998/02/13 19:46:09 momjian Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -88,7 +88,8 @@ CATALOG(pg_attribute) BOOTSTRAP
8888
int2 atttypmod;
8989
/*
9090
* atttypmod records type-specific modifications supplied at table
91-
* creation time.
91+
* creation time, and passes it to input and output functions as the
92+
* third argument.
9293
*/
9394

9495
bool attbyval;

src/include/parser/parse_type.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Id: parse_type.h,v 1.4 1998/02/10 16:04:32 momjian Exp $
9+
* $Id: parse_type.h,v 1.5 1998/02/13 19:46:18 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -27,11 +27,11 @@ extern bool typeByVal(Type t);
2727
extern char *typeTypeName(Type t);
2828
extern char typeTypeFlag(Type t);
2929
extern char *stringTypeString(Type tp, char *string, int16 atttypmod);
30-
extern Oid typeidRetoutfunc(Oid type_id);
30+
extern Oid typeidOutfunc(Oid type_id);
3131
extern Oid typeidTypeRelid(Oid type_id);
3232
extern Oid typeTypeRelid(Type typ);
3333
extern Oid typeidTypElem(Oid type_id);
3434
extern Oid GetArrayElementType(Oid typearray);
35-
extern Oid typeidRetinfunc(Oid type_id);
35+
extern Oid typeidInfunc(Oid type_id);
3636

3737
#endif /* PARSE_TYPE_H */

src/include/utils/array.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* Copyright (c) 1994, Regents of the University of California
1212
*
13-
* $Id: array.h,v 1.9 1998/01/24 22:50:31 momjian Exp $
13+
* $Id: array.h,v 1.10 1998/02/13 19:46:22 momjian Exp $
1414
*
1515
* NOTES
1616
* XXX the data array should be LONGALIGN'd -- notice that the array
@@ -114,7 +114,7 @@ typedef struct
114114
/*
115115
* prototypes for functions defined in arrayfuncs.c
116116
*/
117-
extern char *array_in(char *string, Oid element_type);
117+
extern char *array_in(char *string, Oid element_type, int16 typmod);
118118
extern char *array_out(ArrayType *v, Oid element_type);
119119
extern char *array_dims(ArrayType *v, bool *isNull);
120120
extern Datum array_ref(ArrayType *array, int n, int indx[], int reftype,

0 commit comments

Comments
 (0)