]> granicus.if.org Git - postgresql/commitdiff
New NameStr macro to convert Name to Str. No need for var.data anymore.
authorBruce Momjian <bruce@momjian.us>
Sun, 7 Nov 1999 23:08:36 +0000 (23:08 +0000)
committerBruce Momjian <bruce@momjian.us>
Sun, 7 Nov 1999 23:08:36 +0000 (23:08 +0000)
Fewer calls to nameout.

Better use of RelationGetRelationName.

65 files changed:
src/backend/access/common/printtup.c
src/backend/access/common/tupdesc.c
src/backend/access/gist/gist.c
src/backend/access/hash/hashfunc.c
src/backend/access/heap/heapam.c
src/backend/access/index/indexam.c
src/backend/access/nbtree/nbtcompare.c
src/backend/access/nbtree/nbtsearch.c
src/backend/access/rtree/rtree.c
src/backend/bootstrap/bootstrap.c
src/backend/catalog/aclchk.c
src/backend/catalog/heap.c
src/backend/commands/_deadcode/version.c
src/backend/commands/cluster.c
src/backend/commands/command.c
src/backend/commands/creatinh.c
src/backend/commands/explain.c
src/backend/commands/indexcmds.c
src/backend/commands/remove.c
src/backend/commands/rename.c
src/backend/commands/trigger.c
src/backend/commands/vacuum.c
src/backend/executor/execMain.c
src/backend/executor/execTuples.c
src/backend/executor/execUtils.c
src/backend/executor/nodeUnique.c
src/backend/executor/spi.c
src/backend/libpq/be-dumpdata.c
src/backend/optimizer/prep/preptlist.c
src/backend/parser/analyze.c
src/backend/parser/parse_func.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_target.c
src/backend/parser/parse_type.c
src/backend/rewrite/locks.c
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteManip.c
src/backend/rewrite/rewriteRemove.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/large_object/inv_api.c
src/backend/storage/lmgr/proc.c
src/backend/storage/smgr/md.c
src/backend/storage/smgr/smgr.c
src/backend/tcop/dest.c
src/backend/utils/adt/like.c
src/backend/utils/adt/name.c
src/backend/utils/adt/regexp.c
src/backend/utils/adt/regproc.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varlena.c
src/backend/utils/cache/catcache.c
src/backend/utils/cache/inval.c
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/temprel.c
src/backend/utils/fmgr/dfmgr.c
src/backend/utils/misc/database.c
src/bin/psql/mainloop.c
src/bin/psql/variables.c
src/include/postgres.h
src/include/utils/rel.h
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/tcl/pltcl.c

index f53113560477cea893e207dab7bce6467c0bf946..70d700f5a76a1ea91c3f93c9118de4d3bfa1215b 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.49 1999/07/17 20:16:35 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.50 1999/11/07 23:07:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -245,7 +245,7 @@ printatt(unsigned attributeId,
 {
        printf("\t%2d: %s%s%s%s\t(typeid = %u, len = %d, typmod = %d, byval = %c)\n",
                   attributeId,
-                  attributeP->attname.data,
+                  NameStr(attributeP->attname),
                   value != NULL ? " = \"" : "",
                   value != NULL ? value : "",
                   value != NULL ? "\"" : "",
index f0e717445a6ba53eecfa860d938de048c9eeee08..b4d1c0c0cce2de52cf853d188075cc8c7275f7e5 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.55 1999/10/03 23:55:25 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.56 1999/11/07 23:07:47 momjian Exp $
  *
  * NOTES
  *       some of the executor utility code such as "ExecTypeFromTL" should be
@@ -278,7 +278,7 @@ TupleDescInitEntry(TupleDesc desc,
        if (attributeName != NULL)
                namestrcpy(&(att->attname), attributeName);
        else
-               MemSet(att->attname.data, 0, NAMEDATALEN);
+               MemSet(NameStr(att->attname), 0, NAMEDATALEN);
 
 
        att->attdisbursion = 0;         /* dummy value */
index bc3338b11564450c53bd0dcd85310f9e52caa9c1..425c354302d822296ced63852f1de8dfb9ad59f8 100644 (file)
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.46 1999/09/24 00:23:42 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.47 1999/11/07 23:07:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -111,7 +111,7 @@ gistbuild(Relation heap,
         */
 
        if (oldPred == NULL && (nb = RelationGetNumberOfBlocks(index)) != 0)
-               elog(ERROR, "%s already contains data", index->rd_rel->relname.data);
+               elog(ERROR, "%s already contains data", RelationGetRelationName(index));
 
        /* initialize the root page (if this is a new index) */
        if (oldPred == NULL)
index 7ccaf1ed759fd4eaf70c4b8f5a923e830d2df3af..a2ad8df11f129bd29e1cd62a47e1f79e54e05377 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.19 1999/07/15 22:38:35 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.20 1999/11/07 23:07:49 momjian Exp $
  *
  * NOTES
  *       These functions are stored in pg_amproc.      For each operator class
@@ -177,7 +177,7 @@ hashname(NameData *n)
        int                     len;
        char       *key;
 
-       key = n->data;
+       key = NameStr(*n);
 
        h = 0;
        len = NAMEDATALEN;
index f30b1026b82aed8eee0b09e236c6785905a64b25..a26216c0269f996710a9b1fb380082444aaf7eaa 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.57 1999/10/30 23:10:21 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.58 1999/11/07 23:07:52 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -259,7 +259,7 @@ heapgettup(Relation relation,
        elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", buffer, nkeys, key);
 
        elog(DEBUG, "heapgettup: relation(%c)=`%s', %p",
-                relation->rd_rel->relkind, &relation->rd_rel->relname,
+                relation->rd_rel->relkind, RelationGetRelationName(relation),
                 snapshot);
 #endif  /* !defined(HEAPDEBUGALL) */
 
@@ -525,7 +525,7 @@ heap_open(Oid relationId, LOCKMODE lockmode)
 
        /* Under no circumstances will we return an index as a relation. */
        if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
-               elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
+               elog(ERROR, "%s is an index relation", RelationGetRelationName(r));
 
        if (lockmode == NoLock)
                return r;                               /* caller must check RelationIsValid! */
@@ -567,7 +567,7 @@ heap_openr(char *relationName, LOCKMODE lockmode)
 
        /* Under no circumstances will we return an index as a relation. */
        if (RelationIsValid(r) && r->rd_rel->relkind == RELKIND_INDEX)
-               elog(ERROR, "%s is an index relation", r->rd_rel->relname.data);
+               elog(ERROR, "%s is an index relation", RelationGetRelationName(r));
 
        if (lockmode == NoLock)
                return r;                               /* caller must check RelationIsValid! */
@@ -765,7 +765,7 @@ heap_endscan(HeapScanDesc scan)
 #ifdef HEAPDEBUGALL
 #define HEAPDEBUG_1 \
 elog(DEBUG, "heap_getnext([%s,nkeys=%d],backw=%d) called", \
-        scan->rs_rd->rd_rel->relname.data, scan->rs_nkeys, backw)
+        RelationGetRelationName(scan->rs_rd), scan->rs_nkeys, backw)
 
 #define HEAPDEBUG_2 \
         elog(DEBUG, "heap_getnext called with backw (no tracing yet)")
@@ -1045,7 +1045,7 @@ heap_fetch(Relation relation,
 
        if (!BufferIsValid(buffer))
                elog(ERROR, "heap_fetch: %s relation: ReadBuffer(%lx) failed",
-                        &relation->rd_rel->relname, (long) tid);
+                        RelationGetRelationName(relation), (long) tid);
 
        LockBuffer(buffer, BUFFER_LOCK_SHARE);
 
@@ -1121,7 +1121,7 @@ heap_get_latest_tid(Relation relation,
 
        if (!BufferIsValid(buffer))
                elog(ERROR, "heap_get_latest_tid: %s relation: ReadBuffer(%lx) failed",
-                        &relation->rd_rel->relname, (long) tid);
+                        RelationGetRelationName(relation), (long) tid);
 
        LockBuffer(buffer, BUFFER_LOCK_SHARE);
 
@@ -1231,7 +1231,7 @@ heap_insert(Relation relation, HeapTuple tup)
 
        RelationPutHeapTupleAtEnd(relation, tup);
 
-       if (IsSystemRelationName(RelationGetRelationName(relation)->data))
+       if (IsSystemRelationName(RelationGetRelationName(relation)))
                RelationInvalidateHeapTuple(relation, tup);
 
        return tup->t_data->t_oid;
index 6ad242c0c39a5cdbb15dd53bda76ff442c5bdcfd..1a7ee4d3771dfc3d8b386b523f0729397a93ce63 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.36 1999/09/18 19:06:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.37 1999/11/07 23:07:54 momjian Exp $
  *
  * INTERFACE ROUTINES
  *             index_open              - open an index relation by relationId
@@ -147,7 +147,7 @@ index_open(Oid relationId)
                elog(ERROR, "Index %u does not exist", relationId);
 
        if (r->rd_rel->relkind != RELKIND_INDEX)
-               elog(ERROR, "%s is not an index relation", r->rd_rel->relname.data);
+               elog(ERROR, "%s is not an index relation", RelationGetRelationName(r));
 
        return r;
 }
@@ -169,7 +169,7 @@ index_openr(char *relationName)
                elog(ERROR, "Index '%s' does not exist", relationName);
 
        if (r->rd_rel->relkind != RELKIND_INDEX)
-               elog(ERROR, "%s is not an index relation", r->rd_rel->relname.data);
+               elog(ERROR, "%s is not an index relation", RelationGetRelationName(r));
 
        return r;
 }
index 6673d69b84a4b33696f1def8c26b6cbc7b5252c8..0fc6d4ca69832864d38cda47186cb03e563b610d 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.27 1999/07/17 20:16:41 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.28 1999/11/07 23:07:56 momjian Exp $
  *
  *     NOTES
  *             These functions are stored in pg_amproc.  For each operator class
@@ -131,7 +131,7 @@ btcharcmp(char a, char b)
 int32
 btnamecmp(NameData *a, NameData *b)
 {
-       return strncmp(a->data, b->data, NAMEDATALEN);
+       return strncmp(NameStr(*a), NameStr(*b), NAMEDATALEN);
 }
 
 int32
index 0ad8b4ab36f996f5efccfa17e1d0f990e8feb82c..5b268ed2ccd4d7e8a82afeadd0ba10fe6b5602cc 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.54 1999/09/27 18:20:21 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.55 1999/11/07 23:07:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -206,7 +206,7 @@ _bt_moveright(Relation rel,
                                                                                PageGetItemId(page, P_FIRSTKEY),
                                                                                BTEqualStrategyNumber))
                                                        elog(FATAL, "btree: BTP_CHAIN flag was expected in %s (access = %s)",
-                                                                rel->rd_rel->relname.data, access ? "bt_write" : "bt_read");
+                                                                RelationGetRelationName(rel), access ? "bt_write" : "bt_read");
                                                if (_bt_skeycmp(rel, keysz, scankey, page,
                                                                                PageGetItemId(page, offmax),
                                                                                BTEqualStrategyNumber))
index ee36b418893d10a0e3c5f1ea4976ca580d10e856..fc7f31606bbc4f5b256d79b01f2d6f9216187b84 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.38 1999/09/24 00:23:59 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.39 1999/11/07 23:07:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -105,7 +105,7 @@ rtbuild(Relation heap,
         */
 
        if (oldPred == NULL && (nb = RelationGetNumberOfBlocks(index)) != 0)
-               elog(ERROR, "%s already contains data", index->rd_rel->relname.data);
+               elog(ERROR, "%s already contains data", RelationGetRelationName(index));
 
        /* initialize the root page (if this is a new index) */
        if (oldPred == NULL)
index 35797e82d255c187b8f107dcb40f30d60ec0136b..4e9e626f9b3f57a0b1519b1bf35a5a5ae98dcdaf 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.70 1999/10/25 03:07:43 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.71 1999/11/07 23:07:59 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -479,7 +479,7 @@ boot_openrel(char *relname)
                 */
                if (namestrcmp(&attrtypes[i]->attname, "attisset") == 0)
                        attrtypes[i]->attisset = get_attisset(RelationGetRelid(reldesc),
-                                                                                        attrtypes[i]->attname.data);
+                                                                                        NameStr(attrtypes[i]->attname));
                else
                        attrtypes[i]->attisset = false;
 
@@ -488,7 +488,7 @@ boot_openrel(char *relname)
                        Form_pg_attribute at = attrtypes[i];
 
                        printf("create attribute %d name %s len %d num %d type %d\n",
-                                  i, at->attname.data, at->attlen, at->attnum,
+                                  i, NameStr(at->attname), at->attlen, at->attnum,
                                   at->atttypid
                                );
                        fflush(stdout);
@@ -507,7 +507,7 @@ closerel(char *name)
        {
                if (reldesc)
                {
-                       if (namestrcmp(RelationGetRelationName(reldesc), name) != 0)
+                       if (strcmp(RelationGetRelationName(reldesc), name) != 0)
                                elog(ERROR, "closerel: close of '%s' when '%s' was expected",
                                         name, relname ? relname : "(null)");
                }
@@ -558,7 +558,7 @@ DefineAttr(char *name, char *type, int attnum)
                attrtypes[attnum]->atttypid = Ap->am_oid;
                namestrcpy(&attrtypes[attnum]->attname, name);
                if (!Quiet)
-                       printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
+                       printf("<%s %s> ", NameStr(attrtypes[attnum]->attname), type);
                attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
                attlen = attrtypes[attnum]->attlen = Ap->am_typ.typlen;
                attrtypes[attnum]->attbyval = Ap->am_typ.typbyval;
@@ -569,7 +569,7 @@ DefineAttr(char *name, char *type, int attnum)
                attrtypes[attnum]->atttypid = Procid[typeoid].oid;
                namestrcpy(&attrtypes[attnum]->attname, name);
                if (!Quiet)
-                       printf("<%s %s> ", attrtypes[attnum]->attname.data, type);
+                       printf("<%s %s> ", NameStr(attrtypes[attnum]->attname), type);
                attrtypes[attnum]->attnum = 1 + attnum; /* fillatt */
                attlen = attrtypes[attnum]->attlen = Procid[typeoid].len;
 
@@ -792,7 +792,7 @@ gettype(char *type)
        {
                for (app = Typ; *app != (struct typmap *) NULL; app++)
                {
-                       if (strncmp((*app)->am_typ.typname.data, type, NAMEDATALEN) == 0)
+                       if (strncmp(NameStr((*app)->am_typ.typname), type, NAMEDATALEN) == 0)
                        {
                                Ap = *app;
                                return (*app)->am_oid;
index 33a589ec88b1b81502b3bc3f09b0325382fc437e..262312eb6763d182e2acbe754003b6dc92482fef 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.28 1999/09/18 19:06:33 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.29 1999/11/07 23:08:00 momjian Exp $
  *
  * NOTES
  *       See acl.h.
@@ -192,7 +192,7 @@ get_groname(AclId grosysid)
                                                                ObjectIdGetDatum(grosysid),
                                                                0, 0, 0);
        if (HeapTupleIsValid(tuple))
-               name = (((Form_pg_group) GETSTRUCT(tuple))->groname).data;
+               name = NameStr(((Form_pg_group) GETSTRUCT(tuple))->groname);
        else
                elog(NOTICE, "get_groname: group %d not found", grosysid);
        return name;
index 52cd68b82a5adc1803abdb551d8b1d7c1cc6a04b..fe05d24194736fa2ce42824212cb13c3c2b14fe1 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.106 1999/11/04 08:00:56 inoue Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.107 1999/11/07 23:08:00 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -290,7 +290,7 @@ heap_create(char *relname,
         * ----------------
         */
        MemSet((char *) rel->rd_rel, 0, sizeof *rel->rd_rel);
-       namestrcpy(&(rel->rd_rel->relname), relname);
+       strcpy(RelationGetRelationName(rel), relname);
        rel->rd_rel->relkind = RELKIND_UNCATALOGED;
        rel->rd_rel->relnatts = natts;
        if (tupDesc->constr)
@@ -440,14 +440,14 @@ CheckAttributeNames(TupleDesc tupdesc)
                        {
                                elog(ERROR, "Attribute '%s' has a name conflict"
                                         "\n\tName matches an existing system attribute",
-                                        HeapAtt[j]->attname.data);
+                                        NameStr(HeapAtt[j]->attname));
                        }
                }
                if (tupdesc->attrs[i]->atttypid == UNKNOWNOID)
                {
                        elog(NOTICE, "Attribute '%s' has an unknown type"
                                 "\n\tRelation created; continue",
-                                tupdesc->attrs[i]->attname.data);
+                                NameStr(tupdesc->attrs[i]->attname));
                }
        }
 
@@ -463,7 +463,7 @@ CheckAttributeNames(TupleDesc tupdesc)
                                           &(tupdesc->attrs[i]->attname)))
                        {
                                elog(ERROR, "Attribute '%s' is repeated",
-                                        tupdesc->attrs[j]->attname.data);
+                                        NameStr(tupdesc->attrs[j]->attname));
                        }
                }
        }
@@ -1074,7 +1074,7 @@ DeleteRelationTuple(Relation rel)
        {
                heap_close(pg_class_desc, RowExclusiveLock);
                elog(ERROR, "Relation '%s' does not exist",
-                        &rel->rd_rel->relname);
+                                       RelationGetRelationName(rel));
        }
 
        /* ----------------
@@ -1376,7 +1376,7 @@ DeleteTypeTuple(Relation rel)
                heap_endscan(pg_type_scan);
                heap_close(pg_type_desc, RowExclusiveLock);
                elog(ERROR, "DeleteTypeTuple: %s type nonexistent",
-                        &rel->rd_rel->relname);
+                        RelationGetRelationName(rel));
        }
 
        /* ----------------
@@ -1420,7 +1420,7 @@ DeleteTypeTuple(Relation rel)
                heap_close(pg_type_desc, RowExclusiveLock);
 
                elog(ERROR, "DeleteTypeTuple: att of type %s exists in relation %u",
-                        &rel->rd_rel->relname, relid);
+                        RelationGetRelationName(rel), relid);
        }
        heap_endscan(pg_attribute_scan);
        heap_close(pg_attribute_desc, RowExclusiveLock);
@@ -1463,9 +1463,9 @@ heap_destroy_with_catalog(char *relname)
         */
        /* allow temp of pg_class? Guess so. */
        if (!istemp && !allowSystemTableMods &&
-               IsSystemRelationName(RelationGetRelationName(rel)->data))
+               IsSystemRelationName(RelationGetRelationName(rel)))
                elog(ERROR, "System relation '%s' cannot be destroyed",
-                        &rel->rd_rel->relname);
+                        RelationGetRelationName(rel));
 
        /* ----------------
         *      DROP TABLE within a transaction block is dangerous, because
@@ -1723,8 +1723,8 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, char *adbin,
         * deparse_expression needs a RangeTblEntry list, so make one
         */
        rte = makeNode(RangeTblEntry);
-       rte->relname = RelationGetRelationName(rel)->data;
-       rte->refname = RelationGetRelationName(rel)->data;
+       rte->relname = RelationGetRelationName(rel);
+       rte->refname = RelationGetRelationName(rel);
        rte->relid = RelationGetRelid(rel);
        rte->inh = false;
        rte->inFromCl = true;
@@ -1802,8 +1802,8 @@ StoreRelCheck(Relation rel, char *ccname, char *ccbin)
         * deparse_expression needs a RangeTblEntry list, so make one
         */
        rte = makeNode(RangeTblEntry);
-       rte->relname = RelationGetRelationName(rel)->data;
-       rte->refname = RelationGetRelationName(rel)->data;
+       rte->relname = RelationGetRelationName(rel);
+       rte->refname = RelationGetRelationName(rel);
        rte->relid = RelationGetRelid(rel);
        rte->inh = false;
        rte->inFromCl = true;
@@ -1882,7 +1882,7 @@ AddRelationRawConstraints(Relation rel,
                                                  List *rawColDefaults,
                                                  List *rawConstraints)
 {
-       char       *relname = RelationGetRelationName(rel)->data;
+       char       *relname = RelationGetRelationName(rel);
        TupleDesc       tupleDesc;
        TupleConstr *oldconstr;
        int                     numoldchecks;
@@ -1961,7 +1961,7 @@ AddRelationRawConstraints(Relation rel,
                                        elog(ERROR, "Attribute '%s' is of type '%s'"
                                                 " but default expression is of type '%s'"
                                                 "\n\tYou will need to rewrite or cast the expression",
-                                                atp->attname.data,
+                                                NameStr(atp->attname),
                                                 typeidTypeName(atp->atttypid),
                                                 typeidTypeName(type_id));
                        }
index 1d53690c1e5cccf2b08feade0f65477ce90887c1..3d3683135f88695ff16748058ea2be74df210584 100644 (file)
@@ -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);
index d578fc263f030aa4ccd6904bec26b2bb9e2a7848..9f87d27b474fe7294de7e9b5e9e409045e201e5c 100644 (file)
@@ -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 */
index 3e71e7d1927f4977868586bb676c5d0ca2bb2afd..5fab0e79d10cad8e6aac9bbaa2a27ddbcc297d34 100644 (file)
@@ -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);
                        }
index f07586dac0acaef18f8365eb03ee654ba7d11915..491f3f642f3de026ecc878657c6181d76e6eb52a 100644 (file)
@@ -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
index 11e5c39423918fa3ba8081eff5e4ae95647698c8..99e4e45dd5c7f0cdc3458c0efd2df0810b6c1793 100644 (file)
@@ -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);
                        }
index 5f82c2b532152a03dea0746fa3f4c89ab5509a17..1e110bcdb9c66c5a5adc0f4a4770137e84ccfeba 100644 (file)
@@ -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);
 }
 
 /*
index 67cd5c8c2abbd610bb61212b9d2ecb15607211c6..ffc1d56960991e45bf7cdd57154e2fa6503cd478 100644 (file)
@@ -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);
index 0a72ba497ec1db82c68e139baf639eea9e1b823c..85a49e59f3db4ceeac0c479b23bb24c67c3dd737 100644 (file)
@@ -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);
index 1bec6aa7626e91d660ac27498e3e17e0e9445e88..cf68bbb8a70f3b7e21cf726bcac147c646bab5e8 100644 (file)
@@ -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);
index 62ef4028d768d460dafd3c56941b584d7fb43fd8..0d631b15085393bc440c0e4e944b4d01aec49df1 100644 (file)
@@ -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;
index 5dec35e1061d7e4383226b0caa0defa3f8c52ce3..1785093d0ec47cb1f22a9b1bd1e8673c33d2cd4b 100644 (file)
@@ -26,7 +26,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.99 1999/11/01 05:09:17 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.100 1999/11/07 23:08:05 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -559,7 +559,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
 
                if (resultRelationDesc->rd_rel->relkind == RELKIND_SEQUENCE)
                        elog(ERROR, "You can't change sequence relation %s",
-                                resultRelationDesc->rd_rel->relname.data);
+                                RelationGetRelationName(resultRelationDesc));
 
                resultRelationInfo = makeNode(RelationInfo);
                resultRelationInfo->ri_RangeTableIndex = resultRelationIndex;
@@ -1501,7 +1501,7 @@ ExecRelCheck(Relation rel, HeapTuple tuple, EState *estate)
        slot->ttc_tupleDescriptor = rel->rd_att;
        slot->ttc_buffer = InvalidBuffer;
        slot->ttc_whichplan = -1;
-       rte->relname = nameout(&(rel->rd_rel->relname));
+       rte->relname = RelationGetRelationName(rel);
        rte->refname = rte->relname;
        rte->relid = RelationGetRelid(rel);
        /* inh, inFromCl, inJoinSet, skipAcl won't be used, leave them zero */
@@ -1538,7 +1538,6 @@ ExecRelCheck(Relation rel, HeapTuple tuple, EState *estate)
        }
 
        pfree(slot);
-       pfree(rte->relname);
        pfree(rte);
        pfree(rtlist);
        pfree(econtext);
@@ -1561,7 +1560,7 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple, EState *estate)
                {
                        if (rel->rd_att->attrs[attrChk - 1]->attnotnull && heap_attisnull(tuple, attrChk))
                                elog(ERROR, "%s: Fail to add null value in not null attribute %s",
-                                 caller, rel->rd_att->attrs[attrChk - 1]->attname.data);
+                                 caller, NameStr(rel->rd_att->attrs[attrChk - 1]->attname));
                }
        }
 
index 835dba7c5cd27743ba8ebb7ae761ae4accd1c692..53edd555ad8f546b798a77de925a8a54eb21d332 100644 (file)
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.30 1999/09/24 00:24:23 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.31 1999/11/07 23:08:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -913,7 +913,7 @@ ExecTypeFromTL(List *targetList)
                                                        (Oid) restype,
                                                        resdom->resno,
                                                        resdom->reslen,
-                                                       resdom->resname->data,
+                                                       NameStr(*resdom->resname),
                                                        get_typbyval(restype),
                                                        get_typalign(restype));
 */
index 197995c346228efce0a8d30bc2ad71d0f02574a7..27aecb5d000ac71efbc28173fa8598222946a0b0 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.49 1999/09/18 19:06:48 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.50 1999/11/07 23:08:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -546,9 +546,9 @@ ExecSetTypeInfo(int index,
        att->attrelid = 0;                      /* dummy value */
 
        if (attName != (char *) NULL)
-               StrNCpy(att->attname.data, attName, NAMEDATALEN);
+               StrNCpy(NameStr(att->attname), attName, NAMEDATALEN);
        else
-               MemSet(att->attname.data, 0, NAMEDATALEN);
+               MemSet(NameStr(att->attname), 0, NAMEDATALEN);
 
        att->atttypid = typeID;
        att->attdefrel = 0;                     /* dummy value */
index 13547d4b3cd610922572fd934650b9a383ac931e..c1b1131d97c0358ebf2b1b09ceaca5b8ec5bf2cf 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.24 1999/07/17 20:16:59 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.25 1999/11/07 23:08:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -314,7 +314,7 @@ ExecInitUnique(Unique *node, EState *estate, Plan *parent)
                 * the parser should have ensured that uniqueAttr is a legal
                 * attribute name
                 */
-               while (strcmp((tupDesc->attrs[i]->attname).data, uniqueAttr) != 0)
+               while (strcmp(NameStr(tupDesc->attrs[i]->attname), uniqueAttr) != 0)
                        i++;
                node->uniqueAttrNum = i + 1;    /* attribute numbers start from 1 */
        }
index b54fc62b42c973c5ef20420519baedba1500f5bf..e8aa326b6c7c2ca8bcec73c717ced3e806fa46e5 100644 (file)
@@ -3,7 +3,7 @@
  * spi.c
  *                             Server Programming Interface
  *
- * $Id: spi.c,v 1.40 1999/07/15 22:39:11 momjian Exp $
+ * $Id: spi.c,v 1.41 1999/11/07 23:08:06 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -369,7 +369,7 @@ SPI_fnumber(TupleDesc tupdesc, char *fname)
 
        for (res = 0; res < tupdesc->natts; res++)
        {
-               if (strcasecmp(tupdesc->attrs[res]->attname.data, fname) == 0)
+               if (strcasecmp(NameStr(tupdesc->attrs[res]->attname), fname) == 0)
                        return res + 1;
        }
 
@@ -387,7 +387,7 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
                return NULL;
        }
 
-       return nameout(&(tupdesc->attrs[fnumber - 1]->attname));
+       return pstrdup(NameStr(tupdesc->attrs[fnumber - 1]->attname));
 }
 
 char *
@@ -459,7 +459,7 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
                return NULL;
        }
 
-       return pstrdup(((Form_pg_type) GETSTRUCT(typeTuple))->typname.data);
+       return pstrdup(NameStr(((Form_pg_type) GETSTRUCT(typeTuple))->typname));
 }
 
 Oid
@@ -479,7 +479,7 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
 char *
 SPI_getrelname(Relation rel)
 {
-       return pstrdup(rel->rd_rel->relname.data);
+       return pstrdup(RelationGetRelationName(rel));
 }
 
 void *
index 288ff70f5238ff70fa13e155392343e74ccf915d..95d2ce6394c95d29db983bb435b60c3c6865ad93 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- *     $Id: be-dumpdata.c,v 1.30 1999/07/17 20:17:01 momjian Exp $
+ *     $Id: be-dumpdata.c,v 1.31 1999/11/07 23:08:07 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -182,7 +182,8 @@ be_typeinit(PortalEntry *entry,
                group->types = pbuf_addTypes(natts);
                for (i = 0; i < natts; ++i)
                {
-                       strncpy(group->types[i].name, attrs[i]->attname.data, NAMEDATALEN);
+                       strncpy(group->types[i].name,
+                               NameStr(attrs[i]->attname), NAMEDATALEN);
                        group->types[i].typid = attrs[i]->atttypid;
                        group->types[i].typlen = attrs[i]->attlen;
                }
index f3158050d9f924872856a92ea008222cdc9eb29b..17049b09e8fefeec4c965380959226998df5250d 100644 (file)
@@ -14,7 +14,7 @@
  * Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.32 1999/10/30 23:06:32 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.33 1999/11/07 23:08:08 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -133,7 +133,7 @@ expand_targetlist(List *tlist, int command_type,
        for (attrno = 1; attrno <= numattrs; attrno++)
        {
                Form_pg_attribute att_tup = rel->rd_att->attrs[attrno-1];
-               char               *attrname = att_tup->attname.data;
+               char               *attrname = NameStr(att_tup->attname);
                TargetEntry        *new_tle = NULL;
 
                /*
index 2bd3a00b73e9656a52bc33124aaa4c056a60b670..b83e1372962c5a3e0876001a9d55ad4b8bddda60 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- *     $Id: analyze.c,v 1.122 1999/11/01 05:06:21 tgl Exp $
+ *     $Id: analyze.c,v 1.123 1999/11/07 23:08:10 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -407,7 +407,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
                                makeResdom(attrno,
                                                   thisatt->atttypid,
                                                   thisatt->atttypmod,
-                                                  pstrdup(nameout(&(thisatt->attname))),
+                                                  pstrdup(NameStr(thisatt->attname)),
                                                   0, 0, false),
                                stringToNode(defval[ndef].adbin));
                        qry->targetList = lappend(qry->targetList, te);
index c6f96106994820034eb0cccf69ebab730aa9128c..04030330d597c981e4d9fbd4169230fd063a7a62 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.60 1999/10/07 04:23:12 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.61 1999/11/07 23:08:10 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -321,7 +321,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
                                rd = heap_openr(typeidTypeName(toid), NoLock);
                                if (RelationIsValid(rd))
                                {
-                                       relname = RelationGetRelationName(rd)->data;
+                                       relname = RelationGetRelationName(rd);
                                        heap_close(rd, NoLock);
                                }
                                else
@@ -1160,7 +1160,7 @@ find_inheritors(Oid relid, Oid **supervec)
                        rd = heap_open(qentry->sqe_relid, NoLock);
                        if (! RelationIsValid(rd))
                                elog(ERROR, "Relid %u does not exist", qentry->sqe_relid);
-                       qentry->sqe_relid = typeTypeId(typenameType(RelationGetRelationName(rd)->data));
+                       qentry->sqe_relid = typeTypeId(typenameType(RelationGetRelationName(rd)));
                        heap_close(rd, NoLock);
 
                        DLAddTail(visited, qe);
index fcbd6fedd2cc0d6374179a406801895816db5b97..9d859fd0849fd5f3e60fbef2fb36a8b96e4e72ff 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.32 1999/10/07 04:23:12 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.33 1999/11/07 23:08:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -265,7 +265,7 @@ expandAll(ParseState *pstate, char *relname, char *refname, int *this_resno)
                Var                *varnode;
                TargetEntry *te = makeNode(TargetEntry);
 
-               attrname = pstrdup(rel->rd_att->attrs[varattno]->attname.data);
+               attrname = pstrdup(NameStr(rel->rd_att->attrs[varattno]->attname));
                varnode = make_var(pstate, rte->relid, refname, attrname);
 
                /*
index a009bc5a77cc554ee847de2f78a9f3a9f4c9465e..f87c0aca2575026dc54ab458779c9c09dae1ac0a 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.47 1999/11/01 05:06:21 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.48 1999/11/07 23:08:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -197,7 +197,7 @@ updateTargetListEntry(ParseState *pstate,
                Node       *arrayBase;
                ArrayRef   *aref;
 
-               att->relname = pstrdup(RelationGetRelationName(rd)->data);
+               att->relname = pstrdup(RelationGetRelationName(rd));
                att->attrs = lcons(makeString(colname), NIL);
                arrayBase = ParseNestedFuncOrColumn(pstate, att,
                                                                                        &pstate->p_last_resno,
@@ -381,7 +381,7 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos)
                        Ident      *id = makeNode(Ident);
 
                        id->name = palloc(NAMEDATALEN);
-                       StrNCpy(id->name, attr[i]->attname.data, NAMEDATALEN);
+                       StrNCpy(id->name, NameStr(attr[i]->attname), NAMEDATALEN);
                        id->indirection = NIL;
                        id->isRel = false;
                        cols = lappend(cols, id);
index 38cf29d636c649f1c825da57ca4ce054f80adad8..ac551e9e22c22b1ab783ad69c36c11ed8dc5f9ca 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.25 1999/08/05 02:33:54 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.26 1999/11/07 23:08:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -47,7 +47,7 @@ typeidTypeName(Oid id)
                return NULL;
        }
        typetuple = (Form_pg_type) GETSTRUCT(tup);
-       return (typetuple->typname).data;
+       return NameStr(typetuple->typname);
 }
 
 /* return a Type structure, given a type id */
@@ -118,7 +118,7 @@ typeTypeName(Type t)
        Form_pg_type typ;
 
        typ = (Form_pg_type) GETSTRUCT(t);
-       return (typ->typname).data;
+       return NameStr(typ->typname);
 }
 
 /* given a type, return its typetype ('c' for 'c'atalog types) */
index 789e05b2246b2ddb6ce50a2b84f080588f4e600f..4a148ac2d50c9ba6db03bb63441d2a9b2be216da 100644 (file)
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.23 1999/10/01 04:08:24 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.24 1999/11/07 23:08:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -179,7 +179,7 @@ checkLockPerms(List *locks, Query *parsetree, int rt_index)
                         ev_rel->rd_rel->relowner);
        }
        heap_close(ev_rel, AccessShareLock);
-       evowner = nameout(&(((Form_pg_shadow) GETSTRUCT(usertup))->usename));
+       evowner = pstrdup(NameStr(((Form_pg_shadow) GETSTRUCT(usertup))->usename));
 
        /*
         * Check all the locks, that should get fired on this query
index 26f91d32e3f58783e023d082ac2f3a8acf805d94..4d7fa3a47a46931acb4e6378782a7624c8831e40 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.38 1999/10/21 02:33:25 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.39 1999/11/07 23:08:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -118,9 +118,9 @@ InsertRule(char *rulname,
        appendStringInfo(&rulebuf, "::text, '%s'::bool);",
                                         is_instead);
 
-       pg_exec_query_dest(rulebuf.data, None, true);
+       pg_exec_query_dest(NameStr(rulebuf), None, true);
 
-       pfree(rulebuf.data);
+       pfree(NameStr(rulebuf));
 
        return LastOidProcessed;
 }
@@ -272,7 +272,7 @@ DefineQueryRewrite(RuleStmt *stmt)
                        tle = (TargetEntry *) nth(i - 1, query->targetList);
                        resdom = tle->resdom;
                        attr = event_relation->rd_att->attrs[i - 1];
-                       attname = nameout(&(attr->attname));
+                       attname = pstrdup(NameStr(attr->attname));
 
                        if (strcmp(resdom->resname, attname) != 0)
                                elog(ERROR, "select rules target entry %d has different column name from %s", i, attname);
@@ -295,7 +295,8 @@ DefineQueryRewrite(RuleStmt *stmt)
 
                                rule = event_relation->rd_rules->rules[i];
                                if (rule->event == CMD_SELECT)
-                                       elog(ERROR, "%s is already a view", nameout(&(event_relation->rd_rel->relname)));
+                                       elog(ERROR, "%s is already a view",
+                                               RelationGetRelationName(event_relation));
                        }
                }
 
index 3f9b4da2698ddbfe997f9c5f74556648a06e7bee..0e3791740475b0538656dbcfbcf3882f20ceb939 100644 (file)
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.41 1999/10/01 04:08:24 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.42 1999/11/07 23:08:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -564,12 +564,12 @@ HandleRIRAttributeRule_mutator(Node *node,
                        {
                                NameData        name_to_look_for;
 
-                               name_to_look_for.data[0] = '\0';
+                               NameStr(name_to_look_for)[0] = '\0';
                                namestrcpy(&name_to_look_for,
                                                   (char *) get_attname(getrelid(this_varno,
                                                                                                                 context->rtable),
                                                                                                this_varattno));
-                               if (name_to_look_for.data[0])
+                               if (NameStr(name_to_look_for)[0])
                                {
                                        Node       *n;
 
index c751550e494cd62a907485fa2bf09b63c1e1247b..412915253da8574cb4d791774e8940edb5a118c8 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.30 1999/10/26 03:12:35 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.31 1999/11/07 23:08:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -46,7 +46,7 @@ RewriteGetRuleEventRel(char *rulename)
        if (!HeapTupleIsValid(htup))
                elog(ERROR, "Class '%u' not found", eventrel);
 
-       return ((Form_pg_class) GETSTRUCT(htup))->relname.data;
+       return NameStr(((Form_pg_class) GETSTRUCT(htup))->relname);
 }
 
 /* ----------------------------------------------------------------
index a6f52583a0675dc3cc383b05eeed08b260e1afd8..19bbceb6b1efc3a13961d94f833a0d953dd0c8b0 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.64 1999/09/28 11:41:06 vadim Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.65 1999/11/07 23:08:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -622,7 +622,7 @@ BufferAlloc(Relation reln,
        }
 
        /* record the database name and relation name for this buffer */
-       strcpy(buf->sb_relname, reln->rd_rel->relname.data);
+       strcpy(buf->sb_relname, RelationGetRelationName(reln));
        strcpy(buf->sb_dbname, DatabaseName);
 
        INIT_BUFFERTAG(&(buf->tag), reln, blockNum);
@@ -1598,21 +1598,23 @@ FlushRelationBuffers(Relation rel, BlockNumber block, bool doFlush)
                                                if (FlushBuffer(-i-1, false) != STATUS_OK)
                                                {
                                                        elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is dirty, could not flush it",
-                                                                rel->rd_rel->relname.data, block, buf->tag.blockNum);
+                                                                RelationGetRelationName(rel),
+                                                                block, buf->tag.blockNum);
                                                        return -1;
                                                }
                                        }
                                        else
                                        {
                                                elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is dirty",
-                                                        rel->rd_rel->relname.data, block, buf->tag.blockNum);
+                                                        RelationGetRelationName(rel),
+                                                        block, buf->tag.blockNum);
                                                return -1;
                                        }
                                }
                                if (LocalRefCount[i] > 0)
                                {
                                        elog(NOTICE, "FlushRelationBuffers(%s (local), %u): block %u is referenced (%d)",
-                                                rel->rd_rel->relname.data, block,
+                                                RelationGetRelationName(rel), block,
                                                 buf->tag.blockNum, LocalRefCount[i]);
                                        return -2;
                                }
index 555768a0f3e51439276b38b17d0bc5d62fb48343..d28443a46ea8ba187117112a075621b48516406f 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.60 1999/10/13 15:02:25 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.61 1999/11/07 23:08:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -210,7 +210,7 @@ inv_open(Oid lobjId, int flags)
 
        r = heap_open(lobjId, AccessShareLock);
 
-       indname = pstrdup((r->rd_rel->relname).data);
+       indname = pstrdup(RelationGetRelationName(r));
 
        /*
         * hack hack hack...  we know that the fourth character of the
@@ -282,7 +282,7 @@ inv_destroy(Oid lobjId)
        if (!RelationIsValid(r) || r->rd_rel->relkind != RELKIND_LOBJECT)
                return -1;
 
-       heap_destroy_with_catalog(r->rd_rel->relname.data);
+       heap_destroy_with_catalog(RelationGetRelationName(r));
        return 1;
 }
 
index 38f60ebdfa205a8f4e3b55b75359a0d9c3d1f08c..a1198b60740ae289c41ccc17414e41813b4fc33b 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.63 1999/10/12 14:54:27 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.64 1999/11/07 23:08:17 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -46,7 +46,7 @@
  *             This is so that we can support more backends. (system-wide semaphore
  *             sets run out pretty fast.)                                -ay 4/95
  *
- * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.63 1999/10/12 14:54:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.64 1999/11/07 23:08:17 momjian Exp $
  */
 #include <sys/time.h>
 #include <unistd.h>
@@ -155,7 +155,6 @@ InitProcGlobal(IPCKey key, int maxBackends)
                        {
                                IPCKey          semKey = ProcGlobal->currKey + i;
                                int                     semId;
-                               int                     semstat;
 
                                semId = IpcSemaphoreCreate(semKey,
                                                                                   PROC_NSEMS_PER_SET,
@@ -180,7 +179,6 @@ void
 InitProcess(IPCKey key)
 {
        bool            found = false;
-       int                     semstat;
        unsigned long location,
                                myOffset;
 
index ae9a7848668be8cc492b9430981e2c37fda87dcb..bf885e676d5170762757a528d758d468a5828b97 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.58 1999/11/04 08:01:00 inoue Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.59 1999/11/07 23:08:19 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -121,7 +121,7 @@ mdcreate(Relation reln)
        char       *path;
 
        Assert(reln->rd_unlinked && reln->rd_fd < 0);
-       path = relpath(reln->rd_rel->relname.data);
+       path = relpath(RelationGetRelationName(reln));
 #ifndef __CYGWIN32__
        fd = FileNameOpenFile(path, O_RDWR | O_CREAT | O_EXCL, 0600);
 #else
@@ -319,7 +319,7 @@ mdopen(Relation reln)
        int                     vfd;
 
        Assert(reln->rd_fd < 0);
-       path = relpath(reln->rd_rel->relname.data);
+       path = relpath(RelationGetRelationName(reln));
 
 #ifndef __CYGWIN32__
        fd = FileNameOpenFile(path, O_RDWR, 0600);
@@ -1011,7 +1011,7 @@ _mdfd_openseg(Relation reln, int segno, int oflags)
                           *fullpath;
 
        /* be sure we have enough space for the '.segno', if any */
-       path = relpath(RelationGetRelationName(reln)->data);
+       path = relpath(RelationGetRelationName(reln));
 
        dofree = false;
        if (segno > 0)
index 6ec382e48ae8f8c84d8d02788a7884efa372d174..7efa724eaf95a057948df3f986b82aaf33217019 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.30 1999/11/04 08:01:01 inoue Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.31 1999/11/07 23:08:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -131,7 +131,7 @@ smgrcreate(int16 which, Relation reln)
        int                     fd;
 
        if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0)
-               elog(ERROR, "cannot create %s", reln->rd_rel->relname.data);
+               elog(ERROR, "cannot create %s", RelationGetRelationName(reln));
 
        return fd;
 }
@@ -147,7 +147,7 @@ smgrunlink(int16 which, Relation reln)
        int                     status;
 
        if ((status = (*(smgrsw[which].smgr_unlink)) (reln)) == SM_FAIL)
-               elog(ERROR, "cannot unlink %s", reln->rd_rel->relname.data);
+               elog(ERROR, "cannot unlink %s", RelationGetRelationName(reln));
 
        return status;
 }
@@ -166,7 +166,8 @@ smgrextend(int16 which, Relation reln, char *buffer)
        status = (*(smgrsw[which].smgr_extend)) (reln, buffer);
 
        if (status == SM_FAIL)
-               elog(ERROR, "%s: cannot extend.  Check free disk space.", reln->rd_rel->relname.data);
+               elog(ERROR, "%s: cannot extend.  Check free disk space.",
+                               RelationGetRelationName(reln));
 
        return status;
 }
@@ -184,7 +185,7 @@ smgropen(int16 which, Relation reln)
 
        if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0 &&
                !reln->rd_unlinked)
-               elog(ERROR, "cannot open %s", reln->rd_rel->relname.data);
+               elog(ERROR, "cannot open %s", RelationGetRelationName(reln));
 
        return fd;
 }
@@ -204,7 +205,7 @@ int
 smgrclose(int16 which, Relation reln)
 {
        if ((*(smgrsw[which].smgr_close)) (reln) == SM_FAIL)
-               elog(ERROR, "cannot close %s", reln->rd_rel->relname.data);
+               elog(ERROR, "cannot close %s", RelationGetRelationName(reln));
 
        return SM_SUCCESS;
 }
@@ -228,7 +229,7 @@ smgrread(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
 
        if (status == SM_FAIL)
                elog(ERROR, "cannot read block %d of %s",
-                        blocknum, reln->rd_rel->relname.data);
+                        blocknum, RelationGetRelationName(reln));
 
        return status;
 }
@@ -250,7 +251,7 @@ smgrwrite(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
 
        if (status == SM_FAIL)
                elog(ERROR, "cannot write block %d of %s",
-                        blocknum, reln->rd_rel->relname.data);
+                        blocknum, RelationGetRelationName(reln));
 
        return status;
 }
@@ -267,7 +268,7 @@ smgrflush(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
 
        if (status == SM_FAIL)
                elog(ERROR, "cannot flush block %d of %s to stable store",
-                        blocknum, reln->rd_rel->relname.data);
+                        blocknum, RelationGetRelationName(reln));
 
        return status;
 }
@@ -326,7 +327,8 @@ smgrnblocks(int16 which, Relation reln)
        int                     nblocks;
 
        if ((nblocks = (*(smgrsw[which].smgr_nblocks)) (reln)) < 0)
-               elog(ERROR, "cannot count blocks for %s", reln->rd_rel->relname.data);
+               elog(ERROR, "cannot count blocks for %s",
+                               RelationGetRelationName(reln));
 
        return nblocks;
 }
@@ -348,7 +350,7 @@ smgrtruncate(int16 which, Relation reln, int nblocks)
        {
                if ((newblks = (*(smgrsw[which].smgr_truncate)) (reln, nblocks)) < 0)
                        elog(ERROR, "cannot truncate %s to %d blocks",
-                                reln->rd_rel->relname.data, nblocks);
+                                RelationGetRelationName(reln), nblocks);
        }
 
        return newblks;
index 3e08c726d8f40a0ed78e350129eda0cd331339bd..2cf7996b68eb26b0376db50aa8e1def9aec5a458 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.36 1999/07/17 20:17:50 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.37 1999/11/07 23:08:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -144,7 +144,7 @@ BeginCommand(char *pname,
 
                                for (i = 0; i < natts; ++i)
                                {
-                                       pq_sendstring(&buf, attrs[i]->attname.data);
+                                       pq_sendstring(&buf, NameStr(attrs[i]->attname));
                                        pq_sendint(&buf, (int) attrs[i]->atttypid,
                                                           sizeof(attrs[i]->atttypid));
                                        pq_sendint(&buf, attrs[i]->attlen,
index 8c877c3ffdc5f265142042cf5b65115ba8eb7aab..ad5c5453e7d334ea7a8f8360b9168dbe3ac6fadf 100644 (file)
@@ -10,7 +10,7 @@
  * Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *     $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.31 1999/09/07 19:09:46 tgl Exp $
+ *     $Header: /cvsroot/pgsql/src/backend/utils/adt/like.c,v 1.32 1999/11/07 23:08:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -82,7 +82,7 @@ namelike(NameData *n, struct varlena * p)
 {
        if (!n)
                return FALSE;
-       return fixedlen_like(n->data, p, NAMEDATALEN);
+       return fixedlen_like(NameStr(*n), p, NAMEDATALEN);
 }
 
 bool
index b4d0a7da72887a1314f6c7fba183d92f6f109569..fd457afcbe0cbf82412a92034d84320876e66c22 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.23 1999/07/17 20:17:58 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.24 1999/11/07 23:08:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -40,11 +40,11 @@ namein(char *s)
                return NULL;
        result = (NameData *) palloc(NAMEDATALEN);
        /* always keep it null-padded */
-       StrNCpy(result->data, s, NAMEDATALEN);
-       len = strlen(result->data);
+       StrNCpy(NameStr(*result), s, NAMEDATALEN);
+       len = strlen(NameStr(*result));
        while (len < NAMEDATALEN)
        {
-               *(result->data + len) = '\0';
+               *(NameStr(*result) + len) = '\0';
                len++;
        }
        return result;
@@ -59,7 +59,7 @@ nameout(NameData *s)
        if (s == NULL)
                return "-";
        else
-               return pstrdup(s->data);
+               return pstrdup(NameStr(*s));
 }
 
 
@@ -87,7 +87,7 @@ nameeq(NameData *arg1, NameData *arg2)
        if (!arg1 || !arg2)
                return 0;
        else
-               return (bool) strncmp(arg1->data, arg2->data, NAMEDATALEN) == 0;
+               return (bool) strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) == 0;
 }
 
 bool
@@ -95,7 +95,7 @@ namene(NameData *arg1, NameData *arg2)
 {
        if (arg1 == NULL || arg2 == NULL)
                return (bool) 0;
-       return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) != 0);
+       return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) != 0);
 }
 
 bool
@@ -103,7 +103,7 @@ namelt(NameData *arg1, NameData *arg2)
 {
        if (arg1 == NULL || arg2 == NULL)
                return (bool) 0;
-       return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) < 0);
+       return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) < 0);
 }
 
 bool
@@ -111,7 +111,7 @@ namele(NameData *arg1, NameData *arg2)
 {
        if (arg1 == NULL || arg2 == NULL)
                return (bool) 0;
-       return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) <= 0);
+       return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) <= 0);
 }
 
 bool
@@ -120,7 +120,7 @@ namegt(NameData *arg1, NameData *arg2)
        if (arg1 == NULL || arg2 == NULL)
                return (bool) 0;
 
-       return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) > 0);
+       return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) > 0);
 }
 
 bool
@@ -129,7 +129,7 @@ namege(NameData *arg1, NameData *arg2)
        if (arg1 == NULL || arg2 == NULL)
                return (bool) 0;
 
-       return (bool) (strncmp(arg1->data, arg2->data, NAMEDATALEN) >= 0);
+       return (bool) (strncmp(NameStr(*arg1), NameStr(*arg2), NAMEDATALEN) >= 0);
 }
 
 
@@ -140,7 +140,7 @@ namecpy(Name n1, Name n2)
 {
        if (!n1 || !n2)
                return -1;
-       strncpy(n1->data, n2->data, NAMEDATALEN);
+       strncpy(NameStr(*n1), NameStr(*n2), NAMEDATALEN);
        return 0;
 }
 
@@ -148,7 +148,7 @@ namecpy(Name n1, Name n2)
 int
 namecat(Name n1, Name n2)
 {
-       return namestrcat(n1, n2->data);        /* n2 can't be any longer than n1 */
+       return namestrcat(n1, NameStr(*n2));    /* n2 can't be any longer than n1 */
 }
 
 #endif
@@ -157,7 +157,7 @@ namecat(Name n1, Name n2)
 int
 namecmp(Name n1, Name n2)
 {
-       return strncmp(n1->data, n2->data, NAMEDATALEN);
+       return strncmp(NameStr(*n1), NameStr(*n2), NAMEDATALEN);
 }
 
 #endif
@@ -167,7 +167,7 @@ namestrcpy(Name name, char *str)
 {
        if (!name || !str)
                return -1;
-       StrNCpy(name->data, str, NAMEDATALEN);
+       StrNCpy(NameStr(*name), str, NAMEDATALEN);
        return 0;
 }
 
@@ -181,7 +181,7 @@ namestrcat(Name name, char *str)
 
        if (!name || !str)
                return -1;
-       for (i = 0, p = name->data; i < NAMEDATALEN && *p; ++i, ++p)
+       for (i = 0, p = NameStr(*name); i < NAMEDATALEN && *p; ++i, ++p)
                ;
        for (q = str; i < NAMEDATALEN; ++i, ++p, ++q)
        {
@@ -203,7 +203,7 @@ namestrcmp(Name name, char *str)
                return -1;                              /* NULL < anything */
        if (!str)
                return 1;                               /* NULL < anything */
-       return strncmp(name->data, str, NAMEDATALEN);
+       return strncmp(NameStr(*name), str, NAMEDATALEN);
 }
 
 /*****************************************************************************
@@ -217,7 +217,7 @@ NameComputeLength(Name name)
        char       *charP;
        int                     length;
 
-       for (length = 0, charP = name->data;
+       for (length = 0, charP = NameStr(*name);
                 length < NAMEDATALEN && *charP != '\0';
                 length++, charP++)
                ;
index 082b1dba62a538bfb3c24f01d1ec7f15433c4838..bf0a598c16f65b2d43c96265a2a7b9be0fc11ad1 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.28 1999/07/17 20:17:59 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.29 1999/11/07 23:08:24 momjian Exp $
  *
  *             Alistair Crooks added the code for the regex caching
  *             agc - cached the regular expressions used - there's a good chance
@@ -200,7 +200,7 @@ nameregexeq(NameData *n, struct varlena * p)
 {
        if (!n)
                return FALSE;
-       return fixedlen_regexeq(n->data, p, NAMEDATALEN, REG_EXTENDED);
+       return fixedlen_regexeq(NameStr(*n), p, NAMEDATALEN, REG_EXTENDED);
 }
 
 bool
@@ -248,7 +248,7 @@ nameicregexeq(NameData *n, struct varlena * p)
 {
        if (!n)
                return FALSE;
-       return (fixedlen_regexeq(n->data, p, NAMEDATALEN,
+       return (fixedlen_regexeq(NameStr(*n), p, NAMEDATALEN,
                                                         REG_ICASE | REG_EXTENDED));
 }
 
index b3179e864c122526b1e6806f6a3f85ac33a7421f..74dd671e968bd3698ca029d8adb11625615d1df6 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.43 1999/09/18 19:07:49 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.44 1999/11/07 23:08:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -173,7 +173,7 @@ regprocout(RegProcedure proid)
                {
                        char       *s;
 
-                       s = ((Form_pg_proc) GETSTRUCT(proctup))->proname.data;
+                       s = NameStr(((Form_pg_proc) GETSTRUCT(proctup))->proname);
                        StrNCpy(result, s, NAMEDATALEN);
                }
                else
@@ -261,7 +261,7 @@ oid8types(Oid *oidArray)
                        {
                                char       *s;
 
-                               s = ((Form_pg_type) GETSTRUCT(typetup))->typname.data;
+                               s = NameStr(((Form_pg_type) GETSTRUCT(typetup))->typname);
                                StrNCpy(VARDATA(result) + strlen(VARDATA(result)), s,
                                                NAMEDATALEN);
                                strcat(VARDATA(result), " ");
index 83e593c530118cc5d106baef9513541c132566cf..22f904b60d5a4bbfbe0f844266a8eb92737fb803 100644 (file)
@@ -3,7 +3,7 @@
  *                       out of it's tuple
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.29 1999/10/31 18:57:42 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.30 1999/11/07 23:08:24 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -138,7 +138,7 @@ pg_get_ruledef(NameData *rname)
         * We need the rules name somewhere deep down
         * ----------
         */
-       rulename = nameout(rname);
+       rulename = pstrdup(NameStr(*rname));
 
        /* ----------
         * Connect to SPI manager
@@ -238,7 +238,7 @@ pg_get_viewdef(NameData *rname)
         * We need the rules name somewhere deep down
         * ----------
         */
-       rulename = nameout(rname);
+       rulename = pstrdup(NameStr(*rname));
 
        /* ----------
         * Connect to SPI manager
@@ -410,10 +410,10 @@ pg_get_indexdef(Oid indexrelid)
        spirc = SPI_execp(plan_getam, spi_args, spi_nulls, 1);
        if (spirc != SPI_OK_SELECT)
                elog(ERROR, "failed to get pg_am tuple for index %s",
-                        nameout(&(idxrelrec->relname)));
+                        idxrelrec->relname);
        if (SPI_processed != 1)
                elog(ERROR, "failed to get pg_am tuple for index %s",
-                        nameout(&(idxrelrec->relname)));
+                        idxrelrec->relname);
        spi_tup = SPI_tuptable->vals[0];
        spi_ttc = SPI_tuptable->tupdesc;
        spi_fno = SPI_fnumber(spi_ttc, "amname");
@@ -425,8 +425,8 @@ pg_get_indexdef(Oid indexrelid)
        initStringInfo(&buf);
        appendStringInfo(&buf, "CREATE %sINDEX %s ON %s USING %s (",
                                         idxrec->indisunique ? "UNIQUE " : "",
-                                        quote_identifier(nameout(&(idxrelrec->relname))),
-                                        quote_identifier(nameout(&(indrelrec->relname))),
+                                        quote_identifier(pstrdup(NameStr(idxrelrec->relname))),
+                                        quote_identifier(pstrdup(NameStr(indrelrec->relname))),
                                         quote_identifier(SPI_getvalue(spi_tup, spi_ttc,
                                                                                                   spi_fno)));
 
@@ -491,7 +491,7 @@ pg_get_indexdef(Oid indexrelid)
 
                procStruct = (Form_pg_proc) GETSTRUCT(proctup);
                appendStringInfo(&buf, "%s(%s) ",
-                                                quote_identifier(nameout(&(procStruct->proname))),
+                                                quote_identifier(pstrdup(NameStr(procStruct->proname))),
                                                 keybuf.data);
 
                spi_args[0] = ObjectIdGetDatum(idxrec->indclass[0]);
@@ -561,7 +561,7 @@ pg_get_userbyid(int32 uid)
         * ----------
         */
        result = (NameData *) palloc(NAMEDATALEN);
-       memset(result->data, 0, NAMEDATALEN);
+       memset(NameStr(*result), 0, NAMEDATALEN);
 
        /* ----------
         * Get the pg_shadow entry and print the result
@@ -572,7 +572,7 @@ pg_get_userbyid(int32 uid)
        if (HeapTupleIsValid(usertup))
        {
                user_rec = (Form_pg_shadow) GETSTRUCT(usertup);
-               StrNCpy(result->data, (&(user_rec->usename))->data, NAMEDATALEN);
+               StrNCpy(NameStr(*result), NameStr(user_rec->usename), NAMEDATALEN);
        }
        else
                sprintf((char *) result, "unknown (UID=%d)", uid);
@@ -1446,7 +1446,7 @@ get_func_expr(Expr *expr, deparse_context *context)
                elog(ERROR, "cache lookup for proc %u failed", func->funcid);
 
        procStruct = (Form_pg_proc) GETSTRUCT(proctup);
-       proname = nameout(&(procStruct->proname));
+       proname = pstrdup(NameStr(procStruct->proname));
 
        /*
         * nullvalue() and nonnullvalue() should get turned into special syntax
@@ -1555,7 +1555,8 @@ get_tle_expr(TargetEntry *tle, deparse_context *context)
                elog(ERROR, "cache lookup for type %u failed",
                         procStruct->prorettype);
        typeStruct = (Form_pg_type) GETSTRUCT(tup);
-       if (strncmp(procStruct->proname.data, typeStruct->typname.data,
+       if (strncmp(NameStr(procStruct->proname),
+                               NameStr(typeStruct->typname),
                                NAMEDATALEN) != 0)
        {
                get_rule_expr(tle->expr, context);
@@ -1662,7 +1663,7 @@ get_const_expr(Const *constval, deparse_context *context)
                        /* These types can be left unlabeled */
                        break;
                default:
-                       extval = (char *) nameout(&(typeStruct->typname));
+                       extval = pstrdup(NameStr(typeStruct->typname));
                        appendStringInfo(buf, "::%s", quote_identifier(extval));
                        pfree(extval);
                        break;
@@ -1800,7 +1801,7 @@ get_relation_name(Oid relid)
                elog(ERROR, "cache lookup of relation %u failed", relid);
 
        classStruct = (Form_pg_class) GETSTRUCT(classtup);
-       return nameout(&(classStruct->relname));
+       return pstrdup(NameStr(classStruct->relname));
 }
 
 
@@ -1823,7 +1824,7 @@ get_attribute_name(Oid relid, int2 attnum)
                         attnum, relid);
 
        attStruct = (Form_pg_attribute) GETSTRUCT(atttup);
-       return nameout(&(attStruct->attname));
+       return pstrdup(NameStr(attStruct->attname));
 }
 
 
index 8d27a1ca6d84e71742a92a245f3941a35e8fc6ad..9ac113301d715e7a8c7f77c74dd776643b4c8656 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.54 1999/07/17 20:18:00 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.55 1999/11/07 23:08:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -273,12 +273,12 @@ bpchar_name(char *s)
 #endif
 
        result = (NameData *) palloc(NAMEDATALEN);
-       StrNCpy(result->data, VARDATA(s), NAMEDATALEN);
+       StrNCpy(NameStr(*result), VARDATA(s), NAMEDATALEN);
 
        /* now null pad to full length... */
        while (len < NAMEDATALEN)
        {
-               *(result->data + len) = '\0';
+               *(NameStr(*result) + len) = '\0';
                len++;
        }
 
@@ -297,7 +297,7 @@ name_bpchar(NameData *s)
        if (s == NULL)
                return NULL;
 
-       len = strlen(s->data);
+       len = strlen(NameStr(*s));
 
 #ifdef STRINGDEBUG
        printf("bpchar- convert string length %d (%d) ->%d\n",
@@ -305,7 +305,7 @@ name_bpchar(NameData *s)
 #endif
 
        result = (char *) palloc(VARHDRSZ + len);
-       strncpy(VARDATA(result), s->data, len);
+       strncpy(VARDATA(result), NameStr(*s), len);
        VARSIZE(result) = len + VARHDRSZ;
 
        return result;
index 08eac37460a24aa39035d7076a982975f0e5660d..90f898fe971e7cf0e2d55a2d5e448d6ccea86754 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.53 1999/07/17 20:18:00 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.54 1999/11/07 23:08:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -801,12 +801,12 @@ text_name(text *s)
 #endif
 
        result = palloc(NAMEDATALEN);
-       StrNCpy(result->data, VARDATA(s), NAMEDATALEN);
+       StrNCpy(NameStr(*result), VARDATA(s), NAMEDATALEN);
 
        /* now null pad to full length... */
        while (len < NAMEDATALEN)
        {
-               *(result->data + len) = '\0';
+               *(NameStr(*result) + len) = '\0';
                len++;
        }
 
@@ -825,7 +825,7 @@ name_text(NameData *s)
        if (s == NULL)
                return NULL;
 
-       len = strlen(s->data);
+       len = strlen(NameStr(*s));
 
 #ifdef STRINGDEBUG
        printf("text- convert string length %d (%d) ->%d\n",
@@ -833,7 +833,7 @@ name_text(NameData *s)
 #endif
 
        result = palloc(VARHDRSZ + len);
-       strncpy(VARDATA(result), s->data, len);
+       strncpy(VARDATA(result), NameStr(*s), len);
        VARSIZE(result) = len + VARHDRSZ;
 
        return result;
index d3c022c2479b5aa2bbad1c24674cd83517010a91..cc86bae0fb6a97f268121c58d2395174ce5080bb 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.50 1999/11/01 02:29:25 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.51 1999/11/07 23:08:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -209,7 +209,7 @@ CatalogCacheInitializeCache(struct catcache * cache,
                        cache->cc_skey[i].sk_nargs = cache->cc_skey[i].sk_func.fn_nargs;
 
                        CACHE5_elog(DEBUG, "CatalogCacheInit %s %d %d %x",
-                                               &relation->rd_rel->relname,
+                                               RelationGetRelationName(relation),
                                                i,
                                                tupdesc->attrs[cache->cc_key[i] - 1]->attlen,
                                                cache);
@@ -304,7 +304,7 @@ comphash(long l, char *v)
                 * typelen so this may break them         - XXX
                 */
                namestrcpy(&n, v);
-               v = n.data;
+               v = NameStr(n);
        }
        else if (l < 0)
                l = VARSIZE(v);
index 1671a8e9ecdae2ee1137a9b937e5e75ecf8f9700..e5f7beea339fcfe4d88932557c0d76e96307390e 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.27 1999/07/16 05:00:38 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.28 1999/11/07 23:08:26 momjian Exp $
  *
  * Note - this code is real crufty...
  *
@@ -584,7 +584,7 @@ RelationInvalidateHeapTuple(Relation relation, HeapTuple tuple)
         *      this only works for system relations now
         * ----------------
         */
-       if (!IsSystemRelationName(RelationGetForm(relation)->relname.data))
+       if (!IsSystemRelationName(NameStr(RelationGetForm(relation)->relname)))
                return;
 
        /* ----------------
index 75994a31f27ca7a8ff80a39a4e5d702c0edaaae8..d2b097ed2f58677331e644499c8e0b0babac0f32 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.34 1999/09/09 02:36:04 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.35 1999/11/07 23:08:26 momjian Exp $
  *
  * NOTES
  *       Eventually, the index information should go through here, too.
@@ -62,7 +62,7 @@ get_attname(Oid relid, AttrNumber attnum)
        if (HeapTupleIsValid(tp))
        {
                Form_pg_attribute att_tup = (Form_pg_attribute) GETSTRUCT(tp);
-               return pstrdup(att_tup->attname.data);
+               return pstrdup(NameStr(att_tup->attname));
        }
        else
                return NULL;
@@ -292,7 +292,7 @@ get_opname(Oid opno)
        if (HeapTupleIsValid(tp))
        {
                Form_pg_operator optup = (Form_pg_operator) GETSTRUCT(tp);
-               return pstrdup(optup->oprname.data);
+               return pstrdup(NameStr(optup->oprname));
        }
        else
                return NULL;
@@ -529,7 +529,7 @@ get_rel_name(Oid relid)
        if (HeapTupleIsValid(tp))
        {
                Form_pg_class reltup = (Form_pg_class) GETSTRUCT(tp);
-               return pstrdup(reltup->relname.data);
+               return pstrdup(NameStr(reltup->relname));
        }
        else
                return NULL;
index 0090c82614984297576657a973b512f140df2c0e..f780cf96b3970b146da726f0130fa76ee1b4a116 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.75 1999/11/04 08:00:59 inoue Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.76 1999/11/07 23:08:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -133,7 +133,7 @@ typedef struct relnamecacheent
 do { \
        RelIdCacheEnt *idhentry; RelNameCacheEnt *namehentry; \
        char *relname; Oid reloid; bool found; \
-       relname = (RELATION->rd_rel->relname).data; \
+       relname = RelationGetRelationName(RELATION); \
        namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
                                                                                           relname, \
                                                                                           HASH_ENTER, \
@@ -186,7 +186,7 @@ do { \
 do { \
        RelNameCacheEnt *namehentry; RelIdCacheEnt *idhentry; \
        char *relname; Oid reloid; bool found; \
-       relname = (RELATION->rd_rel->relname).data; \
+       relname = RelationGetRelationName(RELATION); \
        namehentry = (RelNameCacheEnt*)hash_search(RelationNameCache, \
                                                                                           relname, \
                                                                                           HASH_REMOVE, \
@@ -534,7 +534,7 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
 
                if (!HeapTupleIsValid(atttup))
                        elog(ERROR, "cannot find attribute %d of relation %s", i,
-                                relation->rd_rel->relname.data);
+                                RelationGetRelationName(relation));
                attp = (Form_pg_attribute) GETSTRUCT(atttup);
 
                relation->rd_att->attrs[i - 1] =
@@ -962,7 +962,7 @@ formrdesc(char *relationName,
        relation->rd_rel = (Form_pg_class)
                palloc((Size) (sizeof(*relation->rd_rel)));
        MemSet(relation->rd_rel, 0, sizeof(FormData_pg_class));
-       namestrcpy(&relation->rd_rel->relname, relationName);
+       strcpy(RelationGetRelationName(relation), relationName);
 
        /* ----------------
           initialize attribute tuple form
@@ -1092,7 +1092,7 @@ RelationNameCacheGetRelation(char *relationName)
         * null-padded
         */
        namestrcpy(&name, relationName);
-       RelationNameCacheLookup(name.data, rd);
+       RelationNameCacheLookup(NameStr(name), rd);
 
        if (RelationIsValid(rd))
        {
@@ -1373,7 +1373,7 @@ RelationForgetRelation(Oid rid)
                        }
                        if (curr == NIL)
                                elog(FATAL, "Local relation %s not found in list",
-                                        (RelationGetRelationName(relation))->data);
+                                        RelationGetRelationName(relation));
                        if (prev == NIL)
                                newlyCreatedRelns = lnext(newlyCreatedRelns);
                        else
@@ -1745,16 +1745,16 @@ AttrDefaultFetch(Relation relation)
                                continue;
                        if (attrdef[i].adbin != NULL)
                                elog(ERROR, "AttrDefaultFetch: second record found for attr %s in rel %s",
-                               relation->rd_att->attrs[adform->adnum - 1]->attname.data,
-                                        relation->rd_rel->relname.data);
+                               NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
+                                        RelationGetRelationName(relation));
 
                        val = (struct varlena *) fastgetattr(&tuple,
                                                                                                 Anum_pg_attrdef_adbin,
                                                                                                 adrel->rd_att, &isnull);
                        if (isnull)
                                elog(ERROR, "AttrDefaultFetch: adbin IS NULL for attr %s in rel %s",
-                               relation->rd_att->attrs[adform->adnum - 1]->attname.data,
-                                        relation->rd_rel->relname.data);
+                               NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname),
+                                        RelationGetRelationName(relation));
                        attrdef[i].adbin = textout(val);
                        break;
                }
@@ -1763,12 +1763,12 @@ AttrDefaultFetch(Relation relation)
                if (i >= ndef)
                        elog(ERROR, "AttrDefaultFetch: unexpected record found for attr %d in rel %s",
                                 adform->adnum,
-                                relation->rd_rel->relname.data);
+                                RelationGetRelationName(relation));
        }
 
        if (found < ndef)
                elog(ERROR, "AttrDefaultFetch: %d record not found for rel %s",
-                        ndef - found, relation->rd_rel->relname.data);
+                        ndef - found, RelationGetRelationName(relation));
 
        index_endscan(sd);
        pfree(sd);
@@ -1818,21 +1818,21 @@ RelCheckFetch(Relation relation)
                        continue;
                if (found == ncheck)
                        elog(ERROR, "RelCheckFetch: unexpected record found for rel %s",
-                                relation->rd_rel->relname.data);
+                                RelationGetRelationName(relation));
 
                rcname = (Name) fastgetattr(&tuple,
                                                                        Anum_pg_relcheck_rcname,
                                                                        rcrel->rd_att, &isnull);
                if (isnull)
                        elog(ERROR, "RelCheckFetch: rcname IS NULL for rel %s",
-                                relation->rd_rel->relname.data);
-               check[found].ccname = nameout(rcname);
+                                RelationGetRelationName(relation));
+               check[found].ccname = pstrdup(NameStr(*rcname));
                val = (struct varlena *) fastgetattr(&tuple,
                                                                                         Anum_pg_relcheck_rcbin,
                                                                                         rcrel->rd_att, &isnull);
                if (isnull)
                        elog(ERROR, "RelCheckFetch: rcbin IS NULL for rel %s",
-                                relation->rd_rel->relname.data);
+                                RelationGetRelationName(relation));
                check[found].ccbin = textout(val);
                found++;
                ReleaseBuffer(buffer);
@@ -1841,7 +1841,7 @@ RelCheckFetch(Relation relation)
        if (found < ncheck)
                elog(ERROR, "RelCheckFetch: %d record not found for rel %s",
                         ncheck - found,
-                        relation->rd_rel->relname.data);
+                        RelationGetRelationName(relation));
 
        index_endscan(sd);
        pfree(sd);
index e8cc0c2487323f1e5a6830750b85443d61bfc8eb..0119f9e59ecb532c2498e8777e72c88f6941817f 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.14 1999/09/04 22:03:09 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.15 1999/11/07 23:08:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -62,8 +62,8 @@ create_temp_relation(char *relname, HeapTuple pg_class_tuple)
 
        /* save user-supplied name */
        strcpy(temp_rel->user_relname, relname);
-       StrNCpy(temp_rel->relname, ((Form_pg_class)
-               GETSTRUCT(pg_class_tuple))->relname.data, NAMEDATALEN);
+       StrNCpy(temp_rel->relname, NameStr(((Form_pg_class)
+               GETSTRUCT(pg_class_tuple))->relname), NAMEDATALEN);
        temp_rel->relid = pg_class_tuple->t_data->t_oid;
        temp_rel->relkind = ((Form_pg_class) GETSTRUCT(pg_class_tuple))->relkind;
        temp_rel->xid = GetCurrentTransactionId();
index 15b22bdfa41a6268d27d1567fcdf646f40f7d11e..18f573d6d166c944037232781905972d36f63dd4 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.35 1999/10/02 21:33:25 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.36 1999/11/07 23:08:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -78,7 +78,7 @@ fmgr_dynamic(Oid procedureId, int *pronargs)
        }
 
        procedureStruct = (Form_pg_proc) GETSTRUCT(procedureTuple);
-       proname = procedureStruct->proname.data;
+       proname = NameStr(procedureStruct->proname);
        pronargs_save = *pronargs = procedureStruct->pronargs;
        probinattr = heap_getattr(procedureTuple,
                                                          Anum_pg_proc_probin,
index cda5cfbdab3a8130912197d47886bf3e800beea3..c7cd9f838de0133d7ba7ce5dda779d20f7db4f12 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.31 1999/10/25 03:07:52 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.32 1999/11/07 23:08:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -254,7 +254,7 @@ GetRawDatabaseInfo(char *name, Oid *db_id, char *path)
                         */
                        tup_db = (Form_pg_database) GETSTRUCT(&tup);
 
-                       if (strcmp(name, tup_db->datname.data) == 0)
+                       if (strcmp(name, NameStr(tup_db->datname)) == 0)
                        {
                                /* Found it; extract the OID and the database path. */
                                *db_id = tup.t_data->t_oid;
index 745bd6e49858a5066e74d3fd57950e9317c70d6d..b43926577dba2b679b705423c64d4b52dcaa56da 100644 (file)
@@ -133,7 +133,7 @@ MainLoop(PsqlSettings *pset, FILE *source)
                 */
 
                /* No more input.  Time to quit, or \i done */
-               if (line == NULL || (!pset->cur_cmd_interactive && *line == '\0'))
+               if (line == NULL)
                {
                        if (GetVariableBool(pset->vars, "echo") && !GetVariableBool(pset->vars, "quiet"))
                                puts("EOF\n");
index 132ecc9322e8e2d34b66a147c666e621eb4f5015..c84363ea7f3a3d0334a0f623fcb2e877bc27815c 100644 (file)
@@ -79,7 +79,7 @@ SetVariable(VariableSpace space, const char *name, const char *value)
        if (strspn(name, VALID_VARIABLE_CHARS) != strlen(name))
                return false;
 
-       for (current = space; current; previous = current, current = current->next)
+       for (current = space, previous = NULL; current; previous = current, current = current->next)
        {
 #ifdef USE_ASSERT_CHECKING
                assert(current->name);
index 0beb504d388358edbe82246080f0ecf16a360517..396c3c262bf2328a543d06b3f667dc7c84737574 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1995, Regents of the University of California
  *
- * $Id: postgres.h,v 1.29 1999/11/04 08:01:07 inoue Exp $
+ * $Id: postgres.h,v 1.30 1999/11/07 23:08:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -115,6 +115,8 @@ typedef union nameData
 } NameData;
 typedef NameData *Name;
 
+#define NameStr(name)  ((name).data)
+
 /* ----------------------------------------------------------------
  *                             Section 3: TransactionId and CommandId
  * ----------------------------------------------------------------
index 28ea74c5e2bd567a3a5156528fce966e9cd18115..b22ad294ceafc3a06c5c75269b2ac165e0a3c0a0 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: rel.h,v 1.28 1999/11/04 08:01:09 inoue Exp $
+ * $Id: rel.h,v 1.29 1999/11/07 23:08:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -176,7 +176,7 @@ typedef Relation *RelationPtr;
  *
  *       Returns a Relation Name
  */
-#define RelationGetRelationName(relation) (&(relation)->rd_rel->relname)
+#define RelationGetRelationName(relation) (NameStr((relation)->rd_rel->relname))
 
 /*
  * RelationGetNumberOfAttributes
index c2e85673d3db5a6fe642693895a1e8b4e2b3eb9d..49bc642f4f480433b9ae56a161ba2b7eec833323 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.11 1999/09/21 21:10:37 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.12 1999/11/07 23:08:34 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -1212,7 +1212,7 @@ plpgsql_parse_wordrowtype(char *string)
                strcat(var->refname, ".");
                strcat(var->refname, cp);
                var->datatype = malloc(sizeof(PLpgSQL_type));
-               var->datatype->typname = strdup(nameout(&(typeStruct->typname)));
+               var->datatype->typname = strdup(NameStr(typeStruct->typname));
                var->datatype->typoid = typetup->t_data->t_oid;
                fmgr_info(typeStruct->typinput, &(var->datatype->typinput));
                var->datatype->typbyval = typeStruct->typbyval;
index 5be7e55c2d522d25939886d57d893ad0431ec81e..59485f84a2264bc40e8748179feb9623b6a901a3 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.13 1999/07/15 15:21:47 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.14 1999/11/07 23:08:35 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -659,7 +659,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
 
        var = (PLpgSQL_var *) (estate.datums[func->tg_relname_varno]);
        var->isnull = false;
-       var->value = (Datum) namein(nameout(&(trigdata->tg_relation->rd_rel->relname)));
+       var->value = (Datum) namein(RelationGetRelationName(trigdata->tg_relation));
 
        var = (PLpgSQL_var *) (estate.datums[func->tg_nargs_varno]);
        var->isnull = false;
index 0ec47d9f95ff64399c1cc6e3d2517340881a2e4b..8813dc3881187c427578d2760201086c2d8e5545 100644 (file)
@@ -3,7 +3,7 @@
  *                       procedural language (PL)
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.13 1999/07/15 15:21:50 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.14 1999/11/07 23:08:36 momjian Exp $
  *
  *       This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -920,7 +920,8 @@ pltcl_trigger_handler(FmgrInfo *proinfo)
        /* A list of attribute names for argument TG_relatts */
        Tcl_DStringAppendElement(&tcl_trigtup, "");
        for (i = 0; i < tupdesc->natts; i++)
-               Tcl_DStringAppendElement(&tcl_trigtup, tupdesc->attrs[i]->attname.data);
+               Tcl_DStringAppendElement(&tcl_trigtup,
+                       NameStr(tupdesc->attrs[i]->attname));
        Tcl_DStringAppendElement(&tcl_cmd, Tcl_DStringValue(&tcl_trigtup));
        Tcl_DStringFree(&tcl_trigtup);
        Tcl_DStringInit(&tcl_trigtup);
@@ -2125,7 +2126,7 @@ pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
                /************************************************************
                 * Get the attribute name
                 ************************************************************/
-               attname = tupdesc->attrs[i]->attname.data;
+               attname = NameStr(tupdesc->attrs[i]->attname);
 
                /************************************************************
                 * Get the attributes value
@@ -2198,7 +2199,7 @@ pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
                /************************************************************
                 * Get the attribute name
                 ************************************************************/
-               attname = tupdesc->attrs[i]->attname.data;
+               attname = NameStr(tupdesc->attrs[i]->attname);
 
                /************************************************************
                 * Get the attributes value