Preventive maintenance in advance of pgindent run.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 17 May 2017 00:36:35 +0000 (20:36 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 17 May 2017 00:36:35 +0000 (20:36 -0400)
Reformat various places in which pgindent will make a mess, and
fix a few small violations of coding style that I happened to notice
while perusing the diffs from a pgindent dry run.

There is one actual bug fix here: the need-to-enlarge-the-buffer code
path in icu_convert_case was obviously broken.  Perhaps it's unreachable
in our usage?  Or maybe this is just sadly undertested.

20 files changed:
contrib/btree_gist/btree_utils_num.c
src/backend/catalog/pg_publication.c
src/backend/commands/publicationcmds.c
src/backend/commands/subscriptioncmds.c
src/backend/executor/nodeNamedtuplestorescan.c
src/backend/replication/logical/snapbuild.c
src/backend/replication/pgoutput/pgoutput.c
src/backend/tsearch/wparser.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/pg_locale.c
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_waldump/pg_waldump.c
src/bin/psql/tab-complete.c
src/common/scram-common.c
src/include/catalog/pg_authid.h
src/include/catalog/pg_subscription_rel.h
src/include/replication/logicalproto.h
src/interfaces/libpq/libpq-int.h

index d4fee91ee1730e96e1271c5a1cf0d381b26b9103..bae32c4064d4ff527af57c2506d13f62e1916b60 100644 (file)
@@ -183,9 +183,11 @@ gbt_num_union(GBT_NUMKEY *out, const GistEntryVector *entryvec, const gbtree_nin
                cur = (GBT_NUMKEY *) DatumGetPointer((entryvec->vector[i].key));
                c.lower = &cur[0];
                c.upper = &cur[tinfo->size];
-               if ((*tinfo->f_gt) (o.lower, c.lower, flinfo))  /* out->lower > cur->lower */
+               /* if out->lower > cur->lower, adopt cur as lower */
+               if ((*tinfo->f_gt) (o.lower, c.lower, flinfo))
                        memcpy((void *) o.lower, (void *) c.lower, tinfo->size);
-               if ((*tinfo->f_lt) (o.upper, c.upper, flinfo))  /* out->upper < cur->upper */
+               /* if out->upper < cur->upper, adopt cur as upper */
+               if ((*tinfo->f_lt) (o.upper, c.upper, flinfo))
                        memcpy((void *) o.upper, (void *) c.upper, tinfo->size);
        }
 
@@ -274,7 +276,8 @@ gbt_num_consistent(const GBT_NUMKEY_R *key,
                        if (is_leaf)
                                retval = (*tinfo->f_eq) (query, key->lower, flinfo);
                        else
-                               retval = ((*tinfo->f_le) (key->lower, query, flinfo) && (*tinfo->f_le) (query, key->upper, flinfo)) ? true : false;
+                               retval = ((*tinfo->f_le) (key->lower, query, flinfo) &&
+                                                 (*tinfo->f_le) (query, key->upper, flinfo));
                        break;
                case BTGreaterStrategyNumber:
                        if (is_leaf)
@@ -287,7 +290,7 @@ gbt_num_consistent(const GBT_NUMKEY_R *key,
                        break;
                case BtreeGistNotEqualStrategyNumber:
                        retval = (!((*tinfo->f_eq) (query, key->lower, flinfo) &&
-                                               (*tinfo->f_eq) (query, key->upper, flinfo))) ? true : false;
+                                               (*tinfo->f_eq) (query, key->upper, flinfo)));
                        break;
                default:
                        retval = false;
index 493b3aba894986f0587fbce9609e218d9194ac7f..92f9902173f88a7ac74d7e7649da655499e2e691 100644 (file)
@@ -90,6 +90,11 @@ check_publication_add_relation(Relation targetrel)
  *
  * Does same checks as the above, but does not need relation to be opened
  * and also does not throw errors.
+ *
+ * Note this also excludes all tables with relid < FirstNormalObjectId,
+ * ie all tables created during initdb.  This mainly affects the preinstalled
+ * information_schema.  (IsCatalogClass() only checks for these inside
+ * pg_catalog and toast schemas.)
  */
 static bool
 is_publishable_class(Oid relid, Form_pg_class reltuple)
@@ -97,12 +102,6 @@ is_publishable_class(Oid relid, Form_pg_class reltuple)
        return reltuple->relkind == RELKIND_RELATION &&
                !IsCatalogClass(relid, reltuple) &&
                reltuple->relpersistence == RELPERSISTENCE_PERMANENT &&
-               /*
-                * Also exclude any tables created as part of initdb. This mainly
-                * affects the preinstalled information_schema.
-                * Note that IsCatalogClass() only checks for these inside pg_catalog
-                * and toast schemas.
-                */
                relid >= FirstNormalObjectId;
 }
 
index 14c2f68d59f36661b5864570ba85407a8fe0d91b..1c8d88d336e50f64a1996d055381a3e280a544d0 100644 (file)
@@ -493,8 +493,10 @@ OpenTableList(List *tables)
 
                rel = heap_openrv(rv, ShareUpdateExclusiveLock);
                myrelid = RelationGetRelid(rel);
+
                /*
-                * filter out duplicates when user specifies "foo, foo"
+                * Filter out duplicates if user specifies "foo, foo".
+                *
                 * Note that this algorithm is known to not be very efficient (O(N^2))
                 * but given that it only works on list of tables given to us by user
                 * it's deemed acceptable.
index 304ac842a55fcf5552528471b3a9fb818842c2ba..b80af275da5ce5948e84515da9c78bca55bc0ff2 100644 (file)
@@ -296,6 +296,7 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
 
        /*
         * Parse and check options.
+        *
         * Connection and publication should not be specified here.
         */
        parse_subscription_options(stmt->options, &connect, &enabled_given,
index 44e09426691583378962b82189172eedf196cbe6..62234869abb75e9fe549eadf17d829348e9063af 100644 (file)
@@ -117,6 +117,7 @@ ExecInitNamedTuplestoreScan(NamedTuplestoreScan *node, EState *estate, int eflag
 
        /*
         * XXX: Should we add a function to free that read pointer when done?
+        *
         * This was attempted, but it did not improve performance or memory usage
         * in any tested cases.
         */
index c2e3c85914e62c0c5cbb8ce7b4b048eb0d2e2df8..428d7aa55eb83ea6687e65d0e2c7ed316eb28293 100644 (file)
@@ -176,7 +176,7 @@ struct SnapBuild
         */
        TransactionId initial_xmin_horizon;
 
-       /* Indicates if we are building full snapshot or just catalog one .*/
+       /* Indicates if we are building full snapshot or just catalog one*/
        bool            building_full_snapshot;
 
        /*
index 4ddfbf7a98b14e7d7a7a081dc5129cc6c863828a..694f351dd8ea7701512a0f5a8cfa6c75fdcd74b7 100644 (file)
@@ -221,14 +221,15 @@ pgoutput_begin_txn(LogicalDecodingContext *ctx, ReorderBufferTXN *txn)
                OutputPluginWrite(ctx, false);
                OutputPluginPrepareWrite(ctx, true);
 
-               /*
-                * XXX: which behaviour we want here?
+               /*----------
+                * XXX: which behaviour do we want here?
                 *
                 * Alternatives:
                 *  - don't send origin message if origin name not found
                 *    (that's what we do now)
                 *  - throw error - that will break replication, not good
                 *  - send some special "unknown" origin
+                *----------
                 */
                if (replorigin_by_oid(txn->origin_id, true, &origin))
                        logicalrep_write_origin(ctx->out, origin, txn->origin_lsn);
index c19937d644a670ef617aeaca435ab09f089dfc40..9739558e424294fe29853e443330f3e41a954a63 100644 (file)
@@ -303,6 +303,7 @@ ts_parse_byname(PG_FUNCTION_ARGS)
 Datum
 ts_headline_byid_opt(PG_FUNCTION_ARGS)
 {
+       Oid                     tsconfig = PG_GETARG_OID(0);
        text       *in = PG_GETARG_TEXT_PP(1);
        TSQuery         query = PG_GETARG_TSQUERY(2);
        text       *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_PP(3) : NULL;
@@ -312,7 +313,7 @@ ts_headline_byid_opt(PG_FUNCTION_ARGS)
        TSConfigCacheEntry *cfg;
        TSParserCacheEntry *prsobj;
 
-       cfg = lookup_ts_config_cache(PG_GETARG_OID(0));
+       cfg = lookup_ts_config_cache(tsconfig);
        prsobj = lookup_ts_parser_cache(cfg->prsId);
 
        if (!OidIsValid(prsobj->headlineOid))
@@ -381,11 +382,12 @@ ts_headline_opt(PG_FUNCTION_ARGS)
 Datum
 ts_headline_jsonb_byid_opt(PG_FUNCTION_ARGS)
 {
-       Jsonb                   *out, *jb = PG_GETARG_JSONB(1);
+       Oid                             tsconfig = PG_GETARG_OID(0);
+       Jsonb                   *jb = PG_GETARG_JSONB(1);
        TSQuery                 query = PG_GETARG_TSQUERY(2);
        text                    *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_P(3) : NULL;
+       Jsonb                   *out;
        JsonTransformStringValuesAction action = (JsonTransformStringValuesAction) headline_json_value;
-
        HeadlineParsedText prs;
        HeadlineJsonState *state = palloc0(sizeof(HeadlineJsonState));
 
@@ -394,7 +396,7 @@ ts_headline_jsonb_byid_opt(PG_FUNCTION_ARGS)
        prs.words = (HeadlineWordEntry *) palloc(sizeof(HeadlineWordEntry) * prs.lenwords);
 
        state->prs = &prs;
-       state->cfg = lookup_ts_config_cache(PG_GETARG_OID(0));
+       state->cfg = lookup_ts_config_cache(tsconfig);
        state->prsobj = lookup_ts_parser_cache(state->cfg->prsId);
        state->query = query;
        if (opt)
@@ -456,6 +458,7 @@ ts_headline_jsonb_opt(PG_FUNCTION_ARGS)
 Datum
 ts_headline_json_byid_opt(PG_FUNCTION_ARGS)
 {
+       Oid                                     tsconfig = PG_GETARG_OID(0);
        text                            *json = PG_GETARG_TEXT_P(1);
        TSQuery                         query = PG_GETARG_TSQUERY(2);
        text                            *opt = (PG_NARGS() > 3 && PG_GETARG_POINTER(3)) ? PG_GETARG_TEXT_P(3) : NULL;
@@ -470,7 +473,7 @@ ts_headline_json_byid_opt(PG_FUNCTION_ARGS)
        prs.words = (HeadlineWordEntry *) palloc(sizeof(HeadlineWordEntry) * prs.lenwords);
 
        state->prs = &prs;
-       state->cfg = lookup_ts_config_cache(PG_GETARG_OID(0));
+       state->cfg = lookup_ts_config_cache(tsconfig);
        state->prsobj = lookup_ts_parser_cache(state->cfg->prsId);
        state->query = query;
        if (opt)
index 0566abd314de711d22a51964ecba0a47211101d4..1e21dd5c68950c23dddc6072426be1d31c17f2ad 100644 (file)
@@ -1448,9 +1448,15 @@ str_numth(char *dest, char *num, int type)
  *****************************************************************************/
 
 #ifdef USE_ICU
+
+typedef int32_t (*ICU_Convert_Func)(UChar *dest, int32_t destCapacity,
+                                                                       const UChar *src, int32_t srcLength,
+                                                                       const char *locale,
+                                                                       UErrorCode *pErrorCode);
+
 static int32_t
-icu_convert_case(int32_t (*func)(UChar *, int32_t, const UChar *, int32_t, const char *, UErrorCode *),
-                                pg_locale_t mylocale, UChar **buff_dest, UChar *buff_source, int32_t len_source)
+icu_convert_case(ICU_Convert_Func func, pg_locale_t mylocale,
+                                UChar **buff_dest, UChar *buff_source, int32_t len_source)
 {
        UErrorCode      status;
        int32_t         len_dest;
@@ -1458,14 +1464,16 @@ icu_convert_case(int32_t (*func)(UChar *, int32_t, const UChar *, int32_t, const
        len_dest = len_source;  /* try first with same length */
        *buff_dest = palloc(len_dest * sizeof(**buff_dest));
        status = U_ZERO_ERROR;
-       len_dest = func(*buff_dest, len_dest, buff_source, len_source, mylocale->info.icu.locale, &status);
+       len_dest = func(*buff_dest, len_dest, buff_source, len_source,
+                                       mylocale->info.icu.locale, &status);
        if (status == U_BUFFER_OVERFLOW_ERROR)
        {
                /* try again with adjusted length */
-               pfree(buff_dest);
-               buff_dest = palloc(len_dest * sizeof(**buff_dest));
+               pfree(*buff_dest);
+               *buff_dest = palloc(len_dest * sizeof(**buff_dest));
                status = U_ZERO_ERROR;
-               len_dest = func(*buff_dest, len_dest, buff_source, len_source, mylocale->info.icu.locale, &status);
+               len_dest = func(*buff_dest, len_dest, buff_source, len_source,
+                                               mylocale->info.icu.locale, &status);
        }
        if (U_FAILURE(status))
                ereport(ERROR,
@@ -1479,9 +1487,11 @@ u_strToTitle_default_BI(UChar *dest, int32_t destCapacity,
                                                const char *locale,
                                                UErrorCode *pErrorCode)
 {
-       return u_strToTitle(dest, destCapacity, src, srcLength, NULL, locale, pErrorCode);
+       return u_strToTitle(dest, destCapacity, src, srcLength,
+                                               NULL, locale, pErrorCode);
 }
-#endif
+
+#endif /* USE_ICU */
 
 /*
  * If the system provides the needed functions for wide-character manipulation
@@ -1548,7 +1558,8 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
                        UChar      *buff_conv;
 
                        len_uchar = icu_to_uchar(&buff_uchar, buff, nbytes);
-                       len_conv = icu_convert_case(u_strToLower, mylocale, &buff_conv, buff_uchar, len_uchar);
+                       len_conv = icu_convert_case(u_strToLower, mylocale,
+                                                                               &buff_conv, buff_uchar, len_uchar);
                        icu_from_uchar(&result, buff_conv, len_conv);
                }
                else
@@ -1666,7 +1677,8 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
                        UChar      *buff_conv;
 
                        len_uchar = icu_to_uchar(&buff_uchar, buff, nbytes);
-                       len_conv = icu_convert_case(u_strToUpper, mylocale, &buff_conv, buff_uchar, len_uchar);
+                       len_conv = icu_convert_case(u_strToUpper, mylocale,
+                                                                               &buff_conv, buff_uchar, len_uchar);
                        icu_from_uchar(&result, buff_conv, len_conv);
                }
                else
@@ -1785,7 +1797,8 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
                        UChar      *buff_conv;
 
                        len_uchar = icu_to_uchar(&buff_uchar, buff, nbytes);
-                       len_conv = icu_convert_case(u_strToTitle_default_BI, mylocale, &buff_conv, buff_uchar, len_uchar);
+                       len_conv = icu_convert_case(u_strToTitle_default_BI, mylocale,
+                                                                               &buff_conv, buff_uchar, len_uchar);
                        icu_from_uchar(&result, buff_conv, len_conv);
                }
                else
index 2a2c9bc504683abdcc495a7f32fc521272f7a908..e2ccac2d2a5df6137d104cc4d9e92f3bb62bd321 100644 (file)
@@ -1381,12 +1381,14 @@ pg_newlocale_from_collation(Oid collid)
 
                        actual_versionstr = get_collation_actual_version(collform->collprovider, collcollate);
                        if (!actual_versionstr)
+                       {
                                /* This could happen when specifying a version in CREATE
                                 * COLLATION for a libc locale, or manually creating a mess
                                 * in the catalogs. */
                                ereport(ERROR,
                                                (errmsg("collation \"%s\" has no actual version, but a version was specified",
                                                                NameStr(collform->collname))));
+                       }
                        collversionstr = TextDatumGetCString(collversion);
 
                        if (strcmp(actual_versionstr, collversionstr) != 0)
index a75d565843855c15a9103ac45c2fb64b7bd75ea1..866f88a01702d76da766cd74b2ae0e6fa27f0716 100644 (file)
@@ -331,22 +331,22 @@ usage(void)
        printf(_("\nOptions controlling the output:\n"));
        printf(_("  -D, --pgdata=DIRECTORY receive base backup into directory\n"));
        printf(_("  -F, --format=p|t       output format (plain (default), tar)\n"));
-       printf(_("  -r, --max-rate=RATE    maximum transfer rate to transfer data directory\n"
-         "                         (in kB/s, or use suffix \"k\" or \"M\")\n"));
-       printf(_("  -R, --write-recovery-conf\n"
-                        "                         write recovery.conf for replication\n"));
+       printf(_("  -r, --max-rate=RATE    maximum transfer rate to transfer data directory\n"));
+       printf(_("                         (in kB/s, or use suffix \"k\" or \"M\")\n"));
+       printf(_("  -R, --write-recovery-conf\n"));
+       printf(_("                         write recovery.conf for replication\n"));
        printf(_("  -S, --slot=SLOTNAME    replication slot to use\n"));
        printf(_("      --no-slot          prevent creation of temporary replication slot\n"));
-       printf(_("  -T, --tablespace-mapping=OLDDIR=NEWDIR\n"
-         "                         relocate tablespace in OLDDIR to NEWDIR\n"));
-       printf(_("  -X, --wal-method=none|fetch|stream\n"
-                        "                         include required WAL files with specified method\n"));
+       printf(_("  -T, --tablespace-mapping=OLDDIR=NEWDIR\n"));
+       printf(_("                         relocate tablespace in OLDDIR to NEWDIR\n"));
+       printf(_("  -X, --wal-method=none|fetch|stream\n"));
+       printf(_("                         include required WAL files with specified method\n"));
        printf(_("      --waldir=WALDIR    location for the write-ahead log directory\n"));
        printf(_("  -z, --gzip             compress tar output\n"));
        printf(_("  -Z, --compress=0-9     compress tar output with given compression level\n"));
        printf(_("\nGeneral options:\n"));
-       printf(_("  -c, --checkpoint=fast|spread\n"
-                        "                         set fast or spread checkpointing\n"));
+       printf(_("  -c, --checkpoint=fast|spread\n"));
+       printf(_("                         set fast or spread checkpointing\n"));
        printf(_("  -l, --label=LABEL      set backup label\n"));
        printf(_("  -n, --no-clean         do not clean up after errors\n"));
        printf(_("  -N, --no-sync          do not wait for changes to be written safely to disk\n"));
@@ -358,8 +358,8 @@ usage(void)
        printf(_("  -d, --dbname=CONNSTR   connection string\n"));
        printf(_("  -h, --host=HOSTNAME    database server host or socket directory\n"));
        printf(_("  -p, --port=PORT        database server port number\n"));
-       printf(_("  -s, --status-interval=INTERVAL\n"
-                        "                         time between status packets sent to server (in seconds)\n"));
+       printf(_("  -s, --status-interval=INTERVAL\n"));
+       printf(_("                         time between status packets sent to server (in seconds)\n"));
        printf(_("  -U, --username=NAME    connect as specified database user\n"));
        printf(_("  -w, --no-password      never prompt for password\n"));
        printf(_("  -W, --password         force password prompt (should happen automatically)\n"));
index 19534248ab7c4d8dd94e8f14d1ab7a313e178ba9..79eac8c7cf62174c9432dc160bc33925f1ebb1a1 100644 (file)
@@ -527,8 +527,7 @@ do { \
        else if (strcmp(type, "LANGUAGE") == 0)
                CONVERT_PRIV('U', "USAGE");
        else if (strcmp(type, "SCHEMA") == 0 ||
-                        strcmp(type, "SCHEMAS") == 0
-                       )
+                        strcmp(type, "SCHEMAS") == 0)
        {
                CONVERT_PRIV('C', "CREATE");
                CONVERT_PRIV('U', "USAGE");
index 04cbb45bdcb077d944f532f90b19cb77c8687ab3..e7ab6a8fed5e9eea558ee46399bc6b9c4a15a728 100644 (file)
@@ -257,8 +257,8 @@ struct _archiveHandle
        WriteExtraTocPtrType WriteExtraTocPtr;  /* Write extra TOC entry data
                                                                                 * associated with the current archive
                                                                                 * format */
-       ReadExtraTocPtrType ReadExtraTocPtr;    /* Read extr info associated with
-                                                                                * archie format */
+       ReadExtraTocPtrType ReadExtraTocPtr;    /* Read extra info associated with
+                                                                                * archive format */
        PrintExtraTocPtrType PrintExtraTocPtr;  /* Extra TOC info for format */
        PrintTocDataPtrType PrintTocDataPtr;
 
index 77b36f60e1428f8814c134b08df0473dcbb3879b..56843a5d509e3fd302a6d51ccd4a12cbd3802134 100644 (file)
@@ -689,18 +689,18 @@ usage(void)
        printf(_("  -e, --end=RECPTR       stop reading at WAL location RECPTR\n"));
        printf(_("  -f, --follow           keep retrying after reaching end of WAL\n"));
        printf(_("  -n, --limit=N          number of records to display\n"));
-       printf(_("  -p, --path=PATH        directory in which to find log segment files or a\n"
-                        "                         directory with a ./pg_wal that contains such files\n"
-                        "                         (default: current directory, ./pg_wal, PGDATA/pg_wal)\n"));
-       printf(_("  -r, --rmgr=RMGR        only show records generated by resource manager RMGR\n"
-                        "                         use --rmgr=list to list valid resource manager names\n"));
+       printf(_("  -p, --path=PATH        directory in which to find log segment files or a\n"));
+       printf(_("                         directory with a ./pg_wal that contains such files\n"));
+       printf(_("                         (default: current directory, ./pg_wal, PGDATA/pg_wal)\n"));
+       printf(_("  -r, --rmgr=RMGR        only show records generated by resource manager RMGR\n"));
+       printf(_("                         use --rmgr=list to list valid resource manager names\n"));
        printf(_("  -s, --start=RECPTR     start reading at WAL location RECPTR\n"));
-       printf(_("  -t, --timeline=TLI     timeline from which to read log records\n"
-                        "                         (default: 1 or the value used in STARTSEG)\n"));
+       printf(_("  -t, --timeline=TLI     timeline from which to read log records\n"));
+       printf(_("                         (default: 1 or the value used in STARTSEG)\n"));
        printf(_("  -V, --version          output version information, then exit\n"));
        printf(_("  -x, --xid=XID          only show records with TransactionId XID\n"));
-       printf(_("  -z, --stats[=record]   show statistics instead of records\n"
-                        "                         (optionally, show per-record statistics)\n"));
+       printf(_("  -z, --stats[=record]   show statistics instead of records\n"));
+       printf(_("                         (optionally, show per-record statistics)\n"));
        printf(_("  -?, --help             show this help, then exit\n"));
 }
 
index b9e3491aeca45de86e1681b31e4f9187541f3d38..c768a48e4d54f6a1eac9cbb4e0763d2ac74323e5 100644 (file)
@@ -2772,6 +2772,7 @@ psql_completion(const char *text, int start, int end)
  */
        /* Complete GRANT/REVOKE with a list of roles and privileges */
        else if (TailMatches1("GRANT|REVOKE"))
+       {
                /*
                 * With ALTER DEFAULT PRIVILEGES, restrict completion
                 * to grantable privileges (can't grant roles)
@@ -2795,7 +2796,7 @@ psql_completion(const char *text, int start, int end)
                                                        " UNION SELECT 'EXECUTE'"
                                                        " UNION SELECT 'USAGE'"
                                                        " UNION SELECT 'ALL'");
-
+       }
        /*
         * Complete GRANT/REVOKE <privilege> with "ON", GRANT/REVOKE <role> with
         * TO/FROM
@@ -2822,6 +2823,7 @@ psql_completion(const char *text, int start, int end)
         * privilege.
         */
        else if (TailMatches3("GRANT|REVOKE", MatchAny, "ON"))
+       {
                /*
                 * With ALTER DEFAULT PRIVILEGES, restrict completion
                 * to the kinds of objects supported.
@@ -2845,11 +2847,10 @@ psql_completion(const char *text, int start, int end)
                                                                   " UNION SELECT 'TABLE'"
                                                                   " UNION SELECT 'TABLESPACE'"
                                                                   " UNION SELECT 'TYPE'");
-
+       }
        else if (TailMatches4("GRANT|REVOKE", MatchAny, "ON", "ALL"))
                COMPLETE_WITH_LIST3("FUNCTIONS IN SCHEMA", "SEQUENCES IN SCHEMA",
                                                        "TABLES IN SCHEMA");
-
        else if (TailMatches4("GRANT|REVOKE", MatchAny, "ON", "FOREIGN"))
                COMPLETE_WITH_LIST2("DATA WRAPPER", "SERVER");
 
index 77b54c8a5e719b348ce0f3174481cdb9e2c82879..295507a0adc029ddb78a83b3c39a82befe53bf7d 100644 (file)
@@ -213,9 +213,10 @@ scram_build_verifier(const char *salt, int saltlen, int iterations,
 
        scram_ServerKey(salted_password, server_key);
 
-       /*
+       /*----------
         * The format is:
         * SCRAM-SHA-256$<iteration count>:<salt>$<StoredKey>:<ServerKey>
+        *----------
         */
        maxlen = strlen("SCRAM-SHA-256") + 1
                + 10 + 1                                                                /* iteration count */
index a6c5c02cebd76515313e4b1c9cf075e4815d2808..82524242e197363906257ee0a36e1765234bf6a3 100644 (file)
@@ -94,23 +94,21 @@ typedef FormData_pg_authid *Form_pg_authid;
  * The uppercase quantities will be replaced at initdb time with
  * user choices.
  *
- * If adding new default roles or changing the OIDs below, be sure to add or
- * update the #defines which follow as appropriate.
+ * The C code typically refers to these roles using the #define symbols,
+ * so be sure to keep those in sync with the DATA lines.
  * ----------------
  */
 DATA(insert OID = 10 ( "POSTGRES" t t t t t t t -1 _null_ _null_));
-DATA(insert OID = 3373 ( "pg_monitor" f t f f f f f -1 _null_ _null_));
-DATA(insert OID = 3374 ( "pg_read_all_settings" f t f f f f f -1 _null_ _null_));
-DATA(insert OID = 3375 ( "pg_read_all_stats" f t f f f f f -1 _null_ _null_));
-DATA(insert OID = 3377 ( "pg_stat_scan_tables" f t f f f f f -1 _null_ _null_));
-DATA(insert OID = 4200 ( "pg_signal_backend" f t f f f f f -1 _null_ _null_));
-
 #define BOOTSTRAP_SUPERUSERID                  10
-
+DATA(insert OID = 3373 ( "pg_monitor" f t f f f f f -1 _null_ _null_));
 #define DEFAULT_ROLE_MONITOR           3373
+DATA(insert OID = 3374 ( "pg_read_all_settings" f t f f f f f -1 _null_ _null_));
 #define DEFAULT_ROLE_READ_ALL_SETTINGS 3374
+DATA(insert OID = 3375 ( "pg_read_all_stats" f t f f f f f -1 _null_ _null_));
 #define DEFAULT_ROLE_READ_ALL_STATS    3375
+DATA(insert OID = 3377 ( "pg_stat_scan_tables" f t f f f f f -1 _null_ _null_));
 #define DEFAULT_ROLE_STAT_SCAN_TABLES  3377
+DATA(insert OID = 4200 ( "pg_signal_backend" f t f f f f f -1 _null_ _null_));
 #define DEFAULT_ROLE_SIGNAL_BACKENDID  4200
 
 #endif   /* PG_AUTHID_H */
index 9f4f152a116642dc8a6a8687cabf17052bf9790d..f08fb528a26df29b6053cc37c417b4d06588e50d 100644 (file)
@@ -51,15 +51,15 @@ typedef FormData_pg_subscription_rel *Form_pg_subscription_rel;
  *             substate constants
  * ----------------
  */
-#define                  SUBREL_STATE_INIT                             'i'             /* initializing (sublsn NULL) */
-#define                  SUBREL_STATE_DATASYNC                 'd'             /* data is being synchronized (sublsn NULL) */
-#define                  SUBREL_STATE_SYNCDONE                 's'             /* synchronization finished infront of apply (sublsn set) */
-#define                  SUBREL_STATE_READY                    'r'             /* ready (sublsn set) */
+#define SUBREL_STATE_INIT              'i'             /* initializing (sublsn NULL) */
+#define SUBREL_STATE_DATASYNC  'd'             /* data is being synchronized (sublsn NULL) */
+#define SUBREL_STATE_SYNCDONE  's'             /* synchronization finished in front of apply (sublsn set) */
+#define SUBREL_STATE_READY             'r'             /* ready (sublsn set) */
 
 /* These are never stored in the catalog, we only use them for IPC. */
-#define                  SUBREL_STATE_UNKNOWN                  '\0'    /* unknown state */
-#define                  SUBREL_STATE_SYNCWAIT                 'w'             /* waiting for sync */
-#define                  SUBREL_STATE_CATCHUP                  'c'             /* catching up with apply */
+#define SUBREL_STATE_UNKNOWN   '\0'    /* unknown state */
+#define SUBREL_STATE_SYNCWAIT  'w'             /* waiting for sync */
+#define SUBREL_STATE_CATCHUP   'c'             /* catching up with apply */
 
 typedef struct SubscriptionRelState
 {
index 0d8153c39d9e7248eb597bb3b90de5a39bb08cd9..9d0c15d4036c3c51a84484ecd26aacbe82e8a5ca 100644 (file)
 /* Tuple coming via logical replication. */
 typedef struct LogicalRepTupleData
 {
-       char   *values[MaxTupleAttributeNumber];        /* value in out function format or NULL if values is NULL */
-       bool    changed[MaxTupleAttributeNumber];       /* marker for changed/unchanged values */
+       /* column values in text format, or NULL for a null value: */
+       char   *values[MaxTupleAttributeNumber];
+       /* markers for changed/unchanged column values: */
+       bool    changed[MaxTupleAttributeNumber];
 } LogicalRepTupleData;
 
 typedef uint32 LogicalRepRelId;
index 34d049262f5f72a5d0af35d6da687b6f77ede763..335568b790a21f92a23defad34b5bae7ebfcabb8 100644 (file)
@@ -360,8 +360,8 @@ struct pg_conn
        char       *krbsrvname;         /* Kerberos service name */
 #endif
 
-       char       *target_session_attrs;       /* Type of connection to make
-                                                                                * Possible values any, read-write. */
+       /* Type of connection to make.  Possible values: any, read-write. */
+       char       *target_session_attrs;
 
        /* Optional file to write trace info to */
        FILE       *Pfdebug;