mirror of
https://github.com/postgres/postgres.git
synced 2025-11-13 16:22:44 +03:00
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.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* 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)
|
||||
* and byval, since those were already set in
|
||||
* TupleDescInitEntry. In fact, this seems redundant here,
|
||||
* 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 &&
|
||||
(*attributeP)->atttypid != BPCHAROID &&
|
||||
(*attributeP)->atttypid != VARCHAROID)
|
||||
if (!(*attributeP)->attisset)
|
||||
{
|
||||
|
||||
typp = (TypeTupleForm) GETSTRUCT(tuple); /* XXX */
|
||||
(*attributeP)->attlen = typp->typlen;
|
||||
(*attributeP)->attbyval = typp->typbyval;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@@ -107,6 +107,7 @@ DefaultBuild(Relation heapRelation, Relation indexRelation,
|
||||
* AttrNumber attnum;
|
||||
* uint32 attnelems;
|
||||
* int32 attcacheoff;
|
||||
* int16 atttypmod;
|
||||
* bool attbyval;
|
||||
* bool attisset;
|
||||
* char attalign;
|
||||
@@ -117,12 +118,12 @@ DefaultBuild(Relation heapRelation, Relation indexRelation,
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
static FormData_pg_attribute sysatts[] = {
|
||||
{0l, {"ctid"}, 27l, 0l, 6, -1, 0, -1, '\0', '\0', 'i', '\0', '\0'},
|
||||
{0l, {"oid"}, 26l, 0l, 4, -2, 0, -1, '\001', '\0', 'i', '\0', '\0'},
|
||||
{0l, {"xmin"}, 28l, 0l, 4, -3, 0, -1, '\0', '\0', 'i', '\0', '\0'},
|
||||
{0l, {"cmin"}, 29l, 0l, 4, -4, 0, -1, '\001', '\0', 'i', '\0', '\0'},
|
||||
{0l, {"xmax"}, 28l, 0l, 4, -5, 0, -1, '\0', '\0', 'i', '\0', '\0'},
|
||||
{0l, {"cmax"}, 29l, 0l, 4, -6, 0, -1, '\001', '\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, 0, '\001', '\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, 0, '\001', '\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, 0, '\001', '\0', 'i', '\0', '\0'},
|
||||
};
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@@ -436,6 +437,7 @@ ConstructTupleDescriptor(Oid heapoid,
|
||||
|
||||
((AttributeTupleForm) to)->attnotnull = false;
|
||||
((AttributeTupleForm) to)->atthasdef = false;
|
||||
((AttributeTupleForm) to)->atttypmod = 0;
|
||||
|
||||
/*
|
||||
* if the keytype is defined, we need to change the tuple form's
|
||||
@@ -454,11 +456,11 @@ ConstructTupleDescriptor(Oid heapoid,
|
||||
((AttributeTupleForm) to)->atttypid = tup->t_oid;
|
||||
((AttributeTupleForm) to)->attbyval =
|
||||
((TypeTupleForm) ((char *) tup + tup->t_hoff))->typbyval;
|
||||
if (IndexKeyType->typlen > 0)
|
||||
((AttributeTupleForm) to)->attlen = IndexKeyType->typlen;
|
||||
else
|
||||
((AttributeTupleForm) to)->attlen =
|
||||
|
||||
((AttributeTupleForm) to)->attlen =
|
||||
((TypeTupleForm) ((char *) tup + tup->t_hoff))->typlen;
|
||||
|
||||
((AttributeTupleForm) to)->atttypmod = IndexKeyType->typmod;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user