Skip to content

Commit c298d74

Browse files
committed
More functions updated to new fmgr style --- money, name, tid datatypes.
We're reaching the mopup stage here (good thing too, this is getting tedious).
1 parent 1bd3a8f commit c298d74

File tree

22 files changed

+316
-314
lines changed

22 files changed

+316
-314
lines changed

contrib/spi/timetravel.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ set_timetravel(PG_FUNCTION_ARGS)
368368
TTOff = malloc(sizeof(char *));
369369
else
370370
TTOff = realloc(TTOff, (nTTOff + 1) * sizeof(char *));
371-
s = rname = nameout(relname);
371+
s = rname = DatumGetCString(DirectFunctionCall1(nameout,
372+
NameGetDatum(relname)));
372373
d = TTOff[nTTOff] = malloc(strlen(rname) + 1);
373374
while (*s)
374375
*d++ = tolower(*s++);

src/backend/access/heap/tuptoaster.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.10 2000/07/31 22:39:17 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/heap/tuptoaster.c,v 1.11 2000/08/03 16:33:40 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -785,12 +785,14 @@ toast_save_datum(Relation rel, Oid mainoid, int16 attno, Datum value)
785785
toastrel = heap_open(rel->rd_rel->reltoastrelid, RowExclusiveLock);
786786
if (toastrel == NULL)
787787
elog(ERROR, "Failed to open secondary relation of %s",
788-
nameout(&(rel->rd_rel->relname)));
788+
DatumGetCString(DirectFunctionCall1(nameout,
789+
NameGetDatum(&(rel->rd_rel->relname)))));
789790
toasttupDesc = toastrel->rd_att;
790791
toastidx = index_open(rel->rd_rel->reltoastidxid);
791792
if (toastidx == NULL)
792793
elog(ERROR, "Failed to open index for secondary relation of %s",
793-
nameout(&(rel->rd_rel->relname)));
794+
DatumGetCString(DirectFunctionCall1(nameout,
795+
NameGetDatum(&(rel->rd_rel->relname)))));
794796

795797
/* ----------
796798
* Split up the item into chunks

src/backend/catalog/heap.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.140 2000/07/14 22:17:40 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.141 2000/08/03 16:33:52 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -409,8 +409,8 @@ CheckAttributeNames(TupleDesc tupdesc)
409409
{
410410
for (j = 0; j < (int) (sizeof(HeapAtt) / sizeof(HeapAtt[0])); j++)
411411
{
412-
if (nameeq(&(HeapAtt[j]->attname),
413-
&(tupdesc->attrs[i]->attname)))
412+
if (strcmp(NameStr(HeapAtt[j]->attname),
413+
NameStr(tupdesc->attrs[i]->attname)) == 0)
414414
{
415415
elog(ERROR, "Attribute '%s' has a name conflict"
416416
"\n\tName matches an existing system attribute",
@@ -433,8 +433,8 @@ CheckAttributeNames(TupleDesc tupdesc)
433433
{
434434
for (j = 0; j < i; j++)
435435
{
436-
if (nameeq(&(tupdesc->attrs[j]->attname),
437-
&(tupdesc->attrs[i]->attname)))
436+
if (strcmp(NameStr(tupdesc->attrs[j]->attname),
437+
NameStr(tupdesc->attrs[i]->attname)) == 0)
438438
{
439439
elog(ERROR, "Attribute '%s' is repeated",
440440
NameStr(tupdesc->attrs[j]->attname));
@@ -1633,7 +1633,8 @@ StoreRelCheck(Relation rel, char *ccname, char *ccbin)
16331633
ccsrc = deparse_expression(expr, lcons(lcons(rte, NIL), NIL), false);
16341634

16351635
values[Anum_pg_relcheck_rcrelid - 1] = RelationGetRelid(rel);
1636-
values[Anum_pg_relcheck_rcname - 1] = PointerGetDatum(namein(ccname));
1636+
values[Anum_pg_relcheck_rcname - 1] = DirectFunctionCall1(namein,
1637+
CStringGetDatum(ccname));
16371638
values[Anum_pg_relcheck_rcbin - 1] = DirectFunctionCall1(textin,
16381639
CStringGetDatum(ccbin));
16391640
values[Anum_pg_relcheck_rcsrc - 1] = DirectFunctionCall1(textin,

src/backend/commands/command.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.91 2000/07/18 03:57:33 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.92 2000/08/03 16:34:01 tgl Exp $
1212
*
1313
* NOTES
1414
* The PerformAddAttribute() code, like most of the relation
@@ -565,7 +565,7 @@ AlterTableAlterColumn(const char *relationName,
565565
*/
566566
tuple = SearchSysCacheTuple(ATTNAME,
567567
ObjectIdGetDatum(myrelid),
568-
NameGetDatum(namein((char *) colName)),
568+
PointerGetDatum(colName),
569569
0, 0);
570570

571571
if (!HeapTupleIsValid(tuple))

src/backend/commands/dbcommands.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.58 2000/07/05 23:11:11 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.59 2000/08/03 16:34:01 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -98,7 +98,8 @@ createdb(const char *dbname, const char *dbpath, int encoding)
9898
pg_database_dsc = RelationGetDescr(pg_database_rel);
9999

100100
/* Form tuple */
101-
new_record[Anum_pg_database_datname - 1] = NameGetDatum(namein(dbname));
101+
new_record[Anum_pg_database_datname - 1] = DirectFunctionCall1(namein,
102+
CStringGetDatum(dbname));
102103
new_record[Anum_pg_database_datdba - 1] = Int32GetDatum(user_id);
103104
new_record[Anum_pg_database_encoding - 1] = Int32GetDatum(encoding);
104105
new_record[Anum_pg_database_datpath - 1] = DirectFunctionCall1(textin,

src/backend/commands/indexcmds.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.35 2000/07/14 22:17:42 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.36 2000/08/03 16:34:01 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -576,7 +576,8 @@ GetDefaultOpClass(Oid atttypid)
576576
if (!HeapTupleIsValid(tuple))
577577
return NULL;
578578

579-
return nameout(&((Form_pg_opclass) GETSTRUCT(tuple))->opcname);
579+
return DatumGetCString(DirectFunctionCall1(nameout,
580+
NameGetDatum(&((Form_pg_opclass) GETSTRUCT(tuple))->opcname)));
580581
}
581582

582583
/*

src/backend/commands/sequence.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ nextval(PG_FUNCTION_ARGS)
201201
rescnt = 0;
202202

203203
#ifndef NO_SECURITY
204-
if (pg_aclcheck(seqname, getpgusername(), ACL_WR) != ACLCHECK_OK)
204+
if (pg_aclcheck(seqname, GetPgUserName(), ACL_WR) != ACLCHECK_OK)
205205
elog(ERROR, "%s.nextval: you don't have permissions to set sequence %s",
206206
seqname, seqname);
207207
#endif
@@ -298,7 +298,7 @@ currval(PG_FUNCTION_ARGS)
298298
int32 result;
299299

300300
#ifndef NO_SECURITY
301-
if (pg_aclcheck(seqname, getpgusername(), ACL_RD) != ACLCHECK_OK)
301+
if (pg_aclcheck(seqname, GetPgUserName(), ACL_RD) != ACLCHECK_OK)
302302
elog(ERROR, "%s.currval: you don't have permissions to read sequence %s",
303303
seqname, seqname);
304304
#endif
@@ -328,7 +328,7 @@ setval(PG_FUNCTION_ARGS)
328328
Form_pg_sequence seq;
329329

330330
#ifndef NO_SECURITY
331-
if (pg_aclcheck(seqname, getpgusername(), ACL_WR) != ACLCHECK_OK)
331+
if (pg_aclcheck(seqname, GetPgUserName(), ACL_WR) != ACLCHECK_OK)
332332
elog(ERROR, "%s.setval: you don't have permissions to set sequence %s",
333333
seqname, seqname);
334334
#endif

src/backend/commands/trigger.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.73 2000/07/29 03:26:40 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.74 2000/08/03 16:34:01 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -195,7 +195,8 @@ CreateTrigger(CreateTrigStmt *stmt)
195195
MemSet(nulls, ' ', Natts_pg_trigger * sizeof(char));
196196

197197
values[Anum_pg_trigger_tgrelid - 1] = ObjectIdGetDatum(RelationGetRelid(rel));
198-
values[Anum_pg_trigger_tgname - 1] = NameGetDatum(namein(stmt->trigname));
198+
values[Anum_pg_trigger_tgname - 1] = DirectFunctionCall1(namein,
199+
CStringGetDatum(stmt->trigname));
199200
values[Anum_pg_trigger_tgfoid - 1] = ObjectIdGetDatum(funcoid);
200201
values[Anum_pg_trigger_tgtype - 1] = Int16GetDatum(tgtype);
201202
values[Anum_pg_trigger_tgenabled - 1] = BoolGetDatum(true);
@@ -441,7 +442,8 @@ RelationRemoveTriggers(Relation rel)
441442
refrel = heap_open(pg_trigger->tgrelid, NoLock);
442443

443444
stmt.relname = pstrdup(RelationGetRelationName(refrel));
444-
stmt.trigname = nameout(&pg_trigger->tgname);
445+
stmt.trigname = DatumGetCString(DirectFunctionCall1(nameout,
446+
NameGetDatum(&pg_trigger->tgname)));
445447

446448
heap_close(refrel, NoLock);
447449

@@ -552,7 +554,8 @@ RelationBuildTriggers(Relation relation)
552554

553555
build->tgoid = htup->t_data->t_oid;
554556
build->tgname = MemoryContextStrdup(CacheMemoryContext,
555-
nameout(&pg_trigger->tgname));
557+
DatumGetCString(DirectFunctionCall1(nameout,
558+
NameGetDatum(&pg_trigger->tgname))));
556559
build->tgfoid = pg_trigger->tgfoid;
557560
build->tgfunc.fn_oid = InvalidOid; /* mark FmgrInfo as uninitialized */
558561
build->tgtype = pg_trigger->tgtype;
@@ -1217,8 +1220,8 @@ deferredTriggerGetPreviousEvent(Oid relid, ItemPointer ctid)
12171220
}
12181221

12191222
elog(ERROR,
1220-
"deferredTriggerGetPreviousEvent(): event for tuple %s not found",
1221-
tidout(ctid));
1223+
"deferredTriggerGetPreviousEvent(): event for tuple %s not found",
1224+
DatumGetCString(DirectFunctionCall1(tidout, PointerGetDatum(ctid))));
12221225
return NULL;
12231226
}
12241227

@@ -2020,13 +2023,15 @@ DeferredTriggerSaveEvent(Relation rel, int event,
20202023
TRIGGER_DEFERRED_ROW_INSERTED)
20212024
elog(ERROR, "triggered data change violation "
20222025
"on relation \"%s\"",
2023-
nameout(&(rel->rd_rel->relname)));
2026+
DatumGetCString(DirectFunctionCall1(nameout,
2027+
NameGetDatum(&(rel->rd_rel->relname)))));
20242028

20252029
if (prev_event->dte_item[i].dti_state &
20262030
TRIGGER_DEFERRED_KEY_CHANGED)
20272031
elog(ERROR, "triggered data change violation "
20282032
"on relation \"%s\"",
2029-
nameout(&(rel->rd_rel->relname)));
2033+
DatumGetCString(DirectFunctionCall1(nameout,
2034+
NameGetDatum(&(rel->rd_rel->relname)))));
20302035
}
20312036

20322037
/* ----------
@@ -2060,7 +2065,8 @@ DeferredTriggerSaveEvent(Relation rel, int event,
20602065
if (prev_event->dte_event & TRIGGER_DEFERRED_KEY_CHANGED)
20612066
elog(ERROR, "triggered data change violation "
20622067
"on relation \"%s\"",
2063-
nameout(&(rel->rd_rel->relname)));
2068+
DatumGetCString(DirectFunctionCall1(nameout,
2069+
NameGetDatum(&(rel->rd_rel->relname)))));
20642070

20652071
break;
20662072
}

src/backend/commands/user.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.65 2000/07/22 04:16:13 tgl Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.66 2000/08/03 16:34:01 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -121,7 +121,8 @@ write_password_file(Relation rel)
121121
"%s"
122122
CRYPT_PWD_FILE_SEPSTR
123123
"%s\n",
124-
nameout(DatumGetName(datum_n)),
124+
DatumGetCString(DirectFunctionCall1(nameout,
125+
NameGetDatum(DatumGetName(datum_n)))),
125126
null_p ? "" :
126127
DatumGetCString(DirectFunctionCall1(textout, datum_p)),
127128
null_v ? "\\N" :
@@ -246,8 +247,8 @@ CreateUser(CreateUserStmt *stmt)
246247
/*
247248
* Build a tuple to insert
248249
*/
249-
new_record[Anum_pg_shadow_usename - 1] = PointerGetDatum(namein(stmt->user)); /* this truncated
250-
* properly */
250+
new_record[Anum_pg_shadow_usename - 1] = DirectFunctionCall1(namein,
251+
CStringGetDatum(stmt->user));
251252
new_record[Anum_pg_shadow_usesysid - 1] = Int32GetDatum(havesysid ? stmt->sysid : max_id + 1);
252253

253254
AssertState(BoolIsValid(stmt->createdb));
@@ -374,7 +375,8 @@ AlterUser(AlterUserStmt *stmt)
374375
/*
375376
* Build a tuple to update, perusing the information just obtained
376377
*/
377-
new_record[Anum_pg_shadow_usename - 1] = PointerGetDatum(namein(stmt->user));
378+
new_record[Anum_pg_shadow_usename - 1] = DirectFunctionCall1(namein,
379+
CStringGetDatum(stmt->user));
378380
new_record_nulls[Anum_pg_shadow_usename - 1] = ' ';
379381

380382
/* sysid - leave as is */
@@ -556,7 +558,9 @@ DropUser(DropUserStmt *stmt)
556558
datum = heap_getattr(tmp_tuple, Anum_pg_database_datname, pg_dsc, &null);
557559
heap_close(pg_shadow_rel, AccessExclusiveLock);
558560
elog(ERROR, "DROP USER: user \"%s\" owns database \"%s\", cannot be removed%s",
559-
user, nameout(DatumGetName(datum)),
561+
user,
562+
DatumGetCString(DirectFunctionCall1(nameout,
563+
NameGetDatum(DatumGetName(datum)))),
560564
(length(stmt->users) > 1) ? " (no users removed)" : ""
561565
);
562566
}
@@ -587,11 +591,9 @@ DropUser(DropUserStmt *stmt)
587591
{
588592
AlterGroupStmt ags;
589593

594+
/* the group name from which to try to drop the user: */
590595
datum = heap_getattr(tmp_tuple, Anum_pg_group_groname, pg_dsc, &null);
591-
592-
ags.name = nameout(DatumGetName(datum)); /* the group name from
593-
* which to try to drop
594-
* the user */
596+
ags.name = DatumGetCString(DirectFunctionCall1(nameout, datum));
595597
ags.action = -1;
596598
ags.listUsers = lcons((void *) makeInteger(usesysid), NIL);
597599
AlterGroup(&ags, "DROP USER");

src/backend/optimizer/path/indxpath.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.90 2000/07/27 23:15:56 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.91 2000/08/03 16:34:12 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -2006,7 +2006,7 @@ string_to_datum(const char *str, Oid datatype)
20062006
* varchar constants too...
20072007
*/
20082008
if (datatype == NAMEOID)
2009-
return PointerGetDatum(namein((char *) str));
2009+
return DirectFunctionCall1(namein, CStringGetDatum(str));
20102010
else
20112011
return DirectFunctionCall1(textin, CStringGetDatum(str));
20122012
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy