Обсуждение: pgindent vs variable declaration across multiple lines

Поиск
Список
Период
Сортировка

pgindent vs variable declaration across multiple lines

От
Andres Freund
Дата:
Hi,

There's a few places in the code that try to format a variable definition like this

    ReorderBufferChange *next_change =
        dlist_container(ReorderBufferChange, node, next);

but pgindent turns that into

    ReorderBufferChange *next_change =
    dlist_container(ReorderBufferChange, node, next);

even though the same pattern works, and is used fairly widely for assignments

    amroutine->amparallelvacuumoptions =
        VACUUM_OPTION_PARALLEL_BULKDEL;

Particularly when variable and/or types names are longer, it's sometimes hard
to fit enough into one line to use a different style. E.g., the code I'm
currently hacking on has

            RWConflict  possibleUnsafeConflict = dlist_container(RWConflictData, inLink, iter.cur);

There's simply no way to make break that across lines that doesn't either
violate the line length limit or makes pgindent do odd things:

too long line:
            RWConflict  possibleUnsafeConflict = dlist_container(RWConflictData,
                                                                 inLink,
                                                                 iter.cur);

pgindent will move start of second line:
            RWConflict  possibleUnsafeConflict =
                dlist_container(RWConflictData, inLink, iter.cur);

I know I can leave the variable initially uninitialized and then do a separate
assignment, but that's not a great fix. And sometimes other initializations
want to access the variable alrady.


Do others dislike this as well?

I assume we'd again have to dive into pg_bsd_indent's code to fix it :(

And even if we were to figure out how, would it be worth the
reindent-all-branches pain? I'd say yes, but...

Greetings,

Andres Freund



Re: pgindent vs variable declaration across multiple lines

От
Tom Lane
Дата:
Andres Freund <andres@anarazel.de> writes:
> There's a few places in the code that try to format a variable definition like this

>     ReorderBufferChange *next_change =
>         dlist_container(ReorderBufferChange, node, next);

> but pgindent turns that into

>     ReorderBufferChange *next_change =
>     dlist_container(ReorderBufferChange, node, next);

Yeah, that's bugged me too.  I suspect that the triggering factor is
use of a typedef name within the assigned expression, but I've not
tried to run it to ground.

> I assume we'd again have to dive into pg_bsd_indent's code to fix it :(

Yeah :-(.  That's enough of a rat's nest that I've not really wanted to.
But I'd support applying such a fix if someone can figure it out.

> And even if we were to figure out how, would it be worth the
> reindent-all-branches pain? I'd say yes, but...

What reindent-all-branches pain?  We haven't done an all-branches
reindent in the past, even for pgindent fixes that touched far more
code than this would (assuming that the proposed fix doesn't have
other side-effects).

            regards, tom lane



Re: pgindent vs variable declaration across multiple lines

От
Andres Freund
Дата:
Hi,

On 2023-01-19 20:43:44 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > There's a few places in the code that try to format a variable definition like this
> 
> >     ReorderBufferChange *next_change =
> >         dlist_container(ReorderBufferChange, node, next);
> 
> > but pgindent turns that into
> 
> >     ReorderBufferChange *next_change =
> >     dlist_container(ReorderBufferChange, node, next);
> 
> Yeah, that's bugged me too.  I suspect that the triggering factor is
> use of a typedef name within the assigned expression, but I've not
> tried to run it to ground.

It's not that - it happens even with just
    int frak =
        1;

since it doesn't happen for plain assignments, I think it's somehow related to
code dealing with variable declarations.


> > I assume we'd again have to dive into pg_bsd_indent's code to fix it :(
> 
> Yeah :-(.  That's enough of a rat's nest that I've not really wanted to.
> But I'd support applying such a fix if someone can figure it out.

It's pretty awful code :(


> > And even if we were to figure out how, would it be worth the
> > reindent-all-branches pain? I'd say yes, but...
> 
> What reindent-all-branches pain?  We haven't done an all-branches
> reindent in the past, even for pgindent fixes that touched far more
> code than this would (assuming that the proposed fix doesn't have
> other side-effects).

Oh. I thought we had re-indented the other branches when we modified
pg_bsd_intent substantially in the past, to reduce backpatching pain. But I
guess we just discussed that option, but didn't end up pursuing it.

Greetings,

Andres Freund



Re: pgindent vs variable declaration across multiple lines

От
Tom Lane
Дата:
Andres Freund <andres@anarazel.de> writes:
> On 2023-01-19 20:43:44 -0500, Tom Lane wrote:
>> What reindent-all-branches pain?  We haven't done an all-branches
>> reindent in the past, even for pgindent fixes that touched far more
>> code than this would (assuming that the proposed fix doesn't have
>> other side-effects).

> Oh. I thought we had re-indented the other branches when we modified
> pg_bsd_intent substantially in the past, to reduce backpatching pain. But I
> guess we just discussed that option, but didn't end up pursuing it.

Yeah, we did discuss it, but never did it --- I think the convincing
argument not to was that major reformatting would be very painful
for people maintaining forks, and we shouldn't put them through that
to track minor releases.

            regards, tom lane



Re: pgindent vs variable declaration across multiple lines

От
Andres Freund
Дата:
Hi,

On 2023-01-19 17:59:49 -0800, Andres Freund wrote:
> On 2023-01-19 20:43:44 -0500, Tom Lane wrote:
> > Andres Freund <andres@anarazel.de> writes:
> > > There's a few places in the code that try to format a variable definition like this
> >
> > >     ReorderBufferChange *next_change =
> > >         dlist_container(ReorderBufferChange, node, next);
> >
> > > but pgindent turns that into
> >
> > >     ReorderBufferChange *next_change =
> > >     dlist_container(ReorderBufferChange, node, next);
> >
> > Yeah, that's bugged me too.  I suspect that the triggering factor is
> > use of a typedef name within the assigned expression, but I've not
> > tried to run it to ground.
>
> It's not that - it happens even with just
>     int frak =
>         1;
>
> since it doesn't happen for plain assignments, I think it's somehow related to
> code dealing with variable declarations.

Another fun one: pgindent turns

    return (instr_time) {t.QuadPart};
into
    return (struct instr_time)
    {
        t.QuadPart
    };

Obviously it can be dealt with with a local variable, but ...

Greetings,

Andres Freund



Re: pgindent vs variable declaration across multiple lines

От
Robert Haas
Дата:
On Thu, Jan 19, 2023 at 8:31 PM Andres Freund <andres@anarazel.de> wrote:
> I know I can leave the variable initially uninitialized and then do a separate
> assignment, but that's not a great fix.

That's what I do.

If you pick names for all of your data types that are very very long
and wordy then you don't feel as bad about this, because you were
gonna need a line break anyway. :-)

-- 
Robert Haas
EDB: http://www.enterprisedb.com



Re: pgindent vs variable declaration across multiple lines

От
Thomas Munro
Дата:
On Fri, Jan 20, 2023 at 2:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Andres Freund <andres@anarazel.de> writes:
> > There's a few places in the code that try to format a variable definition like this
>
> >     ReorderBufferChange *next_change =
> >         dlist_container(ReorderBufferChange, node, next);
>
> > but pgindent turns that into
>
> >     ReorderBufferChange *next_change =
> >     dlist_container(ReorderBufferChange, node, next);
>
> Yeah, that's bugged me too.  I suspect that the triggering factor is
> use of a typedef name within the assigned expression, but I've not
> tried to run it to ground.
>
> > I assume we'd again have to dive into pg_bsd_indent's code to fix it :(
>
> Yeah :-(.  That's enough of a rat's nest that I've not really wanted to.
> But I'd support applying such a fix if someone can figure it out.

This may be a clue: the place where declarations are treated
differently seems to be (stangely) in io.c:

    ps.ind_stmt = ps.in_stmt & ~ps.in_decl;     /* next line should be
                                                 * indented if we have not
                                                 * completed this stmt and if
                                                 * we are not in the middle of
                                                 * a declaration */

If you just remove "& ~ps.in_decl" then it does the desired thing for
that new code in predicate.c, but it also interferes with declarations
with commas, ie int i, j; where i and j currently line up, now j just
gets one indentation level.  It's probably not the right way to do it
but you can fix that with a last token kluge, something like:

#include "indent_codes.h"

    ps.ind_stmt = ps.in_stmt && (!ps.in_decl || ps.last_token != comma);

That improves a lot of code in our tree IMHO but of course there is
other collateral damage...



Re: pgindent vs variable declaration across multiple lines

От
Tom Lane
Дата:
Thomas Munro <thomas.munro@gmail.com> writes:
> On Fri, Jan 20, 2023 at 2:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Yeah :-(.  That's enough of a rat's nest that I've not really wanted to.
>> But I'd support applying such a fix if someone can figure it out.

> This may be a clue: the place where declarations are treated
> differently seems to be (stangely) in io.c:

>     ps.ind_stmt = ps.in_stmt & ~ps.in_decl;     /* next line should be
>                                                  * indented if we have not
>                                                  * completed this stmt and if
>                                                  * we are not in the middle of
>                                                  * a declaration */

> If you just remove "& ~ps.in_decl" then it does the desired thing for
> that new code in predicate.c, but it also interferes with declarations
> with commas, ie int i, j; where i and j currently line up, now j just
> gets one indentation level.  It's probably not the right way to do it
> but you can fix that with a last token kluge, something like:
> #include "indent_codes.h"
>     ps.ind_stmt = ps.in_stmt && (!ps.in_decl || ps.last_token != comma);
> That improves a lot of code in our tree IMHO but of course there is
> other collateral damage...

I spent some more time staring at this and came up with what seems like
a workable patch, based on the idea that what we want to indent is
specifically initialization expressions.  pg_bsd_indent does have some
understanding of that: ps.block_init is true within such an expression,
and then ps.block_init_level is the brace nesting depth inside it.
If you just enable ind_stmt based on block_init then you get a bunch
of unwanted additional indentation inside struct initializers, but
it seems to work okay if you restrict it to not happen inside braces.
More importantly, it doesn't change anything we don't want changed.

Proposed patch for pg_bsd_indent attached.  I've also attached a diff
representing the delta between what current pg_bsd_indent wants to do
to HEAD and what this would do.  All the changes it wants to make look
good, although I can't say whether there are other places it's failing
to change that we'd like it to.

            regards, tom lane

diff --git a/io.c b/io.c
index 3ce8bfb..8a05d7e 100644
--- a/io.c
+++ b/io.c
@@ -205,11 +205,12 @@ dump_line(void)
     ps.decl_on_line = ps.in_decl;    /* if we are in the middle of a
                      * declaration, remember that fact for
                      * proper comment indentation */
-    ps.ind_stmt = ps.in_stmt & ~ps.in_decl;    /* next line should be
-                         * indented if we have not
-                         * completed this stmt and if
-                         * we are not in the middle of
-                         * a declaration */
+    /* next line should be indented if we have not completed this stmt, and
+     * either we are not in a declaration or we are in an initialization
+     * assignment; but not if we're within braces in an initialization,
+     * because that scenario is handled by other rules. */
+    ps.ind_stmt = ps.in_stmt &&
+    (!ps.in_decl || (ps.block_init && ps.block_init_level <= 0));
     ps.use_ff = false;
     ps.dumped_decl_indent = 0;
     *(e_lab = s_lab) = '\0';    /* reset buffers */
diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c
index 5d2db6c62b..119d03522f 100644
--- a/contrib/ltree/ltree_gist.c
+++ b/contrib/ltree/ltree_gist.c
@@ -43,7 +43,7 @@ ltree_gist_alloc(bool isalltrue, BITVECP sign, int siglen,
                  ltree *left, ltree *right)
 {
     int32        size = LTG_HDRSIZE + (isalltrue ? 0 : siglen) +
-    (left ? VARSIZE(left) + (right ? VARSIZE(right) : 0) : 0);
+        (left ? VARSIZE(left) + (right ? VARSIZE(right) : 0) : 0);
     ltree_gist *result = palloc(size);

     SET_VARSIZE(result, size);
diff --git a/contrib/test_decoding/test_decoding.c b/contrib/test_decoding/test_decoding.c
index e523d22eba..295c7dcc22 100644
--- a/contrib/test_decoding/test_decoding.c
+++ b/contrib/test_decoding/test_decoding.c
@@ -290,7 +290,7 @@ pg_decode_begin_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
 {
     TestDecodingData *data = ctx->output_plugin_private;
     TestDecodingTxnData *txndata =
-    MemoryContextAllocZero(ctx->context, sizeof(TestDecodingTxnData));
+        MemoryContextAllocZero(ctx->context, sizeof(TestDecodingTxnData));

     txndata->xact_wrote_changes = false;
     txn->output_plugin_private = txndata;
@@ -350,7 +350,7 @@ pg_decode_begin_prepare_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
 {
     TestDecodingData *data = ctx->output_plugin_private;
     TestDecodingTxnData *txndata =
-    MemoryContextAllocZero(ctx->context, sizeof(TestDecodingTxnData));
+        MemoryContextAllocZero(ctx->context, sizeof(TestDecodingTxnData));

     txndata->xact_wrote_changes = false;
     txn->output_plugin_private = txndata;
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 14c23101ad..dfcb4d279b 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -1717,7 +1717,7 @@ allocateReloptStruct(Size base, relopt_value *options, int numoptions)
             if (optstr->fill_cb)
             {
                 const char *val = optval->isset ? optval->values.string_val :
-                optstr->default_isnull ? NULL : optstr->default_val;
+                    optstr->default_isnull ? NULL : optstr->default_val;

                 size += optstr->fill_cb(val, NULL);
             }
@@ -1796,8 +1796,8 @@ fillRelOptions(void *rdopts, Size basesize,
                         if (optstring->fill_cb)
                         {
                             Size        size =
-                            optstring->fill_cb(string_val,
-                                               (char *) rdopts + offset);
+                                optstring->fill_cb(string_val,
+                                                   (char *) rdopts + offset);

                             if (size)
                             {
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index ba394f08f6..359c597409 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -1116,7 +1116,7 @@ gistformdownlink(Relation rel, Buffer buf, GISTSTATE *giststate,
     for (offset = FirstOffsetNumber; offset <= maxoff; offset = OffsetNumberNext(offset))
     {
         IndexTuple    ituple = (IndexTuple)
-        PageGetItem(page, PageGetItemId(page, offset));
+            PageGetItem(page, PageGetItemId(page, offset));

         if (downlink == NULL)
             downlink = CopyIndexTuple(ituple);
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index 7382b0921d..e2c9b5f069 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -657,7 +657,7 @@ gistgettuple(IndexScanDesc scan, ScanDirection dir)
                     if (so->killedItems == NULL)
                     {
                         MemoryContext oldCxt =
-                        MemoryContextSwitchTo(so->giststate->scanCxt);
+                            MemoryContextSwitchTo(so->giststate->scanCxt);

                         so->killedItems =
                             (OffsetNumber *) palloc(MaxIndexTuplesPerPage
@@ -694,7 +694,7 @@ gistgettuple(IndexScanDesc scan, ScanDirection dir)
                 if (so->killedItems == NULL)
                 {
                     MemoryContext oldCxt =
-                    MemoryContextSwitchTo(so->giststate->scanCxt);
+                        MemoryContextSwitchTo(so->giststate->scanCxt);

                     so->killedItems =
                         (OffsetNumber *) palloc(MaxIndexTuplesPerPage
diff --git a/src/backend/access/gist/gistxlog.c b/src/backend/access/gist/gistxlog.c
index f65864254a..3bc587fc94 100644
--- a/src/backend/access/gist/gistxlog.c
+++ b/src/backend/access/gist/gistxlog.c
@@ -125,7 +125,7 @@ gistRedoPageUpdateRecord(XLogReaderState *record)
         if (data - begin < datalen)
         {
             OffsetNumber off = (PageIsEmpty(page)) ? FirstOffsetNumber :
-            OffsetNumberNext(PageGetMaxOffsetNumber(page));
+                OffsetNumberNext(PageGetMaxOffsetNumber(page));

             while (data - begin < datalen)
             {
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index e6024a980b..6e26ca09a2 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -542,9 +542,9 @@ heapgettup(HeapScanDesc scan,
             if (scan->rs_base.rs_parallel != NULL)
             {
                 ParallelBlockTableScanDesc pbscan =
-                (ParallelBlockTableScanDesc) scan->rs_base.rs_parallel;
+                    (ParallelBlockTableScanDesc) scan->rs_base.rs_parallel;
                 ParallelBlockTableScanWorker pbscanwork =
-                scan->rs_parallelworkerdata;
+                    scan->rs_parallelworkerdata;

                 table_block_parallelscan_startblock_init(scan->rs_base.rs_rd,
                                                          pbscanwork, pbscan);
@@ -764,9 +764,9 @@ heapgettup(HeapScanDesc scan,
         else if (scan->rs_base.rs_parallel != NULL)
         {
             ParallelBlockTableScanDesc pbscan =
-            (ParallelBlockTableScanDesc) scan->rs_base.rs_parallel;
+                (ParallelBlockTableScanDesc) scan->rs_base.rs_parallel;
             ParallelBlockTableScanWorker pbscanwork =
-            scan->rs_parallelworkerdata;
+                scan->rs_parallelworkerdata;

             block = table_block_parallelscan_nextpage(scan->rs_base.rs_rd,
                                                       pbscanwork, pbscan);
@@ -880,9 +880,9 @@ heapgettup_pagemode(HeapScanDesc scan,
             if (scan->rs_base.rs_parallel != NULL)
             {
                 ParallelBlockTableScanDesc pbscan =
-                (ParallelBlockTableScanDesc) scan->rs_base.rs_parallel;
+                    (ParallelBlockTableScanDesc) scan->rs_base.rs_parallel;
                 ParallelBlockTableScanWorker pbscanwork =
-                scan->rs_parallelworkerdata;
+                    scan->rs_parallelworkerdata;

                 table_block_parallelscan_startblock_init(scan->rs_base.rs_rd,
                                                          pbscanwork, pbscan);
@@ -1073,9 +1073,9 @@ heapgettup_pagemode(HeapScanDesc scan,
         else if (scan->rs_base.rs_parallel != NULL)
         {
             ParallelBlockTableScanDesc pbscan =
-            (ParallelBlockTableScanDesc) scan->rs_base.rs_parallel;
+                (ParallelBlockTableScanDesc) scan->rs_base.rs_parallel;
             ParallelBlockTableScanWorker pbscanwork =
-            scan->rs_parallelworkerdata;
+                scan->rs_parallelworkerdata;

             block = table_block_parallelscan_nextpage(scan->rs_base.rs_rd,
                                                       pbscanwork, pbscan);
@@ -2645,7 +2645,7 @@ static inline bool
 xmax_infomask_changed(uint16 new_infomask, uint16 old_infomask)
 {
     const uint16 interesting =
-    HEAP_XMAX_IS_MULTI | HEAP_XMAX_LOCK_ONLY | HEAP_LOCK_MASK;
+        HEAP_XMAX_IS_MULTI | HEAP_XMAX_LOCK_ONLY | HEAP_LOCK_MASK;

     if ((new_infomask & interesting) != (old_infomask & interesting))
         return true;
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index 4e65cbcadf..fffbeebb99 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -532,7 +532,7 @@ heap_prune_satisfies_vacuum(PruneState *prstate, HeapTuple tup, Buffer buffer)
         if (!TransactionIdIsValid(prstate->old_snap_xmin))
         {
             TransactionId horizon =
-            GlobalVisTestNonRemovableHorizon(prstate->vistest);
+                GlobalVisTestNonRemovableHorizon(prstate->vistest);

             TransactionIdLimitedForOldSnapshots(horizon, prstate->rel,
                                                 &prstate->old_snap_xmin,
diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index a2cca94841..745a425aa3 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -3106,8 +3106,8 @@ dead_items_max_items(LVRelState *vacrel)
 {
     int64        max_items;
     int            vac_work_mem = IsAutoVacuumWorkerProcess() &&
-    autovacuum_work_mem != -1 ?
-    autovacuum_work_mem : maintenance_work_mem;
+        autovacuum_work_mem != -1 ?
+        autovacuum_work_mem : maintenance_work_mem;

     if (vacrel->nindexes > 0)
     {
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c
index 3feee28d19..f31aaca8d5 100644
--- a/src/backend/access/nbtree/nbtpage.c
+++ b/src/backend/access/nbtree/nbtpage.c
@@ -3035,7 +3035,7 @@ _bt_pendingfsm_add(BTVacState *vstate,
     if (vstate->npendingpages > 0)
     {
         FullTransactionId lastsafexid =
-        vstate->pendingpages[vstate->npendingpages - 1].safexid;
+            vstate->pendingpages[vstate->npendingpages - 1].safexid;

         Assert(FullTransactionIdFollowsOrEquals(safexid, lastsafexid));
     }
diff --git a/src/backend/access/rmgrdesc/dbasedesc.c b/src/backend/access/rmgrdesc/dbasedesc.c
index 7d12e0ef91..3922120d64 100644
--- a/src/backend/access/rmgrdesc/dbasedesc.c
+++ b/src/backend/access/rmgrdesc/dbasedesc.c
@@ -27,7 +27,7 @@ dbase_desc(StringInfo buf, XLogReaderState *record)
     if (info == XLOG_DBASE_CREATE_FILE_COPY)
     {
         xl_dbase_create_file_copy_rec *xlrec =
-        (xl_dbase_create_file_copy_rec *) rec;
+            (xl_dbase_create_file_copy_rec *) rec;

         appendStringInfo(buf, "copy dir %u/%u to %u/%u",
                          xlrec->src_tablespace_id, xlrec->src_db_id,
@@ -36,7 +36,7 @@ dbase_desc(StringInfo buf, XLogReaderState *record)
     else if (info == XLOG_DBASE_CREATE_WAL_LOG)
     {
         xl_dbase_create_wal_log_rec *xlrec =
-        (xl_dbase_create_wal_log_rec *) rec;
+            (xl_dbase_create_wal_log_rec *) rec;

         appendStringInfo(buf, "create dir %u/%u",
                          xlrec->tablespace_id, xlrec->db_id);
diff --git a/src/backend/access/rmgrdesc/gindesc.c b/src/backend/access/rmgrdesc/gindesc.c
index 9ef4981ad1..246a6a6b85 100644
--- a/src/backend/access/rmgrdesc/gindesc.c
+++ b/src/backend/access/rmgrdesc/gindesc.c
@@ -120,7 +120,7 @@ gin_desc(StringInfo buf, XLogReaderState *record)
                     else
                     {
                         ginxlogInsertDataInternal *insertData =
-                        (ginxlogInsertDataInternal *) payload;
+                            (ginxlogInsertDataInternal *) payload;

                         appendStringInfo(buf, " pitem: %u-%u/%u",
                                          PostingItemGetBlockNumber(&insertData->newitem),
@@ -156,7 +156,7 @@ gin_desc(StringInfo buf, XLogReaderState *record)
                 else
                 {
                     ginxlogVacuumDataLeafPage *xlrec =
-                    (ginxlogVacuumDataLeafPage *) XLogRecGetBlockData(record, 0, NULL);
+                        (ginxlogVacuumDataLeafPage *) XLogRecGetBlockData(record, 0, NULL);

                     desc_recompress_leaf(buf, &xlrec->data);
                 }
diff --git a/src/backend/access/spgist/spgscan.c b/src/backend/access/spgist/spgscan.c
index f323699165..cbfaf0c00a 100644
--- a/src/backend/access/spgist/spgscan.c
+++ b/src/backend/access/spgist/spgscan.c
@@ -115,7 +115,7 @@ spgAllocSearchItem(SpGistScanOpaque so, bool isnull, double *distances)
 {
     /* allocate distance array only for non-NULL items */
     SpGistSearchItem *item =
-    palloc(SizeOfSpGistSearchItem(isnull ? 0 : so->numberOfNonNullOrderBys));
+        palloc(SizeOfSpGistSearchItem(isnull ? 0 : so->numberOfNonNullOrderBys));

     item->isNull = isnull;

@@ -130,7 +130,7 @@ static void
 spgAddStartItem(SpGistScanOpaque so, bool isnull)
 {
     SpGistSearchItem *startEntry =
-    spgAllocSearchItem(so, isnull, so->zeroDistances);
+        spgAllocSearchItem(so, isnull, so->zeroDistances);

     ItemPointerSet(&startEntry->heapPtr,
                    isnull ? SPGIST_NULL_BLKNO : SPGIST_ROOT_BLKNO,
@@ -768,7 +768,7 @@ spgTestLeafTuple(SpGistScanOpaque so,
                  storeRes_func storeRes)
 {
     SpGistLeafTuple leafTuple = (SpGistLeafTuple)
-    PageGetItem(page, PageGetItemId(page, offset));
+        PageGetItem(page, PageGetItemId(page, offset));

     if (leafTuple->tupstate != SPGIST_LIVE)
     {
@@ -896,7 +896,7 @@ redirect:
             else                /* page is inner */
             {
                 SpGistInnerTuple innerTuple = (SpGistInnerTuple)
-                PageGetItem(page, PageGetItemId(page, offset));
+                    PageGetItem(page, PageGetItemId(page, offset));

                 if (innerTuple->tupstate != SPGIST_LIVE)
                 {
@@ -974,7 +974,7 @@ storeGettuple(SpGistScanOpaque so, ItemPointer heapPtr,
         else
         {
             IndexOrderByDistance *distances =
-            palloc(sizeof(distances[0]) * so->numberOfOrderBys);
+                palloc(sizeof(distances[0]) * so->numberOfOrderBys);
             int            i;

             for (i = 0; i < so->numberOfOrderBys; i++)
diff --git a/src/backend/access/table/tableam.c b/src/backend/access/table/tableam.c
index ef0d34fcee..c4308fb309 100644
--- a/src/backend/access/table/tableam.c
+++ b/src/backend/access/table/tableam.c
@@ -112,7 +112,7 @@ TableScanDesc
 table_beginscan_catalog(Relation relation, int nkeys, struct ScanKeyData *key)
 {
     uint32        flags = SO_TYPE_SEQSCAN |
-    SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE | SO_TEMP_SNAPSHOT;
+        SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE | SO_TEMP_SNAPSHOT;
     Oid            relid = RelationGetRelid(relation);
     Snapshot    snapshot = RegisterSnapshot(GetCatalogSnapshot(relid));

@@ -176,7 +176,7 @@ table_beginscan_parallel(Relation relation, ParallelTableScanDesc pscan)
 {
     Snapshot    snapshot;
     uint32        flags = SO_TYPE_SEQSCAN |
-    SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE;
+        SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE;

     Assert(RelationGetRelid(relation) == pscan->phs_relid);

diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index e75e1fdf74..cfadb867b6 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -3270,7 +3270,7 @@ multixact_redo(XLogReaderState *record)
     else if (info == XLOG_MULTIXACT_CREATE_ID)
     {
         xl_multixact_create *xlrec =
-        (xl_multixact_create *) XLogRecGetData(record);
+            (xl_multixact_create *) XLogRecGetData(record);
         TransactionId max_xid;
         int            i;

diff --git a/src/backend/access/transam/xlogprefetcher.c b/src/backend/access/transam/xlogprefetcher.c
index 046e40d143..f9a4085272 100644
--- a/src/backend/access/transam/xlogprefetcher.c
+++ b/src/backend/access/transam/xlogprefetcher.c
@@ -569,7 +569,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
                 if (record_type == XLOG_DBASE_CREATE_FILE_COPY)
                 {
                     xl_dbase_create_file_copy_rec *xlrec =
-                    (xl_dbase_create_file_copy_rec *) record->main_data;
+                        (xl_dbase_create_file_copy_rec *) record->main_data;
                     RelFileLocator rlocator =
                     {InvalidOid, xlrec->db_id, InvalidRelFileNumber};

@@ -596,7 +596,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
                 if (record_type == XLOG_SMGR_CREATE)
                 {
                     xl_smgr_create *xlrec = (xl_smgr_create *)
-                    record->main_data;
+                        record->main_data;

                     if (xlrec->forkNum == MAIN_FORKNUM)
                     {
@@ -624,7 +624,7 @@ XLogPrefetcherNextBlock(uintptr_t pgsr_private, XLogRecPtr *lsn)
                 else if (record_type == XLOG_SMGR_TRUNCATE)
                 {
                     xl_smgr_truncate *xlrec = (xl_smgr_truncate *)
-                    record->main_data;
+                        record->main_data;

                     /*
                      * Don't consider prefetching anything in the truncated
diff --git a/src/backend/access/transam/xlogrecovery.c b/src/backend/access/transam/xlogrecovery.c
index 1961c41258..fd69904c57 100644
--- a/src/backend/access/transam/xlogrecovery.c
+++ b/src/backend/access/transam/xlogrecovery.c
@@ -3175,7 +3175,7 @@ XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen,
              XLogRecPtr targetRecPtr, char *readBuf)
 {
     XLogPageReadPrivate *private =
-    (XLogPageReadPrivate *) xlogreader->private_data;
+        (XLogPageReadPrivate *) xlogreader->private_data;
     int            emode = private->emode;
     uint32        targetPageOff;
     XLogSegNo    targetSegNo PG_USED_FOR_ASSERTS_ONLY;
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 44f171bb29..0397c4013e 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -3048,7 +3048,7 @@ dbase_redo(XLogReaderState *record)
     if (info == XLOG_DBASE_CREATE_FILE_COPY)
     {
         xl_dbase_create_file_copy_rec *xlrec =
-        (xl_dbase_create_file_copy_rec *) XLogRecGetData(record);
+            (xl_dbase_create_file_copy_rec *) XLogRecGetData(record);
         char       *src_path;
         char       *dst_path;
         char       *parent_path;
@@ -3120,7 +3120,7 @@ dbase_redo(XLogReaderState *record)
     else if (info == XLOG_DBASE_CREATE_WAL_LOG)
     {
         xl_dbase_create_wal_log_rec *xlrec =
-        (xl_dbase_create_wal_log_rec *) XLogRecGetData(record);
+            (xl_dbase_create_wal_log_rec *) XLogRecGetData(record);
         char       *dbpath;
         char       *parent_path;

diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 5212a64b1e..5630c78507 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -1512,7 +1512,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",
@@ -2994,7 +2994,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
@@ -4201,7 +4201,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);
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index de200541ac..29b5dd8136 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -2607,7 +2607,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
                 if (CompressionMethodIsValid(attribute->attcompression))
                 {
                     const char *compression =
-                    GetCompressionMethodName(attribute->attcompression);
+                        GetCompressionMethodName(attribute->attcompression);

                     if (def->compression == NULL)
                         def->compression = pstrdup(compression);
@@ -14246,7 +14246,7 @@ ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation,
         if (check_option)
         {
             const char *view_updatable_error =
-            view_query_is_auto_updatable(view_query, true);
+                view_query_is_auto_updatable(view_query, true);

             if (view_updatable_error)
                 ereport(ERROR,
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index ff98c773f5..9bd77546b9 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -437,7 +437,7 @@ DefineView(ViewStmt *stmt, const char *queryString,
     if (check_option)
     {
         const char *view_updatable_error =
-        view_query_is_auto_updatable(viewParse, true);
+            view_query_is_auto_updatable(viewParse, true);

         if (view_updatable_error)
             ereport(ERROR,
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index bb48569f64..7281d76fe5 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -3442,7 +3442,7 @@ ExecBuildAggTrans(AggState *aggstate, AggStatePerPhase phase,
              * column sorted on.
              */
             TargetEntry *source_tle =
-            (TargetEntry *) linitial(pertrans->aggref->args);
+                (TargetEntry *) linitial(pertrans->aggref->args);

             Assert(list_length(pertrans->aggref->args) == 1);

diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c
index 1470edc0ab..fae5d23bf7 100644
--- a/src/backend/executor/execExprInterp.c
+++ b/src/backend/executor/execExprInterp.c
@@ -1627,7 +1627,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
         {
             AggState   *aggstate = castNode(AggState, state->parent);
             AggStatePerGroup pergroup_allaggs =
-            aggstate->all_pergroups[op->d.agg_plain_pergroup_nullcheck.setoff];
+                aggstate->all_pergroups[op->d.agg_plain_pergroup_nullcheck.setoff];

             if (pergroup_allaggs == NULL)
                 EEO_JUMP(op->d.agg_plain_pergroup_nullcheck.jumpnull);
@@ -1652,7 +1652,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
             AggState   *aggstate = castNode(AggState, state->parent);
             AggStatePerTrans pertrans = op->d.agg_trans.pertrans;
             AggStatePerGroup pergroup =
-            &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];
+                &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

             Assert(pertrans->transtypeByVal);

@@ -1680,7 +1680,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
             AggState   *aggstate = castNode(AggState, state->parent);
             AggStatePerTrans pertrans = op->d.agg_trans.pertrans;
             AggStatePerGroup pergroup =
-            &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];
+                &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

             Assert(pertrans->transtypeByVal);

@@ -1698,7 +1698,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
             AggState   *aggstate = castNode(AggState, state->parent);
             AggStatePerTrans pertrans = op->d.agg_trans.pertrans;
             AggStatePerGroup pergroup =
-            &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];
+                &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

             Assert(pertrans->transtypeByVal);

@@ -1715,7 +1715,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
             AggState   *aggstate = castNode(AggState, state->parent);
             AggStatePerTrans pertrans = op->d.agg_trans.pertrans;
             AggStatePerGroup pergroup =
-            &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];
+                &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

             Assert(!pertrans->transtypeByVal);

@@ -1736,7 +1736,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
             AggState   *aggstate = castNode(AggState, state->parent);
             AggStatePerTrans pertrans = op->d.agg_trans.pertrans;
             AggStatePerGroup pergroup =
-            &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];
+                &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

             Assert(!pertrans->transtypeByVal);

@@ -1753,7 +1753,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
             AggState   *aggstate = castNode(AggState, state->parent);
             AggStatePerTrans pertrans = op->d.agg_trans.pertrans;
             AggStatePerGroup pergroup =
-            &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];
+                &aggstate->all_pergroups[op->d.agg_trans.setoff][op->d.agg_trans.transno];

             Assert(!pertrans->transtypeByVal);

diff --git a/src/backend/executor/execSRF.c b/src/backend/executor/execSRF.c
index d09a7758dc..73bf9152a4 100644
--- a/src/backend/executor/execSRF.c
+++ b/src/backend/executor/execSRF.c
@@ -260,7 +260,7 @@ ExecMakeTableFunctionResult(SetExprState *setexpr,
             if (first_time)
             {
                 MemoryContext oldcontext =
-                MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
+                    MemoryContextSwitchTo(econtext->ecxt_per_query_memory);

                 tupstore = tuplestore_begin_heap(randomAccess, false, work_mem);
                 rsinfo.setResult = tupstore;
@@ -290,7 +290,7 @@ ExecMakeTableFunctionResult(SetExprState *setexpr,
                     if (tupdesc == NULL)
                     {
                         MemoryContext oldcontext =
-                        MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
+                            MemoryContextSwitchTo(econtext->ecxt_per_query_memory);

                         /*
                          * This is the first non-NULL result from the
@@ -395,7 +395,7 @@ no_function_result:
     if (rsinfo.setResult == NULL)
     {
         MemoryContext oldcontext =
-        MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
+            MemoryContextSwitchTo(econtext->ecxt_per_query_memory);

         tupstore = tuplestore_begin_heap(randomAccess, false, work_mem);
         rsinfo.setResult = tupstore;
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index eceee99374..2360c8da4e 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -1320,7 +1320,7 @@ ExecParallelHashRepartitionFirst(HashJoinTable hashtable)
             else
             {
                 size_t        tuple_size =
-                MAXALIGN(HJTUPLE_OVERHEAD + tuple->t_len);
+                    MAXALIGN(HJTUPLE_OVERHEAD + tuple->t_len);

                 /* It belongs in a later batch. */
                 hashtable->batches[batchno].estimated_size += tuple_size;
@@ -1362,7 +1362,7 @@ ExecParallelHashRepartitionRest(HashJoinTable hashtable)
     for (i = 1; i < old_nbatch; ++i)
     {
         ParallelHashJoinBatch *shared =
-        NthParallelHashJoinBatch(old_batches, i);
+            NthParallelHashJoinBatch(old_batches, i);

         old_inner_tuples[i] = sts_attach(ParallelHashJoinBatchInner(shared),
                                          ParallelWorkerNumber + 1,
@@ -3148,7 +3148,7 @@ ExecHashTableDetachBatch(HashJoinTable hashtable)
             while (DsaPointerIsValid(batch->chunks))
             {
                 HashMemoryChunk chunk =
-                dsa_get_address(hashtable->area, batch->chunks);
+                    dsa_get_address(hashtable->area, batch->chunks);
                 dsa_pointer next = chunk->next.shared;

                 dsa_free(hashtable->area, batch->chunks);
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index b215e3f59a..2ef4e651c7 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -1127,7 +1127,7 @@ ExecParallelHashJoinNewBatch(HashJoinState *hjstate)
         {
             SharedTuplestoreAccessor *inner_tuples;
             Barrier    *batch_barrier =
-            &hashtable->batches[batchno].shared->batch_barrier;
+                &hashtable->batches[batchno].shared->batch_barrier;

             switch (BarrierAttach(batch_barrier))
             {
@@ -1496,7 +1496,7 @@ ExecHashJoinReInitializeDSM(HashJoinState *state, ParallelContext *pcxt)
 {
     int            plan_node_id = state->js.ps.plan->plan_node_id;
     ParallelHashJoinState *pstate =
-    shm_toc_lookup(pcxt->toc, plan_node_id, false);
+        shm_toc_lookup(pcxt->toc, plan_node_id, false);

     /*
      * It would be possible to reuse the shared hash table in single-batch
@@ -1531,7 +1531,7 @@ ExecHashJoinInitializeWorker(HashJoinState *state,
     HashState  *hashNode;
     int            plan_node_id = state->js.ps.plan->plan_node_id;
     ParallelHashJoinState *pstate =
-    shm_toc_lookup(pwcxt->toc, plan_node_id, false);
+        shm_toc_lookup(pwcxt->toc, plan_node_id, false);

     /* Attach to the space for shared temporary files. */
     SharedFileSetAttach(&pstate->fileset, pwcxt->seg);
diff --git a/src/backend/executor/nodeIncrementalSort.c b/src/backend/executor/nodeIncrementalSort.c
index 12bc22f33c..0994b2c113 100644
--- a/src/backend/executor/nodeIncrementalSort.c
+++ b/src/backend/executor/nodeIncrementalSort.c
@@ -1007,9 +1007,9 @@ ExecInitIncrementalSort(IncrementalSort *node, EState *estate, int eflags)
     if (incrsortstate->ss.ps.instrument != NULL)
     {
         IncrementalSortGroupInfo *fullsortGroupInfo =
-        &incrsortstate->incsort_info.fullsortGroupInfo;
+            &incrsortstate->incsort_info.fullsortGroupInfo;
         IncrementalSortGroupInfo *prefixsortGroupInfo =
-        &incrsortstate->incsort_info.prefixsortGroupInfo;
+            &incrsortstate->incsort_info.prefixsortGroupInfo;

         fullsortGroupInfo->groupCount = 0;
         fullsortGroupInfo->maxDiskSpaceUsed = 0;
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index f419c47065..7ac10331fb 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -889,7 +889,7 @@ ExecInsert(ModifyTableContext *context,
             {
                 TupleDesc    tdesc = CreateTupleDescCopy(slot->tts_tupleDescriptor);
                 TupleDesc    plan_tdesc =
-                CreateTupleDescCopy(planSlot->tts_tupleDescriptor);
+                    CreateTupleDescCopy(planSlot->tts_tupleDescriptor);

                 resultRelInfo->ri_Slots[resultRelInfo->ri_NumSlots] =
                     MakeSingleTupleTableSlot(tdesc, slot->tts_ops);
diff --git a/src/backend/executor/nodeTableFuncscan.c b/src/backend/executor/nodeTableFuncscan.c
index 0c6c912778..791cbd2372 100644
--- a/src/backend/executor/nodeTableFuncscan.c
+++ b/src/backend/executor/nodeTableFuncscan.c
@@ -352,7 +352,7 @@ tfuncInitialize(TableFuncScanState *tstate, ExprContext *econtext, Datum doc)
     int            colno;
     Datum        value;
     int            ordinalitycol =
-    ((TableFuncScan *) (tstate->ss.ps.plan))->tablefunc->ordinalitycol;
+        ((TableFuncScan *) (tstate->ss.ps.plan))->tablefunc->ordinalitycol;

     /*
      * Install the document as a possibly-toasted Datum into the tablefunc
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 61f03e3999..9ed63286e2 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -3341,7 +3341,7 @@ SPI_register_trigger_data(TriggerData *tdata)
     if (tdata->tg_newtable)
     {
         EphemeralNamedRelation enr =
-        palloc(sizeof(EphemeralNamedRelationData));
+            palloc(sizeof(EphemeralNamedRelationData));
         int            rc;

         enr->md.name = tdata->tg_trigger->tgnewtable;
@@ -3358,7 +3358,7 @@ SPI_register_trigger_data(TriggerData *tdata)
     if (tdata->tg_oldtable)
     {
         EphemeralNamedRelation enr =
-        palloc(sizeof(EphemeralNamedRelationData));
+            palloc(sizeof(EphemeralNamedRelationData));
         int            rc;

         enr->md.name = tdata->tg_trigger->tgoldtable;
diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
index affa06b4c0..06b7901da3 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -1175,7 +1175,7 @@ static LLVMOrcObjectLayerRef
 llvm_create_object_layer(void *Ctx, LLVMOrcExecutionSessionRef ES, const char *Triple)
 {
     LLVMOrcObjectLayerRef objlayer =
-    LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(ES);
+        LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(ES);

 #if defined(HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER) && HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER
     if (jit_debugging_support)
diff --git a/src/backend/jit/llvm/llvmjit_deform.c b/src/backend/jit/llvm/llvmjit_deform.c
index 6b15588da6..15d4a7b431 100644
--- a/src/backend/jit/llvm/llvmjit_deform.c
+++ b/src/backend/jit/llvm/llvmjit_deform.c
@@ -650,7 +650,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc,
         {
             LLVMValueRef v_tmp_loaddata;
             LLVMTypeRef vartypep =
-            LLVMPointerType(LLVMIntType(att->attlen * 8), 0);
+                LLVMPointerType(LLVMIntType(att->attlen * 8), 0);

             v_tmp_loaddata =
                 LLVMBuildPointerCast(b, v_attdatap, vartypep, "");
diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c
index 1c722c7955..6fba259fc9 100644
--- a/src/backend/jit/llvm/llvmjit_expr.c
+++ b/src/backend/jit/llvm/llvmjit_expr.c
@@ -1047,7 +1047,7 @@ llvm_compile_expr(ExprState *state)
                     else
                     {
                         LLVMValueRef v_value =
-                        LLVMBuildLoad(b, v_resvaluep, "");
+                            LLVMBuildLoad(b, v_resvaluep, "");

                         v_value = LLVMBuildZExt(b,
                                                 LLVMBuildICmp(b, LLVMIntEQ,
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 29ae32d960..daa1138865 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -2010,7 +2010,7 @@ cost_incremental_sort(Path *path,
     {
         PathKey    *key = (PathKey *) lfirst(l);
         EquivalenceMember *member = (EquivalenceMember *)
-        linitial(key->pk_eclass->ec_members);
+            linitial(key->pk_eclass->ec_members);

         /*
          * Check if the expression contains Var with "varno 0" so that we
diff --git a/src/backend/optimizer/util/appendinfo.c b/src/backend/optimizer/util/appendinfo.c
index cd45ab4899..00596eaacb 100644
--- a/src/backend/optimizer/util/appendinfo.c
+++ b/src/backend/optimizer/util/appendinfo.c
@@ -340,7 +340,7 @@ adjust_appendrel_attrs_mutator(Node *node,
             if (leaf_relid)
             {
                 RowIdentityVarInfo *ridinfo = (RowIdentityVarInfo *)
-                list_nth(context->root->row_identity_vars, var->varattno - 1);
+                    list_nth(context->root->row_identity_vars, var->varattno - 1);

                 if (bms_is_member(leaf_relid, ridinfo->rowidrels))
                 {
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
index 0a5632699d..1cba0917cb 100644
--- a/src/backend/optimizer/util/relnode.c
+++ b/src/backend/optimizer/util/relnode.c
@@ -1020,7 +1020,7 @@ build_joinrel_tlist(PlannerInfo *root, RelOptInfo *joinrel,
         {
             /* UPDATE/DELETE/MERGE row identity vars are always needed */
             RowIdentityVarInfo *ridinfo = (RowIdentityVarInfo *)
-            list_nth(root->row_identity_vars, var->varattno - 1);
+                list_nth(root->row_identity_vars, var->varattno - 1);

             joinrel->reltarget->exprs = lappend(joinrel->reltarget->exprs,
                                                 var);
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 908bab370e..11e3655d5a 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -2364,7 +2364,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
                  * mentioned above.
                  */
                 Datum        attoptions =
-                get_attoptions(RelationGetRelid(index_rel), i + 1);
+                    get_attoptions(RelationGetRelid(index_rel), i + 1);

                 defopclass = GetDefaultOpClass(attform->atttypid,
                                                index_rel->rd_rel->relam);
diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index ed880c496a..6f7d9b50f5 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -3193,7 +3193,7 @@ check_new_partition_bound(char *relname, Relation parent,
                                  * datums list.
                                  */
                                 PartitionRangeDatum *datum =
-                                list_nth(spec->upperdatums, abs(cmpval) - 1);
+                                    list_nth(spec->upperdatums, abs(cmpval) - 1);

                                 /*
                                  * The new partition overlaps with the
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index f5ea381c53..7a43247f13 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -1847,7 +1847,7 @@ autovac_balance_cost(void)
             worker->wi_cost_limit_base > 0 && worker->wi_cost_delay > 0)
         {
             int            limit = (int)
-            (cost_avail * worker->wi_cost_limit_base / cost_total);
+                (cost_avail * worker->wi_cost_limit_base / cost_total);

             /*
              * We put a lower bound of 1 on the cost_limit, to avoid division-
diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c
index b754c43840..4d29f0ea30 100644
--- a/src/backend/replication/logical/origin.c
+++ b/src/backend/replication/logical/origin.c
@@ -829,7 +829,7 @@ replorigin_redo(XLogReaderState *record)
         case XLOG_REPLORIGIN_SET:
             {
                 xl_replorigin_set *xlrec =
-                (xl_replorigin_set *) XLogRecGetData(record);
+                    (xl_replorigin_set *) XLogRecGetData(record);

                 replorigin_advance(xlrec->node_id,
                                    xlrec->remote_lsn, record->EndRecPtr,
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 54ee824e6c..3de702e16a 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -1407,7 +1407,7 @@ ReorderBufferIterTXNNext(ReorderBuffer *rb, ReorderBufferIterTXNState *state)
     {
         dlist_node *next = dlist_next_node(&entry->txn->changes, &change->node);
         ReorderBufferChange *next_change =
-        dlist_container(ReorderBufferChange, node, next);
+            dlist_container(ReorderBufferChange, node, next);

         /* txn stays the same */
         state->entries[off].lsn = next_change->lsn;
@@ -1438,8 +1438,8 @@ ReorderBufferIterTXNNext(ReorderBuffer *rb, ReorderBufferIterTXNState *state)
         {
             /* successfully restored changes from disk */
             ReorderBufferChange *next_change =
-            dlist_head_element(ReorderBufferChange, node,
-                               &entry->txn->changes);
+                dlist_head_element(ReorderBufferChange, node,
+                                   &entry->txn->changes);

             elog(DEBUG2, "restored %u/%u changes from disk",
                  (uint32) entry->txn->nentries_mem,
@@ -3827,7 +3827,7 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
             {
                 char       *data;
                 Size        inval_size = sizeof(SharedInvalidationMessage) *
-                change->data.inval.ninvalidations;
+                    change->data.inval.ninvalidations;

                 sz += inval_size;

@@ -4192,7 +4192,7 @@ ReorderBufferRestoreChanges(ReorderBuffer *rb, ReorderBufferTXN *txn,
     dlist_foreach_modify(cleanup_iter, &txn->changes)
     {
         ReorderBufferChange *cleanup =
-        dlist_container(ReorderBufferChange, node, cleanup_iter.cur);
+            dlist_container(ReorderBufferChange, node, cleanup_iter.cur);

         dlist_delete(&cleanup->node);
         ReorderBufferReturnChange(rb, cleanup, true);
@@ -4417,7 +4417,7 @@ ReorderBufferRestoreChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
         case REORDER_BUFFER_CHANGE_INVALIDATION:
             {
                 Size        inval_size = sizeof(SharedInvalidationMessage) *
-                change->data.inval.ninvalidations;
+                    change->data.inval.ninvalidations;

                 change->data.inval.invalidations =
                     MemoryContextAlloc(rb->context, inval_size);
@@ -4925,7 +4925,7 @@ ReorderBufferToastReset(ReorderBuffer *rb, ReorderBufferTXN *txn)
         dlist_foreach_modify(it, &ent->chunks)
         {
             ReorderBufferChange *change =
-            dlist_container(ReorderBufferChange, node, it.cur);
+                dlist_container(ReorderBufferChange, node, it.cur);

             dlist_delete(&change->node);
             ReorderBufferReturnChange(rb, change, true);
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index 4647837b82..5f54e3f903 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -562,7 +562,7 @@ process_syncing_tables_for_apply(XLogRecPtr current_lsn)
                  * the lock.
                  */
                 int            nsyncworkers =
-                logicalrep_sync_worker_count(MyLogicalRepWorker->subid);
+                    logicalrep_sync_worker_count(MyLogicalRepWorker->subid);

                 /* Now safe to release the LWLock */
                 LWLockRelease(LogicalRepWorkerLock);
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index b2f3ca7fa0..450d419f6e 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -3045,8 +3045,8 @@ apply_handle_tuple_routing(ApplyExecutionData *edata,
                     if (map)
                     {
                         TupleConversionMap *PartitionToRootMap =
-                        convert_tuples_by_name(RelationGetDescr(partrel),
-                                               RelationGetDescr(parentrel));
+                            convert_tuples_by_name(RelationGetDescr(partrel),
+                                                   RelationGetDescr(parentrel));

                         remoteslot =
                             execute_attr_map_slot(PartitionToRootMap->attrMap,
@@ -3373,7 +3373,7 @@ get_flush_position(XLogRecPtr *write, XLogRecPtr *flush,
     dlist_foreach_modify(iter, &lsn_mapping)
     {
         FlushPosition *pos =
-        dlist_container(FlushPosition, node, iter.cur);
+            dlist_container(FlushPosition, node, iter.cur);

         *write = pos->remote_end;

diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index c74bac20b1..0ce3347c69 100644
--- a/src/backend/rewrite/rewriteHandler.c
+++ b/src/backend/rewrite/rewriteHandler.c
@@ -3519,7 +3519,7 @@ rewriteTargetView(Query *parsetree, Relation view)
         if (parsetree->withCheckOptions != NIL)
         {
             WithCheckOption *parent_wco =
-            (WithCheckOption *) linitial(parsetree->withCheckOptions);
+                (WithCheckOption *) linitial(parsetree->withCheckOptions);

             if (parent_wco->cascaded)
             {
diff --git a/src/backend/rewrite/rowsecurity.c b/src/backend/rewrite/rowsecurity.c
index 569c1c9467..5c3fe4eda2 100644
--- a/src/backend/rewrite/rowsecurity.c
+++ b/src/backend/rewrite/rowsecurity.c
@@ -581,7 +581,7 @@ get_policies_for_relation(Relation relation, CmdType cmd, Oid user_id,
     if (row_security_policy_hook_restrictive)
     {
         List       *hook_policies =
-        (*row_security_policy_hook_restrictive) (cmd, relation);
+            (*row_security_policy_hook_restrictive) (cmd, relation);

         /*
          * As with built-in restrictive policies, we sort any hook-provided
@@ -603,7 +603,7 @@ get_policies_for_relation(Relation relation, CmdType cmd, Oid user_id,
     if (row_security_policy_hook_permissive)
     {
         List       *hook_policies =
-        (*row_security_policy_hook_permissive) (cmd, relation);
+            (*row_security_policy_hook_permissive) (cmd, relation);

         foreach(item, hook_policies)
         {
diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index bdc21bb457..422b173c4d 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -2238,8 +2238,8 @@ compute_expr_stats(Relation onerel, double totalrows,
         if (tcnt > 0)
         {
             AttributeOpts *aopt =
-            get_attribute_options(stats->attr->attrelid,
-                                  stats->attr->attnum);
+                get_attribute_options(stats->attr->attrelid,
+                                      stats->attr->attnum);

             stats->exprvals = exprvals;
             stats->exprnulls = exprnulls;
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 800a4248c9..5572efb217 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -2137,7 +2137,7 @@ BufferSync(int flags)
     {
         BufferDesc *bufHdr = NULL;
         CkptTsStatus *ts_stat = (CkptTsStatus *)
-        DatumGetPointer(binaryheap_first(ts_heap));
+            DatumGetPointer(binaryheap_first(ts_heap));

         buf_id = CkptBufferIds[ts_stat->index].buf_id;
         Assert(buf_id != -1);
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 8a73891198..8ccd94306f 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -1502,7 +1502,7 @@ LockCheckConflicts(LockMethod lockMethodTable,
     dlist_foreach(proclock_iter, &lock->procLocks)
     {
         PROCLOCK   *otherproclock =
-        dlist_container(PROCLOCK, lockLink, proclock_iter.cur);
+            dlist_container(PROCLOCK, lockLink, proclock_iter.cur);

         if (proclock != otherproclock &&
             proclock->groupLeader == otherproclock->groupLeader &&
@@ -3913,7 +3913,7 @@ GetSingleProcBlockerStatusData(PGPROC *blocked_proc, BlockedProcsData *data)
     dlist_foreach(proclock_iter, &theLock->procLocks)
     {
         PROCLOCK   *proclock =
-        dlist_container(PROCLOCK, lockLink, proclock_iter.cur);
+            dlist_container(PROCLOCK, lockLink, proclock_iter.cur);
         PGPROC       *proc = proclock->tag.myProc;
         LOCK       *lock = proclock->tag.myLock;
         LockInstanceData *instance;
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index 11decb74b2..140bd8fd83 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -625,7 +625,7 @@ RWConflictExists(const SERIALIZABLEXACT *reader, const SERIALIZABLEXACT *writer)
     dlist_foreach(iter, &unconstify(SERIALIZABLEXACT *, reader)->outConflicts)
     {
         RWConflict    conflict =
-        dlist_container(RWConflictData, outLink, iter.cur);
+            dlist_container(RWConflictData, outLink, iter.cur);

         if (conflict->sxactIn == writer)
             return true;
@@ -708,7 +708,7 @@ FlagSxactUnsafe(SERIALIZABLEXACT *sxact)
     dlist_foreach_modify(iter, &sxact->possibleUnsafeConflicts)
     {
         RWConflict    conflict =
-        dlist_container(RWConflictData, inLink, iter.cur);
+            dlist_container(RWConflictData, inLink, iter.cur);

         Assert(!SxactIsReadOnly(conflict->sxactOut));
         Assert(sxact == conflict->sxactIn);
@@ -1583,7 +1583,7 @@ GetSafeSnapshotBlockingPids(int blocked_pid, int *output, int output_size)
         dlist_foreach(iter, &sxact->possibleUnsafeConflicts)
         {
             RWConflict    possibleUnsafeConflict =
-            dlist_container(RWConflictData, inLink, iter.cur);
+                dlist_container(RWConflictData, inLink, iter.cur);

             output[num_written++] = possibleUnsafeConflict->sxactOut->pid;
         }
@@ -2593,7 +2593,7 @@ DeleteLockTarget(PREDICATELOCKTARGET *target, uint32 targettaghash)
     dlist_foreach_modify(iter, &target->predicateLocks)
     {
         PREDICATELOCK *predlock =
-        dlist_container(PREDICATELOCK, targetLink, iter.cur);
+            dlist_container(PREDICATELOCK, targetLink, iter.cur);
         bool        found;

         dlist_delete(&(predlock->xactLink));
@@ -2734,7 +2734,7 @@ TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag,
         dlist_foreach_modify(iter, &oldtarget->predicateLocks)
         {
             PREDICATELOCK *oldpredlock =
-            dlist_container(PREDICATELOCK, targetLink, iter.cur);
+                dlist_container(PREDICATELOCK, targetLink, iter.cur);
             PREDICATELOCK *newpredlock;
             SerCommitSeqNo oldCommitSeqNo = oldpredlock->commitSeqNo;

@@ -2956,7 +2956,7 @@ DropAllPredicateLocksFromTable(Relation relation, bool transfer)
         dlist_foreach_modify(iter, &oldtarget->predicateLocks)
         {
             PREDICATELOCK *oldpredlock =
-            dlist_container(PREDICATELOCK, targetLink, iter.cur);
+                dlist_container(PREDICATELOCK, targetLink, iter.cur);
             PREDICATELOCK *newpredlock;
             SerCommitSeqNo oldCommitSeqNo;
             SERIALIZABLEXACT *oldXact;
@@ -3174,7 +3174,7 @@ SetNewSxactGlobalXmin(void)
     dlist_foreach(iter, &PredXact->activeList)
     {
         SERIALIZABLEXACT *sxact =
-        dlist_container(SERIALIZABLEXACT, xactLink, iter.cur);
+            dlist_container(SERIALIZABLEXACT, xactLink, iter.cur);

         if (!SxactIsRolledBack(sxact)
             && !SxactIsCommitted(sxact)
@@ -3418,7 +3418,7 @@ ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe)
         dlist_foreach_modify(iter, &MySerializableXact->possibleUnsafeConflicts)
         {
             RWConflict    possibleUnsafeConflict =
-            dlist_container(RWConflictData, inLink, iter.cur);
+                dlist_container(RWConflictData, inLink, iter.cur);

             Assert(!SxactIsReadOnly(possibleUnsafeConflict->sxactOut));
             Assert(MySerializableXact == possibleUnsafeConflict->sxactIn);
@@ -3449,7 +3449,7 @@ ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe)
     dlist_foreach_modify(iter, &MySerializableXact->outConflicts)
     {
         RWConflict    conflict =
-        dlist_container(RWConflictData, outLink, iter.cur);
+            dlist_container(RWConflictData, outLink, iter.cur);

         if (isCommit
             && !SxactIsReadOnly(MySerializableXact)
@@ -3474,7 +3474,7 @@ ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe)
     dlist_foreach_modify(iter, &MySerializableXact->inConflicts)
     {
         RWConflict    conflict =
-        dlist_container(RWConflictData, inLink, iter.cur);
+            dlist_container(RWConflictData, inLink, iter.cur);

         if (!isCommit
             || SxactIsCommitted(conflict->sxactOut)
@@ -3493,7 +3493,7 @@ ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe)
         dlist_foreach_modify(iter, &MySerializableXact->possibleUnsafeConflicts)
         {
             RWConflict    possibleUnsafeConflict =
-            dlist_container(RWConflictData, outLink, iter.cur);
+                dlist_container(RWConflictData, outLink, iter.cur);

             roXact = possibleUnsafeConflict->sxactIn;
             Assert(MySerializableXact == possibleUnsafeConflict->sxactOut);
@@ -3613,7 +3613,7 @@ ClearOldPredicateLocks(void)
     dlist_foreach_modify(iter, FinishedSerializableTransactions)
     {
         SERIALIZABLEXACT *finishedSxact =
-        dlist_container(SERIALIZABLEXACT, finishedLink, iter.cur);
+            dlist_container(SERIALIZABLEXACT, finishedLink, iter.cur);

         if (!TransactionIdIsValid(PredXact->SxactGlobalXmin)
             || TransactionIdPrecedesOrEquals(finishedSxact->finishedBefore,
@@ -3672,7 +3672,7 @@ ClearOldPredicateLocks(void)
     dlist_foreach_modify(iter, &OldCommittedSxact->predicateLocks)
     {
         PREDICATELOCK *predlock =
-        dlist_container(PREDICATELOCK, xactLink, iter.cur);
+            dlist_container(PREDICATELOCK, xactLink, iter.cur);
         bool        canDoPartialCleanup;

         LWLockAcquire(SerializableXactHashLock, LW_SHARED);
@@ -3759,7 +3759,7 @@ ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial,
     dlist_foreach_modify(iter, &sxact->predicateLocks)
     {
         PREDICATELOCK *predlock =
-        dlist_container(PREDICATELOCK, xactLink, iter.cur);
+            dlist_container(PREDICATELOCK, xactLink, iter.cur);
         PREDICATELOCKTAG tag;
         PREDICATELOCKTARGET *target;
         PREDICATELOCKTARGETTAG targettag;
@@ -3836,7 +3836,7 @@ ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial,
         dlist_foreach_modify(iter, &sxact->outConflicts)
         {
             RWConflict    conflict =
-            dlist_container(RWConflictData, outLink, iter.cur);
+                dlist_container(RWConflictData, outLink, iter.cur);

             if (summarize)
                 conflict->sxactIn->flags |= SXACT_FLAG_SUMMARY_CONFLICT_IN;
@@ -3848,7 +3848,7 @@ ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial,
     dlist_foreach_modify(iter, &sxact->inConflicts)
     {
         RWConflict    conflict =
-        dlist_container(RWConflictData, inLink, iter.cur);
+            dlist_container(RWConflictData, inLink, iter.cur);

         if (summarize)
             conflict->sxactOut->flags |= SXACT_FLAG_SUMMARY_CONFLICT_OUT;
@@ -4106,7 +4106,7 @@ CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag)
     dlist_foreach_modify(iter, &target->predicateLocks)
     {
         PREDICATELOCK *predlock =
-        dlist_container(PREDICATELOCK, targetLink, iter.cur);
+            dlist_container(PREDICATELOCK, targetLink, iter.cur);
         SERIALIZABLEXACT *sxact = predlock->tag.myXact;

         if (sxact == MySerializableXact)
@@ -4379,7 +4379,7 @@ CheckTableForSerializableConflictIn(Relation relation)
         dlist_foreach_modify(iter, &target->predicateLocks)
         {
             PREDICATELOCK *predlock =
-            dlist_container(PREDICATELOCK, targetLink, iter.cur);
+                dlist_container(PREDICATELOCK, targetLink, iter.cur);

             if (predlock->tag.myXact != MySerializableXact
                 && !RWConflictExists(predlock->tag.myXact, MySerializableXact))
@@ -4491,7 +4491,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
         dlist_foreach(iter, &writer->outConflicts)
         {
             RWConflict    conflict =
-            dlist_container(RWConflictData, outLink, iter.cur);
+                dlist_container(RWConflictData, outLink, iter.cur);
             SERIALIZABLEXACT *t2 = conflict->sxactIn;

             if (SxactIsPrepared(t2)
@@ -4538,7 +4538,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
             dlist_foreach(iter, &unconstify(SERIALIZABLEXACT *, reader)->inConflicts)
             {
                 const RWConflict conflict =
-                dlist_container(RWConflictData, inLink, iter.cur);
+                    dlist_container(RWConflictData, inLink, iter.cur);
                 const SERIALIZABLEXACT *t0 = conflict->sxactOut;

                 if (!SxactIsDoomed(t0)
@@ -4632,7 +4632,7 @@ PreCommit_CheckForSerializationFailure(void)
     dlist_foreach(near_iter, &MySerializableXact->inConflicts)
     {
         RWConflict    nearConflict =
-        dlist_container(RWConflictData, inLink, near_iter.cur);
+            dlist_container(RWConflictData, inLink, near_iter.cur);

         if (!SxactIsCommitted(nearConflict->sxactOut)
             && !SxactIsDoomed(nearConflict->sxactOut))
@@ -4642,7 +4642,7 @@ PreCommit_CheckForSerializationFailure(void)
             dlist_foreach(far_iter, &nearConflict->sxactOut->inConflicts)
             {
                 RWConflict    farConflict =
-                dlist_container(RWConflictData, inLink, far_iter.cur);
+                    dlist_container(RWConflictData, inLink, far_iter.cur);

                 if (farConflict->sxactOut == MySerializableXact
                     || (!SxactIsCommitted(farConflict->sxactOut)
@@ -4738,7 +4738,7 @@ AtPrepare_PredicateLocks(void)
     dlist_foreach(iter, &sxact->predicateLocks)
     {
         PREDICATELOCK *predlock =
-        dlist_container(PREDICATELOCK, xactLink, iter.cur);
+            dlist_container(PREDICATELOCK, xactLink, iter.cur);

         record.type = TWOPHASEPREDICATERECORD_LOCK;
         lockRecord->target = predlock->tag.myTarget->tag;
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 6ed19d662f..dac921219f 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -101,7 +101,7 @@ ProcGlobalShmemSize(void)
 {
     Size        size = 0;
     Size        TotalProcs =
-    add_size(MaxBackends, add_size(NUM_AUXILIARY_PROCS, max_prepared_xacts));
+        add_size(MaxBackends, add_size(NUM_AUXILIARY_PROCS, max_prepared_xacts));

     /* ProcGlobal */
     size = add_size(size, sizeof(PROC_HDR));
@@ -1244,7 +1244,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
         if (InHotStandby)
         {
             bool        maybe_log_conflict =
-            (standbyWaitStart != 0 && !logged_recovery_conflict);
+                (standbyWaitStart != 0 && !logged_recovery_conflict);

             /* Set a timer and wait for that or for the lock to be granted */
             ResolveRecoveryConflictWithLock(locallock->tag.lock,
diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c
index 83838ab438..8153240b19 100644
--- a/src/backend/tsearch/spell.c
+++ b/src/backend/tsearch/spell.c
@@ -2276,7 +2276,7 @@ NormalizeSubWord(IspellDict *Conf, char *word, int flag)
                         {
                             /* prefix success */
                             char       *ff = (prefix->aff[j]->flagflags & suffix->aff[i]->flagflags & FF_CROSSPRODUCT)
?
-                            VoidString : prefix->aff[j]->flag;
+                                VoidString : prefix->aff[j]->flag;

                             if (FindWord(Conf, pnewword, ff, flag))
                                 cur += addToResult(forms, cur, pnewword);
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index 0fa5370bcd..3e9f018ad7 100644
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -1155,7 +1155,7 @@ pgstat_flush_pending_entries(bool nowait)
     while (cur)
     {
         PgStat_EntryRef *entry_ref =
-        dlist_container(PgStat_EntryRef, pending_node, cur);
+            dlist_container(PgStat_EntryRef, pending_node, cur);
         PgStat_HashKey key = entry_ref->shared_entry->key;
         PgStat_Kind kind = key.kind;
         const PgStat_KindInfo *kind_info = pgstat_get_kind_info(kind);
diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c
index c1506b53d0..ee20ba2ce2 100644
--- a/src/backend/utils/activity/pgstat_shmem.c
+++ b/src/backend/utils/activity/pgstat_shmem.c
@@ -861,7 +861,7 @@ pgstat_drop_entry(PgStat_Kind kind, Oid dboid, Oid objoid)
     if (pgStatEntryRefHash)
     {
         PgStat_EntryRefHashEntry *lohashent =
-        pgstat_entry_ref_hash_lookup(pgStatEntryRefHash, key);
+            pgstat_entry_ref_hash_lookup(pgStatEntryRefHash, key);

         if (lohashent)
             pgstat_release_entry_ref(lohashent->key, lohashent->entry_ref,
diff --git a/src/backend/utils/activity/pgstat_xact.c b/src/backend/utils/activity/pgstat_xact.c
index 91cdd9222e..369239d501 100644
--- a/src/backend/utils/activity/pgstat_xact.c
+++ b/src/backend/utils/activity/pgstat_xact.c
@@ -76,7 +76,7 @@ AtEOXact_PgStat_DroppedStats(PgStat_SubXactStatus *xact_state, bool isCommit)
     dclist_foreach_modify(iter, &xact_state->pending_drops)
     {
         PgStat_PendingDroppedStatsItem *pending =
-        dclist_container(PgStat_PendingDroppedStatsItem, node, iter.cur);
+            dclist_container(PgStat_PendingDroppedStatsItem, node, iter.cur);
         xl_xact_stats_item *it = &pending->item;

         if (isCommit && !pending->is_create)
@@ -148,7 +148,7 @@ AtEOSubXact_PgStat_DroppedStats(PgStat_SubXactStatus *xact_state,
     dclist_foreach_modify(iter, &xact_state->pending_drops)
     {
         PgStat_PendingDroppedStatsItem *pending =
-        dclist_container(PgStat_PendingDroppedStatsItem, node, iter.cur);
+            dclist_container(PgStat_PendingDroppedStatsItem, node, iter.cur);
         xl_xact_stats_item *it = &pending->item;

         dclist_delete_from(&xact_state->pending_drops, &pending->node);
@@ -290,7 +290,7 @@ pgstat_get_transactional_drops(bool isCommit, xl_xact_stats_item **items)
     dclist_foreach(iter, &xact_state->pending_drops)
     {
         PgStat_PendingDroppedStatsItem *pending =
-        dclist_container(PgStat_PendingDroppedStatsItem, node, iter.cur);
+            dclist_container(PgStat_PendingDroppedStatsItem, node, iter.cur);

         if (isCommit && pending->is_create)
             continue;
@@ -335,7 +335,7 @@ create_drop_transactional_internal(PgStat_Kind kind, Oid dboid, Oid objoid, bool
     int            nest_level = GetCurrentTransactionNestLevel();
     PgStat_SubXactStatus *xact_state;
     PgStat_PendingDroppedStatsItem *drop = (PgStat_PendingDroppedStatsItem *)
-    MemoryContextAlloc(TopTransactionContext, sizeof(PgStat_PendingDroppedStatsItem));
+        MemoryContextAlloc(TopTransactionContext, sizeof(PgStat_PendingDroppedStatsItem));

     xact_state = pgstat_get_xact_stack_level(nest_level);

diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index d166613895..d6c5aeaaa2 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -4558,17 +4558,17 @@ EncodeInterval(struct pg_itm *itm, int style, char *str)
         case INTSTYLE_SQL_STANDARD:
             {
                 bool        has_negative = year < 0 || mon < 0 ||
-                mday < 0 || hour < 0 ||
-                min < 0 || sec < 0 || fsec < 0;
+                    mday < 0 || hour < 0 ||
+                    min < 0 || sec < 0 || fsec < 0;
                 bool        has_positive = year > 0 || mon > 0 ||
-                mday > 0 || hour > 0 ||
-                min > 0 || sec > 0 || fsec > 0;
+                    mday > 0 || hour > 0 ||
+                    min > 0 || sec > 0 || fsec > 0;
                 bool        has_year_month = year != 0 || mon != 0;
                 bool        has_day_time = mday != 0 || hour != 0 ||
-                min != 0 || sec != 0 || fsec != 0;
+                    min != 0 || sec != 0 || fsec != 0;
                 bool        has_day = mday != 0;
                 bool        sql_standard_value = !(has_negative && has_positive) &&
-                !(has_year_month && has_day_time);
+                    !(has_year_month && has_day_time);

                 /*
                  * SQL Standard wants only 1 "<sign>" preceding the whole
diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c
index bdfc48cdf5..001589da0b 100644
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -3218,9 +3218,9 @@ static RecordIOData *
 allocate_record_info(MemoryContext mcxt, int ncolumns)
 {
     RecordIOData *data = (RecordIOData *)
-    MemoryContextAlloc(mcxt,
-                       offsetof(RecordIOData, columns) +
-                       ncolumns * sizeof(ColumnIOData));
+        MemoryContextAlloc(mcxt,
+                           offsetof(RecordIOData, columns) +
+                           ncolumns * sizeof(ColumnIOData));

     data->record_type = InvalidOid;
     data->record_typmod = 0;
diff --git a/src/backend/utils/adt/jsonpath_exec.c b/src/backend/utils/adt/jsonpath_exec.c
index b561f0e7e8..41430bab7e 100644
--- a/src/backend/utils/adt/jsonpath_exec.c
+++ b/src/backend/utils/adt/jsonpath_exec.c
@@ -1326,8 +1326,8 @@ executeBoolItem(JsonPathExecContext *cxt, JsonPathItem *jsp,
                  */
                 JsonValueList vals = {0};
                 JsonPathExecResult res =
-                executeItemOptUnwrapResultNoThrow(cxt, &larg, jb,
-                                                  false, &vals);
+                    executeItemOptUnwrapResultNoThrow(cxt, &larg, jb,
+                                                      false, &vals);

                 if (jperIsError(res))
                     return jpbUnknown;
@@ -1337,8 +1337,8 @@ executeBoolItem(JsonPathExecContext *cxt, JsonPathItem *jsp,
             else
             {
                 JsonPathExecResult res =
-                executeItemOptUnwrapResultNoThrow(cxt, &larg, jb,
-                                                  false, NULL);
+                    executeItemOptUnwrapResultNoThrow(cxt, &larg, jb,
+                                                      false, NULL);

                 if (jperIsError(res))
                     return jpbUnknown;
@@ -1869,7 +1869,7 @@ executeDateTimeMethod(JsonPathExecContext *cxt, JsonPathItem *jsp,
             if (!fmt_txt[i])
             {
                 MemoryContext oldcxt =
-                MemoryContextSwitchTo(TopMemoryContext);
+                    MemoryContextSwitchTo(TopMemoryContext);

                 fmt_txt[i] = cstring_to_text(fmt_str[i]);
                 MemoryContextSwitchTo(oldcxt);
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 9ac42efdbc..a4e5f6281b 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -12186,7 +12186,7 @@ get_range_partbound_string(List *bound_datums)
     foreach(cell, bound_datums)
     {
         PartitionRangeDatum *datum =
-        lfirst_node(PartitionRangeDatum, cell);
+            lfirst_node(PartitionRangeDatum, cell);

         appendStringInfoString(buf, sep);
         if (datum->kind == PARTITION_RANGE_DATUM_MINVALUE)
diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c
index a38db4697d..4457c5d4f9 100644
--- a/src/backend/utils/adt/tsvector_op.c
+++ b/src/backend/utils/adt/tsvector_op.c
@@ -525,7 +525,7 @@ tsvector_delete_by_indices(TSVector tsv, int *indices_to_delete,
         if (arrin[i].haspos)
         {
             int            len = POSDATALEN(tsv, arrin + i) * sizeof(WordEntryPos)
-            + sizeof(uint16);
+                + sizeof(uint16);

             curoff = SHORTALIGN(curoff);
             memcpy(dataout + curoff,
diff --git a/src/backend/utils/adt/xid8funcs.c b/src/backend/utils/adt/xid8funcs.c
index e616303a29..b35533ff85 100644
--- a/src/backend/utils/adt/xid8funcs.c
+++ b/src/backend/utils/adt/xid8funcs.c
@@ -519,7 +519,7 @@ pg_snapshot_recv(PG_FUNCTION_ARGS)
     for (i = 0; i < nxip; i++)
     {
         FullTransactionId cur =
-        FullTransactionIdFromU64((uint64) pq_getmsgint64(buf));
+            FullTransactionIdFromU64((uint64) pq_getmsgint64(buf));

         if (FullTransactionIdPrecedes(cur, last) ||
             FullTransactionIdPrecedes(cur, xmin) ||
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 280f14aacc..1921f0a671 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -3083,10 +3083,10 @@ static void
 AssertPendingSyncConsistency(Relation relation)
 {
     bool        relcache_verdict =
-    RelationIsPermanent(relation) &&
-    ((relation->rd_createSubid != InvalidSubTransactionId &&
-      RELKIND_HAS_STORAGE(relation->rd_rel->relkind)) ||
-     relation->rd_firstRelfilelocatorSubid != InvalidSubTransactionId);
+        RelationIsPermanent(relation) &&
+        ((relation->rd_createSubid != InvalidSubTransactionId &&
+          RELKIND_HAS_STORAGE(relation->rd_rel->relkind)) ||
+         relation->rd_firstRelfilelocatorSubid != InvalidSubTransactionId);

     Assert(relcache_verdict == RelFileLocatorSkippingWAL(relation->rd_locator));

diff --git a/src/backend/utils/mmgr/dsa.c b/src/backend/utils/mmgr/dsa.c
index 604b702a91..9614f2e473 100644
--- a/src/backend/utils/mmgr/dsa.c
+++ b/src/backend/utils/mmgr/dsa.c
@@ -1369,7 +1369,7 @@ init_span(dsa_area *area,
     if (DsaPointerIsValid(pool->spans[1]))
     {
         dsa_area_span *head = (dsa_area_span *)
-        dsa_get_address(area, pool->spans[1]);
+            dsa_get_address(area, pool->spans[1]);

         head->prevspan = span_pointer;
     }
@@ -2215,7 +2215,7 @@ make_new_segment(dsa_area *area, size_t requested_pages)
     if (segment_map->header->next != DSA_SEGMENT_INDEX_NONE)
     {
         dsa_segment_map *next =
-        get_segment_by_index(area, segment_map->header->next);
+            get_segment_by_index(area, segment_map->header->next);

         Assert(next->header->bin == segment_map->header->bin);
         next->header->prev = new_index;
diff --git a/src/backend/utils/mmgr/freepage.c b/src/backend/utils/mmgr/freepage.c
index 722a2e34db..8f9ea090fa 100644
--- a/src/backend/utils/mmgr/freepage.c
+++ b/src/backend/utils/mmgr/freepage.c
@@ -285,7 +285,7 @@ sum_free_pages(FreePageManager *fpm)
         if (!relptr_is_null(fpm->freelist[list]))
         {
             FreePageSpanLeader *candidate =
-            relptr_access(base, fpm->freelist[list]);
+                relptr_access(base, fpm->freelist[list]);

             do
             {
diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c
index 19b6241e45..67522d8251 100644
--- a/src/backend/utils/resowner/resowner.c
+++ b/src/backend/utils/resowner/resowner.c
@@ -567,7 +567,7 @@ ResourceOwnerReleaseInternal(ResourceOwner owner,
         while (ResourceArrayGetAny(&(owner->cryptohasharr), &foundres))
         {
             pg_cryptohash_ctx *context =
-            (pg_cryptohash_ctx *) DatumGetPointer(foundres);
+                (pg_cryptohash_ctx *) DatumGetPointer(foundres);

             if (isCommit)
                 PrintCryptoHashLeakWarning(foundres);
diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c
index 7d11ae3478..d00217b21f 100644
--- a/src/backend/utils/time/snapmgr.c
+++ b/src/backend/utils/time/snapmgr.c
@@ -1990,7 +1990,7 @@ MaintainOldSnapshotTimeMapping(TimestampTz whenTaken, TransactionId xmin)
         int            bucket = (oldSnapshotControl->head_offset
                               + ((ts - oldSnapshotControl->head_timestamp)
                                  / USECS_PER_MINUTE))
-        % OLD_SNAPSHOT_TIME_MAP_ENTRIES;
+            % OLD_SNAPSHOT_TIME_MAP_ENTRIES;

         if (TransactionIdPrecedes(oldSnapshotControl->xid_by_minute[bucket], xmin))
             oldSnapshotControl->xid_by_minute[bucket] = xmin;
@@ -2057,7 +2057,7 @@ MaintainOldSnapshotTimeMapping(TimestampTz whenTaken, TransactionId xmin)
                     /* Extend map to unused entry. */
                     int            new_tail = (oldSnapshotControl->head_offset
                                             + oldSnapshotControl->count_used)
-                    % OLD_SNAPSHOT_TIME_MAP_ENTRIES;
+                        % OLD_SNAPSHOT_TIME_MAP_ENTRIES;

                     oldSnapshotControl->count_used++;
                     oldSnapshotControl->xid_by_minute[new_tail] = xmin;
@@ -2188,7 +2188,7 @@ SerializeSnapshot(Snapshot snapshot, char *start_address)
     if (serialized_snapshot.subxcnt > 0)
     {
         Size        subxipoff = sizeof(SerializedSnapshotData) +
-        snapshot->xcnt * sizeof(TransactionId);
+            snapshot->xcnt * sizeof(TransactionId);

         memcpy((TransactionId *) (start_address + subxipoff),
                snapshot->subxip, snapshot->subxcnt * sizeof(TransactionId));
diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c
index 388ece60cc..1cc00653d2 100644
--- a/src/bin/pg_basebackup/walmethods.c
+++ b/src/bin/pg_basebackup/walmethods.c
@@ -1353,7 +1353,7 @@ CreateWalTarMethod(const char *tarbase,
 {
     TarMethodData *wwmethod;
     const char *suffix = (compression_algorithm == PG_COMPRESSION_GZIP) ?
-    ".tar.gz" : ".tar";
+        ".tar.gz" : ".tar";

     wwmethod = pg_malloc0(sizeof(TarMethodData));
     *((const WalWriteMethodOps **) &wwmethod->base.ops) =
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 1cf47554fb..94f12193e6 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -14968,7 +14968,7 @@ dumpTable(Archive *fout, const TableInfo *tbinfo)
     if (tbinfo->dobj.dump & DUMP_COMPONENT_ACL)
     {
         const char *objtype =
-        (tbinfo->relkind == RELKIND_SEQUENCE) ? "SEQUENCE" : "TABLE";
+            (tbinfo->relkind == RELKIND_SEQUENCE) ? "SEQUENCE" : "TABLE";

         tableAclDumpId =
             dumpACL(fout, tbinfo->dobj.dumpId, InvalidDumpId,
@@ -17660,7 +17660,7 @@ processExtensionTables(Archive *fout, ExtensionInfo extinfo[],
                 TableInfo  *configtbl;
                 Oid            configtbloid = atooid(extconfigarray[j]);
                 bool        dumpobj =
-                curext->dobj.dump & DUMP_COMPONENT_DEFINITION;
+                    curext->dobj.dump & DUMP_COMPONENT_DEFINITION;

                 configtbl = findTableByOid(configtbloid);
                 if (configtbl == NULL)
diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c
index 3d5e8f30ab..435df8d808 100644
--- a/src/bin/pg_test_fsync/pg_test_fsync.c
+++ b/src/bin/pg_test_fsync/pg_test_fsync.c
@@ -623,7 +623,7 @@ static void
 print_elapse(struct timeval start_t, struct timeval stop_t, int ops)
 {
     double        total_time = (stop_t.tv_sec - start_t.tv_sec) +
-    (stop_t.tv_usec - start_t.tv_usec) * 0.000001;
+        (stop_t.tv_usec - start_t.tv_usec) * 0.000001;
     double        per_second = ops / total_time;
     double        avg_op_time_us = (total_time / ops) * USECS_SEC;

diff --git a/src/bin/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c
index c1399c09b9..bc013c7dbd 100644
--- a/src/bin/pg_upgrade/info.c
+++ b/src/bin/pg_upgrade/info.c
@@ -60,9 +60,9 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
            new_relnum < new_db->rel_arr.nrels)
     {
         RelInfo    *old_rel = (old_relnum < old_db->rel_arr.nrels) ?
-        &old_db->rel_arr.rels[old_relnum] : NULL;
+            &old_db->rel_arr.rels[old_relnum] : NULL;
         RelInfo    *new_rel = (new_relnum < new_db->rel_arr.nrels) ?
-        &new_db->rel_arr.rels[new_relnum] : NULL;
+            &new_db->rel_arr.rels[new_relnum] : NULL;

         /* handle running off one array before the other */
         if (!new_rel)
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 9c12ffaea9..1aec4b4b6c 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -4569,7 +4569,7 @@ processXactStats(TState *thread, CState *st, pg_time_usec_t *now,
     double        latency = 0.0,
                 lag = 0.0;
     bool        detailed = progress || throttle_delay || latency_limit ||
-    use_log || per_script_stats;
+        use_log || per_script_stats;

     if (detailed && !skipped && st->estatus == ESTATUS_NO_ERROR)
     {
@@ -6344,7 +6344,7 @@ printResults(StatsData *total,
                 StatsData  *sstats = &sql_script[i].stats;
                 int64        script_failures = getFailures(sstats);
                 int64        script_total_cnt =
-                sstats->cnt + sstats->skipped + script_failures;
+                    sstats->cnt + sstats->skipped + script_failures;

                 printf("SQL script %d: %s\n"
                        " - weight: %d (targets %.1f%% of total)\n"
diff --git a/src/bin/psql/crosstabview.c b/src/bin/psql/crosstabview.c
index 67fcdb49dd..e1ad0e61d9 100644
--- a/src/bin/psql/crosstabview.c
+++ b/src/bin/psql/crosstabview.c
@@ -532,7 +532,7 @@ avlInsertNode(avl_tree *tree, avl_node **node, pivot_field field)
     if (current == tree->end)
     {
         avl_node   *new_node = (avl_node *)
-        pg_malloc(sizeof(avl_node));
+            pg_malloc(sizeof(avl_node));

         new_node->height = 1;
         new_node->field = field;
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index 3fb184717f..4c96a3fb81 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -886,7 +886,7 @@ table_beginscan(Relation rel, Snapshot snapshot,
                 int nkeys, struct ScanKeyData *key)
 {
     uint32        flags = SO_TYPE_SEQSCAN |
-    SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE;
+        SO_ALLOW_STRAT | SO_ALLOW_SYNC | SO_ALLOW_PAGEMODE;

     return rel->rd_tableam->scan_begin(rel, snapshot, nkeys, key, NULL, flags);
 }
diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c
index bf9b313a11..38918ad874 100644
--- a/src/interfaces/ecpg/ecpglib/data.c
+++ b/src/interfaces/ecpg/ecpglib/data.c
@@ -521,7 +521,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                 case ECPGt_bytea:
                     {
                         struct ECPGgeneric_bytea *variable =
-                        (struct ECPGgeneric_bytea *) (var + offset * act_tuple);
+                            (struct ECPGgeneric_bytea *) (var + offset * act_tuple);
                         long        dst_size,
                                     src_size,
                                     dec_size;
@@ -681,7 +681,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
                 case ECPGt_varchar:
                     {
                         struct ECPGgeneric_varchar *variable =
-                        (struct ECPGgeneric_varchar *) (var + offset * act_tuple);
+                            (struct ECPGgeneric_varchar *) (var + offset * act_tuple);

                         variable->len = size;
                         if (varcharsize == 0)
diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c
index 649a71c286..883a210a81 100644
--- a/src/interfaces/ecpg/ecpglib/descriptor.c
+++ b/src/interfaces/ecpg/ecpglib/descriptor.c
@@ -210,7 +210,7 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va
         case ECPGt_varchar:
             {
                 struct ECPGgeneric_varchar *variable =
-                (struct ECPGgeneric_varchar *) var;
+                    (struct ECPGgeneric_varchar *) var;

                 if (varcharsize == 0)
                     memcpy(variable->arr, value, strlen(value));
@@ -597,7 +597,7 @@ set_desc_attr(struct descriptor_item *desc_item, struct variable *var,
     else
     {
         struct ECPGgeneric_bytea *variable =
-        (struct ECPGgeneric_bytea *) (var->value);
+            (struct ECPGgeneric_bytea *) (var->value);

         desc_item->is_binary = true;
         desc_item->data_len = variable->len;
diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c
index 641851983d..93926fd4fb 100644
--- a/src/interfaces/ecpg/ecpglib/execute.c
+++ b/src/interfaces/ecpg/ecpglib/execute.c
@@ -820,7 +820,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
             case ECPGt_bytea:
                 {
                     struct ECPGgeneric_bytea *variable =
-                    (struct ECPGgeneric_bytea *) (var->value);
+                        (struct ECPGgeneric_bytea *) (var->value);

                     if (!(mallocedval = (char *) ecpg_alloc(variable->len, lineno)))
                         return false;
@@ -833,7 +833,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
             case ECPGt_varchar:
                 {
                     struct ECPGgeneric_varchar *variable =
-                    (struct ECPGgeneric_varchar *) (var->value);
+                        (struct ECPGgeneric_varchar *) (var->value);

                     if (!(newcopy = (char *) ecpg_alloc(variable->len + 1, lineno)))
                         return false;
diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c
index dc083c1327..936a688381 100644
--- a/src/interfaces/ecpg/pgtypeslib/interval.c
+++ b/src/interfaces/ecpg/pgtypeslib/interval.c
@@ -780,17 +780,17 @@ EncodeInterval(struct /* pg_ */ tm *tm, fsec_t fsec, int style, char *str)
         case INTSTYLE_SQL_STANDARD:
             {
                 bool        has_negative = year < 0 || mon < 0 ||
-                mday < 0 || hour < 0 ||
-                min < 0 || sec < 0 || fsec < 0;
+                    mday < 0 || hour < 0 ||
+                    min < 0 || sec < 0 || fsec < 0;
                 bool        has_positive = year > 0 || mon > 0 ||
-                mday > 0 || hour > 0 ||
-                min > 0 || sec > 0 || fsec > 0;
+                    mday > 0 || hour > 0 ||
+                    min > 0 || sec > 0 || fsec > 0;
                 bool        has_year_month = year != 0 || mon != 0;
                 bool        has_day_time = mday != 0 || hour != 0 ||
-                min != 0 || sec != 0 || fsec != 0;
+                    min != 0 || sec != 0 || fsec != 0;
                 bool        has_day = mday != 0;
                 bool        sql_standard_value = !(has_negative && has_positive) &&
-                !(has_year_month && has_day_time);
+                    !(has_year_month && has_day_time);

                 /*
                  * SQL Standard wants only 1 "<sign>" preceding the whole
diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c
index 58119d1102..91adb89de9 100644
--- a/src/interfaces/ecpg/preproc/type.c
+++ b/src/interfaces/ecpg/preproc/type.c
@@ -78,7 +78,7 @@ ECPGmake_struct_member(const char *name, struct ECPGtype *type, struct ECPGstruc
 {
     struct ECPGstruct_member *ptr,
                *ne =
-    (struct ECPGstruct_member *) mm_alloc(sizeof(struct ECPGstruct_member));
+        (struct ECPGstruct_member *) mm_alloc(sizeof(struct ECPGstruct_member));

     ne->name = mm_strdup(name);
     ne->type = type;
diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c
index bd60543c03..40620b47e9 100644
--- a/src/interfaces/libpq/fe-print.c
+++ b/src/interfaces/libpq/fe-print.c
@@ -124,7 +124,7 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
         {
             int            len;
             const char *s = (j < numFieldName && po->fieldName[j][0]) ?
-            po->fieldName[j] : PQfname(res, j);
+                po->fieldName[j] : PQfname(res, j);

             fieldNames[j] = s;
             len = s ? strlen(s) : 0;
diff --git a/src/timezone/zic.c b/src/timezone/zic.c
index d6c5141923..d605c721ec 100644
--- a/src/timezone/zic.c
+++ b/src/timezone/zic.c
@@ -906,16 +906,16 @@ namecheck(const char *name)

     /* Benign characters in a portable file name.  */
     static char const benign[] =
-    "-/_"
-    "abcdefghijklmnopqrstuvwxyz"
-    "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+        "-/_"
+        "abcdefghijklmnopqrstuvwxyz"
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

     /*
      * Non-control chars in the POSIX portable character set, excluding the
      * benign characters.
      */
     static char const printable_and_not_benign[] =
-    " !\"#$%&'()*+,.0123456789:;<=>?@[\\]^`{|}~";
+        " !\"#$%&'()*+,.0123456789:;<=>?@[\\]^`{|}~";

     char const *component = name;

@@ -3203,7 +3203,7 @@ outzone(const struct zone *zpfirst, ptrdiff_t zonecount)
                         else if (jtime == ktime)
                         {
                             char const *dup_rules_msg =
-                            _("two rules for same instant");
+                                _("two rules for same instant");

                             eats(zp->z_filename, zp->z_linenum,
                                  rp->r_filename, rp->r_linenum);

Re: pgindent vs variable declaration across multiple lines

От
Andres Freund
Дата:
Hi,

On 2023-01-22 17:34:52 -0500, Tom Lane wrote:
> I spent some more time staring at this and came up with what seems like
> a workable patch, based on the idea that what we want to indent is
> specifically initialization expressions.

That's awesome. Thanks for doing that.


> Proposed patch for pg_bsd_indent attached.  I've also attached a diff
> representing the delta between what current pg_bsd_indent wants to do
> to HEAD and what this would do.  All the changes it wants to make look
> good, although I can't say whether there are other places it's failing
> to change that we'd like it to.

I think it's a significant improvement, even if it turns out that there's
other cases it misses.

Greetings,

Andres Freund



Re: pgindent vs variable declaration across multiple lines

От
Thomas Munro
Дата:
On Mon, Jan 23, 2023 at 11:34 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I spent some more time staring at this and came up with what seems like
> a workable patch, based on the idea that what we want to indent is
> specifically initialization expressions.  pg_bsd_indent does have some
> understanding of that: ps.block_init is true within such an expression,
> and then ps.block_init_level is the brace nesting depth inside it.
> If you just enable ind_stmt based on block_init then you get a bunch
> of unwanted additional indentation inside struct initializers, but
> it seems to work okay if you restrict it to not happen inside braces.
> More importantly, it doesn't change anything we don't want changed.

Nice!  LGTM now that I know about block_init.



Re: pgindent vs variable declaration across multiple lines

От
Andrew Dunstan
Дата:
On 2023-01-22 Su 17:34, Tom Lane wrote:
> I've also attached a diff
> representing the delta between what current pg_bsd_indent wants to do
> to HEAD and what this would do.  All the changes it wants to make look
> good, although I can't say whether there are other places it's failing
> to change that we'd like it to.
>
>             


Changes look good. There are a handful of places where I think the code
would be slightly more readable if a leading typecast were moved to the
second line.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com




Re: pgindent vs variable declaration across multiple lines

От
Tom Lane
Дата:
Andrew Dunstan <andrew@dunslane.net> writes:
> On 2023-01-22 Su 17:34, Tom Lane wrote:
>> I've also attached a diff
>> representing the delta between what current pg_bsd_indent wants to do
>> to HEAD and what this would do.  All the changes it wants to make look
>> good, although I can't say whether there are other places it's failing
>> to change that we'd like it to.

> Changes look good. There are a handful of places where I think the code
> would be slightly more readable if a leading typecast were moved to the
> second line.

Possibly, but that's the sort of decision that pgindent leaves to human
judgment I think.  It'll reflow comment blocks across lines, but I don't
recall having seen it move line breaks within code.

            regards, tom lane



Re: pgindent vs variable declaration across multiple lines

От
Tom Lane
Дата:
Now that pg_bsd_indent is in our tree, we can format this as a
patch against Postgres sources.  I'll stick it in the March CF
so we don't forget about it.

            regards, tom lane

diff --git a/src/tools/pg_bsd_indent/args.c b/src/tools/pg_bsd_indent/args.c
index d08b086a88..38eaa5a5bf 100644
--- a/src/tools/pg_bsd_indent/args.c
+++ b/src/tools/pg_bsd_indent/args.c
@@ -51,7 +51,7 @@ static char sccsid[] = "@(#)args.c    8.1 (Berkeley) 6/6/93";
 #include "indent_globs.h"
 #include "indent.h"
 
-#define INDENT_VERSION    "2.1.1"
+#define INDENT_VERSION    "2.1.2"
 
 /* profile types */
 #define    PRO_SPECIAL    1    /* special case */
diff --git a/src/tools/pg_bsd_indent/io.c b/src/tools/pg_bsd_indent/io.c
index 4149424294..9d64ca1ee5 100644
--- a/src/tools/pg_bsd_indent/io.c
+++ b/src/tools/pg_bsd_indent/io.c
@@ -201,11 +201,12 @@ dump_line(void)
     ps.decl_on_line = ps.in_decl;    /* if we are in the middle of a
                      * declaration, remember that fact for
                      * proper comment indentation */
-    ps.ind_stmt = ps.in_stmt & ~ps.in_decl;    /* next line should be
-                         * indented if we have not
-                         * completed this stmt and if
-                         * we are not in the middle of
-                         * a declaration */
+    /* next line should be indented if we have not completed this stmt, and
+     * either we are not in a declaration or we are in an initialization
+     * assignment; but not if we're within braces in an initialization,
+     * because that scenario is handled by other rules. */
+    ps.ind_stmt = ps.in_stmt &&
+    (!ps.in_decl || (ps.block_init && ps.block_init_level <= 0));
     ps.use_ff = false;
     ps.dumped_decl_indent = 0;
     *(e_lab = s_lab) = '\0';    /* reset buffers */
diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent
index a793971e07..3398d62133 100755
--- a/src/tools/pgindent/pgindent
+++ b/src/tools/pgindent/pgindent
@@ -13,7 +13,7 @@ use IO::Handle;
 use Getopt::Long;
 
 # Update for pg_bsd_indent version
-my $INDENT_VERSION = "2.1.1";
+my $INDENT_VERSION = "2.1.2";
 
 # Our standard indent settings
 my $indent_opts =