HEntry *ptr = &(ARRPTR(st->hs)[st->i]);
Datum res,
dvalues[2];
- char nulls[] = {' ', ' '};
+ bool nulls[2] = {false, false};
text *item;
HeapTuple tuple;
if (ptr->valisnull)
{
dvalues[1] = (Datum) 0;
- nulls[1] = 'n';
+ nulls[1] = true;
}
else
{
}
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));
* 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
* 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
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.122 2008/05/12 00:00:43 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.123 2008/11/02 01:45:26 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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
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
return tuple;
}
-/* ----------------
+/*
* heap_formtuple
*
* construct a tuple from the given values[] and nulls[] arrays
* 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,
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;
}
return newTuple;
}
-/* ----------------
+/*
* heap_modifytuple
*
* forms a new tuple from an old tuple and a set of replacement values.
*
* 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,
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;
}
/*
}
}
-/* ----------------
+/*
* heap_deformtuple
*
* Given a tuple, extract data into values/nulls arrays; this is
* 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,
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);
}
/*
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.89 2008/06/19 00:46:03 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.90 2008/11/02 01:45:27 tgl Exp $
*
*
* INTERFACE ROUTINES
/*
* 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.)
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.246 2008/09/30 10:52:11 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.247 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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 */
for (i = 0; i < MAXATTR; i++)
{
attrtypes[i] = NULL;
- Blanks[i] = ' ';
+ Nulls[i] = false;
}
for (i = 0; i < STRTABLESIZE; ++i)
strtable[i] = NULL;
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 */
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;
}
/* ----------------
elog(DEBUG4, "inserting column %d NULL", i);
Assert(i >= 0 || i < MAXATTR);
values[i] = PointerGetDatum(NULL);
- Blanks[i] = 'n';
+ Nulls[i] = true;
}
/* ----------------
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.148 2008/09/08 00:47:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.149 2008/11/02 01:45:27 tgl Exp $
*
* NOTES
* See acl.h.
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;
/* 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);
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;
/* 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);
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;
/* 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);
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;
/* 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);
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;
/* 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);
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;
/* 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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.341 2008/10/14 23:27:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.342 2008/11/02 01:45:27 tgl Exp $
*
*
* INTERFACE ROUTINES
{
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);
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
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;
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.306 2008/10/14 21:47:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.307 2008/11/02 01:45:27 tgl Exp $
*
*
* INTERFACE ROUTINES
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;
/*
* 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);
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
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.95 2008/07/16 16:55:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.96 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
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;
/* 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);
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.42 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.43 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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;
/* initialize nulls and values */
for (i = 0; i < Natts_pg_constraint; i++)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL;
}
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.
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
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.45 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.46 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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;
/* initialize nulls and values */
for (i = 0; i < Natts_pg_conversion; i++)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL;
}
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.29 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.30 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
CatalogIndexState indstate;
HeapTuple tup;
int i;
- char nulls[Natts_pg_depend];
+ bool nulls[Natts_pg_depend];
Datum values[Natts_pg_depend];
if (nreferenced <= 0)
/* 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++)
{
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.7 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.8 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
int i,
n;
Datum values[Natts_pg_enum];
- char nulls[Natts_pg_enum];
+ bool nulls[Natts_pg_enum];
ListCell *lc;
HeapTuple tup;
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)
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_largeobject.c,v 1.30 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_largeobject.c,v 1.31 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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);
for (i = 0; i < Natts_pg_largeobject; i++)
{
values[i] = (Datum) NULL;
- nulls[i] = ' ';
+ nulls[i] = false;
}
i = 0;
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
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_namespace.c,v 1.19 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_namespace.c,v 1.20 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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;
/* 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));
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.105 2008/08/16 00:01:35 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.106 2008/11/02 01:45:27 tgl Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
int i;
HeapTuple tup;
Datum values[Natts_pg_operator];
- char nulls[Natts_pg_operator];
+ bool nulls[Natts_pg_operator];
NameData oname;
TupleDesc tupDesc;
*/
for (i = 0; i < Natts_pg_operator; ++i)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL; /* redundant, but safe */
}
/*
* create a new operator tuple
*/
- tup = heap_formtuple(tupDesc, values, nulls);
+ tup = heap_form_tuple(tupDesc, values, nulls);
/*
* insert our "shell" operator tuple
{
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;
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;
elog(ERROR, "cache lookup failed for operator %u",
operatorObjectId);
- tup = heap_modifytuple(tup,
+ tup = heap_modify_tuple(tup,
RelationGetDescr(pg_operator_desc),
values,
nulls,
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);
}
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;
}
/*
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,
!(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,
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 */
!(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,
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.153 2008/07/18 03:32:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.154 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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;
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);
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);
}
/* 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);
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;
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.28 2008/05/12 00:00:47 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.29 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.121 2008/08/03 15:23:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.122 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
int i;
HeapTuple tup;
Datum values[Natts_pg_type];
- char nulls[Natts_pg_type];
+ bool nulls[Natts_pg_type];
Oid typoid;
NameData name;
*/
for (i = 0; i < Natts_pg_type; ++i)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = (Datum) NULL; /* redundant, but safe */
}
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.
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;
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;
}
if (defaultTypeBin)
values[i] = CStringGetTextDatum(defaultTypeBin);
else
- nulls[i] = 'n';
+ nulls[i] = true;
i++; /* typdefaultbin */
/*
if (defaultTypeValue)
values[i] = CStringGetTextDatum(defaultTypeValue);
else
- nulls[i] = 'n';
+ nulls[i] = true;
i++; /* typdefault */
/*
/*
* Okay to update existing shell type tuple
*/
- tup = heap_modifytuple(tup,
+ tup = heap_modify_tuple(tup,
RelationGetDescr(pg_type_desc),
values,
nulls,
}
else
{
- tup = heap_formtuple(RelationGetDescr(pg_type_desc),
+ tup = heap_form_tuple(RelationGetDescr(pg_type_desc),
values,
nulls);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.126 2008/10/31 15:05:00 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.127 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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)
*/
for (i = 0; i < Natts_pg_statistic; ++i)
{
- nulls[i] = ' ';
- replaces[i] = 'r';
+ nulls[i] = false;
+ replaces[i] = true;
}
i = 0;
}
else
{
- nulls[i] = 'n';
+ nulls[i] = true;
values[i++] = (Datum) 0;
}
}
}
else
{
- nulls[i] = 'n';
+ nulls[i] = true;
values[i++] = (Datum) 0;
}
}
if (HeapTupleIsValid(oldtup))
{
/* Yes, replace it */
- stup = heap_modifytuple(oldtup,
+ stup = heap_modify_tuple(oldtup,
RelationGetDescr(sd),
values,
nulls,
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);
}
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.141 2008/08/30 01:39:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.142 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
HeapScanDesc scan;
HeapTuple tuple;
Datum values[Natts_pg_listener];
- char nulls[Natts_pg_listener];
+ bool nulls[Natts_pg_listener];
NameData condname;
bool alreadyListener = false;
/*
* 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);
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);
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 */
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;
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)
/*
* 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 */
* Copyright (c) 1996-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.104 2008/10/21 10:38:51 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.105 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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 */
{
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);
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);
}
if (newtuple == NULL && comment != NULL)
{
- newtuple = heap_formtuple(RelationGetDescr(description),
+ newtuple = heap_form_tuple(RelationGetDescr(description),
values, nulls);
simple_heap_insert(description, newtuple);
}
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 */
{
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);
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);
}
if (newtuple == NULL && comment != NULL)
{
- newtuple = heap_formtuple(RelationGetDescr(shdescription),
+ newtuple = heap_form_tuple(RelationGetDescr(shdescription),
values, nulls);
simple_heap_insert(shdescription, newtuple);
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.299 2008/05/12 20:01:59 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.300 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
int i;
Oid in_func_oid;
Datum *values;
- char *nulls;
+ bool *nulls;
int nfields;
char **field_strings;
bool done = false;
}
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;
/* 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)
{
typioparams[m],
attr[m]->atttypmod);
if (string != NULL)
- nulls[m] = ' ';
+ nulls[m] = false;
cstate->cur_attname = NULL;
cstate->cur_attval = NULL;
}
&in_functions[m],
typioparams[m],
attr[m]->atttypmod,
- &isnull);
- nulls[m] = isnull ? 'n' : ' ';
+ &nulls[m]);
cstate->cur_attname = NULL;
}
}
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.214 2008/10/09 10:34:06 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.215 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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;
/* 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));
* 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);
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)
* 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);
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);
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
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,
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);
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;
(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);
/*
{
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.100 2008/10/31 08:39:20 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.101 2008/11/02 01:45:27 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
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;
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);
/*
{
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);
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);
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);
}
Relation relation;
HeapTuple tuple;
Datum values[Natts_pg_cast];
- char nulls[Natts_pg_cast];
+ bool nulls[Natts_pg_cast];
ObjectAddress myself,
referenced;
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.62 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.63 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
Relation rel;
HeapTuple tup;
Datum values[Natts_pg_opfamily];
- char nulls[Natts_pg_opfamily];
+ bool nulls[Natts_pg_opfamily];
NameData opfName;
ObjectAddress myself,
referenced;
* 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);
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);
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,
* 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);
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);
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,
* 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);
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);
{
Relation rel;
Datum values[Natts_pg_amop];
- char nulls[Natts_pg_amop];
+ bool nulls[Natts_pg_amop];
HeapTuple tup;
Oid entryoid;
ObjectAddress myself,
/* 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);
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);
{
Relation rel;
Datum values[Natts_pg_amproc];
- char nulls[Natts_pg_amproc];
+ bool nulls[Natts_pg_amproc];
HeapTuple tup;
Oid entryoid;
ObjectAddress myself,
/* 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);
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);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.79 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.80 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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,
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);
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);
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;
/* 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);
/*
{
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.50 2008/06/14 18:04:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.51 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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;
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);
/*
{
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.154 2008/07/13 20:45:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.155 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
HeapTuple tuple;
TupleDesc tupDesc;
Datum value[SEQ_COL_LASTCOL];
- char null[SEQ_COL_LASTCOL];
+ bool null[SEQ_COL_LASTCOL];
int i;
NameData name;
coldef->cooked_default = NULL;
coldef->constraints = NIL;
- null[i - 1] = ' ';
+ null[i - 1] = false;
switch (i)
{
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);
{
/*
* 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.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.268 2008/10/21 10:38:51 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.269 2008/11/02 01:45:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
{
TupleDesc desc = RelationGetDescr(inhRelation);
Datum datum[Natts_pg_inherits];
- char nullarr[Natts_pg_inherits];
+ bool nullarr[Natts_pg_inherits];
ObjectAddress childobject,
parentobject;
HeapTuple tuple;
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);
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;
}
}
- 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);
/*
{
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);
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 */
* 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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.57 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.58 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#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;
*/
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));
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);
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;
* 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);
/*
{
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);
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.238 2008/10/24 23:42:35 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.239 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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;
/*
* 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,
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.13 2008/06/19 00:46:04 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.14 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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;
/* 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);
*/
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);
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;
* 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);
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);
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);
* 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);
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;
for (i = 0; i < Natts_pg_ts_template; i++)
{
- nulls[i] = ' ';
+ nulls[i] = false;
values[i] = ObjectIdGetDatum(InvalidOid);
}
{
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,
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);
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;
* 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);
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);
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);
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);
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.125 2008/10/21 10:38:51 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.126 2008/11/02 01:45:28 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
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;
/* 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)
(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
{
*/
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);
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.182 2008/05/12 00:00:48 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.183 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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;
* 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));
}
}
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] =
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
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,
* 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
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 */
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 */
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);
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);
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
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,
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);
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;
/* 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);
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
/* 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);
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);
}
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);
/* 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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.103 2008/10/28 22:02:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.104 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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++)
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
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.199 2008/10/16 13:23:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.200 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
HeapTuple mtuple;
int numberOfAttributes;
Datum *v;
- char *n;
+ bool *n;
int i;
if (rel == NULL || tuple == NULL || natts < 0 || attnum == NULL || Values == NULL)
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++)
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
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/prep/preptlist.c,v 1.92 2008/10/21 20:42:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/prep/preptlist.c,v 1.93 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
/*
- * 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
*/
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.130 2008/10/04 21:56:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.131 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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,
/*
* Set up *nulls and *values arrays
*/
- MemSet(nulls, ' ', sizeof(nulls));
+ MemSet(nulls, false, sizeof(nulls));
i = 0;
namestrcpy(&rname, 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);
}
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);
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/large_object/inv_api.c,v 1.134 2008/06/19 00:46:05 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/large_object/inv_api.c,v 1.135 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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));
* 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);
* 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);
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));
* 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);
* 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);
* Copyright (c) 2002-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/lockfuncs.c,v 1.34 2008/05/12 00:00:51 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/lockfuncs.c,v 1.35 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
const char *locktypename;
char tnbuf[32];
Datum values[14];
- char nulls[14];
+ bool nulls[14];
HeapTuple tuple;
Datum result;
* 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];
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:
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;
}
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);
}
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.22 2008/10/13 16:25:19 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.23 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
int i;
char *ptr;
Datum *values;
- char *nulls;
+ bool *nulls;
StringInfoData buf;
/*
}
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
if (tupdesc->attrs[i]->attisdropped)
{
values[i] = (Datum) 0;
- nulls[i] = 'n';
+ nulls[i] = true;
continue;
}
if (*ptr == ',' || *ptr == ')')
{
column_data = NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
}
else
{
}
column_data = buf.data;
- nulls[i] = ' ';
+ nulls[i] = false;
}
/*
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.
*/
int ncolumns;
int i;
Datum *values;
- char *nulls;
+ bool *nulls;
StringInfoData buf;
/* Extract type info from the tuple itself */
}
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);
appendStringInfoChar(&buf, ',');
needComma = true;
- if (nulls[i] == 'n')
+ if (nulls[i])
{
/* emit nothing... */
continue;
int validcols;
int i;
Datum *values;
- char *nulls;
+ bool *nulls;
/*
* Use the passed type unless it's RECORD; we can't support input of
}
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);
if (tupdesc->attrs[i]->attisdropped)
{
values[i] = (Datum) 0;
- nulls[i] = 'n';
+ nulls[i] = true;
continue;
}
{
/* -1 length means NULL */
bufptr = NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
csave = 0; /* keep compiler quiet */
}
else
buf->data[buf->cursor] = '\0';
bufptr = &item_buf;
- nulls[i] = ' ';
+ nulls[i] = false;
}
/* Now call the column's receiveproc */
}
}
- 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.
*/
int validcols;
int i;
Datum *values;
- char *nulls;
+ bool *nulls;
StringInfoData buf;
/* Extract type info from the tuple itself */
}
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);
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);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.144 2008/06/19 00:46:05 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.145 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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++)
{
* 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])
{
keyval = NameGetDatum(newval);
}
values[attindex - 1] = keyval;
- nulls[attindex - 1] = ' ';
+ nulls[attindex - 1] = false;
}
else
{
}
}
- ntp = heap_formtuple(tupDesc, values, nulls);
+ ntp = heap_form_tuple(tupDesc, values, nulls);
if (tupOid != InvalidOid)
HeapTupleSetOid(ntp, tupOid);
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.102 2008/10/28 15:51:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/access/htup.h,v 1.103 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
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);
*
* Copyright (c) 2002-2008, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/include/funcapi.h,v 1.26 2008/01/01 19:45:56 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/funcapi.h,v 1.27 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
*
* 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.
*/
* 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
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.222 2008/10/29 00:00:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.223 2008/11/02 01:45:28 tgl Exp $
*
*-------------------------------------------------------------------------
*/
int fno;
HeapTuple newtup;
int natts;
- int i;
Datum *values;
- char *nulls;
+ bool *nulls;
+ bool *replaces;
void *mustfree;
bool attisnull;
Oid atttype;
/*
* 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\"",
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
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
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);
pfree(values);
pfree(nulls);
+ pfree(replaces);
if (mustfree)
pfree(mustfree);
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);
}
/**********************************************************************
* plpython.c - python as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.114 2008/10/11 00:09:33 alvherre Exp $
+ * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.115 2008/11/02 01:45:28 tgl Exp $
*
*********************************************************************
*/
TupleDesc desc;
HeapTuple tuple;
Datum *values;
- char *nulls;
+ bool *nulls;
volatile int i;
Assert(PyMapping_Check(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;
if (value == Py_None)
{
values[i] = (Datum) NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
}
else if (value)
{
,-1);
Py_DECREF(so);
so = NULL;
- nulls[i] = ' ';
+ nulls[i] = false;
}
else
ereport(ERROR,
PG_END_TRY();
}
- tuple = heap_formtuple(desc, values, nulls);
+ tuple = heap_form_tuple(desc, values, nulls);
ReleaseTupleDesc(desc);
pfree(values);
pfree(nulls);
TupleDesc desc;
HeapTuple tuple;
Datum *values;
- char *nulls;
+ bool *nulls;
volatile int i;
Assert(PySequence_Check(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,
if (value == Py_None)
{
values[i] = (Datum) NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
}
else if (value)
{
,-1);
Py_DECREF(so);
so = NULL;
- nulls[i] = ' ';
+ nulls[i] = false;
}
Py_XDECREF(value);
PG_END_TRY();
}
- tuple = heap_formtuple(desc, values, nulls);
+ tuple = heap_form_tuple(desc, values, nulls);
ReleaseTupleDesc(desc);
pfree(values);
pfree(nulls);
TupleDesc desc;
HeapTuple tuple;
Datum *values;
- char *nulls;
+ bool *nulls;
volatile int i;
desc = lookup_rowtype_tupdesc(info->out.d.typoid, -1);
/* 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;
if (value == Py_None)
{
values[i] = (Datum) NULL;
- nulls[i] = 'n';
+ nulls[i] = true;
}
else if (value)
{
,-1);
Py_DECREF(so);
so = NULL;
- nulls[i] = ' ';
+ nulls[i] = false;
}
else
ereport(ERROR,
PG_END_TRY();
}
- tuple = heap_formtuple(desc, values, nulls);
+ tuple = heap_form_tuple(desc, values, nulls);
ReleaseTupleDesc(desc);
pfree(values);
pfree(nulls);