else
{
name = textarray_to_strvaluelist(namearr);
- if (list_length(name) < 1)
+ if (name == NIL)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("name list length must be at least %d", 1)));
if (list_length(seqlist) > 1)
elog(ERROR, "more than one owned sequence found");
- else if (list_length(seqlist) < 1)
+ else if (seqlist == NIL)
{
if (missing_ok)
return InvalidOid;
* true if any sql_drop, table_rewrite, ddl_command_end event trigger
* exists
*/
- return list_length(EventCacheLookup(EVT_SQLDrop)) > 0 ||
- list_length(EventCacheLookup(EVT_TableRewrite)) > 0 ||
- list_length(EventCacheLookup(EVT_DDLCommandEnd)) > 0;
+ return (EventCacheLookup(EVT_SQLDrop) != NIL) ||
+ (EventCacheLookup(EVT_TableRewrite) != NIL) ||
+ (EventCacheLookup(EVT_DDLCommandEnd) != NIL);
}
/*
parent = currentEventTriggerState->currentCommand->parent;
/* If no subcommands, don't collect */
- if (list_length(currentEventTriggerState->currentCommand->d.alterTable.subcmds) != 0)
+ if (currentEventTriggerState->currentCommand->d.alterTable.subcmds != NIL)
{
MemoryContext oldcxt;
* Make sure no variables are referred to (this is probably dead
* code now that add_missing_from is history).
*/
- if (list_length(pstate->p_rtable) != 0 ||
+ if (pstate->p_rtable != NIL ||
contain_var_clause(def))
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
returnsSet = false;
}
- if (list_length(trftypes_list) > 0)
+ if (trftypes_list != NIL)
{
ListCell *lc;
Datum *arr;
&schemaidlist);
/* FOR ALL TABLES IN SCHEMA requires superuser */
- if (list_length(schemaidlist) > 0 && !superuser())
+ if (schemaidlist != NIL && !superuser())
ereport(ERROR,
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to create FOR ALL TABLES IN SCHEMA publication"));
- if (list_length(relations) > 0)
+ if (relations != NIL)
{
List *rels;
CloseTableList(rels);
}
- if (list_length(schemaidlist) > 0)
+ if (schemaidlist != NIL)
{
/*
* Schema lock is held until the publication is created to prevent
if ((list_length(stmt->exprs) == 1) && (list_length(stxexprs) == 1))
{
/* statistics kinds not specified */
- if (list_length(stmt->stat_types) > 0)
+ if (stmt->stat_types != NIL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("when building statistics on a single expression, statistics kinds may not be specified")));
* automatically. This allows calculating good estimates for stats that
* consider per-clause estimates (e.g. functional dependencies).
*/
- build_expressions = (list_length(stxexprs) > 0);
+ build_expressions = (stxexprs != NIL);
/*
* Check that at least two columns were specified in the statement, or
ListCell *lc;
bool first = true;
- Assert(list_length(publications) > 0);
+ Assert(publications != NIL);
foreach(lc, publications)
{
* Assemble an array of relids so we can write a single WAL record for the
* whole action.
*/
- if (list_length(relids_logged) > 0)
+ if (relids_logged != NIL)
{
xl_heap_truncate xlrec;
int i = 0;
}
/*
- * Check that the table is not part any publication when changing to
- * UNLOGGED as UNLOGGED tables can't be published.
+ * Check that the table is not part of any publication when changing to
+ * UNLOGGED, as UNLOGGED tables can't be published.
*/
if (!toLogged &&
- list_length(GetRelationPublications(RelationGetRelid(rel))) > 0)
+ GetRelationPublications(RelationGetRelid(rel)) != NIL)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("cannot change table \"%s\" to unlogged because it is part of a publication",
* Domains don't allow variables (this is probably dead code now that
* add_missing_from is history, but let's be sure).
*/
- if (list_length(pstate->p_rtable) != 0 ||
+ if (pstate->p_rtable != NIL ||
contain_var_clause(expr))
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
* list and searching for ancestry relationships to each index in the
* ancestor table.
*/
- if (list_length(rootResultRelInfo->ri_onConflictArbiterIndexes) > 0)
+ if (rootResultRelInfo->ri_onConflictArbiterIndexes != NIL)
{
List *childIdxs;
Assert(offsetof(radius_packet, vector) == 4);
/* Verify parameters */
- if (list_length(port->hba->radiusservers) < 1)
+ if (port->hba->radiusservers == NIL)
{
ereport(LOG,
(errmsg("RADIUS server not specified")));
return STATUS_ERROR;
}
- if (list_length(port->hba->radiussecrets) < 1)
+ if (port->hba->radiussecrets == NIL)
{
ereport(LOG,
(errmsg("RADIUS secret not specified")));
MANDATORY_AUTH_ARG(parsedline->radiusservers, "radiusservers", "radius");
MANDATORY_AUTH_ARG(parsedline->radiussecrets, "radiussecrets", "radius");
- if (list_length(parsedline->radiusservers) < 1)
+ if (parsedline->radiusservers == NIL)
{
ereport(elevel,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
return NULL;
}
- if (list_length(parsedline->radiussecrets) < 1)
+ if (parsedline->radiussecrets == NIL)
{
ereport(elevel,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
List *cache_varinfos = NIL;
/* fallback if pathkeys is unknown */
- if (list_length(pathkeys) == 0)
+ if (pathkeys == NIL)
{
/*
* If we'll use a bounded heap-sort keeping just K tuples in memory,
if (rollup->is_hashed)
strat = AGG_HASHED;
- else if (list_length(linitial(rollup->gsets)) == 0)
+ else if (linitial(rollup->gsets) == NIL)
strat = AGG_PLAIN;
else
strat = AGG_SORTED;
GroupingSetData *gs = makeNode(GroupingSetData);
while (list_length(sortclause) > list_length(previous) &&
- list_length(new_elems) > 0)
+ new_elems != NIL)
{
SortGroupClause *sc = list_nth(sortclause, list_length(previous));
int ref = sc->tleSortGroupRef;
/*
* If we have sorted input but nothing we can do with it, bail.
*/
- if (list_length(gd->rollups) == 0)
+ if (gd->rollups == NIL)
return;
/*
group_clauses,
orderAggPathkeys);
- Assert(list_length(pathkey_orderings) > 0);
+ Assert(pathkey_orderings != NIL);
/* process all potentially interesting grouping reorderings */
foreach(lc2, pathkey_orderings)
group_clauses,
orderAggPathkeys);
- Assert(list_length(pathkey_orderings) > 0);
+ Assert(pathkey_orderings != NIL);
/* process all potentially interesting grouping reorderings */
foreach(lc2, pathkey_orderings)
group_clauses,
orderAggPathkeys);
- Assert(list_length(pathkey_orderings) > 0);
+ Assert(pathkey_orderings != NIL);
/* process all potentially interesting grouping reorderings */
foreach(lc2, pathkey_orderings)
group_clauses,
orderAggPathkeys);
- Assert(list_length(pathkey_orderings) > 0);
+ Assert(pathkey_orderings != NIL);
/* process all potentially interesting grouping reorderings */
foreach(lc2, pathkey_orderings)
context->rel->part_scheme->strategy == PARTITION_STRATEGY_HASH);
/* Quick exit if there are no values to prefix with. */
- if (list_length(prefix) == 0)
+ if (prefix == NIL)
{
PartitionPruneStep *step;
* immediate restarts. We don't need it if there are no tables that need
* syncing.
*/
- if (table_states_not_ready && !last_start_times)
+ if (table_states_not_ready != NIL && !last_start_times)
{
HASHCTL ctl;
* Clean up the hash table when we're done with all tables (just to
* release the bit of memory).
*/
- else if (!table_states_not_ready && last_start_times)
+ else if (table_states_not_ready == NIL && last_start_times)
{
hash_destroy(last_start_times);
last_start_times = NULL;
* if table_state_not_ready was empty we still need to check again to
* see if there are 0 tables.
*/
- has_subrels = (list_length(table_states_not_ready) > 0) ||
+ has_subrels = (table_states_not_ready != NIL) ||
HasSubscriptionRelations(MySubscription->oid);
table_states_valid = true;
* Return false when there are no tables in subscription or not all tables
* are in ready state; true otherwise.
*/
- return has_subrels && list_length(table_states_not_ready) == 0;
+ return has_subrels && (table_states_not_ready == NIL);
}
/*
errmsg("client sent proto_version=%d but we only support protocol %d or higher",
data->protocol_version, LOGICALREP_PROTO_MIN_VERSION_NUM)));
- if (list_length(data->publication_names) < 1)
+ if (data->publication_names == NIL)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("publication_names parameter missing")));
*
* So there cannot be INSTEAD NOTHING, ...
*/
- if (list_length(action) == 0)
+ if (action == NIL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("INSTEAD NOTHING rules on SELECT are not implemented"),
/* The bitmap may be partially built. */
Assert(clauses != NIL);
- Assert(list_length(clauses) >= 1);
Assert(mcvlist != NULL);
Assert(mcvlist->nitems > 0);
Assert(mcvlist->nitems <= STATS_MCVLIST_MAX_ITEMS);
int done = 0;
/* Done if no locks to wait for */
- if (list_length(locktags) == 0)
+ if (locktags == NIL)
return;
/* Collect the transactions we need to wait on */
/* extract a list of nodes to be AND-ed */
List *nodes = extract_jsp_path_expr_nodes(cxt, path, jsp, scalar);
- if (list_length(nodes) <= 0)
+ if (nodes == NIL)
/* no nodes were extracted => full scan is needed for this path */
return NULL;
static bool
JsonValueListIsEmpty(JsonValueList *jvl)
{
- return !jvl->singleton && list_length(jvl->list) <= 0;
+ return !jvl->singleton && (jvl->list == NIL);
}
static JsonbValue *
ListCell *cell;
int i = 0;
- Assert(list_length(list) > 0);
+ Assert(list != NIL);
v->value.array.nelems = list_length(list);
v->value.array.elems = palloc(sizeof(v->value.array.elems[0]) *
{
deparse_namespace *dpns = lfirst(lc);
- if (list_length(dpns->rtable_names) > 0)
+ if (dpns->rtable_names != NIL)
{
should_qualify = true;
break;
* for normal cases with GROUP BY or DISTINCT, but it is possible for
* corner cases with set operations.)
*/
- if (groupExprs == NIL || (pgset && list_length(*pgset) < 1))
+ if (groupExprs == NIL || (pgset && *pgset == NIL))
return 1.0;
/*
close_tsvector_parser(state.valstate);
- if (list_length(state.polstr) == 0)
+ if (state.polstr == NIL)
{
ereport(NOTICE,
(errmsg("text-search query doesn't contain lexemes: \"%s\"",
SetSingleFuncCall(fcinfo, 0);
- if (list_length(cmd->d.alterTable.subcmds) == 0)
+ if (cmd->d.alterTable.subcmds == NIL)
elog(ERROR, "empty alter table subcommand list");
foreach(cell, cmd->d.alterTable.subcmds)