BlockNumber blkno, OffsetNumber offnum,
AttrNumber attnum, char *msg)
{
- Datum values[HEAPCHECK_RELATION_COLS];
- bool nulls[HEAPCHECK_RELATION_COLS];
+ Datum values[HEAPCHECK_RELATION_COLS] = {0};
+ bool nulls[HEAPCHECK_RELATION_COLS] = {0};
HeapTuple tuple;
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int64GetDatum(blkno);
values[1] = Int32GetDatum(offnum);
values[2] = Int32GetDatum(attnum);
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
- GenericCosts costs;
-
- MemSet(&costs, 0, sizeof(costs));
+ GenericCosts costs = {0};
/* We have to visit all index tuples anyway */
costs.numIndexTuples = index->tuples;
for (;;)
{
Datum values[7];
- bool nulls[7];
+ bool nulls[7] = {0};
/*
* This loop is called once for every attribute of every tuple in the
else
attno++;
- MemSet(nulls, 0, sizeof(nulls));
-
if (unusedItem)
{
values[0] = UInt16GetDatum(offset);
BrinMetaPageData *meta;
TupleDesc tupdesc;
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
HeapTuple htup;
if (!superuser())
/* Extract values from the metapage */
meta = (BrinMetaPageData *) PageGetContents(page);
- MemSet(nulls, 0, sizeof(nulls));
values[0] = CStringGetTextDatum(psprintf("0x%08X", meta->brinMagic));
values[1] = Int32GetDatum(meta->brinVersion);
values[2] = Int32GetDatum(meta->pagesPerRange);
Page page;
int j;
Datum values[9];
- bool nulls[9];
+ bool nulls[9] = {0};
HashPageStat stat;
HeapTuple tuple;
TupleDesc tupleDesc;
elog(ERROR, "return type must be a row type");
tupleDesc = BlessTupleDesc(tupleDesc);
- MemSet(nulls, 0, sizeof(nulls));
-
j = 0;
values[j++] = Int32GetDatum(stat.live_items);
values[j++] = Int32GetDatum(stat.dead_items);
Page page;
Datum result;
Datum values[3];
- bool nulls[3];
+ bool nulls[3] = {0};
uint32 hashkey;
HeapTuple tuple;
FuncCallContext *fctx;
itup = (IndexTuple) PageGetItem(uargs->page, id);
- MemSet(nulls, 0, sizeof(nulls));
-
j = 0;
values[j++] = Int32GetDatum((int32) uargs->offset);
values[j++] = PointerGetDatum(&itup->t_tid);
int i,
j;
Datum values[3];
- bool nulls[3];
+ bool nulls[3] = {0};
uint32 *freep;
if (!superuser())
elog(ERROR, "return type must be a row type");
tupleDesc = BlessTupleDesc(tupleDesc);
- MemSet(nulls, 0, sizeof(nulls));
-
j = 0;
values[j++] = Int64GetDatum((int64) bitmapblkno);
values[j++] = Int32GetDatum(bitmapbit);
int i,
j;
Datum values[16];
- bool nulls[16];
+ bool nulls[16] = {0};
Datum spares[HASH_MAX_SPLITPOINTS];
Datum mapp[HASH_MAX_BITMAPS];
metad = HashPageGetMeta(page);
- MemSet(nulls, 0, sizeof(nulls));
-
j = 0;
values[j++] = Int64GetDatum((int64) metad->hashm_magic);
values[j++] = Int64GetDatum((int64) metad->hashm_version);
heap_tuple_infomask_flags(PG_FUNCTION_ARGS)
{
#define HEAP_TUPLE_INFOMASK_COLS 2
- Datum values[HEAP_TUPLE_INFOMASK_COLS];
- bool nulls[HEAP_TUPLE_INFOMASK_COLS];
+ Datum values[HEAP_TUPLE_INFOMASK_COLS] = {0};
+ bool nulls[HEAP_TUPLE_INFOMASK_COLS] = {0};
uint16 t_infomask = PG_GETARG_INT16(0);
uint16 t_infomask2 = PG_GETARG_INT16(1);
int cnt = 0;
bitcnt = pg_popcount((const char *) &t_infomask, sizeof(uint16)) +
pg_popcount((const char *) &t_infomask2, sizeof(uint16));
- /* Initialize values and NULL flags arrays */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/* If no flags, return a set of empty arrays */
if (bitcnt <= 0)
{
static void
apw_start_leader_worker(void)
{
- BackgroundWorker worker;
+ BackgroundWorker worker = {0};
BackgroundWorkerHandle *handle;
BgwHandleStatus status;
pid_t pid;
- MemSet(&worker, 0, sizeof(BackgroundWorker));
worker.bgw_flags = BGWORKER_SHMEM_ACCESS;
worker.bgw_start_time = BgWorkerStart_ConsistentState;
strcpy(worker.bgw_library_name, "pg_prewarm");
static void
apw_start_database_worker(void)
{
- BackgroundWorker worker;
+ BackgroundWorker worker = {0};
BackgroundWorkerHandle *handle;
- MemSet(&worker, 0, sizeof(BackgroundWorker));
worker.bgw_flags =
BGWORKER_SHMEM_ACCESS | BGWORKER_BACKEND_DATABASE_CONNECTION;
worker.bgw_start_time = BgWorkerStart_ConsistentState;
{
pgssGlobalStats stats;
TupleDesc tupdesc;
- Datum values[PG_STAT_STATEMENTS_INFO_COLS];
- bool nulls[PG_STAT_STATEMENTS_INFO_COLS];
+ Datum values[PG_STAT_STATEMENTS_INFO_COLS] = {0};
+ bool nulls[PG_STAT_STATEMENTS_INFO_COLS] = {0};
if (!pgss || !pgss_hash)
ereport(ERROR,
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/* Read global statistics for pg_stat_statements */
{
volatile pgssSharedState *s = (volatile pgssSharedState *) pgss;
Buffer vmbuffer = InvalidBuffer;
TupleDesc tupdesc;
Datum values[2];
- bool nulls[2];
+ bool nulls[2] = {0};
rel = relation_open(relid, AccessShareLock);
errmsg("invalid block number")));
tupdesc = pg_visibility_tupdesc(false, false);
- MemSet(nulls, 0, sizeof(nulls));
mapbits = (int32) visibilitymap_get_status(rel, blkno, &vmbuffer);
if (vmbuffer != InvalidBuffer)
Page page;
TupleDesc tupdesc;
Datum values[3];
- bool nulls[3];
+ bool nulls[3] = {0};
rel = relation_open(relid, AccessShareLock);
errmsg("invalid block number")));
tupdesc = pg_visibility_tupdesc(false, true);
- MemSet(nulls, 0, sizeof(nulls));
mapbits = (int32) visibilitymap_get_status(rel, blkno, &vmbuffer);
if (vmbuffer != InvalidBuffer)
if (info->next < info->count)
{
Datum values[3];
- bool nulls[3];
+ bool nulls[3] = {0};
HeapTuple tuple;
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int64GetDatum(info->next);
values[1] = BoolGetDatum((info->bits[info->next] & (1 << 0)) != 0);
values[2] = BoolGetDatum((info->bits[info->next] & (1 << 1)) != 0);
if (info->next < info->count)
{
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
HeapTuple tuple;
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int64GetDatum(info->next);
values[1] = BoolGetDatum((info->bits[info->next] & (1 << 0)) != 0);
values[2] = BoolGetDatum((info->bits[info->next] & (1 << 1)) != 0);
int64 all_frozen = 0;
TupleDesc tupdesc;
Datum values[2];
- bool nulls[2];
+ bool nulls[2] = {0};
rel = relation_open(relid, AccessShareLock);
TupleDescInitEntry(tupdesc, (AttrNumber) 2, "all_frozen", INT8OID, -1, 0);
tupdesc = BlessTupleDesc(tupdesc);
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int64GetDatum(all_visible);
values[1] = Int64GetDatum(all_frozen);
{
#define PG_GET_WAL_RECORD_INFO_COLS 11
Datum result;
- Datum values[PG_GET_WAL_RECORD_INFO_COLS];
- bool nulls[PG_GET_WAL_RECORD_INFO_COLS];
+ Datum values[PG_GET_WAL_RECORD_INFO_COLS] = {0};
+ bool nulls[PG_GET_WAL_RECORD_INFO_COLS] = {0};
XLogRecPtr lsn;
XLogRecPtr curr_lsn;
XLogRecPtr first_record;
errmsg("could not read WAL at %X/%X",
LSN_FORMAT_ARGS(first_record))));
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
GetWALRecordInfo(xlogreader, first_record, values, nulls,
PG_GET_WAL_RECORD_INFO_COLS);
XLogRecPtr first_record;
XLogReaderState *xlogreader;
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
- Datum values[PG_GET_WAL_RECORDS_INFO_COLS];
- bool nulls[PG_GET_WAL_RECORDS_INFO_COLS];
+ Datum values[PG_GET_WAL_RECORDS_INFO_COLS] = {0};
+ bool nulls[PG_GET_WAL_RECORDS_INFO_COLS] = {0};
SetSingleFuncCall(fcinfo, 0);
Assert(xlogreader);
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
while (ReadNextXLogRecord(xlogreader, first_record) &&
xlogreader->EndRecPtr <= end_lsn)
{
#define PG_GET_WAL_STATS_COLS 9
XLogRecPtr first_record;
XLogReaderState *xlogreader;
- XLogStats stats;
+ XLogStats stats = {0};
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
- Datum values[PG_GET_WAL_STATS_COLS];
- bool nulls[PG_GET_WAL_STATS_COLS];
+ Datum values[PG_GET_WAL_STATS_COLS] = {0};
+ bool nulls[PG_GET_WAL_STATS_COLS] = {0};
SetSingleFuncCall(fcinfo, 0);
xlogreader = InitXLogReaderState(start_lsn, &first_record);
- MemSet(&stats, 0, sizeof(stats));
-
while (ReadNextXLogRecord(xlogreader, first_record) &&
xlogreader->EndRecPtr <= end_lsn)
{
pfree(xlogreader->private_data);
XLogReaderFree(xlogreader);
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
GetXLogSummaryStats(&stats, rsinfo, values, nulls,
PG_GET_WAL_STATS_COLS,
stats_per_record);
HeapTuple tuple;
TupleDesc tupleDesc;
Datum values[8];
- bool nulls[8];
+ bool nulls[8] = {0};
Buffer metabuf;
HashMetaPage metap;
float8 free_percent;
/*
* Build and return the tuple
*/
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int32GetDatum(stats.version);
values[1] = Int64GetDatum((int64) stats.bucket_pages);
values[2] = Int64GetDatum((int64) stats.overflow_pages);
while ((entry = (ConnCacheEntry *) hash_seq_search(&scan)))
{
ForeignServer *server;
- Datum values[POSTGRES_FDW_GET_CONNECTIONS_COLS];
- bool nulls[POSTGRES_FDW_GET_CONNECTIONS_COLS];
+ Datum values[POSTGRES_FDW_GET_CONNECTIONS_COLS] = {0};
+ bool nulls[POSTGRES_FDW_GET_CONNECTIONS_COLS] = {0};
/* We only look for open remote connections */
if (!entry->conn)
server = GetForeignServerExtended(entry->serverid, FSV_MISSING_OK);
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/*
* The foreign server may have been dropped in current explicit
* transaction. It is not possible to drop the server from another
{
RelOptInfo *outerrel = fpinfo->outerrel;
PgFdwRelationInfo *ofpinfo;
- AggClauseCosts aggcosts;
+ AggClauseCosts aggcosts = {0};
double input_rows;
int numGroupCols;
double numGroups = 1;
input_rows = ofpinfo->rows;
/* Collect statistics about aggregates for estimating costs. */
- MemSet(&aggcosts, 0, sizeof(AggClauseCosts));
if (root->parse->hasAggs)
{
get_agg_clause_costs(root, AGGSPLIT_SIMPLE, &aggcosts);
{
GlobalTransaction gxact = &status->array[status->currIdx++];
PGPROC *proc = &ProcGlobal->allProcs[gxact->pgprocno];
- Datum values[5];
- bool nulls[5];
+ Datum values[5] = {0};
+ bool nulls[5] = {0};
HeapTuple tuple;
Datum result;
/*
* Form tuple with appropriate data.
*/
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
values[0] = TransactionIdGetDatum(proc->xid);
values[1] = CStringGetTextDatum(gxact->gid);
{
#define PG_STOP_BACKUP_V2_COLS 3
TupleDesc tupdesc;
- Datum values[PG_STOP_BACKUP_V2_COLS];
- bool nulls[PG_STOP_BACKUP_V2_COLS];
+ Datum values[PG_STOP_BACKUP_V2_COLS] = {0};
+ bool nulls[PG_STOP_BACKUP_V2_COLS] = {0};
bool waitforarchive = PG_GETARG_BOOL(0);
XLogRecPtr stoppoint;
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
if (status != SESSION_BACKUP_RUNNING)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
Acl *old_acl;
Acl *new_acl;
HeapTuple newtuple;
- Datum values[Natts_pg_default_acl];
- bool nulls[Natts_pg_default_acl];
- bool replaces[Natts_pg_default_acl];
int noldmembers;
int nnewmembers;
Oid *oldmembers;
}
else
{
+ Datum values[Natts_pg_default_acl] = {0};
+ bool nulls[Natts_pg_default_acl] = {0};
+ bool replaces[Natts_pg_default_acl] = {0};
Oid defAclOid;
- /* Prepare to insert or update pg_default_acl entry */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
if (isNew)
{
/* insert new entry */
AclMode avail_goptions;
bool need_update;
HeapTuple newtuple;
- Datum values[Natts_pg_attribute];
- bool nulls[Natts_pg_attribute];
- bool replaces[Natts_pg_attribute];
+ Datum values[Natts_pg_attribute] = {0};
+ bool nulls[Natts_pg_attribute] = {0};
+ bool replaces[Natts_pg_attribute] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
/*
* If the updated ACL is empty, we can set attacl to null, and maybe even
Acl *new_acl;
Oid grantorId;
HeapTuple newtuple;
- Datum values[Natts_pg_class];
- bool nulls[Natts_pg_class];
- bool replaces[Natts_pg_class];
+ Datum values[Natts_pg_class] = {0};
+ bool nulls[Natts_pg_class] = {0};
+ bool replaces[Natts_pg_class] = {0};
int nnewmembers;
Oid *newmembers;
ObjectType objtype;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_class_relacl - 1] = true;
values[Anum_pg_class_relacl - 1] = PointerGetDatum(new_acl);
Oid grantorId;
Oid ownerId;
HeapTuple newtuple;
- Datum values[Natts_pg_database];
- bool nulls[Natts_pg_database];
- bool replaces[Natts_pg_database];
+ Datum values[Natts_pg_database] = {0};
+ bool nulls[Natts_pg_database] = {0};
+ bool replaces[Natts_pg_database] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_database_datacl - 1] = true;
values[Anum_pg_database_datacl - 1] = PointerGetDatum(new_acl);
Oid ownerId;
HeapTuple tuple;
HeapTuple newtuple;
- Datum values[Natts_pg_foreign_data_wrapper];
- bool nulls[Natts_pg_foreign_data_wrapper];
- bool replaces[Natts_pg_foreign_data_wrapper];
+ Datum values[Natts_pg_foreign_data_wrapper] = {0};
+ bool nulls[Natts_pg_foreign_data_wrapper] = {0};
+ bool replaces[Natts_pg_foreign_data_wrapper] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_foreign_data_wrapper_fdwacl - 1] = true;
values[Anum_pg_foreign_data_wrapper_fdwacl - 1] = PointerGetDatum(new_acl);
Oid ownerId;
HeapTuple tuple;
HeapTuple newtuple;
- Datum values[Natts_pg_foreign_server];
- bool nulls[Natts_pg_foreign_server];
- bool replaces[Natts_pg_foreign_server];
+ Datum values[Natts_pg_foreign_server] = {0};
+ bool nulls[Natts_pg_foreign_server] = {0};
+ bool replaces[Natts_pg_foreign_server] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_foreign_server_srvacl - 1] = true;
values[Anum_pg_foreign_server_srvacl - 1] = PointerGetDatum(new_acl);
Oid ownerId;
HeapTuple tuple;
HeapTuple newtuple;
- Datum values[Natts_pg_proc];
- bool nulls[Natts_pg_proc];
- bool replaces[Natts_pg_proc];
+ Datum values[Natts_pg_proc] = {0};
+ bool nulls[Natts_pg_proc] = {0};
+ bool replaces[Natts_pg_proc] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_proc_proacl - 1] = true;
values[Anum_pg_proc_proacl - 1] = PointerGetDatum(new_acl);
Oid ownerId;
HeapTuple tuple;
HeapTuple newtuple;
- Datum values[Natts_pg_language];
- bool nulls[Natts_pg_language];
- bool replaces[Natts_pg_language];
+ Datum values[Natts_pg_language] = {0};
+ bool nulls[Natts_pg_language] = {0};
+ bool replaces[Natts_pg_language] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_language_lanacl - 1] = true;
values[Anum_pg_language_lanacl - 1] = PointerGetDatum(new_acl);
Oid grantorId;
Oid ownerId;
HeapTuple newtuple;
- Datum values[Natts_pg_largeobject_metadata];
- bool nulls[Natts_pg_largeobject_metadata];
- bool replaces[Natts_pg_largeobject_metadata];
+ Datum values[Natts_pg_largeobject_metadata] = {0};
+ bool nulls[Natts_pg_largeobject_metadata] = {0};
+ bool replaces[Natts_pg_largeobject_metadata] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_largeobject_metadata_lomacl - 1] = true;
values[Anum_pg_largeobject_metadata_lomacl - 1]
= PointerGetDatum(new_acl);
Oid ownerId;
HeapTuple tuple;
HeapTuple newtuple;
- Datum values[Natts_pg_namespace];
- bool nulls[Natts_pg_namespace];
- bool replaces[Natts_pg_namespace];
+ Datum values[Natts_pg_namespace] = {0};
+ bool nulls[Natts_pg_namespace] = {0};
+ bool replaces[Natts_pg_namespace] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_namespace_nspacl - 1] = true;
values[Anum_pg_namespace_nspacl - 1] = PointerGetDatum(new_acl);
Oid grantorId;
Oid ownerId;
HeapTuple newtuple;
- Datum values[Natts_pg_tablespace];
- bool nulls[Natts_pg_tablespace];
- bool replaces[Natts_pg_tablespace];
+ Datum values[Natts_pg_tablespace] = {0};
+ bool nulls[Natts_pg_tablespace] = {0};
+ bool replaces[Natts_pg_tablespace] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_tablespace_spcacl - 1] = true;
values[Anum_pg_tablespace_spcacl - 1] = PointerGetDatum(new_acl);
Oid grantorId;
Oid ownerId;
HeapTuple newtuple;
- Datum values[Natts_pg_type];
- bool nulls[Natts_pg_type];
- bool replaces[Natts_pg_type];
+ Datum values[Natts_pg_type] = {0};
+ bool nulls[Natts_pg_type] = {0};
+ bool replaces[Natts_pg_type] = {0};
int noldmembers;
int nnewmembers;
Oid *oldmembers;
nnewmembers = aclmembers(new_acl, &newmembers);
/* finished building new ACL value, now insert it */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
-
replaces[Anum_pg_type_typacl - 1] = true;
values[Anum_pg_type_typacl - 1] = PointerGetDatum(new_acl);
{
/* finished building new ACL value, now insert it */
HeapTuple newtuple;
- Datum values[Natts_pg_parameter_acl];
- bool nulls[Natts_pg_parameter_acl];
- bool replaces[Natts_pg_parameter_acl];
-
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replaces, false, sizeof(replaces));
+ Datum values[Natts_pg_parameter_acl] = {0};
+ bool nulls[Natts_pg_parameter_acl] = {0};
+ bool replaces[Natts_pg_parameter_acl] = {0};
replaces[Anum_pg_parameter_acl_paracl - 1] = true;
values[Anum_pg_parameter_acl_paracl - 1] = PointerGetDatum(new_acl);
/* If we find an entry, update it with the latest ACL. */
if (HeapTupleIsValid(oldtuple))
{
- Datum values[Natts_pg_init_privs];
- bool nulls[Natts_pg_init_privs];
- bool replace[Natts_pg_init_privs];
+ Datum values[Natts_pg_init_privs] = {0};
+ bool nulls[Natts_pg_init_privs] = {0};
+ bool replace[Natts_pg_init_privs] = {0};
/* If we have a new ACL to set, then update the row with it. */
if (new_acl)
{
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
- MemSet(replace, false, sizeof(replace));
-
values[Anum_pg_init_privs_initprivs - 1] = PointerGetDatum(new_acl);
replace[Anum_pg_init_privs_initprivs - 1] = true;
}
else
{
- Datum values[Natts_pg_init_privs];
- bool nulls[Natts_pg_init_privs];
+ Datum values[Natts_pg_init_privs] = {0};
+ bool nulls[Natts_pg_init_privs] = {0};
/*
* Only add a new entry if the new ACL is non-NULL.
if (new_acl)
{
/* No entry found, so add it. */
- MemSet(nulls, false, sizeof(nulls));
-
values[Anum_pg_init_privs_objoid - 1] = ObjectIdGetDatum(objoid);
values[Anum_pg_init_privs_classoid - 1] = ObjectIdGetDatum(classoid);
values[Anum_pg_init_privs_objsubid - 1] = Int32GetDatum(objsubid);
bool reverse_self)
{
find_expr_references_context context;
- RangeTblEntry rte;
+ RangeTblEntry rte = {0};
context.addrs = new_object_addresses();
/* We gin up a rather bogus rangetable list to handle Vars */
- MemSet(&rte, 0, sizeof(rte));
rte.type = T_RangeTblEntry;
rte.rtekind = RTE_RELATION;
rte.relid = relId;
/* clear the missing value if any */
if (attStruct->atthasmissing)
{
- Datum valuesAtt[Natts_pg_attribute];
- bool nullsAtt[Natts_pg_attribute];
- bool replacesAtt[Natts_pg_attribute];
+ Datum valuesAtt[Natts_pg_attribute] = {0};
+ bool nullsAtt[Natts_pg_attribute] = {0};
+ bool replacesAtt[Natts_pg_attribute] = {0};
/* update the tuple - set atthasmissing and attmissingval */
- MemSet(valuesAtt, 0, sizeof(valuesAtt));
- MemSet(nullsAtt, false, sizeof(nullsAtt));
- MemSet(replacesAtt, false, sizeof(replacesAtt));
-
valuesAtt[Anum_pg_attribute_atthasmissing - 1] =
BoolGetDatum(false);
replacesAtt[Anum_pg_attribute_atthasmissing - 1] = true;
void
SetAttrMissing(Oid relid, char *attname, char *value)
{
- Datum valuesAtt[Natts_pg_attribute];
- bool nullsAtt[Natts_pg_attribute];
- bool replacesAtt[Natts_pg_attribute];
+ Datum valuesAtt[Natts_pg_attribute] = {0};
+ bool nullsAtt[Natts_pg_attribute] = {0};
+ bool replacesAtt[Natts_pg_attribute] = {0};
Datum missingval;
Form_pg_attribute attStruct;
Relation attrrel,
Int32GetDatum(attStruct->atttypmod));
/* update the tuple - set atthasmissing and attmissingval */
- MemSet(valuesAtt, 0, sizeof(valuesAtt));
- MemSet(nullsAtt, false, sizeof(nullsAtt));
- MemSet(replacesAtt, false, sizeof(replacesAtt));
-
valuesAtt[Anum_pg_attribute_atthasmissing - 1] = BoolGetDatum(true);
replacesAtt[Anum_pg_attribute_atthasmissing - 1] = true;
valuesAtt[Anum_pg_attribute_attmissingval - 1] = missingval;
Relation pg_partitioned_table;
HeapTuple tuple;
Datum values[Natts_pg_partitioned_table];
- bool nulls[Natts_pg_partitioned_table];
+ bool nulls[Natts_pg_partitioned_table] = {0};
ObjectAddress myself;
ObjectAddress referenced;
ObjectAddresses *addrs;
pg_partitioned_table = table_open(PartitionedRelationId, RowExclusiveLock);
- MemSet(nulls, false, sizeof(nulls));
-
/* Only this can ever be NULL */
if (!partexprDatum)
nulls[Anum_pg_partitioned_table_partexprs - 1] = true;
Datum exprsDatum;
Datum predDatum;
Datum values[Natts_pg_index];
- bool nulls[Natts_pg_index];
+ bool nulls[Natts_pg_index] = {0};
Relation pg_index;
HeapTuple tuple;
int i;
/*
* Build a pg_index tuple
*/
- 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_indnatts - 1] = Int16GetDatum(indexInfo->ii_NumIndexAttrs);
Expr *expr2 = (Expr *) expr;
EState *estate = NULL;
ExprContext *econtext;
- Datum valuesAtt[Natts_pg_attribute];
- bool nullsAtt[Natts_pg_attribute];
- bool replacesAtt[Natts_pg_attribute];
+ Datum valuesAtt[Natts_pg_attribute] = {0};
+ bool nullsAtt[Natts_pg_attribute] = {0};
+ bool replacesAtt[Natts_pg_attribute] = {0};
Datum missingval = (Datum) 0;
bool missingIsNull = true;
- MemSet(valuesAtt, 0, sizeof(valuesAtt));
- MemSet(nullsAtt, false, sizeof(nullsAtt));
- MemSet(replacesAtt, false, sizeof(replacesAtt));
valuesAtt[Anum_pg_attribute_atthasdef - 1] = true;
replacesAtt[Anum_pg_attribute_atthasdef - 1] = true;
HeapTuple tuple;
Oid castid;
Datum values[Natts_pg_cast];
- bool nulls[Natts_pg_cast];
+ bool nulls[Natts_pg_cast] = {0};
ObjectAddress myself,
referenced;
ObjectAddresses *addrs;
values[Anum_pg_cast_castcontext - 1] = CharGetDatum(castcontext);
values[Anum_pg_cast_castmethod - 1] = CharGetDatum(castmethod);
- MemSet(nulls, false, sizeof(nulls));
-
tuple = heap_form_tuple(RelationGetDescr(relation), values, nulls);
CatalogTupleInsert(relation, tuple);
Relation rel;
TupleDesc tupDesc;
HeapTuple tuple;
- Datum values[Natts_pg_parameter_acl];
- bool nulls[Natts_pg_parameter_acl];
+ Datum values[Natts_pg_parameter_acl] = {0};
+ bool nulls[Natts_pg_parameter_acl] = {0};
/*
* To prevent cluttering pg_parameter_acl with useless entries, insist
*/
rel = table_open(ParameterAclRelationId, RowExclusiveLock);
tupDesc = RelationGetDescr(rel);
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
parameterId = GetNewOidWithIndex(rel,
ParameterAclOidIndexId,
Anum_pg_parameter_acl_oid);
HeapTuple pubtuple = NULL;
HeapTuple rettuple;
Oid relid = list_nth_oid(tables, funcctx->call_cntr);
- Datum values[NUM_PUBLICATION_TABLES_ELEM];
- bool nulls[NUM_PUBLICATION_TABLES_ELEM];
+ Datum values[NUM_PUBLICATION_TABLES_ELEM] = {0};
+ bool nulls[NUM_PUBLICATION_TABLES_ELEM] = {0};
/*
* Form tuple with appropriate data.
*/
- MemSet(nulls, 0, sizeof(nulls));
- MemSet(values, 0, sizeof(values));
publication = GetPublicationByName(pubname, false);
volatile Oid dst_deftablespace;
Relation pg_database_rel;
HeapTuple tuple;
- Datum new_record[Natts_pg_database];
- bool new_record_nulls[Natts_pg_database];
+ Datum new_record[Natts_pg_database] = {0};
+ bool new_record_nulls[Natts_pg_database] = {0};
Oid dboid = InvalidOid;
Oid datdba;
ListCell *option;
(dblocprovider != COLLPROVIDER_ICU && !dbiculocale));
/* Form tuple */
- MemSet(new_record, 0, sizeof(new_record));
- MemSet(new_record_nulls, false, sizeof(new_record_nulls));
-
new_record[Anum_pg_database_oid - 1] = ObjectIdGetDatum(dboid);
new_record[Anum_pg_database_datname - 1] =
DirectFunctionCall1(namein, CStringGetDatum(dbname));
newtuple;
Oid src_tblspcoid,
dst_tblspcoid;
- Datum new_record[Natts_pg_database];
- bool new_record_nulls[Natts_pg_database];
- bool new_record_repl[Natts_pg_database];
ScanKeyData scankey;
SysScanDesc sysscan;
AclResult aclresult;
PG_ENSURE_ERROR_CLEANUP(movedb_failure_callback,
PointerGetDatum(&fparms));
{
+ Datum new_record[Natts_pg_database] = {0};
+ bool new_record_nulls[Natts_pg_database] = {0};
+ bool new_record_repl[Natts_pg_database] = {0};
+
/*
* Copy files from the old tablespace to the new one
*/
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", dbname)));
- MemSet(new_record, 0, sizeof(new_record));
- MemSet(new_record_nulls, false, sizeof(new_record_nulls));
- MemSet(new_record_repl, false, sizeof(new_record_repl));
-
new_record[Anum_pg_database_dattablespace - 1] = ObjectIdGetDatum(dst_tblspcoid);
new_record_repl[Anum_pg_database_dattablespace - 1] = true;
DefElem *dallowconnections = NULL;
DefElem *dconnlimit = NULL;
DefElem *dtablespace = NULL;
- Datum new_record[Natts_pg_database];
- bool new_record_nulls[Natts_pg_database];
- bool new_record_repl[Natts_pg_database];
+ Datum new_record[Natts_pg_database] = {0};
+ bool new_record_nulls[Natts_pg_database] = {0};
+ bool new_record_repl[Natts_pg_database] = {0};
/* 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, false, sizeof(new_record_nulls));
- MemSet(new_record_repl, false, sizeof(new_record_repl));
-
if (distemplate)
{
new_record[Anum_pg_database_datistemplate - 1] = BoolGetDatum(dbistemplate);
if (datForm->datdba != newOwnerId)
{
Datum repl_val[Natts_pg_database];
- bool repl_null[Natts_pg_database];
- bool repl_repl[Natts_pg_database];
+ bool repl_null[Natts_pg_database] = {0};
+ bool repl_repl[Natts_pg_database] = {0};
Acl *newAcl;
Datum aclDatum;
bool isNull;
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to change owner of database")));
- memset(repl_null, false, sizeof(repl_null));
- memset(repl_repl, false, sizeof(repl_repl));
-
repl_repl[Anum_pg_database_datdba - 1] = true;
repl_val[Anum_pg_database_datdba - 1] = ObjectIdGetDatum(newOwnerId);
{
SQLDropObject *obj;
int i = 0;
- Datum values[12];
- bool nulls[12];
+ Datum values[12] = {0};
+ bool nulls[12] = {0};
obj = slist_container(SQLDropObject, next, iter.cur);
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/* classid */
values[i++] = ObjectIdGetDatum(obj->address.classId);
{
CollectedCommand *cmd = lfirst(lc);
Datum values[9];
- bool nulls[9];
+ bool nulls[9] = {0};
ObjectAddress addr;
int i = 0;
!OidIsValid(cmd->d.simple.address.objectId))
continue;
- MemSet(nulls, 0, sizeof(nulls));
-
switch (cmd->type)
{
case SCT_Simple:
AclResult aclresult;
Form_pg_proc procstruct;
Datum values[Natts_pg_transform];
- bool nulls[Natts_pg_transform];
- bool replaces[Natts_pg_transform];
+ bool nulls[Natts_pg_transform] = {0};
+ bool replaces[Natts_pg_transform] = {0};
Oid transformid;
HeapTuple tuple;
HeapTuple newtuple;
values[Anum_pg_transform_trffromsql - 1] = ObjectIdGetDatum(fromsqlfuncid);
values[Anum_pg_transform_trftosql - 1] = ObjectIdGetDatum(tosqlfuncid);
- MemSet(nulls, false, sizeof(nulls));
-
relation = table_open(TransformRelationId, RowExclusiveLock);
tuple = SearchSysCache2(TRFTYPELANG,
format_type_be(typeid),
stmt->lang)));
- MemSet(replaces, false, sizeof(replaces));
replaces[Anum_pg_transform_trffromsql - 1] = true;
replaces[Anum_pg_transform_trftosql - 1] = true;
{
TupleDesc result_desc;
Datum values[8];
- bool nulls[8];
+ bool nulls[8] = {0};
result_desc = prep_stmt->plansource->resultDesc;
- MemSet(nulls, 0, sizeof(nulls));
-
values[0] = CStringGetTextDatum(prep_stmt->stmt_name);
values[1] = CStringGetTextDatum(prep_stmt->plansource->query_string);
values[2] = TimestampTzGetDatum(prep_stmt->prepare_time);
bool recurse, bool recursing, LOCKMODE lockmode)
{
Relation pkrel;
- int16 pkattnum[INDEX_MAX_KEYS];
- int16 fkattnum[INDEX_MAX_KEYS];
- Oid pktypoid[INDEX_MAX_KEYS];
- Oid fktypoid[INDEX_MAX_KEYS];
- Oid opclasses[INDEX_MAX_KEYS];
- Oid pfeqoperators[INDEX_MAX_KEYS];
- Oid ppeqoperators[INDEX_MAX_KEYS];
- Oid ffeqoperators[INDEX_MAX_KEYS];
- int16 fkdelsetcols[INDEX_MAX_KEYS];
+ int16 pkattnum[INDEX_MAX_KEYS] = {0};
+ int16 fkattnum[INDEX_MAX_KEYS] = {0};
+ Oid pktypoid[INDEX_MAX_KEYS] = {0};
+ Oid fktypoid[INDEX_MAX_KEYS] = {0};
+ Oid opclasses[INDEX_MAX_KEYS] = {0};
+ Oid pfeqoperators[INDEX_MAX_KEYS] = {0};
+ Oid ppeqoperators[INDEX_MAX_KEYS] = {0};
+ Oid ffeqoperators[INDEX_MAX_KEYS] = {0};
+ int16 fkdelsetcols[INDEX_MAX_KEYS] = {0};
int i;
int numfks,
numpks,
* Look up the referencing attributes to make sure they exist, and record
* their attnums and type OIDs.
*/
- MemSet(pkattnum, 0, sizeof(pkattnum));
- MemSet(fkattnum, 0, sizeof(fkattnum));
- MemSet(pktypoid, 0, sizeof(pktypoid));
- MemSet(fktypoid, 0, sizeof(fktypoid));
- MemSet(opclasses, 0, sizeof(opclasses));
- MemSet(pfeqoperators, 0, sizeof(pfeqoperators));
- MemSet(ppeqoperators, 0, sizeof(ppeqoperators));
- MemSet(ffeqoperators, 0, sizeof(ffeqoperators));
- MemSet(fkdelsetcols, 0, sizeof(fkdelsetcols));
-
numfks = transformColumnNameList(RelationGetRelid(rel),
fkconstraint->fk_attrs,
fkattnum, fktypoid);
{
TupleTableSlot *slot;
TableScanDesc scan;
- Trigger trig;
+ Trigger trig = {0};
Snapshot snapshot;
MemoryContext oldcxt;
MemoryContext perTupCxt;
/*
* Build a trigger call structure; we'll need it either way.
*/
- MemSet(&trig, 0, sizeof(trig));
trig.tgoid = InvalidOid;
trig.tgname = conname;
trig.tgenabled = TRIGGER_FIRES_ON_ORIGIN;
int one = 1;
bool isNull;
- Datum valuesAtt[Natts_pg_attribute];
- bool nullsAtt[Natts_pg_attribute];
- bool replacesAtt[Natts_pg_attribute];
+ Datum valuesAtt[Natts_pg_attribute] = {0};
+ bool nullsAtt[Natts_pg_attribute] = {0};
+ bool replacesAtt[Natts_pg_attribute] = {0};
HeapTuple newTup;
- MemSet(valuesAtt, 0, sizeof(valuesAtt));
- MemSet(nullsAtt, false, sizeof(nullsAtt));
- MemSet(replacesAtt, false, sizeof(replacesAtt));
-
missingval = array_get_element(missingval,
1,
&one,
HeapTuple tuple;
Form_pg_constraint constrForm;
Relation rel;
- Trigger trig;
+ Trigger trig = {0};
tuple = SearchSysCache1(CONSTROID, ObjectIdGetDatum(constrOid));
if (!HeapTupleIsValid(tuple))
/* prevent data changes into the referencing table until commit */
rel = table_open(constrForm->conrelid, ShareLock);
- MemSet(&trig, 0, sizeof(trig));
trig.tgoid = InvalidOid;
trig.tgname = NameStr(constrForm->conname);
trig.tgenabled = TRIGGER_FIRES_ON_ORIGIN;
#ifdef HAVE_SYMLINK
Relation rel;
Datum values[Natts_pg_tablespace];
- bool nulls[Natts_pg_tablespace];
+ bool nulls[Natts_pg_tablespace] = {0};
HeapTuple tuple;
Oid tablespaceoid;
char *location;
*/
rel = table_open(TableSpaceRelationId, RowExclusiveLock);
- MemSet(nulls, false, sizeof(nulls));
-
if (IsBinaryUpgrade)
{
/* Use binary-upgrade override for tablespace oid */
Relation rel;
char *defaultValue;
Node *defaultExpr = NULL; /* NULL if no default specified */
- Datum new_record[Natts_pg_type];
- bool new_record_nulls[Natts_pg_type];
- bool new_record_repl[Natts_pg_type];
+ Datum new_record[Natts_pg_type] = {0};
+ bool new_record_nulls[Natts_pg_type] = {0};
+ bool new_record_repl[Natts_pg_type] = {0};
HeapTuple newtuple;
Form_pg_type typTup;
ObjectAddress address;
checkDomainOwner(tup);
/* Setup new tuple */
- MemSet(new_record, (Datum) 0, sizeof(new_record));
- 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)
Relation pg_authid_rel;
TupleDesc pg_authid_dsc;
HeapTuple tuple;
- Datum new_record[Natts_pg_authid];
- bool new_record_nulls[Natts_pg_authid];
+ Datum new_record[Natts_pg_authid] = {0};
+ bool new_record_nulls[Natts_pg_authid] = {0};
Oid roleid;
ListCell *item;
ListCell *option;
/*
* Build a tuple to insert
*/
- MemSet(new_record, 0, sizeof(new_record));
- MemSet(new_record_nulls, false, sizeof(new_record_nulls));
-
new_record[Anum_pg_authid_rolname - 1] =
DirectFunctionCall1(namein, CStringGetDatum(stmt->role));
-
new_record[Anum_pg_authid_rolsuper - 1] = BoolGetDatum(issuper);
new_record[Anum_pg_authid_rolinherit - 1] = BoolGetDatum(inherit);
new_record[Anum_pg_authid_rolcreaterole - 1] = BoolGetDatum(createrole);
Oid
AlterRole(ParseState *pstate, AlterRoleStmt *stmt)
{
- Datum new_record[Natts_pg_authid];
- bool new_record_nulls[Natts_pg_authid];
- bool new_record_repl[Natts_pg_authid];
+ Datum new_record[Natts_pg_authid] = {0};
+ bool new_record_nulls[Natts_pg_authid] = {0};
+ bool new_record_repl[Natts_pg_authid] = {0};
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, false, sizeof(new_record_nulls));
- MemSet(new_record_repl, false, sizeof(new_record_repl));
/*
* issuper/createrole/etc
Oid memberid = lfirst_oid(iditem);
HeapTuple authmem_tuple;
HeapTuple tuple;
- Datum new_record[Natts_pg_auth_members];
- bool new_record_nulls[Natts_pg_auth_members];
- bool new_record_repl[Natts_pg_auth_members];
+ Datum new_record[Natts_pg_auth_members] = {0};
+ bool new_record_nulls[Natts_pg_auth_members] = {0};
+ bool new_record_repl[Natts_pg_auth_members] = {0};
/*
* pg_database_owner is never a role member. Lifting this restriction
}
/* Build a tuple to insert or update */
- MemSet(new_record, 0, sizeof(new_record));
- 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);
new_record[Anum_pg_auth_members_grantor - 1] = ObjectIdGetDatum(grantorId);
{
/* Just turn off the admin option */
HeapTuple tuple;
- Datum new_record[Natts_pg_auth_members];
- bool new_record_nulls[Natts_pg_auth_members];
- bool new_record_repl[Natts_pg_auth_members];
+ Datum new_record[Natts_pg_auth_members] = {0};
+ bool new_record_nulls[Natts_pg_auth_members] = {0};
+ bool new_record_repl[Natts_pg_auth_members] = {0};
/* Build a tuple to update with */
- MemSet(new_record, 0, sizeof(new_record));
- 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] = true;
double output_tuples;
Cost startup_cost;
Cost total_cost;
- AggClauseCosts dummy_aggcosts;
+ const AggClauseCosts dummy_aggcosts = {0};
/* Use all-zero per-aggregate costs if NULL is passed */
if (aggcosts == NULL)
{
Assert(aggstrategy == AGG_HASHED);
- MemSet(&dummy_aggcosts, 0, sizeof(AggClauseCosts));
aggcosts = &dummy_aggcosts;
}
* to. We have to build an additional level of ParseState
* to keep in step with varlevelsup in the subselect.
*/
- ParseState mypstate;
+ ParseState mypstate = {0};
- MemSet(&mypstate, 0, sizeof(mypstate));
mypstate.parentParseState = pstate;
mypstate.p_rtable = rte->subquery->rtable;
/* don't bother filling the rest of the fake pstate */
for (i = 0; i < max_logical_replication_workers; i++)
{
/* for each row */
- Datum values[PG_STAT_GET_SUBSCRIPTION_COLS];
- bool nulls[PG_STAT_GET_SUBSCRIPTION_COLS];
+ Datum values[PG_STAT_GET_SUBSCRIPTION_COLS] = {0};
+ bool nulls[PG_STAT_GET_SUBSCRIPTION_COLS] = {0};
int worker_pid;
LogicalRepWorker worker;
worker_pid = worker.proc->pid;
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
values[0] = ObjectIdGetDatum(worker.subid);
if (OidIsValid(worker.relid))
values[1] = ObjectIdGetDatum(worker.relid);
TupOutputState *tstate;
TupleDesc tupdesc;
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
TimeLineID currTLI;
/*
}
dest = CreateDestReceiver(DestRemoteSimple);
- MemSet(nulls, false, sizeof(nulls));
/* need a tuple descriptor representing four columns */
tupdesc = CreateTemplateTupleDesc(4);
DestReceiver *dest;
TupOutputState *tstate;
TupleDesc tupdesc;
- Datum values[READ_REPLICATION_SLOT_COLS];
+ Datum values[READ_REPLICATION_SLOT_COLS] = {0};
bool nulls[READ_REPLICATION_SLOT_COLS];
tupdesc = CreateTemplateTupleDesc(READ_REPLICATION_SLOT_COLS);
TupleDescInitBuiltinEntry(tupdesc, (AttrNumber) 3, "restart_tli",
INT8OID, -1, 0);
- MemSet(values, 0, READ_REPLICATION_SLOT_COLS * sizeof(Datum));
- MemSet(nulls, true, READ_REPLICATION_SLOT_COLS * sizeof(bool));
+ memset(nulls, true, READ_REPLICATION_SLOT_COLS * sizeof(bool));
LWLockAcquire(ReplicationSlotControlLock, LW_SHARED);
slot = SearchNamedReplicationSlot(cmd->slotname, false);
TupOutputState *tstate;
TupleDesc tupdesc;
Datum values[2];
- bool nulls[2];
+ bool nulls[2] = {0};
snprintf(startpos_str, sizeof(startpos_str), "%X/%X",
LSN_FORMAT_ARGS(sendTimeLineValidUpto));
dest = CreateDestReceiver(DestRemoteSimple);
- MemSet(nulls, false, sizeof(nulls));
/*
* Need a tuple descriptor representing two columns. int8 may seem
TupOutputState *tstate;
TupleDesc tupdesc;
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
Assert(!MyReplicationSlot);
LSN_FORMAT_ARGS(MyReplicationSlot->data.confirmed_flush));
dest = CreateDestReceiver(DestRemoteSimple);
- MemSet(nulls, false, sizeof(nulls));
/*----------
* Need a tuple descriptor representing four columns:
TimestampTz replyTime;
bool is_sync_standby;
Datum values[PG_STAT_GET_WAL_SENDERS_COLS];
- bool nulls[PG_STAT_GET_WAL_SENDERS_COLS];
+ bool nulls[PG_STAT_GET_WAL_SENDERS_COLS] = {0};
int j;
/* Collect data from shared memory */
}
}
- memset(nulls, 0, sizeof(nulls));
values[0] = Int32GetDatum(pid);
if (!has_privs_of_role(GetUserId(), ROLE_PG_READ_ALL_STATS))
char *evqual = nodeToString(event_qual);
char *actiontree = nodeToString((Node *) action);
Datum values[Natts_pg_rewrite];
- bool nulls[Natts_pg_rewrite];
- bool replaces[Natts_pg_rewrite];
+ bool nulls[Natts_pg_rewrite] = {0};
NameData rname;
Relation pg_rewrite_desc;
HeapTuple tup,
/*
* Set up *nulls and *values arrays
*/
- MemSet(nulls, false, sizeof(nulls));
-
namestrcpy(&rname, rulname);
values[Anum_pg_rewrite_rulename - 1] = NameGetDatum(&rname);
values[Anum_pg_rewrite_ev_class - 1] = ObjectIdGetDatum(eventrel_oid);
if (HeapTupleIsValid(oldtup))
{
+ bool replaces[Natts_pg_rewrite] = {0};
+
if (!replace)
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
/*
* When replacing, we don't need to replace every attribute
*/
- MemSet(replaces, false, sizeof(replaces));
replaces[Anum_pg_rewrite_ev_type - 1] = true;
replaces[Anum_pg_rewrite_is_instead - 1] = true;
replaces[Anum_pg_rewrite_ev_qual - 1] = true;
{
Datum result;
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
HeapTuple tuple;
values[0] = ObjectIdGetDatum(aidata->ai_grantor);
values[2] = CStringGetTextDatum(convert_aclright_to_string(priv_bit));
values[3] = BoolGetDatum((ACLITEM_GET_GOPTIONS(*aidata) & priv_bit) != 0);
- MemSet(nulls, 0, sizeof(nulls));
-
tuple = heap_form_tuple(funcctx->tuple_desc, values, nulls);
result = HeapTupleGetDatum(tuple);
bool eoArray = false;
bool hasnull;
int32 totbytes;
- int indx[MAXDIM],
+ int indx[MAXDIM] = {0},
prod[MAXDIM];
mda_get_prod(ndim, dim, prod);
- MemSet(indx, 0, sizeof(indx));
/* Initialize is-null markers to true */
memset(nulls, true, nitems * sizeof(bool));
Datum result;
HeapTuple tuple;
Datum values[3];
- bool nulls[3];
+ bool nulls[3] = {0};
const datetkn *tp;
char buffer[TOKMAXLEN + 1];
int gmtoffset;
break;
}
- MemSet(nulls, 0, sizeof(nulls));
-
/*
* Convert name to text, using upcasing conversion that is the inverse of
* what ParseDateTime() uses.
pg_tzenum *tzenum;
pg_tz *tz;
Datum values[4];
- bool nulls[4];
+ bool nulls[4] = {0};
int tzoff;
struct pg_tm tm;
fsec_t fsec;
if (tzn && strlen(tzn) > 31)
continue;
- MemSet(nulls, 0, sizeof(nulls));
-
values[0] = CStringGetTextDatum(pg_get_timezone_name(tz));
values[1] = CStringGetTextDatum(tzn ? tzn : "");
LOCKMODE mode = 0;
const char *locktypename;
char tnbuf[32];
- Datum values[NUM_LOCK_STATUS_COLUMNS];
- bool nulls[NUM_LOCK_STATUS_COLUMNS];
+ Datum values[NUM_LOCK_STATUS_COLUMNS] = {0};
+ bool nulls[NUM_LOCK_STATUS_COLUMNS] = {0};
HeapTuple tuple;
Datum result;
LockInstanceData *instance;
/*
* Form tuple with appropriate data.
*/
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
if (instance->locktag.locktag_type <= LOCKTAG_LAST_TYPE)
locktypename = LockTagTypeNames[instance->locktag.locktag_type];
PREDICATELOCKTARGETTAG *predTag = &(predLockData->locktags[mystatus->predLockIdx]);
SERIALIZABLEXACT *xact = &(predLockData->xacts[mystatus->predLockIdx]);
- Datum values[NUM_LOCK_STATUS_COLUMNS];
- bool nulls[NUM_LOCK_STATUS_COLUMNS];
+ Datum values[NUM_LOCK_STATUS_COLUMNS] = {0};
+ bool nulls[NUM_LOCK_STATUS_COLUMNS] = {0};
HeapTuple tuple;
Datum result;
/*
* Form tuple with appropriate data.
*/
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, false, sizeof(nulls));
/* lock type */
lockType = GET_PREDICATELOCKTARGETTAG_TYPE(*predTag);
if (funcctx->call_cntr < list_length(partitions))
{
Datum result;
- Datum values[PG_PARTITION_TREE_COLS];
- bool nulls[PG_PARTITION_TREE_COLS];
+ Datum values[PG_PARTITION_TREE_COLS] = {0};
+ bool nulls[PG_PARTITION_TREE_COLS] = {0};
HeapTuple tuple;
Oid parentid = InvalidOid;
Oid relid = list_nth_oid(partitions, funcctx->call_cntr);
/*
* Form tuple with appropriate data.
*/
- MemSet(nulls, 0, sizeof(nulls));
- MemSet(values, 0, sizeof(values));
/* relid */
values[0] = ObjectIdGetDatum(relid);
{
LocalPgBackendStatus *local_beentry;
PgBackendStatus *beentry;
- Datum values[PG_STAT_GET_PROGRESS_COLS];
- bool nulls[PG_STAT_GET_PROGRESS_COLS];
+ Datum values[PG_STAT_GET_PROGRESS_COLS] = {0};
+ bool nulls[PG_STAT_GET_PROGRESS_COLS] = {0};
int i;
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
local_beentry = pgstat_fetch_stat_local_beentry(curr_backend);
if (!local_beentry)
for (curr_backend = 1; curr_backend <= num_backends; curr_backend++)
{
/* for each row */
- Datum values[PG_STAT_GET_ACTIVITY_COLS];
- bool nulls[PG_STAT_GET_ACTIVITY_COLS];
+ Datum values[PG_STAT_GET_ACTIVITY_COLS] = {0};
+ bool nulls[PG_STAT_GET_ACTIVITY_COLS] = {0};
LocalPgBackendStatus *local_beentry;
PgBackendStatus *beentry;
PGPROC *proc;
const char *wait_event_type = NULL;
const char *wait_event = NULL;
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/* Get the next one in the list */
local_beentry = pgstat_fetch_stat_local_beentry(curr_backend);
if (!local_beentry)
{
#define PG_STAT_GET_WAL_COLS 9
TupleDesc tupdesc;
- Datum values[PG_STAT_GET_WAL_COLS];
- bool nulls[PG_STAT_GET_WAL_COLS];
+ Datum values[PG_STAT_GET_WAL_COLS] = {0};
+ bool nulls[PG_STAT_GET_WAL_COLS] = {0};
char buf[256];
PgStat_WalStats *wal_stats;
- /* Initialise values and NULL flags arrays */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/* Initialise attributes information in the tuple descriptor */
tupdesc = CreateTemplateTupleDesc(PG_STAT_GET_WAL_COLS);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "wal_records",
for (i = 0;; i++)
{
/* for each row */
- Datum values[PG_STAT_GET_SLRU_COLS];
- bool nulls[PG_STAT_GET_SLRU_COLS];
+ Datum values[PG_STAT_GET_SLRU_COLS] = {0};
+ bool nulls[PG_STAT_GET_SLRU_COLS] = {0};
PgStat_SLRUStats stat;
const char *name;
break;
stat = stats[i];
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
values[0] = PointerGetDatum(cstring_to_text(name));
values[1] = Int64GetDatum(stat.blocks_zeroed);
pg_stat_get_archiver(PG_FUNCTION_ARGS)
{
TupleDesc tupdesc;
- Datum values[7];
- bool nulls[7];
+ Datum values[7] = {0};
+ bool nulls[7] = {0};
PgStat_ArchiverStats *archiver_stats;
- /* Initialise values and NULL flags arrays */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/* Initialise attributes information in the tuple descriptor */
tupdesc = CreateTemplateTupleDesc(7);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "archived_count",
text *slotname_text = PG_GETARG_TEXT_P(0);
NameData slotname;
TupleDesc tupdesc;
- Datum values[PG_STAT_GET_REPLICATION_SLOT_COLS];
- bool nulls[PG_STAT_GET_REPLICATION_SLOT_COLS];
+ Datum values[PG_STAT_GET_REPLICATION_SLOT_COLS] = {0};
+ bool nulls[PG_STAT_GET_REPLICATION_SLOT_COLS] = {0};
PgStat_StatReplSlotEntry *slotent;
PgStat_StatReplSlotEntry allzero;
- /* Initialise values and NULL flags arrays */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
/* Initialise attributes information in the tuple descriptor */
tupdesc = CreateTemplateTupleDesc(PG_STAT_GET_REPLICATION_SLOT_COLS);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "slot_name",
#define PG_STAT_GET_SUBSCRIPTION_STATS_COLS 4
Oid subid = PG_GETARG_OID(0);
TupleDesc tupdesc;
- Datum values[PG_STAT_GET_SUBSCRIPTION_STATS_COLS];
- bool nulls[PG_STAT_GET_SUBSCRIPTION_STATS_COLS];
+ Datum values[PG_STAT_GET_SUBSCRIPTION_STATS_COLS] = {0};
+ bool nulls[PG_STAT_GET_SUBSCRIPTION_STATS_COLS] = {0};
PgStat_StatSubEntry *subentry;
PgStat_StatSubEntry allzero;
TIMESTAMPTZOID, -1, 0);
BlessTupleDesc(tupdesc);
- /* Initialise values and NULL flags arrays */
- MemSet(values, 0, sizeof(values));
- MemSet(nulls, 0, sizeof(nulls));
-
if (!subentry)
{
/* If the subscription is not found, initialise its stats */
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
- GenericCosts costs;
+ GenericCosts costs = {0};
Oid relid;
AttrNumber colnum;
- VariableStatData vardata;
+ VariableStatData vardata = {0};
double numIndexTuples;
Cost descentCost;
List *indexBoundQuals;
/*
* Now do generic index cost estimation.
*/
- MemSet(&costs, 0, sizeof(costs));
costs.numIndexTuples = numIndexTuples;
genericcostestimate(root, path, loop_count, &costs);
* ordering, but don't negate it entirely. Before 8.0 we divided the
* correlation by the number of columns, but that seems too strong.)
*/
- MemSet(&vardata, 0, sizeof(vardata));
-
if (index->indexkeys[0] != 0)
{
/* Simple variable --- look to stats for the underlying table */
Selectivity *indexSelectivity, double *indexCorrelation,
double *indexPages)
{
- GenericCosts costs;
-
- MemSet(&costs, 0, sizeof(costs));
+ GenericCosts costs = {0};
genericcostestimate(root, path, loop_count, &costs);
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
- GenericCosts costs;
+ GenericCosts costs = {0};
Cost descentCost;
- MemSet(&costs, 0, sizeof(costs));
-
genericcostestimate(root, path, loop_count, &costs);
/*
double *indexPages)
{
IndexOptInfo *index = path->indexinfo;
- GenericCosts costs;
+ GenericCosts costs = {0};
Cost descentCost;
- MemSet(&costs, 0, sizeof(costs));
-
genericcostestimate(root, path, loop_count, &costs);
/*
}
static int
-interval_cmp_internal(Interval *interval1, Interval *interval2)
+interval_cmp_internal(const Interval *interval1, const Interval *interval2)
{
INT128 span1 = interval_cmp_value(interval1);
INT128 span2 = interval_cmp_value(interval2);
Timestamp finish = PG_GETARG_TIMESTAMP(1);
Interval *step = PG_GETARG_INTERVAL_P(2);
MemoryContext oldcontext;
- Interval interval_zero;
+ const Interval interval_zero = {0};
/* create a function context for cross-call persistence */
funcctx = SRF_FIRSTCALL_INIT();
fctx->step = *step;
/* Determine sign of the interval */
- MemSet(&interval_zero, 0, sizeof(Interval));
fctx->step_sign = interval_cmp_internal(&fctx->step, &interval_zero);
if (fctx->step_sign == 0)
TimestampTz finish = PG_GETARG_TIMESTAMPTZ(1);
Interval *step = PG_GETARG_INTERVAL_P(2);
MemoryContext oldcontext;
- Interval interval_zero;
+ const Interval interval_zero = {0};
/* create a function context for cross-call persistence */
funcctx = SRF_FIRSTCALL_INIT();
fctx->step = *step;
/* Determine sign of the interval */
- MemSet(&interval_zero, 0, sizeof(Interval));
fctx->step_sign = interval_cmp_internal(&fctx->step, &interval_zero);
if (fctx->step_sign == 0)
{
Portal portal = hentry->portal;
Datum values[6];
- bool nulls[6];
+ bool nulls[6] = {0};
/* report only "visible" entries */
if (!portal->visible)
continue;
- MemSet(nulls, 0, sizeof(nulls));
-
values[0] = CStringGetTextDatum(portal->name);
values[1] = CStringGetTextDatum(portal->sourceText);
values[2] = BoolGetDatum(portal->cursorOptions & CURSOR_OPT_HOLD);
{
#ifndef WIN32
fd_set fds;
- struct timeval tv;
+ struct timeval tv = {0};
int r;
/*
FD_ZERO(&fds);
FD_SET(bgpipe[0], &fds);
- MemSet(&tv, 0, sizeof(tv));
-
r = select(bgpipe[0] + 1, &fds, NULL, NULL, &tv);
if (r == 1)
{
- char xlogend[64];
+ char xlogend[64] = {0};
uint32 hi,
lo;
- MemSet(xlogend, 0, sizeof(xlogend));
r = read(bgpipe[0], xlogend, sizeof(xlogend) - 1);
if (r < 0)
pg_fatal("could not read from ready pipe: %m");
static int
LogStreamerMain(logstreamer_param *param)
{
- StreamCtl stream;
+ StreamCtl stream = {0};
in_log_streamer = true;
- MemSet(&stream, 0, sizeof(stream));
stream.startpos = param->startptr;
stream.timeline = param->timeline;
stream.sysidentifier = param->sysidentifier;
char *basebkp;
int i;
char xlogstart[64];
- char xlogend[64];
+ char xlogend[64] = {0};
int minServerMajor,
maxServerMajor;
int serverVersion,
else
starttli = latesttli;
PQclear(res);
- MemSet(xlogend, 0, sizeof(xlogend));
if (verbose && includewal != NO_WAL)
pg_log_info("write-ahead log start point: %s on timeline %u",
{
XLogRecPtr serverpos;
TimeLineID servertli;
- StreamCtl stream;
+ StreamCtl stream = {0};
char *sysidentifier;
- MemSet(&stream, 0, sizeof(stream));
-
/*
* Connect in replication mode to the server
*/
padding = tarPaddingBytesRequired(filesize);
if (padding)
{
- char zerobuf[TAR_BLOCK_SIZE];
+ char zerobuf[TAR_BLOCK_SIZE] = {0};
- MemSet(zerobuf, 0, padding);
if (tar_write(f, zerobuf, padding) != padding)
return -1;
}
static bool
tar_finish(void)
{
- char zerobuf[1024];
+ char zerobuf[1024] = {0};
tar_clear_error();
}
/* A tarfile always ends with two empty blocks */
- MemSet(zerobuf, 0, sizeof(zerobuf));
if (tar_data->compression_algorithm == PG_COMPRESSION_NONE)
{
errno = 0;
getaddrinfo_unix(const char *path, const struct addrinfo *hintsp,
struct addrinfo **result)
{
- struct addrinfo hints;
+ struct addrinfo hints = {0};
struct addrinfo *aip;
struct sockaddr_un *unp;
*result = NULL;
- MemSet(&hints, 0, sizeof(hints));
-
if (strlen(path) >= sizeof(unp->sun_path))
return EAI_FAIL;
int longflag;
int fmtpos;
int i;
- int last_dollar;
- PrintfArgType argtypes[PG_NL_ARGMAX + 1];
-
- /* Initialize to "no dollar arguments known" */
- last_dollar = 0;
- MemSet(argtypes, 0, sizeof(argtypes));
+ int last_dollar = 0; /* Init to "no dollar arguments known" */
+ PrintfArgType argtypes[PG_NL_ARGMAX + 1] = {0};
/*
* This loop must accept the same format strings as the one in dopr().
strong_refuted_by,
weak_refuted_by;
Datum values[8];
- bool nulls[8];
+ bool nulls[8] = {0};
int i;
/* We use SPI to parse, plan, and execute the test query */
"w_r_holds", BOOLOID, -1, 0);
tupdesc = BlessTupleDesc(tupdesc);
- MemSet(nulls, 0, sizeof(nulls));
values[0] = BoolGetDatum(strong_implied_by);
values[1] = BoolGetDatum(weak_implied_by);
values[2] = BoolGetDatum(strong_refuted_by);
int convertedbytes;
int dstlen;
Datum values[2];
- bool nulls[2];
+ bool nulls[2] = {0};
HeapTuple tuple;
if (src_encoding < 0)
pfree(dst);
}
- MemSet(nulls, 0, sizeof(nulls));
values[0] = Int32GetDatum(convertedbytes);
values[1] = PointerGetDatum(retval);
tuple = heap_form_tuple(tupdesc, values, nulls);