aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/command.c4
-rw-r--r--src/backend/commands/dbcommands.c5
-rw-r--r--src/backend/commands/indexcmds.c5
-rw-r--r--src/backend/commands/sequence.c6
-rw-r--r--src/backend/commands/trigger.c24
-rw-r--r--src/backend/commands/user.c22
6 files changed, 38 insertions, 28 deletions
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index 7d21acc16ba..3deea360e0a 100644
--- a/src/backend/commands/command.c
+++ b/src/backend/commands/command.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.91 2000/07/18 03:57:33 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.92 2000/08/03 16:34:01 tgl Exp $
*
* NOTES
* The PerformAddAttribute() code, like most of the relation
@@ -565,7 +565,7 @@ AlterTableAlterColumn(const char *relationName,
*/
tuple = SearchSysCacheTuple(ATTNAME,
ObjectIdGetDatum(myrelid),
- NameGetDatum(namein((char *) colName)),
+ PointerGetDatum(colName),
0, 0);
if (!HeapTupleIsValid(tuple))
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index bda64842c49..1c2df9c5eb8 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.58 2000/07/05 23:11:11 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.59 2000/08/03 16:34:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -98,7 +98,8 @@ createdb(const char *dbname, const char *dbpath, int encoding)
pg_database_dsc = RelationGetDescr(pg_database_rel);
/* Form tuple */
- new_record[Anum_pg_database_datname - 1] = NameGetDatum(namein(dbname));
+ new_record[Anum_pg_database_datname - 1] = DirectFunctionCall1(namein,
+ CStringGetDatum(dbname));
new_record[Anum_pg_database_datdba - 1] = Int32GetDatum(user_id);
new_record[Anum_pg_database_encoding - 1] = Int32GetDatum(encoding);
new_record[Anum_pg_database_datpath - 1] = DirectFunctionCall1(textin,
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 6ede4f51c12..85de47a6766 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.35 2000/07/14 22:17:42 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.36 2000/08/03 16:34:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -576,7 +576,8 @@ GetDefaultOpClass(Oid atttypid)
if (!HeapTupleIsValid(tuple))
return NULL;
- return nameout(&((Form_pg_opclass) GETSTRUCT(tuple))->opcname);
+ return DatumGetCString(DirectFunctionCall1(nameout,
+ NameGetDatum(&((Form_pg_opclass) GETSTRUCT(tuple))->opcname)));
}
/*
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 80fca6a38a1..f528abed752 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -201,7 +201,7 @@ nextval(PG_FUNCTION_ARGS)
rescnt = 0;
#ifndef NO_SECURITY
- if (pg_aclcheck(seqname, getpgusername(), ACL_WR) != ACLCHECK_OK)
+ if (pg_aclcheck(seqname, GetPgUserName(), ACL_WR) != ACLCHECK_OK)
elog(ERROR, "%s.nextval: you don't have permissions to set sequence %s",
seqname, seqname);
#endif
@@ -298,7 +298,7 @@ currval(PG_FUNCTION_ARGS)
int32 result;
#ifndef NO_SECURITY
- if (pg_aclcheck(seqname, getpgusername(), ACL_RD) != ACLCHECK_OK)
+ if (pg_aclcheck(seqname, GetPgUserName(), ACL_RD) != ACLCHECK_OK)
elog(ERROR, "%s.currval: you don't have permissions to read sequence %s",
seqname, seqname);
#endif
@@ -328,7 +328,7 @@ setval(PG_FUNCTION_ARGS)
Form_pg_sequence seq;
#ifndef NO_SECURITY
- if (pg_aclcheck(seqname, getpgusername(), ACL_WR) != ACLCHECK_OK)
+ if (pg_aclcheck(seqname, GetPgUserName(), ACL_WR) != ACLCHECK_OK)
elog(ERROR, "%s.setval: you don't have permissions to set sequence %s",
seqname, seqname);
#endif
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 8abd930b1b9..17e61a379fb 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.73 2000/07/29 03:26:40 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.74 2000/08/03 16:34:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -195,7 +195,8 @@ CreateTrigger(CreateTrigStmt *stmt)
MemSet(nulls, ' ', Natts_pg_trigger * sizeof(char));
values[Anum_pg_trigger_tgrelid - 1] = ObjectIdGetDatum(RelationGetRelid(rel));
- values[Anum_pg_trigger_tgname - 1] = NameGetDatum(namein(stmt->trigname));
+ values[Anum_pg_trigger_tgname - 1] = DirectFunctionCall1(namein,
+ CStringGetDatum(stmt->trigname));
values[Anum_pg_trigger_tgfoid - 1] = ObjectIdGetDatum(funcoid);
values[Anum_pg_trigger_tgtype - 1] = Int16GetDatum(tgtype);
values[Anum_pg_trigger_tgenabled - 1] = BoolGetDatum(true);
@@ -441,7 +442,8 @@ RelationRemoveTriggers(Relation rel)
refrel = heap_open(pg_trigger->tgrelid, NoLock);
stmt.relname = pstrdup(RelationGetRelationName(refrel));
- stmt.trigname = nameout(&pg_trigger->tgname);
+ stmt.trigname = DatumGetCString(DirectFunctionCall1(nameout,
+ NameGetDatum(&pg_trigger->tgname)));
heap_close(refrel, NoLock);
@@ -552,7 +554,8 @@ RelationBuildTriggers(Relation relation)
build->tgoid = htup->t_data->t_oid;
build->tgname = MemoryContextStrdup(CacheMemoryContext,
- nameout(&pg_trigger->tgname));
+ DatumGetCString(DirectFunctionCall1(nameout,
+ NameGetDatum(&pg_trigger->tgname))));
build->tgfoid = pg_trigger->tgfoid;
build->tgfunc.fn_oid = InvalidOid; /* mark FmgrInfo as uninitialized */
build->tgtype = pg_trigger->tgtype;
@@ -1217,8 +1220,8 @@ deferredTriggerGetPreviousEvent(Oid relid, ItemPointer ctid)
}
elog(ERROR,
- "deferredTriggerGetPreviousEvent(): event for tuple %s not found",
- tidout(ctid));
+ "deferredTriggerGetPreviousEvent(): event for tuple %s not found",
+ DatumGetCString(DirectFunctionCall1(tidout, PointerGetDatum(ctid))));
return NULL;
}
@@ -2020,13 +2023,15 @@ DeferredTriggerSaveEvent(Relation rel, int event,
TRIGGER_DEFERRED_ROW_INSERTED)
elog(ERROR, "triggered data change violation "
"on relation \"%s\"",
- nameout(&(rel->rd_rel->relname)));
+ DatumGetCString(DirectFunctionCall1(nameout,
+ NameGetDatum(&(rel->rd_rel->relname)))));
if (prev_event->dte_item[i].dti_state &
TRIGGER_DEFERRED_KEY_CHANGED)
elog(ERROR, "triggered data change violation "
"on relation \"%s\"",
- nameout(&(rel->rd_rel->relname)));
+ DatumGetCString(DirectFunctionCall1(nameout,
+ NameGetDatum(&(rel->rd_rel->relname)))));
}
/* ----------
@@ -2060,7 +2065,8 @@ DeferredTriggerSaveEvent(Relation rel, int event,
if (prev_event->dte_event & TRIGGER_DEFERRED_KEY_CHANGED)
elog(ERROR, "triggered data change violation "
"on relation \"%s\"",
- nameout(&(rel->rd_rel->relname)));
+ DatumGetCString(DirectFunctionCall1(nameout,
+ NameGetDatum(&(rel->rd_rel->relname)))));
break;
}
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 82135e99946..2164c516f9b 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.65 2000/07/22 04:16:13 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/user.c,v 1.66 2000/08/03 16:34:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -121,7 +121,8 @@ write_password_file(Relation rel)
"%s"
CRYPT_PWD_FILE_SEPSTR
"%s\n",
- nameout(DatumGetName(datum_n)),
+ DatumGetCString(DirectFunctionCall1(nameout,
+ NameGetDatum(DatumGetName(datum_n)))),
null_p ? "" :
DatumGetCString(DirectFunctionCall1(textout, datum_p)),
null_v ? "\\N" :
@@ -246,8 +247,8 @@ CreateUser(CreateUserStmt *stmt)
/*
* Build a tuple to insert
*/
- new_record[Anum_pg_shadow_usename - 1] = PointerGetDatum(namein(stmt->user)); /* this truncated
- * properly */
+ new_record[Anum_pg_shadow_usename - 1] = DirectFunctionCall1(namein,
+ CStringGetDatum(stmt->user));
new_record[Anum_pg_shadow_usesysid - 1] = Int32GetDatum(havesysid ? stmt->sysid : max_id + 1);
AssertState(BoolIsValid(stmt->createdb));
@@ -374,7 +375,8 @@ AlterUser(AlterUserStmt *stmt)
/*
* Build a tuple to update, perusing the information just obtained
*/
- new_record[Anum_pg_shadow_usename - 1] = PointerGetDatum(namein(stmt->user));
+ new_record[Anum_pg_shadow_usename - 1] = DirectFunctionCall1(namein,
+ CStringGetDatum(stmt->user));
new_record_nulls[Anum_pg_shadow_usename - 1] = ' ';
/* sysid - leave as is */
@@ -556,7 +558,9 @@ DropUser(DropUserStmt *stmt)
datum = heap_getattr(tmp_tuple, Anum_pg_database_datname, pg_dsc, &null);
heap_close(pg_shadow_rel, AccessExclusiveLock);
elog(ERROR, "DROP USER: user \"%s\" owns database \"%s\", cannot be removed%s",
- user, nameout(DatumGetName(datum)),
+ user,
+ DatumGetCString(DirectFunctionCall1(nameout,
+ NameGetDatum(DatumGetName(datum)))),
(length(stmt->users) > 1) ? " (no users removed)" : ""
);
}
@@ -587,11 +591,9 @@ DropUser(DropUserStmt *stmt)
{
AlterGroupStmt ags;
+ /* the group name from which to try to drop the user: */
datum = heap_getattr(tmp_tuple, Anum_pg_group_groname, pg_dsc, &null);
-
- ags.name = nameout(DatumGetName(datum)); /* the group name from
- * which to try to drop
- * the user */
+ ags.name = DatumGetCString(DirectFunctionCall1(nameout, datum));
ags.action = -1;
ags.listUsers = lcons((void *) makeInteger(usesysid), NIL);
AlterGroup(&ags, "DROP USER");