mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
New NameStr macro to convert Name to Str. No need for var.data anymore.
Fewer calls to nameout. Better use of RelationGetRelationName.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* doesn't work! - jolly 8/19/95
|
||||
*
|
||||
*
|
||||
* $Id: version.c,v 1.22 1999/07/17 20:16:55 momjian Exp $
|
||||
* $Id: version.c,v 1.23 1999/11/07 23:08:03 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* At the point the version is defined, 2 physical relations are created
|
||||
@@ -190,7 +190,7 @@ setAttrList(char *bname)
|
||||
|
||||
for (i = maxattrs - 1; i > -1; --i)
|
||||
{
|
||||
attrname = (rel->rd_att->attrs[i]->attname).data;
|
||||
attrname = NameStr(rel->rd_att->attrs[i]->attname);
|
||||
|
||||
if (notfirst == 1)
|
||||
sprintf(temp_buf, ", %s = new.%s", attrname, attrname);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.45 1999/09/18 19:06:40 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.46 1999/11/07 23:08:01 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -127,7 +127,7 @@ cluster(char *oldrelname, char *oldindexname)
|
||||
*/
|
||||
NewHeap = copy_heap(OIDOldHeap);
|
||||
OIDNewHeap = RelationGetRelid(NewHeap);
|
||||
strcpy(NewHeapName, NewHeap->rd_rel->relname.data);
|
||||
strcpy(NewHeapName, RelationGetRelationName(NewHeap));
|
||||
|
||||
|
||||
/* To make the new heap visible (which is until now empty). */
|
||||
@@ -284,7 +284,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
|
||||
natts = 1;
|
||||
}
|
||||
|
||||
index_create((NewHeap->rd_rel->relname).data,
|
||||
index_create(RelationGetRelationName(NewHeap),
|
||||
NewIndexName,
|
||||
finfo,
|
||||
NULL, /* type info is in the old index */
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.55 1999/10/03 23:55:27 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.56 1999/11/07 23:08:01 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The PortalExecutorHeapMemory crap needs to be eliminated
|
||||
@@ -358,7 +358,7 @@ PerformAddAttribute(char *relationName,
|
||||
if (childrelid == myrelid)
|
||||
continue;
|
||||
rel = heap_open(childrelid, AccessExclusiveLock);
|
||||
PerformAddAttribute((rel->rd_rel->relname).data,
|
||||
PerformAddAttribute(RelationGetRelationName(rel),
|
||||
userName, false, colDef);
|
||||
heap_close(rel, AccessExclusiveLock);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.50 1999/10/26 03:12:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.51 1999/11/07 23:08:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -341,12 +341,12 @@ MergeAttributes(List *schema, List *supers, List **supconstr)
|
||||
/*
|
||||
* form name, type and constraints
|
||||
*/
|
||||
attributeName = (attribute->attname).data;
|
||||
attributeName = NameStr(attribute->attname);
|
||||
tuple = SearchSysCacheTuple(TYPOID,
|
||||
ObjectIdGetDatum(attribute->atttypid),
|
||||
0, 0, 0);
|
||||
Assert(HeapTupleIsValid(tuple));
|
||||
attributeType = (((Form_pg_type) GETSTRUCT(tuple))->typname).data;
|
||||
attributeType = NameStr(((Form_pg_type) GETSTRUCT(tuple))->typname);
|
||||
|
||||
/*
|
||||
* check validity
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Copyright (c) 1994-5, Regents of the University of California
|
||||
*
|
||||
* $Id: explain.c,v 1.48 1999/09/18 19:06:40 tgl Exp $
|
||||
* $Id: explain.c,v 1.49 1999/11/07 23:08:02 momjian Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -216,7 +216,7 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
|
||||
if (++i > 1)
|
||||
appendStringInfo(str, ", ");
|
||||
appendStringInfo(str,
|
||||
stringStringInfo((RelationGetRelationName(relation))->data));
|
||||
stringStringInfo(RelationGetRelationName(relation)));
|
||||
/* drop relcache refcount from RelationIdGetRelation */
|
||||
RelationDecrementReferenceCount(relation);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.12 1999/10/02 21:33:24 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.13 1999/11/07 23:08:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -533,7 +533,7 @@ GetDefaultOpClass(Oid atttypid)
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
return 0;
|
||||
|
||||
return nameout(&(((Form_pg_opclass) GETSTRUCT(tuple))->opcname));
|
||||
return nameout(&((Form_pg_opclass) GETSTRUCT(tuple))->opcname);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.38 1999/10/26 03:12:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.39 1999/11/07 23:08:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -233,7 +233,7 @@ AttributeAndRelationRemove(Oid typeOid)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = (((Form_pg_class) GETSTRUCT(tup))->relname).data;
|
||||
name = NameStr(((Form_pg_class) GETSTRUCT(tup))->relname);
|
||||
heap_destroy_with_catalog(name);
|
||||
}
|
||||
heap_endscan(scan);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.34 1999/09/24 00:24:17 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.35 1999/11/07 23:08:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -123,7 +123,7 @@ renameatt(char *relname,
|
||||
}
|
||||
/* make copy of cache value, could disappear in call */
|
||||
StrNCpy(childname,
|
||||
((Form_pg_class) GETSTRUCT(reltup))->relname.data,
|
||||
NameStr(((Form_pg_class) GETSTRUCT(reltup))->relname),
|
||||
NAMEDATALEN);
|
||||
/* note we need not recurse again! */
|
||||
renameatt(childname, oldattname, newattname, userName, 0);
|
||||
@@ -153,7 +153,7 @@ renameatt(char *relname,
|
||||
elog(ERROR, "renameatt: attribute \"%s\" exists", newattname);
|
||||
}
|
||||
|
||||
StrNCpy((((Form_pg_attribute) (GETSTRUCT(oldatttup)))->attname.data),
|
||||
StrNCpy(NameStr(((Form_pg_attribute) GETSTRUCT(oldatttup))->attname),
|
||||
newattname, NAMEDATALEN);
|
||||
|
||||
heap_replace(attrelation, &oldatttup->t_self, oldatttup, NULL);
|
||||
@@ -288,7 +288,7 @@ renamerel(char *oldrelname, char *newrelname)
|
||||
/*
|
||||
* Update pg_class tuple with new relname.
|
||||
*/
|
||||
StrNCpy((((Form_pg_class) GETSTRUCT(oldreltup))->relname.data),
|
||||
StrNCpy(NameStr(((Form_pg_class) GETSTRUCT(oldreltup))->relname),
|
||||
newrelname, NAMEDATALEN);
|
||||
|
||||
heap_replace(relrelation, &oldreltup->t_self, oldreltup, NULL);
|
||||
|
||||
@@ -391,8 +391,8 @@ RelationRemoveTriggers(Relation rel)
|
||||
pg_trigger = (Form_pg_trigger) GETSTRUCT(tup);
|
||||
refrel = heap_open(pg_trigger->tgrelid, NoLock);
|
||||
|
||||
stmt.relname = nameout(&(refrel->rd_rel->relname));
|
||||
stmt.trigname = nameout(&(pg_trigger->tgname));
|
||||
stmt.relname = pstrdup(RelationGetRelationName(refrel));
|
||||
stmt.trigname = nameout(&pg_trigger->tgname);
|
||||
|
||||
DropTrigger(&stmt);
|
||||
|
||||
@@ -450,7 +450,7 @@ RelationBuildTriggers(Relation relation)
|
||||
continue;
|
||||
if (found == ntrigs)
|
||||
elog(ERROR, "RelationBuildTriggers: unexpected record found for rel %.*s",
|
||||
NAMEDATALEN, relation->rd_rel->relname.data);
|
||||
NAMEDATALEN, RelationGetRelationName(relation));
|
||||
|
||||
pg_trigger = (Form_pg_trigger) GETSTRUCT(&tuple);
|
||||
|
||||
@@ -461,7 +461,7 @@ RelationBuildTriggers(Relation relation)
|
||||
build = &(triggers[found]);
|
||||
|
||||
build->tgoid = tuple.t_data->t_oid;
|
||||
build->tgname = nameout(&(pg_trigger->tgname));
|
||||
build->tgname = nameout(&pg_trigger->tgname);
|
||||
build->tgfoid = pg_trigger->tgfoid;
|
||||
build->tgfunc.fn_addr = NULL;
|
||||
build->tgtype = pg_trigger->tgtype;
|
||||
@@ -476,7 +476,7 @@ RelationBuildTriggers(Relation relation)
|
||||
tgrel->rd_att, &isnull);
|
||||
if (isnull)
|
||||
elog(ERROR, "RelationBuildTriggers: tgargs IS NULL for rel %.*s",
|
||||
NAMEDATALEN, relation->rd_rel->relname.data);
|
||||
NAMEDATALEN, RelationGetRelationName(relation));
|
||||
if (build->tgnargs > 0)
|
||||
{
|
||||
char *p;
|
||||
@@ -487,7 +487,7 @@ RelationBuildTriggers(Relation relation)
|
||||
tgrel->rd_att, &isnull);
|
||||
if (isnull)
|
||||
elog(ERROR, "RelationBuildTriggers: tgargs IS NULL for rel %.*s",
|
||||
NAMEDATALEN, relation->rd_rel->relname.data);
|
||||
NAMEDATALEN, RelationGetRelationName(relation));
|
||||
p = (char *) VARDATA(val);
|
||||
build->tgargs = (char **) palloc(build->tgnargs * sizeof(char *));
|
||||
for (i = 0; i < build->tgnargs; i++)
|
||||
@@ -507,7 +507,7 @@ RelationBuildTriggers(Relation relation)
|
||||
if (found < ntrigs)
|
||||
elog(ERROR, "RelationBuildTriggers: %d record not found for rel %.*s",
|
||||
ntrigs - found,
|
||||
NAMEDATALEN, relation->rd_rel->relname.data);
|
||||
NAMEDATALEN, RelationGetRelationName(relation));
|
||||
|
||||
index_endscan(sd);
|
||||
pfree(sd);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.122 1999/09/28 11:41:04 vadim Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.123 1999/11/07 23:08:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -122,7 +122,7 @@ vacuum(char *vacrel, bool verbose, bool analyze, List *va_spec)
|
||||
|
||||
/* vacrel gets de-allocated on transaction commit */
|
||||
if (vacrel)
|
||||
strcpy(VacRel.data, vacrel);
|
||||
strcpy(NameStr(VacRel), vacrel);
|
||||
|
||||
pmem = PortalGetVariableMemory(vc_portal);
|
||||
old = MemoryContextSwitchTo((MemoryContext) pmem);
|
||||
@@ -288,11 +288,11 @@ vc_getrels(NameData *VacRelP)
|
||||
|
||||
StartTransactionCommand();
|
||||
|
||||
if (VacRelP->data)
|
||||
if (NameStr(*VacRelP))
|
||||
{
|
||||
ScanKeyEntryInitialize(&key, 0x0, Anum_pg_class_relname,
|
||||
F_NAMEEQ,
|
||||
PointerGetDatum(VacRelP->data));
|
||||
PointerGetDatum(NameStr(*VacRelP)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -402,7 +402,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
|
||||
vacrelstats->relid = relid;
|
||||
vacrelstats->num_pages = vacrelstats->num_tuples = 0;
|
||||
vacrelstats->hasindex = false;
|
||||
if (analyze && !IsSystemRelationName((RelationGetRelationName(onerel))->data))
|
||||
if (analyze && !IsSystemRelationName(RelationGetRelationName(onerel)))
|
||||
{
|
||||
int attr_cnt,
|
||||
*attnums = NULL;
|
||||
@@ -418,7 +418,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
|
||||
|
||||
if (length(va_cols) > attr_cnt)
|
||||
elog(ERROR, "vacuum: too many attributes specified for relation %s",
|
||||
(RelationGetRelationName(onerel))->data);
|
||||
RelationGetRelationName(onerel));
|
||||
attnums = (int *) palloc(attr_cnt * sizeof(int));
|
||||
foreach(le, va_cols)
|
||||
{
|
||||
@@ -434,7 +434,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
|
||||
else
|
||||
{
|
||||
elog(ERROR, "vacuum: there is no attribute %s in %s",
|
||||
col, (RelationGetRelationName(onerel))->data);
|
||||
col, RelationGetRelationName(onerel));
|
||||
}
|
||||
}
|
||||
attr_cnt = tcnt;
|
||||
@@ -625,7 +625,7 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
|
||||
|
||||
getrusage(RUSAGE_SELF, &ru0);
|
||||
|
||||
relname = (RelationGetRelationName(onerel))->data;
|
||||
relname = RelationGetRelationName(onerel);
|
||||
elog(MESSAGE_LEVEL, "--Relation %s--", relname);
|
||||
|
||||
tups_vacuumed = num_tuples = nkeep = nunused = ncrash = empty_pages =
|
||||
@@ -1762,7 +1762,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
|
||||
|
||||
elog(MESSAGE_LEVEL, "Rel %s: Pages: %u --> %u; Tuple(s) moved: %u. \
|
||||
Elapsed %u/%u sec.",
|
||||
(RelationGetRelationName(onerel))->data,
|
||||
RelationGetRelationName(onerel),
|
||||
nblocks, blkno, num_moved,
|
||||
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
|
||||
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
|
||||
@@ -1895,7 +1895,7 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages)
|
||||
Assert(vacrelstats->num_pages >= vacuum_pages->vpl_empty_end_pages);
|
||||
nblocks = vacrelstats->num_pages - vacuum_pages->vpl_empty_end_pages;
|
||||
elog(MESSAGE_LEVEL, "Rel %s: Pages: %u --> %u.",
|
||||
(RelationGetRelationName(onerel))->data,
|
||||
RelationGetRelationName(onerel),
|
||||
vacrelstats->num_pages, nblocks);
|
||||
|
||||
/*
|
||||
@@ -1971,13 +1971,13 @@ vc_scanoneind(Relation indrel, int num_tuples)
|
||||
getrusage(RUSAGE_SELF, &ru1);
|
||||
|
||||
elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %u. Elapsed %u/%u sec.",
|
||||
indrel->rd_rel->relname.data, nipages, nitups,
|
||||
RelationGetRelationName(indrel), nipages, nitups,
|
||||
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
|
||||
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
|
||||
|
||||
if (nitups != num_tuples)
|
||||
elog(NOTICE, "Index %s: NUMBER OF INDEX' TUPLES (%u) IS NOT THE SAME AS HEAP' (%u)",
|
||||
indrel->rd_rel->relname.data, nitups, num_tuples);
|
||||
RelationGetRelationName(indrel), nitups, num_tuples);
|
||||
|
||||
} /* vc_scanoneind */
|
||||
|
||||
@@ -2030,7 +2030,7 @@ vc_vaconeind(VPageList vpl, Relation indrel, int num_tuples, int keep_tuples)
|
||||
if (vp->vpd_offsets_free == 0)
|
||||
{ /* this is EmptyPage !!! */
|
||||
elog(NOTICE, "Index %s: pointer to EmptyPage (blk %u off %u) - fixing",
|
||||
indrel->rd_rel->relname.data,
|
||||
RelationGetRelationName(indrel),
|
||||
vp->vpd_blkno, ItemPointerGetOffsetNumber(heapptr));
|
||||
}
|
||||
++tups_vacuumed;
|
||||
@@ -2051,14 +2051,14 @@ vc_vaconeind(VPageList vpl, Relation indrel, int num_tuples, int keep_tuples)
|
||||
getrusage(RUSAGE_SELF, &ru1);
|
||||
|
||||
elog(MESSAGE_LEVEL, "Index %s: Pages %u; Tuples %u: Deleted %u. Elapsed %u/%u sec.",
|
||||
indrel->rd_rel->relname.data, num_pages,
|
||||
RelationGetRelationName(indrel), num_pages,
|
||||
num_index_tuples - keep_tuples, tups_vacuumed,
|
||||
ru1.ru_stime.tv_sec - ru0.ru_stime.tv_sec,
|
||||
ru1.ru_utime.tv_sec - ru0.ru_utime.tv_sec);
|
||||
|
||||
if (num_index_tuples != num_tuples + keep_tuples)
|
||||
elog(NOTICE, "Index %s: NUMBER OF INDEX' TUPLES (%u) IS NOT THE SAME AS HEAP' (%u)",
|
||||
indrel->rd_rel->relname.data, num_index_tuples, num_tuples);
|
||||
RelationGetRelationName(indrel), num_index_tuples, num_tuples);
|
||||
|
||||
} /* vc_vaconeind */
|
||||
|
||||
@@ -2398,7 +2398,7 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
|
||||
* problem
|
||||
*/
|
||||
if (VacAttrStatsLtGtValid(stats) && stats->initialized
|
||||
/* && !IsSystemRelationName(pgcform->relname.data)
|
||||
/* && !IsSystemRelationName(NameData(pgcform->relname))
|
||||
*/ )
|
||||
{
|
||||
float32data nullratio;
|
||||
|
||||
Reference in New Issue
Block a user