pgindent && weirdness - Mailing list pgsql-hackers

From Alvaro Herrera
Subject pgindent && weirdness
Date
Msg-id 20200114221814.GA19630@alvherre.pgsql
Whole thread Raw
Responses Re: pgindent && weirdness  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I just ran pgindent over some patch, and noticed that this hunk ended up
in my working tree:

diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 861a9148ed..fff54062b0 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -1405,13 +1405,13 @@ examine_opclause_expression(OpExpr *expr, Var **varp, Const **cstp, bool *varonl
     if (IsA(rightop, RelabelType))
         rightop = (Node *) ((RelabelType *) rightop)->arg;
 
-    if (IsA(leftop, Var) && IsA(rightop, Const))
+    if (IsA(leftop, Var) &&IsA(rightop, Const))
     {
         var = (Var *) leftop;
         cst = (Const *) rightop;
         varonleft = true;
     }
-    else if (IsA(leftop, Const) && IsA(rightop, Var))
+    else if (IsA(leftop, Const) &&IsA(rightop, Var))
     {
         var = (Var *) rightop;
         cst = (Const *) leftop;

This seems a really strange change; this
git grep '&&[^([:space:]]' -- *.c
shows that we already have a dozen or so occurrences already.  (That's
ignoring execExprInterp.c's use of computed gotos.)

I don't care all that much, but wanted to throw it out in case somebody
is specifically interested in studying pgindent's logic, since the last
round of changes has yielded excellent results.

Thanks,

-- 
Álvaro Herrera                PostgreSQL Expert, https://www.2ndQuadrant.com/



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: backup manifests
Next
From: Alvaro Herrera
Date:
Subject: Re: Add FOREIGN to ALTER TABLE in pg_dump