Accidental assignment instead of compare in GetOperatorFromCompareType?

Started by Jacob Brazeal11 months ago4 messages
#1Jacob Brazeal
jacob.brazeal@gmail.com
1 attachment(s)

Hi all,

It looks like commit 630f9a43cece93cb4a5c243b30e34abce6a89514 omitted an
equals sign in an ereport() in GetOperatorFromCompareType, giving the line:

cmptype = COMPARE_EQ ? errmsg("could not identify an equality operator for
type %s", format_type_be(opcintype)) :

I think the impact is just that we'd never see the error messages for
the COMPARE_OVERLAP and COMPARE_CONTAINED_BY cases logged.

Regards,
Jacob

Attachments:

v01_fix_typos.patchapplication/octet-stream; name=v01_fix_typos.patchDownload
diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml
index c50ba60e21c..4a7c5748b9a 100644
--- a/doc/src/sgml/indexam.sgml
+++ b/doc/src/sgml/indexam.sgml
@@ -892,7 +892,7 @@ amtranslatestrategy (StrategyNumber strategy, Oid opfamily, Oid opcintype);
 StrategyNumber
 amtranslatecmptype (CompareType cmptype, Oid opfamily, Oid opcintype);
 </programlisting>
-   These functions, if implemented, will be called by the planer and executor
+   These functions, if implemented, will be called by the planner and executor
    to convert between fixed <type>CompareType</type> values and the specific
    strategy numbers used by the access method.  These functions can be
    implemented by access methods that implement functionality similar to the
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index 7bdd85c5cff..15b2300f318 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -801,7 +801,7 @@ psql --username=postgres --file=script.sql postgres
     </para>
 
     <para>
-     Because not all statistics are not transferred by
+     Because not all statistics are transferred by
      <command>pg_upgrade</command>, you will be instructed to run a command to
      regenerate that information at the end of the upgrade.  You might need to
      set connection parameters to match your new cluster.
diff --git a/src/backend/statistics/attribute_stats.c b/src/backend/statistics/attribute_stats.c
index 6bcbee0edba..0f152a32107 100644
--- a/src/backend/statistics/attribute_stats.c
+++ b/src/backend/statistics/attribute_stats.c
@@ -539,7 +539,7 @@ get_attr_expr(Relation rel, int attnum)
 		return NULL;
 
 	/*
-	 * The index attnum points directly to a relation attnum, then it's no an
+	 * The index attnum points directly to a relation attnum, then it's not an
 	 * expression attribute.
 	 */
 	if (rel->rd_index->indkey.values[attnum - 1] != 0)
diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c
index 8adf2730277..591f43d901f 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -1828,7 +1828,7 @@ LWLockDisownInternal(LWLock *lock)
 
 /*
  * Helper function to release lock, shared between LWLockRelease() and
- * LWLockeleaseDisowned().
+ * LWLockReleaseDisowned().
  */
 static void
 LWLockReleaseInternal(LWLock *lock, LWLockMode mode)
diff --git a/src/backend/utils/activity/pgstat_backend.c b/src/backend/utils/activity/pgstat_backend.c
index 3c9ebbcd69c..01545490ab0 100644
--- a/src/backend/utils/activity/pgstat_backend.c
+++ b/src/backend/utils/activity/pgstat_backend.c
@@ -87,7 +87,7 @@ pgstat_fetch_stat_backend(ProcNumber procNumber)
 /*
  * Returns statistics of a backend by pid.
  *
- * This routine includes sanity checks to ensire that the backend exists and
+ * This routine includes sanity checks to ensure that the backend exists and
  * is running.  "bktype" can be optionally defined to return the BackendType
  * of the backend whose statistics are returned.
  */
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 700ccb6df9b..868ab24cf70 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -1654,7 +1654,7 @@ CacheInvalidateSmgr(RelFileLocatorBackend rlocator)
 
 	/* verify optimization stated above stays valid */
 	StaticAssertStmt(MAX_BACKENDS_BITS <= 23,
-					 "MAX_BACKEND_BITS is too big for inval.c");
+					 "MAX_BACKENDS_BITS is too big for inval.c");
 
 	msg.sm.id = SHAREDINVALSMGR_ID;
 	msg.sm.backend_hi = rlocator.backend >> 16;
diff --git a/src/common/pg_lzcompress.c b/src/common/pg_lzcompress.c
index 86354d660fd..bf4f4d8a451 100644
--- a/src/common/pg_lzcompress.c
+++ b/src/common/pg_lzcompress.c
@@ -167,7 +167,7 @@
  *
  *		Acknowledgments:
  *
- *			Many thanks to Adisak Pochanayon, who's article about SLZ
+ *			Many thanks to Adisak Pochanayon, whose article about SLZ
  *			inspired me to write the PostgreSQL compression this way.
  *
  *			Jan Wieck
diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c
index 00747bb811b..66f71d701fd 100644
--- a/src/pl/plpython/plpy_exec.c
+++ b/src/pl/plpython/plpy_exec.c
@@ -309,7 +309,7 @@ PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc)
  *
  * the python function is expected to return Py_None if the tuple is
  * acceptable and unmodified.  Otherwise it should return a PyUnicode
- * object who's value is SKIP, or MODIFY.  SKIP means don't perform
+ * object whose value is SKIP, or MODIFY.  SKIP means don't perform
  * this action.  MODIFY means the tuple has been modified, so update
  * tuple and perform action.  SKIP and MODIFY assume the trigger fires
  * BEFORE the event and is ROW level.  postgres expects the function
diff --git a/src/tools/testwrap b/src/tools/testwrap
index 8ae8fb79ba7..5e59efdf3fa 100755
--- a/src/tools/testwrap
+++ b/src/tools/testwrap
@@ -43,7 +43,7 @@ env_dict = {**os.environ,
             'TESTLOGDIR': os.path.join(testdir, 'log')}
 
 
-# The configuration time value of PG_TEST_EXTRA is supplied via arguement
+# The configuration time value of PG_TEST_EXTRA is supplied via argument
 # --pg-test-extra. But it can be overridden by environment variable
 # PG_TEST_EXTRA at the time of running a test. Hence use value from arguments
 # only if PG_TEST_EXTRA is not set in the test environment, which already
#2Jacob Brazeal
jacob.brazeal@gmail.com
In reply to: Jacob Brazeal (#1)
1 attachment(s)
Re: Accidental assignment instead of compare in GetOperatorFromCompareType?

Sorry, I attached the wrong patch.

Show quoted text

Attachments:

v1_cmp_assign.patchapplication/octet-stream; name=v1_cmp_assign.patchDownload
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index c92f5620ec1..32ff3ca9a28 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -2472,7 +2472,7 @@ GetOperatorFromCompareType(Oid opclass, Oid rhstype, CompareType cmptype,
 		if (*strat == InvalidStrategy)
 			ereport(ERROR,
 					errcode(ERRCODE_UNDEFINED_OBJECT),
-					cmptype = COMPARE_EQ ? errmsg("could not identify an equality operator for type %s", format_type_be(opcintype)) :
+					cmptype == COMPARE_EQ ? errmsg("could not identify an equality operator for type %s", format_type_be(opcintype)) :
 					cmptype == COMPARE_OVERLAP ? errmsg("could not identify an overlaps operator for type %s", format_type_be(opcintype)) :
 					cmptype == COMPARE_CONTAINED_BY ? errmsg("could not identify a contained-by operator for type %s", format_type_be(opcintype)) : 0,
 					errdetail("Could not translate compare type %d for operator family \"%s\", input type %s, access method \"%s\".",
#3Michael Paquier
michael@paquier.xyz
In reply to: Jacob Brazeal (#2)
Re: Accidental assignment instead of compare in GetOperatorFromCompareType?

On Sun, Mar 02, 2025 at 09:06:18PM -0800, Jacob Brazeal wrote:

Sorry, I attached the wrong patch.

                     errcode(ERRCODE_UNDEFINED_OBJECT),
-                    cmptype = COMPARE_EQ ? errmsg("could not identify an equality operator for type %s", format_type_be(opcintype)) :
+                    cmptype == COMPARE_EQ ? errmsg("could not identify an equality operator for type %s", format_type_be(opcintype)) :

Yep, you're right. That's a typo coming from the recent commit
630f9a43cece.
--
Michael

#4Peter Eisentraut
peter@eisentraut.org
In reply to: Jacob Brazeal (#1)
Re: Accidental assignment instead of compare in GetOperatorFromCompareType?

On 03.03.25 06:05, Jacob Brazeal wrote:

Hi all,

It looks like commit 630f9a43cece93cb4a5c243b30e34abce6a89514 omitted an
equals sign in an ereport() in GetOperatorFromCompareType, giving the line:

cmptype = COMPARE_EQ ? errmsg("could not identify an equality operator
for type %s", format_type_be(opcintype)) :

I think the impact is just that we'd never see the error messages for
the COMPARE_OVERLAP and COMPARE_CONTAINED_BY cases logged.

Fixed, thanks.