Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Furthermore, for more detailed installation instructions, please refer to the [I

## Developer Formatting hooks and CI:
- A pre-commit formatting hook is provided at `.githooks/pre-commit`. Enable it with `git config core.hooksPath .githooks`, or run `make enable-git-hooks` (equivalently `bash tools/enable-git-hooks.sh`).
- The hook depends only on in-tree tools `src/tools/pgindent` and `src/tools/pg_bsd_indent`. On commit it formats staged C/C++ files with pgindent and re-adds them to the index.
- The hook depends only on in-tree tools `src/tools/pgindent` and `src/tools/pg_bsd_indent`. On commit it formats staged C/C++ files with pgindent and re-adds them to the staged area.
- A Cirrus workflow `FormatCheck` runs `pgindent --check` on files changed in a PR.

## Contributing to the IvorySQL
Expand Down
8 changes: 4 additions & 4 deletions contrib/postgres_fdw/deparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* well as functions to construct the query text to be sent. The latter
* functionality is annoyingly duplicative of ruleutils.c, but there are
* enough special considerations that it seems best to keep this separate.
* One saving grace is that we only need deparse logic for node types that
* we consider safe to send.
* One saving grace is that deparse logic is required only for node types
* considered safe to send.
*
* We assume that the remote session's search_path is exactly "pg_catalog",
* and thus we need schema-qualify all and only names outside pg_catalog.
Expand Down Expand Up @@ -2976,7 +2976,7 @@ deparseVar(Var *node, deparse_expr_cxt *context)
qualify_col);
else
{
/* Treat like a Param */
/* Treat as a Param */
if (context->params_list)
{
int pindex = 0;
Expand Down Expand Up @@ -3409,7 +3409,7 @@ deparseOperatorName(StringInfo buf, Form_pg_operator opform)
{
char *opname;

/* opname is not a SQL identifier, so we should not quote it. */
/* opname is not a SQL identifier, so do not quote it. */
opname = NameStr(opform->oprname);

/* Print schema name only if it's not pg_catalog */
Expand Down
64 changes: 37 additions & 27 deletions src/backend/catalog/dependency.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static void reportDependentObjects(const ObjectAddresses *targetObjects,
DropBehavior behavior,
int flags,
const ObjectAddress *origObject,
bool *refinddepobjects);
bool *refinddepobjects);
static void deleteOneObject(const ObjectAddress *object,
Relation *depRel, int32 flags);
static void doDeletion(const ObjectAddress *object, int flags);
Expand Down Expand Up @@ -287,7 +287,7 @@ performDeletion(const ObjectAddress *object,
{
Relation depRel;
ObjectAddresses *targetObjects;
bool need_refinddepobj = false;
bool need_refinddepobj = false;

/*
* We save some cycles by opening pg_depend just once and passing the
Expand Down Expand Up @@ -363,7 +363,7 @@ performMultipleDeletions(const ObjectAddresses *objects,
Relation depRel;
ObjectAddresses *targetObjects;
int i;
bool need_refinddepobj = false;
bool need_refinddepobj = false;

/* No work if no objects... */
if (objects->numrefs <= 0)
Expand Down Expand Up @@ -427,7 +427,9 @@ performMultipleDeletions(const ObjectAddresses *objects,
const ObjectAddress *thisobj = objects->refs + i;

/*
* Obtain a deletion lock for every target object. (Preferably, this should have been handled by the caller, but in reality, many callers neglect to do so.)
* Obtain a deletion lock for every target object. (Preferably,
* this should have been handled by the caller, but in reality,
* many callers neglect to do so.)
*/
AcquireDeletionLock(thisobj, flags);

Expand Down Expand Up @@ -504,7 +506,7 @@ findDependentObjects(const ObjectAddress *object,
int maxDependentObjects;
ObjectAddressStack mystack;
ObjectAddressExtra extra;
ObjectFunOrPkg *dependentFuncPkgOids;
ObjectFunOrPkg *dependentFuncPkgOids;
int numDependentFuncPkgOids;
int maxDependentFuncPkgOids;

Expand Down Expand Up @@ -968,7 +970,7 @@ findDependentObjects(const ObjectAddress *object,
if (foundDep->deptype == DEPENDENCY_TYPE &&
(object->classId == RelationRelationId ||
object->classId == PackageRelationId ||
object->classId == PackageBodyRelationId ))
object->classId == PackageBodyRelationId))
{
if (foundDep->classid == 0)
continue;
Expand Down Expand Up @@ -1106,17 +1108,17 @@ findDependentObjects(const ObjectAddress *object,
pg_qsort(dependentFuncPkgOids, numDependentFuncPkgOids,
sizeof(ObjectFunOrPkg), object_funpkgoid_comparator);

numDependentFuncPkgOids = qunique((void *)dependentFuncPkgOids, numDependentFuncPkgOids,
sizeof(ObjectFunOrPkg), object_funpkgoid_comparator);
numDependentFuncPkgOids = qunique((void *) dependentFuncPkgOids, numDependentFuncPkgOids,
sizeof(ObjectFunOrPkg), object_funpkgoid_comparator);
}

/*
* Find out the dependent funciton which uses %TYPE or %ROWTYPE
* in parameters datatype or return datatype.
* Find out the dependent funciton which uses %TYPE or %ROWTYPE in
* parameters datatype or return datatype.
*/
for (int i = 0; i < numDependentFuncPkgOids; i++)
{
Oid objectId = dependentFuncPkgOids[i].objectId;
Oid objectId = dependentFuncPkgOids[i].objectId;

switch (dependentFuncPkgOids[i].flags)
{
Expand Down Expand Up @@ -1150,7 +1152,7 @@ findDependentObjects(const ObjectAddress *object,
{
PackageCacheKey pkey;
PackageCacheItem *item;
HeapTuple pkgbodyTup;
HeapTuple pkgbodyTup;
Form_pg_package_body pkgbodyStruct;

/*
Expand Down Expand Up @@ -1269,7 +1271,7 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
if (ORA_PARSER == compatible_db && behavior == DROP_RESTRICT)
{
/* Check if all dependencies that require CASCADE are views */
bool all_cascade_dep_is_view = true;
bool all_cascade_dep_is_view = true;
ObjectAddresses *viewObjects;

viewObjects = new_object_addresses();
Expand All @@ -1295,8 +1297,9 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
continue;

/*
* If the object was found via an automatic, internal, partition, or extension dependency,
* it is permitted to be removed even with RESTRICT.
* If the object was found via an automatic, internal, partition,
* or extension dependency, it is permitted to be removed even
* with RESTRICT.
*/
if (extra->flags & (DEPFLAG_AUTO |
DEPFLAG_INTERNAL |
Expand All @@ -1317,7 +1320,10 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
}
else
{
/* If any dependent object is not a view, set flag and exit loop */
/*
* If any dependent object is not a view, set flag and exit
* loop
*/
if (get_rel_relkind(obj->objectId) != RELKIND_VIEW)
{
all_cascade_dep_is_view = false;
Expand All @@ -1330,7 +1336,10 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
pfree(objDesc);
}

/* If all dependencies are views, mark them as invalid and trigger a recheck */
/*
* If all dependencies are views, mark them as invalid and trigger a
* recheck
*/
if (all_cascade_dep_is_view && viewObjects->numrefs > 0)
{
for (i = viewObjects->numrefs - 1; i >= 0; i--)
Expand All @@ -1339,7 +1348,8 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
}

/*
* After invalidating views, re-evaluate dependencies to ensure consistency.
* After invalidating views, re-evaluate dependencies to ensure
* consistency.
*/
if (refinddepobj)
*refinddepobj = true;
Expand Down Expand Up @@ -1709,7 +1719,7 @@ doDeletion(const ObjectAddress *object, int flags)
DeleteSequenceTuple(object->objectId);

if (ORA_PARSER == compatible_db && relKind == RELKIND_VIEW)
DeleteForceView(object->objectId);
DeleteForceView(object->objectId);

break;
}
Expand Down Expand Up @@ -1851,7 +1861,7 @@ AcquireDeletionLock(const ObjectAddress *object, int flags)
AccessExclusiveLock);
else
{
/* assume we should lock the whole object not a sub-object */
/* Assume we lock the whole object, not a sub-object */
LockDatabaseObject(object->classId, object->objectId, 0,
AccessExclusiveLock);
}
Expand All @@ -1868,7 +1878,7 @@ ReleaseDeletionLock(const ObjectAddress *object)
if (object->classId == RelationRelationId)
UnlockRelationOid(object->objectId, AccessExclusiveLock);
else
/* assume we should lock the whole object not a sub-object */
/* Assume we lock the whole object, not a sub-object */
UnlockDatabaseObject(object->classId, object->objectId, 0,
AccessExclusiveLock);
}
Expand Down Expand Up @@ -2211,21 +2221,21 @@ find_expr_references_walker(Node *node,

if (FUNC_EXPR_FROM_PG_PROC(funcexpr->function_from))
add_object_address(ProcedureRelationId, funcexpr->funcid, 0,
context->addrs);
context->addrs);
else
{
Oid funcoid = InvalidOid;
bool is_package = false;
bool is_package = false;

funcoid = get_top_function_info(funcexpr, &is_package);
if (OidIsValid(funcoid))
{
if (is_package)
add_object_address(PackageRelationId, funcoid, 0,
context->addrs);
context->addrs);
else
add_object_address(ProcedureRelationId, funcoid, 0,
context->addrs);
context->addrs);
}
}

Expand Down Expand Up @@ -2857,8 +2867,8 @@ object_address_comparator(const void *a, const void *b)
int
object_funpkgoid_comparator(const void *a, const void *b)
{
const ObjectFunOrPkg *obja = (const ObjectFunOrPkg *) a;
const ObjectFunOrPkg *objb = (const ObjectFunOrPkg *) b;
const ObjectFunOrPkg *obja = (const ObjectFunOrPkg *) a;
const ObjectFunOrPkg *objb = (const ObjectFunOrPkg *) b;

if (obja->objectId > objb->objectId)
return -1;
Expand Down
23 changes: 11 additions & 12 deletions src/backend/commands/explain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ ExplainPrintSerialize(ExplainState *es, SerializeMetrics *metrics)
{
const char *format;

/* We shouldn't get called for EXPLAIN_SERIALIZE_NONE */
/* Must not be called for EXPLAIN_SERIALIZE_NONE */
if (es->serialize == EXPLAIN_SERIALIZE_TEXT)
format = "text";
else
Expand Down Expand Up @@ -1343,7 +1343,7 @@ plan_is_disabled(Plan *plan)
* (eg, "Outer", "Inner"); it can be null at top level. plan_name is an
* optional name to be attached to the node.
*
* In text format, es->indent is controlled in this function since we only
* In text format, es->indent is controlled here since we only
* want it to change at plan-node boundaries (but a few subroutines will
* transiently increment it). In non-text formats, es->indent corresponds
* to the nesting depth of logical output groups, and therefore is controlled
Expand Down Expand Up @@ -1699,7 +1699,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
{
BitmapIndexScan *bitmapindexscan = (BitmapIndexScan *) plan;
const char *indexname =
explain_get_index_name(bitmapindexscan->indexid);
explain_get_index_name(bitmapindexscan->indexid);

if (es->format == EXPLAIN_FORMAT_TEXT)
appendStringInfo(es->str, " on %s",
Expand Down Expand Up @@ -3116,13 +3116,12 @@ show_sort_info(SortState *sortstate, ExplainState *es)
}

/*
* You might think we should just skip this stanza entirely when
* es->hide_workers is true, but then we'd get no sort-method output at
* all. We have to make it look like worker 0's data is top-level data.
* This is easily done by just skipping the OpenWorker/CloseWorker calls.
* Currently, we don't worry about the possibility that there are multiple
* workers in such a case; if there are, duplicate output fields will be
* emitted.
* It might seem better to skip this stanza entirely when es->hide_workers
* is true, but then we'd get no sort-method output at all. We have to
* make it look like worker 0's data is top-level data. This is easily
* done by just skipping the OpenWorker/CloseWorker calls. Currently, we
* don't worry about the possibility that there are multiple workers in
* such a case; if there are, duplicate output fields will be emitted.
*/
if (sortstate->shared_info != NULL)
{
Expand Down Expand Up @@ -3330,7 +3329,7 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate,
for (n = 0; n < incrsortstate->shared_info->num_workers; n++)
{
IncrementalSortInfo *incsort_info =
&incrsortstate->shared_info->sinfo[n];
&incrsortstate->shared_info->sinfo[n];

/*
* If a worker hasn't processed any sort groups at all, then
Expand Down Expand Up @@ -4831,7 +4830,7 @@ ExplainCustomChildren(CustomScanState *css, List *ancestors, ExplainState *es)
{
ListCell *cell;
const char *label =
(list_length(css->custom_ps) != 1 ? "children" : "child");
(list_length(css->custom_ps) != 1 ? "children" : "child");

foreach(cell, css->custom_ps)
ExplainNode((PlanState *) lfirst(cell), ancestors, label, NULL, es);
Expand Down
Loading