1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Remove all uses of the deprecated functions heap_formtuple, heap_modifytuple,

and heap_deformtuple in favor of the newer functions heap_form_tuple et al
(which do the same things but use bool control flags instead of arbitrary
char values).  Eliminate the former duplicate coding of these functions,
reducing the deprecated functions to mere wrappers around the newer ones.
We can't get rid of them entirely because add-on modules probably still
contain many instances of the old coding style.

Kris Jurka
This commit is contained in:
Tom Lane
2008-11-02 01:45:28 +00:00
parent 492059daba
commit 902d1cb35f
46 changed files with 630 additions and 1013 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.126 2008/10/31 15:05:00 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.127 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1277,8 +1277,8 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
k,
n;
Datum values[Natts_pg_statistic];
char nulls[Natts_pg_statistic];
char replaces[Natts_pg_statistic];
bool nulls[Natts_pg_statistic];
bool replaces[Natts_pg_statistic];
/* Ignore attr if we weren't able to collect stats */
if (!stats->stats_valid)
@@ -1289,8 +1289,8 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
*/
for (i = 0; i < Natts_pg_statistic; ++i)
{
nulls[i] = ' ';
replaces[i] = 'r';
nulls[i] = false;
replaces[i] = true;
}
i = 0;
@@ -1326,7 +1326,7 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
}
else
{
nulls[i] = 'n';
nulls[i] = true;
values[i++] = (Datum) 0;
}
}
@@ -1346,7 +1346,7 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
}
else
{
nulls[i] = 'n';
nulls[i] = true;
values[i++] = (Datum) 0;
}
}
@@ -1360,7 +1360,7 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
if (HeapTupleIsValid(oldtup))
{
/* Yes, replace it */
stup = heap_modifytuple(oldtup,
stup = heap_modify_tuple(oldtup,
RelationGetDescr(sd),
values,
nulls,
@@ -1371,7 +1371,7 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
else
{
/* No, insert new tuple */
stup = heap_formtuple(RelationGetDescr(sd), values, nulls);
stup = heap_form_tuple(RelationGetDescr(sd), values, nulls);
simple_heap_insert(sd, stup);
}

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.141 2008/08/30 01:39:13 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.142 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -446,7 +446,7 @@ Exec_Listen(Relation lRel, const char *relname)
HeapScanDesc scan;
HeapTuple tuple;
Datum values[Natts_pg_listener];
char nulls[Natts_pg_listener];
bool nulls[Natts_pg_listener];
NameData condname;
bool alreadyListener = false;
@@ -475,14 +475,14 @@ Exec_Listen(Relation lRel, const char *relname)
/*
* OK to insert a new tuple
*/
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
namestrcpy(&condname, relname);
values[Anum_pg_listener_relname - 1] = NameGetDatum(&condname);
values[Anum_pg_listener_pid - 1] = Int32GetDatum(MyProcPid);
values[Anum_pg_listener_notify - 1] = Int32GetDatum(0); /* no notifies pending */
tuple = heap_formtuple(RelationGetDescr(lRel), values, nulls);
tuple = heap_form_tuple(RelationGetDescr(lRel), values, nulls);
simple_heap_insert(lRel, tuple);
@@ -585,14 +585,14 @@ Send_Notify(Relation lRel)
HeapTuple lTuple,
rTuple;
Datum value[Natts_pg_listener];
char repl[Natts_pg_listener],
bool repl[Natts_pg_listener],
nulls[Natts_pg_listener];
/* preset data to update notify column to MyProcPid */
nulls[0] = nulls[1] = nulls[2] = ' ';
repl[0] = repl[1] = repl[2] = ' ';
repl[Anum_pg_listener_notify - 1] = 'r';
value[0] = value[1] = value[2] = (Datum) 0;
memset(nulls, false, sizeof(nulls));
memset(repl, false, sizeof(repl));
repl[Anum_pg_listener_notify - 1] = true;
memset(value, 0, sizeof(value));
value[Anum_pg_listener_notify - 1] = Int32GetDatum(MyProcPid);
scan = heap_beginscan(lRel, SnapshotNow, 0, NULL);
@@ -647,7 +647,7 @@ Send_Notify(Relation lRel)
else if (listener->notification == 0)
{
/* Rewrite the tuple with my PID in notification column */
rTuple = heap_modifytuple(lTuple, tdesc, value, nulls, repl);
rTuple = heap_modify_tuple(lTuple, tdesc, value, nulls, repl);
simple_heap_update(lRel, &lTuple->t_self, rTuple);
#ifdef NOT_USED /* currently there are no indexes */
@@ -950,7 +950,7 @@ ProcessIncomingNotify(void)
HeapTuple lTuple,
rTuple;
Datum value[Natts_pg_listener];
char repl[Natts_pg_listener],
bool repl[Natts_pg_listener],
nulls[Natts_pg_listener];
bool catchup_enabled;
@@ -977,10 +977,10 @@ ProcessIncomingNotify(void)
scan = heap_beginscan(lRel, SnapshotNow, 1, key);
/* Prepare data for rewriting 0 into notification field */
nulls[0] = nulls[1] = nulls[2] = ' ';
repl[0] = repl[1] = repl[2] = ' ';
repl[Anum_pg_listener_notify - 1] = 'r';
value[0] = value[1] = value[2] = (Datum) 0;
memset(nulls, false, sizeof(nulls));
memset(repl, false, sizeof(repl));
repl[Anum_pg_listener_notify - 1] = true;
memset(value, 0, sizeof(value));
value[Anum_pg_listener_notify - 1] = Int32GetDatum(0);
while ((lTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
@@ -1002,7 +1002,7 @@ ProcessIncomingNotify(void)
/*
* Rewrite the tuple with 0 in notification column.
*/
rTuple = heap_modifytuple(lTuple, tdesc, value, nulls, repl);
rTuple = heap_modify_tuple(lTuple, tdesc, value, nulls, repl);
simple_heap_update(lRel, &lTuple->t_self, rTuple);
#ifdef NOT_USED /* currently there are no indexes */

View File

@@ -7,7 +7,7 @@
* Copyright (c) 1996-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.104 2008/10/21 10:38:51 petere Exp $
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.105 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -197,8 +197,8 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
HeapTuple oldtuple;
HeapTuple newtuple = NULL;
Datum values[Natts_pg_description];
char nulls[Natts_pg_description];
char replaces[Natts_pg_description];
bool nulls[Natts_pg_description];
bool replaces[Natts_pg_description];
int i;
/* Reduce empty-string to NULL case */
@@ -210,8 +210,8 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
{
for (i = 0; i < Natts_pg_description; i++)
{
nulls[i] = ' ';
replaces[i] = 'r';
nulls[i] = false;
replaces[i] = true;
}
i = 0;
values[i++] = ObjectIdGetDatum(oid);
@@ -248,7 +248,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
simple_heap_delete(description, &oldtuple->t_self);
else
{
newtuple = heap_modifytuple(oldtuple, RelationGetDescr(description), values,
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(description), values,
nulls, replaces);
simple_heap_update(description, &oldtuple->t_self, newtuple);
}
@@ -262,7 +262,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
if (newtuple == NULL && comment != NULL)
{
newtuple = heap_formtuple(RelationGetDescr(description),
newtuple = heap_form_tuple(RelationGetDescr(description),
values, nulls);
simple_heap_insert(description, newtuple);
}
@@ -297,8 +297,8 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
HeapTuple oldtuple;
HeapTuple newtuple = NULL;
Datum values[Natts_pg_shdescription];
char nulls[Natts_pg_shdescription];
char replaces[Natts_pg_shdescription];
bool nulls[Natts_pg_shdescription];
bool replaces[Natts_pg_shdescription];
int i;
/* Reduce empty-string to NULL case */
@@ -310,8 +310,8 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
{
for (i = 0; i < Natts_pg_shdescription; i++)
{
nulls[i] = ' ';
replaces[i] = 'r';
nulls[i] = false;
replaces[i] = true;
}
i = 0;
values[i++] = ObjectIdGetDatum(oid);
@@ -343,7 +343,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
simple_heap_delete(shdescription, &oldtuple->t_self);
else
{
newtuple = heap_modifytuple(oldtuple, RelationGetDescr(shdescription),
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(shdescription),
values, nulls, replaces);
simple_heap_update(shdescription, &oldtuple->t_self, newtuple);
}
@@ -357,7 +357,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
if (newtuple == NULL && comment != NULL)
{
newtuple = heap_formtuple(RelationGetDescr(shdescription),
newtuple = heap_form_tuple(RelationGetDescr(shdescription),
values, nulls);
simple_heap_insert(shdescription, newtuple);
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.299 2008/05/12 20:01:59 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.300 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1638,7 +1638,7 @@ CopyFrom(CopyState cstate)
int i;
Oid in_func_oid;
Datum *values;
char *nulls;
bool *nulls;
int nfields;
char **field_strings;
bool done = false;
@@ -1872,7 +1872,7 @@ CopyFrom(CopyState cstate)
}
values = (Datum *) palloc(num_phys_attrs * sizeof(Datum));
nulls = (char *) palloc(num_phys_attrs * sizeof(char));
nulls = (bool *) palloc(num_phys_attrs * sizeof(bool));
/* create workspace for CopyReadAttributes results */
nfields = file_has_oids ? (attr_count + 1) : attr_count;
@@ -1916,7 +1916,7 @@ CopyFrom(CopyState cstate)
/* Initialize all values for row to NULL */
MemSet(values, 0, num_phys_attrs * sizeof(Datum));
MemSet(nulls, 'n', num_phys_attrs * sizeof(char));
MemSet(nulls, true, num_phys_attrs * sizeof(bool));
if (!cstate->binary)
{
@@ -1998,7 +1998,7 @@ CopyFrom(CopyState cstate)
typioparams[m],
attr[m]->atttypmod);
if (string != NULL)
nulls[m] = ' ';
nulls[m] = false;
cstate->cur_attname = NULL;
cstate->cur_attval = NULL;
}
@@ -2054,8 +2054,7 @@ CopyFrom(CopyState cstate)
&in_functions[m],
typioparams[m],
attr[m]->atttypmod,
&isnull);
nulls[m] = isnull ? 'n' : ' ';
&nulls[m]);
cstate->cur_attname = NULL;
}
}
@@ -2068,13 +2067,11 @@ CopyFrom(CopyState cstate)
for (i = 0; i < num_defaults; i++)
{
values[defmap[i]] = ExecEvalExpr(defexprs[i], econtext,
&isnull, NULL);
if (!isnull)
nulls[defmap[i]] = ' ';
&nulls[defmap[i]], NULL);
}
/* And now we can form the input tuple. */
tuple = heap_formtuple(tupDesc, values, nulls);
tuple = heap_form_tuple(tupDesc, values, nulls);
if (cstate->oids && file_has_oids)
HeapTupleSetOid(tuple, loaded_oid);

View File

@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.214 2008/10/09 10:34:06 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.215 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -98,7 +98,7 @@ createdb(const CreatedbStmt *stmt)
Relation pg_database_rel;
HeapTuple tuple;
Datum new_record[Natts_pg_database];
char new_record_nulls[Natts_pg_database];
bool new_record_nulls[Natts_pg_database];
Oid dboid;
Oid datdba;
ListCell *option;
@@ -492,7 +492,7 @@ createdb(const CreatedbStmt *stmt)
/* Form tuple */
MemSet(new_record, 0, sizeof(new_record));
MemSet(new_record_nulls, ' ', sizeof(new_record_nulls));
MemSet(new_record_nulls, false, sizeof(new_record_nulls));
new_record[Anum_pg_database_datname - 1] =
DirectFunctionCall1(namein, CStringGetDatum(dbname));
@@ -515,10 +515,10 @@ createdb(const CreatedbStmt *stmt)
* a bad idea when the owner is not the same as the template's owner. It's
* more debatable whether datconfig should be copied.
*/
new_record_nulls[Anum_pg_database_datconfig - 1] = 'n';
new_record_nulls[Anum_pg_database_datacl - 1] = 'n';
new_record_nulls[Anum_pg_database_datconfig - 1] = true;
new_record_nulls[Anum_pg_database_datacl - 1] = true;
tuple = heap_formtuple(RelationGetDescr(pg_database_rel),
tuple = heap_form_tuple(RelationGetDescr(pg_database_rel),
new_record, new_record_nulls);
HeapTupleSetOid(tuple, dboid);
@@ -949,8 +949,8 @@ AlterDatabase(AlterDatabaseStmt *stmt)
int connlimit = -1;
DefElem *dconnlimit = NULL;
Datum new_record[Natts_pg_database];
char new_record_nulls[Natts_pg_database];
char new_record_repl[Natts_pg_database];
bool new_record_nulls[Natts_pg_database];
bool new_record_repl[Natts_pg_database];
/* Extract options from the statement node tree */
foreach(option, stmt->options)
@@ -999,16 +999,16 @@ AlterDatabase(AlterDatabaseStmt *stmt)
* Build an updated tuple, perusing the information just obtained
*/
MemSet(new_record, 0, sizeof(new_record));
MemSet(new_record_nulls, ' ', sizeof(new_record_nulls));
MemSet(new_record_repl, ' ', sizeof(new_record_repl));
MemSet(new_record_nulls, false, sizeof(new_record_nulls));
MemSet(new_record_repl, false, sizeof(new_record_repl));
if (dconnlimit)
{
new_record[Anum_pg_database_datconnlimit - 1] = Int32GetDatum(connlimit);
new_record_repl[Anum_pg_database_datconnlimit - 1] = 'r';
new_record_repl[Anum_pg_database_datconnlimit - 1] = true;
}
newtuple = heap_modifytuple(tuple, RelationGetDescr(rel), new_record,
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), new_record,
new_record_nulls, new_record_repl);
simple_heap_update(rel, &tuple->t_self, newtuple);
@@ -1040,8 +1040,8 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
ScanKeyData scankey;
SysScanDesc scan;
Datum repl_val[Natts_pg_database];
char repl_null[Natts_pg_database];
char repl_repl[Natts_pg_database];
bool repl_null[Natts_pg_database];
bool repl_repl[Natts_pg_database];
valuestr = ExtractSetVariableArgs(stmt->setstmt);
@@ -1067,13 +1067,13 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_DATABASE,
stmt->dbname);
memset(repl_repl, ' ', sizeof(repl_repl));
repl_repl[Anum_pg_database_datconfig - 1] = 'r';
memset(repl_repl, false, sizeof(repl_repl));
repl_repl[Anum_pg_database_datconfig - 1] = true;
if (stmt->setstmt->kind == VAR_RESET_ALL)
{
/* RESET ALL, so just set datconfig to null */
repl_null[Anum_pg_database_datconfig - 1] = 'n';
repl_null[Anum_pg_database_datconfig - 1] = true;
repl_val[Anum_pg_database_datconfig - 1] = (Datum) 0;
}
else
@@ -1082,7 +1082,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
bool isnull;
ArrayType *a;
repl_null[Anum_pg_database_datconfig - 1] = ' ';
repl_null[Anum_pg_database_datconfig - 1] = false;
/* Extract old value of datconfig */
datum = heap_getattr(tuple, Anum_pg_database_datconfig,
@@ -1098,10 +1098,10 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
if (a)
repl_val[Anum_pg_database_datconfig - 1] = PointerGetDatum(a);
else
repl_null[Anum_pg_database_datconfig - 1] = 'n';
repl_null[Anum_pg_database_datconfig - 1] = true;
}
newtuple = heap_modifytuple(tuple, RelationGetDescr(rel),
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tuple->t_self, newtuple);
@@ -1160,8 +1160,8 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId)
if (datForm->datdba != newOwnerId)
{
Datum repl_val[Natts_pg_database];
char repl_null[Natts_pg_database];
char repl_repl[Natts_pg_database];
bool repl_null[Natts_pg_database];
bool repl_repl[Natts_pg_database];
Acl *newAcl;
Datum aclDatum;
bool isNull;
@@ -1189,10 +1189,10 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId)
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to change owner of database")));
memset(repl_null, ' ', sizeof(repl_null));
memset(repl_repl, ' ', sizeof(repl_repl));
memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_repl));
repl_repl[Anum_pg_database_datdba - 1] = 'r';
repl_repl[Anum_pg_database_datdba - 1] = true;
repl_val[Anum_pg_database_datdba - 1] = ObjectIdGetDatum(newOwnerId);
/*
@@ -1207,11 +1207,11 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId)
{
newAcl = aclnewowner(DatumGetAclP(aclDatum),
datForm->datdba, newOwnerId);
repl_repl[Anum_pg_database_datacl - 1] = 'r';
repl_repl[Anum_pg_database_datacl - 1] = true;
repl_val[Anum_pg_database_datacl - 1] = PointerGetDatum(newAcl);
}
newtuple = heap_modifytuple(tuple, RelationGetDescr(rel), repl_val, repl_null, repl_repl);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);

View File

@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.100 2008/10/31 08:39:20 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.101 2008/11/02 01:45:27 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -1104,8 +1104,8 @@ AlterFunctionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
if (procForm->proowner != newOwnerId)
{
Datum repl_val[Natts_pg_proc];
char repl_null[Natts_pg_proc];
char repl_repl[Natts_pg_proc];
bool repl_null[Natts_pg_proc];
bool repl_repl[Natts_pg_proc];
Acl *newAcl;
Datum aclDatum;
bool isNull;
@@ -1131,10 +1131,10 @@ AlterFunctionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
get_namespace_name(procForm->pronamespace));
}
memset(repl_null, ' ', sizeof(repl_null));
memset(repl_repl, ' ', sizeof(repl_repl));
memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_repl));
repl_repl[Anum_pg_proc_proowner - 1] = 'r';
repl_repl[Anum_pg_proc_proowner - 1] = true;
repl_val[Anum_pg_proc_proowner - 1] = ObjectIdGetDatum(newOwnerId);
/*
@@ -1148,11 +1148,11 @@ AlterFunctionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
{
newAcl = aclnewowner(DatumGetAclP(aclDatum),
procForm->proowner, newOwnerId);
repl_repl[Anum_pg_proc_proacl - 1] = 'r';
repl_repl[Anum_pg_proc_proacl - 1] = true;
repl_val[Anum_pg_proc_proacl - 1] = PointerGetDatum(newAcl);
}
newtuple = heap_modifytuple(tup, RelationGetDescr(rel), repl_val,
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val,
repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);
@@ -1259,8 +1259,8 @@ AlterFunction(AlterFunctionStmt *stmt)
bool isnull;
ArrayType *a;
Datum repl_val[Natts_pg_proc];
char repl_null[Natts_pg_proc];
char repl_repl[Natts_pg_proc];
bool repl_null[Natts_pg_proc];
bool repl_repl[Natts_pg_proc];
/* extract existing proconfig setting */
datum = SysCacheGetAttr(PROCOID, tup, Anum_pg_proc_proconfig, &isnull);
@@ -1270,21 +1270,21 @@ AlterFunction(AlterFunctionStmt *stmt)
a = update_proconfig_value(a, set_items);
/* update the tuple */
memset(repl_repl, ' ', sizeof(repl_repl));
repl_repl[Anum_pg_proc_proconfig - 1] = 'r';
memset(repl_repl, false, sizeof(repl_repl));
repl_repl[Anum_pg_proc_proconfig - 1] = true;
if (a == NULL)
{
repl_val[Anum_pg_proc_proconfig - 1] = (Datum) 0;
repl_null[Anum_pg_proc_proconfig - 1] = 'n';
repl_null[Anum_pg_proc_proconfig - 1] = true;
}
else
{
repl_val[Anum_pg_proc_proconfig - 1] = PointerGetDatum(a);
repl_null[Anum_pg_proc_proconfig - 1] = ' ';
repl_null[Anum_pg_proc_proconfig - 1] = false;
}
tup = heap_modifytuple(tup, RelationGetDescr(rel),
tup = heap_modify_tuple(tup, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
}
@@ -1387,7 +1387,7 @@ CreateCast(CreateCastStmt *stmt)
Relation relation;
HeapTuple tuple;
Datum values[Natts_pg_cast];
char nulls[Natts_pg_cast];
bool nulls[Natts_pg_cast];
ObjectAddress myself,
referenced;
@@ -1575,9 +1575,9 @@ CreateCast(CreateCastStmt *stmt)
values[Anum_pg_cast_castcontext - 1] = CharGetDatum(castcontext);
values[Anum_pg_cast_castmethod - 1] = CharGetDatum(castmethod);
MemSet(nulls, ' ', Natts_pg_cast);
MemSet(nulls, false, sizeof(nulls));
tuple = heap_formtuple(RelationGetDescr(relation), values, nulls);
tuple = heap_form_tuple(RelationGetDescr(relation), values, nulls);
simple_heap_insert(relation, tuple);

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.62 2008/06/19 00:46:04 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.63 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -176,7 +176,7 @@ CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
Relation rel;
HeapTuple tup;
Datum values[Natts_pg_opfamily];
char nulls[Natts_pg_opfamily];
bool nulls[Natts_pg_opfamily];
NameData opfName;
ObjectAddress myself,
referenced;
@@ -201,7 +201,7 @@ CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
* Okay, let's create the pg_opfamily entry.
*/
memset(values, 0, sizeof(values));
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
values[Anum_pg_opfamily_opfmethod - 1] = ObjectIdGetDatum(amoid);
namestrcpy(&opfName, opfname);
@@ -209,7 +209,7 @@ CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
values[Anum_pg_opfamily_opfnamespace - 1] = ObjectIdGetDatum(namespaceoid);
values[Anum_pg_opfamily_opfowner - 1] = ObjectIdGetDatum(GetUserId());
tup = heap_formtuple(rel->rd_att, values, nulls);
tup = heap_form_tuple(rel->rd_att, values, nulls);
opfamilyoid = simple_heap_insert(rel, tup);
@@ -264,7 +264,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
HeapTuple tup;
Form_pg_am pg_am;
Datum values[Natts_pg_opclass];
char nulls[Natts_pg_opclass];
bool nulls[Natts_pg_opclass];
AclResult aclresult;
NameData opcName;
ObjectAddress myself,
@@ -570,7 +570,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
* Okay, let's create the pg_opclass entry.
*/
memset(values, 0, sizeof(values));
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
values[Anum_pg_opclass_opcmethod - 1] = ObjectIdGetDatum(amoid);
namestrcpy(&opcName, opcname);
@@ -582,7 +582,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
values[Anum_pg_opclass_opcdefault - 1] = BoolGetDatum(stmt->isDefault);
values[Anum_pg_opclass_opckeytype - 1] = ObjectIdGetDatum(storageoid);
tup = heap_formtuple(rel->rd_att, values, nulls);
tup = heap_form_tuple(rel->rd_att, values, nulls);
opclassoid = simple_heap_insert(rel, tup);
@@ -656,7 +656,7 @@ DefineOpFamily(CreateOpFamilyStmt *stmt)
Relation rel;
HeapTuple tup;
Datum values[Natts_pg_opfamily];
char nulls[Natts_pg_opfamily];
bool nulls[Natts_pg_opfamily];
AclResult aclresult;
NameData opfName;
ObjectAddress myself,
@@ -719,7 +719,7 @@ DefineOpFamily(CreateOpFamilyStmt *stmt)
* Okay, let's create the pg_opfamily entry.
*/
memset(values, 0, sizeof(values));
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
values[Anum_pg_opfamily_opfmethod - 1] = ObjectIdGetDatum(amoid);
namestrcpy(&opfName, opfname);
@@ -727,7 +727,7 @@ DefineOpFamily(CreateOpFamilyStmt *stmt)
values[Anum_pg_opfamily_opfnamespace - 1] = ObjectIdGetDatum(namespaceoid);
values[Anum_pg_opfamily_opfowner - 1] = ObjectIdGetDatum(GetUserId());
tup = heap_formtuple(rel->rd_att, values, nulls);
tup = heap_form_tuple(rel->rd_att, values, nulls);
opfamilyoid = simple_heap_insert(rel, tup);
@@ -1226,7 +1226,7 @@ storeOperators(List *opfamilyname, Oid amoid,
{
Relation rel;
Datum values[Natts_pg_amop];
char nulls[Natts_pg_amop];
bool nulls[Natts_pg_amop];
HeapTuple tup;
Oid entryoid;
ObjectAddress myself,
@@ -1259,7 +1259,7 @@ storeOperators(List *opfamilyname, Oid amoid,
/* Create the pg_amop entry */
memset(values, 0, sizeof(values));
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
values[Anum_pg_amop_amopfamily - 1] = ObjectIdGetDatum(opfamilyoid);
values[Anum_pg_amop_amoplefttype - 1] = ObjectIdGetDatum(op->lefttype);
@@ -1268,7 +1268,7 @@ storeOperators(List *opfamilyname, Oid amoid,
values[Anum_pg_amop_amopopr - 1] = ObjectIdGetDatum(op->object);
values[Anum_pg_amop_amopmethod - 1] = ObjectIdGetDatum(amoid);
tup = heap_formtuple(rel->rd_att, values, nulls);
tup = heap_form_tuple(rel->rd_att, values, nulls);
entryoid = simple_heap_insert(rel, tup);
@@ -1326,7 +1326,7 @@ storeProcedures(List *opfamilyname, Oid amoid,
{
Relation rel;
Datum values[Natts_pg_amproc];
char nulls[Natts_pg_amproc];
bool nulls[Natts_pg_amproc];
HeapTuple tup;
Oid entryoid;
ObjectAddress myself,
@@ -1359,7 +1359,7 @@ storeProcedures(List *opfamilyname, Oid amoid,
/* Create the pg_amproc entry */
memset(values, 0, sizeof(values));
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
values[Anum_pg_amproc_amprocfamily - 1] = ObjectIdGetDatum(opfamilyoid);
values[Anum_pg_amproc_amproclefttype - 1] = ObjectIdGetDatum(proc->lefttype);
@@ -1367,7 +1367,7 @@ storeProcedures(List *opfamilyname, Oid amoid,
values[Anum_pg_amproc_amprocnum - 1] = Int16GetDatum(proc->number);
values[Anum_pg_amproc_amproc - 1] = ObjectIdGetDatum(proc->object);
tup = heap_formtuple(rel->rd_att, values, nulls);
tup = heap_form_tuple(rel->rd_att, values, nulls);
entryoid = simple_heap_insert(rel, tup);

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.79 2008/06/19 00:46:04 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.80 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -268,7 +268,7 @@ create_proc_lang(const char *languageName,
Relation rel;
TupleDesc tupDesc;
Datum values[Natts_pg_language];
char nulls[Natts_pg_language];
bool nulls[Natts_pg_language];
NameData langname;
HeapTuple tup;
ObjectAddress myself,
@@ -281,7 +281,7 @@ create_proc_lang(const char *languageName,
tupDesc = rel->rd_att;
memset(values, 0, sizeof(values));
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
namestrcpy(&langname, languageName);
values[Anum_pg_language_lanname - 1] = NameGetDatum(&langname);
@@ -290,9 +290,9 @@ create_proc_lang(const char *languageName,
values[Anum_pg_language_lanpltrusted - 1] = BoolGetDatum(trusted);
values[Anum_pg_language_lanplcallfoid - 1] = ObjectIdGetDatum(handlerOid);
values[Anum_pg_language_lanvalidator - 1] = ObjectIdGetDatum(valOid);
nulls[Anum_pg_language_lanacl - 1] = 'n';
nulls[Anum_pg_language_lanacl - 1] = true;
tup = heap_formtuple(tupDesc, values, nulls);
tup = heap_form_tuple(tupDesc, values, nulls);
simple_heap_insert(rel, tup);
@@ -594,8 +594,8 @@ AlterLanguageOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId)
if (lanForm->lanowner != newOwnerId)
{
Datum repl_val[Natts_pg_language];
char repl_null[Natts_pg_language];
char repl_repl[Natts_pg_language];
bool repl_null[Natts_pg_language];
bool repl_repl[Natts_pg_language];
Acl *newAcl;
Datum aclDatum;
bool isNull;
@@ -609,10 +609,10 @@ AlterLanguageOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId)
/* Must be able to become new owner */
check_is_member_of_role(GetUserId(), newOwnerId);
memset(repl_null, ' ', sizeof(repl_null));
memset(repl_repl, ' ', sizeof(repl_repl));
memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_repl));
repl_repl[Anum_pg_language_lanowner - 1] = 'r';
repl_repl[Anum_pg_language_lanowner - 1] = true;
repl_val[Anum_pg_language_lanowner - 1] = ObjectIdGetDatum(newOwnerId);
/*
@@ -626,11 +626,11 @@ AlterLanguageOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId)
{
newAcl = aclnewowner(DatumGetAclP(aclDatum),
lanForm->lanowner, newOwnerId);
repl_repl[Anum_pg_language_lanacl - 1] = 'r';
repl_repl[Anum_pg_language_lanacl - 1] = true;
repl_val[Anum_pg_language_lanacl - 1] = PointerGetDatum(newAcl);
}
newtuple = heap_modifytuple(tup, RelationGetDescr(rel),
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.50 2008/06/14 18:04:33 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.51 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -366,8 +366,8 @@ AlterSchemaOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId)
if (nspForm->nspowner != newOwnerId)
{
Datum repl_val[Natts_pg_namespace];
char repl_null[Natts_pg_namespace];
char repl_repl[Natts_pg_namespace];
bool repl_null[Natts_pg_namespace];
bool repl_repl[Natts_pg_namespace];
Acl *newAcl;
Datum aclDatum;
bool isNull;
@@ -397,10 +397,10 @@ AlterSchemaOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId)
aclcheck_error(aclresult, ACL_KIND_DATABASE,
get_database_name(MyDatabaseId));
memset(repl_null, ' ', sizeof(repl_null));
memset(repl_repl, ' ', sizeof(repl_repl));
memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_repl));
repl_repl[Anum_pg_namespace_nspowner - 1] = 'r';
repl_repl[Anum_pg_namespace_nspowner - 1] = true;
repl_val[Anum_pg_namespace_nspowner - 1] = ObjectIdGetDatum(newOwnerId);
/*
@@ -414,11 +414,11 @@ AlterSchemaOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId)
{
newAcl = aclnewowner(DatumGetAclP(aclDatum),
nspForm->nspowner, newOwnerId);
repl_repl[Anum_pg_namespace_nspacl - 1] = 'r';
repl_repl[Anum_pg_namespace_nspacl - 1] = true;
repl_val[Anum_pg_namespace_nspacl - 1] = PointerGetDatum(newAcl);
}
newtuple = heap_modifytuple(tup, RelationGetDescr(rel), repl_val, repl_null, repl_repl);
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.154 2008/07/13 20:45:47 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.155 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -114,7 +114,7 @@ DefineSequence(CreateSeqStmt *seq)
HeapTuple tuple;
TupleDesc tupDesc;
Datum value[SEQ_COL_LASTCOL];
char null[SEQ_COL_LASTCOL];
bool null[SEQ_COL_LASTCOL];
int i;
NameData name;
@@ -136,7 +136,7 @@ DefineSequence(CreateSeqStmt *seq)
coldef->cooked_default = NULL;
coldef->constraints = NIL;
null[i - 1] = ' ';
null[i - 1] = false;
switch (i)
{
@@ -222,7 +222,7 @@ DefineSequence(CreateSeqStmt *seq)
rel->rd_targblock = 0;
/* Now form & insert sequence tuple */
tuple = heap_formtuple(tupDesc, value, null);
tuple = heap_form_tuple(tupDesc, value, null);
simple_heap_insert(rel, tuple);
Assert(ItemPointerGetOffsetNumber(&(tuple->t_self)) == FirstOffsetNumber);
@@ -249,7 +249,7 @@ DefineSequence(CreateSeqStmt *seq)
{
/*
* Note that the "tuple" structure is still just a local tuple record
* created by heap_formtuple; its t_data pointer doesn't point at the
* created by heap_form_tuple; its t_data pointer doesn't point at the
* disk buffer. To scribble on the disk buffer we need to fetch the
* item pointer. But do the same to the local tuple, since that will
* be the source for the WAL log record, below.

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.268 2008/10/21 10:38:51 petere Exp $
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.269 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1670,7 +1670,7 @@ StoreCatalogInheritance1(Oid relationId, Oid parentOid,
{
TupleDesc desc = RelationGetDescr(inhRelation);
Datum datum[Natts_pg_inherits];
char nullarr[Natts_pg_inherits];
bool nullarr[Natts_pg_inherits];
ObjectAddress childobject,
parentobject;
HeapTuple tuple;
@@ -1682,11 +1682,11 @@ StoreCatalogInheritance1(Oid relationId, Oid parentOid,
datum[1] = ObjectIdGetDatum(parentOid); /* inhparent */
datum[2] = Int16GetDatum(seqNumber); /* inhseqno */
nullarr[0] = ' ';
nullarr[1] = ' ';
nullarr[2] = ' ';
nullarr[0] = false;
nullarr[1] = false;
nullarr[2] = false;
tuple = heap_formtuple(desc, datum, nullarr);
tuple = heap_form_tuple(desc, datum, nullarr);
simple_heap_insert(inhRelation, tuple);
@@ -6142,8 +6142,8 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing)
if (tuple_class->relowner != newOwnerId)
{
Datum repl_val[Natts_pg_class];
char repl_null[Natts_pg_class];
char repl_repl[Natts_pg_class];
bool repl_null[Natts_pg_class];
bool repl_repl[Natts_pg_class];
Acl *newAcl;
Datum aclDatum;
bool isNull;
@@ -6175,10 +6175,10 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing)
}
}
memset(repl_null, ' ', sizeof(repl_null));
memset(repl_repl, ' ', sizeof(repl_repl));
memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_repl));
repl_repl[Anum_pg_class_relowner - 1] = 'r';
repl_repl[Anum_pg_class_relowner - 1] = true;
repl_val[Anum_pg_class_relowner - 1] = ObjectIdGetDatum(newOwnerId);
/*
@@ -6192,11 +6192,11 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing)
{
newAcl = aclnewowner(DatumGetAclP(aclDatum),
tuple_class->relowner, newOwnerId);
repl_repl[Anum_pg_class_relacl - 1] = 'r';
repl_repl[Anum_pg_class_relacl - 1] = true;
repl_val[Anum_pg_class_relacl - 1] = PointerGetDatum(newAcl);
}
newtuple = heap_modifytuple(tuple, RelationGetDescr(class_rel), repl_val, repl_null, repl_repl);
newtuple = heap_modify_tuple(tuple, RelationGetDescr(class_rel), repl_val, repl_null, repl_repl);
simple_heap_update(class_rel, &newtuple->t_self, newtuple);
CatalogUpdateIndexes(class_rel, newtuple);
@@ -6408,8 +6408,8 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
bool isnull;
Datum newOptions;
Datum repl_val[Natts_pg_class];
char repl_null[Natts_pg_class];
char repl_repl[Natts_pg_class];
bool repl_null[Natts_pg_class];
bool repl_repl[Natts_pg_class];
if (defList == NIL)
return; /* nothing to do */
@@ -6453,17 +6453,17 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
* propagated into relcaches during post-commit cache inval.
*/
memset(repl_val, 0, sizeof(repl_val));
memset(repl_null, ' ', sizeof(repl_null));
memset(repl_repl, ' ', sizeof(repl_repl));
memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_repl));
if (newOptions != (Datum) 0)
repl_val[Anum_pg_class_reloptions - 1] = newOptions;
else
repl_null[Anum_pg_class_reloptions - 1] = 'n';
repl_null[Anum_pg_class_reloptions - 1] = true;
repl_repl[Anum_pg_class_reloptions - 1] = 'r';
repl_repl[Anum_pg_class_reloptions - 1] = true;
newtuple = heap_modifytuple(tuple, RelationGetDescr(pgclass),
newtuple = heap_modify_tuple(tuple, RelationGetDescr(pgclass),
repl_val, repl_null, repl_repl);
simple_heap_update(pgclass, &newtuple->t_self, newtuple);

View File

@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.57 2008/06/19 00:46:04 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.58 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -197,7 +197,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
#ifdef HAVE_SYMLINK
Relation rel;
Datum values[Natts_pg_tablespace];
char nulls[Natts_pg_tablespace];
bool nulls[Natts_pg_tablespace];
HeapTuple tuple;
Oid tablespaceoid;
char *location;
@@ -278,7 +278,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
*/
rel = heap_open(TableSpaceRelationId, RowExclusiveLock);
MemSet(nulls, ' ', Natts_pg_tablespace);
MemSet(nulls, false, sizeof(nulls));
values[Anum_pg_tablespace_spcname - 1] =
DirectFunctionCall1(namein, CStringGetDatum(stmt->tablespacename));
@@ -286,9 +286,9 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
ObjectIdGetDatum(ownerId);
values[Anum_pg_tablespace_spclocation - 1] =
CStringGetTextDatum(location);
nulls[Anum_pg_tablespace_spcacl - 1] = 'n';
nulls[Anum_pg_tablespace_spcacl - 1] = true;
tuple = heap_formtuple(rel->rd_att, values, nulls);
tuple = heap_form_tuple(rel->rd_att, values, nulls);
tablespaceoid = simple_heap_insert(rel, tuple);
@@ -845,8 +845,8 @@ AlterTableSpaceOwner(const char *name, Oid newOwnerId)
if (spcForm->spcowner != newOwnerId)
{
Datum repl_val[Natts_pg_tablespace];
char repl_null[Natts_pg_tablespace];
char repl_repl[Natts_pg_tablespace];
bool repl_null[Natts_pg_tablespace];
bool repl_repl[Natts_pg_tablespace];
Acl *newAcl;
Datum aclDatum;
bool isNull;
@@ -870,10 +870,10 @@ AlterTableSpaceOwner(const char *name, Oid newOwnerId)
* anyway.
*/
memset(repl_null, ' ', sizeof(repl_null));
memset(repl_repl, ' ', sizeof(repl_repl));
memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_repl));
repl_repl[Anum_pg_tablespace_spcowner - 1] = 'r';
repl_repl[Anum_pg_tablespace_spcowner - 1] = true;
repl_val[Anum_pg_tablespace_spcowner - 1] = ObjectIdGetDatum(newOwnerId);
/*
@@ -888,11 +888,11 @@ AlterTableSpaceOwner(const char *name, Oid newOwnerId)
{
newAcl = aclnewowner(DatumGetAclP(aclDatum),
spcForm->spcowner, newOwnerId);
repl_repl[Anum_pg_tablespace_spcacl - 1] = 'r';
repl_repl[Anum_pg_tablespace_spcacl - 1] = true;
repl_val[Anum_pg_tablespace_spcacl - 1] = PointerGetDatum(newAcl);
}
newtuple = heap_modifytuple(tup, RelationGetDescr(rel), repl_val, repl_null, repl_repl);
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.238 2008/10/24 23:42:35 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.239 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -83,7 +83,7 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid)
int16 tgtype;
int2vector *tgattr;
Datum values[Natts_pg_trigger];
char nulls[Natts_pg_trigger];
bool nulls[Natts_pg_trigger];
Relation rel;
AclResult aclresult;
Relation tgrel;
@@ -310,7 +310,7 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid)
/*
* Build the new pg_trigger tuple.
*/
memset(nulls, ' ', Natts_pg_trigger * sizeof(char));
memset(nulls, false, sizeof(nulls));
values[Anum_pg_trigger_tgrelid - 1] = ObjectIdGetDatum(RelationGetRelid(rel));
values[Anum_pg_trigger_tgname - 1] = DirectFunctionCall1(namein,
@@ -374,7 +374,7 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid)
tgattr = buildint2vector(NULL, 0);
values[Anum_pg_trigger_tgattr - 1] = PointerGetDatum(tgattr);
tuple = heap_formtuple(tgrel->rd_att, values, nulls);
tuple = heap_form_tuple(tgrel->rd_att, values, nulls);
/* force tuple to have the desired OID */
HeapTupleSetOid(tuple, trigoid);

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.13 2008/06/19 00:46:04 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.14 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -167,7 +167,7 @@ DefineTSParser(List *names, List *parameters)
Relation prsRel;
HeapTuple tup;
Datum values[Natts_pg_ts_parser];
char nulls[Natts_pg_ts_parser];
bool nulls[Natts_pg_ts_parser];
NameData pname;
Oid prsOid;
Oid namespaceoid;
@@ -182,7 +182,7 @@ DefineTSParser(List *names, List *parameters)
/* initialize tuple fields with name/namespace */
memset(values, 0, sizeof(values));
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
namestrcpy(&pname, prsname);
values[Anum_pg_ts_parser_prsname - 1] = NameGetDatum(&pname);
@@ -255,7 +255,7 @@ DefineTSParser(List *names, List *parameters)
*/
prsRel = heap_open(TSParserRelationId, RowExclusiveLock);
tup = heap_formtuple(prsRel->rd_att, values, nulls);
tup = heap_form_tuple(prsRel->rd_att, values, nulls);
prsOid = simple_heap_insert(prsRel, tup);
@@ -497,7 +497,7 @@ DefineTSDictionary(List *names, List *parameters)
Relation dictRel;
HeapTuple tup;
Datum values[Natts_pg_ts_dict];
char nulls[Natts_pg_ts_dict];
bool nulls[Natts_pg_ts_dict];
NameData dname;
Oid templId = InvalidOid;
List *dictoptions = NIL;
@@ -547,7 +547,7 @@ DefineTSDictionary(List *names, List *parameters)
* Looks good, insert
*/
memset(values, 0, sizeof(values));
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
namestrcpy(&dname, dictname);
values[Anum_pg_ts_dict_dictname - 1] = NameGetDatum(&dname);
@@ -558,11 +558,11 @@ DefineTSDictionary(List *names, List *parameters)
values[Anum_pg_ts_dict_dictinitoption - 1] =
PointerGetDatum(serialize_deflist(dictoptions));
else
nulls[Anum_pg_ts_dict_dictinitoption - 1] = 'n';
nulls[Anum_pg_ts_dict_dictinitoption - 1] = true;
dictRel = heap_open(TSDictionaryRelationId, RowExclusiveLock);
tup = heap_formtuple(dictRel->rd_att, values, nulls);
tup = heap_form_tuple(dictRel->rd_att, values, nulls);
dictOid = simple_heap_insert(dictRel, tup);
@@ -742,8 +742,8 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
Datum opt;
bool isnull;
Datum repl_val[Natts_pg_ts_dict];
char repl_null[Natts_pg_ts_dict];
char repl_repl[Natts_pg_ts_dict];
bool repl_null[Natts_pg_ts_dict];
bool repl_repl[Natts_pg_ts_dict];
dictId = TSDictionaryGetDictid(stmt->dictname, false);
@@ -813,17 +813,17 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
* Looks good, update
*/
memset(repl_val, 0, sizeof(repl_val));
memset(repl_null, ' ', sizeof(repl_null));
memset(repl_repl, ' ', sizeof(repl_repl));
memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_repl));
if (dictoptions)
repl_val[Anum_pg_ts_dict_dictinitoption - 1] =
PointerGetDatum(serialize_deflist(dictoptions));
else
repl_null[Anum_pg_ts_dict_dictinitoption - 1] = 'n';
repl_repl[Anum_pg_ts_dict_dictinitoption - 1] = 'r';
repl_null[Anum_pg_ts_dict_dictinitoption - 1] = true;
repl_repl[Anum_pg_ts_dict_dictinitoption - 1] = true;
newtup = heap_modifytuple(tup, RelationGetDescr(rel),
newtup = heap_modify_tuple(tup, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtup->t_self, newtup);
@@ -995,7 +995,7 @@ DefineTSTemplate(List *names, List *parameters)
Relation tmplRel;
HeapTuple tup;
Datum values[Natts_pg_ts_template];
char nulls[Natts_pg_ts_template];
bool nulls[Natts_pg_ts_template];
NameData dname;
int i;
Oid dictOid;
@@ -1012,7 +1012,7 @@ DefineTSTemplate(List *names, List *parameters)
for (i = 0; i < Natts_pg_ts_template; i++)
{
nulls[i] = ' ';
nulls[i] = false;
values[i] = ObjectIdGetDatum(InvalidOid);
}
@@ -1031,13 +1031,13 @@ DefineTSTemplate(List *names, List *parameters)
{
values[Anum_pg_ts_template_tmplinit - 1] =
get_ts_template_func(defel, Anum_pg_ts_template_tmplinit);
nulls[Anum_pg_ts_template_tmplinit - 1] = ' ';
nulls[Anum_pg_ts_template_tmplinit - 1] = false;
}
else if (pg_strcasecmp(defel->defname, "lexize") == 0)
{
values[Anum_pg_ts_template_tmpllexize - 1] =
get_ts_template_func(defel, Anum_pg_ts_template_tmpllexize);
nulls[Anum_pg_ts_template_tmpllexize - 1] = ' ';
nulls[Anum_pg_ts_template_tmpllexize - 1] = false;
}
else
ereport(ERROR,
@@ -1060,7 +1060,7 @@ DefineTSTemplate(List *names, List *parameters)
tmplRel = heap_open(TSTemplateRelationId, RowExclusiveLock);
tup = heap_formtuple(tmplRel->rd_att, values, nulls);
tup = heap_form_tuple(tmplRel->rd_att, values, nulls);
dictOid = simple_heap_insert(tmplRel, tup);
@@ -1327,7 +1327,7 @@ DefineTSConfiguration(List *names, List *parameters)
Relation mapRel = NULL;
HeapTuple tup;
Datum values[Natts_pg_ts_config];
char nulls[Natts_pg_ts_config];
bool nulls[Natts_pg_ts_config];
AclResult aclresult;
Oid namespaceoid;
char *cfgname;
@@ -1403,7 +1403,7 @@ DefineTSConfiguration(List *names, List *parameters)
* Looks good, build tuple and insert
*/
memset(values, 0, sizeof(values));
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
namestrcpy(&cname, cfgname);
values[Anum_pg_ts_config_cfgname - 1] = NameGetDatum(&cname);
@@ -1413,7 +1413,7 @@ DefineTSConfiguration(List *names, List *parameters)
cfgRel = heap_open(TSConfigRelationId, RowExclusiveLock);
tup = heap_formtuple(cfgRel->rd_att, values, nulls);
tup = heap_form_tuple(cfgRel->rd_att, values, nulls);
cfgOid = simple_heap_insert(cfgRel, tup);
@@ -1443,17 +1443,17 @@ DefineTSConfiguration(List *names, List *parameters)
Form_pg_ts_config_map cfgmap = (Form_pg_ts_config_map) GETSTRUCT(maptup);
HeapTuple newmaptup;
Datum mapvalues[Natts_pg_ts_config_map];
char mapnulls[Natts_pg_ts_config_map];
bool mapnulls[Natts_pg_ts_config_map];
memset(mapvalues, 0, sizeof(mapvalues));
memset(mapnulls, ' ', sizeof(mapnulls));
memset(mapnulls, false, sizeof(mapnulls));
mapvalues[Anum_pg_ts_config_map_mapcfg - 1] = cfgOid;
mapvalues[Anum_pg_ts_config_map_maptokentype - 1] = cfgmap->maptokentype;
mapvalues[Anum_pg_ts_config_map_mapseqno - 1] = cfgmap->mapseqno;
mapvalues[Anum_pg_ts_config_map_mapdict - 1] = cfgmap->mapdict;
newmaptup = heap_formtuple(mapRel->rd_att, mapvalues, mapnulls);
newmaptup = heap_form_tuple(mapRel->rd_att, mapvalues, mapnulls);
simple_heap_insert(mapRel, newmaptup);
@@ -1911,18 +1911,18 @@ MakeConfigurationMapping(AlterTSConfigurationStmt *stmt,
if (cfgmap->mapdict == dictOld)
{
Datum repl_val[Natts_pg_ts_config_map];
char repl_null[Natts_pg_ts_config_map];
char repl_repl[Natts_pg_ts_config_map];
bool repl_null[Natts_pg_ts_config_map];
bool repl_repl[Natts_pg_ts_config_map];
HeapTuple newtup;
memset(repl_val, 0, sizeof(repl_val));
memset(repl_null, ' ', sizeof(repl_null));
memset(repl_repl, ' ', sizeof(repl_repl));
memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_repl));
repl_val[Anum_pg_ts_config_map_mapdict - 1] = ObjectIdGetDatum(dictNew);
repl_repl[Anum_pg_ts_config_map_mapdict - 1] = 'r';
repl_repl[Anum_pg_ts_config_map_mapdict - 1] = true;
newtup = heap_modifytuple(maptup,
newtup = heap_modify_tuple(maptup,
RelationGetDescr(relMap),
repl_val, repl_null, repl_repl);
simple_heap_update(relMap, &newtup->t_self, newtup);
@@ -1943,15 +1943,15 @@ MakeConfigurationMapping(AlterTSConfigurationStmt *stmt,
for (j = 0; j < ndict; j++)
{
Datum values[Natts_pg_ts_config_map];
char nulls[Natts_pg_ts_config_map];
bool nulls[Natts_pg_ts_config_map];
memset(nulls, ' ', sizeof(nulls));
memset(nulls, false, sizeof(nulls));
values[Anum_pg_ts_config_map_mapcfg - 1] = ObjectIdGetDatum(cfgId);
values[Anum_pg_ts_config_map_maptokentype - 1] = Int32GetDatum(tokens[i]);
values[Anum_pg_ts_config_map_mapseqno - 1] = Int32GetDatum(j + 1);
values[Anum_pg_ts_config_map_mapdict - 1] = ObjectIdGetDatum(dictIds[j]);
tup = heap_formtuple(relMap->rd_att, values, nulls);
tup = heap_form_tuple(relMap->rd_att, values, nulls);
simple_heap_insert(relMap, tup);
CatalogUpdateIndexes(relMap, tup);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.125 2008/10/21 10:38:51 petere Exp $
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.126 2008/11/02 01:45:28 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -1436,8 +1436,8 @@ AlterDomainDefault(List *names, Node *defaultRaw)
char *defaultValue;
Node *defaultExpr = NULL; /* NULL if no default specified */
Datum new_record[Natts_pg_type];
char new_record_nulls[Natts_pg_type];
char new_record_repl[Natts_pg_type];
bool new_record_nulls[Natts_pg_type];
bool new_record_repl[Natts_pg_type];
HeapTuple newtuple;
Form_pg_type typTup;
@@ -1460,8 +1460,8 @@ AlterDomainDefault(List *names, Node *defaultRaw)
/* Setup new tuple */
MemSet(new_record, (Datum) 0, sizeof(new_record));
MemSet(new_record_nulls, ' ', sizeof(new_record_nulls));
MemSet(new_record_repl, ' ', sizeof(new_record_repl));
MemSet(new_record_nulls, false, sizeof(new_record_nulls));
MemSet(new_record_repl, false, sizeof(new_record_repl));
/* Store the new default into the tuple */
if (defaultRaw)
@@ -1487,10 +1487,10 @@ AlterDomainDefault(List *names, Node *defaultRaw)
(IsA(defaultExpr, Const) &&((Const *) defaultExpr)->constisnull))
{
/* Default is NULL, drop it */
new_record_nulls[Anum_pg_type_typdefaultbin - 1] = 'n';
new_record_repl[Anum_pg_type_typdefaultbin - 1] = 'r';
new_record_nulls[Anum_pg_type_typdefault - 1] = 'n';
new_record_repl[Anum_pg_type_typdefault - 1] = 'r';
new_record_nulls[Anum_pg_type_typdefaultbin - 1] = true;
new_record_repl[Anum_pg_type_typdefaultbin - 1] = true;
new_record_nulls[Anum_pg_type_typdefault - 1] = true;
new_record_repl[Anum_pg_type_typdefault - 1] = true;
}
else
{
@@ -1509,21 +1509,21 @@ AlterDomainDefault(List *names, Node *defaultRaw)
*/
new_record[Anum_pg_type_typdefaultbin - 1] = CStringGetTextDatum(nodeToString(defaultExpr));
new_record_repl[Anum_pg_type_typdefaultbin - 1] = 'r';
new_record_repl[Anum_pg_type_typdefaultbin - 1] = true;
new_record[Anum_pg_type_typdefault - 1] = CStringGetTextDatum(defaultValue);
new_record_repl[Anum_pg_type_typdefault - 1] = 'r';
new_record_repl[Anum_pg_type_typdefault - 1] = true;
}
}
else
{
/* ALTER ... DROP DEFAULT */
new_record_nulls[Anum_pg_type_typdefaultbin - 1] = 'n';
new_record_repl[Anum_pg_type_typdefaultbin - 1] = 'r';
new_record_nulls[Anum_pg_type_typdefault - 1] = 'n';
new_record_repl[Anum_pg_type_typdefault - 1] = 'r';
new_record_nulls[Anum_pg_type_typdefaultbin - 1] = true;
new_record_repl[Anum_pg_type_typdefaultbin - 1] = true;
new_record_nulls[Anum_pg_type_typdefault - 1] = true;
new_record_repl[Anum_pg_type_typdefault - 1] = true;
}
newtuple = heap_modifytuple(tup, RelationGetDescr(rel),
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel),
new_record, new_record_nulls,
new_record_repl);

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.182 2008/05/12 00:00:48 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.183 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -78,7 +78,7 @@ CreateRole(CreateRoleStmt *stmt)
TupleDesc pg_authid_dsc;
HeapTuple tuple;
Datum new_record[Natts_pg_authid];
char new_record_nulls[Natts_pg_authid];
bool new_record_nulls[Natts_pg_authid];
Oid roleid;
ListCell *item;
ListCell *option;
@@ -295,7 +295,7 @@ CreateRole(CreateRoleStmt *stmt)
* Build a tuple to insert
*/
MemSet(new_record, 0, sizeof(new_record));
MemSet(new_record_nulls, ' ', sizeof(new_record_nulls));
MemSet(new_record_nulls, false, sizeof(new_record_nulls));
new_record[Anum_pg_authid_rolname - 1] =
DirectFunctionCall1(namein, CStringGetDatum(stmt->role));
@@ -324,7 +324,7 @@ CreateRole(CreateRoleStmt *stmt)
}
}
else
new_record_nulls[Anum_pg_authid_rolpassword - 1] = 'n';
new_record_nulls[Anum_pg_authid_rolpassword - 1] = true;
if (validUntil)
new_record[Anum_pg_authid_rolvaliduntil - 1] =
@@ -334,11 +334,11 @@ CreateRole(CreateRoleStmt *stmt)
Int32GetDatum(-1));
else
new_record_nulls[Anum_pg_authid_rolvaliduntil - 1] = 'n';
new_record_nulls[Anum_pg_authid_rolvaliduntil - 1] = true;
new_record_nulls[Anum_pg_authid_rolconfig - 1] = 'n';
new_record_nulls[Anum_pg_authid_rolconfig - 1] = true;
tuple = heap_formtuple(pg_authid_dsc, new_record, new_record_nulls);
tuple = heap_form_tuple(pg_authid_dsc, new_record, new_record_nulls);
/*
* Insert new record in the pg_authid table
@@ -402,8 +402,8 @@ void
AlterRole(AlterRoleStmt *stmt)
{
Datum new_record[Natts_pg_authid];
char new_record_nulls[Natts_pg_authid];
char new_record_repl[Natts_pg_authid];
bool new_record_nulls[Natts_pg_authid];
bool new_record_repl[Natts_pg_authid];
Relation pg_authid_rel;
TupleDesc pg_authid_dsc;
HeapTuple tuple,
@@ -586,8 +586,8 @@ AlterRole(AlterRoleStmt *stmt)
* Build an updated tuple, perusing the information just obtained
*/
MemSet(new_record, 0, sizeof(new_record));
MemSet(new_record_nulls, ' ', sizeof(new_record_nulls));
MemSet(new_record_repl, ' ', sizeof(new_record_repl));
MemSet(new_record_nulls, false, sizeof(new_record_nulls));
MemSet(new_record_repl, false, sizeof(new_record_repl));
/*
* issuper/createrole/catupdate/etc
@@ -600,40 +600,40 @@ AlterRole(AlterRoleStmt *stmt)
if (issuper >= 0)
{
new_record[Anum_pg_authid_rolsuper - 1] = BoolGetDatum(issuper > 0);
new_record_repl[Anum_pg_authid_rolsuper - 1] = 'r';
new_record_repl[Anum_pg_authid_rolsuper - 1] = true;
new_record[Anum_pg_authid_rolcatupdate - 1] = BoolGetDatum(issuper > 0);
new_record_repl[Anum_pg_authid_rolcatupdate - 1] = 'r';
new_record_repl[Anum_pg_authid_rolcatupdate - 1] = true;
}
if (inherit >= 0)
{
new_record[Anum_pg_authid_rolinherit - 1] = BoolGetDatum(inherit > 0);
new_record_repl[Anum_pg_authid_rolinherit - 1] = 'r';
new_record_repl[Anum_pg_authid_rolinherit - 1] = true;
}
if (createrole >= 0)
{
new_record[Anum_pg_authid_rolcreaterole - 1] = BoolGetDatum(createrole > 0);
new_record_repl[Anum_pg_authid_rolcreaterole - 1] = 'r';
new_record_repl[Anum_pg_authid_rolcreaterole - 1] = true;
}
if (createdb >= 0)
{
new_record[Anum_pg_authid_rolcreatedb - 1] = BoolGetDatum(createdb > 0);
new_record_repl[Anum_pg_authid_rolcreatedb - 1] = 'r';
new_record_repl[Anum_pg_authid_rolcreatedb - 1] = true;
}
if (canlogin >= 0)
{
new_record[Anum_pg_authid_rolcanlogin - 1] = BoolGetDatum(canlogin > 0);
new_record_repl[Anum_pg_authid_rolcanlogin - 1] = 'r';
new_record_repl[Anum_pg_authid_rolcanlogin - 1] = true;
}
if (dconnlimit)
{
new_record[Anum_pg_authid_rolconnlimit - 1] = Int32GetDatum(connlimit);
new_record_repl[Anum_pg_authid_rolconnlimit - 1] = 'r';
new_record_repl[Anum_pg_authid_rolconnlimit - 1] = true;
}
/* password */
@@ -650,14 +650,14 @@ AlterRole(AlterRoleStmt *stmt)
new_record[Anum_pg_authid_rolpassword - 1] =
CStringGetTextDatum(encrypted_password);
}
new_record_repl[Anum_pg_authid_rolpassword - 1] = 'r';
new_record_repl[Anum_pg_authid_rolpassword - 1] = true;
}
/* unset password */
if (dpassword && dpassword->arg == NULL)
{
new_record_repl[Anum_pg_authid_rolpassword - 1] = 'r';
new_record_nulls[Anum_pg_authid_rolpassword - 1] = 'n';
new_record_repl[Anum_pg_authid_rolpassword - 1] = true;
new_record_nulls[Anum_pg_authid_rolpassword - 1] = true;
}
/* valid until */
@@ -668,10 +668,10 @@ AlterRole(AlterRoleStmt *stmt)
CStringGetDatum(validUntil),
ObjectIdGetDatum(InvalidOid),
Int32GetDatum(-1));
new_record_repl[Anum_pg_authid_rolvaliduntil - 1] = 'r';
new_record_repl[Anum_pg_authid_rolvaliduntil - 1] = true;
}
new_tuple = heap_modifytuple(tuple, pg_authid_dsc, new_record,
new_tuple = heap_modify_tuple(tuple, pg_authid_dsc, new_record,
new_record_nulls, new_record_repl);
simple_heap_update(pg_authid_rel, &tuple->t_self, new_tuple);
@@ -721,8 +721,8 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
newtuple;
Relation rel;
Datum repl_val[Natts_pg_authid];
char repl_null[Natts_pg_authid];
char repl_repl[Natts_pg_authid];
bool repl_null[Natts_pg_authid];
bool repl_repl[Natts_pg_authid];
valuestr = ExtractSetVariableArgs(stmt->setstmt);
@@ -755,13 +755,13 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
errmsg("permission denied")));
}
memset(repl_repl, ' ', sizeof(repl_repl));
repl_repl[Anum_pg_authid_rolconfig - 1] = 'r';
memset(repl_repl, false, sizeof(repl_repl));
repl_repl[Anum_pg_authid_rolconfig - 1] = true;
if (stmt->setstmt->kind == VAR_RESET_ALL)
{
/* RESET ALL, so just set rolconfig to null */
repl_null[Anum_pg_authid_rolconfig - 1] = 'n';
repl_null[Anum_pg_authid_rolconfig - 1] = true;
repl_val[Anum_pg_authid_rolconfig - 1] = (Datum) 0;
}
else
@@ -770,7 +770,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
bool isnull;
ArrayType *array;
repl_null[Anum_pg_authid_rolconfig - 1] = ' ';
repl_null[Anum_pg_authid_rolconfig - 1] = false;
/* Extract old value of rolconfig */
datum = SysCacheGetAttr(AUTHNAME, oldtuple,
@@ -786,10 +786,10 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
if (array)
repl_val[Anum_pg_authid_rolconfig - 1] = PointerGetDatum(array);
else
repl_null[Anum_pg_authid_rolconfig - 1] = 'n';
repl_null[Anum_pg_authid_rolconfig - 1] = true;
}
newtuple = heap_modifytuple(oldtuple, RelationGetDescr(rel),
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &oldtuple->t_self, newtuple);
@@ -983,8 +983,8 @@ RenameRole(const char *oldname, const char *newname)
Datum datum;
bool isnull;
Datum repl_val[Natts_pg_authid];
char repl_null[Natts_pg_authid];
char repl_repl[Natts_pg_authid];
bool repl_null[Natts_pg_authid];
bool repl_repl[Natts_pg_authid];
int i;
Oid roleid;
@@ -1053,26 +1053,26 @@ RenameRole(const char *oldname, const char *newname)
/* OK, construct the modified tuple */
for (i = 0; i < Natts_pg_authid; i++)
repl_repl[i] = ' ';
repl_repl[i] = false;
repl_repl[Anum_pg_authid_rolname - 1] = 'r';
repl_repl[Anum_pg_authid_rolname - 1] = true;
repl_val[Anum_pg_authid_rolname - 1] = DirectFunctionCall1(namein,
CStringGetDatum(newname));
repl_null[Anum_pg_authid_rolname - 1] = ' ';
repl_null[Anum_pg_authid_rolname - 1] = false;
datum = heap_getattr(oldtuple, Anum_pg_authid_rolpassword, dsc, &isnull);
if (!isnull && isMD5(TextDatumGetCString(datum)))
{
/* MD5 uses the username as salt, so just clear it on a rename */
repl_repl[Anum_pg_authid_rolpassword - 1] = 'r';
repl_null[Anum_pg_authid_rolpassword - 1] = 'n';
repl_repl[Anum_pg_authid_rolpassword - 1] = true;
repl_null[Anum_pg_authid_rolpassword - 1] = true;
ereport(NOTICE,
(errmsg("MD5 password cleared because of role rename")));
}
newtuple = heap_modifytuple(oldtuple, dsc, repl_val, repl_null, repl_repl);
newtuple = heap_modify_tuple(oldtuple, dsc, repl_val, repl_null, repl_repl);
simple_heap_update(rel, &oldtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);
@@ -1296,8 +1296,8 @@ AddRoleMems(const char *rolename, Oid roleid,
HeapTuple authmem_tuple;
HeapTuple tuple;
Datum new_record[Natts_pg_auth_members];
char new_record_nulls[Natts_pg_auth_members];
char new_record_repl[Natts_pg_auth_members];
bool new_record_nulls[Natts_pg_auth_members];
bool new_record_repl[Natts_pg_auth_members];
/*
* Refuse creation of membership loops, including the trivial case
@@ -1333,8 +1333,8 @@ AddRoleMems(const char *rolename, Oid roleid,
/* Build a tuple to insert or update */
MemSet(new_record, 0, sizeof(new_record));
MemSet(new_record_nulls, ' ', sizeof(new_record_nulls));
MemSet(new_record_repl, ' ', sizeof(new_record_repl));
MemSet(new_record_nulls, false, sizeof(new_record_nulls));
MemSet(new_record_repl, false, sizeof(new_record_repl));
new_record[Anum_pg_auth_members_roleid - 1] = ObjectIdGetDatum(roleid);
new_record[Anum_pg_auth_members_member - 1] = ObjectIdGetDatum(memberid);
@@ -1343,9 +1343,9 @@ AddRoleMems(const char *rolename, Oid roleid,
if (HeapTupleIsValid(authmem_tuple))
{
new_record_repl[Anum_pg_auth_members_grantor - 1] = 'r';
new_record_repl[Anum_pg_auth_members_admin_option - 1] = 'r';
tuple = heap_modifytuple(authmem_tuple, pg_authmem_dsc,
new_record_repl[Anum_pg_auth_members_grantor - 1] = true;
new_record_repl[Anum_pg_auth_members_admin_option - 1] = true;
tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc,
new_record,
new_record_nulls, new_record_repl);
simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple);
@@ -1354,7 +1354,7 @@ AddRoleMems(const char *rolename, Oid roleid,
}
else
{
tuple = heap_formtuple(pg_authmem_dsc,
tuple = heap_form_tuple(pg_authmem_dsc,
new_record, new_record_nulls);
simple_heap_insert(pg_authmem_rel, tuple);
CatalogUpdateIndexes(pg_authmem_rel, tuple);
@@ -1453,18 +1453,18 @@ DelRoleMems(const char *rolename, Oid roleid,
/* Just turn off the admin option */
HeapTuple tuple;
Datum new_record[Natts_pg_auth_members];
char new_record_nulls[Natts_pg_auth_members];
char new_record_repl[Natts_pg_auth_members];
bool new_record_nulls[Natts_pg_auth_members];
bool new_record_repl[Natts_pg_auth_members];
/* Build a tuple to update with */
MemSet(new_record, 0, sizeof(new_record));
MemSet(new_record_nulls, ' ', sizeof(new_record_nulls));
MemSet(new_record_repl, ' ', sizeof(new_record_repl));
MemSet(new_record_nulls, false, sizeof(new_record_nulls));
MemSet(new_record_repl, false, sizeof(new_record_repl));
new_record[Anum_pg_auth_members_admin_option - 1] = BoolGetDatum(false);
new_record_repl[Anum_pg_auth_members_admin_option - 1] = 'r';
new_record_repl[Anum_pg_auth_members_admin_option - 1] = true;
tuple = heap_modifytuple(authmem_tuple, pg_authmem_dsc,
tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc,
new_record,
new_record_nulls, new_record_repl);
simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple);