Fewer calls to nameout.
Better use of RelationGetRelationName.
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
{
printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, typmod = %d, byval = %c)\n",
attributeId,
- attributeP->attname.data,
+ NameStr(attributeP->attname),
value != NULL ? " = \"" : "",
value != NULL ? value : "",
value != NULL ? "\"" : "",
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.55 1999/10/03 23:55:25 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.56 1999/11/07 23:07:47 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
if (attributeName != NULL)
namestrcpy(&(att->attname), attributeName);
else
- MemSet(att->attname.data, 0, NAMEDATALEN);
+ MemSet(NameStr(att->attname), 0, NAMEDATALEN);
att->attdisbursion = 0; /* dummy value */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
if (oldPred == NULL && (nb = RelationGetNumberOfBlocks(index)) != 0)
- elog(ERROR, "%s already contains data", index->rd_rel->relname.data);
+ elog(ERROR, "%s already contains data", RelationGetRelationName(index));
/* initialize the root page (if this is a new index) */
if (oldPred == NULL)
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.19 1999/07/15 22:38:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.20 1999/11/07 23:07:49 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
int len;
char *key;
- key = n->data;
+ key = NameStr(*n);
h = 0;
len = NAMEDATALEN;
*
*
* 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
elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", buffer, nkeys, key);
elog(DEBUG, "heapgettup: relation(%c)=`%s', %p",
- relation->rd_rel->relkind, &relation->rd_rel->relname,
+ relation->rd_rel->relkind, RelationGetRelationName(relation),
snapshot);
#endif /* !defined(HEAPDEBUGALL) */
/* Under no circumstances will we return an index as a relation. */
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
- elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
+ elog(ERROR, "%s is an index relation", RelationGetRelationName(r));
if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */
/* Under no circumstances will we return an index as a relation. */
if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
- elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
+ elog(ERROR, "%s is an index relation", RelationGetRelationName(r));
if (lockmode == NoLock)
return r; /* caller must check RelationIsValid! */
#ifdef HEAPDEBUGALL
#define HEAPDEBUG_1 \
elog(DEBUG, "heap_getnext([%s,nkeys=%d],backw=%d) called", \
- scan->rs_rd->rd_rel->relname.data, scan->rs_nkeys, backw)
+ RelationGetRelationName(scan->rs_rd), scan->rs_nkeys, backw)
#define HEAPDEBUG_2 \
elog(DEBUG, "heap_getnext called with backw (no tracing yet)")
if (!BufferIsValid(buffer))
elog(ERROR, "heap_fetch: %s relation: ReadBuffer(%lx) failed",
- &relation->rd_rel->relname, (long) tid);
+ RelationGetRelationName(relation), (long) tid);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
if (!BufferIsValid(buffer))
elog(ERROR, "heap_get_latest_tid: %s relation: ReadBuffer(%lx) failed",
- &relation->rd_rel->relname, (long) tid);
+ RelationGetRelationName(relation), (long) tid);
LockBuffer(buffer, BUFFER_LOCK_SHARE);
RelationPutHeapTupleAtEnd(relation, tup);
- if (IsSystemRelationName(RelationGetRelationName(relation)->data))
+ if (IsSystemRelationName(RelationGetRelationName(relation)))
RelationInvalidateHeapTuple(relation, tup);
return tup->t_data->t_oid;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.36 1999/09/18 19:06:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.37 1999/11/07 23:07:54 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
elog(ERROR, "Index %u does not exist", relationId);
if (r->rd_rel->relkind != RELKIND_INDEX)
- elog(ERROR, "%s is not an index relation", r->rd_rel->relname.data);
+ elog(ERROR, "%s is not an index relation", RelationGetRelationName(r));
return r;
}
elog(ERROR, "Index '%s' does not exist", relationName);
if (r->rd_rel->relkind != RELKIND_INDEX)
- elog(ERROR, "%s is not an index relation", r->rd_rel->relname.data);
+ elog(ERROR, "%s is not an index relation", RelationGetRelationName(r));
return r;
}
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.27 1999/07/17 20:16:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.28 1999/11/07 23:07:56 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
int32
btnamecmp(NameData *a, NameData *b)
{
- return strncmp(a->data, b->data, NAMEDATALEN);
+ return strncmp(NameStr(*a), NameStr(*b), NAMEDATALEN);
}
int32
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
PageGetItemId(page, P_FIRSTKEY),
BTEqualStrategyNumber))
elog(FATAL, "btree: BTP_CHAIN flag was expected in %s (access = %s)",
- rel->rd_rel->relname.data, access ? "bt_write" : "bt_read");
+ RelationGetRelationName(rel), access ? "bt_write" : "bt_read");
if (_bt_skeycmp(rel, keysz, scankey, page,
PageGetItemId(page, offmax),
BTEqualStrategyNumber))
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
if (oldPred == NULL && (nb = RelationGetNumberOfBlocks(index)) != 0)
- elog(ERROR, "%s already contains data", index->rd_rel->relname.data);
+ elog(ERROR, "%s already contains data", RelationGetRelationName(index));
/* initialize the root page (if this is a new index) */
if (oldPred == NULL)
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.70 1999/10/25 03:07:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.71 1999/11/07 23:07:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
*/
if (namestrcmp(&attrtypes[i]->attname, "attisset") == 0)
attrtypes[i]->attisset = get_attisset(RelationGetRelid(reldesc),
- attrtypes[i]->attname.data);
+ NameStr(attrtypes[i]->attname));
else
attrtypes[i]->attisset = false;
Form_pg_attribute at = attrtypes[i];
printf("create attribute %d name %s len %d num %d type %d\n",
- i, at->attname.data, at->attlen, at->attnum,
+ i, NameStr(at->attname), at->attlen, at->attnum,
at->atttypid
);
fflush(stdout);
{
if (reldesc)
{
- if (namestrcmp(RelationGetRelationName(reldesc), name) != 0)
+ if (strcmp(RelationGetRelationName(reldesc), name) != 0)
elog(ERROR, "closerel: close of '%s' when '%s' was expected",
name, relname ? relname : "(null)");
}
attrtypes[attnum]->atttypid = Ap->am_oid;
namestrcpy(&attrtypes[attnum]->attname, name);
if (!Quiet)
- printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
+ printf("<%s %s> ", NameStr(attrtypes[attnum]->attname), type);
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
attlen = attrtypes[attnum]->attlen = Ap->am_typ.typlen;
attrtypes[attnum]->attbyval = Ap->am_typ.typbyval;
attrtypes[attnum]->atttypid = Procid[typeoid].oid;
namestrcpy(&attrtypes[attnum]->attname, name);
if (!Quiet)
- printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
+ printf("<%s %s> ", NameStr(attrtypes[attnum]->attname), type);
attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
attlen = attrtypes[attnum]->attlen = Procid[typeoid].len;
{
for (app = Typ; *app != (struct typmap *) NULL; app++)
{
- if (strncmp((*app)->am_typ.typname.data, type, NAMEDATALEN) == 0)
+ if (strncmp(NameStr((*app)->am_typ.typname), type, NAMEDATALEN) == 0)
{
Ap = *app;
return (*app)->am_oid;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.28 1999/09/18 19:06:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.29 1999/11/07 23:08:00 momjian Exp $
*
* NOTES
* See acl.h.
ObjectIdGetDatum(grosysid),
0, 0, 0);
if (HeapTupleIsValid(tuple))
- name = (((Form_pg_group) GETSTRUCT(tuple))->groname).data;
+ name = NameStr(((Form_pg_group) GETSTRUCT(tuple))->groname);
else
elog(NOTICE, "get_groname: group %d not found", grosysid);
return name;
*
*
* 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
* ----------------
*/
MemSet((char *) rel->rd_rel, 0, sizeof *rel->rd_rel);
- namestrcpy(&(rel->rd_rel->relname), relname);
+ strcpy(RelationGetRelationName(rel), relname);
rel->rd_rel->relkind = RELKIND_UNCATALOGED;
rel->rd_rel->relnatts = natts;
if (tupDesc->constr)
{
elog(ERROR, "Attribute '%s' has a name conflict"
"\n\tName matches an existing system attribute",
- HeapAtt[j]->attname.data);
+ NameStr(HeapAtt[j]->attname));
}
}
if (tupdesc->attrs[i]->atttypid == UNKNOWNOID)
{
elog(NOTICE, "Attribute '%s' has an unknown type"
"\n\tRelation created; continue",
- tupdesc->attrs[i]->attname.data);
+ NameStr(tupdesc->attrs[i]->attname));
}
}
&(tupdesc->attrs[i]->attname)))
{
elog(ERROR, "Attribute '%s' is repeated",
- tupdesc->attrs[j]->attname.data);
+ NameStr(tupdesc->attrs[j]->attname));
}
}
}
{
heap_close(pg_class_desc, RowExclusiveLock);
elog(ERROR, "Relation '%s' does not exist",
- &rel->rd_rel->relname);
+ RelationGetRelationName(rel));
}
/* ----------------
heap_endscan(pg_type_scan);
heap_close(pg_type_desc, RowExclusiveLock);
elog(ERROR, "DeleteTypeTuple: %s type nonexistent",
- &rel->rd_rel->relname);
+ RelationGetRelationName(rel));
}
/* ----------------
heap_close(pg_type_desc, RowExclusiveLock);
elog(ERROR, "DeleteTypeTuple: att of type %s exists in relation %u",
- &rel->rd_rel->relname, relid);
+ RelationGetRelationName(rel), relid);
}
heap_endscan(pg_attribute_scan);
heap_close(pg_attribute_desc, RowExclusiveLock);
*/
/* allow temp of pg_class? Guess so. */
if (!istemp && !allowSystemTableMods &&
- IsSystemRelationName(RelationGetRelationName(rel)->data))
+ IsSystemRelationName(RelationGetRelationName(rel)))
elog(ERROR, "System relation '%s' cannot be destroyed",
- &rel->rd_rel->relname);
+ RelationGetRelationName(rel));
/* ----------------
* DROP TABLE within a transaction block is dangerous, because
* deparse_expression needs a RangeTblEntry list, so make one
*/
rte = makeNode(RangeTblEntry);
- rte->relname = RelationGetRelationName(rel)->data;
- rte->refname = RelationGetRelationName(rel)->data;
+ rte->relname = RelationGetRelationName(rel);
+ rte->refname = RelationGetRelationName(rel);
rte->relid = RelationGetRelid(rel);
rte->inh = false;
rte->inFromCl = true;
* deparse_expression needs a RangeTblEntry list, so make one
*/
rte = makeNode(RangeTblEntry);
- rte->relname = RelationGetRelationName(rel)->data;
- rte->refname = RelationGetRelationName(rel)->data;
+ rte->relname = RelationGetRelationName(rel);
+ rte->refname = RelationGetRelationName(rel);
rte->relid = RelationGetRelid(rel);
rte->inh = false;
rte->inFromCl = true;
List *rawColDefaults,
List *rawConstraints)
{
- char *relname = RelationGetRelationName(rel)->data;
+ char *relname = RelationGetRelationName(rel);
TupleDesc tupleDesc;
TupleConstr *oldconstr;
int numoldchecks;
elog(ERROR, "Attribute '%s' is of type '%s'"
" but default expression is of type '%s'"
"\n\tYou will need to rewrite or cast the expression",
- atp->attname.data,
+ NameStr(atp->attname),
typeidTypeName(atp->atttypid),
typeidTypeName(type_id));
}
* doesn't work! - jolly 8/19/95
*
*
- * $Id: version.c,v 1.22 1999/07/17 20:16:55 momjian Exp $
+ * $Id: version.c,v 1.23 1999/11/07 23:08:03 momjian Exp $
*
* NOTES
* At the point the version is defined, 2 physical relations are created
for (i = maxattrs - 1; i > -1; --i)
{
- attrname = (rel->rd_att->attrs[i]->attname).data;
+ attrname = NameStr(rel->rd_att->attrs[i]->attname);
if (notfirst == 1)
sprintf(temp_buf, ", %s = new.%s", attrname, attrname);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
NewHeap = copy_heap(OIDOldHeap);
OIDNewHeap = RelationGetRelid(NewHeap);
- strcpy(NewHeapName, NewHeap->rd_rel->relname.data);
+ strcpy(NewHeapName, RelationGetRelationName(NewHeap));
/* To make the new heap visible (which is until now empty). */
natts = 1;
}
- index_create((NewHeap->rd_rel->relname).data,
+ index_create(RelationGetRelationName(NewHeap),
NewIndexName,
finfo,
NULL, /* type info is in the old index */
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.55 1999/10/03 23:55:27 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.56 1999/11/07 23:08:01 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
if (childrelid == myrelid)
continue;
rel = heap_open(childrelid, AccessExclusiveLock);
- PerformAddAttribute((rel->rd_rel->relname).data,
+ PerformAddAttribute(RelationGetRelationName(rel),
userName, false, colDef);
heap_close(rel, AccessExclusiveLock);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/*
* form name, type and constraints
*/
- attributeName = (attribute->attname).data;
+ attributeName = NameStr(attribute->attname);
tuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(attribute->atttypid),
0, 0, 0);
Assert(HeapTupleIsValid(tuple));
- attributeType = (((Form_pg_type) GETSTRUCT(tuple))->typname).data;
+ attributeType = NameStr(((Form_pg_type) GETSTRUCT(tuple))->typname);
/*
* check validity
*
* 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 $
*
*/
if (++i > 1)
appendStringInfo(str, ", ");
appendStringInfo(str,
- stringStringInfo((RelationGetRelationName(relation))->data));
+ stringStringInfo(RelationGetRelationName(relation)));
/* drop relcache refcount from RelationIdGetRelation */
RelationDecrementReferenceCount(relation);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (!HeapTupleIsValid(tuple))
return 0;
- return nameout(&(((Form_pg_opclass) GETSTRUCT(tuple))->opcname));
+ return nameout(&((Form_pg_opclass) GETSTRUCT(tuple))->opcname);
}
/*
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
{
char *name;
- name = (((Form_pg_class) GETSTRUCT(tup))->relname).data;
+ name = NameStr(((Form_pg_class) GETSTRUCT(tup))->relname);
heap_destroy_with_catalog(name);
}
heap_endscan(scan);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
/* make copy of cache value, could disappear in call */
StrNCpy(childname,
- ((Form_pg_class) GETSTRUCT(reltup))->relname.data,
+ NameStr(((Form_pg_class) GETSTRUCT(reltup))->relname),
NAMEDATALEN);
/* note we need not recurse again! */
renameatt(childname, oldattname, newattname, userName, 0);
elog(ERROR, "renameatt: attribute \"%s\" exists", newattname);
}
- StrNCpy((((Form_pg_attribute) (GETSTRUCT(oldatttup)))->attname.data),
+ StrNCpy(NameStr(((Form_pg_attribute) GETSTRUCT(oldatttup))->attname),
newattname, NAMEDATALEN);
heap_replace(attrelation, &oldatttup->t_self, oldatttup, NULL);
/*
* Update pg_class tuple with new relname.
*/
- StrNCpy((((Form_pg_class) GETSTRUCT(oldreltup))->relname.data),
+ StrNCpy(NameStr(((Form_pg_class) GETSTRUCT(oldreltup))->relname),
newrelname, NAMEDATALEN);
heap_replace(relrelation, &oldreltup->t_self, oldreltup, NULL);
pg_trigger = (Form_pg_trigger) GETSTRUCT(tup);
refrel = heap_open(pg_trigger->tgrelid, NoLock);
- stmt.relname = nameout(&(refrel->rd_rel->relname));
- stmt.trigname = nameout(&(pg_trigger->tgname));
+ stmt.relname = pstrdup(RelationGetRelationName(refrel));
+ stmt.trigname = nameout(&pg_trigger->tgname);
DropTrigger(&stmt);
continue;
if (found == ntrigs)
elog(ERROR, "RelationBuildTriggers: unexpected record found for rel %.*s",
- NAMEDATALEN, relation->rd_rel->relname.data);
+ NAMEDATALEN, RelationGetRelationName(relation));
pg_trigger = (Form_pg_trigger) GETSTRUCT(&tuple);
build = &(triggers[found]);
build->tgoid = tuple.t_data->t_oid;
- build->tgname = nameout(&(pg_trigger->tgname));
+ build->tgname = nameout(&pg_trigger->tgname);
build->tgfoid = pg_trigger->tgfoid;
build->tgfunc.fn_addr = NULL;
build->tgtype = pg_trigger->tgtype;
tgrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelationBuildTriggers: tgargs IS NULL for rel %.*s",
- NAMEDATALEN, relation->rd_rel->relname.data);
+ NAMEDATALEN, RelationGetRelationName(relation));
if (build->tgnargs > 0)
{
char *p;
tgrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelationBuildTriggers: tgargs IS NULL for rel %.*s",
- NAMEDATALEN, relation->rd_rel->relname.data);
+ NAMEDATALEN, RelationGetRelationName(relation));
p = (char *) VARDATA(val);
build->tgargs = (char **) palloc(build->tgnargs * sizeof(char *));
for (i = 0; i < build->tgnargs; i++)
if (found < ntrigs)
elog(ERROR, "RelationBuildTriggers: %d record not found for rel %.*s",
ntrigs - found,
- NAMEDATALEN, relation->rd_rel->relname.data);
+ NAMEDATALEN, RelationGetRelationName(relation));
index_endscan(sd);
pfree(sd);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* vacrel gets de-allocated on transaction commit */
if (vacrel)
- strcpy(VacRel.data, vacrel);
+ strcpy(NameStr(VacRel), vacrel);
pmem = PortalGetVariableMemory(vc_portal);
old = MemoryContextSwitchTo((MemoryContext) pmem);
StartTransactionCommand();
- if (VacRelP->data)
+ if (NameStr(*VacRelP))
{
ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relname,
F_NAMEEQ,
- PointerGetDatum(VacRelP->data));
+ PointerGetDatum(NameStr(*VacRelP)));
}
else
{
vacrelstats->relid = relid;
vacrelstats->num_pages = vacrelstats->num_tuples = 0;
vacrelstats->hasindex = false;
- if (analyze && !IsSystemRelationName((RelationGetRelationName(onerel))->data))
+ if (analyze && !IsSystemRelationName(RelationGetRelationName(onerel)))
{
int attr_cnt,
*attnums = NULL;
if (length(va_cols) > attr_cnt)
elog(ERROR, "vacuum: too many attributes specified for relation %s",
- (RelationGetRelationName(onerel))->data);
+ RelationGetRelationName(onerel));
attnums = (int *) palloc(attr_cnt * sizeof(int));
foreach(le, va_cols)
{
else
{
elog(ERROR, "vacuum: there is no attribute %s in %s",
- col, (RelationGetRelationName(onerel))->data);
+ col, RelationGetRelationName(onerel));
}
}
attr_cnt = tcnt;
getrusage(RUSAGE_SELF, &ru0);
- relname = (RelationGetRelationName(onerel))->data;
+ relname = RelationGetRelationName(onerel);
elog(MESSAGE_LEVEL, "--Relation %s--", relname);
tups_vacuumed = num_tuples = nkeep = nunused = ncrash = empty_pages =
elog(MESSAGE_LEVEL, "Rel %s: Pages: %u --> %u; Tuple(s) moved: %u. \
Elapsed %u/%u sec.",
- (RelationGetRelationName(onerel))->data,
+ RelationGetRelationName(onerel),
nblocks, blkno, num_moved,
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
Assert(vacrelstats->num_pages >= vacuum_pages->vpl_empty_end_pages);
nblocks = vacrelstats->num_pages - vacuum_pages->vpl_empty_end_pages;
elog(MESSAGE_LEVEL, "Rel %s: Pages: %u --> %u.",
- (RelationGetRelationName(onerel))->data,
+ RelationGetRelationName(onerel),
vacrelstats->num_pages, nblocks);
/*
getrusage(RUSAGE_SELF, &ru1);
elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %u. Elapsed %u/%u sec.",
- indrel->rd_rel->relname.data, nipages, nitups,
+ RelationGetRelationName(indrel), nipages, nitups,
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
if (nitups != num_tuples)
elog(NOTICE, "Index %s: NUMBER OF INDEX' TUPLES (%u) IS NOT THE SAME AS HEAP' (%u)",
- indrel->rd_rel->relname.data, nitups, num_tuples);
+ RelationGetRelationName(indrel), nitups, num_tuples);
} /* vc_scanoneind */
if (vp->vpd_offsets_free == 0)
{ /* this is EmptyPage !!! */
elog(NOTICE, "Index %s: pointer to EmptyPage (blk %u off %u) - fixing",
- indrel->rd_rel->relname.data,
+ RelationGetRelationName(indrel),
vp->vpd_blkno, ItemPointerGetOffsetNumber(heapptr));
}
++tups_vacuumed;
getrusage(RUSAGE_SELF, &ru1);
elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %u: Deleted %u. Elapsed %u/%u sec.",
- indrel->rd_rel->relname.data, num_pages,
+ RelationGetRelationName(indrel), num_pages,
num_index_tuples - keep_tuples, tups_vacuumed,
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
if (num_index_tuples != num_tuples + keep_tuples)
elog(NOTICE, "Index %s: NUMBER OF INDEX' TUPLES (%u) IS NOT THE SAME AS HEAP' (%u)",
- indrel->rd_rel->relname.data, num_index_tuples, num_tuples);
+ RelationGetRelationName(indrel), num_index_tuples, num_tuples);
} /* vc_vaconeind */
* problem
*/
if (VacAttrStatsLtGtValid(stats) && stats->initialized
- /* && !IsSystemRelationName(pgcform->relname.data)
+ /* && !IsSystemRelationName(NameData(pgcform->relname))
*/ )
{
float32data nullratio;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (resultRelationDesc->rd_rel->relkind == RELKIND_SEQUENCE)
elog(ERROR, "You can't change sequence relation %s",
- resultRelationDesc->rd_rel->relname.data);
+ RelationGetRelationName(resultRelationDesc));
resultRelationInfo = makeNode(RelationInfo);
resultRelationInfo->ri_RangeTableIndex = resultRelationIndex;
slot->ttc_tupleDescriptor = rel->rd_att;
slot->ttc_buffer = InvalidBuffer;
slot->ttc_whichplan = -1;
- rte->relname = nameout(&(rel->rd_rel->relname));
+ rte->relname = RelationGetRelationName(rel);
rte->refname = rte->relname;
rte->relid = RelationGetRelid(rel);
/* inh, inFromCl, inJoinSet, skipAcl won't be used, leave them zero */
}
pfree(slot);
- pfree(rte->relname);
pfree(rte);
pfree(rtlist);
pfree(econtext);
{
if (rel->rd_att->attrs[attrChk - 1]->attnotnull && heap_attisnull(tuple, attrChk))
elog(ERROR, "%s: Fail to add null value in not null attribute %s",
- caller, rel->rd_att->attrs[attrChk - 1]->attname.data);
+ caller, NameStr(rel->rd_att->attrs[attrChk - 1]->attname));
}
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
(Oid) restype,
resdom->resno,
resdom->reslen,
- resdom->resname->data,
+ NameStr(*resdom->resname),
get_typbyval(restype),
get_typalign(restype));
*/
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
att->attrelid = 0; /* dummy value */
if (attName != (char *) NULL)
- StrNCpy(att->attname.data, attName, NAMEDATALEN);
+ StrNCpy(NameStr(att->attname), attName, NAMEDATALEN);
else
- MemSet(att->attname.data, 0, NAMEDATALEN);
+ MemSet(NameStr(att->attname), 0, NAMEDATALEN);
att->atttypid = typeID;
att->attdefrel = 0; /* dummy value */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* the parser should have ensured that uniqueAttr is a legal
* attribute name
*/
- while (strcmp((tupDesc->attrs[i]->attname).data, uniqueAttr) != 0)
+ while (strcmp(NameStr(tupDesc->attrs[i]->attname), uniqueAttr) != 0)
i++;
node->uniqueAttrNum = i + 1; /* attribute numbers start from 1 */
}
* spi.c
* Server Programming Interface
*
- * $Id: spi.c,v 1.40 1999/07/15 22:39:11 momjian Exp $
+ * $Id: spi.c,v 1.41 1999/11/07 23:08:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
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 NULL;
}
- return nameout(&(tupdesc->attrs[fnumber - 1]->attname));
+ return pstrdup(NameStr(tupdesc->attrs[fnumber - 1]->attname));
}
char *
return NULL;
}
- return pstrdup(((Form_pg_type) GETSTRUCT(typeTuple))->typname.data);
+ return pstrdup(NameStr(((Form_pg_type) GETSTRUCT(typeTuple))->typname));
}
Oid
char *
SPI_getrelname(Relation rel)
{
- return pstrdup(rel->rd_rel->relname.data);
+ return pstrdup(RelationGetRelationName(rel));
}
void *
*
* 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 $
*
*-------------------------------------------------------------------------
*/
group->types = pbuf_addTypes(natts);
for (i = 0; i < natts; ++i)
{
- strncpy(group->types[i].name, attrs[i]->attname.data, NAMEDATALEN);
+ strncpy(group->types[i].name,
+ NameStr(attrs[i]->attname), NAMEDATALEN);
group->types[i].typid = attrs[i]->atttypid;
group->types[i].typlen = attrs[i]->attlen;
}
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.32 1999/10/30 23:06:32 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.33 1999/11/07 23:08:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
for (attrno = 1; attrno <= numattrs; attrno++)
{
Form_pg_attribute att_tup = rel->rd_att->attrs[attrno-1];
- char *attrname = att_tup->attname.data;
+ char *attrname = NameStr(att_tup->attname);
TargetEntry *new_tle = NULL;
/*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
makeResdom(attrno,
thisatt->atttypid,
thisatt->atttypmod,
- pstrdup(nameout(&(thisatt->attname))),
+ pstrdup(NameStr(thisatt->attname)),
0, 0, false),
stringToNode(defval[ndef].adbin));
qry->targetList = lappend(qry->targetList, te);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
rd = heap_openr(typeidTypeName(toid), NoLock);
if (RelationIsValid(rd))
{
- relname = RelationGetRelationName(rd)->data;
+ relname = RelationGetRelationName(rd);
heap_close(rd, NoLock);
}
else
rd = heap_open(qentry->sqe_relid, NoLock);
if (! RelationIsValid(rd))
elog(ERROR, "Relid %u does not exist", qentry->sqe_relid);
- qentry->sqe_relid = typeTypeId(typenameType(RelationGetRelationName(rd)->data));
+ qentry->sqe_relid = typeTypeId(typenameType(RelationGetRelationName(rd)));
heap_close(rd, NoLock);
DLAddTail(visited, qe);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
Var *varnode;
TargetEntry *te = makeNode(TargetEntry);
- attrname = pstrdup(rel->rd_att->attrs[varattno]->attname.data);
+ attrname = pstrdup(NameStr(rel->rd_att->attrs[varattno]->attname));
varnode = make_var(pstate, rte->relid, refname, attrname);
/*
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
Node *arrayBase;
ArrayRef *aref;
- att->relname = pstrdup(RelationGetRelationName(rd)->data);
+ att->relname = pstrdup(RelationGetRelationName(rd));
att->attrs = lcons(makeString(colname), NIL);
arrayBase = ParseNestedFuncOrColumn(pstate, att,
&pstate->p_last_resno,
Ident *id = makeNode(Ident);
id->name = palloc(NAMEDATALEN);
- StrNCpy(id->name, attr[i]->attname.data, NAMEDATALEN);
+ StrNCpy(id->name, NameStr(attr[i]->attname), NAMEDATALEN);
id->indirection = NIL;
id->isRel = false;
cols = lappend(cols, id);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
return NULL;
}
typetuple = (Form_pg_type) GETSTRUCT(tup);
- return (typetuple->typname).data;
+ return NameStr(typetuple->typname);
}
/* return a Type structure, given a type id */
Form_pg_type typ;
typ = (Form_pg_type) GETSTRUCT(t);
- return (typ->typname).data;
+ return NameStr(typ->typname);
}
/* given a type, return its typetype ('c' for 'c'atalog types) */
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
ev_rel->rd_rel->relowner);
}
heap_close(ev_rel, AccessShareLock);
- evowner = nameout(&(((Form_pg_shadow) GETSTRUCT(usertup))->usename));
+ evowner = pstrdup(NameStr(((Form_pg_shadow) GETSTRUCT(usertup))->usename));
/*
* Check all the locks, that should get fired on this query
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
appendStringInfo(&rulebuf, "::text, '%s'::bool);",
is_instead);
- pg_exec_query_dest(rulebuf.data, None, true);
+ pg_exec_query_dest(NameStr(rulebuf), None, true);
- pfree(rulebuf.data);
+ pfree(NameStr(rulebuf));
return LastOidProcessed;
}
tle = (TargetEntry *) nth(i - 1, query->targetList);
resdom = tle->resdom;
attr = event_relation->rd_att->attrs[i - 1];
- attname = nameout(&(attr->attname));
+ attname = pstrdup(NameStr(attr->attname));
if (strcmp(resdom->resname, attname) != 0)
elog(ERROR, "select rules target entry %d has different column name from %s", i, attname);
rule = event_relation->rd_rules->rules[i];
if (rule->event == CMD_SELECT)
- elog(ERROR, "%s is already a view", nameout(&(event_relation->rd_rel->relname)));
+ elog(ERROR, "%s is already a view",
+ RelationGetRelationName(event_relation));
}
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
{
NameData name_to_look_for;
- name_to_look_for.data[0] = '\0';
+ NameStr(name_to_look_for)[0] = '\0';
namestrcpy(&name_to_look_for,
(char *) get_attname(getrelid(this_varno,
context->rtable),
this_varattno));
- if (name_to_look_for.data[0])
+ if (NameStr(name_to_look_for)[0])
{
Node *n;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
if (!HeapTupleIsValid(htup))
elog(ERROR, "Class '%u' not found", eventrel);
- return ((Form_pg_class) GETSTRUCT(htup))->relname.data;
+ return NameStr(((Form_pg_class) GETSTRUCT(htup))->relname);
}
/* ----------------------------------------------------------------
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
/* record the database name and relation name for this buffer */
- strcpy(buf->sb_relname, reln->rd_rel->relname.data);
+ strcpy(buf->sb_relname, RelationGetRelationName(reln));
strcpy(buf->sb_dbname, DatabaseName);
INIT_BUFFERTAG(&(buf->tag), reln, blockNum);
if (FlushBuffer(-i-1, false) != STATUS_OK)
{
elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is dirty, could not flush it",
- rel->rd_rel->relname.data, block, buf->tag.blockNum);
+ RelationGetRelationName(rel),
+ block, buf->tag.blockNum);
return -1;
}
}
else
{
elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is dirty",
- rel->rd_rel->relname.data, block, buf->tag.blockNum);
+ RelationGetRelationName(rel),
+ block, buf->tag.blockNum);
return -1;
}
}
if (LocalRefCount[i] > 0)
{
elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is referenced (%d)",
- rel->rd_rel->relname.data, block,
+ RelationGetRelationName(rel), block,
buf->tag.blockNum, LocalRefCount[i]);
return -2;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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
if (!RelationIsValid(r) || r->rd_rel->relkind != RELKIND_LOBJECT)
return -1;
- heap_destroy_with_catalog(r->rd_rel->relname.data);
+ heap_destroy_with_catalog(RelationGetRelationName(r));
return 1;
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* This is so that we can support more backends. (system-wide semaphore
* sets run out pretty fast.) -ay 4/95
*
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.63 1999/10/12 14:54:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.64 1999/11/07 23:08:17 momjian Exp $
*/
#include <sys/time.h>
#include <unistd.h>
{
IPCKey semKey = ProcGlobal->currKey + i;
int semId;
- int semstat;
semId = IpcSemaphoreCreate(semKey,
PROC_NSEMS_PER_SET,
InitProcess(IPCKey key)
{
bool found = false;
- int semstat;
unsigned long location,
myOffset;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
char *path;
Assert(reln->rd_unlinked && reln->rd_fd < 0);
- path = relpath(reln->rd_rel->relname.data);
+ path = relpath(RelationGetRelationName(reln));
#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
#else
int vfd;
Assert(reln->rd_fd < 0);
- path = relpath(reln->rd_rel->relname.data);
+ path = relpath(RelationGetRelationName(reln));
#ifndef __CYGWIN32__
fd = FileNameOpenFile(path, O_RDWR, 0600);
*fullpath;
/* be sure we have enough space for the '.segno', if any */
- path = relpath(RelationGetRelationName(reln)->data);
+ path = relpath(RelationGetRelationName(reln));
dofree = false;
if (segno > 0)
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
int fd;
if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0)
- elog(ERROR, "cannot create %s", reln->rd_rel->relname.data);
+ elog(ERROR, "cannot create %s", RelationGetRelationName(reln));
return fd;
}
int status;
if ((status = (*(smgrsw[which].smgr_unlink)) (reln)) == SM_FAIL)
- elog(ERROR, "cannot unlink %s", reln->rd_rel->relname.data);
+ elog(ERROR, "cannot unlink %s", RelationGetRelationName(reln));
return status;
}
status = (*(smgrsw[which].smgr_extend)) (reln, buffer);
if (status == SM_FAIL)
- elog(ERROR, "%s: cannot extend. Check free disk space.", reln->rd_rel->relname.data);
+ elog(ERROR, "%s: cannot extend. Check free disk space.",
+ RelationGetRelationName(reln));
return status;
}
if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0 &&
!reln->rd_unlinked)
- elog(ERROR, "cannot open %s", reln->rd_rel->relname.data);
+ elog(ERROR, "cannot open %s", RelationGetRelationName(reln));
return fd;
}
smgrclose(int16 which, Relation reln)
{
if ((*(smgrsw[which].smgr_close)) (reln) == SM_FAIL)
- elog(ERROR, "cannot close %s", reln->rd_rel->relname.data);
+ elog(ERROR, "cannot close %s", RelationGetRelationName(reln));
return SM_SUCCESS;
}
if (status == SM_FAIL)
elog(ERROR, "cannot read block %d of %s",
- blocknum, reln->rd_rel->relname.data);
+ blocknum, RelationGetRelationName(reln));
return status;
}
if (status == SM_FAIL)
elog(ERROR, "cannot write block %d of %s",
- blocknum, reln->rd_rel->relname.data);
+ blocknum, RelationGetRelationName(reln));
return status;
}
if (status == SM_FAIL)
elog(ERROR, "cannot flush block %d of %s to stable store",
- blocknum, reln->rd_rel->relname.data);
+ blocknum, RelationGetRelationName(reln));
return status;
}
int nblocks;
if ((nblocks = (*(smgrsw[which].smgr_nblocks)) (reln)) < 0)
- elog(ERROR, "cannot count blocks for %s", reln->rd_rel->relname.data);
+ elog(ERROR, "cannot count blocks for %s",
+ RelationGetRelationName(reln));
return nblocks;
}
{
if ((newblks = (*(smgrsw[which].smgr_truncate)) (reln, nblocks)) < 0)
elog(ERROR, "cannot truncate %s to %d blocks",
- reln->rd_rel->relname.data, nblocks);
+ RelationGetRelationName(reln), nblocks);
}
return newblks;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
for (i = 0; i < natts; ++i)
{
- pq_sendstring(&buf, attrs[i]->attname.data);
+ pq_sendstring(&buf, NameStr(attrs[i]->attname));
pq_sendint(&buf, (int) attrs[i]->atttypid,
sizeof(attrs[i]->atttypid));
pq_sendint(&buf, attrs[i]->attlen,
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.31 1999/09/07 19:09:46 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.32 1999/11/07 23:08:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
{
if (!n)
return FALSE;
- return fixedlen_like(n->data, p, NAMEDATALEN);
+ return fixedlen_like(NameStr(*n), p, NAMEDATALEN);
}
bool
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
return NULL;
result = (NameData *) palloc(NAMEDATALEN);
/* always keep it null-padded */
- StrNCpy(result->data, s, NAMEDATALEN);
- len = strlen(result->data);
+ StrNCpy(NameStr(*result), s, NAMEDATALEN);
+ len = strlen(NameStr(*result));
while (len < NAMEDATALEN)
{
- *(result->data + len) = '\0';
+ *(NameStr(*result) + len) = '\0';
len++;
}
return result;
if (s == NULL)
return "-";
else
- return pstrdup(s->data);
+ return pstrdup(NameStr(*s));
}
if (!arg1 || !arg2)
return 0;
else
- return (bool) strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0;
+ return (bool) strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) == 0;
}
bool
{
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
- return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) != 0);
+ return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) != 0);
}
bool
{
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
- return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) < 0);
+ return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) < 0);
}
bool
{
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
- return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) <= 0);
+ return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) <= 0);
}
bool
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
- return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) > 0);
+ return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) > 0);
}
bool
if (arg1 == NULL || arg2 == NULL)
return (bool) 0;
- return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) >= 0);
+ return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) >= 0);
}
{
if (!n1 || !n2)
return -1;
- strncpy(n1->data, n2->data, NAMEDATALEN);
+ strncpy(NameStr(*n1), NameStr(*n2), NAMEDATALEN);
return 0;
}
int
namecat(Name n1, Name n2)
{
- return namestrcat(n1, n2->data); /* n2 can't be any longer than n1 */
+ return namestrcat(n1, NameStr(*n2)); /* n2 can't be any longer than n1 */
}
#endif
int
namecmp(Name n1, Name n2)
{
- return strncmp(n1->data, n2->data, NAMEDATALEN);
+ return strncmp(NameStr(*n1), NameStr(*n2), NAMEDATALEN);
}
#endif
{
if (!name || !str)
return -1;
- StrNCpy(name->data, str, NAMEDATALEN);
+ StrNCpy(NameStr(*name), str, NAMEDATALEN);
return 0;
}
if (!name || !str)
return -1;
- for (i = 0, p = name->data; i < NAMEDATALEN && *p; ++i, ++p)
+ for (i = 0, p = NameStr(*name); i < NAMEDATALEN && *p; ++i, ++p)
;
for (q = str; i < NAMEDATALEN; ++i, ++p, ++q)
{
return -1; /* NULL < anything */
if (!str)
return 1; /* NULL < anything */
- return strncmp(name->data, str, NAMEDATALEN);
+ return strncmp(NameStr(*name), str, NAMEDATALEN);
}
/*****************************************************************************
char *charP;
int length;
- for (length = 0, charP = name->data;
+ for (length = 0, charP = NameStr(*name);
length < NAMEDATALEN && *charP != '\0';
length++, charP++)
;
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.28 1999/07/17 20:17:59 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.29 1999/11/07 23:08:24 momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
{
if (!n)
return FALSE;
- return fixedlen_regexeq(n->data, p, NAMEDATALEN, REG_EXTENDED);
+ return fixedlen_regexeq(NameStr(*n), p, NAMEDATALEN, REG_EXTENDED);
}
bool
{
if (!n)
return FALSE;
- return (fixedlen_regexeq(n->data, p, NAMEDATALEN,
+ return (fixedlen_regexeq(NameStr(*n), p, NAMEDATALEN,
REG_ICASE | REG_EXTENDED));
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
{
char *s;
- s = ((Form_pg_proc) GETSTRUCT(proctup))->proname.data;
+ s = NameStr(((Form_pg_proc) GETSTRUCT(proctup))->proname);
StrNCpy(result, s, NAMEDATALEN);
}
else
{
char *s;
- s = ((Form_pg_type) GETSTRUCT(typetup))->typname.data;
+ s = NameStr(((Form_pg_type) GETSTRUCT(typetup))->typname);
StrNCpy(VARDATA(result) + strlen(VARDATA(result)), s,
NAMEDATALEN);
strcat(VARDATA(result), " ");
* out of it's tuple
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.29 1999/10/31 18:57:42 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.30 1999/11/07 23:08:24 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
* We need the rules name somewhere deep down
* ----------
*/
- rulename = nameout(rname);
+ rulename = pstrdup(NameStr(*rname));
/* ----------
* Connect to SPI manager
* We need the rules name somewhere deep down
* ----------
*/
- rulename = nameout(rname);
+ rulename = pstrdup(NameStr(*rname));
/* ----------
* Connect to SPI manager
spirc = SPI_execp(plan_getam, spi_args, spi_nulls, 1);
if (spirc != SPI_OK_SELECT)
elog(ERROR, "failed to get pg_am tuple for index %s",
- nameout(&(idxrelrec->relname)));
+ idxrelrec->relname);
if (SPI_processed != 1)
elog(ERROR, "failed to get pg_am tuple for index %s",
- nameout(&(idxrelrec->relname)));
+ idxrelrec->relname);
spi_tup = SPI_tuptable->vals[0];
spi_ttc = SPI_tuptable->tupdesc;
spi_fno = SPI_fnumber(spi_ttc, "amname");
initStringInfo(&buf);
appendStringInfo(&buf, "CREATE %sINDEX %s ON %s USING %s (",
idxrec->indisunique ? "UNIQUE " : "",
- quote_identifier(nameout(&(idxrelrec->relname))),
- quote_identifier(nameout(&(indrelrec->relname))),
+ quote_identifier(pstrdup(NameStr(idxrelrec->relname))),
+ quote_identifier(pstrdup(NameStr(indrelrec->relname))),
quote_identifier(SPI_getvalue(spi_tup, spi_ttc,
spi_fno)));
procStruct = (Form_pg_proc) GETSTRUCT(proctup);
appendStringInfo(&buf, "%s(%s) ",
- quote_identifier(nameout(&(procStruct->proname))),
+ quote_identifier(pstrdup(NameStr(procStruct->proname))),
keybuf.data);
spi_args[0] = ObjectIdGetDatum(idxrec->indclass[0]);
* ----------
*/
result = (NameData *) palloc(NAMEDATALEN);
- memset(result->data, 0, NAMEDATALEN);
+ memset(NameStr(*result), 0, NAMEDATALEN);
/* ----------
* Get the pg_shadow entry and print the result
if (HeapTupleIsValid(usertup))
{
user_rec = (Form_pg_shadow) GETSTRUCT(usertup);
- StrNCpy(result->data, (&(user_rec->usename))->data, NAMEDATALEN);
+ StrNCpy(NameStr(*result), NameStr(user_rec->usename), NAMEDATALEN);
}
else
sprintf((char *) result, "unknown (UID=%d)", uid);
elog(ERROR, "cache lookup for proc %u failed", func->funcid);
procStruct = (Form_pg_proc) GETSTRUCT(proctup);
- proname = nameout(&(procStruct->proname));
+ proname = pstrdup(NameStr(procStruct->proname));
/*
* nullvalue() and nonnullvalue() should get turned into special syntax
elog(ERROR, "cache lookup for type %u failed",
procStruct->prorettype);
typeStruct = (Form_pg_type) GETSTRUCT(tup);
- if (strncmp(procStruct->proname.data, typeStruct->typname.data,
+ if (strncmp(NameStr(procStruct->proname),
+ NameStr(typeStruct->typname),
NAMEDATALEN) != 0)
{
get_rule_expr(tle->expr, context);
/* These types can be left unlabeled */
break;
default:
- extval = (char *) nameout(&(typeStruct->typname));
+ extval = pstrdup(NameStr(typeStruct->typname));
appendStringInfo(buf, "::%s", quote_identifier(extval));
pfree(extval);
break;
elog(ERROR, "cache lookup of relation %u failed", relid);
classStruct = (Form_pg_class) GETSTRUCT(classtup);
- return nameout(&(classStruct->relname));
+ return pstrdup(NameStr(classStruct->relname));
}
attnum, relid);
attStruct = (Form_pg_attribute) GETSTRUCT(atttup);
- return nameout(&(attStruct->attname));
+ return pstrdup(NameStr(attStruct->attname));
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#endif
result = (NameData *) palloc(NAMEDATALEN);
- StrNCpy(result->data, VARDATA(s), NAMEDATALEN);
+ StrNCpy(NameStr(*result), VARDATA(s), NAMEDATALEN);
/* now null pad to full length... */
while (len < NAMEDATALEN)
{
- *(result->data + len) = '\0';
+ *(NameStr(*result) + len) = '\0';
len++;
}
if (s == NULL)
return NULL;
- len = strlen(s->data);
+ len = strlen(NameStr(*s));
#ifdef STRINGDEBUG
printf("bpchar- convert string length %d (%d) ->%d\n",
#endif
result = (char *) palloc(VARHDRSZ + len);
- strncpy(VARDATA(result), s->data, len);
+ strncpy(VARDATA(result), NameStr(*s), len);
VARSIZE(result) = len + VARHDRSZ;
return result;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#endif
result = palloc(NAMEDATALEN);
- StrNCpy(result->data, VARDATA(s), NAMEDATALEN);
+ StrNCpy(NameStr(*result), VARDATA(s), NAMEDATALEN);
/* now null pad to full length... */
while (len < NAMEDATALEN)
{
- *(result->data + len) = '\0';
+ *(NameStr(*result) + len) = '\0';
len++;
}
if (s == NULL)
return NULL;
- len = strlen(s->data);
+ len = strlen(NameStr(*s));
#ifdef STRINGDEBUG
printf("text- convert string length %d (%d) ->%d\n",
#endif
result = palloc(VARHDRSZ + len);
- strncpy(VARDATA(result), s->data, len);
+ strncpy(VARDATA(result), NameStr(*s), len);
VARSIZE(result) = len + VARHDRSZ;
return result;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
cache->cc_skey[i].sk_nargs = cache->cc_skey[i].sk_func.fn_nargs;
CACHE5_elog(DEBUG, "CatalogCacheInit %s %d %d %x",
- &relation->rd_rel->relname,
+ RelationGetRelationName(relation),
i,
tupdesc->attrs[cache->cc_key[i] - 1]->attlen,
cache);
* typelen so this may break them - XXX
*/
namestrcpy(&n, v);
- v = n.data;
+ v = NameStr(n);
}
else if (l < 0)
l = VARSIZE(v);
*
*
* 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...
*
* this only works for system relations now
* ----------------
*/
- if (!IsSystemRelationName(RelationGetForm(relation)->relname.data))
+ if (!IsSystemRelationName(NameStr(RelationGetForm(relation)->relname)))
return;
/* ----------------
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.34 1999/09/09 02:36:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.35 1999/11/07 23:08:26 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
if (HeapTupleIsValid(tp))
{
Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
- return pstrdup(att_tup->attname.data);
+ return pstrdup(NameStr(att_tup->attname));
}
else
return NULL;
if (HeapTupleIsValid(tp))
{
Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
- return pstrdup(optup->oprname.data);
+ return pstrdup(NameStr(optup->oprname));
}
else
return NULL;
if (HeapTupleIsValid(tp))
{
Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
- return pstrdup(reltup->relname.data);
+ return pstrdup(NameStr(reltup->relname));
}
else
return NULL;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
do { \
RelIdCacheEnt *idhentry; RelNameCacheEnt *namehentry; \
char *relname; Oid reloid; bool found; \
- relname = (RELATION->rd_rel->relname).data; \
+ relname = RelationGetRelationName(RELATION); \
namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
relname, \
HASH_ENTER, \
do { \
RelNameCacheEnt *namehentry; RelIdCacheEnt *idhentry; \
char *relname; Oid reloid; bool found; \
- relname = (RELATION->rd_rel->relname).data; \
+ relname = RelationGetRelationName(RELATION); \
namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
relname, \
HASH_REMOVE, \
if (!HeapTupleIsValid(atttup))
elog(ERROR, "cannot find attribute %d of relation %s", i,
- relation->rd_rel->relname.data);
+ RelationGetRelationName(relation));
attp = (Form_pg_attribute) GETSTRUCT(atttup);
relation->rd_att->attrs[i - 1] =
relation->rd_rel = (Form_pg_class)
palloc((Size) (sizeof(*relation->rd_rel)));
MemSet(relation->rd_rel, 0, sizeof(FormData_pg_class));
- namestrcpy(&relation->rd_rel->relname, relationName);
+ strcpy(RelationGetRelationName(relation), relationName);
/* ----------------
initialize attribute tuple form
* null-padded
*/
namestrcpy(&name, relationName);
- RelationNameCacheLookup(name.data, rd);
+ RelationNameCacheLookup(NameStr(name), rd);
if (RelationIsValid(rd))
{
}
if (curr == NIL)
elog(FATAL, "Local relation %s not found in list",
- (RelationGetRelationName(relation))->data);
+ RelationGetRelationName(relation));
if (prev == NIL)
newlyCreatedRelns = lnext(newlyCreatedRelns);
else
continue;
if (attrdef[i].adbin != NULL)
elog(ERROR, "AttrDefaultFetch: second record found for attr %s in rel %s",
- relation->rd_att->attrs[adform->adnum - 1]->attname.data,
- relation->rd_rel->relname.data);
+ NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
+ RelationGetRelationName(relation));
val = (struct varlena *) fastgetattr(&tuple,
Anum_pg_attrdef_adbin,
adrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "AttrDefaultFetch: adbin IS NULL for attr %s in rel %s",
- relation->rd_att->attrs[adform->adnum - 1]->attname.data,
- relation->rd_rel->relname.data);
+ NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
+ RelationGetRelationName(relation));
attrdef[i].adbin = textout(val);
break;
}
if (i >= ndef)
elog(ERROR, "AttrDefaultFetch: unexpected record found for attr %d in rel %s",
adform->adnum,
- relation->rd_rel->relname.data);
+ RelationGetRelationName(relation));
}
if (found < ndef)
elog(ERROR, "AttrDefaultFetch: %d record not found for rel %s",
- ndef - found, relation->rd_rel->relname.data);
+ ndef - found, RelationGetRelationName(relation));
index_endscan(sd);
pfree(sd);
continue;
if (found == ncheck)
elog(ERROR, "RelCheckFetch: unexpected record found for rel %s",
- relation->rd_rel->relname.data);
+ RelationGetRelationName(relation));
rcname = (Name) fastgetattr(&tuple,
Anum_pg_relcheck_rcname,
rcrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelCheckFetch: rcname IS NULL for rel %s",
- relation->rd_rel->relname.data);
- check[found].ccname = nameout(rcname);
+ RelationGetRelationName(relation));
+ check[found].ccname = pstrdup(NameStr(*rcname));
val = (struct varlena *) fastgetattr(&tuple,
Anum_pg_relcheck_rcbin,
rcrel->rd_att, &isnull);
if (isnull)
elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
- relation->rd_rel->relname.data);
+ RelationGetRelationName(relation));
check[found].ccbin = textout(val);
found++;
ReleaseBuffer(buffer);
if (found < ncheck)
elog(ERROR, "RelCheckFetch: %d record not found for rel %s",
ncheck - found,
- relation->rd_rel->relname.data);
+ RelationGetRelationName(relation));
index_endscan(sd);
pfree(sd);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* save user-supplied name */
strcpy(temp_rel->user_relname, relname);
- StrNCpy(temp_rel->relname, ((Form_pg_class)
- GETSTRUCT(pg_class_tuple))->relname.data, NAMEDATALEN);
+ StrNCpy(temp_rel->relname, NameStr(((Form_pg_class)
+ GETSTRUCT(pg_class_tuple))->relname), NAMEDATALEN);
temp_rel->relid = pg_class_tuple->t_data->t_oid;
temp_rel->relkind = ((Form_pg_class) GETSTRUCT(pg_class_tuple))->relkind;
temp_rel->xid = GetCurrentTransactionId();
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
- proname = procedureStruct->proname.data;
+ proname = NameStr(procedureStruct->proname);
pronargs_save = *pronargs = procedureStruct->pronargs;
probinattr = heap_getattr(procedureTuple,
Anum_pg_proc_probin,
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
tup_db = (Form_pg_database) GETSTRUCT(&tup);
- if (strcmp(name, tup_db->datname.data) == 0)
+ if (strcmp(name, NameStr(tup_db->datname)) == 0)
{
/* Found it; extract the OID and the database path. */
*db_id = tup.t_data->t_oid;
*/
/* No more input. Time to quit, or \i done */
- if (line == NULL || (!pset->cur_cmd_interactive && *line == '\0'))
+ if (line == NULL)
{
if (GetVariableBool(pset->vars, "echo") && !GetVariableBool(pset->vars, "quiet"))
puts("EOF\n");
if (strspn(name, VALID_VARIABLE_CHARS) != strlen(name))
return false;
- for (current = space; current; previous = current, current = current->next)
+ for (current = space, previous = NULL; current; previous = current, current = current->next)
{
#ifdef USE_ASSERT_CHECKING
assert(current->name);
*
* 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 $
*
*-------------------------------------------------------------------------
*/
} NameData;
typedef NameData *Name;
+#define NameStr(name) ((name).data)
+
/* ----------------------------------------------------------------
* Section 3: TransactionId and CommandId
* ----------------------------------------------------------------
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*
* Returns a Relation Name
*/
-#define RelationGetRelationName(relation) (&(relation)->rd_rel->relname)
+#define RelationGetRelationName(relation) (NameStr((relation)->rd_rel->relname))
/*
* RelationGetNumberOfAttributes
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.11 1999/09/21 21:10:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.12 1999/11/07 23:08:34 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
strcat(var->refname, ".");
strcat(var->refname, cp);
var->datatype = malloc(sizeof(PLpgSQL_type));
- var->datatype->typname = strdup(nameout(&(typeStruct->typname)));
+ var->datatype->typname = strdup(NameStr(typeStruct->typname));
var->datatype->typoid = typetup->t_data->t_oid;
fmgr_info(typeStruct->typinput, &(var->datatype->typinput));
var->datatype->typbyval = typeStruct->typbyval;
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.13 1999/07/15 15:21:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.14 1999/11/07 23:08:35 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
var = (PLpgSQL_var *) (estate.datums[func->tg_relname_varno]);
var->isnull = false;
- var->value = (Datum) namein(nameout(&(trigdata->tg_relation->rd_rel->relname)));
+ var->value = (Datum) namein(RelationGetRelationName(trigdata->tg_relation));
var = (PLpgSQL_var *) (estate.datums[func->tg_nargs_varno]);
var->isnull = false;
* procedural language (PL)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.13 1999/07/15 15:21:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.14 1999/11/07 23:08:36 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
/* A list of attribute names for argument TG_relatts */
Tcl_DStringAppendElement(&tcl_trigtup, "");
for (i = 0; i < tupdesc->natts; i++)
- Tcl_DStringAppendElement(&tcl_trigtup, tupdesc->attrs[i]->attname.data);
+ Tcl_DStringAppendElement(&tcl_trigtup,
+ NameStr(tupdesc->attrs[i]->attname));
Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
Tcl_DStringFree(&tcl_trigtup);
Tcl_DStringInit(&tcl_trigtup);
/************************************************************
* Get the attribute name
************************************************************/
- attname = tupdesc->attrs[i]->attname.data;
+ attname = NameStr(tupdesc->attrs[i]->attname);
/************************************************************
* Get the attributes value
/************************************************************
* Get the attribute name
************************************************************/
- attname = tupdesc->attrs[i]->attname.data;
+ attname = NameStr(tupdesc->attrs[i]->attname);
/************************************************************
* Get the attributes value