Commit 86ef36c9 authored by Bruce Momjian's avatar Bruce Momjian

New NameStr macro to convert Name to Str. No need for var.data anymore.

Fewer calls to nameout.

Better use of RelationGetRelationName.
parent df723a8a
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.49 1999/07/17 20:16:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.50 1999/11/07 23:07:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -245,7 +245,7 @@ printatt(unsigned attributeId,
{
printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, typmod = %d, byval = %c)\n",
attributeId,
attributeP->attname.data,
NameStr(attributeP->attname),
value != NULL ? " = \"" : "",
value != NULL ? value : "",
value != NULL ? "\"" : "",
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.55 1999/10/03 23:55:25 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.56 1999/11/07 23:07:47 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
......@@ -278,7 +278,7 @@ TupleDescInitEntry(TupleDesc desc,
if (attributeName != NULL)
namestrcpy(&(att->attname), attributeName);
else
MemSet(att->attname.data, 0, NAMEDATALEN);
MemSet(NameStr(att->attname), 0, NAMEDATALEN);
att->attdisbursion = 0; /* dummy value */
......
......@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.46 1999/09/24 00:23:42 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.47 1999/11/07 23:07:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -111,7 +111,7 @@ gistbuild(Relation heap,
*/
if (oldPred == NULL && (nb = RelationGetNumberOfBlocks(index)) != 0)
elog(ERROR, "%s already contains data", index->rd_rel->relname.data);
elog(ERROR, "%s already contains data", RelationGetRelationName(index));
/* initialize the root page (if this is a new index) */
if (oldPred == NULL)
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.19 1999/07/15 22:38:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.20 1999/11/07 23:07:49 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
......@@ -177,7 +177,7 @@ hashname(NameData *n)
int len;
char *key;
key = n->data;
key = NameStr(*n);
h = 0;
len = NAMEDATALEN;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.57 1999/10/30 23:10:21 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.58 1999/11/07 23:07:52 momjian Exp $
*
*
* INTERFACE ROUTINES
......@@ -259,7 +259,7 @@ heapgettup(Relation relation,
elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", buffer, nkeys, key);
elog(DEBUG, "heapgettup: relation(%c)=`%s', %p",
relation->rd_rel->relkind, &relation->rd_rel->relname,
relation->rd_rel->relkind, RelationGetRelationName(relation),
snapshot);
#endif /* !defined(HEAPDEBUGALL) */
......@@ -525,7 +525,7 @@ heap_open(Oid relationId, LOCKMODE lockmode)
/* Under no circumstances will we return an index as a relation. */
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
elog(ERROR, "%s is an index relation", RelationGetRelationName(r));
if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */
......@@ -567,7 +567,7 @@ heap_openr(char *relationName, LOCKMODE lockmode)
/* Under no circumstances will we return an index as a relation. */
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
elog(ERROR, "%s is an index relation", RelationGetRelationName(r));
if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */
......@@ -765,7 +765,7 @@ heap_endscan(HeapScanDesc scan)
#ifdef HEAPDEBUGALL
#define HEAPDEBUG_1 \
elog(DEBUG, "heap_getnext([%s,nkeys=%d],backw=%d) called", \
scan->rs_rd->rd_rel->relname.data, scan->rs_nkeys, backw)
RelationGetRelationName(scan->rs_rd), scan->rs_nkeys, backw)
#define HEAPDEBUG_2 \
elog(DEBUG, "heap_getnext called with backw (no tracing yet)")
......@@ -1045,7 +1045,7 @@ heap_fetch(Relation relation,
if (!BufferIsValid(buffer))
elog(ERROR, "heap_fetch: %s relation: ReadBuffer(%lx) failed",
&relation->rd_rel->relname, (long) tid);
RelationGetRelationName(relation), (long) tid);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
......@@ -1121,7 +1121,7 @@ heap_get_latest_tid(Relation relation,
if (!BufferIsValid(buffer))
elog(ERROR, "heap_get_latest_tid: %s relation: ReadBuffer(%lx) failed",
&relation->rd_rel->relname, (long) tid);
RelationGetRelationName(relation), (long) tid);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
......@@ -1231,7 +1231,7 @@ heap_insert(Relation relation, HeapTuple tup)
RelationPutHeapTupleAtEnd(relation, tup);
if (IsSystemRelationName(RelationGetRelationName(relation)->data))
if (IsSystemRelationName(RelationGetRelationName(relation)))
RelationInvalidateHeapTuple(relation, tup);
return tup->t_data->t_oid;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.36 1999/09/18 19:06:04 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.37 1999/11/07 23:07:54 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
......@@ -147,7 +147,7 @@ index_open(Oid relationId)
elog(ERROR, "Index %u does not exist", relationId);
if (r->rd_rel->relkind != RELKIND_INDEX)
elog(ERROR, "%s is not an index relation", r->rd_rel->relname.data);
elog(ERROR, "%s is not an index relation", RelationGetRelationName(r));
return r;
}
......@@ -169,7 +169,7 @@ index_openr(char *relationName)
elog(ERROR, "Index '%s' does not exist", relationName);
if (r->rd_rel->relkind != RELKIND_INDEX)
elog(ERROR, "%s is not an index relation", r->rd_rel->relname.data);
elog(ERROR, "%s is not an index relation", RelationGetRelationName(r));
return r;
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.27 1999/07/17 20:16:41 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.28 1999/11/07 23:07:56 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
......@@ -131,7 +131,7 @@ btcharcmp(char a, char b)
int32
btnamecmp(NameData *a, NameData *b)
{
return strncmp(a->data, b->data, NAMEDATALEN);
return strncmp(NameStr(*a), NameStr(*b), NAMEDATALEN);
}
int32
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.54 1999/09/27 18:20:21 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.55 1999/11/07 23:07:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -206,7 +206,7 @@ _bt_moveright(Relation rel,
PageGetItemId(page, P_FIRSTKEY),
BTEqualStrategyNumber))
elog(FATAL, "btree: BTP_CHAIN flag was expected in %s (access = %s)",
rel->rd_rel->relname.data, access ? "bt_write" : "bt_read");
RelationGetRelationName(rel), access ? "bt_write" : "bt_read");
if (_bt_skeycmp(rel, keysz, scankey, page,
PageGetItemId(page, offmax),
BTEqualStrategyNumber))
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.38 1999/09/24 00:23:59 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.39 1999/11/07 23:07:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -105,7 +105,7 @@ rtbuild(Relation heap,
*/
if (oldPred == NULL && (nb = RelationGetNumberOfBlocks(index)) != 0)
elog(ERROR, "%s already contains data", index->rd_rel->relname.data);
elog(ERROR, "%s already contains data", RelationGetRelationName(index));
/* initialize the root page (if this is a new index) */
if (oldPred == NULL)
......
......@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.70 1999/10/25 03:07:43 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.71 1999/11/07 23:07:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -479,7 +479,7 @@ boot_openrel(char *relname)
*/
if (namestrcmp(&attrtypes[i]->attname, "attisset") == 0)
attrtypes[i]->attisset = get_attisset(RelationGetRelid(reldesc),
attrtypes[i]->attname.data);
NameStr(attrtypes[i]->attname));
else
attrtypes[i]->attisset = false;
......@@ -488,7 +488,7 @@ boot_openrel(char *relname)
Form_pg_attribute at = attrtypes[i];
printf("create attribute %d name %s len %d num %d type %d\n",
i, at->attname.data, at->attlen, at->attnum,
i, NameStr(at->attname), at->attlen, at->attnum,
at->atttypid
);
fflush(stdout);
......@@ -507,7 +507,7 @@ closerel(char *name)
{
if (reldesc)
{
if (namestrcmp(RelationGetRelationName(reldesc), name) != 0)
if (strcmp(RelationGetRelationName(reldesc), name) != 0)
elog(ERROR, "closerel: close of '%s' when '%s' was expected",
name, relname ? relname : "(null)");
}
......@@ -558,7 +558,7 @@ DefineAttr(char *name, char *type, int attnum)
attrtypes[attnum]->atttypid = Ap->am_oid;
namestrcpy(&attrtypes[attnum]->attname, name);
if (!Quiet)
printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
printf("<%s %s> ", NameStr(attrtypes[attnum]->attname), type);
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
attlen = attrtypes[attnum]->attlen = Ap->am_typ.typlen;
attrtypes[attnum]->attbyval = Ap->am_typ.typbyval;
......@@ -569,7 +569,7 @@ DefineAttr(char *name, char *type, int attnum)
attrtypes[attnum]->atttypid = Procid[typeoid].oid;
namestrcpy(&attrtypes[attnum]->attname, name);
if (!Quiet)
printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
printf("<%s %s> ", NameStr(attrtypes[attnum]->attname), type);
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
attlen = attrtypes[attnum]->attlen = Procid[typeoid].len;
......@@ -792,7 +792,7 @@ gettype(char *type)
{
for (app = Typ; *app != (struct typmap *) NULL; app++)
{
if (strncmp((*app)->am_typ.typname.data, type, NAMEDATALEN) == 0)
if (strncmp(NameStr((*app)->am_typ.typname), type, NAMEDATALEN) == 0)
{
Ap = *app;
return (*app)->am_oid;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.28 1999/09/18 19:06:33 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.29 1999/11/07 23:08:00 momjian Exp $
*
* NOTES
* See acl.h.
......@@ -192,7 +192,7 @@ get_groname(AclId grosysid)
ObjectIdGetDatum(grosysid),
0, 0, 0);
if (HeapTupleIsValid(tuple))
name = (((Form_pg_group) GETSTRUCT(tuple))->groname).data;
name = NameStr(((Form_pg_group) GETSTRUCT(tuple))->groname);
else
elog(NOTICE, "get_groname: group %d not found", grosysid);
return name;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.106 1999/11/04 08:00:56 inoue Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.107 1999/11/07 23:08:00 momjian Exp $
*
*
* INTERFACE ROUTINES
......@@ -290,7 +290,7 @@ heap_create(char *relname,
* ----------------
*/
MemSet((char *) rel->rd_rel, 0, sizeof *rel->rd_rel);
namestrcpy(&(rel->rd_rel->relname), relname);
strcpy(RelationGetRelationName(rel), relname);
rel->rd_rel->relkind = RELKIND_UNCATALOGED;
rel->rd_rel->relnatts = natts;
if (tupDesc->constr)
......@@ -440,14 +440,14 @@ CheckAttributeNames(TupleDesc tupdesc)
{
elog(ERROR, "Attribute '%s' has a name conflict"
"\n\tName matches an existing system attribute",
HeapAtt[j]->attname.data);
NameStr(HeapAtt[j]->attname));
}
}
if (tupdesc->attrs[i]->atttypid == UNKNOWNOID)
{
elog(NOTICE, "Attribute '%s' has an unknown type"
"\n\tRelation created; continue",
tupdesc->attrs[i]->attname.data);
NameStr(tupdesc->attrs[i]->attname));
}
}
......@@ -463,7 +463,7 @@ CheckAttributeNames(TupleDesc tupdesc)
&(tupdesc->attrs[i]->attname)))
{
elog(ERROR, "Attribute '%s' is repeated",
tupdesc->attrs[j]->attname.data);
NameStr(tupdesc->attrs[j]->attname));
}
}
}
......@@ -1074,7 +1074,7 @@ DeleteRelationTuple(Relation rel)
{
heap_close(pg_class_desc, RowExclusiveLock);
elog(ERROR, "Relation '%s' does not exist",
&rel->rd_rel->relname);
RelationGetRelationName(rel));
}
/* ----------------
......@@ -1376,7 +1376,7 @@ DeleteTypeTuple(Relation rel)
heap_endscan(pg_type_scan);
heap_close(pg_type_desc, RowExclusiveLock);
elog(ERROR, "DeleteTypeTuple: %s type nonexistent",
&rel->rd_rel->relname);
RelationGetRelationName(rel));
}
/* ----------------
......@@ -1420,7 +1420,7 @@ DeleteTypeTuple(Relation rel)
heap_close(pg_type_desc, RowExclusiveLock);
elog(ERROR, "DeleteTypeTuple: att of type %s exists in relation %u",
&rel->rd_rel->relname, relid);
RelationGetRelationName(rel), relid);
}
heap_endscan(pg_attribute_scan);
heap_close(pg_attribute_desc, RowExclusiveLock);
......@@ -1463,9 +1463,9 @@ heap_destroy_with_catalog(char *relname)
*/
/* allow temp of pg_class? Guess so. */
if (!istemp && !allowSystemTableMods &&
IsSystemRelationName(RelationGetRelationName(rel)->data))
IsSystemRelationName(RelationGetRelationName(rel)))
elog(ERROR, "System relation '%s' cannot be destroyed",
&rel->rd_rel->relname);
RelationGetRelationName(rel));
/* ----------------
* DROP TABLE within a transaction block is dangerous, because
......@@ -1723,8 +1723,8 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin,
* deparse_expression needs a RangeTblEntry list, so make one
*/
rte = makeNode(RangeTblEntry);
rte->relname = RelationGetRelationName(rel)->data;
rte->refname = RelationGetRelationName(rel)->data;
rte->relname = RelationGetRelationName(rel);
rte->refname = RelationGetRelationName(rel);
rte->relid = RelationGetRelid(rel);
rte->inh = false;
rte->inFromCl = true;
......@@ -1802,8 +1802,8 @@ StoreRelCheck(Relation rel, char *ccname, char *ccbin)
* deparse_expression needs a RangeTblEntry list, so make one
*/
rte = makeNode(RangeTblEntry);
rte->relname = RelationGetRelationName(rel)->data;
rte->refname = RelationGetRelationName(rel)->data;
rte->relname = RelationGetRelationName(rel);
rte->refname = RelationGetRelationName(rel);
rte->relid = RelationGetRelid(rel);
rte->inh = false;
rte->inFromCl = true;
......@@ -1882,7 +1882,7 @@ AddRelationRawConstraints(Relation rel,
List *rawColDefaults,
List *rawConstraints)
{
char *relname = RelationGetRelationName(rel)->data;
char *relname = RelationGetRelationName(rel);
TupleDesc tupleDesc;
TupleConstr *oldconstr;
int numoldchecks;
......@@ -1961,7 +1961,7 @@ AddRelationRawConstraints(Relation rel,
elog(ERROR, "Attribute '%s' is of type '%s'"
" but default expression is of type '%s'"
"\n\tYou will need to rewrite or cast the expression",
atp->attname.data,
NameStr(atp->attname),
typeidTypeName(atp->atttypid),
typeidTypeName(type_id));
}
......
......@@ -9,7 +9,7 @@
* doesn't work! - jolly 8/19/95
*
*
* $Id: version.c,v 1.22 1999/07/17 20:16:55 momjian Exp $
* $Id: version.c,v 1.23 1999/11/07 23:08:03 momjian Exp $
*
* NOTES
* At the point the version is defined, 2 physical relations are created
......@@ -190,7 +190,7 @@ setAttrList(char *bname)
for (i = maxattrs - 1; i > -1; --i)
{
attrname = (rel->rd_att->attrs[i]->attname).data;
attrname = NameStr(rel->rd_att->attrs[i]->attname);
if (notfirst == 1)
sprintf(temp_buf, ", %s = new.%s", attrname, attrname);
......
......@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.45 1999/09/18 19:06:40 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.46 1999/11/07 23:08:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -127,7 +127,7 @@ cluster(char *oldrelname, char *oldindexname)
*/
NewHeap = copy_heap(OIDOldHeap);
OIDNewHeap = RelationGetRelid(NewHeap);
strcpy(NewHeapName, NewHeap->rd_rel->relname.data);
strcpy(NewHeapName, RelationGetRelationName(NewHeap));
/* To make the new heap visible (which is until now empty). */
......@@ -284,7 +284,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
natts = 1;
}
index_create((NewHeap->rd_rel->relname).data,
index_create(RelationGetRelationName(NewHeap),
NewIndexName,
finfo,
NULL, /* type info is in the old index */
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.55 1999/10/03 23:55:27 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.56 1999/11/07 23:08:01 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
......@@ -358,7 +358,7 @@ PerformAddAttribute(char *relationName,
if (childrelid == myrelid)
continue;
rel = heap_open(childrelid, AccessExclusiveLock);
PerformAddAttribute((rel->rd_rel->relname).data,
PerformAddAttribute(RelationGetRelationName(rel),
userName, false, colDef);
heap_close(rel, AccessExclusiveLock);
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.50 1999/10/26 03:12:34 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.51 1999/11/07 23:08:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -341,12 +341,12 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
/*
* form name, type and constraints
*/
attributeName = (attribute->attname).data;
attributeName = NameStr(attribute->attname);
tuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(attribute->atttypid),
0, 0, 0);
Assert(HeapTupleIsValid(tuple));
attributeType = (((Form_pg_type) GETSTRUCT(tuple))->typname).data;
attributeType = NameStr(((Form_pg_type) GETSTRUCT(tuple))->typname);
/*
* check validity
......
......@@ -4,7 +4,7 @@
*
* Copyright (c) 1994-5, Regents of the University of California
*
* $Id: explain.c,v 1.48 1999/09/18 19:06:40 tgl Exp $
* $Id: explain.c,v 1.49 1999/11/07 23:08:02 momjian Exp $
*
*/
......@@ -216,7 +216,7 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
if (++i > 1)
appendStringInfo(str, ", ");
appendStringInfo(str,
stringStringInfo((RelationGetRelationName(relation))->data));
stringStringInfo(RelationGetRelationName(relation)));
/* drop relcache refcount from RelationIdGetRelation */
RelationDecrementReferenceCount(relation);
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.12 1999/10/02 21:33:24 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.13 1999/11/07 23:08:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -533,7 +533,7 @@ GetDefaultOpClass(Oid atttypid)
if (!HeapTupleIsValid(tuple))
return 0;
return nameout(&(((Form_pg_opclass) GETSTRUCT(tuple))->opcname));
return nameout(&((Form_pg_opclass) GETSTRUCT(tuple))->opcname);
}
/*
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.38 1999/10/26 03:12:34 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.39 1999/11/07 23:08:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -233,7 +233,7 @@ AttributeAndRelationRemove(Oid typeOid)
{
char *name;
name = (((Form_pg_class) GETSTRUCT(tup))->relname).data;
name = NameStr(((Form_pg_class) GETSTRUCT(tup))->relname);
heap_destroy_with_catalog(name);
}
heap_endscan(scan);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.34 1999/09/24 00:24:17 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.35 1999/11/07 23:08:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -123,7 +123,7 @@ renameatt(char *relname,
}
/* make copy of cache value, could disappear in call */
StrNCpy(childname,
((Form_pg_class) GETSTRUCT(reltup))->relname.data,
NameStr(((Form_pg_class) GETSTRUCT(reltup))->relname),
NAMEDATALEN);
/* note we need not recurse again! */
renameatt(childname, oldattname, newattname, userName, 0);
......@@ -153,7 +153,7 @@ renameatt(char *relname,
elog(ERROR, "renameatt: attribute \"%s\" exists", newattname);
}
StrNCpy((((Form_pg_attribute) (GETSTRUCT(oldatttup)))->attname.data),
StrNCpy(NameStr(((Form_pg_attribute) GETSTRUCT(oldatttup))->attname),
newattname, NAMEDATALEN);
heap_replace(attrelation, &oldatttup->t_self, oldatttup, NULL);
......@@ -288,7 +288,7 @@ renamerel(char *oldrelname, char *newrelname)
/*
* Update pg_class tuple with new relname.
*/
StrNCpy((((Form_pg_class) GETSTRUCT(oldreltup))->relname.data),
StrNCpy(NameStr(((Form_pg_class) GETSTRUCT(oldreltup))->relname),
newrelname, NAMEDATALEN);
heap_replace(relrelation, &oldreltup->t_self, oldreltup, NULL);
......
......@@ -391,8 +391,8 @@ RelationRemoveTriggers(Relation rel)
pg_trigger = (Form_pg_trigger) GETSTRUCT(tup);
refrel = heap_open(pg_trigger->tgrelid, NoLock);
stmt.relname = nameout(&(refrel->rd_rel->relname));
stmt.trigname = nameout(&(pg_trigger->tgname));
stmt.relname = pstrdup(RelationGetRelationName(refrel));
stmt.trigname = nameout(&pg_trigger->tgname);
DropTrigger(&stmt);
......@@ -450,7 +450,7 @@ RelationBuildTriggers(Relation relation)
continue;
if (found == ntrigs)
elog(ERROR, "RelationBuildTriggers: unexpected record found for rel %.*s",
NAMEDATALEN, relation->rd_rel->relname.data);
NAMEDATALEN, RelationGetRelationName(relation));
pg_trigger = (Form_pg_trigger) GETSTRUCT(&tuple);
......@@ -461,7 +461,7 @@ RelationBuildTriggers(Relation relation)
build = &(triggers[found]);
build->tgoid = tuple.t_data->t_oid;
build->tgname = nameout(&(pg_trigger->tgname));
build->tgname = nameout(&pg_trigger->tgname);
build->tgfoid = pg_trigger->tgfoid;
build->tgfunc.fn_addr = NULL;
build->tgtype = pg_trigger->tgtype;
......@@ -476,7 +476,7 @@ RelationBuildTriggers(Relation relation)
tgrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelationBuildTriggers: tgargs IS NULL for rel %.*s",
NAMEDATALEN, relation->rd_rel->relname.data);
NAMEDATALEN, RelationGetRelationName(relation));
if (build->tgnargs > 0)
{
char *p;
......@@ -487,7 +487,7 @@ RelationBuildTriggers(Relation relation)
tgrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelationBuildTriggers: tgargs IS NULL for rel %.*s",
NAMEDATALEN, relation->rd_rel->relname.data);
NAMEDATALEN, RelationGetRelationName(relation));
p = (char *) VARDATA(val);
build->tgargs = (char **) palloc(build->tgnargs * sizeof(char *));
for (i = 0; i < build->tgnargs; i++)
......@@ -507,7 +507,7 @@ RelationBuildTriggers(Relation relation)
if (found < ntrigs)
elog(ERROR, "RelationBuildTriggers: %d record not found for rel %.*s",
ntrigs - found,
NAMEDATALEN, relation->rd_rel->relname.data);
NAMEDATALEN, RelationGetRelationName(relation));
index_endscan(sd);
pfree(sd);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.122 1999/09/28 11:41:04 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.123 1999/11/07 23:08:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -122,7 +122,7 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec)
/* vacrel gets de-allocated on transaction commit */
if (vacrel)
strcpy(VacRel.data, vacrel);
strcpy(NameStr(VacRel), vacrel);
pmem = PortalGetVariableMemory(vc_portal);
old = MemoryContextSwitchTo((MemoryContext) pmem);
......@@ -288,11 +288,11 @@ vc_getrels(NameData *VacRelP)
StartTransactionCommand();
if (VacRelP->data)
if (NameStr(*VacRelP))
{
ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relname,
F_NAMEEQ,
PointerGetDatum(VacRelP->data));
PointerGetDatum(NameStr(*VacRelP)));
}
else
{
......@@ -402,7 +402,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
vacrelstats->relid = relid;
vacrelstats->num_pages = vacrelstats->num_tuples = 0;
vacrelstats->hasindex = false;
if (analyze && !IsSystemRelationName((RelationGetRelationName(onerel))->data))
if (analyze && !IsSystemRelationName(RelationGetRelationName(onerel)))
{
int attr_cnt,
*attnums = NULL;
......@@ -418,7 +418,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
if (length(va_cols) > attr_cnt)
elog(ERROR, "vacuum: too many attributes specified for relation %s",
(RelationGetRelationName(onerel))->data);
RelationGetRelationName(onerel));
attnums = (int *) palloc(attr_cnt * sizeof(int));
foreach(le, va_cols)
{
......@@ -434,7 +434,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
else
{
elog(ERROR, "vacuum: there is no attribute %s in %s",
col, (RelationGetRelationName(onerel))->data);
col, RelationGetRelationName(onerel));
}
}
attr_cnt = tcnt;
......@@ -625,7 +625,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
getrusage(RUSAGE_SELF, &ru0);
relname = (RelationGetRelationName(onerel))->data;
relname = RelationGetRelationName(onerel);
elog(MESSAGE_LEVEL, "--Relation %s--", relname);
tups_vacuumed = num_tuples = nkeep = nunused = ncrash = empty_pages =
......@@ -1762,7 +1762,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
elog(MESSAGE_LEVEL, "Rel %s: Pages: %u --> %u; Tuple(s) moved: %u. \
Elapsed %u/%u sec.",
(RelationGetRelationName(onerel))->data,
RelationGetRelationName(onerel),
nblocks, blkno, num_moved,
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
......@@ -1895,7 +1895,7 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages)
Assert(vacrelstats->num_pages >= vacuum_pages->vpl_empty_end_pages);
nblocks = vacrelstats->num_pages - vacuum_pages->vpl_empty_end_pages;
elog(MESSAGE_LEVEL, "Rel %s: Pages: %u --> %u.",
(RelationGetRelationName(onerel))->data,
RelationGetRelationName(onerel),
vacrelstats->num_pages, nblocks);
/*
......@@ -1971,13 +1971,13 @@ vc_scanoneind(Relation indrel, int num_tuples)
getrusage(RUSAGE_SELF, &ru1);
elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %u. Elapsed %u/%u sec.",
indrel->rd_rel->relname.data, nipages, nitups,
RelationGetRelationName(indrel), nipages, nitups,
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
if (nitups != num_tuples)
elog(NOTICE, "Index %s: NUMBER OF INDEX' TUPLES (%u) IS NOT THE SAME AS HEAP' (%u)",
indrel->rd_rel->relname.data, nitups, num_tuples);
RelationGetRelationName(indrel), nitups, num_tuples);
} /* vc_scanoneind */
......@@ -2030,7 +2030,7 @@ vc_vaconeind(VPageList vpl, Relation indrel, int num_tuples, int keep_tuples)
if (vp->vpd_offsets_free == 0)
{ /* this is EmptyPage !!! */
elog(NOTICE, "Index %s: pointer to EmptyPage (blk %u off %u) - fixing",
indrel->rd_rel->relname.data,
RelationGetRelationName(indrel),
vp->vpd_blkno, ItemPointerGetOffsetNumber(heapptr));
}
++tups_vacuumed;
......@@ -2051,14 +2051,14 @@ vc_vaconeind(VPageList vpl, Relation indrel, int num_tuples, int keep_tuples)
getrusage(RUSAGE_SELF, &ru1);
elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %u: Deleted %u. Elapsed %u/%u sec.",
indrel->rd_rel->relname.data, num_pages,
RelationGetRelationName(indrel), num_pages,
num_index_tuples - keep_tuples, tups_vacuumed,
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
if (num_index_tuples != num_tuples + keep_tuples)
elog(NOTICE, "Index %s: NUMBER OF INDEX' TUPLES (%u) IS NOT THE SAME AS HEAP' (%u)",
indrel->rd_rel->relname.data, num_index_tuples, num_tuples);
RelationGetRelationName(indrel), num_index_tuples, num_tuples);
} /* vc_vaconeind */
......@@ -2398,7 +2398,7 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
* problem
*/
if (VacAttrStatsLtGtValid(stats) && stats->initialized
/* && !IsSystemRelationName(pgcform->relname.data)
/* && !IsSystemRelationName(NameData(pgcform->relname))
*/ )
{
float32data nullratio;
......
......@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.99 1999/11/01 05:09:17 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.100 1999/11/07 23:08:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -559,7 +559,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
if (resultRelationDesc->rd_rel->relkind == RELKIND_SEQUENCE)
elog(ERROR, "You can't change sequence relation %s",
resultRelationDesc->rd_rel->relname.data);
RelationGetRelationName(resultRelationDesc));
resultRelationInfo = makeNode(RelationInfo);
resultRelationInfo->ri_RangeTableIndex = resultRelationIndex;
......@@ -1501,7 +1501,7 @@ ExecRelCheck(Relation rel, HeapTuple tuple, EState *estate)
slot->ttc_tupleDescriptor = rel->rd_att;
slot->ttc_buffer = InvalidBuffer;
slot->ttc_whichplan = -1;
rte->relname = nameout(&(rel->rd_rel->relname));
rte->relname = RelationGetRelationName(rel);
rte->refname = rte->relname;
rte->relid = RelationGetRelid(rel);
/* inh, inFromCl, inJoinSet, skipAcl won't be used, leave them zero */
......@@ -1538,7 +1538,6 @@ ExecRelCheck(Relation rel, HeapTuple tuple, EState *estate)
}
pfree(slot);
pfree(rte->relname);
pfree(rte);
pfree(rtlist);
pfree(econtext);
......@@ -1561,7 +1560,7 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple, EState *estate)
{
if (rel->rd_att->attrs[attrChk - 1]->attnotnull && heap_attisnull(tuple, attrChk))
elog(ERROR, "%s: Fail to add null value in not null attribute %s",
caller, rel->rd_att->attrs[attrChk - 1]->attname.data);
caller, NameStr(rel->rd_att->attrs[attrChk - 1]->attname));
}
}
......
......@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.30 1999/09/24 00:24:23 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.31 1999/11/07 23:08:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -913,7 +913,7 @@ ExecTypeFromTL(List *targetList)
(Oid) restype,
resdom->resno,
resdom->reslen,
resdom->resname->data,
NameStr(*resdom->resname),
get_typbyval(restype),
get_typalign(restype));
*/
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.49 1999/09/18 19:06:48 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.50 1999/11/07 23:08:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -546,9 +546,9 @@ ExecSetTypeInfo(int index,
att->attrelid = 0; /* dummy value */
if (attName != (char *) NULL)
StrNCpy(att->attname.data, attName, NAMEDATALEN);
StrNCpy(NameStr(att->attname), attName, NAMEDATALEN);
else
MemSet(att->attname.data, 0, NAMEDATALEN);
MemSet(NameStr(att->attname), 0, NAMEDATALEN);
att->atttypid = typeID;
att->attdefrel = 0; /* dummy value */
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.24 1999/07/17 20:16:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.25 1999/11/07 23:08:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -314,7 +314,7 @@ ExecInitUnique(Unique *node, EState *estate, Plan *parent)
* the parser should have ensured that uniqueAttr is a legal
* attribute name
*/
while (strcmp((tupDesc->attrs[i]->attname).data, uniqueAttr) != 0)
while (strcmp(NameStr(tupDesc->attrs[i]->attname), uniqueAttr) != 0)
i++;
node->uniqueAttrNum = i + 1; /* attribute numbers start from 1 */
}
......
......@@ -3,7 +3,7 @@
* spi.c
* Server Programming Interface
*
* $Id: spi.c,v 1.40 1999/07/15 22:39:11 momjian Exp $
* $Id: spi.c,v 1.41 1999/11/07 23:08:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -369,7 +369,7 @@ SPI_fnumber(TupleDesc tupdesc, char *fname)
for (res = 0; res < tupdesc->natts; res++)
{
if (strcasecmp(tupdesc->attrs[res]->attname.data, fname) == 0)
if (strcasecmp(NameStr(tupdesc->attrs[res]->attname), fname) == 0)
return res + 1;
}
......@@ -387,7 +387,7 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
return NULL;
}
return nameout(&(tupdesc->attrs[fnumber - 1]->attname));
return pstrdup(NameStr(tupdesc->attrs[fnumber - 1]->attname));
}
char *
......@@ -459,7 +459,7 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
return NULL;
}
return pstrdup(((Form_pg_type) GETSTRUCT(typeTuple))->typname.data);
return pstrdup(NameStr(((Form_pg_type) GETSTRUCT(typeTuple))->typname));
}
Oid
......@@ -479,7 +479,7 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
char *
SPI_getrelname(Relation rel)
{
return pstrdup(rel->rd_rel->relname.data);
return pstrdup(RelationGetRelationName(rel));
}
void *
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: be-dumpdata.c,v 1.30 1999/07/17 20:17:01 momjian Exp $
* $Id: be-dumpdata.c,v 1.31 1999/11/07 23:08:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -182,7 +182,8 @@ be_typeinit(PortalEntry *entry,
group->types = pbuf_addTypes(natts);
for (i = 0; i < natts; ++i)
{
strncpy(group->types[i].name, attrs[i]->attname.data, NAMEDATALEN);
strncpy(group->types[i].name,
NameStr(attrs[i]->attname), NAMEDATALEN);
group->types[i].typid = attrs[i]->atttypid;
group->types[i].typlen = attrs[i]->attlen;
}
......
......@@ -14,7 +14,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.32 1999/10/30 23:06:32 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.33 1999/11/07 23:08:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -133,7 +133,7 @@ expand_targetlist(List *tlist, int command_type,
for (attrno = 1; attrno <= numattrs; attrno++)
{
Form_pg_attribute att_tup = rel->rd_att->attrs[attrno-1];
char *attrname = att_tup->attname.data;
char *attrname = NameStr(att_tup->attname);
TargetEntry *new_tle = NULL;
/*
......
......@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: analyze.c,v 1.122 1999/11/01 05:06:21 tgl Exp $
* $Id: analyze.c,v 1.123 1999/11/07 23:08:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -407,7 +407,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
makeResdom(attrno,
thisatt->atttypid,
thisatt->atttypmod,
pstrdup(nameout(&(thisatt->attname))),
pstrdup(NameStr(thisatt->attname)),
0, 0, false),
stringToNode(defval[ndef].adbin));
qry->targetList = lappend(qry->targetList, te);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.60 1999/10/07 04:23:12 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.61 1999/11/07 23:08:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -321,7 +321,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
rd = heap_openr(typeidTypeName(toid), NoLock);
if (RelationIsValid(rd))
{
relname = RelationGetRelationName(rd)->data;
relname = RelationGetRelationName(rd);
heap_close(rd, NoLock);
}
else
......@@ -1160,7 +1160,7 @@ find_inheritors(Oid relid, Oid **supervec)
rd = heap_open(qentry->sqe_relid, NoLock);
if (! RelationIsValid(rd))
elog(ERROR, "Relid %u does not exist", qentry->sqe_relid);
qentry->sqe_relid = typeTypeId(typenameType(RelationGetRelationName(rd)->data));
qentry->sqe_relid = typeTypeId(typenameType(RelationGetRelationName(rd)));
heap_close(rd, NoLock);
DLAddTail(visited, qe);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.32 1999/10/07 04:23:12 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.33 1999/11/07 23:08:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -265,7 +265,7 @@ expandAll(ParseState *pstate, char *relname, char *refname, int *this_resno)
Var *varnode;
TargetEntry *te = makeNode(TargetEntry);
attrname = pstrdup(rel->rd_att->attrs[varattno]->attname.data);
attrname = pstrdup(NameStr(rel->rd_att->attrs[varattno]->attname));
varnode = make_var(pstate, rte->relid, refname, attrname);
/*
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.47 1999/11/01 05:06:21 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.48 1999/11/07 23:08:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -197,7 +197,7 @@ updateTargetListEntry(ParseState *pstate,
Node *arrayBase;
ArrayRef *aref;
att->relname = pstrdup(RelationGetRelationName(rd)->data);
att->relname = pstrdup(RelationGetRelationName(rd));
att->attrs = lcons(makeString(colname), NIL);
arrayBase = ParseNestedFuncOrColumn(pstate, att,
&pstate->p_last_resno,
......@@ -381,7 +381,7 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
Ident *id = makeNode(Ident);
id->name = palloc(NAMEDATALEN);
StrNCpy(id->name, attr[i]->attname.data, NAMEDATALEN);
StrNCpy(id->name, NameStr(attr[i]->attname), NAMEDATALEN);
id->indirection = NIL;
id->isRel = false;
cols = lappend(cols, id);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.25 1999/08/05 02:33:54 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.26 1999/11/07 23:08:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -47,7 +47,7 @@ typeidTypeName(Oid id)
return NULL;
}
typetuple = (Form_pg_type) GETSTRUCT(tup);
return (typetuple->typname).data;
return NameStr(typetuple->typname);
}
/* return a Type structure, given a type id */
......@@ -118,7 +118,7 @@ typeTypeName(Type t)
Form_pg_type typ;
typ = (Form_pg_type) GETSTRUCT(t);
return (typ->typname).data;
return NameStr(typ->typname);
}
/* given a type, return its typetype ('c' for 'c'atalog types) */
......
......@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.23 1999/10/01 04:08:24 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.24 1999/11/07 23:08:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -179,7 +179,7 @@ checkLockPerms(List *locks, Query *parsetree, int rt_index)
ev_rel->rd_rel->relowner);
}
heap_close(ev_rel, AccessShareLock);
evowner = nameout(&(((Form_pg_shadow) GETSTRUCT(usertup))->usename));
evowner = pstrdup(NameStr(((Form_pg_shadow) GETSTRUCT(usertup))->usename));
/*
* Check all the locks, that should get fired on this query
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.38 1999/10/21 02:33:25 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.39 1999/11/07 23:08:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -118,9 +118,9 @@ InsertRule(char *rulname,
appendStringInfo(&rulebuf, "::text, '%s'::bool);",
is_instead);
pg_exec_query_dest(rulebuf.data, None, true);
pg_exec_query_dest(NameStr(rulebuf), None, true);
pfree(rulebuf.data);
pfree(NameStr(rulebuf));
return LastOidProcessed;
}
......@@ -272,7 +272,7 @@ DefineQueryRewrite(RuleStmt *stmt)
tle = (TargetEntry *) nth(i - 1, query->targetList);
resdom = tle->resdom;
attr = event_relation->rd_att->attrs[i - 1];
attname = nameout(&(attr->attname));
attname = pstrdup(NameStr(attr->attname));
if (strcmp(resdom->resname, attname) != 0)
elog(ERROR, "select rules target entry %d has different column name from %s", i, attname);
......@@ -295,7 +295,8 @@ DefineQueryRewrite(RuleStmt *stmt)
rule = event_relation->rd_rules->rules[i];
if (rule->event == CMD_SELECT)
elog(ERROR, "%s is already a view", nameout(&(event_relation->rd_rel->relname)));
elog(ERROR, "%s is already a view",
RelationGetRelationName(event_relation));
}
}
......
......@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.41 1999/10/01 04:08:24 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.42 1999/11/07 23:08:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -564,12 +564,12 @@ HandleRIRAttributeRule_mutator(Node *node,
{
NameData name_to_look_for;
name_to_look_for.data[0] = '\0';
NameStr(name_to_look_for)[0] = '\0';
namestrcpy(&name_to_look_for,
(char *) get_attname(getrelid(this_varno,
context->rtable),
this_varattno));
if (name_to_look_for.data[0])
if (NameStr(name_to_look_for)[0])
{
Node *n;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.30 1999/10/26 03:12:35 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.31 1999/11/07 23:08:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -46,7 +46,7 @@ RewriteGetRuleEventRel(char *rulename)
if (!HeapTupleIsValid(htup))
elog(ERROR, "Class '%u' not found", eventrel);
return ((Form_pg_class) GETSTRUCT(htup))->relname.data;
return NameStr(((Form_pg_class) GETSTRUCT(htup))->relname);
}
/* ----------------------------------------------------------------
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.64 1999/09/28 11:41:06 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.65 1999/11/07 23:08:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -622,7 +622,7 @@ BufferAlloc(Relation reln,
}
/* record the database name and relation name for this buffer */
strcpy(buf->sb_relname, reln->rd_rel->relname.data);
strcpy(buf->sb_relname, RelationGetRelationName(reln));
strcpy(buf->sb_dbname, DatabaseName);
INIT_BUFFERTAG(&(buf->tag), reln, blockNum);
......@@ -1598,21 +1598,23 @@ FlushRelationBuffers(Relation rel, BlockNumber block, bool doFlush)
if (FlushBuffer(-i-1, false) != STATUS_OK)
{
elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is dirty, could not flush it",
rel->rd_rel->relname.data, block, buf->tag.blockNum);
RelationGetRelationName(rel),
block, buf->tag.blockNum);
return -1;
}
}
else
{
elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is dirty",
rel->rd_rel->relname.data, block, buf->tag.blockNum);
RelationGetRelationName(rel),
block, buf->tag.blockNum);
return -1;
}
}
if (LocalRefCount[i] > 0)
{
elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is referenced (%d)",
rel->rd_rel->relname.data, block,
RelationGetRelationName(rel), block,
buf->tag.blockNum, LocalRefCount[i]);
return -2;
}
......
......@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.60 1999/10/13 15:02:25 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.61 1999/11/07 23:08:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -210,7 +210,7 @@ inv_open(Oid lobjId, int flags)
r = heap_open(lobjId, AccessShareLock);
indname = pstrdup((r->rd_rel->relname).data);
indname = pstrdup(RelationGetRelationName(r));
/*
* hack hack hack... we know that the fourth character of the
......@@ -282,7 +282,7 @@ inv_destroy(Oid lobjId)
if (!RelationIsValid(r) || r->rd_rel->relkind != RELKIND_LOBJECT)
return -1;
heap_destroy_with_catalog(r->rd_rel->relname.data);
heap_destroy_with_catalog(RelationGetRelationName(r));
return 1;
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.63 1999/10/12 14:54:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.64 1999/11/07 23:08:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -46,7 +46,7 @@
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.63 1999/10/12 14:54:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.64 1999/11/07 23:08:17 momjian Exp $
*/
#include <sys/time.h>
#include <unistd.h>
......@@ -155,7 +155,6 @@ InitProcGlobal(IPCKey key, int maxBackends)
{
IPCKey semKey = ProcGlobal->currKey + i;
int semId;
int semstat;
semId = IpcSemaphoreCreate(semKey,
PROC_NSEMS_PER_SET,
......@@ -180,7 +179,6 @@ void
InitProcess(IPCKey key)
{
bool found = false;
int semstat;
unsigned long location,
myOffset;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.58 1999/11/04 08:01:00 inoue Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.59 1999/11/07 23:08:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -121,7 +121,7 @@ mdcreate(Relation reln)
char *path;
Assert(reln->rd_unlinked && reln->rd_fd < 0);
path = relpath(reln->rd_rel->relname.data);
path = relpath(RelationGetRelationName(reln));
#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
#else
......@@ -319,7 +319,7 @@ mdopen(Relation reln)
int vfd;
Assert(reln->rd_fd < 0);
path = relpath(reln->rd_rel->relname.data);
path = relpath(RelationGetRelationName(reln));
#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR, 0600);
......@@ -1011,7 +1011,7 @@ _mdfd_openseg(Relation reln, int segno, int oflags)
*fullpath;
/* be sure we have enough space for the '.segno', if any */
path = relpath(RelationGetRelationName(reln)->data);
path = relpath(RelationGetRelationName(reln));
dofree = false;
if (segno > 0)
......
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.30 1999/11/04 08:01:01 inoue Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.31 1999/11/07 23:08:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -131,7 +131,7 @@ smgrcreate(int16 which, Relation reln)
int fd;
if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0)
elog(ERROR, "cannot create %s", reln->rd_rel->relname.data);
elog(ERROR, "cannot create %s", RelationGetRelationName(reln));
return fd;
}
......@@ -147,7 +147,7 @@ smgrunlink(int16 which, Relation reln)
int status;
if ((status = (*(smgrsw[which].smgr_unlink)) (reln)) == SM_FAIL)
elog(ERROR, "cannot unlink %s", reln->rd_rel->relname.data);
elog(ERROR, "cannot unlink %s", RelationGetRelationName(reln));
return status;
}
......@@ -166,7 +166,8 @@ smgrextend(int16 which, Relation reln, char *buffer)
status = (*(smgrsw[which].smgr_extend)) (reln, buffer);
if (status == SM_FAIL)
elog(ERROR, "%s: cannot extend. Check free disk space.", reln->rd_rel->relname.data);
elog(ERROR, "%s: cannot extend. Check free disk space.",
RelationGetRelationName(reln));
return status;
}
......@@ -184,7 +185,7 @@ smgropen(int16 which, Relation reln)
if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0 &&
!reln->rd_unlinked)
elog(ERROR, "cannot open %s", reln->rd_rel->relname.data);
elog(ERROR, "cannot open %s", RelationGetRelationName(reln));
return fd;
}
......@@ -204,7 +205,7 @@ int
smgrclose(int16 which, Relation reln)
{
if ((*(smgrsw[which].smgr_close)) (reln) == SM_FAIL)
elog(ERROR, "cannot close %s", reln->rd_rel->relname.data);
elog(ERROR, "cannot close %s", RelationGetRelationName(reln));
return SM_SUCCESS;
}
......@@ -228,7 +229,7 @@ smgrread(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
if (status == SM_FAIL)
elog(ERROR, "cannot read block %d of %s",
blocknum, reln->rd_rel->relname.data);
blocknum, RelationGetRelationName(reln));
return status;
}
......@@ -250,7 +251,7 @@ smgrwrite(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
if (status == SM_FAIL)
elog(ERROR, "cannot write block %d of %s",
blocknum, reln->rd_rel->relname.data);
blocknum, RelationGetRelationName(reln));
return status;
}
......@@ -267,7 +268,7 @@ smgrflush(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
if (status == SM_FAIL)
elog(ERROR, "cannot flush block %d of %s to stable store",
blocknum, reln->rd_rel->relname.data);
blocknum, RelationGetRelationName(reln));
return status;
}
......@@ -326,7 +327,8 @@ smgrnblocks(int16 which, Relation reln)
int nblocks;
if ((nblocks = (*(smgrsw[which].smgr_nblocks)) (reln)) < 0)
elog(ERROR, "cannot count blocks for %s", reln->rd_rel->relname.data);
elog(ERROR, "cannot count blocks for %s",
RelationGetRelationName(reln));
return nblocks;
}
......@@ -348,7 +350,7 @@ smgrtruncate(int16 which, Relation reln, int nblocks)
{
if ((newblks = (*(smgrsw[which].smgr_truncate)) (reln, nblocks)) < 0)
elog(ERROR, "cannot truncate %s to %d blocks",
reln->rd_rel->relname.data, nblocks);
RelationGetRelationName(reln), nblocks);
}
return newblks;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.36 1999/07/17 20:17:50 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.37 1999/11/07 23:08:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -144,7 +144,7 @@ BeginCommand(char *pname,
for (i = 0; i < natts; ++i)
{
pq_sendstring(&buf, attrs[i]->attname.data);
pq_sendstring(&buf, NameStr(attrs[i]->attname));
pq_sendint(&buf, (int) attrs[i]->atttypid,
sizeof(attrs[i]->atttypid));
pq_sendint(&buf, attrs[i]->attlen,
......
......@@ -10,7 +10,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.31 1999/09/07 19:09:46 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.32 1999/11/07 23:08:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -82,7 +82,7 @@ namelike(NameData *n, struct varlena * p)
{
if (!n)
return FALSE;
return fixedlen_like(n->data, p, NAMEDATALEN);
return fixedlen_like(NameStr(*n), p, NAMEDATALEN);
}
bool
......
......@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.23 1999/07/17 20:17:58 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.24 1999/11/07 23:08:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -40,11 +40,11 @@ namein(char *s)
return NULL;
result = (NameData *) palloc(NAMEDATALEN);
/* always keep it null-padded */
StrNCpy(result->data, s, NAMEDATALEN);
len = strlen(result->data);
StrNCpy(NameStr(*result), s, NAMEDATALEN);
len = strlen(NameStr(*result));
while (len < NAMEDATALEN)
{
*(result->data + len) = '\0';
*(NameStr(*result) + len) = '\0';
len++;
}
return result;
......@@ -59,7 +59,7 @@ nameout(NameData *s)
if (s == NULL)
return "-";
else
return pstrdup(s->data);
return pstrdup(NameStr(*s));
}
......@@ -87,7 +87,7 @@ nameeq(NameData *arg1, NameData *arg2)
if (!arg1 || !arg2)
return 0;
else
return (bool) strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0;
return (bool) strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) == 0;
}
bool
......@@ -95,7 +95,7 @@ namene(NameData *arg1, NameData *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) != 0);
return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) != 0);
}
bool
......@@ -103,7 +103,7 @@ namelt(NameData *arg1, NameData *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) < 0);
return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) < 0);
}
bool
......@@ -111,7 +111,7 @@ namele(NameData *arg1, NameData *arg2)
{
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) <= 0);
return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) <= 0);
}
bool
......@@ -120,7 +120,7 @@ namegt(NameData *arg1, NameData *arg2)
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) > 0);
return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) > 0);
}
bool
......@@ -129,7 +129,7 @@ namege(NameData *arg1, NameData *arg2)
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) >= 0);
return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) >= 0);
}
......@@ -140,7 +140,7 @@ namecpy(Name n1, Name n2)
{
if (!n1 || !n2)
return -1;
strncpy(n1->data, n2->data, NAMEDATALEN);
strncpy(NameStr(*n1), NameStr(*n2), NAMEDATALEN);
return 0;
}
......@@ -148,7 +148,7 @@ namecpy(Name n1, Name n2)
int
namecat(Name n1, Name n2)
{
return namestrcat(n1, n2->data); /* n2 can't be any longer than n1 */
return namestrcat(n1, NameStr(*n2)); /* n2 can't be any longer than n1 */
}
#endif
......@@ -157,7 +157,7 @@ namecat(Name n1, Name n2)
int
namecmp(Name n1, Name n2)
{
return strncmp(n1->data, n2->data, NAMEDATALEN);
return strncmp(NameStr(*n1), NameStr(*n2), NAMEDATALEN);
}
#endif
......@@ -167,7 +167,7 @@ namestrcpy(Name name, char *str)
{
if (!name || !str)
return -1;
StrNCpy(name->data, str, NAMEDATALEN);
StrNCpy(NameStr(*name), str, NAMEDATALEN);
return 0;
}
......@@ -181,7 +181,7 @@ namestrcat(Name name, char *str)
if (!name || !str)
return -1;
for (i = 0, p = name->data; i < NAMEDATALEN && *p; ++i, ++p)
for (i = 0, p = NameStr(*name); i < NAMEDATALEN && *p; ++i, ++p)
;
for (q = str; i < NAMEDATALEN; ++i, ++p, ++q)
{
......@@ -203,7 +203,7 @@ namestrcmp(Name name, char *str)
return -1; /* NULL < anything */
if (!str)
return 1; /* NULL < anything */
return strncmp(name->data, str, NAMEDATALEN);
return strncmp(NameStr(*name), str, NAMEDATALEN);
}
/*****************************************************************************
......@@ -217,7 +217,7 @@ NameComputeLength(Name name)
char *charP;
int length;
for (length = 0, charP = name->data;
for (length = 0, charP = NameStr(*name);
length < NAMEDATALEN && *charP != '\0';
length++, charP++)
;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.28 1999/07/17 20:17:59 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.29 1999/11/07 23:08:24 momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
......@@ -200,7 +200,7 @@ nameregexeq(NameData *n, struct varlena * p)
{
if (!n)
return FALSE;
return fixedlen_regexeq(n->data, p, NAMEDATALEN, REG_EXTENDED);
return fixedlen_regexeq(NameStr(*n), p, NAMEDATALEN, REG_EXTENDED);
}
bool
......@@ -248,7 +248,7 @@ nameicregexeq(NameData *n, struct varlena * p)
{
if (!n)
return FALSE;
return (fixedlen_regexeq(n->data, p, NAMEDATALEN,
return (fixedlen_regexeq(NameStr(*n), p, NAMEDATALEN,
REG_ICASE | REG_EXTENDED));
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.43 1999/09/18 19:07:49 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.44 1999/11/07 23:08:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -173,7 +173,7 @@ regprocout(RegProcedure proid)
{
char *s;
s = ((Form_pg_proc) GETSTRUCT(proctup))->proname.data;
s = NameStr(((Form_pg_proc) GETSTRUCT(proctup))->proname);
StrNCpy(result, s, NAMEDATALEN);
}
else
......@@ -261,7 +261,7 @@ oid8types(Oid *oidArray)
{
char *s;
s = ((Form_pg_type) GETSTRUCT(typetup))->typname.data;
s = NameStr(((Form_pg_type) GETSTRUCT(typetup))->typname);
StrNCpy(VARDATA(result) + strlen(VARDATA(result)), s,
NAMEDATALEN);
strcat(VARDATA(result), " ");
......
......@@ -3,7 +3,7 @@
* out of it's tuple
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.29 1999/10/31 18:57:42 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.30 1999/11/07 23:08:24 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
......@@ -138,7 +138,7 @@ pg_get_ruledef(NameData *rname)
* We need the rules name somewhere deep down
* ----------
*/
rulename = nameout(rname);
rulename = pstrdup(NameStr(*rname));
/* ----------
* Connect to SPI manager
......@@ -238,7 +238,7 @@ pg_get_viewdef(NameData *rname)
* We need the rules name somewhere deep down
* ----------
*/
rulename = nameout(rname);
rulename = pstrdup(NameStr(*rname));
/* ----------
* Connect to SPI manager
......@@ -410,10 +410,10 @@ pg_get_indexdef(Oid indexrelid)
spirc = SPI_execp(plan_getam, spi_args, spi_nulls, 1);
if (spirc != SPI_OK_SELECT)
elog(ERROR, "failed to get pg_am tuple for index %s",
nameout(&(idxrelrec->relname)));
idxrelrec->relname);
if (SPI_processed != 1)
elog(ERROR, "failed to get pg_am tuple for index %s",
nameout(&(idxrelrec->relname)));
idxrelrec->relname);
spi_tup = SPI_tuptable->vals[0];
spi_ttc = SPI_tuptable->tupdesc;
spi_fno = SPI_fnumber(spi_ttc, "amname");
......@@ -425,8 +425,8 @@ pg_get_indexdef(Oid indexrelid)
initStringInfo(&buf);
appendStringInfo(&buf, "CREATE %sINDEX %s ON %s USING %s (",
idxrec->indisunique ? "UNIQUE " : "",
quote_identifier(nameout(&(idxrelrec->relname))),
quote_identifier(nameout(&(indrelrec->relname))),
quote_identifier(pstrdup(NameStr(idxrelrec->relname))),
quote_identifier(pstrdup(NameStr(indrelrec->relname))),
quote_identifier(SPI_getvalue(spi_tup, spi_ttc,
spi_fno)));
......@@ -491,7 +491,7 @@ pg_get_indexdef(Oid indexrelid)
procStruct = (Form_pg_proc) GETSTRUCT(proctup);
appendStringInfo(&buf, "%s(%s) ",
quote_identifier(nameout(&(procStruct->proname))),
quote_identifier(pstrdup(NameStr(procStruct->proname))),
keybuf.data);
spi_args[0] = ObjectIdGetDatum(idxrec->indclass[0]);
......@@ -561,7 +561,7 @@ pg_get_userbyid(int32 uid)
* ----------
*/
result = (NameData *) palloc(NAMEDATALEN);
memset(result->data, 0, NAMEDATALEN);
memset(NameStr(*result), 0, NAMEDATALEN);
/* ----------
* Get the pg_shadow entry and print the result
......@@ -572,7 +572,7 @@ pg_get_userbyid(int32 uid)
if (HeapTupleIsValid(usertup))
{
user_rec = (Form_pg_shadow) GETSTRUCT(usertup);
StrNCpy(result->data, (&(user_rec->usename))->data, NAMEDATALEN);
StrNCpy(NameStr(*result), NameStr(user_rec->usename), NAMEDATALEN);
}
else
sprintf((char *) result, "unknown (UID=%d)", uid);
......@@ -1446,7 +1446,7 @@ get_func_expr(Expr *expr, deparse_context *context)
elog(ERROR, "cache lookup for proc %u failed", func->funcid);
procStruct = (Form_pg_proc) GETSTRUCT(proctup);
proname = nameout(&(procStruct->proname));
proname = pstrdup(NameStr(procStruct->proname));
/*
* nullvalue() and nonnullvalue() should get turned into special syntax
......@@ -1555,7 +1555,8 @@ get_tle_expr(TargetEntry *tle, deparse_context *context)
elog(ERROR, "cache lookup for type %u failed",
procStruct->prorettype);
typeStruct = (Form_pg_type) GETSTRUCT(tup);
if (strncmp(procStruct->proname.data, typeStruct->typname.data,
if (strncmp(NameStr(procStruct->proname),
NameStr(typeStruct->typname),
NAMEDATALEN) != 0)
{
get_rule_expr(tle->expr, context);
......@@ -1662,7 +1663,7 @@ get_const_expr(Const *constval, deparse_context *context)
/* These types can be left unlabeled */
break;
default:
extval = (char *) nameout(&(typeStruct->typname));
extval = pstrdup(NameStr(typeStruct->typname));
appendStringInfo(buf, "::%s", quote_identifier(extval));
pfree(extval);
break;
......@@ -1800,7 +1801,7 @@ get_relation_name(Oid relid)
elog(ERROR, "cache lookup of relation %u failed", relid);
classStruct = (Form_pg_class) GETSTRUCT(classtup);
return nameout(&(classStruct->relname));
return pstrdup(NameStr(classStruct->relname));
}
......@@ -1823,7 +1824,7 @@ get_attribute_name(Oid relid, int2 attnum)
attnum, relid);
attStruct = (Form_pg_attribute) GETSTRUCT(atttup);
return nameout(&(attStruct->attname));
return pstrdup(NameStr(attStruct->attname));
}
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.54 1999/07/17 20:18:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.55 1999/11/07 23:08:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -273,12 +273,12 @@ bpchar_name(char *s)
#endif
result = (NameData *) palloc(NAMEDATALEN);
StrNCpy(result->data, VARDATA(s), NAMEDATALEN);
StrNCpy(NameStr(*result), VARDATA(s), NAMEDATALEN);
/* now null pad to full length... */
while (len < NAMEDATALEN)
{
*(result->data + len) = '\0';
*(NameStr(*result) + len) = '\0';
len++;
}
......@@ -297,7 +297,7 @@ name_bpchar(NameData *s)
if (s == NULL)
return NULL;
len = strlen(s->data);
len = strlen(NameStr(*s));
#ifdef STRINGDEBUG
printf("bpchar- convert string length %d (%d) ->%d\n",
......@@ -305,7 +305,7 @@ name_bpchar(NameData *s)
#endif
result = (char *) palloc(VARHDRSZ + len);
strncpy(VARDATA(result), s->data, len);
strncpy(VARDATA(result), NameStr(*s), len);
VARSIZE(result) = len + VARHDRSZ;
return result;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.53 1999/07/17 20:18:00 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.54 1999/11/07 23:08:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -801,12 +801,12 @@ text_name(text *s)
#endif
result = palloc(NAMEDATALEN);
StrNCpy(result->data, VARDATA(s), NAMEDATALEN);
StrNCpy(NameStr(*result), VARDATA(s), NAMEDATALEN);
/* now null pad to full length... */
while (len < NAMEDATALEN)
{
*(result->data + len) = '\0';
*(NameStr(*result) + len) = '\0';
len++;
}
......@@ -825,7 +825,7 @@ name_text(NameData *s)
if (s == NULL)
return NULL;
len = strlen(s->data);
len = strlen(NameStr(*s));
#ifdef STRINGDEBUG
printf("text- convert string length %d (%d) ->%d\n",
......@@ -833,7 +833,7 @@ name_text(NameData *s)
#endif
result = palloc(VARHDRSZ + len);
strncpy(VARDATA(result), s->data, len);
strncpy(VARDATA(result), NameStr(*s), len);
VARSIZE(result) = len + VARHDRSZ;
return result;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.50 1999/11/01 02:29:25 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.51 1999/11/07 23:08:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -209,7 +209,7 @@ CatalogCacheInitializeCache(struct catcache * cache,
cache->cc_skey[i].sk_nargs = cache->cc_skey[i].sk_func.fn_nargs;
CACHE5_elog(DEBUG, "CatalogCacheInit %s %d %d %x",
&relation->rd_rel->relname,
RelationGetRelationName(relation),
i,
tupdesc->attrs[cache->cc_key[i] - 1]->attlen,
cache);
......@@ -304,7 +304,7 @@ comphash(long l, char *v)
* typelen so this may break them - XXX
*/
namestrcpy(&n, v);
v = n.data;
v = NameStr(n);
}
else if (l < 0)
l = VARSIZE(v);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.27 1999/07/16 05:00:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.28 1999/11/07 23:08:26 momjian Exp $
*
* Note - this code is real crufty...
*
......@@ -584,7 +584,7 @@ RelationInvalidateHeapTuple(Relation relation, HeapTuple tuple)
* this only works for system relations now
* ----------------
*/
if (!IsSystemRelationName(RelationGetForm(relation)->relname.data))
if (!IsSystemRelationName(NameStr(RelationGetForm(relation)->relname)))
return;
/* ----------------
......
......@@ -6,7 +6,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.34 1999/09/09 02:36:04 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.35 1999/11/07 23:08:26 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
......@@ -62,7 +62,7 @@ get_attname(Oid relid, AttrNumber attnum)
if (HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
return pstrdup(att_tup->attname.data);
return pstrdup(NameStr(att_tup->attname));
}
else
return NULL;
......@@ -292,7 +292,7 @@ get_opname(Oid opno)
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
return pstrdup(optup->oprname.data);
return pstrdup(NameStr(optup->oprname));
}
else
return NULL;
......@@ -529,7 +529,7 @@ get_rel_name(Oid relid)
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
return pstrdup(reltup->relname.data);
return pstrdup(NameStr(reltup->relname));
}
else
return NULL;
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.75 1999/11/04 08:00:59 inoue Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.76 1999/11/07 23:08:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -133,7 +133,7 @@ typedef struct relnamecacheent
do { \
RelIdCacheEnt *idhentry; RelNameCacheEnt *namehentry; \
char *relname; Oid reloid; bool found; \
relname = (RELATION->rd_rel->relname).data; \
relname = RelationGetRelationName(RELATION); \
namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
relname, \
HASH_ENTER, \
......@@ -186,7 +186,7 @@ do { \
do { \
RelNameCacheEnt *namehentry; RelIdCacheEnt *idhentry; \
char *relname; Oid reloid; bool found; \
relname = (RELATION->rd_rel->relname).data; \
relname = RelationGetRelationName(RELATION); \
namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
relname, \
HASH_REMOVE, \
......@@ -534,7 +534,7 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
if (!HeapTupleIsValid(atttup))
elog(ERROR, "cannot find attribute %d of relation %s", i,
relation->rd_rel->relname.data);
RelationGetRelationName(relation));
attp = (Form_pg_attribute) GETSTRUCT(atttup);
relation->rd_att->attrs[i - 1] =
......@@ -962,7 +962,7 @@ formrdesc(char *relationName,
relation->rd_rel = (Form_pg_class)
palloc((Size) (sizeof(*relation->rd_rel)));
MemSet(relation->rd_rel, 0, sizeof(FormData_pg_class));
namestrcpy(&relation->rd_rel->relname, relationName);
strcpy(RelationGetRelationName(relation), relationName);
/* ----------------
initialize attribute tuple form
......@@ -1092,7 +1092,7 @@ RelationNameCacheGetRelation(char *relationName)
* null-padded
*/
namestrcpy(&name, relationName);
RelationNameCacheLookup(name.data, rd);
RelationNameCacheLookup(NameStr(name), rd);
if (RelationIsValid(rd))
{
......@@ -1373,7 +1373,7 @@ RelationForgetRelation(Oid rid)
}
if (curr == NIL)
elog(FATAL, "Local relation %s not found in list",
(RelationGetRelationName(relation))->data);
RelationGetRelationName(relation));
if (prev == NIL)
newlyCreatedRelns = lnext(newlyCreatedRelns);
else
......@@ -1745,16 +1745,16 @@ AttrDefaultFetch(Relation relation)
continue;
if (attrdef[i].adbin != NULL)
elog(ERROR, "AttrDefaultFetch: second record found for attr %s in rel %s",
relation->rd_att->attrs[adform->adnum - 1]->attname.data,
relation->rd_rel->relname.data);
NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
RelationGetRelationName(relation));
val = (struct varlena *) fastgetattr(&tuple,
Anum_pg_attrdef_adbin,
adrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "AttrDefaultFetch: adbin IS NULL for attr %s in rel %s",
relation->rd_att->attrs[adform->adnum - 1]->attname.data,
relation->rd_rel->relname.data);
NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
RelationGetRelationName(relation));
attrdef[i].adbin = textout(val);
break;
}
......@@ -1763,12 +1763,12 @@ AttrDefaultFetch(Relation relation)
if (i >= ndef)
elog(ERROR, "AttrDefaultFetch: unexpected record found for attr %d in rel %s",
adform->adnum,
relation->rd_rel->relname.data);
RelationGetRelationName(relation));
}
if (found < ndef)
elog(ERROR, "AttrDefaultFetch: %d record not found for rel %s",
ndef - found, relation->rd_rel->relname.data);
ndef - found, RelationGetRelationName(relation));
index_endscan(sd);
pfree(sd);
......@@ -1818,21 +1818,21 @@ RelCheckFetch(Relation relation)
continue;
if (found == ncheck)
elog(ERROR, "RelCheckFetch: unexpected record found for rel %s",
relation->rd_rel->relname.data);
RelationGetRelationName(relation));
rcname = (Name) fastgetattr(&tuple,
Anum_pg_relcheck_rcname,
rcrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelCheckFetch: rcname IS NULL for rel %s",
relation->rd_rel->relname.data);
check[found].ccname = nameout(rcname);
RelationGetRelationName(relation));
check[found].ccname = pstrdup(NameStr(*rcname));
val = (struct varlena *) fastgetattr(&tuple,
Anum_pg_relcheck_rcbin,
rcrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
relation->rd_rel->relname.data);
RelationGetRelationName(relation));
check[found].ccbin = textout(val);
found++;
ReleaseBuffer(buffer);
......@@ -1841,7 +1841,7 @@ RelCheckFetch(Relation relation)
if (found < ncheck)
elog(ERROR, "RelCheckFetch: %d record not found for rel %s",
ncheck - found,
relation->rd_rel->relname.data);
RelationGetRelationName(relation));
index_endscan(sd);
pfree(sd);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.14 1999/09/04 22:03:09 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.15 1999/11/07 23:08:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -62,8 +62,8 @@ create_temp_relation(char *relname, HeapTuple pg_class_tuple)
/* save user-supplied name */
strcpy(temp_rel->user_relname, relname);
StrNCpy(temp_rel->relname, ((Form_pg_class)
GETSTRUCT(pg_class_tuple))->relname.data, NAMEDATALEN);
StrNCpy(temp_rel->relname, NameStr(((Form_pg_class)
GETSTRUCT(pg_class_tuple))->relname), NAMEDATALEN);
temp_rel->relid = pg_class_tuple->t_data->t_oid;
temp_rel->relkind = ((Form_pg_class) GETSTRUCT(pg_class_tuple))->relkind;
temp_rel->xid = GetCurrentTransactionId();
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.35 1999/10/02 21:33:25 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.36 1999/11/07 23:08:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -78,7 +78,7 @@ fmgr_dynamic(Oid procedureId, int *pronargs)
}
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
proname = procedureStruct->proname.data;
proname = NameStr(procedureStruct->proname);
pronargs_save = *pronargs = procedureStruct->pronargs;
probinattr = heap_getattr(procedureTuple,
Anum_pg_proc_probin,
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.31 1999/10/25 03:07:52 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.32 1999/11/07 23:08:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -254,7 +254,7 @@ GetRawDatabaseInfo(char *name, Oid *db_id, char *path)
*/
tup_db = (Form_pg_database) GETSTRUCT(&tup);
if (strcmp(name, tup_db->datname.data) == 0)
if (strcmp(name, NameStr(tup_db->datname)) == 0)
{
/* Found it; extract the OID and the database path. */
*db_id = tup.t_data->t_oid;
......
......@@ -133,7 +133,7 @@ MainLoop(PsqlSettings *pset, FILE *source)
*/
/* No more input. Time to quit, or \i done */
if (line == NULL || (!pset->cur_cmd_interactive && *line == '\0'))
if (line == NULL)
{
if (GetVariableBool(pset->vars, "echo") && !GetVariableBool(pset->vars, "quiet"))
puts("EOF\n");
......
......@@ -79,7 +79,7 @@ SetVariable(VariableSpace space, const char *name, const char *value)
if (strspn(name, VALID_VARIABLE_CHARS) != strlen(name))
return false;
for (current = space; current; previous = current, current = current->next)
for (current = space, previous = NULL; current; previous = current, current = current->next)
{
#ifdef USE_ASSERT_CHECKING
assert(current->name);
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 1995, Regents of the University of California
*
* $Id: postgres.h,v 1.29 1999/11/04 08:01:07 inoue Exp $
* $Id: postgres.h,v 1.30 1999/11/07 23:08:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -115,6 +115,8 @@ typedef union nameData
} NameData;
typedef NameData *Name;
#define NameStr(name) ((name).data)
/* ----------------------------------------------------------------
* Section 3: TransactionId and CommandId
* ----------------------------------------------------------------
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: rel.h,v 1.28 1999/11/04 08:01:09 inoue Exp $
* $Id: rel.h,v 1.29 1999/11/07 23:08:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -176,7 +176,7 @@ typedef Relation *RelationPtr;
*
* Returns a Relation Name
*/
#define RelationGetRelationName(relation) (&(relation)->rd_rel->relname)
#define RelationGetRelationName(relation) (NameStr((relation)->rd_rel->relname))
/*
* RelationGetNumberOfAttributes
......
......@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.11 1999/09/21 21:10:37 momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.12 1999/11/07 23:08:34 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
......@@ -1212,7 +1212,7 @@ plpgsql_parse_wordrowtype(char *string)
strcat(var->refname, ".");
strcat(var->refname, cp);
var->datatype = malloc(sizeof(PLpgSQL_type));
var->datatype->typname = strdup(nameout(&(typeStruct->typname)));
var->datatype->typname = strdup(NameStr(typeStruct->typname));
var->datatype->typoid = typetup->t_data->t_oid;
fmgr_info(typeStruct->typinput, &(var->datatype->typinput));
var->datatype->typbyval = typeStruct->typbyval;
......
......@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.13 1999/07/15 15:21:47 momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.14 1999/11/07 23:08:35 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
......@@ -659,7 +659,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
var = (PLpgSQL_var *) (estate.datums[func->tg_relname_varno]);
var->isnull = false;
var->value = (Datum) namein(nameout(&(trigdata->tg_relation->rd_rel->relname)));
var->value = (Datum) namein(RelationGetRelationName(trigdata->tg_relation));
var = (PLpgSQL_var *) (estate.datums[func->tg_nargs_varno]);
var->isnull = false;
......
......@@ -3,7 +3,7 @@
* procedural language (PL)
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.13 1999/07/15 15:21:50 momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.14 1999/11/07 23:08:36 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
......@@ -920,7 +920,8 @@ pltcl_trigger_handler(FmgrInfo *proinfo)
/* A list of attribute names for argument TG_relatts */
Tcl_DStringAppendElement(&tcl_trigtup, "");
for (i = 0; i < tupdesc->natts; i++)
Tcl_DStringAppendElement(&tcl_trigtup, tupdesc->attrs[i]->attname.data);
Tcl_DStringAppendElement(&tcl_trigtup,
NameStr(tupdesc->attrs[i]->attname));
Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
Tcl_DStringFree(&tcl_trigtup);
Tcl_DStringInit(&tcl_trigtup);
......@@ -2125,7 +2126,7 @@ pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
/************************************************************
* Get the attribute name
************************************************************/
attname = tupdesc->attrs[i]->attname.data;
attname = NameStr(tupdesc->attrs[i]->attname);
/************************************************************
* Get the attributes value
......@@ -2198,7 +2199,7 @@ pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
/************************************************************
* Get the attribute name
************************************************************/
attname = tupdesc->attrs[i]->attname.data;
attname = NameStr(tupdesc->attrs[i]->attname);
/************************************************************
* Get the attributes value
......
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