Incorrect use of "an" and "a" in code comments and docs
Hi all,
While looking at something else, I have one one occurence of $subject.
Looking more deeply at the code I have found 10 more of them, like:
- sinval is a signal invalidation, so it seems to me that "a" is
correct, not "an".
- I bumped into "an" being used instead of "and" in the GIN code.
- config/c-library.m4 also includes one. If that code is from somewhere
else, fixing this typo would not be appropriate perhaps?
Attached is a proposal of patch to fix all those things.
Thanks,
--
Michael
On Mon, Mar 05, 2018 at 01:58:54PM +0900, Michael Paquier wrote:
While looking at something else, I have one one occurence of $subject.
Looking more deeply at the code I have found 10 more of them, like:
- sinval is a signal invalidation, so it seems to me that "a" is
correct, not "an".
- I bumped into "an" being used instead of "and" in the GIN code.
- config/c-library.m4 also includes one. If that code is from somewhere
else, fixing this typo would not be appropriate perhaps?Attached is a proposal of patch to fix all those things.
And of course I forgot to attach the actual patch. (Thanks Thomas for
telling me off-list).
--
Michael
Attachments:
pg-code-pronouns.patchtext/x-diff; charset=us-asciiDownload
diff --git a/config/c-library.m4 b/config/c-library.m4
index 9c2207b03d..34b25081a6 100644
--- a/config/c-library.m4
+++ b/config/c-library.m4
@@ -177,7 +177,7 @@ AC_DEFUN([PGAC_STRUCT_ADDRINFO],
# handle ll, q, and I64. The result is in shell variable
# LONG_LONG_INT_MODIFIER.
#
-# MinGW uses '%I64d', though gcc throws an warning with -Wall,
+# MinGW uses '%I64d', though gcc throws a warning with -Wall,
# while '%lld' doesn't generate a warning, but doesn't work.
#
AC_DEFUN([PGAC_FUNC_SNPRINTF_LONG_LONG_INT_MODIFIER],
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 2f59af25a6..bd9f080895 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -20090,7 +20090,7 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup());
included in the result set. The default is to exclude them
(<literal>false</literal>), but including them can be useful when
<parameter>missing_ok</parameter> is <literal>true</literal>, to distinguish an
- empty directory from an non-existent directory.
+ empty directory from a non-existent directory.
</para>
<indexterm>
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c
index 398532d80b..8b08b46ff6 100644
--- a/src/backend/access/gin/ginvacuum.c
+++ b/src/backend/access/gin/ginvacuum.c
@@ -381,7 +381,7 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
/*
* All subtree is empty - just return true to indicate that parent
- * must do a cleanup. Unless we are ROOT an there is way to go upper.
+ * must do a cleanup. Unless we are ROOT and there is way to go upper.
*/
if (hasEmptyChild && !hasNonEmptyChild && !isRoot)
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 0648539796..9150f8c62d 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -5280,7 +5280,7 @@ pg_extension_ownercheck(Oid ext_oid, Oid roleid)
}
/*
- * Ownership check for an publication (specified by OID).
+ * Ownership check for a publication (specified by OID).
*/
bool
pg_publication_ownercheck(Oid pub_oid, Oid roleid)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 5d481dd50d..125002e75e 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -1538,7 +1538,7 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
frozenXid, cutoffMulti, mapped_tables);
/*
- * If it's a system catalog, queue an sinval message to flush all
+ * If it's a system catalog, queue a sinval message to flush all
* catcaches on the catalog when we reach CommandCounterIncrement.
*/
if (is_system_catalog)
diff --git a/src/backend/executor/instrument.c b/src/backend/executor/instrument.c
index a2d9381ba1..86252cee1f 100644
--- a/src/backend/executor/instrument.c
+++ b/src/backend/executor/instrument.c
@@ -49,7 +49,7 @@ InstrAlloc(int n, int instrument_options)
return instr;
}
-/* Initialize an pre-allocated instrumentation structure. */
+/* Initialize a pre-allocated instrumentation structure. */
void
InstrInit(Instrumentation *instr, int instrument_options)
{
diff --git a/src/backend/libpq/pqformat.c b/src/backend/libpq/pqformat.c
index 30145b96ec..1c7e99019d 100644
--- a/src/backend/libpq/pqformat.c
+++ b/src/backend/libpq/pqformat.c
@@ -100,7 +100,7 @@ pq_beginmessage(StringInfo buf, char msgtype)
* pq_beginmessage_reuse - initialize for sending a message, reuse buffer
*
- * This requires the buffer to be allocated in an sufficiently long-lived
+ * This requires the buffer to be allocated in a sufficiently long-lived
* memory context.
* --------------------------------
*/
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index 068db353d7..41bfb61e24 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -77,7 +77,7 @@
token = pg_strtok(&length); /* get field value */ \
local_node->fldname = pg_strtouint64(token, NULL, 10)
-/* Read an long integer field (anything written as ":fldname %ld") */
+/* Read a long integer field (anything written as ":fldname %ld") */
#define READ_LONG_FIELD(fldname) \
token = pg_strtok(&length); /* skip :fldname */ \
token = pg_strtok(&length); /* get field value */ \
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c
index ec85795827..fae97135db 100644
--- a/src/backend/utils/adt/nabstime.c
+++ b/src/backend/utils/adt/nabstime.c
@@ -694,7 +694,7 @@ reltime2tm(RelativeTime time, struct pg_tm *tm)
/*
- * tintervalin - converts an tinterval string to internal format
+ * tintervalin - converts a tinterval string to internal format
*/
Datum
tintervalin(PG_FUNCTION_ARGS)
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 9ee78f885f..b73db2970d 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -2350,7 +2350,7 @@ RelationDestroyRelation(Relation relation, bool remember_tupdesc)
* NB: when rebuilding, we'd better hold some lock on the relation,
* else the catalog data we need to read could be changing under us.
* Also, a rel to be rebuilt had better have refcnt > 0. This is because
- * an sinval reset could happen while we're accessing the catalogs, and
+ * a sinval reset could happen while we're accessing the catalogs, and
* the rel would get blown away underneath us by RelationCacheInvalidate
* if it has zero refcnt.
*
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl
index 0c23d2fc58..3c663d1272 100644
--- a/src/bin/pgbench/t/001_pgbench_with_server.pl
+++ b/src/bin/pgbench/t/001_pgbench_with_server.pl
@@ -474,7 +474,7 @@ SELECT LEAST(:i, :i, :i, :i, :i, :i, :i, :i, :i, :i, :i);
0,
[ qr{cannot coerce boolean to int} ],
q{\set i TRUE + 2} ],
- [ 'set not an double',
+ [ 'set not a double',
0,
[ qr{cannot coerce boolean to double} ],
q{\set d ln(TRUE)} ],
At 2018-03-05 14:42:14 +0900, michael@paquier.xyz wrote:
- sinval is a signal invalidation, so it seems to me that "a" is
correct, not "an".
I guess it depends on whether you read it as "sin-val" or "ess-inval".
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c index 398532d80b..8b08b46ff6 100644 --- a/src/backend/access/gin/ginvacuum.c +++ b/src/backend/access/gin/ginvacuum.c @@ -381,7 +381,7 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)/* * All subtree is empty - just return true to indicate that parent - * must do a cleanup. Unless we are ROOT an there is way to go upper. + * must do a cleanup. Unless we are ROOT and there is way to go upper. */
That particular comment could use some more changes. :-)
-- Abhijit
On Mon, Mar 05, 2018 at 11:21:18AM +0530, Abhijit Menon-Sen wrote:
At 2018-03-05 14:42:14 +0900, michael@paquier.xyz wrote:
- sinval is a signal invalidation, so it seems to me that "a" is
correct, not "an".I guess it depends on whether you read it as "sin-val" or "ess-inval".
That is an ex-aequo in the core code: there are two places with "an
sinval" and two with "a sinval".
--
Michael
On 5 March 2018 at 18:42, Michael Paquier <michael@paquier.xyz> wrote:
On Mon, Mar 05, 2018 at 01:58:54PM +0900, Michael Paquier wrote:
Attached is a proposal of patch to fix all those things.
And of course I forgot to attach the actual patch. (Thanks Thomas for
telling me off-list).
If you're doing a round of that, then you may as well throw [1]/messages/by-id/CAKJS1f81A20mO_A___3sDnTZcZEH-2Pd5oTeiAUb=Qo2r9MrXw@mail.gmail.com into
the mix. It's gone a bit dead over there, and it does seem like it
would be good to not have two separate commits for these.
[1]: /messages/by-id/CAKJS1f81A20mO_A___3sDnTZcZEH-2Pd5oTeiAUb=Qo2r9MrXw@mail.gmail.com
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
On 2018-03-05 11:21:18 +0530, Abhijit Menon-Sen wrote:
At 2018-03-05 14:42:14 +0900, michael@paquier.xyz wrote:
- sinval is a signal invalidation, so it seems to me that "a" is
correct, not "an".I guess it depends on whether you read it as "sin-val" or "ess-inval".
It stands for shared invalidation, so I'd vote for the former. Not that
I think this really matters... ;)
Greetings,
Andres Freund
On Mon, Mar 5, 2018 at 6:51 PM, Abhijit Menon-Sen <ams@2ndquadrant.com> wrote:
At 2018-03-05 14:42:14 +0900, michael@paquier.xyz wrote:
- sinval is a signal invalidation, so it seems to me that "a" is
correct, not "an".I guess it depends on whether you read it as "sin-val" or "ess-inval".
$ git grep ' a SQL ' | wc -l
642
$ git grep ' an SQL ' | wc -l
219
/me grabs popcorn
--
Thomas Munro
http://www.enterprisedb.com
On Mon, Mar 05, 2018 at 07:42:40PM +1300, Thomas Munro wrote:
$ git grep ' a SQL ' | wc -l
642
$ git grep ' an SQL ' | wc -l
219/me grabs popcorn
ess-queue-el, sir.
--
Michael
Michael Paquier wrote:
On Mon, Mar 05, 2018 at 07:42:40PM +1300, Thomas Munro wrote:
$ git grep ' a SQL ' | wc -l
642
$ git grep ' an SQL ' | wc -l
219/me grabs popcorn
ess-queue-el, sir.
Yeah, but
http://patorjk.com/blog/2012/01/26/pronouncing-sql-s-q-l-or-sequel/
--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
On Mon, Mar 5, 2018 at 07:23:22PM +1300, David Rowley wrote:
On 5 March 2018 at 18:42, Michael Paquier <michael@paquier.xyz> wrote:
On Mon, Mar 05, 2018 at 01:58:54PM +0900, Michael Paquier wrote:
Attached is a proposal of patch to fix all those things.
And of course I forgot to attach the actual patch. (Thanks Thomas for
telling me off-list).If you're doing a round of that, then you may as well throw [1] into
the mix. It's gone a bit dead over there, and it does seem like it
would be good to not have two separate commits for these.[1] /messages/by-id/CAKJS1f81A20mO_A___3sDnTZcZEH-2Pd5oTeiAUb=Qo2r9MrXw@mail.gmail.com
This has been applied already:
commit 3beb46ae8118f64d94518ba105b5e5c79e2ce194
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Mon Mar 12 12:58:35 2018 -0300
docs: Fix typo: a -> an
David Rowley
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
On Mon, Mar 5, 2018 at 01:58:54PM +0900, Michael Paquier wrote:
Hi all,
While looking at something else, I have one one occurence of $subject.
Looking more deeply at the code I have found 10 more of them, like:
- sinval is a signal invalidation, so it seems to me that "a" is
correct, not "an".
- I bumped into "an" being used instead of "and" in the GIN code.
- config/c-library.m4 also includes one. If that code is from somewhere
else, fixing this typo would not be appropriate perhaps?Attached is a proposal of patch to fix all those things.
Attached patch applied. It includes a suggested fix by Abhijit
Menon-Sen.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
Attachments:
a.difftext/x-diff; charset=us-asciiDownload
diff --git a/config/c-library.m4 b/config/c-library.m4
new file mode 100644
index 9c2207b..34b2508
*** a/config/c-library.m4
--- b/config/c-library.m4
*************** AC_DEFUN([PGAC_STRUCT_ADDRINFO],
*** 177,183 ****
# handle ll, q, and I64. The result is in shell variable
# LONG_LONG_INT_MODIFIER.
#
! # MinGW uses '%I64d', though gcc throws an warning with -Wall,
# while '%lld' doesn't generate a warning, but doesn't work.
#
AC_DEFUN([PGAC_FUNC_SNPRINTF_LONG_LONG_INT_MODIFIER],
--- 177,183 ----
# handle ll, q, and I64. The result is in shell variable
# LONG_LONG_INT_MODIFIER.
#
! # MinGW uses '%I64d', though gcc throws a warning with -Wall,
# while '%lld' doesn't generate a warning, but doesn't work.
#
AC_DEFUN([PGAC_FUNC_SNPRINTF_LONG_LONG_INT_MODIFIER],
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c
new file mode 100644
index 398532d..630d6a7
*** a/src/backend/access/gin/ginvacuum.c
--- b/src/backend/access/gin/ginvacuum.c
*************** ginVacuumPostingTreeLeaves(GinVacuumStat
*** 381,387 ****
/*
* All subtree is empty - just return true to indicate that parent
! * must do a cleanup. Unless we are ROOT an there is way to go upper.
*/
if (hasEmptyChild && !hasNonEmptyChild && !isRoot)
--- 381,387 ----
/*
* All subtree is empty - just return true to indicate that parent
! * must do a cleanup, unless we are ROOT and there is way to go upper.
*/
if (hasEmptyChild && !hasNonEmptyChild && !isRoot)
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
new file mode 100644
index 8300057..0ace196
*** a/src/backend/catalog/aclchk.c
--- b/src/backend/catalog/aclchk.c
*************** pg_extension_ownercheck(Oid ext_oid, Oid
*** 5280,5286 ****
}
/*
! * Ownership check for an publication (specified by OID).
*/
bool
pg_publication_ownercheck(Oid pub_oid, Oid roleid)
--- 5280,5286 ----
}
/*
! * Ownership check for a publication (specified by OID).
*/
bool
pg_publication_ownercheck(Oid pub_oid, Oid roleid)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
new file mode 100644
index 639b699..0f844c0
*** a/src/backend/commands/cluster.c
--- b/src/backend/commands/cluster.c
*************** finish_heap_swap(Oid OIDOldHeap, Oid OID
*** 1539,1545 ****
frozenXid, cutoffMulti, mapped_tables);
/*
! * If it's a system catalog, queue an sinval message to flush all
* catcaches on the catalog when we reach CommandCounterIncrement.
*/
if (is_system_catalog)
--- 1539,1545 ----
frozenXid, cutoffMulti, mapped_tables);
/*
! * If it's a system catalog, queue a sinval message to flush all
* catcaches on the catalog when we reach CommandCounterIncrement.
*/
if (is_system_catalog)
diff --git a/src/backend/executor/instrument.c b/src/backend/executor/instrument.c
new file mode 100644
index a2d9381..86252ce
*** a/src/backend/executor/instrument.c
--- b/src/backend/executor/instrument.c
*************** InstrAlloc(int n, int instrument_options
*** 49,55 ****
return instr;
}
! /* Initialize an pre-allocated instrumentation structure. */
void
InstrInit(Instrumentation *instr, int instrument_options)
{
--- 49,55 ----
return instr;
}
! /* Initialize a pre-allocated instrumentation structure. */
void
InstrInit(Instrumentation *instr, int instrument_options)
{
diff --git a/src/backend/libpq/pqformat.c b/src/backend/libpq/pqformat.c
new file mode 100644
index 30145b9..1c7e990
*** a/src/backend/libpq/pqformat.c
--- b/src/backend/libpq/pqformat.c
*************** pq_beginmessage(StringInfo buf, char msg
*** 100,106 ****
* pq_beginmessage_reuse - initialize for sending a message, reuse buffer
*
! * This requires the buffer to be allocated in an sufficiently long-lived
* memory context.
* --------------------------------
*/
--- 100,106 ----
* pq_beginmessage_reuse - initialize for sending a message, reuse buffer
*
! * This requires the buffer to be allocated in a sufficiently long-lived
* memory context.
* --------------------------------
*/
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
new file mode 100644
index fd4586e..d02d4ec
*** a/src/backend/nodes/readfuncs.c
--- b/src/backend/nodes/readfuncs.c
***************
*** 77,83 ****
token = pg_strtok(&length); /* get field value */ \
local_node->fldname = pg_strtouint64(token, NULL, 10)
! /* Read an long integer field (anything written as ":fldname %ld") */
#define READ_LONG_FIELD(fldname) \
token = pg_strtok(&length); /* skip :fldname */ \
token = pg_strtok(&length); /* get field value */ \
--- 77,83 ----
token = pg_strtok(&length); /* get field value */ \
local_node->fldname = pg_strtouint64(token, NULL, 10)
! /* Read a long integer field (anything written as ":fldname %ld") */
#define READ_LONG_FIELD(fldname) \
token = pg_strtok(&length); /* skip :fldname */ \
token = pg_strtok(&length); /* get field value */ \
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c
new file mode 100644
index ec85795..fae9713
*** a/src/backend/utils/adt/nabstime.c
--- b/src/backend/utils/adt/nabstime.c
*************** reltime2tm(RelativeTime time, struct pg_
*** 694,700 ****
/*
! * tintervalin - converts an tinterval string to internal format
*/
Datum
tintervalin(PG_FUNCTION_ARGS)
--- 694,700 ----
/*
! * tintervalin - converts a tinterval string to internal format
*/
Datum
tintervalin(PG_FUNCTION_ARGS)
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
new file mode 100644
index 48f92dc..69a2114
*** a/src/backend/utils/cache/relcache.c
--- b/src/backend/utils/cache/relcache.c
*************** RelationDestroyRelation(Relation relatio
*** 2420,2426 ****
* NB: when rebuilding, we'd better hold some lock on the relation,
* else the catalog data we need to read could be changing under us.
* Also, a rel to be rebuilt had better have refcnt > 0. This is because
! * an sinval reset could happen while we're accessing the catalogs, and
* the rel would get blown away underneath us by RelationCacheInvalidate
* if it has zero refcnt.
*
--- 2420,2426 ----
* NB: when rebuilding, we'd better hold some lock on the relation,
* else the catalog data we need to read could be changing under us.
* Also, a rel to be rebuilt had better have refcnt > 0. This is because
! * a sinval reset could happen while we're accessing the catalogs, and
* the rel would get blown away underneath us by RelationCacheInvalidate
* if it has zero refcnt.
*
diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl
new file mode 100644
index 0929418..be08b20
*** a/src/bin/pgbench/t/001_pgbench_with_server.pl
--- b/src/bin/pgbench/t/001_pgbench_with_server.pl
*************** SELECT LEAST(:i, :i, :i, :i, :i, :i, :i,
*** 583,589 ****
0,
[ qr{cannot coerce boolean to int} ],
q{\set i TRUE + 2} ],
! [ 'set not an double',
0,
[ qr{cannot coerce boolean to double} ],
q{\set d ln(TRUE)} ],
--- 583,589 ----
0,
[ qr{cannot coerce boolean to int} ],
q{\set i TRUE + 2} ],
! [ 'set not a double',
0,
[ qr{cannot coerce boolean to double} ],
q{\set d ln(TRUE)} ],
On Mon, Mar 5, 2018 at 07:42:40PM +1300, Thomas Munro wrote:
On Mon, Mar 5, 2018 at 6:51 PM, Abhijit Menon-Sen <ams@2ndquadrant.com> wrote:
At 2018-03-05 14:42:14 +0900, michael@paquier.xyz wrote:
- sinval is a signal invalidation, so it seems to me that "a" is
correct, not "an".I guess it depends on whether you read it as "sin-val" or "ess-inval".
$ git grep ' a SQL ' | wc -l
642
$ git grep ' an SQL ' | wc -l
219/me grabs popcorn
I am planning to look into this, and will convert to "an" in my proposed
patch.
--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
On Thu, Mar 29, 2018 at 03:28:32PM -0400, Bruce Momjian wrote:
Attached patch applied. It includes a suggested fix by Abhijit
Menon-Sen.
Thanks Bruce.
--
Michael