summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2008-11-02 01:45:28 +0000
committerTom Lane2008-11-02 01:45:28 +0000
commitb4d1cecda8fb813285ba89745ee01c4af3dd6956 (patch)
tree58460e05d5632d2e0a0d9da873e171f5844ebdfc
parent1895946c4601707ebea504e4a2f70c21a7da9425 (diff)
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
-rw-r--r--contrib/hstore/hstore_op.c8
-rw-r--r--src/backend/access/common/heaptuple.c439
-rw-r--r--src/backend/access/heap/tuptoaster.c4
-rw-r--r--src/backend/bootstrap/bootstrap.c12
-rw-r--r--src/backend/catalog/aclchk.c82
-rw-r--r--src/backend/catalog/heap.c14
-rw-r--r--src/backend/catalog/index.c10
-rw-r--r--src/backend/catalog/pg_aggregate.c8
-rw-r--r--src/backend/catalog/pg_constraint.c20
-rw-r--r--src/backend/catalog/pg_conversion.c6
-rw-r--r--src/backend/catalog/pg_depend.c6
-rw-r--r--src/backend/catalog/pg_enum.c6
-rw-r--r--src/backend/catalog/pg_largeobject.c6
-rw-r--r--src/backend/catalog/pg_namespace.c8
-rw-r--r--src/backend/catalog/pg_operator.c42
-rw-r--r--src/backend/catalog/pg_proc.c28
-rw-r--r--src/backend/catalog/pg_shdepend.c2
-rw-r--r--src/backend/catalog/pg_type.c28
-rw-r--r--src/backend/commands/analyze.c16
-rw-r--r--src/backend/commands/async.c30
-rw-r--r--src/backend/commands/comment.c24
-rw-r--r--src/backend/commands/copy.c17
-rw-r--r--src/backend/commands/dbcommands.c52
-rw-r--r--src/backend/commands/functioncmds.c34
-rw-r--r--src/backend/commands/opclasscmds.c30
-rw-r--r--src/backend/commands/proclang.c22
-rw-r--r--src/backend/commands/schemacmds.c14
-rw-r--r--src/backend/commands/sequence.c8
-rw-r--r--src/backend/commands/tablecmds.c38
-rw-r--r--src/backend/commands/tablespace.c22
-rw-r--r--src/backend/commands/trigger.c6
-rw-r--r--src/backend/commands/tsearchcmds.c68
-rw-r--r--src/backend/commands/typecmds.c30
-rw-r--r--src/backend/commands/user.c104
-rw-r--r--src/backend/executor/execTuples.c12
-rw-r--r--src/backend/executor/spi.c10
-rw-r--r--src/backend/optimizer/prep/preptlist.c2
-rw-r--r--src/backend/rewrite/rewriteDefine.c24
-rw-r--r--src/backend/storage/large_object/inv_api.c32
-rw-r--r--src/backend/utils/adt/lockfuncs.c86
-rw-r--r--src/backend/utils/adt/rowtypes.c44
-rw-r--r--src/backend/utils/cache/catcache.c12
-rw-r--r--src/include/access/htup.h9
-rw-r--r--src/include/funcapi.h4
-rw-r--r--src/pl/plpgsql/src/pl_exec.c46
-rw-r--r--src/pl/plpython/plpython.c30
46 files changed, 586 insertions, 969 deletions
diff --git a/contrib/hstore/hstore_op.c b/contrib/hstore/hstore_op.c
index 4f285ee633..bb1ebe4055 100644
--- a/contrib/hstore/hstore_op.c
+++ b/contrib/hstore/hstore_op.c
@@ -610,7 +610,7 @@ each(PG_FUNCTION_ARGS)
HEntry *ptr = &(ARRPTR(st->hs)[st->i]);
Datum res,
dvalues[2];
- char nulls[] = {' ', ' '};
+ bool nulls[2] = {false, false};
text *item;
HeapTuple tuple;
@@ -620,7 +620,7 @@ each(PG_FUNCTION_ARGS)
if (ptr->valisnull)
{
dvalues[1] = (Datum) 0;
- nulls[1] = 'n';
+ nulls[1] = true;
}
else
{
@@ -630,11 +630,11 @@ each(PG_FUNCTION_ARGS)
}
st->i++;
- tuple = heap_formtuple(funcctx->attinmeta->tupdesc, dvalues, nulls);
+ tuple = heap_form_tuple(funcctx->attinmeta->tupdesc, dvalues, nulls);
res = HeapTupleGetDatum(tuple);
pfree(DatumGetPointer(dvalues[0]));
- if (nulls[1] != 'n')
+ if (!nulls[1])
pfree(DatumGetPointer(dvalues[1]));
SRF_RETURN_NEXT(funcctx, PointerGetDatum(res));
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index f27ce02e6e..95348edf9b 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -4,13 +4,6 @@
* This file contains heap tuple accessor and mutator routines, as well
* as various tuple utilities.
*
- * NOTE: there is massive duplication of code in this module to
- * support both the convention that a null is marked by a bool TRUE,
- * and the convention that a null is marked by a char 'n'. The latter
- * convention is deprecated but it'll probably be a long time before
- * we can get rid of it entirely.
- *
- *
* Some notes about varlenas and this code:
*
* Before Postgres 8.3 varlenas always had a 4-byte length header, and
@@ -24,8 +17,8 @@
* be expanded back to the normal 4-byte-header format by pg_detoast_datum.
* (In performance-critical code paths we can use pg_detoast_datum_packed
* and the appropriate access macros to avoid that overhead.) Note that this
- * conversion is performed directly in heap_form_tuple (or heap_formtuple),
- * without explicitly invoking the toaster.
+ * conversion is performed directly in heap_form_tuple, without invoking
+ * tuptoaster.c.
*
* This change will break any code that assumes it needn't detoast values
* that have been put into a tuple but never sent to disk. Hopefully there
@@ -128,54 +121,6 @@ heap_compute_data_size(TupleDesc tupleDesc,
return data_length;
}
-/* ----------------
- * ComputeDataSize
- *
- * Determine size of the data area of a tuple to be constructed
- *
- * OLD API with char 'n'/' ' convention for indicating nulls
- * ----------------
- */
-static Size
-ComputeDataSize(TupleDesc tupleDesc,
- Datum *values,
- char *nulls)
-{
- Size data_length = 0;
- int i;
- int numberOfAttributes = tupleDesc->natts;
- Form_pg_attribute *att = tupleDesc->attrs;
-
- for (i = 0; i < numberOfAttributes; i++)
- {
- Datum val;
-
- if (nulls[i] != ' ')
- continue;
-
- val = values[i];
-
- if (ATT_IS_PACKABLE(att[i]) &&
- VARATT_CAN_MAKE_SHORT(DatumGetPointer(val)))
- {
- /*
- * we're anticipating converting to a short varlena header, so
- * adjust length and don't count any alignment
- */
- data_length += VARATT_CONVERTED_SHORT_SIZE(DatumGetPointer(val));
- }
- else
- {
- data_length = att_align_datum(data_length, att[i]->attalign,
- att[i]->attlen, val);
- data_length = att_addlength_datum(data_length, att[i]->attlen,
- val);
- }
- }
-
- return data_length;
-}
-
/*
* heap_fill_tuple
* Load data portion of a tuple from values/isnull arrays
@@ -310,138 +255,6 @@ heap_fill_tuple(TupleDesc tupleDesc,
Assert((data - start) == data_size);
}
-/* ----------------
- * DataFill
- *
- * Load data portion of a tuple from values/nulls arrays
- *
- * OLD API with char 'n'/' ' convention for indicating nulls
- * ----------------
- */
-static void
-DataFill(TupleDesc tupleDesc,
- Datum *values, char *nulls,
- char *data, Size data_size,
- uint16 *infomask, bits8 *bit)
-{
- bits8 *bitP;
- int bitmask;
- int i;
- int numberOfAttributes = tupleDesc->natts;
- Form_pg_attribute *att = tupleDesc->attrs;
-
-#ifdef USE_ASSERT_CHECKING
- char *start = data;
-#endif
-
- if (bit != NULL)
- {
- bitP = &bit[-1];
- bitmask = HIGHBIT;
- }
- else
- {
- /* just to keep compiler quiet */
- bitP = NULL;
- bitmask = 0;
- }
-
- *infomask &= ~(HEAP_HASNULL | HEAP_HASVARWIDTH | HEAP_HASEXTERNAL);
-
- for (i = 0; i < numberOfAttributes; i++)
- {
- Size data_length;
-
- if (bit != NULL)
- {
- if (bitmask != HIGHBIT)
- bitmask <<= 1;
- else
- {
- bitP += 1;
- *bitP = 0x0;
- bitmask = 1;
- }
-
- if (nulls[i] == 'n')
- {
- *infomask |= HEAP_HASNULL;
- continue;
- }
-
- *bitP |= bitmask;
- }
-
- /*
- * XXX we use the att_align macros on the pointer value itself, not on
- * an offset. This is a bit of a hack.
- */
-
- if (att[i]->attbyval)
- {
- /* pass-by-value */
- data = (char *) att_align_nominal((long) data, att[i]->attalign);
- store_att_byval(data, values[i], att[i]->attlen);
- data_length = att[i]->attlen;
- }
- else if (att[i]->attlen == -1)
- {
- /* varlena */
- Pointer val = DatumGetPointer(values[i]);
-
- *infomask |= HEAP_HASVARWIDTH;
- if (VARATT_IS_EXTERNAL(val))
- {
- *infomask |= HEAP_HASEXTERNAL;
- /* no alignment, since it's short by definition */
- data_length = VARSIZE_EXTERNAL(val);
- memcpy(data, val, data_length);
- }
- else if (VARATT_IS_SHORT(val))
- {
- /* no alignment for short varlenas */
- data_length = VARSIZE_SHORT(val);
- memcpy(data, val, data_length);
- }
- else if (VARLENA_ATT_IS_PACKABLE(att[i]) &&
- VARATT_CAN_MAKE_SHORT(val))
- {
- /* convert to short varlena -- no alignment */
- data_length = VARATT_CONVERTED_SHORT_SIZE(val);
- SET_VARSIZE_SHORT(data, data_length);
- memcpy(data + 1, VARDATA(val), data_length - 1);
- }
- else
- {
- /* full 4-byte header varlena */
- data = (char *) att_align_nominal((long) data,
- att[i]->attalign);
- data_length = VARSIZE(val);
- memcpy(data, val, data_length);
- }
- }
- else if (att[i]->attlen == -2)
- {
- /* cstring ... never needs alignment */
- *infomask |= HEAP_HASVARWIDTH;
- Assert(att[i]->attalign == 'c');
- data_length = strlen(DatumGetCString(values[i])) + 1;
- memcpy(data, DatumGetPointer(values[i]), data_length);
- }
- else
- {
- /* fixed-length pass-by-reference */
- data = (char *) att_align_nominal((long) data, att[i]->attalign);
- Assert(att[i]->attlen > 0);
- data_length = att[i]->attlen;
- memcpy(data, DatumGetPointer(values[i]), data_length);
- }
-
- data += data_length;
- }
-
- Assert((data - start) == data_size);
-}
/* ----------------------------------------------------------------
* heap tuple interface
@@ -952,7 +765,7 @@ heap_form_tuple(TupleDesc tupleDescriptor,
return tuple;
}
-/* ----------------
+/*
* heap_formtuple
*
* construct a tuple from the given values[] and nulls[] arrays
@@ -960,8 +773,9 @@ heap_form_tuple(TupleDesc tupleDescriptor,
* Null attributes are indicated by a 'n' in the appropriate byte
* of nulls[]. Non-null attributes are indicated by a ' ' (space).
*
- * OLD API with char 'n'/' ' convention for indicating nulls
- * ----------------
+ * OLD API with char 'n'/' ' convention for indicating nulls.
+ * This is deprecated and should not be used in new code, but we keep it
+ * around for use by old add-on modules.
*/
HeapTuple
heap_formtuple(TupleDesc tupleDescriptor,
@@ -969,96 +783,16 @@ heap_formtuple(TupleDesc tupleDescriptor,
char *nulls)
{
HeapTuple tuple; /* return tuple */
- HeapTupleHeader td; /* tuple data */
- Size len,
- data_len;
- int hoff;
- bool hasnull = false;
- Form_pg_attribute *att = tupleDescriptor->attrs;
int numberOfAttributes = tupleDescriptor->natts;
+ bool *boolNulls = (bool *) palloc(numberOfAttributes * sizeof(bool));
int i;
- if (numberOfAttributes > MaxTupleAttributeNumber)
- ereport(ERROR,
- (errcode(ERRCODE_TOO_MANY_COLUMNS),
- errmsg("number of columns (%d) exceeds limit (%d)",
- numberOfAttributes, MaxTupleAttributeNumber)));
-
- /*
- * Check for nulls and embedded tuples; expand any toasted attributes in
- * embedded tuples. This preserves the invariant that toasting can only
- * go one level deep.
- *
- * We can skip calling toast_flatten_tuple_attribute() if the attribute
- * couldn't possibly be of composite type. All composite datums are
- * varlena and have alignment 'd'; furthermore they aren't arrays. Also,
- * if an attribute is already toasted, it must have been sent to disk
- * already and so cannot contain toasted attributes.
- */
for (i = 0; i < numberOfAttributes; i++)
- {
- if (nulls[i] != ' ')
- hasnull = true;
- else if (att[i]->attlen == -1 &&
- att[i]->attalign == 'd' &&
- att[i]->attndims == 0 &&
- !VARATT_IS_EXTENDED(DatumGetPointer(values[i])))
- {
- values[i] = toast_flatten_tuple_attribute(values[i],
- att[i]->atttypid,
- att[i]->atttypmod);
- }
- }
-
- /*
- * Determine total space needed
- */
- len = offsetof(HeapTupleHeaderData, t_bits);
+ boolNulls[i] = (nulls[i] == 'n');
- if (hasnull)
- len += BITMAPLEN(numberOfAttributes);
-
- if (tupleDescriptor->tdhasoid)
- len += sizeof(Oid);
+ tuple = heap_form_tuple(tupleDescriptor, values, boolNulls);
- hoff = len = MAXALIGN(len); /* align user data safely */
-
- data_len = ComputeDataSize(tupleDescriptor, values, nulls);
-
- len += data_len;
-
- /*
- * Allocate and zero the space needed. Note that the tuple body and
- * HeapTupleData management structure are allocated in one chunk.
- */
- tuple = (HeapTuple) palloc0(HEAPTUPLESIZE + len);
- tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
-
- /*
- * And fill in the information. Note we fill the Datum fields even though
- * this tuple may never become a Datum.
- */
- tuple->t_len = len;
- ItemPointerSetInvalid(&(tuple->t_self));
- tuple->t_tableOid = InvalidOid;
-
- HeapTupleHeaderSetDatumLength(td, len);
- HeapTupleHeaderSetTypeId(td, tupleDescriptor->tdtypeid);
- HeapTupleHeaderSetTypMod(td, tupleDescriptor->tdtypmod);
-
- HeapTupleHeaderSetNatts(td, numberOfAttributes);
- td->t_hoff = hoff;
-
- if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */
- td->t_infomask = HEAP_HASOID;
-
- DataFill(tupleDescriptor,
- values,
- nulls,
- (char *) td + hoff,
- data_len,
- &td->t_infomask,
- (hasnull ? td->t_bits : NULL));
+ pfree(boolNulls);
return tuple;
}
@@ -1134,7 +868,7 @@ heap_modify_tuple(HeapTuple tuple,
return newTuple;
}
-/* ----------------
+/*
* heap_modifytuple
*
* forms a new tuple from an old tuple and a set of replacement values.
@@ -1142,7 +876,8 @@ heap_modify_tuple(HeapTuple tuple,
*
* OLD API with char 'n'/' ' convention for indicating nulls, and
* char 'r'/' ' convention for indicating whether to replace columns.
- * ----------------
+ * This is deprecated and should not be used in new code, but we keep it
+ * around for use by old add-on modules.
*/
HeapTuple
heap_modifytuple(HeapTuple tuple,
@@ -1151,59 +886,24 @@ heap_modifytuple(HeapTuple tuple,
char *replNulls,
char *replActions)
{
+ HeapTuple result;
int numberOfAttributes = tupleDesc->natts;
- int attoff;
- Datum *values;
- char *nulls;
- HeapTuple newTuple;
-
- /*
- * allocate and fill values and nulls arrays from either the tuple or the
- * repl information, as appropriate.
- *
- * NOTE: it's debatable whether to use heap_deformtuple() here or just
- * heap_getattr() only the non-replaced colums. The latter could win if
- * there are many replaced columns and few non-replaced ones. However,
- * heap_deformtuple costs only O(N) while the heap_getattr way would cost
- * O(N^2) if there are many non-replaced columns, so it seems better to
- * err on the side of linear cost.
- */
- values = (Datum *) palloc(numberOfAttributes * sizeof(Datum));
- nulls = (char *) palloc(numberOfAttributes * sizeof(char));
-
- heap_deformtuple(tuple, tupleDesc, values, nulls);
+ bool *boolNulls = (bool *) palloc(numberOfAttributes * sizeof(bool));
+ bool *boolActions = (bool *) palloc(numberOfAttributes * sizeof(bool));
+ int attnum;
- for (attoff = 0; attoff < numberOfAttributes; attoff++)
+ for (attnum = 0; attnum < numberOfAttributes; attnum++)
{
- if (replActions[attoff] == 'r')
- {
- values[attoff] = replValues[attoff];
- nulls[attoff] = replNulls[attoff];
- }
- else if (replActions[attoff] != ' ')
- elog(ERROR, "unrecognized replace flag: %d",
- (int) replActions[attoff]);
+ boolNulls[attnum] = (replNulls[attnum] == 'n');
+ boolActions[attnum] = (replActions[attnum] == 'r');
}
- /*
- * create a new tuple from the values and nulls arrays
- */
- newTuple = heap_formtuple(tupleDesc, values, nulls);
+ result = heap_modify_tuple(tuple, tupleDesc, replValues, boolNulls, boolActions);
- pfree(values);
- pfree(nulls);
+ pfree(boolNulls);
+ pfree(boolActions);
- /*
- * copy the identification info of the old tuple: t_ctid, t_self, and OID
- * (if any)
- */
- newTuple->t_data->t_ctid = tuple->t_data->t_ctid;
- newTuple->t_self = tuple->t_self;
- newTuple->t_tableOid = tuple->t_tableOid;
- if (tupleDesc->tdhasoid)
- HeapTupleSetOid(newTuple, HeapTupleGetOid(tuple));
-
- return newTuple;
+ return result;
}
/*
@@ -1312,7 +1012,7 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
}
}
-/* ----------------
+/*
* heap_deformtuple
*
* Given a tuple, extract data into values/nulls arrays; this is
@@ -1329,8 +1029,9 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
* heap_getattr; the loop will become O(N^2) as soon as any
* noncacheable attribute offsets are involved.
*
- * OLD API with char 'n'/' ' convention for indicating nulls
- * ----------------
+ * OLD API with char 'n'/' ' convention for indicating nulls.
+ * This is deprecated and should not be used in new code, but we keep it
+ * around for use by old add-on modules.
*/
void
heap_deformtuple(HeapTuple tuple,
@@ -1338,90 +1039,16 @@ heap_deformtuple(HeapTuple tuple,
Datum *values,
char *nulls)
{
- HeapTupleHeader tup = tuple->t_data;
- bool hasnulls = HeapTupleHasNulls(tuple);
- Form_pg_attribute *att = tupleDesc->attrs;
- int tdesc_natts = tupleDesc->natts;
- int natts; /* number of atts to extract */
+ int natts = tupleDesc->natts;
+ bool *boolNulls = (bool *) palloc(natts * sizeof(bool));
int attnum;
- char *tp; /* ptr to tuple data */
- long off; /* offset in tuple data */
- bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
- bool slow = false; /* can we use/set attcacheoff? */
- natts = HeapTupleHeaderGetNatts(tup);
-
- /*
- * In inheritance situations, it is possible that the given tuple actually
- * has more fields than the caller is expecting. Don't run off the end of
- * the caller's arrays.
- */
- natts = Min(natts, tdesc_natts);
-
- tp = (char *) tup + tup->t_hoff;
-
- off = 0;
+ heap_deform_tuple(tuple, tupleDesc, values, boolNulls);
for (attnum = 0; attnum < natts; attnum++)
- {
- Form_pg_attribute thisatt = att[attnum];
-
- if (hasnulls && att_isnull(attnum, bp))
- {
- values[attnum] = (Datum) 0;
- nulls[attnum] = 'n';
- slow = true; /* can't use attcacheoff anymore */
- continue;
- }
-
- nulls[attnum] = ' ';
+ nulls[attnum] = (boolNulls[attnum] ? 'n' : ' ');
- if (!slow && thisatt->attcacheoff >= 0)
- off = thisatt->attcacheoff;
- else if (thisatt->attlen == -1)
- {
- /*
- * We can only cache the offset for a varlena attribute if the
- * offset is already suitably aligned, so that there would be no
- * pad bytes in any case: then the offset will be valid for either
- * an aligned or unaligned value.
- */
- if (!slow &&
- off == att_align_nominal(off, thisatt->attalign))
- thisatt->attcacheoff = off;
- else
- {
- off = att_align_pointer(off, thisatt->attalign, -1,
- tp + off);
- slow = true;
- }
- }
- else
- {
- /* not varlena, so safe to use att_align_nominal */
- off = att_align_nominal(off, thisatt->attalign);
-
- if (!slow)
- thisatt->attcacheoff = off;
- }
-
- values[attnum] = fetchatt(thisatt, tp + off);
-
- off = att_addlength_pointer(off, thisatt->attlen, tp + off);
-
- if (thisatt->attlen <= 0)
- slow = true; /* can't use attcacheoff anymore */
- }
-
- /*
- * If tuple doesn't have all the atts indicated by tupleDesc, read the
- * rest as null
- */
- for (; attnum < tdesc_natts; attnum++)
- {
- values[attnum] = (Datum) 0;
- nulls[attnum] = 'n';
- }
+ pfree(boolNulls);
}
/*
diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c
index 19159848a3..157e8c2283 100644
--- a/src/backend/access/heap/tuptoaster.c
+++ b/src/backend/access/heap/tuptoaster.c
@@ -359,10 +359,10 @@ toast_delete(Relation rel, HeapTuple oldtup)
/*
* Get the tuple descriptor and break down the tuple into fields.
*
- * NOTE: it's debatable whether to use heap_deformtuple() here or just
+ * NOTE: it's debatable whether to use heap_deform_tuple() here or just
* heap_getattr() only the varlena columns. The latter could win if there
* are few varlena columns and many non-varlena ones. However,
- * heap_deformtuple costs only O(N) while the heap_getattr way would cost
+ * heap_deform_tuple costs only O(N) while the heap_getattr way would cost
* O(N^2) if there are many varlena columns, so it seems better to err on
* the side of linear cost. (We won't even be here unless there's at
* least one varlena column, by the way.)
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 6361d718b3..d3852497d0 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -169,7 +169,7 @@ struct typmap
static struct typmap **Typ = NULL;
static struct typmap *Ap = NULL;
-static char Blanks[MAXATTR];
+static bool Nulls[MAXATTR];
Form_pg_attribute attrtypes[MAXATTR]; /* points to attribute info */
static Datum values[MAXATTR]; /* corresponding attribute values */
@@ -488,7 +488,7 @@ BootstrapModeMain(void)
for (i = 0; i < MAXATTR; i++)
{
attrtypes[i] = NULL;
- Blanks[i] = ' ';
+ Nulls[i] = false;
}
for (i = 0; i < STRTABLESIZE; ++i)
strtable[i] = NULL;
@@ -797,7 +797,7 @@ InsertOneTuple(Oid objectid)
tupDesc = CreateTupleDesc(numattr,
RelationGetForm(boot_reldesc)->relhasoids,
attrtypes);
- tuple = heap_formtuple(tupDesc, values, Blanks);
+ tuple = heap_form_tuple(tupDesc, values, Nulls);
if (objectid != (Oid) 0)
HeapTupleSetOid(tuple, objectid);
pfree(tupDesc); /* just free's tupDesc, not the attrtypes */
@@ -807,10 +807,10 @@ InsertOneTuple(Oid objectid)
elog(DEBUG4, "row inserted");
/*
- * Reset blanks for next tuple
+ * Reset null markers for next tuple
*/
for (i = 0; i < numattr; i++)
- Blanks[i] = ' ';
+ Nulls[i] = false;
}
/* ----------------
@@ -857,7 +857,7 @@ InsertOneNull(int i)
elog(DEBUG4, "inserting column %d NULL", i);
Assert(i >= 0 || i < MAXATTR);
values[i] = PointerGetDatum(NULL);
- Blanks[i] = 'n';
+ Nulls[i] = true;
}
/* ----------------
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index c57f7196d9..ed961ce0f0 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -554,8 +554,8 @@ ExecGrant_Relation(InternalGrant *istmt)
HeapTuple tuple;
HeapTuple newtuple;
Datum values[Natts_pg_class];
- char nulls[Natts_pg_class];
- char replaces[Natts_pg_class];
+ bool nulls[Natts_pg_class];
+ bool replaces[Natts_pg_class];
int noldmembers;
int nnewmembers;
Oid *oldmembers;
@@ -694,13 +694,13 @@ ExecGrant_Relation(InternalGrant *istmt)
/* finished building new ACL value, now insert it */
MemSet(values, 0, sizeof(values));
- MemSet(nulls, ' ', sizeof(nulls));
- MemSet(replaces, ' ', sizeof(replaces));
+ MemSet(nulls, false, sizeof(nulls));
+ MemSet(replaces, false, sizeof(replaces));
- replaces[Anum_pg_class_relacl - 1] = 'r';
+ replaces[Anum_pg_class_relacl - 1] = true;
values[Anum_pg_class_relacl - 1] = PointerGetDatum(new_acl);
- newtuple = heap_modifytuple(tuple, RelationGetDescr(relation), values, nulls, replaces);
+ newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values, nulls, replaces);
simple_heap_update(relation, &newtuple->t_self, newtuple);
@@ -749,8 +749,8 @@ ExecGrant_Database(InternalGrant *istmt)
Oid ownerId;
HeapTuple newtuple;
Datum values[Natts_pg_database];
- char nulls[Natts_pg_database];
- char replaces[Natts_pg_database];
+ bool nulls[Natts_pg_database];
+ bool replaces[Natts_pg_database];
int noldmembers;
int nnewmembers;
Oid *oldmembers;
@@ -809,14 +809,14 @@ ExecGrant_Database(InternalGrant *istmt)
/* finished building new ACL value, now insert it */
MemSet(values, 0, sizeof(values));
- MemSet(nulls, ' ', sizeof(nulls));
- MemSet(replaces, ' ', sizeof(replaces));
+ MemSet(nulls, false, sizeof(nulls));
+ MemSet(replaces, false, sizeof(replaces));
- replaces[Anum_pg_database_datacl - 1] = 'r';
+ replaces[Anum_pg_database_datacl - 1] = true;
values[Anum_pg_database_datacl - 1] = PointerGetDatum(new_acl);
- newtuple = heap_modifytuple(tuple, RelationGetDescr(relation), values,
- nulls, replaces);
+ newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
+ nulls, replaces);
simple_heap_update(relation, &newtuple->t_self, newtuple);
@@ -866,8 +866,8 @@ ExecGrant_Function(InternalGrant *istmt)
HeapTuple tuple;
HeapTuple newtuple;
Datum values[Natts_pg_proc];
- char nulls[Natts_pg_proc];
- char replaces[Natts_pg_proc];
+ bool nulls[Natts_pg_proc];
+ bool replaces[Natts_pg_proc];
int noldmembers;
int nnewmembers;
Oid *oldmembers;
@@ -925,14 +925,14 @@ ExecGrant_Function(InternalGrant *istmt)
/* finished building new ACL value, now insert it */
MemSet(values, 0, sizeof(values));
- MemSet(nulls, ' ', sizeof(nulls));
- MemSet(replaces, ' ', sizeof(replaces));
+ MemSet(nulls, false, sizeof(nulls));
+ MemSet(replaces, false, sizeof(replaces));
- replaces[Anum_pg_proc_proacl - 1] = 'r';
+ replaces[Anum_pg_proc_proacl - 1] = true;
values[Anum_pg_proc_proacl - 1] = PointerGetDatum(new_acl);
- newtuple = heap_modifytuple(tuple, RelationGetDescr(relation), values,
- nulls, replaces);
+ newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
+ nulls, replaces);
simple_heap_update(relation, &newtuple->t_self, newtuple);
@@ -982,8 +982,8 @@ ExecGrant_Language(InternalGrant *istmt)
HeapTuple tuple;
HeapTuple newtuple;
Datum values[Natts_pg_language];
- char nulls[Natts_pg_language];
- char replaces[Natts_pg_language];
+ bool nulls[Natts_pg_language];
+ bool replaces[Natts_pg_language];
int noldmembers;
int nnewmembers;
Oid *oldmembers;
@@ -1048,14 +1048,14 @@ ExecGrant_Language(InternalGrant *istmt)
/* finished building new ACL value, now insert it */
MemSet(values, 0, sizeof(values));
- MemSet(nulls, ' ', sizeof(nulls));
- MemSet(replaces, ' ', sizeof(replaces));
+ MemSet(nulls, false, sizeof(nulls));
+ MemSet(replaces, false, sizeof(replaces));
- replaces[Anum_pg_language_lanacl - 1] = 'r';
+ replaces[Anum_pg_language_lanacl - 1] = true;
values[Anum_pg_language_lanacl - 1] = PointerGetDatum(new_acl);
- newtuple = heap_modifytuple(tuple, RelationGetDescr(relation), values,
- nulls, replaces);
+ newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
+ nulls, replaces);
simple_heap_update(relation, &newtuple->t_self, newtuple);
@@ -1105,8 +1105,8 @@ ExecGrant_Namespace(InternalGrant *istmt)
HeapTuple tuple;
HeapTuple newtuple;
Datum values[Natts_pg_namespace];
- char nulls[Natts_pg_namespace];
- char replaces[Natts_pg_namespace];
+ bool nulls[Natts_pg_namespace];
+ bool replaces[Natts_pg_namespace];
int noldmembers;
int nnewmembers;
Oid *oldmembers;
@@ -1165,14 +1165,14 @@ ExecGrant_Namespace(InternalGrant *istmt)
/* finished building new ACL value, now insert it */
MemSet(values, 0, sizeof(values));
- MemSet(nulls, ' ', sizeof(nulls));
- MemSet(replaces, ' ', sizeof(replaces));
+ MemSet(nulls, false, sizeof(nulls));
+ MemSet(replaces, false, sizeof(replaces));
- replaces[Anum_pg_namespace_nspacl - 1] = 'r';
+ replaces[Anum_pg_namespace_nspacl - 1] = true;
values[Anum_pg_namespace_nspacl - 1] = PointerGetDatum(new_acl);
- newtuple = heap_modifytuple(tuple, RelationGetDescr(relation), values,
- nulls, replaces);
+ newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
+ nulls, replaces);
simple_heap_update(relation, &newtuple->t_self, newtuple);
@@ -1221,8 +1221,8 @@ ExecGrant_Tablespace(InternalGrant *istmt)
Oid ownerId;
HeapTuple newtuple;
Datum values[Natts_pg_tablespace];
- char nulls[Natts_pg_tablespace];
- char replaces[Natts_pg_tablespace];
+ bool nulls[Natts_pg_tablespace];
+ bool replaces[Natts_pg_tablespace];
int noldmembers;
int nnewmembers;
Oid *oldmembers;
@@ -1288,14 +1288,14 @@ ExecGrant_Tablespace(InternalGrant *istmt)
/* finished building new ACL value, now insert it */
MemSet(values, 0, sizeof(values));
- MemSet(nulls, ' ', sizeof(nulls));
- MemSet(replaces, ' ', sizeof(replaces));
+ MemSet(nulls, false, sizeof(nulls));
+ MemSet(replaces, false, sizeof(replaces));
- replaces[Anum_pg_tablespace_spcacl - 1] = 'r';
+ replaces[Anum_pg_tablespace_spcacl - 1] = true;
values[Anum_pg_tablespace_spcacl - 1] = PointerGetDatum(new_acl);
- newtuple = heap_modifytuple(tuple, RelationGetDescr(relation), values,
- nulls, replaces);
+ newtuple = heap_modify_tuple(tuple, RelationGetDescr(relation), values,
+ nulls, replaces);
simple_heap_update(relation, &newtuple->t_self, newtuple);
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index c299837f41..b79db1fd83 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -618,12 +618,12 @@ InsertPgClassTuple(Relation pg_class_desc,
{
Form_pg_class rd_rel = new_rel_desc->rd_rel;
Datum values[Natts_pg_class];
- char nulls[Natts_pg_class];
+ bool nulls[Natts_pg_class];
HeapTuple tup;
/* This is a tad tedious, but way cleaner than what we used to do... */
memset(values, 0, sizeof(values));
- memset(nulls, ' ', sizeof(nulls));
+ memset(nulls, false, sizeof(nulls));
values[Anum_pg_class_relname - 1] = NameGetDatum(&rd_rel->relname);
values[Anum_pg_class_relnamespace - 1] = ObjectIdGetDatum(rd_rel->relnamespace);
@@ -651,13 +651,13 @@ InsertPgClassTuple(Relation pg_class_desc,
values[Anum_pg_class_relhassubclass - 1] = BoolGetDatum(rd_rel->relhassubclass);
values[Anum_pg_class_relfrozenxid - 1] = TransactionIdGetDatum(rd_rel->relfrozenxid);
/* start out with empty permissions */
- nulls[Anum_pg_class_relacl - 1] = 'n';
+ nulls[Anum_pg_class_relacl - 1] = true;
if (reloptions != (Datum) 0)
values[Anum_pg_class_reloptions - 1] = reloptions;
else
- nulls[Anum_pg_class_reloptions - 1] = 'n';
+ nulls[Anum_pg_class_reloptions - 1] = true;
- tup = heap_formtuple(RelationGetDescr(pg_class_desc), values, nulls);
+ tup = heap_form_tuple(RelationGetDescr(pg_class_desc), values, nulls);
/*
* The new tuple must have the oid already chosen for the rel. Sure would
@@ -1464,7 +1464,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr)
Relation adrel;
HeapTuple tuple;
Datum values[4];
- static char nulls[4] = {' ', ' ', ' ', ' '};
+ static bool nulls[4] = {false, false, false, false};
Relation attrrel;
HeapTuple atttup;
Form_pg_attribute attStruct;
@@ -1495,7 +1495,7 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr)
adrel = heap_open(AttrDefaultRelationId, RowExclusiveLock);
- tuple = heap_formtuple(adrel->rd_att, values, nulls);
+ tuple = heap_form_tuple(adrel->rd_att, values, nulls);
attrdefOid = simple_heap_insert(adrel, tuple);
CatalogUpdateIndexes(adrel, tuple);
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 9a5e342f8b..65da5239a9 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -389,7 +389,7 @@ UpdateIndexRelation(Oid indexoid,
Datum exprsDatum;
Datum predDatum;
Datum values[Natts_pg_index];
- char nulls[Natts_pg_index];
+ bool nulls[Natts_pg_index];
Relation pg_index;
HeapTuple tuple;
int i;
@@ -441,7 +441,7 @@ UpdateIndexRelation(Oid indexoid,
/*
* Build a pg_index tuple
*/
- MemSet(nulls, ' ', sizeof(nulls));
+ MemSet(nulls, false, sizeof(nulls));
values[Anum_pg_index_indexrelid - 1] = ObjectIdGetDatum(indexoid);
values[Anum_pg_index_indrelid - 1] = ObjectIdGetDatum(heapoid);
@@ -458,12 +458,12 @@ UpdateIndexRelation(Oid indexoid,
values[Anum_pg_index_indoption - 1] = PointerGetDatum(indoption);
values[Anum_pg_index_indexprs - 1] = exprsDatum;
if (exprsDatum == (Datum) 0)
- nulls[Anum_pg_index_indexprs - 1] = 'n';
+ nulls[Anum_pg_index_indexprs - 1] = true;
values[Anum_pg_index_indpred - 1] = predDatum;
if (predDatum == (Datum) 0)
- nulls[Anum_pg_index_indpred - 1] = 'n';
+ nulls[Anum_pg_index_indpred - 1] = true;
- tuple = heap_formtuple(RelationGetDescr(pg_index), values, nulls);
+ tuple = heap_form_tuple(RelationGetDescr(pg_index), values, nulls);
/*
* insert the tuple into the pg_index catalog
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index 9326f143a7..7399123942 100644
--- a/src/backend/catalog/pg_aggregate.c
+++ b/src/backend/catalog/pg_aggregate.c
@@ -54,7 +54,7 @@ AggregateCreate(const char *aggName,
{
Relation aggdesc;
HeapTuple tup;
- char nulls[Natts_pg_aggregate];
+ bool nulls[Natts_pg_aggregate];
Datum values[Natts_pg_aggregate];
Form_pg_proc proc;
Oid transfn;
@@ -225,7 +225,7 @@ AggregateCreate(const char *aggName,
/* initialize nulls and values */
for (i = 0; i < Natts_pg_aggregate; i++)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL;
}
values[Anum_pg_aggregate_aggfnoid - 1] = ObjectIdGetDatum(procOid);
@@ -236,12 +236,12 @@ AggregateCreate(const char *aggName,
if (agginitval)
values[Anum_pg_aggregate_agginitval - 1] = CStringGetTextDatum(agginitval);
else
- nulls[Anum_pg_aggregate_agginitval - 1] = 'n';
+ nulls[Anum_pg_aggregate_agginitval - 1] = true;
aggdesc = heap_open(AggregateRelationId, RowExclusiveLock);
tupDesc = aggdesc->rd_att;
- tup = heap_formtuple(tupDesc, values, nulls);
+ tup = heap_form_tuple(tupDesc, values, nulls);
simple_heap_insert(aggdesc, tup);
CatalogUpdateIndexes(aggdesc, tup);
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c
index 7b5be3c62f..c1452e7fd0 100644
--- a/src/backend/catalog/pg_constraint.c
+++ b/src/backend/catalog/pg_constraint.c
@@ -68,7 +68,7 @@ CreateConstraintEntry(const char *constraintName,
Relation conDesc;
Oid conOid;
HeapTuple tup;
- char nulls[Natts_pg_constraint];
+ bool nulls[Natts_pg_constraint];
Datum values[Natts_pg_constraint];
ArrayType *conkeyArray;
ArrayType *confkeyArray;
@@ -133,7 +133,7 @@ CreateConstraintEntry(const char *constraintName,
/* initialize nulls and values */
for (i = 0; i < Natts_pg_constraint; i++)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL;
}
@@ -154,27 +154,27 @@ CreateConstraintEntry(const char *constraintName,
if (conkeyArray)
values[Anum_pg_constraint_conkey - 1] = PointerGetDatum(conkeyArray);
else
- nulls[Anum_pg_constraint_conkey - 1] = 'n';
+ nulls[Anum_pg_constraint_conkey - 1] = true;
if (confkeyArray)
values[Anum_pg_constraint_confkey - 1] = PointerGetDatum(confkeyArray);
else
- nulls[Anum_pg_constraint_confkey - 1] = 'n';
+ nulls[Anum_pg_constraint_confkey - 1] = true;
if (conpfeqopArray)
values[Anum_pg_constraint_conpfeqop - 1] = PointerGetDatum(conpfeqopArray);
else
- nulls[Anum_pg_constraint_conpfeqop - 1] = 'n';
+ nulls[Anum_pg_constraint_conpfeqop - 1] = true;
if (conppeqopArray)
values[Anum_pg_constraint_conppeqop - 1] = PointerGetDatum(conppeqopArray);
else
- nulls[Anum_pg_constraint_conppeqop - 1] = 'n';
+ nulls[Anum_pg_constraint_conppeqop - 1] = true;
if (conffeqopArray)
values[Anum_pg_constraint_conffeqop - 1] = PointerGetDatum(conffeqopArray);
else
- nulls[Anum_pg_constraint_conffeqop - 1] = 'n';
+ nulls[Anum_pg_constraint_conffeqop - 1] = true;
/*
* initialize the binary form of the check constraint.
@@ -182,7 +182,7 @@ CreateConstraintEntry(const char *constraintName,
if (conBin)
values[Anum_pg_constraint_conbin - 1] = CStringGetTextDatum(conBin);
else
- nulls[Anum_pg_constraint_conbin - 1] = 'n';
+ nulls[Anum_pg_constraint_conbin - 1] = true;
/*
* initialize the text form of the check constraint
@@ -190,9 +190,9 @@ CreateConstraintEntry(const char *constraintName,
if (conSrc)
values[Anum_pg_constraint_consrc - 1] = CStringGetTextDatum(conSrc);
else
- nulls[Anum_pg_constraint_consrc - 1] = 'n';
+ nulls[Anum_pg_constraint_consrc - 1] = true;
- tup = heap_formtuple(RelationGetDescr(conDesc), values, nulls);
+ tup = heap_form_tuple(RelationGetDescr(conDesc), values, nulls);
conOid = simple_heap_insert(conDesc, tup);
diff --git a/src/backend/catalog/pg_conversion.c b/src/backend/catalog/pg_conversion.c
index 136239842c..a90905782a 100644
--- a/src/backend/catalog/pg_conversion.c
+++ b/src/backend/catalog/pg_conversion.c
@@ -46,7 +46,7 @@ ConversionCreate(const char *conname, Oid connamespace,
Relation rel;
TupleDesc tupDesc;
HeapTuple tup;
- char nulls[Natts_pg_conversion];
+ bool nulls[Natts_pg_conversion];
Datum values[Natts_pg_conversion];
NameData cname;
Oid oid;
@@ -89,7 +89,7 @@ ConversionCreate(const char *conname, Oid connamespace,
/* initialize nulls and values */
for (i = 0; i < Natts_pg_conversion; i++)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL;
}
@@ -103,7 +103,7 @@ ConversionCreate(const char *conname, Oid connamespace,
values[Anum_pg_conversion_conproc - 1] = ObjectIdGetDatum(conproc);
values[Anum_pg_conversion_condefault - 1] = BoolGetDatum(def);
- tup = heap_formtuple(tupDesc, values, nulls);
+ tup = heap_form_tuple(tupDesc, values, nulls);
/* insert a new tuple */
oid = simple_heap_insert(rel, tup);
diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c
index 8262720f80..3b3203659b 100644
--- a/src/backend/catalog/pg_depend.c
+++ b/src/backend/catalog/pg_depend.c
@@ -59,7 +59,7 @@ recordMultipleDependencies(const ObjectAddress *depender,
CatalogIndexState indstate;
HeapTuple tup;
int i;
- char nulls[Natts_pg_depend];
+ bool nulls[Natts_pg_depend];
Datum values[Natts_pg_depend];
if (nreferenced <= 0)
@@ -77,7 +77,7 @@ recordMultipleDependencies(const ObjectAddress *depender,
/* Don't open indexes unless we need to make an update */
indstate = NULL;
- memset(nulls, ' ', sizeof(nulls));
+ memset(nulls, false, sizeof(nulls));
for (i = 0; i < nreferenced; i++, referenced++)
{
@@ -102,7 +102,7 @@ recordMultipleDependencies(const ObjectAddress *depender,
values[Anum_pg_depend_deptype - 1] = CharGetDatum((char) behavior);
- tup = heap_formtuple(dependDesc->rd_att, values, nulls);
+ tup = heap_form_tuple(dependDesc->rd_att, values, nulls);
simple_heap_insert(dependDesc, tup);
diff --git a/src/backend/catalog/pg_enum.c b/src/backend/catalog/pg_enum.c
index ff87b053a7..b988c8bb28 100644
--- a/src/backend/catalog/pg_enum.c
+++ b/src/backend/catalog/pg_enum.c
@@ -42,7 +42,7 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
int i,
n;
Datum values[Natts_pg_enum];
- char nulls[Natts_pg_enum];
+ bool nulls[Natts_pg_enum];
ListCell *lc;
HeapTuple tup;
@@ -74,7 +74,7 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
qsort(oids, n, sizeof(Oid), oid_cmp);
/* and make the entries */
- memset(nulls, ' ', sizeof(nulls));
+ memset(nulls, false, sizeof(nulls));
i = 0;
foreach(lc, vals)
@@ -96,7 +96,7 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
namestrcpy(&enumlabel, lab);
values[Anum_pg_enum_enumlabel - 1] = NameGetDatum(&enumlabel);
- tup = heap_formtuple(tupDesc, values, nulls);
+ tup = heap_form_tuple(tupDesc, values, nulls);
HeapTupleSetOid(tup, oids[i]);
simple_heap_insert(pg_enum, tup);
diff --git a/src/backend/catalog/pg_largeobject.c b/src/backend/catalog/pg_largeobject.c
index 3bb7acb883..f405188765 100644
--- a/src/backend/catalog/pg_largeobject.c
+++ b/src/backend/catalog/pg_largeobject.c
@@ -37,7 +37,7 @@ LargeObjectCreate(Oid loid)
Relation pg_largeobject;
HeapTuple ntup;
Datum values[Natts_pg_largeobject];
- char nulls[Natts_pg_largeobject];
+ bool nulls[Natts_pg_largeobject];
int i;
pg_largeobject = heap_open(LargeObjectRelationId, RowExclusiveLock);
@@ -48,7 +48,7 @@ LargeObjectCreate(Oid loid)
for (i = 0; i < Natts_pg_largeobject; i++)
{
values[i] = (Datum) NULL;
- nulls[i] = ' ';
+ nulls[i] = false;
}
i = 0;
@@ -57,7 +57,7 @@ LargeObjectCreate(Oid loid)
values[i++] = DirectFunctionCall1(byteain,
CStringGetDatum(""));
- ntup = heap_formtuple(pg_largeobject->rd_att, values, nulls);
+ ntup = heap_form_tuple(pg_largeobject->rd_att, values, nulls);
/*
* Insert it
diff --git a/src/backend/catalog/pg_namespace.c b/src/backend/catalog/pg_namespace.c
index 489692a349..1fa9d9dcad 100644
--- a/src/backend/catalog/pg_namespace.c
+++ b/src/backend/catalog/pg_namespace.c
@@ -33,7 +33,7 @@ NamespaceCreate(const char *nspName, Oid ownerId)
Relation nspdesc;
HeapTuple tup;
Oid nspoid;
- char nulls[Natts_pg_namespace];
+ bool nulls[Natts_pg_namespace];
Datum values[Natts_pg_namespace];
NameData nname;
TupleDesc tupDesc;
@@ -54,18 +54,18 @@ NamespaceCreate(const char *nspName, Oid ownerId)
/* initialize nulls and values */
for (i = 0; i < Natts_pg_namespace; i++)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL;
}
namestrcpy(&nname, nspName);
values[Anum_pg_namespace_nspname - 1] = NameGetDatum(&nname);
values[Anum_pg_namespace_nspowner - 1] = ObjectIdGetDatum(ownerId);
- nulls[Anum_pg_namespace_nspacl - 1] = 'n';
+ nulls[Anum_pg_namespace_nspacl - 1] = true;
nspdesc = heap_open(NamespaceRelationId, RowExclusiveLock);
tupDesc = nspdesc->rd_att;
- tup = heap_formtuple(tupDesc, values, nulls);
+ tup = heap_form_tuple(tupDesc, values, nulls);
nspoid = simple_heap_insert(nspdesc, tup);
Assert(OidIsValid(nspoid));
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index 0ab20ff618..71dc8b328c 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -207,7 +207,7 @@ OperatorShellMake(const char *operatorName,
int i;
HeapTuple tup;
Datum values[Natts_pg_operator];
- char nulls[Natts_pg_operator];
+ bool nulls[Natts_pg_operator];
NameData oname;
TupleDesc tupDesc;
@@ -225,7 +225,7 @@ OperatorShellMake(const char *operatorName,
*/
for (i = 0; i < Natts_pg_operator; ++i)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL; /* redundant, but safe */
}
@@ -259,7 +259,7 @@ OperatorShellMake(const char *operatorName,
/*
* create a new operator tuple
*/
- tup = heap_formtuple(tupDesc, values, nulls);
+ tup = heap_form_tuple(tupDesc, values, nulls);
/*
* insert our "shell" operator tuple
@@ -336,8 +336,8 @@ OperatorCreate(const char *operatorName,
{
Relation pg_operator_desc;
HeapTuple tup;
- char nulls[Natts_pg_operator];
- char replaces[Natts_pg_operator];
+ bool nulls[Natts_pg_operator];
+ bool replaces[Natts_pg_operator];
Datum values[Natts_pg_operator];
Oid operatorObjectId;
bool operatorAlreadyDefined;
@@ -483,8 +483,8 @@ OperatorCreate(const char *operatorName,
for (i = 0; i < Natts_pg_operator; ++i)
{
values[i] = (Datum) NULL;
- replaces[i] = 'r';
- nulls[i] = ' ';
+ replaces[i] = true;
+ nulls[i] = false;
}
i = 0;
@@ -518,7 +518,7 @@ OperatorCreate(const char *operatorName,
elog(ERROR, "cache lookup failed for operator %u",
operatorObjectId);
- tup = heap_modifytuple(tup,
+ tup = heap_modify_tuple(tup,
RelationGetDescr(pg_operator_desc),
values,
nulls,
@@ -529,7 +529,7 @@ OperatorCreate(const char *operatorName,
else
{
tupDesc = pg_operator_desc->rd_att;
- tup = heap_formtuple(tupDesc, values, nulls);
+ tup = heap_form_tuple(tupDesc, values, nulls);
operatorObjectId = simple_heap_insert(pg_operator_desc, tup);
}
@@ -639,15 +639,15 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
int i;
Relation pg_operator_desc;
HeapTuple tup;
- char nulls[Natts_pg_operator];
- char replaces[Natts_pg_operator];
+ bool nulls[Natts_pg_operator];
+ bool replaces[Natts_pg_operator];
Datum values[Natts_pg_operator];
for (i = 0; i < Natts_pg_operator; ++i)
{
values[i] = (Datum) 0;
- replaces[i] = ' ';
- nulls[i] = ' ';
+ replaces[i] = false;
+ nulls[i] = false;
}
/*
@@ -680,16 +680,16 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
if (!OidIsValid(t->oprnegate))
{
values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(baseId);
- replaces[Anum_pg_operator_oprnegate - 1] = 'r';
+ replaces[Anum_pg_operator_oprnegate - 1] = true;
}
if (!OidIsValid(t->oprcom))
{
values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(baseId);
- replaces[Anum_pg_operator_oprcom - 1] = 'r';
+ replaces[Anum_pg_operator_oprcom - 1] = true;
}
- tup = heap_modifytuple(tup,
+ tup = heap_modify_tuple(tup,
RelationGetDescr(pg_operator_desc),
values,
nulls,
@@ -712,9 +712,9 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
!(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprcom)))
{
values[Anum_pg_operator_oprcom - 1] = ObjectIdGetDatum(baseId);
- replaces[Anum_pg_operator_oprcom - 1] = 'r';
+ replaces[Anum_pg_operator_oprcom - 1] = true;
- tup = heap_modifytuple(tup,
+ tup = heap_modify_tuple(tup,
RelationGetDescr(pg_operator_desc),
values,
nulls,
@@ -725,7 +725,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
CatalogUpdateIndexes(pg_operator_desc, tup);
values[Anum_pg_operator_oprcom - 1] = (Datum) NULL;
- replaces[Anum_pg_operator_oprcom - 1] = ' ';
+ replaces[Anum_pg_operator_oprcom - 1] = false;
}
/* check and update the negator, if necessary */
@@ -738,9 +738,9 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
!(OidIsValid(((Form_pg_operator) GETSTRUCT(tup))->oprnegate)))
{
values[Anum_pg_operator_oprnegate - 1] = ObjectIdGetDatum(baseId);
- replaces[Anum_pg_operator_oprnegate - 1] = 'r';
+ replaces[Anum_pg_operator_oprnegate - 1] = true;
- tup = heap_modifytuple(tup,
+ tup = heap_modify_tuple(tup,
RelationGetDescr(pg_operator_desc),
values,
nulls,
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index 12e71ac23a..5681064750 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -89,9 +89,9 @@ ProcedureCreate(const char *procedureName,
Relation rel;
HeapTuple tup;
HeapTuple oldtup;
- char nulls[Natts_pg_proc];
+ bool nulls[Natts_pg_proc];
Datum values[Natts_pg_proc];
- char replaces[Natts_pg_proc];
+ bool replaces[Natts_pg_proc];
Oid relid;
NameData procname;
TupleDesc tupDesc;
@@ -276,9 +276,9 @@ ProcedureCreate(const char *procedureName,
for (i = 0; i < Natts_pg_proc; ++i)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) 0;
- replaces[i] = 'r';
+ replaces[i] = true;
}
namestrcpy(&procname, procedureName);
@@ -300,26 +300,26 @@ ProcedureCreate(const char *procedureName,
if (allParameterTypes != PointerGetDatum(NULL))
values[Anum_pg_proc_proallargtypes - 1] = allParameterTypes;
else
- nulls[Anum_pg_proc_proallargtypes - 1] = 'n';
+ nulls[Anum_pg_proc_proallargtypes - 1] = true;
if (parameterModes != PointerGetDatum(NULL))
values[Anum_pg_proc_proargmodes - 1] = parameterModes;
else
- nulls[Anum_pg_proc_proargmodes - 1] = 'n';
+ nulls[Anum_pg_proc_proargmodes - 1] = true;
if (parameterNames != PointerGetDatum(NULL))
values[Anum_pg_proc_proargnames - 1] = parameterNames;
else
- nulls[Anum_pg_proc_proargnames - 1] = 'n';
+ nulls[Anum_pg_proc_proargnames - 1] = true;
values[Anum_pg_proc_prosrc - 1] = CStringGetTextDatum(prosrc);
if (probin)
values[Anum_pg_proc_probin - 1] = CStringGetTextDatum(probin);
else
- nulls[Anum_pg_proc_probin - 1] = 'n';
+ nulls[Anum_pg_proc_probin - 1] = true;
if (proconfig != PointerGetDatum(NULL))
values[Anum_pg_proc_proconfig - 1] = proconfig;
else
- nulls[Anum_pg_proc_proconfig - 1] = 'n';
+ nulls[Anum_pg_proc_proconfig - 1] = true;
/* start out with empty permissions */
- nulls[Anum_pg_proc_proacl - 1] = 'n';
+ nulls[Anum_pg_proc_proacl - 1] = true;
rel = heap_open(ProcedureRelationId, RowExclusiveLock);
tupDesc = RelationGetDescr(rel);
@@ -396,11 +396,11 @@ ProcedureCreate(const char *procedureName,
}
/* do not change existing ownership or permissions, either */
- replaces[Anum_pg_proc_proowner - 1] = ' ';
- replaces[Anum_pg_proc_proacl - 1] = ' ';
+ replaces[Anum_pg_proc_proowner - 1] = false;
+ replaces[Anum_pg_proc_proacl - 1] = false;
/* Okay, do it... */
- tup = heap_modifytuple(oldtup, tupDesc, values, nulls, replaces);
+ tup = heap_modify_tuple(oldtup, tupDesc, values, nulls, replaces);
simple_heap_update(rel, &tup->t_self, tup);
ReleaseSysCache(oldtup);
@@ -409,7 +409,7 @@ ProcedureCreate(const char *procedureName,
else
{
/* Creating a new procedure */
- tup = heap_formtuple(tupDesc, values, nulls);
+ tup = heap_form_tuple(tupDesc, values, nulls);
simple_heap_insert(rel, tup);
is_update = false;
}
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index 9fb0b0c9ef..69bb4ca474 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -239,7 +239,7 @@ shdepChangeDep(Relation sdepRel, Oid classid, Oid objid,
Datum values[Natts_pg_shdepend];
bool nulls[Natts_pg_shdepend];
- memset(nulls, 0, sizeof(nulls));
+ memset(nulls, false, sizeof(nulls));
values[Anum_pg_shdepend_dbid - 1] = ObjectIdGetDatum(dbid);
values[Anum_pg_shdepend_classid - 1] = ObjectIdGetDatum(classid);
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 58fc2808eb..a70f5024b6 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -54,7 +54,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace)
int i;
HeapTuple tup;
Datum values[Natts_pg_type];
- char nulls[Natts_pg_type];
+ bool nulls[Natts_pg_type];
Oid typoid;
NameData name;
@@ -71,7 +71,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace)
*/
for (i = 0; i < Natts_pg_type; ++i)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL; /* redundant, but safe */
}
@@ -111,13 +111,13 @@ TypeShellMake(const char *typeName, Oid typeNamespace)
values[i++] = ObjectIdGetDatum(InvalidOid); /* typbasetype */
values[i++] = Int32GetDatum(-1); /* typtypmod */
values[i++] = Int32GetDatum(0); /* typndims */
- nulls[i++] = 'n'; /* typdefaultbin */
- nulls[i++] = 'n'; /* typdefault */
+ nulls[i++] = true; /* typdefaultbin */
+ nulls[i++] = true; /* typdefault */
/*
* create a new type tuple
*/
- tup = heap_formtuple(tupDesc, values, nulls);
+ tup = heap_form_tuple(tupDesc, values, nulls);
/*
* insert the tuple in the relation and get the tuple's oid.
@@ -202,8 +202,8 @@ TypeCreate(Oid newTypeOid,
Oid typeObjectId;
bool rebuildDeps = false;
HeapTuple tup;
- char nulls[Natts_pg_type];
- char replaces[Natts_pg_type];
+ bool nulls[Natts_pg_type];
+ bool replaces[Natts_pg_type];
Datum values[Natts_pg_type];
NameData name;
int i;
@@ -294,12 +294,12 @@ TypeCreate(Oid newTypeOid,
errmsg("fixed-size types must have storage PLAIN")));
/*
- * initialize arrays needed for heap_formtuple or heap_modifytuple
+ * initialize arrays needed for heap_form_tuple or heap_modify_tuple
*/
for (i = 0; i < Natts_pg_type; ++i)
{
- nulls[i] = ' ';
- replaces[i] = 'r';
+ nulls[i] = false;
+ replaces[i] = true;
values[i] = (Datum) 0;
}
@@ -342,7 +342,7 @@ TypeCreate(Oid newTypeOid,
if (defaultTypeBin)
values[i] = CStringGetTextDatum(defaultTypeBin);
else
- nulls[i] = 'n';
+ nulls[i] = true;
i++; /* typdefaultbin */
/*
@@ -351,7 +351,7 @@ TypeCreate(Oid newTypeOid,
if (defaultTypeValue)
values[i] = CStringGetTextDatum(defaultTypeValue);
else
- nulls[i] = 'n';
+ nulls[i] = true;
i++; /* typdefault */
/*
@@ -390,7 +390,7 @@ TypeCreate(Oid newTypeOid,
/*
* Okay to update existing shell type tuple
*/
- tup = heap_modifytuple(tup,
+ tup = heap_modify_tuple(tup,
RelationGetDescr(pg_type_desc),
values,
nulls,
@@ -404,7 +404,7 @@ TypeCreate(Oid newTypeOid,
}
else
{
- tup = heap_formtuple(RelationGetDescr(pg_type_desc),
+ tup = heap_form_tuple(RelationGetDescr(pg_type_desc),
values,
nulls);
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 0e78b42d07..9cfec27d5f 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -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);
}
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 5d26879e6a..99da39f825 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -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 */
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index 67bed6c7ed..8d249e175d 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -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);
}
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index be91132a3e..c9f78a2b1b 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -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);
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 600636e037..063749b73c 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -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);
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 5e8e788186..b5f9dba9dc 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -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);
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index 733b0269af..fbbbe9599f 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -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);
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index 1dbe8a7a76..70d9ae3395 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -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);
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index 4c617a5019..4868f20e4a 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -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);
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 19b5351ba9..d126b801a8 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -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.
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index ee1b5849f5..ab2b8bf9a3 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -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);
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index fd459fc0c1..32d3c5a172 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -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);
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 8def9b8e83..f6872c552b 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -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);
diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c
index 47e113a74f..1e01849285 100644
--- a/src/backend/commands/tsearchcmds.c
+++ b/src/backend/commands/tsearchcmds.c
@@ -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);
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index bee300c797..4c5c63be8f 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -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);
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 69c2a49f37..6f800b2a34 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -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);
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 42d550b223..c5f4eac208 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -1126,12 +1126,12 @@ BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
TupleDesc tupdesc = attinmeta->tupdesc;
int natts = tupdesc->natts;
Datum *dvalues;
- char *nulls;
+ bool *nulls;
int i;
HeapTuple tuple;
dvalues = (Datum *) palloc(natts * sizeof(Datum));
- nulls = (char *) palloc(natts * sizeof(char));
+ nulls = (bool *) palloc(natts * sizeof(bool));
/* Call the "in" function for each non-dropped attribute */
for (i = 0; i < natts; i++)
@@ -1144,22 +1144,22 @@ BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
attinmeta->attioparams[i],
attinmeta->atttypmods[i]);
if (values[i] != NULL)
- nulls[i] = ' ';
+ nulls[i] = false;
else
- nulls[i] = 'n';
+ nulls[i] = true;
}
else
{
/* Handle dropped attributes by setting to NULL */
dvalues[i] = (Datum) 0;
- nulls[i] = 'n';
+ nulls[i] = true;
}
}
/*
* Form a tuple
*/
- tuple = heap_formtuple(tupdesc, dvalues, nulls);
+ tuple = heap_form_tuple(tupdesc, dvalues, nulls);
/*
* Release locally palloc'd space. XXX would probably be good to pfree
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index a4db48fc86..e1578338d7 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -627,7 +627,7 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
HeapTuple mtuple;
int numberOfAttributes;
Datum *v;
- char *n;
+ bool *n;
int i;
if (rel == NULL || tuple == NULL || natts < 0 || attnum == NULL || Values == NULL)
@@ -645,10 +645,10 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
SPI_result = 0;
numberOfAttributes = rel->rd_att->natts;
v = (Datum *) palloc(numberOfAttributes * sizeof(Datum));
- n = (char *) palloc(numberOfAttributes * sizeof(char));
+ n = (bool *) palloc(numberOfAttributes * sizeof(bool));
/* fetch old values and nulls */
- heap_deformtuple(tuple, rel->rd_att, v, n);
+ heap_deform_tuple(tuple, rel->rd_att, v, n);
/* replace values and nulls */
for (i = 0; i < natts; i++)
@@ -656,12 +656,12 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
if (attnum[i] <= 0 || attnum[i] > numberOfAttributes)
break;
v[attnum[i] - 1] = Values[i];
- n[attnum[i] - 1] = (Nulls && Nulls[i] == 'n') ? 'n' : ' ';
+ n[attnum[i] - 1] = (Nulls && Nulls[i] == 'n') ? true : false;
}
if (i == natts) /* no errors in *attnum */
{
- mtuple = heap_formtuple(rel->rd_att, v, n);
+ mtuple = heap_form_tuple(rel->rd_att, v, n);
/*
* copy the identification info of the old tuple: t_ctid, t_self, and
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index 7861e8982a..3136410458 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -68,7 +68,7 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
}
/*
- * for heap_formtuple to work, the targetlist must match the exact order
+ * for heap_form_tuple to work, the targetlist must match the exact order
* of the attributes. We also need to fill in any missing attributes. -ay
* 10/94
*/
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index d254f5330b..70e5c04714 100644
--- a/src/backend/rewrite/rewriteDefine.c
+++ b/src/backend/rewrite/rewriteDefine.c
@@ -60,8 +60,8 @@ InsertRule(char *rulname,
char *actiontree = nodeToString((Node *) action);
int i;
Datum values[Natts_pg_rewrite];
- char nulls[Natts_pg_rewrite];
- char replaces[Natts_pg_rewrite];
+ bool nulls[Natts_pg_rewrite];
+ bool replaces[Natts_pg_rewrite];
NameData rname;
Relation pg_rewrite_desc;
HeapTuple tup,
@@ -74,7 +74,7 @@ InsertRule(char *rulname,
/*
* Set up *nulls and *values arrays
*/
- MemSet(nulls, ' ', sizeof(nulls));
+ MemSet(nulls, false, sizeof(nulls));
i = 0;
namestrcpy(&rname, rulname);
@@ -111,14 +111,14 @@ InsertRule(char *rulname,
/*
* When replacing, we don't need to replace every attribute
*/
- MemSet(replaces, ' ', sizeof(replaces));
- replaces[Anum_pg_rewrite_ev_attr - 1] = 'r';
- replaces[Anum_pg_rewrite_ev_type - 1] = 'r';
- replaces[Anum_pg_rewrite_is_instead - 1] = 'r';
- replaces[Anum_pg_rewrite_ev_qual - 1] = 'r';
- replaces[Anum_pg_rewrite_ev_action - 1] = 'r';
-
- tup = heap_modifytuple(oldtup, RelationGetDescr(pg_rewrite_desc),
+ MemSet(replaces, false, sizeof(replaces));
+ replaces[Anum_pg_rewrite_ev_attr - 1] = true;
+ replaces[Anum_pg_rewrite_ev_type - 1] = true;
+ replaces[Anum_pg_rewrite_is_instead - 1] = true;
+ replaces[Anum_pg_rewrite_ev_qual - 1] = true;
+ replaces[Anum_pg_rewrite_ev_action - 1] = true;
+
+ tup = heap_modify_tuple(oldtup, RelationGetDescr(pg_rewrite_desc),
values, nulls, replaces);
simple_heap_update(pg_rewrite_desc, &tup->t_self, tup);
@@ -130,7 +130,7 @@ InsertRule(char *rulname,
}
else
{
- tup = heap_formtuple(pg_rewrite_desc->rd_att, values, nulls);
+ tup = heap_form_tuple(pg_rewrite_desc->rd_att, values, nulls);
rewriteObjectId = simple_heap_insert(pg_rewrite_desc, tup);
}
diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c
index 867dd65a4e..494d3870a5 100644
--- a/src/backend/storage/large_object/inv_api.c
+++ b/src/backend/storage/large_object/inv_api.c
@@ -522,8 +522,8 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes)
char *workb = VARDATA(&workbuf.hdr);
HeapTuple newtup;
Datum values[Natts_pg_largeobject];
- char nulls[Natts_pg_largeobject];
- char replace[Natts_pg_largeobject];
+ bool nulls[Natts_pg_largeobject];
+ bool replace[Natts_pg_largeobject];
CatalogIndexState indstate;
Assert(PointerIsValid(obj_desc));
@@ -627,11 +627,11 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes)
* Form and insert updated tuple
*/
memset(values, 0, sizeof(values));
- memset(nulls, ' ', sizeof(nulls));
- memset(replace, ' ', sizeof(replace));
+ memset(nulls, false, sizeof(nulls));
+ memset(replace, false, sizeof(replace));
values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf);
- replace[Anum_pg_largeobject_data - 1] = 'r';
- newtup = heap_modifytuple(oldtuple, RelationGetDescr(lo_heap_r),
+ replace[Anum_pg_largeobject_data - 1] = true;
+ newtup = heap_modify_tuple(oldtuple, RelationGetDescr(lo_heap_r),
values, nulls, replace);
simple_heap_update(lo_heap_r, &newtup->t_self, newtup);
CatalogIndexInsert(indstate, newtup);
@@ -671,11 +671,11 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes)
* Form and insert updated tuple
*/
memset(values, 0, sizeof(values));
- memset(nulls, ' ', sizeof(nulls));
+ memset(nulls, false, sizeof(nulls));
values[Anum_pg_largeobject_loid - 1] = ObjectIdGetDatum(obj_desc->id);
values[Anum_pg_largeobject_pageno - 1] = Int32GetDatum(pageno);
values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf);
- newtup = heap_formtuple(lo_heap_r->rd_att, values, nulls);
+ newtup = heap_form_tuple(lo_heap_r->rd_att, values, nulls);
simple_heap_insert(lo_heap_r, newtup);
CatalogIndexInsert(indstate, newtup);
heap_freetuple(newtup);
@@ -714,8 +714,8 @@ inv_truncate(LargeObjectDesc *obj_desc, int len)
char *workb = VARDATA(&workbuf.hdr);
HeapTuple newtup;
Datum values[Natts_pg_largeobject];
- char nulls[Natts_pg_largeobject];
- char replace[Natts_pg_largeobject];
+ bool nulls[Natts_pg_largeobject];
+ bool replace[Natts_pg_largeobject];
CatalogIndexState indstate;
Assert(PointerIsValid(obj_desc));
@@ -796,11 +796,11 @@ inv_truncate(LargeObjectDesc *obj_desc, int len)
* Form and insert updated tuple
*/
memset(values, 0, sizeof(values));
- memset(nulls, ' ', sizeof(nulls));
- memset(replace, ' ', sizeof(replace));
+ memset(nulls, false, sizeof(nulls));
+ memset(replace, false, sizeof(replace));
values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf);
- replace[Anum_pg_largeobject_data - 1] = 'r';
- newtup = heap_modifytuple(oldtuple, RelationGetDescr(lo_heap_r),
+ replace[Anum_pg_largeobject_data - 1] = true;
+ newtup = heap_modify_tuple(oldtuple, RelationGetDescr(lo_heap_r),
values, nulls, replace);
simple_heap_update(lo_heap_r, &newtup->t_self, newtup);
CatalogIndexInsert(indstate, newtup);
@@ -831,11 +831,11 @@ inv_truncate(LargeObjectDesc *obj_desc, int len)
* Form and insert new tuple
*/
memset(values, 0, sizeof(values));
- memset(nulls, ' ', sizeof(nulls));
+ memset(nulls, false, sizeof(nulls));
values[Anum_pg_largeobject_loid - 1] = ObjectIdGetDatum(obj_desc->id);
values[Anum_pg_largeobject_pageno - 1] = Int32GetDatum(pageno);
values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf);
- newtup = heap_formtuple(lo_heap_r->rd_att, values, nulls);
+ newtup = heap_form_tuple(lo_heap_r->rd_att, values, nulls);
simple_heap_insert(lo_heap_r, newtup);
CatalogIndexInsert(indstate, newtup);
heap_freetuple(newtup);
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c
index 09cf1df9f4..65e95b6318 100644
--- a/src/backend/utils/adt/lockfuncs.c
+++ b/src/backend/utils/adt/lockfuncs.c
@@ -144,7 +144,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
const char *locktypename;
char tnbuf[32];
Datum values[14];
- char nulls[14];
+ bool nulls[14];
HeapTuple tuple;
Datum result;
@@ -203,7 +203,7 @@ pg_lock_status(PG_FUNCTION_ARGS)
* Form tuple with appropriate data.
*/
MemSet(values, 0, sizeof(values));
- MemSet(nulls, ' ', sizeof(nulls));
+ MemSet(nulls, false, sizeof(nulls));
if (lock->tag.locktag_type <= LOCKTAG_LAST_TYPE)
locktypename = LockTagTypeNames[lock->tag.locktag_type];
@@ -221,58 +221,58 @@ pg_lock_status(PG_FUNCTION_ARGS)
case LOCKTAG_RELATION_EXTEND:
values[1] = ObjectIdGetDatum(lock->tag.locktag_field1);
values[2] = ObjectIdGetDatum(lock->tag.locktag_field2);
- nulls[3] = 'n';
- nulls[4] = 'n';
- nulls[5] = 'n';
- nulls[6] = 'n';
- nulls[7] = 'n';
- nulls[8] = 'n';
- nulls[9] = 'n';
+ nulls[3] = true;
+ nulls[4] = true;
+ nulls[5] = true;
+ nulls[6] = true;
+ nulls[7] = true;
+ nulls[8] = true;
+ nulls[9] = true;
break;
case LOCKTAG_PAGE:
values[1] = ObjectIdGetDatum(lock->tag.locktag_field1);
values[2] = ObjectIdGetDatum(lock->tag.locktag_field2);
values[3] = UInt32GetDatum(lock->tag.locktag_field3);
- nulls[4] = 'n';
- nulls[5] = 'n';
- nulls[6] = 'n';
- nulls[7] = 'n';
- nulls[8] = 'n';
- nulls[9] = 'n';
+ nulls[4] = true;
+ nulls[5] = true;
+ nulls[6] = true;
+ nulls[7] = true;
+ nulls[8] = true;
+ nulls[9] = true;
break;
case LOCKTAG_TUPLE:
values[1] = ObjectIdGetDatum(lock->tag.locktag_field1);
values[2] = ObjectIdGetDatum(lock->tag.locktag_field2);
values[3] = UInt32GetDatum(lock->tag.locktag_field3);
values[4] = UInt16GetDatum(lock->tag.locktag_field4);
- nulls[5] = 'n';
- nulls[6] = 'n';
- nulls[7] = 'n';
- nulls[8] = 'n';
- nulls[9] = 'n';
+ nulls[5] = true;
+ nulls[6] = true;
+ nulls[7] = true;
+ nulls[8] = true;
+ nulls[9] = true;
break;
case LOCKTAG_TRANSACTION:
values[6] = TransactionIdGetDatum(lock->tag.locktag_field1);
- nulls[1] = 'n';
- nulls[2] = 'n';
- nulls[3] = 'n';
- nulls[4] = 'n';
- nulls[5] = 'n';
- nulls[7] = 'n';
- nulls[8] = 'n';
- nulls[9] = 'n';
+ nulls[1] = true;
+ nulls[2] = true;
+ nulls[3] = true;
+ nulls[4] = true;
+ nulls[5] = true;
+ nulls[7] = true;
+ nulls[8] = true;
+ nulls[9] = true;
break;
case LOCKTAG_VIRTUALTRANSACTION:
values[5] = VXIDGetDatum(lock->tag.locktag_field1,
lock->tag.locktag_field2);
- nulls[1] = 'n';
- nulls[2] = 'n';
- nulls[3] = 'n';
- nulls[4] = 'n';
- nulls[6] = 'n';
- nulls[7] = 'n';
- nulls[8] = 'n';
- nulls[9] = 'n';
+ nulls[1] = true;
+ nulls[2] = true;
+ nulls[3] = true;
+ nulls[4] = true;
+ nulls[6] = true;
+ nulls[7] = true;
+ nulls[8] = true;
+ nulls[9] = true;
break;
case LOCKTAG_OBJECT:
case LOCKTAG_USERLOCK:
@@ -282,11 +282,11 @@ pg_lock_status(PG_FUNCTION_ARGS)
values[7] = ObjectIdGetDatum(lock->tag.locktag_field2);
values[8] = ObjectIdGetDatum(lock->tag.locktag_field3);
values[9] = Int16GetDatum(lock->tag.locktag_field4);
- nulls[2] = 'n';
- nulls[3] = 'n';
- nulls[4] = 'n';
- nulls[5] = 'n';
- nulls[6] = 'n';
+ nulls[2] = true;
+ nulls[3] = true;
+ nulls[4] = true;
+ nulls[5] = true;
+ nulls[6] = true;
break;
}
@@ -294,11 +294,11 @@ pg_lock_status(PG_FUNCTION_ARGS)
if (proc->pid != 0)
values[11] = Int32GetDatum(proc->pid);
else
- nulls[11] = 'n';
+ nulls[11] = true;
values[12] = CStringGetTextDatum(GetLockmodeName(LOCK_LOCKMETHOD(*lock), mode));
values[13] = BoolGetDatum(granted);
- tuple = heap_formtuple(funcctx->tuple_desc, values, nulls);
+ tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
result = HeapTupleGetDatum(tuple);
SRF_RETURN_NEXT(funcctx, result);
}
diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c
index 9d5c385453..67bed9c3bf 100644
--- a/src/backend/utils/adt/rowtypes.c
+++ b/src/backend/utils/adt/rowtypes.c
@@ -83,7 +83,7 @@ record_in(PG_FUNCTION_ARGS)
int i;
char *ptr;
Datum *values;
- char *nulls;
+ bool *nulls;
StringInfoData buf;
/*
@@ -129,7 +129,7 @@ record_in(PG_FUNCTION_ARGS)
}
values = (Datum *) palloc(ncolumns * sizeof(Datum));
- nulls = (char *) palloc(ncolumns * sizeof(char));
+ nulls = (bool *) palloc(ncolumns * sizeof(bool));
/*
* Scan the string. We use "buf" to accumulate the de-quoted data for
@@ -157,7 +157,7 @@ record_in(PG_FUNCTION_ARGS)
if (tupdesc->attrs[i]->attisdropped)
{
values[i] = (Datum) 0;
- nulls[i] = 'n';
+ nulls[i] = true;
continue;
}
@@ -178,7 +178,7 @@ record_in(PG_FUNCTION_ARGS)
if (*ptr == ',' || *ptr == ')')
{
column_data = NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
}
else
{
@@ -223,7 +223,7 @@ record_in(PG_FUNCTION_ARGS)
}
column_data = buf.data;
- nulls[i] = ' ';
+ nulls[i] = false;
}
/*
@@ -264,10 +264,10 @@ record_in(PG_FUNCTION_ARGS)
errmsg("malformed record literal: \"%s\"", string),
errdetail("Junk after right parenthesis.")));
- tuple = heap_formtuple(tupdesc, values, nulls);
+ tuple = heap_form_tuple(tupdesc, values, nulls);
/*
- * We cannot return tuple->t_data because heap_formtuple allocates it as
+ * We cannot return tuple->t_data because heap_form_tuple allocates it as
* part of a larger chunk, and our caller may expect to be able to pfree
* our result. So must copy the info into a new palloc chunk.
*/
@@ -299,7 +299,7 @@ record_out(PG_FUNCTION_ARGS)
int ncolumns;
int i;
Datum *values;
- char *nulls;
+ bool *nulls;
StringInfoData buf;
/* Extract type info from the tuple itself */
@@ -343,10 +343,10 @@ record_out(PG_FUNCTION_ARGS)
}
values = (Datum *) palloc(ncolumns * sizeof(Datum));
- nulls = (char *) palloc(ncolumns * sizeof(char));
+ nulls = (bool *) palloc(ncolumns * sizeof(bool));
/* Break down the tuple into fields */
- heap_deformtuple(&tuple, tupdesc, values, nulls);
+ heap_deform_tuple(&tuple, tupdesc, values, nulls);
/* And build the result string */
initStringInfo(&buf);
@@ -369,7 +369,7 @@ record_out(PG_FUNCTION_ARGS)
appendStringInfoChar(&buf, ',');
needComma = true;
- if (nulls[i] == 'n')
+ if (nulls[i])
{
/* emit nothing... */
continue;
@@ -453,7 +453,7 @@ record_recv(PG_FUNCTION_ARGS)
int validcols;
int i;
Datum *values;
- char *nulls;
+ bool *nulls;
/*
* Use the passed type unless it's RECORD; we can't support input of
@@ -498,7 +498,7 @@ record_recv(PG_FUNCTION_ARGS)
}
values = (Datum *) palloc(ncolumns * sizeof(Datum));
- nulls = (char *) palloc(ncolumns * sizeof(char));
+ nulls = (bool *) palloc(ncolumns * sizeof(bool));
/* Fetch number of columns user thinks it has */
usercols = pq_getmsgint(buf, 4);
@@ -531,7 +531,7 @@ record_recv(PG_FUNCTION_ARGS)
if (tupdesc->attrs[i]->attisdropped)
{
values[i] = (Datum) 0;
- nulls[i] = 'n';
+ nulls[i] = true;
continue;
}
@@ -554,7 +554,7 @@ record_recv(PG_FUNCTION_ARGS)
{
/* -1 length means NULL */
bufptr = NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
csave = 0; /* keep compiler quiet */
}
else
@@ -576,7 +576,7 @@ record_recv(PG_FUNCTION_ARGS)
buf->data[buf->cursor] = '\0';
bufptr = &item_buf;
- nulls[i] = ' ';
+ nulls[i] = false;
}
/* Now call the column's receiveproc */
@@ -608,10 +608,10 @@ record_recv(PG_FUNCTION_ARGS)
}
}
- tuple = heap_formtuple(tupdesc, values, nulls);
+ tuple = heap_form_tuple(tupdesc, values, nulls);
/*
- * We cannot return tuple->t_data because heap_formtuple allocates it as
+ * We cannot return tuple->t_data because heap_form_tuple allocates it as
* part of a larger chunk, and our caller may expect to be able to pfree
* our result. So must copy the info into a new palloc chunk.
*/
@@ -642,7 +642,7 @@ record_send(PG_FUNCTION_ARGS)
int validcols;
int i;
Datum *values;
- char *nulls;
+ bool *nulls;
StringInfoData buf;
/* Extract type info from the tuple itself */
@@ -686,10 +686,10 @@ record_send(PG_FUNCTION_ARGS)
}
values = (Datum *) palloc(ncolumns * sizeof(Datum));
- nulls = (char *) palloc(ncolumns * sizeof(char));
+ nulls = (bool *) palloc(ncolumns * sizeof(bool));
/* Break down the tuple into fields */
- heap_deformtuple(&tuple, tupdesc, values, nulls);
+ heap_deform_tuple(&tuple, tupdesc, values, nulls);
/* And build the result string */
pq_begintypsend(&buf);
@@ -715,7 +715,7 @@ record_send(PG_FUNCTION_ARGS)
pq_sendint(&buf, column_type, sizeof(Oid));
- if (nulls[i] == 'n')
+ if (nulls[i])
{
/* emit -1 data length to signify a NULL */
pq_sendint(&buf, -1, 4);
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index ded8020196..e7c864c06d 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -1673,16 +1673,16 @@ build_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys)
HeapTuple ntp;
TupleDesc tupDesc = cache->cc_tupdesc;
Datum *values;
- char *nulls;
+ bool *nulls;
Oid tupOid = InvalidOid;
NameData tempNames[4];
int i;
values = (Datum *) palloc(tupDesc->natts * sizeof(Datum));
- nulls = (char *) palloc(tupDesc->natts * sizeof(char));
+ nulls = (bool *) palloc(tupDesc->natts * sizeof(bool));
memset(values, 0, tupDesc->natts * sizeof(Datum));
- memset(nulls, 'n', tupDesc->natts * sizeof(char));
+ memset(nulls, true, tupDesc->natts * sizeof(bool));
for (i = 0; i < nkeys; i++)
{
@@ -1695,7 +1695,7 @@ build_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys)
* Here we must be careful in case the caller passed a C string
* where a NAME is wanted: convert the given argument to a
* correctly padded NAME. Otherwise the memcpy() done in
- * heap_formtuple could fall off the end of memory.
+ * heap_form_tuple could fall off the end of memory.
*/
if (cache->cc_isname[i])
{
@@ -1705,7 +1705,7 @@ build_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys)
keyval = NameGetDatum(newval);
}
values[attindex - 1] = keyval;
- nulls[attindex - 1] = ' ';
+ nulls[attindex - 1] = false;
}
else
{
@@ -1714,7 +1714,7 @@ build_dummy_tuple(CatCache *cache, int nkeys, ScanKey skeys)
}
}
- ntp = heap_formtuple(tupDesc, values, nulls);
+ ntp = heap_form_tuple(tupDesc, values, nulls);
if (tupOid != InvalidOid)
HeapTupleSetOid(ntp, tupOid);
diff --git a/src/include/access/htup.h b/src/include/access/htup.h
index 2a49ad54ca..592359326d 100644
--- a/src/include/access/htup.h
+++ b/src/include/access/htup.h
@@ -823,20 +823,21 @@ extern HeapTuple heap_copytuple(HeapTuple tuple);
extern void heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest);
extern HeapTuple heap_form_tuple(TupleDesc tupleDescriptor,
Datum *values, bool *isnull);
-extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
- Datum *values, char *nulls);
extern HeapTuple heap_modify_tuple(HeapTuple tuple,
TupleDesc tupleDesc,
Datum *replValues,
bool *replIsnull,
bool *doReplace);
+extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
+ Datum *values, bool *isnull);
+/* these three are deprecated versions of the three above: */
+extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
+ Datum *values, char *nulls);
extern HeapTuple heap_modifytuple(HeapTuple tuple,
TupleDesc tupleDesc,
Datum *replValues,
char *replNulls,
char *replActions);
-extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
- Datum *values, bool *isnull);
extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc,
Datum *values, char *nulls);
extern void heap_freetuple(HeapTuple htup);
diff --git a/src/include/funcapi.h b/src/include/funcapi.h
index 2adfbec5ad..90f62ab816 100644
--- a/src/include/funcapi.h
+++ b/src/include/funcapi.h
@@ -113,7 +113,7 @@ typedef struct FuncCallContext
*
* tuple_desc is for use when returning tuples (i.e. composite data types)
* and is only needed if you are going to build the tuples with
- * heap_formtuple() rather than with BuildTupleFromCStrings(). Note that
+ * heap_form_tuple() rather than with BuildTupleFromCStrings(). Note that
* the TupleDesc pointer stored here should usually have been run through
* BlessTupleDesc() first.
*/
@@ -187,7 +187,7 @@ extern TupleDesc build_function_result_tupdesc_t(HeapTuple procTuple);
* External declarations:
* TupleDesc BlessTupleDesc(TupleDesc tupdesc) - "Bless" a completed tuple
* descriptor so that it can be used to return properly labeled tuples.
- * You need to call this if you are going to use heap_formtuple directly.
+ * You need to call this if you are going to use heap_form_tuple directly.
* TupleDescGetAttInMetadata does it for you, however, so no need to call
* it if you call TupleDescGetAttInMetadata.
* AttInMetadata *TupleDescGetAttInMetadata(TupleDesc tupdesc) - Build an
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index ed2655ab23..b4b6714cb4 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -3578,9 +3578,9 @@ exec_assign_value(PLpgSQL_execstate *estate,
int fno;
HeapTuple newtup;
int natts;
- int i;
Datum *values;
- char *nulls;
+ bool *nulls;
+ bool *replaces;
void *mustfree;
bool attisnull;
Oid atttype;
@@ -3602,10 +3602,11 @@ exec_assign_value(PLpgSQL_execstate *estate,
/*
* Get the number of the records field to change and the
- * number of attributes in the tuple.
+ * number of attributes in the tuple. Note: disallow
+ * system column names because the code below won't cope.
*/
fno = SPI_fnumber(rec->tupdesc, recfield->fieldname);
- if (fno == SPI_ERROR_NOATTRIBUTE)
+ if (fno <= 0)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("record \"%s\" has no field \"%s\"",
@@ -3614,24 +3615,16 @@ exec_assign_value(PLpgSQL_execstate *estate,
natts = rec->tupdesc->natts;
/*
- * Set up values/datums arrays for heap_formtuple. For all
+ * Set up values/control arrays for heap_modify_tuple. For all
* the attributes except the one we want to replace, use the
* value that's in the old tuple.
*/
values = palloc(sizeof(Datum) * natts);
- nulls = palloc(natts);
+ nulls = palloc(sizeof(bool) * natts);
+ replaces = palloc(sizeof(bool) * natts);
- for (i = 0; i < natts; i++)
- {
- if (i == fno)
- continue;
- values[i] = SPI_getbinval(rec->tup, rec->tupdesc,
- i + 1, &attisnull);
- if (attisnull)
- nulls[i] = 'n';
- else
- nulls[i] = ' ';
- }
+ memset(replaces, false, sizeof(bool) * natts);
+ replaces[fno] = true;
/*
* Now insert the new value, being careful to cast it to the
@@ -3645,10 +3638,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
atttype,
atttypmod,
attisnull);
- if (attisnull)
- nulls[fno] = 'n';
- else
- nulls[fno] = ' ';
+ nulls[fno] = attisnull;
/*
* Avoid leaking the result of exec_simple_cast_value, if it
@@ -3660,10 +3650,11 @@ exec_assign_value(PLpgSQL_execstate *estate,
mustfree = NULL;
/*
- * Now call heap_formtuple() to create a new tuple that
+ * Now call heap_modify_tuple() to create a new tuple that
* replaces the old one in the record.
*/
- newtup = heap_formtuple(rec->tupdesc, values, nulls);
+ newtup = heap_modify_tuple(rec->tup, rec->tupdesc,
+ values, nulls, replaces);
if (rec->freetup)
heap_freetuple(rec->tup);
@@ -3673,6 +3664,7 @@ exec_assign_value(PLpgSQL_execstate *estate,
pfree(values);
pfree(nulls);
+ pfree(replaces);
if (mustfree)
pfree(mustfree);
@@ -4519,12 +4511,12 @@ exec_move_row(PLpgSQL_execstate *estate,
else if (tupdesc)
{
/* If we have a tupdesc but no data, form an all-nulls tuple */
- char *nulls;
+ bool *nulls;
- nulls = (char *) palloc(tupdesc->natts * sizeof(char));
- memset(nulls, 'n', tupdesc->natts * sizeof(char));
+ nulls = (bool *) palloc(tupdesc->natts * sizeof(bool));
+ memset(nulls, true, tupdesc->natts * sizeof(bool));
- tup = heap_formtuple(tupdesc, NULL, nulls);
+ tup = heap_form_tuple(tupdesc, NULL, nulls);
pfree(nulls);
}
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 5d4cf9f403..273aec02d7 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -1766,7 +1766,7 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping)
TupleDesc desc;
HeapTuple tuple;
Datum *values;
- char *nulls;
+ bool *nulls;
volatile int i;
Assert(PyMapping_Check(mapping));
@@ -1778,7 +1778,7 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping)
/* Build tuple */
values = palloc(sizeof(Datum) * desc->natts);
- nulls = palloc(sizeof(char) * desc->natts);
+ nulls = palloc(sizeof(bool) * desc->natts);
for (i = 0; i < desc->natts; ++i)
{
char *key;
@@ -1793,7 +1793,7 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping)
if (value == Py_None)
{
values[i] = (Datum) NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
}
else if (value)
{
@@ -1810,7 +1810,7 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping)
,-1);
Py_DECREF(so);
so = NULL;
- nulls[i] = ' ';
+ nulls[i] = false;
}
else
ereport(ERROR,
@@ -1831,7 +1831,7 @@ PLyMapping_ToTuple(PLyTypeInfo * info, PyObject * mapping)
PG_END_TRY();
}
- tuple = heap_formtuple(desc, values, nulls);
+ tuple = heap_form_tuple(desc, values, nulls);
ReleaseTupleDesc(desc);
pfree(values);
pfree(nulls);
@@ -1846,7 +1846,7 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence)
TupleDesc desc;
HeapTuple tuple;
Datum *values;
- char *nulls;
+ bool *nulls;
volatile int i;
Assert(PySequence_Check(sequence));
@@ -1868,7 +1868,7 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence)
/* Build tuple */
values = palloc(sizeof(Datum) * desc->natts);
- nulls = palloc(sizeof(char) * desc->natts);
+ nulls = palloc(sizeof(bool) * desc->natts);
for (i = 0; i < desc->natts; ++i)
{
PyObject *volatile value,
@@ -1882,7 +1882,7 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence)
if (value == Py_None)
{
values[i] = (Datum) NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
}
else if (value)
{
@@ -1898,7 +1898,7 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence)
,-1);
Py_DECREF(so);
so = NULL;
- nulls[i] = ' ';
+ nulls[i] = false;
}
Py_XDECREF(value);
@@ -1913,7 +1913,7 @@ PLySequence_ToTuple(PLyTypeInfo * info, PyObject * sequence)
PG_END_TRY();
}
- tuple = heap_formtuple(desc, values, nulls);
+ tuple = heap_form_tuple(desc, values, nulls);
ReleaseTupleDesc(desc);
pfree(values);
pfree(nulls);
@@ -1928,7 +1928,7 @@ PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object)
TupleDesc desc;
HeapTuple tuple;
Datum *values;
- char *nulls;
+ bool *nulls;
volatile int i;
desc = lookup_rowtype_tupdesc(info->out.d.typoid, -1);
@@ -1938,7 +1938,7 @@ PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object)
/* Build tuple */
values = palloc(sizeof(Datum) * desc->natts);
- nulls = palloc(sizeof(char) * desc->natts);
+ nulls = palloc(sizeof(bool) * desc->natts);
for (i = 0; i < desc->natts; ++i)
{
char *key;
@@ -1953,7 +1953,7 @@ PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object)
if (value == Py_None)
{
values[i] = (Datum) NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
}
else if (value)
{
@@ -1969,7 +1969,7 @@ PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object)
,-1);
Py_DECREF(so);
so = NULL;
- nulls[i] = ' ';
+ nulls[i] = false;
}
else
ereport(ERROR,
@@ -1991,7 +1991,7 @@ PLyObject_ToTuple(PLyTypeInfo * info, PyObject * object)
PG_END_TRY();
}
- tuple = heap_formtuple(desc, values, nulls);
+ tuple = heap_form_tuple(desc, values, nulls);
ReleaseTupleDesc(desc);
pfree(values);
pfree(nulls);