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