From c30d5a01d2d78ce87025e8b334e78c5d95937df3 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Fri, 17 Mar 2023 22:22:56 -0500
Subject: [PATCH 2/3] little fixes

---
 doc/src/sgml/ref/pg_dump.sgml               |  2 +-
 doc/src/sgml/ref/pg_dumpall.sgml            |  2 +-
 src/bin/pg_dump/filter.c                    | 13 +++++++------
 src/bin/pg_dump/pg_dump.c                   |  2 +-
 src/bin/pg_dump/pg_dumpall.c                |  4 ++--
 src/bin/pg_dump/pg_restore.c                |  4 ++--
 src/bin/pg_dump/t/005_pg_dump_filterfile.pl |  8 ++++----
 7 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml
index 5672fbb273b..f7c4304aec4 100644
--- a/doc/src/sgml/ref/pg_dump.sgml
+++ b/doc/src/sgml/ref/pg_dump.sgml
@@ -843,7 +843,7 @@ PostgreSQL documentation
         <option>-n</option>/<option>--schema</option> for schemas,
         <option>--include-foreign-data</option> for data on foreign servers and
         <option>--exclude-table-data</option>,
-        <option>--exclude-table-data-and-and-children</option> for table data.
+        <option>--exclude-table-data-and-children</option> for table data.
         To read from <literal>STDIN</literal>, use <filename>-</filename> as the
         filename.  The <option>--filter</option> option can be specified in
         conjunction with the above listed options for including or excluding
diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml
index ca2f93652cd..547fe3803f4 100644
--- a/doc/src/sgml/ref/pg_dumpall.sgml
+++ b/doc/src/sgml/ref/pg_dumpall.sgml
@@ -127,7 +127,7 @@ PostgreSQL documentation
       <listitem>
        <para>
         Specify a filename from which to read patterns for databases excluded
-        from dump. The patterns are interpretted according to the same rules
+        from the dump. The patterns are interpretted according to the same rules
         as <option>--exclude-database</option>.
         To read from <literal>STDIN</literal>, use <filename>-</filename> as the
         filename.  The <option>--filter</option> option can be specified in
diff --git a/src/bin/pg_dump/filter.c b/src/bin/pg_dump/filter.c
index 971b3d93eb1..41fb31b7253 100644
--- a/src/bin/pg_dump/filter.c
+++ b/src/bin/pg_dump/filter.c
@@ -25,7 +25,7 @@
  * Following routines are called from pg_dump, pg_dumpall and pg_restore.
  * Unfortunately, the implementation of exit_nicely in pg_dump and pg_restore is
  * different from the one in pg_dumpall, so instead of calling exit_nicely we
- * have to return some error flag (in this case NULL), and exit_nicelly will be
+ * have to return some error flag (in this case NULL), and exit_nicely will be
  * executed from caller's routine.
  */
 
@@ -162,7 +162,7 @@ log_unsupported_filter_object_type(FilterStateData *fstate,
  *
  * Search for keywords (limited to ascii alphabetic characters) in
  * the passed in line buffer. Returns NULL when the buffer is empty or first
- * char is not alpha. The char '_' is allowed too (exclude first position).
+ * char is not alpha. The char '_' is allowed, except as the first character.
  * The length of the found keyword is returned in the size parameter.
  */
 static const char *
@@ -280,8 +280,9 @@ read_quoted_string(FilterStateData *fstate,
  * Note that this function takes special care to sanitize the detected
  * identifier (removing extraneous whitespaces or other unnecessary
  * characters).  This is necessary as most backup/restore filtering functions
- * only recognize identifiers if they are written exactly way as they are
- * regenerated.
+ * only recognize identifiers if they are written exactly the same way as
+ * they are output by the server.
+ *
  * Returns a pointer to next character after the found identifier, or NULL on
  * error.
  */
@@ -364,8 +365,8 @@ read_pattern(FilterStateData *fstate, const char *str, PQExpBuffer pattern)
  * <command> <object_type> <pattern>
  *
  * command can be "include" or "exclude"
- * object_type can one of: "table", "schema", "foreign_data", "table_data",
- * "database", "function", "trigger" or "index"
+ * object_type can one of: "table", "table_and_children", "schema", "foreign_data",
+ * "table_data", "table_and_children", "database", "function", "trigger" or "index"
  * pattern can be any possibly-quoted and possibly-qualified identifier.  It
  * follows the same rules as other object include and exclude functions so it
  * can also use wildcards.
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index c7cc4b15736..42b8f8d91d5 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -18486,7 +18486,7 @@ appendReloptionsArrayAH(PQExpBuffer buffer, const char *reloptions,
 }
 
 /*
- * read_dump_filters - retrieve object identifer patterns from file
+ * read_dump_filters - retrieve object identifier patterns from file
  *
  * Parse the specified filter file for include and exclude patterns, and add
  * them to the relevant lists.  If the filename is "-" then filters will be
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 1bfa1c89051..d58eaaaa063 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -1941,13 +1941,13 @@ hash_string_pointer(char *s)
 }
 
 /*
- * read_dumpall_filters - retrieve database identifer patterns from file
+ * read_dumpall_filters - retrieve database identifier patterns from file
  *
  * Parse the specified filter file for include and exclude patterns, and add
  * them to the relevant lists.  If the filename is "-" then filters will be
  * read from STDIN rather than a file.
  *
- * In this moment only excluded databases can be filtered.
+ * At the moment, the only allowed filter is for database exclusion.
  */
 static void
 read_dumpall_filters(const char *filename, SimpleStringList *pattern)
diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c
index 1ebf573ac48..0ea71351737 100644
--- a/src/bin/pg_dump/pg_restore.c
+++ b/src/bin/pg_dump/pg_restore.c
@@ -504,7 +504,7 @@ usage(const char *progname)
 }
 
 /*
- * read_restore_filters - retrieve object identifer patterns from file
+ * read_restore_filters - retrieve object identifier patterns from file
  *
  * Parse the specified filter file for include and exclude patterns, and add
  * them to the relevant lists.  If the filename is "-" then filters will be
@@ -553,7 +553,7 @@ read_restore_filters(const char *filename, RestoreOptions *opts)
 			else
 			{
 				log_invalid_filter_format(&fstate,
-										   "\"exclude\" type  filter is not allowed");
+										   "\"exclude\" index filter is not allowed");
 				break;
 			}
 		}
diff --git a/src/bin/pg_dump/t/005_pg_dump_filterfile.pl b/src/bin/pg_dump/t/005_pg_dump_filterfile.pl
index ea1702263a6..67314dbd60e 100644
--- a/src/bin/pg_dump/t/005_pg_dump_filterfile.pl
+++ b/src/bin/pg_dump/t/005_pg_dump_filterfile.pl
@@ -640,8 +640,8 @@ command_ok(
 
 $dump = slurp_file($plainfile);
 
-ok($dump !=~ qr/^CREATE TABLE s1\.t1/m, "unwanted table from schema is not restored");
-ok($dump !=~ qr/^CREATE SEQUENCE s1\.s1/m, "unwanted sequence from schema is not restored");
+ok($dump !~ qr/^CREATE TABLE s1\.t1/m, "unwanted table from schema is not restored");
+ok($dump !~ qr/^CREATE SEQUENCE s1\.s1/m, "unwanted sequence from schema is not restored");
 ok($dump =~ qr/^CREATE TABLE s2\.t2/m, "wanted table restored");
 ok($dump =~ qr/^CREATE TABLE public\.t1/m, "wanted table restored");
 
@@ -680,7 +680,7 @@ command_ok(
 
 $dump = slurp_file($plainfile);
 
-ok($dump !=~ qr/^CREATE TABLE public\.bootab/m,   "exclude dumped children table");
+ok($dump !~ qr/^CREATE TABLE public\.bootab/m,   "exclude dumped children table");
 
 open $inputfile, '>', "$tempdir/inputfile.txt"
   or die "unable to open filterfile for writing";
@@ -698,4 +698,4 @@ command_ok(
 $dump = slurp_file($plainfile);
 
 ok($dump =~ qr/^CREATE TABLE public\.bootab/m,   "dumped children table");
-ok($dump !=~ qr/^COPY public\.bootab/m,   "exclude dumped children table");
+ok($dump !~ qr/^COPY public\.bootab/m,   "exclude dumped children table");
-- 
2.34.1

