Commit c079673d authored by Tom Lane's avatar Tom Lane

Preventive maintenance in advance of pgindent run.

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