diff options
author | Pavan Deolasee | 2017-06-27 11:23:19 +0000 |
---|---|---|
committer | Pavan Deolasee | 2017-06-27 11:23:19 +0000 |
commit | e3e1c61e5ee9facf3b0a9bd6a0ce79da7011f9f2 (patch) | |
tree | cad4a0509c9ac54e260ba922b90b086804bad2d4 | |
parent | 668079ca5792a23fc0e220750bff51bb0558b4a5 (diff) | |
parent | 2710ccd782d0308a3fa1ab193531183148e9b626 (diff) |
Merge PG10 master branch into xl10devel
This commit merges PG10 branch upto commit
2710ccd782d0308a3fa1ab193531183148e9b626. Regression tests show no noteworthy
additional failures. This merge includes major pgindent work done with the
newer version of pgindent
1486 files changed, 11837 insertions, 11612 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 5ca902b6a2..0e95ed4b4d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,5 +1,6 @@ dnl aclocal.m4 m4_include([config/ac_func_accept_argtypes.m4]) +m4_include([config/ax_prog_perl_modules.m4]) m4_include([config/ax_pthread.m4]) m4_include([config/c-compiler.m4]) m4_include([config/c-library.m4]) diff --git a/config/ax_prog_perl_modules.m4 b/config/ax_prog_perl_modules.m4 new file mode 100644 index 0000000000..70b3230ebd --- /dev/null +++ b/config/ax_prog_perl_modules.m4 @@ -0,0 +1,77 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_prog_perl_modules.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_PERL_MODULES([MODULES], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# Checks to see if the given perl modules are available. If true the shell +# commands in ACTION-IF-TRUE are executed. If not the shell commands in +# ACTION-IF-FALSE are run. Note if $PERL is not set (for example by +# calling AC_CHECK_PROG, or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl) +# will be run. +# +# MODULES is a space separated list of module names. To check for a +# minimum version of a module, append the version number to the module +# name, separated by an equals sign. +# +# Example: +# +# AX_PROG_PERL_MODULES( Text::Wrap Net::LDAP=1.0.3, , +# AC_MSG_WARN(Need some Perl modules) +# +# LICENSE +# +# Copyright (c) 2009 Dean Povey <[email protected]> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES]) +AC_DEFUN([AX_PROG_PERL_MODULES],[dnl + +m4_define([ax_perl_modules]) +m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])), + [ + m4_append([ax_perl_modules], + [']m4_bpatsubst(ax_perl_module,=,[ ])[' ]) + ]) + +# Make sure we have perl +if test -z "$PERL"; then +AC_CHECK_PROG(PERL,perl,perl) +fi + +if test "x$PERL" != x; then + ax_perl_modules_failed=0 + for ax_perl_module in ax_perl_modules; do + AC_MSG_CHECKING(for perl module $ax_perl_module) + + # Would be nice to log result here, but can't rely on autoconf internals + $PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1 + if test $? -ne 0; then + AC_MSG_RESULT(no); + ax_perl_modules_failed=1 + else + AC_MSG_RESULT(ok); + fi + done + + # Run optional shell commands + if test "$ax_perl_modules_failed" = 0; then + : + $2 + else + : + $3 + fi +else + AC_MSG_WARN(could not find perl) +fi])dnl @@ -16288,6 +16288,84 @@ done if test -z "$PERL"; then as_fn_error $? "Perl not found" "$LINENO" 5 fi + # Check for necessary modules + + + + + + +# Make sure we have perl +if test -z "$PERL"; then +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_PERL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PERL"; then + ac_cv_prog_PERL="$PERL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PERL="perl" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PERL=$ac_cv_prog_PERL +if test -n "$PERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +$as_echo "$PERL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi + +if test "x$PERL" != x; then + ax_perl_modules_failed=0 + for ax_perl_module in 'IPC::Run' ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for perl module $ax_perl_module" >&5 +$as_echo_n "checking for perl module $ax_perl_module... " >&6; } + + # Would be nice to log result here, but can't rely on autoconf internals + $PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1 + if test $? -ne 0; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; + ax_perl_modules_failed=1 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; }; + fi + done + + # Run optional shell commands + if test "$ax_perl_modules_failed" = 0; then + : + + else + : + as_fn_error $? "Perl module IPC::Run is required to run TAP tests" "$LINENO" 5 + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find perl" >&5 +$as_echo "$as_me: WARNING: could not find perl" >&2;} +fi fi # Thread testing diff --git a/configure.in b/configure.in index e1b1780a5f..ab71577598 100644 --- a/configure.in +++ b/configure.in @@ -2142,6 +2142,9 @@ if test "$enable_tap_tests" = yes; then if test -z "$PERL"; then AC_MSG_ERROR([Perl not found]) fi + # Check for necessary modules + AX_PROG_PERL_MODULES(IPC::Run, , + AC_MSG_ERROR([Perl module IPC::Run is required to run TAP tests])) fi # Thread testing diff --git a/contrib/adminpack/adminpack.c b/contrib/adminpack/adminpack.c index 10338f951f..f3f8e7f1e4 100644 --- a/contrib/adminpack/adminpack.c +++ b/contrib/adminpack/adminpack.c @@ -74,7 +74,7 @@ convert_and_check_filename(text *arg, bool logAllowed) if (path_contains_parent_reference(filename)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("reference to parent directory (\"..\") not allowed")))); + (errmsg("reference to parent directory (\"..\") not allowed")))); /* * Allow absolute paths if within DataDir or Log_directory, even @@ -105,7 +105,7 @@ requireSuperuser(void) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("only superuser may access generic file functions")))); + (errmsg("only superuser may access generic file functions")))); } diff --git a/contrib/amcheck/verify_nbtree.c b/contrib/amcheck/verify_nbtree.c index c134e5f3b0..9ae83dc839 100644 --- a/contrib/amcheck/verify_nbtree.c +++ b/contrib/amcheck/verify_nbtree.c @@ -240,8 +240,8 @@ btree_index_checkable(Relation rel) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot access temporary tables of other sessions"), - errdetail("Index \"%s\" is associated with temporary relation.", - RelationGetRelationName(rel)))); + errdetail("Index \"%s\" is associated with temporary relation.", + RelationGetRelationName(rel)))); if (!IndexIsValid(rel->rd_index)) ereport(ERROR, @@ -411,12 +411,12 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), errmsg("block %u fell off the end of index \"%s\"", - current, RelationGetRelationName(state->rel)))); + current, RelationGetRelationName(state->rel)))); else ereport(DEBUG1, (errcode(ERRCODE_NO_DATA), errmsg("block %u of index \"%s\" ignored", - current, RelationGetRelationName(state->rel)))); + current, RelationGetRelationName(state->rel)))); goto nextpage; } else if (nextleveldown.leftmost == InvalidBlockNumber) @@ -433,14 +433,14 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level) if (!P_LEFTMOST(opaque)) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("block %u is not leftmost in index \"%s\"", - current, RelationGetRelationName(state->rel)))); + errmsg("block %u is not leftmost in index \"%s\"", + current, RelationGetRelationName(state->rel)))); if (level.istruerootlevel && !P_ISROOT(opaque)) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("block %u is not true root in index \"%s\"", - current, RelationGetRelationName(state->rel)))); + errmsg("block %u is not true root in index \"%s\"", + current, RelationGetRelationName(state->rel)))); } /* @@ -488,7 +488,7 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level) errmsg("left link/right link pair in index \"%s\" not in agreement", RelationGetRelationName(state->rel)), errdetail_internal("Block=%u left block=%u left link from block=%u.", - current, leftcurrent, opaque->btpo_prev))); + current, leftcurrent, opaque->btpo_prev))); /* Check level, which must be valid for non-ignorable page */ if (level.level != opaque->btpo.level) @@ -497,7 +497,7 @@ bt_check_level_from_leftmost(BtreeCheckState *state, BtreeLevel level) errmsg("leftmost down link for level points to block in index \"%s\" whose level is not one level down", RelationGetRelationName(state->rel)), errdetail_internal("Block pointed to=%u expected level=%u level in pointed to block=%u.", - current, level.level, opaque->btpo.level))); + current, level.level, opaque->btpo.level))); /* Verify invariants for page -- all important checks occur here */ bt_target_page_check(state); @@ -508,8 +508,8 @@ nextpage: if (current == leftcurrent || current == opaque->btpo_prev) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("circular link chain found in block %u of index \"%s\"", - current, RelationGetRelationName(state->rel)))); + errmsg("circular link chain found in block %u of index \"%s\"", + current, RelationGetRelationName(state->rel)))); leftcurrent = current; current = opaque->btpo_next; @@ -665,17 +665,17 @@ bt_target_page_check(BtreeCheckState *state) (errcode(ERRCODE_INDEX_CORRUPTED), errmsg("item order invariant violated for index \"%s\"", RelationGetRelationName(state->rel)), - errdetail_internal("Lower index tid=%s (points to %s tid=%s) " - "higher index tid=%s (points to %s tid=%s) " - "page lsn=%X/%X.", - itid, - P_ISLEAF(topaque) ? "heap" : "index", - htid, - nitid, - P_ISLEAF(topaque) ? "heap" : "index", - nhtid, - (uint32) (state->targetlsn >> 32), - (uint32) state->targetlsn))); + errdetail_internal("Lower index tid=%s (points to %s tid=%s) " + "higher index tid=%s (points to %s tid=%s) " + "page lsn=%X/%X.", + itid, + P_ISLEAF(topaque) ? "heap" : "index", + htid, + nitid, + P_ISLEAF(topaque) ? "heap" : "index", + nhtid, + (uint32) (state->targetlsn >> 32), + (uint32) state->targetlsn))); } /* @@ -824,7 +824,7 @@ bt_right_page_check_scankey(BtreeCheckState *state) ereport(DEBUG1, (errcode(ERRCODE_NO_DATA), errmsg("level %u leftmost page of index \"%s\" was found deleted or half dead", - opaque->btpo.level, RelationGetRelationName(state->rel)), + opaque->btpo.level, RelationGetRelationName(state->rel)), errdetail_internal("Deleted page found when building scankey from right sibling."))); /* Be slightly more pro-active in freeing this memory, just in case */ @@ -1053,7 +1053,7 @@ bt_downlink_check(BtreeCheckState *state, BlockNumber childblock, errmsg("down-link lower bound invariant violated for index \"%s\"", RelationGetRelationName(state->rel)), errdetail_internal("Parent block=%u child index tid=(%u,%u) parent page lsn=%X/%X.", - state->targetblock, childblock, offset, + state->targetblock, childblock, offset, (uint32) (state->targetlsn >> 32), (uint32) state->targetlsn))); } @@ -1228,21 +1228,21 @@ palloc_btree_page(BtreeCheckState *state, BlockNumber blocknum) if (P_ISLEAF(opaque) && !P_ISDELETED(opaque) && opaque->btpo.level != 0) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("invalid leaf page level %u for block %u in index \"%s\"", - opaque->btpo.level, blocknum, RelationGetRelationName(state->rel)))); + errmsg("invalid leaf page level %u for block %u in index \"%s\"", + opaque->btpo.level, blocknum, RelationGetRelationName(state->rel)))); if (blocknum != BTREE_METAPAGE && !P_ISLEAF(opaque) && !P_ISDELETED(opaque) && opaque->btpo.level == 0) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("invalid internal page level 0 for block %u in index \"%s\"", - opaque->btpo.level, RelationGetRelationName(state->rel)))); + errmsg("invalid internal page level 0 for block %u in index \"%s\"", + opaque->btpo.level, RelationGetRelationName(state->rel)))); if (!P_ISLEAF(opaque) && P_HAS_GARBAGE(opaque)) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("internal page block %u in index \"%s\" has garbage items", - blocknum, RelationGetRelationName(state->rel)))); + errmsg("internal page block %u in index \"%s\" has garbage items", + blocknum, RelationGetRelationName(state->rel)))); return page; } diff --git a/contrib/auth_delay/auth_delay.c b/contrib/auth_delay/auth_delay.c index e0604fb808..cd12a86b99 100644 --- a/contrib/auth_delay/auth_delay.c +++ b/contrib/auth_delay/auth_delay.c @@ -57,7 +57,7 @@ _PG_init(void) { /* Define custom GUC variables */ DefineCustomIntVariable("auth_delay.milliseconds", - "Milliseconds to delay before reporting authentication failure", + "Milliseconds to delay before reporting authentication failure", NULL, &auth_delay_milliseconds, 0, diff --git a/contrib/auto_explain/auto_explain.c b/contrib/auto_explain/auto_explain.c index 9213ffb6a4..edcb91542a 100644 --- a/contrib/auto_explain/auto_explain.c +++ b/contrib/auto_explain/auto_explain.c @@ -74,8 +74,8 @@ _PG_init(void) { /* Define custom GUC variables. */ DefineCustomIntVariable("auto_explain.log_min_duration", - "Sets the minimum execution time above which plans will be logged.", - "Zero prints all plans. -1 turns this feature off.", + "Sets the minimum execution time above which plans will be logged.", + "Zero prints all plans. -1 turns this feature off.", &auto_explain_log_min_duration, -1, -1, INT_MAX / 1000, @@ -120,7 +120,7 @@ _PG_init(void) DefineCustomBoolVariable("auto_explain.log_triggers", "Include trigger statistics in plans.", - "This has no effect unless log_analyze is also set.", + "This has no effect unless log_analyze is also set.", &auto_explain_log_triggers, false, PGC_SUSET, diff --git a/contrib/bloom/bloom.h b/contrib/bloom/bloom.h index 0cfe49aad8..f3df1af781 100644 --- a/contrib/bloom/bloom.h +++ b/contrib/bloom/bloom.h @@ -75,7 +75,7 @@ typedef BloomPageOpaqueData *BloomPageOpaque; /* Preserved page numbers */ #define BLOOM_METAPAGE_BLKNO (0) -#define BLOOM_HEAD_BLKNO (1) /* first data page */ +#define BLOOM_HEAD_BLKNO (1) /* first data page */ /* * We store Bloom signatures as arrays of uint16 words. @@ -101,8 +101,8 @@ typedef struct BloomOptions { int32 vl_len_; /* varlena header (do not touch directly!) */ int bloomLength; /* length of signature in words (not bits!) */ - int bitSize[INDEX_MAX_KEYS]; /* # of bits generated for - * each index key */ + int bitSize[INDEX_MAX_KEYS]; /* # of bits generated for each + * index key */ } BloomOptions; /* @@ -111,8 +111,8 @@ typedef struct BloomOptions */ typedef BlockNumber FreeBlockNumberArray[ MAXALIGN_DOWN( - BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(BloomPageOpaqueData)) - - MAXALIGN(sizeof(uint16) * 2 + sizeof(uint32) + sizeof(BloomOptions)) + BLCKSZ - SizeOfPageHeaderData - MAXALIGN(sizeof(BloomPageOpaqueData)) + - MAXALIGN(sizeof(uint16) * 2 + sizeof(uint32) + sizeof(BloomOptions)) ) / sizeof(BlockNumber) ]; diff --git a/contrib/bloom/blutils.c b/contrib/bloom/blutils.c index 00a65875b0..f2eda67e0a 100644 --- a/contrib/bloom/blutils.c +++ b/contrib/bloom/blutils.c @@ -75,7 +75,7 @@ _PG_init(void) bl_relopt_tab[i + 1].optname = MemoryContextStrdup(TopMemoryContext, buf); bl_relopt_tab[i + 1].opttype = RELOPT_TYPE_INT; - bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) +sizeof(int) * i; + bl_relopt_tab[i + 1].offset = offsetof(BloomOptions, bitSize[0]) + sizeof(int) * i; } } diff --git a/contrib/bloom/blvacuum.c b/contrib/bloom/blvacuum.c index 04abd0f6b6..2e060871b6 100644 --- a/contrib/bloom/blvacuum.c +++ b/contrib/bloom/blvacuum.c @@ -84,7 +84,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, */ itup = itupPtr = BloomPageGetTuple(&state, page, FirstOffsetNumber); itupEnd = BloomPageGetTuple(&state, page, - OffsetNumberNext(BloomPageGetMaxOffset(page))); + OffsetNumberNext(BloomPageGetMaxOffset(page))); while (itup < itupEnd) { /* Do we have to delete this tuple? */ @@ -108,7 +108,7 @@ blbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, /* Assert that we counted correctly */ Assert(itupPtr == BloomPageGetTuple(&state, page, - OffsetNumberNext(BloomPageGetMaxOffset(page)))); + OffsetNumberNext(BloomPageGetMaxOffset(page)))); /* * Add page to new notFullPage list if we will not mark page as diff --git a/contrib/btree_gin/btree_gin.c b/contrib/btree_gin/btree_gin.c index 6f0c752b2e..2473f79ca1 100644 --- a/contrib/btree_gin/btree_gin.c +++ b/contrib/btree_gin/btree_gin.c @@ -115,8 +115,8 @@ gin_btree_compare_prefix(FunctionCallInfo fcinfo) data->typecmp, fcinfo->flinfo, PG_GET_COLLATION(), - (data->strategy == BTLessStrategyNumber || - data->strategy == BTLessEqualStrategyNumber) + (data->strategy == BTLessStrategyNumber || + data->strategy == BTLessEqualStrategyNumber) ? data->datum : a, b)); diff --git a/contrib/btree_gist/btree_cash.c b/contrib/btree_gist/btree_cash.c index 1116ca084f..81131af4dc 100644 --- a/contrib/btree_gist/btree_cash.c +++ b/contrib/btree_gist/btree_cash.c @@ -203,8 +203,8 @@ Datum gbt_cash_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_date.c b/contrib/btree_gist/btree_date.c index 28c7c2ac86..992ce57507 100644 --- a/contrib/btree_gist/btree_date.c +++ b/contrib/btree_gist/btree_date.c @@ -87,8 +87,8 @@ gdb_date_dist(const void *a, const void *b, FmgrInfo *flinfo) { /* we assume the difference can't overflow */ Datum diff = DirectFunctionCall2(date_mi, - DateADTGetDatum(*((const DateADT *) a)), - DateADTGetDatum(*((const DateADT *) b))); + DateADTGetDatum(*((const DateADT *) a)), + DateADTGetDatum(*((const DateADT *) b))); return (float8) Abs(DatumGetInt32(diff)); } @@ -210,14 +210,14 @@ gbt_date_penalty(PG_FUNCTION_ARGS) diff = DatumGetInt32(DirectFunctionCall2( date_mi, DateADTGetDatum(newentry->upper), - DateADTGetDatum(origentry->upper))); + DateADTGetDatum(origentry->upper))); res = Max(diff, 0); diff = DatumGetInt32(DirectFunctionCall2( date_mi, - DateADTGetDatum(origentry->lower), - DateADTGetDatum(newentry->lower))); + DateADTGetDatum(origentry->lower), + DateADTGetDatum(newentry->lower))); res += Max(diff, 0); @@ -227,8 +227,8 @@ gbt_date_penalty(PG_FUNCTION_ARGS) { diff = DatumGetInt32(DirectFunctionCall2( date_mi, - DateADTGetDatum(origentry->upper), - DateADTGetDatum(origentry->lower))); + DateADTGetDatum(origentry->upper), + DateADTGetDatum(origentry->lower))); *result += FLT_MIN; *result += (float) (res / ((double) (res + diff))); *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1)); @@ -242,8 +242,8 @@ Datum gbt_date_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_enum.c b/contrib/btree_gist/btree_enum.c index 8bbadfe860..0ec7d8bf88 100644 --- a/contrib/btree_gist/btree_enum.c +++ b/contrib/btree_gist/btree_enum.c @@ -169,8 +169,8 @@ Datum gbt_enum_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_float4.c b/contrib/btree_gist/btree_float4.c index fe6993c226..6b20f44a48 100644 --- a/contrib/btree_gist/btree_float4.c +++ b/contrib/btree_gist/btree_float4.c @@ -196,8 +196,8 @@ Datum gbt_float4_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_float8.c b/contrib/btree_gist/btree_float8.c index 13153d811f..ee114cbe42 100644 --- a/contrib/btree_gist/btree_float8.c +++ b/contrib/btree_gist/btree_float8.c @@ -203,8 +203,8 @@ Datum gbt_float8_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_inet.c b/contrib/btree_gist/btree_inet.c index e1561b37b7..b5b593f77f 100644 --- a/contrib/btree_gist/btree_inet.c +++ b/contrib/btree_gist/btree_inet.c @@ -133,7 +133,7 @@ gbt_inet_consistent(PG_FUNCTION_ARGS) key.upper = (GBT_NUMKEY *) &kkk->upper; PG_RETURN_BOOL(gbt_num_consistent(&key, (void *) &query, - &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)); + &strategy, GIST_LEAF(entry), &tinfo, fcinfo->flinfo)); } @@ -165,8 +165,8 @@ Datum gbt_inet_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_int2.c b/contrib/btree_gist/btree_int2.c index 0a4498a693..f343b8615f 100644 --- a/contrib/btree_gist/btree_int2.c +++ b/contrib/btree_gist/btree_int2.c @@ -202,8 +202,8 @@ Datum gbt_int2_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_int4.c b/contrib/btree_gist/btree_int4.c index b29cbc81a3..35bb442437 100644 --- a/contrib/btree_gist/btree_int4.c +++ b/contrib/btree_gist/btree_int4.c @@ -203,8 +203,8 @@ Datum gbt_int4_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_int8.c b/contrib/btree_gist/btree_int8.c index df1f5338c8..91f2d032d1 100644 --- a/contrib/btree_gist/btree_int8.c +++ b/contrib/btree_gist/btree_int8.c @@ -203,8 +203,8 @@ Datum gbt_int8_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_interval.c b/contrib/btree_gist/btree_interval.c index e4dd9e4238..61ab478c42 100644 --- a/contrib/btree_gist/btree_interval.c +++ b/contrib/btree_gist/btree_interval.c @@ -285,8 +285,8 @@ Datum gbt_intv_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_macaddr.c b/contrib/btree_gist/btree_macaddr.c index d530b4e878..0486c35730 100644 --- a/contrib/btree_gist/btree_macaddr.c +++ b/contrib/btree_gist/btree_macaddr.c @@ -182,8 +182,8 @@ Datum gbt_macad_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_macaddr8.c b/contrib/btree_gist/btree_macaddr8.c index 96afbcdead..30a1391d73 100644 --- a/contrib/btree_gist/btree_macaddr8.c +++ b/contrib/btree_gist/btree_macaddr8.c @@ -182,8 +182,8 @@ Datum gbt_macad8_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_oid.c b/contrib/btree_gist/btree_oid.c index e0d6f2adf1..00e701903f 100644 --- a/contrib/btree_gist/btree_oid.c +++ b/contrib/btree_gist/btree_oid.c @@ -203,8 +203,8 @@ Datum gbt_oid_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_time.c b/contrib/btree_gist/btree_time.c index 5eec8323f5..bb239d4986 100644 --- a/contrib/btree_gist/btree_time.c +++ b/contrib/btree_gist/btree_time.c @@ -289,15 +289,15 @@ gbt_time_penalty(PG_FUNCTION_ARGS) intr = DatumGetIntervalP(DirectFunctionCall2( time_mi_time, - TimeADTGetDatumFast(newentry->upper), - TimeADTGetDatumFast(origentry->upper))); + TimeADTGetDatumFast(newentry->upper), + TimeADTGetDatumFast(origentry->upper))); res = INTERVAL_TO_SEC(intr); res = Max(res, 0); intr = DatumGetIntervalP(DirectFunctionCall2( time_mi_time, - TimeADTGetDatumFast(origentry->lower), - TimeADTGetDatumFast(newentry->lower))); + TimeADTGetDatumFast(origentry->lower), + TimeADTGetDatumFast(newentry->lower))); res2 = INTERVAL_TO_SEC(intr); res2 = Max(res2, 0); @@ -309,8 +309,8 @@ gbt_time_penalty(PG_FUNCTION_ARGS) { intr = DatumGetIntervalP(DirectFunctionCall2( time_mi_time, - TimeADTGetDatumFast(origentry->upper), - TimeADTGetDatumFast(origentry->lower))); + TimeADTGetDatumFast(origentry->upper), + TimeADTGetDatumFast(origentry->lower))); *result += FLT_MIN; *result += (float) (res / (res + INTERVAL_TO_SEC(intr))); *result *= (FLT_MAX / (((GISTENTRY *) PG_GETARG_POINTER(0))->rel->rd_att->natts + 1)); @@ -324,8 +324,8 @@ Datum gbt_time_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_ts.c b/contrib/btree_gist/btree_ts.c index 592466c948..1582cff102 100644 --- a/contrib/btree_gist/btree_ts.c +++ b/contrib/btree_gist/btree_ts.c @@ -387,8 +387,8 @@ Datum gbt_ts_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/btree_gist/btree_utils_num.h b/contrib/btree_gist/btree_utils_num.h index 8aab19396c..17561fa9e4 100644 --- a/contrib/btree_gist/btree_utils_num.h +++ b/contrib/btree_gist/btree_utils_num.h @@ -42,13 +42,13 @@ typedef struct /* Methods */ - bool (*f_gt) (const void *, const void *, FmgrInfo *); /* greater than */ - bool (*f_ge) (const void *, const void *, FmgrInfo *); /* greater or equal */ - bool (*f_eq) (const void *, const void *, FmgrInfo *); /* equal */ - bool (*f_le) (const void *, const void *, FmgrInfo *); /* less or equal */ - bool (*f_lt) (const void *, const void *, FmgrInfo *); /* less than */ - int (*f_cmp) (const void *, const void *, FmgrInfo *); /* key compare function */ - float8 (*f_dist) (const void *, const void *, FmgrInfo *); /* key distance function */ + bool (*f_gt) (const void *, const void *, FmgrInfo *); /* greater than */ + bool (*f_ge) (const void *, const void *, FmgrInfo *); /* greater or equal */ + bool (*f_eq) (const void *, const void *, FmgrInfo *); /* equal */ + bool (*f_le) (const void *, const void *, FmgrInfo *); /* less or equal */ + bool (*f_lt) (const void *, const void *, FmgrInfo *); /* less than */ + int (*f_cmp) (const void *, const void *, FmgrInfo *); /* key compare function */ + float8 (*f_dist) (const void *, const void *, FmgrInfo *); /* key distance function */ } gbtree_ninfo; diff --git a/contrib/btree_gist/btree_utils_var.c b/contrib/btree_gist/btree_utils_var.c index 3648adccef..2c636ad2fa 100644 --- a/contrib/btree_gist/btree_utils_var.c +++ b/contrib/btree_gist/btree_utils_var.c @@ -72,7 +72,7 @@ gbt_var_key_readable(const GBT_VARKEY *k) * Create a leaf-entry to store in the index, from a single Datum. */ static GBT_VARKEY * -gbt_var_key_from_datum(const struct varlena * u) +gbt_var_key_from_datum(const struct varlena *u) { int32 lowersize = VARSIZE(u); GBT_VARKEY *r; @@ -402,8 +402,8 @@ gbt_var_penalty(float *res, const GISTENTRY *o, const GISTENTRY *n, *res = 0.0; else if (!(((*tinfo->f_cmp) (nk.lower, ok.lower, collation, flinfo) >= 0 || gbt_bytea_pf_match(ok.lower, nk.lower, tinfo)) && - ((*tinfo->f_cmp) (nk.upper, ok.upper, collation, flinfo) <= 0 || - gbt_bytea_pf_match(ok.upper, nk.upper, tinfo)))) + ((*tinfo->f_cmp) (nk.upper, ok.upper, collation, flinfo) <= 0 || + gbt_bytea_pf_match(ok.upper, nk.upper, tinfo)))) { Datum d = PointerGetDatum(0); double dres; @@ -488,7 +488,7 @@ gbt_var_picksplit(const GistEntryVector *entryvec, GIST_SPLITVEC *v, cur = (char *) DatumGetPointer(entryvec->vector[i].key); ro = gbt_var_key_readable((GBT_VARKEY *) cur); - if (ro.lower == ro.upper) /* leaf */ + if (ro.lower == ro.upper) /* leaf */ { sv[svcntr] = gbt_var_leaf2node((GBT_VARKEY *) cur, tinfo, flinfo); arr[i].t = sv[svcntr]; diff --git a/contrib/btree_gist/btree_utils_var.h b/contrib/btree_gist/btree_utils_var.h index 04a356276b..15d847c139 100644 --- a/contrib/btree_gist/btree_utils_var.h +++ b/contrib/btree_gist/btree_utils_var.h @@ -40,7 +40,7 @@ typedef struct bool (*f_le) (const void *, const void *, Oid, FmgrInfo *); /* less equal */ bool (*f_lt) (const void *, const void *, Oid, FmgrInfo *); /* less than */ int32 (*f_cmp) (const void *, const void *, Oid, FmgrInfo *); /* compare */ - GBT_VARKEY *(*f_l2n) (GBT_VARKEY *, FmgrInfo *flinfo); /* convert leaf to node */ + GBT_VARKEY *(*f_l2n) (GBT_VARKEY *, FmgrInfo *flinfo); /* convert leaf to node */ } gbtree_vinfo; diff --git a/contrib/btree_gist/btree_uuid.c b/contrib/btree_gist/btree_uuid.c index e67b8cc989..ecf357d662 100644 --- a/contrib/btree_gist/btree_uuid.c +++ b/contrib/btree_gist/btree_uuid.c @@ -150,7 +150,7 @@ gbt_uuid_consistent(PG_FUNCTION_ARGS) PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) query, &strategy, - GIST_LEAF(entry), &tinfo, fcinfo->flinfo) + GIST_LEAF(entry), &tinfo, fcinfo->flinfo) ); } @@ -171,7 +171,7 @@ static double uuid_2_double(const pg_uuid_t *u) { uint64 uu[2]; - const double two64 = 18446744073709551616.0; /* 2^64 */ + const double two64 = 18446744073709551616.0; /* 2^64 */ /* Source data may not be suitably aligned, so copy */ memcpy(uu, u->data, UUID_LEN); @@ -220,8 +220,8 @@ Datum gbt_uuid_picksplit(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(gbt_num_picksplit( - (GistEntryVector *) PG_GETARG_POINTER(0), - (GIST_SPLITVEC *) PG_GETARG_POINTER(1), + (GistEntryVector *) PG_GETARG_POINTER(0), + (GIST_SPLITVEC *) PG_GETARG_POINTER(1), &tinfo, fcinfo->flinfo )); } diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index 2bb2ed029d..149558c763 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -483,7 +483,7 @@ g_cube_picksplit(PG_FUNCTION_ARGS) union_d = cube_union_v0(datum_alpha, datum_beta); rt_cube_size(union_d, &size_union); inter_d = DatumGetNDBOX(DirectFunctionCall2(cube_inter, - entryvec->vector[i].key, entryvec->vector[j].key)); + entryvec->vector[i].key, entryvec->vector[j].key)); rt_cube_size(inter_d, &size_inter); size_waste = size_union - size_inter; @@ -1354,15 +1354,15 @@ g_cube_distance(PG_FUNCTION_ARGS) { case CubeKNNDistanceTaxicab: retval = DatumGetFloat8(DirectFunctionCall2(distance_taxicab, - PointerGetDatum(cube), PointerGetDatum(query))); + PointerGetDatum(cube), PointerGetDatum(query))); break; case CubeKNNDistanceEuclid: retval = DatumGetFloat8(DirectFunctionCall2(cube_distance, - PointerGetDatum(cube), PointerGetDatum(query))); + PointerGetDatum(cube), PointerGetDatum(query))); break; case CubeKNNDistanceChebyshev: retval = DatumGetFloat8(DirectFunctionCall2(distance_chebyshev, - PointerGetDatum(cube), PointerGetDatum(query))); + PointerGetDatum(cube), PointerGetDatum(query))); break; default: elog(ERROR, "unrecognized cube strategy number: %d", strategy); diff --git a/contrib/cube/cubedata.h b/contrib/cube/cubedata.h index af02464178..6e6ddfd3d7 100644 --- a/contrib/cube/cubedata.h +++ b/contrib/cube/cubedata.h @@ -54,10 +54,10 @@ typedef struct NDBOX #define PG_RETURN_NDBOX(x) PG_RETURN_POINTER(x) /* GiST operator strategy numbers */ -#define CubeKNNDistanceCoord 15 /* ~> */ -#define CubeKNNDistanceTaxicab 16 /* <#> */ -#define CubeKNNDistanceEuclid 17 /* <-> */ -#define CubeKNNDistanceChebyshev 18 /* <=> */ +#define CubeKNNDistanceCoord 15 /* ~> */ +#define CubeKNNDistanceTaxicab 16 /* <#> */ +#define CubeKNNDistanceEuclid 17 /* <-> */ +#define CubeKNNDistanceChebyshev 18 /* <=> */ /* in cubescan.l */ extern int cube_yylex(void); diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index a6a3c09ff8..81136b131c 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -67,7 +67,7 @@ typedef struct remoteConn { PGconn *conn; /* Hold the remote connection */ int openCursorCount; /* The number of open cursors */ - bool newXactForCursor; /* Opened a transaction for a cursor */ + bool newXactForCursor; /* Opened a transaction for a cursor */ } remoteConn; typedef struct storeInfo @@ -179,7 +179,7 @@ dblink_conn_not_avail(const char *conname) static void dblink_get_conn(char *conname_or_str, - PGconn *volatile * conn_p, char **conname_p, volatile bool *freeconn_p) + PGconn *volatile *conn_p, char **conname_p, volatile bool *freeconn_p) { remoteConn *rconn = getConnectionByName(conname_or_str); PGconn *conn; @@ -207,9 +207,9 @@ dblink_get_conn(char *conname_or_str, PQfinish(conn); ereport(ERROR, - (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), - errmsg("could not establish connection"), - errdetail_internal("%s", msg))); + (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), + errmsg("could not establish connection"), + errdetail_internal("%s", msg))); } dblink_security_check(conn, rconn); if (PQclientEncoding(conn) != GetDatabaseEncoding()) @@ -723,7 +723,7 @@ dblink_record_internal(FunctionCallInfo fcinfo, bool is_async) /* shouldn't happen */ elog(ERROR, "wrong number of arguments"); } - else /* is_async */ + else /* is_async */ { /* get async result */ conname = text_to_cstring(PG_GETARG_TEXT_PP(0)); @@ -869,8 +869,8 @@ materializeResult(FunctionCallInfo fcinfo, PGconn *conn, PGresult *res) /* failed to determine actual type of RECORD */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("function returning record called in context " - "that cannot accept type record"))); + errmsg("function returning record called in context " + "that cannot accept type record"))); break; default: /* result type isn't composite */ @@ -909,7 +909,7 @@ materializeResult(FunctionCallInfo fcinfo, PGconn *conn, PGresult *res) nestlevel = applyRemoteGucs(conn); oldcontext = MemoryContextSwitchTo( - rsinfo->econtext->ecxt_per_query_memory); + rsinfo->econtext->ecxt_per_query_memory); tupstore = tuplestore_begin_heap(true, false, work_mem); rsinfo->setResult = tupstore; rsinfo->setDesc = tupdesc; @@ -1036,7 +1036,7 @@ materializeQueryResult(FunctionCallInfo fcinfo, attinmeta = TupleDescGetAttInMetadata(tupdesc); oldcontext = MemoryContextSwitchTo( - rsinfo->econtext->ecxt_per_query_memory); + rsinfo->econtext->ecxt_per_query_memory); tupstore = tuplestore_begin_heap(true, false, work_mem); rsinfo->setResult = tupstore; rsinfo->setDesc = tupdesc; @@ -1098,7 +1098,7 @@ storeQueryResult(volatile storeInfo *sinfo, PGconn *conn, const char *sql) if (!PQsendQuery(conn, sql)) elog(ERROR, "could not send query: %s", pchomp(PQerrorMessage(conn))); - if (!PQsetSingleRowMode(conn)) /* shouldn't fail */ + if (!PQsetSingleRowMode(conn)) /* shouldn't fail */ elog(ERROR, "failed to set single-row mode for dblink query"); for (;;) @@ -1460,8 +1460,8 @@ dblink_exec(PG_FUNCTION_ARGS) { PQclear(res); ereport(ERROR, - (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), - errmsg("statement returning results not allowed"))); + (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), + errmsg("statement returning results not allowed"))); } } PG_CATCH(); @@ -1980,7 +1980,7 @@ dblink_fdw_validator(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_FDW_OUT_OF_MEMORY), errmsg("out of memory"), - errdetail("could not get libpq's default connection options"))); + errdetail("could not get libpq's default connection options"))); } /* Validate each supplied option. */ @@ -2179,7 +2179,7 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals appendStringInfoChar(&buf, ','); appendStringInfoString(&buf, - quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname))); + quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname))); needComma = true; } @@ -2242,7 +2242,7 @@ get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals appendStringInfoString(&buf, " AND "); appendStringInfoString(&buf, - quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname))); + quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname))); if (tgt_pkattvals[i] != NULL) appendStringInfo(&buf, " = %s", @@ -2296,7 +2296,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals appendStringInfoString(&buf, ", "); appendStringInfo(&buf, "%s = ", - quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname))); + quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname))); key = get_attnum_pk_pos(pkattnums, pknumatts, i); @@ -2325,7 +2325,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals appendStringInfoString(&buf, " AND "); appendStringInfoString(&buf, - quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname))); + quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname))); val = tgt_pkattvals[i]; @@ -2351,7 +2351,7 @@ quote_ident_cstr(char *rawstr) rawstr_text = cstring_to_text(rawstr); result_text = DatumGetTextPP(DirectFunctionCall1(quote_ident, - PointerGetDatum(rawstr_text))); + PointerGetDatum(rawstr_text))); result = text_to_cstring(result_text); return result; @@ -2416,7 +2416,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk appendStringInfoString(&buf, "NULL"); else appendStringInfoString(&buf, - quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname))); + quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname))); } appendStringInfo(&buf, " FROM %s WHERE ", relname); @@ -2429,7 +2429,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk appendStringInfoString(&buf, " AND "); appendStringInfoString(&buf, - quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname))); + quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname))); if (src_pkattvals[i] != NULL) appendStringInfo(&buf, " = %s", @@ -2619,10 +2619,10 @@ dblink_security_check(PGconn *conn, remoteConn *rconn) pfree(rconn); ereport(ERROR, - (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), - errmsg("password is required"), - errdetail("Non-superuser cannot connect if the server does not request a password."), - errhint("Target server's authentication method must be changed."))); + (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), + errmsg("password is required"), + errdetail("Non-superuser cannot connect if the server does not request a password."), + errhint("Target server's authentication method must be changed."))); } } } @@ -2661,9 +2661,9 @@ dblink_connstr_check(const char *connstr) if (!connstr_gives_password) ereport(ERROR, - (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), - errmsg("password is required"), - errdetail("Non-superusers must provide a password in the connection string."))); + (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), + errmsg("password is required"), + errdetail("Non-superusers must provide a password in the connection string."))); } } @@ -2724,8 +2724,8 @@ dblink_res_error(PGconn *conn, const char *conname, PGresult *res, message_detail ? errdetail_internal("%s", message_detail) : 0, message_hint ? errhint("%s", message_hint) : 0, message_context ? errcontext("%s", message_context) : 0, - errcontext("Error occurred on dblink connection named \"%s\": %s.", - dblink_context_conname, dblink_context_msg))); + errcontext("Error occurred on dblink connection named \"%s\": %s.", + dblink_context_conname, dblink_context_msg))); } /* @@ -2760,7 +2760,7 @@ get_connect_string(const char *servername) ereport(ERROR, (errcode(ERRCODE_FDW_OUT_OF_MEMORY), errmsg("out of memory"), - errdetail("could not get libpq's default connection options"))); + errdetail("could not get libpq's default connection options"))); } /* first gather the server connstr options */ diff --git a/contrib/earthdistance/earthdistance.c b/contrib/earthdistance/earthdistance.c index 6ad6d87ce8..e6ebfd11ad 100644 --- a/contrib/earthdistance/earthdistance.c +++ b/contrib/earthdistance/earthdistance.c @@ -69,7 +69,7 @@ geo_distance_internal(Point *pt1, Point *pt2) longdiff = TWO_PI - longdiff; sino = sqrt(sin(fabs(lat1 - lat2) / 2.) * sin(fabs(lat1 - lat2) / 2.) + - cos(lat1) * cos(lat2) * sin(longdiff / 2.) * sin(longdiff / 2.)); + cos(lat1) * cos(lat2) * sin(longdiff / 2.) * sin(longdiff / 2.)); if (sino > 1.) sino = 1.; diff --git a/contrib/file_fdw/file_fdw.c b/contrib/file_fdw/file_fdw.c index 277639f6e9..2396bd442f 100644 --- a/contrib/file_fdw/file_fdw.c +++ b/contrib/file_fdw/file_fdw.c @@ -250,7 +250,7 @@ file_fdw_validator(PG_FUNCTION_ARGS) buf.len > 0 ? errhint("Valid options in this context are: %s", buf.data) - : errhint("There are no valid options in this context."))); + : errhint("There are no valid options in this context."))); } /* @@ -544,13 +544,13 @@ fileGetForeignPaths(PlannerInfo *root, */ add_path(baserel, (Path *) create_foreignscan_path(root, baserel, - NULL, /* default pathtarget */ + NULL, /* default pathtarget */ baserel->rows, startup_cost, total_cost, - NIL, /* no pathkeys */ - NULL, /* no outer rel either */ - NULL, /* no extra plan */ + NIL, /* no pathkeys */ + NULL, /* no outer rel either */ + NULL, /* no extra plan */ coptions)); /* diff --git a/contrib/fuzzystrmatch/dmetaphone.c b/contrib/fuzzystrmatch/dmetaphone.c index 4e89983afd..918ee0d90e 100644 --- a/contrib/fuzzystrmatch/dmetaphone.c +++ b/contrib/fuzzystrmatch/dmetaphone.c @@ -111,7 +111,7 @@ The remaining code is authored by Andrew Dunstan <[email protected]> and #include <string.h> #include <stdarg.h> -#endif /* DMETAPHONE_MAIN */ +#endif /* DMETAPHONE_MAIN */ #include <assert.h> #include <ctype.h> @@ -197,7 +197,7 @@ dmetaphone_alt(PG_FUNCTION_ARGS) * in a case like this. */ -#define META_FREE(x) ((void)true) /* pfree((x)) */ +#define META_FREE(x) ((void)true) /* pfree((x)) */ #else /* not defined DMETAPHONE_MAIN */ /* use the standard malloc library when not running in PostgreSQL */ @@ -209,7 +209,7 @@ dmetaphone_alt(PG_FUNCTION_ARGS) (v = (t*)realloc((v),((n)*sizeof(t)))) #define META_FREE(x) free((x)) -#endif /* defined DMETAPHONE_MAIN */ +#endif /* defined DMETAPHONE_MAIN */ @@ -977,7 +977,7 @@ DoubleMetaphone(char *str, char **codes) } } - if (GetAt(original, current + 1) == 'J') /* it could happen! */ + if (GetAt(original, current + 1) == 'J') /* it could happen! */ current += 2; else current += 1; diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c index f1bb7bca73..ce58a6a7fc 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.c +++ b/contrib/fuzzystrmatch/fuzzystrmatch.c @@ -389,7 +389,7 @@ _metaphone(char *word, /* IN */ /*-- Allocate memory for our phoned_phrase --*/ if (max_phonemes == 0) { /* Assume largest possible */ - *phoned_word = palloc(sizeof(char) * strlen(word) +1); + *phoned_word = palloc(sizeof(char) * strlen(word) + 1); } else { @@ -722,7 +722,7 @@ _metaphone(char *word, /* IN */ End_Phoned_Word; return (META_SUCCESS); -} /* END metaphone */ +} /* END metaphone */ /* diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h index 6bab08b7de..c4862a82e1 100644 --- a/contrib/hstore/hstore.h +++ b/contrib/hstore/hstore.h @@ -181,7 +181,7 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs); #define HStoreExistsStrategyNumber 9 #define HStoreExistsAnyStrategyNumber 10 #define HStoreExistsAllStrategyNumber 11 -#define HStoreOldContainsStrategyNumber 13 /* backwards compatibility */ +#define HStoreOldContainsStrategyNumber 13 /* backwards compatibility */ /* * defining HSTORE_POLLUTE_NAMESPACE=0 will prevent use of old function names; @@ -202,4 +202,4 @@ extern Pairs *hstoreArrayToPairs(ArrayType *a, int *npairs); extern int no_such_variable #endif -#endif /* __HSTORE_H__ */ +#endif /* __HSTORE_H__ */ diff --git a/contrib/hstore/hstore_io.c b/contrib/hstore/hstore_io.c index 191fc48c7a..b25eb23df5 100644 --- a/contrib/hstore/hstore_io.c +++ b/contrib/hstore/hstore_io.c @@ -443,8 +443,8 @@ hstore_recv(PG_FUNCTION_ARGS) if (pcount < 0 || pcount > MaxAllocSize / sizeof(Pairs)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("number of pairs (%d) exceeds the maximum allowed (%d)", - pcount, (int) (MaxAllocSize / sizeof(Pairs))))); + errmsg("number of pairs (%d) exceeds the maximum allowed (%d)", + pcount, (int) (MaxAllocSize / sizeof(Pairs))))); pairs = palloc(pcount * sizeof(Pairs)); for (i = 0; i < pcount; ++i) @@ -562,8 +562,8 @@ hstore_from_arrays(PG_FUNCTION_ARGS) if (key_count > MaxAllocSize / sizeof(Pairs)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("number of pairs (%d) exceeds the maximum allowed (%d)", - key_count, (int) (MaxAllocSize / sizeof(Pairs))))); + errmsg("number of pairs (%d) exceeds the maximum allowed (%d)", + key_count, (int) (MaxAllocSize / sizeof(Pairs))))); /* value_array might be NULL */ @@ -693,8 +693,8 @@ hstore_from_array(PG_FUNCTION_ARGS) if (count > MaxAllocSize / sizeof(Pairs)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("number of pairs (%d) exceeds the maximum allowed (%d)", - count, (int) (MaxAllocSize / sizeof(Pairs))))); + errmsg("number of pairs (%d) exceeds the maximum allowed (%d)", + count, (int) (MaxAllocSize / sizeof(Pairs))))); pairs = palloc(count * sizeof(Pairs)); @@ -829,7 +829,7 @@ hstore_from_record(PG_FUNCTION_ARGS) my_extra->ncolumns = ncolumns; } - Assert(ncolumns <= MaxTupleAttributeNumber); /* thus, no overflow */ + Assert(ncolumns <= MaxTupleAttributeNumber); /* thus, no overflow */ pairs = palloc(ncolumns * sizeof(Pairs)); if (rec) @@ -1441,8 +1441,8 @@ hstore_to_jsonb_loose(PG_FUNCTION_ARGS) { val.type = jbvNumeric; val.val.numeric = DatumGetNumeric( - DirectFunctionCall3(numeric_in, - CStringGetDatum(tmp.data), 0, -1)); + DirectFunctionCall3(numeric_in, + CStringGetDatum(tmp.data), 0, -1)); } else { diff --git a/contrib/hstore/hstore_op.c b/contrib/hstore/hstore_op.c index 1e2dc881c1..612be23a74 100644 --- a/contrib/hstore/hstore_op.c +++ b/contrib/hstore/hstore_op.c @@ -101,8 +101,8 @@ hstoreArrayToPairs(ArrayType *a, int *npairs) if (key_count > MaxAllocSize / sizeof(Pairs)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("number of pairs (%d) exceeds the maximum allowed (%d)", - key_count, (int) (MaxAllocSize / sizeof(Pairs))))); + errmsg("number of pairs (%d) exceeds the maximum allowed (%d)", + key_count, (int) (MaxAllocSize / sizeof(Pairs))))); key_pairs = palloc(sizeof(Pairs) * key_count); @@ -181,7 +181,7 @@ hstore_exists_any(PG_FUNCTION_ARGS) for (i = 0; i < nkeys; i++) { int idx = hstoreFindKey(hs, &lowbound, - key_pairs[i].key, key_pairs[i].keylen); + key_pairs[i].key, key_pairs[i].keylen); if (idx >= 0) { @@ -215,7 +215,7 @@ hstore_exists_all(PG_FUNCTION_ARGS) for (i = 0; i < nkeys; i++) { int idx = hstoreFindKey(hs, &lowbound, - key_pairs[i].key, key_pairs[i].keylen); + key_pairs[i].key, key_pairs[i].keylen); if (idx < 0) { @@ -546,8 +546,8 @@ hstore_concat(PG_FUNCTION_ARGS) if (difference >= 0) { HS_COPYITEM(ed, bufd, pd, - HSTORE_KEY(es2, ps2, s2idx), HSTORE_KEYLEN(es2, s2idx), - HSTORE_VALLEN(es2, s2idx), HSTORE_VALISNULL(es2, s2idx)); + HSTORE_KEY(es2, ps2, s2idx), HSTORE_KEYLEN(es2, s2idx), + HSTORE_VALLEN(es2, s2idx), HSTORE_VALISNULL(es2, s2idx)); ++s2idx; if (difference == 0) ++s1idx; @@ -555,8 +555,8 @@ hstore_concat(PG_FUNCTION_ARGS) else { HS_COPYITEM(ed, bufd, pd, - HSTORE_KEY(es1, ps1, s1idx), HSTORE_KEYLEN(es1, s1idx), - HSTORE_VALLEN(es1, s1idx), HSTORE_VALISNULL(es1, s1idx)); + HSTORE_KEY(es1, ps1, s1idx), HSTORE_KEYLEN(es1, s1idx), + HSTORE_VALLEN(es1, s1idx), HSTORE_VALISNULL(es1, s1idx)); ++s1idx; } } @@ -614,8 +614,8 @@ hstore_slice_to_array(PG_FUNCTION_ARGS) else { out_datums[i] = PointerGetDatum( - cstring_to_text_with_len(HSTORE_VAL(entries, ptr, idx), - HSTORE_VALLEN(entries, idx))); + cstring_to_text_with_len(HSTORE_VAL(entries, ptr, idx), + HSTORE_VALLEN(entries, idx))); out_nulls[i] = false; } } @@ -667,7 +667,7 @@ hstore_slice_to_hstore(PG_FUNCTION_ARGS) for (i = 0; i < nkeys; ++i) { int idx = hstoreFindKey(hs, &lastidx, - key_pairs[i].key, key_pairs[i].keylen); + key_pairs[i].key, key_pairs[i].keylen); if (idx >= 0) { @@ -760,7 +760,7 @@ hstore_avals(PG_FUNCTION_ARGS) else { text *item = cstring_to_text_with_len(HSTORE_VAL(entries, base, i), - HSTORE_VALLEN(entries, i)); + HSTORE_VALLEN(entries, i)); d[i] = PointerGetDatum(item); nulls[i] = false; @@ -811,7 +811,7 @@ hstore_to_array_internal(HStore *hs, int ndims) else { text *item = cstring_to_text_with_len(HSTORE_VAL(entries, base, i), - HSTORE_VALLEN(entries, i)); + HSTORE_VALLEN(entries, i)); out_datums[i * 2 + 1] = PointerGetDatum(item); out_nulls[i * 2 + 1] = false; diff --git a/contrib/intarray/_int.h b/contrib/intarray/_int.h index d524f0fed5..b689eb7ded 100644 --- a/contrib/intarray/_int.h +++ b/contrib/intarray/_int.h @@ -173,4 +173,4 @@ int compDESC(const void *a, const void *b); (direction) ? compASC : compDESC ); \ } while(0) -#endif /* ___INT_H__ */ +#endif /* ___INT_H__ */ diff --git a/contrib/intarray/_int_bool.c b/contrib/intarray/_int_bool.c index 5d9e676660..a18c645606 100644 --- a/contrib/intarray/_int_bool.c +++ b/contrib/intarray/_int_bool.c @@ -506,8 +506,8 @@ bqarr_in(PG_FUNCTION_ARGS) if (state.num > QUERYTYPEMAXITEMS) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("number of query items (%d) exceeds the maximum allowed (%d)", - state.num, (int) QUERYTYPEMAXITEMS))); + errmsg("number of query items (%d) exceeds the maximum allowed (%d)", + state.num, (int) QUERYTYPEMAXITEMS))); commonlen = COMPUTESIZE(state.num); query = (QUERYTYPE *) palloc(commonlen); diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c index fb16b66edb..73628bea11 100644 --- a/contrib/intarray/_int_gin.c +++ b/contrib/intarray/_int_gin.c @@ -93,7 +93,7 @@ ginint4_queryextract(PG_FUNCTION_ARGS) case RTOldContainsStrategyNumber: if (*nentries > 0) *searchMode = GIN_SEARCH_MODE_DEFAULT; - else /* everything contains the empty set */ + else /* everything contains the empty set */ *searchMode = GIN_SEARCH_MODE_ALL; break; default: diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c index 888c277e60..79521b29b0 100644 --- a/contrib/intarray/_int_gist.c +++ b/contrib/intarray/_int_gist.c @@ -83,7 +83,7 @@ g_int_consistent(PG_FUNCTION_ARGS) case RTOldContainedByStrategyNumber: if (GIST_LEAF(entry)) retval = inner_int_contains(query, - (ArrayType *) DatumGetPointer(entry->key)); + (ArrayType *) DatumGetPointer(entry->key)); else retval = inner_int_overlap((ArrayType *) DatumGetPointer(entry->key), query); diff --git a/contrib/intarray/_int_op.c b/contrib/intarray/_int_op.c index c30d3c8269..3637c4564c 100644 --- a/contrib/intarray/_int_op.c +++ b/contrib/intarray/_int_op.c @@ -49,8 +49,8 @@ _int_different(PG_FUNCTION_ARGS) PG_RETURN_BOOL(!DatumGetBool( DirectFunctionCall2( _int_same, - PointerGetDatum(PG_GETARG_POINTER(0)), - PointerGetDatum(PG_GETARG_POINTER(1)) + PointerGetDatum(PG_GETARG_POINTER(0)), + PointerGetDatum(PG_GETARG_POINTER(1)) ) )); } diff --git a/contrib/intarray/_int_selfuncs.c b/contrib/intarray/_int_selfuncs.c index 3d92025ba5..acb87d10f0 100644 --- a/contrib/intarray/_int_selfuncs.c +++ b/contrib/intarray/_int_selfuncs.c @@ -57,7 +57,7 @@ _int_overlap_sel(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall4(arraycontsel, PG_GETARG_DATUM(0), - ObjectIdGetDatum(OID_ARRAY_OVERLAP_OP), + ObjectIdGetDatum(OID_ARRAY_OVERLAP_OP), PG_GETARG_DATUM(2), PG_GETARG_DATUM(3))); } @@ -67,7 +67,7 @@ _int_contains_sel(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall4(arraycontsel, PG_GETARG_DATUM(0), - ObjectIdGetDatum(OID_ARRAY_CONTAINS_OP), + ObjectIdGetDatum(OID_ARRAY_CONTAINS_OP), PG_GETARG_DATUM(2), PG_GETARG_DATUM(3))); } @@ -77,7 +77,7 @@ _int_contained_sel(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall4(arraycontsel, PG_GETARG_DATUM(0), - ObjectIdGetDatum(OID_ARRAY_CONTAINED_OP), + ObjectIdGetDatum(OID_ARRAY_CONTAINED_OP), PG_GETARG_DATUM(2), PG_GETARG_DATUM(3))); } @@ -87,7 +87,7 @@ _int_overlap_joinsel(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall5(arraycontjoinsel, PG_GETARG_DATUM(0), - ObjectIdGetDatum(OID_ARRAY_OVERLAP_OP), + ObjectIdGetDatum(OID_ARRAY_OVERLAP_OP), PG_GETARG_DATUM(2), PG_GETARG_DATUM(3), PG_GETARG_DATUM(4))); @@ -98,7 +98,7 @@ _int_contains_joinsel(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall5(arraycontjoinsel, PG_GETARG_DATUM(0), - ObjectIdGetDatum(OID_ARRAY_CONTAINS_OP), + ObjectIdGetDatum(OID_ARRAY_CONTAINS_OP), PG_GETARG_DATUM(2), PG_GETARG_DATUM(3), PG_GETARG_DATUM(4))); @@ -109,7 +109,7 @@ _int_contained_joinsel(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall5(arraycontjoinsel, PG_GETARG_DATUM(0), - ObjectIdGetDatum(OID_ARRAY_CONTAINED_OP), + ObjectIdGetDatum(OID_ARRAY_CONTAINED_OP), PG_GETARG_DATUM(2), PG_GETARG_DATUM(3), PG_GETARG_DATUM(4))); diff --git a/contrib/intarray/_int_tool.c b/contrib/intarray/_int_tool.c index 3c52912bbf..2fdfd2ec63 100644 --- a/contrib/intarray/_int_tool.c +++ b/contrib/intarray/_int_tool.c @@ -282,7 +282,7 @@ internal_size(int *a, int len) for (i = 0; i < len; i += 2) { - if (!i || a[i] != a[i - 1]) /* do not count repeated range */ + if (!i || a[i] != a[i - 1]) /* do not count repeated range */ size += a[i + 1] - a[i] + 1; } diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c index c3c10e14bc..4d845b716f 100644 --- a/contrib/isn/isn.c +++ b/contrib/isn/isn.c @@ -131,7 +131,7 @@ invalidindex: elog(DEBUG1, "index %d is invalid", j); return false; } -#endif /* ISN_DEBUG */ +#endif /* ISN_DEBUG */ /*---------------------------------------------------------- * Formatting and conversion routines. @@ -699,11 +699,11 @@ string2ean(const char *str, bool errorOK, ean13 *result, /* recognize and validate the number: */ while (*aux2 && length <= 13) { - last = (*(aux2 + 1) == '!' || *(aux2 + 1) == '\0'); /* is the last character */ + last = (*(aux2 + 1) == '!' || *(aux2 + 1) == '\0'); /* is the last character */ digit = (isdigit((unsigned char) *aux2) != 0); /* is current character * a digit? */ - if (*aux2 == '?' && last) /* automagically calculate check digit - * if it's '?' */ + if (*aux2 == '?' && last) /* automagically calculate check digit if + * it's '?' */ magic = digit = true; if (length == 0 && (*aux2 == 'M' || *aux2 == 'm')) { @@ -832,8 +832,8 @@ string2ean(const char *str, bool errorOK, ean13 *result, goto eanwrongtype; break; case ISMN: - memcpy(buf, "9790", 4); /* this isn't for sure yet, for now - * ISMN it's only 9790 */ + memcpy(buf, "9790", 4); /* this isn't for sure yet, for now ISMN + * it's only 9790 */ valid = (valid && ((rcheck = checkdig(buf, 13)) == check || magic)); break; case ISBN: @@ -887,8 +887,8 @@ eanbadcheck: { ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid check digit for %s number: \"%s\", should be %c", - isn_names[accept], str, (rcheck == 10) ? ('X') : (rcheck + '0')))); + errmsg("invalid check digit for %s number: \"%s\", should be %c", + isn_names[accept], str, (rcheck == 10) ? ('X') : (rcheck + '0')))); } } return false; @@ -1123,7 +1123,7 @@ accept_weak_input(PG_FUNCTION_ARGS) g_weak = PG_GETARG_BOOL(0); #else /* function has no effect */ -#endif /* ISN_WEAK_MODE */ +#endif /* ISN_WEAK_MODE */ PG_RETURN_BOOL(g_weak); } diff --git a/contrib/isn/isn.h b/contrib/isn/isn.h index 09dc7c6575..e2c8a26234 100644 --- a/contrib/isn/isn.h +++ b/contrib/isn/isn.h @@ -32,4 +32,4 @@ typedef uint64 ean13; extern void initialize(void); -#endif /* ISN_H */ +#endif /* ISN_H */ diff --git a/contrib/lo/lo.c b/contrib/lo/lo.c index 6bd2430931..4585923ee2 100644 --- a/contrib/lo/lo.c +++ b/contrib/lo/lo.c @@ -32,11 +32,11 @@ lo_manage(PG_FUNCTION_ARGS) HeapTuple newtuple; /* The new value for tuple */ HeapTuple trigtuple; /* The original value of tuple */ - if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */ + if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */ elog(ERROR, "%s: not fired by trigger manager", trigdata->tg_trigger->tgname); - if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event)) /* internal error */ + if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event)) /* internal error */ elog(ERROR, "%s: must be fired for row", trigdata->tg_trigger->tgname); diff --git a/contrib/ltree/_ltree_op.c b/contrib/ltree/_ltree_op.c index c0c56a40d4..fdf6ebb43b 100644 --- a/contrib/ltree/_ltree_op.c +++ b/contrib/ltree/_ltree_op.c @@ -53,7 +53,7 @@ array_iterator(ArrayType *la, PGCALL2 callback, void *param, ltree **found) while (num > 0) { if (DatumGetBool(DirectFunctionCall2(callback, - PointerGetDatum(item), PointerGetDatum(param)))) + PointerGetDatum(item), PointerGetDatum(param)))) { if (found) diff --git a/contrib/ltree/lquery_op.c b/contrib/ltree/lquery_op.c index 31d150db40..229ddd0ae3 100644 --- a/contrib/ltree/lquery_op.c +++ b/contrib/ltree/lquery_op.c @@ -147,7 +147,7 @@ static struct { bool muse; uint32 high_pos; -} SomeStack = +} SomeStack = { false, 0, @@ -356,7 +356,7 @@ lt_q_regex(PG_FUNCTION_ARGS) while (num > 0) { if (DatumGetBool(DirectFunctionCall2(ltq_regex, - PointerGetDatum(tree), PointerGetDatum(query)))) + PointerGetDatum(tree), PointerGetDatum(query)))) { res = true; diff --git a/contrib/ltree/ltree.h b/contrib/ltree/ltree.h index c604357dbf..fd86323ffe 100644 --- a/contrib/ltree/ltree.h +++ b/contrib/ltree/ltree.h @@ -125,7 +125,7 @@ typedef struct #define OPR 3 #define OPEN 4 #define CLOSE 5 -#define VALTRUE 6 /* for stop words */ +#define VALTRUE 6 /* for stop words */ #define VALFALSE 7 @@ -161,7 +161,7 @@ bool ltree_execute(ITEM *curitem, void *checkval, int ltree_compare(const ltree *a, const ltree *b); bool inner_isparent(const ltree *c, const ltree *p); bool compare_subnode(ltree_level *t, char *q, int len, - int (*cmpptr) (const char *, const char *, size_t), bool anyend); + int (*cmpptr) (const char *, const char *, size_t), bool anyend); ltree *lca_inner(ltree **a, int len); int ltree_strncasecmp(const char *a, const char *b, size_t s); diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c index 033a477c61..70e78a672a 100644 --- a/contrib/ltree/ltree_gist.c +++ b/contrib/ltree/ltree_gist.c @@ -302,7 +302,7 @@ ltree_picksplit(PG_FUNCTION_ARGS) for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) { array[j].index = j; - lu = GETENTRY(entryvec, j); /* use as tmp val */ + lu = GETENTRY(entryvec, j); /* use as tmp val */ array[j].r = LTG_GETLNODE(lu); } @@ -312,7 +312,7 @@ ltree_picksplit(PG_FUNCTION_ARGS) lu_l = lu_r = ru_l = ru_r = NULL; for (j = FirstOffsetNumber; j <= maxoff; j = OffsetNumberNext(j)) { - lu = GETENTRY(entryvec, array[j].index); /* use as tmp val */ + lu = GETENTRY(entryvec, array[j].index); /* use as tmp val */ if (j <= (maxoff - FirstOffsetNumber + 1) / 2) { v->spl_left[v->spl_nleft] = array[j].index; @@ -672,8 +672,8 @@ ltree_consistent(PG_FUNCTION_ARGS) query = PG_GETARG_LQUERY(1); if (GIST_LEAF(entry)) res = DatumGetBool(DirectFunctionCall2(ltq_regex, - PointerGetDatum(LTG_NODE(key)), - PointerGetDatum((lquery *) query) + PointerGetDatum(LTG_NODE(key)), + PointerGetDatum((lquery *) query) )); else res = (gist_qe(key, (lquery *) query) && gist_between(key, (lquery *) query)); @@ -683,8 +683,8 @@ ltree_consistent(PG_FUNCTION_ARGS) query = PG_GETARG_LQUERY(1); if (GIST_LEAF(entry)) res = DatumGetBool(DirectFunctionCall2(ltxtq_exec, - PointerGetDatum(LTG_NODE(key)), - PointerGetDatum((lquery *) query) + PointerGetDatum(LTG_NODE(key)), + PointerGetDatum((lquery *) query) )); else res = gist_qtxt(key, (ltxtquery *) query); @@ -694,8 +694,8 @@ ltree_consistent(PG_FUNCTION_ARGS) query = DatumGetPointer(PG_DETOAST_DATUM(PG_GETARG_DATUM(1))); if (GIST_LEAF(entry)) res = DatumGetBool(DirectFunctionCall2(lt_q_regex, - PointerGetDatum(LTG_NODE(key)), - PointerGetDatum((ArrayType *) query) + PointerGetDatum(LTG_NODE(key)), + PointerGetDatum((ArrayType *) query) )); else res = arrq_cons(key, (ArrayType *) query); diff --git a/contrib/ltree/ltree_io.c b/contrib/ltree/ltree_io.c index a1d4a0d38f..34ca597a48 100644 --- a/contrib/ltree/ltree_io.c +++ b/contrib/ltree/ltree_io.c @@ -61,8 +61,8 @@ ltree_in(PG_FUNCTION_ARGS) if (num + 1 > MaxAllocSize / sizeof(nodeitem)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("number of levels (%d) exceeds the maximum allowed (%d)", - num + 1, (int) (MaxAllocSize / sizeof(nodeitem))))); + errmsg("number of levels (%d) exceeds the maximum allowed (%d)", + num + 1, (int) (MaxAllocSize / sizeof(nodeitem))))); list = lptr = (nodeitem *) palloc(sizeof(nodeitem) * (num + 1)); ptr = buf; while (*ptr) @@ -230,8 +230,8 @@ lquery_in(PG_FUNCTION_ARGS) if (num > MaxAllocSize / ITEMSIZE) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("number of levels (%d) exceeds the maximum allowed (%d)", - num, (int) (MaxAllocSize / ITEMSIZE)))); + errmsg("number of levels (%d) exceeds the maximum allowed (%d)", + num, (int) (MaxAllocSize / ITEMSIZE)))); curqlevel = tmpql = (lquery_level *) palloc0(ITEMSIZE * num); ptr = buf; while (*ptr) diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c index aab71aed2f..8af99decad 100644 --- a/contrib/oid2name/oid2name.c +++ b/contrib/oid2name/oid2name.c @@ -57,7 +57,7 @@ void sql_exec_dumpalltbspc(PGconn *, struct options *); /* function to parse command line options and check for some usage errors. */ void -get_opts(int argc, char **argv, struct options * my_opts) +get_opts(int argc, char **argv, struct options *my_opts) { int c; const char *progname; @@ -211,7 +211,7 @@ add_one_elt(char *eltname, eary *eary) { eary ->alloc *= 2; eary ->array = (char **) pg_realloc(eary->array, - eary->alloc * sizeof(char *)); + eary->alloc * sizeof(char *)); } eary ->array[eary->num] = pg_strdup(eltname); @@ -260,7 +260,7 @@ get_comma_elts(eary *eary) /* establish connection with database. */ PGconn * -sql_conn(struct options * my_opts) +sql_conn(struct options *my_opts) { PGconn *conn; bool have_password = false; @@ -411,7 +411,7 @@ sql_exec(PGconn *conn, const char *todo, bool quiet) * Dump all databases. There are no system objects to worry about. */ void -sql_exec_dumpalldbs(PGconn *conn, struct options * opts) +sql_exec_dumpalldbs(PGconn *conn, struct options *opts) { char todo[1024]; @@ -428,7 +428,7 @@ sql_exec_dumpalldbs(PGconn *conn, struct options * opts) * Dump all tables, indexes and sequences in the current database. */ void -sql_exec_dumpalltables(PGconn *conn, struct options * opts) +sql_exec_dumpalltables(PGconn *conn, struct options *opts) { char todo[1024]; char *addfields = ",c.oid AS \"Oid\", nspname AS \"Schema\", spcname as \"Tablespace\" "; @@ -436,7 +436,7 @@ sql_exec_dumpalltables(PGconn *conn, struct options * opts) snprintf(todo, sizeof(todo), "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s " "FROM pg_catalog.pg_class c " - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace " + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace " " LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database()," " pg_catalog.pg_tablespace t " "WHERE relkind IN (" CppAsString2(RELKIND_RELATION) "," @@ -460,7 +460,7 @@ sql_exec_dumpalltables(PGconn *conn, struct options * opts) * given objects in the current database. */ void -sql_exec_searchtables(PGconn *conn, struct options * opts) +sql_exec_searchtables(PGconn *conn, struct options *opts) { char *todo; char *qualifiers, @@ -507,7 +507,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts) todo = psprintf( "SELECT pg_catalog.pg_relation_filenode(c.oid) as \"Filenode\", relname as \"Table Name\" %s\n" "FROM pg_catalog.pg_class c\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" " LEFT JOIN pg_catalog.pg_database d ON d.datname = pg_catalog.current_database(),\n" " pg_catalog.pg_tablespace t\n" "WHERE relkind IN (" CppAsString2(RELKIND_RELATION) "," @@ -516,7 +516,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts) CppAsString2(RELKIND_SEQUENCE) "," CppAsString2(RELKIND_TOASTVALUE) ") AND\n" " t.oid = CASE\n" - " WHEN reltablespace <> 0 THEN reltablespace\n" + " WHEN reltablespace <> 0 THEN reltablespace\n" " ELSE dattablespace\n" " END AND\n" " (%s)\n" @@ -530,7 +530,7 @@ sql_exec_searchtables(PGconn *conn, struct options * opts) } void -sql_exec_dumpalltbspc(PGconn *conn, struct options * opts) +sql_exec_dumpalltbspc(PGconn *conn, struct options *opts) { char todo[1024]; diff --git a/contrib/pageinspect/brinfuncs.c b/contrib/pageinspect/brinfuncs.c index d52807dcdd..13da7616e7 100644 --- a/contrib/pageinspect/brinfuncs.c +++ b/contrib/pageinspect/brinfuncs.c @@ -226,7 +226,7 @@ brin_page_items(PG_FUNCTION_ARGS) if (ItemIdIsUsed(itemId)) { dtup = brin_deform_tuple(bdesc, - (BrinTuple *) PageGetItem(page, itemId), + (BrinTuple *) PageGetItem(page, itemId), NULL); attno = 1; unusedItem = false; diff --git a/contrib/pageinspect/btreefuncs.c b/contrib/pageinspect/btreefuncs.c index 02440eca47..4f834676ea 100644 --- a/contrib/pageinspect/btreefuncs.c +++ b/contrib/pageinspect/btreefuncs.c @@ -346,7 +346,7 @@ bt_page_items(PG_FUNCTION_ARGS) if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot access temporary tables of other sessions"))); + errmsg("cannot access temporary tables of other sessions"))); if (blkno == 0) elog(ERROR, "block 0 is a meta page"); @@ -442,7 +442,7 @@ bt_page_items_bytea(PG_FUNCTION_ARGS) if (raw_page_size < SizeOfPageHeaderData) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("input page too small (%d bytes)", raw_page_size))); + errmsg("input page too small (%d bytes)", raw_page_size))); fctx = SRF_FIRSTCALL_INIT(); mctx = MemoryContextSwitchTo(fctx->multi_call_memory_ctx); diff --git a/contrib/pageinspect/ginfuncs.c b/contrib/pageinspect/ginfuncs.c index 993fc2d9ae..f774495b6f 100644 --- a/contrib/pageinspect/ginfuncs.c +++ b/contrib/pageinspect/ginfuncs.c @@ -196,7 +196,7 @@ gin_leafpage_items(PG_FUNCTION_ARGS) if (opaq->flags != (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("input page is not a compressed GIN data leaf page"), + errmsg("input page is not a compressed GIN data leaf page"), errdetail("Flags %04X, expected %04X", opaq->flags, (GIN_DATA | GIN_LEAF | GIN_COMPRESSED)))); diff --git a/contrib/pageinspect/hashfuncs.c b/contrib/pageinspect/hashfuncs.c index 228a147c9e..dbe3b6ab04 100644 --- a/contrib/pageinspect/hashfuncs.c +++ b/contrib/pageinspect/hashfuncs.c @@ -99,7 +99,7 @@ verify_hash_page(bytea *raw_page, int flags) case LH_BUCKET_PAGE | LH_OVERFLOW_PAGE: ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("page is not a hash bucket or overflow page"))); + errmsg("page is not a hash bucket or overflow page"))); case LH_OVERFLOW_PAGE: ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), diff --git a/contrib/pageinspect/heapfuncs.c b/contrib/pageinspect/heapfuncs.c index 1448effb50..72d1776a4a 100644 --- a/contrib/pageinspect/heapfuncs.c +++ b/contrib/pageinspect/heapfuncs.c @@ -84,7 +84,7 @@ text_to_bits(char *str, int len) else ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), - errmsg("illegal character '%c' in t_bits string", str[off]))); + errmsg("illegal character '%c' in t_bits string", str[off]))); if (off % 8 == 7) bits[off / 8] = byte; @@ -132,7 +132,7 @@ heap_page_items(PG_FUNCTION_ARGS) if (raw_page_size < SizeOfPageHeaderData) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("input page too small (%d bytes)", raw_page_size))); + errmsg("input page too small (%d bytes)", raw_page_size))); fctx = SRF_FIRSTCALL_INIT(); mctx = MemoryContextSwitchTo(fctx->multi_call_memory_ctx); @@ -236,7 +236,7 @@ heap_page_items(PG_FUNCTION_ARGS) bits_len = ((tuphdr->t_infomask2 & HEAP_NATTS_MASK) / 8 + 1) * 8; values[11] = CStringGetTextDatum( - bits_to_text(tuphdr->t_bits, bits_len)); + bits_to_text(tuphdr->t_bits, bits_len)); } else nulls[11] = true; @@ -384,7 +384,7 @@ tuple_data_split_internal(Oid relid, char *tupdata, if (tupdata_len != off) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), - errmsg("end of tuple reached without looking at all its data"))); + errmsg("end of tuple reached without looking at all its data"))); return makeArrayResult(raw_attrs, CurrentMemoryContext); } diff --git a/contrib/pageinspect/pageinspect.h b/contrib/pageinspect/pageinspect.h index 55ca68fab3..f49cf9e892 100644 --- a/contrib/pageinspect/pageinspect.h +++ b/contrib/pageinspect/pageinspect.h @@ -18,4 +18,4 @@ /* in rawpage.c */ extern Page get_page_from_raw(bytea *raw_page); -#endif /* _PAGEINSPECT_H_ */ +#endif /* _PAGEINSPECT_H_ */ diff --git a/contrib/pageinspect/rawpage.c b/contrib/pageinspect/rawpage.c index f273dfa7cb..e9d3131bda 100644 --- a/contrib/pageinspect/rawpage.c +++ b/contrib/pageinspect/rawpage.c @@ -311,7 +311,7 @@ page_checksum(PG_FUNCTION_ARGS) if (raw_page_size != BLCKSZ) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("incorrect size of input page (%d bytes)", raw_page_size))); + errmsg("incorrect size of input page (%d bytes)", raw_page_size))); page = (PageHeader) VARDATA(raw_page); diff --git a/contrib/passwordcheck/passwordcheck.c b/contrib/passwordcheck/passwordcheck.c index 59f73a1e6b..b80fd458ad 100644 --- a/contrib/passwordcheck/passwordcheck.c +++ b/contrib/passwordcheck/passwordcheck.c @@ -112,7 +112,7 @@ check_password(const char *username, if (!pwd_has_letter || !pwd_has_nonletter) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("password must contain both letters and nonletters"))); + errmsg("password must contain both letters and nonletters"))); #ifdef USE_CRACKLIB /* call cracklib to check password */ diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c index 8bebf2384d..b410aafa5a 100644 --- a/contrib/pg_buffercache/pg_buffercache_pages.c +++ b/contrib/pg_buffercache/pg_buffercache_pages.c @@ -66,7 +66,7 @@ pg_buffercache_pages(PG_FUNCTION_ARGS) FuncCallContext *funcctx; Datum result; MemoryContext oldcontext; - BufferCachePagesContext *fctx; /* User function context. */ + BufferCachePagesContext *fctx; /* User function context. */ TupleDesc tupledesc; TupleDesc expected_tupledesc; HeapTuple tuple; diff --git a/contrib/pg_prewarm/pg_prewarm.c b/contrib/pg_prewarm/pg_prewarm.c index 78d71ab078..fec62b1a54 100644 --- a/contrib/pg_prewarm/pg_prewarm.c +++ b/contrib/pg_prewarm/pg_prewarm.c @@ -138,8 +138,8 @@ pg_prewarm(PG_FUNCTION_ARGS) if (last_block < 0 || last_block >= nblocks) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("ending block number must be between 0 and " INT64_FORMAT, - nblocks - 1))); + errmsg("ending block number must be between 0 and " INT64_FORMAT, + nblocks - 1))); } /* Now we're ready to do the real work. */ diff --git a/contrib/pg_standby/pg_standby.c b/contrib/pg_standby/pg_standby.c index c37eaa395d..d7fa2a80c6 100644 --- a/contrib/pg_standby/pg_standby.c +++ b/contrib/pg_standby/pg_standby.c @@ -44,8 +44,8 @@ int maxwaittime = 0; /* how long are we prepared to wait for? */ int keepfiles = 0; /* number of WAL files to keep, 0 keep all */ int maxretries = 3; /* number of retries on restore command */ bool debug = false; /* are we debugging? */ -bool need_cleanup = false; /* do we need to remove files from - * archive? */ +bool need_cleanup = false; /* do we need to remove files from + * archive? */ #ifndef WIN32 static volatile sig_atomic_t signaled = false; @@ -59,8 +59,8 @@ char *restartWALFileName; /* the file from which we can restart restore */ char *priorWALFileName; /* the file we need to get from archive */ char WALFilePath[MAXPGPATH * 2]; /* the file path including archive */ char restoreCommand[MAXPGPATH]; /* run this to restore */ -char exclusiveCleanupFileName[MAXFNAMELEN]; /* the file we need to - * get from archive */ +char exclusiveCleanupFileName[MAXFNAMELEN]; /* the file we need to get + * from archive */ /* * Two types of failover are supported (smart and fast failover). @@ -256,7 +256,7 @@ CustomizableCleanupPriorWALFiles(void) * in case this worries you. */ if (IsXLogFileName(xlde->d_name) && - strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0) + strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0) { #ifdef WIN32 snprintf(WALFilePath, sizeof(WALFilePath), "%s\\%s", archiveLocation, xlde->d_name); @@ -523,7 +523,7 @@ usage(void) "Main intended use as restore_command in recovery.conf:\n" " restore_command = 'pg_standby [OPTION]... ARCHIVELOCATION %%f %%p %%r'\n" "e.g.\n" - " restore_command = 'pg_standby /mnt/server/archiverdir %%f %%p %%r'\n"); + " restore_command = 'pg_standby /mnt/server/archiverdir %%f %%p %%r'\n"); printf("\nReport bugs to <[email protected]>.\n"); } @@ -582,7 +582,7 @@ main(int argc, char **argv) * There's no way to trigger failover via signal on Windows. */ (void) pqsignal(SIGUSR1, sighandler); - (void) pqsignal(SIGINT, sighandler); /* deprecated, use SIGUSR1 */ + (void) pqsignal(SIGINT, sighandler); /* deprecated, use SIGUSR1 */ (void) pqsignal(SIGQUIT, sigquit_handler); #endif diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c index 3c35604b5d..5e6e726ed2 100644 --- a/contrib/pg_stat_statements/pg_stat_statements.c +++ b/contrib/pg_stat_statements/pg_stat_statements.c @@ -107,7 +107,7 @@ static const uint32 PGSS_PG_MAJOR_VERSION = PG_VERSION_NUM / 100; #define ASSUMED_LENGTH_INIT 1024 /* initial assumed mean query length */ #define USAGE_DECREASE_FACTOR (0.99) /* decreased every entry_dealloc */ #define STICKY_DECREASE_FACTOR (0.50) /* factor for sticky entries */ -#define USAGE_DEALLOC_PERCENT 5 /* free this % of entries at once */ +#define USAGE_DEALLOC_PERCENT 5 /* free this % of entries at once */ #define JUMBLE_SIZE 1024 /* query serialization buffer size */ @@ -146,15 +146,15 @@ typedef struct Counters double sum_var_time; /* sum of variances in execution time in msec */ int64 rows; /* total # of retrieved or affected rows */ int64 shared_blks_hit; /* # of shared buffer hits */ - int64 shared_blks_read; /* # of shared disk blocks read */ + int64 shared_blks_read; /* # of shared disk blocks read */ int64 shared_blks_dirtied; /* # of shared disk blocks dirtied */ int64 shared_blks_written; /* # of shared disk blocks written */ int64 local_blks_hit; /* # of local buffer hits */ int64 local_blks_read; /* # of local disk blocks read */ - int64 local_blks_dirtied; /* # of local disk blocks dirtied */ - int64 local_blks_written; /* # of local disk blocks written */ + int64 local_blks_dirtied; /* # of local disk blocks dirtied */ + int64 local_blks_written; /* # of local disk blocks written */ int64 temp_blks_read; /* # of temp blocks read */ - int64 temp_blks_written; /* # of temp blocks written */ + int64 temp_blks_written; /* # of temp blocks written */ double blk_read_time; /* time spent reading, in msec */ double blk_write_time; /* time spent writing, in msec */ double usage; /* usage factor */ @@ -183,7 +183,7 @@ typedef struct pgssEntry typedef struct pgssSharedState { LWLock *lock; /* protects hashtable search/modification */ - double cur_median_usage; /* current median usage in hashtable */ + double cur_median_usage; /* current median usage in hashtable */ Size mean_query_len; /* current mean entry text length */ slock_t mutex; /* protects following fields only: */ Size extent; /* current extent of query file */ @@ -250,7 +250,7 @@ typedef enum PGSS_TRACK_NONE, /* track no statements */ PGSS_TRACK_TOP, /* only top level statements */ PGSS_TRACK_ALL /* all statements, including nested ones */ -} PGSSTrackLevel; +} PGSSTrackLevel; static const struct config_enum_entry track_options[] = { @@ -362,7 +362,7 @@ _PG_init(void) * Define (or redefine) custom GUC variables. */ DefineCustomIntVariable("pg_stat_statements.max", - "Sets the maximum number of statements tracked by pg_stat_statements.", + "Sets the maximum number of statements tracked by pg_stat_statements.", NULL, &pgss_max, 5000, @@ -375,7 +375,7 @@ _PG_init(void) NULL); DefineCustomEnumVariable("pg_stat_statements.track", - "Selects which statements are tracked by pg_stat_statements.", + "Selects which statements are tracked by pg_stat_statements.", NULL, &pgss_track, PGSS_TRACK_TOP, @@ -387,7 +387,7 @@ _PG_init(void) NULL); DefineCustomBoolVariable("pg_stat_statements.track_utility", - "Selects whether utility commands are tracked by pg_stat_statements.", + "Selects whether utility commands are tracked by pg_stat_statements.", NULL, &pgss_track_utility, true, @@ -398,7 +398,7 @@ _PG_init(void) NULL); DefineCustomBoolVariable("pg_stat_statements.save", - "Save pg_stat_statements statistics across server shutdowns.", + "Save pg_stat_statements statistics across server shutdowns.", NULL, &pgss_save, true, @@ -944,7 +944,7 @@ pgss_ExecutorEnd(QueryDesc *queryDesc) queryId, queryDesc->plannedstmt->stmt_location, queryDesc->plannedstmt->stmt_len, - queryDesc->totaltime->total * 1000.0, /* convert to msec */ + queryDesc->totaltime->total * 1000.0, /* convert to msec */ queryDesc->estate->es_processed, &queryDesc->totaltime->bufusage, NULL); @@ -1353,7 +1353,7 @@ pg_stat_statements_reset(PG_FUNCTION_ARGS) #define PG_STAT_STATEMENTS_COLS_V1_1 18 #define PG_STAT_STATEMENTS_COLS_V1_2 19 #define PG_STAT_STATEMENTS_COLS_V1_3 23 -#define PG_STAT_STATEMENTS_COLS 23 /* maximum of above */ +#define PG_STAT_STATEMENTS_COLS 23 /* maximum of above */ /* * Retrieve statement statistics. @@ -1956,8 +1956,8 @@ qtext_load_file(Size *buffer_size) if (errno != ENOENT) ereport(LOG, (errcode_for_file_access(), - errmsg("could not read pg_stat_statement file \"%s\": %m", - PGSS_TEXT_FILE))); + errmsg("could not read pg_stat_statement file \"%s\": %m", + PGSS_TEXT_FILE))); return NULL; } @@ -2001,8 +2001,8 @@ qtext_load_file(Size *buffer_size) if (errno) ereport(LOG, (errcode_for_file_access(), - errmsg("could not read pg_stat_statement file \"%s\": %m", - PGSS_TEXT_FILE))); + errmsg("could not read pg_stat_statement file \"%s\": %m", + PGSS_TEXT_FILE))); free(buf); CloseTransientFile(fd); return NULL; @@ -2161,8 +2161,8 @@ gc_qtexts(void) { ereport(LOG, (errcode_for_file_access(), - errmsg("could not write pg_stat_statement file \"%s\": %m", - PGSS_TEXT_FILE))); + errmsg("could not write pg_stat_statement file \"%s\": %m", + PGSS_TEXT_FILE))); hash_seq_term(&hash_seq); goto gc_fail; } @@ -2179,8 +2179,8 @@ gc_qtexts(void) if (ftruncate(fileno(qfile), extent) != 0) ereport(LOG, (errcode_for_file_access(), - errmsg("could not truncate pg_stat_statement file \"%s\": %m", - PGSS_TEXT_FILE))); + errmsg("could not truncate pg_stat_statement file \"%s\": %m", + PGSS_TEXT_FILE))); if (FreeFile(qfile)) { @@ -2246,8 +2246,8 @@ gc_fail: if (qfile == NULL) ereport(LOG, (errcode_for_file_access(), - errmsg("could not write new pg_stat_statement file \"%s\": %m", - PGSS_TEXT_FILE))); + errmsg("could not write new pg_stat_statement file \"%s\": %m", + PGSS_TEXT_FILE))); else FreeFile(qfile); @@ -2307,8 +2307,8 @@ entry_reset(void) if (ftruncate(fileno(qfile), 0) != 0) ereport(LOG, (errcode_for_file_access(), - errmsg("could not truncate pg_stat_statement file \"%s\": %m", - PGSS_TEXT_FILE))); + errmsg("could not truncate pg_stat_statement file \"%s\": %m", + PGSS_TEXT_FILE))); FreeFile(qfile); @@ -2983,12 +2983,12 @@ generate_normalized_query(pgssJumbleState *jstate, const char *query, char *norm_query; int query_len = *query_len_p; int i, - norm_query_buflen, /* Space allowed for norm_query */ + norm_query_buflen, /* Space allowed for norm_query */ len_to_wrt, /* Length (in bytes) to write */ quer_loc = 0, /* Source query byte location */ n_quer_loc = 0, /* Normalized query byte location */ last_off = 0, /* Offset from start for previous tok */ - last_tok_len = 0; /* Length (in bytes) of that tok */ + last_tok_len = 0; /* Length (in bytes) of that tok */ /* * Get constants' lengths (core system only gives us locations). Note diff --git a/contrib/pg_trgm/trgm.h b/contrib/pg_trgm/trgm.h index 8cd88e763c..45df91875a 100644 --- a/contrib/pg_trgm/trgm.h +++ b/contrib/pg_trgm/trgm.h @@ -132,4 +132,4 @@ extern TRGM *createTrgmNFA(text *text_re, Oid collation, TrgmPackedGraph **graph, MemoryContext rcontext); extern bool trigramsMatchGraph(TrgmPackedGraph *graph, bool *check); -#endif /* __TRGM_H__ */ +#endif /* __TRGM_H__ */ diff --git a/contrib/pg_trgm/trgm_op.c b/contrib/pg_trgm/trgm_op.c index e9a713113e..f7e96acc53 100644 --- a/contrib/pg_trgm/trgm_op.c +++ b/contrib/pg_trgm/trgm_op.c @@ -325,7 +325,7 @@ generate_trgm(char *str, int slen) protect_out_of_mem(slen); - trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) *3); + trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) * 3); trg->flag = ARRKEY; len = generate_trgm_only(GETARR(trg), str, slen); @@ -572,8 +572,8 @@ calc_word_similarity(char *str1, int slen1, char *str2, int slen2, protect_out_of_mem(slen1 + slen2); /* Make positional trigrams */ - trg1 = (trgm *) palloc(sizeof(trgm) * (slen1 / 2 + 1) *3); - trg2 = (trgm *) palloc(sizeof(trgm) * (slen2 / 2 + 1) *3); + trg1 = (trgm *) palloc(sizeof(trgm) * (slen1 / 2 + 1) * 3); + trg2 = (trgm *) palloc(sizeof(trgm) * (slen2 / 2 + 1) * 3); len1 = generate_trgm_only(trg1, str1, slen1); len2 = generate_trgm_only(trg2, str2, slen2); @@ -806,7 +806,7 @@ generate_wildcard_trgm(const char *str, int slen) protect_out_of_mem(slen); - trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) *3); + trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) * 3); trg->flag = ARRKEY; SET_VARSIZE(trg, TRGMHDRSIZE); diff --git a/contrib/pg_trgm/trgm_regexp.c b/contrib/pg_trgm/trgm_regexp.c index 6ab2e49eb9..1d474e2aac 100644 --- a/contrib/pg_trgm/trgm_regexp.c +++ b/contrib/pg_trgm/trgm_regexp.c @@ -450,7 +450,7 @@ struct TrgmPackedGraph * by color trigram number. */ int colorTrigramsCount; - int *colorTrigramGroups; /* array of size colorTrigramsCount */ + int *colorTrigramGroups; /* array of size colorTrigramsCount */ /* * The states of the simplified NFA. State number 0 is always initial @@ -2350,4 +2350,4 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams) pfree(buf.data); } -#endif /* TRGM_REGEXP_DEBUG */ +#endif /* TRGM_REGEXP_DEBUG */ diff --git a/contrib/pg_visibility/pg_visibility.c b/contrib/pg_visibility/pg_visibility.c index 480f917d08..2cc9575d9f 100644 --- a/contrib/pg_visibility/pg_visibility.c +++ b/contrib/pg_visibility/pg_visibility.c @@ -481,7 +481,7 @@ collect_visibility_data(Oid relid, bool include_pd) check_relation_relkind(rel); nblocks = RelationGetNumberOfBlocks(rel); - info = palloc0(offsetof(vbits, bits) +nblocks); + info = palloc0(offsetof(vbits, bits) + nblocks); info->next = 0; info->count = nblocks; @@ -774,6 +774,6 @@ check_relation_relkind(Relation rel) rel->rd_rel->relkind != RELKIND_TOASTVALUE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("\"%s\" is not a table, materialized view, or TOAST table", - RelationGetRelationName(rel)))); + errmsg("\"%s\" is not a table, materialized view, or TOAST table", + RelationGetRelationName(rel)))); } diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c index 6feaefcf7b..ed69c0c6bb 100644 --- a/contrib/pgcrypto/crypt-blowfish.c +++ b/contrib/pgcrypto/crypt-blowfish.c @@ -737,7 +737,7 @@ _crypt_blowfish_rn(const char *key, const char *setting, memcpy(output, setting, 7 + 22 - 1); output[7 + 22 - 1] = BF_itoa64[(int) - BF_atoi64[(int) setting[7 + 22 - 1] - 0x20] & 0x30]; + BF_atoi64[(int) setting[7 + 22 - 1] - 0x20] & 0x30]; /* This has to be bug-compatible with the original implementation, so * only encode 23 of the 24 bytes. :-) */ diff --git a/contrib/pgcrypto/crypt-des.c b/contrib/pgcrypto/crypt-des.c index 44a5731dde..60bdbb0c91 100644 --- a/contrib/pgcrypto/crypt-des.c +++ b/contrib/pgcrypto/crypt-des.c @@ -734,7 +734,7 @@ px_crypt_des(const char *key, const char *setting) p = output + strlen(output); } else -#endif /* !DISABLE_XDES */ +#endif /* !DISABLE_XDES */ { /* * "old"-style: setting - 2 bytes of salt key - only up to the first 8 diff --git a/contrib/pgcrypto/crypt-gensalt.c b/contrib/pgcrypto/crypt-gensalt.c index 6dc7cbdb3a..740f361253 100644 --- a/contrib/pgcrypto/crypt-gensalt.c +++ b/contrib/pgcrypto/crypt-gensalt.c @@ -23,7 +23,7 @@ static unsigned char _crypt_itoa64[64 + 1] = char * _crypt_gensalt_traditional_rn(unsigned long count, - const char *input, int size, char *output, int output_size) + const char *input, int size, char *output, int output_size) { if (size < 2 || output_size < 2 + 1 || (count && count != 25)) { @@ -41,7 +41,7 @@ _crypt_gensalt_traditional_rn(unsigned long count, char * _crypt_gensalt_extended_rn(unsigned long count, - const char *input, int size, char *output, int output_size) + const char *input, int size, char *output, int output_size) { unsigned long value; @@ -77,7 +77,7 @@ _crypt_gensalt_extended_rn(unsigned long count, char * _crypt_gensalt_md5_rn(unsigned long count, - const char *input, int size, char *output, int output_size) + const char *input, int size, char *output, int output_size) { unsigned long value; @@ -159,7 +159,7 @@ BF_encode(char *dst, const BF_word *src, int size) char * _crypt_gensalt_blowfish_rn(unsigned long count, - const char *input, int size, char *output, int output_size) + const char *input, int size, char *output, int output_size) { if (size < 16 || output_size < 7 + 22 + 1 || (count && (count < 4 || count > 31))) diff --git a/contrib/pgcrypto/imath.c b/contrib/pgcrypto/imath.c index 61a01e2b71..cd528bfd83 100644 --- a/contrib/pgcrypto/imath.c +++ b/contrib/pgcrypto/imath.c @@ -908,7 +908,7 @@ mp_int_sqr(mp_int a, mp_int c) CHECK(a != NULL && c != NULL); /* Get a temporary buffer big enough to hold the result */ - osize = (mp_size) 4 *((MP_USED(a) + 1) / 2); + osize = (mp_size) 4 * ((MP_USED(a) + 1) / 2); if (a == c) { @@ -1613,8 +1613,8 @@ mp_int_gcd(mp_int a, mp_int b, mp_int c) CLEANUP: mp_int_clear(&v); -V: mp_int_clear(&u); -U: mp_int_clear(&t); +V: mp_int_clear(&u); +U: mp_int_clear(&t); return res; } @@ -1975,7 +1975,7 @@ mp_int_string_len(mp_int z, mp_size radix) if (radix < MP_MIN_RADIX || radix > MP_MAX_RADIX) return MP_RANGE; - len = s_outlen(z, radix) + 1; /* for terminator */ + len = s_outlen(z, radix) + 1; /* for terminator */ /* Allow for sign marker on negatives */ if (MP_SIGN(z) == MP_NEG) @@ -2512,7 +2512,7 @@ s_usub(mp_digit *da, mp_digit *db, mp_digit *dc, /* Subtract corresponding digits and propagate borrow */ for (pos = 0; pos < size_b; ++pos, ++da, ++db, ++dc) { - w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */ + w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */ (mp_word) *da) - w - (mp_word) *db; *dc = LOWER_HALF(w); @@ -2522,7 +2522,7 @@ s_usub(mp_digit *da, mp_digit *db, mp_digit *dc, /* Finish the subtraction for remaining upper digits of da */ for ( /* */ ; pos < size_a; ++pos, ++da, ++dc) { - w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */ + w = ((mp_word) MP_DIGIT_MAX + 1 + /* MP_RADIX */ (mp_word) *da) - w; *dc = LOWER_HALF(w); @@ -2594,10 +2594,10 @@ s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc, * t1 and t2 are initially used as temporaries to compute the inner * product (a1 + a0)(b1 + b0) = a1b1 + a1b0 + a0b1 + a0b0 */ - carry = s_uadd(da, a_top, t1, bot_size, at_size); /* t1 = a1 + a0 */ + carry = s_uadd(da, a_top, t1, bot_size, at_size); /* t1 = a1 + a0 */ t1[bot_size] = carry; - carry = s_uadd(db, b_top, t2, bot_size, bt_size); /* t2 = b1 + b0 */ + carry = s_uadd(db, b_top, t2, bot_size, bt_size); /* t2 = b1 + b0 */ t2[bot_size] = carry; (void) s_kmul(t1, t2, t3, bot_size + 1, bot_size + 1); /* t3 = t1 * t2 */ @@ -2609,7 +2609,7 @@ s_kmul(mp_digit *da, mp_digit *db, mp_digit *dc, ZERO(t1, buf_size); ZERO(t2, buf_size); (void) s_kmul(da, db, t1, bot_size, bot_size); /* t1 = a0 * b0 */ - (void) s_kmul(a_top, b_top, t2, at_size, bt_size); /* t2 = a1 * b1 */ + (void) s_kmul(a_top, b_top, t2, at_size, bt_size); /* t2 = a1 * b1 */ /* Subtract out t1 and t2 to get the inner product */ s_usub(t3, t1, t3, buf_size + 2, buf_size); @@ -2692,10 +2692,10 @@ s_ksqr(mp_digit *da, mp_digit *dc, mp_size size_a) t3 = t2 + buf_size; ZERO(t1, 4 * buf_size); - (void) s_ksqr(da, t1, bot_size); /* t1 = a0 ^ 2 */ - (void) s_ksqr(a_top, t2, at_size); /* t2 = a1 ^ 2 */ + (void) s_ksqr(da, t1, bot_size); /* t1 = a0 ^ 2 */ + (void) s_ksqr(a_top, t2, at_size); /* t2 = a1 ^ 2 */ - (void) s_kmul(da, a_top, t3, bot_size, at_size); /* t3 = a0 * a1 */ + (void) s_kmul(da, a_top, t3, bot_size, at_size); /* t3 = a0 * a1 */ /* Quick multiply t3 by 2, shifting left (can't overflow) */ { @@ -2782,7 +2782,7 @@ s_usqr(mp_digit *da, mp_digit *dc, mp_size size_a) w = UPPER_HALF(w); if (ov) { - w += MP_DIGIT_MAX; /* MP_RADIX */ + w += MP_DIGIT_MAX; /* MP_RADIX */ ++w; } } @@ -3512,7 +3512,7 @@ s_outlen(mp_int z, mp_size r) double raw; bits = mp_int_count_bits(z); - raw = (double) bits *s_log2[r]; + raw = (double) bits * s_log2[r]; return (int) (raw + 0.999999); } diff --git a/contrib/pgcrypto/imath.h b/contrib/pgcrypto/imath.h index 0a4f0f713f..2d7a5268e5 100644 --- a/contrib/pgcrypto/imath.h +++ b/contrib/pgcrypto/imath.h @@ -61,6 +61,7 @@ typedef struct mpz mp_size used; mp_sign sign; } mpz_t , + *mp_int; #define MP_DIGITS(Z) ((Z)->digits) @@ -105,9 +106,9 @@ void mp_int_free(mp_int z); mp_result mp_int_copy(mp_int a, mp_int c); /* c = a */ void mp_int_swap(mp_int a, mp_int c); /* swap a, c */ -void mp_int_zero(mp_int z); /* z = 0 */ -mp_result mp_int_abs(mp_int a, mp_int c); /* c = |a| */ -mp_result mp_int_neg(mp_int a, mp_int c); /* c = -a */ +void mp_int_zero(mp_int z); /* z = 0 */ +mp_result mp_int_abs(mp_int a, mp_int c); /* c = |a| */ +mp_result mp_int_neg(mp_int a, mp_int c); /* c = -a */ mp_result mp_int_add(mp_int a, mp_int b, mp_int c); /* c = a + b */ mp_result mp_int_add_value(mp_int a, int value, mp_int c); mp_result mp_int_sub(mp_int a, mp_int b, mp_int c); /* c = a - b */ @@ -115,23 +116,23 @@ mp_result mp_int_sub_value(mp_int a, int value, mp_int c); mp_result mp_int_mul(mp_int a, mp_int b, mp_int c); /* c = a * b */ mp_result mp_int_mul_value(mp_int a, int value, mp_int c); mp_result mp_int_mul_pow2(mp_int a, int p2, mp_int c); -mp_result mp_int_sqr(mp_int a, mp_int c); /* c = a * a */ +mp_result mp_int_sqr(mp_int a, mp_int c); /* c = a * a */ -mp_result mp_int_div(mp_int a, mp_int b, /* q = a / b */ +mp_result mp_int_div(mp_int a, mp_int b, /* q = a / b */ mp_int q, mp_int r); /* r = a % b */ -mp_result mp_int_div_value(mp_int a, int value, /* q = a / value */ - mp_int q, int *r); /* r = a % value */ +mp_result mp_int_div_value(mp_int a, int value, /* q = a / value */ + mp_int q, int *r); /* r = a % value */ mp_result mp_int_div_pow2(mp_int a, int p2, /* q = a / 2^p2 */ mp_int q, mp_int r); /* r = q % 2^p2 */ mp_result mp_int_mod(mp_int a, mp_int m, mp_int c); /* c = a % m */ #define mp_int_mod_value(A, V, R) mp_int_div_value((A), (V), 0, (R)) -mp_result mp_int_expt(mp_int a, int b, mp_int c); /* c = a^b */ +mp_result mp_int_expt(mp_int a, int b, mp_int c); /* c = a^b */ mp_result mp_int_expt_value(int a, int b, mp_int c); /* c = a^b */ int mp_int_compare(mp_int a, mp_int b); /* a <=> b */ -int mp_int_compare_unsigned(mp_int a, mp_int b); /* |a| <=> |b| */ -int mp_int_compare_zero(mp_int z); /* a <=> 0 */ +int mp_int_compare_unsigned(mp_int a, mp_int b); /* |a| <=> |b| */ +int mp_int_compare_zero(mp_int z); /* a <=> 0 */ int mp_int_compare_value(mp_int z, int value); /* a <=> v */ /* Returns true if v|a, false otherwise (including errors) */ @@ -143,15 +144,15 @@ int mp_int_is_pow2(mp_int z); mp_result mp_int_exptmod(mp_int a, mp_int b, mp_int m, mp_int c); /* c = a^b (mod m) */ mp_result mp_int_exptmod_evalue(mp_int a, int value, - mp_int m, mp_int c); /* c = a^v (mod m) */ + mp_int m, mp_int c); /* c = a^v (mod m) */ mp_result mp_int_exptmod_bvalue(int value, mp_int b, - mp_int m, mp_int c); /* c = v^b (mod m) */ + mp_int m, mp_int c); /* c = v^b (mod m) */ mp_result mp_int_exptmod_known(mp_int a, mp_int b, mp_int m, mp_int mu, mp_int c); /* c = a^b (mod m) */ mp_result mp_int_redux_const(mp_int m, mp_int c); -mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c); /* c = 1/a (mod m) */ +mp_result mp_int_invmod(mp_int a, mp_int m, mp_int c); /* c = 1/a (mod m) */ mp_result mp_int_gcd(mp_int a, mp_int b, mp_int c); /* c = gcd(a, b) */ @@ -206,4 +207,4 @@ void s_print(char *tag, mp_int z); void s_print_buf(char *tag, mp_digit *buf, mp_size num); #endif -#endif /* end IMATH_H_ */ +#endif /* end IMATH_H_ */ diff --git a/contrib/pgcrypto/internal.c b/contrib/pgcrypto/internal.c index 2516092ba4..16dfe725ea 100644 --- a/contrib/pgcrypto/internal.c +++ b/contrib/pgcrypto/internal.c @@ -42,11 +42,11 @@ /* * System reseeds should be separated at least this much. */ -#define SYSTEM_RESEED_MIN (20*60) /* 20 min */ +#define SYSTEM_RESEED_MIN (20*60) /* 20 min */ /* * How often to roll dice. */ -#define SYSTEM_RESEED_CHECK_TIME (10*60) /* 10 min */ +#define SYSTEM_RESEED_CHECK_TIME (10*60) /* 10 min */ /* * The chance is x/256 that the reseed happens. */ @@ -318,7 +318,7 @@ rj_init(PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv) } static int -rj_real_init(struct int_ctx * cx, int dir) +rj_real_init(struct int_ctx *cx, int dir) { aes_set_key(&cx->ctx.rj, cx->keybuf, cx->keylen * 8, dir); return 0; diff --git a/contrib/pgcrypto/mbuf.h b/contrib/pgcrypto/mbuf.h index 988293a729..50a989f059 100644 --- a/contrib/pgcrypto/mbuf.h +++ b/contrib/pgcrypto/mbuf.h @@ -51,7 +51,7 @@ struct PushFilterOps * copied (in-place) returns 0 on error */ int (*push) (PushFilter *next, void *priv, - const uint8 *src, int len); + const uint8 *src, int len); int (*flush) (PushFilter *next, void *priv); void (*free) (void *priv); }; @@ -69,7 +69,7 @@ struct PullFilterOps * use buf as work area if NULL in-place copy */ int (*pull) (void *priv, PullFilter *src, int len, - uint8 **data_p, uint8 *buf, int buflen); + uint8 **data_p, uint8 *buf, int buflen); void (*free) (void *priv); }; @@ -121,4 +121,4 @@ int pullf_create_mbuf_reader(PullFilter **pf_p, MBuf *mbuf); (dst) = __b; \ } while (0) -#endif /* __PX_MBUF_H */ +#endif /* __PX_MBUF_H */ diff --git a/contrib/pgcrypto/md5.h b/contrib/pgcrypto/md5.h index 07d08c134d..3e6e8da5e7 100644 --- a/contrib/pgcrypto/md5.h +++ b/contrib/pgcrypto/md5.h @@ -76,4 +76,4 @@ do { \ md5_result((x), (y)); \ } while (0) -#endif /* ! _NETINET6_MD5_H_ */ +#endif /* ! _NETINET6_MD5_H_ */ diff --git a/contrib/pgcrypto/pgp-decrypt.c b/contrib/pgcrypto/pgp-decrypt.c index 9ea60c4c47..7d31e5354b 100644 --- a/contrib/pgcrypto/pgp-decrypt.c +++ b/contrib/pgcrypto/pgp-decrypt.c @@ -460,7 +460,7 @@ mdcbuf_init(void **priv_p, void *arg, PullFilter *src) } static int -mdcbuf_finish(struct MDCBufData * st) +mdcbuf_finish(struct MDCBufData *st) { uint8 hash[20]; int res; @@ -485,7 +485,7 @@ mdcbuf_finish(struct MDCBufData * st) } static void -mdcbuf_load_data(struct MDCBufData * st, uint8 *src, int len) +mdcbuf_load_data(struct MDCBufData *st, uint8 *src, int len) { uint8 *dst = st->pos + st->avail; @@ -495,14 +495,14 @@ mdcbuf_load_data(struct MDCBufData * st, uint8 *src, int len) } static void -mdcbuf_load_mdc(struct MDCBufData * st, uint8 *src, int len) +mdcbuf_load_mdc(struct MDCBufData *st, uint8 *src, int len) { memmove(st->mdc_buf + st->mdc_avail, src, len); st->mdc_avail += len; } static int -mdcbuf_refill(struct MDCBufData * st, PullFilter *src) +mdcbuf_refill(struct MDCBufData *st, PullFilter *src) { uint8 *data; int res; diff --git a/contrib/pgcrypto/pgp-pgsql.c b/contrib/pgcrypto/pgp-pgsql.c index cc5df14725..0984e01a14 100644 --- a/contrib/pgcrypto/pgp-pgsql.c +++ b/contrib/pgcrypto/pgp-pgsql.c @@ -132,7 +132,7 @@ struct debug_expect }; static void -fill_expect(struct debug_expect * ex, int text_mode) +fill_expect(struct debug_expect *ex, int text_mode) { ex->debug = 0; ex->expect = 0; @@ -157,7 +157,7 @@ fill_expect(struct debug_expect * ex, int text_mode) } while (0) static void -check_expect(PGP_Context *ctx, struct debug_expect * ex) +check_expect(PGP_Context *ctx, struct debug_expect *ex) { EX_CHECK(cipher_algo); EX_CHECK(s2k_mode); @@ -179,7 +179,7 @@ show_debug(const char *msg) static int set_arg(PGP_Context *ctx, char *key, char *val, - struct debug_expect * ex) + struct debug_expect *ex) { int res = 0; @@ -317,7 +317,7 @@ downcase_convert(const uint8 *s, int len) static int parse_args(PGP_Context *ctx, uint8 *args, int arg_len, - struct debug_expect * ex) + struct debug_expect *ex) { char *str = downcase_convert(args, arg_len); char *key, @@ -362,7 +362,7 @@ create_mbuf_from_vardata(text *data) static void init_work(PGP_Context **ctx_p, int is_text, - text *args, struct debug_expect * ex) + text *args, struct debug_expect *ex) { int err = pgp_init(ctx_p); @@ -818,7 +818,7 @@ parse_key_value_arrays(ArrayType *key_array, ArrayType *val_array, if (!string_is_ascii(v)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("header key must not contain non-ASCII characters"))); + errmsg("header key must not contain non-ASCII characters"))); if (strstr(v, ": ")) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), @@ -840,7 +840,7 @@ parse_key_value_arrays(ArrayType *key_array, ArrayType *val_array, if (!string_is_ascii(v)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("header value must not contain non-ASCII characters"))); + errmsg("header value must not contain non-ASCII characters"))); if (strchr(v, '\n')) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), diff --git a/contrib/pgcrypto/pgp.h b/contrib/pgcrypto/pgp.h index 804a27018a..1b6ea4c9ea 100644 --- a/contrib/pgcrypto/pgp.h +++ b/contrib/pgcrypto/pgp.h @@ -155,8 +155,8 @@ struct PGP_Context */ int mdc_checked; int corrupt_prefix; /* prefix failed RFC 4880 "quick check" */ - int unsupported_compr; /* has bzip2 compression */ - int unexpected_binary; /* binary data seen in text_mode */ + int unsupported_compr; /* has bzip2 compression */ + int unexpected_binary; /* binary data seen in text_mode */ int in_mdc_pkt; int use_mdcbuf_filter; PX_MD *mdc_ctx; diff --git a/contrib/pgcrypto/px-crypt.c b/contrib/pgcrypto/px-crypt.c index 6c72c4ae83..ee40788fe7 100644 --- a/contrib/pgcrypto/px-crypt.c +++ b/contrib/pgcrypto/px-crypt.c @@ -74,7 +74,7 @@ struct px_crypt_algo char *id; unsigned id_len; char *(*crypt) (const char *psw, const char *salt, - char *buf, unsigned len); + char *buf, unsigned len); }; static const struct px_crypt_algo @@ -115,7 +115,7 @@ struct generator { char *name; char *(*gen) (unsigned long count, const char *input, int size, - char *output, int output_size); + char *output, int output_size); int input_len; int def_rounds; int min_rounds; diff --git a/contrib/pgcrypto/px-crypt.h b/contrib/pgcrypto/px-crypt.h index 24daee743c..696902a17c 100644 --- a/contrib/pgcrypto/px-crypt.h +++ b/contrib/pgcrypto/px-crypt.h @@ -57,13 +57,13 @@ int px_gen_salt(const char *salt_type, char *dst, int rounds); /* crypt-gensalt.c */ char *_crypt_gensalt_traditional_rn(unsigned long count, - const char *input, int size, char *output, int output_size); + const char *input, int size, char *output, int output_size); char *_crypt_gensalt_extended_rn(unsigned long count, - const char *input, int size, char *output, int output_size); + const char *input, int size, char *output, int output_size); char *_crypt_gensalt_md5_rn(unsigned long count, - const char *input, int size, char *output, int output_size); + const char *input, int size, char *output, int output_size); char *_crypt_gensalt_blowfish_rn(unsigned long count, - const char *input, int size, char *output, int output_size); + const char *input, int size, char *output, int output_size); /* disable 'extended DES crypt' */ /* #define DISABLE_XDES */ @@ -79,4 +79,4 @@ char *px_crypt_des(const char *key, const char *setting); char *px_crypt_md5(const char *pw, const char *salt, char *dst, unsigned dstlen); -#endif /* _PX_CRYPT_H */ +#endif /* _PX_CRYPT_H */ diff --git a/contrib/pgcrypto/px.h b/contrib/pgcrypto/px.h index e68a95a058..cef9c4b456 100644 --- a/contrib/pgcrypto/px.h +++ b/contrib/pgcrypto/px.h @@ -154,7 +154,7 @@ struct px_hmac struct px_cipher { unsigned (*block_size) (PX_Cipher *c); - unsigned (*key_size) (PX_Cipher *c); /* max key len */ + unsigned (*key_size) (PX_Cipher *c); /* max key len */ unsigned (*iv_size) (PX_Cipher *c); int (*init) (PX_Cipher *c, const uint8 *key, unsigned klen, const uint8 *iv); @@ -169,11 +169,11 @@ struct px_cipher struct px_combo { int (*init) (PX_Combo *cx, const uint8 *key, unsigned klen, - const uint8 *iv, unsigned ivlen); + const uint8 *iv, unsigned ivlen); int (*encrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen, - uint8 *res, unsigned *rlen); + uint8 *res, unsigned *rlen); int (*decrypt) (PX_Combo *cx, const uint8 *data, unsigned dlen, - uint8 *res, unsigned *rlen); + uint8 *res, unsigned *rlen); unsigned (*encrypt_len) (PX_Combo *cx, unsigned dlen); unsigned (*decrypt_len) (PX_Combo *cx, unsigned dlen); void (*free) (PX_Combo *cx); @@ -239,4 +239,4 @@ void px_debug(const char *fmt,...) pg_attribute_printf(1, 2); (c)->decrypt(c, data, dlen, res, rlen) #define px_combo_free(c) (c)->free(c) -#endif /* __PX_H */ +#endif /* __PX_H */ diff --git a/contrib/pgcrypto/rijndael.c b/contrib/pgcrypto/rijndael.c index 4adbcc1f91..4c074efbc0 100644 --- a/contrib/pgcrypto/rijndael.c +++ b/contrib/pgcrypto/rijndael.c @@ -97,7 +97,7 @@ static u4byte il_tab[4][256]; #endif static u4byte tab_gen = 0; -#endif /* !PRE_CALC_TABLES */ +#endif /* !PRE_CALC_TABLES */ #define ff_mult(a,b) ((a) && (b) ? pow_tab[(log_tab[a] + log_tab[b]) % 255] : 0) @@ -250,7 +250,7 @@ gen_tabs(void) } tab_gen = 1; -#endif /* !PRE_CALC_TABLES */ +#endif /* !PRE_CALC_TABLES */ } diff --git a/contrib/pgcrypto/rijndael.h b/contrib/pgcrypto/rijndael.h index e536c61a6f..bc9ddfaad3 100644 --- a/contrib/pgcrypto/rijndael.h +++ b/contrib/pgcrypto/rijndael.h @@ -44,8 +44,7 @@ typedef struct _rijndael_ctx /* These are all based on 32 bit unsigned values and will therefore */ /* require endian conversions for big-endian architectures */ -rijndael_ctx * - rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int); +rijndael_ctx *rijndael_set_key(rijndael_ctx *, const u4byte *, const u4byte, int); void rijndael_encrypt(rijndael_ctx *, const u4byte *, u4byte *); void rijndael_decrypt(rijndael_ctx *, const u4byte *, u4byte *); @@ -57,4 +56,4 @@ void aes_ecb_decrypt(rijndael_ctx *ctx, uint8 *data, unsigned len); void aes_cbc_encrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len); void aes_cbc_decrypt(rijndael_ctx *ctx, uint8 *iva, uint8 *data, unsigned len); -#endif /* _RIJNDAEL_H_ */ +#endif /* _RIJNDAEL_H_ */ diff --git a/contrib/pgcrypto/sha1.c b/contrib/pgcrypto/sha1.c index 0e753ce63a..fb6a57d917 100644 --- a/contrib/pgcrypto/sha1.c +++ b/contrib/pgcrypto/sha1.c @@ -81,7 +81,7 @@ do { \ static void sha1_step(struct sha1_ctxt *); static void -sha1_step(struct sha1_ctxt * ctxt) +sha1_step(struct sha1_ctxt *ctxt) { uint32 a, b, @@ -226,7 +226,7 @@ sha1_step(struct sha1_ctxt * ctxt) /*------------------------------------------------------------*/ void -sha1_init(struct sha1_ctxt * ctxt) +sha1_init(struct sha1_ctxt *ctxt) { memset(ctxt, 0, sizeof(struct sha1_ctxt)); H(0) = 0x67452301; @@ -237,7 +237,7 @@ sha1_init(struct sha1_ctxt * ctxt) } void -sha1_pad(struct sha1_ctxt * ctxt) +sha1_pad(struct sha1_ctxt *ctxt) { size_t padlen; /* pad length in bytes */ size_t padstart; @@ -280,7 +280,7 @@ sha1_pad(struct sha1_ctxt * ctxt) } void -sha1_loop(struct sha1_ctxt * ctxt, const uint8 *input0, size_t len) +sha1_loop(struct sha1_ctxt *ctxt, const uint8 *input0, size_t len) { const uint8 *input; size_t gaplen; @@ -308,7 +308,7 @@ sha1_loop(struct sha1_ctxt * ctxt, const uint8 *input0, size_t len) } void -sha1_result(struct sha1_ctxt * ctxt, uint8 *digest0) +sha1_result(struct sha1_ctxt *ctxt, uint8 *digest0) { uint8 *digest; diff --git a/contrib/pgcrypto/sha1.h b/contrib/pgcrypto/sha1.h index 2f61e454ba..4300694a34 100644 --- a/contrib/pgcrypto/sha1.h +++ b/contrib/pgcrypto/sha1.h @@ -72,4 +72,4 @@ typedef struct sha1_ctxt SHA1_CTX; #define SHA1_RESULTLEN (160/8) -#endif /* _NETINET6_SHA1_H_ */ +#endif /* _NETINET6_SHA1_H_ */ diff --git a/contrib/pgrowlocks/pgrowlocks.c b/contrib/pgrowlocks/pgrowlocks.c index 00e2015c5c..eabca65bd2 100644 --- a/contrib/pgrowlocks/pgrowlocks.c +++ b/contrib/pgrowlocks/pgrowlocks.c @@ -97,7 +97,19 @@ pgrowlocks(PG_FUNCTION_ARGS) relname = PG_GETARG_TEXT_PP(0); relrv = makeRangeVarFromNameList(textToQualifiedNameList(relname)); - rel = heap_openrv(relrv, AccessShareLock); + rel = relation_openrv(relrv, AccessShareLock); + + if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("\"%s\" is a partitioned table", + RelationGetRelationName(rel)), + errdetail("Partitioned tables do not contain rows."))); + else if (rel->rd_rel->relkind != RELKIND_RELATION) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("\"%s\" is not a table", + RelationGetRelationName(rel)))); /* * check permissions: must have SELECT on table or be in @@ -153,7 +165,7 @@ pgrowlocks(PG_FUNCTION_ARGS) values = (char **) palloc(mydata->ncolumns * sizeof(char *)); values[Atnum_tid] = (char *) DirectFunctionCall1(tidout, - PointerGetDatum(&tuple->t_self)); + PointerGetDatum(&tuple->t_self)); values[Atnum_xmax] = palloc(NCHARS * sizeof(char)); snprintf(values[Atnum_xmax], NCHARS, "%d", xmax); diff --git a/contrib/pgstattuple/pgstatapprox.c b/contrib/pgstattuple/pgstatapprox.c index 9facf65137..5bf06138a5 100644 --- a/contrib/pgstattuple/pgstatapprox.c +++ b/contrib/pgstattuple/pgstatapprox.c @@ -182,10 +182,10 @@ statapprox_heap(Relation rel, output_type *stat) UnlockReleaseBuffer(buf); } - stat->table_len = (uint64) nblocks *BLCKSZ; + stat->table_len = (uint64) nblocks * BLCKSZ; stat->tuple_count = vac_estimate_reltuples(rel, false, nblocks, scanned, - stat->tuple_count + misc_count); + stat->tuple_count + misc_count); /* * Calculate percentages if the relation has one or more pages. diff --git a/contrib/pgstattuple/pgstatindex.c b/contrib/pgstattuple/pgstatindex.c index 03b387f6b6..44e322d1f9 100644 --- a/contrib/pgstattuple/pgstatindex.c +++ b/contrib/pgstattuple/pgstatindex.c @@ -333,7 +333,7 @@ pgstatindex_impl(Relation rel, FunctionCallInfo fcinfo) values[j++] = psprintf("%d", indexStat.version); values[j++] = psprintf("%d", indexStat.level); values[j++] = psprintf(INT64_FORMAT, - (1 + /* include the metapage in index_size */ + (1 + /* include the metapage in index_size */ indexStat.leaf_pages + indexStat.internal_pages + indexStat.deleted_pages + @@ -535,7 +535,7 @@ pgstatginindex_internal(Oid relid, FunctionCallInfo fcinfo) if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot access temporary indexes of other sessions"))); + errmsg("cannot access temporary indexes of other sessions"))); /* * Read metapage @@ -613,7 +613,7 @@ pgstathashindex(PG_FUNCTION_ARGS) if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot access temporary indexes of other sessions"))); + errmsg("cannot access temporary indexes of other sessions"))); /* Get the information we need from the metapage. */ memset(&stats, 0, sizeof(stats)); @@ -648,9 +648,9 @@ pgstathashindex(PG_FUNCTION_ARGS) MAXALIGN(sizeof(HashPageOpaqueData))) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("index \"%s\" contains corrupted page at block %u", - RelationGetRelationName(rel), - BufferGetBlockNumber(buf)))); + errmsg("index \"%s\" contains corrupted page at block %u", + RelationGetRelationName(rel), + BufferGetBlockNumber(buf)))); else { HashPageOpaque opaque; @@ -677,7 +677,7 @@ pgstathashindex(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), errmsg("unexpected page type 0x%04X in HASH index \"%s\" block %u", - opaque->hasho_flag, RelationGetRelationName(rel), + opaque->hasho_flag, RelationGetRelationName(rel), BufferGetBlockNumber(buf)))); } UnlockReleaseBuffer(buf); diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c index eb02ec5b89..7a91cc3468 100644 --- a/contrib/pgstattuple/pgstattuple.c +++ b/contrib/pgstattuple/pgstattuple.c @@ -62,7 +62,7 @@ typedef struct pgstattuple_type } pgstattuple_type; typedef void (*pgstat_page) (pgstattuple_type *, Relation, BlockNumber, - BufferAccessStrategy); + BufferAccessStrategy); static Datum build_pgstattuple_type(pgstattuple_type *stat, FunctionCallInfo fcinfo); @@ -386,7 +386,7 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo) heap_endscan(scan); relation_close(rel, AccessShareLock); - stat.table_len = (uint64) nblocks *BLCKSZ; + stat.table_len = (uint64) nblocks * BLCKSZ; return build_pgstattuple_type(&stat, fcinfo); } @@ -531,7 +531,7 @@ pgstat_index(Relation rel, BlockNumber start, pgstat_page pagefn, /* Quit if we've scanned the whole relation */ if (blkno >= nblocks) { - stat.table_len = (uint64) nblocks *BLCKSZ; + stat.table_len = (uint64) nblocks * BLCKSZ; break; } diff --git a/contrib/postgres_fdw/connection.c b/contrib/postgres_fdw/connection.c index 1b691fb05e..8c33dea845 100644 --- a/contrib/postgres_fdw/connection.c +++ b/contrib/postgres_fdw/connection.c @@ -241,10 +241,10 @@ connect_pg_server(ForeignServer *server, UserMapping *user) conn = PQconnectdbParams(keywords, values, false); if (!conn || PQstatus(conn) != CONNECTION_OK) ereport(ERROR, - (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), - errmsg("could not connect to server \"%s\"", - server->servername), - errdetail_internal("%s", pchomp(PQerrorMessage(conn))))); + (errcode(ERRCODE_SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION), + errmsg("could not connect to server \"%s\"", + server->servername), + errdetail_internal("%s", pchomp(PQerrorMessage(conn))))); /* * Check that non-superuser has used password to establish connection; @@ -253,10 +253,10 @@ connect_pg_server(ForeignServer *server, UserMapping *user) */ if (!superuser() && !PQconnectionUsedPassword(conn)) ereport(ERROR, - (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), - errmsg("password is required"), - errdetail("Non-superuser cannot connect if the server does not request a password."), - errhint("Target server's authentication method must be changed."))); + (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED), + errmsg("password is required"), + errdetail("Non-superuser cannot connect if the server does not request a password."), + errhint("Target server's authentication method must be changed."))); /* Prepare new session for use */ configure_remote_session(conn); @@ -485,7 +485,7 @@ pgfdw_exec_query(PGconn *conn, const char *query) * * This function offers quick responsiveness by checking for any interruptions. * - * This function emulates the PQexec()'s behavior of returning the last result + * This function emulates PQexec()'s behavior of returning the last result * when there are many. * * Caller is responsible for the error handling on the result. @@ -493,40 +493,50 @@ pgfdw_exec_query(PGconn *conn, const char *query) PGresult * pgfdw_get_result(PGconn *conn, const char *query) { - PGresult *last_res = NULL; + PGresult *volatile last_res = NULL; - for (;;) + /* In what follows, do not leak any PGresults on an error. */ + PG_TRY(); { - PGresult *res; - - while (PQisBusy(conn)) + for (;;) { - int wc; + PGresult *res; - /* Sleep until there's something to do */ - wc = WaitLatchOrSocket(MyLatch, - WL_LATCH_SET | WL_SOCKET_READABLE, - PQsocket(conn), - -1L, PG_WAIT_EXTENSION); - ResetLatch(MyLatch); + while (PQisBusy(conn)) + { + int wc; - CHECK_FOR_INTERRUPTS(); + /* Sleep until there's something to do */ + wc = WaitLatchOrSocket(MyLatch, + WL_LATCH_SET | WL_SOCKET_READABLE, + PQsocket(conn), + -1L, PG_WAIT_EXTENSION); + ResetLatch(MyLatch); - /* Data available in socket */ - if (wc & WL_SOCKET_READABLE) - { - if (!PQconsumeInput(conn)) - pgfdw_report_error(ERROR, NULL, conn, false, query); + CHECK_FOR_INTERRUPTS(); + + /* Data available in socket? */ + if (wc & WL_SOCKET_READABLE) + { + if (!PQconsumeInput(conn)) + pgfdw_report_error(ERROR, NULL, conn, false, query); + } } - } - res = PQgetResult(conn); - if (res == NULL) - break; /* query is complete */ + res = PQgetResult(conn); + if (res == NULL) + break; /* query is complete */ + PQclear(last_res); + last_res = res; + } + } + PG_CATCH(); + { PQclear(last_res); - last_res = res; + PG_RE_THROW(); } + PG_END_TRY(); return last_res; } @@ -579,7 +589,7 @@ pgfdw_report_error(int elevel, PGresult *res, PGconn *conn, (errcode(sqlstate), message_primary ? errmsg_internal("%s", message_primary) : errmsg("could not obtain message string for remote error"), - message_detail ? errdetail_internal("%s", message_detail) : 0, + message_detail ? errdetail_internal("%s", message_detail) : 0, message_hint ? errhint("%s", message_hint) : 0, message_context ? errcontext("%s", message_context) : 0, sql ? errcontext("Remote SQL command: %s", sql) : 0)); @@ -1006,6 +1016,7 @@ pgfdw_exec_cleanup_query(PGconn *conn, const char *query, bool ignore_errors) pgfdw_report_error(WARNING, result, conn, true, query); return ignore_errors; } + PQclear(result); return true; } @@ -1028,56 +1039,75 @@ pgfdw_exec_cleanup_query(PGconn *conn, const char *query, bool ignore_errors) static bool pgfdw_get_cleanup_result(PGconn *conn, TimestampTz endtime, PGresult **result) { - PGresult *last_res = NULL; + volatile bool timed_out = false; + PGresult *volatile last_res = NULL; - for (;;) + /* In what follows, do not leak any PGresults on an error. */ + PG_TRY(); { - PGresult *res; - - while (PQisBusy(conn)) + for (;;) { - int wc; - TimestampTz now = GetCurrentTimestamp(); - long secs; - int microsecs; - long cur_timeout; - - /* If timeout has expired, give up, else get sleep time. */ - if (now >= endtime) - return true; - TimestampDifference(now, endtime, &secs, µsecs); - - /* To protect against clock skew, limit sleep to one minute. */ - cur_timeout = Min(60000, secs * USECS_PER_SEC + microsecs); - - /* Sleep until there's something to do */ - wc = WaitLatchOrSocket(MyLatch, - WL_LATCH_SET | WL_SOCKET_READABLE | WL_TIMEOUT, - PQsocket(conn), - cur_timeout, PG_WAIT_EXTENSION); - ResetLatch(MyLatch); - - CHECK_FOR_INTERRUPTS(); - - /* Data available in socket */ - if (wc & WL_SOCKET_READABLE) + PGresult *res; + + while (PQisBusy(conn)) { - if (!PQconsumeInput(conn)) + int wc; + TimestampTz now = GetCurrentTimestamp(); + long secs; + int microsecs; + long cur_timeout; + + /* If timeout has expired, give up, else get sleep time. */ + if (now >= endtime) { - *result = NULL; - return false; + timed_out = true; + goto exit; + } + TimestampDifference(now, endtime, &secs, µsecs); + + /* To protect against clock skew, limit sleep to one minute. */ + cur_timeout = Min(60000, secs * USECS_PER_SEC + microsecs); + + /* Sleep until there's something to do */ + wc = WaitLatchOrSocket(MyLatch, + WL_LATCH_SET | WL_SOCKET_READABLE | WL_TIMEOUT, + PQsocket(conn), + cur_timeout, PG_WAIT_EXTENSION); + ResetLatch(MyLatch); + + CHECK_FOR_INTERRUPTS(); + + /* Data available in socket? */ + if (wc & WL_SOCKET_READABLE) + { + if (!PQconsumeInput(conn)) + { + /* connection trouble; treat the same as a timeout */ + timed_out = true; + goto exit; + } } } - } - res = PQgetResult(conn); - if (res == NULL) - break; /* query is complete */ + res = PQgetResult(conn); + if (res == NULL) + break; /* query is complete */ + PQclear(last_res); + last_res = res; + } +exit: ; + } + PG_CATCH(); + { PQclear(last_res); - last_res = res; + PG_RE_THROW(); } + PG_END_TRY(); - *result = last_res; - return false; + if (timed_out) + PQclear(last_res); + else + *result = last_res; + return timed_out; } diff --git a/contrib/postgres_fdw/deparse.c b/contrib/postgres_fdw/deparse.c index 482a3dd301..2af8364010 100644 --- a/contrib/postgres_fdw/deparse.c +++ b/contrib/postgres_fdw/deparse.c @@ -168,7 +168,7 @@ static void deparseLockingClause(deparse_expr_cxt *context); static void appendOrderByClause(List *pathkeys, deparse_expr_cxt *context); static void appendConditions(List *exprs, deparse_expr_cxt *context); static void deparseFromExprForRel(StringInfo buf, PlannerInfo *root, - RelOptInfo *joinrel, bool use_alias, List **params_list); + RelOptInfo *joinrel, bool use_alias, List **params_list); static void deparseFromExpr(List *quals, deparse_expr_cxt *context); static void deparseRangeTblRef(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel, bool make_subquery, @@ -728,7 +728,7 @@ foreign_expr_walker(Node *node, agg->args); sortcoltype = exprType((Node *) tle->expr); typentry = lookup_type_cache(sortcoltype, - TYPECACHE_LT_OPR | TYPECACHE_GT_OPR); + TYPECACHE_LT_OPR | TYPECACHE_GT_OPR); /* Check shippability of non-default sort operator. */ if (srt->sortop != typentry->lt_opr && srt->sortop != typentry->gt_opr && @@ -883,8 +883,8 @@ build_tlist_to_deparse(RelOptInfo *foreignrel) * required for evaluating the local conditions. */ tlist = add_to_flat_tlist(tlist, - pull_var_clause((Node *) foreignrel->reltarget->exprs, - PVC_RECURSE_PLACEHOLDERS)); + pull_var_clause((Node *) foreignrel->reltarget->exprs, + PVC_RECURSE_PLACEHOLDERS)); foreach(lc, fpinfo->local_conds) { RestrictInfo *rinfo = lfirst_node(RestrictInfo, lc); @@ -1434,7 +1434,7 @@ deparseFromExprForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel, * ((outer relation) <join type> (inner relation) ON (joinclauses)) */ appendStringInfo(buf, "(%s %s JOIN %s ON ", join_sql_o.data, - get_jointype_name(fpinfo->jointype), join_sql_i.data); + get_jointype_name(fpinfo->jointype), join_sql_i.data); /* Append join clause; (TRUE) if no join clause */ if (fpinfo->joinclauses) @@ -1596,7 +1596,7 @@ deparseInsertSql(StringInfo buf, PlannerInfo *root, appendStringInfoString(buf, " ON CONFLICT DO NOTHING"); deparseReturningList(buf, root, rtindex, rel, - rel->trigdesc && rel->trigdesc->trig_insert_after_row, + rel->trigdesc && rel->trigdesc->trig_insert_after_row, returningList, retrieved_attrs); } @@ -1638,7 +1638,7 @@ deparseUpdateSql(StringInfo buf, PlannerInfo *root, appendStringInfoString(buf, " WHERE ctid = $1"); deparseReturningList(buf, root, rtindex, rel, - rel->trigdesc && rel->trigdesc->trig_update_after_row, + rel->trigdesc && rel->trigdesc->trig_update_after_row, returningList, retrieved_attrs); } @@ -1728,7 +1728,7 @@ deparseDeleteSql(StringInfo buf, PlannerInfo *root, appendStringInfoString(buf, " WHERE ctid = $1"); deparseReturningList(buf, root, rtindex, rel, - rel->trigdesc && rel->trigdesc->trig_delete_after_row, + rel->trigdesc && rel->trigdesc->trig_delete_after_row, returningList, retrieved_attrs); } diff --git a/contrib/postgres_fdw/option.c b/contrib/postgres_fdw/option.c index e24db569ea..67e1c59951 100644 --- a/contrib/postgres_fdw/option.c +++ b/contrib/postgres_fdw/option.c @@ -196,7 +196,7 @@ InitPgFdwOptions(void) ereport(ERROR, (errcode(ERRCODE_FDW_OUT_OF_MEMORY), errmsg("out of memory"), - errdetail("could not get libpq's default connection options"))); + errdetail("could not get libpq's default connection options"))); /* Count how many libpq options are available. */ num_libpq_opts = 0; @@ -258,7 +258,7 @@ is_valid_option(const char *keyword, Oid context) { PgFdwOption *opt; - Assert(postgres_fdw_options); /* must be initialized already */ + Assert(postgres_fdw_options); /* must be initialized already */ for (opt = postgres_fdw_options; opt->keyword; opt++) { @@ -277,7 +277,7 @@ is_libpq_option(const char *keyword) { PgFdwOption *opt; - Assert(postgres_fdw_options); /* must be initialized already */ + Assert(postgres_fdw_options); /* must be initialized already */ for (opt = postgres_fdw_options; opt->keyword; opt++) { diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c index 080cb0a074..7214666e10 100644 --- a/contrib/postgres_fdw/postgres_fdw.c +++ b/contrib/postgres_fdw/postgres_fdw.c @@ -756,10 +756,10 @@ get_useful_ecs_for_relation(PlannerInfo *root, RelOptInfo *rel) */ if (bms_overlap(relids, restrictinfo->right_ec->ec_relids)) useful_eclass_list = list_append_unique_ptr(useful_eclass_list, - restrictinfo->right_ec); + restrictinfo->right_ec); else if (bms_overlap(relids, restrictinfo->left_ec->ec_relids)) useful_eclass_list = list_append_unique_ptr(useful_eclass_list, - restrictinfo->left_ec); + restrictinfo->left_ec); } return useful_eclass_list; @@ -899,14 +899,14 @@ postgresGetForeignPaths(PlannerInfo *root, * to estimate cost and size of this path. */ path = create_foreignscan_path(root, baserel, - NULL, /* default pathtarget */ + NULL, /* default pathtarget */ fpinfo->rows, fpinfo->startup_cost, fpinfo->total_cost, NIL, /* no pathkeys */ - NULL, /* no outer rel either */ - NULL, /* no extra plan */ - NIL); /* no fdw_private list */ + NULL, /* no outer rel either */ + NULL, /* no extra plan */ + NIL); /* no fdw_private list */ add_path(baserel, (Path *) path); /* Add paths with pathkeys */ @@ -999,9 +999,9 @@ postgresGetForeignPaths(PlannerInfo *root, arg.current = NULL; clauses = generate_implied_equalities_for_column(root, baserel, - ec_member_matches_foreign, + ec_member_matches_foreign, (void *) &arg, - baserel->lateral_referencers); + baserel->lateral_referencers); /* Done if there are no more expressions in the foreign rel */ if (arg.current == NULL) @@ -1075,7 +1075,7 @@ postgresGetForeignPaths(PlannerInfo *root, rows, startup_cost, total_cost, - NIL, /* no pathkeys */ + NIL, /* no pathkeys */ param_info->ppi_req_outer, NULL, NIL); /* no fdw_private list */ @@ -1332,7 +1332,7 @@ postgresBeginForeignScan(ForeignScanState *node, int eflags) fsstate->query = strVal(list_nth(fsplan->fdw_private, FdwScanPrivateSelectSql)); fsstate->retrieved_attrs = (List *) list_nth(fsplan->fdw_private, - FdwScanPrivateRetrievedAttrs); + FdwScanPrivateRetrievedAttrs); fsstate->fetch_size = intVal(list_nth(fsplan->fdw_private, FdwScanPrivateFetchSize)); @@ -1591,7 +1591,7 @@ postgresPlanForeignModify(PlannerInfo *root, /* bit numbers are offset by FirstLowInvalidHeapAttributeNumber */ AttrNumber attno = col + FirstLowInvalidHeapAttributeNumber; - if (attno <= InvalidAttrNumber) /* shouldn't happen */ + if (attno <= InvalidAttrNumber) /* shouldn't happen */ elog(ERROR, "system-column update is not supported"); targetAttrs = lappend_int(targetAttrs, attno); } @@ -1710,7 +1710,7 @@ postgresBeginForeignModify(ModifyTableState *mtstate, fmstate->has_returning = intVal(list_nth(fdw_private, FdwModifyPrivateHasReturning)); fmstate->retrieved_attrs = (List *) list_nth(fdw_private, - FdwModifyPrivateRetrievedAttrs); + FdwModifyPrivateRetrievedAttrs); /* Create context for per-tuple temp workspace. */ fmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt, @@ -2173,7 +2173,7 @@ postgresPlanDirectModify(PlannerInfo *root, AttrNumber attno = col + FirstLowInvalidHeapAttributeNumber; TargetEntry *tle; - if (attno <= InvalidAttrNumber) /* shouldn't happen */ + if (attno <= InvalidAttrNumber) /* shouldn't happen */ elog(ERROR, "system-column update is not supported"); tle = get_tle_by_resno(subplan->targetlist, attno); @@ -2311,11 +2311,11 @@ postgresBeginDirectModify(ForeignScanState *node, int eflags) dmstate->query = strVal(list_nth(fsplan->fdw_private, FdwDirectModifyPrivateUpdateSql)); dmstate->has_returning = intVal(list_nth(fsplan->fdw_private, - FdwDirectModifyPrivateHasReturning)); + FdwDirectModifyPrivateHasReturning)); dmstate->retrieved_attrs = (List *) list_nth(fsplan->fdw_private, - FdwDirectModifyPrivateRetrievedAttrs); + FdwDirectModifyPrivateRetrievedAttrs); dmstate->set_processed = intVal(list_nth(fsplan->fdw_private, - FdwDirectModifyPrivateSetProcessed)); + FdwDirectModifyPrivateSetProcessed)); /* Create context for per-tuple temp workspace. */ dmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt, @@ -2725,8 +2725,8 @@ estimate_path_cost_size(PlannerInfo *root, /* Get number of grouping columns and possible number of groups */ numGroupCols = list_length(root->parse->groupClause); numGroups = estimate_num_groups(root, - get_sortgrouplist_exprs(root->parse->groupClause, - fpinfo->grouped_tlist), + get_sortgrouplist_exprs(root->parse->groupClause, + fpinfo->grouped_tlist), input_rows, NULL); /* @@ -3763,7 +3763,7 @@ analyze_row_processor(PGresult *res, int row, PgFdwAnalyzeState *astate) astate->rows[pos] = make_tuple_from_result_row(res, row, astate->rel, astate->attinmeta, - astate->retrieved_attrs, + astate->retrieved_attrs, NULL, astate->temp_cxt); @@ -3836,8 +3836,8 @@ postgresImportForeignSchema(ImportForeignSchemaStmt *stmt, Oid serverOid) if (PQntuples(res) != 1) ereport(ERROR, (errcode(ERRCODE_FDW_SCHEMA_NOT_FOUND), - errmsg("schema \"%s\" is not present on foreign server \"%s\"", - stmt->remote_schema, server->servername))); + errmsg("schema \"%s\" is not present on foreign server \"%s\"", + stmt->remote_schema, server->servername))); PQclear(res); res = NULL; @@ -4205,23 +4205,23 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, { case JOIN_INNER: fpinfo->remote_conds = list_concat(fpinfo->remote_conds, - list_copy(fpinfo_i->remote_conds)); + list_copy(fpinfo_i->remote_conds)); fpinfo->remote_conds = list_concat(fpinfo->remote_conds, - list_copy(fpinfo_o->remote_conds)); + list_copy(fpinfo_o->remote_conds)); break; case JOIN_LEFT: fpinfo->joinclauses = list_concat(fpinfo->joinclauses, - list_copy(fpinfo_i->remote_conds)); + list_copy(fpinfo_i->remote_conds)); fpinfo->remote_conds = list_concat(fpinfo->remote_conds, - list_copy(fpinfo_o->remote_conds)); + list_copy(fpinfo_o->remote_conds)); break; case JOIN_RIGHT: fpinfo->joinclauses = list_concat(fpinfo->joinclauses, - list_copy(fpinfo_o->remote_conds)); + list_copy(fpinfo_o->remote_conds)); fpinfo->remote_conds = list_concat(fpinfo->remote_conds, - list_copy(fpinfo_i->remote_conds)); + list_copy(fpinfo_i->remote_conds)); break; case JOIN_FULL: @@ -4305,7 +4305,7 @@ foreign_join_ok(PlannerInfo *root, RelOptInfo *joinrel, JoinType jointype, * Note that since this joinrel is at the end of the join_rel_list list * when we are called, we can get the position by list_length. */ - Assert(fpinfo->relation_index == 0); /* shouldn't be set yet */ + Assert(fpinfo->relation_index == 0); /* shouldn't be set yet */ fpinfo->relation_index = list_length(root->parse->rtable) + list_length(root->join_rel_list); @@ -4316,7 +4316,7 @@ static void add_paths_with_pathkeys_for_rel(PlannerInfo *root, RelOptInfo *rel, Path *epq_path) { - List *useful_pathkeys_list = NIL; /* List of all pathkeys */ + List *useful_pathkeys_list = NIL; /* List of all pathkeys */ ListCell *lc; useful_pathkeys_list = get_useful_pathkeys_for_relation(root, rel); @@ -4568,7 +4568,7 @@ postgresGetForeignJoinPaths(PlannerInfo *root, rows, startup_cost, total_cost, - NIL, /* no pathkeys */ + NIL, /* no pathkeys */ NULL, /* no required_outer */ epq_path, NIL); /* no fdw_private */ diff --git a/contrib/postgres_fdw/postgres_fdw.h b/contrib/postgres_fdw/postgres_fdw.h index 25c950dd76..788b003650 100644 --- a/contrib/postgres_fdw/postgres_fdw.h +++ b/contrib/postgres_fdw/postgres_fdw.h @@ -176,10 +176,10 @@ extern void deparseSelectStmtForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel, List *tlist, List *remote_conds, List *pathkeys, bool is_subquery, List **retrieved_attrs, List **params_list); +extern const char *get_jointype_name(JoinType jointype); /* in shippable.c */ extern bool is_builtin(Oid objectId); extern bool is_shippable(Oid objectId, Oid classId, PgFdwRelationInfo *fpinfo); -extern const char *get_jointype_name(JoinType jointype); -#endif /* POSTGRES_FDW_H */ +#endif /* POSTGRES_FDW_H */ diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index 61e72937ee..4fc18130e1 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -558,7 +558,7 @@ Datum seg_same(PG_FUNCTION_ARGS) { int cmp = DatumGetInt32( - DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); + DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(cmp == 0); } @@ -848,7 +848,7 @@ Datum seg_lt(PG_FUNCTION_ARGS) { int cmp = DatumGetInt32( - DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); + DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(cmp < 0); } @@ -857,7 +857,7 @@ Datum seg_le(PG_FUNCTION_ARGS) { int cmp = DatumGetInt32( - DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); + DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(cmp <= 0); } @@ -866,7 +866,7 @@ Datum seg_gt(PG_FUNCTION_ARGS) { int cmp = DatumGetInt32( - DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); + DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(cmp > 0); } @@ -875,7 +875,7 @@ Datum seg_ge(PG_FUNCTION_ARGS) { int cmp = DatumGetInt32( - DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); + DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(cmp >= 0); } @@ -885,7 +885,7 @@ Datum seg_different(PG_FUNCTION_ARGS) { int cmp = DatumGetInt32( - DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); + DirectFunctionCall2(seg_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(cmp != 0); } diff --git a/contrib/sepgsql/hooks.c b/contrib/sepgsql/hooks.c index dadf99e74b..dc1d1a1d39 100644 --- a/contrib/sepgsql/hooks.c +++ b/contrib/sepgsql/hooks.c @@ -52,7 +52,7 @@ typedef struct * command. Elsewhere (including the case of default) NULL. */ const char *createdb_dtemplate; -} sepgsql_context_info_t; +} sepgsql_context_info_t; static sepgsql_context_info_t sepgsql_context_info; @@ -108,7 +108,7 @@ sepgsql_object_access(ObjectAccessType access, case DatabaseRelationId: Assert(!is_internal); sepgsql_database_post_create(objectId, - sepgsql_context_info.createdb_dtemplate); + sepgsql_context_info.createdb_dtemplate); break; case NamespaceRelationId: @@ -402,7 +402,7 @@ _PG_init(void) if (IsUnderPostmaster) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("sepgsql must be loaded via shared_preload_libraries"))); + errmsg("sepgsql must be loaded via shared_preload_libraries"))); /* * Check availability of SELinux on the platform. If disabled, we cannot diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 6239800189..cbb9249be7 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -68,17 +68,17 @@ static fmgr_hook_type next_fmgr_hook = NULL; * labels were set during the (sub-)transactions. */ static char *client_label_peer = NULL; /* set by getpeercon(3) */ -static List *client_label_pending = NIL; /* pending list being set by - * sepgsql_setcon() */ -static char *client_label_committed = NULL; /* set by sepgsql_setcon(), - * and already committed */ +static List *client_label_pending = NIL; /* pending list being set by + * sepgsql_setcon() */ +static char *client_label_committed = NULL; /* set by sepgsql_setcon(), and + * already committed */ static char *client_label_func = NULL; /* set by trusted procedure */ typedef struct { SubTransactionId subid; char *label; -} pending_label; +} pending_label; /* * sepgsql_get_client_label @@ -477,7 +477,7 @@ sepgsql_get_label(Oid classId, Oid objectId, int32 subId) if (security_get_initial_context_raw("unlabeled", &unlabeled) < 0) ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("SELinux: failed to get initial security label: %m"))); + errmsg("SELinux: failed to get initial security label: %m"))); PG_TRY(); { label = pstrdup(unlabeled); @@ -510,7 +510,7 @@ sepgsql_object_relabel(const ObjectAddress *object, const char *seclabel) security_check_context_raw((security_context_t) seclabel) < 0) ereport(ERROR, (errcode(ERRCODE_INVALID_NAME), - errmsg("SELinux: invalid security label: \"%s\"", seclabel))); + errmsg("SELinux: invalid security label: \"%s\"", seclabel))); /* * Do actual permission checks for each object classes @@ -721,7 +721,7 @@ quote_object_name(const char *src1, const char *src2, * catalog OID. */ static void -exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId) +exec_object_restorecon(struct selabel_handle *sehnd, Oid catalogId) { Relation rel; SysScanDesc sscan; @@ -925,7 +925,7 @@ sepgsql_restorecon(PG_FUNCTION_ARGS) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("SELinux: must be superuser to restore initial contexts"))); + errmsg("SELinux: must be superuser to restore initial contexts"))); /* * Open selabel_lookup(3) stuff. It provides a set of mapping between an @@ -945,7 +945,7 @@ sepgsql_restorecon(PG_FUNCTION_ARGS) if (!sehnd) ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("SELinux: failed to initialize labeling handle: %m"))); + errmsg("SELinux: failed to initialize labeling handle: %m"))); PG_TRY(); { exec_object_restorecon(sehnd, DatabaseRelationId); diff --git a/contrib/sepgsql/proc.c b/contrib/sepgsql/proc.c index 73564edaa7..14faa5fac6 100644 --- a/contrib/sepgsql/proc.c +++ b/contrib/sepgsql/proc.c @@ -106,7 +106,7 @@ sepgsql_proc_post_create(Oid functionId) initStringInfo(&audit_name); nsp_name = get_namespace_name(proForm->pronamespace); appendStringInfo(&audit_name, "%s(", - quote_qualified_identifier(nsp_name, NameStr(proForm->proname))); + quote_qualified_identifier(nsp_name, NameStr(proForm->proname))); for (i = 0; i < proForm->pronargs; i++) { if (i > 0) diff --git a/contrib/sepgsql/selinux.c b/contrib/sepgsql/selinux.c index 7728a18333..bf89e83dd6 100644 --- a/contrib/sepgsql/selinux.c +++ b/contrib/sepgsql/selinux.c @@ -36,7 +36,7 @@ static struct const char *av_name; uint32 av_code; } av[32]; -} selinux_catalog[] = +} selinux_catalog[] = { { @@ -732,7 +732,7 @@ void sepgsql_compute_avd(const char *scontext, const char *tcontext, uint16 tclass, - struct av_decision * avd) + struct av_decision *avd) { const char *tclass_name; security_class_t tclass_ex; diff --git a/contrib/sepgsql/sepgsql.h b/contrib/sepgsql/sepgsql.h index 9d245c2780..d4bf0cd14a 100644 --- a/contrib/sepgsql/sepgsql.h +++ b/contrib/sepgsql/sepgsql.h @@ -235,7 +235,7 @@ extern void sepgsql_audit_log(bool denied, extern void sepgsql_compute_avd(const char *scontext, const char *tcontext, uint16 tclass, - struct av_decision * avd); + struct av_decision *avd); extern char *sepgsql_compute_create(const char *scontext, const char *tcontext, @@ -324,4 +324,4 @@ extern void sepgsql_proc_relabel(Oid functionId, const char *seclabel); extern void sepgsql_proc_setattr(Oid functionId); extern void sepgsql_proc_execute(Oid functionId); -#endif /* SEPGSQL_H */ +#endif /* SEPGSQL_H */ diff --git a/contrib/sepgsql/uavc.c b/contrib/sepgsql/uavc.c index 6fd58c7e42..f0915918db 100644 --- a/contrib/sepgsql/uavc.c +++ b/contrib/sepgsql/uavc.c @@ -45,7 +45,7 @@ typedef struct /* true, if tcontext is valid */ char *ncontext; /* temporary scontext on execution of trusted * procedure, or NULL elsewhere */ -} avc_cache; +} avc_cache; /* * Declaration of static variables @@ -182,7 +182,7 @@ sepgsql_avc_unlabeled(void) if (security_get_initial_context_raw("unlabeled", &unlabeled) < 0) ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("SELinux: failed to get initial security label: %m"))); + errmsg("SELinux: failed to get initial security label: %m"))); PG_TRY(); { avc_unlabeled = MemoryContextStrdup(avc_mem_cxt, unlabeled); diff --git a/contrib/spi/refint.c b/contrib/spi/refint.c index 208ff6103d..46205c7613 100644 --- a/contrib/spi/refint.c +++ b/contrib/spi/refint.c @@ -175,7 +175,7 @@ check_primary_key(PG_FUNCTION_ARGS) for (i = 0; i < nkeys; i++) { snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), "%s = $%d %s", - args[i + nkeys + 1], i + 1, (i < nkeys - 1) ? "and " : ""); + args[i + nkeys + 1], i + 1, (i < nkeys - 1) ? "and " : ""); } /* Prepare plan for query */ @@ -248,7 +248,7 @@ check_foreign_key(PG_FUNCTION_ARGS) Datum *kvals; /* key values */ char *relname; /* referencing relation name */ Relation rel; /* triggered relation */ - HeapTuple trigtuple = NULL; /* tuple to being changed */ + HeapTuple trigtuple = NULL; /* tuple to being changed */ HeapTuple newtuple = NULL; /* tuple to return */ TupleDesc tupdesc; /* tuple description */ EPlan *plan; /* prepared plan(s) */ diff --git a/contrib/spi/timetravel.c b/contrib/spi/timetravel.c index 19bf8a892c..f7905e20db 100644 --- a/contrib/spi/timetravel.c +++ b/contrib/spi/timetravel.c @@ -85,7 +85,7 @@ timetravel(PG_FUNCTION_ARGS) Trigger *trigger; /* to get trigger name */ int argc; char **args; /* arguments */ - int attnum[MaxAttrNum]; /* fnumbers of start/stop columns */ + int attnum[MaxAttrNum]; /* fnumbers of start/stop columns */ Datum oldtimeon, oldtimeoff; Datum newtimeon, @@ -461,7 +461,7 @@ set_timetravel(PG_FUNCTION_ARGS) s = rname = DatumGetCString(DirectFunctionCall1(nameout, NameGetDatum(relname))); if (s) { - pp = malloc(offsetof(TTOffList, name) +strlen(rname) + 1); + pp = malloc(offsetof(TTOffList, name) + strlen(rname) + 1); if (pp) { pp->next = NULL; diff --git a/contrib/sslinfo/sslinfo.c b/contrib/sslinfo/sslinfo.c index 42846436eb..5ba3988e27 100644 --- a/contrib/sslinfo/sslinfo.c +++ b/contrib/sslinfo/sslinfo.c @@ -484,8 +484,8 @@ ssl_extension_info(PG_FUNCTION_ARGS) if (nid == NID_undef) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("unknown OpenSSL extension in certificate at position %d", - call_cntr))); + errmsg("unknown OpenSSL extension in certificate at position %d", + call_cntr))); values[0] = CStringGetTextDatum(OBJ_nid2sn(nid)); nulls[0] = false; diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c index 7434ca9373..0bc8177b61 100644 --- a/contrib/tablefunc/tablefunc.c +++ b/contrib/tablefunc/tablefunc.c @@ -684,7 +684,7 @@ crosstab_hash(PG_FUNCTION_ARGS) crosstab_hash, tupdesc, per_query_ctx, - rsinfo->allowedModes & SFRM_Materialize_Random); + rsinfo->allowedModes & SFRM_Materialize_Random); /* * SFRM_Materialize mode expects us to return a NULL Datum. The actual @@ -1046,7 +1046,7 @@ connectby_text(PG_FUNCTION_ARGS) show_branch, show_serial, per_query_ctx, - rsinfo->allowedModes & SFRM_Materialize_Random, + rsinfo->allowedModes & SFRM_Materialize_Random, attinmeta); rsinfo->setDesc = tupdesc; @@ -1126,7 +1126,7 @@ connectby_text_serial(PG_FUNCTION_ARGS) show_branch, show_serial, per_query_ctx, - rsinfo->allowedModes & SFRM_Materialize_Random, + rsinfo->allowedModes & SFRM_Materialize_Random, attinmeta); rsinfo->setDesc = tupdesc; @@ -1187,8 +1187,8 @@ connectby(char *relname, branch_delim, start_with, start_with, /* current_branch */ - 0, /* initial level is 0 */ - &serial, /* initial serial is 1 */ + 0, /* initial level is 0 */ + &serial, /* initial serial is 1 */ max_depth, show_branch, show_serial, @@ -1475,17 +1475,17 @@ validateConnectbyTupleDesc(TupleDesc tupdesc, bool show_branch, bool show_serial if (show_branch && show_serial && tupdesc->attrs[4]->atttypid != INT4OID) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("query-specified return tuple not valid for Connectby: " - "fifth column must be type %s", - format_type_be(INT4OID)))); + errmsg("query-specified return tuple not valid for Connectby: " + "fifth column must be type %s", + format_type_be(INT4OID)))); /* check that the type of the fifth column is INT4 */ if (!show_branch && show_serial && tupdesc->attrs[3]->atttypid != INT4OID) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("query-specified return tuple not valid for Connectby: " - "fourth column must be type %s", - format_type_be(INT4OID)))); + errmsg("query-specified return tuple not valid for Connectby: " + "fourth column must be type %s", + format_type_be(INT4OID)))); /* OK, the tupdesc is valid for our purposes */ } @@ -1525,8 +1525,8 @@ compatConnectbyTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc) errmsg("invalid return type"), errdetail("SQL key field type %s does " \ "not match return key field type %s.", - format_type_with_typemod(ret_atttypid, ret_atttypmod), - format_type_with_typemod(sql_atttypid, sql_atttypmod)))); + format_type_with_typemod(ret_atttypid, ret_atttypmod), + format_type_with_typemod(sql_atttypid, sql_atttypmod)))); ret_atttypid = ret_tupdesc->attrs[1]->atttypid; sql_atttypid = sql_tupdesc->attrs[1]->atttypid; @@ -1539,8 +1539,8 @@ compatConnectbyTupleDescs(TupleDesc ret_tupdesc, TupleDesc sql_tupdesc) errmsg("invalid return type"), errdetail("SQL parent key field type %s does " \ "not match return parent key field type %s.", - format_type_with_typemod(ret_atttypid, ret_atttypmod), - format_type_with_typemod(sql_atttypid, sql_atttypmod)))); + format_type_with_typemod(ret_atttypid, ret_atttypmod), + format_type_with_typemod(sql_atttypid, sql_atttypmod)))); /* OK, the two tupdescs are compatible for our purposes */ } diff --git a/contrib/tablefunc/tablefunc.h b/contrib/tablefunc/tablefunc.h index 87fa1e5dcb..e88a5720fa 100644 --- a/contrib/tablefunc/tablefunc.h +++ b/contrib/tablefunc/tablefunc.h @@ -36,4 +36,4 @@ #include "fmgr.h" -#endif /* TABLEFUNC_H */ +#endif /* TABLEFUNC_H */ diff --git a/contrib/tcn/tcn.c b/contrib/tcn/tcn.c index 124110830f..0b9acbf848 100644 --- a/contrib/tcn/tcn.c +++ b/contrib/tcn/tcn.c @@ -73,7 +73,7 @@ triggered_change_notification(PG_FUNCTION_ARGS) if (!CALLED_AS_TRIGGER(fcinfo)) ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("triggered_change_notification: must be called as trigger"))); + errmsg("triggered_change_notification: must be called as trigger"))); /* and that it's called after the change */ if (!TRIGGER_FIRED_AFTER(trigdata->tg_event)) @@ -132,7 +132,7 @@ triggered_change_notification(PG_FUNCTION_ARGS) Form_pg_index index; indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid)); - if (!HeapTupleIsValid(indexTuple)) /* should not happen */ + if (!HeapTupleIsValid(indexTuple)) /* should not happen */ elog(ERROR, "cache lookup failed for index %u", indexoid); index = (Form_pg_index) GETSTRUCT(indexTuple); /* we're only interested if it is the primary key and valid */ @@ -175,5 +175,5 @@ triggered_change_notification(PG_FUNCTION_ARGS) (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), errmsg("triggered_change_notification: must be called on a table with a primary key"))); - return PointerGetDatum(NULL); /* after trigger; value doesn't matter */ + return PointerGetDatum(NULL); /* after trigger; value doesn't matter */ } diff --git a/contrib/test_decoding/test_decoding.c b/contrib/test_decoding/test_decoding.c index 21cfd673c6..a1a7c2ae0c 100644 --- a/contrib/test_decoding/test_decoding.c +++ b/contrib/test_decoding/test_decoding.c @@ -126,8 +126,8 @@ pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, else if (!parse_bool(strVal(elem->arg), &data->include_xids)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not parse value \"%s\" for parameter \"%s\"", - strVal(elem->arg), elem->defname))); + errmsg("could not parse value \"%s\" for parameter \"%s\"", + strVal(elem->arg), elem->defname))); } else if (strcmp(elem->defname, "include-timestamp") == 0) { @@ -136,8 +136,8 @@ pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, else if (!parse_bool(strVal(elem->arg), &data->include_timestamp)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not parse value \"%s\" for parameter \"%s\"", - strVal(elem->arg), elem->defname))); + errmsg("could not parse value \"%s\" for parameter \"%s\"", + strVal(elem->arg), elem->defname))); } else if (strcmp(elem->defname, "force-binary") == 0) { @@ -148,8 +148,8 @@ pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, else if (!parse_bool(strVal(elem->arg), &force_binary)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not parse value \"%s\" for parameter \"%s\"", - strVal(elem->arg), elem->defname))); + errmsg("could not parse value \"%s\" for parameter \"%s\"", + strVal(elem->arg), elem->defname))); if (force_binary) opt->output_type = OUTPUT_PLUGIN_BINARY_OUTPUT; @@ -162,8 +162,8 @@ pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, else if (!parse_bool(strVal(elem->arg), &data->skip_empty_xacts)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not parse value \"%s\" for parameter \"%s\"", - strVal(elem->arg), elem->defname))); + errmsg("could not parse value \"%s\" for parameter \"%s\"", + strVal(elem->arg), elem->defname))); } else if (strcmp(elem->defname, "only-local") == 0) { @@ -173,8 +173,8 @@ pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, else if (!parse_bool(strVal(elem->arg), &data->only_local)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not parse value \"%s\" for parameter \"%s\"", - strVal(elem->arg), elem->defname))); + errmsg("could not parse value \"%s\" for parameter \"%s\"", + strVal(elem->arg), elem->defname))); } else { @@ -421,8 +421,8 @@ pg_decode_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, appendStringInfoString(ctx->out, quote_qualified_identifier( get_namespace_name( - get_rel_namespace(RelationGetRelid(relation))), - NameStr(class_form->relname))); + get_rel_namespace(RelationGetRelid(relation))), + NameStr(class_form->relname))); appendStringInfoChar(ctx->out, ':'); switch (change->action) diff --git a/contrib/unaccent/unaccent.c b/contrib/unaccent/unaccent.c index 6a34cfd3ed..e08cca1707 100644 --- a/contrib/unaccent/unaccent.c +++ b/contrib/unaccent/unaccent.c @@ -67,7 +67,7 @@ placeChar(TrieChar *node, const unsigned char *str, int lenstr, if (curnode->replaceTo) ereport(WARNING, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("duplicate source strings, first one will be used"))); + errmsg("duplicate source strings, first one will be used"))); else { curnode->replacelen = replacelen; @@ -389,9 +389,9 @@ unaccent_dict(PG_FUNCTION_ARGS) dict = lookup_ts_dictionary_cache(dictOid); res = (TSLexeme *) DatumGetPointer(FunctionCall4(&(dict->lexize), - PointerGetDatum(dict->dictData), - PointerGetDatum(VARDATA_ANY(str)), - Int32GetDatum(VARSIZE_ANY_EXHDR(str)), + PointerGetDatum(dict->dictData), + PointerGetDatum(VARDATA_ANY(str)), + Int32GetDatum(VARSIZE_ANY_EXHDR(str)), PointerGetDatum(NULL))); PG_FREE_IF_COPY(str, strArg); diff --git a/contrib/uuid-ossp/uuid-ossp.c b/contrib/uuid-ossp/uuid-ossp.c index 1ce08555cf..55bc609415 100644 --- a/contrib/uuid-ossp/uuid-ossp.c +++ b/contrib/uuid-ossp/uuid-ossp.c @@ -110,7 +110,7 @@ do { \ uu.clock_seq_hi_and_reserved |= 0x80; \ } while(0) -#endif /* !HAVE_UUID_OSSP */ +#endif /* !HAVE_UUID_OSSP */ PG_MODULE_MAGIC; @@ -262,11 +262,11 @@ uuid_generate_internal(int v, unsigned char *ns, char *ptr, int len) switch (v) { - case 0: /* constant-value uuids */ + case 0: /* constant-value uuids */ strlcpy(strbuf, ptr, 37); break; - case 1: /* time/node-based uuids */ + case 1: /* time/node-based uuids */ { #ifdef HAVE_UUID_E2FS uuid_t uu; @@ -316,8 +316,8 @@ uuid_generate_internal(int v, unsigned char *ns, char *ptr, int len) break; } - case 3: /* namespace-based MD5 uuids */ - case 5: /* namespace-based SHA1 uuids */ + case 3: /* namespace-based MD5 uuids */ + case 5: /* namespace-based SHA1 uuids */ { dce_uuid_t uu; #ifdef HAVE_UUID_BSD @@ -373,7 +373,7 @@ uuid_generate_internal(int v, unsigned char *ns, char *ptr, int len) break; } - case 4: /* random uuid */ + case 4: /* random uuid */ default: { #ifdef HAVE_UUID_E2FS @@ -398,7 +398,7 @@ uuid_generate_internal(int v, unsigned char *ns, char *ptr, int len) return DirectFunctionCall1(uuid_in, CStringGetDatum(strbuf)); } -#endif /* HAVE_UUID_OSSP */ +#endif /* HAVE_UUID_OSSP */ Datum diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c index 887483cf0f..a4d4553303 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -47,7 +47,7 @@ struct _param long transaction_limit; }; -static int vacuumlo(const char *database, const struct _param * param); +static int vacuumlo(const char *database, const struct _param *param); static void usage(const char *progname); @@ -56,7 +56,7 @@ static void usage(const char *progname); * This vacuums LOs of one database. It returns 0 on success, -1 on failure. */ static int -vacuumlo(const char *database, const struct _param * param) +vacuumlo(const char *database, const struct _param *param) { PGconn *conn; PGresult *res, diff --git a/contrib/xml2/xpath.c b/contrib/xml2/xpath.c index 034545caa8..95e580df08 100644 --- a/contrib/xml2/xpath.c +++ b/contrib/xml2/xpath.c @@ -95,7 +95,7 @@ PG_FUNCTION_INFO_V1(xml_is_well_formed); Datum xml_is_well_formed(PG_FUNCTION_ARGS) { - text *t = PG_GETARG_TEXT_PP(0); /* document buffer */ + text *t = PG_GETARG_TEXT_PP(0); /* document buffer */ bool result = false; int32 docsize = VARSIZE_ANY_EXHDR(t); xmlDocPtr doctree; @@ -187,7 +187,7 @@ pgxmlNodeSetToText(xmlNodeSetPtr nodeset, if (plainsep != NULL) { xmlBufferWriteCHAR(buf, - xmlXPathCastNodeToString(nodeset->nodeTab[i])); + xmlXPathCastNodeToString(nodeset->nodeTab[i])); /* If this isn't the last entry, write the plain sep. */ if (i < (nodeset->nodeNr) - 1) @@ -249,7 +249,7 @@ Datum xpath_nodeset(PG_FUNCTION_ARGS) { text *document = PG_GETARG_TEXT_PP(0); - text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *toptag = pgxml_texttoxmlchar(PG_GETARG_TEXT_PP(2)); xmlChar *septag = pgxml_texttoxmlchar(PG_GETARG_TEXT_PP(3)); xmlChar *xpath; @@ -282,7 +282,7 @@ Datum xpath_list(PG_FUNCTION_ARGS) { text *document = PG_GETARG_TEXT_PP(0); - text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *plainsep = pgxml_texttoxmlchar(PG_GETARG_TEXT_PP(2)); xmlChar *xpath; text *xpres; @@ -311,7 +311,7 @@ Datum xpath_string(PG_FUNCTION_ARGS) { text *document = PG_GETARG_TEXT_PP(0); - text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *xpath; int32 pathsize; text *xpres; @@ -352,7 +352,7 @@ Datum xpath_number(PG_FUNCTION_ARGS) { text *document = PG_GETARG_TEXT_PP(0); - text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *xpath; float4 fRes; xmlXPathObjectPtr res; @@ -384,7 +384,7 @@ Datum xpath_bool(PG_FUNCTION_ARGS) { text *document = PG_GETARG_TEXT_PP(0); - text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ + text *xpathsupp = PG_GETARG_TEXT_PP(1); /* XPath expression */ xmlChar *xpath; int bRes; xmlXPathObjectPtr res; @@ -579,8 +579,8 @@ xpath_table(PG_FUNCTION_ARGS) if (!(rsinfo->allowedModes & SFRM_Materialize)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("xpath_table requires Materialize mode, but it is not " - "allowed in this context"))); + errmsg("xpath_table requires Materialize mode, but it is not " + "allowed in this context"))); /* * The tuplestore must exist in a higher context than this function call @@ -720,7 +720,7 @@ xpath_table(PG_FUNCTION_ARGS) /* Parse the document */ if (xmldoc) doctree = xmlParseMemory(xmldoc, strlen(xmldoc)); - else /* treat NULL as not well-formed */ + else /* treat NULL as not well-formed */ doctree = NULL; if (doctree == NULL) diff --git a/contrib/xml2/xslt_proc.c b/contrib/xml2/xslt_proc.c index 391e6b593b..2189bca86f 100644 --- a/contrib/xml2/xslt_proc.c +++ b/contrib/xml2/xslt_proc.c @@ -29,7 +29,7 @@ #include <libxslt/security.h> #include <libxslt/transform.h> #include <libxslt/xsltutils.h> -#endif /* USE_LIBXSLT */ +#endif /* USE_LIBXSLT */ #ifdef USE_LIBXSLT @@ -39,7 +39,7 @@ extern PgXmlErrorContext *pgxml_parser_init(PgXmlStrictness strictness); /* local defs */ static const char **parse_params(text *paramstr); -#endif /* USE_LIBXSLT */ +#endif /* USE_LIBXSLT */ PG_FUNCTION_INFO_V1(xslt_process); @@ -189,7 +189,7 @@ xslt_process(PG_FUNCTION_ARGS) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("xslt_process() is not available without libxslt"))); PG_RETURN_NULL(); -#endif /* USE_LIBXSLT */ +#endif /* USE_LIBXSLT */ } #ifdef USE_LIBXSLT @@ -219,7 +219,7 @@ parse_params(text *paramstr) { max_params *= 2; params = (const char **) repalloc(params, - (max_params + 1) * sizeof(char *)); + (max_params + 1) * sizeof(char *)); } params[nparams++] = pos; pos = strstr(pos, nvsep); @@ -253,4 +253,4 @@ parse_params(text *paramstr) return params; } -#endif /* USE_LIBXSLT */ +#endif /* USE_LIBXSLT */ diff --git a/doc/src/sgml/adminpack.sgml b/doc/src/sgml/adminpack.sgml index 98736cb7c4..fddf90c4a5 100644 --- a/doc/src/sgml/adminpack.sgml +++ b/doc/src/sgml/adminpack.sgml @@ -152,7 +152,7 @@ <entry><type>integer</type></entry> <entry> Alternate name for <function>pg_rotate_logfile()</>, but note that it - returns integer 0 or 1 rather than boolean + returns integer 0 or 1 rather than <type>boolean</type> </entry> </row> </tbody> diff --git a/doc/src/sgml/amcheck.sgml b/doc/src/sgml/amcheck.sgml index 893a5b41d9..dd71dbd679 100644 --- a/doc/src/sgml/amcheck.sgml +++ b/doc/src/sgml/amcheck.sgml @@ -215,7 +215,7 @@ ORDER BY c.relpages DESC LIMIT 10; </listitem> <listitem> <para> - Filesystem or storage subsystem faults where checksums happen to + File system or storage subsystem faults where checksums happen to simply not be enabled. </para> <para> @@ -223,7 +223,7 @@ ORDER BY c.relpages DESC LIMIT 10; shared memory buffer at the time of verification if there is only a shared buffer hit when accessing the block. Consequently, <filename>amcheck</> does not necessarily examine data read from the - filesystem at the time of verification. Note that when checksums are + file system at the time of verification. Note that when checksums are enabled, <filename>amcheck</> may raise an error due to a checksum failure when a corrupt block is read into a buffer. </para> diff --git a/doc/src/sgml/charset.sgml b/doc/src/sgml/charset.sgml index 5e0a0bf7a7..48ecfc5f48 100644 --- a/doc/src/sgml/charset.sgml +++ b/doc/src/sgml/charset.sgml @@ -508,8 +508,8 @@ SELECT * FROM test1 ORDER BY a || b COLLATE "fr_FR"; operating system C library. These are the locales that most tools provided by the operating system use. Another provider is <literal>icu</literal>, which uses the external - ICU<indexterm><primary>ICU</></> library. Support for ICU has to be - configured when PostgreSQL is built. + ICU<indexterm><primary>ICU</></> library. ICU locales can only be + used if support for ICU was configured when PostgreSQL was built. </para> <para> @@ -529,12 +529,12 @@ SELECT * FROM test1 ORDER BY a || b COLLATE "fr_FR"; </para> <para> - A collation provided by <literal>icu</literal> maps to a named collator - provided by the ICU library. ICU does not support - separate <quote>collate</quote> and <quote>ctype</quote> settings, so they - are always the same. Also, ICU collations are independent of the - encoding, so there is always only one ICU collation for a given name in a - database. + A collation object provided by <literal>icu</literal> maps to a named + collator provided by the ICU library. ICU does not support + separate <quote>collate</quote> and <quote>ctype</quote> settings, so + they are always the same. Also, ICU collations are independent of the + encoding, so there is always only one ICU collation of a given name in + a database. </para> <sect3> @@ -566,10 +566,10 @@ SELECT * FROM test1 ORDER BY a || b COLLATE "fr_FR"; <para> If the operating system provides support for using multiple locales within a single program (<function>newlocale</> and related functions), - or support for ICU is configured, + or if support for ICU is configured, then when a database cluster is initialized, <command>initdb</command> populates the system catalog <literal>pg_collation</literal> with - collations based on all the locales it finds on the operating + collations based on all the locales it finds in the operating system at the time. </para> @@ -602,10 +602,12 @@ SELECT * FROM test1 ORDER BY a || b COLLATE "fr_FR"; directly to the locales installed in the operating system, which can be listed using the command <literal>locale -a</literal>. In case a <literal>libc</literal> collation is needed that has different values - for <symbol>LC_COLLATE</symbol> and <symbol>LC_CTYPE</symbol>, or new + for <symbol>LC_COLLATE</symbol> and <symbol>LC_CTYPE</symbol>, or if new locales are installed in the operating system after the database system was initialized, then a new collation may be created using the <xref linkend="sql-createcollation"> command. + New operating system locales can also be imported en masse using + the <link linkend="functions-admin-collation"><function>pg_import_system_collations()</function></link> function. </para> <para> @@ -617,8 +619,8 @@ SELECT * FROM test1 ORDER BY a || b COLLATE "fr_FR"; Use of the stripped collation names is recommended, since it will make one less thing you need to change if you decide to change to another database encoding. Note however that the <literal>default</>, - <literal>C</>, and <literal>POSIX</> collations, as well as all collations - provided by ICU can be used regardless of the database encoding. + <literal>C</>, and <literal>POSIX</> collations can be used regardless of + the database encoding. </para> <para> @@ -641,7 +643,7 @@ SELECT a COLLATE "C" < b COLLATE "POSIX" FROM test1; Collations provided by ICU are created with names in BCP 47 language tag format, with a <quote>private use</quote> extension <literal>-x-icu</literal> appended, to distinguish them from - libc locales. So <literal>de-x-icu</literal> would be an example. + libc locales. So <literal>de-x-icu</literal> would be an example name. </para> <para> @@ -652,7 +654,7 @@ SELECT a COLLATE "C" < b COLLATE "POSIX" FROM test1; See <ulink url="http://userguide.icu-project.org/locale"></ulink> for information on ICU locale naming. <command>initdb</command> uses the ICU APIs to extract a set of locales with distinct collation rules to populate - the initial set of collations. Here are some examples collations that + the initial set of collations. Here are some example collations that might be created: <variablelist> @@ -675,7 +677,7 @@ SELECT a COLLATE "C" < b COLLATE "POSIX" FROM test1; <listitem> <para>German collation for Austria, default variant</para> <para> - (Note that as of this writing, there is no, + (As of this writing, there is no, say, <literal>de-DE-x-icu</literal> or <literal>de-CH-x-icu</literal>, because those are equivalent to <literal>de-x-icu</literal>.) </para> @@ -701,9 +703,11 @@ SELECT a COLLATE "C" < b COLLATE "POSIX" FROM test1; </para> <para> - Some (less frequently used) encodings are not supported by ICU. If the - database cluster was initialized with such an encoding, no ICU collations - will be predefined. + Some (less frequently used) encodings are not supported by ICU. When the + database encoding is one of these, ICU collation entries + in <literal>pg_collation</literal> are ignored. Attempting to use one + will draw an error along the lines of <quote>collation "de-x-icu" for + encoding "WIN874" does not exist</>. </para> </sect4> </sect3> @@ -761,8 +765,11 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; classification) and <envar>LC_COLLATE</> (string sort order) locale settings. For <literal>C</> or <literal>POSIX</> locale, any character set is allowed, but for other - locales there is only one character set that will work correctly. + libc-provided locales there is only one character set that will work + correctly. (On Windows, however, UTF-8 encoding can be used with any locale.) + If you have ICU support configured, ICU-provided locales can be used + with most but not all server-side encodings. </para> <sect2 id="multibyte-charset-supported"> @@ -775,13 +782,14 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <table id="charset-table"> <title><productname>PostgreSQL</productname> Character Sets</title> - <tgroup cols="6"> + <tgroup cols="7"> <thead> <row> <entry>Name</entry> <entry>Description</entry> <entry>Language</entry> <entry>Server?</entry> + <entry>ICU?</entry> <!-- The Bytes/Char field is populated by looking at the values returned by pg_wchar_table.mblen function for each encoding. @@ -796,6 +804,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Big Five</entry> <entry>Traditional Chinese</entry> <entry>No</entry> + <entry>No</entry> <entry>1-2</entry> <entry><literal>WIN950</>, <literal>Windows950</></entry> </row> @@ -804,6 +813,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Extended UNIX Code-CN</entry> <entry>Simplified Chinese</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1-3</entry> <entry></entry> </row> @@ -812,6 +822,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Extended UNIX Code-JP</entry> <entry>Japanese</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1-3</entry> <entry></entry> </row> @@ -820,6 +831,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Extended UNIX Code-JP, JIS X 0213</entry> <entry>Japanese</entry> <entry>Yes</entry> + <entry>No</entry> <entry>1-3</entry> <entry></entry> </row> @@ -828,6 +840,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Extended UNIX Code-KR</entry> <entry>Korean</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1-3</entry> <entry></entry> </row> @@ -836,6 +849,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Extended UNIX Code-TW</entry> <entry>Traditional Chinese, Taiwanese</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1-3</entry> <entry></entry> </row> @@ -844,6 +858,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>National Standard</entry> <entry>Chinese</entry> <entry>No</entry> + <entry>No</entry> <entry>1-4</entry> <entry></entry> </row> @@ -852,6 +867,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Extended National Standard</entry> <entry>Simplified Chinese</entry> <entry>No</entry> + <entry>No</entry> <entry>1-2</entry> <entry><literal>WIN936</>, <literal>Windows936</></entry> </row> @@ -860,6 +876,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-5, <acronym>ECMA</> 113</entry> <entry>Latin/Cyrillic</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -868,6 +885,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-6, <acronym>ECMA</> 114</entry> <entry>Latin/Arabic</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -876,6 +894,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-7, <acronym>ECMA</> 118</entry> <entry>Latin/Greek</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -884,6 +903,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-8, <acronym>ECMA</> 121</entry> <entry>Latin/Hebrew</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -892,6 +912,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry><acronym>JOHAB</></entry> <entry>Korean (Hangul)</entry> <entry>No</entry> + <entry>No</entry> <entry>1-3</entry> <entry></entry> </row> @@ -900,6 +921,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry><acronym>KOI</acronym>8-R</entry> <entry>Cyrillic (Russian)</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>KOI8</></entry> </row> @@ -908,6 +930,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry><acronym>KOI</acronym>8-U</entry> <entry>Cyrillic (Ukrainian)</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -916,6 +939,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-1, <acronym>ECMA</> 94</entry> <entry>Western European</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ISO88591</></entry> </row> @@ -924,6 +948,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-2, <acronym>ECMA</> 94</entry> <entry>Central European</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ISO88592</></entry> </row> @@ -932,6 +957,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-3, <acronym>ECMA</> 94</entry> <entry>South European</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ISO88593</></entry> </row> @@ -940,6 +966,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-4, <acronym>ECMA</> 94</entry> <entry>North European</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ISO88594</></entry> </row> @@ -948,6 +975,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-9, <acronym>ECMA</> 128</entry> <entry>Turkish</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ISO88599</></entry> </row> @@ -956,6 +984,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-10, <acronym>ECMA</> 144</entry> <entry>Nordic</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ISO885910</></entry> </row> @@ -964,6 +993,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-13</entry> <entry>Baltic</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ISO885913</></entry> </row> @@ -972,6 +1002,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-14</entry> <entry>Celtic</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ISO885914</></entry> </row> @@ -980,6 +1011,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-15</entry> <entry>LATIN1 with Euro and accents</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ISO885915</></entry> </row> @@ -988,6 +1020,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>ISO 8859-16, <acronym>ASRO</> SR 14111</entry> <entry>Romanian</entry> <entry>Yes</entry> + <entry>No</entry> <entry>1</entry> <entry><literal>ISO885916</></entry> </row> @@ -996,6 +1029,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Mule internal code</entry> <entry>Multilingual Emacs</entry> <entry>Yes</entry> + <entry>No</entry> <entry>1-4</entry> <entry></entry> </row> @@ -1004,6 +1038,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Shift JIS</entry> <entry>Japanese</entry> <entry>No</entry> + <entry>No</entry> <entry>1-2</entry> <entry><literal>Mskanji</>, <literal>ShiftJIS</>, <literal>WIN932</>, <literal>Windows932</></entry> </row> @@ -1012,6 +1047,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Shift JIS, JIS X 0213</entry> <entry>Japanese</entry> <entry>No</entry> + <entry>No</entry> <entry>1-2</entry> <entry></entry> </row> @@ -1020,6 +1056,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>unspecified (see text)</entry> <entry><emphasis>any</></entry> <entry>Yes</entry> + <entry>No</entry> <entry>1</entry> <entry></entry> </row> @@ -1028,6 +1065,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Unified Hangul Code</entry> <entry>Korean</entry> <entry>No</entry> + <entry>No</entry> <entry>1-2</entry> <entry><literal>WIN949</>, <literal>Windows949</></entry> </row> @@ -1036,6 +1074,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Unicode, 8-bit</entry> <entry><emphasis>all</></entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1-4</entry> <entry><literal>Unicode</></entry> </row> @@ -1044,6 +1083,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP866</entry> <entry>Cyrillic</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ALT</></entry> </row> @@ -1052,6 +1092,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP874</entry> <entry>Thai</entry> <entry>Yes</entry> + <entry>No</entry> <entry>1</entry> <entry></entry> </row> @@ -1060,6 +1101,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP1250</entry> <entry>Central European</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -1068,6 +1110,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP1251</entry> <entry>Cyrillic</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>WIN</></entry> </row> @@ -1076,6 +1119,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP1252</entry> <entry>Western European</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -1084,6 +1128,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP1253</entry> <entry>Greek</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -1092,6 +1137,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP1254</entry> <entry>Turkish</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -1100,6 +1146,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP1255</entry> <entry>Hebrew</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -1108,6 +1155,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP1256</entry> <entry>Arabic</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -1116,6 +1164,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP1257</entry> <entry>Baltic</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry></entry> </row> @@ -1124,6 +1173,7 @@ CREATE COLLATION "de-DE-x-icu" FROM "de-x-icu"; <entry>Windows CP1258</entry> <entry>Vietnamese</entry> <entry>Yes</entry> + <entry>Yes</entry> <entry>1</entry> <entry><literal>ABC</>, <literal>TCVN</>, <literal>TCVN5712</>, <literal>VSCII</></entry> </row> diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 89eecb4758..28cfc6d258 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1929,10 +1929,10 @@ include_dir 'conf.d' <listitem> <para> Whenever more than <varname>bgwriter_flush_after</varname> bytes have - been written by the bgwriter, attempt to force the OS to issue these + been written by the background writer, attempt to force the OS to issue these writes to the underlying storage. Doing so will limit the amount of dirty data in the kernel's page cache, reducing the likelihood of - stalls when an fsync is issued at the end of a checkpoint, or when + stalls when an <function>fsync</function> is issued at the end of a checkpoint, or when the OS writes data back in larger batches in the background. Often that will result in greatly reduced transaction latency, but there also are some cases, especially with workloads that are bigger than @@ -2050,7 +2050,7 @@ include_dir 'conf.d' pool of processes established by <xref linkend="guc-max-worker-processes">, limited by <xref linkend="guc-max-parallel-workers">. Note that the requested - number of workers may not actually be available at runtime. If this + number of workers may not actually be available at run time. If this occurs, the plan will run with fewer workers than expected, which may be inefficient. The default value is 2. Setting this value to 0 disables parallel query execution. @@ -2111,7 +2111,7 @@ include_dir 'conf.d' been written by a single backend, attempt to force the OS to issue these writes to the underlying storage. Doing so will limit the amount of dirty data in the kernel's page cache, reducing the - likelihood of stalls when an fsync is issued at the end of a + likelihood of stalls when an <function>fsync</function> is issued at the end of a checkpoint, or when the OS writes data back in larger batches in the background. Often that will result in greatly reduced transaction latency, but there also are some cases, especially with workloads @@ -2291,7 +2291,7 @@ include_dir 'conf.d' For reliable recovery when changing <varname>fsync</varname> off to on, it is necessary to force all modified buffers in the kernel to durable storage. This can be done while the cluster - is shutdown or while fsync is on by running <command>initdb + is shutdown or while <varname>fsync</varname> is on by running <command>initdb --sync-only</command>, running <command>sync</>, unmounting the file system, or rebooting the server. </para> @@ -2721,7 +2721,7 @@ include_dir 'conf.d' have been written while performing a checkpoint, attempt to force the OS to issue these writes to the underlying storage. Doing so will limit the amount of dirty data in the kernel's page cache, reducing - the likelihood of stalls when an fsync is issued at the end of the + the likelihood of stalls when an <function>fsync</function> is issued at the end of the checkpoint, or when the OS writes data back in larger batches in the background. Often that will result in greatly reduced transaction latency, but there also are some cases, especially with workloads @@ -3486,7 +3486,7 @@ ANY <replaceable class="parameter">num_sync</replaceable> ( <replaceable class=" <listitem> <para> Maximum number of synchronization workers per subscription. This - parameter controls the amount of paralelism of the initial data copy + parameter controls the amount of parallelism of the initial data copy during the subscription initialization or when new tables are added. </para> <para> @@ -7038,12 +7038,6 @@ SET XML OPTION { DOCUMENT | CONTENT }; </para> <para> - For each parameter, if more than one library is to be loaded, separate - their names with commas. All library names are converted to lower case - unless double-quoted. - </para> - - <para> Only shared libraries specifically intended to be used with PostgreSQL can be loaded this way. Every PostgreSQL-supported library has a <quote>magic block</> that is checked to guarantee compatibility. For @@ -7071,6 +7065,10 @@ SET XML OPTION { DOCUMENT | CONTENT }; <para> This variable specifies one or more shared libraries that are to be preloaded at connection start. + It contains a comma-separated list of library names, where each name + is interpreted as for the <xref linkend="SQL-LOAD"> command. + Whitespace between entries is ignored; surround a library name with + double quotes if you need to include whitespace or commas in the name. The parameter value only takes effect at the start of the connection. Subsequent changes have no effect. If a specified library is not found, the connection attempt will fail. @@ -7117,10 +7115,15 @@ SET XML OPTION { DOCUMENT | CONTENT }; <listitem> <para> This variable specifies one or more shared libraries that are to be - preloaded at connection start. Only superusers can change this setting. + preloaded at connection start. + It contains a comma-separated list of library names, where each name + is interpreted as for the <xref linkend="SQL-LOAD"> command. + Whitespace between entries is ignored; surround a library name with + double quotes if you need to include whitespace or commas in the name. The parameter value only takes effect at the start of the connection. Subsequent changes have no effect. If a specified library is not found, the connection attempt will fail. + Only superusers can change this setting. </para> <para> @@ -7154,9 +7157,13 @@ SET XML OPTION { DOCUMENT | CONTENT }; <listitem> <para> This variable specifies one or more shared libraries to be preloaded at - server start. This parameter can only be set at server - start. If a specified library is not found, the server will fail to - start. + server start. + It contains a comma-separated list of library names, where each name + is interpreted as for the <xref linkend="SQL-LOAD"> command. + Whitespace between entries is ignored; surround a library name with + double quotes if you need to include whitespace or commas in the name. + This parameter can only be set at server start. If a specified + library is not found, the server will fail to start. </para> <para> @@ -7399,7 +7406,7 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' limit, while negative values mean <xref linkend="guc-max-pred-locks-per-transaction"> divided by the absolute value of this setting. The default is -2, which keeps - the behaviour from previous versions of <productname>PostgreSQL</>. + the behavior from previous versions of <productname>PostgreSQL</>. This parameter can only be set in the <filename>postgresql.conf</> file or on the server command line. </para> diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index a70047b340..7449e064ac 100755 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -2039,13 +2039,13 @@ UPDATE 1 <para> All of the policies constructed thus far have been permissive policies, meaning that when multiple policies are applied they are combined using - the "OR" boolean operator. While permissive policies can be constructed + the <quote>OR</quote> Boolean operator. While permissive policies can be constructed to only allow access to rows in the intended cases, it can be simpler to combine permissive policies with restrictive policies (which the records - must pass and which are combined using the "AND" boolean operator). + must pass and which are combined using the <quote>AND</quote> Boolean operator). Building on the example above, we add a restrictive policy to require - the administrator to be connected over a local unix socket to access the - records of the passwd table: + the administrator to be connected over a local Unix socket to access the + records of the <literal>passwd</literal> table: </para> <programlisting> @@ -3241,7 +3241,8 @@ VALUES ('Albany', NULL, NULL, 'NY'); <command>CREATE TABLE</> nor is it possible to add columns to partitions after-the-fact using <command>ALTER TABLE</>. Tables may be added as a partition with <command>ALTER TABLE ... ATTACH PARTITION</> - only if their columns exactly match the parent, including oids. + only if their columns exactly match the parent, including any + <literal>oid</literal> column. </para> </listitem> diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml index c4f211bc02..b96ef389a2 100644 --- a/doc/src/sgml/extend.sgml +++ b/doc/src/sgml/extend.sgml @@ -1207,7 +1207,7 @@ include $(PGXS) <term><varname>NO_INSTALLCHECK</varname></term> <listitem> <para> - don't define an installcheck target, useful e.g. if tests require special configuration, or don't use pg_regress + don't define an <literal>installcheck</literal> target, useful e.g. if tests require special configuration, or don't use <application>pg_regress</application> </para> </listitem> </varlistentry> diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 58c1858121..3d56b889c7 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1302,7 +1302,7 @@ transformation functions <literal><function>radians()</function></literal> and <literal><function>degrees()</function></literal> shown earlier. However, using the degree-based trigonometric functions is preferred, - as that way avoids roundoff error for special cases such + as that way avoids round-off error for special cases such as <literal>sind(30)</>. </para> </note> @@ -9571,7 +9571,7 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple <entry><type>tsvector</type></entry> <entry> reduce each string value in the document to a <type>tsvector</>, and then - concatentate those in document order to produce a single <type>tsvector</> + concatenate those in document order to produce a single <type>tsvector</> </entry> <entry><literal>to_tsvector('english', '{"a": "The Fat Rats"}'::json)</literal></entry> <entry><literal>'fat':2 'rat':3</literal></entry> @@ -9744,7 +9744,7 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple <literal><function>unnest(<type>tsvector</>, OUT <replaceable class="PARAMETER">lexeme</> <type>text</>, OUT <replaceable class="PARAMETER">positions</> <type>smallint[]</>, OUT <replaceable class="PARAMETER">weights</> <type>text</>)</function></literal> </entry> <entry><type>setof record</type></entry> - <entry>expand a tsvector to a set of rows</entry> + <entry>expand a <type>tsvector</type> to a set of rows</entry> <entry><literal>unnest('fat:2,4 cat:3 rat:5A'::tsvector)</literal></entry> <entry><literal>(cat,{3},{D}) ...</literal></entry> </row> @@ -17705,7 +17705,7 @@ SELECT collation for ('foo' COLLATE "de_DE"); <row> <entry><literal><function>txid_current_if_assigned()</function></literal></entry> <entry><type>bigint</type></entry> - <entry>same as <function>txid_current()</function> but returns null instead of assigning an xid if none is already assigned</entry> + <entry>same as <function>txid_current()</function> but returns null instead of assigning a new transaction ID if none is already assigned</entry> </row> <row> <entry><literal><function>txid_current_snapshot()</function></literal></entry> @@ -17735,7 +17735,7 @@ SELECT collation for ('foo' COLLATE "de_DE"); <row> <entry><literal><function>txid_status(<parameter>bigint</parameter>)</function></literal></entry> <entry><type>txid_status</type></entry> - <entry>report the status of the given xact - <literal>committed</literal>, <literal>aborted</literal>, <literal>in progress</literal>, or NULL if the txid is too old</entry> + <entry>report the status of the given transaction: <literal>committed</literal>, <literal>aborted</literal>, <literal>in progress</literal>, or null if the transaction ID is too old</entry> </row> </tbody> </tgroup> @@ -18634,7 +18634,7 @@ postgres=# select pg_start_backup('label_goes_here'); the <filename>backup_label</> and <filename>tablespace_map</> are returned in the result of the function, and should be written to files in the backup (and not in the data directory). There is an optional second - parameter of type boolean. If false, the <function>pg_stop_backup</> + parameter of type <type>boolean</type>. If false, the <function>pg_stop_backup</> will return immediately after the backup is completed without waiting for WAL to be archived. This behavior is only useful for backup software which independently monitors WAL archiving. Otherwise, WAL @@ -19784,9 +19784,9 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); <row> <entry> <indexterm><primary>pg_import_system_collations</primary></indexterm> - <literal><function>pg_import_system_collations(<parameter>if_not_exists</> <type>boolean</>, <parameter>schema</> <type>regnamespace</>)</function></literal> + <literal><function>pg_import_system_collations(<parameter>schema</> <type>regnamespace</>)</function></literal> </entry> - <entry><type>void</type></entry> + <entry><type>integer</type></entry> <entry>Import operating system collations</entry> </row> </tbody> @@ -19803,18 +19803,20 @@ postgres=# SELECT * FROM pg_walfile_name_offset(pg_stop_backup()); </para> <para> - <function>pg_import_system_collations</> populates the system - catalog <literal>pg_collation</literal> with collations based on all the - locales it finds on the operating system. This is + <function>pg_import_system_collations</> adds collations to the system + catalog <literal>pg_collation</literal> based on all the + locales it finds in the operating system. This is what <command>initdb</command> uses; see <xref linkend="collation-managing"> for more details. If additional locales are installed into the operating system later on, this function - can be run again to add collations for the new locales. In that case, the - parameter <parameter>if_not_exists</parameter> should be set to true to - skip over existing collations. The <parameter>schema</parameter> - parameter would typically be <literal>pg_catalog</literal>, but that is - not a requirement. (Collation objects based on locales that are no longer - present on the operating system are never removed by this function.) + can be run again to add collations for the new locales. Locales that + match existing entries in <literal>pg_collation</literal> will be skipped. + (But collation objects based on locales that are no longer + present in the operating system are not removed by this function.) + The <parameter>schema</parameter> parameter would typically + be <literal>pg_catalog</literal>, but that is not a requirement; + the collations could be installed into some other schema as well. + The function returns the number of new collation objects it created. </para> </sect2> diff --git a/doc/src/sgml/generic-wal.sgml b/doc/src/sgml/generic-wal.sgml index 147d456d34..dfa78c5ca2 100644 --- a/doc/src/sgml/generic-wal.sgml +++ b/doc/src/sgml/generic-wal.sgml @@ -35,7 +35,7 @@ — register a buffer to be modified within the current generic WAL record. This function returns a pointer to a temporary copy of the buffer's page, where modifications should be made. (Do not modify the - buffer's contents directly.) The third argument is a bitmask of flags + buffer's contents directly.) The third argument is a bit mask of flags applicable to the operation. Currently the only such flag is <literal>GENERIC_XLOG_FULL_IMAGE</>, which indicates that a full-page image rather than a delta update should be included in the WAL record. diff --git a/doc/src/sgml/high-availability.sgml b/doc/src/sgml/high-availability.sgml index 01f46d39b6..d0354108d1 100644 --- a/doc/src/sgml/high-availability.sgml +++ b/doc/src/sgml/high-availability.sgml @@ -2208,12 +2208,12 @@ LOG: database system is ready to accept read only connections <function>pg_cancel_backend()</> and <function>pg_terminate_backend()</> will work on user backends, but not the Startup process, which performs - recovery. <structname>pg_stat_activity</structname> does not show an - entry for the Startup process, nor do recovering transactions show - as active. As a result, <structname>pg_prepared_xacts</structname> - is always empty during recovery. If you wish to resolve in-doubt - prepared transactions, view <literal>pg_prepared_xacts</> on the - primary and issue commands to resolve transactions there. + recovery. <structname>pg_stat_activity</structname> does not show + recovering transactions as active. As a result, + <structname>pg_prepared_xacts</structname> is always empty during + recovery. If you wish to resolve in-doubt prepared transactions, view + <literal>pg_prepared_xacts</> on the primary and issue commands to + resolve transactions there or resolve them after the end of recovery. </para> <para> diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml index 36c157c43f..fa8ae536d9 100644 --- a/doc/src/sgml/logical-replication.sgml +++ b/doc/src/sgml/logical-replication.sgml @@ -110,11 +110,29 @@ Publications can choose to limit the changes they produce to any combination of <command>INSERT</command>, <command>UPDATE</command>, and <command>DELETE</command>, similar to how triggers are fired by - particular event types. If a table without a <literal>REPLICA - IDENTITY</literal> is added to a publication that - replicates <command>UPDATE</command> or <command>DELETE</command> - operations then subsequent <command>UPDATE</command> - or <command>DELETE</command> operations will fail on the publisher. + particular event types. By default, all operation types are replicated. + </para> + + <para> + A published table must have a <quote>replica identity</quote> configured in + order to be able to replicate <command>UPDATE</command> + and <command>DELETE</command> operations, so that appropriate rows to + update or delete can be identified on the subscriber side. By default, + this is the primary key, if there is one. Another unique index (with + certain additional requirements) can also be set to be the replica + identity. If the table does not have any suitable key, then it can be set + to replica identity <quote>full</quote>, which means the entire row becomes + the key. This, however, is very inefficient and should only be used as a + fallback if no other solution is possible. If a replica identity other + than <quote>full</quote> is set on the publisher side, a replica identity + comprising the same or fewer columns must also be set on the subscriber + side. See <xref linkend="SQL-CREATETABLE-REPLICA-IDENTITY"> for details on + how to set the replica identity. If a table without a replica identity is + added to a publication that replicates <command>UPDATE</command> + or <command>DELETE</command> operations then + subsequent <command>UPDATE</command> or <command>DELETE</command> + operations will cause an error on the publisher. <command>INSERT</command> + operations can proceed regardless of any replica identity. </para> <para> @@ -299,6 +317,76 @@ </para> </sect1> + <sect1 id="logical-replication-restrictions"> + <title>Restrictions</title> + + <para> + Logical replication currently has the following restrictions or missing + functionality. These might be addressed in future releases. + </para> + + <itemizedlist> + <listitem> + <para> + The database schema and DDL commands are not replicated. The initial + schema can be copied by hand using <literal>pg_dump + --schema-only</literal>. Subsequent schema changes would need to be kept + in sync manually. (Note, however, that there is no need for the schemas + to be absolutely the same on both sides.) Logical replication is robust + when schema definitions change in a live database: When the schema is + changed on the publisher and replicated data starts arriving at the + subscriber but does not fit into the table schema, replication will error + until the schema is updated. In many cases, intermittent errors can be + avoided by applying additive schema changes to the subscriber first. + </para> + </listitem> + + <listitem> + <para> + Sequence data is not replicated. The data in serial or identity columns + backed by sequences will of course be replicated as part of the table, + but the sequence itself would still show the start value on the + subscriber. If the subscriber is used as a read-only database, then this + should typically not be a problem. If, however, some kind of switchover + or failover to the subscriber database is intended, then the sequences + would need to be updated to the latest values, either by copying the + current data from the publisher (perhaps + using <command>pg_dump</command>) or by determining a sufficiently high + value from the tables themselves. + </para> + </listitem> + + <listitem> + <para> + <command>TRUNCATE</command> commands are not replicated. This can, of + course, be worked around by using <command>DELETE</command> instead. To + avoid accidental <command>TRUNCATE</command> invocations, you can revoke + the <literal>TRUNCATE</literal> privilege from tables. + </para> + </listitem> + + <listitem> + <para> + Large objects (see <xref linkend="largeobjects">) are not replicated. + There is no workaround for that, other than storing data in normal + tables. + </para> + </listitem> + + <listitem> + <para> + Replication is only possible from base tables to base tables. That is, + the tables on the publication and on the subscription side must be normal + tables, not views, materialized views, partition root tables, or foreign + tables. In the case of partitions, you can therefore replicate a + partition hierarchy one-to-one, but you cannot currently replicate to a + differently partitioned setup. Attempts to replicate tables other than + base tables will result in an error. + </para> + </listitem> + </itemizedlist> + </sect1> + <sect1 id="logical-replication-architecture"> <title>Architecture</title> @@ -382,7 +470,7 @@ <para> The role used for the replication connection must have - the <literal>REPLICATION</literal> attribute. Access for the role must be + the <literal>REPLICATION</literal> attribute (or be a superuser). Access for the role must be configured in <filename>pg_hba.conf</filename>. </para> diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index cfaa0da4b8..9f09355f5f 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -630,7 +630,7 @@ SELECT datname, age(datfrozenxid) FROM pg_database; scans every page in the table that is not already all-frozen, it should set <literal>age(relfrozenxid)</> to a value just a little more than the <varname>vacuum_freeze_min_age</> setting - that was used (more by the number of transcations started since the + that was used (more by the number of transactions started since the <command>VACUUM</> started). If no <structfield>relfrozenxid</>-advancing <command>VACUUM</> is issued on the table until <varname>autovacuum_freeze_max_age</> is reached, an autovacuum will soon diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 9ff5eea038..be3dc672bc 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1143,7 +1143,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser </row> <row> <entry><literal>userlock</></entry> - <entry>Waiting to acquire a userlock.</entry> + <entry>Waiting to acquire a user lock.</entry> </row> <row> <entry><literal>advisory</></entry> @@ -1244,7 +1244,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser </row> <row> <entry><literal>BtreePage</></entry> - <entry>Waiting for the page number needed to continue a parallel btree scan to become available.</entry> + <entry>Waiting for the page number needed to continue a parallel B-tree scan to become available.</entry> </row> <row> <entry><literal>ExecuteGather</></entry> diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml index 789be3d6a8..454c3f1fd2 100644 --- a/doc/src/sgml/perform.sgml +++ b/doc/src/sgml/perform.sgml @@ -1227,7 +1227,7 @@ SELECT * FROM zipcodes WHERE city = 'San Francisco' AND zip = '90210'; <para> In many practical situations, this assumption is usually satisfied; for example, there might be a GUI in the application that only allows - selecting compatible city and zipcode values to use in a query. + selecting compatible city and ZIP code values to use in a query. But if that's not the case, functional dependencies may not be a viable option. </para> diff --git a/doc/src/sgml/planstats.sgml b/doc/src/sgml/planstats.sgml index 8caf297f85..838fcda6d2 100644 --- a/doc/src/sgml/planstats.sgml +++ b/doc/src/sgml/planstats.sgml @@ -501,8 +501,8 @@ EXPLAIN (ANALYZE, TIMING OFF) SELECT * FROM t WHERE a = 1; of this clause to be 1%. By comparing this estimate and the actual number of rows, we see that the estimate is very accurate (in fact exact, as the table is very small). Changing the - <literal>WHERE</> to use the <structfield>b</> column, an identical - plan is generated. But observe what happens if we apply the same + <literal>WHERE</> condition to use the <structfield>b</> column, an + identical plan is generated. But observe what happens if we apply the same condition on both columns, combining them with <literal>AND</>: <programlisting> diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml index 09b4d54b72..25e41fd5a8 100644 --- a/doc/src/sgml/plperl.sgml +++ b/doc/src/sgml/plperl.sgml @@ -1341,7 +1341,7 @@ DO 'elog(WARNING, join ", ", sort keys %INC)' LANGUAGE plperl; </programlisting> </para> <para> - Initialization will happen in the postmaster if the plperl library is + Initialization will happen in the postmaster if the <literal>plperl</literal> library is included in <xref linkend="guc-shared-preload-libraries">, in which case extra consideration should be given to the risk of destabilizing the postmaster. The principal reason for making use of this feature diff --git a/doc/src/sgml/pltcl.sgml b/doc/src/sgml/pltcl.sgml index 321a46917e..ebe4b78476 100644 --- a/doc/src/sgml/pltcl.sgml +++ b/doc/src/sgml/pltcl.sgml @@ -887,7 +887,7 @@ CREATE EVENT TRIGGER tcl_a_snitch ON ddl_command_start EXECUTE PROCEDURE tclsnit first word identifies the subsystem or library reporting the error; beyond that the contents are left to the individual subsystem or library. For database errors reported by PL/Tcl commands, the first - word is <literal>POSTGRES</literal>, the second word is the Postgres + word is <literal>POSTGRES</literal>, the second word is the PostgreSQL version number, and additional words are field name/value pairs providing detailed information about the error. Fields <varname>SQLSTATE</>, <varname>condition</>, diff --git a/doc/src/sgml/ref/alter_collation.sgml b/doc/src/sgml/ref/alter_collation.sgml index 71cf4de802..30e8c756a1 100644 --- a/doc/src/sgml/ref/alter_collation.sgml +++ b/doc/src/sgml/ref/alter_collation.sgml @@ -92,7 +92,7 @@ ALTER COLLATION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_sche <term><literal>REFRESH VERSION</literal></term> <listitem> <para> - Updated the collation version. + Update the collation's version. See <xref linkend="sql-altercollation-notes" endterm="sql-altercollation-notes-title"> below. </para> @@ -107,16 +107,16 @@ ALTER COLLATION <replaceable>name</replaceable> SET SCHEMA <replaceable>new_sche <para> When using collations provided by the ICU library, the ICU-specific version of the collator is recorded in the system catalog when the collation object - is created. When the collation is then used, the current version is + is created. When the collation is used, the current version is checked against the recorded version, and a warning is issued when there is a mismatch, for example: <screen> -WARNING: ICU collator version mismatch -DETAIL: The database was created using version 1.2.3.4, the library provides version 2.3.4.5. -HINT: Rebuild all objects affected by this collation and run ALTER COLLATION pg_catalog."xx-x-icu" REFRESH VERSION, or build PostgreSQL with the right version of ICU. +WARNING: collation "xx-x-icu" has version mismatch +DETAIL: The collation in the database was created using version 1.2.3.4, but the operating system provides version 2.3.4.5. +HINT: Rebuild all objects affected by this collation and run ALTER COLLATION pg_catalog."xx-x-icu" REFRESH VERSION, or build PostgreSQL with the right library version. </screen> A change in collation definitions can lead to corrupt indexes and other - problems where the database system relies on stored objects having a + problems because the database system relies on stored objects having a certain sort order. Generally, this should be avoided, but it can happen in legitimate circumstances, such as when using <command>pg_upgrade</command> to upgrade to server binaries linked diff --git a/doc/src/sgml/ref/create_collation.sgml b/doc/src/sgml/ref/create_collation.sgml index 47de9a09b6..2d3e050545 100644 --- a/doc/src/sgml/ref/create_collation.sgml +++ b/doc/src/sgml/ref/create_collation.sgml @@ -122,7 +122,9 @@ CREATE COLLATION [ IF NOT EXISTS ] <replaceable>name</replaceable> FROM <replace <para> Specifies the provider to use for locale services associated with this collation. Possible values - are: <literal>icu</literal>,<indexterm><primary>ICU</></> <literal>libc</literal>. + are: <literal>icu</literal>,<indexterm><primary>ICU</></> + <literal>libc</literal>. + <literal>libc</literal> is the default. The available choices depend on the operating system and build options. </para> </listitem> diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index 4868317a12..c82cec3072 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -569,8 +569,9 @@ CREATE [ OR REPLACE ] FUNCTION dynamically loadable C language functions when the function name in the C language source code is not the same as the name of the SQL function. The string <replaceable - class="parameter">obj_file</replaceable> is the name of the - file containing the dynamically loadable object, and + class="parameter">obj_file</replaceable> is the name of the shared + library file containing the compiled C function, and is interpreted + as for the <xref linkend="SQL-LOAD"> command. The string <replaceable class="parameter">link_symbol</replaceable> is the function's link symbol, that is, the name of the function in the C language source code. If the link symbol is omitted, it is assumed diff --git a/doc/src/sgml/ref/create_policy.sgml b/doc/src/sgml/ref/create_policy.sgml index 3b24e5e95e..c0dfe1ea4b 100644 --- a/doc/src/sgml/ref/create_policy.sgml +++ b/doc/src/sgml/ref/create_policy.sgml @@ -126,7 +126,7 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable <para> Specify that the policy is to be created as a permissive policy. All permissive policies which are applicable to a given query will - be combined together using the boolean "OR" operator. By creating + be combined together using the Boolean <quote>OR</quote> operator. By creating permissive policies, administrators can add to the set of records which can be accessed. Policies are permissive by default. </para> @@ -139,7 +139,7 @@ CREATE POLICY <replaceable class="parameter">name</replaceable> ON <replaceable <para> Specify that the policy is to be created as a restrictive policy. All restrictive policies which are applicable to a given query will - be combined together using the boolean "AND" operator. By creating + be combined together using the Boolean <quote>AND</quote> operator. By creating restrictive policies, administrators can reduce the set of records which can be accessed as all restrictive policies must be passed for each record. diff --git a/doc/src/sgml/ref/create_publication.sgml b/doc/src/sgml/ref/create_publication.sgml index c5299dd74e..62a5fd432e 100644 --- a/doc/src/sgml/ref/create_publication.sgml +++ b/doc/src/sgml/ref/create_publication.sgml @@ -163,6 +163,11 @@ CREATE PUBLICATION <replaceable class="parameter">name</replaceable> </para> <para> + <command>COPY ... FROM</command> commands are published + as <command>INSERT</command> operations. + </para> + + <para> <command>TRUNCATE</command> and <acronym>DDL</acronym> operations are not published. </para> diff --git a/doc/src/sgml/ref/create_statistics.sgml b/doc/src/sgml/ref/create_statistics.sgml index f319a6ea9c..deda21fec7 100644 --- a/doc/src/sgml/ref/create_statistics.sgml +++ b/doc/src/sgml/ref/create_statistics.sgml @@ -152,14 +152,14 @@ CREATE STATISTICS s1 (dependencies) ON a, b FROM t1; ANALYZE t1; --- now the rowcount estimate is more accurate: +-- now the row count estimate is more accurate: EXPLAIN ANALYZE SELECT * FROM t1 WHERE (a = 1) AND (b = 0); </programlisting> Without functional-dependency statistics, the planner would assume that the two <literal>WHERE</> conditions are independent, and would multiply their selectivities together to arrive at a much-too-small - rowcount estimate. + row count estimate. With such statistics, the planner recognizes that the <literal>WHERE</> conditions are redundant and does not underestimate the rowcount. </para> diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml index 77bf87681b..9f45b6f574 100644 --- a/doc/src/sgml/ref/create_subscription.sgml +++ b/doc/src/sgml/ref/create_subscription.sgml @@ -32,7 +32,7 @@ CREATE SUBSCRIPTION <replaceable class="PARAMETER">subscription_name</replaceabl <title>Description</title> <para> - <command>CREATE SUBSCRIPTION</command> adds a new subscription for a + <command>CREATE SUBSCRIPTION</command> adds a new subscription for the current database. The subscription name must be distinct from the name of any existing subscription in the database. </para> @@ -222,7 +222,7 @@ CREATE SUBSCRIPTION <replaceable class="PARAMETER">subscription_name</replaceabl <title>Notes</title> <para> - See <xref linkend="streaming-replication-authentication"> for details on + See <xref linkend="logical-replication-security"> for details on how to configure access control between the subscription and the publication instance. </para> diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 5a3821b25e..c799984f3b 100755 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -459,8 +459,8 @@ FROM ( { <replaceable class="PARAMETER">numeric_literal</replaceable> | <replace include multiple columns or expressions (up to 32, but this limit can altered when building <productname>PostgreSQL</productname>.), but for list partitioning, the partition key must consist of a single column or - expression. If no btree operator class is specified when creating a - partitioned table, the default btree operator class for the datatype will + expression. If no B-tree operator class is specified when creating a + partitioned table, the default B-tree operator class for the datatype will be used. If there is none, an error will be reported. </para> diff --git a/doc/src/sgml/ref/drop_publication.sgml b/doc/src/sgml/ref/drop_publication.sgml index 517d142251..8e45a43982 100644 --- a/doc/src/sgml/ref/drop_publication.sgml +++ b/doc/src/sgml/ref/drop_publication.sgml @@ -46,8 +46,8 @@ DROP PUBLICATION [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> <term><literal>IF EXISTS</literal></term> <listitem> <para> - Do not throw an error if the extension does not exist. A notice is issued - in this case. + Do not throw an error if the publication does not exist. A notice is + issued in this case. </para> </listitem> </varlistentry> diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml index 5bd3438197..50292d8e26 100644 --- a/doc/src/sgml/ref/explain.sgml +++ b/doc/src/sgml/ref/explain.sgml @@ -229,7 +229,7 @@ ROLLBACK; <term><literal>SUMMARY</literal></term> <listitem> <para> - Include summary information (eg: totalled timing information) after the + Include summary information (e.g., totaled timing information) after the query plan. Summary information is included by default when <literal>ANALYZE</literal> is used but otherwise is not included by default, but can be enabled using this option. Planning time in diff --git a/doc/src/sgml/ref/load.sgml b/doc/src/sgml/ref/load.sgml index 74aff0c833..9db1743e2d 100644 --- a/doc/src/sgml/ref/load.sgml +++ b/doc/src/sgml/ref/load.sgml @@ -38,11 +38,12 @@ LOAD '<replaceable class="PARAMETER">filename</replaceable>' </para> <para> - The file name is specified in the same way as for shared library - names in <xref linkend="sql-createfunction">; in particular, one - can rely on a search path and automatic addition of the system's standard - shared library file name extension. See <xref linkend="xfunc-c"> for - more information on this topic. + The library file name is typically given as just a bare file name, + which is sought in the server's library search path (set + by <xref linkend="guc-dynamic-library-path">). Alternatively it can be + given as a full path name. In either case the platform's standard shared + library file name extension may be omitted. + See <xref linkend="xfunc-c-dynload"> for more information on this topic. </para> <indexterm> diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml index 2ab570ad4c..aa944a2e92 100644 --- a/doc/src/sgml/ref/pg_dumpall.sgml +++ b/doc/src/sgml/ref/pg_dumpall.sgml @@ -345,11 +345,14 @@ PostgreSQL documentation <term><option>--no-role-passwords</option></term> <listitem> <para> - Do not dump passwords for roles. When restored, roles will have a NULL - password and authentication will always fail until the password is reset. - Since password values aren't needed when this option is specified we - use the catalog view pg_roles in preference to pg_authid, since access - to pg_authid may be restricted by security policy. + Do not dump passwords for roles. When restored, roles will have a + null password, and password authentication will always fail until the + password is set. Since password values aren't needed when this option + is specified, the role information is read from the catalog + view <structname>pg_roles</structname> instead + of <structname>pg_authid</structname>. Therefore, this option also + helps if access to <structname>pg_authid</structname> is restricted by + some security policy. </para> </listitem> </varlistentry> diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml index 26b6ba14ba..bbd103f97e 100644 --- a/doc/src/sgml/ref/pgupgrade.sgml +++ b/doc/src/sgml/ref/pgupgrade.sgml @@ -129,7 +129,7 @@ <term><option>-k</option></term> <term><option>--link</option></term> <listitem><para>use hard links instead of copying files to the new - cluster (use junction points on Windows)</para></listitem> + cluster</para></listitem> </varlistentry> <varlistentry> @@ -323,15 +323,22 @@ NET STOP postgresql-&majorversion; </step> <step> - <title>Verify standby servers</title> + <title>Prepare for standby server upgrades</title> <para> - If you are upgrading Streaming Replication and Log-Shipping standby - servers, verify that the old standby servers are caught up by running - <application>pg_controldata</> against the old primary and standby - clusters. Verify that the <quote>Latest checkpoint location</> - values match in all clusters. (There will be a mismatch if old - standby servers were shut down before the old primary.) + If you are upgrading standby servers (as outlined in section <xref + linkend="pgupgrade-step-replicas">), verify that the old standby + servers are caught up by running <application>pg_controldata</> + against the old primary and standby clusters. Verify that the + <quote>Latest checkpoint location</> values match in all clusters. + (There will be a mismatch if old standby servers were shut down + before the old primary.) + </para> + + <para> + Also, if upgrading standby servers, change <varname>wal_level</> + to <literal>replica</> in the <filename>postgresql.conf</> file on + the new master cluster. </para> </step> @@ -416,7 +423,7 @@ pg_upgrade.exe </para> </step> - <step> + <step id="pgupgrade-step-replicas"> <title>Upgrade Streaming Replication and Log-Shipping standby servers</title> <para> @@ -478,16 +485,6 @@ pg_upgrade.exe </step> <step> - <title>Start and stop the new master cluster</title> - - <para> - In the new master cluster, change <varname>wal_level</> to - <literal>replica</> in the <filename>postgresql.conf</> file - and then start and stop the cluster. - </para> - </step> - - <step> <title>Run <application>rsync</></title> <para> diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index e6eba21eda..9faa365481 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1096,7 +1096,8 @@ testdb=> <listitem> <para> - For each relation (table, view, index, sequence, or foreign table) + For each relation (table, view, materialized view, index, sequence, + or foreign table) or composite type matching the <replaceable class="parameter">pattern</replaceable>, show all columns, their types, the tablespace (if not the default) and any @@ -1111,8 +1112,8 @@ testdb=> <para> For some types of relation, <literal>\d</> shows additional information - for each column: column values for sequences, indexed expression for - indexes and foreign data wrapper options for foreign tables. + for each column: column values for sequences, indexed expressions for + indexes, and foreign data wrapper options for foreign tables. </para> <para> @@ -1134,8 +1135,9 @@ testdb=> <para> If <command>\d</command> is used without a <replaceable class="parameter">pattern</replaceable> argument, it is - equivalent to <command>\dtvsE</command> which will show a list of - all visible tables, views, sequences and foreign tables. + equivalent to <command>\dtvmsE</command> which will show a list of + all visible tables, views, materialized views, sequences and + foreign tables. This is purely a convenience measure. </para> </note> diff --git a/doc/src/sgml/release-10.sgml b/doc/src/sgml/release-10.sgml index 1918149333..8b1b66d874 100644 --- a/doc/src/sgml/release-10.sgml +++ b/doc/src/sgml/release-10.sgml @@ -52,7 +52,7 @@ --> <para> <application>pg_upgrade</>-ed hash indexes from previous major - Postgres versions must be rebuilt. + PostgreSQL versions must be rebuilt. </para> <para> @@ -277,7 +277,7 @@ Changing this from the default value caused queries referencing parent tables to not include children tables. The <acronym>SQL</> standard requires such behavior and this has been the default since - Postgres 7.1. + PostgreSQL 7.1. </para> </listitem> @@ -308,7 +308,7 @@ <para> Users needing dump support for pre-8.0 servers need to use dump - binaries from Postgres 9.6. + binaries from PostgreSQL 9.6. </para> </listitem> @@ -323,7 +323,7 @@ <para> This removes configure's <option>--disable-integer-datetimes</> option. Floating-point datetimes/timestamps have not been the - default since Postgres 8.3 and have few advantages. + default since PostgreSQL 8.3 and have few advantages. </para> </listitem> @@ -336,7 +336,7 @@ </para> <para> - This protocol hasn't had client support since Postgres 6.3. + This protocol hasn't had client support since PostgreSQL 6.3. </para> </listitem> @@ -350,7 +350,7 @@ <para> This removes compatibility with the contrib version of full text - search that shipped in pre-8.3 Postgres versions. + search that shipped in pre-8.3 PostgreSQL versions. </para> </listitem> @@ -412,12 +412,12 @@ 2017-02-19 [0414b26ba] Add optimizer and executor support for parallel index-on --> <para> - Support parallel btree index scans (Rahila Syed, Amit Kapila, + Support parallel B-tree index scans (Rahila Syed, Amit Kapila, Robert Haas, Rafia Sabih) </para> <para> - Allows btree index pages to be checked by separate parallel + Allows B-tree index pages to be checked by separate parallel workers. </para> </listitem> @@ -735,7 +735,7 @@ 2017-01-15 [0777f7a2e] Fix matching of boolean index columns to sort ordering. --> <para> - Improve planner matching of boolean indexes (Tom Lane) + Improve planner matching of <type>boolean</type> indexes (Tom Lane) </para> </listitem> @@ -824,7 +824,7 @@ 2017-03-29 [f90d23d0c] Implement SortSupport for macaddr data type --> <para> - Improve sort performance of the macaddr data type (Brandur Leach) + Improve sort performance of the <type>macaddr</type> data type (Brandur Leach) </para> </listitem> @@ -960,7 +960,7 @@ <para> Add function <link linkend="functions-info-session-table"><function>pg_current_logfile()</></> - to read syslog's current stderr and csvlog output file names + to read logging collector's current stderr and csvlog output file names (Gilles Darold) </para> </listitem> @@ -1217,7 +1217,7 @@ 2017-04-05 [68ea2b7f9] Reduce lock level for CREATE STATISTICS --> <para> - Reduce locking required to change table params (Simon Riggs, + Reduce locking required to change table parameters (Simon Riggs, Fabrízio Mello) </para> @@ -1337,7 +1337,7 @@ <para> This allows more fine-grained replication options, including - replication between different major versions of Postgres and + replication between different major versions of PostgreSQL and selective-table replication. </para> </listitem> @@ -1732,7 +1732,7 @@ <para> This is accessed via <function>ts_headline()</> and - <function>to_tsvector</>. + <function>to_tsvector()</>. </para> </listitem> @@ -1876,7 +1876,7 @@ --> <para> Improve <link - linkend="functions-json-processing-table"><function>json_populate_record</></> + linkend="functions-json-processing-table"><function>json_populate_record()</></> and friends operate recursively (Nikita Glukhov) </para> @@ -2127,7 +2127,7 @@ </para> <para> - The ecpg version now matches the Postgres distribution version + The ecpg version now matches the PostgreSQL distribution version number. </para> </listitem> @@ -2427,7 +2427,7 @@ <para> Temporary replication slots will be used by default when - <application>pg_basebackup</> uses wal streaming with default + <application>pg_basebackup</> uses WAL streaming with default options. </para> </listitem> @@ -2525,7 +2525,7 @@ <para> Major versions will now increase just the first number, and minor releases will increase just the second number. A third number - will no longer be used in Postgres version numbers. + will no longer be used in PostgreSQL version numbers. </para> </listitem> @@ -2670,7 +2670,7 @@ 2017-04-06 [510074f9f] Remove use of Jade and DSSSL --> <para> - Use <acronym>XSLT</> to build the Postgres documentation (Peter + Use <acronym>XSLT</> to build the PostgreSQL documentation (Peter Eisentraut) </para> @@ -2785,7 +2785,7 @@ --> <para> Add <link linkend="amcheck"><application>amcheck</></> which can - check the validity of btree indexes (Peter Geoghegan) + check the validity of B-tree indexes (Peter Geoghegan) </para> </listitem> diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml index 914f1505ab..46989f0169 100644 --- a/doc/src/sgml/user-manag.sgml +++ b/doc/src/sgml/user-manag.sgml @@ -527,7 +527,7 @@ DROP ROLE doomed_role; </row> <row> <entry>pg_stat_scan_tables</entry> - <entry>Execute monitoring functions that may take AccessShareLocks on tables, + <entry>Execute monitoring functions that may take <literal>ACCESS SHARE</literal> locks on tables, potentially for a long time.</entry> </row> <row> diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 8acdb0500e..2379fdddc8 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -2360,7 +2360,7 @@ CREATE FUNCTION concat_text(text, text) RETURNS text the system should automatically assume a null result if any input value is null. By doing this, we avoid having to check for null inputs in the function code. Without this, we'd have to check for null values - explicitly, using PG_ARGISNULL(). + explicitly, using <function>PG_ARGISNULL()</function>. </para> <para> @@ -3092,7 +3092,7 @@ CREATE OR REPLACE FUNCTION retcomposite(IN integer, IN integer, </para> <para> - The directory <link linkend="tablefunc">contrib/tablefunc</> + The directory <link linkend="tablefunc"><filename>contrib/tablefunc</filename></> module in the source distribution contains more examples of set-returning functions. </para> diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c index b0e89ace5e..efebeb035a 100644 --- a/src/backend/access/brin/brin.c +++ b/src/backend/access/brin/brin.c @@ -473,7 +473,7 @@ bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm) */ Assert((key->sk_flags & SK_ISNULL) || (key->sk_collation == - bdesc->bd_tupdesc->attrs[keyattno - 1]->attcollation)); + bdesc->bd_tupdesc->attrs[keyattno - 1]->attcollation)); /* First time this column? look up consistent function */ if (consistentFn[keyattno - 1].fn_oid == InvalidOid) @@ -1116,7 +1116,7 @@ terminate_brin_buildstate(BrinBuildState *state) page = BufferGetPage(state->bs_currentInsertBuf); RecordPageWithFreeSpace(state->bs_irel, - BufferGetBlockNumber(state->bs_currentInsertBuf), + BufferGetBlockNumber(state->bs_currentInsertBuf), PageGetFreeSpace(page)); ReleaseBuffer(state->bs_currentInsertBuf); } diff --git a/src/backend/access/brin/brin_inclusion.c b/src/backend/access/brin/brin_inclusion.c index bc16dd7981..9c0a058ccb 100644 --- a/src/backend/access/brin/brin_inclusion.c +++ b/src/backend/access/brin/brin_inclusion.c @@ -312,7 +312,7 @@ brin_inclusion_consistent(PG_FUNCTION_ARGS) case RTLeftStrategyNumber: finfo = inclusion_get_strategy_procinfo(bdesc, attno, subtype, - RTOverRightStrategyNumber); + RTOverRightStrategyNumber); result = FunctionCall2Coll(finfo, colloid, unionval, query); PG_RETURN_BOOL(!DatumGetBool(result)); @@ -336,7 +336,7 @@ brin_inclusion_consistent(PG_FUNCTION_ARGS) case RTBelowStrategyNumber: finfo = inclusion_get_strategy_procinfo(bdesc, attno, subtype, - RTOverAboveStrategyNumber); + RTOverAboveStrategyNumber); result = FunctionCall2Coll(finfo, colloid, unionval, query); PG_RETURN_BOOL(!DatumGetBool(result)); @@ -354,7 +354,7 @@ brin_inclusion_consistent(PG_FUNCTION_ARGS) case RTAboveStrategyNumber: finfo = inclusion_get_strategy_procinfo(bdesc, attno, subtype, - RTOverBelowStrategyNumber); + RTOverBelowStrategyNumber); result = FunctionCall2Coll(finfo, colloid, unionval, query); PG_RETURN_BOOL(!DatumGetBool(result)); @@ -686,7 +686,7 @@ inclusion_get_strategy_procinfo(BrinDesc *bdesc, uint16 attno, Oid subtype, strategynum, attr->atttypid, subtype, opfamily); oprid = DatumGetObjectId(SysCacheGetAttr(AMOPSTRATEGY, tuple, - Anum_pg_amop_amopopr, &isNull)); + Anum_pg_amop_amopopr, &isNull)); ReleaseSysCache(tuple); Assert(!isNull && RegProcedureIsValid(oprid)); diff --git a/src/backend/access/brin/brin_minmax.c b/src/backend/access/brin/brin_minmax.c index 8f7a0c75b8..62fd90aabe 100644 --- a/src/backend/access/brin/brin_minmax.c +++ b/src/backend/access/brin/brin_minmax.c @@ -212,7 +212,7 @@ brin_minmax_consistent(PG_FUNCTION_ARGS) break; /* max() >= scankey */ finfo = minmax_get_strategy_procinfo(bdesc, attno, subtype, - BTGreaterEqualStrategyNumber); + BTGreaterEqualStrategyNumber); matches = FunctionCall2Coll(finfo, colloid, column->bv_values[1], value); break; @@ -358,7 +358,7 @@ minmax_get_strategy_procinfo(BrinDesc *bdesc, uint16 attno, Oid subtype, strategynum, attr->atttypid, subtype, opfamily); oprid = DatumGetObjectId(SysCacheGetAttr(AMOPSTRATEGY, tuple, - Anum_pg_amop_amopopr, &isNull)); + Anum_pg_amop_amopopr, &isNull)); ReleaseSysCache(tuple); Assert(!isNull && RegProcedureIsValid(oprid)); diff --git a/src/backend/access/brin/brin_pageops.c b/src/backend/access/brin/brin_pageops.c index 3609c8ae7c..80f803e438 100644 --- a/src/backend/access/brin/brin_pageops.c +++ b/src/backend/access/brin/brin_pageops.c @@ -73,8 +73,8 @@ brin_doupdate(Relation idxrel, BlockNumber pagesPerRange, { ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", - newsz, BrinMaxItemSize, RelationGetRelationName(idxrel)))); + errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", + newsz, BrinMaxItemSize, RelationGetRelationName(idxrel)))); return false; /* keep compiler quiet */ } @@ -355,9 +355,9 @@ brin_doinsert(Relation idxrel, BlockNumber pagesPerRange, { ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", - itemsz, BrinMaxItemSize, RelationGetRelationName(idxrel)))); - return InvalidOffsetNumber; /* keep compiler quiet */ + errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", + itemsz, BrinMaxItemSize, RelationGetRelationName(idxrel)))); + return InvalidOffsetNumber; /* keep compiler quiet */ } /* Make sure the revmap is long enough to contain the entry we need */ @@ -821,9 +821,9 @@ brin_getinsertbuffer(Relation irel, Buffer oldbuf, Size itemsz, ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", - itemsz, freespace, RelationGetRelationName(irel)))); - return InvalidBuffer; /* keep compiler quiet */ + errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", + itemsz, freespace, RelationGetRelationName(irel)))); + return InvalidBuffer; /* keep compiler quiet */ } if (newblk != oldblk) diff --git a/src/backend/access/brin/brin_revmap.c b/src/backend/access/brin/brin_revmap.c index e778cbcacd..22f2076887 100644 --- a/src/backend/access/brin/brin_revmap.c +++ b/src/backend/access/brin/brin_revmap.c @@ -48,7 +48,7 @@ struct BrinRevmap { Relation rm_irel; BlockNumber rm_pagesPerRange; - BlockNumber rm_lastRevmapPage; /* cached from the metapage */ + BlockNumber rm_lastRevmapPage; /* cached from the metapage */ Buffer rm_metaBuf; Buffer rm_currBuf; }; @@ -260,7 +260,7 @@ brinGetTupleForHeapBlock(BrinRevmap *revmap, BlockNumber heapBlk, if (ItemPointerIsValid(&previptr) && ItemPointerEquals(&previptr, iptr)) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg_internal("corrupted BRIN index: inconsistent range map"))); + errmsg_internal("corrupted BRIN index: inconsistent range map"))); previptr = *iptr; blk = ItemPointerGetBlockNumber(iptr); @@ -598,10 +598,10 @@ revmap_physical_extend(BrinRevmap *revmap) if (!PageIsNew(page) && !BRIN_IS_REGULAR_PAGE(page)) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("unexpected page type 0x%04X in BRIN index \"%s\" block %u", - BrinPageType(page), - RelationGetRelationName(irel), - BufferGetBlockNumber(buf)))); + errmsg("unexpected page type 0x%04X in BRIN index \"%s\" block %u", + BrinPageType(page), + RelationGetRelationName(irel), + BufferGetBlockNumber(buf)))); /* If the page is in use, evacuate it and restart */ if (brin_start_evacuating_page(irel, buf)) diff --git a/src/backend/access/brin/brin_tuple.c b/src/backend/access/brin/brin_tuple.c index e2e1d23377..ed5b4b108d 100644 --- a/src/backend/access/brin/brin_tuple.c +++ b/src/backend/access/brin/brin_tuple.c @@ -68,7 +68,7 @@ brtuple_disk_tupdesc(BrinDesc *brdesc) { for (j = 0; j < brdesc->bd_info[i]->oi_nstored; j++) TupleDescInitEntry(tupdesc, attno++, NULL, - brdesc->bd_info[i]->oi_typcache[j]->type_id, + brdesc->bd_info[i]->oi_typcache[j]->type_id, -1, 0); } diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c index 970e3aa6c9..8c6066314f 100644 --- a/src/backend/access/common/heaptuple.c +++ b/src/backend/access/common/heaptuple.c @@ -367,7 +367,7 @@ nocachegetattr(HeapTuple tuple, HeapTupleHeader tup = tuple->t_data; Form_pg_attribute *att = tupleDesc->attrs; char *tp; /* ptr to data part of tuple */ - bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ + bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ bool slow = false; /* do we have to walk attrs? */ int off; /* current offset within data */ @@ -787,7 +787,7 @@ heap_form_tuple(TupleDesc tupleDescriptor, HeapTupleHeaderSetNatts(td, numberOfAttributes); td->t_hoff = hoff; - if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */ + if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */ td->t_infomask = HEAP_HASOID; heap_fill_tuple(tupleDescriptor, @@ -969,7 +969,7 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc, int attnum; char *tp; /* ptr to tuple data */ long off; /* offset in tuple data */ - bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ + bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ bool slow = false; /* can we use/set attcacheoff? */ natts = HeapTupleHeaderGetNatts(tup); @@ -1071,7 +1071,7 @@ slot_deform_tuple(TupleTableSlot *slot, int natts) int attnum; char *tp; /* ptr to tuple data */ long off; /* offset in tuple data */ - bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ + bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */ bool slow; /* can we use/set attcacheoff? */ /* @@ -1319,7 +1319,7 @@ slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull) { if (tuple == NULL) /* internal error */ elog(ERROR, "cannot extract system attribute from virtual tuple"); - if (tuple == &(slot->tts_minhdr)) /* internal error */ + if (tuple == &(slot->tts_minhdr)) /* internal error */ elog(ERROR, "cannot extract system attribute from minimal tuple"); return heap_getsysattr(tuple, attnum, tupleDesc, isnull); } @@ -1533,7 +1533,7 @@ slot_attisnull(TupleTableSlot *slot, int attnum) { if (tuple == NULL) /* internal error */ elog(ERROR, "cannot extract system attribute from virtual tuple"); - if (tuple == &(slot->tts_minhdr)) /* internal error */ + if (tuple == &(slot->tts_minhdr)) /* internal error */ elog(ERROR, "cannot extract system attribute from minimal tuple"); return heap_attisnull(tuple, attnum); } @@ -1651,7 +1651,7 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor, HeapTupleHeaderSetNatts(tuple, numberOfAttributes); tuple->t_hoff = hoff + MINIMAL_TUPLE_OFFSET; - if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */ + if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */ tuple->t_infomask = HEAP_HASOID; heap_fill_tuple(tupleDescriptor, diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c index 2846ec8b34..37a21057d0 100644 --- a/src/backend/access/common/indextuple.c +++ b/src/backend/access/common/indextuple.c @@ -80,7 +80,7 @@ index_form_tuple(TupleDesc tupleDescriptor, { untoasted_values[i] = PointerGetDatum(heap_tuple_fetch_attr((struct varlena *) - DatumGetPointer(values[i]))); + DatumGetPointer(values[i]))); untoasted_free[i] = true; } @@ -89,7 +89,7 @@ index_form_tuple(TupleDesc tupleDescriptor, * try to compress it in-line. */ if (!VARATT_IS_EXTENDED(DatumGetPointer(untoasted_values[i])) && - VARSIZE(DatumGetPointer(untoasted_values[i])) > TOAST_INDEX_TARGET && + VARSIZE(DatumGetPointer(untoasted_values[i])) > TOAST_INDEX_TARGET && (att->attstorage == 'x' || att->attstorage == 'm')) { Datum cvalue = toast_compress_datum(untoasted_values[i]); diff --git a/src/backend/access/common/printsimple.c b/src/backend/access/common/printsimple.c index 851c3bf4de..c863e859fe 100644 --- a/src/backend/access/common/printsimple.c +++ b/src/backend/access/common/printsimple.c @@ -103,7 +103,7 @@ printsimple(TupleTableSlot *slot, DestReceiver *self) case INT4OID: { int32 num = DatumGetInt32(value); - char str[12]; /* sign, 10 digits and '\0' */ + char str[12]; /* sign, 10 digits and '\0' */ pg_ltoa(num, str); pq_sendcountedtext(&buf, str, strlen(str), false); @@ -113,7 +113,7 @@ printsimple(TupleTableSlot *slot, DestReceiver *self) case INT8OID: { int64 num = DatumGetInt64(value); - char str[23]; /* sign, 21 digits and '\0' */ + char str[23]; /* sign, 21 digits and '\0' */ pg_lltoa(num, str); pq_sendcountedtext(&buf, str, strlen(str), false); diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c index 6d1f22f049..ec10762529 100644 --- a/src/backend/access/common/reloptions.c +++ b/src/backend/access/common/reloptions.c @@ -537,7 +537,7 @@ add_reloption_kind(void) if (last_assigned_kind >= RELOPT_KIND_MAX) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("user-defined relation parameter types limit exceeded"))); + errmsg("user-defined relation parameter types limit exceeded"))); last_assigned_kind <<= 1; return (relopt_kind) last_assigned_kind; } @@ -567,7 +567,7 @@ add_reloption(relopt_gen *newoption) { max_custom_options *= 2; custom_options = repalloc(custom_options, - max_custom_options * sizeof(relopt_gen *)); + max_custom_options * sizeof(relopt_gen *)); } MemoryContextSwitchTo(oldcxt); } @@ -818,7 +818,7 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace, if (def->arg != NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("RESET must not include values for parameters"))); + errmsg("RESET must not include values for parameters"))); } else { @@ -1137,8 +1137,8 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len, if (validate && !parsed) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid value for boolean option \"%s\": %s", - option->gen->name, value))); + errmsg("invalid value for boolean option \"%s\": %s", + option->gen->name, value))); } break; case RELOPT_TYPE_INT: @@ -1149,16 +1149,16 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len, if (validate && !parsed) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid value for integer option \"%s\": %s", - option->gen->name, value))); + errmsg("invalid value for integer option \"%s\": %s", + option->gen->name, value))); if (validate && (option->values.int_val < optint->min || option->values.int_val > optint->max)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("value %s out of bounds for option \"%s\"", - value, option->gen->name), - errdetail("Valid values are between \"%d\" and \"%d\".", - optint->min, optint->max))); + errmsg("value %s out of bounds for option \"%s\"", + value, option->gen->name), + errdetail("Valid values are between \"%d\" and \"%d\".", + optint->min, optint->max))); } break; case RELOPT_TYPE_REAL: @@ -1175,10 +1175,10 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len, option->values.real_val > optreal->max)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("value %s out of bounds for option \"%s\"", - value, option->gen->name), - errdetail("Valid values are between \"%f\" and \"%f\".", - optreal->min, optreal->max))); + errmsg("value %s out of bounds for option \"%s\"", + value, option->gen->name), + errdetail("Valid values are between \"%f\" and \"%f\".", + optreal->min, optreal->max))); } break; case RELOPT_TYPE_STRING: @@ -1321,33 +1321,33 @@ default_reloptions(Datum reloptions, bool validate, relopt_kind kind) static const relopt_parse_elt tab[] = { {"fillfactor", RELOPT_TYPE_INT, offsetof(StdRdOptions, fillfactor)}, {"autovacuum_enabled", RELOPT_TYPE_BOOL, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, enabled)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, enabled)}, {"autovacuum_vacuum_threshold", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_threshold)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_threshold)}, {"autovacuum_analyze_threshold", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_threshold)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_threshold)}, {"autovacuum_vacuum_cost_delay", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_cost_delay)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_delay)}, {"autovacuum_vacuum_cost_limit", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_cost_limit)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_limit)}, {"autovacuum_freeze_min_age", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_min_age)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_min_age)}, {"autovacuum_freeze_max_age", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_max_age)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_max_age)}, {"autovacuum_freeze_table_age", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_table_age)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_table_age)}, {"autovacuum_multixact_freeze_min_age", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, multixact_freeze_min_age)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_min_age)}, {"autovacuum_multixact_freeze_max_age", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, multixact_freeze_max_age)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_max_age)}, {"autovacuum_multixact_freeze_table_age", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, multixact_freeze_table_age)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, multixact_freeze_table_age)}, {"log_autovacuum_min_duration", RELOPT_TYPE_INT, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, log_min_duration)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, log_min_duration)}, {"autovacuum_vacuum_scale_factor", RELOPT_TYPE_REAL, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_scale_factor)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_scale_factor)}, {"autovacuum_analyze_scale_factor", RELOPT_TYPE_REAL, - offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_scale_factor)}, + offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_scale_factor)}, {"user_catalog_table", RELOPT_TYPE_BOOL, offsetof(StdRdOptions, user_catalog_table)}, {"parallel_workers", RELOPT_TYPE_INT, diff --git a/src/backend/access/common/tupconvert.c b/src/backend/access/common/tupconvert.c index 392a49b522..57e44375ea 100644 --- a/src/backend/access/common/tupconvert.c +++ b/src/backend/access/common/tupconvert.c @@ -188,7 +188,7 @@ convert_tuples_by_position(TupleDesc indesc, n = indesc->natts + 1; /* +1 for NULL */ map->invalues = (Datum *) palloc(n * sizeof(Datum)); map->inisnull = (bool *) palloc(n * sizeof(bool)); - map->invalues[0] = (Datum) 0; /* set up the NULL entry */ + map->invalues[0] = (Datum) 0; /* set up the NULL entry */ map->inisnull[0] = true; return map; @@ -267,7 +267,7 @@ convert_tuples_by_name(TupleDesc indesc, n = indesc->natts + 1; /* +1 for NULL */ map->invalues = (Datum *) palloc(n * sizeof(Datum)); map->inisnull = (bool *) palloc(n * sizeof(bool)); - map->invalues[0] = (Datum) 0; /* set up the NULL entry */ + map->invalues[0] = (Datum) 0; /* set up the NULL entry */ map->inisnull[0] = true; return map; diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c index cc7435e030..a5238c3af5 100644 --- a/src/backend/access/gin/ginarrayproc.c +++ b/src/backend/access/gin/ginarrayproc.c @@ -113,7 +113,7 @@ ginqueryarrayextract(PG_FUNCTION_ARGS) case GinContainsStrategy: if (nelems > 0) *searchMode = GIN_SEARCH_MODE_DEFAULT; - else /* everything contains the empty set */ + else /* everything contains the empty set */ *searchMode = GIN_SEARCH_MODE_ALL; break; case GinContainedStrategy: diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginbulk.c index f07c76b90b..4ff149e59a 100644 --- a/src/backend/access/gin/ginbulk.c +++ b/src/backend/access/gin/ginbulk.c @@ -116,7 +116,7 @@ ginInitBA(BuildAccumulator *accum) cmpEntryAccumulator, ginCombineData, ginAllocEntryAccumulator, - NULL, /* no freefunc needed */ + NULL, /* no freefunc needed */ (void *) accum); } diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c index ad62d4e0e9..2e5ea47976 100644 --- a/src/backend/access/gin/gindatapage.c +++ b/src/backend/access/gin/gindatapage.c @@ -391,7 +391,7 @@ GinDataPageAddPostingItem(Page page, PostingItem *data, OffsetNumber offset) if (offset != maxoff + 1) memmove(ptr + sizeof(PostingItem), ptr, - (maxoff - offset + 1) *sizeof(PostingItem)); + (maxoff - offset + 1) * sizeof(PostingItem)); } memcpy(ptr, data, sizeof(PostingItem)); @@ -685,7 +685,7 @@ dataBeginPlaceToPageLeaf(GinBtree btree, Buffer buf, GinBtreeStack *stack, Assert(GinPageRightMost(page) || ginCompareItemPointers(GinDataPageGetRightBound(*newlpage), - GinDataPageGetRightBound(*newrpage)) < 0); + GinDataPageGetRightBound(*newrpage)) < 0); if (append) elog(DEBUG2, "appended %d items to block %u; split %d/%d (%d to go)", @@ -1468,7 +1468,7 @@ addItemsToLeaf(disassembledLeaf *leaf, ItemPointer newItems, int nNewItems) ItemPointerData next_first; next = (leafSegmentInfo *) dlist_container(leafSegmentInfo, node, - dlist_next_node(&leaf->segments, iter.cur)); + dlist_next_node(&leaf->segments, iter.cur)); if (next->items) next_first = next->items[0]; else @@ -1595,7 +1595,7 @@ leafRepackItems(disassembledLeaf *leaf, ItemPointer remaining) { seginfo->seg = ginCompressPostingList(seginfo->items, seginfo->nitems, - GinPostingListSegmentMaxSize, + GinPostingListSegmentMaxSize, &npacked); } if (npacked != seginfo->nitems) @@ -1610,7 +1610,7 @@ leafRepackItems(disassembledLeaf *leaf, ItemPointer remaining) pfree(seginfo->seg); seginfo->seg = ginCompressPostingList(seginfo->items, seginfo->nitems, - GinPostingListSegmentTargetSize, + GinPostingListSegmentTargetSize, &npacked); if (seginfo->action != GIN_SEGMENT_INSERT) seginfo->action = GIN_SEGMENT_REPLACE; diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c index 8c9859ce8e..d5cc70258a 100644 --- a/src/backend/access/gin/ginentrypage.c +++ b/src/backend/access/gin/ginentrypage.c @@ -107,9 +107,9 @@ GinFormTuple(GinState *ginstate, if (errorTooBig) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", - (Size) newsize, (Size) GinMaxItemSize, - RelationGetRelationName(ginstate->index)))); + errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", + (Size) newsize, (Size) GinMaxItemSize, + RelationGetRelationName(ginstate->index)))); pfree(itup); return NULL; } @@ -256,7 +256,7 @@ entryIsMoveRight(GinBtree btree, Page page) key = gintuple_get_key(btree->ginstate, itup, &category); if (ginCompareAttEntries(btree->ginstate, - btree->entryAttnum, btree->entryKey, btree->entryCategory, + btree->entryAttnum, btree->entryKey, btree->entryCategory, attnum, key, category) > 0) return TRUE; diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c index 0d5bb70cc9..59e435465a 100644 --- a/src/backend/access/gin/ginfast.c +++ b/src/backend/access/gin/ginfast.c @@ -482,7 +482,7 @@ ginHeapTupleFastCollect(GinState *ginstate, { collector->lentuples *= 2; collector->tuples = (IndexTuple *) repalloc(collector->tuples, - sizeof(IndexTuple) * collector->lentuples); + sizeof(IndexTuple) * collector->lentuples); } /* @@ -874,7 +874,7 @@ ginInsertCleanup(GinState *ginstate, bool full_clean, */ ginBeginBAScan(&accum); while ((list = ginGetBAEntry(&accum, - &attnum, &key, &category, &nlist)) != NULL) + &attnum, &key, &category, &nlist)) != NULL) { ginEntryInsert(ginstate, attnum, key, category, list, nlist, NULL); @@ -904,7 +904,7 @@ ginInsertCleanup(GinState *ginstate, bool full_clean, ginBeginBAScan(&accum); while ((list = ginGetBAEntry(&accum, - &attnum, &key, &category, &nlist)) != NULL) + &attnum, &key, &category, &nlist)) != NULL) ginEntryInsert(ginstate, attnum, key, category, list, nlist, NULL); } @@ -913,8 +913,8 @@ ginInsertCleanup(GinState *ginstate, bool full_clean, * Remember next page - it will become the new list head */ blkno = GinPageGetOpaque(page)->rightlink; - UnlockReleaseBuffer(buffer); /* shiftList will do exclusive - * locking */ + UnlockReleaseBuffer(buffer); /* shiftList will do exclusive + * locking */ /* * remove read pages from pending list, at this point all content @@ -989,7 +989,7 @@ gin_clean_pending_list(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("recovery is in progress"), - errhint("GIN pending list cannot be cleaned up during recovery."))); + errhint("GIN pending list cannot be cleaned up during recovery."))); /* Must be a GIN index */ if (indexRel->rd_rel->relkind != RELKIND_INDEX || @@ -1007,7 +1007,7 @@ gin_clean_pending_list(PG_FUNCTION_ARGS) if (RELATION_IS_OTHER_TEMP(indexRel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot access temporary indexes of other sessions"))); + errmsg("cannot access temporary indexes of other sessions"))); /* User must own the index (comparable to privileges needed for VACUUM) */ if (!pg_class_ownercheck(indexoid, GetUserId())) diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c index 610d386ff8..56a5bf47b8 100644 --- a/src/backend/access/gin/ginget.c +++ b/src/backend/access/gin/ginget.c @@ -179,11 +179,11 @@ collectMatchBitmap(GinBtreeData *btree, GinBtreeStack *stack, *---------- */ cmp = DatumGetInt32(FunctionCall4Coll(&btree->ginstate->comparePartialFn[attnum - 1], - btree->ginstate->supportCollation[attnum - 1], + btree->ginstate->supportCollation[attnum - 1], scanEntry->queryKey, idatum, - UInt16GetDatum(scanEntry->strategy), - PointerGetDatum(scanEntry->extra_data))); + UInt16GetDatum(scanEntry->strategy), + PointerGetDatum(scanEntry->extra_data))); if (cmp > 0) return true; @@ -628,7 +628,7 @@ entryLoadMoreItems(GinState *ginstate, GinScanEntry entry, { ItemPointerSet(&entry->btree.itemptr, GinItemPointerGetBlockNumber(&advancePast), - OffsetNumberNext(GinItemPointerGetOffsetNumber(&advancePast))); + OffsetNumberNext(GinItemPointerGetOffsetNumber(&advancePast))); } entry->btree.fullScan = false; stack = ginFindLeafPage(&entry->btree, true, snapshot); @@ -990,7 +990,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key, Assert(GinItemPointerGetOffsetNumber(&minItem) > 0); ItemPointerSet(&advancePast, GinItemPointerGetBlockNumber(&minItem), - OffsetNumberPrev(GinItemPointerGetOffsetNumber(&minItem))); + OffsetNumberPrev(GinItemPointerGetOffsetNumber(&minItem))); } /* @@ -1249,7 +1249,7 @@ scanGetItem(IndexScanDesc scan, ItemPointerData advancePast, GinItemPointerGetBlockNumber(&key->curItem)) { ItemPointerSet(&advancePast, - GinItemPointerGetBlockNumber(&key->curItem), + GinItemPointerGetBlockNumber(&key->curItem), InvalidOffsetNumber); } } @@ -1461,11 +1461,11 @@ matchPartialInPendingList(GinState *ginstate, Page page, *---------- */ cmp = DatumGetInt32(FunctionCall4Coll(&ginstate->comparePartialFn[entry->attnum - 1], - ginstate->supportCollation[entry->attnum - 1], + ginstate->supportCollation[entry->attnum - 1], entry->queryKey, datum[off - 1], UInt16GetDatum(entry->strategy), - PointerGetDatum(entry->extra_data))); + PointerGetDatum(entry->extra_data))); if (cmp == 0) return true; else if (cmp > 0) diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c index d90faae65d..5378011f50 100644 --- a/src/backend/access/gin/gininsert.c +++ b/src/backend/access/gin/gininsert.c @@ -292,7 +292,7 @@ ginBuildCallback(Relation index, HeapTuple htup, Datum *values, ginBeginBAScan(&buildstate->accum); while ((list = ginGetBAEntry(&buildstate->accum, - &attnum, &key, &category, &nlist)) != NULL) + &attnum, &key, &category, &nlist)) != NULL) { /* there could be many entries, so be willing to abort here */ CHECK_FOR_INTERRUPTS(); @@ -380,7 +380,7 @@ ginbuild(Relation heap, Relation index, IndexInfo *indexInfo) * ginExtractEntries(), and can be reset after each tuple */ buildstate.funcCtx = AllocSetContextCreate(CurrentMemoryContext, - "Gin build temporary context for user-defined function", + "Gin build temporary context for user-defined function", ALLOCSET_DEFAULT_SIZES); buildstate.accum.ginstate = &buildstate.ginstate; diff --git a/src/backend/access/gin/ginlogic.c b/src/backend/access/gin/ginlogic.c index a940a9374a..5b8ad9a25a 100644 --- a/src/backend/access/gin/ginlogic.c +++ b/src/backend/access/gin/ginlogic.c @@ -83,9 +83,9 @@ directBoolConsistentFn(GinScanKey key) key->query, UInt32GetDatum(key->nuserentries), PointerGetDatum(key->extra_data), - PointerGetDatum(&key->recheckCurItem), + PointerGetDatum(&key->recheckCurItem), PointerGetDatum(key->queryValues), - PointerGetDatum(key->queryCategories))); + PointerGetDatum(key->queryCategories))); } /* @@ -95,15 +95,15 @@ static GinTernaryValue directTriConsistentFn(GinScanKey key) { return DatumGetGinTernaryValue(FunctionCall7Coll( - key->triConsistentFmgrInfo, + key->triConsistentFmgrInfo, key->collation, - PointerGetDatum(key->entryRes), - UInt16GetDatum(key->strategy), + PointerGetDatum(key->entryRes), + UInt16GetDatum(key->strategy), key->query, - UInt32GetDatum(key->nuserentries), - PointerGetDatum(key->extra_data), - PointerGetDatum(key->queryValues), - PointerGetDatum(key->queryCategories))); + UInt32GetDatum(key->nuserentries), + PointerGetDatum(key->extra_data), + PointerGetDatum(key->queryValues), + PointerGetDatum(key->queryCategories))); } /* @@ -117,15 +117,15 @@ shimBoolConsistentFn(GinScanKey key) GinTernaryValue result; result = DatumGetGinTernaryValue(FunctionCall7Coll( - key->triConsistentFmgrInfo, + key->triConsistentFmgrInfo, key->collation, - PointerGetDatum(key->entryRes), - UInt16GetDatum(key->strategy), + PointerGetDatum(key->entryRes), + UInt16GetDatum(key->strategy), key->query, - UInt32GetDatum(key->nuserentries), - PointerGetDatum(key->extra_data), - PointerGetDatum(key->queryValues), - PointerGetDatum(key->queryCategories))); + UInt32GetDatum(key->nuserentries), + PointerGetDatum(key->extra_data), + PointerGetDatum(key->queryValues), + PointerGetDatum(key->queryCategories))); if (result == GIN_MAYBE) { key->recheckCurItem = true; diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c index c83375d6b4..7ceea7a741 100644 --- a/src/backend/access/gin/ginscan.c +++ b/src/backend/access/gin/ginscan.c @@ -310,11 +310,11 @@ ginNewScanKey(IndexScanDesc scan) /* OK to call the extractQueryFn */ queryValues = (Datum *) DatumGetPointer(FunctionCall7Coll(&so->ginstate.extractQueryFn[skey->sk_attno - 1], - so->ginstate.supportCollation[skey->sk_attno - 1], + so->ginstate.supportCollation[skey->sk_attno - 1], skey->sk_argument, PointerGetDatum(&nQueryValues), - UInt16GetDatum(skey->sk_strategy), - PointerGetDatum(&partial_matches), + UInt16GetDatum(skey->sk_strategy), + PointerGetDatum(&partial_matches), PointerGetDatum(&extra_data), PointerGetDatum(&nullFlags), PointerGetDatum(&searchMode))); @@ -362,7 +362,7 @@ ginNewScanKey(IndexScanDesc scan) { if (nullFlags[j]) { - nullFlags[j] = true; /* not any other nonzero value */ + nullFlags[j] = true; /* not any other nonzero value */ hasNullQuery = true; } } diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c index d03d59da6a..91e4a8cf70 100644 --- a/src/backend/access/gin/ginutil.c +++ b/src/backend/access/gin/ginutil.c @@ -131,8 +131,8 @@ initGinState(GinState *state, Relation index) if (!OidIsValid(typentry->cmp_proc_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify a comparison function for type %s", - format_type_be(origTupdesc->attrs[i]->atttypid)))); + errmsg("could not identify a comparison function for type %s", + format_type_be(origTupdesc->attrs[i]->atttypid)))); fmgr_info_copy(&(state->compareFn[i]), &(typentry->cmp_proc_finfo), CurrentMemoryContext); @@ -153,14 +153,14 @@ initGinState(GinState *state, Relation index) if (index_getprocid(index, i + 1, GIN_TRICONSISTENT_PROC) != InvalidOid) { fmgr_info_copy(&(state->triConsistentFn[i]), - index_getprocinfo(index, i + 1, GIN_TRICONSISTENT_PROC), + index_getprocinfo(index, i + 1, GIN_TRICONSISTENT_PROC), CurrentMemoryContext); } if (index_getprocid(index, i + 1, GIN_CONSISTENT_PROC) != InvalidOid) { fmgr_info_copy(&(state->consistentFn[i]), - index_getprocinfo(index, i + 1, GIN_CONSISTENT_PROC), + index_getprocinfo(index, i + 1, GIN_CONSISTENT_PROC), CurrentMemoryContext); } @@ -178,7 +178,7 @@ initGinState(GinState *state, Relation index) if (index_getprocid(index, i + 1, GIN_COMPARE_PARTIAL_PROC) != InvalidOid) { fmgr_info_copy(&(state->comparePartialFn[i]), - index_getprocinfo(index, i + 1, GIN_COMPARE_PARTIAL_PROC), + index_getprocinfo(index, i + 1, GIN_COMPARE_PARTIAL_PROC), CurrentMemoryContext); state->canPartialMatch[i] = true; } @@ -392,7 +392,7 @@ ginCompareEntries(GinState *ginstate, OffsetNumber attnum, /* both not null, so safe to call the compareFn */ return DatumGetInt32(FunctionCall2Coll(&ginstate->compareFn[attnum - 1], - ginstate->supportCollation[attnum - 1], + ginstate->supportCollation[attnum - 1], a, b)); } @@ -499,7 +499,7 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum, nullFlags = NULL; /* in case extractValue doesn't set it */ entries = (Datum *) DatumGetPointer(FunctionCall3Coll(&ginstate->extractValueFn[attnum - 1], - ginstate->supportCollation[attnum - 1], + ginstate->supportCollation[attnum - 1], value, PointerGetDatum(nentries), PointerGetDatum(&nullFlags))); @@ -602,7 +602,7 @@ ginoptions(Datum reloptions, bool validate) static const relopt_parse_elt tab[] = { {"fastupdate", RELOPT_TYPE_BOOL, offsetof(GinOptions, useFastUpdate)}, {"gin_pending_list_limit", RELOPT_TYPE_INT, offsetof(GinOptions, - pendingListCleanupSize)} + pendingListCleanupSize)} }; options = parseRelOptions(reloptions, validate, RELOPT_KIND_GIN, diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c index 27e502a360..31425e9963 100644 --- a/src/backend/access/gin/ginvacuum.c +++ b/src/backend/access/gin/ginvacuum.c @@ -650,7 +650,7 @@ ginbulkdelete(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, vacuum_delay_point(); } - if (blkno == InvalidBlockNumber) /* rightmost page */ + if (blkno == InvalidBlockNumber) /* rightmost page */ break; buffer = ReadBufferExtended(index, MAIN_FORKNUM, blkno, diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 6593771361..565525bbdf 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -28,7 +28,7 @@ /* non-export function prototypes */ static void gistfixsplit(GISTInsertState *state, GISTSTATE *giststate); static bool gistinserttuple(GISTInsertState *state, GISTInsertStack *stack, - GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum); + GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum); static bool gistinserttuples(GISTInsertState *state, GISTInsertStack *stack, GISTSTATE *giststate, IndexTuple *tuples, int ntup, OffsetNumber oldoffnum, @@ -1170,7 +1170,7 @@ gistfixsplit(GISTInsertState *state, GISTSTATE *giststate) */ static bool gistinserttuple(GISTInsertState *state, GISTInsertStack *stack, - GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum) + GISTSTATE *giststate, IndexTuple tuple, OffsetNumber oldoffnum) { return gistinserttuples(state, stack, giststate, &tuple, 1, oldoffnum, InvalidBuffer, InvalidBuffer, false, false); @@ -1360,9 +1360,9 @@ gistSplit(Relation r, if (len == 1) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", - IndexTupleSize(itup[0]), GiSTPageSize, - RelationGetRelationName(r)))); + errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", + IndexTupleSize(itup[0]), GiSTPageSize, + RelationGetRelationName(r)))); memset(v.spl_lisnull, TRUE, sizeof(bool) * giststate->tupdesc->natts); memset(v.spl_risnull, TRUE, sizeof(bool) * giststate->tupdesc->natts); @@ -1442,7 +1442,7 @@ initGISTstate(Relation index) giststate = (GISTSTATE *) palloc(sizeof(GISTSTATE)); giststate->scanCxt = scanCxt; - giststate->tempCxt = scanCxt; /* caller must change this if needed */ + giststate->tempCxt = scanCxt; /* caller must change this if needed */ giststate->tupdesc = index->rd_att; for (i = 0; i < index->rd_att->natts; i++) @@ -1471,7 +1471,7 @@ initGISTstate(Relation index) /* opclasses are not required to provide a Distance method */ if (OidIsValid(index_getprocid(index, i + 1, GIST_DISTANCE_PROC))) fmgr_info_copy(&(giststate->distanceFn[i]), - index_getprocinfo(index, i + 1, GIST_DISTANCE_PROC), + index_getprocinfo(index, i + 1, GIST_DISTANCE_PROC), scanCxt); else giststate->distanceFn[i].fn_oid = InvalidOid; diff --git a/src/backend/access/gist/gistbuild.c b/src/backend/access/gist/gistbuild.c index f1f08bb3d8..4756a70ae6 100644 --- a/src/backend/access/gist/gistbuild.c +++ b/src/backend/access/gist/gistbuild.c @@ -248,7 +248,7 @@ gistValidateBufferingOption(char *value) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("invalid value for \"buffering\" option"), - errdetail("Valid values are \"on\", \"off\", and \"auto\"."))); + errdetail("Valid values are \"on\", \"off\", and \"auto\"."))); } } @@ -814,7 +814,7 @@ gistbufferinginserttuples(GISTBuildState *buildstate, Buffer buffer, int level, downlinks, ndownlinks, downlinkoffnum, InvalidBlockNumber, InvalidOffsetNumber); - list_free_deep(splitinfo); /* we don't need this anymore */ + list_free_deep(splitinfo); /* we don't need this anymore */ } else UnlockReleaseBuffer(buffer); @@ -1083,7 +1083,7 @@ gistGetMaxLevel(Relation index) * everywhere, so we just pick the first one. */ itup = (IndexTuple) PageGetItem(page, - PageGetItemId(page, FirstOffsetNumber)); + PageGetItemId(page, FirstOffsetNumber)); blkno = ItemPointerGetBlockNumber(&(itup->t_tid)); UnlockReleaseBuffer(buffer); @@ -1143,7 +1143,7 @@ gistInitParentMap(GISTBuildState *buildstate) buildstate->parentMap = hash_create("gistbuild parent map", 1024, &hashCtl, - HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); + HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); } static void diff --git a/src/backend/access/gist/gistbuildbuffers.c b/src/backend/access/gist/gistbuildbuffers.c index ca4c32b3fe..88cee2028d 100644 --- a/src/backend/access/gist/gistbuildbuffers.c +++ b/src/backend/access/gist/gistbuildbuffers.c @@ -102,7 +102,7 @@ gistInitBuildBuffers(int pagesPerBuffer, int levelStep, int maxLevel) */ gfbb->loadedBuffersLen = 32; gfbb->loadedBuffers = (GISTNodeBuffer **) palloc(gfbb->loadedBuffersLen * - sizeof(GISTNodeBuffer *)); + sizeof(GISTNodeBuffer *)); gfbb->loadedBuffersCount = 0; gfbb->rootlevel = maxLevel; @@ -709,7 +709,7 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate, * page seen so far. Skip the remaining columns and move * on to the next page, if any. */ - zero_penalty = false; /* so outer loop won't exit */ + zero_penalty = false; /* so outer loop won't exit */ break; } } diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index 5a4dea89ac..760ea0c997 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -147,7 +147,7 @@ gistindex_keytest(IndexScanDesc scan, { int i; - if (GistPageIsLeaf(page)) /* shouldn't happen */ + if (GistPageIsLeaf(page)) /* shouldn't happen */ elog(ERROR, "invalid GiST tuple found on leaf page"); for (i = 0; i < scan->numberOfOrderBys; i++) so->distances[i] = -get_float8_infinity(); diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c index 15b89fd8ad..08990f5a1b 100644 --- a/src/backend/access/gist/gistproc.c +++ b/src/backend/access/gist/gistproc.c @@ -910,64 +910,64 @@ gist_box_leaf_consistent(BOX *key, BOX *query, StrategyNumber strategy) case RTLeftStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_left, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverLeftStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_overleft, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverlapStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_overlap, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverRightStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_overright, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTRightStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_right, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTSameStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_same, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTContainsStrategyNumber: case RTOldContainsStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_contain, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTContainedByStrategyNumber: case RTOldContainedByStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_contained, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverBelowStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_overbelow, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTBelowStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_below, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTAboveStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_above, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverAboveStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_overabove, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; default: elog(ERROR, "unrecognized strategy number: %d", strategy); @@ -997,60 +997,60 @@ rtree_internal_consistent(BOX *key, BOX *query, StrategyNumber strategy) case RTLeftStrategyNumber: retval = !DatumGetBool(DirectFunctionCall2(box_overright, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverLeftStrategyNumber: retval = !DatumGetBool(DirectFunctionCall2(box_right, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverlapStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_overlap, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverRightStrategyNumber: retval = !DatumGetBool(DirectFunctionCall2(box_left, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTRightStrategyNumber: retval = !DatumGetBool(DirectFunctionCall2(box_overleft, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTSameStrategyNumber: case RTContainsStrategyNumber: case RTOldContainsStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_contain, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTContainedByStrategyNumber: case RTOldContainedByStrategyNumber: retval = DatumGetBool(DirectFunctionCall2(box_overlap, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverBelowStrategyNumber: retval = !DatumGetBool(DirectFunctionCall2(box_above, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTBelowStrategyNumber: retval = !DatumGetBool(DirectFunctionCall2(box_overabove, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTAboveStrategyNumber: retval = !DatumGetBool(DirectFunctionCall2(box_overbelow, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; case RTOverAboveStrategyNumber: retval = !DatumGetBool(DirectFunctionCall2(box_below, PointerGetDatum(key), - PointerGetDatum(query))); + PointerGetDatum(query))); break; default: elog(ERROR, "unrecognized strategy number: %d", strategy); @@ -1419,11 +1419,11 @@ gist_point_consistent(PG_FUNCTION_ARGS) POLYGON *query = PG_GETARG_POLYGON_P(1); result = DatumGetBool(DirectFunctionCall5( - gist_poly_consistent, - PointerGetDatum(entry), - PolygonPGetDatum(query), - Int16GetDatum(RTOverlapStrategyNumber), - 0, PointerGetDatum(recheck))); + gist_poly_consistent, + PointerGetDatum(entry), + PolygonPGetDatum(query), + Int16GetDatum(RTOverlapStrategyNumber), + 0, PointerGetDatum(recheck))); if (GIST_LEAF(entry) && result) { @@ -1437,8 +1437,8 @@ gist_point_consistent(PG_FUNCTION_ARGS) && box->high.y == box->low.y); result = DatumGetBool(DirectFunctionCall2( poly_contain_pt, - PolygonPGetDatum(query), - PointPGetDatum(&box->high))); + PolygonPGetDatum(query), + PointPGetDatum(&box->high))); *recheck = false; } } @@ -1448,11 +1448,11 @@ gist_point_consistent(PG_FUNCTION_ARGS) CIRCLE *query = PG_GETARG_CIRCLE_P(1); result = DatumGetBool(DirectFunctionCall5( - gist_circle_consistent, - PointerGetDatum(entry), - CirclePGetDatum(query), - Int16GetDatum(RTOverlapStrategyNumber), - 0, PointerGetDatum(recheck))); + gist_circle_consistent, + PointerGetDatum(entry), + CirclePGetDatum(query), + Int16GetDatum(RTOverlapStrategyNumber), + 0, PointerGetDatum(recheck))); if (GIST_LEAF(entry) && result) { @@ -1465,9 +1465,9 @@ gist_point_consistent(PG_FUNCTION_ARGS) Assert(box->high.x == box->low.x && box->high.y == box->low.y); result = DatumGetBool(DirectFunctionCall2( - circle_contain_pt, - CirclePGetDatum(query), - PointPGetDatum(&box->high))); + circle_contain_pt, + CirclePGetDatum(query), + PointPGetDatum(&box->high))); *recheck = false; } } diff --git a/src/backend/access/gist/gistsplit.c b/src/backend/access/gist/gistsplit.c index cffc5ddc75..617f42c317 100644 --- a/src/backend/access/gist/gistsplit.c +++ b/src/backend/access/gist/gistsplit.c @@ -443,8 +443,8 @@ gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVec */ ereport(DEBUG1, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("picksplit method for column %d of index \"%s\" failed", - attno + 1, RelationGetRelationName(r)), + errmsg("picksplit method for column %d of index \"%s\" failed", + attno + 1, RelationGetRelationName(r)), errhint("The index is not optimal. To optimize it, contact a developer, or try to use the column as the second one in the CREATE INDEX command."))); /* diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c index cbdaec9d2b..b6ccc1a66a 100644 --- a/src/backend/access/gist/gistutil.c +++ b/src/backend/access/gist/gistutil.c @@ -552,7 +552,7 @@ gistdentryinit(GISTSTATE *giststate, int nkey, GISTENTRY *e, gistentryinit(*e, k, r, pg, o, l); dep = (GISTENTRY *) DatumGetPointer(FunctionCall1Coll(&giststate->decompressFn[nkey], - giststate->supportCollation[nkey], + giststate->supportCollation[nkey], PointerGetDatum(e))); /* decompressFn may just return the given pointer */ if (dep != e) @@ -587,7 +587,7 @@ gistFormTuple(GISTSTATE *giststate, Relation r, isleaf); cep = (GISTENTRY *) DatumGetPointer(FunctionCall1Coll(&giststate->compressFn[i], - giststate->supportCollation[i], + giststate->supportCollation[i], PointerGetDatum(¢ry))); compatt[i] = cep->key; } @@ -733,9 +733,9 @@ gistcheckpage(Relation rel, Buffer buf) if (PageIsNew(page)) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("index \"%s\" contains unexpected zero page at block %u", - RelationGetRelationName(rel), - BufferGetBlockNumber(buf)), + errmsg("index \"%s\" contains unexpected zero page at block %u", + RelationGetRelationName(rel), + BufferGetBlockNumber(buf)), errhint("Please REINDEX it."))); /* diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c index 8a3297924f..d89c192862 100644 --- a/src/backend/access/hash/hash.c +++ b/src/backend/access/hash/hash.c @@ -779,7 +779,7 @@ hashbucketcleanup(Relation rel, Bucket cur_bucket, Buffer bucket_buf, { BlockNumber blkno; Buffer buf; - Bucket new_bucket PG_USED_FOR_ASSERTS_ONLY = InvalidBucket; + Bucket new_bucket PG_USED_FOR_ASSERTS_ONLY = InvalidBucket; bool bucket_dirty = false; blkno = bucket_blkno; diff --git a/src/backend/access/hash/hash_xlog.c b/src/backend/access/hash/hash_xlog.c index 0ea11b2e74..429af11f4d 100644 --- a/src/backend/access/hash/hash_xlog.c +++ b/src/backend/access/hash/hash_xlog.c @@ -161,7 +161,7 @@ hash_xlog_add_ovfl_page(XLogReaderState *record) HashPageOpaque ovflopaque; uint32 *num_bucket; char *data; - Size datalen PG_USED_FOR_ASSERTS_ONLY; + Size datalen PG_USED_FOR_ASSERTS_ONLY; bool new_bmpage = false; XLogRecGetBlockTag(record, 0, NULL, NULL, &rightblk); @@ -293,7 +293,7 @@ hash_xlog_split_allocate_page(XLogReaderState *record) Buffer oldbuf; Buffer newbuf; Buffer metabuf; - Size datalen PG_USED_FOR_ASSERTS_ONLY; + Size datalen PG_USED_FOR_ASSERTS_ONLY; char *data; XLogRedoAction action; diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index 4089fd6d8a..9def064057 100644 --- a/src/backend/access/hash/hashfunc.c +++ b/src/backend/access/hash/hashfunc.c @@ -420,7 +420,7 @@ hash_any(register const unsigned char *k, register int keylen) a += k[0]; /* case 0: nothing left to add */ } -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ } else { @@ -437,7 +437,7 @@ hash_any(register const unsigned char *k, register int keylen) a += (k[0] + ((uint32) k[1] << 8) + ((uint32) k[2] << 16) + ((uint32) k[3] << 24)); b += (k[4] + ((uint32) k[5] << 8) + ((uint32) k[6] << 16) + ((uint32) k[7] << 24)); c += (k[8] + ((uint32) k[9] << 8) + ((uint32) k[10] << 16) + ((uint32) k[11] << 24)); -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ mix(a, b, c); k += 12; len -= 12; @@ -500,7 +500,7 @@ hash_any(register const unsigned char *k, register int keylen) a += k[0]; /* case 0: nothing left to add */ } -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ } final(a, b, c); diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c index 01c8d8006c..dc08db97db 100644 --- a/src/backend/access/hash/hashinsert.c +++ b/src/backend/access/hash/hashinsert.c @@ -81,7 +81,7 @@ restart_insert: (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("index row size %zu exceeds hash maximum %zu", itemsz, HashMaxItemSize(metapage)), - errhint("Values larger than a buffer page cannot be indexed."))); + errhint("Values larger than a buffer page cannot be indexed."))); /* Lock the primary bucket page for the target bucket. */ buf = _hash_getbucketbuf_from_hashkey(rel, hashkey, HASH_WRITE, diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c index b5133e3945..c206e704d4 100644 --- a/src/backend/access/hash/hashovfl.c +++ b/src/backend/access/hash/hashovfl.c @@ -505,7 +505,7 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf, uint32 ovflbitno; int32 bitmappage, bitmapbit; - Bucket bucket PG_USED_FOR_ASSERTS_ONLY; + Bucket bucket PG_USED_FOR_ASSERTS_ONLY; Buffer prevbuf = InvalidBuffer; Buffer nextbuf = InvalidBuffer; bool update_metap = false; @@ -534,7 +534,7 @@ _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf, prevbuf = _hash_getbuf_with_strategy(rel, prevblkno, HASH_WRITE, - LH_BUCKET_PAGE | LH_OVERFLOW_PAGE, + LH_BUCKET_PAGE | LH_OVERFLOW_PAGE, bstrategy); } if (BlockNumberIsValid(nextblkno)) @@ -972,7 +972,7 @@ readpage: XLogRegisterBuffer(2, rbuf, REGBUF_STANDARD); XLogRegisterBufData(2, (char *) deletable, - ndeletable * sizeof(OffsetNumber)); + ndeletable * sizeof(OffsetNumber)); recptr = XLogInsert(RM_HASH_ID, XLOG_HASH_MOVE_PAGE_CONTENTS); diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c index 4544889294..1cb18a7513 100644 --- a/src/backend/access/hash/hashpage.c +++ b/src/backend/access/hash/hashpage.c @@ -923,7 +923,7 @@ restart_expand: XLogRegisterBufData(2, (char *) &metap->hashm_ovflpoint, sizeof(uint32)); XLogRegisterBufData(2, - (char *) &metap->hashm_spares[metap->hashm_ovflpoint], + (char *) &metap->hashm_spares[metap->hashm_ovflpoint], sizeof(uint32)); } diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c index 2d9204903f..3e461ad7a0 100644 --- a/src/backend/access/hash/hashsearch.c +++ b/src/backend/access/hash/hashsearch.c @@ -462,7 +462,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir) } if (so->hashso_sk_hash == _hash_get_indextuple_hashkey(itup)) - break; /* yes, so exit for-loop */ + break; /* yes, so exit for-loop */ } /* Before leaving current page, deal with any killed items */ @@ -519,7 +519,7 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir) } if (so->hashso_sk_hash == _hash_get_indextuple_hashkey(itup)) - break; /* yes, so exit for-loop */ + break; /* yes, so exit for-loop */ } /* Before leaving current page, deal with any killed items */ diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c index c513c3b842..9b803af7c2 100644 --- a/src/backend/access/hash/hashutil.c +++ b/src/backend/access/hash/hashutil.c @@ -207,7 +207,7 @@ _hash_get_totalbuckets(uint32 splitpoint_phase) /* account for buckets within splitpoint_group */ phases_within_splitpoint_group = (((splitpoint_phase - HASH_SPLITPOINT_GROUPS_WITH_ONE_PHASE) & - HASH_SPLITPOINT_PHASE_MASK) + 1); /* from 0-based to 1-based */ + HASH_SPLITPOINT_PHASE_MASK) + 1); /* from 0-based to 1-based */ total_buckets += (((1 << (splitpoint_group - 1)) >> HASH_SPLITPOINT_PHASE_BITS) * phases_within_splitpoint_group); @@ -235,9 +235,9 @@ _hash_checkpage(Relation rel, Buffer buf, int flags) if (PageIsNew(page)) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("index \"%s\" contains unexpected zero page at block %u", - RelationGetRelationName(rel), - BufferGetBlockNumber(buf)), + errmsg("index \"%s\" contains unexpected zero page at block %u", + RelationGetRelationName(rel), + BufferGetBlockNumber(buf)), errhint("Please REINDEX it."))); /* @@ -258,9 +258,9 @@ _hash_checkpage(Relation rel, Buffer buf, int flags) if ((opaque->hasho_flag & flags) == 0) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("index \"%s\" contains corrupted page at block %u", - RelationGetRelationName(rel), - BufferGetBlockNumber(buf)), + errmsg("index \"%s\" contains corrupted page at block %u", + RelationGetRelationName(rel), + BufferGetBlockNumber(buf)), errhint("Please REINDEX it."))); } diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 05fd372664..42484f509c 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -524,15 +524,15 @@ heapgettup(HeapScanDesc scan, } } else - page = scan->rs_startblock; /* first page */ + page = scan->rs_startblock; /* first page */ heapgetpage(scan, page); - lineoff = FirstOffsetNumber; /* first offnum */ + lineoff = FirstOffsetNumber; /* first offnum */ scan->rs_inited = true; } else { /* continue from previously returned page/tuple */ - page = scan->rs_cblock; /* current page */ + page = scan->rs_cblock; /* current page */ lineoff = /* next offnum */ OffsetNumberNext(ItemPointerGetOffsetNumber(&(tuple->t_self))); } @@ -580,7 +580,7 @@ heapgettup(HeapScanDesc scan, else { /* continue from previously returned page/tuple */ - page = scan->rs_cblock; /* current page */ + page = scan->rs_cblock; /* current page */ } LockBuffer(scan->rs_cbuf, BUFFER_LOCK_SHARE); @@ -826,7 +826,7 @@ heapgettup_pagemode(HeapScanDesc scan, } } else - page = scan->rs_startblock; /* first page */ + page = scan->rs_startblock; /* first page */ heapgetpage(scan, page); lineindex = 0; scan->rs_inited = true; @@ -834,7 +834,7 @@ heapgettup_pagemode(HeapScanDesc scan, else { /* continue from previously returned page/tuple */ - page = scan->rs_cblock; /* current page */ + page = scan->rs_cblock; /* current page */ lineindex = scan->rs_cindex + 1; } @@ -879,7 +879,7 @@ heapgettup_pagemode(HeapScanDesc scan, else { /* continue from previously returned page/tuple */ - page = scan->rs_cblock; /* current page */ + page = scan->rs_cblock; /* current page */ } dp = BufferGetPage(scan->rs_cbuf); @@ -1091,7 +1091,7 @@ fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, ) ); } -#endif /* defined(DISABLE_COMPLEX_MACRO) */ +#endif /* defined(DISABLE_COMPLEX_MACRO) */ /* ---------------------------------------------------------------- @@ -1429,7 +1429,7 @@ heap_beginscan_bm(Relation relation, Snapshot snapshot, HeapScanDesc heap_beginscan_sampling(Relation relation, Snapshot snapshot, int nkeys, ScanKey key, - bool allow_strat, bool allow_sync, bool allow_pagemode) + bool allow_strat, bool allow_sync, bool allow_pagemode) { return heap_beginscan_internal(relation, snapshot, nkeys, key, NULL, allow_strat, allow_sync, allow_pagemode, @@ -1794,7 +1794,7 @@ heap_update_snapshot(HeapScanDesc scan, Snapshot snapshot) #define HEAPDEBUG_1 #define HEAPDEBUG_2 #define HEAPDEBUG_3 -#endif /* !defined(HEAPDEBUGALL) */ +#endif /* !defined(HEAPDEBUGALL) */ HeapTuple @@ -2257,7 +2257,7 @@ heap_get_latest_tid(Relation relation, * tuple. Check for XMIN match. */ if (TransactionIdIsValid(priorXmax) && - !TransactionIdEquals(priorXmax, HeapTupleHeaderGetXmin(tp.t_data))) + !TransactionIdEquals(priorXmax, HeapTupleHeaderGetXmin(tp.t_data))) { UnlockReleaseBuffer(buffer); break; @@ -2636,7 +2636,7 @@ heap_prepare_insert(Relation relation, HeapTuple tup, TransactionId xid, HeapTupleHeaderSetXminFrozen(tup->t_data); HeapTupleHeaderSetCmin(tup->t_data, cid); - HeapTupleHeaderSetXmax(tup->t_data, 0); /* for cleanliness */ + HeapTupleHeaderSetXmax(tup->t_data, 0); /* for cleanliness */ tup->t_tableOid = RelationGetRelid(relation); #ifdef PGXC tup->t_xc_node_id = PGXCNodeIdentifier; @@ -3751,8 +3751,8 @@ l2: */ if (xmax_infomask_changed(oldtup.t_data->t_infomask, infomask) || - !TransactionIdEquals(HeapTupleHeaderGetRawXmax(oldtup.t_data), - xwait)) + !TransactionIdEquals(HeapTupleHeaderGetRawXmax(oldtup.t_data), + xwait)) goto l2; } @@ -3831,7 +3831,7 @@ l2: */ if (xmax_infomask_changed(oldtup.t_data->t_infomask, infomask) || !TransactionIdEquals(xwait, - HeapTupleHeaderGetRawXmax(oldtup.t_data))) + HeapTupleHeaderGetRawXmax(oldtup.t_data))) goto l2; /* Otherwise check if it committed or aborted */ @@ -4021,7 +4021,7 @@ l2: oldtup.t_data->t_infomask, oldtup.t_data->t_infomask2, xid, *lockmode, false, - &xmax_lock_old_tuple, &infomask_lock_old_tuple, + &xmax_lock_old_tuple, &infomask_lock_old_tuple, &infomask2_lock_old_tuple); Assert(HEAP_XMAX_IS_LOCKED_ONLY(infomask_lock_old_tuple)); @@ -4196,7 +4196,7 @@ l2: * logged. */ old_key_tuple = ExtractReplicaIdentity(relation, &oldtup, - bms_overlap(modified_attrs, id_attrs), + bms_overlap(modified_attrs, id_attrs), &old_key_copied); /* NO EREPORT(ERROR) from here till changes are logged */ @@ -4233,7 +4233,7 @@ l2: HeapTupleClearHeapOnly(newtup); } - RelationPutHeapTuple(relation, newbuf, heaptup, false); /* insert new tuple */ + RelationPutHeapTuple(relation, newbuf, heaptup, false); /* insert new tuple */ /* Clear obsolete visibility flags, possibly set by ourselves above... */ @@ -4455,7 +4455,7 @@ HeapDetermineModifiedColumns(Relation relation, Bitmapset *interesting_cols, if (!heap_tuple_attr_equals(RelationGetDescr(relation), attnum, oldtup, newtup)) modified = bms_add_member(modified, - attnum - FirstLowInvalidHeapAttributeNumber); + attnum - FirstLowInvalidHeapAttributeNumber); } return modified; @@ -4854,7 +4854,7 @@ l3: /* if the xmax changed in the meantime, start over */ if (xmax_infomask_changed(tuple->t_data->t_infomask, infomask) || !TransactionIdEquals( - HeapTupleHeaderGetRawXmax(tuple->t_data), + HeapTupleHeaderGetRawXmax(tuple->t_data), xwait)) goto l3; /* otherwise, we're good */ @@ -4940,11 +4940,11 @@ l3: { case LockWaitBlock: MultiXactIdWait((MultiXactId) xwait, status, infomask, - relation, &tuple->t_self, XLTW_Lock, NULL); + relation, &tuple->t_self, XLTW_Lock, NULL); break; case LockWaitSkip: if (!ConditionalMultiXactIdWait((MultiXactId) xwait, - status, infomask, relation, + status, infomask, relation, NULL)) { result = HeapTupleWouldBlock; @@ -4955,12 +4955,12 @@ l3: break; case LockWaitError: if (!ConditionalMultiXactIdWait((MultiXactId) xwait, - status, infomask, relation, + status, infomask, relation, NULL)) ereport(ERROR, (errcode(ERRCODE_LOCK_NOT_AVAILABLE), errmsg("could not obtain lock on row in relation \"%s\"", - RelationGetRelationName(relation)))); + RelationGetRelationName(relation)))); break; } @@ -4998,7 +4998,7 @@ l3: ereport(ERROR, (errcode(ERRCODE_LOCK_NOT_AVAILABLE), errmsg("could not obtain lock on row in relation \"%s\"", - RelationGetRelationName(relation)))); + RelationGetRelationName(relation)))); break; } } @@ -5249,8 +5249,8 @@ heap_acquire_tuplock(Relation relation, ItemPointer tid, LockTupleMode mode, if (!ConditionalLockTupleTuplock(relation, tid, mode)) ereport(ERROR, (errcode(ERRCODE_LOCK_NOT_AVAILABLE), - errmsg("could not obtain lock on row in relation \"%s\"", - RelationGetRelationName(relation)))); + errmsg("could not obtain lock on row in relation \"%s\"", + RelationGetRelationName(relation)))); break; } *have_tuple_lock = true; @@ -5376,7 +5376,7 @@ l5: { if (HEAP_XMAX_IS_LOCKED_ONLY(old_infomask) || !TransactionIdDidCommit(MultiXactIdGetUpdateXid(xmax, - old_infomask))) + old_infomask))) { /* * Reset these bits and restart; otherwise fall through to @@ -5766,7 +5766,7 @@ l4: Assert(!HEAP_LOCKED_UPGRADED(mytup.t_data->t_infomask)); nmembers = GetMultiXactIdMembers(rawxmax, &members, false, - HEAP_XMAX_IS_LOCKED_ONLY(old_infomask)); + HEAP_XMAX_IS_LOCKED_ONLY(old_infomask)); for (i = 0; i < nmembers; i++) { result = test_lockmode_for_conflict(members[i].status, @@ -6386,7 +6386,7 @@ FreezeMultiXactId(MultiXactId multi, uint16 t_infomask, { Assert(!TransactionIdDidCommit(xid)); *flags |= FRM_INVALIDATE_XMAX; - xid = InvalidTransactionId; /* not strictly necessary */ + xid = InvalidTransactionId; /* not strictly necessary */ } else { @@ -7261,7 +7261,7 @@ heap_tuple_needs_freeze(HeapTupleHeader tuple, TransactionId cutoff_xid, /* need to check whether any member of the mxact is too old */ nmembers = GetMultiXactIdMembers(multi, &members, false, - HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask)); + HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask)); for (i = 0; i < nmembers; i++) { @@ -7664,7 +7664,7 @@ log_heap_update(Relation reln, Buffer oldbuf, { XLogRegisterBufData(0, ((char *) newtup->t_data) + SizeofHeapTupleHeader, - newtup->t_len - SizeofHeapTupleHeader - suffixlen); + newtup->t_len - SizeofHeapTupleHeader - suffixlen); } else { @@ -7676,14 +7676,14 @@ log_heap_update(Relation reln, Buffer oldbuf, if (newtup->t_data->t_hoff - SizeofHeapTupleHeader > 0) { XLogRegisterBufData(0, - ((char *) newtup->t_data) + SizeofHeapTupleHeader, - newtup->t_data->t_hoff - SizeofHeapTupleHeader); + ((char *) newtup->t_data) + SizeofHeapTupleHeader, + newtup->t_data->t_hoff - SizeofHeapTupleHeader); } /* data after common prefix */ XLogRegisterBufData(0, - ((char *) newtup->t_data) + newtup->t_data->t_hoff + prefixlen, - newtup->t_len - newtup->t_data->t_hoff - prefixlen - suffixlen); + ((char *) newtup->t_data) + newtup->t_data->t_hoff + prefixlen, + newtup->t_len - newtup->t_data->t_hoff - prefixlen - suffixlen); } /* We need to log a tuple identity */ diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c index 6529fe3d6b..13e3bdca50 100644 --- a/src/backend/access/heap/hio.c +++ b/src/backend/access/heap/hio.c @@ -329,7 +329,7 @@ RelationGetBufferForTuple(Relation relation, Size len, if (otherBuffer != InvalidBuffer) otherBlock = BufferGetBlockNumber(otherBuffer); else - otherBlock = InvalidBlockNumber; /* just to keep compiler quiet */ + otherBlock = InvalidBlockNumber; /* just to keep compiler quiet */ /* * We first try to put the tuple on the same page we last inserted a tuple diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c index 4f41511764..717cf02c62 100644 --- a/src/backend/access/heap/pruneheap.c +++ b/src/backend/access/heap/pruneheap.c @@ -31,8 +31,7 @@ typedef struct { TransactionId new_prune_xid; /* new prune hint value for page */ - TransactionId latestRemovedXid; /* latest xid to be removed by this - * prune */ + TransactionId latestRemovedXid; /* latest xid to be removed by this prune */ int nredirected; /* numbers of entries in arrays below */ int ndead; int nunused; @@ -150,8 +149,8 @@ heap_page_prune_opt(Relation relation, Buffer buffer) */ if (PageIsFull(page) || PageGetHeapFreeSpace(page) < minfree) { - TransactionId ignore = InvalidTransactionId; /* return value not - * needed */ + TransactionId ignore = InvalidTransactionId; /* return value not + * needed */ /* OK to prune */ (void) heap_page_prune(relation, buffer, OldestXmin, true, &ignore); @@ -409,7 +408,7 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum, { heap_prune_record_unused(prstate, rootoffnum); HeapTupleHeaderAdvanceLatestRemovedXid(htup, - &prstate->latestRemovedXid); + &prstate->latestRemovedXid); ndeleted++; } @@ -542,7 +541,7 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum, { latestdead = offnum; HeapTupleHeaderAdvanceLatestRemovedXid(htup, - &prstate->latestRemovedXid); + &prstate->latestRemovedXid); } else if (!recent_dead) break; diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c index 60dcb67a20..bd560e47e1 100644 --- a/src/backend/access/heap/rewriteheap.c +++ b/src/backend/access/heap/rewriteheap.c @@ -146,23 +146,23 @@ typedef struct RewriteStateData BlockNumber rs_blockno; /* block where page will go */ bool rs_buffer_valid; /* T if any tuples in buffer */ bool rs_use_wal; /* must we WAL-log inserts? */ - bool rs_logical_rewrite; /* do we need to do logical rewriting */ - TransactionId rs_oldest_xmin; /* oldest xmin used by caller to - * determine tuple visibility */ - TransactionId rs_freeze_xid;/* Xid that will be used as freeze cutoff - * point */ - TransactionId rs_logical_xmin; /* Xid that will be used as cutoff - * point for logical rewrites */ - MultiXactId rs_cutoff_multi;/* MultiXactId that will be used as cutoff - * point for multixacts */ + bool rs_logical_rewrite; /* do we need to do logical rewriting */ + TransactionId rs_oldest_xmin; /* oldest xmin used by caller to determine + * tuple visibility */ + TransactionId rs_freeze_xid; /* Xid that will be used as freeze cutoff + * point */ + TransactionId rs_logical_xmin; /* Xid that will be used as cutoff point + * for logical rewrites */ + MultiXactId rs_cutoff_multi; /* MultiXactId that will be used as cutoff + * point for multixacts */ MemoryContext rs_cxt; /* for hash tables and entries and tuples in * them */ XLogRecPtr rs_begin_lsn; /* XLogInsertLsn when starting the rewrite */ - HTAB *rs_unresolved_tups; /* unmatched A tuples */ - HTAB *rs_old_new_tid_map; /* unmatched B tuples */ + HTAB *rs_unresolved_tups; /* unmatched A tuples */ + HTAB *rs_old_new_tid_map; /* unmatched B tuples */ HTAB *rs_logical_mappings; /* logical remapping files */ - uint32 rs_num_rewrite_mappings; /* # in memory mappings */ -} RewriteStateData; + uint32 rs_num_rewrite_mappings; /* # in memory mappings */ +} RewriteStateData; /* * The lookup keys for the hash tables are tuple TID and xmin (we must check @@ -216,8 +216,8 @@ typedef struct RewriteMappingFile */ typedef struct RewriteMappingDataEntry { - LogicalRewriteMappingData map; /* map between old and new location of - * the tuple */ + LogicalRewriteMappingData map; /* map between old and new location of the + * tuple */ dlist_node node; } RewriteMappingDataEntry; @@ -655,7 +655,7 @@ raw_heap_insert(RewriteState state, HeapTuple tup) else heaptup = tup; - len = MAXALIGN(heaptup->t_len); /* be conservative */ + len = MAXALIGN(heaptup->t_len); /* be conservative */ /* * If we're gonna fail for oversize tuple, do it right away diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c index b9963ab5ef..5c1b557db8 100644 --- a/src/backend/access/heap/tuptoaster.c +++ b/src/backend/access/heap/tuptoaster.c @@ -69,13 +69,13 @@ typedef struct toast_compress_header static void toast_delete_datum(Relation rel, Datum value, bool is_speculative); static Datum toast_save_datum(Relation rel, Datum value, - struct varlena * oldexternal, int options); + struct varlena *oldexternal, int options); static bool toastrel_valueid_exists(Relation toastrel, Oid valueid); static bool toastid_valueid_exists(Oid toastrelid, Oid valueid); -static struct varlena *toast_fetch_datum(struct varlena * attr); -static struct varlena *toast_fetch_datum_slice(struct varlena * attr, +static struct varlena *toast_fetch_datum(struct varlena *attr); +static struct varlena *toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length); -static struct varlena *toast_decompress_datum(struct varlena * attr); +static struct varlena *toast_decompress_datum(struct varlena *attr); static int toast_open_indexes(Relation toastrel, LOCKMODE lock, Relation **toastidxs, @@ -98,7 +98,7 @@ static void init_toast_snapshot(Snapshot toast_snapshot); * ---------- */ struct varlena * -heap_tuple_fetch_attr(struct varlena * attr) +heap_tuple_fetch_attr(struct varlena *attr) { struct varlena *result; @@ -169,7 +169,7 @@ heap_tuple_fetch_attr(struct varlena * attr) * ---------- */ struct varlena * -heap_tuple_untoast_attr(struct varlena * attr) +heap_tuple_untoast_attr(struct varlena *attr) { if (VARATT_IS_EXTERNAL_ONDISK(attr)) { @@ -255,7 +255,7 @@ heap_tuple_untoast_attr(struct varlena * attr) * ---------- */ struct varlena * -heap_tuple_untoast_attr_slice(struct varlena * attr, +heap_tuple_untoast_attr_slice(struct varlena *attr, int32 sliceoffset, int32 slicelength) { struct varlena *preslice; @@ -1475,7 +1475,7 @@ toast_get_valid_index(Oid toastoid, LOCKMODE lock) */ static Datum toast_save_datum(Relation rel, Datum value, - struct varlena * oldexternal, int options) + struct varlena *oldexternal, int options) { Relation toastrel; Relation *toastidxs; @@ -1530,7 +1530,7 @@ toast_save_datum(Relation rel, Datum value, { data_p = VARDATA_SHORT(dval); data_todo = VARSIZE_SHORT(dval) - VARHDRSZ_SHORT; - toast_pointer.va_rawsize = data_todo + VARHDRSZ; /* as if not short */ + toast_pointer.va_rawsize = data_todo + VARHDRSZ; /* as if not short */ toast_pointer.va_extsize = data_todo; } else if (VARATT_IS_COMPRESSED(dval)) @@ -1635,7 +1635,7 @@ toast_save_datum(Relation rel, Datum value, { toast_pointer.va_valueid = GetNewOidWithIndex(toastrel, - RelationGetRelid(toastidxs[validIndex]), + RelationGetRelid(toastidxs[validIndex]), (AttrNumber) 1); } while (toastid_valueid_exists(rel->rd_toastoid, toast_pointer.va_valueid)); @@ -1880,7 +1880,7 @@ toastid_valueid_exists(Oid toastrelid, Oid valueid) * ---------- */ static struct varlena * -toast_fetch_datum(struct varlena * attr) +toast_fetch_datum(struct varlena *attr) { Relation toastrel; Relation *toastidxs; @@ -2051,7 +2051,7 @@ toast_fetch_datum(struct varlena * attr) * ---------- */ static struct varlena * -toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length) +toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length) { Relation toastrel; Relation *toastidxs; @@ -2175,7 +2175,7 @@ toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length) init_toast_snapshot(&SnapshotToast); nextidx = startchunk; toastscan = systable_beginscan_ordered(toastrel, toastidxs[validIndex], - &SnapshotToast, nscankeys, toastkey); + &SnapshotToast, nscankeys, toastkey); while ((ttup = systable_getnext_ordered(toastscan, ForwardScanDirection)) != NULL) { /* @@ -2283,7 +2283,7 @@ toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length) * Decompress a compressed version of a varlena datum */ static struct varlena * -toast_decompress_datum(struct varlena * attr) +toast_decompress_datum(struct varlena *attr) { struct varlena *result; diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c index e5616ce051..4c2a13aeba 100644 --- a/src/backend/access/heap/visibilitymap.c +++ b/src/backend/access/heap/visibilitymap.c @@ -592,7 +592,7 @@ vm_readbuf(Relation rel, BlockNumber blkno, bool extend) { if (smgrexists(rel->rd_smgr, VISIBILITYMAP_FORKNUM)) rel->rd_smgr->smgr_vm_nblocks = smgrnblocks(rel->rd_smgr, - VISIBILITYMAP_FORKNUM); + VISIBILITYMAP_FORKNUM); else rel->rd_smgr->smgr_vm_nblocks = 0; } diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c index a91fda7bcd..05d7da001a 100644 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@ -83,7 +83,7 @@ RelationGetIndexScan(Relation indexRelation, int nkeys, int norderbys) scan->heapRelation = NULL; /* may be set later */ scan->indexRelation = indexRelation; - scan->xs_snapshot = InvalidSnapshot; /* caller must initialize this */ + scan->xs_snapshot = InvalidSnapshot; /* caller must initialize this */ scan->numberOfKeys = nkeys; scan->numberOfOrderBys = norderbys; diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c index cc5ac8b857..bef4255369 100644 --- a/src/backend/access/index/indexam.c +++ b/src/backend/access/index/indexam.c @@ -326,7 +326,7 @@ index_rescan(IndexScanDesc scan, scan->xs_continue_hot = false; - scan->kill_prior_tuple = false; /* for safety */ + scan->kill_prior_tuple = false; /* for safety */ scan->indexRelation->rd_amroutine->amrescan(scan, keys, nkeys, orderbys, norderbys); @@ -401,7 +401,7 @@ index_restrpos(IndexScanDesc scan) scan->xs_continue_hot = false; - scan->kill_prior_tuple = false; /* for safety */ + scan->kill_prior_tuple = false; /* for safety */ scan->indexRelation->rd_amroutine->amrestrpos(scan); } @@ -431,7 +431,7 @@ index_parallelscan_estimate(Relation indexRelation, Snapshot snapshot) */ if (indexRelation->rd_amroutine->amestimateparallelscan != NULL) nbytes = add_size(nbytes, - indexRelation->rd_amroutine->amestimateparallelscan()); + indexRelation->rd_amroutine->amestimateparallelscan()); return nbytes; } @@ -751,7 +751,7 @@ index_bulk_delete(IndexVacuumInfo *info, CHECK_REL_PROCEDURE(ambulkdelete); return indexRelation->rd_amroutine->ambulkdelete(info, stats, - callback, callback_state); + callback, callback_state); } /* ---------------- diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index 6dca8109fd..4aca7e4db8 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -36,7 +36,7 @@ typedef struct OffsetNumber newitemoff; /* where the new item is to be inserted */ int leftspace; /* space available for items on left page */ int rightspace; /* space available for items on right page */ - int olddataitemstotal; /* space taken by old items */ + int olddataitemstotal; /* space taken by old items */ bool have_split; /* found a valid split? */ @@ -428,10 +428,10 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel, (errcode(ERRCODE_UNIQUE_VIOLATION), errmsg("duplicate key value violates unique constraint \"%s\"", RelationGetRelationName(rel)), - key_desc ? errdetail("Key %s already exists.", - key_desc) : 0, + key_desc ? errdetail("Key %s already exists.", + key_desc) : 0, errtableconstraint(heapRel, - RelationGetRelationName(rel)))); + RelationGetRelationName(rel)))); } } else if (all_dead) @@ -497,7 +497,7 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel, (errcode(ERRCODE_INTERNAL_ERROR), errmsg("failed to re-find tuple within index \"%s\"", RelationGetRelationName(rel)), - errhint("This may be because of a non-immutable index expression."), + errhint("This may be because of a non-immutable index expression."), errtableconstraint(heapRel, RelationGetRelationName(rel)))); @@ -574,12 +574,12 @@ _bt_findinsertloc(Relation rel, if (itemsz > BTMaxItemSize(page)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", - itemsz, BTMaxItemSize(page), - RelationGetRelationName(rel)), - errhint("Values larger than 1/3 of a buffer page cannot be indexed.\n" - "Consider a function index of an MD5 hash of the value, " - "or use full text indexing."), + errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", + itemsz, BTMaxItemSize(page), + RelationGetRelationName(rel)), + errhint("Values larger than 1/3 of a buffer page cannot be indexed.\n" + "Consider a function index of an MD5 hash of the value, " + "or use full text indexing."), errtableconstraint(heapRel, RelationGetRelationName(rel)))); @@ -1194,7 +1194,7 @@ _bt_split(Relation rel, Buffer buf, Buffer cbuf, OffsetNumber firstright, { memset(rightpage, 0, BufferGetPageSize(rbuf)); elog(ERROR, "right sibling's left-link doesn't match: " - "block %u links to %u instead of expected %u in index \"%s\"", + "block %u links to %u instead of expected %u in index \"%s\"", oopaque->btpo_next, sopaque->btpo_prev, origpagenumber, RelationGetRelationName(rel)); } @@ -1327,7 +1327,7 @@ _bt_split(Relation rel, Buffer buf, Buffer cbuf, OffsetNumber firstright, * _bt_restore_page(). */ XLogRegisterBufData(1, - (char *) rightpage + ((PageHeader) rightpage)->pd_upper, + (char *) rightpage + ((PageHeader) rightpage)->pd_upper, ((PageHeader) rightpage)->pd_special - ((PageHeader) rightpage)->pd_upper); if (isroot) @@ -2052,7 +2052,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf) * some new func in page API. */ XLogRegisterBufData(0, - (char *) rootpage + ((PageHeader) rootpage)->pd_upper, + (char *) rootpage + ((PageHeader) rootpage)->pd_upper, ((PageHeader) rootpage)->pd_special - ((PageHeader) rootpage)->pd_upper); diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c index f815fd40b2..5c817b6510 100644 --- a/src/backend/access/nbtree/nbtpage.c +++ b/src/backend/access/nbtree/nbtpage.c @@ -513,9 +513,9 @@ _bt_checkpage(Relation rel, Buffer buf) if (PageIsNew(page)) ereport(ERROR, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("index \"%s\" contains unexpected zero page at block %u", - RelationGetRelationName(rel), - BufferGetBlockNumber(buf)), + errmsg("index \"%s\" contains unexpected zero page at block %u", + RelationGetRelationName(rel), + BufferGetBlockNumber(buf)), errhint("Please REINDEX it."))); /* @@ -1067,7 +1067,7 @@ _bt_lock_branch_parent(Relation rel, BlockNumber child, BTStack stack, } return _bt_lock_branch_parent(rel, parent, stack->bts_parent, - topparent, topoff, target, rightsib); + topparent, topoff, target, rightsib); } else { @@ -1150,8 +1150,8 @@ _bt_pagedel(Relation rel, Buffer buf) if (P_ISHALFDEAD(opaque)) ereport(LOG, (errcode(ERRCODE_INDEX_CORRUPTED), - errmsg("index \"%s\" contains a half-dead internal page", - RelationGetRelationName(rel)), + errmsg("index \"%s\" contains a half-dead internal page", + RelationGetRelationName(rel)), errhint("This can be caused by an interrupted VACUUM in version 9.3 or older, before upgrade. Please REINDEX it."))); _bt_relbuf(rel, buf); return ndeleted; diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 116f5f32f6..3dbafdd6fc 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -59,7 +59,7 @@ typedef struct IndexBulkDeleteCallback callback; void *callback_state; BTCycleId cycleid; - BlockNumber lastBlockVacuumed; /* highest blkno actually vacuumed */ + BlockNumber lastBlockVacuumed; /* highest blkno actually vacuumed */ BlockNumber lastBlockLocked; /* highest blkno we've cleanup-locked */ BlockNumber totFreePages; /* true total # of free pages */ MemoryContext pagedelcontext; @@ -92,15 +92,14 @@ typedef enum typedef struct BTParallelScanDescData { BlockNumber btps_scanPage; /* latest or next page to be scanned */ - BTPS_State btps_pageStatus;/* indicates whether next page is available - * for scan. see above for possible states of - * parallel scan. */ - int btps_arrayKeyCount; /* count indicating number of array - * scan keys processed by parallel - * scan */ + BTPS_State btps_pageStatus; /* indicates whether next page is + * available for scan. see above for + * possible states of parallel scan. */ + int btps_arrayKeyCount; /* count indicating number of array scan + * keys processed by parallel scan */ slock_t btps_mutex; /* protects above variables */ ConditionVariable btps_cv; /* used to synchronize parallel scan */ -} BTParallelScanDescData; +} BTParallelScanDescData; typedef struct BTParallelScanDescData *BTParallelScanDesc; @@ -187,7 +186,7 @@ btbuild(Relation heap, Relation index, IndexInfo *indexInfo) #ifdef BTREE_BUILD_STATS if (log_btree_build_stats) ResetUsage(); -#endif /* BTREE_BUILD_STATS */ +#endif /* BTREE_BUILD_STATS */ /* * We expect to be called exactly once for any index relation. If that's @@ -234,7 +233,7 @@ btbuild(Relation heap, Relation index, IndexInfo *indexInfo) ShowUsage("BTREE BUILD STATS"); ResetUsage(); } -#endif /* BTREE_BUILD_STATS */ +#endif /* BTREE_BUILD_STATS */ /* * Return statistics diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c index 2f32b2e78d..642c8943e7 100644 --- a/src/backend/access/nbtree/nbtsearch.c +++ b/src/backend/access/nbtree/nbtsearch.c @@ -466,7 +466,7 @@ _bt_compare(Relation rel, datum = index_getattr(itup, scankey->sk_attno, itupdesc, &isNull); /* see comments about NULLs handling in btbuild */ - if (scankey->sk_flags & SK_ISNULL) /* key is NULL */ + if (scankey->sk_flags & SK_ISNULL) /* key is NULL */ { if (isNull) result = 0; /* NULL "=" NULL */ @@ -681,11 +681,11 @@ _bt_first(IndexScanDesc scan, ScanDirection dir) ScanKeyEntryInitialize(chosen, (SK_SEARCHNOTNULL | SK_ISNULL | (impliesNN->sk_flags & - (SK_BT_DESC | SK_BT_NULLS_FIRST))), + (SK_BT_DESC | SK_BT_NULLS_FIRST))), curattr, - ((impliesNN->sk_flags & SK_BT_NULLS_FIRST) ? - BTGreaterStrategyNumber : - BTLessStrategyNumber), + ((impliesNN->sk_flags & SK_BT_NULLS_FIRST) ? + BTGreaterStrategyNumber : + BTLessStrategyNumber), InvalidOid, InvalidOid, InvalidOid, diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index 3d041c47c0..bf6c03c7b2 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -111,7 +111,7 @@ typedef struct BTPageState OffsetNumber btps_lastoff; /* last item offset loaded */ uint32 btps_level; /* tree level (0 = leaf) */ Size btps_full; /* "full" if less than this much free space */ - struct BTPageState *btps_next; /* link to parent level, if any */ + struct BTPageState *btps_next; /* link to parent level, if any */ } BTPageState; /* @@ -122,8 +122,8 @@ typedef struct BTWriteState Relation heap; Relation index; bool btws_use_wal; /* dump pages to WAL? */ - BlockNumber btws_pages_alloced; /* # pages allocated */ - BlockNumber btws_pages_written; /* # pages written out */ + BlockNumber btws_pages_alloced; /* # pages allocated */ + BlockNumber btws_pages_written; /* # pages written out */ Page btws_zeropage; /* workspace for filling zeroes */ } BTWriteState; @@ -208,7 +208,7 @@ _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2) ShowUsage("BTREE BUILD (Spool) STATISTICS"); ResetUsage(); } -#endif /* BTREE_BUILD_STATS */ +#endif /* BTREE_BUILD_STATS */ tuplesort_performsort(btspool->sortstate); if (btspool2) @@ -345,7 +345,7 @@ _bt_pagestate(BTWriteState *wstate, uint32 level) state->btps_full = (BLCKSZ * (100 - BTREE_NONLEAF_FILLFACTOR) / 100); else state->btps_full = RelationGetTargetPageFreeSpace(wstate->index, - BTREE_DEFAULT_FILLFACTOR); + BTREE_DEFAULT_FILLFACTOR); /* no parent level, yet */ state->btps_next = NULL; @@ -485,12 +485,12 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup) if (itupsz > BTMaxItemSize(npage)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", - itupsz, BTMaxItemSize(npage), - RelationGetRelationName(wstate->index)), - errhint("Values larger than 1/3 of a buffer page cannot be indexed.\n" - "Consider a function index of an MD5 hash of the value, " - "or use full text indexing."), + errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", + itupsz, BTMaxItemSize(npage), + RelationGetRelationName(wstate->index)), + errhint("Values larger than 1/3 of a buffer page cannot be indexed.\n" + "Consider a function index of an MD5 hash of the value, " + "or use full text indexing."), errtableconstraint(wstate->heap, RelationGetRelationName(wstate->index)))); @@ -566,7 +566,7 @@ _bt_buildadd(BTWriteState *wstate, BTPageState *state, IndexTuple itup) oopaque->btpo_next = nblkno; nopaque->btpo_prev = oblkno; - nopaque->btpo_next = P_NONE; /* redundant */ + nopaque->btpo_next = P_NONE; /* redundant */ } /* diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c index 5b259a31d9..dbfb775dec 100644 --- a/src/backend/access/nbtree/nbtutils.c +++ b/src/backend/access/nbtree/nbtutils.c @@ -336,7 +336,7 @@ _bt_preprocess_array_keys(IndexScanDesc scan) * successive primitive indexscans produce data in index order. */ num_elems = _bt_sort_array_elements(scan, cur, - (indoption[cur->sk_attno - 1] & INDOPTION_DESC) != 0, + (indoption[cur->sk_attno - 1] & INDOPTION_DESC) != 0, elem_values, num_nonnulls); /* @@ -1163,7 +1163,7 @@ _bt_compare_scankey_args(IndexScanDesc scan, ScanKey op, *result = DatumGetBool(OidFunctionCall2Coll(cmp_proc, op->sk_collation, leftarg->sk_argument, - rightarg->sk_argument)); + rightarg->sk_argument)); return true; } } diff --git a/src/backend/access/rmgrdesc/brindesc.c b/src/backend/access/rmgrdesc/brindesc.c index 637ebf30f8..8eb5275a8b 100644 --- a/src/backend/access/rmgrdesc/brindesc.c +++ b/src/backend/access/rmgrdesc/brindesc.c @@ -66,7 +66,7 @@ brin_desc(StringInfo buf, XLogReaderState *record) xl_brin_desummarize *xlrec = (xl_brin_desummarize *) rec; appendStringInfo(buf, "pagesPerRange %u, heapBlk %u, page offset %u", - xlrec->pagesPerRange, xlrec->heapBlk, xlrec->regOffset); + xlrec->pagesPerRange, xlrec->heapBlk, xlrec->regOffset); } } diff --git a/src/backend/access/rmgrdesc/gindesc.c b/src/backend/access/rmgrdesc/gindesc.c index df51f3ce1f..02c887496e 100644 --- a/src/backend/access/rmgrdesc/gindesc.c +++ b/src/backend/access/rmgrdesc/gindesc.c @@ -89,8 +89,8 @@ gin_desc(StringInfo buf, XLogReaderState *record) ginxlogInsert *xlrec = (ginxlogInsert *) rec; appendStringInfo(buf, "isdata: %c isleaf: %c", - (xlrec->flags & GIN_INSERT_ISDATA) ? 'T' : 'F', - (xlrec->flags & GIN_INSERT_ISLEAF) ? 'T' : 'F'); + (xlrec->flags & GIN_INSERT_ISDATA) ? 'T' : 'F', + (xlrec->flags & GIN_INSERT_ISLEAF) ? 'T' : 'F'); if (!(xlrec->flags & GIN_INSERT_ISLEAF)) { char *payload = rec + sizeof(ginxlogInsert); @@ -126,9 +126,9 @@ gin_desc(StringInfo buf, XLogReaderState *record) (ginxlogInsertDataInternal *) payload; appendStringInfo(buf, " pitem: %u-%u/%u", - PostingItemGetBlockNumber(&insertData->newitem), - ItemPointerGetBlockNumber(&insertData->newitem.key), - ItemPointerGetOffsetNumber(&insertData->newitem.key)); + PostingItemGetBlockNumber(&insertData->newitem), + ItemPointerGetBlockNumber(&insertData->newitem.key), + ItemPointerGetOffsetNumber(&insertData->newitem.key)); } } } @@ -138,10 +138,10 @@ gin_desc(StringInfo buf, XLogReaderState *record) ginxlogSplit *xlrec = (ginxlogSplit *) rec; appendStringInfo(buf, "isrootsplit: %c", - (((ginxlogSplit *) rec)->flags & GIN_SPLIT_ROOT) ? 'T' : 'F'); + (((ginxlogSplit *) rec)->flags & GIN_SPLIT_ROOT) ? 'T' : 'F'); appendStringInfo(buf, " isdata: %c isleaf: %c", - (xlrec->flags & GIN_INSERT_ISDATA) ? 'T' : 'F', - (xlrec->flags & GIN_INSERT_ISLEAF) ? 'T' : 'F'); + (xlrec->flags & GIN_INSERT_ISDATA) ? 'T' : 'F', + (xlrec->flags & GIN_INSERT_ISLEAF) ? 'T' : 'F'); } break; case XLOG_GIN_VACUUM_PAGE: diff --git a/src/backend/access/rmgrdesc/hashdesc.c b/src/backend/access/rmgrdesc/hashdesc.c index 35d86dc893..3e9236122b 100644 --- a/src/backend/access/rmgrdesc/hashdesc.c +++ b/src/backend/access/rmgrdesc/hashdesc.c @@ -51,7 +51,7 @@ hash_desc(StringInfo buf, XLogReaderState *record) xl_hash_add_ovfl_page *xlrec = (xl_hash_add_ovfl_page *) rec; appendStringInfo(buf, "bmsize %d, bmpage_found %c", - xlrec->bmsize, (xlrec->bmpage_found) ? 'T' : 'F'); + xlrec->bmsize, (xlrec->bmpage_found) ? 'T' : 'F'); break; } case XLOG_HASH_SPLIT_ALLOCATE_PAGE: @@ -60,7 +60,7 @@ hash_desc(StringInfo buf, XLogReaderState *record) appendStringInfo(buf, "new_bucket %u, meta_page_masks_updated %c, issplitpoint_changed %c", xlrec->new_bucket, - (xlrec->flags & XLH_SPLIT_META_UPDATE_MASKS) ? 'T' : 'F', + (xlrec->flags & XLH_SPLIT_META_UPDATE_MASKS) ? 'T' : 'F', (xlrec->flags & XLH_SPLIT_META_UPDATE_SPLITPOINT) ? 'T' : 'F'); break; } @@ -69,7 +69,7 @@ hash_desc(StringInfo buf, XLogReaderState *record) xl_hash_split_complete *xlrec = (xl_hash_split_complete *) rec; appendStringInfo(buf, "old_bucket_flag %u, new_bucket_flag %u", - xlrec->old_bucket_flag, xlrec->new_bucket_flag); + xlrec->old_bucket_flag, xlrec->new_bucket_flag); break; } case XLOG_HASH_MOVE_PAGE_CONTENTS: diff --git a/src/backend/access/rmgrdesc/logicalmsgdesc.c b/src/backend/access/rmgrdesc/logicalmsgdesc.c index 8287751e48..0b971c2aee 100644 --- a/src/backend/access/rmgrdesc/logicalmsgdesc.c +++ b/src/backend/access/rmgrdesc/logicalmsgdesc.c @@ -26,7 +26,7 @@ logicalmsg_desc(StringInfo buf, XLogReaderState *record) xl_logical_message *xlrec = (xl_logical_message *) rec; appendStringInfo(buf, "%s message size %zu bytes", - xlrec->transactional ? "transactional" : "nontransactional", + xlrec->transactional ? "transactional" : "nontransactional", xlrec->message_size); } } diff --git a/src/backend/access/rmgrdesc/nbtdesc.c b/src/backend/access/rmgrdesc/nbtdesc.c index fbde9d6555..ad6bba6130 100644 --- a/src/backend/access/rmgrdesc/nbtdesc.c +++ b/src/backend/access/rmgrdesc/nbtdesc.c @@ -93,7 +93,7 @@ btree_desc(StringInfo buf, XLogReaderState *record) appendStringInfo(buf, "rel %u/%u/%u; latestRemovedXid %u", xlrec->node.spcNode, xlrec->node.dbNode, - xlrec->node.relNode, xlrec->latestRemovedXid); + xlrec->node.relNode, xlrec->latestRemovedXid); break; } } diff --git a/src/backend/access/rmgrdesc/spgdesc.c b/src/backend/access/rmgrdesc/spgdesc.c index 24d6cb58fd..41ed84b168 100644 --- a/src/backend/access/rmgrdesc/spgdesc.c +++ b/src/backend/access/rmgrdesc/spgdesc.c @@ -76,7 +76,7 @@ spg_desc(StringInfo buf, XLogReaderState *record) break; case XLOG_SPGIST_VACUUM_REDIRECT: appendStringInfo(buf, "newest XID %u", - ((spgxlogVacuumRedirect *) rec)->newestRedirectXid); + ((spgxlogVacuumRedirect *) rec)->newestRedirectXid); break; } } diff --git a/src/backend/access/rmgrdesc/xactdesc.c b/src/backend/access/rmgrdesc/xactdesc.c index 063e66834d..b270eff9bc 100644 --- a/src/backend/access/rmgrdesc/xactdesc.c +++ b/src/backend/access/rmgrdesc/xactdesc.c @@ -206,8 +206,8 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId if (parsed.nmsgs > 0) { standby_desc_invalidations( - buf, parsed.nmsgs, parsed.msgs, parsed.dbId, parsed.tsId, - XactCompletionRelcacheInitFileInval(parsed.xinfo)); + buf, parsed.nmsgs, parsed.msgs, parsed.dbId, parsed.tsId, + XactCompletionRelcacheInitFileInval(parsed.xinfo)); } if (XactCompletionForceSyncCommit(parsed.xinfo)) diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c index 5f07eb1499..f72f076017 100644 --- a/src/backend/access/rmgrdesc/xlogdesc.c +++ b/src/backend/access/rmgrdesc/xlogdesc.c @@ -26,7 +26,7 @@ const struct config_enum_entry wal_level_options[] = { {"minimal", WAL_LEVEL_MINIMAL, false}, {"replica", WAL_LEVEL_REPLICA, false}, - {"archive", WAL_LEVEL_REPLICA, true}, /* deprecated */ + {"archive", WAL_LEVEL_REPLICA, true}, /* deprecated */ {"hot_standby", WAL_LEVEL_REPLICA, true}, /* deprecated */ {"logical", WAL_LEVEL_LOGICAL, false}, {NULL, 0, false} @@ -48,7 +48,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record) "oldest xid %u in DB %u; oldest multi %u in DB %u; " "oldest/newest commit timestamp xid: %u/%u; " "oldest running xid %u; %s", - (uint32) (checkpoint->redo >> 32), (uint32) checkpoint->redo, + (uint32) (checkpoint->redo >> 32), (uint32) checkpoint->redo, checkpoint->ThisTimeLineID, checkpoint->PrevTimeLineID, checkpoint->fullPageWrites ? "true" : "false", @@ -63,7 +63,7 @@ xlog_desc(StringInfo buf, XLogReaderState *record) checkpoint->oldestCommitTsXid, checkpoint->newestCommitTsXid, checkpoint->oldestActiveXid, - (info == XLOG_CHECKPOINT_SHUTDOWN) ? "shutdown" : "online"); + (info == XLOG_CHECKPOINT_SHUTDOWN) ? "shutdown" : "online"); } else if (info == XLOG_NEXTOID) { diff --git a/src/backend/access/spgist/spgdoinsert.c b/src/backend/access/spgist/spgdoinsert.c index 90c6534139..b0702a7f92 100644 --- a/src/backend/access/spgist/spgdoinsert.c +++ b/src/backend/access/spgist/spgdoinsert.c @@ -189,7 +189,7 @@ saveNodeLink(Relation index, SPPageDesc *parent, SpGistInnerTuple innerTuple; innerTuple = (SpGistInnerTuple) PageGetItem(parent->page, - PageGetItemId(parent->page, parent->offnum)); + PageGetItemId(parent->page, parent->offnum)); spgUpdateNodeLink(innerTuple, parent->node, blkno, offnum); @@ -201,7 +201,7 @@ saveNodeLink(Relation index, SPPageDesc *parent, */ static void addLeafTuple(Relation index, SpGistState *state, SpGistLeafTuple leafTuple, - SPPageDesc *current, SPPageDesc *parent, bool isNulls, bool isNew) + SPPageDesc *current, SPPageDesc *parent, bool isNulls, bool isNew) { spgxlogAddLeaf xlrec; @@ -222,7 +222,7 @@ addLeafTuple(Relation index, SpGistState *state, SpGistLeafTuple leafTuple, /* Tuple is not part of a chain */ leafTuple->nextOffset = InvalidOffsetNumber; current->offnum = SpGistPageAddNewItem(state, current->page, - (Item) leafTuple, leafTuple->size, + (Item) leafTuple, leafTuple->size, NULL, false); xlrec.offnumLeaf = current->offnum; @@ -250,7 +250,7 @@ addLeafTuple(Relation index, SpGistState *state, SpGistLeafTuple leafTuple, OffsetNumber offnum; head = (SpGistLeafTuple) PageGetItem(current->page, - PageGetItemId(current->page, current->offnum)); + PageGetItemId(current->page, current->offnum)); if (head->tupstate == SPGIST_LIVE) { leafTuple->nextOffset = head->nextOffset; @@ -263,7 +263,7 @@ addLeafTuple(Relation index, SpGistState *state, SpGistLeafTuple leafTuple, * and set new second element */ head = (SpGistLeafTuple) PageGetItem(current->page, - PageGetItemId(current->page, current->offnum)); + PageGetItemId(current->page, current->offnum)); head->nextOffset = offnum; xlrec.offnumLeaf = offnum; @@ -467,7 +467,7 @@ moveLeafs(Relation index, SpGistState *state, for (i = 0; i < nDelete; i++) { it = (SpGistLeafTuple) PageGetItem(current->page, - PageGetItemId(current->page, toDelete[i])); + PageGetItemId(current->page, toDelete[i])); Assert(it->tupstate == SPGIST_LIVE); /* @@ -505,7 +505,7 @@ moveLeafs(Relation index, SpGistState *state, * be any concurrent scan so we need not provide a redirect. */ spgPageIndexMultiDelete(state, current->page, toDelete, nDelete, - state->isBuild ? SPGIST_PLACEHOLDER : SPGIST_REDIRECT, + state->isBuild ? SPGIST_PLACEHOLDER : SPGIST_REDIRECT, SPGIST_PLACEHOLDER, nblkno, r); @@ -570,7 +570,7 @@ setRedirectionTuple(SPPageDesc *current, OffsetNumber position, SpGistDeadTuple dt; dt = (SpGistDeadTuple) PageGetItem(current->page, - PageGetItemId(current->page, position)); + PageGetItemId(current->page, position)); Assert(dt->tupstate == SPGIST_REDIRECT); Assert(ItemPointerGetBlockNumber(&dt->pointer) == SPGIST_METAPAGE_BLKNO); ItemPointerSet(&dt->pointer, blkno, offnum); @@ -754,7 +754,7 @@ doPickSplit(Relation index, SpGistState *state, SpGistLeafTuple it; it = (SpGistLeafTuple) PageGetItem(current->page, - PageGetItemId(current->page, i)); + PageGetItemId(current->page, i)); if (it->tupstate == SPGIST_LIVE) { in.datums[nToInsert] = SGLTDATUM(it, state); @@ -765,7 +765,7 @@ doPickSplit(Relation index, SpGistState *state, /* we will delete the tuple altogether, so count full space */ spaceToDelete += it->size + sizeof(ItemIdData); } - else /* tuples on root should be live */ + else /* tuples on root should be live */ elog(ERROR, "unexpected SPGiST tuple state: %d", it->tupstate); } } @@ -779,7 +779,7 @@ doPickSplit(Relation index, SpGistState *state, Assert(i >= FirstOffsetNumber && i <= max); it = (SpGistLeafTuple) PageGetItem(current->page, - PageGetItemId(current->page, i)); + PageGetItemId(current->page, i)); if (it->tupstate == SPGIST_LIVE) { in.datums[nToInsert] = SGLTDATUM(it, state); @@ -957,9 +957,9 @@ doPickSplit(Relation index, SpGistState *state, { /* Send tuple to page with next triple parity (see README) */ newInnerBuffer = SpGistGetBuffer(index, - GBUF_INNER_PARITY(parent->blkno + 1) | + GBUF_INNER_PARITY(parent->blkno + 1) | (isNulls ? GBUF_NULLS : 0), - innerTuple->size + sizeof(ItemIdData), + innerTuple->size + sizeof(ItemIdData), &xlrec.initInner); } else @@ -1004,7 +1004,7 @@ doPickSplit(Relation index, SpGistState *state, insertedNew = true; } for (i = 0; i < nToInsert; i++) - leafPageSelect[i] = 0; /* signifies current page */ + leafPageSelect[i] = 0; /* signifies current page */ } else if (in.nTuples == 1 && totalLeafSizes > SPGIST_PAGE_CAPACITY) { @@ -1025,7 +1025,7 @@ doPickSplit(Relation index, SpGistState *state, int newspace; newLeafBuffer = SpGistGetBuffer(index, - GBUF_LEAF | (isNulls ? GBUF_NULLS : 0), + GBUF_LEAF | (isNulls ? GBUF_NULLS : 0), Min(totalLeafSizes, SPGIST_PAGE_CAPACITY), &xlrec.initDest); @@ -1076,12 +1076,12 @@ doPickSplit(Relation index, SpGistState *state, { if (leafSizes[i] <= curspace) { - nodePageSelect[i] = 0; /* signifies current page */ + nodePageSelect[i] = 0; /* signifies current page */ curspace -= leafSizes[i]; } else { - nodePageSelect[i] = 1; /* signifies new leaf page */ + nodePageSelect[i] = 1; /* signifies new leaf page */ newspace -= leafSizes[i]; } } @@ -1576,7 +1576,7 @@ spgAddNodeAction(Relation index, SpGistState *state, */ current->buffer = SpGistGetBuffer(index, GBUF_INNER_PARITY(current->blkno), - newInnerTuple->size + sizeof(ItemIdData), + newInnerTuple->size + sizeof(ItemIdData), &xlrec.newPage); current->blkno = BufferGetBlockNumber(current->buffer); current->page = BufferGetPage(current->buffer); @@ -1758,7 +1758,7 @@ spgSplitNodeAction(Relation index, SpGistState *state, postfixTuple = spgFormInnerTuple(state, out->result.splitTuple.postfixHasPrefix, - out->result.splitTuple.postfixPrefixDatum, + out->result.splitTuple.postfixPrefixDatum, innerTuple->nNodes, nodes); /* Postfix tuple is allTheSame if original tuple was */ @@ -1834,7 +1834,7 @@ spgSplitNodeAction(Relation index, SpGistState *state, spgUpdateNodeLink(prefixTuple, out->result.splitTuple.childNodeN, postfixBlkno, postfixOffset); prefixTuple = (SpGistInnerTuple) PageGetItem(current->page, - PageGetItemId(current->page, current->offnum)); + PageGetItemId(current->page, current->offnum)); spgUpdateNodeLink(prefixTuple, out->result.splitTuple.childNodeN, postfixBlkno, postfixOffset); @@ -1930,11 +1930,11 @@ spgdoinsert(Relation index, SpGistState *state, if (leafSize > SPGIST_PAGE_CAPACITY && !state->config.longValuesOK) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", - leafSize - sizeof(ItemIdData), - SPGIST_PAGE_CAPACITY - sizeof(ItemIdData), - RelationGetRelationName(index)), - errhint("Values larger than a buffer page cannot be indexed."))); + errmsg("index row size %zu exceeds maximum %zu for index \"%s\"", + leafSize - sizeof(ItemIdData), + SPGIST_PAGE_CAPACITY - sizeof(ItemIdData), + RelationGetRelationName(index)), + errhint("Values larger than a buffer page cannot be indexed."))); /* Initialize "current" to the appropriate root page */ current.blkno = isnull ? SPGIST_NULL_BLKNO : SPGIST_ROOT_BLKNO; @@ -2035,7 +2035,7 @@ spgdoinsert(Relation index, SpGistState *state, } else if ((sizeToSplit = checkSplitConditions(index, state, ¤t, - &nToSplit)) < SPGIST_PAGE_CAPACITY / 2 && + &nToSplit)) < SPGIST_PAGE_CAPACITY / 2 && nToSplit < 64 && leafTuple->size + sizeof(ItemIdData) + sizeToSplit <= SPGIST_PAGE_CAPACITY) { @@ -2064,7 +2064,7 @@ spgdoinsert(Relation index, SpGistState *state, goto process_inner_tuple; } } - else /* non-leaf page */ + else /* non-leaf page */ { /* * Apply the opclass choose function to figure out how to insert @@ -2084,7 +2084,7 @@ spgdoinsert(Relation index, SpGistState *state, CHECK_FOR_INTERRUPTS(); innerTuple = (SpGistInnerTuple) PageGetItem(current.page, - PageGetItemId(current.page, current.offnum)); + PageGetItemId(current.page, current.offnum)); in.datum = datum; in.leafDatum = leafDatum; diff --git a/src/backend/access/spgist/spginsert.c b/src/backend/access/spgist/spginsert.c index 9a37259916..e4b2c29b0e 100644 --- a/src/backend/access/spgist/spginsert.c +++ b/src/backend/access/spgist/spginsert.c @@ -134,7 +134,7 @@ spgbuild(Relation heap, Relation index, IndexInfo *indexInfo) buildstate.spgstate.isBuild = true; buildstate.tmpCtx = AllocSetContextCreate(CurrentMemoryContext, - "SP-GiST build temporary context", + "SP-GiST build temporary context", ALLOCSET_DEFAULT_SIZES); reltuples = IndexBuildHeapScan(heap, index, indexInfo, true, diff --git a/src/backend/access/spgist/spgquadtreeproc.c b/src/backend/access/spgist/spgquadtreeproc.c index 6ad73f448d..773774555f 100644 --- a/src/backend/access/spgist/spgquadtreeproc.c +++ b/src/backend/access/spgist/spgquadtreeproc.c @@ -253,8 +253,8 @@ spg_quad_inner_consistent(PG_FUNCTION_ARGS) boxQuery = DatumGetBoxP(in->scankeys[i].sk_argument); if (DatumGetBool(DirectFunctionCall2(box_contain_pt, - PointerGetDatum(boxQuery), - PointerGetDatum(centroid)))) + PointerGetDatum(boxQuery), + PointerGetDatum(centroid)))) { /* centroid is in box, so all quadrants are OK */ } diff --git a/src/backend/access/spgist/spgscan.c b/src/backend/access/spgist/spgscan.c index 2d96c0094e..7965b5846d 100644 --- a/src/backend/access/spgist/spgscan.c +++ b/src/backend/access/spgist/spgscan.c @@ -25,11 +25,11 @@ typedef void (*storeRes_func) (SpGistScanOpaque so, ItemPointer heapPtr, - Datum leafValue, bool isnull, bool recheck); + Datum leafValue, bool isnull, bool recheck); typedef struct ScanStackEntry { - Datum reconstructedValue; /* value reconstructed from parent */ + Datum reconstructedValue; /* value reconstructed from parent */ void *traversalValue; /* opclass-specific traverse value */ int level; /* level of items on this page */ ItemPointerData ptr; /* block and offset to scan from */ @@ -430,7 +430,7 @@ redirect: } } } - else /* page is inner */ + else /* page is inner */ { SpGistInnerTuple innerTuple; spgInnerConsistentIn in; @@ -442,7 +442,7 @@ redirect: MemoryContext oldCtx; innerTuple = (SpGistInnerTuple) PageGetItem(page, - PageGetItemId(page, offset)); + PageGetItemId(page, offset)); if (innerTuple->tupstate != SPGIST_LIVE) { diff --git a/src/backend/access/spgist/spgutils.c b/src/backend/access/spgist/spgutils.c index e57ac49c6b..8656af453c 100644 --- a/src/backend/access/spgist/spgutils.c +++ b/src/backend/access/spgist/spgutils.c @@ -705,7 +705,7 @@ spgFormInnerTuple(SpGistState *state, bool hasPrefix, Datum prefix, errmsg("SP-GiST inner tuple size %zu exceeds maximum %zu", (Size) size, SPGIST_PAGE_CAPACITY - sizeof(ItemIdData)), - errhint("Values larger than a buffer page cannot be indexed."))); + errhint("Values larger than a buffer page cannot be indexed."))); /* * Check for overflow of header fields --- probably can't fail if the @@ -848,7 +848,7 @@ SpGistPageAddNewItem(SpGistState *state, Page page, Item item, Size size, for (; i <= maxoff; i++) { SpGistDeadTuple it = (SpGistDeadTuple) PageGetItem(page, - PageGetItemId(page, i)); + PageGetItemId(page, i)); if (it->tupstate == SPGIST_PLACEHOLDER) { diff --git a/src/backend/access/spgist/spgvacuum.c b/src/backend/access/spgist/spgvacuum.c index cce9b3f618..d7d5e90ef3 100644 --- a/src/backend/access/spgist/spgvacuum.c +++ b/src/backend/access/spgist/spgvacuum.c @@ -34,7 +34,7 @@ typedef struct spgVacPendingItem { ItemPointerData tid; /* redirection target to visit */ bool done; /* have we dealt with this? */ - struct spgVacPendingItem *next; /* list link */ + struct spgVacPendingItem *next; /* list link */ } spgVacPendingItem; /* Local state for vacuum operations */ @@ -48,7 +48,7 @@ typedef struct spgBulkDeleteState /* Additional working state */ SpGistState spgstate; /* for SPGiST operations that need one */ - spgVacPendingItem *pendingList; /* TIDs we need to (re)visit */ + spgVacPendingItem *pendingList; /* TIDs we need to (re)visit */ TransactionId myXmin; /* for detecting newly-added redirects */ BlockNumber lastFilledBlock; /* last non-deletable block */ } spgBulkDeleteState; @@ -750,7 +750,7 @@ spgprocesspending(spgBulkDeleteState *bds) offset = ItemPointerGetOffsetNumber(&nitem->tid); innerTuple = (SpGistInnerTuple) PageGetItem(page, - PageGetItemId(page, offset)); + PageGetItemId(page, offset)); if (innerTuple->tupstate == SPGIST_LIVE) { SpGistNodeTuple node; @@ -766,7 +766,7 @@ spgprocesspending(spgBulkDeleteState *bds) { /* transfer attention to redirect point */ spgAddPendingTID(bds, - &((SpGistDeadTuple) innerTuple)->pointer); + &((SpGistDeadTuple) innerTuple)->pointer); } else elog(ERROR, "unexpected SPGiST tuple state: %d", diff --git a/src/backend/access/spgist/spgxlog.c b/src/backend/access/spgist/spgxlog.c index c007601efd..c440d21715 100644 --- a/src/backend/access/spgist/spgxlog.c +++ b/src/backend/access/spgist/spgxlog.c @@ -54,7 +54,7 @@ addOrReplaceTuple(Page page, Item tuple, int size, OffsetNumber offset) if (offset <= PageGetMaxOffsetNumber(page)) { SpGistDeadTuple dt = (SpGistDeadTuple) PageGetItem(page, - PageGetItemId(page, offset)); + PageGetItemId(page, offset)); if (dt->tupstate != SPGIST_PLACEHOLDER) elog(ERROR, "SPGiST tuple to be replaced is not a placeholder"); @@ -130,7 +130,7 @@ spgRedoAddLeaf(XLogReaderState *record) { buffer = XLogInitBufferForRedo(record, 0); SpGistInitBuffer(buffer, - SPGIST_LEAF | (xldata->storesNulls ? SPGIST_NULLS : 0)); + SPGIST_LEAF | (xldata->storesNulls ? SPGIST_NULLS : 0)); action = BLK_NEEDS_REDO; } else @@ -153,7 +153,7 @@ spgRedoAddLeaf(XLogReaderState *record) SpGistLeafTuple head; head = (SpGistLeafTuple) PageGetItem(page, - PageGetItemId(page, xldata->offnumHeadLeaf)); + PageGetItemId(page, xldata->offnumHeadLeaf)); Assert(head->nextOffset == leafTupleHdr.nextOffset); head->nextOffset = xldata->offnumLeaf; } @@ -164,7 +164,7 @@ spgRedoAddLeaf(XLogReaderState *record) PageIndexTupleDelete(page, xldata->offnumLeaf); if (PageAddItem(page, (Item) leafTuple, leafTupleHdr.size, - xldata->offnumLeaf, false, false) != xldata->offnumLeaf) + xldata->offnumLeaf, false, false) != xldata->offnumLeaf) elog(ERROR, "failed to add item of size %u to SPGiST index page", leafTupleHdr.size); } @@ -188,7 +188,7 @@ spgRedoAddLeaf(XLogReaderState *record) page = BufferGetPage(buffer); tuple = (SpGistInnerTuple) PageGetItem(page, - PageGetItemId(page, xldata->offnumParent)); + PageGetItemId(page, xldata->offnumParent)); spgUpdateNodeLink(tuple, xldata->nodeI, blknoLeaf, xldata->offnumLeaf); @@ -241,7 +241,7 @@ spgRedoMoveLeafs(XLogReaderState *record) { buffer = XLogInitBufferForRedo(record, 1); SpGistInitBuffer(buffer, - SPGIST_LEAF | (xldata->storesNulls ? SPGIST_NULLS : 0)); + SPGIST_LEAF | (xldata->storesNulls ? SPGIST_NULLS : 0)); action = BLK_NEEDS_REDO; } else @@ -283,7 +283,7 @@ spgRedoMoveLeafs(XLogReaderState *record) page = BufferGetPage(buffer); spgPageIndexMultiDelete(&state, page, toDelete, xldata->nMoves, - state.isBuild ? SPGIST_PLACEHOLDER : SPGIST_REDIRECT, + state.isBuild ? SPGIST_PLACEHOLDER : SPGIST_REDIRECT, SPGIST_PLACEHOLDER, blknoDst, toInsert[nInsert - 1]); @@ -302,7 +302,7 @@ spgRedoMoveLeafs(XLogReaderState *record) page = BufferGetPage(buffer); tuple = (SpGistInnerTuple) PageGetItem(page, - PageGetItemId(page, xldata->offnumParent)); + PageGetItemId(page, xldata->offnumParent)); spgUpdateNodeLink(tuple, xldata->nodeI, blknoDst, toInsert[nInsert - 1]); @@ -396,7 +396,7 @@ spgRedoAddNode(XLogReaderState *record) SpGistInnerTuple parentTuple; parentTuple = (SpGistInnerTuple) PageGetItem(page, - PageGetItemId(page, xldata->offnumParent)); + PageGetItemId(page, xldata->offnumParent)); spgUpdateNodeLink(parentTuple, xldata->nodeI, blknoNew, xldata->offnumNew); @@ -443,7 +443,7 @@ spgRedoAddNode(XLogReaderState *record) SpGistInnerTuple parentTuple; parentTuple = (SpGistInnerTuple) PageGetItem(page, - PageGetItemId(page, xldata->offnumParent)); + PageGetItemId(page, xldata->offnumParent)); spgUpdateNodeLink(parentTuple, xldata->nodeI, blknoNew, xldata->offnumNew); @@ -467,7 +467,7 @@ spgRedoAddNode(XLogReaderState *record) page = BufferGetPage(buffer); parentTuple = (SpGistInnerTuple) PageGetItem(page, - PageGetItemId(page, xldata->offnumParent)); + PageGetItemId(page, xldata->offnumParent)); spgUpdateNodeLink(parentTuple, xldata->nodeI, blknoNew, xldata->offnumNew); @@ -543,7 +543,7 @@ spgRedoSplitTuple(XLogReaderState *record) PageIndexTupleDelete(page, xldata->offnumPrefix); if (PageAddItem(page, (Item) prefixTuple, prefixTupleHdr.size, - xldata->offnumPrefix, false, false) != xldata->offnumPrefix) + xldata->offnumPrefix, false, false) != xldata->offnumPrefix) elog(ERROR, "failed to add item of size %u to SPGiST index page", prefixTupleHdr.size); @@ -613,7 +613,7 @@ spgRedoPickSplit(XLogReaderState *record) srcPage = (Page) BufferGetPage(srcBuffer); SpGistInitBuffer(srcBuffer, - SPGIST_LEAF | (xldata->storesNulls ? SPGIST_NULLS : 0)); + SPGIST_LEAF | (xldata->storesNulls ? SPGIST_NULLS : 0)); /* don't update LSN etc till we're done with it */ } else @@ -666,7 +666,7 @@ spgRedoPickSplit(XLogReaderState *record) destPage = (Page) BufferGetPage(destBuffer); SpGistInitBuffer(destBuffer, - SPGIST_LEAF | (xldata->storesNulls ? SPGIST_NULLS : 0)); + SPGIST_LEAF | (xldata->storesNulls ? SPGIST_NULLS : 0)); /* don't update LSN etc till we're done with it */ } else @@ -735,7 +735,7 @@ spgRedoPickSplit(XLogReaderState *record) SpGistInnerTuple parent; parent = (SpGistInnerTuple) PageGetItem(page, - PageGetItemId(page, xldata->offnumParent)); + PageGetItemId(page, xldata->offnumParent)); spgUpdateNodeLink(parent, xldata->nodeI, blknoInner, xldata->offnumInner); } @@ -767,7 +767,7 @@ spgRedoPickSplit(XLogReaderState *record) page = BufferGetPage(parentBuffer); parent = (SpGistInnerTuple) PageGetItem(page, - PageGetItemId(page, xldata->offnumParent)); + PageGetItemId(page, xldata->offnumParent)); spgUpdateNodeLink(parent, xldata->nodeI, blknoInner, xldata->offnumInner); @@ -852,7 +852,7 @@ spgRedoVacuumLeaf(XLogReaderState *record) SpGistLeafTuple lt; lt = (SpGistLeafTuple) PageGetItem(page, - PageGetItemId(page, chainSrc[i])); + PageGetItemId(page, chainSrc[i])); Assert(lt->tupstate == SPGIST_LIVE); lt->nextOffset = chainDest[i]; } @@ -929,7 +929,7 @@ spgRedoVacuumRedirect(XLogReaderState *record) SpGistDeadTuple dt; dt = (SpGistDeadTuple) PageGetItem(page, - PageGetItemId(page, itemToPlaceholder[i])); + PageGetItemId(page, itemToPlaceholder[i])); Assert(dt->tupstate == SPGIST_REDIRECT); dt->tupstate = SPGIST_PLACEHOLDER; ItemPointerSetInvalid(&dt->pointer); diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c index 9c6964d79c..10184a7268 100644 --- a/src/backend/access/transam/clog.c +++ b/src/backend/access/transam/clog.c @@ -148,9 +148,9 @@ static void set_status_by_pages(int nsubxids, TransactionId *subxids, */ void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, - TransactionId *subxids, XidStatus status, XLogRecPtr lsn) + TransactionId *subxids, XidStatus status, XLogRecPtr lsn) { - int pageno = TransactionIdToPage(xid); /* get page of parent */ + int pageno = TransactionIdToPage(xid); /* get page of parent */ int i; Assert(status == TRANSACTION_STATUS_COMMITTED || diff --git a/src/backend/access/transam/commit_ts.c b/src/backend/access/transam/commit_ts.c index cb75430bc9..555f7cafd1 100644 --- a/src/backend/access/transam/commit_ts.c +++ b/src/backend/access/transam/commit_ts.c @@ -292,7 +292,7 @@ TransactionIdGetCommitTsData(TransactionId xid, TimestampTz *ts, if (!TransactionIdIsValid(xid)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("cannot retrieve commit timestamp for transaction %u", xid))); + errmsg("cannot retrieve commit timestamp for transaction %u", xid))); else if (!TransactionIdIsNormal(xid)) { /* frozen and bootstrap xids are always committed far in the past */ @@ -904,7 +904,7 @@ AdvanceOldestCommitTsXid(TransactionId oldestXact) { LWLockAcquire(CommitTsLock, LW_EXCLUSIVE); if (ShmemVariableCache->oldestCommitTsXid != InvalidTransactionId && - TransactionIdPrecedes(ShmemVariableCache->oldestCommitTsXid, oldestXact)) + TransactionIdPrecedes(ShmemVariableCache->oldestCommitTsXid, oldestXact)) ShmemVariableCache->oldestCommitTsXid = oldestXact; LWLockRelease(CommitTsLock); } diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index 1a7824b5d4..682eef420b 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -999,15 +999,15 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset) (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("database is not accepting commands that generate new MultiXactIds to avoid wraparound data loss in database \"%s\"", oldest_datname), - errhint("Execute a database-wide VACUUM in that database.\n" - "You might also need to commit or roll back old prepared transactions."))); + errhint("Execute a database-wide VACUUM in that database.\n" + "You might also need to commit or roll back old prepared transactions."))); else ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("database is not accepting commands that generate new MultiXactIds to avoid wraparound data loss in database with OID %u", oldest_datoid), - errhint("Execute a database-wide VACUUM in that database.\n" - "You might also need to commit or roll back old prepared transactions."))); + errhint("Execute a database-wide VACUUM in that database.\n" + "You might also need to commit or roll back old prepared transactions."))); } /* @@ -1030,8 +1030,8 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset) multiWrapLimit - result, oldest_datname, multiWrapLimit - result), - errhint("Execute a database-wide VACUUM in that database.\n" - "You might also need to commit or roll back old prepared transactions."))); + errhint("Execute a database-wide VACUUM in that database.\n" + "You might also need to commit or roll back old prepared transactions."))); else ereport(WARNING, (errmsg_plural("database with OID %u must be vacuumed before %u more MultiXactId is used", @@ -1039,8 +1039,8 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset) multiWrapLimit - result, oldest_datoid, multiWrapLimit - result), - errhint("Execute a database-wide VACUUM in that database.\n" - "You might also need to commit or roll back old prepared transactions."))); + errhint("Execute a database-wide VACUUM in that database.\n" + "You might also need to commit or roll back old prepared transactions."))); } /* Re-acquire lock and start over */ @@ -1098,9 +1098,9 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset) errmsg("multixact \"members\" limit exceeded"), errdetail_plural("This command would create a multixact with %u members, but the remaining space is only enough for %u member.", "This command would create a multixact with %u members, but the remaining space is only enough for %u members.", - MultiXactState->offsetStopLimit - nextOffset - 1, + MultiXactState->offsetStopLimit - nextOffset - 1, nmembers, - MultiXactState->offsetStopLimit - nextOffset - 1), + MultiXactState->offsetStopLimit - nextOffset - 1), errhint("Execute a database-wide VACUUM in database with OID %u with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings.", MultiXactState->oldestMultiXactDB))); } @@ -1134,9 +1134,9 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset) (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg_plural("database with OID %u must be vacuumed before %d more multixact member is used", "database with OID %u must be vacuumed before %d more multixact members are used", - MultiXactState->offsetStopLimit - nextOffset + nmembers, + MultiXactState->offsetStopLimit - nextOffset + nmembers, MultiXactState->oldestMultiXactDB, - MultiXactState->offsetStopLimit - nextOffset + nmembers), + MultiXactState->offsetStopLimit - nextOffset + nmembers), errhint("Execute a database-wide VACUUM in that database with reduced vacuum_multixact_freeze_min_age and vacuum_multixact_freeze_table_age settings."))); ExtendMultiXactMember(nextOffset, nmembers); @@ -1274,8 +1274,8 @@ GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members, { ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("MultiXactId %u does no longer exist -- apparent wraparound", - multi))); + errmsg("MultiXactId %u does no longer exist -- apparent wraparound", + multi))); return -1; } @@ -2265,8 +2265,8 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid, /* Log the info */ ereport(DEBUG1, - (errmsg("MultiXactId wrap limit is %u, limited by database with OID %u", - multiWrapLimit, oldest_datoid))); + (errmsg("MultiXactId wrap limit is %u, limited by database with OID %u", + multiWrapLimit, oldest_datoid))); /* * Computing the actual limits is only possible once the data directory is @@ -2618,7 +2618,7 @@ SetOffsetVacuumLimit(bool is_startup) { /* move back to start of the corresponding segment */ offsetStopLimit = oldestOffset - (oldestOffset % - (MULTIXACT_MEMBERS_PER_PAGE * SLRU_PAGES_PER_SEGMENT)); + (MULTIXACT_MEMBERS_PER_PAGE * SLRU_PAGES_PER_SEGMENT)); /* always leave one segment before the wraparound point */ offsetStopLimit -= (MULTIXACT_MEMBERS_PER_PAGE * SLRU_PAGES_PER_SEGMENT); @@ -2628,8 +2628,8 @@ SetOffsetVacuumLimit(bool is_startup) (errmsg("MultiXact member wraparound protections are now enabled"))); ereport(DEBUG1, - (errmsg("MultiXact member stop limit is now %u based on MultiXact %u", - offsetStopLimit, oldestMultiXactId))); + (errmsg("MultiXact member stop limit is now %u based on MultiXact %u", + offsetStopLimit, oldestMultiXactId))); } else if (prevOldestOffsetKnown) { @@ -2915,7 +2915,7 @@ PerformOffsetsTruncation(MultiXactId oldestMulti, MultiXactId newOldestMulti) * detection. */ SimpleLruTruncate(MultiXactOffsetCtl, - MultiXactIdToOffsetPage(PreviousMultiXactId(newOldestMulti))); + MultiXactIdToOffsetPage(PreviousMultiXactId(newOldestMulti))); } /* @@ -3191,7 +3191,7 @@ WriteMZeroPageXlogRec(int pageno, uint8 info) static void WriteMTruncateXlogRec(Oid oldestMultiDB, MultiXactId startTruncOff, MultiXactId endTruncOff, - MultiXactOffset startTruncMemb, MultiXactOffset endTruncMemb) + MultiXactOffset startTruncMemb, MultiXactOffset endTruncMemb) { XLogRecPtr recptr; xl_multixact_truncate xlrec; diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c index afb54ada9f..4e03eeabcc 100644 --- a/src/backend/access/transam/parallel.c +++ b/src/backend/access/transam/parallel.c @@ -114,7 +114,7 @@ static const struct { const char *fn_name; parallel_worker_main_type fn_addr; -} InternalParallelWorkers[] = +} InternalParallelWorkers[] = { { @@ -575,7 +575,7 @@ WaitForParallelWorkersToExit(ParallelContext *pcxt) if (status == BGWH_POSTMASTER_DIED) ereport(FATAL, (errcode(ERRCODE_ADMIN_SHUTDOWN), - errmsg("postmaster exited during a parallel transaction"))); + errmsg("postmaster exited during a parallel transaction"))); /* Release memory. */ pfree(pcxt->worker[i].bgwhandle); @@ -761,8 +761,8 @@ HandleParallelMessages(void) } else ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("lost connection to parallel worker"))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("lost connection to parallel worker"))); } } } @@ -971,7 +971,7 @@ ParallelWorkerMain(Datum main_arg) if (toc == NULL) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("invalid magic number in dynamic shared memory segment"))); + errmsg("invalid magic number in dynamic shared memory segment"))); /* Look up fixed parallel state. */ fps = shm_toc_lookup(toc, PARALLEL_KEY_FIXED, false); diff --git a/src/backend/access/transam/slru.c b/src/backend/access/transam/slru.c index ed90fb9232..2bec856639 100644 --- a/src/backend/access/transam/slru.c +++ b/src/backend/access/transam/slru.c @@ -76,7 +76,7 @@ typedef struct SlruFlushData { int num_files; /* # files actually open */ int fd[MAX_FLUSH_BUFFERS]; /* their FD's */ - int segno[MAX_FLUSH_BUFFERS]; /* their log seg#s */ + int segno[MAX_FLUSH_BUFFERS]; /* their log seg#s */ } SlruFlushData; typedef struct SlruFlushData *SlruFlush; @@ -150,10 +150,10 @@ SimpleLruShmemSize(int nslots, int nlsns) sz = MAXALIGN(sizeof(SlruSharedData)); sz += MAXALIGN(nslots * sizeof(char *)); /* page_buffer[] */ sz += MAXALIGN(nslots * sizeof(SlruPageStatus)); /* page_status[] */ - sz += MAXALIGN(nslots * sizeof(bool)); /* page_dirty[] */ - sz += MAXALIGN(nslots * sizeof(int)); /* page_number[] */ - sz += MAXALIGN(nslots * sizeof(int)); /* page_lru_count[] */ - sz += MAXALIGN(nslots * sizeof(LWLockPadded)); /* buffer_locks[] */ + sz += MAXALIGN(nslots * sizeof(bool)); /* page_dirty[] */ + sz += MAXALIGN(nslots * sizeof(int)); /* page_number[] */ + sz += MAXALIGN(nslots * sizeof(int)); /* page_lru_count[] */ + sz += MAXALIGN(nslots * sizeof(LWLockPadded)); /* buffer_locks[] */ if (nlsns > 0) sz += MAXALIGN(nslots * nlsns * sizeof(XLogRecPtr)); /* group_lsn[] */ @@ -340,7 +340,7 @@ SimpleLruWaitIO(SlruCtl ctl, int slotno) /* indeed, the I/O must have failed */ if (shared->page_status[slotno] == SLRU_PAGE_READ_IN_PROGRESS) shared->page_status[slotno] = SLRU_PAGE_EMPTY; - else /* write_in_progress */ + else /* write_in_progress */ { shared->page_status[slotno] = SLRU_PAGE_VALID; shared->page_dirty[slotno] = true; @@ -921,22 +921,22 @@ SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid) ereport(ERROR, (errcode_for_file_access(), errmsg("could not access status of transaction %u", xid), - errdetail("Could not seek in file \"%s\" to offset %u: %m.", - path, offset))); + errdetail("Could not seek in file \"%s\" to offset %u: %m.", + path, offset))); break; case SLRU_READ_FAILED: ereport(ERROR, (errcode_for_file_access(), errmsg("could not access status of transaction %u", xid), - errdetail("Could not read from file \"%s\" at offset %u: %m.", - path, offset))); + errdetail("Could not read from file \"%s\" at offset %u: %m.", + path, offset))); break; case SLRU_WRITE_FAILED: ereport(ERROR, (errcode_for_file_access(), errmsg("could not access status of transaction %u", xid), - errdetail("Could not write to file \"%s\" at offset %u: %m.", - path, offset))); + errdetail("Could not write to file \"%s\" at offset %u: %m.", + path, offset))); break; case SLRU_FSYNC_FAILED: ereport(ERROR, @@ -986,9 +986,9 @@ SlruSelectLRUPage(SlruCtl ctl, int pageno) int bestvalidslot = 0; /* keep compiler quiet */ int best_valid_delta = -1; int best_valid_page_number = 0; /* keep compiler quiet */ - int bestinvalidslot = 0; /* keep compiler quiet */ + int bestinvalidslot = 0; /* keep compiler quiet */ int best_invalid_delta = -1; - int best_invalid_page_number = 0; /* keep compiler quiet */ + int best_invalid_page_number = 0; /* keep compiler quiet */ /* See if page already has a buffer assigned */ for (slotno = 0; slotno < shared->num_slots; slotno++) @@ -1206,8 +1206,8 @@ restart:; { LWLockRelease(shared->ControlLock); ereport(LOG, - (errmsg("could not truncate directory \"%s\": apparent wraparound", - ctl->Dir))); + (errmsg("could not truncate directory \"%s\": apparent wraparound", + ctl->Dir))); return; } diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c index 8cab8b9aa9..63db8a981d 100644 --- a/src/backend/access/transam/timeline.c +++ b/src/backend/access/transam/timeline.c @@ -151,12 +151,12 @@ readTimeLineHistory(TimeLineID targetTLI) if (nfields != 3) ereport(FATAL, (errmsg("syntax error in history file: %s", fline), - errhint("Expected a write-ahead log switchpoint location."))); + errhint("Expected a write-ahead log switchpoint location."))); if (result && tli <= lasttli) ereport(FATAL, (errmsg("invalid data in history file: %s", fline), - errhint("Timeline IDs must be in increasing sequence."))); + errhint("Timeline IDs must be in increasing sequence."))); lasttli = tli; @@ -177,7 +177,7 @@ readTimeLineHistory(TimeLineID targetTLI) if (result && targetTLI <= lasttli) ereport(FATAL, (errmsg("invalid data in history file \"%s\"", path), - errhint("Timeline IDs must be less than child timeline's ID."))); + errhint("Timeline IDs must be less than child timeline's ID."))); /* * Create one more entry for the "tip" of the timeline, which has no entry @@ -261,7 +261,7 @@ findNewestTimeLine(TimeLineID startTLI) { if (existsTimeLineHistory(probeTLI)) { - newestTLI = probeTLI; /* probeTLI exists */ + newestTLI = probeTLI; /* probeTLI exists */ } else { @@ -367,7 +367,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, ereport(ERROR, (errcode_for_file_access(), - errmsg("could not write to file \"%s\": %m", tmppath))); + errmsg("could not write to file \"%s\": %m", tmppath))); } pgstat_report_wait_end(); } diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 3c1df5166e..12729111d3 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -173,7 +173,7 @@ typedef struct GlobalTransactionData * track of the end LSN because that is the LSN we need to wait for prior * to commit. */ - XLogRecPtr prepare_start_lsn; /* XLOG offset of prepare record start */ + XLogRecPtr prepare_start_lsn; /* XLOG offset of prepare record start */ XLogRecPtr prepare_end_lsn; /* XLOG offset of prepare record end */ TransactionId xid; /* The GXACT id */ @@ -183,7 +183,7 @@ typedef struct GlobalTransactionData bool ondisk; /* TRUE if prepare state file is on disk */ bool inredo; /* TRUE if entry was added via xlog_redo */ char gid[GIDSIZE]; /* The GID assigned to the prepared xact */ -} GlobalTransactionData; +} GlobalTransactionData; /* * Two Phase Commit shared state. Access to this struct is protected @@ -397,7 +397,7 @@ MarkAsPreparing(TransactionId xid, const char *gid, ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("prepared transactions are disabled"), - errhint("Set max_prepared_transactions to a nonzero value."))); + errhint("Set max_prepared_transactions to a nonzero value."))); /* on first call, register the exit hook */ if (!twophaseExitRegistered) @@ -593,13 +593,13 @@ LockGXact(const char *gid, Oid user) if (gxact->locking_backend != InvalidBackendId) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("prepared transaction with identifier \"%s\" is busy", - gid))); + errmsg("prepared transaction with identifier \"%s\" is busy", + gid))); if (user != gxact->owner && !superuser_arg(user)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to finish prepared transaction"), + errmsg("permission denied to finish prepared transaction"), errhint("Must be superuser or the user that prepared the transaction."))); /* @@ -611,7 +611,7 @@ LockGXact(const char *gid, Oid user) if (MyDatabaseId != proc->databaseId) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("prepared transaction belongs to another database"), + errmsg("prepared transaction belongs to another database"), errhint("Connect to the database where the transaction was prepared to finish it."))); /* OK for me to lock it */ @@ -633,10 +633,10 @@ LockGXact(const char *gid, Oid user) if (!xc_maintenance_mode) { #endif - ereport(ERROR, - (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("prepared transaction with identifier \"%s\" does not exist", - gid))); + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_OBJECT), + errmsg("prepared transaction with identifier \"%s\" does not exist", + gid))); #ifdef PGXC } #endif @@ -918,7 +918,7 @@ TwoPhaseGetDummyProc(TransactionId xid) /* * Header for a 2PC state file */ -#define TWOPHASE_MAGIC 0x57F94533 /* format identifier */ +#define TWOPHASE_MAGIC 0x57F94533 /* format identifier */ typedef struct TwoPhaseFileHeader { @@ -968,7 +968,7 @@ static struct xllist uint32 num_chunks; uint32 bytes_free; /* free bytes left in tail block */ uint32 total_len; /* total data bytes in chain */ -} records; +} records; /* @@ -1044,7 +1044,7 @@ StartPrepare(GlobalTransaction gxact) hdr.nabortrels = smgrGetPendingDeletes(false, &abortrels); hdr.ninvalmsgs = xactGetCommittedInvalidationMessages(&invalmsgs, &hdr.initfileinval); - hdr.gidlen = strlen(gxact->gid) + 1; /* Include '\0' */ + hdr.gidlen = strlen(gxact->gid) + 1; /* Include '\0' */ save_state_data(&hdr, sizeof(TwoPhaseFileHeader)); save_state_data(gxact->gid, hdr.gidlen); @@ -1324,7 +1324,7 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of memory"), - errdetail("Failed while allocating a WAL reading processor."))); + errdetail("Failed while allocating a WAL reading processor."))); record = XLogReadRecord(xlogreader, lsn, &errormsg); if (record == NULL) @@ -1338,9 +1338,9 @@ XlogReadTwoPhaseData(XLogRecPtr lsn, char **buf, int *len) (XLogRecGetInfo(xlogreader) & XLOG_XACT_OPMASK) != XLOG_XACT_PREPARE) ereport(ERROR, (errcode_for_file_access(), - errmsg("expected two-phase state data is not present in WAL at %X/%X", - (uint32) (lsn >> 32), - (uint32) lsn))); + errmsg("expected two-phase state data is not present in WAL at %X/%X", + (uint32) (lsn >> 32), + (uint32) lsn))); if (len != NULL) *len = XLogRecGetDataLen(xlogreader); @@ -1589,8 +1589,8 @@ RemoveTwoPhaseFile(TransactionId xid, bool giveWarning) if (errno != ENOENT || giveWarning) ereport(WARNING, (errcode_for_file_access(), - errmsg("could not remove two-phase state file \"%s\": %m", - path))); + errmsg("could not remove two-phase state file \"%s\": %m", + path))); } /* @@ -2092,8 +2092,8 @@ ProcessTwoPhaseBuffer(TransactionId xid, else { ereport(WARNING, - (errmsg("removing future two-phase state from memory for \"%u\"", - xid))); + (errmsg("removing future two-phase state from memory for \"%u\"", + xid))); PrepareRedoRemove(xid, true); } return NULL; @@ -2106,8 +2106,8 @@ ProcessTwoPhaseBuffer(TransactionId xid, if (buf == NULL) { ereport(WARNING, - (errmsg("removing corrupt two-phase state file for \"%u\"", - xid))); + (errmsg("removing corrupt two-phase state file for \"%u\"", + xid))); RemoveTwoPhaseFile(xid, true); return NULL; } @@ -2125,15 +2125,15 @@ ProcessTwoPhaseBuffer(TransactionId xid, if (fromdisk) { ereport(WARNING, - (errmsg("removing corrupt two-phase state file for \"%u\"", - xid))); + (errmsg("removing corrupt two-phase state file for \"%u\"", + xid))); RemoveTwoPhaseFile(xid, true); } else { ereport(WARNING, - (errmsg("removing corrupt two-phase state from memory for \"%u\"", - xid))); + (errmsg("removing corrupt two-phase state from memory for \"%u\"", + xid))); PrepareRedoRemove(xid, true); } pfree(buf); @@ -2226,7 +2226,7 @@ RecordTransactionCommitPrepared(TransactionId xid, nchildren, children, nrels, rels, ninvalmsgs, invalmsgs, initfileinval, false, - MyXactFlags | XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK, + MyXactFlags | XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK, xid); @@ -2311,7 +2311,7 @@ RecordTransactionAbortPrepared(TransactionId xid, recptr = XactLogAbortRecord(GetCurrentTimestamp(), nchildren, children, nrels, rels, - MyXactFlags | XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK, + MyXactFlags | XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK, xid); /* Always flush, since we're about to remove the 2PC state file */ diff --git a/src/backend/access/transam/twophase_rmgr.c b/src/backend/access/transam/twophase_rmgr.c index cdcc382f34..1cd03482d9 100644 --- a/src/backend/access/transam/twophase_rmgr.c +++ b/src/backend/access/transam/twophase_rmgr.c @@ -27,7 +27,7 @@ const TwoPhaseCallback twophase_recover_callbacks[TWOPHASE_RM_MAX_ID + 1] = lock_twophase_recover, /* Lock */ NULL, /* pgstat */ multixact_twophase_recover, /* MultiXact */ - predicatelock_twophase_recover /* PredicateLock */ + predicatelock_twophase_recover /* PredicateLock */ }; const TwoPhaseCallback twophase_postcommit_callbacks[TWOPHASE_RM_MAX_ID + 1] = @@ -35,7 +35,7 @@ const TwoPhaseCallback twophase_postcommit_callbacks[TWOPHASE_RM_MAX_ID + 1] = NULL, /* END ID */ lock_twophase_postcommit, /* Lock */ pgstat_twophase_postcommit, /* pgstat */ - multixact_twophase_postcommit, /* MultiXact */ + multixact_twophase_postcommit, /* MultiXact */ NULL /* PredicateLock */ }; @@ -44,14 +44,14 @@ const TwoPhaseCallback twophase_postabort_callbacks[TWOPHASE_RM_MAX_ID + 1] = NULL, /* END ID */ lock_twophase_postabort, /* Lock */ pgstat_twophase_postabort, /* pgstat */ - multixact_twophase_postabort, /* MultiXact */ + multixact_twophase_postabort, /* MultiXact */ NULL /* PredicateLock */ }; const TwoPhaseCallback twophase_standby_recover_callbacks[TWOPHASE_RM_MAX_ID + 1] = { NULL, /* END ID */ - lock_twophase_standby_recover, /* Lock */ + lock_twophase_standby_recover, /* Lock */ NULL, /* pgstat */ NULL, /* MultiXact */ NULL /* PredicateLock */ diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index d94a1deeb1..cdd3eb8e3e 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -676,11 +676,11 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid) if (oldest_datname) ereport(WARNING, - (errmsg("database \"%s\" must be vacuumed within %u transactions", - oldest_datname, - xidWrapLimit - curXid), - errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n" - "You might also need to commit or roll back old prepared transactions."))); + (errmsg("database \"%s\" must be vacuumed within %u transactions", + oldest_datname, + xidWrapLimit - curXid), + errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n" + "You might also need to commit or roll back old prepared transactions."))); else ereport(WARNING, (errmsg("database with OID %u must be vacuumed within %u transactions", diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 481231d13a..f7eb077a7f 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -208,18 +208,18 @@ typedef struct TransactionStateData TBlockState blockState; /* high-level state */ int nestingLevel; /* transaction nesting depth */ int gucNestLevel; /* GUC context nesting depth */ - MemoryContext curTransactionContext; /* my xact-lifetime context */ + MemoryContext curTransactionContext; /* my xact-lifetime context */ ResourceOwner curTransactionOwner; /* my query resources */ TransactionId *childXids; /* subcommitted child XIDs, in XID order */ int nChildXids; /* # of subcommitted child XIDs */ int maxChildXids; /* allocated size of childXids[] */ Oid prevUser; /* previous CurrentUserId setting */ int prevSecContext; /* previous SecurityRestrictionContext */ - bool prevXactReadOnly; /* entry-time xact r/o state */ - bool startedInRecovery; /* did we start in recovery? */ + bool prevXactReadOnly; /* entry-time xact r/o state */ + bool startedInRecovery; /* did we start in recovery? */ bool didLogXid; /* has xid been included in WAL record? */ - int parallelModeLevel; /* Enter/ExitParallelMode counter */ - struct TransactionStateData *parent; /* back link to parent */ + int parallelModeLevel; /* Enter/ExitParallelMode counter */ + struct TransactionStateData *parent; /* back link to parent */ #ifdef XCP int waitedForXidsCount; /* count of xids we waited to finish */ TransactionId *waitedForXids; /* xids we waited to finish */ @@ -1782,7 +1782,7 @@ AtSubCommit_childXids(void) new_maxChildXids * sizeof(TransactionId)); else new_childXids = repalloc(s->parent->childXids, - new_maxChildXids * sizeof(TransactionId)); + new_maxChildXids * sizeof(TransactionId)); s->parent->childXids = new_childXids; s->parent->maxChildXids = new_maxChildXids; @@ -2910,7 +2910,7 @@ PrepareTransaction(void) if (XactHasExportedSnapshots()) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot PREPARE a transaction that has exported snapshots"))); + errmsg("cannot PREPARE a transaction that has exported snapshots"))); /* Prevent cancel/die interrupt while cleaning up */ HOLD_INTERRUPTS(); @@ -3396,8 +3396,7 @@ CleanupTransaction(void) * do abort cleanup processing */ AtCleanup_Portals(); /* now safe to release portal memory */ - AtEOXact_Snapshot(false, true); /* and release the transaction's - * snapshots */ + AtEOXact_Snapshot(false, true); /* and release the transaction's snapshots */ CurrentResourceOwner = NULL; /* and resource owner */ if (TopTransactionResourceOwner) @@ -4618,7 +4617,7 @@ DefineSavepoint(char *name) if (IsInParallelMode()) ereport(ERROR, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), - errmsg("cannot define savepoints during a parallel operation"))); + errmsg("cannot define savepoints during a parallel operation"))); switch (s->blockState) { @@ -4626,7 +4625,7 @@ DefineSavepoint(char *name) case TBLOCK_SUBINPROGRESS: /* Normal subtransaction start */ PushTransaction(); - s = CurrentTransactionState; /* changed by push */ + s = CurrentTransactionState; /* changed by push */ /* * Savepoint names, like the TransactionState block itself, live @@ -4685,7 +4684,7 @@ ReleaseSavepoint(List *options) if (IsInParallelMode()) ereport(ERROR, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), - errmsg("cannot release savepoints during a parallel operation"))); + errmsg("cannot release savepoints during a parallel operation"))); switch (s->blockState) { @@ -4798,7 +4797,7 @@ RollbackToSavepoint(List *options) if (IsInParallelMode()) ereport(ERROR, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), - errmsg("cannot rollback to savepoints during a parallel operation"))); + errmsg("cannot rollback to savepoints during a parallel operation"))); switch (s->blockState) { @@ -4927,7 +4926,7 @@ BeginInternalSubTransaction(char *name) if (IsInParallelMode()) ereport(ERROR, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), - errmsg("cannot start subtransactions during a parallel operation"))); + errmsg("cannot start subtransactions during a parallel operation"))); switch (s->blockState) { @@ -4938,7 +4937,7 @@ BeginInternalSubTransaction(char *name) case TBLOCK_SUBINPROGRESS: /* Normal subtransaction start */ PushTransaction(); - s = CurrentTransactionState; /* changed by push */ + s = CurrentTransactionState; /* changed by push */ /* * Savepoint names, like the TransactionState block itself, live @@ -4994,7 +4993,7 @@ ReleaseCurrentSubTransaction(void) if (IsInParallelMode()) ereport(ERROR, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), - errmsg("cannot commit subtransactions during a parallel operation"))); + errmsg("cannot commit subtransactions during a parallel operation"))); if (s->blockState != TBLOCK_SUBINPROGRESS) elog(ERROR, "ReleaseCurrentSubTransaction: unexpected state %s", @@ -6277,13 +6276,13 @@ xact_redo_commit(xl_xact_parsed_commit *parsed, * recovered. It's unlikely but it's good to be safe. */ TransactionIdAsyncCommitTree( - xid, parsed->nsubxacts, parsed->subxacts, lsn); + xid, parsed->nsubxacts, parsed->subxacts, lsn); /* * We must mark clog before we update the ProcArray. */ ExpireTreeKnownAssignedTransactionIds( - xid, parsed->nsubxacts, parsed->subxacts, max_xid); + xid, parsed->nsubxacts, parsed->subxacts, max_xid); /* * Send any cache invalidations attached to the commit. We must @@ -6292,7 +6291,7 @@ xact_redo_commit(xl_xact_parsed_commit *parsed, */ ProcessCommittedInvalidationMessages( parsed->msgs, parsed->nmsgs, - XactCompletionRelcacheInitFileInval(parsed->xinfo), + XactCompletionRelcacheInitFileInval(parsed->xinfo), parsed->dbId, parsed->tsId); /* @@ -6431,7 +6430,7 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, TransactionId xid) * We must update the ProcArray after we have marked clog. */ ExpireTreeKnownAssignedTransactionIds( - xid, parsed->nsubxacts, parsed->subxacts, max_xid); + xid, parsed->nsubxacts, parsed->subxacts, max_xid); /* * There are no flat files that need updating, nor invalidation diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index a07bb572ea..7d917dbe70 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -89,8 +89,8 @@ extern uint32 bootstrap_data_checksum_version; /* User-settable parameters */ -int max_wal_size_mb = 1024; /* 1 GB */ -int min_wal_size_mb = 80; /* 80 MB */ +int max_wal_size_mb = 1024; /* 1 GB */ +int min_wal_size_mb = 80; /* 80 MB */ int wal_keep_segments = 0; int XLOGbuffers = -1; int XLogArchiveTimeout = 0; @@ -586,8 +586,7 @@ typedef struct XLogCtlData XLogRecPtr asyncXactLSN; /* LSN of newest async commit/abort */ XLogRecPtr replicationSlotMinLSN; /* oldest LSN needed by any slot */ - XLogSegNo lastRemovedSegNo; /* latest removed/recycled XLOG - * segment */ + XLogSegNo lastRemovedSegNo; /* latest removed/recycled XLOG segment */ /* Fake LSN counter, for unlogged relations. Protected by ulsn_lck. */ XLogRecPtr unloggedLSN; @@ -788,7 +787,7 @@ static int readFile = -1; static XLogSegNo readSegNo = 0; static uint32 readOff = 0; static uint32 readLen = 0; -static XLogSource readSource = 0; /* XLOG_FROM_* code */ +static XLogSource readSource = 0; /* XLOG_FROM_* code */ /* * Keeps track of which source we're currently reading from. This is @@ -816,14 +815,14 @@ typedef struct XLogPageReadPrivate * XLogReceiptSource tracks where we last successfully read some WAL.) */ static TimestampTz XLogReceiptTime = 0; -static XLogSource XLogReceiptSource = 0; /* XLOG_FROM_* code */ +static XLogSource XLogReceiptSource = 0; /* XLOG_FROM_* code */ /* State information for XLOG reading */ static XLogRecPtr ReadRecPtr; /* start of last record read */ static XLogRecPtr EndRecPtr; /* end+1 of last record read */ -static XLogRecPtr minRecoveryPoint; /* local copy of - * ControlFile->minRecoveryPoint */ +static XLogRecPtr minRecoveryPoint; /* local copy of + * ControlFile->minRecoveryPoint */ static TimeLineID minRecoveryPointTLI; static bool updateMinRecoveryPoint = true; @@ -1437,7 +1436,7 @@ checkXLogConsistency(XLogReaderState *record) if (memcmp(replay_image_masked, master_image_masked, BLCKSZ) != 0) { elog(FATAL, - "inconsistent page found, rel %u/%u/%u, forknum %u, blkno %u", + "inconsistent page found, rel %u/%u/%u, forknum %u, blkno %u", rnode.spcNode, rnode.dbNode, rnode.relNode, forknum, blkno); } @@ -1682,7 +1681,7 @@ WALInsertLockUpdateInsertingAt(XLogRecPtr insertingAt) * WALInsertLockAcquireExclusive. */ LWLockUpdateVar(&WALInsertLocks[NUM_XLOGINSERT_LOCKS - 1].l.lock, - &WALInsertLocks[NUM_XLOGINSERT_LOCKS - 1].l.insertingAt, + &WALInsertLocks[NUM_XLOGINSERT_LOCKS - 1].l.insertingAt, insertingAt); } else @@ -2024,7 +2023,7 @@ XLogRecPtrToBytePos(XLogRecPtr ptr) { result = fullsegs * UsableBytesInSegment + (XLOG_BLCKSZ - SizeOfXLogLongPHD) + /* account for first page */ - (fullpages - 1) * UsableBytesInPage; /* full pages */ + (fullpages - 1) * UsableBytesInPage; /* full pages */ if (offset > 0) { Assert(offset >= SizeOfXLogShortPHD); @@ -2457,9 +2456,9 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) if (lseek(openLogFile, (off_t) startoffset, SEEK_SET) < 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not seek in log file %s to offset %u: %m", - XLogFileNameP(ThisTimeLineID, openLogSegNo), - startoffset))); + errmsg("could not seek in log file %s to offset %u: %m", + XLogFileNameP(ThisTimeLineID, openLogSegNo), + startoffset))); openLogOff = startoffset; } @@ -2481,7 +2480,7 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) (errcode_for_file_access(), errmsg("could not write to log file %s " "at offset %u, length %zu: %m", - XLogFileNameP(ThisTimeLineID, openLogSegNo), + XLogFileNameP(ThisTimeLineID, openLogSegNo), openLogOff, nbytes))); } nleft -= written; @@ -2512,7 +2511,7 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible) /* signal that we need to wakeup walsenders later */ WalSndWakeupRequest(); - LogwrtResult.Flush = LogwrtResult.Write; /* end of page */ + LogwrtResult.Flush = LogwrtResult.Write; /* end of page */ if (XLogArchivingActive()) XLogArchiveNotifySeg(openLogSegNo); @@ -2728,7 +2727,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force) if (!force && newMinRecoveryPoint < lsn) elog(WARNING, - "xlog min recovery request %X/%X is past current point %X/%X", + "xlog min recovery request %X/%X is past current point %X/%X", (uint32) (lsn >> 32), (uint32) lsn, (uint32) (newMinRecoveryPoint >> 32), (uint32) newMinRecoveryPoint); @@ -2743,10 +2742,10 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force) minRecoveryPointTLI = newMinRecoveryPointTLI; ereport(DEBUG2, - (errmsg("updated min recovery point to %X/%X on timeline %u", - (uint32) (minRecoveryPoint >> 32), - (uint32) minRecoveryPoint, - newMinRecoveryPointTLI))); + (errmsg("updated min recovery point to %X/%X on timeline %u", + (uint32) (minRecoveryPoint >> 32), + (uint32) minRecoveryPoint, + newMinRecoveryPointTLI))); } } LWLockRelease(ControlFileLock); @@ -2786,7 +2785,7 @@ XLogFlush(XLogRecPtr record) elog(LOG, "xlog flush request %X/%X; write %X/%X; flush %X/%X", (uint32) (record >> 32), (uint32) record, (uint32) (LogwrtResult.Write >> 32), (uint32) LogwrtResult.Write, - (uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush); + (uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush); #endif START_CRIT_SECTION(); @@ -2918,9 +2917,9 @@ XLogFlush(XLogRecPtr record) */ if (LogwrtResult.Flush < record) elog(ERROR, - "xlog flush request %X/%X is not satisfied --- flushed only to %X/%X", + "xlog flush request %X/%X is not satisfied --- flushed only to %X/%X", (uint32) (record >> 32), (uint32) record, - (uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush); + (uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush); } /* @@ -3037,7 +3036,7 @@ XLogBackgroundFlush(void) (uint32) (WriteRqst.Write >> 32), (uint32) WriteRqst.Write, (uint32) (WriteRqst.Flush >> 32), (uint32) WriteRqst.Flush, (uint32) (LogwrtResult.Write >> 32), (uint32) LogwrtResult.Write, - (uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush); + (uint32) (LogwrtResult.Flush >> 32), (uint32) LogwrtResult.Flush); #endif START_CRIT_SECTION(); @@ -3536,7 +3535,7 @@ XLogFileOpen(XLogSegNo segno) if (fd < 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not open write-ahead log file \"%s\": %m", path))); + errmsg("could not open write-ahead log file \"%s\": %m", path))); return fd; } @@ -3979,7 +3978,7 @@ RemoveXlogFile(const char *segname, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr) /* * Initialize info about where to try to recycle to. */ - XLByteToPrevSeg(endptr, endlogSegNo); + XLByteToSeg(endptr, endlogSegNo); if (PriorRedoPtr == InvalidXLogRecPtr) recycleSegNo = endlogSegNo + 10; else @@ -4030,8 +4029,8 @@ RemoveXlogFile(const char *segname, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr) { ereport(LOG, (errcode_for_file_access(), - errmsg("could not rename old write-ahead log file \"%s\": %m", - path))); + errmsg("could not rename old write-ahead log file \"%s\": %m", + path))); return; } rc = durable_unlink(newpath, LOG); @@ -4136,7 +4135,7 @@ CleanupBackupHistory(void) /* * Attempt to read an XLOG record. * - * If RecPtr is not NULL, try to read a record at that position. Otherwise + * If RecPtr is valid, try to read a record at that position. Otherwise * try to read a record just after the last one previously read. * * If no valid record is available, returns NULL, or fails if emode is PANIC. @@ -4185,7 +4184,7 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode, if (errormsg) ereport(emode_for_corrupt_record(emode, RecPtr ? RecPtr : EndRecPtr), - (errmsg_internal("%s", errormsg) /* already translated */ )); + (errmsg_internal("%s", errormsg) /* already translated */ )); } /* @@ -4202,10 +4201,10 @@ ReadRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, int emode, XLogFileName(fname, xlogreader->readPageTLI, segno); ereport(emode_for_corrupt_record(emode, RecPtr ? RecPtr : EndRecPtr), - (errmsg("unexpected timeline ID %u in log segment %s, offset %u", - xlogreader->latestPageTLI, - fname, - offset))); + (errmsg("unexpected timeline ID %u in log segment %s, offset %u", + xlogreader->latestPageTLI, + fname, + offset))); record = NULL; } @@ -4381,7 +4380,7 @@ static void WriteControlFile(void) { int fd; - char buffer[PG_CONTROL_SIZE]; /* need not be aligned */ + char buffer[PG_CONTROL_SIZE]; /* need not be aligned */ /* * Initialize version and compatibility-check fields @@ -4499,8 +4498,8 @@ ReadControlFile(void) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized with PG_CONTROL_VERSION %d (0x%08x)," - " but the server was compiled with PG_CONTROL_VERSION %d (0x%08x).", - ControlFile->pg_control_version, ControlFile->pg_control_version, + " but the server was compiled with PG_CONTROL_VERSION %d (0x%08x).", + ControlFile->pg_control_version, ControlFile->pg_control_version, PG_CONTROL_VERSION, PG_CONTROL_VERSION), errhint("This could be a problem of mismatched byte ordering. It looks like you need to initdb."))); @@ -4508,8 +4507,8 @@ ReadControlFile(void) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized with PG_CONTROL_VERSION %d," - " but the server was compiled with PG_CONTROL_VERSION %d.", - ControlFile->pg_control_version, PG_CONTROL_VERSION), + " but the server was compiled with PG_CONTROL_VERSION %d.", + ControlFile->pg_control_version, PG_CONTROL_VERSION), errhint("It looks like you need to initdb."))); /* Now check the CRC. */ @@ -4532,15 +4531,15 @@ ReadControlFile(void) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized with CATALOG_VERSION_NO %d," - " but the server was compiled with CATALOG_VERSION_NO %d.", - ControlFile->catalog_version_no, CATALOG_VERSION_NO), + " but the server was compiled with CATALOG_VERSION_NO %d.", + ControlFile->catalog_version_no, CATALOG_VERSION_NO), errhint("It looks like you need to initdb."))); if (ControlFile->maxAlign != MAXIMUM_ALIGNOF) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with MAXALIGN %d," - " but the server was compiled with MAXALIGN %d.", - ControlFile->maxAlign, MAXIMUM_ALIGNOF), + errdetail("The database cluster was initialized with MAXALIGN %d," + " but the server was compiled with MAXALIGN %d.", + ControlFile->maxAlign, MAXIMUM_ALIGNOF), errhint("It looks like you need to initdb."))); if (ControlFile->floatFormat != FLOATFORMAT_VALUE) ereport(FATAL, @@ -4550,58 +4549,58 @@ ReadControlFile(void) if (ControlFile->blcksz != BLCKSZ) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with BLCKSZ %d," - " but the server was compiled with BLCKSZ %d.", - ControlFile->blcksz, BLCKSZ), + errdetail("The database cluster was initialized with BLCKSZ %d," + " but the server was compiled with BLCKSZ %d.", + ControlFile->blcksz, BLCKSZ), errhint("It looks like you need to recompile or initdb."))); if (ControlFile->relseg_size != RELSEG_SIZE) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with RELSEG_SIZE %d," - " but the server was compiled with RELSEG_SIZE %d.", - ControlFile->relseg_size, RELSEG_SIZE), + errdetail("The database cluster was initialized with RELSEG_SIZE %d," + " but the server was compiled with RELSEG_SIZE %d.", + ControlFile->relseg_size, RELSEG_SIZE), errhint("It looks like you need to recompile or initdb."))); if (ControlFile->xlog_blcksz != XLOG_BLCKSZ) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with XLOG_BLCKSZ %d," - " but the server was compiled with XLOG_BLCKSZ %d.", - ControlFile->xlog_blcksz, XLOG_BLCKSZ), + errdetail("The database cluster was initialized with XLOG_BLCKSZ %d," + " but the server was compiled with XLOG_BLCKSZ %d.", + ControlFile->xlog_blcksz, XLOG_BLCKSZ), errhint("It looks like you need to recompile or initdb."))); if (ControlFile->xlog_seg_size != XLOG_SEG_SIZE) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized with XLOG_SEG_SIZE %d," - " but the server was compiled with XLOG_SEG_SIZE %d.", + " but the server was compiled with XLOG_SEG_SIZE %d.", ControlFile->xlog_seg_size, XLOG_SEG_SIZE), errhint("It looks like you need to recompile or initdb."))); if (ControlFile->nameDataLen != NAMEDATALEN) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with NAMEDATALEN %d," - " but the server was compiled with NAMEDATALEN %d.", - ControlFile->nameDataLen, NAMEDATALEN), + errdetail("The database cluster was initialized with NAMEDATALEN %d," + " but the server was compiled with NAMEDATALEN %d.", + ControlFile->nameDataLen, NAMEDATALEN), errhint("It looks like you need to recompile or initdb."))); if (ControlFile->indexMaxKeys != INDEX_MAX_KEYS) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized with INDEX_MAX_KEYS %d," - " but the server was compiled with INDEX_MAX_KEYS %d.", + " but the server was compiled with INDEX_MAX_KEYS %d.", ControlFile->indexMaxKeys, INDEX_MAX_KEYS), errhint("It looks like you need to recompile or initdb."))); if (ControlFile->toast_max_chunk_size != TOAST_MAX_CHUNK_SIZE) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized with TOAST_MAX_CHUNK_SIZE %d," - " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.", - ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE), + " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.", + ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE), errhint("It looks like you need to recompile or initdb."))); if (ControlFile->loblksize != LOBLKSIZE) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with LOBLKSIZE %d," - " but the server was compiled with LOBLKSIZE %d.", - ControlFile->loblksize, (int) LOBLKSIZE), + errdetail("The database cluster was initialized with LOBLKSIZE %d," + " but the server was compiled with LOBLKSIZE %d.", + ControlFile->loblksize, (int) LOBLKSIZE), errhint("It looks like you need to recompile or initdb."))); #ifdef USE_FLOAT4_BYVAL @@ -4609,14 +4608,14 @@ ReadControlFile(void) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized without USE_FLOAT4_BYVAL" - " but the server was compiled with USE_FLOAT4_BYVAL."), + " but the server was compiled with USE_FLOAT4_BYVAL."), errhint("It looks like you need to recompile or initdb."))); #else if (ControlFile->float4ByVal != false) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with USE_FLOAT4_BYVAL" - " but the server was compiled without USE_FLOAT4_BYVAL."), + errdetail("The database cluster was initialized with USE_FLOAT4_BYVAL" + " but the server was compiled without USE_FLOAT4_BYVAL."), errhint("It looks like you need to recompile or initdb."))); #endif @@ -4625,14 +4624,14 @@ ReadControlFile(void) ereport(FATAL, (errmsg("database files are incompatible with server"), errdetail("The database cluster was initialized without USE_FLOAT8_BYVAL" - " but the server was compiled with USE_FLOAT8_BYVAL."), + " but the server was compiled with USE_FLOAT8_BYVAL."), errhint("It looks like you need to recompile or initdb."))); #else if (ControlFile->float8ByVal != false) ereport(FATAL, (errmsg("database files are incompatible with server"), - errdetail("The database cluster was initialized with USE_FLOAT8_BYVAL" - " but the server was compiled without USE_FLOAT8_BYVAL."), + errdetail("The database cluster was initialized with USE_FLOAT8_BYVAL" + " but the server was compiled without USE_FLOAT8_BYVAL."), errhint("It looks like you need to recompile or initdb."))); #endif @@ -4897,7 +4896,7 @@ XLOGShmemInit(void) /* WAL insertion locks. Ensure they're aligned to the full padded size */ allocptr += sizeof(WALInsertLockPadded) - - ((uintptr_t) allocptr) %sizeof(WALInsertLockPadded); + ((uintptr_t) allocptr) % sizeof(WALInsertLockPadded); WALInsertLocks = XLogCtl->Insert.WALInsertLocks = (WALInsertLockPadded *) allocptr; allocptr += sizeof(WALInsertLockPadded) * NUM_XLOGINSERT_LOCKS; @@ -5077,7 +5076,7 @@ BootStrapXLOG(void) errno = ENOSPC; ereport(PANIC, (errcode_for_file_access(), - errmsg("could not write bootstrap write-ahead log file: %m"))); + errmsg("could not write bootstrap write-ahead log file: %m"))); } pgstat_report_wait_end(); @@ -5085,13 +5084,13 @@ BootStrapXLOG(void) if (pg_fsync(openLogFile) != 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not fsync bootstrap write-ahead log file: %m"))); + errmsg("could not fsync bootstrap write-ahead log file: %m"))); pgstat_report_wait_end(); if (close(openLogFile)) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not close bootstrap write-ahead log file: %m"))); + errmsg("could not close bootstrap write-ahead log file: %m"))); openLogFile = -1; @@ -5213,9 +5212,9 @@ readRecoveryCommandFile(void) else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid value for recovery parameter \"%s\": \"%s\"", - "recovery_target_action", - item->value), + errmsg("invalid value for recovery parameter \"%s\": \"%s\"", + "recovery_target_action", + item->value), errhint("Valid values are \"pause\", \"promote\", and \"shutdown\"."))); ereport(DEBUG2, @@ -5241,10 +5240,10 @@ readRecoveryCommandFile(void) } if (rtli) ereport(DEBUG2, - (errmsg_internal("recovery_target_timeline = %u", rtli))); + (errmsg_internal("recovery_target_timeline = %u", rtli))); else ereport(DEBUG2, - (errmsg_internal("recovery_target_timeline = latest"))); + (errmsg_internal("recovery_target_timeline = latest"))); } else if (strcmp(item->name, "recovery_target_xid") == 0) { @@ -5253,8 +5252,8 @@ readRecoveryCommandFile(void) if (errno == EINVAL || errno == ERANGE) ereport(FATAL, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("recovery_target_xid is not a valid number: \"%s\"", - item->value))); + errmsg("recovery_target_xid is not a valid number: \"%s\"", + item->value))); ereport(DEBUG2, (errmsg_internal("recovery_target_xid = %u", recoveryTargetXid))); @@ -5269,12 +5268,12 @@ readRecoveryCommandFile(void) */ recoveryTargetTime = DatumGetTimestampTz(DirectFunctionCall3(timestamptz_in, - CStringGetDatum(item->value), - ObjectIdGetDatum(InvalidOid), + CStringGetDatum(item->value), + ObjectIdGetDatum(InvalidOid), Int32GetDatum(-1))); ereport(DEBUG2, (errmsg_internal("recovery_target_time = '%s'", - timestamptz_to_str(recoveryTargetTime)))); + timestamptz_to_str(recoveryTargetTime)))); } #ifdef PGXC else if (strcmp(item->name, "recovery_target_barrier") == 0) @@ -5322,10 +5321,10 @@ readRecoveryCommandFile(void) else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid value for recovery parameter \"%s\": \"%s\"", - "recovery_target", - item->value), - errhint("The only allowed value is \"immediate\"."))); + errmsg("invalid value for recovery parameter \"%s\": \"%s\"", + "recovery_target", + item->value), + errhint("The only allowed value is \"immediate\"."))); ereport(DEBUG2, (errmsg_internal("recovery_target = '%s'", item->value))); @@ -5434,7 +5433,7 @@ readRecoveryCommandFile(void) if (StandbyModeRequested && !IsUnderPostmaster) ereport(FATAL, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("standby mode is not supported by single-user servers"))); + errmsg("standby mode is not supported by single-user servers"))); /* Enable fetching from archive recovery area */ ArchiveRecoveryRequested = true; @@ -5659,9 +5658,9 @@ recoveryStopsBefore(XLogReaderState *record) recoveryStopTime = 0; recoveryStopName[0] = '\0'; ereport(LOG, - (errmsg("recovery stopping before WAL location (LSN) \"%X/%X\"", - (uint32) (recoveryStopLSN >> 32), - (uint32) recoveryStopLSN))); + (errmsg("recovery stopping before WAL location (LSN) \"%X/%X\"", + (uint32) (recoveryStopLSN >> 32), + (uint32) recoveryStopLSN))); return true; } #ifdef PGXC @@ -5846,9 +5845,9 @@ recoveryStopsAfter(XLogReaderState *record) strlcpy(recoveryStopName, recordRestorePointData->rp_name, MAXFNAMELEN); ereport(LOG, - (errmsg("recovery stopping at restore point \"%s\", time %s", - recoveryStopName, - timestamptz_to_str(recoveryStopTime)))); + (errmsg("recovery stopping at restore point \"%s\", time %s", + recoveryStopName, + timestamptz_to_str(recoveryStopTime)))); return true; } } @@ -5864,9 +5863,9 @@ recoveryStopsAfter(XLogReaderState *record) recoveryStopTime = 0; recoveryStopName[0] = '\0'; ereport(LOG, - (errmsg("recovery stopping after WAL location (LSN) \"%X/%X\"", - (uint32) (recoveryStopLSN >> 32), - (uint32) recoveryStopLSN))); + (errmsg("recovery stopping after WAL location (LSN) \"%X/%X\"", + (uint32) (recoveryStopLSN >> 32), + (uint32) recoveryStopLSN))); return true; } @@ -6304,20 +6303,20 @@ StartupXLOG(void) str_time(ControlFile->time)))); else if (ControlFile->state == DB_IN_CRASH_RECOVERY) ereport(LOG, - (errmsg("database system was interrupted while in recovery at %s", - str_time(ControlFile->time)), - errhint("This probably means that some data is corrupted and" - " you will have to use the last backup for recovery."))); + (errmsg("database system was interrupted while in recovery at %s", + str_time(ControlFile->time)), + errhint("This probably means that some data is corrupted and" + " you will have to use the last backup for recovery."))); else if (ControlFile->state == DB_IN_ARCHIVE_RECOVERY) ereport(LOG, (errmsg("database system was interrupted while in recovery at log time %s", str_time(ControlFile->checkPointCopy.time)), errhint("If this has occurred more than once some data might be corrupted" - " and you might need to choose an earlier recovery target."))); + " and you might need to choose an earlier recovery target."))); else if (ControlFile->state == DB_IN_PRODUCTION) ereport(LOG, - (errmsg("database system was interrupted; last known up at %s", - str_time(ControlFile->time)))); + (errmsg("database system was interrupted; last known up at %s", + str_time(ControlFile->time)))); /* This is just to allow attaching to startup process with a debugger */ #ifdef XLOG_REPLAY_DELAY @@ -6418,7 +6417,7 @@ StartupXLOG(void) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of memory"), - errdetail("Failed while allocating a WAL reading processor."))); + errdetail("Failed while allocating a WAL reading processor."))); xlogreader->system_identifier = ControlFile->system_identifier; /* @@ -6453,7 +6452,7 @@ StartupXLOG(void) wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN); ereport(DEBUG1, (errmsg("checkpoint record is at %X/%X", - (uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); + (uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); InRecovery = true; /* force recovery even if SHUTDOWNED */ /* @@ -6499,8 +6498,8 @@ StartupXLOG(void) if (symlink(ti->path, linkloc) < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not create symbolic link \"%s\": %m", - linkloc))); + errmsg("could not create symbolic link \"%s\": %m", + linkloc))); pfree(ti->oid); pfree(ti->path); @@ -6531,16 +6530,16 @@ StartupXLOG(void) unlink(TABLESPACE_MAP_OLD); if (durable_rename(TABLESPACE_MAP, TABLESPACE_MAP_OLD, DEBUG1) == 0) ereport(LOG, - (errmsg("ignoring file \"%s\" because no file \"%s\" exists", - TABLESPACE_MAP, BACKUP_LABEL_FILE), - errdetail("File \"%s\" was renamed to \"%s\".", - TABLESPACE_MAP, TABLESPACE_MAP_OLD))); + (errmsg("ignoring file \"%s\" because no file \"%s\" exists", + TABLESPACE_MAP, BACKUP_LABEL_FILE), + errdetail("File \"%s\" was renamed to \"%s\".", + TABLESPACE_MAP, TABLESPACE_MAP_OLD))); else ereport(LOG, - (errmsg("ignoring file \"%s\" because no file \"%s\" exists", - TABLESPACE_MAP, BACKUP_LABEL_FILE), - errdetail("Could not rename file \"%s\" to \"%s\": %m.", - TABLESPACE_MAP, TABLESPACE_MAP_OLD))); + (errmsg("ignoring file \"%s\" because no file \"%s\" exists", + TABLESPACE_MAP, BACKUP_LABEL_FILE), + errdetail("Could not rename file \"%s\" to \"%s\": %m.", + TABLESPACE_MAP, TABLESPACE_MAP_OLD))); } /* @@ -6581,7 +6580,7 @@ StartupXLOG(void) { ereport(DEBUG1, (errmsg("checkpoint record is at %X/%X", - (uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); + (uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); } else if (StandbyMode) { @@ -6600,12 +6599,12 @@ StartupXLOG(void) { ereport(LOG, (errmsg("using previous checkpoint record at %X/%X", - (uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); - InRecovery = true; /* force recovery even if SHUTDOWNED */ + (uint32) (checkPointLoc >> 32), (uint32) checkPointLoc))); + InRecovery = true; /* force recovery even if SHUTDOWNED */ } else ereport(PANIC, - (errmsg("could not locate a valid checkpoint record"))); + (errmsg("could not locate a valid checkpoint record"))); } memcpy(&checkPoint, XLogRecGetData(xlogreader), sizeof(CheckPoint)); wasShutdown = ((record->xl_info & ~XLR_INFO_MASK) == XLOG_CHECKPOINT_SHUTDOWN); @@ -6658,7 +6657,7 @@ StartupXLOG(void) * history, too. */ if (!XLogRecPtrIsInvalid(ControlFile->minRecoveryPoint) && - tliOfPointInHistory(ControlFile->minRecoveryPoint - 1, expectedTLEs) != + tliOfPointInHistory(ControlFile->minRecoveryPoint - 1, expectedTLEs) != ControlFile->minRecoveryPointTLI) ereport(FATAL, (errmsg("requested timeline %u does not contain minimum recovery point %X/%X on timeline %u", @@ -6671,7 +6670,7 @@ StartupXLOG(void) ereport(DEBUG1, (errmsg_internal("redo record is at %X/%X; shutdown %s", - (uint32) (checkPoint.redo >> 32), (uint32) checkPoint.redo, + (uint32) (checkPoint.redo >> 32), (uint32) checkPoint.redo, wasShutdown ? "TRUE" : "FALSE"))); ereport(DEBUG1, (errmsg_internal("next transaction ID: %u:%u; next OID: %u", @@ -6679,13 +6678,13 @@ StartupXLOG(void) checkPoint.nextOid))); ereport(DEBUG1, (errmsg_internal("next MultiXactId: %u; next MultiXactOffset: %u", - checkPoint.nextMulti, checkPoint.nextMultiOffset))); + checkPoint.nextMulti, checkPoint.nextMultiOffset))); ereport(DEBUG1, - (errmsg_internal("oldest unfrozen transaction ID: %u, in database %u", - checkPoint.oldestXid, checkPoint.oldestXidDB))); + (errmsg_internal("oldest unfrozen transaction ID: %u, in database %u", + checkPoint.oldestXid, checkPoint.oldestXidDB))); ereport(DEBUG1, (errmsg_internal("oldest MultiXactId: %u, in database %u", - checkPoint.oldestMulti, checkPoint.oldestMultiDB))); + checkPoint.oldestMulti, checkPoint.oldestMultiDB))); ereport(DEBUG1, (errmsg_internal("commit timestamp Xid oldest/newest: %u/%u", checkPoint.oldestCommitTsXid, @@ -6875,7 +6874,7 @@ StartupXLOG(void) ereport(FATAL, (errmsg("backup_label contains data inconsistent with control file"), errhint("This means that the backup is corrupted and you will " - "have to use another backup for recovery."))); + "have to use another backup for recovery."))); ControlFile->backupEndPoint = ControlFile->minRecoveryPoint; } } @@ -7081,7 +7080,7 @@ StartupXLOG(void) ereport(LOG, (errmsg("redo starts at %X/%X", - (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr))); + (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr))); /* * main redo apply loop @@ -7092,15 +7091,15 @@ StartupXLOG(void) #ifdef WAL_DEBUG if (XLOG_DEBUG || - (rmid == RM_XACT_ID && trace_recovery_messages <= DEBUG2) || + (rmid == RM_XACT_ID && trace_recovery_messages <= DEBUG2) || (rmid != RM_XACT_ID && trace_recovery_messages <= DEBUG3)) { StringInfoData buf; initStringInfo(&buf); appendStringInfo(&buf, "REDO @ %X/%X; LSN %X/%X: ", - (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr, - (uint32) (EndRecPtr >> 32), (uint32) EndRecPtr); + (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr, + (uint32) (EndRecPtr >> 32), (uint32) EndRecPtr); xlog_outrec(&buf, xlogreader); appendStringInfoString(&buf, " - "); xlog_outdesc(&buf, xlogreader); @@ -7353,12 +7352,12 @@ StartupXLOG(void) ereport(LOG, (errmsg("redo done at %X/%X", - (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr))); + (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr))); xtime = GetLatestXTime(); if (xtime) ereport(LOG, - (errmsg("last completed transaction was at log time %s", - timestamptz_to_str(xtime)))); + (errmsg("last completed transaction was at log time %s", + timestamptz_to_str(xtime)))); InRedo = false; } @@ -7449,7 +7448,7 @@ StartupXLOG(void) errhint("Online backup started with pg_start_backup() must be ended with pg_stop_backup(), and all WAL up to that point must be available at recovery."))); else ereport(FATAL, - (errmsg("WAL ends before consistent recovery point"))); + (errmsg("WAL ends before consistent recovery point"))); } } @@ -8104,7 +8103,7 @@ ReadCheckpointRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, { case 1: ereport(LOG, - (errmsg("invalid primary checkpoint link in control file"))); + (errmsg("invalid primary checkpoint link in control file"))); break; case 2: ereport(LOG, @@ -8112,7 +8111,7 @@ ReadCheckpointRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, break; default: ereport(LOG, - (errmsg("invalid checkpoint link in backup_label file"))); + (errmsg("invalid checkpoint link in backup_label file"))); break; } return NULL; @@ -8156,7 +8155,7 @@ ReadCheckpointRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, break; default: ereport(LOG, - (errmsg("invalid resource manager ID in checkpoint record"))); + (errmsg("invalid resource manager ID in checkpoint record"))); break; } return NULL; @@ -8169,11 +8168,11 @@ ReadCheckpointRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, { case 1: ereport(LOG, - (errmsg("invalid xl_info in primary checkpoint record"))); + (errmsg("invalid xl_info in primary checkpoint record"))); break; case 2: ereport(LOG, - (errmsg("invalid xl_info in secondary checkpoint record"))); + (errmsg("invalid xl_info in secondary checkpoint record"))); break; default: ereport(LOG, @@ -8188,11 +8187,11 @@ ReadCheckpointRecord(XLogReaderState *xlogreader, XLogRecPtr RecPtr, { case 1: ereport(LOG, - (errmsg("invalid length of primary checkpoint record"))); + (errmsg("invalid length of primary checkpoint record"))); break; case 2: ereport(LOG, - (errmsg("invalid length of secondary checkpoint record"))); + (errmsg("invalid length of secondary checkpoint record"))); break; default: ereport(LOG, @@ -8503,14 +8502,14 @@ LogCheckpointEnd(bool restartpoint) */ longest_secs = (long) (CheckpointStats.ckpt_longest_sync / 1000000); longest_usecs = CheckpointStats.ckpt_longest_sync - - (uint64) longest_secs *1000000; + (uint64) longest_secs * 1000000; average_sync_time = 0; if (CheckpointStats.ckpt_sync_rels > 0) average_sync_time = CheckpointStats.ckpt_agg_sync_time / CheckpointStats.ckpt_sync_rels; average_secs = (long) (average_sync_time / 1000000); - average_usecs = average_sync_time - (uint64) average_secs *1000000; + average_usecs = average_sync_time - (uint64) average_secs * 1000000; elog(LOG, "%s complete: wrote %d buffers (%.1f%%); " "%d WAL file(s) added, %d removed, %d recycled; " @@ -8912,7 +8911,7 @@ CreateCheckPoint(int flags) if (shutdown) { if (flags & CHECKPOINT_END_OF_RECOVERY) - LocalXLogInsertAllowed = -1; /* return to "check" state */ + LocalXLogInsertAllowed = -1; /* return to "check" state */ else LocalXLogInsertAllowed = 0; /* never again write WAL */ } @@ -9177,7 +9176,7 @@ CreateRestartPoint(int flags) if (!RecoveryInProgress()) { ereport(DEBUG2, - (errmsg("skipping restartpoint, recovery has already ended"))); + (errmsg("skipping restartpoint, recovery has already ended"))); LWLockRelease(CheckpointLock); return false; } @@ -9377,9 +9376,9 @@ CreateRestartPoint(int flags) xtime = GetLatestXTime(); ereport((log_checkpoints ? LOG : DEBUG2), (errmsg("recovery restart point at %X/%X", - (uint32) (lastCheckPoint.redo >> 32), (uint32) lastCheckPoint.redo), - xtime ? errdetail("last completed transaction was at log time %s", - timestamptz_to_str(xtime)) : 0)); + (uint32) (lastCheckPoint.redo >> 32), (uint32) lastCheckPoint.redo), + xtime ? errdetail("last completed transaction was at log time %s", + timestamptz_to_str(xtime)) : 0)); LWLockRelease(CheckpointLock); @@ -9651,8 +9650,8 @@ checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI, TimeLineID prevTLI) */ if (newTLI < ThisTimeLineID || !tliInHistory(newTLI, expectedTLEs)) ereport(PANIC, - (errmsg("unexpected timeline ID %u (after %u) in checkpoint record", - newTLI, ThisTimeLineID))); + (errmsg("unexpected timeline ID %u (after %u) in checkpoint record", + newTLI, ThisTimeLineID))); /* * If we have not yet reached min recovery point, and we're about to @@ -9743,7 +9742,7 @@ xlog_redo(XLogReaderState *record) !XLogRecPtrIsInvalid(ControlFile->backupStartPoint) && XLogRecPtrIsInvalid(ControlFile->backupEndPoint)) ereport(PANIC, - (errmsg("online backup was canceled, recovery cannot continue"))); + (errmsg("online backup was canceled, recovery cannot continue"))); /* * If we see a shutdown checkpoint, we know that nothing was running @@ -10042,7 +10041,7 @@ xlog_outrec(StringInfo buf, XLogReaderState *record) appendStringInfoString(buf, " FPW"); } } -#endif /* WAL_DEBUG */ +#endif /* WAL_DEBUG */ /* * Returns a string describing an XLogRecord, consisting of its identity @@ -10146,7 +10145,7 @@ assign_xlog_sync_method(int new_sync_method, void *extra) ereport(PANIC, (errcode_for_file_access(), errmsg("could not fsync log segment %s: %m", - XLogFileNameP(ThisTimeLineID, openLogSegNo)))); + XLogFileNameP(ThisTimeLineID, openLogSegNo)))); pgstat_report_wait_end(); if (get_sync_bit(sync_method) != get_sync_bit(new_sync_method)) XLogFileClose(); @@ -10178,8 +10177,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno) if (pg_fsync_writethrough(fd) != 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not fsync write-through log file %s: %m", - XLogFileNameP(ThisTimeLineID, segno)))); + errmsg("could not fsync write-through log file %s: %m", + XLogFileNameP(ThisTimeLineID, segno)))); break; #endif #ifdef HAVE_FDATASYNC @@ -10287,7 +10286,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p, if (!backup_started_in_recovery && !XLogIsNeeded()) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("WAL level not sufficient for making an online backup"), + errmsg("WAL level not sufficient for making an online backup"), errhint("wal_level must be set to \"replica\" or \"logical\" at server start."))); if (strlen(backupidstr) > MAXPGPATH) @@ -10425,13 +10424,13 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p, if (!checkpointfpw || startpoint <= recptr) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("WAL generated with full_page_writes=off was replayed " - "since last restartpoint"), - errhint("This means that the backup being taken on the standby " - "is corrupt and should not be used. " - "Enable full_page_writes and run CHECKPOINT on the master, " - "and then try an online backup again."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("WAL generated with full_page_writes=off was replayed " + "since last restartpoint"), + errhint("This means that the backup being taken on the standby " + "is corrupt and should not be used. " + "Enable full_page_writes and run CHECKPOINT on the master, " + "and then try an online backup again."))); /* * During recovery, since we don't use the end-of-backup WAL @@ -10555,7 +10554,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p, */ ereport(WARNING, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("tablespaces are not supported on this platform"))); + errmsg("tablespaces are not supported on this platform"))); #endif } @@ -10571,9 +10570,9 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p, "%Y-%m-%d %H:%M:%S %Z", pg_localtime(&stamp_time, log_timezone)); appendStringInfo(labelfile, "START WAL LOCATION: %X/%X (file %s)\n", - (uint32) (startpoint >> 32), (uint32) startpoint, xlogfilename); + (uint32) (startpoint >> 32), (uint32) startpoint, xlogfilename); appendStringInfo(labelfile, "CHECKPOINT LOCATION: %X/%X\n", - (uint32) (checkpointloc >> 32), (uint32) checkpointloc); + (uint32) (checkpointloc >> 32), (uint32) checkpointloc); appendStringInfo(labelfile, "BACKUP METHOD: %s\n", exclusive ? "pg_start_backup" : "streamed"); appendStringInfo(labelfile, "BACKUP FROM: %s\n", @@ -10640,10 +10639,10 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p, } else ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("a backup is already in progress"), - errhint("If you're sure there is no backup in progress, remove file \"%s\" and try again.", - TABLESPACE_MAP))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("a backup is already in progress"), + errhint("If you're sure there is no backup in progress, remove file \"%s\" and try again.", + TABLESPACE_MAP))); fp = AllocateFile(TABLESPACE_MAP, "w"); @@ -10805,7 +10804,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p) if (!backup_started_in_recovery && !XLogIsNeeded()) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("WAL level not sufficient for making an online backup"), + errmsg("WAL level not sufficient for making an online backup"), errhint("wal_level must be set to \"replica\" or \"logical\" at server start."))); if (exclusive) @@ -10984,12 +10983,12 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p) if (startpoint <= recptr) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("WAL generated with full_page_writes=off was replayed " - "during online backup"), - errhint("This means that the backup being taken on the standby " - "is corrupt and should not be used. " - "Enable full_page_writes and run CHECKPOINT on the master, " - "and then try an online backup again."))); + errmsg("WAL generated with full_page_writes=off was replayed " + "during online backup"), + errhint("This means that the backup being taken on the standby " + "is corrupt and should not be used. " + "Enable full_page_writes and run CHECKPOINT on the master, " + "and then try an online backup again."))); LWLockAcquire(ControlFileLock, LW_SHARED); @@ -11038,7 +11037,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p) errmsg("could not create file \"%s\": %m", histfilepath))); fprintf(fp, "START WAL LOCATION: %X/%X (file %s)\n", - (uint32) (startpoint >> 32), (uint32) startpoint, startxlogfilename); + (uint32) (startpoint >> 32), (uint32) startpoint, startxlogfilename); fprintf(fp, "STOP WAL LOCATION: %X/%X (file %s)\n", (uint32) (stoppoint >> 32), (uint32) stoppoint, stopxlogfilename); /* transfer remaining lines from label to history file */ @@ -11365,7 +11364,7 @@ read_tablespace_map(List **tablespaces) if (sscanf(str, "%s %n", tbsoid, &n) != 1) ereport(FATAL, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("invalid data in file \"%s\"", TABLESPACE_MAP))); + errmsg("invalid data in file \"%s\"", TABLESPACE_MAP))); tbslinkpath = str + n; i = 0; @@ -11525,7 +11524,7 @@ XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen, (XLogPageReadPrivate *) xlogreader->private_data; int emode = private->emode; uint32 targetPageOff; - XLogSegNo targetSegNo PG_USED_FOR_ASSERTS_ONLY; + XLogSegNo targetSegNo PG_USED_FOR_ASSERTS_ONLY; XLByteToSeg(targetPagePtr, targetSegNo); targetPageOff = targetPagePtr % XLogSegSize; @@ -11838,7 +11837,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, */ now = GetCurrentTimestamp(); if (!TimestampDifferenceExceeds(last_fail_time, now, - wal_retrieve_retry_interval)) + wal_retrieve_retry_interval)) { long secs, wait_time; @@ -11849,7 +11848,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, (secs * 1000 + usecs / 1000); WaitLatch(&XLogCtl->recoveryWakeupLatch, - WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, + WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, wait_time, WAIT_EVENT_RECOVERY_WAL_STREAM); ResetLatch(&XLogCtl->recoveryWakeupLatch); now = GetCurrentTimestamp(); @@ -11903,7 +11902,7 @@ WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, * file from pg_wal. */ readFile = XLogFileReadAnyTLI(readSegNo, DEBUG2, - currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY : + currentSource == XLOG_FROM_ARCHIVE ? XLOG_FROM_ANY : currentSource); if (readFile >= 0) return true; /* success! */ diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index fb905c0a1c..f9b49ba498 100644 --- a/src/backend/access/transam/xlogfuncs.c +++ b/src/backend/access/transam/xlogfuncs.c @@ -110,7 +110,7 @@ pg_start_backup(PG_FUNCTION_ARGS) MemoryContextSwitchTo(oldcontext); startpoint = do_pg_start_backup(backupidstr, fast, NULL, label_file, - dir, NULL, tblspc_map_file, false, true); + dir, NULL, tblspc_map_file, false, true); before_shmem_exit(nonexclusive_base_backup_cleanup, (Datum) 0); } @@ -175,7 +175,7 @@ pg_stop_backup(PG_FUNCTION_ARGS) * The first parameter (variable 'exclusive') allows the user to tell us if * this is an exclusive or a non-exclusive backup. * - * The second paramter (variable 'waitforarchive'), which is optional, + * The second parameter (variable 'waitforarchive'), which is optional, * allows the user to choose if they want to wait for the WAL to be archived * or if we should just return as soon as the WAL record is written. * @@ -326,7 +326,7 @@ pg_create_restore_point(PG_FUNCTION_ARGS) if (!XLogIsNeeded()) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("WAL level not sufficient for creating a restore point"), + errmsg("WAL level not sufficient for creating a restore point"), errhint("wal_level must be set to \"replica\" or \"logical\" at server start."))); restore_name_str = text_to_cstring(restore_name); @@ -528,7 +528,7 @@ pg_walfile_name(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("recovery is in progress"), - errhint("pg_walfile_name() cannot be executed during recovery."))); + errhint("pg_walfile_name() cannot be executed during recovery."))); XLByteToPrevSeg(locationpoint, xlogsegno); XLogFileName(xlogfilename, ThisTimeLineID, xlogsegno); @@ -684,13 +684,13 @@ pg_backup_start_time(PG_FUNCTION_ARGS) if (ferror(lfp)) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not read file \"%s\": %m", BACKUP_LABEL_FILE))); + errmsg("could not read file \"%s\": %m", BACKUP_LABEL_FILE))); /* Close the backup label file. */ if (FreeFile(lfp)) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not close file \"%s\": %m", BACKUP_LABEL_FILE))); + errmsg("could not close file \"%s\": %m", BACKUP_LABEL_FILE))); if (strlen(backup_start_time) == 0) ereport(ERROR, diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c index 6a02738479..3af03ecdb1 100644 --- a/src/backend/access/transam/xloginsert.c +++ b/src/backend/access/transam/xloginsert.c @@ -61,9 +61,9 @@ typedef struct } registered_buffer; static registered_buffer *registered_buffers; -static int max_registered_buffers; /* allocated size */ -static int max_registered_block_id = 0; /* highest block_id + 1 - * currently registered */ +static int max_registered_buffers; /* allocated size */ +static int max_registered_block_id = 0; /* highest block_id + 1 currently + * registered */ /* * A chain of XLogRecDatas to hold the "main data" of a WAL record, registered @@ -175,7 +175,7 @@ XLogEnsureRecordSpace(int max_block_id, int ndatas) * they are included in WAL data, but initialize it all for tidiness. */ MemSet(®istered_buffers[max_registered_buffers], 0, - (nbuffers - max_registered_buffers) * sizeof(registered_buffer)); + (nbuffers - max_registered_buffers) * sizeof(registered_buffer)); max_registered_buffers = nbuffers; } @@ -438,7 +438,7 @@ XLogInsert(RmgrId rmid, uint8 info) if (IsBootstrapProcessingMode() && rmid != RM_XLOG_ID) { XLogResetInsertion(); - EndPos = SizeOfXLogLongPHD; /* start of 1st chkpt record */ + EndPos = SizeOfXLogLongPHD; /* start of 1st chkpt record */ return EndPos; } @@ -1039,7 +1039,7 @@ InitXLogInsert(void) { registered_buffers = (registered_buffer *) MemoryContextAllocZero(xloginsert_cxt, - sizeof(registered_buffer) * (XLR_NORMAL_MAX_BLOCK_ID + 1)); + sizeof(registered_buffer) * (XLR_NORMAL_MAX_BLOCK_ID + 1)); max_registered_buffers = XLR_NORMAL_MAX_BLOCK_ID + 1; } if (rdatas == NULL) diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c index c3b1371764..0781a7b9de 100644 --- a/src/backend/access/transam/xlogreader.c +++ b/src/backend/access/transam/xlogreader.c @@ -30,7 +30,7 @@ static bool allocate_recordbuf(XLogReaderState *state, uint32 reclength); static bool ValidXLogPageHeader(XLogReaderState *state, XLogRecPtr recptr, XLogPageHeader hdr); static bool ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr, - XLogRecPtr PrevRecPtr, XLogRecord *record, bool randAccess); + XLogRecPtr PrevRecPtr, XLogRecord *record, bool randAccess); static bool ValidXLogRecord(XLogReaderState *state, XLogRecord *record, XLogRecPtr recptr); static int ReadPageInternal(XLogReaderState *state, XLogRecPtr pageptr, @@ -254,7 +254,7 @@ XLogReadRecord(XLogReaderState *state, XLogRecPtr RecPtr, char **errormsg) */ readOff = ReadPageInternal(state, targetPagePtr, - Min(targetRecOff + SizeOfXLogRecord, XLOG_BLCKSZ)); + Min(targetRecOff + SizeOfXLogRecord, XLOG_BLCKSZ)); if (readOff < 0) goto err; @@ -322,7 +322,7 @@ XLogReadRecord(XLogReaderState *state, XLogRecPtr RecPtr, char **errormsg) if (total_len < SizeOfXLogRecord) { report_invalid_record(state, - "invalid record length at %X/%X: wanted %u, got %u", + "invalid record length at %X/%X: wanted %u, got %u", (uint32) (RecPtr >> 32), (uint32) RecPtr, (uint32) SizeOfXLogRecord, total_len); goto err; @@ -365,8 +365,8 @@ XLogReadRecord(XLogReaderState *state, XLogRecPtr RecPtr, char **errormsg) /* Wait for the next page to become available */ readOff = ReadPageInternal(state, targetPagePtr, - Min(total_len - gotlen + SizeOfXLogShortPHD, - XLOG_BLCKSZ)); + Min(total_len - gotlen + SizeOfXLogShortPHD, + XLOG_BLCKSZ)); if (readOff < 0) goto err; @@ -379,7 +379,7 @@ XLogReadRecord(XLogReaderState *state, XLogRecPtr RecPtr, char **errormsg) { report_invalid_record(state, "there is no contrecord flag at %X/%X", - (uint32) (RecPtr >> 32), (uint32) RecPtr); + (uint32) (RecPtr >> 32), (uint32) RecPtr); goto err; } @@ -393,7 +393,7 @@ XLogReadRecord(XLogReaderState *state, XLogRecPtr RecPtr, char **errormsg) report_invalid_record(state, "invalid contrecord length %u at %X/%X", pageHeader->xlp_rem_len, - (uint32) (RecPtr >> 32), (uint32) RecPtr); + (uint32) (RecPtr >> 32), (uint32) RecPtr); goto err; } @@ -445,7 +445,7 @@ XLogReadRecord(XLogReaderState *state, XLogRecPtr RecPtr, char **errormsg) { /* Wait for the record data to become available */ readOff = ReadPageInternal(state, targetPagePtr, - Min(targetRecOff + total_len, XLOG_BLCKSZ)); + Min(targetRecOff + total_len, XLOG_BLCKSZ)); if (readOff < 0) goto err; @@ -622,7 +622,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr, if (record->xl_tot_len < SizeOfXLogRecord) { report_invalid_record(state, - "invalid record length at %X/%X: wanted %u, got %u", + "invalid record length at %X/%X: wanted %u, got %u", (uint32) (RecPtr >> 32), (uint32) RecPtr, (uint32) SizeOfXLogRecord, record->xl_tot_len); return false; @@ -644,7 +644,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr, if (!(record->xl_prev < RecPtr)) { report_invalid_record(state, - "record with incorrect prev-link %X/%X at %X/%X", + "record with incorrect prev-link %X/%X at %X/%X", (uint32) (record->xl_prev >> 32), (uint32) record->xl_prev, (uint32) (RecPtr >> 32), (uint32) RecPtr); @@ -661,7 +661,7 @@ ValidXLogRecordHeader(XLogReaderState *state, XLogRecPtr RecPtr, if (record->xl_prev != PrevRecPtr) { report_invalid_record(state, - "record with incorrect prev-link %X/%X at %X/%X", + "record with incorrect prev-link %X/%X at %X/%X", (uint32) (record->xl_prev >> 32), (uint32) record->xl_prev, (uint32) (RecPtr >> 32), (uint32) RecPtr); @@ -698,7 +698,7 @@ ValidXLogRecord(XLogReaderState *state, XLogRecord *record, XLogRecPtr recptr) if (!EQ_CRC32C(record->xl_crc, crc)) { report_invalid_record(state, - "incorrect resource manager data checksum in record at %X/%X", + "incorrect resource manager data checksum in record at %X/%X", (uint32) (recptr >> 32), (uint32) recptr); return false; } @@ -731,7 +731,7 @@ ValidXLogPageHeader(XLogReaderState *state, XLogRecPtr recptr, XLogFileName(fname, state->readPageTLI, segno); report_invalid_record(state, - "invalid magic number %04X in log segment %s, offset %u", + "invalid magic number %04X in log segment %s, offset %u", hdr->xlp_magic, fname, offset); @@ -745,7 +745,7 @@ ValidXLogPageHeader(XLogReaderState *state, XLogRecPtr recptr, XLogFileName(fname, state->readPageTLI, segno); report_invalid_record(state, - "invalid info bits %04X in log segment %s, offset %u", + "invalid info bits %04X in log segment %s, offset %u", hdr->xlp_info, fname, offset); @@ -796,7 +796,7 @@ ValidXLogPageHeader(XLogReaderState *state, XLogRecPtr recptr, /* hmm, first page of file doesn't have a long header? */ report_invalid_record(state, - "invalid info bits %04X in log segment %s, offset %u", + "invalid info bits %04X in log segment %s, offset %u", hdr->xlp_info, fname, offset); @@ -810,8 +810,8 @@ ValidXLogPageHeader(XLogReaderState *state, XLogRecPtr recptr, XLogFileName(fname, state->readPageTLI, segno); report_invalid_record(state, - "unexpected pageaddr %X/%X in log segment %s, offset %u", - (uint32) (hdr->xlp_pageaddr >> 32), (uint32) hdr->xlp_pageaddr, + "unexpected pageaddr %X/%X in log segment %s, offset %u", + (uint32) (hdr->xlp_pageaddr >> 32), (uint32) hdr->xlp_pageaddr, fname, offset); return false; @@ -974,7 +974,7 @@ out: return found; } -#endif /* FRONTEND */ +#endif /* FRONTEND */ /* ---------------------------------------- @@ -1103,14 +1103,14 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg) if (blk->has_data && blk->data_len == 0) { report_invalid_record(state, - "BKPBLOCK_HAS_DATA set, but no data included at %X/%X", + "BKPBLOCK_HAS_DATA set, but no data included at %X/%X", (uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); goto err; } if (!blk->has_data && blk->data_len != 0) { report_invalid_record(state, - "BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%X", + "BKPBLOCK_HAS_DATA not set, but data length is %u at %X/%X", (unsigned int) blk->data_len, (uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); goto err; @@ -1208,7 +1208,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg) if (rnode == NULL) { report_invalid_record(state, - "BKPBLOCK_SAME_REL set but no previous rel at %X/%X", + "BKPBLOCK_SAME_REL set but no previous rel at %X/%X", (uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); goto err; } @@ -1289,7 +1289,7 @@ DecodeXLogRecord(XLogReaderState *state, XLogRecord *record, char **errormsg) shortdata_err: report_invalid_record(state, "record with invalid length at %X/%X", - (uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); + (uint32) (state->ReadRecPtr >> 32), (uint32) state->ReadRecPtr); err: *errormsg = state->errormsg_buf; @@ -1305,7 +1305,7 @@ err: */ bool XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id, - RelFileNode *rnode, ForkNumber *forknum, BlockNumber *blknum) + RelFileNode *rnode, ForkNumber *forknum, BlockNumber *blknum) { DecodedBkpBlock *bkpb; diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c index 4f67dc62fb..6c7c983c5c 100644 --- a/src/backend/access/transam/xlogutils.c +++ b/src/backend/access/transam/xlogutils.c @@ -360,7 +360,7 @@ XLogReadBufferForRedoExtended(XLogReaderState *record, { Assert(XLogRecHasBlockImage(record, block_id)); *buf = XLogReadBufferExtended(rnode, forknum, blkno, - get_cleanup_lock ? RBM_ZERO_AND_CLEANUP_LOCK : RBM_ZERO_AND_LOCK); + get_cleanup_lock ? RBM_ZERO_AND_CLEANUP_LOCK : RBM_ZERO_AND_LOCK); page = BufferGetPage(*buf); if (!RestoreBlockImage(record, block_id, page)) elog(ERROR, "failed to restore block image"); @@ -722,8 +722,8 @@ XLogRead(char *buf, TimeLineID tli, XLogRecPtr startptr, Size count) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not seek in log segment %s to offset %u: %m", - path, startoff))); + errmsg("could not seek in log segment %s to offset %u: %m", + path, startoff))); } sendOff = startoff; } diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 7be0e30a74..c949ac31a7 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -55,7 +55,7 @@ #include "postmaster/clustermon.h" #endif -uint32 bootstrap_data_checksum_version = 0; /* No checksum */ +uint32 bootstrap_data_checksum_version = 0; /* No checksum */ #define ALLOC(t, c) \ @@ -172,7 +172,7 @@ static struct typmap *Ap = NULL; static Datum values[MAXATTR]; /* current row's attribute values */ static bool Nulls[MAXATTR]; -static MemoryContext nogc = NULL; /* special no-gc mem context */ +static MemoryContext nogc = NULL; /* special no-gc mem context */ /* * At bootstrap time, we first declare all the indices to be built, and @@ -715,7 +715,7 @@ DefineAttr(char *name, char *type, int attnum, int nullness) namestrcpy(&attrtypes[attnum]->attname, name); elog(DEBUG4, "column %s %s", NameStr(attrtypes[attnum]->attname), type); - attrtypes[attnum]->attnum = attnum + 1; /* fillatt */ + attrtypes[attnum]->attnum = attnum + 1; /* fillatt */ typeoid = gettype(type); @@ -880,7 +880,7 @@ InsertOneNull(int i) Assert(i >= 0 && i < MAXATTR); if (boot_reldesc->rd_att->attrs[i]->attnotnull) elog(ERROR, - "NULL value specified for not-null column \"%s\" of relation \"%s\"", + "NULL value specified for not-null column \"%s\" of relation \"%s\"", NameStr(boot_reldesc->rd_att->attrs[i]->attname), RelationGetRelationName(boot_reldesc)); values[i] = PointerGetDatum(NULL); diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c index 304e3c4bc3..b7b5e49c9f 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -157,7 +157,7 @@ dumpacl(Acl *acl) DatumGetCString(DirectFunctionCall1(aclitemout, PointerGetDatum(aip + i)))); } -#endif /* ACLDEBUG */ +#endif /* ACLDEBUG */ /* @@ -212,8 +212,8 @@ merge_acl_with_grant(Acl *old_acl, bool is_grant, * option, while REVOKE GRANT OPTION revokes only the option. */ ACLITEM_SET_PRIVS_GOPTIONS(aclitem, - (is_grant || !grant_option) ? privileges : ACL_NO_RIGHTS, - (!is_grant || grant_option) ? privileges : ACL_NO_RIGHTS); + (is_grant || !grant_option) ? privileges : ACL_NO_RIGHTS, + (!is_grant || grant_option) ? privileges : ACL_NO_RIGHTS); newer_acl = aclupdate(new_acl, &aclitem, modechg, ownerId, behavior); @@ -370,8 +370,8 @@ restrict_and_check_grant(bool is_grant, AclMode avail_goptions, bool all_privs, else ereport(WARNING, (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED), - errmsg("not all privileges could be revoked for \"%s\"", - objname))); + errmsg("not all privileges could be revoked for \"%s\"", + objname))); } } @@ -994,7 +994,7 @@ ExecAlterDefaultPrivilegesStmt(ParseState *pstate, AlterDefaultPrivilegesStmt *s if (privnode->cols) ereport(ERROR, (errcode(ERRCODE_INVALID_GRANT_OPERATION), - errmsg("default privileges cannot be set for columns"))); + errmsg("default privileges cannot be set for columns"))); if (privnode->priv_name == NULL) /* parser mistake? */ elog(ERROR, "AccessPriv node must specify privilege"); @@ -2383,7 +2383,7 @@ ExecGrant_ForeignServer(InternalGrant *istmt) this_privileges = restrict_and_check_grant(istmt->is_grant, avail_goptions, istmt->all_privs, istmt->privileges, - srvid, grantorId, ACL_KIND_FOREIGN_SERVER, + srvid, grantorId, ACL_KIND_FOREIGN_SERVER, NameStr(pg_server_tuple->srvname), 0, NULL); @@ -2603,7 +2603,7 @@ ExecGrant_Language(InternalGrant *istmt) errmsg("language \"%s\" is not trusted", NameStr(pg_language_tuple->lanname)), errdetail("GRANT and REVOKE are not allowed on untrusted languages, " - "because only superusers can use untrusted languages."))); + "because only superusers can use untrusted languages."))); /* * Get owner ID and working copy of existing ACL. If there's no ACL, @@ -3117,7 +3117,7 @@ ExecGrant_Type(InternalGrant *istmt) ereport(ERROR, (errcode(ERRCODE_INVALID_GRANT_OPERATION), errmsg("cannot set privileges of array types"), - errhint("Set the privileges of the element type instead."))); + errhint("Set the privileges of the element type instead."))); /* Used GRANT DOMAIN on a non-domain? */ if (istmt->objtype == ACL_OBJECT_DOMAIN && @@ -3433,8 +3433,8 @@ aclcheck_error_col(AclResult aclerr, AclObjectKind objectkind, case ACLCHECK_NO_PRIV: ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied for column \"%s\" of relation \"%s\"", - colname, objectname))); + errmsg("permission denied for column \"%s\" of relation \"%s\"", + colname, objectname))); break; case ACLCHECK_NOT_OWNER: /* relation msg is OK since columns don't have separate owners */ @@ -4866,8 +4866,8 @@ pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid) if (!HeapTupleIsValid(tuple)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("text search configuration with OID %u does not exist", - cfg_oid))); + errmsg("text search configuration with OID %u does not exist", + cfg_oid))); ownerId = ((Form_pg_ts_config) GETSTRUCT(tuple))->cfgowner; diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index f8e560a8d4..077dff70b6 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -110,12 +110,12 @@ typedef struct } ObjectAddressExtra; /* ObjectAddressExtra flag bits */ -#define DEPFLAG_ORIGINAL 0x0001 /* an original deletion target */ -#define DEPFLAG_NORMAL 0x0002 /* reached via normal dependency */ -#define DEPFLAG_AUTO 0x0004 /* reached via auto dependency */ -#define DEPFLAG_INTERNAL 0x0008 /* reached via internal dependency */ -#define DEPFLAG_EXTENSION 0x0010 /* reached via extension dependency */ -#define DEPFLAG_REVERSE 0x0020 /* reverse internal/extension link */ +#define DEPFLAG_ORIGINAL 0x0001 /* an original deletion target */ +#define DEPFLAG_NORMAL 0x0002 /* reached via normal dependency */ +#define DEPFLAG_AUTO 0x0004 /* reached via auto dependency */ +#define DEPFLAG_INTERNAL 0x0008 /* reached via internal dependency */ +#define DEPFLAG_EXTENSION 0x0010 /* reached via extension dependency */ +#define DEPFLAG_REVERSE 0x0020 /* reverse internal/extension link */ /* expansible list of ObjectAddresses */ @@ -163,7 +163,7 @@ static const Oid object_classes[] = { OperatorClassRelationId, /* OCLASS_OPCLASS */ OperatorFamilyRelationId, /* OCLASS_OPFAMILY */ AccessMethodRelationId, /* OCLASS_AM */ - AccessMethodOperatorRelationId, /* OCLASS_AMOP */ + AccessMethodOperatorRelationId, /* OCLASS_AMOP */ AccessMethodProcedureRelationId, /* OCLASS_AMPROC */ RewriteRelationId, /* OCLASS_REWRITE */ TriggerRelationId, /* OCLASS_TRIGGER */ @@ -176,7 +176,7 @@ static const Oid object_classes[] = { AuthIdRelationId, /* OCLASS_ROLE */ DatabaseRelationId, /* OCLASS_DATABASE */ TableSpaceRelationId, /* OCLASS_TBLSPACE */ - ForeignDataWrapperRelationId, /* OCLASS_FDW */ + ForeignDataWrapperRelationId, /* OCLASS_FDW */ ForeignServerRelationId, /* OCLASS_FOREIGN_SERVER */ UserMappingRelationId, /* OCLASS_USER_MAPPING */ DefaultAclRelationId, /* OCLASS_DEFACL */ @@ -416,7 +416,7 @@ performMultipleDeletions(const ObjectAddresses *objects, findDependentObjects(thisobj, DEPFLAG_ORIGINAL, flags, - NULL, /* empty stack */ + NULL, /* empty stack */ targetObjects, objects, &depRel); @@ -1061,8 +1061,8 @@ reportDependentObjects(const ObjectAddresses *targetObjects, if (origObject) ereport(ERROR, (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), - errmsg("cannot drop %s because other objects depend on it", - getObjectDescription(origObject)), + errmsg("cannot drop %s because other objects depend on it", + getObjectDescription(origObject)), errdetail("%s", clientdetail.data), errdetail_log("%s", logdetail.data), errhint("Use DROP ... CASCADE to drop the dependent objects too."))); @@ -1566,7 +1566,7 @@ recordDependencyOnSingleRelExpr(const ObjectAddress *depender, rte.type = T_RangeTblEntry; rte.rtekind = RTE_RELATION; rte.relid = relId; - rte.relkind = RELKIND_RELATION; /* no need for exactness here */ + rte.relkind = RELKIND_RELATION; /* no need for exactness here */ context.rtables = list_make1(list_make1(&rte)); @@ -1793,8 +1793,8 @@ find_expr_references_walker(Node *node, case REGROLEOID: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("constant of the type %s cannot be used here", - "regrole"))); + errmsg("constant of the type %s cannot be used here", + "regrole"))); break; } } @@ -2032,7 +2032,7 @@ find_expr_references_walker(Node *node, TargetEntry *tle = (TargetEntry *) lfirst(lc); if (tle->resjunk) - continue; /* ignore junk tlist items */ + continue; /* ignore junk tlist items */ add_object_address(OCLASS_CLASS, rte->relid, tle->resno, context->addrs); } diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 59520f1893..2c6e551f51 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -309,7 +309,7 @@ heap_create(const char *relname, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied to create \"%s.%s\"", get_namespace_name(relnamespace), relname), - errdetail("System catalog modifications are currently disallowed."))); + errdetail("System catalog modifications are currently disallowed."))); /* * Decide if we need storage or not, and handle a couple other special @@ -561,8 +561,8 @@ CheckAttributeType(const char *attname, if (list_member_oid(containing_rowtypes, atttypid)) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("composite type %s cannot be made a member of itself", - format_type_be(atttypid)))); + errmsg("composite type %s cannot be made a member of itself", + format_type_be(atttypid)))); containing_rowtypes = lcons_oid(atttypid, containing_rowtypes); @@ -605,7 +605,7 @@ CheckAttributeType(const char *attname, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), errmsg("no collation was derived for column \"%s\" with collatable type %s", attname, format_type_be(atttypid)), - errhint("Use the COLLATE clause to set the collation explicitly."))); + errhint("Use the COLLATE clause to set the collation explicitly."))); } /* @@ -1331,25 +1331,25 @@ AddNewRelationType(const char *typeName, return TypeCreate(new_row_type, /* optional predetermined OID */ typeName, /* type name */ - typeNamespace, /* type namespace */ + typeNamespace, /* type namespace */ new_rel_oid, /* relation oid */ new_rel_kind, /* relation kind */ ownerid, /* owner's ID */ -1, /* internal size (varlena) */ TYPTYPE_COMPOSITE, /* type-type (composite) */ - TYPCATEGORY_COMPOSITE, /* type-category (ditto) */ + TYPCATEGORY_COMPOSITE, /* type-category (ditto) */ false, /* composite types are never preferred */ DEFAULT_TYPDELIM, /* default array delimiter */ F_RECORD_IN, /* input procedure */ F_RECORD_OUT, /* output procedure */ - F_RECORD_RECV, /* receive procedure */ - F_RECORD_SEND, /* send procedure */ + F_RECORD_RECV, /* receive procedure */ + F_RECORD_SEND, /* send procedure */ InvalidOid, /* typmodin procedure - none */ InvalidOid, /* typmodout procedure - none */ InvalidOid, /* analyze procedure - default */ InvalidOid, /* array element type - irrelevant */ false, /* this is not an array type */ - new_array_type, /* array type if any */ + new_array_type, /* array type if any */ InvalidOid, /* domain base type - irrelevant */ NULL, /* default value - none */ NULL, /* default binary representation */ @@ -1462,9 +1462,9 @@ heap_create_with_catalog(const char *relname, ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg("type \"%s\" already exists", relname), - errhint("A relation has an associated type of the same name, " - "so you must use a name that doesn't conflict " - "with any existing type."))); + errhint("A relation has an associated type of the same name, " + "so you must use a name that doesn't conflict " + "with any existing type."))); } /* @@ -1599,7 +1599,7 @@ heap_create_with_catalog(const char *relname, relarrayname = makeArrayTypeName(relname, relnamespace); - TypeCreate(new_array_oid, /* force the type's OID to this */ + TypeCreate(new_array_oid, /* force the type's OID to this */ relarrayname, /* Array type name */ relnamespace, /* Same namespace as parent */ InvalidOid, /* Not composite, no relationOid */ @@ -1941,7 +1941,7 @@ RemoveAttributeById(Oid relid, AttrNumber attnum) tuple = SearchSysCacheCopy2(ATTNUM, ObjectIdGetDatum(relid), Int16GetDatum(attnum)); - if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ + if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ elog(ERROR, "cache lookup failed for attribute %d of relation %u", attnum, relid); attStruct = (Form_pg_attribute) GETSTRUCT(tuple); @@ -2106,7 +2106,7 @@ RemoveAttrDefaultById(Oid attrdefId) tuple = SearchSysCacheCopy2(ATTNUM, ObjectIdGetDatum(myrelid), Int16GetDatum(myattnum)); - if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ + if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ elog(ERROR, "cache lookup failed for attribute %d of relation %u", myattnum, myrelid); @@ -2304,8 +2304,8 @@ StoreAttrDefault(Relation rel, AttrNumber attnum, * Also deparse it to form the mostly-obsolete adsrc field. */ adsrc = deparse_expression(expr, - deparse_context_for(RelationGetRelationName(rel), - RelationGetRelid(rel)), + deparse_context_for(RelationGetRelationName(rel), + RelationGetRelid(rel)), false, false); /* @@ -2412,8 +2412,8 @@ StoreRelCheck(Relation rel, char *ccname, Node *expr, * Also deparse it to form the mostly-obsolete consrc field. */ ccsrc = deparse_expression(expr, - deparse_context_for(RelationGetRelationName(rel), - RelationGetRelid(rel)), + deparse_context_for(RelationGetRelationName(rel), + RelationGetRelid(rel)), false, false); /* @@ -2456,15 +2456,15 @@ StoreRelCheck(Relation rel, char *ccname, Node *expr, rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("cannot add NO INHERIT constraint to partitioned table \"%s\"", - RelationGetRelationName(rel)))); + errmsg("cannot add NO INHERIT constraint to partitioned table \"%s\"", + RelationGetRelationName(rel)))); /* * Create the Check Constraint */ constrOid = CreateConstraintEntry(ccname, /* Constraint Name */ - RelationGetNamespace(rel), /* namespace */ + RelationGetNamespace(rel), /* namespace */ CONSTRAINT_CHECK, /* Constraint Type */ false, /* Is Deferrable */ false, /* Is Deferred */ @@ -2472,9 +2472,9 @@ StoreRelCheck(Relation rel, char *ccname, Node *expr, RelationGetRelid(rel), /* relation */ attNos, /* attrs in the constraint */ keycount, /* # attrs in the constraint */ - InvalidOid, /* not a domain constraint */ - InvalidOid, /* no associated index */ - InvalidOid, /* Foreign key fields */ + InvalidOid, /* not a domain constraint */ + InvalidOid, /* no associated index */ + InvalidOid, /* Foreign key fields */ NULL, NULL, NULL, @@ -2483,14 +2483,14 @@ StoreRelCheck(Relation rel, char *ccname, Node *expr, ' ', ' ', ' ', - NULL, /* not an exclusion constraint */ - expr, /* Tree form of check constraint */ + NULL, /* not an exclusion constraint */ + expr, /* Tree form of check constraint */ ccbin, /* Binary form of check constraint */ ccsrc, /* Source form of check constraint */ is_local, /* conislocal */ inhcount, /* coninhcount */ is_no_inherit, /* connoinherit */ - is_internal); /* internally constructed? */ + is_internal); /* internally constructed? */ pfree(ccbin); pfree(ccsrc); @@ -2882,8 +2882,8 @@ MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr, if (!found || !allow_merge) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("constraint \"%s\" for relation \"%s\" already exists", - ccname, RelationGetRelationName(rel)))); + errmsg("constraint \"%s\" for relation \"%s\" already exists", + ccname, RelationGetRelationName(rel)))); /* If the child constraint is "no inherit" then cannot merge */ if (con->connoinherit) @@ -2915,8 +2915,8 @@ MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr, /* OK to update the tuple */ ereport(NOTICE, - (errmsg("merging constraint \"%s\" with inherited definition", - ccname))); + (errmsg("merging constraint \"%s\" with inherited definition", + ccname))); tup = heap_copytuple(tup); con = (Form_pg_constraint) GETSTRUCT(tup); @@ -3031,7 +3031,7 @@ cookDefault(ParseState *pstate, if (contain_var_clause(expr)) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("cannot use column references in default expression"))); + errmsg("cannot use column references in default expression"))); /* * transformExpr() should have already rejected subqueries, aggregates, @@ -3061,7 +3061,7 @@ cookDefault(ParseState *pstate, attname, format_type_be(atttypid), format_type_be(type_id)), - errhint("You will need to rewrite or cast the expression."))); + errhint("You will need to rewrite or cast the expression."))); } /* @@ -3108,8 +3108,8 @@ cookConstraint(ParseState *pstate, if (list_length(pstate->p_rtable) != 1) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("only table \"%s\" can be referenced in check constraint", - relname))); + errmsg("only table \"%s\" can be referenced in check constraint", + relname))); return expr; } @@ -3357,9 +3357,9 @@ heap_truncate_check_FKs(List *relations, bool tempTables) errmsg("cannot truncate a table referenced in a foreign key constraint"), errdetail("Table \"%s\" references \"%s\".", relname2, relname), - errhint("Truncate table \"%s\" at the same time, " - "or use TRUNCATE ... CASCADE.", - relname2))); + errhint("Truncate table \"%s\" at the same time, " + "or use TRUNCATE ... CASCADE.", + relname2))); } } } diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index d0d208e98d..feff80d834 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -159,7 +159,7 @@ relationHasPrimaryKey(Relation rel) HeapTuple indexTuple; indexTuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexoid)); - if (!HeapTupleIsValid(indexTuple)) /* should not happen */ + if (!HeapTupleIsValid(indexTuple)) /* should not happen */ elog(ERROR, "cache lookup failed for index %u", indexoid); result = ((Form_pg_index) GETSTRUCT(indexTuple))->indisprimary; ReleaseSysCache(indexTuple); @@ -208,8 +208,8 @@ index_check_primary_key(Relation heapRel, { ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("multiple primary keys for table \"%s\" are not allowed", - RelationGetRelationName(heapRel)))); + errmsg("multiple primary keys for table \"%s\" are not allowed", + RelationGetRelationName(heapRel)))); } /* @@ -233,7 +233,7 @@ index_check_primary_key(Relation heapRel, continue; atttuple = SearchSysCache2(ATTNUM, - ObjectIdGetDatum(RelationGetRelid(heapRel)), + ObjectIdGetDatum(RelationGetRelid(heapRel)), Int16GetDatum(attnum)); if (!HeapTupleIsValid(atttuple)) elog(ERROR, "cache lookup failed for attribute %d of relation %u", @@ -326,14 +326,14 @@ ConstructTupleDescriptor(Relation heapRelation, * here we are indexing on a system attribute (-1...-n) */ from = SystemAttributeDefinition(atnum, - heapRelation->rd_rel->relhasoids); + heapRelation->rd_rel->relhasoids); } else { /* * here we are indexing on a normal attribute (1...n) */ - if (atnum > natts) /* safety check */ + if (atnum > natts) /* safety check */ elog(ERROR, "invalid column number %d", atnum); from = heapTupDesc->attrs[AttrNumberGetAttrOffset(atnum)]; } @@ -421,7 +421,7 @@ ConstructTupleDescriptor(Relation heapRelation, /* * Set the attribute name as specified by caller. */ - if (colnames_item == NULL) /* shouldn't happen */ + if (colnames_item == NULL) /* shouldn't happen */ elog(ERROR, "too few entries in colnames list"); namestrcpy(&to->attname, (const char *) lfirst(colnames_item)); colnames_item = lnext(colnames_item); @@ -955,7 +955,7 @@ index_create(Relation heapRelation, else { elog(ERROR, "constraint must be PRIMARY, UNIQUE or EXCLUDE"); - constraintType = 0; /* keep compiler quiet */ + constraintType = 0; /* keep compiler quiet */ } index_constraint_create(heapRelation, @@ -965,9 +965,9 @@ index_create(Relation heapRelation, constraintType, deferrable, initdeferred, - false, /* already marked primary */ - false, /* pg_index entry is OK */ - false, /* no old dependencies */ + false, /* already marked primary */ + false, /* pg_index entry is OK */ + false, /* no old dependencies */ allow_system_table_mods, is_internal); } @@ -1039,7 +1039,7 @@ index_create(Relation heapRelation, if (indexInfo->ii_Expressions) { recordDependencyOnSingleRelExpr(&myself, - (Node *) indexInfo->ii_Expressions, + (Node *) indexInfo->ii_Expressions, heapRelationId, DEPENDENCY_NORMAL, DEPENDENCY_AUTO, false); @@ -1206,7 +1206,7 @@ index_constraint_create(Relation heapRelation, indexInfo->ii_KeyAttrNumbers, indexInfo->ii_NumIndexAttrs, InvalidOid, /* no domain */ - indexRelationId, /* index OID */ + indexRelationId, /* index OID */ InvalidOid, /* no foreign key */ NULL, NULL, @@ -1217,12 +1217,12 @@ index_constraint_create(Relation heapRelation, ' ', ' ', indexInfo->ii_ExclusionOps, - NULL, /* no check constraint */ + NULL, /* no check constraint */ NULL, NULL, - true, /* islocal */ + true, /* islocal */ 0, /* inhcount */ - true, /* noinherit */ + true, /* noinherit */ is_internal); /* @@ -1938,7 +1938,7 @@ index_update_stats(Relation rel, if (rd_rel->relkind != RELKIND_INDEX) visibilitymap_count(rel, &relallvisible, NULL); - else /* don't bother for indexes */ + else /* don't bother for indexes */ relallvisible = 0; #ifdef XCP @@ -2274,7 +2274,7 @@ IndexBuildHeapRangeScan(Relation heapRelation, if (IsBootstrapProcessingMode() || indexInfo->ii_Concurrent) { snapshot = RegisterSnapshot(GetTransactionSnapshot()); - OldestXmin = InvalidTransactionId; /* not used */ + OldestXmin = InvalidTransactionId; /* not used */ /* "any visible" mode is not compatible with this */ Assert(!anyvisible); @@ -2287,8 +2287,8 @@ IndexBuildHeapRangeScan(Relation heapRelation, } scan = heap_beginscan_strat(heapRelation, /* relation */ - snapshot, /* snapshot */ - 0, /* number of keys */ + snapshot, /* snapshot */ + 0, /* number of keys */ NULL, /* scan key */ true, /* buffer access strategy OK */ allow_sync); /* syncscan OK? */ @@ -2539,7 +2539,7 @@ IndexBuildHeapRangeScan(Relation heapRelation, break; default: elog(ERROR, "unexpected HeapTupleSatisfiesVacuum result"); - indexIt = tupleIsAlive = false; /* keep compiler quiet */ + indexIt = tupleIsAlive = false; /* keep compiler quiet */ break; } @@ -2692,8 +2692,8 @@ IndexCheckExclusion(Relation heapRelation, */ snapshot = RegisterSnapshot(GetLatestSnapshot()); scan = heap_beginscan_strat(heapRelation, /* relation */ - snapshot, /* snapshot */ - 0, /* number of keys */ + snapshot, /* snapshot */ + 0, /* number of keys */ NULL, /* scan key */ true, /* buffer access strategy OK */ true); /* syncscan OK */ @@ -3012,8 +3012,8 @@ validate_index_heapscan(Relation heapRelation, * match the sorted TIDs. */ scan = heap_beginscan_strat(heapRelation, /* relation */ - snapshot, /* snapshot */ - 0, /* number of keys */ + snapshot, /* snapshot */ + 0, /* number of keys */ NULL, /* scan key */ true, /* buffer access strategy OK */ false); /* syncscan not OK */ @@ -3344,7 +3344,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence, if (RELATION_IS_OTHER_TEMP(iRel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot reindex temporary tables of other sessions"))); + errmsg("cannot reindex temporary tables of other sessions"))); /* * Also check for active uses of the index in the current transaction; we diff --git a/src/backend/catalog/indexing.c b/src/backend/catalog/indexing.c index abc344ad69..e5b6bafaff 100644 --- a/src/backend/catalog/indexing.c +++ b/src/backend/catalog/indexing.c @@ -42,7 +42,7 @@ CatalogOpenIndexes(Relation heapRel) ResultRelInfo *resultRelInfo; resultRelInfo = makeNode(ResultRelInfo); - resultRelInfo->ri_RangeTableIndex = 1; /* dummy */ + resultRelInfo->ri_RangeTableIndex = 1; /* dummy */ resultRelInfo->ri_RelationDesc = heapRel; resultRelInfo->ri_TrigDesc = NULL; /* we don't fire triggers */ @@ -136,7 +136,7 @@ CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple) index_insert(relationDescs[i], /* index relation */ values, /* array of index Datums */ isnull, /* is-null flags */ - &(heapTuple->t_self), /* tid of heap tuple */ + &(heapTuple->t_self), /* tid of heap tuple */ heapRelation, relationDescs[i]->rd_index->indisunique ? UNIQUE_CHECK_YES : UNIQUE_CHECK_NO, diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index a29a232e8b..5f38aa814d 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -165,7 +165,7 @@ static bool baseSearchPathValid = true; typedef struct { List *searchPath; /* the desired search path */ - Oid creationNamespace; /* the desired creation namespace */ + Oid creationNamespace; /* the desired creation namespace */ int nestLevel; /* subtransaction nesting level */ } OverrideStackEntry; @@ -228,7 +228,7 @@ static void FindTemporaryNamespace(void); Oid RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, bool missing_ok, bool nowait, - RangeVarGetRelidCallback callback, void *callback_arg) + RangeVarGetRelidCallback callback, void *callback_arg) { uint64 inval_count; Oid relId; @@ -284,7 +284,7 @@ RangeVarGetRelidExtended(const RangeVar *relation, LOCKMODE lockmode, if (relation->relpersistence == RELPERSISTENCE_TEMP) { if (!OidIsValid(myTempNamespace)) - relId = InvalidOid; /* this probably can't happen? */ + relId = InvalidOid; /* this probably can't happen? */ else { if (relation->schemaname) @@ -1688,7 +1688,7 @@ OpernameGetCandidates(List *names, char oprkind, bool missing_schema_ok) /* We have a match with a previous result */ Assert(pathpos != prevResult->pathpos); if (pathpos > prevResult->pathpos) - continue; /* keep previous result */ + continue; /* keep previous result */ /* replace previous result */ prevResult->pathpos = pathpos; prevResult->oid = HeapTupleGetOid(opertup); @@ -1950,9 +1950,60 @@ OpfamilyIsVisible(Oid opfid) } /* + * lookup_collation + * If there's a collation of the given name/namespace, and it works + * with the given encoding, return its OID. Else return InvalidOid. + */ +static Oid +lookup_collation(const char *collname, Oid collnamespace, int32 encoding) +{ + Oid collid; + HeapTuple colltup; + Form_pg_collation collform; + + /* Check for encoding-specific entry (exact match) */ + collid = GetSysCacheOid3(COLLNAMEENCNSP, + PointerGetDatum(collname), + Int32GetDatum(encoding), + ObjectIdGetDatum(collnamespace)); + if (OidIsValid(collid)) + return collid; + + /* + * Check for any-encoding entry. This takes a bit more work: while libc + * collations with collencoding = -1 do work with all encodings, ICU + * collations only work with certain encodings, so we have to check that + * aspect before deciding it's a match. + */ + colltup = SearchSysCache3(COLLNAMEENCNSP, + PointerGetDatum(collname), + Int32GetDatum(-1), + ObjectIdGetDatum(collnamespace)); + if (!HeapTupleIsValid(colltup)) + return InvalidOid; + collform = (Form_pg_collation) GETSTRUCT(colltup); + if (collform->collprovider == COLLPROVIDER_ICU) + { + if (is_encoding_supported_by_icu(encoding)) + collid = HeapTupleGetOid(colltup); + else + collid = InvalidOid; + } + else + { + collid = HeapTupleGetOid(colltup); + } + ReleaseSysCache(colltup); + return collid; +} + +/* * CollationGetCollid * Try to resolve an unqualified collation name. * Returns OID if collation found in search path, else InvalidOid. + * + * Note that this will only find collations that work with the current + * database's encoding. */ Oid CollationGetCollid(const char *collname) @@ -1970,19 +2021,7 @@ CollationGetCollid(const char *collname) if (namespaceId == myTempNamespace) continue; /* do not look in temp namespace */ - /* Check for database-encoding-specific entry */ - collid = GetSysCacheOid3(COLLNAMEENCNSP, - PointerGetDatum(collname), - Int32GetDatum(dbencoding), - ObjectIdGetDatum(namespaceId)); - if (OidIsValid(collid)) - return collid; - - /* Check for any-encoding entry */ - collid = GetSysCacheOid3(COLLNAMEENCNSP, - PointerGetDatum(collname), - Int32GetDatum(-1), - ObjectIdGetDatum(namespaceId)); + collid = lookup_collation(collname, namespaceId, dbencoding); if (OidIsValid(collid)) return collid; } @@ -1996,6 +2035,9 @@ CollationGetCollid(const char *collname) * Determine whether a collation (identified by OID) is visible in the * current search path. Visible means "would be found by searching * for the unqualified collation name". + * + * Note that only collations that work with the current database's encoding + * will be considered visible. */ bool CollationIsVisible(Oid collid) @@ -2029,9 +2071,10 @@ CollationIsVisible(Oid collid) { /* * If it is in the path, it might still not be visible; it could be - * hidden by another conversion of the same name earlier in the path. - * So we must do a slow check to see if this conversion would be found - * by CollationGetCollid. + * hidden by another collation of the same name earlier in the path, + * or it might not work with the current DB encoding. So we must do a + * slow check to see if this collation would be found by + * CollationGetCollid. */ char *collname = NameStr(collform->collname); @@ -2810,14 +2853,14 @@ DeconstructQualifiedName(List *names, if (strcmp(catalogname, get_database_name(MyDatabaseId)) != 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cross-database references are not implemented: %s", - NameListToString(names)))); + errmsg("cross-database references are not implemented: %s", + NameListToString(names)))); break; default: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("improper qualified name (too many dotted names): %s", - NameListToString(names)))); + errmsg("improper qualified name (too many dotted names): %s", + NameListToString(names)))); break; } @@ -2966,7 +3009,7 @@ CheckSetNamespace(Oid oldNspOid, Oid nspOid) if (isAnyTempNamespace(nspOid) || isAnyTempNamespace(oldNspOid)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot move objects into or out of temporary schemas"))); + errmsg("cannot move objects into or out of temporary schemas"))); /* same for TOAST schema */ if (nspOid == PG_TOAST_NAMESPACE || oldNspOid == PG_TOAST_NAMESPACE) @@ -3076,8 +3119,8 @@ makeRangeVarFromNameList(List *names) default: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("improper relation name (too many dotted names): %s", - NameListToString(names)))); + errmsg("improper relation name (too many dotted names): %s", + NameListToString(names)))); break; } @@ -3177,7 +3220,7 @@ bool isTempOrTempToastNamespace(Oid namespaceId) { if (OidIsValid(myTempNamespace) && - (myTempNamespace == namespaceId || myTempToastNamespace == namespaceId)) + (myTempNamespace == namespaceId || myTempToastNamespace == namespaceId)) return true; return false; } @@ -3528,7 +3571,7 @@ PopOverrideSearchPath(void) entry = (OverrideStackEntry *) linitial(overrideStack); activeSearchPath = entry->searchPath; activeCreationNamespace = entry->creationNamespace; - activeTempCreationPending = false; /* XXX is this OK? */ + activeTempCreationPending = false; /* XXX is this OK? */ } else { @@ -3542,6 +3585,9 @@ PopOverrideSearchPath(void) /* * get_collation_oid - find a collation by possibly qualified name + * + * Note that this will only find collations that work with the current + * database's encoding. */ Oid get_collation_oid(List *name, bool missing_ok) @@ -3563,17 +3609,7 @@ get_collation_oid(List *name, bool missing_ok) if (missing_ok && !OidIsValid(namespaceId)) return InvalidOid; - /* first try for encoding-specific entry, then any-encoding */ - colloid = GetSysCacheOid3(COLLNAMEENCNSP, - PointerGetDatum(collation_name), - Int32GetDatum(dbencoding), - ObjectIdGetDatum(namespaceId)); - if (OidIsValid(colloid)) - return colloid; - colloid = GetSysCacheOid3(COLLNAMEENCNSP, - PointerGetDatum(collation_name), - Int32GetDatum(-1), - ObjectIdGetDatum(namespaceId)); + colloid = lookup_collation(collation_name, namespaceId, dbencoding); if (OidIsValid(colloid)) return colloid; } @@ -3589,16 +3625,7 @@ get_collation_oid(List *name, bool missing_ok) if (namespaceId == myTempNamespace) continue; /* do not look in temp namespace */ - colloid = GetSysCacheOid3(COLLNAMEENCNSP, - PointerGetDatum(collation_name), - Int32GetDatum(dbencoding), - ObjectIdGetDatum(namespaceId)); - if (OidIsValid(colloid)) - return colloid; - colloid = GetSysCacheOid3(COLLNAMEENCNSP, - PointerGetDatum(collation_name), - Int32GetDatum(-1), - ObjectIdGetDatum(namespaceId)); + colloid = lookup_collation(collation_name, namespaceId, dbencoding); if (OidIsValid(colloid)) return colloid; } @@ -4017,7 +4044,7 @@ AtEOXact_Namespace(bool isCommit, bool parallel) { myTempNamespace = InvalidOid; myTempToastNamespace = InvalidOid; - baseSearchPathValid = false; /* need to rebuild list */ + baseSearchPathValid = false; /* need to rebuild list */ } myTempNamespaceSubID = InvalidSubTransactionId; } @@ -4069,7 +4096,7 @@ AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid, /* TEMP namespace creation failed, so reset state */ myTempNamespace = InvalidOid; myTempToastNamespace = InvalidOid; - baseSearchPathValid = false; /* need to rebuild list */ + baseSearchPathValid = false; /* need to rebuild list */ } } @@ -4094,7 +4121,7 @@ AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid, entry = (OverrideStackEntry *) linitial(overrideStack); activeSearchPath = entry->searchPath; activeCreationNamespace = entry->creationNamespace; - activeTempCreationPending = false; /* XXX is this OK? */ + activeTempCreationPending = false; /* XXX is this OK? */ } else { diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c index 05096959de..a135ac2060 100644 --- a/src/backend/catalog/objectaddress.c +++ b/src/backend/catalog/objectaddress.c @@ -97,19 +97,18 @@ typedef struct Oid class_oid; /* oid of catalog */ Oid oid_index_oid; /* oid of index on system oid column */ int oid_catcache_id; /* id of catcache on system oid column */ - int name_catcache_id; /* id of catcache on (name,namespace), - * or (name) if the object does not - * live in a namespace */ + int name_catcache_id; /* id of catcache on (name,namespace), or + * (name) if the object does not live in a + * namespace */ AttrNumber attnum_name; /* attnum of name field */ - AttrNumber attnum_namespace; /* attnum of namespace field */ + AttrNumber attnum_namespace; /* attnum of namespace field */ AttrNumber attnum_owner; /* attnum of owner field */ AttrNumber attnum_acl; /* attnum of acl field */ AclObjectKind acl_kind; /* ACL_KIND_* of this object type */ - bool is_nsp_name_unique; /* can the nsp/name combination (or - * name alone, if there's no - * namespace) be considered a unique - * identifier for an object of this - * class? */ + bool is_nsp_name_unique; /* can the nsp/name combination (or name + * alone, if there's no namespace) be + * considered a unique identifier for an + * object of this class? */ } ObjectPropertyType; static const ObjectPropertyType ObjectProperty[] = @@ -854,13 +853,13 @@ get_object_address(ObjectType objtype, Node *object, objlist = castNode(List, object); domaddr = get_object_address_type(OBJECT_DOMAIN, - linitial_node(TypeName, objlist), + linitial_node(TypeName, objlist), missing_ok); constrname = strVal(lsecond(objlist)); address.classId = ConstraintRelationId; address.objectId = get_domain_constraint_oid(domaddr.objectId, - constrname, missing_ok); + constrname, missing_ok); address.objectSubId = 0; } @@ -878,7 +877,7 @@ get_object_address(ObjectType objtype, Node *object, case OBJECT_PUBLICATION: case OBJECT_SUBSCRIPTION: address = get_object_address_unqualified(objtype, - (Value *) object, missing_ok); + (Value *) object, missing_ok); break; case OBJECT_TYPE: case OBJECT_DOMAIN: @@ -1623,11 +1622,11 @@ get_object_address_opf_member(ObjectType objtype, if (!missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("operator %d (%s, %s) of %s does not exist", - membernum, - TypeNameToString(typenames[0]), - TypeNameToString(typenames[1]), - getObjectDescription(&famaddr)))); + errmsg("operator %d (%s, %s) of %s does not exist", + membernum, + TypeNameToString(typenames[0]), + TypeNameToString(typenames[1]), + getObjectDescription(&famaddr)))); } else { @@ -1654,11 +1653,11 @@ get_object_address_opf_member(ObjectType objtype, if (!missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("function %d (%s, %s) of %s does not exist", - membernum, - TypeNameToString(typenames[0]), - TypeNameToString(typenames[1]), - getObjectDescription(&famaddr)))); + errmsg("function %d (%s, %s) of %s does not exist", + membernum, + TypeNameToString(typenames[0]), + TypeNameToString(typenames[1]), + getObjectDescription(&famaddr)))); } else { @@ -1849,7 +1848,7 @@ get_object_address_defacl(List *object, bool missing_ok) default: ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("unrecognized default ACL object type \"%c\"", objtype), + errmsg("unrecognized default ACL object type \"%c\"", objtype), errhint("Valid object types are \"%c\", \"%c\", \"%c\", \"%c\", \"%c\".", DEFACLOBJ_RELATION, DEFACLOBJ_SEQUENCE, @@ -1906,8 +1905,8 @@ not_found: else ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("default ACL for user \"%s\" on %s does not exist", - username, objtype_str))); + errmsg("default ACL for user \"%s\" on %s does not exist", + username, objtype_str))); } return address; } @@ -2046,9 +2045,9 @@ pg_get_object_address(PG_FUNCTION_ARGS) if (nulls[i]) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("name or argument lists may not contain nulls"))); + errmsg("name or argument lists may not contain nulls"))); args = lappend(args, - typeStringToTypeName(TextDatumGetCString(elems[i]))); + typeStringToTypeName(TextDatumGetCString(elems[i]))); } } else @@ -2072,7 +2071,7 @@ pg_get_object_address(PG_FUNCTION_ARGS) if (list_length(args) != 1) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("argument list length must be exactly %d", 1))); + errmsg("argument list length must be exactly %d", 1))); break; case OBJECT_OPFAMILY: case OBJECT_OPCLASS: @@ -2092,7 +2091,7 @@ pg_get_object_address(PG_FUNCTION_ARGS) if (list_length(args) != 2) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("argument list length must be exactly %d", 2))); + errmsg("argument list length must be exactly %d", 2))); break; default: break; @@ -2666,7 +2665,7 @@ getObjectDescription(const ObjectAddress *object) if (object->objectSubId != 0) appendStringInfo(&buffer, _(" column %s"), get_relid_attribute_name(object->objectId, - object->objectSubId)); + object->objectSubId)); break; case OCLASS_PROC: @@ -2773,7 +2772,7 @@ getObjectDescription(const ObjectAddress *object) elog(ERROR, "cache lookup failed for conversion %u", object->objectId); appendStringInfo(&buffer, _("conversion %s"), - NameStr(((Form_pg_conversion) GETSTRUCT(conTup))->conname)); + NameStr(((Form_pg_conversion) GETSTRUCT(conTup))->conname)); ReleaseSysCache(conTup); break; } @@ -2862,7 +2861,7 @@ getObjectDescription(const ObjectAddress *object) appendStringInfo(&buffer, _("operator class %s for access method %s"), quote_qualified_identifier(nspname, - NameStr(opcForm->opcname)), + NameStr(opcForm->opcname)), NameStr(amForm->amname)); ReleaseSysCache(amTup); @@ -2884,7 +2883,7 @@ getObjectDescription(const ObjectAddress *object) elog(ERROR, "cache lookup failed for access method %u", object->objectId); appendStringInfo(&buffer, _("access method %s"), - NameStr(((Form_pg_am) GETSTRUCT(tup))->amname)); + NameStr(((Form_pg_am) GETSTRUCT(tup))->amname)); ReleaseSysCache(tup); break; } @@ -3101,7 +3100,7 @@ getObjectDescription(const ObjectAddress *object) elog(ERROR, "cache lookup failed for text search parser %u", object->objectId); appendStringInfo(&buffer, _("text search parser %s"), - NameStr(((Form_pg_ts_parser) GETSTRUCT(tup))->prsname)); + NameStr(((Form_pg_ts_parser) GETSTRUCT(tup))->prsname)); ReleaseSysCache(tup); break; } @@ -3116,7 +3115,7 @@ getObjectDescription(const ObjectAddress *object) elog(ERROR, "cache lookup failed for text search dictionary %u", object->objectId); appendStringInfo(&buffer, _("text search dictionary %s"), - NameStr(((Form_pg_ts_dict) GETSTRUCT(tup))->dictname)); + NameStr(((Form_pg_ts_dict) GETSTRUCT(tup))->dictname)); ReleaseSysCache(tup); break; } @@ -3131,7 +3130,7 @@ getObjectDescription(const ObjectAddress *object) elog(ERROR, "cache lookup failed for text search template %u", object->objectId); appendStringInfo(&buffer, _("text search template %s"), - NameStr(((Form_pg_ts_template) GETSTRUCT(tup))->tmplname)); + NameStr(((Form_pg_ts_template) GETSTRUCT(tup))->tmplname)); ReleaseSysCache(tup); break; } @@ -3146,7 +3145,7 @@ getObjectDescription(const ObjectAddress *object) elog(ERROR, "cache lookup failed for text search configuration %u", object->objectId); appendStringInfo(&buffer, _("text search configuration %s"), - NameStr(((Form_pg_ts_config) GETSTRUCT(tup))->cfgname)); + NameStr(((Form_pg_ts_config) GETSTRUCT(tup))->cfgname)); ReleaseSysCache(tup); break; } @@ -3260,33 +3259,33 @@ getObjectDescription(const ObjectAddress *object) case DEFACLOBJ_RELATION: appendStringInfo(&buffer, _("default privileges on new relations belonging to role %s"), - GetUserNameFromId(defacl->defaclrole, false)); + GetUserNameFromId(defacl->defaclrole, false)); break; case DEFACLOBJ_SEQUENCE: appendStringInfo(&buffer, _("default privileges on new sequences belonging to role %s"), - GetUserNameFromId(defacl->defaclrole, false)); + GetUserNameFromId(defacl->defaclrole, false)); break; case DEFACLOBJ_FUNCTION: appendStringInfo(&buffer, _("default privileges on new functions belonging to role %s"), - GetUserNameFromId(defacl->defaclrole, false)); + GetUserNameFromId(defacl->defaclrole, false)); break; case DEFACLOBJ_TYPE: appendStringInfo(&buffer, _("default privileges on new types belonging to role %s"), - GetUserNameFromId(defacl->defaclrole, false)); + GetUserNameFromId(defacl->defaclrole, false)); break; case DEFACLOBJ_NAMESPACE: appendStringInfo(&buffer, _("default privileges on new schemas belonging to role %s"), - GetUserNameFromId(defacl->defaclrole, false)); + GetUserNameFromId(defacl->defaclrole, false)); break; default: /* shouldn't get here */ appendStringInfo(&buffer, - _("default privileges belonging to role %s"), - GetUserNameFromId(defacl->defaclrole, false)); + _("default privileges belonging to role %s"), + GetUserNameFromId(defacl->defaclrole, false)); break; } @@ -3294,7 +3293,7 @@ getObjectDescription(const ObjectAddress *object) { appendStringInfo(&buffer, _(" in schema %s"), - get_namespace_name(defacl->defaclnamespace)); + get_namespace_name(defacl->defaclnamespace)); } systable_endscan(rcscan); @@ -3324,7 +3323,7 @@ getObjectDescription(const ObjectAddress *object) elog(ERROR, "cache lookup failed for event trigger %u", object->objectId); appendStringInfo(&buffer, _("event trigger %s"), - NameStr(((Form_pg_event_trigger) GETSTRUCT(tup))->evtname)); + NameStr(((Form_pg_event_trigger) GETSTRUCT(tup))->evtname)); ReleaseSysCache(tup); break; } @@ -3646,7 +3645,7 @@ pg_identify_object(PG_FUNCTION_ARGS) RelationGetDescr(catalog), &isnull); if (isnull) elog(ERROR, "invalid null namespace in object %u/%u/%d", - address.classId, address.objectId, address.objectSubId); + address.classId, address.objectId, address.objectSubId); } /* @@ -3661,7 +3660,7 @@ pg_identify_object(PG_FUNCTION_ARGS) Datum nameDatum; nameDatum = heap_getattr(objtup, nameAttnum, - RelationGetDescr(catalog), &isnull); + RelationGetDescr(catalog), &isnull); if (isnull) elog(ERROR, "invalid null name in object %u/%u/%d", address.classId, address.objectId, address.objectSubId); @@ -4118,7 +4117,7 @@ getObjectIdentityParts(const ObjectAddress *object, case OCLASS_PROC: appendStringInfoString(&buffer, - format_procedure_qualified(object->objectId)); + format_procedure_qualified(object->objectId)); if (objname) format_procedure_parts(object->objectId, objname, objargs); break; @@ -4151,8 +4150,8 @@ getObjectIdentityParts(const ObjectAddress *object, castForm = (Form_pg_cast) GETSTRUCT(tup); appendStringInfo(&buffer, "(%s AS %s)", - format_type_be_qualified(castForm->castsource), - format_type_be_qualified(castForm->casttarget)); + format_type_be_qualified(castForm->castsource), + format_type_be_qualified(castForm->casttarget)); if (objname) { @@ -4179,7 +4178,7 @@ getObjectIdentityParts(const ObjectAddress *object, schema = get_namespace_name_or_temp(coll->collnamespace); appendStringInfoString(&buffer, quote_qualified_identifier(schema, - NameStr(coll->collname))); + NameStr(coll->collname))); if (objname) *objname = list_make2(schema, pstrdup(NameStr(coll->collname))); @@ -4218,7 +4217,7 @@ getObjectIdentityParts(const ObjectAddress *object, appendStringInfo(&buffer, "%s on %s", quote_identifier(NameStr(con->conname)), - getObjectIdentityParts(&domain, objname, objargs)); + getObjectIdentityParts(&domain, objname, objargs)); if (objname) *objargs = lappend(*objargs, pstrdup(NameStr(con->conname))); @@ -4243,7 +4242,7 @@ getObjectIdentityParts(const ObjectAddress *object, schema = get_namespace_name_or_temp(conForm->connamespace); appendStringInfoString(&buffer, quote_qualified_identifier(schema, - NameStr(conForm->conname))); + NameStr(conForm->conname))); if (objname) *objname = list_make2(schema, pstrdup(NameStr(conForm->conname))); @@ -4304,7 +4303,7 @@ getObjectIdentityParts(const ObjectAddress *object, object->objectId); langForm = (Form_pg_language) GETSTRUCT(langTup); appendStringInfoString(&buffer, - quote_identifier(NameStr(langForm->lanname))); + quote_identifier(NameStr(langForm->lanname))); if (objname) *objname = list_make1(pstrdup(NameStr(langForm->lanname))); ReleaseSysCache(langTup); @@ -4319,7 +4318,7 @@ getObjectIdentityParts(const ObjectAddress *object, case OCLASS_OPERATOR: appendStringInfoString(&buffer, - format_operator_qualified(object->objectId)); + format_operator_qualified(object->objectId)); if (objname) format_operator_parts(object->objectId, objname, objargs); break; @@ -4349,7 +4348,7 @@ getObjectIdentityParts(const ObjectAddress *object, appendStringInfo(&buffer, "%s USING %s", quote_qualified_identifier(schema, - NameStr(opcForm->opcname)), + NameStr(opcForm->opcname)), quote_identifier(NameStr(amForm->amname))); if (objname) *objname = list_make3(pstrdup(NameStr(amForm->amname)), @@ -4418,7 +4417,7 @@ getObjectIdentityParts(const ObjectAddress *object, if (objname) { *objname = lappend(*objname, - psprintf("%d", amopForm->amopstrategy)); + psprintf("%d", amopForm->amopstrategy)); *objargs = list_make2(ltype, rtype); } @@ -4569,10 +4568,10 @@ getObjectIdentityParts(const ObjectAddress *object, schema = get_namespace_name_or_temp(formStatistic->stxnamespace); appendStringInfoString(&buffer, quote_qualified_identifier(schema, - NameStr(formStatistic->stxname))); + NameStr(formStatistic->stxname))); if (objname) *objname = list_make2(schema, - pstrdup(NameStr(formStatistic->stxname))); + pstrdup(NameStr(formStatistic->stxname))); ReleaseSysCache(tup); } break; @@ -4592,10 +4591,10 @@ getObjectIdentityParts(const ObjectAddress *object, schema = get_namespace_name_or_temp(formParser->prsnamespace); appendStringInfoString(&buffer, quote_qualified_identifier(schema, - NameStr(formParser->prsname))); + NameStr(formParser->prsname))); if (objname) *objname = list_make2(schema, - pstrdup(NameStr(formParser->prsname))); + pstrdup(NameStr(formParser->prsname))); ReleaseSysCache(tup); break; } @@ -4615,10 +4614,10 @@ getObjectIdentityParts(const ObjectAddress *object, schema = get_namespace_name_or_temp(formDict->dictnamespace); appendStringInfoString(&buffer, quote_qualified_identifier(schema, - NameStr(formDict->dictname))); + NameStr(formDict->dictname))); if (objname) *objname = list_make2(schema, - pstrdup(NameStr(formDict->dictname))); + pstrdup(NameStr(formDict->dictname))); ReleaseSysCache(tup); break; } @@ -4638,10 +4637,10 @@ getObjectIdentityParts(const ObjectAddress *object, schema = get_namespace_name_or_temp(formTmpl->tmplnamespace); appendStringInfoString(&buffer, quote_qualified_identifier(schema, - NameStr(formTmpl->tmplname))); + NameStr(formTmpl->tmplname))); if (objname) *objname = list_make2(schema, - pstrdup(NameStr(formTmpl->tmplname))); + pstrdup(NameStr(formTmpl->tmplname))); ReleaseSysCache(tup); break; } @@ -4661,7 +4660,7 @@ getObjectIdentityParts(const ObjectAddress *object, schema = get_namespace_name_or_temp(formCfg->cfgnamespace); appendStringInfoString(&buffer, quote_qualified_identifier(schema, - NameStr(formCfg->cfgname))); + NameStr(formCfg->cfgname))); if (objname) *objname = list_make2(schema, pstrdup(NameStr(formCfg->cfgname))); @@ -4880,7 +4879,7 @@ getObjectIdentityParts(const ObjectAddress *object, object->objectId); trigForm = (Form_pg_event_trigger) GETSTRUCT(tup); appendStringInfoString(&buffer, - quote_identifier(NameStr(trigForm->evtname))); + quote_identifier(NameStr(trigForm->evtname))); ReleaseSysCache(tup); break; } @@ -5103,7 +5102,7 @@ getRelationIdentity(StringInfo buffer, Oid relid, List **object) schema = get_namespace_name_or_temp(relForm->relnamespace); appendStringInfoString(buffer, quote_qualified_identifier(schema, - NameStr(relForm->relname))); + NameStr(relForm->relname))); if (object) *object = list_make2(schema, pstrdup(NameStr(relForm->relname))); diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c index a7c9b9a46c..f8c55b1fe7 100644 --- a/src/backend/catalog/partition.c +++ b/src/backend/catalog/partition.c @@ -80,9 +80,9 @@ typedef struct PartitionBoundInfoData int ndatums; /* Length of the datums following array */ Datum **datums; /* Array of datum-tuples with key->partnatts * datums each */ - RangeDatumContent **content;/* what's contained in each range bound datum? - * (see the above enum); NULL for list - * partitioned tables */ + RangeDatumContent **content; /* what's contained in each range bound + * datum? (see the above enum); NULL for + * list partitioned tables */ int *indexes; /* Partition indexes; one entry per member of * the datums array (plus one if range * partitioned table) */ @@ -293,7 +293,7 @@ RelationBuildPartitionDesc(Relation rel) * also save the index of partition the value comes from. */ all_values = (PartitionListValue **) palloc(ndatums * - sizeof(PartitionListValue *)); + sizeof(PartitionListValue *)); i = 0; foreach(cell, non_null_values) { @@ -318,7 +318,7 @@ RelationBuildPartitionDesc(Relation rel) bool *distinct_indexes; all_bounds = (PartitionRangeBound **) palloc0(2 * nparts * - sizeof(PartitionRangeBound *)); + sizeof(PartitionRangeBound *)); distinct_indexes = (bool *) palloc(2 * nparts * sizeof(bool)); /* @@ -420,7 +420,7 @@ RelationBuildPartitionDesc(Relation rel) * into the relcache. */ rbounds = (PartitionRangeBound **) palloc(ndatums * - sizeof(PartitionRangeBound *)); + sizeof(PartitionRangeBound *)); k = 0; for (i = 0; i < 2 * nparts; i++) { @@ -481,8 +481,8 @@ RelationBuildPartitionDesc(Relation rel) { boundinfo->datums[i] = (Datum *) palloc(sizeof(Datum)); boundinfo->datums[i][0] = datumCopy(all_values[i]->value, - key->parttypbyval[0], - key->parttyplen[0]); + key->parttypbyval[0], + key->parttyplen[0]); /* If the old index has no mapping, assign one */ if (mapping[all_values[i]->index] == -1) @@ -513,7 +513,7 @@ RelationBuildPartitionDesc(Relation rel) case PARTITION_STRATEGY_RANGE: { boundinfo->content = (RangeDatumContent **) palloc(ndatums * - sizeof(RangeDatumContent *)); + sizeof(RangeDatumContent *)); boundinfo->indexes = (int *) palloc((ndatums + 1) * sizeof(int)); @@ -522,7 +522,7 @@ RelationBuildPartitionDesc(Relation rel) int j; boundinfo->datums[i] = (Datum *) palloc(key->partnatts * - sizeof(Datum)); + sizeof(Datum)); boundinfo->content[i] = (RangeDatumContent *) palloc(key->partnatts * sizeof(RangeDatumContent)); @@ -573,7 +573,7 @@ RelationBuildPartitionDesc(Relation rel) /* * Now assign OIDs from the original array into mapped indexes of the * result array. Order of OIDs in the former is defined by the - * catalog scan that retrived them, whereas that in the latter is + * catalog scan that retrieved them, whereas that in the latter is * defined by canonicalized representation of the list values or the * range bounds. */ @@ -739,7 +739,7 @@ check_new_partition_bound(char *relname, Relation parent, upper) >= 0) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("cannot create range partition with empty range"), + errmsg("cannot create range partition with empty range"), parser_errposition(pstate, spec->location))); if (partdesc->nparts > 0) @@ -942,7 +942,7 @@ map_partition_varattnos(List *expr, int target_varno, part_attnos = convert_tuples_by_name_map(RelationGetDescr(partrel), RelationGetDescr(parent), - gettext_noop("could not convert row type")); + gettext_noop("could not convert row type")); expr = (List *) map_variable_attnos((Node *) expr, target_varno, 0, part_attnos, @@ -1120,7 +1120,7 @@ RelationGetPartitionDispatchInfo(Relation rel, int lockmode, pd[i]->tupslot = MakeSingleTupleTableSlot(tupdesc); pd[i]->tupmap = convert_tuples_by_name(RelationGetDescr(parent), tupdesc, - gettext_noop("could not convert row type")); + gettext_noop("could not convert row type")); } else { @@ -1200,7 +1200,7 @@ get_partition_operator(PartitionKey key, int col, StrategyNumber strategy, /* * If one doesn't exist, we must resort to using an operator in the same - * opreator family but with the operator class declared input type. It is + * operator family but with the operator class declared input type. It is * OK to do so, because the column's type is known to be binary-coercible * with the operator class input type (otherwise, the operator class in * question would not have been accepted as the partitioning operator @@ -1311,6 +1311,12 @@ get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec) List *arrelems = NIL; bool list_has_null = false; + /* + * Only single-column list partitioning is supported, so we are worried + * only about the partition key with index 0. + */ + Assert(key->partnatts == 1); + /* Construct Var or expression representing the partition column */ if (key->partattrs[0] != 0) keyCol = (Expr *) makeVar(1, @@ -1333,20 +1339,28 @@ get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec) arrelems = lappend(arrelems, copyObject(val)); } - /* Construct an ArrayExpr for the non-null partition values */ - arr = makeNode(ArrayExpr); - arr->array_typeid = !type_is_array(key->parttypid[0]) - ? get_array_type(key->parttypid[0]) - : key->parttypid[0]; - arr->array_collid = key->parttypcoll[0]; - arr->element_typeid = key->parttypid[0]; - arr->elements = arrelems; - arr->multidims = false; - arr->location = -1; - - /* Generate the main expression, i.e., keyCol = ANY (arr) */ - opexpr = make_partition_op_expr(key, 0, BTEqualStrategyNumber, - keyCol, (Expr *) arr); + if (arrelems) + { + /* Construct an ArrayExpr for the non-null partition values */ + arr = makeNode(ArrayExpr); + arr->array_typeid = !type_is_array(key->parttypid[0]) + ? get_array_type(key->parttypid[0]) + : key->parttypid[0]; + arr->array_collid = key->parttypcoll[0]; + arr->element_typeid = key->parttypid[0]; + arr->elements = arrelems; + arr->multidims = false; + arr->location = -1; + + /* Generate the main expression, i.e., keyCol = ANY (arr) */ + opexpr = make_partition_op_expr(key, 0, BTEqualStrategyNumber, + keyCol, (Expr *) arr); + } + else + { + /* If there are no partition values, we don't need an = ANY expr */ + opexpr = NULL; + } if (!list_has_null) { @@ -1361,7 +1375,7 @@ get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec) nulltest->argisrow = false; nulltest->location = -1; - result = list_make2(nulltest, opexpr); + result = opexpr ? list_make2(nulltest, opexpr) : list_make1(nulltest); } else { @@ -1369,16 +1383,21 @@ get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec) * Gin up a "col IS NULL" test that will be OR'd with the main * expression. */ - Expr *or; - nulltest = makeNode(NullTest); nulltest->arg = keyCol; nulltest->nulltesttype = IS_NULL; nulltest->argisrow = false; nulltest->location = -1; - or = makeBoolExpr(OR_EXPR, list_make2(nulltest, opexpr), -1); - result = list_make1(or); + if (opexpr) + { + Expr *or; + + or = makeBoolExpr(OR_EXPR, list_make2(nulltest, opexpr), -1); + result = list_make1(or); + } + else + result = list_make1(nulltest); } return result; @@ -1553,7 +1572,7 @@ get_qual_for_range(PartitionKey key, PartitionBoundSpec *spec) */ i = 0; partexprs_item = list_head(key->partexprs); - partexprs_item_saved = partexprs_item; /* placate compiler */ + partexprs_item_saved = partexprs_item; /* placate compiler */ forboth(cell1, spec->lowerdatums, cell2, spec->upperdatums) { EState *estate; @@ -1595,7 +1614,7 @@ get_qual_for_range(PartitionKey key, PartitionBoundSpec *spec) fix_opfuncids((Node *) test_expr); test_exprstate = ExecInitExpr(test_expr, NULL); test_result = ExecEvalExprSwitchContext(test_exprstate, - GetPerTupleExprContext(estate), + GetPerTupleExprContext(estate), &isNull); MemoryContextSwitchTo(oldcxt); FreeExecutorState(estate); @@ -1676,7 +1695,7 @@ get_qual_for_range(PartitionKey key, PartitionBoundSpec *spec) make_partition_op_expr(key, j, strategy, keyCol, - (Expr *) lower_val)); + (Expr *) lower_val)); } if (need_next_upper_arm && upper_val) @@ -1698,7 +1717,7 @@ get_qual_for_range(PartitionKey key, PartitionBoundSpec *spec) make_partition_op_expr(key, j, strategy, keyCol, - (Expr *) upper_val)); + (Expr *) upper_val)); } /* @@ -1722,13 +1741,13 @@ get_qual_for_range(PartitionKey key, PartitionBoundSpec *spec) if (lower_or_arm_args != NIL) lower_or_arms = lappend(lower_or_arms, list_length(lower_or_arm_args) > 1 - ? makeBoolExpr(AND_EXPR, lower_or_arm_args, -1) + ? makeBoolExpr(AND_EXPR, lower_or_arm_args, -1) : linitial(lower_or_arm_args)); if (upper_or_arm_args != NIL) upper_or_arms = lappend(upper_or_arms, list_length(upper_or_arm_args) > 1 - ? makeBoolExpr(AND_EXPR, upper_or_arm_args, -1) + ? makeBoolExpr(AND_EXPR, upper_or_arm_args, -1) : linitial(upper_or_arm_args)); /* If no work to do in the next iteration, break away. */ @@ -2250,8 +2269,8 @@ partition_bound_cmp(PartitionKey key, PartitionBoundInfo boundinfo, bool lower = boundinfo->indexes[offset] < 0; cmpval = partition_rbound_cmp(key, - bound_datums, content, lower, - (PartitionRangeBound *) probe); + bound_datums, content, lower, + (PartitionRangeBound *) probe); } else cmpval = partition_rbound_datum_cmp(key, diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c index 65c2e88e93..a9204503d3 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -83,9 +83,9 @@ AggregateCreate(const char *aggName, Oid finalfn = InvalidOid; /* can be omitted */ Oid combinefn = InvalidOid; /* can be omitted */ Oid serialfn = InvalidOid; /* can be omitted */ - Oid deserialfn = InvalidOid; /* can be omitted */ + Oid deserialfn = InvalidOid; /* can be omitted */ Oid mtransfn = InvalidOid; /* can be omitted */ - Oid minvtransfn = InvalidOid; /* can be omitted */ + Oid minvtransfn = InvalidOid; /* can be omitted */ Oid mfinalfn = InvalidOid; /* can be omitted */ Oid sortop = InvalidOid; /* can be omitted */ Oid *aggArgTypes = parameterTypes->values; @@ -123,7 +123,7 @@ AggregateCreate(const char *aggName, ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), errmsg_plural("aggregates cannot have more than %d argument", - "aggregates cannot have more than %d arguments", + "aggregates cannot have more than %d arguments", FUNC_MAX_ARGS - 1, FUNC_MAX_ARGS - 1))); @@ -331,9 +331,9 @@ AggregateCreate(const char *aggName, if (rettype != aggmTransType) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("return type of inverse transition function %s is not %s", - NameListToString(aggminvtransfnName), - format_type_be(aggmTransType)))); + errmsg("return type of inverse transition function %s is not %s", + NameListToString(aggminvtransfnName), + format_type_be(aggmTransType)))); tup = SearchSysCache1(PROCOID, ObjectIdGetDatum(minvtransfn)); if (!HeapTupleIsValid(tup)) @@ -452,9 +452,9 @@ AggregateCreate(const char *aggName, if (rettype != BYTEAOID) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("return type of serialization function %s is not %s", - NameListToString(aggserialfnName), - format_type_be(BYTEAOID)))); + errmsg("return type of serialization function %s is not %s", + NameListToString(aggserialfnName), + format_type_be(BYTEAOID)))); } /* @@ -472,9 +472,9 @@ AggregateCreate(const char *aggName, if (rettype != INTERNALOID) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("return type of deserialization function %s is not %s", - NameListToString(aggdeserialfnName), - format_type_be(INTERNALOID)))); + errmsg("return type of deserialization function %s is not %s", + NameListToString(aggdeserialfnName), + format_type_be(INTERNALOID)))); } /* @@ -605,30 +605,30 @@ AggregateCreate(const char *aggName, myself = ProcedureCreate(aggName, aggNamespace, - false, /* no replacement */ - false, /* doesn't return a set */ + false, /* no replacement */ + false, /* doesn't return a set */ finaltype, /* returnType */ - GetUserId(), /* proowner */ - INTERNALlanguageId, /* languageObjectId */ - InvalidOid, /* no validator */ + GetUserId(), /* proowner */ + INTERNALlanguageId, /* languageObjectId */ + InvalidOid, /* no validator */ "aggregate_dummy", /* placeholder proc */ - NULL, /* probin */ - true, /* isAgg */ - false, /* isWindowFunc */ - false, /* security invoker (currently not - * definable for agg) */ - false, /* isLeakProof */ - false, /* isStrict (not needed for agg) */ - PROVOLATILE_IMMUTABLE, /* volatility (not - * needed for agg) */ + NULL, /* probin */ + true, /* isAgg */ + false, /* isWindowFunc */ + false, /* security invoker (currently not + * definable for agg) */ + false, /* isLeakProof */ + false, /* isStrict (not needed for agg) */ + PROVOLATILE_IMMUTABLE, /* volatility (not needed + * for agg) */ proparallel, parameterTypes, /* paramTypes */ allParameterTypes, /* allParamTypes */ parameterModes, /* parameterModes */ parameterNames, /* parameterNames */ parameterDefaults, /* parameterDefaults */ - PointerGetDatum(NULL), /* trftypes */ - PointerGetDatum(NULL), /* proconfig */ + PointerGetDatum(NULL), /* trftypes */ + PointerGetDatum(NULL), /* proconfig */ 1, /* procost */ 0); /* prorows */ procOid = myself.objectId; diff --git a/src/backend/catalog/pg_collation.c b/src/backend/catalog/pg_collation.c index 30cd0cba19..ca62896ecb 100644 --- a/src/backend/catalog/pg_collation.c +++ b/src/backend/catalog/pg_collation.c @@ -37,6 +37,11 @@ * CollationCreate * * Add a new tuple to pg_collation. + * + * if_not_exists: if true, don't fail on duplicate name, just print a notice + * and return InvalidOid. + * quiet: if true, don't fail on duplicate name, just silently return + * InvalidOid (overrides if_not_exists). */ Oid CollationCreate(const char *collname, Oid collnamespace, @@ -45,7 +50,8 @@ CollationCreate(const char *collname, Oid collnamespace, int32 collencoding, const char *collcollate, const char *collctype, const char *collversion, - bool if_not_exists) + bool if_not_exists, + bool quiet) { Relation rel; TupleDesc tupDesc; @@ -77,7 +83,9 @@ CollationCreate(const char *collname, Oid collnamespace, Int32GetDatum(collencoding), ObjectIdGetDatum(collnamespace))) { - if (if_not_exists) + if (quiet) + return InvalidOid; + else if (if_not_exists) { ereport(NOTICE, (errcode(ERRCODE_DUPLICATE_OBJECT), @@ -94,8 +102,8 @@ CollationCreate(const char *collname, Oid collnamespace, collencoding == -1 ? errmsg("collation \"%s\" already exists", collname) - : errmsg("collation \"%s\" for encoding \"%s\" already exists", - collname, pg_encoding_to_char(collencoding)))); + : errmsg("collation \"%s\" for encoding \"%s\" already exists", + collname, pg_encoding_to_char(collencoding)))); } /* open pg_collation; see below about the lock level */ @@ -119,7 +127,12 @@ CollationCreate(const char *collname, Oid collnamespace, Int32GetDatum(-1), ObjectIdGetDatum(collnamespace)))) { - if (if_not_exists) + if (quiet) + { + heap_close(rel, NoLock); + return InvalidOid; + } + else if (if_not_exists) { heap_close(rel, NoLock); ereport(NOTICE, diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c index e5ae3d9292..1336c46d3f 100644 --- a/src/backend/catalog/pg_constraint.c +++ b/src/backend/catalog/pg_constraint.c @@ -576,7 +576,7 @@ RemoveConstraintById(Oid conId) con->conrelid); classForm = (Form_pg_class) GETSTRUCT(relTup); - if (classForm->relchecks == 0) /* should not happen */ + if (classForm->relchecks == 0) /* should not happen */ elog(ERROR, "relation \"%s\" has relchecks = 0", RelationGetRelationName(rel)); classForm->relchecks--; @@ -646,8 +646,8 @@ RenameConstraintById(Oid conId, const char *newname) newname)) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("constraint \"%s\" for relation \"%s\" already exists", - newname, get_rel_name(con->conrelid)))); + errmsg("constraint \"%s\" for relation \"%s\" already exists", + newname, get_rel_name(con->conrelid)))); if (OidIsValid(con->contypid) && ConstraintNameIsUsed(CONSTRAINT_DOMAIN, con->contypid, @@ -678,7 +678,7 @@ RenameConstraintById(Oid conId, const char *newname) */ void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, - Oid newNspId, bool isType, ObjectAddresses *objsMoved) + Oid newNspId, bool isType, ObjectAddresses *objsMoved) { Relation conRel; ScanKeyData key[1]; @@ -785,8 +785,8 @@ get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok) if (OidIsValid(conOid)) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("table \"%s\" has multiple constraints named \"%s\"", - get_rel_name(relid), conname))); + errmsg("table \"%s\" has multiple constraints named \"%s\"", + get_rel_name(relid), conname))); conOid = HeapTupleGetOid(tuple); } } @@ -843,8 +843,8 @@ get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok) if (OidIsValid(conOid)) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("domain %s has multiple constraints named \"%s\"", - format_type_be(typid), conname))); + errmsg("domain %s has multiple constraints named \"%s\"", + format_type_be(typid), conname))); conOid = HeapTupleGetOid(tuple); } } @@ -928,7 +928,7 @@ get_primary_key_attnos(Oid relid, bool deferrableOk, Oid *constraintOid) if (isNull) elog(ERROR, "null conkey for constraint %u", HeapTupleGetOid(tuple)); - arr = DatumGetArrayTypeP(adatum); /* ensure not toasted */ + arr = DatumGetArrayTypeP(adatum); /* ensure not toasted */ numkeys = ARR_DIMS(arr)[0]; if (ARR_NDIM(arr) != 1 || numkeys < 0 || @@ -941,7 +941,7 @@ get_primary_key_attnos(Oid relid, bool deferrableOk, Oid *constraintOid) for (i = 0; i < numkeys; i++) { pkattnos = bms_add_member(pkattnos, - attnums[i] - FirstLowInvalidHeapAttributeNumber); + attnums[i] - FirstLowInvalidHeapAttributeNumber); } *constraintOid = HeapTupleGetOid(tuple); @@ -997,7 +997,7 @@ check_functional_grouping(Oid relid, gvar->varno == varno && gvar->varlevelsup == varlevelsup) groupbyattnos = bms_add_member(groupbyattnos, - gvar->varattno - FirstLowInvalidHeapAttributeNumber); + gvar->varattno - FirstLowInvalidHeapAttributeNumber); } if (bms_is_subset(pkattnos, groupbyattnos)) diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c index d616df62c1..dd6ca3e8f7 100644 --- a/src/backend/catalog/pg_depend.c +++ b/src/backend/catalog/pg_depend.c @@ -214,7 +214,7 @@ deleteDependencyRecordsFor(Oid classId, Oid objectId, while (HeapTupleIsValid(tup = systable_getnext(scan))) { if (skipExtensionDeps && - ((Form_pg_depend) GETSTRUCT(tup))->deptype == DEPENDENCY_EXTENSION) + ((Form_pg_depend) GETSTRUCT(tup))->deptype == DEPENDENCY_EXTENSION) continue; CatalogTupleDelete(depRel, &tup->t_self); @@ -319,8 +319,8 @@ changeDependencyFor(Oid classId, Oid objectId, if (isObjectPinned(&objAddr, depRel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot remove dependency on %s because it is a system object", - getObjectDescription(&objAddr)))); + errmsg("cannot remove dependency on %s because it is a system object", + getObjectDescription(&objAddr)))); /* * We can handle adding a dependency on something pinned, though, since diff --git a/src/backend/catalog/pg_enum.c b/src/backend/catalog/pg_enum.c index 300f24d231..fe61d4dacc 100644 --- a/src/backend/catalog/pg_enum.c +++ b/src/backend/catalog/pg_enum.c @@ -347,7 +347,7 @@ restart: if (!OidIsValid(binary_upgrade_next_pg_enum_oid)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("pg_enum OID value not set when in binary upgrade mode"))); + errmsg("pg_enum OID value not set when in binary upgrade mode"))); /* * Use binary-upgrade override for pg_enum.oid, if supplied. During diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c index b5cbc04889..ef81102150 100644 --- a/src/backend/catalog/pg_operator.c +++ b/src/backend/catalog/pg_operator.c @@ -225,7 +225,7 @@ OperatorShellMake(const char *operatorName, for (i = 0; i < Natts_pg_operator; ++i) { nulls[i] = false; - values[i] = (Datum) NULL; /* redundant, but safe */ + values[i] = (Datum) NULL; /* redundant, but safe */ } /* @@ -368,7 +368,7 @@ OperatorCreate(const char *operatorName, if (OidIsValid(joinId)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("only binary operators can have join selectivity"))); + errmsg("only binary operators can have join selectivity"))); if (canMerge) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), @@ -395,7 +395,7 @@ OperatorCreate(const char *operatorName, if (OidIsValid(joinId)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("only boolean operators can have join selectivity"))); + errmsg("only boolean operators can have join selectivity"))); if (canMerge) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), @@ -609,7 +609,7 @@ get_other_operator(List *otherOp, Oid otherLeftTypeId, Oid otherRightTypeId, if (!isCommutator) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("operator cannot be its own negator or sort operator"))); + errmsg("operator cannot be its own negator or sort operator"))); return InvalidOid; } diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c index 0f7ab80f65..3ba00c34ca 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -403,8 +403,8 @@ ProcedureCreate(const char *procedureName, if (!replace) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_FUNCTION), - errmsg("function \"%s\" already exists with same argument types", - procedureName))); + errmsg("function \"%s\" already exists with same argument types", + procedureName))); if (!pg_proc_ownercheck(HeapTupleGetOid(oldtup), proowner)) aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC, procedureName); @@ -440,8 +440,8 @@ ProcedureCreate(const char *procedureName, !equalTupleDescs(olddesc, newdesc)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("cannot change return type of existing function"), - errdetail("Row type defined by OUT parameters is different."), + errmsg("cannot change return type of existing function"), + errdetail("Row type defined by OUT parameters is different."), errhint("Use DROP FUNCTION %s first.", format_procedure(HeapTupleGetOid(oldtup))))); } @@ -483,10 +483,10 @@ ProcedureCreate(const char *procedureName, strcmp(old_arg_names[j], new_arg_names[j]) != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("cannot change name of input parameter \"%s\"", - old_arg_names[j]), + errmsg("cannot change name of input parameter \"%s\"", + old_arg_names[j]), errhint("Use DROP FUNCTION %s first.", - format_procedure(HeapTupleGetOid(oldtup))))); + format_procedure(HeapTupleGetOid(oldtup))))); } } @@ -536,7 +536,7 @@ ProcedureCreate(const char *procedureName, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("cannot change data type of existing parameter default value"), errhint("Use DROP FUNCTION %s first.", - format_procedure(HeapTupleGetOid(oldtup))))); + format_procedure(HeapTupleGetOid(oldtup))))); newlc = lnext(newlc); } } @@ -552,8 +552,8 @@ ProcedureCreate(const char *procedureName, else ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("function \"%s\" is not an aggregate function", - procedureName))); + errmsg("function \"%s\" is not an aggregate function", + procedureName))); } if (oldproc->proiswindow != isWindowFunc) { @@ -884,8 +884,8 @@ fmgr_sql_validator(PG_FUNCTION_ARGS) else ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("SQL functions cannot have arguments of type %s", - format_type_be(proc->proargtypes.values[i])))); + errmsg("SQL functions cannot have arguments of type %s", + format_type_be(proc->proargtypes.values[i])))); } } @@ -947,7 +947,7 @@ fmgr_sql_validator(PG_FUNCTION_ARGS) querytree_sublist = pg_analyze_and_rewrite_params(parsetree, prosrc, - (ParserSetupHook) sql_fn_parser_setup, + (ParserSetupHook) sql_fn_parser_setup, pinfo, NULL); querytree_list = list_concat(querytree_list, diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c index 17105f4f2c..3ef7ba8cd5 100644 --- a/src/backend/catalog/pg_publication.c +++ b/src/backend/catalog/pg_publication.c @@ -73,7 +73,7 @@ check_publication_add_relation(Relation targetrel) (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("\"%s\" is a system table", RelationGetRelationName(targetrel)), - errdetail("System tables cannot be added to publications."))); + errdetail("System tables cannot be added to publications."))); /* UNLOGGED and TEMP relations cannot be part of publication. */ if (!RelationNeedsWAL(targetrel)) @@ -81,7 +81,7 @@ check_publication_add_relation(Relation targetrel) (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("table \"%s\" cannot be replicated", RelationGetRelationName(targetrel)), - errdetail("Temporary and unlogged relations cannot be replicated."))); + errdetail("Temporary and unlogged relations cannot be replicated."))); } /* @@ -105,6 +105,30 @@ is_publishable_class(Oid relid, Form_pg_class reltuple) relid >= FirstNormalObjectId; } + +/* + * SQL-callable variant of the above + * + * This returns null when the relation does not exist. This is intended to be + * used for example in psql to avoid gratuitous errors when there are + * concurrent catalog changes. + */ +Datum +pg_relation_is_publishable(PG_FUNCTION_ARGS) +{ + Oid relid = PG_GETARG_OID(0); + HeapTuple tuple; + bool result; + + tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relid)); + if (!tuple) + PG_RETURN_NULL(); + result = is_publishable_class(relid, (Form_pg_class) GETSTRUCT(tuple)); + ReleaseSysCache(tuple); + PG_RETURN_BOOL(result); +} + + /* * Insert new publication / relation mapping. */ @@ -139,8 +163,8 @@ publication_add_relation(Oid pubid, Relation targetrel, ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("relation \"%s\" is already member of publication \"%s\"", - RelationGetRelationName(targetrel), pub->name))); + errmsg("relation \"%s\" is already member of publication \"%s\"", + RelationGetRelationName(targetrel), pub->name))); } check_publication_add_relation(targetrel); diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c index d28a8afb47..31b09a1da5 100644 --- a/src/backend/catalog/pg_shdepend.c +++ b/src/backend/catalog/pg_shdepend.c @@ -239,7 +239,7 @@ shdepChangeDep(Relation sdepRel, /* Caller screwed up if multiple matches */ if (oldtup) elog(ERROR, - "multiple pg_shdepend entries for object %u/%u/%d deptype %c", + "multiple pg_shdepend entries for object %u/%u/%d deptype %c", classid, objid, objsubid, deptype); oldtup = heap_copytuple(scantup); } @@ -691,7 +691,7 @@ checkSharedDependencies(Oid classId, Oid objectId, if (numNotReportedDbs > 0) appendStringInfo(&descs, ngettext("\nand objects in %d other database " "(see server log for list)", - "\nand objects in %d other databases " + "\nand objects in %d other databases " "(see server log for list)", numNotReportedDbs), numNotReportedDbs); @@ -1197,9 +1197,9 @@ shdepDropOwned(List *roleids, DropBehavior behavior) ereport(ERROR, (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), - errmsg("cannot drop objects owned by %s because they are " - "required by the database system", - getObjectDescription(&obj)))); + errmsg("cannot drop objects owned by %s because they are " + "required by the database system", + getObjectDescription(&obj)))); } ScanKeyInit(&key[0], diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c index 6b0e4f4729..59ffd2104d 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -79,7 +79,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId) for (i = 0; i < Natts_pg_type; ++i) { nulls[i] = false; - values[i] = (Datum) NULL; /* redundant, but safe */ + values[i] = (Datum) NULL; /* redundant, but safe */ } /* @@ -133,7 +133,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace, Oid ownerId) if (!OidIsValid(binary_upgrade_next_pg_type_oid)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("pg_type OID value not set when in binary upgrade mode"))); + errmsg("pg_type OID value not set when in binary upgrade mode"))); HeapTupleSetOid(tup, binary_upgrade_next_pg_type_oid); binary_upgrade_next_pg_type_oid = InvalidOid; @@ -214,7 +214,7 @@ TypeCreate(Oid newTypeOid, bool isImplicitArray, Oid arrayType, Oid baseType, - const char *defaultTypeValue, /* human readable rep */ + const char *defaultTypeValue, /* human readable rep */ char *defaultTypeBin, /* cooked rep */ bool passedByValue, char alignment, @@ -296,8 +296,8 @@ TypeCreate(Oid newTypeOid, else ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("internal size %d is invalid for passed-by-value type", - internalSize))); + errmsg("internal size %d is invalid for passed-by-value type", + internalSize))); } else { @@ -305,14 +305,14 @@ TypeCreate(Oid newTypeOid, if (internalSize == -1 && !(alignment == 'i' || alignment == 'd')) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("alignment \"%c\" is invalid for variable-length type", - alignment))); + errmsg("alignment \"%c\" is invalid for variable-length type", + alignment))); /* cstring must have char alignment */ if (internalSize == -2 && !(alignment == 'c')) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("alignment \"%c\" is invalid for variable-length type", - alignment))); + errmsg("alignment \"%c\" is invalid for variable-length type", + alignment))); } /* Only varlena types can be toasted */ @@ -511,8 +511,8 @@ TypeCreate(Oid newTypeOid, void GenerateTypeDependencies(Oid typeNamespace, Oid typeObjectId, - Oid relationOid, /* only for relation rowtypes */ - char relationKind, /* ditto */ + Oid relationOid, /* only for relation rowtypes */ + char relationKind, /* ditto */ Oid owner, Oid inputProcedure, Oid outputProcedure, @@ -652,7 +652,7 @@ GenerateTypeDependencies(Oid typeNamespace, referenced.objectId = elementType; referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, - isImplicitArray ? DEPENDENCY_INTERNAL : DEPENDENCY_NORMAL); + isImplicitArray ? DEPENDENCY_INTERNAL : DEPENDENCY_NORMAL); } /* Normal dependency from a domain to its base type. */ diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c index d5c4754d01..f12794e28c 100644 --- a/src/backend/catalog/storage.c +++ b/src/backend/catalog/storage.c @@ -59,7 +59,7 @@ typedef struct PendingRelDelete BackendId backend; /* InvalidBackendId if not a temp rel */ bool atCommit; /* T=delete at commit; F=delete at abort */ int nestLevel; /* xact nesting level of request */ - struct PendingRelDelete *next; /* linked-list link */ + struct PendingRelDelete *next; /* linked-list link */ } PendingRelDelete; static PendingRelDelete *pendingDeletes = NULL; /* head of linked list */ diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c index a84c61493f..a63539ab21 100644 --- a/src/backend/commands/aggregatecmds.c +++ b/src/backend/commands/aggregatecmds.c @@ -216,7 +216,7 @@ DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List if (mtransfuncName != NIL) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("aggregate msfunc must not be specified without mstype"))); + errmsg("aggregate msfunc must not be specified without mstype"))); if (minvtransfuncName != NIL) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), @@ -416,8 +416,8 @@ DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List /* * Most of the argument-checking is done inside of AggregateCreate */ - return AggregateCreate(aggName, /* aggregate name */ - aggNamespace, /* namespace */ + return AggregateCreate(aggName, /* aggregate name */ + aggNamespace, /* namespace */ aggKind, numArgs, numDirectArgs, @@ -427,22 +427,22 @@ DefineAggregate(ParseState *pstate, List *name, List *args, bool oldstyle, List PointerGetDatum(parameterNames), parameterDefaults, variadicArgType, - transfuncName, /* step function name */ - finalfuncName, /* final function name */ - combinefuncName, /* combine function name */ - serialfuncName, /* serial function name */ + transfuncName, /* step function name */ + finalfuncName, /* final function name */ + combinefuncName, /* combine function name */ + serialfuncName, /* serial function name */ deserialfuncName, /* deserial function name */ - mtransfuncName, /* fwd trans function name */ + mtransfuncName, /* fwd trans function name */ minvtransfuncName, /* inv trans function name */ - mfinalfuncName, /* final function name */ + mfinalfuncName, /* final function name */ finalfuncExtraArgs, mfinalfuncExtraArgs, sortoperatorName, /* sort operator name */ transTypeId, /* transition data type */ transSpace, /* transition space */ - mtransTypeId, /* transition data type */ + mtransTypeId, /* transition data type */ mtransSpace, /* transition space */ - initval, /* initial condition */ + initval, /* initial condition */ minitval, /* initial condition */ - proparallel); /* parallel safe? */ + proparallel); /* parallel safe? */ } diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c index 4d3fe8c745..4f8147907c 100644 --- a/src/backend/commands/alter.c +++ b/src/backend/commands/alter.c @@ -408,7 +408,7 @@ ExecRenameStmt(RenameStmt *stmt) default: elog(ERROR, "unrecognized rename stmt type: %d", (int) stmt->renameType); - return InvalidObjectAddress; /* keep compiler happy */ + return InvalidObjectAddress; /* keep compiler happy */ } } @@ -468,7 +468,7 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt, { case OBJECT_EXTENSION: address = AlterExtensionNamespace(strVal((Value *) stmt->object), stmt->newschema, - oldSchemaAddr ? &oldNspOid : NULL); + oldSchemaAddr ? &oldNspOid : NULL); break; case OBJECT_FOREIGN_TABLE: @@ -525,7 +525,7 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt, default: elog(ERROR, "unrecognized AlterObjectSchemaStmt type: %d", (int) stmt->objectType); - return InvalidObjectAddress; /* keep compiler happy */ + return InvalidObjectAddress; /* keep compiler happy */ } if (oldSchemaAddr) @@ -880,7 +880,7 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt) default: elog(ERROR, "unrecognized AlterOwnerStmt type: %d", (int) stmt->objectType); - return InvalidObjectAddress; /* keep compiler happy */ + return InvalidObjectAddress; /* keep compiler happy */ } } diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 67e4146c6c..fc9e017ab2 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -161,8 +161,8 @@ analyze_rel(Oid relid, RangeVar *relation, int options, if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0) ereport(LOG, (errcode(ERRCODE_LOCK_NOT_AVAILABLE), - errmsg("skipping analyze of \"%s\" --- lock not available", - relation->relname))); + errmsg("skipping analyze of \"%s\" --- lock not available", + relation->relname))); } if (!onerel) return; @@ -178,8 +178,8 @@ analyze_rel(Oid relid, RangeVar *relation, int options, { if (onerel->rd_rel->relisshared) ereport(WARNING, - (errmsg("skipping \"%s\" --- only superuser can analyze it", - RelationGetRelationName(onerel)))); + (errmsg("skipping \"%s\" --- only superuser can analyze it", + RelationGetRelationName(onerel)))); else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE) ereport(WARNING, (errmsg("skipping \"%s\" --- only superuser or database owner can analyze it", @@ -246,8 +246,8 @@ analyze_rel(Oid relid, RangeVar *relation, int options, if (!ok) { ereport(WARNING, - (errmsg("skipping \"%s\" --- cannot analyze this foreign table", - RelationGetRelationName(onerel)))); + (errmsg("skipping \"%s\" --- cannot analyze this foreign table", + RelationGetRelationName(onerel)))); relation_close(onerel, ShareUpdateExclusiveLock); return; } @@ -400,8 +400,8 @@ do_analyze_rel(Relation onerel, int options, VacuumParams *params, if (i == InvalidAttrNumber) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" of relation \"%s\" does not exist", - col, RelationGetRelationName(onerel)))); + errmsg("column \"%s\" of relation \"%s\" does not exist", + col, RelationGetRelationName(onerel)))); vacattrstats[tcnt] = examine_attribute(onerel, i, NULL); if (vacattrstats[tcnt] != NULL) tcnt++; @@ -489,7 +489,7 @@ do_analyze_rel(Relation onerel, int options, VacuumParams *params, /* Found an index expression */ Node *indexkey; - if (indexpr_item == NULL) /* shouldn't happen */ + if (indexpr_item == NULL) /* shouldn't happen */ elog(ERROR, "too few entries in indexprs list"); indexkey = (Node *) lfirst(indexpr_item); indexpr_item = lnext(indexpr_item); @@ -1486,7 +1486,7 @@ acquire_inherited_sample_rows(Relation onerel, int elevel, map = convert_tuples_by_name(RelationGetDescr(childrel), RelationGetDescr(onerel), - gettext_noop("could not convert row type")); + gettext_noop("could not convert row type")); if (map != NULL) { int j; @@ -1588,7 +1588,7 @@ update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats) i = Anum_pg_statistic_stakind1 - 1; for (k = 0; k < STATISTIC_NUM_SLOTS; k++) { - values[i++] = Int16GetDatum(stats->stakind[k]); /* stakindN */ + values[i++] = Int16GetDatum(stats->stakind[k]); /* stakindN */ } i = Anum_pg_statistic_staop1 - 1; for (k = 0; k < STATISTIC_NUM_SLOTS; k++) @@ -1903,7 +1903,7 @@ compute_trivial_stats(VacAttrStatsP stats, stats->stawidth = total_width / (double) nonnull_cnt; else stats->stawidth = stats->attrtype->typlen; - stats->stadistinct = 0.0; /* "unknown" */ + stats->stadistinct = 0.0; /* "unknown" */ } else if (null_cnt > 0) { @@ -1914,7 +1914,7 @@ compute_trivial_stats(VacAttrStatsP stats, stats->stawidth = 0; /* "unknown" */ else stats->stawidth = stats->attrtype->typlen; - stats->stadistinct = 0.0; /* "unknown" */ + stats->stadistinct = 0.0; /* "unknown" */ } } @@ -2267,7 +2267,7 @@ compute_distinct_stats(VacAttrStatsP stats, stats->stawidth = 0; /* "unknown" */ else stats->stawidth = stats->attrtype->typlen; - stats->stadistinct = 0.0; /* "unknown" */ + stats->stadistinct = 0.0; /* "unknown" */ } /* We don't need to bother cleaning up any of our temporary palloc's */ @@ -2817,7 +2817,7 @@ compute_scalar_stats(VacAttrStatsP stats, stats->stawidth = 0; /* "unknown" */ else stats->stawidth = stats->attrtype->typlen; - stats->stadistinct = 0.0; /* "unknown" */ + stats->stadistinct = 0.0; /* "unknown" */ } /* We don't need to bother cleaning up any of our temporary palloc's */ diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 87b215d8d3..bacc08eb84 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -245,7 +245,7 @@ typedef struct AsyncQueueControl QueuePosition head; /* head points to the next free location */ QueuePosition tail; /* the global tail is equivalent to the pos of * the "slowest" backend */ - TimestampTz lastQueueFillWarn; /* time of last queue-full msg */ + TimestampTz lastQueueFillWarn; /* time of last queue-full msg */ QueueBackendStatus backend[FLEXIBLE_ARRAY_MEMBER]; /* backend[0] is not used; used entries are from [1] to [MaxBackends] */ } AsyncQueueControl; @@ -265,7 +265,7 @@ static SlruCtlData AsyncCtlData; #define AsyncCtl (&AsyncCtlData) #define QUEUE_PAGESIZE BLCKSZ -#define QUEUE_FULL_WARN_INTERVAL 5000 /* warn at most once every 5s */ +#define QUEUE_FULL_WARN_INTERVAL 5000 /* warn at most once every 5s */ /* * slru.c currently assumes that all filenames are four characters of hex @@ -291,7 +291,7 @@ static SlruCtlData AsyncCtlData; * (ie, have committed a LISTEN on). It is a simple list of channel names, * allocated in TopMemoryContext. */ -static List *listenChannels = NIL; /* list of C strings */ +static List *listenChannels = NIL; /* list of C strings */ /* * State for pending LISTEN/UNLISTEN actions consists of an ordered list of @@ -316,7 +316,7 @@ typedef struct char channel[FLEXIBLE_ARRAY_MEMBER]; /* nul-terminated string */ } ListenAction; -static List *pendingActions = NIL; /* list of ListenAction */ +static List *pendingActions = NIL; /* list of ListenAction */ static List *upperPendingActions = NIL; /* list of upper-xact lists */ @@ -342,9 +342,9 @@ typedef struct Notification char *payload; /* payload string (can be empty) */ } Notification; -static List *pendingNotifies = NIL; /* list of Notifications */ +static List *pendingNotifies = NIL; /* list of Notifications */ -static List *upperPendingNotifies = NIL; /* list of upper-xact lists */ +static List *upperPendingNotifies = NIL; /* list of upper-xact lists */ /* * Inbound notifications are initially processed by HandleNotifyInterrupt(), @@ -853,7 +853,7 @@ PreCommit_Notify(void) if (asyncQueueIsFull()) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("too many notifications in the NOTIFY queue"))); + errmsg("too many notifications in the NOTIFY queue"))); nextNotify = asyncQueueAddEntries(nextNotify); LWLockRelease(AsyncQueueLock); } @@ -1184,7 +1184,7 @@ asyncQueueUnregister(void) { bool advanceTail; - Assert(listenChannels == NIL); /* else caller error */ + Assert(listenChannels == NIL); /* else caller error */ if (!amRegisteredListener) /* nothing to do */ return; @@ -1825,7 +1825,7 @@ asyncQueueReadAllNotifications(void) /* we only want to read as far as head */ copysize = QUEUE_POS_OFFSET(head) - curoffset; if (copysize < 0) - copysize = 0; /* just for safety */ + copysize = 0; /* just for safety */ } else { diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 9a08a07319..cf4590cacc 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -127,7 +127,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel) if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot cluster temporary tables of other sessions"))); + errmsg("cannot cluster temporary tables of other sessions"))); if (stmt->indexname == NULL) { @@ -171,8 +171,8 @@ cluster(ClusterStmt *stmt, bool isTopLevel) if (!OidIsValid(indexOid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("index \"%s\" for table \"%s\" does not exist", - stmt->indexname, stmt->relation->relname))); + errmsg("index \"%s\" for table \"%s\" does not exist", + stmt->indexname, stmt->relation->relname))); } /* close relation, keep lock till commit */ @@ -326,7 +326,7 @@ cluster_rel(Oid tableOid, Oid indexOid, bool recheck, bool verbose) * Check that the index is still the one with indisclustered set. */ tuple = SearchSysCache1(INDEXRELID, ObjectIdGetDatum(indexOid)); - if (!HeapTupleIsValid(tuple)) /* probably can't happen */ + if (!HeapTupleIsValid(tuple)) /* probably can't happen */ { relation_close(OldHeap, AccessExclusiveLock); return; @@ -362,11 +362,11 @@ cluster_rel(Oid tableOid, Oid indexOid, bool recheck, bool verbose) if (OidIsValid(indexOid)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot cluster temporary tables of other sessions"))); + errmsg("cannot cluster temporary tables of other sessions"))); else ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot vacuum temporary tables of other sessions"))); + errmsg("cannot vacuum temporary tables of other sessions"))); } /* diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c index 91b65b174d..7f2ce4db4c 100644 --- a/src/backend/commands/collationcmds.c +++ b/src/backend/commands/collationcmds.c @@ -37,6 +37,14 @@ #include "utils/syscache.h" +typedef struct +{ + char *localename; /* name of locale, as per "locale -a" */ + char *alias; /* shortened alias for same */ + int enc; /* encoding */ +} CollAliasData; + + /* * CREATE COLLATION */ @@ -196,7 +204,8 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e collcollate, collctype, collversion, - if_not_exists); + if_not_exists, + false); /* not quiet */ if (!OidIsValid(newoid)) return InvalidObjectAddress; @@ -345,12 +354,32 @@ pg_collation_actual_version(PG_FUNCTION_ARGS) /* + * Check a string to see if it is pure ASCII + */ +static bool +is_all_ascii(const char *str) +{ + while (*str) + { + if (IS_HIGHBIT_SET(*str)) + return false; + str++; + } + return true; +} + +/* will we use "locale -a" in pg_import_system_collations? */ +#if defined(HAVE_LOCALE_T) && !defined(WIN32) +#define READ_LOCALE_A_OUTPUT +#endif + +#ifdef READ_LOCALE_A_OUTPUT +/* * "Normalize" a libc locale name, stripping off encoding tags such as * ".utf8" (e.g., "en_US.utf8" -> "en_US", but "br_FR.iso885915@euro" * -> "br_FR@euro"). Return true if a new, different name was * generated. */ -pg_attribute_unused() static bool normalize_libc_locale_name(char *new, const char *old) { @@ -379,8 +408,26 @@ normalize_libc_locale_name(char *new, const char *old) return changed; } +/* + * qsort comparator for CollAliasData items + */ +static int +cmpaliases(const void *a, const void *b) +{ + const CollAliasData *ca = (const CollAliasData *) a; + const CollAliasData *cb = (const CollAliasData *) b; + + /* comparing localename is enough because other fields are derived */ + return strcmp(ca->localename, cb->localename); +} +#endif /* READ_LOCALE_A_OUTPUT */ + #ifdef USE_ICU +/* + * Get the ICU language tag for a locale name. + * The result is a palloc'd string. + */ static char * get_icu_language_tag(const char *localename) { @@ -391,178 +438,227 @@ get_icu_language_tag(const char *localename) uloc_toLanguageTag(localename, buf, sizeof(buf), TRUE, &status); if (U_FAILURE(status)) ereport(ERROR, - (errmsg("could not convert locale name \"%s\" to language tag: %s", - localename, u_errorName(status)))); + (errmsg("could not convert locale name \"%s\" to language tag: %s", + localename, u_errorName(status)))); return pstrdup(buf); } - +/* + * Get a comment (specifically, the display name) for an ICU locale. + * The result is a palloc'd string, or NULL if we can't get a comment + * or find that it's not all ASCII. (We can *not* accept non-ASCII + * comments, because the contents of template0 must be encoding-agnostic.) + */ static char * get_icu_locale_comment(const char *localename) { UErrorCode status; UChar displayname[128]; int32 len_uchar; + int32 i; char *result; status = U_ZERO_ERROR; - len_uchar = uloc_getDisplayName(localename, "en", &displayname[0], sizeof(displayname), &status); + len_uchar = uloc_getDisplayName(localename, "en", + displayname, lengthof(displayname), + &status); if (U_FAILURE(status)) - ereport(ERROR, - (errmsg("could get display name for locale \"%s\": %s", - localename, u_errorName(status)))); + return NULL; /* no good reason to raise an error */ + + /* Check for non-ASCII comment (can't use is_all_ascii for this) */ + for (i = 0; i < len_uchar; i++) + { + if (displayname[i] > 127) + return NULL; + } - icu_from_uchar(&result, displayname, len_uchar); + /* OK, transcribe */ + result = palloc(len_uchar + 1); + for (i = 0; i < len_uchar; i++) + result[i] = displayname[i]; + result[len_uchar] = '\0'; return result; } -#endif /* USE_ICU */ +#endif /* USE_ICU */ +/* + * pg_import_system_collations: add known system collations to pg_collation + */ Datum pg_import_system_collations(PG_FUNCTION_ARGS) { - bool if_not_exists = PG_GETARG_BOOL(0); - Oid nspid = PG_GETARG_OID(1); + Oid nspid = PG_GETARG_OID(0); + int ncreated = 0; -#if defined(HAVE_LOCALE_T) && !defined(WIN32) - FILE *locale_a_handle; - char localebuf[NAMEDATALEN]; /* we assume ASCII so this is fine */ - int count = 0; - List *aliaslist = NIL; - List *localelist = NIL; - List *enclist = NIL; - ListCell *lca, - *lcl, - *lce; -#endif + /* silence compiler warning if we have no locale implementation at all */ + (void) nspid; if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errmsg("must be superuser to import system collations")))); -#if !(defined(HAVE_LOCALE_T) && !defined(WIN32)) && !defined(USE_ICU) - /* silence compiler warnings */ - (void) if_not_exists; - (void) nspid; -#endif + /* Load collations known to libc, using "locale -a" to enumerate them */ +#ifdef READ_LOCALE_A_OUTPUT + { + FILE *locale_a_handle; + char localebuf[NAMEDATALEN]; /* we assume ASCII so this is fine */ + int nvalid = 0; + Oid collid; + CollAliasData *aliases; + int naliases, + maxaliases, + i; + + /* expansible array of aliases */ + maxaliases = 100; + aliases = (CollAliasData *) palloc(maxaliases * sizeof(CollAliasData)); + naliases = 0; + + locale_a_handle = OpenPipeStream("locale -a", "r"); + if (locale_a_handle == NULL) + ereport(ERROR, + (errcode_for_file_access(), + errmsg("could not execute command \"%s\": %m", + "locale -a"))); -#if defined(HAVE_LOCALE_T) && !defined(WIN32) - locale_a_handle = OpenPipeStream("locale -a", "r"); - if (locale_a_handle == NULL) - ereport(ERROR, - (errcode_for_file_access(), - errmsg("could not execute command \"%s\": %m", - "locale -a"))); + while (fgets(localebuf, sizeof(localebuf), locale_a_handle)) + { + size_t len; + int enc; + char alias[NAMEDATALEN]; - while (fgets(localebuf, sizeof(localebuf), locale_a_handle)) - { - int i; - size_t len; - int enc; - bool skip; - char alias[NAMEDATALEN]; + len = strlen(localebuf); - len = strlen(localebuf); + if (len == 0 || localebuf[len - 1] != '\n') + { + elog(DEBUG1, "locale name too long, skipped: \"%s\"", localebuf); + continue; + } + localebuf[len - 1] = '\0'; - if (len == 0 || localebuf[len - 1] != '\n') - { - elog(DEBUG1, "locale name too long, skipped: \"%s\"", localebuf); - continue; - } - localebuf[len - 1] = '\0'; + /* + * Some systems have locale names that don't consist entirely of + * ASCII letters (such as "bokmål" or "français"). + * This is pretty silly, since we need the locale itself to + * interpret the non-ASCII characters. We can't do much with + * those, so we filter them out. + */ + if (!is_all_ascii(localebuf)) + { + elog(DEBUG1, "locale name has non-ASCII characters, skipped: \"%s\"", localebuf); + continue; + } - /* - * Some systems have locale names that don't consist entirely of ASCII - * letters (such as "bokmål" or "français"). This is - * pretty silly, since we need the locale itself to interpret the - * non-ASCII characters. We can't do much with those, so we filter - * them out. - */ - skip = false; - for (i = 0; i < len; i++) - { - if (IS_HIGHBIT_SET(localebuf[i])) + enc = pg_get_encoding_from_locale(localebuf, false); + if (enc < 0) { - skip = true; - break; + /* error message printed by pg_get_encoding_from_locale() */ + continue; } - } - if (skip) - { - elog(DEBUG1, "locale name has non-ASCII characters, skipped: \"%s\"", localebuf); - continue; - } + if (!PG_VALID_BE_ENCODING(enc)) + continue; /* ignore locales for client-only encodings */ + if (enc == PG_SQL_ASCII) + continue; /* C/POSIX are already in the catalog */ - enc = pg_get_encoding_from_locale(localebuf, false); - if (enc < 0) - { - /* error message printed by pg_get_encoding_from_locale() */ - continue; - } - if (!PG_VALID_BE_ENCODING(enc)) - continue; /* ignore locales for client-only encodings */ - if (enc == PG_SQL_ASCII) - continue; /* C/POSIX are already in the catalog */ + /* count valid locales found in operating system */ + nvalid++; - count++; + /* + * Create a collation named the same as the locale, but quietly + * doing nothing if it already exists. This is the behavior we + * need even at initdb time, because some versions of "locale -a" + * can report the same locale name more than once. And it's + * convenient for later import runs, too, since you just about + * always want to add on new locales without a lot of chatter + * about existing ones. + */ + collid = CollationCreate(localebuf, nspid, GetUserId(), + COLLPROVIDER_LIBC, enc, + localebuf, localebuf, + get_collation_actual_version(COLLPROVIDER_LIBC, localebuf), + true, true); + if (OidIsValid(collid)) + { + ncreated++; - CollationCreate(localebuf, nspid, GetUserId(), COLLPROVIDER_LIBC, enc, - localebuf, localebuf, - get_collation_actual_version(COLLPROVIDER_LIBC, localebuf), - if_not_exists); + /* Must do CCI between inserts to handle duplicates correctly */ + CommandCounterIncrement(); + } - CommandCounterIncrement(); + /* + * Generate aliases such as "en_US" in addition to "en_US.utf8" + * for ease of use. Note that collation names are unique per + * encoding only, so this doesn't clash with "en_US" for LATIN1, + * say. + * + * However, it might conflict with a name we'll see later in the + * "locale -a" output. So save up the aliases and try to add them + * after we've read all the output. + */ + if (normalize_libc_locale_name(alias, localebuf)) + { + if (naliases >= maxaliases) + { + maxaliases *= 2; + aliases = (CollAliasData *) + repalloc(aliases, maxaliases * sizeof(CollAliasData)); + } + aliases[naliases].localename = pstrdup(localebuf); + aliases[naliases].alias = pstrdup(alias); + aliases[naliases].enc = enc; + naliases++; + } + } + + ClosePipeStream(locale_a_handle); /* - * Generate aliases such as "en_US" in addition to "en_US.utf8" for - * ease of use. Note that collation names are unique per encoding - * only, so this doesn't clash with "en_US" for LATIN1, say. - * - * However, it might conflict with a name we'll see later in the - * "locale -a" output. So save up the aliases and try to add them - * after we've read all the output. + * Before processing the aliases, sort them by locale name. The point + * here is that if "locale -a" gives us multiple locale names with the + * same encoding and base name, say "en_US.utf8" and "en_US.utf-8", we + * want to pick a deterministic one of them. First in ASCII sort + * order is a good enough rule. (Before PG 10, the code corresponding + * to this logic in initdb.c had an additional ordering rule, to + * prefer the locale name exactly matching the alias, if any. We + * don't need to consider that here, because we would have already + * created such a pg_collation entry above, and that one will win.) */ - if (normalize_libc_locale_name(alias, localebuf)) + if (naliases > 1) + qsort((void *) aliases, naliases, sizeof(CollAliasData), cmpaliases); + + /* Now add aliases, ignoring any that match pre-existing entries */ + for (i = 0; i < naliases; i++) { - aliaslist = lappend(aliaslist, pstrdup(alias)); - localelist = lappend(localelist, pstrdup(localebuf)); - enclist = lappend_int(enclist, enc); - } - } + char *locale = aliases[i].localename; + char *alias = aliases[i].alias; + int enc = aliases[i].enc; + + collid = CollationCreate(alias, nspid, GetUserId(), + COLLPROVIDER_LIBC, enc, + locale, locale, + get_collation_actual_version(COLLPROVIDER_LIBC, locale), + true, true); + if (OidIsValid(collid)) + { + ncreated++; - ClosePipeStream(locale_a_handle); + CommandCounterIncrement(); + } + } - /* Now try to add any aliases we created */ - forthree(lca, aliaslist, lcl, localelist, lce, enclist) - { - char *alias = (char *) lfirst(lca); - char *locale = (char *) lfirst(lcl); - int enc = lfirst_int(lce); - - CollationCreate(alias, nspid, GetUserId(), COLLPROVIDER_LIBC, enc, - locale, locale, - get_collation_actual_version(COLLPROVIDER_LIBC, locale), - true); - CommandCounterIncrement(); + /* Give a warning if "locale -a" seems to be malfunctioning */ + if (nvalid == 0) + ereport(WARNING, + (errmsg("no usable system locales were found"))); } +#endif /* READ_LOCALE_A_OUTPUT */ - if (count == 0) - ereport(WARNING, - (errmsg("no usable system locales were found"))); -#endif /* not HAVE_LOCALE_T && not WIN32 */ - + /* Load collations known to ICU */ #ifdef USE_ICU - if (!is_encoding_supported_by_icu(GetDatabaseEncoding())) - { - ereport(NOTICE, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("encoding \"%s\" not supported by ICU", - pg_encoding_to_char(GetDatabaseEncoding())))); - } - else { int i; @@ -574,6 +670,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS) { const char *name; char *langtag; + char *icucomment; const char *collcollate; UEnumeration *en; UErrorCode status; @@ -587,14 +684,31 @@ pg_import_system_collations(PG_FUNCTION_ARGS) langtag = get_icu_language_tag(name); collcollate = U_ICU_VERSION_MAJOR_NUM >= 54 ? langtag : name; + + /* + * Be paranoid about not allowing any non-ASCII strings into + * pg_collation + */ + if (!is_all_ascii(langtag) || !is_all_ascii(collcollate)) + continue; + collid = CollationCreate(psprintf("%s-x-icu", langtag), - nspid, GetUserId(), COLLPROVIDER_ICU, -1, + nspid, GetUserId(), + COLLPROVIDER_ICU, -1, collcollate, collcollate, - get_collation_actual_version(COLLPROVIDER_ICU, collcollate), - if_not_exists); + get_collation_actual_version(COLLPROVIDER_ICU, collcollate), + true, true); + if (OidIsValid(collid)) + { + ncreated++; - CreateComments(collid, CollationRelationId, 0, - get_icu_locale_comment(name)); + CommandCounterIncrement(); + + icucomment = get_icu_locale_comment(name); + if (icucomment) + CreateComments(collid, CollationRelationId, 0, + icucomment); + } /* * Add keyword variants @@ -603,8 +717,8 @@ pg_import_system_collations(PG_FUNCTION_ARGS) en = ucol_getKeywordValuesForLocale("collation", name, TRUE, &status); if (U_FAILURE(status)) ereport(ERROR, - (errmsg("could not get keyword values for locale \"%s\": %s", - name, u_errorName(status)))); + (errmsg("could not get keyword values for locale \"%s\": %s", + name, u_errorName(status)))); status = U_ZERO_ERROR; uenum_reset(en, &status); @@ -614,22 +728,40 @@ pg_import_system_collations(PG_FUNCTION_ARGS) langtag = get_icu_language_tag(localeid); collcollate = U_ICU_VERSION_MAJOR_NUM >= 54 ? langtag : localeid; + + /* + * Be paranoid about not allowing any non-ASCII strings into + * pg_collation + */ + if (!is_all_ascii(langtag) || !is_all_ascii(collcollate)) + continue; + collid = CollationCreate(psprintf("%s-x-icu", langtag), - nspid, GetUserId(), COLLPROVIDER_ICU, -1, + nspid, GetUserId(), + COLLPROVIDER_ICU, -1, collcollate, collcollate, - get_collation_actual_version(COLLPROVIDER_ICU, collcollate), - if_not_exists); - CreateComments(collid, CollationRelationId, 0, - get_icu_locale_comment(localeid)); + get_collation_actual_version(COLLPROVIDER_ICU, collcollate), + true, true); + if (OidIsValid(collid)) + { + ncreated++; + + CommandCounterIncrement(); + + icucomment = get_icu_locale_comment(name); + if (icucomment) + CreateComments(collid, CollationRelationId, 0, + icucomment); + } } if (U_FAILURE(status)) ereport(ERROR, - (errmsg("could not get keyword values for locale \"%s\": %s", - name, u_errorName(status)))); + (errmsg("could not get keyword values for locale \"%s\": %s", + name, u_errorName(status)))); uenum_close(en); } } -#endif +#endif /* USE_ICU */ - PG_RETURN_VOID(); + PG_RETURN_INT32(ncreated); } diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 3ae52116f4..3f692b6441 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -124,7 +124,7 @@ typedef struct CopyStateData bool fe_eof; /* true if detected end of copy data */ EolType eol_type; /* EOL type of input */ int file_encoding; /* file or remote side's character encoding */ - bool need_transcoding; /* file encoding diff from server? */ + bool need_transcoding; /* file encoding diff from server? */ bool encoding_embeds_ascii; /* ASCII can be non-first byte? */ /* parameters from the COPY command */ @@ -141,17 +141,17 @@ typedef struct CopyStateData bool header_line; /* CSV header line? */ char *null_print; /* NULL marker string (server encoding!) */ int null_print_len; /* length of same */ - char *null_print_client; /* same converted to file encoding */ + char *null_print_client; /* same converted to file encoding */ char *delim; /* column delimiter (must be 1 byte) */ char *quote; /* CSV quote char (must be 1 byte) */ char *escape; /* CSV escape char (must be 1 byte) */ List *force_quote; /* list of column names */ bool force_quote_all; /* FORCE_QUOTE *? */ - bool *force_quote_flags; /* per-column CSV FQ flags */ + bool *force_quote_flags; /* per-column CSV FQ flags */ List *force_notnull; /* list of column names */ bool *force_notnull_flags; /* per-column CSV FNN flags */ List *force_null; /* list of column names */ - bool *force_null_flags; /* per-column CSV FN flags */ + bool *force_null_flags; /* per-column CSV FN flags */ bool convert_selectively; /* do selective binary conversion? */ List *convert_select; /* list of column names (can be NIL) */ bool *convert_select_flags; /* per-column CSV/TEXT CS flags */ @@ -184,7 +184,7 @@ typedef struct CopyStateData Oid *typioparams; /* array of element types for in_functions */ int *defmap; /* array of default att numbers */ ExprState **defexprs; /* array of default att expressions */ - bool volatile_defexprs; /* is any of defexprs volatile? */ + bool volatile_defexprs; /* is any of defexprs volatile? */ List *range_table; PartitionDispatch *partition_dispatch_info; @@ -217,7 +217,7 @@ typedef struct CopyStateData * can display it in error messages if appropriate. */ StringInfoData line_buf; - bool line_buf_converted; /* converted to server encoding? */ + bool line_buf_converted; /* converted to server encoding? */ bool line_buf_valid; /* contains the row being processed? */ /* @@ -386,10 +386,10 @@ SendCopyBegin(CopyState cstate) int i; pq_beginmessage(&buf, 'H'); - pq_sendbyte(&buf, format); /* overall format */ + pq_sendbyte(&buf, format); /* overall format */ pq_sendint(&buf, natts, 2); for (i = 0; i < natts; i++) - pq_sendint(&buf, format, 2); /* per-column formats */ + pq_sendint(&buf, format, 2); /* per-column formats */ pq_endmessage(&buf); cstate->copy_dest = COPY_NEW_FE; } @@ -399,7 +399,7 @@ SendCopyBegin(CopyState cstate) if (cstate->binary) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("COPY BINARY is not supported to stdout or from stdin"))); + errmsg("COPY BINARY is not supported to stdout or from stdin"))); pq_putemptymessage('H'); /* grottiness needed for old COPY OUT protocol */ pq_startcopyout(); @@ -419,10 +419,10 @@ ReceiveCopyBegin(CopyState cstate) int i; pq_beginmessage(&buf, 'G'); - pq_sendbyte(&buf, format); /* overall format */ + pq_sendbyte(&buf, format); /* overall format */ pq_sendint(&buf, natts, 2); for (i = 0; i < natts; i++) - pq_sendint(&buf, format, 2); /* per-column formats */ + pq_sendint(&buf, format, 2); /* per-column formats */ pq_endmessage(&buf); cstate->copy_dest = COPY_NEW_FE; cstate->fe_msgbuf = makeStringInfo(); @@ -433,7 +433,7 @@ ReceiveCopyBegin(CopyState cstate) if (cstate->binary) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("COPY BINARY is not supported to stdout or from stdin"))); + errmsg("COPY BINARY is not supported to stdout or from stdin"))); pq_putemptymessage('G'); /* any error in old protocol will make us lose sync */ pq_startmsgread(); @@ -645,20 +645,20 @@ CopyGetData(CopyState cstate, void *databuf, int minread, int maxread) RESUME_CANCEL_INTERRUPTS(); switch (mtype) { - case 'd': /* CopyData */ + case 'd': /* CopyData */ break; - case 'c': /* CopyDone */ + case 'c': /* CopyDone */ /* COPY IN correctly terminated by frontend */ cstate->fe_eof = true; return bytesread; - case 'f': /* CopyFail */ + case 'f': /* CopyFail */ ereport(ERROR, (errcode(ERRCODE_QUERY_CANCELED), errmsg("COPY from stdin failed: %s", - pq_getmsgstring(cstate->fe_msgbuf)))); + pq_getmsgstring(cstate->fe_msgbuf)))); break; - case 'H': /* Flush */ - case 'S': /* Sync */ + case 'H': /* Flush */ + case 'S': /* Sync */ /* * Ignore Flush/Sync for the convenience of client @@ -837,13 +837,13 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to COPY to or from an external program"), errhint("Anyone can COPY to stdout or from stdin. " - "psql's \\copy command also works for anyone."))); + "psql's \\copy command also works for anyone."))); else ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("must be superuser to COPY to or from a file"), errhint("Anyone can COPY to stdout or from stdin. " - "psql's \\copy command also works for anyone."))); + "psql's \\copy command also works for anyone."))); } if (stmt->relation) @@ -903,7 +903,7 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt, if (is_from) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("COPY FROM not supported with row-level security"), + errmsg("COPY FROM not supported with row-level security"), errhint("Use INSERT statements instead."))); /* @@ -1292,14 +1292,14 @@ ProcessCopyOptions(ParseState *pstate, if (strlen(cstate->delim) != 1) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("COPY delimiter must be a single one-byte character"))); + errmsg("COPY delimiter must be a single one-byte character"))); /* Disallow end-of-line characters */ if (strchr(cstate->delim, '\r') != NULL || strchr(cstate->delim, '\n') != NULL) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("COPY delimiter cannot be newline or carriage return"))); + errmsg("COPY delimiter cannot be newline or carriage return"))); if (strchr(cstate->null_print, '\r') != NULL || strchr(cstate->null_print, '\n') != NULL) @@ -1375,7 +1375,7 @@ ProcessCopyOptions(ParseState *pstate, if (cstate->force_notnull != NIL && !is_from) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("COPY force not null only available using COPY FROM"))); + errmsg("COPY force not null only available using COPY FROM"))); /* Check force_null */ if (!cstate->csv_mode && cstate->force_null != NIL) @@ -1392,7 +1392,7 @@ ProcessCopyOptions(ParseState *pstate, if (strchr(cstate->null_print, cstate->delim[0]) != NULL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("COPY delimiter must not appear in the NULL specification"))); + errmsg("COPY delimiter must not appear in the NULL specification"))); /* Don't allow the CSV quote char to appear in the null string. */ if (cstate->csv_mode && @@ -1575,7 +1575,7 @@ BeginCopy(ParseState *pstate, { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("DO INSTEAD NOTHING rules are not supported for COPY"))); + errmsg("DO INSTEAD NOTHING rules are not supported for COPY"))); } else if (list_length(rewritten) > 1) { @@ -1593,7 +1593,7 @@ BeginCopy(ParseState *pstate, if (q->querySource == QSRC_NON_INSTEAD_RULE) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("DO ALSO rules are not supported for the COPY"))); + errmsg("DO ALSO rules are not supported for the COPY"))); } ereport(ERROR, @@ -1646,7 +1646,7 @@ BeginCopy(ParseState *pstate, if (!list_member_oid(plan->relationOids, queryRelId)) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("relation referenced by COPY statement has changed"))); + errmsg("relation referenced by COPY statement has changed"))); } /* @@ -1704,8 +1704,8 @@ BeginCopy(ParseState *pstate, if (!list_member_int(cstate->attnumlist, attnum)) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("FORCE_QUOTE column \"%s\" not referenced by COPY", - NameStr(tupDesc->attrs[attnum - 1]->attname)))); + errmsg("FORCE_QUOTE column \"%s\" not referenced by COPY", + NameStr(tupDesc->attrs[attnum - 1]->attname)))); cstate->force_quote_flags[attnum - 1] = true; } } @@ -1726,8 +1726,8 @@ BeginCopy(ParseState *pstate, if (!list_member_int(cstate->attnumlist, attnum)) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("FORCE_NOT_NULL column \"%s\" not referenced by COPY", - NameStr(tupDesc->attrs[attnum - 1]->attname)))); + errmsg("FORCE_NOT_NULL column \"%s\" not referenced by COPY", + NameStr(tupDesc->attrs[attnum - 1]->attname)))); cstate->force_notnull_flags[attnum - 1] = true; } } @@ -1748,8 +1748,8 @@ BeginCopy(ParseState *pstate, if (!list_member_int(cstate->attnumlist, attnum)) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("FORCE_NULL column \"%s\" not referenced by COPY", - NameStr(tupDesc->attrs[attnum - 1]->attname)))); + errmsg("FORCE_NULL column \"%s\" not referenced by COPY", + NameStr(tupDesc->attrs[attnum - 1]->attname)))); cstate->force_null_flags[attnum - 1] = true; } } @@ -1772,7 +1772,7 @@ BeginCopy(ParseState *pstate, ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), errmsg_internal("selected column \"%s\" not referenced by COPY", - NameStr(tupDesc->attrs[attnum - 1]->attname)))); + NameStr(tupDesc->attrs[attnum - 1]->attname)))); cstate->convert_select_flags[attnum - 1] = true; } } @@ -1792,7 +1792,7 @@ BeginCopy(ParseState *pstate, /* See Multibyte encoding comment above */ cstate->encoding_embeds_ascii = PG_ENCODING_IS_CLIENT_ONLY(cstate->file_encoding); - cstate->copy_dest = COPY_FILE; /* default */ + cstate->copy_dest = COPY_FILE; /* default */ #ifdef PGXC /* @@ -1960,7 +1960,7 @@ BeginCopyTo(ParseState *pstate, if (!is_absolute_path(filename)) ereport(ERROR, (errcode(ERRCODE_INVALID_NAME), - errmsg("relative path not allowed for COPY to file"))); + errmsg("relative path not allowed for COPY to file"))); oumask = umask(S_IWGRP | S_IWOTH); cstate->copy_file = AllocateFile(cstate->filename, PG_BINARY_W); @@ -2070,7 +2070,7 @@ CopyTo(CopyState cstate) tupDesc = cstate->queryDesc->tupDesc; attr = tupDesc->attrs; num_phys_attrs = tupDesc->natts; - cstate->null_print_client = cstate->null_print; /* default */ + cstate->null_print_client = cstate->null_print; /* default */ /* We use fe_msgbuf as a per-row buffer regardless of copy_dest */ cstate->fe_msgbuf = makeStringInfo(); @@ -2138,8 +2138,8 @@ CopyTo(CopyState cstate) */ if (cstate->need_transcoding) cstate->null_print_client = pg_server_to_any(cstate->null_print, - cstate->null_print_len, - cstate->file_encoding); + cstate->null_print_len, + cstate->file_encoding); /* if a header has been requested send the line */ if (cstate->header_line) @@ -2276,7 +2276,7 @@ CopyOneRowTo(CopyState cstate, Oid tupleOid, Datum *values, bool *nulls) if (cstate->oids) { string = DatumGetCString(DirectFunctionCall1(oidout, - ObjectIdGetDatum(tupleOid))); + ObjectIdGetDatum(tupleOid))); CopySendString(cstate, string); need_delim = true; } @@ -2574,7 +2574,7 @@ CopyFrom(CopyState cstate) errmsg("cannot perform FREEZE because of prior transaction activity"))); if (cstate->rel->rd_createSubid != GetCurrentSubTransactionId() && - cstate->rel->rd_newRelfilenodeSubid != GetCurrentSubTransactionId()) + cstate->rel->rd_newRelfilenodeSubid != GetCurrentSubTransactionId()) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("cannot perform FREEZE because the table was not created or truncated in the current subtransaction"))); @@ -2743,7 +2743,7 @@ CopyFrom(CopyState cstate) * partition, respectively. */ leaf_part_index = ExecFindPartition(resultRelInfo, - cstate->partition_dispatch_info, + cstate->partition_dispatch_info, slot, estate); Assert(leaf_part_index >= 0 && @@ -2771,7 +2771,7 @@ CopyFrom(CopyState cstate) if (resultRelInfo->ri_FdwRoutine) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot route inserted tuples to a foreign table"))); + errmsg("cannot route inserted tuples to a foreign table"))); /* * For ExecInsertIndexTuples() to work on the partition's indexes @@ -2813,7 +2813,7 @@ CopyFrom(CopyState cstate) if (slot == NULL) /* "do nothing" */ skip_tuple = true; - else /* trigger might have changed tuple */ + else /* trigger might have changed tuple */ tuple = ExecMaterializeSlot(slot); } @@ -2882,7 +2882,7 @@ CopyFrom(CopyState cstate) if (resultRelInfo->ri_NumIndices > 0) recheckIndexes = ExecInsertIndexTuples(slot, - &(tuple->t_self), + &(tuple->t_self), estate, false, NULL, @@ -3354,7 +3354,7 @@ BeginCopyFrom(ParseState *pstate, if ((tmp >> 16) != 0) ereport(ERROR, (errcode(ERRCODE_BAD_COPY_FILE_FORMAT), - errmsg("unrecognized critical flags in COPY file header"))); + errmsg("unrecognized critical flags in COPY file header"))); /* Header extension length */ if (!CopyGetInt32(cstate, &tmp) || tmp < 0) @@ -3552,7 +3552,7 @@ NextCopyFrom(CopyState cstate, ExprContext *econtext, cstate->cur_attname = "oid"; cstate->cur_attval = string; *tupleOid = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(string))); + CStringGetDatum(string))); if (*tupleOid == InvalidOid) ereport(ERROR, (errcode(ERRCODE_BAD_COPY_FILE_FORMAT), @@ -3715,8 +3715,8 @@ NextCopyFrom(CopyState cstate, ExprContext *econtext, loaded_oid = DatumGetObjectId(CopyReadBinaryAttribute(cstate, 0, - &cstate->oid_in_function, - cstate->oid_typioparam, + &cstate->oid_in_function, + cstate->oid_typioparam, -1, &isnull)); if (isnull || loaded_oid == InvalidOid) @@ -4130,8 +4130,8 @@ CopyReadLineText(CopyState cstate) if (c == '\n') { - raw_buf_ptr++; /* eat newline */ - cstate->eol_type = EOL_CRNL; /* in case not set yet */ + raw_buf_ptr++; /* eat newline */ + cstate->eol_type = EOL_CRNL; /* in case not set yet */ } else { @@ -4140,10 +4140,10 @@ CopyReadLineText(CopyState cstate) ereport(ERROR, (errcode(ERRCODE_BAD_COPY_FILE_FORMAT), !cstate->csv_mode ? - errmsg("literal carriage return found in data") : - errmsg("unquoted carriage return found in data"), + errmsg("literal carriage return found in data") : + errmsg("unquoted carriage return found in data"), !cstate->csv_mode ? - errhint("Use \"\\r\" to represent carriage return.") : + errhint("Use \"\\r\" to represent carriage return.") : errhint("Use quoted CSV field to represent carriage return."))); /* @@ -4160,7 +4160,7 @@ CopyReadLineText(CopyState cstate) errmsg("literal carriage return found in data") : errmsg("unquoted carriage return found in data"), !cstate->csv_mode ? - errhint("Use \"\\r\" to represent carriage return.") : + errhint("Use \"\\r\" to represent carriage return.") : errhint("Use quoted CSV field to represent carriage return."))); /* If reach here, we have found the line terminator */ break; @@ -4177,7 +4177,7 @@ CopyReadLineText(CopyState cstate) errmsg("unquoted newline found in data"), !cstate->csv_mode ? errhint("Use \"\\n\" to represent newline.") : - errhint("Use quoted CSV field to represent newline."))); + errhint("Use quoted CSV field to represent newline."))); cstate->eol_type = EOL_NL; /* in case not set yet */ /* If reach here, we have found the line terminator */ break; @@ -4268,8 +4268,8 @@ CopyReadLineText(CopyState cstate) */ if (prev_raw_ptr > cstate->raw_buf_index) appendBinaryStringInfo(&cstate->line_buf, - cstate->raw_buf + cstate->raw_buf_index, - prev_raw_ptr - cstate->raw_buf_index); + cstate->raw_buf + cstate->raw_buf_index, + prev_raw_ptr - cstate->raw_buf_index); cstate->raw_buf_index = raw_buf_ptr; result = true; /* report EOF */ break; @@ -4903,7 +4903,7 @@ CopyAttributeOutText(CopyState cstate, char *string) break; /* All ASCII control chars are length 1 */ ptr++; - continue; /* fall to end of loop */ + continue; /* fall to end of loop */ } /* if we get here, we need to convert the control char */ DUMPSOFAR(); @@ -4963,7 +4963,7 @@ CopyAttributeOutText(CopyState cstate, char *string) break; /* All ASCII control chars are length 1 */ ptr++; - continue; /* fall to end of loop */ + continue; /* fall to end of loop */ } /* if we get here, we need to convert the control char */ DUMPSOFAR(); @@ -5127,8 +5127,8 @@ CopyGetAttnums(TupleDesc tupDesc, Relation rel, List *attnamelist) if (rel != NULL) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" of relation \"%s\" does not exist", - name, RelationGetRelationName(rel)))); + errmsg("column \"%s\" of relation \"%s\" does not exist", + name, RelationGetRelationName(rel)))); else ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c index 06425cc0eb..97f9c55d6e 100644 --- a/src/backend/commands/createas.c +++ b/src/backend/commands/createas.c @@ -288,7 +288,7 @@ ExecCreateTableAs(CreateTableAsStmt *stmt, const char *queryString, { GetUserIdAndSecContext(&save_userid, &save_sec_context); SetUserIdAndSecContext(save_userid, - save_sec_context | SECURITY_RESTRICTED_OPERATION); + save_sec_context | SECURITY_RESTRICTED_OPERATION); save_nestlevel = NewGUCNestLevel(); } @@ -532,7 +532,7 @@ intorel_startup(DestReceiver *self, int operation, TupleDesc typeinfo) for (attnum = 1; attnum <= intoRelationDesc->rd_att->natts; attnum++) rte->insertedCols = bms_add_member(rte->insertedCols, - attnum - FirstLowInvalidHeapAttributeNumber); + attnum - FirstLowInvalidHeapAttributeNumber); ExecCheckRTPerms(list_make1(rte), true); diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index baeb8b591e..ce49f91166 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -334,7 +334,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) * won't change underneath us. */ if (!dbtemplate) - dbtemplate = "template1"; /* Default template database name */ + dbtemplate = "template1"; /* Default template database name */ if (!get_db_info(dbtemplate, ShareLock, &src_dboid, &src_owner, &src_encoding, @@ -441,7 +441,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) if (dst_deftablespace == GLOBALTABLESPACE_OID) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("pg_global cannot be used as default tablespace"))); + errmsg("pg_global cannot be used as default tablespace"))); /* * If we are trying to change the default tablespace of the template, @@ -503,8 +503,8 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) if (CountOtherDBBackends(src_dboid, ¬herbackends, &npreparedxacts)) ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), - errmsg("source database \"%s\" is being accessed by other users", - dbtemplate), + errmsg("source database \"%s\" is being accessed by other users", + dbtemplate), errdetail_busy_db(notherbackends, npreparedxacts))); /* @@ -757,8 +757,8 @@ check_encoding_locale_matches(int encoding, const char *collate, const char *cty errmsg("encoding \"%s\" does not match locale \"%s\"", pg_encoding_to_char(encoding), ctype), - errdetail("The chosen LC_CTYPE setting requires encoding \"%s\".", - pg_encoding_to_char(ctype_encoding)))); + errdetail("The chosen LC_CTYPE setting requires encoding \"%s\".", + pg_encoding_to_char(ctype_encoding)))); if (!(collate_encoding == encoding || collate_encoding == PG_SQL_ASCII || @@ -772,8 +772,8 @@ check_encoding_locale_matches(int encoding, const char *collate, const char *cty errmsg("encoding \"%s\" does not match locale \"%s\"", pg_encoding_to_char(encoding), collate), - errdetail("The chosen LC_COLLATE setting requires encoding \"%s\".", - pg_encoding_to_char(collate_encoding)))); + errdetail("The chosen LC_COLLATE setting requires encoding \"%s\".", + pg_encoding_to_char(collate_encoding)))); } #ifdef PGXC @@ -839,7 +839,7 @@ dropdb(const char *dbname, bool missing_ok) pgdbrel = heap_open(DatabaseRelationId, RowExclusiveLock); if (!get_db_info(dbname, AccessExclusiveLock, &db_id, NULL, NULL, - &db_istemplate, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) + &db_istemplate, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) { if (!missing_ok) { @@ -1163,7 +1163,7 @@ movedb(const char *dbname, const char *tblspcname) pgdbrel = heap_open(DatabaseRelationId, RowExclusiveLock); if (!get_db_info(dbname, AccessExclusiveLock, &db_id, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, &src_tblspcoid, NULL, NULL)) + NULL, NULL, NULL, NULL, NULL, &src_tblspcoid, NULL, NULL)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); @@ -1362,7 +1362,7 @@ movedb(const char *dbname, const char *tblspcname) sysscan = systable_beginscan(pgdbrel, DatabaseNameIndexId, true, NULL, 1, &scankey); oldtuple = systable_getnext(sysscan); - if (!HeapTupleIsValid(oldtuple)) /* shouldn't happen... */ + if (!HeapTupleIsValid(oldtuple)) /* shouldn't happen... */ ereport(ERROR, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname))); @@ -1605,8 +1605,8 @@ AlterDatabase(ParseState *pstate, AlterDatabaseStmt *stmt, bool isTopLevel) if (list_length(stmt->options) != 1) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("option \"%s\" cannot be specified with other options", - dtablespace->defname), + errmsg("option \"%s\" cannot be specified with other options", + dtablespace->defname), parser_errposition(pstate, dtablespace->location))); /* this case isn't allowed within a transaction block */ #ifdef PGXC @@ -1802,7 +1802,7 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId) if (!have_createdb_privilege()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to change owner of database"))); + errmsg("permission denied to change owner of database"))); memset(repl_null, false, sizeof(repl_null)); memset(repl_repl, false, sizeof(repl_repl)); @@ -2131,7 +2131,7 @@ errdetail_busy_db(int notherbackends, int npreparedxacts) notherbackends); else errdetail_plural("There is %d prepared transaction using the database.", - "There are %d prepared transactions using the database.", + "There are %d prepared transactions using the database.", npreparedxacts, npreparedxacts); return 0; /* just to keep ereport macro happy */ diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c index 3ad4eea59e..8eff0ad17b 100644 --- a/src/backend/commands/define.c +++ b/src/backend/commands/define.c @@ -206,7 +206,7 @@ defGetInt64(DefElem *def) * strings. */ return DatumGetInt64(DirectFunctionCall1(int8in, - CStringGetDatum(strVal(def->arg)))); + CStringGetDatum(strVal(def->arg)))); default: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), diff --git a/src/backend/commands/dropcmds.c b/src/backend/commands/dropcmds.c index 9e307eb8af..2b30677d6f 100644 --- a/src/backend/commands/dropcmds.c +++ b/src/backend/commands/dropcmds.c @@ -102,8 +102,8 @@ RemoveObjects(DropStmt *stmt) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is an aggregate function", - NameListToString(castNode(ObjectWithArgs, object)->objname)), - errhint("Use DROP AGGREGATE to drop aggregate functions."))); + NameListToString(castNode(ObjectWithArgs, object)->objname)), + errhint("Use DROP AGGREGATE to drop aggregate functions."))); ReleaseSysCache(tup); } @@ -393,7 +393,7 @@ does_not_exist_skipping(ObjectType objtype, Node *object) msg = gettext_noop("trigger \"%s\" for relation \"%s\" does not exist, skipping"); name = strVal(llast(castNode(List, object))); args = NameListToString(list_truncate(list_copy(castNode(List, object)), - list_length(castNode(List, object)) - 1)); + list_length(castNode(List, object)) - 1)); } break; case OBJECT_POLICY: @@ -402,7 +402,7 @@ does_not_exist_skipping(ObjectType objtype, Node *object) msg = gettext_noop("policy \"%s\" for relation \"%s\" does not exist, skipping"); name = strVal(llast(castNode(List, object))); args = NameListToString(list_truncate(list_copy(castNode(List, object)), - list_length(castNode(List, object)) - 1)); + list_length(castNode(List, object)) - 1)); } break; case OBJECT_EVENT_TRIGGER: @@ -415,7 +415,7 @@ does_not_exist_skipping(ObjectType objtype, Node *object) msg = gettext_noop("rule \"%s\" for relation \"%s\" does not exist, skipping"); name = strVal(llast(castNode(List, object))); args = NameListToString(list_truncate(list_copy(castNode(List, object)), - list_length(castNode(List, object)) - 1)); + list_length(castNode(List, object)) - 1)); } break; case OBJECT_FDW: diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c index 51d8783fb6..8f31300a4c 100644 --- a/src/backend/commands/event_trigger.c +++ b/src/backend/commands/event_trigger.c @@ -57,8 +57,8 @@ typedef struct EventTriggerQueryState bool in_sql_drop; /* table_rewrite */ - Oid table_rewrite_oid; /* InvalidOid, or set for - * table_rewrite event */ + Oid table_rewrite_oid; /* InvalidOid, or set for table_rewrite + * event */ int table_rewrite_reason; /* AT_REWRITE reason */ /* Support for command collection */ @@ -210,7 +210,7 @@ CreateEventTrigger(CreateEventTrigStmt *stmt) else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("unrecognized filter variable \"%s\"", def->defname))); + errmsg("unrecognized filter variable \"%s\"", def->defname))); } /* Validate tag list, if any. */ @@ -585,7 +585,7 @@ AlterEventTriggerOwner_oid(Oid trigOid, Oid newOwnerId) if (!HeapTupleIsValid(tup)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("event trigger with OID %u does not exist", trigOid))); + errmsg("event trigger with OID %u does not exist", trigOid))); AlterEventTriggerOwner_internal(rel, tup, newOwnerId); @@ -615,9 +615,9 @@ AlterEventTriggerOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) if (!superuser_arg(newOwnerId)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to change owner of event trigger \"%s\"", - NameStr(form->evtname)), - errhint("The owner of an event trigger must be a superuser."))); + errmsg("permission denied to change owner of event trigger \"%s\"", + NameStr(form->evtname)), + errhint("The owner of an event trigger must be a superuser."))); form->evtowner = newOwnerId; CatalogTupleUpdate(rel, &tup->t_self, tup); @@ -1466,8 +1466,8 @@ pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS) !currentEventTriggerState->in_sql_drop) ereport(ERROR, (errcode(ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED), - errmsg("%s can only be called in a sql_drop event trigger function", - "pg_event_trigger_dropped_objects()"))); + errmsg("%s can only be called in a sql_drop event trigger function", + "pg_event_trigger_dropped_objects()"))); /* check to see if caller supports us returning a tuplestore */ if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo)) @@ -2123,10 +2123,10 @@ pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS) addr.classId, addr.objectId); schema_oid = heap_getattr(objtup, nspAttnum, - RelationGetDescr(catalog), &isnull); + RelationGetDescr(catalog), &isnull); if (isnull) elog(ERROR, - "invalid null namespace in object %u/%u/%d", + "invalid null namespace in object %u/%u/%d", addr.classId, addr.objectId, addr.objectSubId); /* XXX not quite get_namespace_name_or_temp */ if (isAnyTempNamespace(schema_oid)) @@ -2173,7 +2173,7 @@ pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS) values[i++] = CStringGetTextDatum(CreateCommandTag(cmd->parsetree)); /* object_type */ values[i++] = CStringGetTextDatum(stringify_adefprivs_objtype( - cmd->d.defprivs.objtype)); + cmd->d.defprivs.objtype)); /* schema */ nulls[i++] = true; /* identity */ @@ -2196,7 +2196,7 @@ pg_event_trigger_ddl_commands(PG_FUNCTION_ARGS) "GRANT" : "REVOKE"); /* object_type */ values[i++] = CStringGetTextDatum(stringify_grantobjtype( - cmd->d.grant.istmt->objtype)); + cmd->d.grant.istmt->objtype)); /* schema */ nulls[i++] = true; /* identity */ diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 1bb5d7582f..b35a799100 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -211,8 +211,8 @@ ExplainQuery(ParseState *pstate, ExplainStmt *stmt, const char *queryString, else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("unrecognized value for EXPLAIN option \"%s\": \"%s\"", - opt->defname, p), + errmsg("unrecognized value for EXPLAIN option \"%s\": \"%s\"", + opt->defname, p), parser_errposition(pstate, opt->location))); } else @@ -482,7 +482,7 @@ ExplainOneUtility(Node *utilityStmt, IntoClause *into, ExplainState *es, { if (es->format == EXPLAIN_FORMAT_TEXT) appendStringInfoString(es->str, - "Utility statements have no plan structure\n"); + "Utility statements have no plan structure\n"); else ExplainDummyGroup("Utility Statement", NULL, es); } @@ -850,14 +850,14 @@ ExplainPreScanNode(PlanState *planstate, Bitmapset **rels_used) break; case T_CustomScan: *rels_used = bms_add_members(*rels_used, - ((CustomScan *) plan)->custom_relids); + ((CustomScan *) plan)->custom_relids); break; case T_ModifyTable: *rels_used = bms_add_member(*rels_used, - ((ModifyTable *) plan)->nominalRelation); + ((ModifyTable *) plan)->nominalRelation); if (((ModifyTable *) plan)->exclRelRTI) *rels_used = bms_add_member(*rels_used, - ((ModifyTable *) plan)->exclRelRTI); + ((ModifyTable *) plan)->exclRelRTI); break; default: break; @@ -1415,7 +1415,7 @@ ExplainNode(PlanState *planstate, List *ancestors, { if (es->timing) appendStringInfo(es->str, - " (actual time=%.3f..%.3f rows=%.0f loops=%.0f)", + " (actual time=%.3f..%.3f rows=%.0f loops=%.0f)", startup_sec, total_sec, rows, nloops); else appendStringInfo(es->str, @@ -1504,7 +1504,7 @@ ExplainNode(PlanState *planstate, List *ancestors, planstate, es); if (es->analyze) ExplainPropertyLong("Heap Fetches", - ((IndexOnlyScanState *) planstate)->ioss_HeapFetches, es); + ((IndexOnlyScanState *) planstate)->ioss_HeapFetches, es); break; case T_BitmapIndexScan: show_scan_qual(((BitmapIndexScan *) plan)->indexqualorig, @@ -1808,7 +1808,7 @@ ExplainNode(PlanState *planstate, List *ancestors, appendStringInfo(es->str, "Worker %d: ", n); if (es->timing) appendStringInfo(es->str, - "actual time=%.3f..%.3f rows=%.0f loops=%.0f\n", + "actual time=%.3f..%.3f rows=%.0f loops=%.0f\n", startup_sec, total_sec, rows, nloops); else appendStringInfo(es->str, @@ -2527,7 +2527,7 @@ show_hash_info(HashState *hashstate, ExplainState *es) { appendStringInfoSpaces(es->str, es->indent * 2); appendStringInfo(es->str, - "Buckets: %d Batches: %d Memory Usage: %ldkB\n", + "Buckets: %d Batches: %d Memory Usage: %ldkB\n", hashtable->nbuckets, hashtable->nbatch, spacePeakKb); } @@ -2721,10 +2721,10 @@ show_buffer_usage(ExplainState *es, const BufferUsage *usage) appendStringInfoString(es->str, "I/O Timings:"); if (!INSTR_TIME_IS_ZERO(usage->blk_read_time)) appendStringInfo(es->str, " read=%0.3f", - INSTR_TIME_GET_MILLISEC(usage->blk_read_time)); + INSTR_TIME_GET_MILLISEC(usage->blk_read_time)); if (!INSTR_TIME_IS_ZERO(usage->blk_write_time)) appendStringInfo(es->str, " write=%0.3f", - INSTR_TIME_GET_MILLISEC(usage->blk_write_time)); + INSTR_TIME_GET_MILLISEC(usage->blk_write_time)); appendStringInfoChar(es->str, '\n'); } } @@ -2976,7 +2976,7 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors, /* Should we explicitly label target relations? */ labeltargets = (mtstate->mt_nplans > 1 || (mtstate->mt_nplans == 1 && - mtstate->resultRelInfo->ri_RangeTableIndex != node->nominalRelation)); + mtstate->resultRelInfo->ri_RangeTableIndex != node->nominalRelation)); if (labeltargets) ExplainOpenGroup("Target Tables", "Target Tables", false, es); @@ -3558,7 +3558,7 @@ ExplainBeginOutput(ExplainState *es) case EXPLAIN_FORMAT_XML: appendStringInfoString(es->str, - "<explain xmlns=\"http://www.postgresql.org/2009/explain\">\n"); + "<explain xmlns=\"http://www.postgresql.org/2009/explain\">\n"); es->indent++; break; diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index 197955624f..ee56e02297 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -75,7 +75,8 @@ typedef struct ExtensionControlFile char *name; /* name of the extension */ char *directory; /* directory for script files */ char *default_version; /* default install target version, if any */ - char *module_pathname; /* string to substitute for MODULE_PATHNAME */ + char *module_pathname; /* string to substitute for + * MODULE_PATHNAME */ char *comment; /* comment, if any */ char *schema; /* target schema (allowed if !relocatable) */ bool relocatable; /* is ALTER EXTENSION SET SCHEMA supported? */ @@ -95,7 +96,7 @@ typedef struct ExtensionVersionInfo /* working state for Dijkstra's algorithm: */ bool distance_known; /* is distance from start known yet? */ int distance; /* current worst-case distance estimate */ - struct ExtensionVersionInfo *previous; /* current best predecessor */ + struct ExtensionVersionInfo *previous; /* current best predecessor */ } ExtensionVersionInfo; /* Local functions */ @@ -285,7 +286,7 @@ check_valid_extension_name(const char *extensionname) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("invalid extension name: \"%s\"", extensionname), - errdetail("Extension names must not begin or end with \"-\"."))); + errdetail("Extension names must not begin or end with \"-\"."))); /* * No directory separators either (this is sufficient to prevent ".." @@ -310,7 +311,7 @@ check_valid_version_name(const char *versionname) if (namelen == 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid extension version name: \"%s\"", versionname), + errmsg("invalid extension version name: \"%s\"", versionname), errdetail("Version names must not be empty."))); /* @@ -319,7 +320,7 @@ check_valid_version_name(const char *versionname) if (strstr(versionname, "--")) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid extension version name: \"%s\"", versionname), + errmsg("invalid extension version name: \"%s\"", versionname), errdetail("Version names must not contain \"--\"."))); /* @@ -328,8 +329,8 @@ check_valid_version_name(const char *versionname) if (versionname[0] == '-' || versionname[namelen - 1] == '-') ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid extension version name: \"%s\"", versionname), - errdetail("Version names must not begin or end with \"-\"."))); + errmsg("invalid extension version name: \"%s\"", versionname), + errdetail("Version names must not begin or end with \"-\"."))); /* * No directory separators either (this is sufficient to prevent ".." @@ -338,7 +339,7 @@ check_valid_version_name(const char *versionname) if (first_dir_separator(versionname) != NULL) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid extension version name: \"%s\"", versionname), + errmsg("invalid extension version name: \"%s\"", versionname), errdetail("Version names must not contain directory separator characters."))); } @@ -574,8 +575,8 @@ parse_extension_control_file(ExtensionControlFile *control, /* syntax error in name list */ ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("parameter \"%s\" must be a list of extension names", - item->name))); + errmsg("parameter \"%s\" must be a list of extension names", + item->name))); } } else @@ -916,8 +917,8 @@ execute_extension_script(Oid extensionOid, ExtensionControlFile *control, { t_sql = DirectFunctionCall3(replace_text, t_sql, - CStringGetTextDatum("MODULE_PATHNAME"), - CStringGetTextDatum(control->module_pathname)); + CStringGetTextDatum("MODULE_PATHNAME"), + CStringGetTextDatum(control->module_pathname)); } /* And now back to C string */ @@ -1425,9 +1426,9 @@ CreateExtensionInternal(char *extensionName, !cascade) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("extension \"%s\" must be installed in schema \"%s\"", - control->name, - control->schema))); + errmsg("extension \"%s\" must be installed in schema \"%s\"", + control->name, + control->schema))); /* Always use the schema from control file for current extension. */ schemaName = control->schema; @@ -1846,8 +1847,8 @@ RemoveExtensionById(Oid extId) if (extId == CurrentExtensionObject) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("cannot drop extension \"%s\" because it is being modified", - get_extension_name(extId)))); + errmsg("cannot drop extension \"%s\" because it is being modified", + get_extension_name(extId)))); rel = heap_open(ExtensionRelationId, RowExclusiveLock); @@ -2365,8 +2366,8 @@ pg_extension_config_dump(PG_FUNCTION_ARGS) CurrentExtensionObject) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("table \"%s\" is not a member of the extension being created", - tablename))); + errmsg("table \"%s\" is not a member of the extension being created", + tablename))); /* * Add the table OID and WHERE condition to the extension's extconfig and @@ -2389,7 +2390,7 @@ pg_extension_config_dump(PG_FUNCTION_ARGS) extTup = systable_getnext(extScan); - if (!HeapTupleIsValid(extTup)) /* should not happen */ + if (!HeapTupleIsValid(extTup)) /* should not happen */ elog(ERROR, "could not find tuple for extension %u", CurrentExtensionObject); @@ -2435,7 +2436,7 @@ pg_extension_config_dump(PG_FUNCTION_ARGS) { if (arrayData[i] == tableoid) { - arrayIndex = i + 1; /* replace this element instead */ + arrayIndex = i + 1; /* replace this element instead */ break; } } @@ -2537,7 +2538,7 @@ extension_config_remove(Oid extensionoid, Oid tableoid) extTup = systable_getnext(extScan); - if (!HeapTupleIsValid(extTup)) /* should not happen */ + if (!HeapTupleIsValid(extTup)) /* should not happen */ elog(ERROR, "could not find tuple for extension %u", extensionoid); @@ -2738,7 +2739,7 @@ AlterExtensionNamespace(const char *extensionName, const char *newschema, Oid *o extTup = systable_getnext(extScan); - if (!HeapTupleIsValid(extTup)) /* should not happen */ + if (!HeapTupleIsValid(extTup)) /* should not happen */ elog(ERROR, "could not find tuple for extension %u", extensionOid); @@ -2803,7 +2804,7 @@ AlterExtensionNamespace(const char *extensionName, const char *newschema, Oid *o dep.objectId = pg_depend->objid; dep.objectSubId = pg_depend->objsubid; - if (dep.objectSubId != 0) /* should not happen */ + if (dep.objectSubId != 0) /* should not happen */ elog(ERROR, "extension should not have a sub-object dependency"); /* Relocate the object */ @@ -2978,8 +2979,8 @@ ExecAlterExtensionStmt(ParseState *pstate, AlterExtensionStmt *stmt) if (strcmp(oldVersionName, versionName) == 0) { ereport(NOTICE, - (errmsg("version \"%s\" of extension \"%s\" is already installed", - versionName, stmt->extname))); + (errmsg("version \"%s\" of extension \"%s\" is already installed", + versionName, stmt->extname))); return InvalidObjectAddress; } diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c index 554656b6ec..1473be0ea9 100644 --- a/src/backend/commands/foreigncmds.c +++ b/src/backend/commands/foreigncmds.c @@ -230,7 +230,7 @@ AlterForeignDataWrapperOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerI (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), errmsg("permission denied to change owner of foreign-data wrapper \"%s\"", NameStr(form->fdwname)), - errhint("The owner of a foreign-data wrapper must be a superuser."))); + errhint("The owner of a foreign-data wrapper must be a superuser."))); if (form->fdwowner != newOwnerId) { @@ -321,7 +321,7 @@ AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId) if (!HeapTupleIsValid(tup)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("foreign-data wrapper with OID %u does not exist", fwdId))); + errmsg("foreign-data wrapper with OID %u does not exist", fwdId))); AlterForeignDataWrapperOwner_internal(rel, tup, newOwnerId); @@ -485,7 +485,7 @@ lookup_fdw_handler_func(DefElem *handler) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("function %s must return type %s", - NameListToString((List *) handler->arg), "fdw_handler"))); + NameListToString((List *) handler->arg), "fdw_handler"))); return handlerOid; } @@ -579,9 +579,9 @@ CreateForeignDataWrapper(CreateFdwStmt *stmt) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to create foreign-data wrapper \"%s\"", - stmt->fdwname), - errhint("Must be superuser to create a foreign-data wrapper."))); + errmsg("permission denied to create foreign-data wrapper \"%s\"", + stmt->fdwname), + errhint("Must be superuser to create a foreign-data wrapper."))); /* For now the owner cannot be specified on create. Use effective user ID. */ ownerId = GetUserId(); @@ -693,9 +693,9 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to alter foreign-data wrapper \"%s\"", - stmt->fdwname), - errhint("Must be superuser to alter a foreign-data wrapper."))); + errmsg("permission denied to alter foreign-data wrapper \"%s\"", + stmt->fdwname), + errhint("Must be superuser to alter a foreign-data wrapper."))); tp = SearchSysCacheCopy1(FOREIGNDATAWRAPPERNAME, CStringGetDatum(stmt->fdwname)); @@ -703,7 +703,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) if (!HeapTupleIsValid(tp)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("foreign-data wrapper \"%s\" does not exist", stmt->fdwname))); + errmsg("foreign-data wrapper \"%s\" does not exist", stmt->fdwname))); fdwForm = (Form_pg_foreign_data_wrapper) GETSTRUCT(tp); fdwId = HeapTupleGetOid(tp); @@ -741,8 +741,8 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt) */ if (OidIsValid(fdwvalidator)) ereport(WARNING, - (errmsg("changing the foreign-data wrapper validator can cause " - "the options for dependent objects to become invalid"))); + (errmsg("changing the foreign-data wrapper validator can cause " + "the options for dependent objects to become invalid"))); } else { @@ -1182,9 +1182,9 @@ CreateUserMapping(CreateUserMappingStmt *stmt) else ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("user mapping for \"%s\" already exists for server %s", - MappingUserName(useId), - stmt->servername))); + errmsg("user mapping for \"%s\" already exists for server %s", + MappingUserName(useId), + stmt->servername))); } fdw = GetForeignDataWrapper(srv->fdwid); @@ -1275,8 +1275,8 @@ AlterUserMapping(AlterUserMappingStmt *stmt) if (!OidIsValid(umId)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("user mapping for \"%s\" does not exist for the server", - MappingUserName(useId)))); + errmsg("user mapping for \"%s\" does not exist for the server", + MappingUserName(useId)))); user_mapping_ddl_aclcheck(useId, srv->serverid, stmt->servername); @@ -1390,8 +1390,8 @@ RemoveUserMapping(DropUserMappingStmt *stmt) if (!stmt->missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("user mapping for \"%s\" does not exist for the server", - MappingUserName(useId)))); + errmsg("user mapping for \"%s\" does not exist for the server", + MappingUserName(useId)))); /* IF EXISTS specified, just note it */ ereport(NOTICE, diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c index ffcae34189..7de844b2ca 100644 --- a/src/backend/commands/functioncmds.c +++ b/src/backend/commands/functioncmds.c @@ -131,8 +131,8 @@ compute_return_type(TypeName *returnType, Oid languageOid, if (returnType->typmods != NIL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("type modifier cannot be specified for shell type \"%s\"", - typnam))); + errmsg("type modifier cannot be specified for shell type \"%s\"", + typnam))); /* Otherwise, go ahead and make a shell type */ ereport(NOTICE, @@ -201,7 +201,7 @@ interpret_function_parameter_list(ParseState *pstate, ListCell *x; int i; - *variadicArgType = InvalidOid; /* default result */ + *variadicArgType = InvalidOid; /* default result */ *requiredResultType = InvalidOid; /* default result */ inTypes = (Oid *) palloc(parameterCount * sizeof(Oid)); @@ -230,8 +230,8 @@ interpret_function_parameter_list(ParseState *pstate, if (languageOid == SQLlanguageId) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("SQL function cannot accept shell type %s", - TypeNameToString(t)))); + errmsg("SQL function cannot accept shell type %s", + TypeNameToString(t)))); /* We don't allow creating aggregates on shell types either */ else if (is_aggregate) ereport(ERROR, @@ -307,7 +307,7 @@ interpret_function_parameter_list(ParseState *pstate, if (!OidIsValid(get_element_type(toid))) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("VARIADIC parameter must be an array"))); + errmsg("VARIADIC parameter must be an array"))); break; } } @@ -347,8 +347,8 @@ interpret_function_parameter_list(ParseState *pstate, strcmp(prevfp->name, fp->name) == 0) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("parameter name \"%s\" used more than once", - fp->name))); + errmsg("parameter name \"%s\" used more than once", + fp->name))); } paramNames[i] = CStringGetTextDatum(fp->name); @@ -362,7 +362,7 @@ interpret_function_parameter_list(ParseState *pstate, if (!isinput) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("only input parameters can have default values"))); + errmsg("only input parameters can have default values"))); def = transformExpr(pstate, fp->defexpr, EXPR_KIND_FUNCTION_DEFAULT); @@ -562,7 +562,7 @@ interpret_func_parallel(DefElem *defel) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("parameter \"parallel\" must be SAFE, RESTRICTED, or UNSAFE"))); - return PROPARALLEL_UNSAFE; /* keep compiler quiet */ + return PROPARALLEL_UNSAFE; /* keep compiler quiet */ } } @@ -588,7 +588,7 @@ update_proconfig_value(ArrayType *a, List *set_items) if (valuestr) a = GUCArrayAdd(a, sstmt->name, valuestr); - else /* RESET */ + else /* RESET */ a = GUCArrayDelete(a, sstmt->name); } } @@ -1090,7 +1090,7 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt) languageValidator, prosrc_str, /* converted to text later */ probin_str, /* converted to text later */ - false, /* not an aggregate */ + false, /* not an aggregate */ isWindowFunc, security, isLeakProof, @@ -1146,7 +1146,7 @@ RemoveFunctionById(Oid funcOid) relation = heap_open(AggregateRelationId, RowExclusiveLock); tup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(funcOid)); - if (!HeapTupleIsValid(tup)) /* should not happen */ + if (!HeapTupleIsValid(tup)) /* should not happen */ elog(ERROR, "cache lookup failed for pg_aggregate tuple for function %u", funcOid); CatalogTupleDelete(relation, &tup->t_self); @@ -1231,7 +1231,7 @@ AlterFunction(ParseState *pstate, AlterFunctionStmt *stmt) if (procForm->proleakproof && !superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("only superuser can define a leakproof function"))); + errmsg("only superuser can define a leakproof function"))); } if (cost_item) { @@ -1316,6 +1316,8 @@ SetFunctionReturnType(Oid funcOid, Oid newRetType) Relation pg_proc_rel; HeapTuple tup; Form_pg_proc procForm; + ObjectAddress func_address; + ObjectAddress type_address; pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock); @@ -1324,7 +1326,7 @@ SetFunctionReturnType(Oid funcOid, Oid newRetType) elog(ERROR, "cache lookup failed for function %u", funcOid); procForm = (Form_pg_proc) GETSTRUCT(tup); - if (procForm->prorettype != OPAQUEOID) /* caller messed up */ + if (procForm->prorettype != OPAQUEOID) /* caller messed up */ elog(ERROR, "function %u doesn't return OPAQUE", funcOid); /* okay to overwrite copied tuple */ @@ -1334,6 +1336,14 @@ SetFunctionReturnType(Oid funcOid, Oid newRetType) CatalogTupleUpdate(pg_proc_rel, &tup->t_self, tup); heap_close(pg_proc_rel, RowExclusiveLock); + + /* + * Also update the dependency to the new type. Opaque is a pinned type, so + * there is no old dependency record for it that we would need to remove. + */ + ObjectAddressSet(type_address, TypeRelationId, newRetType); + ObjectAddressSet(func_address, ProcedureRelationId, funcOid); + recordDependencyOn(&func_address, &type_address, DEPENDENCY_NORMAL); } @@ -1348,6 +1358,8 @@ SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType) Relation pg_proc_rel; HeapTuple tup; Form_pg_proc procForm; + ObjectAddress func_address; + ObjectAddress type_address; pg_proc_rel = heap_open(ProcedureRelationId, RowExclusiveLock); @@ -1367,6 +1379,14 @@ SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType) CatalogTupleUpdate(pg_proc_rel, &tup->t_self, tup); heap_close(pg_proc_rel, RowExclusiveLock); + + /* + * Also update the dependency to the new type. Opaque is a pinned type, so + * there is no old dependency record for it that we would need to remove. + */ + ObjectAddressSet(type_address, TypeRelationId, newArgType); + ObjectAddressSet(func_address, ProcedureRelationId, funcOid); + recordDependencyOn(&func_address, &type_address, DEPENDENCY_NORMAL); } @@ -1463,7 +1483,7 @@ CreateCast(CreateCastStmt *stmt) if (nargs < 1 || nargs > 3) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("cast function must take one to three arguments"))); + errmsg("cast function must take one to three arguments"))); if (!IsBinaryCoercible(sourcetypeid, procstruct->proargtypes.values[0])) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), @@ -1471,8 +1491,8 @@ CreateCast(CreateCastStmt *stmt) if (nargs > 1 && procstruct->proargtypes.values[1] != INT4OID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("second argument of cast function must be type %s", - "integer"))); + errmsg("second argument of cast function must be type %s", + "integer"))); if (nargs > 2 && procstruct->proargtypes.values[2] != BOOLOID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), @@ -1497,7 +1517,7 @@ CreateCast(CreateCastStmt *stmt) if (procstruct->proisagg) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("cast function must not be an aggregate function"))); + errmsg("cast function must not be an aggregate function"))); if (procstruct->proiswindow) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), @@ -1531,7 +1551,7 @@ CreateCast(CreateCastStmt *stmt) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to create a cast WITHOUT FUNCTION"))); + errmsg("must be superuser to create a cast WITHOUT FUNCTION"))); /* * Also, insist that the types match as to size, alignment, and @@ -1561,7 +1581,7 @@ CreateCast(CreateCastStmt *stmt) targettyptype == TYPTYPE_COMPOSITE) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("composite data types are not binary-compatible"))); + errmsg("composite data types are not binary-compatible"))); if (sourcetyptype == TYPTYPE_ENUM || targettyptype == TYPTYPE_ENUM) @@ -1600,7 +1620,7 @@ CreateCast(CreateCastStmt *stmt) if (sourcetypeid == targettypeid && nargs < 2) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("source data type and target data type are the same"))); + errmsg("source data type and target data type are the same"))); /* convert CoercionContext enum to char value for castcontext */ switch (stmt->context) @@ -1749,7 +1769,7 @@ check_transform_function(Form_pg_proc procstruct) if (procstruct->proisagg) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("transform function must not be an aggregate function"))); + errmsg("transform function must not be an aggregate function"))); if (procstruct->proiswindow) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), @@ -1765,8 +1785,8 @@ check_transform_function(Form_pg_proc procstruct) if (procstruct->proargtypes.values[0] != INTERNALOID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("first argument of transform function must be type %s", - "internal"))); + errmsg("first argument of transform function must be type %s", + "internal"))); } @@ -1849,8 +1869,8 @@ CreateTransform(CreateTransformStmt *stmt) if (procstruct->prorettype != INTERNALOID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("return data type of FROM SQL function must be %s", - "internal"))); + errmsg("return data type of FROM SQL function must be %s", + "internal"))); check_transform_function(procstruct); ReleaseSysCache(tuple); } @@ -1902,9 +1922,9 @@ CreateTransform(CreateTransformStmt *stmt) if (!stmt->replace) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("transform for type %s language \"%s\" already exists", - format_type_be(typeid), - stmt->lang))); + errmsg("transform for type %s language \"%s\" already exists", + format_type_be(typeid), + stmt->lang))); MemSet(replaces, false, sizeof(replaces)); replaces[Anum_pg_transform_trffromsql - 1] = true; @@ -1991,9 +2011,9 @@ get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok) if (!OidIsValid(oid) && !missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("transform for type %s language \"%s\" does not exist", - format_type_be(type_id), - get_language_name(lang_id, false)))); + errmsg("transform for type %s language \"%s\" does not exist", + format_type_be(type_id), + get_language_name(lang_id, false)))); return oid; } @@ -2140,8 +2160,8 @@ ExecuteDoStmt(DoStmt *stmt) if (!OidIsValid(laninline)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("language \"%s\" does not support inline code execution", - NameStr(languageStruct->lanname)))); + errmsg("language \"%s\" does not support inline code execution", + NameStr(languageStruct->lanname)))); ReleaseSysCache(languageTuple); diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index f611e3e394..5c4f84ffba 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -528,18 +528,18 @@ DefineIndex(Oid relationId, if (stmt->unique && !amRoutine->amcanunique) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("access method \"%s\" does not support unique indexes", - accessMethodName))); + errmsg("access method \"%s\" does not support unique indexes", + accessMethodName))); if (numberOfAttributes > 1 && !amRoutine->amcanmulticol) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("access method \"%s\" does not support multicolumn indexes", - accessMethodName))); + errmsg("access method \"%s\" does not support multicolumn indexes", + accessMethodName))); if (stmt->excludeOpNames && amRoutine->amgettuple == NULL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("access method \"%s\" does not support exclusion constraints", - accessMethodName))); + errmsg("access method \"%s\" does not support exclusion constraints", + accessMethodName))); amcanorder = amRoutine->amcanorder; amoptions = amRoutine->amoptions; @@ -652,7 +652,7 @@ DefineIndex(Oid relationId, if (attno < 0 && attno != ObjectIdAttributeNumber) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("index creation on system columns is not supported"))); + errmsg("index creation on system columns is not supported"))); } /* @@ -672,7 +672,7 @@ DefineIndex(Oid relationId, indexattrs)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("index creation on system columns is not supported"))); + errmsg("index creation on system columns is not supported"))); } } @@ -693,14 +693,14 @@ DefineIndex(Oid relationId, else { elog(ERROR, "unknown constraint type"); - constraint_type = NULL; /* keep compiler quiet */ + constraint_type = NULL; /* keep compiler quiet */ } ereport(DEBUG1, - (errmsg("%s %s will create implicit index \"%s\" for table \"%s\"", - is_alter_table ? "ALTER TABLE / ADD" : "CREATE TABLE /", - constraint_type, - indexRelationName, RelationGetRelationName(rel)))); + (errmsg("%s %s will create implicit index \"%s\" for table \"%s\"", + is_alter_table ? "ALTER TABLE / ADD" : "CREATE TABLE /", + constraint_type, + indexRelationName, RelationGetRelationName(rel)))); } /* @@ -945,7 +945,7 @@ DefineIndex(Oid relationId, newer_snapshots = GetCurrentVirtualXIDs(limitXmin, true, false, - PROC_IS_AUTOVACUUM | PROC_IN_VACUUM, + PROC_IS_AUTOVACUUM | PROC_IN_VACUUM, &n_newer_snapshots); for (j = i; j < n_old_snapshots; j++) { @@ -957,7 +957,7 @@ DefineIndex(Oid relationId, newer_snapshots[k])) break; } - if (k >= n_newer_snapshots) /* not there anymore */ + if (k >= n_newer_snapshots) /* not there anymore */ SetInvalidVirtualTransactionId(old_snapshots[j]); } pfree(newer_snapshots); @@ -1044,7 +1044,7 @@ CheckPredicate(Expr *predicate) if (CheckMutability(predicate)) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("functions in index predicate must be marked IMMUTABLE"))); + errmsg("functions in index predicate must be marked IMMUTABLE"))); } /* @@ -1110,8 +1110,8 @@ ComputeIndexAttrs(IndexInfo *indexInfo, if (isconstraint) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" named in key does not exist", - attribute->name))); + errmsg("column \"%s\" named in key does not exist", + attribute->name))); else ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), @@ -1422,7 +1422,7 @@ ResolveOpClass(List *opclass, Oid attrType, ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("operator class \"%s\" does not accept data type %s", - NameListToString(opclass), format_type_be(attrType)))); + NameListToString(opclass), format_type_be(attrType)))); ReleaseSysCache(tuple); @@ -1511,8 +1511,8 @@ GetDefaultOpClass(Oid type_id, Oid am_id) if (nexact > 1) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("there are multiple default operator classes for data type %s", - format_type_be(type_id)))); + errmsg("there are multiple default operator classes for data type %s", + format_type_be(type_id)))); if (nexact == 1 || ncompatiblepreferred == 1 || @@ -1752,9 +1752,9 @@ ChooseIndexColumnNames(List *indexElems) /* Get the preliminary name from the IndexElem */ if (ielem->indexcolname) - origname = ielem->indexcolname; /* caller-specified name */ + origname = ielem->indexcolname; /* caller-specified name */ else if (ielem->name) - origname = ielem->name; /* simple column reference */ + origname = ielem->name; /* simple column reference */ else origname = "expr"; /* default name for expression */ diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c index 2061568d7f..bfe549766c 100644 --- a/src/backend/commands/matview.c +++ b/src/backend/commands/matview.c @@ -260,9 +260,9 @@ ExecRefreshMatView(RefreshMatViewStmt *stmt, const char *queryString, if (!hasUniqueIndex) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("cannot refresh materialized view \"%s\" concurrently", - quote_qualified_identifier(get_namespace_name(RelationGetNamespace(matviewRel)), - RelationGetRelationName(matviewRel))), + errmsg("cannot refresh materialized view \"%s\" concurrently", + quote_qualified_identifier(get_namespace_name(RelationGetNamespace(matviewRel)), + RelationGetRelationName(matviewRel))), errhint("Create a unique index with no WHERE clause on one or more columns of the materialized view."))); } @@ -576,7 +576,7 @@ mv_GenerateOper(StringInfo buf, Oid opoid) Assert(operform->oprkind == 'b'); appendStringInfo(buf, "OPERATOR(%s.%s)", - quote_identifier(get_namespace_name(operform->oprnamespace)), + quote_identifier(get_namespace_name(operform->oprnamespace)), NameStr(operform->oprname)); ReleaseSysCache(opertup); @@ -634,7 +634,7 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner, initStringInfo(&querybuf); matviewRel = heap_open(matviewOid, NoLock); matviewname = quote_qualified_identifier(get_namespace_name(RelationGetNamespace(matviewRel)), - RelationGetRelationName(matviewRel)); + RelationGetRelationName(matviewRel)); tempRel = heap_open(tempOid, NoLock); tempname = quote_qualified_identifier(get_namespace_name(RelationGetNamespace(tempRel)), RelationGetRelationName(tempRel)); @@ -702,7 +702,7 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner, errmsg("new data for materialized view \"%s\" contains duplicate rows without any null columns", RelationGetRelationName(matviewRel)), errdetail("Row: %s", - SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1)))); + SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1)))); } SetUserIdAndSecContext(relowner, @@ -841,7 +841,7 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner, /* Deletes must come before inserts; do them first. */ resetStringInfo(&querybuf); appendStringInfo(&querybuf, - "DELETE FROM %s mv WHERE ctid OPERATOR(pg_catalog.=) ANY " + "DELETE FROM %s mv WHERE ctid OPERATOR(pg_catalog.=) ANY " "(SELECT diff.tid FROM %s diff " "WHERE diff.tid IS NOT NULL " "AND diff.newdata IS NULL)", diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c index ab51d1a417..a31b1acb9c 100644 --- a/src/backend/commands/opclasscmds.c +++ b/src/backend/commands/opclasscmds.c @@ -545,7 +545,7 @@ DefineOpClass(CreateOpClassStmt *stmt) if (OidIsValid(storageoid)) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("storage type specified more than once"))); + errmsg("storage type specified more than once"))); storageoid = typenameTypeId(NULL, item->storedtype); #ifdef NOT_USED @@ -619,8 +619,8 @@ DefineOpClass(CreateOpClassStmt *stmt) errmsg("could not make operator class \"%s\" be default for type %s", opcname, TypeNameToString(stmt->datatype)), - errdetail("Operator class \"%s\" already is the default.", - NameStr(opclass->opcname)))); + errdetail("Operator class \"%s\" already is the default.", + NameStr(opclass->opcname)))); } systable_endscan(scan); @@ -856,7 +856,7 @@ AlterOpFamilyAdd(AlterOpFamilyStmt *stmt, Oid amoid, Oid opfamilyoid, ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("operator argument types must be specified in ALTER OPERATOR FAMILY"))); - operOid = InvalidOid; /* keep compiler quiet */ + operOid = InvalidOid; /* keep compiler quiet */ } if (item->order_family) @@ -1085,8 +1085,8 @@ assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid) if (!amroutine->amcanorderbyop) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("access method \"%s\" does not support ordering operators", - get_am_name(amoid)))); + errmsg("access method \"%s\" does not support ordering operators", + get_am_name(amoid)))); } else { @@ -1142,7 +1142,7 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid) if (procform->prorettype != INT4OID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("btree comparison procedures must return integer"))); + errmsg("btree comparison procedures must return integer"))); /* * If lefttype/righttype isn't specified, use the proc's input @@ -1163,7 +1163,7 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid) if (procform->prorettype != VOIDOID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("btree sort support procedures must return void"))); + errmsg("btree sort support procedures must return void"))); /* * Can't infer lefttype/righttype from proc, so use default rule diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index 739d5875eb..6674b41eec 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -70,16 +70,16 @@ DefineOperator(List *names, List *parameters) char *oprName; Oid oprNamespace; AclResult aclresult; - bool canMerge = false; /* operator merges */ + bool canMerge = false; /* operator merges */ bool canHash = false; /* operator hashes */ - List *functionName = NIL; /* function for operator */ - TypeName *typeName1 = NULL; /* first type name */ - TypeName *typeName2 = NULL; /* second type name */ + List *functionName = NIL; /* function for operator */ + TypeName *typeName1 = NULL; /* first type name */ + TypeName *typeName2 = NULL; /* second type name */ Oid typeId1 = InvalidOid; /* types converted to OID */ Oid typeId2 = InvalidOid; Oid rettype; List *commutatorName = NIL; /* optional commutator operator name */ - List *negatorName = NIL; /* optional negator operator name */ + List *negatorName = NIL; /* optional negator operator name */ List *restrictionName = NIL; /* optional restrict. sel. procedure */ List *joinName = NIL; /* optional join sel. procedure */ Oid functionOid; /* functions converted to OID */ @@ -111,7 +111,7 @@ DefineOperator(List *names, List *parameters) if (typeName1->setof) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("SETOF type not allowed for operator argument"))); + errmsg("SETOF type not allowed for operator argument"))); } else if (pg_strcasecmp(defel->defname, "rightarg") == 0) { @@ -119,7 +119,7 @@ DefineOperator(List *names, List *parameters) if (typeName2->setof) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("SETOF type not allowed for operator argument"))); + errmsg("SETOF type not allowed for operator argument"))); } else if (pg_strcasecmp(defel->defname, "procedure") == 0) functionName = defGetQualifiedName(defel); @@ -171,7 +171,7 @@ DefineOperator(List *names, List *parameters) if (!OidIsValid(typeId1) && !OidIsValid(typeId2)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("at least one of leftarg or rightarg must be specified"))); + errmsg("at least one of leftarg or rightarg must be specified"))); if (typeName1) { @@ -243,9 +243,9 @@ DefineOperator(List *names, List *parameters) oprNamespace, /* namespace */ typeId1, /* left type id */ typeId2, /* right type id */ - functionOid, /* function for operator */ + functionOid, /* function for operator */ commutatorName, /* optional commutator operator name */ - negatorName, /* optional negator operator name */ + negatorName, /* optional negator operator name */ restrictionOid, /* optional restrict. sel. procedure */ joinOid, /* optional join sel. procedure name */ canMerge, /* operator merges */ @@ -275,8 +275,8 @@ ValidateRestrictionEstimator(List *restrictionName) if (get_func_rettype(restrictionOid) != FLOAT8OID) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("restriction estimator function %s must return type %s", - NameListToString(restrictionName), "float8"))); + errmsg("restriction estimator function %s must return type %s", + NameListToString(restrictionName), "float8"))); /* Require EXECUTE rights for the estimator */ aclresult = pg_proc_aclcheck(restrictionOid, GetUserId(), ACL_EXECUTE); @@ -479,7 +479,7 @@ AlterOperator(AlterOperatorStmt *stmt) if (OidIsValid(joinOid)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("only binary operators can have join selectivity"))); + errmsg("only binary operators can have join selectivity"))); } if (oprForm->oprresult != BOOLOID) @@ -491,7 +491,7 @@ AlterOperator(AlterOperatorStmt *stmt) if (OidIsValid(joinOid)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("only boolean operators can have join selectivity"))); + errmsg("only boolean operators can have join selectivity"))); } /* Update the tuple */ diff --git a/src/backend/commands/policy.c b/src/backend/commands/policy.c index dad31df517..9ced4ee34c 100644 --- a/src/backend/commands/policy.c +++ b/src/backend/commands/policy.c @@ -168,7 +168,7 @@ policy_role_list_to_array(List *roles, int *num_roles) ereport(WARNING, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("ignoring specified roles other than PUBLIC"), - errhint("All roles are members of the PUBLIC role."))); + errhint("All roles are members of the PUBLIC role."))); *num_roles = 1; } role_oids[0] = ObjectIdGetDatum(ACL_ID_PUBLIC); @@ -552,7 +552,7 @@ RemoveRoleFromObjectPolicy(Oid roleid, Oid classid, Oid policy_id) /* Get policy qual, to update dependencies */ value_datum = heap_getattr(tuple, Anum_pg_policy_polqual, - RelationGetDescr(pg_policy_rel), &attr_isnull); + RelationGetDescr(pg_policy_rel), &attr_isnull); if (!attr_isnull) { ParseState *qual_pstate; @@ -574,7 +574,7 @@ RemoveRoleFromObjectPolicy(Oid roleid, Oid classid, Oid policy_id) /* Get WITH CHECK qual, to update dependencies */ value_datum = heap_getattr(tuple, Anum_pg_policy_polwithcheck, - RelationGetDescr(pg_policy_rel), &attr_isnull); + RelationGetDescr(pg_policy_rel), &attr_isnull); if (!attr_isnull) { ParseState *with_check_pstate; @@ -797,11 +797,11 @@ CreatePolicy(CreatePolicyStmt *stmt) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg("policy \"%s\" for table \"%s\" already exists", - stmt->policy_name, RelationGetRelationName(target_table)))); + stmt->policy_name, RelationGetRelationName(target_table)))); values[Anum_pg_policy_polrelid - 1] = ObjectIdGetDatum(table_id); values[Anum_pg_policy_polname - 1] = DirectFunctionCall1(namein, - CStringGetDatum(stmt->policy_name)); + CStringGetDatum(stmt->policy_name)); values[Anum_pg_policy_polcmd - 1] = CharGetDatum(polcmd); values[Anum_pg_policy_polpermissive - 1] = BoolGetDatum(stmt->permissive); values[Anum_pg_policy_polroles - 1] = PointerGetDatum(role_ids); @@ -1242,7 +1242,7 @@ rename_policy(RenameStmt *stmt) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), errmsg("policy \"%s\" for table \"%s\" already exists", - stmt->newname, RelationGetRelationName(target_table)))); + stmt->newname, RelationGetRelationName(target_table)))); systable_endscan(sscan); @@ -1270,7 +1270,7 @@ rename_policy(RenameStmt *stmt) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("policy \"%s\" for table \"%s\" does not exist", - stmt->subname, RelationGetRelationName(target_table)))); + stmt->subname, RelationGetRelationName(target_table)))); opoloid = HeapTupleGetOid(policy_tuple); diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c index 6191459982..9fb9bf6bcd 100644 --- a/src/backend/commands/portalcmds.c +++ b/src/backend/commands/portalcmds.c @@ -513,7 +513,7 @@ PersistHoldablePortal(Portal portal) /* * Now shut down the inner executor. */ - portal->queryDesc = NULL; /* prevent double shutdown */ + portal->queryDesc = NULL; /* prevent double shutdown */ ExecutorFinish(queryDesc); ExecutorEnd(queryDesc); FreeQueryDesc(queryDesc); diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c index 287affa515..19d9f6cf0f 100644 --- a/src/backend/commands/prepare.c +++ b/src/backend/commands/prepare.c @@ -358,8 +358,8 @@ EvaluateParams(PreparedStatement *pstmt, List *params, if (nparams != num_params) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("wrong number of parameters for prepared statement \"%s\"", - pstmt->stmt_name), + errmsg("wrong number of parameters for prepared statement \"%s\"", + pstmt->stmt_name), errdetail("Expected %d parameters but got %d.", num_params, nparams))); @@ -400,7 +400,7 @@ EvaluateParams(PreparedStatement *pstmt, List *params, i + 1, format_type_be(given_type_id), format_type_be(expected_type_id)), - errhint("You will need to rewrite or cast the expression."))); + errhint("You will need to rewrite or cast the expression."))); /* Take care of collations in the finished expression. */ assign_expr_collations(pstate, expr); @@ -926,7 +926,7 @@ pg_prepared_statement(PG_FUNCTION_ARGS) values[1] = CStringGetTextDatum(prep_stmt->plansource->query_string); values[2] = TimestampTzGetDatum(prep_stmt->prepare_time); values[3] = build_regtype_array(prep_stmt->plansource->param_types, - prep_stmt->plansource->num_params); + prep_stmt->plansource->num_params); values[4] = BoolGetDatum(prep_stmt->from_sql); tuplestore_putvalues(tupstore, tupdesc, values, nulls); diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index a4fbc05a12..9d2d43fe6b 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -115,7 +115,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("function %s must return type %s", - NameListToString(funcname), "language_handler"))); + NameListToString(funcname), "language_handler"))); } else { @@ -161,18 +161,18 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) { tmpAddr = ProcedureCreate(pltemplate->tmplinline, PG_CATALOG_NAMESPACE, - false, /* replace */ - false, /* returnsSet */ + false, /* replace */ + false, /* returnsSet */ VOIDOID, BOOTSTRAP_SUPERUSERID, ClanguageId, F_FMGR_C_VALIDATOR, pltemplate->tmplinline, pltemplate->tmpllibrary, - false, /* isAgg */ - false, /* isWindowFunc */ - false, /* security_definer */ - false, /* isLeakProof */ + false, /* isAgg */ + false, /* isWindowFunc */ + false, /* security_definer */ + false, /* isLeakProof */ true, /* isStrict */ PROVOLATILE_VOLATILE, PROPARALLEL_UNSAFE, @@ -204,18 +204,18 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) { tmpAddr = ProcedureCreate(pltemplate->tmplvalidator, PG_CATALOG_NAMESPACE, - false, /* replace */ - false, /* returnsSet */ + false, /* replace */ + false, /* returnsSet */ VOIDOID, BOOTSTRAP_SUPERUSERID, ClanguageId, F_FMGR_C_VALIDATOR, pltemplate->tmplvalidator, pltemplate->tmpllibrary, - false, /* isAgg */ - false, /* isWindowFunc */ - false, /* security_definer */ - false, /* isLeakProof */ + false, /* isAgg */ + false, /* isWindowFunc */ + false, /* security_definer */ + false, /* isLeakProof */ true, /* isStrict */ PROVOLATILE_VOLATILE, PROPARALLEL_UNSAFE, @@ -278,16 +278,16 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) { ereport(WARNING, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("changing return type of function %s from %s to %s", - NameListToString(stmt->plhandler), - "opaque", "language_handler"))); + errmsg("changing return type of function %s from %s to %s", + NameListToString(stmt->plhandler), + "opaque", "language_handler"))); SetFunctionReturnType(handlerOid, LANGUAGE_HANDLEROID); } else ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("function %s must return type %s", - NameListToString(stmt->plhandler), "language_handler"))); + NameListToString(stmt->plhandler), "language_handler"))); } /* validate the inline function */ @@ -533,7 +533,7 @@ DropProceduralLanguageById(Oid langOid) rel = heap_open(LanguageRelationId, RowExclusiveLock); langTup = SearchSysCache1(LANGOID, ObjectIdGetDatum(langOid)); - if (!HeapTupleIsValid(langTup)) /* should not happen */ + if (!HeapTupleIsValid(langTup)) /* should not happen */ elog(ERROR, "cache lookup failed for language %u", langOid); CatalogTupleDelete(rel, &langTup->t_self); diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c index 8f06c23df9..610cb499d2 100644 --- a/src/backend/commands/publicationcmds.c +++ b/src/backend/commands/publicationcmds.c @@ -157,7 +157,7 @@ CreatePublication(CreatePublicationStmt *stmt) if (stmt->for_all_tables && !superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("must be superuser to create FOR ALL TABLES publication")))); + (errmsg("must be superuser to create FOR ALL TABLES publication")))); rel = heap_open(PublicationRelationId, RowExclusiveLock); @@ -330,7 +330,7 @@ AlterPublicationTables(AlterPublicationStmt *stmt, Relation rel, PublicationAddTables(pubid, rels, false, stmt); else if (stmt->tableAction == DEFELEM_DROP) PublicationDropTables(pubid, rels, false); - else /* DEFELEM_SET */ + else /* DEFELEM_SET */ { List *oldrelids = GetPublicationRelations(pubid); List *delrels = NIL; @@ -664,8 +664,8 @@ AlterPublicationOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) if (form->puballtables && !superuser_arg(newOwnerId)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to change owner of publication \"%s\"", - NameStr(form->pubname)), + errmsg("permission denied to change owner of publication \"%s\"", + NameStr(form->pubname)), errhint("The owner of a FOR ALL TABLES publication must be a superuser."))); } diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c index 546b54bd9f..37d4c2d239 100644 --- a/src/backend/commands/schemacmds.c +++ b/src/backend/commands/schemacmds.c @@ -110,7 +110,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString, ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), errmsg("unacceptable schema name \"%s\"", schemaName), - errdetail("The prefix \"pg_\" is reserved for system schemas."))); + errdetail("The prefix \"pg_\" is reserved for system schemas."))); /* * If if_not_exists was given and the schema already exists, bail out. @@ -139,7 +139,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString, */ if (saved_uid != owner_uid) SetUserIdAndSecContext(owner_uid, - save_sec_context | SECURITY_LOCAL_USERID_CHANGE); + save_sec_context | SECURITY_LOCAL_USERID_CHANGE); /* Create the schema's namespace */ namespaceId = NamespaceCreate(schemaName, owner_uid, false); @@ -297,7 +297,7 @@ RenameSchema(const char *oldname, const char *newname) ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), errmsg("unacceptable schema name \"%s\"", newname), - errdetail("The prefix \"pg_\" is reserved for system schemas."))); + errdetail("The prefix \"pg_\" is reserved for system schemas."))); /* rename */ namestrcpy(&(((Form_pg_namespace) GETSTRUCT(tup))->nspname), newname); diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 29704341d9..62a185d915 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -523,10 +523,13 @@ AlterSequence(ParseState *pstate, AlterSeqStmt *stmt) HeapTuple seqtuple; HeapTuple newdatatuple; - /* Open and lock sequence. */ - relid = RangeVarGetRelid(stmt->sequence, - ShareRowExclusiveLock, - stmt->missing_ok); + /* Open and lock sequence, and check for ownership along the way. */ + relid = RangeVarGetRelidExtended(stmt->sequence, + ShareRowExclusiveLock, + stmt->missing_ok, + false, + RangeVarCallbackOwnsRelation, + NULL); if (relid == InvalidOid) { ereport(NOTICE, @@ -537,11 +540,6 @@ AlterSequence(ParseState *pstate, AlterSeqStmt *stmt) init_sequence(relid, &elm, &seqrel); - /* allow ALTER to sequence owner only */ - if (!pg_class_ownercheck(relid, GetUserId())) - aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS, - stmt->sequence->relname); - rel = heap_open(SequenceRelationId, RowExclusiveLock); seqtuple = SearchSysCacheCopy1(SEQRELID, ObjectIdGetDatum(relid)); @@ -742,7 +740,7 @@ nextval_internal(Oid relid, bool check_permissions) */ PreventCommandIfParallelMode("nextval()"); - if (elm->last != elm->cached) /* some numbers were cached */ + if (elm->last != elm->cached) /* some numbers were cached */ { Assert(elm->last_valid); Assert(elm->increment != 0); @@ -906,9 +904,9 @@ nextval_internal(Oid relid, bool check_permissions) snprintf(buf, sizeof(buf), INT64_FORMAT, maxv); ereport(ERROR, - (errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED), - errmsg("nextval: reached maximum value of sequence \"%s\" (%s)", - RelationGetRelationName(seqrel), buf))); + (errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED), + errmsg("nextval: reached maximum value of sequence \"%s\" (%s)", + RelationGetRelationName(seqrel), buf))); } next = minv; } @@ -929,9 +927,9 @@ nextval_internal(Oid relid, bool check_permissions) snprintf(buf, sizeof(buf), INT64_FORMAT, minv); ereport(ERROR, - (errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED), - errmsg("nextval: reached minimum value of sequence \"%s\" (%s)", - RelationGetRelationName(seqrel), buf))); + (errcode(ERRCODE_SEQUENCE_GENERATOR_LIMIT_EXCEEDED), + errmsg("nextval: reached minimum value of sequence \"%s\" (%s)", + RelationGetRelationName(seqrel), buf))); } next = maxv; } @@ -1622,7 +1620,7 @@ init_params(ParseState *pstate, List *options, bool for_identity, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), for_identity ? errmsg("identity column type must be smallint, integer, or bigint") - : errmsg("sequence type must be smallint, integer, or bigint"))); + : errmsg("sequence type must be smallint, integer, or bigint"))); if (!isInit) { @@ -1634,11 +1632,11 @@ init_params(ParseState *pstate, List *options, bool for_identity, */ if ((seqform->seqtypid == INT2OID && seqform->seqmax == PG_INT16_MAX) || (seqform->seqtypid == INT4OID && seqform->seqmax == PG_INT32_MAX) || - (seqform->seqtypid == INT8OID && seqform->seqmax == PG_INT64_MAX)) + (seqform->seqtypid == INT8OID && seqform->seqmax == PG_INT64_MAX)) reset_max_value = true; if ((seqform->seqtypid == INT2OID && seqform->seqmin == PG_INT16_MIN) || (seqform->seqtypid == INT4OID && seqform->seqmin == PG_INT32_MIN) || - (seqform->seqtypid == INT8OID && seqform->seqmin == PG_INT64_MIN)) + (seqform->seqtypid == INT8OID && seqform->seqmin == PG_INT64_MIN)) reset_min_value = true; } @@ -1695,7 +1693,7 @@ init_params(ParseState *pstate, List *options, bool for_identity, seqform->seqmax = PG_INT64_MAX; } else - seqform->seqmax = -1; /* descending seq */ + seqform->seqmax = -1; /* descending seq */ seqdataform->log_cnt = 0; } @@ -1709,8 +1707,8 @@ init_params(ParseState *pstate, List *options, bool for_identity, ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("MAXVALUE (%s) is out of range for sequence data type %s", - bufx, format_type_be(seqform->seqtypid)))); + errmsg("MAXVALUE (%s) is out of range for sequence data type %s", + bufx, format_type_be(seqform->seqtypid)))); } /* MINVALUE (null arg means NO MINVALUE) */ @@ -1746,8 +1744,8 @@ init_params(ParseState *pstate, List *options, bool for_identity, ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("MINVALUE (%s) is out of range for sequence data type %s", - bufm, format_type_be(seqform->seqtypid)))); + errmsg("MINVALUE (%s) is out of range for sequence data type %s", + bufm, format_type_be(seqform->seqtypid)))); } /* crosscheck min/max */ @@ -1772,9 +1770,9 @@ init_params(ParseState *pstate, List *options, bool for_identity, else if (isInit) { if (seqform->seqincrement > 0) - seqform->seqstart = seqform->seqmin; /* ascending seq */ + seqform->seqstart = seqform->seqmin; /* ascending seq */ else - seqform->seqstart = seqform->seqmax; /* descending seq */ + seqform->seqstart = seqform->seqmax; /* descending seq */ } /* crosscheck START */ @@ -1799,8 +1797,8 @@ init_params(ParseState *pstate, List *options, bool for_identity, snprintf(bufm, sizeof(bufm), INT64_FORMAT, seqform->seqmax); ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("START value (%s) cannot be greater than MAXVALUE (%s)", - bufs, bufm))); + errmsg("START value (%s) cannot be greater than MAXVALUE (%s)", + bufs, bufm))); } /* RESTART [WITH] */ @@ -1832,8 +1830,8 @@ init_params(ParseState *pstate, List *options, bool for_identity, snprintf(bufm, sizeof(bufm), INT64_FORMAT, seqform->seqmin); ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("RESTART value (%s) cannot be less than MINVALUE (%s)", - bufs, bufm))); + errmsg("RESTART value (%s) cannot be less than MINVALUE (%s)", + bufs, bufm))); } if (seqdataform->last_value > seqform->seqmax) { @@ -1844,8 +1842,8 @@ init_params(ParseState *pstate, List *options, bool for_identity, snprintf(bufm, sizeof(bufm), INT64_FORMAT, seqform->seqmax); ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("RESTART value (%s) cannot be greater than MAXVALUE (%s)", - bufs, bufm))); + errmsg("RESTART value (%s) cannot be greater than MAXVALUE (%s)", + bufs, bufm))); } /* CACHE */ @@ -1985,7 +1983,7 @@ process_owned_by(Relation seqrel, List *owned_by, bool for_identity) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("invalid OWNED BY option"), - errhint("Specify OWNED BY table.column or OWNED BY NONE."))); + errhint("Specify OWNED BY table.column or OWNED BY NONE."))); tablerel = NULL; attnum = 0; } diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c index ea0a561401..476505512b 100644 --- a/src/backend/commands/statscmds.c +++ b/src/backend/commands/statscmds.c @@ -90,8 +90,8 @@ CreateStatistics(CreateStatsStmt *stmt) { ereport(NOTICE, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("statistics object \"%s\" already exists, skipping", - namestr))); + errmsg("statistics object \"%s\" already exists, skipping", + namestr))); return InvalidObjectAddress; } @@ -109,7 +109,7 @@ CreateStatistics(CreateStatsStmt *stmt) if (list_length(stmt->relations) != 1) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("only a single relation is allowed in CREATE STATISTICS"))); + errmsg("only a single relation is allowed in CREATE STATISTICS"))); foreach(cell, stmt->relations) { @@ -180,8 +180,8 @@ CreateStatistics(CreateStatsStmt *stmt) if (!HeapTupleIsValid(atttuple)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" referenced in statistics does not exist", - attname))); + errmsg("column \"%s\" referenced in statistics does not exist", + attname))); attForm = (Form_pg_attribute) GETSTRUCT(atttuple); /* Disallow use of system attributes in extended stats */ @@ -235,7 +235,7 @@ CreateStatistics(CreateStatsStmt *stmt) if (attnums[i] == attnums[i - 1]) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_COLUMN), - errmsg("duplicate column name in statistics definition"))); + errmsg("duplicate column name in statistics definition"))); } /* Form an int2vector representation of the sorted column list */ diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index 5aae7b6f91..9cbd36f646 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -466,8 +466,8 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel) walrcv_create_slot(wrconn, slotname, false, CRS_NOEXPORT_SNAPSHOT, &lsn); ereport(NOTICE, - (errmsg("created replication slot \"%s\" on publisher", - slotname))); + (errmsg("created replication slot \"%s\" on publisher", + slotname))); } } PG_CATCH(); @@ -570,7 +570,7 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data) list_length(subrel_states), sizeof(Oid), oid_cmp)) { SetSubscriptionRelState(sub->oid, relid, - copy_data ? SUBREL_STATE_INIT : SUBREL_STATE_READY, + copy_data ? SUBREL_STATE_INIT : SUBREL_STATE_READY, InvalidXLogRecPtr, false); ereport(NOTICE, (errmsg("added subscription for table %s.%s", @@ -957,9 +957,9 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel) if (res->status != WALRCV_OK_COMMAND) ereport(ERROR, - (errmsg("could not drop the replication slot \"%s\" on publisher", - slotname), - errdetail("The error was: %s", res->err))); + (errmsg("could not drop the replication slot \"%s\" on publisher", + slotname), + errdetail("The error was: %s", res->err))); else ereport(NOTICE, (errmsg("dropped replication slot \"%s\" on publisher", @@ -1003,9 +1003,9 @@ AlterSubscriptionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) if (!superuser_arg(newOwnerId)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied to change owner of subscription \"%s\"", - NameStr(form->subname)), - errhint("The owner of a subscription must be a superuser."))); + errmsg("permission denied to change owner of subscription \"%s\"", + NameStr(form->subname)), + errhint("The owner of a subscription must be a superuser."))); form->subowner = newOwnerId; CatalogTupleUpdate(rel, &tup->t_self, tup); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 7c260082bd..a1de996723 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -149,19 +149,19 @@ static List *on_commits = NIL; * a pass determined by subcommand type. */ -#define AT_PASS_UNSET -1 /* UNSET will cause ERROR */ -#define AT_PASS_DROP 0 /* DROP (all flavors) */ -#define AT_PASS_ALTER_TYPE 1 /* ALTER COLUMN TYPE */ -#define AT_PASS_OLD_INDEX 2 /* re-add existing indexes */ -#define AT_PASS_OLD_CONSTR 3 /* re-add existing constraints */ -#define AT_PASS_COL_ATTRS 4 /* set other column attributes */ +#define AT_PASS_UNSET -1 /* UNSET will cause ERROR */ +#define AT_PASS_DROP 0 /* DROP (all flavors) */ +#define AT_PASS_ALTER_TYPE 1 /* ALTER COLUMN TYPE */ +#define AT_PASS_OLD_INDEX 2 /* re-add existing indexes */ +#define AT_PASS_OLD_CONSTR 3 /* re-add existing constraints */ +#define AT_PASS_COL_ATTRS 4 /* set other column attributes */ /* We could support a RENAME COLUMN pass here, but not currently used */ -#define AT_PASS_ADD_COL 5 /* ADD COLUMN */ -#define AT_PASS_ADD_INDEX 6 /* ADD indexes */ -#define AT_PASS_ADD_CONSTR 7 /* ADD constraints, defaults */ -#define AT_PASS_MISC 8 /* other stuff */ +#define AT_PASS_ADD_COL 5 /* ADD COLUMN */ +#define AT_PASS_ADD_INDEX 6 /* ADD indexes */ +#define AT_PASS_ADD_CONSTR 7 /* ADD constraints, defaults */ +#define AT_PASS_MISC 8 /* other stuff */ #ifdef PGXC -#define AT_PASS_DISTRIB 9 /* Redistribution pass */ +#define AT_PASS_DISTRIB 9 /* Redistribution pass */ #define AT_NUM_PASSES 10 #else #define AT_NUM_PASSES 9 @@ -182,13 +182,13 @@ typedef struct AlteredTableInfo int rewrite; /* Reason for forced rewrite, if any */ Oid newTableSpace; /* new tablespace; 0 means no change */ bool chgPersistence; /* T if SET LOGGED/UNLOGGED is used */ - char newrelpersistence; /* if above is true */ + char newrelpersistence; /* if above is true */ Expr *partition_constraint; /* for attach partition validation */ /* Objects to rebuild after completing ALTER TYPE operations */ List *changedConstraintOids; /* OIDs of constraints to rebuild */ List *changedConstraintDefs; /* string definitions of same */ - List *changedIndexOids; /* OIDs of indexes to rebuild */ - List *changedIndexDefs; /* string definitions of same */ + List *changedIndexOids; /* OIDs of indexes to rebuild */ + List *changedIndexDefs; /* string definitions of same */ } AlteredTableInfo; /* Struct describing one new constraint to check in Phase 3 scan */ @@ -321,7 +321,7 @@ static void StoreCatalogInheritance1(Oid relationId, Oid parentOid, bool child_is_partition); static int findAttrByName(const char *attributeName, List *schema); static void AlterIndexNamespaces(Relation classRel, Relation rel, - Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved); + Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved); static void AlterSeqNamespaces(Relation classRel, Relation rel, Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved, LOCKMODE lockmode); @@ -457,7 +457,7 @@ static void ATExecSetRelOptions(Relation rel, List *defList, AlterTableType operation, LOCKMODE lockmode); static void ATExecEnableDisableTrigger(Relation rel, char *trigname, - char fires_when, bool skip_system, LOCKMODE lockmode); + char fires_when, bool skip_system, LOCKMODE lockmode); static void ATExecEnableDisableRule(Relation rel, char *rulename, char fires_when, LOCKMODE lockmode); static void ATPrepAddInherit(Relation child_rel); @@ -675,7 +675,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, */ localHasOids = interpretOidsOption(stmt->options, (relkind == RELKIND_RELATION || - relkind == RELKIND_PARTITIONED_TABLE)); + relkind == RELKIND_PARTITIONED_TABLE)); descriptor->tdhasoid = (localHasOids || parentOidCount > 0); /* @@ -727,13 +727,13 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, cooked = (CookedConstraint *) palloc(sizeof(CookedConstraint)); cooked->contype = CONSTR_DEFAULT; - cooked->conoid = InvalidOid; /* until created */ + cooked->conoid = InvalidOid; /* until created */ cooked->name = NULL; cooked->attnum = attnum; cooked->expr = colDef->cooked_default; cooked->skip_validation = false; cooked->is_local = true; /* not used for defaults */ - cooked->inhcount = 0; /* ditto */ + cooked->inhcount = 0; /* ditto */ cooked->is_no_inherit = false; cookedDefaults = lappend(cookedDefaults, cooked); descriptor->attrs[attnum - 1]->atthasdef = true; @@ -941,7 +941,7 @@ DropErrorMsgNonExistent(RangeVar *rel, char rightkind, bool missing_ok) { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_SCHEMA), - errmsg("schema \"%s\" does not exist", rel->schemaname))); + errmsg("schema \"%s\" does not exist", rel->schemaname))); } else { @@ -970,7 +970,7 @@ DropErrorMsgNonExistent(RangeVar *rel, char rightkind, bool missing_ok) } } - Assert(rentry->kind != '\0'); /* Should be impossible */ + Assert(rentry->kind != '\0'); /* Should be impossible */ } /* @@ -996,7 +996,7 @@ DropErrorMsgWrongType(const char *relname, char wrongkind, char rightkind) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg(rentry->nota_msg, relname), - (wentry->kind != '\0') ? errhint("%s", _(wentry->drophint_msg)) : 0)); + (wentry->kind != '\0') ? errhint("%s", _(wentry->drophint_msg)) : 0)); } /* @@ -1026,7 +1026,7 @@ RemoveRelations(DropStmt *drop) if (drop->behavior == DROP_CASCADE) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("DROP INDEX CONCURRENTLY does not support CASCADE"))); + errmsg("DROP INDEX CONCURRENTLY does not support CASCADE"))); } /* @@ -1588,7 +1588,7 @@ truncate_check_rel(Relation rel) if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot truncate temporary tables of other sessions"))); + errmsg("cannot truncate temporary tables of other sessions"))); /* * Also check for active uses of the relation in the current transaction, @@ -1690,7 +1690,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence, int parentsWithOids = 0; bool have_bogus_defaults = false; int child_attno; - static Node bogus_marker = {0}; /* marks conflicting defaults */ + static Node bogus_marker = {0}; /* marks conflicting defaults */ List *saved_schema = NIL; /* @@ -1749,8 +1749,8 @@ MergeAttributes(List *schema, List *supers, char relpersistence, while (rest != NULL) { ColumnDef *restdef = lfirst(rest); - ListCell *next = lnext(rest); /* need to save it in case we - * delete it */ + ListCell *next = lnext(rest); /* need to save it in case we + * delete it */ if (strcmp(coldef->colname, restdef->colname) == 0) { @@ -1850,7 +1850,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence, ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg(!is_partition - ? "cannot inherit from temporary relation of another session" + ? "cannot inherit from temporary relation of another session" : "cannot create as partition of temporary relation of another session"))); /* @@ -1867,8 +1867,8 @@ MergeAttributes(List *schema, List *supers, char relpersistence, if (list_member_oid(parentOids, RelationGetRelid(relation))) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_TABLE), - errmsg("relation \"%s\" would be inherited from more than once", - parent->relname))); + errmsg("relation \"%s\" would be inherited from more than once", + parent->relname))); parentOids = lappend_oid(parentOids, RelationGetRelid(relation)); @@ -1923,22 +1923,22 @@ MergeAttributes(List *schema, List *supers, char relpersistence, deftypmod != attribute->atttypmod) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("inherited column \"%s\" has a type conflict", - attributeName), + errmsg("inherited column \"%s\" has a type conflict", + attributeName), errdetail("%s versus %s", format_type_with_typemod(defTypeId, deftypmod), - format_type_with_typemod(attribute->atttypid, - attribute->atttypmod)))); + format_type_with_typemod(attribute->atttypid, + attribute->atttypmod)))); defCollId = GetColumnDefCollation(NULL, def, defTypeId); if (defCollId != attribute->attcollation) ereport(ERROR, (errcode(ERRCODE_COLLATION_MISMATCH), - errmsg("inherited column \"%s\" has a collation conflict", - attributeName), + errmsg("inherited column \"%s\" has a collation conflict", + attributeName), errdetail("\"%s\" versus \"%s\"", get_collation_name(defCollId), - get_collation_name(attribute->attcollation)))); + get_collation_name(attribute->attcollation)))); /* Copy storage parameter */ if (def->storage == 0) @@ -2060,7 +2060,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence, if (found_whole_row) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert whole-row table reference"), + errmsg("cannot convert whole-row table reference"), errdetail("Constraint \"%s\" contains a whole-row reference to table \"%s\".", name, RelationGetRelationName(relation)))); @@ -2073,7 +2073,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence, cooked = (CookedConstraint *) palloc(sizeof(CookedConstraint)); cooked->contype = CONSTR_CHECK; - cooked->conoid = InvalidOid; /* until created */ + cooked->conoid = InvalidOid; /* until created */ cooked->name = pstrdup(name); cooked->attnum = 0; /* not used for constraints */ cooked->expr = expr; @@ -2140,8 +2140,8 @@ MergeAttributes(List *schema, List *supers, char relpersistence, */ if (exist_attno == schema_attno) ereport(NOTICE, - (errmsg("merging column \"%s\" with inherited definition", - attributeName))); + (errmsg("merging column \"%s\" with inherited definition", + attributeName))); else ereport(NOTICE, (errmsg("moving and merging column \"%s\" with inherited definition", attributeName), @@ -2182,8 +2182,8 @@ MergeAttributes(List *schema, List *supers, char relpersistence, else if (newdef->storage != 0 && def->storage != newdef->storage) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("column \"%s\" has a storage parameter conflict", - attributeName), + errmsg("column \"%s\" has a storage parameter conflict", + attributeName), errdetail("%s versus %s", storage_name(def->storage), storage_name(newdef->storage)))); @@ -2271,8 +2271,8 @@ MergeAttributes(List *schema, List *supers, char relpersistence, else ereport(ERROR, (errcode(ERRCODE_DUPLICATE_COLUMN), - errmsg("column \"%s\" specified more than once", - coldef->colname))); + errmsg("column \"%s\" specified more than once", + coldef->colname))); } prev = rest; rest = next; @@ -2293,8 +2293,8 @@ MergeAttributes(List *schema, List *supers, char relpersistence, if (def->cooked_default == &bogus_marker) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_DEFINITION), - errmsg("column \"%s\" inherits conflicting default values", - def->colname), + errmsg("column \"%s\" inherits conflicting default values", + def->colname), errhint("To resolve the conflict, specify a default explicitly."))); } } @@ -2658,7 +2658,7 @@ renameatt_internal(Oid myrelid, ListCell *lo; child_oids = find_typed_table_dependencies(targetrelation->rd_rel->reltype, - RelationGetRelationName(targetrelation), + RelationGetRelationName(targetrelation), behavior); foreach(lo, child_oids) @@ -2711,7 +2711,7 @@ renameatt_internal(Oid myrelid, heap_close(attrelation, RowExclusiveLock); - relation_close(targetrelation, NoLock); /* close rel but keep lock */ + relation_close(targetrelation, NoLock); /* close rel but keep lock */ return attnum; } @@ -2762,10 +2762,10 @@ renameatt(RenameStmt *stmt) attnum = renameatt_internal(relid, - stmt->subname, /* old att name */ - stmt->newname, /* new att name */ + stmt->subname, /* old att name */ + stmt->newname, /* new att name */ stmt->relation->inh, /* recursive? */ - false, /* recursing? */ + false, /* recursing? */ 0, /* expected inhcount */ stmt->behavior); @@ -2917,8 +2917,8 @@ RenameConstraint(RenameStmt *stmt) stmt->subname, stmt->newname, (stmt->relation && - stmt->relation->inh), /* recursive? */ - false, /* recursing? */ + stmt->relation->inh), /* recursive? */ + false, /* recursing? */ 0 /* expected inhcount */ ); } @@ -2994,7 +2994,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, bool is_internal) relrelation = heap_open(RelationRelationId, RowExclusiveLock); reltup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(myrelid)); - if (!HeapTupleIsValid(reltup)) /* shouldn't happen */ + if (!HeapTupleIsValid(reltup)) /* shouldn't happen */ elog(ERROR, "cache lookup failed for relation %u", myrelid); relform = (Form_pg_class) GETSTRUCT(reltup); @@ -3267,7 +3267,7 @@ AlterTableGetLockLevel(List *cmds) */ case AT_AddColumn: /* may rewrite heap, in some cases and visible * to SELECT */ - case AT_SetTableSpace: /* must rewrite heap */ + case AT_SetTableSpace: /* must rewrite heap */ case AT_AlterColumnType: /* must rewrite heap */ case AT_AddOids: /* must rewrite heap */ cmd_lockmode = AccessExclusiveLock; @@ -3279,7 +3279,7 @@ AlterTableGetLockLevel(List *cmds) * might miss data added to the new toast table by concurrent * insert transactions. */ - case AT_SetStorage:/* may add toast tables, see + case AT_SetStorage: /* may add toast tables, see * ATRewriteCatalogs() */ cmd_lockmode = AccessExclusiveLock; break; @@ -3288,28 +3288,28 @@ AlterTableGetLockLevel(List *cmds) * Removing constraints can affect SELECTs that have been * optimised assuming the constraint holds true. */ - case AT_DropConstraint: /* as DROP INDEX */ - case AT_DropNotNull: /* may change some SQL plans */ + case AT_DropConstraint: /* as DROP INDEX */ + case AT_DropNotNull: /* may change some SQL plans */ cmd_lockmode = AccessExclusiveLock; break; /* * Subcommands that may be visible to concurrent SELECTs */ - case AT_DropColumn: /* change visible to SELECT */ + case AT_DropColumn: /* change visible to SELECT */ case AT_AddColumnToView: /* CREATE VIEW */ case AT_DropOids: /* calls AT_DropColumn */ case AT_EnableAlwaysRule: /* may change SELECT rules */ case AT_EnableReplicaRule: /* may change SELECT rules */ - case AT_EnableRule: /* may change SELECT rules */ - case AT_DisableRule: /* may change SELECT rules */ + case AT_EnableRule: /* may change SELECT rules */ + case AT_DisableRule: /* may change SELECT rules */ cmd_lockmode = AccessExclusiveLock; break; /* * Changing owner may remove implicit SELECT privileges */ - case AT_ChangeOwner: /* change visible to SELECT */ + case AT_ChangeOwner: /* change visible to SELECT */ cmd_lockmode = AccessExclusiveLock; break; @@ -3365,8 +3365,8 @@ AlterTableGetLockLevel(List *cmds) break; case AT_AddConstraint: - case AT_ProcessedConstraint: /* becomes AT_AddConstraint */ - case AT_AddConstraintRecurse: /* becomes AT_AddConstraint */ + case AT_ProcessedConstraint: /* becomes AT_AddConstraint */ + case AT_AddConstraintRecurse: /* becomes AT_AddConstraint */ case AT_ReAddConstraint: /* becomes AT_AddConstraint */ if (IsA(cmd->def, Constraint)) { @@ -3446,11 +3446,11 @@ AlterTableGetLockLevel(List *cmds) * applies: we don't currently allow concurrent catalog * updates. */ - case AT_SetStatistics: /* Uses MVCC in getTableAttrs() */ + case AT_SetStatistics: /* Uses MVCC in getTableAttrs() */ case AT_ClusterOn: /* Uses MVCC in getIndexes() */ - case AT_DropCluster: /* Uses MVCC in getIndexes() */ - case AT_SetOptions: /* Uses MVCC in getTableAttrs() */ - case AT_ResetOptions: /* Uses MVCC in getTableAttrs() */ + case AT_DropCluster: /* Uses MVCC in getIndexes() */ + case AT_SetOptions: /* Uses MVCC in getTableAttrs() */ + case AT_ResetOptions: /* Uses MVCC in getTableAttrs() */ cmd_lockmode = ShareUpdateExclusiveLock; break; @@ -3459,8 +3459,7 @@ AlterTableGetLockLevel(List *cmds) cmd_lockmode = AccessExclusiveLock; break; - case AT_ValidateConstraint: /* Uses MVCC in - * getConstraints() */ + case AT_ValidateConstraint: /* Uses MVCC in getConstraints() */ cmd_lockmode = ShareUpdateExclusiveLock; break; @@ -3470,8 +3469,8 @@ AlterTableGetLockLevel(List *cmds) * reasons these can all be used with ALTER TABLE, so we can't * decide between them using the basic grammar. */ - case AT_SetRelOptions: /* Uses MVCC in getIndexes() and - * getTables() */ + case AT_SetRelOptions: /* Uses MVCC in getIndexes() and + * getTables() */ case AT_ResetRelOptions: /* Uses MVCC in getIndexes() and * getTables() */ cmd_lockmode = AlterTableGetRelOptionsLockLevel((List *) cmd->def); @@ -3642,14 +3641,13 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, { case AT_AddColumn: /* ADD COLUMN */ ATSimplePermissions(rel, - ATT_TABLE | ATT_COMPOSITE_TYPE | ATT_FOREIGN_TABLE); + ATT_TABLE | ATT_COMPOSITE_TYPE | ATT_FOREIGN_TABLE); ATPrepAddColumn(wqueue, rel, recurse, recursing, false, cmd, lockmode); /* Recursion occurs during execution phase */ pass = AT_PASS_ADD_COL; break; - case AT_AddColumnToView: /* add column via CREATE OR REPLACE - * VIEW */ + case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */ ATSimplePermissions(rel, ATT_VIEW); ATPrepAddColumn(wqueue, rel, recurse, recursing, true, cmd, lockmode); @@ -3715,7 +3713,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, break; case AT_DropColumn: /* DROP COLUMN */ ATSimplePermissions(rel, - ATT_TABLE | ATT_COMPOSITE_TYPE | ATT_FOREIGN_TABLE); + ATT_TABLE | ATT_COMPOSITE_TYPE | ATT_FOREIGN_TABLE); ATPrepDropColumn(wqueue, rel, recurse, recursing, cmd, lockmode); /* Recursion occurs during execution phase */ pass = AT_PASS_DROP; @@ -3734,13 +3732,13 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, cmd->subtype = AT_AddConstraintRecurse; pass = AT_PASS_ADD_CONSTR; break; - case AT_AddIndexConstraint: /* ADD CONSTRAINT USING INDEX */ + case AT_AddIndexConstraint: /* ADD CONSTRAINT USING INDEX */ ATSimplePermissions(rel, ATT_TABLE); /* This command never recurses */ /* No command-specific prep needed */ pass = AT_PASS_ADD_CONSTR; break; - case AT_DropConstraint: /* DROP CONSTRAINT */ + case AT_DropConstraint: /* DROP CONSTRAINT */ ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE); /* Recursion occurs during execution phase */ /* No command-specific prep needed except saving recurse flag */ @@ -3748,9 +3746,9 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, cmd->subtype = AT_DropConstraintRecurse; pass = AT_PASS_DROP; break; - case AT_AlterColumnType: /* ALTER COLUMN TYPE */ + case AT_AlterColumnType: /* ALTER COLUMN TYPE */ ATSimplePermissions(rel, - ATT_TABLE | ATT_COMPOSITE_TYPE | ATT_FOREIGN_TABLE); + ATT_TABLE | ATT_COMPOSITE_TYPE | ATT_FOREIGN_TABLE); /* Performs own recursion */ ATPrepAlterColumnType(wqueue, tab, rel, recurse, recursing, cmd, lockmode); pass = AT_PASS_ALTER_TYPE; @@ -3823,8 +3821,8 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, pass = AT_PASS_MISC; /* doesn't actually matter */ break; case AT_SetRelOptions: /* SET (...) */ - case AT_ResetRelOptions: /* RESET (...) */ - case AT_ReplaceRelOptions: /* reset them all, then set just these */ + case AT_ResetRelOptions: /* RESET (...) */ + case AT_ReplaceRelOptions: /* reset them all, then set just these */ ATSimplePermissions(rel, ATT_TABLE | ATT_VIEW | ATT_MATVIEW | ATT_INDEX); /* This command never recurses */ /* No command-specific prep needed */ @@ -3842,11 +3840,11 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, /* No command-specific prep needed */ pass = AT_PASS_MISC; break; - case AT_AlterConstraint: /* ALTER CONSTRAINT */ + case AT_AlterConstraint: /* ALTER CONSTRAINT */ ATSimplePermissions(rel, ATT_TABLE); pass = AT_PASS_MISC; break; - case AT_ValidateConstraint: /* VALIDATE CONSTRAINT */ + case AT_ValidateConstraint: /* VALIDATE CONSTRAINT */ ATSimplePermissions(rel, ATT_TABLE | ATT_FOREIGN_TABLE); /* Recursion occurs during execution phase */ /* No command-specific prep needed except saving recurse flag */ @@ -3854,7 +3852,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, cmd->subtype = AT_ValidateConstraintRecurse; pass = AT_PASS_MISC; break; - case AT_ReplicaIdentity: /* REPLICA IDENTITY ... */ + case AT_ReplicaIdentity: /* REPLICA IDENTITY ... */ ATSimplePermissions(rel, ATT_TABLE | ATT_MATVIEW); pass = AT_PASS_MISC; /* This command never recurses */ @@ -3876,7 +3874,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, case AT_EnableReplicaRule: case AT_DisableRule: case AT_AddOf: /* OF */ - case AT_DropOf: /* NOT OF */ + case AT_DropOf: /* NOT OF */ case AT_EnableRowSecurity: case AT_DisableRowSecurity: case AT_ForceRowSecurity: @@ -3910,7 +3908,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd, default: /* oops */ elog(ERROR, "unrecognized alter table type: %d", (int) cmd->subtype); - pass = AT_PASS_UNSET; /* keep compiler quiet */ + pass = AT_PASS_UNSET; /* keep compiler quiet */ break; } Assert(pass > AT_PASS_UNSET); @@ -4002,8 +4000,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, switch (cmd->subtype) { case AT_AddColumn: /* ADD COLUMN */ - case AT_AddColumnToView: /* add column via CREATE OR REPLACE - * VIEW */ + case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */ address = ATExecAddColumn(wqueue, tab, rel, (ColumnDef *) cmd->def, false, false, false, false, lockmode); @@ -4048,7 +4045,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, cmd->behavior, false, false, cmd->missing_ok, lockmode); break; - case AT_DropColumnRecurse: /* DROP COLUMN with recursion */ + case AT_DropColumnRecurse: /* DROP COLUMN with recursion */ address = ATExecDropColumn(wqueue, rel, cmd->name, cmd->behavior, true, false, cmd->missing_ok, lockmode); @@ -4071,8 +4068,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def, true, false, lockmode); break; - case AT_ReAddConstraint: /* Re-add pre-existing check - * constraint */ + case AT_ReAddConstraint: /* Re-add pre-existing check constraint */ address = ATExecAddConstraint(wqueue, tab, rel, (Constraint *) cmd->def, true, true, lockmode); @@ -4080,23 +4076,23 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, case AT_ReAddComment: /* Re-add existing comment */ address = CommentObject((CommentStmt *) cmd->def); break; - case AT_AddIndexConstraint: /* ADD CONSTRAINT USING INDEX */ + case AT_AddIndexConstraint: /* ADD CONSTRAINT USING INDEX */ address = ATExecAddIndexConstraint(tab, rel, (IndexStmt *) cmd->def, lockmode); break; - case AT_AlterConstraint: /* ALTER CONSTRAINT */ + case AT_AlterConstraint: /* ALTER CONSTRAINT */ address = ATExecAlterConstraint(rel, cmd, false, false, lockmode); break; - case AT_ValidateConstraint: /* VALIDATE CONSTRAINT */ + case AT_ValidateConstraint: /* VALIDATE CONSTRAINT */ address = ATExecValidateConstraint(rel, cmd->name, false, false, lockmode); break; - case AT_ValidateConstraintRecurse: /* VALIDATE CONSTRAINT with - * recursion */ + case AT_ValidateConstraintRecurse: /* VALIDATE CONSTRAINT with + * recursion */ address = ATExecValidateConstraint(rel, cmd->name, true, false, lockmode); break; - case AT_DropConstraint: /* DROP CONSTRAINT */ + case AT_DropConstraint: /* DROP CONSTRAINT */ ATExecDropConstraint(rel, cmd->name, cmd->behavior, false, false, cmd->missing_ok, lockmode); @@ -4106,10 +4102,10 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, true, false, cmd->missing_ok, lockmode); break; - case AT_AlterColumnType: /* ALTER COLUMN TYPE */ + case AT_AlterColumnType: /* ALTER COLUMN TYPE */ address = ATExecAlterColumnType(tab, rel, cmd, lockmode); break; - case AT_AlterColumnGenericOptions: /* ALTER COLUMN OPTIONS */ + case AT_AlterColumnGenericOptions: /* ALTER COLUMN OPTIONS */ address = ATExecAlterColumnGenericOptions(rel, cmd->name, (List *) cmd->def, lockmode); @@ -4136,7 +4132,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, true, false, false, cmd->missing_ok, lockmode); break; - case AT_AddOidsRecurse: /* SET WITH OIDS */ + case AT_AddOidsRecurse: /* SET WITH OIDS */ /* Use the ADD COLUMN code, unless prep decided to do nothing */ if (cmd->def != NULL) address = @@ -4158,21 +4154,21 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, */ break; case AT_SetRelOptions: /* SET (...) */ - case AT_ResetRelOptions: /* RESET (...) */ - case AT_ReplaceRelOptions: /* replace entire option list */ + case AT_ResetRelOptions: /* RESET (...) */ + case AT_ReplaceRelOptions: /* replace entire option list */ ATExecSetRelOptions(rel, (List *) cmd->def, cmd->subtype, lockmode); break; case AT_EnableTrig: /* ENABLE TRIGGER name */ ATExecEnableDisableTrigger(rel, cmd->name, - TRIGGER_FIRES_ON_ORIGIN, false, lockmode); + TRIGGER_FIRES_ON_ORIGIN, false, lockmode); break; - case AT_EnableAlwaysTrig: /* ENABLE ALWAYS TRIGGER name */ + case AT_EnableAlwaysTrig: /* ENABLE ALWAYS TRIGGER name */ ATExecEnableDisableTrigger(rel, cmd->name, TRIGGER_FIRES_ALWAYS, false, lockmode); break; - case AT_EnableReplicaTrig: /* ENABLE REPLICA TRIGGER name */ + case AT_EnableReplicaTrig: /* ENABLE REPLICA TRIGGER name */ ATExecEnableDisableTrigger(rel, cmd->name, - TRIGGER_FIRES_ON_REPLICA, false, lockmode); + TRIGGER_FIRES_ON_REPLICA, false, lockmode); break; case AT_DisableTrig: /* DISABLE TRIGGER name */ ATExecEnableDisableTrigger(rel, cmd->name, @@ -4180,17 +4176,17 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, break; case AT_EnableTrigAll: /* ENABLE TRIGGER ALL */ ATExecEnableDisableTrigger(rel, NULL, - TRIGGER_FIRES_ON_ORIGIN, false, lockmode); + TRIGGER_FIRES_ON_ORIGIN, false, lockmode); break; - case AT_DisableTrigAll: /* DISABLE TRIGGER ALL */ + case AT_DisableTrigAll: /* DISABLE TRIGGER ALL */ ATExecEnableDisableTrigger(rel, NULL, TRIGGER_DISABLED, false, lockmode); break; - case AT_EnableTrigUser: /* ENABLE TRIGGER USER */ + case AT_EnableTrigUser: /* ENABLE TRIGGER USER */ ATExecEnableDisableTrigger(rel, NULL, - TRIGGER_FIRES_ON_ORIGIN, true, lockmode); + TRIGGER_FIRES_ON_ORIGIN, true, lockmode); break; - case AT_DisableTrigUser: /* DISABLE TRIGGER USER */ + case AT_DisableTrigUser: /* DISABLE TRIGGER USER */ ATExecEnableDisableTrigger(rel, NULL, TRIGGER_DISABLED, true, lockmode); break; @@ -4199,11 +4195,11 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel, ATExecEnableDisableRule(rel, cmd->name, RULE_FIRES_ON_ORIGIN, lockmode); break; - case AT_EnableAlwaysRule: /* ENABLE ALWAYS RULE name */ + case AT_EnableAlwaysRule: /* ENABLE ALWAYS RULE name */ ATExecEnableDisableRule(rel, cmd->name, RULE_FIRES_ALWAYS, lockmode); break; - case AT_EnableReplicaRule: /* ENABLE REPLICA RULE name */ + case AT_EnableReplicaRule: /* ENABLE REPLICA RULE name */ ATExecEnableDisableRule(rel, cmd->name, RULE_FIRES_ON_REPLICA, lockmode); break; @@ -4365,8 +4361,8 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode) if (RelationIsUsedAsCatalogTable(OldHeap)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot rewrite table \"%s\" used as a catalog table", - RelationGetRelationName(OldHeap)))); + errmsg("cannot rewrite table \"%s\" used as a catalog table", + RelationGetRelationName(OldHeap)))); /* * Don't allow rewrite on temp tables of other backends ... their @@ -4375,7 +4371,7 @@ ATRewriteTables(AlterTableStmt *parsetree, List **wqueue, LOCKMODE lockmode) if (RELATION_IS_OTHER_TEMP(OldHeap)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot rewrite temporary tables of other sessions"))); + errmsg("cannot rewrite temporary tables of other sessions"))); /* * Select destination tablespace (same as original unless user @@ -4559,7 +4555,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) */ oldrel = heap_open(tab->relid, NoLock); oldTupDesc = tab->oldDesc; - newTupDesc = RelationGetDescr(oldrel); /* includes all mods */ + newTupDesc = RelationGetDescr(oldrel); /* includes all mods */ if (OidIsValid(OIDNewHeap)) newrel = heap_open(OIDNewHeap, lockmode); @@ -4751,7 +4747,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) values[ex->attnum - 1] = ExecEvalExpr(ex->exprstate, econtext, - &isnull[ex->attnum - 1]); + &isnull[ex->attnum - 1]); } /* @@ -4783,7 +4779,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) ereport(ERROR, (errcode(ERRCODE_NOT_NULL_VIOLATION), errmsg("column \"%s\" contains null values", - NameStr(newTupDesc->attrs[attn]->attname)), + NameStr(newTupDesc->attrs[attn]->attname)), errtablecol(oldrel, attn + 1))); } @@ -4813,7 +4809,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode) if (partqualstate && !ExecCheck(partqualstate, econtext)) ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), - errmsg("partition constraint is violated by some row"))); + errmsg("partition constraint is violated by some row"))); /* Write the tuple out to the new relation */ if (newrel) @@ -5224,7 +5220,7 @@ find_typed_table_dependencies(Oid typeOid, const char *typeName, DropBehavior be (errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST), errmsg("cannot alter type \"%s\" because it is the type of a typed table", typeName), - errhint("Use ALTER ... CASCADE to alter the typed tables too."))); + errhint("Use ALTER ... CASCADE to alter the typed tables too."))); else result = lappend_oid(result, HeapTupleGetOid(tuple)); } @@ -5368,23 +5364,23 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("child table \"%s\" has different type for column \"%s\"", - RelationGetRelationName(rel), colDef->colname))); + RelationGetRelationName(rel), colDef->colname))); ccollid = GetColumnDefCollation(NULL, colDef, ctypeId); if (ccollid != childatt->attcollation) ereport(ERROR, (errcode(ERRCODE_COLLATION_MISMATCH), errmsg("child table \"%s\" has different collation for column \"%s\"", - RelationGetRelationName(rel), colDef->colname), + RelationGetRelationName(rel), colDef->colname), errdetail("\"%s\" versus \"%s\"", get_collation_name(ccollid), - get_collation_name(childatt->attcollation)))); + get_collation_name(childatt->attcollation)))); /* If it's OID, child column must actually be OID */ if (isOid && childatt->attnum != ObjectIdAttributeNumber) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("child table \"%s\" has a conflicting \"%s\" column", - RelationGetRelationName(rel), colDef->colname))); + errmsg("child table \"%s\" has a conflicting \"%s\" column", + RelationGetRelationName(rel), colDef->colname))); /* Bump the existing child att's inhcount */ childatt->attinhcount++; @@ -5394,8 +5390,8 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, /* Inform the user about the merge */ ereport(NOTICE, - (errmsg("merging definition of column \"%s\" for child \"%s\"", - colDef->colname, RelationGetRelationName(rel)))); + (errmsg("merging definition of column \"%s\" for child \"%s\"", + colDef->colname, RelationGetRelationName(rel)))); heap_close(attrdesc, RowExclusiveLock); return InvalidObjectAddress; @@ -5697,8 +5693,8 @@ check_for_column_name_collision(Relation rel, const char *colname, if (attnum <= 0) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_COLUMN), - errmsg("column name \"%s\" conflicts with a system column name", - colname))); + errmsg("column name \"%s\" conflicts with a system column name", + colname))); else { if (if_not_exists) @@ -5849,8 +5845,8 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode) if (get_attidentity(RelationGetRelid(rel), attnum)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("column \"%s\" of relation \"%s\" is an identity column", - colName, RelationGetRelationName(rel)))); + errmsg("column \"%s\" of relation \"%s\" is an identity column", + colName, RelationGetRelationName(rel)))); /* * Check that the attribute is not in a primary key @@ -5907,8 +5903,8 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode) if (tupDesc->attrs[parent_attnum - 1]->attnotnull) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("column \"%s\" is marked NOT NULL in parent table", - colName))); + errmsg("column \"%s\" is marked NOT NULL in parent table", + colName))); heap_close(parent, AccessShareLock); } @@ -6051,8 +6047,8 @@ ATExecColumnDefault(Relation rel, const char *colName, if (get_attidentity(RelationGetRelid(rel), attnum)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("column \"%s\" of relation \"%s\" is an identity column", - colName, RelationGetRelationName(rel)), + errmsg("column \"%s\" of relation \"%s\" is an identity column", + colName, RelationGetRelationName(rel)), newDefault ? 0 : errhint("Use ALTER TABLE ... ALTER COLUMN ... DROP IDENTITY instead."))); /* @@ -6143,8 +6139,8 @@ ATExecAddIdentity(Relation rel, const char *colName, if (attTup->atthasdef) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("column \"%s\" of relation \"%s\" already has a default value", - colName, RelationGetRelationName(rel)))); + errmsg("column \"%s\" of relation \"%s\" already has a default value", + colName, RelationGetRelationName(rel)))); attTup->attidentity = cdef->identity; CatalogTupleUpdate(attrelation, &tuple->t_self, tuple); @@ -6220,8 +6216,8 @@ ATExecSetIdentity(Relation rel, const char *colName, Node *def, LOCKMODE lockmod if (!attTup->attidentity) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("column \"%s\" of relation \"%s\" is not an identity column", - colName, RelationGetRelationName(rel)))); + errmsg("column \"%s\" of relation \"%s\" is not an identity column", + colName, RelationGetRelationName(rel)))); if (generatedEl) { @@ -6769,12 +6765,12 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName, CheckTableNotInUse(childrel, "ALTER TABLE"); tuple = SearchSysCacheCopyAttName(childrelid, colName); - if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ + if (!HeapTupleIsValid(tuple)) /* shouldn't happen */ elog(ERROR, "cache lookup failed for attribute \"%s\" of relation %u", colName, childrelid); childatt = (Form_pg_attribute) GETSTRUCT(tuple); - if (childatt->attinhcount <= 0) /* shouldn't happen */ + if (childatt->attinhcount <= 0) /* shouldn't happen */ elog(ERROR, "relation %u has non-inherited attribute \"%s\"", childrelid, colName); @@ -6996,8 +6992,8 @@ ATExecAddIndexConstraint(AlteredTableInfo *tab, Relation rel, stmt->deferrable, stmt->initdeferred, stmt->primary, - true, /* update pg_index */ - true, /* remove old dependencies */ + true, /* update pg_index */ + true, /* remove old dependencies */ allowSystemTableMods, false); /* is_internal */ @@ -7058,7 +7054,7 @@ ATExecAddConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, else newConstraint->conname = ChooseConstraintName(RelationGetRelationName(rel), - strVal(linitial(newConstraint->fk_attrs)), + strVal(linitial(newConstraint->fk_attrs)), "fkey", RelationGetNamespace(rel), NIL); @@ -7118,8 +7114,8 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, newcons = AddRelationNewConstraints(rel, NIL, list_make1(copyObject(constr)), recursing | is_readd, /* allow_merge */ - !recursing, /* is_local */ - is_readd); /* is_internal */ + !recursing, /* is_local */ + is_readd); /* is_internal */ /* we don't expect more than one constraint here */ Assert(list_length(newcons) <= 1); @@ -7566,8 +7562,7 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, RelationGetRelid(rel), fkattnum, numfks, - InvalidOid, /* not a domain - * constraint */ + InvalidOid, /* not a domain constraint */ indexOid, RelationGetRelid(pkrel), pkattnum, @@ -7578,13 +7573,13 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel, fkconstraint->fk_upd_action, fkconstraint->fk_del_action, fkconstraint->fk_matchtype, - NULL, /* no exclusion constraint */ - NULL, /* no check constraint */ + NULL, /* no exclusion constraint */ + NULL, /* no check constraint */ NULL, NULL, - true, /* islocal */ - 0, /* inhcount */ - true, /* isnoinherit */ + true, /* islocal */ + 0, /* inhcount */ + true, /* isnoinherit */ false); /* is_internal */ ObjectAddressSet(address, ConstraintRelationId, constrOid); @@ -8097,7 +8092,7 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid, atttypids[i] = attnumTypeId(pkrel, pkattno); opclasses[i] = indclass->values[i]; *attnamelist = lappend(*attnamelist, - makeString(pstrdup(NameStr(*attnumAttName(pkrel, pkattno))))); + makeString(pstrdup(NameStr(*attnumAttName(pkrel, pkattno))))); } ReleaseSysCache(indexTuple); @@ -8768,8 +8763,8 @@ ATExecDropConstraint(Relation rel, const char *constrName, { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("constraint \"%s\" of relation \"%s\" does not exist", - constrName, RelationGetRelationName(rel)))); + errmsg("constraint \"%s\" of relation \"%s\" does not exist", + constrName, RelationGetRelationName(rel)))); } else { @@ -8836,9 +8831,9 @@ ATExecDropConstraint(Relation rel, const char *constrName, if (!HeapTupleIsValid(tuple)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("constraint \"%s\" of relation \"%s\" does not exist", - constrName, - RelationGetRelationName(childrel)))); + errmsg("constraint \"%s\" of relation \"%s\" does not exist", + constrName, + RelationGetRelationName(childrel)))); copy_tuple = heap_copytuple(tuple); @@ -8846,7 +8841,7 @@ ATExecDropConstraint(Relation rel, const char *constrName, con = (Form_pg_constraint) GETSTRUCT(copy_tuple); - if (con->coninhcount <= 0) /* shouldn't happen */ + if (con->coninhcount <= 0) /* shouldn't happen */ elog(ERROR, "relation %u has non-inherited constraint \"%s\"", childrelid, constrName); @@ -8956,7 +8951,7 @@ ATPrepAlterColumnType(List **wqueue, if (!is_expr) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("cannot alter type of column named in partition key"))); + errmsg("cannot alter type of column named in partition key"))); else ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), @@ -9020,10 +9015,10 @@ ATPrepAlterColumnType(List **wqueue, errmsg("column \"%s\" cannot be cast automatically to type %s", colName, format_type_be(targettype)), /* translator: USING is SQL, don't translate it */ - errhint("You might need to specify \"USING %s::%s\".", - quote_identifier(colName), - format_type_with_typemod(targettype, - targettypmod)))); + errhint("You might need to specify \"USING %s::%s\".", + quote_identifier(colName), + format_type_with_typemod(targettype, + targettypmod)))); } /* Fix collations after all else */ @@ -9109,7 +9104,7 @@ ATPrepAlterColumnType(List **wqueue, attmap = convert_tuples_by_name_map(RelationGetDescr(childrel), RelationGetDescr(rel), - gettext_noop("could not convert row type")); + gettext_noop("could not convert row type")); ((ColumnDef *) cmd->def)->cooked_default = map_variable_attnos(def->cooked_default, 1, 0, @@ -9118,7 +9113,7 @@ ATPrepAlterColumnType(List **wqueue, if (found_whole_row) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert whole-row table reference"), + errmsg("cannot convert whole-row table reference"), errdetail("USING expression contains a whole-row table reference."))); pfree(attmap); } @@ -9204,7 +9199,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, /* Look up the target column */ heapTup = SearchSysCacheCopyAttName(RelationGetRelid(rel), colName); - if (!HeapTupleIsValid(heapTup)) /* shouldn't happen */ + if (!HeapTupleIsValid(heapTup)) /* shouldn't happen */ ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("column \"%s\" of relation \"%s\" does not exist", @@ -9244,8 +9239,8 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, defaultexpr = build_column_default(rel, attnum); Assert(defaultexpr); defaultexpr = strip_implicit_coercions(defaultexpr); - defaultexpr = coerce_to_target_type(NULL, /* no UNKNOWN params */ - defaultexpr, exprType(defaultexpr), + defaultexpr = coerce_to_target_type(NULL, /* no UNKNOWN params */ + defaultexpr, exprType(defaultexpr), targettype, targettypmod, COERCION_ASSIGNMENT, COERCE_IMPLICIT_CAST, @@ -9316,9 +9311,9 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, if (!list_member_oid(tab->changedIndexOids, foundObject.objectId)) { tab->changedIndexOids = lappend_oid(tab->changedIndexOids, - foundObject.objectId); + foundObject.objectId); tab->changedIndexDefs = lappend(tab->changedIndexDefs, - pg_get_indexdef_string(foundObject.objectId)); + pg_get_indexdef_string(foundObject.objectId)); } } else if (relKind == RELKIND_SEQUENCE) @@ -9739,7 +9734,7 @@ ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab, LOCKMODE lockmode) bool conislocal; tup = SearchSysCache1(CONSTROID, ObjectIdGetDatum(oldId)); - if (!HeapTupleIsValid(tup)) /* should not happen */ + if (!HeapTupleIsValid(tup)) /* should not happen */ elog(ERROR, "cache lookup failed for constraint %u", oldId); con = (Form_pg_constraint) GETSTRUCT(tup); relid = con->conrelid; @@ -9832,7 +9827,7 @@ ATPostAlterTypeParse(Oid oldId, Oid oldRelId, Oid refRelId, char *cmd, else if (IsA(stmt, AlterTableStmt)) querytree_list = list_concat(querytree_list, transformAlterTableStmt(oldRelId, - (AlterTableStmt *) stmt, + (AlterTableStmt *) stmt, cmd)); else querytree_list = lappend(querytree_list, stmt); @@ -9959,7 +9954,7 @@ RebuildConstraintComment(AlteredTableInfo *tab, int pass, Oid objid, cmd = makeNode(CommentStmt); cmd->objtype = OBJECT_TABCONSTRAINT; cmd->object = (Node *) list_make3(makeString(get_namespace_name(RelationGetNamespace(rel))), - makeString(pstrdup(RelationGetRelationName(rel))), + makeString(pstrdup(RelationGetRelationName(rel))), makeString(pstrdup(conname))); cmd->comment = comment_str; @@ -10112,9 +10107,9 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot change owner of sequence \"%s\"", NameStr(tuple_class->relname)), - errdetail("Sequence \"%s\" is linked to table \"%s\".", - NameStr(tuple_class->relname), - get_rel_name(tableId)))); + errdetail("Sequence \"%s\" is linked to table \"%s\".", + NameStr(tuple_class->relname), + get_rel_name(tableId)))); } break; case RELKIND_COMPOSITE_TYPE: @@ -10133,8 +10128,8 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock default: ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("\"%s\" is not a table, view, sequence, or foreign table", - NameStr(tuple_class->relname)))); + errmsg("\"%s\" is not a table, view, sequence, or foreign table", + NameStr(tuple_class->relname)))); } /* @@ -10996,7 +10991,7 @@ AlterTableMoveAll(AlterTableMoveAllStmt *stmt) ereport(NOTICE, (errcode(ERRCODE_NO_DATA_FOUND), errmsg("no matching relations in tablespace \"%s\" found", - orig_tablespaceoid == InvalidOid ? "(database default)" : + orig_tablespaceoid == InvalidOid ? "(database default)" : get_tablespace_name(orig_tablespaceoid)))); /* Everything is locked, loop through and move all of the relations. */ @@ -11121,7 +11116,7 @@ copy_relation_data(SMgrRelation src, SMgrRelation dst, */ static void ATExecEnableDisableTrigger(Relation rel, char *trigname, - char fires_when, bool skip_system, LOCKMODE lockmode) + char fires_when, bool skip_system, LOCKMODE lockmode) { EnableDisableTrigger(rel, trigname, fires_when, skip_system); } @@ -11199,14 +11194,14 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent, LOCKMODE lockmode) !parent_rel->rd_islocaltemp) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot inherit from temporary relation of another session"))); + errmsg("cannot inherit from temporary relation of another session"))); /* Ditto for the child */ if (child_rel->rd_rel->relpersistence == RELPERSISTENCE_TEMP && !child_rel->rd_islocaltemp) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot inherit to temporary relation of another session"))); + errmsg("cannot inherit to temporary relation of another session"))); /* Prevent partitioned tables from becoming inheritance parents */ if (parent_rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) @@ -11310,8 +11305,8 @@ CreateInheritance(Relation child_rel, Relation parent_rel) if (inh->inhparent == RelationGetRelid(parent_rel)) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_TABLE), - errmsg("relation \"%s\" would be inherited from more than once", - RelationGetRelationName(parent_rel)))); + errmsg("relation \"%s\" would be inherited from more than once", + RelationGetRelationName(parent_rel)))); if (inh->inhseqno > inhseqno) inhseqno = inh->inhseqno; @@ -11454,8 +11449,8 @@ MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel) if (attribute->attnotnull && !childatt->attnotnull) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("column \"%s\" in child table must be marked NOT NULL", - attributeName))); + errmsg("column \"%s\" in child table must be marked NOT NULL", + attributeName))); /* * OK, bump the child column's inheritance count. (If we fail @@ -11498,7 +11493,7 @@ MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel) * system column, not some random column named "oid". */ tuple = SearchSysCacheCopy2(ATTNUM, - ObjectIdGetDatum(RelationGetRelid(child_rel)), + ObjectIdGetDatum(RelationGetRelid(child_rel)), Int16GetDatum(ObjectIdAttributeNumber)); if (HeapTupleIsValid(tuple)) { @@ -11778,15 +11773,15 @@ RemoveInheritance(Relation child_rel, Relation parent_rel) if (child_is_partition) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_TABLE), - errmsg("relation \"%s\" is not a partition of relation \"%s\"", - RelationGetRelationName(child_rel), - RelationGetRelationName(parent_rel)))); + errmsg("relation \"%s\" is not a partition of relation \"%s\"", + RelationGetRelationName(child_rel), + RelationGetRelationName(parent_rel)))); else ereport(ERROR, (errcode(ERRCODE_UNDEFINED_TABLE), - errmsg("relation \"%s\" is not a parent of relation \"%s\"", - RelationGetRelationName(parent_rel), - RelationGetRelationName(child_rel)))); + errmsg("relation \"%s\" is not a parent of relation \"%s\"", + RelationGetRelationName(parent_rel), + RelationGetRelationName(child_rel)))); } /* @@ -11886,7 +11881,7 @@ RemoveInheritance(Relation child_rel, Relation parent_rel) HeapTuple copyTuple = heap_copytuple(constraintTuple); Form_pg_constraint copy_con = (Form_pg_constraint) GETSTRUCT(copyTuple); - if (copy_con->coninhcount <= 0) /* shouldn't happen */ + if (copy_con->coninhcount <= 0) /* shouldn't happen */ elog(ERROR, "relation %u has non-inherited constraint \"%s\"", RelationGetRelid(child_rel), NameStr(copy_con->conname)); @@ -12051,8 +12046,8 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode) if (strncmp(table_attname, type_attname, NAMEDATALEN) != 0) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("table has column \"%s\" where type requires \"%s\"", - table_attname, type_attname))); + errmsg("table has column \"%s\" where type requires \"%s\"", + table_attname, type_attname))); /* Compare type. */ if (table_attr->atttypid != type_attr->atttypid || @@ -12060,8 +12055,8 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode) table_attr->attcollation != type_attr->attcollation) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("table \"%s\" has different type for column \"%s\"", - RelationGetRelationName(rel), type_attname))); + errmsg("table \"%s\" has different type for column \"%s\"", + RelationGetRelationName(rel), type_attname))); } DecrTupleDescRefCount(typeTupleDesc); @@ -12174,7 +12169,7 @@ relation_mark_replica_identity(Relation rel, char ri_type, Oid indexOid, */ pg_class = heap_open(RelationRelationId, RowExclusiveLock); pg_class_tuple = SearchSysCacheCopy1(RELOID, - ObjectIdGetDatum(RelationGetRelid(rel))); + ObjectIdGetDatum(RelationGetRelid(rel))); if (!HeapTupleIsValid(pg_class_tuple)) elog(ERROR, "cache lookup failed for relation \"%s\"", RelationGetRelationName(rel)); @@ -12307,20 +12302,20 @@ ATExecReplicaIdentity(Relation rel, ReplicaIdentityStmt *stmt, LOCKMODE lockmode !indexRel->rd_index->indisunique) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot use non-unique index \"%s\" as replica identity", - RelationGetRelationName(indexRel)))); + errmsg("cannot use non-unique index \"%s\" as replica identity", + RelationGetRelationName(indexRel)))); /* Deferred indexes are not guaranteed to be always unique. */ if (!indexRel->rd_index->indimmediate) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot use non-immediate index \"%s\" as replica identity", - RelationGetRelationName(indexRel)))); + errmsg("cannot use non-immediate index \"%s\" as replica identity", + RelationGetRelationName(indexRel)))); /* Expression indexes aren't supported. */ if (RelationGetIndexExpressions(indexRel) != NIL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot use expression index \"%s\" as replica identity", - RelationGetRelationName(indexRel)))); + errmsg("cannot use expression index \"%s\" as replica identity", + RelationGetRelationName(indexRel)))); /* Predicate indexes aren't supported. */ if (RelationGetIndexPredicate(indexRel) != NIL) ereport(ERROR, @@ -13106,7 +13101,7 @@ AlterTableNamespace(AlterObjectSchemaStmt *stmt, Oid *oldschema) sequenceIsOwned(relid, DEPENDENCY_INTERNAL, &tableId, &colId)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot move an owned sequence into another schema"), + errmsg("cannot move an owned sequence into another schema"), errdetail("Sequence \"%s\" is linked to table \"%s\".", RelationGetRelationName(rel), get_rel_name(tableId)))); @@ -13548,7 +13543,7 @@ PreCommit_on_commit_actions(void) if (oids_to_truncate != NIL) { heap_truncate(oids_to_truncate); - CommandCounterIncrement(); /* XXX needed? */ + CommandCounterIncrement(); /* XXX needed? */ } } @@ -13691,7 +13686,7 @@ RangeVarCallbackOwnsRelation(const RangeVar *relation, return; tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relId)); - if (!HeapTupleIsValid(tuple)) /* should not happen */ + if (!HeapTupleIsValid(tuple)) /* should not happen */ elog(ERROR, "cache lookup failed for relation %u", relId); if (!pg_class_ownercheck(relId, GetUserId())) @@ -14063,15 +14058,15 @@ ComputePartitionAttrs(Relation rel, List *partParams, AttrNumber *partattrs, if (!HeapTupleIsValid(atttuple)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" named in partition key does not exist", - pelem->name))); + errmsg("column \"%s\" named in partition key does not exist", + pelem->name))); attform = (Form_pg_attribute) GETSTRUCT(atttuple); if (attform->attnum <= 0) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("cannot use system column \"%s\" in partition key", - pelem->name))); + errmsg("cannot use system column \"%s\" in partition key", + pelem->name))); partattrs[attn] = attform->attnum; atttype = attform->atttypid; @@ -14213,8 +14208,8 @@ ComputePartitionAttrs(Relation rel, List *partParams, AttrNumber *partattrs, if (!OidIsValid(partopclass[attn])) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("data type %s has no default btree operator class", - format_type_be(atttype)), + errmsg("data type %s has no default btree operator class", + format_type_be(atttype)), errhint("You must specify a btree operator class or define a default btree operator class for the data type."))); } else @@ -14341,17 +14336,17 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd) if (rel->rd_rel->relhasoids && !attachRel->rd_rel->relhasoids) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot attach table \"%s\" without OIDs as partition of" - " table \"%s\" with OIDs", RelationGetRelationName(attachRel), - RelationGetRelationName(rel)))); + errmsg("cannot attach table \"%s\" without OIDs as partition of" + " table \"%s\" with OIDs", RelationGetRelationName(attachRel), + RelationGetRelationName(rel)))); /* OTOH, if parent doesn't have them, do not allow in attachRel either */ if (attachRel->rd_rel->relhasoids && !rel->rd_rel->relhasoids) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot attach table \"%s\" with OIDs as partition of table" - " \"%s\" without OIDs", RelationGetRelationName(attachRel), - RelationGetRelationName(rel)))); + errmsg("cannot attach table \"%s\" with OIDs as partition of table" + " \"%s\" without OIDs", RelationGetRelationName(attachRel), + RelationGetRelationName(rel)))); /* Check if there are any columns in attachRel that aren't in the parent */ tupleDesc = RelationGetDescr(attachRel); diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index dc4d3ab02d..8036d95ac9 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -165,8 +165,8 @@ TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo) if (errno != ENOENT || !isRedo) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not create directory \"%s\": %m", - dir))); + errmsg("could not create directory \"%s\": %m", + dir))); /* * Parent directories are missing during WAL replay, so @@ -182,8 +182,8 @@ TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo) if (mkdir(parentdir, S_IRWXU) < 0 && errno != EEXIST) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not create directory \"%s\": %m", - parentdir))); + errmsg("could not create directory \"%s\": %m", + parentdir))); pfree(parentdir); /* create one parent up if not exist */ @@ -193,16 +193,16 @@ TablespaceCreateDbspace(Oid spcNode, Oid dbNode, bool isRedo) if (mkdir(parentdir, S_IRWXU) < 0 && errno != EEXIST) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not create directory \"%s\": %m", - parentdir))); + errmsg("could not create directory \"%s\": %m", + parentdir))); pfree(parentdir); /* Create database directory */ if (mkdir(dir, S_IRWXU) < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not create directory \"%s\": %m", - dir))); + errmsg("could not create directory \"%s\": %m", + dir))); } } @@ -296,7 +296,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt) */ strlen(PGXCNodeName) + 1 + #endif - OIDCHARS + 1 + OIDCHARS + 1 + FORKNAMECHARS + 1 + OIDCHARS > MAXPGPATH) + OIDCHARS + 1 + OIDCHARS + 1 + FORKNAMECHARS + 1 + OIDCHARS > MAXPGPATH) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("tablespace location \"%s\" is too long", @@ -317,7 +317,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt) (errcode(ERRCODE_RESERVED_NAME), errmsg("unacceptable tablespace name \"%s\"", stmt->tablespacename), - errdetail("The prefix \"pg_\" is reserved for system tablespaces."))); + errdetail("The prefix \"pg_\" is reserved for system tablespaces."))); /* * Check that there is no other tablespace by this name. (The unique @@ -411,7 +411,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("tablespaces are not supported on this platform"))); return InvalidOid; /* keep compiler quiet */ -#endif /* HAVE_SYMLINK */ +#endif /* HAVE_SYMLINK */ } /* @@ -572,7 +572,7 @@ DropTableSpace(DropTableSpaceStmt *stmt) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("tablespaces are not supported on this platform"))); -#endif /* HAVE_SYMLINK */ +#endif /* HAVE_SYMLINK */ } @@ -619,8 +619,8 @@ create_tablespace_directories(const char *location, const Oid tablespaceoid) else ereport(ERROR, (errcode_for_file_access(), - errmsg("could not set permissions on directory \"%s\": %m", - location))); + errmsg("could not set permissions on directory \"%s\": %m", + location))); } if (InRecovery) @@ -1057,7 +1057,7 @@ RenameTableSpace(const char *oldname, const char *newname) ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), errmsg("unacceptable tablespace name \"%s\"", newname), - errdetail("The prefix \"pg_\" is reserved for system tablespaces."))); + errdetail("The prefix \"pg_\" is reserved for system tablespaces."))); /* Make sure the new name doesn't exist */ ScanKeyInit(&entry[0], @@ -1619,8 +1619,8 @@ tblspc_redo(XLogReaderState *record) if (!destroy_tablespace_directories(xlrec->ts_id, true)) ereport(LOG, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("directories for tablespace %u could not be removed", - xlrec->ts_id), + errmsg("directories for tablespace %u could not be removed", + xlrec->ts_id), errhint("You can remove the directories manually if necessary."))); } } diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 619d422e62..8f6de3fc69 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -200,7 +200,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is a partitioned table", RelationGetRelationName(rel)), - errdetail("Partitioned tables cannot have ROW triggers."))); + errdetail("Partitioned tables cannot have ROW triggers."))); } else if (rel->rd_rel->relkind == RELKIND_VIEW) { @@ -230,21 +230,21 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is a foreign table", RelationGetRelationName(rel)), - errdetail("Foreign tables cannot have INSTEAD OF triggers."))); + errdetail("Foreign tables cannot have INSTEAD OF triggers."))); if (TRIGGER_FOR_TRUNCATE(stmt->events)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is a foreign table", RelationGetRelationName(rel)), - errdetail("Foreign tables cannot have TRUNCATE triggers."))); + errdetail("Foreign tables cannot have TRUNCATE triggers."))); if (stmt->isconstraint) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("\"%s\" is a foreign table", RelationGetRelationName(rel)), - errdetail("Foreign tables cannot have constraint triggers."))); + errdetail("Foreign tables cannot have constraint triggers."))); } else ereport(ERROR, @@ -319,7 +319,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, if (stmt->whenClause) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("INSTEAD OF triggers cannot have WHEN conditions"))); + errmsg("INSTEAD OF triggers cannot have WHEN conditions"))); if (stmt->columns != NIL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -403,7 +403,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, if (newtablename != NULL) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("NEW TABLE cannot be specified multiple times"))); + errmsg("NEW TABLE cannot be specified multiple times"))); newtablename = tt->name; } @@ -418,7 +418,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, if (oldtablename != NULL) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("OLD TABLE cannot be specified multiple times"))); + errmsg("OLD TABLE cannot be specified multiple times"))); oldtablename = tt->name; } @@ -428,7 +428,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, strcmp(newtablename, oldtablename) == 0) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("OLD TABLE name and NEW TABLE name cannot be the same"))); + errmsg("OLD TABLE name and NEW TABLE name cannot be the same"))); } /* @@ -553,9 +553,9 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, if (funcrettype == OPAQUEOID) { ereport(WARNING, - (errmsg("changing return type of function %s from %s to %s", - NameListToString(stmt->funcname), - "opaque", "trigger"))); + (errmsg("changing return type of function %s from %s to %s", + NameListToString(stmt->funcname), + "opaque", "trigger"))); SetFunctionReturnType(funcoid, TRIGGEROID); } else @@ -600,11 +600,11 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, stmt->initdeferred, true, RelationGetRelid(rel), - NULL, /* no conkey */ + NULL, /* no conkey */ 0, - InvalidOid, /* no domain */ - InvalidOid, /* no index */ - InvalidOid, /* no foreign key */ + InvalidOid, /* no domain */ + InvalidOid, /* no index */ + InvalidOid, /* no foreign key */ NULL, NULL, NULL, @@ -613,14 +613,14 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, ' ', ' ', ' ', - NULL, /* no exclusion */ - NULL, /* no check constraint */ + NULL, /* no exclusion */ + NULL, /* no check constraint */ NULL, NULL, - true, /* islocal */ - 0, /* inhcount */ - true, /* isnoinherit */ - isInternal); /* is_internal */ + true, /* islocal */ + 0, /* inhcount */ + true, /* isnoinherit */ + isInternal); /* is_internal */ } /* @@ -673,8 +673,8 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, if (namestrcmp(&(pg_trigger->tgname), trigname) == 0) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("trigger \"%s\" for relation \"%s\" already exists", - trigname, RelationGetRelationName(rel)))); + errmsg("trigger \"%s\" for relation \"%s\" already exists", + trigname, RelationGetRelationName(rel)))); } systable_endscan(tgscan); } @@ -686,7 +686,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, values[Anum_pg_trigger_tgrelid - 1] = ObjectIdGetDatum(RelationGetRelid(rel)); values[Anum_pg_trigger_tgname - 1] = DirectFunctionCall1(namein, - CStringGetDatum(trigname)); + CStringGetDatum(trigname)); values[Anum_pg_trigger_tgfoid - 1] = ObjectIdGetDatum(funcoid); values[Anum_pg_trigger_tgtype - 1] = Int16GetDatum(tgtype); values[Anum_pg_trigger_tgenabled - 1] = CharGetDatum(TRIGGER_FIRES_ON_ORIGIN); @@ -732,13 +732,13 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, } values[Anum_pg_trigger_tgnargs - 1] = Int16GetDatum(nargs); values[Anum_pg_trigger_tgargs - 1] = DirectFunctionCall1(byteain, - CStringGetDatum(args)); + CStringGetDatum(args)); } else { values[Anum_pg_trigger_tgnargs - 1] = Int16GetDatum(0); values[Anum_pg_trigger_tgargs - 1] = DirectFunctionCall1(byteain, - CStringGetDatum("")); + CStringGetDatum("")); } /* build column number array if it's a column-specific trigger */ @@ -762,8 +762,8 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, if (attnum == InvalidAttrNumber) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" of relation \"%s\" does not exist", - name, RelationGetRelationName(rel)))); + errmsg("column \"%s\" of relation \"%s\" does not exist", + name, RelationGetRelationName(rel)))); /* Check for duplicates */ for (j = i - 1; j >= 0; j--) @@ -789,12 +789,12 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString, if (oldtablename) values[Anum_pg_trigger_tgoldtable - 1] = DirectFunctionCall1(namein, - CStringGetDatum(oldtablename)); + CStringGetDatum(oldtablename)); else nulls[Anum_pg_trigger_tgoldtable - 1] = true; if (newtablename) values[Anum_pg_trigger_tgnewtable - 1] = DirectFunctionCall1(namein, - CStringGetDatum(newtablename)); + CStringGetDatum(newtablename)); else nulls[Anum_pg_trigger_tgnewtable - 1] = true; @@ -1080,9 +1080,9 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid) MemoryContext oldContext; ereport(NOTICE, - (errmsg("ignoring incomplete trigger group for constraint \"%s\" %s", - constr_name, buf.data), - errdetail_internal("%s", _(funcdescr[funcnum])))); + (errmsg("ignoring incomplete trigger group for constraint \"%s\" %s", + constr_name, buf.data), + errdetail_internal("%s", _(funcdescr[funcnum])))); oldContext = MemoryContextSwitchTo(TopMemoryContext); info = (OldTriggerInfo *) palloc0(sizeof(OldTriggerInfo)); info->args = copyObject(stmt->args); @@ -1096,9 +1096,9 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid) { /* Second trigger of set */ ereport(NOTICE, - (errmsg("ignoring incomplete trigger group for constraint \"%s\" %s", - constr_name, buf.data), - errdetail_internal("%s", _(funcdescr[funcnum])))); + (errmsg("ignoring incomplete trigger group for constraint \"%s\" %s", + constr_name, buf.data), + errdetail_internal("%s", _(funcdescr[funcnum])))); } else { @@ -1574,8 +1574,8 @@ EnableDisableTrigger(Relation rel, const char *tgname, if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("permission denied: \"%s\" is a system trigger", - NameStr(oldtrig->tgname)))); + errmsg("permission denied: \"%s\" is a system trigger", + NameStr(oldtrig->tgname)))); } found = true; @@ -1682,7 +1682,7 @@ RelationBuildTriggers(Relation relation) build->tgoid = HeapTupleGetOid(htup); build->tgname = DatumGetCString(DirectFunctionCall1(nameout, - NameGetDatum(&pg_trigger->tgname))); + NameGetDatum(&pg_trigger->tgname))); build->tgfoid = pg_trigger->tgfoid; build->tgtype = pg_trigger->tgtype; build->tgenabled = pg_trigger->tgenabled; @@ -2035,7 +2035,7 @@ equalTriggerDescs(TriggerDesc *trigdesc1, TriggerDesc *trigdesc2) return false; return true; } -#endif /* NOT_USED */ +#endif /* NOT_USED */ /* * Call a trigger function. @@ -2190,7 +2190,7 @@ ExecBSInsertTriggers(EState *estate, ResultRelInfo *relinfo) if (newtuple) ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("BEFORE STATEMENT trigger cannot return a value"))); + errmsg("BEFORE STATEMENT trigger cannot return a value"))); } } @@ -2396,7 +2396,7 @@ ExecBSDeleteTriggers(EState *estate, ResultRelInfo *relinfo) if (newtuple) ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("BEFORE STATEMENT trigger cannot return a value"))); + errmsg("BEFORE STATEMENT trigger cannot return a value"))); } } @@ -2607,7 +2607,7 @@ ExecBSUpdateTriggers(EState *estate, ResultRelInfo *relinfo) if (newtuple) ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("BEFORE STATEMENT trigger cannot return a value"))); + errmsg("BEFORE STATEMENT trigger cannot return a value"))); } } @@ -2749,7 +2749,7 @@ ExecARUpdateTriggers(EState *estate, ResultRelInfo *relinfo, TriggerDesc *trigdesc = relinfo->ri_TrigDesc; if (trigdesc && (trigdesc->trig_update_after_row || - trigdesc->trig_update_old_table || trigdesc->trig_update_new_table)) + trigdesc->trig_update_old_table || trigdesc->trig_update_new_table)) { HeapTuple trigtuple; @@ -2886,7 +2886,7 @@ ExecBSTruncateTriggers(EState *estate, ResultRelInfo *relinfo) if (newtuple) ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("BEFORE STATEMENT trigger cannot return a value"))); + errmsg("BEFORE STATEMENT trigger cannot return a value"))); } } @@ -3061,7 +3061,7 @@ TriggerEnabled(EState *estate, ResultRelInfo *relinfo, trigger->tgenabled == TRIGGER_DISABLED) return false; } - else /* ORIGIN or LOCAL role */ + else /* ORIGIN or LOCAL role */ { if (trigger->tgenabled == TRIGGER_FIRES_ON_REPLICA || trigger->tgenabled == TRIGGER_DISABLED) @@ -3267,8 +3267,7 @@ typedef SetConstraintStateData *SetConstraintState; */ typedef uint32 TriggerFlags; -#define AFTER_TRIGGER_OFFSET 0x0FFFFFFF /* must be low-order - * bits */ +#define AFTER_TRIGGER_OFFSET 0x0FFFFFFF /* must be low-order bits */ #define AFTER_TRIGGER_DONE 0x10000000 #define AFTER_TRIGGER_IN_PROGRESS 0x20000000 /* bits describing the size and tuple sources of this event */ @@ -3302,13 +3301,13 @@ typedef struct AfterTriggerEventDataOneCtid { TriggerFlags ate_flags; /* status bits and offset to shared data */ ItemPointerData ate_ctid1; /* inserted, deleted, or old updated tuple */ -} AfterTriggerEventDataOneCtid; +} AfterTriggerEventDataOneCtid; /* AfterTriggerEventData, minus ate_ctid1 and ate_ctid2 */ typedef struct AfterTriggerEventDataZeroCtids { TriggerFlags ate_flags; /* status bits and offset to shared data */ -} AfterTriggerEventDataZeroCtids; +} AfterTriggerEventDataZeroCtids; #define SizeofTriggerEvent(evt) \ (((evt)->ate_flags & AFTER_TRIGGER_TUP_BITS) == AFTER_TRIGGER_2CTID ? \ @@ -3329,7 +3328,7 @@ typedef struct AfterTriggerEventDataZeroCtids */ typedef struct AfterTriggerEventChunk { - struct AfterTriggerEventChunk *next; /* list link */ + struct AfterTriggerEventChunk *next; /* list link */ char *freeptr; /* start of free space in chunk */ char *endfree; /* end of free space in chunk */ char *endptr; /* end of chunk */ @@ -3421,7 +3420,7 @@ typedef struct AfterTriggersData { CommandId firing_counter; /* next firing ID to assign */ SetConstraintState state; /* the active S C state */ - AfterTriggerEventList events; /* deferred-event list */ + AfterTriggerEventList events; /* deferred-event list */ int query_depth; /* current query list index */ AfterTriggerEventList *query_stack; /* events pending from each query */ Tuplestorestate **fdw_tuplestores; /* foreign tuples for one row from @@ -3434,7 +3433,7 @@ typedef struct AfterTriggersData /* these fields are just for resetting at subtrans abort: */ SetConstraintState *state_stack; /* stacked S C states */ - AfterTriggerEventList *events_stack; /* stacked list pointers */ + AfterTriggerEventList *events_stack; /* stacked list pointers */ int *depth_stack; /* stacked query_depths */ CommandId *firing_stack; /* stacked firing_counters */ int maxtransdepth; /* allocated len of above arrays */ @@ -4070,7 +4069,7 @@ afterTriggerInvokeEvents(AfterTriggerEventList *events, slot1 = MakeSingleTupleTableSlot(rel->rd_att); slot2 = MakeSingleTupleTableSlot(rel->rd_att); } - if (trigdesc == NULL) /* should not happen */ + if (trigdesc == NULL) /* should not happen */ elog(ERROR, "relation %u has no triggers", evtshared->ats_relid); } @@ -4144,7 +4143,7 @@ AfterTriggerBeginXact(void) /* * Initialize after-trigger state structure to empty */ - afterTriggers.firing_counter = (CommandId) 1; /* mustn't be 0 */ + afterTriggers.firing_counter = (CommandId) 1; /* mustn't be 0 */ afterTriggers.query_depth = -1; /* @@ -4834,7 +4833,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cross-database references are not implemented: \"%s.%s.%s\"", - constraint->catalogname, constraint->schemaname, + constraint->catalogname, constraint->schemaname, constraint->relname))); } @@ -5194,8 +5193,8 @@ AfterTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo, /* If transition tables are the only reason we're here, return. */ if ((event == TRIGGER_EVENT_DELETE && !trigdesc->trig_delete_after_row) || - (event == TRIGGER_EVENT_INSERT && !trigdesc->trig_insert_after_row) || - (event == TRIGGER_EVENT_UPDATE && !trigdesc->trig_update_after_row)) + (event == TRIGGER_EVENT_INSERT && !trigdesc->trig_insert_after_row) || + (event == TRIGGER_EVENT_UPDATE && !trigdesc->trig_update_after_row)) return; } diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c index dfb95a1ed3..adc7cd67a7 100644 --- a/src/backend/commands/tsearchcmds.c +++ b/src/backend/commands/tsearchcmds.c @@ -237,8 +237,8 @@ DefineTSParser(List *names, List *parameters) else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("text search parser parameter \"%s\" not recognized", - defel->defname))); + errmsg("text search parser parameter \"%s\" not recognized", + defel->defname))); } /* @@ -381,8 +381,8 @@ verify_dictoptions(Oid tmplId, List *dictoptions) if (dictoptions) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("text search template \"%s\" does not accept options", - NameStr(tform->tmplname)))); + errmsg("text search template \"%s\" does not accept options", + NameStr(tform->tmplname)))); } else { @@ -743,7 +743,7 @@ DefineTSTemplate(List *names, List *parameters) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to create text search templates"))); + errmsg("must be superuser to create text search templates"))); /* Convert list of names to a name and namespace */ namespaceoid = QualifiedNameGetCreationNamespace(names, &tmplname); @@ -780,8 +780,8 @@ DefineTSTemplate(List *names, List *parameters) else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("text search template parameter \"%s\" not recognized", - defel->defname))); + errmsg("text search template parameter \"%s\" not recognized", + defel->defname))); } /* @@ -1484,8 +1484,8 @@ DropConfigurationMapping(AlterTSConfigurationStmt *stmt, { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("mapping for token type \"%s\" does not exist", - strVal(val)))); + errmsg("mapping for token type \"%s\" does not exist", + strVal(val)))); } else { @@ -1561,7 +1561,7 @@ serialize_deflist(List *deflist) List * deserialize_deflist(Datum txt) { - text *in = DatumGetTextPP(txt); /* in case it's toasted */ + text *in = DatumGetTextPP(txt); /* in case it's toasted */ List *result = NIL; int len = VARSIZE_ANY_EXHDR(in); char *ptr, @@ -1582,7 +1582,7 @@ deserialize_deflist(Datum txt) } ds_state; ds_state state = CS_WAITKEY; - workspace = (char *) palloc(len + 1); /* certainly enough room */ + workspace = (char *) palloc(len + 1); /* certainly enough room */ ptr = VARDATA_ANY(in); endptr = ptr + len; for (; ptr < endptr; ptr++) @@ -1685,7 +1685,7 @@ deserialize_deflist(Datum txt) *wsptr++ = '\0'; result = lappend(result, makeDefElem(pstrdup(workspace), - (Node *) makeString(pstrdup(startvalue)), -1)); + (Node *) makeString(pstrdup(startvalue)), -1)); state = CS_WAITKEY; } } @@ -1717,7 +1717,7 @@ deserialize_deflist(Datum txt) *wsptr++ = '\0'; result = lappend(result, makeDefElem(pstrdup(workspace), - (Node *) makeString(pstrdup(startvalue)), -1)); + (Node *) makeString(pstrdup(startvalue)), -1)); state = CS_WAITKEY; } } @@ -1732,7 +1732,7 @@ deserialize_deflist(Datum txt) *wsptr++ = '\0'; result = lappend(result, makeDefElem(pstrdup(workspace), - (Node *) makeString(pstrdup(startvalue)), -1)); + (Node *) makeString(pstrdup(startvalue)), -1)); state = CS_WAITKEY; } else @@ -1751,7 +1751,7 @@ deserialize_deflist(Datum txt) *wsptr++ = '\0'; result = lappend(result, makeDefElem(pstrdup(workspace), - (Node *) makeString(pstrdup(startvalue)), -1)); + (Node *) makeString(pstrdup(startvalue)), -1)); } else if (state != CS_WAITKEY) ereport(ERROR, diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index e7ecc4ed7e..c2fc59d1aa 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -343,8 +343,8 @@ DefineType(ParseState *pstate, List *names, List *parameters) if (category < 32 || category > 126) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid type category \"%s\": must be simple ASCII", - p))); + errmsg("invalid type category \"%s\": must be simple ASCII", + p))); } if (preferredEl) preferred = defGetBoolean(preferredEl); @@ -454,8 +454,8 @@ DefineType(ParseState *pstate, List *names, List *parameters) { /* backwards-compatibility hack */ ereport(WARNING, - (errmsg("changing return type of function %s from %s to %s", - NameListToString(inputName), "opaque", typeName))); + (errmsg("changing return type of function %s from %s to %s", + NameListToString(inputName), "opaque", typeName))); SetFunctionReturnType(inputOid, typoid); } else @@ -471,8 +471,8 @@ DefineType(ParseState *pstate, List *names, List *parameters) { /* backwards-compatibility hack */ ereport(WARNING, - (errmsg("changing return type of function %s from %s to %s", - NameListToString(outputName), "opaque", "cstring"))); + (errmsg("changing return type of function %s from %s to %s", + NameListToString(outputName), "opaque", "cstring"))); SetFunctionReturnType(outputOid, CSTRINGOID); } else @@ -581,13 +581,13 @@ DefineType(ParseState *pstate, List *names, List *parameters) if (typmodinOid && func_volatile(typmodinOid) == PROVOLATILE_VOLATILE) ereport(WARNING, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("type modifier input function %s should not be volatile", - NameListToString(typmodinName)))); + errmsg("type modifier input function %s should not be volatile", + NameListToString(typmodinName)))); if (typmodoutOid && func_volatile(typmodoutOid) == PROVOLATILE_VOLATILE) ereport(WARNING, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("type modifier output function %s should not be volatile", - NameListToString(typmodoutName)))); + errmsg("type modifier output function %s should not be volatile", + NameListToString(typmodoutName)))); /* * OK, we're done checking, time to make the type. We must assign the @@ -606,11 +606,11 @@ DefineType(ParseState *pstate, List *names, List *parameters) address = TypeCreate(InvalidOid, /* no predetermined type OID */ typeName, /* type name */ - typeNamespace, /* namespace */ + typeNamespace, /* namespace */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ GetUserId(), /* owner's ID */ - internalLength, /* internal size */ + internalLength, /* internal size */ TYPTYPE_BASE, /* type-type (base type) */ category, /* type-category */ preferred, /* is it a preferred type? */ @@ -653,7 +653,7 @@ DefineType(ParseState *pstate, List *names, List *parameters) GetUserId(), /* owner's ID */ -1, /* internal size (always varlena) */ TYPTYPE_BASE, /* type-type (base type) */ - TYPCATEGORY_ARRAY, /* type-category (array) */ + TYPCATEGORY_ARRAY, /* type-category (array) */ false, /* array types are never preferred */ delimiter, /* array element delimiter */ F_ARRAY_IN, /* input procedure */ @@ -662,7 +662,7 @@ DefineType(ParseState *pstate, List *names, List *parameters) F_ARRAY_SEND, /* send procedure */ typmodinOid, /* typmodin procedure */ typmodoutOid, /* typmodout procedure */ - F_ARRAY_TYPANALYZE, /* analyze procedure */ + F_ARRAY_TYPANALYZE, /* analyze procedure */ typoid, /* element type ID */ true, /* yes this is an array type */ InvalidOid, /* no further array type */ @@ -956,7 +956,7 @@ DefineDomain(CreateDomainStmt *stmt) if (nullDefined && !typNotNull) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("conflicting NULL/NOT NULL constraints"))); + errmsg("conflicting NULL/NOT NULL constraints"))); typNotNull = true; nullDefined = true; break; @@ -965,7 +965,7 @@ DefineDomain(CreateDomainStmt *stmt) if (nullDefined && typNotNull) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("conflicting NULL/NOT NULL constraints"))); + errmsg("conflicting NULL/NOT NULL constraints"))); typNotNull = false; nullDefined = true; break; @@ -990,25 +990,25 @@ DefineDomain(CreateDomainStmt *stmt) case CONSTR_UNIQUE: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("unique constraints not possible for domains"))); + errmsg("unique constraints not possible for domains"))); break; case CONSTR_PRIMARY: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("primary key constraints not possible for domains"))); + errmsg("primary key constraints not possible for domains"))); break; case CONSTR_EXCLUSION: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("exclusion constraints not possible for domains"))); + errmsg("exclusion constraints not possible for domains"))); break; case CONSTR_FOREIGN: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("foreign key constraints not possible for domains"))); + errmsg("foreign key constraints not possible for domains"))); break; case CONSTR_ATTR_DEFERRABLE: @@ -1033,19 +1033,19 @@ DefineDomain(CreateDomainStmt *stmt) address = TypeCreate(InvalidOid, /* no predetermined type OID */ domainName, /* type name */ - domainNamespace, /* namespace */ + domainNamespace, /* namespace */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ GetUserId(), /* owner's ID */ - internalLength, /* internal size */ - TYPTYPE_DOMAIN, /* type-type (domain type) */ + internalLength, /* internal size */ + TYPTYPE_DOMAIN, /* type-type (domain type) */ category, /* type-category */ false, /* domain types are never preferred */ delimiter, /* array element delimiter */ - inputProcedure, /* input procedure */ - outputProcedure, /* output procedure */ + inputProcedure, /* input procedure */ + outputProcedure, /* output procedure */ receiveProcedure, /* receive procedure */ - sendProcedure, /* send procedure */ + sendProcedure, /* send procedure */ InvalidOid, /* typmodin procedure - none */ InvalidOid, /* typmodout procedure - none */ analyzeProcedure, /* analyze procedure */ @@ -1054,7 +1054,7 @@ DefineDomain(CreateDomainStmt *stmt) InvalidOid, /* no arrays for domains (yet) */ basetypeoid, /* base type ID */ defaultValue, /* default type value (text) */ - defaultValueBin, /* default type value (binary) */ + defaultValueBin, /* default type value (binary) */ byValue, /* passed by value */ alignment, /* required alignment */ storage, /* TOAST strategy */ @@ -1145,7 +1145,7 @@ DefineEnum(CreateEnumStmt *stmt) enumTypeAddr = TypeCreate(InvalidOid, /* no predetermined type OID */ enumName, /* type name */ - enumNamespace, /* namespace */ + enumNamespace, /* namespace */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ GetUserId(), /* owner's ID */ @@ -1191,7 +1191,7 @@ DefineEnum(CreateEnumStmt *stmt) GetUserId(), /* owner's ID */ -1, /* internal size (always varlena) */ TYPTYPE_BASE, /* type-type (base type) */ - TYPCATEGORY_ARRAY, /* type-category (array) */ + TYPCATEGORY_ARRAY, /* type-category (array) */ false, /* array types are never preferred */ DEFAULT_TYPDELIM, /* array element delimiter */ F_ARRAY_IN, /* input procedure */ @@ -1200,7 +1200,7 @@ DefineEnum(CreateEnumStmt *stmt) F_ARRAY_SEND, /* send procedure */ InvalidOid, /* typmodin procedure - none */ InvalidOid, /* typmodout procedure - none */ - F_ARRAY_TYPANALYZE, /* analyze procedure */ + F_ARRAY_TYPANALYZE, /* analyze procedure */ enumTypeAddr.objectId, /* element type ID */ true, /* yes this is an array type */ InvalidOid, /* no further array type */ @@ -1473,12 +1473,12 @@ DefineRange(CreateRangeStmt *stmt) address = TypeCreate(InvalidOid, /* no predetermined type OID */ typeName, /* type name */ - typeNamespace, /* namespace */ + typeNamespace, /* namespace */ InvalidOid, /* relation oid (n/a here) */ 0, /* relation kind (ditto) */ GetUserId(), /* owner's ID */ -1, /* internal size (always varlena) */ - TYPTYPE_RANGE, /* type-type (range type) */ + TYPTYPE_RANGE, /* type-type (range type) */ TYPCATEGORY_RANGE, /* type-category (range type) */ false, /* range types are never preferred */ DEFAULT_TYPDELIM, /* array element delimiter */ @@ -1491,7 +1491,7 @@ DefineRange(CreateRangeStmt *stmt) F_RANGE_TYPANALYZE, /* analyze procedure */ InvalidOid, /* element type ID - none */ false, /* this is not an array type */ - rangeArrayOid, /* array type we are about to create */ + rangeArrayOid, /* array type we are about to create */ InvalidOid, /* base type ID (only for domains) */ NULL, /* never a default type value */ NULL, /* no binary form available either */ @@ -1521,7 +1521,7 @@ DefineRange(CreateRangeStmt *stmt) GetUserId(), /* owner's ID */ -1, /* internal size (always varlena) */ TYPTYPE_BASE, /* type-type (base type) */ - TYPCATEGORY_ARRAY, /* type-category (array) */ + TYPCATEGORY_ARRAY, /* type-category (array) */ false, /* array types are never preferred */ DEFAULT_TYPDELIM, /* array element delimiter */ F_ARRAY_IN, /* input procedure */ @@ -1530,7 +1530,7 @@ DefineRange(CreateRangeStmt *stmt) F_ARRAY_SEND, /* send procedure */ InvalidOid, /* typmodin procedure - none */ InvalidOid, /* typmodout procedure - none */ - F_ARRAY_TYPANALYZE, /* analyze procedure */ + F_ARRAY_TYPANALYZE, /* analyze procedure */ typoid, /* element type ID */ true, /* yes this is an array type */ InvalidOid, /* no further array type */ @@ -1591,14 +1591,14 @@ makeRangeConstructors(const char *name, Oid namespace, pronargs[i]); myself = ProcedureCreate(name, /* name: same as range type */ - namespace, /* namespace */ + namespace, /* namespace */ false, /* replace */ false, /* returns set */ - rangeOid, /* return type */ + rangeOid, /* return type */ BOOTSTRAP_SUPERUSERID, /* proowner */ INTERNALlanguageId, /* language */ - F_FMGR_INTERNAL_VALIDATOR, /* language validator */ - prosrc[i], /* prosrc */ + F_FMGR_INTERNAL_VALIDATOR, /* language validator */ + prosrc[i], /* prosrc */ NULL, /* probin */ false, /* isAgg */ false, /* isWindowFunc */ @@ -1606,8 +1606,8 @@ makeRangeConstructors(const char *name, Oid namespace, false, /* leakproof */ false, /* isStrict */ PROVOLATILE_IMMUTABLE, /* volatility */ - PROPARALLEL_SAFE, /* parallel safety */ - constructorArgTypesVector, /* parameterTypes */ + PROPARALLEL_SAFE, /* parallel safety */ + constructorArgTypesVector, /* parameterTypes */ PointerGetDatum(NULL), /* allParameterTypes */ PointerGetDatum(NULL), /* parameterModes */ PointerGetDatum(NULL), /* parameterNames */ @@ -1728,8 +1728,8 @@ findTypeOutputFunction(List *procname, Oid typeOid) { /* Found, but must complain and fix the pg_proc entry */ ereport(WARNING, - (errmsg("changing argument type of function %s from \"opaque\" to %s", - NameListToString(procname), format_type_be(typeOid)))); + (errmsg("changing argument type of function %s from \"opaque\" to %s", + NameListToString(procname), format_type_be(typeOid)))); SetFunctionArgType(procOid, 0, typeOid); /* @@ -1913,9 +1913,9 @@ findRangeSubOpclass(List *opcname, Oid subtype) if (!IsBinaryCoercible(subtype, opInputType)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("operator class \"%s\" does not accept data type %s", - NameListToString(opcname), - format_type_be(subtype)))); + errmsg("operator class \"%s\" does not accept data type %s", + NameListToString(opcname), + format_type_be(subtype)))); } else { @@ -2131,7 +2131,7 @@ AlterDomainDefault(List *names, Node *defaultRaw) ParseState *pstate; Relation rel; char *defaultValue; - Node *defaultExpr = NULL; /* NULL if no default specified */ + Node *defaultExpr = NULL; /* NULL if no default specified */ Datum new_record[Natts_pg_type]; bool new_record_nulls[Natts_pg_type]; bool new_record_repl[Natts_pg_type]; @@ -2226,7 +2226,7 @@ AlterDomainDefault(List *names, Node *defaultRaw) /* Rebuild dependencies */ GenerateTypeDependencies(typTup->typnamespace, domainoid, - InvalidOid, /* typrelid is n/a */ + InvalidOid, /* typrelid is n/a */ 0, /* relation kind is n/a */ typTup->typowner, typTup->typinput, @@ -2237,11 +2237,11 @@ AlterDomainDefault(List *names, Node *defaultRaw) typTup->typmodout, typTup->typanalyze, InvalidOid, - false, /* a domain isn't an implicit array */ + false, /* a domain isn't an implicit array */ typTup->typbasetype, typTup->typcollation, defaultExpr, - true); /* Rebuild is true */ + true); /* Rebuild is true */ InvokeObjectPostAlterHook(TypeRelationId, domainoid, 0); @@ -2338,7 +2338,7 @@ AlterDomainNotNull(List *names, bool notNull) ereport(ERROR, (errcode(ERRCODE_NOT_NULL_VIOLATION), errmsg("column \"%s\" of table \"%s\" contains null values", - NameStr(tupdesc->attrs[attnum - 1]->attname), + NameStr(tupdesc->attrs[attnum - 1]->attname), RelationGetRelationName(testrel)), errtablecol(testrel, attnum))); } @@ -2450,8 +2450,8 @@ AlterDomainDropConstraint(List *names, const char *constrName, if (!missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("constraint \"%s\" of domain \"%s\" does not exist", - constrName, TypeNameToString(typename)))); + errmsg("constraint \"%s\" of domain \"%s\" does not exist", + constrName, TypeNameToString(typename)))); else ereport(NOTICE, (errmsg("constraint \"%s\" of domain \"%s\" does not exist, skipping", @@ -2515,19 +2515,19 @@ AlterDomainAddConstraint(List *names, Node *newConstraint, case CONSTR_PRIMARY: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("primary key constraints not possible for domains"))); + errmsg("primary key constraints not possible for domains"))); break; case CONSTR_EXCLUSION: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("exclusion constraints not possible for domains"))); + errmsg("exclusion constraints not possible for domains"))); break; case CONSTR_FOREIGN: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("foreign key constraints not possible for domains"))); + errmsg("foreign key constraints not possible for domains"))); break; case CONSTR_ATTR_DEFERRABLE: @@ -2639,8 +2639,8 @@ AlterDomainValidateConstraint(List *names, char *constrName) if (con->contype != CONSTRAINT_CHECK) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("constraint \"%s\" of domain \"%s\" is not a check constraint", - constrName, TypeNameToString(typename)))); + errmsg("constraint \"%s\" of domain \"%s\" is not a check constraint", + constrName, TypeNameToString(typename)))); val = SysCacheGetAttr(CONSTROID, tuple, Anum_pg_constraint_conbin, @@ -2745,7 +2745,7 @@ validateDomainConstraint(Oid domainoid, char *ccbin) ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), errmsg("column \"%s\" of table \"%s\" contains values that violate the new constraint", - NameStr(tupdesc->attrs[attnum - 1]->attname), + NameStr(tupdesc->attrs[attnum - 1]->attname), RelationGetRelationName(testrel)), errtablecol(testrel, attnum))); } @@ -2991,8 +2991,8 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, constr->conname)) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("constraint \"%s\" for domain \"%s\" already exists", - constr->conname, domainName))); + errmsg("constraint \"%s\" for domain \"%s\" already exists", + constr->conname, domainName))); } else constr->conname = ChooseConstraintName(domainName, @@ -3042,7 +3042,7 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, contain_var_clause(expr)) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("cannot use table references in domain check constraint"))); + errmsg("cannot use table references in domain check constraint"))); /* * Convert to string form for storage. @@ -3065,12 +3065,12 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, false, /* Is Deferrable */ false, /* Is Deferred */ !constr->skip_validation, /* Is Validated */ - InvalidOid, /* not a relation constraint */ + InvalidOid, /* not a relation constraint */ NULL, 0, - domainOid, /* domain constraint */ - InvalidOid, /* no associated index */ - InvalidOid, /* Foreign key fields */ + domainOid, /* domain constraint */ + InvalidOid, /* no associated index */ + InvalidOid, /* Foreign key fields */ NULL, NULL, NULL, @@ -3079,11 +3079,11 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, ' ', ' ', ' ', - NULL, /* not an exclusion constraint */ - expr, /* Tree form of check constraint */ + NULL, /* not an exclusion constraint */ + expr, /* Tree form of check constraint */ ccbin, /* Binary form of check constraint */ ccsrc, /* Source form of check constraint */ - true, /* is local */ + true, /* is local */ 0, /* inhcount */ false, /* connoinherit */ false); /* is_internal */ diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index 10d6ba9e04..0a72c2ecb3 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -82,18 +82,17 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt) char *password = NULL; /* user password */ bool issuper = false; /* Make the user a superuser? */ bool inherit = true; /* Auto inherit privileges? */ - bool createrole = false; /* Can this user create roles? */ - bool createdb = false; /* Can the user create databases? */ - bool canlogin = false; /* Can this user login? */ + bool createrole = false; /* Can this user create roles? */ + bool createdb = false; /* Can the user create databases? */ + bool canlogin = false; /* Can this user login? */ bool isreplication = false; /* Is this a replication role? */ - bool bypassrls = false; /* Is this a row security enabled - * role? */ + bool bypassrls = false; /* Is this a row security enabled role? */ int connlimit = -1; /* maximum connections allowed */ List *addroleto = NIL; /* roles to make this a member of */ - List *rolemembers = NIL; /* roles to be members of this role */ - List *adminmembers = NIL; /* roles to be admins of this role */ - char *validUntil = NULL; /* time the login is valid until */ - Datum validUntil_datum; /* same, as timestamptz Datum */ + List *rolemembers = NIL; /* roles to be members of this role */ + List *adminmembers = NIL; /* roles to be admins of this role */ + char *validUntil = NULL; /* time the login is valid until */ + Datum validUntil_datum; /* same, as timestamptz Datum */ bool validUntil_null; DefElem *dpassword = NULL; DefElem *dissuper = NULL; @@ -300,14 +299,14 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to create replication users"))); + errmsg("must be superuser to create replication users"))); } else if (bypassrls) { if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to change bypassrls attribute"))); + errmsg("must be superuser to change bypassrls attribute"))); } else { @@ -326,7 +325,7 @@ CreateRole(ParseState *pstate, CreateRoleStmt *stmt) (errcode(ERRCODE_RESERVED_NAME), errmsg("role name \"%s\" is reserved", stmt->role), - errdetail("Role names starting with \"pg_\" are reserved."))); + errdetail("Role names starting with \"pg_\" are reserved."))); /* * Check the pg_authid relation to be certain the role doesn't already @@ -497,11 +496,11 @@ AlterRole(AlterRoleStmt *stmt) int createrole = -1; /* Can this user create roles? */ int createdb = -1; /* Can the user create databases? */ int canlogin = -1; /* Can this user login? */ - int isreplication = -1; /* Is this a replication role? */ + int isreplication = -1; /* Is this a replication role? */ int connlimit = -1; /* maximum connections allowed */ - List *rolemembers = NIL; /* roles to be added/removed */ - char *validUntil = NULL; /* time the login is valid until */ - Datum validUntil_datum; /* same, as timestamptz Datum */ + List *rolemembers = NIL; /* roles to be added/removed */ + char *validUntil = NULL; /* time the login is valid until */ + Datum validUntil_datum; /* same, as timestamptz Datum */ bool validUntil_null; int bypassrls = -1; DefElem *dpassword = NULL; @@ -682,7 +681,7 @@ AlterRole(AlterRoleStmt *stmt) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to change bypassrls attribute"))); + errmsg("must be superuser to change bypassrls attribute"))); } else if (!have_createrole_privilege()) { @@ -962,7 +961,7 @@ DropRole(DropRoleStmt *stmt) if (rolspec->roletype != ROLESPEC_CSTRING) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("cannot use special role specifier in DROP ROLE"))); + errmsg("cannot use special role specifier in DROP ROLE"))); role = rolspec->rolename; tuple = SearchSysCache1(AUTHNAME, PointerGetDatum(role)); @@ -1160,14 +1159,14 @@ RenameRole(const char *oldname, const char *newname) (errcode(ERRCODE_RESERVED_NAME), errmsg("role name \"%s\" is reserved", NameStr(authform->rolname)), - errdetail("Role names starting with \"pg_\" are reserved."))); + errdetail("Role names starting with \"pg_\" are reserved."))); if (IsReservedName(newname)) ereport(ERROR, (errcode(ERRCODE_RESERVED_NAME), errmsg("role name \"%s\" is reserved", newname), - errdetail("Role names starting with \"pg_\" are reserved."))); + errdetail("Role names starting with \"pg_\" are reserved."))); /* make sure the new name doesn't exist */ if (SearchSysCacheExists1(AUTHNAME, CStringGetDatum(newname))) @@ -1199,7 +1198,7 @@ RenameRole(const char *oldname, const char *newname) repl_repl[Anum_pg_authid_rolname - 1] = true; repl_val[Anum_pg_authid_rolname - 1] = DirectFunctionCall1(namein, - CStringGetDatum(newname)); + CStringGetDatum(newname)); repl_null[Anum_pg_authid_rolname - 1] = false; datum = heap_getattr(oldtuple, Anum_pg_authid_rolpassword, dsc, &isnull); @@ -1271,7 +1270,7 @@ GrantRole(GrantRoleStmt *stmt) if (rolename == NULL || priv->cols != NIL) ereport(ERROR, (errcode(ERRCODE_INVALID_GRANT_OPERATION), - errmsg("column names cannot be included in GRANT/REVOKE ROLE"))); + errmsg("column names cannot be included in GRANT/REVOKE ROLE"))); roleid = get_role_oid(rolename, false); if (stmt->is_grant) diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 24edf48b68..979969bd32 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -1342,8 +1342,8 @@ vacuum_rel(Oid relid, RangeVar *relation, int options, VacuumParams *params) if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0) ereport(LOG, (errcode(ERRCODE_LOCK_NOT_AVAILABLE), - errmsg("skipping vacuum of \"%s\" --- lock not available", - relation->relname))); + errmsg("skipping vacuum of \"%s\" --- lock not available", + relation->relname))); } if (!onerel) @@ -1368,8 +1368,8 @@ vacuum_rel(Oid relid, RangeVar *relation, int options, VacuumParams *params) { if (onerel->rd_rel->relisshared) ereport(WARNING, - (errmsg("skipping \"%s\" --- only superuser can vacuum it", - RelationGetRelationName(onerel)))); + (errmsg("skipping \"%s\" --- only superuser can vacuum it", + RelationGetRelationName(onerel)))); else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE) ereport(WARNING, (errmsg("skipping \"%s\" --- only superuser or database owner can vacuum it", diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index fc9c4f0fb1..881c7356db 100644 --- a/src/backend/commands/vacuumlazy.c +++ b/src/backend/commands/vacuumlazy.c @@ -4,11 +4,10 @@ * Concurrent ("lazy") vacuuming. * * - * The major space usage for LAZY VACUUM is storage for the array of dead - * tuple TIDs, with the next biggest need being storage for per-disk-page - * free space info. We want to ensure we can vacuum even the very largest - * relations with finite memory space usage. To do that, we set upper bounds - * on the number of tuples and pages we will keep track of at once. + * The major space usage for LAZY VACUUM is storage for the array of dead tuple + * TIDs. We want to ensure we can vacuum even the very largest relations with + * finite memory space usage. To do that, we set upper bounds on the number of + * tuples we will keep track of at once. * * We are willing to use at most maintenance_work_mem (or perhaps * autovacuum_work_mem) memory space to keep track of dead tuples. We @@ -81,8 +80,8 @@ * that the potential for improvement was great enough to merit the cost of * supporting them. */ -#define VACUUM_TRUNCATE_LOCK_CHECK_INTERVAL 20 /* ms */ -#define VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL 50 /* ms */ +#define VACUUM_TRUNCATE_LOCK_CHECK_INTERVAL 20 /* ms */ +#define VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL 50 /* ms */ #define VACUUM_TRUNCATE_LOCK_TIMEOUT 5000 /* ms */ /* @@ -112,7 +111,7 @@ typedef struct LVRelStats BlockNumber old_rel_pages; /* previous value of pg_class.relpages */ BlockNumber rel_pages; /* total number of pages */ BlockNumber scanned_pages; /* number of pages we examined */ - BlockNumber pinskipped_pages; /* # of pages we skipped due to a pin */ + BlockNumber pinskipped_pages; /* # of pages we skipped due to a pin */ BlockNumber frozenskipped_pages; /* # of frozen pages we skipped */ BlockNumber tupcount_pages; /* pages whose tuples we counted */ double scanned_tuples; /* counts only tuples on tupcount_pages */ @@ -167,7 +166,7 @@ static void lazy_record_dead_tuple(LVRelStats *vacrelstats, static bool lazy_tid_reaped(ItemPointer itemptr, void *state); static int vac_cmp_itemptr(const void *left, const void *right); static bool heap_page_is_all_visible(Relation rel, Buffer buf, - TransactionId *visibility_cutoff_xid, bool *all_frozen); + TransactionId *visibility_cutoff_xid, bool *all_frozen); /* @@ -363,10 +362,10 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params, write_rate = 0; if ((secs > 0) || (usecs > 0)) { - read_rate = (double) BLCKSZ *VacuumPageMiss / (1024 * 1024) / - (secs + usecs / 1000000.0); - write_rate = (double) BLCKSZ *VacuumPageDirty / (1024 * 1024) / - (secs + usecs / 1000000.0); + read_rate = (double) BLCKSZ * VacuumPageMiss / (1024 * 1024) / + (secs + usecs / 1000000.0); + write_rate = (double) BLCKSZ * VacuumPageDirty / (1024 * 1024) / + (secs + usecs / 1000000.0); } /* @@ -391,7 +390,7 @@ lazy_vacuum_rel(Relation onerel, int options, VacuumParams *params, vacrelstats->new_dead_tuples, OldestXmin); appendStringInfo(&buf, - _("buffer usage: %d hits, %d misses, %d dirtied\n"), + _("buffer usage: %d hits, %d misses, %d dirtied\n"), VacuumPageHit, VacuumPageMiss, VacuumPageDirty); @@ -621,7 +620,7 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats, uint8 vmskipflags; vmskipflags = visibilitymap_get_status(onerel, - next_unskippable_block, + next_unskippable_block, &vmbuffer); if (aggressive) { @@ -857,8 +856,8 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats, if (PageIsNew(page)) { ereport(WARNING, - (errmsg("relation \"%s\" page %u is uninitialized --- fixing", - relname, blkno))); + (errmsg("relation \"%s\" page %u is uninitialized --- fixing", + relname, blkno))); PageInit(page, BufferGetPageSize(buf), 0); empty_pages++; } @@ -900,7 +899,7 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats, PageSetAllVisible(page); visibilitymap_set(onerel, blkno, buf, InvalidXLogRecPtr, vmbuffer, InvalidTransactionId, - VISIBILITYMAP_ALL_VISIBLE | VISIBILITYMAP_ALL_FROZEN); + VISIBILITYMAP_ALL_VISIBLE | VISIBILITYMAP_ALL_FROZEN); END_CRIT_SECTION(); } @@ -1071,7 +1070,7 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats, { lazy_record_dead_tuple(vacrelstats, &(tuple.t_self)); HeapTupleHeaderAdvanceLatestRemovedXid(tuple.t_data, - &vacrelstats->latestRemovedXid); + &vacrelstats->latestRemovedXid); tups_vacuumed += 1; has_dead_tuples = true; } @@ -1087,7 +1086,7 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats, * freezing. Note we already have exclusive buffer lock. */ if (heap_prepare_freeze_tuple(tuple.t_data, FreezeLimit, - MultiXactCutoff, &frozen[nfrozen], + MultiXactCutoff, &frozen[nfrozen], &tuple_totally_frozen)) frozen[nfrozen++].offset = offnum; @@ -1268,7 +1267,7 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats, /* now we can compute the new value for pg_class.reltuples */ vacrelstats->new_rel_tuples = vac_estimate_reltuples(onerel, false, nblocks, - vacrelstats->tupcount_pages, + vacrelstats->tupcount_pages, num_tuples); /* @@ -1337,7 +1336,7 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats, */ initStringInfo(&buf); appendStringInfo(&buf, - _("%.0f dead row versions cannot be removed yet, oldest xmin: %u\n"), + _("%.0f dead row versions cannot be removed yet, oldest xmin: %u\n"), nkeep, OldestXmin); appendStringInfo(&buf, _("There were %.0f unused item pointers.\n"), nunused); @@ -1664,7 +1663,7 @@ lazy_cleanup_index(Relation indrel, stats->num_index_tuples, stats->num_pages), errdetail("%.0f index row versions were removed.\n" - "%u index pages have been deleted, %u are currently reusable.\n" + "%u index pages have been deleted, %u are currently reusable.\n" "%s.", stats->tuples_removed, stats->pages_deleted, stats->pages_free, @@ -1700,7 +1699,7 @@ should_attempt_truncation(LVRelStats *vacrelstats) possibly_freeable = vacrelstats->rel_pages - vacrelstats->nonempty_pages; if (possibly_freeable > 0 && (possibly_freeable >= REL_TRUNCATE_MINIMUM || - possibly_freeable >= vacrelstats->rel_pages / REL_TRUNCATE_FRACTION) && + possibly_freeable >= vacrelstats->rel_pages / REL_TRUNCATE_FRACTION) && old_snapshot_threshold < 0) return true; else diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c index 717bc39c01..fe1988b4a1 100644 --- a/src/backend/commands/variable.c +++ b/src/backend/commands/variable.c @@ -294,7 +294,7 @@ check_timezone(char **newval, void **extra, GucSource source) */ interval = DatumGetIntervalP(DirectFunctionCall3(interval_in, CStringGetDatum(val), - ObjectIdGetDatum(InvalidOid), + ObjectIdGetDatum(InvalidOid), Int32GetDatum(-1))); pfree(val); @@ -791,7 +791,7 @@ assign_client_encoding(const char *newval, void *extra) */ ereport(ERROR, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), - errmsg("cannot change client_encoding during a parallel operation"))); + errmsg("cannot change client_encoding during a parallel operation"))); } /* We do not expect an error if PrepareClientEncoding succeeded */ diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index 2ca5b5cfd2..8545f09261 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -91,7 +91,7 @@ DefineVirtualRelation(RangeVar *relation, List *tlist, bool replace, ColumnDef *def = makeColumnDef(tle->resname, exprType((Node *) tle->expr), exprTypmod((Node *) tle->expr), - exprCollation((Node *) tle->expr)); + exprCollation((Node *) tle->expr)); /* * It's possible that the column is of a collatable type but the @@ -299,9 +299,9 @@ checkViewTupleDesc(TupleDesc newdesc, TupleDesc olddesc) if (strcmp(NameStr(newattr->attname), NameStr(oldattr->attname)) != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("cannot change name of view column \"%s\" to \"%s\"", - NameStr(oldattr->attname), - NameStr(newattr->attname)))); + errmsg("cannot change name of view column \"%s\" to \"%s\"", + NameStr(oldattr->attname), + NameStr(newattr->attname)))); /* XXX would it be safe to allow atttypmod to change? Not sure */ if (newattr->atttypid != oldattr->atttypid || newattr->atttypmod != oldattr->atttypmod) @@ -464,7 +464,7 @@ DefineView(ViewStmt *stmt, const char *queryString, if (viewParse->hasModifyingCTE) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("views must not contain data-modifying statements in WITH"))); + errmsg("views must not contain data-modifying statements in WITH"))); /* * If the user specified the WITH CHECK OPTION, add it to the list of @@ -473,11 +473,11 @@ DefineView(ViewStmt *stmt, const char *queryString, if (stmt->withCheckOption == LOCAL_CHECK_OPTION) stmt->options = lappend(stmt->options, makeDefElem("check_option", - (Node *) makeString("local"), -1)); + (Node *) makeString("local"), -1)); else if (stmt->withCheckOption == CASCADED_CHECK_OPTION) stmt->options = lappend(stmt->options, makeDefElem("check_option", - (Node *) makeString("cascaded"), -1)); + (Node *) makeString("cascaded"), -1)); /* * Check that the view is auto-updatable if WITH CHECK OPTION was @@ -542,7 +542,7 @@ DefineView(ViewStmt *stmt, const char *queryString, if (stmt->view->relpersistence == RELPERSISTENCE_UNLOGGED) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("views cannot be unlogged because they do not have storage"))); + errmsg("views cannot be unlogged because they do not have storage"))); /* * If the user didn't explicitly ask for a temporary view, check whether @@ -550,7 +550,7 @@ DefineView(ViewStmt *stmt, const char *queryString, * long as the CREATE command is consistent with that --- no explicit * schema name. */ - view = copyObject(stmt->view); /* don't corrupt original command */ + view = copyObject(stmt->view); /* don't corrupt original command */ if (view->relpersistence == RELPERSISTENCE_PERMANENT && isQueryUsingTempRelation(viewParse)) { diff --git a/src/backend/executor/execCurrent.c b/src/backend/executor/execCurrent.c index 0224b9e4af..689de82ee3 100644 --- a/src/backend/executor/execCurrent.c +++ b/src/backend/executor/execCurrent.c @@ -157,7 +157,7 @@ execCurrentOf(CurrentOfExpr *cexpr, { ScanState *scanstate; bool lisnull; - Oid tuple_tableoid PG_USED_FOR_ASSERTS_ONLY; + Oid tuple_tableoid PG_USED_FOR_ASSERTS_ONLY; ItemPointer tuple_tid; /* diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c index fe12326336..a298b92af8 100644 --- a/src/backend/executor/execExpr.c +++ b/src/backend/executor/execExpr.c @@ -344,7 +344,7 @@ ExecBuildProjectionInfo(List *targetList, attnum = variable->varattno; if (inputDesc == NULL) - isSafeVar = true; /* can't check, just assume OK */ + isSafeVar = true; /* can't check, just assume OK */ else if (attnum <= inputDesc->natts) { Form_pg_attribute attr = inputDesc->attrs[attnum - 1]; @@ -777,7 +777,7 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state, if (nfuncs != winstate->numfuncs) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("window function calls cannot be nested"))); + errmsg("window function calls cannot be nested"))); } else { @@ -1362,7 +1362,7 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state, /* If WHEN result isn't true, jump to next CASE arm */ scratch.opcode = EEOP_JUMP_IF_NOT_TRUE; - scratch.d.jump.jumpdone = -1; /* computed later */ + scratch.d.jump.jumpdone = -1; /* computed later */ ExprEvalPushStep(state, &scratch); whenstep = state->steps_len - 1; @@ -1374,7 +1374,7 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state, /* Emit JUMP step to jump to end of CASE's code */ scratch.opcode = EEOP_JUMP; - scratch.d.jump.jumpdone = -1; /* computed later */ + scratch.d.jump.jumpdone = -1; /* computed later */ ExprEvalPushStep(state, &scratch); /* @@ -1545,8 +1545,8 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state, ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("ROW() column has type %s instead of type %s", - format_type_be(exprType((Node *) e)), - format_type_be(attrs[i]->atttypid)))); + format_type_be(exprType((Node *) e)), + format_type_be(attrs[i]->atttypid)))); } else { @@ -1720,7 +1720,7 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state, /* if it's not null, skip to end of COALESCE expr */ scratch.opcode = EEOP_JUMP_IF_NOT_NULL; - scratch.d.jump.jumpdone = -1; /* adjust later */ + scratch.d.jump.jumpdone = -1; /* adjust later */ ExprEvalPushStep(state, &scratch); adjust_jumps = lappend_int(adjust_jumps, @@ -2076,10 +2076,10 @@ ExecInitFunc(ExprEvalStep *scratch, Expr *node, List *args, Oid funcid, if (nargs > FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg_plural("cannot pass more than %d argument to a function", - "cannot pass more than %d arguments to a function", - FUNC_MAX_ARGS, - FUNC_MAX_ARGS))); + errmsg_plural("cannot pass more than %d argument to a function", + "cannot pass more than %d arguments to a function", + FUNC_MAX_ARGS, + FUNC_MAX_ARGS))); /* Allocate function lookup data and parameter workspace for this call */ scratch->d.func.finfo = palloc0(sizeof(FmgrInfo)); @@ -2105,7 +2105,7 @@ ExecInitFunc(ExprEvalStep *scratch, Expr *node, List *args, Oid funcid, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("set-valued function called in context that cannot accept a set"), parent ? executor_errposition(parent->state, - exprLocation((Node *) node)) : 0)); + exprLocation((Node *) node)) : 0)); /* Build code to evaluate arguments directly into the fcinfo struct */ argno = 0; @@ -2380,7 +2380,7 @@ ExecInitArrayRef(ExprEvalStep *scratch, ArrayRef *aref, PlanState *parent, /* Each subscript is evaluated into subscriptvalue/subscriptnull */ ExecInitExprRec(e, parent, state, - &arefstate->subscriptvalue, &arefstate->subscriptnull); + &arefstate->subscriptvalue, &arefstate->subscriptnull); /* ... and then ARRAYREF_SUBSCRIPT saves it into step's workspace */ scratch->opcode = EEOP_ARRAYREF_SUBSCRIPT; @@ -2413,7 +2413,7 @@ ExecInitArrayRef(ExprEvalStep *scratch, ArrayRef *aref, PlanState *parent, /* Each subscript is evaluated into subscriptvalue/subscriptnull */ ExecInitExprRec(e, parent, state, - &arefstate->subscriptvalue, &arefstate->subscriptnull); + &arefstate->subscriptvalue, &arefstate->subscriptnull); /* ... and then ARRAYREF_SUBSCRIPT saves it into step's workspace */ scratch->opcode = EEOP_ARRAYREF_SUBSCRIPT; diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c index fed0052fc6..c227d9bdd9 100644 --- a/src/backend/executor/execExprInterp.c +++ b/src/backend/executor/execExprInterp.c @@ -83,7 +83,7 @@ */ #ifdef HAVE_COMPUTED_GOTO #define EEO_USE_COMPUTED_GOTO -#endif /* HAVE_COMPUTED_GOTO */ +#endif /* HAVE_COMPUTED_GOTO */ /* * Macros for opcode dispatch. @@ -112,7 +112,7 @@ static const void **dispatch_table = NULL; #define EEO_DISPATCH() goto starteval #define EEO_OPCODE(opcode) (opcode) -#endif /* EEO_USE_COMPUTED_GOTO */ +#endif /* EEO_USE_COMPUTED_GOTO */ #define EEO_NEXT() \ do { \ @@ -256,7 +256,7 @@ ExecReadyInterpretedExpr(ExprState *state) state->flags |= EEO_FLAG_DIRECT_THREADED; } -#endif /* EEO_USE_COMPUTED_GOTO */ +#endif /* EEO_USE_COMPUTED_GOTO */ state->evalfunc = ExecInterpExpr; } @@ -373,7 +373,7 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull) return PointerGetDatum(dispatch_table); #else Assert(state != NULL); -#endif /* EEO_USE_COMPUTED_GOTO */ +#endif /* EEO_USE_COMPUTED_GOTO */ /* setup state */ op = state->steps; @@ -1559,7 +1559,7 @@ CheckVarSlotCompatibility(TupleTableSlot *slot, int attnum, Oid vartype) TupleDesc slot_tupdesc = slot->tts_tupleDescriptor; Form_pg_attribute attr; - if (attnum > slot_tupdesc->natts) /* should never happen */ + if (attnum > slot_tupdesc->natts) /* should never happen */ elog(ERROR, "attribute number %d exceeds number of columns %d", attnum, slot_tupdesc->natts); @@ -1986,7 +1986,7 @@ ExecEvalCurrentOfExpr(ExprState *state, ExprEvalStep *op) { ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("WHERE CURRENT OF is not supported for this table type"))); + errmsg("WHERE CURRENT OF is not supported for this table type"))); } /* @@ -2187,7 +2187,7 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("cannot merge incompatible arrays"), errdetail("Array with element type %s cannot be " - "included in ARRAY construct with element type %s.", + "included in ARRAY construct with element type %s.", format_type_be(ARR_ELEMTYPE(array)), format_type_be(element_type)))); @@ -2207,8 +2207,8 @@ ExecEvalArrayExpr(ExprState *state, ExprEvalStep *op) if (ndims <= 0 || ndims > MAXDIM) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("number of array dimensions (%d) exceeds " \ - "the maximum allowed (%d)", ndims, MAXDIM))); + errmsg("number of array dimensions (%d) exceeds " \ + "the maximum allowed (%d)", ndims, MAXDIM))); elem_dims = (int *) palloc(elem_ndims * sizeof(int)); memcpy(elem_dims, ARR_DIMS(array), elem_ndims * sizeof(int)); @@ -2475,7 +2475,7 @@ ExecEvalFieldSelect(ExprState *state, ExprEvalStep *op, ExprContext *econtext) if (fieldnum <= 0) /* should never happen */ elog(ERROR, "unsupported reference to system column %d in FieldSelect", fieldnum); - if (fieldnum > tupDesc->natts) /* should never happen */ + if (fieldnum > tupDesc->natts) /* should never happen */ elog(ERROR, "attribute number %d exceeds number of columns %d", fieldnum, tupDesc->natts); attr = tupDesc->attrs[fieldnum - 1]; @@ -2601,7 +2601,7 @@ ExecEvalArrayRefSubscript(ExprState *state, ExprEvalStep *op) if (arefstate->isassignment) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("array subscript in assignment must not be null"))); + errmsg("array subscript in assignment must not be null"))); *op->resnull = true; return false; } @@ -2834,7 +2834,7 @@ ExecEvalConvertRowtype(ExprState *state, ExprEvalStep *op, ExprContext *econtext /* prepare map from old to new attribute numbers */ op->d.convert_rowtype.map = convert_tuples_by_name(indesc, outdesc, - gettext_noop("could not convert row type")); + gettext_noop("could not convert row type")); op->d.convert_rowtype.initialized = true; MemoryContextSwitchTo(old_cxt); @@ -3049,9 +3049,9 @@ ExecEvalConstraintCheck(ExprState *state, ExprEvalStep *op) !DatumGetBool(*op->d.domaincheck.checkvalue)) ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), - errmsg("value for domain %s violates check constraint \"%s\"", - format_type_be(op->d.domaincheck.resulttype), - op->d.domaincheck.constraintname), + errmsg("value for domain %s violates check constraint \"%s\"", + format_type_be(op->d.domaincheck.resulttype), + op->d.domaincheck.constraintname), errdomainconstraint(op->d.domaincheck.resulttype, op->d.domaincheck.constraintname))); } @@ -3116,7 +3116,7 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) appendStringInfo(&buf, "<%s>%s</%s>", argname, map_sql_value_to_xml_value(value, - exprType((Node *) e), true), + exprType((Node *) e), true), argname); *op->resnull = false; } @@ -3137,10 +3137,10 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) case IS_XMLELEMENT: *op->resvalue = PointerGetDatum(xmlelement(xexpr, - op->d.xmlexpr.named_argvalue, - op->d.xmlexpr.named_argnull, + op->d.xmlexpr.named_argvalue, + op->d.xmlexpr.named_argnull, op->d.xmlexpr.argvalue, - op->d.xmlexpr.argnull)); + op->d.xmlexpr.argnull)); *op->resnull = false; break; @@ -3166,7 +3166,7 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) *op->resvalue = PointerGetDatum(xmlparse(data, xexpr->xmloption, - preserve_whitespace)); + preserve_whitespace)); *op->resnull = false; } break; @@ -3243,8 +3243,8 @@ ExecEvalXmlExpr(ExprState *state, ExprEvalStep *op) value = argvalue[0]; *op->resvalue = PointerGetDatum( - xmltotext_with_xmloption(DatumGetXmlP(value), - xexpr->xmloption)); + xmltotext_with_xmloption(DatumGetXmlP(value), + xexpr->xmloption)); *op->resnull = false; } break; @@ -3418,7 +3418,7 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("table row type and query-specified row type do not match"), errdetail_plural("Table row contains %d attribute, but query expects %d.", - "Table row contains %d attributes, but query expects %d.", + "Table row contains %d attributes, but query expects %d.", slot_tupdesc->natts, slot_tupdesc->natts, var_tupdesc->natts))); @@ -3492,10 +3492,10 @@ ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext) * perhaps other places.) */ if (econtext->ecxt_estate && - variable->varno <= list_length(econtext->ecxt_estate->es_range_table)) + variable->varno <= list_length(econtext->ecxt_estate->es_range_table)) { RangeTblEntry *rte = rt_fetch(variable->varno, - econtext->ecxt_estate->es_range_table); + econtext->ecxt_estate->es_range_table); if (rte->eref) ExecTypeSetColNames(output_tupdesc, rte->eref->colnames); diff --git a/src/backend/executor/execIndexing.c b/src/backend/executor/execIndexing.c index 108060ac0f..89e189fa71 100644 --- a/src/backend/executor/execIndexing.c +++ b/src/backend/executor/execIndexing.c @@ -387,7 +387,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot, index_insert(indexRelation, /* index relation */ values, /* array of index Datums */ isnull, /* null flags */ - tupleid, /* tid of heap tuple */ + tupleid, /* tid of heap tuple */ heapRelation, /* heap relation */ checkUnique, /* type of uniqueness check to do */ indexInfo); /* index AM may need this */ @@ -432,7 +432,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot, indexRelation, indexInfo, tupleid, values, isnull, estate, false, - waitMode, violationOK, NULL); + waitMode, violationOK, NULL); } if ((checkUnique == UNIQUE_CHECK_PARTIAL || @@ -542,7 +542,7 @@ ExecCheckIndexConstraints(TupleTableSlot *slot, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("ON CONFLICT does not support deferrable unique constraints/exclusion constraints as arbiters"), errtableconstraint(heapRelation, - RelationGetRelationName(indexRelation)))); + RelationGetRelationName(indexRelation)))); checkedIndex = true; @@ -580,7 +580,7 @@ ExecCheckIndexConstraints(TupleTableSlot *slot, satisfiesConstraint = check_exclusion_or_unique_constraint(heapRelation, indexRelation, indexInfo, &invalidItemPtr, - values, isnull, estate, false, + values, isnull, estate, false, CEOUC_WAIT, true, conflictTid); if (!satisfiesConstraint) diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 34cca85563..1d306b58ea 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -745,14 +745,14 @@ ExecCheckRTEPerms(RangeTblEntry *rte) */ if (remainingPerms & ACL_INSERT && !ExecCheckRTEPermsModified(relOid, userid, - rte->insertedCols, - ACL_INSERT)) + rte->insertedCols, + ACL_INSERT)) return false; if (remainingPerms & ACL_UPDATE && !ExecCheckRTEPermsModified(relOid, userid, - rte->updatedCols, - ACL_UPDATE)) + rte->updatedCols, + ACL_UPDATE)) return false; } return true; @@ -1198,26 +1198,26 @@ CheckValidResultRel(Relation resultRel, CmdType operation) case CMD_INSERT: if (!trigDesc || !trigDesc->trig_insert_instead_row) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("cannot insert into view \"%s\"", - RelationGetRelationName(resultRel)), - errhint("To enable inserting into the view, provide an INSTEAD OF INSERT trigger or an unconditional ON INSERT DO INSTEAD rule."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("cannot insert into view \"%s\"", + RelationGetRelationName(resultRel)), + errhint("To enable inserting into the view, provide an INSTEAD OF INSERT trigger or an unconditional ON INSERT DO INSTEAD rule."))); break; case CMD_UPDATE: if (!trigDesc || !trigDesc->trig_update_instead_row) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("cannot update view \"%s\"", - RelationGetRelationName(resultRel)), - errhint("To enable updating the view, provide an INSTEAD OF UPDATE trigger or an unconditional ON UPDATE DO INSTEAD rule."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("cannot update view \"%s\"", + RelationGetRelationName(resultRel)), + errhint("To enable updating the view, provide an INSTEAD OF UPDATE trigger or an unconditional ON UPDATE DO INSTEAD rule."))); break; case CMD_DELETE: if (!trigDesc || !trigDesc->trig_delete_instead_row) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("cannot delete from view \"%s\"", - RelationGetRelationName(resultRel)), - errhint("To enable deleting from the view, provide an INSTEAD OF DELETE trigger or an unconditional ON DELETE DO INSTEAD rule."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("cannot delete from view \"%s\"", + RelationGetRelationName(resultRel)), + errhint("To enable deleting from the view, provide an INSTEAD OF DELETE trigger or an unconditional ON DELETE DO INSTEAD rule."))); break; default: elog(ERROR, "unrecognized CmdType: %d", (int) operation); @@ -1240,14 +1240,14 @@ CheckValidResultRel(Relation resultRel, CmdType operation) if (fdwroutine->ExecForeignInsert == NULL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot insert into foreign table \"%s\"", - RelationGetRelationName(resultRel)))); + errmsg("cannot insert into foreign table \"%s\"", + RelationGetRelationName(resultRel)))); if (fdwroutine->IsForeignRelUpdatable != NULL && (fdwroutine->IsForeignRelUpdatable(resultRel) & (1 << CMD_INSERT)) == 0) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("foreign table \"%s\" does not allow inserts", - RelationGetRelationName(resultRel)))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("foreign table \"%s\" does not allow inserts", + RelationGetRelationName(resultRel)))); break; case CMD_UPDATE: if (fdwroutine->ExecForeignUpdate == NULL) @@ -1258,22 +1258,22 @@ CheckValidResultRel(Relation resultRel, CmdType operation) if (fdwroutine->IsForeignRelUpdatable != NULL && (fdwroutine->IsForeignRelUpdatable(resultRel) & (1 << CMD_UPDATE)) == 0) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("foreign table \"%s\" does not allow updates", - RelationGetRelationName(resultRel)))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("foreign table \"%s\" does not allow updates", + RelationGetRelationName(resultRel)))); break; case CMD_DELETE: if (fdwroutine->ExecForeignDelete == NULL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot delete from foreign table \"%s\"", - RelationGetRelationName(resultRel)))); + errmsg("cannot delete from foreign table \"%s\"", + RelationGetRelationName(resultRel)))); if (fdwroutine->IsForeignRelUpdatable != NULL && (fdwroutine->IsForeignRelUpdatable(resultRel) & (1 << CMD_DELETE)) == 0) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("foreign table \"%s\" does not allow deletes", - RelationGetRelationName(resultRel)))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("foreign table \"%s\" does not allow deletes", + RelationGetRelationName(resultRel)))); break; default: elog(ERROR, "unrecognized CmdType: %d", (int) operation); @@ -1332,8 +1332,8 @@ CheckValidRowMarkRel(Relation rel, RowMarkType markType) if (markType != ROW_MARK_REFERENCE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("cannot lock rows in materialized view \"%s\"", - RelationGetRelationName(rel)))); + errmsg("cannot lock rows in materialized view \"%s\"", + RelationGetRelationName(rel)))); break; case RELKIND_FOREIGN_TABLE: /* Okay only if the FDW supports it */ @@ -1940,7 +1940,7 @@ ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, tupdesc = RelationGetDescr(rel); /* a reverse map */ map = convert_tuples_by_name(old_tupdesc, tupdesc, - gettext_noop("could not convert row type")); + gettext_noop("could not convert row type")); if (map != NULL) { tuple = do_convert_tuple(tuple, map); @@ -1958,9 +1958,9 @@ ExecPartitionCheck(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, 64); ereport(ERROR, (errcode(ERRCODE_CHECK_VIOLATION), - errmsg("new row for relation \"%s\" violates partition constraint", - RelationGetRelationName(orig_rel)), - val_desc ? errdetail("Failing row contains %s.", val_desc) : 0)); + errmsg("new row for relation \"%s\" violates partition constraint", + RelationGetRelationName(orig_rel)), + val_desc ? errdetail("Failing row contains %s.", val_desc) : 0)); } } @@ -2017,7 +2017,7 @@ ExecConstraints(ResultRelInfo *resultRelInfo, tupdesc = RelationGetDescr(rel); /* a reverse map */ map = convert_tuples_by_name(orig_tupdesc, tupdesc, - gettext_noop("could not convert row type")); + gettext_noop("could not convert row type")); if (map != NULL) { tuple = do_convert_tuple(tuple, map); @@ -2037,7 +2037,7 @@ ExecConstraints(ResultRelInfo *resultRelInfo, ereport(ERROR, (errcode(ERRCODE_NOT_NULL_VIOLATION), errmsg("null value in column \"%s\" violates not-null constraint", - NameStr(orig_tupdesc->attrs[attrChk - 1]->attname)), + NameStr(orig_tupdesc->attrs[attrChk - 1]->attname)), val_desc ? errdetail("Failing row contains %s.", val_desc) : 0, errtablecol(orig_rel, attrChk))); } @@ -2064,7 +2064,7 @@ ExecConstraints(ResultRelInfo *resultRelInfo, tupdesc = RelationGetDescr(rel); /* a reverse map */ map = convert_tuples_by_name(old_tupdesc, tupdesc, - gettext_noop("could not convert row type")); + gettext_noop("could not convert row type")); if (map != NULL) { tuple = do_convert_tuple(tuple, map); @@ -2084,7 +2084,7 @@ ExecConstraints(ResultRelInfo *resultRelInfo, (errcode(ERRCODE_CHECK_VIOLATION), errmsg("new row for relation \"%s\" violates check constraint \"%s\"", RelationGetRelationName(orig_rel), failed), - val_desc ? errdetail("Failing row contains %s.", val_desc) : 0, + val_desc ? errdetail("Failing row contains %s.", val_desc) : 0, errtableconstraint(orig_rel, failed))); } } @@ -2158,8 +2158,8 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, * the permissions on the relation (that is, if the user * could view it directly anyway). For RLS violations, we * don't include the data since we don't know if the user - * should be able to view the tuple as as that depends on - * the USING policy. + * should be able to view the tuple as that depends on the + * USING policy. */ case WCO_VIEW_CHECK: insertedCols = GetInsertedColumns(resultRelInfo, estate); @@ -2173,8 +2173,8 @@ ExecWithCheckOptions(WCOKind kind, ResultRelInfo *resultRelInfo, ereport(ERROR, (errcode(ERRCODE_WITH_CHECK_OPTION_VIOLATION), - errmsg("new row violates check option for view \"%s\"", - wco->relname), + errmsg("new row violates check option for view \"%s\"", + wco->relname), val_desc ? errdetail("Failing row contains %s.", val_desc) : 0)); break; @@ -2635,14 +2635,14 @@ EvalPlanQualFetch(EState *estate, Relation relation, int lockmode, break; case LockWaitSkip: if (!ConditionalXactLockTableWait(SnapshotDirty.xmax)) - return NULL; /* skip instead of waiting */ + return NULL; /* skip instead of waiting */ break; case LockWaitError: if (!ConditionalXactLockTableWait(SnapshotDirty.xmax)) ereport(ERROR, (errcode(ERRCODE_LOCK_NOT_AVAILABLE), errmsg("could not obtain lock on row in relation \"%s\"", - RelationGetRelationName(relation)))); + RelationGetRelationName(relation)))); break; } continue; /* loop back to repeat heap_fetch */ @@ -2940,8 +2940,8 @@ EvalPlanQualFetchRowMarks(EPQState *epqstate) if (fdwroutine->RefetchForeignRow == NULL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot lock rows in foreign table \"%s\"", - RelationGetRelationName(erm->relation)))); + errmsg("cannot lock rows in foreign table \"%s\"", + RelationGetRelationName(erm->relation)))); copyTuple = fdwroutine->RefetchForeignRow(epqstate->estate, erm, datum, @@ -3302,7 +3302,7 @@ ExecSetupPartitionTupleRouting(Relation rel, *partitions = (ResultRelInfo *) palloc(*num_partitions * sizeof(ResultRelInfo)); *tup_conv_maps = (TupleConversionMap **) palloc0(*num_partitions * - sizeof(TupleConversionMap *)); + sizeof(TupleConversionMap *)); /* * Initialize an empty slot that will be used to manipulate tuples of any @@ -3337,7 +3337,7 @@ ExecSetupPartitionTupleRouting(Relation rel, * partition from the parent's type to the partition's. */ (*tup_conv_maps)[i] = convert_tuples_by_name(tupDesc, part_tupdesc, - gettext_noop("could not convert row type")); + gettext_noop("could not convert row type")); InitResultRelInfo(leaf_part_rri, partrel, diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c index 1c02fa140b..ce47f1d4a8 100644 --- a/src/backend/executor/execParallel.c +++ b/src/backend/executor/execParallel.c @@ -110,7 +110,7 @@ static bool ExecParallelInitializeDSM(PlanState *node, static shm_mq_handle **ExecParallelSetupTupleQueues(ParallelContext *pcxt, bool reinitialize); static bool ExecParallelRetrieveInstrumentation(PlanState *planstate, - SharedExecutorInstrumentation *instrumentation); + SharedExecutorInstrumentation *instrumentation); /* Helper function that runs in the parallel worker. */ static DestReceiver *ExecParallelGetReceiver(dsm_segment *seg, shm_toc *toc); @@ -446,7 +446,7 @@ ExecInitParallelPlan(PlanState *planstate, EState *estate, int nworkers) /* Estimate space for tuple queues. */ shm_toc_estimate_chunk(&pcxt->estimator, - mul_size(PARALLEL_TUPLE_QUEUE_SIZE, pcxt->nworkers)); + mul_size(PARALLEL_TUPLE_QUEUE_SIZE, pcxt->nworkers)); shm_toc_estimate_keys(&pcxt->estimator, 1); /* @@ -504,7 +504,7 @@ ExecInitParallelPlan(PlanState *planstate, EState *estate, int nworkers) /* Allocate space for each worker's BufferUsage; no need to initialize. */ bufusage_space = shm_toc_allocate(pcxt->toc, - mul_size(sizeof(BufferUsage), pcxt->nworkers)); + mul_size(sizeof(BufferUsage), pcxt->nworkers)); shm_toc_insert(pcxt->toc, PARALLEL_KEY_BUFFER_USAGE, bufusage_space); pei->buffer_usage = bufusage_space; @@ -583,7 +583,7 @@ ExecInitParallelPlan(PlanState *planstate, EState *estate, int nworkers) */ static bool ExecParallelRetrieveInstrumentation(PlanState *planstate, - SharedExecutorInstrumentation *instrumentation) + SharedExecutorInstrumentation *instrumentation) { Instrumentation *instrument; int i; @@ -735,7 +735,7 @@ ExecParallelGetQueryDesc(shm_toc *toc, DestReceiver *receiver, */ static bool ExecParallelReportInstrumentation(PlanState *planstate, - SharedExecutorInstrumentation *instrumentation) + SharedExecutorInstrumentation *instrumentation) { int i; int plan_node_id = planstate->plan->plan_node_id; @@ -804,7 +804,7 @@ ExecParallelInitializeWorker(PlanState *planstate, shm_toc *toc) break; case T_BitmapHeapScanState: ExecBitmapHeapInitializeWorker( - (BitmapHeapScanState *) planstate, toc); + (BitmapHeapScanState *) planstate, toc); break; default: break; diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c index f2d9ccb130..b62f964271 100644 --- a/src/backend/executor/execProcnode.c +++ b/src/backend/executor/execProcnode.c @@ -262,7 +262,7 @@ ExecInitNode(Plan *node, EState *estate, int eflags) case T_NamedTuplestoreScan: result = (PlanState *) ExecInitNamedTuplestoreScan((NamedTuplestoreScan *) node, - estate, eflags); + estate, eflags); break; case T_WorkTableScan: diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index c6a66b6195..59f14e997f 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -24,12 +24,14 @@ #include "parser/parsetree.h" #include "storage/bufmgr.h" #include "storage/lmgr.h" +#include "utils/builtins.h" #include "utils/datum.h" #include "utils/lsyscache.h" #include "utils/memutils.h" #include "utils/rel.h" #include "utils/snapmgr.h" #include "utils/syscache.h" +#include "utils/typcache.h" #include "utils/tqual.h" @@ -224,13 +226,15 @@ tuple_equals_slot(TupleDesc desc, HeapTuple tup, TupleTableSlot *slot) Datum values[MaxTupleAttributeNumber]; bool isnull[MaxTupleAttributeNumber]; int attrnum; - Form_pg_attribute att; heap_deform_tuple(tup, desc, values, isnull); /* Check equality of the attributes. */ for (attrnum = 0; attrnum < desc->natts; attrnum++) { + Form_pg_attribute att; + TypeCacheEntry *typentry; + /* * If one value is NULL and other is not, then they are certainly not * equal @@ -245,8 +249,17 @@ tuple_equals_slot(TupleDesc desc, HeapTuple tup, TupleTableSlot *slot) continue; att = desc->attrs[attrnum]; - if (!datumIsEqual(values[attrnum], slot->tts_values[attrnum], - att->attbyval, att->attlen)) + + typentry = lookup_type_cache(att->atttypid, TYPECACHE_EQ_OPR_FINFO); + if (!OidIsValid(typentry->eq_opr_finfo.fn_oid)) + ereport(ERROR, + (errcode(ERRCODE_UNDEFINED_FUNCTION), + errmsg("could not identify an equality operator for type %s", + format_type_be(att->atttypid)))); + + if (!DatumGetBool(FunctionCall2(&typentry->eq_opr_finfo, + values[attrnum], + slot->tts_values[attrnum]))) return false; } @@ -568,6 +581,6 @@ CheckSubscriptionRelkind(char relkind, const char *nspname, if (relkind != RELKIND_RELATION) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("logical replication target relation \"%s.%s\" is not a table", - nspname, relname))); + errmsg("logical replication target relation \"%s.%s\" is not a table", + nspname, relname))); } diff --git a/src/backend/executor/execSRF.c b/src/backend/executor/execSRF.c index 077ac208c1..138e86ac67 100644 --- a/src/backend/executor/execSRF.c +++ b/src/backend/executor/execSRF.c @@ -291,7 +291,7 @@ ExecMakeTableFunctionResult(SetExprState *setexpr, */ oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_query_memory); tupdesc = lookup_rowtype_tupdesc_copy(HeapTupleHeaderGetTypeId(td), - HeapTupleHeaderGetTypMod(td)); + HeapTupleHeaderGetTypMod(td)); rsinfo.setDesc = tupdesc; MemoryContextSwitchTo(oldcontext); } @@ -667,10 +667,10 @@ init_sexpr(Oid foid, Oid input_collation, Expr *node, if (list_length(sexpr->args) > FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg_plural("cannot pass more than %d argument to a function", - "cannot pass more than %d arguments to a function", - FUNC_MAX_ARGS, - FUNC_MAX_ARGS))); + errmsg_plural("cannot pass more than %d argument to a function", + "cannot pass more than %d arguments to a function", + FUNC_MAX_ARGS, + FUNC_MAX_ARGS))); /* Set up the primary fmgr lookup information */ fmgr_info_cxt(foid, &(sexpr->func), sexprCxt); @@ -687,7 +687,7 @@ init_sexpr(Oid foid, Oid input_collation, Expr *node, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("set-valued function called in context that cannot accept a set"), parent ? executor_errposition(parent->state, - exprLocation((Node *) node)) : 0)); + exprLocation((Node *) node)) : 0)); /* Otherwise, caller should have marked the sexpr correctly */ Assert(sexpr->func.fn_retset == sexpr->funcReturnsSet); @@ -897,7 +897,7 @@ tupledesc_match(TupleDesc dst_tupdesc, TupleDesc src_tupdesc) (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("function return row and query-specified return row do not match"), errdetail_plural("Returned row contains %d attribute, but query expects %d.", - "Returned row contains %d attributes, but query expects %d.", + "Returned row contains %d attributes, but query expects %d.", src_tupdesc->natts, src_tupdesc->natts, dst_tupdesc->natts))); diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c index 489ca5edb9..220715d0ea 100644 --- a/src/backend/executor/execTuples.c +++ b/src/backend/executor/execTuples.c @@ -254,8 +254,8 @@ ExecDropSingleTupleTableSlot(TupleTableSlot *slot) * -------------------------------- */ void -ExecSetSlotDescriptor(TupleTableSlot *slot, /* slot to change */ - TupleDesc tupdesc) /* new tuple descriptor */ +ExecSetSlotDescriptor(TupleTableSlot *slot, /* slot to change */ + TupleDesc tupdesc) /* new tuple descriptor */ { /* For safety, make sure slot is empty before changing it */ ExecClearTuple(slot); @@ -1377,7 +1377,7 @@ HeapTupleHeaderGetDatum(HeapTupleHeader tuple) /* And do the flattening */ result = toast_flatten_tuple_to_datum(tuple, - HeapTupleHeaderGetDatumLength(tuple), + HeapTupleHeaderGetDatumLength(tuple), tupDesc); ReleaseTupleDesc(tupDesc); diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index b1178552e5..cde7b645d8 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -103,7 +103,7 @@ CreateExecutorState(void) * Initialize all fields of the Executor State structure */ estate->es_direction = ForwardScanDirection; - estate->es_snapshot = InvalidSnapshot; /* caller must initialize this */ + estate->es_snapshot = InvalidSnapshot; /* caller must initialize this */ estate->es_crosscheck_snapshot = InvalidSnapshot; /* no crosscheck */ estate->es_range_table = NIL; estate->es_plannedstmt = NULL; diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c index bb5c609e54..1e993742c2 100644 --- a/src/backend/executor/functions.c +++ b/src/backend/executor/functions.c @@ -97,7 +97,7 @@ typedef struct char *fname; /* function name (for error msgs) */ char *src; /* function body text (for error msgs) */ - SQLFunctionParseInfoPtr pinfo; /* data for parser callback hooks */ + SQLFunctionParseInfoPtr pinfo; /* data for parser callback hooks */ Oid rettype; /* actual return type */ int16 typlen; /* length of the return type */ @@ -144,7 +144,7 @@ typedef struct SQLFunctionParseInfo char **argnames; /* names of input arguments; NULL if none */ /* Note that argnames[i] can be NULL, if some args are unnamed */ Oid collation; /* function's input collation, if known */ -} SQLFunctionParseInfo; +} SQLFunctionParseInfo; /* non-export function prototypes */ @@ -249,13 +249,13 @@ prepare_sql_fn_parse_info(HeapTuple procedureTuple, Anum_pg_proc_proargnames, &isNull); if (isNull) - proargnames = PointerGetDatum(NULL); /* just to be sure */ + proargnames = PointerGetDatum(NULL); /* just to be sure */ proargmodes = SysCacheGetAttr(PROCNAMEARGSNSP, procedureTuple, Anum_pg_proc_proargmodes, &isNull); if (isNull) - proargmodes = PointerGetDatum(NULL); /* just to be sure */ + proargmodes = PointerGetDatum(NULL); /* just to be sure */ n_arg_names = get_func_input_arg_names(proargnames, proargmodes, &pinfo->argnames); @@ -521,7 +521,7 @@ init_execution_state(List *queryTree_list, ((CopyStmt *) stmt->utilityStmt)->filename == NULL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot COPY to/from client in a SQL function"))); + errmsg("cannot COPY to/from client in a SQL function"))); if (IsA(stmt->utilityStmt, TransactionStmt)) ereport(ERROR, @@ -535,8 +535,8 @@ init_execution_state(List *queryTree_list, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /* translator: %s is a SQL statement name */ - errmsg("%s is not allowed in a non-volatile function", - CreateCommandTag((Node *) stmt)))); + errmsg("%s is not allowed in a non-volatile function", + CreateCommandTag((Node *) stmt)))); #ifdef PGXC if (IS_PGXC_LOCAL_COORDINATOR) @@ -670,7 +670,7 @@ init_sql_fcache(FmgrInfo *finfo, Oid collation, bool lazyEvalOK) if (IsPolymorphicType(rettype)) { rettype = get_fn_expr_rettype(finfo); - if (rettype == InvalidOid) /* this probably should not happen */ + if (rettype == InvalidOid) /* this probably should not happen */ ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("could not determine actual result type for function declared to return type %s", @@ -735,7 +735,7 @@ init_sql_fcache(FmgrInfo *finfo, Oid collation, bool lazyEvalOK) queryTree_sublist = pg_analyze_and_rewrite_params(parsetree, fcache->src, - (ParserSetupHook) sql_fn_parser_setup, + (ParserSetupHook) sql_fn_parser_setup, fcache->pinfo, NULL); queryTree_list = lappend(queryTree_list, queryTree_sublist); @@ -1569,7 +1569,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, AssertArg(!IsPolymorphicType(rettype)); if (modifyTargetList) - *modifyTargetList = false; /* initialize for no change */ + *modifyTargetList = false; /* initialize for no change */ if (junkFilter) *junkFilter = NULL; /* initialize in case of VOID result */ @@ -1619,8 +1619,8 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, if (rettype != VOIDOID) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("return type mismatch in function declared to return %s", - format_type_be(rettype)), + errmsg("return type mismatch in function declared to return %s", + format_type_be(rettype)), errdetail("Function's final statement must be SELECT or INSERT/UPDATE/DELETE RETURNING."))); return false; } @@ -1656,9 +1656,9 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, if (tlistlen != 1) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("return type mismatch in function declared to return %s", - format_type_be(rettype)), - errdetail("Final statement must return exactly one column."))); + errmsg("return type mismatch in function declared to return %s", + format_type_be(rettype)), + errdetail("Final statement must return exactly one column."))); /* We assume here that non-junk TLEs must come first in tlists */ tle = (TargetEntry *) linitial(tlist); @@ -1668,8 +1668,8 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, if (!IsBinaryCoercible(restype, rettype)) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("return type mismatch in function declared to return %s", - format_type_be(rettype)), + errmsg("return type mismatch in function declared to return %s", + format_type_be(rettype)), errdetail("Actual return type is %s.", format_type_be(restype)))); if (modifyTargetList && restype != rettype) @@ -1723,8 +1723,8 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, tle->expr = (Expr *) makeRelabelType(tle->expr, rettype, -1, - get_typcollation(rettype), - COERCE_IMPLICIT_CAST); + get_typcollation(rettype), + COERCE_IMPLICIT_CAST); /* Relabel is dangerous if sort/group or setop column */ if (tle->ressortgroupref != 0 || parse->setOperations) *modifyTargetList = true; @@ -1783,7 +1783,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("return type mismatch in function declared to return %s", format_type_be(rettype)), - errdetail("Final statement returns too many columns."))); + errdetail("Final statement returns too many columns."))); attr = tupdesc->attrs[colindex - 1]; if (attr->attisdropped && modifyTargetList) { @@ -1795,7 +1795,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, InvalidOid, sizeof(int32), (Datum) 0, - true, /* isnull */ + true, /* isnull */ true /* byval */ ); newtlist = lappend(newtlist, makeTargetEntry(null_expr, @@ -1827,8 +1827,8 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, tle->expr = (Expr *) makeRelabelType(tle->expr, atttype, -1, - get_typcollation(atttype), - COERCE_IMPLICIT_CAST); + get_typcollation(atttype), + COERCE_IMPLICIT_CAST); /* Relabel is dangerous if sort/group or setop column */ if (tle->ressortgroupref != 0 || parse->setOperations) *modifyTargetList = true; @@ -1846,7 +1846,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("return type mismatch in function declared to return %s", format_type_be(rettype)), - errdetail("Final statement returns too few columns."))); + errdetail("Final statement returns too few columns."))); if (modifyTargetList) { Expr *null_expr; @@ -1886,7 +1886,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList, /* Set up junk filter if needed */ if (junkFilter) *junkFilter = ExecInitJunkFilterConversion(tlist, - CreateTupleDescCopy(tupdesc), + CreateTupleDescCopy(tupdesc), NULL); /* Report that we are returning entire tuple result */ diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 1b94a66484..81a80a1e84 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -392,7 +392,7 @@ typedef struct AggStatePerTransData FunctionCallInfoData serialfn_fcinfo; FunctionCallInfoData deserialfn_fcinfo; -} AggStatePerTransData; +} AggStatePerTransData; /* * AggStatePerAggData - per-aggregate information @@ -440,7 +440,7 @@ typedef struct AggStatePerAggData int16 resulttypeLen; bool resulttypeByVal; -} AggStatePerAggData; +} AggStatePerAggData; /* * AggStatePerGroupData - per-aggregate-per-group working state @@ -472,7 +472,7 @@ typedef struct AggStatePerGroupData * NULL and not auto-replace it with a later input value. Only the first * non-NULL input will be auto-substituted. */ -} AggStatePerGroupData; +} AggStatePerGroupData; /* * AggStatePerPhaseData - per-grouping-set-phase state @@ -494,7 +494,7 @@ typedef struct AggStatePerPhaseData FmgrInfo *eqfunctions; /* per-grouping-field equality fns */ Agg *aggnode; /* Agg node for phase data */ Sort *sortnode; /* Sort node for input ordering for phase */ -} AggStatePerPhaseData; +} AggStatePerPhaseData; /* * AggStatePerHashData - per-hashtable state @@ -512,11 +512,11 @@ typedef struct AggStatePerHashData FmgrInfo *eqfunctions; /* per-grouping-field equality fns */ int numCols; /* number of hash key columns */ int numhashGrpCols; /* number of columns in hash table */ - int largestGrpColIdx; /* largest col required for hashing */ - AttrNumber *hashGrpColIdxInput; /* hash col indices in input slot */ - AttrNumber *hashGrpColIdxHash; /* indices in hashtbl tuples */ + int largestGrpColIdx; /* largest col required for hashing */ + AttrNumber *hashGrpColIdxInput; /* hash col indices in input slot */ + AttrNumber *hashGrpColIdxHash; /* indices in hashtbl tuples */ Agg *aggnode; /* original Agg node, for numGroups etc. */ -} AggStatePerHashData; +} AggStatePerHashData; static void select_current_set(AggState *aggstate, int setno, bool is_hash); @@ -753,7 +753,7 @@ initialize_aggregate(AggState *aggstate, AggStatePerTrans pertrans, MemoryContext oldContext; oldContext = MemoryContextSwitchTo( - aggstate->curaggcontext->ecxt_per_tuple_memory); + aggstate->curaggcontext->ecxt_per_tuple_memory); pergroupstate->transValue = datumCopy(pertrans->initValue, pertrans->transtypeByVal, pertrans->transtypeLen); @@ -870,7 +870,7 @@ advance_transition_function(AggState *aggstate, * do not need to pfree the old transValue, since it's NULL. */ oldContext = MemoryContextSwitchTo( - aggstate->curaggcontext->ecxt_per_tuple_memory); + aggstate->curaggcontext->ecxt_per_tuple_memory); pergroupstate->transValue = datumCopy(fcinfo->arg[1], pertrans->transtypeByVal, pertrans->transtypeLen); @@ -1201,9 +1201,9 @@ advance_combine_function(AggState *aggstate, if (!pertrans->transtypeByVal) { oldContext = MemoryContextSwitchTo( - aggstate->curaggcontext->ecxt_per_tuple_memory); + aggstate->curaggcontext->ecxt_per_tuple_memory); pergroupstate->transValue = datumCopy(fcinfo->arg[1], - pertrans->transtypeByVal, + pertrans->transtypeByVal, pertrans->transtypeLen); MemoryContextSwitchTo(oldContext); } @@ -1531,7 +1531,7 @@ finalize_aggregate(AggState *aggstate, /* Fill in the transition state value */ fcinfo.arg[0] = MakeExpandedObjectReadOnly(pergroupstate->transValue, - pergroupstate->transValueIsNull, + pergroupstate->transValueIsNull, pertrans->transtypeLen); fcinfo.argnull[0] = pergroupstate->transValueIsNull; anynull |= pergroupstate->transValueIsNull; @@ -1611,8 +1611,8 @@ finalize_partialaggregate(AggState *aggstate, FunctionCallInfo fcinfo = &pertrans->serialfn_fcinfo; fcinfo->arg[0] = MakeExpandedObjectReadOnly(pergroupstate->transValue, - pergroupstate->transValueIsNull, - pertrans->transtypeLen); + pergroupstate->transValueIsNull, + pertrans->transtypeLen); fcinfo->argnull[0] = pergroupstate->transValueIsNull; *resultVal = FunctionCallInvoke(fcinfo); @@ -1873,9 +1873,9 @@ build_hash_table(AggState *aggstate) perhash->hashfunctions, perhash->aggnode->numGroups, additionalsize, - aggstate->hashcontext->ecxt_per_tuple_memory, + aggstate->hashcontext->ecxt_per_tuple_memory, tmpmem, - DO_AGGSPLIT_SKIPFINAL(aggstate->aggsplit)); + DO_AGGSPLIT_SKIPFINAL(aggstate->aggsplit)); } } @@ -2052,7 +2052,7 @@ lookup_hash_entry(AggState *aggstate) { entry->additional = (AggStatePerGroup) MemoryContextAlloc(perhash->hashtable->tablecxt, - sizeof(AggStatePerGroupData) * aggstate->numtrans); + sizeof(AggStatePerGroupData) * aggstate->numtrans); /* initialize aggregates for new tuple group */ initialize_aggregates(aggstate, (AggStatePerGroup) entry->additional, -1); @@ -2374,8 +2374,7 @@ agg_retrieve_direct(AggState *aggstate) firstSlot, InvalidBuffer, true); - aggstate->grp_firstTuple = NULL; /* don't keep two - * pointers */ + aggstate->grp_firstTuple = NULL; /* don't keep two pointers */ /* set up for first advance_aggregates call */ tmpcontext->ecxt_outertuple = firstSlot; @@ -2435,7 +2434,7 @@ agg_retrieve_direct(AggState *aggstate) node->numCols, node->grpColIdx, aggstate->phase->eqfunctions, - tmpcontext->ecxt_per_tuple_memory)) + tmpcontext->ecxt_per_tuple_memory)) { aggstate->grp_firstTuple = ExecCopySlotTuple(outerslot); break; @@ -2819,7 +2818,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) ExecAssignScanTypeFromOuterPlan(&aggstate->ss); if (node->chain) ExecSetSlotDescriptor(aggstate->sort_slot, - aggstate->ss.ss_ScanTupleSlot->tts_tupleDescriptor); + aggstate->ss.ss_ScanTupleSlot->tts_tupleDescriptor); /* * Initialize result tuple type and projection info. @@ -2935,7 +2934,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) } all_grouped_cols = bms_add_members(all_grouped_cols, - phasedata->grouped_cols[0]); + phasedata->grouped_cols[0]); } else { @@ -3306,8 +3305,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) */ existing_transno = find_compatible_pertrans(aggstate, aggref, transfn_oid, aggtranstype, - serialfn_oid, deserialfn_oid, - initValue, initValueIsNull, + serialfn_oid, deserialfn_oid, + initValue, initValueIsNull, same_input_transnos); if (existing_transno != -1) { @@ -3979,7 +3978,7 @@ ExecReScanAgg(AggState *node) * Reset the per-group state (in particular, mark transvalues null) */ MemSet(node->pergroup, 0, - sizeof(AggStatePerGroupData) * node->numaggs * numGroupingSets); + sizeof(AggStatePerGroupData) * node->numaggs * numGroupingSets); /* reset to phase 1 */ initialize_phase(node, 1); diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index 77f65db0ca..7e0ba030b7 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -129,7 +129,7 @@ BitmapHeapNext(BitmapHeapScanState *node) node->prefetch_pages = 0; node->prefetch_target = -1; } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } else { @@ -182,7 +182,7 @@ BitmapHeapNext(BitmapHeapScanState *node) node->shared_prefetch_iterator = tbm_attach_shared_iterate(dsa, pstate->prefetch_iterator); } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } node->initialized = true; } @@ -265,7 +265,7 @@ BitmapHeapNext(BitmapHeapScanState *node) pstate->prefetch_target++; SpinLockRelease(&pstate->mutex); } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } /* @@ -514,7 +514,7 @@ BitmapAdjustPrefetchIterator(BitmapHeapScanState *node, tbm_shared_iterate(prefetch_iterator); } } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } /* @@ -558,7 +558,7 @@ BitmapAdjustPrefetchTarget(BitmapHeapScanState *node) pstate->prefetch_target++; SpinLockRelease(&pstate->mutex); } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } /* @@ -634,7 +634,7 @@ BitmapPrefetch(BitmapHeapScanState *node, HeapScanDesc scan) } } } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } /* diff --git a/src/backend/executor/nodeBitmapIndexscan.c b/src/backend/executor/nodeBitmapIndexscan.c index ce2f3210a4..2411a2e5c1 100644 --- a/src/backend/executor/nodeBitmapIndexscan.c +++ b/src/backend/executor/nodeBitmapIndexscan.c @@ -73,7 +73,7 @@ MultiExecBitmapIndexScan(BitmapIndexScanState *node) if (node->biss_result) { tbm = node->biss_result; - node->biss_result = NULL; /* reset for next time */ + node->biss_result = NULL; /* reset for next time */ } else { @@ -254,7 +254,7 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags) */ relistarget = ExecRelationIsTargetRelation(estate, node->scan.scanrelid); indexstate->biss_RelationDesc = index_open(node->indexid, - relistarget ? NoLock : AccessShareLock); + relistarget ? NoLock : AccessShareLock); /* * Initialize index-specific scan state diff --git a/src/backend/executor/nodeBitmapOr.c b/src/backend/executor/nodeBitmapOr.c index c0f261407b..4f0ddc6dff 100644 --- a/src/backend/executor/nodeBitmapOr.c +++ b/src/backend/executor/nodeBitmapOr.c @@ -150,7 +150,7 @@ MultiExecBitmapOr(BitmapOrState *node) elog(ERROR, "unrecognized result from subplan"); if (result == NULL) - result = subresult; /* first subplan */ + result = subresult; /* first subplan */ else { tbm_union(result, subresult); diff --git a/src/backend/executor/nodeFunctionscan.c b/src/backend/executor/nodeFunctionscan.c index 426527d2a2..3217d641d7 100644 --- a/src/backend/executor/nodeFunctionscan.c +++ b/src/backend/executor/nodeFunctionscan.c @@ -96,7 +96,7 @@ FunctionNext(FunctionScanState *node) node->ss.ps.ps_ExprContext, node->argcontext, node->funcstates[0].tupdesc, - node->eflags & EXEC_FLAG_BACKWARD); + node->eflags & EXEC_FLAG_BACKWARD); /* * paranoia - cope if the function, which may have constructed the @@ -155,7 +155,7 @@ FunctionNext(FunctionScanState *node) node->ss.ps.ps_ExprContext, node->argcontext, fs->tupdesc, - node->eflags & EXEC_FLAG_BACKWARD); + node->eflags & EXEC_FLAG_BACKWARD); /* * paranoia - cope if the function, which may have constructed the diff --git a/src/backend/executor/nodeGather.c b/src/backend/executor/nodeGather.c index c1db2e263b..f83cd584d7 100644 --- a/src/backend/executor/nodeGather.c +++ b/src/backend/executor/nodeGather.c @@ -258,7 +258,7 @@ gather_getnext(GatherState *gatherstate) if (HeapTupleIsValid(tup)) { - ExecStoreTuple(tup, /* tuple to store */ + ExecStoreTuple(tup, /* tuple to store */ fslot, /* slot in which to store the tuple */ InvalidBuffer, /* buffer associated with this * tuple */ diff --git a/src/backend/executor/nodeGatherMerge.c b/src/backend/executor/nodeGatherMerge.c index e066574836..80ee1fc89b 100644 --- a/src/backend/executor/nodeGatherMerge.c +++ b/src/backend/executor/nodeGatherMerge.c @@ -515,7 +515,7 @@ form_tuple_array(GatherMergeState *gm_state, int reader) tuple_buffer->tuple[i] = heap_copytuple(gm_readnext_tuple(gm_state, reader, false, - &tuple_buffer->done)); + &tuple_buffer->done)); if (!HeapTupleIsValid(tuple_buffer->tuple[i])) break; tuple_buffer->nTuples++; @@ -597,7 +597,7 @@ gather_merge_readnext(GatherMergeState *gm_state, int reader, bool nowait) ExecStoreTuple(tup, /* tuple to store */ gm_state->gm_slots[reader], /* slot in which to store the * tuple */ - InvalidBuffer, /* buffer associated with this tuple */ + InvalidBuffer, /* buffer associated with this tuple */ true); /* pfree this pointer if not from heap */ return true; diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c index d9789d0719..075f4ed11c 100644 --- a/src/backend/executor/nodeHash.c +++ b/src/backend/executor/nodeHash.c @@ -657,7 +657,7 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable) hashtable->log2_nbuckets = hashtable->log2_nbuckets_optimal; hashtable->buckets = repalloc(hashtable->buckets, - sizeof(HashJoinTuple) * hashtable->nbuckets); + sizeof(HashJoinTuple) * hashtable->nbuckets); } /* @@ -783,7 +783,7 @@ ExecHashIncreaseNumBuckets(HashJoinTable hashtable) */ hashtable->buckets = (HashJoinTuple *) repalloc(hashtable->buckets, - hashtable->nbuckets * sizeof(HashJoinTuple)); + hashtable->nbuckets * sizeof(HashJoinTuple)); memset(hashtable->buckets, 0, hashtable->nbuckets * sizeof(HashJoinTuple)); @@ -1176,7 +1176,7 @@ ExecScanHashTableForUnmatched(HashJoinState *hjstate, ExprContext *econtext) /* insert hashtable's tuple into exec slot */ inntuple = ExecStoreMinimalTuple(HJTUPLE_MINTUPLE(hashTuple), hjstate->hj_HashTupleSlot, - false); /* do not pfree */ + false); /* do not pfree */ econtext->ecxt_innertuple = inntuple; /* @@ -1650,7 +1650,7 @@ dense_alloc(HashJoinTable hashtable, Size size) { /* allocate new chunk and put it at the beginning of the list */ newChunk = (HashMemoryChunk) MemoryContextAlloc(hashtable->batchCxt, - offsetof(HashMemoryChunkData, data) + size); + offsetof(HashMemoryChunkData, data) + size); newChunk->maxlen = size; newChunk->used = 0; newChunk->ntuples = 0; @@ -1685,7 +1685,7 @@ dense_alloc(HashJoinTable hashtable, Size size) { /* allocate new chunk and put it at the beginning of the list */ newChunk = (HashMemoryChunk) MemoryContextAlloc(hashtable->batchCxt, - offsetof(HashMemoryChunkData, data) + HASH_CHUNK_SIZE); + offsetof(HashMemoryChunkData, data) + HASH_CHUNK_SIZE); newChunk->maxlen = HASH_CHUNK_SIZE; newChunk->used = size; diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c index f9ab0d6035..668ed871e1 100644 --- a/src/backend/executor/nodeHashjoin.c +++ b/src/backend/executor/nodeHashjoin.c @@ -234,7 +234,7 @@ ExecHashJoin(HashJoinState *node) Assert(batchno > hashtable->curbatch); ExecHashJoinSaveTuple(ExecFetchSlotMinimalTuple(outerTupleSlot), hashvalue, - &hashtable->outerBatchFile[batchno]); + &hashtable->outerBatchFile[batchno]); /* Loop around, staying in HJ_NEED_NEW_OUTER state */ continue; } @@ -452,20 +452,20 @@ ExecInitHashJoin(HashJoin *node, EState *estate, int eflags) case JOIN_ANTI: hjstate->hj_NullInnerTupleSlot = ExecInitNullTupleSlot(estate, - ExecGetResultType(innerPlanState(hjstate))); + ExecGetResultType(innerPlanState(hjstate))); break; case JOIN_RIGHT: hjstate->hj_NullOuterTupleSlot = ExecInitNullTupleSlot(estate, - ExecGetResultType(outerPlanState(hjstate))); + ExecGetResultType(outerPlanState(hjstate))); break; case JOIN_FULL: hjstate->hj_NullOuterTupleSlot = ExecInitNullTupleSlot(estate, - ExecGetResultType(outerPlanState(hjstate))); + ExecGetResultType(outerPlanState(hjstate))); hjstate->hj_NullInnerTupleSlot = ExecInitNullTupleSlot(estate, - ExecGetResultType(innerPlanState(hjstate))); + ExecGetResultType(innerPlanState(hjstate))); break; default: elog(ERROR, "unrecognized join type: %d", @@ -618,7 +618,7 @@ ExecHashJoinOuterGetTuple(PlanState *outerNode, econtext->ecxt_outertuple = slot; if (ExecHashGetHashValue(hashtable, econtext, hjstate->hj_OuterHashKeys, - true, /* outer tuple */ + true, /* outer tuple */ HJ_FILL_OUTER(hjstate), hashvalue)) { @@ -687,7 +687,7 @@ ExecHashJoinNewBatch(HashJoinState *hjstate) BufFileClose(hashtable->outerBatchFile[curbatch]); hashtable->outerBatchFile[curbatch] = NULL; } - else /* we just finished the first batch */ + else /* we just finished the first batch */ { /* * Reset some of the skew optimization state variables, since we no @@ -764,7 +764,7 @@ ExecHashJoinNewBatch(HashJoinState *hjstate) if (BufFileSeek(innerFile, 0, 0L, SEEK_SET)) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not rewind hash-join temporary file: %m"))); + errmsg("could not rewind hash-join temporary file: %m"))); while ((slot = ExecHashJoinGetSavedTuple(hjstate, innerFile, @@ -794,7 +794,7 @@ ExecHashJoinNewBatch(HashJoinState *hjstate) if (BufFileSeek(hashtable->outerBatchFile[curbatch], 0, 0L, SEEK_SET)) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not rewind hash-join temporary file: %m"))); + errmsg("could not rewind hash-join temporary file: %m"))); } return true; diff --git a/src/backend/executor/nodeIndexonlyscan.c b/src/backend/executor/nodeIndexonlyscan.c index fb3d3bb121..890e54416a 100644 --- a/src/backend/executor/nodeIndexonlyscan.c +++ b/src/backend/executor/nodeIndexonlyscan.c @@ -542,7 +542,7 @@ ExecInitIndexOnlyScan(IndexOnlyScan *node, EState *estate, int eflags) */ relistarget = ExecRelationIsTargetRelation(estate, node->scan.scanrelid); indexstate->ioss_RelationDesc = index_open(node->indexid, - relistarget ? NoLock : AccessShareLock); + relistarget ? NoLock : AccessShareLock); /* * Initialize index-specific scan state diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index 0fb3fb5e7e..d8aceb1f2c 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -138,7 +138,7 @@ IndexNext(IndexScanState *node) */ ExecStoreTuple(tuple, /* tuple to store */ slot, /* slot to store in */ - scandesc->xs_cbuf, /* buffer containing tuple */ + scandesc->xs_cbuf, /* buffer containing tuple */ false); /* don't pfree */ /* @@ -284,7 +284,7 @@ next_indextuple: */ ExecStoreTuple(tuple, /* tuple to store */ slot, /* slot to store in */ - scandesc->xs_cbuf, /* buffer containing tuple */ + scandesc->xs_cbuf, /* buffer containing tuple */ false); /* don't pfree */ /* @@ -970,7 +970,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags) */ relistarget = ExecRelationIsTargetRelation(estate, node->scan.scanrelid); indexstate->iss_RelationDesc = index_open(node->indexid, - relistarget ? NoLock : AccessShareLock); + relistarget ? NoLock : AccessShareLock); /* * Initialize index-specific scan state @@ -1296,7 +1296,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, flags, varattno, /* attribute number to scan */ op_strategy, /* op's strategy */ - op_righttype, /* strategy subtype */ + op_righttype, /* strategy subtype */ ((OpExpr *) clause)->inputcollid, /* collation */ opfuncid, /* reg proc to use */ scanvalue); /* constant */ @@ -1421,12 +1421,12 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, */ ScanKeyEntryInitialize(this_sub_key, flags, - varattno, /* attribute number */ - op_strategy, /* op's strategy */ + varattno, /* attribute number */ + op_strategy, /* op's strategy */ op_righttype, /* strategy subtype */ inputcollation, /* collation */ - opfuncid, /* reg proc to use */ - scanvalue); /* constant */ + opfuncid, /* reg proc to use */ + scanvalue); /* constant */ n_sub_key++; } @@ -1558,7 +1558,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, flags, varattno, /* attribute number to scan */ op_strategy, /* op's strategy */ - op_righttype, /* strategy subtype */ + op_righttype, /* strategy subtype */ saop->inputcollid, /* collation */ opfuncid, /* reg proc to use */ scanvalue); /* constant */ @@ -1608,7 +1608,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, ScanKeyEntryInitialize(this_scan_key, flags, varattno, /* attribute number to scan */ - InvalidStrategy, /* no strategy */ + InvalidStrategy, /* no strategy */ InvalidOid, /* no strategy subtype */ InvalidOid, /* no collation */ InvalidOid, /* no reg proc for this */ diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c index aaec132218..abd060d75f 100644 --- a/src/backend/executor/nodeLimit.c +++ b/src/backend/executor/nodeLimit.c @@ -248,8 +248,8 @@ recompute_limits(LimitState *node) node->offset = DatumGetInt64(val); if (node->offset < 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE), - errmsg("OFFSET must not be negative"))); + (errcode(ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE), + errmsg("OFFSET must not be negative"))); } } else diff --git a/src/backend/executor/nodeLockRows.c b/src/backend/executor/nodeLockRows.c index 5630eae53d..f519794cf3 100644 --- a/src/backend/executor/nodeLockRows.c +++ b/src/backend/executor/nodeLockRows.c @@ -172,7 +172,7 @@ lnext: break; default: elog(ERROR, "unsupported rowmark type"); - lockmode = LockTupleNoKeyExclusive; /* keep compiler quiet */ + lockmode = LockTupleNoKeyExclusive; /* keep compiler quiet */ break; } diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c index aa5d2529f4..32b7269cda 100644 --- a/src/backend/executor/nodeMaterial.c +++ b/src/backend/executor/nodeMaterial.c @@ -66,7 +66,7 @@ ExecMaterial(MaterialState *node) * Allocate a second read pointer to serve as the mark. We know it * must have index 1, so needn't store that. */ - int ptrno PG_USED_FOR_ASSERTS_ONLY; + int ptrno PG_USED_FOR_ASSERTS_ONLY; ptrno = tuplestore_alloc_read_pointer(tuplestorestate, node->eflags); diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c index 572e9dce94..6a145ee33a 100644 --- a/src/backend/executor/nodeMergejoin.c +++ b/src/backend/executor/nodeMergejoin.c @@ -137,7 +137,7 @@ typedef struct MergeJoinClauseData * stored here. */ SortSupportData ssup; -} MergeJoinClauseData; +} MergeJoinClauseData; /* Result type for MJEvalOuterValues and MJEvalInnerValues */ typedef enum @@ -216,7 +216,7 @@ MJExamineQuals(List *mergeclauses, clause->ssup.ssup_reverse = false; else if (opstrategy == BTGreaterStrategyNumber) clause->ssup.ssup_reverse = true; - else /* planner screwed up */ + else /* planner screwed up */ elog(ERROR, "unsupported mergejoin strategy %d", opstrategy); clause->ssup.ssup_nulls_first = nulls_first; @@ -225,7 +225,7 @@ MJExamineQuals(List *mergeclauses, &op_strategy, &op_lefttype, &op_righttype); - if (op_strategy != BTEqualStrategyNumber) /* should not happen */ + if (op_strategy != BTEqualStrategyNumber) /* should not happen */ elog(ERROR, "cannot merge using non-equality operator %u", qual->opno); @@ -849,7 +849,7 @@ ExecMergeJoin(MergeJoinState *node) */ TupleTableSlot *result; - node->mj_MatchedInner = true; /* do it only once */ + node->mj_MatchedInner = true; /* do it only once */ result = MJFillInner(node); if (result) @@ -951,7 +951,7 @@ ExecMergeJoin(MergeJoinState *node) */ TupleTableSlot *result; - node->mj_MatchedOuter = true; /* do it only once */ + node->mj_MatchedOuter = true; /* do it only once */ result = MJFillOuter(node); if (result) @@ -1212,7 +1212,7 @@ ExecMergeJoin(MergeJoinState *node) */ TupleTableSlot *result; - node->mj_MatchedOuter = true; /* do it only once */ + node->mj_MatchedOuter = true; /* do it only once */ result = MJFillOuter(node); if (result) @@ -1274,7 +1274,7 @@ ExecMergeJoin(MergeJoinState *node) */ TupleTableSlot *result; - node->mj_MatchedInner = true; /* do it only once */ + node->mj_MatchedInner = true; /* do it only once */ result = MJFillInner(node); if (result) @@ -1344,7 +1344,7 @@ ExecMergeJoin(MergeJoinState *node) */ TupleTableSlot *result; - node->mj_MatchedInner = true; /* do it only once */ + node->mj_MatchedInner = true; /* do it only once */ result = MJFillInner(node); if (result) @@ -1390,7 +1390,7 @@ ExecMergeJoin(MergeJoinState *node) */ TupleTableSlot *result; - node->mj_MatchedOuter = true; /* do it only once */ + node->mj_MatchedOuter = true; /* do it only once */ result = MJFillOuter(node); if (result) @@ -1534,14 +1534,14 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags) mergestate->mj_FillInner = false; mergestate->mj_NullInnerTupleSlot = ExecInitNullTupleSlot(estate, - ExecGetResultType(innerPlanState(mergestate))); + ExecGetResultType(innerPlanState(mergestate))); break; case JOIN_RIGHT: mergestate->mj_FillOuter = false; mergestate->mj_FillInner = true; mergestate->mj_NullOuterTupleSlot = ExecInitNullTupleSlot(estate, - ExecGetResultType(outerPlanState(mergestate))); + ExecGetResultType(outerPlanState(mergestate))); /* * Can't handle right or full join with non-constant extra @@ -1558,10 +1558,10 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags) mergestate->mj_FillInner = true; mergestate->mj_NullOuterTupleSlot = ExecInitNullTupleSlot(estate, - ExecGetResultType(outerPlanState(mergestate))); + ExecGetResultType(outerPlanState(mergestate))); mergestate->mj_NullInnerTupleSlot = ExecInitNullTupleSlot(estate, - ExecGetResultType(innerPlanState(mergestate))); + ExecGetResultType(innerPlanState(mergestate))); /* * Can't handle right or full join with non-constant extra diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index bdff68513b..0e1ac0a13d 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -108,7 +108,7 @@ ExecCheckPlanOutput(Relation resultRel, List *targetList) errdetail("Table has type %s at ordinal position %d, but query expects %s.", format_type_be(attr->atttypid), attno, - format_type_be(exprType((Node *) tle->expr))))); + format_type_be(exprType((Node *) tle->expr))))); } else { @@ -129,7 +129,7 @@ ExecCheckPlanOutput(Relation resultRel, List *targetList) if (attno != resultDesc->natts) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("table row type and query-specified row type do not match"), + errmsg("table row type and query-specified row type do not match"), errdetail("Query has too few columns."))); } @@ -212,7 +212,7 @@ ExecCheckHeapTupleVisible(EState *estate, if (!TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(tuple->t_data))) ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), - errmsg("could not serialize access due to concurrent update"))); + errmsg("could not serialize access due to concurrent update"))); } LockBuffer(buffer, BUFFER_LOCK_UNLOCK); } @@ -292,7 +292,7 @@ ExecInsert(ModifyTableState *mtstate, * respectively. */ leaf_part_index = ExecFindPartition(resultRelInfo, - mtstate->mt_partition_dispatch_info, + mtstate->mt_partition_dispatch_info, slot, estate); Assert(leaf_part_index >= 0 && @@ -309,7 +309,7 @@ ExecInsert(ModifyTableState *mtstate, if (resultRelInfo->ri_FdwRoutine) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot route inserted tuples to a foreign table"))); + errmsg("cannot route inserted tuples to a foreign table"))); /* For ExecInsertIndexTuples() to work on the partition's indexes */ estate->es_result_relation_info = resultRelInfo; @@ -529,7 +529,7 @@ ExecInsert(ModifyTableState *mtstate, /* insert index entries for tuple */ recheckIndexes = ExecInsertIndexTuples(slot, &(tuple->t_self), - estate, true, &specConflict, + estate, true, &specConflict, arbiterIndexes); /* adjust the tuple's state accordingly */ @@ -1562,8 +1562,7 @@ ExecModifyTable(ModifyTableState *node) elog(ERROR, "ctid is NULL"); tupleid = (ItemPointer) DatumGetPointer(datum); - tuple_ctid = *tupleid; /* be sure we don't free - * ctid!! */ + tuple_ctid = *tupleid; /* be sure we don't free ctid!! */ tupleid = &tuple_ctid; } @@ -1616,16 +1615,16 @@ ExecModifyTable(ModifyTableState *node) { case CMD_INSERT: slot = ExecInsert(node, slot, planSlot, - node->mt_arbiterindexes, node->mt_onconflict, + node->mt_arbiterindexes, node->mt_onconflict, estate, node->canSetTag); break; case CMD_UPDATE: slot = ExecUpdate(tupleid, oldtuple, slot, planSlot, - &node->mt_epqstate, estate, node->canSetTag); + &node->mt_epqstate, estate, node->canSetTag); break; case CMD_DELETE: slot = ExecDelete(tupleid, oldtuple, planSlot, - &node->mt_epqstate, estate, node->canSetTag); + &node->mt_epqstate, estate, node->canSetTag); break; default: elog(ERROR, "unknown operation"); @@ -1724,7 +1723,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) /* Initialize the usesFdwDirectModify flag */ resultRelInfo->ri_usesFdwDirectModify = bms_is_member(i, - node->fdwDirectModifyPlans); + node->fdwDirectModifyPlans); /* * Verify result relation is a valid target for the current operation @@ -1777,7 +1776,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) root_rti = linitial_int(node->partitioned_rels); root_oid = getrelid(root_rti, estate->es_range_table); - rel = heap_open(root_oid, NoLock); /* locked by InitPlan */ + rel = heap_open(root_oid, NoLock); /* locked by InitPlan */ } else rel = mtstate->resultRelInfo->ri_RelationDesc; @@ -1920,7 +1919,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) resultRelInfo->ri_projectReturning = ExecBuildProjectionInfo(rlist, econtext, slot, &mtstate->ps, - resultRelInfo->ri_RelationDesc->rd_att); + resultRelInfo->ri_RelationDesc->rd_att); resultRelInfo++; } @@ -1944,7 +1943,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) partrel, rel); resultRelInfo->ri_projectReturning = ExecBuildProjectionInfo(rlist, econtext, slot, &mtstate->ps, - resultRelInfo->ri_RelationDesc->rd_att); + resultRelInfo->ri_RelationDesc->rd_att); resultRelInfo++; } } @@ -1994,7 +1993,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) /* create target slot for UPDATE SET projection */ tupDesc = ExecTypeFromTL((List *) node->onConflictSet, - resultRelInfo->ri_RelationDesc->rd_rel->relhasoids); + resultRelInfo->ri_RelationDesc->rd_rel->relhasoids); mtstate->mt_conflproj = ExecInitExtraTupleSlot(mtstate->ps.state); ExecSetSlotDescriptor(mtstate->mt_conflproj, tupDesc); @@ -2103,7 +2102,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags) subplan->targetlist); j = ExecInitJunkFilter(subplan->targetlist, - resultRelInfo->ri_RelationDesc->rd_att->tdhasoid, + resultRelInfo->ri_RelationDesc->rd_att->tdhasoid, ExecInitExtraTupleSlot(estate)); if (operation == CMD_UPDATE || operation == CMD_DELETE) diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c index 67c8269b96..18f3e91484 100644 --- a/src/backend/executor/nodeNestloop.c +++ b/src/backend/executor/nodeNestloop.c @@ -327,7 +327,7 @@ ExecInitNestLoop(NestLoop *node, EState *estate, int eflags) case JOIN_ANTI: nlstate->nl_NullInnerTupleSlot = ExecInitNullTupleSlot(estate, - ExecGetResultType(innerPlanState(nlstate))); + ExecGetResultType(innerPlanState(nlstate))); break; default: elog(ERROR, "unrecognized join type: %d", diff --git a/src/backend/executor/nodeProjectSet.c b/src/backend/executor/nodeProjectSet.c index 2f0a4e647b..01048cc826 100644 --- a/src/backend/executor/nodeProjectSet.c +++ b/src/backend/executor/nodeProjectSet.c @@ -120,7 +120,7 @@ ExecProjectSRF(ProjectSetState *node, bool continuing) { TupleTableSlot *resultSlot = node->ps.ps_ResultTupleSlot; ExprContext *econtext = node->ps.ps_ExprContext; - bool hassrf PG_USED_FOR_ASSERTS_ONLY; + bool hassrf PG_USED_FOR_ASSERTS_ONLY; bool hasresult; int argno; diff --git a/src/backend/executor/nodeSamplescan.c b/src/backend/executor/nodeSamplescan.c index 0247bd2347..b710ef7edf 100644 --- a/src/backend/executor/nodeSamplescan.c +++ b/src/backend/executor/nodeSamplescan.c @@ -120,7 +120,7 @@ InitScanRelation(SampleScanState *node, EState *estate, int eflags) * open that relation and acquire appropriate lock on it. */ currentRelation = ExecOpenScanRelation(estate, - ((SampleScan *) node->ss.ps.plan)->scan.scanrelid, + ((SampleScan *) node->ss.ps.plan)->scan.scanrelid, eflags); node->ss.ss_currentRelation = currentRelation; @@ -307,7 +307,7 @@ tablesample_init(SampleScanState *scanstate) if (isnull) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLESAMPLE_REPEAT), - errmsg("TABLESAMPLE REPEATABLE parameter cannot be null"))); + errmsg("TABLESAMPLE REPEATABLE parameter cannot be null"))); /* * The REPEATABLE parameter has been coerced to float8 by the parser. @@ -415,7 +415,7 @@ tablesample_getnext(SampleScanState *scanstate) else { /* continue from previously returned page/tuple */ - blockno = scan->rs_cblock; /* current page */ + blockno = scan->rs_cblock; /* current page */ } /* diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c index c0e37dcd83..307df87c82 100644 --- a/src/backend/executor/nodeSeqscan.c +++ b/src/backend/executor/nodeSeqscan.c @@ -90,8 +90,8 @@ SeqNext(SeqScanState *node) if (tuple) ExecStoreTuple(tuple, /* tuple to store */ slot, /* slot to store in */ - scandesc->rs_cbuf, /* buffer associated with this - * tuple */ + scandesc->rs_cbuf, /* buffer associated with this + * tuple */ false); /* don't pfree this pointer */ else ExecClearTuple(slot); @@ -145,7 +145,7 @@ InitScanRelation(SeqScanState *node, EState *estate, int eflags) * open that relation and acquire appropriate lock on it. */ currentRelation = ExecOpenScanRelation(estate, - ((SeqScan *) node->ss.ps.plan)->scanrelid, + ((SeqScan *) node->ss.ps.plan)->scanrelid, eflags); node->ss.ss_currentRelation = currentRelation; diff --git a/src/backend/executor/nodeSetOp.c b/src/backend/executor/nodeSetOp.c index 9ae53bb8a7..9c7812e519 100644 --- a/src/backend/executor/nodeSetOp.c +++ b/src/backend/executor/nodeSetOp.c @@ -64,7 +64,7 @@ typedef struct SetOpStatePerGroupData { long numLeft; /* number of left-input dups in group */ long numRight; /* number of right-input dups in group */ -} SetOpStatePerGroupData; +} SetOpStatePerGroupData; static TupleTableSlot *setop_retrieve_direct(SetOpState *setopstate); @@ -263,7 +263,7 @@ setop_retrieve_direct(SetOpState *setopstate) resultTupleSlot, InvalidBuffer, true); - setopstate->grp_firstTuple = NULL; /* don't keep two pointers */ + setopstate->grp_firstTuple = NULL; /* don't keep two pointers */ /* Initialize working state for a new input tuple group */ initialize_counts(pergroup); @@ -333,7 +333,7 @@ setop_fill_hash_table(SetOpState *setopstate) SetOp *node = (SetOp *) setopstate->ps.plan; PlanState *outerPlan; int firstFlag; - bool in_first_rel PG_USED_FOR_ASSERTS_ONLY; + bool in_first_rel PG_USED_FOR_ASSERTS_ONLY; /* * get state info from node diff --git a/src/backend/executor/nodeTableFuncscan.c b/src/backend/executor/nodeTableFuncscan.c index da557ceb6f..bb016ec8f6 100644 --- a/src/backend/executor/nodeTableFuncscan.c +++ b/src/backend/executor/nodeTableFuncscan.c @@ -288,7 +288,7 @@ tfuncFetchRows(TableFuncScanState *tstate, ExprContext *econtext) PG_TRY(); { routine->InitOpaque(tstate, - tstate->ss.ss_ScanTupleSlot->tts_tupleDescriptor->natts); + tstate->ss.ss_ScanTupleSlot->tts_tupleDescriptor->natts); /* * If evaluating the document expression returns NULL, the table @@ -398,9 +398,9 @@ tfuncInitialize(TableFuncScanState *tstate, ExprContext *econtext, Datum doc) if (isnull) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("column filter expression must not be null"), + errmsg("column filter expression must not be null"), errdetail("Filter for column \"%s\" is null.", - NameStr(tupdesc->attrs[colno]->attname)))); + NameStr(tupdesc->attrs[colno]->attname)))); colfilter = TextDatumGetCString(value); } else @@ -460,8 +460,8 @@ tfuncLoadRows(TableFuncScanState *tstate, ExprContext *econtext) values[colno] = routine->GetValue(tstate, colno, - tupdesc->attrs[colno]->atttypid, - tupdesc->attrs[colno]->atttypmod, + tupdesc->attrs[colno]->atttypid, + tupdesc->attrs[colno]->atttypmod, &isnull); /* No value? Evaluate and apply the default, if any */ @@ -479,7 +479,7 @@ tfuncLoadRows(TableFuncScanState *tstate, ExprContext *econtext) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("null is not allowed in column \"%s\"", - NameStr(tupdesc->attrs[colno]->attname)))); + NameStr(tupdesc->attrs[colno]->attname)))); nulls[colno] = isnull; } diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c index 4860ec0f4d..96af2d21d9 100644 --- a/src/backend/executor/nodeTidscan.c +++ b/src/backend/executor/nodeTidscan.c @@ -221,7 +221,7 @@ TidListEval(TidScanState *tidstate) Assert(tidexpr->cexpr); if (execCurrentOf(tidexpr->cexpr, econtext, - RelationGetRelid(tidstate->ss.ss_currentRelation), + RelationGetRelid(tidstate->ss.ss_currentRelation), &cursor_tid)) { if (numTids >= numAllocTids) @@ -382,10 +382,10 @@ TidNext(TidScanState *node) * pointers onto disk pages and were not created with palloc() and * so should not be pfree()'d. */ - ExecStoreTuple(tuple, /* tuple to store */ + ExecStoreTuple(tuple, /* tuple to store */ slot, /* slot to store in */ - buffer, /* buffer associated with tuple */ - false); /* don't pfree */ + buffer, /* buffer associated with tuple */ + false); /* don't pfree */ /* * At this point we have an extra pin on the buffer, because @@ -551,7 +551,7 @@ ExecInitTidScan(TidScan *node, EState *estate, int eflags) currentRelation = ExecOpenScanRelation(estate, node->scan.scanrelid, eflags); tidstate->ss.ss_currentRelation = currentRelation; - tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */ + tidstate->ss.ss_currentScanDesc = NULL; /* no heap scan here */ /* * get the scan type from the relation descriptor. diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c index 124db68b1f..2a0d2c472d 100644 --- a/src/backend/executor/nodeWindowAgg.c +++ b/src/backend/executor/nodeWindowAgg.c @@ -96,7 +96,7 @@ typedef struct WindowStatePerFuncData int aggno; /* if so, index of its PerAggData */ WindowObject winobj; /* object used in window function API */ -} WindowStatePerFuncData; +} WindowStatePerFuncData; /* * For plain aggregate window functions, we also have one of these. @@ -351,7 +351,7 @@ advance_windowaggregate(WindowAggState *winstate, if (fcinfo->isnull && OidIsValid(peraggstate->invtransfn_oid)) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("moving-aggregate transition function must not return null"))); + errmsg("moving-aggregate transition function must not return null"))); /* * We must track the number of rows included in transValue, since to @@ -600,7 +600,7 @@ finalize_windowaggregate(WindowAggState *winstate, perfuncstate->winCollation, (void *) winstate, NULL); fcinfo.arg[0] = MakeExpandedObjectReadOnly(peraggstate->transValue, - peraggstate->transValueIsNull, + peraggstate->transValueIsNull, peraggstate->transtypeLen); fcinfo.argnull[0] = peraggstate->transValueIsNull; anynull = peraggstate->transValueIsNull; @@ -1143,7 +1143,7 @@ begin_partition(WindowAggState *winstate) winobj->markptr = tuplestore_alloc_read_pointer(winstate->buffer, 0); winobj->readptr = tuplestore_alloc_read_pointer(winstate->buffer, - EXEC_FLAG_BACKWARD); + EXEC_FLAG_BACKWARD); winobj->markpos = -1; winobj->seekpos = -1; } @@ -1632,7 +1632,7 @@ ExecWindowAgg(WindowAggState *winstate) if (offset < 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("frame starting offset must not be negative"))); + errmsg("frame starting offset must not be negative"))); } } if (frameOptions & FRAMEOPTION_END_VALUE) @@ -1657,7 +1657,7 @@ ExecWindowAgg(WindowAggState *winstate) if (offset < 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("frame ending offset must not be negative"))); + errmsg("frame ending offset must not be negative"))); } } winstate->all_first = false; @@ -1733,8 +1733,8 @@ ExecWindowAgg(WindowAggState *winstate) if (perfuncstate->plain_agg) continue; eval_windowfunction(winstate, perfuncstate, - &(econtext->ecxt_aggvalues[perfuncstate->wfuncstate->wfuncno]), - &(econtext->ecxt_aggnulls[perfuncstate->wfuncstate->wfuncno])); + &(econtext->ecxt_aggvalues[perfuncstate->wfuncstate->wfuncno]), + &(econtext->ecxt_aggnulls[perfuncstate->wfuncstate->wfuncno])); } /* @@ -1864,7 +1864,7 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags) /* Set up data for comparing tuples */ if (node->partNumCols > 0) winstate->partEqfunctions = execTuplesMatchPrepare(node->partNumCols, - node->partOperators); + node->partOperators); if (node->ordNumCols > 0) winstate->ordEqfunctions = execTuplesMatchPrepare(node->ordNumCols, node->ordOperators); @@ -1896,7 +1896,7 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags) AclResult aclresult; int i; - if (wfunc->winref != node->winref) /* planner screwed up? */ + if (wfunc->winref != node->winref) /* planner screwed up? */ elog(ERROR, "WindowFunc with winref %u assigned to WindowAgg with winref %u", wfunc->winref, node->winref); @@ -2210,7 +2210,7 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc, /* build expression trees using actual argument & result types */ build_aggregate_transfn_expr(inputTypes, numArguments, - 0, /* no ordered-set window functions yet */ + 0, /* no ordered-set window functions yet */ false, /* no variadic window functions yet */ aggtranstype, wfunc->inputcollid, diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c index a9ce846540..a168b63e26 100644 --- a/src/backend/executor/spi.c +++ b/src/backend/executor/spi.c @@ -43,7 +43,7 @@ int SPI_result; static _SPI_connection *_SPI_stack = NULL; static _SPI_connection *_SPI_current = NULL; -static int _SPI_stack_depth = 0; /* allocated size of _SPI_stack */ +static int _SPI_stack_depth = 0; /* allocated size of _SPI_stack */ static int _SPI_connected = -1; /* current stack index */ static Portal SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, @@ -123,7 +123,7 @@ SPI_connect(void) _SPI_current->lastoid = InvalidOid; _SPI_current->tuptable = NULL; slist_init(&_SPI_current->tuptables); - _SPI_current->procCxt = NULL; /* in case we fail to create 'em */ + _SPI_current->procCxt = NULL; /* in case we fail to create 'em */ _SPI_current->execCxt = NULL; _SPI_current->connectSubid = GetCurrentSubTransactionId(); _SPI_current->queryEnv = NULL; @@ -153,7 +153,7 @@ SPI_finish(void) { int res; - res = _SPI_begin_call(false); /* live in procedure memory */ + res = _SPI_begin_call(false); /* live in procedure memory */ if (res < 0) return res; @@ -645,7 +645,7 @@ SPI_saveplan(SPIPlanPtr plan) return NULL; } - SPI_result = _SPI_begin_call(false); /* don't change context */ + SPI_result = _SPI_begin_call(false); /* don't change context */ if (SPI_result < 0) return NULL; @@ -1285,7 +1285,7 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, if (!(portal->cursorOptions & (CURSOR_OPT_SCROLL | CURSOR_OPT_NO_SCROLL))) { if (list_length(stmt_list) == 1 && - linitial_node(PlannedStmt, stmt_list)->commandType != CMD_UTILITY && + linitial_node(PlannedStmt, stmt_list)->commandType != CMD_UTILITY && linitial_node(PlannedStmt, stmt_list)->rowMarks == NIL && ExecSupportsBackwardScan(linitial_node(PlannedStmt, stmt_list)->planTree)) portal->cursorOptions |= CURSOR_OPT_SCROLL; @@ -1301,7 +1301,7 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, if (portal->cursorOptions & CURSOR_OPT_SCROLL) { if (list_length(stmt_list) == 1 && - linitial_node(PlannedStmt, stmt_list)->commandType != CMD_UTILITY && + linitial_node(PlannedStmt, stmt_list)->commandType != CMD_UTILITY && linitial_node(PlannedStmt, stmt_list)->rowMarks != NIL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -1334,8 +1334,8 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /* translator: %s is a SQL statement name */ - errmsg("%s is not allowed in a non-volatile function", - CreateCommandTag((Node *) pstmt)))); + errmsg("%s is not allowed in a non-volatile function", + CreateCommandTag((Node *) pstmt)))); else PreventCommandIfParallelMode(CreateCommandTag((Node *) pstmt)); } @@ -1768,7 +1768,7 @@ spi_printtup(TupleTableSlot *slot, DestReceiver *self) tuptable->free = tuptable->alloced; tuptable->alloced += tuptable->free; tuptable->vals = (HeapTuple *) repalloc_huge(tuptable->vals, - tuptable->alloced * sizeof(HeapTuple)); + tuptable->alloced * sizeof(HeapTuple)); } tuptable->vals[tuptable->alloced - tuptable->free] = @@ -1890,7 +1890,7 @@ _SPI_pgxc_prepare_plan(const char *src, List *src_parsetree, SPIPlanPtr plan) plan->parserSetup, plan->parserSetupArg, plan->cursor_options, - false); /* not fixed result */ + false); /* not fixed result */ plancache_list = lappend(plancache_list, plansource); } @@ -1957,7 +1957,7 @@ _SPI_prepare_oneshot_plan(const char *src, SPIPlanPtr plan) plansource = CreateOneShotCachedPlan(parsetree, src, - CreateCommandTag(parsetree->stmt)); + CreateCommandTag(parsetree->stmt)); plancache_list = lappend(plancache_list, plansource); } @@ -2068,8 +2068,8 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, stmt_list = pg_analyze_and_rewrite_params(parsetree, src, plan->parserSetup, - plan->parserSetupArg, - _SPI_current->queryEnv); + plan->parserSetupArg, + _SPI_current->queryEnv); } else { @@ -2144,8 +2144,8 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /* translator: %s is a SQL statement name */ - errmsg("%s is not allowed in a non-volatile function", - CreateCommandTag((Node *) stmt)))); + errmsg("%s is not allowed in a non-volatile function", + CreateCommandTag((Node *) stmt)))); if (IsInParallelMode() && !CommandIsReadOnly(stmt)) PreventCommandIfParallelMode(CreateCommandTag((Node *) stmt)); @@ -2749,7 +2749,7 @@ SPI_register_relation(EphemeralNamedRelation enr) if (enr == NULL || enr->md.name == NULL) return SPI_ERROR_ARGUMENT; - res = _SPI_begin_call(false); /* keep current memory context */ + res = _SPI_begin_call(false); /* keep current memory context */ if (res < 0) return res; @@ -2783,7 +2783,7 @@ SPI_unregister_relation(const char *name) if (name == NULL) return SPI_ERROR_ARGUMENT; - res = _SPI_begin_call(false); /* keep current memory context */ + res = _SPI_begin_call(false); /* keep current memory context */ if (res < 0) return res; diff --git a/src/backend/executor/tqueue.c b/src/backend/executor/tqueue.c index 8d7e711b3b..a4cfe9685a 100644 --- a/src/backend/executor/tqueue.c +++ b/src/backend/executor/tqueue.c @@ -95,7 +95,7 @@ typedef struct ArrayRemapInfo int16 typlen; /* array element type's storage properties */ bool typbyval; char typalign; - TupleRemapInfo *element_remap; /* array element type's remap info */ + TupleRemapInfo *element_remap; /* array element type's remap info */ } ArrayRemapInfo; typedef struct RangeRemapInfo @@ -113,7 +113,7 @@ typedef struct RecordRemapInfo int32 localtypmod; /* If no fields of the record require remapping, these are NULL: */ TupleDesc tupledesc; /* copy of record's tupdesc */ - TupleRemapInfo **field_remap; /* each field's remap info */ + TupleRemapInfo **field_remap; /* each field's remap info */ } RecordRemapInfo; struct TupleRemapInfo @@ -527,7 +527,7 @@ TQSendRecordInfo(TQueueDestReceiver *tqueue, int32 typmod, TupleDesc tupledesc) ctl.hcxt = tqueue->mycontext; tqueue->recordhtab = hash_create("tqueue sender record type hashtable", 100, &ctl, - HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); + HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); } /* Have we already seen this record type? If not, must report it. */ @@ -865,7 +865,7 @@ TQRemapArray(TupleQueueReader *reader, ArrayRemapInfo *remapinfo, /* Reconstruct and return the array. */ *changed = true; arr = construct_md_array(elem_values, elem_nulls, - ARR_NDIM(arr), ARR_DIMS(arr), ARR_LBOUND(arr), + ARR_NDIM(arr), ARR_DIMS(arr), ARR_LBOUND(arr), typid, remapinfo->typlen, remapinfo->typbyval, remapinfo->typalign); return PointerGetDatum(arr); @@ -1099,7 +1099,7 @@ TupleQueueHandleControlMessage(TupleQueueReader *reader, Size nbytes, ctl.hcxt = reader->mycontext; reader->typmodmap = hash_create("tqueue receiver record type hashtable", 100, &ctl, - HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); + HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); } /* Create map entry. */ diff --git a/src/backend/executor/tstoreReceiver.c b/src/backend/executor/tstoreReceiver.c index 1e641c9837..eda38b1de1 100644 --- a/src/backend/executor/tstoreReceiver.c +++ b/src/backend/executor/tstoreReceiver.c @@ -135,7 +135,7 @@ tstoreReceiveSlot_detoast(TupleTableSlot *slot, DestReceiver *self) if (VARATT_IS_EXTERNAL(DatumGetPointer(val))) { val = PointerGetDatum(heap_tuple_fetch_attr((struct varlena *) - DatumGetPointer(val))); + DatumGetPointer(val))); myState->tofree[nfree++] = val; } } diff --git a/src/backend/lib/binaryheap.c b/src/backend/lib/binaryheap.c index 9f99e77db0..ce4331ccde 100644 --- a/src/backend/lib/binaryheap.c +++ b/src/backend/lib/binaryheap.c @@ -35,7 +35,7 @@ binaryheap_allocate(int capacity, binaryheap_comparator compare, void *arg) int sz; binaryheap *heap; - sz = offsetof(binaryheap, bh_nodes) +sizeof(Datum) * capacity; + sz = offsetof(binaryheap, bh_nodes) + sizeof(Datum) * capacity; heap = (binaryheap *) palloc(sz); heap->bh_space = capacity; heap->bh_compare = compare; diff --git a/src/backend/lib/ilist.c b/src/backend/lib/ilist.c index 720cecb0e7..af8d656d3e 100644 --- a/src/backend/lib/ilist.c +++ b/src/backend/lib/ilist.c @@ -32,7 +32,7 @@ slist_delete(slist_head *head, slist_node *node) { slist_node *last = &head->head; slist_node *cur; - bool found PG_USED_FOR_ASSERTS_ONLY = false; + bool found PG_USED_FOR_ASSERTS_ONLY = false; while ((cur = last->next) != NULL) { @@ -108,4 +108,4 @@ slist_check(slist_head *head) ; } -#endif /* ILIST_DEBUG */ +#endif /* ILIST_DEBUG */ diff --git a/src/backend/lib/pairingheap.c b/src/backend/lib/pairingheap.c index 7c6bd837c6..fd871408f3 100644 --- a/src/backend/lib/pairingheap.c +++ b/src/backend/lib/pairingheap.c @@ -295,7 +295,7 @@ merge_children(pairingheap *heap, pairingheap_node *children) static void pairingheap_dump_recurse(StringInfo buf, pairingheap_node *node, - void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque), + void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque), void *opaque, int depth, pairingheap_node *prev_or_parent) @@ -316,7 +316,7 @@ pairingheap_dump_recurse(StringInfo buf, char * pairingheap_dump(pairingheap *heap, - void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque), + void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque), void *opaque) { StringInfoData buf; diff --git a/src/backend/lib/rbtree.c b/src/backend/lib/rbtree.c index cdf8a73aa5..3d80090a8c 100644 --- a/src/backend/lib/rbtree.c +++ b/src/backend/lib/rbtree.c @@ -429,7 +429,7 @@ rb_insert(RBTree *rb, const RBNode *data, bool *isNew) */ *isNew = true; - x = rb->allocfunc (rb->arg); + x = rb->allocfunc(rb->arg); x->color = RBRED; @@ -624,7 +624,7 @@ rb_delete_node(RBTree *rb, RBNode *z) /* Now we can recycle the y node */ if (rb->freefunc) - rb->freefunc (y, rb->arg); + rb->freefunc(y, rb->arg); } /* @@ -808,7 +808,7 @@ loop: iter->next_step = NextStepLeft; goto loop; } - else /* not moved - return current, then go up */ + else /* not moved - return current, then go up */ iter->next_step = NextStepUp; break; diff --git a/src/backend/libpq/auth-scram.c b/src/backend/libpq/auth-scram.c index a6042b8013..0b69f106f1 100644 --- a/src/backend/libpq/auth-scram.c +++ b/src/backend/libpq/auth-scram.c @@ -674,8 +674,8 @@ read_any_attr(char **input, char *attr_p) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), errmsg("malformed SCRAM message"), - errdetail("Attribute expected, but found invalid character %s.", - sanitize_char(attr)))); + errdetail("Attribute expected, but found invalid character %s.", + sanitize_char(attr)))); if (attr_p) *attr_p = attr; begin++; @@ -1062,7 +1062,7 @@ read_client_final_message(scram_state *state, char *input) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), errmsg("malformed SCRAM message"), - errdetail("Garbage found at the end of client-final-message."))); + errdetail("Garbage found at the end of client-final-message."))); state->client_final_message_without_proof = palloc(proof - begin + 1); memcpy(state->client_final_message_without_proof, input, proof - begin); diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index 081c06a1e6..dd7de7c3a4 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -92,8 +92,8 @@ static int auth_peer(hbaPort *port); #define PGSQL_PAM_SERVICE "postgresql" /* Service name passed to PAM */ static int CheckPAMAuth(Port *port, char *user, char *password); -static int pam_passwd_conv_proc(int num_msg, const struct pam_message ** msg, - struct pam_response ** resp, void *appdata_ptr); +static int pam_passwd_conv_proc(int num_msg, const struct pam_message **msg, + struct pam_response **resp, void *appdata_ptr); static struct pam_conv pam_passw_conv = { &pam_passwd_conv_proc, @@ -103,7 +103,7 @@ static struct pam_conv pam_passw_conv = { static char *pam_passwd = NULL; /* Workaround for Solaris 2.6 brokenness */ static Port *pam_port_cludge; /* Workaround for passing "Port *port" into * pam_passwd_conv_proc */ -#endif /* USE_PAM */ +#endif /* USE_PAM */ /*---------------------------------------------------------------- @@ -114,7 +114,7 @@ static Port *pam_port_cludge; /* Workaround for passing "Port *port" into #include <bsd_auth.h> static int CheckBSDAuth(Port *port, char *user); -#endif /* USE_BSD_AUTH */ +#endif /* USE_BSD_AUTH */ /*---------------------------------------------------------------- @@ -132,16 +132,16 @@ static int CheckBSDAuth(Port *port, char *user); /* Correct header from the Platform SDK */ typedef ULONG (*__ldap_start_tls_sA) ( - IN PLDAP ExternalHandle, - OUT PULONG ServerReturnValue, - OUT LDAPMessage **result, - IN PLDAPControlA * ServerControls, - IN PLDAPControlA * ClientControls + IN PLDAP ExternalHandle, + OUT PULONG ServerReturnValue, + OUT LDAPMessage **result, + IN PLDAPControlA * ServerControls, + IN PLDAPControlA * ClientControls ); #endif static int CheckLDAPAuth(Port *port); -#endif /* USE_LDAP */ +#endif /* USE_LDAP */ /*---------------------------------------------------------------- * Cert authentication @@ -172,7 +172,7 @@ bool pg_krb_caseins_users; #endif static int pg_GSS_recvauth(Port *port); -#endif /* ENABLE_GSS */ +#endif /* ENABLE_GSS */ /*---------------------------------------------------------------- @@ -182,7 +182,7 @@ static int pg_GSS_recvauth(Port *port); #ifdef ENABLE_SSPI typedef SECURITY_STATUS (WINAPI * QUERY_SECURITY_CONTEXT_TOKEN_FN) ( - PCtxtHandle, void **); + PCtxtHandle, void **); static int pg_SSPI_recvauth(Port *port); static int pg_SSPI_make_upn(char *accountname, size_t accountnamesize, @@ -373,7 +373,7 @@ ClientAuthentication(Port *port) if (!port->peer_cert_valid) ereport(FATAL, (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("connection requires a valid client certificate"))); + errmsg("connection requires a valid client certificate"))); } /* @@ -405,32 +405,32 @@ ClientAuthentication(Port *port) { #ifdef USE_SSL ereport(FATAL, - (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("pg_hba.conf rejects replication connection for host \"%s\", user \"%s\", %s", - hostinfo, port->user_name, - port->ssl_in_use ? _("SSL on") : _("SSL off")))); + (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), + errmsg("pg_hba.conf rejects replication connection for host \"%s\", user \"%s\", %s", + hostinfo, port->user_name, + port->ssl_in_use ? _("SSL on") : _("SSL off")))); #else ereport(FATAL, - (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("pg_hba.conf rejects replication connection for host \"%s\", user \"%s\"", - hostinfo, port->user_name))); + (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), + errmsg("pg_hba.conf rejects replication connection for host \"%s\", user \"%s\"", + hostinfo, port->user_name))); #endif } else { #ifdef USE_SSL ereport(FATAL, - (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("pg_hba.conf rejects connection for host \"%s\", user \"%s\", database \"%s\", %s", - hostinfo, port->user_name, - port->database_name, - port->ssl_in_use ? _("SSL on") : _("SSL off")))); + (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), + errmsg("pg_hba.conf rejects connection for host \"%s\", user \"%s\", database \"%s\", %s", + hostinfo, port->user_name, + port->database_name, + port->ssl_in_use ? _("SSL on") : _("SSL off")))); #else ereport(FATAL, - (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("pg_hba.conf rejects connection for host \"%s\", user \"%s\", database \"%s\"", - hostinfo, port->user_name, - port->database_name))); + (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), + errmsg("pg_hba.conf rejects connection for host \"%s\", user \"%s\", database \"%s\"", + hostinfo, port->user_name, + port->database_name))); #endif } break; @@ -479,36 +479,36 @@ ClientAuthentication(Port *port) { #ifdef USE_SSL ereport(FATAL, - (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("no pg_hba.conf entry for replication connection from host \"%s\", user \"%s\", %s", - hostinfo, port->user_name, - port->ssl_in_use ? _("SSL on") : _("SSL off")), - HOSTNAME_LOOKUP_DETAIL(port))); + (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), + errmsg("no pg_hba.conf entry for replication connection from host \"%s\", user \"%s\", %s", + hostinfo, port->user_name, + port->ssl_in_use ? _("SSL on") : _("SSL off")), + HOSTNAME_LOOKUP_DETAIL(port))); #else ereport(FATAL, - (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("no pg_hba.conf entry for replication connection from host \"%s\", user \"%s\"", - hostinfo, port->user_name), - HOSTNAME_LOOKUP_DETAIL(port))); + (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), + errmsg("no pg_hba.conf entry for replication connection from host \"%s\", user \"%s\"", + hostinfo, port->user_name), + HOSTNAME_LOOKUP_DETAIL(port))); #endif } else { #ifdef USE_SSL ereport(FATAL, - (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\", %s", - hostinfo, port->user_name, - port->database_name, - port->ssl_in_use ? _("SSL on") : _("SSL off")), - HOSTNAME_LOOKUP_DETAIL(port))); + (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), + errmsg("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\", %s", + hostinfo, port->user_name, + port->database_name, + port->ssl_in_use ? _("SSL on") : _("SSL off")), + HOSTNAME_LOOKUP_DETAIL(port))); #else ereport(FATAL, - (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\"", - hostinfo, port->user_name, - port->database_name), - HOSTNAME_LOOKUP_DETAIL(port))); + (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), + errmsg("no pg_hba.conf entry for host \"%s\", user \"%s\", database \"%s\"", + hostinfo, port->user_name, + port->database_name), + HOSTNAME_LOOKUP_DETAIL(port))); #endif } break; @@ -558,7 +558,7 @@ ClientAuthentication(Port *port) status = CheckPAMAuth(port, port->user_name, ""); #else Assert(false); -#endif /* USE_PAM */ +#endif /* USE_PAM */ break; case uaBSD: @@ -566,7 +566,7 @@ ClientAuthentication(Port *port) status = CheckBSDAuth(port, port->user_name); #else Assert(false); -#endif /* USE_BSD_AUTH */ +#endif /* USE_BSD_AUTH */ break; case uaLDAP: @@ -658,8 +658,8 @@ recv_password_packet(Port *port) if (mtype != EOF) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("expected password response, got message type %d", - mtype))); + errmsg("expected password response, got message type %d", + mtype))); return NULL; /* EOF or bad message type */ } } @@ -671,7 +671,7 @@ recv_password_packet(Port *port) } initStringInfo(&buf); - if (pq_getmessage(&buf, 1000)) /* receive password */ + if (pq_getmessage(&buf, 1000)) /* receive password */ { /* EOF - pq_getmessage already logged a suitable message */ pfree(buf.data); @@ -1196,7 +1196,7 @@ pg_GSS_recvauth(Port *port) (unsigned int) port->gss->outbuf.length); sendAuthRequest(port, AUTH_REQ_GSS_CONT, - port->gss->outbuf.value, port->gss->outbuf.length); + port->gss->outbuf.value, port->gss->outbuf.length); gss_release_buffer(&lmin_s, &port->gss->outbuf); } @@ -1205,7 +1205,7 @@ pg_GSS_recvauth(Port *port) { gss_delete_sec_context(&lmin_s, &port->gss->ctx, GSS_C_NO_BUFFER); pg_GSS_error(ERROR, - gettext_noop("accepting GSS security context failed"), + gettext_noop("accepting GSS security context failed"), maj_stat, min_stat); } @@ -1264,7 +1264,7 @@ pg_GSS_recvauth(Port *port) { /* GSS realm does not match */ elog(DEBUG2, - "GSSAPI realm (%s) and configured realm (%s) don't match", + "GSSAPI realm (%s) and configured realm (%s) don't match", cp, port->hba->krb_realm); gss_release_buffer(&lmin_s, &gbuf); return STATUS_ERROR; @@ -1287,7 +1287,7 @@ pg_GSS_recvauth(Port *port) return ret; } -#endif /* ENABLE_GSS */ +#endif /* ENABLE_GSS */ /*---------------------------------------------------------------- @@ -1337,6 +1337,7 @@ pg_SSPI_recvauth(Port *port) DWORD domainnamesize = sizeof(domainname); SID_NAME_USE accountnameuse; HMODULE secur32; + QUERY_SECURITY_CONTEXT_TOKEN_FN _QuerySecurityContextToken; /* @@ -1442,7 +1443,7 @@ pg_SSPI_recvauth(Port *port) port->gss->outbuf.value = outbuf.pBuffers[0].pvBuffer; sendAuthRequest(port, AUTH_REQ_GSS_CONT, - port->gss->outbuf.value, port->gss->outbuf.length); + port->gss->outbuf.value, port->gss->outbuf.length); FreeContextBuffer(outbuf.pBuffers[0].pvBuffer); } @@ -1542,16 +1543,16 @@ pg_SSPI_recvauth(Port *port) if (!GetTokenInformation(token, TokenUser, tokenuser, retlen, &retlen)) ereport(ERROR, - (errmsg_internal("could not get token information: error code %lu", - GetLastError()))); + (errmsg_internal("could not get token information: error code %lu", + GetLastError()))); CloseHandle(token); if (!LookupAccountSid(NULL, tokenuser->User.Sid, accountname, &accountnamesize, domainname, &domainnamesize, &accountnameuse)) ereport(ERROR, - (errmsg_internal("could not look up account SID: error code %lu", - GetLastError()))); + (errmsg_internal("could not look up account SID: error code %lu", + GetLastError()))); free(tokenuser); @@ -1695,7 +1696,7 @@ pg_SSPI_make_upn(char *accountname, pfree(upname); return STATUS_OK; } -#endif /* ENABLE_SSPI */ +#endif /* ENABLE_SSPI */ @@ -1714,7 +1715,7 @@ static bool interpret_ident_response(const char *ident_response, char *ident_user) { - const char *cursor = ident_response; /* Cursor into *ident_response */ + const char *cursor = ident_response; /* Cursor into *ident_response */ /* * Ident's response, in the telnet tradition, should end in crlf (\r\n). @@ -1768,7 +1769,7 @@ interpret_ident_response(const char *ident_response, { int i; /* Index into *ident_user */ - cursor++; /* Go over colon */ + cursor++; /* Go over colon */ while (pg_isblank(*cursor)) cursor++; /* skip blanks */ /* Rest of line is user name. Copy it over. */ @@ -1804,7 +1805,7 @@ ident_inet(hbaPort *port) const SockAddr remote_addr = port->raddr; const SockAddr local_addr = port->laddr; char ident_user[IDENT_USERNAME_MAX + 1]; - pgsocket sock_fd = PGINVALID_SOCKET; /* for talking to Ident server */ + pgsocket sock_fd = PGINVALID_SOCKET; /* for talking to Ident server */ int rc; /* Return code from a locally called function */ bool ident_return; char remote_addr_s[NI_MAXHOST]; @@ -1946,8 +1947,8 @@ ident_inet(hbaPort *port) ident_return = interpret_ident_response(ident_response, ident_user); if (!ident_return) ereport(LOG, - (errmsg("invalidly formatted response from Ident server: \"%s\"", - ident_response))); + (errmsg("invalidly formatted response from Ident server: \"%s\"", + ident_response))); ident_inet_done: if (sock_fd != PGINVALID_SOCKET) @@ -1986,7 +1987,7 @@ auth_peer(hbaPort *port) if (errno == ENOSYS) ereport(LOG, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("peer authentication is not supported on this platform"))); + errmsg("peer authentication is not supported on this platform"))); else ereport(LOG, (errcode_for_socket_access(), @@ -2009,7 +2010,7 @@ auth_peer(hbaPort *port) return check_usermap(port->hba->usermap, port->user_name, ident_user, false); } -#endif /* HAVE_UNIX_SOCKETS */ +#endif /* HAVE_UNIX_SOCKETS */ /*---------------------------------------------------------------- @@ -2023,8 +2024,8 @@ auth_peer(hbaPort *port) */ static int -pam_passwd_conv_proc(int num_msg, const struct pam_message ** msg, - struct pam_response ** resp, void *appdata_ptr) +pam_passwd_conv_proc(int num_msg, const struct pam_message **msg, + struct pam_response **resp, void *appdata_ptr) { char *passwd; struct pam_response *reply; @@ -2083,7 +2084,7 @@ pam_passwd_conv_proc(int num_msg, const struct pam_message ** msg, if (strlen(passwd) == 0) { ereport(LOG, - (errmsg("empty password returned by client"))); + (errmsg("empty password returned by client"))); goto fail; } } @@ -2138,7 +2139,7 @@ CheckPAMAuth(Port *port, char *user, char *password) retval = pg_getnameinfo_all(&port->raddr.addr, port->raddr.salen, hostinfo, sizeof(hostinfo), NULL, 0, - port->hba->pam_use_hostname ? 0 : NI_NUMERICHOST | NI_NUMERICSERV); + port->hba->pam_use_hostname ? 0 : NI_NUMERICHOST | NI_NUMERICSERV); if (retval != 0) { ereport(WARNING, @@ -2160,8 +2161,8 @@ CheckPAMAuth(Port *port, char *user, char *password) * later used inside the PAM conversation to pass the password to the * authentication module. */ - pam_passw_conv.appdata_ptr = (char *) password; /* from password above, - * not allocated */ + pam_passw_conv.appdata_ptr = (char *) password; /* from password above, + * not allocated */ /* Optionally, one can set the service name in pg_hba.conf */ if (port->hba->pamservice && port->hba->pamservice[0] != '\0') @@ -2248,7 +2249,7 @@ CheckPAMAuth(Port *port, char *user, char *password) return (retval == PAM_SUCCESS ? STATUS_OK : STATUS_ERROR); } -#endif /* USE_PAM */ +#endif /* USE_PAM */ /*---------------------------------------------------------------- @@ -2281,7 +2282,7 @@ CheckBSDAuth(Port *port, char *user) return STATUS_OK; } -#endif /* USE_BSD_AUTH */ +#endif /* USE_BSD_AUTH */ /*---------------------------------------------------------------- @@ -2456,8 +2457,8 @@ CheckLDAPAuth(Port *port) * searching. If none is specified, this turns into an anonymous bind. */ r = ldap_simple_bind_s(ldap, - port->hba->ldapbinddn ? port->hba->ldapbinddn : "", - port->hba->ldapbindpasswd ? port->hba->ldapbindpasswd : ""); + port->hba->ldapbinddn ? port->hba->ldapbinddn : "", + port->hba->ldapbindpasswd ? port->hba->ldapbindpasswd : ""); if (r != LDAP_SUCCESS) { ereport(LOG, @@ -2486,7 +2487,7 @@ CheckLDAPAuth(Port *port) { ereport(LOG, (errmsg("could not search LDAP for filter \"%s\" on server \"%s\": %s", - filter, port->hba->ldapserver, ldap_err2string(r)))); + filter, port->hba->ldapserver, ldap_err2string(r)))); pfree(filter); return STATUS_ERROR; } @@ -2496,16 +2497,16 @@ CheckLDAPAuth(Port *port) { if (count == 0) ereport(LOG, - (errmsg("LDAP user \"%s\" does not exist", port->user_name), - errdetail("LDAP search for filter \"%s\" on server \"%s\" returned no entries.", - filter, port->hba->ldapserver))); + (errmsg("LDAP user \"%s\" does not exist", port->user_name), + errdetail("LDAP search for filter \"%s\" on server \"%s\" returned no entries.", + filter, port->hba->ldapserver))); else ereport(LOG, - (errmsg("LDAP user \"%s\" is not unique", port->user_name), - errdetail_plural("LDAP search for filter \"%s\" on server \"%s\" returned %d entry.", - "LDAP search for filter \"%s\" on server \"%s\" returned %d entries.", - count, - filter, port->hba->ldapserver, count))); + (errmsg("LDAP user \"%s\" is not unique", port->user_name), + errdetail_plural("LDAP search for filter \"%s\" on server \"%s\" returned %d entry.", + "LDAP search for filter \"%s\" on server \"%s\" returned %d entries.", + count, + filter, port->hba->ldapserver, count))); pfree(filter); ldap_msgfree(search_message); @@ -2521,7 +2522,7 @@ CheckLDAPAuth(Port *port) (void) ldap_get_option(ldap, LDAP_OPT_ERROR_NUMBER, &error); ereport(LOG, (errmsg("could not get dn for the first entry matching \"%s\" on server \"%s\": %s", - filter, port->hba->ldapserver, ldap_err2string(error)))); + filter, port->hba->ldapserver, ldap_err2string(error)))); pfree(filter); ldap_msgfree(search_message); return STATUS_ERROR; @@ -2541,7 +2542,7 @@ CheckLDAPAuth(Port *port) (void) ldap_get_option(ldap, LDAP_OPT_ERROR_NUMBER, &error); ereport(LOG, (errmsg("could not unbind after searching for user \"%s\" on server \"%s\": %s", - fulluser, port->hba->ldapserver, ldap_err2string(error)))); + fulluser, port->hba->ldapserver, ldap_err2string(error)))); pfree(fulluser); return STATUS_ERROR; } @@ -2560,9 +2561,9 @@ CheckLDAPAuth(Port *port) } else fulluser = psprintf("%s%s%s", - port->hba->ldapprefix ? port->hba->ldapprefix : "", + port->hba->ldapprefix ? port->hba->ldapprefix : "", port->user_name, - port->hba->ldapsuffix ? port->hba->ldapsuffix : ""); + port->hba->ldapsuffix ? port->hba->ldapsuffix : ""); r = ldap_simple_bind_s(ldap, fulluser, passwd); ldap_unbind(ldap); @@ -2570,8 +2571,8 @@ CheckLDAPAuth(Port *port) if (r != LDAP_SUCCESS) { ereport(LOG, - (errmsg("LDAP login failed for user \"%s\" on server \"%s\": %s", - fulluser, port->hba->ldapserver, ldap_err2string(r)))); + (errmsg("LDAP login failed for user \"%s\" on server \"%s\": %s", + fulluser, port->hba->ldapserver, ldap_err2string(r)))); pfree(fulluser); return STATUS_ERROR; } @@ -2580,7 +2581,7 @@ CheckLDAPAuth(Port *port) return STATUS_OK; } -#endif /* USE_LDAP */ +#endif /* USE_LDAP */ /*---------------------------------------------------------------- @@ -2743,8 +2744,8 @@ CheckRADIUSAuth(Port *port) { int ret = PerformRadiusTransaction(lfirst(server), lfirst(secrets), - radiusports ? lfirst(radiusports) : NULL, - identifiers ? lfirst(identifiers) : NULL, + radiusports ? lfirst(radiusports) : NULL, + identifiers ? lfirst(identifiers) : NULL, port->user_name, passwd); @@ -2919,7 +2920,7 @@ PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identi addrsize = sizeof(struct sockaddr_in); #endif - if (bind(sock, (struct sockaddr *) & localaddr, addrsize)) + if (bind(sock, (struct sockaddr *) &localaddr, addrsize)) { ereport(LOG, (errmsg("could not bind local RADIUS socket: %m"))); @@ -3010,7 +3011,7 @@ PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identi addrsize = sizeof(remoteaddr); packetlength = recvfrom(sock, receive_buffer, RADIUS_BUFFER_SIZE, 0, - (struct sockaddr *) & remoteaddr, &addrsize); + (struct sockaddr *) &remoteaddr, &addrsize); if (packetlength < 0) { ereport(LOG, @@ -3048,7 +3049,7 @@ PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identi { ereport(LOG, (errmsg("RADIUS response from %s has corrupt length: %d (actual length %d)", - server, ntohs(receivepacket->length), packetlength))); + server, ntohs(receivepacket->length), packetlength))); continue; } @@ -3070,8 +3071,8 @@ PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identi memcpy(cryptvector + 4, packet->vector, RADIUS_VECTOR_LENGTH); /* request * authenticator, from * original packet */ - if (packetlength > RADIUS_HEADER_LENGTH) /* there may be no - * attributes at all */ + if (packetlength > RADIUS_HEADER_LENGTH) /* there may be no + * attributes at all */ memcpy(cryptvector + RADIUS_HEADER_LENGTH, receive_buffer + RADIUS_HEADER_LENGTH, packetlength - RADIUS_HEADER_LENGTH); memcpy(cryptvector + packetlength, secret, strlen(secret)); @@ -3080,7 +3081,7 @@ PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identi encryptedpassword)) { ereport(LOG, - (errmsg("could not perform MD5 encryption of received packet"))); + (errmsg("could not perform MD5 encryption of received packet"))); pfree(cryptvector); continue; } @@ -3089,8 +3090,8 @@ PerformRadiusTransaction(char *server, char *secret, char *portstr, char *identi if (memcmp(receivepacket->vector, encryptedpassword, RADIUS_VECTOR_LENGTH) != 0) { ereport(LOG, - (errmsg("RADIUS response from %s has incorrect MD5 signature", - server))); + (errmsg("RADIUS response from %s has incorrect MD5 signature", + server))); continue; } diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c index 4773b18df9..554977f190 100644 --- a/src/backend/libpq/be-fsstubs.c +++ b/src/backend/libpq/be-fsstubs.c @@ -228,8 +228,8 @@ lo_write(int fd, const char *buf, int len) if ((lobj->flags & IFS_WRLOCK) == 0) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("large object descriptor %d was not opened for writing", - fd))); + errmsg("large object descriptor %d was not opened for writing", + fd))); /* Permission checks --- first time through only */ if ((lobj->flags & IFS_WR_PERM_OK) == 0) @@ -270,8 +270,8 @@ be_lo_lseek(PG_FUNCTION_ARGS) if (status != (int32) status) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("lo_lseek result out of range for large-object descriptor %d", - fd))); + errmsg("lo_lseek result out of range for large-object descriptor %d", + fd))); PG_RETURN_INT32((int32) status); } @@ -371,8 +371,8 @@ be_lo_tell(PG_FUNCTION_ARGS) if (offset != (int32) offset) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("lo_tell result out of range for large-object descriptor %d", - fd))); + errmsg("lo_tell result out of range for large-object descriptor %d", + fd))); PG_RETURN_INT32((int32) offset); } @@ -688,8 +688,8 @@ lo_truncate_internal(int32 fd, int64 len) if ((lobj->flags & IFS_WRLOCK) == 0) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("large object descriptor %d was not opened for writing", - fd))); + errmsg("large object descriptor %d was not opened for writing", + fd))); /* Permission checks --- first time through only */ if ((lobj->flags & IFS_WR_PERM_OK) == 0) @@ -870,7 +870,7 @@ lo_get_fragment_internal(Oid loOid, int64 offset, int32 nbytes) LargeObjectDesc *loDesc; int64 loSize; int64 result_length; - int total_read PG_USED_FOR_ASSERTS_ONLY; + int total_read PG_USED_FOR_ASSERTS_ONLY; bytea *result = NULL; /* @@ -900,7 +900,7 @@ lo_get_fragment_internal(Oid loOid, int64 offset, int32 nbytes) if (loSize > offset) { if (nbytes >= 0 && nbytes <= loSize - offset) - result_length = nbytes; /* request is wholly inside LO */ + result_length = nbytes; /* request is wholly inside LO */ else result_length = loSize - offset; /* adjust to end of LO */ } @@ -986,7 +986,7 @@ be_lo_from_bytea(PG_FUNCTION_ARGS) Oid loOid = PG_GETARG_OID(0); bytea *str = PG_GETARG_BYTEA_PP(1); LargeObjectDesc *loDesc; - int written PG_USED_FOR_ASSERTS_ONLY; + int written PG_USED_FOR_ASSERTS_ONLY; #ifdef PGXC ereport(ERROR, @@ -1016,7 +1016,7 @@ be_lo_put(PG_FUNCTION_ARGS) int64 offset = PG_GETARG_INT64(1); bytea *str = PG_GETARG_BYTEA_PP(2); LargeObjectDesc *loDesc; - int written PG_USED_FOR_ASSERTS_ONLY; + int written PG_USED_FOR_ASSERTS_ONLY; #ifdef PGXC ereport(ERROR, diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-secure-openssl.c index 44c84a7869..036d58a24e 100644 --- a/src/backend/libpq/be-secure-openssl.c +++ b/src/backend/libpq/be-secure-openssl.c @@ -372,12 +372,12 @@ be_tls_init(bool isServerStart) /* OpenSSL 0.96 does not support X509_V_FLAG_CRL_CHECK */ #ifdef X509_V_FLAG_CRL_CHECK X509_STORE_set_flags(cvstore, - X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); + X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); #else ereport(LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("SSL certificate revocation list file \"%s\" ignored", - ssl_crl_file), + errmsg("SSL certificate revocation list file \"%s\" ignored", + ssl_crl_file), errdetail("SSL library does not support certificate revocation lists."))); #endif } @@ -386,7 +386,7 @@ be_tls_init(bool isServerStart) ereport(isServerStart ? FATAL : LOG, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("could not load SSL certificate revocation list file \"%s\": %s", - ssl_crl_file, SSLerrmessage(ERR_get_error())))); + ssl_crl_file, SSLerrmessage(ERR_get_error())))); goto error; } } @@ -541,7 +541,7 @@ aloop: else ereport(COMMERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("could not accept SSL connection: EOF detected"))); + errmsg("could not accept SSL connection: EOF detected"))); break; case SSL_ERROR_SSL: ereport(COMMERROR, @@ -552,7 +552,7 @@ aloop: case SSL_ERROR_ZERO_RETURN: ereport(COMMERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("could not accept SSL connection: EOF detected"))); + errmsg("could not accept SSL connection: EOF detected"))); break; default: ereport(COMMERROR, @@ -853,7 +853,7 @@ my_BIO_s_socket(void) !BIO_meth_set_puts(my_bio_methods, BIO_meth_get_puts(biom)) || !BIO_meth_set_ctrl(my_bio_methods, BIO_meth_get_ctrl(biom)) || !BIO_meth_set_create(my_bio_methods, BIO_meth_get_create(biom)) || - !BIO_meth_set_destroy(my_bio_methods, BIO_meth_get_destroy(biom)) || + !BIO_meth_set_destroy(my_bio_methods, BIO_meth_get_destroy(biom)) || !BIO_meth_set_callback_ctrl(my_bio_methods, BIO_meth_get_callback_ctrl(biom))) { BIO_meth_free(my_bio_methods); diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 823880ebff..42afead9fd 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -232,8 +232,8 @@ next_token(char **lineptr, char *buf, int bufsz, *buf = '\0'; ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("authentication file token too long, skipping: \"%s\"", - start_buf))); + errmsg("authentication file token too long, skipping: \"%s\"", + start_buf))); *err_msg = "authentication file token too long"; /* Discard remainder of line */ while ((c = (*(*lineptr)++)) != '\0') @@ -646,7 +646,7 @@ check_db(const char *dbname, const char *role, Oid roleid, List *tokens) } static bool -ipv4eq(struct sockaddr_in * a, struct sockaddr_in * b) +ipv4eq(struct sockaddr_in *a, struct sockaddr_in *b) { return (a->sin_addr.s_addr == b->sin_addr.s_addr); } @@ -654,7 +654,7 @@ ipv4eq(struct sockaddr_in * a, struct sockaddr_in * b) #ifdef HAVE_IPV6 static bool -ipv6eq(struct sockaddr_in6 * a, struct sockaddr_in6 * b) +ipv6eq(struct sockaddr_in6 *a, struct sockaddr_in6 *b) { int i; @@ -664,7 +664,7 @@ ipv6eq(struct sockaddr_in6 * a, struct sockaddr_in6 * b) return true; } -#endif /* HAVE_IPV6 */ +#endif /* HAVE_IPV6 */ /* * Check whether host name matches pattern. @@ -747,7 +747,7 @@ check_hostname(hbaPort *port, const char *hostname) if (gai->ai_addr->sa_family == AF_INET) { if (ipv4eq((struct sockaddr_in *) gai->ai_addr, - (struct sockaddr_in *) & port->raddr.addr)) + (struct sockaddr_in *) &port->raddr.addr)) { found = true; break; @@ -757,7 +757,7 @@ check_hostname(hbaPort *port, const char *hostname) else if (gai->ai_addr->sa_family == AF_INET6) { if (ipv6eq((struct sockaddr_in6 *) gai->ai_addr, - (struct sockaddr_in6 *) & port->raddr.addr)) + (struct sockaddr_in6 *) &port->raddr.addr)) { found = true; break; @@ -783,7 +783,7 @@ check_hostname(hbaPort *port, const char *hostname) * Check to see if a connecting IP matches the given address and netmask. */ static bool -check_ip(SockAddr *raddr, struct sockaddr * addr, struct sockaddr * mask) +check_ip(SockAddr *raddr, struct sockaddr *addr, struct sockaddr *mask) { if (raddr->addr.ss_family == addr->sa_family && pg_range_sockaddr(&raddr->addr, @@ -797,7 +797,7 @@ check_ip(SockAddr *raddr, struct sockaddr * addr, struct sockaddr * mask) * pg_foreach_ifaddr callback: does client addr match this machine interface? */ static void -check_network_callback(struct sockaddr * addr, struct sockaddr * netmask, +check_network_callback(struct sockaddr *addr, struct sockaddr *netmask, void *cb_data) { check_network_data *cn = (check_network_data *) cb_data; @@ -811,7 +811,7 @@ check_network_callback(struct sockaddr * addr, struct sockaddr * netmask, { /* Make an all-ones netmask of appropriate length for family */ pg_sockaddr_cidr_mask(&mask, NULL, addr->sa_family); - cn->result = check_ip(cn->raddr, addr, (struct sockaddr *) & mask); + cn->result = check_ip(cn->raddr, addr, (struct sockaddr *) &mask); } else { @@ -1006,7 +1006,7 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) { ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("hostssl record cannot match because SSL is disabled"), + errmsg("hostssl record cannot match because SSL is disabled"), errhint("Set ssl = on in postgresql.conf."), errcontext("line %d of configuration file \"%s\"", line_num, HbaFileName))); @@ -1016,13 +1016,13 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("hostssl record cannot match because SSL is not supported by this build"), - errhint("Compile with --with-openssl to use SSL connections."), + errhint("Compile with --with-openssl to use SSL connections."), errcontext("line %d of configuration file \"%s\"", line_num, HbaFileName))); *err_msg = "hostssl record cannot match because SSL is not supported by this build"; #endif } - else if (token->string[4] == 'n') /* "hostnossl" */ + else if (token->string[4] == 'n') /* "hostnossl" */ { parsedline->conntype = ctHostNoSSL; } @@ -1181,8 +1181,8 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("specifying both host name and CIDR mask is invalid: \"%s\"", token->string), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); *err_msg = psprintf("specifying both host name and CIDR mask is invalid: \"%s\"", token->string); return NULL; @@ -1195,8 +1195,8 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("invalid CIDR mask in address \"%s\"", token->string), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); *err_msg = psprintf("invalid CIDR mask in address \"%s\"", token->string); return NULL; @@ -1212,10 +1212,10 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) { ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("end-of-line before netmask specification"), + errmsg("end-of-line before netmask specification"), errhint("Specify an address range in CIDR notation, or provide a separate netmask."), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); *err_msg = "end-of-line before netmask specification"; return NULL; } @@ -1225,8 +1225,8 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("multiple values specified for netmask"), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); *err_msg = "multiple values specified for netmask"; return NULL; } @@ -1240,8 +1240,8 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("invalid IP mask \"%s\": %s", token->string, gai_strerror(ret)), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); *err_msg = psprintf("invalid IP mask \"%s\": %s", token->string, gai_strerror(ret)); if (gai_result) @@ -1258,8 +1258,8 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), errmsg("IP address and mask do not match"), - errcontext("line %d of configuration file \"%s\"", - line_num, HbaFileName))); + errcontext("line %d of configuration file \"%s\"", + line_num, HbaFileName))); *err_msg = "IP address and mask do not match"; return NULL; } @@ -1398,7 +1398,7 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) { ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("gssapi authentication is not supported on local sockets"), + errmsg("gssapi authentication is not supported on local sockets"), errcontext("line %d of configuration file \"%s\"", line_num, HbaFileName))); *err_msg = "gssapi authentication is not supported on local sockets"; @@ -1410,7 +1410,7 @@ parse_hba_line(TokenizedLine *tok_line, int elevel) { ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("peer authentication is only supported on local sockets"), + errmsg("peer authentication is only supported on local sockets"), errcontext("line %d of configuration file \"%s\"", line_num, HbaFileName))); *err_msg = "peer authentication is only supported on local sockets"; @@ -1651,7 +1651,7 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, { ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("clientcert can only be configured for \"hostssl\" rows"), + errmsg("clientcert can only be configured for \"hostssl\" rows"), errcontext("line %d of configuration file \"%s\"", line_num, HbaFileName))); *err_msg = "clientcert can only be configured for \"hostssl\" rows"; @@ -1714,7 +1714,7 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, { ereport(elevel, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("unsupported LDAP URL scheme: %s", urldata->lud_scheme))); + errmsg("unsupported LDAP URL scheme: %s", urldata->lud_scheme))); *err_msg = psprintf("unsupported LDAP URL scheme: %s", urldata->lud_scheme); ldap_free_urldesc(urldata); @@ -1726,7 +1726,7 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, hbaline->ldapbasedn = pstrdup(urldata->lud_dn); if (urldata->lud_attrs) - hbaline->ldapsearchattribute = pstrdup(urldata->lud_attrs[0]); /* only use first one */ + hbaline->ldapsearchattribute = pstrdup(urldata->lud_attrs[0]); /* only use first one */ hbaline->ldapscope = urldata->lud_scope; if (urldata->lud_filter) { @@ -1743,7 +1743,7 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("LDAP URLs not supported on this platform"))); *err_msg = "LDAP URLs not supported on this platform"; -#endif /* not OpenLDAP */ +#endif /* not OpenLDAP */ } else if (strcmp(name, "ldaptls") == 0) { @@ -2041,8 +2041,8 @@ check_hba(hbaPort *port) else { if (!check_ip(&port->raddr, - (struct sockaddr *) & hba->addr, - (struct sockaddr *) & hba->mask)) + (struct sockaddr *) &hba->addr, + (struct sockaddr *) &hba->mask)) continue; } break; @@ -2723,8 +2723,8 @@ check_ident_usermap(IdentLine *identLine, const char *usermap_name, pg_regerror(r, &identLine->re, errstr, sizeof(errstr)); ereport(LOG, (errcode(ERRCODE_INVALID_REGULAR_EXPRESSION), - errmsg("regular expression match for \"%s\" failed: %s", - identLine->ident_user + 1, errstr))); + errmsg("regular expression match for \"%s\" failed: %s", + identLine->ident_user + 1, errstr))); *error_p = true; } @@ -2743,7 +2743,7 @@ check_ident_usermap(IdentLine *identLine, const char *usermap_name, ereport(LOG, (errcode(ERRCODE_INVALID_REGULAR_EXPRESSION), errmsg("regular expression \"%s\" has no subexpressions as requested by backreference in \"%s\"", - identLine->ident_user + 1, identLine->pg_role))); + identLine->ident_user + 1, identLine->pg_role))); *error_p = true; return; } diff --git a/src/backend/libpq/ifaddr.c b/src/backend/libpq/ifaddr.c index 10643978c7..53bf6bcd80 100644 --- a/src/backend/libpq/ifaddr.c +++ b/src/backend/libpq/ifaddr.c @@ -32,14 +32,14 @@ #include "libpq/ifaddr.h" -static int range_sockaddr_AF_INET(const struct sockaddr_in * addr, - const struct sockaddr_in * netaddr, - const struct sockaddr_in * netmask); +static int range_sockaddr_AF_INET(const struct sockaddr_in *addr, + const struct sockaddr_in *netaddr, + const struct sockaddr_in *netmask); #ifdef HAVE_IPV6 -static int range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr, - const struct sockaddr_in6 * netaddr, - const struct sockaddr_in6 * netmask); +static int range_sockaddr_AF_INET6(const struct sockaddr_in6 *addr, + const struct sockaddr_in6 *netaddr, + const struct sockaddr_in6 *netmask); #endif @@ -50,9 +50,9 @@ static int range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr, * in the same address family; and AF_UNIX addresses are not supported. */ int -pg_range_sockaddr(const struct sockaddr_storage * addr, - const struct sockaddr_storage * netaddr, - const struct sockaddr_storage * netmask) +pg_range_sockaddr(const struct sockaddr_storage *addr, + const struct sockaddr_storage *netaddr, + const struct sockaddr_storage *netmask) { if (addr->ss_family == AF_INET) return range_sockaddr_AF_INET((const struct sockaddr_in *) addr, @@ -69,9 +69,9 @@ pg_range_sockaddr(const struct sockaddr_storage * addr, } static int -range_sockaddr_AF_INET(const struct sockaddr_in * addr, - const struct sockaddr_in * netaddr, - const struct sockaddr_in * netmask) +range_sockaddr_AF_INET(const struct sockaddr_in *addr, + const struct sockaddr_in *netaddr, + const struct sockaddr_in *netmask) { if (((addr->sin_addr.s_addr ^ netaddr->sin_addr.s_addr) & netmask->sin_addr.s_addr) == 0) @@ -84,9 +84,9 @@ range_sockaddr_AF_INET(const struct sockaddr_in * addr, #ifdef HAVE_IPV6 static int -range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr, - const struct sockaddr_in6 * netaddr, - const struct sockaddr_in6 * netmask) +range_sockaddr_AF_INET6(const struct sockaddr_in6 *addr, + const struct sockaddr_in6 *netaddr, + const struct sockaddr_in6 *netmask) { int i; @@ -99,7 +99,7 @@ range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr, return 1; } -#endif /* HAVE_IPV6 */ +#endif /* HAVE_IPV6 */ /* * pg_sockaddr_cidr_mask - make a network mask of the appropriate family @@ -112,7 +112,7 @@ range_sockaddr_AF_INET6(const struct sockaddr_in6 * addr, * Return value is 0 if okay, -1 if not. */ int -pg_sockaddr_cidr_mask(struct sockaddr_storage * mask, char *numbits, int family) +pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, char *numbits, int family) { long bits; char *endptr; @@ -190,7 +190,7 @@ pg_sockaddr_cidr_mask(struct sockaddr_storage * mask, char *numbits, int family) */ static void run_ifaddr_callback(PgIfAddrCallback callback, void *cb_data, - struct sockaddr * addr, struct sockaddr * mask) + struct sockaddr *addr, struct sockaddr *mask) { struct sockaddr_storage fullmask; @@ -222,7 +222,7 @@ run_ifaddr_callback(PgIfAddrCallback callback, void *cb_data, if (!mask) { pg_sockaddr_cidr_mask(&fullmask, NULL, addr->sa_family); - mask = (struct sockaddr *) & fullmask; + mask = (struct sockaddr *) &fullmask; } (*callback) (addr, mask, cb_data); @@ -284,8 +284,8 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) for (i = 0; i < length / sizeof(INTERFACE_INFO); ++i) run_ifaddr_callback(callback, cb_data, - (struct sockaddr *) & ii[i].iiAddress, - (struct sockaddr *) & ii[i].iiNetmask); + (struct sockaddr *) &ii[i].iiAddress, + (struct sockaddr *) &ii[i].iiNetmask); closesocket(sock); free(ii); @@ -425,7 +425,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) lifr = lifc.lifc_req; for (i = 0; i < total; ++i) { - addr = (struct sockaddr *) & lifr[i].lifr_addr; + addr = (struct sockaddr *) &lifr[i].lifr_addr; memcpy(&lmask, &lifr[i], sizeof(struct lifreq)); #ifdef HAVE_IPV6 fd = (addr->sa_family == AF_INET6) ? sock6 : sock; @@ -435,7 +435,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) if (ioctl(fd, SIOCGLIFNETMASK, &lmask) < 0) mask = NULL; else - mask = (struct sockaddr *) & lmask.lifr_addr; + mask = (struct sockaddr *) &lmask.lifr_addr; run_ifaddr_callback(callback, cb_data, addr, mask); } @@ -471,7 +471,7 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) #define _SIZEOF_ADDR_IFREQ(ifr) \ sizeof (struct ifreq) #endif -#endif /* !_SIZEOF_ADDR_IFREQ */ +#endif /* !_SIZEOF_ADDR_IFREQ */ /* * Enumerate the system's network interface addresses and call the callback @@ -572,8 +572,8 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) memset(&mask, 0, sizeof(mask)); pg_sockaddr_cidr_mask(&mask, "8", AF_INET); run_ifaddr_callback(callback, cb_data, - (struct sockaddr *) & addr, - (struct sockaddr *) & mask); + (struct sockaddr *) &addr, + (struct sockaddr *) &mask); #ifdef HAVE_IPV6 /* addr ::1/128 */ @@ -583,12 +583,12 @@ pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data) memset(&mask, 0, sizeof(mask)); pg_sockaddr_cidr_mask(&mask, "128", AF_INET6); run_ifaddr_callback(callback, cb_data, - (struct sockaddr *) & addr6, - (struct sockaddr *) & mask); + (struct sockaddr *) &addr6, + (struct sockaddr *) &mask); #endif return 0; } -#endif /* !defined(SIOCGIFCONF) */ +#endif /* !defined(SIOCGIFCONF) */ -#endif /* !HAVE_GETIFADDRS */ +#endif /* !HAVE_GETIFADDRS */ diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index d1cc38beb2..261e9be828 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -149,7 +149,7 @@ static int internal_flush(void); #ifdef HAVE_UNIX_SOCKETS static int Lock_AF_UNIX(char *unixSocketDir, char *unixSocketPath); static int Setup_AF_UNIX(char *sock_path); -#endif /* HAVE_UNIX_SOCKETS */ +#endif /* HAVE_UNIX_SOCKETS */ static PQcommMethods PqCommSocketMethods = { socket_comm_reset, @@ -253,7 +253,7 @@ socket_close(int code, Datum arg) if (MyProcPort->gss->cred != GSS_C_NO_CREDENTIAL) gss_release_cred(&min_s, &MyProcPort->gss->cred); -#endif /* ENABLE_GSS */ +#endif /* ENABLE_GSS */ /* * GSS and SSPI share the port->gss struct. Since nowhere else does a @@ -261,7 +261,7 @@ socket_close(int code, Datum arg) * BackendInitialize(). */ free(MyProcPort->gss); -#endif /* ENABLE_GSS || ENABLE_SSPI */ +#endif /* ENABLE_GSS || ENABLE_SSPI */ /* * Cleanly shut down SSL layer. Nowhere else does a postmaster child @@ -362,7 +362,7 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber, service = unixSocketPath; } else -#endif /* HAVE_UNIX_SOCKETS */ +#endif /* HAVE_UNIX_SOCKETS */ { snprintf(portNumberStr, sizeof(portNumberStr), "%d", portNumber); service = portNumberStr; @@ -377,8 +377,8 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber, hostName, service, gai_strerror(ret)))); else ereport(LOG, - (errmsg("could not translate service \"%s\" to address: %s", - service, gai_strerror(ret)))); + (errmsg("could not translate service \"%s\" to address: %s", + service, gai_strerror(ret)))); if (addrs) pg_freeaddrinfo_all(hint.ai_family, addrs); return STATUS_ERROR; @@ -453,8 +453,8 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber, ereport(LOG, (errcode_for_socket_access(), /* translator: first %s is IPv4, IPv6, or Unix */ - errmsg("could not create %s socket for address \"%s\": %m", - familyDesc, addrDesc))); + errmsg("could not create %s socket for address \"%s\": %m", + familyDesc, addrDesc))); continue; } @@ -519,12 +519,12 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber, errmsg("could not bind %s address \"%s\": %m", familyDesc, addrDesc), (IS_AF_UNIX(addr->ai_family)) ? - errhint("Is another postmaster already running on port %d?" - " If not, remove socket file \"%s\" and retry.", - (int) portNumber, service) : - errhint("Is another postmaster already running on port %d?" - " If not, wait a few seconds and retry.", - (int) portNumber))); + errhint("Is another postmaster already running on port %d?" + " If not, remove socket file \"%s\" and retry.", + (int) portNumber, service) : + errhint("Is another postmaster already running on port %d?" + " If not, wait a few seconds and retry.", + (int) portNumber))); closesocket(fd); continue; } @@ -680,7 +680,7 @@ Setup_AF_UNIX(char *sock_path) } return STATUS_OK; } -#endif /* HAVE_UNIX_SOCKETS */ +#endif /* HAVE_UNIX_SOCKETS */ /* @@ -699,7 +699,7 @@ StreamConnection(pgsocket server_fd, Port *port) /* accept connection and fill in the client (remote) address */ port->raddr.salen = sizeof(port->raddr.addr); if ((port->sock = accept(server_fd, - (struct sockaddr *) & port->raddr.addr, + (struct sockaddr *) &port->raddr.addr, &port->raddr.salen)) == PGINVALID_SOCKET) { ereport(LOG, @@ -720,7 +720,7 @@ StreamConnection(pgsocket server_fd, Port *port) /* fill in the server (local) address */ port->laddr.salen = sizeof(port->laddr.addr); if (getsockname(port->sock, - (struct sockaddr *) & port->laddr.addr, + (struct sockaddr *) &port->laddr.addr, &port->laddr.salen) < 0) { elog(LOG, "getsockname() failed: %m"); @@ -858,8 +858,8 @@ TouchSocketFiles(void) #else /* !HAVE_UTIME */ #ifdef HAVE_UTIMES utimes(sock_path, NULL); -#endif /* HAVE_UTIMES */ -#endif /* HAVE_UTIME */ +#endif /* HAVE_UTIMES */ +#endif /* HAVE_UTIME */ } } @@ -1573,7 +1573,7 @@ fail: static void socket_putmessage_noblock(char msgtype, const char *s, size_t len) { - int res PG_USED_FOR_ASSERTS_ONLY; + int res PG_USED_FOR_ASSERTS_ONLY; int required; /* @@ -1704,11 +1704,11 @@ pq_getkeepalivesidle(Port *port) elog(LOG, "getsockopt(TCP_KEEPALIVE) failed: %m"); port->default_keepalives_idle = -1; /* don't know */ } -#endif /* TCP_KEEPIDLE */ +#endif /* TCP_KEEPIDLE */ #else /* WIN32 */ /* We can't get the defaults on Windows, so return "don't know" */ port->default_keepalives_idle = -1; -#endif /* WIN32 */ +#endif /* WIN32 */ } return port->default_keepalives_idle; @@ -1733,7 +1733,7 @@ pq_setkeepalivesidle(int idle, Port *port) if (pq_getkeepalivesidle(port) < 0) { if (idle == 0) - return STATUS_OK; /* default is set but unknown */ + return STATUS_OK; /* default is set but unknown */ else return STATUS_ERROR; } @@ -1792,12 +1792,12 @@ pq_getkeepalivesinterval(Port *port) &size) < 0) { elog(LOG, "getsockopt(TCP_KEEPINTVL) failed: %m"); - port->default_keepalives_interval = -1; /* don't know */ + port->default_keepalives_interval = -1; /* don't know */ } #else /* We can't get the defaults on Windows, so return "don't know" */ port->default_keepalives_interval = -1; -#endif /* WIN32 */ +#endif /* WIN32 */ } return port->default_keepalives_interval; @@ -1822,7 +1822,7 @@ pq_setkeepalivesinterval(int interval, Port *port) if (pq_getkeepalivesinterval(port) < 0) { if (interval == 0) - return STATUS_OK; /* default is set but unknown */ + return STATUS_OK; /* default is set but unknown */ else return STATUS_ERROR; } @@ -1872,7 +1872,7 @@ pq_getkeepalivescount(Port *port) &size) < 0) { elog(LOG, "getsockopt(TCP_KEEPCNT) failed: %m"); - port->default_keepalives_count = -1; /* don't know */ + port->default_keepalives_count = -1; /* don't know */ } } @@ -1897,7 +1897,7 @@ pq_setkeepalivescount(int count, Port *port) if (pq_getkeepalivescount(port) < 0) { if (count == 0) - return STATUS_OK; /* default is set but unknown */ + return STATUS_OK; /* default is set but unknown */ else return STATUS_ERROR; } diff --git a/src/backend/main/main.c b/src/backend/main/main.c index 78ee4cbc18..60db834d3e 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -217,7 +217,7 @@ main(int argc, char *argv[]) #endif if (argc > 1 && strcmp(argv[1], "--boot") == 0) - AuxiliaryProcessMain(argc, argv); /* does not return */ + AuxiliaryProcessMain(argc, argv); /* does not return */ else if (argc > 1 && strcmp(argv[1], "--describe-config") == 0) GucInfoMain(); /* does not return */ else if (argc > 1 && strcmp(argv[1], "--single") == 0) @@ -225,7 +225,7 @@ main(int argc, char *argv[]) NULL, /* no dbname */ strdup(get_user_name_or_exit(progname))); /* does not return */ else - PostmasterMain(argc, argv); /* does not return */ + PostmasterMain(argc, argv); /* does not return */ abort(); /* should not get here */ } @@ -283,10 +283,10 @@ startup_hacks(const char *progname) { _set_FMA3_enable(0); } -#endif /* defined(_M_AMD64) && _MSC_VER == 1800 */ +#endif /* defined(_M_AMD64) && _MSC_VER == 1800 */ } -#endif /* WIN32 */ +#endif /* WIN32 */ /* * Initialize dummy_spinlock, in case we are on a platform where we have @@ -383,7 +383,7 @@ help(const char *progname) #endif printf(_("\nPlease read the documentation for the complete list of run-time\n" - "configuration settings and how to set them on the command line or in\n" + "configuration settings and how to set them on the command line or in\n" "the configuration file.\n\n" "Report bugs to <[email protected]>.\n")); } @@ -398,8 +398,8 @@ check_root(const char *progname) { write_stderr("\"root\" execution of the PostgreSQL server is not permitted.\n" "The server must be started under an unprivileged user ID to prevent\n" - "possible system security compromise. See the documentation for\n" - "more information on how to properly start the server.\n"); + "possible system security compromise. See the documentation for\n" + "more information on how to properly start the server.\n"); exit(1); } @@ -423,9 +423,9 @@ check_root(const char *progname) write_stderr("Execution of PostgreSQL by a user with administrative permissions is not\n" "permitted.\n" "The server must be started under an unprivileged user ID to prevent\n" - "possible system security compromises. See the documentation for\n" - "more information on how to properly start the server.\n"); + "possible system security compromises. See the documentation for\n" + "more information on how to properly start the server.\n"); exit(1); } -#endif /* WIN32 */ +#endif /* WIN32 */ } diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index a1d056ff9f..312decb38e 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -1394,8 +1394,8 @@ _copyTableFunc(const TableFunc *from) { TableFunc *newnode = makeNode(TableFunc); - COPY_NODE_FIELD(ns_names); COPY_NODE_FIELD(ns_uris); + COPY_NODE_FIELD(ns_names); COPY_NODE_FIELD(docexpr); COPY_NODE_FIELD(rowexpr); COPY_NODE_FIELD(colnames); @@ -4215,8 +4215,8 @@ _copyCreateForeignServerStmt(const CreateForeignServerStmt *from) COPY_STRING_FIELD(servertype); COPY_STRING_FIELD(version); COPY_STRING_FIELD(fdwname); - COPY_NODE_FIELD(options); COPY_SCALAR_FIELD(if_not_exists); + COPY_NODE_FIELD(options); return newnode; } @@ -4241,8 +4241,8 @@ _copyCreateUserMappingStmt(const CreateUserMappingStmt *from) COPY_NODE_FIELD(user); COPY_STRING_FIELD(servername); - COPY_NODE_FIELD(options); COPY_SCALAR_FIELD(if_not_exists); + COPY_NODE_FIELD(options); return newnode; } diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 14a8167b04..d25d259586 100644 --- a/src/backend/nodes/equalfuncs.c +++ b/src/backend/nodes/equalfuncs.c @@ -121,13 +121,13 @@ _equalRangeVar(const RangeVar *a, const RangeVar *b) static bool _equalTableFunc(const TableFunc *a, const TableFunc *b) { - COMPARE_NODE_FIELD(ns_names); COMPARE_NODE_FIELD(ns_uris); + COMPARE_NODE_FIELD(ns_names); COMPARE_NODE_FIELD(docexpr); COMPARE_NODE_FIELD(rowexpr); COMPARE_NODE_FIELD(colnames); COMPARE_NODE_FIELD(coltypes); - COMPARE_NODE_FIELD(coltypes); + COMPARE_NODE_FIELD(coltypmods); COMPARE_NODE_FIELD(colcollations); COMPARE_NODE_FIELD(colexprs); COMPARE_NODE_FIELD(coldefexprs); @@ -1255,8 +1255,8 @@ _equalCreateStmt(const CreateStmt *a, const CreateStmt *b) COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(tableElts); COMPARE_NODE_FIELD(inhRelations); - COMPARE_NODE_FIELD(partspec); COMPARE_NODE_FIELD(partbound); + COMPARE_NODE_FIELD(partspec); COMPARE_NODE_FIELD(ofTypename); COMPARE_NODE_FIELD(constraints); COMPARE_NODE_FIELD(options); @@ -1902,8 +1902,8 @@ _equalCreateForeignServerStmt(const CreateForeignServerStmt *a, const CreateFore COMPARE_STRING_FIELD(servertype); COMPARE_STRING_FIELD(version); COMPARE_STRING_FIELD(fdwname); - COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(if_not_exists); + COMPARE_NODE_FIELD(options); return true; } @@ -1924,8 +1924,8 @@ _equalCreateUserMappingStmt(const CreateUserMappingStmt *a, const CreateUserMapp { COMPARE_NODE_FIELD(user); COMPARE_STRING_FIELD(servername); - COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(if_not_exists); + COMPARE_NODE_FIELD(options); return true; } @@ -2344,7 +2344,7 @@ _equalParamRef(const ParamRef *a, const ParamRef *b) static bool _equalAConst(const A_Const *a, const A_Const *b) { - if (!equal(&a->val, &b->val)) /* hack for in-line Value field */ + if (!equal(&a->val, &b->val)) /* hack for in-line Value field */ return false; COMPARE_LOCATION_FIELD(location); @@ -2540,7 +2540,6 @@ _equalRangeTableFuncCol(const RangeTableFuncCol *a, const RangeTableFuncCol *b) COMPARE_STRING_FIELD(colname); COMPARE_NODE_FIELD(typeName); COMPARE_SCALAR_FIELD(for_ordinality); - COMPARE_NODE_FIELD(typeName); COMPARE_SCALAR_FIELD(is_not_null); COMPARE_NODE_FIELD(colexpr); COMPARE_NODE_FIELD(coldefexpr); @@ -2638,7 +2637,6 @@ _equalLockingClause(const LockingClause *a, const LockingClause *b) COMPARE_NODE_FIELD(lockedRels); COMPARE_SCALAR_FIELD(strength); COMPARE_SCALAR_FIELD(waitPolicy); - COMPARE_LOCATION_FIELD(location); return true; } @@ -2655,8 +2653,8 @@ _equalRangeTblEntry(const RangeTblEntry *a, const RangeTblEntry *b) COMPARE_SCALAR_FIELD(jointype); COMPARE_NODE_FIELD(joinaliasvars); COMPARE_NODE_FIELD(functions); - COMPARE_NODE_FIELD(tablefunc); COMPARE_SCALAR_FIELD(funcordinality); + COMPARE_NODE_FIELD(tablefunc); COMPARE_NODE_FIELD(values_lists); COMPARE_STRING_FIELD(ctename); COMPARE_SCALAR_FIELD(ctelevelsup); diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c index f09aa248d8..acaf4b5315 100644 --- a/src/backend/nodes/list.c +++ b/src/backend/nodes/list.c @@ -52,7 +52,7 @@ check_list_invariants(const List *list) } #else #define check_list_invariants(l) -#endif /* USE_ASSERT_CHECKING */ +#endif /* USE_ASSERT_CHECKING */ /* * Return a freshly allocated List. Since empty non-NIL lists are diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c index f138afd706..60b1377cd2 100644 --- a/src/backend/nodes/makefuncs.c +++ b/src/backend/nodes/makefuncs.c @@ -528,8 +528,8 @@ makeFuncExpr(Oid funcid, Oid rettype, List *args, funcexpr = makeNode(FuncExpr); funcexpr->funcid = funcid; funcexpr->funcresulttype = rettype; - funcexpr->funcretset = false; /* only allowed case here */ - funcexpr->funcvariadic = false; /* only allowed case here */ + funcexpr->funcretset = false; /* only allowed case here */ + funcexpr->funcvariadic = false; /* only allowed case here */ funcexpr->funcformat = fformat; funcexpr->funccollid = funccollid; funcexpr->inputcollid = inputcollid; diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index 2496a9a43c..e4d34f35cc 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -29,7 +29,7 @@ static bool expression_returns_set_walker(Node *node, void *context); static int leftmostLoc(int loc1, int loc2); static bool fix_opfuncids_walker(Node *node, void *context); static bool planstate_walk_subplans(List *plans, bool (*walker) (), - void *context); + void *context); static bool planstate_walk_members(List *plans, PlanState **planstates, bool (*walker) (), void *context); @@ -121,7 +121,7 @@ exprType(const Node *expr) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("could not find array type for data type %s", - format_type_be(exprType((Node *) tent->expr))))); + format_type_be(exprType((Node *) tent->expr))))); } } else if (sublink->subLinkType == MULTIEXPR_SUBLINK) @@ -152,7 +152,7 @@ exprType(const Node *expr) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("could not find array type for data type %s", - format_type_be(subplan->firstColType)))); + format_type_be(subplan->firstColType)))); } } else if (subplan->subLinkType == MULTIEXPR_SUBLINK) @@ -1007,10 +1007,10 @@ exprSetCollation(Node *expr, Oid collation) ((NullIfExpr *) expr)->opcollid = collation; break; case T_ScalarArrayOpExpr: - Assert(!OidIsValid(collation)); /* result is always boolean */ + Assert(!OidIsValid(collation)); /* result is always boolean */ break; case T_BoolExpr: - Assert(!OidIsValid(collation)); /* result is always boolean */ + Assert(!OidIsValid(collation)); /* result is always boolean */ break; case T_SubLink: #ifdef USE_ASSERT_CHECKING @@ -1036,13 +1036,13 @@ exprSetCollation(Node *expr, Oid collation) Assert(!OidIsValid(collation)); } } -#endif /* USE_ASSERT_CHECKING */ +#endif /* USE_ASSERT_CHECKING */ break; case T_FieldSelect: ((FieldSelect *) expr)->resultcollid = collation; break; case T_FieldStore: - Assert(!OidIsValid(collation)); /* result is always composite */ + Assert(!OidIsValid(collation)); /* result is always composite */ break; case T_RelabelType: ((RelabelType *) expr)->resultcollid = collation; @@ -1054,7 +1054,7 @@ exprSetCollation(Node *expr, Oid collation) ((ArrayCoerceExpr *) expr)->resultcollid = collation; break; case T_ConvertRowtypeExpr: - Assert(!OidIsValid(collation)); /* result is always composite */ + Assert(!OidIsValid(collation)); /* result is always composite */ break; case T_CaseExpr: ((CaseExpr *) expr)->casecollid = collation; @@ -1063,10 +1063,10 @@ exprSetCollation(Node *expr, Oid collation) ((ArrayExpr *) expr)->array_collid = collation; break; case T_RowExpr: - Assert(!OidIsValid(collation)); /* result is always composite */ + Assert(!OidIsValid(collation)); /* result is always composite */ break; case T_RowCompareExpr: - Assert(!OidIsValid(collation)); /* result is always boolean */ + Assert(!OidIsValid(collation)); /* result is always boolean */ break; case T_CoalesceExpr: ((CoalesceExpr *) expr)->coalescecollid = collation; @@ -1075,7 +1075,7 @@ exprSetCollation(Node *expr, Oid collation) ((MinMaxExpr *) expr)->minmaxcollid = collation; break; case T_SQLValueFunction: - Assert(!OidIsValid(collation)); /* no collatable results */ + Assert(!OidIsValid(collation)); /* no collatable results */ break; case T_XmlExpr: Assert((((XmlExpr *) expr)->op == IS_XMLSERIALIZE) ? @@ -1083,10 +1083,10 @@ exprSetCollation(Node *expr, Oid collation) (collation == InvalidOid)); break; case T_NullTest: - Assert(!OidIsValid(collation)); /* result is always boolean */ + Assert(!OidIsValid(collation)); /* result is always boolean */ break; case T_BooleanTest: - Assert(!OidIsValid(collation)); /* result is always boolean */ + Assert(!OidIsValid(collation)); /* result is always boolean */ break; case T_CoerceToDomain: ((CoerceToDomain *) expr)->resultcollid = collation; @@ -1098,11 +1098,11 @@ exprSetCollation(Node *expr, Oid collation) ((SetToDefault *) expr)->collation = collation; break; case T_CurrentOfExpr: - Assert(!OidIsValid(collation)); /* result is always boolean */ + Assert(!OidIsValid(collation)); /* result is always boolean */ break; case T_NextValueExpr: - Assert(!OidIsValid(collation)); /* result is always an integer - * type */ + Assert(!OidIsValid(collation)); /* result is always an integer + * type */ break; default: elog(ERROR, "unrecognized node type: %d", (int) nodeTag(expr)); @@ -3096,7 +3096,7 @@ query_tree_mutator(Query *query, MUTATE(query->limitCount, query->limitCount, Node *); if (!(flags & QTW_IGNORE_CTE_SUBQUERIES)) MUTATE(query->cteList, query->cteList, List *); - else /* else copy CTE list as-is */ + else /* else copy CTE list as-is */ query->cteList = copyObject(query->cteList); query->rtable = range_table_mutator(query->rtable, mutator, context, flags); @@ -3732,31 +3732,31 @@ planstate_tree_walker(PlanState *planstate, { case T_ModifyTable: if (planstate_walk_members(((ModifyTable *) plan)->plans, - ((ModifyTableState *) planstate)->mt_plans, + ((ModifyTableState *) planstate)->mt_plans, walker, context)) return true; break; case T_Append: if (planstate_walk_members(((Append *) plan)->appendplans, - ((AppendState *) planstate)->appendplans, + ((AppendState *) planstate)->appendplans, walker, context)) return true; break; case T_MergeAppend: if (planstate_walk_members(((MergeAppend *) plan)->mergeplans, - ((MergeAppendState *) planstate)->mergeplans, + ((MergeAppendState *) planstate)->mergeplans, walker, context)) return true; break; case T_BitmapAnd: if (planstate_walk_members(((BitmapAnd *) plan)->bitmapplans, - ((BitmapAndState *) planstate)->bitmapplans, + ((BitmapAndState *) planstate)->bitmapplans, walker, context)) return true; break; case T_BitmapOr: if (planstate_walk_members(((BitmapOr *) plan)->bitmapplans, - ((BitmapOrState *) planstate)->bitmapplans, + ((BitmapOrState *) planstate)->bitmapplans, walker, context)) return true; break; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 1e1377f7b5..ec1b467ce3 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -1702,8 +1702,8 @@ _outTableFunc(StringInfo str, const TableFunc *node) { WRITE_NODE_TYPE("TABLEFUNC"); - WRITE_NODE_FIELD(ns_names); WRITE_NODE_FIELD(ns_uris); + WRITE_NODE_FIELD(ns_names); WRITE_NODE_FIELD(docexpr); WRITE_NODE_FIELD(rowexpr); WRITE_NODE_FIELD(colnames); diff --git a/src/backend/nodes/params.c b/src/backend/nodes/params.c index 0fb08b94db..110732081b 100644 --- a/src/backend/nodes/params.c +++ b/src/backend/nodes/params.c @@ -120,7 +120,7 @@ EstimateParamListSpace(ParamListInfo paramLI) } sz = add_size(sz, sizeof(Oid)); /* space for type OID */ - sz = add_size(sz, sizeof(uint16)); /* space for pflags */ + sz = add_size(sz, sizeof(uint16)); /* space for pflags */ /* space for datum/isnull */ if (OidIsValid(typeOid)) @@ -132,7 +132,7 @@ EstimateParamListSpace(ParamListInfo paramLI) typByVal = true; } sz = add_size(sz, - datumEstimateSpace(prm->value, prm->isnull, typByVal, typLen)); + datumEstimateSpace(prm->value, prm->isnull, typByVal, typLen)); } return sz; diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 3219d00240..157e88e4b8 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -688,8 +688,7 @@ _readRangeVar(void) { READ_LOCALS(RangeVar); - local_node->catalogname = NULL; /* not currently saved in output - * format */ + local_node->catalogname = NULL; /* not currently saved in output format */ READ_STRING_FIELD(schemaname); READ_STRING_FIELD(relname); @@ -709,8 +708,8 @@ _readTableFunc(void) { READ_LOCALS(TableFunc); - READ_NODE_FIELD(ns_names); READ_NODE_FIELD(ns_uris); + READ_NODE_FIELD(ns_names); READ_NODE_FIELD(docexpr); READ_NODE_FIELD(rowexpr); READ_NODE_FIELD(colnames); @@ -801,7 +800,7 @@ _readConst(void) token = pg_strtok(&length); /* skip :constvalue */ if (local_node->constisnull) - token = pg_strtok(&length); /* skip "<>" */ + token = pg_strtok(&length); /* skip "<>" */ else #ifdef XCP if (portable_input) diff --git a/src/backend/nodes/tidbitmap.c b/src/backend/nodes/tidbitmap.c index bbd39a2ed9..c4e53adb0c 100644 --- a/src/backend/nodes/tidbitmap.c +++ b/src/backend/nodes/tidbitmap.c @@ -216,7 +216,7 @@ typedef struct PTIterationArray */ struct TBMSharedIterator { - TBMSharedIteratorState *state; /* shared state */ + TBMSharedIteratorState *state; /* shared state */ PTEntryArray *ptbase; /* pagetable element array */ PTIterationArray *ptpages; /* sorted exact page index list */ PTIterationArray *ptchunks; /* sorted lossy page index list */ @@ -297,8 +297,8 @@ tbm_create(long maxbytes, dsa_area *dsa) */ nbuckets = maxbytes / (sizeof(PagetableEntry) + sizeof(Pointer) + sizeof(Pointer)); - nbuckets = Min(nbuckets, INT_MAX - 1); /* safety limit */ - nbuckets = Max(nbuckets, 16); /* sanity limit */ + nbuckets = Min(nbuckets, INT_MAX - 1); /* safety limit */ + nbuckets = Max(nbuckets, 16); /* sanity limit */ tbm->maxentries = (int) nbuckets; tbm->lossify_start = 0; tbm->dsa = dsa; @@ -723,7 +723,7 @@ tbm_begin_iterate(TIDBitmap *tbm) * needs of the TBMIterateResult sub-struct. */ iterator = (TBMIterator *) palloc(sizeof(TBMIterator) + - MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber)); + MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber)); iterator->tbm = tbm; /* @@ -1498,7 +1498,7 @@ tbm_attach_shared_iterate(dsa_area *dsa, dsa_pointer dp) * serve the needs of the TBMIterateResult sub-struct. */ iterator = (TBMSharedIterator *) palloc0(sizeof(TBMSharedIterator) + - MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber)); + MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber)); istate = (TBMSharedIteratorState *) dsa_get_address(dsa, dp); @@ -1537,7 +1537,7 @@ pagetable_allocate(pagetable_hash *pagetable, Size size) tbm->dsapagetableold = tbm->dsapagetable; tbm->dsapagetable = dsa_allocate_extended(tbm->dsa, sizeof(PTEntryArray) + size, - DSA_ALLOC_HUGE | DSA_ALLOC_ZERO); + DSA_ALLOC_HUGE | DSA_ALLOC_ZERO); ptbase = dsa_get_address(tbm->dsa, tbm->dsapagetable); return ptbase->ptentry; diff --git a/src/backend/optimizer/geqo/geqo_cx.c b/src/backend/optimizer/geqo/geqo_cx.c index c72081e81a..d05327d8ab 100644 --- a/src/backend/optimizer/geqo/geqo_cx.c +++ b/src/backend/optimizer/geqo/geqo_cx.c @@ -121,4 +121,4 @@ cx(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, return num_diffs; } -#endif /* defined(CX) */ +#endif /* defined(CX) */ diff --git a/src/backend/optimizer/geqo/geqo_erx.c b/src/backend/optimizer/geqo/geqo_erx.c index 173be44409..fbabe2e25a 100644 --- a/src/backend/optimizer/geqo/geqo_erx.c +++ b/src/backend/optimizer/geqo/geqo_erx.c @@ -468,4 +468,4 @@ edge_failure(PlannerInfo *root, Gene *gene, int index, Edge *edge_table, int num return 0; /* to keep the compiler quiet */ } -#endif /* defined(ERX) */ +#endif /* defined(ERX) */ diff --git a/src/backend/optimizer/geqo/geqo_misc.c b/src/backend/optimizer/geqo/geqo_misc.c index 503a19f6d6..937cb5fe0f 100644 --- a/src/backend/optimizer/geqo/geqo_misc.c +++ b/src/backend/optimizer/geqo/geqo_misc.c @@ -129,4 +129,4 @@ print_edge_table(FILE *fp, Edge *edge_table, int num_gene) fflush(fp); } -#endif /* GEQO_DEBUG */ +#endif /* GEQO_DEBUG */ diff --git a/src/backend/optimizer/geqo/geqo_mutation.c b/src/backend/optimizer/geqo/geqo_mutation.c index c6af00a2a7..2af0295d69 100644 --- a/src/backend/optimizer/geqo/geqo_mutation.c +++ b/src/backend/optimizer/geqo/geqo_mutation.c @@ -63,4 +63,4 @@ geqo_mutation(PlannerInfo *root, Gene *tour, int num_gene) } } -#endif /* defined(CX) */ +#endif /* defined(CX) */ diff --git a/src/backend/optimizer/geqo/geqo_ox1.c b/src/backend/optimizer/geqo/geqo_ox1.c index 891cfa2403..53dacb811f 100644 --- a/src/backend/optimizer/geqo/geqo_ox1.c +++ b/src/backend/optimizer/geqo/geqo_ox1.c @@ -92,4 +92,4 @@ ox1(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, } -#endif /* defined(OX1) */ +#endif /* defined(OX1) */ diff --git a/src/backend/optimizer/geqo/geqo_ox2.c b/src/backend/optimizer/geqo/geqo_ox2.c index b43455d3eb..8d5baa9826 100644 --- a/src/backend/optimizer/geqo/geqo_ox2.c +++ b/src/backend/optimizer/geqo/geqo_ox2.c @@ -109,4 +109,4 @@ ox2(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, } -#endif /* defined(OX2) */ +#endif /* defined(OX2) */ diff --git a/src/backend/optimizer/geqo/geqo_pmx.c b/src/backend/optimizer/geqo/geqo_pmx.c index e9485cc8b5..ddbc78172c 100644 --- a/src/backend/optimizer/geqo/geqo_pmx.c +++ b/src/backend/optimizer/geqo/geqo_pmx.c @@ -221,4 +221,4 @@ pmx(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, int num_gene) pfree(check_list); } -#endif /* defined(PMX) */ +#endif /* defined(PMX) */ diff --git a/src/backend/optimizer/geqo/geqo_pool.c b/src/backend/optimizer/geqo/geqo_pool.c index 0f7a26c9a1..596a2cda20 100644 --- a/src/backend/optimizer/geqo/geqo_pool.c +++ b/src/backend/optimizer/geqo/geqo_pool.c @@ -54,7 +54,7 @@ alloc_pool(PlannerInfo *root, int pool_size, int string_length) new_pool->data = (Chromosome *) palloc(pool_size * sizeof(Chromosome)); /* all gene */ - chromo = (Chromosome *) new_pool->data; /* vector of all chromos */ + chromo = (Chromosome *) new_pool->data; /* vector of all chromos */ for (i = 0; i < pool_size; i++) chromo[i].string = palloc((string_length + 1) * sizeof(Gene)); diff --git a/src/backend/optimizer/geqo/geqo_px.c b/src/backend/optimizer/geqo/geqo_px.c index f7f615462c..2e7748c5aa 100644 --- a/src/backend/optimizer/geqo/geqo_px.c +++ b/src/backend/optimizer/geqo/geqo_px.c @@ -107,4 +107,4 @@ px(PlannerInfo *root, Gene *tour1, Gene *tour2, Gene *offspring, int num_gene, } -#endif /* defined(PX) */ +#endif /* defined(PX) */ diff --git a/src/backend/optimizer/geqo/geqo_recombination.c b/src/backend/optimizer/geqo/geqo_recombination.c index a61547c16d..eb6ab42808 100644 --- a/src/backend/optimizer/geqo/geqo_recombination.c +++ b/src/backend/optimizer/geqo/geqo_recombination.c @@ -89,4 +89,4 @@ free_city_table(PlannerInfo *root, City *city_table) pfree(city_table); } -#endif /* CX || PX || OX1 || OX2 */ +#endif /* CX || PX || OX1 || OX2 */ diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 196c6194cb..9ebe69ebad 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -165,7 +165,7 @@ make_one_rel(PlannerInfo *root, List *joinlist) if (brel == NULL) continue; - Assert(brel->relid == rti); /* sanity check on array */ + Assert(brel->relid == rti); /* sanity check on array */ /* ignore RTEs that are "other rels" */ if (brel->reloptkind != RELOPT_BASEREL) @@ -264,7 +264,7 @@ set_base_rel_sizes(PlannerInfo *root) if (rel == NULL) continue; - Assert(rel->relid == rti); /* sanity check on array */ + Assert(rel->relid == rti); /* sanity check on array */ /* ignore RTEs that are "other rels" */ if (rel->reloptkind != RELOPT_BASEREL) @@ -306,7 +306,7 @@ set_base_rel_pathlists(PlannerInfo *root) if (rel == NULL) continue; - Assert(rel->relid == rti); /* sanity check on array */ + Assert(rel->relid == rti); /* sanity check on array */ /* ignore RTEs that are "other rels" */ if (rel->reloptkind != RELOPT_BASEREL) @@ -816,7 +816,7 @@ set_tablesample_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry * */ if ((root->query_level > 1 || bms_membership(root->all_baserels) != BMS_SINGLETON) && - !(GetTsmRoutine(rte->tablesample->tsmhandler)->repeatable_across_scans)) + !(GetTsmRoutine(rte->tablesample->tsmhandler)->repeatable_across_scans)) { path = (Path *) create_material_path(rel, path); } @@ -859,10 +859,10 @@ set_foreign_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte) * Set size estimates for a simple "append relation" * * The passed-in rel and RTE represent the entire append relation. The - * relation's contents are computed by appending together the output of - * the individual member relations. Note that in the inheritance case, - * the first member relation is actually the same table as is mentioned in - * the parent RTE ... but it has a different RTE and RelOptInfo. This is + * relation's contents are computed by appending together the output of the + * individual member relations. Note that in the non-partitioned inheritance + * case, the first member relation is actually the same table as is mentioned + * in the parent RTE ... but it has a different RTE and RelOptInfo. This is * a good thing because their outputs are not the same size. */ static void @@ -986,7 +986,7 @@ set_append_rel_size(PlannerInfo *root, RelOptInfo *rel, childquals = lappend(childquals, make_restrictinfo((Expr *) onecq, rinfo->is_pushed_down, - rinfo->outerjoin_delayed, + rinfo->outerjoin_delayed, pseudoconstant, rinfo->security_level, NULL, NULL, NULL)); @@ -1323,14 +1323,14 @@ add_paths_to_append_rel(PlannerInfo *root, RelOptInfo *rel, */ if (childrel->cheapest_total_path->param_info == NULL) subpaths = accumulate_append_subpath(subpaths, - childrel->cheapest_total_path); + childrel->cheapest_total_path); else subpaths_valid = false; /* Same idea, but for a partial plan. */ if (childrel->partial_pathlist != NIL) partial_subpaths = accumulate_append_subpath(partial_subpaths, - linitial(childrel->partial_pathlist)); + linitial(childrel->partial_pathlist)); else partial_subpaths_valid = false; @@ -1596,7 +1596,7 @@ generate_mergeappend_paths(PlannerInfo *root, RelOptInfo *rel, total_subpaths, pathkeys, NULL, - partitioned_rels)); + partitioned_rels)); } } @@ -1962,7 +1962,7 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel, pathkeys = convert_subquery_pathkeys(root, rel, subpath->pathkeys, - make_tlist_from_pathtarget(subpath->pathtarget)); + make_tlist_from_pathtarget(subpath->pathtarget)); if (subroot->distribution && subroot->distribution->distributionExpr) { @@ -3119,7 +3119,7 @@ create_partial_bitmap_paths(PlannerInfo *root, RelOptInfo *rel, return; add_partial_path(rel, (Path *) create_bitmap_heap_path(root, rel, - bitmapqual, rel->lateral_relids, 1.0, parallel_workers)); + bitmapqual, rel->lateral_relids, 1.0, parallel_workers)); } /* @@ -3157,7 +3157,7 @@ compute_parallel_worker(RelOptInfo *rel, double heap_pages, double index_pages) */ if (rel->reloptkind == RELOPT_BASEREL && ((heap_pages >= 0 && heap_pages < min_parallel_table_scan_size) || - (index_pages >= 0 && index_pages < min_parallel_index_scan_size))) + (index_pages >= 0 && index_pages < min_parallel_index_scan_size))) return 0; if (heap_pages >= 0) @@ -3513,4 +3513,4 @@ debug_print_rel(PlannerInfo *root, RelOptInfo *rel) fflush(stdout); } -#endif /* OPTIMIZER_DEBUG */ +#endif /* OPTIMIZER_DEBUG */ diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c index 758ddea4a5..9d340255c3 100644 --- a/src/backend/optimizer/path/clausesel.c +++ b/src/backend/optimizer/path/clausesel.c @@ -31,7 +31,7 @@ */ typedef struct RangeQueryClause { - struct RangeQueryClause *next; /* next in linked list */ + struct RangeQueryClause *next; /* next in linked list */ Node *var; /* The common variable of the clauses */ bool have_lobound; /* found a low-bound clause yet? */ bool have_hibound; /* found a high-bound clause yet? */ @@ -690,7 +690,7 @@ clause_selectivity(PlannerInfo *root, { /* inverse of the selectivity of the underlying clause */ s1 = 1.0 - clause_selectivity(root, - (Node *) get_notclausearg((Expr *) clause), + (Node *) get_notclausearg((Expr *) clause), varRelid, jointype, sjinfo); @@ -848,7 +848,7 @@ clause_selectivity(PlannerInfo *root, #ifdef SELECTIVITY_DEBUG elog(DEBUG4, "clause_selectivity: s1 %f", s1); -#endif /* SELECTIVITY_DEBUG */ +#endif /* SELECTIVITY_DEBUG */ return s1; } diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index dfb1c973c5..b752aed3c6 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -510,10 +510,10 @@ cost_index(IndexPath *path, PlannerInfo *root, double loop_count, path->path.rows = path->path.param_info->ppi_rows; /* qpquals come from the rel's restriction clauses and ppi_clauses */ qpquals = list_concat( - extract_nonindex_conditions(path->indexinfo->indrestrictinfo, - path->indexquals), - extract_nonindex_conditions(path->path.param_info->ppi_clauses, - path->indexquals)); + extract_nonindex_conditions(path->indexinfo->indrestrictinfo, + path->indexquals), + extract_nonindex_conditions(path->path.param_info->ppi_clauses, + path->indexquals)); } else { @@ -683,7 +683,7 @@ cost_index(IndexPath *path, PlannerInfo *root, double loop_count, * order. */ path->path.parallel_workers = compute_parallel_worker(baserel, - rand_heap_pages, index_pages); + rand_heap_pages, index_pages); /* * Fall out if workers can't be assigned for parallel scan, because in @@ -833,7 +833,7 @@ index_pages_fetched(double tuples_fetched, BlockNumber pages, Assert(T <= total_pages); /* b is pro-rated share of effective_cache_size */ - b = (double) effective_cache_size *T / total_pages; + b = (double) effective_cache_size * T / total_pages; /* force it positive and integral */ if (b <= 1.0) @@ -2978,7 +2978,7 @@ initial_cost_hashjoin(PlannerInfo *root, JoinCostWorkspace *workspace, */ ExecChooseHashTableSize(inner_path_rows, inner_path->pathtarget->width, - true, /* useskew */ + true, /* useskew */ &numbuckets, &numbatches, &num_skew_mcvs); @@ -3072,7 +3072,7 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path, path->num_batches = numbatches; /* and compute the number of "virtual" buckets in the whole join */ - virtualbuckets = (double) numbuckets *(double) numbatches; + virtualbuckets = (double) numbuckets * (double) numbatches; /* * Determine bucketsize fraction for inner relation. We use the smallest @@ -3112,7 +3112,7 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path, /* not cached yet */ thisbucketsize = estimate_hash_bucketsize(root, - get_rightop(restrictinfo->clause), + get_rightop(restrictinfo->clause), virtualbuckets); restrictinfo->right_bucketsize = thisbucketsize; } @@ -3128,7 +3128,7 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path, /* not cached yet */ thisbucketsize = estimate_hash_bucketsize(root, - get_leftop(restrictinfo->clause), + get_leftop(restrictinfo->clause), virtualbuckets); restrictinfo->left_bucketsize = thisbucketsize; } @@ -3391,7 +3391,7 @@ cost_rescan(PlannerInfo *root, Path *path, */ Cost run_cost = cpu_tuple_cost * path->rows; double nbytes = relation_byte_size(path->rows, - path->pathtarget->width); + path->pathtarget->width); long work_mem_bytes = work_mem * 1024L; if (nbytes > work_mem_bytes) @@ -3418,7 +3418,7 @@ cost_rescan(PlannerInfo *root, Path *path, */ Cost run_cost = cpu_operator_cost * path->rows; double nbytes = relation_byte_size(path->rows, - path->pathtarget->width); + path->pathtarget->width); long work_mem_bytes = work_mem * 1024L; if (nbytes > work_mem_bytes) @@ -3800,7 +3800,7 @@ compute_semi_anti_join_factors(PlannerInfo *root, jselec = clauselist_selectivity(root, joinquals, 0, - (jointype == JOIN_ANTI) ? JOIN_ANTI : JOIN_SEMI, + (jointype == JOIN_ANTI) ? JOIN_ANTI : JOIN_SEMI, sjinfo); /* @@ -4062,7 +4062,7 @@ get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel, nrows = rel->tuples * clauselist_selectivity(root, allclauses, - rel->relid, /* do not use 0! */ + rel->relid, /* do not use 0! */ JOIN_INNER, NULL); nrows = clamp_row_est(nrows); @@ -4333,7 +4333,6 @@ get_foreign_key_join_selectivity(PlannerInfo *root, { ForeignKeyOptInfo *fkinfo = (ForeignKeyOptInfo *) lfirst(lc); bool ref_is_outer; - bool use_smallest_selectivity = false; List *removedlist; ListCell *cell; ListCell *prev; @@ -4353,6 +4352,22 @@ get_foreign_key_join_selectivity(PlannerInfo *root, continue; /* + * If we're dealing with a semi/anti join, and the FK's referenced + * relation is on the outside, then knowledge of the FK doesn't help + * us figure out what we need to know (which is the fraction of outer + * rows that have matches). On the other hand, if the referenced rel + * is on the inside, then all outer rows must have matches in the + * referenced table (ignoring nulls). But any restriction or join + * clauses that filter that table will reduce the fraction of matches. + * We can account for restriction clauses, but it's too hard to guess + * how many table rows would get through a join that's inside the RHS. + * Hence, if either case applies, punt and ignore the FK. + */ + if ((jointype == JOIN_SEMI || jointype == JOIN_ANTI) && + (ref_is_outer || bms_membership(inner_relids) != BMS_SINGLETON)) + continue; + + /* * Modify the restrictlist by removing clauses that match the FK (and * putting them into removedlist instead). It seems unsafe to modify * the originally-passed List structure, so we make a shallow copy the @@ -4452,10 +4467,7 @@ get_foreign_key_join_selectivity(PlannerInfo *root, * However (1) if there are any strict restriction clauses for the * referencing column(s) elsewhere in the query, derating here would * be double-counting the null fraction, and (2) it's not very clear - * how to combine null fractions for multiple referencing columns. - * - * In the use_smallest_selectivity code below, null derating is done - * implicitly by relying on clause_selectivity(); in the other cases, + * how to combine null fractions for multiple referencing columns. So * we do nothing for now about correcting for nulls. * * XXX another point here is that if either side of an FK constraint @@ -4468,52 +4480,23 @@ get_foreign_key_join_selectivity(PlannerInfo *root, * work, it is uncommon in practice to have an FK referencing a parent * table. So, at least for now, disregard inheritance here. */ - if (ref_is_outer && jointype != JOIN_INNER) + if (jointype == JOIN_SEMI || jointype == JOIN_ANTI) { /* - * When the referenced table is on the outer side of a non-inner - * join, knowing that each inner row has exactly one match is not - * as useful as one could wish, since we really need to know the - * fraction of outer rows with a match. Still, we can avoid the - * folly of multiplying the per-column estimates together. Take - * the smallest per-column selectivity, instead. (This should - * correspond to the FK column with the most nulls.) + * For JOIN_SEMI and JOIN_ANTI, we only get here when the FK's + * referenced table is exactly the inside of the join. The join + * selectivity is defined as the fraction of LHS rows that have + * matches. The FK implies that every LHS row has a match *in the + * referenced table*; but any restriction clauses on it will + * reduce the number of matches. Hence we take the join + * selectivity as equal to the selectivity of the table's + * restriction clauses, which is rows / tuples; but we must guard + * against tuples == 0. */ - use_smallest_selectivity = true; - } - else if (jointype == JOIN_SEMI || jointype == JOIN_ANTI) - { - /* - * For JOIN_SEMI and JOIN_ANTI, the selectivity is defined as the - * fraction of LHS rows that have matches. The referenced table - * is on the inner side (we already handled the other case above), - * so the FK implies that every LHS row has a match *in the - * referenced table*. But any restriction or join clauses below - * here will reduce the number of matches. - */ - if (bms_membership(inner_relids) == BMS_SINGLETON) - { - /* - * When the inner side of the semi/anti join is just the - * referenced table, we may take the FK selectivity as equal - * to the selectivity of the table's restriction clauses. - */ - RelOptInfo *ref_rel = find_base_rel(root, fkinfo->ref_relid); - double ref_tuples = Max(ref_rel->tuples, 1.0); + RelOptInfo *ref_rel = find_base_rel(root, fkinfo->ref_relid); + double ref_tuples = Max(ref_rel->tuples, 1.0); - fkselec *= ref_rel->rows / ref_tuples; - } - else - { - /* - * When the inner side of the semi/anti join is itself a join, - * it's hard to guess what fraction of the referenced table - * will get through the join. But we still don't want to - * multiply per-column estimates together. Take the smallest - * per-column selectivity, instead. - */ - use_smallest_selectivity = true; - } + fkselec *= ref_rel->rows / ref_tuples; } else { @@ -4527,26 +4510,6 @@ get_foreign_key_join_selectivity(PlannerInfo *root, fkselec *= 1.0 / ref_tuples; } - - /* - * Common code for cases where we should use the smallest selectivity - * that would be computed for any one of the FK's clauses. - */ - if (use_smallest_selectivity) - { - Selectivity thisfksel = 1.0; - - foreach(cell, removedlist) - { - RestrictInfo *rinfo = (RestrictInfo *) lfirst(cell); - Selectivity csel; - - csel = clause_selectivity(root, (Node *) rinfo, - 0, jointype, sjinfo); - thisfksel = Min(thisfksel, csel); - } - fkselec *= thisfksel; - } } *restrictlist = worklist; @@ -4977,7 +4940,7 @@ set_rel_width(PlannerInfo *root, RelOptInfo *rel) { /* Real relation, so estimate true tuple width */ wholerow_width += get_relation_data_width(reloid, - rel->attr_widths - rel->min_attr); + rel->attr_widths - rel->min_attr); } else { diff --git a/src/backend/optimizer/path/equivclass.c b/src/backend/optimizer/path/equivclass.c index 67bd760fb4..9a3f606df0 100644 --- a/src/backend/optimizer/path/equivclass.c +++ b/src/backend/optimizer/path/equivclass.c @@ -244,7 +244,7 @@ process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo, { EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc2); - Assert(!cur_em->em_is_child); /* no children yet */ + Assert(!cur_em->em_is_child); /* no children yet */ /* * If below an outer join, don't match constants: they're not as @@ -1103,9 +1103,9 @@ generate_join_implied_equalities_for_ecs(PlannerInfo *root, if (ec->ec_broken) sublist = generate_join_implied_equalities_broken(root, ec, - nominal_join_relids, + nominal_join_relids, outer_relids, - nominal_inner_relids, + nominal_inner_relids, inner_rel); result = list_concat(result, sublist); @@ -1426,7 +1426,7 @@ create_join_clause(PlannerInfo *root, bms_union(leftem->em_relids, rightem->em_relids), bms_union(leftem->em_nullable_relids, - rightem->em_nullable_relids), + rightem->em_nullable_relids), ec->ec_min_security); /* Mark the clause as redundant, or not */ @@ -1704,7 +1704,7 @@ reconsider_outer_join_clause(PlannerInfo *root, RestrictInfo *rinfo, { EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc2); - Assert(!cur_em->em_is_child); /* no children yet */ + Assert(!cur_em->em_is_child); /* no children yet */ if (equal(outervar, cur_em->em_expr)) { match = true; @@ -1738,7 +1738,7 @@ reconsider_outer_join_clause(PlannerInfo *root, RestrictInfo *rinfo, innervar, cur_em->em_expr, bms_copy(inner_relids), - bms_copy(inner_nullable_relids), + bms_copy(inner_nullable_relids), cur_ec->ec_min_security); if (process_equivalence(root, newrinfo, true)) match = true; @@ -1834,7 +1834,7 @@ reconsider_full_join_clause(PlannerInfo *root, RestrictInfo *rinfo) foreach(lc2, cur_ec->ec_members) { coal_em = (EquivalenceMember *) lfirst(lc2); - Assert(!coal_em->em_is_child); /* no children yet */ + Assert(!coal_em->em_is_child); /* no children yet */ if (IsA(coal_em->em_expr, CoalesceExpr)) { CoalesceExpr *cexpr = (CoalesceExpr *) coal_em->em_expr; @@ -1881,8 +1881,8 @@ reconsider_full_join_clause(PlannerInfo *root, RestrictInfo *rinfo) leftvar, cur_em->em_expr, bms_copy(left_relids), - bms_copy(left_nullable_relids), - cur_ec->ec_min_security); + bms_copy(left_nullable_relids), + cur_ec->ec_min_security); if (process_equivalence(root, newrinfo, true)) matchleft = true; } @@ -1896,8 +1896,8 @@ reconsider_full_join_clause(PlannerInfo *root, RestrictInfo *rinfo) rightvar, cur_em->em_expr, bms_copy(right_relids), - bms_copy(right_nullable_relids), - cur_ec->ec_min_security); + bms_copy(right_nullable_relids), + cur_ec->ec_min_security); if (process_equivalence(root, newrinfo, true)) matchright = true; } @@ -1997,7 +1997,7 @@ match_eclasses_to_foreign_key_col(PlannerInfo *root, Index var2varno = fkinfo->ref_relid; AttrNumber var2attno = fkinfo->confkey[colno]; Oid eqop = fkinfo->conpfeqop[colno]; - List *opfamilies = NIL; /* compute only if needed */ + List *opfamilies = NIL; /* compute only if needed */ ListCell *lc1; foreach(lc1, root->eq_classes) diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 07ab33902b..dedb9f521d 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -320,7 +320,7 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel) * the joinclause list. Add these to bitjoinpaths. */ indexpaths = generate_bitmap_or_paths(root, rel, - joinorclauses, rel->baserestrictinfo); + joinorclauses, rel->baserestrictinfo); bitjoinpaths = list_concat(bitjoinpaths, indexpaths); /* @@ -1170,7 +1170,7 @@ build_paths_for_OR(PlannerInfo *root, RelOptInfo *rel, List *clauses, List *other_clauses) { List *result = NIL; - List *all_clauses = NIL; /* not computed till needed */ + List *all_clauses = NIL; /* not computed till needed */ ListCell *lc; foreach(lc, rel->indexlist) @@ -1383,7 +1383,7 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel, List *paths) Assert(npaths > 0); /* else caller error */ if (npaths == 1) - return (Path *) linitial(paths); /* easy case */ + return (Path *) linitial(paths); /* easy case */ /* * In theory we should consider every nonempty subset of the given paths. @@ -1650,7 +1650,7 @@ bitmap_and_cost_est(PlannerInfo *root, RelOptInfo *rel, List *paths) apath.path.pathtype = T_BitmapAnd; apath.path.parent = rel; apath.path.pathtarget = rel->reltarget; - apath.path.param_info = NULL; /* not used in bitmap trees */ + apath.path.param_info = NULL; /* not used in bitmap trees */ apath.path.pathkeys = NIL; apath.bitmapquals = paths; cost_bitmap_and_node(&apath, root); @@ -1760,7 +1760,7 @@ get_bitmap_tree_required_outer(Path *bitmapqual) foreach(lc, ((BitmapAndPath *) bitmapqual)->bitmapquals) { result = bms_join(result, - get_bitmap_tree_required_outer((Path *) lfirst(lc))); + get_bitmap_tree_required_outer((Path *) lfirst(lc))); } } else if (IsA(bitmapqual, BitmapOrPath)) @@ -1768,7 +1768,7 @@ get_bitmap_tree_required_outer(Path *bitmapqual) foreach(lc, ((BitmapOrPath *) bitmapqual)->bitmapquals) { result = bms_join(result, - get_bitmap_tree_required_outer((Path *) lfirst(lc))); + get_bitmap_tree_required_outer((Path *) lfirst(lc))); } } else @@ -1982,7 +1982,7 @@ get_loop_count(PlannerInfo *root, Index cur_relid, Relids outer_relids) outer_rel = root->simple_rel_array[outer_relid]; if (outer_rel == NULL) continue; - Assert(outer_rel->relid == outer_relid); /* sanity check on array */ + Assert(outer_rel->relid == outer_relid); /* sanity check on array */ /* Other relation could be proven empty, if so ignore */ if (IS_DUMMY_REL(outer_rel)) @@ -2161,9 +2161,9 @@ match_eclass_clauses_to_index(PlannerInfo *root, IndexOptInfo *index, arg.indexcol = indexcol; clauses = generate_implied_equalities_for_column(root, index->rel, - ec_member_matches_indexcol, + ec_member_matches_indexcol, (void *) &arg, - index->rel->lateral_referencers); + index->rel->lateral_referencers); /* * We have to check whether the results actually do match the index, @@ -2632,7 +2632,7 @@ match_pathkeys_to_index(IndexOptInfo *index, List *pathkeys, return; } - *orderby_clauses_p = orderby_clauses; /* success! */ + *orderby_clauses_p = orderby_clauses; /* success! */ *clause_columns_p = clause_columns; } @@ -2836,8 +2836,8 @@ check_index_predicates(PlannerInfo *root, RelOptInfo *rel) clauselist = list_concat(clauselist, generate_join_implied_equalities(root, - bms_union(rel->relids, - otherrels), + bms_union(rel->relids, + otherrels), otherrels, rel)); @@ -3062,7 +3062,7 @@ relation_has_unique_index_for(PlannerInfo *root, RelOptInfo *rel, if (match_index_to_operand(rexpr, c, ind)) { - matched = true; /* column is unique */ + matched = true; /* column is unique */ break; } } @@ -3983,7 +3983,7 @@ adjust_rowcompare_for_index(RowCompareExpr *clause, if (!var_on_left) { expr_op = get_commutator(expr_op); - if (!OidIsValid(expr_op)) /* should not happen */ + if (!OidIsValid(expr_op)) /* should not happen */ elog(ERROR, "could not find commutator of member %d(%u,%u) of opfamily %u", op_strategy, lefttype, righttype, opfam); } @@ -4085,7 +4085,7 @@ prefix_quals(Node *leftop, Oid opfamily, Oid collation, break; case BYTEAOID: prefix = DatumGetCString(DirectFunctionCall1(byteaout, - prefix_const->constvalue)); + prefix_const->constvalue)); break; default: elog(ERROR, "unexpected const type: %u", diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c index c130d2f17f..511c734980 100644 --- a/src/backend/optimizer/path/joinpath.c +++ b/src/backend/optimizer/path/joinpath.c @@ -214,16 +214,16 @@ add_paths_to_joinrel(PlannerInfo *root, if (bms_overlap(joinrel->relids, sjinfo2->min_righthand) && !bms_overlap(joinrel->relids, sjinfo2->min_lefthand)) extra.param_source_rels = bms_join(extra.param_source_rels, - bms_difference(root->all_baserels, - sjinfo2->min_righthand)); + bms_difference(root->all_baserels, + sjinfo2->min_righthand)); /* full joins constrain both sides symmetrically */ if (sjinfo2->jointype == JOIN_FULL && bms_overlap(joinrel->relids, sjinfo2->min_lefthand) && !bms_overlap(joinrel->relids, sjinfo2->min_righthand)) extra.param_source_rels = bms_join(extra.param_source_rels, - bms_difference(root->all_baserels, - sjinfo2->min_lefthand)); + bms_difference(root->all_baserels, + sjinfo2->min_lefthand)); } /* @@ -918,7 +918,7 @@ sort_inner_and_outer(PlannerInfo *root, cur_mergeclauses = find_mergeclauses_for_pathkeys(root, outerkeys, true, - extra->mergeclause_list); + extra->mergeclause_list); /* Should have used them all... */ Assert(list_length(cur_mergeclauses) == list_length(extra->mergeclause_list)); @@ -1104,7 +1104,7 @@ generate_mergejoin_paths(PlannerInfo *root, } num_sortkeys = list_length(innersortkeys); if (num_sortkeys > 1 && !useallclauses) - trialsortkeys = list_copy(innersortkeys); /* need modifiable copy */ + trialsortkeys = list_copy(innersortkeys); /* need modifiable copy */ else trialsortkeys = innersortkeys; /* won't really truncate */ @@ -1445,7 +1445,7 @@ match_unsorted_outer(PlannerInfo *root, return; inner_cheapest_total = get_cheapest_parallel_safe_total_inner( - innerrel->pathlist); + innerrel->pathlist); } if (inner_cheapest_total) @@ -1732,7 +1732,7 @@ hash_inner_and_outer(PlannerInfo *root, if (outerpath == cheapest_startup_outer && innerpath == cheapest_total_inner) - continue; /* already tried it */ + continue; /* already tried it */ try_hashjoin_path(root, joinrel, diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c index 5a68de3cc8..6ee23509c5 100644 --- a/src/backend/optimizer/path/joinrels.c +++ b/src/backend/optimizer/path/joinrels.c @@ -93,7 +93,7 @@ join_search_one_level(PlannerInfo *root, int level) if (level == 2) /* consider remaining initial rels */ other_rels = lnext(r); - else /* consider all initial rels */ + else /* consider all initial rels */ other_rels = list_head(joinrels[1]); make_rels_by_clause_joins(root, @@ -615,7 +615,7 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, !bms_is_subset(sjinfo->min_righthand, join_plus_rhs)) { join_plus_rhs = bms_add_members(join_plus_rhs, - sjinfo->min_righthand); + sjinfo->min_righthand); more = true; } /* full joins constrain both sides symmetrically */ diff --git a/src/backend/optimizer/path/pathkeys.c b/src/backend/optimizer/path/pathkeys.c index 2c269062ec..37cfa098d4 100644 --- a/src/backend/optimizer/path/pathkeys.c +++ b/src/backend/optimizer/path/pathkeys.c @@ -196,7 +196,7 @@ make_pathkey_from_sortinfo(PlannerInfo *root, opcintype, opcintype, BTEqualStrategyNumber); - if (!OidIsValid(equality_op)) /* shouldn't happen */ + if (!OidIsValid(equality_op)) /* shouldn't happen */ elog(ERROR, "could not find equality operator for opfamily %u", opfamily); opfamilies = get_mergejoin_opfamilies(equality_op); @@ -575,8 +575,8 @@ build_expression_pathkey(PlannerInfo *root, opfamily, opcintype, exprCollation((Node *) expr), - (strategy == BTGreaterStrategyNumber), - (strategy == BTGreaterStrategyNumber), + (strategy == BTGreaterStrategyNumber), + (strategy == BTGreaterStrategyNumber), 0, rel, create_it); @@ -746,7 +746,7 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel, outer_ec = get_eclass_for_sort_expr(root, outer_expr, NULL, - sub_eclass->ec_opfamilies, + sub_eclass->ec_opfamilies, sub_expr_type, sub_expr_coll, 0, @@ -762,9 +762,9 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel, outer_pk = make_canonical_pathkey(root, outer_ec, - sub_pathkey->pk_opfamily, - sub_pathkey->pk_strategy, - sub_pathkey->pk_nulls_first); + sub_pathkey->pk_opfamily, + sub_pathkey->pk_strategy, + sub_pathkey->pk_nulls_first); /* score = # of equivalence peers */ score = list_length(outer_ec->ec_members) - 1; /* +1 if it matches the proper query_pathkeys item */ diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 5c833e933d..0d375b13c7 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -85,9 +85,9 @@ * ressortgroupref labels. This is passed down by parent nodes such as Sort * and Group, which need these values to be available in their inputs. */ -#define CP_EXACT_TLIST 0x0001 /* Plan must return specified tlist */ -#define CP_SMALL_TLIST 0x0002 /* Prefer narrower tlists */ -#define CP_LABEL_TLIST 0x0004 /* tlist must contain sortgrouprefs */ +#define CP_EXACT_TLIST 0x0001 /* Plan must return specified tlist */ +#define CP_SMALL_TLIST 0x0002 /* Prefer narrower tlists */ +#define CP_LABEL_TLIST 0x0004 /* tlist must contain sortgrouprefs */ static Plan *create_plan_recurse(PlannerInfo *root, Path *best_path, @@ -169,7 +169,7 @@ static TableFuncScan *create_tablefuncscan_plan(PlannerInfo *root, Path *best_pa static CteScan *create_ctescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses); static NamedTuplestoreScan *create_namedtuplestorescan_plan(PlannerInfo *root, - Path *best_path, List *tlist, List *scan_clauses); + Path *best_path, List *tlist, List *scan_clauses); static WorkTableScan *create_worktablescan_plan(PlannerInfo *root, Path *best_path, List *tlist, List *scan_clauses); static ForeignScan *create_foreignscan_plan(PlannerInfo *root, ForeignPath *best_path, @@ -445,7 +445,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags) else if (IsA(best_path, MinMaxAggPath)) { plan = (Plan *) create_minmaxagg_plan(root, - (MinMaxAggPath *) best_path); + (MinMaxAggPath *) best_path); } else { @@ -456,7 +456,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags) break; case T_ProjectSet: plan = (Plan *) create_project_set_plan(root, - (ProjectSetPath *) best_path); + (ProjectSetPath *) best_path); break; case T_Material: plan = (Plan *) create_material_plan(root, @@ -467,7 +467,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags) if (IsA(best_path, UpperUniquePath)) { plan = (Plan *) create_upper_unique_plan(root, - (UpperUniquePath *) best_path, + (UpperUniquePath *) best_path, flags); } else @@ -494,7 +494,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags) case T_Agg: if (IsA(best_path, GroupingSetsPath)) plan = create_groupingsets_plan(root, - (GroupingSetsPath *) best_path); + (GroupingSetsPath *) best_path); else { Assert(IsA(best_path, AggPath)); @@ -504,7 +504,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags) break; case T_WindowAgg: plan = (Plan *) create_windowagg_plan(root, - (WindowAggPath *) best_path); + (WindowAggPath *) best_path); break; case T_SetOp: plan = (Plan *) create_setop_plan(root, @@ -513,7 +513,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags) break; case T_RecursiveUnion: plan = (Plan *) create_recursiveunion_plan(root, - (RecursiveUnionPath *) best_path); + (RecursiveUnionPath *) best_path); break; case T_LockRows: plan = (Plan *) create_lockrows_plan(root, @@ -522,7 +522,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags) break; case T_ModifyTable: plan = (Plan *) create_modifytable_plan(root, - (ModifyTablePath *) best_path); + (ModifyTablePath *) best_path); break; case T_Limit: plan = (Plan *) create_limit_plan(root, @@ -531,7 +531,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags) break; case T_GatherMerge: plan = (Plan *) create_gather_merge_plan(root, - (GatherMergePath *) best_path); + (GatherMergePath *) best_path); break; default: elog(ERROR, "unrecognized node type: %d", @@ -673,7 +673,7 @@ create_scan_plan(PlannerInfo *root, Path *best_path, int flags) case T_BitmapHeapScan: plan = (Plan *) create_bitmap_scan_plan(root, - (BitmapHeapPath *) best_path, + (BitmapHeapPath *) best_path, tlist, scan_clauses); break; @@ -687,7 +687,7 @@ create_scan_plan(PlannerInfo *root, Path *best_path, int flags) case T_SubqueryScan: plan = (Plan *) create_subqueryscan_plan(root, - (SubqueryScanPath *) best_path, + (SubqueryScanPath *) best_path, tlist, scan_clauses); break; @@ -1033,7 +1033,7 @@ create_join_plan(PlannerInfo *root, JoinPath *best_path) if (get_loc_restrictinfo(best_path) != NIL) set_qpqual((Plan) plan, list_concat(get_qpqual((Plan) plan), - get_actual_clauses(get_loc_restrictinfo(best_path)))); + get_actual_clauses(get_loc_restrictinfo(best_path)))); #endif return plan; @@ -1474,7 +1474,7 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path, int flags) * for the IN clause operators' RHS datatype. */ eqop = get_equality_op_for_ordering_op(sortop, NULL); - if (!OidIsValid(eqop)) /* shouldn't happen */ + if (!OidIsValid(eqop)) /* shouldn't happen */ elog(ERROR, "could not find equality operator for ordering operator %u", sortop); @@ -1965,9 +1965,9 @@ create_groupingsets_plan(PlannerInfo *root, GroupingSetsPath *best_path) NIL, strat, AGGSPLIT_SIMPLE, - list_length((List *) linitial(rollup->gsets)), + list_length((List *) linitial(rollup->gsets)), new_grpColIdx, - extract_grouping_ops(rollup->groupClause), + extract_grouping_ops(rollup->groupClause), rollup->gsets, NIL, rollup->numGroups, @@ -2931,7 +2931,7 @@ create_indexscan_plan(PlannerInfo *root, indexoid, fixed_indexquals, fixed_indexorderbys, - best_path->indexinfo->indextlist, + best_path->indexinfo->indextlist, best_path->indexscandir); else scan_plan = (Scan *) make_indexscan(tlist, @@ -3192,7 +3192,7 @@ create_bitmap_subplan(PlannerInfo *root, Path *bitmapqual, plan->total_cost = opath->path.total_cost; plan->plan_rows = clamp_row_est(opath->bitmapselectivity * opath->path.parent->tuples); - plan->plan_width = 0; /* meaningless */ + plan->plan_width = 0; /* meaningless */ plan->parallel_aware = false; plan->parallel_safe = opath->path.parallel_safe; } @@ -3678,7 +3678,7 @@ create_worktablescan_plan(PlannerInfo *root, Path *best_path, if (!cteroot) /* shouldn't happen */ elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename); } - if (cteroot->wt_param_id < 0) /* shouldn't happen */ + if (cteroot->wt_param_id < 0) /* shouldn't happen */ elog(ERROR, "could not find param ID for CTE \"%s\"", rte->ctename); /* Sort clauses into best execution order */ @@ -4002,7 +4002,7 @@ create_nestloop_plan(PlannerInfo *root, bms_overlap(((PlaceHolderVar *) nlp->paramval)->phrels, outerrelids) && bms_is_subset(find_placeholder_info(root, - (PlaceHolderVar *) nlp->paramval, + (PlaceHolderVar *) nlp->paramval, false)->ph_eval_at, outerrelids)) { @@ -4079,10 +4079,10 @@ create_mergejoin_plan(PlannerInfo *root, * necessary. */ outer_plan = create_plan_recurse(root, best_path->jpath.outerjoinpath, - (best_path->outersortkeys != NIL) ? CP_SMALL_TLIST : 0); + (best_path->outersortkeys != NIL) ? CP_SMALL_TLIST : 0); inner_plan = create_plan_recurse(root, best_path->jpath.innerjoinpath, - (best_path->innersortkeys != NIL) ? CP_SMALL_TLIST : 0); + (best_path->innersortkeys != NIL) ? CP_SMALL_TLIST : 0); /* Sort join qual clauses into best execution order */ /* NB: do NOT reorder the mergeclauses */ @@ -4127,7 +4127,7 @@ create_mergejoin_plan(PlannerInfo *root, * outer_is_left status. */ mergeclauses = get_switched_clauses(best_path->path_mergeclauses, - best_path->jpath.outerjoinpath->parent->relids); + best_path->jpath.outerjoinpath->parent->relids); /* * Create explicit sort nodes for the outer and inner paths if necessary. @@ -4378,7 +4378,7 @@ create_hashjoin_plan(PlannerInfo *root, * that we don't put extra data in the outer batch files. */ outer_plan = create_plan_recurse(root, best_path->jpath.outerjoinpath, - (best_path->num_batches > 1) ? CP_SMALL_TLIST : 0); + (best_path->num_batches > 1) ? CP_SMALL_TLIST : 0); inner_plan = create_plan_recurse(root, best_path->jpath.innerjoinpath, CP_SMALL_TLIST); @@ -4425,7 +4425,7 @@ create_hashjoin_plan(PlannerInfo *root, * on the left. */ hashclauses = get_switched_clauses(best_path->path_hashclauses, - best_path->jpath.outerjoinpath->parent->relids); + best_path->jpath.outerjoinpath->parent->relids); /* * If there is a single join clause and we can identify the outer variable @@ -4565,8 +4565,8 @@ replace_nestloop_params_mutator(Node *node, PlannerInfo *root) * rels, and then grab its PlaceHolderInfo to tell for sure. */ if (!bms_overlap(phv->phrels, root->curOuterRels) || - !bms_is_subset(find_placeholder_info(root, phv, false)->ph_eval_at, - root->curOuterRels)) + !bms_is_subset(find_placeholder_info(root, phv, false)->ph_eval_at, + root->curOuterRels)) { /* * We can't replace the whole PHV, but we might still need to @@ -5224,7 +5224,7 @@ bitmap_subplan_mark_shared(Plan *plan) { if (IsA(plan, BitmapAnd)) bitmap_subplan_mark_shared( - linitial(((BitmapAnd *) plan)->bitmapplans)); + linitial(((BitmapAnd *) plan)->bitmapplans)); else if (IsA(plan, BitmapOr)) ((BitmapOr *) plan)->isshared = true; else if (IsA(plan, BitmapIndexScan)) @@ -6438,7 +6438,7 @@ prepare_sort_from_pathkeys(Plan *lefttree, List *pathkeys, NULL, true); tlist = lappend(tlist, tle); - lefttree->targetlist = tlist; /* just in case NIL before */ + lefttree->targetlist = tlist; /* just in case NIL before */ #ifdef XCP /* * RemoteSubplan is conditionally projection capable - it is @@ -7241,7 +7241,7 @@ make_modifytable(PlannerInfo *root, node->partitioned_rels = partitioned_rels; node->resultRelations = resultRelations; node->resultRelIndex = -1; /* will be set correctly in setrefs.c */ - node->rootResultRelIndex = -1; /* will be set correctly in setrefs.c */ + node->rootResultRelIndex = -1; /* will be set correctly in setrefs.c */ node->plans = subplans; if (!onconflict) { diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c index ebd442ad4d..987c20ac9f 100644 --- a/src/backend/optimizer/plan/initsplan.c +++ b/src/backend/optimizer/plan/initsplan.c @@ -287,7 +287,7 @@ find_lateral_references(PlannerInfo *root) if (brel == NULL) continue; - Assert(brel->relid == rti); /* sanity check on array */ + Assert(brel->relid == rti); /* sanity check on array */ /* * This bit is less obvious than it might look. We ignore appendrel @@ -436,7 +436,7 @@ create_lateral_join_info(PlannerInfo *root) if (brel == NULL) continue; - Assert(brel->relid == rti); /* sanity check on array */ + Assert(brel->relid == rti); /* sanity check on array */ /* ignore RTEs that are "other rels" */ if (brel->reloptkind != RELOPT_BASEREL) @@ -945,7 +945,7 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join, /* JOIN_RIGHT was eliminated during reduce_outer_joins() */ elog(ERROR, "unrecognized join type: %d", (int) j->jointype); - nonnullable_rels = NULL; /* keep compiler quiet */ + nonnullable_rels = NULL; /* keep compiler quiet */ nullable_rels = NULL; leftjoinlist = rightjoinlist = NIL; break; @@ -1214,7 +1214,7 @@ make_outerjoininfo(PlannerInfo *root, { sjinfo->min_lefthand = bms_copy(left_rels); sjinfo->min_righthand = bms_copy(right_rels); - sjinfo->lhs_strict = false; /* don't care about this */ + sjinfo->lhs_strict = false; /* don't care about this */ return sjinfo; } @@ -2047,7 +2047,7 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause, static bool check_outerjoin_delay(PlannerInfo *root, Relids *relids_p, /* in/out parameter */ - Relids *nullable_relids_p, /* output parameter */ + Relids *nullable_relids_p, /* output parameter */ bool is_pushed_down) { Relids relids; @@ -2223,7 +2223,7 @@ distribute_restrictinfo_to_rels(PlannerInfo *root, restrictinfo); /* Update security level info */ rel->baserestrict_min_security = Min(rel->baserestrict_min_security, - restrictinfo->security_level); + restrictinfo->security_level); break; case BMS_MULTIPLE: @@ -2304,8 +2304,8 @@ process_implied_equality(PlannerInfo *root, * original (this is necessary in case there are subselects in there...) */ clause = make_opclause(opno, - BOOLOID, /* opresulttype */ - false, /* opretset */ + BOOLOID, /* opresulttype */ + false, /* opretset */ copyObject(item1), copyObject(item2), InvalidOid, @@ -2367,8 +2367,8 @@ build_implied_join_equality(Oid opno, * original (this is necessary in case there are subselects in there...) */ clause = make_opclause(opno, - BOOLOID, /* opresulttype */ - false, /* opretset */ + BOOLOID, /* opresulttype */ + false, /* opretset */ copyObject(item1), copyObject(item2), InvalidOid, @@ -2378,12 +2378,12 @@ build_implied_join_equality(Oid opno, * Build the RestrictInfo node itself. */ restrictinfo = make_restrictinfo(clause, - true, /* is_pushed_down */ - false, /* outerjoin_delayed */ - false, /* pseudoconstant */ + true, /* is_pushed_down */ + false, /* outerjoin_delayed */ + false, /* pseudoconstant */ security_level, /* security_level */ qualscope, /* required_relids */ - NULL, /* outer_relids */ + NULL, /* outer_relids */ nullable_relids); /* nullable_relids */ /* Set mergejoinability/hashjoinability flags */ diff --git a/src/backend/optimizer/plan/planagg.c b/src/backend/optimizer/plan/planagg.c index c9331d272a..1f676cd131 100644 --- a/src/backend/optimizer/plan/planagg.c +++ b/src/backend/optimizer/plan/planagg.c @@ -90,8 +90,8 @@ preprocess_minmax_aggregates(PlannerInfo *root, List *tlist) if (!parse->hasAggs) return; - Assert(!parse->setOperations); /* shouldn't get here if a setop */ - Assert(parse->rowMarks == NIL); /* nor if FOR UPDATE */ + Assert(!parse->setOperations); /* shouldn't get here if a setop */ + Assert(parse->rowMarks == NIL); /* nor if FOR UPDATE */ /* * Reject unoptimizable cases. @@ -204,7 +204,7 @@ preprocess_minmax_aggregates(PlannerInfo *root, List *tlist) SS_make_initplan_output_param(root, exprType((Node *) mminfo->target), -1, - exprCollation((Node *) mminfo->target)); + exprCollation((Node *) mminfo->target)); } /* diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index 74de3b818f..f4e0a6ea3d 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -246,7 +246,7 @@ query_planner(PlannerInfo *root, List *tlist, if (brel == NULL) continue; - Assert(brel->relid == rti); /* sanity check on array */ + Assert(brel->relid == rti); /* sanity check on array */ if (IS_SIMPLE_REL(brel)) total_pages += (double) brel->pages; diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index b49a91a3b0..15d4efb52e 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -1470,7 +1470,7 @@ inheritance_planner(PlannerInfo *root) else final_rtable = list_concat(final_rtable, list_copy_tail(subroot->parse->rtable, - list_length(final_rtable))); + list_length(final_rtable))); /* * We need to collect all the RelOptInfos from all child plans into @@ -1702,7 +1702,7 @@ grouping_planner(PlannerInfo *root, bool inheritance_update, translator: %s is a SQL row locking clause such as FOR UPDATE */ errmsg("%s is not allowed with UNION/INTERSECT/EXCEPT", LCS_asString(((RowMarkClause *) - linitial(parse->rowMarks))->strength)))); + linitial(parse->rowMarks))->strength)))); /* * Calculate pathkeys that represent result ordering requirements @@ -2137,7 +2137,7 @@ grouping_planner(PlannerInfo *root, bool inheritance_update, { path = (Path *) create_lockrows_path(root, final_rel, path, root->rowMarks, - SS_assign_special_param(root)); + SS_assign_special_param(root)); } /* @@ -2438,7 +2438,7 @@ preprocess_grouping_sets(PlannerInfo *root) */ gd->hash_sets_idx = remap_to_groupclause_idx(parse->groupClause, gd->unsortable_sets, - gd->tleref_to_colnum_map); + gd->tleref_to_colnum_map); gd->any_hashable = true; } @@ -2644,7 +2644,7 @@ preprocess_rowmarks(PlannerInfo *root) newrc->markType = select_rowmark_type(rte, LCS_NONE); newrc->allMarkTypes = (1 << newrc->markType); newrc->strength = LCS_NONE; - newrc->waitPolicy = LockWaitBlock; /* doesn't matter */ + newrc->waitPolicy = LockWaitBlock; /* doesn't matter */ newrc->isParent = false; prowmarks = lappend(prowmarks, newrc); @@ -2701,7 +2701,7 @@ select_rowmark_type(RangeTblEntry *rte, LockClauseStrength strength) break; } elog(ERROR, "unrecognized LockClauseStrength %d", (int) strength); - return ROW_MARK_EXCLUSIVE; /* keep compiler quiet */ + return ROW_MARK_EXCLUSIVE; /* keep compiler quiet */ } } @@ -2751,7 +2751,7 @@ preprocess_limit(PlannerInfo *root, double tuple_fraction, { *count_est = DatumGetInt64(((Const *) est)->constvalue); if (*count_est <= 0) - *count_est = 1; /* force to at least 1 */ + *count_est = 1; /* force to at least 1 */ } } else @@ -2885,7 +2885,7 @@ preprocess_limit(PlannerInfo *root, double tuple_fraction, /* both fractional, so add them together */ tuple_fraction += limit_fraction; if (tuple_fraction >= 1.0) - tuple_fraction = 0.0; /* assume fetch all */ + tuple_fraction = 0.0; /* assume fetch all */ } } } @@ -3010,7 +3010,7 @@ remove_useless_groupby_columns(PlannerInfo *root) relid = var->varno; Assert(relid <= list_length(parse->rtable)); groupbyattnos[relid] = bms_add_member(groupbyattnos[relid], - var->varattno - FirstLowInvalidHeapAttributeNumber); + var->varattno - FirstLowInvalidHeapAttributeNumber); } /* @@ -3059,7 +3059,7 @@ remove_useless_groupby_columns(PlannerInfo *root) */ if (surplusvars == NULL) surplusvars = (Bitmapset **) palloc0(sizeof(Bitmapset *) * - (list_length(parse->rtable) + 1)); + (list_length(parse->rtable) + 1)); /* Remember the attnos of the removable columns */ surplusvars[relid] = bms_difference(relattnos, pkattnos); @@ -3091,8 +3091,8 @@ remove_useless_groupby_columns(PlannerInfo *root) */ if (!IsA(var, Var) || var->varlevelsup > 0 || - !bms_is_member(var->varattno - FirstLowInvalidHeapAttributeNumber, - surplusvars[var->varno])) + !bms_is_member(var->varattno - FirstLowInvalidHeapAttributeNumber, + surplusvars[var->varno])) new_groupby = lappend(new_groupby, sgc); } @@ -3746,7 +3746,7 @@ create_grouping_paths(PlannerInfo *root, RelOptInfo *grouped_rel; PathTarget *partial_grouping_target = NULL; AggClauseCosts agg_partial_costs; /* parallel only */ - AggClauseCosts agg_final_costs; /* parallel only */ + AggClauseCosts agg_final_costs; /* parallel only */ Size hashaggtablesize; double dNumGroups; double dNumPartialGroups = 0; @@ -3886,7 +3886,7 @@ create_grouping_paths(PlannerInfo *root, */ can_hash = (parse->groupClause != NIL && agg_costs->numOrderedAggs == 0 && - (gd ? gd->any_hashable : grouping_is_hashable(parse->groupClause))); + (gd ? gd->any_hashable : grouping_is_hashable(parse->groupClause))); /* * If grouped_rel->consider_parallel is true, then paths that we generate @@ -4039,9 +4039,9 @@ create_grouping_paths(PlannerInfo *root, create_agg_path(root, grouped_rel, path, - partial_grouping_target, - parse->groupClause ? AGG_SORTED : AGG_PLAIN, - AGGSPLIT_INITIAL_SERIAL, + partial_grouping_target, + parse->groupClause ? AGG_SORTED : AGG_PLAIN, + AGGSPLIT_INITIAL_SERIAL, parse->groupClause, NIL, &agg_partial_costs, @@ -4051,10 +4051,10 @@ create_grouping_paths(PlannerInfo *root, create_group_path(root, grouped_rel, path, - partial_grouping_target, + partial_grouping_target, parse->groupClause, NIL, - dNumPartialGroups)); + dNumPartialGroups)); } } } @@ -4177,7 +4177,7 @@ create_grouping_paths(PlannerInfo *root, grouped_rel, path, target, - parse->groupClause ? AGG_SORTED : AGG_PLAIN, + parse->groupClause ? AGG_SORTED : AGG_PLAIN, AGGSPLIT_SIMPLE, parse->groupClause, (List *) parse->havingQual, @@ -4256,7 +4256,7 @@ create_grouping_paths(PlannerInfo *root, grouped_rel, path, target, - parse->groupClause ? AGG_SORTED : AGG_PLAIN, + parse->groupClause ? AGG_SORTED : AGG_PLAIN, AGGSPLIT_FINAL_DESERIAL, parse->groupClause, (List *) parse->havingQual, @@ -4318,7 +4318,7 @@ create_grouping_paths(PlannerInfo *root, grouped_rel, gmpath, target, - parse->groupClause ? AGG_SORTED : AGG_PLAIN, + parse->groupClause ? AGG_SORTED : AGG_PLAIN, AGGSPLIT_FINAL_DESERIAL, parse->groupClause, (List *) parse->havingQual, @@ -5040,7 +5040,7 @@ consider_groupingsets_paths(PlannerInfo *root, rollup->gsets_data = list_make1(gs); rollup->gsets = remap_to_groupclause_idx(rollup->groupClause, rollup->gsets_data, - gd->tleref_to_colnum_map); + gd->tleref_to_colnum_map); rollup->numGroups = gs->numGroups; rollup->hashable = true; rollup->is_hashed = true; @@ -5170,7 +5170,7 @@ consider_groupingsets_paths(PlannerInfo *root, { double sz = estimate_hashagg_tablesize(path, agg_costs, - rollup->numGroups); + rollup->numGroups); /* * If sz is enormous, but work_mem (and hence scale) is @@ -5204,7 +5204,7 @@ consider_groupingsets_paths(PlannerInfo *root, { if (bms_is_member(i, hash_items)) hash_sets = list_concat(hash_sets, - list_copy(rollup->gsets_data)); + list_copy(rollup->gsets_data)); else rollups = lappend(rollups, rollup); ++i; @@ -5229,7 +5229,7 @@ consider_groupingsets_paths(PlannerInfo *root, rollup->gsets_data = list_make1(gs); rollup->gsets = remap_to_groupclause_idx(rollup->groupClause, rollup->gsets_data, - gd->tleref_to_colnum_map); + gd->tleref_to_colnum_map); rollup->numGroups = gs->numGroups; rollup->hashable = true; rollup->is_hashed = true; @@ -5568,7 +5568,7 @@ create_distinct_paths(PlannerInfo *root, add_path(distinct_rel, (Path *) create_upper_unique_path(root, distinct_rel, path, - list_length(root->distinct_pathkeys), + list_length(root->distinct_pathkeys), numDistinctRows)); } } @@ -5599,7 +5599,7 @@ create_distinct_paths(PlannerInfo *root, add_path(distinct_rel, (Path *) create_upper_unique_path(root, distinct_rel, path, - list_length(root->distinct_pathkeys), + list_length(root->distinct_pathkeys), numDistinctRows)); } @@ -5672,7 +5672,7 @@ create_distinct_paths(PlannerInfo *root, if (distinct_rel->fdwroutine && distinct_rel->fdwroutine->GetForeignUpperPaths) distinct_rel->fdwroutine->GetForeignUpperPaths(root, UPPERREL_DISTINCT, - input_rel, distinct_rel); + input_rel, distinct_rel); /* Let extensions possibly add some more paths */ if (create_upper_paths_hook) @@ -6348,7 +6348,7 @@ make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("could not implement window ORDER BY"), - errdetail("Window ordering columns must be of sortable datatypes."))); + errdetail("Window ordering columns must be of sortable datatypes."))); /* Okay, make the combined pathkeys */ window_sortclauses = list_concat(list_copy(wc->partitionClause), @@ -6449,7 +6449,7 @@ make_sort_input_target(PlannerInfo *root, /* Shouldn't get here unless query has ORDER BY */ Assert(parse->sortClause); - *have_postponed_srfs = false; /* default result */ + *have_postponed_srfs = false; /* default result */ /* Inspect tlist and collect per-column information */ ncols = list_length(final_target->exprs); @@ -6562,7 +6562,7 @@ make_sort_input_target(PlannerInfo *root, postponable_cols = lappend(postponable_cols, expr); else add_column_to_pathtarget(input_target, expr, - get_pathtarget_sortgroupref(final_target, i)); + get_pathtarget_sortgroupref(final_target, i)); i++; } @@ -6616,7 +6616,7 @@ get_cheapest_fractional_path(RelOptInfo *rel, double tuple_fraction) Path *path = (Path *) lfirst(l); if (path == rel->cheapest_total_path || - compare_fractional_path_costs(best_path, path, tuple_fraction) <= 0) + compare_fractional_path_costs(best_path, path, tuple_fraction) <= 0) continue; best_path = path; diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c index 398586e98a..ea495931f6 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -313,7 +313,7 @@ add_rtes_to_flat_rtable(PlannerInfo *root, bool recursing) if (rel != NULL) { - Assert(rel->relid == rti); /* sanity check on array */ + Assert(rel->relid == rti); /* sanity check on array */ /* * The subquery might never have been planned at all, if it @@ -1441,13 +1441,13 @@ fix_expr_common(PlannerInfo *root, Node *node) { set_sa_opfuncid((ScalarArrayOpExpr *) node); record_plan_function_dependency(root, - ((ScalarArrayOpExpr *) node)->opfuncid); + ((ScalarArrayOpExpr *) node)->opfuncid); } else if (IsA(node, ArrayCoerceExpr)) { if (OidIsValid(((ArrayCoerceExpr *) node)->elemfuncid)) record_plan_function_dependency(root, - ((ArrayCoerceExpr *) node)->elemfuncid); + ((ArrayCoerceExpr *) node)->elemfuncid); } else if (IsA(node, Const)) { @@ -1957,7 +1957,7 @@ set_dummy_tlist_references(Plan *plan, int rtoffset) } else { - newvar->varnoold = 0; /* wasn't ever a plain Var */ + newvar->varnoold = 0; /* wasn't ever a plain Var */ newvar->varoattno = 0; } @@ -2186,7 +2186,7 @@ search_indexed_tlist_for_sortgroupref(Expr *node, Var *newvar; newvar = makeVarFromTargetEntry(newvarno, tle); - newvar->varnoold = 0; /* wasn't ever a plain Var */ + newvar->varnoold = 0; /* wasn't ever a plain Var */ newvar->varoattno = 0; return newvar; } @@ -2563,7 +2563,7 @@ record_plan_function_dependency(PlannerInfo *root, Oid funcid) */ inval_item->cacheId = PROCOID; inval_item->hashValue = GetSysCacheHashValue1(PROCOID, - ObjectIdGetDatum(funcid)); + ObjectIdGetDatum(funcid)); root->glob->invalItems = lappend(root->glob->invalItems, inval_item); } diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c index d8545f2bdd..beeebd3a57 100644 --- a/src/backend/optimizer/plan/subselect.c +++ b/src/backend/optimizer/plan/subselect.c @@ -1959,7 +1959,7 @@ replace_correlation_vars_mutator(Node *node, PlannerInfo *root) { if (((PlaceHolderVar *) node)->phlevelsup > 0) return (Node *) replace_outer_placeholdervar(root, - (PlaceHolderVar *) node); + (PlaceHolderVar *) node); } if (IsA(node, Aggref)) { diff --git a/src/backend/optimizer/prep/prepjointree.c b/src/backend/optimizer/prep/prepjointree.c index 41a930428f..74e259a195 100644 --- a/src/backend/optimizer/prep/prepjointree.c +++ b/src/backend/optimizer/prep/prepjointree.c @@ -47,7 +47,7 @@ typedef struct pullup_replace_vars_context RangeTblEntry *target_rte; /* RTE of subquery */ Relids relids; /* relids within subquery, as numbered after * pullup (set only if target_rte->lateral) */ - bool *outer_hasSubLinks; /* -> outer query's hasSubLinks */ + bool *outer_hasSubLinks; /* -> outer query's hasSubLinks */ int varno; /* varno of subquery */ bool need_phvs; /* do we need PlaceHolderVars? */ bool wrap_non_vars; /* do we need 'em on *all* non-Vars? */ @@ -272,7 +272,7 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode, j->quals = pull_up_sublinks_qual_recurse(root, j->quals, &jtlink, bms_union(leftrelids, - rightrelids), + rightrelids), NULL, NULL); break; case JOIN_LEFT: @@ -467,7 +467,7 @@ pull_up_sublinks_qual_recurse(PlannerInfo *root, Node *node, if (sublink->subLinkType == EXISTS_SUBLINK) { if ((j = convert_EXISTS_sublink_to_join(root, sublink, true, - available_rels1)) != NULL) + available_rels1)) != NULL) { /* Yes; insert the new join node into the join tree */ j->larg = *jtlink1; @@ -493,7 +493,7 @@ pull_up_sublinks_qual_recurse(PlannerInfo *root, Node *node, } if (available_rels2 != NULL && (j = convert_EXISTS_sublink_to_join(root, sublink, true, - available_rels2)) != NULL) + available_rels2)) != NULL) { /* Yes; insert the new join node into the join tree */ j->larg = *jtlink2; @@ -775,7 +775,7 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode, if (deletion_ok && !have_undeleted_child) { /* OK to delete this FromExpr entirely */ - root->hasDeletedRTEs = true; /* probably is set already */ + root->hasDeletedRTEs = true; /* probably is set already */ return NULL; } } @@ -796,12 +796,12 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode, */ j->larg = pull_up_subqueries_recurse(root, j->larg, lowest_outer_join, - lowest_nulling_outer_join, + lowest_nulling_outer_join, NULL, true); j->rarg = pull_up_subqueries_recurse(root, j->rarg, lowest_outer_join, - lowest_nulling_outer_join, + lowest_nulling_outer_join, NULL, j->larg != NULL); break; @@ -810,7 +810,7 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode, case JOIN_ANTI: j->larg = pull_up_subqueries_recurse(root, j->larg, j, - lowest_nulling_outer_join, + lowest_nulling_outer_join, NULL, false); j->rarg = pull_up_subqueries_recurse(root, j->rarg, @@ -839,7 +839,7 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode, false); j->rarg = pull_up_subqueries_recurse(root, j->rarg, j, - lowest_nulling_outer_join, + lowest_nulling_outer_join, NULL, false); break; @@ -1019,7 +1019,7 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte, if (rte->lateral) rvcontext.relids = get_relids_in_jointree((Node *) subquery->jointree, true); - else /* won't need relids */ + else /* won't need relids */ rvcontext.relids = NULL; rvcontext.outer_hasSubLinks = &parse->hasSubLinks; rvcontext.varno = varno; @@ -1530,7 +1530,7 @@ is_simple_subquery(Query *subquery, RangeTblEntry *rte, } if (jointree_contains_lateral_outer_refs((Node *) subquery->jointree, - restricted, safe_upper_varnos)) + restricted, safe_upper_varnos)) return false; /* @@ -2098,7 +2098,7 @@ pullup_replace_vars_callback(Var *var, &colnames, &fields); /* Adjust the generated per-field Vars, but don't insert PHVs */ rcon->need_phvs = false; - context->sublevels_up = 0; /* to match the expandRTE output */ + context->sublevels_up = 0; /* to match the expandRTE output */ fields = (List *) replace_rte_variables_mutator((Node *) fields, context); rcon->need_phvs = save_need_phvs; @@ -2202,7 +2202,7 @@ pullup_replace_vars_callback(Var *var, * level-zero var must belong to the subquery. */ if ((rcon->target_rte->lateral ? - bms_overlap(pull_varnos((Node *) newnode), rcon->relids) : + bms_overlap(pull_varnos((Node *) newnode), rcon->relids) : contain_vars_of_level((Node *) newnode, 0)) && !contain_nonstrict_functions((Node *) newnode)) { @@ -2756,7 +2756,7 @@ reduce_outer_joins_pass2(Node *jtnode, { /* OK to merge upper and local constraints */ local_nonnullable_rels = bms_add_members(local_nonnullable_rels, - nonnullable_rels); + nonnullable_rels); local_nonnullable_vars = list_concat(local_nonnullable_vars, nonnullable_vars); local_forced_null_vars = list_concat(local_forced_null_vars, @@ -2801,7 +2801,7 @@ reduce_outer_joins_pass2(Node *jtnode, if (right_state->contains_outer) { - if (jointype != JOIN_FULL) /* ie, INNER/LEFT/SEMI/ANTI */ + if (jointype != JOIN_FULL) /* ie, INNER/LEFT/SEMI/ANTI */ { /* pass appropriate constraints, per comment above */ pass_nonnullable_rels = local_nonnullable_rels; diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c index 4d47272781..b31d5ca334 100644 --- a/src/backend/optimizer/prep/preptlist.c +++ b/src/backend/optimizer/prep/preptlist.c @@ -422,7 +422,7 @@ expand_targetlist(List *tlist, int command_type, attcollation, att_tup->attlen, (Datum) 0, - true, /* isnull */ + true, /* isnull */ att_tup->attbyval); new_expr = coerce_to_domain(new_expr, InvalidOid, -1, @@ -440,7 +440,7 @@ expand_targetlist(List *tlist, int command_type, InvalidOid, sizeof(int32), (Datum) 0, - true, /* isnull */ + true, /* isnull */ true /* byval */ ); } break; @@ -462,7 +462,7 @@ expand_targetlist(List *tlist, int command_type, InvalidOid, sizeof(int32), (Datum) 0, - true, /* isnull */ + true, /* isnull */ true /* byval */ ); } break; diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index 66c684c065..8074a1ec57 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -363,7 +363,7 @@ recurse_set_operations(Node *setOp, PlannerInfo *root, *pNumGroups = subpath->rows; else *pNumGroups = estimate_num_groups(subroot, - get_tlist_exprs(subquery->targetList, false), + get_tlist_exprs(subquery->targetList, false), subpath->rows, NULL); } @@ -792,14 +792,14 @@ generate_nonunion_path(SetOperationStmt *op, PlannerInfo *root, */ use_hash = choose_hashed_setop(root, groupList, path, dNumGroups, dNumOutputRows, - (op->op == SETOP_INTERSECT) ? "INTERSECT" : "EXCEPT"); + (op->op == SETOP_INTERSECT) ? "INTERSECT" : "EXCEPT"); if (!use_hash) path = (Path *) create_sort_path(root, result_rel, path, make_pathkeys_for_sortclauses(root, - groupList, + groupList, tlist), -1.0); @@ -955,7 +955,7 @@ make_union_unique(SetOperationStmt *op, Path *path, List *tlist, result_rel, path, make_pathkeys_for_sortclauses(root, - groupList, + groupList, tlist), -1.0); /* We have to manually jam the right tlist into the path; ick */ @@ -1595,11 +1595,11 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti) if (childOID != parentOID) { childrte->selectedCols = translate_col_privs(rte->selectedCols, - appinfo->translated_vars); + appinfo->translated_vars); childrte->insertedCols = translate_col_privs(rte->insertedCols, - appinfo->translated_vars); + appinfo->translated_vars); childrte->updatedCols = translate_col_privs(rte->updatedCols, - appinfo->translated_vars); + appinfo->translated_vars); } } else @@ -1808,7 +1808,7 @@ translate_col_privs(const Bitmapset *parent_privs, if (bms_is_member(attno - FirstLowInvalidHeapAttributeNumber, parent_privs)) child_privs = bms_add_member(child_privs, - attno - FirstLowInvalidHeapAttributeNumber); + attno - FirstLowInvalidHeapAttributeNumber); } /* Check if parent has whole-row reference */ @@ -1828,7 +1828,7 @@ translate_col_privs(const Bitmapset *parent_privs, bms_is_member(attno - FirstLowInvalidHeapAttributeNumber, parent_privs)) child_privs = bms_add_member(child_privs, - var->varattno - FirstLowInvalidHeapAttributeNumber); + var->varattno - FirstLowInvalidHeapAttributeNumber); } return child_privs; @@ -1995,7 +1995,7 @@ adjust_appendrel_attrs_mutator(Node *node, JoinExpr *j; j = (JoinExpr *) expression_tree_mutator(node, - adjust_appendrel_attrs_mutator, + adjust_appendrel_attrs_mutator, (void *) context); /* now fix JoinExpr's rtindex (probably never happens) */ if (j->rtindex == appinfo->parent_relid) @@ -2008,7 +2008,7 @@ adjust_appendrel_attrs_mutator(Node *node, PlaceHolderVar *phv; phv = (PlaceHolderVar *) expression_tree_mutator(node, - adjust_appendrel_attrs_mutator, + adjust_appendrel_attrs_mutator, (void *) context); /* now fix PlaceHolderVar's relid sets */ if (phv->phlevelsup == 0) diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index a1dafc8e0f..8961ed88a8 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -147,14 +147,14 @@ static Expr *inline_function(Oid funcid, Oid result_type, Oid result_collid, static Node *substitute_actual_parameters(Node *expr, int nargs, List *args, int *usecounts); static Node *substitute_actual_parameters_mutator(Node *node, - substitute_actual_parameters_context *context); + substitute_actual_parameters_context *context); static void sql_inline_error_callback(void *arg); static Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod, Oid result_collation); static Query *substitute_actual_srf_parameters(Query *expr, int nargs, List *args); static Node *substitute_actual_srf_parameters_mutator(Node *node, - substitute_actual_srf_parameters_context *context); + substitute_actual_srf_parameters_context *context); static bool tlist_matches_coltypelist(List *tlist, List *coltypelist); @@ -1011,7 +1011,7 @@ contain_volatile_functions_not_nextval_walker(Node *node, void *context) return false; /* Check for volatile functions in node itself */ if (check_functions_in_node(node, - contain_volatile_functions_not_nextval_checker, + contain_volatile_functions_not_nextval_checker, context)) return true; @@ -1026,11 +1026,11 @@ contain_volatile_functions_not_nextval_walker(Node *node, void *context) { /* Recurse into subselects */ return query_tree_walker((Query *) node, - contain_volatile_functions_not_nextval_walker, + contain_volatile_functions_not_nextval_walker, context, 0); } return expression_tree_walker(node, - contain_volatile_functions_not_nextval_walker, + contain_volatile_functions_not_nextval_walker, context); } @@ -1399,7 +1399,7 @@ contain_context_dependent_node(Node *clause) return contain_context_dependent_node_walker(clause, &flags); } -#define CCDN_IN_CASEEXPR 0x0001 /* CaseTestExpr okay here? */ +#define CCDN_IN_CASEEXPR 0x0001 /* CaseTestExpr okay here? */ static bool contain_context_dependent_node_walker(Node *node, int *flags) @@ -1432,7 +1432,7 @@ contain_context_dependent_node_walker(Node *node, int *flags) */ *flags |= CCDN_IN_CASEEXPR; res = expression_tree_walker(node, - contain_context_dependent_node_walker, + contain_context_dependent_node_walker, (void *) flags); *flags = save_flags; return res; @@ -2434,7 +2434,7 @@ estimate_expression_value(PlannerInfo *root, Node *node) { eval_const_expressions_context context; - context.boundParams = root->glob->boundParams; /* bound Params */ + context.boundParams = root->glob->boundParams; /* bound Params */ /* we do not need to mark the plan as depending on inlined functions */ context.root = NULL; context.active_fns = NIL; /* nothing being recursively simplified */ @@ -2675,7 +2675,7 @@ eval_const_expressions_mutator(Node *node, * self. */ args = (List *) expression_tree_mutator((Node *) expr->args, - eval_const_expressions_mutator, + eval_const_expressions_mutator, (void *) context); /* @@ -2712,8 +2712,8 @@ eval_const_expressions_mutator(Node *node, * Need to get OID of underlying function. Okay to * scribble on input to this extent. */ - set_opfuncid((OpExpr *) expr); /* rely on struct - * equivalence */ + set_opfuncid((OpExpr *) expr); /* rely on struct + * equivalence */ /* * Code for op/func reduction is pretty bulky, so split it @@ -2943,7 +2943,7 @@ eval_const_expressions_mutator(Node *node, -1, InvalidOid, sizeof(Oid), - ObjectIdGetDatum(intypioparam), + ObjectIdGetDatum(intypioparam), false, true), makeConst(INT4OID, @@ -3009,7 +3009,7 @@ eval_const_expressions_mutator(Node *node, */ if (arg && IsA(arg, Const) && (!OidIsValid(newexpr->elemfuncid) || - func_volatile(newexpr->elemfuncid) == PROVOLATILE_IMMUTABLE)) + func_volatile(newexpr->elemfuncid) == PROVOLATILE_IMMUTABLE)) return (Node *) evaluate_expr((Expr *) newexpr, newexpr->resulttype, newexpr->resulttypmod, @@ -3114,7 +3114,7 @@ eval_const_expressions_mutator(Node *node, if (newarg && IsA(newarg, Const)) { context->case_val = newarg; - newarg = NULL; /* not needed anymore, see above */ + newarg = NULL; /* not needed anymore, see above */ } else context->case_val = NULL; @@ -3286,7 +3286,7 @@ eval_const_expressions_mutator(Node *node, if (newargs == NIL) return (Node *) makeNullConst(coalesceexpr->coalescetype, -1, - coalesceexpr->coalescecollid); + coalesceexpr->coalescecollid); newcoalesce = makeNode(CoalesceExpr); newcoalesce->coalescetype = coalesceexpr->coalescetype; @@ -3365,7 +3365,7 @@ eval_const_expressions_mutator(Node *node, fselect->fieldnum <= list_length(rowexpr->args)) { Node *fld = (Node *) list_nth(rowexpr->args, - fselect->fieldnum - 1); + fselect->fieldnum - 1); if (rowtype_field_matches(rowexpr->row_typeid, fselect->fieldnum, @@ -3463,7 +3463,7 @@ eval_const_expressions_mutator(Node *node, default: elog(ERROR, "unrecognized nulltesttype: %d", (int) ntest->nulltesttype); - result = false; /* keep compiler quiet */ + result = false; /* keep compiler quiet */ break; } @@ -3517,7 +3517,7 @@ eval_const_expressions_mutator(Node *node, default: elog(ERROR, "unrecognized booltesttype: %d", (int) btest->booltesttype); - result = false; /* keep compiler quiet */ + result = false; /* keep compiler quiet */ break; } @@ -3900,7 +3900,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod, { args = expand_function_arguments(args, result_type, func_tuple); args = (List *) expression_tree_mutator((Node *) args, - eval_const_expressions_mutator, + eval_const_expressions_mutator, (void *) context); /* Argument processing done, give it back to the caller */ *args_p = args; @@ -4263,7 +4263,7 @@ evaluate_function(Oid funcid, Oid result_type, int32 result_typmod, newexpr->funcretset = false; newexpr->funcvariadic = funcvariadic; newexpr->funcformat = COERCE_EXPLICIT_CALL; /* doesn't matter */ - newexpr->funccollid = result_collid; /* doesn't matter */ + newexpr->funccollid = result_collid; /* doesn't matter */ newexpr->inputcollid = input_collid; newexpr->args = args; newexpr->location = -1; @@ -4623,7 +4623,7 @@ substitute_actual_parameters(Node *expr, int nargs, List *args, static Node * substitute_actual_parameters_mutator(Node *node, - substitute_actual_parameters_context *context) + substitute_actual_parameters_context *context) { if (node == NULL) return NULL; @@ -4943,7 +4943,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte) querytree_list = pg_analyze_and_rewrite_params(linitial(raw_parsetree_list), src, - (ParserSetupHook) sql_fn_parser_setup, + (ParserSetupHook) sql_fn_parser_setup, pinfo, NULL); if (list_length(querytree_list) != 1) goto fail; @@ -5066,7 +5066,7 @@ substitute_actual_srf_parameters(Query *expr, int nargs, List *args) static Node * substitute_actual_srf_parameters_mutator(Node *node, - substitute_actual_srf_parameters_context *context) + substitute_actual_srf_parameters_context *context) { Node *result; @@ -5076,7 +5076,7 @@ substitute_actual_srf_parameters_mutator(Node *node, { context->sublevels_up++; result = (Node *) query_tree_mutator((Query *) node, - substitute_actual_srf_parameters_mutator, + substitute_actual_srf_parameters_mutator, (void *) context, 0); context->sublevels_up--; diff --git a/src/backend/optimizer/util/orclauses.c b/src/backend/optimizer/util/orclauses.c index b6867e3001..9aa661c909 100644 --- a/src/backend/optimizer/util/orclauses.c +++ b/src/backend/optimizer/util/orclauses.c @@ -84,7 +84,7 @@ extract_restriction_or_clauses(PlannerInfo *root) if (rel == NULL) continue; - Assert(rel->relid == rti); /* sanity check on array */ + Assert(rel->relid == rti); /* sanity check on array */ /* ignore RTEs that are "other rels" */ if (rel->reloptkind != RELOPT_BASEREL) @@ -233,7 +233,7 @@ extract_or_clause(RestrictInfo *or_rinfo, RelOptInfo *rel) subclause = (Node *) make_ands_explicit(subclauses); if (or_clause(subclause)) clauselist = list_concat(clauselist, - list_copy(((BoolExpr *) subclause)->args)); + list_copy(((BoolExpr *) subclause)->args)); else clauselist = lappend(clauselist, subclause); } diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index 0ccf4bd47d..8d99cf9b34 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -429,7 +429,7 @@ set_cheapest(RelOptInfo *parent_rel) void add_path(RelOptInfo *parent_rel, Path *new_path) { - bool accept_new = true; /* unless we find a superior old path */ + bool accept_new = true; /* unless we find a superior old path */ ListCell *insert_after = NULL; /* where to insert new item */ List *new_path_pathkeys; ListCell *p1; @@ -495,14 +495,14 @@ add_path(RelOptInfo *parent_rel, Path *new_path) { case COSTS_EQUAL: outercmp = bms_subset_compare(PATH_REQ_OUTER(new_path), - PATH_REQ_OUTER(old_path)); + PATH_REQ_OUTER(old_path)); if (keyscmp == PATHKEYS_BETTER1) { if ((outercmp == BMS_EQUAL || outercmp == BMS_SUBSET1) && new_path->rows <= old_path->rows && new_path->parallel_safe >= old_path->parallel_safe) - remove_old = true; /* new dominates old */ + remove_old = true; /* new dominates old */ } else if (keyscmp == PATHKEYS_BETTER2) { @@ -510,7 +510,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path) outercmp == BMS_SUBSET2) && new_path->rows >= old_path->rows && new_path->parallel_safe <= old_path->parallel_safe) - accept_new = false; /* old dominates new */ + accept_new = false; /* old dominates new */ } else /* keyscmp == PATHKEYS_EQUAL */ { @@ -543,7 +543,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path) accept_new = false; /* old dominates new */ else if (compare_path_costs_fuzzily(new_path, old_path, - 1.0000000001) == COSTS_BETTER1) + 1.0000000001) == COSTS_BETTER1) remove_old = true; /* new dominates old */ else accept_new = false; /* old equals or @@ -552,11 +552,11 @@ add_path(RelOptInfo *parent_rel, Path *new_path) else if (outercmp == BMS_SUBSET1 && new_path->rows <= old_path->rows && new_path->parallel_safe >= old_path->parallel_safe) - remove_old = true; /* new dominates old */ + remove_old = true; /* new dominates old */ else if (outercmp == BMS_SUBSET2 && new_path->rows >= old_path->rows && new_path->parallel_safe <= old_path->parallel_safe) - accept_new = false; /* old dominates new */ + accept_new = false; /* old dominates new */ /* else different parameterizations, keep both */ } break; @@ -564,24 +564,24 @@ add_path(RelOptInfo *parent_rel, Path *new_path) if (keyscmp != PATHKEYS_BETTER2) { outercmp = bms_subset_compare(PATH_REQ_OUTER(new_path), - PATH_REQ_OUTER(old_path)); + PATH_REQ_OUTER(old_path)); if ((outercmp == BMS_EQUAL || outercmp == BMS_SUBSET1) && new_path->rows <= old_path->rows && new_path->parallel_safe >= old_path->parallel_safe) - remove_old = true; /* new dominates old */ + remove_old = true; /* new dominates old */ } break; case COSTS_BETTER2: if (keyscmp != PATHKEYS_BETTER1) { outercmp = bms_subset_compare(PATH_REQ_OUTER(new_path), - PATH_REQ_OUTER(old_path)); + PATH_REQ_OUTER(old_path)); if ((outercmp == BMS_EQUAL || outercmp == BMS_SUBSET2) && new_path->rows >= old_path->rows && new_path->parallel_safe <= old_path->parallel_safe) - accept_new = false; /* old dominates new */ + accept_new = false; /* old dominates new */ } break; case COSTS_DIFFERENT: @@ -769,7 +769,7 @@ add_path_precheck(RelOptInfo *parent_rel, void add_partial_path(RelOptInfo *parent_rel, Path *new_path) { - bool accept_new = true; /* unless we find a superior old path */ + bool accept_new = true; /* unless we find a superior old path */ ListCell *insert_after = NULL; /* where to insert new item */ ListCell *p1; ListCell *p1_prev; @@ -2264,7 +2264,7 @@ create_bitmap_heap_path(PlannerInfo *root, pathnode->path.parallel_aware = parallel_degree > 0 ? true : false; pathnode->path.parallel_safe = rel->consider_parallel; pathnode->path.parallel_workers = parallel_degree; - pathnode->path.pathkeys = NIL; /* always unordered */ + pathnode->path.pathkeys = NIL; /* always unordered */ pathnode->bitmapqual = bitmapqual; @@ -2314,7 +2314,7 @@ create_bitmap_and_path(PlannerInfo *root, pathnode->path.parallel_safe = rel->consider_parallel; pathnode->path.parallel_workers = 0; - pathnode->path.pathkeys = NIL; /* always unordered */ + pathnode->path.pathkeys = NIL; /* always unordered */ pathnode->bitmapquals = bitmapquals; @@ -2354,7 +2354,7 @@ create_bitmap_or_path(PlannerInfo *root, pathnode->path.parallel_safe = rel->consider_parallel; pathnode->path.parallel_workers = 0; - pathnode->path.pathkeys = NIL; /* always unordered */ + pathnode->path.pathkeys = NIL; /* always unordered */ pathnode->bitmapquals = bitmapquals; @@ -2386,7 +2386,7 @@ create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals, pathnode->path.parallel_aware = false; pathnode->path.parallel_safe = rel->consider_parallel; pathnode->path.parallel_workers = 0; - pathnode->path.pathkeys = NIL; /* always unordered */ + pathnode->path.pathkeys = NIL; /* always unordered */ pathnode->tidquals = tidquals; @@ -2429,8 +2429,7 @@ create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer, pathnode->path.parallel_aware = false; pathnode->path.parallel_safe = rel->consider_parallel; pathnode->path.parallel_workers = parallel_workers; - pathnode->path.pathkeys = NIL; /* result is always considered - * unsorted */ + pathnode->path.pathkeys = NIL; /* result is always considered unsorted */ #ifdef XCP /* * Append path is used to implement scans of inherited tables and some @@ -2500,7 +2499,6 @@ create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer, pathnode->path.distribution = distribution; } #endif - pathnode->partitioned_rels = list_copy(partitioned_rels); pathnode->subpaths = subpaths; @@ -2668,7 +2666,7 @@ create_merge_append_path(PlannerInfo *root, else { /* We'll need to insert a Sort node, so include cost for that */ - Path sort_path; /* dummy for result of cost_sort */ + Path sort_path; /* dummy for result of cost_sort */ cost_sort(&sort_path, root, @@ -3109,7 +3107,7 @@ create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath, pathnode->path.parallel_aware = false; pathnode->path.parallel_safe = false; pathnode->path.parallel_workers = 0; - pathnode->path.pathkeys = NIL; /* Gather has unordered result */ + pathnode->path.pathkeys = NIL; /* Gather has unordered result */ /* distribution is the same as in the subpath */ pathnode->path.distribution = (Distribution *) copyObject(subpath->distribution); @@ -4279,8 +4277,8 @@ create_groupingsets_path(PlannerInfo *root, } else { - Path sort_path; /* dummy for result of cost_sort */ - Path agg_path; /* dummy for result of cost_agg */ + Path sort_path; /* dummy for result of cost_sort */ + Path agg_path; /* dummy for result of cost_agg */ if (rollup->is_hashed || is_first_sort) { @@ -4637,6 +4635,9 @@ create_lockrows_path(PlannerInfo *root, RelOptInfo *rel, * 'operation' is the operation type * 'canSetTag' is true if we set the command tag/es_processed * 'nominalRelation' is the parent RT index for use of EXPLAIN + * 'partitioned_rels' is an integer list of RT indexes of non-leaf tables in + * the partition tree, if this is an UPDATE/DELETE to a partitioned table. + * Otherwise NIL. * 'resultRelations' is an integer list of actual RT indexes of target rel(s) * 'subpaths' is a list of Path(s) producing source data (one per rel) * 'subroots' is a list of PlannerInfo structs (one per rel) diff --git a/src/backend/optimizer/util/placeholder.c b/src/backend/optimizer/util/placeholder.c index 698a387ac2..970542dde5 100644 --- a/src/backend/optimizer/util/placeholder.c +++ b/src/backend/optimizer/util/placeholder.c @@ -101,7 +101,7 @@ find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv, rels_used = pull_varnos((Node *) phv->phexpr); phinfo->ph_lateral = bms_difference(rels_used, phv->phrels); if (bms_is_empty(phinfo->ph_lateral)) - phinfo->ph_lateral = NULL; /* make it exactly NULL if empty */ + phinfo->ph_lateral = NULL; /* make it exactly NULL if empty */ phinfo->ph_eval_at = bms_int_members(rels_used, phv->phrels); /* If no contained vars, force evaluation at syntactic location */ if (bms_is_empty(phinfo->ph_eval_at)) diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index dec1589ec5..32dcb5f877 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -357,8 +357,8 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, /* Build targetlist using the completed indexprs data */ info->indextlist = build_index_tlist(root, info, relation); - info->indrestrictinfo = NIL; /* set later, in indxpath.c */ - info->predOK = false; /* set later, in indxpath.c */ + info->indrestrictinfo = NIL; /* set later, in indxpath.c */ + info->predOK = false; /* set later, in indxpath.c */ info->unique = index->indisunique; info->immediate = index->indimmediate; info->hypothetical = false; @@ -633,7 +633,7 @@ infer_arbiter_indexes(PlannerInfo *root) errmsg("whole row unique index inference specifications are not supported"))); inferAttrs = bms_add_member(inferAttrs, - attno - FirstLowInvalidHeapAttributeNumber); + attno - FirstLowInvalidHeapAttributeNumber); } /* @@ -728,7 +728,7 @@ infer_arbiter_indexes(PlannerInfo *root) if (attno != 0) indexedAttrs = bms_add_member(indexedAttrs, - attno - FirstLowInvalidHeapAttributeNumber); + attno - FirstLowInvalidHeapAttributeNumber); } /* Non-expression attributes (if any) must match */ @@ -840,7 +840,7 @@ infer_collation_opclass_match(InferenceElem *elem, Relation idxRel, List *idxExprs) { AttrNumber natt; - Oid inferopfamily = InvalidOid; /* OID of opclass opfamily */ + Oid inferopfamily = InvalidOid; /* OID of opclass opfamily */ Oid inferopcinputtype = InvalidOid; /* OID of opclass input type */ int nplain = 0; /* # plain attrs observed */ @@ -1632,7 +1632,7 @@ build_index_tlist(PlannerInfo *root, IndexOptInfo *index, if (indexkey < 0) att_tup = SystemAttributeDefinition(indexkey, - heapRelation->rd_rel->relhasoids); + heapRelation->rd_rel->relhasoids); else att_tup = heapRelation->rd_att->attrs[indexkey - 1]; diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c index 06fce8458c..536d24b698 100644 --- a/src/backend/optimizer/util/predtest.c +++ b/src/backend/optimizer/util/predtest.c @@ -382,7 +382,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate, iterate_end(pred_info); if (!presult) { - result = false; /* doesn't imply any of B's */ + result = false; /* doesn't imply any of B's */ break; } } @@ -650,7 +650,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate, iterate_end(pred_info); if (!presult) { - result = false; /* citem refutes nothing */ + result = false; /* citem refutes nothing */ break; } } @@ -1360,12 +1360,12 @@ static const bool BT_implies_table[6][6] = { * The predicate operator: * LT LE EQ GE GT NE */ - {TRUE, TRUE, none, none, none, TRUE}, /* LT */ - {none, TRUE, none, none, none, none}, /* LE */ - {none, TRUE, TRUE, TRUE, none, none}, /* EQ */ - {none, none, none, TRUE, none, none}, /* GE */ - {none, none, none, TRUE, TRUE, TRUE}, /* GT */ - {none, none, none, none, none, TRUE} /* NE */ + {TRUE, TRUE, none, none, none, TRUE}, /* LT */ + {none, TRUE, none, none, none, none}, /* LE */ + {none, TRUE, TRUE, TRUE, none, none}, /* EQ */ + {none, none, none, TRUE, none, none}, /* GE */ + {none, none, none, TRUE, TRUE, TRUE}, /* GT */ + {none, none, none, none, none, TRUE} /* NE */ }; static const bool BT_refutes_table[6][6] = { @@ -1373,12 +1373,12 @@ static const bool BT_refutes_table[6][6] = { * The predicate operator: * LT LE EQ GE GT NE */ - {none, none, TRUE, TRUE, TRUE, none}, /* LT */ - {none, none, none, none, TRUE, none}, /* LE */ - {TRUE, none, none, none, TRUE, TRUE}, /* EQ */ - {TRUE, none, none, none, none, none}, /* GE */ - {TRUE, TRUE, TRUE, none, none, none}, /* GT */ - {none, none, TRUE, none, none, none} /* NE */ + {none, none, TRUE, TRUE, TRUE, none}, /* LT */ + {none, none, none, none, TRUE, none}, /* LE */ + {TRUE, none, none, none, TRUE, TRUE}, /* EQ */ + {TRUE, none, none, none, none, none}, /* GE */ + {TRUE, TRUE, TRUE, none, none, none}, /* GT */ + {none, none, TRUE, none, none, none} /* NE */ }; static const StrategyNumber BT_implic_table[6][6] = { @@ -1386,12 +1386,12 @@ static const StrategyNumber BT_implic_table[6][6] = { * The predicate operator: * LT LE EQ GE GT NE */ - {BTGE, BTGE, none, none, none, BTGE}, /* LT */ - {BTGT, BTGE, none, none, none, BTGT}, /* LE */ - {BTGT, BTGE, BTEQ, BTLE, BTLT, BTNE}, /* EQ */ - {none, none, none, BTLE, BTLT, BTLT}, /* GE */ - {none, none, none, BTLE, BTLE, BTLE}, /* GT */ - {none, none, none, none, none, BTEQ} /* NE */ + {BTGE, BTGE, none, none, none, BTGE}, /* LT */ + {BTGT, BTGE, none, none, none, BTGT}, /* LE */ + {BTGT, BTGE, BTEQ, BTLE, BTLT, BTNE}, /* EQ */ + {none, none, none, BTLE, BTLT, BTLT}, /* GE */ + {none, none, none, BTLE, BTLE, BTLE}, /* GT */ + {none, none, none, none, none, BTEQ} /* NE */ }; static const StrategyNumber BT_refute_table[6][6] = { @@ -1399,12 +1399,12 @@ static const StrategyNumber BT_refute_table[6][6] = { * The predicate operator: * LT LE EQ GE GT NE */ - {none, none, BTGE, BTGE, BTGE, none}, /* LT */ - {none, none, BTGT, BTGT, BTGE, none}, /* LE */ - {BTLE, BTLT, BTNE, BTGT, BTGE, BTEQ}, /* EQ */ - {BTLE, BTLT, BTLT, none, none, none}, /* GE */ - {BTLE, BTLE, BTLE, none, none, none}, /* GT */ - {none, none, BTEQ, none, none, none} /* NE */ + {none, none, BTGE, BTGE, BTGE, none}, /* LT */ + {none, none, BTGT, BTGT, BTGE, none}, /* LE */ + {BTLE, BTLT, BTNE, BTGT, BTGE, BTEQ}, /* EQ */ + {BTLE, BTLT, BTLT, none, none, none}, /* GE */ + {BTLE, BTLE, BTLE, none, none, none}, /* GT */ + {none, none, BTEQ, none, none, none} /* NE */ }; @@ -1804,7 +1804,7 @@ lookup_proof_cache(Oid pred_op, Oid clause_op, bool refute_it) clause_op_infos = get_op_btree_interpretation(clause_op); if (clause_op_infos) pred_op_infos = get_op_btree_interpretation(pred_op); - else /* no point in looking */ + else /* no point in looking */ pred_op_infos = NIL; foreach(lcp, pred_op_infos) diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index 3ab5ceb7d3..a9ec1f9dea 100644 --- a/src/backend/optimizer/util/relnode.c +++ b/src/backend/optimizer/util/relnode.c @@ -111,8 +111,8 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent) rel->rows = 0; /* cheap startup cost is interesting iff not all tuples to be retrieved */ rel->consider_startup = (root->tuple_fraction > 0); - rel->consider_param_startup = false; /* might get changed later */ - rel->consider_parallel = false; /* might get changed later */ + rel->consider_param_startup = false; /* might get changed later */ + rel->consider_parallel = false; /* might get changed later */ rel->reltarget = create_empty_pathtarget(); rel->pathlist = NIL; rel->ppilist = NIL; @@ -135,7 +135,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent) rel->allvisfrac = 0; rel->subroot = NULL; rel->subplan_params = NIL; - rel->rel_parallel_workers = -1; /* set up in get_relation_info */ + rel->rel_parallel_workers = -1; /* set up in get_relation_info */ rel->serverid = InvalidOid; rel->userid = rte->checkAsUser; rel->useridiscurrent = false; @@ -282,7 +282,7 @@ build_join_rel_hash(PlannerInfo *root) hashtab = hash_create("JoinRelHashTable", 256L, &hash_ctl, - HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); + HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); /* Insert all the already-existing joinrels */ foreach(l, root->join_rel_list) @@ -947,7 +947,7 @@ fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids) /* cheap startup cost is interesting iff not all tuples to be retrieved */ upperrel->consider_startup = (root->tuple_fraction > 0); upperrel->consider_param_startup = false; - upperrel->consider_parallel = false; /* might get changed later */ + upperrel->consider_parallel = false; /* might get changed later */ upperrel->reltarget = create_empty_pathtarget(); upperrel->pathlist = NIL; upperrel->cheapest_startup_path = NULL; diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c index e946290af5..ebae0cd8ce 100644 --- a/src/backend/optimizer/util/restrictinfo.c +++ b/src/backend/optimizer/util/restrictinfo.c @@ -114,7 +114,7 @@ make_restrictinfo_internal(Expr *clause, restrictinfo->is_pushed_down = is_pushed_down; restrictinfo->outerjoin_delayed = outerjoin_delayed; restrictinfo->pseudoconstant = pseudoconstant; - restrictinfo->can_join = false; /* may get set below */ + restrictinfo->can_join = false; /* may get set below */ restrictinfo->security_level = security_level; restrictinfo->outer_relids = outer_relids; restrictinfo->nullable_relids = nullable_relids; @@ -127,7 +127,7 @@ make_restrictinfo_internal(Expr *clause, if (security_level > 0) restrictinfo->leakproof = !contain_leaked_vars((Node *) clause); else - restrictinfo->leakproof = false; /* really, "don't know" */ + restrictinfo->leakproof = false; /* really, "don't know" */ /* * If it's a binary opclause, set up left/right relids info. In any case diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c index 09523853d0..9345891380 100644 --- a/src/backend/optimizer/util/tlist.c +++ b/src/backend/optimizer/util/tlist.c @@ -28,12 +28,12 @@ /* Workspace for split_pathtarget_walker */ typedef struct { - List *input_target_exprs; /* exprs available from input */ + List *input_target_exprs; /* exprs available from input */ List *level_srfs; /* list of lists of SRF exprs */ - List *level_input_vars; /* vars needed by SRFs of each level */ - List *level_input_srfs; /* SRFs needed by SRFs of each level */ - List *current_input_vars; /* vars needed in current subexpr */ - List *current_input_srfs; /* SRFs needed in current subexpr */ + List *level_input_vars; /* vars needed by SRFs of each level */ + List *level_input_srfs; /* SRFs needed by SRFs of each level */ + List *current_input_vars; /* vars needed in current subexpr */ + List *current_input_srfs; /* SRFs needed in current subexpr */ int current_depth; /* max SRF depth in current subexpr */ } split_pathtarget_context; @@ -145,7 +145,7 @@ add_to_flat_tlist(List *tlist, List *exprs) { TargetEntry *tle; - tle = makeTargetEntry(copyObject(expr), /* copy needed?? */ + tle = makeTargetEntry(copyObject(expr), /* copy needed?? */ next_resno++, NULL, false); diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c index cf326ae003..b8d7d3ffad 100644 --- a/src/backend/optimizer/util/var.c +++ b/src/backend/optimizer/util/var.c @@ -62,8 +62,8 @@ typedef struct { PlannerInfo *root; int sublevels_up; - bool possible_sublink; /* could aliases include a SubLink? */ - bool inserted_sublink; /* have we inserted a SubLink? */ + bool possible_sublink; /* could aliases include a SubLink? */ + bool inserted_sublink; /* have we inserted a SubLink? */ } flatten_join_alias_vars_context; static bool pull_varnos_walker(Node *node, @@ -240,7 +240,7 @@ pull_varattnos_walker(Node *node, pull_varattnos_context *context) if (var->varno == context->varno && var->varlevelsup == 0) context->varattnos = bms_add_member(context->varattnos, - var->varattno - FirstLowInvalidHeapAttributeNumber); + var->varattno - FirstLowInvalidHeapAttributeNumber); return false; } @@ -778,7 +778,7 @@ flatten_join_alias_vars_mutator(Node *node, PlaceHolderVar *phv; phv = (PlaceHolderVar *) expression_tree_mutator(node, - flatten_join_alias_vars_mutator, + flatten_join_alias_vars_mutator, (void *) context); /* now fix PlaceHolderVar's relid sets */ if (phv->phlevelsup == context->sublevels_up) diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 020d6f74c4..fb6250efb1 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -302,7 +302,7 @@ transformStmt(ParseState *pstate, Node *parseTree) default: break; } -#endif /* RAW_EXPRESSION_COVERAGE_TEST */ +#endif /* RAW_EXPRESSION_COVERAGE_TEST */ switch (nodeTag(parseTree)) { @@ -339,7 +339,7 @@ transformStmt(ParseState *pstate, Node *parseTree) */ case T_DeclareCursorStmt: result = transformDeclareCursorStmt(pstate, - (DeclareCursorStmt *) parseTree); + (DeclareCursorStmt *) parseTree); break; case T_ExplainStmt: @@ -356,7 +356,7 @@ transformStmt(ParseState *pstate, Node *parseTree) case T_CreateTableAsStmt: result = transformCreateTableAsStmt(pstate, - (CreateTableAsStmt *) parseTree); + (CreateTableAsStmt *) parseTree); break; default: @@ -542,7 +542,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) qry->override = stmt->override; isOnConflictUpdate = (stmt->onConflictClause && - stmt->onConflictClause->action == ONCONFLICT_UPDATE); + stmt->onConflictClause->action == ONCONFLICT_UPDATE); /* * We have three cases to deal with: DEFAULT VALUES (selectStmt == NULL), @@ -891,7 +891,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt) qry->targetList = lappend(qry->targetList, tle); rte->insertedCols = bms_add_member(rte->insertedCols, - attr_num - FirstLowInvalidHeapAttributeNumber); + attr_num - FirstLowInvalidHeapAttributeNumber); icols = lnext(icols); attnos = lnext(attnos); @@ -970,7 +970,7 @@ transformInsertRow(ParseState *pstate, List *exprlist, errmsg("INSERT has more expressions than target columns"), parser_errposition(pstate, exprLocation(list_nth(exprlist, - list_length(icolumns)))))); + list_length(icolumns)))))); if (stmtcols != NIL && list_length(exprlist) < list_length(icolumns)) { @@ -992,7 +992,7 @@ transformInsertRow(ParseState *pstate, List *exprlist, errhint("The insertion source is a row expression containing the same number of columns expected by the INSERT. Did you accidentally use extra parentheses?") : 0), parser_errposition(pstate, exprLocation(list_nth(icolumns, - list_length(exprlist)))))); + list_length(exprlist)))))); } /* @@ -1251,7 +1251,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt) (errcode(ERRCODE_SYNTAX_ERROR), errmsg("SELECT ... INTO is not allowed here"), parser_errposition(pstate, - exprLocation((Node *) stmt->intoClause)))); + exprLocation((Node *) stmt->intoClause)))); /* make FOR UPDATE/FOR SHARE info available to addRangeTableEntry */ pstate->p_locking_clause = stmt->lockingClause; @@ -1580,7 +1580,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt) translator: %s is a SQL row locking clause such as FOR UPDATE */ errmsg("%s cannot be applied to VALUES", LCS_asString(((LockingClause *) - linitial(stmt->lockingClause))->strength)))); + linitial(stmt->lockingClause))->strength)))); qry->rtable = pstate->p_rtable; qry->jointree = makeFromExpr(pstate->p_joinlist, NULL); @@ -1648,7 +1648,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt) (errcode(ERRCODE_SYNTAX_ERROR), errmsg("SELECT ... INTO is not allowed here"), parser_errposition(pstate, - exprLocation((Node *) leftmostSelect->intoClause)))); + exprLocation((Node *) leftmostSelect->intoClause)))); /* * We need to extract ORDER BY and other top-level clauses here and not @@ -1801,7 +1801,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt) errdetail("Only result column names can be used, not expressions or functions."), errhint("Add the expression/function to every SELECT, or move the UNION into a FROM clause."), parser_errposition(pstate, - exprLocation(list_nth(qry->targetList, tllen))))); + exprLocation(list_nth(qry->targetList, tllen))))); qry->limitOffset = transformLimitClause(pstate, limitOffset, EXPR_KIND_OFFSET, "OFFSET"); @@ -1862,7 +1862,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("INTO is only allowed on first SELECT of UNION/INTERSECT/EXCEPT"), parser_errposition(pstate, - exprLocation((Node *) stmt->intoClause)))); + exprLocation((Node *) stmt->intoClause)))); /* We don't support FOR UPDATE/SHARE with set ops at the moment. */ if (stmt->lockingClause) @@ -1872,7 +1872,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, translator: %s is a SQL row locking clause such as FOR UPDATE */ errmsg("%s is not allowed with UNION/INTERSECT/EXCEPT", LCS_asString(((LockingClause *) - linitial(stmt->lockingClause))->strength)))); + linitial(stmt->lockingClause))->strength)))); /* * If an internal node of a set-op tree has ORDER BY, LIMIT, FOR UPDATE, @@ -1934,7 +1934,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), errmsg("UNION/INTERSECT/EXCEPT member statement cannot refer to other relations of same query level"), parser_errposition(pstate, - locate_var_of_level((Node *) selectQuery, 1)))); + locate_var_of_level((Node *) selectQuery, 1)))); } /* @@ -2021,8 +2021,8 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, if (list_length(ltargetlist) != list_length(rtargetlist)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("each %s query must have the same number of columns", - context), + errmsg("each %s query must have the same number of columns", + context), parser_errposition(pstate, exprLocation((Node *) rtargetlist)))); @@ -2119,8 +2119,8 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, * collation.) */ rescolcoll = select_common_collation(pstate, - list_make2(lcolnode, rcolnode), - (op->op == SETOP_UNION && op->all)); + list_make2(lcolnode, rcolnode), + (op->op == SETOP_UNION && op->all)); /* emit results */ op->colTypes = lappend_oid(op->colTypes, rescoltype); @@ -2155,7 +2155,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, grpcl->tleSortGroupRef = 0; grpcl->eqop = eqop; grpcl->sortop = sortop; - grpcl->nulls_first = false; /* OK with or without sortop */ + grpcl->nulls_first = false; /* OK with or without sortop */ grpcl->hashable = hashable; op->groupClauses = lappend(op->groupClauses, grpcl); @@ -2176,7 +2176,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt, rescolnode->collation = rescolcoll; rescolnode->location = bestlocation; restle = makeTargetEntry((Expr *) rescolnode, - 0, /* no need to set resno */ + 0, /* no need to set resno */ NULL, false); *targetlist = lappend(*targetlist, restle); @@ -2361,7 +2361,7 @@ transformUpdateTargetList(ParseState *pstate, List *origTlist) (errcode(ERRCODE_UNDEFINED_COLUMN), errmsg("column \"%s\" of relation \"%s\" does not exist", origTarget->name, - RelationGetRelationName(pstate->p_target_relation)), + RelationGetRelationName(pstate->p_target_relation)), parser_errposition(pstate, origTarget->location))); updateTargetListEntry(pstate, tle, origTarget->name, @@ -2371,7 +2371,7 @@ transformUpdateTargetList(ParseState *pstate, List *origTlist) /* Mark the target column as requiring update permissions */ target_rte->updatedCols = bms_add_member(target_rte->updatedCols, - attrno - FirstLowInvalidHeapAttributeNumber); + attrno - FirstLowInvalidHeapAttributeNumber); orig_tl = lnext(orig_tl); } @@ -2825,7 +2825,7 @@ LCS_asString(LockClauseStrength strength) void CheckSelectLocking(Query *qry, LockClauseStrength strength) { - Assert(strength != LCS_NONE); /* else caller error */ + Assert(strength != LCS_NONE); /* else caller error */ if (qry->setOperations) ereport(ERROR, @@ -2986,25 +2986,25 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc, translator: %s is a SQL row locking clause such as FOR UPDATE */ errmsg("%s cannot be applied to a join", LCS_asString(lc->strength)), - parser_errposition(pstate, thisrel->location))); + parser_errposition(pstate, thisrel->location))); break; case RTE_FUNCTION: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /*------ translator: %s is a SQL row locking clause such as FOR UPDATE */ - errmsg("%s cannot be applied to a function", - LCS_asString(lc->strength)), - parser_errposition(pstate, thisrel->location))); + errmsg("%s cannot be applied to a function", + LCS_asString(lc->strength)), + parser_errposition(pstate, thisrel->location))); break; case RTE_TABLEFUNC: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /*------ translator: %s is a SQL row locking clause such as FOR UPDATE */ - errmsg("%s cannot be applied to a table function", - LCS_asString(lc->strength)), - parser_errposition(pstate, thisrel->location))); + errmsg("%s cannot be applied to a table function", + LCS_asString(lc->strength)), + parser_errposition(pstate, thisrel->location))); break; case RTE_VALUES: ereport(ERROR, @@ -3013,16 +3013,16 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc, translator: %s is a SQL row locking clause such as FOR UPDATE */ errmsg("%s cannot be applied to VALUES", LCS_asString(lc->strength)), - parser_errposition(pstate, thisrel->location))); + parser_errposition(pstate, thisrel->location))); break; case RTE_CTE: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /*------ translator: %s is a SQL row locking clause such as FOR UPDATE */ - errmsg("%s cannot be applied to a WITH query", - LCS_asString(lc->strength)), - parser_errposition(pstate, thisrel->location))); + errmsg("%s cannot be applied to a WITH query", + LCS_asString(lc->strength)), + parser_errposition(pstate, thisrel->location))); break; case RTE_NAMEDTUPLESTORE: ereport(ERROR, @@ -3031,7 +3031,7 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc, translator: %s is a SQL row locking clause such as FOR UPDATE */ errmsg("%s cannot be applied to a named tuplestore", LCS_asString(lc->strength)), - parser_errposition(pstate, thisrel->location))); + parser_errposition(pstate, thisrel->location))); break; default: elog(ERROR, "unrecognized RTE type: %d", @@ -3064,7 +3064,7 @@ applyLockingClause(Query *qry, Index rtindex, { RowMarkClause *rc; - Assert(strength != LCS_NONE); /* else caller error */ + Assert(strength != LCS_NONE); /* else caller error */ /* If it's an explicit clause, make sure hasForUpdate gets set */ if (!pushedDown) @@ -3218,4 +3218,4 @@ test_raw_expression_coverage(Node *node, void *context) context); } -#endif /* RAW_EXPRESSION_COVERAGE_TEST */ +#endif /* RAW_EXPRESSION_COVERAGE_TEST */ diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index ffa1ba6605..363cc5ab3e 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -4096,7 +4096,7 @@ ExistingIndex: USING INDEX index_name { $$ = $3; } /***************************************************************************** * * QUERY : - * CREATE STATISTICS stats_name [(stat types)] + * CREATE STATISTICS [IF NOT EXISTS] stats_name [(stat types)] * ON expression-list FROM from_list * * Note: the expectation here is that the clauses after ON are a subset of @@ -4108,15 +4108,26 @@ ExistingIndex: USING INDEX index_name { $$ = $3; } *****************************************************************************/ CreateStatsStmt: - CREATE opt_if_not_exists STATISTICS any_name + CREATE STATISTICS any_name opt_name_list ON expr_list FROM from_list { CreateStatsStmt *n = makeNode(CreateStatsStmt); - n->defnames = $4; - n->stat_types = $5; - n->exprs = $7; - n->relations = $9; - n->if_not_exists = $2; + n->defnames = $3; + n->stat_types = $4; + n->exprs = $6; + n->relations = $8; + n->if_not_exists = false; + $$ = (Node *)n; + } + | CREATE STATISTICS IF_P NOT EXISTS any_name + opt_name_list ON expr_list FROM from_list + { + CreateStatsStmt *n = makeNode(CreateStatsStmt); + n->defnames = $6; + n->stat_types = $7; + n->exprs = $9; + n->relations = $11; + n->if_not_exists = true; $$ = (Node *)n; } ; diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c index a95e349562..a07274f77e 100644 --- a/src/backend/parser/parse_agg.c +++ b/src/backend/parser/parse_agg.c @@ -647,15 +647,15 @@ check_agg_arguments(ParseState *pstate, (errcode(ERRCODE_GROUPING_ERROR), errmsg("outer-level aggregate cannot contain a lower-level variable in its direct arguments"), parser_errposition(pstate, - locate_var_of_level((Node *) directargs, - context.min_varlevel)))); + locate_var_of_level((Node *) directargs, + context.min_varlevel)))); if (context.min_agglevel >= 0 && context.min_agglevel <= agglevel) ereport(ERROR, (errcode(ERRCODE_GROUPING_ERROR), errmsg("aggregate function calls cannot be nested"), parser_errposition(pstate, - locate_agg_of_level((Node *) directargs, - context.min_agglevel)))); + locate_agg_of_level((Node *) directargs, + context.min_agglevel)))); } return agglevel; } @@ -778,7 +778,7 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc, (errcode(ERRCODE_WINDOWING_ERROR), errmsg("window function calls cannot be nested"), parser_errposition(pstate, - locate_windowfunc((Node *) wfunc->args)))); + locate_windowfunc((Node *) wfunc->args)))); /* * Check to see if the window function is in an invalid place within the @@ -1023,8 +1023,8 @@ parseCheckAggregates(ParseState *pstate, Query *qry) errmsg("too many grouping sets present (maximum 4096)"), parser_errposition(pstate, qry->groupClause - ? exprLocation((Node *) qry->groupClause) - : exprLocation((Node *) qry->groupingSets)))); + ? exprLocation((Node *) qry->groupClause) + : exprLocation((Node *) qry->groupingSets)))); /* * The intersection will often be empty, so help things along by @@ -1103,7 +1103,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry) root->recursiveOk = true; groupClauses = (List *) flatten_join_alias_vars(root, - (Node *) groupClauses); + (Node *) groupClauses); } /* @@ -1318,7 +1318,7 @@ check_ungrouped_columns_walker(Node *node, gvar->varno == var->varno && gvar->varattno == var->varattno && gvar->varlevelsup == 0) - return false; /* acceptable, we're okay */ + return false; /* acceptable, we're okay */ } } diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index 3d5b20836f..9ff80b8b40 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -359,7 +359,7 @@ transformJoinUsingClause(ParseState *pstate, /* Now create the lvar = rvar join condition */ e = makeSimpleA_Expr(AEXPR_OP, "=", - (Node *) copyObject(lvar), (Node *) copyObject(rvar), + (Node *) copyObject(lvar), (Node *) copyObject(rvar), -1); /* Prepare to combine into an AND clause, if multiple join columns */ @@ -636,7 +636,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("set-returning functions must appear at top level of FROM"), parser_errposition(pstate, - exprLocation(pstate->p_last_srf)))); + exprLocation(pstate->p_last_srf)))); funcexprs = lappend(funcexprs, newfexpr); @@ -676,7 +676,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r) (errcode(ERRCODE_SYNTAX_ERROR), errmsg("multiple column definition lists are not allowed for the same function"), parser_errposition(pstate, - exprLocation((Node *) r->coldeflist)))); + exprLocation((Node *) r->coldeflist)))); coldeflists = lappend(coldeflists, coldeflist); } @@ -710,22 +710,22 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r) errmsg("ROWS FROM() with multiple functions cannot have a column definition list"), errhint("Put a separate column definition list for each function inside ROWS FROM()."), parser_errposition(pstate, - exprLocation((Node *) r->coldeflist)))); + exprLocation((Node *) r->coldeflist)))); else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("UNNEST() with multiple arguments cannot have a column definition list"), errhint("Use separate UNNEST() calls inside ROWS FROM(), and attach a column definition list to each one."), parser_errposition(pstate, - exprLocation((Node *) r->coldeflist)))); + exprLocation((Node *) r->coldeflist)))); } if (r->ordinality) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("WITH ORDINALITY cannot be used with a column definition list"), - errhint("Put the column definition list inside ROWS FROM()."), + errhint("Put the column definition list inside ROWS FROM()."), parser_errposition(pstate, - exprLocation((Node *) r->coldeflist)))); + exprLocation((Node *) r->coldeflist)))); coldeflists = list_make1(r->coldeflist); } @@ -785,7 +785,7 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf) /* Transform and apply typecast to the row-generating expression ... */ Assert(rtf->rowexpr != NULL); tf->rowexpr = coerce_to_specific_type(pstate, - transformExpr(pstate, rtf->rowexpr, EXPR_KIND_FROM_FUNCTION), + transformExpr(pstate, rtf->rowexpr, EXPR_KIND_FROM_FUNCTION), TEXTOID, constructName); assign_expr_collations(pstate, tf->rowexpr); @@ -793,7 +793,7 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf) /* ... and to the document itself */ Assert(rtf->docexpr != NULL); tf->docexpr = coerce_to_specific_type(pstate, - transformExpr(pstate, rtf->docexpr, EXPR_KIND_FROM_FUNCTION), + transformExpr(pstate, rtf->docexpr, EXPR_KIND_FROM_FUNCTION), docType, constructName); assign_expr_collations(pstate, tf->docexpr); @@ -849,14 +849,14 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf) tf->coltypes = lappend_oid(tf->coltypes, typid); tf->coltypmods = lappend_int(tf->coltypmods, typmod); tf->colcollations = lappend_oid(tf->colcollations, - type_is_collatable(typid) ? DEFAULT_COLLATION_OID : InvalidOid); + type_is_collatable(typid) ? DEFAULT_COLLATION_OID : InvalidOid); /* Transform the PATH and DEFAULT expressions */ if (rawc->colexpr) { colexpr = coerce_to_specific_type(pstate, - transformExpr(pstate, rawc->colexpr, - EXPR_KIND_FROM_FUNCTION), + transformExpr(pstate, rawc->colexpr, + EXPR_KIND_FROM_FUNCTION), TEXTOID, constructName); assign_expr_collations(pstate, colexpr); @@ -867,8 +867,8 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf) if (rawc->coldefexpr) { coldefexpr = coerce_to_specific_type_typmod(pstate, - transformExpr(pstate, rawc->coldefexpr, - EXPR_KIND_FROM_FUNCTION), + transformExpr(pstate, rawc->coldefexpr, + EXPR_KIND_FROM_FUNCTION), typid, typmod, constructName); assign_expr_collations(pstate, coldefexpr); @@ -1022,12 +1022,12 @@ transformRangeTableSample(ParseState *pstate, RangeTableSample *rts) if (list_length(rts->args) != list_length(tsm->parameterTypes)) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLESAMPLE_ARGUMENT), - errmsg_plural("tablesample method %s requires %d argument, not %d", - "tablesample method %s requires %d arguments, not %d", - list_length(tsm->parameterTypes), - NameListToString(rts->method), - list_length(tsm->parameterTypes), - list_length(rts->args)), + errmsg_plural("tablesample method %s requires %d argument, not %d", + "tablesample method %s requires %d arguments, not %d", + list_length(tsm->parameterTypes), + NameListToString(rts->method), + list_length(tsm->parameterTypes), + list_length(rts->args)), parser_errposition(pstate, rts->location))); /* @@ -1056,8 +1056,8 @@ transformRangeTableSample(ParseState *pstate, RangeTableSample *rts) if (!tsm->repeatable_across_queries) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("tablesample method %s does not support REPEATABLE", - NameListToString(rts->method)), + errmsg("tablesample method %s does not support REPEATABLE", + NameListToString(rts->method)), parser_errposition(pstate, rts->location))); arg = transformExpr(pstate, rts->repeatable, EXPR_KIND_FROM_FUNCTION); @@ -1218,7 +1218,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("TABLESAMPLE clause can only be applied to tables and materialized views"), - parser_errposition(pstate, exprLocation(rts->relation)))); + parser_errposition(pstate, exprLocation(rts->relation)))); /* Transform TABLESAMPLE details and attach to the RTE */ rte->tablesample = transformRangeTableSample(pstate, rts); @@ -1323,7 +1323,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, ListCell *lx, *rx; - Assert(j->usingClause == NIL); /* shouldn't have USING() too */ + Assert(j->usingClause == NIL); /* shouldn't have USING() too */ foreach(lx, l_colnames) { @@ -1830,7 +1830,7 @@ checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle, errmsg("aggregate functions are not allowed in %s", ParseExprKindName(exprKind)), parser_errposition(pstate, - locate_agg_of_level((Node *) tle->expr, 0)))); + locate_agg_of_level((Node *) tle->expr, 0)))); if (pstate->p_hasWindowFuncs && contain_windowfuncs((Node *) tle->expr)) ereport(ERROR, @@ -1839,7 +1839,7 @@ checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle, errmsg("window functions are not allowed in %s", ParseExprKindName(exprKind)), parser_errposition(pstate, - locate_windowfunc((Node *) tle->expr)))); + locate_windowfunc((Node *) tle->expr)))); break; case EXPR_KIND_ORDER_BY: /* no extra checks needed */ @@ -2415,7 +2415,7 @@ transformGroupingSet(List **flatresult, List *l = transformGroupClauseList(flatresult, pstate, (List *) n, targetlist, sortClause, - exprKind, useSQL99, false); + exprKind, useSQL99, false); content = lappend(content, makeGroupingSet(GROUPING_SET_SIMPLE, l, @@ -2427,8 +2427,8 @@ transformGroupingSet(List **flatresult, content = lappend(content, transformGroupingSet(flatresult, pstate, gset2, - targetlist, sortClause, - exprKind, useSQL99, false)); + targetlist, sortClause, + exprKind, useSQL99, false)); } else { @@ -2530,7 +2530,7 @@ transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets, { flat_grouplist = list_make1(makeGroupingSet(GROUPING_SET_EMPTY, NIL, - exprLocation((Node *) grouplist))); + exprLocation((Node *) grouplist))); } foreach(gl, flat_grouplist) @@ -2556,8 +2556,8 @@ transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets, gsets = lappend(gsets, transformGroupingSet(&result, pstate, gset, - targetlist, sortClause, - exprKind, useSQL99, true)); + targetlist, sortClause, + exprKind, useSQL99, true)); break; } } @@ -2566,7 +2566,7 @@ transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets, Index ref = transformGroupClauseExpr(&result, seen_local, pstate, gexpr, targetlist, sortClause, - exprKind, useSQL99, true); + exprKind, useSQL99, true); if (ref > 0) { @@ -2719,8 +2719,8 @@ transformWindowDefinitions(ParseState *pstate, if (partitionClause) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot override PARTITION BY clause of window \"%s\"", - windef->refname), + errmsg("cannot override PARTITION BY clause of window \"%s\"", + windef->refname), parser_errposition(pstate, windef->location))); wc->partitionClause = copyObject(refwc->partitionClause); } @@ -2731,8 +2731,8 @@ transformWindowDefinitions(ParseState *pstate, if (orderClause && refwc->orderClause) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot override ORDER BY clause of window \"%s\"", - windef->refname), + errmsg("cannot override ORDER BY clause of window \"%s\"", + windef->refname), parser_errposition(pstate, windef->location))); if (orderClause) { @@ -2767,8 +2767,8 @@ transformWindowDefinitions(ParseState *pstate, /* Else this clause is just OVER (foo), so say this: */ ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot copy window \"%s\" because it has a frame clause", - windef->refname), + errmsg("cannot copy window \"%s\" because it has a frame clause", + windef->refname), errhint("Omit the parentheses in this OVER clause."), parser_errposition(pstate, windef->location))); } @@ -2868,7 +2868,7 @@ transformDistinctClause(ParseState *pstate, ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), is_agg ? - errmsg("an aggregate with DISTINCT must have at least one argument") : + errmsg("an aggregate with DISTINCT must have at least one argument") : errmsg("SELECT DISTINCT must have at least one column"))); return result; @@ -2937,9 +2937,9 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), errmsg("SELECT DISTINCT ON expressions must match initial ORDER BY expressions"), parser_errposition(pstate, - get_matching_location(scl->tleSortGroupRef, - sortgrouprefs, - distinctlist)))); + get_matching_location(scl->tleSortGroupRef, + sortgrouprefs, + distinctlist)))); else result = lappend(result, copyObject(scl)); } @@ -3051,7 +3051,7 @@ resolve_unique_index_expr(ParseState *pstate, InferClause *infer, if (ielem->nulls_ordering != SORTBY_NULLS_DEFAULT) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("NULLS FIRST/LAST is not allowed in ON CONFLICT clause"), + errmsg("NULLS FIRST/LAST is not allowed in ON CONFLICT clause"), parser_errposition(pstate, exprLocation((Node *) infer)))); @@ -3134,7 +3134,7 @@ transformOnConflictArbiter(ParseState *pstate, errmsg("ON CONFLICT DO UPDATE requires inference specification or constraint name"), errhint("For example, ON CONFLICT (column_name)."), parser_errposition(pstate, - exprLocation((Node *) onConflictClause)))); + exprLocation((Node *) onConflictClause)))); /* * To simplify certain aspects of its design, speculative insertion into @@ -3143,9 +3143,9 @@ transformOnConflictArbiter(ParseState *pstate, if (IsCatalogRelation(pstate->p_target_relation)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("ON CONFLICT is not supported with system catalog tables"), + errmsg("ON CONFLICT is not supported with system catalog tables"), parser_errposition(pstate, - exprLocation((Node *) onConflictClause)))); + exprLocation((Node *) onConflictClause)))); /* Same applies to table used by logical decoding as catalog table */ if (RelationIsUsedAsCatalogTable(pstate->p_target_relation)) @@ -3154,7 +3154,7 @@ transformOnConflictArbiter(ParseState *pstate, errmsg("ON CONFLICT is not supported on table \"%s\" used as a catalog table", RelationGetRelationName(pstate->p_target_relation)), parser_errposition(pstate, - exprLocation((Node *) onConflictClause)))); + exprLocation((Node *) onConflictClause)))); /* ON CONFLICT DO NOTHING does not require an inference clause */ if (infer) @@ -3172,7 +3172,7 @@ transformOnConflictArbiter(ParseState *pstate, if (infer->indexElems) *arbiterExpr = resolve_unique_index_expr(pstate, infer, - pstate->p_target_relation); + pstate->p_target_relation); /* * Handling inference WHERE clause (for partial unique index @@ -3277,8 +3277,8 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle, if (!OidIsValid(eqop)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("operator %s is not a valid ordering operator", - strVal(llast(sortby->useOp))), + errmsg("operator %s is not a valid ordering operator", + strVal(llast(sortby->useOp))), errhint("Ordering operators must be \"<\" or \">\" members of btree operator families."))); /* @@ -3389,7 +3389,7 @@ addTargetToGroupList(ParseState *pstate, TargetEntry *tle, grpcl->tleSortGroupRef = assignSortGroupRef(tle, targetlist); grpcl->eqop = eqop; grpcl->sortop = sortop; - grpcl->nulls_first = false; /* OK with or without sortop */ + grpcl->nulls_first = false; /* OK with or without sortop */ grpcl->hashable = hashable; grouplist = lappend(grouplist, grpcl); diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index cd05eac159..884f4ccabb 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -309,7 +309,7 @@ coerce_type(ParseState *pstate, Node *node, */ if (!con->constisnull) newcon->constvalue = stringTypeDatum(baseType, - DatumGetCString(con->constvalue), + DatumGetCString(con->constvalue), inputTypeMod); else newcon->constvalue = stringTypeDatum(baseType, @@ -349,7 +349,7 @@ coerce_type(ParseState *pstate, Node *node, val2 = PointerGetDatum(PG_DETOAST_DATUM(val2)); if (!datumIsEqual(newcon->constvalue, val2, false, newcon->constlen)) elog(WARNING, "type %s has unstable input conversion for \"%s\"", - typeTypeName(baseType), DatumGetCString(con->constvalue)); + typeTypeName(baseType), DatumGetCString(con->constvalue)); } #endif @@ -425,7 +425,7 @@ coerce_type(ParseState *pstate, Node *node, result = build_coercion_expression(node, pathtype, funcId, baseTypeId, baseTypeMod, cformat, location, - (cformat != COERCE_IMPLICIT_CAST)); + (cformat != COERCE_IMPLICIT_CAST)); /* * If domain, coerce to the domain type and relabel with domain @@ -556,7 +556,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids, /* accept if target is polymorphic, for now */ if (IsPolymorphicType(targetTypeId)) { - have_generics = true; /* do more checking later */ + have_generics = true; /* do more checking later */ continue; } @@ -1450,7 +1450,7 @@ check_generic_type_consistency(Oid *actual_arg_types, { if (actual_type == UNKNOWNOID) continue; - actual_type = getBaseType(actual_type); /* flatten domains */ + actual_type = getBaseType(actual_type); /* flatten domains */ if (OidIsValid(array_typeid) && actual_type != array_typeid) return false; array_typeid = actual_type; @@ -1459,7 +1459,7 @@ check_generic_type_consistency(Oid *actual_arg_types, { if (actual_type == UNKNOWNOID) continue; - actual_type = getBaseType(actual_type); /* flatten domains */ + actual_type = getBaseType(actual_type); /* flatten domains */ if (OidIsValid(range_typeid) && actual_type != range_typeid) return false; range_typeid = actual_type; @@ -1653,7 +1653,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types, if (OidIsValid(elem_typeid) && actual_type != elem_typeid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("arguments declared \"anyelement\" are not all alike"), + errmsg("arguments declared \"anyelement\" are not all alike"), errdetail("%s versus %s", format_type_be(elem_typeid), format_type_be(actual_type)))); @@ -1669,11 +1669,11 @@ enforce_generic_type_consistency(Oid *actual_arg_types, } if (allow_poly && decl_type == actual_type) continue; /* no new information here */ - actual_type = getBaseType(actual_type); /* flatten domains */ + actual_type = getBaseType(actual_type); /* flatten domains */ if (OidIsValid(array_typeid) && actual_type != array_typeid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("arguments declared \"anyarray\" are not all alike"), + errmsg("arguments declared \"anyarray\" are not all alike"), errdetail("%s versus %s", format_type_be(array_typeid), format_type_be(actual_type)))); @@ -1689,11 +1689,11 @@ enforce_generic_type_consistency(Oid *actual_arg_types, } if (allow_poly && decl_type == actual_type) continue; /* no new information here */ - actual_type = getBaseType(actual_type); /* flatten domains */ + actual_type = getBaseType(actual_type); /* flatten domains */ if (OidIsValid(range_typeid) && actual_type != range_typeid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("arguments declared \"anyrange\" are not all alike"), + errmsg("arguments declared \"anyrange\" are not all alike"), errdetail("%s versus %s", format_type_be(range_typeid), format_type_be(actual_type)))); @@ -1722,8 +1722,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types, if (!OidIsValid(array_typelem)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("argument declared %s is not an array but type %s", - "anyarray", format_type_be(array_typeid)))); + errmsg("argument declared %s is not an array but type %s", + "anyarray", format_type_be(array_typeid)))); } if (!OidIsValid(elem_typeid)) @@ -1760,9 +1760,9 @@ enforce_generic_type_consistency(Oid *actual_arg_types, if (!OidIsValid(range_typelem)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("argument declared %s is not a range type but type %s", - "anyrange", - format_type_be(range_typeid)))); + errmsg("argument declared %s is not a range type but type %s", + "anyrange", + format_type_be(range_typeid)))); } if (!OidIsValid(elem_typeid)) @@ -1809,8 +1809,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types, if (type_is_array_domain(elem_typeid)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("type matched to anynonarray is an array type: %s", - format_type_be(elem_typeid)))); + errmsg("type matched to anynonarray is an array type: %s", + format_type_be(elem_typeid)))); } if (have_anyenum && elem_typeid != ANYELEMENTOID) @@ -1848,8 +1848,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types, if (!OidIsValid(array_typeid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("could not find array type for data type %s", - format_type_be(elem_typeid)))); + errmsg("could not find array type for data type %s", + format_type_be(elem_typeid)))); } declared_arg_types[j] = array_typeid; } @@ -1859,8 +1859,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types, { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("could not find range type for data type %s", - format_type_be(elem_typeid)))); + errmsg("could not find range type for data type %s", + format_type_be(elem_typeid)))); } declared_arg_types[j] = range_typeid; } @@ -1937,8 +1937,8 @@ resolve_generic_type(Oid declared_type, if (!OidIsValid(array_typelem)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("argument declared %s is not an array but type %s", - "anyarray", format_type_be(context_base_type)))); + errmsg("argument declared %s is not an array but type %s", + "anyarray", format_type_be(context_base_type)))); return context_base_type; } else if (context_declared_type == ANYELEMENTOID || @@ -1971,8 +1971,8 @@ resolve_generic_type(Oid declared_type, if (!OidIsValid(array_typelem)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("argument declared %s is not an array but type %s", - "anyarray", format_type_be(context_base_type)))); + errmsg("argument declared %s is not an array but type %s", + "anyarray", format_type_be(context_base_type)))); return array_typelem; } else if (context_declared_type == ANYRANGEOID) @@ -1984,8 +1984,8 @@ resolve_generic_type(Oid declared_type, if (!OidIsValid(range_typelem)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("argument declared %s is not a range type but type %s", - "anyrange", format_type_be(context_base_type)))); + errmsg("argument declared %s is not a range type but type %s", + "anyrange", format_type_be(context_base_type)))); return range_typelem; } else if (context_declared_type == ANYELEMENTOID || @@ -2260,7 +2260,7 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId, Oid sourceElem; if ((targetElem = get_element_type(targetTypeId)) != InvalidOid && - (sourceElem = get_base_element_type(sourceTypeId)) != InvalidOid) + (sourceElem = get_base_element_type(sourceTypeId)) != InvalidOid) { CoercionPathType elempathtype; Oid elemfuncid; diff --git a/src/backend/parser/parse_collate.c b/src/backend/parser/parse_collate.c index aa443f23ad..0d106c4c19 100644 --- a/src/backend/parser/parse_collate.c +++ b/src/backend/parser/parse_collate.c @@ -332,7 +332,7 @@ assign_collations_walker(Node *node, assign_collations_context *context) /* Node's result type isn't collatable. */ collation = InvalidOid; strength = COLLATE_NONE; - location = -1; /* won't be used */ + location = -1; /* won't be used */ } } break; @@ -428,7 +428,7 @@ assign_collations_walker(Node *node, assign_collations_context *context) /* Node's result type isn't collatable. */ collation = InvalidOid; strength = COLLATE_NONE; - location = -1; /* won't be used */ + location = -1; /* won't be used */ } /* @@ -604,11 +604,11 @@ assign_collations_walker(Node *node, assign_collations_context *context) break; case AGGKIND_ORDERED_SET: assign_ordered_set_collations(aggref, - &loccontext); + &loccontext); break; case AGGKIND_HYPOTHETICAL: assign_hypothetical_collations(aggref, - &loccontext); + &loccontext); break; default: elog(ERROR, "unrecognized aggkind: %d", @@ -616,7 +616,7 @@ assign_collations_walker(Node *node, assign_collations_context *context) } assign_expr_collations(context->pstate, - (Node *) aggref->aggfilter); + (Node *) aggref->aggfilter); } break; case T_WindowFunc: @@ -674,7 +674,7 @@ assign_collations_walker(Node *node, assign_collations_context *context) * equally to loccontext. */ (void) expression_tree_walker(node, - assign_collations_walker, + assign_collations_walker, (void *) &loccontext); break; } @@ -711,7 +711,7 @@ assign_collations_walker(Node *node, assign_collations_context *context) /* Node's result type isn't collatable. */ collation = InvalidOid; strength = COLLATE_NONE; - location = -1; /* won't be used */ + location = -1; /* won't be used */ } /* @@ -900,7 +900,7 @@ assign_ordered_set_collations(Aggref *aggref, /* Merge sort collations to parent only if there can be only one */ merge_sort_collations = (list_length(aggref->args) == 1 && - get_func_variadictype(aggref->aggfnoid) == InvalidOid); + get_func_variadictype(aggref->aggfnoid) == InvalidOid); /* Direct args, if any, are normal children of the Aggref node */ (void) assign_collations_walker((Node *) aggref->aggdirectargs, @@ -938,7 +938,7 @@ assign_hypothetical_collations(Aggref *aggref, /* Merge sort collations to parent only if there can be only one */ merge_sort_collations = (list_length(aggref->args) == 1 && - get_func_variadictype(aggref->aggfnoid) == InvalidOid); + get_func_variadictype(aggref->aggfnoid) == InvalidOid); /* Process any non-hypothetical direct args */ extra_args = list_length(aggref->aggdirectargs) - list_length(aggref->args); diff --git a/src/backend/parser/parse_cte.c b/src/backend/parser/parse_cte.c index dfbcaa2cdc..5160fdb0e0 100644 --- a/src/backend/parser/parse_cte.c +++ b/src/backend/parser/parse_cte.c @@ -129,8 +129,8 @@ transformWithClause(ParseState *pstate, WithClause *withClause) if (strcmp(cte->ctename, cte2->ctename) == 0) ereport(ERROR, (errcode(ERRCODE_DUPLICATE_ALIAS), - errmsg("WITH query name \"%s\" specified more than once", - cte2->ctename), + errmsg("WITH query name \"%s\" specified more than once", + cte2->ctename), parser_errposition(pstate, cte2->location))); } @@ -313,7 +313,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte) errmsg("recursive query \"%s\" column %d has type %s in non-recursive term but type %s overall", cte->ctename, varattno, format_type_with_typemod(lfirst_oid(lctyp), - lfirst_int(lctypmod)), + lfirst_int(lctypmod)), format_type_with_typemod(exprType(texpr), exprTypmod(texpr))), errhint("Cast the output of the non-recursive term to the correct type."), @@ -331,7 +331,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte) lctypmod = lnext(lctypmod); lccoll = lnext(lccoll); } - if (lctyp != NULL || lctypmod != NULL || lccoll != NULL) /* shouldn't happen */ + if (lctyp != NULL || lctypmod != NULL || lccoll != NULL) /* shouldn't happen */ elog(ERROR, "wrong number of output columns in WITH"); } } @@ -595,7 +595,7 @@ TopologicalSort(ParseState *pstate, CteItem *items, int numitems) if (j >= numitems) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("mutual recursion between WITH items is not implemented"), + errmsg("mutual recursion between WITH items is not implemented"), parser_errposition(pstate, items[i].cte->location))); /* @@ -637,7 +637,7 @@ checkWellFormedRecursion(CteState *cstate) CommonTableExpr *cte = cstate->items[i].cte; SelectStmt *stmt = (SelectStmt *) cte->ctequery; - Assert(!IsA(stmt, Query)); /* not analyzed yet */ + Assert(!IsA(stmt, Query)); /* not analyzed yet */ /* Ignore items that weren't found to be recursive */ if (!cte->cterecursive) @@ -699,9 +699,9 @@ checkWellFormedRecursion(CteState *cstate) if (stmt->sortClause) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("ORDER BY in a recursive query is not implemented"), + errmsg("ORDER BY in a recursive query is not implemented"), parser_errposition(cstate->pstate, - exprLocation((Node *) stmt->sortClause)))); + exprLocation((Node *) stmt->sortClause)))); if (stmt->limitOffset) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -719,7 +719,7 @@ checkWellFormedRecursion(CteState *cstate) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("FOR UPDATE/SHARE in a recursive query is not implemented"), parser_errposition(cstate->pstate, - exprLocation((Node *) stmt->lockingClause)))); + exprLocation((Node *) stmt->lockingClause)))); } } diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 958176c0ac..a8435eb2ed 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -48,20 +48,20 @@ bool Transform_null_equals = false; * Node-type groups for operator precedence warnings * We use zero for everything not otherwise classified */ -#define PREC_GROUP_POSTFIX_IS 1 /* postfix IS tests (NullTest, etc) */ -#define PREC_GROUP_INFIX_IS 2 /* infix IS (IS DISTINCT FROM, etc) */ -#define PREC_GROUP_LESS 3 /* < > */ -#define PREC_GROUP_EQUAL 4 /* = */ -#define PREC_GROUP_LESS_EQUAL 5 /* <= >= <> */ -#define PREC_GROUP_LIKE 6 /* LIKE ILIKE SIMILAR */ -#define PREC_GROUP_BETWEEN 7 /* BETWEEN */ -#define PREC_GROUP_IN 8 /* IN */ -#define PREC_GROUP_NOT_LIKE 9 /* NOT LIKE/ILIKE/SIMILAR */ -#define PREC_GROUP_NOT_BETWEEN 10 /* NOT BETWEEN */ -#define PREC_GROUP_NOT_IN 11 /* NOT IN */ -#define PREC_GROUP_POSTFIX_OP 12 /* generic postfix operators */ -#define PREC_GROUP_INFIX_OP 13 /* generic infix operators */ -#define PREC_GROUP_PREFIX_OP 14 /* generic prefix operators */ +#define PREC_GROUP_POSTFIX_IS 1 /* postfix IS tests (NullTest, etc) */ +#define PREC_GROUP_INFIX_IS 2 /* infix IS (IS DISTINCT FROM, etc) */ +#define PREC_GROUP_LESS 3 /* < > */ +#define PREC_GROUP_EQUAL 4 /* = */ +#define PREC_GROUP_LESS_EQUAL 5 /* <= >= <> */ +#define PREC_GROUP_LIKE 6 /* LIKE ILIKE SIMILAR */ +#define PREC_GROUP_BETWEEN 7 /* BETWEEN */ +#define PREC_GROUP_IN 8 /* IN */ +#define PREC_GROUP_NOT_LIKE 9 /* NOT LIKE/ILIKE/SIMILAR */ +#define PREC_GROUP_NOT_BETWEEN 10 /* NOT BETWEEN */ +#define PREC_GROUP_NOT_IN 11 /* NOT IN */ +#define PREC_GROUP_POSTFIX_OP 12 /* generic postfix operators */ +#define PREC_GROUP_INFIX_OP 13 /* generic infix operators */ +#define PREC_GROUP_PREFIX_OP 14 /* generic prefix operators */ /* * Map precedence groupings to old precedence ordering @@ -418,8 +418,8 @@ unknown_attribute(ParseState *pstate, Node *relref, char *attname, else if (relTypeId == RECORDOID) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("could not identify column \"%s\" in record data type", - attname), + errmsg("could not identify column \"%s\" in record data type", + attname), parser_errposition(pstate, location))); else ereport(ERROR, @@ -741,7 +741,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) break; } default: - crerr = CRERR_TOO_MANY; /* too many dotted names */ + crerr = CRERR_TOO_MANY; /* too many dotted names */ break; } @@ -786,15 +786,15 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) case CRERR_WRONG_DB: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cross-database references are not implemented: %s", - NameListToString(cref->fields)), + errmsg("cross-database references are not implemented: %s", + NameListToString(cref->fields)), parser_errposition(pstate, cref->location))); break; case CRERR_TOO_MANY: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("improper qualified name (too many dotted names): %s", - NameListToString(cref->fields)), + errmsg("improper qualified name (too many dotted names): %s", + NameListToString(cref->fields)), parser_errposition(pstate, cref->location))); break; } @@ -1263,7 +1263,7 @@ transformAExprIn(ParseState *pstate, A_Expr *a) /* ROW() op ROW() is handled specially */ cmp = make_row_comparison_op(pstate, a->name, - copyObject(((RowExpr *) lexpr)->args), + copyObject(((RowExpr *) lexpr)->args), ((RowExpr *) rexpr)->args, a->location); } @@ -1364,10 +1364,10 @@ transformAExprBetween(ParseState *pstate, A_Expr *a) a->location)); sub1 = (Node *) makeBoolExpr(AND_EXPR, args, a->location); args = list_make2(makeSimpleA_Expr(AEXPR_OP, ">=", - copyObject(aexpr), copyObject(cexpr), + copyObject(aexpr), copyObject(cexpr), a->location), makeSimpleA_Expr(AEXPR_OP, "<=", - copyObject(aexpr), copyObject(bexpr), + copyObject(aexpr), copyObject(bexpr), a->location)); sub2 = (Node *) makeBoolExpr(AND_EXPR, args, a->location); args = list_make2(sub1, sub2); @@ -1382,10 +1382,10 @@ transformAExprBetween(ParseState *pstate, A_Expr *a) a->location)); sub1 = (Node *) makeBoolExpr(OR_EXPR, args, a->location); args = list_make2(makeSimpleA_Expr(AEXPR_OP, "<", - copyObject(aexpr), copyObject(cexpr), + copyObject(aexpr), copyObject(cexpr), a->location), makeSimpleA_Expr(AEXPR_OP, ">", - copyObject(aexpr), copyObject(bexpr), + copyObject(aexpr), copyObject(bexpr), a->location)); sub2 = (Node *) makeBoolExpr(OR_EXPR, args, a->location); args = list_make2(sub1, sub2); @@ -1517,7 +1517,7 @@ transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref) if (count_nonjunk_tlist_entries(qtree->targetList) != maref->ncolumns) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("number of columns does not match number of values"), + errmsg("number of columns does not match number of values"), parser_errposition(pstate, sublink->location))); /* @@ -1549,7 +1549,7 @@ transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref) if (list_length(rexpr->args) != maref->ncolumns) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("number of columns does not match number of values"), + errmsg("number of columns does not match number of values"), parser_errposition(pstate, rexpr->location))); /* @@ -1564,7 +1564,7 @@ transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"), - parser_errposition(pstate, exprLocation(maref->source)))); + parser_errposition(pstate, exprLocation(maref->source)))); } else { @@ -2097,8 +2097,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, if (!OidIsValid(element_type)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("could not find element type for data type %s", - format_type_be(array_type)), + errmsg("could not find element type for data type %s", + format_type_be(array_type)), parser_errposition(pstate, a->location))); } else @@ -2384,8 +2384,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), x->op == IS_XMLELEMENT - ? errmsg("unnamed XML attribute value must be a column reference") - : errmsg("unnamed XML element value must be a column reference"), + ? errmsg("unnamed XML attribute value must be a column reference") + : errmsg("unnamed XML element value must be a column reference"), parser_errposition(pstate, r->location))); argname = NULL; /* keep compiler quiet */ } @@ -2400,8 +2400,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x) if (strcmp(argname, strVal(lfirst(lc2))) == 0) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("XML attribute name \"%s\" appears more than once", - argname), + errmsg("XML attribute name \"%s\" appears more than once", + argname), parser_errposition(pstate, r->location))); } } @@ -2481,7 +2481,7 @@ transformXmlSerialize(ParseState *pstate, XmlSerialize *xs) xexpr = makeNode(XmlExpr); xexpr->op = IS_XMLSERIALIZE; xexpr->args = list_make1(coerce_to_specific_type(pstate, - transformExprRecurse(pstate, xs->expr), + transformExprRecurse(pstate, xs->expr), XMLOID, "XMLSERIALIZE")); @@ -2581,7 +2581,7 @@ transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr) * If so, replace the raw name reference with a parameter reference. (This * is a hack for the convenience of plpgsql.) */ - if (cexpr->cursor_name != NULL) /* in case already transformed */ + if (cexpr->cursor_name != NULL) /* in case already transformed */ { ColumnRef *cref = makeNode(ColumnRef); Node *node = NULL; @@ -2844,9 +2844,9 @@ make_row_comparison_op(ParseState *pstate, List *opname, if (cmp->opresulttype != BOOLOID) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("row comparison operator must yield type boolean, " - "not type %s", - format_type_be(cmp->opresulttype)), + errmsg("row comparison operator must yield type boolean, " + "not type %s", + format_type_be(cmp->opresulttype)), parser_errposition(pstate, location))); if (expression_returns_set((Node *) cmp)) ereport(ERROR, @@ -2948,12 +2948,12 @@ make_row_comparison_op(ParseState *pstate, List *opname, } if (OidIsValid(opfamily)) opfamilies = lappend_oid(opfamilies, opfamily); - else /* should not happen */ + else /* should not happen */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("could not determine interpretation of row comparison operator %s", strVal(llast(opname))), - errdetail("There are multiple equally-plausible candidates."), + errdetail("There are multiple equally-plausible candidates."), parser_errposition(pstate, location))); } @@ -3046,7 +3046,7 @@ make_distinct_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree, if (((OpExpr *) result)->opresulttype != BOOLOID) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("IS DISTINCT FROM requires = operator to yield boolean"), + errmsg("IS DISTINCT FROM requires = operator to yield boolean"), parser_errposition(pstate, location))); if (((OpExpr *) result)->opretset) ereport(ERROR, diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index 34f1cf82ee..8487edaa95 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -117,10 +117,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (list_length(fargs) > FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg_plural("cannot pass more than %d argument to a function", - "cannot pass more than %d arguments to a function", - FUNC_MAX_ARGS, - FUNC_MAX_ARGS), + errmsg_plural("cannot pass more than %d argument to a function", + "cannot pass more than %d arguments to a function", + FUNC_MAX_ARGS, + FUNC_MAX_ARGS), parser_errposition(pstate, location))); /* @@ -176,8 +176,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (strcmp(na->name, (char *) lfirst(lc)) == 0) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("argument name \"%s\" used more than once", - na->name), + errmsg("argument name \"%s\" used more than once", + na->name), parser_errposition(pstate, na->location))); } argnames = lappend(argnames, na->name); @@ -187,7 +187,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (argnames != NIL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("positional argument cannot follow named argument"), + errmsg("positional argument cannot follow named argument"), parser_errposition(pstate, exprLocation(arg)))); } } @@ -272,15 +272,15 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (agg_star) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("%s(*) specified, but %s is not an aggregate function", - NameListToString(funcname), - NameListToString(funcname)), + errmsg("%s(*) specified, but %s is not an aggregate function", + NameListToString(funcname), + NameListToString(funcname)), parser_errposition(pstate, location))); if (agg_distinct) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("DISTINCT specified, but %s is not an aggregate function", - NameListToString(funcname)), + errmsg("DISTINCT specified, but %s is not an aggregate function", + NameListToString(funcname)), parser_errposition(pstate, location))); if (agg_within_group) ereport(ERROR, @@ -291,14 +291,14 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (agg_order != NIL) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("ORDER BY specified, but %s is not an aggregate function", - NameListToString(funcname)), + errmsg("ORDER BY specified, but %s is not an aggregate function", + NameListToString(funcname)), parser_errposition(pstate, location))); if (agg_filter) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("FILTER specified, but %s is not an aggregate function", - NameListToString(funcname)), + errmsg("FILTER specified, but %s is not an aggregate function", + NameListToString(funcname)), parser_errposition(pstate, location))); if (over) ereport(ERROR, @@ -317,7 +317,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, int catDirectArgs; tup = SearchSysCache1(AGGFNOID, ObjectIdGetDatum(funcid)); - if (!HeapTupleIsValid(tup)) /* should not happen */ + if (!HeapTupleIsValid(tup)) /* should not happen */ elog(ERROR, "cache lookup failed for aggregate %u", funcid); classForm = (Form_pg_aggregate) GETSTRUCT(tup); aggkind = classForm->aggkind; @@ -339,8 +339,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (over) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("OVER is not supported for ordered-set aggregate %s", - NameListToString(funcname)), + errmsg("OVER is not supported for ordered-set aggregate %s", + NameListToString(funcname)), parser_errposition(pstate, location))); /* gram.y rejects DISTINCT + WITHIN GROUP */ Assert(!agg_distinct); @@ -398,7 +398,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, errmsg("function %s does not exist", func_signature_string(funcname, nargs, argnames, - actual_arg_types)), + actual_arg_types)), errhint("There is an ordered-set aggregate %s, but it requires %d direct arguments, not %d.", NameListToString(funcname), catDirectArgs, numDirectArgs), @@ -421,12 +421,12 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), errmsg("function %s does not exist", - func_signature_string(funcname, nargs, - argnames, - actual_arg_types)), + func_signature_string(funcname, nargs, + argnames, + actual_arg_types)), errhint("To use the hypothetical-set aggregate %s, the number of hypothetical direct arguments (here %d) must match the number of ordering columns (here %d).", NameListToString(funcname), - nvargs - numAggregatedArgs, numAggregatedArgs), + nvargs - numAggregatedArgs, numAggregatedArgs), parser_errposition(pstate, location))); } else @@ -435,9 +435,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), errmsg("function %s does not exist", - func_signature_string(funcname, nargs, - argnames, - actual_arg_types)), + func_signature_string(funcname, nargs, + argnames, + actual_arg_types)), errhint("There is an ordered-set aggregate %s, but it requires at least %d direct arguments.", NameListToString(funcname), catDirectArgs), @@ -513,7 +513,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, func_signature_string(funcname, nargs, argnames, actual_arg_types)), errhint("No aggregate function matches the given name and argument types. " - "Perhaps you misplaced ORDER BY; ORDER BY must appear " + "Perhaps you misplaced ORDER BY; ORDER BY must appear " "after all regular arguments of the aggregate."), parser_errposition(pstate, location))); } @@ -523,8 +523,8 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, errmsg("function %s does not exist", func_signature_string(funcname, nargs, argnames, actual_arg_types)), - errhint("No function matches the given name and argument types. " - "You might need to add explicit type casts."), + errhint("No function matches the given name and argument types. " + "You might need to add explicit type casts."), parser_errposition(pstate, location))); } @@ -544,10 +544,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (nargsplusdefs >= FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg_plural("cannot pass more than %d argument to a function", - "cannot pass more than %d arguments to a function", - FUNC_MAX_ARGS, - FUNC_MAX_ARGS), + errmsg_plural("cannot pass more than %d argument to a function", + "cannot pass more than %d arguments to a function", + FUNC_MAX_ARGS, + FUNC_MAX_ARGS), parser_errposition(pstate, location))); actual_arg_types[nargsplusdefs++] = exprType(expr); @@ -601,7 +601,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, (errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("could not find array type for data type %s", format_type_be(newa->element_typeid)), - parser_errposition(pstate, exprLocation((Node *) vargs)))); + parser_errposition(pstate, exprLocation((Node *) vargs)))); /* array_collid will be set by parse_collate.c */ newa->multidims = false; newa->location = exprLocation((Node *) vargs); @@ -627,7 +627,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("VARIADIC argument must be an array"), parser_errposition(pstate, - exprLocation((Node *) llast(fargs))))); + exprLocation((Node *) llast(fargs))))); } /* if it returns a set, check that's OK */ @@ -658,7 +658,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, aggref->aggfnoid = funcid; aggref->aggtype = rettype; /* aggcollid and inputcollid will be set by parse_collate.c */ - aggref->aggtranstype = InvalidOid; /* will be set by planner */ + aggref->aggtranstype = InvalidOid; /* will be set by planner */ /* aggargtypes will be set by transformAggregateCall */ /* aggdirectargs and args will be set by transformAggregateCall */ /* aggorder and aggdistinct will be set by transformAggregateCall */ @@ -667,7 +667,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, aggref->aggvariadic = func_variadic; aggref->aggkind = aggkind; /* agglevelsup will be set by transformAggregateCall */ - aggref->aggsplit = AGGSPLIT_SIMPLE; /* planner might change this */ + aggref->aggsplit = AGGSPLIT_SIMPLE; /* planner might change this */ aggref->location = location; /* @@ -713,7 +713,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, WindowFunc *wfunc = makeNode(WindowFunc); Assert(over); /* lack of this was checked above */ - Assert(!agg_within_group); /* also checked above */ + Assert(!agg_within_group); /* also checked above */ wfunc->winfnoid = funcid; wfunc->wintype = rettype; @@ -731,7 +731,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs, if (agg_distinct) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("DISTINCT is not implemented for window functions"), + errmsg("DISTINCT is not implemented for window functions"), parser_errposition(pstate, location))); /* @@ -811,7 +811,7 @@ int func_match_argtypes(int nargs, Oid *input_typeids, FuncCandidateList raw_candidates, - FuncCandidateList *candidates) /* return value */ + FuncCandidateList *candidates) /* return value */ { FuncCandidateList current_candidate; FuncCandidateList next_candidate; @@ -834,7 +834,7 @@ func_match_argtypes(int nargs, } return ncandidates; -} /* func_match_argtypes() */ +} /* func_match_argtypes() */ /* func_select_candidate() @@ -918,10 +918,10 @@ func_select_candidate(int nargs, if (nargs > FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg_plural("cannot pass more than %d argument to a function", - "cannot pass more than %d arguments to a function", - FUNC_MAX_ARGS, - FUNC_MAX_ARGS))); + errmsg_plural("cannot pass more than %d argument to a function", + "cannot pass more than %d arguments to a function", + FUNC_MAX_ARGS, + FUNC_MAX_ARGS))); /* * If any input types are domains, reduce them to their base types. This @@ -1077,7 +1077,7 @@ func_select_candidate(int nargs, if (input_base_typeids[i] != UNKNOWNOID) continue; - resolved_unknowns = true; /* assume we can do it */ + resolved_unknowns = true; /* assume we can do it */ slot_category[i] = TYPCATEGORY_INVALID; slot_has_preferred_type[i] = false; have_conflict = false; @@ -1205,7 +1205,7 @@ func_select_candidate(int nargs, { if (input_base_typeids[i] == UNKNOWNOID) continue; - if (known_type == UNKNOWNOID) /* first known arg? */ + if (known_type == UNKNOWNOID) /* first known arg? */ known_type = input_base_typeids[i]; else if (known_type != input_base_typeids[i]) { @@ -1245,7 +1245,7 @@ func_select_candidate(int nargs, } return NULL; /* failed to select a best candidate */ -} /* func_select_candidate() */ +} /* func_select_candidate() */ /* func_get_detail() @@ -1292,8 +1292,8 @@ func_get_detail(List *funcname, bool *retset, /* return value */ int *nvargs, /* return value */ Oid *vatype, /* return value */ - Oid **true_typeids, /* return value */ - List **argdefaults) /* optional return value */ + Oid **true_typeids, /* return value */ + List **argdefaults) /* optional return value */ { FuncCandidateList raw_candidates; FuncCandidateList best_candidate; @@ -1400,7 +1400,7 @@ func_get_detail(List *funcname, case COERCION_PATH_COERCEVIAIO: if ((sourceType == RECORDOID || ISCOMPLEX(sourceType)) && - TypeCategory(targetType) == TYPCATEGORY_STRING) + TypeCategory(targetType) == TYPCATEGORY_STRING) iscoercion = false; else iscoercion = true; @@ -2152,7 +2152,7 @@ check_srf_call_placement(ParseState *pstate, Node *last_srf, int location) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("set-returning functions must appear at top level of FROM"), parser_errposition(pstate, - exprLocation(pstate->p_last_srf)))); + exprLocation(pstate->p_last_srf)))); break; case EXPR_KIND_WHERE: errkind = true; diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c index fb3d117a7d..6dbad53a41 100644 --- a/src/backend/parser/parse_node.c +++ b/src/backend/parser/parse_node.c @@ -356,7 +356,7 @@ transformArraySubscripts(ParseState *pstate, ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("array subscript must have type integer"), - parser_errposition(pstate, exprLocation(ai->lidx)))); + parser_errposition(pstate, exprLocation(ai->lidx)))); } else if (!ai->is_slice) { @@ -367,7 +367,7 @@ transformArraySubscripts(ParseState *pstate, sizeof(int32), Int32GetDatum(1), false, - true); /* pass by value */ + true); /* pass by value */ } else { @@ -427,7 +427,7 @@ transformArraySubscripts(ParseState *pstate, " but expression is of type %s", format_type_be(typeneeded), format_type_be(typesource)), - errhint("You will need to rewrite or cast the expression."), + errhint("You will need to rewrite or cast the expression."), parser_errposition(pstate, exprLocation(assignFrom)))); assignFrom = newFrom; } @@ -511,7 +511,7 @@ make_const(ParseState *pstate, Value *value, int location) typeid = INT8OID; typelen = sizeof(int64); - typebyval = FLOAT8PASSBYVAL; /* int8 and float8 alike */ + typebyval = FLOAT8PASSBYVAL; /* int8 and float8 alike */ } } else diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c index 4b1db76e19..e9bf50243f 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -221,7 +221,7 @@ get_sort_group_operators(Oid argtype, (errcode(ERRCODE_UNDEFINED_FUNCTION), errmsg("could not identify an ordering operator for type %s", format_type_be(argtype)), - errhint("Use an explicit ordering operator or modify the query."))); + errhint("Use an explicit ordering operator or modify the query."))); if (needEQ && !OidIsValid(eq_opr)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), @@ -319,7 +319,7 @@ static FuncDetailCode oper_select_candidate(int nargs, Oid *input_typeids, FuncCandidateList candidates, - Oid *operOid) /* output argument */ + Oid *operOid) /* output argument */ { int ncandidates; @@ -723,8 +723,8 @@ op_error(ParseState *pstate, List *op, char oprkind, (errcode(ERRCODE_UNDEFINED_FUNCTION), errmsg("operator does not exist: %s", op_signature_string(op, oprkind, arg1, arg2)), - errhint("No operator matches the given name and argument type(s). " - "You might need to add explicit type casts."), + errhint("No operator matches the given name and argument type(s). " + "You might need to add explicit type casts."), parser_errposition(pstate, location))); } @@ -894,7 +894,7 @@ make_scalar_array_op(ParseState *pstate, List *opname, if (!OidIsValid(rtypeId)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("op ANY/ALL (array) requires array on right side"), + errmsg("op ANY/ALL (array) requires array on right side"), parser_errposition(pstate, location))); } @@ -936,12 +936,12 @@ make_scalar_array_op(ParseState *pstate, List *opname, if (rettype != BOOLOID) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("op ANY/ALL (array) requires operator to yield boolean"), + errmsg("op ANY/ALL (array) requires operator to yield boolean"), parser_errposition(pstate, location))); if (get_func_retset(opform->oprcode)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("op ANY/ALL (array) requires operator not to return a set"), + errmsg("op ANY/ALL (array) requires operator not to return a set"), parser_errposition(pstate, location))); /* @@ -1057,7 +1057,7 @@ make_oper_cache_key(ParseState *pstate, OprCacheKey *key, List *opname, { /* get the active search path */ if (fetch_search_path_array(key->search_path, - MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN) + MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN) return false; /* oops, didn't fit */ } diff --git a/src/backend/parser/parse_param.c b/src/backend/parser/parse_param.c index 20fd83f095..3e04e8c4d1 100644 --- a/src/backend/parser/parse_param.c +++ b/src/backend/parser/parse_param.c @@ -301,8 +301,8 @@ check_parameter_resolution_walker(Node *node, ParseState *pstate) if (param->paramtype != (*parstate->paramTypes)[paramno - 1]) ereport(ERROR, (errcode(ERRCODE_AMBIGUOUS_PARAMETER), - errmsg("could not determine data type of parameter $%d", - paramno), + errmsg("could not determine data type of parameter $%d", + paramno), parser_errposition(pstate, param->location))); } return false; diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index 8ae8b00236..f2d4b21746 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -453,8 +453,8 @@ check_lateral_ref_ok(ParseState *pstate, ParseNamespaceItem *nsitem, ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("invalid reference to FROM-clause entry for table \"%s\"", - refname), + errmsg("invalid reference to FROM-clause entry for table \"%s\"", + refname), (rte == pstate->p_target_rangetblentry) ? errhint("There is an entry for table \"%s\", but it cannot be referenced from this part of the query.", refname) : @@ -878,7 +878,7 @@ searchRangeTableForCol(ParseState *pstate, const char *alias, char *colname, fuzzy_rte_penalty = varstr_levenshtein_less_equal(alias, strlen(alias), rte->eref->aliasname, - strlen(rte->eref->aliasname), + strlen(rte->eref->aliasname), 1, 1, 1, MAX_FUZZY_DISTANCE + 1, true); @@ -947,7 +947,7 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte, rte->requiredPerms |= ACL_SELECT; /* Must offset the attnum to fit in a bitmapset */ rte->selectedCols = bms_add_member(rte->selectedCols, - col - FirstLowInvalidHeapAttributeNumber); + col - FirstLowInvalidHeapAttributeNumber); } else if (rte->rtekind == RTE_JOIN) { @@ -1340,7 +1340,7 @@ addRangeTableEntry(ParseState *pstate, else #endif rte->requiredPerms = ACL_SELECT; - rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ + rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ rte->selectedCols = NULL; rte->insertedCols = NULL; rte->updatedCols = NULL; @@ -1395,7 +1395,7 @@ addRangeTableEntryForRelation(ParseState *pstate, rte->inFromCl = inFromCl; rte->requiredPerms = ACL_SELECT; - rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ + rte->checkAsUser = InvalidOid; /* not set-uid by default, either */ rte->selectedCols = NULL; rte->insertedCols = NULL; rte->updatedCols = NULL; @@ -1562,7 +1562,7 @@ addRangeTableEntryForFunction(ParseState *pstate, rtfunc->funccoltypes = NIL; rtfunc->funccoltypmods = NIL; rtfunc->funccolcollations = NIL; - rtfunc->funcparams = NULL; /* not set until planning */ + rtfunc->funcparams = NULL; /* not set until planning */ /* * Now determine if the function returns a simple or composite type. @@ -1582,7 +1582,7 @@ addRangeTableEntryForFunction(ParseState *pstate, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("a column definition list is only allowed for functions returning \"record\""), parser_errposition(pstate, - exprLocation((Node *) coldeflist)))); + exprLocation((Node *) coldeflist)))); } else { @@ -1668,8 +1668,8 @@ addRangeTableEntryForFunction(ParseState *pstate, else ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("function \"%s\" in FROM has unsupported return type %s", - funcname, format_type_be(funcrettype)), + errmsg("function \"%s\" in FROM has unsupported return type %s", + funcname, format_type_be(funcrettype)), parser_errposition(pstate, exprLocation(funcexpr)))); /* Finish off the RangeTblFunction and add it to the RTE's list */ @@ -1779,7 +1779,7 @@ addRangeTableEntryForTableFunc(ParseState *pstate, /* fill in any unspecified alias columns */ if (numaliases < list_length(tf->colnames)) eref->colnames = list_concat(eref->colnames, - list_copy_tail(tf->colnames, numaliases)); + list_copy_tail(tf->colnames, numaliases)); rte->eref = eref; @@ -2002,8 +2002,8 @@ addRangeTableEntryForCTE(ParseState *pstate, ctequery->returningList == NIL) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("WITH query \"%s\" does not have a RETURNING clause", - cte->ctename), + errmsg("WITH query \"%s\" does not have a RETURNING clause", + cte->ctename), parser_errposition(pstate, rv->location))); } @@ -2620,7 +2620,7 @@ expandTupleDesc(TupleDesc tupdesc, Alias *eref, int count, int offset, * what type the Const claims to be. */ *colvars = lappend(*colvars, - makeNullConst(INT4OID, -1, InvalidOid)); + makeNullConst(INT4OID, -1, InvalidOid)); } } if (aliascell) @@ -2706,7 +2706,7 @@ expandRelAttrs(ParseState *pstate, RangeTblEntry *rte, markVarForSelectPriv(pstate, varnode, rte); } - Assert(name == NULL && var == NULL); /* lists not the same length? */ + Assert(name == NULL && var == NULL); /* lists not the same length? */ return te_list; } @@ -2775,7 +2775,7 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum, tp = SearchSysCache2(ATTNUM, ObjectIdGetDatum(rte->relid), Int16GetDatum(attnum)); - if (!HeapTupleIsValid(tp)) /* shouldn't happen */ + if (!HeapTupleIsValid(tp)) /* shouldn't happen */ elog(ERROR, "cache lookup failed for attribute %d of relation %u", attnum, rte->relid); att_tup = (Form_pg_attribute) GETSTRUCT(tp); @@ -2787,9 +2787,9 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum, if (att_tup->attisdropped) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" of relation \"%s\" does not exist", - NameStr(att_tup->attname), - get_rel_name(rte->relid)))); + errmsg("column \"%s\" of relation \"%s\" does not exist", + NameStr(att_tup->attname), + get_rel_name(rte->relid)))); *vartype = att_tup->atttypid; *vartypmod = att_tup->atttypmod; *varcollid = att_tup->attcollation; @@ -2959,7 +2959,7 @@ get_rte_attribute_is_dropped(RangeTblEntry *rte, AttrNumber attnum) tp = SearchSysCache2(ATTNUM, ObjectIdGetDatum(rte->relid), Int16GetDatum(attnum)); - if (!HeapTupleIsValid(tp)) /* shouldn't happen */ + if (!HeapTupleIsValid(tp)) /* shouldn't happen */ elog(ERROR, "cache lookup failed for attribute %d of relation %u", attnum, rte->relid); att_tup = (Form_pg_attribute) GETSTRUCT(tp); @@ -3281,11 +3281,11 @@ errorMissingRTE(ParseState *pstate, RangeVar *relation) if (rte) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_TABLE), - errmsg("invalid reference to FROM-clause entry for table \"%s\"", - relation->relname), + errmsg("invalid reference to FROM-clause entry for table \"%s\"", + relation->relname), (badAlias ? - errhint("Perhaps you meant to reference the table alias \"%s\".", - badAlias) : + errhint("Perhaps you meant to reference the table alias \"%s\".", + badAlias) : errhint("There is an entry for table \"%s\", but it cannot be referenced from this part of the query.", rte->eref->aliasname)), parser_errposition(pstate, relation->location))); @@ -3344,8 +3344,8 @@ errorMissingColumn(ParseState *pstate, errmsg("column %s.%s does not exist", relname, colname) : errmsg("column \"%s\" does not exist", colname), state->rfirst ? closestfirst ? - errhint("Perhaps you meant to reference the column \"%s.%s\".", - state->rfirst->eref->aliasname, closestfirst) : + errhint("Perhaps you meant to reference the column \"%s.%s\".", + state->rfirst->eref->aliasname, closestfirst) : errhint("There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.", colname, state->rfirst->eref->aliasname) : 0, parser_errposition(pstate, location))); diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index f2ca840ef2..6484e83160 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -592,7 +592,7 @@ transformAssignedExpr(ParseState *pstate, colname, format_type_be(attrtype), format_type_be(type_id)), - errhint("You will need to rewrite or cast the expression."), + errhint("You will need to rewrite or cast the expression."), parser_errposition(pstate, exprLocation(orig_expr)))); } @@ -782,7 +782,7 @@ transformAssignmentIndirection(ParseState *pstate, parser_errposition(pstate, location))); get_atttypetypmodcoll(typrelid, attnum, - &fieldTypeId, &fieldTypMod, &fieldCollation); + &fieldTypeId, &fieldTypMod, &fieldCollation); /* recurse to create appropriate RHS for field assign */ rhs = transformAssignmentIndirection(pstate, @@ -842,7 +842,7 @@ transformAssignmentIndirection(ParseState *pstate, targetName, format_type_be(targetTypeId), format_type_be(exprType(rhs))), - errhint("You will need to rewrite or cast the expression."), + errhint("You will need to rewrite or cast the expression."), parser_errposition(pstate, location))); else ereport(ERROR, @@ -852,7 +852,7 @@ transformAssignmentIndirection(ParseState *pstate, targetName, format_type_be(targetTypeId), format_type_be(exprType(rhs))), - errhint("You will need to rewrite or cast the expression."), + errhint("You will need to rewrite or cast the expression."), parser_errposition(pstate, location))); } @@ -1004,9 +1004,9 @@ checkInsertTargets(ParseState *pstate, List *cols, List **attrnos) if (attrno == InvalidAttrNumber) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" of relation \"%s\" does not exist", - name, - RelationGetRelationName(pstate->p_target_relation)), + errmsg("column \"%s\" of relation \"%s\" does not exist", + name, + RelationGetRelationName(pstate->p_target_relation)), parser_errposition(pstate, col->location))); /* diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c index b71b17bd2a..d0b3fbeb57 100644 --- a/src/backend/parser/parse_type.c +++ b/src/backend/parser/parse_type.c @@ -80,8 +80,8 @@ LookupTypeName(ParseState *pstate, const TypeName *typeName, case 1: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("improper %%TYPE reference (too few dotted names): %s", - NameListToString(typeName->names)), + errmsg("improper %%TYPE reference (too few dotted names): %s", + NameListToString(typeName->names)), parser_errposition(pstate, typeName->location))); break; case 2: @@ -124,8 +124,8 @@ LookupTypeName(ParseState *pstate, const TypeName *typeName, else ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("column \"%s\" of relation \"%s\" does not exist", - field, rel->relname), + errmsg("column \"%s\" of relation \"%s\" does not exist", + field, rel->relname), parser_errposition(pstate, typeName->location))); } else @@ -334,8 +334,8 @@ typenameTypeMod(ParseState *pstate, const TypeName *typeName, Type typ) if (!((Form_pg_type) GETSTRUCT(typ))->typisdefined) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("type modifier cannot be specified for shell type \"%s\"", - TypeNameToString(typeName)), + errmsg("type modifier cannot be specified for shell type \"%s\"", + TypeNameToString(typeName)), parser_errposition(pstate, typeName->location))); typmodin = ((Form_pg_type) GETSTRUCT(typ))->typmodin; @@ -385,7 +385,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typeName, Type typ) if (!cstr) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("type modifiers must be simple constants or identifiers"), + errmsg("type modifiers must be simple constants or identifiers"), parser_errposition(pstate, typeName->location))); datums[n++] = CStringGetDatum(cstr); } diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 5e1e89c979..1cdeacf3b5 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -121,7 +121,7 @@ typedef struct PGXCSubCluster *subcluster; /* original subcluster option of CREATE TABLE */ #endif bool ispartitioned; /* true if table is partitioned */ - PartitionBoundSpec *partbound; /* transformed FOR VALUES */ + PartitionBoundSpec *partbound; /* transformed FOR VALUES */ } CreateStmtContext; /* State shared by transformCreateSchemaStmt and its subroutines */ @@ -176,7 +176,7 @@ static PGXCSubCluster *makeSubCluster(List *nodelist); #endif static void transformPartitionCmd(CreateStmtContext *cxt, PartitionCmd *cmd); static Const *transformPartitionBoundValue(ParseState *pstate, A_Const *con, - const char *colName, Oid colType, int32 colTypmod); + const char *colName, Oid colType, int32 colTypmod); /* @@ -313,7 +313,7 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString) if (stmt->inhRelations && !stmt->partbound) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("cannot create partitioned table as inheritance child"))); + errmsg("cannot create partitioned table as inheritance child"))); } /* @@ -594,7 +594,7 @@ generateSerialExtraStmts(CreateStmtContext *cxt, ColumnDef *column, */ if (seqtypid) seqstmt->options = lcons(makeDefElem("as", - (Node *) makeTypeNameFromOid(seqtypid, -1), + (Node *) makeTypeNameFromOid(seqtypid, -1), -1), seqstmt->options); @@ -811,12 +811,12 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("multiple identity specifications for column \"%s\" of table \"%s\"", - column->colname, cxt->relation->relname), + column->colname, cxt->relation->relname), parser_errposition(cxt->pstate, constraint->location))); generateSerialExtraStmts(cxt, column, - typeOid, constraint->options, true, + typeOid, constraint->options, true, NULL, NULL); column->identity = constraint->generated_when; @@ -1058,7 +1058,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla if (cxt->isforeign) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("LIKE is not supported for creating foreign tables"))); + errmsg("LIKE is not supported for creating foreign tables"))); relation = relation_openrv(table_like_clause->relation, AccessShareLock); @@ -1251,7 +1251,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla stmt->objtype = OBJECT_COLUMN; stmt->object = (Node *) list_make3(makeString(cxt->relation->schemaname), - makeString(cxt->relation->relname), + makeString(cxt->relation->relname), makeString(def->colname)); stmt->comment = comment; @@ -1308,7 +1308,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla /* Copy comment on constraint */ if ((table_like_clause->options & CREATE_TABLE_LIKE_COMMENTS) && (comment = GetComment(get_relation_constraint_oid(RelationGetRelid(relation), - n->conname, false), + n->conname, false), ConstraintRelationId, 0)) != NULL) { @@ -1316,7 +1316,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla stmt->objtype = OBJECT_TABCONSTRAINT; stmt->object = (Node *) list_make3(makeString(cxt->relation->schemaname), - makeString(cxt->relation->relname), + makeString(cxt->relation->relname), makeString(n->conname)); stmt->comment = comment; @@ -1388,7 +1388,7 @@ transformOfType(CreateStmtContext *cxt, TypeName *ofTypename) tuple = typenameType(NULL, ofTypename, NULL); check_of_type(tuple); ofTypeId = HeapTupleGetOid(tuple); - ofTypename->typeOid = ofTypeId; /* cached for later */ + ofTypename->typeOid = ofTypeId; /* cached for later */ tupdesc = lookup_rowtype_tupdesc(ofTypeId, -1); for (i = 0; i < tupdesc->natts; i++) @@ -1721,8 +1721,8 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot convert whole-row table reference"), - errdetail("Index \"%s\" contains a whole-row table reference.", - RelationGetRelationName(source_idx)))); + errdetail("Index \"%s\" contains a whole-row table reference.", + RelationGetRelationName(source_idx)))); index->whereClause = pred_tree; } @@ -1935,8 +1935,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) if (cxt->pkey != NULL) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("multiple primary keys for table \"%s\" are not allowed", - cxt->relation->relname), + errmsg("multiple primary keys for table \"%s\" are not allowed", + cxt->relation->relname), parser_errposition(cxt->pstate, constraint->location))); cxt->pkey = index; @@ -2017,8 +2017,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) if (OidIsValid(get_index_constraint(index_oid))) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("index \"%s\" is already associated with a constraint", - index_name), + errmsg("index \"%s\" is already associated with a constraint", + index_name), parser_errposition(cxt->pstate, constraint->location))); /* Perform validity checks on the index */ @@ -2106,7 +2106,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) } else attform = SystemAttributeDefinition(attnum, - heap_rel->rd_rel->relhasoids); + heap_rel->rd_rel->relhasoids); attname = pstrdup(NameStr(attform->attname)); /* @@ -2124,7 +2124,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("index \"%s\" does not have default sorting behavior", index_name), errdetail("Cannot create a primary key or unique constraint using such an index."), - parser_errposition(cxt->pstate, constraint->location))); + parser_errposition(cxt->pstate, constraint->location))); constraint->keys = lappend(constraint->keys, makeString(attname)); } @@ -2287,13 +2287,13 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) (errcode(ERRCODE_DUPLICATE_COLUMN), errmsg("column \"%s\" appears twice in primary key constraint", key), - parser_errposition(cxt->pstate, constraint->location))); + parser_errposition(cxt->pstate, constraint->location))); else ereport(ERROR, (errcode(ERRCODE_DUPLICATE_COLUMN), - errmsg("column \"%s\" appears twice in unique constraint", - key), - parser_errposition(cxt->pstate, constraint->location))); + errmsg("column \"%s\" appears twice in unique constraint", + key), + parser_errposition(cxt->pstate, constraint->location))); } } @@ -2694,14 +2694,14 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString, /* take care of the where clause */ *whereClause = transformWhereClause(pstate, - (Node *) copyObject(stmt->whereClause), + (Node *) copyObject(stmt->whereClause), EXPR_KIND_WHERE, "WHERE"); /* we have to fix its collations too */ assign_expr_collations(pstate, *whereClause); /* this is probably dead code without add_missing_from: */ - if (list_length(pstate->p_rtable) != 2) /* naughty, naughty... */ + if (list_length(pstate->p_rtable) != 2) /* naughty, naughty... */ ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("rule WHERE condition cannot contain references to other relations"))); @@ -2718,7 +2718,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString, nothing_qry->commandType = CMD_NOTHING; nothing_qry->rtable = pstate->p_rtable; - nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */ + nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */ *actions = list_make1(nothing_qry); } @@ -3099,7 +3099,7 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, AlterSeqStmt *altseqstmt = makeNode(AlterSeqStmt); altseqstmt->sequence = makeRangeVar(get_namespace_name(get_rel_namespace(seq_relid)), - get_rel_name(seq_relid), + get_rel_name(seq_relid), -1); altseqstmt->options = list_make1(makeDefElem("as", (Node *) makeTypeNameFromOid(typeOid, -1), -1)); altseqstmt->for_identity = true; @@ -3175,7 +3175,7 @@ transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, seqstmt = makeNode(AlterSeqStmt); seq_relid = linitial_oid(seqlist); seqstmt->sequence = makeRangeVar(get_namespace_name(get_rel_namespace(seq_relid)), - get_rel_name(seq_relid), -1); + get_rel_name(seq_relid), -1); seqstmt->options = newseqopts; seqstmt->for_identity = true; seqstmt->missing_ok = false; @@ -4132,8 +4132,8 @@ transformPartitionBound(ParseState *pstate, Relation parent, if (spec->strategy != PARTITION_STRATEGY_LIST) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("invalid bound specification for a list partition"), - parser_errposition(pstate, exprLocation((Node *) spec)))); + errmsg("invalid bound specification for a list partition"), + parser_errposition(pstate, exprLocation((Node *) spec)))); /* Get the only column's name in case we need to output an error */ if (key->partattrs[0] != 0) @@ -4141,8 +4141,8 @@ transformPartitionBound(ParseState *pstate, Relation parent, key->partattrs[0]); else colname = deparse_expression((Node *) linitial(partexprs), - deparse_context_for(RelationGetRelationName(parent), - RelationGetRelid(parent)), + deparse_context_for(RelationGetRelationName(parent), + RelationGetRelid(parent)), false, false); /* Need its type data too */ coltype = get_partition_col_typid(key, 0); @@ -4189,8 +4189,8 @@ transformPartitionBound(ParseState *pstate, Relation parent, if (spec->strategy != PARTITION_STRATEGY_RANGE) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLE_DEFINITION), - errmsg("invalid bound specification for a range partition"), - parser_errposition(pstate, exprLocation((Node *) spec)))); + errmsg("invalid bound specification for a range partition"), + parser_errposition(pstate, exprLocation((Node *) spec)))); if (list_length(spec->lowerdatums) != partnatts) ereport(ERROR, @@ -4216,8 +4216,8 @@ transformPartitionBound(ParseState *pstate, Relation parent, else if (seen_unbounded) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("cannot specify finite value after UNBOUNDED"), - parser_errposition(pstate, exprLocation((Node *) ldatum)))); + errmsg("cannot specify finite value after UNBOUNDED"), + parser_errposition(pstate, exprLocation((Node *) ldatum)))); } seen_unbounded = false; foreach(cell1, spec->upperdatums) @@ -4230,8 +4230,8 @@ transformPartitionBound(ParseState *pstate, Relation parent, else if (seen_unbounded) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("cannot specify finite value after UNBOUNDED"), - parser_errposition(pstate, exprLocation((Node *) rdatum)))); + errmsg("cannot specify finite value after UNBOUNDED"), + parser_errposition(pstate, exprLocation((Node *) rdatum)))); } /* Transform all the constants */ @@ -4254,8 +4254,8 @@ transformPartitionBound(ParseState *pstate, Relation parent, else { colname = deparse_expression((Node *) list_nth(partexprs, j), - deparse_context_for(RelationGetRelationName(parent), - RelationGetRelid(parent)), + deparse_context_for(RelationGetRelationName(parent), + RelationGetRelid(parent)), false, false); ++j; } @@ -4310,7 +4310,7 @@ transformPartitionBound(ParseState *pstate, Relation parent, */ static Const * transformPartitionBoundValue(ParseState *pstate, A_Const *con, - const char *colName, Oid colType, int32 colTypmod) + const char *colName, Oid colType, int32 colTypmod) { Node *value; @@ -4329,8 +4329,8 @@ transformPartitionBoundValue(ParseState *pstate, A_Const *con, if (value == NULL) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("specified value cannot be cast to type %s for column \"%s\"", - format_type_be(colType), colName), + errmsg("specified value cannot be cast to type %s for column \"%s\"", + format_type_be(colType), colName), parser_errposition(pstate, con->location))); /* Simplify the expression, in case we had a coercion */ @@ -4341,8 +4341,8 @@ transformPartitionBoundValue(ParseState *pstate, A_Const *con, if (!IsA(value, Const)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("specified value cannot be cast to type %s for column \"%s\"", - format_type_be(colType), colName), + errmsg("specified value cannot be cast to type %s for column \"%s\"", + format_type_be(colType), colName), errdetail("The cast requires a non-immutable conversion."), errhint("Try putting the literal value in single quotes."), parser_errposition(pstate, con->location))); diff --git a/src/backend/port/atomics.c b/src/backend/port/atomics.c index 231d847de7..c0c2b31270 100644 --- a/src/backend/port/atomics.c +++ b/src/backend/port/atomics.c @@ -82,7 +82,7 @@ pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr) S_UNLOCK((slock_t *) &ptr->sema); } -#endif /* PG_HAVE_ATOMIC_FLAG_SIMULATION */ +#endif /* PG_HAVE_ATOMIC_FLAG_SIMULATION */ #ifdef PG_HAVE_ATOMIC_U32_SIMULATION void @@ -156,7 +156,7 @@ pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_) return oldval; } -#endif /* PG_HAVE_ATOMIC_U32_SIMULATION */ +#endif /* PG_HAVE_ATOMIC_U32_SIMULATION */ #ifdef PG_HAVE_ATOMIC_U64_SIMULATION @@ -219,4 +219,4 @@ pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_) return oldval; } -#endif /* PG_HAVE_ATOMIC_U64_SIMULATION */ +#endif /* PG_HAVE_ATOMIC_U64_SIMULATION */ diff --git a/src/backend/port/dynloader/aix.h b/src/backend/port/dynloader/aix.h index 321597dae2..4b1bad6e45 100644 --- a/src/backend/port/dynloader/aix.h +++ b/src/backend/port/dynloader/aix.h @@ -16,7 +16,7 @@ #define PORT_PROTOS_H #include <dlfcn.h> -#include "utils/dynamic_loader.h" /* pgrminclude ignore */ +#include "utils/dynamic_loader.h" /* pgrminclude ignore */ /* * In some older systems, the RTLD_NOW flag isn't defined and the mode @@ -36,4 +36,4 @@ #define pg_dlclose(h) dlclose(h) #define pg_dlerror() dlerror() -#endif /* PORT_PROTOS_H */ +#endif /* PORT_PROTOS_H */ diff --git a/src/backend/port/dynloader/cygwin.h b/src/backend/port/dynloader/cygwin.h index bb3d7a322a..5d819cfd7b 100644 --- a/src/backend/port/dynloader/cygwin.h +++ b/src/backend/port/dynloader/cygwin.h @@ -13,7 +13,7 @@ #define PORT_PROTOS_H #include <dlfcn.h> -#include "utils/dynamic_loader.h" /* pgrminclude ignore */ +#include "utils/dynamic_loader.h" /* pgrminclude ignore */ /* * In some older systems, the RTLD_NOW flag isn't defined and the mode @@ -33,4 +33,4 @@ #define pg_dlclose dlclose #define pg_dlerror dlerror -#endif /* PORT_PROTOS_H */ +#endif /* PORT_PROTOS_H */ diff --git a/src/backend/port/dynloader/darwin.c b/src/backend/port/dynloader/darwin.c index 7b6b48d14a..f8fdeaf122 100644 --- a/src/backend/port/dynloader/darwin.c +++ b/src/backend/port/dynloader/darwin.c @@ -135,4 +135,4 @@ pg_dlerror(void) return (char *) errorString; } -#endif /* HAVE_DLOPEN */ +#endif /* HAVE_DLOPEN */ diff --git a/src/backend/port/dynloader/freebsd.c b/src/backend/port/dynloader/freebsd.c index e61b1c241a..23547b06bb 100644 --- a/src/backend/port/dynloader/freebsd.c +++ b/src/backend/port/dynloader/freebsd.c @@ -32,7 +32,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91"; -#endif /* LIBC_SCCS and not lint */ +#endif /* LIBC_SCCS and not lint */ #include "postgres.h" @@ -89,7 +89,7 @@ BSD44_derived_dlsym(void *handle, const char *name) snprintf(buf, sizeof(buf), "_%s", name); name = buf; } -#endif /* !__ELF__ */ +#endif /* !__ELF__ */ if ((vp = dlsym(handle, (char *) name)) == NULL) snprintf(error_message, sizeof(error_message), "dlsym (%s) failed", name); diff --git a/src/backend/port/dynloader/freebsd.h b/src/backend/port/dynloader/freebsd.h index 6116d3f83f..6faf07f962 100644 --- a/src/backend/port/dynloader/freebsd.h +++ b/src/backend/port/dynloader/freebsd.h @@ -17,7 +17,7 @@ #include <link.h> #include <dlfcn.h> -#include "utils/dynamic_loader.h" /* pgrminclude ignore */ +#include "utils/dynamic_loader.h" /* pgrminclude ignore */ /* * Dynamic Loader on NetBSD 1.0. @@ -55,4 +55,4 @@ void *BSD44_derived_dlopen(const char *filename, int num); void *BSD44_derived_dlsym(void *handle, const char *name); void BSD44_derived_dlclose(void *handle); -#endif /* PORT_PROTOS_H */ +#endif /* PORT_PROTOS_H */ diff --git a/src/backend/port/dynloader/hpux.c b/src/backend/port/dynloader/hpux.c index c7f93d2d4a..5a0e40146d 100644 --- a/src/backend/port/dynloader/hpux.c +++ b/src/backend/port/dynloader/hpux.c @@ -34,7 +34,7 @@ pg_dlopen(char *filename) * call the library! */ shl_t handle = shl_load(filename, - BIND_IMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH, + BIND_IMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH, 0L); return (void *) handle; diff --git a/src/backend/port/dynloader/linux.c b/src/backend/port/dynloader/linux.c index 368bf0006f..38e19f7484 100644 --- a/src/backend/port/dynloader/linux.c +++ b/src/backend/port/dynloader/linux.c @@ -130,4 +130,4 @@ pg_dlerror(void) #endif } -#endif /* !HAVE_DLOPEN */ +#endif /* !HAVE_DLOPEN */ diff --git a/src/backend/port/dynloader/linux.h b/src/backend/port/dynloader/linux.h index 9d804ad955..d2c25df033 100644 --- a/src/backend/port/dynloader/linux.h +++ b/src/backend/port/dynloader/linux.h @@ -14,7 +14,7 @@ #ifndef PORT_PROTOS_H #define PORT_PROTOS_H -#include "utils/dynamic_loader.h" /* pgrminclude ignore */ +#include "utils/dynamic_loader.h" /* pgrminclude ignore */ #ifdef HAVE_DLOPEN #include <dlfcn.h> #endif @@ -39,6 +39,6 @@ #define pg_dlsym dlsym #define pg_dlclose dlclose #define pg_dlerror dlerror -#endif /* HAVE_DLOPEN */ +#endif /* HAVE_DLOPEN */ -#endif /* PORT_PROTOS_H */ +#endif /* PORT_PROTOS_H */ diff --git a/src/backend/port/dynloader/netbsd.c b/src/backend/port/dynloader/netbsd.c index 01a96013cb..475d746514 100644 --- a/src/backend/port/dynloader/netbsd.c +++ b/src/backend/port/dynloader/netbsd.c @@ -32,7 +32,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91"; -#endif /* LIBC_SCCS and not lint */ +#endif /* LIBC_SCCS and not lint */ #include "postgres.h" @@ -89,7 +89,7 @@ BSD44_derived_dlsym(void *handle, const char *name) snprintf(buf, sizeof(buf), "_%s", name); name = buf; } -#endif /* !__ELF__ */ +#endif /* !__ELF__ */ if ((vp = dlsym(handle, (char *) name)) == NULL) snprintf(error_message, sizeof(error_message), "dlsym (%s) failed", name); diff --git a/src/backend/port/dynloader/netbsd.h b/src/backend/port/dynloader/netbsd.h index 0bd406850d..2ca332256b 100644 --- a/src/backend/port/dynloader/netbsd.h +++ b/src/backend/port/dynloader/netbsd.h @@ -18,7 +18,7 @@ #include <link.h> #include <dlfcn.h> -#include "utils/dynamic_loader.h" /* pgrminclude ignore */ +#include "utils/dynamic_loader.h" /* pgrminclude ignore */ /* * Dynamic Loader on NetBSD 1.0. @@ -56,4 +56,4 @@ void *BSD44_derived_dlopen(const char *filename, int num); void *BSD44_derived_dlsym(void *handle, const char *name); void BSD44_derived_dlclose(void *handle); -#endif /* PORT_PROTOS_H */ +#endif /* PORT_PROTOS_H */ diff --git a/src/backend/port/dynloader/openbsd.c b/src/backend/port/dynloader/openbsd.c index fcd336acbe..7b481b90d1 100644 --- a/src/backend/port/dynloader/openbsd.c +++ b/src/backend/port/dynloader/openbsd.c @@ -32,7 +32,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91"; -#endif /* LIBC_SCCS and not lint */ +#endif /* LIBC_SCCS and not lint */ #include "postgres.h" @@ -89,7 +89,7 @@ BSD44_derived_dlsym(void *handle, const char *name) snprintf(buf, sizeof(buf), "_%s", name); name = buf; } -#endif /* !__ELF__ */ +#endif /* !__ELF__ */ if ((vp = dlsym(handle, (char *) name)) == NULL) snprintf(error_message, sizeof(error_message), "dlsym (%s) failed", name); diff --git a/src/backend/port/dynloader/openbsd.h b/src/backend/port/dynloader/openbsd.h index 25d5439633..1130f39b41 100644 --- a/src/backend/port/dynloader/openbsd.h +++ b/src/backend/port/dynloader/openbsd.h @@ -17,7 +17,7 @@ #include <link.h> #include <dlfcn.h> -#include "utils/dynamic_loader.h" /* pgrminclude ignore */ +#include "utils/dynamic_loader.h" /* pgrminclude ignore */ /* * Dynamic Loader on NetBSD 1.0. @@ -55,4 +55,4 @@ void *BSD44_derived_dlopen(const char *filename, int num); void *BSD44_derived_dlsym(void *handle, const char *name); void BSD44_derived_dlclose(void *handle); -#endif /* PORT_PROTOS_H */ +#endif /* PORT_PROTOS_H */ diff --git a/src/backend/port/dynloader/solaris.h b/src/backend/port/dynloader/solaris.h index f50ba524dc..e7638ff0fc 100644 --- a/src/backend/port/dynloader/solaris.h +++ b/src/backend/port/dynloader/solaris.h @@ -15,7 +15,7 @@ #define PORT_PROTOS_H #include <dlfcn.h> -#include "utils/dynamic_loader.h" /* pgrminclude ignore */ +#include "utils/dynamic_loader.h" /* pgrminclude ignore */ /* * In some older systems, the RTLD_NOW flag isn't defined and the mode @@ -35,4 +35,4 @@ #define pg_dlclose dlclose #define pg_dlerror dlerror -#endif /* PORT_PROTOS_H */ +#endif /* PORT_PROTOS_H */ diff --git a/src/backend/port/dynloader/win32.h b/src/backend/port/dynloader/win32.h index f689dc8ff9..ddbf866520 100644 --- a/src/backend/port/dynloader/win32.h +++ b/src/backend/port/dynloader/win32.h @@ -4,7 +4,7 @@ #ifndef PORT_PROTOS_H #define PORT_PROTOS_H -#include "utils/dynamic_loader.h" /* pgrminclude ignore */ +#include "utils/dynamic_loader.h" /* pgrminclude ignore */ #define pg_dlopen(f) dlopen((f), 1) #define pg_dlsym dlsym @@ -16,4 +16,4 @@ int dlclose(void *handle); void *dlsym(void *handle, const char *symbol); void *dlopen(const char *path, int mode); -#endif /* PORT_PROTOS_H */ +#endif /* PORT_PROTOS_H */ diff --git a/src/backend/port/posix_sema.c b/src/backend/port/posix_sema.c index f251ac6788..5719caf9b5 100644 --- a/src/backend/port/posix_sema.c +++ b/src/backend/port/posix_sema.c @@ -130,7 +130,7 @@ PosixSemaphoreCreate(sem_t *sem) if (sem_init(sem, 1, 1) < 0) elog(FATAL, "sem_init failed: %m"); } -#endif /* USE_NAMED_POSIX_SEMAPHORES */ +#endif /* USE_NAMED_POSIX_SEMAPHORES */ /* diff --git a/src/backend/port/sysv_sema.c b/src/backend/port/sysv_sema.c index 4fbcc5e2b4..d4202feb56 100644 --- a/src/backend/port/sysv_sema.c +++ b/src/backend/port/sysv_sema.c @@ -64,10 +64,10 @@ typedef int IpcSemaphoreId; /* semaphore ID returned by semget(2) */ static PGSemaphore sharedSemas; /* array of PGSemaphoreData in shared memory */ static int numSharedSemas; /* number of PGSemaphoreDatas used so far */ static int maxSharedSemas; /* allocated size of PGSemaphoreData array */ -static IpcSemaphoreId *mySemaSets; /* IDs of sema sets acquired so far */ +static IpcSemaphoreId *mySemaSets; /* IDs of sema sets acquired so far */ static int numSemaSets; /* number of sema sets acquired so far */ static int maxSemaSets; /* allocated size of mySemaSets array */ -static IpcSemaphoreKey nextSemaKey; /* next key to try using */ +static IpcSemaphoreKey nextSemaKey; /* next key to try using */ static int nextSemaNumber; /* next free sem num in last sema set */ @@ -126,12 +126,12 @@ InternalIpcSemaphoreCreate(IpcSemaphoreKey semKey, int numSems) IPC_CREAT | IPC_EXCL | IPCProtection), (saved_errno == ENOSPC) ? errhint("This error does *not* mean that you have run out of disk space. " - "It occurs when either the system limit for the maximum number of " - "semaphore sets (SEMMNI), or the system wide maximum number of " - "semaphores (SEMMNS), would be exceeded. You need to raise the " - "respective kernel parameter. Alternatively, reduce PostgreSQL's " + "It occurs when either the system limit for the maximum number of " + "semaphore sets (SEMMNI), or the system wide maximum number of " + "semaphores (SEMMNS), would be exceeded. You need to raise the " + "respective kernel parameter. Alternatively, reduce PostgreSQL's " "consumption of semaphores by reducing its max_connections parameter.\n" - "The PostgreSQL documentation contains more information about " + "The PostgreSQL documentation contains more information about " "configuring your system for PostgreSQL.") : 0)); } @@ -156,7 +156,7 @@ IpcSemaphoreInitialize(IpcSemaphoreId semId, int semNum, int value) semId, semNum, value), (saved_errno == ERANGE) ? errhint("You possibly need to raise your kernel's SEMVMX value to be at least " - "%d. Look into the PostgreSQL documentation for details.", + "%d. Look into the PostgreSQL documentation for details.", value) : 0)); } } @@ -333,7 +333,7 @@ PGReserveSemaphores(int maxSemas, int port) elog(PANIC, "out of memory"); numSemaSets = 0; nextSemaKey = port * 1000; - nextSemaNumber = SEMAS_PER_SET; /* force sema set alloc on 1st call */ + nextSemaNumber = SEMAS_PER_SET; /* force sema set alloc on 1st call */ on_shmem_exit(ReleaseSemaphores, 0); } diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c index 124b2148de..273d1313b0 100644 --- a/src/backend/port/sysv_shmem.c +++ b/src/backend/port/sysv_shmem.c @@ -193,29 +193,29 @@ InternalIpcMemoryCreate(IpcMemoryKey memKey, Size size) errno = shmget_errno; ereport(FATAL, (errmsg("could not create shared memory segment: %m"), - errdetail("Failed system call was shmget(key=%lu, size=%zu, 0%o).", - (unsigned long) memKey, size, - IPC_CREAT | IPC_EXCL | IPCProtection), + errdetail("Failed system call was shmget(key=%lu, size=%zu, 0%o).", + (unsigned long) memKey, size, + IPC_CREAT | IPC_EXCL | IPCProtection), (shmget_errno == EINVAL) ? errhint("This error usually means that PostgreSQL's request for a shared memory " - "segment exceeded your kernel's SHMMAX parameter, or possibly that " + "segment exceeded your kernel's SHMMAX parameter, or possibly that " "it is less than " "your kernel's SHMMIN parameter.\n" - "The PostgreSQL documentation contains more information about shared " + "The PostgreSQL documentation contains more information about shared " "memory configuration.") : 0, (shmget_errno == ENOMEM) ? errhint("This error usually means that PostgreSQL's request for a shared " "memory segment exceeded your kernel's SHMALL parameter. You might need " "to reconfigure the kernel with larger SHMALL.\n" - "The PostgreSQL documentation contains more information about shared " + "The PostgreSQL documentation contains more information about shared " "memory configuration.") : 0, (shmget_errno == ENOSPC) ? errhint("This error does *not* mean that you have run out of disk space. " "It occurs either if all available shared memory IDs have been taken, " "in which case you need to raise the SHMMNI parameter in your kernel, " - "or because the system's overall limit for shared memory has been " + "or because the system's overall limit for shared memory has been " "reached.\n" - "The PostgreSQL documentation contains more information about shared " + "The PostgreSQL documentation contains more information about shared " "memory configuration.") : 0)); } @@ -440,10 +440,10 @@ GetHugePageSize(Size *hugepagesize, int *mmap_flags) FreeFile(fp); } } -#endif /* __linux__ */ +#endif /* __linux__ */ } -#endif /* MAP_HUGETLB */ +#endif /* MAP_HUGETLB */ /* * Creates an anonymous mmap()ed shared memory segment. @@ -504,10 +504,10 @@ CreateAnonymousSegment(Size *size) (errmsg("could not map anonymous shared memory: %m"), (mmap_errno == ENOMEM) ? errhint("This error usually means that PostgreSQL's request " - "for a shared memory segment exceeded available memory, " - "swap space, or huge pages. To reduce the request size " + "for a shared memory segment exceeded available memory, " + "swap space, or huge pages. To reduce the request size " "(currently %zu bytes), reduce PostgreSQL's shared " - "memory usage, perhaps by reducing shared_buffers or " + "memory usage, perhaps by reducing shared_buffers or " "max_connections.", *size) : 0)); } @@ -533,7 +533,7 @@ AnonymousShmemDetach(int status, Datum arg) } } -#endif /* USE_ANONYMOUS_SHMEM */ +#endif /* USE_ANONYMOUS_SHMEM */ /* * PGSharedMemoryCreate @@ -771,7 +771,7 @@ PGSharedMemoryNoReAttach(void) UsedShmemSegID = 0; } -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ /* * PGSharedMemoryDetach diff --git a/src/backend/port/win32/crashdump.c b/src/backend/port/win32/crashdump.c index ff44b6033e..f06dfd1987 100644 --- a/src/backend/port/win32/crashdump.c +++ b/src/backend/port/win32/crashdump.c @@ -71,9 +71,9 @@ */ typedef BOOL (WINAPI * MINIDUMPWRITEDUMP) (HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, - CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, - CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, - CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam + CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, + CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, + CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam ); @@ -89,7 +89,7 @@ typedef BOOL (WINAPI * MINIDUMPWRITEDUMP) (HANDLE hProcess, DWORD dwPid, HANDLE * any PostgreSQL functions. */ static LONG WINAPI -crashDumpHandler(struct _EXCEPTION_POINTERS * pExceptionInfo) +crashDumpHandler(struct _EXCEPTION_POINTERS *pExceptionInfo) { /* * We only write crash dumps if the "crashdumps" directory within the diff --git a/src/backend/port/win32/mingwcompat.c b/src/backend/port/win32/mingwcompat.c index ca63c6ee27..e02b41711e 100644 --- a/src/backend/port/win32/mingwcompat.c +++ b/src/backend/port/win32/mingwcompat.c @@ -42,8 +42,8 @@ LoadKernel32() kernel32 = LoadLibraryEx("kernel32.dll", NULL, 0); if (kernel32 == NULL) ereport(FATAL, - (errmsg_internal("could not load kernel32.dll: error code %lu", - GetLastError()))); + (errmsg_internal("could not load kernel32.dll: error code %lu", + GetLastError()))); } diff --git a/src/backend/port/win32/signal.c b/src/backend/port/win32/signal.c index ebbd434b9a..0fd993e3f3 100644 --- a/src/backend/port/win32/signal.c +++ b/src/backend/port/win32/signal.c @@ -186,7 +186,7 @@ pgwin32_create_signal_listener(pid_t pid) snprintf(pipename, sizeof(pipename), "\\\\.\\pipe\\pgsignal_%u", (int) pid); pipe = CreateNamedPipe(pipename, PIPE_ACCESS_DUPLEX, - PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, 16, 16, 1000, NULL); if (pipe == INVALID_HANDLE_VALUE) @@ -266,8 +266,8 @@ pg_signal_thread(LPVOID param) if (pipe == INVALID_HANDLE_VALUE) { pipe = CreateNamedPipe(pipename, PIPE_ACCESS_DUPLEX, - PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, - PIPE_UNLIMITED_INSTANCES, 16, 16, 1000, NULL); + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, 16, 16, 1000, NULL); if (pipe == INVALID_HANDLE_VALUE) { @@ -293,8 +293,8 @@ pg_signal_thread(LPVOID param) * window of time where we will miss incoming requests. */ newpipe = CreateNamedPipe(pipename, PIPE_ACCESS_DUPLEX, - PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, - PIPE_UNLIMITED_INSTANCES, 16, 16, 1000, NULL); + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, 16, 16, 1000, NULL); if (newpipe == INVALID_HANDLE_VALUE) { /* @@ -311,7 +311,7 @@ pg_signal_thread(LPVOID param) */ } hThread = CreateThread(NULL, 0, - (LPTHREAD_START_ROUTINE) pg_signal_dispatch_thread, + (LPTHREAD_START_ROUTINE) pg_signal_dispatch_thread, (LPVOID) pipe, 0, NULL); if (hThread == INVALID_HANDLE_VALUE) write_stderr("could not create signal dispatch thread: error code %lu\n", diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socket.c index f11d6e6eb8..ba8b863d82 100644 --- a/src/backend/port/win32/socket.c +++ b/src/backend/port/win32/socket.c @@ -298,7 +298,7 @@ pgwin32_socket(int af, int type, int protocol) } int -pgwin32_bind(SOCKET s, struct sockaddr * addr, int addrlen) +pgwin32_bind(SOCKET s, struct sockaddr *addr, int addrlen) { int res; @@ -320,7 +320,7 @@ pgwin32_listen(SOCKET s, int backlog) } SOCKET -pgwin32_accept(SOCKET s, struct sockaddr * addr, int *addrlen) +pgwin32_accept(SOCKET s, struct sockaddr *addr, int *addrlen) { SOCKET rs; @@ -342,7 +342,7 @@ pgwin32_accept(SOCKET s, struct sockaddr * addr, int *addrlen) /* No signal delivery during connect. */ int -pgwin32_connect(SOCKET s, const struct sockaddr * addr, int addrlen) +pgwin32_connect(SOCKET s, const struct sockaddr *addr, int addrlen) { int r; @@ -426,7 +426,7 @@ pgwin32_recv(SOCKET s, char *buf, int len, int f) pg_usleep(10000); } ereport(NOTICE, - (errmsg_internal("could not read from ready socket (after retries)"))); + (errmsg_internal("could not read from ready socket (after retries)"))); errno = EWOULDBLOCK; return -1; } @@ -500,7 +500,7 @@ pgwin32_send(SOCKET s, const void *buf, int len, int flags) * since it is not used in postgresql! */ int -pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval * timeout) +pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout) { WSAEVENT events[FD_SETSIZE * 2]; /* worst case is readfds totally * different from writefds, so diff --git a/src/backend/port/win32/timer.c b/src/backend/port/win32/timer.c index 43097794f7..f0a45f4339 100644 --- a/src/backend/port/win32/timer.c +++ b/src/backend/port/win32/timer.c @@ -83,7 +83,7 @@ pg_timer_thread(LPVOID param) * to handle the timer setting and notification upon timeout. */ int -setitimer(int which, const struct itimerval * value, struct itimerval * ovalue) +setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) { Assert(value != NULL); Assert(value->it_interval.tv_sec == 0 && value->it_interval.tv_usec == 0); @@ -95,8 +95,8 @@ setitimer(int which, const struct itimerval * value, struct itimerval * ovalue) timerCommArea.event = CreateEvent(NULL, TRUE, FALSE, NULL); if (timerCommArea.event == NULL) ereport(FATAL, - (errmsg_internal("could not create timer event: error code %lu", - GetLastError()))); + (errmsg_internal("could not create timer event: error code %lu", + GetLastError()))); MemSet(&timerCommArea.value, 0, sizeof(struct itimerval)); @@ -105,8 +105,8 @@ setitimer(int which, const struct itimerval * value, struct itimerval * ovalue) timerThreadHandle = CreateThread(NULL, 0, pg_timer_thread, NULL, 0, NULL); if (timerThreadHandle == INVALID_HANDLE_VALUE) ereport(FATAL, - (errmsg_internal("could not create timer thread: error code %lu", - GetLastError()))); + (errmsg_internal("could not create timer thread: error code %lu", + GetLastError()))); } /* Request the timer thread to change settings */ diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c index 31489fcdb0..01f51f3158 100644 --- a/src/backend/port/win32_shmem.c +++ b/src/backend/port/win32_shmem.c @@ -49,7 +49,7 @@ GetSharedMemName(void) elog(FATAL, "could not get size for full pathname of datadir %s: error code %lu", DataDir, GetLastError()); - retptr = malloc(bufsize + 18); /* 18 for Global\PostgreSQL: */ + retptr = malloc(bufsize + 18); /* 18 for Global\PostgreSQL: */ if (retptr == NULL) elog(FATAL, "could not allocate memory for shared memory name"); @@ -163,9 +163,9 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port, hmap = CreateFileMapping(INVALID_HANDLE_VALUE, /* Use the pagefile */ NULL, /* Default security attrs */ - PAGE_READWRITE, /* Memory is Read/Write */ - size_high, /* Size Upper 32 Bits */ - size_low, /* Size Lower 32 bits */ + PAGE_READWRITE, /* Memory is Read/Write */ + size_high, /* Size Upper 32 Bits */ + size_low, /* Size Lower 32 bits */ szShareMem); if (!hmap) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 45ae93b4ef..eb939b880c 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -134,8 +134,8 @@ int Log_autovacuum_min_duration = -1; #define STATS_READ_DELAY 1000 /* the minimum allowed time between two awakenings of the launcher */ -#define MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */ -#define MAX_AUTOVAC_SLEEPTIME 300 /* seconds */ +#define MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */ +#define MAX_AUTOVAC_SLEEPTIME 300 /* seconds */ /* Flags to tell if we are in an autovacuum process */ static bool am_autovacuum_launcher = false; @@ -247,7 +247,7 @@ typedef enum AutoVacForkFailed, /* failed trying to start a worker */ AutoVacRebalance, /* rebalance the cost limits */ AutoVacNumSignals /* must be last */ -} AutoVacuumSignal; +} AutoVacuumSignal; /*------------- * The main autovacuum shmem struct. On shared memory we store this main @@ -326,7 +326,7 @@ NON_EXEC_STATIC void AutoVacLauncherMain(int argc, char *argv[]) pg_attribute_no static Oid do_start_worker(void); static void launcher_determine_sleep(bool canlaunch, bool recursing, - struct timeval * nap); + struct timeval *nap); static void launch_worker(TimestampTz now); static List *get_database_list(void); static void rebuild_database_list(Oid newdb); @@ -418,7 +418,7 @@ StartAutoVacLauncher(void) { case -1: ereport(LOG, - (errmsg("could not fork autovacuum launcher process: %m"))); + (errmsg("could not fork autovacuum launcher process: %m"))); return 0; #ifndef EXEC_BACKEND @@ -521,7 +521,7 @@ AutoVacLauncherMain(int argc, char *argv[]) /* Forget any pending QueryCancel or timeout request */ disable_all_timeouts(false); - QueryCancelPending = false; /* second to avoid race condition */ + QueryCancelPending = false; /* second to avoid race condition */ /* Report the error to the server log */ EmitErrorReport(); @@ -617,7 +617,8 @@ AutoVacLauncherMain(int argc, char *argv[]) /* * Set up our DSA so that backends can install work-item requests. It may - * already exist as created by a previous launcher. + * already exist as created by a previous launcher; and we may even be + * already attached to it, if we're here after longjmp'ing above. */ if (!AutoVacuumShmem->av_dsa_handle) { @@ -631,7 +632,7 @@ AutoVacLauncherMain(int argc, char *argv[]) AutoVacuumShmem->av_workitems = InvalidDsaPointer; LWLockRelease(AutovacuumLock); } - else + else if (AutoVacuumDSA == NULL) { AutoVacuumDSA = dsa_attach(AutoVacuumShmem->av_dsa_handle); dsa_pin_mapping(AutoVacuumDSA); @@ -854,7 +855,7 @@ shutdown: * cause a long sleep, which will be interrupted when a worker exits. */ static void -launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap) +launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval *nap) { /* * We sleep until the next scheduled vacuum. We trust that when the @@ -1808,9 +1809,9 @@ autovac_balance_cost(void) * zero is not a valid value. */ int vac_cost_limit = (autovacuum_vac_cost_limit > 0 ? - autovacuum_vac_cost_limit : VacuumCostLimit); + autovacuum_vac_cost_limit : VacuumCostLimit); int vac_cost_delay = (autovacuum_vac_cost_delay >= 0 ? - autovacuum_vac_cost_delay : VacuumCostDelay); + autovacuum_vac_cost_delay : VacuumCostDelay); double cost_total; double cost_avail; dlist_iter iter; @@ -2689,7 +2690,7 @@ perform_work_item(AutoVacuumWorkItem *workitem) case AVW_BRINSummarizeRange: DirectFunctionCall2(brin_summarize_range, ObjectIdGetDatum(workitem->avw_relation), - Int64GetDatum((int64) workitem->avw_blockNumber)); + Int64GetDatum((int64) workitem->avw_blockNumber)); break; default: elog(WARNING, "unrecognized work item found: type %d", diff --git a/src/backend/postmaster/bgworker.c b/src/backend/postmaster/bgworker.c index 712d700481..28af6f0f07 100644 --- a/src/backend/postmaster/bgworker.c +++ b/src/backend/postmaster/bgworker.c @@ -118,7 +118,7 @@ static const struct { const char *fn_name; bgworker_main_type fn_addr; -} InternalBGWorkers[] = +} InternalBGWorkers[] = { { @@ -636,7 +636,7 @@ SanityCheckBackgroundWorker(BackgroundWorker *worker, int elevel) static void bgworker_quickdie(SIGNAL_ARGS) { - sigaddset(&BlockSig, SIGQUIT); /* prevent nested calls */ + sigaddset(&BlockSig, SIGQUIT); /* prevent nested calls */ PG_SETMASK(&BlockSig); /* @@ -853,7 +853,7 @@ RegisterBackgroundWorker(BackgroundWorker *worker) if (!IsUnderPostmaster) ereport(DEBUG1, - (errmsg("registering background worker \"%s\"", worker->bgw_name))); + (errmsg("registering background worker \"%s\"", worker->bgw_name))); if (!process_shared_preload_libraries_in_progress && strcmp(worker->bgw_library_name, "postgres") != 0) @@ -986,7 +986,7 @@ RegisterDynamicBackgroundWorker(BackgroundWorker *worker, if (!slot->in_use) { memcpy(&slot->worker, worker, sizeof(BackgroundWorker)); - slot->pid = InvalidPid; /* indicates not started yet */ + slot->pid = InvalidPid; /* indicates not started yet */ slot->generation++; slot->terminate = false; generation = slot->generation; diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c index 2674bb49ba..9ad74ee977 100644 --- a/src/backend/postmaster/bgwriter.c +++ b/src/backend/postmaster/bgwriter.c @@ -122,8 +122,8 @@ BackgroundWriterMain(void) */ pqsignal(SIGHUP, BgSigHupHandler); /* set flag to read config file */ pqsignal(SIGINT, SIG_IGN); - pqsignal(SIGTERM, ReqShutdownHandler); /* shutdown */ - pqsignal(SIGQUIT, bg_quickdie); /* hard crash time */ + pqsignal(SIGTERM, ReqShutdownHandler); /* shutdown */ + pqsignal(SIGQUIT, bg_quickdie); /* hard crash time */ pqsignal(SIGALRM, SIG_IGN); pqsignal(SIGPIPE, SIG_IGN); pqsignal(SIGUSR1, bgwriter_sigusr1_handler); diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c index a55071900d..e48ebd557f 100644 --- a/src/backend/postmaster/checkpointer.c +++ b/src/backend/postmaster/checkpointer.c @@ -116,7 +116,7 @@ typedef struct typedef struct { - pid_t checkpointer_pid; /* PID (0 if not started) */ + pid_t checkpointer_pid; /* PID (0 if not started) */ slock_t ckpt_lck; /* protects all the ckpt_* fields */ @@ -126,8 +126,8 @@ typedef struct int ckpt_flags; /* checkpoint flags, as defined in xlog.h */ - uint32 num_backend_writes; /* counts user backend buffer writes */ - uint32 num_backend_fsync; /* counts user backend fsync calls */ + uint32 num_backend_writes; /* counts user backend buffer writes */ + uint32 num_backend_fsync; /* counts user backend fsync calls */ int num_requests; /* current # of requests */ int max_requests; /* allocated array size */ @@ -205,15 +205,14 @@ CheckpointerMain(void) * want to wait for the backends to exit, whereupon the postmaster will * tell us it's okay to shut down (via SIGUSR2). */ - pqsignal(SIGHUP, ChkptSigHupHandler); /* set flag to read config - * file */ - pqsignal(SIGINT, ReqCheckpointHandler); /* request checkpoint */ + pqsignal(SIGHUP, ChkptSigHupHandler); /* set flag to read config file */ + pqsignal(SIGINT, ReqCheckpointHandler); /* request checkpoint */ pqsignal(SIGTERM, SIG_IGN); /* ignore SIGTERM */ pqsignal(SIGQUIT, chkpt_quickdie); /* hard crash time */ pqsignal(SIGALRM, SIG_IGN); pqsignal(SIGPIPE, SIG_IGN); pqsignal(SIGUSR1, chkpt_sigusr1_handler); - pqsignal(SIGUSR2, ReqShutdownHandler); /* request shutdown */ + pqsignal(SIGUSR2, ReqShutdownHandler); /* request shutdown */ /* * Reset some signals that are accepted by postmaster but not here @@ -463,7 +462,7 @@ CheckpointerMain(void) elapsed_secs < CheckPointWarning) ereport(LOG, (errmsg_plural("checkpoints are occurring too frequently (%d second apart)", - "checkpoints are occurring too frequently (%d seconds apart)", + "checkpoints are occurring too frequently (%d seconds apart)", elapsed_secs, elapsed_secs), errhint("Consider increasing the configuration parameter \"max_wal_size\"."))); @@ -1281,8 +1280,8 @@ CompactCheckpointerRequestQueue(void) CheckpointerShmem->requests[preserve_count++] = CheckpointerShmem->requests[n]; } ereport(DEBUG1, - (errmsg("compacted fsync request queue from %d entries to %d entries", - CheckpointerShmem->num_requests, preserve_count))); + (errmsg("compacted fsync request queue from %d entries to %d entries", + CheckpointerShmem->num_requests, preserve_count))); CheckpointerShmem->num_requests = preserve_count; /* Cleanup. */ diff --git a/src/backend/postmaster/fork_process.c b/src/backend/postmaster/fork_process.c index 0bb15d8487..65145b1205 100644 --- a/src/backend/postmaster/fork_process.c +++ b/src/backend/postmaster/fork_process.c @@ -118,4 +118,4 @@ fork_process(void) return result; } -#endif /* ! WIN32 */ +#endif /* ! WIN32 */ diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c index 2dce39fdef..ddf9d698e0 100644 --- a/src/backend/postmaster/pgarch.c +++ b/src/backend/postmaster/pgarch.c @@ -54,11 +54,10 @@ * Timer definitions. * ---------- */ -#define PGARCH_AUTOWAKE_INTERVAL 60 /* How often to force a poll of the - * archive status directory; in - * seconds. */ -#define PGARCH_RESTART_INTERVAL 10 /* How often to attempt to restart a - * failed archiver; in seconds. */ +#define PGARCH_AUTOWAKE_INTERVAL 60 /* How often to force a poll of the + * archive status directory; in seconds. */ +#define PGARCH_RESTART_INTERVAL 10 /* How often to attempt to restart a + * failed archiver; in seconds. */ #define NUM_ARCHIVE_RETRIES 3 @@ -203,7 +202,7 @@ pgarch_forkexec(void) return postmaster_forkexec(ac, av); } -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ /* @@ -389,7 +388,7 @@ pgarch_MainLoop(void) int rc; rc = WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, + WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, timeout * 1000L, WAIT_EVENT_ARCHIVER_MAIN); if (rc & WL_TIMEOUT) @@ -594,16 +593,16 @@ pgarch_archiveXlog(char *xlog) { #if defined(WIN32) ereport(lev, - (errmsg("archive command was terminated by exception 0x%X", - WTERMSIG(rc)), - errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."), - errdetail("The failed archive command was: %s", - xlogarchcmd))); + (errmsg("archive command was terminated by exception 0x%X", + WTERMSIG(rc)), + errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."), + errdetail("The failed archive command was: %s", + xlogarchcmd))); #elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST ereport(lev, (errmsg("archive command was terminated by signal %d: %s", WTERMSIG(rc), - WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"), + WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"), errdetail("The failed archive command was: %s", xlogarchcmd))); #else @@ -617,10 +616,10 @@ pgarch_archiveXlog(char *xlog) else { ereport(lev, - (errmsg("archive command exited with unrecognized status %d", - rc), - errdetail("The failed archive command was: %s", - xlogarchcmd))); + (errmsg("archive command exited with unrecognized status %d", + rc), + errdetail("The failed archive command was: %s", + xlogarchcmd))); } snprintf(activitymsg, sizeof(activitymsg), "failed on %s", xlog); diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 288eb8efc6..98cd5dd9b8 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -75,21 +75,21 @@ * Timer definitions. * ---------- */ -#define PGSTAT_STAT_INTERVAL 500 /* Minimum time between stats file - * updates; in milliseconds. */ +#define PGSTAT_STAT_INTERVAL 500 /* Minimum time between stats file + * updates; in milliseconds. */ -#define PGSTAT_RETRY_DELAY 10 /* How long to wait between checks for - * a new file; in milliseconds. */ +#define PGSTAT_RETRY_DELAY 10 /* How long to wait between checks for a + * new file; in milliseconds. */ #define PGSTAT_MAX_WAIT_TIME 10000 /* Maximum time to wait for a stats * file update; in milliseconds. */ -#define PGSTAT_INQ_INTERVAL 640 /* How often to ping the collector for - * a new file; in milliseconds. */ +#define PGSTAT_INQ_INTERVAL 640 /* How often to ping the collector for a + * new file; in milliseconds. */ -#define PGSTAT_RESTART_INTERVAL 60 /* How often to attempt to restart a - * failed statistics collector; in - * seconds. */ +#define PGSTAT_RESTART_INTERVAL 60 /* How often to attempt to restart a + * failed statistics collector; in + * seconds. */ #define PGSTAT_POLL_LOOP_COUNT (PGSTAT_MAX_WAIT_TIME / PGSTAT_RETRY_DELAY) #define PGSTAT_INQ_LOOP_COUNT (PGSTAT_INQ_INTERVAL / PGSTAT_RETRY_DELAY) @@ -214,7 +214,7 @@ typedef struct PgStat_SubXactStatus { int nest_level; /* subtransaction nest level */ struct PgStat_SubXactStatus *prev; /* higher-level subxact if any */ - PgStat_TableXactStatus *first; /* head of list for this subxact */ + PgStat_TableXactStatus *first; /* head of list for this subxact */ } PgStat_SubXactStatus; static PgStat_SubXactStatus *pgStatXactStack = NULL; @@ -227,9 +227,9 @@ PgStat_Counter pgStatBlockWriteTime = 0; /* Record that's written to 2PC state file when pgstat state is persisted */ typedef struct TwoPhasePgStatRecord { - PgStat_Counter tuples_inserted; /* tuples inserted in xact */ - PgStat_Counter tuples_updated; /* tuples updated in xact */ - PgStat_Counter tuples_deleted; /* tuples deleted in xact */ + PgStat_Counter tuples_inserted; /* tuples inserted in xact */ + PgStat_Counter tuples_updated; /* tuples updated in xact */ + PgStat_Counter tuples_deleted; /* tuples deleted in xact */ PgStat_Counter inserted_pre_trunc; /* tuples inserted prior to truncate */ PgStat_Counter updated_pre_trunc; /* tuples updated prior to truncate */ PgStat_Counter deleted_pre_trunc; /* tuples deleted prior to truncate */ @@ -376,7 +376,7 @@ pgstat_init(void) * compile-time cross-check that we didn't. */ StaticAssertStmt(sizeof(PgStat_Msg) <= PGSTAT_MAX_MSG_SIZE, - "maximum stats message size exceeds PGSTAT_MAX_MSG_SIZE"); + "maximum stats message size exceeds PGSTAT_MAX_MSG_SIZE"); /* * Create the UDP socket for sending and receiving statistic messages @@ -416,7 +416,7 @@ pgstat_init(void) if (++tries > 1) ereport(LOG, - (errmsg("trying another address for the statistics collector"))); + (errmsg("trying another address for the statistics collector"))); /* * Create the socket. @@ -425,7 +425,7 @@ pgstat_init(void) { ereport(LOG, (errcode_for_socket_access(), - errmsg("could not create socket for statistics collector: %m"))); + errmsg("could not create socket for statistics collector: %m"))); continue; } @@ -437,14 +437,14 @@ pgstat_init(void) { ereport(LOG, (errcode_for_socket_access(), - errmsg("could not bind socket for statistics collector: %m"))); + errmsg("could not bind socket for statistics collector: %m"))); closesocket(pgStatSock); pgStatSock = PGINVALID_SOCKET; continue; } alen = sizeof(pgStatAddr); - if (getsockname(pgStatSock, (struct sockaddr *) & pgStatAddr, &alen) < 0) + if (getsockname(pgStatSock, (struct sockaddr *) &pgStatAddr, &alen) < 0) { ereport(LOG, (errcode_for_socket_access(), @@ -460,11 +460,11 @@ pgstat_init(void) * provides a kernel-level check that only packets from this same * address will be received. */ - if (connect(pgStatSock, (struct sockaddr *) & pgStatAddr, alen) < 0) + if (connect(pgStatSock, (struct sockaddr *) &pgStatAddr, alen) < 0) { ereport(LOG, (errcode_for_socket_access(), - errmsg("could not connect socket for statistics collector: %m"))); + errmsg("could not connect socket for statistics collector: %m"))); closesocket(pgStatSock); pgStatSock = PGINVALID_SOCKET; continue; @@ -613,7 +613,7 @@ retry2: startup_failed: ereport(LOG, - (errmsg("disabling statistics collector for lack of working socket"))); + (errmsg("disabling statistics collector for lack of working socket"))); if (addrs) pg_freeaddrinfo_all(hints.ai_family, addrs); @@ -711,7 +711,7 @@ pgstat_forkexec(void) return postmaster_forkexec(ac, av); } -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ /* @@ -1108,7 +1108,7 @@ pgstat_vacuum_stat(void) if (msg.m_nentries >= PGSTAT_NUM_TABPURGE) { len = offsetof(PgStat_MsgTabpurge, m_tableid[0]) - +msg.m_nentries * sizeof(Oid); + + msg.m_nentries * sizeof(Oid); pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE); msg.m_databaseid = MyDatabaseId; @@ -1124,7 +1124,7 @@ pgstat_vacuum_stat(void) if (msg.m_nentries > 0) { len = offsetof(PgStat_MsgTabpurge, m_tableid[0]) - +msg.m_nentries * sizeof(Oid); + + msg.m_nentries * sizeof(Oid); pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE); msg.m_databaseid = MyDatabaseId; @@ -1168,7 +1168,7 @@ pgstat_vacuum_stat(void) if (f_msg.m_nentries >= PGSTAT_NUM_FUNCPURGE) { len = offsetof(PgStat_MsgFuncpurge, m_functionid[0]) - +f_msg.m_nentries * sizeof(Oid); + + f_msg.m_nentries * sizeof(Oid); pgstat_send(&f_msg, len); @@ -1182,7 +1182,7 @@ pgstat_vacuum_stat(void) if (f_msg.m_nentries > 0) { len = offsetof(PgStat_MsgFuncpurge, m_functionid[0]) - +f_msg.m_nentries * sizeof(Oid); + + f_msg.m_nentries * sizeof(Oid); pgstat_send(&f_msg, len); } @@ -1285,13 +1285,13 @@ pgstat_drop_relation(Oid relid) msg.m_tableid[0] = relid; msg.m_nentries = 1; - len = offsetof(PgStat_MsgTabpurge, m_tableid[0]) +sizeof(Oid); + len = offsetof(PgStat_MsgTabpurge, m_tableid[0]) + sizeof(Oid); pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_TABPURGE); msg.m_databaseid = MyDatabaseId; pgstat_send(&msg, len); } -#endif /* NOT_USED */ +#endif /* NOT_USED */ /* ---------- @@ -2676,11 +2676,11 @@ BackendStatusShmemSize(void) mul_size(NAMEDATALEN, NumBackendStatSlots)); /* BackendActivityBuffer: */ size = add_size(size, - mul_size(pgstat_track_activity_query_size, NumBackendStatSlots)); + mul_size(pgstat_track_activity_query_size, NumBackendStatSlots)); #ifdef USE_SSL /* BackendSslStatusBuffer: */ size = add_size(size, - mul_size(sizeof(PgBackendSSLStatus), NumBackendStatSlots)); + mul_size(sizeof(PgBackendSSLStatus), NumBackendStatSlots)); #endif return size; } @@ -3301,13 +3301,13 @@ pgstat_read_current_status(void) localtable = (LocalPgBackendStatus *) MemoryContextAlloc(pgStatLocalContext, - sizeof(LocalPgBackendStatus) * NumBackendStatSlots); + sizeof(LocalPgBackendStatus) * NumBackendStatSlots); localappname = (char *) MemoryContextAlloc(pgStatLocalContext, NAMEDATALEN * NumBackendStatSlots); localactivity = (char *) MemoryContextAlloc(pgStatLocalContext, - pgstat_track_activity_query_size * NumBackendStatSlots); + pgstat_track_activity_query_size * NumBackendStatSlots); #ifdef USE_SSL localsslstatus = (PgBackendSSLStatus *) MemoryContextAlloc(pgStatLocalContext, @@ -4406,13 +4406,13 @@ PgstatCollectorMain(int argc, char *argv[]) case PGSTAT_MTYPE_RESETSHAREDCOUNTER: pgstat_recv_resetsharedcounter( - (PgStat_MsgResetsharedcounter *) &msg, + (PgStat_MsgResetsharedcounter *) &msg, len); break; case PGSTAT_MTYPE_RESETSINGLECOUNTER: pgstat_recv_resetsinglecounter( - (PgStat_MsgResetsinglecounter *) &msg, + (PgStat_MsgResetsinglecounter *) &msg, len); break; @@ -4464,7 +4464,7 @@ PgstatCollectorMain(int argc, char *argv[]) /* Sleep until there's something to do */ #ifndef WIN32 wr = WaitLatchOrSocket(MyLatch, - WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE, + WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE, pgStatSock, -1L, WAIT_EVENT_PGSTAT_MAIN); #else @@ -4480,7 +4480,7 @@ PgstatCollectorMain(int argc, char *argv[]) * backend_read_statsfile. */ wr = WaitLatchOrSocket(MyLatch, - WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE | WL_TIMEOUT, + WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE | WL_TIMEOUT, pgStatSock, 2 * 1000L /* msec */ , WAIT_EVENT_PGSTAT_MAIN); @@ -4759,8 +4759,8 @@ pgstat_write_statsfiles(bool permanent, bool allDbs) { ereport(LOG, (errcode_for_file_access(), - errmsg("could not write temporary statistics file \"%s\": %m", - tmpfile))); + errmsg("could not write temporary statistics file \"%s\": %m", + tmpfile))); FreeFile(fpout); unlink(tmpfile); } @@ -4768,8 +4768,8 @@ pgstat_write_statsfiles(bool permanent, bool allDbs) { ereport(LOG, (errcode_for_file_access(), - errmsg("could not close temporary statistics file \"%s\": %m", - tmpfile))); + errmsg("could not close temporary statistics file \"%s\": %m", + tmpfile))); unlink(tmpfile); } else if (rename(tmpfile, statfile) < 0) @@ -4894,8 +4894,8 @@ pgstat_write_db_statsfile(PgStat_StatDBEntry *dbentry, bool permanent) { ereport(LOG, (errcode_for_file_access(), - errmsg("could not write temporary statistics file \"%s\": %m", - tmpfile))); + errmsg("could not write temporary statistics file \"%s\": %m", + tmpfile))); FreeFile(fpout); unlink(tmpfile); } @@ -4903,8 +4903,8 @@ pgstat_write_db_statsfile(PgStat_StatDBEntry *dbentry, bool permanent) { ereport(LOG, (errcode_for_file_access(), - errmsg("could not close temporary statistics file \"%s\": %m", - tmpfile))); + errmsg("could not close temporary statistics file \"%s\": %m", + tmpfile))); unlink(tmpfile); } else if (rename(tmpfile, statfile) < 0) @@ -5023,16 +5023,28 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep) { ereport(pgStatRunningInCollector ? LOG : WARNING, (errmsg("corrupted statistics file \"%s\"", statfile))); + memset(&globalStats, 0, sizeof(globalStats)); goto done; } /* + * In the collector, disregard the timestamp we read from the permanent + * stats file; we should be willing to write a temp stats file immediately + * upon the first request from any backend. This only matters if the old + * file's timestamp is less than PGSTAT_STAT_INTERVAL ago, but that's not + * an unusual scenario. + */ + if (pgStatRunningInCollector) + globalStats.stats_timestamp = 0; + + /* * Read archiver stats struct */ if (fread(&archiverStats, 1, sizeof(archiverStats), fpin) != sizeof(archiverStats)) { ereport(pgStatRunningInCollector ? LOG : WARNING, (errmsg("corrupted statistics file \"%s\"", statfile))); + memset(&archiverStats, 0, sizeof(archiverStats)); goto done; } @@ -5062,7 +5074,7 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep) * Add to the DB hash */ dbentry = (PgStat_StatDBEntry *) hash_search(dbhash, - (void *) &dbbuf.databaseid, + (void *) &dbbuf.databaseid, HASH_ENTER, &found); if (found) @@ -5078,6 +5090,15 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep) dbentry->functions = NULL; /* + * In the collector, disregard the timestamp we read from the + * permanent stats file; we should be willing to write a temp + * stats file immediately upon the first request from any + * backend. + */ + if (pgStatRunningInCollector) + dbentry->stats_timestamp = 0; + + /* * Don't create tables/functions hashtables for uninteresting * databases. */ @@ -5095,7 +5116,7 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep) dbentry->tables = hash_create("Per-database table", PGSTAT_TAB_HASH_SIZE, &hash_ctl, - HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); + HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); hash_ctl.keysize = sizeof(Oid); hash_ctl.entrysize = sizeof(PgStat_StatFuncEntry); @@ -5103,7 +5124,7 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep) dbentry->functions = hash_create("Per-database function", PGSTAT_FUNCTION_HASH_SIZE, &hash_ctl, - HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); + HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); /* * If requested, read the data from the database-specific @@ -5229,8 +5250,8 @@ pgstat_read_db_statsfile(Oid databaseid, HTAB *tabhash, HTAB *funchash, break; tabentry = (PgStat_StatTabEntry *) hash_search(tabhash, - (void *) &tabbuf.tableid, - HASH_ENTER, &found); + (void *) &tabbuf.tableid, + HASH_ENTER, &found); if (found) { @@ -5263,8 +5284,8 @@ pgstat_read_db_statsfile(Oid databaseid, HTAB *tabhash, HTAB *funchash, break; funcentry = (PgStat_StatFuncEntry *) hash_search(funchash, - (void *) &funcbuf.functionid, - HASH_ENTER, &found); + (void *) &funcbuf.functionid, + HASH_ENTER, &found); if (found) { @@ -5731,7 +5752,7 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len) PgStat_TableEntry *tabmsg = &(msg->m_entry[i]); tabentry = (PgStat_StatTabEntry *) hash_search(dbentry->tables, - (void *) &(tabmsg->t_id), + (void *) &(tabmsg->t_id), HASH_ENTER, &found); if (!found) @@ -6216,7 +6237,7 @@ pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len) for (i = 0; i < msg->m_nentries; i++, funcmsg++) { funcentry = (PgStat_StatFuncEntry *) hash_search(dbentry->functions, - (void *) &(funcmsg->f_id), + (void *) &(funcmsg->f_id), HASH_ENTER, &found); if (!found) diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 1e511f4c1e..d25ea8826a 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -360,13 +360,14 @@ static PMState pmState = PM_INIT; /* Start time of SIGKILL timeout during immediate shutdown or child crash */ /* Zero means timeout is not running */ static time_t AbortStartTime = 0; + /* Length of said timeout */ #define SIGKILL_CHILDREN_AFTER_SECS 5 -static bool ReachedNormalRunning = false; /* T if we've reached PM_RUN */ +static bool ReachedNormalRunning = false; /* T if we've reached PM_RUN */ -bool ClientAuthInProgress = false; /* T during new-client - * authentication */ +bool ClientAuthInProgress = false; /* T during new-client + * authentication */ bool redirection_done = false; /* stderr redirected for syslogger? */ @@ -376,6 +377,9 @@ static volatile sig_atomic_t start_autovac_launcher = false; /* the launcher needs to be signalled to communicate some condition */ static volatile bool avlauncher_needs_signal = false; +/* received START_WALRECEIVER signal */ +static volatile sig_atomic_t WalReceiverRequested = false; + /* set when there's a worker that needs to be started up */ static volatile bool StartWorkerNeeded = true; static volatile bool HaveCrashedWorker = false; @@ -456,6 +460,7 @@ static void maybe_start_bgworkers(void); static bool CreateOptsFile(int argc, char *argv[], char *fullprogname); static pid_t StartChildProcess(AuxProcType type); static void StartAutovacuumWorker(void); +static void MaybeStartWalReceiver(void); static void InitPostmasterDeathWatchHandle(void); /* @@ -485,7 +490,7 @@ typedef struct HANDLE procHandle; DWORD procId; } win32_deadchild_waitinfo; -#endif /* WIN32 */ +#endif /* WIN32 */ static pid_t backend_forkexec(Port *port); static pid_t internal_forkexec(int argc, char *argv[], Port *port); @@ -567,7 +572,7 @@ static bool save_backend_variables(BackendParameters *param, Port *port, static void ShmemBackendArrayAdd(Backend *bn); static void ShmemBackendArrayRemove(Backend *bn); -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ #ifdef XCP char *parentPGXCNode = NULL; @@ -700,20 +705,18 @@ PostmasterMain(int argc, char *argv[]) pqinitmask(); PG_SETMASK(&BlockSig); - pqsignal_no_restart(SIGHUP, SIGHUP_handler); /* reread config file - * and have children do - * same */ + pqsignal_no_restart(SIGHUP, SIGHUP_handler); /* reread config file and + * have children do same */ pqsignal_no_restart(SIGINT, pmdie); /* send SIGTERM and shut down */ - pqsignal_no_restart(SIGQUIT, pmdie); /* send SIGQUIT and die */ - pqsignal_no_restart(SIGTERM, pmdie); /* wait for children and shut - * down */ + pqsignal_no_restart(SIGQUIT, pmdie); /* send SIGQUIT and die */ + pqsignal_no_restart(SIGTERM, pmdie); /* wait for children and shut down */ pqsignal(SIGALRM, SIG_IGN); /* ignored */ pqsignal(SIGPIPE, SIG_IGN); /* ignored */ - pqsignal_no_restart(SIGUSR1, sigusr1_handler); /* message from child - * process */ - pqsignal_no_restart(SIGUSR2, dummy_handler); /* unused, reserve for - * children */ - pqsignal_no_restart(SIGCHLD, reaper); /* handle child termination */ + pqsignal_no_restart(SIGUSR1, sigusr1_handler); /* message from child + * process */ + pqsignal_no_restart(SIGUSR2, dummy_handler); /* unused, reserve for + * children */ + pqsignal_no_restart(SIGCHLD, reaper); /* handle child termination */ pqsignal(SIGTTIN, SIG_IGN); /* ignored */ pqsignal(SIGTTOU, SIG_IGN); /* ignored */ /* ignore SIGXFSZ, so that ulimit violations work like disk full */ @@ -1021,15 +1024,15 @@ PostmasterMain(int argc, char *argv[]) char **p; ereport(DEBUG3, - (errmsg_internal("%s: PostmasterMain: initial environment dump:", - progname))); + (errmsg_internal("%s: PostmasterMain: initial environment dump:", + progname))); ereport(DEBUG3, - (errmsg_internal("-----------------------------------------"))); + (errmsg_internal("-----------------------------------------"))); for (p = environ; *p; ++p) ereport(DEBUG3, (errmsg_internal("\t%s", *p))); ereport(DEBUG3, - (errmsg_internal("-----------------------------------------"))); + (errmsg_internal("-----------------------------------------"))); } /* @@ -1283,7 +1286,7 @@ PostmasterMain(int argc, char *argv[]) win32ChildQueue = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1); if (win32ChildQueue == NULL) ereport(FATAL, - (errmsg("could not create I/O completion port for child queue"))); + (errmsg("could not create I/O completion port for child queue"))); #endif /* @@ -1374,8 +1377,8 @@ PostmasterMain(int argc, char *argv[]) if (!(Log_destination & LOG_DESTINATION_STDERR)) ereport(LOG, (errmsg("ending log output to stderr"), - errhint("Future log output will go to log destination \"%s\".", - Log_destination_string))); + errhint("Future log output will go to log destination \"%s\".", + Log_destination_string))); whereToSendOutput = DestNone; @@ -1427,7 +1430,7 @@ PostmasterMain(int argc, char *argv[]) ereport(FATAL, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("postmaster became multithreaded during startup"), - errhint("Set the LC_ALL environment variable to a valid locale."))); + errhint("Set the LC_ALL environment variable to a valid locale."))); #endif /* @@ -1593,8 +1596,8 @@ checkDataDir(void) else ereport(FATAL, (errcode_for_file_access(), - errmsg("could not read permissions of directory \"%s\": %m", - DataDir))); + errmsg("could not read permissions of directory \"%s\": %m", + DataDir))); } /* eventual chdir would fail anyway, but let's test ... */ @@ -1671,7 +1674,7 @@ checkDataDir(void) * cases are as shown in the code. */ static void -DetermineSleepTime(struct timeval * timeout) +DetermineSleepTime(struct timeval *timeout) { TimestampTz next_wakeup = 0; @@ -1733,7 +1736,7 @@ DetermineSleepTime(struct timeval * timeout) } this_wakeup = TimestampTzPlusMilliseconds(rw->rw_crashed_at, - 1000L * rw->rw_worker.bgw_restart_time); + 1000L * rw->rw_worker.bgw_restart_time); if (next_wakeup == 0 || this_wakeup < next_wakeup) next_wakeup = this_wakeup; } @@ -1936,6 +1939,10 @@ ServerLoop(void) kill(AutoVacPID, SIGUSR2); } + /* If we need to start a WAL receiver, try to do that now */ + if (WalReceiverRequested) + MaybeStartWalReceiver(); + /* Get other worker processes running, if needed */ if (StartWorkerNeeded || HaveCrashedWorker) maybe_start_bgworkers(); @@ -2232,9 +2239,9 @@ retry1: else if (!parse_bool(valptr, &am_walsender)) ereport(FATAL, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid value for parameter \"%s\": \"%s\"", - "replication", - valptr), + errmsg("invalid value for parameter \"%s\": \"%s\"", + "replication", + valptr), errhint("Valid values are: \"false\", 0, \"true\", 1, \"database\"."))); } else @@ -2283,7 +2290,7 @@ retry1: if (port->user_name == NULL || port->user_name[0] == '\0') ereport(FATAL, (errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION), - errmsg("no PostgreSQL user name specified in startup packet"))); + errmsg("no PostgreSQL user name specified in startup packet"))); /* The database defaults to the user name. */ if (port->database_name == NULL || port->database_name[0] == '\0') @@ -2744,7 +2751,7 @@ pmdie(SIGNAL_ARGS) /* autovac workers are told to shut down immediately */ /* and bgworkers too; does this need tweaking? */ SignalSomeChildren(SIGTERM, - BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_BGWORKER); + BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_BGWORKER); /* and the autovac launcher too */ if (AutoVacPID != 0) signal_child(AutoVacPID, SIGTERM); @@ -2837,7 +2844,7 @@ pmdie(SIGNAL_ARGS) (errmsg("aborting any active transactions"))); /* shut down all backends and workers */ SignalSomeChildren(SIGTERM, - BACKEND_TYPE_NORMAL | BACKEND_TYPE_AUTOVAC | + BACKEND_TYPE_NORMAL | BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_BGWORKER); /* and the autovac launcher too */ if (AutoVacPID != 0) @@ -2955,7 +2962,7 @@ reaper(SIGNAL_ARGS) LogChildExit(LOG, _("startup process"), pid, exitstatus); ereport(LOG, - (errmsg("aborting startup due to startup process failure"))); + (errmsg("aborting startup due to startup process failure"))); ExitPostmaster(1); } @@ -3025,7 +3032,7 @@ reaper(SIGNAL_ARGS) /* at this point we are really open for business */ ereport(LOG, - (errmsg("database system is ready to accept connections"))); + (errmsg("database system is ready to accept connections"))); #ifdef USE_SYSTEMD sd_notify(0, "READY=1"); @@ -3121,7 +3128,8 @@ reaper(SIGNAL_ARGS) /* * Was it the wal receiver? If exit status is zero (normal) or one * (FATAL exit), we assume everything is all right just like normal - * backends. + * backends. (If we need a new wal receiver, we'll start one at the + * next iteration of the postmaster's main loop.) */ if (pid == WalReceiverPID) { @@ -3334,7 +3342,7 @@ CleanupBackgroundWorker(int pid, rw->rw_backend = NULL; rw->rw_pid = 0; rw->rw_child_slot = 0; - ReportBackgroundWorkerExit(&iter); /* report child death */ + ReportBackgroundWorkerExit(&iter); /* report child death */ LogChildExit(EXIT_STATUS_0(exitstatus) ? DEBUG1 : LOG, namebuf, pid, exitstatus); @@ -3732,7 +3740,7 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus) if (!EXIT_STATUS_0(exitstatus)) activity = pgstat_get_crashed_backend_activity(pid, activity_buffer, - sizeof(activity_buffer)); + sizeof(activity_buffer)); if (WIFEXITED(exitstatus)) ereport(lev, @@ -3755,16 +3763,16 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus) errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."), activity ? errdetail("Failed process was running: %s", activity) : 0)); #elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST - ereport(lev, - - /*------ - translator: %s is a noun phrase describing a child process, such as - "server process" */ - (errmsg("%s (PID %d) was terminated by signal %d: %s", - procname, pid, WTERMSIG(exitstatus), - WTERMSIG(exitstatus) < NSIG ? - sys_siglist[WTERMSIG(exitstatus)] : "(unknown)"), - activity ? errdetail("Failed process was running: %s", activity) : 0)); + ereport(lev, + + /*------ + translator: %s is a noun phrase describing a child process, such as + "server process" */ + (errmsg("%s (PID %d) was terminated by signal %d: %s", + procname, pid, WTERMSIG(exitstatus), + WTERMSIG(exitstatus) < NSIG ? + sys_siglist[WTERMSIG(exitstatus)] : "(unknown)"), + activity ? errdetail("Failed process was running: %s", activity) : 0)); #else ereport(lev, @@ -4236,7 +4244,7 @@ BackendStartup(Port *port) /* And run the backend */ BackendRun(port); } -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ if (pid < 0) { @@ -4263,7 +4271,7 @@ BackendStartup(Port *port) * of backends. */ bn->pid = pid; - bn->bkend_type = BACKEND_TYPE_NORMAL; /* Can change later to WALSND */ + bn->bkend_type = BACKEND_TYPE_NORMAL; /* Can change later to WALSND */ dlist_push_head(&BackendList, &bn->elem); #ifdef EXEC_BACKEND @@ -4353,7 +4361,7 @@ BackendInitialize(Port *port) * Must do this now because authentication uses libpq to send messages. */ pq_init(); /* initialize libpq to talk to client */ - whereToSendOutput = DestRemote; /* now safe to ereport to client */ + whereToSendOutput = DestRemote; /* now safe to ereport to client */ /* * We arrange for a simple exit(1) if we receive SIGTERM or SIGQUIT or @@ -4383,7 +4391,7 @@ BackendInitialize(Port *port) if ((ret = pg_getnameinfo_all(&port->raddr.addr, port->raddr.salen, remote_host, sizeof(remote_host), remote_port, sizeof(remote_port), - (log_hostname ? 0 : NI_NUMERICHOST) | NI_NUMERICSERV)) != 0) + (log_hostname ? 0 : NI_NUMERICHOST) | NI_NUMERICSERV)) != 0) ereport(WARNING, (errmsg_internal("pg_getnameinfo_all() failed: %s", gai_strerror(ret)))); @@ -4890,7 +4898,7 @@ internal_forkexec(int argc, char *argv[], Port *port) pgwin32_deadchild_callback, childinfo, INFINITE, - WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD)) + WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD)) ereport(FATAL, (errmsg_internal("could not register process for wait: error code %lu", GetLastError()))); @@ -4901,7 +4909,7 @@ internal_forkexec(int argc, char *argv[], Port *port) return pi.dwProcessId; } -#endif /* WIN32 */ +#endif /* WIN32 */ /* @@ -5075,7 +5083,7 @@ SubPostmasterMain(int argc, char *argv[]) /* Attach process to shared data structures */ CreateSharedMemoryAndSemaphores(false, 0); - AuxiliaryProcessMain(argc - 2, argv + 2); /* does not return */ + AuxiliaryProcessMain(argc - 2, argv + 2); /* does not return */ } if (strcmp(argv[1], "--forkavlauncher") == 0) { @@ -5088,7 +5096,7 @@ SubPostmasterMain(int argc, char *argv[]) /* Attach process to shared data structures */ CreateSharedMemoryAndSemaphores(false, 0); - AutoVacLauncherMain(argc - 2, argv + 2); /* does not return */ + AutoVacLauncherMain(argc - 2, argv + 2); /* does not return */ } if (strcmp(argv[1], "--forkavworker") == 0) { @@ -5129,24 +5137,24 @@ SubPostmasterMain(int argc, char *argv[]) { /* Do not want to attach to shared memory */ - PgArchiverMain(argc, argv); /* does not return */ + PgArchiverMain(argc, argv); /* does not return */ } if (strcmp(argv[1], "--forkcol") == 0) { /* Do not want to attach to shared memory */ - PgstatCollectorMain(argc, argv); /* does not return */ + PgstatCollectorMain(argc, argv); /* does not return */ } if (strcmp(argv[1], "--forklog") == 0) { /* Do not want to attach to shared memory */ - SysLoggerMain(argc, argv); /* does not return */ + SysLoggerMain(argc, argv); /* does not return */ } abort(); /* shouldn't get here */ } -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ /* @@ -5169,7 +5177,7 @@ ExitPostmaster(int status) ereport(LOG, (errcode(ERRCODE_INTERNAL_ERROR), errmsg_internal("postmaster became multithreaded"), - errdetail("Please report this to <[email protected]>."))); + errdetail("Please report this to <[email protected]>."))); #endif /* should cleanup shared memory and kill all backends */ @@ -5248,7 +5256,7 @@ sigusr1_handler(SIGNAL_ARGS) PgStatPID = pgstat_start(); ereport(LOG, - (errmsg("database system is ready to accept read only connections"))); + (errmsg("database system is ready to accept read only connections"))); #ifdef USE_SYSTEMD sd_notify(0, "READY=1"); @@ -5301,14 +5309,12 @@ sigusr1_handler(SIGNAL_ARGS) StartAutovacuumWorker(); } - if (CheckPostmasterSignal(PMSIGNAL_START_WALRECEIVER) && - WalReceiverPID == 0 && - (pmState == PM_STARTUP || pmState == PM_RECOVERY || - pmState == PM_HOT_STANDBY || pmState == PM_WAIT_READONLY) && - Shutdown == NoShutdown) + if (CheckPostmasterSignal(PMSIGNAL_START_WALRECEIVER)) { /* Startup Process wants us to start the walreceiver process. */ - WalReceiverPID = StartWalReceiver(); + /* Start immediately if possible, else remember request for later. */ + WalReceiverRequested = true; + MaybeStartWalReceiver(); } if (CheckPostmasterSignal(PMSIGNAL_ADVANCE_STATE_MACHINE) && @@ -5505,7 +5511,7 @@ StartChildProcess(AuxProcType type) AuxiliaryProcessMain(ac, av); ExitPostmaster(0); } -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ if (pid < 0) { @@ -5531,7 +5537,7 @@ StartChildProcess(AuxProcType type) break; case BgWriterProcess: ereport(LOG, - (errmsg("could not fork background writer process: %m"))); + (errmsg("could not fork background writer process: %m"))); break; case CheckpointerProcess: ereport(LOG, @@ -5655,6 +5661,24 @@ StartAutovacuumWorker(void) } /* + * MaybeStartWalReceiver + * Start the WAL receiver process, if not running and our state allows. + */ +static void +MaybeStartWalReceiver(void) +{ + if (WalReceiverPID == 0 && + (pmState == PM_STARTUP || pmState == PM_RECOVERY || + pmState == PM_HOT_STANDBY || pmState == PM_WAIT_READONLY) && + Shutdown == NoShutdown) + { + WalReceiverPID = StartWalReceiver(); + WalReceiverRequested = false; + } +} + + +/* * Create the opts file */ static bool @@ -6041,7 +6065,7 @@ maybe_start_bgworkers(void) now = GetCurrentTimestamp(); if (!TimestampDifferenceExceeds(rw->rw_crashed_at, now, - rw->rw_worker.bgw_restart_time * 1000)) + rw->rw_worker.bgw_restart_time * 1000)) { /* Set flag to remember that we have workers to start later */ HaveCrashedWorker = true; @@ -6471,7 +6495,7 @@ ShmemBackendArrayRemove(Backend *bn) /* Mark the slot as empty */ ShmemBackendArray[i].pid = 0; } -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ #ifdef WIN32 @@ -6547,7 +6571,7 @@ pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired) /* Queue SIGCHLD signal */ pg_queue_signal(SIGCHLD); } -#endif /* WIN32 */ +#endif /* WIN32 */ /* * Initialize one and only handle for monitoring postmaster death. @@ -6598,5 +6622,5 @@ InitPostmasterDeathWatchHandle(void) ereport(FATAL, (errmsg_internal("could not duplicate postmaster handle: error code %lu", GetLastError()))); -#endif /* WIN32 */ +#endif /* WIN32 */ } diff --git a/src/backend/postmaster/startup.c b/src/backend/postmaster/startup.c index b623252475..4693a1bb86 100644 --- a/src/backend/postmaster/startup.c +++ b/src/backend/postmaster/startup.c @@ -183,7 +183,7 @@ StartupProcessMain(void) */ pqsignal(SIGHUP, StartupProcSigHupHandler); /* reload config file */ pqsignal(SIGINT, SIG_IGN); /* ignore query cancel */ - pqsignal(SIGTERM, StartupProcShutdownHandler); /* request shutdown */ + pqsignal(SIGTERM, StartupProcShutdownHandler); /* request shutdown */ pqsignal(SIGQUIT, startupproc_quickdie); /* hard crash time */ InitializeTimeouts(); /* establishes SIGALRM handler */ pqsignal(SIGPIPE, SIG_IGN); diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c index 9f5ca5cac0..3255b42c7d 100644 --- a/src/backend/postmaster/syslogger.c +++ b/src/backend/postmaster/syslogger.c @@ -169,7 +169,7 @@ SysLoggerMain(int argc, char *argv[]) #ifdef EXEC_BACKEND syslogger_parseArgs(argc, argv); -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ am_syslogger = true; @@ -268,7 +268,7 @@ SysLoggerMain(int argc, char *argv[]) threadHandle = (HANDLE) _beginthreadex(NULL, 0, pipeThread, NULL, 0, NULL); if (threadHandle == 0) elog(FATAL, "could not create syslogger data transfer thread: %m"); -#endif /* WIN32 */ +#endif /* WIN32 */ /* * Remember active logfile's name. We recompute this from the reference @@ -490,7 +490,7 @@ SysLoggerMain(int argc, char *argv[]) WAIT_EVENT_SYSLOGGER_MAIN); EnterCriticalSection(&sysloggerSection); -#endif /* WIN32 */ +#endif /* WIN32 */ if (pipe_eof_seen) { @@ -630,8 +630,8 @@ SysLogger_Start(void) */ ereport(LOG, (errmsg("redirecting log output to logging collector process"), - errhint("Future log output will appear in directory \"%s\".", - Log_directory))); + errhint("Future log output will appear in directory \"%s\".", + Log_directory))); #ifndef WIN32 fflush(stdout); @@ -716,7 +716,7 @@ syslogger_forkexec(void) (long) _get_osfhandle(_fileno(syslogFile))); else strcpy(filenobuf, "0"); -#endif /* WIN32 */ +#endif /* WIN32 */ av[ac++] = filenobuf; av[ac] = NULL; @@ -756,9 +756,9 @@ syslogger_parseArgs(int argc, char *argv[]) setvbuf(syslogFile, NULL, PG_IOLBF, 0); } } -#endif /* WIN32 */ +#endif /* WIN32 */ } -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ /* -------------------------------- @@ -797,7 +797,7 @@ process_pipe_input(char *logbuffer, int *bytes_in_logbuffer) int dest = LOG_DESTINATION_STDERR; /* While we have enough for a header, process data... */ - while (count >= (int) (offsetof(PipeProtoHeader, data) +1)) + while (count >= (int) (offsetof(PipeProtoHeader, data) + 1)) { PipeProtoHeader p; int chunklen; @@ -1084,7 +1084,7 @@ pipeThread(void *arg) _endthread(); return 0; } -#endif /* WIN32 */ +#endif /* WIN32 */ /* * Open the csv log file - we do this opportunistically, because @@ -1103,7 +1103,7 @@ open_csvlogfile(void) csvlogFile = logfile_open(filename, "a", false); - if (last_csv_file_name != NULL) /* probably shouldn't happen */ + if (last_csv_file_name != NULL) /* probably shouldn't happen */ pfree(last_csv_file_name); last_csv_file_name = filename; diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c index a575d8f953..7b89e02428 100644 --- a/src/backend/postmaster/walwriter.c +++ b/src/backend/postmaster/walwriter.c @@ -109,8 +109,8 @@ WalWriterMain(void) * reasonable to treat like SIGTERM. */ pqsignal(SIGHUP, WalSigHupHandler); /* set flag to read config file */ - pqsignal(SIGINT, WalShutdownHandler); /* request shutdown */ - pqsignal(SIGTERM, WalShutdownHandler); /* request shutdown */ + pqsignal(SIGINT, WalShutdownHandler); /* request shutdown */ + pqsignal(SIGTERM, WalShutdownHandler); /* request shutdown */ pqsignal(SIGQUIT, wal_quickdie); /* hard crash time */ pqsignal(SIGALRM, SIG_IGN); pqsignal(SIGPIPE, SIG_IGN); @@ -286,7 +286,7 @@ WalWriterMain(void) * sleep time so as to reduce the server's idle power consumption. */ if (left_till_hibernate > 0) - cur_timeout = WalWriterDelay; /* in ms */ + cur_timeout = WalWriterDelay; /* in ms */ else cur_timeout = WalWriterDelay * HIBERNATE_FACTOR; diff --git a/src/backend/regex/regc_color.c b/src/backend/regex/regc_color.c index 4b72894ad3..f5a4151757 100644 --- a/src/backend/regex/regc_color.c +++ b/src/backend/regex/regc_color.c @@ -46,8 +46,8 @@ * initcm - set up new colormap */ static void -initcm(struct vars * v, - struct colormap * cm) +initcm(struct vars *v, + struct colormap *cm) { struct colordesc *cd; @@ -100,7 +100,7 @@ initcm(struct vars * v, * freecm - free dynamically-allocated things in a colormap */ static void -freecm(struct colormap * cm) +freecm(struct colormap *cm) { cm->magic = 0; if (cm->cd != cm->cdspace) @@ -117,7 +117,7 @@ freecm(struct colormap * cm) * pg_reg_getcolor - slow case of GETCOLOR() */ color -pg_reg_getcolor(struct colormap * cm, chr c) +pg_reg_getcolor(struct colormap *cm, chr c) { int rownum, colnum, @@ -145,7 +145,7 @@ pg_reg_getcolor(struct colormap * cm, chr c) low = middle + 1; else { - rownum = cmr->rownum; /* found a match */ + rownum = cmr->rownum; /* found a match */ break; } } @@ -169,7 +169,7 @@ pg_reg_getcolor(struct colormap * cm, chr c) * maxcolor - report largest color number in use */ static color -maxcolor(struct colormap * cm) +maxcolor(struct colormap *cm) { if (CISERR()) return COLORLESS; @@ -182,7 +182,7 @@ maxcolor(struct colormap * cm) * Beware: may relocate the colordescs. */ static color /* COLORLESS for error */ -newcolor(struct colormap * cm) +newcolor(struct colormap *cm) { struct colordesc *cd; size_t n; @@ -254,7 +254,7 @@ newcolor(struct colormap * cm) * freecolor - free a color (must have no arcs or subcolor) */ static void -freecolor(struct colormap * cm, +freecolor(struct colormap *cm, color co) { struct colordesc *cd = &cm->cd[co]; @@ -309,7 +309,7 @@ freecolor(struct colormap * cm, * pseudocolor - allocate a false color, to be managed by other means */ static color -pseudocolor(struct colormap * cm) +pseudocolor(struct colormap *cm) { color co; struct colordesc *cd; @@ -333,7 +333,7 @@ pseudocolor(struct colormap * cm) * This works only for chrs that map into the low color map. */ static color -subcolor(struct colormap * cm, chr c) +subcolor(struct colormap *cm, chr c) { color co; /* current color of c */ color sco; /* new subcolor */ @@ -363,7 +363,7 @@ subcolor(struct colormap * cm, chr c) * colormap, which do not necessarily correspond to exactly one chr code. */ static color -subcolorhi(struct colormap * cm, color *pco) +subcolorhi(struct colormap *cm, color *pco) { color co; /* current color of entry */ color sco; /* new subcolor */ @@ -386,7 +386,7 @@ subcolorhi(struct colormap * cm, color *pco) * newsub - allocate a new subcolor (if necessary) for a color */ static color -newsub(struct colormap * cm, +newsub(struct colormap *cm, color co) { color sco; /* new subcolor */ @@ -417,7 +417,7 @@ newsub(struct colormap * cm, * Returns array index of new row. Note the array might move. */ static int -newhicolorrow(struct colormap * cm, +newhicolorrow(struct colormap *cm, int oldrow) { int newrow = cm->hiarrayrows; @@ -466,7 +466,7 @@ newhicolorrow(struct colormap * cm, * Essentially, extends the 2-D array to the right with a copy of itself. */ static void -newhicolorcols(struct colormap * cm) +newhicolorcols(struct colormap *cm) { color *newarray; int r, @@ -519,10 +519,10 @@ newhicolorcols(struct colormap * cm) * mechanized with the "lastsubcolor" state variable. */ static void -subcolorcvec(struct vars * v, - struct cvec * cv, - struct state * lp, - struct state * rp) +subcolorcvec(struct vars *v, + struct cvec *cv, + struct state *lp, + struct state *rp) { struct colormap *cm = v->cm; color lastsubcolor = COLORLESS; @@ -621,10 +621,10 @@ subcolorcvec(struct vars * v, * to be able to handle both low and high chr codes. */ static void -subcoloronechr(struct vars * v, +subcoloronechr(struct vars *v, chr ch, - struct state * lp, - struct state * rp, + struct state *lp, + struct state *rp, color *lastsubcolor) { struct colormap *cm = v->cm; @@ -744,11 +744,11 @@ subcoloronechr(struct vars * v, * subcoloronerange - do subcolorcvec's work for a high range */ static void -subcoloronerange(struct vars * v, +subcoloronerange(struct vars *v, chr from, chr to, - struct state * lp, - struct state * rp, + struct state *lp, + struct state *rp, color *lastsubcolor) { struct colormap *cm = v->cm; @@ -882,10 +882,10 @@ subcoloronerange(struct vars * v, * subcoloronerow - do subcolorcvec's work for one new row in the high colormap */ static void -subcoloronerow(struct vars * v, +subcoloronerow(struct vars *v, int rownum, - struct state * lp, - struct state * rp, + struct state *lp, + struct state *rp, color *lastsubcolor) { struct colormap *cm = v->cm; @@ -913,8 +913,8 @@ subcoloronerow(struct vars * v, * okcolors - promote subcolors to full colors */ static void -okcolors(struct nfa * nfa, - struct colormap * cm) +okcolors(struct nfa *nfa, + struct colormap *cm) { struct colordesc *cd; struct colordesc *end = CDEND(cm); @@ -972,8 +972,8 @@ okcolors(struct nfa * nfa, * colorchain - add this arc to the color chain of its color */ static void -colorchain(struct colormap * cm, - struct arc * a) +colorchain(struct colormap *cm, + struct arc *a) { struct colordesc *cd = &cm->cd[a->co]; @@ -988,8 +988,8 @@ colorchain(struct colormap * cm, * uncolorchain - delete this arc from the color chain of its color */ static void -uncolorchain(struct colormap * cm, - struct arc * a) +uncolorchain(struct colormap *cm, + struct arc *a) { struct colordesc *cd = &cm->cd[a->co]; struct arc *aa = a->colorchainRev; @@ -1014,12 +1014,12 @@ uncolorchain(struct colormap * cm, * rainbow - add arcs of all full colors (but one) between specified states */ static void -rainbow(struct nfa * nfa, - struct colormap * cm, +rainbow(struct nfa *nfa, + struct colormap *cm, int type, color but, /* COLORLESS if no exceptions */ - struct state * from, - struct state * to) + struct state *from, + struct state *to) { struct colordesc *cd; struct colordesc *end = CDEND(cm); @@ -1037,13 +1037,12 @@ rainbow(struct nfa * nfa, * The calling sequence ought to be reconciled with cloneouts(). */ static void -colorcomplement(struct nfa * nfa, - struct colormap * cm, +colorcomplement(struct nfa *nfa, + struct colormap *cm, int type, - struct state * of, /* complements of this guy's PLAIN - * outarcs */ - struct state * from, - struct state * to) + struct state *of, /* complements of this guy's PLAIN outarcs */ + struct state *from, + struct state *to) { struct colordesc *cd; struct colordesc *end = CDEND(cm); @@ -1063,7 +1062,7 @@ colorcomplement(struct nfa * nfa, * dumpcolors - debugging output */ static void -dumpcolors(struct colormap * cm, +dumpcolors(struct colormap *cm, FILE *f) { struct colordesc *cd; @@ -1138,4 +1137,4 @@ dumpchr(chr c, fprintf(f, "\\u%04lx", (long) c); } -#endif /* REG_DEBUG */ +#endif /* REG_DEBUG */ diff --git a/src/backend/regex/regc_cvec.c b/src/backend/regex/regc_cvec.c index 50b7a4574b..1030621559 100644 --- a/src/backend/regex/regc_cvec.c +++ b/src/backend/regex/regc_cvec.c @@ -63,7 +63,7 @@ newcvec(int nchrs, /* to hold this many chrs... */ * Returns pointer as convenience. */ static struct cvec * -clearcvec(struct cvec * cv) +clearcvec(struct cvec *cv) { assert(cv != NULL); cv->nchrs = 0; @@ -76,7 +76,7 @@ clearcvec(struct cvec * cv) * addchr - add a chr to a cvec */ static void -addchr(struct cvec * cv, /* character vector */ +addchr(struct cvec *cv, /* character vector */ chr c) /* character to add */ { assert(cv->nchrs < cv->chrspace); @@ -87,7 +87,7 @@ addchr(struct cvec * cv, /* character vector */ * addrange - add a range to a cvec */ static void -addrange(struct cvec * cv, /* character vector */ +addrange(struct cvec *cv, /* character vector */ chr from, /* first character of range */ chr to) /* last character of range */ { @@ -109,7 +109,7 @@ addrange(struct cvec * cv, /* character vector */ * so transientness is a convenient behavior. */ static struct cvec * -getcvec(struct vars * v, /* context */ +getcvec(struct vars *v, /* context */ int nchrs, /* to hold this many chrs... */ int nranges) /* ... and this many ranges */ { @@ -132,7 +132,7 @@ getcvec(struct vars * v, /* context */ * freecvec - free a cvec */ static void -freecvec(struct cvec * cv) +freecvec(struct cvec *cv) { FREE(cv); } diff --git a/src/backend/regex/regc_lex.c b/src/backend/regex/regc_lex.c index cd34c8ae41..2c6551ca74 100644 --- a/src/backend/regex/regc_lex.c +++ b/src/backend/regex/regc_lex.c @@ -67,7 +67,7 @@ * lexstart - set up lexical stuff, scan leading options */ static void -lexstart(struct vars * v) +lexstart(struct vars *v) { prefixes(v); /* may turn on new type bits etc. */ NOERR(); @@ -96,7 +96,7 @@ lexstart(struct vars * v) * prefixes - implement various special prefixes */ static void -prefixes(struct vars * v) +prefixes(struct vars *v) { /* literal string doesn't get any of this stuff */ if (v->cflags & REG_QUOTE) @@ -200,7 +200,7 @@ prefixes(struct vars * v) * implicit assumptions about what sorts of strings can be subroutines. */ static void -lexnest(struct vars * v, +lexnest(struct vars *v, const chr *beginp, /* start of interpolation */ const chr *endp) /* one past end of interpolation */ { @@ -265,7 +265,7 @@ static const chr brbackw[] = { /* \w within brackets */ * Possibly ought to inquire whether there is a "word" character class. */ static void -lexword(struct vars * v) +lexword(struct vars *v) { lexnest(v, backw, ENDOF(backw)); } @@ -274,7 +274,7 @@ lexword(struct vars * v) * next - get next token */ static int /* 1 normal, 0 failure */ -next(struct vars * v) +next(struct vars *v) { chr c; @@ -384,7 +384,7 @@ next(struct vars * v) else FAILW(REG_BADBR); break; - case CHR('\\'): /* BRE bound ends with \} */ + case CHR('\\'): /* BRE bound ends with \} */ if (INCON(L_BBND) && NEXT1('}')) { v->now++; @@ -476,7 +476,7 @@ next(struct vars * v) NOTE(REG_ULOCALE); RET(CCLASS); break; - default: /* oops */ + default: /* oops */ v->now--; RETV(PLAIN, c); break; @@ -586,10 +586,10 @@ next(struct vars * v) FAILW(REG_BADRPT); switch (*v->now++) { - case CHR(':'): /* non-capturing paren */ + case CHR(':'): /* non-capturing paren */ RETV('(', 0); break; - case CHR('#'): /* comment */ + case CHR('#'): /* comment */ while (!ATEOS() && *v->now != CHR(')')) v->now++; if (!ATEOS()) @@ -597,11 +597,11 @@ next(struct vars * v) assert(v->nexttype == v->lasttype); return next(v); break; - case CHR('='): /* positive lookahead */ + case CHR('='): /* positive lookahead */ NOTE(REG_ULOOKAROUND); RETV(LACON, LATYPE_AHEAD_POS); break; - case CHR('!'): /* negative lookahead */ + case CHR('!'): /* negative lookahead */ NOTE(REG_ULOOKAROUND); RETV(LACON, LATYPE_AHEAD_NEG); break; @@ -610,11 +610,11 @@ next(struct vars * v) FAILW(REG_BADRPT); switch (*v->now++) { - case CHR('='): /* positive lookbehind */ + case CHR('='): /* positive lookbehind */ NOTE(REG_ULOOKAROUND); RETV(LACON, LATYPE_BEHIND_POS); break; - case CHR('!'): /* negative lookbehind */ + case CHR('!'): /* negative lookbehind */ NOTE(REG_ULOOKAROUND); RETV(LACON, LATYPE_BEHIND_NEG); break; @@ -671,7 +671,7 @@ next(struct vars * v) case CHR('$'): RET('$'); break; - case CHR('\\'): /* mostly punt backslashes to code below */ + case CHR('\\'): /* mostly punt backslashes to code below */ if (ATEOS()) FAILW(REG_EESCAPE); break; @@ -734,7 +734,7 @@ next(struct vars * v) * Note slightly nonstandard use of the CCLASS type code. */ static int /* not actually used, but convenient for RETV */ -lexescape(struct vars * v) +lexescape(struct vars *v) { chr c; static const chr alert[] = { @@ -836,7 +836,7 @@ lexescape(struct vars * v) break; case CHR('x'): NOTE(REG_UUNPORT); - c = lexdigits(v, 16, 1, 255); /* REs >255 long outside spec */ + c = lexdigits(v, 16, 1, 255); /* REs >255 long outside spec */ if (ISERR() || !CHR_IS_IN_RANGE(c)) FAILW(REG_EESCAPE); RETV(PLAIN, c); @@ -863,7 +863,7 @@ lexescape(struct vars * v) case CHR('9'): save = v->now; v->now--; /* put first digit back */ - c = lexdigits(v, 10, 1, 255); /* REs >255 long outside spec */ + c = lexdigits(v, 10, 1, 255); /* REs >255 long outside spec */ if (ISERR()) FAILW(REG_EESCAPE); /* ugly heuristic (first test is "exactly 1 digit?") */ @@ -904,7 +904,7 @@ lexescape(struct vars * v) * if maxlen is large enough to make that possible. */ static chr /* chr value; errors signalled via ERR */ -lexdigits(struct vars * v, +lexdigits(struct vars *v, int base, int minlen, int maxlen) @@ -985,7 +985,7 @@ lexdigits(struct vars * v, * context-dependency of some things. */ static int /* 1 normal, 0 failure */ -brenext(struct vars * v, +brenext(struct vars *v, chr c) { switch (c) @@ -1106,7 +1106,7 @@ brenext(struct vars * v, * skip - skip white space and comments in expanded form */ static void -skip(struct vars * v) +skip(struct vars *v) { const chr *start = v->now; @@ -1146,7 +1146,7 @@ newline(void) * use that it hardly matters. */ static chr -chrnamed(struct vars * v, +chrnamed(struct vars *v, const chr *startp, /* start of name */ const chr *endp, /* just past end of name */ chr lastresort) /* what to return if name lookup fails */ diff --git a/src/backend/regex/regc_locale.c b/src/backend/regex/regc_locale.c index 7cb3a40a0c..047abc3e1e 100644 --- a/src/backend/regex/regc_locale.c +++ b/src/backend/regex/regc_locale.c @@ -56,7 +56,7 @@ static const struct cname { const char *name; const char code; -} cnames[] = +} cnames[] = { { @@ -377,7 +377,7 @@ enum classes * element - map collating-element name to chr */ static chr -element(struct vars * v, /* context */ +element(struct vars *v, /* context */ const chr *startp, /* points to start of name */ const chr *endp) /* points just past end of name */ { @@ -413,7 +413,7 @@ element(struct vars * v, /* context */ * range - supply cvec for a range, including legality check */ static struct cvec * -range(struct vars * v, /* context */ +range(struct vars *v, /* context */ chr a, /* range start */ chr b, /* range end, might equal a */ int cases) /* case-independent? */ @@ -505,7 +505,7 @@ before(chr x, chr y) * Must include case counterparts on request. */ static struct cvec * -eclass(struct vars * v, /* context */ +eclass(struct vars *v, /* context */ chr c, /* Collating element representing the * equivalence class. */ int cases) /* all cases? */ @@ -545,14 +545,14 @@ eclass(struct vars * v, /* context */ * because callers are not supposed to explicitly free the result either way. */ static struct cvec * -cclass(struct vars * v, /* context */ +cclass(struct vars *v, /* context */ const chr *startp, /* where the name starts */ const chr *endp, /* just past the end of the name */ int cases) /* case-independent? */ { size_t len; struct cvec *cv = NULL; - const char *const * namePtr; + const char *const *namePtr; int i, index; @@ -669,7 +669,7 @@ cclass(struct vars * v, /* context */ * cclass_column_index - get appropriate high colormap column index for chr */ static int -cclass_column_index(struct colormap * cm, chr c) +cclass_column_index(struct colormap *cm, chr c) { int colnum = 0; @@ -713,7 +713,7 @@ cclass_column_index(struct colormap * cm, chr c) * messy cases are done via range(). */ static struct cvec * -allcases(struct vars * v, /* context */ +allcases(struct vars *v, /* context */ chr c) /* character to get case equivs of */ { struct cvec *cv; @@ -754,7 +754,7 @@ cmp(const chr *x, const chr *y, /* strings to compare */ * stop at embedded NULs! */ static int /* 0 for equal, nonzero for unequal */ -casecmp(const chr *x, const chr *y, /* strings to compare */ +casecmp(const chr *x, const chr *y, /* strings to compare */ size_t len) /* exact length of comparison */ { for (; len > 0; len--, x++, y++) diff --git a/src/backend/regex/regc_nfa.c b/src/backend/regex/regc_nfa.c index 90dca5d9de..92c9c4d795 100644 --- a/src/backend/regex/regc_nfa.c +++ b/src/backend/regex/regc_nfa.c @@ -44,9 +44,9 @@ * newnfa - set up an NFA */ static struct nfa * /* the NFA, or NULL */ -newnfa(struct vars * v, - struct colormap * cm, - struct nfa * parent) /* NULL if primary NFA */ +newnfa(struct vars *v, + struct colormap *cm, + struct nfa *parent) /* NULL if primary NFA */ { struct nfa *nfa; @@ -67,7 +67,7 @@ newnfa(struct vars * v, nfa->eos[0] = nfa->eos[1] = COLORLESS; nfa->parent = parent; /* Precedes newfstate so parent is valid. */ nfa->post = newfstate(nfa, '@'); /* number 0 */ - nfa->pre = newfstate(nfa, '>'); /* number 1 */ + nfa->pre = newfstate(nfa, '>'); /* number 1 */ nfa->init = newstate(nfa); /* may become invalid later */ nfa->final = newstate(nfa); @@ -95,7 +95,7 @@ newnfa(struct vars * v, * freenfa - free an entire NFA */ static void -freenfa(struct nfa * nfa) +freenfa(struct nfa *nfa) { struct state *s; @@ -121,7 +121,7 @@ freenfa(struct nfa * nfa) * newstate - allocate an NFA state, with zero flag value */ static struct state * /* NULL on error */ -newstate(struct nfa * nfa) +newstate(struct nfa *nfa) { struct state *s; @@ -185,7 +185,7 @@ newstate(struct nfa * nfa) * newfstate - allocate an NFA state with a specified flag value */ static struct state * /* NULL on error */ -newfstate(struct nfa * nfa, int flag) +newfstate(struct nfa *nfa, int flag) { struct state *s; @@ -199,8 +199,8 @@ newfstate(struct nfa * nfa, int flag) * dropstate - delete a state's inarcs and outarcs and free it */ static void -dropstate(struct nfa * nfa, - struct state * s) +dropstate(struct nfa *nfa, + struct state *s) { struct arc *a; @@ -215,8 +215,8 @@ dropstate(struct nfa * nfa, * freestate - free a state, which has no in-arcs or out-arcs */ static void -freestate(struct nfa * nfa, - struct state * s) +freestate(struct nfa *nfa, + struct state *s) { assert(s != NULL); assert(s->nins == 0 && s->nouts == 0); @@ -246,8 +246,8 @@ freestate(struct nfa * nfa, * destroystate - really get rid of an already-freed state */ static void -destroystate(struct nfa * nfa, - struct state * s) +destroystate(struct nfa *nfa, + struct state *s) { struct arcbatch *ab; struct arcbatch *abnext; @@ -273,11 +273,11 @@ destroystate(struct nfa * nfa, * In general we never want duplicates. */ static void -newarc(struct nfa * nfa, +newarc(struct nfa *nfa, int t, color co, - struct state * from, - struct state * to) + struct state *from, + struct state *to) { struct arc *a; @@ -319,11 +319,11 @@ newarc(struct nfa * nfa, * identical arc (same type/color/from/to). */ static void -createarc(struct nfa * nfa, +createarc(struct nfa *nfa, int t, color co, - struct state * from, - struct state * to) + struct state *from, + struct state *to) { struct arc *a; @@ -365,8 +365,8 @@ createarc(struct nfa * nfa, * allocarc - allocate a new out-arc within a state */ static struct arc * /* NULL for failure */ -allocarc(struct nfa * nfa, - struct state * s) +allocarc(struct nfa *nfa, + struct state *s) { struct arc *a; @@ -418,8 +418,8 @@ allocarc(struct nfa * nfa, * freearc - free an arc */ static void -freearc(struct nfa * nfa, - struct arc * victim) +freearc(struct nfa *nfa, + struct arc *victim) { struct state *from = victim->from; struct state *to = victim->to; @@ -492,7 +492,7 @@ freearc(struct nfa * nfa, * a similar changearcsource function. */ static void -changearctarget(struct arc * a, struct state * newto) +changearctarget(struct arc *a, struct state *newto) { struct state *oldto = a->to; struct arc *predecessor; @@ -534,7 +534,7 @@ changearctarget(struct arc * a, struct state * newto) * hasnonemptyout - Does state have a non-EMPTY out arc? */ static int -hasnonemptyout(struct state * s) +hasnonemptyout(struct state *s) { struct arc *a; @@ -551,7 +551,7 @@ hasnonemptyout(struct state * s) * If there is more than one such arc, the result is random. */ static struct arc * -findarc(struct state * s, +findarc(struct state *s, int type, color co) { @@ -567,10 +567,10 @@ findarc(struct state * s, * cparc - allocate a new arc within an NFA, copying details from old one */ static void -cparc(struct nfa * nfa, - struct arc * oa, - struct state * from, - struct state * to) +cparc(struct nfa *nfa, + struct arc *oa, + struct state *from, + struct state *to) { newarc(nfa, oa->type, oa->co, from, to); } @@ -579,8 +579,8 @@ cparc(struct nfa * nfa, * sortins - sort the in arcs of a state by from/color/type */ static void -sortins(struct nfa * nfa, - struct state * s) +sortins(struct nfa *nfa, + struct state *s) { struct arc **sortarray; struct arc *a; @@ -623,8 +623,8 @@ sortins(struct nfa * nfa, static int sortins_cmp(const void *a, const void *b) { - const struct arc *aa = *((const struct arc * const *) a); - const struct arc *bb = *((const struct arc * const *) b); + const struct arc *aa = *((const struct arc *const *) a); + const struct arc *bb = *((const struct arc *const *) b); /* we check the fields in the order they are most likely to be different */ if (aa->from->no < bb->from->no) @@ -646,8 +646,8 @@ sortins_cmp(const void *a, const void *b) * sortouts - sort the out arcs of a state by to/color/type */ static void -sortouts(struct nfa * nfa, - struct state * s) +sortouts(struct nfa *nfa, + struct state *s) { struct arc **sortarray; struct arc *a; @@ -690,8 +690,8 @@ sortouts(struct nfa * nfa, static int sortouts_cmp(const void *a, const void *b) { - const struct arc *aa = *((const struct arc * const *) a); - const struct arc *bb = *((const struct arc * const *) b); + const struct arc *aa = *((const struct arc *const *) a); + const struct arc *bb = *((const struct arc *const *) b); /* we check the fields in the order they are most likely to be different */ if (aa->to->no < bb->to->no) @@ -733,9 +733,9 @@ sortouts_cmp(const void *a, const void *b) * the arc lists, and then we can indeed just update the arcs in-place. */ static void -moveins(struct nfa * nfa, - struct state * oldState, - struct state * newState) +moveins(struct nfa *nfa, + struct state *oldState, + struct state *newState) { assert(oldState != newState); @@ -825,9 +825,9 @@ moveins(struct nfa * nfa, * copyins - copy in arcs of a state to another state */ static void -copyins(struct nfa * nfa, - struct state * oldState, - struct state * newState) +copyins(struct nfa *nfa, + struct state *oldState, + struct state *newState) { assert(oldState != newState); @@ -907,9 +907,9 @@ copyins(struct nfa * nfa, * and are not guaranteed unique. It's okay to clobber the array contents. */ static void -mergeins(struct nfa * nfa, - struct state * s, - struct arc ** arcarray, +mergeins(struct nfa *nfa, + struct state *s, + struct arc **arcarray, int arccount) { struct arc *na; @@ -1004,9 +1004,9 @@ mergeins(struct nfa * nfa, * moveouts - move all out arcs of a state to another state */ static void -moveouts(struct nfa * nfa, - struct state * oldState, - struct state * newState) +moveouts(struct nfa *nfa, + struct state *oldState, + struct state *newState) { assert(oldState != newState); @@ -1093,9 +1093,9 @@ moveouts(struct nfa * nfa, * copyouts - copy out arcs of a state to another state */ static void -copyouts(struct nfa * nfa, - struct state * oldState, - struct state * newState) +copyouts(struct nfa *nfa, + struct state *oldState, + struct state *newState) { assert(oldState != newState); @@ -1172,10 +1172,10 @@ copyouts(struct nfa * nfa, * cloneouts - copy out arcs of a state to another state pair, modifying type */ static void -cloneouts(struct nfa * nfa, - struct state * old, - struct state * from, - struct state * to, +cloneouts(struct nfa *nfa, + struct state *old, + struct state *from, + struct state *to, int type) { struct arc *a; @@ -1193,9 +1193,9 @@ cloneouts(struct nfa * nfa, * states using their tmp pointer. */ static void -delsub(struct nfa * nfa, - struct state * lp, /* the sub-NFA goes from here... */ - struct state * rp) /* ...to here, *not* inclusive */ +delsub(struct nfa *nfa, + struct state *lp, /* the sub-NFA goes from here... */ + struct state *rp) /* ...to here, *not* inclusive */ { assert(lp != rp); @@ -1216,9 +1216,9 @@ delsub(struct nfa * nfa, * This routine's basic job is to destroy all out-arcs of the state. */ static void -deltraverse(struct nfa * nfa, - struct state * leftend, - struct state * s) +deltraverse(struct nfa *nfa, + struct state *leftend, + struct state *s) { struct arc *a; struct state *to; @@ -1253,7 +1253,7 @@ deltraverse(struct nfa * nfa, } assert(s->no != FREESTATE); /* we're still here */ - assert(s == leftend || s->nins != 0); /* and still reachable */ + assert(s == leftend || s->nins != 0); /* and still reachable */ assert(s->nouts == 0); /* but have no outarcs */ s->tmp = NULL; /* we're done here */ @@ -1267,11 +1267,11 @@ deltraverse(struct nfa * nfa, * it's a state pointer, didn't you? :-)) */ static void -dupnfa(struct nfa * nfa, - struct state * start, /* duplicate of subNFA starting here */ - struct state * stop, /* and stopping here */ - struct state * from, /* stringing duplicate from here */ - struct state * to) /* to here */ +dupnfa(struct nfa *nfa, + struct state *start, /* duplicate of subNFA starting here */ + struct state *stop, /* and stopping here */ + struct state *from, /* stringing duplicate from here */ + struct state *to) /* to here */ { if (start == stop) { @@ -1291,9 +1291,9 @@ dupnfa(struct nfa * nfa, * duptraverse - recursive heart of dupnfa */ static void -duptraverse(struct nfa * nfa, - struct state * s, - struct state * stmp) /* s's duplicate, or NULL */ +duptraverse(struct nfa *nfa, + struct state *s, + struct state *stmp) /* s's duplicate, or NULL */ { struct arc *a; @@ -1328,8 +1328,8 @@ duptraverse(struct nfa * nfa, * cleartraverse - recursive cleanup for algorithms that leave tmp ptrs set */ static void -cleartraverse(struct nfa * nfa, - struct state * s) +cleartraverse(struct nfa *nfa, + struct state *s) { struct arc *a; @@ -1365,7 +1365,7 @@ cleartraverse(struct nfa * nfa, * that implementation detail not create user-visible performance differences. */ static struct state * -single_color_transition(struct state * s1, struct state * s2) +single_color_transition(struct state *s1, struct state *s2) { struct arc *a; @@ -1395,7 +1395,7 @@ single_color_transition(struct state * s1, struct state * s2) * specialcolors - fill in special colors for an NFA */ static void -specialcolors(struct nfa * nfa) +specialcolors(struct nfa *nfa) { /* false colors for BOS, BOL, EOS, EOL */ if (nfa->parent == NULL) @@ -1434,7 +1434,7 @@ specialcolors(struct nfa * nfa) * without making any progress in the input string. */ static long /* re_info bits */ -optimize(struct nfa * nfa, +optimize(struct nfa *nfa, FILE *f) /* for debug output; NULL none */ { #ifdef REG_DEBUG @@ -1474,7 +1474,7 @@ optimize(struct nfa * nfa, * pullback - pull back constraints backward to eliminate them */ static void -pullback(struct nfa * nfa, +pullback(struct nfa *nfa, FILE *f) /* for debug output; NULL none */ { struct state *s; @@ -1554,9 +1554,9 @@ pullback(struct nfa * nfa, * through their tmp fields). */ static int -pull(struct nfa * nfa, - struct arc * con, - struct state ** intermediates) +pull(struct nfa *nfa, + struct arc *con, + struct state **intermediates) { struct state *from = con->from; struct state *to = con->to; @@ -1641,7 +1641,7 @@ pull(struct nfa * nfa, * pushfwd - push forward constraints forward to eliminate them */ static void -pushfwd(struct nfa * nfa, +pushfwd(struct nfa *nfa, FILE *f) /* for debug output; NULL none */ { struct state *s; @@ -1721,9 +1721,9 @@ pushfwd(struct nfa * nfa, * through their tmp fields). */ static int -push(struct nfa * nfa, - struct arc * con, - struct state ** intermediates) +push(struct nfa *nfa, + struct arc *con, + struct state **intermediates) { struct state *from = con->from; struct state *to = con->to; @@ -1751,7 +1751,7 @@ push(struct nfa * nfa, if (NISERR()) return 0; copyouts(nfa, to, s); /* duplicate outarcs */ - cparc(nfa, con, from, s); /* move constraint arc */ + cparc(nfa, con, from, s); /* move constraint arc */ freearc(nfa, con); if (NISERR()) return 0; @@ -1812,8 +1812,8 @@ push(struct nfa * nfa, * #def COMPATIBLE 3 // compatible but not satisfied yet */ static int -combine(struct arc * con, - struct arc * a) +combine(struct arc *con, + struct arc *a) { #define CA(ct,at) (((ct)<<CHAR_BIT) | (at)) @@ -1833,7 +1833,7 @@ combine(struct arc * con, case CA('$', '$'): case CA(AHEAD, AHEAD): case CA(BEHIND, BEHIND): - if (con->co == a->co) /* true duplication */ + if (con->co == a->co) /* true duplication */ return SATISFIED; return INCOMPATIBLE; break; @@ -1866,7 +1866,7 @@ combine(struct arc * con, * fixempties - get rid of EMPTY arcs */ static void -fixempties(struct nfa * nfa, +fixempties(struct nfa *nfa, FILE *f) /* for debug output; NULL none */ { struct state *s; @@ -2093,10 +2093,10 @@ fixempties(struct nfa * nfa, * the NFA ... but that could still be enough to cause trouble. */ static struct state * -emptyreachable(struct nfa * nfa, - struct state * s, - struct state * lastfound, - struct arc ** inarcsorig) +emptyreachable(struct nfa *nfa, + struct state *s, + struct state *lastfound, + struct arc **inarcsorig) { struct arc *a; @@ -2121,7 +2121,7 @@ emptyreachable(struct nfa * nfa, * isconstraintarc - detect whether an arc is of a constraint type */ static inline int -isconstraintarc(struct arc * a) +isconstraintarc(struct arc *a) { switch (a->type) { @@ -2139,7 +2139,7 @@ isconstraintarc(struct arc * a) * hasconstraintout - does state have a constraint out arc? */ static int -hasconstraintout(struct state * s) +hasconstraintout(struct state *s) { struct arc *a; @@ -2160,7 +2160,7 @@ hasconstraintout(struct state * s) * of such loops before doing that. */ static void -fixconstraintloops(struct nfa * nfa, +fixconstraintloops(struct nfa *nfa, FILE *f) /* for debug output; NULL none */ { struct state *s; @@ -2259,7 +2259,7 @@ restart: * of the NFA ... but that could still be enough to cause trouble. */ static int -findconstraintloop(struct nfa * nfa, struct state * s) +findconstraintloop(struct nfa *nfa, struct state *s) { struct arc *a; @@ -2348,7 +2348,7 @@ findconstraintloop(struct nfa * nfa, struct state * s) * break the loop just by removing those loop arcs, with no new states added. */ static void -breakconstraintloop(struct nfa * nfa, struct state * sinitial) +breakconstraintloop(struct nfa *nfa, struct state *sinitial) { struct state *s; struct state *shead; @@ -2494,11 +2494,11 @@ breakconstraintloop(struct nfa * nfa, struct state * sinitial) * successor states. */ static void -clonesuccessorstates(struct nfa * nfa, - struct state * ssource, - struct state * sclone, - struct state * spredecessor, - struct arc * refarc, +clonesuccessorstates(struct nfa *nfa, + struct state *ssource, + struct state *sclone, + struct state *spredecessor, + struct arc *refarc, char *curdonemap, char *outerdonemap, int nstates) @@ -2726,7 +2726,7 @@ clonesuccessorstates(struct nfa * nfa, * cleanup - clean up NFA after optimizations */ static void -cleanup(struct nfa * nfa) +cleanup(struct nfa *nfa) { struct state *s; struct state *nexts; @@ -2761,10 +2761,10 @@ cleanup(struct nfa * nfa) * markreachable - recursive marking of reachable states */ static void -markreachable(struct nfa * nfa, - struct state * s, - struct state * okay, /* consider only states with this mark */ - struct state * mark) /* the value to mark with */ +markreachable(struct nfa *nfa, + struct state *s, + struct state *okay, /* consider only states with this mark */ + struct state *mark) /* the value to mark with */ { struct arc *a; @@ -2787,10 +2787,10 @@ markreachable(struct nfa * nfa, * markcanreach - recursive marking of states which can reach here */ static void -markcanreach(struct nfa * nfa, - struct state * s, - struct state * okay, /* consider only states with this mark */ - struct state * mark) /* the value to mark with */ +markcanreach(struct nfa *nfa, + struct state *s, + struct state *okay, /* consider only states with this mark */ + struct state *mark) /* the value to mark with */ { struct arc *a; @@ -2813,7 +2813,7 @@ markcanreach(struct nfa * nfa, * analyze - ascertain potentially-useful facts about an optimized NFA */ static long /* re_info bits to be ORed in */ -analyze(struct nfa * nfa) +analyze(struct nfa *nfa) { struct arc *a; struct arc *aa; @@ -2834,8 +2834,8 @@ analyze(struct nfa * nfa) * compact - construct the compact representation of an NFA */ static void -compact(struct nfa * nfa, - struct cnfa * cnfa) +compact(struct nfa *nfa, + struct cnfa *cnfa) { struct state *s; struct arc *a; @@ -2922,7 +2922,7 @@ compact(struct nfa * nfa, * carcsort - sort compacted-NFA arcs by color */ static void -carcsort(struct carc * first, size_t n) +carcsort(struct carc *first, size_t n) { if (n > 1) qsort(first, n, sizeof(struct carc), carc_cmp); @@ -2949,7 +2949,7 @@ carc_cmp(const void *a, const void *b) * freecnfa - free a compacted NFA */ static void -freecnfa(struct cnfa * cnfa) +freecnfa(struct cnfa *cnfa) { assert(cnfa->nstates != 0); /* not empty already */ cnfa->nstates = 0; @@ -2962,7 +2962,7 @@ freecnfa(struct cnfa * cnfa) * dumpnfa - dump an NFA in human-readable form */ static void -dumpnfa(struct nfa * nfa, +dumpnfa(struct nfa *nfa, FILE *f) { #ifdef REG_DEBUG @@ -2999,7 +2999,7 @@ dumpnfa(struct nfa * nfa, * dumpstate - dump an NFA state in human-readable form */ static void -dumpstate(struct state * s, +dumpstate(struct state *s, FILE *f) { struct arc *a; @@ -3025,7 +3025,7 @@ dumpstate(struct state * s, * dumparcs - dump out-arcs in human-readable form */ static void -dumparcs(struct state * s, +dumparcs(struct state *s, FILE *f) { int pos; @@ -3057,8 +3057,8 @@ dumparcs(struct state * s, * dumparc - dump one outarc in readable form, including prefixing tab */ static void -dumparc(struct arc * a, - struct state * s, +dumparc(struct arc *a, + struct state *s, FILE *f) { struct arc *aa; @@ -3114,14 +3114,14 @@ dumparc(struct arc * a, if (aa == NULL) fprintf(f, "?!?"); /* missing from in-chain */ } -#endif /* REG_DEBUG */ +#endif /* REG_DEBUG */ /* * dumpcnfa - dump a compacted NFA in human-readable form */ #ifdef REG_DEBUG static void -dumpcnfa(struct cnfa * cnfa, +dumpcnfa(struct cnfa *cnfa, FILE *f) { int st; @@ -3151,7 +3151,7 @@ dumpcnfa(struct cnfa * cnfa, */ static void dumpcstate(int st, - struct cnfa * cnfa, + struct cnfa *cnfa, FILE *f) { struct carc *ca; @@ -3178,4 +3178,4 @@ dumpcstate(int st, fflush(f); } -#endif /* REG_DEBUG */ +#endif /* REG_DEBUG */ diff --git a/src/backend/regex/regc_pg_locale.c b/src/backend/regex/regc_pg_locale.c index 4bdcb4fd6a..6982879688 100644 --- a/src/backend/regex/regc_pg_locale.c +++ b/src/backend/regex/regc_pg_locale.c @@ -277,7 +277,7 @@ pg_set_regex_collation(Oid collation) pg_regex_strategy = PG_REGEX_LOCALE_WIDE; } else -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ { if (pg_regex_locale) pg_regex_strategy = PG_REGEX_LOCALE_1BYTE_L; diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c index 0834ae6e06..51385509bb 100644 --- a/src/backend/regex/regcomp.c +++ b/src/backend/regex/regcomp.c @@ -257,7 +257,7 @@ struct vars /* parsing macros; most know that `v' is the struct vars pointer */ #define NEXT() (next(v)) /* advance by one token */ #define SEE(t) (v->nexttype == (t)) /* is next token this? */ -#define EAT(t) (SEE(t) && next(v)) /* if next is this, swallow it */ +#define EAT(t) (SEE(t) && next(v)) /* if next is this, swallow it */ #define VISERR(vv) ((vv)->err != 0) /* have we seen an error yet? */ #define ISERR() VISERR(v) #define VERR(vv,e) ((vv)->nexttype = EOS, \ @@ -491,14 +491,14 @@ pg_regcomp(regex_t *re, * moresubs - enlarge subRE vector */ static void -moresubs(struct vars * v, +moresubs(struct vars *v, int wanted) /* want enough room for this one */ { struct subre **p; size_t n; assert(wanted > 0 && (size_t) wanted >= v->nsubs); - n = (size_t) wanted *3 / 2 + 1; + n = (size_t) wanted * 3 / 2 + 1; if (v->subs == v->sub10) { @@ -528,7 +528,7 @@ moresubs(struct vars * v, * (if any), to make error-handling code terser. */ static int -freev(struct vars * v, +freev(struct vars *v, int err) { if (v->re != NULL) @@ -557,8 +557,8 @@ freev(struct vars * v, * NFA must have been optimize()d already. */ static void -makesearch(struct vars * v, - struct nfa * nfa) +makesearch(struct vars *v, + struct nfa *nfa) { struct arc *a; struct arc *b; @@ -646,11 +646,11 @@ makesearch(struct vars * v, * of a chain of '|' subres. */ static struct subre * -parse(struct vars * v, +parse(struct vars *v, int stopper, /* EOS or ')' */ int type, /* LACON (lookaround subRE) or PLAIN */ - struct state * init, /* initial state */ - struct state * final) /* final state */ + struct state *init, /* initial state */ + struct state *final) /* final state */ { struct state *left; /* scaffolding for branch */ struct state *right; @@ -725,11 +725,11 @@ parse(struct vars * v, * ',' nodes introduced only when necessary due to substructure. */ static struct subre * -parsebranch(struct vars * v, +parsebranch(struct vars *v, int stopper, /* EOS or ')' */ int type, /* LACON (lookaround subRE) or PLAIN */ - struct state * left, /* leftmost state */ - struct state * right, /* rightmost state */ + struct state *left, /* leftmost state */ + struct state *right, /* rightmost state */ int partial) /* is this only part of a branch? */ { struct state *lp; /* left end of current construct */ @@ -774,12 +774,12 @@ parsebranch(struct vars * v, * of the branch, making this function's name somewhat inaccurate. */ static void -parseqatom(struct vars * v, +parseqatom(struct vars *v, int stopper, /* EOS or ')' */ int type, /* LACON (lookaround subRE) or PLAIN */ - struct state * lp, /* left state to hang it on */ - struct state * rp, /* right state to hang it on */ - struct subre * top) /* subtree top */ + struct state *lp, /* left state to hang it on */ + struct state *rp, /* right state to hang it on */ + struct subre *top) /* subtree top */ { struct state *s; /* temporaries for new states */ struct state *s2; @@ -942,7 +942,7 @@ parseqatom(struct vars * v, assert((size_t) subno < v->nsubs); } else - atomtype = PLAIN; /* something that's not '(' */ + atomtype = PLAIN; /* something that's not '(' */ NEXT(); /* need new endpoints because tree will contain pointers */ s = newstate(v->nfa); @@ -1124,7 +1124,7 @@ parseqatom(struct vars * v, /* if it's a backref, now is the time to replicate the subNFA */ if (atomtype == BACKREF) { - assert(atom->begin->nouts == 1); /* just the EMPTY */ + assert(atom->begin->nouts == 1); /* just the EMPTY */ delsub(v->nfa, atom->begin, atom->end); assert(v->subs[subno] != NULL); @@ -1145,7 +1145,7 @@ parseqatom(struct vars * v, if (atomtype == BACKREF) { /* special case: backrefs have internal quantifiers */ - EMPTYARC(s, atom->begin); /* empty prefix */ + EMPTYARC(s, atom->begin); /* empty prefix */ /* just stuff everything into atom */ repeat(v, atom->begin, atom->end, m, n); atom->min = (short) m; @@ -1157,7 +1157,7 @@ parseqatom(struct vars * v, else if (m == 1 && n == 1) { /* no/vacuous quantifier: done */ - EMPTYARC(s, atom->begin); /* empty prefix */ + EMPTYARC(s, atom->begin); /* empty prefix */ /* rest of branch can be strung starting from atom->end */ s2 = atom->end; } @@ -1175,7 +1175,7 @@ parseqatom(struct vars * v, assert(m >= 1 && m != DUPINF && n >= 1); repeat(v, s, atom->begin, m - 1, (n == DUPINF) ? n : n - 1); f = COMBINE(qprefer, atom->flags); - t = subre(v, '.', f, s, atom->end); /* prefix and atom */ + t = subre(v, '.', f, s, atom->end); /* prefix and atom */ NOERR(); t->left = subre(v, '=', PREF(f), s, atom->begin); NOERR(); @@ -1222,10 +1222,10 @@ parseqatom(struct vars * v, * nonword - generate arcs for non-word-character ahead or behind */ static void -nonword(struct vars * v, +nonword(struct vars *v, int dir, /* AHEAD or BEHIND */ - struct state * lp, - struct state * rp) + struct state *lp, + struct state *rp) { int anchor = (dir == AHEAD) ? '$' : '^'; @@ -1240,10 +1240,10 @@ nonword(struct vars * v, * word - generate arcs for word character ahead or behind */ static void -word(struct vars * v, +word(struct vars *v, int dir, /* AHEAD or BEHIND */ - struct state * lp, - struct state * rp) + struct state *lp, + struct state *rp) { assert(dir == AHEAD || dir == BEHIND); cloneouts(v->nfa, v->wordchrs, lp, rp, dir); @@ -1254,7 +1254,7 @@ word(struct vars * v, * scannum - scan a number */ static int /* value, <= DUPMAX */ -scannum(struct vars * v) +scannum(struct vars *v) { int n = 0; @@ -1285,9 +1285,9 @@ scannum(struct vars * v) * code in parse(), and when this is called, it doesn't matter any more. */ static void -repeat(struct vars * v, - struct state * lp, - struct state * rp, +repeat(struct vars *v, + struct state *lp, + struct state *rp, int m, int n) { @@ -1371,9 +1371,9 @@ repeat(struct vars * v, * Also called from cbracket for complemented bracket expressions. */ static void -bracket(struct vars * v, - struct state * lp, - struct state * rp) +bracket(struct vars *v, + struct state *lp, + struct state *rp) { assert(SEE('[')); NEXT(); @@ -1390,9 +1390,9 @@ bracket(struct vars * v, * arcs as the b.e. is seen... but that gets messy. */ static void -cbracket(struct vars * v, - struct state * lp, - struct state * rp) +cbracket(struct vars *v, + struct state *lp, + struct state *rp) { struct state *left = newstate(v->nfa); struct state *right = newstate(v->nfa); @@ -1420,9 +1420,9 @@ cbracket(struct vars * v, * brackpart - handle one item (or range) within a bracket expression */ static void -brackpart(struct vars * v, - struct state * lp, - struct state * rp) +brackpart(struct vars *v, + struct state *lp, + struct state *rp) { chr startc; chr endc; @@ -1533,7 +1533,7 @@ brackpart(struct vars * v, * to look past the final bracket of the [. etc. */ static const chr * /* just after end of sequence */ -scanplain(struct vars * v) +scanplain(struct vars *v) { const chr *endp; @@ -1558,10 +1558,10 @@ scanplain(struct vars * v) * This is mostly a shortcut for efficient handling of the common case. */ static void -onechr(struct vars * v, +onechr(struct vars *v, chr c, - struct state * lp, - struct state * rp) + struct state *lp, + struct state *rp) { if (!(v->cflags & REG_ICASE)) { @@ -1585,7 +1585,7 @@ onechr(struct vars * v, * should be cleaned up to reduce dependencies on input scanning. */ static void -wordchrs(struct vars * v) +wordchrs(struct vars *v) { struct state *left; struct state *right; @@ -1617,12 +1617,12 @@ wordchrs(struct vars * v) * can be optimized. */ static void -processlacon(struct vars * v, - struct state * begin, /* start of parsed LACON sub-re */ - struct state * end, /* end of parsed LACON sub-re */ +processlacon(struct vars *v, + struct state *begin, /* start of parsed LACON sub-re */ + struct state *end, /* end of parsed LACON sub-re */ int latype, - struct state * lp, /* left state to hang it on */ - struct state * rp) /* right state to hang it on */ + struct state *lp, /* left state to hang it on */ + struct state *rp) /* right state to hang it on */ { struct state *s1; int n; @@ -1683,11 +1683,11 @@ processlacon(struct vars * v, * subre - allocate a subre */ static struct subre * -subre(struct vars * v, +subre(struct vars *v, int op, int flags, - struct state * begin, - struct state * end) + struct state *begin, + struct state *end) { struct subre *ret = v->treefree; @@ -1735,8 +1735,8 @@ subre(struct vars * v, * freesubre - free a subRE subtree */ static void -freesubre(struct vars * v, /* might be NULL */ - struct subre * sr) +freesubre(struct vars *v, /* might be NULL */ + struct subre *sr) { if (sr == NULL) return; @@ -1753,8 +1753,8 @@ freesubre(struct vars * v, /* might be NULL */ * freesrnode - free one node in a subRE subtree */ static void -freesrnode(struct vars * v, /* might be NULL */ - struct subre * sr) +freesrnode(struct vars *v, /* might be NULL */ + struct subre *sr) { if (sr == NULL) return; @@ -1777,8 +1777,8 @@ freesrnode(struct vars * v, /* might be NULL */ * optst - optimize a subRE subtree */ static void -optst(struct vars * v, - struct subre * t) +optst(struct vars *v, + struct subre *t) { /* * DGP (2007-11-13): I assume it was the programmer's intent to eventually @@ -1793,7 +1793,7 @@ optst(struct vars * v, * numst - number tree nodes (assigning "id" indexes) */ static int /* next number */ -numst(struct subre * t, +numst(struct subre *t, int start) /* starting point for subtree numbers */ { int i; @@ -1827,7 +1827,7 @@ numst(struct subre * t, * in or between these two functions. */ static void -markst(struct subre * t) +markst(struct subre *t) { assert(t != NULL); @@ -1842,7 +1842,7 @@ markst(struct subre * t) * cleanst - free any tree nodes not marked INUSE */ static void -cleanst(struct vars * v) +cleanst(struct vars *v) { struct subre *t; struct subre *next; @@ -1861,8 +1861,8 @@ cleanst(struct vars * v) * nfatree - turn a subRE subtree into a tree of compacted NFAs */ static long /* optimize results from top node */ -nfatree(struct vars * v, - struct subre * t, +nfatree(struct vars *v, + struct subre *t, FILE *f) /* for debug output */ { assert(t != NULL && t->begin != NULL); @@ -1881,8 +1881,8 @@ nfatree(struct vars * v, * If converttosearch is true, apply makesearch() to the NFA. */ static long /* optimize results */ -nfanode(struct vars * v, - struct subre * t, +nfanode(struct vars *v, + struct subre *t, int converttosearch, FILE *f) /* for debug output */ { @@ -1920,9 +1920,9 @@ nfanode(struct vars * v, * newlacon - allocate a lookaround-constraint subRE */ static int /* lacon number */ -newlacon(struct vars * v, - struct state * begin, - struct state * end, +newlacon(struct vars *v, + struct state *begin, + struct state *end, int latype) { int n; @@ -1959,7 +1959,7 @@ newlacon(struct vars * v, * freelacons - free lookaround-constraint subRE vector */ static void -freelacons(struct subre * subs, +freelacons(struct subre *subs, int n) { struct subre *sub; @@ -2102,7 +2102,7 @@ dump(regex_t *re, * dumpst - dump a subRE tree */ static void -dumpst(struct subre * t, +dumpst(struct subre *t, FILE *f, int nfapresent) /* is the original NFA still around? */ { @@ -2117,7 +2117,7 @@ dumpst(struct subre * t, * stdump - recursive guts of dumpst */ static void -stdump(struct subre * t, +stdump(struct subre *t, FILE *f, int nfapresent) /* is the original NFA still around? */ { @@ -2167,7 +2167,7 @@ stdump(struct subre * t, * stid - identify a subtree node for dumping */ static const char * /* points to buf or constant string */ -stid(struct subre * t, +stid(struct subre *t, char *buf, size_t bufsize) { @@ -2180,7 +2180,7 @@ stid(struct subre * t, sprintf(buf, "%p", t); return buf; } -#endif /* REG_DEBUG */ +#endif /* REG_DEBUG */ #include "regc_lex.c" diff --git a/src/backend/regex/rege_dfa.c b/src/backend/regex/rege_dfa.c index b98c9d3902..5695e158a5 100644 --- a/src/backend/regex/rege_dfa.c +++ b/src/backend/regex/rege_dfa.c @@ -39,8 +39,8 @@ * Internal errors also return NULL, with v->err set. */ static chr * -longest(struct vars * v, - struct dfa * d, +longest(struct vars *v, + struct dfa *d, chr *start, /* where the match should start */ chr *stop, /* match must end at or before here */ int *hitstopp) /* record whether hit v->stop, if non-NULL */ @@ -165,8 +165,8 @@ longest(struct vars * v, * Internal errors also return NULL, with v->err set. */ static chr * -shortest(struct vars * v, - struct dfa * d, +shortest(struct vars *v, + struct dfa *d, chr *start, /* where the match should start */ chr *min, /* match must end at or after here */ chr *max, /* match must end at or before here */ @@ -300,10 +300,10 @@ shortest(struct vars * v, * Internal errors also return 0, with v->err set. */ static int -matchuntil(struct vars * v, - struct dfa * d, +matchuntil(struct vars *v, + struct dfa *d, chr *probe, /* we want to know if a match ends here */ - struct sset ** lastcss, /* state storage across calls */ + struct sset **lastcss, /* state storage across calls */ chr **lastcp) /* state storage across calls */ { chr *cp = *lastcp; @@ -414,8 +414,8 @@ matchuntil(struct vars * v, * lastcold - determine last point at which no progress had been made */ static chr * /* endpoint, or NULL */ -lastcold(struct vars * v, - struct dfa * d) +lastcold(struct vars *v, + struct dfa *d) { struct sset *ss; chr *nopr; @@ -434,10 +434,10 @@ lastcold(struct vars * v, * newdfa - set up a fresh DFA */ static struct dfa * -newdfa(struct vars * v, - struct cnfa * cnfa, - struct colormap * cm, - struct smalldfa * sml) /* preallocated space, may be NULL */ +newdfa(struct vars *v, + struct cnfa *cnfa, + struct colormap *cm, + struct smalldfa *sml) /* preallocated space, may be NULL */ { struct dfa *d; size_t nss = cnfa->nstates * 2; @@ -514,7 +514,7 @@ newdfa(struct vars * v, * freedfa - free a DFA */ static void -freedfa(struct dfa * d) +freedfa(struct dfa *d) { if (d->cptsmalloced) { @@ -554,8 +554,8 @@ hash(unsigned *uv, * initialize - hand-craft a cache entry for startup, otherwise get ready */ static struct sset * -initialize(struct vars * v, - struct dfa * d, +initialize(struct vars *v, + struct dfa *d, chr *start) { struct sset *ss; @@ -600,9 +600,9 @@ initialize(struct vars * v, * Internal errors also return NULL, with v->err set. */ static struct sset * -miss(struct vars * v, - struct dfa * d, - struct sset * css, +miss(struct vars *v, + struct dfa *d, + struct sset *css, color co, chr *cp, /* next chr */ chr *start) /* where the attempt got started */ @@ -672,15 +672,15 @@ miss(struct vars * v, for (ca = cnfa->states[i]; ca->co != COLORLESS; ca++) { if (ca->co < cnfa->ncolors) - continue; /* not a LACON arc */ + continue; /* not a LACON arc */ if (ISBSET(d->work, ca->to)) - continue; /* arc would be a no-op anyway */ - sawlacons = 1; /* this LACON affects our result */ + continue; /* arc would be a no-op anyway */ + sawlacons = 1; /* this LACON affects our result */ if (!lacon(v, cnfa, cp, ca->co)) { if (ISERR()) return NULL; - continue; /* LACON arc cannot be traversed */ + continue; /* LACON arc cannot be traversed */ } if (ISERR()) return NULL; @@ -740,8 +740,8 @@ miss(struct vars * v, * lacon - lookaround-constraint checker for miss() */ static int /* predicate: constraint satisfied? */ -lacon(struct vars * v, - struct cnfa * pcnfa, /* parent cnfa */ +lacon(struct vars *v, + struct cnfa *pcnfa, /* parent cnfa */ chr *cp, color co) /* "color" of the lookaround constraint */ { @@ -797,8 +797,8 @@ lacon(struct vars * v, * clear the innards of the state set -- that's up to the caller. */ static struct sset * -getvacant(struct vars * v, - struct dfa * d, +getvacant(struct vars *v, + struct dfa *d, chr *cp, chr *start) { @@ -821,7 +821,7 @@ getvacant(struct vars * v, FDEBUG(("zapping c%d's %ld outarc\n", (int) (p - d->ssets), (long) co)); p->outs[co] = NULL; ap = p->inchain[co]; - p->inchain[co].ss = NULL; /* paranoia */ + p->inchain[co].ss = NULL; /* paranoia */ } ss->ins.ss = NULL; @@ -868,8 +868,8 @@ getvacant(struct vars * v, * pickss - pick the next stateset to be used */ static struct sset * -pickss(struct vars * v, - struct dfa * d, +pickss(struct vars *v, + struct dfa *d, chr *cp, chr *start) { diff --git a/src/backend/regex/regerror.c b/src/backend/regex/regerror.c index f2fe696425..4a27c2552c 100644 --- a/src/backend/regex/regerror.c +++ b/src/backend/regex/regerror.c @@ -42,7 +42,7 @@ static const struct rerr int code; const char *name; const char *explain; -} rerrs[] = +} rerrs[] = { /* the actual table is built from regex.h */ @@ -64,7 +64,7 @@ pg_regerror(int errcode, /* error code, or REG_ATOI or REG_ITOA */ { const struct rerr *r; const char *msg; - char convbuf[sizeof(unk) + 50]; /* 50 = plenty for int */ + char convbuf[sizeof(unk) + 50]; /* 50 = plenty for int */ size_t len; int icode; @@ -78,7 +78,7 @@ pg_regerror(int errcode, /* error code, or REG_ATOI or REG_ITOA */ msg = convbuf; break; case REG_ITOA: /* convert number to name */ - icode = atoi(errbuf); /* not our problem if this fails */ + icode = atoi(errbuf); /* not our problem if this fails */ for (r = rerrs; r->code >= 0; r++) if (r->code == icode) break; diff --git a/src/backend/regex/regexec.c b/src/backend/regex/regexec.c index 5cbfd9b151..f7eaa76b02 100644 --- a/src/backend/regex/regexec.c +++ b/src/backend/regex/regexec.c @@ -334,8 +334,8 @@ cleanup: * The DFA will be freed by the cleanup step in pg_regexec(). */ static struct dfa * -getsubdfa(struct vars * v, - struct subre * t) +getsubdfa(struct vars *v, + struct subre *t) { if (v->subdfas[t->id] == NULL) { @@ -352,7 +352,7 @@ getsubdfa(struct vars * v, * Same as above, but for LACONs. */ static struct dfa * -getladfa(struct vars * v, +getladfa(struct vars *v, int n) { assert(n > 0 && n < v->g->nlacons && v->g->lacons != NULL); @@ -372,9 +372,9 @@ getladfa(struct vars * v, * find - find a match for the main NFA (no-complications case) */ static int -find(struct vars * v, - struct cnfa * cnfa, - struct colormap * cm) +find(struct vars *v, + struct cnfa *cnfa, + struct colormap *cm) { struct dfa *s; struct dfa *d; @@ -403,7 +403,7 @@ find(struct vars * v, v->details->rm_extend.rm_so = OFF(cold); else v->details->rm_extend.rm_so = OFF(v->stop); - v->details->rm_extend.rm_eo = OFF(v->stop); /* unknown */ + v->details->rm_extend.rm_eo = OFF(v->stop); /* unknown */ } if (close == NULL) /* not found */ return REG_NOMATCH; @@ -449,7 +449,7 @@ find(struct vars * v, v->details->rm_extend.rm_so = OFF(cold); else v->details->rm_extend.rm_so = OFF(v->stop); - v->details->rm_extend.rm_eo = OFF(v->stop); /* unknown */ + v->details->rm_extend.rm_eo = OFF(v->stop); /* unknown */ } if (v->nmatch == 1) /* no need for submatches */ return REG_OKAY; @@ -463,9 +463,9 @@ find(struct vars * v, * cfind - find a match for the main NFA (with complications) */ static int -cfind(struct vars * v, - struct cnfa * cnfa, - struct colormap * cm) +cfind(struct vars *v, + struct cnfa *cnfa, + struct colormap *cm) { struct dfa *s; struct dfa *d; @@ -494,7 +494,7 @@ cfind(struct vars * v, v->details->rm_extend.rm_so = OFF(cold); else v->details->rm_extend.rm_so = OFF(v->stop); - v->details->rm_extend.rm_eo = OFF(v->stop); /* unknown */ + v->details->rm_extend.rm_eo = OFF(v->stop); /* unknown */ } return ret; } @@ -503,11 +503,11 @@ cfind(struct vars * v, * cfindloop - the heart of cfind */ static int -cfindloop(struct vars * v, - struct cnfa * cnfa, - struct colormap * cm, - struct dfa * d, - struct dfa * s, +cfindloop(struct vars *v, + struct cnfa *cnfa, + struct colormap *cm, + struct dfa *d, + struct dfa *s, chr **coldp) /* where to put coldstart pointer */ { chr *begin; @@ -632,8 +632,8 @@ zapallsubs(regmatch_t *p, * zaptreesubs - initialize subexpressions within subtree to "no match" */ static void -zaptreesubs(struct vars * v, - struct subre * t) +zaptreesubs(struct vars *v, + struct subre *t) { if (t->op == '(') { @@ -657,8 +657,8 @@ zaptreesubs(struct vars * v, * subset - set subexpression match data for a successful subre */ static void -subset(struct vars * v, - struct subre * sub, +subset(struct vars *v, + struct subre *sub, chr *begin, chr *end) { @@ -689,8 +689,8 @@ subset(struct vars * v, * zaptreesubs (or zapallsubs at the top level). */ static int /* regexec return code */ -cdissect(struct vars * v, - struct subre * t, +cdissect(struct vars *v, + struct subre *t, chr *begin, /* beginning of relevant substring */ chr *end) /* end of same */ { @@ -718,7 +718,7 @@ cdissect(struct vars * v, break; case '.': /* concatenation */ assert(t->left != NULL && t->right != NULL); - if (t->left->flags & SHORTER) /* reverse scan */ + if (t->left->flags & SHORTER) /* reverse scan */ er = crevcondissect(v, t, begin, end); else er = ccondissect(v, t, begin, end); @@ -729,7 +729,7 @@ cdissect(struct vars * v, break; case '*': /* iteration */ assert(t->left != NULL); - if (t->left->flags & SHORTER) /* reverse scan */ + if (t->left->flags & SHORTER) /* reverse scan */ er = creviterdissect(v, t, begin, end); else er = citerdissect(v, t, begin, end); @@ -760,8 +760,8 @@ cdissect(struct vars * v, * ccondissect - dissect match for concatenation node */ static int /* regexec return code */ -ccondissect(struct vars * v, - struct subre * t, +ccondissect(struct vars *v, + struct subre *t, chr *begin, /* beginning of relevant substring */ chr *end) /* end of same */ { @@ -838,8 +838,8 @@ ccondissect(struct vars * v, * crevcondissect - dissect match for concatenation node, shortest-first */ static int /* regexec return code */ -crevcondissect(struct vars * v, - struct subre * t, +crevcondissect(struct vars *v, + struct subre *t, chr *begin, /* beginning of relevant substring */ chr *end) /* end of same */ { @@ -916,8 +916,8 @@ crevcondissect(struct vars * v, * cbrdissect - dissect match for backref node */ static int /* regexec return code */ -cbrdissect(struct vars * v, - struct subre * t, +cbrdissect(struct vars *v, + struct subre *t, chr *begin, /* beginning of relevant substring */ chr *end) /* end of same */ { @@ -997,8 +997,8 @@ cbrdissect(struct vars * v, * caltdissect - dissect match for alternation node */ static int /* regexec return code */ -caltdissect(struct vars * v, - struct subre * t, +caltdissect(struct vars *v, + struct subre *t, chr *begin, /* beginning of relevant substring */ chr *end) /* end of same */ { @@ -1034,8 +1034,8 @@ caltdissect(struct vars * v, * citerdissect - dissect match for iteration node */ static int /* regexec return code */ -citerdissect(struct vars * v, - struct subre * t, +citerdissect(struct vars *v, + struct subre *t, chr *begin, /* beginning of relevant substring */ chr *end) /* end of same */ { @@ -1235,8 +1235,8 @@ backtrack: * creviterdissect - dissect match for iteration node, shortest-first */ static int /* regexec return code */ -creviterdissect(struct vars * v, - struct subre * t, +creviterdissect(struct vars *v, + struct subre *t, chr *begin, /* beginning of relevant substring */ chr *end) /* end of same */ { diff --git a/src/backend/regex/regexport.c b/src/backend/regex/regexport.c index 371c1f9da6..febf2adaec 100644 --- a/src/backend/regex/regexport.c +++ b/src/backend/regex/regexport.c @@ -90,7 +90,7 @@ pg_reg_getfinalstate(const regex_t *regex) * arcs_len (possibly 0) are emitted into arcs[]. */ static void -traverse_lacons(struct cnfa * cnfa, int st, +traverse_lacons(struct cnfa *cnfa, int st, int *arcs_count, regex_arc_t *arcs, int arcs_len) { @@ -235,7 +235,7 @@ pg_reg_getnumcharacters(const regex_t *regex, int co) if (co <= 0 || co > cm->max) /* we reject 0 which is WHITE */ return -1; - if (cm->cd[co].flags & PSEUDO) /* also pseudocolors (BOS etc) */ + if (cm->cd[co].flags & PSEUDO) /* also pseudocolors (BOS etc) */ return -1; /* diff --git a/src/backend/regex/regprefix.c b/src/backend/regex/regprefix.c index cb74f2f311..96ca0e1ed3 100644 --- a/src/backend/regex/regprefix.c +++ b/src/backend/regex/regprefix.c @@ -19,7 +19,7 @@ /* * forward declarations */ -static int findprefix(struct cnfa * cnfa, struct colormap * cm, +static int findprefix(struct cnfa *cnfa, struct colormap *cm, chr *string, size_t *slength); @@ -109,8 +109,8 @@ pg_regprefix(regex_t *re, * *slength (which must be preset to zero) incremented for each chr. */ static int /* regprefix return code */ -findprefix(struct cnfa * cnfa, - struct colormap * cm, +findprefix(struct cnfa *cnfa, + struct colormap *cm, chr *string, size_t *slength) { diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index cb5f58b6ba..9776858f03 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -16,7 +16,7 @@ #include <unistd.h> #include <time.h> -#include "access/xlog_internal.h" /* for pg_start/stop_backup */ +#include "access/xlog_internal.h" /* for pg_start/stop_backup */ #include "catalog/catalog.h" #include "catalog/pg_type.h" #include "lib/stringinfo.h" @@ -54,11 +54,11 @@ typedef struct static int64 sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, bool sendtblspclinks); static bool sendFile(char *readfilename, char *tarfilename, - struct stat * statbuf, bool missing_ok); + struct stat *statbuf, bool missing_ok); static void sendFileWithContent(const char *filename, const char *content); static int64 _tarWriteHeader(const char *filename, const char *linktarget, - struct stat * statbuf, bool sizeonly); -static int64 _tarWriteDir(const char *pathbuf, int basepathlen, struct stat * statbuf, + struct stat *statbuf, bool sizeonly); +static int64 _tarWriteDir(const char *pathbuf, int basepathlen, struct stat *statbuf, bool sizeonly); static void send_int8_string(StringInfoData *buf, int64 intval); static void SendBackupHeader(List *tablespaces); @@ -273,8 +273,8 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) /* Send CopyOutResponse message */ pq_beginmessage(&buf, 'H'); - pq_sendbyte(&buf, 0); /* overall format */ - pq_sendint(&buf, 0, 2); /* natts */ + pq_sendbyte(&buf, 0); /* overall format */ + pq_sendint(&buf, 0, 2); /* natts */ pq_endmessage(&buf); if (ti->path == NULL) @@ -318,7 +318,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) Assert(lnext(lc) == NULL); } else - pq_putemptymessage('c'); /* CopyDone */ + pq_putemptymessage('c'); /* CopyDone */ } } PG_END_ENSURE_ERROR_CLEANUP(base_backup_cleanup, (Datum) 0); @@ -365,7 +365,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) dir = AllocateDir("pg_wal"); if (!dir) ereport(ERROR, - (errmsg("could not open directory \"%s\": %m", "pg_wal"))); + (errmsg("could not open directory \"%s\": %m", "pg_wal"))); while ((de = ReadDir(dir, "pg_wal")) != NULL) { /* Does it look like a WAL segment, and is it in the range? */ @@ -436,7 +436,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) XLogFileName(nextfname, ThisTimeLineID, nextsegno); ereport(ERROR, - (errmsg("could not find WAL file \"%s\"", nextfname))); + (errmsg("could not find WAL file \"%s\"", nextfname))); } } if (segno != endsegno) @@ -484,7 +484,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) CheckXLogRemoved(segno, tli); ereport(ERROR, (errcode_for_file_access(), - errmsg("unexpected WAL file size \"%s\"", walFiles[i]))); + errmsg("unexpected WAL file size \"%s\"", walFiles[i]))); } /* send the WAL file itself */ @@ -510,7 +510,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir) CheckXLogRemoved(segno, tli); ereport(ERROR, (errcode_for_file_access(), - errmsg("unexpected WAL file size \"%s\"", walFiles[i]))); + errmsg("unexpected WAL file size \"%s\"", walFiles[i]))); } /* XLogSegSize is a multiple of 512, so no need for padding */ @@ -652,7 +652,7 @@ parse_basebackup_options(List *options, basebackup_options *opt) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("%d is outside the valid range for parameter \"%s\" (%d .. %d)", - (int) maxrate, "MAX_RATE", MAX_RATE_LOWER, MAX_RATE_UPPER))); + (int) maxrate, "MAX_RATE", MAX_RATE_LOWER, MAX_RATE_UPPER))); opt->maxrate = (uint32) maxrate; o_maxrate = true; @@ -814,7 +814,7 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli) pq_sendstring(&buf, "recptr"); pq_sendint(&buf, 0, 4); /* table oid */ pq_sendint(&buf, 0, 2); /* attnum */ - pq_sendint(&buf, TEXTOID, 4); /* type oid */ + pq_sendint(&buf, TEXTOID, 4); /* type oid */ pq_sendint(&buf, -1, 2); pq_sendint(&buf, 0, 4); pq_sendint(&buf, 0, 2); @@ -827,7 +827,7 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli) * int8 may seem like a surprising data type for this, but in theory int4 * would not be wide enough for this, as TimeLineID is unsigned. */ - pq_sendint(&buf, INT8OID, 4); /* type oid */ + pq_sendint(&buf, INT8OID, 4); /* type oid */ pq_sendint(&buf, -1, 2); pq_sendint(&buf, 0, 4); pq_sendint(&buf, 0, 2); @@ -992,9 +992,9 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("the standby was promoted during online backup"), - errhint("This means that the backup being taken is corrupt " - "and should not be used. " - "Try taking another online backup."))); + errhint("This means that the backup being taken is corrupt " + "and should not be used. " + "Try taking another online backup."))); /* Scan for files that should be excluded */ excludeFound = false; @@ -1113,9 +1113,9 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, */ ereport(WARNING, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("tablespaces are not supported on this platform"))); + errmsg("tablespaces are not supported on this platform"))); continue; -#endif /* HAVE_READLINK */ +#endif /* HAVE_READLINK */ } else if (S_ISDIR(statbuf.st_mode)) { @@ -1199,7 +1199,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, * and the file did not exist. */ static bool -sendFile(char *readfilename, char *tarfilename, struct stat * statbuf, +sendFile(char *readfilename, char *tarfilename, struct stat *statbuf, bool missing_ok) { FILE *fp; @@ -1225,7 +1225,7 @@ sendFile(char *readfilename, char *tarfilename, struct stat * statbuf, /* Send the chunk as a CopyData message */ if (pq_putmessage('d', buf, cnt)) ereport(ERROR, - (errmsg("base backup could not send data, aborting backup"))); + (errmsg("base backup could not send data, aborting backup"))); len += cnt; throttle(cnt); @@ -1273,7 +1273,7 @@ sendFile(char *readfilename, char *tarfilename, struct stat * statbuf, static int64 _tarWriteHeader(const char *filename, const char *linktarget, - struct stat * statbuf, bool sizeonly) + struct stat *statbuf, bool sizeonly) { char h[512]; enum tarError rc; @@ -1281,7 +1281,7 @@ _tarWriteHeader(const char *filename, const char *linktarget, if (!sizeonly) { rc = tarCreateHeader(h, filename, linktarget, statbuf->st_size, - statbuf->st_mode, statbuf->st_uid, statbuf->st_gid, + statbuf->st_mode, statbuf->st_uid, statbuf->st_gid, statbuf->st_mtime); switch (rc) @@ -1295,9 +1295,9 @@ _tarWriteHeader(const char *filename, const char *linktarget, break; case TAR_SYMLINK_TOO_LONG: ereport(ERROR, - (errmsg("symbolic link target too long for tar format: " - "file name \"%s\", target \"%s\"", - filename, linktarget))); + (errmsg("symbolic link target too long for tar format: " + "file name \"%s\", target \"%s\"", + filename, linktarget))); break; default: elog(ERROR, "unrecognized tar error: %d", rc); @@ -1314,7 +1314,7 @@ _tarWriteHeader(const char *filename, const char *linktarget, * write it as a directory anyway. */ static int64 -_tarWriteDir(const char *pathbuf, int basepathlen, struct stat * statbuf, +_tarWriteDir(const char *pathbuf, int basepathlen, struct stat *statbuf, bool sizeonly) { /* If symlink, write it as a directory anyway */ @@ -1366,7 +1366,7 @@ throttle(size_t increment) * the maximum time to sleep. Thus the cast to long is safe. */ wait_result = WaitLatch(MyLatch, - WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, + WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, (long) (sleep / 1000), WAIT_EVENT_BASE_BACKUP_THROTTLE); diff --git a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c index 7509b4fe60..2f0ed035fc 100644 --- a/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c +++ b/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c @@ -425,8 +425,8 @@ libpqrcv_endstreaming(WalReceiverConn *conn, TimeLineID *next_tli) if (PQputCopyEnd(conn->streamConn, NULL) <= 0 || PQflush(conn->streamConn)) ereport(ERROR, - (errmsg("could not send end-of-streaming message to primary: %s", - pchomp(PQerrorMessage(conn->streamConn))))); + (errmsg("could not send end-of-streaming message to primary: %s", + pchomp(PQerrorMessage(conn->streamConn))))); *next_tli = 0; @@ -591,13 +591,19 @@ libpqrcv_PQexec(PGconn *streamConn, const char *query) ResetLatch(MyLatch); CHECK_FOR_INTERRUPTS(); } + + /* Consume whatever data is available from the socket */ if (PQconsumeInput(streamConn) == 0) - return NULL; /* trouble */ + { + /* trouble; drop whatever we had and return NULL */ + PQclear(lastResult); + return NULL; + } } /* - * Emulate the PQexec()'s behavior of returning the last result when - * there are many. We are fine with returning just last error message. + * Emulate PQexec()'s behavior of returning the last result when there + * are many. We are fine with returning just last error message. */ result = PQgetResult(streamConn); if (result == NULL) @@ -791,7 +797,7 @@ libpqrcv_create_slot(WalReceiverConn *conn, const char *slotname, } *lsn = DatumGetLSN(DirectFunctionCall1Coll(pg_lsn_in, InvalidOid, - CStringGetDatum(PQgetvalue(res, 0, 1)))); + CStringGetDatum(PQgetvalue(res, 0, 1)))); if (!PQgetisnull(res, 0, 2)) snapshot = pstrdup(PQgetvalue(res, 0, 2)); else @@ -890,7 +896,7 @@ libpqrcv_exec(WalReceiverConn *conn, const char *query, if (MyDatabaseId == InvalidOid) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("the query interface requires a database connection"))); + errmsg("the query interface requires a database connection"))); pgres = libpqrcv_PQexec(conn->streamConn, query); diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c index 4ed34f64d7..18481432a2 100644 --- a/src/backend/replication/logical/decode.c +++ b/src/backend/replication/logical/decode.c @@ -336,7 +336,7 @@ DecodeStandbyOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf) (xl_invalidations *) XLogRecGetData(r); ReorderBufferImmediateInvalidation( - ctx->reorder, invalidations->nmsgs, invalidations->msgs); + ctx->reorder, invalidations->nmsgs, invalidations->msgs); } break; default: diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c index 15dac00ffa..86a2b14807 100644 --- a/src/backend/replication/logical/launcher.c +++ b/src/backend/replication/logical/launcher.c @@ -265,8 +265,8 @@ logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname, Oid userid, TimestampTz now; ereport(DEBUG1, - (errmsg("starting logical replication worker for subscription \"%s\"", - subname))); + (errmsg("starting logical replication worker for subscription \"%s\"", + subname))); /* Report this after the initial starting message for consistency. */ if (max_replication_slots == 0) @@ -399,7 +399,7 @@ retry: ereport(WARNING, (errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED), errmsg("out of background worker slots"), - errhint("You might need to increase max_worker_processes."))); + errhint("You might need to increase max_worker_processes."))); return; } @@ -556,8 +556,8 @@ logicalrep_worker_attach(int slot) LWLockRelease(LogicalRepWorkerLock); ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("logical replication worker slot %d is empty, cannot attach", - slot))); + errmsg("logical replication worker slot %d is empty, cannot attach", + slot))); } if (MyLogicalRepWorker->proc) @@ -565,8 +565,8 @@ logicalrep_worker_attach(int slot) LWLockRelease(LogicalRepWorkerLock); ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("logical replication worker slot %d is already used by " - "another worker, cannot attach", slot))); + errmsg("logical replication worker slot %d is already used by " + "another worker, cannot attach", slot))); } MyLogicalRepWorker->proc = MyProc; @@ -829,7 +829,7 @@ ApplyLauncherMain(Datum main_arg) { /* Use temporary context for the database list and worker info. */ subctx = AllocSetContextCreate(TopMemoryContext, - "Logical Replication Launcher sublist", + "Logical Replication Launcher sublist", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c index 33cb01b8d0..85721ead3e 100644 --- a/src/backend/replication/logical/logical.c +++ b/src/backend/replication/logical/logical.c @@ -64,7 +64,7 @@ static void change_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change); static void message_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, XLogRecPtr message_lsn, bool transactional, - const char *prefix, Size message_size, const char *message); + const char *prefix, Size message_size, const char *message); static void LoadOutputPlugin(OutputPluginCallbacks *callbacks, char *plugin); @@ -103,7 +103,7 @@ CheckLogicalDecodingRequirements(void) if (RecoveryInProgress()) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("logical decoding cannot be used while in recovery"))); + errmsg("logical decoding cannot be used while in recovery"))); } /* @@ -118,7 +118,7 @@ StartupDecodingContext(List *output_plugin_options, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, - LogicalOutputPluginWriterUpdateProgress update_progress) + LogicalOutputPluginWriterUpdateProgress update_progress) { ReplicationSlot *slot; MemoryContext context, @@ -219,7 +219,7 @@ CreateInitDecodingContext(char *plugin, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, - LogicalOutputPluginWriterUpdateProgress update_progress) + LogicalOutputPluginWriterUpdateProgress update_progress) { TransactionId xmin_horizon = InvalidTransactionId; ReplicationSlot *slot; @@ -240,13 +240,13 @@ CreateInitDecodingContext(char *plugin, if (SlotIsPhysical(slot)) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("cannot use physical replication slot for logical decoding"))); + errmsg("cannot use physical replication slot for logical decoding"))); if (slot->data.database != MyDatabaseId) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("replication slot \"%s\" was not created in this database", - NameStr(slot->data.name)))); + errmsg("replication slot \"%s\" was not created in this database", + NameStr(slot->data.name)))); if (IsTransactionState() && GetTopTransactionIdIfAny() != InvalidTransactionId) @@ -367,8 +367,8 @@ CreateDecodingContext(XLogRecPtr start_lsn, if (slot->data.database != MyDatabaseId) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - (errmsg("replication slot \"%s\" was not created in this database", - NameStr(slot->data.name))))); + (errmsg("replication slot \"%s\" was not created in this database", + NameStr(slot->data.name))))); if (start_lsn == InvalidXLogRecPtr) { @@ -451,7 +451,7 @@ DecodingContextFindStartpoint(LogicalDecodingContext *ctx) if (err) elog(ERROR, "%s", err); if (!record) - elog(ERROR, "no record found"); /* shouldn't happen */ + elog(ERROR, "no record found"); /* shouldn't happen */ startptr = InvalidXLogRecPtr; @@ -661,7 +661,7 @@ commit_cb_wrapper(ReorderBuffer *cache, ReorderBufferTXN *txn, /* Push callback + info on the error context stack */ state.ctx = ctx; state.callback_name = "commit"; - state.report_location = txn->final_lsn; /* beginning of commit record */ + state.report_location = txn->final_lsn; /* beginning of commit record */ errcallback.callback = output_plugin_error_callback; errcallback.arg = (void *) &state; errcallback.previous = error_context_stack; diff --git a/src/backend/replication/logical/logicalfuncs.c b/src/backend/replication/logical/logicalfuncs.c index 8eade48e4f..0831e7fc86 100644 --- a/src/backend/replication/logical/logicalfuncs.c +++ b/src/backend/replication/logical/logicalfuncs.c @@ -98,7 +98,7 @@ LogicalOutputWrite(LogicalDecodingContext *ctx, XLogRecPtr lsn, TransactionId xi /* ick, but cstring_to_text_with_len works for bytea perfectly fine */ values[2] = PointerGetDatum( - cstring_to_text_with_len(ctx->out->data, ctx->out->len)); + cstring_to_text_with_len(ctx->out->data, ctx->out->len)); tuplestore_putvalues(p->tupstore, p->tupdesc, values, nulls); p->returned_rows++; @@ -115,7 +115,7 @@ check_permissions(void) int logical_read_local_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, - int reqLen, XLogRecPtr targetRecPtr, char *cur_page, TimeLineID *pageTLI) + int reqLen, XLogRecPtr targetRecPtr, char *cur_page, TimeLineID *pageTLI) { return read_local_xlog_page(state, targetPagePtr, reqLen, targetRecPtr, cur_page, pageTLI); diff --git a/src/backend/replication/logical/origin.c b/src/backend/replication/logical/origin.c index 09206f29a0..1c665312a4 100644 --- a/src/backend/replication/logical/origin.c +++ b/src/backend/replication/logical/origin.c @@ -147,7 +147,7 @@ typedef struct ReplicationStateCtl } ReplicationStateCtl; /* external variables */ -RepOriginId replorigin_session_origin = InvalidRepOriginId; /* assumed identity */ +RepOriginId replorigin_session_origin = InvalidRepOriginId; /* assumed identity */ XLogRecPtr replorigin_session_origin_lsn = InvalidXLogRecPtr; TimestampTz replorigin_session_origin_timestamp = 0; @@ -187,7 +187,7 @@ replorigin_check_prerequisites(bool check_slots, bool recoveryOK) if (!recoveryOK && RecoveryInProgress()) ereport(ERROR, (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION), - errmsg("cannot manipulate replication origins during recovery"))); + errmsg("cannot manipulate replication origins during recovery"))); } @@ -449,7 +449,7 @@ ReplicationOriginShmemSize(void) size = add_size(size, offsetof(ReplicationStateCtl, states)); size = add_size(size, - mul_size(max_replication_slots, sizeof(ReplicationState))); + mul_size(max_replication_slots, sizeof(ReplicationState))); return size; } @@ -664,8 +664,8 @@ StartupReplicationOrigin(void) if (magic != REPLICATION_STATE_MAGIC) ereport(PANIC, - (errmsg("replication checkpoint has wrong magic %u instead of %u", - magic, REPLICATION_STATE_MAGIC))); + (errmsg("replication checkpoint has wrong magic %u instead of %u", + magic, REPLICATION_STATE_MAGIC))); /* we can skip locking here, no other access is possible */ @@ -997,7 +997,7 @@ replorigin_session_setup(RepOriginId node) if (session_replication_state != NULL) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("cannot setup replication origin when one is already setup"))); + errmsg("cannot setup replication origin when one is already setup"))); /* Lock exclusively, as we may have to create a new table entry. */ LWLockAcquire(ReplicationOriginLock, LW_EXCLUSIVE); @@ -1026,8 +1026,8 @@ replorigin_session_setup(RepOriginId node) { ereport(ERROR, (errcode(ERRCODE_OBJECT_IN_USE), - errmsg("replication identifier %d is already active for PID %d", - curstate->roident, curstate->acquired_by))); + errmsg("replication identifier %d is already active for PID %d", + curstate->roident, curstate->acquired_by))); } /* ok, found slot */ diff --git a/src/backend/replication/logical/proto.c b/src/backend/replication/logical/proto.c index ff348ff2a8..e3230e1fa2 100644 --- a/src/backend/replication/logical/proto.c +++ b/src/backend/replication/logical/proto.c @@ -194,9 +194,9 @@ logicalrep_write_update(StringInfo out, Relation rel, HeapTuple oldtuple, if (oldtuple != NULL) { if (rel->rd_rel->relreplident == REPLICA_IDENTITY_FULL) - pq_sendbyte(out, 'O'); /* old tuple follows */ + pq_sendbyte(out, 'O'); /* old tuple follows */ else - pq_sendbyte(out, 'K'); /* old key follows */ + pq_sendbyte(out, 'K'); /* old key follows */ logicalrep_write_tuple(out, rel, oldtuple); } @@ -424,12 +424,12 @@ logicalrep_write_tuple(StringInfo out, Relation rel, HeapTuple tuple) if (isnull[i]) { - pq_sendbyte(out, 'n'); /* null column */ + pq_sendbyte(out, 'n'); /* null column */ continue; } else if (att->attlen == -1 && VARATT_IS_EXTERNAL_ONDISK(values[i])) { - pq_sendbyte(out, 'u'); /* unchanged toast column */ + pq_sendbyte(out, 'u'); /* unchanged toast column */ continue; } diff --git a/src/backend/replication/logical/relation.c b/src/backend/replication/logical/relation.c index 2bd1d9f792..7779857456 100644 --- a/src/backend/replication/logical/relation.c +++ b/src/backend/replication/logical/relation.c @@ -283,7 +283,7 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode) continue; attnum = logicalrep_rel_att_by_name(remoterel, - NameStr(desc->attrs[i]->attname)); + NameStr(desc->attrs[i]->attname)); entry->attrmap[i] = attnum; if (attnum >= 0) @@ -294,9 +294,9 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode) if (found < remoterel->natts) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("logical replication target relation \"%s.%s\" is missing " - "some replicated columns", - remoterel->nspname, remoterel->relname))); + errmsg("logical replication target relation \"%s.%s\" is missing " + "some replicated columns", + remoterel->nspname, remoterel->relname))); /* * Check that replica identity matches. We allow for stricter replica @@ -334,9 +334,9 @@ logicalrep_rel_open(LogicalRepRelId remoteid, LOCKMODE lockmode) if (!AttrNumberIsForUserDefinedAttr(attnum)) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("logical replication target relation \"%s.%s\" uses " - "system columns in REPLICA IDENTITY index", - remoterel->nspname, remoterel->relname))); + errmsg("logical replication target relation \"%s.%s\" uses " + "system columns in REPLICA IDENTITY index", + remoterel->nspname, remoterel->relname))); attnum = AttrNumberGetAttrOffset(attnum); diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 524946a2a2..5567bee061 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -62,7 +62,7 @@ #include "replication/logical.h" #include "replication/reorderbuffer.h" #include "replication/slot.h" -#include "replication/snapbuild.h" /* just for SnapBuildSnapDecRefcount */ +#include "replication/snapbuild.h" /* just for SnapBuildSnapDecRefcount */ #include "storage/bufmgr.h" #include "storage/fd.h" #include "storage/sinval.h" @@ -124,8 +124,8 @@ typedef struct ReorderBufferToastEnt Size num_chunks; /* number of chunks we've already seen */ Size size; /* combined size of chunks seen */ dlist_head chunks; /* linked list of chunks */ - struct varlena *reconstructed; /* reconstructed varlena now pointed - * to in main tup */ + struct varlena *reconstructed; /* reconstructed varlena now pointed to in + * main tup */ } ReorderBufferToastEnt; /* Disk serialization support datastructures */ @@ -157,7 +157,7 @@ static const Size max_changes_in_memory = 4096; * major bottleneck, especially when spilling to disk while decoding batch * workloads. */ -static const Size max_cached_tuplebufs = 4096 * 2; /* ~8MB */ +static const Size max_cached_tuplebufs = 4096 * 2; /* ~8MB */ /* --------------------------------------- * primary reorderbuffer support routines @@ -180,8 +180,7 @@ static void AssertTXNLsnOrder(ReorderBuffer *rb); * --------------------------------------- */ static ReorderBufferIterTXNState *ReorderBufferIterTXNInit(ReorderBuffer *rb, ReorderBufferTXN *txn); -static ReorderBufferChange * - ReorderBufferIterTXNNext(ReorderBuffer *rb, ReorderBufferIterTXNState *state); +static ReorderBufferChange *ReorderBufferIterTXNNext(ReorderBuffer *rb, ReorderBufferIterTXNState *state); static void ReorderBufferIterTXNFinish(ReorderBuffer *rb, ReorderBufferIterTXNState *state); static void ReorderBufferExecuteInvalidations(ReorderBuffer *rb, ReorderBufferTXN *txn); @@ -893,7 +892,7 @@ ReorderBufferIterTXNInit(ReorderBuffer *rb, ReorderBufferTXN *txn) { ReorderBufferChange *cur_change; - if (txn->nentries != txn->nentries_mem) + if (txn->serialized) { /* serialize remaining changes */ ReorderBufferSerializeTXN(rb, txn); @@ -922,7 +921,7 @@ ReorderBufferIterTXNInit(ReorderBuffer *rb, ReorderBufferTXN *txn) { ReorderBufferChange *cur_change; - if (cur_txn->nentries != cur_txn->nentries_mem) + if (cur_txn->serialized) { /* serialize remaining changes */ ReorderBufferSerializeTXN(rb, cur_txn); @@ -1142,7 +1141,7 @@ ReorderBufferCleanupTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) Assert(found); /* remove entries spilled to disk */ - if (txn->nentries != txn->nentries_mem) + if (txn->serialized) ReorderBufferRestoreCleanup(rb, txn); /* deallocate */ @@ -1404,7 +1403,7 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid, Assert(snapshot_now); reloid = RelidByRelfilenode(change->data.tp.relnode.spcNode, - change->data.tp.relnode.relNode); + change->data.tp.relnode.relNode); /* * Catalog tuple without data, emitted while catalog was @@ -1566,7 +1565,7 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid, { /* we don't use the global one anymore */ snapshot_now = ReorderBufferCopySnap(rb, snapshot_now, - txn, command_id); + txn, command_id); } snapshot_now->curcid = command_id; @@ -2124,6 +2123,7 @@ ReorderBufferSerializeTXN(ReorderBuffer *rb, ReorderBufferTXN *txn) Assert(spilled == txn->nentries_mem); Assert(dlist_is_empty(&txn->changes)); txn->nentries_mem = 0; + txn->serialized = true; if (fd != -1) CloseTransientFile(fd); @@ -2384,7 +2384,7 @@ ReorderBufferRestoreChanges(ReorderBuffer *rb, ReorderBufferTXN *txn, else if (readBytes < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not read from reorderbuffer spill file: %m"))); + errmsg("could not read from reorderbuffer spill file: %m"))); else if (readBytes != sizeof(ReorderBufferDiskChange)) ereport(ERROR, (errcode_for_file_access(), @@ -2395,7 +2395,7 @@ ReorderBufferRestoreChanges(ReorderBuffer *rb, ReorderBufferTXN *txn, ondisk = (ReorderBufferDiskChange *) rb->outbuf; ReorderBufferSerializeReserve(rb, - sizeof(ReorderBufferDiskChange) + ondisk->size); + sizeof(ReorderBufferDiskChange) + ondisk->size); ondisk = (ReorderBufferDiskChange *) rb->outbuf; pgstat_report_wait_start(WAIT_EVENT_REORDER_BUFFER_READ); @@ -2406,13 +2406,13 @@ ReorderBufferRestoreChanges(ReorderBuffer *rb, ReorderBufferTXN *txn, if (readBytes < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not read from reorderbuffer spill file: %m"))); + errmsg("could not read from reorderbuffer spill file: %m"))); else if (readBytes != ondisk->size - sizeof(ReorderBufferDiskChange)) ereport(ERROR, (errcode_for_file_access(), errmsg("could not read from reorderbuffer spill file: read %d instead of %u bytes", readBytes, - (uint32) (ondisk->size - sizeof(ReorderBufferDiskChange))))); + (uint32) (ondisk->size - sizeof(ReorderBufferDiskChange))))); /* * ok, read a full change from disk, now restore it into proper @@ -2521,7 +2521,7 @@ ReorderBufferRestoreChange(ReorderBuffer *rb, ReorderBufferTXN *txn, memcpy(&change->data.msg.message_size, data, sizeof(Size)); data += sizeof(Size); change->data.msg.message = MemoryContextAlloc(rb->context, - change->data.msg.message_size); + change->data.msg.message_size); memcpy(change->data.msg.message, data, change->data.msg.message_size); data += change->data.msg.message_size; @@ -2867,7 +2867,7 @@ ReorderBufferToastReplace(ReorderBuffer *rb, ReorderBufferTXN *txn, cchange = dlist_container(ReorderBufferChange, node, it.cur); ctup = cchange->data.tp.newtuple; chunk = DatumGetPointer( - fastgetattr(&ctup->tuple, 3, toast_desc, &isnull)); + fastgetattr(&ctup->tuple, 3, toast_desc, &isnull)); Assert(!isnull); Assert(!VARATT_IS_EXTERNAL(chunk)); diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index e06aa0992a..281b7ab869 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -210,7 +210,7 @@ struct SnapBuild TransactionId was_xmax; size_t was_xcnt; /* number of used xip entries */ - size_t was_xcnt_space; /* allocated size of xip */ + size_t was_xcnt_space; /* allocated size of xip */ TransactionId *was_xip; /* running xacts array, xidComparator-sorted */ } was_running; @@ -336,7 +336,7 @@ AllocateSnapshotBuilder(ReorderBuffer *reorder, /* Other struct members initialized by zeroing via palloc0 above */ builder->committed.xcnt = 0; - builder->committed.xcnt_space = 128; /* arbitrary number */ + builder->committed.xcnt_space = 128; /* arbitrary number */ builder->committed.xip = palloc0(builder->committed.xcnt_space * sizeof(TransactionId)); builder->committed.includes_all_transactions = true; @@ -662,7 +662,7 @@ SnapBuildExportSnapshot(SnapBuild *builder) ereport(LOG, (errmsg_plural("exported logical decoding snapshot: \"%s\" with %u transaction ID", - "exported logical decoding snapshot: \"%s\" with %u transaction IDs", + "exported logical decoding snapshot: \"%s\" with %u transaction IDs", snap->xcnt, snapname, snap->xcnt))); return snapname; @@ -866,7 +866,7 @@ SnapBuildAddCommittedTxn(SnapBuild *builder, TransactionId xid) (uint32) builder->committed.xcnt_space); builder->committed.xip = repalloc(builder->committed.xip, - builder->committed.xcnt_space * sizeof(TransactionId)); + builder->committed.xcnt_space * sizeof(TransactionId)); } /* @@ -1169,10 +1169,10 @@ SnapBuildProcessRunningXacts(SnapBuild *builder, XLogRecPtr lsn, xl_running_xact * we have one. */ else if (txn == NULL && - builder->reorder->current_restart_decoding_lsn != InvalidXLogRecPtr && + builder->reorder->current_restart_decoding_lsn != InvalidXLogRecPtr && builder->last_serialized_snapshot != InvalidXLogRecPtr) LogicalIncreaseRestartDecodingForSlot(lsn, - builder->last_serialized_snapshot); + builder->last_serialized_snapshot); } @@ -1222,8 +1222,8 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn ereport(DEBUG1, (errmsg_internal("skipping snapshot at %X/%X while building logical decoding snapshot, xmin horizon too low", (uint32) (lsn >> 32), (uint32) lsn), - errdetail_internal("initial xmin horizon of %u vs the snapshot's %u", - builder->initial_xmin_horizon, running->oldestRunningXid))); + errdetail_internal("initial xmin horizon of %u vs the snapshot's %u", + builder->initial_xmin_horizon, running->oldestRunningXid))); SnapBuildWaitSnapshot(running, builder->initial_xmin_horizon); @@ -1248,8 +1248,8 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn builder->start_decoding_at = lsn + 1; /* As no transactions were running xmin/xmax can be trivially set. */ - builder->xmin = running->nextXid; /* < are finished */ - builder->xmax = running->nextXid; /* >= are running */ + builder->xmin = running->nextXid; /* < are finished */ + builder->xmax = running->nextXid; /* >= are running */ /* so we can safely use the faster comparisons */ Assert(TransactionIdIsNormal(builder->xmin)); @@ -1295,18 +1295,18 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn * currently running transactions have finished. We'll update both * while waiting for the pending transactions to finish. */ - builder->xmin = running->nextXid; /* < are finished */ - builder->xmax = running->nextXid; /* >= are running */ + builder->xmin = running->nextXid; /* < are finished */ + builder->xmax = running->nextXid; /* >= are running */ /* so we can safely use the faster comparisons */ Assert(TransactionIdIsNormal(builder->xmin)); Assert(TransactionIdIsNormal(builder->xmax)); ereport(LOG, - (errmsg("logical decoding found initial starting point at %X/%X", - (uint32) (lsn >> 32), (uint32) lsn), - errdetail("Waiting for transactions (approximately %d) older than %u to end.", - running->xcnt, running->nextXid))); + (errmsg("logical decoding found initial starting point at %X/%X", + (uint32) (lsn >> 32), (uint32) lsn), + errdetail("Waiting for transactions (approximately %d) older than %u to end.", + running->xcnt, running->nextXid))); SnapBuildWaitSnapshot(running, running->nextXid); } @@ -1327,10 +1327,10 @@ SnapBuildFindSnapshot(SnapBuild *builder, XLogRecPtr lsn, xl_running_xacts *runn SnapBuildStartNextPhaseAt(builder, running->nextXid); ereport(LOG, - (errmsg("logical decoding found initial consistent point at %X/%X", - (uint32) (lsn >> 32), (uint32) lsn), - errdetail("Waiting for transactions (approximately %d) older than %u to end.", - running->xcnt, running->nextXid))); + (errmsg("logical decoding found initial consistent point at %X/%X", + (uint32) (lsn >> 32), (uint32) lsn), + errdetail("Waiting for transactions (approximately %d) older than %u to end.", + running->xcnt, running->nextXid))); SnapBuildWaitSnapshot(running, running->nextXid); } @@ -1570,7 +1570,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn) INIT_CRC32C(ondisk->checksum); COMP_CRC32C(ondisk->checksum, ((char *) ondisk) + SnapBuildOnDiskNotChecksummedSize, - SnapBuildOnDiskConstantSize - SnapBuildOnDiskNotChecksummedSize); + SnapBuildOnDiskConstantSize - SnapBuildOnDiskNotChecksummedSize); ondisk_c += sizeof(SnapBuildOnDisk); memcpy(&ondisk->builder, builder, sizeof(SnapBuild)); @@ -1729,7 +1729,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn) INIT_CRC32C(checksum); COMP_CRC32C(checksum, ((char *) &ondisk) + SnapBuildOnDiskNotChecksummedSize, - SnapBuildOnDiskConstantSize - SnapBuildOnDiskNotChecksummedSize); + SnapBuildOnDiskConstantSize - SnapBuildOnDiskNotChecksummedSize); /* read SnapBuild */ pgstat_report_wait_start(WAIT_EVENT_SNAPBUILD_READ); diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index 3ff08bfb2b..3ef12dfd26 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -186,7 +186,7 @@ wait_for_relation_state_change(Oid relid, char expected_state) /* Check if the opposite worker is still running and bail if not. */ worker = logicalrep_worker_find(MyLogicalRepWorker->subid, - am_tablesync_worker() ? InvalidOid : relid, + am_tablesync_worker() ? InvalidOid : relid, false); LWLockRelease(LogicalRepWorkerLock); if (!worker) @@ -682,7 +682,7 @@ fetch_remote_table_info(char *nspname, char *relname, " a.attnum = ANY(i.indkey)" " FROM pg_catalog.pg_attribute a" " LEFT JOIN pg_catalog.pg_index i" - " ON (i.indexrelid = pg_get_replica_identity_index(%u))" + " ON (i.indexrelid = pg_get_replica_identity_index(%u))" " WHERE a.attnum > 0::pg_catalog.int2" " AND NOT a.attisdropped" " AND a.attrelid = %u" @@ -812,7 +812,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) * NAMEDATALEN on the remote that matters, but this scheme will also work * reasonably if that is different.) */ - StaticAssertStmt(NAMEDATALEN >= 32, "NAMEDATALEN too small"); /* for sanity */ + StaticAssertStmt(NAMEDATALEN >= 32, "NAMEDATALEN too small"); /* for sanity */ slotname = psprintf("%.*s_%u_sync_%u", NAMEDATALEN - 28, MySubscription->slotname, diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 97d2dff0dd..898c497d12 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -157,12 +157,15 @@ ensure_transaction(void) { if (IsTransactionState()) { + SetCurrentStatementStartTimestamp(); + if (CurrentMemoryContext != ApplyMessageContext) MemoryContextSwitchTo(ApplyMessageContext); return false; } + SetCurrentStatementStartTimestamp(); StartTransactionCommand(); maybe_reread_subscription(); @@ -625,7 +628,7 @@ check_relation_updatable(LogicalRepRelMapEntry *rel) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("publisher does not send replica identity column " - "expected by the logical replication target relation \"%s.%s\"", + "expected by the logical replication target relation \"%s.%s\"", rel->remoterel.nspname, rel->remoterel.relname))); } @@ -905,7 +908,7 @@ apply_dispatch(StringInfo s) default: ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid logical replication message type %c", action))); + errmsg("invalid logical replication message type %c", action))); } } @@ -1204,7 +1207,7 @@ LogicalRepApplyLoop(XLogRecPtr last_received) if (!ping_sent) { timeout = TimestampTzPlusMilliseconds(last_recv_timestamp, - (wal_receiver_timeout / 2)); + (wal_receiver_timeout / 2)); if (now >= timeout) { requestReply = true; @@ -1287,9 +1290,9 @@ send_feedback(XLogRecPtr recvpos, bool force, bool requestReply) resetStringInfo(reply_message); pq_sendbyte(reply_message, 'r'); - pq_sendint64(reply_message, recvpos); /* write */ - pq_sendint64(reply_message, flushpos); /* flush */ - pq_sendint64(reply_message, writepos); /* apply */ + pq_sendint64(reply_message, recvpos); /* write */ + pq_sendint64(reply_message, flushpos); /* flush */ + pq_sendint64(reply_message, writepos); /* apply */ pq_sendint64(reply_message, now); /* sendTime */ pq_sendbyte(reply_message, requestReply); /* replyRequested */ @@ -1372,7 +1375,7 @@ maybe_reread_subscription(void) { ereport(LOG, (errmsg("logical replication apply worker for subscription \"%s\" will " - "restart because the connection information was changed", + "restart because the connection information was changed", MySubscription->name))); proc_exit(0); @@ -1403,7 +1406,7 @@ maybe_reread_subscription(void) { ereport(LOG, (errmsg("logical replication apply worker for subscription \"%s\" will " - "restart because the replication slot name was changed", + "restart because the replication slot name was changed", MySubscription->name))); proc_exit(0); @@ -1417,7 +1420,7 @@ maybe_reread_subscription(void) { ereport(LOG, (errmsg("logical replication apply worker for subscription \"%s\" will " - "restart because subscription's publications were changed", + "restart because subscription's publications were changed", MySubscription->name))); proc_exit(0); @@ -1525,7 +1528,7 @@ ApplyWorkerMain(Datum main_arg) { ereport(LOG, (errmsg("logical replication apply worker for subscription \"%s\" will not " - "start because the subscription was disabled during startup", + "start because the subscription was disabled during startup", MySubscription->name))); proc_exit(0); @@ -1539,7 +1542,7 @@ ApplyWorkerMain(Datum main_arg) if (am_tablesync_worker()) ereport(LOG, (errmsg("logical replication table synchronization worker for subscription \"%s\", table \"%s\" has started", - MySubscription->name, get_rel_name(MyLogicalRepWorker->relid)))); + MySubscription->name, get_rel_name(MyLogicalRepWorker->relid)))); else ereport(LOG, (errmsg("logical replication apply worker for subscription \"%s\" has started", diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 5bdfa60ae7..4a5628888a 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -150,7 +150,7 @@ pgoutput_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, /* Create our memory context for private allocations. */ data->context = AllocSetContextCreate(ctx->context, - "logical replication output context", + "logical replication output context", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); @@ -177,13 +177,13 @@ pgoutput_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("client sent proto_version=%d but we only support protocol %d or lower", - data->protocol_version, LOGICALREP_PROTO_VERSION_NUM))); + data->protocol_version, LOGICALREP_PROTO_VERSION_NUM))); if (data->protocol_version < LOGICALREP_PROTO_MIN_VERSION_NUM) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("client sent proto_version=%d but we only support protocol %d or higher", - data->protocol_version, LOGICALREP_PROTO_MIN_VERSION_NUM))); + data->protocol_version, LOGICALREP_PROTO_MIN_VERSION_NUM))); if (list_length(data->publication_names) < 1) ereport(ERROR, diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index c0f7fbb2b2..dc7de20e11 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -86,7 +86,7 @@ typedef struct ReplicationSlotOnDisk #define ReplicationSlotOnDiskV2Size \ sizeof(ReplicationSlotOnDisk) - ReplicationSlotOnDiskConstantSize -#define SLOT_MAGIC 0x1051CA1 /* format identifier */ +#define SLOT_MAGIC 0x1051CA1 /* format identifier */ #define SLOT_VERSION 2 /* version for new files */ /* Control array for replication slot management */ @@ -200,8 +200,8 @@ ReplicationSlotValidateName(const char *name, int elevel) { ereport(elevel, (errcode(ERRCODE_INVALID_NAME), - errmsg("replication slot name \"%s\" contains invalid character", - name), + errmsg("replication slot name \"%s\" contains invalid character", + name), errhint("Replication slot names may only contain lower case letters, numbers, and the underscore character."))); return false; } @@ -1352,15 +1352,15 @@ RestoreSlotFromDisk(const char *name) if (cp.version != SLOT_VERSION) ereport(PANIC, (errcode_for_file_access(), - errmsg("replication slot file \"%s\" has unsupported version %u", - path, cp.version))); + errmsg("replication slot file \"%s\" has unsupported version %u", + path, cp.version))); /* boundary check on length */ if (cp.length != ReplicationSlotOnDiskV2Size) ereport(PANIC, (errcode_for_file_access(), - errmsg("replication slot file \"%s\" has corrupted length %u", - path, cp.length))); + errmsg("replication slot file \"%s\" has corrupted length %u", + path, cp.length))); /* Now that we know the size, read the entire file */ pgstat_report_wait_start(WAIT_EVENT_REPLICATION_SLOT_READ); diff --git a/src/backend/replication/slotfuncs.c b/src/backend/replication/slotfuncs.c index bbd26f3d6a..6dc808874d 100644 --- a/src/backend/replication/slotfuncs.c +++ b/src/backend/replication/slotfuncs.c @@ -132,7 +132,7 @@ pg_create_logical_replication_slot(PG_FUNCTION_ARGS) * Create logical decoding context, to build the initial snapshot. */ ctx = CreateInitDecodingContext(NameStr(*plugin), NIL, - false, /* do not build snapshot */ + false, /* do not build snapshot */ logical_read_local_xlog_page, NULL, NULL, NULL); diff --git a/src/backend/replication/syncrep.c b/src/backend/replication/syncrep.c index 11688603e4..8211ceda20 100644 --- a/src/backend/replication/syncrep.c +++ b/src/backend/replication/syncrep.c @@ -400,8 +400,8 @@ SyncRepInitConfig(void) MyWalSnd->sync_standby_priority = priority; LWLockRelease(SyncRepLock); ereport(DEBUG1, - (errmsg("standby \"%s\" now has synchronous standby priority %u", - application_name, priority))); + (errmsg("standby \"%s\" now has synchronous standby priority %u", + application_name, priority))); } } @@ -462,7 +462,7 @@ SyncRepReleaseWaiters(void) if (SyncRepConfig->syncrep_method == SYNC_REP_PRIORITY) ereport(LOG, (errmsg("standby \"%s\" is now a synchronous standby with priority %u", - application_name, MyWalSnd->sync_standby_priority))); + application_name, MyWalSnd->sync_standby_priority))); else ereport(LOG, (errmsg("standby \"%s\" is now a candidate for quorum synchronous standby", @@ -613,7 +613,7 @@ SyncRepGetOldestSyncRecPtr(XLogRecPtr *writePtr, XLogRecPtr *flushPtr, */ static void SyncRepGetNthLatestSyncRecPtr(XLogRecPtr *writePtr, XLogRecPtr *flushPtr, - XLogRecPtr *applyPtr, List *sync_standbys, uint8 nth) + XLogRecPtr *applyPtr, List *sync_standbys, uint8 nth) { ListCell *cell; XLogRecPtr *write_array; @@ -895,7 +895,7 @@ SyncRepGetSyncStandbysPriority(bool *am_sync) if (list_length(result) == SyncRepConfig->num_sync) { list_free(pending); - return result; /* Exit if got enough sync standbys */ + return result; /* Exit if got enough sync standbys */ } /* diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c index 2723612718..8a249e22b9 100644 --- a/src/backend/replication/walreceiver.c +++ b/src/backend/replication/walreceiver.c @@ -106,7 +106,7 @@ static struct { XLogRecPtr Write; /* last byte + 1 written out in the standby */ XLogRecPtr Flush; /* last byte + 1 flushed in the standby */ -} LogstreamResult; +} LogstreamResult; static StringInfoData reply_message; static StringInfoData incoming_message; @@ -259,8 +259,7 @@ WalReceiverMain(void) walrcv->latch = &MyProc->procLatch; /* Properly accept or ignore signals the postmaster might send us */ - pqsignal(SIGHUP, WalRcvSigHupHandler); /* set flag to read config - * file */ + pqsignal(SIGHUP, WalRcvSigHupHandler); /* set flag to read config file */ pqsignal(SIGINT, SIG_IGN); pqsignal(SIGTERM, WalRcvShutdownHandler); /* request shutdown */ pqsignal(SIGQUIT, WalRcvQuickDieHandler); /* hard crash time */ @@ -386,13 +385,13 @@ WalReceiverMain(void) if (first_stream) ereport(LOG, (errmsg("started streaming WAL from primary at %X/%X on timeline %u", - (uint32) (startpoint >> 32), (uint32) startpoint, + (uint32) (startpoint >> 32), (uint32) startpoint, startpointTLI))); else ereport(LOG, - (errmsg("restarted WAL streaming at %X/%X on timeline %u", - (uint32) (startpoint >> 32), (uint32) startpoint, - startpointTLI))); + (errmsg("restarted WAL streaming at %X/%X on timeline %u", + (uint32) (startpoint >> 32), (uint32) startpoint, + startpointTLI))); first_stream = false; /* Initialize LogstreamResult and buffers for processing messages */ @@ -494,7 +493,7 @@ WalReceiverMain(void) */ Assert(wait_fd != PGINVALID_SOCKET); rc = WaitLatchOrSocket(walrcv->latch, - WL_POSTMASTER_DEATH | WL_SOCKET_READABLE | + WL_POSTMASTER_DEATH | WL_SOCKET_READABLE | WL_TIMEOUT | WL_LATCH_SET, wait_fd, NAPTIME_PER_CYCLE, @@ -561,7 +560,7 @@ WalReceiverMain(void) if (!ping_sent) { timeout = TimestampTzPlusMilliseconds(last_recv_timestamp, - (wal_receiver_timeout / 2)); + (wal_receiver_timeout / 2)); if (now >= timeout) { requestReply = true; @@ -1003,9 +1002,9 @@ XLogWalRcvWrite(char *buf, Size nbytes, XLogRecPtr recptr) if (lseek(recvFile, (off_t) startoff, SEEK_SET) < 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not seek in log segment %s to offset %u: %m", - XLogFileNameP(recvFileTLI, recvSegNo), - startoff))); + errmsg("could not seek in log segment %s to offset %u: %m", + XLogFileNameP(recvFileTLI, recvSegNo), + startoff))); recvOff = startoff; } @@ -1475,5 +1474,5 @@ pg_stat_get_wal_receiver(PG_FUNCTION_ARGS) /* Returns the record as Datum */ PG_RETURN_DATUM(HeapTupleGetDatum( - heap_form_tuple(tupdesc, values, nulls))); + heap_form_tuple(tupdesc, values, nulls))); } diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 976a42f86d..f845180873 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -111,15 +111,16 @@ WalSndCtlData *WalSndCtl = NULL; WalSnd *MyWalSnd = NULL; /* Global state */ -bool am_walsender = false; /* Am I a walsender process? */ -bool am_cascading_walsender = false; /* Am I cascading WAL to - * another standby? */ +bool am_walsender = false; /* Am I a walsender process? */ +bool am_cascading_walsender = false; /* Am I cascading WAL to another + * standby? */ bool am_db_walsender = false; /* Connected to a database? */ /* User-settable parameters for walsender */ -int max_wal_senders = 0; /* the maximum number of concurrent walsenders */ -int wal_sender_timeout = 60 * 1000; /* maximum time to send one - * WAL data message */ +int max_wal_senders = 0; /* the maximum number of concurrent + * walsenders */ +int wal_sender_timeout = 60 * 1000; /* maximum time to send one WAL + * data message */ bool log_replication_commands = false; /* @@ -214,7 +215,7 @@ static struct int write_head; int read_heads[NUM_SYNC_REP_WAIT_MODE]; WalTimeSample last_read[NUM_SYNC_REP_WAIT_MODE]; -} LagTracker; +} LagTracker; /* Signal handlers */ static void WalSndLastCycleHandler(SIGNAL_ARGS); @@ -449,16 +450,16 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd) pq_sendstring(&buf, "filename"); /* col name */ pq_sendint(&buf, 0, 4); /* table oid */ pq_sendint(&buf, 0, 2); /* attnum */ - pq_sendint(&buf, TEXTOID, 4); /* type oid */ + pq_sendint(&buf, TEXTOID, 4); /* type oid */ pq_sendint(&buf, -1, 2); /* typlen */ pq_sendint(&buf, 0, 4); /* typmod */ pq_sendint(&buf, 0, 2); /* format code */ /* second field */ - pq_sendstring(&buf, "content"); /* col name */ + pq_sendstring(&buf, "content"); /* col name */ pq_sendint(&buf, 0, 4); /* table oid */ pq_sendint(&buf, 0, 2); /* attnum */ - pq_sendint(&buf, BYTEAOID, 4); /* type oid */ + pq_sendint(&buf, BYTEAOID, 4); /* type oid */ pq_sendint(&buf, -1, 2); /* typlen */ pq_sendint(&buf, 0, 4); /* typmod */ pq_sendint(&buf, 0, 2); /* format code */ @@ -486,7 +487,7 @@ SendTimeLineHistory(TimeLineHistoryCmd *cmd) if (lseek(fd, 0, SEEK_SET) != 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not seek to beginning of file \"%s\": %m", path))); + errmsg("could not seek to beginning of file \"%s\": %m", path))); pq_sendint(&buf, histfilelen, 4); /* col2 len */ @@ -527,7 +528,7 @@ StartReplication(StartReplicationCmd *cmd) if (ThisTimeLineID == 0) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("IDENTIFY_SYSTEM has not been run before START_REPLICATION"))); + errmsg("IDENTIFY_SYSTEM has not been run before START_REPLICATION"))); /* * We assume here that we're logging enough information in the WAL for @@ -749,7 +750,7 @@ StartReplication(StartReplicationCmd *cmd) */ static int logical_read_xlog_page(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen, - XLogRecPtr targetRecPtr, char *cur_page, TimeLineID *pageTLI) + XLogRecPtr targetRecPtr, char *cur_page, TimeLineID *pageTLI) { XLogRecPtr flushptr; int count; @@ -1747,7 +1748,7 @@ ProcessStandbyReplyMessage(void) writePtr = pq_getmsgint64(&reply_message); flushPtr = pq_getmsgint64(&reply_message); applyPtr = pq_getmsgint64(&reply_message); - (void) pq_getmsgint64(&reply_message); /* sendTime; not used ATM */ + (void) pq_getmsgint64(&reply_message); /* sendTime; not used ATM */ replyRequested = pq_getmsgbyte(&reply_message); elog(DEBUG2, "write %X/%X flush %X/%X apply %X/%X%s", @@ -1910,7 +1911,7 @@ ProcessStandbyHSFeedbackMessage(void) * byte. See XLogWalRcvSendHSFeedback() in walreceiver.c for the creation * of this message. */ - (void) pq_getmsgint64(&reply_message); /* sendTime; not used ATM */ + (void) pq_getmsgint64(&reply_message); /* sendTime; not used ATM */ feedbackXmin = pq_getmsgint(&reply_message, 4); feedbackEpoch = pq_getmsgint(&reply_message, 4); feedbackCatalogXmin = pq_getmsgint(&reply_message, 4); @@ -1977,7 +1978,7 @@ ProcessStandbyHSFeedbackMessage(void) * XXX: It might make sense to generalize the ephemeral slot concept and * always use the slot mechanism to handle the feedback xmin. */ - if (MyReplicationSlot != NULL) /* XXX: persistency configurable? */ + if (MyReplicationSlot != NULL) /* XXX: persistency configurable? */ PhysicalReplicationSlotNewXmin(feedbackXmin, feedbackCatalogXmin); else { @@ -1999,7 +2000,7 @@ ProcessStandbyHSFeedbackMessage(void) static long WalSndComputeSleeptime(TimestampTz now) { - long sleeptime = 10000; /* 10 s */ + long sleeptime = 10000; /* 10 s */ if (wal_sender_timeout > 0 && last_reply_timestamp > 0) { @@ -2058,7 +2059,7 @@ WalSndCheckTimeOut(TimestampTz now) * standby. */ ereport(COMMERROR, - (errmsg("terminating walsender process due to replication timeout"))); + (errmsg("terminating walsender process due to replication timeout"))); WalSndShutdown(); } @@ -2146,8 +2147,8 @@ WalSndLoop(WalSndSendDataCallback send_data) if (MyWalSnd->state == WALSNDSTATE_CATCHUP) { ereport(DEBUG1, - (errmsg("standby \"%s\" has now caught up with primary", - application_name))); + (errmsg("standby \"%s\" has now caught up with primary", + application_name))); WalSndSetState(WALSNDSTATE_STREAMING); } @@ -2371,7 +2372,7 @@ retry: ereport(ERROR, (errcode_for_file_access(), errmsg("requested WAL segment %s has already been removed", - XLogFileNameP(curFileTimeLine, sendSegNo)))); + XLogFileNameP(curFileTimeLine, sendSegNo)))); else ereport(ERROR, (errcode_for_file_access(), @@ -2387,9 +2388,9 @@ retry: if (lseek(sendFile, (off_t) startoff, SEEK_SET) < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not seek in log segment %s to offset %u: %m", - XLogFileNameP(curFileTimeLine, sendSegNo), - startoff))); + errmsg("could not seek in log segment %s to offset %u: %m", + XLogFileNameP(curFileTimeLine, sendSegNo), + startoff))); sendOff = startoff; } @@ -3442,6 +3443,16 @@ LagTrackerRead(int head, XLogRecPtr lsn, TimestampTz now) (LagTracker.read_heads[head] + 1) % LAG_TRACKER_BUFFER_SIZE; } + /* + * If the lag tracker is empty, that means the standby has processed + * everything we've ever sent so we should now clear 'last_read'. If we + * didn't do that, we'd risk using a stale and irrelevant sample for + * interpolation at the beginning of the next burst of WAL after a period + * of idleness. + */ + if (LagTracker.read_heads[head] == LagTracker.write_head) + LagTracker.last_read[head].time = 0; + if (time > now) { /* If the clock somehow went backwards, treat as not found. */ @@ -3458,9 +3469,14 @@ LagTrackerRead(int head, XLogRecPtr lsn, TimestampTz now) * eventually start moving again and cross one of our samples before * we can show the lag increasing. */ - if (LagTracker.read_heads[head] != LagTracker.write_head && - LagTracker.last_read[head].time != 0) + if (LagTracker.read_heads[head] == LagTracker.write_head) { + /* There are no future samples, so we can't interpolate. */ + return -1; + } + else if (LagTracker.last_read[head].time != 0) + { + /* We can interpolate between last_read and the next sample. */ double fraction; WalTimeSample prev = LagTracker.last_read[head]; WalTimeSample next = LagTracker.buffer[LagTracker.read_heads[head]]; @@ -3493,8 +3509,14 @@ LagTrackerRead(int head, XLogRecPtr lsn, TimestampTz now) } else { - /* Couldn't interpolate due to lack of data. */ - return -1; + /* + * We have only a future sample, implying that we were entirely + * caught up but and now there is a new burst of WAL and the + * standby hasn't processed the first sample yet. Until the + * standby reaches the future sample the best we can do is report + * the hypothetical lag if that sample were to be replayed now. + */ + time = LagTracker.buffer[LagTracker.read_heads[head]].time; } } diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c index fd3768de17..9e6865bef6 100644 --- a/src/backend/rewrite/rewriteDefine.c +++ b/src/backend/rewrite/rewriteDefine.c @@ -160,7 +160,7 @@ InsertRule(char *rulname, referenced.objectSubId = 0; recordDependencyOn(&myself, &referenced, - (evtype == CMD_SELECT) ? DEPENDENCY_INTERNAL : DEPENDENCY_AUTO); + (evtype == CMD_SELECT) ? DEPENDENCY_INTERNAL : DEPENDENCY_AUTO); /* * Also install dependencies on objects referenced in action and qual. @@ -312,7 +312,7 @@ DefineQueryRewrite(char *rulename, if (list_length(action) == 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("INSTEAD NOTHING rules on SELECT are not implemented"), + errmsg("INSTEAD NOTHING rules on SELECT are not implemented"), errhint("Use views instead."))); /* @@ -331,7 +331,7 @@ DefineQueryRewrite(char *rulename, query->commandType != CMD_SELECT) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("rules on SELECT must have action INSTEAD SELECT"))); + errmsg("rules on SELECT must have action INSTEAD SELECT"))); /* * ... it cannot contain data-modifying WITH ... @@ -373,9 +373,9 @@ DefineQueryRewrite(char *rulename, rule = event_relation->rd_rules->rules[i]; if (rule->event == CMD_SELECT) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("\"%s\" is already a view", - RelationGetRelationName(event_relation)))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("\"%s\" is already a view", + RelationGetRelationName(event_relation)))); } } @@ -425,8 +425,14 @@ DefineQueryRewrite(char *rulename, if (event_relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("could not convert partitioned table \"%s\" to a view", - RelationGetRelationName(event_relation)))); + errmsg("could not convert partitioned table \"%s\" to a view", + RelationGetRelationName(event_relation)))); + + if (event_relation->rd_rel->relispartition) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("could not convert partition \"%s\" to a view", + RelationGetRelationName(event_relation)))); snapshot = RegisterSnapshot(GetLatestSnapshot()); scanDesc = heap_beginscan(event_relation, snapshot, 0, NULL); @@ -493,7 +499,7 @@ DefineQueryRewrite(char *rulename, if (haveReturning) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot have multiple RETURNING lists in a rule"))); + errmsg("cannot have multiple RETURNING lists in a rule"))); haveReturning = true; if (event_qual != NULL) ereport(ERROR, @@ -667,7 +673,7 @@ checkRuleResultList(List *targetList, TupleDesc resultDesc, bool isSelect, ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), isSelect ? - errmsg("SELECT rule's target list has too many entries") : + errmsg("SELECT rule's target list has too many entries") : errmsg("RETURNING list has too many entries"))); attr = resultDesc->attrs[i - 1]; diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c index c5f6a93e80..33713bc37c 100644 --- a/src/backend/rewrite/rewriteHandler.c +++ b/src/backend/rewrite/rewriteHandler.c @@ -282,7 +282,7 @@ AcquireRewriteLocks(Query *parsetree, AcquireRewriteLocks(rte->subquery, forExecute, (forUpdatePushedDown || - get_parse_rowmark(parsetree, rt_index) != NULL)); + get_parse_rowmark(parsetree, rt_index) != NULL)); break; default: @@ -622,7 +622,7 @@ rewriteRuleAction(Query *parsetree, if (*returning_flag) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot have RETURNING lists in multiple rules"))); + errmsg("cannot have RETURNING lists in multiple rules"))); *returning_flag = true; rule_action->returningList = (List *) ReplaceVarsFromTargetList((Node *) parsetree->returningList, @@ -828,7 +828,7 @@ rewriteTargetListIU(List *targetList, * tlist entry is a DEFAULT placeholder node. */ apply_default = ((new_tle == NULL && commandType == CMD_INSERT) || - (new_tle && new_tle->expr && IsA(new_tle->expr, SetToDefault))); + (new_tle && new_tle->expr && IsA(new_tle->expr, SetToDefault))); if (commandType == CMD_INSERT) { @@ -840,7 +840,7 @@ rewriteTargetListIU(List *targetList, errmsg("cannot insert into column \"%s\"", NameStr(att_tup->attname)), errdetail("Column \"%s\" is an identity column defined as GENERATED ALWAYS.", NameStr(att_tup->attname)), - errhint("Use OVERRIDING SYSTEM VALUE to override."))); + errhint("Use OVERRIDING SYSTEM VALUE to override."))); } if (att_tup->attidentity == ATTRIBUTE_IDENTITY_BY_DEFAULT && override == OVERRIDING_USER_VALUE) @@ -1164,7 +1164,7 @@ build_column_default(Relation rel, int attrno) NameStr(att_tup->attname), format_type_be(atttype), format_type_be(exprtype)), - errhint("You will need to rewrite or cast the expression."))); + errhint("You will need to rewrite or cast the expression."))); return expr; } @@ -1552,7 +1552,7 @@ matchLocks(CmdType event, oneLock->enabled == RULE_DISABLED) continue; } - else /* ORIGIN or LOCAL ROLE */ + else /* ORIGIN or LOCAL ROLE */ { if (oneLock->enabled == RULE_FIRES_ON_REPLICA || oneLock->enabled == RULE_DISABLED) @@ -1853,7 +1853,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown) { rte->subquery = fireRIRrules(rte->subquery, activeRIRs, (forUpdatePushedDown || - get_parse_rowmark(parsetree, rt_index) != NULL)); + get_parse_rowmark(parsetree, rt_index) != NULL)); continue; } @@ -2054,7 +2054,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown) rte->securityQuals); parsetree->withCheckOptions = list_concat(withCheckOptions, - parsetree->withCheckOptions); + parsetree->withCheckOptions); } /* @@ -2228,7 +2228,7 @@ fireRules(Query *parsetree, returning_flag); rule_action->querySource = qsrc; - rule_action->canSetTag = false; /* might change later */ + rule_action->canSetTag = false; /* might change later */ results = lappend(results, rule_action); } @@ -2707,9 +2707,9 @@ relation_is_updatable(Oid reloid, updatable_cols = bms_int_members(updatable_cols, include_cols); if (bms_is_empty(updatable_cols)) - auto_events = (1 << CMD_DELETE); /* May support DELETE */ + auto_events = (1 << CMD_DELETE); /* May support DELETE */ else - auto_events = ALL_EVENTS; /* May support all events */ + auto_events = ALL_EVENTS; /* May support all events */ /* * The base relation must also support these update commands. @@ -2781,7 +2781,7 @@ adjust_view_column_set(Bitmapset *cols, List *targetlist) continue; var = castNode(Var, tle->expr); result = bms_add_member(result, - var->varattno - FirstLowInvalidHeapAttributeNumber); + var->varattno - FirstLowInvalidHeapAttributeNumber); } } else @@ -2798,7 +2798,7 @@ adjust_view_column_set(Bitmapset *cols, List *targetlist) Var *var = (Var *) tle->expr; result = bms_add_member(result, - var->varattno - FirstLowInvalidHeapAttributeNumber); + var->varattno - FirstLowInvalidHeapAttributeNumber); } else elog(ERROR, "attribute number %d not found in view targetlist", @@ -2902,7 +2902,7 @@ rewriteTargetView(Query *parsetree, Relation view) if (!tle->resjunk) modified_cols = bms_add_member(modified_cols, - tle->resno - FirstLowInvalidHeapAttributeNumber); + tle->resno - FirstLowInvalidHeapAttributeNumber); } if (parsetree->onConflict) @@ -2913,7 +2913,7 @@ rewriteTargetView(Query *parsetree, Relation view) if (!tle->resjunk) modified_cols = bms_add_member(modified_cols, - tle->resno - FirstLowInvalidHeapAttributeNumber); + tle->resno - FirstLowInvalidHeapAttributeNumber); } } @@ -2932,18 +2932,18 @@ rewriteTargetView(Query *parsetree, Relation view) case CMD_INSERT: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot insert into column \"%s\" of view \"%s\"", - non_updatable_col, - RelationGetRelationName(view)), - errdetail_internal("%s", _(auto_update_detail)))); + errmsg("cannot insert into column \"%s\" of view \"%s\"", + non_updatable_col, + RelationGetRelationName(view)), + errdetail_internal("%s", _(auto_update_detail)))); break; case CMD_UPDATE: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot update column \"%s\" of view \"%s\"", - non_updatable_col, - RelationGetRelationName(view)), - errdetail_internal("%s", _(auto_update_detail)))); + errmsg("cannot update column \"%s\" of view \"%s\"", + non_updatable_col, + RelationGetRelationName(view)), + errdetail_internal("%s", _(auto_update_detail)))); break; default: elog(ERROR, "unrecognized CmdType: %d", @@ -3435,10 +3435,10 @@ RewriteQuery(Query *parsetree, List *rewrite_events) /* Process the main targetlist ... */ parsetree->targetList = rewriteTargetListIU(parsetree->targetList, - parsetree->commandType, - parsetree->override, + parsetree->commandType, + parsetree->override, rt_entry_relation, - parsetree->resultRelation, + parsetree->resultRelation, &attrnos); /* ... and the VALUES expression lists */ rewriteValuesRTE(values_rte, rt_entry_relation, attrnos); @@ -3565,7 +3565,7 @@ RewriteQuery(Query *parsetree, List *rewrite_events) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), errmsg("infinite recursion detected in rules for relation \"%s\"", - RelationGetRelationName(rt_entry_relation)))); + RelationGetRelationName(rt_entry_relation)))); } rev = (rewrite_event *) palloc(sizeof(rewrite_event)); @@ -3602,21 +3602,21 @@ RewriteQuery(Query *parsetree, List *rewrite_events) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot perform INSERT RETURNING on relation \"%s\"", - RelationGetRelationName(rt_entry_relation)), + RelationGetRelationName(rt_entry_relation)), errhint("You need an unconditional ON INSERT DO INSTEAD rule with a RETURNING clause."))); break; case CMD_UPDATE: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot perform UPDATE RETURNING on relation \"%s\"", - RelationGetRelationName(rt_entry_relation)), + RelationGetRelationName(rt_entry_relation)), errhint("You need an unconditional ON UPDATE DO INSTEAD rule with a RETURNING clause."))); break; case CMD_DELETE: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot perform DELETE RETURNING on relation \"%s\"", - RelationGetRelationName(rt_entry_relation)), + RelationGetRelationName(rt_entry_relation)), errhint("You need an unconditional ON DELETE DO INSTEAD rule with a RETURNING clause."))); break; default: diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c index da02cfd25c..b89b435da0 100644 --- a/src/backend/rewrite/rewriteManip.c +++ b/src/backend/rewrite/rewriteManip.c @@ -1000,7 +1000,7 @@ AddQual(Query *parsetree, Node *qual) else ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("conditional utility statements are not implemented"))); + errmsg("conditional utility statements are not implemented"))); } if (parsetree->setOperations != NULL) @@ -1166,7 +1166,7 @@ replace_rte_variables_mutator(Node *node, */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("WHERE CURRENT OF on a view is not implemented"))); + errmsg("WHERE CURRENT OF on a view is not implemented"))); } /* otherwise fall through to copy the expr normally */ } @@ -1397,7 +1397,7 @@ ReplaceVarsFromTargetList_callback(Var *var, */ return coerce_to_domain((Node *) makeNullConst(var->vartype, var->vartypmod, - var->varcollid), + var->varcollid), InvalidOid, -1, var->vartype, COERCE_IMPLICIT_CAST, diff --git a/src/backend/rewrite/rowsecurity.c b/src/backend/rewrite/rowsecurity.c index 99ce3faea0..84950e204f 100644 --- a/src/backend/rewrite/rowsecurity.c +++ b/src/backend/rewrite/rowsecurity.c @@ -293,7 +293,7 @@ get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index, &select_restrictive_policies); add_with_check_options(rel, rt_index, commandType == CMD_INSERT ? - WCO_RLS_INSERT_CHECK : WCO_RLS_UPDATE_CHECK, + WCO_RLS_INSERT_CHECK : WCO_RLS_UPDATE_CHECK, select_permissive_policies, select_restrictive_policies, withCheckOptions, @@ -343,8 +343,8 @@ get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index, List *conflict_select_restrictive_policies = NIL; get_policies_for_relation(rel, CMD_SELECT, user_id, - &conflict_select_permissive_policies, - &conflict_select_restrictive_policies); + &conflict_select_permissive_policies, + &conflict_select_restrictive_policies); add_with_check_options(rel, rt_index, WCO_RLS_CONFLICT_CHECK, conflict_select_permissive_policies, diff --git a/src/backend/snowball/dict_snowball.c b/src/backend/snowball/dict_snowball.c index 0c322a49c6..7cf668de19 100644 --- a/src/backend/snowball/dict_snowball.c +++ b/src/backend/snowball/dict_snowball.c @@ -126,7 +126,7 @@ typedef struct DictSnowball struct SN_env *z; StopList stoplist; bool needrecode; /* needs recoding before/after call stem */ - int (*stem) (struct SN_env * z); + int (*stem) (struct SN_env *z); /* * snowball saves alloced memory between calls, so we should run it in our diff --git a/src/backend/statistics/README.dependencies b/src/backend/statistics/README.dependencies index 59f9d57657..702d34e3f8 100644 --- a/src/backend/statistics/README.dependencies +++ b/src/backend/statistics/README.dependencies @@ -79,20 +79,21 @@ to break the consistency. Clause reduction (planner/optimizer) ------------------------------------ -Applying the functional dependencies is fairly simple - given a list of +Applying the functional dependencies is fairly simple: given a list of equality clauses, we compute selectivities of each clause and then use the degree to combine them using this formula P(a=?,b=?) = P(a=?) * (d + (1-d) * P(b=?)) -Where 'd' is the degree of functional dependence (a=>b). +Where 'd' is the degree of functional dependency (a => b). With more than two equality clauses, this process happens recursively. For -example for (a,b,c) we first use (a,b=>c) to break the computation into +example for (a,b,c) we first use (a,b => c) to break the computation into - P(a=?,b=?,c=?) = P(a=?,b=?) * (d + (1-d)*P(b=?)) + P(a=?,b=?,c=?) = P(a=?,b=?) * (e + (1-e) * P(c=?)) -and then apply (a=>b) the same way on P(a=?,b=?). +where 'e' is the degree of functional dependency (a,b => c); then we can +apply (a=>b) the same way on P(a=?,b=?). Consistency of clauses diff --git a/src/backend/statistics/dependencies.c b/src/backend/statistics/dependencies.c index 793b2da766..89dece3350 100644 --- a/src/backend/statistics/dependencies.c +++ b/src/backend/statistics/dependencies.c @@ -49,13 +49,13 @@ typedef struct DependencyGeneratorData typedef DependencyGeneratorData *DependencyGenerator; static void generate_dependencies_recurse(DependencyGenerator state, - int index, AttrNumber start, AttrNumber *current); + int index, AttrNumber start, AttrNumber *current); static void generate_dependencies(DependencyGenerator state); static DependencyGenerator DependencyGenerator_init(int n, int k); static void DependencyGenerator_free(DependencyGenerator state); static AttrNumber *DependencyGenerator_next(DependencyGenerator state); static double dependency_degree(int numrows, HeapTuple *rows, int k, - AttrNumber *dependency, VacAttrStats **stats, Bitmapset *attrs); + AttrNumber *dependency, VacAttrStats **stats, Bitmapset *attrs); static bool dependency_is_fully_matched(MVDependency *dependency, Bitmapset *attnums); static bool dependency_implies_attribute(MVDependency *dependency, @@ -122,7 +122,7 @@ generate_dependencies_recurse(DependencyGenerator state, int index, if (!match) { state->dependencies = (AttrNumber *) repalloc(state->dependencies, - state->k * (state->ndependencies + 1) * sizeof(AttrNumber)); + state->k * (state->ndependencies + 1) * sizeof(AttrNumber)); memcpy(&state->dependencies[(state->k * state->ndependencies)], current, state->k * sizeof(AttrNumber)); state->ndependencies++; @@ -308,7 +308,7 @@ dependency_degree(int numrows, HeapTuple *rows, int k, AttrNumber *dependency, * to the preceding one. */ if (i == numrows || - multi_sort_compare_dims(0, k - 2, &items[i - 1], &items[i], mss) != 0) + multi_sort_compare_dims(0, k - 2, &items[i - 1], &items[i], mss) != 0) { /* * If no violations were found in the group then track the rows of @@ -409,7 +409,7 @@ statext_dependencies_build(int numrows, HeapTuple *rows, Bitmapset *attrs, continue; d = (MVDependency *) palloc0(offsetof(MVDependency, attributes) - +k * sizeof(AttrNumber)); + + k * sizeof(AttrNumber)); /* copy the dependency (and keep the indexes into stxkeys) */ d->degree = degree; @@ -430,8 +430,8 @@ statext_dependencies_build(int numrows, HeapTuple *rows, Bitmapset *attrs, dependencies->ndeps++; dependencies = (MVDependencies *) repalloc(dependencies, - offsetof(MVDependencies, deps) - +dependencies->ndeps * sizeof(MVDependency)); + offsetof(MVDependencies, deps) + + dependencies->ndeps * sizeof(MVDependency)); dependencies->deps[dependencies->ndeps - 1] = d; } @@ -552,7 +552,7 @@ statext_dependencies_deserialize(bytea *data) /* allocate space for the MCV items */ dependencies = repalloc(dependencies, offsetof(MVDependencies, deps) - +(dependencies->ndeps * sizeof(MVDependency *))); + + (dependencies->ndeps * sizeof(MVDependency *))); for (i = 0; i < dependencies->ndeps; i++) { @@ -573,7 +573,7 @@ statext_dependencies_deserialize(bytea *data) /* now that we know the number of attributes, allocate the dependency */ d = (MVDependency *) palloc0(offsetof(MVDependency, attributes) - +(k * sizeof(AttrNumber))); + + (k * sizeof(AttrNumber))); d->degree = degree; d->nattributes = k; @@ -633,11 +633,11 @@ dependency_implies_attribute(MVDependency *dependency, AttrNumber attnum) } /* - * staext_dependencies_load + * statext_dependencies_load * Load the functional dependencies for the indicated pg_statistic_ext tuple */ MVDependencies * -staext_dependencies_load(Oid mvoid) +statext_dependencies_load(Oid mvoid) { bool isnull; Datum deps; @@ -883,7 +883,7 @@ find_strongest_dependency(StatisticExtInfo *stats, MVDependencies *dependencies, * slightly more expensive than the previous checks. */ if (dependency_is_fully_matched(dependency, attnums)) - strongest = dependency; /* save new best match */ + strongest = dependency; /* save new best match */ } return strongest; @@ -987,7 +987,7 @@ dependencies_clauselist_selectivity(PlannerInfo *root, } /* load the dependency items stored in the statistics object */ - dependencies = staext_dependencies_load(stat->statOid); + dependencies = statext_dependencies_load(stat->statOid); /* * Apply the dependencies recursively, starting with the widest/strongest diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c index 8d7460c96b..db4987bde3 100644 --- a/src/backend/statistics/extended_stats.c +++ b/src/backend/statistics/extended_stats.c @@ -121,7 +121,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows, stat->columns, stats); else if (t == STATS_EXT_DEPENDENCIES) dependencies = statext_dependencies_build(numrows, rows, - stat->columns, stats); + stat->columns, stats); } /* store the statistics in the catalog */ @@ -353,7 +353,7 @@ multi_sort_init(int ndims) Assert(ndims >= 2); mss = (MultiSortSupport) palloc0(offsetof(MultiSortSupportData, ssup) - +sizeof(SortSupportData) * ndims); + + sizeof(SortSupportData) * ndims); mss->ndims = ndims; diff --git a/src/backend/statistics/mvdistinct.c b/src/backend/statistics/mvdistinct.c index d8d422cd45..913829233e 100644 --- a/src/backend/statistics/mvdistinct.c +++ b/src/backend/statistics/mvdistinct.c @@ -101,7 +101,7 @@ statext_ndistinct_build(double totalrows, int numrows, HeapTuple *rows, item->attrs = NULL; for (j = 0; j < k; j++) item->attrs = bms_add_member(item->attrs, - stats[combination[j]]->attr->attnum); + stats[combination[j]]->attr->attnum); item->ndistinct = ndistinct_for_combination(totalrows, numrows, rows, stats, k, combination); @@ -166,7 +166,7 @@ statext_ndistinct_serialize(MVNDistinct *ndistinct) * for each item, including number of items for each. */ len = VARHDRSZ + SizeOfMVNDistinct + - ndistinct->nitems * (offsetof(MVNDistinctItem, attrs) +sizeof(int)); + ndistinct->nitems * (offsetof(MVNDistinctItem, attrs) + sizeof(int)); /* and also include space for the actual attribute numbers */ for (i = 0; i < ndistinct->nitems; i++) @@ -275,8 +275,8 @@ statext_ndistinct_deserialize(bytea *data) if (VARSIZE_ANY_EXHDR(data) < minimum_size) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), - errmsg("invalid MVNDistinct size %zd (expected at least %zd)", - VARSIZE_ANY_EXHDR(data), minimum_size))); + errmsg("invalid MVNDistinct size %zd (expected at least %zd)", + VARSIZE_ANY_EXHDR(data), minimum_size))); /* * Allocate space for the ndistinct items (no space for each item's @@ -513,10 +513,10 @@ estimate_ndistinct(double totalrows, int numrows, int d, int f1) denom, ndistinct; - numer = (double) numrows *(double) d; + numer = (double) numrows * (double) d; denom = (double) (numrows - f1) + - (double) f1 *(double) numrows / totalrows; + (double) f1 * (double) numrows / totalrows; ndistinct = numer / denom; diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index b22edf00ec..dd9b1eee9a 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -542,7 +542,7 @@ PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum) if (RELATION_IS_OTHER_TEMP(reln)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot access temporary tables of other sessions"))); + errmsg("cannot access temporary tables of other sessions"))); /* pass it off to localbuf.c */ LocalPrefetchBuffer(reln->rd_smgr, forkNum, blockNum); @@ -583,7 +583,7 @@ PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum) * not clear that there's enough of a problem to justify that. */ } -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } @@ -805,9 +805,9 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr); if (!PageIsNew((Page) bufBlock)) ereport(ERROR, - (errmsg("unexpected data beyond EOF in block %u of relation %s", - blockNum, relpath(smgr->smgr_rnode, forkNum)), - errhint("This has been seen to occur with buggy kernels; consider updating your system."))); + (errmsg("unexpected data beyond EOF in block %u of relation %s", + blockNum, relpath(smgr->smgr_rnode, forkNum)), + errhint("This has been seen to occur with buggy kernels; consider updating your system."))); /* * We *must* do smgrextend before succeeding, else the page will not @@ -992,10 +992,10 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, { BufferTag newTag; /* identity of requested block */ uint32 newHash; /* hash value for newTag */ - LWLock *newPartitionLock; /* buffer partition lock for it */ + LWLock *newPartitionLock; /* buffer partition lock for it */ BufferTag oldTag; /* previous identity of selected buffer */ uint32 oldHash; /* hash value for oldTag */ - LWLock *oldPartitionLock; /* buffer partition lock for it */ + LWLock *oldPartitionLock; /* buffer partition lock for it */ uint32 oldFlags; int buf_id; BufferDesc *buf; @@ -1134,9 +1134,9 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, /* OK, do the I/O */ TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START(forkNum, blockNum, - smgr->smgr_rnode.node.spcNode, - smgr->smgr_rnode.node.dbNode, - smgr->smgr_rnode.node.relNode); + smgr->smgr_rnode.node.spcNode, + smgr->smgr_rnode.node.dbNode, + smgr->smgr_rnode.node.relNode); FlushBuffer(buf, NULL); LWLockRelease(BufferDescriptorGetContentLock(buf)); @@ -1145,9 +1145,9 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, &buf->tag); TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE(forkNum, blockNum, - smgr->smgr_rnode.node.spcNode, - smgr->smgr_rnode.node.dbNode, - smgr->smgr_rnode.node.relNode); + smgr->smgr_rnode.node.spcNode, + smgr->smgr_rnode.node.dbNode, + smgr->smgr_rnode.node.relNode); } else { @@ -1354,7 +1354,7 @@ InvalidateBuffer(BufferDesc *buf) { BufferTag oldTag; uint32 oldHash; /* hash value for oldTag */ - LWLock *oldPartitionLock; /* buffer partition lock for it */ + LWLock *oldPartitionLock; /* buffer partition lock for it */ uint32 oldFlags; uint32 buf_state; @@ -2119,7 +2119,7 @@ BgBufferSync(WritebackContext *wb_context) int32 passes_delta = strategy_passes - prev_strategy_passes; strategy_delta = strategy_buf_id - prev_strategy_buf_id; - strategy_delta += (long) passes_delta *NBuffers; + strategy_delta += (long) passes_delta * NBuffers; Assert(strategy_delta >= 0); @@ -2948,7 +2948,7 @@ DropRelFileNodesAllBuffers(RelFileNodeBackend *rnodes, int nnodes) if (nnodes == 0) return; - nodes = palloc(sizeof(RelFileNode) * nnodes); /* non-local relations */ + nodes = palloc(sizeof(RelFileNode) * nnodes); /* non-local relations */ /* If it's a local relation, it's localbuf.c's problem. */ for (i = 0; i < nnodes; i++) @@ -3093,7 +3093,7 @@ PrintBufferDescs(void) "[%02d] (freeNext=%d, rel=%s, " "blockNum=%u, flags=0x%x, refcount=%u %d)", i, buf->freeNext, - relpathbackend(buf->tag.rnode, InvalidBackendId, buf->tag.forkNum), + relpathbackend(buf->tag.rnode, InvalidBackendId, buf->tag.forkNum), buf->tag.blockNum, buf->flags, buf->refcount, GetPrivateRefCount(b)); } @@ -4196,7 +4196,7 @@ ckpt_buforder_comparator(const void *pa, const void *pb) /* compare block number */ else if (a->blockNum < b->blockNum) return -1; - else /* should not be the same block ... */ + else /* should not be the same block ... */ return 1; } diff --git a/src/backend/storage/buffer/freelist.c b/src/backend/storage/buffer/freelist.c index 5d0a636ba8..9d8ae6ae8e 100644 --- a/src/backend/storage/buffer/freelist.c +++ b/src/backend/storage/buffer/freelist.c @@ -94,7 +94,7 @@ typedef struct BufferAccessStrategyData * struct. */ Buffer buffers[FLEXIBLE_ARRAY_MEMBER]; -} BufferAccessStrategyData; +} BufferAccessStrategyData; /* Prototypes for internal functions */ @@ -674,7 +674,7 @@ StrategyRejectBuffer(BufferAccessStrategy strategy, BufferDesc *buf) /* Don't muck with behavior of normal buffer-replacement strategy */ if (!strategy->current_was_in_ring || - strategy->buffers[strategy->current] != BufferDescriptorGetBuffer(buf)) + strategy->buffers[strategy->current] != BufferDescriptorGetBuffer(buf)) return false; /* diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 6e59ce888c..1d540e87e8 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -86,7 +86,7 @@ LocalPrefetchBuffer(SMgrRelation smgr, ForkNumber forkNum, /* Not in buffers, so initiate prefetch */ smgrprefetch(smgr, forkNum, blockNum); -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } @@ -189,7 +189,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum, /* Found a usable buffer */ LocalRefCount[b]++; ResourceOwnerRememberBuffer(CurrentResourceOwner, - BufferDescriptorGetBuffer(bufHdr)); + BufferDescriptorGetBuffer(bufHdr)); break; } } diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 954db661d9..ceaeacd8a2 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -525,7 +525,7 @@ pg_flush_data(int fd, off_t offset, off_t nbytes) /* FATAL error because mapping would remain */ ereport(FATAL, (errcode_for_file_access(), - errmsg("could not munmap() while flushing data: %m"))); + errmsg("could not munmap() while flushing data: %m"))); } return; @@ -818,10 +818,10 @@ count_usable_fds(int max_to_probe, int *usable_fds, int *already_open) getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim); #else /* but BSD doesn't ... */ getrlimit_status = getrlimit(RLIMIT_OFILE, &rlim); -#endif /* RLIMIT_NOFILE */ +#endif /* RLIMIT_NOFILE */ if (getrlimit_status != 0) ereport(WARNING, (errmsg("getrlimit failed: %m"))); -#endif /* HAVE_GETRLIMIT */ +#endif /* HAVE_GETRLIMIT */ /* dup until failure or probe limit reached */ for (;;) @@ -981,7 +981,7 @@ _dump_lru(void) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "LEAST"); elog(LOG, "%s", buf); } -#endif /* FDDEBUG */ +#endif /* FDDEBUG */ static void Delete(File file) @@ -1766,8 +1766,8 @@ FileWrite(File file, char *buffer, int amount, uint32 wait_event_info) if (newTotal > (uint64) temp_file_limit * (uint64) 1024) ereport(ERROR, (errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED), - errmsg("temporary file size exceeds temp_file_limit (%dkB)", - temp_file_limit))); + errmsg("temporary file size exceeds temp_file_limit (%dkB)", + temp_file_limit))); } } @@ -2511,7 +2511,7 @@ closeAllVfds(void) if (SizeVfdCache > 0) { - Assert(FileIsNotOpen(0)); /* Make sure ring not corrupted */ + Assert(FileIsNotOpen(0)); /* Make sure ring not corrupted */ for (i = 1; i < SizeVfdCache; i++) { if (!FileIsNotOpen(i)) @@ -2662,7 +2662,7 @@ CleanupTempFiles(bool isProcExit) */ if (isProcExit || have_xact_temporary_files) { - Assert(FileIsNotOpen(0)); /* Make sure ring not corrupted */ + Assert(FileIsNotOpen(0)); /* Make sure ring not corrupted */ for (i = 1; i < SizeVfdCache; i++) { unsigned short fdstate = VfdCache[i].fdstate; @@ -3123,7 +3123,7 @@ pre_sync_fname(const char *fname, bool isdir, int elevel) (void) CloseTransientFile(fd); } -#endif /* PG_FLUSH_DATA_WORKS */ +#endif /* PG_FLUSH_DATA_WORKS */ static void datadir_fsync_fname(const char *fname, bool isdir, int elevel) diff --git a/src/backend/storage/ipc/dsm.c b/src/backend/storage/ipc/dsm.c index 387849e22c..36904d2676 100644 --- a/src/backend/storage/ipc/dsm.c +++ b/src/backend/storage/ipc/dsm.c @@ -429,7 +429,7 @@ dsm_backend_startup(void) &dsm_control_mapped_size, WARNING); ereport(FATAL, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("dynamic shared memory control segment is not valid"))); + errmsg("dynamic shared memory control segment is not valid"))); } } #endif @@ -935,7 +935,7 @@ dsm_unpin_segment(dsm_handle handle) * dsm_impl_unpin_segment. */ dsm_impl_unpin_segment(handle, - &dsm_control->item[control_slot].impl_private_pm_handle); + &dsm_control->item[control_slot].impl_private_pm_handle); /* Note that 1 means no references (0 means unused slot). */ if (--dsm_control->item[control_slot].refcnt == 1) @@ -1160,5 +1160,5 @@ static uint64 dsm_control_bytes_needed(uint32 nitems) { return offsetof(dsm_control_header, item) - +sizeof(dsm_control_item) * (uint64) nitems; + + sizeof(dsm_control_item) * (uint64) nitems; } diff --git a/src/backend/storage/ipc/dsm_impl.c b/src/backend/storage/ipc/dsm_impl.c index e0eaefeeb3..1500465d31 100644 --- a/src/backend/storage/ipc/dsm_impl.c +++ b/src/backend/storage/ipc/dsm_impl.c @@ -258,8 +258,8 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size, { ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not unmap shared memory segment \"%s\": %m", - name))); + errmsg("could not unmap shared memory segment \"%s\": %m", + name))); return false; } *mapped_address = NULL; @@ -268,8 +268,8 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size, { ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not remove shared memory segment \"%s\": %m", - name))); + errmsg("could not remove shared memory segment \"%s\": %m", + name))); return false; } return true; @@ -358,8 +358,8 @@ dsm_impl_posix(dsm_op op, dsm_handle handle, Size request_size, ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not unmap shared memory segment \"%s\": %m", - name))); + errmsg("could not unmap shared memory segment \"%s\": %m", + name))); return false; } *mapped_address = NULL; @@ -530,8 +530,8 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size, { ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not unmap shared memory segment \"%s\": %m", - name))); + errmsg("could not unmap shared memory segment \"%s\": %m", + name))); return false; } *mapped_address = NULL; @@ -540,8 +540,8 @@ dsm_impl_sysv(dsm_op op, dsm_handle handle, Size request_size, { ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not remove shared memory segment \"%s\": %m", - name))); + errmsg("could not remove shared memory segment \"%s\": %m", + name))); return false; } return true; @@ -645,8 +645,8 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size, _dosmaperr(GetLastError()); ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not unmap shared memory segment \"%s\": %m", - name))); + errmsg("could not unmap shared memory segment \"%s\": %m", + name))); return false; } if (*impl_private != NULL @@ -655,8 +655,8 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size, _dosmaperr(GetLastError()); ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not remove shared memory segment \"%s\": %m", - name))); + errmsg("could not remove shared memory segment \"%s\": %m", + name))); return false; } @@ -686,9 +686,9 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size, hmap = CreateFileMapping(INVALID_HANDLE_VALUE, /* Use the pagefile */ NULL, /* Default security attrs */ - PAGE_READWRITE, /* Memory is read/write */ - size_high, /* Upper 32 bits of size */ - size_low, /* Lower 32 bits of size */ + PAGE_READWRITE, /* Memory is read/write */ + size_high, /* Upper 32 bits of size */ + size_low, /* Lower 32 bits of size */ name); errcode = GetLastError(); @@ -711,8 +711,8 @@ dsm_impl_windows(dsm_op op, dsm_handle handle, Size request_size, _dosmaperr(errcode); ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not create shared memory segment \"%s\": %m", - name))); + errmsg("could not create shared memory segment \"%s\": %m", + name))); return false; } } @@ -816,8 +816,8 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size, { ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not unmap shared memory segment \"%s\": %m", - name))); + errmsg("could not unmap shared memory segment \"%s\": %m", + name))); return false; } *mapped_address = NULL; @@ -826,8 +826,8 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size, { ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not remove shared memory segment \"%s\": %m", - name))); + errmsg("could not remove shared memory segment \"%s\": %m", + name))); return false; } return true; @@ -960,8 +960,8 @@ dsm_impl_mmap(dsm_op op, dsm_handle handle, Size request_size, ereport(elevel, (errcode_for_dynamic_shared_memory(), - errmsg("could not unmap shared memory segment \"%s\": %m", - name))); + errmsg("could not unmap shared memory segment \"%s\": %m", + name))); return false; } *mapped_address = NULL; @@ -1026,8 +1026,8 @@ dsm_impl_pin_segment(dsm_handle handle, void *impl_private, _dosmaperr(GetLastError()); ereport(ERROR, (errcode_for_dynamic_shared_memory(), - errmsg("could not duplicate handle for \"%s\": %m", - name))); + errmsg("could not duplicate handle for \"%s\": %m", + name))); } /* @@ -1074,8 +1074,8 @@ dsm_impl_unpin_segment(dsm_handle handle, void **impl_private) _dosmaperr(GetLastError()); ereport(ERROR, (errcode_for_dynamic_shared_memory(), - errmsg("could not duplicate handle for \"%s\": %m", - name))); + errmsg("could not duplicate handle for \"%s\": %m", + name))); } *impl_private = NULL; diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c index ffd91f5b0a..90dee4f51a 100644 --- a/src/backend/storage/ipc/ipc.c +++ b/src/backend/storage/ipc/ipc.c @@ -198,7 +198,7 @@ proc_exit_prepare(int code) */ while (--on_proc_exit_index >= 0) (*on_proc_exit_list[on_proc_exit_index].function) (code, - on_proc_exit_list[on_proc_exit_index].arg); + on_proc_exit_list[on_proc_exit_index].arg); on_proc_exit_index = 0; } @@ -226,7 +226,7 @@ shmem_exit(int code) code, before_shmem_exit_index); while (--before_shmem_exit_index >= 0) (*before_shmem_exit_list[before_shmem_exit_index].function) (code, - before_shmem_exit_list[before_shmem_exit_index].arg); + before_shmem_exit_list[before_shmem_exit_index].arg); before_shmem_exit_index = 0; /* @@ -259,7 +259,7 @@ shmem_exit(int code) code, on_shmem_exit_index); while (--on_shmem_exit_index >= 0) (*on_shmem_exit_list[on_shmem_exit_index].function) (code, - on_shmem_exit_list[on_shmem_exit_index].arg); + on_shmem_exit_list[on_shmem_exit_index].arg); on_shmem_exit_index = 0; } diff --git a/src/backend/storage/ipc/latch.c b/src/backend/storage/ipc/latch.c index 55959de91f..07b1364de8 100644 --- a/src/backend/storage/ipc/latch.c +++ b/src/backend/storage/ipc/latch.c @@ -124,7 +124,7 @@ static int selfpipe_owner_pid = 0; /* Private function prototypes */ static void sendSelfPipeByte(void); static void drainSelfPipe(void); -#endif /* WIN32 */ +#endif /* WIN32 */ #if defined(WAIT_USE_EPOLL) static void WaitEventAdjustEpoll(WaitEventSet *set, WaitEvent *event, int action); @@ -230,7 +230,7 @@ InitLatch(volatile Latch *latch) latch->event = CreateEvent(NULL, TRUE, FALSE, NULL); if (latch->event == NULL) elog(ERROR, "CreateEvent failed: error code %lu", GetLastError()); -#endif /* WIN32 */ +#endif /* WIN32 */ } /* @@ -576,7 +576,7 @@ CreateWaitEventSet(MemoryContext context, int nevents) elog(ERROR, "epoll_create failed: %m"); if (fcntl(set->epoll_fd, F_SETFD, FD_CLOEXEC) == -1) elog(ERROR, "fcntl(F_SETFD) failed on epoll descriptor: %m"); -#endif /* EPOLL_CLOEXEC */ +#endif /* EPOLL_CLOEXEC */ #elif defined(WAIT_USE_WIN32) /* @@ -1214,7 +1214,7 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout, } } else if (cur_event->events == WL_POSTMASTER_DEATH && - (cur_pollfd->revents & (POLLIN | POLLHUP | POLLERR | POLLNVAL))) + (cur_pollfd->revents & (POLLIN | POLLHUP | POLLERR | POLLNVAL))) { /* * We expect an POLLHUP when the remote end is closed, but because @@ -1469,7 +1469,7 @@ latch_sigusr1_handler(void) if (waiting) sendSelfPipeByte(); } -#endif /* !WIN32 */ +#endif /* !WIN32 */ /* Send one byte to the self-pipe, to wake up WaitLatch */ #ifndef WIN32 @@ -1502,7 +1502,7 @@ retry: return; } } -#endif /* !WIN32 */ +#endif /* !WIN32 */ /* * Read all available data from the self-pipe @@ -1550,4 +1550,4 @@ drainSelfPipe(void) /* else buffer wasn't big enough, so read again */ } } -#endif /* !WIN32 */ +#endif /* !WIN32 */ diff --git a/src/backend/storage/ipc/pmsignal.c b/src/backend/storage/ipc/pmsignal.c index 98f4082d94..85db6b21f8 100644 --- a/src/backend/storage/ipc/pmsignal.c +++ b/src/backend/storage/ipc/pmsignal.c @@ -289,5 +289,5 @@ PostmasterIsAlive(void) return false; #else /* WIN32 */ return (WaitForSingleObject(PostmasterHandle, 0) == WAIT_TIMEOUT); -#endif /* WIN32 */ +#endif /* WIN32 */ } diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index 0e0bbf71f0..fe0dabd90c 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -95,7 +95,7 @@ typedef struct ProcArrayStruct int numKnownAssignedXids; /* current # of valid entries */ int tailKnownAssignedXids; /* index of oldest valid element */ int headKnownAssignedXids; /* index of newest element, + 1 */ - slock_t known_assigned_xids_lck; /* protects head/tail pointers */ + slock_t known_assigned_xids_lck; /* protects head/tail pointers */ /* * Highest subxid that has been removed from KnownAssignedXids array to @@ -169,7 +169,7 @@ static void DisplayXidCache(void); #define xc_by_known_assigned_inc() ((void) 0) #define xc_no_overflow_inc() ((void) 0) #define xc_slow_answer_inc() ((void) 0) -#endif /* XIDCACHE_DEBUG */ +#endif /* XIDCACHE_DEBUG */ #ifdef PGXC /* PGXC_DATANODE */ @@ -419,7 +419,7 @@ ProcArrayRemove(PGPROC *proc, TransactionId latestXid) /* Keep the PGPROC array sorted. See notes above */ memmove(&arrayP->pgprocnos[index], &arrayP->pgprocnos[index + 1], (arrayP->numProcs - index - 1) * sizeof(int)); - arrayP->pgprocnos[arrayP->numProcs - 1] = -1; /* for debugging */ + arrayP->pgprocnos[arrayP->numProcs - 1] = -1; /* for debugging */ arrayP->numProcs--; LWLockRelease(ProcArrayLock); return; @@ -501,7 +501,7 @@ ProcArrayEndTransaction(PGPROC *proc, TransactionId latestXid) pgxact->xmin = InvalidTransactionId; /* must be cleared with xid/xmin: */ pgxact->vacuumFlags &= ~PROC_VACUUM_STATE_MASK; - pgxact->delayChkpt = false; /* be sure this is cleared in abort */ + pgxact->delayChkpt = false; /* be sure this is cleared in abort */ proc->recoveryConflictPending = false; Assert(pgxact->nxids == 0); @@ -801,8 +801,8 @@ ProcArrayApplyRecoveryInfo(RunningTransactions running) } else elog(trace_recovery(DEBUG1), - "recovery snapshot waiting for non-overflowed snapshot or " - "until oldest active xid on standby is at least %u (now %u)", + "recovery snapshot waiting for non-overflowed snapshot or " + "until oldest active xid on standby is at least %u (now %u)", standbySnapshotPendingXmin, running->oldestRunningXid); return; @@ -1472,7 +1472,7 @@ GetOldestXminInternal(Relation rel, int flags, bool computeLocal, if (allDbs || proc->databaseId == MyDatabaseId || - proc->databaseId == 0) /* always include WalSender */ + proc->databaseId == 0) /* always include WalSender */ { /* Fetch xid just once - see GetNewTransactionId */ TransactionId xid = pgxact->xid; @@ -3353,7 +3353,7 @@ DisplayXidCache(void) xc_no_overflow, xc_slow_answer); } -#endif /* XIDCACHE_DEBUG */ +#endif /* XIDCACHE_DEBUG */ #ifdef PGXC @@ -3773,7 +3773,7 @@ RecordKnownAssignedTransactionIds(TransactionId xid) */ void ExpireTreeKnownAssignedTransactionIds(TransactionId xid, int nsubxids, - TransactionId *subxids, TransactionId max_xid) + TransactionId *subxids, TransactionId max_xid) { Assert(standbyState >= STANDBY_INITIALIZED); diff --git a/src/backend/storage/ipc/shm_mq.c b/src/backend/storage/ipc/shm_mq.c index fcd6cc7a8c..f45a67cc27 100644 --- a/src/backend/storage/ipc/shm_mq.c +++ b/src/backend/storage/ipc/shm_mq.c @@ -145,7 +145,7 @@ static shm_mq_result shm_mq_receive_bytes(shm_mq *mq, Size bytes_needed, bool nowait, Size *nbytesp, void **datap); static bool shm_mq_counterparty_gone(volatile shm_mq *mq, BackgroundWorkerHandle *handle); -static bool shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile * ptr, +static bool shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile *ptr, BackgroundWorkerHandle *handle); static uint64 shm_mq_get_bytes_read(volatile shm_mq *mq, bool *detached); static void shm_mq_inc_bytes_read(volatile shm_mq *mq, Size n); @@ -365,7 +365,7 @@ shm_mq_sendv(shm_mq_handle *mqh, shm_mq_iovec *iov, int iovcnt, bool nowait) { Assert(mqh->mqh_partial_bytes < sizeof(Size)); res = shm_mq_send_bytes(mqh, sizeof(Size) - mqh->mqh_partial_bytes, - ((char *) &nbytes) +mqh->mqh_partial_bytes, + ((char *) &nbytes) + mqh->mqh_partial_bytes, nowait, &bytes_written); if (res == SHM_MQ_DETACHED) @@ -1053,7 +1053,7 @@ shm_mq_counterparty_gone(volatile shm_mq *mq, BackgroundWorkerHandle *handle) * non-NULL when our counterpart attaches to the queue. */ static bool -shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile * ptr, +shm_mq_wait_internal(volatile shm_mq *mq, PGPROC *volatile *ptr, BackgroundWorkerHandle *handle) { bool result = false; diff --git a/src/backend/storage/ipc/shm_toc.c b/src/backend/storage/ipc/shm_toc.c index 50334cd797..9f259441f0 100644 --- a/src/backend/storage/ipc/shm_toc.c +++ b/src/backend/storage/ipc/shm_toc.c @@ -96,7 +96,7 @@ shm_toc_allocate(shm_toc *toc, Size nbytes) total_bytes = vtoc->toc_total_bytes; allocated_bytes = vtoc->toc_allocated_bytes; nentry = vtoc->toc_nentry; - toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry) + toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry) + allocated_bytes; /* Check for memory exhaustion and overflow. */ @@ -132,7 +132,7 @@ shm_toc_freespace(shm_toc *toc) nentry = vtoc->toc_nentry; SpinLockRelease(&toc->toc_mutex); - toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry); + toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry); Assert(allocated_bytes + BUFFERALIGN(toc_bytes) <= total_bytes); return total_bytes - (allocated_bytes + BUFFERALIGN(toc_bytes)); } @@ -176,7 +176,7 @@ shm_toc_insert(shm_toc *toc, uint64 key, void *address) total_bytes = vtoc->toc_total_bytes; allocated_bytes = vtoc->toc_allocated_bytes; nentry = vtoc->toc_nentry; - toc_bytes = offsetof(shm_toc, toc_entry) +nentry * sizeof(shm_toc_entry) + toc_bytes = offsetof(shm_toc, toc_entry) + nentry * sizeof(shm_toc_entry) + allocated_bytes; /* Check for memory exhaustion and overflow. */ @@ -253,6 +253,6 @@ Size shm_toc_estimate(shm_toc_estimator *e) { return add_size(offsetof(shm_toc, toc_entry), - add_size(mul_size(e->number_of_keys, sizeof(shm_toc_entry)), - e->space_for_chunks)); + add_size(mul_size(e->number_of_keys, sizeof(shm_toc_entry)), + e->space_for_chunks)); } diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c index 67150debf2..81c291f6e3 100644 --- a/src/backend/storage/ipc/shmem.c +++ b/src/backend/storage/ipc/shmem.c @@ -75,7 +75,7 @@ /* shared memory global variables */ -static PGShmemHeader *ShmemSegHdr; /* shared mem segment header */ +static PGShmemHeader *ShmemSegHdr; /* shared mem segment header */ static void *ShmemBase; /* start address of shared memory */ @@ -314,7 +314,7 @@ InitShmemIndex(void) * for NULL. */ HTAB * -ShmemInitHash(const char *name, /* table string name for shmem index */ +ShmemInitHash(const char *name, /* table string name for shmem index */ long init_size, /* initial table size */ long max_size, /* max size of the table */ HASHCTL *infoP, /* info about key and bucket size */ @@ -418,8 +418,8 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr) LWLockRelease(ShmemIndexLock); ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), - errmsg("could not create ShmemIndex entry for data structure \"%s\"", - name))); + errmsg("could not create ShmemIndex entry for data structure \"%s\"", + name))); } if (*foundPtr) @@ -433,9 +433,9 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr) { LWLockRelease(ShmemIndexLock); ereport(ERROR, - (errmsg("ShmemIndex entry size is wrong for data structure" - " \"%s\": expected %zu, actual %zu", - name, size, result->size))); + (errmsg("ShmemIndex entry size is wrong for data structure" + " \"%s\": expected %zu, actual %zu", + name, size, result->size))); } structPtr = result->location; } diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c index 13f21e0d99..b9a73e9247 100644 --- a/src/backend/storage/ipc/sinval.c +++ b/src/backend/storage/ipc/sinval.c @@ -69,7 +69,7 @@ SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n) */ void ReceiveSharedInvalidMessages( - void (*invalFunction) (SharedInvalidationMessage *msg), + void (*invalFunction) (SharedInvalidationMessage *msg), void (*resetFunction) (void)) { #define MAXINVALMSGS 32 diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c index 18302caf5e..1b9d32b7cf 100644 --- a/src/backend/storage/ipc/sinvaladt.c +++ b/src/backend/storage/ipc/sinvaladt.c @@ -240,7 +240,7 @@ CreateSharedInvalidationState(void) /* Mark all backends inactive, and initialize nextLXID */ for (i = 0; i < shmInvalBuffer->maxBackends; i++) { - shmInvalBuffer->procState[i].procPid = 0; /* inactive */ + shmInvalBuffer->procState[i].procPid = 0; /* inactive */ shmInvalBuffer->procState[i].proc = NULL; shmInvalBuffer->procState[i].nextMsgNum = 0; /* meaningless */ shmInvalBuffer->procState[i].resetState = false; @@ -271,7 +271,7 @@ SharedInvalBackendInit(bool sendOnly) /* Look for a free entry in the procState array */ for (index = 0; index < segP->lastBackend; index++) { - if (segP->procState[index].procPid == 0) /* inactive slot? */ + if (segP->procState[index].procPid == 0) /* inactive slot? */ { stateP = &segP->procState[index]; break; diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c index 8e57f933ca..0343cc6bdf 100644 --- a/src/backend/storage/ipc/standby.c +++ b/src/backend/storage/ipc/standby.c @@ -284,7 +284,7 @@ ResolveRecoveryConflictWithSnapshot(TransactionId latestRemovedXid, RelFileNode node.dbNode); ResolveRecoveryConflictWithVirtualXIDs(backends, - PROCSIG_RECOVERY_CONFLICT_SNAPSHOT); + PROCSIG_RECOVERY_CONFLICT_SNAPSHOT); } void @@ -312,7 +312,7 @@ ResolveRecoveryConflictWithTablespace(Oid tsid) temp_file_users = GetConflictingVirtualXIDs(InvalidTransactionId, InvalidOid); ResolveRecoveryConflictWithVirtualXIDs(temp_file_users, - PROCSIG_RECOVERY_CONFLICT_TABLESPACE); + PROCSIG_RECOVERY_CONFLICT_TABLESPACE); } void @@ -376,7 +376,7 @@ ResolveRecoveryConflictWithLock(LOCKTAG locktag) backends = GetLockConflicts(&locktag, AccessExclusiveLock); ResolveRecoveryConflictWithVirtualXIDs(backends, - PROCSIG_RECOVERY_CONFLICT_LOCK); + PROCSIG_RECOVERY_CONFLICT_LOCK); } else { @@ -529,7 +529,7 @@ CheckRecoveryConflictDeadlock(void) ereport(ERROR, (errcode(ERRCODE_T_R_DEADLOCK_DETECTED), errmsg("canceling statement due to conflict with recovery"), - errdetail("User transaction caused buffer deadlock with recovery."))); + errdetail("User transaction caused buffer deadlock with recovery."))); } @@ -986,7 +986,7 @@ LogCurrentRunningXacts(RunningTransactions CurrRunningXacts) /* array of TransactionIds */ if (xlrec.xcnt > 0) XLogRegisterData((char *) CurrRunningXacts->xids, - (xlrec.xcnt + xlrec.subxcnt) * sizeof(TransactionId)); + (xlrec.xcnt + xlrec.subxcnt) * sizeof(TransactionId)); recptr = XLogInsert(RM_STANDBY_ID, XLOG_RUNNING_XACTS); diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c index 6597b36b17..d55d40e6f8 100644 --- a/src/backend/storage/large_object/inv_api.c +++ b/src/backend/storage/large_object/inv_api.c @@ -445,8 +445,8 @@ inv_seek(LargeObjectDesc *obj_desc, int64 offset, int whence) if (newoffset < 0 || newoffset > MAX_LARGE_OBJECT_SIZE) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg_internal("invalid large object seek target: " INT64_FORMAT, - newoffset))); + errmsg_internal("invalid large object seek target: " INT64_FORMAT, + newoffset))); obj_desc->offset = newoffset; return newoffset; @@ -624,7 +624,7 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes) { if ((oldtuple = systable_getnext_ordered(sd, ForwardScanDirection)) != NULL) { - if (HeapTupleHasNulls(oldtuple)) /* paranoia */ + if (HeapTupleHasNulls(oldtuple)) /* paranoia */ elog(ERROR, "null field found in pg_largeobject"); olddata = (Form_pg_largeobject) GETSTRUCT(oldtuple); Assert(olddata->pageno >= pageno); @@ -806,7 +806,7 @@ inv_truncate(LargeObjectDesc *obj_desc, int64 len) olddata = NULL; if ((oldtuple = systable_getnext_ordered(sd, ForwardScanDirection)) != NULL) { - if (HeapTupleHasNulls(oldtuple)) /* paranoia */ + if (HeapTupleHasNulls(oldtuple)) /* paranoia */ elog(ERROR, "null field found in pg_largeobject"); olddata = (Form_pg_largeobject) GETSTRUCT(oldtuple); Assert(olddata->pageno >= pageno); diff --git a/src/backend/storage/lmgr/deadlock.c b/src/backend/storage/lmgr/deadlock.c index de67e5db49..5e49c78905 100644 --- a/src/backend/storage/lmgr/deadlock.c +++ b/src/backend/storage/lmgr/deadlock.c @@ -527,8 +527,8 @@ FindLockCycleRecurse(PGPROC *checkProc, if (memberProc->links.next != NULL && memberProc->waitLock != NULL && memberProc != checkProc && - FindLockCycleRecurseMember(memberProc, checkProc, depth, softEdges, - nSoftEdges)) + FindLockCycleRecurseMember(memberProc, checkProc, depth, softEdges, + nSoftEdges)) return true; } @@ -539,8 +539,8 @@ static bool FindLockCycleRecurseMember(PGPROC *checkProc, PGPROC *checkProcLeader, int depth, - EDGE *softEdges, /* output argument */ - int *nSoftEdges) /* output argument */ + EDGE *softEdges, /* output argument */ + int *nSoftEdges) /* output argument */ { PGPROC *proc; LOCK *lock = checkProc->waitLock; @@ -1030,7 +1030,7 @@ TopoSort(LOCK *lock, for (c = 0; c <= last; ++c) { if (topoProcs[c] == proc || (topoProcs[c] != NULL && - topoProcs[c]->lockGroupLeader == proc)) + topoProcs[c]->lockGroupLeader == proc)) { ordering[i - nmatches] = topoProcs[c]; topoProcs[c] = NULL; @@ -1106,7 +1106,7 @@ DeadLockReport(void) appendStringInfoChar(&clientbuf, '\n'); appendStringInfo(&clientbuf, - _("Process %d waits for %s on %s; blocked by process %d."), + _("Process %d waits for %s on %s; blocked by process %d."), info->pid, GetLockmodeName(info->locktag.locktag_lockmethodid, info->lockmode), @@ -1127,7 +1127,7 @@ DeadLockReport(void) appendStringInfo(&logbuf, _("Process %d: %s"), info->pid, - pgstat_get_backend_current_activity(info->pid, false)); + pgstat_get_backend_current_activity(info->pid, false)); } pgstat_report_deadlock(); diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index 34a4e913d7..b332890aee 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -341,7 +341,7 @@ PROCLOCK_PRINT(const char *where, const PROCLOCK *proclockP) #define LOCK_PRINT(where, lock, type) ((void) 0) #define PROCLOCK_PRINT(where, proclockP) ((void) 0) -#endif /* not LOCK_DEBUG */ +#endif /* not LOCK_DEBUG */ static uint32 proclock_hash(const void *key, Size keysize); @@ -406,7 +406,7 @@ InitLocks(void) init_table_size, max_table_size, &info, - HASH_ELEM | HASH_BLOBS | HASH_PARTITION); + HASH_ELEM | HASH_BLOBS | HASH_PARTITION); /* Assume an average of 2 holders per lock */ max_table_size *= 2; @@ -425,7 +425,7 @@ InitLocks(void) init_table_size, max_table_size, &info, - HASH_ELEM | HASH_FUNCTION | HASH_PARTITION); + HASH_ELEM | HASH_FUNCTION | HASH_PARTITION); /* * Allocate fast-path structures. @@ -600,7 +600,7 @@ LockHasWaiters(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) /* * Find the LOCALLOCK entry for this lock and lockmode */ - MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ + MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ localtag.lock = *locktag; localtag.mode = lockmode; @@ -792,7 +792,7 @@ LockAcquireExtendedXC(const LOCKTAG *locktag, /* * Find or create a LOCALLOCK entry for this lock and lockmode */ - MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ + MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ localtag.lock = *locktag; localtag.mode = lockmode; @@ -815,7 +815,7 @@ LockAcquireExtendedXC(const LOCKTAG *locktag, locallock->lockOwners = NULL; /* in case next line fails */ locallock->lockOwners = (LOCALLOCKOWNER *) MemoryContextAlloc(TopMemoryContext, - locallock->maxLockOwners * sizeof(LOCALLOCKOWNER)); + locallock->maxLockOwners * sizeof(LOCALLOCKOWNER)); } else { @@ -1261,7 +1261,7 @@ SetupLockInTable(LockMethod lockMethodTable, PGPROC *proc, } } } -#endif /* CHECK_DEADLOCK_RISK */ +#endif /* CHECK_DEADLOCK_RISK */ } /* @@ -1966,7 +1966,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) /* * Find the LOCALLOCK entry for this lock and lockmode */ - MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ + MemSet(&localtag, 0, sizeof(localtag)); /* must clear padding */ localtag.lock = *locktag; localtag.mode = lockmode; @@ -2331,7 +2331,7 @@ LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks) LWLockAcquire(partitionLock, LW_EXCLUSIVE); for (proclock = (PROCLOCK *) SHMQueueNext(procLocks, procLocks, - offsetof(PROCLOCK, procLink)); + offsetof(PROCLOCK, procLink)); proclock; proclock = nextplock) { @@ -2729,7 +2729,7 @@ FastPathTransferRelationLocks(LockMethod lockMethodTable, const LOCKTAG *locktag /* Find or create lock object. */ LWLockAcquire(partitionLock, LW_EXCLUSIVE); for (lockmode = FAST_PATH_LOCKNUMBER_OFFSET; - lockmode < FAST_PATH_LOCKNUMBER_OFFSET + FAST_PATH_BITS_PER_SLOT; + lockmode < FAST_PATH_LOCKNUMBER_OFFSET + FAST_PATH_BITS_PER_SLOT; ++lockmode) { PROCLOCK *proclock; @@ -2896,7 +2896,7 @@ GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode) if (vxids == NULL) vxids = (VirtualTransactionId *) MemoryContextAlloc(TopMemoryContext, - sizeof(VirtualTransactionId) * (MaxBackends + 1)); + sizeof(VirtualTransactionId) * (MaxBackends + 1)); } else vxids = (VirtualTransactionId *) @@ -3394,7 +3394,7 @@ PostPrepare_Locks(TransactionId xid) LWLockAcquire(partitionLock, LW_EXCLUSIVE); for (proclock = (PROCLOCK *) SHMQueueNext(procLocks, procLocks, - offsetof(PROCLOCK, procLink)); + offsetof(PROCLOCK, procLink)); proclock; proclock = nextplock) { @@ -4047,7 +4047,7 @@ DumpAllLocks(void) elog(LOG, "DumpAllLocks: proclock->tag.myLock = NULL"); } } -#endif /* LOCK_DEBUG */ +#endif /* LOCK_DEBUG */ /* * LOCK 2PC resource manager's routines @@ -4126,7 +4126,7 @@ lock_twophase_recover(TransactionId xid, uint16 info, ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of shared memory"), - errhint("You might need to increase max_locks_per_transaction."))); + errhint("You might need to increase max_locks_per_transaction."))); } /* @@ -4191,7 +4191,7 @@ lock_twophase_recover(TransactionId xid, uint16 info, ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("out of shared memory"), - errhint("You might need to increase max_locks_per_transaction."))); + errhint("You might need to increase max_locks_per_transaction."))); } /* @@ -4280,8 +4280,8 @@ lock_twophase_standby_recover(TransactionId xid, uint16 info, locktag->locktag_type == LOCKTAG_RELATION) { StandbyAcquireAccessExclusiveLock(xid, - locktag->locktag_field1 /* dboid */ , - locktag->locktag_field2 /* reloid */ ); + locktag->locktag_field1 /* dboid */ , + locktag->locktag_field2 /* reloid */ ); } } diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index 655c05c7a7..6426dd92ca 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -172,7 +172,7 @@ typedef struct lwlock_stats_key { int tranche; void *instance; -} lwlock_stats_key; +} lwlock_stats_key; typedef struct lwlock_stats { @@ -182,7 +182,7 @@ typedef struct lwlock_stats int block_count; int dequeue_self_count; int spin_delay_count; -} lwlock_stats; +} lwlock_stats; static HTAB *lwlock_stats_htab; static lwlock_stats lwlock_stats_dummy; @@ -230,13 +230,13 @@ LOG_LWDEBUG(const char *where, LWLock *lock, const char *msg) #else /* not LOCK_DEBUG */ #define PRINT_LWDEBUG(a,b,c) ((void)0) #define LOG_LWDEBUG(a,b,c) ((void)0) -#endif /* LOCK_DEBUG */ +#endif /* LOCK_DEBUG */ #ifdef LWLOCK_STATS static void init_lwlock_stats(void); static void print_lwlock_stats(int code, Datum arg); -static lwlock_stats *get_lwlock_stats_entry(LWLock *lockid); +static lwlock_stats * get_lwlock_stats_entry(LWLock *lockid); static void init_lwlock_stats(void) @@ -327,7 +327,7 @@ get_lwlock_stats_entry(LWLock *lock) } return lwstats; } -#endif /* LWLOCK_STATS */ +#endif /* LWLOCK_STATS */ /* @@ -857,7 +857,7 @@ LWLockWaitListLock(LWLock *lock) static void LWLockWaitListUnlock(LWLock *lock) { - uint32 old_state PG_USED_FOR_ASSERTS_ONLY; + uint32 old_state PG_USED_FOR_ASSERTS_ONLY; old_state = pg_atomic_fetch_and_u32(&lock->state, ~LW_FLAG_LOCKED); @@ -1098,7 +1098,7 @@ LWLockDequeueSelf(LWLock *lock) #ifdef LOCK_DEBUG { /* not waiting anymore */ - uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1); + uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1); Assert(nwaiters < MAX_BACKENDS); } @@ -1135,7 +1135,7 @@ LWLockAcquire(LWLock *lock, LWLockMode mode) lwstats->ex_acquire_count++; else lwstats->sh_acquire_count++; -#endif /* LWLOCK_STATS */ +#endif /* LWLOCK_STATS */ /* * We can't wait if we haven't got a PGPROC. This should only occur @@ -1248,7 +1248,7 @@ LWLockAcquire(LWLock *lock, LWLockMode mode) #ifdef LOCK_DEBUG { /* not waiting anymore */ - uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1); + uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1); Assert(nwaiters < MAX_BACKENDS); } @@ -1406,7 +1406,7 @@ LWLockAcquireOrWait(LWLock *lock, LWLockMode mode) #ifdef LOCK_DEBUG { /* not waiting anymore */ - uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1); + uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1); Assert(nwaiters < MAX_BACKENDS); } @@ -1622,7 +1622,7 @@ LWLockWaitForVar(LWLock *lock, uint64 *valptr, uint64 oldval, uint64 *newval) #ifdef LOCK_DEBUG { /* not waiting anymore */ - uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1); + uint32 nwaiters PG_USED_FOR_ASSERTS_ONLY = pg_atomic_fetch_sub_u32(&lock->nwaiters, 1); Assert(nwaiters < MAX_BACKENDS); } diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c index 38c2e493a5..440c003e22 100644 --- a/src/backend/storage/lmgr/predicate.c +++ b/src/backend/storage/lmgr/predicate.c @@ -337,7 +337,7 @@ typedef struct OldSerXidControlData TransactionId headXid; /* newest valid Xid in the SLRU */ TransactionId tailXid; /* oldest xmin we might be interested in */ bool warningIssued; /* have we issued SLRU wrap-around warning? */ -} OldSerXidControlData; +} OldSerXidControlData; typedef struct OldSerXidControlData *OldSerXidControl; @@ -358,9 +358,9 @@ static SERIALIZABLEXACT *OldCommittedSxact; * attempt to degrade performance (mostly as false positive serialization * failure) gracefully in the face of memory pressurel */ -int max_predicate_locks_per_xact; /* set by guc.c */ +int max_predicate_locks_per_xact; /* set by guc.c */ int max_predicate_locks_per_relation; /* set by guc.c */ -int max_predicate_locks_per_page; /* set by guc.c */ +int max_predicate_locks_per_page; /* set by guc.c */ /* * This provides a list of objects in order to track transactions @@ -1474,7 +1474,7 @@ SummarizeOldestCommittedSxact(void) /* Add to SLRU summary information. */ if (TransactionIdIsValid(sxact->topXid) && !SxactIsReadOnly(sxact)) OldSerXidAdd(sxact->topXid, SxactHasConflictOut(sxact) - ? sxact->SeqNo.earliestOutConflictCommit : InvalidSerCommitSeqNo); + ? sxact->SeqNo.earliestOutConflictCommit : InvalidSerCommitSeqNo); /* Summarize and release the detail. */ ReleaseOneSerializableXact(sxact, false, true); @@ -1754,8 +1754,8 @@ GetSerializableTransactionSnapshotInt(Snapshot snapshot, ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("could not import the requested snapshot"), - errdetail("The source process with pid %d is not running anymore.", - sourcepid))); + errdetail("The source process with pid %d is not running anymore.", + sourcepid))); } /* @@ -1987,17 +1987,17 @@ GetParentPredicateLockTag(const PREDICATELOCKTARGETTAG *tag, case PREDLOCKTAG_PAGE: /* parent lock is relation lock */ SET_PREDICATELOCKTARGETTAG_RELATION(*parent, - GET_PREDICATELOCKTARGETTAG_DB(*tag), - GET_PREDICATELOCKTARGETTAG_RELATION(*tag)); + GET_PREDICATELOCKTARGETTAG_DB(*tag), + GET_PREDICATELOCKTARGETTAG_RELATION(*tag)); return true; case PREDLOCKTAG_TUPLE: /* parent lock is page lock */ SET_PREDICATELOCKTARGETTAG_PAGE(*parent, - GET_PREDICATELOCKTARGETTAG_DB(*tag), - GET_PREDICATELOCKTARGETTAG_RELATION(*tag), - GET_PREDICATELOCKTARGETTAG_PAGE(*tag)); + GET_PREDICATELOCKTARGETTAG_DB(*tag), + GET_PREDICATELOCKTARGETTAG_RELATION(*tag), + GET_PREDICATELOCKTARGETTAG_PAGE(*tag)); return true; } @@ -2393,7 +2393,7 @@ CreatePredicateLock(const PREDICATELOCKTARGETTAG *targettag, locktag.myXact = sxact; lock = (PREDICATELOCK *) hash_search_with_hash_value(PredicateLockHash, &locktag, - PredicateLockHashCodeFromTargetHashCode(&locktag, targettaghash), + PredicateLockHashCodeFromTargetHashCode(&locktag, targettaghash), HASH_ENTER_NULL, &found); if (!lock) ereport(ERROR, @@ -2774,8 +2774,8 @@ TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag, hash_search_with_hash_value (PredicateLockHash, &oldpredlock->tag, - PredicateLockHashCodeFromTargetHashCode(&oldpredlock->tag, - oldtargettaghash), + PredicateLockHashCodeFromTargetHashCode(&oldpredlock->tag, + oldtargettaghash), HASH_REMOVE, &found); Assert(found); } @@ -2783,8 +2783,8 @@ TransferPredicateLocksToNewTarget(PREDICATELOCKTARGETTAG oldtargettag, newpredlock = (PREDICATELOCK *) hash_search_with_hash_value(PredicateLockHash, &newpredlocktag, - PredicateLockHashCodeFromTargetHashCode(&newpredlocktag, - newtargettaghash), + PredicateLockHashCodeFromTargetHashCode(&newpredlocktag, + newtargettaghash), HASH_ENTER_NULL, &found); if (!newpredlock) @@ -2914,8 +2914,8 @@ DropAllPredicateLocksFromTable(Relation relation, bool transfer) heapId = relation->rd_index->indrelid; } Assert(heapId != InvalidOid); - Assert(transfer || !isIndex); /* index OID only makes sense with - * transfer */ + Assert(transfer || !isIndex); /* index OID only makes sense with + * transfer */ /* Retrieve first time needed, then keep. */ heaptargettaghash = 0; @@ -3024,8 +3024,8 @@ DropAllPredicateLocksFromTable(Relation relation, bool transfer) newpredlock = (PREDICATELOCK *) hash_search_with_hash_value(PredicateLockHash, &newpredlocktag, - PredicateLockHashCodeFromTargetHashCode(&newpredlocktag, - heaptargettaghash), + PredicateLockHashCodeFromTargetHashCode(&newpredlocktag, + heaptargettaghash), HASH_ENTER, &found); if (!found) @@ -3605,7 +3605,7 @@ ClearOldPredicateLocks(void) LWLockAcquire(SerializableXactHashLock, LW_SHARED); } else if (finishedSxact->commitSeqNo > PredXact->HavePartialClearedThrough - && finishedSxact->commitSeqNo <= PredXact->CanPartialClearThrough) + && finishedSxact->commitSeqNo <= PredXact->CanPartialClearThrough) { /* * Any active transactions that took their snapshot before this @@ -3690,8 +3690,8 @@ ClearOldPredicateLocks(void) SHMQueueDelete(&(predlock->xactLink)); hash_search_with_hash_value(PredicateLockHash, &tag, - PredicateLockHashCodeFromTargetHashCode(&tag, - targettaghash), + PredicateLockHashCodeFromTargetHashCode(&tag, + targettaghash), HASH_REMOVE, NULL); RemoveTargetIfNoLongerUsed(target, targettaghash); @@ -3774,8 +3774,8 @@ ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial, SHMQueueDelete(targetLink); hash_search_with_hash_value(PredicateLockHash, &tag, - PredicateLockHashCodeFromTargetHashCode(&tag, - targettaghash), + PredicateLockHashCodeFromTargetHashCode(&tag, + targettaghash), HASH_REMOVE, NULL); if (summarize) { @@ -3784,8 +3784,8 @@ ReleaseOneSerializableXact(SERIALIZABLEXACT *sxact, bool partial, /* Fold into dummy transaction list. */ tag.myXact = OldCommittedSxact; predlock = hash_search_with_hash_value(PredicateLockHash, &tag, - PredicateLockHashCodeFromTargetHashCode(&tag, - targettaghash), + PredicateLockHashCodeFromTargetHashCode(&tag, + targettaghash), HASH_ENTER_NULL, &found); if (!predlock) ereport(ERROR, @@ -4036,7 +4036,7 @@ CheckForSerializableConflictOut(bool visible, Relation relation, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), errdetail_internal("Reason code: Canceled on conflict out to old pivot %u.", xid), - errhint("The transaction might succeed if retried."))); + errhint("The transaction might succeed if retried."))); if (SxactHasSummaryConflictIn(MySerializableXact) || !SHMQueueEmpty(&MySerializableXact->inConflicts)) @@ -4044,7 +4044,7 @@ CheckForSerializableConflictOut(bool visible, Relation relation, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), errmsg("could not serialize access due to read/write dependencies among transactions"), errdetail_internal("Reason code: Canceled on identification as a pivot, with conflict out to old committed transaction %u.", xid), - errhint("The transaction might succeed if retried."))); + errhint("The transaction might succeed if retried."))); MySerializableXact->flags |= SXACT_FLAG_SUMMARY_CONFLICT_OUT; } @@ -4344,8 +4344,8 @@ CheckForSerializableConflictIn(Relation relation, HeapTuple tuple, SET_PREDICATELOCKTARGETTAG_TUPLE(targettag, relation->rd_node.dbNode, relation->rd_id, - ItemPointerGetBlockNumber(&(tuple->t_self)), - ItemPointerGetOffsetNumber(&(tuple->t_self))); + ItemPointerGetBlockNumber(&(tuple->t_self)), + ItemPointerGetOffsetNumber(&(tuple->t_self))); CheckTargetForConflictsIn(&targettag); } @@ -4460,7 +4460,7 @@ CheckTableForSerializableConflictIn(Relation relation) offsetof(PREDICATELOCK, targetLink)); if (predlock->tag.myXact != MySerializableXact - && !RWConflictExists(predlock->tag.myXact, MySerializableXact)) + && !RWConflictExists(predlock->tag.myXact, MySerializableXact)) { FlagRWConflict(predlock->tag.myXact, MySerializableXact); } @@ -4541,7 +4541,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader, *------------------------------------------------------------------------ */ if (SxactIsCommitted(writer) - && (SxactHasConflictOut(writer) || SxactHasSummaryConflictOut(writer))) + && (SxactHasConflictOut(writer) || SxactHasSummaryConflictOut(writer))) failure = true; /*------------------------------------------------------------------------ @@ -4585,7 +4585,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader, && (!SxactIsCommitted(writer) || t2->prepareSeqNo <= writer->commitSeqNo) && (!SxactIsReadOnly(reader) - || t2->prepareSeqNo <= reader->SeqNo.lastCommitBeforeSnapshot)) + || t2->prepareSeqNo <= reader->SeqNo.lastCommitBeforeSnapshot)) { failure = true; break; @@ -4630,7 +4630,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader, && (!SxactIsCommitted(t0) || t0->commitSeqNo >= writer->prepareSeqNo) && (!SxactIsReadOnly(t0) - || t0->SeqNo.lastCommitBeforeSnapshot >= writer->prepareSeqNo)) + || t0->SeqNo.lastCommitBeforeSnapshot >= writer->prepareSeqNo)) { failure = true; break; diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 410c31fe99..5c3840dc8f 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -291,7 +291,7 @@ InitProcGlobal(void) void InitProcess(void) { - PGPROC *volatile * procgloballist; + PGPROC *volatile *procgloballist; /* * ProcGlobal should be set up already (if we are a backend, we inherit @@ -802,7 +802,7 @@ static void ProcKill(int code, Datum arg) { PGPROC *proc; - PGPROC *volatile * procgloballist; + PGPROC *volatile *procgloballist; Assert(MyProc != NULL); @@ -1321,8 +1321,8 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) appendStringInfo(&logbuf, _("Process %d waits for %s on %s."), MyProcPid, - GetLockmodeName(lock->tag.locktag_lockmethodid, - lockmode), + GetLockmodeName(lock->tag.locktag_lockmethodid, + lockmode), locktagbuf.data); /* release lock as quickly as possible */ @@ -1330,9 +1330,9 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) /* send the autovacuum worker Back to Old Kent Road */ ereport(DEBUG1, - (errmsg("sending cancel to blocking autovacuum PID %d", - pid), - errdetail_log("%s", logbuf.data))); + (errmsg("sending cancel to blocking autovacuum PID %d", + pid), + errdetail_log("%s", logbuf.data))); if (kill(pid, SIGINT) < 0) { @@ -1348,8 +1348,8 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) */ if (errno != ESRCH) ereport(WARNING, - (errmsg("could not send signal to process %d: %m", - pid))); + (errmsg("could not send signal to process %d: %m", + pid))); } pfree(logbuf.data); @@ -1407,7 +1407,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) procLocks = &(lock->procLocks); proclock = (PROCLOCK *) SHMQueueNext(procLocks, procLocks, - offsetof(PROCLOCK, lockLink)); + offsetof(PROCLOCK, lockLink)); while (proclock) { @@ -1443,7 +1443,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) } proclock = (PROCLOCK *) SHMQueueNext(procLocks, &proclock->lockLink, - offsetof(PROCLOCK, lockLink)); + offsetof(PROCLOCK, lockLink)); } LWLockRelease(partitionLock); @@ -1453,7 +1453,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) (errmsg("process %d avoided deadlock for %s on %s by rearranging queue order after %ld.%03d ms", MyProcPid, modename, buf.data, msecs, usecs), (errdetail_log_plural("Process holding the lock: %s. Wait queue: %s.", - "Processes holding the lock: %s. Wait queue: %s.", + "Processes holding the lock: %s. Wait queue: %s.", lockHoldersNum, lock_holders_sbuf.data, lock_waiters_sbuf.data)))); else if (deadlock_state == DS_HARD_DEADLOCK) { @@ -1468,7 +1468,7 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) (errmsg("process %d detected deadlock while waiting for %s on %s after %ld.%03d ms", MyProcPid, modename, buf.data, msecs, usecs), (errdetail_log_plural("Process holding the lock: %s. Wait queue: %s.", - "Processes holding the lock: %s. Wait queue: %s.", + "Processes holding the lock: %s. Wait queue: %s.", lockHoldersNum, lock_holders_sbuf.data, lock_waiters_sbuf.data)))); } @@ -1477,12 +1477,12 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) (errmsg("process %d still waiting for %s on %s after %ld.%03d ms", MyProcPid, modename, buf.data, msecs, usecs), (errdetail_log_plural("Process holding the lock: %s. Wait queue: %s.", - "Processes holding the lock: %s. Wait queue: %s.", + "Processes holding the lock: %s. Wait queue: %s.", lockHoldersNum, lock_holders_sbuf.data, lock_waiters_sbuf.data)))); else if (myWaitStatus == STATUS_OK) ereport(LOG, - (errmsg("process %d acquired %s on %s after %ld.%03d ms", - MyProcPid, modename, buf.data, msecs, usecs))); + (errmsg("process %d acquired %s on %s after %ld.%03d ms", + MyProcPid, modename, buf.data, msecs, usecs))); else { Assert(myWaitStatus == STATUS_ERROR); @@ -1498,9 +1498,9 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable) if (deadlock_state != DS_HARD_DEADLOCK) ereport(LOG, (errmsg("process %d failed to acquire %s on %s after %ld.%03d ms", - MyProcPid, modename, buf.data, msecs, usecs), + MyProcPid, modename, buf.data, msecs, usecs), (errdetail_log_plural("Process holding the lock: %s. Wait queue: %s.", - "Processes holding the lock: %s. Wait queue: %s.", + "Processes holding the lock: %s. Wait queue: %s.", lockHoldersNum, lock_holders_sbuf.data, lock_waiters_sbuf.data)))); } diff --git a/src/backend/storage/lmgr/s_lock.c b/src/backend/storage/lmgr/s_lock.c index ac82e704fa..40d8156331 100644 --- a/src/backend/storage/lmgr/s_lock.c +++ b/src/backend/storage/lmgr/s_lock.c @@ -133,7 +133,7 @@ perform_spin_delay(SpinDelayStatus *status) if (++(status->delays) > NUM_DELAYS) s_lock_stuck(status->file, status->line, status->func); - if (status->cur_delay == 0) /* first time to delay? */ + if (status->cur_delay == 0) /* first time to delay? */ status->cur_delay = MIN_DELAY_USEC; pg_usleep(status->cur_delay); @@ -145,7 +145,7 @@ perform_spin_delay(SpinDelayStatus *status) /* increase delay by a random fraction between 1X and 2X */ status->cur_delay += (int) (status->cur_delay * - ((double) random() / (double) MAX_RANDOM_VALUE) + 0.5); + ((double) random() / (double) MAX_RANDOM_VALUE) + 0.5); /* wrap back to minimum delay when max is exceeded */ if (status->cur_delay > MAX_DELAY_USEC) status->cur_delay = MIN_DELAY_USEC; @@ -250,10 +250,10 @@ update_spins_per_delay(int shared_spins_per_delay) static void tas_dummy() { - __asm__ __volatile__( + __asm__ __volatile__( #if defined(__NetBSD__) && defined(__ELF__) /* no underscore for label and % for registers */ - "\ + "\ .global tas \n\ tas: \n\ movel %sp@(0x4),%a0 \n\ @@ -265,7 +265,7 @@ _success: \n\ moveq #0,%d0 \n\ rts \n" #else - "\ + "\ .global _tas \n\ _tas: \n\ movel sp@(0x4),a0 \n\ @@ -276,12 +276,12 @@ _tas: \n\ _success: \n\ moveq #0,d0 \n\ rts \n" -#endif /* __NetBSD__ && __ELF__ */ - ); +#endif /* __NetBSD__ && __ELF__ */ + ); } -#endif /* __m68k__ && !__linux__ */ -#endif /* not __GNUC__ */ -#endif /* HAVE_SPINLOCKS */ +#endif /* __m68k__ && !__linux__ */ +#endif /* not __GNUC__ */ +#endif /* HAVE_SPINLOCKS */ @@ -375,4 +375,4 @@ main() return 1; } -#endif /* S_LOCK_TEST */ +#endif /* S_LOCK_TEST */ diff --git a/src/backend/storage/lmgr/spin.c b/src/backend/storage/lmgr/spin.c index f7b1ac04f9..2c16938f5a 100644 --- a/src/backend/storage/lmgr/spin.c +++ b/src/backend/storage/lmgr/spin.c @@ -140,4 +140,4 @@ tas_sema(volatile slock_t *lock) return !PGSemaphoreTryLock(SpinlockSemaArray[lockndx - 1]); } -#endif /* !HAVE_SPINLOCKS */ +#endif /* !HAVE_SPINLOCKS */ diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c index 1b53d651cd..41642eb59c 100644 --- a/src/backend/storage/page/bufpage.c +++ b/src/backend/storage/page/bufpage.c @@ -237,7 +237,7 @@ PageAddItemExtended(Page page, else { if (offsetNumber < limit) - needshuffle = true; /* need to move existing linp's */ + needshuffle = true; /* need to move existing linp's */ } } else @@ -557,8 +557,8 @@ PageRepairFragmentation(Page page) if (totallen > (Size) (pd_special - pd_lower)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), - errmsg("corrupted item lengths: total %u, available space %u", - (unsigned int) totallen, pd_special - pd_lower))); + errmsg("corrupted item lengths: total %u, available space %u", + (unsigned int) totallen, pd_special - pd_lower))); compactify_tuples(itemidbase, nstorage, page); } @@ -902,8 +902,8 @@ PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems) offset != MAXALIGN(offset)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), - errmsg("corrupted item pointer: offset = %u, length = %u", - offset, (unsigned int) size))); + errmsg("corrupted item pointer: offset = %u, length = %u", + offset, (unsigned int) size))); if (nextitm < nitems && offnum == itemnos[nextitm]) { @@ -912,7 +912,7 @@ PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems) } else { - itemidptr->offsetindex = nused; /* where it will go */ + itemidptr->offsetindex = nused; /* where it will go */ itemidptr->itemoff = offset; itemidptr->alignedlen = MAXALIGN(size); totallen += itemidptr->alignedlen; @@ -929,8 +929,8 @@ PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems) if (totallen > (Size) (pd_special - pd_lower)) ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), - errmsg("corrupted item lengths: total %u, available space %u", - (unsigned int) totallen, pd_special - pd_lower))); + errmsg("corrupted item lengths: total %u, available space %u", + (unsigned int) totallen, pd_special - pd_lower))); /* * Looks good. Overwrite the line pointers with the copy, from which we've diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 9bc00b6214..65e0abe9ec 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -154,7 +154,7 @@ typedef struct static HTAB *pendingOpsTable = NULL; static List *pendingUnlinks = NIL; -static MemoryContext pendingOpsCxt; /* context for the above */ +static MemoryContext pendingOpsCxt; /* context for the above */ static CycleCtr mdsync_cycle_ctr = 0; static CycleCtr mdckpt_cycle_ctr = 0; @@ -472,7 +472,7 @@ mdunlinkfork(RelFileNodeBackend rnode, ForkNumber forkNum, bool isRedo) if (errno != ENOENT) ereport(WARNING, (errcode_for_file_access(), - errmsg("could not remove file \"%s\": %m", segpath))); + errmsg("could not remove file \"%s\": %m", segpath))); break; } } @@ -518,7 +518,7 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, v = _mdfd_getseg(reln, forknum, blocknum, skipFsync, EXTENSION_CREATE); - seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE)); + seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)); Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE); @@ -664,12 +664,12 @@ mdprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum) v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL); - seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE)); + seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)); Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE); (void) FilePrefetch(v->mdfd_vfd, seekpos, BLCKSZ, WAIT_EVENT_DATA_FILE_PREFETCH); -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } /* @@ -715,7 +715,7 @@ mdwriteback(SMgrRelation reln, ForkNumber forknum, Assert(nflush >= 1); Assert(nflush <= nblocks); - seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE)); + seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)); FileWriteback(v->mdfd_vfd, seekpos, (off_t) BLCKSZ * nflush, WAIT_EVENT_DATA_FILE_FLUSH); @@ -744,7 +744,7 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL | EXTENSION_CREATE_RECOVERY); - seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE)); + seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)); Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE); @@ -820,7 +820,7 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, v = _mdfd_getseg(reln, forknum, blocknum, skipFsync, EXTENSION_FAIL | EXTENSION_CREATE_RECOVERY); - seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE)); + seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)); Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE); @@ -997,9 +997,9 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks) if (FileTruncate(v->mdfd_vfd, (off_t) lastsegblocks * BLCKSZ, WAIT_EVENT_DATA_FILE_TRUNCATE) < 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not truncate file \"%s\" to %u blocks: %m", - FilePathName(v->mdfd_vfd), - nblocks))); + errmsg("could not truncate file \"%s\" to %u blocks: %m", + FilePathName(v->mdfd_vfd), + nblocks))); if (!SmgrIsTemp(reln)) register_dirty_segment(reln, forknum, v); } @@ -1225,7 +1225,7 @@ mdsync(void) /* Attempt to open and fsync the target segment */ seg = _mdfd_getseg(reln, forknum, - (BlockNumber) segno * (BlockNumber) RELSEG_SIZE, + (BlockNumber) segno * (BlockNumber) RELSEG_SIZE, false, EXTENSION_RETURN_NULL | EXTENSION_DONT_CHECK_SIZE); @@ -1233,7 +1233,7 @@ mdsync(void) INSTR_TIME_SET_CURRENT(sync_start); if (seg != NULL && - FileSync(seg->mdfd_vfd, WAIT_EVENT_DATA_FILE_SYNC) >= 0) + FileSync(seg->mdfd_vfd, WAIT_EVENT_DATA_FILE_SYNC) >= 0) { /* Success; update statistics about sync timing */ INSTR_TIME_SET_CURRENT(sync_end); @@ -1279,8 +1279,8 @@ mdsync(void) else ereport(DEBUG1, (errcode_for_file_access(), - errmsg("could not fsync file \"%s\" but retrying: %m", - path))); + errmsg("could not fsync file \"%s\" but retrying: %m", + path))); pfree(path); /* @@ -1925,9 +1925,9 @@ _mdfd_getseg(SMgrRelation reln, ForkNumber forknum, BlockNumber blkno, return NULL; ereport(ERROR, (errcode_for_file_access(), - errmsg("could not open file \"%s\" (target block %u): %m", - _mdfd_segpath(reln, forknum, nextsegno), - blkno))); + errmsg("could not open file \"%s\" (target block %u): %m", + _mdfd_segpath(reln, forknum, nextsegno), + blkno))); } } diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index 0ed1fe91d5..0ca095c4d6 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -38,30 +38,30 @@ typedef struct f_smgr { void (*smgr_init) (void); /* may be NULL */ - void (*smgr_shutdown) (void); /* may be NULL */ + void (*smgr_shutdown) (void); /* may be NULL */ void (*smgr_close) (SMgrRelation reln, ForkNumber forknum); void (*smgr_create) (SMgrRelation reln, ForkNumber forknum, - bool isRedo); + bool isRedo); bool (*smgr_exists) (SMgrRelation reln, ForkNumber forknum); void (*smgr_unlink) (RelFileNodeBackend rnode, ForkNumber forknum, - bool isRedo); + bool isRedo); void (*smgr_extend) (SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer, bool skipFsync); + BlockNumber blocknum, char *buffer, bool skipFsync); void (*smgr_prefetch) (SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum); + BlockNumber blocknum); void (*smgr_read) (SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer); + BlockNumber blocknum, char *buffer); void (*smgr_write) (SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, char *buffer, bool skipFsync); + BlockNumber blocknum, char *buffer, bool skipFsync); void (*smgr_writeback) (SMgrRelation reln, ForkNumber forknum, - BlockNumber blocknum, BlockNumber nblocks); + BlockNumber blocknum, BlockNumber nblocks); BlockNumber (*smgr_nblocks) (SMgrRelation reln, ForkNumber forknum); void (*smgr_truncate) (SMgrRelation reln, ForkNumber forknum, - BlockNumber nblocks); + BlockNumber nblocks); void (*smgr_immedsync) (SMgrRelation reln, ForkNumber forknum); - void (*smgr_pre_ckpt) (void); /* may be NULL */ + void (*smgr_pre_ckpt) (void); /* may be NULL */ void (*smgr_sync) (void); /* may be NULL */ - void (*smgr_post_ckpt) (void); /* may be NULL */ + void (*smgr_post_ckpt) (void); /* may be NULL */ } f_smgr; diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c index 5f272d8448..9207d76981 100644 --- a/src/backend/tcop/fastpath.c +++ b/src/backend/tcop/fastpath.c @@ -54,13 +54,13 @@ struct fp_info Oid namespace; /* other stuff from pg_proc */ Oid rettype; Oid argtypes[FUNC_MAX_ARGS]; - char fname[NAMEDATALEN]; /* function name for logging */ + char fname[NAMEDATALEN]; /* function name for logging */ }; -static int16 parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip, +static int16 parse_fcall_arguments(StringInfo msgBuf, struct fp_info *fip, FunctionCallInfo fcinfo); -static int16 parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info * fip, +static int16 parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info *fip, FunctionCallInfo fcinfo); @@ -108,8 +108,8 @@ GetOldFunctionMessage(StringInfo buf) /* FATAL here since no hope of regaining message sync */ ereport(FATAL, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid argument size %d in function call message", - argsize))); + errmsg("invalid argument size %d in function call message", + argsize))); } /* and arg contents */ if (argsize > 0) @@ -195,7 +195,7 @@ SendFunctionResult(Datum retval, bool isnull, Oid rettype, int16 format) * function 'func_id'. */ static void -fetch_fp_info(Oid func_id, struct fp_info * fip) +fetch_fp_info(Oid func_id, struct fp_info *fip) { HeapTuple func_htp; Form_pg_proc pp; @@ -293,7 +293,7 @@ HandleFunctionRequest(StringInfo msgBuf) if (PG_PROTOCOL_MAJOR(FrontendProtocol) < 3) (void) pq_getmsgstring(msgBuf); /* dummy string */ - fid = (Oid) pq_getmsgint(msgBuf, 4); /* function oid */ + fid = (Oid) pq_getmsgint(msgBuf, 4); /* function oid */ /* * There used to be a lame attempt at caching lookup info here. Now we @@ -405,7 +405,7 @@ HandleFunctionRequest(StringInfo msgBuf) * is returned. */ static int16 -parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip, +parse_fcall_arguments(StringInfo msgBuf, struct fp_info *fip, FunctionCallInfo fcinfo) { int nargs; @@ -460,8 +460,8 @@ parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip, if (argsize < 0) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid argument size %d in function call message", - argsize))); + errmsg("invalid argument size %d in function call message", + argsize))); /* Reset abuf to empty, and insert raw data into it */ resetStringInfo(&abuf); @@ -523,8 +523,8 @@ parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip, if (argsize != -1 && abuf.cursor != abuf.len) ereport(ERROR, (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), - errmsg("incorrect binary data format in function argument %d", - i + 1))); + errmsg("incorrect binary data format in function argument %d", + i + 1))); } else ereport(ERROR, @@ -543,7 +543,7 @@ parse_fcall_arguments(StringInfo msgBuf, struct fp_info * fip, * is returned. */ static int16 -parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info * fip, +parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info *fip, FunctionCallInfo fcinfo) { int nargs; @@ -590,8 +590,8 @@ parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info * fip, if (argsize < 0) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid argument size %d in function call message", - argsize))); + errmsg("invalid argument size %d in function call message", + argsize))); /* Reset abuf to empty, and insert raw data into it */ resetStringInfo(&abuf); @@ -606,8 +606,8 @@ parse_fcall_arguments_20(StringInfo msgBuf, struct fp_info * fip, if (abuf.cursor != abuf.len) ereport(ERROR, (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), - errmsg("incorrect binary data format in function argument %d", - i + 1))); + errmsg("incorrect binary data format in function argument %d", + i + 1))); } /* Desired result format is always binary in protocol 2.0 */ diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 8c7beaf201..4bd9564326 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -172,7 +172,7 @@ static CachedPlanSource *unnamed_stmt_psrc = NULL; /* assorted command-line switches */ static const char *userDoption = NULL; /* -D switch */ static bool EchoQuery = false; /* -E switch */ -static bool UseSemiNewlineNewline = false; /* -j switch */ +static bool UseSemiNewlineNewline = false; /* -j switch */ /* whether or not, and why, we were canceled by conflict with recovery */ static bool RecoveryConflictPending = false; @@ -511,7 +511,7 @@ SocketBackend(StringInfo inBuf) whereToSendOutput = DestNone; ereport(DEBUG1, (errcode(ERRCODE_CONNECTION_DOES_NOT_EXIST), - errmsg("unexpected EOF on client connection"))); + errmsg("unexpected EOF on client connection"))); } return EOF; } @@ -538,7 +538,7 @@ SocketBackend(StringInfo inBuf) whereToSendOutput = DestNone; ereport(DEBUG1, (errcode(ERRCODE_CONNECTION_DOES_NOT_EXIST), - errmsg("unexpected EOF on client connection"))); + errmsg("unexpected EOF on client connection"))); } return EOF; } @@ -826,7 +826,7 @@ pg_analyze_and_rewrite_params(RawStmt *parsetree, Query *query; List *querytree_list; - Assert(query_string != NULL); /* required as of 8.4 */ + Assert(query_string != NULL); /* required as of 8.4 */ TRACE_POSTGRESQL_QUERY_REWRITE_START(query_string); @@ -1199,7 +1199,7 @@ exec_simple_query(const char *query_string) ereport(ERROR, (errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION), errmsg("current transaction is aborted, " - "commands ignored until end of transaction block"), + "commands ignored until end of transaction block"), errdetail_abort())); /* Make sure we are in a transaction command */ @@ -1421,10 +1421,10 @@ exec_simple_query(const char *query_string) */ static void exec_parse_message(const char *query_string, /* string to execute */ - const char *stmt_name, /* name for prepared stmt */ - Oid *paramTypes, /* parameter types */ + const char *stmt_name, /* name for prepared stmt */ + Oid *paramTypes, /* parameter types */ char **paramTypeNames, /* parameter type names */ - int numParams) /* number of parameters */ + int numParams) /* number of parameters */ { MemoryContext unnamed_stmt_context = NULL; MemoryContext oldcontext; @@ -1523,7 +1523,7 @@ exec_parse_message(const char *query_string, /* string to execute */ if (list_length(parsetree_list) > 1) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("cannot insert multiple commands into a prepared statement"))); + errmsg("cannot insert multiple commands into a prepared statement"))); if (parsetree_list != NIL) { @@ -1551,7 +1551,7 @@ exec_parse_message(const char *query_string, /* string to execute */ ereport(ERROR, (errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION), errmsg("current transaction is aborted, " - "commands ignored until end of transaction block"), + "commands ignored until end of transaction block"), errdetail_abort())); /* @@ -1596,8 +1596,8 @@ exec_parse_message(const char *query_string, /* string to execute */ if (ptype == InvalidOid || ptype == UNKNOWNOID) ereport(ERROR, (errcode(ERRCODE_INDETERMINATE_DATATYPE), - errmsg("could not determine data type of parameter $%d", - i + 1))); + errmsg("could not determine data type of parameter $%d", + i + 1))); } if (log_parser_stats) @@ -1942,8 +1942,8 @@ exec_bind_message(StringInfo input_message) if (numPFormats > 1 && numPFormats != numParams) ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("bind message has %d parameter formats but %d parameters", - numPFormats, numParams))); + errmsg("bind message has %d parameter formats but %d parameters", + numPFormats, numParams))); if (numParams != psrc->num_params) ereport(ERROR, @@ -2062,7 +2062,7 @@ exec_bind_message(StringInfo input_message) } else { - pbuf.data = NULL; /* keep compiler quiet */ + pbuf.data = NULL; /* keep compiler quiet */ csave = 0; } @@ -2096,7 +2096,7 @@ exec_bind_message(StringInfo input_message) if (pstring && pstring != pbuf.data) pfree(pstring); } - else if (pformat == 1) /* binary mode */ + else if (pformat == 1) /* binary mode */ { Oid typreceive; Oid typioparam; @@ -2961,7 +2961,7 @@ drop_unnamed_stmt(void) void quickdie(SIGNAL_ARGS) { - sigaddset(&BlockSig, SIGQUIT); /* prevent nested calls */ + sigaddset(&BlockSig, SIGQUIT); /* prevent nested calls */ PG_SETMASK(&BlockSig); /* @@ -2987,10 +2987,10 @@ quickdie(SIGNAL_ARGS) ereport(WARNING, (errcode(ERRCODE_CRASH_SHUTDOWN), errmsg("terminating connection because of crash of another server process"), - errdetail("The postmaster has commanded this server process to roll back" - " the current transaction and exit, because another" - " server process exited abnormally and possibly corrupted" - " shared memory."), + errdetail("The postmaster has commanded this server process to roll back" + " the current transaction and exit, because another" + " server process exited abnormally and possibly corrupted" + " shared memory."), errhint("In a moment you should be able to reconnect to the" " database and repeat your command."))); @@ -3247,7 +3247,7 @@ ProcessInterrupts(void) if (ProcDiePending) { ProcDiePending = false; - QueryCancelPending = false; /* ProcDie trumps QueryCancel */ + QueryCancelPending = false; /* ProcDie trumps QueryCancel */ LockErrorCleanup(); /* As in quickdie, don't risk sending to client during auth */ if (ClientAuthInProgress && whereToSendOutput == DestRemote) @@ -3269,15 +3269,18 @@ ProcessInterrupts(void) ereport(DEBUG1, (errmsg("logical replication launcher shutting down"))); - /* The logical replication launcher can be stopped at any time. */ - proc_exit(0); + /* + * The logical replication launcher can be stopped at any time. + * Use exit status 1 so the background worker is restarted. + */ + proc_exit(1); } else if (RecoveryConflictPending && RecoveryConflictRetryable) { pgstat_report_recovery_conflict(RecoveryConflictReason); ereport(FATAL, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), - errmsg("terminating connection due to conflict with recovery"), + errmsg("terminating connection due to conflict with recovery"), errdetail_recovery_conflict())); } else if (RecoveryConflictPending) @@ -3287,17 +3290,17 @@ ProcessInterrupts(void) pgstat_report_recovery_conflict(RecoveryConflictReason); ereport(FATAL, (errcode(ERRCODE_DATABASE_DROPPED), - errmsg("terminating connection due to conflict with recovery"), + errmsg("terminating connection due to conflict with recovery"), errdetail_recovery_conflict())); } else ereport(FATAL, (errcode(ERRCODE_ADMIN_SHUTDOWN), - errmsg("terminating connection due to administrator command"))); + errmsg("terminating connection due to administrator command"))); } if (ClientConnectionLost) { - QueryCancelPending = false; /* lost connection trumps QueryCancel */ + QueryCancelPending = false; /* lost connection trumps QueryCancel */ LockErrorCleanup(); /* don't send to client, we already know the connection to be dead. */ whereToSendOutput = DestNone; @@ -3314,13 +3317,13 @@ ProcessInterrupts(void) */ if (RecoveryConflictPending && DoingCommandRead) { - QueryCancelPending = false; /* this trumps QueryCancel */ + QueryCancelPending = false; /* this trumps QueryCancel */ RecoveryConflictPending = false; LockErrorCleanup(); pgstat_report_recovery_conflict(RecoveryConflictReason); ereport(FATAL, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), - errmsg("terminating connection due to conflict with recovery"), + errmsg("terminating connection due to conflict with recovery"), errdetail_recovery_conflict(), errhint("In a moment you should be able to reconnect to the" " database and repeat your command."))); @@ -3364,7 +3367,7 @@ ProcessInterrupts(void) */ if (lock_timeout_occurred && stmt_timeout_occurred && get_timeout_finish_time(STATEMENT_TIMEOUT) < get_timeout_finish_time(LOCK_TIMEOUT)) - lock_timeout_occurred = false; /* report stmt timeout */ + lock_timeout_occurred = false; /* report stmt timeout */ if (lock_timeout_occurred) { @@ -3394,7 +3397,7 @@ ProcessInterrupts(void) pgstat_report_recovery_conflict(RecoveryConflictReason); ereport(ERROR, (errcode(ERRCODE_T_R_SERIALIZATION_FAILURE), - errmsg("canceling statement due to conflict with recovery"), + errmsg("canceling statement due to conflict with recovery"), errdetail_recovery_conflict())); } @@ -3459,15 +3462,15 @@ ia64_get_bsp(void) char *ret; /* the ;; is a "stop", seems to be required before fetching BSP */ - __asm__ __volatile__( - ";;\n" - " mov %0=ar.bsp \n" - : "=r"(ret)); + __asm__ __volatile__( + ";;\n" + " mov %0=ar.bsp \n" +: "=r"(ret)); return ret; } #endif -#endif /* IA64 */ +#endif /* IA64 */ /* @@ -3537,7 +3540,7 @@ check_stack_depth(void) (errcode(ERRCODE_STATEMENT_TOO_COMPLEX), errmsg("stack depth limit exceeded"), errhint("Increase the configuration parameter \"max_stack_depth\" (currently %dkB), " - "after ensuring the platform's stack depth limit is adequate.", + "after ensuring the platform's stack depth limit is adequate.", max_stack_depth))); } } @@ -3585,7 +3588,7 @@ stack_is_too_deep(void) if (stack_depth > max_stack_depth_bytes && register_stack_base_ptr != NULL) return true; -#endif /* IA64 */ +#endif /* IA64 */ return false; } @@ -3700,7 +3703,7 @@ get_stats_option_name(const char *arg) switch (arg[0]) { case 'p': - if (optarg[1] == 'a') /* "parser" */ + if (optarg[1] == 'a') /* "parser" */ return "log_parser_stats"; else if (optarg[1] == 'l') /* "planner" */ return "log_planner_stats"; @@ -3762,7 +3765,7 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx, } else { - gucsource = PGC_S_CLIENT; /* switches came from client */ + gucsource = PGC_S_CLIENT; /* switches came from client */ } #ifdef HAVE_INT_OPTERR @@ -4011,13 +4014,13 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx, ereport(FATAL, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("invalid command-line argument for server process: %s", argv[optind]), - errhint("Try \"%s --help\" for more information.", progname))); + errhint("Try \"%s --help\" for more information.", progname))); else ereport(FATAL, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("%s: invalid command-line argument: %s", progname, argv[optind]), - errhint("Try \"%s --help\" for more information.", progname))); + errhint("Try \"%s --help\" for more information.", progname))); } /* @@ -4126,9 +4129,9 @@ PostgresMain(int argc, char *argv[], WalSndSignals(); else { - pqsignal(SIGHUP, PostgresSigHupHandler); /* set flag to read - * config file */ - pqsignal(SIGINT, StatementCancelHandler); /* cancel current query */ + pqsignal(SIGHUP, PostgresSigHupHandler); /* set flag to read config + * file */ + pqsignal(SIGINT, StatementCancelHandler); /* cancel current query */ pqsignal(SIGTERM, die); /* cancel current query and exit */ /* @@ -4137,9 +4140,9 @@ PostgresMain(int argc, char *argv[], * rather than quickdie(). */ if (IsUnderPostmaster) - pqsignal(SIGQUIT, quickdie); /* hard crash time */ + pqsignal(SIGQUIT, quickdie); /* hard crash time */ else - pqsignal(SIGQUIT, die); /* cancel current query and exit */ + pqsignal(SIGQUIT, die); /* cancel current query and exit */ InitializeTimeouts(); /* establishes SIGALRM handler */ /* @@ -4157,8 +4160,8 @@ PostgresMain(int argc, char *argv[], * Reset some signals that are accepted by postmaster but not by * backend */ - pqsignal(SIGCHLD, SIG_DFL); /* system() requires this on some - * platforms */ + pqsignal(SIGCHLD, SIG_DFL); /* system() requires this on some + * platforms */ } pqinitmask(); @@ -4416,7 +4419,7 @@ PostgresMain(int argc, char *argv[], * forgetting a timeout cancel. */ disable_all_timeouts(false); - QueryCancelPending = false; /* second to avoid race condition */ + QueryCancelPending = false; /* second to avoid race condition */ /* Not reading from the client anymore. */ DoingCommandRead = false; @@ -4862,13 +4865,13 @@ PostgresMain(int argc, char *argv[], default: ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid CLOSE message subtype %d", - close_type))); + errmsg("invalid CLOSE message subtype %d", + close_type))); break; } if (whereToSendOutput == DestRemote) - pq_putemptymessage('3'); /* CloseComplete */ + pq_putemptymessage('3'); /* CloseComplete */ } break; @@ -4897,8 +4900,8 @@ PostgresMain(int argc, char *argv[], default: ereport(ERROR, (errcode(ERRCODE_PROTOCOL_VIOLATION), - errmsg("invalid DESCRIBE message subtype %d", - describe_type))); + errmsg("invalid DESCRIBE message subtype %d", + describe_type))); break; } } @@ -5193,7 +5196,7 @@ ShowUsageCommon(const char *title, struct rusage *save_r, struct timeval *save_t appendStringInfoString(&str, "! system usage stats:\n"); appendStringInfo(&str, - "!\t%ld.%06ld s user, %ld.%06ld s system, %ld.%06ld s elapsed\n", + "!\t%ld.%06ld s user, %ld.%06ld s system, %ld.%06ld s elapsed\n", (long) (r.ru_utime.tv_sec - save_r->ru_utime.tv_sec), (long) (r.ru_utime.tv_usec - save_r->ru_utime.tv_usec), (long) (r.ru_stime.tv_sec - save_r->ru_stime.tv_sec), @@ -5214,25 +5217,25 @@ ShowUsageCommon(const char *title, struct rusage *save_r, struct timeval *save_t r.ru_oublock - save_r->ru_oublock, r.ru_inblock, r.ru_oublock); appendStringInfo(&str, - "!\t%ld/%ld [%ld/%ld] page faults/reclaims, %ld [%ld] swaps\n", + "!\t%ld/%ld [%ld/%ld] page faults/reclaims, %ld [%ld] swaps\n", r.ru_majflt - save_r->ru_majflt, r.ru_minflt - save_r->ru_minflt, r.ru_majflt, r.ru_minflt, r.ru_nswap - save_r->ru_nswap, r.ru_nswap); appendStringInfo(&str, - "!\t%ld [%ld] signals rcvd, %ld/%ld [%ld/%ld] messages rcvd/sent\n", + "!\t%ld [%ld] signals rcvd, %ld/%ld [%ld/%ld] messages rcvd/sent\n", r.ru_nsignals - save_r->ru_nsignals, r.ru_nsignals, r.ru_msgrcv - save_r->ru_msgrcv, r.ru_msgsnd - save_r->ru_msgsnd, r.ru_msgrcv, r.ru_msgsnd); appendStringInfo(&str, - "!\t%ld/%ld [%ld/%ld] voluntary/involuntary context switches\n", + "!\t%ld/%ld [%ld/%ld] voluntary/involuntary context switches\n", r.ru_nvcsw - save_r->ru_nvcsw, r.ru_nivcsw - save_r->ru_nivcsw, r.ru_nvcsw, r.ru_nivcsw); -#endif /* HAVE_GETRUSAGE */ +#endif /* HAVE_GETRUSAGE */ /* remove trailing newline */ if (str.data[str.len - 1] == '\n') @@ -5280,5 +5283,5 @@ log_disconnections(int code, Datum arg) "user=%s database=%s host=%s%s%s", hours, minutes, seconds, msecs, port->user_name, port->database_name, port->remote_host, - port->remote_port[0] ? " port=" : "", port->remote_port))); + port->remote_port[0] ? " port=" : "", port->remote_port))); } diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c index cb97be771f..b4fb4c992e 100644 --- a/src/backend/tcop/pquery.c +++ b/src/backend/tcop/pquery.c @@ -89,7 +89,7 @@ CreateQueryDesc(PlannedStmt *plannedstmt, QueryDesc *qd = (QueryDesc *) palloc(sizeof(QueryDesc)); qd->operation = plannedstmt->commandType; /* operation */ - qd->plannedstmt = plannedstmt; /* plan */ + qd->plannedstmt = plannedstmt; /* plan */ qd->sourceText = sourceText; /* query text */ qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */ /* RI check snapshot */ @@ -97,8 +97,7 @@ CreateQueryDesc(PlannedStmt *plannedstmt, qd->dest = dest; /* output dest */ qd->params = params; /* parameter values passed into query */ qd->queryEnv = queryEnv; - qd->instrument_options = instrument_options; /* instrumentation - * wanted? */ + qd->instrument_options = instrument_options; /* instrumentation wanted? */ /* null these fields until set by ExecutorStart */ qd->tupDesc = NULL; @@ -1454,7 +1453,7 @@ PortalRunSelect(Portal portal, if (!ScanDirectionIsNoMovement(direction)) { if (nprocessed > 0) - portal->atStart = false; /* OK to go backward now */ + portal->atStart = false; /* OK to go backward now */ if (count == 0 || nprocessed < (uint64) count) portal->atEnd = true; /* we retrieved 'em all */ portal->portalPos += nprocessed; @@ -1701,7 +1700,7 @@ PortalRunUtility(Portal portal, PlannedStmt *pstmt, ProcessUtility(pstmt, portal->sourceText, - isTopLevel ? PROCESS_UTILITY_TOPLEVEL : PROCESS_UTILITY_QUERY, + isTopLevel ? PROCESS_UTILITY_TOPLEVEL : PROCESS_UTILITY_QUERY, portal->portalParams, portal->queryEnv, dest, diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 3fdf5c84da..ada57ac500 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -339,8 +339,8 @@ CheckRestrictedOperation(const char *cmdname) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), /* translator: %s is name of a SQL command, eg PREPARE */ - errmsg("cannot execute %s within security-restricted operation", - cmdname))); + errmsg("cannot execute %s within security-restricted operation", + cmdname))); } @@ -1656,7 +1656,7 @@ ProcessUtilitySlow(ParseState *pstate, * table */ toast_options = transformRelOptions((Datum) 0, - ((CreateStmt *) stmt)->options, + ((CreateStmt *) stmt)->options, "toast", validnsps, true, @@ -1826,8 +1826,8 @@ ProcessUtilitySlow(ParseState *pstate, } else ereport(NOTICE, - (errmsg("relation \"%s\" does not exist, skipping", - atstmt->relation->relname))); + (errmsg("relation \"%s\" does not exist, skipping", + atstmt->relation->relname))); } /* ALTER TABLE stashes commands internally */ @@ -1844,7 +1844,7 @@ ProcessUtilitySlow(ParseState *pstate, */ switch (stmt->subtype) { - case 'T': /* ALTER DOMAIN DEFAULT */ + case 'T': /* ALTER DOMAIN DEFAULT */ /* * Recursively alter column default for table and, @@ -1854,35 +1854,35 @@ ProcessUtilitySlow(ParseState *pstate, AlterDomainDefault(stmt->typeName, stmt->def); break; - case 'N': /* ALTER DOMAIN DROP NOT NULL */ + case 'N': /* ALTER DOMAIN DROP NOT NULL */ address = AlterDomainNotNull(stmt->typeName, false); break; - case 'O': /* ALTER DOMAIN SET NOT NULL */ + case 'O': /* ALTER DOMAIN SET NOT NULL */ address = AlterDomainNotNull(stmt->typeName, true); break; - case 'C': /* ADD CONSTRAINT */ + case 'C': /* ADD CONSTRAINT */ address = AlterDomainAddConstraint(stmt->typeName, stmt->def, &secondaryObject); break; - case 'X': /* DROP CONSTRAINT */ + case 'X': /* DROP CONSTRAINT */ address = AlterDomainDropConstraint(stmt->typeName, stmt->name, stmt->behavior, stmt->missing_ok); break; - case 'V': /* VALIDATE CONSTRAINT */ + case 'V': /* VALIDATE CONSTRAINT */ address = AlterDomainValidateConstraint(stmt->typeName, stmt->name); break; - default: /* oops */ + default: /* oops */ elog(ERROR, "unrecognized alter domain type: %d", (int) stmt->subtype); break; @@ -2014,14 +2014,14 @@ ProcessUtilitySlow(ParseState *pstate, /* ... and do it */ EventTriggerAlterTableStart(parsetree); address = - DefineIndex(relid, /* OID of heap relation */ + DefineIndex(relid, /* OID of heap relation */ stmt, InvalidOid, /* no predefined OID */ - false, /* is_alter_table */ - true, /* check_rights */ - true, /* check_not_in_use */ - false, /* skip_build */ - false); /* quiet */ + false, /* is_alter_table */ + true, /* check_rights */ + true, /* check_not_in_use */ + false, /* skip_build */ + false); /* quiet */ #ifdef PGXC if (IS_PGXC_COORDINATOR && !stmt->isconstraint && !IsConnFromCoord()) @@ -2133,7 +2133,7 @@ ProcessUtilitySlow(ParseState *pstate, #endif break; - case T_CreateEnumStmt: /* CREATE TYPE AS ENUM */ + case T_CreateEnumStmt: /* CREATE TYPE AS ENUM */ address = DefineEnum((CreateEnumStmt *) parsetree); #ifdef PGXC if (IS_PGXC_LOCAL_COORDINATOR) @@ -2141,7 +2141,7 @@ ProcessUtilitySlow(ParseState *pstate, #endif break; - case T_CreateRangeStmt: /* CREATE TYPE AS RANGE */ + case T_CreateRangeStmt: /* CREATE TYPE AS RANGE */ address = DefineRange((CreateRangeStmt *) parsetree); #ifdef PGXC if (IS_PGXC_LOCAL_COORDINATOR) @@ -2149,7 +2149,7 @@ ProcessUtilitySlow(ParseState *pstate, #endif break; - case T_AlterEnumStmt: /* ALTER TYPE (enum) */ + case T_AlterEnumStmt: /* ALTER TYPE (enum) */ address = AlterEnum((AlterEnumStmt *) parsetree); #ifdef PGXC /* @@ -2289,7 +2289,7 @@ ProcessUtilitySlow(ParseState *pstate, PG_TRY(); { address = ExecRefreshMatView((RefreshMatViewStmt *) parsetree, - queryString, params, completionTag); + queryString, params, completionTag); #ifdef PGXC if ((IS_PGXC_COORDINATOR) && !IsConnFromCoord()) { @@ -2514,7 +2514,7 @@ ProcessUtilitySlow(ParseState *pstate, #endif break; - case T_AlterPolicyStmt: /* ALTER POLICY */ + case T_AlterPolicyStmt: /* ALTER POLICY */ address = AlterPolicy((AlterPolicyStmt *) parsetree); #ifdef PGXC if (IS_PGXC_LOCAL_COORDINATOR) @@ -2695,7 +2695,7 @@ UtilityReturnsTuples(Node *parsetree) return false; portal = GetPortalByName(stmt->portalname); if (!PortalIsValid(portal)) - return false; /* not our business to raise error */ + return false; /* not our business to raise error */ return portal->tupDesc ? true : false; } @@ -2706,7 +2706,7 @@ UtilityReturnsTuples(Node *parsetree) entry = FetchPreparedStatement(stmt->name, false); if (!entry) - return false; /* not our business to raise error */ + return false; /* not our business to raise error */ if (entry->plansource->resultDesc) return true; return false; @@ -3896,7 +3896,7 @@ GetCommandLogLevel(Node *parsetree) case T_SelectStmt: if (((SelectStmt *) parsetree)->intoClause) - lev = LOGSTMT_DDL; /* SELECT INTO */ + lev = LOGSTMT_DDL; /* SELECT INTO */ else lev = LOGSTMT_ALL; break; diff --git a/src/backend/tsearch/dict.c b/src/backend/tsearch/dict.c index ba8a3d79a8..63655fb592 100644 --- a/src/backend/tsearch/dict.c +++ b/src/backend/tsearch/dict.c @@ -37,19 +37,19 @@ ts_lexize(PG_FUNCTION_ARGS) dict = lookup_ts_dictionary_cache(dictId); res = (TSLexeme *) DatumGetPointer(FunctionCall4(&dict->lexize, - PointerGetDatum(dict->dictData), - PointerGetDatum(VARDATA_ANY(in)), - Int32GetDatum(VARSIZE_ANY_EXHDR(in)), - PointerGetDatum(&dstate))); + PointerGetDatum(dict->dictData), + PointerGetDatum(VARDATA_ANY(in)), + Int32GetDatum(VARSIZE_ANY_EXHDR(in)), + PointerGetDatum(&dstate))); if (dstate.getnext) { dstate.isend = true; ptr = (TSLexeme *) DatumGetPointer(FunctionCall4(&dict->lexize, - PointerGetDatum(dict->dictData), - PointerGetDatum(VARDATA_ANY(in)), - Int32GetDatum(VARSIZE_ANY_EXHDR(in)), - PointerGetDatum(&dstate))); + PointerGetDatum(dict->dictData), + PointerGetDatum(VARDATA_ANY(in)), + Int32GetDatum(VARSIZE_ANY_EXHDR(in)), + PointerGetDatum(&dstate))); if (ptr != NULL) res = ptr; } diff --git a/src/backend/tsearch/dict_ispell.c b/src/backend/tsearch/dict_ispell.c index b4576bf1f8..8f61bd2830 100644 --- a/src/backend/tsearch/dict_ispell.c +++ b/src/backend/tsearch/dict_ispell.c @@ -51,8 +51,8 @@ dispell_init(PG_FUNCTION_ARGS) (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("multiple DictFile parameters"))); NIImportDictionary(&(d->obj), - get_tsearch_config_filename(defGetString(defel), - "dict")); + get_tsearch_config_filename(defGetString(defel), + "dict")); dictloaded = true; } else if (pg_strcasecmp(defel->defname, "AffFile") == 0) diff --git a/src/backend/tsearch/dict_simple.c b/src/backend/tsearch/dict_simple.c index c361362880..a13cdc0743 100644 --- a/src/backend/tsearch/dict_simple.c +++ b/src/backend/tsearch/dict_simple.c @@ -63,8 +63,8 @@ dsimple_init(PG_FUNCTION_ARGS) { ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("unrecognized simple dictionary parameter: \"%s\"", - defel->defname))); + errmsg("unrecognized simple dictionary parameter: \"%s\"", + defel->defname))); } } diff --git a/src/backend/tsearch/dict_thesaurus.c b/src/backend/tsearch/dict_thesaurus.c index 9a01075d4e..1b6085add3 100644 --- a/src/backend/tsearch/dict_thesaurus.c +++ b/src/backend/tsearch/dict_thesaurus.c @@ -405,15 +405,15 @@ compileTheLexeme(DictThesaurus *d) { TSLexeme *ptr; - if (strcmp(d->wrds[i].lexeme, "?") == 0) /* Is stop word marker? */ + if (strcmp(d->wrds[i].lexeme, "?") == 0) /* Is stop word marker? */ newwrds = addCompiledLexeme(newwrds, &nnw, &tnm, NULL, d->wrds[i].entries, 0); else { ptr = (TSLexeme *) DatumGetPointer(FunctionCall4(&(d->subdict->lexize), - PointerGetDatum(d->subdict->dictData), - PointerGetDatum(d->wrds[i].lexeme), - Int32GetDatum(strlen(d->wrds[i].lexeme)), - PointerGetDatum(NULL))); + PointerGetDatum(d->subdict->dictData), + PointerGetDatum(d->wrds[i].lexeme), + Int32GetDatum(strlen(d->wrds[i].lexeme)), + PointerGetDatum(NULL))); if (!ptr) ereport(ERROR, @@ -535,11 +535,11 @@ compileTheSubstitute(DictThesaurus *d) { lexized = (TSLexeme *) DatumGetPointer( FunctionCall4( - &(d->subdict->lexize), - PointerGetDatum(d->subdict->dictData), - PointerGetDatum(inptr->lexeme), - Int32GetDatum(strlen(inptr->lexeme)), - PointerGetDatum(NULL) + &(d->subdict->lexize), + PointerGetDatum(d->subdict->dictData), + PointerGetDatum(inptr->lexeme), + Int32GetDatum(strlen(inptr->lexeme)), + PointerGetDatum(NULL) ) ); } @@ -816,7 +816,7 @@ thesaurus_lexize(PG_FUNCTION_ARGS) d->subdict = lookup_ts_dictionary_cache(d->subdictOid); res = (TSLexeme *) DatumGetPointer(FunctionCall4(&(d->subdict->lexize), - PointerGetDatum(d->subdict->dictData), + PointerGetDatum(d->subdict->dictData), PG_GETARG_DATUM(1), PG_GETARG_DATUM(2), PointerGetDatum(NULL))); diff --git a/src/backend/tsearch/regis.c b/src/backend/tsearch/regis.c index aea76e85b5..2b89f596f0 100644 --- a/src/backend/tsearch/regis.c +++ b/src/backend/tsearch/regis.c @@ -115,7 +115,7 @@ RS_compile(Regis *r, bool issuffix, const char *str) ptr->type = RSF_ONEOF; state = RS_IN_ONEOF; } - else /* shouldn't get here */ + else /* shouldn't get here */ elog(ERROR, "invalid regis pattern: \"%s\"", str); } else if (state == RS_IN_ONEOF) @@ -131,7 +131,7 @@ RS_compile(Regis *r, bool issuffix, const char *str) ptr->len = pg_mblen(c); state = RS_IN_ONEOF_IN; } - else /* shouldn't get here */ + else /* shouldn't get here */ elog(ERROR, "invalid regis pattern: \"%s\"", str); } else if (state == RS_IN_ONEOF_IN || state == RS_IN_NONEOF) @@ -143,7 +143,7 @@ RS_compile(Regis *r, bool issuffix, const char *str) } else if (t_iseq(c, ']')) state = RS_IN_WAIT; - else /* shouldn't get here */ + else /* shouldn't get here */ elog(ERROR, "invalid regis pattern: \"%s\"", str); } else diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c index c1e194a8f5..1020250490 100644 --- a/src/backend/tsearch/spell.c +++ b/src/backend/tsearch/spell.c @@ -411,8 +411,8 @@ getNextFlagFromString(IspellDict *Conf, char **sflagset, char *sflag) { ereport(ERROR, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("invalid character in affix flag \"%s\"", - *sflagset))); + errmsg("invalid character in affix flag \"%s\"", + *sflagset))); } *sflagset += pg_mblen(*sflagset); @@ -803,7 +803,7 @@ get_nextfield(char **str, char *next) state = PAE_INMASK; } } - else /* state == PAE_INMASK */ + else /* state == PAE_INMASK */ { if (t_isspace(*str)) { @@ -827,7 +827,7 @@ get_nextfield(char **str, char *next) *next = '\0'; - return (state == PAE_INMASK); /* OK if we got a nonempty field */ + return (state == PAE_INMASK); /* OK if we got a nonempty field */ } /* @@ -1088,7 +1088,7 @@ addCompoundAffixFlagValue(IspellDict *Conf, char *s, uint32 val) Conf->mCompoundAffixFlag *= 2; Conf->CompoundAffixFlags = (CompoundAffixFlag *) repalloc((void *) Conf->CompoundAffixFlags, - Conf->mCompoundAffixFlag * sizeof(CompoundAffixFlag)); + Conf->mCompoundAffixFlag * sizeof(CompoundAffixFlag)); } else { @@ -1306,7 +1306,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename) if (naffix == 0) ereport(ERROR, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("invalid number of flag vector aliases"))); + errmsg("invalid number of flag vector aliases"))); /* Also reserve place for empty flag set */ naffix++; @@ -1539,7 +1539,7 @@ isnewformat: if (oldformat) ereport(ERROR, (errcode(ERRCODE_CONFIG_FILE_ERROR), - errmsg("affix file contains both old-style and new-style commands"))); + errmsg("affix file contains both old-style and new-style commands"))); tsearch_readline_end(&trst); NIImportOOAffixes(Conf, filename); @@ -1566,7 +1566,7 @@ MergeAffix(IspellDict *Conf, int a1, int a2) { Conf->lenAffixData *= 2; Conf->AffixData = (char **) repalloc(Conf->AffixData, - sizeof(char *) * Conf->lenAffixData); + sizeof(char *) * Conf->lenAffixData); } ptr = Conf->AffixData + Conf->nAffixData; @@ -1664,7 +1664,7 @@ mkSPNode(IspellDict *Conf, int low, int high, int level) */ clearCompoundOnly = (FF_COMPOUNDONLY & data->compoundflag - & makeCompoundFlags(Conf, Conf->Spell[i]->p.d.affix)) + & makeCompoundFlags(Conf, Conf->Spell[i]->p.d.affix)) ? false : true; data->affix = MergeAffix(Conf, data->affix, Conf->Spell[i]->p.d.affix); } diff --git a/src/backend/tsearch/to_tsany.c b/src/backend/tsearch/to_tsany.c index 18368d118e..6400440756 100644 --- a/src/backend/tsearch/to_tsany.c +++ b/src/backend/tsearch/to_tsany.c @@ -49,8 +49,8 @@ compareWORD(const void *a, const void *b) int res; res = tsCompareString( - ((const ParsedWord *) a)->word, ((const ParsedWord *) a)->len, - ((const ParsedWord *) b)->word, ((const ParsedWord *) b)->len, + ((const ParsedWord *) a)->word, ((const ParsedWord *) a)->len, + ((const ParsedWord *) b)->word, ((const ParsedWord *) b)->len, false); if (res == 0) @@ -390,8 +390,8 @@ add_to_tsvector(void *_state, char *elem_value, int elem_len) item_vector = make_tsvector(prs); state->result = (TSVector) DirectFunctionCall2(tsvector_concat, - TSVectorGetDatum(state->result), - PointerGetDatum(item_vector)); + TSVectorGetDatum(state->result), + PointerGetDatum(item_vector)); } else state->result = make_tsvector(prs); @@ -472,7 +472,7 @@ pushval_morph(Datum opaque, TSQueryParserState state, char *strval, int lenval, prs.words[count].word, prs.words[count].len, weight, - ((prs.words[count].flags & TSL_PREFIX) || prefix)); + ((prs.words[count].flags & TSL_PREFIX) || prefix)); pfree(prs.words[count].word); if (cnt) pushOperator(state, OP_AND, 0); diff --git a/src/backend/tsearch/ts_locale.c b/src/backend/tsearch/ts_locale.c index 19d2cc3f30..1aa3e23733 100644 --- a/src/backend/tsearch/ts_locale.c +++ b/src/backend/tsearch/ts_locale.c @@ -28,7 +28,7 @@ t_isdigit(const char *ptr) { int clen = pg_mblen(ptr); wchar_t character[2]; - Oid collation = DEFAULT_COLLATION_OID; /* TODO */ + Oid collation = DEFAULT_COLLATION_OID; /* TODO */ pg_locale_t mylocale = 0; /* TODO */ if (clen == 1 || lc_ctype_is_c(collation)) @@ -44,7 +44,7 @@ t_isspace(const char *ptr) { int clen = pg_mblen(ptr); wchar_t character[2]; - Oid collation = DEFAULT_COLLATION_OID; /* TODO */ + Oid collation = DEFAULT_COLLATION_OID; /* TODO */ pg_locale_t mylocale = 0; /* TODO */ if (clen == 1 || lc_ctype_is_c(collation)) @@ -60,7 +60,7 @@ t_isalpha(const char *ptr) { int clen = pg_mblen(ptr); wchar_t character[2]; - Oid collation = DEFAULT_COLLATION_OID; /* TODO */ + Oid collation = DEFAULT_COLLATION_OID; /* TODO */ pg_locale_t mylocale = 0; /* TODO */ if (clen == 1 || lc_ctype_is_c(collation)) @@ -76,7 +76,7 @@ t_isprint(const char *ptr) { int clen = pg_mblen(ptr); wchar_t character[2]; - Oid collation = DEFAULT_COLLATION_OID; /* TODO */ + Oid collation = DEFAULT_COLLATION_OID; /* TODO */ pg_locale_t mylocale = 0; /* TODO */ if (clen == 1 || lc_ctype_is_c(collation)) @@ -86,7 +86,7 @@ t_isprint(const char *ptr) return iswprint((wint_t) character[0]); } -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ /* @@ -246,7 +246,7 @@ lowerstr_with_len(const char *str, int len) char *out; #ifdef USE_WIDE_UPPER_LOWER - Oid collation = DEFAULT_COLLATION_OID; /* TODO */ + Oid collation = DEFAULT_COLLATION_OID; /* TODO */ pg_locale_t mylocale = 0; /* TODO */ #endif @@ -296,11 +296,11 @@ lowerstr_with_len(const char *str, int len) if (wlen < 0) ereport(ERROR, (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE), - errmsg("conversion from wchar_t to server encoding failed: %m"))); + errmsg("conversion from wchar_t to server encoding failed: %m"))); Assert(wlen < len); } else -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ { const char *ptr = str; char *outptr; diff --git a/src/backend/tsearch/ts_parse.c b/src/backend/tsearch/ts_parse.c index b612fb0e2c..ad5dddff4b 100644 --- a/src/backend/tsearch/ts_parse.c +++ b/src/backend/tsearch/ts_parse.c @@ -205,11 +205,11 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem) ld->dictState.isend = ld->dictState.getnext = false; ld->dictState.private_state = NULL; res = (TSLexeme *) DatumGetPointer(FunctionCall4( - &(dict->lexize), - PointerGetDatum(dict->dictData), - PointerGetDatum(curValLemm), - Int32GetDatum(curValLenLemm), - PointerGetDatum(&ld->dictState) + &(dict->lexize), + PointerGetDatum(dict->dictData), + PointerGetDatum(curValLemm), + Int32GetDatum(curValLenLemm), + PointerGetDatum(&ld->dictState) )); if (ld->dictState.getnext) @@ -295,10 +295,10 @@ LexizeExec(LexizeData *ld, ParsedLex **correspondLexem) res = (TSLexeme *) DatumGetPointer(FunctionCall4( &(dict->lexize), - PointerGetDatum(dict->dictData), - PointerGetDatum(curVal->lemm), - Int32GetDatum(curVal->lenlemm), - PointerGetDatum(&ld->dictState) + PointerGetDatum(dict->dictData), + PointerGetDatum(curVal->lemm), + Int32GetDatum(curVal->lenlemm), + PointerGetDatum(&ld->dictState) )); if (ld->dictState.getnext) diff --git a/src/backend/tsearch/ts_typanalyze.c b/src/backend/tsearch/ts_typanalyze.c index 017435cc59..ab224b76b8 100644 --- a/src/backend/tsearch/ts_typanalyze.c +++ b/src/backend/tsearch/ts_typanalyze.c @@ -188,7 +188,7 @@ compute_tsvector_stats(VacAttrStats *stats, lexemes_tab = hash_create("Analyzed lexemes table", num_mcelem, &hash_ctl, - HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); + HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); /* Initialize counters. */ b_current = 1; @@ -396,7 +396,7 @@ compute_tsvector_stats(VacAttrStats *stats, mcelem_values[i] = PointerGetDatum(cstring_to_text_with_len(item->key.lexeme, - item->key.length)); + item->key.length)); mcelem_freqs[i] = (double) item->frequency / (double) nonnull_cnt; } mcelem_freqs[i++] = (double) minfreq / (double) nonnull_cnt; @@ -423,7 +423,7 @@ compute_tsvector_stats(VacAttrStats *stats, stats->stats_valid = true; stats->stanullfrac = 1.0; stats->stawidth = 0; /* "unknown" */ - stats->stadistinct = 0.0; /* "unknown" */ + stats->stadistinct = 0.0; /* "unknown" */ } /* @@ -501,8 +501,8 @@ lexeme_compare(const void *key1, const void *key2) static int trackitem_compare_frequencies_desc(const void *e1, const void *e2) { - const TrackItem *const * t1 = (const TrackItem *const *) e1; - const TrackItem *const * t2 = (const TrackItem *const *) e2; + const TrackItem *const *t1 = (const TrackItem *const *) e1; + const TrackItem *const *t2 = (const TrackItem *const *) e2; return (*t2)->frequency - (*t1)->frequency; } @@ -513,8 +513,8 @@ trackitem_compare_frequencies_desc(const void *e1, const void *e2) static int trackitem_compare_lexemes(const void *e1, const void *e2) { - const TrackItem *const * t1 = (const TrackItem *const *) e1; - const TrackItem *const * t2 = (const TrackItem *const *) e2; + const TrackItem *const *t1 = (const TrackItem *const *) e1; + const TrackItem *const *t2 = (const TrackItem *const *) e2; return lexeme_compare(&(*t1)->key, &(*t2)->key); } diff --git a/src/backend/tsearch/wparser.c b/src/backend/tsearch/wparser.c index 8f4727448f..c9ce80a91a 100644 --- a/src/backend/tsearch/wparser.c +++ b/src/backend/tsearch/wparser.c @@ -186,8 +186,8 @@ prs_setup_firstcall(FuncCallContext *funcctx, Oid prsid, text *txt) st->list = (LexemeEntry *) palloc(sizeof(LexemeEntry) * st->len); prsdata = (void *) DatumGetPointer(FunctionCall2(&prs->prsstart, - PointerGetDatum(VARDATA_ANY(txt)), - Int32GetDatum(VARSIZE_ANY_EXHDR(txt)))); + PointerGetDatum(VARDATA_ANY(txt)), + Int32GetDatum(VARSIZE_ANY_EXHDR(txt)))); while ((type = DatumGetInt32(FunctionCall3(&prs->prstoken, PointerGetDatum(prsdata), @@ -319,7 +319,7 @@ ts_headline_byid_opt(PG_FUNCTION_ARGS) if (!OidIsValid(prsobj->headlineOid)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("text search parser does not support headline creation"))); + errmsg("text search parser does not support headline creation"))); memset(&prs, 0, sizeof(HeadlineParsedText)); prs.lenwords = 32; @@ -364,7 +364,7 @@ Datum ts_headline(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_byid_opt, - ObjectIdGetDatum(getTSCurrentConfig(true)), + ObjectIdGetDatum(getTSCurrentConfig(true)), PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); } @@ -373,7 +373,7 @@ Datum ts_headline_opt(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_byid_opt, - ObjectIdGetDatum(getTSCurrentConfig(true)), + ObjectIdGetDatum(getTSCurrentConfig(true)), PG_GETARG_DATUM(0), PG_GETARG_DATUM(1), PG_GETARG_DATUM(2))); @@ -407,7 +407,7 @@ ts_headline_jsonb_byid_opt(PG_FUNCTION_ARGS) if (!OidIsValid(state->prsobj->headlineOid)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("text search parser does not support headline creation"))); + errmsg("text search parser does not support headline creation"))); out = transform_jsonb_string_values(jb, state, action); @@ -431,7 +431,7 @@ Datum ts_headline_jsonb(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_jsonb_byid_opt, - ObjectIdGetDatum(getTSCurrentConfig(true)), + ObjectIdGetDatum(getTSCurrentConfig(true)), PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); } @@ -449,7 +449,7 @@ Datum ts_headline_jsonb_opt(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_jsonb_byid_opt, - ObjectIdGetDatum(getTSCurrentConfig(true)), + ObjectIdGetDatum(getTSCurrentConfig(true)), PG_GETARG_DATUM(0), PG_GETARG_DATUM(1), PG_GETARG_DATUM(2))); @@ -484,7 +484,7 @@ ts_headline_json_byid_opt(PG_FUNCTION_ARGS) if (!OidIsValid(state->prsobj->headlineOid)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("text search parser does not support headline creation"))); + errmsg("text search parser does not support headline creation"))); out = transform_json_string_values(json, state, action); @@ -507,7 +507,7 @@ Datum ts_headline_json(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall3(ts_headline_json_byid_opt, - ObjectIdGetDatum(getTSCurrentConfig(true)), + ObjectIdGetDatum(getTSCurrentConfig(true)), PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); } @@ -525,7 +525,7 @@ Datum ts_headline_json_opt(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall4(ts_headline_json_byid_opt, - ObjectIdGetDatum(getTSCurrentConfig(true)), + ObjectIdGetDatum(getTSCurrentConfig(true)), PG_GETARG_DATUM(0), PG_GETARG_DATUM(1), PG_GETARG_DATUM(2))); diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c index bb7edc1516..e841a1ccf0 100644 --- a/src/backend/tsearch/wparser_def.c +++ b/src/backend/tsearch/wparser_def.c @@ -199,10 +199,10 @@ typedef enum /* forward declaration */ struct TParser; -typedef int (*TParserCharTest) (struct TParser *); /* any p_is* functions - * except p_iseq */ -typedef void (*TParserSpecial) (struct TParser *); /* special handler for - * special cases... */ +typedef int (*TParserCharTest) (struct TParser *); /* any p_is* functions + * except p_iseq */ +typedef void (*TParserSpecial) (struct TParser *); /* special handler for + * special cases... */ typedef struct { @@ -302,7 +302,7 @@ TParserInit(char *str, int len) if (prs->charmaxlen > 1) { Oid collation = DEFAULT_COLLATION_OID; /* TODO */ - pg_locale_t mylocale = 0; /* TODO */ + pg_locale_t mylocale = 0; /* TODO */ prs->usewide = true; if (lc_ctype_is_c(collation)) @@ -560,7 +560,7 @@ p_iseq(TParser *prs, char c) p_iswhat(alnum) p_iswhat(alpha) -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ p_iswhat(digit) p_iswhat(lower) @@ -665,17 +665,17 @@ SpecialTags(TParser *prs) { switch (prs->state->lenchartoken) { - case 8: /* </script */ + case 8: /* </script */ if (pg_strncasecmp(prs->token, "</script", 8) == 0) prs->ignore = false; break; - case 7: /* <script || </style */ + case 7: /* <script || </style */ if (pg_strncasecmp(prs->token, "</style", 7) == 0) prs->ignore = false; else if (pg_strncasecmp(prs->token, "<script", 7) == 0) prs->ignore = true; break; - case 6: /* <style */ + case 6: /* <style */ if (pg_strncasecmp(prs->token, "<style", 6) == 0) prs->ignore = true; break; @@ -1697,7 +1697,7 @@ static const TParserStateActionItem actionTPS_InHyphenUnsignedInt[] = { */ typedef struct { - const TParserStateActionItem *action; /* the actual state info */ + const TParserStateActionItem *action; /* the actual state info */ TParserState state; /* only for Assert crosscheck */ #ifdef WPARSER_TRACE const char *state_name; /* only for debug printout */ @@ -2295,7 +2295,7 @@ mark_hl_fragments(HeadlineParsedText *prs, TSQuery query, int highlight, { if (!covers[i].in && !covers[i].excluded && (maxitems < covers[i].poslen || (maxitems == covers[i].poslen - && minwords > covers[i].curlen))) + && minwords > covers[i].curlen))) { maxitems = covers[i].poslen; minwords = covers[i].curlen; diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 35bdfc9a46..2efb6c94e1 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -320,8 +320,8 @@ aclparse(const char *s, AclItem *aip) default: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid mode character: must be one of \"%s\"", - ACL_ALL_RIGHTS_STR))); + errmsg("invalid mode character: must be one of \"%s\"", + ACL_ALL_RIGHTS_STR))); } privs |= read; @@ -573,7 +573,7 @@ aclitemin(PG_FUNCTION_ARGS) if (*s) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("extra garbage at the end of the ACL specification"))); + errmsg("extra garbage at the end of the ACL specification"))); PG_RETURN_ACLITEM_P(aip); } @@ -793,7 +793,7 @@ acldefault(GrantObjectType objtype, Oid ownerId) break; default: elog(ERROR, "unrecognized objtype: %d", (int) objtype); - world_default = ACL_NO_RIGHTS; /* keep compiler quiet */ + world_default = ACL_NO_RIGHTS; /* keep compiler quiet */ owner_default = ACL_NO_RIGHTS; break; } @@ -1193,7 +1193,7 @@ cc_restart: if ((ACLITEM_GET_GOPTIONS(*mod_aip) & ~own_privs) != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_GRANT_OPERATION), - errmsg("grant options cannot be granted back to your own grantor"))); + errmsg("grant options cannot be granted back to your own grantor"))); pfree(acl); } @@ -4713,7 +4713,7 @@ roles_has_privs_of(Oid roleid) /* * Now safe to assign to state variable */ - cached_privs_role = InvalidOid; /* just paranoia */ + cached_privs_role = InvalidOid; /* just paranoia */ list_free(cached_privs_roles); cached_privs_roles = new_cached_privs_roles; cached_privs_role = roleid; @@ -5176,7 +5176,7 @@ get_rolespec_tuple(const RoleSpec *role) if (!HeapTupleIsValid(tuple)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("role \"%s\" does not exist", role->rolename))); + errmsg("role \"%s\" does not exist", role->rolename))); break; case ROLESPEC_CURRENT_USER: diff --git a/src/backend/utils/adt/amutils.c b/src/backend/utils/adt/amutils.c index b3a3a4dcc3..f53b251b30 100644 --- a/src/backend/utils/adt/amutils.c +++ b/src/backend/utils/adt/amutils.c @@ -240,7 +240,7 @@ indexam_property(FunctionCallInfo fcinfo, case AMPROP_NULLS_FIRST: if (test_indoption(index_oid, attno, routine->amcanorder, - INDOPTION_NULLS_FIRST, INDOPTION_NULLS_FIRST, &res)) + INDOPTION_NULLS_FIRST, INDOPTION_NULLS_FIRST, &res)) PG_RETURN_BOOL(res); PG_RETURN_NULL(); diff --git a/src/backend/utils/adt/array_selfuncs.c b/src/backend/utils/adt/array_selfuncs.c index 3ae6018c67..9daf8e73bc 100644 --- a/src/backend/utils/adt/array_selfuncs.c +++ b/src/backend/utils/adt/array_selfuncs.c @@ -165,7 +165,7 @@ scalararraysel_containment(PlannerInfo *root, sslot.numbers, sslot.nnumbers, &constval, 1, - OID_ARRAY_CONTAINS_OP, + OID_ARRAY_CONTAINS_OP, cmpfunc); else selec = mcelem_array_contained_selec(sslot.values, @@ -188,7 +188,7 @@ scalararraysel_containment(PlannerInfo *root, selec = mcelem_array_contain_overlap_selec(NULL, 0, NULL, 0, &constval, 1, - OID_ARRAY_CONTAINS_OP, + OID_ARRAY_CONTAINS_OP, cmpfunc); else selec = mcelem_array_contained_selec(NULL, 0, @@ -482,7 +482,7 @@ mcelem_array_selec(ArrayType *array, TypeCacheEntry *typentry, if (operator == OID_ARRAY_CONTAINS_OP || operator == OID_ARRAY_OVERLAP_OP) selec = mcelem_array_contain_overlap_selec(mcelem, nmcelem, numbers, nnumbers, - elem_values, nonnull_nitems, + elem_values, nonnull_nitems, operator, cmpfunc); else if (operator == OID_ARRAY_CONTAINED_OP) selec = mcelem_array_contained_selec(mcelem, nmcelem, @@ -788,7 +788,7 @@ mcelem_array_contained_selec(Datum *mcelem, int nmcelem, else { if (cmp == 0) - match = true; /* mcelem is found */ + match = true; /* mcelem is found */ break; } } diff --git a/src/backend/utils/adt/array_typanalyze.c b/src/backend/utils/adt/array_typanalyze.c index 85b7a43292..78153d232f 100644 --- a/src/backend/utils/adt/array_typanalyze.c +++ b/src/backend/utils/adt/array_typanalyze.c @@ -81,7 +81,7 @@ typedef struct } DECountItem; static void compute_array_stats(VacAttrStats *stats, - AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows); + AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows); static void prune_element_hashtable(HTAB *elements_tab, int b_current); static uint32 element_hash(const void *key, Size keysize); static int element_match(const void *key1, const void *key2, Size keysize); @@ -285,7 +285,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, elements_tab = hash_create("Analyzed elements table", num_mcelem, &elem_hash_ctl, - HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); + HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT); /* hashtable for array distinct elements counts */ MemSet(&count_hash_ctl, 0, sizeof(count_hash_ctl)); @@ -751,8 +751,8 @@ element_compare(const void *key1, const void *key2) static int trackitem_compare_frequencies_desc(const void *e1, const void *e2) { - const TrackItem *const * t1 = (const TrackItem *const *) e1; - const TrackItem *const * t2 = (const TrackItem *const *) e2; + const TrackItem *const *t1 = (const TrackItem *const *) e1; + const TrackItem *const *t2 = (const TrackItem *const *) e2; return (*t2)->frequency - (*t1)->frequency; } @@ -763,8 +763,8 @@ trackitem_compare_frequencies_desc(const void *e1, const void *e2) static int trackitem_compare_element(const void *e1, const void *e2) { - const TrackItem *const * t1 = (const TrackItem *const *) e1; - const TrackItem *const * t2 = (const TrackItem *const *) e2; + const TrackItem *const *t1 = (const TrackItem *const *) e1; + const TrackItem *const *t2 = (const TrackItem *const *) e2; return element_compare(&(*t1)->key, &(*t2)->key); } @@ -775,8 +775,8 @@ trackitem_compare_element(const void *e1, const void *e2) static int countitem_compare_count(const void *e1, const void *e2) { - const DECountItem *const * t1 = (const DECountItem *const *) e1; - const DECountItem *const * t2 = (const DECountItem *const *) e2; + const DECountItem *const *t1 = (const DECountItem *const *) e1; + const DECountItem *const *t2 = (const DECountItem *const *) e2; if ((*t1)->count < (*t2)->count) return -1; diff --git a/src/backend/utils/adt/array_userfuncs.c b/src/backend/utils/adt/array_userfuncs.c index 8311c7ef11..0b0dfa04e0 100644 --- a/src/backend/utils/adt/array_userfuncs.c +++ b/src/backend/utils/adt/array_userfuncs.c @@ -143,7 +143,7 @@ array_append(PG_FUNCTION_ARGS) result = array_set_element(EOHPGetRWDatum(&eah->hdr), 1, &indx, newelem, isNull, - -1, my_extra->typlen, my_extra->typbyval, my_extra->typalign); + -1, my_extra->typlen, my_extra->typbyval, my_extra->typalign); PG_RETURN_DATUM(result); } @@ -200,7 +200,7 @@ array_prepend(PG_FUNCTION_ARGS) result = array_set_element(EOHPGetRWDatum(&eah->hdr), 1, &indx, newelem, isNull, - -1, my_extra->typlen, my_extra->typbyval, my_extra->typalign); + -1, my_extra->typlen, my_extra->typbyval, my_extra->typalign); /* Readjust result's LB to match the input's, as expected for prepend */ Assert(result == EOHPGetRWDatum(&eah->hdr)); @@ -352,8 +352,8 @@ array_cat(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), errmsg("cannot concatenate incompatible arrays"), - errdetail("Arrays with differing element dimensions are " - "not compatible for concatenation."))); + errdetail("Arrays with differing element dimensions are " + "not compatible for concatenation."))); dims[i] = dims1[i]; lbs[i] = lbs1[i]; @@ -725,8 +725,8 @@ array_position_common(FunctionCallInfo fcinfo) if (!OidIsValid(typentry->eq_opr_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify an equality operator for type %s", - format_type_be(element_type)))); + errmsg("could not identify an equality operator for type %s", + format_type_be(element_type)))); my_extra->element_type = element_type; fmgr_info_cxt(typentry->eq_opr_finfo.fn_oid, &my_extra->proc, @@ -864,8 +864,8 @@ array_positions(PG_FUNCTION_ARGS) if (!OidIsValid(typentry->eq_opr_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify an equality operator for type %s", - format_type_be(element_type)))); + errmsg("could not identify an equality operator for type %s", + format_type_be(element_type)))); my_extra->element_type = element_type; fmgr_info_cxt(typentry->eq_opr_finfo.fn_oid, &my_extra->proc, diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index 2c21a43d73..449bb30a47 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -85,7 +85,7 @@ typedef struct ArrayIteratorData /* current position information, updated on each iteration */ char *data_ptr; /* our current position in the array */ int current_item; /* the item # we're at in the array */ -} ArrayIteratorData; +} ArrayIteratorData; static bool array_isspace(char ch); static int ArrayCount(const char *str, int *dim, char typdelim); @@ -172,8 +172,8 @@ Datum array_in(PG_FUNCTION_ARGS) { char *string = PG_GETARG_CSTRING(0); /* external form */ - Oid element_type = PG_GETARG_OID(1); /* type of an array - * element */ + Oid element_type = PG_GETARG_OID(1); /* type of an array + * element */ int32 typmod = PG_GETARG_INT32(2); /* typmod for array elements */ int typlen; bool typbyval; @@ -524,7 +524,7 @@ ArrayCount(const char *str, int *dim, char typdelim) parse_state != ARRAY_ELEM_DELIMITED) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", str), + errmsg("malformed array literal: \"%s\"", str), errdetail("Unexpected \"%c\" character.", '\\'))); if (parse_state != ARRAY_QUOTED_ELEM_STARTED) @@ -535,7 +535,7 @@ ArrayCount(const char *str, int *dim, char typdelim) else ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", str), + errmsg("malformed array literal: \"%s\"", str), errdetail("Unexpected end of input."))); break; case '"': @@ -550,7 +550,7 @@ ArrayCount(const char *str, int *dim, char typdelim) parse_state != ARRAY_ELEM_DELIMITED) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", str), + errmsg("malformed array literal: \"%s\"", str), errdetail("Unexpected array element."))); in_quotes = !in_quotes; if (in_quotes) @@ -570,10 +570,10 @@ ArrayCount(const char *str, int *dim, char typdelim) parse_state != ARRAY_LEVEL_STARTED && parse_state != ARRAY_LEVEL_DELIMITED) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", str), - errdetail("Unexpected \"%c\" character.", - '{'))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("malformed array literal: \"%s\"", str), + errdetail("Unexpected \"%c\" character.", + '{'))); parse_state = ARRAY_LEVEL_STARTED; if (nest_level >= MAXDIM) ereport(ERROR, @@ -600,26 +600,26 @@ ArrayCount(const char *str, int *dim, char typdelim) parse_state != ARRAY_LEVEL_COMPLETED && !(nest_level == 1 && parse_state == ARRAY_LEVEL_STARTED)) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", str), - errdetail("Unexpected \"%c\" character.", - '}'))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("malformed array literal: \"%s\"", str), + errdetail("Unexpected \"%c\" character.", + '}'))); parse_state = ARRAY_LEVEL_COMPLETED; if (nest_level == 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", str), - errdetail("Unmatched \"%c\" character.", '}'))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("malformed array literal: \"%s\"", str), + errdetail("Unmatched \"%c\" character.", '}'))); nest_level--; if (nelems_last[nest_level] != 0 && nelems[nest_level] != nelems_last[nest_level]) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", str), - errdetail("Multidimensional arrays must have " - "sub-arrays with matching " - "dimensions."))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("malformed array literal: \"%s\"", str), + errdetail("Multidimensional arrays must have " + "sub-arrays with matching " + "dimensions."))); nelems_last[nest_level] = nelems[nest_level]; nelems[nest_level] = 1; if (nest_level == 0) @@ -649,10 +649,10 @@ ArrayCount(const char *str, int *dim, char typdelim) parse_state != ARRAY_QUOTED_ELEM_COMPLETED && parse_state != ARRAY_LEVEL_COMPLETED) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", str), - errdetail("Unexpected \"%c\" character.", - typdelim))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("malformed array literal: \"%s\"", str), + errdetail("Unexpected \"%c\" character.", + typdelim))); if (parse_state == ARRAY_LEVEL_COMPLETED) parse_state = ARRAY_LEVEL_DELIMITED; else @@ -672,9 +672,9 @@ ArrayCount(const char *str, int *dim, char typdelim) parse_state != ARRAY_ELEM_STARTED && parse_state != ARRAY_ELEM_DELIMITED) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", str), - errdetail("Unexpected array element."))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("malformed array literal: \"%s\"", str), + errdetail("Unexpected array element."))); parse_state = ARRAY_ELEM_STARTED; } } @@ -843,9 +843,9 @@ ReadArrayStr(char *arrayStr, { if (nest_level >= ndim) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", - origStr))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("malformed array literal: \"%s\"", + origStr))); nest_level++; indx[nest_level - 1] = 0; srcptr++; @@ -858,9 +858,9 @@ ReadArrayStr(char *arrayStr, { if (nest_level == 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("malformed array literal: \"%s\"", - origStr))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("malformed array literal: \"%s\"", + origStr))); if (i == -1) i = ArrayGetOffset0(ndim, indx, prod); indx[nest_level - 1] = 0; @@ -1153,9 +1153,9 @@ array_out(PG_FUNCTION_ARGS) /* count data plus backslashes; detect chars needing quotes */ if (values[i][0] == '\0') - needquote = true; /* force quotes for empty string */ + needquote = true; /* force quotes for empty string */ else if (pg_strcasecmp(values[i], "NULL") == 0) - needquote = true; /* force quotes for literal NULL */ + needquote = true; /* force quotes for literal NULL */ else needquote = false; @@ -2315,7 +2315,7 @@ array_set_element(Datum arraydatum, return PointerGetDatum(construct_md_array(&dataValue, &isNull, nSubscripts, dim, lb, elmtype, - elmlen, elmbyval, elmalign)); + elmlen, elmbyval, elmalign)); } if (ndim != nSubscripts) @@ -2341,14 +2341,14 @@ array_set_element(Datum arraydatum, dim[0] += addedbefore; lb[0] = indx[0]; if (addedbefore > 1) - newhasnulls = true; /* will insert nulls */ + newhasnulls = true; /* will insert nulls */ } if (indx[0] >= (dim[0] + lb[0])) { addedafter = indx[0] - (dim[0] + lb[0]) + 1; dim[0] += addedafter; if (addedafter > 1) - newhasnulls = true; /* will insert nulls */ + newhasnulls = true; /* will insert nulls */ } } else @@ -2543,7 +2543,7 @@ array_set_element_expanded(Datum arraydatum, eah->dims = (int *) MemoryContextAllocZero(eah->hdr.eoh_context, nSubscripts * sizeof(int)); eah->lbound = (int *) MemoryContextAllocZero(eah->hdr.eoh_context, - nSubscripts * sizeof(int)); + nSubscripts * sizeof(int)); /* Update local copies of dimension info */ ndim = nSubscripts; @@ -2598,7 +2598,7 @@ array_set_element_expanded(Datum arraydatum, lb[0] = indx[0]; dimschanged = true; if (addedbefore > 1) - newhasnulls = true; /* will insert nulls */ + newhasnulls = true; /* will insert nulls */ } if (indx[0] >= (dim[0] + lb[0])) { @@ -2606,7 +2606,7 @@ array_set_element_expanded(Datum arraydatum, dim[0] += addedafter; dimschanged = true; if (addedafter > 1) - newhasnulls = true; /* will insert nulls */ + newhasnulls = true; /* will insert nulls */ } } else @@ -2815,7 +2815,7 @@ array_set_slice(Datum arraydatum, */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("updates on slices of fixed-length arrays not implemented"))); + errmsg("updates on slices of fixed-length arrays not implemented"))); } /* detoast arrays if necessary */ @@ -2846,9 +2846,9 @@ array_set_slice(Datum arraydatum, if (!upperProvided[i] || !lowerProvided[i]) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("array slice subscript must provide both boundaries"), - errdetail("When assigning to a slice of an empty array value," - " slice boundaries must be fully specified."))); + errmsg("array slice subscript must provide both boundaries"), + errdetail("When assigning to a slice of an empty array value," + " slice boundaries must be fully specified."))); dim[i] = 1 + upperIndx[i] - lowerIndx[i]; lb[i] = lowerIndx[i]; @@ -2862,7 +2862,7 @@ array_set_slice(Datum arraydatum, return PointerGetDatum(construct_md_array(dvalues, dnulls, nSubscripts, dim, lb, elmtype, - elmlen, elmbyval, elmalign)); + elmlen, elmbyval, elmalign)); } if (ndim < nSubscripts || ndim <= 0 || ndim > MAXDIM) @@ -2894,7 +2894,7 @@ array_set_slice(Datum arraydatum, if (lowerIndx[0] < lb[0]) { if (upperIndx[0] < lb[0] - 1) - newhasnulls = true; /* will insert nulls */ + newhasnulls = true; /* will insert nulls */ addedbefore = lb[0] - lowerIndx[0]; dim[0] += addedbefore; lb[0] = lowerIndx[0]; @@ -2902,7 +2902,7 @@ array_set_slice(Datum arraydatum, if (upperIndx[0] >= (dim[0] + lb[0])) { if (lowerIndx[0] > (dim[0] + lb[0])) - newhasnulls = true; /* will insert nulls */ + newhasnulls = true; /* will insert nulls */ addedafter = upperIndx[0] - (dim[0] + lb[0]) + 1; dim[0] += addedafter; } @@ -2922,7 +2922,7 @@ array_set_slice(Datum arraydatum, if (lowerIndx[i] > upperIndx[i]) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("upper bound cannot be less than lower bound"))); + errmsg("upper bound cannot be less than lower bound"))); if (lowerIndx[i] < lb[i] || upperIndx[i] >= (dim[i] + lb[i])) ereport(ERROR, @@ -2937,7 +2937,7 @@ array_set_slice(Datum arraydatum, if (lowerIndx[i] > upperIndx[i]) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("upper bound cannot be less than lower bound"))); + errmsg("upper bound cannot be less than lower bound"))); } } @@ -2979,7 +2979,7 @@ array_set_slice(Datum arraydatum, ndim, dim, lb, lowerIndx, upperIndx, elmlen, elmbyval, elmalign); - lenbefore = lenafter = 0; /* keep compiler quiet */ + lenbefore = lenafter = 0; /* keep compiler quiet */ itemsbefore = itemsafter = nolditems = 0; } else @@ -3229,7 +3229,7 @@ array_map(FunctionCallInfo fcinfo, Oid retType, ArrayMapState *amstate) /* Get source element, checking for NULL */ fcinfo->arg[0] = array_iter_next(&iter, &fcinfo->argnull[0], i, - inp_typlen, inp_typbyval, inp_typalign); + inp_typlen, inp_typbyval, inp_typalign); /* * Apply the given function to source elt and extra args. @@ -3533,7 +3533,7 @@ deconstruct_array(ArrayType *array, else ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("null array element not allowed in this context"))); + errmsg("null array element not allowed in this context"))); } else { @@ -3659,8 +3659,8 @@ array_eq(PG_FUNCTION_ARGS) if (!OidIsValid(typentry->eq_opr_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify an equality operator for type %s", - format_type_be(element_type)))); + errmsg("could not identify an equality operator for type %s", + format_type_be(element_type)))); fcinfo->flinfo->fn_extra = (void *) typentry; } typlen = typentry->typlen; @@ -3823,8 +3823,8 @@ array_cmp(FunctionCallInfo fcinfo) if (!OidIsValid(typentry->cmp_proc_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify a comparison function for type %s", - format_type_be(element_type)))); + errmsg("could not identify a comparison function for type %s", + format_type_be(element_type)))); fcinfo->flinfo->fn_extra = (void *) typentry; } typlen = typentry->typlen; @@ -4097,8 +4097,8 @@ array_contain_compare(AnyArrayType *array1, AnyArrayType *array2, Oid collation, if (!OidIsValid(typentry->eq_opr_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify an equality operator for type %s", - format_type_be(element_type)))); + errmsg("could not identify an equality operator for type %s", + format_type_be(element_type)))); *fn_extra = (void *) typentry; } typlen = typentry->typlen; @@ -4986,8 +4986,7 @@ initArrayResult(Oid element_type, MemoryContext rcontext, bool subcontext) MemoryContextAlloc(arr_context, sizeof(ArrayBuildState)); astate->mcontext = arr_context; astate->private_cxt = subcontext; - astate->alen = (subcontext ? 64 : 8); /* arbitrary starting array - * size */ + astate->alen = (subcontext ? 64 : 8); /* arbitrary starting array size */ astate->dvalues = (Datum *) MemoryContextAlloc(arr_context, astate->alen * sizeof(Datum)); astate->dnulls = (bool *) @@ -5163,8 +5162,7 @@ initArrayResultArr(Oid array_type, Oid element_type, MemoryContext rcontext, bool subcontext) { ArrayBuildStateArr *astate; - MemoryContext arr_context = rcontext; /* by default use the parent - * ctx */ + MemoryContext arr_context = rcontext; /* by default use the parent ctx */ /* Lookup element type, unless element_type already provided */ if (!OidIsValid(element_type)) @@ -5286,7 +5284,7 @@ accumArrayResultArr(ArrayBuildStateArr *astate, if (astate->ndims != ndims + 1) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("cannot accumulate arrays of different dimensionality"))); + errmsg("cannot accumulate arrays of different dimensionality"))); for (i = 0; i < ndims; i++) { if (astate->dims[i + 1] != dims[i] || astate->lbs[i + 1] != lbs[i]) @@ -5658,7 +5656,7 @@ array_fill_with_lower_bounds(PG_FUNCTION_ARGS) if (PG_ARGISNULL(1) || PG_ARGISNULL(2)) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("dimension array or low bound array cannot be null"))); + errmsg("dimension array or low bound array cannot be null"))); dims = PG_GETARG_ARRAYTYPE_P(1); lbs = PG_GETARG_ARRAYTYPE_P(2); @@ -5698,7 +5696,7 @@ array_fill(PG_FUNCTION_ARGS) if (PG_ARGISNULL(1)) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("dimension array or low bound array cannot be null"))); + errmsg("dimension array or low bound array cannot be null"))); dims = PG_GETARG_ARRAYTYPE_P(1); @@ -6059,8 +6057,8 @@ array_replace_internal(ArrayType *array, if (!OidIsValid(typentry->eq_opr_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify an equality operator for type %s", - format_type_be(element_type)))); + errmsg("could not identify an equality operator for type %s", + format_type_be(element_type)))); fcinfo->flinfo->fn_extra = (void *) typentry; } typlen = typentry->typlen; @@ -6179,8 +6177,8 @@ array_replace_internal(ArrayType *array, if (!AllocSizeIsValid(nbytes)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("array size exceeds the maximum allowed (%d)", - (int) MaxAllocSize))); + errmsg("array size exceeds the maximum allowed (%d)", + (int) MaxAllocSize))); } nresult++; } @@ -6345,8 +6343,8 @@ width_bucket_array(PG_FUNCTION_ARGS) if (!OidIsValid(typentry->cmp_proc_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify a comparison function for type %s", - format_type_be(element_type)))); + errmsg("could not identify a comparison function for type %s", + format_type_be(element_type)))); fcinfo->flinfo->fn_extra = (void *) typentry; } diff --git a/src/backend/utils/adt/arrayutils.c b/src/backend/utils/adt/arrayutils.c index a46d8629c3..27b24703b0 100644 --- a/src/backend/utils/adt/arrayutils.c +++ b/src/backend/utils/adt/arrayutils.c @@ -93,7 +93,7 @@ ArrayGetNItems(int ndim, const int *dims) errmsg("array size exceeds the maximum allowed (%d)", (int) MaxArraySize))); - prod = (int64) ret *(int64) dims[i]; + prod = (int64) ret * (int64) dims[i]; ret = (int32) prod; if ((int64) ret != prod) diff --git a/src/backend/utils/adt/ascii.c b/src/backend/utils/adt/ascii.c index e219d4b495..362272277f 100644 --- a/src/backend/utils/adt/ascii.c +++ b/src/backend/utils/adt/ascii.c @@ -102,9 +102,9 @@ pg_to_ascii(unsigned char *src, unsigned char *src_end, unsigned char *dest, int static text * encode_to_ascii(text *data, int enc) { - pg_to_ascii((unsigned char *) VARDATA(data), /* src */ - (unsigned char *) (data) + VARSIZE(data), /* src end */ - (unsigned char *) VARDATA(data), /* dest */ + pg_to_ascii((unsigned char *) VARDATA(data), /* src */ + (unsigned char *) (data) + VARSIZE(data), /* src end */ + (unsigned char *) VARDATA(data), /* dest */ enc); /* encoding */ return data; diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c index a170294b94..7bbc634bd2 100644 --- a/src/backend/utils/adt/cash.c +++ b/src/backend/utils/adt/cash.c @@ -84,7 +84,7 @@ num_word(Cash value) } return buf; -} /* num_word() */ +} /* num_word() */ /* cash_in() * Convert a string to a cash data type. @@ -132,7 +132,7 @@ cash_in(PG_FUNCTION_ARGS) dsymbol = '.'; if (*lconvert->mon_thousands_sep != '\0') ssymbol = lconvert->mon_thousands_sep; - else /* ssymbol should not equal dsymbol */ + else /* ssymbol should not equal dsymbol */ ssymbol = (dsymbol != ',') ? "," : "."; csymbol = (*lconvert->currency_symbol != '\0') ? lconvert->currency_symbol : "$"; psymbol = (*lconvert->positive_sign != '\0') ? lconvert->positive_sign : "+"; @@ -347,7 +347,7 @@ cash_out(PG_FUNCTION_ARGS) dsymbol = '.'; if (*lconvert->mon_thousands_sep != '\0') ssymbol = lconvert->mon_thousands_sep; - else /* ssymbol should not equal dsymbol */ + else /* ssymbol should not equal dsymbol */ ssymbol = (dsymbol != ',') ? "," : "."; csymbol = (*lconvert->currency_symbol != '\0') ? lconvert->currency_symbol : "$"; @@ -971,10 +971,10 @@ cash_words(PG_FUNCTION_ARGS) val = (uint64) value; m0 = val % INT64CONST(100); /* cents */ - m1 = (val / INT64CONST(100)) % 1000; /* hundreds */ - m2 = (val / INT64CONST(100000)) % 1000; /* thousands */ + m1 = (val / INT64CONST(100)) % 1000; /* hundreds */ + m2 = (val / INT64CONST(100000)) % 1000; /* thousands */ m3 = (val / INT64CONST(100000000)) % 1000; /* millions */ - m4 = (val / INT64CONST(100000000000)) % 1000; /* billions */ + m4 = (val / INT64CONST(100000000000)) % 1000; /* billions */ m5 = (val / INT64CONST(100000000000000)) % 1000; /* trillions */ m6 = (val / INT64CONST(100000000000000000)) % 1000; /* quadrillions */ diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index baf2957c1a..ca3c0e37a9 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -45,10 +45,10 @@ #endif -static int time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec); -static int timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp); -static int tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result); -static int tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result); +static int time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec); +static int timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp); +static int tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result); +static int tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result); static void AdjustTimeForTypmod(TimeADT *time, int32 typmod); @@ -147,7 +147,7 @@ date_in(PG_FUNCTION_ARGS) case DTK_CURRENT: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("date/time value \"current\" is no longer supported"))); + errmsg("date/time value \"current\" is no longer supported"))); GetCurrentDateTime(tm); break; @@ -314,7 +314,7 @@ EncodeSpecialDate(DateADT dt, char *str) strcpy(str, EARLY); else if (DATE_IS_NOEND(dt)) strcpy(str, LATE); - else /* shouldn't happen */ + else /* shouldn't happen */ elog(ERROR, "invalid argument for EncodeSpecialDate"); } @@ -539,7 +539,7 @@ date_pli(PG_FUNCTION_ARGS) DateADT result; if (DATE_NOT_FINITE(dateVal)) - PG_RETURN_DATEADT(dateVal); /* can't change infinity */ + PG_RETURN_DATEADT(dateVal); /* can't change infinity */ result = dateVal + days; @@ -563,7 +563,7 @@ date_mii(PG_FUNCTION_ARGS) DateADT result; if (DATE_NOT_FINITE(dateVal)) - PG_RETURN_DATEADT(dateVal); /* can't change infinity */ + PG_RETURN_DATEADT(dateVal); /* can't change infinity */ result = dateVal - days; @@ -1173,7 +1173,7 @@ abstime_date(PG_FUNCTION_ARGS) case INVALID_ABSTIME: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert reserved abstime value to date"))); + errmsg("cannot convert reserved abstime value to date"))); result = 0; /* keep compiler quiet */ break; @@ -1247,7 +1247,7 @@ time_in(PG_FUNCTION_ARGS) * Convert a tm structure to a time data type. */ static int -tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result) +tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result) { *result = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec) * USECS_PER_SEC) + fsec; @@ -1262,7 +1262,7 @@ tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result) * if pg_time_t is just 32 bits) - thomas 97/05/27 */ static int -time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec) +time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec) { tm->tm_hour = time / USECS_PER_HOUR; time -= tm->tm_hour * USECS_PER_HOUR; @@ -1946,7 +1946,7 @@ time_part(PG_FUNCTION_ARGS) * Convert a tm structure to a time data type. */ static int -tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result) +tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result) { result->time = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec) * USECS_PER_SEC) + fsec; @@ -2080,7 +2080,7 @@ timetztypmodout(PG_FUNCTION_ARGS) * Convert TIME WITH TIME ZONE data type to POSIX time structure. */ static int -timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp) +timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp) { TimeOffset trem = time->time; @@ -2610,8 +2610,8 @@ timetz_part(PG_FUNCTION_ARGS) default: ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("\"time with time zone\" units \"%s\" not recognized", - lowunits))); + errmsg("\"time with time zone\" units \"%s\" not recognized", + lowunits))); result = 0; } } @@ -2728,9 +2728,9 @@ timetz_izone(PG_FUNCTION_ARGS) if (zone->month != 0 || zone->day != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("interval time zone \"%s\" must not include months or days", - DatumGetCString(DirectFunctionCall1(interval_out, - PointerGetDatum(zone)))))); + errmsg("interval time zone \"%s\" must not include months or days", + DatumGetCString(DirectFunctionCall1(interval_out, + PointerGetDatum(zone)))))); tz = -(zone->time / USECS_PER_SEC); diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 30db3bf7e5..a3d7dc3697 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -34,22 +34,22 @@ static int DecodeNumber(int flen, char *field, bool haveTextMonth, int fmask, int *tmask, - struct pg_tm * tm, fsec_t *fsec, bool *is2digits); + struct pg_tm *tm, fsec_t *fsec, bool *is2digits); static int DecodeNumberField(int len, char *str, int fmask, int *tmask, - struct pg_tm * tm, fsec_t *fsec, bool *is2digits); + struct pg_tm *tm, fsec_t *fsec, bool *is2digits); static int DecodeTime(char *str, int fmask, int range, - int *tmask, struct pg_tm * tm, fsec_t *fsec); + int *tmask, struct pg_tm *tm, fsec_t *fsec); static const datetkn *datebsearch(const char *key, const datetkn *base, int nel); static int DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, - struct pg_tm * tm); + struct pg_tm *tm); static char *AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros); -static void AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, +static void AdjustFractSeconds(double frac, struct pg_tm *tm, fsec_t *fsec, int scale); -static void AdjustFractDays(double frac, struct pg_tm * tm, fsec_t *fsec, +static void AdjustFractDays(double frac, struct pg_tm *tm, fsec_t *fsec, int scale); -static int DetermineTimeZoneOffsetInternal(struct pg_tm * tm, pg_tz *tzp, +static int DetermineTimeZoneOffsetInternal(struct pg_tm *tm, pg_tz *tzp, pg_time_t *tp); static bool DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t, const char *abbr, pg_tz *tzp, @@ -91,7 +91,7 @@ static const datetkn datetktbl[] = { /* token, type, value */ {EARLY, RESERV, DTK_EARLY}, /* "-infinity" reserved for "early time" */ {DA_D, ADBC, AD}, /* "ad" for years > 0 */ - {"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */ + {"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */ {"am", AMPM, AM}, {"apr", MONTH, 4}, {"april", MONTH, 4}, @@ -113,8 +113,8 @@ static const datetkn datetktbl[] = { {"friday", DOW, 5}, {"h", UNITS, DTK_HOUR}, /* "hour" */ {LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */ - {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */ - {"isodow", UNITS, DTK_ISODOW}, /* ISO day of week, Sunday == 7 */ + {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */ + {"isodow", UNITS, DTK_ISODOW}, /* ISO day of week, Sunday == 7 */ {"isoyear", UNITS, DTK_ISOYEAR}, /* year in terms of the ISO week date */ {"j", UNITS, DTK_JULIAN}, {"jan", MONTH, 1}, @@ -176,33 +176,33 @@ static const datetkn deltatktbl[] = { {"@", IGNORE_DTF, 0}, /* postgres relative prefix */ {DAGO, AGO, 0}, /* "ago" indicates negative time offset */ {"c", UNITS, DTK_CENTURY}, /* "century" relative */ - {"cent", UNITS, DTK_CENTURY}, /* "century" relative */ + {"cent", UNITS, DTK_CENTURY}, /* "century" relative */ {"centuries", UNITS, DTK_CENTURY}, /* "centuries" relative */ - {DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative */ + {DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative */ {"d", UNITS, DTK_DAY}, /* "day" relative */ {DDAY, UNITS, DTK_DAY}, /* "day" relative */ {"days", UNITS, DTK_DAY}, /* "days" relative */ {"dec", UNITS, DTK_DECADE}, /* "decade" relative */ - {DDECADE, UNITS, DTK_DECADE}, /* "decade" relative */ - {"decades", UNITS, DTK_DECADE}, /* "decades" relative */ + {DDECADE, UNITS, DTK_DECADE}, /* "decade" relative */ + {"decades", UNITS, DTK_DECADE}, /* "decades" relative */ {"decs", UNITS, DTK_DECADE}, /* "decades" relative */ {"h", UNITS, DTK_HOUR}, /* "hour" relative */ {DHOUR, UNITS, DTK_HOUR}, /* "hour" relative */ {"hours", UNITS, DTK_HOUR}, /* "hours" relative */ {"hr", UNITS, DTK_HOUR}, /* "hour" relative */ {"hrs", UNITS, DTK_HOUR}, /* "hours" relative */ - {INVALID, RESERV, DTK_INVALID}, /* reserved for invalid time */ + {INVALID, RESERV, DTK_INVALID}, /* reserved for invalid time */ {"m", UNITS, DTK_MINUTE}, /* "minute" relative */ - {"microsecon", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ - {"mil", UNITS, DTK_MILLENNIUM}, /* "millennium" relative */ - {"millennia", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */ - {DMILLENNIUM, UNITS, DTK_MILLENNIUM}, /* "millennium" relative */ - {"millisecon", UNITS, DTK_MILLISEC}, /* relative */ + {"microsecon", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ + {"mil", UNITS, DTK_MILLENNIUM}, /* "millennium" relative */ + {"millennia", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */ + {DMILLENNIUM, UNITS, DTK_MILLENNIUM}, /* "millennium" relative */ + {"millisecon", UNITS, DTK_MILLISEC}, /* relative */ {"mils", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */ {"min", UNITS, DTK_MINUTE}, /* "minute" relative */ {"mins", UNITS, DTK_MINUTE}, /* "minutes" relative */ - {DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative */ - {"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative */ + {DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative */ + {"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative */ {"mon", UNITS, DTK_MONTH}, /* "months" relative */ {"mons", UNITS, DTK_MONTH}, /* "months" relative */ {DMONTH, UNITS, DTK_MONTH}, /* "month" relative */ @@ -213,7 +213,7 @@ static const datetkn deltatktbl[] = { {"mseconds", UNITS, DTK_MILLISEC}, {"msecs", UNITS, DTK_MILLISEC}, {"qtr", UNITS, DTK_QUARTER}, /* "quarter" relative */ - {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative */ + {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative */ {"s", UNITS, DTK_SECOND}, {"sec", UNITS, DTK_SECOND}, {DSECOND, UNITS, DTK_SECOND}, @@ -221,13 +221,13 @@ static const datetkn deltatktbl[] = { {"secs", UNITS, DTK_SECOND}, {DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */ {"timezone_h", UNITS, DTK_TZ_HOUR}, /* timezone hour units */ - {"timezone_m", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */ + {"timezone_m", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */ {"undefined", RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */ {"us", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ - {"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ + {"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ {DMICROSEC, UNITS, DTK_MICROSEC}, /* "microsecond" relative */ {"useconds", UNITS, DTK_MICROSEC}, /* "microseconds" relative */ - {"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative */ + {"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative */ {"w", UNITS, DTK_WEEK}, /* "week" relative */ {DWEEK, UNITS, DTK_WEEK}, /* "week" relative */ {"weeks", UNITS, DTK_WEEK}, /* "weeks" relative */ @@ -311,7 +311,7 @@ date2j(int y, int m, int d) julian += 7834 * m / 256 + d; return julian; -} /* date2j() */ +} /* date2j() */ void j2date(int jd, int *year, int *month, int *day) @@ -338,7 +338,7 @@ j2date(int jd, int *year, int *month, int *day) *month = (quad + 10) % MONTHS_PER_YEAR + 1; return; -} /* j2date() */ +} /* j2date() */ /* @@ -358,7 +358,7 @@ j2day(int date) date += 7; return date; -} /* j2day() */ +} /* j2day() */ /* @@ -367,7 +367,7 @@ j2day(int date) * Get the transaction start time ("now()") broken down as a struct pg_tm. */ void -GetCurrentDateTime(struct pg_tm * tm) +GetCurrentDateTime(struct pg_tm *tm) { int tz; fsec_t fsec; @@ -384,7 +384,7 @@ GetCurrentDateTime(struct pg_tm * tm) * including fractional seconds and timezone offset. */ void -GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp) +GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp) { int tz; @@ -471,7 +471,7 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros) * there; callers are responsible for NUL terminating str themselves. */ static char * -AppendTimestampSeconds(char *cp, struct pg_tm * tm, fsec_t fsec) +AppendTimestampSeconds(char *cp, struct pg_tm *tm, fsec_t fsec) { return AppendSeconds(cp, tm->tm_sec, fsec, MAX_TIMESTAMP_PRECISION, true); } @@ -481,7 +481,7 @@ AppendTimestampSeconds(char *cp, struct pg_tm * tm, fsec_t fsec) * We assume the input frac is less than 1 so overflow is not an issue. */ static void -AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, int scale) +AdjustFractSeconds(double frac, struct pg_tm *tm, fsec_t *fsec, int scale) { int sec; @@ -496,7 +496,7 @@ AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, int scale) /* As above, but initial scale produces days */ static void -AdjustFractDays(double frac, struct pg_tm * tm, fsec_t *fsec, int scale) +AdjustFractDays(double frac, struct pg_tm *tm, fsec_t *fsec, int scale) { int extra_days; @@ -781,7 +781,7 @@ ParseDateTime(const char *timestr, char *workbuf, size_t buflen, */ int DecodeDateTime(char **field, int *ftype, int nf, - int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp) + int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp) { int fmask = 0, tmask, @@ -1205,8 +1205,8 @@ DecodeDateTime(char **field, int *ftype, int nf, { case DTK_CURRENT: ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("date/time value \"current\" is no longer supported"))); + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("date/time value \"current\" is no longer supported"))); return DTERR_BAD_FORMAT; break; @@ -1222,7 +1222,7 @@ DecodeDateTime(char **field, int *ftype, int nf, *dtype = DTK_DATE; GetCurrentDateTime(&cur_tm); j2date(date2j(cur_tm.tm_year, cur_tm.tm_mon, cur_tm.tm_mday) - 1, - &tm->tm_year, &tm->tm_mon, &tm->tm_mday); + &tm->tm_year, &tm->tm_mon, &tm->tm_mday); break; case DTK_TODAY: @@ -1239,7 +1239,7 @@ DecodeDateTime(char **field, int *ftype, int nf, *dtype = DTK_DATE; GetCurrentDateTime(&cur_tm); j2date(date2j(cur_tm.tm_year, cur_tm.tm_mon, cur_tm.tm_mday) + 1, - &tm->tm_year, &tm->tm_mon, &tm->tm_mday); + &tm->tm_year, &tm->tm_mon, &tm->tm_mday); break; case DTK_ZULU: @@ -1468,7 +1468,7 @@ DecodeDateTime(char **field, int *ftype, int nf, * though probably some higher-level code will. */ int -DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp) +DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp) { pg_time_t t; @@ -1490,7 +1490,7 @@ DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp) * of mktime(), anyway. */ static int -DetermineTimeZoneOffsetInternal(struct pg_tm * tm, pg_tz *tzp, pg_time_t *tp) +DetermineTimeZoneOffsetInternal(struct pg_tm *tm, pg_tz *tzp, pg_time_t *tp) { int date, sec; @@ -1626,7 +1626,7 @@ overflow: * back to doing DetermineTimeZoneOffset().) */ int -DetermineTimeZoneAbbrevOffset(struct pg_tm * tm, const char *abbr, pg_tz *tzp) +DetermineTimeZoneAbbrevOffset(struct pg_tm *tm, const char *abbr, pg_tz *tzp) { pg_time_t t; int zone_offset; @@ -1742,7 +1742,7 @@ DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t, const char *abbr, pg_tz *tzp, */ int DecodeTimeOnly(char **field, int *ftype, int nf, - int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp) + int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp) { int fmask = 0, tmask, @@ -2113,8 +2113,8 @@ DecodeTimeOnly(char **field, int *ftype, int nf, { case DTK_CURRENT: ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("date/time value \"current\" is no longer supported"))); + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("date/time value \"current\" is no longer supported"))); return DTERR_BAD_FORMAT; break; @@ -2367,7 +2367,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, */ static int DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, - struct pg_tm * tm) + struct pg_tm *tm) { fsec_t fsec; int nf = 0; @@ -2477,7 +2477,7 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, */ int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, - struct pg_tm * tm) + struct pg_tm *tm) { if (fmask & DTK_M(YEAR)) { @@ -2556,7 +2556,7 @@ ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, */ static int DecodeTime(char *str, int fmask, int range, - int *tmask, struct pg_tm * tm, fsec_t *fsec) + int *tmask, struct pg_tm *tm, fsec_t *fsec) { char *cp; int dterr; @@ -2632,7 +2632,7 @@ DecodeTime(char *str, int fmask, int range, */ static int DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask, - int *tmask, struct pg_tm * tm, fsec_t *fsec, bool *is2digits) + int *tmask, struct pg_tm *tm, fsec_t *fsec, bool *is2digits) { int val; char *cp; @@ -2752,7 +2752,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask, if (flen >= 3 && *is2digits) { /* Guess that first numeric field is day was wrong */ - *tmask = DTK_M(DAY); /* YEAR is already set */ + *tmask = DTK_M(DAY); /* YEAR is already set */ tm->tm_mday = tm->tm_year; tm->tm_year = val; *is2digits = FALSE; @@ -2817,7 +2817,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask, */ static int DecodeNumberField(int len, char *str, int fmask, - int *tmask, struct pg_tm * tm, fsec_t *fsec, bool *is2digits) + int *tmask, struct pg_tm *tm, fsec_t *fsec, bool *is2digits) { char *cp; @@ -3068,7 +3068,7 @@ DecodeSpecial(int field, char *lowtoken, int *val) * Zero out a pg_tm and associated fsec_t */ static inline void -ClearPgTm(struct pg_tm * tm, fsec_t *fsec) +ClearPgTm(struct pg_tm *tm, fsec_t *fsec) { tm->tm_year = 0; tm->tm_mon = 0; @@ -3093,7 +3093,7 @@ ClearPgTm(struct pg_tm * tm, fsec_t *fsec) */ int DecodeInterval(char **field, int *ftype, int nf, int range, - int *dtype, struct pg_tm * tm, fsec_t *fsec) + int *dtype, struct pg_tm *tm, fsec_t *fsec) { bool is_before = FALSE; char *cp; @@ -3519,7 +3519,7 @@ ISO8601IntegerWidth(char *fieldstart) */ int DecodeISO8601Interval(char *str, - int *dtype, struct pg_tm * tm, fsec_t *fsec) + int *dtype, struct pg_tm *tm, fsec_t *fsec) { bool datepart = true; bool havefield = false; @@ -3749,7 +3749,7 @@ DecodeUnits(int field, char *lowtoken, int *val) } return type; -} /* DecodeUnits() */ +} /* DecodeUnits() */ /* * Report an error detected by one of the datetime input processing routines. @@ -3778,7 +3778,7 @@ DateTimeParseError(int dterr, const char *str, const char *datatype) (errcode(ERRCODE_DATETIME_FIELD_OVERFLOW), errmsg("date/time field value out of range: \"%s\"", str), - errhint("Perhaps you need a different \"datestyle\" setting."))); + errhint("Perhaps you need a different \"datestyle\" setting."))); break; case DTERR_INTERVAL_OVERFLOW: ereport(ERROR, @@ -3881,7 +3881,7 @@ EncodeTimezone(char *str, int tz, int style) * Encode date as local time. */ void -EncodeDateOnly(struct pg_tm * tm, int style, char *str) +EncodeDateOnly(struct pg_tm *tm, int style, char *str) { Assert(tm->tm_mon >= 1 && tm->tm_mon <= MONTHS_PER_YEAR); @@ -3891,7 +3891,7 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str) case USE_XSD_DATES: /* compatible with ISO date formats */ str = pg_ltostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); *str++ = '-'; str = pg_ltostr_zeropad(str, tm->tm_mon, 2); *str++ = '-'; @@ -3914,7 +3914,7 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str) } *str++ = '/'; str = pg_ltostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); break; case USE_GERMAN_DATES: @@ -3924,7 +3924,7 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str) str = pg_ltostr_zeropad(str, tm->tm_mon, 2); *str++ = '.'; str = pg_ltostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); break; case USE_POSTGRES_DATES: @@ -3944,7 +3944,7 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str) } *str++ = '-'; str = pg_ltostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); break; } @@ -3966,7 +3966,7 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str) * output. */ void -EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style, char *str) +EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, int style, char *str) { str = pg_ltostr_zeropad(str, tm->tm_hour, 2); *str++ = ':'; @@ -3996,7 +3996,7 @@ EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style, * XSD - yyyy-mm-ddThh:mm:ss.ss+/-tz */ void -EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str) +EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str) { int day; @@ -4014,7 +4014,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char case USE_XSD_DATES: /* Compatible with ISO-8601 date formats */ str = pg_ltostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); *str++ = '-'; str = pg_ltostr_zeropad(str, tm->tm_mon, 2); *str++ = '-'; @@ -4045,7 +4045,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char } *str++ = '/'; str = pg_ltostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); *str++ = ' '; str = pg_ltostr_zeropad(str, tm->tm_hour, 2); *str++ = ':'; @@ -4077,7 +4077,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char str = pg_ltostr_zeropad(str, tm->tm_mon, 2); *str++ = '.'; str = pg_ltostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); *str++ = ' '; str = pg_ltostr_zeropad(str, tm->tm_hour, 2); *str++ = ':'; @@ -4127,7 +4127,7 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char str = AppendTimestampSeconds(str, tm, fsec); *str++ = ' '; str = pg_ltostr_zeropad(str, - (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); + (tm->tm_year > 0) ? tm->tm_year : -(tm->tm_year - 1), 4); if (print_tz) { @@ -4238,7 +4238,7 @@ AddVerboseIntPart(char *cp, int value, const char *units, * "day-time literal"s (that look like ('4 5:6:7') */ void -EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) +EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str) { char *cp = str; int year = tm->tm_year; @@ -4860,7 +4860,7 @@ pg_timezone_names(PG_FUNCTION_ARGS) * reasonably omit from the pg_timezone_names view. */ if (tzn && (strcmp(tzn, "-00") == 0 || - strcmp(tzn, "Local time zone must be set--see zic manual page") == 0)) + strcmp(tzn, "Local time zone must be set--see zic manual page") == 0)) continue; /* Found a displayable zone */ diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index c1446bb2a3..6c9ab212ae 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -405,7 +405,7 @@ pg_relation_size(PG_FUNCTION_ARGS) PG_RETURN_NULL(); size = calculate_relation_size(&(rel->rd_node), rel->rd_backend, - forkname_to_number(text_to_cstring(forkName))); + forkname_to_number(text_to_cstring(forkName))); relation_close(rel, AccessShareLock); @@ -925,10 +925,10 @@ pg_size_bytes(PG_FUNCTION_ARGS) Numeric mul_num; mul_num = DatumGetNumeric(DirectFunctionCall1(int8_numeric, - Int64GetDatum(multiplier))); + Int64GetDatum(multiplier))); num = DatumGetNumeric(DirectFunctionCall2(numeric_mul, - NumericGetDatum(mul_num), + NumericGetDatum(mul_num), NumericGetDatum(num))); } } @@ -976,7 +976,7 @@ pg_relation_filenode(PG_FUNCTION_ARGS) /* okay, these have storage */ if (relform->relfilenode) result = relform->relfilenode; - else /* Consult the relation mapper */ + else /* Consult the relation mapper */ result = RelationMapOidToFilenode(relid, relform->relisshared); break; @@ -1063,9 +1063,9 @@ pg_relation_filepath(PG_FUNCTION_ARGS) rnode.dbNode = MyDatabaseId; if (relform->relfilenode) rnode.relNode = relform->relfilenode; - else /* Consult the relation mapper */ + else /* Consult the relation mapper */ rnode.relNode = RelationMapOidToFilenode(relid, - relform->relisshared); + relform->relisshared); break; default: diff --git a/src/backend/utils/adt/domains.c b/src/backend/utils/adt/domains.c index 73deaa7e1c..e61d91bd88 100644 --- a/src/backend/utils/adt/domains.c +++ b/src/backend/utils/adt/domains.c @@ -174,7 +174,7 @@ domain_check_input(Datum value, bool isnull, DomainIOData *my_extra) */ econtext->domainValue_datum = MakeExpandedObjectReadOnly(value, isnull, - my_extra->constraint_ref.tcache->typlen); + my_extra->constraint_ref.tcache->typlen); econtext->domainValue_isNull = isnull; if (!ExecCheck(con->check_exprstate, econtext)) diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c index 8fd8ede39e..742ce6f97e 100644 --- a/src/backend/utils/adt/encode.c +++ b/src/backend/utils/adt/encode.c @@ -175,7 +175,7 @@ hex_decode(const char *src, unsigned len, char *dst) if (s >= srcend) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid hexadecimal data: odd number of digits"))); + errmsg("invalid hexadecimal data: odd number of digits"))); v2 = get_hex(*s++); *p++ = v1 | v2; @@ -520,7 +520,7 @@ static const struct { const char *name; struct pg_encoding enc; -} enclist[] = +} enclist[] = { { diff --git a/src/backend/utils/adt/enum.c b/src/backend/utils/adt/enum.c index b1d2a6f0c3..973397cc85 100644 --- a/src/backend/utils/adt/enum.c +++ b/src/backend/utils/adt/enum.c @@ -115,7 +115,7 @@ check_safe_enum_use(HeapTuple enumval_tup) errmsg("unsafe use of new value \"%s\" of enum type %s", NameStr(en->enumlabel), format_type_be(en->enumtypid)), - errhint("New enum values must be committed before they can be used."))); + errhint("New enum values must be committed before they can be used."))); } diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index 894f026a41..18b3b949ac 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -65,7 +65,7 @@ do { \ /* Configurable GUC parameter */ -int extra_float_digits = 0; /* Added to DBL_DIG or FLT_DIG */ +int extra_float_digits = 0; /* Added to DBL_DIG or FLT_DIG */ /* Cached constants for degree-based trig functions */ static bool degree_consts_set = false; @@ -105,7 +105,7 @@ static void init_degree_constants(void); */ #define cbrt my_cbrt static double cbrt(double x); -#endif /* HAVE_CBRT */ +#endif /* HAVE_CBRT */ /* @@ -329,7 +329,7 @@ float4in(PG_FUNCTION_ARGS) if (endptr != num && endptr[-1] == '\0') endptr--; } -#endif /* HAVE_BUGGY_SOLARIS_STRTOD */ +#endif /* HAVE_BUGGY_SOLARIS_STRTOD */ /* skip trailing whitespace */ while (*endptr != '\0' && isspace((unsigned char) *endptr)) @@ -534,8 +534,8 @@ float8in_internal(char *num, char **endptr_p, errnumber[endptr - num] = '\0'; ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("\"%s\" is out of range for type double precision", - errnumber))); + errmsg("\"%s\" is out of range for type double precision", + errnumber))); } } else @@ -555,7 +555,7 @@ float8in_internal(char *num, char **endptr_p, if (endptr != num && endptr[-1] == '\0') endptr--; } -#endif /* HAVE_BUGGY_SOLARIS_STRTOD */ +#endif /* HAVE_BUGGY_SOLARIS_STRTOD */ /* skip trailing whitespace */ while (*endptr != '\0' && isspace((unsigned char) *endptr)) @@ -3534,7 +3534,7 @@ width_bucket_float8(PG_FUNCTION_ARGS) if (isnan(operand) || isnan(bound1) || isnan(bound2)) ereport(ERROR, (errcode(ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION), - errmsg("operand, lower bound, and upper bound cannot be NaN"))); + errmsg("operand, lower bound, and upper bound cannot be NaN"))); /* Note that we allow "operand" to be infinite */ if (isinf(bound1) || isinf(bound2)) @@ -3608,4 +3608,4 @@ cbrt(double x) return isneg ? -tmpres : tmpres; } -#endif /* !HAVE_CBRT */ +#endif /* !HAVE_CBRT */ diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 4127bece12..46f45f6654 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -114,8 +114,8 @@ * Maximal length of one node * ---------- */ -#define DCH_MAX_ITEM_SIZ 12 /* max localized day name */ -#define NUM_MAX_ITEM_SIZ 8 /* roman number (RN has 15 chars) */ +#define DCH_MAX_ITEM_SIZ 12 /* max localized day name */ +#define NUM_MAX_ITEM_SIZ 8 /* roman number (RN has 15 chars) */ /* ---------- * More is in float.c @@ -667,7 +667,7 @@ typedef enum /* last */ _DCH_last_ -} DCH_poz; +} DCH_poz; typedef enum { @@ -710,7 +710,7 @@ typedef enum /* last */ _NUM_last_ -} NUM_poz; +} NUM_poz; /* ---------- * KeyWords for DATE-TIME version @@ -724,7 +724,7 @@ static const KeyWord DCH_keywords[] = { {"AM", 2, DCH_AM, FALSE, FROM_CHAR_DATE_NONE}, {"B.C.", 4, DCH_B_C, FALSE, FROM_CHAR_DATE_NONE}, /* B */ {"BC", 2, DCH_BC, FALSE, FROM_CHAR_DATE_NONE}, - {"CC", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* C */ + {"CC", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* C */ {"DAY", 3, DCH_DAY, FALSE, FROM_CHAR_DATE_NONE}, /* D */ {"DDD", 3, DCH_DDD, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"DD", 2, DCH_DD, TRUE, FROM_CHAR_DATE_GREGORIAN}, @@ -732,11 +732,11 @@ static const KeyWord DCH_keywords[] = { {"Day", 3, DCH_Day, FALSE, FROM_CHAR_DATE_NONE}, {"Dy", 2, DCH_Dy, FALSE, FROM_CHAR_DATE_NONE}, {"D", 1, DCH_D, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"FX", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* F */ + {"FX", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* F */ {"HH24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE}, /* H */ {"HH12", 4, DCH_HH12, TRUE, FROM_CHAR_DATE_NONE}, {"HH", 2, DCH_HH, TRUE, FROM_CHAR_DATE_NONE}, - {"IDDD", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* I */ + {"IDDD", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* I */ {"ID", 2, DCH_ID, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"IW", 2, DCH_IW, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"IYYY", 4, DCH_IYYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, @@ -744,22 +744,22 @@ static const KeyWord DCH_keywords[] = { {"IY", 2, DCH_IY, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"I", 1, DCH_I, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"J", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* J */ - {"MI", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* M */ + {"MI", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* M */ {"MM", 2, DCH_MM, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"MONTH", 5, DCH_MONTH, FALSE, FROM_CHAR_DATE_GREGORIAN}, {"MON", 3, DCH_MON, FALSE, FROM_CHAR_DATE_GREGORIAN}, {"MS", 2, DCH_MS, TRUE, FROM_CHAR_DATE_NONE}, {"Month", 5, DCH_Month, FALSE, FROM_CHAR_DATE_GREGORIAN}, {"Mon", 3, DCH_Mon, FALSE, FROM_CHAR_DATE_GREGORIAN}, - {"OF", 2, DCH_OF, FALSE, FROM_CHAR_DATE_NONE}, /* O */ + {"OF", 2, DCH_OF, FALSE, FROM_CHAR_DATE_NONE}, /* O */ {"P.M.", 4, DCH_P_M, FALSE, FROM_CHAR_DATE_NONE}, /* P */ {"PM", 2, DCH_PM, FALSE, FROM_CHAR_DATE_NONE}, {"Q", 1, DCH_Q, TRUE, FROM_CHAR_DATE_NONE}, /* Q */ {"RM", 2, DCH_RM, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* R */ {"SSSS", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE}, /* S */ {"SS", 2, DCH_SS, TRUE, FROM_CHAR_DATE_NONE}, - {"TZ", 2, DCH_TZ, FALSE, FROM_CHAR_DATE_NONE}, /* T */ - {"US", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* U */ + {"TZ", 2, DCH_TZ, FALSE, FROM_CHAR_DATE_NONE}, /* T */ + {"US", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* U */ {"WW", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* W */ {"W", 1, DCH_W, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"Y,YYY", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* Y */ @@ -773,17 +773,17 @@ static const KeyWord DCH_keywords[] = { {"am", 2, DCH_am, FALSE, FROM_CHAR_DATE_NONE}, {"b.c.", 4, DCH_b_c, FALSE, FROM_CHAR_DATE_NONE}, /* b */ {"bc", 2, DCH_bc, FALSE, FROM_CHAR_DATE_NONE}, - {"cc", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* c */ + {"cc", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* c */ {"day", 3, DCH_day, FALSE, FROM_CHAR_DATE_NONE}, /* d */ {"ddd", 3, DCH_DDD, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"dd", 2, DCH_DD, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"dy", 2, DCH_dy, FALSE, FROM_CHAR_DATE_NONE}, {"d", 1, DCH_D, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"fx", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* f */ + {"fx", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* f */ {"hh24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE}, /* h */ {"hh12", 4, DCH_HH12, TRUE, FROM_CHAR_DATE_NONE}, {"hh", 2, DCH_HH, TRUE, FROM_CHAR_DATE_NONE}, - {"iddd", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* i */ + {"iddd", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* i */ {"id", 2, DCH_ID, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"iw", 2, DCH_IW, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"iyyy", 4, DCH_IYYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, @@ -791,7 +791,7 @@ static const KeyWord DCH_keywords[] = { {"iy", 2, DCH_IY, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"i", 1, DCH_I, TRUE, FROM_CHAR_DATE_ISOWEEK}, {"j", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* j */ - {"mi", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* m */ + {"mi", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* m */ {"mm", 2, DCH_MM, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"month", 5, DCH_month, FALSE, FROM_CHAR_DATE_GREGORIAN}, {"mon", 3, DCH_mon, FALSE, FROM_CHAR_DATE_GREGORIAN}, @@ -802,8 +802,8 @@ static const KeyWord DCH_keywords[] = { {"rm", 2, DCH_rm, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* r */ {"ssss", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE}, /* s */ {"ss", 2, DCH_SS, TRUE, FROM_CHAR_DATE_NONE}, - {"tz", 2, DCH_tz, FALSE, FROM_CHAR_DATE_NONE}, /* t */ - {"us", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* u */ + {"tz", 2, DCH_tz, FALSE, FROM_CHAR_DATE_NONE}, /* t */ + {"us", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* u */ {"ww", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* w */ {"w", 1, DCH_W, TRUE, FROM_CHAR_DATE_GREGORIAN}, {"y,yyy", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* y */ @@ -976,10 +976,10 @@ static void from_char_set_mode(TmFromChar *tmfc, const FromCharDateMode mode); static void from_char_set_int(int *dest, const int value, const FormatNode *node); static int from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node); static int from_char_parse_int(int *dest, char **src, FormatNode *node); -static int seq_search(char *name, const char *const * array, int type, int max, int *len); -static int from_char_seq_search(int *dest, char **src, const char *const * array, int type, int max, FormatNode *node); +static int seq_search(char *name, const char *const *array, int type, int max, int *len); +static int from_char_seq_search(int *dest, char **src, const char *const *array, int type, int max, FormatNode *node); static void do_to_timestamp(text *date_txt, text *fmt, - struct pg_tm * tm, fsec_t *fsec); + struct pg_tm *tm, fsec_t *fsec); static char *fill_str(char *str, int c, int max); static FormatNode *NUM_cache(int len, NUMDesc *Num, text *pars_str, bool *shouldFree); static char *int_to_roman(int number); @@ -988,7 +988,7 @@ static char *get_last_relevant_decnum(char *num); static void NUM_numpart_from_char(NUMProc *Np, int id, int input_len); static void NUM_numpart_to_char(NUMProc *Np, int id); static char *NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, - char *number, int from_char_input_len, int to_char_out_pre_spaces, + char *number, int from_char_input_len, int to_char_out_pre_spaces, int sign, bool is_to_char, Oid collid); static DCHCacheEntry *DCH_cache_getnew(const char *str); static DCHCacheEntry *DCH_cache_search(const char *str); @@ -1112,7 +1112,7 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n) if (IS_MULTI(num)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("cannot use \"V\" and decimal point together"))); + errmsg("cannot use \"V\" and decimal point together"))); num->flag |= NUM_F_DECIMAL; break; @@ -1195,7 +1195,7 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n) if (IS_DECIMAL(num)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("cannot use \"V\" and decimal point together"))); + errmsg("cannot use \"V\" and decimal point together"))); num->flag |= NUM_F_MULTI; break; @@ -1209,7 +1209,7 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n) IS_ROMAN(num) || IS_MULTI(num)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("\"EEEE\" is incompatible with other formats"), + errmsg("\"EEEE\" is incompatible with other formats"), errdetail("\"EEEE\" may only be used together with digit and decimal point patterns."))); num->flag |= NUM_F_EEEE; break; @@ -1377,7 +1377,7 @@ dump_node(FormatNode *node, int max) elog(DEBUG_elog_output, "%d:\t unknown NODE!", a); } } -#endif /* DEBUG */ +#endif /* DEBUG */ /***************************************************************************** * Private utils @@ -1450,9 +1450,9 @@ 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); + const UChar *src, int32_t srcLength, + const char *locale, + UErrorCode *pErrorCode); static int32_t icu_convert_case(ICU_Convert_Func func, pg_locale_t mylocale, @@ -1491,7 +1491,7 @@ u_strToTitle_default_BI(UChar *dest, int32_t destCapacity, NULL, locale, pErrorCode); } -#endif /* USE_ICU */ +#endif /* USE_ICU */ /* * If the system provides the needed functions for wide-character manipulation @@ -1561,6 +1561,7 @@ str_tolower(const char *buff, size_t nbytes, Oid collid) len_conv = icu_convert_case(u_strToLower, mylocale, &buff_conv, buff_uchar, len_uchar); icu_from_uchar(&result, buff_conv, len_conv); + pfree(buff_uchar); } else #endif @@ -1602,7 +1603,7 @@ str_tolower(const char *buff, size_t nbytes, Oid collid) wchar2char(result, workspace, result_size, mylocale); pfree(workspace); } -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ else { char *p; @@ -1684,6 +1685,7 @@ str_toupper(const char *buff, size_t nbytes, Oid collid) len_conv = icu_convert_case(u_strToUpper, mylocale, &buff_conv, buff_uchar, len_uchar); icu_from_uchar(&result, buff_conv, len_conv); + pfree(buff_uchar); } else #endif @@ -1725,7 +1727,7 @@ str_toupper(const char *buff, size_t nbytes, Oid collid) wchar2char(result, workspace, result_size, mylocale); pfree(workspace); } -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ else { char *p; @@ -1808,6 +1810,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid) len_conv = icu_convert_case(u_strToTitle_default_BI, mylocale, &buff_conv, buff_uchar, len_uchar); icu_from_uchar(&result, buff_conv, len_conv); + pfree(buff_uchar); } else #endif @@ -1861,7 +1864,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid) wchar2char(result, workspace, result_size, mylocale); pfree(workspace); } -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ else { char *p; @@ -2066,7 +2069,7 @@ dump_index(const KeyWord *k, const int *index) elog(DEBUG_elog_output, "\n\t\tUsed positions: %d,\n\t\tFree positions: %d", count, free_i); } -#endif /* DEBUG */ +#endif /* DEBUG */ /* ---------- * Return TRUE if next format picture is not digit value @@ -2175,8 +2178,8 @@ from_char_set_int(int *dest, const int value, const FormatNode *node) if (*dest != 0 && *dest != value) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("conflicting values for \"%s\" field in formatting string", - node->key->name), + errmsg("conflicting values for \"%s\" field in formatting string", + node->key->name), errdetail("This value contradicts a previous setting for " "the same field type."))); *dest = value; @@ -2238,8 +2241,8 @@ from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node) if (used < len) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("source string too short for \"%s\" formatting field", - node->key->name), + errmsg("source string too short for \"%s\" formatting field", + node->key->name), errdetail("Field requires %d characters, but only %d " "remain.", len, used), @@ -2303,10 +2306,10 @@ from_char_parse_int(int *dest, char **src, FormatNode *node) * ---------- */ static int -seq_search(char *name, const char *const * array, int type, int max, int *len) +seq_search(char *name, const char *const *array, int type, int max, int *len) { const char *p; - const char *const * a; + const char *const *a; char *n; int last, i; @@ -2381,7 +2384,7 @@ seq_search(char *name, const char *const * array, int type, int max, int *len) * If the string doesn't match, throw an error. */ static int -from_char_seq_search(int *dest, char **src, const char *const * array, int type, int max, +from_char_seq_search(int *dest, char **src, const char *const *array, int type, int max, FormatNode *node) { int len; @@ -2465,7 +2468,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col * intervals */ sprintf(s, "%0*d", S_FM(n->suffix) ? 0 : (tm->tm_hour >= 0) ? 2 : 3, - tm->tm_hour % (HOURS_PER_DAY / 2) == 0 ? HOURS_PER_DAY / 2 : + tm->tm_hour % (HOURS_PER_DAY / 2) == 0 ? HOURS_PER_DAY / 2 : tm->tm_hour % (HOURS_PER_DAY / 2)); if (S_THth(n->suffix)) str_numth(s, s, S_TH_TYPE(n->suffix)); @@ -2583,7 +2586,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9, @@ -2603,7 +2606,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9, @@ -2623,7 +2626,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9, @@ -2643,7 +2646,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else strcpy(s, asc_toupper_z(months[tm->tm_mon - 1])); @@ -2662,7 +2665,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else strcpy(s, months[tm->tm_mon - 1]); @@ -2681,7 +2684,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else strcpy(s, asc_tolower_z(months[tm->tm_mon - 1])); @@ -2705,7 +2708,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9, @@ -2723,7 +2726,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9, @@ -2741,7 +2744,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9, @@ -2759,7 +2762,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else strcpy(s, asc_toupper_z(days_short[tm->tm_wday])); @@ -2776,7 +2779,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else strcpy(s, days_short[tm->tm_wday]); @@ -2793,7 +2796,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col else ereport(ERROR, (errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE), - errmsg("localized string format value too long"))); + errmsg("localized string format value too long"))); } else strcpy(s, asc_tolower_z(days_short[tm->tm_wday])); @@ -2804,7 +2807,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col sprintf(s, "%0*d", S_FM(n->suffix) ? 0 : 3, (n->key->id == DCH_DDD) ? tm->tm_yday : - date2isoyearday(tm->tm_year, tm->tm_mon, tm->tm_mday)); + date2isoyearday(tm->tm_year, tm->tm_mon, tm->tm_mday)); if (S_THth(n->suffix)) str_numth(s, s, S_TH_TYPE(n->suffix)); s += strlen(s); @@ -3080,8 +3083,8 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out) case DCH_OF: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("formatting field \"%s\" is only supported in to_char", - n->key->name))); + errmsg("formatting field \"%s\" is only supported in to_char", + n->key->name))); break; case DCH_A_D: case DCH_B_C: @@ -3191,7 +3194,7 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out) if (matched < 2) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("invalid input string for \"Y,YYY\""))); + errmsg("invalid input string for \"Y,YYY\""))); years += (millennia * 1000); from_char_set_int(&out->year, years, n); out->yysz = 4; @@ -3609,7 +3612,7 @@ to_date(PG_FUNCTION_ARGS) */ static void do_to_timestamp(text *date_txt, text *fmt, - struct pg_tm * tm, fsec_t *fsec) + struct pg_tm *tm, fsec_t *fsec) { FormatNode *format; TmFromChar tmfc; @@ -3805,7 +3808,7 @@ do_to_timestamp(text *date_txt, text *fmt, if (!tm->tm_year && !tmfc.bc) ereport(ERROR, (errcode(ERRCODE_INVALID_DATETIME_FORMAT), - errmsg("cannot calculate day of year without year information"))); + errmsg("cannot calculate day of year without year information"))); if (tmfc.mode == FROM_CHAR_DATE_ISOWEEK) { @@ -4309,12 +4312,12 @@ NUM_numpart_from_char(NUMProc *Np, int id, int input_len) if (*Np->inout_p == '-' || (IS_BRACKET(Np->Num) && *Np->inout_p == '<')) { - *Np->number = '-'; /* set - */ + *Np->number = '-'; /* set - */ Np->inout_p++; } else if (*Np->inout_p == '+') { - *Np->number = '+'; /* set + */ + *Np->number = '+'; /* set + */ Np->inout_p++; } } @@ -4512,7 +4515,7 @@ NUM_numpart_to_char(NUMProc *Np, int id) { if (!IS_FILLMODE(Np->Num)) { - *Np->inout_p = ' '; /* Write + */ + *Np->inout_p = ' '; /* Write + */ ++Np->inout_p; } Np->sign_wrote = TRUE; @@ -4539,7 +4542,7 @@ NUM_numpart_to_char(NUMProc *Np, int id) */ if (!IS_FILLMODE(Np->Num)) { - *Np->inout_p = ' '; /* Write ' ' */ + *Np->inout_p = ' '; /* Write ' ' */ ++Np->inout_p; } } @@ -4608,7 +4611,7 @@ NUM_numpart_to_char(NUMProc *Np, int id) } else { - *Np->inout_p = *Np->number_p; /* Write DIGIT */ + *Np->inout_p = *Np->number_p; /* Write DIGIT */ ++Np->inout_p; Np->num_in = TRUE; } @@ -4646,7 +4649,7 @@ NUM_numpart_to_char(NUMProc *Np, int id) static char * NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, - char *number, int from_char_input_len, int to_char_out_pre_spaces, + char *number, int from_char_input_len, int to_char_out_pre_spaces, int sign, bool is_to_char, Oid collid) { FormatNode *n; @@ -4847,7 +4850,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, if (Np->is_to_char) { NUM_numpart_to_char(Np, n->key->id); - continue; /* for() */ + continue; /* for() */ } else { @@ -5129,15 +5132,15 @@ numeric_to_number(PG_FUNCTION_ARGS) result = DirectFunctionCall3(numeric_in, CStringGetDatum(numstr), ObjectIdGetDatum(InvalidOid), - Int32GetDatum(((precision << 16) | scale) + VARHDRSZ)); + Int32GetDatum(((precision << 16) | scale) + VARHDRSZ)); if (IS_MULTI(&Num)) { Numeric x; Numeric a = DatumGetNumeric(DirectFunctionCall1(int4_numeric, - Int32GetDatum(10))); + Int32GetDatum(10))); Numeric b = DatumGetNumeric(DirectFunctionCall1(int4_numeric, - Int32GetDatum(-Num.multi))); + Int32GetDatum(-Num.multi))); x = DatumGetNumeric(DirectFunctionCall2(numeric_power, NumericGetDatum(a), @@ -5183,7 +5186,7 @@ numeric_to_char(PG_FUNCTION_ARGS) Int32GetDatum(0))); numstr = orgnum = int_to_roman(DatumGetInt32(DirectFunctionCall1(numeric_int4, - NumericGetDatum(x)))); + NumericGetDatum(x)))); } else if (IS_EEEE(&Num)) { @@ -5224,9 +5227,9 @@ numeric_to_char(PG_FUNCTION_ARGS) if (IS_MULTI(&Num)) { Numeric a = DatumGetNumeric(DirectFunctionCall1(int4_numeric, - Int32GetDatum(10))); + Int32GetDatum(10))); Numeric b = DatumGetNumeric(DirectFunctionCall1(int4_numeric, - Int32GetDatum(Num.multi))); + Int32GetDatum(Num.multi))); x = DatumGetNumeric(DirectFunctionCall2(numeric_power, NumericGetDatum(a), @@ -5329,7 +5332,7 @@ int4_to_char(PG_FUNCTION_ARGS) else { orgnum = DatumGetCString(DirectFunctionCall1(int4out, - Int32GetDatum(value))); + Int32GetDatum(value))); } if (*orgnum == '-') @@ -5397,7 +5400,7 @@ int8_to_char(PG_FUNCTION_ARGS) { /* Currently don't support int8 conversion to roman... */ numstr = orgnum = int_to_roman(DatumGetInt32( - DirectFunctionCall1(int84, Int64GetDatum(value)))); + DirectFunctionCall1(int84, Int64GetDatum(value)))); } else if (IS_EEEE(&Num)) { @@ -5434,8 +5437,8 @@ int8_to_char(PG_FUNCTION_ARGS) value = DatumGetInt64(DirectFunctionCall2(int8mul, Int64GetDatum(value), - DirectFunctionCall1(dtoi8, - Float8GetDatum(multi)))); + DirectFunctionCall1(dtoi8, + Float8GetDatum(multi)))); Num.pre += Num.multi; } diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c index 5b15562ba5..5285aa54f1 100644 --- a/src/backend/utils/adt/genfile.c +++ b/src/backend/utils/adt/genfile.c @@ -60,7 +60,7 @@ convert_and_check_filename(text *arg) if (path_contains_parent_reference(filename)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("reference to parent directory (\"..\") not allowed")))); + (errmsg("reference to parent directory (\"..\") not allowed")))); /* * Allow absolute paths if within DataDir or Log_directory, even @@ -112,7 +112,7 @@ read_binary_file(const char *filename, int64 seek_offset, int64 bytes_to_read, else ereport(ERROR, (errcode_for_file_access(), - errmsg("could not stat file \"%s\": %m", filename))); + errmsg("could not stat file \"%s\": %m", filename))); } bytes_to_read = fst.st_size - seek_offset; diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c index 655b81cc46..0348855b11 100644 --- a/src/backend/utils/adt/geo_ops.c +++ b/src/backend/utils/adt/geo_ops.c @@ -126,7 +126,7 @@ single_decode(char *num, char **endptr_p, const char *type_name, const char *orig_string) { return float8in_internal(num, endptr_p, type_name, orig_string); -} /* single_decode() */ +} /* single_decode() */ static void single_encode(float8 x, StringInfo str) @@ -135,7 +135,7 @@ single_encode(float8 x, StringInfo str) appendStringInfoString(str, xstr); pfree(xstr); -} /* single_encode() */ +} /* single_encode() */ static void pair_decode(char *str, double *x, double *y, char **endptr_p, @@ -264,7 +264,7 @@ path_decode(char *str, bool opentype, int npts, Point *p, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s: \"%s\"", type_name, orig_string))); -} /* path_decode() */ +} /* path_decode() */ static char * path_encode(enum path_delim path_delim, int npts, Point *pt) @@ -309,7 +309,7 @@ path_encode(enum path_delim path_delim, int npts, Point *pt) } return str.data; -} /* path_encode() */ +} /* path_encode() */ /*------------------------------------------------------------- * pair_count - count the number of points @@ -1333,7 +1333,7 @@ path_in(PG_FUNCTION_ARGS) } base_size = sizeof(path->p[0]) * npts; - size = offsetof(PATH, p) +base_size; + size = offsetof(PATH, p) + base_size; /* Check for integer overflow */ if (base_size / npts != sizeof(path->p[0]) || size <= base_size) @@ -1401,9 +1401,9 @@ path_recv(PG_FUNCTION_ARGS) if (npts <= 0 || npts >= (int32) ((INT_MAX - offsetof(PATH, p)) / sizeof(Point))) ereport(ERROR, (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), - errmsg("invalid number of points in external \"path\" value"))); + errmsg("invalid number of points in external \"path\" value"))); - size = offsetof(PATH, p) +sizeof(path->p[0]) * npts; + size = offsetof(PATH, p) + sizeof(path->p[0]) * npts; path = (PATH *) palloc(size); SET_VARSIZE(path, size); @@ -1598,7 +1598,7 @@ path_inter(PG_FUNCTION_ARGS) { if (!p1->closed) continue; - iprev = p1->npts - 1; /* include the closure segment */ + iprev = p1->npts - 1; /* include the closure segment */ } for (j = 0; j < p2->npts; j++) @@ -1652,7 +1652,7 @@ path_distance(PG_FUNCTION_ARGS) { if (!p1->closed) continue; - iprev = p1->npts - 1; /* include the closure segment */ + iprev = p1->npts - 1; /* include the closure segment */ } for (j = 0; j < p2->npts; j++) @@ -1710,7 +1710,7 @@ path_length(PG_FUNCTION_ARGS) { if (!path->closed) continue; - iprev = path->npts - 1; /* include the closure segment */ + iprev = path->npts - 1; /* include the closure segment */ } result += point_dt(&path->p[iprev], &path->p[i]); @@ -1907,7 +1907,7 @@ point_dt(Point *pt1, Point *pt2) { #ifdef GEODEBUG printf("point_dt- segment (%f,%f),(%f,%f) length is %f\n", - pt1->x, pt1->y, pt2->x, pt2->y, HYPOT(pt1->x - pt2->x, pt1->y - pt2->y)); + pt1->x, pt1->y, pt2->x, pt2->y, HYPOT(pt1->x - pt2->x, pt1->y - pt2->y)); #endif return HYPOT(pt1->x - pt2->x, pt1->y - pt2->y); } @@ -2457,7 +2457,7 @@ dist_ppath(PG_FUNCTION_ARGS) { if (!path->closed) continue; - iprev = path->npts - 1; /* include the closure segment */ + iprev = path->npts - 1; /* include the closure segment */ } statlseg_construct(&lseg, &path->p[iprev], &path->p[i]); @@ -2776,7 +2776,7 @@ close_ps(PG_FUNCTION_ARGS) xh = lseg->p[0].x < lseg->p[1].x; yh = lseg->p[0].y < lseg->p[1].y; - if (FPeq(lseg->p[0].x, lseg->p[1].x)) /* vertical? */ + if (FPeq(lseg->p[0].x, lseg->p[1].x)) /* vertical? */ { #ifdef GEODEBUG printf("close_ps- segment is vertical\n"); @@ -2822,24 +2822,24 @@ close_ps(PG_FUNCTION_ARGS) */ invm = -1.0 / point_sl(&(lseg->p[0]), &(lseg->p[1])); - tmp = line_construct_pm(&lseg->p[!yh], invm); /* lower edge of the - * "band" */ + tmp = line_construct_pm(&lseg->p[!yh], invm); /* lower edge of the + * "band" */ if (pt->y < (tmp->A * pt->x + tmp->C)) { /* we are below the lower edge */ - result = point_copy(&lseg->p[!yh]); /* below the lseg, take lower - * end pt */ + result = point_copy(&lseg->p[!yh]); /* below the lseg, take lower end + * pt */ #ifdef GEODEBUG printf("close_ps below: tmp A %f B %f C %f\n", tmp->A, tmp->B, tmp->C); #endif PG_RETURN_POINT_P(result); } - tmp = line_construct_pm(&lseg->p[yh], invm); /* upper edge of the - * "band" */ + tmp = line_construct_pm(&lseg->p[yh], invm); /* upper edge of the + * "band" */ if (pt->y > (tmp->A * pt->x + tmp->C)) { /* we are below the lower edge */ - result = point_copy(&lseg->p[yh]); /* above the lseg, take higher - * end pt */ + result = point_copy(&lseg->p[yh]); /* above the lseg, take higher end + * pt */ #ifdef GEODEBUG printf("close_ps above: tmp A %f B %f C %f\n", tmp->A, tmp->B, tmp->C); @@ -3225,10 +3225,10 @@ on_sl(PG_FUNCTION_ARGS) LINE *line = PG_GETARG_LINE_P(1); PG_RETURN_BOOL(DatumGetBool(DirectFunctionCall2(on_pl, - PointPGetDatum(&lseg->p[0]), + PointPGetDatum(&lseg->p[0]), LinePGetDatum(line))) && DatumGetBool(DirectFunctionCall2(on_pl, - PointPGetDatum(&lseg->p[1]), + PointPGetDatum(&lseg->p[1]), LinePGetDatum(line)))); } @@ -3239,10 +3239,10 @@ on_sb(PG_FUNCTION_ARGS) BOX *box = PG_GETARG_BOX_P(1); PG_RETURN_BOOL(DatumGetBool(DirectFunctionCall2(on_pb, - PointPGetDatum(&lseg->p[0]), + PointPGetDatum(&lseg->p[0]), BoxPGetDatum(box))) && DatumGetBool(DirectFunctionCall2(on_pb, - PointPGetDatum(&lseg->p[1]), + PointPGetDatum(&lseg->p[1]), BoxPGetDatum(box)))); } @@ -3431,7 +3431,7 @@ poly_in(PG_FUNCTION_ARGS) "polygon", str))); base_size = sizeof(poly->p[0]) * npts; - size = offsetof(POLYGON, p) +base_size; + size = offsetof(POLYGON, p) + base_size; /* Check for integer overflow */ if (base_size / npts != sizeof(poly->p[0]) || size <= base_size) @@ -3484,9 +3484,9 @@ poly_recv(PG_FUNCTION_ARGS) if (npts <= 0 || npts >= (int32) ((INT_MAX - offsetof(POLYGON, p)) / sizeof(Point))) ereport(ERROR, (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), - errmsg("invalid number of points in external \"polygon\" value"))); + errmsg("invalid number of points in external \"polygon\" value"))); - size = offsetof(POLYGON, p) +sizeof(poly->p[0]) * npts; + size = offsetof(POLYGON, p) + sizeof(poly->p[0]) * npts; poly = (POLYGON *) palloc0(size); /* zero any holes */ SET_VARSIZE(poly, size); @@ -4243,7 +4243,7 @@ path_add(PG_FUNCTION_ARGS) PG_RETURN_NULL(); base_size = sizeof(p1->p[0]) * (p1->npts + p2->npts); - size = offsetof(PATH, p) +base_size; + size = offsetof(PATH, p) + base_size; /* Check for integer overflow */ if (base_size / sizeof(p1->p[0]) != (p1->npts + p2->npts) || @@ -4385,7 +4385,7 @@ path_poly(PG_FUNCTION_ARGS) * Never overflows: the old size fit in MaxAllocSize, and the new size is * just a small constant larger. */ - size = offsetof(POLYGON, p) +sizeof(poly->p[0]) * path->npts; + size = offsetof(POLYGON, p) + sizeof(poly->p[0]) * path->npts; poly = (POLYGON *) palloc(size); SET_VARSIZE(poly, size); @@ -4460,7 +4460,7 @@ box_poly(PG_FUNCTION_ARGS) int size; /* map four corners of the box to a polygon */ - size = offsetof(POLYGON, p) +sizeof(poly->p[0]) * 4; + size = offsetof(POLYGON, p) + sizeof(poly->p[0]) * 4; poly = (POLYGON *) palloc(size); SET_VARSIZE(poly, size); @@ -4494,7 +4494,7 @@ poly_path(PG_FUNCTION_ARGS) * Never overflows: the old size fit in MaxAllocSize, and the new size is * smaller by a small constant. */ - size = offsetof(PATH, p) +sizeof(path->p[0]) * poly->npts; + size = offsetof(PATH, p) + sizeof(path->p[0]) * poly->npts; path = (PATH *) palloc(size); SET_VARSIZE(path, size); @@ -5164,7 +5164,7 @@ circle_poly(PG_FUNCTION_ARGS) if (FPzero(circle->radius)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert circle with radius zero to polygon"))); + errmsg("cannot convert circle with radius zero to polygon"))); if (npts < 2) ereport(ERROR, @@ -5172,7 +5172,7 @@ circle_poly(PG_FUNCTION_ARGS) errmsg("must request at least 2 points"))); base_size = sizeof(poly->p[0]) * npts; - size = offsetof(POLYGON, p) +base_size; + size = offsetof(POLYGON, p) + base_size; /* Check for integer overflow */ if (base_size / npts != sizeof(poly->p[0]) || size <= base_size) diff --git a/src/backend/utils/adt/inet_cidr_ntop.c b/src/backend/utils/adt/inet_cidr_ntop.c index d5d1289d7d..2973d56658 100644 --- a/src/backend/utils/adt/inet_cidr_ntop.c +++ b/src/backend/utils/adt/inet_cidr_ntop.c @@ -241,8 +241,8 @@ inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) } if (zero_l != words && zero_s == 0 && ((zero_l == 6) || - ((zero_l == 5 && s[10] == 0xff && s[11] == 0xff) || - ((zero_l == 7 && s[14] != 0 && s[15] != 1))))) + ((zero_l == 5 && s[10] == 0xff && s[11] == 0xff) || + ((zero_l == 7 && s[14] != 0 && s[15] != 1))))) is_ipv4 = 1; /* Format whole words. */ diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c index bd4422e08a..96ef25b900 100644 --- a/src/backend/utils/adt/int.c +++ b/src/backend/utils/adt/int.c @@ -822,7 +822,7 @@ int2mul(PG_FUNCTION_ARGS) * The most practical way to detect overflow is to do the arithmetic in * int32 (so that the result can't overflow) and then do a range check. */ - result32 = (int32) arg1 *(int32) arg2; + result32 = (int32) arg1 * (int32) arg2; if (result32 < SHRT_MIN || result32 > SHRT_MAX) ereport(ERROR, diff --git a/src/backend/utils/adt/int8.c b/src/backend/utils/adt/int8.c index 0c6a412f2a..e8354dee44 100644 --- a/src/backend/utils/adt/int8.c +++ b/src/backend/utils/adt/int8.c @@ -104,7 +104,7 @@ scanint8(const char *str, bool errorOK, int64 *result) { int64 newtmp = tmp * 10 + (*ptr++ - '0'); - if ((newtmp / 10) != tmp) /* overflow? */ + if ((newtmp / 10) != tmp) /* overflow? */ { if (errorOK) return false; diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c index 0f99b613f5..4dd7d977e8 100644 --- a/src/backend/utils/adt/json.c +++ b/src/backend/utils/adt/json.c @@ -347,7 +347,7 @@ pg_parse_json(JsonLexContext *lex, JsonSemAction *sem) parse_array(lex, sem); break; default: - parse_scalar(lex, sem); /* json can be a bare scalar */ + parse_scalar(lex, sem); /* json can be a bare scalar */ } lex_expect(JSON_PARSE_END, lex, JSON_TOKEN_END); @@ -837,11 +837,11 @@ json_lex_string(JsonLexContext *lex) { if (hi_surrogate != -1) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type %s", - "json"), - errdetail("Unicode high surrogate must not follow a high surrogate."), - report_json_context(lex))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("invalid input syntax for type %s", + "json"), + errdetail("Unicode high surrogate must not follow a high surrogate."), + report_json_context(lex))); hi_surrogate = (ch & 0x3ff) << 10; continue; } @@ -849,10 +849,10 @@ json_lex_string(JsonLexContext *lex) { if (hi_surrogate == -1) ereport(ERROR, - (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type %s", "json"), - errdetail("Unicode low surrogate must follow a high surrogate."), - report_json_context(lex))); + (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), + errmsg("invalid input syntax for type %s", "json"), + errdetail("Unicode low surrogate must follow a high surrogate."), + report_json_context(lex))); ch = 0x10000 + hi_surrogate + (ch & 0x3ff); hi_surrogate = -1; } @@ -860,7 +860,7 @@ json_lex_string(JsonLexContext *lex) if (hi_surrogate != -1) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type %s", "json"), + errmsg("invalid input syntax for type %s", "json"), errdetail("Unicode low surrogate must follow a high surrogate."), report_json_context(lex))); @@ -876,8 +876,8 @@ json_lex_string(JsonLexContext *lex) /* We can't allow this, since our TEXT type doesn't */ ereport(ERROR, (errcode(ERRCODE_UNTRANSLATABLE_CHARACTER), - errmsg("unsupported Unicode escape sequence"), - errdetail("\\u0000 cannot be converted to text."), + errmsg("unsupported Unicode escape sequence"), + errdetail("\\u0000 cannot be converted to text."), report_json_context(lex))); } else if (GetDatabaseEncoding() == PG_UTF8) @@ -899,7 +899,7 @@ json_lex_string(JsonLexContext *lex) { ereport(ERROR, (errcode(ERRCODE_UNTRANSLATABLE_CHARACTER), - errmsg("unsupported Unicode escape sequence"), + errmsg("unsupported Unicode escape sequence"), errdetail("Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8."), report_json_context(lex))); } @@ -945,8 +945,8 @@ json_lex_string(JsonLexContext *lex) (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s", "json"), - errdetail("Escape sequence \"\\%s\" is invalid.", - extract_mb_char(s)), + errdetail("Escape sequence \"\\%s\" is invalid.", + extract_mb_char(s)), report_json_context(lex))); } } @@ -987,7 +987,7 @@ json_lex_string(JsonLexContext *lex) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s", "json"), - errdetail("Unicode low surrogate must follow a high surrogate."), + errdetail("Unicode low surrogate must follow a high surrogate."), report_json_context(lex))); /* Hooray, we found the end of the string! */ @@ -1181,16 +1181,16 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s", "json"), - errdetail("Expected \",\" or \"]\", but found \"%s\".", - token), + errdetail("Expected \",\" or \"]\", but found \"%s\".", + token), report_json_context(lex))); break; case JSON_PARSE_OBJECT_START: ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s", "json"), - errdetail("Expected string or \"}\", but found \"%s\".", - token), + errdetail("Expected string or \"}\", but found \"%s\".", + token), report_json_context(lex))); break; case JSON_PARSE_OBJECT_LABEL: @@ -1205,8 +1205,8 @@ report_parse_error(JsonParseContext ctx, JsonLexContext *lex) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s", "json"), - errdetail("Expected \",\" or \"}\", but found \"%s\".", - token), + errdetail("Expected \",\" or \"}\", but found \"%s\".", + token), report_json_context(lex))); break; case JSON_PARSE_OBJECT_COMMA: @@ -1471,7 +1471,7 @@ datum_to_json(Datum val, bool is_null, StringInfo result, tcategory == JSONTYPE_CAST)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("key value must be scalar, not array, composite, or json"))); + errmsg("key value must be scalar, not array, composite, or json"))); switch (tcategory) { @@ -2008,7 +2008,7 @@ json_object_agg_transfn(PG_FUNCTION_ARGS) if (arg_type == InvalidOid) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not determine data type for argument %d", 1))); + errmsg("could not determine data type for argument %d", 1))); json_categorize_type(arg_type, &state->key_category, &state->key_output_func); @@ -2018,7 +2018,7 @@ json_object_agg_transfn(PG_FUNCTION_ARGS) if (arg_type == InvalidOid) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not determine data type for argument %d", 2))); + errmsg("could not determine data type for argument %d", 2))); json_categorize_type(arg_type, &state->val_category, &state->val_output_func); diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c index c588ce00af..7100645443 100644 --- a/src/backend/utils/adt/jsonb.c +++ b/src/backend/utils/adt/jsonb.c @@ -320,8 +320,8 @@ jsonb_put_escaped_value(StringInfo out, JsonbValue *scalarVal) break; case jbvNumeric: appendStringInfoString(out, - DatumGetCString(DirectFunctionCall1(numeric_out, - PointerGetDatum(scalarVal->val.numeric)))); + DatumGetCString(DirectFunctionCall1(numeric_out, + PointerGetDatum(scalarVal->val.numeric)))); break; case jbvBool: if (scalarVal->val.boolean) @@ -664,7 +664,7 @@ jsonb_categorize_type(Oid typoid, CoercionPathType ctype; ctype = find_coercion_pathway(JSONOID, typoid, - COERCION_EXPLICIT, &castfunc); + COERCION_EXPLICIT, &castfunc); if (ctype == COERCION_PATH_FUNC && OidIsValid(castfunc)) { *tcategory = JSONBTYPE_JSONCAST; @@ -722,7 +722,7 @@ datum_to_jsonb(Datum val, bool is_null, JsonbInState *result, { ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("key value must be scalar, not array, composite, or json"))); + errmsg("key value must be scalar, not array, composite, or json"))); } else { @@ -1212,7 +1212,7 @@ jsonb_build_object(PG_FUNCTION_ARGS) if (val_type == InvalidOid || val_type == UNKNOWNOID) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not determine data type for argument %d", i + 1))); + errmsg("could not determine data type for argument %d", i + 1))); add_jsonb(arg, false, &result, val_type, true); @@ -1235,7 +1235,7 @@ jsonb_build_object(PG_FUNCTION_ARGS) if (val_type == InvalidOid || val_type == UNKNOWNOID) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not determine data type for argument %d", i + 2))); + errmsg("could not determine data type for argument %d", i + 2))); add_jsonb(arg, PG_ARGISNULL(i + 1), &result, val_type, false); } @@ -1295,7 +1295,7 @@ jsonb_build_array(PG_FUNCTION_ARGS) if (val_type == InvalidOid || val_type == UNKNOWNOID) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("could not determine data type for argument %d", i + 1))); + errmsg("could not determine data type for argument %d", i + 1))); add_jsonb(arg, PG_ARGISNULL(i), &result, val_type, false); } @@ -1661,8 +1661,8 @@ jsonb_agg_transfn(PG_FUNCTION_ARGS) { /* same for numeric */ v.val.numeric = - DatumGetNumeric(DirectFunctionCall1(numeric_uplus, - NumericGetDatum(v.val.numeric))); + DatumGetNumeric(DirectFunctionCall1(numeric_uplus, + NumericGetDatum(v.val.numeric))); } result->res = pushJsonbValue(&result->parseState, type, &v); @@ -1892,8 +1892,8 @@ jsonb_object_agg_transfn(PG_FUNCTION_ARGS) { /* same for numeric */ v.val.numeric = - DatumGetNumeric(DirectFunctionCall1(numeric_uplus, - NumericGetDatum(v.val.numeric))); + DatumGetNumeric(DirectFunctionCall1(numeric_uplus, + NumericGetDatum(v.val.numeric))); } result->res = pushJsonbValue(&result->parseState, single_scalar ? WJB_VALUE : type, diff --git a/src/backend/utils/adt/jsonb_util.c b/src/backend/utils/adt/jsonb_util.c index 0d2abb35b9..4850569bb5 100644 --- a/src/backend/utils/adt/jsonb_util.c +++ b/src/backend/utils/adt/jsonb_util.c @@ -557,7 +557,7 @@ pushJsonbValueScalar(JsonbParseState **pstate, JsonbIteratorToken seq, (*pstate)->contVal.type = jbvArray; (*pstate)->contVal.val.array.nElems = 0; (*pstate)->contVal.val.array.rawScalar = (scalarVal && - scalarVal->val.array.rawScalar); + scalarVal->val.array.rawScalar); if (scalarVal && scalarVal->val.array.nElems > 0) { /* Assume that this array is still really a scalar */ @@ -872,7 +872,7 @@ recurse: JBE_ADVANCE_OFFSET((*it)->curDataOffset, (*it)->children[(*it)->curIndex]); JBE_ADVANCE_OFFSET((*it)->curValueOffset, - (*it)->children[(*it)->curIndex + (*it)->nElems]); + (*it)->children[(*it)->curIndex + (*it)->nElems]); (*it)->curIndex++; /* @@ -1228,7 +1228,7 @@ JsonbHashScalarValue(const JsonbValue *scalarVal, uint32 *hash) case jbvNumeric: /* Must hash equal numerics to equal hash codes */ tmp = DatumGetUInt32(DirectFunctionCall1(hash_numeric, - NumericGetDatum(scalarVal->val.numeric))); + NumericGetDatum(scalarVal->val.numeric))); break; case jbvBool: tmp = scalarVal->val.boolean ? 0x02 : 0x04; @@ -1265,8 +1265,8 @@ equalsJsonbScalarValue(JsonbValue *aScalar, JsonbValue *bScalar) return lengthCompareJsonbStringValue(aScalar, bScalar) == 0; case jbvNumeric: return DatumGetBool(DirectFunctionCall2(numeric_eq, - PointerGetDatum(aScalar->val.numeric), - PointerGetDatum(bScalar->val.numeric))); + PointerGetDatum(aScalar->val.numeric), + PointerGetDatum(bScalar->val.numeric))); case jbvBool: return aScalar->val.boolean == bScalar->val.boolean; @@ -1301,8 +1301,8 @@ compareJsonbScalarValue(JsonbValue *aScalar, JsonbValue *bScalar) DEFAULT_COLLATION_OID); case jbvNumeric: return DatumGetInt32(DirectFunctionCall2(numeric_cmp, - PointerGetDatum(aScalar->val.numeric), - PointerGetDatum(bScalar->val.numeric))); + PointerGetDatum(aScalar->val.numeric), + PointerGetDatum(bScalar->val.numeric))); case jbvBool: if (aScalar->val.boolean == bScalar->val.boolean) return 0; diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index d7ece68c18..4779e74895 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -57,8 +57,8 @@ typedef struct OkeysState typedef struct IterateJsonStringValuesState { JsonLexContext *lex; - JsonIterateStringValuesAction action; /* an action that will be - * applied to each json value */ + JsonIterateStringValuesAction action; /* an action that will be applied + * to each json value */ void *action_state; /* any necessary context for iteration */ } IterateJsonStringValuesState; @@ -67,8 +67,8 @@ typedef struct TransformJsonStringValuesState { JsonLexContext *lex; StringInfo strval; /* resulting json */ - JsonTransformStringValuesAction action; /* an action that will be - * applied to each json value */ + JsonTransformStringValuesAction action; /* an action that will be applied + * to each json value */ void *action_state; /* any necessary context for transformation */ } TransformJsonStringValuesState; @@ -84,7 +84,8 @@ typedef struct GetState char **path_names; /* field name(s) being sought */ int *path_indexes; /* array index(es) being sought */ bool *pathok; /* is path matched to current depth? */ - int *array_cur_index; /* current element index at each path level */ + int *array_cur_index; /* current element index at each path + * level */ } GetState; /* state for json_array_length */ @@ -135,7 +136,7 @@ typedef struct JHashState /* hashtable element */ typedef struct JsonHashEntry { - char fname[NAMEDATALEN]; /* hash key (MUST BE FIRST) */ + char fname[NAMEDATALEN]; /* hash key (MUST BE FIRST) */ char *val; JsonTokenType type; } JsonHashEntry; @@ -425,7 +426,7 @@ static Datum populate_scalar(ScalarIOData *io, Oid typid, int32 typmod, JsValue static void prepare_column_cache(ColumnIOData *column, Oid typid, int32 typmod, MemoryContext mcxt, bool json); static Datum populate_record_field(ColumnIOData *col, Oid typid, int32 typmod, - const char *colname, MemoryContext mcxt, Datum defaultval, + const char *colname, MemoryContext mcxt, Datum defaultval, JsValue *jsv, bool *isnull); static RecordIOData *allocate_record_info(MemoryContext mcxt, int ncolumns); static bool JsObjectGetField(JsObject *obj, char *field, JsValue *jsv); @@ -765,7 +766,7 @@ jsonb_object_field_text(PG_FUNCTION_ARGS) break; case jbvNumeric: result = cstring_to_text(DatumGetCString(DirectFunctionCall1(numeric_out, - PointerGetDatum(v->val.numeric)))); + PointerGetDatum(v->val.numeric)))); break; case jbvBinary: { @@ -882,7 +883,7 @@ jsonb_array_element_text(PG_FUNCTION_ARGS) break; case jbvNumeric: result = cstring_to_text(DatumGetCString(DirectFunctionCall1(numeric_out, - PointerGetDatum(v->val.numeric)))); + PointerGetDatum(v->val.numeric)))); break; case jbvBinary: { @@ -1445,7 +1446,7 @@ get_jsonb_path_all(FunctionCallInfo fcinfo, bool as_text) jbvp = findJsonbValueFromContainerLen(container, JB_FOBJECT, VARDATA(pathtext[i]), - VARSIZE(pathtext[i]) - VARHDRSZ); + VARSIZE(pathtext[i]) - VARHDRSZ); } else if (have_array) { @@ -2160,7 +2161,7 @@ elements_worker(FunctionCallInfo fcinfo, const char *funcname, bool as_text) state->next_scalar = false; state->lex = lex; state->tmp_cxt = AllocSetContextCreate(CurrentMemoryContext, - "json_array_elements temporary cxt", + "json_array_elements temporary cxt", ALLOCSET_DEFAULT_SIZES); pg_parse_json(lex, sem); @@ -2478,7 +2479,7 @@ populate_array_element_end(void *_state, bool isnull) else if (state->element_scalar) { jsv.val.json.str = state->element_scalar; - jsv.val.json.len = -1; /* null-terminated */ + jsv.val.json.len = -1; /* null-terminated */ } else { @@ -2544,9 +2545,9 @@ populate_array_json(PopulateArrayContext *ctx, char *json, int len) * elements and accumulate result using given ArrayBuildState. */ static void -populate_array_dim_jsonb(PopulateArrayContext *ctx, /* context */ - JsonbValue *jbv, /* jsonb sub-array */ - int ndim) /* current dimension */ +populate_array_dim_jsonb(PopulateArrayContext *ctx, /* context */ + JsonbValue *jbv, /* jsonb sub-array */ + int ndim) /* current dimension */ { JsonbContainer *jbc = jbv->val.binary.data; JsonbIterator *it; @@ -2811,13 +2812,13 @@ populate_scalar(ScalarIOData *io, Oid typid, int32 typmod, JsValue *jsv) str = JsonbToCString(NULL, &jsonb->root, VARSIZE(jsonb)); } - else if (jbv->type == jbvString) /* quotes are stripped */ + else if (jbv->type == jbvString) /* quotes are stripped */ str = pnstrdup(jbv->val.string.val, jbv->val.string.len); else if (jbv->type == jbvBool) str = pstrdup(jbv->val.boolean ? "true" : "false"); else if (jbv->type == jbvNumeric) str = DatumGetCString(DirectFunctionCall1(numeric_out, - PointerGetDatum(jbv->val.numeric))); + PointerGetDatum(jbv->val.numeric))); else if (jbv->type == jbvBinary) str = JsonbToCString(NULL, jbv->val.binary.data, jbv->val.binary.len); @@ -2886,7 +2887,7 @@ prepare_column_cache(ColumnIOData *column, column->io.domain.base_typid = type->typbasetype; column->io.domain.base_typmod = type->typtypmod; column->io.domain.base_io = MemoryContextAllocZero(mcxt, - sizeof(ColumnIOData)); + sizeof(ColumnIOData)); column->io.domain.domain_info = NULL; } else if (type->typtype == TYPTYPE_COMPOSITE || typid == RECORDOID) @@ -2899,7 +2900,7 @@ prepare_column_cache(ColumnIOData *column, { column->typcat = TYPECAT_ARRAY; column->io.array.element_info = MemoryContextAllocZero(mcxt, - sizeof(ColumnIOData)); + sizeof(ColumnIOData)); column->io.array.element_type = type->typelem; /* array element typemod stored in attribute's typmod */ column->io.array.element_typmod = typmod; @@ -3378,7 +3379,7 @@ hash_array_start(void *state) if (_state->lex->lex_level == 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("cannot call %s on an array", _state->function_name))); + errmsg("cannot call %s on an array", _state->function_name))); } static void @@ -3389,7 +3390,7 @@ hash_scalar(void *state, char *token, JsonTokenType tokentype) if (_state->lex->lex_level == 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("cannot call %s on a scalar", _state->function_name))); + errmsg("cannot call %s on a scalar", _state->function_name))); if (_state->lex->lex_level == 1) { @@ -3579,8 +3580,8 @@ populate_recordset_worker(FunctionCallInfo fcinfo, const char *funcname, !JsonContainerIsObject(v.val.binary.data)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("argument of %s must be an array of objects", - funcname))); + errmsg("argument of %s must be an array of objects", + funcname))); obj.is_json = false; obj.val.jsonb_cont = v.val.binary.data; @@ -3976,8 +3977,8 @@ addJsonbToParseState(JsonbParseState **jbps, Jsonb *jb) if (JB_ROOT_IS_SCALAR(jb)) { - (void) JsonbIteratorNext(&it, &v, false); /* skip array header */ - (void) JsonbIteratorNext(&it, &v, false); /* fetch scalar value */ + (void) JsonbIteratorNext(&it, &v, false); /* skip array header */ + (void) JsonbIteratorNext(&it, &v, false); /* fetch scalar value */ switch (o->type) { @@ -4711,8 +4712,8 @@ setPathArray(JsonbIterator **it, Datum *path_elems, bool *path_nulls, lindex < INT_MIN) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("path element at position %d is not an integer: \"%s\"", - level + 1, c))); + errmsg("path element at position %d is not an integer: \"%s\"", + level + 1, c))); idx = lindex; } else @@ -4870,7 +4871,7 @@ iterate_string_values_scalar(void *state, char *token, JsonTokenType tokentype) */ Jsonb * transform_jsonb_string_values(Jsonb *jsonb, void *action_state, - JsonTransformStringValuesAction transform_action) + JsonTransformStringValuesAction transform_action) { JsonbIterator *it; JsonbValue v, diff --git a/src/backend/utils/adt/levenshtein.c b/src/backend/utils/adt/levenshtein.c index 4f40f279db..97e034b453 100644 --- a/src/backend/utils/adt/levenshtein.c +++ b/src/backend/utils/adt/levenshtein.c @@ -130,8 +130,8 @@ varstr_levenshtein(const char *source, int slen, n > MAX_LEVENSHTEIN_STRLEN)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("levenshtein argument exceeds maximum length of %d characters", - MAX_LEVENSHTEIN_STRLEN))); + errmsg("levenshtein argument exceeds maximum length of %d characters", + MAX_LEVENSHTEIN_STRLEN))); #ifdef LEVENSHTEIN_LESS_EQUAL /* Initialize start and stop columns. */ diff --git a/src/backend/utils/adt/like.c b/src/backend/utils/adt/like.c index d4d173480d..37394f4972 100644 --- a/src/backend/utils/adt/like.c +++ b/src/backend/utils/adt/like.c @@ -180,7 +180,7 @@ Generic_Text_IC_like(text *str, text *pat, Oid collation) */ ereport(ERROR, (errcode(ERRCODE_INDETERMINATE_COLLATION), - errmsg("could not determine which collation to use for ILIKE"), + errmsg("could not determine which collation to use for ILIKE"), errhint("Use the COLLATE clause to set the collation explicitly."))); } locale = pg_newlocale_from_collation(collation); diff --git a/src/backend/utils/adt/like_match.c b/src/backend/utils/adt/like_match.c index 1c37229e09..8ed362a8ff 100644 --- a/src/backend/utils/adt/like_match.c +++ b/src/backend/utils/adt/like_match.c @@ -104,7 +104,7 @@ MatchText(char *t, int tlen, char *p, int plen, if (plen <= 0) ereport(ERROR, (errcode(ERRCODE_INVALID_ESCAPE_SEQUENCE), - errmsg("LIKE pattern must not end with escape character"))); + errmsg("LIKE pattern must not end with escape character"))); if (GETCHAR(*p) != GETCHAR(*t)) return LIKE_FALSE; } @@ -236,7 +236,7 @@ MatchText(char *t, int tlen, char *p, int plen, * matching this pattern. */ return LIKE_ABORT; -} /* MatchText() */ +} /* MatchText() */ /* * like_escape() --- given a pattern and an ESCAPE string, @@ -290,7 +290,7 @@ do_like_escape(text *pat, text *esc) ereport(ERROR, (errcode(ERRCODE_INVALID_ESCAPE_SEQUENCE), errmsg("invalid escape string"), - errhint("Escape string must be empty or one character."))); + errhint("Escape string must be empty or one character."))); e = VARDATA_ANY(esc); @@ -337,7 +337,7 @@ do_like_escape(text *pat, text *esc) return result; } -#endif /* do_like_escape */ +#endif /* do_like_escape */ #ifdef CHAREQ #undef CHAREQ diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c index 5849978674..fee7314da1 100644 --- a/src/backend/utils/adt/lockfuncs.c +++ b/src/backend/utils/adt/lockfuncs.c @@ -826,7 +826,7 @@ PreventAdvisoryLocksInParallelMode(void) if (IsInParallelMode()) ereport(ERROR, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), - errmsg("cannot use advisory locks during a parallel operation"))); + errmsg("cannot use advisory locks during a parallel operation"))); } /* diff --git a/src/backend/utils/adt/mac.c b/src/backend/utils/adt/mac.c index c2b52d8046..d1c20c3086 100644 --- a/src/backend/utils/adt/mac.c +++ b/src/backend/utils/adt/mac.c @@ -99,7 +99,7 @@ macaddr_in(PG_FUNCTION_ARGS) (e < 0) || (e > 255) || (f < 0) || (f > 255)) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("invalid octet value in \"macaddr\" value: \"%s\"", str))); + errmsg("invalid octet value in \"macaddr\" value: \"%s\"", str))); result = (macaddr *) palloc(sizeof(macaddr)); @@ -460,7 +460,7 @@ macaddr_abbrev_abort(int memtupcount, SortSupport ssup) if (trace_sort) elog(LOG, "macaddr_abbrev: aborting abbreviation at cardinality %f" - " below threshold %f after " INT64_FORMAT " values (%d rows)", + " below threshold %f after " INT64_FORMAT " values (%d rows)", abbr_card, uss->input_count / 2000.0 + 0.5, uss->input_count, memtupcount); #endif diff --git a/src/backend/utils/adt/mac8.c b/src/backend/utils/adt/mac8.c index 1ed4183be7..482d1fb5bf 100644 --- a/src/backend/utils/adt/mac8.c +++ b/src/backend/utils/adt/mac8.c @@ -163,8 +163,8 @@ macaddr8_in(PG_FUNCTION_ARGS) /* must be trailing garbage... */ ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type %s: \"%s\"", "macaddr8", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", "macaddr8", + str))); } /* Move forward to where the next byte should be */ @@ -181,8 +181,8 @@ macaddr8_in(PG_FUNCTION_ARGS) else if (spacer != *ptr) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type %s: \"%s\"", "macaddr8", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", "macaddr8", + str))); /* move past the spacer */ ptr++; @@ -218,8 +218,8 @@ macaddr8_in(PG_FUNCTION_ARGS) else if (count != 8) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), - errmsg("invalid input syntax for type %s: \"%s\"", "macaddr8", - str))); + errmsg("invalid input syntax for type %s: \"%s\"", "macaddr8", + str))); result = (macaddr8 *) palloc0(sizeof(macaddr8)); @@ -552,10 +552,10 @@ macaddr8tomacaddr(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg("macaddr8 data out of range to convert to macaddr"), - errhint("Only addresses that have FF and FE as values in the " - "4th and 5th bytes, from the left, for example: " - "XX-XX-XX-FF-FE-XX-XX-XX, are eligible to be converted " - "from macaddr8 to macaddr."))); + errhint("Only addresses that have FF and FE as values in the " + "4th and 5th bytes, from the left, for example: " + "XX-XX-XX-FF-FE-XX-XX-XX, are eligible to be converted " + "from macaddr8 to macaddr."))); result->a = addr->a; result->b = addr->b; diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c index af2fa19521..b7fdf77a72 100644 --- a/src/backend/utils/adt/misc.c +++ b/src/backend/utils/adt/misc.c @@ -313,7 +313,7 @@ pg_terminate_backend(PG_FUNCTION_ARGS) if (r == SIGNAL_BACKEND_NOSUPERUSER) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("must be a superuser to terminate superuser process")))); + (errmsg("must be a superuser to terminate superuser process")))); if (r == SIGNAL_BACKEND_NOPERMISSION) ereport(ERROR, @@ -355,7 +355,7 @@ pg_rotate_logfile(PG_FUNCTION_ARGS) if (!Logging_collector) { ereport(WARNING, - (errmsg("rotation not possible because log collection not active"))); + (errmsg("rotation not possible because log collection not active"))); PG_RETURN_BOOL(false); } @@ -422,7 +422,7 @@ pg_tablespace_databases(PG_FUNCTION_ARGS) errmsg("could not open directory \"%s\": %m", fctx->location))); ereport(WARNING, - (errmsg("%u is not a tablespace OID", tablespaceOid))); + (errmsg("%u is not a tablespace OID", tablespaceOid))); } } funcctx->user_fctx = fctx; @@ -801,9 +801,9 @@ parse_ident(PG_FUNCTION_ARGS) if (endp == NULL) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("string is not a valid identifier: \"%s\"", - text_to_cstring(qualname)), - errdetail("String has unclosed double quotes."))); + errmsg("string is not a valid identifier: \"%s\"", + text_to_cstring(qualname)), + errdetail("String has unclosed double quotes."))); if (endp[1] != '"') break; memmove(endp, endp + 1, strlen(endp)); @@ -964,7 +964,7 @@ pg_current_logfile(PG_FUNCTION_ARGS) { /* Uh oh. No newline found, so file content is corrupted. */ elog(ERROR, - "missing newline character in \"%s\"", LOG_METAINFO_DATAFILE); + "missing newline character in \"%s\"", LOG_METAINFO_DATAFILE); break; } *nlpos = '\0'; diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 3f6a9d3b82..2c5948052d 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -71,8 +71,8 @@ * Function prototypes -- internal to this file only */ -static AbsoluteTime tm2abstime(struct pg_tm * tm, int tz); -static void reltime2tm(RelativeTime time, struct pg_tm * tm); +static AbsoluteTime tm2abstime(struct pg_tm *tm, int tz); +static void reltime2tm(RelativeTime time, struct pg_tm *tm); static void parsetinterval(char *i_string, AbsoluteTime *i_start, AbsoluteTime *i_end); @@ -96,7 +96,7 @@ GetCurrentAbsoluteTime(void) void -abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn) +abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm *tm, char **tzn) { pg_time_t time = (pg_time_t) _time; struct pg_tm *tx; @@ -148,7 +148,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn) * Note that tm has full year (not 1900-based) and 1-based month. */ static AbsoluteTime -tm2abstime(struct pg_tm * tm, int tz) +tm2abstime(struct pg_tm *tm, int tz) { int day; AbsoluteTime sec; @@ -159,7 +159,7 @@ tm2abstime(struct pg_tm * tm, int tz) tm->tm_mday < 1 || tm->tm_mday > 31 || tm->tm_hour < 0 || tm->tm_hour > HOURS_PER_DAY || /* test for > 24:00:00 */ - (tm->tm_hour == HOURS_PER_DAY && (tm->tm_min > 0 || tm->tm_sec > 0)) || + (tm->tm_hour == HOURS_PER_DAY && (tm->tm_min > 0 || tm->tm_sec > 0)) || tm->tm_min < 0 || tm->tm_min > MINS_PER_HOUR - 1 || tm->tm_sec < 0 || tm->tm_sec > SECS_PER_MINUTE) return INVALID_ABSTIME; @@ -479,7 +479,7 @@ abstime_timestamp(PG_FUNCTION_ARGS) case INVALID_ABSTIME: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert abstime \"invalid\" to timestamp"))); + errmsg("cannot convert abstime \"invalid\" to timestamp"))); TIMESTAMP_NOBEGIN(result); break; @@ -552,7 +552,7 @@ abstime_timestamptz(PG_FUNCTION_ARGS) case INVALID_ABSTIME: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert abstime \"invalid\" to timestamp"))); + errmsg("cannot convert abstime \"invalid\" to timestamp"))); TIMESTAMP_NOBEGIN(result); break; @@ -680,7 +680,7 @@ reltimesend(PG_FUNCTION_ARGS) static void -reltime2tm(RelativeTime time, struct pg_tm * tm) +reltime2tm(RelativeTime time, struct pg_tm *tm) { double dtime = time; @@ -741,12 +741,12 @@ tintervalout(PG_FUNCTION_ARGS) else { p = DatumGetCString(DirectFunctionCall1(abstimeout, - AbsoluteTimeGetDatum(tinterval->data[0]))); + AbsoluteTimeGetDatum(tinterval->data[0]))); strcat(i_str, p); pfree(p); strcat(i_str, "\" \""); p = DatumGetCString(DirectFunctionCall1(abstimeout, - AbsoluteTimeGetDatum(tinterval->data[1]))); + AbsoluteTimeGetDatum(tinterval->data[1]))); strcat(i_str, p); pfree(p); } @@ -772,7 +772,7 @@ tintervalrecv(PG_FUNCTION_ARGS) if (tinterval->data[0] == INVALID_ABSTIME || tinterval->data[1] == INVALID_ABSTIME) - status = T_INTERVAL_INVAL; /* undefined */ + status = T_INTERVAL_INVAL; /* undefined */ else status = T_INTERVAL_VALID; @@ -849,7 +849,7 @@ reltime_interval(PG_FUNCTION_ARGS) case INVALID_RELTIME: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot convert reltime \"invalid\" to interval"))); + errmsg("cannot convert reltime \"invalid\" to interval"))); result->time = 0; result->day = 0; result->month = 0; @@ -919,7 +919,7 @@ timepl(PG_FUNCTION_ARGS) if (AbsoluteTimeIsReal(t1) && RelativeTimeIsValid(t2) && ((t2 > 0 && t1 < NOEND_ABSTIME - t2) || - (t2 <= 0 && t1 > NOSTART_ABSTIME - t2))) /* prevent overflow */ + (t2 <= 0 && t1 > NOSTART_ABSTIME - t2))) /* prevent overflow */ PG_RETURN_ABSOLUTETIME(t1 + t2); PG_RETURN_ABSOLUTETIME(INVALID_ABSTIME); @@ -958,10 +958,10 @@ intinterval(PG_FUNCTION_ARGS) { if (DatumGetBool(DirectFunctionCall2(abstimege, AbsoluteTimeGetDatum(t), - AbsoluteTimeGetDatum(tinterval->data[0]))) && + AbsoluteTimeGetDatum(tinterval->data[0]))) && DatumGetBool(DirectFunctionCall2(abstimele, AbsoluteTimeGetDatum(t), - AbsoluteTimeGetDatum(tinterval->data[1])))) + AbsoluteTimeGetDatum(tinterval->data[1])))) PG_RETURN_BOOL(true); } PG_RETURN_BOOL(false); @@ -1108,7 +1108,7 @@ tintervalsame(PG_FUNCTION_ARGS) if (DatumGetBool(DirectFunctionCall2(abstimeeq, AbsoluteTimeGetDatum(i1->data[0]), - AbsoluteTimeGetDatum(i2->data[0]))) && + AbsoluteTimeGetDatum(i2->data[0]))) && DatumGetBool(DirectFunctionCall2(abstimeeq, AbsoluteTimeGetDatum(i1->data[1]), AbsoluteTimeGetDatum(i2->data[1])))) @@ -1353,7 +1353,7 @@ tintervalct(PG_FUNCTION_ARGS) PG_RETURN_BOOL(false); if (DatumGetBool(DirectFunctionCall2(abstimele, AbsoluteTimeGetDatum(i1->data[0]), - AbsoluteTimeGetDatum(i2->data[0]))) && + AbsoluteTimeGetDatum(i2->data[0]))) && DatumGetBool(DirectFunctionCall2(abstimege, AbsoluteTimeGetDatum(i1->data[1]), AbsoluteTimeGetDatum(i2->data[1])))) @@ -1374,7 +1374,7 @@ tintervalov(PG_FUNCTION_ARGS) PG_RETURN_BOOL(false); if (DatumGetBool(DirectFunctionCall2(abstimelt, AbsoluteTimeGetDatum(i1->data[1]), - AbsoluteTimeGetDatum(i2->data[0]))) || + AbsoluteTimeGetDatum(i2->data[0]))) || DatumGetBool(DirectFunctionCall2(abstimegt, AbsoluteTimeGetDatum(i1->data[0]), AbsoluteTimeGetDatum(i2->data[1])))) @@ -1538,7 +1538,7 @@ bogus: (errcode(ERRCODE_INVALID_DATETIME_FORMAT), errmsg("invalid input syntax for type %s: \"%s\"", "tinterval", i_string))); - *i_start = *i_end = INVALID_ABSTIME; /* keep compiler quiet */ + *i_start = *i_end = INVALID_ABSTIME; /* keep compiler quiet */ } diff --git a/src/backend/utils/adt/name.c b/src/backend/utils/adt/name.c index e41ee478ec..974e6e8401 100644 --- a/src/backend/utils/adt/name.c +++ b/src/backend/utils/adt/name.c @@ -200,8 +200,7 @@ namecpy(Name n1, Name n2) int namecat(Name n1, Name n2) { - return namestrcat(n1, NameStr(*n2)); /* n2 can't be any longer than - * n1 */ + return namestrcat(n1, NameStr(*n2)); /* n2 can't be any longer than n1 */ } #endif @@ -317,9 +316,9 @@ current_schemas(PG_FUNCTION_ARGS) array = construct_array(names, i, NAMEOID, - NAMEDATALEN, /* sizeof(Name) */ - false, /* Name is not by-val */ - 'c'); /* alignment of Name */ + NAMEDATALEN, /* sizeof(Name) */ + false, /* Name is not by-val */ + 'c'); /* alignment of Name */ PG_RETURN_POINTER(array); } diff --git a/src/backend/utils/adt/network_selfuncs.c b/src/backend/utils/adt/network_selfuncs.c index 1d29ecd521..c9927fff9b 100644 --- a/src/backend/utils/adt/network_selfuncs.c +++ b/src/backend/utils/adt/network_selfuncs.c @@ -287,7 +287,7 @@ networkjoinsel_inner(Oid operator, mcv1_exists = get_attstatsslot(&mcv1_slot, vardata1->statsTuple, STATISTIC_KIND_MCV, InvalidOid, - ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); + ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); hist1_exists = get_attstatsslot(&hist1_slot, vardata1->statsTuple, STATISTIC_KIND_HISTOGRAM, InvalidOid, ATTSTATSSLOT_VALUES); @@ -309,7 +309,7 @@ networkjoinsel_inner(Oid operator, mcv2_exists = get_attstatsslot(&mcv2_slot, vardata2->statsTuple, STATISTIC_KIND_MCV, InvalidOid, - ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); + ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); hist2_exists = get_attstatsslot(&hist2_slot, vardata2->statsTuple, STATISTIC_KIND_HISTOGRAM, InvalidOid, ATTSTATSSLOT_VALUES); @@ -360,7 +360,7 @@ networkjoinsel_inner(Oid operator, selec += (1.0 - nullfrac1 - sumcommon1) * (1.0 - nullfrac2 - sumcommon2) * inet_hist_inclusion_join_sel(hist1_slot.values, hist1_slot.nvalues, - hist2_slot.values, hist2_slot.nvalues, + hist2_slot.values, hist2_slot.nvalues, opr_codenum); /* @@ -417,7 +417,7 @@ networkjoinsel_semi(Oid operator, mcv1_exists = get_attstatsslot(&mcv1_slot, vardata1->statsTuple, STATISTIC_KIND_MCV, InvalidOid, - ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); + ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); hist1_exists = get_attstatsslot(&hist1_slot, vardata1->statsTuple, STATISTIC_KIND_HISTOGRAM, InvalidOid, ATTSTATSSLOT_VALUES); @@ -439,7 +439,7 @@ networkjoinsel_semi(Oid operator, mcv2_exists = get_attstatsslot(&mcv2_slot, vardata2->statsTuple, STATISTIC_KIND_MCV, InvalidOid, - ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); + ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); hist2_exists = get_attstatsslot(&hist2_slot, vardata2->statsTuple, STATISTIC_KIND_HISTOGRAM, InvalidOid, ATTSTATSSLOT_VALUES); diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 6cce0f292c..3e5614ece3 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -1026,8 +1026,8 @@ numerictypmodin(PG_FUNCTION_ARGS) if (tl[1] < 0 || tl[1] > tl[0]) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("NUMERIC scale %d must be between 0 and precision %d", - tl[1], tl[0]))); + errmsg("NUMERIC scale %d must be between 0 and precision %d", + tl[1], tl[0]))); typmod = ((tl[0] << 16) | tl[1]) + VARHDRSZ; } else if (n == 1) @@ -1497,7 +1497,7 @@ width_bucket_numeric(PG_FUNCTION_ARGS) NUMERIC_IS_NAN(bound2)) ereport(ERROR, (errcode(ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION), - errmsg("operand, lower bound, and upper bound cannot be NaN"))); + errmsg("operand, lower bound, and upper bound cannot be NaN"))); init_var(&result_var); init_var(&count_var); @@ -1509,8 +1509,8 @@ width_bucket_numeric(PG_FUNCTION_ARGS) { case 0: ereport(ERROR, - (errcode(ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION), - errmsg("lower bound cannot equal upper bound"))); + (errcode(ERRCODE_INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION), + errmsg("lower bound cannot equal upper bound"))); /* bound1 < bound2 */ case -1: @@ -1770,7 +1770,7 @@ numeric_abbrev_abort(int memtupcount, SortSupport ssup) if (trace_sort) elog(LOG, "numeric_abbrev: aborting abbreviation at cardinality %f" - " below threshold %f after " INT64_FORMAT " values (%d rows)", + " below threshold %f after " INT64_FORMAT " values (%d rows)", abbr_card, nss->input_count / 10000.0 + 0.5, nss->input_count, memtupcount); #endif @@ -1933,7 +1933,7 @@ numeric_abbrev_convert_var(NumericVar *var, NumericSortSupport *nss) return NumericAbbrevGetDatum(result); } -#endif /* NUMERIC_ABBREV_BITS == 64 */ +#endif /* NUMERIC_ABBREV_BITS == 64 */ #if NUMERIC_ABBREV_BITS == 32 @@ -2010,7 +2010,7 @@ numeric_abbrev_convert_var(NumericVar *var, NumericSortSupport *nss) return NumericAbbrevGetDatum(result); } -#endif /* NUMERIC_ABBREV_BITS == 32 */ +#endif /* NUMERIC_ABBREV_BITS == 32 */ /* * Ordinary (non-sortsupport) comparisons follow. @@ -4704,7 +4704,7 @@ numeric_stddev_internal(NumericAggState *state, rscale = vsumX.dscale * 2; mul_var(&vsumX, &vsumX, &vsumX, rscale); /* vsumX = sumX * sumX */ - mul_var(&vN, &vsumX2, &vsumX2, rscale); /* vsumX2 = N * sumX2 */ + mul_var(&vN, &vsumX2, &vsumX2, rscale); /* vsumX2 = N * sumX2 */ sub_var(&vsumX2, &vsumX, &vsumX2); /* N * sumX2 - sumX * sumX */ if (cmp_var(&vsumX2, &const_zero) <= 0) @@ -4715,11 +4715,11 @@ numeric_stddev_internal(NumericAggState *state, else { if (sample) - mul_var(&vN, &vNminus1, &vNminus1, 0); /* N * (N - 1) */ + mul_var(&vN, &vNminus1, &vNminus1, 0); /* N * (N - 1) */ else mul_var(&vN, &vN, &vNminus1, 0); /* N * N */ rscale = select_div_scale(&vsumX2, &vNminus1); - div_var(&vsumX2, &vNminus1, &vsumX, rscale, true); /* variance */ + div_var(&vsumX2, &vNminus1, &vsumX, rscale, true); /* variance */ if (!variance) sqrt_var(&vsumX, &vsumX, rscale); /* stddev */ @@ -5369,7 +5369,7 @@ dump_var(const char *str, NumericVar *var) printf("\n"); } -#endif /* NUMERIC_DEBUG */ +#endif /* NUMERIC_DEBUG */ /* ---------------------------------------------------------------------- @@ -8081,7 +8081,7 @@ power_var(NumericVar *base, NumericVar *exp, NumericVar *result) if (cmp_var(base, &const_zero) == 0) { set_var_from_var(&const_zero, result); - result->dscale = NUMERIC_MIN_SIG_DIGITS; /* no need to round */ + result->dscale = NUMERIC_MIN_SIG_DIGITS; /* no need to round */ return; } @@ -8175,8 +8175,7 @@ power_var_int(NumericVar *base, int exp, NumericVar *result, int rscale) * While 0 ^ 0 can be either 1 or indeterminate (error), we treat * it as 1 because most programming languages do this. SQL:2003 * also requires a return value of 1. - * http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_zero_pow - * er + * http://en.wikipedia.org/wiki/Exponentiation#Zero_to_the_zero_power */ set_var_from_var(&const_one, result); result->dscale = rscale; /* no need to round */ @@ -8361,7 +8360,7 @@ cmp_abs(NumericVar *var1, NumericVar *var2) */ static int cmp_abs_common(const NumericDigit *var1digits, int var1ndigits, int var1weight, - const NumericDigit *var2digits, int var2ndigits, int var2weight) + const NumericDigit *var2digits, int var2ndigits, int var2weight) { int i1 = 0; int i2 = 0; diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c index 4ea2892c98..07682723b7 100644 --- a/src/backend/utils/adt/numutils.c +++ b/src/backend/utils/adt/numutils.c @@ -86,7 +86,7 @@ pg_atoi(const char *s, int size, int c) if (errno == ERANGE || l < SCHAR_MIN || l > SCHAR_MAX) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for 8-bit integer", s))); + errmsg("value \"%s\" is out of range for 8-bit integer", s))); break; default: elog(ERROR, "unsupported result size: %d", size); diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 24ae3c6886..0f5ec954c3 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -129,7 +129,7 @@ static HTAB *collation_cache = NULL; #if defined(WIN32) && defined(LC_MESSAGES) -static char *IsoLocaleName(const char *); /* MSVC specific */ +static char *IsoLocaleName(const char *); /* MSVC specific */ #endif @@ -174,7 +174,7 @@ pg_perm_setlocale(int category, const char *locale) else #endif result = setlocale(category, locale); -#endif /* WIN32 */ +#endif /* WIN32 */ if (result == NULL) return result; /* fall out immediately on failure */ @@ -219,9 +219,9 @@ pg_perm_setlocale(int category, const char *locale) result = IsoLocaleName(locale); if (result == NULL) result = (char *) locale; -#endif /* WIN32 */ +#endif /* WIN32 */ break; -#endif /* LC_MESSAGES */ +#endif /* LC_MESSAGES */ case LC_MONETARY: envvar = "LC_MONETARY"; envbuf = lc_monetary_envbuf; @@ -390,7 +390,7 @@ assign_locale_messages(const char *newval, void *extra) * itself.) It's important that this not throw elog(ERROR). */ static void -free_struct_lconv(struct lconv * s) +free_struct_lconv(struct lconv *s) { if (s->decimal_point) free(s->decimal_point); @@ -419,7 +419,7 @@ free_struct_lconv(struct lconv * s) * about) are non-NULL. The field list must match free_struct_lconv(). */ static bool -struct_lconv_is_valid(struct lconv * s) +struct_lconv_is_valid(struct lconv *s) { if (s->decimal_point == NULL) return false; @@ -705,7 +705,7 @@ PGLC_localeconv(void) */ static size_t strftime_win32(char *dst, size_t dstlen, - const char *format, const struct tm * tm) + const char *format, const struct tm *tm) { size_t len; wchar_t wformat[8]; /* formats used below need 3 bytes */ @@ -752,11 +752,11 @@ strftime_win32(char *dst, size_t dstlen, /* redefine strftime() */ #define strftime(a,b,c,d) strftime_win32(a,b,c,d) -#endif /* WIN32 */ +#endif /* WIN32 */ /* Subroutine for cache_locale_time(). */ static void -cache_single_time(char **dst, const char *format, const struct tm * tm) +cache_single_time(char **dst, const char *format, const struct tm *tm) { char buf[MAX_L10N_DATA]; char *ptr; @@ -972,9 +972,9 @@ IsoLocaleName(const char *winlocname) return NULL; #else return NULL; /* Not supported on this version of msvc/mingw */ -#endif /* _MSC_VER >= 1400 */ +#endif /* _MSC_VER >= 1400 */ } -#endif /* WIN32 && LC_MESSAGES */ +#endif /* WIN32 && LC_MESSAGES */ /* @@ -1242,7 +1242,7 @@ report_newlocale_failure(const char *localename) errdetail("The operating system could not find any locale data for the locale name \"%s\".", localename) : 0))); } -#endif /* HAVE_LOCALE_T */ +#endif /* HAVE_LOCALE_T */ /* @@ -1346,7 +1346,7 @@ pg_newlocale_from_collation(Oid collid) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("collation provider LIBC is not supported on this platform"))); -#endif /* not HAVE_LOCALE_T */ +#endif /* not HAVE_LOCALE_T */ } else if (collform->collprovider == COLLPROVIDER_ICU) { @@ -1358,8 +1358,8 @@ pg_newlocale_from_collation(Oid collid) collator = ucol_open(collcollate, &status); if (U_FAILURE(status)) ereport(ERROR, - (errmsg("could not open collator for locale \"%s\": %s", - collcollate, u_errorName(status)))); + (errmsg("could not open collator for locale \"%s\": %s", + collcollate, u_errorName(status)))); result->info.icu.locale = strdup(collcollate); result->info.icu.ucol = collator; @@ -1368,8 +1368,8 @@ pg_newlocale_from_collation(Oid collid) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("ICU is not supported in this build"), \ - errhint("You need to rebuild PostgreSQL using --with-icu."))); -#endif /* not USE_ICU */ + errhint("You need to rebuild PostgreSQL using --with-icu."))); +#endif /* not USE_ICU */ } collversion = SysCacheGetAttr(COLLOID, tp, Anum_pg_collation_collversion, @@ -1398,13 +1398,13 @@ pg_newlocale_from_collation(Oid collid) (errmsg("collation \"%s\" has version mismatch", NameStr(collform->collname)), errdetail("The collation in the database was created using version %s, " - "but the operating system provides version %s.", + "but the operating system provides version %s.", collversionstr, actual_versionstr), errhint("Rebuild all objects affected by this collation and run " "ALTER COLLATION %s REFRESH VERSION, " - "or build PostgreSQL with the right library version.", + "or build PostgreSQL with the right library version.", quote_qualified_identifier(get_namespace_name(collform->collnamespace), - NameStr(collform->collname))))); + NameStr(collform->collname))))); } ReleaseSysCache(tp); @@ -1480,12 +1480,24 @@ init_icu_converter(void) conv = ucnv_open(icu_encoding_name, &status); if (U_FAILURE(status)) ereport(ERROR, - (errmsg("could not open ICU converter for encoding \"%s\": %s", - icu_encoding_name, u_errorName(status)))); + (errmsg("could not open ICU converter for encoding \"%s\": %s", + icu_encoding_name, u_errorName(status)))); icu_converter = conv; } +/* + * Convert a string in the database encoding into a string of UChars. + * + * The source string at buff is of length nbytes + * (it needn't be nul-terminated) + * + * *buff_uchar receives a pointer to the palloc'd result string, and + * the function's result is the number of UChars generated. + * + * The result string is nul-terminated, though most callers rely on the + * result length instead. + */ int32_t icu_to_uchar(UChar **buff_uchar, const char *buff, size_t nbytes) { @@ -1494,18 +1506,30 @@ icu_to_uchar(UChar **buff_uchar, const char *buff, size_t nbytes) init_icu_converter(); - len_uchar = 2 * nbytes; /* max length per docs */ + len_uchar = 2 * nbytes + 1; /* max length per docs */ *buff_uchar = palloc(len_uchar * sizeof(**buff_uchar)); status = U_ZERO_ERROR; - len_uchar = ucnv_toUChars(icu_converter, *buff_uchar, len_uchar, buff, nbytes, &status); + len_uchar = ucnv_toUChars(icu_converter, *buff_uchar, len_uchar, + buff, nbytes, &status); if (U_FAILURE(status)) ereport(ERROR, (errmsg("ucnv_toUChars failed: %s", u_errorName(status)))); return len_uchar; } +/* + * Convert a string of UChars into the database encoding. + * + * The source string at buff_uchar is of length len_uchar + * (it needn't be nul-terminated) + * + * *result receives a pointer to the palloc'd result string, and the + * function's result is the number of bytes generated (not counting nul). + * + * The result string is nul-terminated. + */ int32_t -icu_from_uchar(char **result, UChar *buff_uchar, int32_t len_uchar) +icu_from_uchar(char **result, const UChar *buff_uchar, int32_t len_uchar) { UErrorCode status; int32_t len_result; @@ -1515,13 +1539,14 @@ icu_from_uchar(char **result, UChar *buff_uchar, int32_t len_uchar) len_result = UCNV_GET_MAX_BYTES_FOR_STRING(len_uchar, ucnv_getMaxCharSize(icu_converter)); *result = palloc(len_result + 1); status = U_ZERO_ERROR; - ucnv_fromUChars(icu_converter, *result, len_result, buff_uchar, len_uchar, &status); + len_result = ucnv_fromUChars(icu_converter, *result, len_result + 1, + buff_uchar, len_uchar, &status); if (U_FAILURE(status)) ereport(ERROR, (errmsg("ucnv_fromUChars failed: %s", u_errorName(status)))); return len_result; } -#endif +#endif /* USE_ICU */ /* * These functions convert from/to libc's wchar_t, *not* pg_wchar_t. @@ -1569,7 +1594,7 @@ wchar2char(char *to, const wchar_t *from, size_t tolen, pg_locale_t locale) } } else -#endif /* WIN32 */ +#endif /* WIN32 */ if (locale == (pg_locale_t) 0) { /* Use wcstombs directly for the default locale */ @@ -1588,12 +1613,12 @@ wchar2char(char *to, const wchar_t *from, size_t tolen, pg_locale_t locale) result = wcstombs(to, from, tolen); uselocale(save_locale); -#endif /* HAVE_WCSTOMBS_L */ +#endif /* HAVE_WCSTOMBS_L */ #else /* !HAVE_LOCALE_T */ /* Can't have locale != 0 without HAVE_LOCALE_T */ elog(ERROR, "wcstombs_l is not available"); result = 0; /* keep compiler quiet */ -#endif /* HAVE_LOCALE_T */ +#endif /* HAVE_LOCALE_T */ } return result; @@ -1642,7 +1667,7 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen, } } else -#endif /* WIN32 */ +#endif /* WIN32 */ { /* mbstowcs requires ending '\0' */ char *str = pnstrdup(from, fromlen); @@ -1665,12 +1690,12 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen, result = mbstowcs(to, str, tolen); uselocale(save_locale); -#endif /* HAVE_MBSTOWCS_L */ +#endif /* HAVE_MBSTOWCS_L */ #else /* !HAVE_LOCALE_T */ /* Can't have locale != 0 without HAVE_LOCALE_T */ elog(ERROR, "mbstowcs_l is not available"); result = 0; /* keep compiler quiet */ -#endif /* HAVE_LOCALE_T */ +#endif /* HAVE_LOCALE_T */ } pfree(str); @@ -1697,4 +1722,4 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen, return result; } -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ diff --git a/src/backend/utils/adt/pg_upgrade_support.c b/src/backend/utils/adt/pg_upgrade_support.c index 4b340055f0..c0b0474628 100644 --- a/src/backend/utils/adt/pg_upgrade_support.c +++ b/src/backend/utils/adt/pg_upgrade_support.c @@ -172,7 +172,7 @@ binary_upgrade_create_empty_extension(PG_FUNCTION_ARGS) InsertExtensionTuple(text_to_cstring(extName), GetUserId(), - get_namespace_oid(text_to_cstring(schemaName), false), + get_namespace_oid(text_to_cstring(schemaName), false), relocatable, text_to_cstring(extVersion), extConfig, diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index e0cae1ba1e..20ce48b2d8 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -784,7 +784,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS) { clean_ipv6_addr(beentry->st_clientaddr.addr.ss_family, remote_host); values[12] = DirectFunctionCall1(inet_in, - CStringGetDatum(remote_host)); + CStringGetDatum(remote_host)); if (beentry->st_clienthostname && beentry->st_clienthostname[0]) values[13] = CStringGetTextDatum(beentry->st_clienthostname); @@ -1859,5 +1859,5 @@ pg_stat_get_archiver(PG_FUNCTION_ARGS) /* Returns the record as Datum */ PG_RETURN_DATUM(HeapTupleGetDatum( - heap_form_tuple(tupdesc, values, nulls))); + heap_form_tuple(tupdesc, values, nulls))); } diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c index 304345b904..09a4f14a17 100644 --- a/src/backend/utils/adt/rangetypes.c +++ b/src/backend/utils/adt/rangetypes.c @@ -331,13 +331,13 @@ get_range_io_data(FunctionCallInfo fcinfo, Oid rngtypid, IOFuncSelector func) if (func == IOFunc_receive) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("no binary input function available for type %s", - format_type_be(cache->typcache->rngelemtype->type_id)))); + errmsg("no binary input function available for type %s", + format_type_be(cache->typcache->rngelemtype->type_id)))); else ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("no binary output function available for type %s", - format_type_be(cache->typcache->rngelemtype->type_id)))); + errmsg("no binary output function available for type %s", + format_type_be(cache->typcache->rngelemtype->type_id)))); } fmgr_info_cxt(cache->typiofunc, &cache->proc, fcinfo->flinfo->fn_mcxt); @@ -402,7 +402,7 @@ range_constructor3(PG_FUNCTION_ARGS) if (PG_ARGISNULL(2)) ereport(ERROR, (errcode(ERRCODE_DATA_EXCEPTION), - errmsg("range constructor flags argument must not be null"))); + errmsg("range constructor flags argument must not be null"))); flags = range_parse_flags(text_to_cstring(PG_GETARG_TEXT_PP(2))); @@ -989,7 +989,7 @@ range_minus(PG_FUNCTION_ARGS) if (cmp_l1l2 < 0 && cmp_u1u2 > 0) ereport(ERROR, (errcode(ERRCODE_DATA_EXCEPTION), - errmsg("result of range difference would not be contiguous"))); + errmsg("result of range difference would not be contiguous"))); if (cmp_l1u2 > 0 || cmp_u1l2 < 0) PG_RETURN_RANGE(r1); @@ -1914,7 +1914,7 @@ range_parse_flags(const char *flags_str) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("invalid range bound flags"), - errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\"."))); + errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\"."))); switch (flags_str[0]) { @@ -1927,7 +1927,7 @@ range_parse_flags(const char *flags_str) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("invalid range bound flags"), - errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\"."))); + errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\"."))); } switch (flags_str[1]) @@ -1941,7 +1941,7 @@ range_parse_flags(const char *flags_str) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("invalid range bound flags"), - errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\"."))); + errhint("Valid values are \"[]\", \"[)\", \"(]\", and \"()\"."))); } return flags; @@ -2051,7 +2051,7 @@ range_parse(const char *string, char *flags, char **lbound_str, } else if (*ptr == ')') ptr++; - else /* must be a comma */ + else /* must be a comma */ ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("malformed range literal: \"%s\"", diff --git a/src/backend/utils/adt/rangetypes_gist.c b/src/backend/utils/adt/rangetypes_gist.c index f81b16c236..a1f4f4d372 100644 --- a/src/backend/utils/adt/rangetypes_gist.c +++ b/src/backend/utils/adt/rangetypes_gist.c @@ -70,7 +70,7 @@ typedef enum typedef struct { TypeCacheEntry *typcache; /* typcache for range type */ - bool has_subtype_diff; /* does it have subtype_diff? */ + bool has_subtype_diff; /* does it have subtype_diff? */ int entries_count; /* total number of entries being split */ /* Information about currently selected split follows */ diff --git a/src/backend/utils/adt/rangetypes_selfuncs.c b/src/backend/utils/adt/rangetypes_selfuncs.c index c4c549658d..ed13c27fcb 100644 --- a/src/backend/utils/adt/rangetypes_selfuncs.c +++ b/src/backend/utils/adt/rangetypes_selfuncs.c @@ -47,15 +47,15 @@ static float8 get_distance(TypeCacheEntry *typcache, RangeBound *bound1, static int length_hist_bsearch(Datum *length_hist_values, int length_hist_nvalues, double value, bool equal); static double calc_length_hist_frac(Datum *length_hist_values, - int length_hist_nvalues, double length1, double length2, bool equal); + int length_hist_nvalues, double length1, double length2, bool equal); static double calc_hist_selectivity_contained(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, RangeBound *hist_lower, int hist_nvalues, - Datum *length_hist_values, int length_hist_nvalues); + Datum *length_hist_values, int length_hist_nvalues); static double calc_hist_selectivity_contains(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, RangeBound *hist_lower, int hist_nvalues, - Datum *length_hist_values, int length_hist_nvalues); + Datum *length_hist_values, int length_hist_nvalues); /* * Returns a default selectivity estimate for given operator, when we don't @@ -251,7 +251,7 @@ calc_rangesel(TypeCacheEntry *typcache, VariableStatData *vardata, ATTSTATSSLOT_NUMBERS)) { if (sslot.nnumbers != 1) - elog(ERROR, "invalid empty fraction statistic"); /* shouldn't happen */ + elog(ERROR, "invalid empty fraction statistic"); /* shouldn't happen */ empty_frac = sslot.numbers[0]; free_attstatsslot(&sslot); } @@ -535,7 +535,7 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata, case OID_RANGE_CONTAINS_OP: hist_selec = calc_hist_selectivity_contains(typcache, &const_lower, - &const_upper, hist_lower, nhist, + &const_upper, hist_lower, nhist, lslot.values, lslot.nvalues); break; @@ -554,14 +554,14 @@ calc_hist_selectivity(TypeCacheEntry *typcache, VariableStatData *vardata, { hist_selec = 1.0 - calc_hist_selectivity_scalar(typcache, &const_lower, - hist_lower, nhist, false); + hist_lower, nhist, false); } else { hist_selec = calc_hist_selectivity_contained(typcache, &const_lower, - &const_upper, hist_lower, nhist, - lslot.values, lslot.nvalues); + &const_upper, hist_lower, nhist, + lslot.values, lslot.nvalues); } break; @@ -599,7 +599,7 @@ calc_hist_selectivity_scalar(TypeCacheEntry *typcache, RangeBound *constbound, /* Adjust using linear interpolation within the bin */ if (index >= 0 && index < hist_nvalues - 1) selec += get_position(typcache, constbound, &hist[index], - &hist[index + 1]) / (Selectivity) (hist_nvalues - 1); + &hist[index + 1]) / (Selectivity) (hist_nvalues - 1); return selec; } @@ -694,7 +694,7 @@ get_position(TypeCacheEntry *typcache, RangeBound *value, RangeBound *hist1, /* Calculate relative position using subdiff function. */ bin_width = DatumGetFloat8(FunctionCall2Coll( - &typcache->rng_subdiff_finfo, + &typcache->rng_subdiff_finfo, typcache->rng_collation, hist2->val, hist1->val)); @@ -702,7 +702,7 @@ get_position(TypeCacheEntry *typcache, RangeBound *value, RangeBound *hist1, return 0.5; /* zero width bin */ position = DatumGetFloat8(FunctionCall2Coll( - &typcache->rng_subdiff_finfo, + &typcache->rng_subdiff_finfo, typcache->rng_collation, value->val, hist1->val)) @@ -998,7 +998,7 @@ static double calc_hist_selectivity_contained(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, RangeBound *hist_lower, int hist_nvalues, - Datum *length_hist_values, int length_hist_nvalues) + Datum *length_hist_values, int length_hist_nvalues) { int i, upper_index; @@ -1108,7 +1108,7 @@ static double calc_hist_selectivity_contains(TypeCacheEntry *typcache, RangeBound *lower, RangeBound *upper, RangeBound *hist_lower, int hist_nvalues, - Datum *length_hist_values, int length_hist_nvalues) + Datum *length_hist_values, int length_hist_nvalues) { int i, lower_index; diff --git a/src/backend/utils/adt/rangetypes_spgist.c b/src/backend/utils/adt/rangetypes_spgist.c index a887e55b92..e82c4e1a9e 100644 --- a/src/backend/utils/adt/rangetypes_spgist.c +++ b/src/backend/utils/adt/rangetypes_spgist.c @@ -213,7 +213,7 @@ spg_range_quad_picksplit(PG_FUNCTION_ARGS) *upperBounds; typcache = range_get_typcache(fcinfo, - RangeTypeGetOid(DatumGetRangeType(in->datums[0]))); + RangeTypeGetOid(DatumGetRangeType(in->datums[0]))); /* Allocate memory for bounds */ lowerBounds = palloc(sizeof(RangeBound) * in->nTuples); @@ -347,7 +347,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS) */ if (strategy != RANGESTRAT_CONTAINS_ELEM) empty = RangeIsEmpty( - DatumGetRangeType(in->scankeys[i].sk_argument)); + DatumGetRangeType(in->scankeys[i].sk_argument)); else empty = false; @@ -417,7 +417,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS) /* This node has a centroid. Fetch it. */ centroid = DatumGetRangeType(in->prefixDatum); typcache = range_get_typcache(fcinfo, - RangeTypeGetOid(DatumGetRangeType(centroid))); + RangeTypeGetOid(DatumGetRangeType(centroid))); range_deserialize(typcache, centroid, ¢roidLower, ¢roidUpper, ¢roidEmpty); @@ -574,7 +574,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS) */ cmp = adjacent_inner_consistent(typcache, &lower, ¢roidUpper, - prevCentroid ? &prevUpper : NULL); + prevCentroid ? &prevUpper : NULL); if (cmp > 0) which1 = (1 << 1) | (1 << 4); else if (cmp < 0) @@ -590,7 +590,7 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS) */ cmp = adjacent_inner_consistent(typcache, &upper, ¢roidLower, - prevCentroid ? &prevLower : NULL); + prevCentroid ? &prevLower : NULL); if (cmp > 0) which2 = (1 << 1) | (1 << 2); else if (cmp < 0) @@ -973,7 +973,7 @@ spg_range_quad_leaf_consistent(PG_FUNCTION_ARGS) break; case RANGESTRAT_CONTAINED_BY: res = range_contained_by_internal(typcache, leafRange, - DatumGetRangeType(keyDatum)); + DatumGetRangeType(keyDatum)); break; case RANGESTRAT_CONTAINS_ELEM: res = range_contains_elem_internal(typcache, leafRange, diff --git a/src/backend/utils/adt/rangetypes_typanalyze.c b/src/backend/utils/adt/rangetypes_typanalyze.c index a8d585ce7a..324bbe48e5 100644 --- a/src/backend/utils/adt/rangetypes_typanalyze.c +++ b/src/backend/utils/adt/rangetypes_typanalyze.c @@ -33,7 +33,7 @@ static int float8_qsort_cmp(const void *a1, const void *a2); static int range_bound_qsort_cmp(const void *a1, const void *a2, void *arg); static void compute_range_stats(VacAttrStats *stats, - AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows); + AnalyzeAttrFetchFunc fetchfunc, int samplerows, double totalrows); /* * range_typanalyze -- typanalyze function for range columns @@ -165,9 +165,9 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, * and lower bound values. */ length = DatumGetFloat8(FunctionCall2Coll( - &typcache->rng_subdiff_finfo, - typcache->rng_collation, - upper.val, lower.val)); + &typcache->rng_subdiff_finfo, + typcache->rng_collation, + upper.val, lower.val)); } else { @@ -246,7 +246,7 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, for (i = 0; i < num_hist; i++) { bound_hist_values[i] = PointerGetDatum(range_serialize( - typcache, &lowers[pos], &uppers[pos], false)); + typcache, &lowers[pos], &uppers[pos], false)); pos += delta; posfrac += deltafrac; if (posfrac >= (num_hist - 1)) @@ -347,7 +347,7 @@ compute_range_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc, stats->stats_valid = true; stats->stanullfrac = 1.0; stats->stawidth = 0; /* "unknown" */ - stats->stadistinct = 0.0; /* "unknown" */ + stats->stadistinct = 0.0; /* "unknown" */ } /* diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c index 3a1647bc52..139bb583b1 100644 --- a/src/backend/utils/adt/regexp.c +++ b/src/backend/utils/adt/regexp.c @@ -696,7 +696,7 @@ similar_escape(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_ESCAPE_SEQUENCE), errmsg("invalid escape string"), - errhint("Escape string must be empty or one character."))); + errhint("Escape string must be empty or one character."))); } } @@ -1028,7 +1028,7 @@ setup_regexp_matches(text *orig_str, text *pattern, pg_re_flags *re_flags, { array_len *= 2; matchctx->match_locs = (int *) repalloc(matchctx->match_locs, - sizeof(int) * array_len); + sizeof(int) * array_len); } /* save this match's locations */ @@ -1118,7 +1118,7 @@ build_regexp_match_result(regexp_matches_ctx *matchctx) else { elems[i] = DirectFunctionCall3(text_substr, - PointerGetDatum(matchctx->orig_str), + PointerGetDatum(matchctx->orig_str), Int32GetDatum(so + 1), Int32GetDatum(eo - so)); nulls[i] = false; @@ -1216,7 +1216,7 @@ regexp_split_to_array(PG_FUNCTION_ARGS) if (re_flags.glob) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("regexp_split_to_array does not support the global option"))); + errmsg("regexp_split_to_array does not support the global option"))); /* But we find all the matches anyway */ re_flags.glob = true; diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c index ba879e81cd..6fe81fab7e 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -76,7 +76,7 @@ regprocin(PG_FUNCTION_ARGS) strspn(pro_name_or_oid, "0123456789") == strlen(pro_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(pro_name_or_oid))); + CStringGetDatum(pro_name_or_oid))); PG_RETURN_OID(result); } @@ -247,7 +247,7 @@ regprocedurein(PG_FUNCTION_ARGS) strspn(pro_name_or_oid, "0123456789") == strlen(pro_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(pro_name_or_oid))); + CStringGetDatum(pro_name_or_oid))); PG_RETURN_OID(result); } @@ -497,7 +497,7 @@ regoperin(PG_FUNCTION_ARGS) strspn(opr_name_or_oid, "0123456789") == strlen(opr_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(opr_name_or_oid))); + CStringGetDatum(opr_name_or_oid))); PG_RETURN_OID(result); } @@ -670,7 +670,7 @@ regoperatorin(PG_FUNCTION_ARGS) strspn(opr_name_or_oid, "0123456789") == strlen(opr_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(opr_name_or_oid))); + CStringGetDatum(opr_name_or_oid))); PG_RETURN_OID(result); } @@ -916,7 +916,7 @@ regclassin(PG_FUNCTION_ARGS) strspn(class_name_or_oid, "0123456789") == strlen(class_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(class_name_or_oid))); + CStringGetDatum(class_name_or_oid))); PG_RETURN_OID(result); } @@ -1074,7 +1074,7 @@ regtypein(PG_FUNCTION_ARGS) strspn(typ_name_or_oid, "0123456789") == strlen(typ_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(typ_name_or_oid))); + CStringGetDatum(typ_name_or_oid))); PG_RETURN_OID(result); } @@ -1210,7 +1210,7 @@ regconfigin(PG_FUNCTION_ARGS) strspn(cfg_name_or_oid, "0123456789") == strlen(cfg_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(cfg_name_or_oid))); + CStringGetDatum(cfg_name_or_oid))); PG_RETURN_OID(result); } @@ -1321,7 +1321,7 @@ regdictionaryin(PG_FUNCTION_ARGS) strspn(dict_name_or_oid, "0123456789") == strlen(dict_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(dict_name_or_oid))); + CStringGetDatum(dict_name_or_oid))); PG_RETURN_OID(result); } @@ -1432,7 +1432,7 @@ regrolein(PG_FUNCTION_ARGS) strspn(role_name_or_oid, "0123456789") == strlen(role_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(role_name_or_oid))); + CStringGetDatum(role_name_or_oid))); PG_RETURN_OID(result); } @@ -1557,7 +1557,7 @@ regnamespacein(PG_FUNCTION_ARGS) strspn(nsp_name_or_oid, "0123456789") == strlen(nsp_name_or_oid)) { result = DatumGetObjectId(DirectFunctionCall1(oidin, - CStringGetDatum(nsp_name_or_oid))); + CStringGetDatum(nsp_name_or_oid))); PG_RETURN_OID(result); } diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index ee2c56bb2e..139c734623 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -123,14 +123,11 @@ typedef struct RI_ConstraintInfo char confdeltype; /* foreign key's ON DELETE action */ char confmatchtype; /* foreign key's match type */ int nkeys; /* number of key columns */ - int16 pk_attnums[RI_MAX_NUMKEYS]; /* attnums of referenced cols */ - int16 fk_attnums[RI_MAX_NUMKEYS]; /* attnums of referencing cols */ - Oid pf_eq_oprs[RI_MAX_NUMKEYS]; /* equality operators (PK = - * FK) */ - Oid pp_eq_oprs[RI_MAX_NUMKEYS]; /* equality operators (PK = - * PK) */ - Oid ff_eq_oprs[RI_MAX_NUMKEYS]; /* equality operators (FK = - * FK) */ + int16 pk_attnums[RI_MAX_NUMKEYS]; /* attnums of referenced cols */ + int16 fk_attnums[RI_MAX_NUMKEYS]; /* attnums of referencing cols */ + Oid pf_eq_oprs[RI_MAX_NUMKEYS]; /* equality operators (PK = FK) */ + Oid pp_eq_oprs[RI_MAX_NUMKEYS]; /* equality operators (PK = PK) */ + Oid ff_eq_oprs[RI_MAX_NUMKEYS]; /* equality operators (FK = FK) */ dlist_node valid_link; /* Link in list of valid entries */ } RI_ConstraintInfo; @@ -592,7 +589,7 @@ ri_Check_Pk_Match(Relation pk_rel, Relation fk_rel, result = ri_PerformCheck(riinfo, &qkey, qplan, fk_rel, pk_rel, old_row, NULL, - true, /* treat like update */ + true, /* treat like update */ SPI_OK_SELECT); if (SPI_finish() != SPI_OK_FINISH) @@ -784,7 +781,7 @@ ri_restrict_del(TriggerData *trigdata, bool is_no_action) ri_PerformCheck(riinfo, &qkey, qplan, fk_rel, pk_rel, old_row, NULL, - true, /* must detect new rows */ + true, /* must detect new rows */ SPI_OK_SELECT); if (SPI_finish() != SPI_OK_FINISH) @@ -1007,7 +1004,7 @@ ri_restrict_upd(TriggerData *trigdata, bool is_no_action) ri_PerformCheck(riinfo, &qkey, qplan, fk_rel, pk_rel, old_row, NULL, - true, /* must detect new rows */ + true, /* must detect new rows */ SPI_OK_SELECT); if (SPI_finish() != SPI_OK_FINISH) @@ -1163,7 +1160,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS) ri_PerformCheck(riinfo, &qkey, qplan, fk_rel, pk_rel, old_row, NULL, - true, /* must detect new rows */ + true, /* must detect new rows */ SPI_OK_DELETE); if (SPI_finish() != SPI_OK_FINISH) @@ -1344,7 +1341,7 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS) ri_PerformCheck(riinfo, &qkey, qplan, fk_rel, pk_rel, old_row, new_row, - true, /* must detect new rows */ + true, /* must detect new rows */ SPI_OK_UPDATE); if (SPI_finish() != SPI_OK_FINISH) @@ -1509,7 +1506,7 @@ RI_FKey_setnull_del(PG_FUNCTION_ARGS) ri_PerformCheck(riinfo, &qkey, qplan, fk_rel, pk_rel, old_row, NULL, - true, /* must detect new rows */ + true, /* must detect new rows */ SPI_OK_UPDATE); if (SPI_finish() != SPI_OK_FINISH) @@ -1685,7 +1682,7 @@ RI_FKey_setnull_upd(PG_FUNCTION_ARGS) ri_PerformCheck(riinfo, &qkey, qplan, fk_rel, pk_rel, old_row, NULL, - true, /* must detect new rows */ + true, /* must detect new rows */ SPI_OK_UPDATE); if (SPI_finish() != SPI_OK_FINISH) @@ -1851,7 +1848,7 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS) ri_PerformCheck(riinfo, &qkey, qplan, fk_rel, pk_rel, old_row, NULL, - true, /* must detect new rows */ + true, /* must detect new rows */ SPI_OK_UPDATE); if (SPI_finish() != SPI_OK_FINISH) @@ -2042,7 +2039,7 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS) ri_PerformCheck(riinfo, &qkey, qplan, fk_rel, pk_rel, old_row, NULL, - true, /* must detect new rows */ + true, /* must detect new rows */ SPI_OK_UPDATE); if (SPI_finish() != SPI_OK_FINISH) @@ -2728,7 +2725,7 @@ ri_CheckTrigger(FunctionCallInfo fcinfo, const char *funcname, int tgkind) !TRIGGER_FIRED_FOR_ROW(trigdata->tg_event)) ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("function \"%s\" must be fired AFTER ROW", funcname))); + errmsg("function \"%s\" must be fired AFTER ROW", funcname))); switch (tgkind) { @@ -2771,8 +2768,8 @@ ri_FetchConstraintInfo(Trigger *trigger, Relation trig_rel, bool rel_is_pk) if (!OidIsValid(constraintOid)) ereport(ERROR, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), - errmsg("no pg_constraint entry for trigger \"%s\" on table \"%s\"", - trigger->tgname, RelationGetRelationName(trig_rel)), + errmsg("no pg_constraint entry for trigger \"%s\" on table \"%s\"", + trigger->tgname, RelationGetRelationName(trig_rel)), errhint("Remove this referential integrity trigger and its mates, then do ALTER TABLE ADD CONSTRAINT."))); /* Find or create a hashtable entry for the constraint */ @@ -2844,7 +2841,7 @@ ri_LoadConstraintInfo(Oid constraintOid) /* And extract data */ Assert(riinfo->constraint_id == constraintOid); riinfo->oidHashValue = GetSysCacheHashValue1(CONSTROID, - ObjectIdGetDatum(constraintOid)); + ObjectIdGetDatum(constraintOid)); memcpy(&riinfo->conname, &conForm->conname, sizeof(NameData)); riinfo->pk_relid = conForm->confrelid; riinfo->fk_relid = conForm->conrelid; @@ -3118,7 +3115,7 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo, */ if (IsolationUsesXactSnapshot() && detectNewRows) { - CommandCounterIncrement(); /* be sure all my own work is visible */ + CommandCounterIncrement(); /* be sure all my own work is visible */ test_snapshot = GetLatestSnapshot(); crosscheck_snapshot = GetTransactionSnapshot(); } @@ -3166,7 +3163,7 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo, /* XXX wouldn't it be clearer to do this part at the caller? */ if (qkey->constr_queryno != RI_PLAN_CHECK_LOOKUPPK_FROM_PK && expect_OK == SPI_OK_SELECT && - (SPI_processed == 0) == (qkey->constr_queryno == RI_PLAN_CHECK_LOOKUPPK)) + (SPI_processed == 0) == (qkey->constr_queryno == RI_PLAN_CHECK_LOOKUPPK)) ri_ReportViolation(riinfo, pk_rel, fk_rel, new_tuple ? new_tuple : old_tuple, @@ -3337,9 +3334,9 @@ ri_ReportViolation(const RI_ConstraintInfo *riinfo, NameStr(riinfo->conname), RelationGetRelationName(fk_rel)), has_perm ? - errdetail("Key (%s)=(%s) is still referenced from table \"%s\".", - key_names.data, key_values.data, - RelationGetRelationName(fk_rel)) : + errdetail("Key (%s)=(%s) is still referenced from table \"%s\".", + key_names.data, key_values.data, + RelationGetRelationName(fk_rel)) : errdetail("Key is still referenced from table \"%s\".", RelationGetRelationName(fk_rel)), errtableconstraint(fk_rel, NameStr(riinfo->conname)))); @@ -3591,11 +3588,11 @@ ri_AttributesEqual(Oid eq_opr, Oid typeid, { oldvalue = FunctionCall3(&entry->cast_func_finfo, oldvalue, - Int32GetDatum(-1), /* typmod */ + Int32GetDatum(-1), /* typmod */ BoolGetDatum(false)); /* implicit coercion */ newvalue = FunctionCall3(&entry->cast_func_finfo, newvalue, - Int32GetDatum(-1), /* typmod */ + Int32GetDatum(-1), /* typmod */ BoolGetDatum(false)); /* implicit coercion */ } @@ -3670,7 +3667,7 @@ ri_HashCompareOp(Oid eq_opr, Oid typeid) op_input_types(eq_opr, &lefttype, &righttype); Assert(lefttype == righttype); if (typeid == lefttype) - castfunc = InvalidOid; /* simplest case */ + castfunc = InvalidOid; /* simplest case */ else { pathtype = find_coercion_pathway(lefttype, typeid, diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c index dce7bdb7e4..bab78d492e 100644 --- a/src/backend/utils/adt/rowtypes.c +++ b/src/backend/utils/adt/rowtypes.c @@ -100,7 +100,7 @@ record_in(PG_FUNCTION_ARGS) if (tupType == RECORDOID && tupTypmod < 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("input of anonymous composite types is not implemented"))); + errmsg("input of anonymous composite types is not implemented"))); /* * This comes from the composite type's pg_type.oid and stores system oids @@ -479,7 +479,7 @@ record_recv(PG_FUNCTION_ARGS) if (tupType == RECORDOID && tupTypmod < 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("input of anonymous composite types is not implemented"))); + errmsg("input of anonymous composite types is not implemented"))); tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod); ncolumns = tupdesc->natts; @@ -936,8 +936,8 @@ record_cmp(FunctionCallInfo fcinfo) if (!OidIsValid(typentry->cmp_proc_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify a comparison function for type %s", - format_type_be(typentry->type_id)))); + errmsg("could not identify a comparison function for type %s", + format_type_be(typentry->type_id)))); my_extra->columns[j].typentry = typentry; } @@ -1182,8 +1182,8 @@ record_eq(PG_FUNCTION_ARGS) if (!OidIsValid(typentry->eq_opr_finfo.fn_oid)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not identify an equality operator for type %s", - format_type_be(typentry->type_id)))); + errmsg("could not identify an equality operator for type %s", + format_type_be(typentry->type_id)))); my_extra->columns[j].typentry = typentry; } diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index a1a7edd589..2f28197517 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -98,7 +98,7 @@ #define PRETTYINDENT_JOIN 4 #define PRETTYINDENT_VAR 4 -#define PRETTYINDENT_LIMIT 40 /* wrap limit */ +#define PRETTYINDENT_LIMIT 40 /* wrap limit */ /* Pretty flags */ #define PRETTYFLAG_PAREN 1 @@ -128,8 +128,8 @@ typedef struct int wrapColumn; /* max line length, or -1 for no limit */ int indentLevel; /* current indent level for prettyprint */ bool varprefix; /* TRUE to print prefixes on Vars */ - ParseExprKind special_exprkind; /* set only for exprkinds needing - * special handling */ + ParseExprKind special_exprkind; /* set only for exprkinds needing special + * handling */ #ifdef PGXC bool finalise_aggs; /* should Datanode finalise the aggregates? */ bool sortgroup_colno;/* instead of expression use resno for @@ -301,7 +301,7 @@ typedef struct */ typedef struct { - char name[NAMEDATALEN]; /* Hash key --- must be first */ + char name[NAMEDATALEN]; /* Hash key --- must be first */ int counter; /* Largest addition used so far for name */ } NameHashEntry; @@ -953,7 +953,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty) { if (OidIsValid(trigrec->tgconstrrelid)) appendStringInfo(&buf, "FROM %s ", - generate_relation_name(trigrec->tgconstrrelid, NIL)); + generate_relation_name(trigrec->tgconstrrelid, NIL)); if (!trigrec->tgdeferrable) appendStringInfoString(&buf, "NOT "); appendStringInfoString(&buf, "DEFERRABLE INITIALLY "); @@ -1288,7 +1288,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, quote_identifier(NameStr(idxrelrec->relname)), generate_relation_name(indrelid, NIL), quote_identifier(NameStr(amrec->amname))); - else /* currently, must be EXCLUDE constraint */ + else /* currently, must be EXCLUDE constraint */ appendStringInfo(&buf, "EXCLUDE USING %s (", quote_identifier(NameStr(amrec->amname))); } @@ -1337,7 +1337,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, { /* Need parens if it's not a bare function call */ if (indexkey && IsA(indexkey, FuncExpr) && - ((FuncExpr *) indexkey)->funcformat == COERCE_EXPLICIT_CALL) + ((FuncExpr *) indexkey)->funcformat == COERCE_EXPLICIT_CALL) appendStringInfoString(&buf, str); else appendStringInfo(&buf, "(%s)", str); @@ -1505,7 +1505,7 @@ pg_get_statisticsobj_worker(Oid statextid, bool missing_ok) nsp = get_namespace_name(statextrec->stxnamespace); appendStringInfo(&buf, "CREATE STATISTICS %s", quote_qualified_identifier(nsp, - NameStr(statextrec->stxname))); + NameStr(statextrec->stxname))); /* * Decode the stxkind column so that we know which stats types to print. @@ -1659,7 +1659,7 @@ pg_get_partkeydef_worker(Oid relid, int prettyFlags, char *exprsString; exprsDatum = SysCacheGetAttr(PARTRELID, tuple, - Anum_pg_partitioned_table_partexprs, &isnull); + Anum_pg_partitioned_table_partexprs, &isnull); Assert(!isnull); exprsString = TextDatumGetCString(exprsDatum); partexprs = (List *) stringToNode(exprsString); @@ -2051,7 +2051,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand, tblspc = get_rel_tablespace(indexId); if (OidIsValid(tblspc)) appendStringInfo(&buf, " USING INDEX TABLESPACE %s", - quote_identifier(get_tablespace_name(tblspc))); + quote_identifier(get_tablespace_name(tblspc))); } break; @@ -2486,7 +2486,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS) print_function_trftypes(&buf, proctup); appendStringInfo(&buf, "\n LANGUAGE %s\n", - quote_identifier(get_language_name(proc->prolang, false))); + quote_identifier(get_language_name(proc->prolang, false))); /* Emit some miscellaneous options on one line */ oldlen = buf.len; @@ -2594,7 +2594,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS) if (!isnull) { simple_quote_literal(&buf, TextDatumGetCString(tmp)); - appendStringInfoString(&buf, ", "); /* assume prosrc isn't null */ + appendStringInfoString(&buf, ", "); /* assume prosrc isn't null */ } tmp = SysCacheGetAttr(PROCOID, proctup, Anum_pg_proc_prosrc, &isnull); @@ -5400,19 +5400,19 @@ get_select_query_def(Query *query, deparse_context *context, break; case LCS_FORKEYSHARE: appendContextKeyword(context, " FOR KEY SHARE", - -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); + -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); break; case LCS_FORSHARE: appendContextKeyword(context, " FOR SHARE", - -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); + -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); break; case LCS_FORNOKEYUPDATE: appendContextKeyword(context, " FOR NO KEY UPDATE", - -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); + -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); break; case LCS_FORUPDATE: appendContextKeyword(context, " FOR UPDATE", - -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); + -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); break; } @@ -6290,8 +6290,8 @@ get_insert_query_def(Query *query, deparse_context *context) * tle->resname, since resname will fail to track RENAME. */ appendStringInfoString(buf, - quote_identifier(get_relid_attribute_name(rte->relid, - tle->resno))); + quote_identifier(get_relid_attribute_name(rte->relid, + tle->resno))); /* * Print any indirection needed (subfields or subscripts), and strip @@ -6573,7 +6573,7 @@ get_update_query_targetlist_def(Query *query, List *targetList, cur_ma_sublink = (SubLink *) lfirst(next_ma_cell); next_ma_cell = lnext(next_ma_cell); remaining_ma_columns = count_nonjunk_tlist_entries( - ((Query *) cur_ma_sublink->subselect)->targetList); + ((Query *) cur_ma_sublink->subselect)->targetList); Assert(((Param *) expr)->paramid == ((cur_ma_sublink->subLinkId << 16) | 1)); appendStringInfoChar(buf, '('); @@ -6585,8 +6585,8 @@ get_update_query_targetlist_def(Query *query, List *targetList, * tle->resname, since resname will fail to track RENAME. */ appendStringInfoString(buf, - quote_identifier(get_relid_attribute_name(rte->relid, - tle->resno))); + quote_identifier(get_relid_attribute_name(rte->relid, + tle->resno))); /* * Print any indirection needed (subfields or subscripts), and strip @@ -7922,17 +7922,17 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags) return false; return true; /* own parentheses */ } - case T_BoolExpr: /* lower precedence */ - case T_ArrayRef: /* other separators */ - case T_ArrayExpr: /* other separators */ - case T_RowExpr: /* other separators */ + case T_BoolExpr: /* lower precedence */ + case T_ArrayRef: /* other separators */ + case T_ArrayExpr: /* other separators */ + case T_RowExpr: /* other separators */ case T_CoalesceExpr: /* own parentheses */ - case T_MinMaxExpr: /* own parentheses */ - case T_XmlExpr: /* own parentheses */ - case T_NullIfExpr: /* other separators */ + case T_MinMaxExpr: /* own parentheses */ + case T_XmlExpr: /* own parentheses */ + case T_NullIfExpr: /* other separators */ case T_Aggref: /* own parentheses */ - case T_WindowFunc: /* own parentheses */ - case T_CaseExpr: /* other separators */ + case T_WindowFunc: /* own parentheses */ + case T_CaseExpr: /* other separators */ return true; default: return false; @@ -7973,16 +7973,16 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags) return false; return true; /* own parentheses */ } - case T_ArrayRef: /* other separators */ - case T_ArrayExpr: /* other separators */ - case T_RowExpr: /* other separators */ + case T_ArrayRef: /* other separators */ + case T_ArrayExpr: /* other separators */ + case T_RowExpr: /* other separators */ case T_CoalesceExpr: /* own parentheses */ - case T_MinMaxExpr: /* own parentheses */ - case T_XmlExpr: /* own parentheses */ - case T_NullIfExpr: /* other separators */ + case T_MinMaxExpr: /* own parentheses */ + case T_XmlExpr: /* own parentheses */ + case T_NullIfExpr: /* other separators */ case T_Aggref: /* own parentheses */ - case T_WindowFunc: /* own parentheses */ - case T_CaseExpr: /* other separators */ + case T_WindowFunc: /* own parentheses */ + case T_CaseExpr: /* other separators */ return true; default: return false; @@ -8281,7 +8281,7 @@ get_rule_expr(Node *node, deparse_context *context, appendStringInfo(buf, " %s %s (", generate_operator_name(expr->opno, exprType(arg1), - get_base_element_type(exprType(arg2))), + get_base_element_type(exprType(arg2))), expr->useOr ? "ANY" : "ALL"); get_rule_expr_paren(arg2, context, true, node); @@ -8301,7 +8301,7 @@ get_rule_expr(Node *node, deparse_context *context, ((SubLink *) arg2)->subLinkType == EXPR_SUBLINK) appendStringInfo(buf, "::%s", format_type_with_typemod(exprType(arg2), - exprTypmod(arg2))); + exprTypmod(arg2))); appendStringInfoChar(buf, ')'); if (!PRETTY_PAREN(context)) appendStringInfoChar(buf, ')'); @@ -8659,7 +8659,7 @@ get_rule_expr(Node *node, deparse_context *context, */ if (arrayexpr->elements == NIL) appendStringInfo(buf, "::%s", - format_type_with_typemod(arrayexpr->array_typeid, -1)); + format_type_with_typemod(arrayexpr->array_typeid, -1)); } break; @@ -8721,7 +8721,7 @@ get_rule_expr(Node *node, deparse_context *context, appendStringInfoChar(buf, ')'); if (rowexpr->row_format == COERCE_EXPLICIT_CAST) appendStringInfo(buf, "::%s", - format_type_with_typemod(rowexpr->row_typeid, -1)); + format_type_with_typemod(rowexpr->row_typeid, -1)); } break; @@ -8754,9 +8754,9 @@ get_rule_expr(Node *node, deparse_context *context, * be perfect. */ appendStringInfo(buf, ") %s ROW(", - generate_operator_name(linitial_oid(rcexpr->opnos), - exprType(linitial(rcexpr->largs)), - exprType(linitial(rcexpr->rargs)))); + generate_operator_name(linitial_oid(rcexpr->opnos), + exprType(linitial(rcexpr->largs)), + exprType(linitial(rcexpr->rargs)))); sep = ""; foreach(arg, rcexpr->rargs) { @@ -8970,7 +8970,7 @@ get_rule_expr(Node *node, deparse_context *context, Assert(!con->constisnull); if (DatumGetBool(con->constvalue)) appendStringInfoString(buf, - " PRESERVE WHITESPACE"); + " PRESERVE WHITESPACE"); else appendStringInfoString(buf, " STRIP WHITESPACE"); @@ -8998,15 +8998,15 @@ get_rule_expr(Node *node, deparse_context *context, { case XML_STANDALONE_YES: appendStringInfoString(buf, - ", STANDALONE YES"); + ", STANDALONE YES"); break; case XML_STANDALONE_NO: appendStringInfoString(buf, - ", STANDALONE NO"); + ", STANDALONE NO"); break; case XML_STANDALONE_NO_VALUE: appendStringInfoString(buf, - ", STANDALONE NO VALUE"); + ", STANDALONE NO VALUE"); break; default: break; @@ -9192,7 +9192,7 @@ get_rule_expr(Node *node, deparse_context *context, if (iexpr->infercollid) appendStringInfo(buf, " COLLATE %s", - generate_collation_name(iexpr->infercollid)); + generate_collation_name(iexpr->infercollid)); /* Add the operator class name, if not default */ if (iexpr->inferopclass) @@ -9792,7 +9792,7 @@ get_const_expr(Const *constval, deparse_context *context, int showtype) else { appendStringInfo(buf, "'%s'", extval); - needlabel = true; /* we must attach a cast */ + needlabel = true; /* we must attach a cast */ } break; @@ -9811,7 +9811,7 @@ get_const_expr(Const *constval, deparse_context *context, int showtype) else { appendStringInfo(buf, "'%s'", extval); - needlabel = true; /* we must attach a cast */ + needlabel = true; /* we must attach a cast */ } break; @@ -9973,8 +9973,8 @@ get_sublink_expr(SubLink *sublink, deparse_context *context) get_rule_expr(linitial(opexpr->args), context, true); if (!opname) opname = generate_operator_name(opexpr->opno, - exprType(linitial(opexpr->args)), - exprType(lsecond(opexpr->args))); + exprType(linitial(opexpr->args)), + exprType(lsecond(opexpr->args))); sep = ", "; } appendStringInfoChar(buf, ')'); @@ -9988,7 +9988,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context) get_rule_expr((Node *) rcexpr->largs, context, true); opname = generate_operator_name(linitial_oid(rcexpr->opnos), exprType(linitial(rcexpr->largs)), - exprType(linitial(rcexpr->rargs))); + exprType(linitial(rcexpr->rargs))); appendStringInfoChar(buf, ')'); } else @@ -10005,7 +10005,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context) break; case ANY_SUBLINK: - if (strcmp(opname, "=") == 0) /* Represent = ANY as IN */ + if (strcmp(opname, "=") == 0) /* Represent = ANY as IN */ appendStringInfoString(buf, " IN "); else appendStringInfo(buf, " %s ANY ", opname); @@ -10809,7 +10809,7 @@ processIndirection(Node *node, deparse_context *context) */ Assert(list_length(fstore->fieldnums) == 1); fieldname = get_relid_attribute_name(typrelid, - linitial_int(fstore->fieldnums)); + linitial_int(fstore->fieldnums)); appendStringInfo(buf, ".%s", quote_identifier(fieldname)); /* diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 2967f179ad..f4a3ae3e89 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -171,7 +171,7 @@ static double eqjoinsel_semi(Oid operator, VariableStatData *vardata1, VariableStatData *vardata2, RelOptInfo *inner_rel); static bool estimate_multivariate_ndistinct(PlannerInfo *root, - RelOptInfo *rel, List **varinfos, double *ndistinct); + RelOptInfo *rel, List **varinfos, double *ndistinct); static bool convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue, Datum lobound, Datum hibound, Oid boundstypid, double *scaledlobound, double *scaledhibound); @@ -334,7 +334,7 @@ var_eq_const(VariableStatData *vardata, Oid operator, } else if (HeapTupleIsValid(vardata->statsTuple) && statistic_proc_security_check(vardata, - (opfuncoid = get_opcode(operator)))) + (opfuncoid = get_opcode(operator)))) { AttStatsSlot sslot; bool match = false; @@ -360,12 +360,12 @@ var_eq_const(VariableStatData *vardata, Oid operator, /* be careful to apply operator right way 'round */ if (varonleft) match = DatumGetBool(FunctionCall2Coll(&eqproc, - DEFAULT_COLLATION_OID, + DEFAULT_COLLATION_OID, sslot.values[i], constval)); else match = DatumGetBool(FunctionCall2Coll(&eqproc, - DEFAULT_COLLATION_OID, + DEFAULT_COLLATION_OID, constval, sslot.values[i])); if (match) @@ -811,7 +811,7 @@ ineq_histogram_selectivity(PlannerInfo *root, */ double histfrac; int lobound = 0; /* first possible slot to search */ - int hibound = sslot.nvalues; /* last+1 slot to search */ + int hibound = sslot.nvalues; /* last+1 slot to search */ bool have_end = false; /* @@ -848,7 +848,7 @@ ineq_histogram_selectivity(PlannerInfo *root, vardata, sslot.staop, NULL, - &sslot.values[probe]); + &sslot.values[probe]); ltcmp = DatumGetBool(FunctionCall2Coll(opproc, DEFAULT_COLLATION_OID, @@ -1268,7 +1268,7 @@ patternsel(PG_FUNCTION_ARGS, Pattern_Type ptype, bool negate) break; case BYTEAOID: prefixstr = DatumGetCString(DirectFunctionCall1(byteaout, - prefix->constvalue)); + prefix->constvalue)); break; default: elog(ERROR, "unrecognized consttype: %u", @@ -1805,7 +1805,7 @@ scalararraysel(PlannerInfo *root, /* get nominal (after relabeling) element type of rightop */ nominal_element_type = get_base_element_type(exprType(rightop)); if (!OidIsValid(nominal_element_type)) - return (Selectivity) 0.5; /* probably shouldn't happen */ + return (Selectivity) 0.5; /* probably shouldn't happen */ /* get nominal collation, too, for generating constants */ nominal_element_collation = exprCollation(rightop); @@ -1933,17 +1933,17 @@ scalararraysel(PlannerInfo *root, s2 = DatumGetFloat8(FunctionCall5Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(operator), PointerGetDatum(args), Int16GetDatum(jointype), - PointerGetDatum(sjinfo))); + PointerGetDatum(sjinfo))); else s2 = DatumGetFloat8(FunctionCall4Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(operator), PointerGetDatum(args), - Int32GetDatum(varRelid))); + Int32GetDatum(varRelid))); if (useOr) { @@ -2000,17 +2000,17 @@ scalararraysel(PlannerInfo *root, s2 = DatumGetFloat8(FunctionCall5Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(operator), PointerGetDatum(args), Int16GetDatum(jointype), - PointerGetDatum(sjinfo))); + PointerGetDatum(sjinfo))); else s2 = DatumGetFloat8(FunctionCall4Coll(&oprselproc, clause->inputcollid, PointerGetDatum(root), - ObjectIdGetDatum(operator), + ObjectIdGetDatum(operator), PointerGetDatum(args), - Int32GetDatum(varRelid))); + Int32GetDatum(varRelid))); if (useOr) { @@ -2295,7 +2295,7 @@ eqjoinsel_inner(Oid operator, if (statistic_proc_security_check(vardata1, opfuncoid)) have_mcvs1 = get_attstatsslot(&sslot1, vardata1->statsTuple, STATISTIC_KIND_MCV, InvalidOid, - ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); + ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); } if (HeapTupleIsValid(vardata2->statsTuple)) @@ -2305,7 +2305,7 @@ eqjoinsel_inner(Oid operator, if (statistic_proc_security_check(vardata2, opfuncoid)) have_mcvs2 = get_attstatsslot(&sslot2, vardata2->statsTuple, STATISTIC_KIND_MCV, InvalidOid, - ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); + ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); } if (have_mcvs1 && have_mcvs2) @@ -2545,7 +2545,7 @@ eqjoinsel_semi(Oid operator, if (statistic_proc_security_check(vardata1, opfuncoid)) have_mcvs1 = get_attstatsslot(&sslot1, vardata1->statsTuple, STATISTIC_KIND_MCV, InvalidOid, - ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); + ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS); } if (HeapTupleIsValid(vardata2->statsTuple) && @@ -4205,7 +4205,7 @@ convert_string_datum(Datum value, Oid typid) { char *xfrmstr; size_t xfrmlen; - size_t xfrmlen2 PG_USED_FOR_ASSERTS_ONLY; + size_t xfrmlen2 PG_USED_FOR_ASSERTS_ONLY; /* * XXX: We could guess at a suitable output buffer size and only call @@ -4220,8 +4220,8 @@ convert_string_datum(Datum value, Oid typid) /* * - * http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx? - * FeedbackID=99694 */ + * http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694 + */ { char x[1]; @@ -4509,10 +4509,10 @@ get_join_variables(PlannerInfo *root, List *args, SpecialJoinInfo *sjinfo, if (vardata1->rel && bms_is_subset(vardata1->rel->relids, sjinfo->syn_righthand)) - *join_is_reversed = true; /* var1 is on RHS */ + *join_is_reversed = true; /* var1 is on RHS */ else if (vardata2->rel && bms_is_subset(vardata2->rel->relids, sjinfo->syn_lefthand)) - *join_is_reversed = true; /* var2 is on LHS */ + *join_is_reversed = true; /* var2 is on LHS */ else *join_is_reversed = false; } @@ -4611,7 +4611,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid, if (varRelid == 0 || bms_is_member(varRelid, varnos)) { onerel = find_base_rel(root, - (varRelid ? varRelid : bms_singleton_member(varnos))); + (varRelid ? varRelid : bms_singleton_member(varnos))); vardata->rel = onerel; node = basenode; /* strip any relabeling */ } @@ -4713,7 +4713,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid, { vardata->statsTuple = SearchSysCache3(STATRELATTINH, - ObjectIdGetDatum(index->indexoid), + ObjectIdGetDatum(index->indexoid), Int16GetDatum(pos + 1), BoolGetDatum(false)); vardata->freefunc = ReleaseSysCache; @@ -4734,7 +4734,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid, */ vardata->acl_ok = (pg_class_aclcheck(rte->relid, GetUserId(), - ACL_SELECT) == ACLCHECK_OK); + ACL_SELECT) == ACLCHECK_OK); } else { @@ -5335,7 +5335,7 @@ get_actual_variable_range(PlannerInfo *root, VariableStatData *vardata, ScanKeyEntryInitialize(&scankeys[0], SK_ISNULL | SK_SEARCHNOTNULL, 1, /* index col to scan */ - InvalidStrategy, /* no strategy */ + InvalidStrategy, /* no strategy */ InvalidOid, /* no strategy subtype */ InvalidOid, /* no collation */ InvalidOid, /* no reg proc for this */ @@ -5549,7 +5549,7 @@ like_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation, if (typeid == BYTEAOID) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("case insensitive matching not supported on type bytea"))); + errmsg("case insensitive matching not supported on type bytea"))); /* If case-insensitive, we need locale info */ if (lc_ctype_is_c(collation)) @@ -5605,7 +5605,7 @@ like_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation, /* Stop if case-varying character (it's sort of a wildcard) */ if (case_insensitive && - pattern_char_isalpha(patt[pos], is_multibyte, locale, locale_is_c)) + pattern_char_isalpha(patt[pos], is_multibyte, locale, locale_is_c)) break; match[match_pos++] = patt[pos]; @@ -5651,7 +5651,7 @@ regex_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation, if (typeid == BYTEAOID) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("regular-expression matching not supported on type bytea"))); + errmsg("regular-expression matching not supported on type bytea"))); /* Use the regexp machinery to extract the prefix, if any */ prefix = regexp_fixed_prefix(DatumGetTextPP(patt_const->constvalue), @@ -5729,7 +5729,7 @@ pattern_fixed_prefix(Const *patt, Pattern_Type ptype, Oid collation, break; default: elog(ERROR, "unrecognized ptype: %d", (int) ptype); - result = Pattern_Prefix_None; /* keep compiler quiet */ + result = Pattern_Prefix_None; /* keep compiler quiet */ break; } return result; @@ -5935,8 +5935,7 @@ regex_selectivity_sub(const char *patt, int pattlen, bool case_insensitive) negclass = true; pos++; } - if (patt[pos] == ']') /* ']' at start of class is not - * special */ + if (patt[pos] == ']') /* ']' at start of class is not special */ pos++; while (pos < pattlen && patt[pos] != ']') pos++; @@ -6434,7 +6433,7 @@ orderby_operands_eval_cost(PlannerInfo *root, IndexPath *path) { elog(ERROR, "unsupported indexorderby type: %d", (int) nodeTag(clause)); - other_operand = NULL; /* keep compiler quiet */ + other_operand = NULL; /* keep compiler quiet */ } cost_qual_eval_node(&index_qual_cost, other_operand, root); @@ -7832,7 +7831,7 @@ brincostestimate(PlannerInfo *root, IndexPath *path, double loop_count, */ if (HeapTupleIsValid(vardata.statsTuple) && !vardata.freefunc) elog(ERROR, - "no function provided to release variable stats with"); + "no function provided to release variable stats with"); } else { @@ -7855,7 +7854,7 @@ brincostestimate(PlannerInfo *root, IndexPath *path, double loop_count, attnum = qinfo->indexcol + 1; if (get_index_stats_hook && - (*get_index_stats_hook) (root, index->indexoid, attnum, &vardata)) + (*get_index_stats_hook) (root, index->indexoid, attnum, &vardata)) { /* * The hook took control of acquiring a stats tuple. If it @@ -7868,7 +7867,7 @@ brincostestimate(PlannerInfo *root, IndexPath *path, double loop_count, else { vardata.statsTuple = SearchSysCache3(STATRELATTINH, - ObjectIdGetDatum(index->indexoid), + ObjectIdGetDatum(index->indexoid), Int16GetDatum(attnum), BoolGetDatum(false)); vardata.freefunc = ReleaseSysCache; diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 994bbdee1c..87521428c1 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -114,9 +114,9 @@ anytimestamp_typmod_check(bool istz, int32 typmod) { ereport(WARNING, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("TIMESTAMP(%d)%s precision reduced to maximum allowed, %d", - typmod, (istz ? " WITH TIME ZONE" : ""), - MAX_TIMESTAMP_PRECISION))); + errmsg("TIMESTAMP(%d)%s precision reduced to maximum allowed, %d", + typmod, (istz ? " WITH TIME ZONE" : ""), + MAX_TIMESTAMP_PRECISION))); typmod = MAX_TIMESTAMP_PRECISION; } @@ -195,7 +195,7 @@ timestamp_in(PG_FUNCTION_ARGS) case DTK_INVALID: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("date/time value \"%s\" is no longer supported", str))); + errmsg("date/time value \"%s\" is no longer supported", str))); TIMESTAMP_NOEND(result); break; @@ -363,8 +363,8 @@ AdjustTimestampForTypmod(Timestamp *time, int32 typmod) if (typmod < 0 || typmod > MAX_TIMESTAMP_PRECISION) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("timestamp(%d) precision must be between %d and %d", - typmod, 0, MAX_TIMESTAMP_PRECISION))); + errmsg("timestamp(%d) precision must be between %d and %d", + typmod, 0, MAX_TIMESTAMP_PRECISION))); if (*time >= INT64CONST(0)) { @@ -435,7 +435,7 @@ timestamptz_in(PG_FUNCTION_ARGS) case DTK_INVALID: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("date/time value \"%s\" is no longer supported", str))); + errmsg("date/time value \"%s\" is no longer supported", str))); TIMESTAMP_NOEND(result); break; @@ -459,7 +459,7 @@ timestamptz_in(PG_FUNCTION_ARGS) * don't care, so we don't bother being consistent. */ static int -parse_sane_timezone(struct pg_tm * tm, text *zone) +parse_sane_timezone(struct pg_tm *tm, text *zone) { char tzname[TZ_STRLEN_MAX + 1]; int rt; @@ -500,7 +500,7 @@ parse_sane_timezone(struct pg_tm * tm, text *zone) if (rt == DTERR_TZDISP_OVERFLOW) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("numeric time zone \"%s\" out of range", tzname))); + errmsg("numeric time zone \"%s\" out of range", tzname))); else if (rt != DTERR_BAD_FORMAT) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), @@ -942,7 +942,7 @@ interval_in(PG_FUNCTION_ARGS) case DTK_INVALID: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("date/time value \"%s\" is no longer supported", str))); + errmsg("date/time value \"%s\" is no longer supported", str))); break; default: @@ -1091,8 +1091,8 @@ intervaltypmodin(PG_FUNCTION_ARGS) { ereport(WARNING, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("INTERVAL(%d) precision reduced to maximum allowed, %d", - tl[1], MAX_INTERVAL_PRECISION))); + errmsg("INTERVAL(%d) precision reduced to maximum allowed, %d", + tl[1], MAX_INTERVAL_PRECISION))); typmod = INTERVAL_TYPMOD(MAX_INTERVAL_PRECISION, tl[0]); } else @@ -1463,8 +1463,8 @@ AdjustIntervalForTypmod(Interval *interval, int32 typmod) if (precision < 0 || precision > MAX_INTERVAL_PRECISION) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("interval(%d) precision must be between %d and %d", - precision, 0, MAX_INTERVAL_PRECISION))); + errmsg("interval(%d) precision must be between %d and %d", + precision, 0, MAX_INTERVAL_PRECISION))); if (interval->time >= INT64CONST(0)) { @@ -1530,7 +1530,7 @@ EncodeSpecialTimestamp(Timestamp dt, char *str) strcpy(str, EARLY); else if (TIMESTAMP_IS_NOEND(dt)) strcpy(str, LATE); - else /* shouldn't happen */ + else /* shouldn't happen */ elog(ERROR, "invalid argument for EncodeSpecialTimestamp"); } @@ -1698,7 +1698,7 @@ timestamptz_to_time_t(TimestampTz t) pg_time_t result; result = (pg_time_t) (t / USECS_PER_SEC + - ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY)); + ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY)); return result; } @@ -1744,7 +1744,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec) time -= (*min) * USECS_PER_MINUTE; *sec = time / USECS_PER_SEC; *fsec = time - (*sec * USECS_PER_SEC); -} /* dt2time() */ +} /* dt2time() */ /* @@ -1759,7 +1759,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec) * If attimezone is NULL, the global timezone setting will be used. */ int -timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone) +timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone) { Timestamp date; Timestamp time; @@ -1855,7 +1855,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, const char * Returns -1 on failure (value out of range). */ int -tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result) +tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result) { TimeOffset date; TimeOffset time; @@ -1903,7 +1903,7 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result) * Convert an interval data type to a tm structure. */ int -interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec) +interval2tm(Interval span, struct pg_tm *tm, fsec_t *fsec) { TimeOffset time; TimeOffset tfrac; @@ -1931,7 +1931,7 @@ interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec) } int -tm2interval(struct pg_tm * tm, fsec_t fsec, Interval *span) +tm2interval(struct pg_tm *tm, fsec_t fsec, Interval *span) { double total_months = (double) tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon; @@ -1985,7 +1985,7 @@ interval_finite(PG_FUNCTION_ARGS) *---------------------------------------------------------*/ void -GetEpochTime(struct pg_tm * tm) +GetEpochTime(struct pg_tm *tm) { struct pg_tm *t0; pg_time_t epoch = 0; @@ -2015,7 +2015,7 @@ SetEpochTimestamp(void) tm2timestamp(tm, 0, NULL, &dt); return dt; -} /* SetEpochTimestamp() */ +} /* SetEpochTimestamp() */ /* * We are currently sharing some code between timestamp and timestamptz. @@ -2629,7 +2629,7 @@ timestamp_mi(PG_FUNCTION_ARGS) *---------- */ result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours, - IntervalPGetDatum(result))); + IntervalPGetDatum(result))); PG_RETURN_INTERVAL_P(result); } @@ -3165,7 +3165,7 @@ interval_mul(PG_FUNCTION_ARGS) month_remainder_days = (orig_month * factor - result->month) * DAYS_PER_MONTH; month_remainder_days = TSROUND(month_remainder_days); sec_remainder = (orig_day * factor - result->day + - month_remainder_days - (int) month_remainder_days) * SECS_PER_DAY; + month_remainder_days - (int) month_remainder_days) * SECS_PER_DAY; sec_remainder = TSROUND(sec_remainder); /* @@ -3228,7 +3228,7 @@ interval_div(PG_FUNCTION_ARGS) month_remainder_days = (orig_month / factor - result->month) * DAYS_PER_MONTH; month_remainder_days = TSROUND(month_remainder_days); sec_remainder = (orig_day / factor - result->day + - month_remainder_days - (int) month_remainder_days) * SECS_PER_DAY; + month_remainder_days - (int) month_remainder_days) * SECS_PER_DAY; sec_remainder = TSROUND(sec_remainder); if (Abs(sec_remainder) >= SECS_PER_DAY) { @@ -3279,7 +3279,7 @@ interval_accum(PG_FUNCTION_ARGS) newsum = DatumGetIntervalP(DirectFunctionCall2(interval_pl, IntervalPGetDatum(&sumX), - IntervalPGetDatum(newval))); + IntervalPGetDatum(newval))); N.time += 1; transdatums[0] = IntervalPGetDatum(newsum); @@ -3363,7 +3363,7 @@ interval_accum_inv(PG_FUNCTION_ARGS) newsum = DatumGetIntervalP(DirectFunctionCall2(interval_mi, IntervalPGetDatum(&sumX), - IntervalPGetDatum(newval))); + IntervalPGetDatum(newval))); N.time -= 1; transdatums[0] = IntervalPGetDatum(newsum); @@ -3918,8 +3918,8 @@ timestamptz_trunc(PG_FUNCTION_ARGS) { ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("timestamp with time zone units \"%s\" not recognized", - lowunits))); + errmsg("timestamp with time zone units \"%s\" not recognized", + lowunits))); result = 0; } @@ -3992,7 +3992,7 @@ interval_trunc(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("interval units \"%s\" not supported " - "because months usually have fractional weeks", + "because months usually have fractional weeks", lowunits))); else ereport(ERROR, @@ -4213,8 +4213,8 @@ NonFiniteTimestampTzPart(int type, int unit, char *lowunits, if (isTz) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("timestamp with time zone units \"%s\" not recognized", - lowunits))); + errmsg("timestamp with time zone units \"%s\" not recognized", + lowunits))); else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), @@ -4259,8 +4259,8 @@ NonFiniteTimestampTzPart(int type, int unit, char *lowunits, if (isTz) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("timestamp with time zone units \"%s\" not supported", - lowunits))); + errmsg("timestamp with time zone units \"%s\" not supported", + lowunits))); else ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -4398,7 +4398,7 @@ timestamp_part(PG_FUNCTION_ARGS) case DTK_JULIAN: result = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday); result += ((((tm->tm_hour * MINS_PER_HOUR) + tm->tm_min) * SECS_PER_MINUTE) + - tm->tm_sec + (fsec / 1000000.0)) / (double) SECS_PER_DAY; + tm->tm_sec + (fsec / 1000000.0)) / (double) SECS_PER_DAY; break; case DTK_ISOYEAR: @@ -4602,7 +4602,7 @@ timestamptz_part(PG_FUNCTION_ARGS) case DTK_JULIAN: result = date2j(tm->tm_year, tm->tm_mon, tm->tm_mday); result += ((((tm->tm_hour * MINS_PER_HOUR) + tm->tm_min) * SECS_PER_MINUTE) + - tm->tm_sec + (fsec / 1000000.0)) / (double) SECS_PER_DAY; + tm->tm_sec + (fsec / 1000000.0)) / (double) SECS_PER_DAY; break; case DTK_ISOYEAR: @@ -4632,8 +4632,8 @@ timestamptz_part(PG_FUNCTION_ARGS) default: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("timestamp with time zone units \"%s\" not supported", - lowunits))); + errmsg("timestamp with time zone units \"%s\" not supported", + lowunits))); result = 0; } @@ -4654,8 +4654,8 @@ timestamptz_part(PG_FUNCTION_ARGS) default: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("timestamp with time zone units \"%s\" not supported", - lowunits))); + errmsg("timestamp with time zone units \"%s\" not supported", + lowunits))); result = 0; } } @@ -4663,8 +4663,8 @@ timestamptz_part(PG_FUNCTION_ARGS) { ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("timestamp with time zone units \"%s\" not recognized", - lowunits))); + errmsg("timestamp with time zone units \"%s\" not recognized", + lowunits))); result = 0; } @@ -4923,9 +4923,9 @@ timestamp_izone(PG_FUNCTION_ARGS) if (zone->month != 0 || zone->day != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("interval time zone \"%s\" must not include months or days", - DatumGetCString(DirectFunctionCall1(interval_out, - PointerGetDatum(zone)))))); + errmsg("interval time zone \"%s\" must not include months or days", + DatumGetCString(DirectFunctionCall1(interval_out, + PointerGetDatum(zone)))))); tz = zone->time / USECS_PER_SEC; @@ -4937,7 +4937,7 @@ timestamp_izone(PG_FUNCTION_ARGS) errmsg("timestamp out of range"))); PG_RETURN_TIMESTAMPTZ(result); -} /* timestamp_izone() */ +} /* timestamp_izone() */ /* timestamp_timestamptz() * Convert local timestamp to timestamp at GMT @@ -5120,9 +5120,9 @@ timestamptz_izone(PG_FUNCTION_ARGS) if (zone->month != 0 || zone->day != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("interval time zone \"%s\" must not include months or days", - DatumGetCString(DirectFunctionCall1(interval_out, - PointerGetDatum(zone)))))); + errmsg("interval time zone \"%s\" must not include months or days", + DatumGetCString(DirectFunctionCall1(interval_out, + PointerGetDatum(zone)))))); tz = -(zone->time / USECS_PER_SEC); @@ -5203,9 +5203,9 @@ generate_series_timestamp(PG_FUNCTION_ARGS) { /* increment current in preparation for next iteration */ fctx->current = DatumGetTimestamp( - DirectFunctionCall2(timestamp_pl_interval, - TimestampGetDatum(fctx->current), - PointerGetDatum(&fctx->step))); + DirectFunctionCall2(timestamp_pl_interval, + TimestampGetDatum(fctx->current), + PointerGetDatum(&fctx->step))); /* do when there is more left to send */ SRF_RETURN_NEXT(funcctx, TimestampGetDatum(result)); @@ -5284,9 +5284,9 @@ generate_series_timestamptz(PG_FUNCTION_ARGS) { /* increment current in preparation for next iteration */ fctx->current = DatumGetTimestampTz( - DirectFunctionCall2(timestamptz_pl_interval, - TimestampTzGetDatum(fctx->current), - PointerGetDatum(&fctx->step))); + DirectFunctionCall2(timestamptz_pl_interval, + TimestampTzGetDatum(fctx->current), + PointerGetDatum(&fctx->step))); /* do when there is more left to send */ SRF_RETURN_NEXT(funcctx, TimestampTzGetDatum(result)); diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index 3e2fc6e9df..fdb041971e 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -113,7 +113,7 @@ get_modifiers(char *buf, int16 *weight, bool *prefix) * Parse phrase operator. The operator * may take the following forms: * - * a <X> b (distance is no greater than X) + * a <N> b (distance is exactly N lexemes) * a <-> b (default distance = 1) * * The buffer should begin with '<' char @@ -129,10 +129,9 @@ parse_phrase_operator(char *buf, int16 *distance) PHRASE_ERR, PHRASE_FINISH } state = PHRASE_OPEN; - char *ptr = buf; char *endptr; - long l = 1; + long l = 1; /* default distance */ while (*ptr) { @@ -151,16 +150,17 @@ parse_phrase_operator(char *buf, int16 *distance) ptr++; break; } - else if (!t_isdigit(ptr)) + if (!t_isdigit(ptr)) { state = PHRASE_ERR; break; } + errno = 0; l = strtol(ptr, &endptr, 10); if (ptr == endptr) state = PHRASE_ERR; - else if (errno == ERANGE || l > MAXENTRYPOS) + else if (errno == ERANGE || l < 0 || l > MAXENTRYPOS) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("distance in phrase operator should not be greater than %d", @@ -234,8 +234,8 @@ gettoken_query(TSQueryParserState state, case WAITOPERAND: if (t_iseq(state->buf, '!')) { - (state->buf)++; /* can safely ++, t_iseq guarantee - * that pg_mblen()==1 */ + (state->buf)++; /* can safely ++, t_iseq guarantee that + * pg_mblen()==1 */ *operator = OP_NOT; state->state = WAITOPERAND; return PT_OPR; @@ -458,7 +458,7 @@ cleanOpStack(TSQueryParserState state, { /* NOT is right associative unlike to others */ if ((op != OP_NOT && opPriority > OP_PRIORITY(stack[*lenstack - 1].op)) || - (op == OP_NOT && opPriority >= OP_PRIORITY(stack[*lenstack - 1].op))) + (op == OP_NOT && opPriority >= OP_PRIORITY(stack[*lenstack - 1].op))) break; (*lenstack)--; @@ -542,7 +542,7 @@ findoprnd_recurse(QueryItem *ptr, uint32 *pos, int nnodes, bool *needcleanup) if (ptr[*pos].qoperator.oper == OP_NOT) { - ptr[*pos].qoperator.left = 1; /* fixed offset */ + ptr[*pos].qoperator.left = 1; /* fixed offset */ (*pos)++; /* process the only argument */ @@ -551,7 +551,7 @@ findoprnd_recurse(QueryItem *ptr, uint32 *pos, int nnodes, bool *needcleanup) else { QueryOperator *curitem = &ptr[*pos].qoperator; - int tmp = *pos; /* save current position */ + int tmp = *pos; /* save current position */ Assert(curitem->oper == OP_AND || curitem->oper == OP_OR || @@ -1015,7 +1015,8 @@ tsqueryrecv(PG_FUNCTION_ARGS) if (item->type == QI_VAL) { - size_t val_len; /* length after recoding to server encoding */ + size_t val_len; /* length after recoding to server + * encoding */ uint8 weight; uint8 prefix; const char *val; @@ -1055,7 +1056,7 @@ tsqueryrecv(PG_FUNCTION_ARGS) */ operands[i] = val; - datalen += val_len + 1; /* + 1 for the '\0' terminator */ + datalen += val_len + 1; /* + 1 for the '\0' terminator */ } else if (item->type == QI_OPR) { diff --git a/src/backend/utils/adt/tsrank.c b/src/backend/utils/adt/tsrank.c index 76e5e541b6..4577bcc0b8 100644 --- a/src/backend/utils/adt/tsrank.c +++ b/src/backend/utils/adt/tsrank.c @@ -908,9 +908,9 @@ calc_rank_cd(const float4 *arrdata, TSVector txt, TSQuery query, int method) Wdoc += Cpos / ((double) (1 + nNoise)); CurExtPos = ((double) (ext.q + ext.p)) / 2.0; - if (NExtent > 0 && CurExtPos > PrevExtPos /* prevent division by - * zero in a case of - multiple lexize */ ) + if (NExtent > 0 && CurExtPos > PrevExtPos /* prevent division by + * zero in a case of + * multiple lexize */ ) SumDist += 1.0 / (CurExtPos - PrevExtPos); PrevExtPos = CurExtPos; diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index c694637c8f..2d7407c29c 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -411,7 +411,7 @@ tsvector_bsearch(const TSVector tsv, char *lexeme, int lexeme_len) StopHigh = StopMiddle; else if (cmp > 0) StopLow = StopMiddle + 1; - else /* found it */ + else /* found it */ return StopMiddle; } @@ -674,7 +674,7 @@ tsvector_unnest(PG_FUNCTION_ARGS) Datum values[3]; values[0] = PointerGetDatum( - cstring_to_text_with_len(data + arrin[i].pos, arrin[i].len) + cstring_to_text_with_len(data + arrin[i].pos, arrin[i].len) ); if (arrin[i].haspos) @@ -697,14 +697,14 @@ tsvector_unnest(PG_FUNCTION_ARGS) positions[j] = Int16GetDatum(WEP_GETPOS(posv->pos[j])); weight = 'D' - WEP_GETWEIGHT(posv->pos[j]); weights[j] = PointerGetDatum( - cstring_to_text_with_len(&weight, 1) + cstring_to_text_with_len(&weight, 1) ); } values[1] = PointerGetDatum( - construct_array(positions, posv->npos, INT2OID, 2, true, 's')); + construct_array(positions, posv->npos, INT2OID, 2, true, 's')); values[2] = PointerGetDatum( - construct_array(weights, posv->npos, TEXTOID, -1, false, 'i')); + construct_array(weights, posv->npos, TEXTOID, -1, false, 'i')); } else { @@ -738,7 +738,7 @@ tsvector_to_array(PG_FUNCTION_ARGS) for (i = 0; i < tsin->size; i++) { elements[i] = PointerGetDatum( - cstring_to_text_with_len(STRPTR(tsin) + arrin[i].pos, arrin[i].len) + cstring_to_text_with_len(STRPTR(tsin) + arrin[i].pos, arrin[i].len) ); } @@ -1058,7 +1058,7 @@ tsvector_concat(PG_FUNCTION_ARGS) if (ptr2->haspos) dataoff += add_pos(in2, ptr2, out, ptr, maxpos) * sizeof(WordEntryPos); } - else /* must have ptr2->haspos */ + else /* must have ptr2->haspos */ { int addlen = add_pos(in2, ptr2, out, ptr, maxpos); @@ -1255,7 +1255,7 @@ checkclass_str(CHKVAL *chkval, WordEntry *entry, QueryOperand *val, posvec_iter++; } } - else /* data != NULL */ + else /* data != NULL */ { data->npos = posvec->npos; data->pos = posvec->pos; @@ -1489,7 +1489,7 @@ TS_phrase_output(ExecPhraseData *data, Lindex++; Rindex++; } - else /* Lpos > Rpos */ + else /* Lpos > Rpos */ { /* Rpos is not matched in Ldata, should we output it? */ if (emit & TSPO_R_ONLY) @@ -2466,7 +2466,7 @@ tsvector_update_trigger(PG_FUNCTION_ARGS, bool config_column) Oid cfgId; /* Check call context */ - if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */ + if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */ elog(ERROR, "tsvector_update_trigger: not fired by trigger manager"); trigdata = (TriggerData *) fcinfo->context; diff --git a/src/backend/utils/adt/tsvector_parser.c b/src/backend/utils/adt/tsvector_parser.c index 2680114f7c..060d073fb7 100644 --- a/src/backend/utils/adt/tsvector_parser.c +++ b/src/backend/utils/adt/tsvector_parser.c @@ -363,7 +363,7 @@ gettoken_tsvector(TSVectorParseState state, else if (!t_isdigit(state->prsbuf)) PRSSYNTAXERROR; } - else /* internal error */ + else /* internal error */ elog(ERROR, "unrecognized state in gettoken_tsvector: %d", statecode); diff --git a/src/backend/utils/adt/uuid.c b/src/backend/utils/adt/uuid.c index eaf2f8064d..5f15c8e619 100644 --- a/src/backend/utils/adt/uuid.c +++ b/src/backend/utils/adt/uuid.c @@ -340,7 +340,7 @@ uuid_abbrev_abort(int memtupcount, SortSupport ssup) if (trace_sort) elog(LOG, "uuid_abbrev: aborting abbreviation at cardinality %f" - " below threshold %f after " INT64_FORMAT " values (%d rows)", + " below threshold %f after " INT64_FORMAT " values (%d rows)", abbr_card, uss->input_count / 2000.0 + 0.5, uss->input_count, memtupcount); #endif diff --git a/src/backend/utils/adt/varbit.c b/src/backend/utils/adt/varbit.c index e947785d81..0cf1c6f6d6 100644 --- a/src/backend/utils/adt/varbit.c +++ b/src/backend/utils/adt/varbit.c @@ -161,8 +161,8 @@ bit_in(PG_FUNCTION_ARGS) if (slen > VARBITMAXLEN / 4) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("bit string length exceeds the maximum allowed (%d)", - VARBITMAXLEN))); + errmsg("bit string length exceeds the maximum allowed (%d)", + VARBITMAXLEN))); bitlen = slen * 4; } @@ -473,8 +473,8 @@ varbit_in(PG_FUNCTION_ARGS) if (slen > VARBITMAXLEN / 4) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("bit string length exceeds the maximum allowed (%d)", - VARBITMAXLEN))); + errmsg("bit string length exceeds the maximum allowed (%d)", + VARBITMAXLEN))); bitlen = slen * 4; } @@ -1131,8 +1131,8 @@ bitoverlay(PG_FUNCTION_ARGS) { VarBit *t1 = PG_GETARG_VARBIT_P(0); VarBit *t2 = PG_GETARG_VARBIT_P(1); - int sp = PG_GETARG_INT32(2); /* substring start position */ - int sl = PG_GETARG_INT32(3); /* substring length */ + int sp = PG_GETARG_INT32(2); /* substring start position */ + int sl = PG_GETARG_INT32(3); /* substring length */ PG_RETURN_VARBIT_P(bit_overlay(t1, t2, sp, sl)); } @@ -1142,7 +1142,7 @@ bitoverlay_no_len(PG_FUNCTION_ARGS) { VarBit *t1 = PG_GETARG_VARBIT_P(0); VarBit *t2 = PG_GETARG_VARBIT_P(1); - int sp = PG_GETARG_INT32(2); /* substring start position */ + int sp = PG_GETARG_INT32(2); /* substring start position */ int sl; sl = VARBITLEN(t2); /* defaults to length(t2) */ diff --git a/src/backend/utils/adt/varchar.c b/src/backend/utils/adt/varchar.c index 6f2f9f6633..cbc62b00be 100644 --- a/src/backend/utils/adt/varchar.c +++ b/src/backend/utils/adt/varchar.c @@ -467,8 +467,8 @@ varchar_input(const char *s, size_t len, int32 atttypmod) if (s[j] != ' ') ereport(ERROR, (errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION), - errmsg("value too long for type character varying(%d)", - (int) maxlen))); + errmsg("value too long for type character varying(%d)", + (int) maxlen))); } len = mbmaxlen; @@ -620,8 +620,8 @@ varchar(PG_FUNCTION_ARGS) if (s_data[i] != ' ') ereport(ERROR, (errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION), - errmsg("value too long for type character varying(%d)", - maxlen))); + errmsg("value too long for type character varying(%d)", + maxlen))); } PG_RETURN_VARCHAR_P((VarChar *) cstring_to_text_with_len(s_data, diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index 30f44e8c4d..9707c0f3fd 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -221,7 +221,7 @@ text_to_cstring_buffer(const text *src, char *dst, size_t dst_len) dst_len--; if (dst_len >= src_len) dst_len = src_len; - else /* ensure truncation is encoding-safe */ + else /* ensure truncation is encoding-safe */ dst_len = pg_mbcliplen(VARDATA_ANY(srcunpacked), src_len, dst_len); memcpy(dst, VARDATA_ANY(srcunpacked), dst_len); dst[dst_len] = '\0'; @@ -268,7 +268,7 @@ byteain(PG_FUNCTION_ARGS) bc = (len - 2) / 2 + VARHDRSZ; /* maximum possible length */ result = palloc(bc); bc = hex_decode(inputText + 2, len - 2, VARDATA(result)); - SET_VARSIZE(result, bc + VARHDRSZ); /* actual length */ + SET_VARSIZE(result, bc + VARHDRSZ); /* actual length */ PG_RETURN_BYTEA_P(result); } @@ -828,8 +828,8 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified) { S1 = Max(S, 1); - if (length_not_specified) /* special case - get length to end of - * string */ + if (length_not_specified) /* special case - get length to end of + * string */ L1 = -1; else { @@ -893,8 +893,8 @@ text_substring(Datum str, int32 start, int32 length, bool length_not_specified) */ slice_start = 0; - if (length_not_specified) /* special case - get length to end of - * string */ + if (length_not_specified) /* special case - get length to end of + * string */ slice_size = L1 = -1; else { @@ -1017,8 +1017,8 @@ textoverlay(PG_FUNCTION_ARGS) { text *t1 = PG_GETARG_TEXT_PP(0); text *t2 = PG_GETARG_TEXT_PP(1); - int sp = PG_GETARG_INT32(2); /* substring start position */ - int sl = PG_GETARG_INT32(3); /* substring length */ + int sp = PG_GETARG_INT32(2); /* substring start position */ + int sl = PG_GETARG_INT32(3); /* substring length */ PG_RETURN_TEXT_P(text_overlay(t1, t2, sp, sl)); } @@ -1028,10 +1028,10 @@ textoverlay_no_len(PG_FUNCTION_ARGS) { text *t1 = PG_GETARG_TEXT_PP(0); text *t2 = PG_GETARG_TEXT_PP(1); - int sp = PG_GETARG_INT32(2); /* substring start position */ + int sp = PG_GETARG_INT32(2); /* substring start position */ int sl; - sl = text_length(PointerGetDatum(t2)); /* defaults to length(t2) */ + sl = text_length(PointerGetDatum(t2)); /* defaults to length(t2) */ PG_RETURN_TEXT_P(text_overlay(t1, t2, sp, sl)); } @@ -1438,7 +1438,8 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid) #ifdef WIN32 /* Win32 does not have UTF-8, so we need to map to UTF-16 */ - if (GetDatabaseEncoding() == PG_UTF8) + if (GetDatabaseEncoding() == PG_UTF8 + && (!mylocale || mylocale->provider == COLLPROVIDER_LIBC)) { int a1len; int a2len; @@ -1524,7 +1525,7 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid) return result; } -#endif /* WIN32 */ +#endif /* WIN32 */ if (len1 >= TEXTBUFLEN) a1p = (char *) palloc(len1 + 1); @@ -1573,11 +1574,14 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid) result = ucol_strcoll(mylocale->info.icu.ucol, uchar1, ulen1, uchar2, ulen2); + + pfree(uchar1); + pfree(uchar2); } #else /* not USE_ICU */ /* shouldn't happen */ elog(ERROR, "unsupported collprovider: %c", mylocale->provider); -#endif /* not USE_ICU */ +#endif /* not USE_ICU */ } else { @@ -2143,7 +2147,7 @@ varstrfastcmp_locale(Datum x, Datum y, SortSupport ssup) &status); if (U_FAILURE(status)) ereport(ERROR, - (errmsg("collation failed: %s", u_errorName(status)))); + (errmsg("collation failed: %s", u_errorName(status)))); } else #endif @@ -2159,11 +2163,14 @@ varstrfastcmp_locale(Datum x, Datum y, SortSupport ssup) result = ucol_strcoll(sss->locale->info.icu.ucol, uchar1, ulen1, uchar2, ulen2); + + pfree(uchar1); + pfree(uchar2); } #else /* not USE_ICU */ /* shouldn't happen */ elog(ERROR, "unsupported collprovider: %c", sss->locale->provider); -#endif /* not USE_ICU */ +#endif /* not USE_ICU */ } else { @@ -2283,7 +2290,7 @@ varstr_abbrev_convert(Datum original, SortSupport ssup) Size bsize; #ifdef USE_ICU int32_t ulen = -1; - UChar *uchar; + UChar *uchar = NULL; #endif /* @@ -2354,16 +2361,17 @@ varstr_abbrev_convert(Datum original, SortSupport ssup) &iter, state, (uint8_t *) sss->buf2, - Min(sizeof(Datum), sss->buflen2), + Min(sizeof(Datum), sss->buflen2), &status); if (U_FAILURE(status)) ereport(ERROR, - (errmsg("sort key generation failed: %s", u_errorName(status)))); + (errmsg("sort key generation failed: %s", + u_errorName(status)))); } else bsize = ucol_getSortKey(sss->locale->info.icu.ucol, uchar, ulen, - (uint8_t *) sss->buf2, sss->buflen2); + (uint8_t *) sss->buf2, sss->buflen2); } else #endif @@ -2398,6 +2406,11 @@ varstr_abbrev_convert(Datum original, SortSupport ssup) * okay. See remarks on bytea case above.) */ memcpy(pres, sss->buf2, Min(sizeof(Datum), bsize)); + +#ifdef USE_ICU + if (uchar) + pfree(uchar); +#endif } /* @@ -2903,8 +2916,8 @@ byteaoverlay(PG_FUNCTION_ARGS) { bytea *t1 = PG_GETARG_BYTEA_PP(0); bytea *t2 = PG_GETARG_BYTEA_PP(1); - int sp = PG_GETARG_INT32(2); /* substring start position */ - int sl = PG_GETARG_INT32(3); /* substring length */ + int sp = PG_GETARG_INT32(2); /* substring start position */ + int sl = PG_GETARG_INT32(3); /* substring length */ PG_RETURN_BYTEA_P(bytea_overlay(t1, t2, sp, sl)); } @@ -2914,7 +2927,7 @@ byteaoverlay_no_len(PG_FUNCTION_ARGS) { bytea *t1 = PG_GETARG_BYTEA_PP(0); bytea *t2 = PG_GETARG_BYTEA_PP(1); - int sp = PG_GETARG_INT32(2); /* substring start position */ + int sp = PG_GETARG_INT32(2); /* substring start position */ int sl; sl = VARSIZE_ANY_EXHDR(t2); /* defaults to length(t2) */ @@ -3277,7 +3290,7 @@ SplitIdentifierString(char *rawstring, char separator, { endp = strchr(nextp + 1, '"'); if (endp == NULL) - return false; /* mismatched quotes */ + return false; /* mismatched quotes */ if (endp[1] != '"') break; /* found end of quoted name */ /* Collapse adjacent quotes into one quote, and look again */ @@ -3351,7 +3364,9 @@ SplitIdentifierString(char *rawstring, char separator, /* - * SplitDirectoriesString --- parse a string containing directory names + * SplitDirectoriesString --- parse a string containing file/directory names + * + * This works fine on file names too; the function name is historical. * * This is similar to SplitIdentifierString, except that the parsing * rules are meant to handle pathnames instead of identifiers: there is @@ -3402,7 +3417,7 @@ SplitDirectoriesString(char *rawstring, char separator, { endp = strchr(nextp + 1, '"'); if (endp == NULL) - return false; /* mismatched quotes */ + return false; /* mismatched quotes */ if (endp[1] != '"') break; /* found end of quoted name */ /* Collapse adjacent quotes into one quote, and look again */ @@ -3934,7 +3949,7 @@ replace_text_regexp(text *src_text, void *regexp, data, data_len, search_start, - NULL, /* no details */ + NULL, /* no details */ REGEXP_REPLACE_BACKREF_CNT, pmatch, 0); @@ -4246,14 +4261,14 @@ text_to_array_internal(PG_FUNCTION_ARGS) /* XXX: this hardcodes assumptions about the text type */ PG_RETURN_ARRAYTYPE_P(construct_md_array(elems, nulls, 1, dims, lbs, - TEXTOID, -1, false, 'i')); + TEXTOID, -1, false, 'i')); } start_posn = 1; /* start_ptr points to the start_posn'th character of inputstring */ start_ptr = VARDATA_ANY(inputstring); - for (fldnum = 1;; fldnum++) /* field number is 1 based */ + for (fldnum = 1;; fldnum++) /* field number is 1 based */ { CHECK_FOR_INTERRUPTS(); @@ -4697,7 +4712,7 @@ string_agg_transfn(PG_FUNCTION_ARGS) else if (!PG_ARGISNULL(2)) appendStringInfoText(state, PG_GETARG_TEXT_PP(2)); /* delimiter */ - appendStringInfoText(state, PG_GETARG_TEXT_PP(1)); /* value */ + appendStringInfoText(state, PG_GETARG_TEXT_PP(1)); /* value */ } /* @@ -5323,7 +5338,7 @@ text_format_parse_format(const char *start_ptr, const char *end_ptr, if (*cp != '$') ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("width argument position must be ended by \"$\""))); + errmsg("width argument position must be ended by \"$\""))); /* The number was width argument position */ *widthpos = n; /* Explicit 0 for argument index is immediately refused */ @@ -5368,7 +5383,7 @@ text_format_string_conversion(StringInfo buf, char conversion, else if (conversion == 'I') ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("null values cannot be formatted as an SQL identifier"))); + errmsg("null values cannot be formatted as an SQL identifier"))); return; } diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index cdcd45419a..323614c183 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -65,7 +65,7 @@ #if LIBXML_VERSION >= 20704 #define HAVE_XMLSTRUCTUREDERRORCONTEXT 1 #endif -#endif /* USE_LIBXML */ +#endif /* USE_LIBXML */ #include "access/htup_details.h" #include "catalog/namespace.h" @@ -133,7 +133,7 @@ static void *xml_palloc(size_t size); static void *xml_repalloc(void *ptr, size_t size); static void xml_pfree(void *ptr); static char *xml_pstrdup(const char *string); -#endif /* USE_LIBXMLCONTEXT */ +#endif /* USE_LIBXMLCONTEXT */ static xmlChar *xml_text2xmlChar(text *in); static int parse_xml_decl(const xmlChar *str, size_t *lenp, @@ -147,7 +147,7 @@ static int xml_xpathobjtoxmlarray(xmlXPathObjectPtr xpathobj, ArrayBuildState *astate, PgXmlErrorContext *xmlerrcxt); static xmlChar *pg_xmlCharStrndup(char *str, size_t len); -#endif /* USE_LIBXML */ +#endif /* USE_LIBXML */ static void xmldata_root_element_start(StringInfo result, const char *eltname, const char *xmlschema, const char *targetns, @@ -157,7 +157,7 @@ static StringInfo query_to_xml_internal(const char *query, char *tablename, const char *xmlschema, bool nulls, bool tableforest, const char *targetns, bool top_level); static const char *map_sql_table_to_xmlschema(TupleDesc tupdesc, Oid relid, - bool nulls, bool tableforest, const char *targetns); + bool nulls, bool tableforest, const char *targetns); static const char *map_sql_schema_to_xmlschema_types(Oid nspid, List *relid_list, bool nulls, bool tableforest, const char *targetns); @@ -798,7 +798,7 @@ xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is_null) ereport(ERROR, (errcode(ERRCODE_INVALID_XML_PROCESSING_INSTRUCTION), errmsg("invalid XML processing instruction"), - errdetail("XML processing instruction cannot contain \"?>\"."))); + errdetail("XML processing instruction cannot contain \"?>\"."))); appendStringInfoChar(&buf, ' '); appendStringInfoString(&buf, string + strspn(string, " ")); @@ -924,7 +924,7 @@ xml_is_document(xmltype *arg) #else /* not USE_LIBXML */ NO_XML_SUPPORT(); return false; -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } @@ -1405,7 +1405,7 @@ xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace, volatile xmlParserCtxtPtr ctxt = NULL; volatile xmlDocPtr doc = NULL; - len = VARSIZE_ANY_EXHDR(data); /* will be useful later */ + len = VARSIZE_ANY_EXHDR(data); /* will be useful later */ string = xml_text2xmlChar(data); utf8string = pg_do_encoding_conversion(string, @@ -1439,7 +1439,7 @@ xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace, NULL, "UTF-8", XML_PARSE_NOENT | XML_PARSE_DTDATTR - | (preserve_whitespace ? 0 : XML_PARSE_NOBLANKS)); + | (preserve_whitespace ? 0 : XML_PARSE_NOBLANKS)); if (doc == NULL || xmlerrcxt->err_occurred) xml_ereport(xmlerrcxt, ERROR, ERRCODE_INVALID_XML_DOCUMENT, "invalid XML document"); @@ -1455,7 +1455,7 @@ xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace, &count, &version, NULL, &standalone); if (res_code != 0) xml_ereport_by_code(ERROR, ERRCODE_INVALID_XML_CONTENT, - "invalid XML content: invalid XML declaration", + "invalid XML content: invalid XML declaration", res_code); doc = xmlNewDoc(version); @@ -1467,7 +1467,7 @@ xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace, if (*(utf8string + count)) { res_code = xmlParseBalancedChunkMemory(doc, NULL, NULL, 0, - utf8string + count, NULL); + utf8string + count, NULL); if (res_code != 0 || xmlerrcxt->err_occurred) xml_ereport(xmlerrcxt, ERROR, ERRCODE_INVALID_XML_CONTENT, "invalid XML content"); @@ -1555,7 +1555,7 @@ xml_pstrdup(const char *string) { return MemoryContextStrdup(LibxmlContext, string); } -#endif /* USE_LIBXMLCONTEXT */ +#endif /* USE_LIBXMLCONTEXT */ /* @@ -1623,7 +1623,7 @@ xml_errorHandler(void *data, xmlErrorPtr error) xmlParserInputPtr input = (ctxt != NULL) ? ctxt->input : NULL; xmlNodePtr node = error->node; const xmlChar *name = (node != NULL && - node->type == XML_ELEMENT_NODE) ? node->name : NULL; + node->type == XML_ELEMENT_NODE) ? node->name : NULL; int domain = error->domain; int level = error->level; StringInfo errorBuf; @@ -1887,7 +1887,7 @@ is_valid_xml_namechar(pg_wchar c) || xmlIsCombiningQ(c) || xmlIsExtenderQ(c)); } -#endif /* USE_LIBXML */ +#endif /* USE_LIBXML */ /* @@ -1942,7 +1942,7 @@ map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, #else /* not USE_LIBXML */ NO_XML_SUPPORT(); return NULL; -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } @@ -2171,10 +2171,10 @@ map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings) if (xmlbinary == XMLBINARY_BASE64) xmlTextWriterWriteBase64(writer, VARDATA_ANY(bstr), - 0, VARSIZE_ANY_EXHDR(bstr)); + 0, VARSIZE_ANY_EXHDR(bstr)); else xmlTextWriterWriteBinHex(writer, VARDATA_ANY(bstr), - 0, VARSIZE_ANY_EXHDR(bstr)); + 0, VARSIZE_ANY_EXHDR(bstr)); /* we MUST do this now to flush data out to the buffer */ xmlFreeTextWriter(writer); @@ -2201,7 +2201,7 @@ map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings) return result; } -#endif /* USE_LIBXML */ +#endif /* USE_LIBXML */ } @@ -2385,8 +2385,8 @@ database_get_xml_visible_tables(void) CppAsString2(RELKIND_RELATION) "," CppAsString2(RELKIND_MATVIEW) "," CppAsString2(RELKIND_VIEW) ")" - " AND pg_catalog.has_table_privilege(pg_class.oid, 'SELECT')" - " AND relnamespace IN (" XML_VISIBLE_SCHEMAS ");"); + " AND pg_catalog.has_table_privilege(pg_class.oid, 'SELECT')" + " AND relnamespace IN (" XML_VISIBLE_SCHEMAS ");"); } @@ -2405,7 +2405,7 @@ table_to_xml_internal(Oid relid, initStringInfo(&query); appendStringInfo(&query, "SELECT * FROM %s", DatumGetCString(DirectFunctionCall1(regclassout, - ObjectIdGetDatum(relid)))); + ObjectIdGetDatum(relid)))); return query_to_xml_internal(query.data, get_rel_name(relid), xmlschema, nulls, tableforest, targetns, top_level); @@ -2421,8 +2421,8 @@ table_to_xml(PG_FUNCTION_ARGS) const char *targetns = text_to_cstring(PG_GETARG_TEXT_PP(3)); PG_RETURN_XML_P(stringinfo_to_xmltype(table_to_xml_internal(relid, NULL, - nulls, tableforest, - targetns, true))); + nulls, tableforest, + targetns, true))); } @@ -2435,8 +2435,8 @@ query_to_xml(PG_FUNCTION_ARGS) const char *targetns = text_to_cstring(PG_GETARG_TEXT_PP(3)); PG_RETURN_XML_P(stringinfo_to_xmltype(query_to_xml_internal(query, NULL, - NULL, nulls, tableforest, - targetns, true))); + NULL, nulls, tableforest, + targetns, true))); } @@ -2640,7 +2640,7 @@ cursor_to_xmlschema(PG_FUNCTION_ARGS) xmlschema = _SPI_strdup(map_sql_table_to_xmlschema(portal->tupDesc, InvalidOid, nulls, - tableforest, targetns)); + tableforest, targetns)); SPI_finish(); PG_RETURN_XML_P(cstring_to_xmltype(xmlschema)); @@ -2663,8 +2663,8 @@ table_to_xml_and_xmlschema(PG_FUNCTION_ARGS) heap_close(rel, NoLock); PG_RETURN_XML_P(stringinfo_to_xmltype(table_to_xml_internal(relid, - xmlschema, nulls, tableforest, - targetns, true))); + xmlschema, nulls, tableforest, + targetns, true))); } @@ -2689,13 +2689,13 @@ query_to_xml_and_xmlschema(PG_FUNCTION_ARGS) elog(ERROR, "SPI_cursor_open(\"%s\") failed", query); xmlschema = _SPI_strdup(map_sql_table_to_xmlschema(portal->tupDesc, - InvalidOid, nulls, tableforest, targetns)); + InvalidOid, nulls, tableforest, targetns)); SPI_cursor_close(portal); SPI_finish(); PG_RETURN_XML_P(stringinfo_to_xmltype(query_to_xml_internal(query, NULL, - xmlschema, nulls, tableforest, - targetns, true))); + xmlschema, nulls, tableforest, + targetns, true))); } @@ -2762,7 +2762,7 @@ schema_to_xml(PG_FUNCTION_ARGS) nspid = LookupExplicitNamespace(schemaname, false); PG_RETURN_XML_P(stringinfo_to_xmltype(schema_to_xml_internal(nspid, NULL, - nulls, tableforest, targetns, true))); + nulls, tableforest, targetns, true))); } @@ -2827,8 +2827,8 @@ schema_to_xmlschema_internal(const char *schemaname, bool nulls, map_sql_typecoll_to_xmlschema_types(tupdesc_list)); appendStringInfoString(result, - map_sql_schema_to_xmlschema_types(nspid, relid_list, - nulls, tableforest, targetns)); + map_sql_schema_to_xmlschema_types(nspid, relid_list, + nulls, tableforest, targetns)); xsd_schema_element_end(result); @@ -2847,7 +2847,7 @@ schema_to_xmlschema(PG_FUNCTION_ARGS) const char *targetns = text_to_cstring(PG_GETARG_TEXT_PP(3)); PG_RETURN_XML_P(stringinfo_to_xmltype(schema_to_xmlschema_internal(NameStr(*name), - nulls, tableforest, targetns))); + nulls, tableforest, targetns))); } @@ -2869,8 +2869,8 @@ schema_to_xml_and_xmlschema(PG_FUNCTION_ARGS) tableforest, targetns); PG_RETURN_XML_P(stringinfo_to_xmltype(schema_to_xml_internal(nspid, - xmlschema->data, nulls, - tableforest, targetns, true))); + xmlschema->data, nulls, + tableforest, targetns, true))); } @@ -2930,7 +2930,7 @@ database_to_xml(PG_FUNCTION_ARGS) const char *targetns = text_to_cstring(PG_GETARG_TEXT_PP(2)); PG_RETURN_XML_P(stringinfo_to_xmltype(database_to_xml_internal(NULL, nulls, - tableforest, targetns))); + tableforest, targetns))); } @@ -2985,7 +2985,7 @@ database_to_xmlschema(PG_FUNCTION_ARGS) const char *targetns = text_to_cstring(PG_GETARG_TEXT_PP(2)); PG_RETURN_XML_P(stringinfo_to_xmltype(database_to_xmlschema_internal(nulls, - tableforest, targetns))); + tableforest, targetns))); } @@ -3000,7 +3000,7 @@ database_to_xml_and_xmlschema(PG_FUNCTION_ARGS) xmlschema = database_to_xmlschema_internal(nulls, tableforest, targetns); PG_RETURN_XML_P(stringinfo_to_xmltype(database_to_xml_internal(xmlschema->data, - nulls, tableforest, targetns))); + nulls, tableforest, targetns))); } @@ -3065,14 +3065,14 @@ map_sql_table_to_xmlschema(TupleDesc tupdesc, Oid relid, bool nulls, true, false); tabletypename = map_multipart_sql_identifier_to_xml_name("TableType", - get_database_name(MyDatabaseId), - get_namespace_name(reltuple->relnamespace), - NameStr(reltuple->relname)); + get_database_name(MyDatabaseId), + get_namespace_name(reltuple->relnamespace), + NameStr(reltuple->relname)); rowtypename = map_multipart_sql_identifier_to_xml_name("RowType", - get_database_name(MyDatabaseId), - get_namespace_name(reltuple->relnamespace), - NameStr(reltuple->relname)); + get_database_name(MyDatabaseId), + get_namespace_name(reltuple->relnamespace), + NameStr(reltuple->relname)); ReleaseSysCache(tuple); } @@ -3090,7 +3090,7 @@ map_sql_table_to_xmlschema(TupleDesc tupdesc, Oid relid, bool nulls, xsd_schema_element_start(&result, targetns); appendStringInfoString(&result, - map_sql_typecoll_to_xmlschema_types(list_make1(tupdesc))); + map_sql_typecoll_to_xmlschema_types(list_make1(tupdesc))); appendStringInfo(&result, "<xsd:complexType name=\"%s\">\n" @@ -3102,10 +3102,10 @@ map_sql_table_to_xmlschema(TupleDesc tupdesc, Oid relid, bool nulls, if (tupdesc->attrs[i]->attisdropped) continue; appendStringInfo(&result, - " <xsd:element name=\"%s\" type=\"%s\"%s></xsd:element>\n", - map_sql_identifier_to_xml_name(NameStr(tupdesc->attrs[i]->attname), - true, false), - map_sql_type_to_xml_name(tupdesc->attrs[i]->atttypid, -1), + " <xsd:element name=\"%s\" type=\"%s\"%s></xsd:element>\n", + map_sql_identifier_to_xml_name(NameStr(tupdesc->attrs[i]->attname), + true, false), + map_sql_type_to_xml_name(tupdesc->attrs[i]->atttypid, -1), nulls ? " nillable=\"true\"" : " minOccurs=\"0\""); } @@ -3180,9 +3180,9 @@ map_sql_schema_to_xmlschema_types(Oid nspid, List *relid_list, bool nulls, char *relname = get_rel_name(relid); char *xmltn = map_sql_identifier_to_xml_name(relname, true, false); char *tabletypename = map_multipart_sql_identifier_to_xml_name(tableforest ? "RowType" : "TableType", - dbname, - nspname, - relname); + dbname, + nspname, + relname); if (!tableforest) appendStringInfo(&result, @@ -3247,9 +3247,9 @@ map_sql_catalog_to_xmlschema_types(List *nspid_list, bool nulls, char *nspname = get_namespace_name(nspid); char *xmlsn = map_sql_identifier_to_xml_name(nspname, true, false); char *schematypename = map_multipart_sql_identifier_to_xml_name("SchemaType", - dbname, - nspname, - NULL); + dbname, + nspname, + NULL); appendStringInfo(&result, " <xsd:element name=\"%s\" type=\"%s\"/>\n", @@ -3361,9 +3361,9 @@ map_sql_type_to_xml_name(Oid typeoid, int typmod) appendStringInfoString(&result, map_multipart_sql_identifier_to_xml_name((typtuple->typtype == TYPTYPE_DOMAIN) ? "Domain" : "UDT", - get_database_name(MyDatabaseId), - get_namespace_name(typtuple->typnamespace), - NameStr(typtuple->typname))); + get_database_name(MyDatabaseId), + get_namespace_name(typtuple->typnamespace), + NameStr(typtuple->typname))); ReleaseSysCache(tuple); } @@ -3471,15 +3471,15 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod) appendStringInfo(&result, " <xsd:restriction base=\"xsd:%s\">\n" " </xsd:restriction>\n", - xmlbinary == XMLBINARY_BASE64 ? "base64Binary" : "hexBinary"); + xmlbinary == XMLBINARY_BASE64 ? "base64Binary" : "hexBinary"); break; case NUMERICOID: if (typmod != -1) appendStringInfo(&result, - " <xsd:restriction base=\"xsd:decimal\">\n" + " <xsd:restriction base=\"xsd:decimal\">\n" " <xsd:totalDigits value=\"%d\"/>\n" - " <xsd:fractionDigits value=\"%d\"/>\n" + " <xsd:fractionDigits value=\"%d\"/>\n" " </xsd:restriction>\n", ((typmod - VARHDRSZ) >> 16) & 0xffff, (typmod - VARHDRSZ) & 0xffff); @@ -3506,16 +3506,16 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod) case INT8OID: appendStringInfo(&result, " <xsd:restriction base=\"xsd:long\">\n" - " <xsd:maxInclusive value=\"" INT64_FORMAT "\"/>\n" - " <xsd:minInclusive value=\"" INT64_FORMAT "\"/>\n" + " <xsd:maxInclusive value=\"" INT64_FORMAT "\"/>\n" + " <xsd:minInclusive value=\"" INT64_FORMAT "\"/>\n" " </xsd:restriction>\n", - (((uint64) 1) << (sizeof(int64) * 8 - 1)) - 1, + (((uint64) 1) << (sizeof(int64) * 8 - 1)) - 1, (((uint64) 1) << (sizeof(int64) * 8 - 1))); break; case FLOAT4OID: appendStringInfoString(&result, - " <xsd:restriction base=\"xsd:float\"></xsd:restriction>\n"); + " <xsd:restriction base=\"xsd:float\"></xsd:restriction>\n"); break; case FLOAT8OID: @@ -3535,19 +3535,19 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod) if (typmod == -1) appendStringInfo(&result, - " <xsd:restriction base=\"xsd:time\">\n" + " <xsd:restriction base=\"xsd:time\">\n" " <xsd:pattern value=\"\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}(.\\p{Nd}+)?%s\"/>\n" " </xsd:restriction>\n", tz); else if (typmod == 0) appendStringInfo(&result, - " <xsd:restriction base=\"xsd:time\">\n" + " <xsd:restriction base=\"xsd:time\">\n" " <xsd:pattern value=\"\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}%s\"/>\n" " </xsd:restriction>\n", tz); else appendStringInfo(&result, - " <xsd:restriction base=\"xsd:time\">\n" + " <xsd:restriction base=\"xsd:time\">\n" " <xsd:pattern value=\"\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}.\\p{Nd}{%d}%s\"/>\n" - " </xsd:restriction>\n", typmod - VARHDRSZ, tz); + " </xsd:restriction>\n", typmod - VARHDRSZ, tz); break; } @@ -3558,25 +3558,25 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod) if (typmod == -1) appendStringInfo(&result, - " <xsd:restriction base=\"xsd:dateTime\">\n" + " <xsd:restriction base=\"xsd:dateTime\">\n" " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}T\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}(.\\p{Nd}+)?%s\"/>\n" " </xsd:restriction>\n", tz); else if (typmod == 0) appendStringInfo(&result, - " <xsd:restriction base=\"xsd:dateTime\">\n" + " <xsd:restriction base=\"xsd:dateTime\">\n" " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}T\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}%s\"/>\n" " </xsd:restriction>\n", tz); else appendStringInfo(&result, - " <xsd:restriction base=\"xsd:dateTime\">\n" + " <xsd:restriction base=\"xsd:dateTime\">\n" " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}T\\p{Nd}{2}:\\p{Nd}{2}:\\p{Nd}{2}.\\p{Nd}{%d}%s\"/>\n" - " </xsd:restriction>\n", typmod - VARHDRSZ, tz); + " </xsd:restriction>\n", typmod - VARHDRSZ, tz); break; } case DATEOID: appendStringInfoString(&result, - " <xsd:restriction base=\"xsd:date\">\n" + " <xsd:restriction base=\"xsd:date\">\n" " <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}\"/>\n" " </xsd:restriction>\n"); break; @@ -3591,7 +3591,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod) appendStringInfo(&result, " <xsd:restriction base=\"%s\"/>\n", - map_sql_type_to_xml_name(base_typeoid, base_typmod)); + map_sql_type_to_xml_name(base_typeoid, base_typmod)); } break; } @@ -3650,7 +3650,7 @@ SPI_sql_row_to_xmlelement(uint64 rownum, StringInfo result, char *tablename, appendStringInfo(result, " <%s>%s</%s>\n", colname, map_sql_value_to_xml_value(colval, - SPI_gettypeid(SPI_tuptable->tupdesc, i), true), + SPI_gettypeid(SPI_tuptable->tupdesc, i), true), colname); } @@ -3772,7 +3772,7 @@ xml_xpathobjtoxmlarray(xmlXPathObjectPtr xpathobj, for (i = 0; i < result; i++) { datum = PointerGetDatum(xml_xmlnodetoxmltype(xpathobj->nodesetval->nodeTab[i], - xmlerrcxt)); + xmlerrcxt)); (void) accumArrayResult(astate, datum, false, XMLOID, CurrentMemoryContext); } @@ -3936,13 +3936,13 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces, ns_names_uris_nulls[i * 2 + 1]) ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), - errmsg("neither namespace name nor URI may be null"))); + errmsg("neither namespace name nor URI may be null"))); ns_name = TextDatumGetCString(ns_names_uris[i * 2]); ns_uri = TextDatumGetCString(ns_names_uris[i * 2 + 1]); if (xmlXPathRegisterNs(xpathctx, (xmlChar *) ns_name, (xmlChar *) ns_uri) != 0) - ereport(ERROR, /* is this an internal error??? */ + ereport(ERROR, /* is this an internal error??? */ (errmsg("could not register XML namespace with name \"%s\" and URI \"%s\"", ns_name, ns_uri))); } @@ -4000,7 +4000,7 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces, pg_xml_done(xmlerrcxt, false); } -#endif /* USE_LIBXML */ +#endif /* USE_LIBXML */ /* * Evaluate XPath expression and return array of XML values. @@ -4115,7 +4115,7 @@ xml_is_well_formed(PG_FUNCTION_ARGS) #else NO_XML_SUPPORT(); return 0; -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } Datum @@ -4128,7 +4128,7 @@ xml_is_well_formed_document(PG_FUNCTION_ARGS) #else NO_XML_SUPPORT(); return 0; -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } Datum @@ -4141,7 +4141,7 @@ xml_is_well_formed_content(PG_FUNCTION_ARGS) #else NO_XML_SUPPORT(); return 0; -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } /* @@ -4221,7 +4221,7 @@ XmlTableInitOpaque(TableFuncScanState *state, int natts) state->opaque = xtCxt; #else NO_XML_SUPPORT(); -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } /* @@ -4281,7 +4281,7 @@ XmlTableSetDocument(TableFuncScanState *state, Datum value) xtCxt->xpathcxt = xpathcxt; #else NO_XML_SUPPORT(); -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } /* @@ -4307,7 +4307,7 @@ XmlTableSetNamespace(TableFuncScanState *state, char *name, char *uri) "could not set XML namespace"); #else NO_XML_SUPPORT(); -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } /* @@ -4336,7 +4336,7 @@ XmlTableSetRowFilter(TableFuncScanState *state, char *path) "invalid XPath expression"); #else NO_XML_SUPPORT(); -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } /* @@ -4367,7 +4367,7 @@ XmlTableSetColumnFilter(TableFuncScanState *state, char *path, int colnum) "invalid XPath expression"); #else NO_XML_SUPPORT(); -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } /* @@ -4415,7 +4415,7 @@ XmlTableFetchRow(TableFuncScanState *state) #else NO_XML_SUPPORT(); return false; -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } /* @@ -4495,7 +4495,7 @@ XmlTableGetValue(TableFuncScanState *state, int colnum, xmlChar *str; str = xmlNodeListGetString(xtCxt->doc, - xpathobj->nodesetval->nodeTab[0]->xmlChildrenNode, + xpathobj->nodesetval->nodeTab[0]->xmlChildrenNode, 1); if (str != NULL) @@ -4546,8 +4546,8 @@ XmlTableGetValue(TableFuncScanState *state, int colnum, for (i = 0; i < count; i++) { appendStringInfoText(&str, - xml_xmlnodetoxmltype(xpathobj->nodesetval->nodeTab[i], - xtCxt->xmlerrcxt)); + xml_xmlnodetoxmltype(xpathobj->nodesetval->nodeTab[i], + xtCxt->xmlerrcxt)); } cstr = str.data; } @@ -4585,7 +4585,7 @@ XmlTableGetValue(TableFuncScanState *state, int colnum, #else NO_XML_SUPPORT(); return 0; -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } /* @@ -4631,5 +4631,5 @@ XmlTableDestroyOpaque(TableFuncScanState *state) #else NO_XML_SUPPORT(); -#endif /* not USE_LIBXML */ +#endif /* not USE_LIBXML */ } diff --git a/src/backend/utils/cache/attoptcache.c b/src/backend/utils/cache/attoptcache.c index 4b30e6bc62..da8b42ddb8 100644 --- a/src/backend/utils/cache/attoptcache.c +++ b/src/backend/utils/cache/attoptcache.c @@ -111,8 +111,7 @@ get_attribute_options(Oid attrelid, int attnum) /* Find existing cache entry, if any. */ if (!AttoptCacheHash) InitializeAttoptCache(); - memset(&key, 0, sizeof(key)); /* make sure any padding bits are - * unset */ + memset(&key, 0, sizeof(key)); /* make sure any padding bits are unset */ key.attrelid = attrelid; key.attnum = attnum; attopt = diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index b19044c46c..e7e8e3b54c 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -339,7 +339,7 @@ CatCachePrintStats(int code, Datum arg) cc_lsearches, cc_lhits); } -#endif /* CATCACHE_STATS */ +#endif /* CATCACHE_STATS */ /* @@ -1571,7 +1571,7 @@ SearchCatCacheList(CatCache *cache, oldcxt = MemoryContextSwitchTo(CacheMemoryContext); nmembers = list_length(ctlist); cl = (CatCList *) - palloc(offsetof(CatCList, members) +nmembers * sizeof(CatCTup *)); + palloc(offsetof(CatCList, members) + nmembers * sizeof(CatCTup *)); heap_copytuple_with_tuple(ntp, &cl->tuple); MemoryContextSwitchTo(oldcxt); heap_freetuple(ntp); diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index 9daaf75d88..40421ac68a 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -126,7 +126,7 @@ */ typedef struct InvalidationChunk { - struct InvalidationChunk *next; /* list link */ + struct InvalidationChunk *next; /* list link */ int nitems; /* # items currently stored in chunk */ int maxitems; /* size of allocated array in this chunk */ SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]; @@ -199,7 +199,7 @@ static struct SYSCACHECALLBACK int16 link; /* next callback index+1 for same cache */ SyscacheCallbackFunction function; Datum arg; -} syscache_callback_list[MAX_SYSCACHE_CALLBACKS]; +} syscache_callback_list[MAX_SYSCACHE_CALLBACKS]; static int16 syscache_callback_links[SysCacheSize]; @@ -209,7 +209,7 @@ static struct RELCACHECALLBACK { RelcacheCallbackFunction function; Datum arg; -} relcache_callback_list[MAX_RELCACHE_CALLBACKS]; +} relcache_callback_list[MAX_RELCACHE_CALLBACKS]; static int relcache_callback_count = 0; @@ -241,7 +241,7 @@ AddInvalidationMessage(InvalidationChunk **listHdr, chunk = (InvalidationChunk *) MemoryContextAlloc(CurTransactionContext, offsetof(InvalidationChunk, msgs) + - FIRSTCHUNKSIZE * sizeof(SharedInvalidationMessage)); + FIRSTCHUNKSIZE * sizeof(SharedInvalidationMessage)); chunk->nitems = 0; chunk->maxitems = FIRSTCHUNKSIZE; chunk->next = *listHdr; @@ -469,7 +469,7 @@ ProcessInvalidationMessages(InvalidationListHeader *hdr, */ static void ProcessInvalidationMessagesMulti(InvalidationListHeader *hdr, - void (*func) (const SharedInvalidationMessage *msgs, int n)) + void (*func) (const SharedInvalidationMessage *msgs, int n)) { ProcessMessageListMulti(hdr->cclist, func(msgs, n)); ProcessMessageListMulti(hdr->rclist, func(msgs, n)); @@ -783,7 +783,7 @@ MakeSharedInvalidMessagesArray(const SharedInvalidationMessage *msgs, int n) * We're so close to EOXact that we now we're going to lose it anyhow. */ SharedInvalidMessagesArray = palloc(maxSharedInvalidMessagesArray - * sizeof(SharedInvalidationMessage)); + * sizeof(SharedInvalidationMessage)); } if ((numSharedInvalidMessagesArray + n) > maxSharedInvalidMessagesArray) @@ -793,7 +793,7 @@ MakeSharedInvalidMessagesArray(const SharedInvalidationMessage *msgs, int n) SharedInvalidMessagesArray = repalloc(SharedInvalidMessagesArray, maxSharedInvalidMessagesArray - * sizeof(SharedInvalidationMessage)); + * sizeof(SharedInvalidationMessage)); } /* diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 7384b1971a..aa96e82558 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -3135,7 +3135,7 @@ get_typmodout(Oid typid) else return InvalidOid; } -#endif /* NOT_USED */ +#endif /* NOT_USED */ /* * get_typcollation diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c index 61e3da9306..524c62d7a0 100644 --- a/src/backend/utils/cache/plancache.c +++ b/src/backend/utils/cache/plancache.c @@ -169,7 +169,7 @@ CreateCachedPlan(RawStmt *raw_parse_tree, MemoryContext source_context; MemoryContext oldcxt; - Assert(query_string != NULL); /* required as of 8.4 */ + Assert(query_string != NULL); /* required as of 8.4 */ /* * Make a dedicated memory context for the CachedPlanSource and its @@ -254,7 +254,7 @@ CreateOneShotCachedPlan(RawStmt *raw_parse_tree, { CachedPlanSource *plansource; - Assert(query_string != NULL); /* required as of 8.4 */ + Assert(query_string != NULL); /* required as of 8.4 */ /* * Create and fill the CachedPlanSource struct within the caller's memory @@ -1260,7 +1260,7 @@ GetCachedPlan(CachedPlanSource *plansource, ParamListInfo boundParams, { /* otherwise, it should be a sibling of the plansource */ MemoryContextSetParent(plan->context, - MemoryContextGetParent(plansource->context)); + MemoryContextGetParent(plansource->context)); } /* Update generic_cost whenever we make a new generic plan */ plansource->generic_cost = cached_plan_cost(plan, false); @@ -1600,7 +1600,7 @@ AcquireExecutorLocks(List *stmt_list, bool acquire) * acquire a non-conflicting lock. */ if (list_member_int(plannedstmt->resultRelations, rt_index) || - list_member_int(plannedstmt->nonleafResultRelations, rt_index)) + list_member_int(plannedstmt->nonleafResultRelations, rt_index)) lockmode = RowExclusiveLock; else if ((rc = get_plan_rowmark(plannedstmt->rowMarks, rt_index)) != NULL && RowMarkRequiresRowShareLock(rc->markType)) diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 02df474339..29f744ff80 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -633,7 +633,7 @@ RelationBuildTupleDesc(Relation relation) constr->num_check = relation->rd_rel->relchecks; constr->check = (ConstrCheck *) MemoryContextAllocZero(CacheMemoryContext, - constr->num_check * sizeof(ConstrCheck)); + constr->num_check * sizeof(ConstrCheck)); CheckConstraintFetch(relation); } else @@ -1388,7 +1388,7 @@ RelationBuildDesc(Oid targetRelId, bool insertIt) /* * initialize the relation lock manager information */ - RelationInitLockInfo(relation); /* see lmgr.c */ + RelationInitLockInfo(relation); /* see lmgr.c */ /* * initialize physical addressing information for the relation @@ -1463,7 +1463,7 @@ RelationInitPhysicalAddr(Relation relation) Form_pg_class physrel; phys_tuple = ScanPgRelation(RelationGetRelid(relation), - RelationGetRelid(relation) != ClassOidIndexId, + RelationGetRelid(relation) != ClassOidIndexId, true); if (!HeapTupleIsValid(phys_tuple)) elog(ERROR, "could not find pg_class entry for %u", @@ -2028,7 +2028,7 @@ formrdesc(const char *relationName, Oid relationReltype, /* * initialize the relation lock manager information */ - RelationInitLockInfo(relation); /* see lmgr.c */ + RelationInitLockInfo(relation); /* see lmgr.c */ /* * initialize physical addressing information for the relation @@ -2440,7 +2440,7 @@ RelationClearRelation(Relation relation, bool rebuild) if (relation->rd_rel->relkind == RELKIND_INDEX) { - relation->rd_isvalid = false; /* needs to be revalidated */ + relation->rd_isvalid = false; /* needs to be revalidated */ if (relation->rd_refcnt > 1 && IsTransactionState()) RelationReloadIndexInfo(relation); } @@ -2906,7 +2906,7 @@ RememberToFreeTupleDescAtEOX(TupleDesc td) Assert(EOXactTupleDescArrayLen > 0); EOXactTupleDescArray = (TupleDesc *) repalloc(EOXactTupleDescArray, - newlen * sizeof(TupleDesc)); + newlen * sizeof(TupleDesc)); EOXactTupleDescArrayLen = newlen; } @@ -3679,7 +3679,7 @@ RelationCacheInitializePhase3(void) formrdesc("pg_type", TypeRelation_Rowtype_Id, false, true, Natts_pg_type, Desc_pg_type); -#define NUM_CRITICAL_LOCAL_RELS 4 /* fix if you change list above */ +#define NUM_CRITICAL_LOCAL_RELS 4 /* fix if you change list above */ } MemoryContextSwitchTo(oldcxt); @@ -3804,7 +3804,7 @@ RelationCacheInitializePhase3(void) Form_pg_class relp; htup = SearchSysCache1(RELOID, - ObjectIdGetDatum(RelationGetRelid(relation))); + ObjectIdGetDatum(RelationGetRelid(relation))); if (!HeapTupleIsValid(htup)) elog(FATAL, "cache lookup failed for relation %u", RelationGetRelid(relation)); @@ -3982,7 +3982,7 @@ BuildHardcodedDescriptor(int natts, const FormData_pg_attribute *attrs, oldcxt = MemoryContextSwitchTo(CacheMemoryContext); result = CreateTemplateTupleDesc(natts, hasoids); - result->tdtypeid = RECORDOID; /* not right, but we don't care */ + result->tdtypeid = RECORDOID; /* not right, but we don't care */ result->tdtypmod = -1; for (i = 0; i < natts; i++) @@ -4067,7 +4067,7 @@ AttrDefaultFetch(Relation relation) continue; if (attrdef[i].adbin != NULL) elog(WARNING, "multiple attrdef records found for attr %s of rel %s", - NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname), + NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname), RelationGetRelationName(relation)); else found++; @@ -4077,7 +4077,7 @@ AttrDefaultFetch(Relation relation) adrel->rd_att, &isnull); if (isnull) elog(WARNING, "null adbin for attr %s of rel %s", - NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname), + NameStr(relation->rd_att->attrs[adform->adnum - 1]->attname), RelationGetRelationName(relation)); else { @@ -4261,7 +4261,7 @@ RelationGetFKeyList(Relation relation) elog(ERROR, "null conkey for rel %s", RelationGetRelationName(relation)); - arr = DatumGetArrayTypeP(adatum); /* ensure not toasted */ + arr = DatumGetArrayTypeP(adatum); /* ensure not toasted */ nelem = ARR_DIMS(arr)[0]; if (ARR_NDIM(arr) != 1 || nelem < 1 || @@ -4280,7 +4280,7 @@ RelationGetFKeyList(Relation relation) elog(ERROR, "null confkey for rel %s", RelationGetRelationName(relation)); - arr = DatumGetArrayTypeP(adatum); /* ensure not toasted */ + arr = DatumGetArrayTypeP(adatum); /* ensure not toasted */ nelem = ARR_DIMS(arr)[0]; if (ARR_NDIM(arr) != 1 || nelem != info->nkeys || @@ -4297,7 +4297,7 @@ RelationGetFKeyList(Relation relation) elog(ERROR, "null conpfeqop for rel %s", RelationGetRelationName(relation)); - arr = DatumGetArrayTypeP(adatum); /* ensure not toasted */ + arr = DatumGetArrayTypeP(adatum); /* ensure not toasted */ nelem = ARR_DIMS(arr)[0]; if (ARR_NDIM(arr) != 1 || nelem != info->nkeys || @@ -4969,19 +4969,19 @@ restart: if (attrnum != 0) { indexattrs = bms_add_member(indexattrs, - attrnum - FirstLowInvalidHeapAttributeNumber); + attrnum - FirstLowInvalidHeapAttributeNumber); if (isKey) uindexattrs = bms_add_member(uindexattrs, - attrnum - FirstLowInvalidHeapAttributeNumber); + attrnum - FirstLowInvalidHeapAttributeNumber); if (isPK) pkindexattrs = bms_add_member(pkindexattrs, - attrnum - FirstLowInvalidHeapAttributeNumber); + attrnum - FirstLowInvalidHeapAttributeNumber); if (isIDKey) idindexattrs = bms_add_member(idindexattrs, - attrnum - FirstLowInvalidHeapAttributeNumber); + attrnum - FirstLowInvalidHeapAttributeNumber); } } @@ -5470,7 +5470,7 @@ load_relcache_init_file(bool shared) rel->rd_att->tdrefcount = 1; /* mark as refcounted */ rel->rd_att->tdtypeid = relform->reltype; - rel->rd_att->tdtypmod = -1; /* unnecessary, but... */ + rel->rd_att->tdtypmod = -1; /* unnecessary, but... */ /* next read all the attribute tuple form data entries */ has_not_null = false; @@ -5495,7 +5495,7 @@ load_relcache_init_file(bool shared) if (fread(rel->rd_options, 1, len, fp) != len) goto read_failed; if (len != VARSIZE(rel->rd_options)) - goto read_failed; /* sanity check */ + goto read_failed; /* sanity check */ } else { @@ -5812,7 +5812,7 @@ write_relcache_init_file(bool shared) (errcode_for_file_access(), errmsg("could not create relation-cache initialization file \"%s\": %m", tempfilename), - errdetail("Continuing anyway, but there's something wrong."))); + errdetail("Continuing anyway, but there's something wrong."))); return; } diff --git a/src/backend/utils/cache/relfilenodemap.c b/src/backend/utils/cache/relfilenodemap.c index 612f0f3a0d..3e811e1c9b 100644 --- a/src/backend/utils/cache/relfilenodemap.c +++ b/src/backend/utils/cache/relfilenodemap.c @@ -68,9 +68,9 @@ RelfilenodeMapInvalidateCallback(Datum arg, Oid relid) * all entries, otherwise just remove the specific relation's entry. * Always remove negative cache entries. */ - if (relid == InvalidOid || /* complete reset */ - entry->relid == InvalidOid || /* negative cache entry */ - entry->relid == relid) /* individual flushed relation */ + if (relid == InvalidOid || /* complete reset */ + entry->relid == InvalidOid || /* negative cache entry */ + entry->relid == relid) /* individual flushed relation */ { if (hash_search(RelfilenodeMapHash, (void *) &entry->key, diff --git a/src/backend/utils/cache/relmapper.c b/src/backend/utils/cache/relmapper.c index 047c5b40e8..f5394dc43d 100644 --- a/src/backend/utils/cache/relmapper.c +++ b/src/backend/utils/cache/relmapper.c @@ -72,9 +72,9 @@ */ #define RELMAPPER_FILENAME "pg_filenode.map" -#define RELMAPPER_FILEMAGIC 0x592717 /* version ID value */ +#define RELMAPPER_FILEMAGIC 0x592717 /* version ID value */ -#define MAX_MAPPINGS 62 /* 62 * 8 + 16 = 512 */ +#define MAX_MAPPINGS 62 /* 62 * 8 + 16 = 512 */ typedef struct RelMapping { @@ -684,8 +684,8 @@ load_relmap_file(bool shared) if (!EQ_CRC32C(crc, map->crc)) ereport(FATAL, - (errmsg("relation mapping file \"%s\" contains incorrect checksum", - mapfilename))); + (errmsg("relation mapping file \"%s\" contains incorrect checksum", + mapfilename))); } /* diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index e244faac0e..36de1706a6 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -425,7 +425,7 @@ static const struct cachedesc cacheinfo[] = { }, 8 }, - {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */ + {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPERNAME */ ForeignDataWrapperNameIndexId, 1, { @@ -436,7 +436,7 @@ static const struct cachedesc cacheinfo[] = { }, 2 }, - {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */ + {ForeignDataWrapperRelationId, /* FOREIGNDATAWRAPPEROID */ ForeignDataWrapperOidIndexId, 1, { @@ -757,7 +757,7 @@ static const struct cachedesc cacheinfo[] = { }, 128 }, - {ReplicationOriginRelationId, /* REPLORIGIDENT */ + {ReplicationOriginRelationId, /* REPLORIGIDENT */ ReplicationOriginIdentIndex, 1, { @@ -768,7 +768,7 @@ static const struct cachedesc cacheinfo[] = { }, 16 }, - {ReplicationOriginRelationId, /* REPLORIGNAME */ + {ReplicationOriginRelationId, /* REPLORIGNAME */ ReplicationOriginNameIndex, 1, { diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c index 88e4ffb66d..da5c8ea345 100644 --- a/src/backend/utils/cache/ts_cache.c +++ b/src/backend/utils/cache/ts_cache.c @@ -334,7 +334,7 @@ lookup_ts_dictionary_cache(Oid dictId) entry->dictData = DatumGetPointer(OidFunctionCall1(template->tmplinit, - PointerGetDatum(dictoptions))); + PointerGetDatum(dictoptions))); MemoryContextSwitchTo(oldcontext); } diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c index 0cf5001a75..7ec31eb3e3 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -152,7 +152,7 @@ static HTAB *RecordCacheHash = NULL; static TupleDesc *RecordCacheArray = NULL; static int32 RecordCacheArrayLen = 0; /* allocated length of array */ -static int32 NextRecordTypmod = 0; /* number of entries used */ +static int32 NextRecordTypmod = 0; /* number of entries used */ static void load_typcache_tupdesc(TypeCacheEntry *typentry); static void load_rangetype_info(TypeCacheEntry *typentry); @@ -572,7 +572,7 @@ load_typcache_tupdesc(TypeCacheEntry *typentry) { Relation rel; - if (!OidIsValid(typentry->typrelid)) /* should not happen */ + if (!OidIsValid(typentry->typrelid)) /* should not happen */ elog(ERROR, "invalid typrelid for composite type %u", typentry->type_id); rel = relation_open(typentry->typrelid, AccessShareLock); @@ -888,8 +888,8 @@ load_domaintype_info(TypeCacheEntry *typentry) static int dcs_cmp(const void *a, const void *b) { - const DomainConstraintState *const * ca = (const DomainConstraintState *const *) a; - const DomainConstraintState *const * cb = (const DomainConstraintState *const *) b; + const DomainConstraintState *const *ca = (const DomainConstraintState *const *) a; + const DomainConstraintState *const *cb = (const DomainConstraintState *const *) b; return strcmp((*ca)->name, (*cb)->name); } diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 35ed690931..86751440b9 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -112,7 +112,7 @@ emit_log_hook_type emit_log_hook = NULL; /* GUC parameters */ int Log_error_verbosity = PGERROR_VERBOSE; -char *Log_line_prefix = NULL; /* format for extra log line info */ +char *Log_line_prefix = NULL; /* format for extra log line info */ int Log_destination = LOG_DESTINATION_STDERR; char *Log_destination_string = NULL; bool syslog_sequence_numbers = true; @@ -404,7 +404,7 @@ errstart(int elevel, const char *filename, int lineno, * because it suggests an infinite loop of errors during error * recovery. */ - errordata_stack_depth = -1; /* make room on stack */ + errordata_stack_depth = -1; /* make room on stack */ ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded"))); } @@ -675,7 +675,7 @@ errcode_for_file_access(void) case ENOTDIR: /* Not a directory */ case EISDIR: /* Is a directory */ #if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */ - case ENOTEMPTY: /* Directory not empty */ + case ENOTEMPTY: /* Directory not empty */ #endif edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE; break; @@ -1369,7 +1369,7 @@ elog_start(const char *filename, int lineno, * else failure to convert it to client encoding could cause further * recursion. */ - errordata_stack_depth = -1; /* make room on stack */ + errordata_stack_depth = -1; /* make room on stack */ ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded"))); } @@ -1750,7 +1750,7 @@ ReThrowError(ErrorData *edata) * because it suggests an infinite loop of errors during error * recovery. */ - errordata_stack_depth = -1; /* make room on stack */ + errordata_stack_depth = -1; /* make room on stack */ ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded"))); } @@ -1881,7 +1881,7 @@ GetErrorContextStack(void) * because it suggests an infinite loop of errors during error * recovery. */ - errordata_stack_depth = -1; /* make room on stack */ + errordata_stack_depth = -1; /* make room on stack */ ereport(PANIC, (errmsg_internal("ERRORDATA_STACK_SIZE exceeded"))); } @@ -1947,7 +1947,7 @@ DebugFileOpen(void) 0666)) < 0) ereport(FATAL, (errcode_for_file_access(), - errmsg("could not open file \"%s\": %m", OutputFileName))); + errmsg("could not open file \"%s\": %m", OutputFileName))); istty = isatty(fd); close(fd); @@ -2118,7 +2118,7 @@ write_syslog(int level, const char *line) syslog(level, "%s", line); } } -#endif /* HAVE_SYSLOG */ +#endif /* HAVE_SYSLOG */ #ifdef WIN32 /* @@ -2150,7 +2150,7 @@ write_eventlog(int level, const char *line, int len) if (evtHandle == INVALID_HANDLE_VALUE) { evtHandle = RegisterEventSource(NULL, - event_source ? event_source : DEFAULT_EVENT_SOURCE); + event_source ? event_source : DEFAULT_EVENT_SOURCE); if (evtHandle == NULL) { evtHandle = INVALID_HANDLE_VALUE; @@ -2222,7 +2222,7 @@ write_eventlog(int level, const char *line, int len) &line, NULL); } -#endif /* WIN32 */ +#endif /* WIN32 */ static void write_console(const char *line, int len) @@ -3128,7 +3128,7 @@ send_message_to_server_log(ErrorData *edata) write_syslog(syslog_level, buf.data); } -#endif /* HAVE_SYSLOG */ +#endif /* HAVE_SYSLOG */ #ifdef WIN32 /* Write to eventlog, if enabled */ @@ -3136,7 +3136,7 @@ send_message_to_server_log(ErrorData *edata) { write_eventlog(edata->elevel, buf.data, buf.len); } -#endif /* WIN32 */ +#endif /* WIN32 */ /* Write to stderr, if enabled */ if ((Log_destination & LOG_DESTINATION_STDERR) || whereToSendOutput == DestDebug) @@ -3404,7 +3404,7 @@ send_message_to_frontend(ErrorData *edata) err_sendstring(&msgbuf, edata->funcname); } - pq_sendbyte(&msgbuf, '\0'); /* terminator */ + pq_sendbyte(&msgbuf, '\0'); /* terminator */ } else { diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c index 28c2583f96..1239f95ddc 100644 --- a/src/backend/utils/fmgr/dfmgr.c +++ b/src/backend/utils/fmgr/dfmgr.c @@ -48,7 +48,7 @@ typedef struct df_files ino_t inode; /* Inode number of file */ #endif void *handle; /* a handle for pg_dl* functions */ - char filename[FLEXIBLE_ARRAY_MEMBER]; /* Full pathname of file */ + char filename[FLEXIBLE_ARRAY_MEMBER]; /* Full pathname of file */ } DynamicFileList; static DynamicFileList *file_list = NULL; @@ -65,7 +65,7 @@ char *Dynamic_library_path; static void *internal_load_library(const char *libname); static void incompatible_module_error(const char *libname, - const Pg_magic_struct *module_magic_data) pg_attribute_noreturn(); + const Pg_magic_struct *module_magic_data) pg_attribute_noreturn(); static void internal_unload_library(const char *libname); static bool file_exists(const char *name); static char *expand_dynamic_library_name(const char *name); @@ -214,7 +214,7 @@ internal_load_library(const char *libname) * File not loaded yet. */ file_scanner = (DynamicFileList *) - malloc(offsetof(DynamicFileList, filename) +strlen(libname) + 1); + malloc(offsetof(DynamicFileList, filename) + strlen(libname) + 1); if (file_scanner == NULL) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), @@ -268,9 +268,9 @@ internal_load_library(const char *libname) free((char *) file_scanner); /* complain */ ereport(ERROR, - (errmsg("incompatible library \"%s\": missing magic block", - libname), - errhint("Extension libraries are required to use the PG_MODULE_MAGIC macro."))); + (errmsg("incompatible library \"%s\": missing magic block", + libname), + errhint("Extension libraries are required to use the PG_MODULE_MAGIC macro."))); } /* @@ -362,7 +362,7 @@ incompatible_module_error(const char *libname, if (details.len) appendStringInfoChar(&details, '\n'); appendStringInfo(&details, - _("Server has FLOAT4PASSBYVAL = %s, library has %s."), + _("Server has FLOAT4PASSBYVAL = %s, library has %s."), magic_data.float4byval ? "true" : "false", module_magic_data->float4byval ? "true" : "false"); } @@ -371,14 +371,14 @@ incompatible_module_error(const char *libname, if (details.len) appendStringInfoChar(&details, '\n'); appendStringInfo(&details, - _("Server has FLOAT8PASSBYVAL = %s, library has %s."), + _("Server has FLOAT8PASSBYVAL = %s, library has %s."), magic_data.float8byval ? "true" : "false", module_magic_data->float8byval ? "true" : "false"); } if (details.len == 0) appendStringInfoString(&details, - _("Magic block has unexpected length or padding difference.")); + _("Magic block has unexpected length or padding difference.")); ereport(ERROR, (errmsg("incompatible library \"%s\": magic block mismatch", @@ -448,7 +448,7 @@ internal_unload_library(const char *libname) else prv = file_scanner; } -#endif /* NOT_USED */ +#endif /* NOT_USED */ } static bool diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index f6d2b7d63e..a7b07827e0 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -46,7 +46,7 @@ typedef struct TransactionId fn_xmin; /* for checking up-to-dateness */ ItemPointerData fn_tid; PGFunction user_fn; /* the function's address */ - const Pg_finfo_record *inforec; /* address of its info record */ + const Pg_finfo_record *inforec; /* address of its info record */ } CFuncHashTabEntry; static HTAB *CFuncHash = NULL; @@ -172,7 +172,7 @@ fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt, finfo->fn_nargs = fbp->nargs; finfo->fn_strict = fbp->strict; finfo->fn_retset = fbp->retset; - finfo->fn_stats = TRACK_FUNC_ALL; /* ie, never track */ + finfo->fn_stats = TRACK_FUNC_ALL; /* ie, never track */ finfo->fn_addr = fbp->func; finfo->fn_oid = functionId; return; @@ -208,7 +208,7 @@ fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt, FmgrHookIsNeeded(functionId))) { finfo->fn_addr = fmgr_security_definer; - finfo->fn_stats = TRACK_FUNC_ALL; /* ie, never track */ + finfo->fn_stats = TRACK_FUNC_ALL; /* ie, never track */ finfo->fn_oid = functionId; ReleaseSysCache(procedureTuple); return; @@ -396,8 +396,8 @@ fetch_finfo_record(void *filehandle, const char *funcname) { ereport(ERROR, (errcode(ERRCODE_UNDEFINED_FUNCTION), - errmsg("could not find function information for function \"%s\"", - funcname), + errmsg("could not find function information for function \"%s\"", + funcname), errhint("SQL-callable functions need an accompanying PG_FUNCTION_INFO_V1(funcname)."))); return NULL; /* silence compiler */ } @@ -631,7 +631,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) if (OidIsValid(fcache->userid)) SetUserIdAndSecContext(fcache->userid, - save_sec_context | SECURITY_LOCAL_USERID_CHANGE); + save_sec_context | SECURITY_LOCAL_USERID_CHANGE); if (fcache->proconfig) { @@ -1795,7 +1795,7 @@ Int64GetDatum(int64 X) *retval = X; return PointerGetDatum(retval); } -#endif /* USE_FLOAT8_BYVAL */ +#endif /* USE_FLOAT8_BYVAL */ #ifndef USE_FLOAT4_BYVAL @@ -1828,7 +1828,7 @@ Float8GetDatum(float8 X) */ struct varlena * -pg_detoast_datum(struct varlena * datum) +pg_detoast_datum(struct varlena *datum) { if (VARATT_IS_EXTENDED(datum)) return heap_tuple_untoast_attr(datum); @@ -1837,7 +1837,7 @@ pg_detoast_datum(struct varlena * datum) } struct varlena * -pg_detoast_datum_copy(struct varlena * datum) +pg_detoast_datum_copy(struct varlena *datum) { if (VARATT_IS_EXTENDED(datum)) return heap_tuple_untoast_attr(datum); @@ -1853,14 +1853,14 @@ pg_detoast_datum_copy(struct varlena * datum) } struct varlena * -pg_detoast_datum_slice(struct varlena * datum, int32 first, int32 count) +pg_detoast_datum_slice(struct varlena *datum, int32 first, int32 count) { /* Only get the specified portion from the toast rel */ return heap_tuple_untoast_attr_slice(datum, first, count); } struct varlena * -pg_detoast_datum_packed(struct varlena * datum) +pg_detoast_datum_packed(struct varlena *datum) { if (VARATT_IS_COMPRESSED(datum) || VARATT_IS_EXTERNAL(datum)) return heap_tuple_untoast_attr(datum); diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c index af08f102fe..be47d411c5 100644 --- a/src/backend/utils/fmgr/funcapi.c +++ b/src/backend/utils/fmgr/funcapi.c @@ -814,7 +814,7 @@ get_func_arg_info(HeapTuple procTup, * deconstruct_array() since the array data is just going to look like * a C array of values. */ - arr = DatumGetArrayTypeP(proallargtypes); /* ensure not toasted */ + arr = DatumGetArrayTypeP(proallargtypes); /* ensure not toasted */ numargs = ARR_DIMS(arr)[0]; if (ARR_NDIM(arr) != 1 || numargs < 0 || @@ -953,7 +953,7 @@ get_func_input_arg_names(Datum proargnames, Datum proargmodes, * For proargmodes, we don't need to use deconstruct_array() since the * array data is just going to look like a C array of values. */ - arr = DatumGetArrayTypeP(proargnames); /* ensure not toasted */ + arr = DatumGetArrayTypeP(proargnames); /* ensure not toasted */ if (ARR_NDIM(arr) != 1 || ARR_HASNULL(arr) || ARR_ELEMTYPE(arr) != TEXTOID) @@ -1200,7 +1200,7 @@ build_function_result_tupdesc_d(Datum proallargtypes, ARR_ELEMTYPE(arr) != OIDOID) elog(ERROR, "proallargtypes is not a 1-D Oid array"); argtypes = (Oid *) ARR_DATA_PTR(arr); - arr = DatumGetArrayTypeP(proargmodes); /* ensure not toasted */ + arr = DatumGetArrayTypeP(proargmodes); /* ensure not toasted */ if (ARR_NDIM(arr) != 1 || ARR_DIMS(arr)[0] != numargs || ARR_HASNULL(arr) || @@ -1369,7 +1369,7 @@ TypeGetTupleDesc(Oid typeoid, List *colaliases) if (list_length(colaliases) != 1) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("number of aliases does not match number of columns"))); + errmsg("number of aliases does not match number of columns"))); /* OK, get the column alias */ attname = strVal(linitial(colaliases)); diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c index 1adc5841f7..ebd55da997 100644 --- a/src/backend/utils/hash/dynahash.c +++ b/src/backend/utils/hash/dynahash.c @@ -331,7 +331,7 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags) } /* Initialize the hash header, plus a copy of the table name */ - hashp = (HTAB *) DynaHashAlloc(sizeof(HTAB) + strlen(tabname) +1); + hashp = (HTAB *) DynaHashAlloc(sizeof(HTAB) + strlen(tabname) + 1); MemSet(hashp, 0, sizeof(HTAB)); hashp->tabname = (char *) (hashp + 1); @@ -352,7 +352,7 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags) hashp->hash = tag_hash; } else - hashp->hash = string_hash; /* default hash function */ + hashp->hash = string_hash; /* default hash function */ /* * If you don't specify a match function, it defaults to string_compare if @@ -733,7 +733,7 @@ hash_estimate_size(long num_entries, Size entrysize) size = add_size(size, mul_size(nDirEntries, sizeof(HASHSEGMENT))); /* segments */ size = add_size(size, mul_size(nSegments, - MAXALIGN(DEF_SEGSIZE * sizeof(HASHBUCKET)))); + MAXALIGN(DEF_SEGSIZE * sizeof(HASHBUCKET)))); /* elements --- allocated in groups of choose_nelem_alloc() entries */ elementAllocCnt = choose_nelem_alloc(entrysize); nElementAllocs = (num_entries - 1) / elementAllocCnt + 1; @@ -1417,7 +1417,7 @@ hash_seq_search(HASH_SEQ_STATUS *status) /* Begin scan of curBucket... */ status->curEntry = curElem->link; - if (status->curEntry == NULL) /* end of this bucket */ + if (status->curEntry == NULL) /* end of this bucket */ ++curBucket; status->curBucket = curBucket; return (void *) ELEMENTKEY(curElem); @@ -1740,7 +1740,7 @@ next_pow2_int(long num) #define MAX_SEQ_SCANS 100 static HTAB *seq_scan_tables[MAX_SEQ_SCANS]; /* tables being scanned */ -static int seq_scan_level[MAX_SEQ_SCANS]; /* subtransaction nest level */ +static int seq_scan_level[MAX_SEQ_SCANS]; /* subtransaction nest level */ static int num_seq_scans = 0; diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c index a91faf4b71..4b9578de6d 100644 --- a/src/backend/utils/init/globals.c +++ b/src/backend/utils/init/globals.c @@ -63,10 +63,10 @@ char *DataDir = NULL; char OutputFileName[MAXPGPATH]; /* debugging output file */ char my_exec_path[MAXPGPATH]; /* full path to my executable */ -char pkglib_path[MAXPGPATH]; /* full path to lib directory */ +char pkglib_path[MAXPGPATH]; /* full path to lib directory */ #ifdef EXEC_BACKEND -char postgres_exec_path[MAXPGPATH]; /* full path to backend */ +char postgres_exec_path[MAXPGPATH]; /* full path to backend */ /* note: currently this is not valid in backend processes */ #endif @@ -137,7 +137,7 @@ int max_worker_processes = 8; int max_parallel_workers = 8; int MaxBackends = 0; -int VacuumCostPageHit = 1; /* GUC parameters for vacuum */ +int VacuumCostPageHit = 1; /* GUC parameters for vacuum */ int VacuumCostPageMiss = 10; int VacuumCostPageDirty = 20; int VacuumCostLimit = 200; @@ -147,7 +147,7 @@ int VacuumPageHit = 0; int VacuumPageMiss = 0; int VacuumPageDirty = 0; -int VacuumCostBalance = 0; /* working state for vacuum */ +int VacuumCostBalance = 0; /* working state for vacuum */ bool VacuumCostActive = false; #ifdef PGXC diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index d987dac8f5..dc622219f0 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -1116,7 +1116,7 @@ CreateLockFile(const char *filename, bool amPostmaster, errmsg("could not remove old lock file \"%s\": %m", filename), errhint("The file seems accidentally left over, but " - "it could not be removed. Please remove the file " + "it could not be removed. Please remove the file " "by hand and try again."))); } @@ -1272,8 +1272,8 @@ TouchSocketLockFiles(void) read(fd, buffer, sizeof(buffer)); close(fd); } -#endif /* HAVE_UTIMES */ -#endif /* HAVE_UTIME */ +#endif /* HAVE_UTIMES */ +#endif /* HAVE_UTIME */ } } @@ -1438,8 +1438,8 @@ RecheckDataDirLockFile(void) /* non-fatal, at least for now */ ereport(LOG, (errcode_for_file_access(), - errmsg("could not open file \"%s\": %m; continuing anyway", - DIRECTORY_LOCK_FILE))); + errmsg("could not open file \"%s\": %m; continuing anyway", + DIRECTORY_LOCK_FILE))); return true; } } @@ -1570,12 +1570,12 @@ load_libraries(const char *libraries, const char *gucname, bool restricted) /* Need a modifiable copy of string */ rawstring = pstrdup(libraries); - /* Parse string into list of identifiers */ - if (!SplitIdentifierString(rawstring, ',', &elemlist)) + /* Parse string into list of filename paths */ + if (!SplitDirectoriesString(rawstring, ',', &elemlist)) { /* syntax error in list */ + list_free_deep(elemlist); pfree(rawstring); - list_free(elemlist); ereport(LOG, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("invalid list syntax in parameter \"%s\"", @@ -1585,28 +1585,25 @@ load_libraries(const char *libraries, const char *gucname, bool restricted) foreach(l, elemlist) { - char *tok = (char *) lfirst(l); - char *filename; + /* Note that filename was already canonicalized */ + char *filename = (char *) lfirst(l); + char *expanded = NULL; - filename = pstrdup(tok); - canonicalize_path(filename); /* If restricting, insert $libdir/plugins if not mentioned already */ if (restricted && first_dir_separator(filename) == NULL) { - char *expanded; - expanded = psprintf("$libdir/plugins/%s", filename); - pfree(filename); filename = expanded; } load_file(filename, restricted); ereport(DEBUG1, (errmsg("loaded library \"%s\"", filename))); - pfree(filename); + if (expanded) + pfree(expanded); } + list_free_deep(elemlist); pfree(rawstring); - list_free(elemlist); } /* diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 778e7fc472..ec85af8e9e 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -280,7 +280,7 @@ PerformAuthentication(Port *port) set_ps_display("startup", false); - ClientAuthInProgress = false; /* client_min_messages is active now */ + ClientAuthInProgress = false; /* client_min_messages is active now */ } @@ -327,8 +327,8 @@ CheckMyDatabase(const char *name, bool am_superuser) if (!dbform->datallowconn) ereport(FATAL, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("database \"%s\" is not currently accepting connections", - name))); + errmsg("database \"%s\" is not currently accepting connections", + name))); /* * Check privilege to connect to the database. (The am_superuser test @@ -383,17 +383,17 @@ CheckMyDatabase(const char *name, bool am_superuser) if (pg_perm_setlocale(LC_COLLATE, collate) == NULL) ereport(FATAL, - (errmsg("database locale is incompatible with operating system"), - errdetail("The database was initialized with LC_COLLATE \"%s\", " - " which is not recognized by setlocale().", collate), - errhint("Recreate the database with another locale or install the missing locale."))); + (errmsg("database locale is incompatible with operating system"), + errdetail("The database was initialized with LC_COLLATE \"%s\", " + " which is not recognized by setlocale().", collate), + errhint("Recreate the database with another locale or install the missing locale."))); if (pg_perm_setlocale(LC_CTYPE, ctype) == NULL) ereport(FATAL, - (errmsg("database locale is incompatible with operating system"), - errdetail("The database was initialized with LC_CTYPE \"%s\", " - " which is not recognized by setlocale().", ctype), - errhint("Recreate the database with another locale or install the missing locale."))); + (errmsg("database locale is incompatible with operating system"), + errdetail("The database was initialized with LC_CTYPE \"%s\", " + " which is not recognized by setlocale().", ctype), + errhint("Recreate the database with another locale or install the missing locale."))); /* Make the locale settings visible as GUC variables, too */ SetConfigOption("lc_collate", collate, PGC_INTERNAL, PGC_S_OVERRIDE); @@ -765,7 +765,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, else ereport(FATAL, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to connect during database shutdown"))); + errmsg("must be superuser to connect during database shutdown"))); } /* @@ -775,7 +775,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, { ereport(FATAL, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser to connect in binary upgrade mode"))); + errmsg("must be superuser to connect in binary upgrade mode"))); } /* @@ -957,7 +957,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, ereport(FATAL, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname), - errdetail("It seems to have just been dropped or renamed."))); + errdetail("It seems to have just been dropped or renamed."))); } /* @@ -975,8 +975,8 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, (errcode(ERRCODE_UNDEFINED_DATABASE), errmsg("database \"%s\" does not exist", dbname), - errdetail("The database subdirectory \"%s\" is missing.", - fullpath))); + errdetail("The database subdirectory \"%s\" is missing.", + fullpath))); else ereport(FATAL, (errcode_for_file_access(), diff --git a/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c b/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c index c55bcc978c..83c2712eba 100644 --- a/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c +++ b/src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c @@ -261,7 +261,7 @@ shift_jis_20042euc_jis_2004(const unsigned char *sjis, unsigned char *p, int len /* * JIS X 0213 */ - if (c1 >= 0x81 && c1 <= 0x9f) /* plane 1 1ku-62ku */ + if (c1 >= 0x81 && c1 <= 0x9f) /* plane 1 1ku-62ku */ { ku = (c1 << 1) - 0x100; ten = get_ten(c2, &kubun); diff --git a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c index 09002a77d8..1d9b10f8a7 100644 --- a/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c +++ b/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/big5.c @@ -22,7 +22,7 @@ typedef struct } codes_t; /* map Big5 Level 1 to CNS 11643-1992 Plane 1 */ -static const codes_t big5Level1ToCnsPlane1[25] = { /* range */ +static const codes_t big5Level1ToCnsPlane1[25] = { /* range */ {0xA140, 0x2121}, {0xA1F6, 0x2258}, {0xA1F7, 0x2257}, @@ -51,7 +51,7 @@ static const codes_t big5Level1ToCnsPlane1[25] = { /* range */ }; /* map CNS 11643-1992 Plane 1 to Big5 Level 1 */ -static const codes_t cnsPlane1ToBig5Level1[26] = { /* range */ +static const codes_t cnsPlane1ToBig5Level1[26] = { /* range */ {0x2121, 0xA140}, {0x2257, 0xA1F7}, {0x2258, 0xA1F6}, @@ -81,7 +81,7 @@ static const codes_t cnsPlane1ToBig5Level1[26] = { /* range */ }; /* map Big5 Level 2 to CNS 11643-1992 Plane 2 */ -static const codes_t big5Level2ToCnsPlane2[48] = { /* range */ +static const codes_t big5Level2ToCnsPlane2[48] = { /* range */ {0xC940, 0x2121}, {0xc94a, 0x0000}, {0xC94B, 0x212B}, @@ -133,7 +133,7 @@ static const codes_t big5Level2ToCnsPlane2[48] = { /* range */ }; /* map CNS 11643-1992 Plane 2 to Big5 Level 2 */ -static const codes_t cnsPlane2ToBig5Level2[49] = { /* range */ +static const codes_t cnsPlane2ToBig5Level2[49] = { /* range */ {0x2121, 0xC940}, {0x212B, 0xC94B}, {0x214C, 0xC9BE}, diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c b/src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c index 1e6f3b3f19..b21167997c 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c @@ -43,7 +43,7 @@ euc_jis_2004_to_utf8(PG_FUNCTION_ARGS) LocalToUtf(src, len, dest, &euc_jis_2004_to_unicode_tree, - LUmapEUC_JIS_2004_combined, lengthof(LUmapEUC_JIS_2004_combined), + LUmapEUC_JIS_2004_combined, lengthof(LUmapEUC_JIS_2004_combined), NULL, PG_EUC_JIS_2004); @@ -61,7 +61,7 @@ utf8_to_euc_jis_2004(PG_FUNCTION_ARGS) UtfToLocal(src, len, dest, &euc_jis_2004_from_unicode_tree, - ULmapEUC_JIS_2004_combined, lengthof(ULmapEUC_JIS_2004_combined), + ULmapEUC_JIS_2004_combined, lengthof(ULmapEUC_JIS_2004_combined), NULL, PG_EUC_JIS_2004); diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c index ac0bc915ed..4e47cf66c5 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c @@ -60,37 +60,37 @@ PG_FUNCTION_INFO_V1(utf8_to_iso8859); typedef struct { pg_enc encoding; - const pg_mb_radix_tree *map1; /* to UTF8 map name */ - const pg_mb_radix_tree *map2; /* from UTF8 map name */ + const pg_mb_radix_tree *map1; /* to UTF8 map name */ + const pg_mb_radix_tree *map2; /* from UTF8 map name */ } pg_conv_map; static const pg_conv_map maps[] = { {PG_LATIN2, &iso8859_2_to_unicode_tree, - &iso8859_2_from_unicode_tree}, /* ISO-8859-2 Latin 2 */ + &iso8859_2_from_unicode_tree}, /* ISO-8859-2 Latin 2 */ {PG_LATIN3, &iso8859_3_to_unicode_tree, - &iso8859_3_from_unicode_tree}, /* ISO-8859-3 Latin 3 */ + &iso8859_3_from_unicode_tree}, /* ISO-8859-3 Latin 3 */ {PG_LATIN4, &iso8859_4_to_unicode_tree, - &iso8859_4_from_unicode_tree}, /* ISO-8859-4 Latin 4 */ + &iso8859_4_from_unicode_tree}, /* ISO-8859-4 Latin 4 */ {PG_LATIN5, &iso8859_9_to_unicode_tree, - &iso8859_9_from_unicode_tree}, /* ISO-8859-9 Latin 5 */ + &iso8859_9_from_unicode_tree}, /* ISO-8859-9 Latin 5 */ {PG_LATIN6, &iso8859_10_to_unicode_tree, - &iso8859_10_from_unicode_tree}, /* ISO-8859-10 Latin 6 */ + &iso8859_10_from_unicode_tree}, /* ISO-8859-10 Latin 6 */ {PG_LATIN7, &iso8859_13_to_unicode_tree, - &iso8859_13_from_unicode_tree}, /* ISO-8859-13 Latin 7 */ + &iso8859_13_from_unicode_tree}, /* ISO-8859-13 Latin 7 */ {PG_LATIN8, &iso8859_14_to_unicode_tree, - &iso8859_14_from_unicode_tree}, /* ISO-8859-14 Latin 8 */ + &iso8859_14_from_unicode_tree}, /* ISO-8859-14 Latin 8 */ {PG_LATIN9, &iso8859_15_to_unicode_tree, - &iso8859_15_from_unicode_tree}, /* ISO-8859-15 Latin 9 */ + &iso8859_15_from_unicode_tree}, /* ISO-8859-15 Latin 9 */ {PG_LATIN10, &iso8859_16_to_unicode_tree, - &iso8859_16_from_unicode_tree}, /* ISO-8859-16 Latin 10 */ + &iso8859_16_from_unicode_tree}, /* ISO-8859-16 Latin 10 */ {PG_ISO_8859_5, &iso8859_5_to_unicode_tree, - &iso8859_5_from_unicode_tree}, /* ISO-8859-5 */ + &iso8859_5_from_unicode_tree}, /* ISO-8859-5 */ {PG_ISO_8859_6, &iso8859_6_to_unicode_tree, - &iso8859_6_from_unicode_tree}, /* ISO-8859-6 */ + &iso8859_6_from_unicode_tree}, /* ISO-8859-6 */ {PG_ISO_8859_7, &iso8859_7_to_unicode_tree, - &iso8859_7_from_unicode_tree}, /* ISO-8859-7 */ + &iso8859_7_from_unicode_tree}, /* ISO-8859-7 */ {PG_ISO_8859_8, &iso8859_8_to_unicode_tree, - &iso8859_8_from_unicode_tree}, /* ISO-8859-8 */ + &iso8859_8_from_unicode_tree}, /* ISO-8859-8 */ }; Datum diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c b/src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c index f8eb725201..adc1c9e93c 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c @@ -43,7 +43,7 @@ shift_jis_2004_to_utf8(PG_FUNCTION_ARGS) LocalToUtf(src, len, dest, &shift_jis_2004_to_unicode_tree, - LUmapSHIFT_JIS_2004_combined, lengthof(LUmapSHIFT_JIS_2004_combined), + LUmapSHIFT_JIS_2004_combined, lengthof(LUmapSHIFT_JIS_2004_combined), NULL, PG_SHIFT_JIS_2004); @@ -61,7 +61,7 @@ utf8_to_shift_jis_2004(PG_FUNCTION_ARGS) UtfToLocal(src, len, dest, &shift_jis_2004_from_unicode_tree, - ULmapSHIFT_JIS_2004_combined, lengthof(ULmapSHIFT_JIS_2004_combined), + ULmapSHIFT_JIS_2004_combined, lengthof(ULmapSHIFT_JIS_2004_combined), NULL, PG_SHIFT_JIS_2004); diff --git a/src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c b/src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c index 971de32f6c..cec458c9f4 100644 --- a/src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c +++ b/src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c @@ -56,8 +56,8 @@ PG_FUNCTION_INFO_V1(utf8_to_win); typedef struct { pg_enc encoding; - const pg_mb_radix_tree *map1; /* to UTF8 map name */ - const pg_mb_radix_tree *map2; /* from UTF8 map name */ + const pg_mb_radix_tree *map1; /* to UTF8 map name */ + const pg_mb_radix_tree *map2; /* from UTF8 map name */ } pg_conv_map; static const pg_conv_map maps[] = { diff --git a/src/backend/utils/mb/encnames.c b/src/backend/utils/mb/encnames.c index f97505e55a..12b61cd3db 100644 --- a/src/backend/utils/mb/encnames.c +++ b/src/backend/utils/mb/encnames.c @@ -476,7 +476,7 @@ get_encoding_name_for_icu(int encoding) return icu_encoding_name; } -#endif /* not FRONTEND */ +#endif /* not FRONTEND */ /* ---------- diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c index 95644e3468..ca7f129ebe 100644 --- a/src/backend/utils/mb/mbutils.c +++ b/src/backend/utils/mb/mbutils.c @@ -374,8 +374,8 @@ pg_do_encoding_conversion(unsigned char *src, int len, ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("out of memory"), - errdetail("String of %d bytes is too long for encoding conversion.", - len))); + errdetail("String of %d bytes is too long for encoding conversion.", + len))); result = palloc(len * MAX_CONVERSION_GROWTH + 1); @@ -399,7 +399,7 @@ pg_convert_to(PG_FUNCTION_ARGS) Datum string = PG_GETARG_DATUM(0); Datum dest_encoding_name = PG_GETARG_DATUM(1); Datum src_encoding_name = DirectFunctionCall1(namein, - CStringGetDatum(DatabaseEncoding->name)); + CStringGetDatum(DatabaseEncoding->name)); Datum result; /* @@ -424,7 +424,7 @@ pg_convert_from(PG_FUNCTION_ARGS) Datum string = PG_GETARG_DATUM(0); Datum src_encoding_name = PG_GETARG_DATUM(1); Datum dest_encoding_name = DirectFunctionCall1(namein, - CStringGetDatum(DatabaseEncoding->name)); + CStringGetDatum(DatabaseEncoding->name)); Datum result; result = DirectFunctionCall3(pg_convert, string, @@ -606,9 +606,9 @@ pg_any_to_server(const char *s, int len, int encoding) if (s[i] == '\0' || IS_HIGHBIT_SET(s[i])) ereport(ERROR, (errcode(ERRCODE_CHARACTER_NOT_IN_REPERTOIRE), - errmsg("invalid byte value for encoding \"%s\": 0x%02x", - pg_enc2name_tbl[PG_SQL_ASCII].name, - (unsigned char) s[i]))); + errmsg("invalid byte value for encoding \"%s\": 0x%02x", + pg_enc2name_tbl[PG_SQL_ASCII].name, + (unsigned char) s[i]))); } } return (char *) s; @@ -707,8 +707,8 @@ perform_default_encoding_conversion(const char *src, int len, ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg("out of memory"), - errdetail("String of %d bytes is too long for encoding conversion.", - len))); + errdetail("String of %d bytes is too long for encoding conversion.", + len))); result = palloc(len * MAX_CONVERSION_GROWTH + 1); diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c index fd51eedf7c..765815a199 100644 --- a/src/backend/utils/mb/wchar.c +++ b/src/backend/utils/mb/wchar.c @@ -85,20 +85,20 @@ pg_euc2wchar_with_len(const unsigned char *from, pg_wchar *to, int len) *to = (SS2 << 8) | *from++; len -= 2; } - else if (*from == SS3 && len >= 3) /* JIS X 0212 KANJI */ + else if (*from == SS3 && len >= 3) /* JIS X 0212 KANJI */ { from++; *to = (SS3 << 16) | (*from++ << 8); *to |= *from++; len -= 3; } - else if (IS_HIGHBIT_SET(*from) && len >= 2) /* JIS X 0208 KANJI */ + else if (IS_HIGHBIT_SET(*from) && len >= 2) /* JIS X 0208 KANJI */ { *to = *from++ << 8; *to |= *from++; len -= 2; } - else /* must be ASCII */ + else /* must be ASCII */ { *to = *from++; len--; @@ -212,14 +212,14 @@ pg_euccn2wchar_with_len(const unsigned char *from, pg_wchar *to, int len) *to |= *from++; len -= 3; } - else if (*from == SS3 && len >= 3) /* code set 3 (unused ?) */ + else if (*from == SS3 && len >= 3) /* code set 3 (unused ?) */ { from++; *to = (SS3 << 16) | (*from++ << 8); *to |= *from++; len -= 3; } - else if (IS_HIGHBIT_SET(*from) && len >= 2) /* code set 1 */ + else if (IS_HIGHBIT_SET(*from) && len >= 2) /* code set 1 */ { *to = *from++ << 8; *to |= *from++; @@ -280,14 +280,14 @@ pg_euctw2wchar_with_len(const unsigned char *from, pg_wchar *to, int len) *to |= *from++; len -= 4; } - else if (*from == SS3 && len >= 3) /* code set 3 (unused?) */ + else if (*from == SS3 && len >= 3) /* code set 3 (unused?) */ { from++; *to = (SS3 << 16) | (*from++ << 8); *to |= *from++; len -= 3; } - else if (IS_HIGHBIT_SET(*from) && len >= 2) /* code set 2 */ + else if (IS_HIGHBIT_SET(*from) && len >= 2) /* code set 2 */ { *to = *from++ << 8; *to |= *from++; @@ -581,7 +581,7 @@ struct mbinterval /* auxiliary function for binary search in interval table */ static int -mbbisearch(pg_wchar ucs, const struct mbinterval * table, int max) +mbbisearch(pg_wchar ucs, const struct mbinterval *table, int max) { int min = 0; int mid; @@ -984,7 +984,7 @@ pg_sjis_dsplen(const unsigned char *s) else if (IS_HIGHBIT_SET(*s)) len = 2; /* kanji? */ else - len = pg_ascii_dsplen(s); /* should be ASCII */ + len = pg_ascii_dsplen(s); /* should be ASCII */ return len; } @@ -1011,7 +1011,7 @@ pg_big5_dsplen(const unsigned char *s) if (IS_HIGHBIT_SET(*s)) len = 2; /* kanji? */ else - len = pg_ascii_dsplen(s); /* should be ASCII */ + len = pg_ascii_dsplen(s); /* should be ASCII */ return len; } @@ -1038,7 +1038,7 @@ pg_gbk_dsplen(const unsigned char *s) if (IS_HIGHBIT_SET(*s)) len = 2; /* kanji? */ else - len = pg_ascii_dsplen(s); /* should be ASCII */ + len = pg_ascii_dsplen(s); /* should be ASCII */ return len; } @@ -1065,7 +1065,7 @@ pg_uhc_dsplen(const unsigned char *s) if (IS_HIGHBIT_SET(*s)) len = 2; /* 2byte? */ else - len = pg_ascii_dsplen(s); /* should be ASCII */ + len = pg_ascii_dsplen(s); /* should be ASCII */ return len; } @@ -1095,7 +1095,7 @@ pg_gb18030_dsplen(const unsigned char *s) if (IS_HIGHBIT_SET(*s)) len = 2; else - len = pg_ascii_dsplen(s); /* ASCII */ + len = pg_ascii_dsplen(s); /* ASCII */ return len; } @@ -1157,7 +1157,7 @@ pg_eucjp_verifier(const unsigned char *s, int len) break; default: - if (IS_HIGHBIT_SET(c1)) /* JIS X 0208? */ + if (IS_HIGHBIT_SET(c1)) /* JIS X 0208? */ { l = 2; if (l > len) @@ -1241,7 +1241,7 @@ pg_euctw_verifier(const unsigned char *s, int len) return -1; default: - if (IS_HIGHBIT_SET(c1)) /* CNS 11643 Plane 1 */ + if (IS_HIGHBIT_SET(c1)) /* CNS 11643 Plane 1 */ { l = 2; if (l > len) @@ -1683,7 +1683,7 @@ pg_eucjp_increment(unsigned char *charptr, int length) return false; default: - if (IS_HIGHBIT_SET(c1)) /* JIS X 0208? */ + if (IS_HIGHBIT_SET(c1)) /* JIS X 0208? */ { if (length != 2) return false; @@ -1717,7 +1717,7 @@ pg_eucjp_increment(unsigned char *charptr, int length) return true; } -#endif /* !FRONTEND */ +#endif /* !FRONTEND */ /* @@ -1734,40 +1734,40 @@ const pg_wchar_tbl pg_wchar_table[] = { {pg_euctw2wchar_with_len, pg_wchar2euc_with_len, pg_euctw_mblen, pg_euctw_dsplen, pg_euctw_verifier, 4}, /* PG_EUC_TW */ {pg_eucjp2wchar_with_len, pg_wchar2euc_with_len, pg_eucjp_mblen, pg_eucjp_dsplen, pg_eucjp_verifier, 3}, /* PG_EUC_JIS_2004 */ {pg_utf2wchar_with_len, pg_wchar2utf_with_len, pg_utf_mblen, pg_utf_dsplen, pg_utf8_verifier, 4}, /* PG_UTF8 */ - {pg_mule2wchar_with_len, pg_wchar2mule_with_len, pg_mule_mblen, pg_mule_dsplen, pg_mule_verifier, 4}, /* PG_MULE_INTERNAL */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN1 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN2 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN3 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN4 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN5 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN6 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN7 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN8 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN9 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN10 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1256 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1258 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN866 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN874 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_KOI8R */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1251 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1252 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* ISO-8859-5 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* ISO-8859-6 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* ISO-8859-7 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* ISO-8859-8 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1250 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1253 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1254 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1255 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1257 */ - {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_KOI8U */ + {pg_mule2wchar_with_len, pg_wchar2mule_with_len, pg_mule_mblen, pg_mule_dsplen, pg_mule_verifier, 4}, /* PG_MULE_INTERNAL */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN1 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN2 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN3 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN4 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN5 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN6 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN7 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN8 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN9 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_LATIN10 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1256 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1258 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN866 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN874 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_KOI8R */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1251 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1252 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* ISO-8859-5 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* ISO-8859-6 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* ISO-8859-7 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* ISO-8859-8 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1250 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1253 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1254 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1255 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_WIN1257 */ + {pg_latin12wchar_with_len, pg_wchar2single_with_len, pg_latin1_mblen, pg_latin1_dsplen, pg_latin1_verifier, 1}, /* PG_KOI8U */ {0, 0, pg_sjis_mblen, pg_sjis_dsplen, pg_sjis_verifier, 2}, /* PG_SJIS */ {0, 0, pg_big5_mblen, pg_big5_dsplen, pg_big5_verifier, 2}, /* PG_BIG5 */ {0, 0, pg_gbk_mblen, pg_gbk_dsplen, pg_gbk_verifier, 2}, /* PG_GBK */ {0, 0, pg_uhc_mblen, pg_uhc_dsplen, pg_uhc_verifier, 2}, /* PG_UHC */ - {0, 0, pg_gb18030_mblen, pg_gb18030_dsplen, pg_gb18030_verifier, 4}, /* PG_GB18030 */ - {0, 0, pg_johab_mblen, pg_johab_dsplen, pg_johab_verifier, 3}, /* PG_JOHAB */ + {0, 0, pg_gb18030_mblen, pg_gb18030_dsplen, pg_gb18030_verifier, 4}, /* PG_GB18030 */ + {0, 0, pg_johab_mblen, pg_johab_dsplen, pg_johab_verifier, 3}, /* PG_JOHAB */ {0, 0, pg_sjis_mblen, pg_sjis_dsplen, pg_sjis_verifier, 2} /* PG_SHIFT_JIS_2004 */ }; @@ -1785,8 +1785,8 @@ int pg_encoding_mblen(int encoding, const char *mbstr) { return (PG_VALID_ENCODING(encoding) ? - ((*pg_wchar_table[encoding].mblen) ((const unsigned char *) mbstr)) : - ((*pg_wchar_table[PG_SQL_ASCII].mblen) ((const unsigned char *) mbstr))); + ((*pg_wchar_table[encoding].mblen) ((const unsigned char *) mbstr)) : + ((*pg_wchar_table[PG_SQL_ASCII].mblen) ((const unsigned char *) mbstr))); } /* @@ -1796,8 +1796,8 @@ int pg_encoding_dsplen(int encoding, const char *mbstr) { return (PG_VALID_ENCODING(encoding) ? - ((*pg_wchar_table[encoding].dsplen) ((const unsigned char *) mbstr)) : - ((*pg_wchar_table[PG_SQL_ASCII].dsplen) ((const unsigned char *) mbstr))); + ((*pg_wchar_table[encoding].dsplen) ((const unsigned char *) mbstr)) : + ((*pg_wchar_table[PG_SQL_ASCII].dsplen) ((const unsigned char *) mbstr))); } /* @@ -2051,4 +2051,4 @@ report_untranslatable_char(int src_encoding, int dest_encoding, pg_enc2name_tbl[dest_encoding].name))); } -#endif /* !FRONTEND */ +#endif /* !FRONTEND */ diff --git a/src/backend/utils/misc/backend_random.c b/src/backend/utils/misc/backend_random.c index d8556143dc..4f18656fda 100644 --- a/src/backend/utils/misc/backend_random.c +++ b/src/backend/utils/misc/backend_random.c @@ -69,9 +69,9 @@ typedef struct { bool initialized; unsigned short seed[3]; -} BackendRandomShmemStruct; +} BackendRandomShmemStruct; -static BackendRandomShmemStruct *BackendRandomShmem; +static BackendRandomShmemStruct * BackendRandomShmem; Size BackendRandomShmemSize(void) @@ -155,4 +155,4 @@ pg_backend_random(char *dst, int len) } -#endif /* HAVE_STRONG_RANDOM */ +#endif /* HAVE_STRONG_RANDOM */ diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index f7391cc6b8..2deaf62455 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -160,15 +160,15 @@ static void do_serialize(char **destptr, Size *maxbytes, const char *fmt,...) pg static void set_config_sourcefile(const char *name, char *sourcefile, int sourceline); -static bool call_bool_check_hook(struct config_bool * conf, bool *newval, +static bool call_bool_check_hook(struct config_bool *conf, bool *newval, void **extra, GucSource source, int elevel); -static bool call_int_check_hook(struct config_int * conf, int *newval, +static bool call_int_check_hook(struct config_int *conf, int *newval, void **extra, GucSource source, int elevel); -static bool call_real_check_hook(struct config_real * conf, double *newval, +static bool call_real_check_hook(struct config_real *conf, double *newval, void **extra, GucSource source, int elevel); -static bool call_string_check_hook(struct config_string * conf, char **newval, +static bool call_string_check_hook(struct config_string *conf, char **newval, void **extra, GucSource source, int elevel); -static bool call_enum_check_hook(struct config_enum * conf, int *newval, +static bool call_enum_check_hook(struct config_enum *conf, int *newval, void **extra, GucSource source, int elevel); static bool check_log_destination(char **newval, void **extra, GucSource source); @@ -497,8 +497,8 @@ bool Debug_pretty_print = true; bool log_parser_stats = false; bool log_planner_stats = false; bool log_executor_stats = false; -bool log_statement_stats = false; /* this is sort of all three - * above together */ +bool log_statement_stats = false; /* this is sort of all three above + * together */ #ifdef XCP bool log_gtm_stats = false; bool log_remotesubplan_stats = false; @@ -1092,7 +1092,7 @@ static struct config_bool ConfigureNamesBool[] = {"fsync", PGC_SIGHUP, WAL_SETTINGS, gettext_noop("Forces synchronization of updates to disk."), gettext_noop("The server will use the fsync() system call in several places to make " - "sure that updates are physically written to disk. This insures " + "sure that updates are physically written to disk. This insures " "that a database cluster will recover to a consistent state after " "an operating system or hardware crash.") }, @@ -1104,10 +1104,10 @@ static struct config_bool ConfigureNamesBool[] = {"ignore_checksum_failure", PGC_SUSET, DEVELOPER_OPTIONS, gettext_noop("Continues processing after a checksum failure."), gettext_noop("Detection of a checksum failure normally causes PostgreSQL to " - "report an error, aborting the current transaction. Setting " + "report an error, aborting the current transaction. Setting " "ignore_checksum_failure to true causes the system to ignore the failure " - "(but still report a warning), and continue processing. This " - "behavior could cause crashes or other serious problems. Only " + "(but still report a warning), and continue processing. This " + "behavior could cause crashes or other serious problems. Only " "has an effect if checksums are enabled."), GUC_NOT_IN_SAMPLE }, @@ -1119,7 +1119,7 @@ static struct config_bool ConfigureNamesBool[] = {"zero_damaged_pages", PGC_SUSET, DEVELOPER_OPTIONS, gettext_noop("Continues processing past damaged page headers."), gettext_noop("Detection of a damaged page header normally causes PostgreSQL to " - "report an error, aborting the current transaction. Setting " + "report an error, aborting the current transaction. Setting " "zero_damaged_pages to true causes the system to instead report a " "warning, zero out the damaged page, and continue processing. This " "behavior will destroy data, namely all the rows on the damaged page."), @@ -1134,7 +1134,7 @@ static struct config_bool ConfigureNamesBool[] = gettext_noop("Writes full pages to WAL when first modified after a checkpoint."), gettext_noop("A page write in process during an operating system crash might be " "only partially written to disk. During recovery, the row changes " - "stored in WAL are not enough to recover. This option writes " + "stored in WAL are not enough to recover. This option writes " "pages when first modified after a checkpoint to WAL so full recovery " "is possible.") }, @@ -1470,8 +1470,8 @@ static struct config_bool ConfigureNamesBool[] = gettext_noop("Logs the host name in the connection logs."), gettext_noop("By default, connection logs only show the IP address " "of the connecting host. If you want them to show the host name you " - "can turn this on, but depending on your host name resolution " - "setup it might impose a non-negligible performance penalty.") + "can turn this on, but depending on your host name resolution " + "setup it might impose a non-negligible performance penalty.") }, &log_hostname, false, @@ -1481,9 +1481,9 @@ static struct config_bool ConfigureNamesBool[] = {"transform_null_equals", PGC_USERSET, COMPAT_OPTIONS_CLIENT, gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."), gettext_noop("When turned on, expressions of the form expr = NULL " - "(or NULL = expr) are treated as expr IS NULL, that is, they " - "return true if expr evaluates to the null value, and false " - "otherwise. The correct behavior of expr = NULL is to always " + "(or NULL = expr) are treated as expr IS NULL, that is, they " + "return true if expr evaluates to the null value, and false " + "otherwise. The correct behavior of expr = NULL is to always " "return null (unknown).") }, &Transform_null_equals, @@ -1769,7 +1769,7 @@ static struct config_bool ConfigureNamesBool[] = {"lo_compat_privileges", PGC_SUSET, COMPAT_OPTIONS_PREVIOUS, gettext_noop("Enables backward compatibility mode for privilege checks on large objects."), gettext_noop("Skips privilege checks when reading or modifying large objects, " - "for compatibility with PostgreSQL releases prior to 9.0.") + "for compatibility with PostgreSQL releases prior to 9.0.") }, &lo_compat_privileges, false, @@ -1861,7 +1861,7 @@ static struct config_int ConfigureNamesInt[] = {"default_statistics_target", PGC_USERSET, QUERY_TUNING_OTHER, gettext_noop("Sets the default statistics target."), gettext_noop("This applies to table columns that have not had a " - "column-specific target set via ALTER TABLE SET STATISTICS.") + "column-specific target set via ALTER TABLE SET STATISTICS.") }, &default_statistics_target, 100, 1, 10000, @@ -1872,7 +1872,7 @@ static struct config_int ConfigureNamesInt[] = gettext_noop("Sets the FROM-list size beyond which subqueries " "are not collapsed."), gettext_noop("The planner will merge subqueries into upper " - "queries if the resulting FROM list would have no more than " + "queries if the resulting FROM list would have no more than " "this many items.") }, &from_collapse_limit, @@ -2343,7 +2343,7 @@ static struct config_int ConfigureNamesInt[] = {"max_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT, gettext_noop("Sets the maximum number of locks per transaction."), gettext_noop("The shared lock table is sized on the assumption that " - "at most max_locks_per_transaction * max_connections distinct " + "at most max_locks_per_transaction * max_connections distinct " "objects will need to be locked at any one time.") }, &max_locks_per_xact, @@ -2378,7 +2378,7 @@ static struct config_int ConfigureNamesInt[] = {"max_pred_locks_per_page", PGC_SIGHUP, LOCK_MANAGEMENT, gettext_noop("Sets the maximum number of predicate-locked tuples per page."), gettext_noop("If more than this number of tuples on the same page are locked " - "by a connection, those locks are replaced by a page level lock.") + "by a connection, those locks are replaced by a page level lock.") }, &max_predicate_locks_per_page, 2, 0, INT_MAX, @@ -2456,7 +2456,7 @@ static struct config_int ConfigureNamesInt[] = gettext_noop("Enables warnings if checkpoint segments are filled more " "frequently than this."), gettext_noop("Write a message to the server log if checkpoints " - "caused by the filling of checkpoint segment files happens more " + "caused by the filling of checkpoint segment files happens more " "frequently than this number of seconds. Zero turns off the warning."), GUC_UNIT_S }, @@ -2569,7 +2569,7 @@ static struct config_int ConfigureNamesInt[] = {"extra_float_digits", PGC_USERSET, CLIENT_CONN_LOCALE, gettext_noop("Sets the number of digits displayed for floating-point values."), gettext_noop("This affects real, double precision, and geometric data types. " - "The parameter value is added to the standard number of digits " + "The parameter value is added to the standard number of digits " "(FLT_DIG or DBL_DIG as appropriate).") }, &extra_float_digits, @@ -3265,7 +3265,7 @@ static struct config_real ConfigureNamesReal[] = { {"parallel_tuple_cost", PGC_USERSET, QUERY_TUNING_COST, gettext_noop("Sets the planner's estimate of the cost of " - "passing each tuple (row) from worker to master backend."), + "passing each tuple (row) from worker to master backend."), NULL }, ¶llel_tuple_cost, @@ -4325,7 +4325,7 @@ static struct config_enum ConfigureNamesEnum[] = {"password_encryption", PGC_USERSET, CONN_AUTH_SECURITY, gettext_noop("Encrypt passwords."), gettext_noop("When a password is specified in CREATE USER or " - "ALTER USER without writing either ENCRYPTED or UNENCRYPTED, " + "ALTER USER without writing either ENCRYPTED or UNENCRYPTED, " "this parameter determines whether the password is to be encrypted.") }, &Password_encryption, @@ -4377,17 +4377,17 @@ static int GUCNestLevel = 0; /* 1 when in main transaction */ static int guc_var_compare(const void *a, const void *b); static int guc_name_compare(const char *namea, const char *nameb); static void InitializeGUCOptionsFromEnvironment(void); -static void InitializeOneGUCOption(struct config_generic * gconf); -static void push_old_value(struct config_generic * gconf, GucAction action); -static void ReportGUCOption(struct config_generic * record); -static void reapply_stacked_values(struct config_generic * variable, - struct config_string * pHolder, +static void InitializeOneGUCOption(struct config_generic *gconf); +static void push_old_value(struct config_generic *gconf, GucAction action); +static void ReportGUCOption(struct config_generic *record); +static void reapply_stacked_values(struct config_generic *variable, + struct config_string *pHolder, GucStack *stack, const char *curvalue, GucContext curscontext, GucSource cursource); static void ShowGUCConfigOption(const char *name, DestReceiver *dest); static void ShowAllGUCConfig(DestReceiver *dest); -static char *_ShowOption(struct config_generic * record, bool use_units); +static char *_ShowOption(struct config_generic *record, bool use_units); static bool validate_option_array_item(const char *name, const char *value, bool skipIfNoPermissions); static void write_auto_conf_file(int fd, const char *filename, ConfigVariable *head_p); @@ -4448,7 +4448,7 @@ guc_strdup(int elevel, const char *src) * Detect whether strval is referenced anywhere in a GUC string item */ static bool -string_field_used(struct config_string * conf, char *strval) +string_field_used(struct config_string *conf, char *strval) { GucStack *stack; @@ -4471,7 +4471,7 @@ string_field_used(struct config_string * conf, char *strval) * states). */ static void -set_string_field(struct config_string * conf, char **field, char *newval) +set_string_field(struct config_string *conf, char **field, char *newval) { char *oldval = *field; @@ -4487,7 +4487,7 @@ set_string_field(struct config_string * conf, char **field, char *newval) * Detect whether an "extra" struct is referenced anywhere in a GUC item */ static bool -extra_field_used(struct config_generic * gconf, void *extra) +extra_field_used(struct config_generic *gconf, void *extra) { GucStack *stack; @@ -4532,7 +4532,7 @@ extra_field_used(struct config_generic * gconf, void *extra) * states). */ static void -set_extra_field(struct config_generic * gconf, void **field, void *newval) +set_extra_field(struct config_generic *gconf, void **field, void *newval) { void *oldval = *field; @@ -4552,7 +4552,7 @@ set_extra_field(struct config_generic * gconf, void **field, void *newval) * initialized to NULL before this is used, else we'll try to free() them. */ static void -set_stack_value(struct config_generic * gconf, config_var_value *val) +set_stack_value(struct config_generic *gconf, config_var_value *val) { switch (gconf->vartype) { @@ -4586,7 +4586,7 @@ set_stack_value(struct config_generic * gconf, config_var_value *val) * The "extra" field associated with the stack entry is cleared, too. */ static void -discard_stack_value(struct config_generic * gconf, config_var_value *val) +discard_stack_value(struct config_generic *gconf, config_var_value *val) { switch (gconf->vartype) { @@ -4709,7 +4709,7 @@ build_guc_variables(void) * list is expanded if needed. */ static bool -add_guc_variable(struct config_generic * var, int elevel) +add_guc_variable(struct config_generic *var, int elevel) { if (num_guc_variables + 1 >= size_guc_variables) { @@ -4846,8 +4846,8 @@ find_option(const char *name, bool create_placeholders, int elevel) static int guc_var_compare(const void *a, const void *b) { - const struct config_generic *confa = *(struct config_generic * const *) a; - const struct config_generic *confb = *(struct config_generic * const *) b; + const struct config_generic *confa = *(struct config_generic *const *) a; + const struct config_generic *confb = *(struct config_generic *const *) b; return guc_name_compare(confa->name, confb->name); } @@ -4992,7 +4992,7 @@ InitializeGUCOptionsFromEnvironment(void) * might fail, but that the hooks might wish to compute an "extra" struct. */ static void -InitializeOneGUCOption(struct config_generic * gconf) +InitializeOneGUCOption(struct config_generic *gconf) { gconf->status = 0; gconf->source = PGC_S_DEFAULT; @@ -5387,7 +5387,7 @@ ResetAllOptions(void) * Push previous state during transactional assignment to a GUC variable. */ static void -push_old_value(struct config_generic * gconf, GucAction action) +push_old_value(struct config_generic *gconf, GucAction action) { GucStack *stack; @@ -5564,7 +5564,7 @@ AtEOXact_GUC(bool isCommit, int nestLevel) /* we keep the current active value */ discard_stack_value(gconf, &stack->prior); } - else /* must be GUC_LOCAL */ + else /* must be GUC_LOCAL */ restorePrior = true; } else if (prev == NULL || @@ -5823,7 +5823,7 @@ BeginReportingGUCOptions(void) * ReportGUCOption: if appropriate, transmit option value to frontend */ static void -ReportGUCOption(struct config_generic * record) +ReportGUCOption(struct config_generic *record) { if (reporting_enabled && (record->flags & GUC_REPORT)) { @@ -6052,7 +6052,7 @@ parse_real(const char *value, double *result) * allocated for modification. */ const char * -config_enum_lookup_by_value(struct config_enum * record, int val) +config_enum_lookup_by_value(struct config_enum *record, int val) { const struct config_enum_entry *entry; @@ -6075,7 +6075,7 @@ config_enum_lookup_by_value(struct config_enum * record, int val) * true. If it's not found, return FALSE and retval is set to 0. */ bool -config_enum_lookup_by_name(struct config_enum * record, const char *value, +config_enum_lookup_by_name(struct config_enum *record, const char *value, int *retval) { const struct config_enum_entry *entry; @@ -6101,7 +6101,7 @@ config_enum_lookup_by_name(struct config_enum * record, const char *value, * If suffix is non-NULL, it is added to the end of the string. */ static char * -config_enum_get_options(struct config_enum * record, const char *prefix, +config_enum_get_options(struct config_enum *record, const char *prefix, const char *suffix, const char *separator) { const struct config_enum_entry *entry; @@ -6159,10 +6159,10 @@ config_enum_get_options(struct config_enum * record, const char *prefix, * Returns true if OK, false if not (or throws error, if elevel >= ERROR) */ static bool -parse_and_validate_value(struct config_generic * record, +parse_and_validate_value(struct config_generic *record, const char *name, const char *value, GucSource source, int elevel, - union config_var_val * newval, void **newextra) + union config_var_val *newval, void **newextra) { switch (record->vartype) { @@ -6174,8 +6174,8 @@ parse_and_validate_value(struct config_generic * record, { ereport(elevel, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("parameter \"%s\" requires a Boolean value", - name))); + errmsg("parameter \"%s\" requires a Boolean value", + name))); return false; } @@ -6194,8 +6194,8 @@ parse_and_validate_value(struct config_generic * record, { ereport(elevel, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid value for parameter \"%s\": \"%s\"", - name, value), + errmsg("invalid value for parameter \"%s\": \"%s\"", + name, value), hintmsg ? errhint("%s", _(hintmsg)) : 0)); return false; } @@ -6223,8 +6223,8 @@ parse_and_validate_value(struct config_generic * record, { ereport(elevel, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("parameter \"%s\" requires a numeric value", - name))); + errmsg("parameter \"%s\" requires a numeric value", + name))); return false; } @@ -6287,8 +6287,8 @@ parse_and_validate_value(struct config_generic * record, ereport(elevel, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid value for parameter \"%s\": \"%s\"", - name, value), + errmsg("invalid value for parameter \"%s\": \"%s\"", + name, value), hintmsg ? errhint("%s", _(hintmsg)) : 0)); if (hintmsg) @@ -6402,14 +6402,14 @@ set_config_option(const char *name, const char *value, if (IsInParallelMode() && changeVal && action != GUC_ACTION_SAVE) ereport(elevel, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), - errmsg("cannot set parameters during a parallel operation"))); + errmsg("cannot set parameters during a parallel operation"))); record = find_option(name, true, elevel); if (record == NULL) { ereport(elevel, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("unrecognized configuration parameter \"%s\"", name))); + errmsg("unrecognized configuration parameter \"%s\"", name))); return 0; } @@ -7249,7 +7249,7 @@ GetConfigOption(const char *name, bool missing_ok, bool restrict_superuser) case PGC_ENUM: return config_enum_lookup_by_value((struct config_enum *) record, - *((struct config_enum *) record)->variable); + *((struct config_enum *) record)->variable); } return NULL; } @@ -7271,7 +7271,7 @@ GetConfigOptionResetString(const char *name) if (record == NULL) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("unrecognized configuration parameter \"%s\"", name))); + errmsg("unrecognized configuration parameter \"%s\"", name))); if ((record->flags & GUC_SUPERUSER_ONLY) && !is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_SETTINGS)) ereport(ERROR, @@ -7299,7 +7299,7 @@ GetConfigOptionResetString(const char *name) case PGC_ENUM: return config_enum_lookup_by_value((struct config_enum *) record, - ((struct config_enum *) record)->reset_val); + ((struct config_enum *) record)->reset_val); } return NULL; } @@ -7553,7 +7553,7 @@ replace_auto_config_value(ConfigVariable **head_p, ConfigVariable **tail_p, item->name = pstrdup(name); item->value = pstrdup(value); item->errmsg = NULL; - item->filename = pstrdup(""); /* new item has no location */ + item->filename = pstrdup(""); /* new item has no location */ item->sourceline = 0; item->ignore = false; item->applied = false; @@ -7594,7 +7594,7 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt) if (!superuser()) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("must be superuser to execute ALTER SYSTEM command")))); + (errmsg("must be superuser to execute ALTER SYSTEM command")))); /* * Extract statement arguments @@ -7806,7 +7806,7 @@ ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel) if (IsInParallelMode()) ereport(ERROR, (errcode(ERRCODE_INVALID_TRANSACTION_STATE), - errmsg("cannot set parameters during a parallel operation"))); + errmsg("cannot set parameters during a parallel operation"))); switch (stmt->kind) { @@ -8067,7 +8067,7 @@ init_custom_variable(const char *name, * variable into the GUC variable array, replacing any placeholder. */ static void -define_custom_variable(struct config_generic * variable) +define_custom_variable(struct config_generic *variable) { const char *name = variable->name; const char **nameAddr = &name; @@ -8167,8 +8167,8 @@ define_custom_variable(struct config_generic * variable) * fashion implied by the stack entry. */ static void -reapply_stacked_values(struct config_generic * variable, - struct config_string * pHolder, +reapply_stacked_values(struct config_generic *variable, + struct config_string *pHolder, GucStack *stack, const char *curvalue, GucContext curscontext, GucSource cursource) @@ -8210,7 +8210,7 @@ reapply_stacked_values(struct config_generic * variable, case GUC_SET_LOCAL: /* first, apply the masked value as SET */ (void) set_config_option(name, stack->masked.val.stringval, - stack->masked_scontext, PGC_S_SESSION, + stack->masked_scontext, PGC_S_SESSION, GUC_ACTION_SET, true, WARNING, false); /* then apply the current value as LOCAL */ @@ -8364,7 +8364,7 @@ DefineCustomEnumVariable(const char *name, const char *long_desc, int *valueAddr, int bootValue, - const struct config_enum_entry * options, + const struct config_enum_entry *options, GucContext context, int flags, GucEnumCheckHook check_hook, @@ -8570,7 +8570,7 @@ GetConfigOptionByName(const char *name, const char **varname, bool missing_ok) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("unrecognized configuration parameter \"%s\"", name))); + errmsg("unrecognized configuration parameter \"%s\"", name))); } if ((record->flags & GUC_SUPERUSER_ONLY) && @@ -8800,11 +8800,11 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow) /* boot_val */ values[12] = pstrdup(config_enum_lookup_by_value(lconf, - lconf->boot_val)); + lconf->boot_val)); /* reset_val */ values[13] = pstrdup(config_enum_lookup_by_value(lconf, - lconf->reset_val)); + lconf->reset_val)); } break; @@ -9152,7 +9152,7 @@ show_all_file_settings(PG_FUNCTION_ARGS) } static char * -_ShowOption(struct config_generic * record, bool use_units) +_ShowOption(struct config_generic *record, bool use_units) { char buffer[256]; const char *val; @@ -9263,7 +9263,7 @@ _ShowOption(struct config_generic * record, bool use_units) * variable scontext, integer */ static void -write_one_nondefault_variable(FILE *fp, struct config_generic * gconf) +write_one_nondefault_variable(FILE *fp, struct config_generic *gconf) { if (gconf->source == PGC_S_DEFAULT) return; @@ -9478,7 +9478,7 @@ read_nondefault_variables(void) FreeFile(fp); } -#endif /* EXEC_BACKEND */ +#endif /* EXEC_BACKEND */ /* * can_skip_gucvar: @@ -9499,7 +9499,7 @@ read_nondefault_variables(void) * never sends these, and RestoreGUCState() never changes them. */ static bool -can_skip_gucvar(struct config_generic * gconf) +can_skip_gucvar(struct config_generic *gconf) { return gconf->context == PGC_POSTMASTER || gconf->context == PGC_INTERNAL || gconf->source == PGC_S_DEFAULT; @@ -9512,7 +9512,7 @@ can_skip_gucvar(struct config_generic * gconf) * It's OK to overestimate, but not to underestimate. */ static Size -estimate_variable_size(struct config_generic * gconf) +estimate_variable_size(struct config_generic *gconf) { Size size; Size valsize = 0; @@ -9684,7 +9684,7 @@ do_serialize_binary(char **destptr, Size *maxbytes, void *val, Size valsize) */ static void serialize_variable(char **destptr, Size *maxbytes, - struct config_generic * gconf) + struct config_generic *gconf) { if (can_skip_gucvar(gconf)) return; @@ -9734,7 +9734,7 @@ serialize_variable(char **destptr, Size *maxbytes, struct config_enum *conf = (struct config_enum *) gconf; do_serialize(destptr, maxbytes, "%s", - config_enum_lookup_by_value(conf, *conf->variable)); + config_enum_lookup_by_value(conf, *conf->variable)); } break; } @@ -10305,7 +10305,7 @@ GUC_check_errcode(int sqlerrcode) */ static bool -call_bool_check_hook(struct config_bool * conf, bool *newval, void **extra, +call_bool_check_hook(struct config_bool *conf, bool *newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -10339,7 +10339,7 @@ call_bool_check_hook(struct config_bool * conf, bool *newval, void **extra, } static bool -call_int_check_hook(struct config_int * conf, int *newval, void **extra, +call_int_check_hook(struct config_int *conf, int *newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -10373,7 +10373,7 @@ call_int_check_hook(struct config_int * conf, int *newval, void **extra, } static bool -call_real_check_hook(struct config_real * conf, double *newval, void **extra, +call_real_check_hook(struct config_real *conf, double *newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -10407,7 +10407,7 @@ call_real_check_hook(struct config_real * conf, double *newval, void **extra, } static bool -call_string_check_hook(struct config_string * conf, char **newval, void **extra, +call_string_check_hook(struct config_string *conf, char **newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -10441,7 +10441,7 @@ call_string_check_hook(struct config_string * conf, char **newval, void **extra, } static bool -call_enum_check_hook(struct config_enum * conf, int *newval, void **extra, +call_enum_check_hook(struct config_enum *conf, int *newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -10973,7 +10973,7 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source) return false; #else return true; -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } static void @@ -10981,7 +10981,7 @@ assign_effective_io_concurrency(int newval, void *extra) { #ifdef USE_PREFETCH target_prefetch_pages = *((int *) extra); -#endif /* USE_PREFETCH */ +#endif /* USE_PREFETCH */ } static void @@ -10993,13 +10993,13 @@ assign_pgstat_temp_directory(const char *newval, void *extra) char *fname; /* directory */ - dname = guc_malloc(ERROR, strlen(newval) + 1); /* runtime dir */ + dname = guc_malloc(ERROR, strlen(newval) + 1); /* runtime dir */ sprintf(dname, "%s", newval); /* global stats */ - tname = guc_malloc(ERROR, strlen(newval) + 12); /* /global.tmp */ + tname = guc_malloc(ERROR, strlen(newval) + 12); /* /global.tmp */ sprintf(tname, "%s/global.tmp", newval); - fname = guc_malloc(ERROR, strlen(newval) + 13); /* /global.stat */ + fname = guc_malloc(ERROR, strlen(newval) + 13); /* /global.stat */ sprintf(fname, "%s/global.stat", newval); if (pgstat_stat_directory) diff --git a/src/backend/utils/misc/help_config.c b/src/backend/utils/misc/help_config.c index 7bc8f92f6d..08d563d1ae 100644 --- a/src/backend/utils/misc/help_config.c +++ b/src/backend/utils/misc/help_config.c @@ -124,7 +124,7 @@ printMixedStruct(mixedStruct *structToPrint) case PGC_ENUM: printf("ENUM\t%s\t\t\t", config_enum_lookup_by_value(&structToPrint->_enum, - structToPrint->_enum.boot_val)); + structToPrint->_enum.boot_val)); break; default: diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c index 56ba301e5a..0dbfe7f952 100644 --- a/src/backend/utils/misc/pg_controldata.c +++ b/src/backend/utils/misc/pg_controldata.c @@ -167,8 +167,8 @@ pg_control_checkpoint(PG_FUNCTION_ARGS) nulls[6] = false; values[7] = CStringGetTextDatum(psprintf("%u:%u", - ControlFile->checkPointCopy.nextXidEpoch, - ControlFile->checkPointCopy.nextXid)); + ControlFile->checkPointCopy.nextXidEpoch, + ControlFile->checkPointCopy.nextXid)); nulls[7] = false; values[8] = ObjectIdGetDatum(ControlFile->checkPointCopy.nextOid); @@ -202,7 +202,7 @@ pg_control_checkpoint(PG_FUNCTION_ARGS) nulls[17] = false; values[18] = TimestampTzGetDatum( - time_t_to_timestamptz(ControlFile->checkPointCopy.time)); + time_t_to_timestamptz(ControlFile->checkPointCopy.time)); nulls[18] = false; htup = heap_form_tuple(tupdesc, values, nulls); diff --git a/src/backend/utils/misc/pg_rusage.c b/src/backend/utils/misc/pg_rusage.c index 98fa7ea9a8..df643d798c 100644 --- a/src/backend/utils/misc/pg_rusage.c +++ b/src/backend/utils/misc/pg_rusage.c @@ -63,9 +63,9 @@ pg_rusage_show(const PGRUsage *ru0) snprintf(result, sizeof(result), _("CPU: user: %d.%02d s, system: %d.%02d s, elapsed: %d.%02d s"), (int) (ru1.ru.ru_utime.tv_sec - ru0->ru.ru_utime.tv_sec), - (int) (ru1.ru.ru_utime.tv_usec - ru0->ru.ru_utime.tv_usec) / 10000, + (int) (ru1.ru.ru_utime.tv_usec - ru0->ru.ru_utime.tv_usec) / 10000, (int) (ru1.ru.ru_stime.tv_sec - ru0->ru.ru_stime.tv_sec), - (int) (ru1.ru.ru_stime.tv_usec - ru0->ru.ru_stime.tv_usec) / 10000, + (int) (ru1.ru.ru_stime.tv_usec - ru0->ru.ru_stime.tv_usec) / 10000, (int) (ru1.tv.tv_sec - ru0->tv.tv_sec), (int) (ru1.tv.tv_usec - ru0->tv.tv_usec) / 10000); diff --git a/src/backend/utils/misc/ps_status.c b/src/backend/utils/misc/ps_status.c index 4007a17800..5742de0802 100644 --- a/src/backend/utils/misc/ps_status.c +++ b/src/backend/utils/misc/ps_status.c @@ -93,11 +93,11 @@ static const size_t ps_buffer_size = PS_BUFFER_SIZE; static char *ps_buffer; /* will point to argv area */ static size_t ps_buffer_size; /* space determined at run time */ static size_t last_status_len; /* use to minimize length of clobber */ -#endif /* PS_USE_CLOBBER_ARGV */ +#endif /* PS_USE_CLOBBER_ARGV */ static size_t ps_buffer_cur_len; /* nominal strlen(ps_buffer) */ -static size_t ps_buffer_fixed_size; /* size of the constant prefix */ +static size_t ps_buffer_fixed_size; /* size of the constant prefix */ /* save the original argv[] location here */ static int save_argc; @@ -183,7 +183,7 @@ save_ps_display_args(int argc, char **argv) new_environ[i] = NULL; environ = new_environ; } -#endif /* PS_USE_CLOBBER_ARGV */ +#endif /* PS_USE_CLOBBER_ARGV */ #if defined(PS_USE_CHANGE_ARGV) || defined(PS_USE_CLOBBER_ARGV) @@ -231,7 +231,7 @@ save_ps_display_args(int argc, char **argv) argv = new_argv; } -#endif /* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */ +#endif /* PS_USE_CHANGE_ARGV or PS_USE_CLOBBER_ARGV */ return argv; } @@ -270,7 +270,7 @@ init_ps_display(const char *username, const char *dbname, #ifdef PS_USE_CHANGE_ARGV save_argv[0] = ps_buffer; save_argv[1] = NULL; -#endif /* PS_USE_CHANGE_ARGV */ +#endif /* PS_USE_CHANGE_ARGV */ #ifdef PS_USE_CLOBBER_ARGV { @@ -280,7 +280,7 @@ init_ps_display(const char *username, const char *dbname, for (i = 1; i < save_argc; i++) save_argv[i] = ps_buffer + ps_buffer_size; } -#endif /* PS_USE_CLOBBER_ARGV */ +#endif /* PS_USE_CLOBBER_ARGV */ /* * Make fixed prefix of ps display. @@ -313,7 +313,7 @@ init_ps_display(const char *username, const char *dbname, ps_buffer_cur_len = ps_buffer_fixed_size = strlen(ps_buffer); set_ps_display(initial_str, true); -#endif /* not PS_USE_NONE */ +#endif /* not PS_USE_NONE */ } @@ -358,12 +358,12 @@ set_ps_display(const char *activity, bool force) pst.pst_command = ps_buffer; pstat(PSTAT_SETCMD, pst, ps_buffer_cur_len, 0, 0); } -#endif /* PS_USE_PSTAT */ +#endif /* PS_USE_PSTAT */ #ifdef PS_USE_PS_STRINGS PS_STRINGS->ps_nargvstr = 1; PS_STRINGS->ps_argvstr = ps_buffer; -#endif /* PS_USE_PS_STRINGS */ +#endif /* PS_USE_PS_STRINGS */ #ifdef PS_USE_CLOBBER_ARGV /* pad unused memory; need only clobber remainder of old status string */ @@ -371,7 +371,7 @@ set_ps_display(const char *activity, bool force) MemSet(ps_buffer + ps_buffer_cur_len, PS_PADDING, last_status_len - ps_buffer_cur_len); last_status_len = ps_buffer_cur_len; -#endif /* PS_USE_CLOBBER_ARGV */ +#endif /* PS_USE_CLOBBER_ARGV */ #ifdef PS_USE_WIN32 { @@ -390,8 +390,8 @@ set_ps_display(const char *activity, bool force) ident_handle = CreateEvent(NULL, TRUE, FALSE, name); } -#endif /* PS_USE_WIN32 */ -#endif /* not PS_USE_NONE */ +#endif /* PS_USE_WIN32 */ +#endif /* not PS_USE_NONE */ } diff --git a/src/backend/utils/misc/sampling.c b/src/backend/utils/misc/sampling.c index c36459ebad..b618ed1d7e 100644 --- a/src/backend/utils/misc/sampling.c +++ b/src/backend/utils/misc/sampling.c @@ -59,8 +59,8 @@ BlockSampler_HasMore(BlockSampler bs) BlockNumber BlockSampler_Next(BlockSampler bs) { - BlockNumber K = bs->N - bs->t; /* remaining blocks */ - int k = bs->n - bs->m; /* blocks still to sample */ + BlockNumber K = bs->N - bs->t; /* remaining blocks */ + int k = bs->n - bs->m; /* blocks still to sample */ double p; /* probability to skip block */ double V; /* random */ @@ -150,7 +150,7 @@ reservoir_get_next_S(ReservoirState rs, double t, int n) double V, quot; - V = sampler_random_fract(rs->randstate); /* Generate V */ + V = sampler_random_fract(rs->randstate); /* Generate V */ S = 0; t += 1; /* Note: "num" in Vitter's code is always equal to t - n */ @@ -211,7 +211,7 @@ reservoir_get_next_S(ReservoirState rs, double t, int n) y *= numer / denom; denom -= 1; } - W = exp(-log(sampler_random_fract(rs->randstate)) / n); /* Generate W in advance */ + W = exp(-log(sampler_random_fract(rs->randstate)) / n); /* Generate W in advance */ if (exp(log(y) / n) <= (t + X) / t) break; } diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index 45d793c1e8..7033042e2d 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -99,7 +99,7 @@ #define ALLOC_BLOCKHDRSZ MAXALIGN(sizeof(AllocBlockData)) #define ALLOC_CHUNKHDRSZ sizeof(struct AllocChunkData) -typedef struct AllocBlockData *AllocBlock; /* forward reference */ +typedef struct AllocBlockData *AllocBlock; /* forward reference */ typedef struct AllocChunkData *AllocChunk; /* @@ -122,7 +122,7 @@ typedef struct AllocSetContext MemoryContextData header; /* Standard memory-context fields */ /* Info about storage allocated in this context: */ AllocBlock blocks; /* head of list of blocks in this set */ - AllocChunk freelist[ALLOCSET_NUM_FREELISTS]; /* free chunk lists */ + AllocChunk freelist[ALLOCSET_NUM_FREELISTS]; /* free chunk lists */ /* Allocation parameters for this context: */ Size initBlockSize; /* initial block size */ Size maxBlockSize; /* maximum block size */ @@ -152,7 +152,7 @@ typedef struct AllocBlockData AllocBlock next; /* next block in aset's blocks list, if any */ char *freeptr; /* start of free space in this block */ char *endptr; /* end of space in this block */ -} AllocBlockData; +} AllocBlockData; /* * AllocChunk @@ -170,13 +170,13 @@ typedef struct AllocChunkData Size padding; #endif -#endif /* MEMORY_CONTEXT_CHECKING */ +#endif /* MEMORY_CONTEXT_CHECKING */ /* aset is the owning aset if allocated, or the freelist link if free */ void *aset; /* there must not be any padding to reach a MAXALIGN boundary here! */ -} AllocChunkData; +} AllocChunkData; /* * AllocPointerIsValid @@ -721,7 +721,7 @@ AllocSetAlloc(MemoryContext context, Size size) chunk->size = availchunk; #ifdef MEMORY_CONTEXT_CHECKING - chunk->requested_size = 0; /* mark it free */ + chunk->requested_size = 0; /* mark it free */ #endif chunk->aset = (void *) set->freelist[a_fidx]; set->freelist[a_fidx] = chunk; @@ -1181,7 +1181,7 @@ AllocSetStats(MemoryContext context, int level, bool print, for (i = 0; i < level; i++) fprintf(stderr, " "); fprintf(stderr, - "%s: %zu total in %zd blocks; %zu free (%zd chunks); %zu used\n", + "%s: %zu total in %zd blocks; %zu free (%zd chunks); %zu used\n", set->header.name, totalspace, nblocks, freespace, freechunks, totalspace - freespace); } @@ -1252,10 +1252,10 @@ AllocSetCheck(MemoryContext context) Size chsize, dsize; - chsize = chunk->size; /* aligned chunk size */ + chsize = chunk->size; /* aligned chunk size */ VALGRIND_MAKE_MEM_DEFINED(&chunk->requested_size, sizeof(chunk->requested_size)); - dsize = chunk->requested_size; /* real data */ + dsize = chunk->requested_size; /* real data */ if (dsize > 0) /* not on a free list */ VALGRIND_MAKE_MEM_NOACCESS(&chunk->requested_size, sizeof(chunk->requested_size)); @@ -1305,4 +1305,4 @@ AllocSetCheck(MemoryContext context) } } -#endif /* MEMORY_CONTEXT_CHECKING */ +#endif /* MEMORY_CONTEXT_CHECKING */ diff --git a/src/backend/utils/mmgr/dsa.c b/src/backend/utils/mmgr/dsa.c index f09a9c0487..b3327f676b 100644 --- a/src/backend/utils/mmgr/dsa.c +++ b/src/backend/utils/mmgr/dsa.c @@ -235,7 +235,7 @@ typedef struct */ static const uint16 dsa_size_classes[] = { sizeof(dsa_area_span), 0, /* special size classes */ - 8, 16, 24, 32, 40, 48, 56, 64, /* 8 classes separated by 8 bytes */ + 8, 16, 24, 32, 40, 48, 56, 64, /* 8 classes separated by 8 bytes */ 80, 96, 112, 128, /* 4 classes separated by 16 bytes */ 160, 192, 224, 256, /* 4 classes separated by 32 bytes */ 320, 384, 448, 512, /* 4 classes separated by 64 bytes */ @@ -1080,7 +1080,7 @@ dsa_dump(dsa_area *area) dsa_segment_index segment_index; fprintf(stderr, - " segment bin %zu (at least %d contiguous pages free):\n", + " segment bin %zu (at least %d contiguous pages free):\n", i, 1 << (i - 1)); segment_index = area->control->segment_bins[i]; while (segment_index != DSA_SEGMENT_INDEX_NONE) @@ -1120,7 +1120,7 @@ dsa_dump(dsa_area *area) fprintf(stderr, " pool for large object spans:\n"); else fprintf(stderr, - " pool for size class %zu (object size %hu bytes):\n", + " pool for size class %zu (object size %hu bytes):\n", i, dsa_size_classes[i]); for (j = 0; j < DSA_FULLNESS_CLASSES; ++j) { @@ -1304,7 +1304,7 @@ attach_internal(void *place, dsm_segment *segment, dsa_handle handle) /* Set up the segment map for this process's mapping. */ segment_map = &area->segment_maps[0]; - segment_map->segment = segment; /* NULL for in-place */ + segment_map->segment = segment; /* NULL for in-place */ segment_map->mapped_address = place; segment_map->header = (dsa_segment_header *) segment_map->mapped_address; segment_map->fpm = (FreePageManager *) @@ -1734,7 +1734,7 @@ get_segment_by_index(dsa_area *area, dsa_segment_index index) /* It's an error to try to access an unused slot. */ if (handle == DSM_HANDLE_INVALID) elog(ERROR, - "dsa_area could not attach to a segment that has been freed"); + "dsa_area could not attach to a segment that has been freed"); segment = dsm_attach(handle); if (segment == NULL) diff --git a/src/backend/utils/mmgr/freepage.c b/src/backend/utils/mmgr/freepage.c index 2cd758178c..7566a66970 100644 --- a/src/backend/utils/mmgr/freepage.c +++ b/src/backend/utils/mmgr/freepage.c @@ -135,7 +135,7 @@ static FreePageBtree *FreePageBtreeFindRightSibling(char *base, static Size FreePageBtreeFirstKey(FreePageBtree *btp); static FreePageBtree *FreePageBtreeGetRecycled(FreePageManager *fpm); static void FreePageBtreeInsertInternal(char *base, FreePageBtree *btp, - Size index, Size first_page, FreePageBtree *child); + Size index, Size first_page, FreePageBtree *child); static void FreePageBtreeInsertLeaf(FreePageBtree *btp, Size index, Size first_page, Size npages); static void FreePageBtreeRecycle(FreePageManager *fpm, Size pageno); @@ -1269,7 +1269,7 @@ FreePageManagerDumpBtree(FreePageManager *fpm, FreePageBtree *btp, if (btp->hdr.magic == FREE_PAGE_INTERNAL_MAGIC) appendStringInfo(buf, " %zu->%zu", btp->u.internal_key[index].first_page, - btp->u.internal_key[index].child.relptr_off / FPM_PAGE_SIZE); + btp->u.internal_key[index].child.relptr_off / FPM_PAGE_SIZE); else appendStringInfo(buf, " %zu(%zu)", btp->u.leaf_key[index].first_page, @@ -1359,7 +1359,7 @@ FreePageManagerGetInternal(FreePageManager *fpm, Size npages, Size *first_page) do { if (candidate->npages >= npages && (victim == NULL || - victim->npages > candidate->npages)) + victim->npages > candidate->npages)) { victim = candidate; if (victim->npages == npages) diff --git a/src/backend/utils/mmgr/mcxt.c b/src/backend/utils/mmgr/mcxt.c index 73c9fba2b1..5de395d983 100644 --- a/src/backend/utils/mmgr/mcxt.c +++ b/src/backend/utils/mmgr/mcxt.c @@ -460,7 +460,7 @@ MemoryContextStatsDetail(MemoryContext context, int max_children) MemoryContextStatsInternal(context, 0, true, max_children, &grand_totals); fprintf(stderr, - "Grand total: %zu bytes in %zd blocks; %zu free (%zd chunks); %zu used\n", + "Grand total: %zu bytes in %zd blocks; %zu free (%zd chunks); %zu used\n", grand_totals.totalspace, grand_totals.nblocks, grand_totals.freespace, grand_totals.freechunks, grand_totals.totalspace - grand_totals.freespace); diff --git a/src/backend/utils/mmgr/memdebug.c b/src/backend/utils/mmgr/memdebug.c index 243607732c..f0a87d3f20 100644 --- a/src/backend/utils/mmgr/memdebug.c +++ b/src/backend/utils/mmgr/memdebug.c @@ -90,4 +90,4 @@ randomize_mem(char *ptr, size_t size) save_ctr = ctr; } -#endif /* RANDOMIZE_ALLOCATED_MEMORY */ +#endif /* RANDOMIZE_ALLOCATED_MEMORY */ diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c index e59154ddda..35de6b6d82 100644 --- a/src/backend/utils/mmgr/slab.c +++ b/src/backend/utils/mmgr/slab.c @@ -190,7 +190,7 @@ SlabContextCreate(MemoryContext parent, Size freelistSize; SlabContext *slab; - StaticAssertStmt(offsetof(SlabChunk, slab) +sizeof(MemoryContext) == + StaticAssertStmt(offsetof(SlabChunk, slab) + sizeof(MemoryContext) == MAXALIGN(sizeof(SlabChunk)), "padding calculation in SlabChunk is wrong"); @@ -221,7 +221,7 @@ SlabContextCreate(MemoryContext parent, /* Do the type-independent part of context creation */ slab = (SlabContext *) MemoryContextCreate(T_SlabContext, - (offsetof(SlabContext, freelist) +freelistSize), + (offsetof(SlabContext, freelist) + freelistSize), &SlabMethods, parent, name); @@ -764,4 +764,4 @@ SlabCheck(MemoryContext context) } } -#endif /* MEMORY_CONTEXT_CHECKING */ +#endif /* MEMORY_CONTEXT_CHECKING */ diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c index 4c3654f809..83b20f5f05 100644 --- a/src/backend/utils/resowner/resowner.c +++ b/src/backend/utils/resowner/resowner.c @@ -131,8 +131,8 @@ typedef struct ResourceOwnerData /* We can remember up to MAX_RESOWNER_LOCKS references to local locks. */ int nlocks; /* number of owned locks */ - LOCALLOCK *locks[MAX_RESOWNER_LOCKS]; /* list of owned locks */ -} ResourceOwnerData; + LOCALLOCK *locks[MAX_RESOWNER_LOCKS]; /* list of owned locks */ +} ResourceOwnerData; /***************************************************************************** diff --git a/src/backend/utils/sort/logtape.c b/src/backend/utils/sort/logtape.c index 455735925e..5ebb6fb11a 100644 --- a/src/backend/utils/sort/logtape.c +++ b/src/backend/utils/sort/logtape.c @@ -161,7 +161,7 @@ struct LogicalTapeSet * blocks that have been allocated for a tape, but have not been written * to the underlying file yet. */ - long nBlocksAllocated; /* # of blocks allocated */ + long nBlocksAllocated; /* # of blocks allocated */ long nBlocksWritten; /* # of blocks used in underlying file */ /* @@ -357,7 +357,7 @@ ltsReleaseBlock(LogicalTapeSet *lts, long blocknum) { lts->freeBlocksLen *= 2; lts->freeBlocks = (long *) repalloc(lts->freeBlocks, - lts->freeBlocksLen * sizeof(long)); + lts->freeBlocksLen * sizeof(long)); } /* diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 02cd1d7fe2..e427ba72fe 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -271,7 +271,7 @@ typedef enum #define RUN_SECOND 1 typedef int (*SortTupleComparator) (const SortTuple *a, const SortTuple *b, - Tuplesortstate *state); + Tuplesortstate *state); /* * Private state of a Tuplesort operation. @@ -325,7 +325,7 @@ struct Tuplesortstate * memory space thereby released. */ void (*writetup) (Tuplesortstate *state, int tapenum, - SortTuple *stup); + SortTuple *stup); /* * Function to read a stored tuple from tape back into memory. 'len' is @@ -333,7 +333,7 @@ struct Tuplesortstate * from the slab memory arena, or is palloc'd, see readtup_alloc(). */ void (*readtup) (Tuplesortstate *state, SortTuple *stup, - int tapenum, unsigned int len); + int tapenum, unsigned int len); #ifdef PGXC /* @@ -754,7 +754,7 @@ tuplesort_begin_common(int workMem, bool randomAccess) * see comments in grow_memtuples(). */ state->memtupsize = Max(1024, - ALLOCSET_SEPARATE_THRESHOLD / sizeof(SortTuple) + 1); + ALLOCSET_SEPARATE_THRESHOLD / sizeof(SortTuple) + 1); state->growmemtuples = true; state->slabAllocatorUsed = false; @@ -2131,7 +2131,7 @@ tuplesort_gettuple_common(Tuplesortstate *state, bool forward, */ nmoved = LogicalTapeBackspace(state->tapeset, state->result_tape, - tuplen + 2 * sizeof(unsigned int)); + tuplen + 2 * sizeof(unsigned int)); if (nmoved == tuplen + sizeof(unsigned int)) { /* @@ -2539,7 +2539,7 @@ inittapes(Tuplesortstate *state) * case it's not important to account for tuple space, so we don't care if * LACKMEM becomes inaccurate.) */ - tapeSpace = (int64) maxTapes *TAPE_BUFFER_OVERHEAD; + tapeSpace = (int64) maxTapes * TAPE_BUFFER_OVERHEAD; if (tapeSpace + GetMemoryChunkSpace(state->memtuples) < state->allowedMem) USEMEM(state, tapeSpace); @@ -4171,7 +4171,7 @@ copytup_cluster(Tuplesortstate *state, SortTuple *stup, void *tup) tuple = (HeapTuple) mtup->tuple; mtup->datum1 = heap_getattr(tuple, - state->indexInfo->ii_KeyAttrNumbers[0], + state->indexInfo->ii_KeyAttrNumbers[0], state->tupDesc, &mtup->isnull1); } @@ -4347,7 +4347,7 @@ comparetup_index_btree(const SortTuple *a, const SortTuple *b, key_desc ? errdetail("Key %s is duplicated.", key_desc) : errdetail("Duplicate keys exist."), errtableconstraint(state->heapRel, - RelationGetRelationName(state->indexRel)))); + RelationGetRelationName(state->indexRel)))); } /* @@ -4552,7 +4552,7 @@ comparetup_datum(const SortTuple *a, const SortTuple *b, Tuplesortstate *state) if (state->sortKeys->abbrev_converter) compare = ApplySortAbbrevFullComparator(PointerGetDatum(a->tuple), a->isnull1, - PointerGetDatum(b->tuple), b->isnull1, + PointerGetDatum(b->tuple), b->isnull1, state->sortKeys); return compare; diff --git a/src/backend/utils/sort/tuplestore.c b/src/backend/utils/sort/tuplestore.c index 9cbce9e598..9da5ff6eb6 100644 --- a/src/backend/utils/sort/tuplestore.c +++ b/src/backend/utils/sort/tuplestore.c @@ -963,7 +963,7 @@ tuplestore_puttuple_common(Tuplestorestate *state, void *tuple) SEEK_SET) != 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not seek in tuplestore temporary file: %m"))); + errmsg("could not seek in tuplestore temporary file: %m"))); state->status = TSS_WRITEFILE; /* @@ -1157,7 +1157,7 @@ tuplestore_gettuple(Tuplestorestate *state, bool forward, SEEK_CUR) != 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not seek in tuplestore temporary file: %m"))); + errmsg("could not seek in tuplestore temporary file: %m"))); tup = READTUP(state, tuplen); if (state->stat_name && tup) state->stat_read_count++; @@ -1387,7 +1387,7 @@ tuplestore_rescan(Tuplestorestate *state) if (BufFileSeek(state->myfile, 0, 0L, SEEK_SET) != 0) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not seek in tuplestore temporary file: %m"))); + errmsg("could not seek in tuplestore temporary file: %m"))); break; default: elog(ERROR, "invalid tuplestore state"); @@ -1608,7 +1608,7 @@ getlen(Tuplestorestate *state, bool eofOK) if (nbytes != 0 || !eofOK) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not read from tuplestore temporary file: %m"))); + errmsg("could not read from tuplestore temporary file: %m"))); return 0; } @@ -1660,7 +1660,7 @@ writetup_heap(Tuplestorestate *state, void *tup) sizeof(tuplen)) != sizeof(tuplen)) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not write to tuplestore temporary file: %m"))); + errmsg("could not write to tuplestore temporary file: %m"))); FREEMEM(state, GetMemoryChunkSpace(tuple)); heap_free_minimal_tuple(tuple); @@ -1681,13 +1681,13 @@ readtup_heap(Tuplestorestate *state, unsigned int len) tupbodylen) != (size_t) tupbodylen) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not read from tuplestore temporary file: %m"))); + errmsg("could not read from tuplestore temporary file: %m"))); if (state->backward) /* need trailing length word? */ if (BufFileRead(state->myfile, (void *) &tuplen, sizeof(tuplen)) != sizeof(tuplen)) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not read from tuplestore temporary file: %m"))); + errmsg("could not read from tuplestore temporary file: %m"))); return (void *) tuple; } diff --git a/src/backend/utils/time/combocid.c b/src/backend/utils/time/combocid.c index e72547e879..cbb92c2316 100644 --- a/src/backend/utils/time/combocid.c +++ b/src/backend/utils/time/combocid.c @@ -130,7 +130,7 @@ HeapTupleHeaderGetCmax(HeapTupleHeader tup) * things too much. */ Assert(CritSectionCount > 0 || - TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetUpdateXid(tup))); + TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetUpdateXid(tup))); if (tup->t_infomask & HEAP_COMBOCID) return GetRealCmax(cid); diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index 687222fc54..6966b28741 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -75,7 +75,7 @@ /* * GUC parameters */ -int old_snapshot_threshold; /* number of minutes, -1 disables */ +int old_snapshot_threshold; /* number of minutes, -1 disables */ /* * Structure for dealing with old_snapshot_threshold implementation. @@ -87,9 +87,8 @@ typedef struct OldSnapshotControlData * only allowed to move forward. */ slock_t mutex_current; /* protect current_timestamp */ - TimestampTz current_timestamp; /* latest snapshot timestamp */ - slock_t mutex_latest_xmin; /* protect latest_xmin and - * next_map_update */ + TimestampTz current_timestamp; /* latest snapshot timestamp */ + slock_t mutex_latest_xmin; /* protect latest_xmin and next_map_update */ TransactionId latest_xmin; /* latest snapshot xmin */ TimestampTz next_map_update; /* latest snapshot valid up to */ slock_t mutex_threshold; /* protect threshold fields */ @@ -219,8 +218,8 @@ static Snapshot FirstXactSnapshot = NULL; /* Structure holding info about exported snapshot. */ typedef struct ExportedSnapshot { - char *snapfile; - Snapshot snapshot; + char *snapfile; + Snapshot snapshot; } ExportedSnapshot; /* Current xact's exported snapshots (a list of ExportedSnapshot structs) */ @@ -446,7 +445,7 @@ GetOldestSnapshot(void) if (!pairingheap_is_empty(&RegisteredSnapshots)) { OldestRegisteredSnapshot = pairingheap_container(SnapshotData, ph_node, - pairingheap_first(&RegisteredSnapshots)); + pairingheap_first(&RegisteredSnapshots)); RegisteredLSN = OldestRegisteredSnapshot->lsn; } @@ -649,14 +648,14 @@ SetTransactionSnapshot(Snapshot sourcesnap, VirtualTransactionId *sourcevxid, ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("could not import the requested snapshot"), - errdetail("The source transaction is not running anymore."))); + errdetail("The source transaction is not running anymore."))); } else if (!ProcArrayInstallImportedXmin(CurrentSnapshot->xmin, sourcevxid)) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("could not import the requested snapshot"), - errdetail("The source process with pid %d is not running anymore.", - sourcepid))); + errdetail("The source process with pid %d is not running anymore.", + sourcepid))); /* * In transaction-snapshot mode, the first snapshot must live until end of @@ -1036,7 +1035,7 @@ SnapshotResetXmin(void) } minSnapshot = pairingheap_container(SnapshotData, ph_node, - pairingheap_first(&RegisteredSnapshots)); + pairingheap_first(&RegisteredSnapshots)); if (TransactionIdPrecedes(MyPgXact->xmin, minSnapshot->xmin)) MyPgXact->xmin = minSnapshot->xmin; @@ -1142,7 +1141,7 @@ AtEOXact_Snapshot(bool isCommit, bool resetXmin) */ foreach(lc, exportedSnapshots) { - ExportedSnapshot *esnap = (ExportedSnapshot *) lfirst(lc); + ExportedSnapshot *esnap = (ExportedSnapshot *) lfirst(lc); if (unlink(esnap->snapfile)) elog(WARNING, "could not unlink file \"%s\": %m", @@ -1306,7 +1305,7 @@ ExportSnapshot(Snapshot snapshot) * snapshot.h.) */ addTopXid = (TransactionIdIsValid(topXid) && - TransactionIdPrecedes(topXid, snapshot->xmax)) ? 1 : 0; + TransactionIdPrecedes(topXid, snapshot->xmax)) ? 1 : 0; appendStringInfo(&buf, "xcnt:%d\n", snapshot->xcnt + addTopXid); for (i = 0; i < snapshot->xcnt; i++) appendStringInfo(&buf, "xip:%u\n", snapshot->xip[i]); @@ -1500,7 +1499,7 @@ ImportSnapshot(const char *idstr) IsSubTransaction()) ereport(ERROR, (errcode(ERRCODE_ACTIVE_SQL_TRANSACTION), - errmsg("SET TRANSACTION SNAPSHOT must be called before any query"))); + errmsg("SET TRANSACTION SNAPSHOT must be called before any query"))); /* * If we are in read committed mode then the next query would execute with @@ -1636,7 +1635,7 @@ ImportSnapshot(const char *idstr) if (src_dbid != MyDatabaseId) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot import a snapshot from a different database"))); + errmsg("cannot import a snapshot from a different database"))); /* OK, install the snapshot */ SetTransactionSnapshot(&snapshot, &src_vxid, src_pid, NULL); @@ -1931,7 +1930,7 @@ MaintainOldSnapshotTimeMapping(TimestampTz whenTaken, TransactionId xmin) if (whenTaken < 0) { elog(DEBUG1, - "MaintainOldSnapshotTimeMapping called with negative whenTaken = %ld", + "MaintainOldSnapshotTimeMapping called with negative whenTaken = %ld", (long) whenTaken); return; } @@ -2123,6 +2122,14 @@ SerializeSnapshot(Snapshot snapshot, char *start_address) serialized_snapshot.whenTaken = snapshot->whenTaken; serialized_snapshot.lsn = snapshot->lsn; + /* + * Ignore the SubXID array if it has overflowed, unless the snapshot was + * taken during recovery - in that case, top-level XIDs are in subxip as + * well, and we mustn't lose them. + */ + if (serialized_snapshot.suboverflowed && !snapshot->takenDuringRecovery) + serialized_snapshot.subxcnt = 0; + /* Copy struct to possibly-unaligned buffer */ memcpy(start_address, &serialized_snapshot, sizeof(SerializedSnapshotData)); @@ -2139,9 +2146,6 @@ SerializeSnapshot(Snapshot snapshot, char *start_address) * snapshot taken during recovery; all the top-level XIDs are in subxip as * well in that case, so we mustn't lose them. */ - if (serialized_snapshot.suboverflowed && !snapshot->takenDuringRecovery) - serialized_snapshot.subxcnt = 0; - if (serialized_snapshot.subxcnt > 0) { Size subxipoff = sizeof(SerializedSnapshotData) + diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c index 51ef93aa99..c6b30d0bbd 100644 --- a/src/backend/utils/time/tqual.c +++ b/src/backend/utils/time/tqual.c @@ -512,7 +512,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, else if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmin(tuple))) { if (HeapTupleHeaderGetCmin(tuple) >= curcid) - return HeapTupleInvisible; /* inserted after scan started */ + return HeapTupleInvisible; /* inserted after scan started */ if (tuple->t_infomask & HEAP_XMAX_INVALID) /* xid invalid */ return HeapTupleMayBeUpdated; @@ -571,8 +571,8 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, return HeapTupleSelfUpdated; /* updated after scan * started */ else - return HeapTupleInvisible; /* updated before scan - * started */ + return HeapTupleInvisible; /* updated before scan + * started */ } } @@ -587,7 +587,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, if (HeapTupleHeaderGetCmax(tuple) >= curcid) return HeapTupleSelfUpdated; /* updated after scan started */ else - return HeapTupleInvisible; /* updated before scan started */ + return HeapTupleInvisible; /* updated before scan started */ } else if (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple))) return HeapTupleInvisible; @@ -657,7 +657,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, if (HeapTupleHeaderGetCmax(tuple) >= curcid) return HeapTupleSelfUpdated; /* updated after scan started */ else - return HeapTupleInvisible; /* updated before scan started */ + return HeapTupleInvisible; /* updated before scan started */ } if (MultiXactIdIsRunning(HeapTupleHeaderGetRawXmax(tuple), false)) @@ -693,7 +693,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid, if (HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask)) return HeapTupleBeingUpdated; if (HeapTupleHeaderGetCmax(tuple) >= curcid) - return HeapTupleSelfUpdated; /* updated after scan started */ + return HeapTupleSelfUpdated; /* updated after scan started */ else return HeapTupleInvisible; /* updated before scan started */ } @@ -1049,7 +1049,7 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot, else if (HeapTupleHeaderGetCmax(tuple) >= snapshot->curcid) return true; /* updated after scan started */ else - return false; /* updated before scan started */ + return false; /* updated before scan started */ } if (!TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmax(tuple))) diff --git a/src/bin/initdb/findtimezone.c b/src/bin/initdb/findtimezone.c index 82089f47a0..c9b4141a16 100644 --- a/src/bin/initdb/findtimezone.c +++ b/src/bin/initdb/findtimezone.c @@ -151,7 +151,7 @@ struct tztry }; static void scan_available_timezones(char *tzdir, char *tzdirsub, - struct tztry * tt, + struct tztry *tt, int *bestscore, char *bestzonename); @@ -159,7 +159,7 @@ static void scan_available_timezones(char *tzdir, char *tzdirsub, * Get GMT offset from a system struct tm */ static int -get_timezone_offset(struct tm * tm) +get_timezone_offset(struct tm *tm) { #if defined(HAVE_STRUCT_TM_TM_ZONE) return tm->tm_gmtoff; @@ -190,7 +190,7 @@ build_time_t(int year, int month, int day) * Does a system tm value match one we computed ourselves? */ static bool -compare_tm(struct tm * s, struct pg_tm * p) +compare_tm(struct tm *s, struct pg_tm *p) { if (s->tm_sec != p->tm_sec || s->tm_min != p->tm_min || @@ -217,7 +217,7 @@ compare_tm(struct tm * s, struct pg_tm * p) * test time. */ static int -score_timezone(const char *tzname, struct tztry * tt) +score_timezone(const char *tzname, struct tztry *tt) { int i; pg_time_t pgtt; @@ -279,7 +279,7 @@ score_timezone(const char *tzname, struct tztry * tt) if (pgtm->tm_zone == NULL) return -1; /* probably shouldn't happen */ memset(cbuf, 0, sizeof(cbuf)); - strftime(cbuf, sizeof(cbuf) - 1, "%Z", systm); /* zone abbr */ + strftime(cbuf, sizeof(cbuf) - 1, "%Z", systm); /* zone abbr */ if (strcmp(cbuf, pgtm->tm_zone) != 0) { #ifdef DEBUG_IDENTIFY_TIMEZONE @@ -506,7 +506,7 @@ identify_system_timezone(void) * score. bestzonename must be a buffer of length TZ_STRLEN_MAX + 1. */ static void -scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry * tt, +scan_available_timezones(char *tzdir, char *tzdirsub, struct tztry *tt, int *bestscore, char *bestzonename) { int tzdir_orig_len = strlen(tzdir); @@ -578,7 +578,7 @@ static const struct const char *stdname; /* Windows name of standard timezone */ const char *dstname; /* Windows name of daylight timezone */ const char *pgtzname; /* Name of pgsql timezone to map to */ -} win32_tzmap[] = +} win32_tzmap[] = { /* @@ -1221,7 +1221,7 @@ identify_system_timezone(void) */ memset(localtzname, 0, sizeof(localtzname)); if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, - "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", + "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones", 0, KEY_READ, &rootKey) != ERROR_SUCCESS) @@ -1336,7 +1336,7 @@ identify_system_timezone(void) #endif return NULL; /* go to GMT */ } -#endif /* WIN32 */ +#endif /* WIN32 */ /* diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 6399d92f64..54fb24f42a 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -598,12 +598,12 @@ exit_nicely(void) { if (made_new_pgdata || found_existing_pgdata) fprintf(stderr, - _("%s: data directory \"%s\" not removed at user's request\n"), + _("%s: data directory \"%s\" not removed at user's request\n"), progname, pg_data); if (made_new_xlogdir || found_existing_xlogdir) fprintf(stderr, - _("%s: WAL directory \"%s\" not removed at user's request\n"), + _("%s: WAL directory \"%s\" not removed at user's request\n"), progname, xlog_dir); } @@ -783,16 +783,16 @@ check_input(char *path) _("%s: file \"%s\" does not exist\n"), progname, path); fprintf(stderr, _("This might mean you have a corrupted installation or identified\n" - "the wrong directory with the invocation option -L.\n")); + "the wrong directory with the invocation option -L.\n")); } else { fprintf(stderr, - _("%s: could not access file \"%s\": %s\n"), progname, path, + _("%s: could not access file \"%s\": %s\n"), progname, path, strerror(errno)); fprintf(stderr, _("This might mean you have a corrupted installation or identified\n" - "the wrong directory with the invocation option -L.\n")); + "the wrong directory with the invocation option -L.\n")); } exit(1); } @@ -801,8 +801,8 @@ check_input(char *path) fprintf(stderr, _("%s: file \"%s\" is not a regular file\n"), progname, path); fprintf(stderr, - _("This might mean you have a corrupted installation or identified\n" - "the wrong directory with the invocation option -L.\n")); + _("This might mean you have a corrupted installation or identified\n" + "the wrong directory with the invocation option -L.\n")); exit(1); } } @@ -1092,7 +1092,7 @@ setup_config(void) "default_text_search_config = 'pg_catalog.%s'", escape_quotes(default_text_search_config)); conflines = replace_token(conflines, - "#default_text_search_config = 'pg_catalog.simple'", + "#default_text_search_config = 'pg_catalog.simple'", repltok); #ifdef PGXC /* Add Postgres-XC node name to configuration file */ @@ -1237,11 +1237,11 @@ setup_config(void) getaddrinfo("::1", NULL, &hints, &gai_result) != 0) { conflines = replace_token(conflines, - "host all all ::1", - "#host all all ::1"); + "host all all ::1", + "#host all all ::1"); conflines = replace_token(conflines, - "host replication all ::1", - "#host replication all ::1"); + "host replication all ::1", + "#host replication all ::1"); } } #else /* !HAVE_IPV6 */ @@ -1252,7 +1252,7 @@ setup_config(void) conflines = replace_token(conflines, "host replication all ::1", "#host replication all ::1"); -#endif /* HAVE_IPV6 */ +#endif /* HAVE_IPV6 */ /* Replace default authentication methods */ conflines = replace_token(conflines, @@ -1403,7 +1403,7 @@ bootstrap_template1(void) static void setup_auth(FILE *cmdfd) { - const char *const * line; + const char *const *line; static const char *const pg_authid_setup[] = { /* * The authid table shouldn't be readable except through views, to @@ -1490,7 +1490,7 @@ get_su_pwd(void) static void setup_depend(FILE *cmdfd) { - const char *const * line; + const char *const *line; static const char *const pg_depend_setup[] = { /* * Make PIN entries in pg_depend for all objects made so far in the @@ -1499,9 +1499,16 @@ setup_depend(FILE *cmdfd) * for instance) but generating only the minimum required set of * dependencies seems hard. * - * Note that we deliberately do not pin the system views, which - * haven't been created yet. Also, no conversions, databases, or - * tablespaces are pinned. + * Catalogs that are intentionally not scanned here are: + * + * pg_database: it's a feature, not a bug, that template1 is not + * pinned. + * + * pg_extension: a pinned extension isn't really an extension, hmm? + * + * pg_tablespace: tablespaces don't participate in the dependency + * code, and DropTableSpace() explicitly protects the built-in + * tablespaces. * * First delete any already-made entries; PINs override all else, and * must be the only entries for their objects. @@ -1522,6 +1529,8 @@ setup_depend(FILE *cmdfd) "INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' " " FROM pg_constraint;\n\n", "INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' " + " FROM pg_conversion;\n\n", + "INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' " " FROM pg_attrdef;\n\n", "INSERT INTO pg_depend SELECT 0,0,0, tableoid,oid,0, 'p' " " FROM pg_language;\n\n", @@ -1644,7 +1653,7 @@ setup_description(FILE *cmdfd) /* Create default descriptions for operator implementation functions */ PG_CMD_PUTS("WITH funcdescs AS ( " "SELECT p.oid as p_oid, oprname, " - "coalesce(obj_description(o.oid, 'pg_operator'),'') as opdesc " + "coalesce(obj_description(o.oid, 'pg_operator'),'') as opdesc " "FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid ) " "INSERT INTO pg_description " " SELECT p_oid, 'pg_proc'::regclass, 0, " @@ -1652,7 +1661,7 @@ setup_description(FILE *cmdfd) " FROM funcdescs " " WHERE opdesc NOT LIKE 'deprecated%' AND " " NOT EXISTS (SELECT 1 FROM pg_description " - " WHERE objoid = p_oid AND classoid = 'pg_proc'::regclass);\n\n"); + " WHERE objoid = p_oid AND classoid = 'pg_proc'::regclass);\n\n"); /* * Even though the tables are temp, drop them explicitly so they don't get @@ -1668,10 +1677,16 @@ setup_description(FILE *cmdfd) static void setup_collation(FILE *cmdfd) { - PG_CMD_PUTS("SELECT pg_import_system_collations(if_not_exists => false, schema => 'pg_catalog');\n\n"); + /* + * Add an SQL-standard name. We don't want to pin this, so it doesn't go + * in pg_collation.h. But add it before reading system collations, so + * that it wins if libc defines a locale named ucs_basic. + */ + PG_CMD_PRINTF3("INSERT INTO pg_collation (collname, collnamespace, collowner, collprovider, collencoding, collcollate, collctype) VALUES ('ucs_basic', 'pg_catalog'::regnamespace, %u, '%c', %d, 'C', 'C');\n\n", + BOOTSTRAP_SUPERUSERID, COLLPROVIDER_LIBC, PG_UTF8); - /* Add an SQL-standard name */ - PG_CMD_PRINTF3("INSERT INTO pg_collation (collname, collnamespace, collowner, collprovider, collencoding, collcollate, collctype) VALUES ('ucs_basic', 'pg_catalog'::regnamespace, %u, '%c', %d, 'C', 'C');\n\n", BOOTSTRAP_SUPERUSERID, COLLPROVIDER_LIBC, PG_UTF8); + /* Now import all collations we can find in the operating system */ + PG_CMD_PUTS("SELECT pg_import_system_collations('pg_catalog');\n\n"); } /* @@ -1996,7 +2011,7 @@ vacuum_db(FILE *cmdfd) static void make_template0(FILE *cmdfd) { - const char *const * line; + const char *const *line; static const char *const template0_setup[] = { "CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;\n\n", @@ -2040,7 +2055,7 @@ make_template0(FILE *cmdfd) static void make_postgres(FILE *cmdfd) { - const char *const * line; + const char *const *line; static const char *const postgres_setup[] = { "CREATE DATABASE postgres;\n\n", "COMMENT ON DATABASE postgres IS 'default administrative connection database';\n\n", @@ -2110,7 +2125,7 @@ check_ok(void) /* Hack to suppress a warning about %x from some versions of gcc */ static inline size_t -my_strftime(char *s, size_t max, const char *fmt, const struct tm * tm) +my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm) { return strftime(s, max, fmt, tm); } @@ -2264,9 +2279,9 @@ check_locale_encoding(const char *locale, int user_enc) fprintf(stderr, _("%s: encoding mismatch\n"), progname); fprintf(stderr, _("The encoding you selected (%s) and the encoding that the\n" - "selected locale uses (%s) do not match. This would lead to\n" - "misbehavior in various character string processing functions.\n" - "Rerun %s and either do not specify an encoding explicitly,\n" + "selected locale uses (%s) do not match. This would lead to\n" + "misbehavior in various character string processing functions.\n" + "Rerun %s and either do not specify an encoding explicitly,\n" "or choose a matching combination.\n"), pg_encoding_to_char(user_enc), pg_encoding_to_char(locale_enc), @@ -2355,7 +2370,7 @@ usage(const char *progname) printf(_(" --no-locale equivalent to --locale=C\n")); printf(_(" --pwfile=FILE read password for the new superuser from file\n")); printf(_(" -T, --text-search-config=CFG\n" - " default text search configuration\n")); + " default text search configuration\n")); printf(_(" -U, --username=NAME database superuser name\n")); printf(_(" -W, --pwprompt prompt for a password for the new superuser\n")); printf(_(" -X, --waldir=WALDIR location for the write-ahead log directory\n")); @@ -2382,15 +2397,15 @@ check_authmethod_unspecified(const char **authmethod) { authwarning = _("\nWARNING: enabling \"trust\" authentication for local connections\n" "You can change this by editing pg_hba.conf or using the option -A, or\n" - "--auth-local and --auth-host, the next time you run initdb.\n"); + "--auth-local and --auth-host, the next time you run initdb.\n"); *authmethod = "trust"; } } static void -check_authmethod_valid(const char *authmethod, const char *const * valid_methods, const char *conntype) +check_authmethod_valid(const char *authmethod, const char *const *valid_methods, const char *conntype) { - const char *const * p; + const char *const *p; for (p = valid_methods; *p; p++) { @@ -2572,18 +2587,18 @@ setup_locale_encoding(void) */ #ifdef WIN32 printf(_("Encoding \"%s\" implied by locale is not allowed as a server-side encoding.\n" - "The default database encoding will be set to \"%s\" instead.\n"), + "The default database encoding will be set to \"%s\" instead.\n"), pg_encoding_to_char(ctype_enc), pg_encoding_to_char(PG_UTF8)); ctype_enc = PG_UTF8; encodingid = encodingid_to_string(ctype_enc); #else fprintf(stderr, - _("%s: locale \"%s\" requires unsupported encoding \"%s\"\n"), + _("%s: locale \"%s\" requires unsupported encoding \"%s\"\n"), progname, lc_ctype, pg_encoding_to_char(ctype_enc)); fprintf(stderr, - _("Encoding \"%s\" is not allowed as a server-side encoding.\n" - "Rerun %s with a different locale selection.\n"), + _("Encoding \"%s\" is not allowed as a server-side encoding.\n" + "Rerun %s with a different locale selection.\n"), pg_encoding_to_char(ctype_enc), progname); exit(1); #endif @@ -2995,6 +3010,11 @@ initialize_data_directory(void) setup_depend(cmdfd); + /* + * Note that no objects created after setup_depend() will be "pinned". + * They are all droppable at the whim of the DBA. + */ + setup_sysviews(cmdfd); #ifdef PGXC @@ -3060,7 +3080,7 @@ main(int argc, char *argv[]) {"show", no_argument, NULL, 's'}, {"noclean", no_argument, NULL, 'n'}, /* for backwards compatibility */ {"no-clean", no_argument, NULL, 'n'}, - {"nosync", no_argument, NULL, 'N'}, /* for backwards compatibility */ + {"nosync", no_argument, NULL, 'N'}, /* for backwards compatibility */ {"no-sync", no_argument, NULL, 'N'}, {"sync-only", no_argument, NULL, 'S'}, {"waldir", required_argument, NULL, 'X'}, diff --git a/src/bin/pg_archivecleanup/pg_archivecleanup.c b/src/bin/pg_archivecleanup/pg_archivecleanup.c index 990fe47e03..c5e344f3cf 100644 --- a/src/bin/pg_archivecleanup/pg_archivecleanup.c +++ b/src/bin/pg_archivecleanup/pg_archivecleanup.c @@ -28,14 +28,13 @@ const char *progname; /* Options and defaults */ bool debug = false; /* are we debugging? */ bool dryrun = false; /* are we performing a dry-run operation? */ -char *additional_ext = NULL; /* Extension to remove from filenames */ +char *additional_ext = NULL; /* Extension to remove from filenames */ char *archiveLocation; /* where to find the archive? */ char *restartWALFileName; /* the file from which we can restart restore */ char WALFilePath[MAXPGPATH * 2]; /* the file path including archive */ -char exclusiveCleanupFileName[MAXFNAMELEN]; /* the oldest file we - * want to remain in - * archive */ +char exclusiveCleanupFileName[MAXFNAMELEN]; /* the oldest file we want + * to remain in archive */ /* ===================================================================== @@ -315,8 +314,8 @@ main(int argc, char **argv) dryrun = true; break; case 'x': - additional_ext = pg_strdup(optarg); /* Extension to remove - * from xlogfile names */ + additional_ext = pg_strdup(optarg); /* Extension to remove + * from xlogfile names */ break; default: fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.c index 54d27dc658..3ad06995ec 100644 --- a/src/bin/pg_basebackup/pg_basebackup.c +++ b/src/bin/pg_basebackup/pg_basebackup.c @@ -87,7 +87,7 @@ static IncludeWal includewal = STREAM_WAL; static bool fastcheckpoint = false; static bool writerecoveryconf = false; static bool do_sync = true; -static int standby_message_timeout = 10 * 1000; /* 10 sec = default */ +static int standby_message_timeout = 10 * 1000; /* 10 sec = default */ static pg_time_t last_progress_report = 0; static int32 maxrate = 0; /* no limit by default */ static char *replication_slot = NULL; @@ -194,18 +194,18 @@ cleanup_directories_atexit(void) { if (made_new_pgdata || found_existing_pgdata) fprintf(stderr, - _("%s: data directory \"%s\" not removed at user's request\n"), + _("%s: data directory \"%s\" not removed at user's request\n"), progname, basedir); if (made_new_xlogdir || found_existing_xlogdir) fprintf(stderr, - _("%s: WAL directory \"%s\" not removed at user's request\n"), + _("%s: WAL directory \"%s\" not removed at user's request\n"), progname, xlog_dir); } if (made_tablespace_dirs || found_tablespace_dirs) fprintf(stderr, - _("%s: changes to tablespace directories will not be undone\n"), + _("%s: changes to tablespace directories will not be undone\n"), progname); } @@ -332,13 +332,13 @@ usage(void) 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")); + " (in kB/s, or use suffix \"k\" or \"M\")\n")); printf(_(" -R, --write-recovery-conf\n" - " write recovery.conf for replication\n")); + " 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")); + " relocate tablespace in OLDDIR to NEWDIR\n")); printf(_(" -X, --wal-method=none|fetch|stream\n" " include required WAL files with specified method\n")); printf(_(" --waldir=WALDIR location for the write-ahead log directory\n")); @@ -414,7 +414,7 @@ reached_end_position(XLogRecPtr segendpos, uint32 timeline, if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2) { fprintf(stderr, - _("%s: could not parse write-ahead log location \"%s\"\n"), + _("%s: could not parse write-ahead log location \"%s\"\n"), progname, xlogend); exit(1); } @@ -771,8 +771,8 @@ progress_report(int tablespacenum, const char *filename, bool force) tablespacenum, tablespacecount, /* Prefix with "..." if we do leading truncation */ truncate ? "..." : "", - truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH, - truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH, + truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH, + truncate ? VERBOSE_FILENAME_LENGTH - 3 : VERBOSE_FILENAME_LENGTH, /* Truncate filename at beginning if it's too long */ truncate ? filename + strlen(filename) - VERBOSE_FILENAME_LENGTH + 3 : filename); } @@ -1112,7 +1112,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum) if (gzclose(ztarfile) != 0) { fprintf(stderr, - _("%s: could not close compressed file \"%s\": %s\n"), + _("%s: could not close compressed file \"%s\": %s\n"), progname, filename, get_gz_error(ztarfile)); disconnect_and_exit(1); } @@ -1398,7 +1398,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum) /* * Directory */ - filename[strlen(filename) - 1] = '\0'; /* Remove trailing slash */ + filename[strlen(filename) - 1] = '\0'; /* Remove trailing slash */ if (mkdir(filename, S_IRWXU) != 0) { /* @@ -1412,11 +1412,11 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum) */ if (!((pg_str_endswith(filename, "/pg_wal") || pg_str_endswith(filename, "/pg_xlog") || - pg_str_endswith(filename, "/archive_status")) && + pg_str_endswith(filename, "/archive_status")) && errno == EEXIST)) { fprintf(stderr, - _("%s: could not create directory \"%s\": %s\n"), + _("%s: could not create directory \"%s\": %s\n"), progname, filename, strerror(errno)); disconnect_and_exit(1); } @@ -1442,7 +1442,7 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum) * are, you can call it an undocumented feature that you * can map them too.) */ - filename[strlen(filename) - 1] = '\0'; /* Remove trailing slash */ + filename[strlen(filename) - 1] = '\0'; /* Remove trailing slash */ mapped_tblspc_path = get_tablespace_mapping(©buf[157]); if (symlink(mapped_tblspc_path, filename) != 0) @@ -1758,7 +1758,7 @@ BaseBackup(void) if (verbose) fprintf(stderr, - _("%s: initiating base backup, waiting for checkpoint to complete\n"), + _("%s: initiating base backup, waiting for checkpoint to complete\n"), progname); if (showprogress && !verbose) @@ -1907,14 +1907,14 @@ BaseBackup(void) if (PQresultStatus(res) != PGRES_TUPLES_OK) { fprintf(stderr, - _("%s: could not get write-ahead log end position from server: %s"), + _("%s: could not get write-ahead log end position from server: %s"), progname, PQerrorMessage(conn)); disconnect_and_exit(1); } if (PQntuples(res) != 1) { fprintf(stderr, - _("%s: no write-ahead log end position returned from server\n"), + _("%s: no write-ahead log end position returned from server\n"), progname); disconnect_and_exit(1); } @@ -1998,7 +1998,7 @@ BaseBackup(void) if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2) { fprintf(stderr, - _("%s: could not parse write-ahead log location \"%s\"\n"), + _("%s: could not parse write-ahead log location \"%s\"\n"), progname, xlogend); disconnect_and_exit(1); } @@ -2204,7 +2204,7 @@ main(int argc, char **argv) #ifdef HAVE_LIBZ compresslevel = Z_DEFAULT_COMPRESSION; #else - compresslevel = 1; /* will be rejected below */ + compresslevel = 1; /* will be rejected below */ #endif break; case 'Z': @@ -2312,7 +2312,7 @@ main(int argc, char **argv) if (format == 't' && includewal == STREAM_WAL && strcmp(basedir, "-") == 0) { fprintf(stderr, - _("%s: cannot stream write-ahead logs in tar mode to stdout\n"), + _("%s: cannot stream write-ahead logs in tar mode to stdout\n"), progname); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); @@ -2322,7 +2322,7 @@ main(int argc, char **argv) if (replication_slot && includewal != STREAM_WAL) { fprintf(stderr, - _("%s: replication slots can only be used with WAL streaming\n"), + _("%s: replication slots can only be used with WAL streaming\n"), progname); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); @@ -2405,7 +2405,7 @@ main(int argc, char **argv) * renamed to pg_wal in post-10 clusters. */ linkloc = psprintf("%s/%s", basedir, - PQserverVersion(conn) < MINIMUM_VERSION_FOR_PG_WAL ? + PQserverVersion(conn) < MINIMUM_VERSION_FOR_PG_WAL ? "pg_xlog" : "pg_wal"); #ifdef HAVE_SYMLINK diff --git a/src/bin/pg_basebackup/pg_receivewal.c b/src/bin/pg_basebackup/pg_receivewal.c index 370d871660..f3c7668d50 100644 --- a/src/bin/pg_basebackup/pg_receivewal.c +++ b/src/bin/pg_basebackup/pg_receivewal.c @@ -35,7 +35,7 @@ static char *basedir = NULL; static int verbose = 0; static int compresslevel = 0; static int noloop = 0; -static int standby_message_timeout = 10 * 1000; /* 10 sec = default */ +static int standby_message_timeout = 10 * 1000; /* 10 sec = default */ static volatile bool time_to_abort = false; static bool do_create_slot = false; static bool slot_exists_ok = false; @@ -405,7 +405,7 @@ StreamLog(void) if (verbose) fprintf(stderr, _("%s: starting log streaming at %X/%X (timeline %u)\n"), - progname, (uint32) (stream.startpos >> 32), (uint32) stream.startpos, + progname, (uint32) (stream.startpos >> 32), (uint32) stream.startpos, stream.timeline); stream.stream_stop = stop_streaming; diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c index 5f7412e9d5..6811a55e76 100644 --- a/src/bin/pg_basebackup/pg_recvlogical.c +++ b/src/bin/pg_basebackup/pg_recvlogical.c @@ -37,7 +37,7 @@ static char *outfile = NULL; static int verbose = 0; static int noloop = 0; -static int standby_message_timeout = 10 * 1000; /* 10 sec = default */ +static int standby_message_timeout = 10 * 1000; /* 10 sec = default */ static int fsync_interval = 10 * 1000; /* 10 sec = default */ static XLogRecPtr startpos = InvalidXLogRecPtr; static XLogRecPtr endpos = InvalidXLogRecPtr; @@ -132,9 +132,9 @@ sendFeedback(PGconn *conn, TimestampTz now, bool force, bool replyRequested) if (verbose) fprintf(stderr, - _("%s: confirming write up to %X/%X, flush to %X/%X (slot %s)\n"), + _("%s: confirming write up to %X/%X, flush to %X/%X (slot %s)\n"), progname, - (uint32) (output_written_lsn >> 32), (uint32) output_written_lsn, + (uint32) (output_written_lsn >> 32), (uint32) output_written_lsn, (uint32) (output_fsync_lsn >> 32), (uint32) output_fsync_lsn, replication_slot); @@ -142,13 +142,13 @@ sendFeedback(PGconn *conn, TimestampTz now, bool force, bool replyRequested) len += 1; fe_sendint64(output_written_lsn, &replybuf[len]); /* write */ len += 8; - fe_sendint64(output_fsync_lsn, &replybuf[len]); /* flush */ + fe_sendint64(output_fsync_lsn, &replybuf[len]); /* flush */ len += 8; fe_sendint64(InvalidXLogRecPtr, &replybuf[len]); /* apply */ len += 8; fe_sendint64(now, &replybuf[len]); /* sendTime */ len += 8; - replybuf[len] = replyRequested ? 1 : 0; /* replyRequested */ + replybuf[len] = replyRequested ? 1 : 0; /* replyRequested */ len += 1; startpos = output_written_lsn; @@ -241,7 +241,7 @@ StreamLogicalLog(void) /* Initiate the replication stream at specified location */ appendPQExpBuffer(query, "START_REPLICATION SLOT \"%s\" LOGICAL %X/%X", - replication_slot, (uint32) (startpos >> 32), (uint32) startpos); + replication_slot, (uint32) (startpos >> 32), (uint32) startpos); /* print options if there are any */ if (noptions) @@ -570,7 +570,7 @@ StreamLogicalLog(void) if (ret < 0) { fprintf(stderr, - _("%s: could not write %u bytes to log file \"%s\": %s\n"), + _("%s: could not write %u bytes to log file \"%s\": %s\n"), progname, bytes_left, outfile, strerror(errno)); goto error; @@ -584,7 +584,7 @@ StreamLogicalLog(void) if (write(outfd, "\n", 1) != 1) { fprintf(stderr, - _("%s: could not write %u bytes to log file \"%s\": %s\n"), + _("%s: could not write %u bytes to log file \"%s\": %s\n"), progname, 1, outfile, strerror(errno)); goto error; diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c index 52aa274bb8..15932c60b5 100644 --- a/src/bin/pg_basebackup/receivelog.c +++ b/src/bin/pg_basebackup/receivelog.c @@ -35,7 +35,7 @@ static char current_walfile_name[MAXPGPATH] = ""; static bool reportFlushPosition = false; static XLogRecPtr lastFlushPosition = InvalidXLogRecPtr; -static bool still_sending = true; /* feedback still needs to be sent? */ +static bool still_sending = true; /* feedback still needs to be sent? */ static PGresult *HandleCopyStream(PGconn *conn, StreamCtl *stream, XLogRecPtr *stoppos); @@ -116,7 +116,7 @@ open_walfile(StreamCtl *stream, XLogRecPtr startpoint) if (size < 0) { fprintf(stderr, - _("%s: could not get size of write-ahead log file \"%s\": %s\n"), + _("%s: could not get size of write-ahead log file \"%s\": %s\n"), progname, fn, stream->walmethod->getlasterror()); return false; } @@ -191,8 +191,8 @@ close_walfile(StreamCtl *stream, XLogRecPtr pos) if (currpos == -1) { fprintf(stderr, - _("%s: could not determine seek position in file \"%s\": %s\n"), - progname, current_walfile_name, stream->walmethod->getlasterror()); + _("%s: could not determine seek position in file \"%s\": %s\n"), + progname, current_walfile_name, stream->walmethod->getlasterror()); stream->walmethod->close(walfile, CLOSE_UNLINK); walfile = NULL; @@ -219,7 +219,7 @@ close_walfile(StreamCtl *stream, XLogRecPtr pos) if (r != 0) { fprintf(stderr, _("%s: could not close file \"%s\": %s\n"), - progname, current_walfile_name, stream->walmethod->getlasterror()); + progname, current_walfile_name, stream->walmethod->getlasterror()); return false; } @@ -330,18 +330,18 @@ sendFeedback(PGconn *conn, XLogRecPtr blockpos, TimestampTz now, bool replyReque replybuf[len] = 'r'; len += 1; - fe_sendint64(blockpos, &replybuf[len]); /* write */ + fe_sendint64(blockpos, &replybuf[len]); /* write */ len += 8; if (reportFlushPosition) - fe_sendint64(lastFlushPosition, &replybuf[len]); /* flush */ + fe_sendint64(lastFlushPosition, &replybuf[len]); /* flush */ else - fe_sendint64(InvalidXLogRecPtr, &replybuf[len]); /* flush */ + fe_sendint64(InvalidXLogRecPtr, &replybuf[len]); /* flush */ len += 8; fe_sendint64(InvalidXLogRecPtr, &replybuf[len]); /* apply */ len += 8; fe_sendint64(now, &replybuf[len]); /* sendTime */ len += 8; - replybuf[len] = replyRequested ? 1 : 0; /* replyRequested */ + replybuf[len] = replyRequested ? 1 : 0; /* replyRequested */ len += 1; if (PQputCopyData(conn, replybuf, len) <= 0 || PQflush(conn)) @@ -511,7 +511,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream) if (stream->timeline > atoi(PQgetvalue(res, 0, 1))) { fprintf(stderr, - _("%s: starting timeline %u is not present in the server\n"), + _("%s: starting timeline %u is not present in the server\n"), progname, stream->timeline); PQclear(res); return false; @@ -525,7 +525,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream) if (stream->temp_slot) { snprintf(query, sizeof(query), - "CREATE_REPLICATION_SLOT \"%s\" TEMPORARY PHYSICAL RESERVE_WAL", + "CREATE_REPLICATION_SLOT \"%s\" TEMPORARY PHYSICAL RESERVE_WAL", stream->replication_slot); res = PQexec(conn, query); if (PQresultStatus(res) != PGRES_TUPLES_OK) @@ -559,7 +559,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream) { /* FIXME: we might send it ok, but get an error */ fprintf(stderr, _("%s: could not send replication command \"%s\": %s"), - progname, "TIMELINE_HISTORY", PQresultErrorMessage(res)); + progname, "TIMELINE_HISTORY", PQresultErrorMessage(res)); PQclear(res); return false; } @@ -652,7 +652,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream) fprintf(stderr, _("%s: server stopped streaming timeline %u at %X/%X, but reported next timeline %u to begin at %X/%X\n"), progname, - stream->timeline, (uint32) (stoppos >> 32), (uint32) stoppos, + stream->timeline, (uint32) (stoppos >> 32), (uint32) stoppos, newtimeline, (uint32) (stream->startpos >> 32), (uint32) stream->startpos); goto error; } @@ -662,7 +662,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream) if (PQresultStatus(res) != PGRES_COMMAND_OK) { fprintf(stderr, - _("%s: unexpected termination of replication stream: %s"), + _("%s: unexpected termination of replication stream: %s"), progname, PQresultErrorMessage(res)); PQclear(res); goto error; @@ -710,7 +710,7 @@ ReceiveXlogStream(PGconn *conn, StreamCtl *stream) error: if (walfile != NULL && stream->walmethod->close(walfile, CLOSE_NO_RENAME) != 0) fprintf(stderr, _("%s: could not close file \"%s\": %s\n"), - progname, current_walfile_name, stream->walmethod->getlasterror()); + progname, current_walfile_name, stream->walmethod->getlasterror()); walfile = NULL; return false; } @@ -750,7 +750,7 @@ ReadEndOfStreamingResult(PGresult *res, XLogRecPtr *startpos, uint32 *timeline) &startpos_xrecoff) != 2) { fprintf(stderr, - _("%s: could not parse next timeline's starting point \"%s\"\n"), + _("%s: could not parse next timeline's starting point \"%s\"\n"), progname, PQgetvalue(res, 0, 1)); return false; } @@ -1167,7 +1167,7 @@ ProcessXLogDataMsg(PGconn *conn, StreamCtl *stream, char *copybuf, int len, bytes_to_write) != bytes_to_write) { fprintf(stderr, - _("%s: could not write %u bytes to WAL file \"%s\": %s\n"), + _("%s: could not write %u bytes to WAL file \"%s\": %s\n"), progname, bytes_to_write, current_walfile_name, stream->walmethod->getlasterror()); return false; diff --git a/src/bin/pg_basebackup/receivelog.h b/src/bin/pg_basebackup/receivelog.h index 9a51d9a9c4..bb786ce289 100644 --- a/src/bin/pg_basebackup/receivelog.h +++ b/src/bin/pg_basebackup/receivelog.h @@ -33,8 +33,7 @@ typedef struct StreamCtl TimeLineID timeline; /* Timeline to stream data from */ char *sysidentifier; /* Validate this system identifier and * timeline */ - int standby_message_timeout; /* Send status messages this - * often */ + int standby_message_timeout; /* Send status messages this often */ bool synchronous; /* Flush immediately WAL data on write */ bool mark_done; /* Mark segment as done in generated archive */ bool do_sync; /* Flush to disk to ensure consistent state of @@ -47,7 +46,7 @@ typedef struct StreamCtl WalWriteMethod *walmethod; /* How to write the WAL */ char *partial_suffix; /* Suffix appended to partially received files */ - char *replication_slot; /* Replication slot to use, or NULL */ + char *replication_slot; /* Replication slot to use, or NULL */ bool temp_slot; /* Create temporary replication slot */ } StreamCtl; @@ -57,4 +56,4 @@ extern bool CheckServerVersionForStreaming(PGconn *conn); extern bool ReceiveXlogStream(PGconn *conn, StreamCtl *stream); -#endif /* RECEIVELOG_H */ +#endif /* RECEIVELOG_H */ diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c index 7ea3b0f8ee..d7ba7e2c49 100644 --- a/src/bin/pg_basebackup/streamutil.c +++ b/src/bin/pg_basebackup/streamutil.c @@ -212,7 +212,7 @@ GetConnection(void) if (!tmpparam) { fprintf(stderr, - _("%s: could not determine server setting for integer_datetimes\n"), + _("%s: could not determine server setting for integer_datetimes\n"), progname); PQfinish(tmpconn); exit(1); @@ -221,7 +221,7 @@ GetConnection(void) if (strcmp(tmpparam, "on") != 0) { fprintf(stderr, - _("%s: integer_datetimes compile flag does not match server\n"), + _("%s: integer_datetimes compile flag does not match server\n"), progname); PQfinish(tmpconn); exit(1); @@ -282,7 +282,7 @@ RunIdentifySystem(PGconn *conn, char **sysid, TimeLineID *starttli, if (sscanf(PQgetvalue(res, 0, 2), "%X/%X", &hi, &lo) != 2) { fprintf(stderr, - _("%s: could not parse write-ahead log location \"%s\"\n"), + _("%s: could not parse write-ahead log location \"%s\"\n"), progname, PQgetvalue(res, 0, 2)); PQclear(res); diff --git a/src/bin/pg_basebackup/streamutil.h b/src/bin/pg_basebackup/streamutil.h index 460dcb5267..6f6878679f 100644 --- a/src/bin/pg_basebackup/streamutil.h +++ b/src/bin/pg_basebackup/streamutil.h @@ -48,4 +48,4 @@ extern bool feTimestampDifferenceExceeds(TimestampTz start_time, TimestampTz sto extern void fe_sendint64(int64 i, char *buf); extern int64 fe_recvint64(char *buf); -#endif /* STREAMUTIL_H */ +#endif /* STREAMUTIL_H */ diff --git a/src/bin/pg_basebackup/walmethods.c b/src/bin/pg_basebackup/walmethods.c index 4c2edca8fe..5fe02dee72 100644 --- a/src/bin/pg_basebackup/walmethods.c +++ b/src/bin/pg_basebackup/walmethods.c @@ -534,7 +534,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_ * We open the tar file only when we first try to write to it. */ tar_data->fd = open(tar_data->tarfilename, - O_WRONLY | O_CREAT | PG_BINARY, S_IRUSR | S_IWUSR); + O_WRONLY | O_CREAT | PG_BINARY, S_IRUSR | S_IWUSR); if (tar_data->fd < 0) return NULL; diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 8043d326b3..a84b0beba3 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -68,6 +68,10 @@ typedef enum #define DEFAULT_WAIT 60 +#define USEC_PER_SEC 1000000 + +#define WAITS_PER_SEC 10 /* should divide USEC_PER_SEC evenly */ + static bool do_wait = true; static int wait_seconds = DEFAULT_WAIT; static bool wait_seconds_arg = false; @@ -83,7 +87,7 @@ static const char *progname; static char *log_file = NULL; static char *exec_path = NULL; static char *event_source = NULL; -static char *register_servicename = "PostgreSQL"; /* FIXME: + version ID? */ +static char *register_servicename = "PostgreSQL"; /* FIXME: + version ID? */ static char *register_username = NULL; static char *register_password = NULL; static char *argv0 = NULL; @@ -173,7 +177,7 @@ write_eventlog(int level, const char *line) if (evtHandle == INVALID_HANDLE_VALUE) { evtHandle = RegisterEventSource(NULL, - event_source ? event_source : DEFAULT_EVENT_SOURCE); + event_source ? event_source : DEFAULT_EVENT_SOURCE); if (evtHandle == NULL) { evtHandle = INVALID_HANDLE_VALUE; @@ -214,7 +218,7 @@ write_stderr(const char *fmt,...) */ if (pgwin32_is_service()) /* Running as a service */ { - char errbuf[2048]; /* Arbitrary size? */ + char errbuf[2048]; /* Arbitrary size? */ vsnprintf(errbuf, sizeof(errbuf), fmt, ap); @@ -260,8 +264,7 @@ get_pgpid(bool is_status_request) /* * The Linux Standard Base Core Specification 3.1 says this should * return '4, program or service status is unknown' - * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-g - * eneric/iniscrptact.html + * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */ exit(is_status_request ? 4 : 1); } @@ -514,7 +517,7 @@ start_postmaster(void) postmasterProcess = pi.hProcess; CloseHandle(pi.hThread); return pi.dwProcessId; /* Shell's PID, not postmaster's! */ -#endif /* WIN32 */ +#endif /* WIN32 */ } @@ -546,7 +549,7 @@ test_postmaster_connection(pgpid_t pm_pid, bool do_checkpoint) connstr[0] = '\0'; - for (i = 0; i < wait_seconds; i++) + for (i = 0; i < wait_seconds * WAITS_PER_SEC; i++) { /* Do we need a connection string? */ if (connstr[0] == '\0') @@ -674,7 +677,7 @@ test_postmaster_connection(pgpid_t pm_pid, bool do_checkpoint) * timeout first. */ snprintf(connstr, sizeof(connstr), - "dbname=postgres port=%d host='%s' connect_timeout=5", + "dbname=postgres port=%d host='%s' connect_timeout=5", portnum, host_str); } } @@ -716,24 +719,28 @@ test_postmaster_connection(pgpid_t pm_pid, bool do_checkpoint) #endif /* No response, or startup still in process; wait */ -#ifdef WIN32 - if (do_checkpoint) + if (i % WAITS_PER_SEC == 0) { - /* - * Increment the wait hint by 6 secs (connection timeout + sleep) - * We must do this to indicate to the SCM that our startup time is - * changing, otherwise it'll usually send a stop signal after 20 - * seconds, despite incrementing the checkpoint counter. - */ - status.dwWaitHint += 6000; - status.dwCheckPoint++; - SetServiceStatus(hStatus, (LPSERVICE_STATUS) &status); - } - else +#ifdef WIN32 + if (do_checkpoint) + { + /* + * Increment the wait hint by 6 secs (connection timeout + + * sleep). We must do this to indicate to the SCM that our + * startup time is changing, otherwise it'll usually send a + * stop signal after 20 seconds, despite incrementing the + * checkpoint counter. + */ + status.dwWaitHint += 6000; + status.dwCheckPoint++; + SetServiceStatus(hStatus, (LPSERVICE_STATUS) &status); + } + else #endif - print_msg("."); + print_msg("."); + } - pg_usleep(1000000); /* 1 sec */ + pg_usleep(USEC_PER_SEC / WAITS_PER_SEC); } /* return result of last call to PQping */ @@ -801,8 +808,7 @@ read_post_opts(void) */ if ((arg1 = strstr(optline, " \"")) != NULL) { - *arg1 = '\0'; /* terminate so we get only program - * name */ + *arg1 = '\0'; /* terminate so we get only program name */ post_opts = pg_strdup(arg1 + 1); /* point past whitespace */ } if (exec_path == NULL) @@ -1014,12 +1020,13 @@ do_stop(void) print_msg(_("waiting for server to shut down...")); - for (cnt = 0; cnt < wait_seconds; cnt++) + for (cnt = 0; cnt < wait_seconds * WAITS_PER_SEC; cnt++) { if ((pid = get_pgpid(false)) != 0) { - print_msg("."); - pg_usleep(1000000); /* 1 sec */ + if (cnt % WAITS_PER_SEC == 0) + print_msg("."); + pg_usleep(USEC_PER_SEC / WAITS_PER_SEC); } else break; @@ -1032,7 +1039,7 @@ do_stop(void) write_stderr(_("%s: server does not shut down\n"), progname); if (shutdown_mode == SMART_MODE) write_stderr(_("HINT: The \"-m fast\" option immediately disconnects sessions rather than\n" - "waiting for session-initiated disconnection.\n")); + "waiting for session-initiated disconnection.\n")); exit(1); } print_msg(_(" done\n")); @@ -1104,12 +1111,13 @@ do_restart(void) /* always wait for restart */ - for (cnt = 0; cnt < wait_seconds; cnt++) + for (cnt = 0; cnt < wait_seconds * WAITS_PER_SEC; cnt++) { if ((pid = get_pgpid(false)) != 0) { - print_msg("."); - pg_usleep(1000000); /* 1 sec */ + if (cnt % WAITS_PER_SEC == 0) + print_msg("."); + pg_usleep(USEC_PER_SEC / WAITS_PER_SEC); } else break; @@ -1122,7 +1130,7 @@ do_restart(void) write_stderr(_("%s: server does not shut down\n"), progname); if (shutdown_mode == SMART_MODE) write_stderr(_("HINT: The \"-m fast\" option immediately disconnects sessions rather than\n" - "waiting for session-initiated disconnection.\n")); + "waiting for session-initiated disconnection.\n")); exit(1); } @@ -1241,17 +1249,18 @@ do_promote(void) if (do_wait) { DBState state = DB_STARTUP; + int cnt; print_msg(_("waiting for server to promote...")); - while (wait_seconds > 0) + for (cnt = 0; cnt < wait_seconds * WAITS_PER_SEC; cnt++) { state = get_control_dbstate(); if (state == DB_IN_PRODUCTION) break; - print_msg("."); - pg_usleep(1000000); /* 1 sec */ - wait_seconds--; + if (cnt % WAITS_PER_SEC == 0) + print_msg("."); + pg_usleep(USEC_PER_SEC / WAITS_PER_SEC); } if (state == DB_IN_PRODUCTION) { @@ -1346,8 +1355,7 @@ do_status(void) /* * The Linux Standard Base Core Specification 3.1 says this should return * '3, program is not running' - * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-gener - * ic/iniscrptact.html + * https://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html */ exit(3); } @@ -1376,7 +1384,7 @@ IsWindowsXPOrGreater(void) osv.dwOSVersionInfoSize = sizeof(osv); /* Windows XP = Version 5.1 */ - return (!GetVersionEx(&osv) || /* could not get version */ + return (!GetVersionEx(&osv) || /* could not get version */ osv.dwMajorVersion > 5 || (osv.dwMajorVersion == 5 && osv.dwMinorVersion >= 1)); } @@ -1388,7 +1396,7 @@ IsWindows7OrGreater(void) osv.dwOSVersionInfoSize = sizeof(osv); /* Windows 7 = Version 6.0 */ - return (!GetVersionEx(&osv) || /* could not get version */ + return (!GetVersionEx(&osv) || /* could not get version */ osv.dwMajorVersion > 6 || (osv.dwMajorVersion == 6 && osv.dwMinorVersion >= 0)); } #endif @@ -1507,10 +1515,10 @@ pgwin32_doRegister(void) } if ((hService = CreateService(hSCM, register_servicename, register_servicename, - SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, + SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, pgctl_start_type, SERVICE_ERROR_NORMAL, pgwin32_CommandLine(true), - NULL, NULL, "RPCSS\0", register_username, register_password)) == NULL) + NULL, NULL, "RPCSS\0", register_username, register_password)) == NULL) { CloseServiceHandle(hSCM); write_stderr(_("%s: could not register service \"%s\": error code %lu\n"), @@ -1679,7 +1687,7 @@ pgwin32_ServiceMain(DWORD argc, LPTSTR *argv) break; } - case (WAIT_OBJECT_0 + 1): /* postmaster went down */ + case (WAIT_OBJECT_0 + 1): /* postmaster went down */ break; default: @@ -1796,10 +1804,10 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser /* Allocate list of SIDs to remove */ ZeroMemory(&dropSids, sizeof(dropSids)); if (!AllocateAndInitializeSid(&NtAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, + SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &dropSids[0].Sid) || !AllocateAndInitializeSid(&NtAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0, + SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0, 0, &dropSids[1].Sid)) { write_stderr(_("%s: could not allocate SIDs: error code %lu\n"), @@ -1931,7 +1939,7 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser */ return r; } -#endif /* WIN32 */ +#endif /* WIN32 */ static void do_advice(void) @@ -1984,7 +1992,7 @@ do_help(void) #endif printf(_(" -l, --log=FILENAME write (or append) server log to FILENAME\n")); printf(_(" -o, --options=OPTIONS command line options to pass to postgres\n" - " (PostgreSQL server executable) or initdb\n")); + " (PostgreSQL server executable) or initdb\n")); printf(_(" -p PATH-TO-POSTGRES normally not necessary\n")); printf(_("\nOptions for stop or restart:\n")); printf(_(" -m, --mode=MODE MODE can be \"smart\", \"fast\", or \"immediate\"\n")); diff --git a/src/bin/pg_dump/compress_io.c b/src/bin/pg_dump/compress_io.c index 631fa337e6..991fe11e8a 100644 --- a/src/bin/pg_dump/compress_io.c +++ b/src/bin/pg_dump/compress_io.c @@ -388,7 +388,7 @@ ReadDataFromArchiveZlib(ArchiveHandle *AH, ReadFunc readF) free(out); free(zp); } -#endif /* HAVE_LIBZ */ +#endif /* HAVE_LIBZ */ /* @@ -593,7 +593,7 @@ cfread(void *ptr, int size, cfp *fp) ret = gzread(fp->compressedfp, ptr, size); if (ret != size && !gzeof(fp->compressedfp)) exit_horribly(modulename, - "could not read from input file: %s\n", strerror(errno)); + "could not read from input file: %s\n", strerror(errno)); } else #endif @@ -629,10 +629,10 @@ cfgetc(cfp *fp) { if (!gzeof(fp->compressedfp)) exit_horribly(modulename, - "could not read from input file: %s\n", strerror(errno)); + "could not read from input file: %s\n", strerror(errno)); else exit_horribly(modulename, - "could not read from input file: end of file\n"); + "could not read from input file: end of file\n"); } } else diff --git a/src/bin/pg_dump/dumputils.c b/src/bin/pg_dump/dumputils.c index 79eac8c7cf..dfc611848b 100644 --- a/src/bin/pg_dump/dumputils.c +++ b/src/bin/pg_dump/dumputils.c @@ -177,7 +177,7 @@ buildACLCommands(const char *name, const char *subname, else if (strncmp(grantee->data, "group ", strlen("group ")) == 0) appendPQExpBuffer(firstsql, "GROUP %s;\n", - fmtId(grantee->data + strlen("group "))); + fmtId(grantee->data + strlen("group "))); else appendPQExpBuffer(firstsql, "%s;\n", fmtId(grantee->data)); @@ -185,14 +185,14 @@ buildACLCommands(const char *name, const char *subname, if (privswgo->len > 0) { appendPQExpBuffer(firstsql, - "%sREVOKE GRANT OPTION FOR %s ON %s %s FROM ", + "%sREVOKE GRANT OPTION FOR %s ON %s %s FROM ", prefix, privswgo->data, type, name); if (grantee->len == 0) appendPQExpBufferStr(firstsql, "PUBLIC"); else if (strncmp(grantee->data, "group ", strlen("group ")) == 0) appendPQExpBuffer(firstsql, "GROUP %s", - fmtId(grantee->data + strlen("group "))); + fmtId(grantee->data + strlen("group "))); else appendPQExpBufferStr(firstsql, fmtId(grantee->data)); } @@ -260,7 +260,7 @@ buildACLCommands(const char *name, const char *subname, fmtId(grantee->data)); if (privswgo->len > 0) appendPQExpBuffer(firstsql, - "%sGRANT %s ON %s %s TO %s WITH GRANT OPTION;\n", + "%sGRANT %s ON %s %s TO %s WITH GRANT OPTION;\n", prefix, privswgo->data, type, name, fmtId(grantee->data)); } @@ -291,7 +291,7 @@ buildACLCommands(const char *name, const char *subname, else if (strncmp(grantee->data, "group ", strlen("group ")) == 0) appendPQExpBuffer(secondsql, "GROUP %s;\n", - fmtId(grantee->data + strlen("group "))); + fmtId(grantee->data + strlen("group "))); else appendPQExpBuffer(secondsql, "%s;\n", fmtId(grantee->data)); } @@ -304,7 +304,7 @@ buildACLCommands(const char *name, const char *subname, else if (strncmp(grantee->data, "group ", strlen("group ")) == 0) appendPQExpBuffer(secondsql, "GROUP %s", - fmtId(grantee->data + strlen("group "))); + fmtId(grantee->data + strlen("group "))); else appendPQExpBufferStr(secondsql, fmtId(grantee->data)); appendPQExpBufferStr(secondsql, " WITH GRANT OPTION;\n"); @@ -604,7 +604,7 @@ copyAclUserName(PQExpBuffer output, char *input) while (!(*input == '"' && *(input + 1) != '"')) { if (*input == '\0') - return input; /* really a syntax error... */ + return input; /* really a syntax error... */ /* * Quoting convention is to escape " as "". Keep this code in @@ -764,16 +764,16 @@ buildACLQueries(PQExpBuffer acl_subquery, PQExpBuffer racl_subquery, "(SELECT pg_catalog.array_agg(acl) FROM " "(SELECT pg_catalog.unnest(pip.initprivs) AS acl " "EXCEPT " - "SELECT pg_catalog.unnest(pg_catalog.acldefault(%s,%s))) as foo) END", + "SELECT pg_catalog.unnest(pg_catalog.acldefault(%s,%s))) as foo) END", obj_kind, acl_owner); printfPQExpBuffer(init_racl_subquery, "CASE WHEN privtype = 'e' THEN " "(SELECT pg_catalog.array_agg(acl) FROM " - "(SELECT pg_catalog.unnest(pg_catalog.acldefault(%s,%s)) AS acl " + "(SELECT pg_catalog.unnest(pg_catalog.acldefault(%s,%s)) AS acl " "EXCEPT " - "SELECT pg_catalog.unnest(pip.initprivs)) as foo) END", + "SELECT pg_catalog.unnest(pip.initprivs)) as foo) END", obj_kind, acl_owner); } diff --git a/src/bin/pg_dump/dumputils.h b/src/bin/pg_dump/dumputils.h index d7eecdfb3c..fe364dd8c4 100644 --- a/src/bin/pg_dump/dumputils.h +++ b/src/bin/pg_dump/dumputils.h @@ -56,4 +56,4 @@ extern void buildACLQueries(PQExpBuffer acl_subquery, PQExpBuffer racl_subquery, const char *acl_column, const char *acl_owner, const char *obj_kind, bool binary_upgrade); -#endif /* DUMPUTILS_H */ +#endif /* DUMPUTILS_H */ diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c index feda575af8..8ad51942ff 100644 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@ -91,7 +91,7 @@ struct ParallelSlot T_WorkerStatus workerStatus; /* see enum above */ /* These fields are valid if workerStatus == WRKR_WORKING: */ - ParallelCompletionPtr callback; /* function to call on completion */ + ParallelCompletionPtr callback; /* function to call on completion */ void *callback_data; /* passthrough data for it */ ArchiveHandle *AH; /* Archive data worker is using */ @@ -134,7 +134,7 @@ static int piperead(int s, char *buf, int len); #define piperead(a,b,c) read(a,b,c) #define pipewrite(a,b,c) write(a,b,c) -#endif /* WIN32 */ +#endif /* WIN32 */ /* * State info for archive_close_connection() shutdown callback. @@ -193,7 +193,7 @@ static DWORD tls_index; /* globally visible variables (needed by exit_nicely) */ bool parallel_init_done = false; DWORD mainThreadId; -#endif /* WIN32 */ +#endif /* WIN32 */ static const char *modulename = gettext_noop("parallel archiver"); @@ -335,7 +335,7 @@ getThreadLocalPQExpBuffer(void) return id_return; } -#endif /* WIN32 */ +#endif /* WIN32 */ /* * pg_dump and pg_restore call this to register the cleanup handler @@ -512,7 +512,7 @@ WaitForTerminatingWorkers(ParallelState *pstate) break; } } -#endif /* WIN32 */ +#endif /* WIN32 */ /* On all platforms, update workerStatus and te[] as well */ Assert(j < pstate->numWorkers); @@ -729,7 +729,7 @@ setup_cancel_handler(void) } } -#endif /* WIN32 */ +#endif /* WIN32 */ /* @@ -898,7 +898,7 @@ init_spawned_worker_win32(WorkerInfo *wi) _endthreadex(0); return 0; } -#endif /* WIN32 */ +#endif /* WIN32 */ /* * This function starts a parallel dump or restore by spawning off the worker @@ -1044,7 +1044,7 @@ ParallelBackupStart(ArchiveHandle *AH) closesocket(pipeMW[PIPE_READ]); /* close write end of Worker -> Master */ closesocket(pipeWM[PIPE_WRITE]); -#endif /* WIN32 */ +#endif /* WIN32 */ } /* @@ -1342,8 +1342,8 @@ lockTableForWorker(ArchiveHandle *AH, TocEntry *te) if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) exit_horribly(modulename, "could not obtain lock on relation \"%s\"\n" - "This usually means that someone requested an ACCESS EXCLUSIVE lock " - "on the table after the pg_dump parent process had gotten the " + "This usually means that someone requested an ACCESS EXCLUSIVE lock " + "on the table after the pg_dump parent process had gotten the " "initial ACCESS SHARE lock on the table.\n", qualId); PQclear(res); @@ -1840,4 +1840,4 @@ piperead(int s, char *buf, int len) return ret; } -#endif /* WIN32 */ +#endif /* WIN32 */ diff --git a/src/bin/pg_dump/parallel.h b/src/bin/pg_dump/parallel.h index ad99735226..8d800bdf83 100644 --- a/src/bin/pg_dump/parallel.h +++ b/src/bin/pg_dump/parallel.h @@ -20,9 +20,9 @@ /* Function to call in master process on completion of a worker task */ typedef void (*ParallelCompletionPtr) (ArchiveHandle *AH, - TocEntry *te, - int status, - void *callback_data); + TocEntry *te, + int status, + void *callback_data); /* Wait options for WaitForWorkers */ typedef enum @@ -67,4 +67,4 @@ extern void ParallelBackupEnd(ArchiveHandle *AH, ParallelState *pstate); extern void set_archive_cancel_info(ArchiveHandle *AH, PGconn *conn); -#endif /* PG_DUMP_PARALLEL_H */ +#endif /* PG_DUMP_PARALLEL_H */ diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index c567905a29..52a5e1cc7e 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -63,10 +63,10 @@ typedef struct _restoreOptions int createDB; /* Issue commands to create the database */ int noOwner; /* Don't try to match original object owner */ int noTablespace; /* Don't issue tablespace-related commands */ - int disable_triggers; /* disable triggers during data-only - * restore */ - int use_setsessauth;/* Use SET SESSION AUTHORIZATION commands - * instead of OWNER TO */ + int disable_triggers; /* disable triggers during data-only + * restore */ + int use_setsessauth; /* Use SET SESSION AUTHORIZATION commands + * instead of OWNER TO */ char *superuser; /* Username to use as superuser */ char *use_role; /* Issue SET ROLE to this */ int dropSchema; @@ -75,8 +75,8 @@ typedef struct _restoreOptions int column_inserts; int if_exists; int no_publications; /* Skip publication entries */ - int no_security_labels; /* Skip security label entries */ - int no_subscriptions; /* Skip subscription entries */ + int no_security_labels; /* Skip security label entries */ + int no_subscriptions; /* Skip subscription entries */ int strict_names; const char *filename; @@ -181,17 +181,16 @@ typedef struct Archive RestoreOptions *ropt; /* options, if restoring */ int verbose; - char *remoteVersionStr; /* server's version string */ + char *remoteVersionStr; /* server's version string */ int remoteVersion; /* same in numeric form */ bool isStandby; /* is server a standby node */ bool isPostgresXL; /* is server a Postgres-XL node */ - int minRemoteVersion; /* allowable range */ + int minRemoteVersion; /* allowable range */ int maxRemoteVersion; int numWorkers; /* number of parallel processes */ - char *sync_snapshot_id; /* sync snapshot id for parallel - * operation */ + char *sync_snapshot_id; /* sync snapshot id for parallel operation */ /* info needed for string escaping */ int encoding; /* libpq code for client_encoding */ @@ -300,4 +299,4 @@ extern int archprintf(Archive *AH, const char *fmt,...) pg_attribute_printf(2, 3 #define appendStringLiteralAH(buf,str,AH) \ appendStringLiteral(buf, str, (AH)->encoding, (AH)->std_strings) -#endif /* PG_BACKUP_H */ +#endif /* PG_BACKUP_H */ diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 6720595746..c24a0f07e2 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -572,7 +572,7 @@ RestoreArchive(Archive *AHX) char *mark; if (strcmp(te->desc, "CONSTRAINT") == 0 || - strcmp(te->desc, "CHECK CONSTRAINT") == 0 || + strcmp(te->desc, "CHECK CONSTRAINT") == 0 || strcmp(te->desc, "FK CONSTRAINT") == 0) strcpy(buffer, "DROP CONSTRAINT"); else @@ -744,7 +744,7 @@ restore_toc_entry(ArchiveHandle *AH, TocEntry *te, bool is_parallel) defnDumped = false; - if ((reqs & REQ_SCHEMA) != 0) /* We want the schema */ + if ((reqs & REQ_SCHEMA) != 0) /* We want the schema */ { /* Show namespace if available */ if (te->namespace) @@ -1650,13 +1650,13 @@ dump_lo_buf(ArchiveHandle *AH) res = lo_write(AH->connection, AH->loFd, AH->lo_buf, AH->lo_buf_used); ahlog(AH, 5, ngettext("wrote %lu byte of large object data (result = %lu)\n", - "wrote %lu bytes of large object data (result = %lu)\n", + "wrote %lu bytes of large object data (result = %lu)\n", AH->lo_buf_used), (unsigned long) AH->lo_buf_used, (unsigned long) res); if (res != AH->lo_buf_used) exit_horribly(modulename, - "could not write to large object (result: %lu, expected: %lu)\n", - (unsigned long) res, (unsigned long) AH->lo_buf_used); + "could not write to large object (result: %lu, expected: %lu)\n", + (unsigned long) res, (unsigned long) AH->lo_buf_used); } else { @@ -1765,8 +1765,8 @@ warn_or_exit_horribly(ArchiveHandle *AH, { write_msg(modulename, "Error from TOC entry %d; %u %u %s %s %s\n", AH->currentTE->dumpId, - AH->currentTE->catalogId.tableoid, AH->currentTE->catalogId.oid, - AH->currentTE->desc, AH->currentTE->tag, AH->currentTE->owner); + AH->currentTE->catalogId.tableoid, AH->currentTE->catalogId.oid, + AH->currentTE->desc, AH->currentTE->tag, AH->currentTE->owner); } AH->lastErrorStage = AH->stage; AH->lastErrorTE = AH->currentTE; @@ -2179,7 +2179,7 @@ _discoverArchiveFormat(ArchiveHandle *AH) AH->lookahead[AH->lookaheadLen++] = vmin; /* Check header version; varies from V1.0 */ - if (vmaj > 1 || (vmaj == 1 && vmin > 0)) /* Version > 1.0 */ + if (vmaj > 1 || (vmaj == 1 && vmin > 0)) /* Version > 1.0 */ { if ((byteread = fgetc(fh)) == EOF) READ_ERROR_EXIT(fh); @@ -2337,12 +2337,12 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt, AH->OF = stdout; /* - * On Windows, we need to use binary mode to read/write non-text archive - * formats. Force stdin/stdout into binary mode if that is what we are - * using. + * On Windows, we need to use binary mode to read/write non-text files, + * which include all archive formats as well as compressed plain text. + * Force stdin/stdout into binary mode if that is what we are using. */ #ifdef WIN32 - if (fmt != archNull && + if ((fmt != archNull || compression != 0) && (AH->fSpec == NULL || strcmp(AH->fSpec, "") == 0)) { if (mode == archModeWrite) @@ -2559,7 +2559,7 @@ ReadToc(ArchiveHandle *AH) /* Sanity check */ if (te->dumpId <= 0) exit_horribly(modulename, - "entry ID %d out of range -- perhaps a corrupt TOC\n", + "entry ID %d out of range -- perhaps a corrupt TOC\n", te->dumpId); te->hadDumper = ReadInt(AH); @@ -2924,7 +2924,7 @@ _tocEntryRequired(TocEntry *te, teSection curSection, RestoreOptions *ropt) */ if (!(ropt->sequence_data && strcmp(te->desc, "SEQUENCE SET") == 0) && !(ropt->binary_upgrade && strcmp(te->desc, "BLOB") == 0) && - !(ropt->binary_upgrade && strncmp(te->tag, "LARGE OBJECT ", 13) == 0)) + !(ropt->binary_upgrade && strncmp(te->tag, "LARGE OBJECT ", 13) == 0)) res = res & REQ_SCHEMA; } @@ -3270,8 +3270,8 @@ _selectTablespace(ArchiveHandle *AH, const char *tablespace) if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) warn_or_exit_horribly(AH, modulename, - "could not set default_tablespace to %s: %s", - fmtId(want), PQerrorMessage(AH->connection)); + "could not set default_tablespace to %s: %s", + fmtId(want), PQerrorMessage(AH->connection)); PQclear(res); } @@ -3600,7 +3600,7 @@ WriteHead(ArchiveHandle *AH) { struct tm crtm; - (*AH->WriteBufPtr) (AH, "PGDMP", 5); /* Magic code */ + (*AH->WriteBufPtr) (AH, "PGDMP", 5); /* Magic code */ (*AH->WriteBytePtr) (AH, ARCHIVE_MAJOR(AH->version)); (*AH->WriteBytePtr) (AH, ARCHIVE_MINOR(AH->version)); (*AH->WriteBytePtr) (AH, ARCHIVE_REV(AH->version)); @@ -3648,7 +3648,7 @@ ReadHead(ArchiveHandle *AH) vmaj = (*AH->ReadBytePtr) (AH); vmin = (*AH->ReadBytePtr) (AH); - if (vmaj > 1 || (vmaj == 1 && vmin > 0)) /* Version > 1.0 */ + if (vmaj > 1 || (vmaj == 1 && vmin > 0)) /* Version > 1.0 */ vrev = (*AH->ReadBytePtr) (AH); else vrev = 0; diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index 3ee75f0b6e..6123859132 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -75,23 +75,23 @@ typedef z_stream *z_streamp; /* Historical version numbers (checked in code) */ #define K_VERS_1_0 MAKE_ARCHIVE_VERSION(1, 0, 0) -#define K_VERS_1_2 MAKE_ARCHIVE_VERSION(1, 2, 0) /* Allow No ZLIB */ -#define K_VERS_1_3 MAKE_ARCHIVE_VERSION(1, 3, 0) /* BLOBs */ -#define K_VERS_1_4 MAKE_ARCHIVE_VERSION(1, 4, 0) /* Date & name in header */ -#define K_VERS_1_5 MAKE_ARCHIVE_VERSION(1, 5, 0) /* Handle dependencies */ -#define K_VERS_1_6 MAKE_ARCHIVE_VERSION(1, 6, 0) /* Schema field in TOCs */ -#define K_VERS_1_7 MAKE_ARCHIVE_VERSION(1, 7, 0) /* File Offset size in - * header */ -#define K_VERS_1_8 MAKE_ARCHIVE_VERSION(1, 8, 0) /* change interpretation - * of ID numbers and - * dependencies */ -#define K_VERS_1_9 MAKE_ARCHIVE_VERSION(1, 9, 0) /* add default_with_oids - * tracking */ -#define K_VERS_1_10 MAKE_ARCHIVE_VERSION(1, 10, 0) /* add tablespace */ -#define K_VERS_1_11 MAKE_ARCHIVE_VERSION(1, 11, 0) /* add toc section - * indicator */ -#define K_VERS_1_12 MAKE_ARCHIVE_VERSION(1, 12, 0) /* add separate BLOB - * entries */ +#define K_VERS_1_2 MAKE_ARCHIVE_VERSION(1, 2, 0) /* Allow No ZLIB */ +#define K_VERS_1_3 MAKE_ARCHIVE_VERSION(1, 3, 0) /* BLOBs */ +#define K_VERS_1_4 MAKE_ARCHIVE_VERSION(1, 4, 0) /* Date & name in header */ +#define K_VERS_1_5 MAKE_ARCHIVE_VERSION(1, 5, 0) /* Handle dependencies */ +#define K_VERS_1_6 MAKE_ARCHIVE_VERSION(1, 6, 0) /* Schema field in TOCs */ +#define K_VERS_1_7 MAKE_ARCHIVE_VERSION(1, 7, 0) /* File Offset size in + * header */ +#define K_VERS_1_8 MAKE_ARCHIVE_VERSION(1, 8, 0) /* change interpretation + * of ID numbers and + * dependencies */ +#define K_VERS_1_9 MAKE_ARCHIVE_VERSION(1, 9, 0) /* add default_with_oids + * tracking */ +#define K_VERS_1_10 MAKE_ARCHIVE_VERSION(1, 10, 0) /* add tablespace */ +#define K_VERS_1_11 MAKE_ARCHIVE_VERSION(1, 11, 0) /* add toc section + * indicator */ +#define K_VERS_1_12 MAKE_ARCHIVE_VERSION(1, 12, 0) /* add separate BLOB + * entries */ /* Current archive version number (the format we can output) */ #define K_VERS_MAJOR 1 @@ -217,8 +217,8 @@ struct _archiveHandle char *archiveRemoteVersion; /* When reading an archive, the * version of the dumped DB */ - char *archiveDumpVersion; /* When reading an archive, the - * version of the dumper */ + char *archiveDumpVersion; /* When reading an archive, the version of + * the dumper */ int debugLevel; /* Used for logging (currently only by * --verbose) */ @@ -242,25 +242,24 @@ struct _archiveHandle size_t lookaheadLen; /* Length of data in lookahead */ pgoff_t lookaheadPos; /* Current read position in lookahead buffer */ - ArchiveEntryPtrType ArchiveEntryPtr; /* Called for each metadata - * object */ - StartDataPtrType StartDataPtr; /* Called when table data is about to - * be dumped */ - WriteDataPtrType WriteDataPtr; /* Called to send some table data to - * the archive */ + ArchiveEntryPtrType ArchiveEntryPtr; /* Called for each metadata object */ + StartDataPtrType StartDataPtr; /* Called when table data is about to be + * dumped */ + WriteDataPtrType WriteDataPtr; /* Called to send some table data to the + * archive */ EndDataPtrType EndDataPtr; /* Called when table data dump is finished */ - WriteBytePtrType WriteBytePtr; /* Write a byte to output */ + WriteBytePtrType WriteBytePtr; /* Write a byte to output */ ReadBytePtrType ReadBytePtr; /* Read a byte from an archive */ WriteBufPtrType WriteBufPtr; /* Write a buffer of output to the archive */ ReadBufPtrType ReadBufPtr; /* Read a buffer of input from the archive */ ClosePtrType ClosePtr; /* Close the archive */ ReopenPtrType ReopenPtr; /* Reopen the archive */ - WriteExtraTocPtrType WriteExtraTocPtr; /* Write extra TOC entry data - * associated with the current - * archive format */ - ReadExtraTocPtrType ReadExtraTocPtr; /* Read extra info associated - * with archive format */ - PrintExtraTocPtrType PrintExtraTocPtr; /* Extra TOC info for format */ + WriteExtraTocPtrType WriteExtraTocPtr; /* Write extra TOC entry data + * associated with the current + * archive format */ + ReadExtraTocPtrType ReadExtraTocPtr; /* Read extra info associated with + * archive format */ + PrintExtraTocPtrType PrintExtraTocPtr; /* Extra TOC info for format */ PrintTocDataPtrType PrintTocDataPtr; StartBlobsPtrType StartBlobsPtr; @@ -275,7 +274,7 @@ struct _archiveHandle ClonePtrType ClonePtr; /* Clone format-specific fields */ DeClonePtrType DeClonePtr; /* Clean up cloned fields */ - CustomOutPtrType CustomOutPtr; /* Alternative script output routine */ + CustomOutPtrType CustomOutPtr; /* Alternative script output routine */ /* Stuff for direct DB connection */ char *archdbname; /* DB name *read* from archive */ diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c index a1f4cb1fea..3da00403a1 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -476,9 +476,9 @@ _PrintTocData(ArchiveHandle *AH, TocEntry *te) else if (!ctx->hasSeek) exit_horribly(modulename, "could not find block ID %d in archive -- " "possibly due to out-of-order restore request, " - "which cannot be handled due to non-seekable input file\n", + "which cannot be handled due to non-seekable input file\n", te->dumpId); - else /* huh, the dataPos led us to EOF? */ + else /* huh, the dataPos led us to EOF? */ exit_horribly(modulename, "could not find block ID %d in archive -- " "possibly corrupt archive\n", te->dumpId); @@ -581,10 +581,10 @@ _skipData(ArchiveHandle *AH) { if (feof(AH->FH)) exit_horribly(modulename, - "could not read from input file: end of file\n"); + "could not read from input file: end of file\n"); else exit_horribly(modulename, - "could not read from input file: %s\n", strerror(errno)); + "could not read from input file: %s\n", strerror(errno)); } ctx->filePos += blkLen; diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index a778a82e31..5fb1a3f9a6 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -651,7 +651,7 @@ EndDBCopyMode(Archive *AHX, const char *tocEntryTag) res = PQgetResult(AH->connection); if (PQresultStatus(res) != PGRES_COMMAND_OK) warn_or_exit_horribly(AH, modulename, "COPY failed for table \"%s\": %s", - tocEntryTag, PQerrorMessage(AH->connection)); + tocEntryTag, PQerrorMessage(AH->connection)); PQclear(res); /* Do this to ensure we've pumped libpq back to idle state */ diff --git a/src/bin/pg_dump/pg_backup_tar.c b/src/bin/pg_dump/pg_backup_tar.c index a2b320f371..f839712945 100644 --- a/src/bin/pg_dump/pg_backup_tar.c +++ b/src/bin/pg_dump/pg_backup_tar.c @@ -178,7 +178,7 @@ InitArchiveFmt_Tar(ArchiveHandle *AH) ctx->tarFH = fopen(AH->fSpec, PG_BINARY_W); if (ctx->tarFH == NULL) exit_horribly(modulename, - "could not open TOC file \"%s\" for output: %s\n", + "could not open TOC file \"%s\" for output: %s\n", AH->fSpec, strerror(errno)); } else @@ -207,7 +207,7 @@ InitArchiveFmt_Tar(ArchiveHandle *AH) */ if (AH->compression != 0) exit_horribly(modulename, - "compression is not supported by tar archive format\n"); + "compression is not supported by tar archive format\n"); } else { /* Read Mode */ @@ -556,7 +556,7 @@ _tarReadRaw(ArchiveHandle *AH, void *buf, size_t len, TAR_MEMBER *th, FILE *fh) res = GZREAD(&((char *) buf)[used], 1, len, th->zFH); if (res != len && !GZEOF(th->zFH)) exit_horribly(modulename, - "could not read from input file: %s\n", strerror(errno)); + "could not read from input file: %s\n", strerror(errno)); } else { @@ -1193,7 +1193,7 @@ _tarPositionTo(ArchiveHandle *AH, const char *filename) th->targetFile, filename); /* Header doesn't match, so read to next header */ - len = ((th->fileLen + 511) & ~511); /* Padded length */ + len = ((th->fileLen + 511) & ~511); /* Padded length */ blks = len >> 9; /* # of 512 byte blocks */ for (i = 0; i < blks; i++) @@ -1235,7 +1235,7 @@ _tarGetHeader(ArchiveHandle *AH, TAR_MEMBER *th) if (len != 512) exit_horribly(modulename, ngettext("incomplete tar header found (%lu byte)\n", - "incomplete tar header found (%lu bytes)\n", + "incomplete tar header found (%lu bytes)\n", len), (unsigned long) len); diff --git a/src/bin/pg_dump/pg_backup_utils.c b/src/bin/pg_dump/pg_backup_utils.c index d7907fde95..1e5967e5cc 100644 --- a/src/bin/pg_dump/pg_backup_utils.c +++ b/src/bin/pg_dump/pg_backup_utils.c @@ -25,7 +25,7 @@ static struct { on_exit_nicely_callback function; void *arg; -} on_exit_nicely_list[MAX_ON_EXIT_NICELY]; +} on_exit_nicely_list[MAX_ON_EXIT_NICELY]; static int on_exit_nicely_index; diff --git a/src/bin/pg_dump/pg_backup_utils.h b/src/bin/pg_dump/pg_backup_utils.h index 04b53f496e..14661a1160 100644 --- a/src/bin/pg_dump/pg_backup_utils.h +++ b/src/bin/pg_dump/pg_backup_utils.h @@ -35,4 +35,4 @@ extern void exit_nicely(int code) pg_attribute_noreturn(); extern void exit_horribly(const char *modulename, const char *fmt,...) pg_attribute_printf(2, 3) pg_attribute_noreturn(); -#endif /* PG_BACKUP_UTILS_H */ +#endif /* PG_BACKUP_UTILS_H */ diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 8829ceacc8..932ca6aa43 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -258,9 +258,9 @@ static void dumpDatabase(Archive *AH); static void dumpEncoding(Archive *AH); static void dumpStdStrings(Archive *AH); static void binary_upgrade_set_type_oids_by_type_oid(Archive *fout, - PQExpBuffer upgrade_buffer, Oid pg_type_oid); + PQExpBuffer upgrade_buffer, Oid pg_type_oid); static bool binary_upgrade_set_type_oids_by_rel_oid(Archive *fout, - PQExpBuffer upgrade_buffer, Oid pg_rel_oid); + PQExpBuffer upgrade_buffer, Oid pg_rel_oid); static void binary_upgrade_set_pg_class_oids(Archive *fout, PQExpBuffer upgrade_buffer, Oid pg_class_oid, bool is_index); @@ -697,14 +697,14 @@ main(int argc, char **argv) if (numWorkers > 1 && fout->remoteVersion < 90200 && !dopt.no_synchronized_snapshots) exit_horribly(NULL, - "Synchronized snapshots are not supported by this server version.\n" - "Run with --no-synchronized-snapshots instead if you do not need\n" + "Synchronized snapshots are not supported by this server version.\n" + "Run with --no-synchronized-snapshots instead if you do not need\n" "synchronized snapshots.\n"); /* check the version when a snapshot is explicitly specified by user */ if (dumpsnapshot && fout->remoteVersion < 90200) exit_horribly(NULL, - "Exported snapshots are not supported by this server version.\n"); + "Exported snapshots are not supported by this server version.\n"); /* * Find the last built-in OID, if needed (prior to 8.1) @@ -713,7 +713,7 @@ main(int argc, char **argv) */ if (fout->remoteVersion < 80100) g_last_builtin_oid = findLastBuiltinOid_V71(fout, - PQdb(GetConnection(fout))); + PQdb(GetConnection(fout))); else g_last_builtin_oid = FirstNormalObjectId - 1; @@ -968,7 +968,7 @@ help(const char *progname) printf(_(" --serializable-deferrable wait until the dump can run without anomalies\n")); printf(_(" --snapshot=SNAPSHOT use given snapshot for the dump\n")); printf(_(" --strict-names require table and/or schema include patterns to\n" - " match at least one entity each\n")); + " match at least one entity each\n")); printf(_(" --use-set-session-authorization\n" " use SET SESSION AUTHORIZATION commands instead of\n" " ALTER OWNER commands to set ownership\n")); @@ -1149,7 +1149,7 @@ setup_connection(Archive *AH, const char *dumpencoding, { if (AH->isStandby) exit_horribly(NULL, - "Synchronized snapshots are not supported on standby servers.\n" + "Synchronized snapshots are not supported on standby servers.\n" "Run with --no-synchronized-snapshots instead if you do not need\n" "synchronized snapshots.\n"); @@ -1299,8 +1299,8 @@ expand_table_name_patterns(Archive *fout, appendPQExpBuffer(query, "SELECT c.oid" "\nFROM pg_catalog.pg_class c" - "\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace" - "\nWHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c')\n", + "\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace" + "\nWHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c')\n", RELKIND_RELATION, RELKIND_SEQUENCE, RELKIND_VIEW, RELKIND_MATVIEW, RELKIND_FOREIGN_TABLE, RELKIND_PARTITIONED_TABLE); @@ -2070,7 +2070,7 @@ dumpTableData(Archive *fout, TableDataInfo *tdinfo) fmtId(tbinfo->dobj.name)); appendPQExpBuffer(copyBuf, "%s %sFROM stdin;\n", fmtCopyColumnList(tbinfo, clistBuf), - (tdinfo->oids && tbinfo->hasoids) ? "WITH OIDS " : ""); + (tdinfo->oids && tbinfo->hasoids) ? "WITH OIDS " : ""); copyStmt = copyBuf->data; } else @@ -2122,8 +2122,8 @@ refreshMatViewData(Archive *fout, TableDataInfo *tdinfo) if (tdinfo->dobj.dump & DUMP_COMPONENT_DATA) ArchiveEntry(fout, - tdinfo->dobj.catId, /* catalog ID */ - tdinfo->dobj.dumpId, /* dump ID */ + tdinfo->dobj.catId, /* catalog ID */ + tdinfo->dobj.dumpId, /* dump ID */ tbinfo->dobj.name, /* Name */ tbinfo->dobj.namespace->dobj.name, /* Namespace */ NULL, /* Tablespace */ @@ -2135,7 +2135,7 @@ refreshMatViewData(Archive *fout, TableDataInfo *tdinfo) "", /* Del */ NULL, /* Copy */ tdinfo->dobj.dependencies, /* Deps */ - tdinfo->dobj.nDeps, /* # Deps */ + tdinfo->dobj.nDeps, /* # Deps */ NULL, /* Dumper */ NULL); /* Dumper Arg */ @@ -2253,30 +2253,30 @@ buildMatViewRefreshDependencies(Archive *fout) appendPQExpBufferStr(query, "WITH RECURSIVE w AS " "( " - "SELECT d1.objid, d2.refobjid, c2.relkind AS refrelkind " + "SELECT d1.objid, d2.refobjid, c2.relkind AS refrelkind " "FROM pg_depend d1 " "JOIN pg_class c1 ON c1.oid = d1.objid " "AND c1.relkind = " CppAsString2(RELKIND_MATVIEW) " JOIN pg_rewrite r1 ON r1.ev_class = d1.objid " - "JOIN pg_depend d2 ON d2.classid = 'pg_rewrite'::regclass " + "JOIN pg_depend d2 ON d2.classid = 'pg_rewrite'::regclass " "AND d2.objid = r1.oid " "AND d2.refobjid <> d1.objid " "JOIN pg_class c2 ON c2.oid = d2.refobjid " - "AND c2.relkind IN (" CppAsString2(RELKIND_MATVIEW) "," + "AND c2.relkind IN (" CppAsString2(RELKIND_MATVIEW) "," CppAsString2(RELKIND_VIEW) ") " "WHERE d1.classid = 'pg_class'::regclass " "UNION " "SELECT w.objid, d3.refobjid, c3.relkind " "FROM w " "JOIN pg_rewrite r3 ON r3.ev_class = w.refobjid " - "JOIN pg_depend d3 ON d3.classid = 'pg_rewrite'::regclass " + "JOIN pg_depend d3 ON d3.classid = 'pg_rewrite'::regclass " "AND d3.objid = r3.oid " "AND d3.refobjid <> w.refobjid " "JOIN pg_class c3 ON c3.oid = d3.refobjid " - "AND c3.relkind IN (" CppAsString2(RELKIND_MATVIEW) "," + "AND c3.relkind IN (" CppAsString2(RELKIND_MATVIEW) "," CppAsString2(RELKIND_VIEW) ") " ") " - "SELECT 'pg_class'::regclass::oid AS classid, objid, refobjid " + "SELECT 'pg_class'::regclass::oid AS classid, objid, refobjid " "FROM w " "WHERE refrelkind = " CppAsString2(RELKIND_MATVIEW)); @@ -2510,7 +2510,7 @@ dumpDatabase(Archive *fout) "pg_encoding_to_char(encoding) AS encoding, " "datcollate, datctype, datfrozenxid, datminmxid, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, " - "shobj_description(oid, 'pg_database') AS description " + "shobj_description(oid, 'pg_database') AS description " "FROM pg_database " "WHERE datname = ", @@ -2522,9 +2522,9 @@ dumpDatabase(Archive *fout) appendPQExpBuffer(dbQry, "SELECT tableoid, oid, " "(%s datdba) AS dba, " "pg_encoding_to_char(encoding) AS encoding, " - "datcollate, datctype, datfrozenxid, 0 AS datminmxid, " + "datcollate, datctype, datfrozenxid, 0 AS datminmxid, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, " - "shobj_description(oid, 'pg_database') AS description " + "shobj_description(oid, 'pg_database') AS description " "FROM pg_database " "WHERE datname = ", @@ -2538,7 +2538,7 @@ dumpDatabase(Archive *fout) "pg_encoding_to_char(encoding) AS encoding, " "NULL AS datcollate, NULL AS datctype, datfrozenxid, 0 AS datminmxid, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) AS tablespace, " - "shobj_description(oid, 'pg_database') AS description " + "shobj_description(oid, 'pg_database') AS description " "FROM pg_database " "WHERE datname = ", @@ -2629,7 +2629,7 @@ dumpDatabase(Archive *fout) dba, /* Owner */ false, /* with oids */ "DATABASE", /* Desc */ - SECTION_PRE_DATA, /* Section */ + SECTION_PRE_DATA, /* Section */ creaQry->data, /* Create */ delQry->data, /* Del */ NULL, /* Copy */ @@ -3212,7 +3212,7 @@ getPolicies(Archive *fout, TableInfo tblinfo[], int numTables) "SELECT oid, tableoid, pol.polname, pol.polcmd, pol.polpermissive, " "CASE WHEN pol.polroles = '{0}' THEN NULL ELSE " " pg_catalog.array_to_string(ARRAY(SELECT pg_catalog.quote_ident(rolname) from pg_catalog.pg_roles WHERE oid = ANY(pol.polroles)), ', ') END AS polroles, " - "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid) AS polqual, " + "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid) AS polqual, " "pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid) AS polwithcheck " "FROM pg_catalog.pg_policy pol " "WHERE polrelid = '%u'", @@ -3222,7 +3222,7 @@ getPolicies(Archive *fout, TableInfo tblinfo[], int numTables) "SELECT oid, tableoid, pol.polname, pol.polcmd, 't' as polpermissive, " "CASE WHEN pol.polroles = '{0}' THEN NULL ELSE " " pg_catalog.array_to_string(ARRAY(SELECT pg_catalog.quote_ident(rolname) from pg_catalog.pg_roles WHERE oid = ANY(pol.polroles)), ', ') END AS polroles, " - "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid) AS polqual, " + "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid) AS polqual, " "pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid) AS polwithcheck " "FROM pg_catalog.pg_policy pol " "WHERE polrelid = '%u'", @@ -3733,8 +3733,8 @@ getSubscriptions(Archive *fout) res = ExecuteSqlQuery(fout, "SELECT count(*) FROM pg_subscription " - "WHERE subdbid = (SELECT oid FROM pg_catalog.pg_database" - " WHERE datname = current_database())", + "WHERE subdbid = (SELECT oid FROM pg_catalog.pg_database" + " WHERE datname = current_database())", PGRES_TUPLES_OK); n = atoi(PQgetvalue(res, 0, 0)); if (n > 0) @@ -3754,8 +3754,8 @@ getSubscriptions(Archive *fout) " s.subconninfo, s.subslotname, s.subsynccommit, " " s.subpublications " "FROM pg_catalog.pg_subscription s " - "WHERE s.subdbid = (SELECT oid FROM pg_catalog.pg_database" - " WHERE datname = current_database())", + "WHERE s.subdbid = (SELECT oid FROM pg_catalog.pg_database" + " WHERE datname = current_database())", username_subquery); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); @@ -3921,7 +3921,7 @@ binary_upgrade_set_type_oids_by_type_oid(Archive *fout, if (OidIsValid(pg_type_array_oid)) { appendPQExpBufferStr(upgrade_buffer, - "\n-- For binary upgrade, must preserve pg_type array oid\n"); + "\n-- For binary upgrade, must preserve pg_type array oid\n"); appendPQExpBuffer(upgrade_buffer, "SELECT pg_catalog.binary_upgrade_set_next_array_pg_type_oid('%u'::pg_catalog.oid);\n\n", pg_type_array_oid); @@ -3961,7 +3961,7 @@ binary_upgrade_set_type_oids_by_rel_oid(Archive *fout, { /* Toast tables do not have pg_type array rows */ Oid pg_type_toast_oid = atooid(PQgetvalue(upgrade_res, 0, - PQfnumber(upgrade_res, "trel"))); + PQfnumber(upgrade_res, "trel"))); appendPQExpBufferStr(upgrade_buffer, "\n-- For binary upgrade, must preserve pg_type toast oid\n"); appendPQExpBuffer(upgrade_buffer, @@ -4000,7 +4000,7 @@ binary_upgrade_set_pg_class_oids(Archive *fout, pg_index_indexrelid = atooid(PQgetvalue(upgrade_res, 0, PQfnumber(upgrade_res, "indexrelid"))); appendPQExpBufferStr(upgrade_buffer, - "\n-- For binary upgrade, must preserve pg_class oids\n"); + "\n-- For binary upgrade, must preserve pg_class oids\n"); if (!is_index) { @@ -4072,7 +4072,7 @@ binary_upgrade_extension_member(PQExpBuffer upgrade_buffer, exit_horribly(NULL, "could not find parent extension for %s\n", objlabel); appendPQExpBufferStr(upgrade_buffer, - "\n-- For binary upgrade, handle extension membership the hard way\n"); + "\n-- For binary upgrade, handle extension membership the hard way\n"); appendPQExpBuffer(upgrade_buffer, "ALTER EXTENSION %s ADD %s;\n", fmtId(extobj->name), objlabel); @@ -5193,7 +5193,7 @@ getAggregates(Archive *fout, int *numAggs) "FROM pg_proc " "WHERE proisagg " "AND pronamespace != " - "(SELECT oid FROM pg_namespace WHERE nspname = 'pg_catalog')", + "(SELECT oid FROM pg_namespace WHERE nspname = 'pg_catalog')", username_subquery); } @@ -5230,8 +5230,8 @@ getAggregates(Archive *fout, int *numAggs) if (strlen(agginfo[i].aggfn.rolname) == 0) write_msg(NULL, "WARNING: owner of aggregate function \"%s\" appears to be invalid\n", agginfo[i].aggfn.dobj.name); - agginfo[i].aggfn.lang = InvalidOid; /* not currently interesting */ - agginfo[i].aggfn.prorettype = InvalidOid; /* not saved */ + agginfo[i].aggfn.lang = InvalidOid; /* not currently interesting */ + agginfo[i].aggfn.prorettype = InvalidOid; /* not saved */ agginfo[i].aggfn.proacl = pg_strdup(PQgetvalue(res, i, i_aggacl)); agginfo[i].aggfn.rproacl = pg_strdup(PQgetvalue(res, i, i_raggacl)); agginfo[i].aggfn.initproacl = pg_strdup(PQgetvalue(res, i, i_initaggacl)); @@ -5368,13 +5368,13 @@ getFuncs(Archive *fout, int *numFuncs) g_last_builtin_oid); if (dopt->binary_upgrade) appendPQExpBufferStr(query, - "\n OR EXISTS(SELECT 1 FROM pg_depend WHERE " + "\n OR EXISTS(SELECT 1 FROM pg_depend WHERE " "classid = 'pg_proc'::regclass AND " "objid = p.oid AND " "refclassid = 'pg_extension'::regclass AND " "deptype = 'e')"); appendPQExpBufferStr(query, - "\n OR p.proacl IS DISTINCT FROM pip.initprivs"); + "\n OR p.proacl IS DISTINCT FROM pip.initprivs"); appendPQExpBufferChar(query, ')'); destroyPQExpBuffer(acl_subquery); @@ -5396,7 +5396,7 @@ getFuncs(Archive *fout, int *numFuncs) username_subquery); if (fout->remoteVersion >= 90200) appendPQExpBufferStr(query, - "\n AND NOT EXISTS (SELECT 1 FROM pg_depend " + "\n AND NOT EXISTS (SELECT 1 FROM pg_depend " "WHERE classid = 'pg_proc'::regclass AND " "objid = p.oid AND deptype = 'i')"); appendPQExpBuffer(query, @@ -5419,7 +5419,7 @@ getFuncs(Archive *fout, int *numFuncs) if (dopt->binary_upgrade && fout->remoteVersion >= 90100) appendPQExpBufferStr(query, - "\n OR EXISTS(SELECT 1 FROM pg_depend WHERE " + "\n OR EXISTS(SELECT 1 FROM pg_depend WHERE " "classid = 'pg_proc'::regclass AND " "objid = p.oid AND " "refclassid = 'pg_extension'::regclass AND " @@ -5487,7 +5487,7 @@ getFuncs(Archive *fout, int *numFuncs) if (strlen(finfo[i].rolname) == 0) write_msg(NULL, - "WARNING: owner of function \"%s\" appears to be invalid\n", + "WARNING: owner of function \"%s\" appears to be invalid\n", finfo[i].dobj.name); } @@ -5619,12 +5619,12 @@ getTables(Archive *fout, int *numTables) buildACLQueries(acl_subquery, racl_subquery, initacl_subquery, initracl_subquery, "c.relacl", "c.relowner", - "CASE WHEN c.relkind = " CppAsString2(RELKIND_SEQUENCE) + "CASE WHEN c.relkind = " CppAsString2(RELKIND_SEQUENCE) " THEN 's' ELSE 'r' END::\"char\"", dopt->binary_upgrade); buildACLQueries(attacl_subquery, attracl_subquery, attinitacl_subquery, - attinitracl_subquery, "at.attacl", "c.relowner", "'c'", + attinitracl_subquery, "at.attacl", "c.relowner", "'c'", dopt->binary_upgrade); appendPQExpBuffer(query, @@ -5672,13 +5672,13 @@ getTables(Archive *fout, int *numTables) "(c.relkind = '%c' AND " "d.classid = c.tableoid AND d.objid = c.oid AND " "d.objsubid = 0 AND " - "d.refclassid = c.tableoid AND d.deptype IN ('a', 'i')) " - "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " + "d.refclassid = c.tableoid AND d.deptype IN ('a', 'i')) " + "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " "LEFT JOIN pg_init_privs pip ON " "(c.oid = pip.objoid " "AND pip.classoid = 'pg_class'::regclass " "AND pip.objsubid = 0) " - "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c', '%c') " + "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c', '%c') " "ORDER BY c.oid", acl_subquery->data, racl_subquery->data, @@ -5756,8 +5756,8 @@ getTables(Archive *fout, int *numTables) "d.classid = c.tableoid AND d.objid = c.oid AND " "d.objsubid = 0 AND " "d.refclassid = c.tableoid AND d.deptype = 'a') " - "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " - "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c') " + "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " + "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, fout->isPostgresXL @@ -5813,8 +5813,8 @@ getTables(Archive *fout, int *numTables) "d.classid = c.tableoid AND d.objid = c.oid AND " "d.objsubid = 0 AND " "d.refclassid = c.tableoid AND d.deptype = 'a') " - "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " - "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c') " + "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " + "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, fout->isPostgresXL @@ -5870,8 +5870,8 @@ getTables(Archive *fout, int *numTables) "d.classid = c.tableoid AND d.objid = c.oid AND " "d.objsubid = 0 AND " "d.refclassid = c.tableoid AND d.deptype = 'a') " - "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " - "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c') " + "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " + "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, fout->isPostgresXL @@ -5925,8 +5925,8 @@ getTables(Archive *fout, int *numTables) "d.classid = c.tableoid AND d.objid = c.oid AND " "d.objsubid = 0 AND " "d.refclassid = c.tableoid AND d.deptype = 'a') " - "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " - "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c') " + "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " + "WHERE c.relkind in ('%c', '%c', '%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, fout->isPostgresXL @@ -5977,7 +5977,7 @@ getTables(Archive *fout, int *numTables) "d.classid = c.tableoid AND d.objid = c.oid AND " "d.objsubid = 0 AND " "d.refclassid = c.tableoid AND d.deptype = 'a') " - "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " + "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " "WHERE c.relkind in ('%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, @@ -6023,7 +6023,7 @@ getTables(Archive *fout, int *numTables) "d.classid = c.tableoid AND d.objid = c.oid AND " "d.objsubid = 0 AND " "d.refclassid = c.tableoid AND d.deptype = 'a') " - "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " + "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " "WHERE c.relkind in ('%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, @@ -6044,7 +6044,7 @@ getTables(Archive *fout, int *numTables) "c.relkind, " "c.relnamespace, " "(%s c.relowner) AS rolname, " - "c.relchecks, (c.reltriggers <> 0) AS relhastriggers, " + "c.relchecks, (c.reltriggers <> 0) AS relhastriggers, " "c.relhasindex, c.relhasrules, c.relhasoids, " "'f'::bool AS relrowsecurity, " "'f'::bool AS relforcerowsecurity, " @@ -6069,7 +6069,7 @@ getTables(Archive *fout, int *numTables) "d.classid = c.tableoid AND d.objid = c.oid AND " "d.objsubid = 0 AND " "d.refclassid = c.tableoid AND d.deptype = 'a') " - "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " + "LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) " "WHERE c.relkind in ('%c', '%c', '%c', '%c') " "ORDER BY c.oid", username_subquery, @@ -6299,10 +6299,10 @@ getTables(Archive *fout, int *numTables) tblinfo[i].interesting = tblinfo[i].dobj.dump ? true : false; tblinfo[i].dummy_view = false; /* might get set during sort */ - tblinfo[i].postponed_def = false; /* might get set during sort */ + tblinfo[i].postponed_def = false; /* might get set during sort */ tblinfo[i].is_identity_sequence = (i_is_identity_sequence >= 0 && - strcmp(PQgetvalue(res, i, i_is_identity_sequence), "t") == 0); + strcmp(PQgetvalue(res, i, i_is_identity_sequence), "t") == 0); /* Partition key string or NULL */ tblinfo[i].partkeydef = pg_strdup(PQgetvalue(res, i, i_partkeydef)); @@ -6332,7 +6332,7 @@ getTables(Archive *fout, int *numTables) appendPQExpBuffer(query, "LOCK TABLE %s IN ACCESS SHARE MODE", fmtQualifiedId(fout->remoteVersion, - tblinfo[i].dobj.namespace->dobj.name, + tblinfo[i].dobj.namespace->dobj.name, tblinfo[i].dobj.name)); ExecuteSqlStatement(fout, query->data); } @@ -6540,7 +6540,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) appendPQExpBuffer(query, "SELECT t.tableoid, t.oid, " "t.relname AS indexname, " - "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, " + "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, " "t.relnatts AS indnkeys, " "i.indkey, i.indisclustered, " "i.indisreplident, t.relpages, " @@ -6548,11 +6548,11 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) "c.condeferrable, c.condeferred, " "c.tableoid AS contableoid, " "c.oid AS conoid, " - "pg_catalog.pg_get_constraintdef(c.oid, false) AS condef, " + "pg_catalog.pg_get_constraintdef(c.oid, false) AS condef, " "(SELECT spcname FROM pg_catalog.pg_tablespace s WHERE s.oid = t.reltablespace) AS tablespace, " "t.reloptions AS indreloptions " "FROM pg_catalog.pg_index i " - "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) " + "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) " "LEFT JOIN pg_catalog.pg_constraint c " "ON (i.indrelid = c.conrelid AND " "i.indexrelid = c.conindid AND " @@ -6571,7 +6571,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) appendPQExpBuffer(query, "SELECT t.tableoid, t.oid, " "t.relname AS indexname, " - "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, " + "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, " "t.relnatts AS indnkeys, " "i.indkey, i.indisclustered, " "false AS indisreplident, t.relpages, " @@ -6579,11 +6579,11 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) "c.condeferrable, c.condeferred, " "c.tableoid AS contableoid, " "c.oid AS conoid, " - "pg_catalog.pg_get_constraintdef(c.oid, false) AS condef, " + "pg_catalog.pg_get_constraintdef(c.oid, false) AS condef, " "(SELECT spcname FROM pg_catalog.pg_tablespace s WHERE s.oid = t.reltablespace) AS tablespace, " "t.reloptions AS indreloptions " "FROM pg_catalog.pg_index i " - "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) " + "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) " "LEFT JOIN pg_catalog.pg_constraint c " "ON (i.indrelid = c.conrelid AND " "i.indexrelid = c.conindid AND " @@ -6598,7 +6598,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) appendPQExpBuffer(query, "SELECT t.tableoid, t.oid, " "t.relname AS indexname, " - "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, " + "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, " "t.relnatts AS indnkeys, " "i.indkey, i.indisclustered, " "false AS indisreplident, t.relpages, " @@ -6610,7 +6610,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) "(SELECT spcname FROM pg_catalog.pg_tablespace s WHERE s.oid = t.reltablespace) AS tablespace, " "t.reloptions AS indreloptions " "FROM pg_catalog.pg_index i " - "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) " + "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) " "LEFT JOIN pg_catalog.pg_depend d " "ON (d.classid = t.tableoid " "AND d.objid = t.oid " @@ -6628,7 +6628,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) appendPQExpBuffer(query, "SELECT t.tableoid, t.oid, " "t.relname AS indexname, " - "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, " + "pg_catalog.pg_get_indexdef(i.indexrelid) AS indexdef, " "t.relnatts AS indnkeys, " "i.indkey, i.indisclustered, " "false AS indisreplident, t.relpages, " @@ -6640,7 +6640,7 @@ getIndexes(Archive *fout, TableInfo tblinfo[], int numTables) "(SELECT spcname FROM pg_catalog.pg_tablespace s WHERE s.oid = t.reltablespace) AS tablespace, " "null AS indreloptions " "FROM pg_catalog.pg_index i " - "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) " + "JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) " "LEFT JOIN pg_catalog.pg_depend d " "ON (d.classid = t.tableoid " "AND d.objid = t.oid " @@ -7204,7 +7204,7 @@ getTriggers(Archive *fout, TableInfo tblinfo[], int numTables) appendPQExpBuffer(query, "SELECT tgname, " "tgfoid::pg_catalog.regproc AS tgfname, " - "pg_catalog.pg_get_triggerdef(oid, false) AS tgdef, " + "pg_catalog.pg_get_triggerdef(oid, false) AS tgdef, " "tgenabled, tableoid, oid " "FROM pg_catalog.pg_trigger t " "WHERE tgrelid = '%u'::pg_catalog.oid " @@ -7222,7 +7222,7 @@ getTriggers(Archive *fout, TableInfo tblinfo[], int numTables) "tgtype, tgnargs, tgargs, tgenabled, " "tgisconstraint, tgconstrname, tgdeferrable, " "tgconstrrelid, tginitdeferred, tableoid, oid, " - "tgconstrrelid::pg_catalog.regclass AS tgconstrrelname " + "tgconstrrelid::pg_catalog.regclass AS tgconstrrelname " "FROM pg_catalog.pg_trigger t " "WHERE tgrelid = '%u'::pg_catalog.oid " "AND tgconstraint = 0", @@ -7241,7 +7241,7 @@ getTriggers(Archive *fout, TableInfo tblinfo[], int numTables) "tgtype, tgnargs, tgargs, tgenabled, " "tgisconstraint, tgconstrname, tgdeferrable, " "tgconstrrelid, tginitdeferred, tableoid, oid, " - "tgconstrrelid::pg_catalog.regclass AS tgconstrrelname " + "tgconstrrelid::pg_catalog.regclass AS tgconstrrelname " "FROM pg_catalog.pg_trigger t " "WHERE tgrelid = '%u'::pg_catalog.oid " "AND (NOT tgisconstraint " @@ -7655,7 +7655,7 @@ getCasts(Archive *fout, int *numCasts) { appendPQExpBufferStr(query, "SELECT tableoid, oid, " "castsource, casttarget, castfunc, castcontext, " - "CASE WHEN castfunc = 0 THEN 'b' ELSE 'f' END AS castmethod " + "CASE WHEN castfunc = 0 THEN 'b' ELSE 'f' END AS castmethod " "FROM pg_cast ORDER BY 3,4"); } @@ -7909,18 +7909,18 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) "a.attstattarget, a.attstorage, t.typstorage, " "a.attnotnull, a.atthasdef, a.attisdropped, " "a.attlen, a.attalign, a.attislocal, " - "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " - "array_to_string(a.attoptions, ', ') AS attoptions, " + "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " + "array_to_string(a.attoptions, ', ') AS attoptions, " "CASE WHEN a.attcollation <> t.typcollation " - "THEN a.attcollation ELSE 0 END AS attcollation, " + "THEN a.attcollation ELSE 0 END AS attcollation, " "a.attidentity, " "pg_catalog.array_to_string(ARRAY(" "SELECT pg_catalog.quote_ident(option_name) || " "' ' || pg_catalog.quote_literal(option_value) " - "FROM pg_catalog.pg_options_to_table(attfdwoptions) " + "FROM pg_catalog.pg_options_to_table(attfdwoptions) " "ORDER BY option_name" "), E',\n ') AS attfdwoptions " - "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " + "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " "AND a.attnum > 0::pg_catalog.int2 " @@ -7936,17 +7936,17 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) "a.attstattarget, a.attstorage, t.typstorage, " "a.attnotnull, a.atthasdef, a.attisdropped, " "a.attlen, a.attalign, a.attislocal, " - "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " - "array_to_string(a.attoptions, ', ') AS attoptions, " + "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " + "array_to_string(a.attoptions, ', ') AS attoptions, " "CASE WHEN a.attcollation <> t.typcollation " - "THEN a.attcollation ELSE 0 END AS attcollation, " + "THEN a.attcollation ELSE 0 END AS attcollation, " "pg_catalog.array_to_string(ARRAY(" "SELECT pg_catalog.quote_ident(option_name) || " "' ' || pg_catalog.quote_literal(option_value) " - "FROM pg_catalog.pg_options_to_table(attfdwoptions) " + "FROM pg_catalog.pg_options_to_table(attfdwoptions) " "ORDER BY option_name" "), E',\n ') AS attfdwoptions " - "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " + "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " "AND a.attnum > 0::pg_catalog.int2 " @@ -7965,12 +7965,12 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) "a.attstattarget, a.attstorage, t.typstorage, " "a.attnotnull, a.atthasdef, a.attisdropped, " "a.attlen, a.attalign, a.attislocal, " - "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " - "array_to_string(a.attoptions, ', ') AS attoptions, " + "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " + "array_to_string(a.attoptions, ', ') AS attoptions, " "CASE WHEN a.attcollation <> t.typcollation " - "THEN a.attcollation ELSE 0 END AS attcollation, " + "THEN a.attcollation ELSE 0 END AS attcollation, " "NULL AS attfdwoptions " - "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " + "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " "AND a.attnum > 0::pg_catalog.int2 " @@ -7984,11 +7984,11 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) "a.attstattarget, a.attstorage, t.typstorage, " "a.attnotnull, a.atthasdef, a.attisdropped, " "a.attlen, a.attalign, a.attislocal, " - "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " - "array_to_string(a.attoptions, ', ') AS attoptions, " + "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " + "array_to_string(a.attoptions, ', ') AS attoptions, " "0 AS attcollation, " "NULL AS attfdwoptions " - "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " + "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " "AND a.attnum > 0::pg_catalog.int2 " @@ -8002,10 +8002,10 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) "a.attstattarget, a.attstorage, t.typstorage, " "a.attnotnull, a.atthasdef, a.attisdropped, " "a.attlen, a.attalign, a.attislocal, " - "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " + "pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname, " "'' AS attoptions, 0 AS attcollation, " "NULL AS attfdwoptions " - "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " + "FROM pg_catalog.pg_attribute a LEFT JOIN pg_catalog.pg_type t " "ON a.atttypid = t.oid " "WHERE a.attrelid = '%u'::pg_catalog.oid " "AND a.attnum > 0::pg_catalog.int2 " @@ -8100,7 +8100,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) tbinfo->dobj.name); printfPQExpBuffer(q, "SELECT tableoid, oid, adnum, " - "pg_catalog.pg_get_expr(adbin, adrelid) AS adsrc " + "pg_catalog.pg_get_expr(adbin, adrelid) AS adsrc " "FROM pg_catalog.pg_attrdef " "WHERE adrelid = '%u'::pg_catalog.oid", tbinfo->dobj.catId.oid); @@ -8196,7 +8196,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) * but it wasn't ever false for check constraints until 9.2). */ appendPQExpBuffer(q, "SELECT tableoid, oid, conname, " - "pg_catalog.pg_get_constraintdef(oid) AS consrc, " + "pg_catalog.pg_get_constraintdef(oid) AS consrc, " "conislocal, convalidated " "FROM pg_catalog.pg_constraint " "WHERE conrelid = '%u'::pg_catalog.oid " @@ -8208,7 +8208,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) { /* conislocal is new in 8.4 */ appendPQExpBuffer(q, "SELECT tableoid, oid, conname, " - "pg_catalog.pg_get_constraintdef(oid) AS consrc, " + "pg_catalog.pg_get_constraintdef(oid) AS consrc, " "conislocal, true AS convalidated " "FROM pg_catalog.pg_constraint " "WHERE conrelid = '%u'::pg_catalog.oid " @@ -8219,7 +8219,7 @@ getTableAttrs(Archive *fout, TableInfo *tblinfo, int numTables) else { appendPQExpBuffer(q, "SELECT tableoid, oid, conname, " - "pg_catalog.pg_get_constraintdef(oid) AS consrc, " + "pg_catalog.pg_get_constraintdef(oid) AS consrc, " "true AS conislocal, true AS convalidated " "FROM pg_catalog.pg_constraint " "WHERE conrelid = '%u'::pg_catalog.oid " @@ -8730,7 +8730,7 @@ getForeignDataWrappers(Archive *fout, int *numForeignDataWrappers) "FROM pg_foreign_data_wrapper f " "LEFT JOIN pg_init_privs pip ON " "(f.oid = pip.objoid " - "AND pip.classoid = 'pg_foreign_data_wrapper'::regclass " + "AND pip.classoid = 'pg_foreign_data_wrapper'::regclass " "AND pip.objsubid = 0) ", username_subquery, acl_subquery->data, @@ -9696,7 +9696,7 @@ dumpExtension(Archive *fout, ExtensionInfo *extinfo) appendPQExpBuffer(q, "DROP EXTENSION IF EXISTS %s;\n", qextname); appendPQExpBufferStr(q, - "SELECT pg_catalog.binary_upgrade_create_empty_extension("); + "SELECT pg_catalog.binary_upgrade_create_empty_extension("); appendStringLiteralAH(q, extinfo->dobj.name, fout); appendPQExpBufferStr(q, ", "); appendStringLiteralAH(q, extinfo->namespace, fout); @@ -9959,7 +9959,7 @@ dumpRangeType(Archive *fout, TypeInfo *tyinfo) selectSourceSchema(fout, tyinfo->dobj.namespace->dobj.name); appendPQExpBuffer(query, - "SELECT pg_catalog.format_type(rngsubtype, NULL) AS rngsubtype, " + "SELECT pg_catalog.format_type(rngsubtype, NULL) AS rngsubtype, " "opc.opcname AS opcname, " "(SELECT nspname FROM pg_catalog.pg_namespace nsp " " WHERE nsp.oid = opc.opcnamespace) AS opcnsp, " @@ -10464,20 +10464,20 @@ dumpDomain(Archive *fout, TypeInfo *tyinfo) { /* typcollation is new in 9.1 */ appendPQExpBuffer(query, "SELECT t.typnotnull, " - "pg_catalog.format_type(t.typbasetype, t.typtypmod) AS typdefn, " + "pg_catalog.format_type(t.typbasetype, t.typtypmod) AS typdefn, " "pg_catalog.pg_get_expr(t.typdefaultbin, 'pg_catalog.pg_type'::pg_catalog.regclass) AS typdefaultbin, " "t.typdefault, " "CASE WHEN t.typcollation <> u.typcollation " "THEN t.typcollation ELSE 0 END AS typcollation " "FROM pg_catalog.pg_type t " - "LEFT JOIN pg_catalog.pg_type u ON (t.typbasetype = u.oid) " + "LEFT JOIN pg_catalog.pg_type u ON (t.typbasetype = u.oid) " "WHERE t.oid = '%u'::pg_catalog.oid", tyinfo->dobj.catId.oid); } else { appendPQExpBuffer(query, "SELECT typnotnull, " - "pg_catalog.format_type(typbasetype, typtypmod) AS typdefn, " + "pg_catalog.format_type(typbasetype, typtypmod) AS typdefn, " "pg_catalog.pg_get_expr(typdefaultbin, 'pg_catalog.pg_type'::pg_catalog.regclass) AS typdefaultbin, " "typdefault, 0 AS typcollation " "FROM pg_catalog.pg_type " @@ -10662,13 +10662,13 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) * collation does not matter for those. */ appendPQExpBuffer(query, "SELECT a.attname, " - "pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, " + "pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, " "a.attlen, a.attalign, a.attisdropped, " "CASE WHEN a.attcollation <> at.typcollation " "THEN a.attcollation ELSE 0 END AS attcollation " "FROM pg_catalog.pg_type ct " - "JOIN pg_catalog.pg_attribute a ON a.attrelid = ct.typrelid " - "LEFT JOIN pg_catalog.pg_type at ON at.oid = a.atttypid " + "JOIN pg_catalog.pg_attribute a ON a.attrelid = ct.typrelid " + "LEFT JOIN pg_catalog.pg_type at ON at.oid = a.atttypid " "WHERE ct.oid = '%u'::pg_catalog.oid " "ORDER BY a.attnum ", tyinfo->dobj.catId.oid); @@ -10680,10 +10680,10 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) * should always be false. */ appendPQExpBuffer(query, "SELECT a.attname, " - "pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, " + "pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, " "a.attlen, a.attalign, a.attisdropped, " "0 AS attcollation " - "FROM pg_catalog.pg_type ct, pg_catalog.pg_attribute a " + "FROM pg_catalog.pg_type ct, pg_catalog.pg_attribute a " "WHERE ct.oid = '%u'::pg_catalog.oid " "AND a.attrelid = ct.typrelid " "ORDER BY a.attnum ", @@ -10769,7 +10769,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo) /* stash separately for insertion after the CREATE TYPE */ appendPQExpBufferStr(dropped, - "\n-- For binary upgrade, recreate dropped column.\n"); + "\n-- For binary upgrade, recreate dropped column.\n"); appendPQExpBuffer(dropped, "UPDATE pg_catalog.pg_attribute\n" "SET attlen = %s, " "attalign = '%s', attbyval = false\n" @@ -10979,7 +10979,7 @@ dumpShellType(Archive *fout, ShellTypeInfo *stinfo) if (dopt->binary_upgrade) binary_upgrade_set_type_oids_by_type_oid(fout, q, - stinfo->baseType->dobj.catId.oid); + stinfo->baseType->dobj.catId.oid); appendPQExpBuffer(q, "CREATE TYPE %s;\n", fmtId(stinfo->dobj.name)); @@ -11088,7 +11088,7 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) /* Cope with possibility that inline is in different schema */ if (inlineInfo->dobj.namespace != funcInfo->dobj.namespace) appendPQExpBuffer(defqry, "%s.", - fmtId(inlineInfo->dobj.namespace->dobj.name)); + fmtId(inlineInfo->dobj.namespace->dobj.name)); appendPQExpBufferStr(defqry, fmtId(inlineInfo->dobj.name)); } if (OidIsValid(plang->lanvalidator)) @@ -11097,7 +11097,7 @@ dumpProcLang(Archive *fout, ProcLangInfo *plang) /* Cope with possibility that validator is in different schema */ if (validatorInfo->dobj.namespace != funcInfo->dobj.namespace) appendPQExpBuffer(defqry, "%s.", - fmtId(validatorInfo->dobj.namespace->dobj.name)); + fmtId(validatorInfo->dobj.namespace->dobj.name)); appendPQExpBufferStr(defqry, fmtId(validatorInfo->dobj.name)); } } @@ -11301,7 +11301,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) PQExpBuffer asPart; PGresult *res; char *funcsig; /* identity signature */ - char *funcfullsig = NULL; /* full signature */ + char *funcfullsig = NULL; /* full signature */ char *funcsig_tag; char *proretset; char *prosrc; @@ -11353,9 +11353,9 @@ dumpFunc(Archive *fout, FuncInfo *finfo) */ appendPQExpBuffer(query, "SELECT proretset, prosrc, probin, " - "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " - "pg_catalog.pg_get_function_result(oid) AS funcresult, " + "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " + "pg_catalog.pg_get_function_result(oid) AS funcresult, " "array_to_string(protrftypes, ' ') AS protrftypes, " "proiswindow, provolatile, proisstrict, prosecdef, " "proleakproof, proconfig, procost, prorows, " @@ -11372,9 +11372,9 @@ dumpFunc(Archive *fout, FuncInfo *finfo) */ appendPQExpBuffer(query, "SELECT proretset, prosrc, probin, " - "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " - "pg_catalog.pg_get_function_result(oid) AS funcresult, " + "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " + "pg_catalog.pg_get_function_result(oid) AS funcresult, " "array_to_string(protrftypes, ' ') AS protrftypes, " "proiswindow, provolatile, proisstrict, prosecdef, " "proleakproof, proconfig, procost, prorows, " @@ -11390,9 +11390,9 @@ dumpFunc(Archive *fout, FuncInfo *finfo) */ appendPQExpBuffer(query, "SELECT proretset, prosrc, probin, " - "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " - "pg_catalog.pg_get_function_result(oid) AS funcresult, " + "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " + "pg_catalog.pg_get_function_result(oid) AS funcresult, " "proiswindow, provolatile, proisstrict, prosecdef, " "proleakproof, proconfig, procost, prorows, " "(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname " @@ -11408,9 +11408,9 @@ dumpFunc(Archive *fout, FuncInfo *finfo) */ appendPQExpBuffer(query, "SELECT proretset, prosrc, probin, " - "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " - "pg_catalog.pg_get_function_result(oid) AS funcresult, " + "pg_catalog.pg_get_function_arguments(oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs, " + "pg_catalog.pg_get_function_result(oid) AS funcresult, " "proiswindow, provolatile, proisstrict, prosecdef, " "false AS proleakproof, " " proconfig, procost, prorows, " @@ -11522,7 +11522,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) * contains quote or backslash; else use regular quoting. */ if (dopt->disable_dollar_quoting || - (strchr(prosrc, '\'') == NULL && strchr(prosrc, '\\') == NULL)) + (strchr(prosrc, '\'') == NULL && strchr(prosrc, '\\') == NULL)) appendStringLiteralAH(asPart, prosrc, fout); else appendStringLiteralDQ(asPart, prosrc, NULL); @@ -11648,7 +11648,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo) if (i != 0) appendPQExpBufferStr(q, ", "); appendPQExpBuffer(q, "FOR TYPE %s", - getFormattedTypeName(fout, typeids[i], zeroAsNone)); + getFormattedTypeName(fout, typeids[i], zeroAsNone)); } } @@ -11855,7 +11855,7 @@ dumpCast(Archive *fout, CastInfo *cast) * it). */ appendPQExpBuffer(defqry, "WITH FUNCTION %s.%s", - fmtId(funcInfo->dobj.namespace->dobj.name), fsig); + fmtId(funcInfo->dobj.namespace->dobj.name), fsig); free(fsig); } else @@ -11965,7 +11965,7 @@ dumpTransform(Archive *fout, TransformInfo *transform) * pg_catalog schema (format_function_signature won't qualify it). */ appendPQExpBuffer(defqry, "FROM SQL WITH FUNCTION %s.%s", - fmtId(fromsqlFuncInfo->dobj.namespace->dobj.name), fsig); + fmtId(fromsqlFuncInfo->dobj.namespace->dobj.name), fsig); free(fsig); } else @@ -11986,7 +11986,7 @@ dumpTransform(Archive *fout, TransformInfo *transform) * pg_catalog schema (format_function_signature won't qualify it). */ appendPQExpBuffer(defqry, "TO SQL WITH FUNCTION %s.%s", - fmtId(tosqlFuncInfo->dobj.namespace->dobj.name), fsig); + fmtId(tosqlFuncInfo->dobj.namespace->dobj.name), fsig); free(fsig); } else @@ -12501,8 +12501,8 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) "nspname AS opcfamilynsp, " "(SELECT amname FROM pg_catalog.pg_am WHERE oid = opcmethod) AS amname " "FROM pg_catalog.pg_opclass c " - "LEFT JOIN pg_catalog.pg_opfamily f ON f.oid = opcfamily " - "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = opfnamespace " + "LEFT JOIN pg_catalog.pg_opfamily f ON f.oid = opcfamily " + "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = opfnamespace " "WHERE c.oid = '%u'::pg_catalog.oid", opcinfo->dobj.catId.oid); } @@ -12513,7 +12513,7 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) "opcdefault, NULL AS opcfamily, " "NULL AS opcfamilyname, " "NULL AS opcfamilynsp, " - "(SELECT amname FROM pg_catalog.pg_am WHERE oid = opcamid) AS amname " + "(SELECT amname FROM pg_catalog.pg_am WHERE oid = opcamid) AS amname " "FROM pg_catalog.pg_opclass " "WHERE oid = '%u'::pg_catalog.oid", opcinfo->dobj.catId.oid); @@ -12598,11 +12598,11 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) "amopopr::pg_catalog.regoperator, " "opfname AS sortfamily, " "nspname AS sortfamilynsp " - "FROM pg_catalog.pg_amop ao JOIN pg_catalog.pg_depend ON " + "FROM pg_catalog.pg_amop ao JOIN pg_catalog.pg_depend ON " "(classid = 'pg_catalog.pg_amop'::pg_catalog.regclass AND objid = ao.oid) " - "LEFT JOIN pg_catalog.pg_opfamily f ON f.oid = amopsortfamily " - "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = opfnamespace " - "WHERE refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass " + "LEFT JOIN pg_catalog.pg_opfamily f ON f.oid = amopsortfamily " + "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = opfnamespace " + "WHERE refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass " "AND refobjid = '%u'::pg_catalog.oid " "AND amopfamily = '%s'::pg_catalog.oid " "ORDER BY amopstrategy", @@ -12616,9 +12616,9 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) "NULL AS sortfamily, " "NULL AS sortfamilynsp " "FROM pg_catalog.pg_amop ao, pg_catalog.pg_depend " - "WHERE refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass " + "WHERE refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass " "AND refobjid = '%u'::pg_catalog.oid " - "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " + "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " "AND objid = ao.oid " "ORDER BY amopstrategy", opcinfo->dobj.catId.oid); @@ -12630,9 +12630,9 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) "NULL AS sortfamily, " "NULL AS sortfamilynsp " "FROM pg_catalog.pg_amop ao, pg_catalog.pg_depend " - "WHERE refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass " + "WHERE refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass " "AND refobjid = '%u'::pg_catalog.oid " - "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " + "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " "AND objid = ao.oid " "ORDER BY amopstrategy", opcinfo->dobj.catId.oid); @@ -12713,10 +12713,10 @@ dumpOpclass(Archive *fout, OpclassInfo *opcinfo) "amproc::pg_catalog.regprocedure, " "amproclefttype::pg_catalog.regtype, " "amprocrighttype::pg_catalog.regtype " - "FROM pg_catalog.pg_amproc ap, pg_catalog.pg_depend " - "WHERE refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass " + "FROM pg_catalog.pg_amproc ap, pg_catalog.pg_depend " + "WHERE refclassid = 'pg_catalog.pg_opclass'::pg_catalog.regclass " "AND refobjid = '%u'::pg_catalog.oid " - "AND classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass " + "AND classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass " "AND objid = ap.oid " "ORDER BY amprocnum", opcinfo->dobj.catId.oid); @@ -12879,11 +12879,11 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) "amopopr::pg_catalog.regoperator, " "opfname AS sortfamily, " "nspname AS sortfamilynsp " - "FROM pg_catalog.pg_amop ao JOIN pg_catalog.pg_depend ON " + "FROM pg_catalog.pg_amop ao JOIN pg_catalog.pg_depend ON " "(classid = 'pg_catalog.pg_amop'::pg_catalog.regclass AND objid = ao.oid) " - "LEFT JOIN pg_catalog.pg_opfamily f ON f.oid = amopsortfamily " - "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = opfnamespace " - "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " + "LEFT JOIN pg_catalog.pg_opfamily f ON f.oid = amopsortfamily " + "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = opfnamespace " + "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " "AND refobjid = '%u'::pg_catalog.oid " "AND amopfamily = '%u'::pg_catalog.oid " "ORDER BY amopstrategy", @@ -12897,9 +12897,9 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) "NULL AS sortfamily, " "NULL AS sortfamilynsp " "FROM pg_catalog.pg_amop ao, pg_catalog.pg_depend " - "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " + "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " "AND refobjid = '%u'::pg_catalog.oid " - "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " + "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " "AND objid = ao.oid " "ORDER BY amopstrategy", opfinfo->dobj.catId.oid); @@ -12911,9 +12911,9 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) "NULL AS sortfamily, " "NULL AS sortfamilynsp " "FROM pg_catalog.pg_amop ao, pg_catalog.pg_depend " - "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " + "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " "AND refobjid = '%u'::pg_catalog.oid " - "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " + "AND classid = 'pg_catalog.pg_amop'::pg_catalog.regclass " "AND objid = ao.oid " "ORDER BY amopstrategy", opfinfo->dobj.catId.oid); @@ -12928,9 +12928,9 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) "amproclefttype::pg_catalog.regtype, " "amprocrighttype::pg_catalog.regtype " "FROM pg_catalog.pg_amproc ap, pg_catalog.pg_depend " - "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " + "WHERE refclassid = 'pg_catalog.pg_opfamily'::pg_catalog.regclass " "AND refobjid = '%u'::pg_catalog.oid " - "AND classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass " + "AND classid = 'pg_catalog.pg_amproc'::pg_catalog.regclass " "AND objid = ap.oid " "ORDER BY amprocnum", opfinfo->dobj.catId.oid); @@ -12941,7 +12941,7 @@ dumpOpfamily(Archive *fout, OpfamilyInfo *opfinfo) resetPQExpBuffer(query); appendPQExpBuffer(query, "SELECT " - "(SELECT amname FROM pg_catalog.pg_am WHERE oid = opfmethod) AS amname " + "(SELECT amname FROM pg_catalog.pg_am WHERE oid = opfmethod) AS amname " "FROM pg_catalog.pg_opfamily " "WHERE oid = '%u'::pg_catalog.oid", opfinfo->dobj.catId.oid); @@ -13269,8 +13269,8 @@ dumpConversion(Archive *fout, ConvInfo *convinfo) /* Get conversion-specific details */ appendPQExpBuffer(query, "SELECT " - "pg_catalog.pg_encoding_to_char(conforencoding) AS conforencoding, " - "pg_catalog.pg_encoding_to_char(contoencoding) AS contoencoding, " + "pg_catalog.pg_encoding_to_char(conforencoding) AS conforencoding, " + "pg_catalog.pg_encoding_to_char(contoencoding) AS contoencoding, " "conproc, condefault " "FROM pg_catalog.pg_conversion c " "WHERE c.oid = '%u'::pg_catalog.oid", @@ -13389,7 +13389,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) PQExpBuffer labelq; PQExpBuffer details; char *aggsig; /* identity signature */ - char *aggfullsig = NULL; /* full signature */ + char *aggfullsig = NULL; /* full signature */ char *aggsig_tag; PGresult *res; int i_aggtransfn; @@ -13452,18 +13452,18 @@ dumpAgg(Archive *fout, AggInfo *agginfo) { appendPQExpBuffer(query, "SELECT aggtransfn, " "aggfinalfn, aggtranstype::pg_catalog.regtype, " - "aggcombinefn, aggserialfn, aggdeserialfn, aggmtransfn, " - "aggminvtransfn, aggmfinalfn, aggmtranstype::pg_catalog.regtype, " + "aggcombinefn, aggserialfn, aggdeserialfn, aggmtransfn, " + "aggminvtransfn, aggmfinalfn, aggmtranstype::pg_catalog.regtype, " "aggfinalextra, aggmfinalextra, " "aggsortop::pg_catalog.regoperator, " "(aggkind = 'h') AS hypothetical, " "aggtransspace, agginitval, " "aggmtransspace, aggminitval, " "true AS convertok, " - "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs, " + "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs, " "p.proparallel " - "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " + "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", agginfo->aggfn.dobj.catId.oid); @@ -13473,7 +13473,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) appendPQExpBuffer(query, "SELECT aggtransfn, " "aggfinalfn, aggtranstype::pg_catalog.regtype, " "'-' AS aggcombinefn, '-' AS aggserialfn, " - "'-' AS aggdeserialfn, aggmtransfn, aggminvtransfn, " + "'-' AS aggdeserialfn, aggmtransfn, aggminvtransfn, " "aggmfinalfn, aggmtranstype::pg_catalog.regtype, " "aggfinalextra, aggmfinalextra, " "aggsortop::pg_catalog.regoperator, " @@ -13481,9 +13481,9 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "aggtransspace, agginitval, " "aggmtransspace, aggminitval, " "true AS convertok, " - "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs " - "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " + "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs " + "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", agginfo->aggfn.dobj.catId.oid); @@ -13502,9 +13502,9 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggtransspace, agginitval, " "0 AS aggmtransspace, NULL AS aggminitval, " "true AS convertok, " - "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " - "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs " - "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " + "pg_catalog.pg_get_function_arguments(p.oid) AS funcargs, " + "pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs " + "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", agginfo->aggfn.dobj.catId.oid); @@ -13523,7 +13523,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggtransspace, agginitval, " "0 AS aggmtransspace, NULL AS aggminitval, " "true AS convertok " - "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " + "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", agginfo->aggfn.dobj.catId.oid); @@ -13541,7 +13541,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) "0 AS aggtransspace, agginitval, " "0 AS aggmtransspace, NULL AS aggminitval, " "true AS convertok " - "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " + "FROM pg_catalog.pg_aggregate a, pg_catalog.pg_proc p " "WHERE a.aggfnoid = p.oid " "AND p.oid = '%u'::pg_catalog.oid", agginfo->aggfn.dobj.catId.oid); @@ -13746,7 +13746,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo) dumpSecLabel(fout, labelq->data, agginfo->aggfn.dobj.namespace->dobj.name, agginfo->aggfn.rolname, - agginfo->aggfn.dobj.catId, 0, agginfo->aggfn.dobj.dumpId); + agginfo->aggfn.dobj.catId, 0, agginfo->aggfn.dobj.dumpId); /* * Since there is no GRANT ON AGGREGATE syntax, we have to make the ACL @@ -14470,7 +14470,7 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo) default: /* shouldn't get here */ exit_horribly(NULL, - "unrecognized object type in default privileges: %d\n", + "unrecognized object type in default privileges: %d\n", (int) daclinfo->defaclobjtype); type = ""; /* keep compiler quiet */ } @@ -14494,7 +14494,7 @@ dumpDefaultACL(Archive *fout, DefaultACLInfo *daclinfo) if (daclinfo->dobj.dump & DUMP_COMPONENT_ACL) ArchiveEntry(fout, daclinfo->dobj.catId, daclinfo->dobj.dumpId, tag->data, - daclinfo->dobj.namespace ? daclinfo->dobj.namespace->dobj.name : NULL, + daclinfo->dobj.namespace ? daclinfo->dobj.namespace->dobj.name : NULL, NULL, daclinfo->defaclrole, false, "DEFAULT ACL", SECTION_POST_DATA, @@ -14937,7 +14937,7 @@ dumpTable(Archive *fout, TableInfo *tbinfo) PQExpBuffer initracl_subquery = createPQExpBuffer(); buildACLQueries(acl_subquery, racl_subquery, initacl_subquery, - initracl_subquery, "at.attacl", "c.relowner", "'c'", + initracl_subquery, "at.attacl", "c.relowner", "'c'", dopt->binary_upgrade); appendPQExpBuffer(query, @@ -14947,10 +14947,10 @@ dumpTable(Archive *fout, TableInfo *tbinfo) "%s AS initattacl, " "%s AS initrattacl " "FROM pg_catalog.pg_attribute at " - "JOIN pg_catalog.pg_class c ON (at.attrelid = c.oid) " + "JOIN pg_catalog.pg_class c ON (at.attrelid = c.oid) " "LEFT JOIN pg_catalog.pg_init_privs pip ON " "(at.attrelid = pip.objoid " - "AND pip.classoid = 'pg_catalog.pg_class'::pg_catalog.regclass " + "AND pip.classoid = 'pg_catalog.pg_class'::pg_catalog.regclass " "AND at.attnum = pip.objsubid) " "WHERE at.attrelid = '%u'::pg_catalog.oid AND " "NOT at.attisdropped " @@ -14981,7 +14981,7 @@ dumpTable(Archive *fout, TableInfo *tbinfo) "SELECT attname, attacl, NULL as rattacl, " "NULL AS initattacl, NULL AS initrattacl " "FROM pg_catalog.pg_attribute " - "WHERE attrelid = '%u'::pg_catalog.oid AND NOT attisdropped " + "WHERE attrelid = '%u'::pg_catalog.oid AND NOT attisdropped " "AND attacl IS NOT NULL " "ORDER BY attnum", tbinfo->dobj.catId.oid); @@ -15034,7 +15034,7 @@ createViewAsClause(Archive *fout, TableInfo *tbinfo) /* Fetch the view definition */ appendPQExpBuffer(query, - "SELECT pg_catalog.pg_get_viewdef('%u'::pg_catalog.oid) AS viewdef", + "SELECT pg_catalog.pg_get_viewdef('%u'::pg_catalog.oid) AS viewdef", tbinfo->dobj.catId.oid); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); @@ -15205,9 +15205,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) appendPQExpBuffer(query, "SELECT fs.srvname, " "pg_catalog.array_to_string(ARRAY(" - "SELECT pg_catalog.quote_ident(option_name) || " - "' ' || pg_catalog.quote_literal(option_value) " - "FROM pg_catalog.pg_options_to_table(ftoptions) " + "SELECT pg_catalog.quote_ident(option_name) || " + "' ' || pg_catalog.quote_literal(option_value) " + "FROM pg_catalog.pg_options_to_table(ftoptions) " "ORDER BY option_name" "), E',\n ') AS ftoptions " "FROM pg_catalog.pg_foreign_table ft " @@ -15287,7 +15287,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) appendPQExpBuffer(q, " PARTITION OF "); if (parentRel->dobj.namespace != tbinfo->dobj.namespace) appendPQExpBuffer(q, "%s.", - fmtId(parentRel->dobj.namespace->dobj.name)); + fmtId(parentRel->dobj.namespace->dobj.name)); appendPQExpBufferStr(q, fmtId(parentRel->dobj.name)); } @@ -15309,7 +15309,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) * Default value --- suppress if to be printed separately. */ bool has_default = (tbinfo->attrdefs[j] != NULL && - !tbinfo->attrdefs[j]->separate); + !tbinfo->attrdefs[j]->separate); /* * Not Null constraint --- suppress if inherited, except @@ -15376,7 +15376,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) { /* always schema-qualify, don't try to be smart */ appendPQExpBuffer(q, " COLLATE %s.", - fmtId(coll->dobj.namespace->dobj.name)); + fmtId(coll->dobj.namespace->dobj.name)); appendPQExpBufferStr(q, fmtId(coll->dobj.name)); } } @@ -15444,7 +15444,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) appendPQExpBufferStr(q, ", "); if (parentRel->dobj.namespace != tbinfo->dobj.namespace) appendPQExpBuffer(q, "%s.", - fmtId(parentRel->dobj.namespace->dobj.name)); + fmtId(parentRel->dobj.namespace->dobj.name)); appendPQExpBufferStr(q, fmtId(parentRel->dobj.name)); } appendPQExpBufferChar(q, ')'); @@ -15626,7 +15626,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) /* Schema-qualify the parent table, if necessary */ if (parentRel->dobj.namespace != tbinfo->dobj.namespace) appendPQExpBuffer(parentname, "%s.", - fmtId(parentRel->dobj.namespace->dobj.name)); + fmtId(parentRel->dobj.namespace->dobj.name)); appendPQExpBuffer(parentname, "%s", fmtId(parentRel->dobj.name)); @@ -15634,7 +15634,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) /* In the partitioning case, we alter the parent */ if (tbinfo->ispartition) appendPQExpBuffer(q, - "ALTER TABLE ONLY %s ATTACH PARTITION ", + "ALTER TABLE ONLY %s ATTACH PARTITION ", parentname->data); else appendPQExpBuffer(q, "ALTER TABLE ONLY %s INHERIT ", @@ -15673,7 +15673,7 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) /* We preserve the toast oids, so we can use it during restore */ appendPQExpBufferStr(q, "\n-- For binary upgrade, set toast's relfrozenxid and relminmxid\n"); appendPQExpBuffer(q, "UPDATE pg_catalog.pg_class\n" - "SET relfrozenxid = '%u', relminmxid = '%u'\n" + "SET relfrozenxid = '%u', relminmxid = '%u'\n" "WHERE oid = '%u';\n", tbinfo->toast_frozenxid, tbinfo->toast_minmxid, tbinfo->toast_oid); @@ -15843,9 +15843,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo) ArchiveEntry(fout, tbinfo->dobj.catId, tbinfo->dobj.dumpId, tbinfo->dobj.name, tbinfo->dobj.namespace->dobj.name, - (tbinfo->relkind == RELKIND_VIEW) ? NULL : tbinfo->reltablespace, + (tbinfo->relkind == RELKIND_VIEW) ? NULL : tbinfo->reltablespace, tbinfo->rolname, - (strcmp(reltypename, "TABLE") == 0) ? tbinfo->hasoids : false, + (strcmp(reltypename, "TABLE") == 0) ? tbinfo->hasoids : false, reltypename, tbinfo->postponed_def ? SECTION_POST_DATA : SECTION_PRE_DATA, @@ -16174,7 +16174,7 @@ dumpConstraint(Archive *fout, ConstraintInfo *coninfo) else { appendPQExpBuffer(q, "%s (", - coninfo->contype == 'p' ? "PRIMARY KEY" : "UNIQUE"); + coninfo->contype == 'p' ? "PRIMARY KEY" : "UNIQUE"); for (k = 0; k < indxinfo->indnkeys; k++) { int indkey = (int) indxinfo->indkeys[k]; @@ -16394,7 +16394,7 @@ dumpTableConstraintComment(Archive *fout, ConstraintInfo *coninfo) tbinfo->dobj.namespace->dobj.name, tbinfo->rolname, coninfo->dobj.catId, 0, - coninfo->separate ? coninfo->dobj.dumpId : tbinfo->dobj.dumpId); + coninfo->separate ? coninfo->dobj.dumpId : tbinfo->dobj.dumpId); destroyPQExpBuffer(labelq); } @@ -16485,7 +16485,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) appendPQExpBuffer(query, "SELECT 'bigint'::name AS sequence_type, " - "0 AS start_value, increment_by, max_value, min_value, " + "0 AS start_value, increment_by, max_value, min_value, " "cache_value, is_cycled FROM %s", fmtId(tbinfo->dobj.name)); } @@ -16574,7 +16574,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) fmtId(owning_tab->dobj.name)); appendPQExpBuffer(query, "ALTER COLUMN %s ADD GENERATED ", - fmtId(owning_tab->attnames[tbinfo->owning_col - 1])); + fmtId(owning_tab->attnames[tbinfo->owning_col - 1])); if (owning_tab->attidentity[tbinfo->owning_col - 1] == ATTRIBUTE_IDENTITY_ALWAYS) appendPQExpBuffer(query, "ALWAYS"); else if (owning_tab->attidentity[tbinfo->owning_col - 1] == ATTRIBUTE_IDENTITY_BY_DEFAULT) @@ -16663,7 +16663,7 @@ dumpSequence(Archive *fout, TableInfo *tbinfo) appendPQExpBuffer(query, " OWNED BY %s", fmtId(owning_tab->dobj.name)); appendPQExpBuffer(query, ".%s;\n", - fmtId(owning_tab->attnames[tbinfo->owning_col - 1])); + fmtId(owning_tab->attnames[tbinfo->owning_col - 1])); if (tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION) ArchiveEntry(fout, nilCatalogId, createDumpId(), @@ -17137,7 +17137,7 @@ dumpRule(Archive *fout, RuleInfo *rinfo) { /* In the rule case, just print pg_get_ruledef's result verbatim */ appendPQExpBuffer(query, - "SELECT pg_catalog.pg_get_ruledef('%u'::pg_catalog.oid)", + "SELECT pg_catalog.pg_get_ruledef('%u'::pg_catalog.oid)", rinfo->dobj.catId.oid); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); @@ -17395,7 +17395,7 @@ processExtensionTables(Archive *fout, ExtensionInfo extinfo[], int nconditionitems; if (parsePGArray(extconfig, &extconfigarray, &nconfigitems) && - parsePGArray(extcondition, &extconditionarray, &nconditionitems) && + parsePGArray(extcondition, &extconditionarray, &nconditionitems) && nconfigitems == nconditionitems) { int j; @@ -17437,7 +17437,7 @@ processExtensionTables(Archive *fout, ExtensionInfo extinfo[], /* check schema excluded by an exclusion switch */ if (simple_oid_list_member(&schema_exclude_oids, - configtbl->dobj.namespace->dobj.catId.oid)) + configtbl->dobj.namespace->dobj.catId.oid)) dumpobj = false; if (dumpobj) @@ -17849,7 +17849,7 @@ findDumpableDependencies(ArchiveHandle *AH, DumpableObject *dobj, { *allocDeps *= 2; *dependencies = (DumpId *) pg_realloc(*dependencies, - *allocDeps * sizeof(DumpId)); + *allocDeps * sizeof(DumpId)); } (*dependencies)[*nDeps] = depid; (*nDeps)++; diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index 75aa065e5d..80c994b0f5 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -133,7 +133,7 @@ typedef struct _dumpableObject char *name; /* object name (should never be NULL) */ struct _namespaceInfo *namespace; /* containing namespace, or NULL */ DumpComponents dump; /* bitmask of components to dump */ - DumpComponents dump_contains; /* as above, but for contained objects */ + DumpComponents dump_contains; /* as above, but for contained objects */ bool ext_member; /* true if object is member of extension */ DumpId *dependencies; /* dumpIds of objects this one depends on */ int nDeps; /* number of valid dependencies */ @@ -271,7 +271,7 @@ typedef struct _tableInfo char *reltablespace; /* relation tablespace */ char *reloptions; /* options specified by WITH (...) */ char *checkoption; /* WITH CHECK OPTION, if any */ - char *toast_reloptions; /* WITH options for the TOAST table */ + char *toast_reloptions; /* WITH options for the TOAST table */ bool hasindex; /* does it have any indexes? */ bool hasrules; /* does it have any rules? */ bool hastriggers; /* does it have any triggers? */ @@ -323,7 +323,7 @@ typedef struct _tableInfo char **attfdwoptions; /* per-attribute fdw options */ bool *notnull; /* NOT NULL constraints on attributes */ bool *inhNotNull; /* true if NOT NULL is inherited */ - struct _attrDefInfo **attrdefs; /* DEFAULT expressions */ + struct _attrDefInfo **attrdefs; /* DEFAULT expressions */ struct _constraintInfo *checkexprs; /* CHECK constraints */ char *partkeydef; /* partition key definition */ char *partbound; /* partition bound definition */ @@ -334,9 +334,9 @@ typedef struct _tableInfo */ int numParents; /* number of (immediate) parent tables */ struct _tableInfo **parents; /* TableInfos of immediate parents */ - struct _tableDataInfo *dataObj; /* TableDataInfo, if dumping its data */ + struct _tableDataInfo *dataObj; /* TableDataInfo, if dumping its data */ int numTriggers; /* number of triggers for table */ - struct _triggerInfo *triggers; /* array of TriggerInfo structs */ + struct _triggerInfo *triggers; /* array of TriggerInfo structs */ } TableInfo; typedef struct _attrDefInfo @@ -718,4 +718,4 @@ extern void getPublicationTables(Archive *fout, TableInfo tblinfo[], int numTables); extern void getSubscriptions(Archive *fout); -#endif /* PG_DUMP_H */ +#endif /* PG_DUMP_H */ diff --git a/src/bin/pg_dump/pg_dump_sort.c b/src/bin/pg_dump/pg_dump_sort.c index 5c19b05ca4..5044a76787 100644 --- a/src/bin/pg_dump/pg_dump_sort.c +++ b/src/bin/pg_dump/pg_dump_sort.c @@ -360,7 +360,7 @@ sortDumpableObjects(DumpableObject **objs, int numObjs, static bool TopoSort(DumpableObject **objs, int numObjs, - DumpableObject **ordering, /* output argument */ + DumpableObject **ordering, /* output argument */ int *nOrdering) /* output argument */ { DumpId maxDumpId = getMaxDumpId(); @@ -1181,7 +1181,7 @@ repairDependencyLoop(DumpableObject **loop, write_msg(NULL, "Consider using a full dump instead of a --data-only dump to avoid this problem.\n"); if (nLoop > 1) removeObjectDependency(loop[0], loop[1]->dumpId); - else /* must be a self-dependency */ + else /* must be a self-dependency */ removeObjectDependency(loop[0], loop[0]->dumpId); return; } @@ -1201,7 +1201,7 @@ repairDependencyLoop(DumpableObject **loop, if (nLoop > 1) removeObjectDependency(loop[0], loop[1]->dumpId); - else /* must be a self-dependency */ + else /* must be a self-dependency */ removeObjectDependency(loop[0], loop[0]->dumpId); } diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index fbd6342de5..0c33d1c9c4 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -53,7 +53,7 @@ static void buildShSecLabels(PGconn *conn, const char *catalog_name, uint32 objectId, PQExpBuffer buffer, const char *target, const char *objname); static PGconn *connectDatabase(const char *dbname, const char *connstr, const char *pghost, const char *pgport, - const char *pguser, trivalue prompt_password, bool fail_on_error); + const char *pguser, trivalue prompt_password, bool fail_on_error); static char *constructConnStr(const char **keywords, const char **values); static PGresult *executeQuery(PGconn *conn, const char *query); static void executeCommand(PGconn *conn, const char *query); @@ -742,7 +742,7 @@ dumpRoles(PGconn *conn) "rolcreaterole, rolcreatedb, " "rolcanlogin, rolconnlimit, rolpassword, " "rolvaliduntil, rolreplication, rolbypassrls, " - "pg_catalog.shobj_description(oid, '%s') as rolcomment, " + "pg_catalog.shobj_description(oid, '%s') as rolcomment, " "rolname = current_user AS is_current_user " "FROM %s " "WHERE rolname !~ '^pg_' " @@ -753,7 +753,7 @@ dumpRoles(PGconn *conn) "rolcreaterole, rolcreatedb, " "rolcanlogin, rolconnlimit, rolpassword, " "rolvaliduntil, rolreplication, rolbypassrls, " - "pg_catalog.shobj_description(oid, '%s') as rolcomment, " + "pg_catalog.shobj_description(oid, '%s') as rolcomment, " "rolname = current_user AS is_current_user " "FROM %s " "ORDER BY 2", role_catalog, role_catalog); @@ -764,7 +764,7 @@ dumpRoles(PGconn *conn) "rolcanlogin, rolconnlimit, rolpassword, " "rolvaliduntil, rolreplication, " "false as rolbypassrls, " - "pg_catalog.shobj_description(oid, '%s') as rolcomment, " + "pg_catalog.shobj_description(oid, '%s') as rolcomment, " "rolname = current_user AS is_current_user " "FROM %s " "ORDER BY 2", role_catalog, role_catalog); @@ -775,7 +775,7 @@ dumpRoles(PGconn *conn) "rolcanlogin, rolconnlimit, rolpassword, " "rolvaliduntil, false as rolreplication, " "false as rolbypassrls, " - "pg_catalog.shobj_description(oid, '%s') as rolcomment, " + "pg_catalog.shobj_description(oid, '%s') as rolcomment, " "rolname = current_user AS is_current_user " "FROM %s " "ORDER BY 2", role_catalog, role_catalog); @@ -986,8 +986,8 @@ dumpRoleMembership(PGconn *conn) "LEFT JOIN %s ur on ur.oid = a.roleid " "LEFT JOIN %s um on um.oid = a.member " "LEFT JOIN %s ug on ug.oid = a.grantor " - "WHERE NOT (ur.rolname ~ '^pg_' AND um.rolname ~ '^pg_')" - "ORDER BY 1,2,3", role_catalog, role_catalog, role_catalog); + "WHERE NOT (ur.rolname ~ '^pg_' AND um.rolname ~ '^pg_')" + "ORDER BY 1,2,3", role_catalog, role_catalog, role_catalog); res = executeQuery(conn, buf->data); if (PQntuples(res) > 0) @@ -1152,7 +1152,7 @@ dumpTablespaces(PGconn *conn) */ if (server_version >= 90600) res = executeQuery(conn, "SELECT oid, spcname, " - "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " + "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " "pg_catalog.pg_tablespace_location(oid), " "(SELECT pg_catalog.array_agg(acl) FROM (SELECT pg_catalog.unnest(coalesce(spcacl,pg_catalog.acldefault('t',spcowner))) AS acl " "EXCEPT SELECT pg_catalog.unnest(pg_catalog.acldefault('t',spcowner))) as foo)" @@ -1161,40 +1161,40 @@ dumpTablespaces(PGconn *conn) "EXCEPT SELECT pg_catalog.unnest(coalesce(spcacl,pg_catalog.acldefault('t',spcowner)))) as foo)" "AS rspcacl," "array_to_string(spcoptions, ', ')," - "pg_catalog.shobj_description(oid, 'pg_tablespace') " + "pg_catalog.shobj_description(oid, 'pg_tablespace') " "FROM pg_catalog.pg_tablespace " "WHERE spcname !~ '^pg_' " "ORDER BY 1"); else if (server_version >= 90200) res = executeQuery(conn, "SELECT oid, spcname, " - "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " + "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " "pg_catalog.pg_tablespace_location(oid), " "spcacl, '' as rspcacl, " "array_to_string(spcoptions, ', ')," - "pg_catalog.shobj_description(oid, 'pg_tablespace') " + "pg_catalog.shobj_description(oid, 'pg_tablespace') " "FROM pg_catalog.pg_tablespace " "WHERE spcname !~ '^pg_' " "ORDER BY 1"); else if (server_version >= 90000) res = executeQuery(conn, "SELECT oid, spcname, " - "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " + "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " "spclocation, spcacl, '' as rspcacl, " "array_to_string(spcoptions, ', ')," - "pg_catalog.shobj_description(oid, 'pg_tablespace') " + "pg_catalog.shobj_description(oid, 'pg_tablespace') " "FROM pg_catalog.pg_tablespace " "WHERE spcname !~ '^pg_' " "ORDER BY 1"); else if (server_version >= 80200) res = executeQuery(conn, "SELECT oid, spcname, " - "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " + "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " "spclocation, spcacl, '' as rspcacl, null, " - "pg_catalog.shobj_description(oid, 'pg_tablespace') " + "pg_catalog.shobj_description(oid, 'pg_tablespace') " "FROM pg_catalog.pg_tablespace " "WHERE spcname !~ '^pg_' " "ORDER BY 1"); else res = executeQuery(conn, "SELECT oid, spcname, " - "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " + "pg_catalog.pg_get_userbyid(spcowner) AS spcowner, " "spclocation, spcacl, '' as rspcacl, " "null, null " "FROM pg_catalog.pg_tablespace " @@ -1394,8 +1394,8 @@ dumpCreateDB(PGconn *conn) "AS rdatacl, " "datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " - "FROM pg_database d LEFT JOIN %s u ON (datdba = u.oid) " - "WHERE datallowconn ORDER BY 1", role_catalog, role_catalog); + "FROM pg_database d LEFT JOIN %s u ON (datdba = u.oid) " + "WHERE datallowconn ORDER BY 1", role_catalog, role_catalog); else if (server_version >= 90300) printfPQExpBuffer(buf, "SELECT datname, " @@ -1405,19 +1405,19 @@ dumpCreateDB(PGconn *conn) "datistemplate, datacl, '' as rdatacl, " "datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " - "FROM pg_database d LEFT JOIN %s u ON (datdba = u.oid) " - "WHERE datallowconn ORDER BY 1", role_catalog, role_catalog); + "FROM pg_database d LEFT JOIN %s u ON (datdba = u.oid) " + "WHERE datallowconn ORDER BY 1", role_catalog, role_catalog); else if (server_version >= 80400) printfPQExpBuffer(buf, "SELECT datname, " "coalesce(rolname, (select rolname from %s where oid=(select datdba from pg_database where datname='template0'))), " "pg_encoding_to_char(d.encoding), " - "datcollate, datctype, datfrozenxid, 0 AS datminmxid, " + "datcollate, datctype, datfrozenxid, 0 AS datminmxid, " "datistemplate, datacl, '' as rdatacl, " "datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " - "FROM pg_database d LEFT JOIN %s u ON (datdba = u.oid) " - "WHERE datallowconn ORDER BY 1", role_catalog, role_catalog); + "FROM pg_database d LEFT JOIN %s u ON (datdba = u.oid) " + "WHERE datallowconn ORDER BY 1", role_catalog, role_catalog); else if (server_version >= 80100) printfPQExpBuffer(buf, "SELECT datname, " @@ -1427,8 +1427,8 @@ dumpCreateDB(PGconn *conn) "datistemplate, datacl, '' as rdatacl, " "datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " - "FROM pg_database d LEFT JOIN %s u ON (datdba = u.oid) " - "WHERE datallowconn ORDER BY 1", role_catalog, role_catalog); + "FROM pg_database d LEFT JOIN %s u ON (datdba = u.oid) " + "WHERE datallowconn ORDER BY 1", role_catalog, role_catalog); else printfPQExpBuffer(buf, "SELECT datname, " @@ -1438,7 +1438,7 @@ dumpCreateDB(PGconn *conn) "datistemplate, datacl, '' as rdatacl, " "-1 as datconnlimit, " "(SELECT spcname FROM pg_tablespace t WHERE t.oid = d.dattablespace) AS dattablespace " - "FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) " + "FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid) " "WHERE datallowconn ORDER BY 1"); res = executeQuery(conn, buf->data); @@ -1639,7 +1639,7 @@ dumpUserConfig(PGconn *conn, const char *username) if (server_version >= 90000) printfPQExpBuffer(buf, "SELECT setconfig[%d] FROM pg_db_role_setting WHERE " "setdatabase = 0 AND setrole = " - "(SELECT oid FROM %s WHERE rolname = ", count, role_catalog); + "(SELECT oid FROM %s WHERE rolname = ", count, role_catalog); else if (server_version >= 80100) printfPQExpBuffer(buf, "SELECT rolconfig[%d] FROM %s WHERE rolname = ", count, role_catalog); else @@ -1680,7 +1680,7 @@ dumpDbRoleConfig(PGconn *conn) printfPQExpBuffer(buf, "SELECT rolname, datname, unnest(setconfig) " "FROM pg_db_role_setting, %s u, pg_database " - "WHERE setrole = u.oid AND setdatabase = pg_database.oid", role_catalog); + "WHERE setrole = u.oid AND setdatabase = pg_database.oid", role_catalog); res = executeQuery(conn, buf->data); if (PQntuples(res) > 0) diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index 1e6835d529..860a211a3c 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -488,7 +488,7 @@ usage(const char *progname) printf(_(" --no-tablespaces do not restore tablespace assignments\n")); printf(_(" --section=SECTION restore named section (pre-data, data, or post-data)\n")); printf(_(" --strict-names require table and/or schema include patterns to\n" - " match at least one entity each\n")); + " match at least one entity each\n")); printf(_(" --use-set-session-authorization\n" " use SET SESSION AUTHORIZATION commands instead of\n" " ALTER OWNER commands to set ownership\n")); diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index 7f01067581..d4dd1d49ca 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -57,7 +57,7 @@ #include "pg_getopt.h" -static ControlFileData ControlFile; /* pg_control values */ +static ControlFileData ControlFile; /* pg_control values */ static XLogSegNo newXlogSegNo; /* new XLOG segment # */ static bool guessed = false; /* T if we had to guess at any values */ static const char *progname; @@ -438,7 +438,7 @@ main(int argc, char *argv[]) if (ControlFile.state != DB_SHUTDOWNED && !force) { printf(_("The database server was not shut down cleanly.\n" - "Resetting the write-ahead log might cause data to be lost.\n" + "Resetting the write-ahead log might cause data to be lost.\n" "If you want to proceed anyway, use -f to force reset.\n")); exit(1); } @@ -564,7 +564,7 @@ ReadControlFile(void) close(fd); if (len >= sizeof(ControlFileData) && - ((ControlFileData *) buffer)->pg_control_version == PG_CONTROL_VERSION) + ((ControlFileData *) buffer)->pg_control_version == PG_CONTROL_VERSION) { /* Check the CRC. */ INIT_CRC32C(crc); @@ -834,7 +834,7 @@ static void RewriteControlFile(void) { int fd; - char buffer[PG_CONTROL_SIZE]; /* need not be aligned */ + char buffer[PG_CONTROL_SIZE]; /* need not be aligned */ /* * Adjust fields as needed to force an empty XLOG starting at diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c index 347d4e4d4c..f7ac5b30b5 100644 --- a/src/bin/pg_rewind/copy_fetch.c +++ b/src/bin/pg_rewind/copy_fetch.c @@ -137,7 +137,7 @@ recurse_dir(const char *datadir, const char *parentpath, #else pg_fatal("\"%s\" is a symbolic link, but symbolic links are not supported on this platform\n", fullpath); -#endif /* HAVE_READLINK */ +#endif /* HAVE_READLINK */ } } diff --git a/src/bin/pg_rewind/datapagemap.h b/src/bin/pg_rewind/datapagemap.h index 15ebd68b27..db991c16df 100644 --- a/src/bin/pg_rewind/datapagemap.h +++ b/src/bin/pg_rewind/datapagemap.h @@ -27,4 +27,4 @@ extern datapagemap_iterator_t *datapagemap_iterate(datapagemap_t *map); extern bool datapagemap_next(datapagemap_iterator_t *iter, BlockNumber *blkno); extern void datapagemap_print(datapagemap_t *map); -#endif /* DATAPAGEMAP_H */ +#endif /* DATAPAGEMAP_H */ diff --git a/src/bin/pg_rewind/fetch.h b/src/bin/pg_rewind/fetch.h index ccb2dab3e9..1e08f76b3e 100644 --- a/src/bin/pg_rewind/fetch.h +++ b/src/bin/pg_rewind/fetch.h @@ -41,4 +41,4 @@ extern void copy_executeFileMap(filemap_t *map); typedef void (*process_file_callback_t) (const char *path, file_type_t type, size_t size, const char *link_target); extern void traverse_datadir(const char *datadir, process_file_callback_t callback); -#endif /* FETCH_H */ +#endif /* FETCH_H */ diff --git a/src/bin/pg_rewind/file_ops.h b/src/bin/pg_rewind/file_ops.h index d247f3dc65..f9aea52d6d 100644 --- a/src/bin/pg_rewind/file_ops.h +++ b/src/bin/pg_rewind/file_ops.h @@ -21,4 +21,4 @@ extern void remove_target(file_entry_t *t); extern char *slurpFile(const char *datadir, const char *path, size_t *filesize); -#endif /* FILE_OPS_H */ +#endif /* FILE_OPS_H */ diff --git a/src/bin/pg_rewind/filemap.c b/src/bin/pg_rewind/filemap.c index 0b78980507..2b745e54ee 100644 --- a/src/bin/pg_rewind/filemap.c +++ b/src/bin/pg_rewind/filemap.c @@ -604,7 +604,7 @@ isRelDataFile(const char *path) else { nmatch = sscanf(path, "pg_tblspc/%u/PG_%20s/%u/%u.%u", - &rnode.spcNode, buf, &rnode.dbNode, &rnode.relNode, + &rnode.spcNode, buf, &rnode.dbNode, &rnode.relNode, &segNo); if (nmatch == 4 || nmatch == 5) matched = true; diff --git a/src/bin/pg_rewind/filemap.h b/src/bin/pg_rewind/filemap.h index 3431047bf7..6c97fa74d1 100644 --- a/src/bin/pg_rewind/filemap.h +++ b/src/bin/pg_rewind/filemap.h @@ -102,4 +102,4 @@ extern void process_block_change(ForkNumber forknum, RelFileNode rnode, BlockNumber blkno); extern void filemap_finalize(void); -#endif /* FILEMAP_H */ +#endif /* FILEMAP_H */ diff --git a/src/bin/pg_rewind/logging.h b/src/bin/pg_rewind/logging.h index c2f4689104..c665194050 100644 --- a/src/bin/pg_rewind/logging.h +++ b/src/bin/pg_rewind/logging.h @@ -32,4 +32,4 @@ extern void pg_fatal(const char *fmt,...) pg_attribute_printf(1, 2) pg_attribute extern void progress_report(bool force); -#endif /* PG_REWIND_LOGGING_H */ +#endif /* PG_REWIND_LOGGING_H */ diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c index 1e3d329705..1befdbdeea 100644 --- a/src/bin/pg_rewind/parsexlog.c +++ b/src/bin/pg_rewind/parsexlog.c @@ -371,7 +371,7 @@ extractPageInfo(XLogReaderState *record) */ pg_fatal("WAL record modifies a relation, but record type is not recognized\n" "lsn: %X/%X, rmgr: %s, info: %02X\n", - (uint32) (record->ReadRecPtr >> 32), (uint32) (record->ReadRecPtr), + (uint32) (record->ReadRecPtr >> 32), (uint32) (record->ReadRecPtr), RmgrNames[rmid], info); } diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index 622dc6d135..6c75b56992 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -589,14 +589,14 @@ createBackupLabel(XLogRecPtr startpoint, TimeLineID starttli, XLogRecPtr checkpo "BACKUP FROM: standby\n" "START TIME: %s\n", /* omit LABEL: line */ - (uint32) (startpoint >> 32), (uint32) startpoint, xlogfilename, + (uint32) (startpoint >> 32), (uint32) startpoint, xlogfilename, (uint32) (checkpointloc >> 32), (uint32) checkpointloc, strfbuf); if (len >= sizeof(buf)) pg_fatal("backup label buffer too small\n"); /* shouldn't happen */ /* TODO: move old file out of the way, if any. */ - open_target_file("backup_label", true); /* BACKUP_LABEL_FILE */ + open_target_file("backup_label", true); /* BACKUP_LABEL_FILE */ write_target_range(buf, 0, len); close_target_file(); } diff --git a/src/bin/pg_rewind/pg_rewind.h b/src/bin/pg_rewind/pg_rewind.h index 524478a72b..31353dd354 100644 --- a/src/bin/pg_rewind/pg_rewind.h +++ b/src/bin/pg_rewind/pg_rewind.h @@ -43,4 +43,4 @@ extern XLogRecPtr readOneRecord(const char *datadir, XLogRecPtr ptr, extern TimeLineHistoryEntry *rewind_parseTimeLineHistory(char *buffer, TimeLineID targetTLI, int *nentries); -#endif /* PG_REWIND_H */ +#endif /* PG_REWIND_H */ diff --git a/src/bin/pg_test_timing/pg_test_timing.c b/src/bin/pg_test_timing/pg_test_timing.c index 4867681eb4..2f1ab7cd60 100644 --- a/src/bin/pg_test_timing/pg_test_timing.c +++ b/src/bin/pg_test_timing/pg_test_timing.c @@ -99,7 +99,7 @@ handle_args(int argc, char *argv[]) else { fprintf(stderr, - _("%s: duration must be a positive integer (duration is \"%d\")\n"), + _("%s: duration must be a positive integer (duration is \"%d\")\n"), progname, test_duration); fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 8b9e81eb40..120c9ae265 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -174,23 +174,25 @@ report_clusters_compatible(void) void -issue_warnings(void) +issue_warnings_and_set_wal_level(void) { + /* + * We unconditionally start/stop the new server because pg_resetwal -o set + * wal_level to 'minimum'. If the user is upgrading standby servers using + * the rsync instructions, they will need pg_upgrade to write its final + * WAL record showing wal_level as 'replica'. + */ + start_postmaster(&new_cluster, true); + /* Create dummy large object permissions for old < PG 9.0? */ if (GET_MAJOR_VERSION(old_cluster.major_version) <= 804) - { - start_postmaster(&new_cluster, true); new_9_0_populate_pg_largeobject_metadata(&new_cluster, false); - stop_postmaster(false); - } /* Reindex hash indexes for old < 10.0 */ if (GET_MAJOR_VERSION(old_cluster.major_version) <= 906) - { - start_postmaster(&new_cluster, true); old_9_6_invalidate_hash_indexes(&new_cluster, false); - stop_postmaster(false); - } + + stop_postmaster(false); } @@ -207,18 +209,18 @@ output_completion_banner(char *analyze_script_file_name, else pg_log(PG_REPORT, "Optimizer statistics and free space information are not transferred\n" - "by pg_upgrade so, once you start the new server, consider running:\n" + "by pg_upgrade so, once you start the new server, consider running:\n" " %s\n\n", analyze_script_file_name); if (deletion_script_file_name) pg_log(PG_REPORT, - "Running this script will delete the old cluster's data files:\n" + "Running this script will delete the old cluster's data files:\n" " %s\n", deletion_script_file_name); else pg_log(PG_REPORT, - "Could not create a script to delete the old cluster's data files\n" + "Could not create a script to delete the old cluster's data files\n" "because user-defined tablespaces or the new cluster's data directory\n" "exist in the old cluster directory. The old cluster's contents must\n" "be deleted manually.\n"); @@ -737,7 +739,7 @@ check_proper_datallowconn(ClusterInfo *cluster) */ if (strcmp(datallowconn, "f") == 0) pg_fatal("All non-template0 databases must allow connections, " - "i.e. their pg_database.datallowconn must be true\n"); + "i.e. their pg_database.datallowconn must be true\n"); } } @@ -857,8 +859,8 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster) { pg_log(PG_REPORT, "fatal\n"); pg_fatal("Your installation contains \"contrib/isn\" functions which rely on the\n" - "bigint data type. Your old and new clusters pass bigint values\n" - "differently so this cluster cannot currently be upgraded. You can\n" + "bigint data type. Your old and new clusters pass bigint values\n" + "differently so this cluster cannot currently be upgraded. You can\n" "manually upgrade databases that use \"contrib/isn\" facilities and remove\n" "\"contrib/isn\" from the old cluster and restart the upgrade. A list of\n" "the problem functions is in the file:\n" @@ -917,13 +919,13 @@ check_for_reg_data_type_usage(ClusterInfo *cluster) "WHERE c.oid = a.attrelid AND " " NOT a.attisdropped AND " " a.atttypid IN ( " - " 'pg_catalog.regproc'::pg_catalog.regtype, " + " 'pg_catalog.regproc'::pg_catalog.regtype, " " 'pg_catalog.regprocedure'::pg_catalog.regtype, " - " 'pg_catalog.regoper'::pg_catalog.regtype, " + " 'pg_catalog.regoper'::pg_catalog.regtype, " " 'pg_catalog.regoperator'::pg_catalog.regtype, " /* regclass.oid is preserved, so 'regclass' is OK */ /* regtype.oid is preserved, so 'regtype' is OK */ - " 'pg_catalog.regconfig'::pg_catalog.regtype, " + " 'pg_catalog.regconfig'::pg_catalog.regtype, " " 'pg_catalog.regdictionary'::pg_catalog.regtype) AND " " c.relnamespace = n.oid AND " " n.nspname NOT IN ('pg_catalog', 'information_schema')"); @@ -961,8 +963,8 @@ check_for_reg_data_type_usage(ClusterInfo *cluster) { pg_log(PG_REPORT, "fatal\n"); pg_fatal("Your installation contains one of the reg* data types in user tables.\n" - "These data types reference system OIDs that are not preserved by\n" - "pg_upgrade, so this cluster cannot currently be upgraded. You can\n" + "These data types reference system OIDs that are not preserved by\n" + "pg_upgrade, so this cluster cannot currently be upgraded. You can\n" "remove the problem tables and restart the upgrade. A list of the problem\n" "columns is in the file:\n" " %s\n\n", output_path); diff --git a/src/bin/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c index 519256851c..3abef16c81 100644 --- a/src/bin/pg_upgrade/controldata.c +++ b/src/bin/pg_upgrade/controldata.c @@ -551,7 +551,7 @@ check_control_data(ControlData *oldctrl, { if (oldctrl->align == 0 || oldctrl->align != newctrl->align) pg_fatal("old and new pg_controldata alignments are invalid or do not match\n" - "Likely one cluster is a 32-bit install, the other 64-bit\n"); + "Likely one cluster is a 32-bit install, the other 64-bit\n"); if (oldctrl->blocksz == 0 || oldctrl->blocksz != newctrl->blocksz) pg_fatal("old and new pg_controldata block sizes are invalid or do not match\n"); @@ -620,6 +620,6 @@ disable_old_cluster(void) pg_log(PG_REPORT, "\n" "If you want to start the old cluster, you will need to remove\n" "the \".old\" suffix from %s/global/pg_control.old.\n" - "Because \"link\" mode was used, the old cluster cannot be safely\n" - "started once the new cluster has been started.\n\n", old_cluster.pgdata); + "Because \"link\" mode was used, the old cluster cannot be safely\n" + "started once the new cluster has been started.\n\n", old_cluster.pgdata); } diff --git a/src/bin/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c index 2e621b027c..77c03ac05b 100644 --- a/src/bin/pg_upgrade/dump.c +++ b/src/bin/pg_upgrade/dump.c @@ -61,9 +61,9 @@ generate_old_dump(void) snprintf(log_file_name, sizeof(log_file_name), DB_DUMP_LOG_FILE_MASK, old_db->db_oid); parallel_exec_prog(log_file_name, NULL, - "\"%s/pg_dump\" %s --schema-only --quote-all-identifiers " - "--binary-upgrade --format=custom %s --file=\"%s\" %s", - new_cluster.bindir, cluster_conn_opts(&old_cluster), + "\"%s/pg_dump\" %s --schema-only --quote-all-identifiers " + "--binary-upgrade --format=custom %s --file=\"%s\" %s", + new_cluster.bindir, cluster_conn_opts(&old_cluster), log_opts.verbose ? "--verbose" : "", sql_file_name, escaped_connstr.data); diff --git a/src/bin/pg_upgrade/file.c b/src/bin/pg_upgrade/file.c index 50897e7b7a..eb925d1e0f 100644 --- a/src/bin/pg_upgrade/file.c +++ b/src/bin/pg_upgrade/file.c @@ -89,7 +89,7 @@ copyFile(const char *src, const char *dst, schemaName, relName, src, dst, strerror(errno)); } -#endif /* WIN32 */ +#endif /* WIN32 */ } diff --git a/src/bin/pg_upgrade/function.c b/src/bin/pg_upgrade/function.c index 685d1de0b7..8383b75325 100644 --- a/src/bin/pg_upgrade/function.c +++ b/src/bin/pg_upgrade/function.c @@ -95,7 +95,7 @@ get_loadable_libraries(void) "FROM pg_catalog.pg_proc p " " JOIN pg_catalog.pg_namespace n " " ON pronamespace = n.oid " - "WHERE proname = 'plpython_call_handler' AND " + "WHERE proname = 'plpython_call_handler' AND " "nspname = 'public' AND " "prolang = %u AND " "probin = '$libdir/plpython' AND " @@ -118,9 +118,9 @@ get_loadable_libraries(void) "pre-8.1 install of plpython, and must be removed for pg_upgrade\n" "to complete because it references a now-obsolete \"plpython\"\n" "shared object file. You can remove the \"public\" schema version\n" - "of this function by running the following command:\n" + "of this function by running the following command:\n" "\n" - " DROP FUNCTION public.plpython_call_handler()\n" + " DROP FUNCTION public.plpython_call_handler()\n" "\n" "in each affected database:\n" "\n"); diff --git a/src/bin/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c index ab6328eef5..6500302c3d 100644 --- a/src/bin/pg_upgrade/info.c +++ b/src/bin/pg_upgrade/info.c @@ -269,7 +269,7 @@ report_unmatched_relation(const RelInfo *rel, const DbInfo *db, bool is_new_db) if (i >= db->rel_arr.nrels) snprintf(reldesc + strlen(reldesc), sizeof(reldesc) - strlen(reldesc), - _(" which is the TOAST table for OID %u"), rel->toastheap); + _(" which is the TOAST table for OID %u"), rel->toastheap); } if (is_new_db) diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c index 5a556e7b30..de5bfddf5c 100644 --- a/src/bin/pg_upgrade/option.c +++ b/src/bin/pg_upgrade/option.c @@ -22,7 +22,7 @@ static void usage(void); static void check_required_directory(char **dirpath, char **configpath, - char *envVarName, char *cmdLineOption, char *description); + char *envVarName, char *cmdLineOption, char *description); #define FIX_DEFAULT_READ_ONLY "-c default_transaction_read_only=false" @@ -218,7 +218,7 @@ parseCommandLine(int argc, char *argv[]) /* Start with newline because we might be appending to a file. */ fprintf(fp, "\n" - "-----------------------------------------------------------------\n" + "-----------------------------------------------------------------\n" " pg_upgrade run on %s" "-----------------------------------------------------------------\n\n", ctime(&run_time)); @@ -243,9 +243,9 @@ parseCommandLine(int argc, char *argv[]) check_required_directory(&new_cluster.bindir, NULL, "PGBINNEW", "-B", _("new cluster binaries reside")); check_required_directory(&old_cluster.pgdata, &old_cluster.pgconfig, - "PGDATAOLD", "-d", _("old cluster data resides")); + "PGDATAOLD", "-d", _("old cluster data resides")); check_required_directory(&new_cluster.pgdata, &new_cluster.pgconfig, - "PGDATANEW", "-D", _("new cluster data resides")); + "PGDATANEW", "-D", _("new cluster data resides")); #ifdef WIN32 @@ -296,11 +296,11 @@ usage(void) printf(_(" -?, --help show this help, then exit\n")); printf(_("\n" "Before running pg_upgrade you must:\n" - " create a new database cluster (using the new version of initdb)\n" + " create a new database cluster (using the new version of initdb)\n" " shutdown the postmaster servicing the old cluster\n" " shutdown the postmaster servicing the new cluster\n")); printf(_("\n" - "When you run pg_upgrade, you must provide the following information:\n" + "When you run pg_upgrade, you must provide the following information:\n" " the data directory for the old cluster (-d DATADIR)\n" " the data directory for the new cluster (-D DATADIR)\n" " the \"bin\" directory for the old version (-b BINDIR)\n" @@ -478,7 +478,7 @@ get_sock_dir(ClusterInfo *cluster, bool live_check) pg_fatal("Cannot open file %s: %m\n", filename); for (lineno = 1; - lineno <= Max(LOCK_FILE_LINE_PORT, LOCK_FILE_LINE_SOCKET_DIR); + lineno <= Max(LOCK_FILE_LINE_PORT, LOCK_FILE_LINE_SOCKET_DIR); lineno++) { if (fgets(line, sizeof(line), fp) == NULL) diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c index ca1aa5cbb8..ef9793f3bd 100644 --- a/src/bin/pg_upgrade/pg_upgrade.c +++ b/src/bin/pg_upgrade/pg_upgrade.c @@ -162,7 +162,7 @@ main(int argc, char **argv) create_script_for_cluster_analyze(&analyze_script_file_name); create_script_for_old_cluster_deletion(&deletion_script_file_name); - issue_warnings(); + issue_warnings_and_set_wal_level(); pg_log(PG_REPORT, "\nUpgrade Complete\n"); pg_log(PG_REPORT, "----------------\n"); @@ -328,7 +328,7 @@ create_new_objects(void) */ parallel_exec_prog(log_file_name, NULL, - "\"%s/pg_restore\" %s --exit-on-error --verbose --dbname %s \"%s\"", + "\"%s/pg_restore\" %s --exit-on-error --verbose --dbname %s \"%s\"", new_cluster.bindir, cluster_conn_opts(&new_cluster), escaped_connstr.data, @@ -561,7 +561,7 @@ set_frozenxids(bool minmxid_only) */ if (strcmp(datallowconn, "f") == 0) PQclear(executeQueryOrDie(conn_template1, - "ALTER DATABASE %s ALLOW_CONNECTIONS = true", + "ALTER DATABASE %s ALLOW_CONNECTIONS = true", quote_identifier(datname))); conn = connectToServer(&new_cluster, datname); @@ -593,7 +593,7 @@ set_frozenxids(bool minmxid_only) /* Reset datallowconn flag */ if (strcmp(datallowconn, "f") == 0) PQclear(executeQueryOrDie(conn_template1, - "ALTER DATABASE %s ALLOW_CONNECTIONS = false", + "ALTER DATABASE %s ALLOW_CONNECTIONS = false", quote_identifier(datname))); } diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h index 8fbf8acd7e..13f7ebfe5a 100644 --- a/src/bin/pg_upgrade/pg_upgrade.h +++ b/src/bin/pg_upgrade/pg_upgrade.h @@ -183,8 +183,8 @@ typedef struct { Oid db_oid; /* oid of the database */ char *db_name; /* database name */ - char db_tablespace[MAXPGPATH]; /* database default tablespace - * path */ + char db_tablespace[MAXPGPATH]; /* database default tablespace + * path */ char *db_collate; char *db_ctype; int db_encoding; @@ -272,7 +272,7 @@ typedef struct uint32 major_version; /* PG_VERSION of cluster */ char major_version_str[64]; /* string PG_VERSION of cluster */ uint32 bin_version; /* version returned from pg_ctl */ - const char *tablespace_suffix; /* directory specification */ + const char *tablespace_suffix; /* directory specification */ } ClusterInfo; @@ -332,7 +332,7 @@ void output_check_banner(bool live_check); void check_and_dump_old_cluster(bool live_check); void check_new_cluster(void); void report_clusters_compatible(void); -void issue_warnings(void); +void issue_warnings_and_set_wal_level(void); void output_completion_banner(char *analyze_script_file_name, char *deletion_script_file_name); void check_cluster_versions(void); @@ -397,9 +397,9 @@ void get_sock_dir(ClusterInfo *cluster, bool live_check); /* relfilenode.c */ void transfer_all_new_tablespaces(DbInfoArr *old_db_arr, - DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata); + DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata); void transfer_all_new_dbs(DbInfoArr *old_db_arr, - DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata, + DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata, char *old_tablespace); /* tablespace.c */ diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c index 87a98983e2..23ba6a2e11 100644 --- a/src/bin/pg_upgrade/server.c +++ b/src/bin/pg_upgrade/server.c @@ -231,13 +231,13 @@ start_postmaster(ClusterInfo *cluster, bool throw_error) * win on ext4. */ snprintf(cmd, sizeof(cmd), - "\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d%s%s %s%s\" start", - cluster->bindir, SERVER_LOG_FILE, cluster->pgconfig, cluster->port, + "\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" -o \"-p %d%s%s %s%s\" start", + cluster->bindir, SERVER_LOG_FILE, cluster->pgconfig, cluster->port, (cluster->controldata.cat_ver >= BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? " -b" : " -c autovacuum=off -c autovacuum_freeze_max_age=2000000000", (cluster == &new_cluster) ? - " -c synchronous_commit=off -c fsync=off -c full_page_writes=off" : "", + " -c synchronous_commit=off -c fsync=off -c full_page_writes=off" : "", cluster->pgopts ? cluster->pgopts : "", socket_string); /* diff --git a/src/bin/pg_upgrade/tablespace.c b/src/bin/pg_upgrade/tablespace.c index 4938bc2de2..31958d5c67 100644 --- a/src/bin/pg_upgrade/tablespace.c +++ b/src/bin/pg_upgrade/tablespace.c @@ -24,7 +24,7 @@ init_tablespaces(void) set_tablespace_directory_suffix(&new_cluster); if (os_info.num_old_tablespaces > 0 && - strcmp(old_cluster.tablespace_suffix, new_cluster.tablespace_suffix) == 0) + strcmp(old_cluster.tablespace_suffix, new_cluster.tablespace_suffix) == 0) pg_fatal("Cannot upgrade to/from the same system catalog version when\n" "using tablespaces.\n"); } @@ -52,13 +52,13 @@ get_tablespace_paths(void) " spcname != 'pg_global'", /* 9.2 removed the spclocation column */ (GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ? - "spclocation" : "pg_catalog.pg_tablespace_location(oid) AS spclocation"); + "spclocation" : "pg_catalog.pg_tablespace_location(oid) AS spclocation"); res = executeQueryOrDie(conn, "%s", query); if ((os_info.num_old_tablespaces = PQntuples(res)) != 0) os_info.old_tablespaces = (char **) pg_malloc( - os_info.num_old_tablespaces * sizeof(char *)); + os_info.num_old_tablespaces * sizeof(char *)); else os_info.old_tablespaces = NULL; @@ -69,7 +69,7 @@ get_tablespace_paths(void) struct stat statBuf; os_info.old_tablespaces[tblnum] = pg_strdup( - PQgetvalue(res, tblnum, i_spclocation)); + PQgetvalue(res, tblnum, i_spclocation)); /* * Check that the tablespace path exists and is a directory. @@ -88,8 +88,8 @@ get_tablespace_paths(void) os_info.old_tablespaces[tblnum]); else report_status(PG_FATAL, - "could not stat tablespace directory \"%s\": %s\n", - os_info.old_tablespaces[tblnum], strerror(errno)); + "could not stat tablespace directory \"%s\": %s\n", + os_info.old_tablespaces[tblnum], strerror(errno)); } if (!S_ISDIR(statBuf.st_mode)) report_status(PG_FATAL, diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c index 814eaa522c..a9071a3448 100644 --- a/src/bin/pg_upgrade/version.c +++ b/src/bin/pg_upgrade/version.c @@ -142,7 +142,7 @@ old_9_3_check_for_line_data_type_usage(ClusterInfo *cluster) " c.relnamespace = n.oid AND " /* exclude possible orphaned temp tables */ " n.nspname !~ '^pg_temp_' AND " - " n.nspname !~ '^pg_toast_temp_' AND " + " n.nspname !~ '^pg_toast_temp_' AND " " n.nspname NOT IN ('pg_catalog', 'information_schema')"); ntups = PQntuples(res); @@ -243,7 +243,7 @@ old_9_6_check_for_unknown_data_type_usage(ClusterInfo *cluster) " c.relnamespace = n.oid AND " /* exclude possible orphaned temp tables */ " n.nspname !~ '^pg_temp_' AND " - " n.nspname !~ '^pg_toast_temp_' AND " + " n.nspname !~ '^pg_toast_temp_' AND " " n.nspname NOT IN ('pg_catalog', 'information_schema')"); ntups = PQntuples(res); @@ -393,7 +393,7 @@ old_9_6_invalidate_hash_indexes(ClusterInfo *cluster, bool check_mode) "reindexed with the REINDEX command. The file:\n" " %s\n" "when executed by psql by the database superuser will recreate all invalid\n" - "indexes; until then, none of these indexes will be used.\n\n", + "indexes; until then, none of these indexes will be used.\n\n", output_path); } else diff --git a/src/bin/pg_waldump/compat.c b/src/bin/pg_waldump/compat.c index a5d2f69c54..19a3a9d0c5 100644 --- a/src/bin/pg_waldump/compat.c +++ b/src/bin/pg_waldump/compat.c @@ -30,7 +30,7 @@ timestamptz_to_time_t(TimestampTz t) pg_time_t result; result = (pg_time_t) (t / USECS_PER_SEC + - ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY)); + ((POSTGRES_EPOCH_JDATE - UNIX_EPOCH_JDATE) * SECS_PER_DAY)); return result; } diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c index 2578d4b692..81ec3e32fd 100644 --- a/src/bin/pg_waldump/pg_waldump.c +++ b/src/bin/pg_waldump/pg_waldump.c @@ -132,7 +132,7 @@ split_path(const char *path, char **dir, char **fname) if (sep != NULL) { *dir = pg_strdup(path); - (*dir)[(sep - path) + 1] = '\0'; /* no strndup */ + (*dir)[(sep - path) + 1] = '\0'; /* no strndup */ *fname = pg_strdup(sep + 1); } /* local directory */ @@ -715,11 +715,11 @@ usage(void) " 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")); + " (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")); + " (optionally, show per-record statistics)\n")); printf(_(" -?, --help show this help, then exit\n")); } @@ -948,7 +948,7 @@ main(int argc, char **argv) else if (!XLByteInSeg(private.startptr, segno)) { fprintf(stderr, - _("%s: start WAL location %X/%X is not inside file \"%s\"\n"), + _("%s: start WAL location %X/%X is not inside file \"%s\"\n"), progname, (uint32) (private.startptr >> 32), (uint32) private.startptr, @@ -992,7 +992,7 @@ main(int argc, char **argv) private.endptr != (segno + 1) * XLogSegSize) { fprintf(stderr, - _("%s: end WAL location %X/%X is not inside file \"%s\"\n"), + _("%s: end WAL location %X/%X is not inside file \"%s\"\n"), progname, (uint32) (private.endptr >> 32), (uint32) private.endptr, diff --git a/src/bin/pg_waldump/rmgrdesc.h b/src/bin/pg_waldump/rmgrdesc.h index 2fa60d90ad..d5f6923e5c 100644 --- a/src/bin/pg_waldump/rmgrdesc.h +++ b/src/bin/pg_waldump/rmgrdesc.h @@ -19,4 +19,4 @@ typedef struct RmgrDescData extern const RmgrDescData RmgrDescTable[]; -#endif /* RMGRDESC_H */ +#endif /* RMGRDESC_H */ diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index fe5df0fa22..222bd62a1f 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -29,7 +29,7 @@ #ifdef WIN32 #define FD_SETSIZE 1024 /* set before winsock2.h is included */ -#endif /* ! WIN32 */ +#endif /* ! WIN32 */ #include "postgres_fe.h" @@ -93,7 +93,7 @@ static int pthread_join(pthread_t th, void **thread_return); #define LOG_STEP_SECONDS 5 /* seconds between log messages */ #define DEFAULT_NXACTS 10 /* default nxacts */ -#define MIN_GAUSSIAN_PARAM 2.0 /* minimum parameter for gauss */ +#define MIN_GAUSSIAN_PARAM 2.0 /* minimum parameter for gauss */ int nxacts = 0; /* number of transactions per client */ int duration = 0; /* duration in seconds */ @@ -345,8 +345,8 @@ typedef struct pthread_t thread; /* thread handle */ CState *state; /* array of CState */ int nstate; /* length of state[] */ - unsigned short random_state[3]; /* separate randomness for each thread */ - int64 throttle_trigger; /* previous/next throttling (us) */ + unsigned short random_state[3]; /* separate randomness for each thread */ + int64 throttle_trigger; /* previous/next throttling (us) */ FILE *logfile; /* where to log, or NULL */ /* per thread collected stats */ @@ -484,17 +484,17 @@ usage(void) #ifdef PGXC " -k distribute by primary key branch id - bid\n" #endif - " -n, --no-vacuum do not run VACUUM after initialization\n" - " -q, --quiet quiet logging (one message each 5 seconds)\n" + " -n, --no-vacuum do not run VACUUM after initialization\n" + " -q, --quiet quiet logging (one message each 5 seconds)\n" " -s, --scale=NUM scaling factor\n" " --foreign-keys create foreign key constraints between tables\n" " --index-tablespace=TABLESPACE\n" - " create indexes in the specified tablespace\n" - " --tablespace=TABLESPACE create tables in the specified tablespace\n" + " create indexes in the specified tablespace\n" + " --tablespace=TABLESPACE create tables in the specified tablespace\n" " --unlogged-tables create tables as unlogged tables\n" "\nOptions to select what to run:\n" " -b, --builtin=NAME[@W] add builtin script NAME weighted at W (default: 1)\n" - " (use \"-b list\" to list available scripts)\n" + " (use \"-b list\" to list available scripts)\n" " -f, --file=FILENAME[@W] add script FILENAME weighted at W (default: 1)\n" " -N, --skip-some-updates skip updates of pgbench_tellers and pgbench_branches\n" " (same as \"-b simple-update\")\n" @@ -504,7 +504,7 @@ usage(void) " -c, --client=NUM number of concurrent database clients (default: 1)\n" " -C, --connect establish new connection for each transaction\n" " -D, --define=VARNAME=VALUE\n" - " define variable for use by custom script\n" + " define variable for use by custom script\n" #ifdef PGXC " -k query with default key and additional key branch id (bid)\n" #endif @@ -516,22 +516,22 @@ usage(void) " -n, --no-vacuum do not run VACUUM before tests\n" " -P, --progress=NUM show thread progress report every NUM seconds\n" " -r, --report-latencies report average latency per command\n" - " -R, --rate=NUM target rate in transactions per second\n" + " -R, --rate=NUM target rate in transactions per second\n" " -s, --scale=NUM report this scale factor in output\n" " -t, --transactions=NUM number of transactions each client runs (default: 10)\n" - " -T, --time=NUM duration of benchmark test in seconds\n" + " -T, --time=NUM duration of benchmark test in seconds\n" " -v, --vacuum-all vacuum all four standard tables before tests\n" " --aggregate-interval=NUM aggregate data over NUM seconds\n" " --log-prefix=PREFIX prefix for transaction time log file\n" " (default: \"pgbench_log\")\n" - " --progress-timestamp use Unix epoch timestamps for progress\n" + " --progress-timestamp use Unix epoch timestamps for progress\n" " --sampling-rate=NUM fraction of transactions to log (e.g., 0.01 for 1%%)\n" "\nCommon options:\n" " -d, --debug print debugging output\n" - " -h, --host=HOSTNAME database server host or socket directory\n" + " -h, --host=HOSTNAME database server host or socket directory\n" " -p, --port=PORT database server port number\n" " -U, --username=USERNAME connect as specified database user\n" - " -V, --version output version information, then exit\n" + " -V, --version output version information, then exit\n" " -?, --help show this help, then exit\n" "\n" "Report bugs to <[email protected]>.\n", @@ -616,7 +616,7 @@ strtoint64(const char *str) { int64 tmp = result * 10 + (*ptr++ - '0'); - if ((tmp / 10) != result) /* overflow? */ + if ((tmp / 10) != result) /* overflow? */ fprintf(stderr, "value \"%s\" is out of range for type bigint\n", str); result = tmp; } @@ -1013,7 +1013,7 @@ makeVariableNumeric(Variable *var) setIntValue(&var->num_value, strtoint64(var->value)); var->is_numeric = true; } - else /* type should be double */ + else /* type should be double */ { double dv; char xs; @@ -1075,7 +1075,7 @@ lookupCreateVariable(CState *st, const char *context, char *name) /* Create variable at the end of the array */ if (st->variables) newvars = (Variable *) pg_realloc(st->variables, - (st->nvariables + 1) * sizeof(Variable)); + (st->nvariables + 1) * sizeof(Variable)); else newvars = (Variable *) pg_malloc(sizeof(Variable)); @@ -1368,7 +1368,7 @@ evalFunc(TState *thread, CState *st, Assert(0); } } - else /* we have integer operands, or % */ + else /* we have integer operands, or % */ { int64 li, ri; @@ -1606,7 +1606,7 @@ evalFunc(TState *thread, CState *st, Assert(nargs == 2); setIntValue(retval, getrand(thread, imin, imax)); } - else /* gaussian & exponential */ + else /* gaussian & exponential */ { double param; @@ -1626,20 +1626,20 @@ evalFunc(TState *thread, CState *st, } setIntValue(retval, - getGaussianRand(thread, imin, imax, param)); + getGaussianRand(thread, imin, imax, param)); } - else /* exponential */ + else /* exponential */ { if (param <= 0.0) { fprintf(stderr, - "exponential parameter must be greater than zero" + "exponential parameter must be greater than zero" " (got %f)\n", param); return false; } setIntValue(retval, - getExponentialRand(thread, imin, imax, param)); + getExponentialRand(thread, imin, imax, param)); } } @@ -1894,7 +1894,7 @@ sendCommand(CState *st, Command *command) continue; preparedStatementName(name, st->use_file, j); res = PQprepare(st->con, name, - commands[j]->argv[0], commands[j]->argc - 1, NULL); + commands[j]->argv[0], commands[j]->argc - 1, NULL); if (PQresultStatus(res) != PGRES_COMMAND_OK) fprintf(stderr, "%s", PQerrorMessage(st->con)); PQclear(res); @@ -1910,7 +1910,7 @@ sendCommand(CState *st, Command *command) r = PQsendQueryPrepared(st->con, name, command->argc - 1, params, NULL, NULL, 0); } - else /* unknown sql mode */ + else /* unknown sql mode */ r = 0; if (r == 0) @@ -2246,7 +2246,7 @@ doCustom(TState *thread, CState *st, StatsData *agg) st->state = CSTATE_FINISHED; break; } - else if (!ret) /* on error */ + else if (!ret) /* on error */ { commandFailed(st, "execution of meta-command 'setshell' failed"); st->state = CSTATE_ABORTED; @@ -2266,7 +2266,7 @@ doCustom(TState *thread, CState *st, StatsData *agg) st->state = CSTATE_FINISHED; break; } - else if (!ret) /* on error */ + else if (!ret) /* on error */ { commandFailed(st, "execution of meta-command 'shell' failed"); st->state = CSTATE_ABORTED; @@ -2745,7 +2745,7 @@ init(bool is_no_vacuum) { /* "filler" column defaults to NULL */ snprintf(sql, sizeof(sql), - "insert into pgbench_tellers(tid,bid,tbalance) values (%d,%d,0)", + "insert into pgbench_tellers(tid,bid,tbalance) values (%d,%d,0)", i + 1, i / ntellers + 1); executeStatement(con, sql); } @@ -3100,7 +3100,7 @@ process_backslash_command(PsqlScanState sstate, const char *source) Command *my_command; PQExpBufferData word_buf; int word_offset; - int offsets[MAX_ARGS]; /* offsets of argument words */ + int offsets[MAX_ARGS]; /* offsets of argument words */ int start_offset, end_offset; int lineno; @@ -3468,7 +3468,7 @@ findBuiltin(const char *name) /* error cases */ if (found == 0) fprintf(stderr, "no builtin script found for name \"%s\"\n", name); - else /* found > 1 */ + else /* found > 1 */ fprintf(stderr, "ambiguous builtin name: %d builtin scripts found for prefix \"%s\"\n", found, name); @@ -3509,7 +3509,7 @@ parseScriptWeight(const char *option, char **script) if (wtmp > INT_MAX || wtmp < 0) { fprintf(stderr, - "weight specification out of range (0 .. %u): " INT64_FORMAT "\n", + "weight specification out of range (0 .. %u): " INT64_FORMAT "\n", INT_MAX, (int64) wtmp); exit(1); } @@ -3567,7 +3567,7 @@ printResults(TState *threads, StatsData *total, instr_time total_time, time_include = INSTR_TIME_GET_DOUBLE(total_time); tps_include = total->cnt / time_include; tps_exclude = total->cnt / (time_include - - (INSTR_TIME_GET_DOUBLE(conn_total_time) / nclients)); + (INSTR_TIME_GET_DOUBLE(conn_total_time) / nclients)); /* Report test parameters. */ printf("transaction type: %s\n", @@ -3651,7 +3651,7 @@ printResults(TState *threads, StatsData *total, instr_time total_time, printf(" - number of transactions skipped: " INT64_FORMAT " (%.3f%%)\n", sql_script[i].stats.skipped, 100.0 * sql_script[i].stats.skipped / - (sql_script[i].stats.skipped + sql_script[i].stats.cnt)); + (sql_script[i].stats.skipped + sql_script[i].stats.cnt)); if (num_scripts > 1) printSimpleStats(" - latency", &sql_script[i].stats.latency); @@ -3720,8 +3720,8 @@ main(int argc, char **argv) }; int c; - int is_init_mode = 0; /* initialize mode? */ - int is_no_vacuum = 0; /* no vacuum at all before testing? */ + int is_init_mode = 0; /* initialize mode? */ + int is_no_vacuum = 0; /* no vacuum at all before testing? */ int do_vacuum_accounts = 0; /* do vacuum accounts before testing? */ int optindex; bool scale_given = false; @@ -3829,7 +3829,7 @@ main(int argc, char **argv) if (getrlimit(RLIMIT_NOFILE, &rlim) == -1) #else /* but BSD doesn't ... */ if (getrlimit(RLIMIT_OFILE, &rlim) == -1) -#endif /* RLIMIT_NOFILE */ +#endif /* RLIMIT_NOFILE */ { fprintf(stderr, "getrlimit failed: %s\n", strerror(errno)); exit(1); @@ -3841,7 +3841,7 @@ main(int argc, char **argv) fprintf(stderr, "Reduce number of clients, or use limit/ulimit to increase the system limit.\n"); exit(1); } -#endif /* HAVE_GETRLIMIT */ +#endif /* HAVE_GETRLIMIT */ break; case 'j': /* jobs */ benchmarking_option_set = true; @@ -3858,7 +3858,7 @@ main(int argc, char **argv) fprintf(stderr, "threads are not supported on this platform; use -j1\n"); exit(1); } -#endif /* !ENABLE_THREAD_SAFETY */ +#endif /* !ENABLE_THREAD_SAFETY */ break; case 'C': benchmarking_option_set = true; @@ -4370,7 +4370,7 @@ main(int argc, char **argv) /* compute when to stop */ if (duration > 0) end_time = INSTR_TIME_GET_MICROSEC(thread->start_time) + - (int64) 1000000 *duration; + (int64) 1000000 * duration; /* the first thread (i = 0) is executed by main thread */ if (i > 0) @@ -4393,9 +4393,9 @@ main(int argc, char **argv) /* compute when to stop */ if (duration > 0) end_time = INSTR_TIME_GET_MICROSEC(threads[0].start_time) + - (int64) 1000000 *duration; + (int64) 1000000 * duration; threads[0].thread = INVALID_THREAD; -#endif /* ENABLE_THREAD_SAFETY */ +#endif /* ENABLE_THREAD_SAFETY */ /* wait for threads and accumulate results */ initStats(&stats, 0); @@ -4413,7 +4413,7 @@ main(int argc, char **argv) pthread_join(thread->thread, NULL); #else (void) threadRun(thread); -#endif /* ENABLE_THREAD_SAFETY */ +#endif /* ENABLE_THREAD_SAFETY */ /* aggregate thread level stats */ mergeSimpleStats(&stats.latency, &thread->stats.latency); @@ -4450,7 +4450,7 @@ threadRun(void *arg) instr_time start, end; int nstate = thread->nstate; - int remains = nstate; /* number of remaining clients */ + int remains = nstate; /* number of remaining clients */ int i; /* for reporting progress: */ @@ -4521,7 +4521,7 @@ threadRun(void *arg) fd_set input_mask; int maxsock; /* max socket number to be waited for */ int64 min_usec; - int64 now_usec = 0; /* set this only if needed */ + int64 now_usec = 0; /* set this only if needed */ /* identify which client sockets should be checked for input */ FD_ZERO(&input_mask); @@ -4770,7 +4770,7 @@ threadRun(void *arg) */ do { - next_report += (int64) progress *1000000; + next_report += (int64) progress * 1000000; } while (now >= next_report); } } @@ -4905,4 +4905,4 @@ pthread_join(pthread_t th, void **thread_return) return 0; } -#endif /* WIN32 */ +#endif /* WIN32 */ diff --git a/src/bin/pgbench/pgbench.h b/src/bin/pgbench/pgbench.h index 38b3af5ab1..abc13e9463 100644 --- a/src/bin/pgbench/pgbench.h +++ b/src/bin/pgbench/pgbench.h @@ -137,4 +137,4 @@ extern void syntax_error(const char *source, int lineno, const char *line, extern int64 strtoint64(const char *str); -#endif /* PGBENCH_H */ +#endif /* PGBENCH_H */ diff --git a/src/bin/pgevent/pgevent.c b/src/bin/pgevent/pgevent.c index f68f987c17..807a2c9312 100644 --- a/src/bin/pgevent/pgevent.c +++ b/src/bin/pgevent/pgevent.c @@ -28,7 +28,7 @@ char event_source[256] = DEFAULT_EVENT_SOURCE; HRESULT DllInstall(BOOL bInstall, LPCWSTR pszCmdLine); STDAPI DllRegisterServer(void); STDAPI DllUnregisterServer(void); -BOOL WINAPI DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved); +BOOL WINAPI DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved); /* * DllInstall --- Passes the command line argument to DLL @@ -81,7 +81,7 @@ DllRegisterServer(void) * EventLog registry key. */ _snprintf(key_name, sizeof(key_name), - "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s", + "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s", event_source); if (RegCreateKey(HKEY_LOCAL_MACHINE, key_name, &key)) { @@ -134,7 +134,7 @@ DllUnregisterServer(void) */ _snprintf(key_name, sizeof(key_name), - "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s", + "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s", event_source); if (RegDeleteKey(HKEY_LOCAL_MACHINE, key_name)) { diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index c376d96989..70cad9a748 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -552,7 +552,7 @@ exec_command_cd(PsqlScanState scan_state, bool active_branch, const char *cmd) { psql_error("could not get home directory for user ID %ld: %s\n", (long) user_id, - errno ? strerror(errno) : _("user does not exist")); + errno ? strerror(errno) : _("user does not exist")); exit(EXIT_FAILURE); } dir = pw->pw_dir; @@ -563,7 +563,7 @@ exec_command_cd(PsqlScanState scan_state, bool active_branch, const char *cmd) * directory, so if someone wants to code this here instead... */ dir = "/"; -#endif /* WIN32 */ +#endif /* WIN32 */ } if (chdir(dir) == -1) @@ -804,7 +804,7 @@ exec_command_d(PsqlScanState scan_state, bool active_branch, const char *cmd) if (pattern) pattern2 = psql_scan_slash_option(scan_state, - OT_NORMAL, NULL, true); + OT_NORMAL, NULL, true); success = listDbRoleSettings(pattern, pattern2); } else @@ -3295,7 +3295,7 @@ printSSLInfo(void) protocol ? protocol : _("unknown"), cipher ? cipher : _("unknown"), bits ? bits : _("unknown"), - (compression && strcmp(compression, "off") != 0) ? _("on") : _("off")); + (compression && strcmp(compression, "off") != 0) ? _("on") : _("off")); } @@ -3485,7 +3485,7 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf, "/", (int) getpid()); #else snprintf(fnametmp, sizeof(fnametmp), "%s%spsql.edit.%d.sql", tmpdir, - "" /* trailing separator already present */ , (int) getpid()); + "" /* trailing separator already present */ , (int) getpid()); #endif fname = (const char *) fnametmp; @@ -4160,19 +4160,19 @@ printPsetInfo(const char *param, struct printQueryOpt *popt) else if (strcmp(param, "unicode_border_linestyle") == 0) { printf(_("Unicode border line style is \"%s\".\n"), - _unicode_linestyle2string(popt->topt.unicode_border_linestyle)); + _unicode_linestyle2string(popt->topt.unicode_border_linestyle)); } else if (strcmp(param, "unicode_column_linestyle") == 0) { printf(_("Unicode column line style is \"%s\".\n"), - _unicode_linestyle2string(popt->topt.unicode_column_linestyle)); + _unicode_linestyle2string(popt->topt.unicode_column_linestyle)); } else if (strcmp(param, "unicode_header_linestyle") == 0) { printf(_("Unicode header line style is \"%s\".\n"), - _unicode_linestyle2string(popt->topt.unicode_header_linestyle)); + _unicode_linestyle2string(popt->topt.unicode_header_linestyle)); } else @@ -4582,7 +4582,7 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid, "WHEN 'check_option=cascaded' = ANY (c.reloptions) THEN 'CASCADED'::text ELSE NULL END AS checkoption " "FROM pg_catalog.pg_class c " "LEFT JOIN pg_catalog.pg_namespace n " - "ON c.relnamespace = n.oid WHERE c.oid = %u", + "ON c.relnamespace = n.oid WHERE c.oid = %u", oid); } else if (pset.sversion >= 90200) @@ -4594,7 +4594,7 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid, "NULL AS checkoption " "FROM pg_catalog.pg_class c " "LEFT JOIN pg_catalog.pg_namespace n " - "ON c.relnamespace = n.oid WHERE c.oid = %u", + "ON c.relnamespace = n.oid WHERE c.oid = %u", oid); } else @@ -4606,7 +4606,7 @@ get_create_object_cmd(EditableObjectType obj_type, Oid oid, "NULL AS checkoption " "FROM pg_catalog.pg_class c " "LEFT JOIN pg_catalog.pg_namespace n " - "ON c.relnamespace = n.oid WHERE c.oid = %u", + "ON c.relnamespace = n.oid WHERE c.oid = %u", oid); } break; diff --git a/src/bin/psql/command.h b/src/bin/psql/command.h index e8ea8473e8..7aedd0d625 100644 --- a/src/bin/psql/command.h +++ b/src/bin/psql/command.h @@ -43,4 +43,4 @@ extern void SyncVariables(void); extern void UnsyncVariables(void); -#endif /* COMMAND_H */ +#endif /* COMMAND_H */ diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index a2f1259c1e..044cdb82a7 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -377,7 +377,7 @@ setup_cancel_handler(void) SetConsoleCtrlHandler(consoleHandler, TRUE); } -#endif /* WIN32 */ +#endif /* WIN32 */ /* ConnectionUp diff --git a/src/bin/psql/common.h b/src/bin/psql/common.h index 1ceb8ae386..f34868b54e 100644 --- a/src/bin/psql/common.h +++ b/src/bin/psql/common.h @@ -46,4 +46,4 @@ extern void expand_tilde(char **filename); extern bool recognized_connection_string(const char *connstr); -#endif /* COMMON_H */ +#endif /* COMMON_H */ diff --git a/src/bin/psql/conditional.h b/src/bin/psql/conditional.h index 448db9b8bd..0957627742 100644 --- a/src/bin/psql/conditional.h +++ b/src/bin/psql/conditional.h @@ -51,7 +51,7 @@ typedef struct IfStackElem typedef struct ConditionalStackData { IfStackElem *head; -} ConditionalStackData; +} ConditionalStackData; typedef struct ConditionalStackData *ConditionalStack; @@ -80,4 +80,4 @@ extern void conditional_stack_set_paren_depth(ConditionalStack cstack, int depth extern int conditional_stack_get_paren_depth(ConditionalStack cstack); -#endif /* CONDITIONAL_H */ +#endif /* CONDITIONAL_H */ diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c index 7ed339ab6d..724ea9211a 100644 --- a/src/bin/psql/copy.c +++ b/src/bin/psql/copy.c @@ -63,7 +63,7 @@ struct copy_options static void -free_copy_options(struct copy_options * ptr) +free_copy_options(struct copy_options *ptr) { if (!ptr) return; @@ -102,7 +102,7 @@ parse_slash_copy(const char *args) result = pg_malloc0(sizeof(struct copy_options)); - result->before_tofrom = pg_strdup(""); /* initialize for appending */ + result->before_tofrom = pg_strdup(""); /* initialize for appending */ token = strtokx(args, whitespace, ".,()", "\"", 0, false, false, pset.encoding); @@ -629,8 +629,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, bool isbinary, PGresult **res) /* * This code erroneously assumes '\.' on a line alone * inside a quoted CSV string terminates the \copy. - * http://www.postgresql.org/message-id/E1TdNVQ-0001ju-GO@w - * rigleys.postgresql.org + * http://www.postgresql.org/message-id/[email protected] */ if (strcmp(buf, "\\.\n") == 0 || strcmp(buf, "\\.\r\n") == 0) diff --git a/src/bin/psql/crosstabview.c b/src/bin/psql/crosstabview.c index 2794eb6b87..ed61c346ee 100644 --- a/src/bin/psql/crosstabview.c +++ b/src/bin/psql/crosstabview.c @@ -78,7 +78,7 @@ typedef struct _avl_tree static bool printCrosstab(const PGresult *results, - int num_columns, pivot_field *piv_columns, int field_for_columns, + int num_columns, pivot_field *piv_columns, int field_for_columns, int num_rows, pivot_field *piv_rows, int field_for_rows, int field_for_data); static void avlInit(avl_tree *tree); @@ -283,7 +283,7 @@ error_return: */ static bool printCrosstab(const PGresult *results, - int num_columns, pivot_field *piv_columns, int field_for_columns, + int num_columns, pivot_field *piv_columns, int field_for_columns, int num_rows, pivot_field *piv_rows, int field_for_rows, int field_for_data) { @@ -547,7 +547,7 @@ avlInsertNode(avl_tree *tree, avl_node **node, pivot_field field) if (cmp != 0) { avlInsertNode(tree, - cmp > 0 ? ¤t->children[1] : ¤t->children[0], + cmp > 0 ? ¤t->children[1] : ¤t->children[0], field); avlAdjustBalance(tree, node); } diff --git a/src/bin/psql/crosstabview.h b/src/bin/psql/crosstabview.h index 97c72a5139..ad63ddef50 100644 --- a/src/bin/psql/crosstabview.h +++ b/src/bin/psql/crosstabview.h @@ -24,4 +24,4 @@ /* prototypes */ extern bool PrintResultsInCrosstab(const PGresult *res); -#endif /* CROSSTABVIEW_H */ +#endif /* CROSSTABVIEW_H */ diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 6ada5ea4f4..8e10f3f478 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -75,7 +75,7 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem) printfPQExpBuffer(&buf, "SELECT n.nspname as \"%s\",\n" " p.proname AS \"%s\",\n" - " pg_catalog.format_type(p.prorettype, NULL) AS \"%s\",\n", + " pg_catalog.format_type(p.prorettype, NULL) AS \"%s\",\n", gettext_noop("Schema"), gettext_noop("Name"), gettext_noop("Result data type")); @@ -84,7 +84,7 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem) appendPQExpBuffer(&buf, " CASE WHEN p.pronargs = 0\n" " THEN CAST('*' AS pg_catalog.text)\n" - " ELSE pg_catalog.pg_get_function_arguments(p.oid)\n" + " ELSE pg_catalog.pg_get_function_arguments(p.oid)\n" " END AS \"%s\",\n", gettext_noop("Argument data types")); else if (pset.sversion >= 80200) @@ -94,7 +94,7 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem) " ELSE\n" " pg_catalog.array_to_string(ARRAY(\n" " SELECT\n" - " pg_catalog.format_type(p.proargtypes[s.i], NULL)\n" + " pg_catalog.format_type(p.proargtypes[s.i], NULL)\n" " FROM\n" " pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n" " ), ', ')\n" @@ -102,13 +102,13 @@ describeAggregates(const char *pattern, bool verbose, bool showSystem) gettext_noop("Argument data types")); else appendPQExpBuffer(&buf, - " pg_catalog.format_type(p.proargtypes[0], NULL) AS \"%s\",\n", + " pg_catalog.format_type(p.proargtypes[0], NULL) AS \"%s\",\n", gettext_noop("Argument data types")); appendPQExpBuffer(&buf, - " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n" + " pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"\n" "FROM pg_catalog.pg_proc p\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n" + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n" "WHERE p.proisagg\n", gettext_noop("Description")); @@ -173,7 +173,7 @@ describeAccessMethods(const char *pattern, bool verbose) { appendPQExpBuffer(&buf, ",\n amhandler AS \"%s\",\n" - " pg_catalog.obj_description(oid, 'pg_am') AS \"%s\"", + " pg_catalog.obj_description(oid, 'pg_am') AS \"%s\"", gettext_noop("Handler"), gettext_noop("Description")); } @@ -229,15 +229,15 @@ describeTablespaces(const char *pattern, bool verbose) if (pset.sversion >= 90200) printfPQExpBuffer(&buf, "SELECT spcname AS \"%s\",\n" - " pg_catalog.pg_get_userbyid(spcowner) AS \"%s\",\n" - " pg_catalog.pg_tablespace_location(oid) AS \"%s\"", + " pg_catalog.pg_get_userbyid(spcowner) AS \"%s\",\n" + " pg_catalog.pg_tablespace_location(oid) AS \"%s\"", gettext_noop("Name"), gettext_noop("Owner"), gettext_noop("Location")); else printfPQExpBuffer(&buf, "SELECT spcname AS \"%s\",\n" - " pg_catalog.pg_get_userbyid(spcowner) AS \"%s\",\n" + " pg_catalog.pg_get_userbyid(spcowner) AS \"%s\",\n" " spclocation AS \"%s\"", gettext_noop("Name"), gettext_noop("Owner"), @@ -261,7 +261,7 @@ describeTablespaces(const char *pattern, bool verbose) if (verbose && pset.sversion >= 80200) appendPQExpBuffer(&buf, - ",\n pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"", + ",\n pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"", gettext_noop("Description")); appendPQExpBufferStr(&buf, @@ -350,8 +350,8 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool if (pset.sversion >= 80400) appendPQExpBuffer(&buf, - " pg_catalog.pg_get_function_result(p.oid) as \"%s\",\n" - " pg_catalog.pg_get_function_arguments(p.oid) as \"%s\",\n" + " pg_catalog.pg_get_function_result(p.oid) as \"%s\",\n" + " pg_catalog.pg_get_function_arguments(p.oid) as \"%s\",\n" " CASE\n" " WHEN p.proisagg THEN '%s'\n" " WHEN p.proiswindow THEN '%s'\n" @@ -368,22 +368,22 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool gettext_noop("Type")); else if (pset.sversion >= 80100) appendPQExpBuffer(&buf, - " CASE WHEN p.proretset THEN 'SETOF ' ELSE '' END ||\n" - " pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n" + " CASE WHEN p.proretset THEN 'SETOF ' ELSE '' END ||\n" + " pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n" " CASE WHEN proallargtypes IS NOT NULL THEN\n" " pg_catalog.array_to_string(ARRAY(\n" " SELECT\n" " CASE\n" " WHEN p.proargmodes[s.i] = 'i' THEN ''\n" - " WHEN p.proargmodes[s.i] = 'o' THEN 'OUT '\n" - " WHEN p.proargmodes[s.i] = 'b' THEN 'INOUT '\n" - " WHEN p.proargmodes[s.i] = 'v' THEN 'VARIADIC '\n" + " WHEN p.proargmodes[s.i] = 'o' THEN 'OUT '\n" + " WHEN p.proargmodes[s.i] = 'b' THEN 'INOUT '\n" + " WHEN p.proargmodes[s.i] = 'v' THEN 'VARIADIC '\n" " END ||\n" " CASE\n" - " WHEN COALESCE(p.proargnames[s.i], '') = '' THEN ''\n" + " WHEN COALESCE(p.proargnames[s.i], '') = '' THEN ''\n" " ELSE p.proargnames[s.i] || ' '\n" " END ||\n" - " pg_catalog.format_type(p.proallargtypes[s.i], NULL)\n" + " pg_catalog.format_type(p.proallargtypes[s.i], NULL)\n" " FROM\n" " pg_catalog.generate_series(1, pg_catalog.array_upper(p.proallargtypes, 1)) AS s(i)\n" " ), ', ')\n" @@ -391,10 +391,10 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool " pg_catalog.array_to_string(ARRAY(\n" " SELECT\n" " CASE\n" - " WHEN COALESCE(p.proargnames[s.i+1], '') = '' THEN ''\n" + " WHEN COALESCE(p.proargnames[s.i+1], '') = '' THEN ''\n" " ELSE p.proargnames[s.i+1] || ' '\n" " END ||\n" - " pg_catalog.format_type(p.proargtypes[s.i], NULL)\n" + " pg_catalog.format_type(p.proargtypes[s.i], NULL)\n" " FROM\n" " pg_catalog.generate_series(0, pg_catalog.array_upper(p.proargtypes, 1)) AS s(i)\n" " ), ', ')\n" @@ -413,9 +413,9 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool gettext_noop("Type")); else appendPQExpBuffer(&buf, - " CASE WHEN p.proretset THEN 'SETOF ' ELSE '' END ||\n" - " pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n" - " pg_catalog.oidvectortypes(p.proargtypes) as \"%s\",\n" + " CASE WHEN p.proretset THEN 'SETOF ' ELSE '' END ||\n" + " pg_catalog.format_type(p.prorettype, NULL) as \"%s\",\n" + " pg_catalog.oidvectortypes(p.proargtypes) as \"%s\",\n" " CASE\n" " WHEN p.proisagg THEN '%s'\n" " WHEN p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype THEN '%s'\n" @@ -453,8 +453,8 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool gettext_noop("unsafe"), gettext_noop("Parallel")); appendPQExpBuffer(&buf, - ",\n pg_catalog.pg_get_userbyid(p.proowner) as \"%s\"" - ",\n CASE WHEN prosecdef THEN '%s' ELSE '%s' END AS \"%s\"", + ",\n pg_catalog.pg_get_userbyid(p.proowner) as \"%s\"" + ",\n CASE WHEN prosecdef THEN '%s' ELSE '%s' END AS \"%s\"", gettext_noop("Owner"), gettext_noop("definer"), gettext_noop("invoker"), @@ -464,7 +464,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool appendPQExpBuffer(&buf, ",\n l.lanname as \"%s\"" ",\n p.prosrc as \"%s\"" - ",\n pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"", + ",\n pg_catalog.obj_description(p.oid, 'pg_proc') as \"%s\"", gettext_noop("Language"), gettext_noop("Source code"), gettext_noop("Description")); @@ -472,11 +472,11 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_proc p" - "\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"); + "\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace\n"); if (verbose) appendPQExpBufferStr(&buf, - " LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang\n"); + " LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang\n"); have_where = false; @@ -536,7 +536,7 @@ describeFunctions(const char *functypes, const char *pattern, bool verbose, bool if (needs_or) appendPQExpBufferStr(&buf, " OR "); appendPQExpBufferStr(&buf, - "p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype\n"); + "p.prorettype = 'pg_catalog.trigger'::pg_catalog.regtype\n"); needs_or = true; } if (showWindow) @@ -640,7 +640,7 @@ describeTypes(const char *pattern, bool verbose, bool showSystem) if (verbose) { appendPQExpBuffer(&buf, - " pg_catalog.pg_get_userbyid(t.typowner) AS \"%s\",\n", + " pg_catalog.pg_get_userbyid(t.typowner) AS \"%s\",\n", gettext_noop("Owner")); } if (verbose && pset.sversion >= 90200) @@ -650,11 +650,11 @@ describeTypes(const char *pattern, bool verbose, bool showSystem) } appendPQExpBuffer(&buf, - " pg_catalog.obj_description(t.oid, 'pg_type') as \"%s\"\n", + " pg_catalog.obj_description(t.oid, 'pg_type') as \"%s\"\n", gettext_noop("Description")); appendPQExpBufferStr(&buf, "FROM pg_catalog.pg_type t\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n"); + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n"); /* * do not include complex types (typrelid!=0) unless they are standalone @@ -732,7 +732,7 @@ describeOperators(const char *pattern, bool verbose, bool showSystem) " o.oprname AS \"%s\",\n" " CASE WHEN o.oprkind='l' THEN NULL ELSE pg_catalog.format_type(o.oprleft, NULL) END AS \"%s\",\n" " CASE WHEN o.oprkind='r' THEN NULL ELSE pg_catalog.format_type(o.oprright, NULL) END AS \"%s\",\n" - " pg_catalog.format_type(o.oprresult, NULL) AS \"%s\",\n", + " pg_catalog.format_type(o.oprresult, NULL) AS \"%s\",\n", gettext_noop("Schema"), gettext_noop("Name"), gettext_noop("Left arg type"), @@ -745,10 +745,10 @@ describeOperators(const char *pattern, bool verbose, bool showSystem) gettext_noop("Function")); appendPQExpBuffer(&buf, - " coalesce(pg_catalog.obj_description(o.oid, 'pg_operator'),\n" - " pg_catalog.obj_description(o.oprcode, 'pg_proc')) AS \"%s\"\n" + " coalesce(pg_catalog.obj_description(o.oid, 'pg_operator'),\n" + " pg_catalog.obj_description(o.oprcode, 'pg_proc')) AS \"%s\"\n" "FROM pg_catalog.pg_operator o\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n", + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = o.oprnamespace\n", gettext_noop("Description")); if (!showSystem && !pattern) @@ -793,8 +793,8 @@ listAllDbs(const char *pattern, bool verbose) printfPQExpBuffer(&buf, "SELECT d.datname as \"%s\",\n" - " pg_catalog.pg_get_userbyid(d.datdba) as \"%s\",\n" - " pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\",\n", + " pg_catalog.pg_get_userbyid(d.datdba) as \"%s\",\n" + " pg_catalog.pg_encoding_to_char(d.encoding) as \"%s\",\n", gettext_noop("Name"), gettext_noop("Owner"), gettext_noop("Encoding")); @@ -825,7 +825,7 @@ listAllDbs(const char *pattern, bool verbose) "\nFROM pg_catalog.pg_database d\n"); if (verbose && pset.sversion >= 80000) appendPQExpBufferStr(&buf, - " JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid\n"); + " JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid\n"); if (pattern) processSQLNamePattern(pset.db, &buf, pattern, false, false, @@ -873,8 +873,8 @@ permissionsList(const char *pattern) " WHEN " CppAsString2(RELKIND_VIEW) " THEN '%s'" " WHEN " CppAsString2(RELKIND_MATVIEW) " THEN '%s'" " WHEN " CppAsString2(RELKIND_SEQUENCE) " THEN '%s'" - " WHEN " CppAsString2(RELKIND_FOREIGN_TABLE) " THEN '%s'" - " WHEN " CppAsString2(RELKIND_PARTITIONED_TABLE) " THEN '%s'" + " WHEN " CppAsString2(RELKIND_FOREIGN_TABLE) " THEN '%s'" + " WHEN " CppAsString2(RELKIND_PARTITIONED_TABLE) " THEN '%s'" " END as \"%s\",\n" " ", gettext_noop("Schema"), @@ -915,7 +915,7 @@ permissionsList(const char *pattern) " ELSE E''\n" " END" " || CASE WHEN polroles <> '{0}' THEN\n" - " E'\\n to: ' || pg_catalog.array_to_string(\n" + " E'\\n to: ' || pg_catalog.array_to_string(\n" " ARRAY(\n" " SELECT rolname\n" " FROM pg_catalog.pg_roles\n" @@ -949,7 +949,7 @@ permissionsList(const char *pattern) " ELSE E''\n" " END" " || CASE WHEN polroles <> '{0}' THEN\n" - " E'\\n to: ' || pg_catalog.array_to_string(\n" + " E'\\n to: ' || pg_catalog.array_to_string(\n" " ARRAY(\n" " SELECT rolname\n" " FROM pg_catalog.pg_roles\n" @@ -964,7 +964,7 @@ permissionsList(const char *pattern) gettext_noop("Policies")); appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_class c\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" "WHERE c.relkind IN (" CppAsString2(RELKIND_RELATION) "," CppAsString2(RELKIND_VIEW) "," @@ -981,7 +981,7 @@ permissionsList(const char *pattern) */ processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "c.relname", NULL, - "n.nspname !~ '^pg_' AND pg_catalog.pg_table_is_visible(c.oid)"); + "n.nspname !~ '^pg_' AND pg_catalog.pg_table_is_visible(c.oid)"); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); @@ -1033,7 +1033,7 @@ listDefaultACLs(const char *pattern) initPQExpBuffer(&buf); printfPQExpBuffer(&buf, - "SELECT pg_catalog.pg_get_userbyid(d.defaclrole) AS \"%s\",\n" + "SELECT pg_catalog.pg_get_userbyid(d.defaclrole) AS \"%s\",\n" " n.nspname AS \"%s\",\n" " CASE d.defaclobjtype WHEN '%c' THEN '%s' WHEN '%c' THEN '%s' WHEN '%c' THEN '%s' WHEN '%c' THEN '%s' WHEN '%c' THEN '%s' END AS \"%s\",\n" " ", @@ -1180,7 +1180,7 @@ objectDescription(const char *pattern, bool showSystem) if (!showSystem && !pattern) appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "o.opcname", NULL, @@ -1196,7 +1196,7 @@ objectDescription(const char *pattern, bool showSystem) /* Operator family descriptions */ appendPQExpBuffer(&buf, "UNION ALL\n" - " SELECT opf.oid as oid, opf.tableoid as tableoid,\n" + " SELECT opf.oid as oid, opf.tableoid as tableoid,\n" " n.nspname as nspname,\n" " CAST(opf.opfname AS pg_catalog.text) AS name,\n" " CAST('%s' AS pg_catalog.text) as object\n" @@ -1209,7 +1209,7 @@ objectDescription(const char *pattern, bool showSystem) if (!showSystem && !pattern) appendPQExpBufferStr(&buf, " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n"); + " AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, true, false, "n.nspname", "opf.opfname", NULL, @@ -1224,8 +1224,8 @@ objectDescription(const char *pattern, bool showSystem) " CAST(r.rulename AS pg_catalog.text) as name," " CAST('%s' AS pg_catalog.text) as object\n" " FROM pg_catalog.pg_rewrite r\n" - " JOIN pg_catalog.pg_class c ON c.oid = r.ev_class\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" + " JOIN pg_catalog.pg_class c ON c.oid = r.ev_class\n" + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n" " WHERE r.rulename != '_RETURN'\n", gettext_noop("rule")); @@ -1245,8 +1245,8 @@ objectDescription(const char *pattern, bool showSystem) " CAST(t.tgname AS pg_catalog.text) as name," " CAST('%s' AS pg_catalog.text) as object\n" " FROM pg_catalog.pg_trigger t\n" - " JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n", + " JOIN pg_catalog.pg_class c ON c.oid = t.tgrelid\n" + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n", gettext_noop("trigger")); if (!showSystem && !pattern) @@ -1303,7 +1303,7 @@ describeTableDetails(const char *pattern, bool verbose, bool showSystem) " n.nspname,\n" " c.relname\n" "FROM pg_catalog.pg_class c\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"); + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace\n"); if (!showSystem && !pattern) appendPQExpBufferStr(&buf, "WHERE n.nspname <> 'pg_catalog'\n" @@ -1415,13 +1415,13 @@ describeOneTableDetails(const char *schemaname, if (pset.sversion >= 90500) { printfPQExpBuffer(&buf, - "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " - "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, " + "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " + "c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, " "c.relhasoids, %s, c.reltablespace, " "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, " "c.relpersistence, c.relreplident\n" "FROM pg_catalog.pg_class c\n " - "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" + "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" "WHERE c.oid = '%s';", (verbose ? "pg_catalog.array_to_string(c.reloptions || " @@ -1432,13 +1432,13 @@ describeOneTableDetails(const char *schemaname, else if (pset.sversion >= 90400) { printfPQExpBuffer(&buf, - "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " + "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " "c.relhastriggers, false, false, c.relhasoids, " "%s, c.reltablespace, " "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, " "c.relpersistence, c.relreplident\n" "FROM pg_catalog.pg_class c\n " - "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" + "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" "WHERE c.oid = '%s';", (verbose ? "pg_catalog.array_to_string(c.reloptions || " @@ -1449,13 +1449,13 @@ describeOneTableDetails(const char *schemaname, else if (pset.sversion >= 90100) { printfPQExpBuffer(&buf, - "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " + "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " "c.relhastriggers, false, false, c.relhasoids, " "%s, c.reltablespace, " "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END, " "c.relpersistence\n" "FROM pg_catalog.pg_class c\n " - "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" + "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" "WHERE c.oid = '%s';", (verbose ? "pg_catalog.array_to_string(c.reloptions || " @@ -1466,12 +1466,12 @@ describeOneTableDetails(const char *schemaname, else if (pset.sversion >= 90000) { printfPQExpBuffer(&buf, - "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " + "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " "c.relhastriggers, false, false, c.relhasoids, " "%s, c.reltablespace, " "CASE WHEN c.reloftype = 0 THEN '' ELSE c.reloftype::pg_catalog.regtype::pg_catalog.text END\n" "FROM pg_catalog.pg_class c\n " - "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" + "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" "WHERE c.oid = '%s';", (verbose ? "pg_catalog.array_to_string(c.reloptions || " @@ -1482,11 +1482,11 @@ describeOneTableDetails(const char *schemaname, else if (pset.sversion >= 80400) { printfPQExpBuffer(&buf, - "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " + "SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, " "c.relhastriggers, false, false, c.relhasoids, " "%s, c.reltablespace\n" "FROM pg_catalog.pg_class c\n " - "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" + "LEFT JOIN pg_catalog.pg_class tc ON (c.reltoastrelid = tc.oid)\n" "WHERE c.oid = '%s';", (verbose ? "pg_catalog.array_to_string(c.reloptions || " @@ -1497,18 +1497,18 @@ describeOneTableDetails(const char *schemaname, else if (pset.sversion >= 80200) { printfPQExpBuffer(&buf, - "SELECT relchecks, relkind, relhasindex, relhasrules, " + "SELECT relchecks, relkind, relhasindex, relhasrules, " "reltriggers <> 0, false, false, relhasoids, " "%s, reltablespace\n" "FROM pg_catalog.pg_class WHERE oid = '%s';", (verbose ? - "pg_catalog.array_to_string(reloptions, E', ')" : "''"), + "pg_catalog.array_to_string(reloptions, E', ')" : "''"), oid); } else if (pset.sversion >= 80000) { printfPQExpBuffer(&buf, - "SELECT relchecks, relkind, relhasindex, relhasrules, " + "SELECT relchecks, relkind, relhasindex, relhasrules, " "reltriggers <> 0, false, false, relhasoids, " "'', reltablespace\n" "FROM pg_catalog.pg_class WHERE oid = '%s';", @@ -1517,7 +1517,7 @@ describeOneTableDetails(const char *schemaname, else { printfPQExpBuffer(&buf, - "SELECT relchecks, relkind, relhasindex, relhasrules, " + "SELECT relchecks, relkind, relhasindex, relhasrules, " "reltriggers <> 0, false, false, relhasoids, " "'', ''\n" "FROM pg_catalog.pg_class WHERE oid = '%s';", @@ -1765,7 +1765,7 @@ describeOneTableDetails(const char *schemaname, PGresult *result; printfPQExpBuffer(&buf, - "SELECT pg_catalog.pg_get_viewdef('%s'::pg_catalog.oid, true);", + "SELECT pg_catalog.pg_get_viewdef('%s'::pg_catalog.oid, true);", oid); result = PSQLexec(buf.data); if (!result) @@ -1870,12 +1870,12 @@ describeOneTableDetails(const char *schemaname, if (verbose) printfPQExpBuffer(&buf, "SELECT inhparent::pg_catalog.regclass," - " pg_get_expr(c.relpartbound, inhrelid)," - " pg_get_partition_constraintdef(inhrelid)" + " pg_get_expr(c.relpartbound, inhrelid)," + " pg_get_partition_constraintdef(inhrelid)" " FROM pg_catalog.pg_class c" " JOIN pg_catalog.pg_inherits" " ON c.oid = inhrelid" - " WHERE c.oid = '%s' AND c.relispartition;", oid); + " WHERE c.oid = '%s' AND c.relispartition;", oid); else printfPQExpBuffer(&buf, "SELECT inhparent::pg_catalog.regclass," @@ -1883,7 +1883,7 @@ describeOneTableDetails(const char *schemaname, " FROM pg_catalog.pg_class c" " JOIN pg_catalog.pg_inherits" " ON c.oid = inhrelid" - " WHERE c.oid = '%s' AND c.relispartition;", oid); + " WHERE c.oid = '%s' AND c.relispartition;", oid); result = PSQLexec(buf.data); if (!result) goto error_return; @@ -1918,7 +1918,7 @@ describeOneTableDetails(const char *schemaname, char *partkeydef; printfPQExpBuffer(&buf, - "SELECT pg_catalog.pg_get_partkeydef('%s'::pg_catalog.oid);", + "SELECT pg_catalog.pg_get_partkeydef('%s'::pg_catalog.oid);", oid); result = PSQLexec(buf.data); if (!result || PQntuples(result) != 1) @@ -1936,7 +1936,7 @@ describeOneTableDetails(const char *schemaname, PGresult *result; printfPQExpBuffer(&buf, - "SELECT i.indisunique, i.indisprimary, i.indisclustered, "); + "SELECT i.indisunique, i.indisprimary, i.indisclustered, "); if (pset.sversion >= 80200) appendPQExpBufferStr(&buf, "i.indisvalid,\n"); else @@ -1944,20 +1944,20 @@ describeOneTableDetails(const char *schemaname, if (pset.sversion >= 90000) appendPQExpBufferStr(&buf, " (NOT i.indimmediate) AND " - "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint " + "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint " "WHERE conrelid = i.indrelid AND " "conindid = i.indexrelid AND " "contype IN ('p','u','x') AND " "condeferrable) AS condeferrable,\n" " (NOT i.indimmediate) AND " - "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint " + "EXISTS (SELECT 1 FROM pg_catalog.pg_constraint " "WHERE conrelid = i.indrelid AND " "conindid = i.indexrelid AND " "contype IN ('p','u','x') AND " "condeferred) AS condeferred,\n"); else appendPQExpBufferStr(&buf, - " false AS condeferrable, false AS condeferred,\n"); + " false AS condeferrable, false AS condeferred,\n"); if (pset.sversion >= 90400) appendPQExpBuffer(&buf, "i.indisreplident,\n"); @@ -1965,9 +1965,9 @@ describeOneTableDetails(const char *schemaname, appendPQExpBuffer(&buf, "false AS indisreplident,\n"); appendPQExpBuffer(&buf, " a.amname, c2.relname, " - "pg_catalog.pg_get_expr(i.indpred, i.indrelid, true)\n" + "pg_catalog.pg_get_expr(i.indpred, i.indrelid, true)\n" "FROM pg_catalog.pg_index i, pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_am a\n" - "WHERE i.indexrelid = c.oid AND c.oid = '%s' AND c.relam = a.oid\n" + "WHERE i.indexrelid = c.oid AND c.oid = '%s' AND c.relam = a.oid\n" "AND i.indrelid = c2.oid;", oid); @@ -2040,13 +2040,13 @@ describeOneTableDetails(const char *schemaname, "\n pg_catalog.quote_ident(attname)," "\n d.deptype" "\nFROM pg_catalog.pg_class c" - "\nINNER JOIN pg_catalog.pg_depend d ON c.oid=d.refobjid" - "\nINNER JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace" + "\nINNER JOIN pg_catalog.pg_depend d ON c.oid=d.refobjid" + "\nINNER JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace" "\nINNER JOIN pg_catalog.pg_attribute a ON (" "\n a.attrelid=c.oid AND" "\n a.attnum=d.refobjsubid)" - "\nWHERE d.classid='pg_catalog.pg_class'::pg_catalog.regclass" - "\n AND d.refclassid='pg_catalog.pg_class'::pg_catalog.regclass" + "\nWHERE d.classid='pg_catalog.pg_class'::pg_catalog.regclass" + "\n AND d.refclassid='pg_catalog.pg_class'::pg_catalog.regclass" "\n AND d.objid=%s" "\n AND d.deptype IN ('a', 'i')", oid); @@ -2099,12 +2099,12 @@ describeOneTableDetails(const char *schemaname, appendPQExpBufferStr(&buf, "pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),\n "); if (pset.sversion >= 90000) appendPQExpBufferStr(&buf, - "pg_catalog.pg_get_constraintdef(con.oid, true), " + "pg_catalog.pg_get_constraintdef(con.oid, true), " "contype, condeferrable, condeferred"); else appendPQExpBufferStr(&buf, - "null AS constraintdef, null AS contype, " - "false AS condeferrable, false AS condeferred"); + "null AS constraintdef, null AS contype, " + "false AS condeferrable, false AS condeferred"); if (pset.sversion >= 90400) appendPQExpBufferStr(&buf, ", i.indisreplident"); else @@ -2118,7 +2118,7 @@ describeOneTableDetails(const char *schemaname, " LEFT JOIN pg_catalog.pg_constraint con ON (conrelid = i.indrelid AND conindid = i.indexrelid AND contype IN ('p','u','x'))\n"); appendPQExpBuffer(&buf, "WHERE c.oid = '%s' AND c.oid = i.indrelid AND i.indexrelid = c2.oid\n" - "ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname;", + "ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname;", oid); result = PSQLexec(buf.data); if (!result) @@ -2187,7 +2187,7 @@ describeOneTableDetails(const char *schemaname, /* Print tablespace of the index on the same line */ if (pset.sversion >= 80000) add_tablespace_footer(&cont, RELKIND_INDEX, - atooid(PQgetvalue(result, i, 11)), + atooid(PQgetvalue(result, i, 11)), false); } } @@ -2231,9 +2231,9 @@ describeOneTableDetails(const char *schemaname, { printfPQExpBuffer(&buf, "SELECT conname,\n" - " pg_catalog.pg_get_constraintdef(r.oid, true) as condef\n" + " pg_catalog.pg_get_constraintdef(r.oid, true) as condef\n" "FROM pg_catalog.pg_constraint r\n" - "WHERE r.conrelid = '%s' AND r.contype = 'f' ORDER BY 1;", + "WHERE r.conrelid = '%s' AND r.contype = 'f' ORDER BY 1;", oid); result = PSQLexec(buf.data); if (!result) @@ -2261,10 +2261,10 @@ describeOneTableDetails(const char *schemaname, if (tableinfo.hastriggers) { printfPQExpBuffer(&buf, - "SELECT conname, conrelid::pg_catalog.regclass,\n" - " pg_catalog.pg_get_constraintdef(c.oid, true) as condef\n" + "SELECT conname, conrelid::pg_catalog.regclass,\n" + " pg_catalog.pg_get_constraintdef(c.oid, true) as condef\n" "FROM pg_catalog.pg_constraint c\n" - "WHERE c.confrelid = '%s' AND c.contype = 'f' ORDER BY 1;", + "WHERE c.confrelid = '%s' AND c.contype = 'f' ORDER BY 1;", oid); result = PSQLexec(buf.data); if (!result) @@ -2295,8 +2295,8 @@ describeOneTableDetails(const char *schemaname, printfPQExpBuffer(&buf, "SELECT pol.polname, pol.polpermissive,\n" "CASE WHEN pol.polroles = '{0}' THEN NULL ELSE array_to_string(array(select rolname from pg_roles where oid = any (pol.polroles) order by 1),',') END,\n" - "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n" - "pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid),\n" + "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n" + "pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid),\n" "CASE pol.polcmd\n" "WHEN 'r' THEN 'SELECT'\n" "WHEN 'a' THEN 'INSERT'\n" @@ -2308,10 +2308,10 @@ describeOneTableDetails(const char *schemaname, oid); else printfPQExpBuffer(&buf, - "SELECT pol.polname, 't' as polpermissive,\n" + "SELECT pol.polname, 't' as polpermissive,\n" "CASE WHEN pol.polroles = '{0}' THEN NULL ELSE array_to_string(array(select rolname from pg_roles where oid = any (pol.polroles) order by 1),',') END,\n" - "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n" - "pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid),\n" + "pg_catalog.pg_get_expr(pol.polqual, pol.polrelid),\n" + "pg_catalog.pg_get_expr(pol.polwithcheck, pol.polrelid),\n" "CASE pol.polcmd\n" "WHEN 'r' THEN 'SELECT'\n" "WHEN 'a' THEN 'INSERT'\n" @@ -2392,7 +2392,7 @@ describeOneTableDetails(const char *schemaname, " (SELECT pg_catalog.string_agg(pg_catalog.quote_ident(attname),', ')\n" " FROM pg_catalog.unnest(stxkeys) s(attnum)\n" " JOIN pg_catalog.pg_attribute a ON (stxrelid = a.attrelid AND\n" - " a.attnum = s.attnum AND NOT attisdropped)) AS columns,\n" + " a.attnum = s.attnum AND NOT attisdropped)) AS columns,\n" " (stxkind @> '{d}') AS ndist_enabled,\n" " (stxkind @> '{f}') AS deps_enabled\n" "FROM pg_catalog.pg_statistic_ext stat " @@ -2542,12 +2542,16 @@ describeOneTableDetails(const char *schemaname, if (pset.sversion >= 100000) { printfPQExpBuffer(&buf, - "SELECT pub.pubname\n" - " FROM pg_catalog.pg_publication pub,\n" - " pg_catalog.pg_get_publication_tables(pub.pubname)\n" - "WHERE relid = '%s'\n" + "SELECT pubname\n" + "FROM pg_catalog.pg_publication p\n" + "JOIN pg_catalog.pg_publication_rel pr ON p.oid = pr.prpubid\n" + "WHERE pr.prrelid = '%s'\n" + "UNION ALL\n" + "SELECT pubname\n" + "FROM pg_catalog.pg_publication p\n" + "WHERE p.puballtables AND pg_relation_is_publishable('%s')\n" "ORDER BY 1;", - oid); + oid, oid); result = PSQLexec(buf.data); if (!result) @@ -2584,7 +2588,7 @@ describeOneTableDetails(const char *schemaname, printfPQExpBuffer(&buf, "SELECT r.rulename, trim(trailing ';' from pg_catalog.pg_get_ruledef(r.oid, true))\n" "FROM pg_catalog.pg_rewrite r\n" - "WHERE r.ev_class = '%s' AND r.rulename != '_RETURN' ORDER BY 1;", + "WHERE r.ev_class = '%s' AND r.rulename != '_RETURN' ORDER BY 1;", oid); result = PSQLexec(buf.data); if (!result) @@ -2769,7 +2773,7 @@ describeOneTableDetails(const char *schemaname, " array_to_string(ARRAY(SELECT " " quote_ident(option_name) || ' ' || " " quote_literal(option_value) FROM " - " pg_options_to_table(ftoptions)), ', ') " + " pg_options_to_table(ftoptions)), ', ') " "FROM pg_catalog.pg_foreign_table f,\n" " pg_catalog.pg_foreign_server s\n" "WHERE f.ftrelid = %s AND s.oid = f.ftserver;", @@ -2801,9 +2805,9 @@ describeOneTableDetails(const char *schemaname, /* print inherited tables (exclude, if parent is a partitioned table) */ printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass" - " FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i" + " FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i" " WHERE c.oid=i.inhparent AND i.inhrelid = '%s'" - " AND c.relkind != " CppAsString2(RELKIND_PARTITIONED_TABLE) + " AND c.relkind != " CppAsString2(RELKIND_PARTITIONED_TABLE) " ORDER BY inhseqno;", oid); result = PSQLexec(buf.data); @@ -2837,18 +2841,18 @@ describeOneTableDetails(const char *schemaname, if (pset.sversion >= 100000) printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass, pg_get_expr(c.relpartbound, c.oid)" - " FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i" + " FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i" " WHERE c.oid=i.inhrelid AND" " i.inhparent = '%s' AND" - " EXISTS (SELECT 1 FROM pg_class c WHERE c.oid = '%s')" + " EXISTS (SELECT 1 FROM pg_class c WHERE c.oid = '%s')" " ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;", oid, oid); else if (pset.sversion >= 80300) printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass" - " FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i" + " FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i" " WHERE c.oid=i.inhrelid AND" " i.inhparent = '%s' AND" - " EXISTS (SELECT 1 FROM pg_class c WHERE c.oid = '%s')" + " EXISTS (SELECT 1 FROM pg_class c WHERE c.oid = '%s')" " ORDER BY c.oid::pg_catalog.regclass::pg_catalog.text;", oid, oid); else printfPQExpBuffer(&buf, "SELECT c.oid::pg_catalog.regclass FROM pg_catalog.pg_class c, pg_catalog.pg_inherits i WHERE c.oid=i.inhrelid AND i.inhparent = '%s' ORDER BY c.relname;", oid); @@ -3127,7 +3131,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem) " r.rolconnlimit, r.rolvaliduntil,\n" " ARRAY(SELECT b.rolname\n" " FROM pg_catalog.pg_auth_members m\n" - " JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)\n" + " JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)\n" " WHERE m.member = r.oid) as memberof"); if (verbose && pset.sversion >= 80200) @@ -3159,7 +3163,7 @@ describeRoles(const char *pattern, bool verbose, bool showSystem) "SELECT u.usename AS rolname,\n" " u.usesuper AS rolsuper,\n" " true AS rolinherit, false AS rolcreaterole,\n" - " u.usecreatedb AS rolcreatedb, true AS rolcanlogin,\n" + " u.usecreatedb AS rolcreatedb, true AS rolcanlogin,\n" " -1 AS rolconnlimit," " u.valuntil as rolvaliduntil,\n" " ARRAY(SELECT g.groname FROM pg_catalog.pg_group g WHERE u.usesysid = ANY(g.grolist)) as memberof" @@ -3286,15 +3290,15 @@ listDbRoleSettings(const char *pattern, const char *pattern2) bool havewhere; printfPQExpBuffer(&buf, "SELECT rolname AS \"%s\", datname AS \"%s\",\n" - "pg_catalog.array_to_string(setconfig, E'\\n') AS \"%s\"\n" + "pg_catalog.array_to_string(setconfig, E'\\n') AS \"%s\"\n" "FROM pg_db_role_setting AS s\n" - "LEFT JOIN pg_database ON pg_database.oid = setdatabase\n" + "LEFT JOIN pg_database ON pg_database.oid = setdatabase\n" "LEFT JOIN pg_roles ON pg_roles.oid = setrole\n", gettext_noop("Role"), gettext_noop("Database"), gettext_noop("Settings")); havewhere = processSQLNamePattern(pset.db, &buf, pattern, false, false, - NULL, "pg_roles.rolname", NULL, NULL); + NULL, "pg_roles.rolname", NULL, NULL); processSQLNamePattern(pset.db, &buf, pattern2, havewhere, false, NULL, "pg_database.datname", NULL, NULL); appendPQExpBufferStr(&buf, "ORDER BY 1, 2;"); @@ -3302,7 +3306,7 @@ listDbRoleSettings(const char *pattern, const char *pattern2) else { fprintf(pset.queryFout, - _("No per-database role settings support in this server version.\n")); + _("No per-database role settings support in this server version.\n")); return false; } @@ -3345,7 +3349,6 @@ listDbRoleSettings(const char *pattern, const char *pattern2) * s - sequences * E - foreign table (Note: different from 'f', the relkind value) * (any order of the above is fine) - * If tabtypes is empty, we default to \dtvsE. */ bool listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSystem) @@ -3362,6 +3365,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys printQueryOpt myopt = pset.popt; static const bool translate_columns[] = {false, false, true, false, false, false, false}; + /* If tabtypes is empty, we default to \dtvmsE (but see also command.c) */ if (!(showTables || showIndexes || showViews || showMatViews || showSeq || showForeign)) showTables = showViews = showMatViews = showSeq = showForeign = true; @@ -3381,8 +3385,8 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys " WHEN " CppAsString2(RELKIND_INDEX) " THEN '%s'" " WHEN " CppAsString2(RELKIND_SEQUENCE) " THEN '%s'" " WHEN 's' THEN '%s'" - " WHEN " CppAsString2(RELKIND_FOREIGN_TABLE) " THEN '%s'" - " WHEN " CppAsString2(RELKIND_PARTITIONED_TABLE) " THEN '%s'" + " WHEN " CppAsString2(RELKIND_FOREIGN_TABLE) " THEN '%s'" + " WHEN " CppAsString2(RELKIND_PARTITIONED_TABLE) " THEN '%s'" " END as \"%s\",\n" " pg_catalog.pg_get_userbyid(c.relowner) as \"%s\"", gettext_noop("Schema"), @@ -3419,17 +3423,17 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys gettext_noop("Size")); appendPQExpBuffer(&buf, - ",\n pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"", + ",\n pg_catalog.obj_description(c.oid, 'pg_class') as \"%s\"", gettext_noop("Description")); } appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_class c" - "\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace"); + "\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace"); if (showIndexes) appendPQExpBufferStr(&buf, - "\n LEFT JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid" - "\n LEFT JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid"); + "\n LEFT JOIN pg_catalog.pg_index i ON i.indexrelid = c.oid" + "\n LEFT JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid"); appendPQExpBufferStr(&buf, "\nWHERE c.relkind IN ("); if (showTables) @@ -3444,7 +3448,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys if (showSeq) appendPQExpBufferStr(&buf, CppAsString2(RELKIND_SEQUENCE) ","); if (showSystem || pattern) - appendPQExpBufferStr(&buf, "'s',"); /* was RELKIND_SPECIAL */ + appendPQExpBufferStr(&buf, "'s',"); /* was RELKIND_SPECIAL */ if (showForeign) appendPQExpBufferStr(&buf, CppAsString2(RELKIND_FOREIGN_TABLE) ","); @@ -3517,7 +3521,7 @@ listLanguages(const char *pattern, bool verbose, bool showSystem) gettext_noop("Name")); if (pset.sversion >= 80300) appendPQExpBuffer(&buf, - " pg_catalog.pg_get_userbyid(l.lanowner) as \"%s\",\n", + " pg_catalog.pg_get_userbyid(l.lanowner) as \"%s\",\n", gettext_noop("Owner")); appendPQExpBuffer(&buf, @@ -3529,7 +3533,7 @@ listLanguages(const char *pattern, bool verbose, bool showSystem) appendPQExpBuffer(&buf, ",\n NOT l.lanispl AS \"%s\",\n" " l.lanplcallfoid::regprocedure AS \"%s\",\n" - " l.lanvalidator::regprocedure AS \"%s\",\n ", + " l.lanvalidator::regprocedure AS \"%s\",\n ", gettext_noop("Internal language"), gettext_noop("Call handler"), gettext_noop("Validator")); @@ -3590,7 +3594,7 @@ listDomains(const char *pattern, bool verbose, bool showSystem) printfPQExpBuffer(&buf, "SELECT n.nspname as \"%s\",\n" " t.typname as \"%s\",\n" - " pg_catalog.format_type(t.typbasetype, t.typtypmod) as \"%s\",\n", + " pg_catalog.format_type(t.typbasetype, t.typtypmod) as \"%s\",\n", gettext_noop("Schema"), gettext_noop("Name"), gettext_noop("Type")); @@ -3601,7 +3605,7 @@ listDomains(const char *pattern, bool verbose, bool showSystem) " WHERE c.oid = t.typcollation AND bt.oid = t.typbasetype AND t.typcollation <> bt.typcollation) as \"%s\",\n", gettext_noop("Collation")); appendPQExpBuffer(&buf, - " CASE WHEN t.typnotnull THEN 'not null' END as \"%s\",\n" + " CASE WHEN t.typnotnull THEN 'not null' END as \"%s\",\n" " t.typdefault as \"%s\",\n" " pg_catalog.array_to_string(ARRAY(\n" " SELECT pg_catalog.pg_get_constraintdef(r.oid, true) FROM pg_catalog.pg_constraint r WHERE t.oid = r.contypid\n" @@ -3624,12 +3628,12 @@ listDomains(const char *pattern, bool verbose, bool showSystem) appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_type t\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n"); + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n"); if (verbose) appendPQExpBufferStr(&buf, " LEFT JOIN pg_catalog.pg_description d " - "ON d.classoid = t.tableoid AND d.objoid = t.oid " + "ON d.classoid = t.tableoid AND d.objoid = t.oid " "AND d.objsubid = 0\n"); appendPQExpBufferStr(&buf, "WHERE t.typtype = 'd'\n"); @@ -3678,8 +3682,8 @@ listConversions(const char *pattern, bool verbose, bool showSystem) printfPQExpBuffer(&buf, "SELECT n.nspname AS \"%s\",\n" " c.conname AS \"%s\",\n" - " pg_catalog.pg_encoding_to_char(c.conforencoding) AS \"%s\",\n" - " pg_catalog.pg_encoding_to_char(c.contoencoding) AS \"%s\",\n" + " pg_catalog.pg_encoding_to_char(c.conforencoding) AS \"%s\",\n" + " pg_catalog.pg_encoding_to_char(c.contoencoding) AS \"%s\",\n" " CASE WHEN c.condefault THEN '%s'\n" " ELSE '%s' END AS \"%s\"", gettext_noop("Schema"), @@ -3761,7 +3765,7 @@ listEventTriggers(const char *pattern, bool verbose) " when 'D' then '%s' end as \"%s\",\n" " e.evtfoid::pg_catalog.regproc as \"%s\", " "pg_catalog.array_to_string(array(select x" - " from pg_catalog.unnest(evttags) as t(x)), ', ') as \"%s\"", + " from pg_catalog.unnest(evttags) as t(x)), ', ') as \"%s\"", gettext_noop("Name"), gettext_noop("Event"), gettext_noop("Owner"), @@ -3774,7 +3778,7 @@ listEventTriggers(const char *pattern, bool verbose) gettext_noop("Tags")); if (verbose) appendPQExpBuffer(&buf, - ",\npg_catalog.obj_description(e.oid, 'pg_event_trigger') as \"%s\"", + ",\npg_catalog.obj_description(e.oid, 'pg_event_trigger') as \"%s\"", gettext_noop("Description")); appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_event_trigger e "); @@ -3823,9 +3827,9 @@ listCasts(const char *pattern, bool verbose) * function name that happens to match some string in the PO database. */ printfPQExpBuffer(&buf, - "SELECT pg_catalog.format_type(castsource, NULL) AS \"%s\",\n" - " pg_catalog.format_type(casttarget, NULL) AS \"%s\",\n" - " CASE WHEN castfunc = 0 THEN '(binary coercible)'\n" + "SELECT pg_catalog.format_type(castsource, NULL) AS \"%s\",\n" + " pg_catalog.format_type(casttarget, NULL) AS \"%s\",\n" + " CASE WHEN castfunc = 0 THEN '(binary coercible)'\n" " ELSE p.proname\n" " END as \"%s\",\n" " CASE WHEN c.castcontext = 'e' THEN '%s'\n" @@ -3846,7 +3850,7 @@ listCasts(const char *pattern, bool verbose) gettext_noop("Description")); appendPQExpBufferStr(&buf, - "FROM pg_catalog.pg_cast c LEFT JOIN pg_catalog.pg_proc p\n" + "FROM pg_catalog.pg_cast c LEFT JOIN pg_catalog.pg_proc p\n" " ON c.castfunc = p.oid\n" " LEFT JOIN pg_catalog.pg_type ts\n" " ON c.castsource = ts.oid\n" @@ -3946,7 +3950,7 @@ listCollations(const char *pattern, bool verbose, bool showSystem) gettext_noop("Description")); appendPQExpBufferStr(&buf, - "\nFROM pg_catalog.pg_collation c, pg_catalog.pg_namespace n\n" + "\nFROM pg_catalog.pg_collation c, pg_catalog.pg_namespace n\n" "WHERE n.oid = c.collnamespace\n"); if (!showSystem && !pattern) @@ -4008,7 +4012,7 @@ listSchemas(const char *pattern, bool verbose, bool showSystem) appendPQExpBufferStr(&buf, ",\n "); printACLColumn(&buf, "n.nspacl"); appendPQExpBuffer(&buf, - ",\n pg_catalog.obj_description(n.oid, 'pg_namespace') AS \"%s\"", + ",\n pg_catalog.obj_description(n.oid, 'pg_namespace') AS \"%s\"", gettext_noop("Description")); } @@ -4017,7 +4021,7 @@ listSchemas(const char *pattern, bool verbose, bool showSystem) if (!showSystem && !pattern) appendPQExpBufferStr(&buf, - "WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema'\n"); + "WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema'\n"); processSQLNamePattern(pset.db, &buf, pattern, !showSystem && !pattern, false, @@ -4072,9 +4076,9 @@ listTSParsers(const char *pattern, bool verbose) "SELECT\n" " n.nspname as \"%s\",\n" " p.prsname as \"%s\",\n" - " pg_catalog.obj_description(p.oid, 'pg_ts_parser') as \"%s\"\n" + " pg_catalog.obj_description(p.oid, 'pg_ts_parser') as \"%s\"\n" "FROM pg_catalog.pg_ts_parser p\n" - "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.prsnamespace\n", + "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.prsnamespace\n", gettext_noop("Schema"), gettext_noop("Name"), gettext_noop("Description") @@ -4118,7 +4122,7 @@ listTSParsersVerbose(const char *pattern) " n.nspname,\n" " p.prsname\n" "FROM pg_catalog.pg_ts_parser p\n" - "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.prsnamespace\n" + "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.prsnamespace\n" ); processSQLNamePattern(pset.db, &buf, pattern, false, false, @@ -4183,7 +4187,7 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname) printfPQExpBuffer(&buf, "SELECT '%s' AS \"%s\",\n" " p.prsstart::pg_catalog.regproc AS \"%s\",\n" - " pg_catalog.obj_description(p.prsstart, 'pg_proc') as \"%s\"\n" + " pg_catalog.obj_description(p.prsstart, 'pg_proc') as \"%s\"\n" " FROM pg_catalog.pg_ts_parser p\n" " WHERE p.oid = '%s'\n" "UNION ALL\n" @@ -4201,13 +4205,13 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname) "UNION ALL\n" "SELECT '%s',\n" " p.prsheadline::pg_catalog.regproc,\n" - " pg_catalog.obj_description(p.prsheadline, 'pg_proc')\n" + " pg_catalog.obj_description(p.prsheadline, 'pg_proc')\n" " FROM pg_catalog.pg_ts_parser p\n" " WHERE p.oid = '%s'\n" "UNION ALL\n" "SELECT '%s',\n" " p.prslextype::pg_catalog.regproc,\n" - " pg_catalog.obj_description(p.prslextype, 'pg_proc')\n" + " pg_catalog.obj_description(p.prslextype, 'pg_proc')\n" " FROM pg_catalog.pg_ts_parser p\n" " WHERE p.oid = '%s';", gettext_noop("Start parse"), @@ -4250,7 +4254,7 @@ describeOneTSParser(const char *oid, const char *nspname, const char *prsname) printfPQExpBuffer(&buf, "SELECT t.alias as \"%s\",\n" " t.description as \"%s\"\n" - "FROM pg_catalog.ts_token_type( '%s'::pg_catalog.oid ) as t\n" + "FROM pg_catalog.ts_token_type( '%s'::pg_catalog.oid ) as t\n" "ORDER BY 1;", gettext_noop("Token name"), gettext_noop("Description"), @@ -4323,11 +4327,11 @@ listTSDictionaries(const char *pattern, bool verbose) } appendPQExpBuffer(&buf, - " pg_catalog.obj_description(d.oid, 'pg_ts_dict') as \"%s\"\n", + " pg_catalog.obj_description(d.oid, 'pg_ts_dict') as \"%s\"\n", gettext_noop("Description")); appendPQExpBufferStr(&buf, "FROM pg_catalog.pg_ts_dict d\n" - "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = d.dictnamespace\n"); + "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = d.dictnamespace\n"); processSQLNamePattern(pset.db, &buf, pattern, false, false, "n.nspname", "d.dictname", NULL, @@ -4381,7 +4385,7 @@ listTSTemplates(const char *pattern, bool verbose) " t.tmplname AS \"%s\",\n" " t.tmplinit::pg_catalog.regproc AS \"%s\",\n" " t.tmpllexize::pg_catalog.regproc AS \"%s\",\n" - " pg_catalog.obj_description(t.oid, 'pg_ts_template') AS \"%s\"\n", + " pg_catalog.obj_description(t.oid, 'pg_ts_template') AS \"%s\"\n", gettext_noop("Schema"), gettext_noop("Name"), gettext_noop("Init"), @@ -4392,13 +4396,13 @@ listTSTemplates(const char *pattern, bool verbose) "SELECT\n" " n.nspname AS \"%s\",\n" " t.tmplname AS \"%s\",\n" - " pg_catalog.obj_description(t.oid, 'pg_ts_template') AS \"%s\"\n", + " pg_catalog.obj_description(t.oid, 'pg_ts_template') AS \"%s\"\n", gettext_noop("Schema"), gettext_noop("Name"), gettext_noop("Description")); appendPQExpBufferStr(&buf, "FROM pg_catalog.pg_ts_template t\n" - "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.tmplnamespace\n"); + "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.tmplnamespace\n"); processSQLNamePattern(pset.db, &buf, pattern, false, false, "n.nspname", "t.tmplname", NULL, @@ -4452,9 +4456,9 @@ listTSConfigs(const char *pattern, bool verbose) "SELECT\n" " n.nspname as \"%s\",\n" " c.cfgname as \"%s\",\n" - " pg_catalog.obj_description(c.oid, 'pg_ts_config') as \"%s\"\n" + " pg_catalog.obj_description(c.oid, 'pg_ts_config') as \"%s\"\n" "FROM pg_catalog.pg_ts_config c\n" - "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.cfgnamespace\n", + "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.cfgnamespace\n", gettext_noop("Schema"), gettext_noop("Name"), gettext_noop("Description") @@ -4496,9 +4500,9 @@ listTSConfigsVerbose(const char *pattern) " p.prsname,\n" " np.nspname as pnspname\n" "FROM pg_catalog.pg_ts_config c\n" - " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.cfgnamespace,\n" + " LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.cfgnamespace,\n" " pg_catalog.pg_ts_parser p\n" - " LEFT JOIN pg_catalog.pg_namespace np ON np.oid = p.prsnamespace\n" + " LEFT JOIN pg_catalog.pg_namespace np ON np.oid = p.prsnamespace\n" "WHERE p.oid = c.cfgparser\n" ); @@ -4572,13 +4576,13 @@ describeOneTSConfig(const char *oid, const char *nspname, const char *cfgname, " pg_catalog.ts_token_type(c.cfgparser) AS t\n" " WHERE t.tokid = m.maptokentype ) AS \"%s\",\n" " pg_catalog.btrim(\n" - " ARRAY( SELECT mm.mapdict::pg_catalog.regdictionary\n" + " ARRAY( SELECT mm.mapdict::pg_catalog.regdictionary\n" " FROM pg_catalog.pg_ts_config_map AS mm\n" " WHERE mm.mapcfg = m.mapcfg AND mm.maptokentype = m.maptokentype\n" " ORDER BY mapcfg, maptokentype, mapseqno\n" " ) :: pg_catalog.text,\n" " '{}') AS \"%s\"\n" - "FROM pg_catalog.pg_ts_config AS c, pg_catalog.pg_ts_config_map AS m\n" + "FROM pg_catalog.pg_ts_config AS c, pg_catalog.pg_ts_config_map AS m\n" "WHERE c.oid = '%s' AND m.mapcfg = c.oid\n" "GROUP BY m.mapcfg, m.maptokentype, c.cfgparser\n" "ORDER BY 1;", @@ -4647,7 +4651,7 @@ listForeignDataWrappers(const char *pattern, bool verbose) initPQExpBuffer(&buf); printfPQExpBuffer(&buf, "SELECT fdw.fdwname AS \"%s\",\n" - " pg_catalog.pg_get_userbyid(fdw.fdwowner) AS \"%s\",\n", + " pg_catalog.pg_get_userbyid(fdw.fdwowner) AS \"%s\",\n", gettext_noop("Name"), gettext_noop("Owner")); if (pset.sversion >= 90100) @@ -4759,12 +4763,12 @@ listForeignServers(const char *pattern, bool verbose) appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_foreign_server s\n" - " JOIN pg_catalog.pg_foreign_data_wrapper f ON f.oid=s.srvfdw\n"); + " JOIN pg_catalog.pg_foreign_data_wrapper f ON f.oid=s.srvfdw\n"); if (verbose) appendPQExpBufferStr(&buf, "LEFT JOIN pg_description d\n " - "ON d.classoid = s.tableoid AND d.objoid = s.oid " + "ON d.classoid = s.tableoid AND d.objoid = s.oid " "AND d.objsubid = 0\n"); processSQLNamePattern(pset.db, &buf, pattern, false, false, @@ -4951,11 +4955,11 @@ listExtensions(const char *pattern) initPQExpBuffer(&buf); printfPQExpBuffer(&buf, "SELECT e.extname AS \"%s\", " - "e.extversion AS \"%s\", n.nspname AS \"%s\", c.description AS \"%s\"\n" + "e.extversion AS \"%s\", n.nspname AS \"%s\", c.description AS \"%s\"\n" "FROM pg_catalog.pg_extension e " - "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = e.extnamespace " - "LEFT JOIN pg_catalog.pg_description c ON c.objoid = e.oid " - "AND c.classoid = 'pg_catalog.pg_extension'::pg_catalog.regclass\n", + "LEFT JOIN pg_catalog.pg_namespace n ON n.oid = e.extnamespace " + "LEFT JOIN pg_catalog.pg_description c ON c.objoid = e.oid " + "AND c.classoid = 'pg_catalog.pg_extension'::pg_catalog.regclass\n", gettext_noop("Name"), gettext_noop("Version"), gettext_noop("Schema"), @@ -5070,7 +5074,7 @@ listOneExtensionContents(const char *extname, const char *oid) initPQExpBuffer(&buf); printfPQExpBuffer(&buf, - "SELECT pg_catalog.pg_describe_object(classid, objid, 0) AS \"%s\"\n" + "SELECT pg_catalog.pg_describe_object(classid, objid, 0) AS \"%s\"\n" "FROM pg_catalog.pg_depend\n" "WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass AND refobjid = '%s' AND deptype = 'e'\n" "ORDER BY 1;", @@ -5104,7 +5108,7 @@ listPublications(const char *pattern) PQExpBufferData buf; PGresult *res; printQueryOpt myopt = pset.popt; - static const bool translate_columns[] = {false, false, false, false, false}; + static const bool translate_columns[] = {false, false, false, false, false, false}; if (pset.sversion < 100000) { @@ -5121,11 +5125,13 @@ listPublications(const char *pattern) printfPQExpBuffer(&buf, "SELECT pubname AS \"%s\",\n" " pg_catalog.pg_get_userbyid(pubowner) AS \"%s\",\n" + " puballtables AS \"%s\",\n" " pubinsert AS \"%s\",\n" " pubupdate AS \"%s\",\n" " pubdelete AS \"%s\"\n", gettext_noop("Name"), gettext_noop("Owner"), + gettext_noop("All tables"), gettext_noop("Inserts"), gettext_noop("Updates"), gettext_noop("Deletes")); @@ -5202,7 +5208,7 @@ describePublications(const char *pattern) for (i = 0; i < PQntuples(res); i++) { const char align = 'l'; - int ncols = 3; + int ncols = 4; int nrows = 1; int tables = 0; PGresult *tabres; @@ -5218,25 +5224,18 @@ describePublications(const char *pattern) printfPQExpBuffer(&title, _("Publication %s"), pubname); printTableInit(&cont, &myopt, title.data, ncols, nrows); + printTableAddHeader(&cont, gettext_noop("All tables"), true, align); printTableAddHeader(&cont, gettext_noop("Inserts"), true, align); printTableAddHeader(&cont, gettext_noop("Updates"), true, align); printTableAddHeader(&cont, gettext_noop("Deletes"), true, align); + printTableAddCell(&cont, PQgetvalue(res, i, 2), false, false); printTableAddCell(&cont, PQgetvalue(res, i, 3), false, false); printTableAddCell(&cont, PQgetvalue(res, i, 4), false, false); printTableAddCell(&cont, PQgetvalue(res, i, 5), false, false); - if (puballtables) - printfPQExpBuffer(&buf, - "SELECT n.nspname, c.relname\n" - "FROM pg_catalog.pg_class c,\n" - " pg_catalog.pg_namespace n\n" - "WHERE c.relnamespace = n.oid\n" - " AND c.relkind = " CppAsString2(RELKIND_RELATION) "\n" - " AND n.nspname <> 'pg_catalog'\n" - " AND n.nspname <> 'information_schema'\n" - "ORDER BY 1,2"); - else + if (!puballtables) + { printfPQExpBuffer(&buf, "SELECT n.nspname, c.relname\n" "FROM pg_catalog.pg_class c,\n" @@ -5247,30 +5246,31 @@ describePublications(const char *pattern) " AND pr.prpubid = '%s'\n" "ORDER BY 1,2", pubid); - tabres = PSQLexec(buf.data); - if (!tabres) - { - printTableCleanup(&cont); - PQclear(res); - termPQExpBuffer(&buf); - termPQExpBuffer(&title); - return false; - } - else - tables = PQntuples(tabres); + tabres = PSQLexec(buf.data); + if (!tabres) + { + printTableCleanup(&cont); + PQclear(res); + termPQExpBuffer(&buf); + termPQExpBuffer(&title); + return false; + } + else + tables = PQntuples(tabres); - if (tables > 0) - printTableAddFooter(&cont, _("Tables:")); + if (tables > 0) + printTableAddFooter(&cont, _("Tables:")); - for (j = 0; j < tables; j++) - { - printfPQExpBuffer(&buf, " \"%s.%s\"", - PQgetvalue(tabres, j, 0), - PQgetvalue(tabres, j, 1)); + for (j = 0; j < tables; j++) + { + printfPQExpBuffer(&buf, " \"%s.%s\"", + PQgetvalue(tabres, j, 0), + PQgetvalue(tabres, j, 1)); - printTableAddFooter(&cont, buf.data); + printTableAddFooter(&cont, buf.data); + } + PQclear(tabres); } - PQclear(tabres); printTable(&cont, pset.queryFout, false, pset.logfile); printTableCleanup(&cont); @@ -5334,7 +5334,7 @@ describeSubscriptions(const char *pattern, bool verbose) "FROM pg_catalog.pg_subscription\n" "WHERE subdbid = (SELECT oid\n" " FROM pg_catalog.pg_database\n" - " WHERE datname = current_database())"); + " WHERE datname = current_database())"); processSQLNamePattern(pset.db, &buf, pattern, true, false, NULL, "subname", NULL, diff --git a/src/bin/psql/describe.h b/src/bin/psql/describe.h index b05d6bb976..14a5667f3e 100644 --- a/src/bin/psql/describe.h +++ b/src/bin/psql/describe.h @@ -111,4 +111,4 @@ bool describePublications(const char *pattern); /* \dRs */ bool describeSubscriptions(const char *pattern, bool verbose); -#endif /* DESCRIBE_H */ +#endif /* DESCRIBE_H */ diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index f097b06594..8e08da79e9 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -84,8 +84,8 @@ usage(unsigned short int pager) fprintf(output, _(" -f, --file=FILENAME execute commands from file, then exit\n")); fprintf(output, _(" -l, --list list available databases, then exit\n")); fprintf(output, _(" -v, --set=, --variable=NAME=VALUE\n" - " set psql variable NAME to VALUE\n" - " (e.g., -v ON_ERROR_STOP=1)\n")); + " set psql variable NAME to VALUE\n" + " (e.g., -v ON_ERROR_STOP=1)\n")); fprintf(output, _(" -V, --version output version information, then exit\n")); fprintf(output, _(" -X, --no-psqlrc do not read startup file (~/.psqlrc)\n")); fprintf(output, _(" -1 (\"one\"), --single-transaction\n" @@ -278,7 +278,7 @@ slashUsage(unsigned short int pager) ON(pset.popt.topt.tuples_only)); fprintf(output, _(" \\T [STRING] set HTML <table> tag attributes, or unset if none\n")); fprintf(output, _(" \\x [on|off|auto] toggle expanded output (currently %s)\n"), - pset.popt.topt.expanded == 2 ? "auto" : ON(pset.popt.topt.expanded)); + pset.popt.topt.expanded == 2 ? "auto" : ON(pset.popt.topt.expanded)); fprintf(output, "\n"); fprintf(output, _("Connection\n")); @@ -344,7 +344,7 @@ helpVariables(unsigned short int pager) fprintf(output, _(" AUTOCOMMIT if set, successful SQL commands are automatically committed\n")); fprintf(output, _(" COMP_KEYWORD_CASE determines the case used to complete SQL key words\n" - " [lower, upper, preserve-lower, preserve-upper]\n")); + " [lower, upper, preserve-lower, preserve-upper]\n")); fprintf(output, _(" DBNAME the currently connected database name\n")); fprintf(output, _(" ECHO controls what input is written to standard output\n" " [all, errors, none, queries]\n")); @@ -515,7 +515,7 @@ helpSQL(const char *topic, unsigned short int pager) while (topic[j] != ' ' && j++ <= len) wordlen++; } - if (wordlen >= len) /* Don't try again if the same word */ + if (wordlen >= len) /* Don't try again if the same word */ { if (!output) output = PageOutput(nl_count, pager ? &(pset.popt.topt) : NULL); @@ -583,19 +583,19 @@ print_copyright(void) "(formerly known as Postgres, then as Postgres95)\n\n" "Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group\n\n" "Portions Copyright (c) 1994, The Regents of the University of California\n\n" - "Permission to use, copy, modify, and distribute this software and its\n" + "Permission to use, copy, modify, and distribute this software and its\n" "documentation for any purpose, without fee, and without a written agreement\n" - "is hereby granted, provided that the above copyright notice and this\n" - "paragraph and the following two paragraphs appear in all copies.\n\n" + "is hereby granted, provided that the above copyright notice and this\n" + "paragraph and the following two paragraphs appear in all copies.\n\n" "IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR\n" "DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING\n" "LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS\n" "DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE\n" "POSSIBILITY OF SUCH DAMAGE.\n\n" - "THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\n" + "THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\n" "INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\n" "AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\n" "ON AN \"AS IS\" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO\n" - "PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\n" + "PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\n" ); } diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index b8c9a00b09..62f5f77383 100644 --- a/src/bin/psql/input.c +++ b/src/bin/psql/input.c @@ -333,7 +333,7 @@ decode_history(void) } END_ITERATE_HISTORY(); } -#endif /* USE_READLINE */ +#endif /* USE_READLINE */ /* diff --git a/src/bin/psql/input.h b/src/bin/psql/input.h index f40561459d..35886dae22 100644 --- a/src/bin/psql/input.h +++ b/src/bin/psql/input.h @@ -32,8 +32,8 @@ #if defined(HAVE_HISTORY_H) #include <history.h> #endif -#endif /* HAVE_READLINE_READLINE_H, etc */ -#endif /* HAVE_LIBREADLINE */ +#endif /* HAVE_READLINE_READLINE_H, etc */ +#endif /* HAVE_LIBREADLINE */ #include "pqexpbuffer.h" @@ -48,4 +48,4 @@ extern bool printHistory(const char *fname, unsigned short int pager); extern void pg_append_history(const char *s, PQExpBuffer history_buf); extern void pg_send_history(PQExpBuffer history_buf); -#endif /* INPUT_H */ +#endif /* INPUT_H */ diff --git a/src/bin/psql/large_obj.c b/src/bin/psql/large_obj.c index 2ad0a4bb83..2a3416b369 100644 --- a/src/bin/psql/large_obj.c +++ b/src/bin/psql/large_obj.c @@ -281,7 +281,7 @@ do_lo_list(void) snprintf(buf, sizeof(buf), "SELECT oid as \"%s\",\n" " pg_catalog.pg_get_userbyid(lomowner) as \"%s\",\n" - " pg_catalog.obj_description(oid, 'pg_largeobject') as \"%s\"\n" + " pg_catalog.obj_description(oid, 'pg_largeobject') as \"%s\"\n" " FROM pg_catalog.pg_largeobject_metadata " " ORDER BY oid", gettext_noop("ID"), @@ -292,8 +292,8 @@ do_lo_list(void) { snprintf(buf, sizeof(buf), "SELECT loid as \"%s\",\n" - " pg_catalog.obj_description(loid, 'pg_largeobject') as \"%s\"\n" - "FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) x\n" + " pg_catalog.obj_description(loid, 'pg_largeobject') as \"%s\"\n" + "FROM (SELECT DISTINCT loid FROM pg_catalog.pg_largeobject) x\n" "ORDER BY 1", gettext_noop("ID"), gettext_noop("Description")); diff --git a/src/bin/psql/large_obj.h b/src/bin/psql/large_obj.h index 7d74d5fdb7..5750b5d9cc 100644 --- a/src/bin/psql/large_obj.h +++ b/src/bin/psql/large_obj.h @@ -13,4 +13,4 @@ bool do_lo_import(const char *filename_arg, const char *comment_arg); bool do_lo_unlink(const char *loid_arg); bool do_lo_list(void); -#endif /* LARGE_OBJ_H */ +#endif /* LARGE_OBJ_H */ diff --git a/src/bin/psql/mainloop.c b/src/bin/psql/mainloop.c index 2bc2f43b4e..0162ee8d2f 100644 --- a/src/bin/psql/mainloop.c +++ b/src/bin/psql/mainloop.c @@ -36,7 +36,7 @@ MainLoop(FILE *source) { PsqlScanState scan_state; /* lexer working state */ ConditionalStack cond_stack; /* \if status stack */ - volatile PQExpBuffer query_buf; /* buffer for query being accumulated */ + volatile PQExpBuffer query_buf; /* buffer for query being accumulated */ volatile PQExpBuffer previous_buf; /* if there isn't anything in the new * buffer yet, use this one for \e, * etc. */ @@ -226,7 +226,7 @@ MainLoop(FILE *source) printf(_("Type: \\copyright for distribution terms\n" " \\h for help with SQL commands\n" " \\? for help with psql commands\n" - " \\g or terminate with semicolon to execute query\n" + " \\g or terminate with semicolon to execute query\n" " \\q to quit\n")); fflush(stdout); @@ -517,4 +517,4 @@ MainLoop(FILE *source) pset.lineno = prev_lineno; return successResult; -} /* MainLoop() */ +} /* MainLoop() */ diff --git a/src/bin/psql/mainloop.h b/src/bin/psql/mainloop.h index 228a5e085e..8ef8cc1bd6 100644 --- a/src/bin/psql/mainloop.h +++ b/src/bin/psql/mainloop.h @@ -14,4 +14,4 @@ extern const PsqlScanCallbacks psqlscan_callbacks; extern int MainLoop(FILE *source); -#endif /* MAINLOOP_H */ +#endif /* MAINLOOP_H */ diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c index e502ff3f6e..913b23e4cd 100644 --- a/src/bin/psql/prompt.c +++ b/src/bin/psql/prompt.c @@ -310,7 +310,7 @@ get_prompt(promptStatus_t status, ConditionalStack cstack) */ buf[0] = (*p == '[') ? RL_PROMPT_START_IGNORE : RL_PROMPT_END_IGNORE; buf[1] = '\0'; -#endif /* USE_READLINE */ +#endif /* USE_READLINE */ break; default: diff --git a/src/bin/psql/prompt.h b/src/bin/psql/prompt.h index b3d2d98fd7..a7a95effb4 100644 --- a/src/bin/psql/prompt.h +++ b/src/bin/psql/prompt.h @@ -14,4 +14,4 @@ char *get_prompt(promptStatus_t status, ConditionalStack cstack); -#endif /* PROMPT_H */ +#endif /* PROMPT_H */ diff --git a/src/bin/psql/settings.h b/src/bin/psql/settings.h index 70ff1812c8..b78f151acd 100644 --- a/src/bin/psql/settings.h +++ b/src/bin/psql/settings.h @@ -86,7 +86,7 @@ typedef struct _psqlSettings FILE *copyStream; /* Stream to read/write for \copy command */ - PGresult *last_error_result; /* most recent error result, if any */ + PGresult *last_error_result; /* most recent error result, if any */ printQueryOpt popt; diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index 7e78c95546..2dac26b2ba 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -12,7 +12,7 @@ #else /* WIN32 */ #include <io.h> #include <win32.h> -#endif /* WIN32 */ +#endif /* WIN32 */ #include "getopt_long.h" @@ -79,7 +79,7 @@ struct adhoc_opts }; static void parse_psql_options(int argc, char *argv[], - struct adhoc_opts * options); + struct adhoc_opts *options); static void simple_action_list_append(SimpleActionList *list, enum _actions action, const char *val); static void process_psqlrc(char *argv0); @@ -411,7 +411,7 @@ error: */ static void -parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) +parse_psql_options(int argc, char *argv[], struct adhoc_opts *options) { static struct option long_options[] = { diff --git a/src/bin/psql/stringutils.c b/src/bin/psql/stringutils.c index 145069ae13..959381d085 100644 --- a/src/bin/psql/stringutils.c +++ b/src/bin/psql/stringutils.c @@ -58,8 +58,8 @@ strtokx(const char *s, bool del_quotes, int encoding) { - static char *storage = NULL;/* store the local copy of the users string - * here */ + static char *storage = NULL; /* store the local copy of the users + * string here */ static char *string = NULL; /* pointer into storage where to continue on * next call */ diff --git a/src/bin/psql/stringutils.h b/src/bin/psql/stringutils.h index 360ee030a1..213473f919 100644 --- a/src/bin/psql/stringutils.h +++ b/src/bin/psql/stringutils.h @@ -24,4 +24,4 @@ extern void strip_quotes(char *source, char quote, char escape, int encoding); extern char *quote_if_needed(const char *source, const char *entails_quote, char quote, char escape, int encoding); -#endif /* STRINGUTILS_H */ +#endif /* STRINGUTILS_H */ diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index e1f33175e2..f1e1920c69 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -130,9 +130,9 @@ static int completion_max_records; * the completion callback functions. Ugly but there is no better way. */ static const char *completion_charp; /* to pass a string */ -static const char *const * completion_charpp; /* to pass a list of strings */ -static const char *completion_info_charp; /* to pass a second string */ -static const char *completion_info_charp2; /* to pass a third string */ +static const char *const *completion_charpp; /* to pass a list of strings */ +static const char *completion_info_charp; /* to pass a second string */ +static const char *completion_info_charp2; /* to pass a third string */ static const SchemaQuery *completion_squery; /* to pass a SchemaQuery */ static bool completion_case_sensitive; /* completion is case sensitive */ @@ -1030,8 +1030,8 @@ static const pgsql_thing_t words_after_create[] = { {"CONFIGURATION", Query_for_list_of_ts_configurations, NULL, THING_NO_SHOW}, {"CONVERSION", "SELECT pg_catalog.quote_ident(conname) FROM pg_catalog.pg_conversion WHERE substring(pg_catalog.quote_ident(conname),1,%d)='%s'"}, {"DATABASE", Query_for_list_of_databases}, - {"DICTIONARY", Query_for_list_of_ts_dictionaries, NULL, THING_NO_SHOW}, {"DEFAULT PRIVILEGES", NULL, NULL, THING_NO_CREATE | THING_NO_DROP}, + {"DICTIONARY", Query_for_list_of_ts_dictionaries, NULL, THING_NO_SHOW}, {"DOMAIN", NULL, &Query_for_list_of_domains}, {"EVENT TRIGGER", NULL, NULL}, {"EXTENSION", Query_for_list_of_extensions}, @@ -1059,8 +1059,8 @@ static const pgsql_thing_t words_after_create[] = { {"SYSTEM", NULL, NULL, THING_NO_CREATE | THING_NO_DROP}, {"TABLE", NULL, &Query_for_list_of_tables}, {"TABLESPACE", Query_for_list_of_tablespaces}, - {"TEMP", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE TEMP TABLE - * ... */ + {"TEMP", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE TEMP TABLE + * ... */ {"TEMPLATE", Query_for_list_of_ts_templates, NULL, THING_NO_SHOW}, {"TEMPORARY", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE TEMPORARY * TABLE ... */ @@ -1068,8 +1068,8 @@ static const pgsql_thing_t words_after_create[] = { {"TRANSFORM", NULL, NULL}, {"TRIGGER", "SELECT pg_catalog.quote_ident(tgname) FROM pg_catalog.pg_trigger WHERE substring(pg_catalog.quote_ident(tgname),1,%d)='%s' AND NOT tgisinternal"}, {"TYPE", NULL, &Query_for_list_of_datatypes}, - {"UNIQUE", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE UNIQUE - * INDEX ... */ + {"UNIQUE", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE UNIQUE + * INDEX ... */ {"UNLOGGED", NULL, NULL, THING_NO_DROP | THING_NO_ALTER}, /* for CREATE UNLOGGED * TABLE ... */ {"USER", Query_for_list_of_roles}, @@ -1093,7 +1093,7 @@ static void append_variable_names(char ***varnames, int *nvars, int *maxvars, const char *varname, const char *prefix, const char *suffix); static char **complete_from_variables(const char *text, - const char *prefix, const char *suffix, bool need_value); + const char *prefix, const char *suffix, bool need_value); static char *complete_from_files(const char *text, int state); static char *pg_strdup_keyword_case(const char *s, const char *ref); @@ -1995,11 +1995,11 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH_LIST5("(", "DEFAULT", "NOT NULL", "STATISTICS", "STORAGE"); /* ALTER TABLE ALTER [COLUMN] <foo> SET ( */ else if (Matches8("ALTER", "TABLE", MatchAny, "ALTER", "COLUMN", MatchAny, "SET", "(") || - Matches7("ALTER", "TABLE", MatchAny, "ALTER", MatchAny, "SET", "(")) + Matches7("ALTER", "TABLE", MatchAny, "ALTER", MatchAny, "SET", "(")) COMPLETE_WITH_LIST2("n_distinct", "n_distinct_inherited"); /* ALTER TABLE ALTER [COLUMN] <foo> SET STORAGE */ else if (Matches8("ALTER", "TABLE", MatchAny, "ALTER", "COLUMN", MatchAny, "SET", "STORAGE") || - Matches7("ALTER", "TABLE", MatchAny, "ALTER", MatchAny, "SET", "STORAGE")) + Matches7("ALTER", "TABLE", MatchAny, "ALTER", MatchAny, "SET", "STORAGE")) COMPLETE_WITH_LIST4("PLAIN", "EXTERNAL", "EXTENDED", "MAIN"); /* ALTER TABLE ALTER [COLUMN] <foo> DROP */ else if (Matches7("ALTER", "TABLE", MatchAny, "ALTER", "COLUMN", MatchAny, "DROP") || @@ -2257,7 +2257,7 @@ psql_completion(const char *text, int start, int end) else if (Matches4("COMMENT", "ON", "EVENT", "TRIGGER")) COMPLETE_WITH_QUERY(Query_for_list_of_event_triggers); else if (Matches4("COMMENT", "ON", MatchAny, MatchAnyExcept("IS")) || - Matches5("COMMENT", "ON", MatchAny, MatchAny, MatchAnyExcept("IS")) || + Matches5("COMMENT", "ON", MatchAny, MatchAny, MatchAnyExcept("IS")) || Matches6("COMMENT", "ON", MatchAny, MatchAny, MatchAny, MatchAnyExcept("IS"))) COMPLETE_WITH_CONST("IS"); @@ -2525,7 +2525,7 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH_LIST8("INCREMENT BY", "MINVALUE", "MAXVALUE", "NO", "CACHE", "CYCLE", "OWNED BY", "START WITH"); else if (TailMatches4("CREATE", "SEQUENCE", MatchAny, "NO") || - TailMatches5("CREATE", "TEMP|TEMPORARY", "SEQUENCE", MatchAny, "NO")) + TailMatches5("CREATE", "TEMP|TEMPORARY", "SEQUENCE", MatchAny, "NO")) COMPLETE_WITH_LIST3("MINVALUE", "MAXVALUE", "CYCLE"); /* CREATE SERVER <name> */ @@ -2604,7 +2604,7 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH_LIST3("INSERT", "DELETE", "UPDATE"); /* complete CREATE TRIGGER <name> BEFORE,AFTER sth with OR,ON */ else if (TailMatches5("CREATE", "TRIGGER", MatchAny, "BEFORE|AFTER", MatchAny) || - TailMatches6("CREATE", "TRIGGER", MatchAny, "INSTEAD", "OF", MatchAny)) + TailMatches6("CREATE", "TRIGGER", MatchAny, "INSTEAD", "OF", MatchAny)) COMPLETE_WITH_LIST2("ON", "OR"); /* @@ -2618,7 +2618,7 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_views, NULL); else if (HeadMatches2("CREATE", "TRIGGER") && TailMatches2("ON", MatchAny)) COMPLETE_WITH_LIST7("NOT DEFERRABLE", "DEFERRABLE", "INITIALLY", - "REFERENCING", "FOR", "WHEN (", "EXECUTE PROCEDURE"); + "REFERENCING", "FOR", "WHEN (", "EXECUTE PROCEDURE"); else if (HeadMatches2("CREATE", "TRIGGER") && (TailMatches1("DEFERRABLE") || TailMatches2("INITIALLY", "IMMEDIATE|DEFERRED"))) COMPLETE_WITH_LIST4("REFERENCING", "FOR", "WHEN (", "EXECUTE PROCEDURE"); @@ -2909,7 +2909,7 @@ psql_completion(const char *text, int start, int end) */ if (HeadMatches3("ALTER", "DEFAULT", "PRIVILEGES")) COMPLETE_WITH_LIST10("SELECT", "INSERT", "UPDATE", - "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", + "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER", "EXECUTE", "USAGE", "ALL"); else COMPLETE_WITH_QUERY(Query_for_list_of_roles @@ -2963,8 +2963,8 @@ psql_completion(const char *text, int start, int end) COMPLETE_WITH_LIST5("TABLES", "SEQUENCES", "FUNCTIONS", "TYPES", "SCHEMAS"); else COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tsvmf, - " UNION SELECT 'ALL FUNCTIONS IN SCHEMA'" - " UNION SELECT 'ALL SEQUENCES IN SCHEMA'" + " UNION SELECT 'ALL FUNCTIONS IN SCHEMA'" + " UNION SELECT 'ALL SEQUENCES IN SCHEMA'" " UNION SELECT 'ALL TABLES IN SCHEMA'" " UNION SELECT 'DATABASE'" " UNION SELECT 'DOMAIN'" @@ -3253,11 +3253,11 @@ psql_completion(const char *text, int start, int end) else if (Matches2("BEGIN|START", "TRANSACTION") || Matches2("BEGIN", "WORK") || Matches1("BEGIN") || - Matches5("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION")) + Matches5("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION")) COMPLETE_WITH_LIST4("ISOLATION LEVEL", "READ", "DEFERRABLE", "NOT DEFERRABLE"); else if (Matches3("SET|BEGIN|START", "TRANSACTION|WORK", "NOT") || Matches2("BEGIN", "NOT") || - Matches6("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "NOT")) + Matches6("SET", "SESSION", "CHARACTERISTICS", "AS", "TRANSACTION", "NOT")) COMPLETE_WITH_CONST("DEFERRABLE"); else if (Matches3("SET|BEGIN|START", "TRANSACTION|WORK", "ISOLATION") || Matches2("BEGIN", "ISOLATION") || @@ -3871,7 +3871,7 @@ _complete_from_query(int is_schema_query, const char *text, int state) { appendPQExpBufferStr(&query_buffer, " AND c.relnamespace <> (SELECT oid FROM" - " pg_catalog.pg_namespace WHERE nspname = 'pg_catalog')"); + " pg_catalog.pg_namespace WHERE nspname = 'pg_catalog')"); } /* @@ -3879,14 +3879,14 @@ _complete_from_query(int is_schema_query, const char *text, int state) * one potential match among schema names. */ appendPQExpBuffer(&query_buffer, "\nUNION\n" - "SELECT pg_catalog.quote_ident(n.nspname) || '.' " + "SELECT pg_catalog.quote_ident(n.nspname) || '.' " "FROM pg_catalog.pg_namespace n " "WHERE substring(pg_catalog.quote_ident(n.nspname) || '.',1,%d)='%s'", char_length, e_text); appendPQExpBuffer(&query_buffer, " AND (SELECT pg_catalog.count(*)" " FROM pg_catalog.pg_namespace" - " WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,%d) =" + " WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,%d) =" " substring('%s',1,pg_catalog.length(pg_catalog.quote_ident(nspname))+1)) > 1", char_length, e_text); @@ -3895,7 +3895,7 @@ _complete_from_query(int is_schema_query, const char *text, int state) * one schema matching the input-so-far. */ appendPQExpBuffer(&query_buffer, "\nUNION\n" - "SELECT pg_catalog.quote_ident(n.nspname) || '.' || %s " + "SELECT pg_catalog.quote_ident(n.nspname) || '.' || %s " "FROM %s, pg_catalog.pg_namespace n " "WHERE %s = n.oid AND ", qualresult, @@ -3913,13 +3913,13 @@ _complete_from_query(int is_schema_query, const char *text, int state) * speed up the query */ appendPQExpBuffer(&query_buffer, - " AND substring(pg_catalog.quote_ident(n.nspname) || '.',1,%d) =" + " AND substring(pg_catalog.quote_ident(n.nspname) || '.',1,%d) =" " substring('%s',1,pg_catalog.length(pg_catalog.quote_ident(n.nspname))+1)", char_length, e_text); appendPQExpBuffer(&query_buffer, " AND (SELECT pg_catalog.count(*)" " FROM pg_catalog.pg_namespace" - " WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,%d) =" + " WHERE substring(pg_catalog.quote_ident(nspname) || '.',1,%d) =" " substring('%s',1,pg_catalog.length(pg_catalog.quote_ident(nspname))+1)) = 1", char_length, e_text); @@ -4187,7 +4187,7 @@ pg_strdup_keyword_case(const char *s, const char *ref) if (pset.comp_case == PSQL_COMP_CASE_LOWER || ((pset.comp_case == PSQL_COMP_CASE_PRESERVE_LOWER || - pset.comp_case == PSQL_COMP_CASE_PRESERVE_UPPER) && islower(first)) || + pset.comp_case == PSQL_COMP_CASE_PRESERVE_UPPER) && islower(first)) || (pset.comp_case == PSQL_COMP_CASE_PRESERVE_LOWER && !isalpha(first))) { for (p = ret; *p; p++) @@ -4457,6 +4457,6 @@ dequote_file_name(char *text, char quote_char) return s; } -#endif /* NOT_USED */ +#endif /* NOT_USED */ -#endif /* USE_READLINE */ +#endif /* USE_READLINE */ diff --git a/src/bin/psql/tab-complete.h b/src/bin/psql/tab-complete.h index 9c0309dc1e..1a42ef1c66 100644 --- a/src/bin/psql/tab-complete.h +++ b/src/bin/psql/tab-complete.h @@ -14,4 +14,4 @@ extern PQExpBuffer tab_completion_query_buf; extern void initialize_readline(void); -#endif /* TAB_COMPLETE_H */ +#endif /* TAB_COMPLETE_H */ diff --git a/src/bin/psql/variables.c b/src/bin/psql/variables.c index d9d07631a5..806d39bfbe 100644 --- a/src/bin/psql/variables.c +++ b/src/bin/psql/variables.c @@ -273,7 +273,7 @@ SetVariable(VariableSpace space, const char *name, const char *value) } } else if (new_value) - pg_free(new_value); /* current->value is left unchanged */ + pg_free(new_value); /* current->value is left unchanged */ return confirmed; } diff --git a/src/bin/psql/variables.h b/src/bin/psql/variables.h index 19257937c7..02d85b1bc2 100644 --- a/src/bin/psql/variables.h +++ b/src/bin/psql/variables.h @@ -93,4 +93,4 @@ void SetVariableHooks(VariableSpace space, const char *name, void PsqlVarEnumError(const char *name, const char *value, const char *suggestions); -#endif /* VARIABLES_H */ +#endif /* VARIABLES_H */ diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c index 0b88fa6b4d..7394bf293e 100644 --- a/src/bin/scripts/common.c +++ b/src/bin/scripts/common.c @@ -425,4 +425,4 @@ setup_cancel_handler(void) SetConsoleCtrlHandler(consoleHandler, TRUE); } -#endif /* WIN32 */ +#endif /* WIN32 */ diff --git a/src/bin/scripts/common.h b/src/bin/scripts/common.h index 6532eb2372..18d8d12d15 100644 --- a/src/bin/scripts/common.h +++ b/src/bin/scripts/common.h @@ -35,8 +35,8 @@ extern PGconn *connectDatabase(const char *dbname, const char *pghost, bool fail_ok, bool allow_password_reuse); extern PGconn *connectMaintenanceDatabase(const char *maintenance_db, - const char *pghost, const char *pgport, const char *pguser, - enum trivalue prompt_password, const char *progname); + const char *pghost, const char *pgport, const char *pguser, + enum trivalue prompt_password, const char *progname); extern PGresult *executeQuery(PGconn *conn, const char *query, const char *progname, bool echo); @@ -55,4 +55,4 @@ extern void SetCancelConn(PGconn *conn); extern void ResetCancelConn(void); -#endif /* COMMON_H */ +#endif /* COMMON_H */ diff --git a/src/bin/scripts/dropdb.c b/src/bin/scripts/dropdb.c index 85c75a79ce..5dc8558e8e 100644 --- a/src/bin/scripts/dropdb.c +++ b/src/bin/scripts/dropdb.c @@ -129,7 +129,7 @@ main(int argc, char *argv[]) maintenance_db = "template1"; conn = connectMaintenanceDatabase(maintenance_db, - host, port, username, prompt_password, progname); + host, port, username, prompt_password, progname); if (echo) printf("%s\n", sql.data); diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c index 12a4528574..ffd611e7bb 100644 --- a/src/bin/scripts/reindexdb.c +++ b/src/bin/scripts/reindexdb.c @@ -182,7 +182,7 @@ main(int argc, char *argv[]) } reindex_all_databases(maintenance_db, host, port, username, - prompt_password, progname, echo, quiet, verbose); + prompt_password, progname, echo, quiet, verbose); } else if (syscatalog) { @@ -234,7 +234,7 @@ main(int argc, char *argv[]) for (cell = schemas.head; cell; cell = cell->next) { reindex_one_database(cell->val, dbname, "SCHEMA", host, port, - username, prompt_password, progname, echo, verbose); + username, prompt_password, progname, echo, verbose); } } @@ -245,7 +245,7 @@ main(int argc, char *argv[]) for (cell = indexes.head; cell; cell = cell->next) { reindex_one_database(cell->val, dbname, "INDEX", host, port, - username, prompt_password, progname, echo, verbose); + username, prompt_password, progname, echo, verbose); } } if (tables.head != NULL) @@ -255,7 +255,7 @@ main(int argc, char *argv[]) for (cell = tables.head; cell; cell = cell->next) { reindex_one_database(cell->val, dbname, "TABLE", host, port, - username, prompt_password, progname, echo, verbose); + username, prompt_password, progname, echo, verbose); } } @@ -265,7 +265,7 @@ main(int argc, char *argv[]) */ if (indexes.head == NULL && tables.head == NULL && schemas.head == NULL) reindex_one_database(NULL, dbname, "DATABASE", host, port, - username, prompt_password, progname, echo, verbose); + username, prompt_password, progname, echo, verbose); } exit(0); @@ -274,7 +274,7 @@ main(int argc, char *argv[]) static void reindex_one_database(const char *name, const char *dbname, const char *type, const char *host, const char *port, const char *username, - enum trivalue prompt_password, const char *progname, bool echo, + enum trivalue prompt_password, const char *progname, bool echo, bool verbose) { PQExpBufferData sql; @@ -327,7 +327,7 @@ static void reindex_all_databases(const char *maintenance_db, const char *host, const char *port, const char *username, enum trivalue prompt_password, - const char *progname, bool echo, bool quiet, bool verbose) + const char *progname, bool echo, bool quiet, bool verbose) { PGconn *conn; PGresult *result; diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 97792d0720..5d2869ea6b 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -557,7 +557,7 @@ vacuum_all_databases(vacuumingOptions *vacopts, conn = connectMaintenanceDatabase(maintenance_db, host, port, username, prompt_password, progname); result = executeQuery(conn, - "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;", + "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;", progname, echo); PQfinish(conn); @@ -705,7 +705,7 @@ run_vacuum_command(PGconn *conn, const char *sql, bool echo, { if (table) fprintf(stderr, - _("%s: vacuuming of table \"%s\" in database \"%s\" failed: %s"), + _("%s: vacuuming of table \"%s\" in database \"%s\" failed: %s"), progname, table, PQdb(conn), PQerrorMessage(conn)); else fprintf(stderr, _("%s: vacuuming of database \"%s\" failed: %s"), diff --git a/src/common/exec.c b/src/common/exec.c index bd01c2d9a2..67bf4d1d79 100644 --- a/src/common/exec.c +++ b/src/common/exec.c @@ -187,7 +187,7 @@ find_my_exec(const char *argv0, char *retpath) switch (validate_exec(retpath)) { - case 0: /* found ok */ + case 0: /* found ok */ return resolve_symlinks(retpath); case -1: /* wasn't even a candidate, keep looking */ break; @@ -293,7 +293,7 @@ resolve_symlinks(char *path) log_error4(_("could not change directory to \"%s\": %s"), orig_wd, strerror(errno)); return -1; } -#endif /* HAVE_READLINK */ +#endif /* HAVE_READLINK */ return 0; } @@ -499,7 +499,7 @@ pipe_read_line(char *cmd, char *line, int maxsize) CloseHandle(childstdoutrddup); return retval; -#endif /* WIN32 */ +#endif /* WIN32 */ } @@ -683,7 +683,7 @@ AddUserToTokenDacl(HANDLE hToken) /* Figure out the size of the new ACL */ dwNewAclSize = asi.AclBytesInUse + sizeof(ACCESS_ALLOWED_ACE) + - GetLengthSid(pTokenUser->User.Sid) -sizeof(DWORD); + GetLengthSid(pTokenUser->User.Sid) - sizeof(DWORD); /* Allocate the ACL buffer & initialize it */ pacl = (PACL) LocalAlloc(LPTR, dwNewAclSize); diff --git a/src/common/file_utils.c b/src/common/file_utils.c index 7f24325b8a..4304058acb 100644 --- a/src/common/file_utils.c +++ b/src/common/file_utils.c @@ -65,7 +65,7 @@ fsync_pgdata(const char *pg_data, /* handle renaming of pg_xlog to pg_wal in post-10 clusters */ snprintf(pg_wal, MAXPGPATH, "%s/%s", pg_data, - serverVersion < MINIMUM_VERSION_FOR_PG_WAL ? "pg_xlog" : "pg_wal"); + serverVersion < MINIMUM_VERSION_FOR_PG_WAL ? "pg_xlog" : "pg_wal"); snprintf(pg_tblspc, MAXPGPATH, "%s/pg_tblspc", pg_data); /* @@ -250,7 +250,7 @@ pre_sync_fname(const char *fname, bool isdir, const char *progname) return 0; } -#endif /* PG_FLUSH_DATA_WORKS */ +#endif /* PG_FLUSH_DATA_WORKS */ /* * fsync_fname -- Try to fsync a file or directory diff --git a/src/common/ip.c b/src/common/ip.c index 80711dbb98..bb536d3e86 100644 --- a/src/common/ip.c +++ b/src/common/ip.c @@ -40,10 +40,10 @@ #ifdef HAVE_UNIX_SOCKETS static int getaddrinfo_unix(const char *path, - const struct addrinfo * hintsp, - struct addrinfo ** result); + const struct addrinfo *hintsp, + struct addrinfo **result); -static int getnameinfo_unix(const struct sockaddr_un * sa, int salen, +static int getnameinfo_unix(const struct sockaddr_un *sa, int salen, char *node, int nodelen, char *service, int servicelen, int flags); @@ -55,7 +55,7 @@ static int getnameinfo_unix(const struct sockaddr_un * sa, int salen, */ int pg_getaddrinfo_all(const char *hostname, const char *servname, - const struct addrinfo * hintp, struct addrinfo ** result) + const struct addrinfo *hintp, struct addrinfo **result) { int rc; @@ -85,7 +85,7 @@ pg_getaddrinfo_all(const char *hostname, const char *servname, * not safe to look at ai_family in the addrinfo itself. */ void -pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo * ai) +pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo *ai) { #ifdef HAVE_UNIX_SOCKETS if (hint_ai_family == AF_UNIX) @@ -101,7 +101,7 @@ pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo * ai) } } else -#endif /* HAVE_UNIX_SOCKETS */ +#endif /* HAVE_UNIX_SOCKETS */ { /* struct was built by getaddrinfo() */ if (ai != NULL) @@ -119,7 +119,7 @@ pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo * ai) * guaranteed to be filled with something even on failure return. */ int -pg_getnameinfo_all(const struct sockaddr_storage * addr, int salen, +pg_getnameinfo_all(const struct sockaddr_storage *addr, int salen, char *node, int nodelen, char *service, int servicelen, int flags) @@ -162,8 +162,8 @@ pg_getnameinfo_all(const struct sockaddr_storage * addr, int salen, * ------- */ static int -getaddrinfo_unix(const char *path, const struct addrinfo * hintsp, - struct addrinfo ** result) +getaddrinfo_unix(const char *path, const struct addrinfo *hintsp, + struct addrinfo **result) { struct addrinfo hints; struct addrinfo *aip; @@ -228,7 +228,7 @@ getaddrinfo_unix(const char *path, const struct addrinfo * hintsp, * Convert an address to a hostname. */ static int -getnameinfo_unix(const struct sockaddr_un * sa, int salen, +getnameinfo_unix(const struct sockaddr_un *sa, int salen, char *node, int nodelen, char *service, int servicelen, int flags) @@ -256,4 +256,4 @@ getnameinfo_unix(const struct sockaddr_un * sa, int salen, return 0; } -#endif /* HAVE_UNIX_SOCKETS */ +#endif /* HAVE_UNIX_SOCKETS */ diff --git a/src/common/keywords.c b/src/common/keywords.c index 266c29205f..a5c6c41cb8 100644 --- a/src/common/keywords.c +++ b/src/common/keywords.c @@ -35,7 +35,7 @@ */ #define PG_KEYWORD(a,b,c) {a,0,c}, -#endif /* FRONTEND */ +#endif /* FRONTEND */ const ScanKeyword ScanKeywords[] = { diff --git a/src/common/md5.c b/src/common/md5.c index 6e70b218d2..ba65b02af6 100644 --- a/src/common/md5.c +++ b/src/common/md5.c @@ -117,21 +117,21 @@ doTheRounds(uint32 X[16], uint32 state[4]) b = c + ROT_LEFT((b + F(c, d, a) + X[7] + 0xfd469501), 22); /* 8 */ a = b + ROT_LEFT((a + F(b, c, d) + X[8] + 0x698098d8), 7); /* 9 */ d = a + ROT_LEFT((d + F(a, b, c) + X[9] + 0x8b44f7af), 12); /* 10 */ - c = d + ROT_LEFT((c + F(d, a, b) + X[10] + 0xffff5bb1), 17); /* 11 */ - b = c + ROT_LEFT((b + F(c, d, a) + X[11] + 0x895cd7be), 22); /* 12 */ + c = d + ROT_LEFT((c + F(d, a, b) + X[10] + 0xffff5bb1), 17); /* 11 */ + b = c + ROT_LEFT((b + F(c, d, a) + X[11] + 0x895cd7be), 22); /* 12 */ a = b + ROT_LEFT((a + F(b, c, d) + X[12] + 0x6b901122), 7); /* 13 */ - d = a + ROT_LEFT((d + F(a, b, c) + X[13] + 0xfd987193), 12); /* 14 */ - c = d + ROT_LEFT((c + F(d, a, b) + X[14] + 0xa679438e), 17); /* 15 */ - b = c + ROT_LEFT((b + F(c, d, a) + X[15] + 0x49b40821), 22); /* 16 */ + d = a + ROT_LEFT((d + F(a, b, c) + X[13] + 0xfd987193), 12); /* 14 */ + c = d + ROT_LEFT((c + F(d, a, b) + X[14] + 0xa679438e), 17); /* 15 */ + b = c + ROT_LEFT((b + F(c, d, a) + X[15] + 0x49b40821), 22); /* 16 */ /* round 2 */ a = b + ROT_LEFT((a + G(b, c, d) + X[1] + 0xf61e2562), 5); /* 17 */ d = a + ROT_LEFT((d + G(a, b, c) + X[6] + 0xc040b340), 9); /* 18 */ - c = d + ROT_LEFT((c + G(d, a, b) + X[11] + 0x265e5a51), 14); /* 19 */ + c = d + ROT_LEFT((c + G(d, a, b) + X[11] + 0x265e5a51), 14); /* 19 */ b = c + ROT_LEFT((b + G(c, d, a) + X[0] + 0xe9b6c7aa), 20); /* 20 */ a = b + ROT_LEFT((a + G(b, c, d) + X[5] + 0xd62f105d), 5); /* 21 */ d = a + ROT_LEFT((d + G(a, b, c) + X[10] + 0x02441453), 9); /* 22 */ - c = d + ROT_LEFT((c + G(d, a, b) + X[15] + 0xd8a1e681), 14); /* 23 */ + c = d + ROT_LEFT((c + G(d, a, b) + X[15] + 0xd8a1e681), 14); /* 23 */ b = c + ROT_LEFT((b + G(c, d, a) + X[4] + 0xe7d3fbc8), 20); /* 24 */ a = b + ROT_LEFT((a + G(b, c, d) + X[9] + 0x21e1cde6), 5); /* 25 */ d = a + ROT_LEFT((d + G(a, b, c) + X[14] + 0xc33707d6), 9); /* 26 */ @@ -140,41 +140,41 @@ doTheRounds(uint32 X[16], uint32 state[4]) a = b + ROT_LEFT((a + G(b, c, d) + X[13] + 0xa9e3e905), 5); /* 29 */ d = a + ROT_LEFT((d + G(a, b, c) + X[2] + 0xfcefa3f8), 9); /* 30 */ c = d + ROT_LEFT((c + G(d, a, b) + X[7] + 0x676f02d9), 14); /* 31 */ - b = c + ROT_LEFT((b + G(c, d, a) + X[12] + 0x8d2a4c8a), 20); /* 32 */ + b = c + ROT_LEFT((b + G(c, d, a) + X[12] + 0x8d2a4c8a), 20); /* 32 */ /* round 3 */ a = b + ROT_LEFT((a + H(b, c, d) + X[5] + 0xfffa3942), 4); /* 33 */ d = a + ROT_LEFT((d + H(a, b, c) + X[8] + 0x8771f681), 11); /* 34 */ - c = d + ROT_LEFT((c + H(d, a, b) + X[11] + 0x6d9d6122), 16); /* 35 */ - b = c + ROT_LEFT((b + H(c, d, a) + X[14] + 0xfde5380c), 23); /* 36 */ + c = d + ROT_LEFT((c + H(d, a, b) + X[11] + 0x6d9d6122), 16); /* 35 */ + b = c + ROT_LEFT((b + H(c, d, a) + X[14] + 0xfde5380c), 23); /* 36 */ a = b + ROT_LEFT((a + H(b, c, d) + X[1] + 0xa4beea44), 4); /* 37 */ d = a + ROT_LEFT((d + H(a, b, c) + X[4] + 0x4bdecfa9), 11); /* 38 */ c = d + ROT_LEFT((c + H(d, a, b) + X[7] + 0xf6bb4b60), 16); /* 39 */ - b = c + ROT_LEFT((b + H(c, d, a) + X[10] + 0xbebfbc70), 23); /* 40 */ + b = c + ROT_LEFT((b + H(c, d, a) + X[10] + 0xbebfbc70), 23); /* 40 */ a = b + ROT_LEFT((a + H(b, c, d) + X[13] + 0x289b7ec6), 4); /* 41 */ d = a + ROT_LEFT((d + H(a, b, c) + X[0] + 0xeaa127fa), 11); /* 42 */ c = d + ROT_LEFT((c + H(d, a, b) + X[3] + 0xd4ef3085), 16); /* 43 */ b = c + ROT_LEFT((b + H(c, d, a) + X[6] + 0x04881d05), 23); /* 44 */ a = b + ROT_LEFT((a + H(b, c, d) + X[9] + 0xd9d4d039), 4); /* 45 */ - d = a + ROT_LEFT((d + H(a, b, c) + X[12] + 0xe6db99e5), 11); /* 46 */ - c = d + ROT_LEFT((c + H(d, a, b) + X[15] + 0x1fa27cf8), 16); /* 47 */ + d = a + ROT_LEFT((d + H(a, b, c) + X[12] + 0xe6db99e5), 11); /* 46 */ + c = d + ROT_LEFT((c + H(d, a, b) + X[15] + 0x1fa27cf8), 16); /* 47 */ b = c + ROT_LEFT((b + H(c, d, a) + X[2] + 0xc4ac5665), 23); /* 48 */ /* round 4 */ a = b + ROT_LEFT((a + I(b, c, d) + X[0] + 0xf4292244), 6); /* 49 */ d = a + ROT_LEFT((d + I(a, b, c) + X[7] + 0x432aff97), 10); /* 50 */ - c = d + ROT_LEFT((c + I(d, a, b) + X[14] + 0xab9423a7), 15); /* 51 */ + c = d + ROT_LEFT((c + I(d, a, b) + X[14] + 0xab9423a7), 15); /* 51 */ b = c + ROT_LEFT((b + I(c, d, a) + X[5] + 0xfc93a039), 21); /* 52 */ a = b + ROT_LEFT((a + I(b, c, d) + X[12] + 0x655b59c3), 6); /* 53 */ d = a + ROT_LEFT((d + I(a, b, c) + X[3] + 0x8f0ccc92), 10); /* 54 */ - c = d + ROT_LEFT((c + I(d, a, b) + X[10] + 0xffeff47d), 15); /* 55 */ + c = d + ROT_LEFT((c + I(d, a, b) + X[10] + 0xffeff47d), 15); /* 55 */ b = c + ROT_LEFT((b + I(c, d, a) + X[1] + 0x85845dd1), 21); /* 56 */ a = b + ROT_LEFT((a + I(b, c, d) + X[8] + 0x6fa87e4f), 6); /* 57 */ - d = a + ROT_LEFT((d + I(a, b, c) + X[15] + 0xfe2ce6e0), 10); /* 58 */ + d = a + ROT_LEFT((d + I(a, b, c) + X[15] + 0xfe2ce6e0), 10); /* 58 */ c = d + ROT_LEFT((c + I(d, a, b) + X[6] + 0xa3014314), 15); /* 59 */ - b = c + ROT_LEFT((b + I(c, d, a) + X[13] + 0x4e0811a1), 21); /* 60 */ + b = c + ROT_LEFT((b + I(c, d, a) + X[13] + 0x4e0811a1), 21); /* 60 */ a = b + ROT_LEFT((a + I(b, c, d) + X[4] + 0xf7537e82), 6); /* 61 */ - d = a + ROT_LEFT((d + I(a, b, c) + X[11] + 0xbd3af235), 10); /* 62 */ + d = a + ROT_LEFT((d + I(a, b, c) + X[11] + 0xbd3af235), 10); /* 62 */ c = d + ROT_LEFT((c + I(d, a, b) + X[2] + 0x2ad7d2bb), 15); /* 63 */ b = c + ROT_LEFT((b + I(c, d, a) + X[9] + 0xeb86d391), 21); /* 64 */ diff --git a/src/common/pg_lzcompress.c b/src/common/pg_lzcompress.c index 5ec93ec7a6..67f570c362 100644 --- a/src/common/pg_lzcompress.c +++ b/src/common/pg_lzcompress.c @@ -752,7 +752,7 @@ pglz_decompress(const char *source, int32 slen, char *dest, * An unset control bit means LITERAL BYTE. So we just copy * one from INPUT to OUTPUT. */ - if (dp >= destend) /* check for buffer overrun */ + if (dp >= destend) /* check for buffer overrun */ break; /* do not clobber memory */ *dp++ = *sp++; diff --git a/src/common/psprintf.c b/src/common/psprintf.c index 8561e9aed6..8f5903d519 100644 --- a/src/common/psprintf.c +++ b/src/common/psprintf.c @@ -25,7 +25,7 @@ #include "postgres_fe.h" /* It's possible we could use a different value for this in frontend code */ -#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */ +#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */ #endif diff --git a/src/common/restricted_token.c b/src/common/restricted_token.c index 1a00293695..57591aaae2 100644 --- a/src/common/restricted_token.c +++ b/src/common/restricted_token.c @@ -81,10 +81,10 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, const char /* Allocate list of SIDs to remove */ ZeroMemory(&dropSids, sizeof(dropSids)); if (!AllocateAndInitializeSid(&NtAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, + SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &dropSids[0].Sid) || !AllocateAndInitializeSid(&NtAuthority, 2, - SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0, + SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_POWER_USERS, 0, 0, 0, 0, 0, 0, &dropSids[1].Sid)) { fprintf(stderr, _("%s: could not allocate SIDs: error code %lu\n"), diff --git a/src/common/scram-common.c b/src/common/scram-common.c index 461d75db12..e43d035d4d 100644 --- a/src/common/scram-common.c +++ b/src/common/scram-common.c @@ -221,7 +221,7 @@ scram_build_verifier(const char *salt, int saltlen, int iterations, maxlen = strlen("SCRAM-SHA-256") + 1 + 10 + 1 /* iteration count */ + pg_b64_enc_len(saltlen) + 1 /* Base64-encoded salt */ - + pg_b64_enc_len(SCRAM_KEY_LEN) + 1 /* Base64-encoded StoredKey */ + + pg_b64_enc_len(SCRAM_KEY_LEN) + 1 /* Base64-encoded StoredKey */ + pg_b64_enc_len(SCRAM_KEY_LEN) + 1; /* Base64-encoded ServerKey */ #ifdef FRONTEND diff --git a/src/common/sha2.c b/src/common/sha2.c index 496467507d..7c6f1b49ad 100644 --- a/src/common/sha2.c +++ b/src/common/sha2.c @@ -94,7 +94,7 @@ (x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \ ((tmp & 0x0000ffff0000ffffULL) << 16); \ } -#endif /* not bigendian */ +#endif /* not bigendian */ /* * Macro for incrementally adding the unsigned 64-bit integer n to the @@ -459,7 +459,7 @@ SHA256_Transform(pg_sha256_ctx *context, const uint8 *data) /* Clean up */ a = b = c = d = e = f = g = h = T1 = T2 = 0; } -#endif /* SHA2_UNROLL_TRANSFORM */ +#endif /* SHA2_UNROLL_TRANSFORM */ void pg_sha256_update(pg_sha256_ctx *context, const uint8 *data, size_t len) @@ -785,7 +785,7 @@ SHA512_Transform(pg_sha512_ctx *context, const uint8 *data) /* Clean up */ a = b = c = d = e = f = g = h = T1 = T2 = 0; } -#endif /* SHA2_UNROLL_TRANSFORM */ +#endif /* SHA2_UNROLL_TRANSFORM */ void pg_sha512_update(pg_sha512_ctx *context, const uint8 *data, size_t len) diff --git a/src/common/unicode/norm_test.c b/src/common/unicode/norm_test.c index 10a370cffa..f1bd99fce4 100644 --- a/src/common/unicode/norm_test.c +++ b/src/common/unicode/norm_test.c @@ -56,7 +56,7 @@ pg_wcscmp(const pg_wchar *s1, const pg_wchar *s2) int main(int argc, char **argv) { - const pg_unicode_test *test; + const pg_unicode_test *test; for (test = UnicodeNormalizationTests; test->input[0] != 0; test++) { diff --git a/src/common/username.c b/src/common/username.c index 487eacfe73..7187bbde42 100644 --- a/src/common/username.c +++ b/src/common/username.c @@ -42,7 +42,7 @@ get_user_name(char **errstr) { *errstr = psprintf(_("could not look up effective user ID %ld: %s"), (long) user_id, - errno ? strerror(errno) : _("user does not exist")); + errno ? strerror(errno) : _("user does not exist")); return NULL; } diff --git a/src/fe_utils/mbprint.c b/src/fe_utils/mbprint.c index d186fc4c91..9aabe59f38 100644 --- a/src/fe_utils/mbprint.c +++ b/src/fe_utils/mbprint.c @@ -104,7 +104,7 @@ utf_charcheck(const unsigned char *c) /* check 0xfffe/0xffff, 0xfdd0..0xfedf range, surrogates */ if (((z == 0x0f) && (((yx & 0xffe) == 0xffe) || - (((yx & 0xf80) == 0xd80) && (lx >= 0x30) && (lx <= 0x4f)))) || + (((yx & 0xf80) == 0xd80) && (lx >= 0x30) && (lx <= 0x4f)))) || ((z == 0x0d) && ((yx & 0xb00) == 0x800))) return -1; return 3; @@ -233,14 +233,14 @@ pg_wcssize(const unsigned char *pwcs, size_t len, int encoding, width = linewidth; linewidth = 0; height += 1; - format_size += 1; /* For NUL char */ + format_size += 1; /* For NUL char */ } - else if (*pwcs == '\r') /* Linefeed */ + else if (*pwcs == '\r') /* Linefeed */ { linewidth += 2; format_size += 2; } - else if (*pwcs == '\t') /* Tab */ + else if (*pwcs == '\t') /* Tab */ { do { @@ -253,7 +253,7 @@ pg_wcssize(const unsigned char *pwcs, size_t len, int encoding, linewidth += 4; format_size += 4; } - else /* Output it as-is */ + else /* Output it as-is */ { linewidth += w; format_size += 1; @@ -264,7 +264,7 @@ pg_wcssize(const unsigned char *pwcs, size_t len, int encoding, linewidth += 6; /* \u0000 */ format_size += 6; } - else /* All other chars */ + else /* All other chars */ { linewidth += w; format_size += chlen; @@ -292,7 +292,7 @@ pg_wcssize(const unsigned char *pwcs, size_t len, int encoding, */ void pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding, - struct lineptr * lines, int count) + struct lineptr *lines, int count) { int w, chlen = 0; @@ -321,13 +321,13 @@ pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding, /* make next line point to remaining memory */ lines->ptr = ptr; } - else if (*pwcs == '\r') /* Linefeed */ + else if (*pwcs == '\r') /* Linefeed */ { strcpy((char *) ptr, "\\r"); linewidth += 2; ptr += 2; } - else if (*pwcs == '\t') /* Tab */ + else if (*pwcs == '\t') /* Tab */ { do { @@ -341,7 +341,7 @@ pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding, linewidth += 4; ptr += 4; } - else /* Output it as-is */ + else /* Output it as-is */ { linewidth += w; *ptr++ = *pwcs; @@ -363,7 +363,7 @@ pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding, ptr += 6; linewidth += 6; } - else /* All other chars */ + else /* All other chars */ { int i; diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c index 9180b90004..f756f767e5 100644 --- a/src/fe_utils/print.c +++ b/src/fe_utils/print.c @@ -370,7 +370,7 @@ print_unaligned_text(const printTableContent *cont, FILE *fout) { bool opt_tuples_only = cont->opt->tuples_only; unsigned int i; - const char *const * ptr; + const char *const *ptr; bool need_recordsep = false; if (cancel_pressed) @@ -461,7 +461,7 @@ print_unaligned_vertical(const printTableContent *cont, FILE *fout) { bool opt_tuples_only = cont->opt->tuples_only; unsigned int i; - const char *const * ptr; + const char *const *ptr; bool need_recordsep = false; if (cancel_pressed) @@ -606,14 +606,14 @@ print_aligned_text(const printTableContent *cont, FILE *fout, bool is_pager) unsigned int extra_row_output_lines = 0; unsigned int extra_output_lines = 0; - const char *const * ptr; + const char *const *ptr; - struct lineptr **col_lineptrs; /* pointers to line pointer per column */ + struct lineptr **col_lineptrs; /* pointers to line pointer per column */ bool *header_done; /* Have all header lines been output? */ int *bytes_output; /* Bytes output for column value */ printTextLineWrap *wrap; /* Wrap status for each column */ - int output_columns = 0; /* Width of interactive console */ + int output_columns = 0; /* Width of interactive console */ bool is_local_pager = false; if (cancel_pressed) @@ -1006,7 +1006,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout, bool is_pager) int bytes_to_output; int chars_to_output = width_wrap[j]; bool finalspaces = (opt_border == 2 || - (col_count > 0 && j < col_count - 1)); + (col_count > 0 && j < col_count - 1)); /* Print left-hand wrap or newline mark */ if (opt_border != 0) @@ -1046,14 +1046,14 @@ print_aligned_text(const printTableContent *cont, FILE *fout, bool is_pager) /* spaces first */ fprintf(fout, "%*s", width_wrap[j] - chars_to_output, ""); fputnbytes(fout, - (char *) (this_line->ptr + bytes_output[j]), + (char *) (this_line->ptr + bytes_output[j]), bytes_to_output); } - else /* Left aligned cell */ + else /* Left aligned cell */ { /* spaces second */ fputnbytes(fout, - (char *) (this_line->ptr + bytes_output[j]), + (char *) (this_line->ptr + bytes_output[j]), bytes_to_output); } @@ -1086,7 +1086,7 @@ print_aligned_text(const printTableContent *cont, FILE *fout, bool is_pager) * If left-aligned, pad out remaining space if needed (not * last column, and/or wrap marks required). */ - if (cont->aligns[j] != 'r') /* Left aligned cell */ + if (cont->aligns[j] != 'r') /* Left aligned cell */ { if (finalspaces || wrap[j] == PRINT_LINE_WRAP_WRAP || @@ -1236,7 +1236,7 @@ print_aligned_vertical(const printTableContent *cont, const printTextLineFormat *dformat = &format->lrule[PRINT_RULE_DATA]; int encoding = cont->opt->encoding; unsigned long record = cont->opt->prior_records + 1; - const char *const * ptr; + const char *const *ptr; unsigned int i, hwidth = 0, dwidth = 0, @@ -1249,7 +1249,7 @@ print_aligned_vertical(const printTableContent *cont, bool is_local_pager = false, hmultiline = false, dmultiline = false; - int output_columns = 0; /* Width of interactive console */ + int output_columns = 0; /* Width of interactive console */ if (cancel_pressed) return; @@ -1789,7 +1789,7 @@ print_html_text(const printTableContent *cont, FILE *fout) unsigned short opt_border = cont->opt->border; const char *opt_table_attr = cont->opt->tableAttr; unsigned int i; - const char *const * ptr; + const char *const *ptr; if (cancel_pressed) return; @@ -1879,7 +1879,7 @@ print_html_vertical(const printTableContent *cont, FILE *fout) const char *opt_table_attr = cont->opt->tableAttr; unsigned long record = cont->opt->prior_records + 1; unsigned int i; - const char *const * ptr; + const char *const *ptr; if (cancel_pressed) return; @@ -1980,7 +1980,7 @@ print_asciidoc_text(const printTableContent *cont, FILE *fout) bool opt_tuples_only = cont->opt->tuples_only; unsigned short opt_border = cont->opt->border; unsigned int i; - const char *const * ptr; + const char *const *ptr; if (cancel_pressed) return; @@ -2091,7 +2091,7 @@ print_asciidoc_vertical(const printTableContent *cont, FILE *fout) unsigned short opt_border = cont->opt->border; unsigned long record = cont->opt->prior_records + 1; unsigned int i; - const char *const * ptr; + const char *const *ptr; if (cancel_pressed) return; @@ -2223,7 +2223,7 @@ print_latex_text(const printTableContent *cont, FILE *fout) bool opt_tuples_only = cont->opt->tuples_only; unsigned short opt_border = cont->opt->border; unsigned int i; - const char *const * ptr; + const char *const *ptr; if (cancel_pressed) return; @@ -2328,7 +2328,7 @@ print_latex_longtable_text(const printTableContent *cont, FILE *fout) const char *opt_table_attr = cont->opt->tableAttr; const char *next_opt_table_attr_char = opt_table_attr; const char *last_opt_table_attr_char = NULL; - const char *const * ptr; + const char *const *ptr; if (cancel_pressed) return; @@ -2360,7 +2360,7 @@ print_latex_longtable_text(const printTableContent *cont, FILE *fout) { fputs("p{", fout); fwrite(next_opt_table_attr_char, strcspn(next_opt_table_attr_char, - LONGTABLE_WHITESPACE), 1, fout); + LONGTABLE_WHITESPACE), 1, fout); last_opt_table_attr_char = next_opt_table_attr_char; next_opt_table_attr_char += strcspn(next_opt_table_attr_char, LONGTABLE_WHITESPACE); @@ -2371,7 +2371,7 @@ print_latex_longtable_text(const printTableContent *cont, FILE *fout) { fputs("p{", fout); fwrite(last_opt_table_attr_char, strcspn(last_opt_table_attr_char, - LONGTABLE_WHITESPACE), 1, fout); + LONGTABLE_WHITESPACE), 1, fout); fputs("\\textwidth}", fout); } else @@ -2482,7 +2482,7 @@ print_latex_vertical(const printTableContent *cont, FILE *fout) unsigned short opt_border = cont->opt->border; unsigned long record = cont->opt->prior_records + 1; unsigned int i; - const char *const * ptr; + const char *const *ptr; if (cancel_pressed) return; @@ -2591,7 +2591,7 @@ print_troff_ms_text(const printTableContent *cont, FILE *fout) bool opt_tuples_only = cont->opt->tuples_only; unsigned short opt_border = cont->opt->border; unsigned int i; - const char *const * ptr; + const char *const *ptr; if (cancel_pressed) return; @@ -2684,7 +2684,7 @@ print_troff_ms_vertical(const printTableContent *cont, FILE *fout) unsigned short opt_border = cont->opt->border; unsigned long record = cont->opt->prior_records + 1; unsigned int i; - const char *const * ptr; + const char *const *ptr; unsigned short current_format = 0; /* 0=none, 1=header, 2=body */ if (cancel_pressed) diff --git a/src/fe_utils/simple_list.c b/src/fe_utils/simple_list.c index 1be8ca7598..21a2e57297 100644 --- a/src/fe_utils/simple_list.c +++ b/src/fe_utils/simple_list.c @@ -65,7 +65,7 @@ simple_string_list_append(SimpleStringList *list, const char *val) SimpleStringListCell *cell; cell = (SimpleStringListCell *) - pg_malloc(offsetof(SimpleStringListCell, val) +strlen(val) + 1); + pg_malloc(offsetof(SimpleStringListCell, val) + strlen(val) + 1); cell->next = NULL; cell->touched = false; diff --git a/src/fe_utils/string_utils.c b/src/fe_utils/string_utils.c index dc84d32a09..c7e42ddec9 100644 --- a/src/fe_utils/string_utils.c +++ b/src/fe_utils/string_utils.c @@ -536,7 +536,7 @@ appendShellStringNoError(PQExpBuffer buf, const char *str) backslash_run_length--; } appendPQExpBufferStr(buf, "^\""); -#endif /* WIN32 */ +#endif /* WIN32 */ return ok; } @@ -596,7 +596,7 @@ void appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname) { const char *s; - bool complex; + bool complex; /* * If the name is plain ASCII characters, emit a trivial "\connect "foo"". @@ -604,6 +604,7 @@ appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname) * general case. No database has a zero-length name. */ complex = false; + for (s = dbname; *s; s++) { if (*s == '\n' || *s == '\r') @@ -712,9 +713,9 @@ parsePGArray(const char *atext, char ***itemarray, int *nitems) { atext++; if (*atext == '\0') - return false; /* premature end of string */ + return false; /* premature end of string */ } - *strings++ = *atext++; /* copy quoted data */ + *strings++ = *atext++; /* copy quoted data */ } atext++; } diff --git a/src/include/access/amapi.h b/src/include/access/amapi.h index f919cf8b87..0db4fc73ac 100644 --- a/src/include/access/amapi.h +++ b/src/include/access/amapi.h @@ -60,75 +60,75 @@ typedef enum IndexAMProperty /* build new index */ typedef IndexBuildResult *(*ambuild_function) (Relation heapRelation, - Relation indexRelation, - struct IndexInfo *indexInfo); + Relation indexRelation, + struct IndexInfo *indexInfo); /* build empty index */ typedef void (*ambuildempty_function) (Relation indexRelation); /* insert this tuple */ typedef bool (*aminsert_function) (Relation indexRelation, - Datum *values, - bool *isnull, - ItemPointer heap_tid, - Relation heapRelation, - IndexUniqueCheck checkUnique, - struct IndexInfo *indexInfo); + Datum *values, + bool *isnull, + ItemPointer heap_tid, + Relation heapRelation, + IndexUniqueCheck checkUnique, + struct IndexInfo *indexInfo); /* bulk delete */ typedef IndexBulkDeleteResult *(*ambulkdelete_function) (IndexVacuumInfo *info, - IndexBulkDeleteResult *stats, - IndexBulkDeleteCallback callback, - void *callback_state); + IndexBulkDeleteResult *stats, + IndexBulkDeleteCallback callback, + void *callback_state); /* post-VACUUM cleanup */ typedef IndexBulkDeleteResult *(*amvacuumcleanup_function) (IndexVacuumInfo *info, - IndexBulkDeleteResult *stats); + IndexBulkDeleteResult *stats); /* can indexscan return IndexTuples? */ typedef bool (*amcanreturn_function) (Relation indexRelation, int attno); /* estimate cost of an indexscan */ typedef void (*amcostestimate_function) (struct PlannerInfo *root, - struct IndexPath *path, - double loop_count, - Cost *indexStartupCost, - Cost *indexTotalCost, - Selectivity *indexSelectivity, - double *indexCorrelation, - double *indexPages); + struct IndexPath *path, + double loop_count, + Cost *indexStartupCost, + Cost *indexTotalCost, + Selectivity *indexSelectivity, + double *indexCorrelation, + double *indexPages); /* parse index reloptions */ typedef bytea *(*amoptions_function) (Datum reloptions, - bool validate); + bool validate); /* report AM, index, or index column property */ typedef bool (*amproperty_function) (Oid index_oid, int attno, - IndexAMProperty prop, const char *propname, - bool *res, bool *isnull); + IndexAMProperty prop, const char *propname, + bool *res, bool *isnull); /* validate definition of an opclass for this AM */ typedef bool (*amvalidate_function) (Oid opclassoid); /* prepare for index scan */ typedef IndexScanDesc (*ambeginscan_function) (Relation indexRelation, - int nkeys, - int norderbys); + int nkeys, + int norderbys); /* (re)start index scan */ typedef void (*amrescan_function) (IndexScanDesc scan, - ScanKey keys, - int nkeys, - ScanKey orderbys, - int norderbys); + ScanKey keys, + int nkeys, + ScanKey orderbys, + int norderbys); /* next valid tuple */ typedef bool (*amgettuple_function) (IndexScanDesc scan, - ScanDirection direction); + ScanDirection direction); /* fetch all valid tuples */ typedef int64 (*amgetbitmap_function) (IndexScanDesc scan, - TIDBitmap *tbm); + TIDBitmap *tbm); /* end index scan */ typedef void (*amendscan_function) (IndexScanDesc scan); @@ -203,19 +203,19 @@ typedef struct IndexAmRoutine amcanreturn_function amcanreturn; /* can be NULL */ amcostestimate_function amcostestimate; amoptions_function amoptions; - amproperty_function amproperty; /* can be NULL */ + amproperty_function amproperty; /* can be NULL */ amvalidate_function amvalidate; ambeginscan_function ambeginscan; amrescan_function amrescan; - amgettuple_function amgettuple; /* can be NULL */ + amgettuple_function amgettuple; /* can be NULL */ amgetbitmap_function amgetbitmap; /* can be NULL */ amendscan_function amendscan; - ammarkpos_function ammarkpos; /* can be NULL */ - amrestrpos_function amrestrpos; /* can be NULL */ + ammarkpos_function ammarkpos; /* can be NULL */ + amrestrpos_function amrestrpos; /* can be NULL */ /* interface functions to support parallel index scans */ - amestimateparallelscan_function amestimateparallelscan; /* can be NULL */ - aminitparallelscan_function aminitparallelscan; /* can be NULL */ + amestimateparallelscan_function amestimateparallelscan; /* can be NULL */ + aminitparallelscan_function aminitparallelscan; /* can be NULL */ amparallelrescan_function amparallelrescan; /* can be NULL */ } IndexAmRoutine; @@ -224,4 +224,4 @@ typedef struct IndexAmRoutine extern IndexAmRoutine *GetIndexAmRoutine(Oid amhandler); extern IndexAmRoutine *GetIndexAmRoutineByAmId(Oid amoid, bool noerror); -#endif /* AMAPI_H */ +#endif /* AMAPI_H */ diff --git a/src/include/access/amvalidate.h b/src/include/access/amvalidate.h index 742c25a78d..04b7429a78 100644 --- a/src/include/access/amvalidate.h +++ b/src/include/access/amvalidate.h @@ -33,4 +33,4 @@ extern bool check_amop_signature(Oid opno, Oid restype, Oid lefttype, Oid righttype); extern bool opfamily_can_sort_type(Oid opfamilyoid, Oid datatypeoid); -#endif /* AMVALIDATE_H */ +#endif /* AMVALIDATE_H */ diff --git a/src/include/access/attnum.h b/src/include/access/attnum.h index 7fa459fc8c..d23888b098 100644 --- a/src/include/access/attnum.h +++ b/src/include/access/attnum.h @@ -61,4 +61,4 @@ typedef int16 AttrNumber; #define AttrOffsetGetAttrNumber(attributeOffset) \ ((AttrNumber) (1 + (attributeOffset))) -#endif /* ATTNUM_H */ +#endif /* ATTNUM_H */ diff --git a/src/include/access/brin.h b/src/include/access/brin.h index 45d55a9733..61a38804ca 100644 --- a/src/include/access/brin.h +++ b/src/include/access/brin.h @@ -49,4 +49,4 @@ typedef struct BrinStatsData extern void brinGetStats(Relation index, BrinStatsData *stats); -#endif /* BRIN_H */ +#endif /* BRIN_H */ diff --git a/src/include/access/brin_internal.h b/src/include/access/brin_internal.h index abe887788b..3ed67438b2 100644 --- a/src/include/access/brin_internal.h +++ b/src/include/access/brin_internal.h @@ -107,4 +107,4 @@ extern bytea *brinoptions(Datum reloptions, bool validate); /* brin_validate.c */ extern bool brinvalidate(Oid opclassoid); -#endif /* BRIN_INTERNAL_H */ +#endif /* BRIN_INTERNAL_H */ diff --git a/src/include/access/brin_page.h b/src/include/access/brin_page.h index e2b3b92fac..bf03a6e9f8 100644 --- a/src/include/access/brin_page.h +++ b/src/include/access/brin_page.h @@ -93,4 +93,4 @@ typedef struct RevmapContents #define REVMAP_PAGE_MAXITEMS \ (REVMAP_CONTENT_SIZE / sizeof(ItemPointerData)) -#endif /* BRIN_PAGE_H */ +#endif /* BRIN_PAGE_H */ diff --git a/src/include/access/brin_pageops.h b/src/include/access/brin_pageops.h index ab38093a23..e0f5641635 100644 --- a/src/include/access/brin_pageops.h +++ b/src/include/access/brin_pageops.h @@ -35,4 +35,4 @@ extern void brin_evacuate_page(Relation idxRel, BlockNumber pagesPerRange, extern bool brin_page_cleanup(Relation idxrel, Buffer buf); -#endif /* BRIN_PAGEOPS_H */ +#endif /* BRIN_PAGEOPS_H */ diff --git a/src/include/access/brin_revmap.h b/src/include/access/brin_revmap.h index 7fdcf877f4..ddd87e040b 100644 --- a/src/include/access/brin_revmap.h +++ b/src/include/access/brin_revmap.h @@ -38,4 +38,4 @@ extern BrinTuple *brinGetTupleForHeapBlock(BrinRevmap *revmap, Size *size, int mode, Snapshot snapshot); extern bool brinRevmapDesummarizeRange(Relation idxrel, BlockNumber heapBlk); -#endif /* BRIN_REVMAP_H */ +#endif /* BRIN_REVMAP_H */ diff --git a/src/include/access/brin_tuple.h b/src/include/access/brin_tuple.h index 3f4a7b6d3c..6545c0a6ff 100644 --- a/src/include/access/brin_tuple.h +++ b/src/include/access/brin_tuple.h @@ -99,4 +99,4 @@ extern BrinMemTuple *brin_memtuple_initialize(BrinMemTuple *dtuple, extern BrinMemTuple *brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple); -#endif /* BRIN_TUPLE_H */ +#endif /* BRIN_TUPLE_H */ diff --git a/src/include/access/brin_xlog.h b/src/include/access/brin_xlog.h index 38e6dcccf2..10e90d3c78 100644 --- a/src/include/access/brin_xlog.h +++ b/src/include/access/brin_xlog.h @@ -148,4 +148,4 @@ extern void brin_desc(StringInfo buf, XLogReaderState *record); extern const char *brin_identify(uint8 info); extern void brin_mask(char *pagedata, BlockNumber blkno); -#endif /* BRIN_XLOG_H */ +#endif /* BRIN_XLOG_H */ diff --git a/src/include/access/clog.h b/src/include/access/clog.h index 5ac7cdd618..7bae0902b5 100644 --- a/src/include/access/clog.h +++ b/src/include/access/clog.h @@ -36,7 +36,7 @@ typedef struct xl_clog_truncate } xl_clog_truncate; extern void TransactionIdSetTreeStatus(TransactionId xid, int nsubxids, - TransactionId *subxids, XidStatus status, XLogRecPtr lsn); + TransactionId *subxids, XidStatus status, XLogRecPtr lsn); extern XidStatus TransactionIdGetStatus(TransactionId xid, XLogRecPtr *lsn); extern Size CLOGShmemBuffers(void); @@ -58,4 +58,4 @@ extern void clog_redo(XLogReaderState *record); extern void clog_desc(StringInfo buf, XLogReaderState *record); extern const char *clog_identify(uint8 info); -#endif /* CLOG_H */ +#endif /* CLOG_H */ diff --git a/src/include/access/commit_ts.h b/src/include/access/commit_ts.h index f172c91d8f..31936faf08 100644 --- a/src/include/access/commit_ts.h +++ b/src/include/access/commit_ts.h @@ -74,4 +74,4 @@ extern void commit_ts_redo(XLogReaderState *record); extern void commit_ts_desc(StringInfo buf, XLogReaderState *record); extern const char *commit_ts_identify(uint8 info); -#endif /* COMMIT_TS_H */ +#endif /* COMMIT_TS_H */ diff --git a/src/include/access/genam.h b/src/include/access/genam.h index f467b18a9c..b56a44f902 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -48,7 +48,7 @@ typedef struct IndexVacuumInfo bool estimated_count; /* num_heap_tuples is an estimate */ int message_level; /* ereport level for progress messages */ double num_heap_tuples; /* tuples remaining in heap */ - BufferAccessStrategy strategy; /* access strategy for reads */ + BufferAccessStrategy strategy; /* access strategy for reads */ } IndexVacuumInfo; /* @@ -73,7 +73,7 @@ typedef struct IndexBulkDeleteResult BlockNumber num_pages; /* pages remaining in index */ BlockNumber pages_removed; /* # removed during vacuum operation */ bool estimated_count; /* num_index_tuples is an estimate */ - double num_index_tuples; /* tuples remaining */ + double num_index_tuples; /* tuples remaining */ double tuples_removed; /* # removed during vacuum operation */ BlockNumber pages_deleted; /* # unused pages in index */ BlockNumber pages_free; /* # pages available for reuse */ @@ -152,7 +152,7 @@ extern void index_markpos(IndexScanDesc scan); extern void index_restrpos(IndexScanDesc scan); extern Size index_parallelscan_estimate(Relation indexrel, Snapshot snapshot); extern void index_parallelscan_initialize(Relation heaprel, Relation indexrel, - Snapshot snapshot, ParallelIndexScanDesc target); + Snapshot snapshot, ParallelIndexScanDesc target); extern void index_parallelrescan(IndexScanDesc scan); extern IndexScanDesc index_beginscan_parallel(Relation heaprel, Relation indexrel, int nkeys, int norderbys, @@ -203,4 +203,4 @@ extern HeapTuple systable_getnext_ordered(SysScanDesc sysscan, ScanDirection direction); extern void systable_endscan_ordered(SysScanDesc sysscan); -#endif /* GENAM_H */ +#endif /* GENAM_H */ diff --git a/src/include/access/generic_xlog.h b/src/include/access/generic_xlog.h index 0dc17f55f2..02696141ea 100644 --- a/src/include/access/generic_xlog.h +++ b/src/include/access/generic_xlog.h @@ -42,4 +42,4 @@ extern const char *generic_identify(uint8 info); extern void generic_desc(StringInfo buf, XLogReaderState *record); extern void generic_mask(char *pagedata, BlockNumber blkno); -#endif /* GENERIC_XLOG_H */ +#endif /* GENERIC_XLOG_H */ diff --git a/src/include/access/gin.h b/src/include/access/gin.h index bd9e8833de..ec83058095 100644 --- a/src/include/access/gin.h +++ b/src/include/access/gin.h @@ -33,7 +33,7 @@ #define GIN_SEARCH_MODE_DEFAULT 0 #define GIN_SEARCH_MODE_INCLUDE_EMPTY 1 #define GIN_SEARCH_MODE_ALL 2 -#define GIN_SEARCH_MODE_EVERYTHING 3 /* for internal use only */ +#define GIN_SEARCH_MODE_EVERYTHING 3 /* for internal use only */ /* * GinStatsData represents stats data for planner use @@ -73,4 +73,4 @@ extern int gin_pending_list_limit; extern void ginGetStats(Relation index, GinStatsData *stats); extern void ginUpdateStats(Relation index, const GinStatsData *stats); -#endif /* GIN_H */ +#endif /* GIN_H */ diff --git a/src/include/access/gin_private.h b/src/include/access/gin_private.h index 986fe6e041..adfdb0c6d9 100644 --- a/src/include/access/gin_private.h +++ b/src/include/access/gin_private.h @@ -75,7 +75,7 @@ typedef struct GinState FmgrInfo extractQueryFn[INDEX_MAX_KEYS]; FmgrInfo consistentFn[INDEX_MAX_KEYS]; FmgrInfo triConsistentFn[INDEX_MAX_KEYS]; - FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */ + FmgrInfo comparePartialFn[INDEX_MAX_KEYS]; /* optional method */ /* canPartialMatch[i] is true if comparePartialFn[i] is valid */ bool canPartialMatch[INDEX_MAX_KEYS]; /* Collations to pass to the support functions */ @@ -95,7 +95,7 @@ extern int ginCompareEntries(GinState *ginstate, OffsetNumber attnum, Datum b, GinNullCategory categoryb); extern int ginCompareAttEntries(GinState *ginstate, OffsetNumber attnuma, Datum a, GinNullCategory categorya, - OffsetNumber attnumb, Datum b, GinNullCategory categoryb); + OffsetNumber attnumb, Datum b, GinNullCategory categoryb); extern Datum *ginExtractEntries(GinState *ginstate, OffsetNumber attnum, Datum value, bool isNull, int32 *nentries, GinNullCategory **categories); @@ -309,7 +309,7 @@ typedef struct GinScanKeyData bool curItemMatches; bool recheckCurItem; bool isFinished; -} GinScanKeyData; +} GinScanKeyData; typedef struct GinScanEntryData { @@ -342,7 +342,7 @@ typedef struct GinScanEntryData bool reduceResult; uint32 predictNumberResult; GinBtreeData btree; -} GinScanEntryData; +} GinScanEntryData; typedef struct GinScanOpaqueData { @@ -473,4 +473,4 @@ ginCompareItemPointers(ItemPointer a, ItemPointer b) extern int ginTraverseLock(Buffer buffer, bool searchMode); -#endif /* GIN_PRIVATE_H */ +#endif /* GIN_PRIVATE_H */ diff --git a/src/include/access/ginblock.h b/src/include/access/ginblock.h index 438912c6a0..114370c7d7 100644 --- a/src/include/access/ginblock.h +++ b/src/include/access/ginblock.h @@ -41,7 +41,7 @@ typedef GinPageOpaqueData *GinPageOpaque; #define GIN_DELETED (1 << 2) #define GIN_META (1 << 3) #define GIN_LIST (1 << 4) -#define GIN_LIST_FULLROW (1 << 5) /* makes sense only on GIN_LIST page */ +#define GIN_LIST_FULLROW (1 << 5) /* makes sense only on GIN_LIST page */ #define GIN_INCOMPLETE_SPLIT (1 << 6) /* page was split, but parent not * updated */ #define GIN_COMPRESSED (1 << 7) @@ -196,10 +196,10 @@ typedef struct */ typedef signed char GinNullCategory; -#define GIN_CAT_NORM_KEY 0 /* normal, non-null key value */ -#define GIN_CAT_NULL_KEY 1 /* null key value */ -#define GIN_CAT_EMPTY_ITEM 2 /* placeholder for zero-key item */ -#define GIN_CAT_NULL_ITEM 3 /* placeholder for null item */ +#define GIN_CAT_NORM_KEY 0 /* normal, non-null key value */ +#define GIN_CAT_NULL_KEY 1 /* null key value */ +#define GIN_CAT_EMPTY_ITEM 2 /* placeholder for zero-key item */ +#define GIN_CAT_NULL_ITEM 3 /* placeholder for null item */ #define GIN_CAT_EMPTY_QUERY (-1) /* placeholder for full-scan query */ /* @@ -333,4 +333,4 @@ typedef struct #define SizeOfGinPostingList(plist) (offsetof(GinPostingList, bytes) + SHORTALIGN((plist)->nbytes) ) #define GinNextPostingListSegment(cur) ((GinPostingList *) (((char *) (cur)) + SizeOfGinPostingList((cur)))) -#endif /* GINBLOCK_H */ +#endif /* GINBLOCK_H */ diff --git a/src/include/access/ginxlog.h b/src/include/access/ginxlog.h index 8decc42cdb..42e0ae90c3 100644 --- a/src/include/access/ginxlog.h +++ b/src/include/access/ginxlog.h @@ -87,14 +87,14 @@ typedef struct * added, followed by the items themselves as ItemPointers. DELETE actions * have no further data. */ -} ginxlogSegmentAction; +} ginxlogSegmentAction; /* Action types */ -#define GIN_SEGMENT_UNMODIFIED 0 /* no action (not used in WAL records) */ -#define GIN_SEGMENT_DELETE 1 /* a whole segment is removed */ -#define GIN_SEGMENT_INSERT 2 /* a whole segment is added */ -#define GIN_SEGMENT_REPLACE 3 /* a segment is replaced */ -#define GIN_SEGMENT_ADDITEMS 4 /* items are added to existing segment */ +#define GIN_SEGMENT_UNMODIFIED 0 /* no action (not used in WAL records) */ +#define GIN_SEGMENT_DELETE 1 /* a whole segment is removed */ +#define GIN_SEGMENT_INSERT 2 /* a whole segment is added */ +#define GIN_SEGMENT_REPLACE 3 /* a segment is replaced */ +#define GIN_SEGMENT_ADDITEMS 4 /* items are added to existing segment */ typedef struct { @@ -214,4 +214,4 @@ extern void gin_xlog_startup(void); extern void gin_xlog_cleanup(void); extern void gin_mask(char *pagedata, BlockNumber blkno); -#endif /* GINXLOG_H */ +#endif /* GINXLOG_H */ diff --git a/src/include/access/gist.h b/src/include/access/gist.h index 5824e90bda..83642189db 100644 --- a/src/include/access/gist.h +++ b/src/include/access/gist.h @@ -105,12 +105,12 @@ typedef struct GIST_SPLITVEC OffsetNumber *spl_left; /* array of entries that go left */ int spl_nleft; /* size of this array */ Datum spl_ldatum; /* Union of keys in spl_left */ - bool spl_ldatum_exists; /* true, if spl_ldatum already exists. */ + bool spl_ldatum_exists; /* true, if spl_ldatum already exists. */ OffsetNumber *spl_right; /* array of entries that go right */ int spl_nright; /* size of the array */ Datum spl_rdatum; /* Union of keys in spl_right */ - bool spl_rdatum_exists; /* true, if spl_rdatum already exists. */ + bool spl_rdatum_exists; /* true, if spl_rdatum already exists. */ } GIST_SPLITVEC; /* @@ -170,4 +170,4 @@ typedef struct do { (e).key = (k); (e).rel = (r); (e).page = (pg); \ (e).offset = (o); (e).leafkey = (l); } while (0) -#endif /* GIST_H */ +#endif /* GIST_H */ diff --git a/src/include/access/gist_private.h b/src/include/access/gist_private.h index 1ad4ed6da7..bfef2df420 100644 --- a/src/include/access/gist_private.h +++ b/src/include/access/gist_private.h @@ -118,7 +118,7 @@ typedef struct GISTSearchHeapItem { ItemPointerData heapPtr; bool recheck; /* T if quals must be rechecked */ - bool recheckDistances; /* T if distances must be rechecked */ + bool recheckDistances; /* T if distances must be rechecked */ HeapTuple recontup; /* data reconstructed from the index, used in * index-only scans */ OffsetNumber offnum; /* track offset in page to mark tuple as @@ -136,8 +136,8 @@ typedef struct GISTSearchItem /* we must store parentlsn to detect whether a split occurred */ GISTSearchHeapItem heap; /* heap info, if heap tuple */ } data; - double distances[FLEXIBLE_ARRAY_MEMBER]; /* numberOfOrderBys - * entries */ + double distances[FLEXIBLE_ARRAY_MEMBER]; /* numberOfOrderBys + * entries */ } GISTSearchItem; #define GISTSearchItemIsHeap(item) ((item).blkno == InvalidBlockNumber) @@ -225,12 +225,12 @@ typedef struct GistSplitVector { GIST_SPLITVEC splitVector; /* passed to/from user PickSplit method */ - Datum spl_lattr[INDEX_MAX_KEYS]; /* Union of subkeys in - * splitVector.spl_left */ + Datum spl_lattr[INDEX_MAX_KEYS]; /* Union of subkeys in + * splitVector.spl_left */ bool spl_lisnull[INDEX_MAX_KEYS]; - Datum spl_rattr[INDEX_MAX_KEYS]; /* Union of subkeys in - * splitVector.spl_right */ + Datum spl_rattr[INDEX_MAX_KEYS]; /* Union of subkeys in + * splitVector.spl_right */ bool spl_risnull[INDEX_MAX_KEYS]; bool *spl_dontcare; /* flags tuples which could go to either side @@ -288,7 +288,7 @@ typedef struct int32 blocksCount; /* current # of blocks occupied by buffer */ BlockNumber pageBlocknum; /* temporary file block # */ - GISTNodeBufferPage *pageBuffer; /* in-memory buffer page */ + GISTNodeBufferPage *pageBuffer; /* in-memory buffer page */ /* is this buffer queued for emptying? */ bool queuedForEmptying; @@ -360,8 +360,8 @@ typedef struct GISTBuildBuffers * loaded in main memory. */ GISTNodeBuffer **loadedBuffers; - int loadedBuffersCount; /* # of entries in loadedBuffers */ - int loadedBuffersLen; /* allocated size of loadedBuffers */ + int loadedBuffersCount; /* # of entries in loadedBuffers */ + int loadedBuffersLen; /* allocated size of loadedBuffers */ /* Level of the current root node (= height of the index tree - 1) */ int rootlevel; @@ -522,4 +522,4 @@ extern void gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, List *splitinfo); extern void gistUnloadNodeBuffers(GISTBuildBuffers *gfbb); -#endif /* GIST_PRIVATE_H */ +#endif /* GIST_PRIVATE_H */ diff --git a/src/include/access/gistscan.h b/src/include/access/gistscan.h index 017740d14a..2aea6ad309 100644 --- a/src/include/access/gistscan.h +++ b/src/include/access/gistscan.h @@ -21,4 +21,4 @@ extern void gistrescan(IndexScanDesc scan, ScanKey key, int nkeys, ScanKey orderbys, int norderbys); extern void gistendscan(IndexScanDesc scan); -#endif /* GISTSCAN_H */ +#endif /* GISTSCAN_H */ diff --git a/src/include/access/hash.h b/src/include/access/hash.h index c608b03bb0..4e50a843f7 100644 --- a/src/include/access/hash.h +++ b/src/include/access/hash.h @@ -145,8 +145,7 @@ typedef struct HashScanOpaqueData */ bool hashso_buc_split; /* info about killed items if any (killedItems is NULL if never used) */ - HashScanPosItem *killedItems; /* tids and offset numbers of killed - * items */ + HashScanPosItem *killedItems; /* tids and offset numbers of killed items */ int numKilled; /* number of currently stored items */ } HashScanOpaqueData; @@ -213,13 +212,13 @@ typedef struct HashMetaPageData uint32 hashm_maxbucket; /* ID of maximum bucket in use */ uint32 hashm_highmask; /* mask to modulo into entire table */ uint32 hashm_lowmask; /* mask to modulo into lower half of table */ - uint32 hashm_ovflpoint;/* splitpoint from which ovflpgs being - * allocated */ + uint32 hashm_ovflpoint; /* splitpoint from which ovflpgs being + * allocated */ uint32 hashm_firstfree; /* lowest-number free ovflpage (bit#) */ uint32 hashm_nmaps; /* number of bitmap pages */ RegProcedure hashm_procid; /* hash procedure id from pg_proc */ - uint32 hashm_spares[HASH_MAX_SPLITPOINTS]; /* spare pages before - * each splitpoint */ + uint32 hashm_spares[HASH_MAX_SPLITPOINTS]; /* spare pages before each + * splitpoint */ BlockNumber hashm_mapp[HASH_MAX_BITMAPS]; /* blknos of ovfl bitmaps */ } HashMetaPageData; @@ -242,7 +241,7 @@ typedef HashMetaPageData *HashMetaPage; /* * Constants */ -#define BYTE_TO_BIT 3 /* 2^3 bits/byte */ +#define BYTE_TO_BIT 3 /* 2^3 bits/byte */ #define ALL_SET ((uint32) ~0) /* @@ -339,7 +338,7 @@ extern void _hash_pgaddmultitup(Relation rel, Buffer buf, IndexTuple *itups, extern Buffer _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf, bool retain_pin); extern BlockNumber _hash_freeovflpage(Relation rel, Buffer bucketbuf, Buffer ovflbuf, Buffer wbuf, IndexTuple *itups, OffsetNumber *itup_offsets, - Size *tups_size, uint16 nitups, BufferAccessStrategy bstrategy); + Size *tups_size, uint16 nitups, BufferAccessStrategy bstrategy); extern void _hash_initbitmapbuffer(Buffer buf, uint16 bmsize, bool initpage); extern void _hash_squeezebucket(Relation rel, Bucket bucket, BlockNumber bucket_blkno, @@ -428,4 +427,4 @@ extern Datum compute_hash(Oid type, Datum value, char locator); extern char *get_compute_hash_function(Oid type, char locator); #endif -#endif /* HASH_H */ +#endif /* HASH_H */ diff --git a/src/include/access/hash_xlog.h b/src/include/access/hash_xlog.h index d4a6a71ca7..c778fdc8df 100644 --- a/src/include/access/hash_xlog.h +++ b/src/include/access/hash_xlog.h @@ -24,14 +24,13 @@ /* * XLOG records for hash operations */ -#define XLOG_HASH_INIT_META_PAGE 0x00 /* initialize the meta page */ -#define XLOG_HASH_INIT_BITMAP_PAGE 0x10 /* initialize the bitmap page */ +#define XLOG_HASH_INIT_META_PAGE 0x00 /* initialize the meta page */ +#define XLOG_HASH_INIT_BITMAP_PAGE 0x10 /* initialize the bitmap page */ #define XLOG_HASH_INSERT 0x20 /* add index tuple without split */ #define XLOG_HASH_ADD_OVFL_PAGE 0x30 /* add overflow page */ #define XLOG_HASH_SPLIT_ALLOCATE_PAGE 0x40 /* allocate new page for split */ #define XLOG_HASH_SPLIT_PAGE 0x50 /* split page */ -#define XLOG_HASH_SPLIT_COMPLETE 0x60 /* completion of split - * operation */ +#define XLOG_HASH_SPLIT_COMPLETE 0x60 /* completion of split operation */ #define XLOG_HASH_MOVE_PAGE_CONTENTS 0x70 /* remove tuples from one page * and add to another page */ #define XLOG_HASH_SQUEEZE_PAGE 0x80 /* add tuples to one of the previous @@ -41,11 +40,10 @@ #define XLOG_HASH_SPLIT_CLEANUP 0xA0 /* clear split-cleanup flag in primary * bucket page after deleting tuples * that are moved due to split */ -#define XLOG_HASH_UPDATE_META_PAGE 0xB0 /* update meta page after - * vacuum */ +#define XLOG_HASH_UPDATE_META_PAGE 0xB0 /* update meta page after vacuum */ -#define XLOG_HASH_VACUUM_ONE_PAGE 0xC0 /* remove dead tuples from - * index page */ +#define XLOG_HASH_VACUUM_ONE_PAGE 0xC0 /* remove dead tuples from index + * page */ /* * xl_hash_split_allocate_page flag values, 8 bits are available. @@ -63,7 +61,7 @@ typedef struct xl_hash_createidx double num_tuples; RegProcedure procid; uint16 ffactor; -} xl_hash_createidx; +} xl_hash_createidx; #define SizeOfHashCreateIdx (offsetof(xl_hash_createidx, ffactor) + sizeof(uint16)) /* @@ -151,9 +149,9 @@ typedef struct xl_hash_split_complete typedef struct xl_hash_move_page_contents { uint16 ntups; - bool is_prim_bucket_same_wrt; /* TRUE if the page to which - * tuples are moved is same as - * primary bucket page */ + bool is_prim_bucket_same_wrt; /* TRUE if the page to which + * tuples are moved is same as + * primary bucket page */ } xl_hash_move_page_contents; #define SizeOfHashMovePageContents \ @@ -176,13 +174,13 @@ typedef struct xl_hash_squeeze_page BlockNumber prevblkno; BlockNumber nextblkno; uint16 ntups; - bool is_prim_bucket_same_wrt; /* TRUE if the page to which - * tuples are moved is same as - * primary bucket page */ - bool is_prev_bucket_same_wrt; /* TRUE if the page to which - * tuples are moved is the - * page previous to the freed - * overflow page */ + bool is_prim_bucket_same_wrt; /* TRUE if the page to which + * tuples are moved is same as + * primary bucket page */ + bool is_prev_bucket_same_wrt; /* TRUE if the page to which + * tuples are moved is the page + * previous to the freed overflow + * page */ } xl_hash_squeeze_page; #define SizeOfHashSqueezePage \ @@ -198,8 +196,8 @@ typedef struct xl_hash_squeeze_page */ typedef struct xl_hash_delete { - bool clear_dead_marking; /* TRUE if this operation clears - * LH_PAGE_HAS_DEAD_TUPLES flag */ + bool clear_dead_marking; /* TRUE if this operation clears + * LH_PAGE_HAS_DEAD_TUPLES flag */ bool is_primary_bucket_page; /* TRUE if the operation is for * primary bucket page */ } xl_hash_delete; @@ -279,4 +277,4 @@ extern void hash_desc(StringInfo buf, XLogReaderState *record); extern const char *hash_identify(uint8 info); extern void hash_mask(char *pagedata, BlockNumber blkno); -#endif /* HASH_XLOG_H */ +#endif /* HASH_XLOG_H */ diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h index 7e85510d2f..b2132e723e 100644 --- a/src/include/access/heapam.h +++ b/src/include/access/heapam.h @@ -117,13 +117,13 @@ extern HeapScanDesc heap_beginscan_bm(Relation relation, Snapshot snapshot, int nkeys, ScanKey key); extern HeapScanDesc heap_beginscan_sampling(Relation relation, Snapshot snapshot, int nkeys, ScanKey key, - bool allow_strat, bool allow_sync, bool allow_pagemode); + bool allow_strat, bool allow_sync, bool allow_pagemode); extern void heap_setscanlimits(HeapScanDesc scan, BlockNumber startBlk, BlockNumber endBlk); extern void heapgetpage(HeapScanDesc scan, BlockNumber page); extern void heap_rescan(HeapScanDesc scan, ScanKey key); extern void heap_rescan_set_params(HeapScanDesc scan, ScanKey key, - bool allow_strat, bool allow_sync, bool allow_pagemode); + bool allow_strat, bool allow_sync, bool allow_pagemode); extern void heap_endscan(HeapScanDesc scan); extern HeapTuple heap_getnext(HeapScanDesc scan, ScanDirection direction); @@ -198,4 +198,4 @@ extern BlockNumber ss_get_location(Relation rel, BlockNumber relnblocks); extern void SyncScanShmemInit(void); extern Size SyncScanShmemSize(void); -#endif /* HEAPAM_H */ +#endif /* HEAPAM_H */ diff --git a/src/include/access/heapam_xlog.h b/src/include/access/heapam_xlog.h index b285f172aa..81a6a395c4 100644 --- a/src/include/access/heapam_xlog.h +++ b/src/include/access/heapam_xlog.h @@ -189,7 +189,7 @@ typedef struct xl_heap_update { TransactionId old_xmax; /* xmax of the old tuple */ OffsetNumber old_offnum; /* old tuple's offset */ - uint8 old_infobits_set; /* infomask bits to set on old tuple */ + uint8 old_infobits_set; /* infomask bits to set on old tuple */ uint8 flags; TransactionId new_xmax; /* xmax of the new tuple */ OffsetNumber new_offnum; /* new tuple's offset */ @@ -399,4 +399,4 @@ extern void heap_execute_freeze_tuple(HeapTupleHeader tuple, extern XLogRecPtr log_heap_visible(RelFileNode rnode, Buffer heap_buffer, Buffer vm_buffer, TransactionId cutoff_xid, uint8 flags); -#endif /* HEAPAM_XLOG_H */ +#endif /* HEAPAM_XLOG_H */ diff --git a/src/include/access/hio.h b/src/include/access/hio.h index 2824f23218..4a8beb63a6 100644 --- a/src/include/access/hio.h +++ b/src/include/access/hio.h @@ -30,9 +30,9 @@ */ typedef struct BulkInsertStateData { - BufferAccessStrategy strategy; /* our BULKWRITE strategy object */ + BufferAccessStrategy strategy; /* our BULKWRITE strategy object */ Buffer current_buf; /* current insertion target page */ -} BulkInsertStateData; +} BulkInsertStateData; extern void RelationPutHeapTuple(Relation relation, Buffer buffer, @@ -42,4 +42,4 @@ extern Buffer RelationGetBufferForTuple(Relation relation, Size len, BulkInsertState bistate, Buffer *vmbuffer, Buffer *vmbuffer_other); -#endif /* HIO_H */ +#endif /* HIO_H */ diff --git a/src/include/access/htup.h b/src/include/access/htup.h index 1d31b5f1c2..187f18c735 100644 --- a/src/include/access/htup.h +++ b/src/include/access/htup.h @@ -105,4 +105,4 @@ extern void HeapTupleHeaderAdjustCmax(HeapTupleHeader tup, /* Prototype for HeapTupleHeader accessors in heapam.c */ extern TransactionId HeapTupleGetUpdateXid(HeapTupleHeader tuple); -#endif /* HTUP_H */ +#endif /* HTUP_H */ diff --git a/src/include/access/htup_details.h b/src/include/access/htup_details.h index e365f4f2b4..3e1676c7e6 100644 --- a/src/include/access/htup_details.h +++ b/src/include/access/htup_details.h @@ -748,7 +748,7 @@ struct MinimalTupleData extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull); -#endif /* defined(DISABLE_COMPLEX_MACRO) */ +#endif /* defined(DISABLE_COMPLEX_MACRO) */ /* ---------------- @@ -821,4 +821,4 @@ extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup); extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup); extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup); -#endif /* HTUP_DETAILS_H */ +#endif /* HTUP_DETAILS_H */ diff --git a/src/include/access/itup.h b/src/include/access/itup.h index e9ec8e27e2..a94e7948b4 100644 --- a/src/include/access/itup.h +++ b/src/include/access/itup.h @@ -55,9 +55,9 @@ typedef IndexTupleData *IndexTuple; typedef struct IndexAttributeBitMapData { bits8 bits[(INDEX_MAX_KEYS + 8 - 1) / 8]; -} IndexAttributeBitMapData; +} IndexAttributeBitMapData; -typedef IndexAttributeBitMapData *IndexAttributeBitMap; +typedef IndexAttributeBitMapData * IndexAttributeBitMap; /* * t_info manipulation macros @@ -148,4 +148,4 @@ extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor, Datum *values, bool *isnull); extern IndexTuple CopyIndexTuple(IndexTuple source); -#endif /* ITUP_H */ +#endif /* ITUP_H */ diff --git a/src/include/access/multixact.h b/src/include/access/multixact.h index 85997a41fa..d5e18c6733 100644 --- a/src/include/access/multixact.h +++ b/src/include/access/multixact.h @@ -157,4 +157,4 @@ extern const char *multixact_identify(uint8 info); extern char *mxid_to_string(MultiXactId multi, int nmembers, MultiXactMember *members); -#endif /* MULTIXACT_H */ +#endif /* MULTIXACT_H */ diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 15771ce9e0..e6abbec280 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -421,9 +421,9 @@ typedef BTScanOpaqueData *BTScanOpaque; * to use bits 16-31 (see skey.h). The uppermost bits are copied from the * index's indoption[] array entry for the index attribute. */ -#define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */ -#define SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */ -#define SK_BT_INDOPTION_SHIFT 24 /* must clear the above bits */ +#define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */ +#define SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */ +#define SK_BT_INDOPTION_SHIFT 24 /* must clear the above bits */ #define SK_BT_DESC (INDOPTION_DESC << SK_BT_INDOPTION_SHIFT) #define SK_BT_NULLS_FIRST (INDOPTION_NULLS_FIRST << SK_BT_INDOPTION_SHIFT) @@ -556,4 +556,4 @@ extern void _bt_spool(BTSpool *btspool, ItemPointer self, Datum *values, bool *isnull); extern void _bt_leafbuild(BTSpool *btspool, BTSpool *spool2); -#endif /* NBTREE_H */ +#endif /* NBTREE_H */ diff --git a/src/include/access/nbtxlog.h b/src/include/access/nbtxlog.h index d6a3085923..a46e9c36f3 100644 --- a/src/include/access/nbtxlog.h +++ b/src/include/access/nbtxlog.h @@ -32,9 +32,9 @@ #define XLOG_BTREE_SPLIT_R_ROOT 0x60 /* as above, new item on right */ #define XLOG_BTREE_DELETE 0x70 /* delete leaf index tuples for a page */ #define XLOG_BTREE_UNLINK_PAGE 0x80 /* delete a half-dead page */ -#define XLOG_BTREE_UNLINK_PAGE_META 0x90 /* same, and update metapage */ +#define XLOG_BTREE_UNLINK_PAGE_META 0x90 /* same, and update metapage */ #define XLOG_BTREE_NEWROOT 0xA0 /* new root page */ -#define XLOG_BTREE_MARK_PAGE_HALFDEAD 0xB0 /* mark a leaf as half-dead */ +#define XLOG_BTREE_MARK_PAGE_HALFDEAD 0xB0 /* mark a leaf as half-dead */ #define XLOG_BTREE_VACUUM 0xC0 /* delete entries on a page during * vacuum */ #define XLOG_BTREE_REUSE_PAGE 0xD0 /* old page is about to be reused from @@ -252,4 +252,4 @@ extern void btree_desc(StringInfo buf, XLogReaderState *record); extern const char *btree_identify(uint8 info); extern void btree_mask(char *pagedata, BlockNumber blkno); -#endif /* NBXLOG_H */ +#endif /* NBXLOG_H */ diff --git a/src/include/access/parallel.h b/src/include/access/parallel.h index 590e27a484..e3e0cecf1e 100644 --- a/src/include/access/parallel.h +++ b/src/include/access/parallel.h @@ -67,4 +67,4 @@ extern void ParallelWorkerReportLastRecEnd(XLogRecPtr last_xlog_end); extern void ParallelWorkerMain(Datum main_arg); -#endif /* PARALLEL_H */ +#endif /* PARALLEL_H */ diff --git a/src/include/access/printsimple.h b/src/include/access/printsimple.h index 3f3e7a3840..edf28cece9 100644 --- a/src/include/access/printsimple.h +++ b/src/include/access/printsimple.h @@ -20,4 +20,4 @@ extern bool printsimple(TupleTableSlot *slot, DestReceiver *self); extern void printsimple_startup(DestReceiver *self, int operation, TupleDesc tupdesc); -#endif /* PRINTSIMPLE_H */ +#endif /* PRINTSIMPLE_H */ diff --git a/src/include/access/printtup.h b/src/include/access/printtup.h index a828889c4f..641715e416 100644 --- a/src/include/access/printtup.h +++ b/src/include/access/printtup.h @@ -32,4 +32,4 @@ extern void spi_dest_startup(DestReceiver *self, int operation, TupleDesc typeinfo); extern bool spi_printtup(TupleTableSlot *slot, DestReceiver *self); -#endif /* PRINTTUP_H */ +#endif /* PRINTTUP_H */ diff --git a/src/include/access/reloptions.h b/src/include/access/reloptions.h index 91b2cd7bb2..5cdaa3bff1 100644 --- a/src/include/access/reloptions.h +++ b/src/include/access/reloptions.h @@ -280,4 +280,4 @@ extern bytea *attribute_reloptions(Datum reloptions, bool validate); extern bytea *tablespace_reloptions(Datum reloptions, bool validate); extern LOCKMODE AlterTableGetRelOptionsLockLevel(List *defList); -#endif /* RELOPTIONS_H */ +#endif /* RELOPTIONS_H */ diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h index f4d4f1ee71..a20646b2b7 100644 --- a/src/include/access/relscan.h +++ b/src/include/access/relscan.h @@ -39,7 +39,7 @@ typedef struct ParallelHeapScanDescData BlockNumber phs_startblock; /* starting block number */ BlockNumber phs_cblock; /* current block number */ char phs_snapshot_data[FLEXIBLE_ARRAY_MEMBER]; -} ParallelHeapScanDescData; +} ParallelHeapScanDescData; typedef struct HeapScanDescData { @@ -75,7 +75,7 @@ typedef struct HeapScanDescData int rs_cindex; /* current tuple's index in vistuples */ int rs_ntuples; /* number of visible tuples on page */ OffsetNumber rs_vistuples[MaxHeapTuplesPerPage]; /* their offsets */ -} HeapScanDescData; +} HeapScanDescData; /* * We use the same IndexScanDescData structure for both amgettuple-based @@ -89,14 +89,14 @@ typedef struct IndexScanDescData Relation indexRelation; /* index relation descriptor */ Snapshot xs_snapshot; /* snapshot to see */ int numberOfKeys; /* number of index qualifier conditions */ - int numberOfOrderBys; /* number of ordering operators */ + int numberOfOrderBys; /* number of ordering operators */ ScanKey keyData; /* array of index qualifier descriptors */ ScanKey orderByData; /* array of ordering op descriptors */ bool xs_want_itup; /* caller requests index tuples */ bool xs_temp_snap; /* unregister snapshot at scan end? */ /* signaling to index AM about killing index tuples */ - bool kill_prior_tuple; /* last-returned tuple is dead */ + bool kill_prior_tuple; /* last-returned tuple is dead */ bool ignore_killed_tuples; /* do not return killed entries */ bool xactStartedInRecovery; /* prevents killing/seeing killed * tuples */ @@ -137,7 +137,7 @@ typedef struct IndexScanDescData /* parallel index scan information, in shared memory */ ParallelIndexScanDesc parallel_scan; -} IndexScanDescData; +} IndexScanDescData; /* Generic structure for parallel scans */ typedef struct ParallelIndexScanDescData @@ -146,7 +146,7 @@ typedef struct ParallelIndexScanDescData Oid ps_indexid; Size ps_offset; /* Offset in bytes of am specific structure */ char ps_snapshot_data[FLEXIBLE_ARRAY_MEMBER]; -} ParallelIndexScanDescData; +} ParallelIndexScanDescData; /* Struct for heap-or-index scans of system tables */ typedef struct SysScanDescData @@ -156,6 +156,6 @@ typedef struct SysScanDescData HeapScanDesc scan; /* only valid in heap-scan case */ IndexScanDesc iscan; /* only valid in index-scan case */ Snapshot snapshot; /* snapshot to unregister at end of scan */ -} SysScanDescData; +} SysScanDescData; -#endif /* RELSCAN_H */ +#endif /* RELSCAN_H */ diff --git a/src/include/access/rewriteheap.h b/src/include/access/rewriteheap.h index 564c2ad0f5..91ff36707a 100644 --- a/src/include/access/rewriteheap.h +++ b/src/include/access/rewriteheap.h @@ -54,4 +54,4 @@ typedef struct LogicalRewriteMappingData #define LOGICAL_REWRITE_FORMAT "map-%x-%x-%X_%X-%x-%x" void CheckPointLogicalRewriteHeap(void); -#endif /* REWRITE_HEAP_H */ +#endif /* REWRITE_HEAP_H */ diff --git a/src/include/access/rmgr.h b/src/include/access/rmgr.h index 64b92ff33a..c9b5c56a4c 100644 --- a/src/include/access/rmgr.h +++ b/src/include/access/rmgr.h @@ -32,4 +32,4 @@ typedef enum RmgrIds #define RM_MAX_ID (RM_NEXT_ID - 1) -#endif /* RMGR_H */ +#endif /* RMGR_H */ diff --git a/src/include/access/sdir.h b/src/include/access/sdir.h index 347e910a41..65eab48551 100644 --- a/src/include/access/sdir.h +++ b/src/include/access/sdir.h @@ -55,4 +55,4 @@ typedef enum ScanDirection #define ScanDirectionIsForward(direction) \ ((bool) ((direction) == ForwardScanDirection)) -#endif /* SDIR_H */ +#endif /* SDIR_H */ diff --git a/src/include/access/skey.h b/src/include/access/skey.h index 01cc940363..2f4814f140 100644 --- a/src/include/access/skey.h +++ b/src/include/access/skey.h @@ -112,16 +112,15 @@ typedef ScanKeyData *ScanKey; * bits should be defined here). Bits 16-31 are reserved for use within * individual index access methods. */ -#define SK_ISNULL 0x0001 /* sk_argument is NULL */ -#define SK_UNARY 0x0002 /* unary operator (not supported!) */ -#define SK_ROW_HEADER 0x0004 /* row comparison header (see above) */ -#define SK_ROW_MEMBER 0x0008 /* row comparison member (see above) */ -#define SK_ROW_END 0x0010 /* last row comparison member */ -#define SK_SEARCHARRAY 0x0020 /* scankey represents ScalarArrayOp */ -#define SK_SEARCHNULL 0x0040 /* scankey represents "col IS NULL" */ -#define SK_SEARCHNOTNULL 0x0080 /* scankey represents "col IS NOT - * NULL" */ -#define SK_ORDER_BY 0x0100 /* scankey is for ORDER BY op */ +#define SK_ISNULL 0x0001 /* sk_argument is NULL */ +#define SK_UNARY 0x0002 /* unary operator (not supported!) */ +#define SK_ROW_HEADER 0x0004 /* row comparison header (see above) */ +#define SK_ROW_MEMBER 0x0008 /* row comparison member (see above) */ +#define SK_ROW_END 0x0010 /* last row comparison member */ +#define SK_SEARCHARRAY 0x0020 /* scankey represents ScalarArrayOp */ +#define SK_SEARCHNULL 0x0040 /* scankey represents "col IS NULL" */ +#define SK_SEARCHNOTNULL 0x0080 /* scankey represents "col IS NOT NULL" */ +#define SK_ORDER_BY 0x0100 /* scankey is for ORDER BY op */ /* @@ -149,4 +148,4 @@ extern void ScanKeyEntryInitializeWithInfo(ScanKey entry, FmgrInfo *finfo, Datum argument); -#endif /* SKEY_H */ +#endif /* SKEY_H */ diff --git a/src/include/access/slru.h b/src/include/access/slru.h index 722867d5d2..f1b4d6cc9d 100644 --- a/src/include/access/slru.h +++ b/src/include/access/slru.h @@ -155,7 +155,7 @@ extern void SimpleLruTruncate(SlruCtl ctl, int cutoffPage); extern bool SimpleLruDoesPhysicalPageExist(SlruCtl ctl, int pageno); typedef bool (*SlruScanCallback) (SlruCtl ctl, char *filename, int segpage, - void *data); + void *data); extern bool SlruScanDirectory(SlruCtl ctl, SlruScanCallback callback, void *data); extern void SlruDeleteSegment(SlruCtl ctl, int segno); @@ -165,4 +165,4 @@ extern bool SlruScanDirCbReportPresence(SlruCtl ctl, char *filename, extern bool SlruScanDirCbDeleteAll(SlruCtl ctl, char *filename, int segpage, void *data); -#endif /* SLRU_H */ +#endif /* SLRU_H */ diff --git a/src/include/access/spgist.h b/src/include/access/spgist.h index 9dca8fde7d..d1bc396e6d 100644 --- a/src/include/access/spgist.h +++ b/src/include/access/spgist.h @@ -74,33 +74,33 @@ typedef enum spgChooseResultType typedef struct spgChooseOut { - spgChooseResultType resultType; /* action code, see above */ + spgChooseResultType resultType; /* action code, see above */ union { struct /* results for spgMatchNode */ { int nodeN; /* descend to this node (index from 0) */ - int levelAdd; /* increment level by this much */ - Datum restDatum; /* new leaf datum */ + int levelAdd; /* increment level by this much */ + Datum restDatum; /* new leaf datum */ } matchNode; struct /* results for spgAddNode */ { - Datum nodeLabel; /* new node's label */ + Datum nodeLabel; /* new node's label */ int nodeN; /* where to insert it (index from 0) */ } addNode; struct /* results for spgSplitTuple */ { /* Info to form new upper-level inner tuple with one child tuple */ - bool prefixHasPrefix; /* tuple should have a prefix? */ - Datum prefixPrefixDatum; /* if so, its value */ + bool prefixHasPrefix; /* tuple should have a prefix? */ + Datum prefixPrefixDatum; /* if so, its value */ int prefixNNodes; /* number of nodes */ - Datum *prefixNodeLabels; /* their labels (or NULL for - * no labels) */ - int childNodeN; /* which node gets child tuple */ + Datum *prefixNodeLabels; /* their labels (or NULL for no + * labels) */ + int childNodeN; /* which node gets child tuple */ /* Info to form new lower-level inner tuple with all old nodes */ - bool postfixHasPrefix; /* tuple should have a prefix? */ - Datum postfixPrefixDatum; /* if so, its value */ + bool postfixHasPrefix; /* tuple should have a prefix? */ + Datum postfixPrefixDatum; /* if so, its value */ } splitTuple; } result; } spgChooseOut; @@ -123,7 +123,7 @@ typedef struct spgPickSplitOut int nNodes; /* number of nodes for new inner tuple */ Datum *nodeLabels; /* their labels (or NULL for no labels) */ - int *mapTuplesToNodes; /* node index for each leaf tuple */ + int *mapTuplesToNodes; /* node index for each leaf tuple */ Datum *leafTupleDatums; /* datum to store in each new leaf tuple */ } spgPickSplitOut; @@ -135,10 +135,9 @@ typedef struct spgInnerConsistentIn ScanKey scankeys; /* array of operators and comparison values */ int nkeys; /* length of array */ - Datum reconstructedValue; /* value reconstructed at parent */ + Datum reconstructedValue; /* value reconstructed at parent */ void *traversalValue; /* opclass-specific traverse value */ - MemoryContext traversalMemoryContext; /* put new traverse values - * here */ + MemoryContext traversalMemoryContext; /* put new traverse values here */ int level; /* current level (counting from zero) */ bool returnData; /* original data must be returned? */ @@ -167,7 +166,7 @@ typedef struct spgLeafConsistentIn ScanKey scankeys; /* array of operators and comparison values */ int nkeys; /* length of array */ - Datum reconstructedValue; /* value reconstructed at parent */ + Datum reconstructedValue; /* value reconstructed at parent */ void *traversalValue; /* opclass-specific traverse value */ int level; /* current level (counting from zero) */ bool returnData; /* original data must be returned? */ @@ -214,4 +213,4 @@ extern IndexBulkDeleteResult *spgvacuumcleanup(IndexVacuumInfo *info, /* spgvalidate.c */ extern bool spgvalidate(Oid opclassoid); -#endif /* SPGIST_H */ +#endif /* SPGIST_H */ diff --git a/src/include/access/spgist_private.h b/src/include/access/spgist_private.h index 4072c050de..1c4b321b6c 100644 --- a/src/include/access/spgist_private.h +++ b/src/include/access/spgist_private.h @@ -48,8 +48,8 @@ typedef SpGistPageOpaqueData *SpGistPageOpaque; /* Flag bits in page special space */ #define SPGIST_META (1<<0) -#define SPGIST_DELETED (1<<1) /* never set, but keep for backwards - * compatibility */ +#define SPGIST_DELETED (1<<1) /* never set, but keep for backwards + * compatibility */ #define SPGIST_LEAF (1<<2) #define SPGIST_NULLS (1<<3) @@ -94,7 +94,7 @@ typedef struct SpGistLUPCache typedef struct SpGistMetaPageData { uint32 magicNumber; /* for identity cross-check */ - SpGistLUPCache lastUsedPages; /* shared storage of last-used info */ + SpGistLUPCache lastUsedPages; /* shared storage of last-used info */ } SpGistMetaPageData; #define SPGIST_MAGIC_NUMBER (0xBA0BABEE) @@ -120,10 +120,10 @@ typedef struct SpGistState spgConfigOut config; /* filled in by opclass config method */ SpGistTypeDesc attType; /* type of input data and leaf values */ - SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ + SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ SpGistTypeDesc attLabelType; /* type of node label values */ - char *deadTupleStorage; /* workspace for spgFormDeadTuple */ + char *deadTupleStorage; /* workspace for spgFormDeadTuple */ TransactionId myXid; /* XID to use when creating a redirect tuple */ bool isBuild; /* true if doing index build */ @@ -159,7 +159,7 @@ typedef struct SpGistScanOpaqueData int iPtr; /* index for scanning through same */ ItemPointerData heapPtrs[MaxIndexTuplesPerPage]; /* TIDs from cur page */ bool recheck[MaxIndexTuplesPerPage]; /* their recheck flags */ - HeapTuple reconTups[MaxIndexTuplesPerPage]; /* reconstructed tuples */ + HeapTuple reconTups[MaxIndexTuplesPerPage]; /* reconstructed tuples */ /* * Note: using MaxIndexTuplesPerPage above is a bit hokey since @@ -179,10 +179,10 @@ typedef struct SpGistCache spgConfigOut config; /* filled in by opclass config method */ SpGistTypeDesc attType; /* type of input data and leaf values */ - SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ + SpGistTypeDesc attPrefixType; /* type of inner-tuple prefix values */ SpGistTypeDesc attLabelType; /* type of node label values */ - SpGistLUPCache lastUsedPages; /* local storage of last-used info */ + SpGistLUPCache lastUsedPages; /* local storage of last-used info */ } SpGistCache; @@ -418,4 +418,4 @@ extern void spgPageIndexMultiDelete(SpGistState *state, Page page, extern bool spgdoinsert(Relation index, SpGistState *state, ItemPointer heapPtr, Datum datum, bool isnull); -#endif /* SPGIST_PRIVATE_H */ +#endif /* SPGIST_PRIVATE_H */ diff --git a/src/include/access/spgxlog.h b/src/include/access/spgxlog.h index ff597f75db..cf4331be4a 100644 --- a/src/include/access/spgxlog.h +++ b/src/include/access/spgxlog.h @@ -238,7 +238,7 @@ typedef struct spgxlogVacuumRoot typedef struct spgxlogVacuumRedirect { uint16 nToPlaceholder; /* number of redirects to make placeholders */ - OffsetNumber firstPlaceholder; /* first placeholder tuple to remove */ + OffsetNumber firstPlaceholder; /* first placeholder tuple to remove */ TransactionId newestRedirectXid; /* newest XID of removed redirects */ /* offsets of redirect tuples to make placeholders follow */ @@ -254,4 +254,4 @@ extern void spg_xlog_startup(void); extern void spg_xlog_cleanup(void); extern void spg_mask(char *pagedata, BlockNumber blkno); -#endif /* SPGXLOG_H */ +#endif /* SPGXLOG_H */ diff --git a/src/include/access/stratnum.h b/src/include/access/stratnum.h index 489e5c595e..91d57605b2 100644 --- a/src/include/access/stratnum.h +++ b/src/include/access/stratnum.h @@ -41,35 +41,35 @@ typedef uint16 StrategyNumber; * The first few of these come from the R-Tree indexing method (hence the * names); the others have been added over time as they have been needed. */ -#define RTLeftStrategyNumber 1 /* for << */ -#define RTOverLeftStrategyNumber 2 /* for &< */ -#define RTOverlapStrategyNumber 3 /* for && */ -#define RTOverRightStrategyNumber 4 /* for &> */ -#define RTRightStrategyNumber 5 /* for >> */ -#define RTSameStrategyNumber 6 /* for ~= */ -#define RTContainsStrategyNumber 7 /* for @> */ -#define RTContainedByStrategyNumber 8 /* for <@ */ -#define RTOverBelowStrategyNumber 9 /* for &<| */ -#define RTBelowStrategyNumber 10 /* for <<| */ -#define RTAboveStrategyNumber 11 /* for |>> */ -#define RTOverAboveStrategyNumber 12 /* for |&> */ -#define RTOldContainsStrategyNumber 13 /* for old spelling of @> */ -#define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */ -#define RTKNNSearchStrategyNumber 15 /* for <-> (distance) */ -#define RTContainsElemStrategyNumber 16 /* for range types @> elem */ -#define RTAdjacentStrategyNumber 17 /* for -|- */ -#define RTEqualStrategyNumber 18 /* for = */ -#define RTNotEqualStrategyNumber 19 /* for != */ -#define RTLessStrategyNumber 20 /* for < */ -#define RTLessEqualStrategyNumber 21 /* for <= */ -#define RTGreaterStrategyNumber 22 /* for > */ -#define RTGreaterEqualStrategyNumber 23 /* for >= */ -#define RTSubStrategyNumber 24 /* for inet >> */ -#define RTSubEqualStrategyNumber 25 /* for inet <<= */ -#define RTSuperStrategyNumber 26 /* for inet << */ -#define RTSuperEqualStrategyNumber 27 /* for inet >>= */ +#define RTLeftStrategyNumber 1 /* for << */ +#define RTOverLeftStrategyNumber 2 /* for &< */ +#define RTOverlapStrategyNumber 3 /* for && */ +#define RTOverRightStrategyNumber 4 /* for &> */ +#define RTRightStrategyNumber 5 /* for >> */ +#define RTSameStrategyNumber 6 /* for ~= */ +#define RTContainsStrategyNumber 7 /* for @> */ +#define RTContainedByStrategyNumber 8 /* for <@ */ +#define RTOverBelowStrategyNumber 9 /* for &<| */ +#define RTBelowStrategyNumber 10 /* for <<| */ +#define RTAboveStrategyNumber 11 /* for |>> */ +#define RTOverAboveStrategyNumber 12 /* for |&> */ +#define RTOldContainsStrategyNumber 13 /* for old spelling of @> */ +#define RTOldContainedByStrategyNumber 14 /* for old spelling of <@ */ +#define RTKNNSearchStrategyNumber 15 /* for <-> (distance) */ +#define RTContainsElemStrategyNumber 16 /* for range types @> elem */ +#define RTAdjacentStrategyNumber 17 /* for -|- */ +#define RTEqualStrategyNumber 18 /* for = */ +#define RTNotEqualStrategyNumber 19 /* for != */ +#define RTLessStrategyNumber 20 /* for < */ +#define RTLessEqualStrategyNumber 21 /* for <= */ +#define RTGreaterStrategyNumber 22 /* for > */ +#define RTGreaterEqualStrategyNumber 23 /* for >= */ +#define RTSubStrategyNumber 24 /* for inet >> */ +#define RTSubEqualStrategyNumber 25 /* for inet <<= */ +#define RTSuperStrategyNumber 26 /* for inet << */ +#define RTSuperEqualStrategyNumber 27 /* for inet >>= */ #define RTMaxStrategyNumber 27 -#endif /* STRATNUM_H */ +#endif /* STRATNUM_H */ diff --git a/src/include/access/subtrans.h b/src/include/access/subtrans.h index 847359873a..41716d7b71 100644 --- a/src/include/access/subtrans.h +++ b/src/include/access/subtrans.h @@ -27,4 +27,4 @@ extern void CheckPointSUBTRANS(void); extern void ExtendSUBTRANS(TransactionId newestXact); extern void TruncateSUBTRANS(TransactionId oldestXact); -#endif /* SUBTRANS_H */ +#endif /* SUBTRANS_H */ diff --git a/src/include/access/sysattr.h b/src/include/access/sysattr.h index 348c67ed86..1b3ab8e4aa 100644 --- a/src/include/access/sysattr.h +++ b/src/include/access/sysattr.h @@ -33,4 +33,4 @@ #endif -#endif /* SYSATTR_H */ +#endif /* SYSATTR_H */ diff --git a/src/include/access/timeline.h b/src/include/access/timeline.h index c1911feb16..4bdb0c1f4f 100644 --- a/src/include/access/timeline.h +++ b/src/include/access/timeline.h @@ -41,4 +41,4 @@ extern TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history); extern XLogRecPtr tliSwitchPoint(TimeLineID tli, List *history, TimeLineID *nextTLI); -#endif /* TIMELINE_H */ +#endif /* TIMELINE_H */ diff --git a/src/include/access/transam.h b/src/include/access/transam.h index e357d5dea8..9296bcc7f1 100644 --- a/src/include/access/transam.h +++ b/src/include/access/transam.h @@ -199,4 +199,4 @@ extern void AdvanceOldestClogXid(TransactionId oldest_datfrozenxid); extern bool ForceTransactionIdLimitUpdate(void); extern Oid GetNewObjectId(void); -#endif /* TRAMSAM_H */ +#endif /* TRAMSAM_H */ diff --git a/src/include/access/tsmapi.h b/src/include/access/tsmapi.h index d07b3f25a9..3d94cc6466 100644 --- a/src/include/access/tsmapi.h +++ b/src/include/access/tsmapi.h @@ -21,24 +21,24 @@ */ typedef void (*SampleScanGetSampleSize_function) (PlannerInfo *root, - RelOptInfo *baserel, - List *paramexprs, - BlockNumber *pages, - double *tuples); + RelOptInfo *baserel, + List *paramexprs, + BlockNumber *pages, + double *tuples); typedef void (*InitSampleScan_function) (SampleScanState *node, - int eflags); + int eflags); typedef void (*BeginSampleScan_function) (SampleScanState *node, - Datum *params, - int nparams, - uint32 seed); + Datum *params, + int nparams, + uint32 seed); typedef BlockNumber (*NextSampleBlock_function) (SampleScanState *node); typedef OffsetNumber (*NextSampleTuple_function) (SampleScanState *node, - BlockNumber blockno, - OffsetNumber maxoffset); + BlockNumber blockno, + OffsetNumber maxoffset); typedef void (*EndSampleScan_function) (SampleScanState *node); @@ -67,15 +67,15 @@ typedef struct TsmRoutine SampleScanGetSampleSize_function SampleScanGetSampleSize; /* Functions for executing a SampleScan on a physical table */ - InitSampleScan_function InitSampleScan; /* can be NULL */ + InitSampleScan_function InitSampleScan; /* can be NULL */ BeginSampleScan_function BeginSampleScan; NextSampleBlock_function NextSampleBlock; /* can be NULL */ NextSampleTuple_function NextSampleTuple; - EndSampleScan_function EndSampleScan; /* can be NULL */ + EndSampleScan_function EndSampleScan; /* can be NULL */ } TsmRoutine; /* Functions in access/tablesample/tablesample.c */ extern TsmRoutine *GetTsmRoutine(Oid tsmhandler); -#endif /* TSMAPI_H */ +#endif /* TSMAPI_H */ diff --git a/src/include/access/tupconvert.h b/src/include/access/tupconvert.h index e86cfd56c8..173904adae 100644 --- a/src/include/access/tupconvert.h +++ b/src/include/access/tupconvert.h @@ -46,4 +46,4 @@ extern HeapTuple do_convert_tuple(HeapTuple tuple, TupleConversionMap *map); extern void free_conversion_map(TupleConversionMap *map); -#endif /* TUPCONVERT_H */ +#endif /* TUPCONVERT_H */ diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h index b48f839028..e7065d70ba 100644 --- a/src/include/access/tupdesc.h +++ b/src/include/access/tupdesc.h @@ -78,7 +78,7 @@ typedef struct tupleDesc int32 tdtypmod; /* typmod for tuple type */ bool tdhasoid; /* tuple has oid attribute in its header */ int tdrefcount; /* reference count, or -1 if not counting */ -} *TupleDesc; +} *TupleDesc; extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid); @@ -134,4 +134,4 @@ extern TupleDesc BuildDescForRelation(List *schema); extern TupleDesc BuildDescFromLists(List *names, List *types, List *typmods, List *collations); -#endif /* TUPDESC_H */ +#endif /* TUPDESC_H */ diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h index b5369108cc..6746203828 100644 --- a/src/include/access/tupmacs.h +++ b/src/include/access/tupmacs.h @@ -88,7 +88,7 @@ : \ PointerGetDatum((char *) (T)) \ ) -#endif /* SIZEOF_DATUM == 8 */ +#endif /* SIZEOF_DATUM == 8 */ /* * att_align_datum aligns the given offset as needed for a datum of alignment @@ -238,6 +238,6 @@ break; \ } \ } while (0) -#endif /* SIZEOF_DATUM == 8 */ +#endif /* SIZEOF_DATUM == 8 */ #endif diff --git a/src/include/access/tuptoaster.h b/src/include/access/tuptoaster.h index c7abeed812..fd9f83ac44 100644 --- a/src/include/access/tuptoaster.h +++ b/src/include/access/tuptoaster.h @@ -84,7 +84,7 @@ * * NB: Changing TOAST_MAX_CHUNK_SIZE requires an initdb. */ -#define EXTERN_TUPLES_PER_PAGE 4 /* tweak only this */ +#define EXTERN_TUPLES_PER_PAGE 4 /* tweak only this */ #define EXTERN_TUPLE_MAX_SIZE MaximumBytesPerTuple(EXTERN_TUPLES_PER_PAGE) @@ -152,7 +152,7 @@ extern void toast_delete(Relation rel, HeapTuple oldtup, bool is_speculative); * in compressed format. * ---------- */ -extern struct varlena *heap_tuple_fetch_attr(struct varlena * attr); +extern struct varlena *heap_tuple_fetch_attr(struct varlena *attr); /* ---------- * heap_tuple_untoast_attr() - @@ -161,7 +161,7 @@ extern struct varlena *heap_tuple_fetch_attr(struct varlena * attr); * it as needed. * ---------- */ -extern struct varlena *heap_tuple_untoast_attr(struct varlena * attr); +extern struct varlena *heap_tuple_untoast_attr(struct varlena *attr); /* ---------- * heap_tuple_untoast_attr_slice() - @@ -170,7 +170,7 @@ extern struct varlena *heap_tuple_untoast_attr(struct varlena * attr); * (Handles all cases for attribute storage) * ---------- */ -extern struct varlena *heap_tuple_untoast_attr_slice(struct varlena * attr, +extern struct varlena *heap_tuple_untoast_attr_slice(struct varlena *attr, int32 sliceoffset, int32 slicelength); @@ -236,4 +236,4 @@ extern Size toast_datum_size(Datum value); */ extern Oid toast_get_valid_index(Oid toastoid, LOCKMODE lock); -#endif /* TUPTOASTER_H */ +#endif /* TUPTOASTER_H */ diff --git a/src/include/access/twophase.h b/src/include/access/twophase.h index d03af5f2c2..99c6227714 100644 --- a/src/include/access/twophase.h +++ b/src/include/access/twophase.h @@ -57,4 +57,4 @@ extern void PrepareRedoAdd(char *buf, XLogRecPtr start_lsn, XLogRecPtr end_lsn); extern void PrepareRedoRemove(TransactionId xid, bool giveWarning); extern void restoreTwoPhaseData(void); -#endif /* TWOPHASE_H */ +#endif /* TWOPHASE_H */ diff --git a/src/include/access/twophase_rmgr.h b/src/include/access/twophase_rmgr.h index 32b6475dd9..44cd6d202f 100644 --- a/src/include/access/twophase_rmgr.h +++ b/src/include/access/twophase_rmgr.h @@ -15,7 +15,7 @@ #define TWOPHASE_RMGR_H typedef void (*TwoPhaseCallback) (TransactionId xid, uint16 info, - void *recdata, uint32 len); + void *recdata, uint32 len); typedef uint8 TwoPhaseRmgrId; /* @@ -37,4 +37,4 @@ extern const TwoPhaseCallback twophase_standby_recover_callbacks[]; extern void RegisterTwoPhaseRecord(TwoPhaseRmgrId rmid, uint16 info, const void *data, uint32 len); -#endif /* TWOPHASE_RMGR_H */ +#endif /* TWOPHASE_RMGR_H */ diff --git a/src/include/access/valid.h b/src/include/access/valid.h index 72f2bb6ac2..53a7d0685a 100644 --- a/src/include/access/valid.h +++ b/src/include/access/valid.h @@ -66,4 +66,4 @@ do \ } \ } while (0) -#endif /* VALID_H */ +#endif /* VALID_H */ diff --git a/src/include/access/visibilitymap.h b/src/include/access/visibilitymap.h index a3796f2902..da0e76d6be 100644 --- a/src/include/access/visibilitymap.h +++ b/src/include/access/visibilitymap.h @@ -25,8 +25,8 @@ /* Flags for bit map */ #define VISIBILITYMAP_ALL_VISIBLE 0x01 #define VISIBILITYMAP_ALL_FROZEN 0x02 -#define VISIBILITYMAP_VALID_BITS 0x03 /* OR of all valid - * visibilitymap flags bits */ +#define VISIBILITYMAP_VALID_BITS 0x03 /* OR of all valid visibilitymap + * flags bits */ /* Macros for visibilitymap test */ #define VM_ALL_VISIBLE(r, b, v) \ @@ -46,4 +46,4 @@ extern uint8 visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer extern void visibilitymap_count(Relation rel, BlockNumber *all_visible, BlockNumber *all_frozen); extern void visibilitymap_truncate(Relation rel, BlockNumber nheapblocks); -#endif /* VISIBILITYMAP_H */ +#endif /* VISIBILITYMAP_H */ diff --git a/src/include/access/xact.h b/src/include/access/xact.h index 2186e706a6..16b3c5a26f 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -62,13 +62,12 @@ extern bool XactDeferrable; typedef enum { SYNCHRONOUS_COMMIT_OFF, /* asynchronous commit */ - SYNCHRONOUS_COMMIT_LOCAL_FLUSH, /* wait for local flush only */ + SYNCHRONOUS_COMMIT_LOCAL_FLUSH, /* wait for local flush only */ SYNCHRONOUS_COMMIT_REMOTE_WRITE, /* wait for local flush and remote * write */ SYNCHRONOUS_COMMIT_REMOTE_FLUSH, /* wait for local and remote flush */ - SYNCHRONOUS_COMMIT_REMOTE_APPLY /* wait for local flush and remote - * apply */ -} SyncCommitLevel; + SYNCHRONOUS_COMMIT_REMOTE_APPLY /* wait for local flush and remote apply */ +} SyncCommitLevel; /* Define the default setting for synchronous_commit */ #define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH @@ -124,7 +123,7 @@ typedef enum } SubXactEvent; typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid, - SubTransactionId parentSubid, void *arg); + SubTransactionId parentSubid, void *arg); #ifdef PGXC /* @@ -460,4 +459,4 @@ extern void EnterParallelMode(void); extern void ExitParallelMode(void); extern bool IsInParallelMode(void); -#endif /* XACT_H */ +#endif /* XACT_H */ diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 4a633a7fad..50e8ed4b17 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -24,9 +24,9 @@ /* Sync methods */ #define SYNC_METHOD_FSYNC 0 #define SYNC_METHOD_FDATASYNC 1 -#define SYNC_METHOD_OPEN 2 /* for O_SYNC */ +#define SYNC_METHOD_OPEN 2 /* for O_SYNC */ #define SYNC_METHOD_FSYNC_WRITETHROUGH 3 -#define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */ +#define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */ extern int sync_method; extern PGDLLIMPORT TimeLineID ThisTimeLineID; /* current TLI */ @@ -176,9 +176,8 @@ extern bool XLOG_DEBUG; /* These directly affect the behavior of CreateCheckPoint and subsidiaries */ #define CHECKPOINT_IS_SHUTDOWN 0x0001 /* Checkpoint is for shutdown */ -#define CHECKPOINT_END_OF_RECOVERY 0x0002 /* Like shutdown checkpoint, - * but issued at end of WAL - * recovery */ +#define CHECKPOINT_END_OF_RECOVERY 0x0002 /* Like shutdown checkpoint, but + * issued at end of WAL recovery */ #define CHECKPOINT_IMMEDIATE 0x0004 /* Do it without delays */ #define CHECKPOINT_FORCE 0x0008 /* Force even if no activity */ #define CHECKPOINT_FLUSH_ALL 0x0010 /* Flush all pages, including those @@ -205,18 +204,18 @@ typedef struct CheckpointStatsData TimestampTz ckpt_sync_end_t; /* end of fsyncs */ TimestampTz ckpt_end_t; /* end of checkpoint */ - int ckpt_bufs_written; /* # of buffers written */ + int ckpt_bufs_written; /* # of buffers written */ int ckpt_segs_added; /* # of new xlog segments created */ - int ckpt_segs_removed; /* # of xlog segments deleted */ - int ckpt_segs_recycled; /* # of xlog segments recycled */ + int ckpt_segs_removed; /* # of xlog segments deleted */ + int ckpt_segs_recycled; /* # of xlog segments recycled */ int ckpt_sync_rels; /* # of relations synced */ - uint64 ckpt_longest_sync; /* Longest sync for one relation */ - uint64 ckpt_agg_sync_time; /* The sum of all the individual sync - * times, which is not necessarily the - * same as the total elapsed time for - * the entire sync phase. */ + uint64 ckpt_longest_sync; /* Longest sync for one relation */ + uint64 ckpt_agg_sync_time; /* The sum of all the individual sync + * times, which is not necessarily the + * same as the total elapsed time for the + * entire sync phase. */ } CheckpointStatsData; extern CheckpointStatsData CheckpointStats; @@ -312,8 +311,8 @@ typedef enum SessionBackupState } SessionBackupState; extern XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast, - TimeLineID *starttli_p, StringInfo labelfile, DIR *tblspcdir, - List **tablespaces, StringInfo tblspcmapfile, bool infotbssize, + TimeLineID *starttli_p, StringInfo labelfile, DIR *tblspcdir, + List **tablespaces, StringInfo tblspcmapfile, bool infotbssize, bool needtblspcmapfile); extern XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p); @@ -327,4 +326,4 @@ extern SessionBackupState get_backup_status(void); #define TABLESPACE_MAP "tablespace_map" #define TABLESPACE_MAP_OLD "tablespace_map.old" -#endif /* XLOG_H */ +#endif /* XLOG_H */ diff --git a/src/include/access/xlog_internal.h b/src/include/access/xlog_internal.h index 6e2bfd0ad0..a661ec0180 100644 --- a/src/include/access/xlog_internal.h +++ b/src/include/access/xlog_internal.h @@ -319,4 +319,4 @@ extern bool XLogArchiveIsReady(const char *xlog); extern bool XLogArchiveIsReadyOrDone(const char *xlog); extern void XLogArchiveCleanup(const char *xlog); -#endif /* XLOG_INTERNAL_H */ +#endif /* XLOG_INTERNAL_H */ diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h index 0f07bb2674..3a80d6be6f 100644 --- a/src/include/access/xlogdefs.h +++ b/src/include/access/xlogdefs.h @@ -99,4 +99,4 @@ typedef uint16 RepOriginId; #define DEFAULT_SYNC_METHOD SYNC_METHOD_FSYNC #endif -#endif /* XLOG_DEFS_H */ +#endif /* XLOG_DEFS_H */ diff --git a/src/include/access/xloginsert.h b/src/include/access/xloginsert.h index d30786fa0d..174c88677f 100644 --- a/src/include/access/xloginsert.h +++ b/src/include/access/xloginsert.h @@ -29,14 +29,13 @@ /* flags for XLogRegisterBuffer */ #define REGBUF_FORCE_IMAGE 0x01 /* force a full-page image */ #define REGBUF_NO_IMAGE 0x02 /* don't take a full-page image */ -#define REGBUF_WILL_INIT (0x04 | 0x02) /* page will be re-initialized - * at replay (implies - * NO_IMAGE) */ -#define REGBUF_STANDARD 0x08/* page follows "standard" page layout, (data - * between pd_lower and pd_upper will be - * skipped) */ -#define REGBUF_KEEP_DATA 0x10/* include data even if a full-page image is - * taken */ +#define REGBUF_WILL_INIT (0x04 | 0x02) /* page will be re-initialized at + * replay (implies NO_IMAGE) */ +#define REGBUF_STANDARD 0x08 /* page follows "standard" page layout, + * (data between pd_lower and pd_upper + * will be skipped) */ +#define REGBUF_KEEP_DATA 0x10 /* include data even if a full-page image + * is taken */ /* prototypes for public functions in xloginsert.c: */ extern void XLogBeginInsert(void); @@ -59,4 +58,4 @@ extern XLogRecPtr XLogSaveBufferForHint(Buffer buffer, bool buffer_std); extern void InitXLogInsert(void); -#endif /* XLOGINSERT_H */ +#endif /* XLOGINSERT_H */ diff --git a/src/include/access/xlogreader.h b/src/include/access/xlogreader.h index 956c9bd3a8..7671598334 100644 --- a/src/include/access/xlogreader.h +++ b/src/include/access/xlogreader.h @@ -31,11 +31,11 @@ typedef struct XLogReaderState XLogReaderState; /* Function type definition for the read_page callback */ typedef int (*XLogPageReadCB) (XLogReaderState *xlogreader, - XLogRecPtr targetPagePtr, - int reqLen, - XLogRecPtr targetRecPtr, - char *readBuf, - TimeLineID *pageTLI); + XLogRecPtr targetPagePtr, + int reqLen, + XLogRecPtr targetRecPtr, + char *readBuf, + TimeLineID *pageTLI); typedef struct { @@ -204,7 +204,7 @@ extern void XLogReaderInvalReadState(XLogReaderState *state); #ifdef FRONTEND extern XLogRecPtr XLogFindNextRecord(XLogReaderState *state, XLogRecPtr RecPtr); -#endif /* FRONTEND */ +#endif /* FRONTEND */ /* Functions for decoding an XLogRecord */ @@ -233,4 +233,4 @@ extern bool XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id, RelFileNode *rnode, ForkNumber *forknum, BlockNumber *blknum); -#endif /* XLOGREADER_H */ +#endif /* XLOGREADER_H */ diff --git a/src/include/access/xlogrecord.h b/src/include/access/xlogrecord.h index eeb6a30c1c..b53960e112 100644 --- a/src/include/access/xlogrecord.h +++ b/src/include/access/xlogrecord.h @@ -145,8 +145,9 @@ typedef struct XLogRecordBlockImageHeader /* Information stored in bimg_info */ #define BKPIMAGE_HAS_HOLE 0x01 /* page image has "hole" */ -#define BKPIMAGE_IS_COMPRESSED 0x02 /* page image is compressed */ -#define BKPIMAGE_APPLY 0x04 /* page image should be restored during replay */ +#define BKPIMAGE_IS_COMPRESSED 0x02 /* page image is compressed */ +#define BKPIMAGE_APPLY 0x04 /* page image should be restored during + * replay */ /* * Extra header information used when page image has "hole" and @@ -195,7 +196,7 @@ typedef struct XLogRecordDataHeaderShort { uint8 id; /* XLR_BLOCK_ID_DATA_SHORT */ uint8 data_length; /* number of payload bytes */ -} XLogRecordDataHeaderShort; +} XLogRecordDataHeaderShort; #define SizeOfXLogRecordDataHeaderShort (sizeof(uint8) * 2) @@ -203,7 +204,7 @@ typedef struct XLogRecordDataHeaderLong { uint8 id; /* XLR_BLOCK_ID_DATA_LONG */ /* followed by uint32 data_length, unaligned */ -} XLogRecordDataHeaderLong; +} XLogRecordDataHeaderLong; #define SizeOfXLogRecordDataHeaderLong (sizeof(uint8) + sizeof(uint32)) @@ -224,4 +225,4 @@ typedef struct XLogRecordDataHeaderLong #define XLR_BLOCK_ID_DATA_LONG 254 #define XLR_BLOCK_ID_ORIGIN 253 -#endif /* XLOGRECORD_H */ +#endif /* XLOGRECORD_H */ diff --git a/src/include/bootstrap/bootstrap.h b/src/include/bootstrap/bootstrap.h index 51a0ba925f..8903baada3 100644 --- a/src/include/bootstrap/bootstrap.h +++ b/src/include/bootstrap/bootstrap.h @@ -64,4 +64,4 @@ extern int boot_yyparse(void); extern int boot_yylex(void); extern void boot_yyerror(const char *str) pg_attribute_noreturn(); -#endif /* BOOTSTRAP_H */ +#endif /* BOOTSTRAP_H */ diff --git a/src/include/c.h b/src/include/c.h index 5e91b64305..3d58771b36 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -62,7 +62,7 @@ #define WIN32 #endif -#if !defined(WIN32) && !defined(__CYGWIN__) /* win32 includes further down */ +#if !defined(WIN32) && !defined(__CYGWIN__) /* win32 includes further down */ #include "pg_config_os.h" /* must be before any system header files */ #endif @@ -209,7 +209,7 @@ typedef char bool; #ifndef false #define false ((bool) 0) #endif -#endif /* not C++ */ +#endif /* not C++ */ typedef bool *BoolPtr; @@ -254,7 +254,7 @@ typedef char *Pointer; typedef signed char int8; /* == 8 bits */ typedef signed short int16; /* == 16 bits */ typedef signed int int32; /* == 32 bits */ -#endif /* not HAVE_INT8 */ +#endif /* not HAVE_INT8 */ /* * uintN @@ -266,7 +266,7 @@ typedef signed int int32; /* == 32 bits */ typedef unsigned char uint8; /* == 8 bits */ typedef unsigned short uint16; /* == 16 bits */ typedef unsigned int uint32; /* == 32 bits */ -#endif /* not HAVE_UINT8 */ +#endif /* not HAVE_UINT8 */ /* * bitsN @@ -420,7 +420,7 @@ typedef uint32 CommandId; typedef struct { int indx[MAXDIM]; -} IntArray; +} IntArray; /* ---------------- * Variable-length datatypes all share the 'struct varlena' header. @@ -553,7 +553,7 @@ typedef NameData *Name; */ #ifndef offsetof #define offsetof(type, field) ((long) &((type *)0)->field) -#endif /* offsetof */ +#endif /* offsetof */ /* * lengthof @@ -732,7 +732,7 @@ typedef NameData *Name; Trap(TYPEALIGN(bndr, (uintptr_t)(ptr)) != (uintptr_t)(ptr), \ "UnalignedPointer") -#endif /* USE_ASSERT_CHECKING && !FRONTEND */ +#endif /* USE_ASSERT_CHECKING && !FRONTEND */ /* * Macros to support compile-time assertion checks. @@ -758,7 +758,7 @@ typedef NameData *Name; ((void) sizeof(struct { int static_assert_failure : (condition) ? 1 : -1; })) #define StaticAssertExpr(condition, errmessage) \ StaticAssertStmt(condition, errmessage) -#endif /* HAVE__STATIC_ASSERT */ +#endif /* HAVE__STATIC_ASSERT */ /* @@ -786,7 +786,7 @@ typedef NameData *Name; #define AssertVariableIsOfTypeMacro(varname, typename) \ ((void) StaticAssertExpr(sizeof(varname) == sizeof(typename), \ CppAsString(varname) " does not have type " CppAsString(typename))) -#endif /* HAVE__BUILTIN_TYPES_COMPATIBLE_P */ +#endif /* HAVE__BUILTIN_TYPES_COMPATIBLE_P */ /* ---------------------------------------------------------------- @@ -1126,4 +1126,4 @@ extern int fdatasync(int fildes); /* /port compatibility functions */ #include "port.h" -#endif /* C_H */ +#endif /* C_H */ diff --git a/src/include/catalog/binary_upgrade.h b/src/include/catalog/binary_upgrade.h index 98089e3c1a..5ff365fe53 100644 --- a/src/include/catalog/binary_upgrade.h +++ b/src/include/catalog/binary_upgrade.h @@ -27,4 +27,4 @@ extern PGDLLIMPORT Oid binary_upgrade_next_pg_authid_oid; extern PGDLLIMPORT bool binary_upgrade_record_init_privs; -#endif /* BINARY_UPGRADE_H */ +#endif /* BINARY_UPGRADE_H */ diff --git a/src/include/catalog/catalog.h b/src/include/catalog/catalog.h index 7062d7ed2f..85d8385b3f 100644 --- a/src/include/catalog/catalog.h +++ b/src/include/catalog/catalog.h @@ -49,4 +49,4 @@ extern Oid GetNewOidWithIndex(Relation relation, Oid indexId, extern Oid GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence); -#endif /* CATALOG_H */ +#endif /* CATALOG_H */ diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 8b2ec21509..405e8e303b 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 201706141 +#define CATALOG_VERSION_NO 201706241 #endif diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index c4d0c694f4..f43bf41dbd 100644 --- a/src/include/catalog/dependency.h +++ b/src/include/catalog/dependency.h @@ -177,11 +177,11 @@ typedef enum ObjectClass #define LAST_OCLASS OCLASS_TRANSFORM /* flag bits for performDeletion/performMultipleDeletions: */ -#define PERFORM_DELETION_INTERNAL 0x0001 /* internal action */ -#define PERFORM_DELETION_CONCURRENTLY 0x0002 /* concurrent drop */ -#define PERFORM_DELETION_QUIETLY 0x0004 /* suppress notices */ -#define PERFORM_DELETION_SKIP_ORIGINAL 0x0008 /* keep original obj */ -#define PERFORM_DELETION_SKIP_EXTENSIONS 0x0010 /* keep extensions */ +#define PERFORM_DELETION_INTERNAL 0x0001 /* internal action */ +#define PERFORM_DELETION_CONCURRENTLY 0x0002 /* concurrent drop */ +#define PERFORM_DELETION_QUIETLY 0x0004 /* suppress notices */ +#define PERFORM_DELETION_SKIP_ORIGINAL 0x0008 /* keep original obj */ +#define PERFORM_DELETION_SKIP_EXTENSIONS 0x0010 /* keep extensions */ /* in dependency.c */ @@ -289,4 +289,4 @@ extern void shdepDropOwned(List *relids, DropBehavior behavior); extern void shdepReassignOwned(List *relids, Oid newrole); -#endif /* DEPENDENCY_H */ +#endif /* DEPENDENCY_H */ diff --git a/src/include/catalog/genbki.h b/src/include/catalog/genbki.h index a522b4cd82..a2cb313d4a 100644 --- a/src/include/catalog/genbki.h +++ b/src/include/catalog/genbki.h @@ -47,4 +47,4 @@ #define DESCR(x) extern int no_such_variable #define SHDESCR(x) extern int no_such_variable -#endif /* GENBKI_H */ +#endif /* GENBKI_H */ diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index 12ad62532b..3ac2a05159 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -166,4 +166,4 @@ extern void RemovePartitionKeyByRelId(Oid relid); extern void StorePartitionBound(Relation rel, Relation parent, PartitionBoundSpec *bound); -#endif /* HEAP_H */ +#endif /* HEAP_H */ diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h index 20bec90b9d..1d4ec09f8f 100644 --- a/src/include/catalog/index.h +++ b/src/include/catalog/index.h @@ -22,11 +22,11 @@ /* Typedef for callback function for IndexBuildHeapScan */ typedef void (*IndexBuildCallback) (Relation index, - HeapTuple htup, - Datum *values, - bool *isnull, - bool tupleIsAlive, - void *state); + HeapTuple htup, + Datum *values, + bool *isnull, + bool tupleIsAlive, + void *state); /* Action code for index_set_state_flags */ typedef enum @@ -131,4 +131,4 @@ extern bool ReindexIsProcessingHeap(Oid heapOid); extern bool ReindexIsProcessingIndex(Oid indexOid); extern Oid IndexGetRelation(Oid indexId, bool missing_ok); -#endif /* INDEX_H */ +#endif /* INDEX_H */ diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h index 35f50b69a5..2039d86962 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -384,4 +384,4 @@ DECLARE_UNIQUE_INDEX(pg_subscription_rel_srrelid_srsubid_index, 6117, on pg_subs /* last step of initialization script: build the indexes declared above */ BUILD_INDICES -#endif /* INDEXING_H */ +#endif /* INDEXING_H */ diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h index 14df88290a..074c315b4f 100644 --- a/src/include/catalog/namespace.h +++ b/src/include/catalog/namespace.h @@ -36,7 +36,7 @@ typedef struct _FuncCandidateList int ndargs; /* number of defaulted args */ int *argnumbers; /* args' positional indexes, if named call */ Oid args[FLEXIBLE_ARRAY_MEMBER]; /* arg types */ -} *FuncCandidateList; +} *FuncCandidateList; /* * Structure for xxxOverrideSearchPath functions @@ -49,7 +49,7 @@ typedef struct OverrideSearchPath } OverrideSearchPath; typedef void (*RangeVarGetRelidCallback) (const RangeVar *relation, Oid relId, - Oid oldRelId, void *callback_arg); + Oid oldRelId, void *callback_arg); #define RangeVarGetRelid(relation, lockmode, missing_ok) \ RangeVarGetRelidExtended(relation, lockmode, missing_ok, false, NULL, NULL) @@ -161,4 +161,4 @@ extern char *namespace_search_path; extern List *fetch_search_path(bool includeImplicit); extern int fetch_search_path_array(Oid *sarray, int sarray_len); -#endif /* NAMESPACE_H */ +#endif /* NAMESPACE_H */ diff --git a/src/include/catalog/objectaccess.h b/src/include/catalog/objectaccess.h index 3a6dd596ce..251eb6fd88 100644 --- a/src/include/catalog/objectaccess.h +++ b/src/include/catalog/objectaccess.h @@ -118,10 +118,10 @@ typedef struct /* Plugin provides a hook function matching this signature. */ typedef void (*object_access_hook_type) (ObjectAccessType access, - Oid classId, - Oid objectId, - int subId, - void *arg); + Oid classId, + Oid objectId, + int subId, + void *arg); /* Plugin sets this variable to a suitable hook function. */ extern PGDLLIMPORT object_access_hook_type object_access_hook; @@ -182,4 +182,4 @@ extern void RunFunctionExecuteHook(Oid objectId); RunFunctionExecuteHook(objectId); \ } while(0) -#endif /* OBJECTACCESS_H */ +#endif /* OBJECTACCESS_H */ diff --git a/src/include/catalog/objectaddress.h b/src/include/catalog/objectaddress.h index 406c38bc73..5fc54d0e57 100644 --- a/src/include/catalog/objectaddress.h +++ b/src/include/catalog/objectaddress.h @@ -78,4 +78,4 @@ extern char *getObjectIdentityParts(const ObjectAddress *address, List **objname, List **objargs); extern ArrayType *strlist_to_textarray(List *list); -#endif /* OBJECTADDRESS_H */ +#endif /* OBJECTADDRESS_H */ diff --git a/src/include/catalog/opfam_internal.h b/src/include/catalog/opfam_internal.h index 448ad9708b..c4a010029a 100644 --- a/src/include/catalog/opfam_internal.h +++ b/src/include/catalog/opfam_internal.h @@ -25,4 +25,4 @@ typedef struct Oid sortfamily; /* ordering operator's sort opfamily, or 0 */ } OpFamilyMember; -#endif /* OPFAM_INTERNAL_H */ +#endif /* OPFAM_INTERNAL_H */ diff --git a/src/include/catalog/partition.h b/src/include/catalog/partition.h index 0a1e468898..f10879a162 100644 --- a/src/include/catalog/partition.h +++ b/src/include/catalog/partition.h @@ -34,7 +34,7 @@ typedef struct PartitionDescData { int nparts; /* Number of partitions */ Oid *oids; /* OIDs of partitions */ - PartitionBoundInfo boundinfo; /* collection of partition bounds */ + PartitionBoundInfo boundinfo; /* collection of partition bounds */ } PartitionDescData; typedef struct PartitionDescData *PartitionDesc; @@ -98,4 +98,4 @@ extern int get_partition_for_tuple(PartitionDispatch *pd, EState *estate, PartitionDispatchData **failed_at, TupleTableSlot **failed_slot); -#endif /* PARTITION_H */ +#endif /* PARTITION_H */ diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h index 1ffde6cdc5..4d5b9bb9a6 100644 --- a/src/include/catalog/pg_aggregate.h +++ b/src/include/catalog/pg_aggregate.h @@ -348,4 +348,4 @@ extern ObjectAddress AggregateCreate(const char *aggName, const char *aggminitval, char proparallel); -#endif /* PG_AGGREGATE_H */ +#endif /* PG_AGGREGATE_H */ diff --git a/src/include/catalog/pg_am.h b/src/include/catalog/pg_am.h index 9b6dc38f64..e021f5b894 100644 --- a/src/include/catalog/pg_am.h +++ b/src/include/catalog/pg_am.h @@ -58,7 +58,7 @@ typedef FormData_pg_am *Form_pg_am; * compiler constant for amtype * ---------------- */ -#define AMTYPE_INDEX 'i' /* index access method */ +#define AMTYPE_INDEX 'i' /* index access method */ /* ---------------- * initial contents of pg_am @@ -84,4 +84,4 @@ DATA(insert OID = 3580 ( brin brinhandler i )); DESCR("block range index (BRIN) access method"); #define BRIN_AM_OID 3580 -#endif /* PG_AM_H */ +#endif /* PG_AM_H */ diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h index da0228de6b..f850be490a 100644 --- a/src/include/catalog/pg_amop.h +++ b/src/include/catalog/pg_amop.h @@ -1162,4 +1162,4 @@ DATA(insert ( 4104 603 603 12 s 2572 3580 0 )); /* we could, but choose not to, supply entries for strategies 13 and 14 */ DATA(insert ( 4104 603 600 7 s 433 3580 0 )); -#endif /* PG_AMOP_H */ +#endif /* PG_AMOP_H */ diff --git a/src/include/catalog/pg_amproc.h b/src/include/catalog/pg_amproc.h index bcbb7a1617..7d245b1271 100644 --- a/src/include/catalog/pg_amproc.h +++ b/src/include/catalog/pg_amproc.h @@ -536,4 +536,4 @@ DATA(insert ( 4104 603 603 4 4108 )); DATA(insert ( 4104 603 603 11 4067 )); DATA(insert ( 4104 603 603 13 187 )); -#endif /* PG_AMPROC_H */ +#endif /* PG_AMPROC_H */ diff --git a/src/include/catalog/pg_attrdef.h b/src/include/catalog/pg_attrdef.h index ff1842f53c..b877f42a2d 100644 --- a/src/include/catalog/pg_attrdef.h +++ b/src/include/catalog/pg_attrdef.h @@ -56,4 +56,4 @@ typedef FormData_pg_attrdef *Form_pg_attrdef; #define Anum_pg_attrdef_adbin 3 #define Anum_pg_attrdef_adsrc 4 -#endif /* PG_ATTRDEF_H */ +#endif /* PG_ATTRDEF_H */ diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index 753d45f2d1..bcf28e8f04 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -228,4 +228,4 @@ typedef FormData_pg_attribute *Form_pg_attribute; #define ATTRIBUTE_IDENTITY_ALWAYS 'a' #define ATTRIBUTE_IDENTITY_BY_DEFAULT 'd' -#endif /* PG_ATTRIBUTE_H */ +#endif /* PG_ATTRIBUTE_H */ diff --git a/src/include/catalog/pg_auth_members.h b/src/include/catalog/pg_auth_members.h index e34a4e80a4..6a954fff97 100644 --- a/src/include/catalog/pg_auth_members.h +++ b/src/include/catalog/pg_auth_members.h @@ -54,4 +54,4 @@ typedef FormData_pg_auth_members *Form_pg_auth_members; #define Anum_pg_auth_members_grantor 3 #define Anum_pg_auth_members_admin_option 4 -#endif /* PG_AUTH_MEMBERS_H */ +#endif /* PG_AUTH_MEMBERS_H */ diff --git a/src/include/catalog/pg_authid.h b/src/include/catalog/pg_authid.h index 39fea9f41a..9b6b52c9f9 100644 --- a/src/include/catalog/pg_authid.h +++ b/src/include/catalog/pg_authid.h @@ -111,4 +111,4 @@ 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 DEFAULT_ROLE_SIGNAL_BACKENDID 4200 -#endif /* PG_AUTHID_H */ +#endif /* PG_AUTHID_H */ diff --git a/src/include/catalog/pg_cast.h b/src/include/catalog/pg_cast.h index ccc6fb35a8..17827531ad 100644 --- a/src/include/catalog/pg_cast.h +++ b/src/include/catalog/pg_cast.h @@ -52,8 +52,8 @@ typedef FormData_pg_cast *Form_pg_cast; typedef enum CoercionCodes { - COERCION_CODE_IMPLICIT = 'i', /* coercion in context of expression */ - COERCION_CODE_ASSIGNMENT = 'a', /* coercion in context of assignment */ + COERCION_CODE_IMPLICIT = 'i', /* coercion in context of expression */ + COERCION_CODE_ASSIGNMENT = 'a', /* coercion in context of assignment */ COERCION_CODE_EXPLICIT = 'e' /* explicit cast operation */ } CoercionCodes; @@ -64,8 +64,8 @@ typedef enum CoercionCodes */ typedef enum CoercionMethod { - COERCION_METHOD_FUNCTION = 'f', /* use a function */ - COERCION_METHOD_BINARY = 'b', /* types are binary-compatible */ + COERCION_METHOD_FUNCTION = 'f', /* use a function */ + COERCION_METHOD_BINARY = 'b', /* types are binary-compatible */ COERCION_METHOD_INOUT = 'i' /* use input/output functions */ } CoercionMethod; @@ -392,4 +392,4 @@ DATA(insert ( 1700 1700 1703 i f )); DATA(insert ( 114 3802 0 a i )); DATA(insert ( 3802 114 0 a i )); -#endif /* PG_CAST_H */ +#endif /* PG_CAST_H */ diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index 3657201317..04c163042c 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -157,19 +157,19 @@ DATA(insert OID = 1259 ( pg_class PGNSP 83 0 PGUID 0 0 0 0 0 0 0 f f p r 33 0 DESCR(""); -#define RELKIND_RELATION 'r' /* ordinary table */ -#define RELKIND_INDEX 'i' /* secondary index */ -#define RELKIND_SEQUENCE 'S' /* sequence object */ -#define RELKIND_TOASTVALUE 't' /* for out-of-line values */ -#define RELKIND_VIEW 'v' /* view */ -#define RELKIND_MATVIEW 'm' /* materialized view */ -#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ -#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ -#define RELKIND_PARTITIONED_TABLE 'p' /* partitioned table */ - -#define RELPERSISTENCE_PERMANENT 'p' /* regular table */ -#define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */ -#define RELPERSISTENCE_TEMP 't' /* temporary table */ +#define RELKIND_RELATION 'r' /* ordinary table */ +#define RELKIND_INDEX 'i' /* secondary index */ +#define RELKIND_SEQUENCE 'S' /* sequence object */ +#define RELKIND_TOASTVALUE 't' /* for out-of-line values */ +#define RELKIND_VIEW 'v' /* view */ +#define RELKIND_MATVIEW 'm' /* materialized view */ +#define RELKIND_COMPOSITE_TYPE 'c' /* composite type */ +#define RELKIND_FOREIGN_TABLE 'f' /* foreign table */ +#define RELKIND_PARTITIONED_TABLE 'p' /* partitioned table */ + +#define RELPERSISTENCE_PERMANENT 'p' /* regular table */ +#define RELPERSISTENCE_UNLOGGED 'u' /* unlogged permanent table */ +#define RELPERSISTENCE_TEMP 't' /* temporary table */ #ifdef PGXC #define RELPERSISTENCE_LOCAL_TEMP 'l' /* local temp table */ @@ -188,4 +188,4 @@ DESCR(""); */ #define REPLICA_IDENTITY_INDEX 'i' -#endif /* PG_CLASS_H */ +#endif /* PG_CLASS_H */ diff --git a/src/include/catalog/pg_collation.h b/src/include/catalog/pg_collation.h index 901c0b5115..0cac7cae72 100644 --- a/src/include/catalog/pg_collation.h +++ b/src/include/catalog/pg_collation.h @@ -85,4 +85,4 @@ DESCR("standard POSIX collation"); #define COLLPROVIDER_ICU 'i' #define COLLPROVIDER_LIBC 'c' -#endif /* PG_COLLATION_H */ +#endif /* PG_COLLATION_H */ diff --git a/src/include/catalog/pg_collation_fn.h b/src/include/catalog/pg_collation_fn.h index dfebdbaa0b..0ef31389d5 100644 --- a/src/include/catalog/pg_collation_fn.h +++ b/src/include/catalog/pg_collation_fn.h @@ -20,7 +20,8 @@ extern Oid CollationCreate(const char *collname, Oid collnamespace, int32 collencoding, const char *collcollate, const char *collctype, const char *collversion, - bool if_not_exists); + bool if_not_exists, + bool quiet); extern void RemoveCollationById(Oid collationOid); -#endif /* PG_COLLATION_FN_H */ +#endif /* PG_COLLATION_FN_H */ diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h index e959583364..ec035d8434 100644 --- a/src/include/catalog/pg_constraint.h +++ b/src/include/catalog/pg_constraint.h @@ -198,4 +198,4 @@ typedef FormData_pg_constraint *Form_pg_constraint; * the FKCONSTR_MATCH_xxx constants defined in parsenodes.h. */ -#endif /* PG_CONSTRAINT_H */ +#endif /* PG_CONSTRAINT_H */ diff --git a/src/include/catalog/pg_constraint_fn.h b/src/include/catalog/pg_constraint_fn.h index d2acb3a053..a4c46897ed 100644 --- a/src/include/catalog/pg_constraint_fn.h +++ b/src/include/catalog/pg_constraint_fn.h @@ -67,7 +67,7 @@ extern char *ChooseConstraintName(const char *name1, const char *name2, List *others); extern void AlterConstraintNamespaces(Oid ownerId, Oid oldNspId, - Oid newNspId, bool isType, ObjectAddresses *objsMoved); + Oid newNspId, bool isType, ObjectAddresses *objsMoved); extern Oid get_relation_constraint_oid(Oid relid, const char *conname, bool missing_ok); extern Oid get_domain_constraint_oid(Oid typid, const char *conname, bool missing_ok); @@ -79,4 +79,4 @@ extern bool check_functional_grouping(Oid relid, List *grouping_columns, List **constraintDeps); -#endif /* PG_CONSTRAINT_FN_H */ +#endif /* PG_CONSTRAINT_FN_H */ diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index 3a25cc84b2..84327c9da6 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -121,8 +121,8 @@ typedef struct ControlFileData * example, WAL logs contain per-page magic numbers that can serve as * version cues for the WAL log. */ - uint32 pg_control_version; /* PG_CONTROL_VERSION */ - uint32 catalog_version_no; /* see catversion.h */ + uint32 pg_control_version; /* PG_CONTROL_VERSION */ + uint32 catalog_version_no; /* see catversion.h */ /* * System status data @@ -244,4 +244,4 @@ typedef struct ControlFileData */ #define PG_CONTROL_SIZE 8192 -#endif /* PG_CONTROL_H */ +#endif /* PG_CONTROL_H */ diff --git a/src/include/catalog/pg_conversion.h b/src/include/catalog/pg_conversion.h index 88174a620a..0682d7eb22 100644 --- a/src/include/catalog/pg_conversion.h +++ b/src/include/catalog/pg_conversion.h @@ -74,4 +74,4 @@ typedef FormData_pg_conversion *Form_pg_conversion; * --------------- */ -#endif /* PG_CONVERSION_H */ +#endif /* PG_CONVERSION_H */ diff --git a/src/include/catalog/pg_conversion_fn.h b/src/include/catalog/pg_conversion_fn.h index a2c1345f01..7074bcf13a 100644 --- a/src/include/catalog/pg_conversion_fn.h +++ b/src/include/catalog/pg_conversion_fn.h @@ -24,4 +24,4 @@ extern ObjectAddress ConversionCreate(const char *conname, Oid connamespace, extern void RemoveConversionById(Oid conversionOid); extern Oid FindDefaultConversion(Oid connamespace, int32 for_encoding, int32 to_encoding); -#endif /* PG_CONVERSION_FN_H */ +#endif /* PG_CONVERSION_FN_H */ diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h index 55a1f6edab..e7cbca49cf 100644 --- a/src/include/catalog/pg_database.h +++ b/src/include/catalog/pg_database.h @@ -79,4 +79,4 @@ DATA(insert OID = 1 ( template1 PGUID ENCODING "LC_COLLATE" "LC_CTYPE" t t -1 0 SHDESCR("default template for new databases"); #define TemplateDbOid 1 -#endif /* PG_DATABASE_H */ +#endif /* PG_DATABASE_H */ diff --git a/src/include/catalog/pg_db_role_setting.h b/src/include/catalog/pg_db_role_setting.h index 311258fd7b..4a8e3370c9 100644 --- a/src/include/catalog/pg_db_role_setting.h +++ b/src/include/catalog/pg_db_role_setting.h @@ -42,7 +42,7 @@ CATALOG(pg_db_role_setting,2964) BKI_SHARED_RELATION BKI_WITHOUT_OIDS #endif } FormData_pg_db_role_setting; -typedef FormData_pg_db_role_setting *Form_pg_db_role_setting; +typedef FormData_pg_db_role_setting * Form_pg_db_role_setting; /* ---------------- * compiler constants for pg_db_role_setting @@ -66,4 +66,4 @@ extern void DropSetting(Oid databaseid, Oid roleid); extern void ApplySetting(Snapshot snapshot, Oid databaseid, Oid roleid, Relation relsetting, GucSource source); -#endif /* PG_DB_ROLE_SETTING_H */ +#endif /* PG_DB_ROLE_SETTING_H */ diff --git a/src/include/catalog/pg_default_acl.h b/src/include/catalog/pg_default_acl.h index 78bbeb64fe..09587abee6 100644 --- a/src/include/catalog/pg_default_acl.h +++ b/src/include/catalog/pg_default_acl.h @@ -66,10 +66,10 @@ typedef FormData_pg_default_acl *Form_pg_default_acl; * permissions through pg_default_acl. These codes are used in the * defaclobjtype column. */ -#define DEFACLOBJ_RELATION 'r' /* table, view */ -#define DEFACLOBJ_SEQUENCE 'S' /* sequence */ -#define DEFACLOBJ_FUNCTION 'f' /* function */ -#define DEFACLOBJ_TYPE 'T' /* type */ -#define DEFACLOBJ_NAMESPACE 'n' /* namespace */ +#define DEFACLOBJ_RELATION 'r' /* table, view */ +#define DEFACLOBJ_SEQUENCE 'S' /* sequence */ +#define DEFACLOBJ_FUNCTION 'f' /* function */ +#define DEFACLOBJ_TYPE 'T' /* type */ +#define DEFACLOBJ_NAMESPACE 'n' /* namespace */ -#endif /* PG_DEFAULT_ACL_H */ +#endif /* PG_DEFAULT_ACL_H */ diff --git a/src/include/catalog/pg_depend.h b/src/include/catalog/pg_depend.h index 6c480dd7dc..8bda78d9ef 100644 --- a/src/include/catalog/pg_depend.h +++ b/src/include/catalog/pg_depend.h @@ -87,4 +87,4 @@ typedef FormData_pg_depend *Form_pg_depend; * convenient to find from the contents of other catalogs. */ -#endif /* PG_DEPEND_H */ +#endif /* PG_DEPEND_H */ diff --git a/src/include/catalog/pg_description.h b/src/include/catalog/pg_description.h index 2f51ac33f3..e0499ca2d6 100644 --- a/src/include/catalog/pg_description.h +++ b/src/include/catalog/pg_description.h @@ -52,7 +52,7 @@ CATALOG(pg_description,2609) BKI_WITHOUT_OIDS int32 objsubid; /* column number, or 0 if not used */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text description BKI_FORCE_NOT_NULL; /* description of object */ + text description BKI_FORCE_NOT_NULL; /* description of object */ #endif } FormData_pg_description; @@ -61,7 +61,7 @@ CATALOG(pg_description,2609) BKI_WITHOUT_OIDS * the format of pg_description relation. * ---------------- */ -typedef FormData_pg_description *Form_pg_description; +typedef FormData_pg_description * Form_pg_description; /* ---------------- * compiler constants for pg_description @@ -84,4 +84,4 @@ typedef FormData_pg_description *Form_pg_description; * by genbki.pl and loaded during initdb. */ -#endif /* PG_DESCRIPTION_H */ +#endif /* PG_DESCRIPTION_H */ diff --git a/src/include/catalog/pg_enum.h b/src/include/catalog/pg_enum.h index faee5e6c3c..5938ba5cac 100644 --- a/src/include/catalog/pg_enum.h +++ b/src/include/catalog/pg_enum.h @@ -70,4 +70,4 @@ extern void AddEnumLabel(Oid enumTypeOid, const char *newVal, extern void RenameEnumLabel(Oid enumTypeOid, const char *oldVal, const char *newVal); -#endif /* PG_ENUM_H */ +#endif /* PG_ENUM_H */ diff --git a/src/include/catalog/pg_event_trigger.h b/src/include/catalog/pg_event_trigger.h index b41cc12602..f9f568b27b 100644 --- a/src/include/catalog/pg_event_trigger.h +++ b/src/include/catalog/pg_event_trigger.h @@ -61,4 +61,4 @@ typedef FormData_pg_event_trigger *Form_pg_event_trigger; #define Anum_pg_event_trigger_evtenabled 5 #define Anum_pg_event_trigger_evttags 6 -#endif /* PG_EVENT_TRIGGER_H */ +#endif /* PG_EVENT_TRIGGER_H */ diff --git a/src/include/catalog/pg_extension.h b/src/include/catalog/pg_extension.h index 41b087d8b9..2ce575d17e 100644 --- a/src/include/catalog/pg_extension.h +++ b/src/include/catalog/pg_extension.h @@ -37,7 +37,7 @@ CATALOG(pg_extension,3079) #ifdef CATALOG_VARLEN /* variable-length fields start here */ /* extversion may never be null, but the others can be. */ - text extversion BKI_FORCE_NOT_NULL; /* extension version name */ + text extversion BKI_FORCE_NOT_NULL; /* extension version name */ Oid extconfig[1]; /* dumpable configuration tables */ text extcondition[1]; /* WHERE clauses for config tables */ #endif @@ -69,4 +69,4 @@ typedef FormData_pg_extension *Form_pg_extension; * ---------------- */ -#endif /* PG_EXTENSION_H */ +#endif /* PG_EXTENSION_H */ diff --git a/src/include/catalog/pg_foreign_data_wrapper.h b/src/include/catalog/pg_foreign_data_wrapper.h index 47df6799c9..af602c74ee 100644 --- a/src/include/catalog/pg_foreign_data_wrapper.h +++ b/src/include/catalog/pg_foreign_data_wrapper.h @@ -61,4 +61,4 @@ typedef FormData_pg_foreign_data_wrapper *Form_pg_foreign_data_wrapper; #define Anum_pg_foreign_data_wrapper_fdwacl 5 #define Anum_pg_foreign_data_wrapper_fdwoptions 6 -#endif /* PG_FOREIGN_DATA_WRAPPER_H */ +#endif /* PG_FOREIGN_DATA_WRAPPER_H */ diff --git a/src/include/catalog/pg_foreign_server.h b/src/include/catalog/pg_foreign_server.h index 629bfc389d..689dbbb4e7 100644 --- a/src/include/catalog/pg_foreign_server.h +++ b/src/include/catalog/pg_foreign_server.h @@ -61,4 +61,4 @@ typedef FormData_pg_foreign_server *Form_pg_foreign_server; #define Anum_pg_foreign_server_srvacl 6 #define Anum_pg_foreign_server_srvoptions 7 -#endif /* PG_FOREIGN_SERVER_H */ +#endif /* PG_FOREIGN_SERVER_H */ diff --git a/src/include/catalog/pg_foreign_table.h b/src/include/catalog/pg_foreign_table.h index b62d5e948b..c5dbcceef1 100644 --- a/src/include/catalog/pg_foreign_table.h +++ b/src/include/catalog/pg_foreign_table.h @@ -53,4 +53,4 @@ typedef FormData_pg_foreign_table *Form_pg_foreign_table; #define Anum_pg_foreign_table_ftserver 2 #define Anum_pg_foreign_table_ftoptions 3 -#endif /* PG_FOREIGN_TABLE_H */ +#endif /* PG_FOREIGN_TABLE_H */ diff --git a/src/include/catalog/pg_index.h b/src/include/catalog/pg_index.h index 7ca0fae707..8505c3be5f 100644 --- a/src/include/catalog/pg_index.h +++ b/src/include/catalog/pg_index.h @@ -108,4 +108,4 @@ typedef FormData_pg_index *Form_pg_index; #define IndexIsReady(indexForm) ((indexForm)->indisready) #define IndexIsLive(indexForm) ((indexForm)->indislive) -#endif /* PG_INDEX_H */ +#endif /* PG_INDEX_H */ diff --git a/src/include/catalog/pg_inherits.h b/src/include/catalog/pg_inherits.h index 434fa7c864..26bfab5db6 100644 --- a/src/include/catalog/pg_inherits.h +++ b/src/include/catalog/pg_inherits.h @@ -56,4 +56,4 @@ typedef FormData_pg_inherits *Form_pg_inherits; * ---------------- */ -#endif /* PG_INHERITS_H */ +#endif /* PG_INHERITS_H */ diff --git a/src/include/catalog/pg_inherits_fn.h b/src/include/catalog/pg_inherits_fn.h index e33b39e71e..abfa4766a1 100644 --- a/src/include/catalog/pg_inherits_fn.h +++ b/src/include/catalog/pg_inherits_fn.h @@ -23,4 +23,4 @@ extern List *find_all_inheritors(Oid parentrelId, LOCKMODE lockmode, extern bool has_subclass(Oid relationId); extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId); -#endif /* PG_INHERITS_FN_H */ +#endif /* PG_INHERITS_FN_H */ diff --git a/src/include/catalog/pg_init_privs.h b/src/include/catalog/pg_init_privs.h index 0d241b8a40..5fca36334b 100644 --- a/src/include/catalog/pg_init_privs.h +++ b/src/include/catalog/pg_init_privs.h @@ -49,8 +49,7 @@ CATALOG(pg_init_privs,3394) BKI_WITHOUT_OIDS char privtype; /* from initdb or extension? */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - aclitem initprivs[1] BKI_FORCE_NOT_NULL; /* initial privs on - * object */ + aclitem initprivs[1] BKI_FORCE_NOT_NULL; /* initial privs on object */ #endif } FormData_pg_init_privs; @@ -59,7 +58,7 @@ CATALOG(pg_init_privs,3394) BKI_WITHOUT_OIDS * the format of pg_init_privs relation. * ---------------- */ -typedef FormData_pg_init_privs *Form_pg_init_privs; +typedef FormData_pg_init_privs * Form_pg_init_privs; /* ---------------- * compiler constants for pg_init_privs @@ -98,4 +97,4 @@ typedef enum InitPrivsType * The initial contents are loaded near the end of initdb. */ -#endif /* PG_INIT_PRIVS_H */ +#endif /* PG_INIT_PRIVS_H */ diff --git a/src/include/catalog/pg_language.h b/src/include/catalog/pg_language.h index 46e4099485..ad244e839b 100644 --- a/src/include/catalog/pg_language.h +++ b/src/include/catalog/pg_language.h @@ -79,4 +79,4 @@ DATA(insert OID = 14 ( "sql" PGUID f t 0 0 2248 _null_ )); DESCR("SQL-language functions"); #define SQLlanguageId 14 -#endif /* PG_LANGUAGE_H */ +#endif /* PG_LANGUAGE_H */ diff --git a/src/include/catalog/pg_largeobject.h b/src/include/catalog/pg_largeobject.h index 93c8c6af6e..f2df67c35f 100644 --- a/src/include/catalog/pg_largeobject.h +++ b/src/include/catalog/pg_largeobject.h @@ -34,7 +34,8 @@ CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS int32 pageno; /* Page number (starting from 0) */ /* data has variable length, but we allow direct access; see inv_api.c */ - bytea data BKI_FORCE_NOT_NULL; /* Data for page (may be zero-length) */ + bytea data BKI_FORCE_NOT_NULL; /* Data for page (may be + * zero-length) */ } FormData_pg_largeobject; /* ---------------- @@ -57,4 +58,4 @@ extern Oid LargeObjectCreate(Oid loid); extern void LargeObjectDrop(Oid loid); extern bool LargeObjectExists(Oid loid); -#endif /* PG_LARGEOBJECT_H */ +#endif /* PG_LARGEOBJECT_H */ diff --git a/src/include/catalog/pg_largeobject_metadata.h b/src/include/catalog/pg_largeobject_metadata.h index 16cb602a6c..7ae6d8c02b 100644 --- a/src/include/catalog/pg_largeobject_metadata.h +++ b/src/include/catalog/pg_largeobject_metadata.h @@ -52,4 +52,4 @@ typedef FormData_pg_largeobject_metadata *Form_pg_largeobject_metadata; #define Anum_pg_largeobject_metadata_lomowner 1 #define Anum_pg_largeobject_metadata_lomacl 2 -#endif /* PG_LARGEOBJECT_METADATA_H */ +#endif /* PG_LARGEOBJECT_METADATA_H */ diff --git a/src/include/catalog/pg_namespace.h b/src/include/catalog/pg_namespace.h index 010190e35c..095c5154ae 100644 --- a/src/include/catalog/pg_namespace.h +++ b/src/include/catalog/pg_namespace.h @@ -88,4 +88,4 @@ DESCR("StormDB catalog schema"); */ extern Oid NamespaceCreate(const char *nspName, Oid ownerId, bool isTemp); -#endif /* PG_NAMESPACE_H */ +#endif /* PG_NAMESPACE_H */ diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h index 5819d5309f..28dbc747d5 100644 --- a/src/include/catalog/pg_opclass.h +++ b/src/include/catalog/pg_opclass.h @@ -247,4 +247,4 @@ DATA(insert ( 3580 pg_lsn_minmax_ops PGNSP PGUID 4082 3220 t 3220 )); DATA(insert ( 3580 box_inclusion_ops PGNSP PGUID 4104 603 t 603 )); /* no brin opclass for the geometric types except box */ -#endif /* PG_OPCLASS_H */ +#endif /* PG_OPCLASS_H */ diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index ccbb17efec..ffabc2003b 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -1854,4 +1854,4 @@ DESCR("delete array element"); DATA(insert OID = 3287 ( "#-" PGNSP PGUID b f f 3802 1009 3802 0 0 jsonb_delete_path - - )); DESCR("delete path"); -#endif /* PG_OPERATOR_H */ +#endif /* PG_OPERATOR_H */ diff --git a/src/include/catalog/pg_operator_fn.h b/src/include/catalog/pg_operator_fn.h index d8ea390fdf..37f5c712fe 100644 --- a/src/include/catalog/pg_operator_fn.h +++ b/src/include/catalog/pg_operator_fn.h @@ -33,4 +33,4 @@ extern ObjectAddress makeOperatorDependencies(HeapTuple tuple, bool isUpdate); extern void OperatorUpd(Oid baseId, Oid commId, Oid negId, bool isDelete); -#endif /* PG_OPERATOR_FN_H */ +#endif /* PG_OPERATOR_FN_H */ diff --git a/src/include/catalog/pg_opfamily.h b/src/include/catalog/pg_opfamily.h index 546527aa8e..0d0ba7c66a 100644 --- a/src/include/catalog/pg_opfamily.h +++ b/src/include/catalog/pg_opfamily.h @@ -187,4 +187,4 @@ DATA(insert OID = 4082 ( 3580 pg_lsn_minmax_ops PGNSP PGUID )); DATA(insert OID = 4104 ( 3580 box_inclusion_ops PGNSP PGUID )); DATA(insert OID = 5000 ( 4000 box_ops PGNSP PGUID )); -#endif /* PG_OPFAMILY_H */ +#endif /* PG_OPFAMILY_H */ diff --git a/src/include/catalog/pg_partitioned_table.h b/src/include/catalog/pg_partitioned_table.h index bdff36a04b..38d64d6511 100644 --- a/src/include/catalog/pg_partitioned_table.h +++ b/src/include/catalog/pg_partitioned_table.h @@ -71,4 +71,4 @@ typedef FormData_pg_partitioned_table *Form_pg_partitioned_table; #define Anum_pg_partitioned_table_partcollation 6 #define Anum_pg_partitioned_table_partexprs 7 -#endif /* PG_PARTITIONED_TABLE_H */ +#endif /* PG_PARTITIONED_TABLE_H */ diff --git a/src/include/catalog/pg_pltemplate.h b/src/include/catalog/pg_pltemplate.h index 6d770fbb3c..fbe71bd0c3 100644 --- a/src/include/catalog/pg_pltemplate.h +++ b/src/include/catalog/pg_pltemplate.h @@ -35,11 +35,11 @@ CATALOG(pg_pltemplate,1136) BKI_SHARED_RELATION BKI_WITHOUT_OIDS bool tmpldbacreate; /* PL is installable by db owner? */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text tmplhandler BKI_FORCE_NOT_NULL; /* name of call handler + text tmplhandler BKI_FORCE_NOT_NULL; /* name of call handler * function */ text tmplinline; /* name of anonymous-block handler, or NULL */ text tmplvalidator; /* name of validator function, or NULL */ - text tmpllibrary BKI_FORCE_NOT_NULL; /* path of shared library */ + text tmpllibrary BKI_FORCE_NOT_NULL; /* path of shared library */ aclitem tmplacl[1]; /* access privileges for template */ #endif } FormData_pg_pltemplate; @@ -80,4 +80,4 @@ DATA(insert ( "plpythonu" f f "plpython_call_handler" "plpython_inline_handler" DATA(insert ( "plpython2u" f f "plpython2_call_handler" "plpython2_inline_handler" "plpython2_validator" "$libdir/plpython2" _null_ )); DATA(insert ( "plpython3u" f f "plpython3_call_handler" "plpython3_inline_handler" "plpython3_validator" "$libdir/plpython3" _null_ )); -#endif /* PG_PLTEMPLATE_H */ +#endif /* PG_PLTEMPLATE_H */ diff --git a/src/include/catalog/pg_policy.h b/src/include/catalog/pg_policy.h index 331584f5e0..86000737fa 100644 --- a/src/include/catalog/pg_policy.h +++ b/src/include/catalog/pg_policy.h @@ -52,4 +52,4 @@ typedef FormData_pg_policy *Form_pg_policy; #define Anum_pg_policy_polqual 6 #define Anum_pg_policy_polwithcheck 7 -#endif /* PG_POLICY_H */ +#endif /* PG_POLICY_H */ diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index cafdb8990a..d44c4ecc0b 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -63,13 +63,13 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO oidvector proargtypes; /* parameter types (excludes OUT params) */ #ifdef CATALOG_VARLEN - Oid proallargtypes[1]; /* all param types (NULL if IN only) */ + Oid proallargtypes[1]; /* all param types (NULL if IN only) */ char proargmodes[1]; /* parameter modes (NULL if IN only) */ text proargnames[1]; /* parameter names (NULL if no names) */ - pg_node_tree proargdefaults;/* list of expression trees for argument - * defaults (NULL if none) */ + pg_node_tree proargdefaults; /* list of expression trees for argument + * defaults (NULL if none) */ Oid protrftypes[1]; /* types for which to apply transforms */ - text prosrc BKI_FORCE_NOT_NULL; /* procedure source text */ + text prosrc BKI_FORCE_NOT_NULL; /* procedure source text */ text probin; /* secondary procedure info (can be NULL) */ text proconfig[1]; /* procedure-local GUC settings */ aclitem proacl[1]; /* access permissions */ @@ -5464,8 +5464,10 @@ DATA(insert OID = 6020 ( pg_msgmodule_disable_all PGNSP PGUID 12 1 1 0 0 f f f f DESCR("all processes to ignore overriden log levels"); #endif /* publications */ -DATA(insert OID = 6119 ( pg_get_publication_tables PGNSP PGUID 12 1 1000 0 0 f f t f t t s s 1 0 26 "25" "{25,26}" "{i,o}" "{pubname,relid}" _null_ _null_ pg_get_publication_tables _null_ _null_ _null_ )); +DATA(insert OID = 6119 ( pg_get_publication_tables PGNSP PGUID 12 1 1000 0 0 f f f f t t s s 1 0 26 "25" "{25,26}" "{i,o}" "{pubname,relid}" _null_ _null_ pg_get_publication_tables _null_ _null_ _null_ )); DESCR("get OIDs of tables in a publication"); +DATA(insert OID = 6121 ( pg_relation_is_publishable PGNSP PGUID 12 1 0 0 0 f f f f t f s s 1 0 16 "2205" _null_ _null_ _null_ _null_ _null_ pg_relation_is_publishable _null_ _null_ _null_ )); +DESCR("returns whether a relation can be part of a publication"); /* rls */ DATA(insert OID = 3298 ( row_security_active PGNSP PGUID 12 1 0 0 0 f f f f t f s s 1 0 16 "26" _null_ _null_ _null_ _null_ _null_ row_security_active _null_ _null_ _null_ )); @@ -5490,11 +5492,12 @@ DESCR("pg_controldata recovery state information as a function"); DATA(insert OID = 3444 ( pg_control_init PGNSP PGUID 12 1 0 0 0 f f f f t f v s 0 0 2249 "" "{23,23,23,23,23,23,23,23,23,16,16,23}" "{o,o,o,o,o,o,o,o,o,o,o,o}" "{max_data_alignment,database_block_size,blocks_per_segment,wal_block_size,bytes_per_wal_segment,max_identifier_length,max_index_columns,max_toast_chunk_size,large_object_chunk_size,float4_pass_by_value,float8_pass_by_value,data_page_checksum_version}" _null_ _null_ pg_control_init _null_ _null_ _null_ )); DESCR("pg_controldata init state information as a function"); -DATA(insert OID = 3445 ( pg_import_system_collations PGNSP PGUID 12 100 0 0 0 f f f f t f v r 2 0 2278 "16 4089" _null_ _null_ "{if_not_exists,schema}" _null_ _null_ pg_import_system_collations _null_ _null_ _null_ )); +/* collation management functions */ +DATA(insert OID = 3445 ( pg_import_system_collations PGNSP PGUID 12 100 0 0 0 f f f f t f v r 1 0 23 "4089" _null_ _null_ _null_ _null_ _null_ pg_import_system_collations _null_ _null_ _null_ )); DESCR("import collations from operating system"); DATA(insert OID = 3448 ( pg_collation_actual_version PGNSP PGUID 12 100 0 0 0 f f f f t f v s 1 0 25 "26" _null_ _null_ _null_ _null_ _null_ pg_collation_actual_version _null_ _null_ _null_ )); -DESCR("import collations from operating system"); +DESCR("get actual version of collation from operating system"); /* system management/monitoring related functions */ DATA(insert OID = 3353 ( pg_ls_logdir PGNSP PGUID 12 10 20 0 0 f f f f t t v s 0 0 2249 "" "{25,20,1184}" "{o,o,o}" "{name,size,modification}" _null_ _null_ pg_ls_logdir _null_ _null_ _null_ )); @@ -5510,18 +5513,18 @@ DESCR("list of files in the WAL directory"); * must be labeled volatile to ensure they will not get optimized away, * even if the actual return value is not changeable. */ -#define PROVOLATILE_IMMUTABLE 'i' /* never changes for given input */ -#define PROVOLATILE_STABLE 's' /* does not change within a scan */ -#define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */ +#define PROVOLATILE_IMMUTABLE 'i' /* never changes for given input */ +#define PROVOLATILE_STABLE 's' /* does not change within a scan */ +#define PROVOLATILE_VOLATILE 'v' /* can change even within a scan */ /* * Symbolic values for proparallel column: these indicate whether a function * can be safely be run in a parallel backend, during parallelism but * necessarily in the master, or only in non-parallel mode. */ -#define PROPARALLEL_SAFE 's' /* can run in worker or master */ -#define PROPARALLEL_RESTRICTED 'r' /* can run in parallel master only */ -#define PROPARALLEL_UNSAFE 'u' /* banned while in parallel mode */ +#define PROPARALLEL_SAFE 's' /* can run in worker or master */ +#define PROPARALLEL_RESTRICTED 'r' /* can run in parallel master only */ +#define PROPARALLEL_UNSAFE 'u' /* banned while in parallel mode */ /* * Symbolic values for proargmodes column. Note that these must agree with @@ -5534,4 +5537,4 @@ DESCR("list of files in the WAL directory"); #define PROARGMODE_VARIADIC 'v' #define PROARGMODE_TABLE 't' -#endif /* PG_PROC_H */ +#endif /* PG_PROC_H */ diff --git a/src/include/catalog/pg_proc_fn.h b/src/include/catalog/pg_proc_fn.h index 993278a91a..2c85f5d267 100644 --- a/src/include/catalog/pg_proc_fn.h +++ b/src/include/catalog/pg_proc_fn.h @@ -48,4 +48,4 @@ extern bool function_parse_error_transpose(const char *prosrc); extern List *oid_array_to_list(Datum datum); -#endif /* PG_PROC_FN_H */ +#endif /* PG_PROC_FN_H */ diff --git a/src/include/catalog/pg_publication.h b/src/include/catalog/pg_publication.h index c2086c1f42..aa148960cd 100644 --- a/src/include/catalog/pg_publication.h +++ b/src/include/catalog/pg_publication.h @@ -101,4 +101,4 @@ extern char *get_publication_name(Oid pubid); extern Datum pg_get_publication_tables(PG_FUNCTION_ARGS); -#endif /* PG_PUBLICATION_H */ +#endif /* PG_PUBLICATION_H */ diff --git a/src/include/catalog/pg_publication_rel.h b/src/include/catalog/pg_publication_rel.h index f889b6f4db..3729e5abdc 100644 --- a/src/include/catalog/pg_publication_rel.h +++ b/src/include/catalog/pg_publication_rel.h @@ -49,4 +49,4 @@ typedef FormData_pg_publication_rel *Form_pg_publication_rel; #define Anum_pg_publication_rel_prpubid 1 #define Anum_pg_publication_rel_prrelid 2 -#endif /* PG_PUBLICATION_REL_H */ +#endif /* PG_PUBLICATION_REL_H */ diff --git a/src/include/catalog/pg_range.h b/src/include/catalog/pg_range.h index 4ed57fe2e9..f12e82b2f2 100644 --- a/src/include/catalog/pg_range.h +++ b/src/include/catalog/pg_range.h @@ -82,4 +82,4 @@ extern void RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation, RegProcedure rangeSubDiff); extern void RangeDelete(Oid rangeTypeOid); -#endif /* PG_RANGE_H */ +#endif /* PG_RANGE_H */ diff --git a/src/include/catalog/pg_replication_origin.h b/src/include/catalog/pg_replication_origin.h index c22831f517..24c8a8430c 100644 --- a/src/include/catalog/pg_replication_origin.h +++ b/src/include/catalog/pg_replication_origin.h @@ -46,7 +46,7 @@ CATALOG(pg_replication_origin,6000) BKI_SHARED_RELATION BKI_WITHOUT_OIDS */ /* external, free-format, name */ - text roname BKI_FORCE_NOT_NULL; + text roname BKI_FORCE_NOT_NULL; #ifdef CATALOG_VARLEN /* further variable-length fields */ #endif @@ -67,4 +67,4 @@ typedef FormData_pg_replication_origin *Form_pg_replication_origin; * ---------------- */ -#endif /* PG_REPLICATION_ORIGIN_H */ +#endif /* PG_REPLICATION_ORIGIN_H */ diff --git a/src/include/catalog/pg_rewrite.h b/src/include/catalog/pg_rewrite.h index 425a336755..48b9333a9d 100644 --- a/src/include/catalog/pg_rewrite.h +++ b/src/include/catalog/pg_rewrite.h @@ -65,4 +65,4 @@ typedef FormData_pg_rewrite *Form_pg_rewrite; #define Anum_pg_rewrite_ev_qual 6 #define Anum_pg_rewrite_ev_action 7 -#endif /* PG_REWRITE_H */ +#endif /* PG_REWRITE_H */ diff --git a/src/include/catalog/pg_seclabel.h b/src/include/catalog/pg_seclabel.h index 01e14e77c0..3db9612fc3 100644 --- a/src/include/catalog/pg_seclabel.h +++ b/src/include/catalog/pg_seclabel.h @@ -27,8 +27,8 @@ CATALOG(pg_seclabel,3596) BKI_WITHOUT_OIDS int32 objsubid; /* column number, or 0 if not used */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text provider BKI_FORCE_NOT_NULL; /* name of label provider */ - text label BKI_FORCE_NOT_NULL; /* security label of the object */ + text provider BKI_FORCE_NOT_NULL; /* name of label provider */ + text label BKI_FORCE_NOT_NULL; /* security label of the object */ #endif } FormData_pg_seclabel; @@ -43,4 +43,4 @@ CATALOG(pg_seclabel,3596) BKI_WITHOUT_OIDS #define Anum_pg_seclabel_provider 4 #define Anum_pg_seclabel_label 5 -#endif /* PG_SECLABEL_H */ +#endif /* PG_SECLABEL_H */ diff --git a/src/include/catalog/pg_sequence.h b/src/include/catalog/pg_sequence.h index 26d2993674..8ae6b7143d 100644 --- a/src/include/catalog/pg_sequence.h +++ b/src/include/catalog/pg_sequence.h @@ -29,4 +29,4 @@ typedef FormData_pg_sequence *Form_pg_sequence; #define Anum_pg_sequence_seqcache 7 #define Anum_pg_sequence_seqcycle 8 -#endif /* PG_SEQUENCE_H */ +#endif /* PG_SEQUENCE_H */ diff --git a/src/include/catalog/pg_shdepend.h b/src/include/catalog/pg_shdepend.h index ae1aa4f952..51b6588d3e 100644 --- a/src/include/catalog/pg_shdepend.h +++ b/src/include/catalog/pg_shdepend.h @@ -87,4 +87,4 @@ typedef FormData_pg_shdepend *Form_pg_shdepend; * are explicitly stored in pg_shdepend. */ -#endif /* PG_SHDEPEND_H */ +#endif /* PG_SHDEPEND_H */ diff --git a/src/include/catalog/pg_shdescription.h b/src/include/catalog/pg_shdescription.h index 21086447fa..154c48b584 100644 --- a/src/include/catalog/pg_shdescription.h +++ b/src/include/catalog/pg_shdescription.h @@ -44,7 +44,7 @@ CATALOG(pg_shdescription,2396) BKI_SHARED_RELATION BKI_WITHOUT_OIDS Oid classoid; /* OID of table containing object */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text description BKI_FORCE_NOT_NULL; /* description of object */ + text description BKI_FORCE_NOT_NULL; /* description of object */ #endif } FormData_pg_shdescription; @@ -53,7 +53,7 @@ CATALOG(pg_shdescription,2396) BKI_SHARED_RELATION BKI_WITHOUT_OIDS * the format of pg_shdescription relation. * ---------------- */ -typedef FormData_pg_shdescription *Form_pg_shdescription; +typedef FormData_pg_shdescription * Form_pg_shdescription; /* ---------------- * compiler constants for pg_shdescription @@ -75,4 +75,4 @@ typedef FormData_pg_shdescription *Form_pg_shdescription; * by genbki.pl and loaded during initdb. */ -#endif /* PG_SHDESCRIPTION_H */ +#endif /* PG_SHDESCRIPTION_H */ diff --git a/src/include/catalog/pg_shseclabel.h b/src/include/catalog/pg_shseclabel.h index a88f65c169..f8a906bb12 100644 --- a/src/include/catalog/pg_shseclabel.h +++ b/src/include/catalog/pg_shseclabel.h @@ -27,12 +27,12 @@ CATALOG(pg_shseclabel,3592) BKI_SHARED_RELATION BKI_ROWTYPE_OID(4066) BKI_WITHOU Oid classoid; /* OID of table containing the shared object */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ - text provider BKI_FORCE_NOT_NULL; /* name of label provider */ - text label BKI_FORCE_NOT_NULL; /* security label of the object */ + text provider BKI_FORCE_NOT_NULL; /* name of label provider */ + text label BKI_FORCE_NOT_NULL; /* security label of the object */ #endif } FormData_pg_shseclabel; -typedef FormData_pg_shseclabel *Form_pg_shseclabel; +typedef FormData_pg_shseclabel * Form_pg_shseclabel; /* ---------------- * compiler constants for pg_shseclabel @@ -44,4 +44,4 @@ typedef FormData_pg_shseclabel *Form_pg_shseclabel; #define Anum_pg_shseclabel_provider 3 #define Anum_pg_shseclabel_label 4 -#endif /* PG_SHSECLABEL_H */ +#endif /* PG_SHSECLABEL_H */ diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h index 3576419a2f..3713a56bbd 100644 --- a/src/include/catalog/pg_statistic.h +++ b/src/include/catalog/pg_statistic.h @@ -291,4 +291,4 @@ typedef FormData_pg_statistic *Form_pg_statistic; */ #define STATISTIC_KIND_BOUNDS_HISTOGRAM 7 -#endif /* PG_STATISTIC_H */ +#endif /* PG_STATISTIC_H */ diff --git a/src/include/catalog/pg_statistic_ext.h b/src/include/catalog/pg_statistic_ext.h index d302b7fc01..78138026db 100644 --- a/src/include/catalog/pg_statistic_ext.h +++ b/src/include/catalog/pg_statistic_ext.h @@ -77,4 +77,4 @@ typedef FormData_pg_statistic_ext *Form_pg_statistic_ext; #define STATS_EXT_NDISTINCT 'd' #define STATS_EXT_DEPENDENCIES 'f' -#endif /* PG_STATISTIC_EXT_H */ +#endif /* PG_STATISTIC_EXT_H */ diff --git a/src/include/catalog/pg_subscription.h b/src/include/catalog/pg_subscription.h index b2cebd4a4b..274ff6bc42 100644 --- a/src/include/catalog/pg_subscription.h +++ b/src/include/catalog/pg_subscription.h @@ -42,13 +42,13 @@ CATALOG(pg_subscription,6100) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101) BKI_SCHE #ifdef CATALOG_VARLEN /* variable-length fields start here */ /* Connection string to the publisher */ - text subconninfo BKI_FORCE_NOT_NULL; + text subconninfo BKI_FORCE_NOT_NULL; /* Slot name on publisher */ NameData subslotname; /* Synchronous commit setting for worker */ - text subsynccommit BKI_FORCE_NOT_NULL; + text subsynccommit BKI_FORCE_NOT_NULL; /* List of publications subscribed to */ text subpublications[1] BKI_FORCE_NOT_NULL; @@ -93,4 +93,4 @@ extern char *get_subscription_name(Oid subid); extern int CountDBSubscriptions(Oid dbid); -#endif /* PG_SUBSCRIPTION_H */ +#endif /* PG_SUBSCRIPTION_H */ diff --git a/src/include/catalog/pg_subscription_rel.h b/src/include/catalog/pg_subscription_rel.h index f5f6191676..991ca9d552 100644 --- a/src/include/catalog/pg_subscription_rel.h +++ b/src/include/catalog/pg_subscription_rel.h @@ -51,17 +51,17 @@ 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 in front - * 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_SYNCWAIT 'w' /* waiting for sync */ +#define SUBREL_STATE_CATCHUP 'c' /* catching up with apply */ typedef struct SubscriptionRelState { @@ -79,4 +79,4 @@ extern void RemoveSubscriptionRel(Oid subid, Oid relid); extern List *GetSubscriptionRelations(Oid subid); extern List *GetSubscriptionNotReadyRelations(Oid subid); -#endif /* PG_SUBSCRIPTION_REL_H */ +#endif /* PG_SUBSCRIPTION_REL_H */ diff --git a/src/include/catalog/pg_tablespace.h b/src/include/catalog/pg_tablespace.h index d9ea4b7d63..b759d5cea4 100644 --- a/src/include/catalog/pg_tablespace.h +++ b/src/include/catalog/pg_tablespace.h @@ -63,4 +63,4 @@ DATA(insert OID = 1664 ( pg_global PGUID _null_ _null_ )); #define DEFAULTTABLESPACE_OID 1663 #define GLOBALTABLESPACE_OID 1664 -#endif /* PG_TABLESPACE_H */ +#endif /* PG_TABLESPACE_H */ diff --git a/src/include/catalog/pg_transform.h b/src/include/catalog/pg_transform.h index 3415db3bd6..8b1610bb83 100644 --- a/src/include/catalog/pg_transform.h +++ b/src/include/catalog/pg_transform.h @@ -44,4 +44,4 @@ typedef FormData_pg_transform *Form_pg_transform; #define Anum_pg_transform_trffromsql 3 #define Anum_pg_transform_trftosql 4 -#endif /* PG_TRANSFORM_H */ +#endif /* PG_TRANSFORM_H */ diff --git a/src/include/catalog/pg_trigger.h b/src/include/catalog/pg_trigger.h index 547332fe65..f413caf34f 100644 --- a/src/include/catalog/pg_trigger.h +++ b/src/include/catalog/pg_trigger.h @@ -57,7 +57,7 @@ CATALOG(pg_trigger,2620) int2vector tgattr; /* column numbers, if trigger is on columns */ #ifdef CATALOG_VARLEN - bytea tgargs BKI_FORCE_NOT_NULL; /* first\000second\000tgnargs\000 */ + bytea tgargs BKI_FORCE_NOT_NULL; /* first\000second\000tgnargs\000 */ pg_node_tree tgqual; /* WHEN expression, or NULL if none */ NameData tgoldtable; /* old transition table, or NULL if none */ NameData tgnewtable; /* new transition table, or NULL if none */ @@ -153,4 +153,4 @@ typedef FormData_pg_trigger *Form_pg_trigger; #define TRIGGER_USES_TRANSITION_TABLE(namepointer) \ ((namepointer) != (char *) NULL) -#endif /* PG_TRIGGER_H */ +#endif /* PG_TRIGGER_H */ diff --git a/src/include/catalog/pg_ts_config.h b/src/include/catalog/pg_ts_config.h index b61cf857d9..0ba79a596f 100644 --- a/src/include/catalog/pg_ts_config.h +++ b/src/include/catalog/pg_ts_config.h @@ -57,4 +57,4 @@ typedef FormData_pg_ts_config *Form_pg_ts_config; DATA(insert OID = 3748 ( "simple" PGNSP PGUID 3722 )); DESCR("simple configuration"); -#endif /* PG_TS_CONFIG_H */ +#endif /* PG_TS_CONFIG_H */ diff --git a/src/include/catalog/pg_ts_config_map.h b/src/include/catalog/pg_ts_config_map.h index fc9467fd9c..3df05195be 100644 --- a/src/include/catalog/pg_ts_config_map.h +++ b/src/include/catalog/pg_ts_config_map.h @@ -75,4 +75,4 @@ DATA(insert ( 3748 20 1 3765 )); DATA(insert ( 3748 21 1 3765 )); DATA(insert ( 3748 22 1 3765 )); -#endif /* PG_TS_CONFIG_MAP_H */ +#endif /* PG_TS_CONFIG_MAP_H */ diff --git a/src/include/catalog/pg_ts_dict.h b/src/include/catalog/pg_ts_dict.h index 28b7bb7c0d..634ea703e3 100644 --- a/src/include/catalog/pg_ts_dict.h +++ b/src/include/catalog/pg_ts_dict.h @@ -63,4 +63,4 @@ typedef FormData_pg_ts_dict *Form_pg_ts_dict; DATA(insert OID = 3765 ( "simple" PGNSP PGUID 3727 _null_)); DESCR("simple dictionary: just lower case and check for stopword"); -#endif /* PG_TS_DICT_H */ +#endif /* PG_TS_DICT_H */ diff --git a/src/include/catalog/pg_ts_parser.h b/src/include/catalog/pg_ts_parser.h index cfb87b4d56..96e09bdcd8 100644 --- a/src/include/catalog/pg_ts_parser.h +++ b/src/include/catalog/pg_ts_parser.h @@ -64,4 +64,4 @@ typedef FormData_pg_ts_parser *Form_pg_ts_parser; DATA(insert OID = 3722 ( "default" PGNSP prsd_start prsd_nexttoken prsd_end prsd_headline prsd_lextype )); DESCR("default word parser"); -#endif /* PG_TS_PARSER_H */ +#endif /* PG_TS_PARSER_H */ diff --git a/src/include/catalog/pg_ts_template.h b/src/include/catalog/pg_ts_template.h index 5fc6eea243..dc0148c68b 100644 --- a/src/include/catalog/pg_ts_template.h +++ b/src/include/catalog/pg_ts_template.h @@ -64,4 +64,4 @@ DESCR("ispell dictionary"); DATA(insert OID = 3742 ( "thesaurus" PGNSP thesaurus_init thesaurus_lexize )); DESCR("thesaurus dictionary: phrase by phrase substitution"); -#endif /* PG_TS_TEMPLATE_H */ +#endif /* PG_TS_TEMPLATE_H */ diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 8dfbc8a15f..e4a81a113d 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -732,14 +732,14 @@ DATA(insert OID = 3831 ( anyrange PGNSP PGUID -1 f p P f t \054 0 0 0 anyrange #define TYPCATEGORY_DATETIME 'D' #define TYPCATEGORY_ENUM 'E' #define TYPCATEGORY_GEOMETRIC 'G' -#define TYPCATEGORY_NETWORK 'I' /* think INET */ +#define TYPCATEGORY_NETWORK 'I' /* think INET */ #define TYPCATEGORY_NUMERIC 'N' #define TYPCATEGORY_PSEUDOTYPE 'P' #define TYPCATEGORY_RANGE 'R' #define TYPCATEGORY_STRING 'S' #define TYPCATEGORY_TIMESPAN 'T' #define TYPCATEGORY_USER 'U' -#define TYPCATEGORY_BITSTRING 'V' /* er ... "varbit"? */ +#define TYPCATEGORY_BITSTRING 'V' /* er ... "varbit"? */ #define TYPCATEGORY_UNKNOWN 'X' /* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */ @@ -750,4 +750,4 @@ DATA(insert OID = 3831 ( anyrange PGNSP PGUID -1 f p P f t \054 0 0 0 anyrange (typid) == ANYENUMOID || \ (typid) == ANYRANGEOID) -#endif /* PG_TYPE_H */ +#endif /* PG_TYPE_H */ diff --git a/src/include/catalog/pg_type_fn.h b/src/include/catalog/pg_type_fn.h index 01f095612d..b570d3588f 100644 --- a/src/include/catalog/pg_type_fn.h +++ b/src/include/catalog/pg_type_fn.h @@ -81,4 +81,4 @@ extern char *makeArrayTypeName(const char *typeName, Oid typeNamespace); extern bool moveArrayTypeName(Oid typeOid, const char *typeName, Oid typeNamespace); -#endif /* PG_TYPE_FN_H */ +#endif /* PG_TYPE_FN_H */ diff --git a/src/include/catalog/pg_user_mapping.h b/src/include/catalog/pg_user_mapping.h index 1ebf4611df..f08e6a72ed 100644 --- a/src/include/catalog/pg_user_mapping.h +++ b/src/include/catalog/pg_user_mapping.h @@ -54,4 +54,4 @@ typedef FormData_pg_user_mapping *Form_pg_user_mapping; #define Anum_pg_user_mapping_umserver 2 #define Anum_pg_user_mapping_umoptions 3 -#endif /* PG_USER_MAPPING_H */ +#endif /* PG_USER_MAPPING_H */ diff --git a/src/include/catalog/storage.h b/src/include/catalog/storage.h index fea96deba3..a3a97db929 100644 --- a/src/include/catalog/storage.h +++ b/src/include/catalog/storage.h @@ -33,4 +33,4 @@ extern void AtSubCommit_smgr(void); extern void AtSubAbort_smgr(void); extern void PostPrepare_smgr(void); -#endif /* STORAGE_H */ +#endif /* STORAGE_H */ diff --git a/src/include/catalog/storage_xlog.h b/src/include/catalog/storage_xlog.h index fcdd0233b1..4c08005228 100644 --- a/src/include/catalog/storage_xlog.h +++ b/src/include/catalog/storage_xlog.h @@ -56,4 +56,4 @@ extern void smgr_redo(XLogReaderState *record); extern void smgr_desc(StringInfo buf, XLogReaderState *record); extern const char *smgr_identify(uint8 info); -#endif /* STORAGE_XLOG_H */ +#endif /* STORAGE_XLOG_H */ diff --git a/src/include/catalog/toasting.h b/src/include/catalog/toasting.h index 00d0a8326f..f82a799572 100644 --- a/src/include/catalog/toasting.h +++ b/src/include/catalog/toasting.h @@ -67,4 +67,4 @@ DECLARE_TOAST(pg_shseclabel, 4060, 4061); #define PgShseclabelToastTable 4060 #define PgShseclabelToastIndex 4061 -#endif /* TOASTING_H */ +#endif /* TOASTING_H */ diff --git a/src/include/commands/alter.h b/src/include/commands/alter.h index b7aa86cb57..4365357ab8 100644 --- a/src/include/commands/alter.h +++ b/src/include/commands/alter.h @@ -32,4 +32,4 @@ extern ObjectAddress ExecAlterOwnerStmt(AlterOwnerStmt *stmt); extern void AlterObjectOwner_internal(Relation catalog, Oid objectId, Oid new_ownerId); -#endif /* ALTER_H */ +#endif /* ALTER_H */ diff --git a/src/include/commands/async.h b/src/include/commands/async.h index b7842d1a0f..939711d8d9 100644 --- a/src/include/commands/async.h +++ b/src/include/commands/async.h @@ -54,4 +54,4 @@ extern void HandleNotifyInterrupt(void); /* process interrupts */ extern void ProcessNotifyInterrupt(void); -#endif /* ASYNC_H */ +#endif /* ASYNC_H */ diff --git a/src/include/commands/cluster.h b/src/include/commands/cluster.h index 7c9d4746d9..7bade9fad2 100644 --- a/src/include/commands/cluster.h +++ b/src/include/commands/cluster.h @@ -36,4 +36,4 @@ extern void finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap, MultiXactId minMulti, char newrelpersistence); -#endif /* CLUSTER_H */ +#endif /* CLUSTER_H */ diff --git a/src/include/commands/collationcmds.h b/src/include/commands/collationcmds.h index df5623ccb6..30e847432e 100644 --- a/src/include/commands/collationcmds.h +++ b/src/include/commands/collationcmds.h @@ -22,4 +22,4 @@ extern ObjectAddress DefineCollation(ParseState *pstate, List *names, List *para extern void IsThereCollationInNamespace(const char *collname, Oid nspOid); extern ObjectAddress AlterCollation(AlterCollationStmt *stmt); -#endif /* COLLATIONCMDS_H */ +#endif /* COLLATIONCMDS_H */ diff --git a/src/include/commands/comment.h b/src/include/commands/comment.h index 684ea8b697..85bd801513 100644 --- a/src/include/commands/comment.h +++ b/src/include/commands/comment.h @@ -42,4 +42,4 @@ extern void CreateSharedComments(Oid oid, Oid classoid, char *comment); extern char *GetComment(Oid oid, Oid classoid, int32 subid); -#endif /* COMMENT_H */ +#endif /* COMMENT_H */ diff --git a/src/include/commands/conversioncmds.h b/src/include/commands/conversioncmds.h index 20d7f0e9b1..7054505794 100644 --- a/src/include/commands/conversioncmds.h +++ b/src/include/commands/conversioncmds.h @@ -20,4 +20,4 @@ extern ObjectAddress CreateConversionCommand(CreateConversionStmt *parsetree); -#endif /* CONVERSIONCMDS_H */ +#endif /* CONVERSIONCMDS_H */ diff --git a/src/include/commands/copy.h b/src/include/commands/copy.h index f081f2219f..8b2971d287 100644 --- a/src/include/commands/copy.h +++ b/src/include/commands/copy.h @@ -41,4 +41,4 @@ extern uint64 CopyFrom(CopyState cstate); extern DestReceiver *CreateCopyDestReceiver(void); -#endif /* COPY_H */ +#endif /* COPY_H */ diff --git a/src/include/commands/createas.h b/src/include/commands/createas.h index c3c43f6b36..aaf4fac97b 100644 --- a/src/include/commands/createas.h +++ b/src/include/commands/createas.h @@ -22,10 +22,10 @@ extern ObjectAddress ExecCreateTableAs(CreateTableAsStmt *stmt, const char *queryString, - ParamListInfo params, QueryEnvironment *queryEnv, char *completionTag); + ParamListInfo params, QueryEnvironment *queryEnv, char *completionTag); extern int GetIntoRelEFlags(IntoClause *intoClause); extern DestReceiver *CreateIntoRelDestReceiver(IntoClause *intoClause); -#endif /* CREATEAS_H */ +#endif /* CREATEAS_H */ diff --git a/src/include/commands/dbcommands.h b/src/include/commands/dbcommands.h index 5a74a02a5d..91186654d0 100644 --- a/src/include/commands/dbcommands.h +++ b/src/include/commands/dbcommands.h @@ -35,4 +35,4 @@ extern void check_encoding_locale_matches(int encoding, const char *collate, con extern bool IsSetTableSpace(AlterDatabaseStmt *stmt); #endif -#endif /* DBCOMMANDS_H */ +#endif /* DBCOMMANDS_H */ diff --git a/src/include/commands/dbcommands_xlog.h b/src/include/commands/dbcommands_xlog.h index 6583d0d5bd..63b1a6470c 100644 --- a/src/include/commands/dbcommands_xlog.h +++ b/src/include/commands/dbcommands_xlog.h @@ -41,4 +41,4 @@ extern void dbase_redo(XLogReaderState *rptr); extern void dbase_desc(StringInfo buf, XLogReaderState *rptr); extern const char *dbase_identify(uint8 info); -#endif /* DBCOMMANDS_XLOG_H */ +#endif /* DBCOMMANDS_XLOG_H */ diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 5dd14b43d3..f7bb4a54f7 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -164,4 +164,4 @@ extern TypeName *defGetTypeName(DefElem *def); extern int defGetTypeLength(DefElem *def); extern List *defGetStringList(DefElem *def); -#endif /* DEFREM_H */ +#endif /* DEFREM_H */ diff --git a/src/include/commands/discard.h b/src/include/commands/discard.h index b960cab51f..8ea0b30ddf 100644 --- a/src/include/commands/discard.h +++ b/src/include/commands/discard.h @@ -17,4 +17,4 @@ extern void DiscardCommand(DiscardStmt *stmt, bool isTopLevel); -#endif /* DISCARD_H */ +#endif /* DISCARD_H */ diff --git a/src/include/commands/event_trigger.h b/src/include/commands/event_trigger.h index 0017bd0cd4..2ce528272c 100644 --- a/src/include/commands/event_trigger.h +++ b/src/include/commands/event_trigger.h @@ -86,4 +86,4 @@ extern void EventTriggerCollectAlterTSConfig(AlterTSConfigurationStmt *stmt, Oid cfgId, Oid *dictIds, int ndicts); extern void EventTriggerCollectAlterDefPrivs(AlterDefaultPrivilegesStmt *stmt); -#endif /* EVENT_TRIGGER_H */ +#endif /* EVENT_TRIGGER_H */ diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index 5882aff24d..c4dfdc3d6b 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -48,16 +48,16 @@ typedef struct ExplainState List *rtable; /* range table */ List *rtable_names; /* alias names for RTEs */ List *deparse_cxt; /* context list for deparsing expressions */ - Bitmapset *printed_subplans; /* ids of SubPlans we've printed */ + Bitmapset *printed_subplans; /* ids of SubPlans we've printed */ } ExplainState; /* Hook for plugins to get control in ExplainOneQuery() */ typedef void (*ExplainOneQuery_hook_type) (Query *query, - int cursorOptions, - IntoClause *into, - ExplainState *es, - const char *queryString, - ParamListInfo params); + int cursorOptions, + IntoClause *into, + ExplainState *es, + const char *queryString, + ParamListInfo params); extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook; /* Hook for plugins to get control in explain_get_index_name() */ @@ -66,7 +66,7 @@ extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook; extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt, const char *queryString, - ParamListInfo params, QueryEnvironment *queryEnv, DestReceiver *dest); + ParamListInfo params, QueryEnvironment *queryEnv, DestReceiver *dest); extern ExplainState *NewExplainState(void); @@ -105,4 +105,4 @@ extern void ExplainPropertyFloat(const char *qlabel, double value, int ndigits, extern void ExplainPropertyBool(const char *qlabel, bool value, ExplainState *es); -#endif /* EXPLAIN_H */ +#endif /* EXPLAIN_H */ diff --git a/src/include/commands/extension.h b/src/include/commands/extension.h index 7f027d9dc7..73bba3c784 100644 --- a/src/include/commands/extension.h +++ b/src/include/commands/extension.h @@ -53,4 +53,4 @@ extern ObjectAddress AlterExtensionNamespace(const char *extensionName, const ch extern void AlterExtensionOwner_oid(Oid extensionOid, Oid newOwnerId); -#endif /* EXTENSION_H */ +#endif /* EXTENSION_H */ diff --git a/src/include/commands/lockcmds.h b/src/include/commands/lockcmds.h index 45ed96d4d1..cdb5c62a52 100644 --- a/src/include/commands/lockcmds.h +++ b/src/include/commands/lockcmds.h @@ -21,4 +21,4 @@ */ extern void LockTableCommand(LockStmt *lockstmt); -#endif /* LOCKCMDS_H */ +#endif /* LOCKCMDS_H */ diff --git a/src/include/commands/matview.h b/src/include/commands/matview.h index 129fb92f59..3feb137ef4 100644 --- a/src/include/commands/matview.h +++ b/src/include/commands/matview.h @@ -30,4 +30,4 @@ extern DestReceiver *CreateTransientRelDestReceiver(Oid oid); extern bool MatViewIncrementalMaintenanceIsEnabled(void); -#endif /* MATVIEW_H */ +#endif /* MATVIEW_H */ diff --git a/src/include/commands/policy.h b/src/include/commands/policy.h index cff93a6cb0..d6a920ccef 100644 --- a/src/include/commands/policy.h +++ b/src/include/commands/policy.h @@ -35,4 +35,4 @@ extern ObjectAddress rename_policy(RenameStmt *stmt); extern bool relation_has_policies(Relation rel); -#endif /* POLICY_H */ +#endif /* POLICY_H */ diff --git a/src/include/commands/portalcmds.h b/src/include/commands/portalcmds.h index 8f0e6c48f4..488ce60cd6 100644 --- a/src/include/commands/portalcmds.h +++ b/src/include/commands/portalcmds.h @@ -30,4 +30,4 @@ extern void PortalCleanup(Portal portal); extern void PersistHoldablePortal(Portal portal); -#endif /* PORTALCMDS_H */ +#endif /* PORTALCMDS_H */ diff --git a/src/include/commands/prepare.h b/src/include/commands/prepare.h index 147f22b870..0d84d5aeba 100644 --- a/src/include/commands/prepare.h +++ b/src/include/commands/prepare.h @@ -28,7 +28,7 @@ typedef struct { /* dynahash.c requires key to be first field */ char stmt_name[NAMEDATALEN]; - CachedPlanSource *plansource; /* the actual cached plan */ + CachedPlanSource *plansource; /* the actual cached plan */ bool from_sql; /* prepared via SQL, not FE/BE protocol? */ #ifdef XCP bool use_resowner; /* does it use resowner for tracking? */ @@ -79,4 +79,4 @@ extern int SetRemoteStatementName(Plan *plan, const char *stmt_name, int num_par Oid *param_types, int n); #endif -#endif /* PREPARE_H */ +#endif /* PREPARE_H */ diff --git a/src/include/commands/proclang.h b/src/include/commands/proclang.h index f056978805..9a4bc75d12 100644 --- a/src/include/commands/proclang.h +++ b/src/include/commands/proclang.h @@ -20,4 +20,4 @@ extern void DropProceduralLanguageById(Oid langOid); extern bool PLTemplateExists(const char *languageName); extern Oid get_language_oid(const char *langname, bool missing_ok); -#endif /* PROCLANG_H */ +#endif /* PROCLANG_H */ diff --git a/src/include/commands/publicationcmds.h b/src/include/commands/publicationcmds.h index 7f12ff0a1b..a2e0f4a21e 100644 --- a/src/include/commands/publicationcmds.h +++ b/src/include/commands/publicationcmds.h @@ -26,4 +26,4 @@ extern void RemovePublicationRelById(Oid proid); extern ObjectAddress AlterPublicationOwner(const char *name, Oid newOwnerId); extern void AlterPublicationOwner_oid(Oid pubid, Oid newOwnerId); -#endif /* PUBLICATIONCMDS_H */ +#endif /* PUBLICATIONCMDS_H */ diff --git a/src/include/commands/schemacmds.h b/src/include/commands/schemacmds.h index 7079bfbf5a..25771bfe29 100644 --- a/src/include/commands/schemacmds.h +++ b/src/include/commands/schemacmds.h @@ -29,4 +29,4 @@ extern ObjectAddress RenameSchema(const char *oldname, const char *newname); extern ObjectAddress AlterSchemaOwner(const char *name, Oid newOwnerId); extern void AlterSchemaOwner_oid(Oid schemaOid, Oid newOwnerId); -#endif /* SCHEMACMDS_H */ +#endif /* SCHEMACMDS_H */ diff --git a/src/include/commands/seclabel.h b/src/include/commands/seclabel.h index d317f39485..a97c3293b2 100644 --- a/src/include/commands/seclabel.h +++ b/src/include/commands/seclabel.h @@ -27,8 +27,8 @@ extern void DeleteSharedSecurityLabel(Oid objectId, Oid classId); extern ObjectAddress ExecSecLabelStmt(SecLabelStmt *stmt); typedef void (*check_object_relabel_type) (const ObjectAddress *object, - const char *seclabel); + const char *seclabel); extern void register_label_provider(const char *provider, check_object_relabel_type hook); -#endif /* SECLABEL_H */ +#endif /* SECLABEL_H */ diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h index 0e9533cc2d..7d9cfe80e7 100644 --- a/src/include/commands/sequence.h +++ b/src/include/commands/sequence.h @@ -93,4 +93,4 @@ extern bool IsTempSequence(Oid relid); extern char *GetGlobalSeqName(Relation rel, const char *new_seqname, const char *new_schemaname); #endif -#endif /* SEQUENCE_H */ +#endif /* SEQUENCE_H */ diff --git a/src/include/commands/subscriptioncmds.h b/src/include/commands/subscriptioncmds.h index 1e4428e617..3d92a682a1 100644 --- a/src/include/commands/subscriptioncmds.h +++ b/src/include/commands/subscriptioncmds.h @@ -26,4 +26,4 @@ extern void DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel); extern ObjectAddress AlterSubscriptionOwner(const char *name, Oid newOwnerId); extern void AlterSubscriptionOwner_oid(Oid subid, Oid newOwnerId); -#endif /* SUBSCRIPTIONCMDS_H */ +#endif /* SUBSCRIPTIONCMDS_H */ diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index a27fdfbfce..bba254a011 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -96,4 +96,4 @@ extern void RangeVarCallbackOwnsTable(const RangeVar *relation, extern void RangeVarCallbackOwnsRelation(const RangeVar *relation, Oid relId, Oid oldRelId, void *noCatalogs); -#endif /* TABLECMDS_H */ +#endif /* TABLECMDS_H */ diff --git a/src/include/commands/tablespace.h b/src/include/commands/tablespace.h index 3ea13bdf14..ba8de32c7b 100644 --- a/src/include/commands/tablespace.h +++ b/src/include/commands/tablespace.h @@ -63,4 +63,4 @@ extern void tblspc_redo(XLogReaderState *rptr); extern void tblspc_desc(StringInfo buf, XLogReaderState *rptr); extern const char *tblspc_identify(uint8 info); -#endif /* TABLESPACE_H */ +#endif /* TABLESPACE_H */ diff --git a/src/include/commands/trigger.h b/src/include/commands/trigger.h index de9462d402..5061bee782 100644 --- a/src/include/commands/trigger.h +++ b/src/include/commands/trigger.h @@ -219,4 +219,4 @@ extern bool RI_Initial_Check(Trigger *trigger, extern int RI_FKey_trigger_type(Oid tgfoid); -#endif /* TRIGGER_H */ +#endif /* TRIGGER_H */ diff --git a/src/include/commands/typecmds.h b/src/include/commands/typecmds.h index c18f93adb2..34f6fe328f 100644 --- a/src/include/commands/typecmds.h +++ b/src/include/commands/typecmds.h @@ -54,4 +54,4 @@ extern Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid, bool errorOnTableType, ObjectAddresses *objsMoved); -#endif /* TYPECMDS_H */ +#endif /* TYPECMDS_H */ diff --git a/src/include/commands/user.h b/src/include/commands/user.h index 08037e0f81..028e0dde56 100644 --- a/src/include/commands/user.h +++ b/src/include/commands/user.h @@ -34,4 +34,4 @@ extern void DropOwnedObjects(DropOwnedStmt *stmt); extern void ReassignOwnedObjects(ReassignOwnedStmt *stmt); extern List *roleSpecsToIds(List *memberNames); -#endif /* USER_H */ +#endif /* USER_H */ diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index fd2dc860dd..307ec96cc6 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -60,12 +60,12 @@ typedef struct VacAttrStats *VacAttrStatsP; typedef Datum (*AnalyzeAttrFetchFunc) (VacAttrStatsP stats, int rownum, - bool *isNull); + bool *isNull); typedef void (*AnalyzeAttrComputeStatsFunc) (VacAttrStatsP stats, - AnalyzeAttrFetchFunc fetchfunc, - int samplerows, - double totalrows); + AnalyzeAttrFetchFunc fetchfunc, + int samplerows, + double totalrows); typedef struct VacAttrStats { @@ -137,20 +137,19 @@ typedef struct VacAttrStats typedef struct VacuumParams { int freeze_min_age; /* min freeze age, -1 to use default */ - int freeze_table_age; /* age at which to scan whole table */ - int multixact_freeze_min_age; /* min multixact freeze age, - * -1 to use default */ - int multixact_freeze_table_age; /* multixact age at which to - * scan whole table */ + int freeze_table_age; /* age at which to scan whole table */ + int multixact_freeze_min_age; /* min multixact freeze age, -1 to + * use default */ + int multixact_freeze_table_age; /* multixact age at which to scan + * whole table */ bool is_wraparound; /* force a for-wraparound vacuum */ - int log_min_duration; /* minimum execution threshold in ms - * at which verbose logs are - * activated, -1 to use default */ + int log_min_duration; /* minimum execution threshold in ms at + * which verbose logs are activated, -1 + * to use default */ } VacuumParams; /* GUC parameters */ -extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for - * PostGIS */ +extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for PostGIS */ extern int vacuum_freeze_min_age; extern int vacuum_freeze_table_age; extern int vacuum_multixact_freeze_min_age; @@ -208,4 +207,4 @@ extern double anl_random_fract(void); extern double anl_init_selection_state(int n); extern double anl_get_next_S(double t, int n, double *stateptr); -#endif /* VACUUM_H */ +#endif /* VACUUM_H */ diff --git a/src/include/commands/variable.h b/src/include/commands/variable.h index e0fb3332df..2e0bd3b3b2 100644 --- a/src/include/commands/variable.h +++ b/src/include/commands/variable.h @@ -42,4 +42,4 @@ extern bool check_role(char **newval, void **extra, GucSource source); extern void assign_role(const char *newval, void *extra); extern const char *show_role(void); -#endif /* VARIABLE_H */ +#endif /* VARIABLE_H */ diff --git a/src/include/commands/view.h b/src/include/commands/view.h index 39763913c8..cf08ce2ac7 100644 --- a/src/include/commands/view.h +++ b/src/include/commands/view.h @@ -24,4 +24,4 @@ extern ObjectAddress DefineView(ViewStmt *stmt, const char *queryString, extern void StoreViewQuery(Oid viewOid, Query *viewParse, bool replace); -#endif /* VIEW_H */ +#endif /* VIEW_H */ diff --git a/src/include/common/base64.h b/src/include/common/base64.h index 09b69b1656..7fe19bb432 100644 --- a/src/include/common/base64.h +++ b/src/include/common/base64.h @@ -16,4 +16,4 @@ extern int pg_b64_decode(const char *src, int len, char *dst); extern int pg_b64_enc_len(int srclen); extern int pg_b64_dec_len(int srclen); -#endif /* BASE64_H */ +#endif /* BASE64_H */ diff --git a/src/include/common/config_info.h b/src/include/common/config_info.h index 656e26fdb0..f775327861 100644 --- a/src/include/common/config_info.h +++ b/src/include/common/config_info.h @@ -18,4 +18,4 @@ typedef struct ConfigData extern ConfigData *get_configdata(const char *my_exec_path, size_t *configdata_len); -#endif /* COMMON_CONFIG_INFO_H */ +#endif /* COMMON_CONFIG_INFO_H */ diff --git a/src/include/common/controldata_utils.h b/src/include/common/controldata_utils.h index 82ea426afe..e97abe6a51 100644 --- a/src/include/common/controldata_utils.h +++ b/src/include/common/controldata_utils.h @@ -14,4 +14,4 @@ extern ControlFileData *get_controlfile(const char *DataDir, const char *progname, bool *crc_ok_p); -#endif /* COMMON_CONTROLDATA_UTILS_H */ +#endif /* COMMON_CONTROLDATA_UTILS_H */ diff --git a/src/include/common/fe_memutils.h b/src/include/common/fe_memutils.h index cb381bd9f5..6708670b96 100644 --- a/src/include/common/fe_memutils.h +++ b/src/include/common/fe_memutils.h @@ -41,4 +41,4 @@ extern void pfree(void *pointer); extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2); extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0); -#endif /* FE_MEMUTILS_H */ +#endif /* FE_MEMUTILS_H */ diff --git a/src/include/common/file_utils.h b/src/include/common/file_utils.h index 95c001905d..52af7f0baa 100644 --- a/src/include/common/file_utils.h +++ b/src/include/common/file_utils.h @@ -24,4 +24,4 @@ extern int durable_rename(const char *oldfile, const char *newfile, const char *progname); extern int fsync_parent_path(const char *fname, const char *progname); -#endif /* FILE_UTILS_H */ +#endif /* FILE_UTILS_H */ diff --git a/src/include/common/int128.h b/src/include/common/int128.h index 4c46e26f40..af2c93da46 100644 --- a/src/include/common/int128.h +++ b/src/include/common/int128.h @@ -61,7 +61,7 @@ int128_add_int64(INT128 *i128, int64 v) static inline void int128_add_int64_mul_int64(INT128 *i128, int64 x, int64 y) { - *i128 += (int128) x *(int128) y; + *i128 += (int128) x * (int128) y; } /* @@ -271,6 +271,6 @@ int128_to_int64(INT128 val) return (int64) val.lo; } -#endif /* USE_NATIVE_INT128 */ +#endif /* USE_NATIVE_INT128 */ -#endif /* INT128_H */ +#endif /* INT128_H */ diff --git a/src/include/common/ip.h b/src/include/common/ip.h index 815e6ccad3..f530139876 100644 --- a/src/include/common/ip.h +++ b/src/include/common/ip.h @@ -25,13 +25,13 @@ #endif extern int pg_getaddrinfo_all(const char *hostname, const char *servname, - const struct addrinfo * hintp, - struct addrinfo ** result); -extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo * ai); + const struct addrinfo *hintp, + struct addrinfo **result); +extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo *ai); -extern int pg_getnameinfo_all(const struct sockaddr_storage * addr, int salen, +extern int pg_getnameinfo_all(const struct sockaddr_storage *addr, int salen, char *node, int nodelen, char *service, int servicelen, int flags); -#endif /* IP_H */ +#endif /* IP_H */ diff --git a/src/include/common/keywords.h b/src/include/common/keywords.h index 34e066be6b..60522715a8 100644 --- a/src/include/common/keywords.h +++ b/src/include/common/keywords.h @@ -41,4 +41,4 @@ extern const ScanKeyword *ScanKeywordLookup(const char *text, const ScanKeyword *keywords, int num_keywords); -#endif /* KEYWORDS_H */ +#endif /* KEYWORDS_H */ diff --git a/src/include/common/pg_lzcompress.h b/src/include/common/pg_lzcompress.h index dbd51d58ef..d4b2e8a53c 100644 --- a/src/include/common/pg_lzcompress.h +++ b/src/include/common/pg_lzcompress.h @@ -88,4 +88,4 @@ extern int32 pglz_compress(const char *source, int32 slen, char *dest, extern int32 pglz_decompress(const char *source, int32 slen, char *dest, int32 rawsize); -#endif /* _PG_LZCOMPRESS_H_ */ +#endif /* _PG_LZCOMPRESS_H_ */ diff --git a/src/include/common/relpath.h b/src/include/common/relpath.h index 8468c0c6f6..fb9ca3e785 100644 --- a/src/include/common/relpath.h +++ b/src/include/common/relpath.h @@ -92,4 +92,4 @@ extern char *GetRelationPath_client(Oid dbNode, Oid spcNode, Oid relNode, #define relpath(rnode, forknum) \ relpathbackend((rnode).node, (rnode).backend, forknum) #endif -#endif /* RELPATH_H */ +#endif /* RELPATH_H */ diff --git a/src/include/common/restricted_token.h b/src/include/common/restricted_token.h index 7441a55119..51be5a760c 100644 --- a/src/include/common/restricted_token.h +++ b/src/include/common/restricted_token.h @@ -21,4 +21,4 @@ void get_restricted_token(const char *progname); HANDLE CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, const char *progname); #endif -#endif /* COMMON_RESTRICTED_TOKEN_H */ +#endif /* COMMON_RESTRICTED_TOKEN_H */ diff --git a/src/include/common/saslprep.h b/src/include/common/saslprep.h index ec5c8ce361..c7b620cf19 100644 --- a/src/include/common/saslprep.h +++ b/src/include/common/saslprep.h @@ -27,4 +27,4 @@ typedef enum extern pg_saslprep_rc pg_saslprep(const char *input, char **output); -#endif /* SASLPREP_H */ +#endif /* SASLPREP_H */ diff --git a/src/include/common/scram-common.h b/src/include/common/scram-common.h index 2ee51fbaec..ebb733df4b 100644 --- a/src/include/common/scram-common.h +++ b/src/include/common/scram-common.h @@ -56,4 +56,4 @@ extern void scram_ServerKey(const uint8 *salted_password, uint8 *result); extern char *scram_build_verifier(const char *salt, int saltlen, int iterations, const char *password); -#endif /* SCRAM_COMMON_H */ +#endif /* SCRAM_COMMON_H */ diff --git a/src/include/common/sha2.h b/src/include/common/sha2.h index 09107cfc3b..6358ca3c56 100644 --- a/src/include/common/sha2.h +++ b/src/include/common/sha2.h @@ -89,7 +89,7 @@ typedef struct pg_sha512_ctx } pg_sha512_ctx; typedef struct pg_sha256_ctx pg_sha224_ctx; typedef struct pg_sha512_ctx pg_sha384_ctx; -#endif /* USE_SSL */ +#endif /* USE_SSL */ /* Interface routines for SHA224/256/384/512 */ extern void pg_sha224_init(pg_sha224_ctx *ctx); @@ -112,4 +112,4 @@ extern void pg_sha512_update(pg_sha512_ctx *ctx, const uint8 *input0, size_t len); extern void pg_sha512_final(pg_sha512_ctx *ctx, uint8 *dest); -#endif /* _PG_SHA2_H_ */ +#endif /* _PG_SHA2_H_ */ diff --git a/src/include/common/string.h b/src/include/common/string.h index ec9ee9a740..5f3ea71d61 100644 --- a/src/include/common/string.h +++ b/src/include/common/string.h @@ -12,4 +12,4 @@ extern bool pg_str_endswith(const char *str, const char *end); -#endif /* COMMON_STRING_H */ +#endif /* COMMON_STRING_H */ diff --git a/src/include/common/unicode_norm.h b/src/include/common/unicode_norm.h index 488f964d2c..8741209751 100644 --- a/src/include/common/unicode_norm.h +++ b/src/include/common/unicode_norm.h @@ -18,4 +18,4 @@ extern pg_wchar *unicode_normalize_kc(const pg_wchar *input); -#endif /* UNICODE_NORM_H */ +#endif /* UNICODE_NORM_H */ diff --git a/src/include/common/unicode_norm_table.h b/src/include/common/unicode_norm_table.h index 3bcf05e5ee..da08e487e3 100644 --- a/src/include/common/unicode_norm_table.h +++ b/src/include/common/unicode_norm_table.h @@ -26,7 +26,8 @@ typedef struct } pg_unicode_decomposition; #define DECOMP_NO_COMPOSE 0x80 /* don't use for re-composition */ -#define DECOMP_INLINE 0x40 /* decomposition is stored inline in dec_index */ +#define DECOMP_INLINE 0x40 /* decomposition is stored inline in + * dec_index */ #define DECOMPOSITION_SIZE(x) ((x)->dec_size_flags & 0x3F) #define DECOMPOSITION_NO_COMPOSE(x) (((x)->dec_size_flags & DECOMP_NO_COMPOSE) != 0) @@ -36,14 +37,14 @@ typedef struct static const pg_unicode_decomposition UnicodeDecompMain[6532] = { {0x00A0, 0, 1 | DECOMP_INLINE, 0x0020}, - {0x00A8, 0, 2 | DECOMP_NO_COMPOSE, 0}, /* compatibility mapping */ + {0x00A8, 0, 2 | DECOMP_NO_COMPOSE, 0}, /* compatibility mapping */ {0x00AA, 0, 1 | DECOMP_INLINE, 0x0061}, - {0x00AF, 0, 2 | DECOMP_NO_COMPOSE, 2}, /* compatibility mapping */ + {0x00AF, 0, 2 | DECOMP_NO_COMPOSE, 2}, /* compatibility mapping */ {0x00B2, 0, 1 | DECOMP_INLINE, 0x0032}, {0x00B3, 0, 1 | DECOMP_INLINE, 0x0033}, - {0x00B4, 0, 2 | DECOMP_NO_COMPOSE, 4}, /* compatibility mapping */ + {0x00B4, 0, 2 | DECOMP_NO_COMPOSE, 4}, /* compatibility mapping */ {0x00B5, 0, 1 | DECOMP_INLINE, 0x03BC}, - {0x00B8, 0, 2 | DECOMP_NO_COMPOSE, 6}, /* compatibility mapping */ + {0x00B8, 0, 2 | DECOMP_NO_COMPOSE, 6}, /* compatibility mapping */ {0x00B9, 0, 1 | DECOMP_INLINE, 0x0031}, {0x00BA, 0, 1 | DECOMP_INLINE, 0x006F}, {0x00BC, 0, 3, 8}, diff --git a/src/include/common/username.h b/src/include/common/username.h index 114304f9e1..735572d382 100644 --- a/src/include/common/username.h +++ b/src/include/common/username.h @@ -12,4 +12,4 @@ extern const char *get_user_name(char **errstr); extern const char *get_user_name_or_exit(const char *progname); -#endif /* USERNAME_H */ +#endif /* USERNAME_H */ diff --git a/src/include/datatype/timestamp.h b/src/include/datatype/timestamp.h index 16e1b4c44d..6f48d1c71b 100644 --- a/src/include/datatype/timestamp.h +++ b/src/include/datatype/timestamp.h @@ -178,7 +178,7 @@ typedef struct /* First allowed date, and first disallowed date, in Julian-date form */ #define DATETIME_MIN_JULIAN (0) #define DATE_END_JULIAN (2147483494) /* == date2j(JULIAN_MAXYEAR, 1, 1) */ -#define TIMESTAMP_END_JULIAN (109203528) /* == date2j(294277, 1, 1) */ +#define TIMESTAMP_END_JULIAN (109203528) /* == date2j(294277, 1, 1) */ /* Timestamp limits */ #define MIN_TIMESTAMP INT64CONST(-211813488000000000) @@ -194,4 +194,4 @@ typedef struct /* Range-check a timestamp */ #define IS_VALID_TIMESTAMP(t) (MIN_TIMESTAMP <= (t) && (t) < END_TIMESTAMP) -#endif /* DATATYPE_TIMESTAMP_H */ +#endif /* DATATYPE_TIMESTAMP_H */ diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h index 86fdb33cd3..7a65339f01 100644 --- a/src/include/executor/execExpr.h +++ b/src/include/executor/execExpr.h @@ -261,7 +261,7 @@ typedef struct ExprEvalStep bool first; /* first time through, need to initialize? */ bool slow; /* need runtime check for nulls? */ TupleDesc tupdesc; /* descriptor for resulting tuples */ - JunkFilter *junkFilter; /* JunkFilter to remove resjunk cols */ + JunkFilter *junkFilter; /* JunkFilter to remove resjunk cols */ } wholerow; /* for EEOP_ASSIGN_*_VAR */ @@ -292,7 +292,7 @@ typedef struct ExprEvalStep struct { FmgrInfo *finfo; /* function's lookup data */ - FunctionCallInfo fcinfo_data; /* arguments etc */ + FunctionCallInfo fcinfo_data; /* arguments etc */ /* faster to access without additional indirection: */ PGFunction fn_addr; /* actual call address */ int nargs; /* number of arguments */ @@ -302,19 +302,19 @@ typedef struct ExprEvalStep struct { bool *anynull; /* track if any input was NULL */ - int jumpdone; /* jump here if result determined */ + int jumpdone; /* jump here if result determined */ } boolexpr; /* for EEOP_QUAL */ struct { - int jumpdone; /* jump here on false or null */ + int jumpdone; /* jump here on false or null */ } qualexpr; /* for EEOP_JUMP[_CONDITION] */ struct { - int jumpdone; /* target instruction's index */ + int jumpdone; /* target instruction's index */ } jump; /* for EEOP_NULLTEST_ROWIS[NOT]NULL */ @@ -328,7 +328,7 @@ typedef struct ExprEvalStep struct { int paramid; /* numeric ID for parameter */ - Oid paramtype; /* OID of parameter's datatype */ + Oid paramtype; /* OID of parameter's datatype */ } param; /* for EEOP_CASE_TESTVAL/DOMAIN_TESTVAL */ @@ -372,14 +372,14 @@ typedef struct ExprEvalStep /* for EEOP_ARRAYEXPR */ struct { - Datum *elemvalues; /* element values get stored here */ + Datum *elemvalues; /* element values get stored here */ bool *elemnulls; int nelems; /* length of the above arrays */ - Oid elemtype; /* array element type */ - int16 elemlength; /* typlen of the array element type */ - bool elembyval; /* is the element type pass-by-value? */ - char elemalign; /* typalign of the element type */ - bool multidims; /* is array expression multi-D? */ + Oid elemtype; /* array element type */ + int16 elemlength; /* typlen of the array element type */ + bool elembyval; /* is the element type pass-by-value? */ + char elemalign; /* typalign of the element type */ + bool multidims; /* is array expression multi-D? */ } arrayexpr; /* for EEOP_ARRAYCOERCE */ @@ -387,9 +387,9 @@ typedef struct ExprEvalStep { ArrayCoerceExpr *coerceexpr; Oid resultelemtype; /* element type of result array */ - FmgrInfo *elemfunc; /* lookup info for element coercion - * function */ - struct ArrayMapState *amstate; /* workspace for array_map */ + FmgrInfo *elemfunc; /* lookup info for element coercion + * function */ + struct ArrayMapState *amstate; /* workspace for array_map */ } arraycoerce; /* for EEOP_ROW */ @@ -437,8 +437,8 @@ typedef struct ExprEvalStep /* for EEOP_FIELDSELECT */ struct { - AttrNumber fieldnum; /* field number to extract */ - Oid resulttype; /* field's type */ + AttrNumber fieldnum; /* field number to extract */ + Oid resulttype; /* field's type */ /* cached tupdesc pointer - filled at runtime */ TupleDesc argdesc; } fieldselect; @@ -466,7 +466,7 @@ typedef struct ExprEvalStep struct ArrayRefState *state; int off; /* 0-based index of this subscript */ bool isupper; /* is it upper or lower subscript? */ - int jumpdone; /* jump here on null */ + int jumpdone; /* jump here on null */ } arrayref_subscript; /* for EEOP_ARRAYREF_OLD / ASSIGN / FETCH */ @@ -491,7 +491,7 @@ typedef struct ExprEvalStep /* for EEOP_CONVERT_ROWTYPE */ struct { - ConvertRowtypeExpr *convert; /* original expression */ + ConvertRowtypeExpr *convert; /* original expression */ /* these three fields are filled at runtime: */ TupleDesc indesc; /* tupdesc for input type */ TupleDesc outdesc; /* tupdesc for output type */ @@ -509,7 +509,7 @@ typedef struct ExprEvalStep bool typbyval; char typalign; FmgrInfo *finfo; /* function's lookup data */ - FunctionCallInfo fcinfo_data; /* arguments etc */ + FunctionCallInfo fcinfo_data; /* arguments etc */ /* faster to access without additional indirection: */ PGFunction fn_addr; /* actual call address */ } scalararrayop; @@ -647,4 +647,4 @@ extern void ExecEvalAlternativeSubPlan(ExprState *state, ExprEvalStep *op, extern void ExecEvalWholeRowVar(ExprState *state, ExprEvalStep *op, ExprContext *econtext); -#endif /* EXEC_EXPR_H */ +#endif /* EXEC_EXPR_H */ diff --git a/src/include/executor/execParallel.h b/src/include/executor/execParallel.h index 0b7ca59dca..bd0a87fa04 100644 --- a/src/include/executor/execParallel.h +++ b/src/include/executor/execParallel.h @@ -40,4 +40,4 @@ extern void ExecParallelReinitialize(ParallelExecutorInfo *pei); extern void ParallelQueryMain(dsm_segment *seg, shm_toc *toc); -#endif /* EXECPARALLEL_H */ +#endif /* EXECPARALLEL_H */ diff --git a/src/include/executor/execdebug.h b/src/include/executor/execdebug.h index 8b61520e18..cd04b60176 100644 --- a/src/include/executor/execdebug.h +++ b/src/include/executor/execdebug.h @@ -76,7 +76,7 @@ #define NL_printf(s) #define NL1_printf(s, a) #define ENL1_printf(message) -#endif /* EXEC_NESTLOOPDEBUG */ +#endif /* EXEC_NESTLOOPDEBUG */ /* ---------------- * sort node debugging defines @@ -90,7 +90,7 @@ #define SO_nodeDisplay(l) #define SO_printf(s) #define SO1_printf(s, p) -#endif /* EXEC_SORTDEBUG */ +#endif /* EXEC_SORTDEBUG */ /* ---------------- * merge join debugging defines @@ -123,6 +123,6 @@ #define MJ_DEBUG_COMPARE(res) #define MJ_DEBUG_QUAL(clause, res) #define MJ_DEBUG_PROC_NODE(slot) -#endif /* EXEC_MERGEJOINDEBUG */ +#endif /* EXEC_MERGEJOINDEBUG */ -#endif /* EXECDEBUG_H */ +#endif /* EXECDEBUG_H */ diff --git a/src/include/executor/execdesc.h b/src/include/executor/execdesc.h index 62a2f2e477..a4b0609e2c 100644 --- a/src/include/executor/execdesc.h +++ b/src/include/executor/execdesc.h @@ -44,7 +44,7 @@ typedef struct QueryDesc DestReceiver *dest; /* the destination for tuple output */ ParamListInfo params; /* param values being passed in */ QueryEnvironment *queryEnv; /* query environment passed in */ - int instrument_options; /* OR of InstrumentOption flags */ + int instrument_options; /* OR of InstrumentOption flags */ /* These fields are set by ExecutorStart */ TupleDesc tupDesc; /* descriptor for result tuples */ @@ -59,7 +59,7 @@ typedef struct QueryDesc * get local data from squeue */ #endif /* This field is set by ExecutorRun */ - bool already_executed; /* true if previously executed */ + bool already_executed; /* true if previously executed */ /* This is always set NULL by the core system, but plugins can change it */ struct Instrumentation *totaltime; /* total time spent in ExecutorRun */ @@ -77,4 +77,4 @@ extern QueryDesc *CreateQueryDesc(PlannedStmt *plannedstmt, extern void FreeQueryDesc(QueryDesc *qdesc); -#endif /* EXECDESC_H */ +#endif /* EXECDESC_H */ diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index fdf7c15b70..83bc1bc2a4 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -76,9 +76,9 @@ extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook; /* Hook for plugins to get control in ExecutorRun() */ typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc, - ScanDirection direction, - uint64 count, - bool execute_once); + ScanDirection direction, + uint64 count, + bool execute_once); extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook; /* Hook for plugins to get control in ExecutorFinish() */ @@ -179,7 +179,7 @@ extern void standard_ExecutorStart(QueryDesc *queryDesc, int eflags); extern void ExecutorRun(QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once); extern void standard_ExecutorRun(QueryDesc *queryDesc, - ScanDirection direction, uint64 count, bool execute_once); + ScanDirection direction, uint64 count, bool execute_once); extern void ExecutorFinish(QueryDesc *queryDesc); extern void standard_ExecutorFinish(QueryDesc *queryDesc); extern void ExecutorEnd(QueryDesc *queryDesc); @@ -550,4 +550,4 @@ extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd); extern void CheckSubscriptionRelkind(char relkind, const char *nspname, const char *relname); -#endif /* EXECUTOR_H */ +#endif /* EXECUTOR_H */ diff --git a/src/include/executor/functions.h b/src/include/executor/functions.h index 7821a634f1..718d8947a3 100644 --- a/src/include/executor/functions.h +++ b/src/include/executor/functions.h @@ -36,4 +36,4 @@ extern bool check_sql_fn_retval(Oid func_id, Oid rettype, extern DestReceiver *CreateSQLFunctionDestReceiver(void); -#endif /* FUNCTIONS_H */ +#endif /* FUNCTIONS_H */ diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h index ac840533ee..82acadf85b 100644 --- a/src/include/executor/hashjoin.h +++ b/src/include/executor/hashjoin.h @@ -63,10 +63,10 @@ typedef struct HashJoinTupleData { - struct HashJoinTupleData *next; /* link to next tuple in same bucket */ + struct HashJoinTupleData *next; /* link to next tuple in same bucket */ uint32 hashvalue; /* tuple's hash code */ /* Tuple data, in MinimalTuple format, follows on a MAXALIGN boundary */ -} HashJoinTupleData; +} HashJoinTupleData; #define HJTUPLE_OVERHEAD MAXALIGN(sizeof(HashJoinTupleData)) #define HJTUPLE_MINTUPLE(hjtup) \ @@ -116,7 +116,7 @@ typedef struct HashMemoryChunkData * list) */ char data[FLEXIBLE_ARRAY_MEMBER]; /* buffer allocated at the end */ -} HashMemoryChunkData; +} HashMemoryChunkData; typedef struct HashMemoryChunkData *HashMemoryChunk; @@ -128,9 +128,8 @@ typedef struct HashJoinTableData int nbuckets; /* # buckets in the in-memory hash table */ int log2_nbuckets; /* its log2 (nbuckets must be a power of 2) */ - int nbuckets_original; /* # buckets when starting the first - * hash */ - int nbuckets_optimal; /* optimal # buckets (per batch) */ + int nbuckets_original; /* # buckets when starting the first hash */ + int nbuckets_optimal; /* optimal # buckets (per batch) */ int log2_nbuckets_optimal; /* log2(nbuckets_optimal) */ /* buckets[i] is head of list of tuples in i'th in-memory bucket */ @@ -179,13 +178,13 @@ typedef struct HashJoinTableData Size spaceAllowed; /* upper limit for space used */ Size spacePeak; /* peak space used */ Size spaceUsedSkew; /* skew hash table's current space usage */ - Size spaceAllowedSkew; /* upper limit for skew hashtable */ + Size spaceAllowedSkew; /* upper limit for skew hashtable */ MemoryContext hashCxt; /* context for whole-hash-join storage */ MemoryContext batchCxt; /* context for this-batch-only storage */ /* used for dense allocation of tuples (into linked chunks) */ HashMemoryChunk chunks; /* one list for the whole batch */ -} HashJoinTableData; +} HashJoinTableData; -#endif /* HASHJOIN_H */ +#endif /* HASHJOIN_H */ diff --git a/src/include/executor/instrument.h b/src/include/executor/instrument.h index c9e169c45c..31573145a9 100644 --- a/src/include/executor/instrument.h +++ b/src/include/executor/instrument.h @@ -19,15 +19,15 @@ typedef struct BufferUsage { long shared_blks_hit; /* # of shared buffer hits */ - long shared_blks_read; /* # of shared disk blocks read */ + long shared_blks_read; /* # of shared disk blocks read */ long shared_blks_dirtied; /* # of shared blocks dirtied */ long shared_blks_written; /* # of shared disk blocks written */ long local_blks_hit; /* # of local buffer hits */ long local_blks_read; /* # of local disk blocks read */ - long local_blks_dirtied; /* # of shared blocks dirtied */ - long local_blks_written; /* # of local disk blocks written */ + long local_blks_dirtied; /* # of shared blocks dirtied */ + long local_blks_written; /* # of local disk blocks written */ long temp_blks_read; /* # of temp blocks read */ - long temp_blks_written; /* # of temp blocks written */ + long temp_blks_written; /* # of temp blocks written */ instr_time blk_read_time; /* time spent reading */ instr_time blk_write_time; /* time spent writing */ } BufferUsage; @@ -81,4 +81,4 @@ extern void InstrStartParallelQuery(void); extern void InstrEndParallelQuery(BufferUsage *result); extern void InstrAccumParallelQuery(BufferUsage *result); -#endif /* INSTRUMENT_H */ +#endif /* INSTRUMENT_H */ diff --git a/src/include/executor/nodeAgg.h b/src/include/executor/nodeAgg.h index d2fee52e12..fa11ba93a6 100644 --- a/src/include/executor/nodeAgg.h +++ b/src/include/executor/nodeAgg.h @@ -25,4 +25,4 @@ extern Size hash_agg_entry_size(int numAggs); extern Datum aggregate_dummy(PG_FUNCTION_ARGS); -#endif /* NODEAGG_H */ +#endif /* NODEAGG_H */ diff --git a/src/include/executor/nodeAppend.h b/src/include/executor/nodeAppend.h index 6fb4662c88..ee0b6ad23d 100644 --- a/src/include/executor/nodeAppend.h +++ b/src/include/executor/nodeAppend.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecAppend(AppendState *node); extern void ExecEndAppend(AppendState *node); extern void ExecReScanAppend(AppendState *node); -#endif /* NODEAPPEND_H */ +#endif /* NODEAPPEND_H */ diff --git a/src/include/executor/nodeBitmapAnd.h b/src/include/executor/nodeBitmapAnd.h index 1cb3470bcb..5d848b61af 100644 --- a/src/include/executor/nodeBitmapAnd.h +++ b/src/include/executor/nodeBitmapAnd.h @@ -21,4 +21,4 @@ extern Node *MultiExecBitmapAnd(BitmapAndState *node); extern void ExecEndBitmapAnd(BitmapAndState *node); extern void ExecReScanBitmapAnd(BitmapAndState *node); -#endif /* NODEBITMAPAND_H */ +#endif /* NODEBITMAPAND_H */ diff --git a/src/include/executor/nodeBitmapHeapscan.h b/src/include/executor/nodeBitmapHeapscan.h index 465c58e6ee..f477d1c772 100644 --- a/src/include/executor/nodeBitmapHeapscan.h +++ b/src/include/executor/nodeBitmapHeapscan.h @@ -28,4 +28,4 @@ extern void ExecBitmapHeapInitializeDSM(BitmapHeapScanState *node, extern void ExecBitmapHeapInitializeWorker(BitmapHeapScanState *node, shm_toc *toc); -#endif /* NODEBITMAPHEAPSCAN_H */ +#endif /* NODEBITMAPHEAPSCAN_H */ diff --git a/src/include/executor/nodeBitmapIndexscan.h b/src/include/executor/nodeBitmapIndexscan.h index 1fb8da01cb..842193f4df 100644 --- a/src/include/executor/nodeBitmapIndexscan.h +++ b/src/include/executor/nodeBitmapIndexscan.h @@ -21,4 +21,4 @@ extern Node *MultiExecBitmapIndexScan(BitmapIndexScanState *node); extern void ExecEndBitmapIndexScan(BitmapIndexScanState *node); extern void ExecReScanBitmapIndexScan(BitmapIndexScanState *node); -#endif /* NODEBITMAPINDEXSCAN_H */ +#endif /* NODEBITMAPINDEXSCAN_H */ diff --git a/src/include/executor/nodeBitmapOr.h b/src/include/executor/nodeBitmapOr.h index a23bf77ff7..526904eb4d 100644 --- a/src/include/executor/nodeBitmapOr.h +++ b/src/include/executor/nodeBitmapOr.h @@ -21,4 +21,4 @@ extern Node *MultiExecBitmapOr(BitmapOrState *node); extern void ExecEndBitmapOr(BitmapOrState *node); extern void ExecReScanBitmapOr(BitmapOrState *node); -#endif /* NODEBITMAPOR_H */ +#endif /* NODEBITMAPOR_H */ diff --git a/src/include/executor/nodeCtescan.h b/src/include/executor/nodeCtescan.h index e8bcb88b35..397bdfdd1c 100644 --- a/src/include/executor/nodeCtescan.h +++ b/src/include/executor/nodeCtescan.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecCteScan(CteScanState *node); extern void ExecEndCteScan(CteScanState *node); extern void ExecReScanCteScan(CteScanState *node); -#endif /* NODECTESCAN_H */ +#endif /* NODECTESCAN_H */ diff --git a/src/include/executor/nodeCustom.h b/src/include/executor/nodeCustom.h index c2f2ca1eed..e81bcf7f21 100644 --- a/src/include/executor/nodeCustom.h +++ b/src/include/executor/nodeCustom.h @@ -39,4 +39,4 @@ extern void ExecCustomScanInitializeWorker(CustomScanState *node, shm_toc *toc); extern void ExecShutdownCustomScan(CustomScanState *node); -#endif /* NODECUSTOM_H */ +#endif /* NODECUSTOM_H */ diff --git a/src/include/executor/nodeForeignscan.h b/src/include/executor/nodeForeignscan.h index 1b167b8143..3ff4ecd8c9 100644 --- a/src/include/executor/nodeForeignscan.h +++ b/src/include/executor/nodeForeignscan.h @@ -30,4 +30,4 @@ extern void ExecForeignScanInitializeWorker(ForeignScanState *node, shm_toc *toc); extern void ExecShutdownForeignScan(ForeignScanState *node); -#endif /* NODEFOREIGNSCAN_H */ +#endif /* NODEFOREIGNSCAN_H */ diff --git a/src/include/executor/nodeFunctionscan.h b/src/include/executor/nodeFunctionscan.h index efff0deaee..5e830ebdea 100644 --- a/src/include/executor/nodeFunctionscan.h +++ b/src/include/executor/nodeFunctionscan.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecFunctionScan(FunctionScanState *node); extern void ExecEndFunctionScan(FunctionScanState *node); extern void ExecReScanFunctionScan(FunctionScanState *node); -#endif /* NODEFUNCTIONSCAN_H */ +#endif /* NODEFUNCTIONSCAN_H */ diff --git a/src/include/executor/nodeGather.h b/src/include/executor/nodeGather.h index e19bc9b20d..b0006934d4 100644 --- a/src/include/executor/nodeGather.h +++ b/src/include/executor/nodeGather.h @@ -22,4 +22,4 @@ extern void ExecEndGather(GatherState *node); extern void ExecShutdownGather(GatherState *node); extern void ExecReScanGather(GatherState *node); -#endif /* NODEGATHER_H */ +#endif /* NODEGATHER_H */ diff --git a/src/include/executor/nodeGatherMerge.h b/src/include/executor/nodeGatherMerge.h index f5ba353762..14b31a086c 100644 --- a/src/include/executor/nodeGatherMerge.h +++ b/src/include/executor/nodeGatherMerge.h @@ -24,4 +24,4 @@ extern void ExecEndGatherMerge(GatherMergeState *node); extern void ExecReScanGatherMerge(GatherMergeState *node); extern void ExecShutdownGatherMerge(GatherMergeState *node); -#endif /* NODEGATHERMERGE_H */ +#endif /* NODEGATHERMERGE_H */ diff --git a/src/include/executor/nodeGroup.h b/src/include/executor/nodeGroup.h index a9536a3c6f..7358b61707 100644 --- a/src/include/executor/nodeGroup.h +++ b/src/include/executor/nodeGroup.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecGroup(GroupState *node); extern void ExecEndGroup(GroupState *node); extern void ExecReScanGroup(GroupState *node); -#endif /* NODEGROUP_H */ +#endif /* NODEGROUP_H */ diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h index fe5c2642d7..8052f27d0b 100644 --- a/src/include/executor/nodeHash.h +++ b/src/include/executor/nodeHash.h @@ -50,4 +50,4 @@ extern void ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew, int *num_skew_mcvs); extern int ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue); -#endif /* NODEHASH_H */ +#endif /* NODEHASH_H */ diff --git a/src/include/executor/nodeHashjoin.h b/src/include/executor/nodeHashjoin.h index ddc32b1de3..541c81edc7 100644 --- a/src/include/executor/nodeHashjoin.h +++ b/src/include/executor/nodeHashjoin.h @@ -25,4 +25,4 @@ extern void ExecReScanHashJoin(HashJoinState *node); extern void ExecHashJoinSaveTuple(MinimalTuple tuple, uint32 hashvalue, BufFile **fileptr); -#endif /* NODEHASHJOIN_H */ +#endif /* NODEHASHJOIN_H */ diff --git a/src/include/executor/nodeIndexonlyscan.h b/src/include/executor/nodeIndexonlyscan.h index 5d3c6bbc0d..cf227daae0 100644 --- a/src/include/executor/nodeIndexonlyscan.h +++ b/src/include/executor/nodeIndexonlyscan.h @@ -32,4 +32,4 @@ extern void ExecIndexOnlyScanInitializeDSM(IndexOnlyScanState *node, extern void ExecIndexOnlyScanInitializeWorker(IndexOnlyScanState *node, shm_toc *toc); -#endif /* NODEINDEXONLYSCAN_H */ +#endif /* NODEINDEXONLYSCAN_H */ diff --git a/src/include/executor/nodeIndexscan.h b/src/include/executor/nodeIndexscan.h index ea3f3a5cc4..0118234eca 100644 --- a/src/include/executor/nodeIndexscan.h +++ b/src/include/executor/nodeIndexscan.h @@ -37,9 +37,9 @@ extern void ExecIndexBuildScanKeys(PlanState *planstate, Relation index, IndexRuntimeKeyInfo **runtimeKeys, int *numRuntimeKeys, IndexArrayKeyInfo **arrayKeys, int *numArrayKeys); extern void ExecIndexEvalRuntimeKeys(ExprContext *econtext, - IndexRuntimeKeyInfo *runtimeKeys, int numRuntimeKeys); + IndexRuntimeKeyInfo *runtimeKeys, int numRuntimeKeys); extern bool ExecIndexEvalArrayKeys(ExprContext *econtext, IndexArrayKeyInfo *arrayKeys, int numArrayKeys); extern bool ExecIndexAdvanceArrayKeys(IndexArrayKeyInfo *arrayKeys, int numArrayKeys); -#endif /* NODEINDEXSCAN_H */ +#endif /* NODEINDEXSCAN_H */ diff --git a/src/include/executor/nodeLimit.h b/src/include/executor/nodeLimit.h index 6e4084b46d..7bb20d9978 100644 --- a/src/include/executor/nodeLimit.h +++ b/src/include/executor/nodeLimit.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecLimit(LimitState *node); extern void ExecEndLimit(LimitState *node); extern void ExecReScanLimit(LimitState *node); -#endif /* NODELIMIT_H */ +#endif /* NODELIMIT_H */ diff --git a/src/include/executor/nodeLockRows.h b/src/include/executor/nodeLockRows.h index c23954131b..6b90756e4c 100644 --- a/src/include/executor/nodeLockRows.h +++ b/src/include/executor/nodeLockRows.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecLockRows(LockRowsState *node); extern void ExecEndLockRows(LockRowsState *node); extern void ExecReScanLockRows(LockRowsState *node); -#endif /* NODELOCKROWS_H */ +#endif /* NODELOCKROWS_H */ diff --git a/src/include/executor/nodeMaterial.h b/src/include/executor/nodeMaterial.h index f6a7241ee7..f69abbca82 100644 --- a/src/include/executor/nodeMaterial.h +++ b/src/include/executor/nodeMaterial.h @@ -23,4 +23,4 @@ extern void ExecMaterialMarkPos(MaterialState *node); extern void ExecMaterialRestrPos(MaterialState *node); extern void ExecReScanMaterial(MaterialState *node); -#endif /* NODEMATERIAL_H */ +#endif /* NODEMATERIAL_H */ diff --git a/src/include/executor/nodeMergeAppend.h b/src/include/executor/nodeMergeAppend.h index eafa15445c..3cc6ef549b 100644 --- a/src/include/executor/nodeMergeAppend.h +++ b/src/include/executor/nodeMergeAppend.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecMergeAppend(MergeAppendState *node); extern void ExecEndMergeAppend(MergeAppendState *node); extern void ExecReScanMergeAppend(MergeAppendState *node); -#endif /* NODEMERGEAPPEND_H */ +#endif /* NODEMERGEAPPEND_H */ diff --git a/src/include/executor/nodeMergejoin.h b/src/include/executor/nodeMergejoin.h index ffaa3af908..32df25ae8b 100644 --- a/src/include/executor/nodeMergejoin.h +++ b/src/include/executor/nodeMergejoin.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecMergeJoin(MergeJoinState *node); extern void ExecEndMergeJoin(MergeJoinState *node); extern void ExecReScanMergeJoin(MergeJoinState *node); -#endif /* NODEMERGEJOIN_H */ +#endif /* NODEMERGEJOIN_H */ diff --git a/src/include/executor/nodeModifyTable.h b/src/include/executor/nodeModifyTable.h index 0c327768e1..5a406f236d 100644 --- a/src/include/executor/nodeModifyTable.h +++ b/src/include/executor/nodeModifyTable.h @@ -20,4 +20,4 @@ extern TupleTableSlot *ExecModifyTable(ModifyTableState *node); extern void ExecEndModifyTable(ModifyTableState *node); extern void ExecReScanModifyTable(ModifyTableState *node); -#endif /* NODEMODIFYTABLE_H */ +#endif /* NODEMODIFYTABLE_H */ diff --git a/src/include/executor/nodeNamedtuplestorescan.h b/src/include/executor/nodeNamedtuplestorescan.h index 9ef477e7ff..7f72fbe98a 100644 --- a/src/include/executor/nodeNamedtuplestorescan.h +++ b/src/include/executor/nodeNamedtuplestorescan.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecNamedTuplestoreScan(NamedTuplestoreScanState *node); extern void ExecEndNamedTuplestoreScan(NamedTuplestoreScanState *node); extern void ExecReScanNamedTuplestoreScan(NamedTuplestoreScanState *node); -#endif /* NODENAMEDTUPLESTORESCAN_H */ +#endif /* NODENAMEDTUPLESTORESCAN_H */ diff --git a/src/include/executor/nodeNestloop.h b/src/include/executor/nodeNestloop.h index 4b2bf59050..8e0fcc1922 100644 --- a/src/include/executor/nodeNestloop.h +++ b/src/include/executor/nodeNestloop.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecNestLoop(NestLoopState *node); extern void ExecEndNestLoop(NestLoopState *node); extern void ExecReScanNestLoop(NestLoopState *node); -#endif /* NODENESTLOOP_H */ +#endif /* NODENESTLOOP_H */ diff --git a/src/include/executor/nodeProjectSet.h b/src/include/executor/nodeProjectSet.h index 30b2b7cec9..2f6999e8db 100644 --- a/src/include/executor/nodeProjectSet.h +++ b/src/include/executor/nodeProjectSet.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecProjectSet(ProjectSetState *node); extern void ExecEndProjectSet(ProjectSetState *node); extern void ExecReScanProjectSet(ProjectSetState *node); -#endif /* NODEPROJECTSET_H */ +#endif /* NODEPROJECTSET_H */ diff --git a/src/include/executor/nodeRecursiveunion.h b/src/include/executor/nodeRecursiveunion.h index 066596f773..f0eba05bee 100644 --- a/src/include/executor/nodeRecursiveunion.h +++ b/src/include/executor/nodeRecursiveunion.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecRecursiveUnion(RecursiveUnionState *node); extern void ExecEndRecursiveUnion(RecursiveUnionState *node); extern void ExecReScanRecursiveUnion(RecursiveUnionState *node); -#endif /* NODERECURSIVEUNION_H */ +#endif /* NODERECURSIVEUNION_H */ diff --git a/src/include/executor/nodeResult.h b/src/include/executor/nodeResult.h index 8e547b77e9..61d3cb2cc2 100644 --- a/src/include/executor/nodeResult.h +++ b/src/include/executor/nodeResult.h @@ -23,4 +23,4 @@ extern void ExecResultMarkPos(ResultState *node); extern void ExecResultRestrPos(ResultState *node); extern void ExecReScanResult(ResultState *node); -#endif /* NODERESULT_H */ +#endif /* NODERESULT_H */ diff --git a/src/include/executor/nodeSamplescan.h b/src/include/executor/nodeSamplescan.h index 8baf3a355c..ed06e77e4e 100644 --- a/src/include/executor/nodeSamplescan.h +++ b/src/include/executor/nodeSamplescan.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecSampleScan(SampleScanState *node); extern void ExecEndSampleScan(SampleScanState *node); extern void ExecReScanSampleScan(SampleScanState *node); -#endif /* NODESAMPLESCAN_H */ +#endif /* NODESAMPLESCAN_H */ diff --git a/src/include/executor/nodeSeqscan.h b/src/include/executor/nodeSeqscan.h index 92b305e138..06e0686b0b 100644 --- a/src/include/executor/nodeSeqscan.h +++ b/src/include/executor/nodeSeqscan.h @@ -27,4 +27,4 @@ extern void ExecSeqScanEstimate(SeqScanState *node, ParallelContext *pcxt); extern void ExecSeqScanInitializeDSM(SeqScanState *node, ParallelContext *pcxt); extern void ExecSeqScanInitializeWorker(SeqScanState *node, shm_toc *toc); -#endif /* NODESEQSCAN_H */ +#endif /* NODESEQSCAN_H */ diff --git a/src/include/executor/nodeSetOp.h b/src/include/executor/nodeSetOp.h index 887bdc1a42..af85977183 100644 --- a/src/include/executor/nodeSetOp.h +++ b/src/include/executor/nodeSetOp.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecSetOp(SetOpState *node); extern void ExecEndSetOp(SetOpState *node); extern void ExecReScanSetOp(SetOpState *node); -#endif /* NODESETOP_H */ +#endif /* NODESETOP_H */ diff --git a/src/include/executor/nodeSort.h b/src/include/executor/nodeSort.h index 10d16b47b1..1d2b7130b3 100644 --- a/src/include/executor/nodeSort.h +++ b/src/include/executor/nodeSort.h @@ -23,4 +23,4 @@ extern void ExecSortMarkPos(SortState *node); extern void ExecSortRestrPos(SortState *node); extern void ExecReScanSort(SortState *node); -#endif /* NODESORT_H */ +#endif /* NODESORT_H */ diff --git a/src/include/executor/nodeSubplan.h b/src/include/executor/nodeSubplan.h index 0d3f52118b..5dbaeeb29a 100644 --- a/src/include/executor/nodeSubplan.h +++ b/src/include/executor/nodeSubplan.h @@ -28,4 +28,4 @@ extern void ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent); extern void ExecSetParamPlan(SubPlanState *node, ExprContext *econtext); -#endif /* NODESUBPLAN_H */ +#endif /* NODESUBPLAN_H */ diff --git a/src/include/executor/nodeSubqueryscan.h b/src/include/executor/nodeSubqueryscan.h index c2a0f707a6..c852e2947f 100644 --- a/src/include/executor/nodeSubqueryscan.h +++ b/src/include/executor/nodeSubqueryscan.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecSubqueryScan(SubqueryScanState *node); extern void ExecEndSubqueryScan(SubqueryScanState *node); extern void ExecReScanSubqueryScan(SubqueryScanState *node); -#endif /* NODESUBQUERYSCAN_H */ +#endif /* NODESUBQUERYSCAN_H */ diff --git a/src/include/executor/nodeTableFuncscan.h b/src/include/executor/nodeTableFuncscan.h index 529c929993..c58156e99c 100644 --- a/src/include/executor/nodeTableFuncscan.h +++ b/src/include/executor/nodeTableFuncscan.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecTableFuncScan(TableFuncScanState *node); extern void ExecEndTableFuncScan(TableFuncScanState *node); extern void ExecReScanTableFuncScan(TableFuncScanState *node); -#endif /* NODETABLEFUNCSCAN_H */ +#endif /* NODETABLEFUNCSCAN_H */ diff --git a/src/include/executor/nodeTidscan.h b/src/include/executor/nodeTidscan.h index 3186ca8cff..d07ed7c864 100644 --- a/src/include/executor/nodeTidscan.h +++ b/src/include/executor/nodeTidscan.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecTidScan(TidScanState *node); extern void ExecEndTidScan(TidScanState *node); extern void ExecReScanTidScan(TidScanState *node); -#endif /* NODETIDSCAN_H */ +#endif /* NODETIDSCAN_H */ diff --git a/src/include/executor/nodeUnique.h b/src/include/executor/nodeUnique.h index 66ad898397..3d0ac9dde1 100644 --- a/src/include/executor/nodeUnique.h +++ b/src/include/executor/nodeUnique.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecUnique(UniqueState *node); extern void ExecEndUnique(UniqueState *node); extern void ExecReScanUnique(UniqueState *node); -#endif /* NODEUNIQUE_H */ +#endif /* NODEUNIQUE_H */ diff --git a/src/include/executor/nodeValuesscan.h b/src/include/executor/nodeValuesscan.h index 6c2af73b1f..c28bb1acce 100644 --- a/src/include/executor/nodeValuesscan.h +++ b/src/include/executor/nodeValuesscan.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecValuesScan(ValuesScanState *node); extern void ExecEndValuesScan(ValuesScanState *node); extern void ExecReScanValuesScan(ValuesScanState *node); -#endif /* NODEVALUESSCAN_H */ +#endif /* NODEVALUESSCAN_H */ diff --git a/src/include/executor/nodeWindowAgg.h b/src/include/executor/nodeWindowAgg.h index 11d2dba2c5..db1ad60677 100644 --- a/src/include/executor/nodeWindowAgg.h +++ b/src/include/executor/nodeWindowAgg.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecWindowAgg(WindowAggState *node); extern void ExecEndWindowAgg(WindowAggState *node); extern void ExecReScanWindowAgg(WindowAggState *node); -#endif /* NODEWINDOWAGG_H */ +#endif /* NODEWINDOWAGG_H */ diff --git a/src/include/executor/nodeWorktablescan.h b/src/include/executor/nodeWorktablescan.h index 7790ca2e1b..c222d9f6b4 100644 --- a/src/include/executor/nodeWorktablescan.h +++ b/src/include/executor/nodeWorktablescan.h @@ -21,4 +21,4 @@ extern TupleTableSlot *ExecWorkTableScan(WorkTableScanState *node); extern void ExecEndWorkTableScan(WorkTableScanState *node); extern void ExecReScanWorkTableScan(WorkTableScanState *node); -#endif /* NODEWORKTABLESCAN_H */ +#endif /* NODEWORKTABLESCAN_H */ diff --git a/src/include/executor/spi.h b/src/include/executor/spi.h index c22b3ed5d6..6bbef72cc1 100644 --- a/src/include/executor/spi.h +++ b/src/include/executor/spi.h @@ -163,4 +163,4 @@ extern void AtEOSubXact_SPI(bool isCommit, SubTransactionId mySubid); extern int SPI_execute_direct(const char *src, char *nodename); #endif -#endif /* SPI_H */ +#endif /* SPI_H */ diff --git a/src/include/executor/spi_priv.h b/src/include/executor/spi_priv.h index 49aa7c94e7..ba7fb98875 100644 --- a/src/include/executor/spi_priv.h +++ b/src/include/executor/spi_priv.h @@ -31,7 +31,7 @@ typedef struct MemoryContext procCxt; /* procedure context */ MemoryContext execCxt; /* executor context */ MemoryContext savedcxt; /* context of SPI_connect's caller */ - SubTransactionId connectSubid; /* ID of connecting subtransaction */ + SubTransactionId connectSubid; /* ID of connecting subtransaction */ QueryEnvironment *queryEnv; /* query environment setup for SPI level */ } _SPI_connection; @@ -88,4 +88,4 @@ typedef struct _SPI_plan void *parserSetupArg; } _SPI_plan; -#endif /* SPI_PRIV_H */ +#endif /* SPI_PRIV_H */ diff --git a/src/include/executor/tablefunc.h b/src/include/executor/tablefunc.h index 22ca916eb2..a24a555b75 100644 --- a/src/include/executor/tablefunc.h +++ b/src/include/executor/tablefunc.h @@ -54,14 +54,14 @@ typedef struct TableFuncRoutine void (*InitOpaque) (struct TableFuncScanState *state, int natts); void (*SetDocument) (struct TableFuncScanState *state, Datum value); void (*SetNamespace) (struct TableFuncScanState *state, char *name, - char *uri); + char *uri); void (*SetRowFilter) (struct TableFuncScanState *state, char *path); void (*SetColumnFilter) (struct TableFuncScanState *state, - char *path, int colnum); + char *path, int colnum); bool (*FetchRow) (struct TableFuncScanState *state); Datum (*GetValue) (struct TableFuncScanState *state, int colnum, - Oid typid, int32 typmod, bool *isnull); + Oid typid, int32 typmod, bool *isnull); void (*DestroyOpaque) (struct TableFuncScanState *state); } TableFuncRoutine; -#endif /* _TABLEFUNC_H */ +#endif /* _TABLEFUNC_H */ diff --git a/src/include/executor/tqueue.h b/src/include/executor/tqueue.h index 892eec812e..a717ac6184 100644 --- a/src/include/executor/tqueue.h +++ b/src/include/executor/tqueue.h @@ -30,4 +30,4 @@ extern void DestroyTupleQueueReader(TupleQueueReader *reader); extern HeapTuple TupleQueueReaderNext(TupleQueueReader *reader, bool nowait, bool *done); -#endif /* TQUEUE_H */ +#endif /* TQUEUE_H */ diff --git a/src/include/executor/tstoreReceiver.h b/src/include/executor/tstoreReceiver.h index cd15e27821..ac4de3a663 100644 --- a/src/include/executor/tstoreReceiver.h +++ b/src/include/executor/tstoreReceiver.h @@ -26,4 +26,4 @@ extern void SetTuplestoreDestReceiverParams(DestReceiver *self, MemoryContext tContext, bool detoast); -#endif /* TSTORE_RECEIVER_H */ +#endif /* TSTORE_RECEIVER_H */ diff --git a/src/include/executor/tuptable.h b/src/include/executor/tuptable.h index efdb6fee5a..a1db5eb54b 100644 --- a/src/include/executor/tuptable.h +++ b/src/include/executor/tuptable.h @@ -116,7 +116,7 @@ typedef struct TupleTableSlot NodeTag type; bool tts_isempty; /* true = slot is empty */ bool tts_shouldFree; /* should pfree tts_tuple? */ - bool tts_shouldFreeMin; /* should pfree tts_mintuple? */ + bool tts_shouldFreeMin; /* should pfree tts_mintuple? */ bool tts_slow; /* saved state for slot_deform_tuple */ HeapTuple tts_tuple; /* physical tuple, or NULL if virtual */ #ifdef PGXC @@ -186,4 +186,4 @@ extern void slot_getallattrs(TupleTableSlot *slot); extern void slot_getsomeattrs(TupleTableSlot *slot, int attnum); extern bool slot_attisnull(TupleTableSlot *slot, int attnum); -#endif /* TUPTABLE_H */ +#endif /* TUPTABLE_H */ diff --git a/src/include/fe_utils/mbprint.h b/src/include/fe_utils/mbprint.h index 56626f631b..e3cfaf3ddd 100644 --- a/src/include/fe_utils/mbprint.h +++ b/src/include/fe_utils/mbprint.h @@ -22,8 +22,8 @@ struct lineptr extern unsigned char *mbvalidate(unsigned char *pwcs, int encoding); extern int pg_wcswidth(const char *pwcs, size_t len, int encoding); extern void pg_wcsformat(const unsigned char *pwcs, size_t len, int encoding, - struct lineptr * lines, int count); + struct lineptr *lines, int count); extern void pg_wcssize(const unsigned char *pwcs, size_t len, int encoding, int *width, int *height, int *format_size); -#endif /* MBPRINT_H */ +#endif /* MBPRINT_H */ diff --git a/src/include/fe_utils/print.h b/src/include/fe_utils/print.h index d89b6febcb..36b89e7d57 100644 --- a/src/include/fe_utils/print.h +++ b/src/include/fe_utils/print.h @@ -67,7 +67,7 @@ typedef struct printTextFormat { /* A complete line style */ const char *name; /* for display purposes */ - printTextLineFormat lrule[4]; /* indexed by enum printTextRule */ + printTextLineFormat lrule[4]; /* indexed by enum printTextRule */ const char *midvrule_nl; /* vertical line for continue after newline */ const char *midvrule_wrap; /* vertical line for wrapped data */ const char *midvrule_blank; /* vertical line for blank data */ @@ -77,8 +77,8 @@ typedef struct printTextFormat const char *nl_right; /* right mark for newline */ const char *wrap_left; /* left mark after wrapped data */ const char *wrap_right; /* right mark for wrapped data */ - bool wrap_right_border; /* use right-hand border for wrap - * marks when border=0? */ + bool wrap_right_border; /* use right-hand border for wrap marks + * when border=0? */ } printTextFormat; typedef enum unicode_linestyle @@ -96,14 +96,14 @@ struct separator typedef struct printTableOpt { enum printFormat format; /* see enum above */ - unsigned short int expanded;/* expanded/vertical output (if supported by - * output format); 0=no, 1=yes, 2=auto */ + unsigned short int expanded; /* expanded/vertical output (if supported + * by output format); 0=no, 1=yes, 2=auto */ unsigned short int border; /* Print a border around the table. 0=none, * 1=dividing lines, 2=full */ unsigned short int pager; /* use pager for output (if to stdout and * stdout is a tty) 0=off 1=on 2=always */ - int pager_min_lines;/* don't use pager unless there are at least - * this many lines */ + int pager_min_lines; /* don't use pager unless there are at + * least this many lines */ bool tuples_only; /* don't output headers, row counts, etc. */ bool start_table; /* print start decoration, eg <table> */ bool stop_table; /* print stop decoration, eg </table> */ @@ -166,9 +166,9 @@ typedef struct printQueryOpt char *nullPrint; /* how to print null entities */ char *title; /* override title */ char **footers; /* override footer (default is "(xx rows)") */ - bool translate_header; /* do gettext on column headers */ - const bool *translate_columns; /* translate_columns[i-1] => do - * gettext on col i */ + bool translate_header; /* do gettext on column headers */ + const bool *translate_columns; /* translate_columns[i-1] => do gettext on + * col i */ int n_translate_columns; /* length of translate_columns[] */ } printQueryOpt; @@ -212,4 +212,4 @@ extern void setDecimalLocale(void); extern const printTextFormat *get_line_style(const printTableOpt *opt); extern void refresh_utf8format(const printTableOpt *opt); -#endif /* PRINT_H */ +#endif /* PRINT_H */ diff --git a/src/include/fe_utils/psqlscan.h b/src/include/fe_utils/psqlscan.h index e9c8143925..c199a2917e 100644 --- a/src/include/fe_utils/psqlscan.h +++ b/src/include/fe_utils/psqlscan.h @@ -63,7 +63,7 @@ typedef struct PsqlScanCallbacks /* Fetch value of a variable, as a free'able string; NULL if unknown */ /* This pointer can be NULL if no variable substitution is wanted */ char *(*get_variable) (const char *varname, PsqlScanQuoteType quote, - void *passthrough); + void *passthrough); /* Print an error message someplace appropriate */ /* (very old gcc versions don't support attributes on function pointers) */ #if defined(__GNUC__) && __GNUC__ < 4 @@ -94,4 +94,4 @@ extern void psql_scan_reselect_sql_lexer(PsqlScanState state); extern bool psql_scan_in_quote(PsqlScanState state); -#endif /* PSQLSCAN_H */ +#endif /* PSQLSCAN_H */ diff --git a/src/include/fe_utils/psqlscan_int.h b/src/include/fe_utils/psqlscan_int.h index af62f5ebdf..c70ff29f4e 100644 --- a/src/include/fe_utils/psqlscan_int.h +++ b/src/include/fe_utils/psqlscan_int.h @@ -143,4 +143,4 @@ extern void psqlscan_escape_variable(PsqlScanState state, const char *txt, int len, PsqlScanQuoteType quote); -#endif /* PSQLSCAN_INT_H */ +#endif /* PSQLSCAN_INT_H */ diff --git a/src/include/fe_utils/simple_list.h b/src/include/fe_utils/simple_list.h index b63f5dc061..97bb34f191 100644 --- a/src/include/fe_utils/simple_list.h +++ b/src/include/fe_utils/simple_list.h @@ -34,7 +34,7 @@ typedef struct SimpleStringListCell struct SimpleStringListCell *next; bool touched; /* true, when this string was searched and * touched */ - char val[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string here */ + char val[FLEXIBLE_ARRAY_MEMBER]; /* null-terminated string here */ } SimpleStringListCell; typedef struct SimpleStringList @@ -52,4 +52,4 @@ extern bool simple_string_list_member(SimpleStringList *list, const char *val); extern const char *simple_string_list_not_touched(SimpleStringList *list); -#endif /* SIMPLE_LIST_H */ +#endif /* SIMPLE_LIST_H */ diff --git a/src/include/fe_utils/string_utils.h b/src/include/fe_utils/string_utils.h index c68234335e..bc6b87d6f1 100644 --- a/src/include/fe_utils/string_utils.h +++ b/src/include/fe_utils/string_utils.h @@ -57,4 +57,4 @@ extern bool processSQLNamePattern(PGconn *conn, PQExpBuffer buf, const char *schemavar, const char *namevar, const char *altnamevar, const char *visibilityrule); -#endif /* STRING_UTILS_H */ +#endif /* STRING_UTILS_H */ diff --git a/src/include/fmgr.h b/src/include/fmgr.h index cfb7b7774d..0216965bfc 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -82,7 +82,7 @@ typedef struct FunctionCallInfoData Oid fncollation; /* collation for function to use */ bool isnull; /* function must set true if result is NULL */ short nargs; /* # arguments actually passed */ - Datum arg[FUNC_MAX_ARGS]; /* Arguments passed to function */ + Datum arg[FUNC_MAX_ARGS]; /* Arguments passed to function */ bool argnull[FUNC_MAX_ARGS]; /* T if arg[i] is actually NULL */ } FunctionCallInfoData; @@ -196,11 +196,11 @@ extern void fmgr_info_copy(FmgrInfo *dstinfo, FmgrInfo *srcinfo, * Note: it'd be nice if these could be macros, but I see no way to do that * without evaluating the arguments multiple times, which is NOT acceptable. */ -extern struct varlena *pg_detoast_datum(struct varlena * datum); -extern struct varlena *pg_detoast_datum_copy(struct varlena * datum); -extern struct varlena *pg_detoast_datum_slice(struct varlena * datum, +extern struct varlena *pg_detoast_datum(struct varlena *datum); +extern struct varlena *pg_detoast_datum_copy(struct varlena *datum); +extern struct varlena *pg_detoast_datum_slice(struct varlena *datum, int32 first, int32 count); -extern struct varlena *pg_detoast_datum_packed(struct varlena * datum); +extern struct varlena *pg_detoast_datum_packed(struct varlena *datum); #define PG_DETOAST_DATUM(datum) \ pg_detoast_datum((struct varlena *) DatumGetPointer(datum)) @@ -690,8 +690,8 @@ extern void RestoreLibraryState(char *start_address); */ /* AggCheckCallContext can return one of the following codes, or 0: */ -#define AGG_CONTEXT_AGGREGATE 1 /* regular aggregate */ -#define AGG_CONTEXT_WINDOW 2 /* window function */ +#define AGG_CONTEXT_AGGREGATE 1 /* regular aggregate */ +#define AGG_CONTEXT_WINDOW 2 /* window function */ extern int AggCheckCallContext(FunctionCallInfo fcinfo, MemoryContext *aggcontext); @@ -720,7 +720,7 @@ typedef enum FmgrHookEventType typedef bool (*needs_fmgr_hook_type) (Oid fn_oid); typedef void (*fmgr_hook_type) (FmgrHookEventType event, - FmgrInfo *flinfo, Datum *arg); + FmgrInfo *flinfo, Datum *arg); extern PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook; extern PGDLLIMPORT fmgr_hook_type fmgr_hook; @@ -743,4 +743,4 @@ extern PGDLLIMPORT fmgr_hook_type fmgr_hook; */ extern char *fmgr(Oid procedureId,...); -#endif /* FMGR_H */ +#endif /* FMGR_H */ diff --git a/src/include/foreign/fdwapi.h b/src/include/foreign/fdwapi.h index 6ca44f734f..e391f20fb8 100644 --- a/src/include/foreign/fdwapi.h +++ b/src/include/foreign/fdwapi.h @@ -25,136 +25,136 @@ struct ExplainState; */ typedef void (*GetForeignRelSize_function) (PlannerInfo *root, - RelOptInfo *baserel, - Oid foreigntableid); + RelOptInfo *baserel, + Oid foreigntableid); typedef void (*GetForeignPaths_function) (PlannerInfo *root, - RelOptInfo *baserel, - Oid foreigntableid); + RelOptInfo *baserel, + Oid foreigntableid); typedef ForeignScan *(*GetForeignPlan_function) (PlannerInfo *root, - RelOptInfo *baserel, - Oid foreigntableid, - ForeignPath *best_path, - List *tlist, - List *scan_clauses, - Plan *outer_plan); + RelOptInfo *baserel, + Oid foreigntableid, + ForeignPath *best_path, + List *tlist, + List *scan_clauses, + Plan *outer_plan); typedef void (*BeginForeignScan_function) (ForeignScanState *node, - int eflags); + int eflags); typedef TupleTableSlot *(*IterateForeignScan_function) (ForeignScanState *node); typedef bool (*RecheckForeignScan_function) (ForeignScanState *node, - TupleTableSlot *slot); + TupleTableSlot *slot); typedef void (*ReScanForeignScan_function) (ForeignScanState *node); typedef void (*EndForeignScan_function) (ForeignScanState *node); typedef void (*GetForeignJoinPaths_function) (PlannerInfo *root, - RelOptInfo *joinrel, - RelOptInfo *outerrel, - RelOptInfo *innerrel, - JoinType jointype, - JoinPathExtraData *extra); + RelOptInfo *joinrel, + RelOptInfo *outerrel, + RelOptInfo *innerrel, + JoinType jointype, + JoinPathExtraData *extra); typedef void (*GetForeignUpperPaths_function) (PlannerInfo *root, - UpperRelationKind stage, - RelOptInfo *input_rel, - RelOptInfo *output_rel); + UpperRelationKind stage, + RelOptInfo *input_rel, + RelOptInfo *output_rel); typedef void (*AddForeignUpdateTargets_function) (Query *parsetree, - RangeTblEntry *target_rte, - Relation target_relation); + RangeTblEntry *target_rte, + Relation target_relation); typedef List *(*PlanForeignModify_function) (PlannerInfo *root, - ModifyTable *plan, - Index resultRelation, - int subplan_index); + ModifyTable *plan, + Index resultRelation, + int subplan_index); typedef void (*BeginForeignModify_function) (ModifyTableState *mtstate, - ResultRelInfo *rinfo, - List *fdw_private, - int subplan_index, - int eflags); + ResultRelInfo *rinfo, + List *fdw_private, + int subplan_index, + int eflags); typedef TupleTableSlot *(*ExecForeignInsert_function) (EState *estate, - ResultRelInfo *rinfo, - TupleTableSlot *slot, - TupleTableSlot *planSlot); + ResultRelInfo *rinfo, + TupleTableSlot *slot, + TupleTableSlot *planSlot); typedef TupleTableSlot *(*ExecForeignUpdate_function) (EState *estate, - ResultRelInfo *rinfo, - TupleTableSlot *slot, - TupleTableSlot *planSlot); + ResultRelInfo *rinfo, + TupleTableSlot *slot, + TupleTableSlot *planSlot); typedef TupleTableSlot *(*ExecForeignDelete_function) (EState *estate, - ResultRelInfo *rinfo, - TupleTableSlot *slot, - TupleTableSlot *planSlot); + ResultRelInfo *rinfo, + TupleTableSlot *slot, + TupleTableSlot *planSlot); typedef void (*EndForeignModify_function) (EState *estate, - ResultRelInfo *rinfo); + ResultRelInfo *rinfo); typedef int (*IsForeignRelUpdatable_function) (Relation rel); typedef bool (*PlanDirectModify_function) (PlannerInfo *root, - ModifyTable *plan, - Index resultRelation, - int subplan_index); + ModifyTable *plan, + Index resultRelation, + int subplan_index); typedef void (*BeginDirectModify_function) (ForeignScanState *node, - int eflags); + int eflags); typedef TupleTableSlot *(*IterateDirectModify_function) (ForeignScanState *node); typedef void (*EndDirectModify_function) (ForeignScanState *node); typedef RowMarkType (*GetForeignRowMarkType_function) (RangeTblEntry *rte, - LockClauseStrength strength); + LockClauseStrength strength); typedef HeapTuple (*RefetchForeignRow_function) (EState *estate, - ExecRowMark *erm, - Datum rowid, - bool *updated); + ExecRowMark *erm, + Datum rowid, + bool *updated); typedef void (*ExplainForeignScan_function) (ForeignScanState *node, - struct ExplainState *es); + struct ExplainState *es); typedef void (*ExplainForeignModify_function) (ModifyTableState *mtstate, - ResultRelInfo *rinfo, - List *fdw_private, - int subplan_index, - struct ExplainState *es); + ResultRelInfo *rinfo, + List *fdw_private, + int subplan_index, + struct ExplainState *es); typedef void (*ExplainDirectModify_function) (ForeignScanState *node, - struct ExplainState *es); + struct ExplainState *es); typedef int (*AcquireSampleRowsFunc) (Relation relation, int elevel, - HeapTuple *rows, int targrows, - double *totalrows, - double *totaldeadrows); + HeapTuple *rows, int targrows, + double *totalrows, + double *totaldeadrows); typedef bool (*AnalyzeForeignTable_function) (Relation relation, - AcquireSampleRowsFunc *func, - BlockNumber *totalpages); + AcquireSampleRowsFunc *func, + BlockNumber *totalpages); typedef List *(*ImportForeignSchema_function) (ImportForeignSchemaStmt *stmt, - Oid serverOid); + Oid serverOid); typedef Size (*EstimateDSMForeignScan_function) (ForeignScanState *node, - ParallelContext *pcxt); + ParallelContext *pcxt); typedef void (*InitializeDSMForeignScan_function) (ForeignScanState *node, - ParallelContext *pcxt, - void *coordinate); + ParallelContext *pcxt, + void *coordinate); typedef void (*InitializeWorkerForeignScan_function) (ForeignScanState *node, - shm_toc *toc, - void *coordinate); + shm_toc *toc, + void *coordinate); typedef void (*ShutdownForeignScan_function) (ForeignScanState *node); typedef bool (*IsForeignScanParallelSafe_function) (PlannerInfo *root, - RelOptInfo *rel, - RangeTblEntry *rte); + RelOptInfo *rel, + RangeTblEntry *rte); /* * FdwRoutine is the struct returned by a foreign-data wrapper's handler @@ -239,4 +239,4 @@ extern bool IsImportableForeignTable(const char *tablename, ImportForeignSchemaStmt *stmt); extern Path *GetExistingLocalJoinPath(RelOptInfo *joinrel); -#endif /* FDWAPI_H */ +#endif /* FDWAPI_H */ diff --git a/src/include/foreign/foreign.h b/src/include/foreign/foreign.h index 446a071239..2f4c569d1d 100644 --- a/src/include/foreign/foreign.h +++ b/src/include/foreign/foreign.h @@ -82,4 +82,4 @@ extern List *GetForeignColumnOptions(Oid relid, AttrNumber attnum); extern Oid get_foreign_data_wrapper_oid(const char *fdwname, bool missing_ok); extern Oid get_foreign_server_oid(const char *servername, bool missing_ok); -#endif /* FOREIGN_H */ +#endif /* FOREIGN_H */ diff --git a/src/include/funcapi.h b/src/include/funcapi.h index 30e66b6335..951af2aad3 100644 --- a/src/include/funcapi.h +++ b/src/include/funcapi.h @@ -315,4 +315,4 @@ extern void end_MultiFuncCall(PG_FUNCTION_ARGS, FuncCallContext *funcctx); PG_RETURN_NULL(); \ } while (0) -#endif /* FUNCAPI_H */ +#endif /* FUNCAPI_H */ diff --git a/src/include/getaddrinfo.h b/src/include/getaddrinfo.h index c5595142a5..3dcfc1fa25 100644 --- a/src/include/getaddrinfo.h +++ b/src/include/getaddrinfo.h @@ -55,8 +55,8 @@ #define EAI_NONAME WSAHOST_NOT_FOUND #define EAI_SERVICE WSATYPE_NOT_FOUND #define EAI_SOCKTYPE WSAESOCKTNOSUPPORT -#endif /* !WIN32 */ -#endif /* !EAI_FAIL */ +#endif /* !WIN32 */ +#endif /* !EAI_FAIL */ #ifndef AI_PASSIVE #define AI_PASSIVE 0x0001 @@ -124,7 +124,7 @@ struct addrinfo struct addrinfo *ai_next; }; #endif -#endif /* HAVE_STRUCT_ADDRINFO */ +#endif /* HAVE_STRUCT_ADDRINFO */ #ifndef HAVE_GETADDRINFO @@ -151,12 +151,12 @@ struct addrinfo #define getnameinfo pg_getnameinfo extern int getaddrinfo(const char *node, const char *service, - const struct addrinfo * hints, struct addrinfo ** res); -extern void freeaddrinfo(struct addrinfo * res); + const struct addrinfo *hints, struct addrinfo **res); +extern void freeaddrinfo(struct addrinfo *res); extern const char *gai_strerror(int errcode); -extern int getnameinfo(const struct sockaddr * sa, int salen, +extern int getnameinfo(const struct sockaddr *sa, int salen, char *node, int nodelen, char *service, int servicelen, int flags); -#endif /* HAVE_GETADDRINFO */ +#endif /* HAVE_GETADDRINFO */ -#endif /* GETADDRINFO_H */ +#endif /* GETADDRINFO_H */ diff --git a/src/include/getopt_long.h b/src/include/getopt_long.h index a16c5f9b14..c55d45348a 100644 --- a/src/include/getopt_long.h +++ b/src/include/getopt_long.h @@ -30,7 +30,7 @@ struct option extern int getopt_long(int argc, char *const argv[], const char *optstring, - const struct option * longopts, int *longindex); + const struct option *longopts, int *longindex); #endif -#endif /* GETOPT_LONG_H */ +#endif /* GETOPT_LONG_H */ diff --git a/src/include/lib/binaryheap.h b/src/include/lib/binaryheap.h index a4bbb390ea..da7504bd55 100644 --- a/src/include/lib/binaryheap.h +++ b/src/include/lib/binaryheap.h @@ -51,4 +51,4 @@ extern void binaryheap_replace_first(binaryheap *heap, Datum d); #define binaryheap_empty(h) ((h)->bh_size == 0) -#endif /* BINARYHEAP_H */ +#endif /* BINARYHEAP_H */ diff --git a/src/include/lib/bipartite_match.h b/src/include/lib/bipartite_match.h index d662b3821e..8f580bbd97 100644 --- a/src/include/lib/bipartite_match.h +++ b/src/include/lib/bipartite_match.h @@ -43,4 +43,4 @@ extern BipartiteMatchState *BipartiteMatch(int u_size, int v_size, short **adjac extern void BipartiteMatchFree(BipartiteMatchState *state); -#endif /* BIPARTITE_MATCH_H */ +#endif /* BIPARTITE_MATCH_H */ diff --git a/src/include/lib/hyperloglog.h b/src/include/lib/hyperloglog.h index dd40fe9b00..7a249cd252 100644 --- a/src/include/lib/hyperloglog.h +++ b/src/include/lib/hyperloglog.h @@ -65,4 +65,4 @@ extern void addHyperLogLog(hyperLogLogState *cState, uint32 hash); extern double estimateHyperLogLog(hyperLogLogState *cState); extern void freeHyperLogLog(hyperLogLogState *cState); -#endif /* HYPERLOGLOG_H */ +#endif /* HYPERLOGLOG_H */ diff --git a/src/include/lib/ilist.h b/src/include/lib/ilist.h index 8a44c90c4f..e5ac5c218a 100644 --- a/src/include/lib/ilist.h +++ b/src/include/lib/ilist.h @@ -266,7 +266,7 @@ extern void slist_check(slist_head *head); */ #define dlist_check(head) ((void) (head)) #define slist_check(head) ((void) (head)) -#endif /* ILIST_DEBUG */ +#endif /* ILIST_DEBUG */ /* doubly linked list implementation */ @@ -724,4 +724,4 @@ slist_delete_current(slist_mutable_iter *iter) (iter).cur = (iter).next, \ (iter).next = (iter).next ? (iter).next->next : NULL) -#endif /* ILIST_H */ +#endif /* ILIST_H */ diff --git a/src/include/lib/knapsack.h b/src/include/lib/knapsack.h index 8d1e6d0aa0..4485738e2a 100644 --- a/src/include/lib/knapsack.h +++ b/src/include/lib/knapsack.h @@ -14,4 +14,4 @@ extern Bitmapset *DiscreteKnapsack(int max_weight, int num_items, int *item_weights, double *item_values); -#endif /* KNAPSACK_H */ +#endif /* KNAPSACK_H */ diff --git a/src/include/lib/pairingheap.h b/src/include/lib/pairingheap.h index 9ee90befe5..e3a75f51f7 100644 --- a/src/include/lib/pairingheap.h +++ b/src/include/lib/pairingheap.h @@ -58,8 +58,8 @@ typedef struct pairingheap_node * and >0 iff a > b. For a min-heap, the conditions are reversed. */ typedef int (*pairingheap_comparator) (const pairingheap_node *a, - const pairingheap_node *b, - void *arg); + const pairingheap_node *b, + void *arg); /* * A pairing heap. @@ -85,7 +85,7 @@ extern void pairingheap_remove(pairingheap *heap, pairingheap_node *node); #ifdef PAIRINGHEAP_DEBUG extern char *pairingheap_dump(pairingheap *heap, - void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque), + void (*dumpfunc) (pairingheap_node *node, StringInfo buf, void *opaque), void *opaque); #endif @@ -99,4 +99,4 @@ extern char *pairingheap_dump(pairingheap *heap, #define pairingheap_is_singular(h) \ ((h)->ph_root && (h)->ph_root->first_child == NULL) -#endif /* PAIRINGHEAP_H */ +#endif /* PAIRINGHEAP_H */ diff --git a/src/include/lib/rbtree.h b/src/include/lib/rbtree.h index 7e2b7ae71b..a7183bb0b4 100644 --- a/src/include/lib/rbtree.h +++ b/src/include/lib/rbtree.h @@ -79,4 +79,4 @@ extern void rb_begin_iterate(RBTree *rb, RBOrderControl ctrl, RBTreeIterator *iter); extern RBNode *rb_iterate(RBTreeIterator *iter); -#endif /* RBTREE_H */ +#endif /* RBTREE_H */ diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h index 47dd0bc4ee..c5af5b96a7 100644 --- a/src/include/lib/simplehash.h +++ b/src/include/lib/simplehash.h @@ -121,7 +121,7 @@ typedef struct SH_TYPE /* user defined data, useful for callbacks */ void *private_data; -} SH_TYPE; +} SH_TYPE; typedef enum SH_STATUS { @@ -134,22 +134,22 @@ typedef struct SH_ITERATOR uint32 cur; /* current element */ uint32 end; bool done; /* iterator exhausted? */ -} SH_ITERATOR; +} SH_ITERATOR; /* externally visible function prototypes */ -SH_SCOPE SH_TYPE *SH_CREATE(MemoryContext ctx, uint32 nelements, +SH_SCOPE SH_TYPE *SH_CREATE(MemoryContext ctx, uint32 nelements, void *private_data); SH_SCOPE void SH_DESTROY(SH_TYPE * tb); SH_SCOPE void SH_GROW(SH_TYPE * tb, uint32 newsize); -SH_SCOPE SH_ELEMENT_TYPE *SH_INSERT(SH_TYPE * tb, SH_KEY_TYPE key, bool *found); -SH_SCOPE SH_ELEMENT_TYPE *SH_LOOKUP(SH_TYPE * tb, SH_KEY_TYPE key); +SH_SCOPE SH_ELEMENT_TYPE *SH_INSERT(SH_TYPE * tb, SH_KEY_TYPE key, bool *found); +SH_SCOPE SH_ELEMENT_TYPE *SH_LOOKUP(SH_TYPE * tb, SH_KEY_TYPE key); SH_SCOPE bool SH_DELETE(SH_TYPE * tb, SH_KEY_TYPE key); SH_SCOPE void SH_START_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter); SH_SCOPE void SH_START_ITERATE_AT(SH_TYPE * tb, SH_ITERATOR * iter, uint32 at); -SH_SCOPE SH_ELEMENT_TYPE *SH_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter); +SH_SCOPE SH_ELEMENT_TYPE *SH_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter); SH_SCOPE void SH_STAT(SH_TYPE * tb); -#endif /* SH_DECLARE */ +#endif /* SH_DECLARE */ /* generate implementation of the hash table */ @@ -324,7 +324,7 @@ SH_FREE(SH_TYPE * type, void *pointer) * Memory other than for the array of elements will still be allocated from * the passed-in context. */ -SH_SCOPE SH_TYPE * +SH_SCOPE SH_TYPE * SH_CREATE(MemoryContext ctx, uint32 nelements, void *private_data) { SH_TYPE *tb; @@ -470,7 +470,7 @@ SH_GROW(SH_TYPE * tb, uint32 newsize) * already exists, false otherwise. Returns the hash-table entry in either * case. */ -SH_SCOPE SH_ELEMENT_TYPE * +SH_SCOPE SH_ELEMENT_TYPE * SH_INSERT(SH_TYPE * tb, SH_KEY_TYPE key, bool *found) { uint32 hash = SH_HASH_KEY(tb, key); @@ -634,7 +634,7 @@ restart: /* * Lookup up entry in hash table. Returns NULL if key not present. */ -SH_SCOPE SH_ELEMENT_TYPE * +SH_SCOPE SH_ELEMENT_TYPE * SH_LOOKUP(SH_TYPE * tb, SH_KEY_TYPE key) { uint32 hash = SH_HASH_KEY(tb, key); @@ -788,7 +788,7 @@ SH_START_ITERATE_AT(SH_TYPE * tb, SH_ITERATOR * iter, uint32 at) * Iterate backwards, that allows the current element to be deleted, even * if there are backward shifts. */ - iter->cur = at & tb->sizemask; /* ensure at is within a valid range */ + iter->cur = at & tb->sizemask; /* ensure at is within a valid range */ iter->end = iter->cur; iter->done = false; } @@ -803,7 +803,7 @@ SH_START_ITERATE_AT(SH_TYPE * tb, SH_ITERATOR * iter, uint32 at) * deletions), but if so, there's neither a guarantee that all nodes are * visited at least once, nor a guarantee that a node is visited at most once. */ -SH_SCOPE SH_ELEMENT_TYPE * +SH_SCOPE SH_ELEMENT_TYPE * SH_ITERATE(SH_TYPE * tb, SH_ITERATOR * iter) { while (!iter->done) @@ -899,10 +899,10 @@ SH_STAT(SH_TYPE * tb) total_collisions, max_collisions, avg_collisions); } -#endif /* SH_DEFINE */ +#endif /* SH_DEFINE */ -/* undefine external paramters, so next hash table can be defined */ +/* undefine external parameters, so next hash table can be defined */ #undef SH_PREFIX #undef SH_KEY_TYPE #undef SH_KEY diff --git a/src/include/lib/stringinfo.h b/src/include/lib/stringinfo.h index 316c196565..9694ea3f21 100644 --- a/src/include/lib/stringinfo.h +++ b/src/include/lib/stringinfo.h @@ -149,4 +149,4 @@ extern void appendBinaryStringInfo(StringInfo str, */ extern void enlargeStringInfo(StringInfo str, int needed); -#endif /* STRINGINFO_H */ +#endif /* STRINGINFO_H */ diff --git a/src/include/libpq/auth.h b/src/include/libpq/auth.h index 601dc5d71a..871cc03add 100644 --- a/src/include/libpq/auth.h +++ b/src/include/libpq/auth.h @@ -26,4 +26,4 @@ extern void ClientAuthentication(Port *port); typedef void (*ClientAuthentication_hook_type) (Port *, int); extern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook; -#endif /* AUTH_H */ +#endif /* AUTH_H */ diff --git a/src/include/libpq/be-fsstubs.h b/src/include/libpq/be-fsstubs.h index 641124cd21..96bcaa0f08 100644 --- a/src/include/libpq/be-fsstubs.h +++ b/src/include/libpq/be-fsstubs.h @@ -34,4 +34,4 @@ extern void AtEOXact_LargeObject(bool isCommit); extern void AtEOSubXact_LargeObject(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid); -#endif /* BE_FSSTUBS_H */ +#endif /* BE_FSSTUBS_H */ diff --git a/src/include/libpq/hba.h b/src/include/libpq/hba.h index f28b860877..07d92d4f9f 100644 --- a/src/include/libpq/hba.h +++ b/src/include/libpq/hba.h @@ -120,4 +120,4 @@ extern int check_usermap(const char *usermap_name, bool case_sensitive); extern bool pg_isblank(const char c); -#endif /* HBA_H */ +#endif /* HBA_H */ diff --git a/src/include/libpq/ifaddr.h b/src/include/libpq/ifaddr.h index 5f6f48598f..be19ff8823 100644 --- a/src/include/libpq/ifaddr.h +++ b/src/include/libpq/ifaddr.h @@ -14,17 +14,17 @@ #include "libpq/pqcomm.h" /* pgrminclude ignore */ -typedef void (*PgIfAddrCallback) (struct sockaddr * addr, - struct sockaddr * netmask, - void *cb_data); +typedef void (*PgIfAddrCallback) (struct sockaddr *addr, + struct sockaddr *netmask, + void *cb_data); -extern int pg_range_sockaddr(const struct sockaddr_storage * addr, - const struct sockaddr_storage * netaddr, - const struct sockaddr_storage * netmask); +extern int pg_range_sockaddr(const struct sockaddr_storage *addr, + const struct sockaddr_storage *netaddr, + const struct sockaddr_storage *netmask); -extern int pg_sockaddr_cidr_mask(struct sockaddr_storage * mask, +extern int pg_sockaddr_cidr_mask(struct sockaddr_storage *mask, char *numbits, int family); extern int pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data); -#endif /* IFADDR_H */ +#endif /* IFADDR_H */ diff --git a/src/include/libpq/libpq-be.h b/src/include/libpq/libpq-be.h index ed4ecea816..8b1b84a5ae 100644 --- a/src/include/libpq/libpq-be.h +++ b/src/include/libpq/libpq-be.h @@ -32,7 +32,7 @@ #include <gssapi.h> #else #include <gssapi/gssapi.h> -#endif /* HAVE_GSSAPI_H */ +#endif /* HAVE_GSSAPI_H */ /* * GSSAPI brings in headers that set a lot of things in the global namespace on win32, * that doesn't match the msvc build. It gives a bunch of compiler warnings that we ignore, @@ -41,7 +41,7 @@ #ifdef _MSC_VER #undef HAVE_GETADDRINFO #endif -#endif /* ENABLE_GSS */ +#endif /* ENABLE_GSS */ #ifdef ENABLE_SSPI #define SECURITY_WIN32 @@ -61,7 +61,7 @@ typedef struct int length; } gss_buffer_desc; #endif -#endif /* ENABLE_SSPI */ +#endif /* ENABLE_SSPI */ #include "datatype/timestamp.h" #include "libpq/hba.h" @@ -120,10 +120,10 @@ typedef struct Port SockAddr laddr; /* local addr (postmaster) */ SockAddr raddr; /* remote addr (client) */ char *remote_host; /* name (or ip addr) of remote host */ - char *remote_hostname;/* name (not ip addr) of remote host, if - * available */ + char *remote_hostname; /* name (not ip addr) of remote host, if + * available */ int remote_hostname_resolv; /* see above */ - int remote_hostname_errcode; /* see above */ + int remote_hostname_errcode; /* see above */ char *remote_port; /* text rep of remote port */ CAC_state canAcceptConnections; /* postmaster connection status */ @@ -147,7 +147,7 @@ typedef struct Port * but since it gets used by elog.c in the same way as database_name and * other members of this struct, we may as well keep it here. */ - TimestampTz SessionStartTime; /* backend start time */ + TimestampTz SessionStartTime; /* backend start time */ /* * TCP keepalive settings. @@ -222,4 +222,4 @@ extern int pq_setkeepalivesidle(int idle, Port *port); extern int pq_setkeepalivesinterval(int interval, Port *port); extern int pq_setkeepalivescount(int count, Port *port); -#endif /* LIBPQ_BE_H */ +#endif /* LIBPQ_BE_H */ diff --git a/src/include/libpq/libpq-fs.h b/src/include/libpq/libpq-fs.h index afe32706f4..ce4b2a1892 100644 --- a/src/include/libpq/libpq-fs.h +++ b/src/include/libpq/libpq-fs.h @@ -21,4 +21,4 @@ #define INV_WRITE 0x00020000 #define INV_READ 0x00040000 -#endif /* LIBPQ_FS_H */ +#endif /* LIBPQ_FS_H */ diff --git a/src/include/libpq/libpq.h b/src/include/libpq/libpq.h index d4885a5e28..78851b1060 100644 --- a/src/include/libpq/libpq.h +++ b/src/include/libpq/libpq.h @@ -99,4 +99,4 @@ extern char *SSLCipherSuites; extern char *SSLECDHCurve; extern bool SSLPreferServerCiphers; -#endif /* LIBPQ_H */ +#endif /* LIBPQ_H */ diff --git a/src/include/libpq/pqcomm.h b/src/include/libpq/pqcomm.h index b6de569c5c..10c7434c41 100644 --- a/src/include/libpq/pqcomm.h +++ b/src/include/libpq/pqcomm.h @@ -57,7 +57,7 @@ struct sockaddr_storage #define ss_len ss_stuff.sa.sa_len #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN 1 #endif -#endif /* HAVE_STRUCT_SOCKADDR_STORAGE */ +#endif /* HAVE_STRUCT_SOCKADDR_STORAGE */ typedef struct { @@ -133,19 +133,19 @@ typedef uint32 PacketLen; #define SM_DATABASE 64 #define SM_USER 32 /* We append database name if db_user_namespace true. */ -#define SM_DATABASE_USER (SM_DATABASE+SM_USER+1) /* +1 for @ */ +#define SM_DATABASE_USER (SM_DATABASE+SM_USER+1) /* +1 for @ */ #define SM_OPTIONS 64 #define SM_UNUSED 64 #define SM_TTY 64 typedef struct StartupPacket { - ProtocolVersion protoVersion; /* Protocol version */ + ProtocolVersion protoVersion; /* Protocol version */ char database[SM_DATABASE]; /* Database name */ /* Db_user_namespace appends dbname */ char user[SM_USER]; /* User name */ char options[SM_OPTIONS]; /* Optional additional args */ - char unused[SM_UNUSED]; /* Unused */ + char unused[SM_UNUSED]; /* Unused */ char tty[SM_TTY]; /* Tty for debug output */ } StartupPacket; @@ -192,7 +192,7 @@ typedef uint32 AuthRequest; typedef struct CancelRequestPacket { /* Note that each field is stored in network byte order! */ - MsgType cancelRequestCode; /* code to identify a cancel request */ + MsgType cancelRequestCode; /* code to identify a cancel request */ uint32 backendPID; /* PID of client's backend */ uint32 cancelAuthCode; /* secret key to authorize cancel */ } CancelRequestPacket; @@ -204,4 +204,4 @@ typedef struct CancelRequestPacket */ #define NEGOTIATE_SSL_CODE PG_PROTOCOL(1234,5679) -#endif /* PQCOMM_H */ +#endif /* PQCOMM_H */ diff --git a/src/include/libpq/pqformat.h b/src/include/libpq/pqformat.h index 4df87ec8a2..32112547a0 100644 --- a/src/include/libpq/pqformat.h +++ b/src/include/libpq/pqformat.h @@ -47,4 +47,4 @@ extern const char *pq_getmsgstring(StringInfo msg); extern const char *pq_getmsgrawstring(StringInfo msg); extern void pq_getmsgend(StringInfo msg); -#endif /* PQFORMAT_H */ +#endif /* PQFORMAT_H */ diff --git a/src/include/libpq/pqmq.h b/src/include/libpq/pqmq.h index e356bd60f4..86436d6753 100644 --- a/src/include/libpq/pqmq.h +++ b/src/include/libpq/pqmq.h @@ -21,4 +21,4 @@ extern void pq_set_parallel_master(pid_t pid, BackendId backend_id); extern void pq_parse_errornotice(StringInfo str, ErrorData *edata); -#endif /* PQMQ_H */ +#endif /* PQMQ_H */ diff --git a/src/include/libpq/pqsignal.h b/src/include/libpq/pqsignal.h index a9dbce49d1..af4e61ba4d 100644 --- a/src/include/libpq/pqsignal.h +++ b/src/include/libpq/pqsignal.h @@ -28,7 +28,7 @@ extern int pqsigsetmask(int mask); #define sigfillset(set) (*(set) = ~0) #define sigaddset(set, signum) (*(set) |= (sigmask(signum))) #define sigdelset(set, signum) (*(set) &= ~(sigmask(signum))) -#endif /* WIN32 */ +#endif /* WIN32 */ extern sigset_t UnBlockSig, BlockSig, @@ -36,4 +36,4 @@ extern sigset_t UnBlockSig, extern void pqinitmask(void); -#endif /* PQSIGNAL_H */ +#endif /* PQSIGNAL_H */ diff --git a/src/include/libpq/scram.h b/src/include/libpq/scram.h index 14b48af12f..0166e1945d 100644 --- a/src/include/libpq/scram.h +++ b/src/include/libpq/scram.h @@ -31,4 +31,4 @@ extern char *pg_be_scram_build_verifier(const char *password); extern bool scram_verify_plain_password(const char *username, const char *password, const char *verifier); -#endif /* PG_SCRAM_H */ +#endif /* PG_SCRAM_H */ diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h index 737ab1c713..d57ef017cb 100644 --- a/src/include/mb/pg_wchar.h +++ b/src/include/mb/pg_wchar.h @@ -133,10 +133,12 @@ typedef unsigned int pg_wchar; #define LC_JISX0212 0x94 /* Japanese Kanji (JIS X 0212) */ #define LC_CNS11643_1 0x95 /* CNS 11643-1992 Plane 1 */ #define LC_CNS11643_2 0x96 /* CNS 11643-1992 Plane 2 */ -#define LC_JISX0213_1 0x97/* Japanese Kanji (JIS X 0213 Plane 1) (not - * supported) */ -#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not supported) */ -#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not supported) */ +#define LC_JISX0213_1 0x97 /* Japanese Kanji (JIS X 0213 Plane 1) + * (not supported) */ +#define LC_BIG5_1 0x98 /* Plane 1 Chinese traditional (not + * supported) */ +#define LC_BIG5_2 0x99 /* Plane 1 Chinese traditional (not + * supported) */ /* Is a leading byte for "official" multibyte encodings? */ #define IS_LC2(c) ((unsigned char)(c) >= 0x90 && (unsigned char)(c) <= 0x99) @@ -168,44 +170,44 @@ typedef unsigned int pg_wchar; /* * Charset IDs for private single byte encodings (0xa0-0xef) */ -#define LC_SISHENG 0xa0/* Chinese SiSheng characters for - * PinYin/ZhuYin (not supported) */ -#define LC_IPA 0xa1/* IPA (International Phonetic Association) - * (not supported) */ -#define LC_VISCII_LOWER 0xa2/* Vietnamese VISCII1.1 lower-case (not - * supported) */ -#define LC_VISCII_UPPER 0xa3/* Vietnamese VISCII1.1 upper-case (not - * supported) */ +#define LC_SISHENG 0xa0 /* Chinese SiSheng characters for + * PinYin/ZhuYin (not supported) */ +#define LC_IPA 0xa1 /* IPA (International Phonetic + * Association) (not supported) */ +#define LC_VISCII_LOWER 0xa2 /* Vietnamese VISCII1.1 lower-case (not + * supported) */ +#define LC_VISCII_UPPER 0xa3 /* Vietnamese VISCII1.1 upper-case (not + * supported) */ #define LC_ARABIC_DIGIT 0xa4 /* Arabic digit (not supported) */ #define LC_ARABIC_1_COLUMN 0xa5 /* Arabic 1-column (not supported) */ #define LC_ASCII_RIGHT_TO_LEFT 0xa6 /* ASCII (left half of ISO8859-1) with * right-to-left direction (not * supported) */ -#define LC_LAO 0xa7/* Lao characters (ISO10646 0E80..0EDF) (not - * supported) */ +#define LC_LAO 0xa7 /* Lao characters (ISO10646 0E80..0EDF) + * (not supported) */ #define LC_ARABIC_2_COLUMN 0xa8 /* Arabic 1-column (not supported) */ /* * Charset IDs for private multibyte encodings (0xf0-0xff) */ -#define LC_INDIAN_1_COLUMN 0xf0/* Indian charset for 1-column width glyphs - * (not supported) */ -#define LC_TIBETAN_1_COLUMN 0xf1/* Tibetan 1-column width glyphs (not - * supported) */ -#define LC_UNICODE_SUBSET_2 0xf2/* Unicode characters of the range - * U+2500..U+33FF. (not supported) */ -#define LC_UNICODE_SUBSET_3 0xf3/* Unicode characters of the range - * U+E000..U+FFFF. (not supported) */ -#define LC_UNICODE_SUBSET 0xf4/* Unicode characters of the range - * U+0100..U+24FF. (not supported) */ +#define LC_INDIAN_1_COLUMN 0xf0 /* Indian charset for 1-column width + * glyphs (not supported) */ +#define LC_TIBETAN_1_COLUMN 0xf1 /* Tibetan 1-column width glyphs (not + * supported) */ +#define LC_UNICODE_SUBSET_2 0xf2 /* Unicode characters of the range + * U+2500..U+33FF. (not supported) */ +#define LC_UNICODE_SUBSET_3 0xf3 /* Unicode characters of the range + * U+E000..U+FFFF. (not supported) */ +#define LC_UNICODE_SUBSET 0xf4 /* Unicode characters of the range + * U+0100..U+24FF. (not supported) */ #define LC_ETHIOPIC 0xf5 /* Ethiopic characters (not supported) */ #define LC_CNS11643_3 0xf6 /* CNS 11643-1992 Plane 3 */ #define LC_CNS11643_4 0xf7 /* CNS 11643-1992 Plane 4 */ #define LC_CNS11643_5 0xf8 /* CNS 11643-1992 Plane 5 */ #define LC_CNS11643_6 0xf9 /* CNS 11643-1992 Plane 6 */ #define LC_CNS11643_7 0xfa /* CNS 11643-1992 Plane 7 */ -#define LC_INDIAN_2_COLUMN 0xfb/* Indian charset for 2-column width glyphs - * (not supported) */ +#define LC_INDIAN_2_COLUMN 0xfb /* Indian charset for 2-column width + * glyphs (not supported) */ #define LC_TIBETAN 0xfc /* Tibetan (not supported) */ /* #define FREE 0xfd free (unused) */ /* #define FREE 0xfe free (unused) */ @@ -342,12 +344,12 @@ extern const char *get_encoding_name_for_icu(int encoding); * pg_wchar stuff */ typedef int (*mb2wchar_with_len_converter) (const unsigned char *from, - pg_wchar *to, - int len); + pg_wchar *to, + int len); typedef int (*wchar2mb_with_len_converter) (const pg_wchar *from, - unsigned char *to, - int len); + unsigned char *to, + int len); typedef int (*mblen_converter) (const unsigned char *mbstr); @@ -359,12 +361,12 @@ typedef int (*mbverifier) (const unsigned char *mbstr, int len); typedef struct { - mb2wchar_with_len_converter mb2wchar_with_len; /* convert a multibyte - * string to a wchar */ - wchar2mb_with_len_converter wchar2mb_with_len; /* convert a wchar - * string to a multibyte */ + mb2wchar_with_len_converter mb2wchar_with_len; /* convert a multibyte + * string to a wchar */ + wchar2mb_with_len_converter wchar2mb_with_len; /* convert a wchar string + * to a multibyte */ mblen_converter mblen; /* get byte length of a char */ - mbdisplaylen_converter dsplen; /* get display width of a char */ + mbdisplaylen_converter dsplen; /* get display width of a char */ mbverifier mbverify; /* verify multibyte sequence */ int maxmblen; /* max bytes for a char in this encoding */ } pg_wchar_tbl; @@ -597,7 +599,7 @@ extern void check_encoding_conversion_args(int src_encoding, extern void report_invalid_encoding(int encoding, const char *mbstr, int len) pg_attribute_noreturn(); extern void report_untranslatable_char(int src_encoding, int dest_encoding, - const char *mbstr, int len) pg_attribute_noreturn(); + const char *mbstr, int len) pg_attribute_noreturn(); extern void local2local(const unsigned char *l, unsigned char *p, int len, int src_encoding, int dest_encoding, const unsigned char *tab); @@ -620,4 +622,4 @@ extern bool pg_utf8_islegal(const unsigned char *source, int length); extern WCHAR *pgwin32_message_to_UTF16(const char *str, int len, int *utf16len); #endif -#endif /* PG_WCHAR_H */ +#endif /* PG_WCHAR_H */ diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 8ac73dd403..58feafd919 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -112,7 +112,7 @@ do { \ if (InterruptPending) \ ProcessInterrupts(); \ } while(0) -#endif /* WIN32 */ +#endif /* WIN32 */ #define HOLD_INTERRUPTS() (InterruptHoldoffCount++) @@ -487,4 +487,4 @@ extern bool has_rolreplication(Oid roleid); extern bool BackupInProgress(void); extern void CancelBackup(void); -#endif /* MISCADMIN_H */ +#endif /* MISCADMIN_H */ diff --git a/src/include/nodes/bitmapset.h b/src/include/nodes/bitmapset.h index f381bedd44..28641e20d4 100644 --- a/src/include/nodes/bitmapset.h +++ b/src/include/nodes/bitmapset.h @@ -105,4 +105,4 @@ extern uint32 bms_hash_value(const Bitmapset *a); extern int bms_any_member(Bitmapset *a); #endif -#endif /* BITMAPSET_H */ +#endif /* BITMAPSET_H */ diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 2bc126dabe..86f379c126 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -45,8 +45,8 @@ struct ExprContext; struct ExprEvalStep; /* avoid including execExpr.h everywhere */ typedef Datum (*ExprStateEvalFunc) (struct ExprState *expression, - struct ExprContext *econtext, - bool *isNull); + struct ExprContext *econtext, + bool *isNull); /* Bits in ExprState->flags (see also execExpr.h for private flag bits): */ /* expression is for use with ExecQual() */ @@ -140,8 +140,8 @@ typedef struct IndexInfo List *ii_Predicate; /* list of Expr */ ExprState *ii_PredicateState; Oid *ii_ExclusionOps; /* array with one entry per column */ - Oid *ii_ExclusionProcs; /* array with one entry per column */ - uint16 *ii_ExclusionStrats; /* array with one entry per column */ + Oid *ii_ExclusionProcs; /* array with one entry per column */ + uint16 *ii_ExclusionStrats; /* array with one entry per column */ Oid *ii_UniqueOps; /* array with one entry per column */ Oid *ii_UniqueProcs; /* array with one entry per column */ uint16 *ii_UniqueStrats; /* array with one entry per column */ @@ -205,7 +205,7 @@ typedef struct ExprContext MemoryContext ecxt_per_tuple_memory; /* Values to substitute for Param nodes in expression */ - ParamExecData *ecxt_param_exec_vals; /* for PARAM_EXEC params */ + ParamExecData *ecxt_param_exec_vals; /* for PARAM_EXEC params */ ParamListInfo ecxt_param_list_info; /* for other param types */ /* @@ -251,7 +251,7 @@ typedef enum { SFRM_ValuePerCall = 0x01, /* one value returned per call */ SFRM_Materialize = 0x02, /* result set instantiated in Tuplestore */ - SFRM_Materialize_Random = 0x04, /* Tuplestore needs randomAccess */ + SFRM_Materialize_Random = 0x04, /* Tuplestore needs randomAccess */ SFRM_Materialize_Preferred = 0x08 /* caller prefers Tuplestore */ } SetFunctionReturnMode; @@ -338,61 +338,81 @@ typedef struct JunkFilter AttrNumber jf_junkAttNo; } JunkFilter; -/* ---------------- - * ResultRelInfo information - * - * Whenever we update an existing relation, we have to - * update indices on the relation, and perhaps also fire triggers. - * The ResultRelInfo class is used to hold all the information needed - * about a result relation, including indices.. -cim 10/15/89 - * - * RangeTableIndex result relation's range table index - * RelationDesc relation descriptor for result relation - * NumIndices # of indices existing on result relation - * IndexRelationDescs array of relation descriptors for indices - * IndexRelationInfo array of key/attr info for indices - * TrigDesc triggers to be fired, if any - * TrigFunctions cached lookup info for trigger functions - * TrigWhenExprs array of trigger WHEN expr states - * TrigInstrument optional runtime measurements for triggers - * FdwRoutine FDW callback functions, if foreign table - * FdwState available to save private state of FDW - * usesFdwDirectModify true when modifying foreign table directly - * WithCheckOptions list of WithCheckOption's to be checked - * WithCheckOptionExprs list of WithCheckOption expr states - * ConstraintExprs array of constraint-checking expr states - * junkFilter for removing junk attributes from tuples - * projectReturning for computing a RETURNING list - * onConflictSetProj for computing ON CONFLICT DO UPDATE SET - * onConflictSetWhere list of ON CONFLICT DO UPDATE exprs (qual) - * PartitionCheck partition check expression - * PartitionCheckExpr partition check expression state - * ---------------- +/* + * ResultRelInfo + * + * Whenever we update an existing relation, we have to update indexes on the + * relation, and perhaps also fire triggers. ResultRelInfo holds all the + * information needed about a result relation, including indexes. */ typedef struct ResultRelInfo { NodeTag type; + + /* result relation's range table index */ Index ri_RangeTableIndex; + + /* relation descriptor for result relation */ Relation ri_RelationDesc; + + /* # of indices existing on result relation */ int ri_NumIndices; + + /* array of relation descriptors for indices */ RelationPtr ri_IndexRelationDescs; + + /* array of key/attr info for indices */ IndexInfo **ri_IndexRelationInfo; + + /* triggers to be fired, if any */ TriggerDesc *ri_TrigDesc; + + /* cached lookup info for trigger functions */ FmgrInfo *ri_TrigFunctions; + + /* array of trigger WHEN expr states */ ExprState **ri_TrigWhenExprs; + + /* optional runtime measurements for triggers */ Instrumentation *ri_TrigInstrument; + + /* FDW callback functions, if foreign table */ struct FdwRoutine *ri_FdwRoutine; + + /* available to save private state of FDW */ void *ri_FdwState; + + /* true when modifying foreign table directly */ bool ri_usesFdwDirectModify; + + /* list of WithCheckOption's to be checked */ List *ri_WithCheckOptions; + + /* list of WithCheckOption expr states */ List *ri_WithCheckOptionExprs; + + /* array of constraint-checking expr states */ ExprState **ri_ConstraintExprs; + + /* for removing junk attributes from tuples */ JunkFilter *ri_junkFilter; + + /* for computing a RETURNING list */ ProjectionInfo *ri_projectReturning; + + /* for computing ON CONFLICT DO UPDATE SET */ ProjectionInfo *ri_onConflictSetProj; + + /* list of ON CONFLICT DO UPDATE exprs (qual) */ ExprState *ri_onConflictSetWhere; + + /* partition check expression */ List *ri_PartitionCheck; + + /* partition check expression state */ ExprState *ri_PartitionCheckExpr; + + /* relation descriptor for root partitioned table */ Relation ri_PartitionRoot; } ResultRelInfo; @@ -421,13 +441,8 @@ typedef struct EState /* Info about target table(s) for insert/update/delete queries: */ ResultRelInfo *es_result_relations; /* array of ResultRelInfos */ - int es_num_result_relations; /* length of array */ - ResultRelInfo *es_result_relation_info; /* currently active array elt */ -#ifdef PGXC -#ifndef PGXC - struct PlanState *es_result_remoterel; /* currently active remote rel */ -#endif -#endif + int es_num_result_relations; /* length of array */ + ResultRelInfo *es_result_relation_info; /* currently active array elt */ /* * Info about the target partitioned target table root(s) for @@ -440,16 +455,16 @@ typedef struct EState int es_num_root_result_relations; /* length of the array */ /* Stuff used for firing triggers: */ - List *es_trig_target_relations; /* trigger-only ResultRelInfos */ + List *es_trig_target_relations; /* trigger-only ResultRelInfos */ TupleTableSlot *es_trig_tuple_slot; /* for trigger output tuples */ - TupleTableSlot *es_trig_oldtup_slot; /* for TriggerEnabled */ - TupleTableSlot *es_trig_newtup_slot; /* for TriggerEnabled */ + TupleTableSlot *es_trig_oldtup_slot; /* for TriggerEnabled */ + TupleTableSlot *es_trig_newtup_slot; /* for TriggerEnabled */ /* Parameter info: */ ParamListInfo es_param_list_info; /* values of external params */ ParamExecData *es_param_exec_vals; /* values of internal params */ - QueryEnvironment *es_queryEnv; /* query environment */ + QueryEnvironment *es_queryEnv; /* query environment */ /* Other working state: */ MemoryContext es_query_cxt; /* per-query context in which EState lives */ @@ -467,9 +482,9 @@ typedef struct EState List *es_exprcontexts; /* List of ExprContexts within EState */ - List *es_subplanstates; /* List of PlanState for SubPlans */ + List *es_subplanstates; /* List of PlanState for SubPlans */ - List *es_auxmodifytables; /* List of secondary ModifyTableStates */ + List *es_auxmodifytables; /* List of secondary ModifyTableStates */ /* * this ExprContext is for per-output-tuple operations, such as constraint @@ -576,7 +591,7 @@ typedef struct TupleHashEntryData uint32 hash; /* hash value (cached) */ } TupleHashEntryData; -/* define paramters necessary to generate the tuple hash table interface */ +/* define parameters necessary to generate the tuple hash table interface */ #define SH_PREFIX tuplehash #define SH_ELEMENT_TYPE TupleHashEntryData #define SH_KEY_TYPE MinimalTuple @@ -600,7 +615,7 @@ typedef struct TupleHashTableData FmgrInfo *in_hash_funcs; /* hash functions for input datatype(s) */ FmgrInfo *cur_eq_funcs; /* equality functions for input vs. table */ uint32 hash_iv; /* hash-function IV */ -} TupleHashTableData; +} TupleHashTableData; typedef tuplehash_iterator TupleHashIterator; @@ -698,8 +713,7 @@ typedef struct SetExprState * output. If so, it's stored here. */ TupleDesc funcResultDesc; - bool funcReturnsTuple; /* valid when funcResultDesc isn't - * NULL */ + bool funcReturnsTuple; /* valid when funcResultDesc isn't NULL */ /* * Remember whether the function is declared to return a set. This is set @@ -791,7 +805,7 @@ typedef enum DomainConstraintType typedef struct DomainConstraintState { NodeTag type; - DomainConstraintType constrainttype; /* constraint type */ + DomainConstraintType constrainttype; /* constraint type */ char *name; /* name of constraint (for error msgs) */ Expr *check_expr; /* for CHECK, a boolean expression */ ExprState *check_exprstate; /* check_expr's eval state, or NULL */ @@ -914,7 +928,7 @@ typedef struct ProjectSetState Node **elems; /* array of expression states */ ExprDoneCond *elemdone; /* array of per-SRF is-done states */ int nelems; /* length of elemdone[] array */ - bool pending_srf_tuples; /* still evaluating srfs in tlist? */ + bool pending_srf_tuples; /* still evaluating srfs in tlist? */ } ProjectSetState; /* ---------------- @@ -933,26 +947,24 @@ typedef struct ModifyTableState #endif int mt_nplans; /* number of plans in the array */ int mt_whichplan; /* which one is being executed (0..n-1) */ - ResultRelInfo *resultRelInfo; /* per-subplan target relations */ + ResultRelInfo *resultRelInfo; /* per-subplan target relations */ ResultRelInfo *rootResultRelInfo; /* root target relation (partitioned * table root) */ List **mt_arowmarks; /* per-subplan ExecAuxRowMark lists */ EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */ bool fireBSTriggers; /* do we need to fire stmt triggers? */ - OnConflictAction mt_onconflict; /* ON CONFLICT type */ - List *mt_arbiterindexes; /* unique index OIDs to arbitrate - * taking alt path */ + OnConflictAction mt_onconflict; /* ON CONFLICT type */ + List *mt_arbiterindexes; /* unique index OIDs to arbitrate taking + * alt path */ TupleTableSlot *mt_existing; /* slot to store existing target tuple in */ - List *mt_excludedtlist; /* the excluded pseudo relation's - * tlist */ - TupleTableSlot *mt_conflproj; /* CONFLICT ... SET ... projection - * target */ + List *mt_excludedtlist; /* the excluded pseudo relation's tlist */ + TupleTableSlot *mt_conflproj; /* CONFLICT ... SET ... projection target */ struct PartitionDispatchData **mt_partition_dispatch_info; /* Tuple-routing support info */ int mt_num_dispatch; /* Number of entries in the above array */ - int mt_num_partitions; /* Number of members in the following - * arrays */ - ResultRelInfo *mt_partitions; /* Per partition result relation */ + int mt_num_partitions; /* Number of members in the following + * arrays */ + ResultRelInfo *mt_partitions; /* Per partition result relation */ TupleConversionMap **mt_partition_tupconv_maps; /* Per partition tuple conversion map */ TupleTableSlot *mt_partition_tuple_slot; @@ -1091,7 +1103,7 @@ typedef struct SampleScanState List *args; /* expr states for TABLESAMPLE params */ ExprState *repeatable; /* expr state for REPEATABLE expr */ /* use struct pointer to avoid including tsmapi.h here */ - struct TsmRoutine *tsmroutine; /* descriptor for tablesample method */ + struct TsmRoutine *tsmroutine; /* descriptor for tablesample method */ void *tsm_state; /* tablesample method can keep state here */ bool use_bulkread; /* use bulkread buffer access strategy? */ bool use_pagemode; /* use page-at-a-time visibility checking? */ @@ -1390,8 +1402,7 @@ typedef struct FunctionScanState bool simple; int64 ordinal; int nfuncs; - struct FunctionScanPerFuncState *funcstates; /* array of length - * nfuncs */ + struct FunctionScanPerFuncState *funcstates; /* array of length nfuncs */ MemoryContext argcontext; } FunctionScanState; @@ -1438,7 +1449,7 @@ typedef struct TableFuncScanState List *ns_uris; /* list of states of namespace uri exprs */ Bitmapset *notnulls; /* nullability flag for each output column */ void *opaque; /* table builder private space */ - const struct TableFuncRoutine *routine; /* table builder methods */ + const struct TableFuncRoutine *routine; /* table builder methods */ FmgrInfo *in_functions; /* input function for each column */ Oid *typioparams; /* typioparam for each column */ int64 ordinal; /* row number to be output next */ @@ -1510,7 +1521,7 @@ typedef struct WorkTableScanState typedef struct ForeignScanState { ScanState ss; /* its first field is NodeTag */ - ExprState *fdw_recheck_quals; /* original quals not in ss.ps.qual */ + ExprState *fdw_recheck_quals; /* original quals not in ss.ps.qual */ Size pscan_len; /* size of parallel coordination information */ /* use struct pointer to avoid including fdwapi.h here */ struct FdwRoutine *fdwroutine; @@ -1660,9 +1671,9 @@ typedef struct HashJoinState { JoinState js; /* its first field is NodeTag */ ExprState *hashclauses; - List *hj_OuterHashKeys; /* list of ExprState nodes */ - List *hj_InnerHashKeys; /* list of ExprState nodes */ - List *hj_HashOperators; /* list of operator OIDs */ + List *hj_OuterHashKeys; /* list of ExprState nodes */ + List *hj_InnerHashKeys; /* list of ExprState nodes */ + List *hj_HashOperators; /* list of operator OIDs */ HashJoinTable hj_HashTable; uint32 hj_CurHashValue; int hj_CurBucketNo; @@ -1764,14 +1775,13 @@ typedef struct AggState ExprContext **aggcontexts; /* econtexts for long-lived data (per GS) */ ExprContext *tmpcontext; /* econtext for input expressions */ ExprContext *curaggcontext; /* currently active aggcontext */ - AggStatePerTrans curpertrans; /* currently active trans state */ + AggStatePerTrans curpertrans; /* currently active trans state */ bool input_done; /* indicates end of input */ bool agg_done; /* indicates completion of Agg scan */ int projected_set; /* The last projected grouping set */ int current_set; /* The current grouping set being evaluated */ Bitmapset *grouped_cols; /* grouped cols in current projection */ - List *all_grouped_cols; /* list of all grouped cols in DESC - * order */ + List *all_grouped_cols; /* list of all grouped cols in DESC order */ /* These fields are for grouping set phase data */ int maxsets; /* The max number of sets in any phase */ AggStatePerPhase phases; /* array of all phases */ @@ -1820,15 +1830,14 @@ typedef struct WindowAggState int64 frameheadpos; /* current frame head position */ int64 frametailpos; /* current frame tail position */ /* use struct pointer to avoid including windowapi.h here */ - struct WindowObjectData *agg_winobj; /* winobj for aggregate - * fetches */ + struct WindowObjectData *agg_winobj; /* winobj for aggregate fetches */ int64 aggregatedbase; /* start row for current aggregates */ int64 aggregatedupto; /* rows before this one are aggregated */ int frameOptions; /* frame_clause options, see WindowDef */ ExprState *startOffset; /* expression for starting bound offset */ ExprState *endOffset; /* expression for ending bound offset */ - Datum startOffsetValue; /* result of startOffset evaluation */ + Datum startOffsetValue; /* result of startOffset evaluation */ Datum endOffsetValue; /* result of endOffset evaluation */ MemoryContext partcontext; /* context for partition-lifespan data */ @@ -1838,15 +1847,14 @@ typedef struct WindowAggState bool all_first; /* true if the scan is starting */ bool all_done; /* true if the scan is finished */ - bool partition_spooled; /* true if all tuples in current - * partition have been spooled into - * tuplestore */ - bool more_partitions;/* true if there's more partitions after this - * one */ - bool framehead_valid;/* true if frameheadpos is known up to date - * for current row */ - bool frametail_valid;/* true if frametailpos is known up to date - * for current row */ + bool partition_spooled; /* true if all tuples in current partition + * have been spooled into tuplestore */ + bool more_partitions; /* true if there's more partitions after + * this one */ + bool framehead_valid; /* true if frameheadpos is known up to + * date for current row */ + bool frametail_valid; /* true if frametailpos is known up to + * date for current row */ TupleTableSlot *first_part_slot; /* first tuple of current or next * partition */ @@ -1920,8 +1928,7 @@ typedef struct GatherMergeState bool need_to_scan_locally; int gm_nkeys; SortSupport gm_sortkeys; /* array of length ms_nkeys */ - struct GMReaderTupleBuffer *gm_tuple_buffers; /* tuple buffer per - * reader */ + struct GMReaderTupleBuffer *gm_tuple_buffers; /* tuple buffer per reader */ } GatherMergeState; /* ---------------- @@ -2017,4 +2024,4 @@ typedef struct LimitState TupleTableSlot *subSlot; /* tuple last obtained from subplan */ } LimitState; -#endif /* EXECNODES_H */ +#endif /* EXECNODES_H */ diff --git a/src/include/nodes/extensible.h b/src/include/nodes/extensible.h index 0b02cc18e9..7325bf536a 100644 --- a/src/include/nodes/extensible.h +++ b/src/include/nodes/extensible.h @@ -62,11 +62,11 @@ typedef struct ExtensibleNodeMethods const char *extnodename; Size node_size; void (*nodeCopy) (struct ExtensibleNode *newnode, - const struct ExtensibleNode *oldnode); + const struct ExtensibleNode *oldnode); bool (*nodeEqual) (const struct ExtensibleNode *a, - const struct ExtensibleNode *b); + const struct ExtensibleNode *b); void (*nodeOut) (struct StringInfoData *str, - const struct ExtensibleNode *node); + const struct ExtensibleNode *node); void (*nodeRead) (struct ExtensibleNode *node); } ExtensibleNodeMethods; @@ -91,12 +91,12 @@ typedef struct CustomPathMethods /* Convert Path to a Plan */ struct Plan *(*PlanCustomPath) (PlannerInfo *root, - RelOptInfo *rel, - struct CustomPath *best_path, - List *tlist, - List *clauses, - List *custom_plans); -} CustomPathMethods; + RelOptInfo *rel, + struct CustomPath *best_path, + List *tlist, + List *clauses, + List *custom_plans); +} CustomPathMethods; /* * Custom scan. Here again, there's not much to do: we need to be able to @@ -120,8 +120,8 @@ typedef struct CustomExecMethods /* Required executor methods */ void (*BeginCustomScan) (CustomScanState *node, - EState *estate, - int eflags); + EState *estate, + int eflags); TupleTableSlot *(*ExecCustomScan) (CustomScanState *node); void (*EndCustomScan) (CustomScanState *node); void (*ReScanCustomScan) (CustomScanState *node); @@ -132,23 +132,23 @@ typedef struct CustomExecMethods /* Optional methods: needed if parallel execution is supported */ Size (*EstimateDSMCustomScan) (CustomScanState *node, - ParallelContext *pcxt); + ParallelContext *pcxt); void (*InitializeDSMCustomScan) (CustomScanState *node, - ParallelContext *pcxt, - void *coordinate); + ParallelContext *pcxt, + void *coordinate); void (*InitializeWorkerCustomScan) (CustomScanState *node, - shm_toc *toc, - void *coordinate); + shm_toc *toc, + void *coordinate); void (*ShutdownCustomScan) (CustomScanState *node); /* Optional: print additional information in EXPLAIN */ void (*ExplainCustomScan) (CustomScanState *node, - List *ancestors, - ExplainState *es); + List *ancestors, + ExplainState *es); } CustomExecMethods; extern void RegisterCustomScanMethods(const CustomScanMethods *methods); extern const CustomScanMethods *GetCustomScanMethods(const char *CustomName, bool missing_ok); -#endif /* EXTENSIBLE_H */ +#endif /* EXTENSIBLE_H */ diff --git a/src/include/nodes/lockoptions.h b/src/include/nodes/lockoptions.h index 4f8affd930..e0981dac6f 100644 --- a/src/include/nodes/lockoptions.h +++ b/src/include/nodes/lockoptions.h @@ -43,4 +43,4 @@ typedef enum LockWaitPolicy LockWaitError } LockWaitPolicy; -#endif /* LOCKOPTIONS_H */ +#endif /* LOCKOPTIONS_H */ diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h index 53ea6598c8..46a79b1817 100644 --- a/src/include/nodes/makefuncs.h +++ b/src/include/nodes/makefuncs.h @@ -86,4 +86,4 @@ extern DefElem *makeDefElemExtended(char *nameSpace, char *name, Node *arg, extern GroupingSet *makeGroupingSet(GroupingSetKind kind, List *content, int location); -#endif /* MAKEFUNC_H */ +#endif /* MAKEFUNC_H */ diff --git a/src/include/nodes/memnodes.h b/src/include/nodes/memnodes.h index fe6bc903b3..7a0c6763df 100644 --- a/src/include/nodes/memnodes.h +++ b/src/include/nodes/memnodes.h @@ -63,7 +63,7 @@ typedef struct MemoryContextMethods Size (*get_chunk_space) (MemoryContext context, void *pointer); bool (*is_empty) (MemoryContext context); void (*stats) (MemoryContext context, int level, bool print, - MemoryContextCounters *totals); + MemoryContextCounters *totals); #ifdef MEMORY_CONTEXT_CHECKING void (*check) (MemoryContext context); #endif @@ -75,8 +75,8 @@ typedef struct MemoryContextData NodeTag type; /* identifies exact kind of context */ /* these two fields are placed here to minimize alignment wastage: */ bool isReset; /* T = no space alloced since last reset */ - bool allowInCritSection; /* allow palloc in critical section */ - MemoryContextMethods *methods; /* virtual function table */ + bool allowInCritSection; /* allow palloc in critical section */ + MemoryContextMethods *methods; /* virtual function table */ MemoryContext parent; /* NULL if no parent (toplevel context) */ MemoryContext firstchild; /* head of linked list of children */ MemoryContext prevchild; /* previous child of same parent */ @@ -98,4 +98,4 @@ typedef struct MemoryContextData ((context) != NULL && \ (IsA((context), AllocSetContext) || IsA((context), SlabContext))) -#endif /* MEMNODES_H */ +#endif /* MEMNODES_H */ diff --git a/src/include/nodes/nodeFuncs.h b/src/include/nodes/nodeFuncs.h index b6c9b48ee6..3366983936 100644 --- a/src/include/nodes/nodeFuncs.h +++ b/src/include/nodes/nodeFuncs.h @@ -17,13 +17,13 @@ /* flags bits for query_tree_walker and query_tree_mutator */ -#define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */ -#define QTW_IGNORE_CTE_SUBQUERIES 0x02 /* subqueries in cteList */ -#define QTW_IGNORE_RC_SUBQUERIES 0x03 /* both of above */ -#define QTW_IGNORE_JOINALIASES 0x04 /* JOIN alias var lists */ -#define QTW_IGNORE_RANGE_TABLE 0x08 /* skip rangetable entirely */ -#define QTW_EXAMINE_RTES 0x10 /* examine RTEs */ -#define QTW_DONT_COPY_QUERY 0x20 /* do not copy top Query */ +#define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */ +#define QTW_IGNORE_CTE_SUBQUERIES 0x02 /* subqueries in cteList */ +#define QTW_IGNORE_RC_SUBQUERIES 0x03 /* both of above */ +#define QTW_IGNORE_JOINALIASES 0x04 /* JOIN alias var lists */ +#define QTW_IGNORE_RANGE_TABLE 0x08 /* skip rangetable entirely */ +#define QTW_EXAMINE_RTES 0x10 /* examine RTEs */ +#define QTW_DONT_COPY_QUERY 0x20 /* do not copy top Query */ /* callback function for check_functions_in_node */ typedef bool (*check_function_callback) (Oid func_id, void *context); @@ -51,30 +51,30 @@ extern bool check_functions_in_node(Node *node, check_function_callback checker, void *context); extern bool expression_tree_walker(Node *node, bool (*walker) (), - void *context); + void *context); extern Node *expression_tree_mutator(Node *node, Node *(*mutator) (), - void *context); + void *context); extern bool query_tree_walker(Query *query, bool (*walker) (), - void *context, int flags); + void *context, int flags); extern Query *query_tree_mutator(Query *query, Node *(*mutator) (), - void *context, int flags); + void *context, int flags); extern bool range_table_walker(List *rtable, bool (*walker) (), - void *context, int flags); + void *context, int flags); extern List *range_table_mutator(List *rtable, Node *(*mutator) (), - void *context, int flags); + void *context, int flags); extern bool query_or_expression_tree_walker(Node *node, bool (*walker) (), - void *context, int flags); + void *context, int flags); extern Node *query_or_expression_tree_mutator(Node *node, Node *(*mutator) (), - void *context, int flags); + void *context, int flags); extern bool raw_expression_tree_walker(Node *node, bool (*walker) (), - void *context); + void *context); struct PlanState; extern bool planstate_tree_walker(struct PlanState *planstate, bool (*walker) (), - void *context); + void *context); -#endif /* NODEFUNCS_H */ +#endif /* NODEFUNCS_H */ diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index df93faed90..779947f0f6 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -596,7 +596,7 @@ extern PGDLLIMPORT Node *newNodeMacroHolder; newNodeMacroHolder->type = (tag), \ newNodeMacroHolder \ ) -#endif /* __GNUC__ */ +#endif /* __GNUC__ */ #define makeNode(_type_) ((_type_ *) newNode(sizeof(_type_),T_##_type_)) @@ -621,7 +621,7 @@ castNodeImpl(NodeTag type, void *ptr) #define castNode(_type_, nodeptr) ((_type_ *) castNodeImpl(T_##_type_, nodeptr)) #else #define castNode(_type_, nodeptr) ((_type_ *) (nodeptr)) -#endif /* USE_ASSERT_CHECKING */ +#endif /* USE_ASSERT_CHECKING */ /* ---------------------------------------------------------------- @@ -665,6 +665,7 @@ extern int16 *readAttrNumberCols(int numCols); * nodes/copyfuncs.c */ extern void *copyObjectImpl(const void *obj); + /* cast result back to argument type, if supported by compiler */ #ifdef HAVE_TYPEOF #define copyObject(obj) ((typeof(obj)) copyObjectImpl(obj)) @@ -857,4 +858,4 @@ typedef enum OnConflictAction ONCONFLICT_UPDATE /* ON CONFLICT ... DO UPDATE */ } OnConflictAction; -#endif /* NODES_H */ +#endif /* NODES_H */ diff --git a/src/include/nodes/params.h b/src/include/nodes/params.h index d9a48191f0..9297c91b4b 100644 --- a/src/include/nodes/params.h +++ b/src/include/nodes/params.h @@ -50,7 +50,7 @@ struct ParseState; * ---------------- */ -#define PARAM_FLAG_CONST 0x0001 /* parameter is constant */ +#define PARAM_FLAG_CONST 0x0001 /* parameter is constant */ typedef struct ParamExternData { @@ -75,7 +75,7 @@ typedef struct ParamListInfoData int numParams; /* number of ParamExternDatas following */ struct Bitmapset *paramMask; /* if non-NULL, can ignore omitted params */ ParamExternData params[FLEXIBLE_ARRAY_MEMBER]; -} ParamListInfoData; +} ParamListInfoData; /* ---------------- @@ -113,4 +113,4 @@ extern Size EstimateParamListSpace(ParamListInfo paramLI); extern void SerializeParamList(ParamListInfo paramLI, char **start_address); extern ParamListInfo RestoreParamList(char **start_address); -#endif /* PARAMS_H */ +#endif /* PARAMS_H */ diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index fb3684eb5c..fb8dbc871b 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -172,10 +172,9 @@ typedef struct Query List *constraintDeps; /* a list of pg_constraint OIDs that the query * depends on to be semantically valid */ - List *withCheckOptions; /* a list of WithCheckOption's, which - * are only added during rewrite and - * therefore are not written out as - * part of Query. */ + List *withCheckOptions; /* a list of WithCheckOption's, which are + * only added during rewrite and therefore + * are not written out as part of Query. */ /* * The following two fields identify the portion of the source text string @@ -357,7 +356,7 @@ typedef struct FuncCall List *args; /* the arguments (list of exprs) */ List *agg_order; /* ORDER BY (list of SortBy) */ Node *agg_filter; /* FILTER clause, if any */ - bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */ + bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */ bool agg_star; /* argument was really '*' */ bool agg_distinct; /* arguments were labeled DISTINCT */ bool func_variadic; /* last argument was labeled VARIADIC */ @@ -965,13 +964,13 @@ typedef struct RangeTblEntry */ Oid relid; /* OID of the relation */ char relkind; /* relation kind (see pg_class.relkind) */ - struct TableSampleClause *tablesample; /* sampling info, or NULL */ + struct TableSampleClause *tablesample; /* sampling info, or NULL */ /* * Fields valid for a subquery RTE (else NULL): */ Query *subquery; /* the sub-query */ - bool security_barrier; /* is from security_barrier view? */ + bool security_barrier; /* is from security_barrier view? */ /* * Fields valid for a join RTE (else NULL/zero): @@ -1026,11 +1025,11 @@ typedef struct RangeTblEntry * * We need these for CTE RTEs so that the types of self-referential * columns are well-defined. For VALUES RTEs, storing these explicitly - * saves having to re-determine the info by scanning the values_lists. - * For ENRs, we store the types explicitly here (we could get the - * information from the catalogs if 'relid' was supplied, but we'd still - * need these for TupleDesc-based ENRs, so we might as well always store - * the type info here). + * saves having to re-determine the info by scanning the values_lists. For + * ENRs, we store the types explicitly here (we could get the information + * from the catalogs if 'relid' was supplied, but we'd still need these + * for TupleDesc-based ENRs, so we might as well always store the type + * info here). */ List *coltypes; /* OID list of column type OIDs */ List *coltypmods; /* integer list of column typmods */ @@ -1084,7 +1083,7 @@ typedef struct RangeTblFunction List *funccolnames; /* column names (list of String) */ List *funccoltypes; /* OID list of column type OIDs */ List *funccoltypmods; /* integer list of column typmods */ - List *funccolcollations; /* OID list of column collation OIDs */ + List *funccolcollations; /* OID list of column collation OIDs */ /* This is set during planning for use by the executor: */ Bitmapset *funcparams; /* PARAM_EXEC Param IDs affecting this func */ } RangeTblFunction; @@ -1377,7 +1376,7 @@ typedef struct CommonTableExpr List *ctecolnames; /* list of output column names */ List *ctecoltypes; /* OID list of output column type OIDs */ List *ctecoltypmods; /* integer list of output column typmods */ - List *ctecolcollations; /* OID list of column collation OIDs */ + List *ctecolcollations; /* OID list of column collation OIDs */ } CommonTableExpr; /* Convenience macro to get the output tlist of a CTE's query */ @@ -1715,7 +1714,7 @@ typedef enum AlterTableType AT_ReAddConstraint, /* internal to commands/tablecmds.c */ AT_AlterConstraint, /* alter constraint */ AT_ValidateConstraint, /* validate constraint */ - AT_ValidateConstraintRecurse, /* internal to commands/tablecmds.c */ + AT_ValidateConstraintRecurse, /* internal to commands/tablecmds.c */ AT_ProcessedConstraint, /* pre-processed add constraint (local in * parser/parse_utilcmd.c) */ AT_AddIndexConstraint, /* add constraint using existing index */ @@ -1723,7 +1722,7 @@ typedef enum AlterTableType AT_DropConstraintRecurse, /* internal to commands/tablecmds.c */ AT_ReAddComment, /* internal to commands/tablecmds.c */ AT_AlterColumnType, /* alter column type */ - AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */ + AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */ AT_ChangeOwner, /* change owner */ AT_ClusterOn, /* CLUSTER ON */ AT_DropCluster, /* SET WITHOUT CLUSTER */ @@ -1882,9 +1881,9 @@ typedef struct ObjectWithArgs NodeTag type; List *objname; /* qualified name of function/operator */ List *objargs; /* list of Typename nodes */ - bool args_unspecified; /* argument list was omitted, so name - * must be unique (note that objargs - * == NIL means zero args) */ + bool args_unspecified; /* argument list was omitted, so name must + * be unique (note that objargs == NIL + * means zero args) */ } ObjectWithArgs; /* @@ -2008,7 +2007,7 @@ typedef struct CreateStmt List *tableElts; /* column definitions (list of ColumnDef) */ List *inhRelations; /* relations to inherit from (list of * inhRelation) */ - PartitionBoundSpec *partbound; /* FOR VALUES clause */ + PartitionBoundSpec *partbound; /* FOR VALUES clause */ PartitionSpec *partspec; /* PARTITION BY clause */ TypeName *ofTypename; /* OF typename */ List *constraints; /* constraints (list of Constraint nodes) */ @@ -2124,7 +2123,8 @@ typedef struct Constraint char fk_upd_action; /* ON UPDATE action */ char fk_del_action; /* ON DELETE action */ List *old_conpfeqop; /* pg_constraint.conpfeqop of my former self */ - Oid old_pktable_oid; /* pg_constraint.confrelid of my former self */ + Oid old_pktable_oid; /* pg_constraint.confrelid of my former + * self */ /* Fields used for constraints that allow a NOT VALID specification */ bool skip_validation; /* skip validation of existing rows? */ @@ -2996,7 +2996,7 @@ typedef struct AlterEnumStmt char *newVal; /* new enum value's name */ char *newValNeighbor; /* neighboring enum value, if specified */ bool newValIsAfter; /* place new enum value after neighbor? */ - bool skipIfNewValExists; /* no error if new already exists? */ + bool skipIfNewValExists; /* no error if new already exists? */ } AlterEnumStmt; /* ---------------------- @@ -3110,7 +3110,7 @@ typedef enum VacuumOption VACOPT_FULL = 1 << 4, /* FULL (non-concurrent) vacuum */ VACOPT_NOWAIT = 1 << 5, /* don't wait to get lock (autovacuum only) */ VACOPT_SKIPTOAST = 1 << 6, /* don't process the TOAST table, if any */ - VACOPT_DISABLE_PAGE_SKIPPING = 1 << 7, /* don't skip any pages */ + VACOPT_DISABLE_PAGE_SKIPPING = 1 << 7, /* don't skip any pages */ VACOPT_COORDINATOR = 1 << 8 /* don't trigger analyze on the datanodes, but * just collect existing info and populate * coordinator side stats. @@ -3311,7 +3311,7 @@ typedef struct ConstraintsSetStmt */ /* Reindex options */ -#define REINDEXOPT_VERBOSE 1 << 0 /* print progress info */ +#define REINDEXOPT_VERBOSE 1 << 0 /* print progress info */ typedef enum ReindexObjectType { @@ -3340,8 +3340,8 @@ typedef struct CreateConversionStmt { NodeTag type; List *conversion_name; /* Name of the conversion */ - char *for_encoding_name; /* source encoding name */ - char *to_encoding_name; /* destination encoding name */ + char *for_encoding_name; /* source encoding name */ + char *to_encoding_name; /* destination encoding name */ List *func_name; /* qualified conversion function name */ bool def; /* is this a default conversion? */ } CreateConversionStmt; @@ -3554,4 +3554,4 @@ typedef struct DropSubscriptionStmt DropBehavior behavior; /* RESTRICT or CASCADE behavior */ } DropSubscriptionStmt; -#endif /* PARSENODES_H */ +#endif /* PARSENODES_H */ diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h index 8395bb4322..feee49ae53 100644 --- a/src/include/nodes/pg_list.h +++ b/src/include/nodes/pg_list.h @@ -340,6 +340,6 @@ extern List *list_copy_tail(const List *list, int nskip); #define listCopy(list) list_copy(list) extern int length(List *list); -#endif /* ENABLE_LIST_COMPAT */ +#endif /* ENABLE_LIST_COMPAT */ -#endif /* PG_LIST_H */ +#endif /* PG_LIST_H */ diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index a4b9f18aa5..0fcc5607bb 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -57,7 +57,7 @@ typedef struct PlannedStmt bool dependsOnRole; /* is plan specific to current role? */ - bool parallelModeNeeded; /* parallel mode required to execute? */ + bool parallelModeNeeded; /* parallel mode required to execute? */ struct Plan *planTree; /* tree of Plan nodes */ @@ -235,7 +235,7 @@ typedef struct ModifyTable List *partitioned_rels; List *resultRelations; /* integer list of RT indexes */ int resultRelIndex; /* index of first resultRel in plan's list */ - int rootResultRelIndex; /* index of the partitioned table root */ + int rootResultRelIndex; /* index of the partitioned table root */ List *plans; /* plan(s) producing source data */ List *withCheckOptionLists; /* per-target-table WCO lists */ List *returningLists; /* per-target-table RETURNING tlists */ @@ -404,7 +404,7 @@ typedef struct IndexScan List *indexqual; /* list of index quals (usually OpExprs) */ List *indexqualorig; /* the same in original form */ List *indexorderby; /* list of index ORDER BY exprs */ - List *indexorderbyorig; /* the same in original form */ + List *indexorderbyorig; /* the same in original form */ List *indexorderbyops; /* OIDs of sort ops for ORDER BY exprs */ ScanDirection indexorderdir; /* forward or backward or don't care */ } IndexScan; @@ -614,8 +614,7 @@ typedef struct ForeignScan List *fdw_exprs; /* expressions that FDW may evaluate */ List *fdw_private; /* private data for FDW */ List *fdw_scan_tlist; /* optional tlist describing scan tuple */ - List *fdw_recheck_quals; /* original quals not in - * scan.plan.qual */ + List *fdw_recheck_quals; /* original quals not in scan.plan.qual */ Bitmapset *fs_relids; /* RTIs generated by this scan */ bool fsSystemCol; /* true if any "system column" is needed */ } ForeignScan; @@ -643,8 +642,7 @@ typedef struct CustomScan List *custom_plans; /* list of Plan nodes, if any */ List *custom_exprs; /* expressions that custom code may evaluate */ List *custom_private; /* private data for custom code */ - List *custom_scan_tlist; /* optional tlist describing scan - * tuple */ + List *custom_scan_tlist; /* optional tlist describing scan tuple */ Bitmapset *custom_relids; /* RTIs generated by this scan */ const struct CustomScanMethods *methods; } CustomScan; @@ -723,7 +721,7 @@ typedef struct NestLoopParam typedef struct MergeJoin { Join join; - bool skip_mark_restore; /* Can we skip mark/restore calls? */ + bool skip_mark_restore; /* Can we skip mark/restore calls? */ List *mergeclauses; /* mergeclauses as expression trees */ /* these are arrays, but have the same length as the mergeclauses list: */ Oid *mergeFamilies; /* per-clause OIDs of btree opfamilies */ @@ -1044,4 +1042,4 @@ typedef struct PlanInvalItem uint32 hashValue; /* hash value of object's cache lookup key */ } PlanInvalItem; -#endif /* PLANNODES_H */ +#endif /* PLANNODES_H */ diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 66dd6b50e4..72bd50ac3e 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -156,9 +156,9 @@ typedef struct Expr * are very useful for debugging and interpreting completed plans, so we keep * them around. */ -#define INNER_VAR 65000 /* reference to inner subplan */ -#define OUTER_VAR 65001 /* reference to outer subplan */ -#define INDEX_VAR 65002 /* reference to index column */ +#define INNER_VAR 65000 /* reference to inner subplan */ +#define OUTER_VAR 65001 /* reference to outer subplan */ +#define INDEX_VAR 65002 /* reference to index column */ #define IS_SPECIAL_VARNO(varno) ((varno) >= INNER_VAR) @@ -410,10 +410,11 @@ typedef struct ArrayRef Oid refelemtype; /* type of the array elements */ int32 reftypmod; /* typmod of the array (and elements too) */ Oid refcollid; /* OID of collation, or InvalidOid if none */ - List *refupperindexpr;/* expressions that evaluate to upper array - * indexes */ - List *reflowerindexpr;/* expressions that evaluate to lower array - * indexes, or NIL for single array element */ + List *refupperindexpr; /* expressions that evaluate to upper + * array indexes */ + List *reflowerindexpr; /* expressions that evaluate to lower + * array indexes, or NIL for single array + * element */ Expr *refexpr; /* the expression that evaluates to an array * value */ Expr *refassgnexpr; /* expression for the source value, or NULL if @@ -701,8 +702,8 @@ typedef struct SubPlan /* Extra data useful for determining subplan's output type: */ Oid firstColType; /* Type of first column of subplan result */ int32 firstColTypmod; /* Typmod of first column of subplan result */ - Oid firstColCollation; /* Collation of first column of - * subplan result */ + Oid firstColCollation; /* Collation of first column of subplan + * result */ /* Information about execution strategy: */ bool useHashTable; /* TRUE to store subselect output in a hash * table (implies we are doing "IN") */ @@ -1377,8 +1378,8 @@ typedef struct TargetEntry Expr *expr; /* expression to evaluate */ AttrNumber resno; /* attribute number (see notes above) */ char *resname; /* name of the column (could be NULL) */ - Index ressortgroupref;/* nonzero if referenced by a sort/group - * clause */ + Index ressortgroupref; /* nonzero if referenced by a sort/group + * clause */ Oid resorigtbl; /* OID of column's source table */ AttrNumber resorigcol; /* column's number in source table */ bool resjunk; /* set to true to eliminate the attribute from @@ -1559,4 +1560,4 @@ typedef struct OnConflictExpr List *exclRelTlist; /* tlist of the EXCLUDED pseudo relation */ } OnConflictExpr; -#endif /* PRIMNODES_H */ +#endif /* PRIMNODES_H */ diff --git a/src/include/nodes/print.h b/src/include/nodes/print.h index 4c94a3afe5..fa01c2ad84 100644 --- a/src/include/nodes/print.h +++ b/src/include/nodes/print.h @@ -31,4 +31,4 @@ extern void print_pathkeys(const List *pathkeys, const List *rtable); extern void print_tl(const List *tlist, const List *rtable); extern void print_slot(TupleTableSlot *slot); -#endif /* PRINT_H */ +#endif /* PRINT_H */ diff --git a/src/include/nodes/readfuncs.h b/src/include/nodes/readfuncs.h index ca540baf02..c80fae2311 100644 --- a/src/include/nodes/readfuncs.h +++ b/src/include/nodes/readfuncs.h @@ -28,4 +28,4 @@ extern void *nodeRead(char *token, int tok_len); */ extern Node *parseNodeString(void); -#endif /* READFUNCS_H */ +#endif /* READFUNCS_H */ diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 1e7e6942d5..d3d2f33ff3 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -148,9 +148,9 @@ typedef struct PlannerGlobal bool parallelModeOK; /* parallel mode potentially OK? */ - bool parallelModeNeeded; /* parallel mode actually required? */ + bool parallelModeNeeded; /* parallel mode actually required? */ - char maxParallelHazard; /* worst PROPARALLEL hazard level */ + char maxParallelHazard; /* worst PROPARALLEL hazard level */ } PlannerGlobal; /* macro for fetching the Plan associated with a SubPlan node */ @@ -196,7 +196,7 @@ typedef struct PlannerInfo * does not correspond to a base relation, such as a join RTE or an * unreferenced view RTE; or if the RelOptInfo hasn't been made yet. */ - struct RelOptInfo **simple_rel_array; /* All 1-rel RelOptInfos */ + struct RelOptInfo **simple_rel_array; /* All 1-rel RelOptInfos */ int simple_rel_array_size; /* allocated size of array */ /* @@ -249,23 +249,23 @@ typedef struct PlannerInfo List *cte_plan_ids; /* per-CTE-item list of subplan IDs */ - List *multiexpr_params; /* List of Lists of Params for - * MULTIEXPR subquery outputs */ + List *multiexpr_params; /* List of Lists of Params for MULTIEXPR + * subquery outputs */ List *eq_classes; /* list of active EquivalenceClasses */ List *canon_pathkeys; /* list of "canonical" PathKeys */ - List *left_join_clauses; /* list of RestrictInfos for - * mergejoinable outer join clauses - * w/nonnullable var on left */ + List *left_join_clauses; /* list of RestrictInfos for mergejoinable + * outer join clauses w/nonnullable var on + * left */ - List *right_join_clauses; /* list of RestrictInfos for - * mergejoinable outer join clauses - * w/nonnullable var on right */ + List *right_join_clauses; /* list of RestrictInfos for mergejoinable + * outer join clauses w/nonnullable var on + * right */ - List *full_join_clauses; /* list of RestrictInfos for - * mergejoinable full join clauses */ + List *full_join_clauses; /* list of RestrictInfos for mergejoinable + * full join clauses */ List *join_info_list; /* list of SpecialJoinInfos */ @@ -275,7 +275,7 @@ typedef struct PlannerInfo List *rowMarks; /* list of PlanRowMarks */ - List *placeholder_list; /* list of PlaceHolderInfos */ + List *placeholder_list; /* list of PlaceHolderInfos */ List *fkey_list; /* list of ForeignKeyOptInfos */ @@ -283,7 +283,7 @@ typedef struct PlannerInfo List *group_pathkeys; /* groupClause pathkeys, if any */ List *window_pathkeys; /* pathkeys of bottom window, if any */ - List *distinct_pathkeys; /* distinctClause pathkeys, if any */ + List *distinct_pathkeys; /* distinctClause pathkeys, if any */ List *sort_pathkeys; /* sortClause pathkeys, if any */ List *initial_rels; /* RelOptInfos we are now trying to join */ @@ -306,7 +306,7 @@ typedef struct PlannerInfo MemoryContext planner_cxt; /* context holding PlannerInfo */ - double total_table_pages; /* # of pages in all tables of query */ + double total_table_pages; /* # of pages in all tables of query */ double tuple_fraction; /* tuple_fraction passed to query_planner */ double limit_tuples; /* limit_tuples passed to query_planner */ @@ -314,8 +314,8 @@ typedef struct PlannerInfo Index qual_security_level; /* minimum security_level for quals */ /* Note: qual_security_level is zero if there are no securityQuals */ - bool hasInheritedTarget; /* true if parse->resultRelation is an - * inheritance child rel */ + bool hasInheritedTarget; /* true if parse->resultRelation is an + * inheritance child rel */ bool hasJoinRTEs; /* true if any RTEs are RTE_JOIN kind */ bool hasLateralRTEs; /* true if any RTEs are marked LATERAL */ bool hasDeletedRTEs; /* true if any RTE was deleted from jointree */ @@ -560,17 +560,17 @@ typedef struct RelOptInfo double rows; /* estimated number of result tuples */ /* per-relation planner control flags */ - bool consider_startup; /* keep cheap-startup-cost paths? */ + bool consider_startup; /* keep cheap-startup-cost paths? */ bool consider_param_startup; /* ditto, for parameterized paths? */ - bool consider_parallel; /* consider parallel paths? */ + bool consider_parallel; /* consider parallel paths? */ /* default result targetlist for Paths scanning this relation */ - struct PathTarget *reltarget; /* list of Vars/Exprs, cost, width */ + struct PathTarget *reltarget; /* list of Vars/Exprs, cost, width */ /* materialization information */ List *pathlist; /* Path structures */ List *ppilist; /* ParamPathInfos used in pathlist */ - List *partial_pathlist; /* partial Paths */ + List *partial_pathlist; /* partial Paths */ struct Path *cheapest_startup_path; struct Path *cheapest_total_path; struct Path *cheapest_unique_path; @@ -609,21 +609,21 @@ typedef struct RelOptInfo void *fdw_private; /* cache space for remembering if we have proven this relation unique */ - List *unique_for_rels; /* known unique for these other relid set(s) */ + List *unique_for_rels; /* known unique for these other relid + * set(s) */ List *non_unique_for_rels; /* known not unique for these set(s) */ /* used by various scans and joins: */ - List *baserestrictinfo; /* RestrictInfo structures (if base - * rel) */ - QualCost baserestrictcost; /* cost of evaluating the above */ - Index baserestrict_min_security; /* min security_level found in - * baserestrictinfo */ + List *baserestrictinfo; /* RestrictInfo structures (if base rel) */ + QualCost baserestrictcost; /* cost of evaluating the above */ + Index baserestrict_min_security; /* min security_level found in + * baserestrictinfo */ List *joininfo; /* RestrictInfo structures for join clauses * involving this rel */ - bool has_eclass_joins; /* T means joininfo is incomplete */ + bool has_eclass_joins; /* T means joininfo is incomplete */ /* used by "other" relations */ - Relids top_parent_relids; /* Relids of topmost parents */ + Relids top_parent_relids; /* Relids of topmost parents */ } RelOptInfo; /* @@ -687,10 +687,11 @@ typedef struct IndexOptInfo List *indextlist; /* targetlist representing index columns */ - List *indrestrictinfo;/* parent relation's baserestrictinfo list, - * less any conditions implied by the index's - * predicate (unless it's a target rel, see - * comments in check_index_predicates()) */ + List *indrestrictinfo; /* parent relation's baserestrictinfo + * list, less any conditions implied by + * the index's predicate (unless it's a + * target rel, see comments in + * check_index_predicates()) */ bool predOK; /* true if index predicate matches query */ bool unique; /* true if a unique index */ @@ -726,8 +727,8 @@ typedef struct ForeignKeyOptInfo Index ref_relid; /* RT index of the referenced table */ int nkeys; /* number of columns in the foreign key */ AttrNumber conkey[INDEX_MAX_KEYS]; /* cols in referencing table */ - AttrNumber confkey[INDEX_MAX_KEYS]; /* cols in referenced table */ - Oid conpfeqop[INDEX_MAX_KEYS]; /* PK = FK operator OIDs */ + AttrNumber confkey[INDEX_MAX_KEYS]; /* cols in referenced table */ + Oid conpfeqop[INDEX_MAX_KEYS]; /* PK = FK operator OIDs */ /* Derived info about whether FK's equality conditions match the query: */ int nmatched_ec; /* # of FK cols matched by ECs */ @@ -852,7 +853,7 @@ typedef struct EquivalenceMember Expr *em_expr; /* the expression represented */ Relids em_relids; /* all relids appearing in em_expr */ - Relids em_nullable_relids; /* nullable by lower outer joins */ + Relids em_nullable_relids; /* nullable by lower outer joins */ bool em_is_const; /* expression is pseudoconstant? */ bool em_is_child; /* derived version for a child relation? */ Oid em_datatype; /* the "nominal type" used by the opfamily */ @@ -989,8 +990,7 @@ typedef struct Path bool parallel_aware; /* engage parallel-aware logic? */ bool parallel_safe; /* OK to use as part of parallel plan? */ - int parallel_workers; /* desired # of workers; 0 = not - * parallel */ + int parallel_workers; /* desired # of workers; 0 = not parallel */ /* estimated size/costs for path (see costsize.c for more info) */ double rows; /* estimated number of result tuples */ @@ -1339,7 +1339,7 @@ typedef struct JoinPath Path *outerjoinpath; /* path for the outer side of the join */ Path *innerjoinpath; /* path for the inner side of the join */ - List *joinrestrictinfo; /* RestrictInfos to apply to join */ + List *joinrestrictinfo; /* RestrictInfos to apply to join */ #ifdef XCP List *movedrestrictinfo; /* RestrictInfos moved down to inner path */ @@ -1396,11 +1396,11 @@ typedef JoinPath NestPath; typedef struct MergePath { JoinPath jpath; - List *path_mergeclauses; /* join clauses to be used for merge */ + List *path_mergeclauses; /* join clauses to be used for merge */ List *outersortkeys; /* keys for explicit sort, if any */ List *innersortkeys; /* keys for explicit sort, if any */ - bool skip_mark_restore; /* can executor skip mark/restore? */ - bool materialize_inner; /* add Materialize to inner? */ + bool skip_mark_restore; /* can executor skip mark/restore? */ + bool materialize_inner; /* add Materialize to inner? */ } MergePath; /* @@ -1415,7 +1415,7 @@ typedef struct MergePath typedef struct HashPath { JoinPath jpath; - List *path_hashclauses; /* join clauses used for hashing */ + List *path_hashclauses; /* join clauses used for hashing */ int num_batches; /* number of batches expected */ } HashPath; @@ -1795,7 +1795,7 @@ typedef struct RestrictInfo bool is_pushed_down; /* TRUE if clause was pushed down in level */ - bool outerjoin_delayed; /* TRUE if delayed by lower outer join */ + bool outerjoin_delayed; /* TRUE if delayed by lower outer join */ bool can_join; /* see comment above */ @@ -1849,11 +1849,11 @@ typedef struct RestrictInfo bool outer_is_left; /* T = outer var on left, F = on right */ /* valid if clause is hashjoinable, else InvalidOid: */ - Oid hashjoinoperator; /* copy of clause operator */ + Oid hashjoinoperator; /* copy of clause operator */ /* cache space for hashclause processing; -1 if not yet set */ Selectivity left_bucketsize; /* avg bucketsize of left side */ - Selectivity right_bucketsize; /* avg bucketsize of right side */ + Selectivity right_bucketsize; /* avg bucketsize of right side */ } RestrictInfo; /* @@ -1967,7 +1967,7 @@ typedef struct SpecialJoinInfo Relids syn_righthand; /* base relids syntactically within RHS */ JoinType jointype; /* always INNER, LEFT, FULL, SEMI, or ANTI */ bool lhs_strict; /* joinclause is strict for some LHS rel */ - bool delay_upper_joins; /* can't commute with upper RHS */ + bool delay_upper_joins; /* can't commute with upper RHS */ /* Remaining fields are set only for JOIN_SEMI jointype: */ bool semi_can_btree; /* true if semi_operators are all btree */ bool semi_can_hash; /* true if semi_operators are all hash */ @@ -2268,4 +2268,4 @@ typedef struct JoinCostWorkspace int numbatches; } JoinCostWorkspace; -#endif /* RELATION_H */ +#endif /* RELATION_H */ diff --git a/src/include/nodes/replnodes.h b/src/include/nodes/replnodes.h index 92ada41b6d..dea61e90e9 100644 --- a/src/include/nodes/replnodes.h +++ b/src/include/nodes/replnodes.h @@ -105,4 +105,4 @@ typedef struct SQLCmd NodeTag type; } SQLCmd; -#endif /* REPLNODES_H */ +#endif /* REPLNODES_H */ diff --git a/src/include/nodes/tidbitmap.h b/src/include/nodes/tidbitmap.h index 87f4bb7c91..f9a1902da8 100644 --- a/src/include/nodes/tidbitmap.h +++ b/src/include/nodes/tidbitmap.h @@ -71,4 +71,4 @@ extern void tbm_end_shared_iterate(TBMSharedIterator *iterator); extern TBMSharedIterator *tbm_attach_shared_iterate(dsa_area *dsa, dsa_pointer dp); -#endif /* TIDBITMAP_H */ +#endif /* TIDBITMAP_H */ diff --git a/src/include/nodes/value.h b/src/include/nodes/value.h index ede97b7bcd..83f5a19fe9 100644 --- a/src/include/nodes/value.h +++ b/src/include/nodes/value.h @@ -58,4 +58,4 @@ extern Value *makeFloat(char *numericStr); extern Value *makeString(char *str); extern Value *makeBitString(char *str); -#endif /* VALUE_H */ +#endif /* VALUE_H */ diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h index cc0d7b0a26..e3672218f3 100644 --- a/src/include/optimizer/clauses.h +++ b/src/include/optimizer/clauses.h @@ -85,4 +85,4 @@ extern Node *estimate_expression_value(PlannerInfo *root, Node *node); extern Query *inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte); -#endif /* CLAUSES_H */ +#endif /* CLAUSES_H */ diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 2701500a4a..da34133a12 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -40,8 +40,8 @@ typedef enum { CONSTRAINT_EXCLUSION_OFF, /* do not use c_e */ CONSTRAINT_EXCLUSION_ON, /* apply c_e to all rels */ - CONSTRAINT_EXCLUSION_PARTITION /* apply c_e to otherrels only */ -} ConstraintExclusionType; + CONSTRAINT_EXCLUSION_PARTITION /* apply c_e to otherrels only */ +} ConstraintExclusionType; /* @@ -207,7 +207,7 @@ extern void set_namedtuplestore_size_estimates(PlannerInfo *root, RelOptInfo *re extern void set_foreign_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern PathTarget *set_pathtarget_cost_width(PlannerInfo *root, PathTarget *target); extern double compute_bitmap_pages(PlannerInfo *root, RelOptInfo *baserel, - Path *bitmapqual, int loop_count, Cost *cost, double *tuple); + Path *bitmapqual, int loop_count, Cost *cost, double *tuple); /* * prototypes for clausesel.c @@ -228,4 +228,4 @@ extern void cost_gather_merge(GatherMergePath *path, PlannerInfo *root, Cost input_startup_cost, Cost input_total_cost, double *rows); -#endif /* COST_H */ +#endif /* COST_H */ diff --git a/src/include/optimizer/geqo.h b/src/include/optimizer/geqo.h index be65c054e1..d0158d7adf 100644 --- a/src/include/optimizer/geqo.h +++ b/src/include/optimizer/geqo.h @@ -73,7 +73,7 @@ extern double Geqo_seed; /* 0 .. 1 */ typedef struct { List *initial_rels; /* the base relations we are joining */ - unsigned short random_state[3]; /* state for pg_erand48() */ + unsigned short random_state[3]; /* state for pg_erand48() */ } GeqoPrivateData; @@ -85,4 +85,4 @@ extern RelOptInfo *geqo(PlannerInfo *root, extern Cost geqo_eval(PlannerInfo *root, Gene *tour, int num_gene); extern RelOptInfo *gimme_tree(PlannerInfo *root, Gene *tour, int num_gene); -#endif /* GEQO_H */ +#endif /* GEQO_H */ diff --git a/src/include/optimizer/geqo_copy.h b/src/include/optimizer/geqo_copy.h index 3cbaf3e4ca..4035b4ff13 100644 --- a/src/include/optimizer/geqo_copy.h +++ b/src/include/optimizer/geqo_copy.h @@ -27,4 +27,4 @@ extern void geqo_copy(PlannerInfo *root, Chromosome *chromo1, Chromosome *chromo2, int string_length); -#endif /* GEQO_COPY_H */ +#endif /* GEQO_COPY_H */ diff --git a/src/include/optimizer/geqo_gene.h b/src/include/optimizer/geqo_gene.h index f936ebdd89..3282193284 100644 --- a/src/include/optimizer/geqo_gene.h +++ b/src/include/optimizer/geqo_gene.h @@ -42,4 +42,4 @@ typedef struct Pool int string_length; } Pool; -#endif /* GEQO_GENE_H */ +#endif /* GEQO_GENE_H */ diff --git a/src/include/optimizer/geqo_misc.h b/src/include/optimizer/geqo_misc.h index 880bd0e140..89f91b3a4d 100644 --- a/src/include/optimizer/geqo_misc.h +++ b/src/include/optimizer/geqo_misc.h @@ -29,6 +29,6 @@ extern void print_pool(FILE *fp, Pool *pool, int start, int stop); extern void print_gen(FILE *fp, Pool *pool, int generation); extern void print_edge_table(FILE *fp, Edge *edge_table, int num_gene); -#endif /* GEQO_DEBUG */ +#endif /* GEQO_DEBUG */ -#endif /* GEQO_MISC_H */ +#endif /* GEQO_MISC_H */ diff --git a/src/include/optimizer/geqo_mutation.h b/src/include/optimizer/geqo_mutation.h index 85781c3c31..c5a94e03cf 100644 --- a/src/include/optimizer/geqo_mutation.h +++ b/src/include/optimizer/geqo_mutation.h @@ -27,4 +27,4 @@ extern void geqo_mutation(PlannerInfo *root, Gene *tour, int num_gene); -#endif /* GEQO_MUTATION_H */ +#endif /* GEQO_MUTATION_H */ diff --git a/src/include/optimizer/geqo_pool.h b/src/include/optimizer/geqo_pool.h index 7947b6e5bb..9fac307d69 100644 --- a/src/include/optimizer/geqo_pool.h +++ b/src/include/optimizer/geqo_pool.h @@ -37,4 +37,4 @@ extern void spread_chromo(PlannerInfo *root, Chromosome *chromo, Pool *pool); extern void sort_pool(PlannerInfo *root, Pool *pool); -#endif /* GEQO_POOL_H */ +#endif /* GEQO_POOL_H */ diff --git a/src/include/optimizer/geqo_random.h b/src/include/optimizer/geqo_random.h index 5312589387..2665a096b3 100644 --- a/src/include/optimizer/geqo_random.h +++ b/src/include/optimizer/geqo_random.h @@ -38,4 +38,4 @@ extern double geqo_rand(PlannerInfo *root); #define geqo_randint(root, upper, lower) \ ( (int) floor( geqo_rand(root)*(((upper)-(lower))+0.999999) ) + (lower) ) -#endif /* GEQO_RANDOM_H */ +#endif /* GEQO_RANDOM_H */ diff --git a/src/include/optimizer/geqo_recombination.h b/src/include/optimizer/geqo_recombination.h index 8ddde22296..8a436b9ec2 100644 --- a/src/include/optimizer/geqo_recombination.h +++ b/src/include/optimizer/geqo_recombination.h @@ -86,4 +86,4 @@ extern void ox1(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring, extern void ox2(PlannerInfo *root, Gene *mom, Gene *dad, Gene *offspring, int num_gene, City *city_table); -#endif /* GEQO_RECOMBINATION_H */ +#endif /* GEQO_RECOMBINATION_H */ diff --git a/src/include/optimizer/geqo_selection.h b/src/include/optimizer/geqo_selection.h index 1aecf14ac1..69ce2b4b8a 100644 --- a/src/include/optimizer/geqo_selection.h +++ b/src/include/optimizer/geqo_selection.h @@ -30,4 +30,4 @@ extern void geqo_selection(PlannerInfo *root, Chromosome *momma, Chromosome *daddy, Pool *pool, double bias); -#endif /* GEQO_SELECTION_H */ +#endif /* GEQO_SELECTION_H */ diff --git a/src/include/optimizer/joininfo.h b/src/include/optimizer/joininfo.h index c9a8b53f1f..4450d81408 100644 --- a/src/include/optimizer/joininfo.h +++ b/src/include/optimizer/joininfo.h @@ -27,4 +27,4 @@ extern void remove_join_clause_from_rels(PlannerInfo *root, RestrictInfo *restrictinfo, Relids join_relids); -#endif /* JOININFO_H */ +#endif /* JOININFO_H */ diff --git a/src/include/optimizer/orclauses.h b/src/include/optimizer/orclauses.h index 2512ddee8f..a3d8e1d9f9 100644 --- a/src/include/optimizer/orclauses.h +++ b/src/include/optimizer/orclauses.h @@ -18,4 +18,4 @@ extern void extract_restriction_or_clauses(PlannerInfo *root); -#endif /* ORCLAUSES_H */ +#endif /* ORCLAUSES_H */ diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h index 7937deebda..daf427a838 100644 --- a/src/include/optimizer/pathnode.h +++ b/src/include/optimizer/pathnode.h @@ -290,4 +290,4 @@ extern ParamPathInfo *get_joinrel_parampathinfo(PlannerInfo *root, extern ParamPathInfo *get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer); -#endif /* PATHNODE_H */ +#endif /* PATHNODE_H */ diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index a216f9e912..4e06b2e299 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -27,24 +27,24 @@ extern int min_parallel_index_scan_size; /* Hook for plugins to get control in set_rel_pathlist() */ typedef void (*set_rel_pathlist_hook_type) (PlannerInfo *root, - RelOptInfo *rel, - Index rti, - RangeTblEntry *rte); + RelOptInfo *rel, + Index rti, + RangeTblEntry *rte); extern PGDLLIMPORT set_rel_pathlist_hook_type set_rel_pathlist_hook; /* Hook for plugins to get control in add_paths_to_joinrel() */ typedef void (*set_join_pathlist_hook_type) (PlannerInfo *root, - RelOptInfo *joinrel, - RelOptInfo *outerrel, - RelOptInfo *innerrel, - JoinType jointype, - JoinPathExtraData *extra); + RelOptInfo *joinrel, + RelOptInfo *outerrel, + RelOptInfo *innerrel, + JoinType jointype, + JoinPathExtraData *extra); extern PGDLLIMPORT set_join_pathlist_hook_type set_join_pathlist_hook; /* Hook for plugins to replace standard_join_search() */ typedef RelOptInfo *(*join_search_hook_type) (PlannerInfo *root, - int levels_needed, - List *initial_rels); + int levels_needed, + List *initial_rels); extern PGDLLIMPORT join_search_hook_type join_search_hook; @@ -117,10 +117,10 @@ extern bool have_dangerous_phv(PlannerInfo *root, * routines for managing EquivalenceClasses */ typedef bool (*ec_matches_callback_type) (PlannerInfo *root, - RelOptInfo *rel, - EquivalenceClass *ec, - EquivalenceMember *em, - void *arg); + RelOptInfo *rel, + EquivalenceClass *ec, + EquivalenceMember *em, + void *arg); extern bool process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo, bool below_outer_join); @@ -228,4 +228,4 @@ extern PathKey *make_canonical_pathkey(PlannerInfo *root, EquivalenceClass *eclass, Oid opfamily, int strategy, bool nulls_first); -#endif /* PATHS_H */ +#endif /* PATHS_H */ diff --git a/src/include/optimizer/placeholder.h b/src/include/optimizer/placeholder.h index 11e6403aa3..5a4d46ba9d 100644 --- a/src/include/optimizer/placeholder.h +++ b/src/include/optimizer/placeholder.h @@ -29,4 +29,4 @@ extern void add_placeholders_to_base_rels(PlannerInfo *root); extern void add_placeholders_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel); -#endif /* PLACEHOLDER_H */ +#endif /* PLACEHOLDER_H */ diff --git a/src/include/optimizer/plancat.h b/src/include/optimizer/plancat.h index 68fd713b09..71f0faf938 100644 --- a/src/include/optimizer/plancat.h +++ b/src/include/optimizer/plancat.h @@ -19,9 +19,9 @@ /* Hook for plugins to get control in get_relation_info() */ typedef void (*get_relation_info_hook_type) (PlannerInfo *root, - Oid relationObjectId, - bool inhparent, - RelOptInfo *rel); + Oid relationObjectId, + bool inhparent, + RelOptInfo *rel); extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook; @@ -57,4 +57,4 @@ extern Selectivity join_selectivity(PlannerInfo *root, extern bool has_row_triggers(PlannerInfo *root, Index rti, CmdType event); -#endif /* PLANCAT_H */ +#endif /* PLANCAT_H */ diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h index 4ef9ddb2ba..9068b03666 100644 --- a/src/include/optimizer/planmain.h +++ b/src/include/optimizer/planmain.h @@ -27,7 +27,7 @@ typedef enum FORCE_PARALLEL_OFF, FORCE_PARALLEL_ON, FORCE_PARALLEL_REGRESS -} ForceParallelMode; +} ForceParallelMode; /* GUC parameters */ #define DEFAULT_CURSOR_TUPLE_FRACTION 0.1 @@ -130,4 +130,4 @@ extern void extract_query_dependencies(Node *query, List **invalItems, bool *hasRowSecurity); -#endif /* PLANMAIN_H */ +#endif /* PLANMAIN_H */ diff --git a/src/include/optimizer/planner.h b/src/include/optimizer/planner.h index 99ddafb4f3..a59625cd27 100644 --- a/src/include/optimizer/planner.h +++ b/src/include/optimizer/planner.h @@ -20,15 +20,15 @@ /* Hook for plugins to get control in planner() */ typedef PlannedStmt *(*planner_hook_type) (Query *parse, - int cursorOptions, - ParamListInfo boundParams); + int cursorOptions, + ParamListInfo boundParams); extern PGDLLIMPORT planner_hook_type planner_hook; /* Hook for plugins to get control when grouping_planner() plans upper rels */ typedef void (*create_upper_paths_hook_type) (PlannerInfo *root, - UpperRelationKind stage, - RelOptInfo *input_rel, - RelOptInfo *output_rel); + UpperRelationKind stage, + RelOptInfo *input_rel, + RelOptInfo *output_rel); extern PGDLLIMPORT create_upper_paths_hook_type create_upper_paths_hook; @@ -63,4 +63,4 @@ extern bool plan_cluster_use_sort(Oid tableOid, Oid indexOid); extern List *get_partitioned_child_rels(PlannerInfo *root, Index rti); -#endif /* PLANNER_H */ +#endif /* PLANNER_H */ diff --git a/src/include/optimizer/predtest.h b/src/include/optimizer/predtest.h index 748cd35611..bccb8d63a9 100644 --- a/src/include/optimizer/predtest.h +++ b/src/include/optimizer/predtest.h @@ -22,4 +22,4 @@ extern bool predicate_implied_by(List *predicate_list, List *clause_list, extern bool predicate_refuted_by(List *predicate_list, List *clause_list, bool clause_is_check); -#endif /* PREDTEST_H */ +#endif /* PREDTEST_H */ diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h index 2b20b36f74..faad46b5e4 100644 --- a/src/include/optimizer/prep.h +++ b/src/include/optimizer/prep.h @@ -58,4 +58,4 @@ extern Node *adjust_appendrel_attrs(PlannerInfo *root, Node *node, extern Node *adjust_appendrel_attrs_multilevel(PlannerInfo *root, Node *node, RelOptInfo *child_rel); -#endif /* PREP_H */ +#endif /* PREP_H */ diff --git a/src/include/optimizer/restrictinfo.h b/src/include/optimizer/restrictinfo.h index 31b9a79285..b2a69998fd 100644 --- a/src/include/optimizer/restrictinfo.h +++ b/src/include/optimizer/restrictinfo.h @@ -43,4 +43,4 @@ extern bool join_clause_is_movable_into(RestrictInfo *rinfo, Relids currentrelids, Relids current_and_outer); -#endif /* RESTRICTINFO_H */ +#endif /* RESTRICTINFO_H */ diff --git a/src/include/optimizer/subselect.h b/src/include/optimizer/subselect.h index 56dc237b51..ecd2011d54 100644 --- a/src/include/optimizer/subselect.h +++ b/src/include/optimizer/subselect.h @@ -40,4 +40,4 @@ extern Param *assign_nestloop_param_placeholdervar(PlannerInfo *root, PlaceHolderVar *phv); extern int SS_assign_special_param(PlannerInfo *root); -#endif /* SUBSELECT_H */ +#endif /* SUBSELECT_H */ diff --git a/src/include/optimizer/tlist.h b/src/include/optimizer/tlist.h index ccb93d8c80..0d3ec920dd 100644 --- a/src/include/optimizer/tlist.h +++ b/src/include/optimizer/tlist.h @@ -69,4 +69,4 @@ extern void split_pathtarget_at_srfs(PlannerInfo *root, #define create_pathtarget(root, tlist) \ set_pathtarget_cost_width(root, make_pathtarget_from_tlist(tlist)) -#endif /* TLIST_H */ +#endif /* TLIST_H */ diff --git a/src/include/optimizer/var.h b/src/include/optimizer/var.h index ae1f856933..61861528af 100644 --- a/src/include/optimizer/var.h +++ b/src/include/optimizer/var.h @@ -21,10 +21,10 @@ #define PVC_RECURSE_AGGREGATES 0x0002 /* recurse into Aggref arguments */ #define PVC_INCLUDE_WINDOWFUNCS 0x0004 /* include WindowFuncs in output list */ #define PVC_RECURSE_WINDOWFUNCS 0x0008 /* recurse into WindowFunc arguments */ -#define PVC_INCLUDE_PLACEHOLDERS 0x0010 /* include PlaceHolderVars in - * output list */ -#define PVC_RECURSE_PLACEHOLDERS 0x0020 /* recurse into PlaceHolderVar - * arguments */ +#define PVC_INCLUDE_PLACEHOLDERS 0x0010 /* include PlaceHolderVars in + * output list */ +#define PVC_RECURSE_PLACEHOLDERS 0x0020 /* recurse into PlaceHolderVar + * arguments */ extern Relids pull_varnos(Node *node); @@ -37,4 +37,4 @@ extern int locate_var_of_level(Node *node, int levelsup); extern List *pull_var_clause(Node *node, int flags); extern Node *flatten_join_alias_vars(PlannerInfo *root, Node *node); -#endif /* VAR_H */ +#endif /* VAR_H */ diff --git a/src/include/parser/analyze.h b/src/include/parser/analyze.h index 2c14b1e1af..42435884fe 100644 --- a/src/include/parser/analyze.h +++ b/src/include/parser/analyze.h @@ -19,7 +19,7 @@ /* Hook for plugins to get control at end of parse analysis */ typedef void (*post_parse_analyze_hook_type) (ParseState *pstate, - Query *query); + Query *query); extern PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook; @@ -48,4 +48,4 @@ extern void applyLockingClause(Query *qry, Index rtindex, extern void ParseAnalyze_callback(ParseState *pstate, Query *query); extern post_parse_analyze_hook_type prev_ParseAnalyze_callback; #endif -#endif /* ANALYZE_H */ +#endif /* ANALYZE_H */ diff --git a/src/include/parser/gramparse.h b/src/include/parser/gramparse.h index 2da98f67f3..b6b67fb92c 100644 --- a/src/include/parser/gramparse.h +++ b/src/include/parser/gramparse.h @@ -44,8 +44,8 @@ typedef struct base_yy_extra_type */ bool have_lookahead; /* is lookahead info valid? */ int lookahead_token; /* one-token lookahead */ - core_YYSTYPE lookahead_yylval; /* yylval for lookahead token */ - YYLTYPE lookahead_yylloc; /* yylloc for lookahead token */ + core_YYSTYPE lookahead_yylval; /* yylval for lookahead token */ + YYLTYPE lookahead_yylloc; /* yylloc for lookahead token */ char *lookahead_end; /* end of current token */ char lookahead_hold_char; /* to be put back at *lookahead_end */ @@ -72,4 +72,4 @@ extern int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, extern void parser_init(base_yy_extra_type *yyext); extern int base_yyparse(core_yyscan_t yyscanner); -#endif /* GRAMPARSE_H */ +#endif /* GRAMPARSE_H */ diff --git a/src/include/parser/parse_agg.h b/src/include/parser/parse_agg.h index 0ec3bc2e24..b9fd78d07a 100644 --- a/src/include/parser/parse_agg.h +++ b/src/include/parser/parse_agg.h @@ -66,4 +66,4 @@ extern void build_aggregate_finalfn_expr(Oid *agg_input_types, Oid finalfn_oid, Expr **finalfnexpr); -#endif /* PARSE_AGG_H */ +#endif /* PARSE_AGG_H */ diff --git a/src/include/parser/parse_clause.h b/src/include/parser/parse_clause.h index 823138f6c0..1d205c6327 100644 --- a/src/include/parser/parse_clause.h +++ b/src/include/parser/parse_clause.h @@ -51,4 +51,4 @@ extern List *addTargetToSortList(ParseState *pstate, TargetEntry *tle, extern Index assignSortGroupRef(TargetEntry *tle, List *tlist); extern bool targetIsInSortList(TargetEntry *tle, Oid sortop, List *sortList); -#endif /* PARSE_CLAUSE_H */ +#endif /* PARSE_CLAUSE_H */ diff --git a/src/include/parser/parse_coerce.h b/src/include/parser/parse_coerce.h index 3eed81966d..06f65293cb 100644 --- a/src/include/parser/parse_coerce.h +++ b/src/include/parser/parse_coerce.h @@ -91,4 +91,4 @@ extern CoercionPathType find_coercion_pathway(Oid targetTypeId, extern CoercionPathType find_typmod_coercion_function(Oid typeId, Oid *funcid); -#endif /* PARSE_COERCE_H */ +#endif /* PARSE_COERCE_H */ diff --git a/src/include/parser/parse_collate.h b/src/include/parser/parse_collate.h index e42971dfde..7279fa4e7c 100644 --- a/src/include/parser/parse_collate.h +++ b/src/include/parser/parse_collate.h @@ -24,4 +24,4 @@ extern void assign_expr_collations(ParseState *pstate, Node *expr); extern Oid select_common_collation(ParseState *pstate, List *exprs, bool none_ok); -#endif /* PARSE_COLLATE_H */ +#endif /* PARSE_COLLATE_H */ diff --git a/src/include/parser/parse_cte.h b/src/include/parser/parse_cte.h index 9130612312..695e88c7ed 100644 --- a/src/include/parser/parse_cte.h +++ b/src/include/parser/parse_cte.h @@ -21,4 +21,4 @@ extern List *transformWithClause(ParseState *pstate, WithClause *withClause); extern void analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist); -#endif /* PARSE_CTE_H */ +#endif /* PARSE_CTE_H */ diff --git a/src/include/parser/parse_enr.h b/src/include/parser/parse_enr.h index 48a7576f2c..9c68ddbb04 100644 --- a/src/include/parser/parse_enr.h +++ b/src/include/parser/parse_enr.h @@ -19,4 +19,4 @@ extern bool name_matches_visible_ENR(ParseState *pstate, const char *refname); extern EphemeralNamedRelationMetadata get_visible_ENR(ParseState *pstate, const char *refname); -#endif /* PARSE_ENR_H */ +#endif /* PARSE_ENR_H */ diff --git a/src/include/parser/parse_expr.h b/src/include/parser/parse_expr.h index 2101eaefda..3af09b0056 100644 --- a/src/include/parser/parse_expr.h +++ b/src/include/parser/parse_expr.h @@ -23,4 +23,4 @@ extern Node *transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKin extern const char *ParseExprKindName(ParseExprKind exprKind); -#endif /* PARSE_EXPR_H */ +#endif /* PARSE_EXPR_H */ diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h index c684217e33..538b35bc17 100644 --- a/src/include/parser/parse_func.h +++ b/src/include/parser/parse_func.h @@ -71,4 +71,4 @@ extern void check_srf_call_placement(ParseState *pstate, Node *last_srf, int location); extern void check_pg_get_expr_args(ParseState *pstate, Oid fnoid, List *args); -#endif /* PARSE_FUNC_H */ +#endif /* PARSE_FUNC_H */ diff --git a/src/include/parser/parse_node.h b/src/include/parser/parse_node.h index 6a3507f3b1..68930c1f4a 100644 --- a/src/include/parser/parse_node.h +++ b/src/include/parser/parse_node.h @@ -43,7 +43,7 @@ typedef enum ParseExprKind EXPR_KIND_FILTER, /* FILTER */ EXPR_KIND_WINDOW_PARTITION, /* window definition PARTITION BY */ EXPR_KIND_WINDOW_ORDER, /* window definition ORDER BY */ - EXPR_KIND_WINDOW_FRAME_RANGE, /* window frame clause with RANGE */ + EXPR_KIND_WINDOW_FRAME_RANGE, /* window frame clause with RANGE */ EXPR_KIND_WINDOW_FRAME_ROWS, /* window frame clause with ROWS */ EXPR_KIND_SELECT_TARGET, /* SELECT target list item */ EXPR_KIND_INSERT_TARGET, /* INSERT target list item */ @@ -63,11 +63,11 @@ typedef enum ParseExprKind EXPR_KIND_FUNCTION_DEFAULT, /* default parameter value for function */ EXPR_KIND_INDEX_EXPRESSION, /* index expression */ EXPR_KIND_INDEX_PREDICATE, /* index predicate */ - EXPR_KIND_ALTER_COL_TRANSFORM, /* transform expr in ALTER COLUMN TYPE */ + EXPR_KIND_ALTER_COL_TRANSFORM, /* transform expr in ALTER COLUMN TYPE */ EXPR_KIND_EXECUTE_PARAMETER, /* parameter value in EXECUTE */ EXPR_KIND_TRIGGER_WHEN, /* WHEN condition in CREATE TRIGGER */ EXPR_KIND_POLICY, /* USING or WITH CHECK expr in policy */ - EXPR_KIND_PARTITION_EXPRESSION /* PARTITION BY expression */ + EXPR_KIND_PARTITION_EXPRESSION /* PARTITION BY expression */ } ParseExprKind; @@ -80,8 +80,8 @@ typedef Node *(*PreParseColumnRefHook) (ParseState *pstate, ColumnRef *cref); typedef Node *(*PostParseColumnRefHook) (ParseState *pstate, ColumnRef *cref, Node *var); typedef Node *(*ParseParamRefHook) (ParseState *pstate, ParamRef *pref); typedef Node *(*CoerceParamHook) (ParseState *pstate, Param *param, - Oid targetTypeId, int32 targetTypeMod, - int location); + Oid targetTypeId, int32 targetTypeMod, + int location); /* @@ -167,7 +167,7 @@ typedef Node *(*CoerceParamHook) (ParseState *pstate, Param *param, */ struct ParseState { - struct ParseState *parentParseState; /* stack link */ + struct ParseState *parentParseState; /* stack link */ const char *p_sourcetext; /* source text, or NULL if not available */ List *p_rtable; /* range table so far */ List *p_joinexprs; /* JoinExprs for RTE_JOIN p_rtable entries */ @@ -175,25 +175,24 @@ struct ParseState * node's fromlist) */ List *p_namespace; /* currently-referenceable RTEs (List of * ParseNamespaceItem) */ - bool p_lateral_active; /* p_lateral_only items visible? */ + bool p_lateral_active; /* p_lateral_only items visible? */ List *p_ctenamespace; /* current namespace for common table exprs */ List *p_future_ctes; /* common table exprs not yet in namespace */ - CommonTableExpr *p_parent_cte; /* this query's containing CTE */ - Relation p_target_relation; /* INSERT/UPDATE/DELETE target rel */ - RangeTblEntry *p_target_rangetblentry; /* target rel's RTE */ + CommonTableExpr *p_parent_cte; /* this query's containing CTE */ + Relation p_target_relation; /* INSERT/UPDATE/DELETE target rel */ + RangeTblEntry *p_target_rangetblentry; /* target rel's RTE */ bool p_is_insert; /* process assignment like INSERT not UPDATE */ List *p_windowdefs; /* raw representations of window clauses */ ParseExprKind p_expr_kind; /* what kind of expression we're parsing */ int p_next_resno; /* next targetlist resno to assign */ List *p_multiassign_exprs; /* junk tlist entries for multiassign */ - List *p_locking_clause; /* raw FOR UPDATE/FOR SHARE info */ + List *p_locking_clause; /* raw FOR UPDATE/FOR SHARE info */ bool p_locked_from_parent; /* parent has marked this subquery * with FOR UPDATE/FOR SHARE */ - bool p_resolve_unknowns; /* resolve unknown-type SELECT outputs - * as type text */ + bool p_resolve_unknowns; /* resolve unknown-type SELECT outputs as + * type text */ - QueryEnvironment *p_queryEnv; /* curr env, incl refs to enclosing - * env */ + QueryEnvironment *p_queryEnv; /* curr env, incl refs to enclosing env */ /* Flags telling about things found in the query: */ bool p_hasAggs; @@ -212,7 +211,7 @@ struct ParseState PostParseColumnRefHook p_post_columnref_hook; ParseParamRefHook p_paramref_hook; CoerceParamHook p_coerce_param_hook; - void *p_ref_hook_state; /* common passthrough link for above */ + void *p_ref_hook_state; /* common passthrough link for above */ }; /* @@ -280,4 +279,4 @@ extern ArrayRef *transformArraySubscripts(ParseState *pstate, Node *assignFrom); extern Const *make_const(ParseState *pstate, Value *value, int location); -#endif /* PARSE_NODE_H */ +#endif /* PARSE_NODE_H */ diff --git a/src/include/parser/parse_oper.h b/src/include/parser/parse_oper.h index ab3c4aa62f..3cab732b1f 100644 --- a/src/include/parser/parse_oper.h +++ b/src/include/parser/parse_oper.h @@ -64,4 +64,4 @@ extern Expr *make_scalar_array_op(ParseState *pstate, List *opname, bool useOr, Node *ltree, Node *rtree, int location); -#endif /* PARSE_OPER_H */ +#endif /* PARSE_OPER_H */ diff --git a/src/include/parser/parse_param.h b/src/include/parser/parse_param.h index 68f3ddaffa..50c21cfc9d 100644 --- a/src/include/parser/parse_param.h +++ b/src/include/parser/parse_param.h @@ -22,4 +22,4 @@ extern void parse_variable_parameters(ParseState *pstate, extern void check_variable_parameters(ParseState *pstate, Query *query); extern bool query_contains_extern_params(Query *query); -#endif /* PARSE_PARAM_H */ +#endif /* PARSE_PARAM_H */ diff --git a/src/include/parser/parse_relation.h b/src/include/parser/parse_relation.h index 4eece2bf8d..bbb605c31b 100644 --- a/src/include/parser/parse_relation.h +++ b/src/include/parser/parse_relation.h @@ -117,7 +117,7 @@ extern void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte, bool addToRelNameSpace, bool addToVarNameSpace); extern void errorMissingRTE(ParseState *pstate, RangeVar *relation) pg_attribute_noreturn(); extern void errorMissingColumn(ParseState *pstate, - char *relname, char *colname, int location) pg_attribute_noreturn(); + char *relname, char *colname, int location) pg_attribute_noreturn(); extern void expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up, int location, bool include_dropped, List **colnames, List **colvars); @@ -133,4 +133,4 @@ extern bool isQueryUsingTempRelation(Query *query); extern int specialAttNum(const char *attname); #endif -#endif /* PARSE_RELATION_H */ +#endif /* PARSE_RELATION_H */ diff --git a/src/include/parser/parse_target.h b/src/include/parser/parse_target.h index d06a235df0..44af46b1aa 100644 --- a/src/include/parser/parse_target.h +++ b/src/include/parser/parse_target.h @@ -43,4 +43,4 @@ extern TupleDesc expandRecordVariable(ParseState *pstate, Var *var, extern char *FigureColname(Node *node); extern char *FigureIndexColname(Node *node); -#endif /* PARSE_TARGET_H */ +#endif /* PARSE_TARGET_H */ diff --git a/src/include/parser/parse_type.h b/src/include/parser/parse_type.h index db0cd56ecc..7b843d0b9d 100644 --- a/src/include/parser/parse_type.h +++ b/src/include/parser/parse_type.h @@ -52,4 +52,4 @@ extern void parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, boo #define ISCOMPLEX(typeid) (typeidTypeRelid(typeid) != InvalidOid) -#endif /* PARSE_TYPE_H */ +#endif /* PARSE_TYPE_H */ diff --git a/src/include/parser/parse_utilcmd.h b/src/include/parser/parse_utilcmd.h index c3cdf7158c..bae44d924f 100644 --- a/src/include/parser/parse_utilcmd.h +++ b/src/include/parser/parse_utilcmd.h @@ -38,4 +38,4 @@ extern bool CheckLocalIndexColumn (char loctype, char *partcolname, char *indexc extern PartitionBoundSpec *transformPartitionBound(ParseState *pstate, Relation parent, PartitionBoundSpec *spec); -#endif /* PARSE_UTILCMD_H */ +#endif /* PARSE_UTILCMD_H */ diff --git a/src/include/parser/parser.h b/src/include/parser/parser.h index c8ad710dac..8370df6bbb 100644 --- a/src/include/parser/parser.h +++ b/src/include/parser/parser.h @@ -23,7 +23,7 @@ typedef enum BACKSLASH_QUOTE_OFF, BACKSLASH_QUOTE_ON, BACKSLASH_QUOTE_SAFE_ENCODING -} BackslashQuoteType; +} BackslashQuoteType; /* GUC variables in scan.l (every one of these is a bad idea :-() */ extern int backslash_quote; @@ -38,4 +38,4 @@ extern List *raw_parser(const char *str); extern List *SystemFuncName(char *name); extern TypeName *SystemTypeName(char *name); -#endif /* PARSER_H */ +#endif /* PARSER_H */ diff --git a/src/include/parser/parsetree.h b/src/include/parser/parsetree.h index 951ff0a254..96cb2e2f67 100644 --- a/src/include/parser/parsetree.h +++ b/src/include/parser/parsetree.h @@ -76,4 +76,4 @@ extern TargetEntry *get_tle_by_resno(List *tlist, AttrNumber resno); extern RowMarkClause *get_parse_rowmark(Query *qry, Index rtindex); -#endif /* PARSETREE_H */ +#endif /* PARSETREE_H */ diff --git a/src/include/parser/scanner.h b/src/include/parser/scanner.h index 74f1cc897f..bb95de730b 100644 --- a/src/include/parser/scanner.h +++ b/src/include/parser/scanner.h @@ -127,4 +127,4 @@ extern int core_yylex(core_YYSTYPE *lvalp, YYLTYPE *llocp, extern int scanner_errposition(int location, core_yyscan_t yyscanner); extern void scanner_yyerror(const char *message, core_yyscan_t yyscanner) pg_attribute_noreturn(); -#endif /* SCANNER_H */ +#endif /* SCANNER_H */ diff --git a/src/include/parser/scansup.h b/src/include/parser/scansup.h index 3464eb4c0e..f9a36b5cbd 100644 --- a/src/include/parser/scansup.h +++ b/src/include/parser/scansup.h @@ -27,4 +27,4 @@ extern void truncate_identifier(char *ident, int len, bool warn); extern bool scanner_isspace(char ch); -#endif /* SCANSUP_H */ +#endif /* SCANSUP_H */ diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index f920e35664..d7cd0ac4f6 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -457,6 +457,9 @@ /* Define to 1 if you have the external array `tzname'. */ /* #undef HAVE_TZNAME */ +/* Define to 1 if you have the `ucol_strcollUTF8' function. */ +#define HAVE_UCOL_STRCOLLUTF8 1 + /* Define to 1 if the system has the type `uint64'. */ /* #undef HAVE_UINT64 */ diff --git a/src/include/pg_getopt.h b/src/include/pg_getopt.h index 2e25576499..16d5a326f9 100644 --- a/src/include/pg_getopt.h +++ b/src/include/pg_getopt.h @@ -29,7 +29,7 @@ extern int optind; extern int opterr; extern int optopt; -#endif /* HAVE_GETOPT_H */ +#endif /* HAVE_GETOPT_H */ /* * Some platforms have optreset but fail to declare it in <getopt.h>, so cope. @@ -40,7 +40,7 @@ extern int optreset; #endif #ifndef HAVE_GETOPT -extern int getopt(int nargc, char *const * nargv, const char *ostr); +extern int getopt(int nargc, char *const *nargv, const char *ostr); #endif -#endif /* PG_GETOPT_H */ +#endif /* PG_GETOPT_H */ diff --git a/src/include/pg_trace.h b/src/include/pg_trace.h index 1fe95e6403..29bc95d0d3 100644 --- a/src/include/pg_trace.h +++ b/src/include/pg_trace.h @@ -14,4 +14,4 @@ #include "utils/probes.h" /* pgrminclude ignore */ -#endif /* PG_TRACE_H */ +#endif /* PG_TRACE_H */ diff --git a/src/include/pgstat.h b/src/include/pgstat.h index ca40c572db..25dbf0dc12 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -40,7 +40,7 @@ typedef enum TrackFunctionsLevel TRACK_FUNC_OFF, TRACK_FUNC_PL, TRACK_FUNC_ALL -} TrackFunctionsLevel; +} TrackFunctionsLevel; /* ---------- * The types of backend -> collector messages @@ -155,7 +155,7 @@ typedef struct PgStat_TableStatus { Oid t_id; /* table's OID */ bool t_shared; /* is it a shared catalog? */ - struct PgStat_TableXactStatus *trans; /* lowest subxact's counts */ + struct PgStat_TableXactStatus *trans; /* lowest subxact's counts */ PgStat_TableCounts t_counts; /* event counts to be sent */ } PgStat_TableStatus; @@ -165,19 +165,19 @@ typedef struct PgStat_TableStatus */ typedef struct PgStat_TableXactStatus { - PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */ - PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */ - PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */ + PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */ + PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */ + PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */ bool truncated; /* relation truncated in this (sub)xact */ PgStat_Counter inserted_pre_trunc; /* tuples inserted prior to truncate */ PgStat_Counter updated_pre_trunc; /* tuples updated prior to truncate */ PgStat_Counter deleted_pre_trunc; /* tuples deleted prior to truncate */ int nest_level; /* subtransaction nest level */ /* links to other structs for same relation: */ - struct PgStat_TableXactStatus *upper; /* next higher subxact if any */ + struct PgStat_TableXactStatus *upper; /* next higher subxact if any */ PgStat_TableStatus *parent; /* per-table status */ /* structs of same subxact level are linked here: */ - struct PgStat_TableXactStatus *next; /* next of same subxact */ + struct PgStat_TableXactStatus *next; /* next of same subxact */ } PgStat_TableXactStatus; @@ -419,7 +419,7 @@ typedef struct PgStat_MsgBgWriter PgStat_Counter m_buf_written_backend; PgStat_Counter m_buf_fsync_backend; PgStat_Counter m_buf_alloc; - PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */ + PgStat_Counter m_checkpoint_write_time; /* times in milliseconds */ PgStat_Counter m_checkpoint_sync_time; } PgStat_MsgBgWriter; @@ -634,13 +634,13 @@ typedef struct PgStat_StatTabEntry PgStat_Counter blocks_fetched; PgStat_Counter blocks_hit; - TimestampTz vacuum_timestamp; /* user initiated vacuum */ + TimestampTz vacuum_timestamp; /* user initiated vacuum */ PgStat_Counter vacuum_count; - TimestampTz autovac_vacuum_timestamp; /* autovacuum initiated */ + TimestampTz autovac_vacuum_timestamp; /* autovacuum initiated */ PgStat_Counter autovac_vacuum_count; - TimestampTz analyze_timestamp; /* user initiated */ + TimestampTz analyze_timestamp; /* user initiated */ PgStat_Counter analyze_count; - TimestampTz autovac_analyze_timestamp; /* autovacuum initiated */ + TimestampTz autovac_analyze_timestamp; /* autovacuum initiated */ PgStat_Counter autovac_analyze_count; } PgStat_StatTabEntry; @@ -665,13 +665,13 @@ typedef struct PgStat_StatFuncEntry */ typedef struct PgStat_ArchiverStats { - PgStat_Counter archived_count; /* archival successes */ + PgStat_Counter archived_count; /* archival successes */ char last_archived_wal[MAX_XFN_CHARS + 1]; /* last WAL file * archived */ - TimestampTz last_archived_timestamp; /* last archival success time */ + TimestampTz last_archived_timestamp; /* last archival success time */ PgStat_Counter failed_count; /* failed archival attempts */ - char last_failed_wal[MAX_XFN_CHARS + 1]; /* WAL file involved in - * last failure */ + char last_failed_wal[MAX_XFN_CHARS + 1]; /* WAL file involved in + * last failure */ TimestampTz last_failed_timestamp; /* last archival failure time */ TimestampTz stat_reset_timestamp; } PgStat_ArchiverStats; @@ -684,7 +684,7 @@ typedef struct PgStat_GlobalStats TimestampTz stats_timestamp; /* time of stats file update */ PgStat_Counter timed_checkpoints; PgStat_Counter requested_checkpoints; - PgStat_Counter checkpoint_write_time; /* times in milliseconds */ + PgStat_Counter checkpoint_write_time; /* times in milliseconds */ PgStat_Counter checkpoint_sync_time; PgStat_Counter buf_written_checkpoints; PgStat_Counter buf_written_clean; @@ -938,9 +938,9 @@ typedef struct PgBackendSSLStatus /* Information about SSL connection */ int ssl_bits; bool ssl_compression; - char ssl_version[NAMEDATALEN]; /* MUST be null-terminated */ - char ssl_cipher[NAMEDATALEN]; /* MUST be null-terminated */ - char ssl_clientdn[NAMEDATALEN]; /* MUST be null-terminated */ + char ssl_version[NAMEDATALEN]; /* MUST be null-terminated */ + char ssl_cipher[NAMEDATALEN]; /* MUST be null-terminated */ + char ssl_clientdn[NAMEDATALEN]; /* MUST be null-terminated */ } PgBackendSSLStatus; @@ -991,7 +991,7 @@ typedef struct PgBackendStatus Oid st_databaseid; Oid st_userid; SockAddr st_clientaddr; - char *st_clienthostname; /* MUST be null-terminated */ + char *st_clienthostname; /* MUST be null-terminated */ /* Information about SSL connection */ bool st_ssl; @@ -1333,4 +1333,4 @@ extern int pgstat_fetch_stat_numbackends(void); extern PgStat_ArchiverStats *pgstat_fetch_stat_archiver(void); extern PgStat_GlobalStats *pgstat_fetch_global(void); -#endif /* PGSTAT_H */ +#endif /* PGSTAT_H */ diff --git a/src/include/pgtar.h b/src/include/pgtar.h index d0188efaa6..9a1be4c9f6 100644 --- a/src/include/pgtar.h +++ b/src/include/pgtar.h @@ -20,7 +20,7 @@ enum tarError }; extern enum tarError tarCreateHeader(char *h, const char *filename, const char *linktarget, - pgoff_t size, mode_t mode, uid_t uid, gid_t gid, time_t mtime); + pgoff_t size, mode_t mode, uid_t uid, gid_t gid, time_t mtime); extern uint64 read_tar_number(const char *s, int len); extern void print_tar_number(char *s, int len, uint64 val); extern int tarChecksum(char *header); diff --git a/src/include/pgtime.h b/src/include/pgtime.h index 52b54b920a..4fd8f75ef9 100644 --- a/src/include/pgtime.h +++ b/src/include/pgtime.h @@ -66,7 +66,7 @@ extern bool pg_tz_acceptable(pg_tz *tz); /* these functions are in strftime.c */ extern size_t pg_strftime(char *s, size_t max, const char *format, - const struct pg_tm * tm); + const struct pg_tm *tm); /* these functions and variables are in pgtz.c */ @@ -81,4 +81,4 @@ extern pg_tzenum *pg_tzenumerate_start(void); extern pg_tz *pg_tzenumerate_next(pg_tzenum *dir); extern void pg_tzenumerate_end(pg_tzenum *dir); -#endif /* _PGTIME_H */ +#endif /* _PGTIME_H */ diff --git a/src/include/port.h b/src/include/port.h index 7d8e8a68d4..3729b7a306 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -180,7 +180,7 @@ extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2); #define fprintf pg_fprintf #define printf pg_printf #endif -#endif /* USE_REPL_SNPRINTF */ +#endif /* USE_REPL_SNPRINTF */ #if defined(WIN32) /* @@ -200,7 +200,7 @@ extern int pg_printf(const char *fmt,...) pg_attribute_printf(1, 2); extern char *pgwin32_setlocale(int category, const char *locale); #define setlocale(a,b) pgwin32_setlocale(a,b) -#endif /* WIN32 */ +#endif /* WIN32 */ /* Portable prompt handling */ extern void simple_prompt(const char *prompt, char *destination, size_t destlen, @@ -237,7 +237,7 @@ extern int pgunlink(const char *path); #define rename(from, to) pgrename(from, to) #define unlink(path) pgunlink(path) -#endif /* defined(WIN32) || defined(__CYGWIN__) */ +#endif /* defined(WIN32) || defined(__CYGWIN__) */ /* * Win32 also doesn't have symlinks, but we can emulate them with @@ -271,7 +271,7 @@ extern bool rmtree(const char *path, bool rmtopdir); */ #if defined(WIN32) && !defined(__CYGWIN__) && !defined(UNSAFE_STAT_OK) #include <sys/stat.h> -extern int pgwin32_safestat(const char *path, struct stat * buf); +extern int pgwin32_safestat(const char *path, struct stat *buf); #define stat(a,b) pgwin32_safestat(a,b) #endif @@ -317,7 +317,7 @@ extern FILE *pgwin32_popen(const char *command, const char *type); /* New versions of MingW have gettimeofday, old mingw and msvc don't */ #ifndef HAVE_GETTIMEOFDAY /* Last parameter not used */ -extern int gettimeofday(struct timeval * tp, struct timezone * tzp); +extern int gettimeofday(struct timeval *tp, struct timezone *tzp); #endif #else /* !WIN32 */ @@ -326,7 +326,7 @@ extern int gettimeofday(struct timeval * tp, struct timezone * tzp); * close() does them all. */ #define closesocket close -#endif /* WIN32 */ +#endif /* WIN32 */ /* * On Windows, setvbuf() does not support _IOLBF mode, and interprets that @@ -392,7 +392,7 @@ extern double rint(double x); #ifndef HAVE_INET_ATON #include <netinet/in.h> #include <arpa/inet.h> -extern int inet_aton(const char *cp, struct in_addr * addr); +extern int inet_aton(const char *cp, struct in_addr *addr); #endif #if !HAVE_DECL_STRLCAT @@ -423,14 +423,14 @@ extern void srandom(unsigned int seed); extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen); #ifndef WIN32 -extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer, - size_t buflen, struct passwd ** result); +extern int pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer, + size_t buflen, struct passwd **result); #endif extern int pqGethostbyname(const char *name, - struct hostent * resultbuf, + struct hostent *resultbuf, char *buffer, size_t buflen, - struct hostent ** result, + struct hostent **result, int *herrno); extern void pg_qsort(void *base, size_t nel, size_t elsize, @@ -485,4 +485,4 @@ extern char *escape_single_quotes_ascii(const char *src); /* port/wait_error.c */ extern char *wait_result_to_str(int exit_status); -#endif /* PG_PORT_H */ +#endif /* PG_PORT_H */ diff --git a/src/include/port/atomics.h b/src/include/port/atomics.h index 89eb522637..2bfd1ed728 100644 --- a/src/include/port/atomics.h +++ b/src/include/port/atomics.h @@ -532,4 +532,4 @@ pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_) #undef INSIDE_ATOMICS_H -#endif /* ATOMICS_H */ +#endif /* ATOMICS_H */ diff --git a/src/include/port/pg_bswap.h b/src/include/port/pg_bswap.h index 18859a6ea3..50a6bd106b 100644 --- a/src/include/port/pg_bswap.h +++ b/src/include/port/pg_bswap.h @@ -29,7 +29,7 @@ (((x) << 8) & 0x00ff0000) | \ (((x) >> 8) & 0x0000ff00) | \ (((x) >> 24) & 0x000000ff)) -#endif /* HAVE__BUILTIN_BSWAP32 */ +#endif /* HAVE__BUILTIN_BSWAP32 */ #ifdef HAVE__BUILTIN_BSWAP64 #define BSWAP64(x) __builtin_bswap64(x) @@ -42,7 +42,7 @@ (((x) >> 24) & UINT64CONST(0x0000000000ff0000)) | \ (((x) >> 40) & UINT64CONST(0x000000000000ff00)) | \ (((x) >> 56) & UINT64CONST(0x00000000000000ff))) -#endif /* HAVE__BUILTIN_BSWAP64 */ +#endif /* HAVE__BUILTIN_BSWAP64 */ /* * Rearrange the bytes of a Datum from big-endian order into the native byte @@ -63,7 +63,7 @@ #define DatumBigEndianToNative(x) BSWAP64(x) #else /* SIZEOF_DATUM != 8 */ #define DatumBigEndianToNative(x) BSWAP32(x) -#endif /* SIZEOF_DATUM == 8 */ -#endif /* WORDS_BIGENDIAN */ +#endif /* SIZEOF_DATUM == 8 */ +#endif /* WORDS_BIGENDIAN */ -#endif /* PG_BSWAP_H */ +#endif /* PG_BSWAP_H */ diff --git a/src/include/port/pg_crc32c.h b/src/include/port/pg_crc32c.h index aa35fa89d2..cd58ecc988 100644 --- a/src/include/port/pg_crc32c.h +++ b/src/include/port/pg_crc32c.h @@ -82,4 +82,4 @@ extern pg_crc32c pg_comp_crc32c_sb8(pg_crc32c crc, const void *data, size_t len) #endif -#endif /* PG_CRC32C_H */ +#endif /* PG_CRC32C_H */ diff --git a/src/include/port/win32.h b/src/include/port/win32.h index 0debb3b3f4..23f89748ac 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -222,7 +222,7 @@ struct itimerval struct timeval it_value; }; -int setitimer(int which, const struct itimerval * value, struct itimerval * ovalue); +int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue); /* * WIN32 does not provide 64-bit off_t, but does provide the functions operating @@ -376,11 +376,11 @@ void pg_queue_signal(int signum); #define send(s, buf, len, flags) pgwin32_send(s, buf, len, flags) SOCKET pgwin32_socket(int af, int type, int protocol); -int pgwin32_bind(SOCKET s, struct sockaddr * addr, int addrlen); +int pgwin32_bind(SOCKET s, struct sockaddr *addr, int addrlen); int pgwin32_listen(SOCKET s, int backlog); -SOCKET pgwin32_accept(SOCKET s, struct sockaddr * addr, int *addrlen); -int pgwin32_connect(SOCKET s, const struct sockaddr * name, int namelen); -int pgwin32_select(int nfds, fd_set *readfs, fd_set *writefds, fd_set *exceptfds, const struct timeval * timeout); +SOCKET pgwin32_accept(SOCKET s, struct sockaddr *addr, int *addrlen); +int pgwin32_connect(SOCKET s, const struct sockaddr *name, int namelen); +int pgwin32_select(int nfds, fd_set *readfs, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout); int pgwin32_recv(SOCKET s, char *buf, int len, int flags); int pgwin32_send(SOCKET s, const void *buf, int len, int flags); @@ -442,7 +442,7 @@ typedef unsigned short mode_t; /* Pulled from Makefile.port in mingw */ #define DLSUFFIX ".dll" -#endif /* _MSC_VER */ +#endif /* _MSC_VER */ /* These aren't provided by either MingW or MSVC */ #define S_IRGRP 0 diff --git a/src/include/port/win32/sys/socket.h b/src/include/port/win32/sys/socket.h index edaee6a894..9b2cdf3b9b 100644 --- a/src/include/port/win32/sys/socket.h +++ b/src/include/port/win32/sys/socket.h @@ -30,4 +30,4 @@ */ #undef gai_strerror -#endif /* WIN32_SYS_SOCKET_H */ +#endif /* WIN32_SYS_SOCKET_H */ diff --git a/src/include/portability/instr_time.h b/src/include/portability/instr_time.h index 9eb4bb7eac..b6e8c58d44 100644 --- a/src/include/portability/instr_time.h +++ b/src/include/portability/instr_time.h @@ -202,7 +202,7 @@ typedef struct timeval instr_time; #define INSTR_TIME_GET_MICROSEC(t) \ (((uint64) (t).tv_sec * (uint64) 1000000) + (uint64) (t).tv_usec) -#endif /* HAVE_CLOCK_GETTIME */ +#endif /* HAVE_CLOCK_GETTIME */ #else /* WIN32 */ @@ -243,6 +243,6 @@ GetTimerFrequency(void) return (double) f.QuadPart; } -#endif /* WIN32 */ +#endif /* WIN32 */ -#endif /* INSTR_TIME_H */ +#endif /* INSTR_TIME_H */ diff --git a/src/include/portability/mem.h b/src/include/portability/mem.h index d560c3ce56..fa507c2581 100644 --- a/src/include/portability/mem.h +++ b/src/include/portability/mem.h @@ -45,4 +45,4 @@ #define MAP_FAILED ((void *) -1) #endif -#endif /* MEM_H */ +#endif /* MEM_H */ diff --git a/src/include/postgres.h b/src/include/postgres.h index 7426a253d2..29eec53bf8 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -81,7 +81,7 @@ typedef struct varatt_external int32 va_extsize; /* External saved size (doesn't) */ Oid va_valueid; /* Unique ID of value within TOAST table */ Oid va_toastrelid; /* RelID of TOAST table containing it */ -} varatt_external; +} varatt_external; /* * struct varatt_indirect is a "TOAST pointer" representing an out-of-line @@ -95,7 +95,7 @@ typedef struct varatt_external typedef struct varatt_indirect { struct varlena *pointer; /* Pointer to in-memory varlena */ -} varatt_indirect; +} varatt_indirect; /* * struct varatt_expanded is a "TOAST pointer" representing an out-of-line @@ -157,7 +157,7 @@ typedef union { uint32 va_header; uint32 va_rawsize; /* Original data size (excludes header) */ - char va_data[FLEXIBLE_ARRAY_MEMBER]; /* Compressed data */ + char va_data[FLEXIBLE_ARRAY_MEMBER]; /* Compressed data */ } va_compressed; } varattrib_4b; @@ -274,7 +274,7 @@ typedef struct #define SET_VARTAG_1B_E(PTR,tag) \ (((varattrib_1b_e *) (PTR))->va_header = 0x01, \ ((varattrib_1b_e *) (PTR))->va_tag = (tag)) -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ #define VARHDRSZ_SHORT offsetof(varattrib_1b, va_data) #define VARATT_SHORT_MAX 0x7F @@ -811,10 +811,7 @@ extern Datum Float8GetDatum(float8 X); */ extern void ExceptionalCondition(const char *conditionName, const char *errorType, - const char *fileName, int lineNumber) pg_attribute_noreturn(); - -//#define PGXC_COORD // for PGXC coordinator compiling -//#define PGXC_DATANODE // for PGXC data node compiling + const char *fileName, int lineNumber) pg_attribute_noreturn(); extern void ResetUsageCommon(struct rusage *save_r, struct timeval *save_t); @@ -822,4 +819,4 @@ extern void ResetUsage(void); extern void ShowUsageCommon(const char *title, struct rusage *save_r, struct timeval *save_t); -#endif /* POSTGRES_H */ +#endif /* POSTGRES_H */ diff --git a/src/include/postgres_ext.h b/src/include/postgres_ext.h index 452eae9935..fdb61b7cf5 100644 --- a/src/include/postgres_ext.h +++ b/src/include/postgres_ext.h @@ -71,4 +71,4 @@ typedef PG_INT64_TYPE pg_int64; #define PG_DIAG_SOURCE_LINE 'L' #define PG_DIAG_SOURCE_FUNCTION 'R' -#endif /* POSTGRES_EXT_H */ +#endif /* POSTGRES_EXT_H */ diff --git a/src/include/postgres_fe.h b/src/include/postgres_fe.h index f49e33bc35..1dd01d0283 100644 --- a/src/include/postgres_fe.h +++ b/src/include/postgres_fe.h @@ -26,4 +26,4 @@ #include "common/fe_memutils.h" -#endif /* POSTGRES_FE_H */ +#endif /* POSTGRES_FE_H */ diff --git a/src/include/postmaster/autovacuum.h b/src/include/postmaster/autovacuum.h index e61cc93e55..5ce7f62739 100644 --- a/src/include/postmaster/autovacuum.h +++ b/src/include/postmaster/autovacuum.h @@ -84,4 +84,4 @@ extern void AutoVacuumRequestWork(AutoVacuumWorkItemType type, extern Size AutoVacuumShmemSize(void); extern void AutoVacuumShmemInit(void); -#endif /* AUTOVACUUM_H */ +#endif /* AUTOVACUUM_H */ diff --git a/src/include/postmaster/bgworker.h b/src/include/postmaster/bgworker.h index 51a5978ea8..e2ecd3c9eb 100644 --- a/src/include/postmaster/bgworker.h +++ b/src/include/postmaster/bgworker.h @@ -90,7 +90,7 @@ typedef struct BackgroundWorker char bgw_name[BGW_MAXLEN]; int bgw_flags; BgWorkerStartTime bgw_start_time; - int bgw_restart_time; /* in seconds, or BGW_NEVER_RESTART */ + int bgw_restart_time; /* in seconds, or BGW_NEVER_RESTART */ char bgw_library_name[BGW_MAXLEN]; char bgw_function_name[BGW_MAXLEN]; Datum bgw_main_arg; @@ -119,9 +119,7 @@ extern bool RegisterDynamicBackgroundWorker(BackgroundWorker *worker, /* Query the status of a bgworker */ extern BgwHandleStatus GetBackgroundWorkerPid(BackgroundWorkerHandle *handle, pid_t *pidp); -extern BgwHandleStatus -WaitForBackgroundWorkerStartup(BackgroundWorkerHandle * - handle, pid_t *pid); +extern BgwHandleStatus WaitForBackgroundWorkerStartup(BackgroundWorkerHandle *handle, pid_t *pid); extern BgwHandleStatus WaitForBackgroundWorkerShutdown(BackgroundWorkerHandle *); @@ -149,4 +147,4 @@ extern void BackgroundWorkerInitializeConnectionByOid(Oid dboid, Oid useroid); extern void BackgroundWorkerBlockSignals(void); extern void BackgroundWorkerUnblockSignals(void); -#endif /* BGWORKER_H */ +#endif /* BGWORKER_H */ diff --git a/src/include/postmaster/bgworker_internals.h b/src/include/postmaster/bgworker_internals.h index 9e0b0621cf..bff10ba53c 100644 --- a/src/include/postmaster/bgworker_internals.h +++ b/src/include/postmaster/bgworker_internals.h @@ -60,4 +60,4 @@ extern void StartBackgroundWorker(void) pg_attribute_noreturn(); extern BackgroundWorker *BackgroundWorkerEntry(int slotno); #endif -#endif /* BGWORKER_INTERNALS_H */ +#endif /* BGWORKER_INTERNALS_H */ diff --git a/src/include/postmaster/bgwriter.h b/src/include/postmaster/bgwriter.h index 359b3ef5a5..a9b8bc7e8e 100644 --- a/src/include/postmaster/bgwriter.h +++ b/src/include/postmaster/bgwriter.h @@ -40,4 +40,4 @@ extern void CheckpointerShmemInit(void); extern bool FirstCallSinceLastCheckpoint(void); -#endif /* _BGWRITER_H */ +#endif /* _BGWRITER_H */ diff --git a/src/include/postmaster/fork_process.h b/src/include/postmaster/fork_process.h index c2bfd44ea0..9d5b97aca7 100644 --- a/src/include/postmaster/fork_process.h +++ b/src/include/postmaster/fork_process.h @@ -14,4 +14,4 @@ extern pid_t fork_process(void); -#endif /* FORK_PROCESS_H */ +#endif /* FORK_PROCESS_H */ diff --git a/src/include/postmaster/pgarch.h b/src/include/postmaster/pgarch.h index 6a4e0f43b8..ab1ddcf52c 100644 --- a/src/include/postmaster/pgarch.h +++ b/src/include/postmaster/pgarch.h @@ -36,4 +36,4 @@ extern int pgarch_start(void); extern void PgArchiverMain(int argc, char *argv[]) pg_attribute_noreturn(); #endif -#endif /* _PGARCH_H */ +#endif /* _PGARCH_H */ diff --git a/src/include/postmaster/postmaster.h b/src/include/postmaster/postmaster.h index 95231bf768..0f85908b09 100644 --- a/src/include/postmaster/postmaster.h +++ b/src/include/postmaster/postmaster.h @@ -39,9 +39,9 @@ extern int postmaster_alive_fds[2]; * Constants that represent which of postmaster_alive_fds is held by * postmaster, and which is used in children to check for postmaster death. */ -#define POSTMASTER_FD_WATCH 0 /* used in children to check for - * postmaster death */ -#define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */ +#define POSTMASTER_FD_WATCH 0 /* used in children to check for + * postmaster death */ +#define POSTMASTER_FD_OWN 1 /* kept open by postmaster only */ #endif extern const char *progname; @@ -74,4 +74,4 @@ extern void ShmemBackendArrayAllocation(void); */ #define MAX_BACKENDS 0x3FFFF -#endif /* _POSTMASTER_H */ +#endif /* _POSTMASTER_H */ diff --git a/src/include/postmaster/startup.h b/src/include/postmaster/startup.h index ce76d94991..883bd395bd 100644 --- a/src/include/postmaster/startup.h +++ b/src/include/postmaster/startup.h @@ -19,4 +19,4 @@ extern void PostRestoreCommand(void); extern bool IsPromoteTriggered(void); extern void ResetPromoteTriggered(void); -#endif /* _STARTUP_H */ +#endif /* _STARTUP_H */ diff --git a/src/include/postmaster/syslogger.h b/src/include/postmaster/syslogger.h index 94d7eac347..f4248ef5d4 100644 --- a/src/include/postmaster/syslogger.h +++ b/src/include/postmaster/syslogger.h @@ -94,4 +94,4 @@ extern void SysLoggerMain(int argc, char *argv[]) pg_attribute_noreturn(); #define LOG_METAINFO_DATAFILE "current_logfiles" #define LOG_METAINFO_DATAFILE_TMP LOG_METAINFO_DATAFILE ".tmp" -#endif /* _SYSLOGGER_H */ +#endif /* _SYSLOGGER_H */ diff --git a/src/include/postmaster/walwriter.h b/src/include/postmaster/walwriter.h index fb91385e0b..f0eb425802 100644 --- a/src/include/postmaster/walwriter.h +++ b/src/include/postmaster/walwriter.h @@ -18,4 +18,4 @@ extern int WalWriterFlushAfter; extern void WalWriterMain(void) pg_attribute_noreturn(); -#endif /* _WALWRITER_H */ +#endif /* _WALWRITER_H */ diff --git a/src/include/regex/regex.h b/src/include/regex/regex.h index cc73db2547..27fdc09040 100644 --- a/src/include/regex/regex.h +++ b/src/include/regex/regex.h @@ -173,4 +173,4 @@ extern int pg_regprefix(regex_t *, pg_wchar **, size_t *); extern void pg_regfree(regex_t *); extern size_t pg_regerror(int, const regex_t *, char *, size_t); -#endif /* _REGEX_H_ */ +#endif /* _REGEX_H_ */ diff --git a/src/include/regex/regexport.h b/src/include/regex/regexport.h index 091c568e63..1c84d15d55 100644 --- a/src/include/regex/regexport.h +++ b/src/include/regex/regexport.h @@ -54,4 +54,4 @@ extern int pg_reg_getnumcharacters(const regex_t *regex, int co); extern void pg_reg_getcharacters(const regex_t *regex, int co, pg_wchar *chars, int chars_len); -#endif /* _REGEXPORT_H_ */ +#endif /* _REGEXPORT_H_ */ diff --git a/src/include/regex/regguts.h b/src/include/regex/regguts.h index 69816f1449..5d0e7a961c 100644 --- a/src/include/regex/regguts.h +++ b/src/include/regex/regguts.h @@ -218,7 +218,7 @@ struct colormap color *locolormap; /* simple array indexed by chr code */ /* mapping data for chrs > MAX_SIMPLE_CHR: */ - int classbits[NUM_CCLASSES]; /* see comment above */ + int classbits[NUM_CCLASSES]; /* see comment above */ int numcmranges; /* number of colormapranges */ colormaprange *cmranges; /* ranges of high chrs */ color *hicolormap; /* 2-D array of color entries */ @@ -479,4 +479,4 @@ struct guts /* prototypes for functions that are exported from regcomp.c to regexec.c */ extern void pg_set_regex_collation(Oid collation); -extern color pg_reg_getcolor(struct colormap * cm, chr c); +extern color pg_reg_getcolor(struct colormap *cm, chr c); diff --git a/src/include/replication/basebackup.h b/src/include/replication/basebackup.h index bbd446904f..1a165c860b 100644 --- a/src/include/replication/basebackup.h +++ b/src/include/replication/basebackup.h @@ -33,4 +33,4 @@ extern void SendBaseBackup(BaseBackupCmd *cmd); extern int64 sendTablespace(char *path, bool sizeonly); -#endif /* _BASEBACKUP_H */ +#endif /* _BASEBACKUP_H */ diff --git a/src/include/replication/logical.h b/src/include/replication/logical.h index 159da7f23f..7f0e0fa881 100644 --- a/src/include/replication/logical.h +++ b/src/include/replication/logical.h @@ -18,18 +18,18 @@ struct LogicalDecodingContext; typedef void (*LogicalOutputPluginWriterWrite) ( - struct LogicalDecodingContext *lr, - XLogRecPtr Ptr, - TransactionId xid, - bool last_write + struct LogicalDecodingContext *lr, + XLogRecPtr Ptr, + TransactionId xid, + bool last_write ); typedef LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite; typedef void (*LogicalOutputPluginWriterUpdateProgress) ( - struct LogicalDecodingContext *lr, - XLogRecPtr Ptr, - TransactionId xid + struct LogicalDecodingContext *lr, + XLogRecPtr Ptr, + TransactionId xid ); typedef struct LogicalDecodingContext @@ -93,14 +93,14 @@ extern LogicalDecodingContext *CreateInitDecodingContext(char *plugin, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, - LogicalOutputPluginWriterUpdateProgress update_progress); + LogicalOutputPluginWriterUpdateProgress update_progress); extern LogicalDecodingContext *CreateDecodingContext( XLogRecPtr start_lsn, List *output_plugin_options, XLogPageReadCB read_page, LogicalOutputPluginWriterPrepareWrite prepare_write, LogicalOutputPluginWriterWrite do_write, - LogicalOutputPluginWriterUpdateProgress update_progress); + LogicalOutputPluginWriterUpdateProgress update_progress); extern void DecodingContextFindStartpoint(LogicalDecodingContext *ctx); extern bool DecodingContextReady(LogicalDecodingContext *ctx); extern void FreeDecodingContext(LogicalDecodingContext *ctx); diff --git a/src/include/replication/logicallauncher.h b/src/include/replication/logicallauncher.h index 4f3e89e061..aac7d326e2 100644 --- a/src/include/replication/logicallauncher.h +++ b/src/include/replication/logicallauncher.h @@ -26,4 +26,4 @@ extern void AtEOXact_ApplyLauncher(bool isCommit); extern bool IsLogicalLauncher(void); -#endif /* LOGICALLAUNCHER_H */ +#endif /* LOGICALLAUNCHER_H */ diff --git a/src/include/replication/logicalproto.h b/src/include/replication/logicalproto.h index e7679e29ed..191b03772f 100644 --- a/src/include/replication/logicalproto.h +++ b/src/include/replication/logicalproto.h @@ -103,4 +103,4 @@ extern LogicalRepRelation *logicalrep_read_rel(StringInfo in); extern void logicalrep_write_typ(StringInfo out, Oid typoid); extern void logicalrep_read_typ(StringInfo out, LogicalRepTyp *ltyp); -#endif /* LOGICALREP_PROTO_H */ +#endif /* LOGICALREP_PROTO_H */ diff --git a/src/include/replication/logicalrelation.h b/src/include/replication/logicalrelation.h index 3b814d3b2b..8352705650 100644 --- a/src/include/replication/logicalrelation.h +++ b/src/include/replication/logicalrelation.h @@ -16,7 +16,7 @@ typedef struct LogicalRepRelMapEntry { - LogicalRepRelation remoterel; /* key is remoterel.remoteid */ + LogicalRepRelation remoterel; /* key is remoterel.remoteid */ /* Mapping to local relation, filled as needed. */ Oid localreloid; /* local relation id */ @@ -39,4 +39,4 @@ extern void logicalrep_rel_close(LogicalRepRelMapEntry *rel, extern void logicalrep_typmap_update(LogicalRepTyp *remotetyp); extern Oid logicalrep_typmap_getid(Oid remoteid); -#endif /* LOGICALRELATION_H */ +#endif /* LOGICALRELATION_H */ diff --git a/src/include/replication/logicalworker.h b/src/include/replication/logicalworker.h index 5877a930f6..2557d5a23b 100644 --- a/src/include/replication/logicalworker.h +++ b/src/include/replication/logicalworker.h @@ -16,4 +16,4 @@ extern void ApplyWorkerMain(Datum main_arg); extern bool IsLogicalWorker(void); -#endif /* LOGICALWORKER_H */ +#endif /* LOGICALWORKER_H */ diff --git a/src/include/replication/message.h b/src/include/replication/message.h index b016af7bd7..1f2d0bb535 100644 --- a/src/include/replication/message.h +++ b/src/include/replication/message.h @@ -39,4 +39,4 @@ void logicalmsg_redo(XLogReaderState *record); void logicalmsg_desc(StringInfo buf, XLogReaderState *record); const char *logicalmsg_identify(uint8 info); -#endif /* PG_LOGICAL_MESSAGE_H */ +#endif /* PG_LOGICAL_MESSAGE_H */ diff --git a/src/include/replication/origin.h b/src/include/replication/origin.h index d6b8eb9d80..ca56c01469 100644 --- a/src/include/replication/origin.h +++ b/src/include/replication/origin.h @@ -71,4 +71,4 @@ const char *replorigin_identify(uint8 info); extern Size ReplicationOriginShmemSize(void); extern void ReplicationOriginShmemInit(void); -#endif /* PG_ORIGIN_H */ +#endif /* PG_ORIGIN_H */ diff --git a/src/include/replication/output_plugin.h b/src/include/replication/output_plugin.h index 2435e2be2d..26ff024882 100644 --- a/src/include/replication/output_plugin.h +++ b/src/include/replication/output_plugin.h @@ -42,47 +42,47 @@ typedef void (*LogicalOutputPluginInit) (struct OutputPluginCallbacks *cb); * the same slot is used from there one, it will be "false". */ typedef void (*LogicalDecodeStartupCB) (struct LogicalDecodingContext *ctx, - OutputPluginOptions *options, - bool is_init); + OutputPluginOptions *options, + bool is_init); /* * Callback called for every (explicit or implicit) BEGIN of a successful * transaction. */ typedef void (*LogicalDecodeBeginCB) (struct LogicalDecodingContext *ctx, - ReorderBufferTXN *txn); + ReorderBufferTXN *txn); /* * Callback for every individual change in a successful transaction. */ typedef void (*LogicalDecodeChangeCB) (struct LogicalDecodingContext *ctx, - ReorderBufferTXN *txn, - Relation relation, - ReorderBufferChange *change); + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); /* * Called for every (explicit or implicit) COMMIT of a successful transaction. */ typedef void (*LogicalDecodeCommitCB) (struct LogicalDecodingContext *ctx, - ReorderBufferTXN *txn, - XLogRecPtr commit_lsn); + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); /* * Called for the generic logical decoding messages. */ typedef void (*LogicalDecodeMessageCB) (struct LogicalDecodingContext *ctx, - ReorderBufferTXN *txn, - XLogRecPtr message_lsn, - bool transactional, - const char *prefix, - Size message_size, - const char *message); + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, + Size message_size, + const char *message); /* * Filter changes by origin. */ typedef bool (*LogicalDecodeFilterByOriginCB) (struct LogicalDecodingContext *ctx, - RepOriginId origin_id); + RepOriginId origin_id); /* * Called to shutdown an output plugin. @@ -108,4 +108,4 @@ extern void OutputPluginPrepareWrite(struct LogicalDecodingContext *ctx, bool la extern void OutputPluginWrite(struct LogicalDecodingContext *ctx, bool last_write); extern void OutputPluginUpdateProgress(struct LogicalDecodingContext *ctx); -#endif /* OUTPUT_PLUGIN_H */ +#endif /* OUTPUT_PLUGIN_H */ diff --git a/src/include/replication/pgoutput.h b/src/include/replication/pgoutput.h index 8cd29ab164..bfe8448ba9 100644 --- a/src/include/replication/pgoutput.h +++ b/src/include/replication/pgoutput.h @@ -27,4 +27,4 @@ typedef struct PGOutputData List *publications; } PGOutputData; -#endif /* PGOUTPUT_H */ +#endif /* PGOUTPUT_H */ diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h index 17e47b385b..86effe106b 100644 --- a/src/include/replication/reorderbuffer.h +++ b/src/include/replication/reorderbuffer.h @@ -213,6 +213,15 @@ typedef struct ReorderBufferTXN uint64 nentries_mem; /* + * Has this transaction been spilled to disk? It's not always possible to + * deduce that fact by comparing nentries with nentries_mem, because e.g. + * subtransactions of a large transaction might get serialized together + * with the parent - if they're restored to memory they'd have + * nentries_mem == nentries. + */ + bool serialized; + + /* * List of ReorderBufferChange structs, including new Snapshots and new * CommandIds */ @@ -267,30 +276,30 @@ typedef struct ReorderBuffer ReorderBuffer; /* change callback signature */ typedef void (*ReorderBufferApplyChangeCB) ( - ReorderBuffer *rb, - ReorderBufferTXN *txn, - Relation relation, - ReorderBufferChange *change); + ReorderBuffer *rb, + ReorderBufferTXN *txn, + Relation relation, + ReorderBufferChange *change); /* begin callback signature */ typedef void (*ReorderBufferBeginCB) ( - ReorderBuffer *rb, - ReorderBufferTXN *txn); + ReorderBuffer *rb, + ReorderBufferTXN *txn); /* commit callback signature */ typedef void (*ReorderBufferCommitCB) ( - ReorderBuffer *rb, - ReorderBufferTXN *txn, - XLogRecPtr commit_lsn); + ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr commit_lsn); /* message callback signature */ typedef void (*ReorderBufferMessageCB) ( - ReorderBuffer *rb, - ReorderBufferTXN *txn, - XLogRecPtr message_lsn, - bool transactional, - const char *prefix, Size sz, - const char *message); + ReorderBuffer *rb, + ReorderBufferTXN *txn, + XLogRecPtr message_lsn, + bool transactional, + const char *prefix, Size sz, + const char *message); struct ReorderBuffer { @@ -372,7 +381,7 @@ void ReorderBufferQueueMessage(ReorderBuffer *, TransactionId, Snapshot snapshot Size message_size, const char *message); void ReorderBufferCommit(ReorderBuffer *, TransactionId, XLogRecPtr commit_lsn, XLogRecPtr end_lsn, - TimestampTz commit_time, RepOriginId origin_id, XLogRecPtr origin_lsn); + TimestampTz commit_time, RepOriginId origin_id, XLogRecPtr origin_lsn); void ReorderBufferAssignChild(ReorderBuffer *, TransactionId, TransactionId, XLogRecPtr commit_lsn); void ReorderBufferCommitChild(ReorderBuffer *, TransactionId, TransactionId, XLogRecPtr commit_lsn, XLogRecPtr end_lsn); @@ -386,7 +395,7 @@ void ReorderBufferAddNewCommandId(ReorderBuffer *, TransactionId, XLogRecPtr lsn CommandId cid); void ReorderBufferAddNewTupleCids(ReorderBuffer *, TransactionId, XLogRecPtr lsn, RelFileNode node, ItemPointerData pt, - CommandId cmin, CommandId cmax, CommandId combocid); + CommandId cmin, CommandId cmax, CommandId combocid); void ReorderBufferAddInvalidations(ReorderBuffer *, TransactionId, XLogRecPtr lsn, Size nmsgs, SharedInvalidationMessage *msgs); void ReorderBufferImmediateInvalidation(ReorderBuffer *, uint32 ninvalidations, diff --git a/src/include/replication/slot.h b/src/include/replication/slot.h index 9a2dbd7b61..a283f4e2b8 100644 --- a/src/include/replication/slot.h +++ b/src/include/replication/slot.h @@ -184,4 +184,4 @@ extern void CheckPointReplicationSlots(void); extern void CheckSlotRequirements(void); -#endif /* SLOT_H */ +#endif /* SLOT_H */ diff --git a/src/include/replication/snapbuild.h b/src/include/replication/snapbuild.h index dc676a0ce2..7653717f83 100644 --- a/src/include/replication/snapbuild.h +++ b/src/include/replication/snapbuild.h @@ -87,4 +87,4 @@ extern void SnapBuildProcessRunningXacts(SnapBuild *builder, XLogRecPtr lsn, struct xl_running_xacts *running); extern void SnapBuildSerializationPoint(SnapBuild *builder, XLogRecPtr lsn); -#endif /* SNAPBUILD_H */ +#endif /* SNAPBUILD_H */ diff --git a/src/include/replication/syncrep.h b/src/include/replication/syncrep.h index 1676ea0952..ceafe2cbea 100644 --- a/src/include/replication/syncrep.h +++ b/src/include/replication/syncrep.h @@ -94,4 +94,4 @@ extern void syncrep_yyerror(const char *str); extern void syncrep_scanner_init(const char *query_string); extern void syncrep_scanner_finish(void); -#endif /* _SYNCREP_H */ +#endif /* _SYNCREP_H */ diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h index 31d090c99d..c8652dbd48 100644 --- a/src/include/replication/walreceiver.h +++ b/src/include/replication/walreceiver.h @@ -153,7 +153,7 @@ typedef struct struct { uint32 proto_version; /* Logical protocol version */ - List *publication_names; /* String list of publications */ + List *publication_names; /* String list of publications */ } logical; } proto; } WalRcvStreamOptions; @@ -192,33 +192,33 @@ typedef struct WalRcvExecResult /* libpqwalreceiver hooks */ typedef WalReceiverConn *(*walrcv_connect_fn) (const char *conninfo, bool logical, - const char *appname, - char **err); + const char *appname, + char **err); typedef void (*walrcv_check_conninfo_fn) (const char *conninfo); typedef char *(*walrcv_get_conninfo_fn) (WalReceiverConn *conn); typedef char *(*walrcv_identify_system_fn) (WalReceiverConn *conn, - TimeLineID *primary_tli, - int *server_version); + TimeLineID *primary_tli, + int *server_version); typedef void (*walrcv_readtimelinehistoryfile_fn) (WalReceiverConn *conn, - TimeLineID tli, - char **filename, - char **content, int *size); + TimeLineID tli, + char **filename, + char **content, int *size); typedef bool (*walrcv_startstreaming_fn) (WalReceiverConn *conn, - const WalRcvStreamOptions *options); + const WalRcvStreamOptions *options); typedef void (*walrcv_endstreaming_fn) (WalReceiverConn *conn, - TimeLineID *next_tli); + TimeLineID *next_tli); typedef int (*walrcv_receive_fn) (WalReceiverConn *conn, char **buffer, - pgsocket *wait_fd); + pgsocket *wait_fd); typedef void (*walrcv_send_fn) (WalReceiverConn *conn, const char *buffer, - int nbytes); + int nbytes); typedef char *(*walrcv_create_slot_fn) (WalReceiverConn *conn, const char *slotname, bool temporary, - CRSSnapshotAction snapshot_action, - XLogRecPtr *lsn); + CRSSnapshotAction snapshot_action, + XLogRecPtr *lsn); typedef WalRcvExecResult *(*walrcv_exec_fn) (WalReceiverConn *conn, - const char *query, - const int nRetTypes, - const Oid *retTypes); + const char *query, + const int nRetTypes, + const Oid *retTypes); typedef void (*walrcv_disconnect_fn) (WalReceiverConn *conn); typedef struct WalReceiverFunctionsType @@ -298,4 +298,4 @@ extern int GetReplicationApplyDelay(void); extern int GetReplicationTransferLatency(void); extern void WalRcvForceReply(void); -#endif /* _WALRECEIVER_H */ +#endif /* _WALRECEIVER_H */ diff --git a/src/include/replication/walsender.h b/src/include/replication/walsender.h index c50e450ec2..1f20db827a 100644 --- a/src/include/replication/walsender.h +++ b/src/include/replication/walsender.h @@ -72,4 +72,4 @@ extern void WalSndRqstFileReload(void); } \ } while (0) -#endif /* _WALSENDER_H */ +#endif /* _WALSENDER_H */ diff --git a/src/include/replication/walsender_private.h b/src/include/replication/walsender_private.h index 36311e124c..0aa80d5c3e 100644 --- a/src/include/replication/walsender_private.h +++ b/src/include/replication/walsender_private.h @@ -114,4 +114,4 @@ extern void replication_scanner_finish(void); extern Node *replication_parse_result; -#endif /* _WALSENDER_PRIVATE_H */ +#endif /* _WALSENDER_PRIVATE_H */ diff --git a/src/include/replication/worker_internal.h b/src/include/replication/worker_internal.h index 2bfff5c120..494a3a3d08 100644 --- a/src/include/replication/worker_internal.h +++ b/src/include/replication/worker_internal.h @@ -90,4 +90,4 @@ am_tablesync_worker(void) return OidIsValid(MyLogicalRepWorker->relid); } -#endif /* WORKER_INTERNAL_H */ +#endif /* WORKER_INTERNAL_H */ diff --git a/src/include/rewrite/prs2lock.h b/src/include/rewrite/prs2lock.h index 36dca02a7e..419d140bd5 100644 --- a/src/include/rewrite/prs2lock.h +++ b/src/include/rewrite/prs2lock.h @@ -43,4 +43,4 @@ typedef struct RuleLock RewriteRule **rules; } RuleLock; -#endif /* REWRITE_H */ +#endif /* REWRITE_H */ diff --git a/src/include/rewrite/rewriteDefine.h b/src/include/rewrite/rewriteDefine.h index 5495700970..2e25288bb4 100644 --- a/src/include/rewrite/rewriteDefine.h +++ b/src/include/rewrite/rewriteDefine.h @@ -41,4 +41,4 @@ extern void setRuleCheckAsUser(Node *node, Oid userid); extern void EnableDisableRule(Relation rel, const char *rulename, char fires_when); -#endif /* REWRITEDEFINE_H */ +#endif /* REWRITEDEFINE_H */ diff --git a/src/include/rewrite/rewriteHandler.h b/src/include/rewrite/rewriteHandler.h index 4504968437..bbac12707d 100644 --- a/src/include/rewrite/rewriteHandler.h +++ b/src/include/rewrite/rewriteHandler.h @@ -34,4 +34,4 @@ extern int relation_is_updatable(Oid reloid, extern List *QueryRewriteCTAS(Query *parsetree); #endif -#endif /* REWRITEHANDLER_H */ +#endif /* REWRITEHANDLER_H */ diff --git a/src/include/rewrite/rewriteManip.h b/src/include/rewrite/rewriteManip.h index 3910bceb2a..282ff9967f 100644 --- a/src/include/rewrite/rewriteManip.h +++ b/src/include/rewrite/rewriteManip.h @@ -20,7 +20,7 @@ typedef struct replace_rte_variables_context replace_rte_variables_context; typedef Node *(*replace_rte_variables_callback) (Var *var, - replace_rte_variables_context *context); + replace_rte_variables_context *context); struct replace_rte_variables_context { @@ -28,7 +28,7 @@ struct replace_rte_variables_context void *callback_arg; /* context data for callback function */ int target_varno; /* RTE index to search for */ int sublevels_up; /* (current) nesting depth */ - bool inserted_sublink; /* have we inserted a SubLink? */ + bool inserted_sublink; /* have we inserted a SubLink? */ }; typedef enum ReplaceVarsNoMatchOption @@ -82,4 +82,4 @@ extern Node *ReplaceVarsFromTargetList(Node *node, int nomatch_varno, bool *outer_hasSubLinks); -#endif /* REWRITEMANIP_H */ +#endif /* REWRITEMANIP_H */ diff --git a/src/include/rewrite/rewriteRemove.h b/src/include/rewrite/rewriteRemove.h index 28c9be72db..d7d53b0137 100644 --- a/src/include/rewrite/rewriteRemove.h +++ b/src/include/rewrite/rewriteRemove.h @@ -18,4 +18,4 @@ extern void RemoveRewriteRuleById(Oid ruleOid); -#endif /* REWRITEREMOVE_H */ +#endif /* REWRITEREMOVE_H */ diff --git a/src/include/rewrite/rewriteSupport.h b/src/include/rewrite/rewriteSupport.h index d287bbda78..60800aae25 100644 --- a/src/include/rewrite/rewriteSupport.h +++ b/src/include/rewrite/rewriteSupport.h @@ -23,4 +23,4 @@ extern void SetRelationRuleStatus(Oid relationId, bool relHasRules); extern Oid get_rewrite_oid(Oid relid, const char *rulename, bool missing_ok); -#endif /* REWRITESUPPORT_H */ +#endif /* REWRITESUPPORT_H */ diff --git a/src/include/rewrite/rowsecurity.h b/src/include/rewrite/rowsecurity.h index 0e739fd334..0dbc1a4bee 100644 --- a/src/include/rewrite/rowsecurity.h +++ b/src/include/rewrite/rowsecurity.h @@ -35,7 +35,7 @@ typedef struct RowSecurityDesc } RowSecurityDesc; typedef List *(*row_security_policy_hook_type) (CmdType cmdtype, - Relation relation); + Relation relation); extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_permissive; @@ -46,4 +46,4 @@ extern void get_row_security_policies(Query *root, List **securityQuals, List **withCheckOptions, bool *hasRowSecurity, bool *hasSubLinks); -#endif /* ROWSECURITY_H */ +#endif /* ROWSECURITY_H */ diff --git a/src/include/rusagestub.h b/src/include/rusagestub.h index 0e366cab10..f54f66e6f3 100644 --- a/src/include/rusagestub.h +++ b/src/include/rusagestub.h @@ -29,6 +29,6 @@ struct rusage struct timeval ru_stime; /* system time used */ }; -extern int getrusage(int who, struct rusage * rusage); +extern int getrusage(int who, struct rusage *rusage); -#endif /* RUSAGESTUB_H */ +#endif /* RUSAGESTUB_H */ diff --git a/src/include/snowball/header.h b/src/include/snowball/header.h index d8be02ee60..10acf4c53d 100644 --- a/src/include/snowball/header.h +++ b/src/include/snowball/header.h @@ -64,4 +64,4 @@ #endif #define free(a) pfree(a) -#endif /* SNOWBALL_HEADR_H */ +#endif /* SNOWBALL_HEADR_H */ diff --git a/src/include/statistics/extended_stats_internal.h b/src/include/statistics/extended_stats_internal.h index dc72e2f479..738ff3fadc 100644 --- a/src/include/statistics/extended_stats_internal.h +++ b/src/include/statistics/extended_stats_internal.h @@ -66,4 +66,4 @@ extern int multi_sort_compare_dim(int dim, const SortItem *a, extern int multi_sort_compare_dims(int start, int end, const SortItem *a, const SortItem *b, MultiSortSupport mss); -#endif /* EXTENDED_STATS_INTERNAL_H */ +#endif /* EXTENDED_STATS_INTERNAL_H */ diff --git a/src/include/statistics/statistics.h b/src/include/statistics/statistics.h index a3f0d90195..1d68c39df0 100644 --- a/src/include/statistics/statistics.h +++ b/src/include/statistics/statistics.h @@ -16,7 +16,7 @@ #include "commands/vacuum.h" #include "nodes/relation.h" -#define STATS_MAX_DIMENSIONS 8 /* max number of attributes */ +#define STATS_MAX_DIMENSIONS 8 /* max number of attributes */ /* Multivariate distinct coefficients */ #define STATS_NDISTINCT_MAGIC 0xA352BFA4 /* struct identifier */ @@ -28,6 +28,7 @@ typedef struct MVNDistinctItem double ndistinct; /* ndistinct value for this combination */ Bitmapset *attrs; /* attr numbers of items */ } MVNDistinctItem; + /* size of the struct, excluding attribute list */ #define SizeOfMVNDistinctItem \ (offsetof(MVNDistinctItem, ndistinct) + sizeof(double)) @@ -48,8 +49,8 @@ typedef struct MVNDistinct /* size of the struct excluding the items array */ #define SizeOfMVNDistinct (offsetof(MVNDistinct, nitems) + sizeof(uint32)) -#define STATS_DEPS_MAGIC 0xB4549A2C /* marks serialized bytea */ -#define STATS_DEPS_TYPE_BASIC 1 /* basic dependencies type */ +#define STATS_DEPS_MAGIC 0xB4549A2C /* marks serialized bytea */ +#define STATS_DEPS_TYPE_BASIC 1 /* basic dependencies type */ /* * Functional dependencies, tracking column-level relationships (values @@ -59,7 +60,7 @@ typedef struct MVDependency { double degree; /* degree of validity (0-1) */ AttrNumber nattributes; /* number of attributes */ - AttrNumber attributes[FLEXIBLE_ARRAY_MEMBER]; /* attribute numbers */ + AttrNumber attributes[FLEXIBLE_ARRAY_MEMBER]; /* attribute numbers */ } MVDependency; /* size of the struct excluding the deps array */ @@ -78,7 +79,7 @@ typedef struct MVDependencies #define SizeOfDependencies (offsetof(MVDependencies, ndeps) + sizeof(uint32)) extern MVNDistinct *statext_ndistinct_load(Oid mvoid); -extern MVDependencies *staext_dependencies_load(Oid mvoid); +extern MVDependencies *statext_dependencies_load(Oid mvoid); extern void BuildRelationExtStatistics(Relation onerel, double totalrows, int numrows, HeapTuple *rows, @@ -95,4 +96,4 @@ extern bool has_stats_of_kind(List *stats, char requiredkind); extern StatisticExtInfo *choose_best_statistics(List *stats, Bitmapset *attnums, char requiredkind); -#endif /* STATISTICS_H */ +#endif /* STATISTICS_H */ diff --git a/src/include/storage/backendid.h b/src/include/storage/backendid.h index 3445caeb93..5dea030510 100644 --- a/src/include/storage/backendid.h +++ b/src/include/storage/backendid.h @@ -23,7 +23,7 @@ typedef int BackendId; /* unique currently active backend identifier */ #define InvalidBackendId (-1) -extern PGDLLIMPORT BackendId MyBackendId; /* backend id of this backend */ +extern PGDLLIMPORT BackendId MyBackendId; /* backend id of this backend */ #ifdef XCP /* @@ -51,4 +51,4 @@ extern PGDLLIMPORT BackendId ParallelMasterBackendId; #define BackendIdForTempRelations() \ (ParallelMasterBackendId == InvalidBackendId ? MyBackendId : ParallelMasterBackendId) -#endif /* BACKENDID_H */ +#endif /* BACKENDID_H */ diff --git a/src/include/storage/block.h b/src/include/storage/block.h index ec847bbb7a..33840798a8 100644 --- a/src/include/storage/block.h +++ b/src/include/storage/block.h @@ -118,4 +118,4 @@ typedef BlockIdData *BlockId; /* block identifier */ (BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) \ ) -#endif /* BLOCK_H */ +#endif /* BLOCK_H */ diff --git a/src/include/storage/buf.h b/src/include/storage/buf.h index ac33b83b4b..054f482bd7 100644 --- a/src/include/storage/buf.h +++ b/src/include/storage/buf.h @@ -43,4 +43,4 @@ typedef int Buffer; */ typedef struct BufferAccessStrategyData *BufferAccessStrategy; -#endif /* BUF_H */ +#endif /* BUF_H */ diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index ff99f6b5e2..b768b6fc96 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -55,17 +55,17 @@ * Note: TAG_VALID essentially means that there is a buffer hashtable * entry associated with the buffer's tag. */ -#define BM_LOCKED (1U << 22) /* buffer header is locked */ -#define BM_DIRTY (1U << 23) /* data needs writing */ -#define BM_VALID (1U << 24) /* data is valid */ -#define BM_TAG_VALID (1U << 25) /* tag is assigned */ -#define BM_IO_IN_PROGRESS (1U << 26) /* read or write in progress */ -#define BM_IO_ERROR (1U << 27) /* previous I/O failed */ -#define BM_JUST_DIRTIED (1U << 28) /* dirtied since write started */ -#define BM_PIN_COUNT_WAITER (1U << 29) /* have waiter for sole pin */ -#define BM_CHECKPOINT_NEEDED (1U << 30) /* must write for checkpoint */ -#define BM_PERMANENT (1U << 31) /* permanent buffer (not - * unlogged, or init fork) */ +#define BM_LOCKED (1U << 22) /* buffer header is locked */ +#define BM_DIRTY (1U << 23) /* data needs writing */ +#define BM_VALID (1U << 24) /* data is valid */ +#define BM_TAG_VALID (1U << 25) /* tag is assigned */ +#define BM_IO_IN_PROGRESS (1U << 26) /* read or write in progress */ +#define BM_IO_ERROR (1U << 27) /* previous I/O failed */ +#define BM_JUST_DIRTIED (1U << 28) /* dirtied since write started */ +#define BM_PIN_COUNT_WAITER (1U << 29) /* have waiter for sole pin */ +#define BM_CHECKPOINT_NEEDED (1U << 30) /* must write for checkpoint */ +#define BM_PERMANENT (1U << 31) /* permanent buffer (not unlogged, + * or init fork) */ /* * The maximum allowed value of usage_count represents a tradeoff between * accuracy and speed of the clock-sweep buffer management algorithm. A @@ -183,7 +183,7 @@ typedef struct BufferDesc /* state of the tag, containing flags, refcount and usagecount */ pg_atomic_uint32 state; - int wait_backend_pid; /* backend PID of pin-count waiter */ + int wait_backend_pid; /* backend PID of pin-count waiter */ int freeNext; /* link in freelist chain */ LWLock content_lock; /* to lock access to buffer contents */ @@ -337,4 +337,4 @@ extern void DropRelFileNodeLocalBuffers(RelFileNode rnode, ForkNumber forkNum, extern void DropRelFileNodeAllLocalBuffers(RelFileNode rnode); extern void AtEOXact_LocalBuffers(bool isCommit); -#endif /* BUFMGR_INTERNALS_H */ +#endif /* BUFMGR_INTERNALS_H */ diff --git a/src/include/storage/buffile.h b/src/include/storage/buffile.h index fe00bf0c31..fafcb3f089 100644 --- a/src/include/storage/buffile.h +++ b/src/include/storage/buffile.h @@ -42,4 +42,4 @@ extern int BufFileSeek(BufFile *file, int fileno, off_t offset, int whence); extern void BufFileTell(BufFile *file, int *fileno, off_t *offset); extern int BufFileSeekBlock(BufFile *file, long blknum); -#endif /* BUFFILE_H */ +#endif /* BUFFILE_H */ diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index 07a32d6dfc..98b63fc5ba 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -79,7 +79,7 @@ extern PGDLLIMPORT int32 *LocalRefCount; #define MAX_IO_CONCURRENCY 1000 /* special block number for ReadBuffer() */ -#define P_NEW InvalidBlockNumber /* grow the file to get a new page */ +#define P_NEW InvalidBlockNumber /* grow the file to get a new page */ /* * Buffer content lock modes (mode argument for LockBuffer()) @@ -275,6 +275,6 @@ TestForOldSnapshot(Snapshot snapshot, Relation relation, Page page) TestForOldSnapshot_impl(snapshot, relation); } -#endif /* FRONTEND */ +#endif /* FRONTEND */ -#endif /* BUFMGR_H */ +#endif /* BUFMGR_H */ diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h index e956dc3386..50c72a3c8d 100644 --- a/src/include/storage/bufpage.h +++ b/src/include/storage/bufpage.h @@ -173,13 +173,12 @@ typedef PageHeaderData *PageHeader; * page for its new tuple version; this suggests that a prune is needed. * Again, this is just a hint. */ -#define PD_HAS_FREE_LINES 0x0001 /* are there any unused line pointers? */ -#define PD_PAGE_FULL 0x0002 /* not enough free space for new - * tuple? */ -#define PD_ALL_VISIBLE 0x0004 /* all tuples on page are visible to - * everyone */ +#define PD_HAS_FREE_LINES 0x0001 /* are there any unused line pointers? */ +#define PD_PAGE_FULL 0x0002 /* not enough free space for new tuple? */ +#define PD_ALL_VISIBLE 0x0004 /* all tuples on page are visible to + * everyone */ -#define PD_VALID_FLAG_BITS 0x0007 /* OR of all valid pd_flags bits */ +#define PD_VALID_FLAG_BITS 0x0007 /* OR of all valid pd_flags bits */ /* * Page layout version number 0 is for pre-7.3 Postgres releases. @@ -436,4 +435,4 @@ extern bool PageIndexTupleOverwrite(Page page, OffsetNumber offnum, extern char *PageSetChecksumCopy(Page page, BlockNumber blkno); extern void PageSetChecksumInplace(Page page, BlockNumber blkno); -#endif /* BUFPAGE_H */ +#endif /* BUFPAGE_H */ diff --git a/src/include/storage/checksum.h b/src/include/storage/checksum.h index 682043f8e7..b85f714712 100644 --- a/src/include/storage/checksum.h +++ b/src/include/storage/checksum.h @@ -21,4 +21,4 @@ */ extern uint16 pg_checksum_page(char *page, BlockNumber blkno); -#endif /* CHECKSUM_H */ +#endif /* CHECKSUM_H */ diff --git a/src/include/storage/condition_variable.h b/src/include/storage/condition_variable.h index 89f5d5804b..f77c0b22ad 100644 --- a/src/include/storage/condition_variable.h +++ b/src/include/storage/condition_variable.h @@ -56,4 +56,4 @@ extern void ConditionVariablePrepareToSleep(ConditionVariable *); extern bool ConditionVariableSignal(ConditionVariable *); extern int ConditionVariableBroadcast(ConditionVariable *); -#endif /* CONDITION_VARIABLE_H */ +#endif /* CONDITION_VARIABLE_H */ diff --git a/src/include/storage/copydir.h b/src/include/storage/copydir.h index c3722b4033..f88a044509 100644 --- a/src/include/storage/copydir.h +++ b/src/include/storage/copydir.h @@ -16,4 +16,4 @@ extern void copydir(char *fromdir, char *todir, bool recurse); extern void copy_file(char *fromfile, char *tofile); -#endif /* COPYDIR_H */ +#endif /* COPYDIR_H */ diff --git a/src/include/storage/dsm.h b/src/include/storage/dsm.h index 7d1250c1e0..31b1f4da9c 100644 --- a/src/include/storage/dsm.h +++ b/src/include/storage/dsm.h @@ -60,4 +60,4 @@ extern void cancel_on_dsm_detach(dsm_segment *seg, on_dsm_detach_callback function, Datum arg); extern void reset_on_dsm_detach(void); -#endif /* DSM_H */ +#endif /* DSM_H */ diff --git a/src/include/storage/dsm_impl.h b/src/include/storage/dsm_impl.h index 51c217899d..c2060431ba 100644 --- a/src/include/storage/dsm_impl.h +++ b/src/include/storage/dsm_impl.h @@ -77,4 +77,4 @@ extern void dsm_impl_pin_segment(dsm_handle handle, void *impl_private, void **impl_private_pm_handle); extern void dsm_impl_unpin_segment(dsm_handle handle, void **impl_private); -#endif /* DSM_IMPL_H */ +#endif /* DSM_IMPL_H */ diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index 05680499e4..faef39e78d 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -127,4 +127,4 @@ extern void SyncDataDirectory(void); #define PG_TEMP_FILES_DIR "pgsql_tmp" #define PG_TEMP_FILE_PREFIX "pgsql_tmp" -#endif /* FD_H */ +#endif /* FD_H */ diff --git a/src/include/storage/freespace.h b/src/include/storage/freespace.h index 9a5c9f4be4..d110f006af 100644 --- a/src/include/storage/freespace.h +++ b/src/include/storage/freespace.h @@ -37,4 +37,4 @@ extern void UpdateFreeSpaceMap(Relation rel, BlockNumber endBlkNum, Size freespace); -#endif /* FREESPACE_H_ */ +#endif /* FREESPACE_H_ */ diff --git a/src/include/storage/fsm_internals.h b/src/include/storage/fsm_internals.h index 4eb3fc12b1..722e649123 100644 --- a/src/include/storage/fsm_internals.h +++ b/src/include/storage/fsm_internals.h @@ -69,4 +69,4 @@ extern bool fsm_set_avail(Page page, int slot, uint8 value); extern bool fsm_truncate_avail(Page page, int nslots); extern bool fsm_rebuild_page(Page page); -#endif /* FSM_INTERNALS_H */ +#endif /* FSM_INTERNALS_H */ diff --git a/src/include/storage/indexfsm.h b/src/include/storage/indexfsm.h index b256ee6aef..f8045f0df8 100644 --- a/src/include/storage/indexfsm.h +++ b/src/include/storage/indexfsm.h @@ -23,4 +23,4 @@ extern void RecordUsedIndexPage(Relation rel, BlockNumber page); extern void IndexFreeSpaceMapVacuum(Relation rel); -#endif /* INDEXFSM_H_ */ +#endif /* INDEXFSM_H_ */ diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h index 8d5a6b2698..bde635f502 100644 --- a/src/include/storage/ipc.h +++ b/src/include/storage/ipc.h @@ -77,4 +77,4 @@ extern PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook; extern void CreateSharedMemoryAndSemaphores(bool makePrivate, int port); -#endif /* IPC_H */ +#endif /* IPC_H */ diff --git a/src/include/storage/item.h b/src/include/storage/item.h index d19e19e01b..72426a2d48 100644 --- a/src/include/storage/item.h +++ b/src/include/storage/item.h @@ -16,4 +16,4 @@ typedef Pointer Item; -#endif /* ITEM_H */ +#endif /* ITEM_H */ diff --git a/src/include/storage/itemid.h b/src/include/storage/itemid.h index af77852cc0..2ec86b57fc 100644 --- a/src/include/storage/itemid.h +++ b/src/include/storage/itemid.h @@ -180,4 +180,4 @@ typedef uint16 ItemLength; (itemId)->lp_flags = LP_DEAD \ ) -#endif /* ITEMID_H */ +#endif /* ITEMID_H */ diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h index c21d2adfcb..8f8e22444a 100644 --- a/src/include/storage/itemptr.h +++ b/src/include/storage/itemptr.h @@ -38,6 +38,7 @@ typedef struct ItemPointerData BlockIdData ip_blkid; OffsetNumber ip_posid; } + /* If compiler understands packed and aligned pragmas, use those */ #if defined(pg_attribute_packed) && defined(pg_attribute_aligned) pg_attribute_packed() @@ -161,4 +162,4 @@ typedef ItemPointerData *ItemPointer; extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2); extern int32 ItemPointerCompare(ItemPointer arg1, ItemPointer arg2); -#endif /* ITEMPTR_H */ +#endif /* ITEMPTR_H */ diff --git a/src/include/storage/large_object.h b/src/include/storage/large_object.h index fc55019b98..796a8fdeea 100644 --- a/src/include/storage/large_object.h +++ b/src/include/storage/large_object.h @@ -94,4 +94,4 @@ extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes); extern int inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes); extern void inv_truncate(LargeObjectDesc *obj_desc, int64 len); -#endif /* LARGE_OBJECT_H */ +#endif /* LARGE_OBJECT_H */ diff --git a/src/include/storage/latch.h b/src/include/storage/latch.h index 3158d7bec6..73abfafec5 100644 --- a/src/include/storage/latch.h +++ b/src/include/storage/latch.h @@ -176,4 +176,4 @@ extern void latch_sigusr1_handler(void); #define latch_sigusr1_handler() ((void) 0) #endif -#endif /* LATCH_H */ +#endif /* LATCH_H */ diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index 2a1244c836..0b923227a2 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.h @@ -106,4 +106,4 @@ extern void DescribeLockTag(StringInfo buf, const LOCKTAG *tag); extern const char *GetLockNameFromTagType(uint16 locktag_type); -#endif /* LMGR_H */ +#endif /* LMGR_H */ diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 3abeb59fc7..2f5874644b 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -42,7 +42,7 @@ extern bool Trace_locks; extern bool Trace_userlocks; extern int Trace_lock_table; extern bool Debug_deadlocks; -#endif /* LOCK_DEBUG */ +#endif /* LOCK_DEBUG */ /* @@ -63,8 +63,7 @@ extern bool Debug_deadlocks; typedef struct { BackendId backendId; /* determined at backend startup */ - LocalTransactionId localTransactionId; /* backend-local transaction - * id */ + LocalTransactionId localTransactionId; /* backend-local transaction id */ } VirtualTransactionId; #define InvalidLocalTransactionId 0 @@ -113,7 +112,7 @@ typedef struct LockMethodData { int numLockModes; const LOCKMASK *conflictTab; - const char *const * lockModeNames; + const char *const *lockModeNames; const bool *trace_flag; } LockMethodData; @@ -292,7 +291,7 @@ typedef struct LOCK LOCKMASK waitMask; /* bitmask for lock types awaited */ SHM_QUEUE procLocks; /* list of PROCLOCK objects assoc. with lock */ PROC_QUEUE waitProcs; /* list of PGPROC objects waiting on lock */ - int requested[MAX_LOCKMODES]; /* counts of requested locks */ + int requested[MAX_LOCKMODES]; /* counts of requested locks */ int nRequested; /* total of requested[] array */ int granted[MAX_LOCKMODES]; /* counts of granted locks */ int nGranted; /* total of granted[] array */ @@ -587,4 +586,4 @@ extern void VirtualXactLockTableInsert(VirtualTransactionId vxid); extern void VirtualXactLockTableCleanup(void); extern bool VirtualXactLock(VirtualTransactionId vxid, bool wait); -#endif /* LOCK_H */ +#endif /* LOCK_H */ diff --git a/src/include/storage/lockdefs.h b/src/include/storage/lockdefs.h index bfeb8779f7..fe9f7cb310 100644 --- a/src/include/storage/lockdefs.h +++ b/src/include/storage/lockdefs.h @@ -33,18 +33,17 @@ typedef int LOCKMODE; /* NoLock is not a lock mode, but a flag value meaning "don't get a lock" */ #define NoLock 0 -#define AccessShareLock 1 /* SELECT */ -#define RowShareLock 2 /* SELECT FOR UPDATE/FOR SHARE */ -#define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */ -#define ShareUpdateExclusiveLock 4 /* VACUUM (non-FULL),ANALYZE, CREATE - * INDEX CONCURRENTLY */ -#define ShareLock 5 /* CREATE INDEX (WITHOUT CONCURRENTLY) */ -#define ShareRowExclusiveLock 6 /* like EXCLUSIVE MODE, but allows ROW - * SHARE */ -#define ExclusiveLock 7 /* blocks ROW SHARE/SELECT...FOR - * UPDATE */ -#define AccessExclusiveLock 8 /* ALTER TABLE, DROP TABLE, VACUUM - * FULL, and unqualified LOCK TABLE */ +#define AccessShareLock 1 /* SELECT */ +#define RowShareLock 2 /* SELECT FOR UPDATE/FOR SHARE */ +#define RowExclusiveLock 3 /* INSERT, UPDATE, DELETE */ +#define ShareUpdateExclusiveLock 4 /* VACUUM (non-FULL),ANALYZE, CREATE INDEX + * CONCURRENTLY */ +#define ShareLock 5 /* CREATE INDEX (WITHOUT CONCURRENTLY) */ +#define ShareRowExclusiveLock 6 /* like EXCLUSIVE MODE, but allows ROW + * SHARE */ +#define ExclusiveLock 7 /* blocks ROW SHARE/SELECT...FOR UPDATE */ +#define AccessExclusiveLock 8 /* ALTER TABLE, DROP TABLE, VACUUM FULL, + * and unqualified LOCK TABLE */ typedef struct xl_standby_lock { @@ -53,4 +52,4 @@ typedef struct xl_standby_lock Oid relOid; } xl_standby_lock; -#endif /* LOCKDEF_H_ */ +#endif /* LOCKDEF_H_ */ diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h index c22daef179..7e0859d0d5 100644 --- a/src/include/storage/lwlock.h +++ b/src/include/storage/lwlock.h @@ -216,7 +216,7 @@ typedef enum BuiltinTrancheIds LWTRANCHE_PARALLEL_QUERY_DSA, LWTRANCHE_TBM, LWTRANCHE_FIRST_USER_DEFINED -} BuiltinTrancheIds; +} BuiltinTrancheIds; /* * Prior to PostgreSQL 9.4, we used an enum type called LWLockId to refer @@ -225,4 +225,4 @@ typedef enum BuiltinTrancheIds */ typedef LWLock *LWLockId; -#endif /* LWLOCK_H */ +#endif /* LWLOCK_H */ diff --git a/src/include/storage/off.h b/src/include/storage/off.h index fe8638fe15..7228808b94 100644 --- a/src/include/storage/off.h +++ b/src/include/storage/off.h @@ -26,7 +26,7 @@ typedef uint16 OffsetNumber; #define InvalidOffsetNumber ((OffsetNumber) 0) #define FirstOffsetNumber ((OffsetNumber) 1) #define MaxOffsetNumber ((OffsetNumber) (BLCKSZ / sizeof(ItemIdData))) -#define OffsetNumberMask (0xffff) /* valid uint16 bits */ +#define OffsetNumberMask (0xffff) /* valid uint16 bits */ /* ---------------- * support macros @@ -55,4 +55,4 @@ typedef uint16 OffsetNumber; #define OffsetNumberPrev(offsetNumber) \ ((OffsetNumber) (-1 + (offsetNumber))) -#endif /* OFF_H */ +#endif /* OFF_H */ diff --git a/src/include/storage/pg_sema.h b/src/include/storage/pg_sema.h index b819f41d19..65db86f578 100644 --- a/src/include/storage/pg_sema.h +++ b/src/include/storage/pg_sema.h @@ -58,4 +58,4 @@ extern void PGSemaphoreUnlock(PGSemaphore sema); /* Lock a semaphore only if able to do so without blocking */ extern bool PGSemaphoreTryLock(PGSemaphore sema); -#endif /* PG_SEMA_H */ +#endif /* PG_SEMA_H */ diff --git a/src/include/storage/pg_shmem.h b/src/include/storage/pg_shmem.h index a329c81899..e3ee096229 100644 --- a/src/include/storage/pg_shmem.h +++ b/src/include/storage/pg_shmem.h @@ -50,7 +50,7 @@ typedef enum HUGE_PAGES_OFF, HUGE_PAGES_ON, HUGE_PAGES_TRY -} HugePagesType; +} HugePagesType; #ifndef WIN32 extern unsigned long UsedShmemSegID; @@ -69,4 +69,4 @@ extern PGShmemHeader *PGSharedMemoryCreate(Size size, bool makePrivate, extern bool PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2); extern void PGSharedMemoryDetach(void); -#endif /* PG_SHMEM_H */ +#endif /* PG_SHMEM_H */ diff --git a/src/include/storage/pmsignal.h b/src/include/storage/pmsignal.h index 90ddfa3b31..4b954d7614 100644 --- a/src/include/storage/pmsignal.h +++ b/src/include/storage/pmsignal.h @@ -27,10 +27,10 @@ typedef enum PMSIGNAL_WAKEN_ARCHIVER, /* send a NOTIFY signal to xlog archiver */ PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */ PMSIGNAL_START_AUTOVAC_LAUNCHER, /* start an autovacuum launcher */ - PMSIGNAL_START_AUTOVAC_WORKER, /* start an autovacuum worker */ + PMSIGNAL_START_AUTOVAC_WORKER, /* start an autovacuum worker */ PMSIGNAL_BACKGROUND_WORKER_CHANGE, /* background worker state change */ PMSIGNAL_START_WALRECEIVER, /* start a walreceiver */ - PMSIGNAL_ADVANCE_STATE_MACHINE, /* advance postmaster's state machine */ + PMSIGNAL_ADVANCE_STATE_MACHINE, /* advance postmaster's state machine */ NUM_PMSIGNALS /* Must be last value of enum! */ } PMSignalReason; @@ -53,4 +53,4 @@ extern void MarkPostmasterChildInactive(void); extern void MarkPostmasterChildWalSender(void); extern bool PostmasterIsAlive(void); -#endif /* PMSIGNAL_H */ +#endif /* PMSIGNAL_H */ diff --git a/src/include/storage/predicate.h b/src/include/storage/predicate.h index 941ba7119e..06bcbf2471 100644 --- a/src/include/storage/predicate.h +++ b/src/include/storage/predicate.h @@ -74,4 +74,4 @@ extern void PredicateLockTwoPhaseFinish(TransactionId xid, bool isCommit); extern void predicatelock_twophase_recover(TransactionId xid, uint16 info, void *recdata, uint32 len); -#endif /* PREDICATE_H */ +#endif /* PREDICATE_H */ diff --git a/src/include/storage/predicate_internals.h b/src/include/storage/predicate_internals.h index 3cb0ab9bb0..89874a5c3b 100644 --- a/src/include/storage/predicate_internals.h +++ b/src/include/storage/predicate_internals.h @@ -78,10 +78,10 @@ typedef struct SERIALIZABLEXACT /* these values are not both interesting at the same time */ union { - SerCommitSeqNo earliestOutConflictCommit; /* when committed with - * conflict out */ - SerCommitSeqNo lastCommitBeforeSnapshot; /* when not committed or - * no conflict out */ + SerCommitSeqNo earliestOutConflictCommit; /* when committed with + * conflict out */ + SerCommitSeqNo lastCommitBeforeSnapshot; /* when not committed or + * no conflict out */ } SeqNo; SHM_QUEUE outConflicts; /* list of write transactions whose data we * couldn't read. */ @@ -99,18 +99,18 @@ typedef struct SERIALIZABLEXACT TransactionId topXid; /* top level xid for the transaction, if one * exists; else invalid */ - TransactionId finishedBefore; /* invalid means still running; else - * the struct expires when no - * serializable xids are before this. */ + TransactionId finishedBefore; /* invalid means still running; else the + * struct expires when no serializable + * xids are before this. */ TransactionId xmin; /* the transaction's snapshot xmin */ uint32 flags; /* OR'd combination of values defined below */ int pid; /* pid of associated process */ } SERIALIZABLEXACT; -#define SXACT_FLAG_COMMITTED 0x00000001 /* already committed */ -#define SXACT_FLAG_PREPARED 0x00000002 /* about to commit */ -#define SXACT_FLAG_ROLLED_BACK 0x00000004 /* already rolled back */ -#define SXACT_FLAG_DOOMED 0x00000008 /* will roll back */ +#define SXACT_FLAG_COMMITTED 0x00000001 /* already committed */ +#define SXACT_FLAG_PREPARED 0x00000002 /* about to commit */ +#define SXACT_FLAG_ROLLED_BACK 0x00000004 /* already rolled back */ +#define SXACT_FLAG_DOOMED 0x00000008 /* will roll back */ /* * The following flag actually means that the flagged transaction has a * conflict out *to a transaction which committed ahead of it*. It's hard @@ -135,7 +135,7 @@ typedef struct PredXactListElementData { SHM_QUEUE link; SERIALIZABLEXACT sxact; -} PredXactListElementData; +} PredXactListElementData; typedef struct PredXactListElementData *PredXactListElement; @@ -153,28 +153,27 @@ typedef struct PredXactListData * but are not needed outside the predicate.c source file. Protected by * SerializableXactHashLock. */ - TransactionId SxactGlobalXmin; /* global xmin for active serializable - * transactions */ + TransactionId SxactGlobalXmin; /* global xmin for active serializable + * transactions */ int SxactGlobalXminCount; /* how many active serializable * transactions have this xmin */ - int WritableSxactCount; /* how many non-read-only serializable - * transactions are active */ - SerCommitSeqNo LastSxactCommitSeqNo; /* a strictly monotonically - * increasing number for - * commits of serializable - * transactions */ + int WritableSxactCount; /* how many non-read-only serializable + * transactions are active */ + SerCommitSeqNo LastSxactCommitSeqNo; /* a strictly monotonically + * increasing number for commits + * of serializable transactions */ /* Protected by SerializableXactHashLock. */ - SerCommitSeqNo CanPartialClearThrough; /* can clear predicate locks - * and inConflicts for - * committed transactions - * through this seq no */ + SerCommitSeqNo CanPartialClearThrough; /* can clear predicate locks and + * inConflicts for committed + * transactions through this seq + * no */ /* Protected by SerializableFinishedListLock. */ SerCommitSeqNo HavePartialClearedThrough; /* have cleared through this * seq no */ - SERIALIZABLEXACT *OldCommittedSxact; /* shared copy of dummy sxact */ + SERIALIZABLEXACT *OldCommittedSxact; /* shared copy of dummy sxact */ PredXactListElement element; -} PredXactListData; +} PredXactListData; typedef struct PredXactListData *PredXactList; @@ -198,7 +197,7 @@ typedef struct RWConflictData SHM_QUEUE inLink; /* link for list of conflicts in to a sxact */ SERIALIZABLEXACT *sxactOut; SERIALIZABLEXACT *sxactIn; -} RWConflictData; +} RWConflictData; typedef struct RWConflictData *RWConflict; @@ -209,7 +208,7 @@ typedef struct RWConflictPoolHeaderData { SHM_QUEUE availableList; RWConflict element; -} RWConflictPoolHeaderData; +} RWConflictPoolHeaderData; typedef struct RWConflictPoolHeaderData *RWConflictPoolHeader; @@ -477,4 +476,4 @@ extern PredicateLockData *GetPredicateLockStatusData(void); extern int GetSafeSnapshotBlockingPids(int blocked_pid, int *output, int output_size); -#endif /* PREDICATE_INTERNALS_H */ +#endif /* PREDICATE_INTERNALS_H */ diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 0be7165d4f..4c8345db83 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -120,7 +120,7 @@ struct PGPROC * the distributed session */ #endif - bool isBackgroundWorker; /* true if background worker. */ + bool isBackgroundWorker; /* true if background worker. */ /* * While in hot standby mode, shows that a conflict signal has been sent @@ -188,7 +188,7 @@ struct PGPROC /* Lock manager data, recording fast-path locks taken by this backend. */ uint64 fpLockBits; /* lock modes held for each fast-path slot */ - Oid fpRelId[FP_LOCK_SLOTS_PER_BACKEND]; /* slots for rel oids */ + Oid fpRelId[FP_LOCK_SLOTS_PER_BACKEND]; /* slots for rel oids */ bool fpVXIDLock; /* are we holding a fast-path VXID lock? */ LocalTransactionId fpLocalTransactionId; /* lxid for fast-path VXID * lock */ @@ -198,7 +198,7 @@ struct PGPROC * leader to get the LWLock protecting these fields. */ PGPROC *lockGroupLeader; /* lock group leader, if I'm a member */ - dlist_head lockGroupMembers; /* list of members, if I'm a leader */ + dlist_head lockGroupMembers; /* list of members, if I'm a leader */ dlist_node lockGroupLink; /* my member link, if I'm a member */ }; @@ -331,4 +331,4 @@ extern PGPROC *AuxiliaryPidGetProc(int pid); extern void BecomeLockGroupLeader(void); extern bool BecomeLockGroupMember(PGPROC *leader, int pid); -#endif /* PROC_H */ +#endif /* PROC_H */ diff --git a/src/include/storage/procarray.h b/src/include/storage/procarray.h index 7dfe37f881..4e1622b174 100644 --- a/src/include/storage/procarray.h +++ b/src/include/storage/procarray.h @@ -38,16 +38,15 @@ typedef enum GlobalSnapshotSourceType * to avoid forcing to include proc.h when including procarray.h. So if you modify * PROC_XXX flags, you need to modify these flags. */ -#define PROCARRAY_VACUUM_FLAG 0x02 /* currently running - * lazy vacuum */ -#define PROCARRAY_ANALYZE_FLAG 0x04 /* currently running - * analyze */ -#define PROCARRAY_LOGICAL_DECODING_FLAG 0x10 /* currently doing - * logical decoding - * outside xact */ - -#define PROCARRAY_SLOTS_XMIN 0x20 /* replication slot - * xmin, catalog_xmin */ +#define PROCARRAY_VACUUM_FLAG 0x02 /* currently running lazy + * vacuum */ +#define PROCARRAY_ANALYZE_FLAG 0x04 /* currently running + * analyze */ +#define PROCARRAY_LOGICAL_DECODING_FLAG 0x10 /* currently doing logical + * decoding outside xact */ + +#define PROCARRAY_SLOTS_XMIN 0x20 /* replication slot xmin, + * catalog_xmin */ /* * Only flags in PROCARRAY_PROC_FLAGS_MASK are considered when matching * PGXACT->vacuumFlags. Other flags are used for different purposes and @@ -154,9 +153,9 @@ extern int GetFirstBackendId(int *numBackends, int *backends); #endif /* XCP */ extern void ProcArraySetReplicationSlotXmin(TransactionId xmin, - TransactionId catalog_xmin, bool already_locked); + TransactionId catalog_xmin, bool already_locked); extern void ProcArrayGetReplicationSlotXmin(TransactionId *xmin, TransactionId *catalog_xmin); -#endif /* PROCARRAY_H */ +#endif /* PROCARRAY_H */ diff --git a/src/include/storage/procsignal.h b/src/include/storage/procsignal.h index d58c1bede9..9b8f067a4e 100644 --- a/src/include/storage/procsignal.h +++ b/src/include/storage/procsignal.h @@ -46,8 +46,7 @@ typedef enum PROCSIG_PGXCPOOL_REFRESH, /* refresh local view of connection handles */ #endif PROCSIG_PARALLEL_MESSAGE, /* message from cooperating parallel backend */ - PROCSIG_WALSND_INIT_STOPPING, /* ask walsenders to prepare for - * shutdown */ + PROCSIG_WALSND_INIT_STOPPING, /* ask walsenders to prepare for shutdown */ /* Recovery conflict reasons */ PROCSIG_RECOVERY_CONFLICT_DATABASE, @@ -72,4 +71,4 @@ extern int SendProcSignal(pid_t pid, ProcSignalReason reason, extern void procsignal_sigusr1_handler(SIGNAL_ARGS); -#endif /* PROCSIGNAL_H */ +#endif /* PROCSIGNAL_H */ diff --git a/src/include/storage/reinit.h b/src/include/storage/reinit.h index 8c1b178de4..90e494e933 100644 --- a/src/include/storage/reinit.h +++ b/src/include/storage/reinit.h @@ -20,4 +20,4 @@ extern void ResetUnloggedRelations(int op); #define UNLOGGED_RELATION_CLEANUP 0x0001 #define UNLOGGED_RELATION_INIT 0x0002 -#endif /* REINIT_H */ +#endif /* REINIT_H */ diff --git a/src/include/storage/relfilenode.h b/src/include/storage/relfilenode.h index bdf3cecdfa..075ce6b077 100644 --- a/src/include/storage/relfilenode.h +++ b/src/include/storage/relfilenode.h @@ -101,4 +101,4 @@ typedef struct RelFileNodeBackend (node1).backend == (node2).backend && \ (node1).node.spcNode == (node2).node.spcNode) -#endif /* RELFILENODE_H */ +#endif /* RELFILENODE_H */ diff --git a/src/include/storage/shm_mq.h b/src/include/storage/shm_mq.h index 7a37535ab3..02a93e0222 100644 --- a/src/include/storage/shm_mq.h +++ b/src/include/storage/shm_mq.h @@ -82,4 +82,4 @@ extern shm_mq_result shm_mq_wait_for_attach(shm_mq_handle *mqh); /* Smallest possible queue. */ extern PGDLLIMPORT const Size shm_mq_minimum_size; -#endif /* SHM_MQ_H */ +#endif /* SHM_MQ_H */ diff --git a/src/include/storage/shm_toc.h b/src/include/storage/shm_toc.h index 9175a472d8..8ccd35d96b 100644 --- a/src/include/storage/shm_toc.h +++ b/src/include/storage/shm_toc.h @@ -55,4 +55,4 @@ typedef struct extern Size shm_toc_estimate(shm_toc_estimator *e); -#endif /* SHM_TOC_H */ +#endif /* SHM_TOC_H */ diff --git a/src/include/storage/shmem.h b/src/include/storage/shmem.h index 1961832c0f..c6993387ff 100644 --- a/src/include/storage/shmem.h +++ b/src/include/storage/shmem.h @@ -57,7 +57,7 @@ extern void RequestAddinShmemSpace(Size size); /* this is a hash bucket in the shmem index table */ typedef struct { - char key[SHMEM_INDEX_KEYSIZE]; /* string name */ + char key[SHMEM_INDEX_KEYSIZE]; /* string name */ void *location; /* location in shared mem */ Size size; /* # bytes allocated for the structure */ } ShmemIndexEnt; @@ -77,4 +77,4 @@ extern Pointer SHMQueuePrev(const SHM_QUEUE *queue, const SHM_QUEUE *curElem, extern bool SHMQueueEmpty(const SHM_QUEUE *queue); extern bool SHMQueueIsDetached(const SHM_QUEUE *queue); -#endif /* SHMEM_H */ +#endif /* SHMEM_H */ diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h index 6a3db9580f..84c0b02da0 100644 --- a/src/include/storage/sinval.h +++ b/src/include/storage/sinval.h @@ -130,7 +130,7 @@ extern volatile sig_atomic_t catchupInterruptPending; extern void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n); extern void ReceiveSharedInvalidMessages( - void (*invalFunction) (SharedInvalidationMessage *msg), + void (*invalFunction) (SharedInvalidationMessage *msg), void (*resetFunction) (void)); /* signal handler for catchup events (PROCSIG_CATCHUP_INTERRUPT) */ @@ -151,4 +151,4 @@ extern void ProcessCommittedInvalidationMessages(SharedInvalidationMessage *msgs extern void LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg); -#endif /* SINVAL_H */ +#endif /* SINVAL_H */ diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h index 07ac2f8c85..751735fc9a 100644 --- a/src/include/storage/sinvaladt.h +++ b/src/include/storage/sinvaladt.h @@ -40,4 +40,4 @@ extern void SICleanupQueue(bool callerHasWriteLock, int minFree); extern LocalTransactionId GetNextLocalTransactionId(void); -#endif /* SINVALADT_H */ +#endif /* SINVALADT_H */ diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index 91a97f84b8..27c33af846 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -41,7 +41,7 @@ typedef struct SMgrRelationData { /* rnode is the hashtable lookup key, so it must be first! */ - RelFileNodeBackend smgr_rnode; /* relation physical identifier */ + RelFileNodeBackend smgr_rnode; /* relation physical identifier */ /* pointer to owning pointer, or NULL if none */ struct SMgrRelationData **smgr_owner; @@ -54,7 +54,7 @@ typedef struct SMgrRelationData * happens. In all three cases, InvalidBlockNumber means "unknown". */ BlockNumber smgr_targblock; /* current insertion target block */ - BlockNumber smgr_fsm_nblocks; /* last known size of fsm fork */ + BlockNumber smgr_fsm_nblocks; /* last known size of fsm fork */ BlockNumber smgr_vm_nblocks; /* last known size of vm fork */ /* additional public fields may someday exist here */ @@ -151,4 +151,4 @@ extern void RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, extern void ForgetRelationFsyncRequests(RelFileNode rnode, ForkNumber forknum); extern void ForgetDatabaseFsyncRequests(Oid dbid); -#endif /* SMGR_H */ +#endif /* SMGR_H */ diff --git a/src/include/storage/spin.h b/src/include/storage/spin.h index 8987c90537..66698645c2 100644 --- a/src/include/storage/spin.h +++ b/src/include/storage/spin.h @@ -74,4 +74,4 @@ extern void SpinlockSemaInit(void); extern PGSemaphore *SpinlockSemaArray; #endif -#endif /* SPIN_H */ +#endif /* SPIN_H */ diff --git a/src/include/storage/standby.h b/src/include/storage/standby.h index 3ecc446083..f5404b4c1f 100644 --- a/src/include/storage/standby.h +++ b/src/include/storage/standby.h @@ -73,7 +73,7 @@ typedef struct RunningTransactionsData int subxcnt; /* # of subxact ids in xids[] */ bool subxid_overflow; /* snapshot overflowed, subxids missing */ TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */ - TransactionId oldestRunningXid; /* *not* oldestXmin */ + TransactionId oldestRunningXid; /* *not* oldestXmin */ TransactionId latestCompletedXid; /* so we can set xmax */ TransactionId *xids; /* array of (sub)xids still running */ @@ -88,4 +88,4 @@ extern XLogRecPtr LogStandbySnapshot(void); extern void LogStandbyInvalidations(int nmsgs, SharedInvalidationMessage *msgs, bool relcacheInitFileInval); -#endif /* STANDBY_H */ +#endif /* STANDBY_H */ diff --git a/src/include/storage/standbydefs.h b/src/include/storage/standbydefs.h index f8444c787a..a0af6788e9 100644 --- a/src/include/storage/standbydefs.h +++ b/src/include/storage/standbydefs.h @@ -50,7 +50,7 @@ typedef struct xl_running_xacts int subxcnt; /* # of subxact ids in xids[] */ bool subxid_overflow; /* snapshot overflowed, subxids missing */ TransactionId nextXid; /* copy of ShmemVariableCache->nextXid */ - TransactionId oldestRunningXid; /* *not* oldestXmin */ + TransactionId oldestRunningXid; /* *not* oldestXmin */ TransactionId latestCompletedXid; /* so we can set xmax */ TransactionId xids[FLEXIBLE_ARRAY_MEMBER]; @@ -71,4 +71,4 @@ typedef struct xl_invalidations #define MinSizeOfInvalidations offsetof(xl_invalidations, msgs) -#endif /* STANDBYDEFS_H */ +#endif /* STANDBYDEFS_H */ diff --git a/src/include/tcop/deparse_utility.h b/src/include/tcop/deparse_utility.h index f0b25bea90..9c4e608934 100644 --- a/src/include/tcop/deparse_utility.h +++ b/src/include/tcop/deparse_utility.h @@ -102,4 +102,4 @@ typedef struct CollectedCommand } d; } CollectedCommand; -#endif /* DEPARSE_UTILITY_H */ +#endif /* DEPARSE_UTILITY_H */ diff --git a/src/include/tcop/dest.h b/src/include/tcop/dest.h index 622d35b346..445178307d 100644 --- a/src/include/tcop/dest.h +++ b/src/include/tcop/dest.h @@ -120,11 +120,11 @@ struct _DestReceiver { /* Called for each tuple to be output: */ bool (*receiveSlot) (TupleTableSlot *slot, - DestReceiver *self); + DestReceiver *self); /* Per-executor-run initialization and shutdown: */ void (*rStartup) (DestReceiver *self, - int operation, - TupleDesc typeinfo); + int operation, + TupleDesc typeinfo); void (*rShutdown) (DestReceiver *self); /* Destroy the receiver object itself (if dynamically allocated) */ void (*rDestroy) (DestReceiver *self); @@ -133,7 +133,7 @@ struct _DestReceiver /* Private fields might appear beyond this point... */ }; -extern DestReceiver *None_Receiver; /* permanent receiver for DestNone */ +extern DestReceiver *None_Receiver; /* permanent receiver for DestNone */ /* The primary destination management functions */ @@ -146,4 +146,4 @@ extern void EndCommand(const char *commandTag, CommandDest dest); extern void NullCommand(CommandDest dest); extern void ReadyForQuery(CommandDest dest); -#endif /* DEST_H */ +#endif /* DEST_H */ diff --git a/src/include/tcop/fastpath.h b/src/include/tcop/fastpath.h index 81d94913db..4a7c35f1a9 100644 --- a/src/include/tcop/fastpath.h +++ b/src/include/tcop/fastpath.h @@ -18,4 +18,4 @@ extern int GetOldFunctionMessage(StringInfo buf); extern void HandleFunctionRequest(StringInfo msgBuf); -#endif /* FASTPATH_H */ +#endif /* FASTPATH_H */ diff --git a/src/include/tcop/pquery.h b/src/include/tcop/pquery.h index e8ec5d0f8f..0d787dd99c 100644 --- a/src/include/tcop/pquery.h +++ b/src/include/tcop/pquery.h @@ -48,4 +48,4 @@ extern int AdvanceProducingPortal(Portal portal, bool can_wait); extern void cleanupClosedProducers(void); #endif -#endif /* PQUERY_H */ +#endif /* PQUERY_H */ diff --git a/src/include/tcop/tcopprot.h b/src/include/tcop/tcopprot.h index 8700e5d88e..fe1a9b00fe 100644 --- a/src/include/tcop/tcopprot.h +++ b/src/include/tcop/tcopprot.h @@ -96,4 +96,4 @@ extern bool set_plan_disabling_options(const char *arg, GucContext context, GucSource source); extern const char *get_stats_option_name(const char *arg); -#endif /* TCOPPROT_H */ +#endif /* TCOPPROT_H */ diff --git a/src/include/tcop/utility.h b/src/include/tcop/utility.h index d52f3e8525..2f09a939d9 100644 --- a/src/include/tcop/utility.h +++ b/src/include/tcop/utility.h @@ -25,12 +25,12 @@ typedef enum /* Hook for plugins to get control in ProcessUtility() */ typedef void (*ProcessUtility_hook_type) (PlannedStmt *pstmt, - const char *queryString, ProcessUtilityContext context, - ParamListInfo params, - QueryEnvironment *queryEnv, - DestReceiver *dest, - bool sentToRemote, - char *completionTag); + const char *queryString, ProcessUtilityContext context, + ParamListInfo params, + QueryEnvironment *queryEnv, + DestReceiver *dest, + bool sentToRemote, + char *completionTag); extern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook; extern void ProcessUtility(PlannedStmt *pstmt, const char *queryString, @@ -62,4 +62,4 @@ extern bool CommandIsReadOnly(PlannedStmt *pstmt); extern bool pgxc_lock_for_utility_stmt(Node *parsetree); #endif -#endif /* UTILITY_H */ +#endif /* UTILITY_H */ diff --git a/src/include/tsearch/ts_cache.h b/src/include/tsearch/ts_cache.h index 80b8a079ed..abff0fdfcc 100644 --- a/src/include/tsearch/ts_cache.h +++ b/src/include/tsearch/ts_cache.h @@ -95,4 +95,4 @@ extern Oid getTSCurrentConfig(bool emitError); extern bool check_TSCurrentConfig(char **newval, void **extra, GucSource source); extern void assign_TSCurrentConfig(const char *newval, void *extra); -#endif /* TS_CACHE_H */ +#endif /* TS_CACHE_H */ diff --git a/src/include/tsearch/ts_locale.h b/src/include/tsearch/ts_locale.h index afcf2b93de..c32f0743aa 100644 --- a/src/include/tsearch/ts_locale.h +++ b/src/include/tsearch/ts_locale.h @@ -61,7 +61,7 @@ extern int t_isprint(const char *ptr); #define t_iseq(x,c) (TOUCHAR(x) == (unsigned char) (c)) #define COPYCHAR(d,s) (*((unsigned char *) (d)) = TOUCHAR(s)) -#endif /* USE_WIDE_UPPER_LOWER */ +#endif /* USE_WIDE_UPPER_LOWER */ extern char *lowerstr(const char *str); extern char *lowerstr_with_len(const char *str, int len); @@ -73,4 +73,4 @@ extern void tsearch_readline_end(tsearch_readline_state *stp); extern char *t_readline(FILE *fp); -#endif /* __TSLOCALE_H__ */ +#endif /* __TSLOCALE_H__ */ diff --git a/src/include/tsearch/ts_public.h b/src/include/tsearch/ts_public.h index 4c190b22e8..94ba7fcb20 100644 --- a/src/include/tsearch/ts_public.h +++ b/src/include/tsearch/ts_public.h @@ -129,4 +129,4 @@ typedef struct * getnext == true */ } DictSubState; -#endif /* _PG_TS_PUBLIC_H_ */ +#endif /* _PG_TS_PUBLIC_H_ */ diff --git a/src/include/tsearch/ts_type.h b/src/include/tsearch/ts_type.h index 873e2e1856..2885bc0153 100644 --- a/src/include/tsearch/ts_type.h +++ b/src/include/tsearch/ts_type.h @@ -248,4 +248,4 @@ typedef TSQueryData *TSQuery; #define PG_GETARG_TSQUERY_COPY(n) DatumGetTSQueryCopy(PG_GETARG_DATUM(n)) #define PG_RETURN_TSQUERY(x) return TSQueryGetDatum(x) -#endif /* _PG_TSTYPE_H_ */ +#endif /* _PG_TSTYPE_H_ */ diff --git a/src/include/tsearch/ts_utils.h b/src/include/tsearch/ts_utils.h index 20d90b12fd..3312353026 100644 --- a/src/include/tsearch/ts_utils.h +++ b/src/include/tsearch/ts_utils.h @@ -41,11 +41,10 @@ struct TSQueryParserStateData; /* private in backend/utils/adt/tsquery.c */ typedef struct TSQueryParserStateData *TSQueryParserState; typedef void (*PushFunction) (Datum opaque, TSQueryParserState state, - char *token, int tokenlen, - int16 tokenweights, /* bitmap as described - * in QueryOperand - * struct */ - bool prefix); + char *token, int tokenlen, + int16 tokenweights, /* bitmap as described in + * QueryOperand struct */ + bool prefix); extern TSQuery parse_tsquery(char *buf, PushFunction pushval, @@ -152,7 +151,7 @@ typedef struct ExecPhraseData * it as zeroes if position data is not available. */ typedef bool (*TSExecuteCallback) (void *arg, QueryOperand *val, - ExecPhraseData *data); + ExecPhraseData *data); /* * Flag bits for TS_execute @@ -237,4 +236,4 @@ extern TSQuerySign makeTSQuerySign(TSQuery a); extern QTNode *findsubquery(QTNode *root, QTNode *ex, QTNode *subs, bool *isfind); -#endif /* _PG_TS_UTILS_H_ */ +#endif /* _PG_TS_UTILS_H_ */ diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index 2487020ec1..43273eaab5 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -127,11 +127,11 @@ typedef ArrayType Acl; * External representations of the privilege bits --- aclitemin/aclitemout * represent each possible privilege bit with a distinct 1-character code */ -#define ACL_INSERT_CHR 'a' /* formerly known as "append" */ -#define ACL_SELECT_CHR 'r' /* formerly known as "read" */ -#define ACL_UPDATE_CHR 'w' /* formerly known as "write" */ +#define ACL_INSERT_CHR 'a' /* formerly known as "append" */ +#define ACL_SELECT_CHR 'r' /* formerly known as "read" */ +#define ACL_UPDATE_CHR 'w' /* formerly known as "write" */ #define ACL_DELETE_CHR 'd' -#define ACL_TRUNCATE_CHR 'D' /* super-delete, as it were */ +#define ACL_TRUNCATE_CHR 'D' /* super-delete, as it were */ #define ACL_REFERENCES_CHR 'x' #define ACL_TRIGGER_CHR 't' #define ACL_EXECUTE_CHR 'X' @@ -265,7 +265,7 @@ extern AclMode pg_proc_aclmask(Oid proc_oid, Oid roleid, extern AclMode pg_language_aclmask(Oid lang_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_largeobject_aclmask_snapshot(Oid lobj_oid, Oid roleid, - AclMode mask, AclMaskHow how, Snapshot snapshot); + AclMode mask, AclMaskHow how, Snapshot snapshot); extern AclMode pg_namespace_aclmask(Oid nsp_oid, Oid roleid, AclMode mask, AclMaskHow how); extern AclMode pg_tablespace_aclmask(Oid spc_oid, Oid roleid, @@ -331,4 +331,4 @@ extern bool pg_statistics_object_ownercheck(Oid stat_oid, Oid roleid); extern bool has_createrole_privilege(Oid roleid); extern bool has_bypassrls_privilege(Oid roleid); -#endif /* ACL_H */ +#endif /* ACL_H */ diff --git a/src/include/utils/aclchk_internal.h b/src/include/utils/aclchk_internal.h index 0e50f73aab..3374edb638 100644 --- a/src/include/utils/aclchk_internal.h +++ b/src/include/utils/aclchk_internal.h @@ -42,4 +42,4 @@ typedef struct } InternalGrant; -#endif /* ACLCHK_INTERNAL_H */ +#endif /* ACLCHK_INTERNAL_H */ diff --git a/src/include/utils/array.h b/src/include/utils/array.h index 552c08f0d5..61a67a21e3 100644 --- a/src/include/utils/array.h +++ b/src/include/utils/array.h @@ -443,4 +443,4 @@ extern ExpandedArrayHeader *DatumGetExpandedArrayX(Datum d, extern AnyArrayType *DatumGetAnyArray(Datum d); extern void deconstruct_expanded_array(ExpandedArrayHeader *eah); -#endif /* ARRAY_H */ +#endif /* ARRAY_H */ diff --git a/src/include/utils/arrayaccess.h b/src/include/utils/arrayaccess.h index 6148bdf834..7655c80bed 100644 --- a/src/include/utils/arrayaccess.h +++ b/src/include/utils/arrayaccess.h @@ -115,4 +115,4 @@ array_iter_next(array_iter *it, bool *isnull, int i, return ret; } -#endif /* ARRAYACCESS_H */ +#endif /* ARRAYACCESS_H */ diff --git a/src/include/utils/ascii.h b/src/include/utils/ascii.h index 3771e1acab..d3b183f11f 100644 --- a/src/include/utils/ascii.h +++ b/src/include/utils/ascii.h @@ -13,4 +13,4 @@ extern void ascii_safe_strlcpy(char *dest, const char *src, size_t destsiz); -#endif /* _ASCII_H_ */ +#endif /* _ASCII_H_ */ diff --git a/src/include/utils/attoptcache.h b/src/include/utils/attoptcache.h index 7f2334b4cd..4eef793181 100644 --- a/src/include/utils/attoptcache.h +++ b/src/include/utils/attoptcache.h @@ -25,4 +25,4 @@ typedef struct AttributeOpts AttributeOpts *get_attribute_options(Oid spcid, int attnum); -#endif /* ATTOPTCACHE_H */ +#endif /* ATTOPTCACHE_H */ diff --git a/src/include/utils/backend_random.h b/src/include/utils/backend_random.h index 31602f250d..9781aea0ac 100644 --- a/src/include/utils/backend_random.h +++ b/src/include/utils/backend_random.h @@ -16,4 +16,4 @@ extern Size BackendRandomShmemSize(void); extern void BackendRandomShmemInit(void); extern bool pg_backend_random(char *dst, int len); -#endif /* BACKEND_RANDOM_H */ +#endif /* BACKEND_RANDOM_H */ diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index ea93c922f1..586dc44978 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -153,4 +153,4 @@ extern Datum pg_msgmodule_enable(PG_FUNCTION_ARGS); extern Datum pg_msgmodule_disable(PG_FUNCTION_ARGS); extern Datum pg_msgmodule_enable_all(PG_FUNCTION_ARGS); extern Datum pg_msgmodule_disable_all(PG_FUNCTION_ARGS); -#endif /* BUILTINS_H */ +#endif /* BUILTINS_H */ diff --git a/src/include/utils/bytea.h b/src/include/utils/bytea.h index 818e65707f..d7bd30842e 100644 --- a/src/include/utils/bytea.h +++ b/src/include/utils/bytea.h @@ -21,8 +21,8 @@ typedef enum { BYTEA_OUTPUT_ESCAPE, BYTEA_OUTPUT_HEX -} ByteaOutputType; +} ByteaOutputType; extern int bytea_output; /* ByteaOutputType, but int for GUC enum */ -#endif /* BYTEA_H */ +#endif /* BYTEA_H */ diff --git a/src/include/utils/cash.h b/src/include/utils/cash.h index 84083677e1..2e332d83b1 100644 --- a/src/include/utils/cash.h +++ b/src/include/utils/cash.h @@ -22,4 +22,4 @@ typedef int64 Cash; #define PG_GETARG_CASH(n) DatumGetCash(PG_GETARG_DATUM(n)) #define PG_RETURN_CASH(x) return CashGetDatum(x) -#endif /* CASH_H */ +#endif /* CASH_H */ diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h index 5add424e5e..f8ebc903d3 100644 --- a/src/include/utils/catcache.h +++ b/src/include/utils/catcache.h @@ -46,10 +46,10 @@ typedef struct catcache int cc_ntup; /* # of tuples currently in this cache */ int cc_nbuckets; /* # of hash buckets in this cache */ int cc_nkeys; /* # of keys (1..CATCACHE_MAXKEYS) */ - int cc_key[CATCACHE_MAXKEYS]; /* AttrNumber of each key */ + int cc_key[CATCACHE_MAXKEYS]; /* AttrNumber of each key */ PGFunction cc_hashfunc[CATCACHE_MAXKEYS]; /* hash function for each key */ - ScanKeyData cc_skey[CATCACHE_MAXKEYS]; /* precomputed key info for - * heap scans */ + ScanKeyData cc_skey[CATCACHE_MAXKEYS]; /* precomputed key info for heap + * scans */ bool cc_isname[CATCACHE_MAXKEYS]; /* flag "name" key columns */ dlist_head cc_lists; /* list of CatCList structs */ dlist_head *cc_bucket; /* hash buckets */ @@ -199,4 +199,4 @@ extern void PrepareToInvalidateCacheTuple(Relation relation, extern void PrintCatCacheLeakWarning(HeapTuple tuple); extern void PrintCatCacheListLeakWarning(CatCList *list); -#endif /* CATCACHE_H */ +#endif /* CATCACHE_H */ diff --git a/src/include/utils/combocid.h b/src/include/utils/combocid.h index 1cb0e74275..6d8be8bf0f 100644 --- a/src/include/utils/combocid.h +++ b/src/include/utils/combocid.h @@ -25,4 +25,4 @@ extern void RestoreComboCIDState(char *comboCIDstate); extern void SerializeComboCIDState(Size maxsize, char *start_address); extern Size EstimateComboCIDStateSpace(void); -#endif /* COMBOCID_H */ +#endif /* COMBOCID_H */ diff --git a/src/include/utils/date.h b/src/include/utils/date.h index 309a581853..0736a72946 100644 --- a/src/include/utils/date.h +++ b/src/include/utils/date.h @@ -74,4 +74,4 @@ extern DateADT GetSQLCurrentDate(void); extern TimeTzADT *GetSQLCurrentTime(int32 typmod); extern TimeADT GetSQLLocalTime(int32 typmod); -#endif /* DATE_H */ +#endif /* DATE_H */ diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index fb7885bf34..7968569fda 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -259,7 +259,7 @@ do { \ * Include check for leap year. */ -extern const char *const months[]; /* months (3-char abbreviations) */ +extern const char *const months[]; /* months (3-char abbreviations) */ extern const char *const days[]; /* days (full names) */ extern const int day_tab[2][13]; @@ -286,8 +286,8 @@ extern const int day_tab[2][13]; #define DTERR_TZDISP_OVERFLOW (-5) -extern void GetCurrentDateTime(struct pg_tm * tm); -extern void GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp); +extern void GetCurrentDateTime(struct pg_tm *tm); +extern void GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp); extern void j2date(int jd, int *year, int *month, int *day); extern int date2j(int year, int month, int day); @@ -296,32 +296,32 @@ extern int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, int maxfields, int *numfields); extern int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, - struct pg_tm * tm, fsec_t *fsec, int *tzp); + struct pg_tm *tm, fsec_t *fsec, int *tzp); extern int DecodeTimezone(char *str, int *tzp); extern int DecodeTimeOnly(char **field, int *ftype, int nf, int *dtype, - struct pg_tm * tm, fsec_t *fsec, int *tzp); + struct pg_tm *tm, fsec_t *fsec, int *tzp); extern int DecodeInterval(char **field, int *ftype, int nf, int range, - int *dtype, struct pg_tm * tm, fsec_t *fsec); + int *dtype, struct pg_tm *tm, fsec_t *fsec); extern int DecodeISO8601Interval(char *str, - int *dtype, struct pg_tm * tm, fsec_t *fsec); + int *dtype, struct pg_tm *tm, fsec_t *fsec); extern void DateTimeParseError(int dterr, const char *str, const char *datatype) pg_attribute_noreturn(); -extern int DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp); -extern int DetermineTimeZoneAbbrevOffset(struct pg_tm * tm, const char *abbr, pg_tz *tzp); +extern int DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp); +extern int DetermineTimeZoneAbbrevOffset(struct pg_tm *tm, const char *abbr, pg_tz *tzp); extern int DetermineTimeZoneAbbrevOffsetTS(TimestampTz ts, const char *abbr, pg_tz *tzp, int *isdst); -extern void EncodeDateOnly(struct pg_tm * tm, int style, char *str); -extern void EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style, char *str); -extern void EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str); -extern void EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str); +extern void EncodeDateOnly(struct pg_tm *tm, int style, char *str); +extern void EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, int style, char *str); +extern void EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str); +extern void EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str); extern void EncodeSpecialTimestamp(Timestamp dt, char *str); extern int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, - struct pg_tm * tm); + struct pg_tm *tm); extern int DecodeTimezoneAbbrev(int field, char *lowtoken, int *offset, pg_tz **tz); @@ -338,4 +338,4 @@ extern TimeZoneAbbrevTable *ConvertTimeZoneAbbrevs(struct tzEntry *abbrevs, int n); extern void InstallTimeZoneAbbrevs(TimeZoneAbbrevTable *tbl); -#endif /* DATETIME_H */ +#endif /* DATETIME_H */ diff --git a/src/include/utils/datum.h b/src/include/utils/datum.h index a8a9ea6d19..d2f0f9ed51 100644 --- a/src/include/utils/datum.h +++ b/src/include/utils/datum.h @@ -56,4 +56,4 @@ extern void datumSerialize(Datum value, bool isnull, bool typByVal, int typLen, char **start_address); extern Datum datumRestore(char **start_address, bool *isnull); -#endif /* DATUM_H */ +#endif /* DATUM_H */ diff --git a/src/include/utils/dsa.h b/src/include/utils/dsa.h index f084443409..516ef610f0 100644 --- a/src/include/utils/dsa.h +++ b/src/include/utils/dsa.h @@ -122,4 +122,4 @@ extern void *dsa_get_address(dsa_area *area, dsa_pointer dp); extern void dsa_trim(dsa_area *area); extern void dsa_dump(dsa_area *area); -#endif /* DSA_H */ +#endif /* DSA_H */ diff --git a/src/include/utils/dynahash.h b/src/include/utils/dynahash.h index eee5cce928..8e03245a03 100644 --- a/src/include/utils/dynahash.h +++ b/src/include/utils/dynahash.h @@ -16,4 +16,4 @@ extern int my_log2(long num); -#endif /* DYNAHASH_H */ +#endif /* DYNAHASH_H */ diff --git a/src/include/utils/dynamic_loader.h b/src/include/utils/dynamic_loader.h index 987f21a362..6c9287b611 100644 --- a/src/include/utils/dynamic_loader.h +++ b/src/include/utils/dynamic_loader.h @@ -22,4 +22,4 @@ extern PGFunction pg_dlsym(void *handle, char *funcname); extern void pg_dlclose(void *handle); extern char *pg_dlerror(void); -#endif /* DYNAMIC_LOADER_H */ +#endif /* DYNAMIC_LOADER_H */ diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h index b56e444b5e..df9e7a6901 100644 --- a/src/include/utils/elog.h +++ b/src/include/utils/elog.h @@ -27,9 +27,9 @@ * server log by default. */ #define LOG_SERVER_ONLY 16 /* Same as LOG for server reporting, but never * sent to client. */ -#define COMMERROR LOG_SERVER_ONLY /* Client communication problems; same - * as LOG for server reporting, but - * never sent to client. */ +#define COMMERROR LOG_SERVER_ONLY /* Client communication problems; same as + * LOG for server reporting, but never + * sent to client. */ #define INFO 17 /* Messages specifically requested by user (eg * VACUUM VERBOSE output); always sent to * client regardless of client_min_messages, @@ -137,7 +137,7 @@ if (elevel_ >= ERROR) \ pg_unreachable(); \ } while(0) -#endif /* HAVE__BUILTIN_CONSTANT_P */ +#endif /* HAVE__BUILTIN_CONSTANT_P */ #endif #define ereport(elevel, rest) \ @@ -162,7 +162,7 @@ extern int errmsg(const char *fmt,...) pg_attribute_printf(1, 2); extern int errmsg_internal(const char *fmt,...) pg_attribute_printf(1, 2); extern int errmsg_plural(const char *fmt_singular, const char *fmt_plural, - unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); extern int errdetail(const char *fmt,...) pg_attribute_printf(1, 2); extern int errdetail_internal(const char *fmt,...) pg_attribute_printf(1, 2); @@ -171,10 +171,10 @@ extern int errdetail_log(const char *fmt,...) pg_attribute_printf(1, 2); extern int errdetail_log_plural(const char *fmt_singular, const char *fmt_plural, - unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); extern int errdetail_plural(const char *fmt_singular, const char *fmt_plural, - unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); + unsigned long n,...) pg_attribute_printf(1, 4) pg_attribute_printf(2, 4); extern int errhint(const char *fmt,...) pg_attribute_printf(1, 2); @@ -268,14 +268,14 @@ extern int getinternalerrposition(void); pg_unreachable(); \ } \ } while(0) -#endif /* HAVE__BUILTIN_CONSTANT_P */ +#endif /* HAVE__BUILTIN_CONSTANT_P */ #else /* !HAVE__VA_ARGS */ #define elog \ do { \ elog_start(__FILE__, __LINE__, PG_FUNCNAME_MACRO); \ } while (0); \ elog_finish -#endif /* HAVE__VA_ARGS */ +#endif /* HAVE__VA_ARGS */ #endif extern void elog_start(const char *filename, int lineno, @@ -391,8 +391,8 @@ extern PGDLLIMPORT sigjmp_buf *PG_exception_stack; typedef struct ErrorData { int elevel; /* error level */ - bool output_to_server; /* will report to server log? */ - bool output_to_client; /* will report to client? */ + bool output_to_server; /* will report to server log? */ + bool output_to_client; /* will report to client? */ bool show_funcname; /* true to force funcname inclusion */ bool hide_stmt; /* true to prevent STATEMENT: inclusion */ bool hide_ctx; /* true to prevent CONTEXT: inclusion */ @@ -459,7 +459,7 @@ typedef enum PGERROR_TERSE, /* single-line error messages */ PGERROR_DEFAULT, /* recommended style */ PGERROR_VERBOSE /* all the facts, ma'am */ -} PGErrorVerbosity; +} PGErrorVerbosity; extern int Log_error_verbosity; extern char *Log_line_prefix; @@ -490,4 +490,4 @@ extern void set_syslog_parameters(const char *ident, int facility); */ extern void write_stderr(const char *fmt,...) pg_attribute_printf(1, 2); -#endif /* ELOG_H */ +#endif /* ELOG_H */ diff --git a/src/include/utils/evtcache.h b/src/include/utils/evtcache.h index f6ea163df3..9774eac5a6 100644 --- a/src/include/utils/evtcache.h +++ b/src/include/utils/evtcache.h @@ -34,4 +34,4 @@ typedef struct extern List *EventCacheLookup(EventTriggerEvent event); -#endif /* EVTCACHE_H */ +#endif /* EVTCACHE_H */ diff --git a/src/include/utils/expandeddatum.h b/src/include/utils/expandeddatum.h index f853a13e6e..7116b860cc 100644 --- a/src/include/utils/expandeddatum.h +++ b/src/include/utils/expandeddatum.h @@ -66,7 +66,7 @@ */ typedef Size (*EOM_get_flat_size_method) (ExpandedObjectHeader *eohptr); typedef void (*EOM_flatten_into_method) (ExpandedObjectHeader *eohptr, - void *result, Size allocated_size); + void *result, Size allocated_size); /* Struct of function pointers for an expanded object's methods */ typedef struct ExpandedObjectMethods @@ -156,4 +156,4 @@ extern Datum MakeExpandedObjectReadOnlyInternal(Datum d); extern Datum TransferExpandedObject(Datum d, MemoryContext new_parent); extern void DeleteExpandedObject(Datum d); -#endif /* EXPANDEDDATUM_H */ +#endif /* EXPANDEDDATUM_H */ diff --git a/src/include/utils/fmgrtab.h b/src/include/utils/fmgrtab.h index 414cd03952..6130ef8f9c 100644 --- a/src/include/utils/fmgrtab.h +++ b/src/include/utils/fmgrtab.h @@ -36,4 +36,4 @@ extern const FmgrBuiltin fmgr_builtins[]; extern const int fmgr_nbuiltins; /* number of entries in table */ -#endif /* FMGRTAB_H */ +#endif /* FMGRTAB_H */ diff --git a/src/include/utils/freepage.h b/src/include/utils/freepage.h index 78caa5369b..c370c733ee 100644 --- a/src/include/utils/freepage.h +++ b/src/include/utils/freepage.h @@ -96,4 +96,4 @@ extern void FreePageManagerPut(FreePageManager *fpm, Size first_page, Size npages); extern char *FreePageManagerDump(FreePageManager *fpm); -#endif /* FREEPAGE_H */ +#endif /* FREEPAGE_H */ diff --git a/src/include/utils/geo_decls.h b/src/include/utils/geo_decls.h index 9b530dbe3d..44c6381b85 100644 --- a/src/include/utils/geo_decls.h +++ b/src/include/utils/geo_decls.h @@ -183,4 +183,4 @@ extern double point_dt(Point *pt1, Point *pt2); extern double point_sl(Point *pt1, Point *pt2); extern double pg_hypot(double x, double y); -#endif /* GEO_DECLS_H */ +#endif /* GEO_DECLS_H */ diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index 144281aa24..7917832a55 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -213,8 +213,8 @@ typedef enum #define GUC_SUPERUSER_ONLY 0x0100 /* show only to superusers */ #define GUC_IS_NAME 0x0200 /* limit string to NAMEDATALEN-1 */ #define GUC_NOT_WHILE_SEC_REST 0x0400 /* can't set if security restricted */ -#define GUC_DISALLOW_IN_AUTO_FILE 0x0800 /* can't set in - * PG_AUTOCONF_FILENAME */ +#define GUC_DISALLOW_IN_AUTO_FILE 0x0800 /* can't set in + * PG_AUTOCONF_FILENAME */ #define GUC_UNIT_KB 0x1000 /* value is in kilobytes */ #define GUC_UNIT_BLOCKS 0x2000 /* value is in blocks */ @@ -345,7 +345,7 @@ extern void DefineCustomEnumVariable( const char *long_desc, int *valueAddr, int bootValue, - const struct config_enum_entry * options, + const struct config_enum_entry *options, GucContext context, int flags, GucEnumCheckHook check_hook, @@ -447,4 +447,4 @@ extern bool check_wal_buffers(int *newval, void **extra, GucSource source); extern void assign_xlog_sync_method(int new_sync_method, void *extra); extern const char *quote_guc_value(const char *value, int flags); -#endif /* GUC_H */ +#endif /* GUC_H */ diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h index 1057e55f76..20e4479252 100644 --- a/src/include/utils/guc_tables.h +++ b/src/include/utils/guc_tables.h @@ -172,7 +172,7 @@ struct config_generic }; /* bit values in status field */ -#define GUC_IS_IN_FILE 0x0001 /* found it in config file */ +#define GUC_IS_IN_FILE 0x0001 /* found it in config file */ /* * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile. * Do not assume that its value represents useful information elsewhere. @@ -269,8 +269,8 @@ extern struct config_generic **get_guc_variables(void); extern void build_guc_variables(void); /* search in enum options */ -extern const char *config_enum_lookup_by_value(struct config_enum * record, int val); -extern bool config_enum_lookup_by_name(struct config_enum * record, +extern const char *config_enum_lookup_by_value(struct config_enum *record, int val); +extern bool config_enum_lookup_by_name(struct config_enum *record, const char *value, int *retval); -#endif /* GUC_TABLES_H */ +#endif /* GUC_TABLES_H */ diff --git a/src/include/utils/hsearch.h b/src/include/utils/hsearch.h index 7964087161..bc5873ed20 100644 --- a/src/include/utils/hsearch.h +++ b/src/include/utils/hsearch.h @@ -27,7 +27,7 @@ typedef uint32 (*HashValueFunc) (const void *key, Size keysize); * as key comparison functions.) */ typedef int (*HashCompareFunc) (const void *key1, const void *key2, - Size keysize); + Size keysize); /* * Key copying functions must have this signature. The return value is not @@ -157,4 +157,4 @@ extern int bitmap_match(const void *key1, const void *key2, Size keysize); #define oid_hash uint32_hash /* Remove me eventually */ -#endif /* HSEARCH_H */ +#endif /* HSEARCH_H */ diff --git a/src/include/utils/index_selfuncs.h b/src/include/utils/index_selfuncs.h index 17d165ca65..24f2f3a866 100644 --- a/src/include/utils/index_selfuncs.h +++ b/src/include/utils/index_selfuncs.h @@ -71,4 +71,4 @@ extern void gincostestimate(struct PlannerInfo *root, double *indexCorrelation, double *indexPages); -#endif /* INDEX_SELFUNCS_H */ +#endif /* INDEX_SELFUNCS_H */ diff --git a/src/include/utils/inet.h b/src/include/utils/inet.h index 7dc179e255..f2aa864a35 100644 --- a/src/include/utils/inet.h +++ b/src/include/utils/inet.h @@ -146,4 +146,4 @@ extern inet *cidr_set_masklen_internal(const inet *src, int bits); extern int bitncmp(const unsigned char *l, const unsigned char *r, int n); extern int bitncommon(const unsigned char *l, const unsigned char *r, int n); -#endif /* INET_H */ +#endif /* INET_H */ diff --git a/src/include/utils/int8.h b/src/include/utils/int8.h index c58ee048cf..8b78983fee 100644 --- a/src/include/utils/int8.h +++ b/src/include/utils/int8.h @@ -22,4 +22,4 @@ extern bool scanint8(const char *str, bool errorOK, int64 *result); -#endif /* INT8_H */ +#endif /* INT8_H */ diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h index afbe354b4d..361543f412 100644 --- a/src/include/utils/inval.h +++ b/src/include/utils/inval.h @@ -63,4 +63,4 @@ extern void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func, extern void CallSyscacheCallbacks(int cacheid, uint32 hashvalue); extern void InvalidateSystemCaches(void); -#endif /* INVAL_H */ +#endif /* INVAL_H */ diff --git a/src/include/utils/json.h b/src/include/utils/json.h index 0a749b90c8..e3ffe6fc44 100644 --- a/src/include/utils/json.h +++ b/src/include/utils/json.h @@ -19,4 +19,4 @@ /* functions in json.c */ extern void escape_json(StringInfo buf, const char *str); -#endif /* JSON_H */ +#endif /* JSON_H */ diff --git a/src/include/utils/jsonapi.h b/src/include/utils/jsonapi.h index 44ee36931e..4336823de2 100644 --- a/src/include/utils/jsonapi.h +++ b/src/include/utils/jsonapi.h @@ -143,8 +143,8 @@ extern void iterate_jsonb_string_values(Jsonb *jb, void *state, extern void iterate_json_string_values(text *json, void *action_state, JsonIterateStringValuesAction action); extern Jsonb *transform_jsonb_string_values(Jsonb *jsonb, void *action_state, - JsonTransformStringValuesAction transform_action); + JsonTransformStringValuesAction transform_action); extern text *transform_json_string_values(text *json, void *action_state, - JsonTransformStringValuesAction transform_action); + JsonTransformStringValuesAction transform_action); -#endif /* JSONAPI_H */ +#endif /* JSONAPI_H */ diff --git a/src/include/utils/jsonb.h b/src/include/utils/jsonb.h index 411e158d6c..ea9dd17540 100644 --- a/src/include/utils/jsonb.h +++ b/src/include/utils/jsonb.h @@ -148,7 +148,7 @@ typedef uint32 JEntry; #define JENTRY_ISBOOL_FALSE 0x20000000 #define JENTRY_ISBOOL_TRUE 0x30000000 #define JENTRY_ISNULL 0x40000000 -#define JENTRY_ISCONTAINER 0x50000000 /* array or object */ +#define JENTRY_ISCONTAINER 0x50000000 /* array or object */ /* Access macros. Note possible multiple evaluations */ #define JBE_OFFLENFLD(je_) ((je_) & JENTRY_OFFLENMASK) @@ -200,8 +200,8 @@ typedef struct JsonbContainer } JsonbContainer; /* flags for the header-field in JsonbContainer */ -#define JB_CMASK 0x0FFFFFFF /* mask for count field */ -#define JB_FSCALAR 0x10000000 /* flag bits */ +#define JB_CMASK 0x0FFFFFFF /* mask for count field */ +#define JB_FSCALAR 0x10000000 /* flag bits */ #define JB_FOBJECT 0x20000000 #define JB_FARRAY 0x40000000 @@ -263,7 +263,7 @@ struct JsonbValue { int nElems; JsonbValue *elems; - bool rawScalar; /* Top-level "raw scalar" array? */ + bool rawScalar; /* Top-level "raw scalar" array? */ } array; /* Array container type */ struct @@ -378,4 +378,4 @@ extern char *JsonbToCStringIndent(StringInfo out, JsonbContainer *in, int estimated_len); -#endif /* __JSONB_H__ */ +#endif /* __JSONB_H__ */ diff --git a/src/include/utils/logtape.h b/src/include/utils/logtape.h index e802c4b213..a1e869b80c 100644 --- a/src/include/utils/logtape.h +++ b/src/include/utils/logtape.h @@ -43,4 +43,4 @@ extern void LogicalTapeTell(LogicalTapeSet *lts, int tapenum, long *blocknum, int *offset); extern long LogicalTapeSetBlocks(LogicalTapeSet *lts); -#endif /* LOGTAPE_H */ +#endif /* LOGTAPE_H */ diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index 8da59bbf3e..32121311a8 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -220,4 +220,4 @@ extern Oid get_tablesample_method_id(const char *methodname); #define TypeIsToastable(typid) (get_typstorage(typid) != 'p') -#endif /* LSYSCACHE_H */ +#endif /* LSYSCACHE_H */ diff --git a/src/include/utils/memdebug.h b/src/include/utils/memdebug.h index 206e6ce002..a73d505be8 100644 --- a/src/include/utils/memdebug.h +++ b/src/include/utils/memdebug.h @@ -43,7 +43,7 @@ wipe_mem(void *ptr, size_t size) VALGRIND_MAKE_MEM_NOACCESS(ptr, size); } -#endif /* CLOBBER_FREED_MEMORY */ +#endif /* CLOBBER_FREED_MEMORY */ #ifdef MEMORY_CONTEXT_CHECKING @@ -70,13 +70,13 @@ sentinel_ok(const void *base, Size offset) return ret; } -#endif /* MEMORY_CONTEXT_CHECKING */ +#endif /* MEMORY_CONTEXT_CHECKING */ #ifdef RANDOMIZE_ALLOCATED_MEMORY void randomize_mem(char *ptr, size_t size); -#endif /* RANDOMIZE_ALLOCATED_MEMORY */ +#endif /* RANDOMIZE_ALLOCATED_MEMORY */ -#endif /* MEMDEBUG_H */ +#endif /* MEMDEBUG_H */ diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h index 58e816d8e9..c553349066 100644 --- a/src/include/utils/memutils.h +++ b/src/include/utils/memutils.h @@ -37,7 +37,7 @@ * MemoryContextAllocHuge(). Both limits permit code to assume that it may * compute twice an allocation's size without overflow. */ -#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */ +#define MaxAllocSize ((Size) 0x3fffffff) /* 1 gigabyte - 1 */ #define AllocSizeIsValid(size) ((Size) (size) <= MaxAllocSize) @@ -194,4 +194,4 @@ extern MemoryContext SlabContextCreate(MemoryContext parent, #define SLAB_DEFAULT_BLOCK_SIZE (8 * 1024) #define SLAB_LARGE_BLOCK_SIZE (8 * 1024 * 1024) -#endif /* MEMUTILS_H */ +#endif /* MEMUTILS_H */ diff --git a/src/include/utils/nabstime.h b/src/include/utils/nabstime.h index 4b0706a316..69133952d1 100644 --- a/src/include/utils/nabstime.h +++ b/src/include/utils/nabstime.h @@ -73,11 +73,11 @@ typedef TimeIntervalData *TimeInterval; * These were chosen as special 32-bit bit patterns, * so redefine them explicitly using these bit patterns. - tgl 97/02/24 */ -#define INVALID_ABSTIME ((AbsoluteTime) 0x7FFFFFFE) /* 2147483647 (2^31 - 1) */ -#define NOEND_ABSTIME ((AbsoluteTime) 0x7FFFFFFC) /* 2147483645 (2^31 - 3) */ -#define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN) /* -2147483648 */ +#define INVALID_ABSTIME ((AbsoluteTime) 0x7FFFFFFE) /* 2147483647 (2^31 - 1) */ +#define NOEND_ABSTIME ((AbsoluteTime) 0x7FFFFFFC) /* 2147483645 (2^31 - 3) */ +#define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN) /* -2147483648 */ -#define INVALID_RELTIME ((RelativeTime) 0x7FFFFFFE) /* 2147483647 (2^31 - 1) */ +#define INVALID_RELTIME ((RelativeTime) 0x7FFFFFFE) /* 2147483647 (2^31 - 1) */ #define AbsoluteTimeIsValid(time) \ ((bool) ((time) != INVALID_ABSTIME)) @@ -98,6 +98,6 @@ typedef TimeIntervalData *TimeInterval; /* non-fmgr-callable support routines */ extern AbsoluteTime GetCurrentAbsoluteTime(void); -extern void abstime2tm(AbsoluteTime time, int *tzp, struct pg_tm * tm, char **tzn); +extern void abstime2tm(AbsoluteTime time, int *tzp, struct pg_tm *tm, char **tzn); -#endif /* NABSTIME_H */ +#endif /* NABSTIME_H */ diff --git a/src/include/utils/numeric.h b/src/include/utils/numeric.h index 0ab57d7025..3aa7fef947 100644 --- a/src/include/utils/numeric.h +++ b/src/include/utils/numeric.h @@ -61,4 +61,4 @@ int32 numeric_maximum_size(int32 typmod); extern char *numeric_out_sci(Numeric num, int scale); extern char *numeric_normalize(Numeric num); -#endif /* _PG_NUMERIC_H_ */ +#endif /* _PG_NUMERIC_H_ */ diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index 2e07bd57ad..a7dc837724 100644 --- a/src/include/utils/palloc.h +++ b/src/include/utils/palloc.h @@ -113,7 +113,7 @@ MemoryContextSwitchTo(MemoryContext context) CurrentMemoryContext = context; return old; } -#endif /* FRONTEND */ +#endif /* FRONTEND */ /* Registration of memory context reset/delete callbacks */ extern void MemoryContextRegisterResetCallback(MemoryContext context, @@ -133,4 +133,4 @@ extern char *pchomp(const char *in); extern char *psprintf(const char *fmt,...) pg_attribute_printf(1, 2); extern size_t pvsnprintf(char *buf, size_t len, const char *fmt, va_list args) pg_attribute_printf(3, 0); -#endif /* PALLOC_H */ +#endif /* PALLOC_H */ diff --git a/src/include/utils/pg_crc.h b/src/include/utils/pg_crc.h index 2fe083850a..9ea0622321 100644 --- a/src/include/utils/pg_crc.h +++ b/src/include/utils/pg_crc.h @@ -104,4 +104,4 @@ do { \ */ extern PGDLLIMPORT const uint32 pg_crc32_table[256]; -#endif /* PG_CRC_H */ +#endif /* PG_CRC_H */ diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h index f0acc86b88..a02d27ba26 100644 --- a/src/include/utils/pg_locale.h +++ b/src/include/utils/pg_locale.h @@ -93,7 +93,7 @@ extern char *get_collation_actual_version(char collprovider, const char *collcol #ifdef USE_ICU extern int32_t icu_to_uchar(UChar **buff_uchar, const char *buff, size_t nbytes); -extern int32_t icu_from_uchar(char **result, UChar *buff_uchar, int32_t len_uchar); +extern int32_t icu_from_uchar(char **result, const UChar *buff_uchar, int32_t len_uchar); #endif /* These functions convert from/to libc's wchar_t, *not* pg_wchar_t */ @@ -104,4 +104,4 @@ extern size_t char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen, pg_locale_t locale); #endif -#endif /* _PG_LOCALE_ */ +#endif /* _PG_LOCALE_ */ diff --git a/src/include/utils/pg_lsn.h b/src/include/utils/pg_lsn.h index 6f038e9e14..cc51b2a078 100644 --- a/src/include/utils/pg_lsn.h +++ b/src/include/utils/pg_lsn.h @@ -24,4 +24,4 @@ #define PG_GETARG_LSN(n) DatumGetLSN(PG_GETARG_DATUM(n)) #define PG_RETURN_LSN(x) return LSNGetDatum(x) -#endif /* PG_LSN_H */ +#endif /* PG_LSN_H */ diff --git a/src/include/utils/pg_rusage.h b/src/include/utils/pg_rusage.h index 48a74e90ba..cea51f0cb2 100644 --- a/src/include/utils/pg_rusage.h +++ b/src/include/utils/pg_rusage.h @@ -34,4 +34,4 @@ typedef struct PGRUsage extern void pg_rusage_init(PGRUsage *ru0); extern const char *pg_rusage_show(const PGRUsage *ru0); -#endif /* PG_RUSAGE_H */ +#endif /* PG_RUSAGE_H */ diff --git a/src/include/utils/plancache.h b/src/include/utils/plancache.h index fbb271ed1c..2cb2241f45 100644 --- a/src/include/utils/plancache.h +++ b/src/include/utils/plancache.h @@ -81,7 +81,7 @@ struct RawStmt; typedef struct CachedPlanSource { int magic; /* should equal CACHEDPLANSOURCE_MAGIC */ - struct RawStmt *raw_parse_tree; /* output of raw_parser(), or NULL */ + struct RawStmt *raw_parse_tree; /* output of raw_parser(), or NULL */ const char *query_string; /* source text of query */ const char *commandTag; /* command tag (a constant!), or NULL */ Oid *param_types; /* array of parameter type OIDs, or NULL */ @@ -96,11 +96,11 @@ typedef struct CachedPlanSource List *query_list; /* list of Query nodes, or NIL if not valid */ List *relationOids; /* OIDs of relations the queries depend on */ List *invalItems; /* other dependencies, as PlanInvalItems */ - struct OverrideSearchPath *search_path; /* search_path used for - * parsing and planning */ + struct OverrideSearchPath *search_path; /* search_path used for parsing + * and planning */ MemoryContext query_context; /* context holding the above, or NULL */ Oid rewriteRoleId; /* Role ID we did rewriting for */ - bool rewriteRowSecurity; /* row_security used during rewrite */ + bool rewriteRowSecurity; /* row_security used during rewrite */ bool dependsOnRLS; /* is rewritten query specific to the above? */ /* If we have a generic plan, this is a reference-counted link to it: */ struct CachedPlan *gplan; /* generic plan, or NULL if not valid */ @@ -111,11 +111,11 @@ typedef struct CachedPlanSource bool is_valid; /* is the query_list currently valid? */ int generation; /* increments each time we create a plan */ /* If CachedPlanSource has been saved, it is a member of a global list */ - struct CachedPlanSource *next_saved; /* list link, if so */ + struct CachedPlanSource *next_saved; /* list link, if so */ /* State kept to help decide whether to use custom or generic plans: */ double generic_cost; /* cost of generic plan, or -1 if not known */ - double total_custom_cost; /* total cost of custom plans so far */ - int num_custom_plans; /* number of plans included in total */ + double total_custom_cost; /* total cost of custom plans so far */ + int num_custom_plans; /* number of plans included in total */ #ifdef PGXC char *stmt_name; /* If set, this is a copy of prepared stmt name */ #endif @@ -193,4 +193,4 @@ extern void SetRemoteSubplan(CachedPlanSource *plansource, const char *plan_string); #endif -#endif /* PLANCACHE_H */ +#endif /* PLANCACHE_H */ diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h index c9ce886483..0ec2eba5d3 100644 --- a/src/include/utils/portal.h +++ b/src/include/utils/portal.h @@ -123,7 +123,7 @@ typedef struct PortalData const char *prepStmtName; /* source prepared statement (NULL if none) */ MemoryContext heap; /* subsidiary memory for portal */ ResourceOwner resowner; /* resources owned by portal */ - void (*cleanup) (Portal portal); /* cleanup hook */ + void (*cleanup) (Portal portal); /* cleanup hook */ /* * State data for remembering which subtransaction(s) the portal was @@ -132,8 +132,8 @@ typedef struct PortalData * createSubid is the creating subxact and activeSubid is the last subxact * in which we ran the portal. */ - SubTransactionId createSubid; /* the creating subxact */ - SubTransactionId activeSubid; /* the last subxact with activity */ + SubTransactionId createSubid; /* the creating subxact */ + SubTransactionId activeSubid; /* the last subxact with activity */ /* The query or queries the portal will execute */ const char *sourceText; /* text of query (as of 8.4, never NULL) */ @@ -198,7 +198,7 @@ typedef struct PortalData /* Presentation data, primarily used by the pg_cursors system view */ TimestampTz creation_time; /* time at which this portal was defined */ bool visible; /* include this portal in pg_cursors? */ -} PortalData; +} PortalData; /* * PortalIsValid @@ -253,4 +253,4 @@ extern bool portalIsProducing(Portal portal); #endif extern bool ThereAreNoReadyPortals(void); -#endif /* PORTAL_H */ +#endif /* PORTAL_H */ diff --git a/src/include/utils/ps_status.h b/src/include/utils/ps_status.h index 3f503cc187..2ba5a0ea2e 100644 --- a/src/include/utils/ps_status.h +++ b/src/include/utils/ps_status.h @@ -23,4 +23,4 @@ extern void set_ps_display(const char *activity, bool force); extern const char *get_ps_display(int *displen); -#endif /* PS_STATUS_H */ +#endif /* PS_STATUS_H */ diff --git a/src/include/utils/queryenvironment.h b/src/include/utils/queryenvironment.h index 291b6fdbc2..08e6051b4e 100644 --- a/src/include/utils/queryenvironment.h +++ b/src/include/utils/queryenvironment.h @@ -71,4 +71,4 @@ extern void unregister_ENR(QueryEnvironment *queryEnv, const char *name); extern EphemeralNamedRelation get_ENR(QueryEnvironment *queryEnv, const char *name); extern TupleDesc ENRMetadataGetTupDesc(EphemeralNamedRelationMetadata enrmd); -#endif /* QUERYENVIRONMENT_H */ +#endif /* QUERYENVIRONMENT_H */ diff --git a/src/include/utils/rangetypes.h b/src/include/utils/rangetypes.h index abb2223ec5..5544889317 100644 --- a/src/include/utils/rangetypes.h +++ b/src/include/utils/rangetypes.h @@ -40,8 +40,8 @@ typedef struct #define RANGE_UB_INF 0x10 /* upper bound is +infinity */ #define RANGE_LB_NULL 0x20 /* lower bound is null (NOT USED) */ #define RANGE_UB_NULL 0x40 /* upper bound is null (NOT USED) */ -#define RANGE_CONTAIN_EMPTY 0x80/* marks a GiST internal-page entry whose - * subtree contains some empty ranges */ +#define RANGE_CONTAIN_EMPTY 0x80 /* marks a GiST internal-page entry whose + * subtree contains some empty ranges */ #define RANGE_HAS_LBOUND(flags) (!((flags) & (RANGE_EMPTY | \ RANGE_LB_NULL | \ @@ -136,4 +136,4 @@ extern bool bounds_adjacent(TypeCacheEntry *typcache, RangeBound bound1, RangeBound bound2); extern RangeType *make_empty_range(TypeCacheEntry *typcache); -#endif /* RANGETYPES_H */ +#endif /* RANGETYPES_H */ diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index dd5de58fef..ab07f614c8 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -74,7 +74,7 @@ typedef struct PartitionKeyData bool *parttypbyval; char *parttypalign; Oid *parttypcoll; -} PartitionKeyData; +} PartitionKeyData; typedef struct PartitionKeyData *PartitionKey; @@ -128,9 +128,9 @@ typedef struct RelationData bool rd_fkeyvalid; /* true if list has been computed */ MemoryContext rd_partkeycxt; /* private memory cxt for the below */ - struct PartitionKeyData *rd_partkey; /* partition key, or NULL */ + struct PartitionKeyData *rd_partkey; /* partition key, or NULL */ MemoryContext rd_pdcxt; /* private context for partdesc */ - struct PartitionDescData *rd_partdesc; /* partitions, or NULL */ + struct PartitionDescData *rd_partdesc; /* partitions, or NULL */ List *rd_partcheck; /* partition CHECK quals */ /* data managed by RelationGetIndexList: */ @@ -160,7 +160,7 @@ typedef struct RelationData /* These are non-NULL only for an index relation: */ Form_pg_index rd_index; /* pg_index tuple describing this index */ /* use "struct" here to avoid needing to include htup.h: */ - struct HeapTupleData *rd_indextuple; /* all of pg_index tuple */ + struct HeapTupleData *rd_indextuple; /* all of pg_index tuple */ /* * index access support info (used only for an index relation) @@ -180,7 +180,7 @@ typedef struct RelationData Oid rd_amhandler; /* OID of index AM's handler function */ MemoryContext rd_indexcxt; /* private memory cxt for this stuff */ /* use "struct" here to avoid needing to include amapi.h: */ - struct IndexAmRoutine *rd_amroutine; /* index AM's API struct */ + struct IndexAmRoutine *rd_amroutine; /* index AM's API struct */ Oid *rd_opfamily; /* OIDs of op families for each index col */ Oid *rd_opcintype; /* OIDs of opclass declared input data types */ RegProcedure *rd_support; /* OIDs of support procedures */ @@ -217,7 +217,7 @@ typedef struct RelationData Oid rd_toastoid; /* Real TOAST table's OID, or InvalidOid */ /* use "struct" here to avoid needing to include pgstat.h: */ - struct PgStat_TableStatus *pgstat_info; /* statistics collection area */ + struct PgStat_TableStatus *pgstat_info; /* statistics collection area */ #ifdef PGXC RelationLocInfo *rd_locator_info; #endif @@ -246,8 +246,8 @@ typedef struct ForeignKeyCacheInfo int nkeys; /* number of columns in the foreign key */ /* these arrays each have nkeys valid entries: */ AttrNumber conkey[INDEX_MAX_KEYS]; /* cols in referencing table */ - AttrNumber confkey[INDEX_MAX_KEYS]; /* cols in referenced table */ - Oid conpfeqop[INDEX_MAX_KEYS]; /* PK = FK operator OIDs */ + AttrNumber confkey[INDEX_MAX_KEYS]; /* cols in referenced table */ + Oid conpfeqop[INDEX_MAX_KEYS]; /* PK = FK operator OIDs */ } ForeignKeyCacheInfo; @@ -283,9 +283,8 @@ typedef struct StdRdOptions int32 vl_len_; /* varlena header (do not touch directly!) */ int fillfactor; /* page fill factor in percent (0..100) */ AutoVacOpts autovacuum; /* autovacuum-related options */ - bool user_catalog_table; /* use as an additional catalog - * relation */ - int parallel_workers; /* max number of parallel workers */ + bool user_catalog_table; /* use as an additional catalog relation */ + int parallel_workers; /* max number of parallel workers */ } StdRdOptions; #define HEAP_MIN_FILLFACTOR 10 @@ -691,4 +690,4 @@ extern void RelationDecrementReferenceCount(Relation rel); extern bool RelationHasUnloggedIndex(Relation rel); extern List *RelationGetRepsetList(Relation rel); -#endif /* REL_H */ +#endif /* REL_H */ diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h index 81af3aebb8..3c53cefe4b 100644 --- a/src/include/utils/relcache.h +++ b/src/include/utils/relcache.h @@ -135,4 +135,4 @@ extern bool criticalRelcachesBuilt; /* should be used only by relcache.c and postinit.c */ extern bool criticalSharedRelcachesBuilt; -#endif /* RELCACHE_H */ +#endif /* RELCACHE_H */ diff --git a/src/include/utils/relfilenodemap.h b/src/include/utils/relfilenodemap.h index 0827ff3db8..b3ee555fb7 100644 --- a/src/include/utils/relfilenodemap.h +++ b/src/include/utils/relfilenodemap.h @@ -15,4 +15,4 @@ extern Oid RelidByRelfilenode(Oid reltablespace, Oid relfilenode); -#endif /* RELFILENODEMAP_H */ +#endif /* RELFILENODEMAP_H */ diff --git a/src/include/utils/relmapper.h b/src/include/utils/relmapper.h index 8fb2879ff9..7af69ba6cf 100644 --- a/src/include/utils/relmapper.h +++ b/src/include/utils/relmapper.h @@ -63,4 +63,4 @@ extern void relmap_redo(XLogReaderState *record); extern void relmap_desc(StringInfo buf, XLogReaderState *record); extern const char *relmap_identify(uint8 info); -#endif /* RELMAPPER_H */ +#endif /* RELMAPPER_H */ diff --git a/src/include/utils/relptr.h b/src/include/utils/relptr.h index 1e5e622150..06e592e0c6 100644 --- a/src/include/utils/relptr.h +++ b/src/include/utils/relptr.h @@ -74,4 +74,4 @@ #define relptr_copy(rp1, rp2) \ ((rp1).relptr_off = (rp2).relptr_off) -#endif /* RELPTR_H */ +#endif /* RELPTR_H */ diff --git a/src/include/utils/reltrigger.h b/src/include/utils/reltrigger.h index 65d6ecb30a..2169b0306b 100644 --- a/src/include/utils/reltrigger.h +++ b/src/include/utils/reltrigger.h @@ -77,4 +77,4 @@ typedef struct TriggerDesc bool trig_delete_old_table; } TriggerDesc; -#endif /* RELTRIGGER_H */ +#endif /* RELTRIGGER_H */ diff --git a/src/include/utils/resowner.h b/src/include/utils/resowner.h index ff785e3a3e..07d30d93bc 100644 --- a/src/include/utils/resowner.h +++ b/src/include/utils/resowner.h @@ -54,9 +54,9 @@ typedef enum * by providing a callback of this form. */ typedef void (*ResourceReleaseCallback) (ResourceReleasePhase phase, - bool isCommit, - bool isTopLevel, - void *arg); + bool isCommit, + bool isTopLevel, + void *arg); /* @@ -79,4 +79,4 @@ extern void RegisterResourceReleaseCallback(ResourceReleaseCallback callback, extern void UnregisterResourceReleaseCallback(ResourceReleaseCallback callback, void *arg); -#endif /* RESOWNER_H */ +#endif /* RESOWNER_H */ diff --git a/src/include/utils/resowner_private.h b/src/include/utils/resowner_private.h index 2f763d7539..4c9d1fe50e 100644 --- a/src/include/utils/resowner_private.h +++ b/src/include/utils/resowner_private.h @@ -97,4 +97,4 @@ extern void ResourceOwnerForgetPreparedStmt(ResourceOwner owner, char *stmt); #endif -#endif /* RESOWNER_PRIVATE_H */ +#endif /* RESOWNER_PRIVATE_H */ diff --git a/src/include/utils/rls.h b/src/include/utils/rls.h index fa2c44e160..f9780ad0c0 100644 --- a/src/include/utils/rls.h +++ b/src/include/utils/rls.h @@ -47,4 +47,4 @@ enum CheckEnableRlsResult extern int check_enable_rls(Oid relid, Oid checkAsUser, bool noError); -#endif /* RLS_H */ +#endif /* RLS_H */ diff --git a/src/include/utils/ruleutils.h b/src/include/utils/ruleutils.h index 42fc872c4a..a2206cb7cd 100644 --- a/src/include/utils/ruleutils.h +++ b/src/include/utils/ruleutils.h @@ -34,4 +34,4 @@ extern List *select_rtable_names_for_explain(List *rtable, Bitmapset *rels_used); extern char *generate_collation_name(Oid collid); -#endif /* RULEUTILS_H */ +#endif /* RULEUTILS_H */ diff --git a/src/include/utils/sampling.h b/src/include/utils/sampling.h index 7edfc4a44d..f566e0b866 100644 --- a/src/include/utils/sampling.h +++ b/src/include/utils/sampling.h @@ -32,7 +32,7 @@ typedef struct int n; /* desired sample size */ BlockNumber t; /* current block number */ int m; /* blocks selected so far */ - SamplerRandomState randstate; /* random generator state */ + SamplerRandomState randstate; /* random generator state */ } BlockSamplerData; typedef BlockSamplerData *BlockSampler; @@ -47,7 +47,7 @@ extern BlockNumber BlockSampler_Next(BlockSampler bs); typedef struct { double W; - SamplerRandomState randstate; /* random generator state */ + SamplerRandomState randstate; /* random generator state */ } ReservoirStateData; typedef ReservoirStateData *ReservoirState; @@ -62,4 +62,4 @@ extern double anl_random_fract(void); extern double anl_init_selection_state(int n); extern double anl_get_next_S(double t, int n, double *stateptr); -#endif /* SAMPLING_H */ +#endif /* SAMPLING_H */ diff --git a/src/include/utils/selfuncs.h b/src/include/utils/selfuncs.h index 958bdba455..c7fdd540e8 100644 --- a/src/include/utils/selfuncs.h +++ b/src/include/utils/selfuncs.h @@ -126,10 +126,10 @@ typedef struct typedef struct { /* These are the values the cost estimator must return to the planner */ - Cost indexStartupCost; /* index-related startup cost */ + Cost indexStartupCost; /* index-related startup cost */ Cost indexTotalCost; /* total index-related scan cost */ - Selectivity indexSelectivity; /* selectivity of index */ - double indexCorrelation; /* order correlation of index */ + Selectivity indexSelectivity; /* selectivity of index */ + double indexCorrelation; /* order correlation of index */ /* Intermediate values we obtain along the way */ double numIndexPages; /* number of leaf pages visited */ @@ -140,14 +140,14 @@ typedef struct /* Hooks for plugins to get control when we ask for stats */ typedef bool (*get_relation_stats_hook_type) (PlannerInfo *root, - RangeTblEntry *rte, - AttrNumber attnum, - VariableStatData *vardata); + RangeTblEntry *rte, + AttrNumber attnum, + VariableStatData *vardata); extern PGDLLIMPORT get_relation_stats_hook_type get_relation_stats_hook; typedef bool (*get_index_stats_hook_type) (PlannerInfo *root, - Oid indexOid, - AttrNumber indexattnum, - VariableStatData *vardata); + Oid indexOid, + AttrNumber indexattnum, + VariableStatData *vardata); extern PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook; /* Functions in selfuncs.c */ @@ -222,4 +222,4 @@ extern Selectivity scalararraysel_containment(PlannerInfo *root, Oid elemtype, bool isEquality, bool useOr, int varRelid); -#endif /* SELFUNCS_H */ +#endif /* SELFUNCS_H */ diff --git a/src/include/utils/snapmgr.h b/src/include/utils/snapmgr.h index 2a3f8eca34..fc64153780 100644 --- a/src/include/utils/snapmgr.h +++ b/src/include/utils/snapmgr.h @@ -110,4 +110,4 @@ extern void SerializeSnapshot(Snapshot snapshot, char *start_address); extern Snapshot RestoreSnapshot(char *start_address); extern void RestoreTransactionSnapshot(Snapshot snapshot, void *master_pgproc); -#endif /* SNAPMGR_H */ +#endif /* SNAPMGR_H */ diff --git a/src/include/utils/snapshot.h b/src/include/utils/snapshot.h index a981d90616..b113fc9b6a 100644 --- a/src/include/utils/snapshot.h +++ b/src/include/utils/snapshot.h @@ -32,7 +32,7 @@ typedef struct SnapshotData *Snapshot; * function. */ typedef bool (*SnapshotSatisfiesFunc) (HeapTuple htup, - Snapshot snapshot, Buffer buffer); + Snapshot snapshot, Buffer buffer); /* * Struct representing all kind of possible snapshots. @@ -130,4 +130,4 @@ typedef enum HeapTupleWouldBlock /* can be returned by heap_tuple_lock */ } HTSU_Result; -#endif /* SNAPSHOT_H */ +#endif /* SNAPSHOT_H */ diff --git a/src/include/utils/sortsupport.h b/src/include/utils/sortsupport.h index 9ca8fe86ae..6e8444b4ff 100644 --- a/src/include/utils/sortsupport.h +++ b/src/include/utils/sortsupport.h @@ -72,7 +72,7 @@ typedef struct SortSupportData * sort support functions. */ bool ssup_reverse; /* descending-order sort? */ - bool ssup_nulls_first; /* sort nulls first? */ + bool ssup_nulls_first; /* sort nulls first? */ /* * These fields are workspace for callers, and should not be touched by @@ -274,4 +274,4 @@ extern void PrepareSortSupportFromOrderingOp(Oid orderingOp, SortSupport ssup); extern void PrepareSortSupportFromIndexRel(Relation indexRel, int16 strategy, SortSupport ssup); -#endif /* SORTSUPPORT_H */ +#endif /* SORTSUPPORT_H */ diff --git a/src/include/utils/spccache.h b/src/include/utils/spccache.h index 26f88da0b2..7c45bb11eb 100644 --- a/src/include/utils/spccache.h +++ b/src/include/utils/spccache.h @@ -17,4 +17,4 @@ void get_tablespace_page_costs(Oid spcid, float8 *spc_random_page_cost, float8 *spc_seq_page_cost); int get_tablespace_io_concurrency(Oid spcid); -#endif /* SPCCACHE_H */ +#endif /* SPCCACHE_H */ diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h index 67cc6f4c23..211e47bc40 100644 --- a/src/include/utils/syscache.h +++ b/src/include/utils/syscache.h @@ -218,4 +218,4 @@ extern bool RelationSupportsSysCache(Oid relid); #define ReleaseSysCacheList(x) ReleaseCatCacheList(x) -#endif /* SYSCACHE_H */ +#endif /* SYSCACHE_H */ diff --git a/src/include/utils/timeout.h b/src/include/utils/timeout.h index aa816334c0..5a2efc0dd9 100644 --- a/src/include/utils/timeout.h +++ b/src/include/utils/timeout.h @@ -84,4 +84,4 @@ extern bool get_timeout_indicator(TimeoutId id, bool reset_indicator); extern TimestampTz get_timeout_start_time(TimeoutId id); extern TimestampTz get_timeout_finish_time(TimeoutId id); -#endif /* TIMEOUT_H */ +#endif /* TIMEOUT_H */ diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h index 5e7e353b73..f778037e05 100644 --- a/src/include/utils/timestamp.h +++ b/src/include/utils/timestamp.h @@ -84,16 +84,16 @@ extern pg_time_t timestamptz_to_time_t(TimestampTz t); extern const char *timestamptz_to_str(TimestampTz t); -extern int tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *dt); -extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, +extern int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *dt); +extern int timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone); extern void dt2time(Timestamp dt, int *hour, int *min, int *sec, fsec_t *fsec); -extern int interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec); -extern int tm2interval(struct pg_tm * tm, fsec_t fsec, Interval *span); +extern int interval2tm(Interval span, struct pg_tm *tm, fsec_t *fsec); +extern int tm2interval(struct pg_tm *tm, fsec_t fsec, Interval *span); extern Timestamp SetEpochTimestamp(void); -extern void GetEpochTime(struct pg_tm * tm); +extern void GetEpochTime(struct pg_tm *tm); extern int timestamp_cmp_internal(Timestamp dt1, Timestamp dt2); @@ -107,4 +107,4 @@ extern int date2isoweek(int year, int mon, int mday); extern int date2isoyear(int year, int mon, int mday); extern int date2isoyearday(int year, int mon, int mday); -#endif /* TIMESTAMP_H */ +#endif /* TIMESTAMP_H */ diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h index f39f21bb64..036d9898d6 100644 --- a/src/include/utils/tqual.h +++ b/src/include/utils/tqual.h @@ -51,7 +51,7 @@ typedef enum HEAPTUPLE_DEAD, /* tuple is dead and deletable */ HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */ HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */ - HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */ + HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */ HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */ } HTSV_Result; @@ -109,4 +109,4 @@ extern bool ResolveCminCmaxDuringDecoding(struct HTAB *tuplecid_data, (snapshotdata).lsn = (l), \ (snapshotdata).whenTaken = (w)) -#endif /* TQUAL_H */ +#endif /* TQUAL_H */ diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h index d6be7fe826..97bb38f84e 100644 --- a/src/include/utils/tuplesort.h +++ b/src/include/utils/tuplesort.h @@ -134,4 +134,4 @@ extern void tuplesort_rescan(Tuplesortstate *state); extern void tuplesort_markpos(Tuplesortstate *state); extern void tuplesort_restorepos(Tuplesortstate *state); -#endif /* TUPLESORT_H */ +#endif /* TUPLESORT_H */ diff --git a/src/include/utils/tuplestore.h b/src/include/utils/tuplestore.h index aef4fc9840..33b5c9f996 100644 --- a/src/include/utils/tuplestore.h +++ b/src/include/utils/tuplestore.h @@ -99,4 +99,4 @@ extern char *tuplestore_getmessage(Tuplestorestate *state, int *len); extern void tuplestore_collect_stat(Tuplestorestate *state, char *name); -#endif /* TUPLESTORE_H */ +#endif /* TUPLESTORE_H */ diff --git a/src/include/utils/typcache.h b/src/include/utils/typcache.h index 1bf94e2548..c12631dafe 100644 --- a/src/include/utils/typcache.h +++ b/src/include/utils/typcache.h @@ -83,9 +83,9 @@ typedef struct TypeCacheEntry */ struct TypeCacheEntry *rngelemtype; /* range's element type */ Oid rng_collation; /* collation for comparisons, if any */ - FmgrInfo rng_cmp_proc_finfo; /* comparison function */ + FmgrInfo rng_cmp_proc_finfo; /* comparison function */ FmgrInfo rng_canonical_finfo; /* canonicalization function, if any */ - FmgrInfo rng_subdiff_finfo; /* difference function, if any */ + FmgrInfo rng_subdiff_finfo; /* difference function, if any */ /* * Domain constraint data if it's a domain type. NULL if not domain, or @@ -136,7 +136,7 @@ typedef struct DomainConstraintRef /* Management data --- treat these fields as private to typcache.c */ DomainConstraintCache *dcc; /* current constraints, or NULL if none */ - MemoryContextCallback callback; /* used to release refcount when done */ + MemoryContextCallback callback; /* used to release refcount when done */ } DomainConstraintRef; @@ -160,4 +160,4 @@ extern void assign_record_type_typmod(TupleDesc tupDesc); extern int compare_values_of_enum(TypeCacheEntry *tcache, Oid arg1, Oid arg2); -#endif /* TYPCACHE_H */ +#endif /* TYPCACHE_H */ diff --git a/src/include/utils/tzparser.h b/src/include/utils/tzparser.h index c22467de1a..1e444e1159 100644 --- a/src/include/utils/tzparser.h +++ b/src/include/utils/tzparser.h @@ -36,4 +36,4 @@ typedef struct tzEntry extern TimeZoneAbbrevTable *load_tzoffsets(const char *filename); -#endif /* TZPARSER_H */ +#endif /* TZPARSER_H */ diff --git a/src/include/utils/uuid.h b/src/include/utils/uuid.h index 9e62d81c3d..ed3ec28959 100644 --- a/src/include/utils/uuid.h +++ b/src/include/utils/uuid.h @@ -28,4 +28,4 @@ typedef struct pg_uuid_t #define DatumGetUUIDP(X) ((pg_uuid_t *) DatumGetPointer(X)) #define PG_GETARG_UUID_P(X) DatumGetUUIDP(PG_GETARG_DATUM(X)) -#endif /* UUID_H */ +#endif /* UUID_H */ diff --git a/src/include/utils/xml.h b/src/include/utils/xml.h index 195b9b3a97..e6fa0e2051 100644 --- a/src/include/utils/xml.h +++ b/src/include/utils/xml.h @@ -28,19 +28,19 @@ typedef enum XML_STANDALONE_NO, XML_STANDALONE_NO_VALUE, XML_STANDALONE_OMITTED -} XmlStandaloneType; +} XmlStandaloneType; typedef enum { XMLBINARY_BASE64, XMLBINARY_HEX -} XmlBinaryType; +} XmlBinaryType; typedef enum { PG_XML_STRICTNESS_LEGACY, /* ignore errors unless function result * indicates error condition */ - PG_XML_STRICTNESS_WELLFORMED, /* ignore non-parser messages */ + PG_XML_STRICTNESS_WELLFORMED, /* ignore non-parser messages */ PG_XML_STRICTNESS_ALL /* report all notices/warnings/errors */ } PgXmlStrictness; @@ -81,4 +81,4 @@ extern int xmloption; /* XmlOptionType, but int for guc enum */ extern const TableFuncRoutine XmlTableRoutine; -#endif /* XML_H */ +#endif /* XML_H */ diff --git a/src/include/windowapi.h b/src/include/windowapi.h index 481ebe06cf..0aa23ef2f5 100644 --- a/src/include/windowapi.h +++ b/src/include/windowapi.h @@ -61,4 +61,4 @@ extern Datum WinGetFuncArgInFrame(WindowObject winobj, int argno, extern Datum WinGetFuncArgCurrent(WindowObject winobj, int argno, bool *isnull); -#endif /* WINDOWAPI_H */ +#endif /* WINDOWAPI_H */ diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c index e50aa5ec65..2508ed9b8f 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -205,8 +205,8 @@ deccvasc(char *cp, int len, decimal *np) if (risnull(CSTRINGTYPE, cp)) return 0; - str = ecpg_strndup(cp, len);/* decimal_in always converts the complete - * string */ + str = ecpg_strndup(cp, len); /* decimal_in always converts the complete + * string */ if (!str) ret = ECPG_INFORMIX_NUM_UNDERFLOW; else @@ -692,7 +692,7 @@ static struct int remaining; char sign; char *val_string; -} value; +} value; /** * initialize the struct, which holds the different forms diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index c90f13dc6c..0716abdd7e 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -110,7 +110,7 @@ ecpg_get_connection(const char *connection_name) } static void -ecpg_finish(struct connection * act) +ecpg_finish(struct connection *act) { if (act != NULL) { diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c index 499a4c1780..5dbfded873 100644 --- a/src/interfaces/ecpg/ecpglib/data.c +++ b/src/interfaces/ecpg/ecpglib/data.c @@ -187,7 +187,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, case ECPGt_unsigned_long_long: *((long long int *) (ind + ind_offset * act_tuple)) = value_for_indicator; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ case ECPGt_NO_INDICATOR: if (value_for_indicator == -1) { @@ -202,7 +202,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, else { ecpg_raise(lineno, ECPG_MISSING_INDICATOR, - ECPG_SQLSTATE_NULL_VALUE_NO_INDICATOR_PARAMETER, + ECPG_SQLSTATE_NULL_VALUE_NO_INDICATOR_PARAMETER, NULL); return (false); } @@ -275,7 +275,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, case ECPGt_unsigned_long_long: *((long long int *) (ind + ind_offset * act_tuple)) = size; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ default: break; } @@ -369,7 +369,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, pval = scan_length; break; -#endif /* HAVE_STRTOLL */ +#endif /* HAVE_STRTOLL */ #ifdef HAVE_STRTOULL case ECPGt_unsigned_long_long: *((unsigned long long int *) (var + offset * act_tuple)) = strtoull(pval, &scan_length, 10); @@ -381,8 +381,8 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, pval = scan_length; break; -#endif /* HAVE_STRTOULL */ -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_STRTOULL */ +#endif /* HAVE_LONG_LONG_INT */ case ECPGt_float: case ECPGt_double: @@ -496,7 +496,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, case ECPGt_unsigned_long_long: *((long long int *) (ind + ind_offset * act_tuple)) = size; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ default: break; } @@ -541,7 +541,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, case ECPGt_unsigned_long_long: *((long long int *) (ind + ind_offset * act_tuple)) = variable->len; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ default: break; } @@ -580,7 +580,7 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno, else { ecpg_raise(lineno, ECPG_OUT_OF_MEMORY, - ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); + ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY, NULL); return (false); } } diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index 15fd7a08a5..1fa00b892f 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -16,14 +16,14 @@ #include "sqlda.h" #include "sql3types.h" -static void descriptor_free(struct descriptor * desc); +static void descriptor_free(struct descriptor *desc); /* We manage descriptors separately for each thread. */ #ifdef ENABLE_THREAD_SAFETY static pthread_key_t descriptor_key; static pthread_once_t descriptor_once = PTHREAD_ONCE_INIT; -static void descriptor_deallocate_all(struct descriptor * list); +static void descriptor_deallocate_all(struct descriptor *list); static void descriptor_destructor(void *arg) @@ -45,7 +45,7 @@ get_descriptors(void) } static void -set_descriptors(struct descriptor * value) +set_descriptors(struct descriptor *value) { pthread_setspecific(descriptor_key, value); } @@ -141,7 +141,7 @@ get_int_item(int lineno, void *var, enum ECPGttype vartype, int value) case ECPGt_unsigned_long_long: *(unsigned long long int *) var = (unsigned long long int) value; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ case ECPGt_float: *(float *) var = (float) value; break; @@ -186,7 +186,7 @@ set_int_item(int lineno, int *target, const void *var, enum ECPGttype vartype) case ECPGt_unsigned_long_long: *target = *(const unsigned long long int *) var; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ case ECPGt_float: *target = *(const float *) var; break; @@ -689,7 +689,7 @@ ECPGset_desc(int lineno, const char *desc_name, int index,...) /* Free the descriptor and items in it. */ static void -descriptor_free(struct descriptor * desc) +descriptor_free(struct descriptor *desc) { struct descriptor_item *desc_item; @@ -743,7 +743,7 @@ ECPGdeallocate_desc(int line, const char *name) /* Deallocate all descriptors in the list */ static void -descriptor_deallocate_all(struct descriptor * list) +descriptor_deallocate_all(struct descriptor *list) { while (list) { @@ -753,7 +753,7 @@ descriptor_deallocate_all(struct descriptor * list) list = next; } } -#endif /* ENABLE_THREAD_SAFETY */ +#endif /* ENABLE_THREAD_SAFETY */ bool ECPGallocate_desc(int line, const char *name) @@ -855,7 +855,7 @@ ECPGdescribe(int line, int compat, bool input, const char *connection_name, cons /* rest of variable parameters */ ptr = va_arg(args, void *); - (void) va_arg(args, long); /* skip args */ + (void) va_arg(args, long); /* skip args */ (void) va_arg(args, long); (void) va_arg(args, long); diff --git a/src/interfaces/ecpg/ecpglib/error.c b/src/interfaces/ecpg/ecpglib/error.c index 656b2c420a..77d6cc2dae 100644 --- a/src/interfaces/ecpg/ecpglib/error.c +++ b/src/interfaces/ecpg/ecpglib/error.c @@ -44,7 +44,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str) snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), /*------ translator: this string will be truncated at 149 characters expanded. */ - ecpg_gettext("unsupported type \"%s\" on line %d"), str, line); + ecpg_gettext("unsupported type \"%s\" on line %d"), str, line); break; case ECPG_TOO_MANY_ARGUMENTS: @@ -106,7 +106,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str) snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), /*------ translator: this string will be truncated at 149 characters expanded. */ - ecpg_gettext("null value without indicator on line %d"), line); + ecpg_gettext("null value without indicator on line %d"), line); break; case ECPG_NO_ARRAY: @@ -162,7 +162,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str) snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), /*------ translator: this string will be truncated at 149 characters expanded. */ - ecpg_gettext("descriptor index out of range on line %d"), line); + ecpg_gettext("descriptor index out of range on line %d"), line); break; case ECPG_UNKNOWN_DESCRIPTOR_ITEM: @@ -190,7 +190,7 @@ ecpg_raise(int line, int code, const char *sqlstate, const char *str) snprintf(sqlca->sqlerrm.sqlerrmc, sizeof(sqlca->sqlerrm.sqlerrmc), /*------ translator: this string will be truncated at 149 characters expanded. */ - ecpg_gettext("error in transaction processing on line %d"), line); + ecpg_gettext("error in transaction processing on line %d"), line); break; case ECPG_CONNECT: diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index bd9b86be49..03c55d3593 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -82,7 +82,7 @@ quote_postgres(char *arg, bool quote, int lineno) } static void -free_variable(struct variable * var) +free_variable(struct variable *var) { struct variable *var_next; @@ -95,7 +95,7 @@ free_variable(struct variable * var) } static void -free_statement(struct statement * stmt) +free_statement(struct statement *stmt) { if (stmt == NULL) return; @@ -145,7 +145,7 @@ next_insert(char *text, int pos, bool questionmarks) } static bool -ecpg_type_infocache_push(struct ECPGtype_information_cache ** cache, int oid, enum ARRAY_TYPE isarray, int lineno) +ecpg_type_infocache_push(struct ECPGtype_information_cache **cache, int oid, enum ARRAY_TYPE isarray, int lineno) { struct ECPGtype_information_cache *new_entry = (struct ECPGtype_information_cache *) ecpg_alloc(sizeof(struct ECPGtype_information_cache), lineno); @@ -161,7 +161,7 @@ ecpg_type_infocache_push(struct ECPGtype_information_cache ** cache, int oid, en } static enum ARRAY_TYPE -ecpg_is_type_an_array(int type, const struct statement * stmt, const struct variable * var) +ecpg_is_type_an_array(int type, const struct statement *stmt, const struct variable *var) { char *array_query; enum ARRAY_TYPE isarray = ECPG_ARRAY_NOT_SET; @@ -307,7 +307,7 @@ ecpg_is_type_an_array(int type, const struct statement * stmt, const struct vari bool ecpg_store_result(const PGresult *results, int act_field, - const struct statement * stmt, struct variable * var) + const struct statement *stmt, struct variable *var) { enum ARRAY_TYPE isarray; int act_tuple, @@ -364,7 +364,7 @@ ecpg_store_result(const PGresult *results, int act_field, /* special mode for handling char**foo=0 */ for (act_tuple = 0; act_tuple < ntuples; act_tuple++) len += strlen(PQgetvalue(results, act_tuple, act_field)) + 1; - len *= var->offset; /* should be 1, but YMNK */ + len *= var->offset; /* should be 1, but YMNK */ len += (ntuples + 1) * sizeof(char *); } else @@ -431,7 +431,7 @@ ecpg_store_result(const PGresult *results, int act_field, int len = strlen(PQgetvalue(results, act_tuple, act_field)) + 1; if (!ecpg_get_data(results, act_tuple, act_field, stmt->lineno, - var->type, var->ind_type, current_data_location, + var->type, var->ind_type, current_data_location, var->ind_value, len, 0, var->ind_offset, isarray, stmt->compat, stmt->force_indicator)) status = false; else @@ -491,7 +491,7 @@ sprintf_float_value(char *ptr, float value, const char *delim) } bool -ecpg_store_input(const int lineno, const bool force_indicator, const struct variable * var, +ecpg_store_input(const int lineno, const bool force_indicator, const struct variable *var, char **tobeinserted_p, bool quote) { char *mallocedval = NULL; @@ -534,7 +534,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari if (*(long long int *) var->ind_value < (long long) 0) *tobeinserted_p = NULL; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ case ECPGt_NO_INDICATOR: if (force_indicator == false) { @@ -704,7 +704,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari *tobeinserted_p = mallocedval; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ case ECPGt_float: if (!(mallocedval = ecpg_alloc(asize * 25, lineno))) return false; @@ -1049,7 +1049,7 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari } void -ecpg_free_params(struct statement * stmt, bool print) +ecpg_free_params(struct statement *stmt, bool print) { int n; @@ -1065,7 +1065,7 @@ ecpg_free_params(struct statement * stmt, bool print) } static bool -insert_tobeinserted(int position, int ph_len, struct statement * stmt, char *tobeinserted) +insert_tobeinserted(int position, int ph_len, struct statement *stmt, char *tobeinserted) { char *newcopy; @@ -1104,7 +1104,7 @@ insert_tobeinserted(int position, int ph_len, struct statement * stmt, char *tob * in arrays which can be used by PQexecParams(). */ bool -ecpg_build_params(struct statement * stmt) +ecpg_build_params(struct statement *stmt) { struct variable *var; int desc_counter = 0; @@ -1361,8 +1361,8 @@ ecpg_build_params(struct statement * stmt) if (stmt->command[position] == '?') { /* yes, replace with new style */ - int buffersize = sizeof(int) * CHAR_BIT * 10 / 3; /* a rough guess of the - * size we need */ + int buffersize = sizeof(int) * CHAR_BIT * 10 / 3; /* a rough guess of the + * size we need */ if (!(tobeinserted = (char *) ecpg_alloc(buffersize, stmt->lineno))) { @@ -1389,7 +1389,7 @@ ecpg_build_params(struct statement * stmt) if (next_insert(stmt->command, position, stmt->questionmarks) >= 0) { ecpg_raise(stmt->lineno, ECPG_TOO_FEW_ARGUMENTS, - ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, NULL); + ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, NULL); ecpg_free_params(stmt, false); return false; } @@ -1402,7 +1402,7 @@ ecpg_build_params(struct statement * stmt) * If we are in non-autocommit mode, automatically start a transaction. */ bool -ecpg_autostart_transaction(struct statement * stmt) +ecpg_autostart_transaction(struct statement *stmt) { if (PQtransactionStatus(stmt->connection->connection) == PQTRANS_IDLE && !stmt->connection->autocommit) { @@ -1423,7 +1423,7 @@ ecpg_autostart_transaction(struct statement * stmt) * Execute the SQL statement. */ bool -ecpg_execute(struct statement * stmt) +ecpg_execute(struct statement *stmt) { ecpg_log("ecpg_execute on line %d: query: %s; with %d parameter(s) on connection %s\n", stmt->lineno, stmt->command, stmt->nparams, stmt->connection->name); if (stmt->statement_type == ECPGst_execute) @@ -1471,7 +1471,7 @@ ecpg_execute(struct statement * stmt) *------- */ bool -ecpg_process_output(struct statement * stmt, bool clear_result) +ecpg_process_output(struct statement *stmt, bool clear_result) { struct variable *var; bool status = false; @@ -1747,7 +1747,7 @@ bool ecpg_do_prologue(int lineno, const int compat, const int force_indicator, const char *connection_name, const bool questionmarks, enum ECPG_statement_type statement_type, const char *query, - va_list args, struct statement ** stmt_out) + va_list args, struct statement **stmt_out) { struct statement *stmt; struct connection *con; @@ -1976,7 +1976,7 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator, * Restore the application locale and free the statement structure. */ void -ecpg_do_epilogue(struct statement * stmt) +ecpg_do_epilogue(struct statement *stmt) { if (stmt == NULL) return; diff --git a/src/interfaces/ecpg/ecpglib/extern.h b/src/interfaces/ecpg/ecpglib/extern.h index fb9b5aebbe..91c7367b8b 100644 --- a/src/interfaces/ecpg/ecpglib/extern.h +++ b/src/interfaces/ecpg/ecpglib/extern.h @@ -163,18 +163,18 @@ struct descriptor *ecpggetdescp(int, char *); struct descriptor *ecpg_find_desc(int line, const char *name); struct prepared_statement *ecpg_find_prepared_statement(const char *, - struct connection *, struct prepared_statement **); + struct connection *, struct prepared_statement **); bool ecpg_store_result(const PGresult *results, int act_field, - const struct statement * stmt, struct variable * var); + const struct statement *stmt, struct variable *var); bool ecpg_store_input(const int, const bool, const struct variable *, char **, bool); -void ecpg_free_params(struct statement * stmt, bool print); +void ecpg_free_params(struct statement *stmt, bool print); bool ecpg_do_prologue(int, const int, const int, const char *, const bool, enum ECPG_statement_type, const char *, va_list, struct statement **); bool ecpg_build_params(struct statement *); -bool ecpg_autostart_transaction(struct statement * stmt); -bool ecpg_execute(struct statement * stmt); +bool ecpg_autostart_transaction(struct statement *stmt); +bool ecpg_execute(struct statement *stmt); bool ecpg_process_output(struct statement *, bool); void ecpg_do_epilogue(struct statement *); bool ecpg_do(const int, const int, const int, const char *, const bool, @@ -184,10 +184,10 @@ bool ecpg_check_PQresult(PGresult *, int, PGconn *, enum COMPAT_MODE); void ecpg_raise(int line, int code, const char *sqlstate, const char *str); void ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat); char *ecpg_prepared(const char *, struct connection *); -bool ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection * conn); +bool ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection *conn); void ecpg_log(const char *format,...) pg_attribute_printf(1, 2); bool ecpg_auto_prepare(int, const char *, const int, char **, const char *); -void ecpg_init_sqlca(struct sqlca_t * sqlca); +void ecpg_init_sqlca(struct sqlca_t *sqlca); struct sqlda_compat *ecpg_build_compat_sqlda(int, PGresult *, int, enum COMPAT_MODE); void ecpg_set_compat_sqlda(int, struct sqlda_compat **, const PGresult *, int, enum COMPAT_MODE); @@ -220,4 +220,4 @@ void ecpg_set_native_sqlda(int, struct sqlda_struct **, const PGresult *, int, #define ECPG_SQLSTATE_ECPG_INTERNAL_ERROR "YE000" #define ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY "YE001" -#endif /* _ECPG_LIB_EXTERN_H */ +#endif /* _ECPG_LIB_EXTERN_H */ diff --git a/src/interfaces/ecpg/ecpglib/memory.c b/src/interfaces/ecpg/ecpglib/memory.c index 9c1d20efc5..a7268bb0f6 100644 --- a/src/interfaces/ecpg/ecpglib/memory.c +++ b/src/interfaces/ecpg/ecpglib/memory.c @@ -93,7 +93,7 @@ get_auto_allocs(void) } static void -set_auto_allocs(struct auto_mem * am) +set_auto_allocs(struct auto_mem *am) { pthread_setspecific(auto_mem_key, am); } diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c index 019ebe10f9..edd7302d54 100644 --- a/src/interfaces/ecpg/ecpglib/misc.c +++ b/src/interfaces/ecpg/ecpglib/misc.c @@ -23,9 +23,9 @@ #define LONG_LONG_MIN LLONG_MIN #else #define LONG_LONG_MIN LONGLONG_MIN -#endif /* LLONG_MIN */ -#endif /* LONG_LONG_MIN */ -#endif /* HAVE_LONG_LONG_INT */ +#endif /* LLONG_MIN */ +#endif /* LONG_LONG_MIN */ +#endif /* HAVE_LONG_LONG_INT */ bool ecpg_internal_regression_mode = false; @@ -96,13 +96,13 @@ static int simple_debug = 0; static FILE *debugstream = NULL; void -ecpg_init_sqlca(struct sqlca_t * sqlca) +ecpg_init_sqlca(struct sqlca_t *sqlca) { memcpy((char *) sqlca, (char *) &sqlca_init, sizeof(struct sqlca_t)); } bool -ecpg_init(const struct connection * con, const char *connection_name, const int lineno) +ecpg_init(const struct connection *con, const char *connection_name, const int lineno) { struct sqlca_t *sqlca = ECPGget_sqlca(); @@ -344,7 +344,7 @@ ECPGset_noind_null(enum ECPGttype type, void *ptr) case ECPGt_unsigned_long_long: *((long long *) ptr) = LONG_LONG_MIN; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ case ECPGt_float: memset((char *) ptr, 0xff, sizeof(float)); break; @@ -417,7 +417,7 @@ ECPGis_noind_null(enum ECPGttype type, void *ptr) if (*((long long *) ptr) == LONG_LONG_MIN) return true; break; -#endif /* HAVE_LONG_LONG_INT */ +#endif /* HAVE_LONG_LONG_INT */ case ECPGt_float: return (_check(ptr, sizeof(float))); break; @@ -481,8 +481,8 @@ win32_pthread_once(volatile pthread_once_t *once, void (*fn) (void)) pthread_mutex_unlock(&win32_pthread_once_lock); } } -#endif /* ENABLE_THREAD_SAFETY */ -#endif /* WIN32 */ +#endif /* ENABLE_THREAD_SAFETY */ +#endif /* WIN32 */ #ifdef ENABLE_NLS @@ -516,7 +516,7 @@ ecpg_gettext(const char *msgid) return dgettext(PG_TEXTDOMAIN("ecpglib"), msgid); } -#endif /* ENABLE_NLS */ +#endif /* ENABLE_NLS */ struct var_list *ivlist = NULL; diff --git a/src/interfaces/ecpg/ecpglib/pg_type.h b/src/interfaces/ecpg/ecpglib/pg_type.h index 48ae480129..94d2d9287b 100644 --- a/src/interfaces/ecpg/ecpglib/pg_type.h +++ b/src/interfaces/ecpg/ecpglib/pg_type.h @@ -76,4 +76,4 @@ #define JSONBOID 3802 #define INT4RANGEOID 3904 -#endif /* PG_TYPE_H */ +#endif /* PG_TYPE_H */ diff --git a/src/interfaces/ecpg/ecpglib/prepare.c b/src/interfaces/ecpg/ecpglib/prepare.c index 983b242d06..151aa80dc6 100644 --- a/src/interfaces/ecpg/ecpglib/prepare.c +++ b/src/interfaces/ecpg/ecpglib/prepare.c @@ -23,12 +23,12 @@ typedef struct } stmtCacheEntry; static int nextStmtID = 1; -static const int stmtCacheNBuckets = 2039; /* # buckets - a prime # */ -static const int stmtCacheEntPerBucket = 8; /* # entries/bucket */ +static const int stmtCacheNBuckets = 2039; /* # buckets - a prime # */ +static const int stmtCacheEntPerBucket = 8; /* # entries/bucket */ static stmtCacheEntry stmtCacheEntries[16384] = {{0, {0}, 0, 0, 0}}; -static bool deallocate_one(int lineno, enum COMPAT_MODE c, struct connection * con, - struct prepared_statement * prev, struct prepared_statement * this); +static bool deallocate_one(int lineno, enum COMPAT_MODE c, struct connection *con, + struct prepared_statement *prev, struct prepared_statement *this); static bool isvarchar(unsigned char c) @@ -100,7 +100,7 @@ replace_variables(char **text, int lineno) } static bool -prepare_common(int lineno, struct connection * con, const char *name, const char *variable) +prepare_common(int lineno, struct connection *con, const char *name, const char *variable) { struct statement *stmt; struct prepared_statement *this; @@ -180,7 +180,7 @@ ECPGprepare(int lineno, const char *connection_name, const bool questionmarks, c struct prepared_statement * ecpg_find_prepared_statement(const char *name, - struct connection * con, struct prepared_statement ** prev_) + struct connection *con, struct prepared_statement **prev_) { struct prepared_statement *this, *prev; @@ -198,7 +198,7 @@ ecpg_find_prepared_statement(const char *name, } static bool -deallocate_one(int lineno, enum COMPAT_MODE c, struct connection * con, struct prepared_statement * prev, struct prepared_statement * this) +deallocate_one(int lineno, enum COMPAT_MODE c, struct connection *con, struct prepared_statement *prev, struct prepared_statement *this) { bool r = false; @@ -273,7 +273,7 @@ ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name) } bool -ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection * con) +ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection *con) { /* deallocate all prepared statements */ while (con->prep_stmts) @@ -292,7 +292,7 @@ ECPGdeallocate_all(int lineno, int compat, const char *connection_name) } char * -ecpg_prepared(const char *name, struct connection * con) +ecpg_prepared(const char *name, struct connection *con) { struct prepared_statement *this; @@ -380,7 +380,7 @@ SearchStmtCache(const char *ecpgQuery) * OR negative error code */ static int -ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */ +ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free */ { stmtCacheEntry *entry; struct connection *con; @@ -416,7 +416,7 @@ ecpg_freeStmtCacheEntry(int lineno, int compat, int entNo) /* entry # to free * */ static int AddStmtToCache(int lineno, /* line # of statement */ - const char *stmtID, /* statement ID */ + const char *stmtID, /* statement ID */ const char *connection, /* connection */ int compat, /* compatibility level */ const char *ecpgQuery) /* query */ diff --git a/src/interfaces/ecpg/ecpglib/sqlda.c b/src/interfaces/ecpg/ecpglib/sqlda.c index bc94f2f859..c1ba989166 100644 --- a/src/interfaces/ecpg/ecpglib/sqlda.c +++ b/src/interfaces/ecpg/ecpglib/sqlda.c @@ -249,7 +249,7 @@ static int16 value_is_null = -1; static int16 value_is_not_null = 0; void -ecpg_set_compat_sqlda(int lineno, struct sqlda_compat ** _sqlda, const PGresult *res, int row, enum COMPAT_MODE compat) +ecpg_set_compat_sqlda(int lineno, struct sqlda_compat **_sqlda, const PGresult *res, int row, enum COMPAT_MODE compat) { struct sqlda_compat *sqlda = (*_sqlda); int i; @@ -438,7 +438,7 @@ ecpg_build_native_sqlda(int line, PGresult *res, int row, enum COMPAT_MODE compa } void -ecpg_set_native_sqlda(int lineno, struct sqlda_struct ** _sqlda, const PGresult *res, int row, enum COMPAT_MODE compat) +ecpg_set_native_sqlda(int lineno, struct sqlda_struct **_sqlda, const PGresult *res, int row, enum COMPAT_MODE compat) { struct sqlda_struct *sqlda = (*_sqlda); int i; diff --git a/src/interfaces/ecpg/ecpglib/typename.c b/src/interfaces/ecpg/ecpglib/typename.c index f90279cf81..48587e49c7 100644 --- a/src/interfaces/ecpg/ecpglib/typename.c +++ b/src/interfaces/ecpg/ecpglib/typename.c @@ -75,19 +75,19 @@ ecpg_dynamic_type(Oid type) case BOOLOID: return SQL3_BOOLEAN; /* bool */ case INT2OID: - return SQL3_SMALLINT; /* int2 */ + return SQL3_SMALLINT; /* int2 */ case INT4OID: return SQL3_INTEGER; /* int4 */ case TEXTOID: - return SQL3_CHARACTER; /* text */ + return SQL3_CHARACTER; /* text */ case FLOAT4OID: return SQL3_REAL; /* float4 */ case FLOAT8OID: - return SQL3_DOUBLE_PRECISION; /* float8 */ + return SQL3_DOUBLE_PRECISION; /* float8 */ case BPCHAROID: - return SQL3_CHARACTER; /* bpchar */ + return SQL3_CHARACTER; /* bpchar */ case VARCHAROID: - return SQL3_CHARACTER_VARYING; /* varchar */ + return SQL3_CHARACTER_VARYING; /* varchar */ case DATEOID: return SQL3_DATE_TIME_TIMESTAMP; /* date */ case TIMEOID: diff --git a/src/interfaces/ecpg/include/datetime.h b/src/interfaces/ecpg/include/datetime.h index 9394a129f1..44b24227e5 100644 --- a/src/interfaces/ecpg/include/datetime.h +++ b/src/interfaces/ecpg/include/datetime.h @@ -9,6 +9,6 @@ #ifndef _ECPGLIB_H typedef timestamp dtime_t; typedef interval intrvl_t; -#endif /* ndef _ECPGLIB_H */ +#endif /* ndef _ECPGLIB_H */ -#endif /* ndef _ECPG_DATETIME_H */ +#endif /* ndef _ECPG_DATETIME_H */ diff --git a/src/interfaces/ecpg/include/decimal.h b/src/interfaces/ecpg/include/decimal.h index 11b02de8ae..6ac2962530 100644 --- a/src/interfaces/ecpg/include/decimal.h +++ b/src/interfaces/ecpg/include/decimal.h @@ -8,6 +8,6 @@ /* source created by ecpg which defines this */ #ifndef _ECPGLIB_H typedef decimal dec_t; -#endif /* ndef _ECPGLIB_H */ +#endif /* ndef _ECPGLIB_H */ -#endif /* ndef _ECPG_DECIMAL_H */ +#endif /* ndef _ECPG_DECIMAL_H */ diff --git a/src/interfaces/ecpg/include/ecpg-pthread-win32.h b/src/interfaces/ecpg/include/ecpg-pthread-win32.h index 7e59357a38..33c897b633 100644 --- a/src/interfaces/ecpg/include/ecpg-pthread-win32.h +++ b/src/interfaces/ecpg/include/ecpg-pthread-win32.h @@ -52,7 +52,7 @@ void win32_pthread_once(volatile pthread_once_t *once, void (*fn) (void)); if (!*(once)) \ win32_pthread_once((once), (fn)); \ } while(0) -#endif /* WIN32 */ -#endif /* ENABLE_THREAD_SAFETY */ +#endif /* WIN32 */ +#endif /* ENABLE_THREAD_SAFETY */ -#endif /* _ECPG_PTHREAD_WIN32_H */ +#endif /* _ECPG_PTHREAD_WIN32_H */ diff --git a/src/interfaces/ecpg/include/ecpg_informix.h b/src/interfaces/ecpg/include/ecpg_informix.h index 3ffeb95b5a..dd6258152a 100644 --- a/src/interfaces/ecpg/include/ecpg_informix.h +++ b/src/interfaces/ecpg/include/ecpg_informix.h @@ -29,7 +29,7 @@ #define ECPG_INFORMIX_EXTRA_CHARS -1264 #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -87,4 +87,4 @@ extern int dtcvfmtasc(char *, char *, timestamp *); } #endif -#endif /* ndef _ECPG_INFORMIX_H */ +#endif /* ndef _ECPG_INFORMIX_H */ diff --git a/src/interfaces/ecpg/include/ecpgerrno.h b/src/interfaces/ecpg/include/ecpgerrno.h index 36b15b7a61..c4bc526463 100644 --- a/src/interfaces/ecpg/include/ecpgerrno.h +++ b/src/interfaces/ecpg/include/ecpgerrno.h @@ -76,4 +76,4 @@ /* WARNING: BlankPortalAssignName: portal * already exists */ #define ECPG_WARNING_PORTAL_EXISTS -605 -#endif /* !_ECPG_ERRNO_H */ +#endif /* !_ECPG_ERRNO_H */ diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h index c32df6c5d5..536b7506ff 100644 --- a/src/interfaces/ecpg/include/ecpglib.h +++ b/src/interfaces/ecpg/include/ecpglib.h @@ -21,26 +21,26 @@ extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1); #ifndef __cplusplus #ifndef bool #define bool char -#endif /* ndef bool */ +#endif /* ndef bool */ #ifndef true #define true ((bool) 1) -#endif /* ndef true */ +#endif /* ndef true */ #ifndef false #define false ((bool) 0) -#endif /* ndef false */ -#endif /* not C++ */ +#endif /* ndef false */ +#endif /* not C++ */ #ifndef TRUE #define TRUE 1 -#endif /* TRUE */ +#endif /* TRUE */ #ifndef FALSE #define FALSE 0 -#endif /* FALSE */ +#endif /* FALSE */ #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -97,4 +97,4 @@ void ecpg_pthreads_init(void); } #endif -#endif /* _ECPGLIB_H */ +#endif /* _ECPGLIB_H */ diff --git a/src/interfaces/ecpg/include/ecpgtype.h b/src/interfaces/ecpg/include/ecpgtype.h index 7cc47e91e3..38fb3b6eaf 100644 --- a/src/interfaces/ecpg/include/ecpgtype.h +++ b/src/interfaces/ecpg/include/ecpgtype.h @@ -34,7 +34,7 @@ #define _ECPGTYPE_H #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -103,4 +103,4 @@ enum ECPG_statement_type } #endif -#endif /* _ECPGTYPE_H */ +#endif /* _ECPGTYPE_H */ diff --git a/src/interfaces/ecpg/include/pgtypes_date.h b/src/interfaces/ecpg/include/pgtypes_date.h index b8990bb072..3d1a181b2b 100644 --- a/src/interfaces/ecpg/include/pgtypes_date.h +++ b/src/interfaces/ecpg/include/pgtypes_date.h @@ -8,11 +8,11 @@ typedef long date; #ifdef __cplusplus -extern "C" +extern "C" { #endif -extern date *PGTYPESdate_new(void); +extern date * PGTYPESdate_new(void); extern void PGTYPESdate_free(date *); extern date PGTYPESdate_from_asc(char *, char **); extern char *PGTYPESdate_to_asc(date); @@ -28,4 +28,4 @@ extern int PGTYPESdate_fmt_asc(date, const char *, char *); } #endif -#endif /* PGTYPES_DATETIME */ +#endif /* PGTYPES_DATETIME */ diff --git a/src/interfaces/ecpg/include/pgtypes_interval.h b/src/interfaces/ecpg/include/pgtypes_interval.h index d5b085deb4..5747736fe1 100644 --- a/src/interfaces/ecpg/include/pgtypes_interval.h +++ b/src/interfaces/ecpg/include/pgtypes_interval.h @@ -21,22 +21,22 @@ typedef long long int int64; #endif #define HAVE_INT64_TIMESTAMP -#endif /* C_H */ +#endif /* C_H */ typedef struct { int64 time; /* all time units other than months and years */ long month; /* months and years, after time for alignment */ -} interval; +} interval; #ifdef __cplusplus -extern "C" +extern "C" { #endif -extern interval *PGTYPESinterval_new(void); +extern interval * PGTYPESinterval_new(void); extern void PGTYPESinterval_free(interval *); -extern interval *PGTYPESinterval_from_asc(char *, char **); +extern interval * PGTYPESinterval_from_asc(char *, char **); extern char *PGTYPESinterval_to_asc(interval *); extern int PGTYPESinterval_copy(interval *, interval *); @@ -44,4 +44,4 @@ extern int PGTYPESinterval_copy(interval *, interval *); } #endif -#endif /* PGTYPES_INTERVAL */ +#endif /* PGTYPES_INTERVAL */ diff --git a/src/interfaces/ecpg/include/pgtypes_numeric.h b/src/interfaces/ecpg/include/pgtypes_numeric.h index 1b9e4c35e4..56c46ea272 100644 --- a/src/interfaces/ecpg/include/pgtypes_numeric.h +++ b/src/interfaces/ecpg/include/pgtypes_numeric.h @@ -31,11 +31,11 @@ typedef struct int rscale; /* result scale */ int dscale; /* display scale */ int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */ - NumericDigit digits[DECSIZE]; /* decimal digits */ + NumericDigit digits[DECSIZE]; /* decimal digits */ } decimal; #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -64,4 +64,4 @@ int PGTYPESnumeric_from_decimal(decimal *, numeric *); } #endif -#endif /* PGTYPES_NUMERIC */ +#endif /* PGTYPES_NUMERIC */ diff --git a/src/interfaces/ecpg/include/pgtypes_timestamp.h b/src/interfaces/ecpg/include/pgtypes_timestamp.h index 144e606f7f..283ecca25e 100644 --- a/src/interfaces/ecpg/include/pgtypes_timestamp.h +++ b/src/interfaces/ecpg/include/pgtypes_timestamp.h @@ -10,7 +10,7 @@ typedef int64 timestamp; typedef int64 TimestampTz; #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -27,4 +27,4 @@ extern int PGTYPEStimestamp_sub_interval(timestamp * tin, interval * span, times } #endif -#endif /* PGTYPES_TIMESTAMP */ +#endif /* PGTYPES_TIMESTAMP */ diff --git a/src/interfaces/ecpg/include/sql3types.h b/src/interfaces/ecpg/include/sql3types.h index b9db452dac..644b616cf8 100644 --- a/src/interfaces/ecpg/include/sql3types.h +++ b/src/interfaces/ecpg/include/sql3types.h @@ -40,4 +40,4 @@ enum * standard) */ }; -#endif /* !_ECPG_SQL3TYPES_H */ +#endif /* !_ECPG_SQL3TYPES_H */ diff --git a/src/interfaces/ecpg/include/sqlca.h b/src/interfaces/ecpg/include/sqlca.h index 41e5b550af..c5f107dd33 100644 --- a/src/interfaces/ecpg/include/sqlca.h +++ b/src/interfaces/ecpg/include/sqlca.h @@ -6,13 +6,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/include/sqlda-compat.h b/src/interfaces/ecpg/include/sqlda-compat.h index 2c4e07c5f1..7393182aa9 100644 --- a/src/interfaces/ecpg/include/sqlda-compat.h +++ b/src/interfaces/ecpg/include/sqlda-compat.h @@ -40,8 +40,8 @@ struct sqlda_compat struct sqlvar_compat *sqlvar; char desc_name[19]; /* descriptor name */ short desc_occ; /* size of sqlda structure */ - struct sqlda_compat *desc_next; /* pointer to next sqlda struct */ + struct sqlda_compat *desc_next; /* pointer to next sqlda struct */ void *reserved; /* reserved for future use */ }; -#endif /* ECPG_SQLDA_COMPAT_H */ +#endif /* ECPG_SQLDA_COMPAT_H */ diff --git a/src/interfaces/ecpg/include/sqlda-native.h b/src/interfaces/ecpg/include/sqlda-native.h index acb314cd17..67d3c7b4e4 100644 --- a/src/interfaces/ecpg/include/sqlda-native.h +++ b/src/interfaces/ecpg/include/sqlda-native.h @@ -40,4 +40,4 @@ struct sqlda_struct struct sqlvar_struct sqlvar[1]; }; -#endif /* ECPG_SQLDA_NATIVE_H */ +#endif /* ECPG_SQLDA_NATIVE_H */ diff --git a/src/interfaces/ecpg/include/sqlda.h b/src/interfaces/ecpg/include/sqlda.h index c265beb66c..d810e739e2 100644 --- a/src/interfaces/ecpg/include/sqlda.h +++ b/src/interfaces/ecpg/include/sqlda.h @@ -15,4 +15,4 @@ typedef struct sqlda_struct sqlda_t; #endif -#endif /* ECPG_SQLDA_H */ +#endif /* ECPG_SQLDA_H */ diff --git a/src/interfaces/ecpg/include/sqltypes.h b/src/interfaces/ecpg/include/sqltypes.h index 797cb5b1be..e7cbfa4795 100644 --- a/src/interfaces/ecpg/include/sqltypes.h +++ b/src/interfaces/ecpg/include/sqltypes.h @@ -54,4 +54,4 @@ #define SQLSERIAL8 ECPGt_long #endif -#endif /* ndef ECPG_SQLTYPES_H */ +#endif /* ndef ECPG_SQLTYPES_H */ diff --git a/src/interfaces/ecpg/pgtypeslib/datetime.c b/src/interfaces/ecpg/pgtypeslib/datetime.c index 702bf89ef0..33c9011a71 100644 --- a/src/interfaces/ecpg/pgtypeslib/datetime.c +++ b/src/interfaces/ecpg/pgtypeslib/datetime.c @@ -156,8 +156,8 @@ PGTYPESdate_today(date * d) return; } -#define PGTYPES_DATE_NUM_MAX_DIGITS 20 /* should suffice for most - * years... */ +#define PGTYPES_DATE_NUM_MAX_DIGITS 20 /* should suffice for most + * years... */ #define PGTYPES_FMTDATE_DAY_DIGITS_LZ 1 /* LZ means "leading zeroes" */ #define PGTYPES_FMTDATE_DOW_LITERAL_SHORT 2 @@ -441,7 +441,7 @@ PGTYPESdate_defmt_asc(date * d, const char *fmt, char *str) /* * as long as the string, one additional byte for the terminator and 2 - * for the delimiters between the 3 fiedls + * for the delimiters between the 3 fields */ str_copy = pgtypes_alloc(strlen(str) + 1 + 2); if (!str_copy) diff --git a/src/interfaces/ecpg/pgtypeslib/dt.h b/src/interfaces/ecpg/pgtypeslib/dt.h index dc711b914b..5a192ddc45 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt.h +++ b/src/interfaces/ecpg/pgtypeslib/dt.h @@ -313,12 +313,12 @@ do { \ int DecodeInterval(char **, int *, int, int *, struct tm *, fsec_t *); int DecodeTime(char *, int *, struct tm *, fsec_t *); -int EncodeDateTime(struct tm * tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates); -int EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str); +int EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates); +int EncodeInterval(struct tm *tm, fsec_t fsec, int style, char *str); int tm2timestamp(struct tm *, fsec_t, int *, timestamp *); int DecodeUnits(int field, char *lowtoken, int *val); bool CheckDateTokenTables(void); -int EncodeDateOnly(struct tm * tm, int style, char *str, bool EuroDates); +int EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates); int GetEpochTime(struct tm *); int ParseDateTime(char *, char *, char **, int *, int *, char **); int DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool); @@ -338,4 +338,4 @@ extern char *months[]; extern char *days[]; extern int day_tab[2][13]; -#endif /* DT_H */ +#endif /* DT_H */ diff --git a/src/interfaces/ecpg/pgtypeslib/dt_common.c b/src/interfaces/ecpg/pgtypeslib/dt_common.c index 82939db58b..a26d61b32c 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt_common.c +++ b/src/interfaces/ecpg/pgtypeslib/dt_common.c @@ -30,7 +30,7 @@ static datetkn datetktbl[] = { {"ahst", TZ, -36000}, /* Alaska-Hawaii Std Time */ {"akdt", DTZ, -28800}, /* Alaska Daylight Time */ {"akst", DTZ, -32400}, /* Alaska Standard Time */ - {"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */ + {"allballs", RESERV, DTK_ZULU}, /* 00:00:00 */ {"almst", TZ, 25200}, /* Almaty Savings Time */ {"almt", TZ, 21600}, /* Almaty Time */ {"am", AMPM, AM}, @@ -201,12 +201,12 @@ static datetkn datetktbl[] = { idt /* Israeli, Iran, Indian Daylight Time */ #endif {LATE, RESERV, DTK_LATE}, /* "infinity" reserved for "late time" */ - {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */ + {INVALID, RESERV, DTK_INVALID}, /* "invalid" reserved for bad time */ {"iot", TZ, 18000}, /* Indian Chagos Time */ {"irkst", DTZ, 32400}, /* Irkutsk Summer Time */ {"irkt", TZ, 28800}, /* Irkutsk Time */ {"irt", TZ, 12600}, /* Iran Time */ - {"isodow", UNITS, DTK_ISODOW}, /* ISO day of week, Sunday == 7 */ + {"isodow", UNITS, DTK_ISODOW}, /* ISO day of week, Sunday == 7 */ #if 0 isst #endif @@ -425,33 +425,33 @@ static datetkn deltatktbl[] = { {"@", IGNORE_DTF, 0}, /* postgres relative prefix */ {DAGO, AGO, 0}, /* "ago" indicates negative time offset */ {"c", UNITS, DTK_CENTURY}, /* "century" relative */ - {"cent", UNITS, DTK_CENTURY}, /* "century" relative */ + {"cent", UNITS, DTK_CENTURY}, /* "century" relative */ {"centuries", UNITS, DTK_CENTURY}, /* "centuries" relative */ - {DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative */ + {DCENTURY, UNITS, DTK_CENTURY}, /* "century" relative */ {"d", UNITS, DTK_DAY}, /* "day" relative */ {DDAY, UNITS, DTK_DAY}, /* "day" relative */ {"days", UNITS, DTK_DAY}, /* "days" relative */ {"dec", UNITS, DTK_DECADE}, /* "decade" relative */ - {DDECADE, UNITS, DTK_DECADE}, /* "decade" relative */ - {"decades", UNITS, DTK_DECADE}, /* "decades" relative */ + {DDECADE, UNITS, DTK_DECADE}, /* "decade" relative */ + {"decades", UNITS, DTK_DECADE}, /* "decades" relative */ {"decs", UNITS, DTK_DECADE}, /* "decades" relative */ {"h", UNITS, DTK_HOUR}, /* "hour" relative */ {DHOUR, UNITS, DTK_HOUR}, /* "hour" relative */ {"hours", UNITS, DTK_HOUR}, /* "hours" relative */ {"hr", UNITS, DTK_HOUR}, /* "hour" relative */ {"hrs", UNITS, DTK_HOUR}, /* "hours" relative */ - {INVALID, RESERV, DTK_INVALID}, /* reserved for invalid time */ + {INVALID, RESERV, DTK_INVALID}, /* reserved for invalid time */ {"m", UNITS, DTK_MINUTE}, /* "minute" relative */ - {"microsecon", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ - {"mil", UNITS, DTK_MILLENNIUM}, /* "millennium" relative */ - {"millennia", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */ - {DMILLENNIUM, UNITS, DTK_MILLENNIUM}, /* "millennium" relative */ - {"millisecon", UNITS, DTK_MILLISEC}, /* relative */ + {"microsecon", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ + {"mil", UNITS, DTK_MILLENNIUM}, /* "millennium" relative */ + {"millennia", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */ + {DMILLENNIUM, UNITS, DTK_MILLENNIUM}, /* "millennium" relative */ + {"millisecon", UNITS, DTK_MILLISEC}, /* relative */ {"mils", UNITS, DTK_MILLENNIUM}, /* "millennia" relative */ {"min", UNITS, DTK_MINUTE}, /* "minute" relative */ {"mins", UNITS, DTK_MINUTE}, /* "minutes" relative */ - {DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative */ - {"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative */ + {DMINUTE, UNITS, DTK_MINUTE}, /* "minute" relative */ + {"minutes", UNITS, DTK_MINUTE}, /* "minutes" relative */ {"mon", UNITS, DTK_MONTH}, /* "months" relative */ {"mons", UNITS, DTK_MONTH}, /* "months" relative */ {DMONTH, UNITS, DTK_MONTH}, /* "month" relative */ @@ -462,7 +462,7 @@ static datetkn deltatktbl[] = { {"mseconds", UNITS, DTK_MILLISEC}, {"msecs", UNITS, DTK_MILLISEC}, {"qtr", UNITS, DTK_QUARTER}, /* "quarter" relative */ - {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative */ + {DQUARTER, UNITS, DTK_QUARTER}, /* "quarter" relative */ {"s", UNITS, DTK_SECOND}, {"sec", UNITS, DTK_SECOND}, {DSECOND, UNITS, DTK_SECOND}, @@ -470,13 +470,13 @@ static datetkn deltatktbl[] = { {"secs", UNITS, DTK_SECOND}, {DTIMEZONE, UNITS, DTK_TZ}, /* "timezone" time offset */ {"timezone_h", UNITS, DTK_TZ_HOUR}, /* timezone hour units */ - {"timezone_m", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */ + {"timezone_m", UNITS, DTK_TZ_MINUTE}, /* timezone minutes units */ {"undefined", RESERV, DTK_INVALID}, /* pre-v6.1 invalid time */ {"us", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ - {"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ + {"usec", UNITS, DTK_MICROSEC}, /* "microsecond" relative */ {DMICROSEC, UNITS, DTK_MICROSEC}, /* "microsecond" relative */ {"useconds", UNITS, DTK_MICROSEC}, /* "microseconds" relative */ - {"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative */ + {"usecs", UNITS, DTK_MICROSEC}, /* "microseconds" relative */ {"w", UNITS, DTK_WEEK}, /* "week" relative */ {DWEEK, UNITS, DTK_WEEK}, /* "week" relative */ {"weeks", UNITS, DTK_WEEK}, /* "weeks" relative */ @@ -561,7 +561,7 @@ DecodeUnits(int field, char *lowtoken, int *val) } return type; -} /* DecodeUnits() */ +} /* DecodeUnits() */ /* * Calendar time to Julian date conversions. @@ -604,7 +604,7 @@ date2j(int y, int m, int d) julian += 7834 * m / 256 + d; return julian; -} /* date2j() */ +} /* date2j() */ void j2date(int jd, int *year, int *month, int *day) @@ -630,7 +630,7 @@ j2date(int jd, int *year, int *month, int *day) *month = (quad + 10) % 12 + 1; return; -} /* j2date() */ +} /* j2date() */ /* DecodeSpecial() * Decode text string using lookup table. @@ -666,13 +666,13 @@ DecodeSpecial(int field, char *lowtoken, int *val) } return type; -} /* DecodeSpecial() */ +} /* DecodeSpecial() */ /* EncodeDateOnly() * Encode date as local time. */ int -EncodeDateOnly(struct tm * tm, int style, char *str, bool EuroDates) +EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates) { if (tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR) return -1; @@ -725,7 +725,7 @@ EncodeDateOnly(struct tm * tm, int style, char *str, bool EuroDates) } return TRUE; -} /* EncodeDateOnly() */ +} /* EncodeDateOnly() */ void TrimTrailingZeros(char *str) @@ -759,7 +759,7 @@ TrimTrailingZeros(char *str) * European - dd/mm/yyyy */ int -EncodeDateTime(struct tm * tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates) +EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates) { int day, hour, @@ -953,10 +953,10 @@ EncodeDateTime(struct tm * tm, fsec_t fsec, bool print_tz, int tz, const char *t } return TRUE; -} /* EncodeDateTime() */ +} /* EncodeDateTime() */ int -GetEpochTime(struct tm * tm) +GetEpochTime(struct tm *tm) { struct tm *t0; time_t epoch = 0; @@ -976,10 +976,10 @@ GetEpochTime(struct tm * tm) } return -1; -} /* GetEpochTime() */ +} /* GetEpochTime() */ static void -abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn) +abstime2tm(AbsoluteTime _time, int *tzp, struct tm *tm, char **tzn) { time_t time = (time_t) _time; struct tm *tx; @@ -1064,7 +1064,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct tm * tm, char **tzn) } void -GetCurrentDateTime(struct tm * tm) +GetCurrentDateTime(struct tm *tm) { int tz; @@ -1083,7 +1083,7 @@ dt2time(double jd, int *hour, int *min, int *sec, fsec_t *fsec) time -= (*min) * USECS_PER_MINUTE; *sec = time / USECS_PER_SEC; *fsec = time - (*sec * USECS_PER_SEC); -} /* dt2time() */ +} /* dt2time() */ @@ -1094,7 +1094,7 @@ dt2time(double jd, int *hour, int *min, int *sec, fsec_t *fsec) */ static int DecodeNumberField(int len, char *str, int fmask, - int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits) + int *tmask, struct tm *tm, fsec_t *fsec, int *is2digits) { char *cp; @@ -1196,7 +1196,7 @@ DecodeNumberField(int len, char *str, int fmask, } return -1; -} /* DecodeNumberField() */ +} /* DecodeNumberField() */ /* DecodeNumber() @@ -1204,7 +1204,7 @@ DecodeNumberField(int len, char *str, int fmask, */ static int DecodeNumber(int flen, char *str, int fmask, - int *tmask, struct tm * tm, fsec_t *fsec, int *is2digits, bool EuroDates) + int *tmask, struct tm *tm, fsec_t *fsec, int *is2digits, bool EuroDates) { int val; char *cp; @@ -1305,14 +1305,14 @@ DecodeNumber(int flen, char *str, int fmask, return -1; return 0; -} /* DecodeNumber() */ +} /* DecodeNumber() */ /* DecodeDate() * Decode date string which includes delimiters. * Insist on a complete set of fields. */ static int -DecodeDate(char *str, int fmask, int *tmask, struct tm * tm, bool EuroDates) +DecodeDate(char *str, int fmask, int *tmask, struct tm *tm, bool EuroDates) { fsec_t fsec; @@ -1432,7 +1432,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm, bool EuroDates) } return 0; -} /* DecodeDate() */ +} /* DecodeDate() */ /* DecodeTime() @@ -1441,7 +1441,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm, bool EuroDates) * can be used to represent time spans. */ int -DecodeTime(char *str, int *tmask, struct tm * tm, fsec_t *fsec) +DecodeTime(char *str, int *tmask, struct tm *tm, fsec_t *fsec) { char *cp; @@ -1497,7 +1497,7 @@ DecodeTime(char *str, int *tmask, struct tm * tm, fsec_t *fsec) return -1; return 0; -} /* DecodeTime() */ +} /* DecodeTime() */ /* DecodeTimezone() * Interpret string as a numeric timezone. @@ -1541,7 +1541,7 @@ DecodeTimezone(char *str, int *tzp) *tzp = -tz; return *cp != '\0'; -} /* DecodeTimezone() */ +} /* DecodeTimezone() */ /* DecodePosixTimezone() @@ -1583,7 +1583,7 @@ DecodePosixTimezone(char *str, int *tzp) } return 0; -} /* DecodePosixTimezone() */ +} /* DecodePosixTimezone() */ /* ParseDateTime() * Break string into tokens based on a date/time context. @@ -1763,7 +1763,7 @@ ParseDateTime(char *timestr, char *lowstr, *numfields = nf; return 0; -} /* ParseDateTime() */ +} /* ParseDateTime() */ /* DecodeDateTime() @@ -1788,7 +1788,7 @@ ParseDateTime(char *timestr, char *lowstr, */ int DecodeDateTime(char **field, int *ftype, int nf, - int *dtype, struct tm * tm, fsec_t *fsec, bool EuroDates) + int *dtype, struct tm *tm, fsec_t *fsec, bool EuroDates) { int fmask = 0, tmask, @@ -1894,7 +1894,7 @@ DecodeDateTime(char **field, int *ftype, int nf, * time */ if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], fmask, - &tmask, tm, fsec, &is2digits)) < 0) + &tmask, tm, fsec, &is2digits)) < 0) return -1; /* @@ -2074,7 +2074,7 @@ DecodeDateTime(char **field, int *ftype, int nf, case DTK_TIME: /* previous field was "t" for ISO time */ if ((ftype[i] = DecodeNumberField(strlen(field[i]), field[i], (fmask | DTK_DATE_M), - &tmask, tm, fsec, &is2digits)) < 0) + &tmask, tm, fsec, &is2digits)) < 0) return -1; if (tmask != DTK_TIME_M) @@ -2112,18 +2112,18 @@ DecodeDateTime(char **field, int *ftype, int nf, * Example: 20011223 or 040506 */ if ((ftype[i] = DecodeNumberField(flen, field[i], fmask, - &tmask, tm, fsec, &is2digits)) < 0) + &tmask, tm, fsec, &is2digits)) < 0) return -1; } else if (flen > 4) { if ((ftype[i] = DecodeNumberField(flen, field[i], fmask, - &tmask, tm, fsec, &is2digits)) < 0) + &tmask, tm, fsec, &is2digits)) < 0) return -1; } /* otherwise it is a single date/time field... */ else if (DecodeNumber(flen, field[i], fmask, - &tmask, tm, fsec, &is2digits, EuroDates) != 0) + &tmask, tm, fsec, &is2digits, EuroDates) != 0) return -1; } break; @@ -2151,7 +2151,7 @@ DecodeDateTime(char **field, int *ftype, int nf, *dtype = DTK_DATE; GetCurrentDateTime(tm); j2date(date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) - 1, - &tm->tm_year, &tm->tm_mon, &tm->tm_mday); + &tm->tm_year, &tm->tm_mon, &tm->tm_mday); tm->tm_hour = 0; tm->tm_min = 0; tm->tm_sec = 0; @@ -2171,7 +2171,7 @@ DecodeDateTime(char **field, int *ftype, int nf, *dtype = DTK_DATE; GetCurrentDateTime(tm); j2date(date2j(tm->tm_year, tm->tm_mon, tm->tm_mday) + 1, - &tm->tm_year, &tm->tm_mon, &tm->tm_mday); + &tm->tm_year, &tm->tm_mon, &tm->tm_mday); tm->tm_hour = 0; tm->tm_min = 0; tm->tm_sec = 0; @@ -2351,7 +2351,7 @@ DecodeDateTime(char **field, int *ftype, int nf, } return 0; -} /* DecodeDateTime() */ +} /* DecodeDateTime() */ /* Function works as follows: * @@ -2464,7 +2464,7 @@ find_end_token(char *str, char *fmt) } static int -pgtypes_defmt_scan(union un_fmt_comb * scan_val, int scan_type, char **pstr, char *pfmt) +pgtypes_defmt_scan(union un_fmt_comb *scan_val, int scan_type, char **pstr, char *pfmt) { /* * scan everything between pstr and pstr_end. This is not including the diff --git a/src/interfaces/ecpg/pgtypeslib/extern.h b/src/interfaces/ecpg/pgtypeslib/extern.h index 88b2fb0775..9df800ea1d 100644 --- a/src/interfaces/ecpg/pgtypeslib/extern.h +++ b/src/interfaces/ecpg/pgtypeslib/extern.h @@ -11,13 +11,12 @@ #define PGTYPES_TYPE_STRING_MALLOCED 1 #define PGTYPES_TYPE_STRING_CONSTANT 2 #define PGTYPES_TYPE_CHAR 3 -#define PGTYPES_TYPE_DOUBLE_NF 4 /* no fractional part */ +#define PGTYPES_TYPE_DOUBLE_NF 4 /* no fractional part */ #define PGTYPES_TYPE_INT64 5 #define PGTYPES_TYPE_UINT 6 -#define PGTYPES_TYPE_UINT_2_LZ 7 /* 2 digits, pad with leading - * zero */ -#define PGTYPES_TYPE_UINT_2_LS 8 /* 2 digits, pad with leading - * space */ +#define PGTYPES_TYPE_UINT_2_LZ 7 /* 2 digits, pad with leading zero */ +#define PGTYPES_TYPE_UINT_2_LS 8 /* 2 digits, pad with leading + * space */ #define PGTYPES_TYPE_UINT_3_LZ 9 #define PGTYPES_TYPE_UINT_4_LZ 10 #define PGTYPES_TYPE_UINT_LONG 11 @@ -41,14 +40,14 @@ char *pgtypes_strdup(const char *); #ifndef bool #define bool char -#endif /* ndef bool */ +#endif /* ndef bool */ #ifndef FALSE #define FALSE 0 -#endif /* FALSE */ +#endif /* FALSE */ #ifndef TRUE #define TRUE 1 -#endif /* TRUE */ +#endif /* TRUE */ -#endif /* __PGTYPES_COMMON_H__ */ +#endif /* __PGTYPES_COMMON_H__ */ diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c index 16fe70d29e..30f2ccbcb7 100644 --- a/src/interfaces/ecpg/pgtypeslib/interval.c +++ b/src/interfaces/ecpg/pgtypeslib/interval.c @@ -32,7 +32,7 @@ strtoint(const char *nptr, char **endptr, int base) * and changesd struct pg_tm to struct tm */ static void -AdjustFractSeconds(double frac, struct /* pg_ */ tm * tm, fsec_t *fsec, int scale) +AdjustFractSeconds(double frac, struct /* pg_ */ tm *tm, fsec_t *fsec, int scale) { int sec; @@ -50,7 +50,7 @@ AdjustFractSeconds(double frac, struct /* pg_ */ tm * tm, fsec_t *fsec, int scal * and changesd struct pg_tm to struct tm */ static void -AdjustFractDays(double frac, struct /* pg_ */ tm * tm, fsec_t *fsec, int scale) +AdjustFractDays(double frac, struct /* pg_ */ tm *tm, fsec_t *fsec, int scale) { int extra_days; @@ -103,7 +103,7 @@ ISO8601IntegerWidth(char *fieldstart) * and changesd struct pg_tm to struct tm */ static inline void -ClearPgTm(struct /* pg_ */ tm * tm, fsec_t *fsec) +ClearPgTm(struct /* pg_ */ tm *tm, fsec_t *fsec) { tm->tm_year = 0; tm->tm_mon = 0; @@ -122,7 +122,7 @@ ClearPgTm(struct /* pg_ */ tm * tm, fsec_t *fsec) */ static int DecodeISO8601Interval(char *str, - int *dtype, struct /* pg_ */ tm * tm, fsec_t *fsec) + int *dtype, struct /* pg_ */ tm *tm, fsec_t *fsec) { bool datepart = true; bool havefield = false; @@ -335,8 +335,8 @@ DecodeISO8601Interval(char *str, * * Assert wasn't available so removed it. */ int -DecodeInterval(char **field, int *ftype, int nf, /* int range, */ - int *dtype, struct /* pg_ */ tm * tm, fsec_t *fsec) +DecodeInterval(char **field, int *ftype, int nf, /* int range, */ + int *dtype, struct /* pg_ */ tm *tm, fsec_t *fsec) { int IntervalStyle = INTSTYLE_POSTGRES_VERBOSE; int range = INTERVAL_FULL_RANGE; @@ -772,7 +772,7 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros) */ int -EncodeInterval(struct /* pg_ */ tm * tm, fsec_t fsec, int style, char *str) +EncodeInterval(struct /* pg_ */ tm *tm, fsec_t fsec, int style, char *str) { char *cp = str; int year = tm->tm_year; @@ -949,14 +949,14 @@ EncodeInterval(struct /* pg_ */ tm * tm, fsec_t fsec, int style, char *str) } return 0; -} /* EncodeInterval() */ +} /* EncodeInterval() */ /* interval2tm() * Convert an interval data type to a tm structure. */ static int -interval2tm(interval span, struct tm * tm, fsec_t *fsec) +interval2tm(interval span, struct tm *tm, fsec_t *fsec) { int64 time; @@ -984,10 +984,10 @@ interval2tm(interval span, struct tm * tm, fsec_t *fsec) *fsec = time - (tm->tm_sec * USECS_PER_SEC); return 0; -} /* interval2tm() */ +} /* interval2tm() */ static int -tm2interval(struct tm * tm, fsec_t fsec, interval * span) +tm2interval(struct tm *tm, fsec_t fsec, interval * span) { if ((double) tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon > INT_MAX || (double) tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon < INT_MIN) @@ -999,7 +999,7 @@ tm2interval(struct tm * tm, fsec_t fsec, interval * span) tm->tm_sec) * USECS_PER_SEC) + fsec; return 0; -} /* tm2interval() */ +} /* tm2interval() */ interval * PGTYPESinterval_new(void) diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c index 49d7e1ced5..78931399e6 100644 --- a/src/interfaces/ecpg/pgtypeslib/timestamp.c +++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c @@ -22,14 +22,14 @@ static int64 time2t(const int hour, const int min, const int sec, const fsec_t fsec) { return (((((hour * MINS_PER_HOUR) + min) * SECS_PER_MINUTE) + sec) * USECS_PER_SEC) + fsec; -} /* time2t() */ +} /* time2t() */ static timestamp dt2local(timestamp dt, int tz) { dt -= (tz * USECS_PER_SEC); return dt; -} /* dt2local() */ +} /* dt2local() */ /* tm2timestamp() * Convert a tm structure to a timestamp data type. @@ -39,7 +39,7 @@ dt2local(timestamp dt, int tz) * Returns -1 on failure (overflow). */ int -tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp * result) +tm2timestamp(struct tm *tm, fsec_t fsec, int *tzp, timestamp * result) { int dDate; int64 time; @@ -67,7 +67,7 @@ tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp * result) return -1; return 0; -} /* tm2timestamp() */ +} /* tm2timestamp() */ static timestamp SetEpochTimestamp(void) @@ -82,7 +82,7 @@ SetEpochTimestamp(void) tm2timestamp(tm, 0, NULL, &dt); return dt; -} /* SetEpochTimestamp() */ +} /* SetEpochTimestamp() */ /* timestamp2tm() * Convert timestamp data type to POSIX time structure. @@ -96,7 +96,7 @@ SetEpochTimestamp(void) * local time zone. If out of this range, leave as GMT. - tgl 97/05/27 */ static int -timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, const char **tzn) +timestamp2tm(timestamp dt, int *tzp, struct tm *tm, fsec_t *fsec, const char **tzn) { int64 dDate, date0; @@ -152,7 +152,7 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, const char ** tm->tm_gmtoff = tx->tm_gmtoff; tm->tm_zone = tx->tm_zone; - *tzp = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */ + *tzp = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */ if (tzn != NULL) *tzn = tm->tm_zone; #elif defined(HAVE_INT_TIMEZONE) @@ -187,7 +187,7 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, const char ** tm->tm_yday = dDate - date2j(tm->tm_year, 1, 1) + 1; return 0; -} /* timestamp2tm() */ +} /* timestamp2tm() */ /* EncodeSpecialTimestamp() * * Convert reserved timestamp data type to string. @@ -203,7 +203,7 @@ EncodeSpecialTimestamp(timestamp dt, char *str) return FALSE; return TRUE; -} /* EncodeSpecialTimestamp() */ +} /* EncodeSpecialTimestamp() */ timestamp PGTYPEStimestamp_from_asc(char *str, char **endptr) @@ -309,7 +309,7 @@ PGTYPEStimestamp_current(timestamp * ts) } static int -dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm, +dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm *tm, char *output, int *pstr_len, const char *fmtstr) { union un_fmt_comb replace_val; diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c index c6442c1805..729f063f62 100644 --- a/src/interfaces/ecpg/preproc/descriptor.c +++ b/src/interfaces/ecpg/preproc/descriptor.c @@ -300,7 +300,7 @@ output_set_descr(char *desc_name, char *index) fprintf(base_yyout, "%s,", get_dtype(results->value)); ECPGdump_a_type(base_yyout, v->name, v->type, v->brace_level, - NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL); + NULL, NULL, -1, NULL, NULL, str_zero, NULL, NULL); free(str_zero); } break; diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index aaecbf8122..bad0a667fc 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -51,7 +51,7 @@ help(const char *progname) printf(_(" -I DIRECTORY search DIRECTORY for include files\n")); printf(_(" -o OUTFILE write result to OUTFILE\n")); printf(_(" -r OPTION specify run-time behavior; OPTION can be:\n" - " \"no_indicator\", \"prepare\", \"questionmarks\"\n")); + " \"no_indicator\", \"prepare\", \"questionmarks\"\n")); printf(_(" --regression run in regression testing mode\n")); printf(_(" -t turn on autocommit of transactions\n")); printf(_(" -V, --version output version information, then exit\n")); diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h index 0ce3a6e424..2c35426b7f 100644 --- a/src/interfaces/ecpg/preproc/extern.h +++ b/src/interfaces/ecpg/preproc/extern.h @@ -94,7 +94,7 @@ extern struct variable *descriptor_variable(const char *name, int input); extern struct variable *sqlda_variable(const char *name); extern void add_variable_to_head(struct arguments **, struct variable *, struct variable *); extern void add_variable_to_tail(struct arguments **, struct variable *, struct variable *); -extern void remove_variable_from_list(struct arguments ** list, struct variable * var); +extern void remove_variable_from_list(struct arguments **list, struct variable *var); extern void dump_variables(struct arguments *, int); extern struct typedefs *get_typedef(char *); extern void adjust_array(enum ECPGttype, char **, char **, char *, char *, int, bool); @@ -128,4 +128,4 @@ extern enum COMPAT_MODE compat; #define INFORMIX_MODE (compat == ECPG_COMPAT_INFORMIX || compat == ECPG_COMPAT_INFORMIX_SE) -#endif /* _ECPG_PREPROC_EXTERN_H */ +#endif /* _ECPG_PREPROC_EXTERN_H */ diff --git a/src/interfaces/ecpg/preproc/output.c b/src/interfaces/ecpg/preproc/output.c index 59d5d30df4..0479c93c99 100644 --- a/src/interfaces/ecpg/preproc/output.c +++ b/src/interfaces/ecpg/preproc/output.c @@ -32,7 +32,7 @@ struct when when_error, when_warn; static void -print_action(struct when * w) +print_action(struct when *w) { switch (w->code) { @@ -96,7 +96,7 @@ hashline_number(void) ) { /* "* 2" here is for escaping '\' and '"' below */ - char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename) *2); + char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename) * 2); char *src, *dest; @@ -228,8 +228,8 @@ output_escaped_str(char *str, bool quoted) j++; } while (str[j] == ' ' || str[j] == '\t'); - if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a - * newline */ + if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a + * newline */ fputs("\\\\", base_yyout); } else if (str[i] == '\r' && str[i + 1] == '\n') diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index 1bbdc64db8..750cdf9c7c 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -34,7 +34,7 @@ mm_strdup(const char *string) /* duplicate memberlist */ struct ECPGstruct_member * -ECPGstruct_member_dup(struct ECPGstruct_member * rm) +ECPGstruct_member_dup(struct ECPGstruct_member *rm) { struct ECPGstruct_member *new = NULL; @@ -74,7 +74,7 @@ ECPGstruct_member_dup(struct ECPGstruct_member * rm) /* The NAME argument is copied. The type argument is preserved as a pointer. */ void -ECPGmake_struct_member(char *name, struct ECPGtype * type, struct ECPGstruct_member ** start) +ECPGmake_struct_member(char *name, struct ECPGtype *type, struct ECPGstruct_member **start) { struct ECPGstruct_member *ptr, *ne = @@ -108,7 +108,7 @@ ECPGmake_simple_type(enum ECPGttype type, char *size, int counter) } struct ECPGtype * -ECPGmake_array_type(struct ECPGtype * type, char *size) +ECPGmake_array_type(struct ECPGtype *type, char *size) { struct ECPGtype *ne = ECPGmake_simple_type(ECPGt_array, size, 0); @@ -118,7 +118,7 @@ ECPGmake_array_type(struct ECPGtype * type, char *size) } struct ECPGtype * -ECPGmake_struct_type(struct ECPGstruct_member * rm, enum ECPGttype type, char *type_name, char *struct_sizeof) +ECPGmake_struct_type(struct ECPGstruct_member *rm, enum ECPGttype type, char *type_name, char *struct_sizeof) { struct ECPGtype *ne = ECPGmake_simple_type(type, mm_strdup("1"), 0); @@ -175,10 +175,10 @@ get_type(enum ECPGttype type) break; case ECPGt_varchar: return ("ECPGt_varchar"); - case ECPGt_NO_INDICATOR: /* no indicator */ + case ECPGt_NO_INDICATOR: /* no indicator */ return ("ECPGt_NO_INDICATOR"); break; - case ECPGt_char_variable: /* string that should not be quoted */ + case ECPGt_char_variable: /* string that should not be quoted */ return ("ECPGt_char_variable"); break; case ECPGt_const: /* constant string quoted */ @@ -233,11 +233,11 @@ static void ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, char *varcharsize, char *arrsize, const char *size, const char *prefix, int); static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsize, - struct ECPGtype * type, struct ECPGtype * ind_type, const char *prefix, const char *ind_prefix); + struct ECPGtype *type, struct ECPGtype *ind_type, const char *prefix, const char *ind_prefix); void -ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int brace_level, - const char *ind_name, struct ECPGtype * ind_type, const int ind_brace_level, +ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype *type, const int brace_level, + const char *ind_name, struct ECPGtype *ind_type, const int ind_brace_level, const char *prefix, const char *ind_prefix, char *arr_str_size, const char *struct_sizeof, const char *ind_struct_sizeof) @@ -569,7 +569,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, /* Penetrate a struct and dump the contents. */ static void -ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsize, struct ECPGtype * type, struct ECPGtype * ind_type, const char *prefix, const char *ind_prefix) +ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsize, struct ECPGtype *type, struct ECPGtype *ind_type, const char *prefix, const char *ind_prefix) { /* * If offset is NULL, then this is the first recursive level. If not then @@ -617,7 +617,7 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsize } void -ECPGfree_struct_member(struct ECPGstruct_member * rm) +ECPGfree_struct_member(struct ECPGstruct_member *rm) { while (rm) { @@ -631,7 +631,7 @@ ECPGfree_struct_member(struct ECPGstruct_member * rm) } void -ECPGfree_type(struct ECPGtype * type) +ECPGfree_type(struct ECPGtype *type) { if (!IS_SIMPLE_TYPE(type->type)) { diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/preproc/type.h index cd0d1da8c4..4b93336480 100644 --- a/src/interfaces/ecpg/preproc/type.h +++ b/src/interfaces/ecpg/preproc/type.h @@ -25,10 +25,9 @@ struct ECPGtype * string */ union { - struct ECPGtype *element; /* For an array this is the type of - * the element */ - struct ECPGstruct_member *members; /* A pointer to a list of - * members. */ + struct ECPGtype *element; /* For an array this is the type of the + * element */ + struct ECPGstruct_member *members; /* A pointer to a list of members. */ } u; int counter; }; @@ -195,4 +194,4 @@ struct fetch_desc char *name; }; -#endif /* _ECPG_PREPROC_TYPE_H */ +#endif /* _ECPG_PREPROC_TYPE_H */ diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c index 232b940938..31225738e0 100644 --- a/src/interfaces/ecpg/preproc/variable.c +++ b/src/interfaces/ecpg/preproc/variable.c @@ -7,7 +7,7 @@ static struct variable *allvariables = NULL; struct variable * -new_variable(const char *name, struct ECPGtype * type, int brace_level) +new_variable(const char *name, struct ECPGtype *type, int brace_level) { struct variable *p = (struct variable *) mm_alloc(sizeof(struct variable)); @@ -22,7 +22,7 @@ new_variable(const char *name, struct ECPGtype * type, int brace_level) } static struct variable * -find_struct_member(char *name, char *str, struct ECPGstruct_member * members, int brace_level) +find_struct_member(char *name, char *str, struct ECPGstruct_member *members, int brace_level) { char *next = strpbrk(++str, ".-["), *end, @@ -376,7 +376,7 @@ reset_variables(void) * Note: The list is dumped from the end, * so we have to add new entries at the beginning */ void -add_variable_to_head(struct arguments ** list, struct variable * var, struct variable * ind) +add_variable_to_head(struct arguments **list, struct variable *var, struct variable *ind) { struct arguments *p = (struct arguments *) mm_alloc(sizeof(struct arguments)); @@ -388,7 +388,7 @@ add_variable_to_head(struct arguments ** list, struct variable * var, struct var /* Append a new variable to our request list. */ void -add_variable_to_tail(struct arguments ** list, struct variable * var, struct variable * ind) +add_variable_to_tail(struct arguments **list, struct variable *var, struct variable *ind) { struct arguments *p, *new = (struct arguments *) mm_alloc(sizeof(struct arguments)); @@ -406,7 +406,7 @@ add_variable_to_tail(struct arguments ** list, struct variable * var, struct var } void -remove_variable_from_list(struct arguments ** list, struct variable * var) +remove_variable_from_list(struct arguments **list, struct variable *var) { struct arguments *p, *prev = NULL; @@ -435,7 +435,7 @@ remove_variable_from_list(struct arguments ** list, struct variable * var) deletes the list as we go on. */ void -dump_variables(struct arguments * list, int mode) +dump_variables(struct arguments *list, int mode) { char *str_zero; @@ -464,7 +464,7 @@ dump_variables(struct arguments * list, int mode) } void -check_indicator(struct ECPGtype * var) +check_indicator(struct ECPGtype *var) { /* make sure this is a valid indicator variable */ switch (var->type) diff --git a/src/interfaces/ecpg/test/expected/compat_informix-describe.c b/src/interfaces/ecpg/test/expected/compat_informix-describe.c index d1632e280c..1b5aae0df7 100644 --- a/src/interfaces/ecpg/test/expected/compat_informix-describe.c +++ b/src/interfaces/ecpg/test/expected/compat_informix-describe.c @@ -41,7 +41,7 @@ typedef struct sqlda_struct sqlda_t; #endif -#endif /* ECPG_SQLDA_H */ +#endif /* ECPG_SQLDA_H */ #line 5 "describe.pgc" diff --git a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c index 1f316fbd7c..1df87f83ef 100644 --- a/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c +++ b/src/interfaces/ecpg/test/expected/compat_informix-sqlda.c @@ -43,7 +43,7 @@ typedef struct sqlda_struct sqlda_t; #endif -#endif /* ECPG_SQLDA_H */ +#endif /* ECPG_SQLDA_H */ #line 7 "sqlda.pgc" @@ -105,7 +105,7 @@ typedef struct sqlda_struct sqlda_t; #define SQLSERIAL8 ECPGt_long #endif -#endif /* ndef ECPG_SQLTYPES_H */ +#endif /* ndef ECPG_SQLTYPES_H */ #line 8 "sqlda.pgc" diff --git a/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c index 4476130689..4e372a5799 100644 --- a/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c +++ b/src/interfaces/ecpg/test/expected/compat_informix-test_informix2.c @@ -23,13 +23,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/preproc-init.c b/src/interfaces/ecpg/test/expected/preproc-init.c index 9e410ff155..ca23d348d6 100644 --- a/src/interfaces/ecpg/test/expected/preproc-init.c +++ b/src/interfaces/ecpg/test/expected/preproc-init.c @@ -17,13 +17,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/preproc-outofscope.c b/src/interfaces/ecpg/test/expected/preproc-outofscope.c index 348e843328..b3deb221d7 100644 --- a/src/interfaces/ecpg/test/expected/preproc-outofscope.c +++ b/src/interfaces/ecpg/test/expected/preproc-outofscope.c @@ -58,11 +58,11 @@ typedef struct int rscale; /* result scale */ int dscale; /* display scale */ int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */ - NumericDigit digits[DECSIZE]; /* decimal digits */ + NumericDigit digits[DECSIZE]; /* decimal digits */ } decimal; #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -91,7 +91,7 @@ int PGTYPESnumeric_from_decimal(decimal *, numeric *); } #endif -#endif /* PGTYPES_NUMERIC */ +#endif /* PGTYPES_NUMERIC */ #line 8 "outofscope.pgc" diff --git a/src/interfaces/ecpg/test/expected/sql-array.c b/src/interfaces/ecpg/test/expected/sql-array.c index 9128741dd3..781c426771 100644 --- a/src/interfaces/ecpg/test/expected/sql-array.c +++ b/src/interfaces/ecpg/test/expected/sql-array.c @@ -30,13 +30,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/sql-code100.c b/src/interfaces/ecpg/test/expected/sql-code100.c index 3c8fea6216..4c85530a17 100644 --- a/src/interfaces/ecpg/test/expected/sql-code100.c +++ b/src/interfaces/ecpg/test/expected/sql-code100.c @@ -17,13 +17,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/sql-copystdout.c b/src/interfaces/ecpg/test/expected/sql-copystdout.c index 62db9c1771..d2599fb0e9 100644 --- a/src/interfaces/ecpg/test/expected/sql-copystdout.c +++ b/src/interfaces/ecpg/test/expected/sql-copystdout.c @@ -19,13 +19,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/sql-define.c b/src/interfaces/ecpg/test/expected/sql-define.c index ad6e317aac..29583ecd74 100644 --- a/src/interfaces/ecpg/test/expected/sql-define.c +++ b/src/interfaces/ecpg/test/expected/sql-define.c @@ -17,13 +17,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/sql-describe.c b/src/interfaces/ecpg/test/expected/sql-describe.c index b5e2d7427f..155e206f29 100644 --- a/src/interfaces/ecpg/test/expected/sql-describe.c +++ b/src/interfaces/ecpg/test/expected/sql-describe.c @@ -39,7 +39,7 @@ typedef struct sqlda_struct sqlda_t; #endif -#endif /* ECPG_SQLDA_H */ +#endif /* ECPG_SQLDA_H */ #line 5 "describe.pgc" diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc.c b/src/interfaces/ecpg/test/expected/sql-dynalloc.c index c78e13a3f6..a95dddf15d 100644 --- a/src/interfaces/ecpg/test/expected/sql-dynalloc.c +++ b/src/interfaces/ecpg/test/expected/sql-dynalloc.c @@ -18,13 +18,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/sql-dynalloc2.c b/src/interfaces/ecpg/test/expected/sql-dynalloc2.c index 9f74a0c5f9..711857706a 100644 --- a/src/interfaces/ecpg/test/expected/sql-dynalloc2.c +++ b/src/interfaces/ecpg/test/expected/sql-dynalloc2.c @@ -18,13 +18,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/sql-dyntest.c b/src/interfaces/ecpg/test/expected/sql-dyntest.c index 2cbc196009..513d44c630 100644 --- a/src/interfaces/ecpg/test/expected/sql-dyntest.c +++ b/src/interfaces/ecpg/test/expected/sql-dyntest.c @@ -57,7 +57,7 @@ enum * standard) */ }; -#endif /* !_ECPG_SQL3TYPES_H */ +#endif /* !_ECPG_SQL3TYPES_H */ #line 7 "dyntest.pgc" @@ -71,13 +71,13 @@ enum #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/sql-indicators.c b/src/interfaces/ecpg/test/expected/sql-indicators.c index 6c8cffc249..7cf43ad622 100644 --- a/src/interfaces/ecpg/test/expected/sql-indicators.c +++ b/src/interfaces/ecpg/test/expected/sql-indicators.c @@ -19,13 +19,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/sql-sqlda.c b/src/interfaces/ecpg/test/expected/sql-sqlda.c index b470b04a6a..15c81c6b12 100644 --- a/src/interfaces/ecpg/test/expected/sql-sqlda.c +++ b/src/interfaces/ecpg/test/expected/sql-sqlda.c @@ -41,7 +41,7 @@ typedef struct sqlda_struct sqlda_t; #endif -#endif /* ECPG_SQLDA_H */ +#endif /* ECPG_SQLDA_H */ #line 7 "sqlda.pgc" @@ -80,11 +80,11 @@ typedef struct int rscale; /* result scale */ int dscale; /* display scale */ int sign; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */ - NumericDigit digits[DECSIZE]; /* decimal digits */ + NumericDigit digits[DECSIZE]; /* decimal digits */ } decimal; #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -113,7 +113,7 @@ int PGTYPESnumeric_from_decimal(decimal *, numeric *); } #endif -#endif /* PGTYPES_NUMERIC */ +#endif /* PGTYPES_NUMERIC */ #line 8 "sqlda.pgc" diff --git a/src/interfaces/ecpg/test/expected/thread-alloc.c b/src/interfaces/ecpg/test/expected/thread-alloc.c index 49f1cd19c4..9f8ac59430 100644 --- a/src/interfaces/ecpg/test/expected/thread-alloc.c +++ b/src/interfaces/ecpg/test/expected/thread-alloc.c @@ -40,13 +40,13 @@ main(void) #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/thread-descriptor.c b/src/interfaces/ecpg/test/expected/thread-descriptor.c index e2be89dec0..607df7ce24 100644 --- a/src/interfaces/ecpg/test/expected/thread-descriptor.c +++ b/src/interfaces/ecpg/test/expected/thread-descriptor.c @@ -31,13 +31,13 @@ #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/expected/thread-prep.c b/src/interfaces/ecpg/test/expected/thread-prep.c index 4d06b90b98..72ca568151 100644 --- a/src/interfaces/ecpg/test/expected/thread-prep.c +++ b/src/interfaces/ecpg/test/expected/thread-prep.c @@ -40,13 +40,13 @@ main(void) #define PGDLLIMPORT __declspec (dllimport) #else #define PGDLLIMPORT -#endif /* __CYGWIN__ */ -#endif /* PGDLLIMPORT */ +#endif /* __CYGWIN__ */ +#endif /* PGDLLIMPORT */ #define SQLERRMC_LEN 150 #ifdef __cplusplus -extern "C" +extern "C" { #endif diff --git a/src/interfaces/ecpg/test/regression.h b/src/interfaces/ecpg/test/regression.h index 4aa13b6fb2..6b7fba1bfd 100644 --- a/src/interfaces/ecpg/test/regression.h +++ b/src/interfaces/ecpg/test/regression.h @@ -1,5 +1,5 @@ -exec sql define REGRESSDB1 ecpg1_regression; -exec sql define REGRESSDB2 ecpg2_regression; +exec sql define REGRESSDB1 ecpg1_regression; +exec sql define REGRESSDB2 ecpg2_regression; -exec sql define REGRESSUSER1 regress_ecpg_user1; -exec sql define REGRESSUSER2 regress_ecpg_user2; +exec sql define REGRESSUSER1 regress_ecpg_user1; +exec sql define REGRESSUSER2 regress_ecpg_user2; diff --git a/src/interfaces/libpq/fe-auth-scram.c b/src/interfaces/libpq/fe-auth-scram.c index d2e355a8b8..8c5c3148c5 100644 --- a/src/interfaces/libpq/fe-auth-scram.c +++ b/src/interfaces/libpq/fe-auth-scram.c @@ -173,13 +173,13 @@ pg_fe_scram_exchange(void *opaq, char *input, int inputlen, if (inputlen == 0) { printfPQExpBuffer(errorMessage, - libpq_gettext("malformed SCRAM message (empty message)\n")); + libpq_gettext("malformed SCRAM message (empty message)\n")); goto error; } if (inputlen != strlen(input)) { printfPQExpBuffer(errorMessage, - libpq_gettext("malformed SCRAM message (length mismatch)\n")); + libpq_gettext("malformed SCRAM message (length mismatch)\n")); goto error; } } @@ -228,7 +228,7 @@ pg_fe_scram_exchange(void *opaq, char *input, int inputlen, { *success = false; printfPQExpBuffer(errorMessage, - libpq_gettext("invalid server signature\n")); + libpq_gettext("invalid server signature\n")); } *done = true; state->state = FE_SCRAM_FINISHED; @@ -237,7 +237,7 @@ pg_fe_scram_exchange(void *opaq, char *input, int inputlen, default: /* shouldn't happen */ printfPQExpBuffer(errorMessage, - libpq_gettext("invalid SCRAM exchange state\n")); + libpq_gettext("invalid SCRAM exchange state\n")); goto error; } return; @@ -260,7 +260,7 @@ read_attr_value(char **input, char attr, PQExpBuffer errorMessage) if (*begin != attr) { printfPQExpBuffer(errorMessage, - libpq_gettext("malformed SCRAM message (%c expected)\n"), + libpq_gettext("malformed SCRAM message (%c expected)\n"), attr); return NULL; } @@ -269,7 +269,7 @@ read_attr_value(char **input, char attr, PQExpBuffer errorMessage) if (*begin != '=') { printfPQExpBuffer(errorMessage, - libpq_gettext("malformed SCRAM message (expected = in attr '%c')\n"), + libpq_gettext("malformed SCRAM message (expected = in attr '%c')\n"), attr); return NULL; } @@ -434,7 +434,7 @@ read_server_first_message(fe_scram_state *state, char *input, memcmp(nonce, state->client_nonce, strlen(state->client_nonce)) != 0) { printfPQExpBuffer(errormessage, - libpq_gettext("invalid SCRAM response (nonce mismatch)\n")); + libpq_gettext("invalid SCRAM response (nonce mismatch)\n")); return false; } @@ -473,7 +473,7 @@ read_server_first_message(fe_scram_state *state, char *input, if (*endptr != '\0' || state->iterations < 1) { printfPQExpBuffer(errormessage, - libpq_gettext("malformed SCRAM message (invalid iteration count)\n")); + libpq_gettext("malformed SCRAM message (invalid iteration count)\n")); return false; } @@ -508,7 +508,7 @@ read_server_final_message(fe_scram_state *state, char *input, char *errmsg = read_attr_value(&input, 'e', errormessage); printfPQExpBuffer(errormessage, - libpq_gettext("error received from server in SASL exchange: %s\n"), + libpq_gettext("error received from server in SASL exchange: %s\n"), errmsg); return false; } diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index 74086545bf..3a048108d4 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -122,7 +122,7 @@ pg_GSS_continue(PGconn *conn, int payloadlen) if (!ginbuf.value) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("out of memory allocating GSSAPI buffer (%d)\n"), + libpq_gettext("out of memory allocating GSSAPI buffer (%d)\n"), payloadlen); return STATUS_ERROR; } @@ -150,7 +150,7 @@ pg_GSS_continue(PGconn *conn, int payloadlen) GSS_C_MUTUAL_FLAG, 0, GSS_C_NO_CHANNEL_BINDINGS, - (ginbuf.value == NULL) ? GSS_C_NO_BUFFER : &ginbuf, + (ginbuf.value == NULL) ? GSS_C_NO_BUFFER : &ginbuf, NULL, &goutbuf, NULL, @@ -214,7 +214,7 @@ pg_GSS_startup(PGconn *conn, int payloadlen) if (conn->gctx) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("duplicate GSS authentication request\n")); + libpq_gettext("duplicate GSS authentication request\n")); return STATUS_ERROR; } @@ -254,7 +254,7 @@ pg_GSS_startup(PGconn *conn, int payloadlen) return pg_GSS_continue(conn, payloadlen); } -#endif /* ENABLE_GSS */ +#endif /* ENABLE_GSS */ #ifdef ENABLE_SSPI @@ -303,7 +303,7 @@ pg_SSPI_continue(PGconn *conn, int payloadlen) if (!inputbuf) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("out of memory allocating SSPI buffer (%d)\n"), + libpq_gettext("out of memory allocating SSPI buffer (%d)\n"), payloadlen); return STATUS_ERROR; } @@ -393,7 +393,7 @@ pg_SSPI_continue(PGconn *conn, int payloadlen) if (outbuf.pBuffers[0].cbBuffer > 0) { if (pqPacketSend(conn, 'p', - outbuf.pBuffers[0].pvBuffer, outbuf.pBuffers[0].cbBuffer)) + outbuf.pBuffers[0].pvBuffer, outbuf.pBuffers[0].cbBuffer)) { FreeContextBuffer(outbuf.pBuffers[0].pvBuffer); return STATUS_ERROR; @@ -422,7 +422,7 @@ pg_SSPI_startup(PGconn *conn, int use_negotiate, int payloadlen) if (conn->sspictx) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("duplicate SSPI authentication request\n")); + libpq_gettext("duplicate SSPI authentication request\n")); return STATUS_ERROR; } @@ -480,7 +480,7 @@ pg_SSPI_startup(PGconn *conn, int use_negotiate, int payloadlen) return pg_SSPI_continue(conn, payloadlen); } -#endif /* ENABLE_SSPI */ +#endif /* ENABLE_SSPI */ /* * Initialize SASL authentication exchange. @@ -500,7 +500,7 @@ pg_SASL_init(PGconn *conn, int payloadlen) if (conn->sasl_state) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("duplicate SASL authentication request\n")); + libpq_gettext("duplicate SASL authentication request\n")); goto error; } @@ -633,7 +633,7 @@ pg_SASL_continue(PGconn *conn, int payloadlen, bool final) if (!challenge) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("out of memory allocating SASL buffer (%d)\n"), + libpq_gettext("out of memory allocating SASL buffer (%d)\n"), payloadlen); return STATUS_ERROR; } @@ -735,7 +735,7 @@ pg_local_sendauth(PGconn *conn) return STATUS_OK; #else printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SCM_CRED authentication method not supported\n")); + libpq_gettext("SCM_CRED authentication method not supported\n")); return STATUS_ERROR; #endif } @@ -826,12 +826,12 @@ pg_fe_sendauth(AuthRequest areq, int payloadlen, PGconn *conn) case AUTH_REQ_KRB4: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("Kerberos 4 authentication not supported\n")); + libpq_gettext("Kerberos 4 authentication not supported\n")); return STATUS_ERROR; case AUTH_REQ_KRB5: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("Kerberos 5 authentication not supported\n")); + libpq_gettext("Kerberos 5 authentication not supported\n")); return STATUS_ERROR; #if defined(ENABLE_GSS) || defined(ENABLE_SSPI) @@ -902,9 +902,9 @@ pg_fe_sendauth(AuthRequest areq, int payloadlen, PGconn *conn) case AUTH_REQ_GSS: case AUTH_REQ_GSS_CONT: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("GSSAPI authentication not supported\n")); + libpq_gettext("GSSAPI authentication not supported\n")); return STATUS_ERROR; -#endif /* defined(ENABLE_GSS) || defined(ENABLE_SSPI) */ +#endif /* defined(ENABLE_GSS) || defined(ENABLE_SSPI) */ #ifdef ENABLE_SSPI case AUTH_REQ_SSPI: @@ -934,15 +934,15 @@ pg_fe_sendauth(AuthRequest areq, int payloadlen, PGconn *conn) #if !defined(ENABLE_GSS) case AUTH_REQ_SSPI: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSPI authentication not supported\n")); + libpq_gettext("SSPI authentication not supported\n")); return STATUS_ERROR; -#endif /* !define(ENABLE_GSSAPI) */ -#endif /* ENABLE_SSPI */ +#endif /* !define(ENABLE_GSSAPI) */ +#endif /* ENABLE_SSPI */ case AUTH_REQ_CRYPT: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("Crypt authentication not supported\n")); + libpq_gettext("Crypt authentication not supported\n")); return STATUS_ERROR; case AUTH_REQ_MD5: @@ -963,7 +963,7 @@ pg_fe_sendauth(AuthRequest areq, int payloadlen, PGconn *conn) if (pg_password_sendauth(conn, password, areq) != STATUS_OK) { printfPQExpBuffer(&conn->errorMessage, - "fe_sendauth: error sending password authentication\n"); + "fe_sendauth: error sending password authentication\n"); return STATUS_ERROR; } break; @@ -996,7 +996,7 @@ pg_fe_sendauth(AuthRequest areq, int payloadlen, PGconn *conn) /* Use error message, if set already */ if (conn->errorMessage.len == 0) printfPQExpBuffer(&conn->errorMessage, - "fe_sendauth: error in SASL authentication\n"); + "fe_sendauth: error in SASL authentication\n"); return STATUS_ERROR; } break; @@ -1008,7 +1008,7 @@ pg_fe_sendauth(AuthRequest areq, int payloadlen, PGconn *conn) default: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("authentication method %u not supported\n"), areq); + libpq_gettext("authentication method %u not supported\n"), areq); return STATUS_ERROR; } @@ -1055,7 +1055,7 @@ pg_fe_getauthname(PQExpBuffer errorMessage) name = username; else if (errorMessage) printfPQExpBuffer(errorMessage, - libpq_gettext("user name lookup failure: error code %lu\n"), + libpq_gettext("user name lookup failure: error code %lu\n"), GetLastError()); #else pwerr = pqGetpwuid(user_id, &pwdstr, pwdbuf, sizeof(pwdbuf), &pw); @@ -1065,12 +1065,12 @@ pg_fe_getauthname(PQExpBuffer errorMessage) { if (pwerr != 0) printfPQExpBuffer(errorMessage, - libpq_gettext("could not look up local user ID %d: %s\n"), + libpq_gettext("could not look up local user ID %d: %s\n"), (int) user_id, pqStrerror(pwerr, pwdbuf, sizeof(pwdbuf))); else printfPQExpBuffer(errorMessage, - libpq_gettext("local user with ID %d does not exist\n"), + libpq_gettext("local user with ID %d does not exist\n"), (int) user_id); } #endif @@ -1181,7 +1181,7 @@ PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, { PQclear(res); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("password_encryption value too long\n")); + libpq_gettext("password_encryption value too long\n")); return NULL; } strcpy(algobuf, val); @@ -1221,7 +1221,7 @@ PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, else { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("unrecognized password encryption algorithm \"%s\"\n"), + libpq_gettext("unrecognized password encryption algorithm \"%s\"\n"), algorithm); return NULL; } diff --git a/src/interfaces/libpq/fe-auth.h b/src/interfaces/libpq/fe-auth.h index 9f4c2a50d8..5dc6bb5341 100644 --- a/src/interfaces/libpq/fe-auth.h +++ b/src/interfaces/libpq/fe-auth.h @@ -30,4 +30,4 @@ extern void pg_fe_scram_exchange(void *opaq, char *input, int inputlen, bool *done, bool *success, PQExpBuffer errorMessage); extern char *pg_fe_scram_build_verifier(const char *password); -#endif /* FE_AUTH_H */ +#endif /* FE_AUTH_H */ diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index 02ec8f0cea..764e9601fe 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -184,7 +184,7 @@ static const internalPQconninfoOption PQconninfoOptions[] = { offsetof(struct pg_conn, pgpassfile)}, {"connect_timeout", "PGCONNECT_TIMEOUT", NULL, NULL, - "Connect-timeout", "", 10, /* strlen(INT32_MAX) == 10 */ + "Connect-timeout", "", 10, /* strlen(INT32_MAX) == 10 */ offsetof(struct pg_conn, connect_timeout)}, {"dbname", "PGDATABASE", NULL, NULL, @@ -236,7 +236,7 @@ static const internalPQconninfoOption PQconninfoOptions[] = { offsetof(struct pg_conn, keepalives_idle)}, {"keepalives_interval", NULL, NULL, NULL, - "TCP-Keepalives-Interval", "", 10, /* strlen(INT32_MAX) == 10 */ + "TCP-Keepalives-Interval", "", 10, /* strlen(INT32_MAX) == 10 */ offsetof(struct pg_conn, keepalives_interval)}, {"keepalives_count", NULL, NULL, NULL, @@ -349,8 +349,8 @@ static int uri_prefix_length(const char *connstr); static bool recognized_connection_string(const char *connstr); static PQconninfoOption *conninfo_parse(const char *conninfo, PQExpBuffer errorMessage, bool use_defaults); -static PQconninfoOption *conninfo_array_parse(const char *const * keywords, - const char *const * values, PQExpBuffer errorMessage, +static PQconninfoOption *conninfo_array_parse(const char *const *keywords, + const char *const *values, PQExpBuffer errorMessage, bool use_defaults, int expand_dbname); static bool conninfo_add_defaults(PQconninfoOption *options, PQExpBuffer errorMessage); @@ -367,7 +367,7 @@ static const char *conninfo_getval(PQconninfoOption *connOptions, const char *keyword); static PQconninfoOption *conninfo_storeval(PQconninfoOption *connOptions, const char *keyword, const char *value, - PQExpBuffer errorMessage, bool ignoreMissing, bool uri_decode); + PQExpBuffer errorMessage, bool ignoreMissing, bool uri_decode); static PQconninfoOption *conninfo_find(PQconninfoOption *connOptions, const char *keyword); static void defaultNoticeReceiver(void *arg, const PGresult *res); @@ -507,8 +507,8 @@ pqDropConnection(PGconn *conn, bool flushInput) * call succeeded. */ PGconn * -PQconnectdbParams(const char *const * keywords, - const char *const * values, +PQconnectdbParams(const char *const *keywords, + const char *const *values, int expand_dbname) { PGconn *conn = PQconnectStartParams(keywords, values, expand_dbname); @@ -526,8 +526,8 @@ PQconnectdbParams(const char *const * keywords, * check server status, accepting parameters identical to PQconnectdbParams */ PGPing -PQpingParams(const char *const * keywords, - const char *const * values, +PQpingParams(const char *const *keywords, + const char *const *values, int expand_dbname) { PGconn *conn = PQconnectStartParams(keywords, values, expand_dbname); @@ -610,8 +610,8 @@ PQping(const char *conninfo) * See PQconnectPoll for more info. */ PGconn * -PQconnectStartParams(const char *const * keywords, - const char *const * values, +PQconnectStartParams(const char *const *keywords, + const char *const *values, int expand_dbname) { PGconn *conn; @@ -954,7 +954,7 @@ connectOptions2(PGconn *conn) { conn->status = CONNECTION_BAD; printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not match %d port numbers to %d hosts\n"), + libpq_gettext("could not match %d port numbers to %d hosts\n"), nports, conn->nconnhost); return false; } @@ -1058,7 +1058,7 @@ connectOptions2(PGconn *conn) { conn->status = CONNECTION_BAD; printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("invalid sslmode value: \"%s\"\n"), + libpq_gettext("invalid sslmode value: \"%s\"\n"), conn->sslmode); return false; } @@ -1114,7 +1114,7 @@ connectOptions2(PGconn *conn) { conn->status = CONNECTION_BAD; printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("invalid target_session_attrs value: \"%s\"\n"), + libpq_gettext("invalid target_session_attrs value: \"%s\"\n"), conn->target_session_attrs); return false; } @@ -1332,7 +1332,7 @@ connectNoDelay(PGconn *conn) char sebuf[256]; appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not set socket to TCP no delay mode: %s\n"), + libpq_gettext("could not set socket to TCP no delay mode: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return 0; } @@ -1363,13 +1363,13 @@ connectFailureMessage(PGconn *conn, int errorno) NI_NUMERICSERV); appendPQExpBuffer(&conn->errorMessage, libpq_gettext("could not connect to server: %s\n" - "\tIs the server running locally and accepting\n" - "\tconnections on Unix domain socket \"%s\"?\n"), + "\tIs the server running locally and accepting\n" + "\tconnections on Unix domain socket \"%s\"?\n"), SOCK_STRERROR(errorno, sebuf, sizeof(sebuf)), service); } else -#endif /* HAVE_UNIX_SOCKETS */ +#endif /* HAVE_UNIX_SOCKETS */ { char host_addr[NI_MAXHOST]; const char *displayed_host; @@ -1394,7 +1394,7 @@ connectFailureMessage(PGconn *conn, int errorno) else if (addr->ss_family == AF_INET6) { if (inet_net_ntop(AF_INET6, - &((struct sockaddr_in6 *) addr)->sin6_addr.s6_addr, + &((struct sockaddr_in6 *) addr)->sin6_addr.s6_addr, 128, host_addr, sizeof(host_addr)) == NULL) strcpy(host_addr, "???"); @@ -1417,18 +1417,18 @@ connectFailureMessage(PGconn *conn, int errorno) if ((conn->pghostaddr == NULL) && (conn->pghost == NULL || strcmp(conn->pghost, host_addr) != 0)) appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not connect to server: %s\n" - "\tIs the server running on host \"%s\" (%s) and accepting\n" - "\tTCP/IP connections on port %s?\n"), + libpq_gettext("could not connect to server: %s\n" + "\tIs the server running on host \"%s\" (%s) and accepting\n" + "\tTCP/IP connections on port %s?\n"), SOCK_STRERROR(errorno, sebuf, sizeof(sebuf)), displayed_host, host_addr, displayed_port); else appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not connect to server: %s\n" - "\tIs the server running on host \"%s\" and accepting\n" - "\tTCP/IP connections on port %s?\n"), + libpq_gettext("could not connect to server: %s\n" + "\tIs the server running on host \"%s\" and accepting\n" + "\tTCP/IP connections on port %s?\n"), SOCK_STRERROR(errorno, sebuf, sizeof(sebuf)), displayed_host, displayed_port); @@ -1477,7 +1477,7 @@ setKeepalivesIdle(PGconn *conn) char sebuf[256]; appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("setsockopt(TCP_KEEPIDLE) failed: %s\n"), + libpq_gettext("setsockopt(TCP_KEEPIDLE) failed: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return 0; } @@ -1490,7 +1490,7 @@ setKeepalivesIdle(PGconn *conn) char sebuf[256]; appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("setsockopt(TCP_KEEPALIVE) failed: %s\n"), + libpq_gettext("setsockopt(TCP_KEEPALIVE) failed: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return 0; } @@ -1522,7 +1522,7 @@ setKeepalivesInterval(PGconn *conn) char sebuf[256]; appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("setsockopt(TCP_KEEPINTVL) failed: %s\n"), + libpq_gettext("setsockopt(TCP_KEEPINTVL) failed: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return 0; } @@ -1554,7 +1554,7 @@ setKeepalivesCount(PGconn *conn) char sebuf[256]; appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("setsockopt(TCP_KEEPCNT) failed: %s\n"), + libpq_gettext("setsockopt(TCP_KEEPCNT) failed: %s\n"), SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); return 0; } @@ -1602,14 +1602,14 @@ setKeepalivesWin32(PGconn *conn) != 0) { appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("WSAIoctl(SIO_KEEPALIVE_VALS) failed: %ui\n"), + libpq_gettext("WSAIoctl(SIO_KEEPALIVE_VALS) failed: %ui\n"), WSAGetLastError()); return 0; } return 1; } -#endif /* SIO_KEEPALIVE_VALS */ -#endif /* WIN32 */ +#endif /* SIO_KEEPALIVE_VALS */ +#endif /* WIN32 */ /* ---------- * connectDBStart - @@ -1659,7 +1659,7 @@ connectDBStart(PGconn *conn) if (thisport < 1 || thisport > 65535) { appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("invalid port number: \"%s\"\n"), + libpq_gettext("invalid port number: \"%s\"\n"), ch->port); conn->options_valid = false; goto connect_errReturn; @@ -1991,7 +1991,7 @@ PQconnectPoll(PGconn *conn) appendPQExpBufferStr(&conn->errorMessage, libpq_gettext( "invalid connection state, " - "probably indicative of memory corruption\n" + "probably indicative of memory corruption\n" )); goto error_return; } @@ -2047,8 +2047,8 @@ keep_going: /* We will come back to here until there is continue; } appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not create socket: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + libpq_gettext("could not create socket: %s\n"), + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); break; } @@ -2070,7 +2070,7 @@ keep_going: /* We will come back to here until there is { appendPQExpBuffer(&conn->errorMessage, libpq_gettext("could not set socket to nonblocking mode: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); pqDropConnection(conn, true); conn->addr_cur = addr_cur->ai_next; continue; @@ -2081,12 +2081,12 @@ keep_going: /* We will come back to here until there is { appendPQExpBuffer(&conn->errorMessage, libpq_gettext("could not set socket to close-on-exec mode: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); pqDropConnection(conn, true); conn->addr_cur = addr_cur->ai_next; continue; } -#endif /* F_SETFD */ +#endif /* F_SETFD */ if (!IS_AF_UNIX(addr_cur->ai_family)) { @@ -2113,7 +2113,7 @@ keep_going: /* We will come back to here until there is { appendPQExpBuffer(&conn->errorMessage, libpq_gettext("setsockopt(SO_KEEPALIVE) failed: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); err = 1; } else if (!setKeepalivesIdle(conn) @@ -2124,8 +2124,8 @@ keep_going: /* We will come back to here until there is #ifdef SIO_KEEPALIVE_VALS else if (!setKeepalivesWin32(conn)) err = 1; -#endif /* SIO_KEEPALIVE_VALS */ -#endif /* WIN32 */ +#endif /* SIO_KEEPALIVE_VALS */ +#endif /* WIN32 */ if (err) { @@ -2163,7 +2163,7 @@ keep_going: /* We will come back to here until there is conn->sigpipe_flag = true; #else conn->sigpipe_flag = false; -#endif /* MSG_NOSIGNAL */ +#endif /* MSG_NOSIGNAL */ #ifdef SO_NOSIGPIPE optval = 1; @@ -2173,7 +2173,7 @@ keep_going: /* We will come back to here until there is conn->sigpipe_so = true; conn->sigpipe_flag = false; } -#endif /* SO_NOSIGPIPE */ +#endif /* SO_NOSIGPIPE */ /* * Start/make connection. This should not block, since we @@ -2249,8 +2249,8 @@ keep_going: /* We will come back to here until there is (char *) &optval, &optlen) == -1) { appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not get socket error status: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + libpq_gettext("could not get socket error status: %s\n"), + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); goto error_return; } else if (optval != 0) @@ -2280,12 +2280,12 @@ keep_going: /* We will come back to here until there is /* Fill in the client address */ conn->laddr.salen = sizeof(conn->laddr.addr); if (getsockname(conn->sock, - (struct sockaddr *) & conn->laddr.addr, + (struct sockaddr *) &conn->laddr.addr, &conn->laddr.salen) < 0) { appendPQExpBuffer(&conn->errorMessage, libpq_gettext("could not get client address from socket: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); goto error_return; } @@ -2330,7 +2330,7 @@ keep_going: /* We will come back to here until there is else appendPQExpBuffer(&conn->errorMessage, libpq_gettext("could not get peer credentials: %s\n"), - pqStrerror(errno, sebuf, sizeof(sebuf))); + pqStrerror(errno, sebuf, sizeof(sebuf))); goto error_return; } @@ -2341,7 +2341,7 @@ keep_going: /* We will come back to here until there is appendPQExpBuffer(&conn->errorMessage, libpq_gettext("could not look up local user ID %d: %s\n"), (int) uid, - pqStrerror(passerr, sebuf, sizeof(sebuf))); + pqStrerror(passerr, sebuf, sizeof(sebuf))); else appendPQExpBuffer(&conn->errorMessage, libpq_gettext("local user with ID %d does not exist\n"), @@ -2357,7 +2357,7 @@ keep_going: /* We will come back to here until there is goto error_return; } } -#endif /* HAVE_UNIX_SOCKETS */ +#endif /* HAVE_UNIX_SOCKETS */ #ifdef USE_SSL @@ -2387,14 +2387,14 @@ keep_going: /* We will come back to here until there is { appendPQExpBuffer(&conn->errorMessage, libpq_gettext("could not send SSL negotiation packet: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); goto error_return; } /* Ok, wait for response */ conn->status = CONNECTION_SSL_STARTUP; return PGRES_POLLING_READING; } -#endif /* USE_SSL */ +#endif /* USE_SSL */ /* * Build the startup packet. @@ -2425,8 +2425,8 @@ keep_going: /* We will come back to here until there is if (pqPacketSend(conn, 0, startpacket, packetlen) != STATUS_OK) { appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not send startup packet: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + libpq_gettext("could not send startup packet: %s\n"), + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); free(startpacket); goto error_return; } @@ -2559,7 +2559,7 @@ keep_going: /* We will come back to here until there is #else /* !USE_SSL */ /* can't get here */ goto error_return; -#endif /* USE_SSL */ +#endif /* USE_SSL */ } /* @@ -2597,8 +2597,8 @@ keep_going: /* We will come back to here until there is { appendPQExpBuffer(&conn->errorMessage, libpq_gettext( - "expected authentication request from " - "server, but received %c\n"), + "expected authentication request from " + "server, but received %c\n"), beresp); goto error_return; } @@ -2630,8 +2630,8 @@ keep_going: /* We will come back to here until there is { appendPQExpBuffer(&conn->errorMessage, libpq_gettext( - "expected authentication request from " - "server, but received %c\n"), + "expected authentication request from " + "server, but received %c\n"), beresp); goto error_return; } @@ -2962,11 +2962,11 @@ keep_going: /* We will come back to here until there is case PGRES_POLLING_OK: /* Success */ break; - case PGRES_POLLING_READING: /* Still going */ + case PGRES_POLLING_READING: /* Still going */ conn->status = CONNECTION_SETENV; return PGRES_POLLING_READING; - case PGRES_POLLING_WRITING: /* Still going */ + case PGRES_POLLING_WRITING: /* Still going */ conn->status = CONNECTION_SETENV; return PGRES_POLLING_WRITING; @@ -3063,11 +3063,11 @@ keep_going: /* We will come back to here until there is /* Not writable; close connection. */ appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not make a writable " - "connection to server " - "\"%s:%s\"\n"), - conn->connhost[conn->whichhost].host, - conn->connhost[conn->whichhost].port); + libpq_gettext("could not make a writable " + "connection to server " + "\"%s:%s\"\n"), + conn->connhost[conn->whichhost].host, + conn->connhost[conn->whichhost].port); conn->status = CONNECTION_OK; sendTerminateConn(conn); pqDropConnection(conn, true); @@ -3105,8 +3105,8 @@ keep_going: /* We will come back to here until there is PQclear(res); restoreErrorMessage(conn, &savedMessage); appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("test \"SHOW transaction_read_only\" failed " - "on server \"%s:%s\"\n"), + libpq_gettext("test \"SHOW transaction_read_only\" failed " + "on server \"%s:%s\"\n"), conn->connhost[conn->whichhost].host, conn->connhost[conn->whichhost].port); conn->status = CONNECTION_OK; @@ -3128,7 +3128,7 @@ keep_going: /* We will come back to here until there is default: appendPQExpBuffer(&conn->errorMessage, libpq_gettext("invalid connection state %d, " - "probably indicative of memory corruption\n"), + "probably indicative of memory corruption\n"), conn->status); goto error_return; } @@ -3510,8 +3510,7 @@ closePGconn(PGconn *conn) * Close the connection, reset all transient state, flush I/O buffers. */ pqDropConnection(conn, true); - conn->status = CONNECTION_BAD; /* Well, not really _bad_ - just - * absent */ + conn->status = CONNECTION_BAD; /* Well, not really _bad_ - just absent */ conn->asyncStatus = PGASYNC_IDLE; pqClearAsyncResult(conn); /* deallocate result */ resetPQExpBuffer(&conn->errorMessage); @@ -3740,7 +3739,7 @@ internal_cancel(SockAddr *raddr, int be_pid, int be_key, goto cancel_errReturn; } retry3: - if (connect(tmpsock, (struct sockaddr *) & raddr->addr, + if (connect(tmpsock, (struct sockaddr *) &raddr->addr, raddr->salen) < 0) { if (SOCK_ERRNO == EINTR) @@ -4005,7 +4004,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (p == NULL || *(p + 1) == '\0' || *(p + 1) == '?') { printfPQExpBuffer(errorMessage, libpq_gettext( - "invalid LDAP URL \"%s\": missing distinguished name\n"), purl); + "invalid LDAP URL \"%s\": missing distinguished name\n"), purl); free(url); return 3; } @@ -4016,7 +4015,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if ((p = strchr(dn, '?')) == NULL || *(p + 1) == '\0' || *(p + 1) == '?') { printfPQExpBuffer(errorMessage, libpq_gettext( - "invalid LDAP URL \"%s\": must have exactly one attribute\n"), purl); + "invalid LDAP URL \"%s\": must have exactly one attribute\n"), purl); free(url); return 3; } @@ -4037,7 +4036,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if ((p = strchr(scopestr, '?')) == NULL || *(p + 1) == '\0' || *(p + 1) == '?') { printfPQExpBuffer(errorMessage, - libpq_gettext("invalid LDAP URL \"%s\": no filter\n"), purl); + libpq_gettext("invalid LDAP URL \"%s\": no filter\n"), purl); free(url); return 3; } @@ -4058,7 +4057,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (*portstr == '\0' || *endptr != '\0' || errno || lport < 0 || lport > 65535) { printfPQExpBuffer(errorMessage, libpq_gettext( - "invalid LDAP URL \"%s\": invalid port number\n"), purl); + "invalid LDAP URL \"%s\": invalid port number\n"), purl); free(url); return 3; } @@ -4069,7 +4068,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (strchr(attrs[0], ',') != NULL) { printfPQExpBuffer(errorMessage, libpq_gettext( - "invalid LDAP URL \"%s\": must have exactly one attribute\n"), purl); + "invalid LDAP URL \"%s\": must have exactly one attribute\n"), purl); free(url); return 3; } @@ -4158,7 +4157,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, ldap_unbind(ld); return 3; } -#endif /* WIN32 */ +#endif /* WIN32 */ /* search */ res = NULL; @@ -4179,7 +4178,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if ((rc = ldap_count_entries(ld, res)) != 1) { printfPQExpBuffer(errorMessage, - rc ? libpq_gettext("more than one entry found on LDAP lookup\n") + rc ? libpq_gettext("more than one entry found on LDAP lookup\n") : libpq_gettext("no entry found on LDAP lookup\n")); ldap_msgfree(res); ldap_unbind(ld); @@ -4203,7 +4202,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if ((values = ldap_get_values_len(ld, entry, attrs[0])) == NULL) { printfPQExpBuffer(errorMessage, - libpq_gettext("attribute has no values on LDAP lookup\n")); + libpq_gettext("attribute has no values on LDAP lookup\n")); ldap_msgfree(res); ldap_unbind(ld); free(url); @@ -4216,7 +4215,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (values[0] == NULL) { printfPQExpBuffer(errorMessage, - libpq_gettext("attribute has no values on LDAP lookup\n")); + libpq_gettext("attribute has no values on LDAP lookup\n")); ldap_value_free_len(values); ldap_unbind(ld); return 1; @@ -4268,7 +4267,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, else if (ld_is_nl_cr(*p)) { printfPQExpBuffer(errorMessage, libpq_gettext( - "missing \"=\" after \"%s\" in connection info string\n"), + "missing \"=\" after \"%s\" in connection info string\n"), optname); free(result); return 3; @@ -4287,7 +4286,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, else if (!ld_is_sp_tab(*p)) { printfPQExpBuffer(errorMessage, libpq_gettext( - "missing \"=\" after \"%s\" in connection info string\n"), + "missing \"=\" after \"%s\" in connection info string\n"), optname); free(result); return 3; @@ -4348,7 +4347,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (!options[i].val) { printfPQExpBuffer(errorMessage, - libpq_gettext("out of memory\n")); + libpq_gettext("out of memory\n")); free(result); return 3; } @@ -4360,7 +4359,7 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (!found_keyword) { printfPQExpBuffer(errorMessage, - libpq_gettext("invalid connection option \"%s\"\n"), + libpq_gettext("invalid connection option \"%s\"\n"), optname); free(result); return 1; @@ -4376,14 +4375,14 @@ ldapServiceLookup(const char *purl, PQconninfoOption *options, if (state == 5 || state == 6) { printfPQExpBuffer(errorMessage, libpq_gettext( - "unterminated quoted string in connection info string\n")); + "unterminated quoted string in connection info string\n")); return 3; } return 0; } -#endif /* USE_LDAP */ +#endif /* USE_LDAP */ #define MAXBUFSIZE 256 @@ -4449,7 +4448,7 @@ last_file: if (!group_found) { printfPQExpBuffer(errorMessage, - libpq_gettext("definition of service \"%s\" not found\n"), service); + libpq_gettext("definition of service \"%s\" not found\n"), service); return 3; } @@ -4485,7 +4484,7 @@ parseServiceFile(const char *serviceFile, { fclose(f); printfPQExpBuffer(errorMessage, - libpq_gettext("line %d too long in service file \"%s\"\n"), + libpq_gettext("line %d too long in service file \"%s\"\n"), linenr, serviceFile); return 2; @@ -4588,7 +4587,7 @@ parseServiceFile(const char *serviceFile, if (!options[i].val) { printfPQExpBuffer(errorMessage, - libpq_gettext("out of memory\n")); + libpq_gettext("out of memory\n")); fclose(f); return 3; } @@ -4926,7 +4925,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage, * a database, in-tree code first wraps the name in a connection string. */ static PQconninfoOption * -conninfo_array_parse(const char *const * keywords, const char *const * values, +conninfo_array_parse(const char *const *keywords, const char *const *values, PQExpBuffer errorMessage, bool use_defaults, int expand_dbname) { @@ -4991,7 +4990,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values, if (option->keyword == NULL) { printfPQExpBuffer(errorMessage, - libpq_gettext("invalid connection option \"%s\"\n"), + libpq_gettext("invalid connection option \"%s\"\n"), pname); PQconninfoFree(options); PQconninfoFree(dbname_options); @@ -5023,7 +5022,7 @@ conninfo_array_parse(const char *const * keywords, const char *const * values, if (!options[k].val) { printfPQExpBuffer(errorMessage, - libpq_gettext("out of memory\n")); + libpq_gettext("out of memory\n")); PQconninfoFree(options); PQconninfoFree(dbname_options); return NULL; @@ -5412,7 +5411,7 @@ conninfo_uri_parse_options(PQconninfoOption *options, const char *uri, if (prevchar == ':') { - const char *port = ++p; /* advance past host terminator */ + const char *port = ++p; /* advance past host terminator */ while (*p && *p != '/' && *p != '?' && *p != ',') ++p; @@ -5444,7 +5443,7 @@ conninfo_uri_parse_options(PQconninfoOption *options, const char *uri, if (prevchar && prevchar != '?') { - const char *dbname = ++p; /* advance past host terminator */ + const char *dbname = ++p; /* advance past host terminator */ /* Look for query parameters */ while (*p && *p != '?') @@ -5586,7 +5585,7 @@ conninfo_uri_parse_params(char *params, /* Insert generic message if conninfo_storeval didn't give one. */ if (errorMessage->len == 0) printfPQExpBuffer(errorMessage, - libpq_gettext("invalid URI query parameter: \"%s\"\n"), + libpq_gettext("invalid URI query parameter: \"%s\"\n"), keyword); /* And fail. */ if (malloced) @@ -5660,7 +5659,7 @@ conninfo_uri_decode(const char *str, PQExpBuffer errorMessage) if (!(get_hexdigit(*q++, &hi) && get_hexdigit(*q++, &lo))) { printfPQExpBuffer(errorMessage, - libpq_gettext("invalid percent-encoded token: \"%s\"\n"), + libpq_gettext("invalid percent-encoded token: \"%s\"\n"), str); free(buf); return NULL; @@ -5765,7 +5764,7 @@ conninfo_storeval(PQconninfoOption *connOptions, { if (!ignoreMissing) printfPQExpBuffer(errorMessage, - libpq_gettext("invalid connection option \"%s\"\n"), + libpq_gettext("invalid connection option \"%s\"\n"), keyword); return NULL; } @@ -6313,7 +6312,7 @@ passwordFromFile(char *hostname, char *port, char *dbname, if (!S_ISREG(stat_buf.st_mode)) { fprintf(stderr, - libpq_gettext("WARNING: password file \"%s\" is not a plain file\n"), + libpq_gettext("WARNING: password file \"%s\" is not a plain file\n"), pgpassfile); return NULL; } @@ -6414,7 +6413,7 @@ pgpassfileWarning(PGconn *conn) if (sqlstate && strcmp(sqlstate, ERRCODE_INVALID_PASSWORD) == 0) appendPQExpBuffer(&conn->errorMessage, - libpq_gettext("password retrieved from file \"%s\"\n"), + libpq_gettext("password retrieved from file \"%s\"\n"), conn->pgpassfile); } } diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 9decd5339e..e1e2d18e3a 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -58,7 +58,7 @@ static int PQsendQueryGuts(PGconn *conn, const char *stmtName, int nParams, const Oid *paramTypes, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat); @@ -125,7 +125,7 @@ static int check_field_number(const PGresult *res, int field_num); */ #define PGRESULT_DATA_BLOCKSIZE 2048 -#define PGRESULT_ALIGN_BOUNDARY MAXIMUM_ALIGNOF /* from configure */ +#define PGRESULT_ALIGN_BOUNDARY MAXIMUM_ALIGNOF /* from configure */ #define PGRESULT_BLOCK_OVERHEAD Max(sizeof(PGresult_data), PGRESULT_ALIGN_BOUNDARY) #define PGRESULT_SEP_ALLOC_THRESHOLD (PGRESULT_DATA_BLOCKSIZE / 2) @@ -940,7 +940,7 @@ pqSaveParameterStatus(PGconn *conn, const char *name, const char *value) * Store new info as a single malloc block */ pstatus = (pgParameterStatus *) malloc(sizeof(pgParameterStatus) + - strlen(name) +strlen(value) + 2); + strlen(name) + strlen(value) + 2); if (pstatus) { char *ptr; @@ -1138,7 +1138,7 @@ PQsendQuery(PGconn *conn, const char *query) if (!query) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("command string is a null pointer\n")); + libpq_gettext("command string is a null pointer\n")); return 0; } @@ -1184,7 +1184,7 @@ PQsendQueryParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat) @@ -1196,13 +1196,13 @@ PQsendQueryParams(PGconn *conn, if (!command) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("command string is a null pointer\n")); + libpq_gettext("command string is a null pointer\n")); return 0; } if (nParams < 0 || nParams > 65535) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("number of parameters must be between 0 and 65535\n")); + libpq_gettext("number of parameters must be between 0 and 65535\n")); return 0; } @@ -1236,19 +1236,19 @@ PQsendPrepare(PGconn *conn, if (!stmtName) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("statement name is a null pointer\n")); + libpq_gettext("statement name is a null pointer\n")); return 0; } if (!query) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("command string is a null pointer\n")); + libpq_gettext("command string is a null pointer\n")); return 0; } if (nParams < 0 || nParams > 65535) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("number of parameters must be between 0 and 65535\n")); + libpq_gettext("number of parameters must be between 0 and 65535\n")); return 0; } @@ -1256,7 +1256,7 @@ PQsendPrepare(PGconn *conn, if (PG_PROTOCOL_MAJOR(conn->pversion) < 3) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("function requires at least protocol version 3.0\n")); + libpq_gettext("function requires at least protocol version 3.0\n")); return 0; } @@ -1325,7 +1325,7 @@ int PQsendQueryPrepared(PGconn *conn, const char *stmtName, int nParams, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat) @@ -1337,13 +1337,13 @@ PQsendQueryPrepared(PGconn *conn, if (!stmtName) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("statement name is a null pointer\n")); + libpq_gettext("statement name is a null pointer\n")); return 0; } if (nParams < 0 || nParams > 65535) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("number of parameters must be between 0 and 65535\n")); + libpq_gettext("number of parameters must be between 0 and 65535\n")); return 0; } @@ -1381,7 +1381,7 @@ PQsendQueryStart(PGconn *conn) if (conn->asyncStatus != PGASYNC_IDLE) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("another command is already in progress\n")); + libpq_gettext("another command is already in progress\n")); return false; } @@ -1408,7 +1408,7 @@ PQsendQueryGuts(PGconn *conn, const char *stmtName, int nParams, const Oid *paramTypes, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat) @@ -1419,7 +1419,7 @@ PQsendQueryGuts(PGconn *conn, if (PG_PROTOCOL_MAJOR(conn->pversion) < 3) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("function requires at least protocol version 3.0\n")); + libpq_gettext("function requires at least protocol version 3.0\n")); return 0; } @@ -1861,7 +1861,7 @@ PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat) @@ -1907,7 +1907,7 @@ PGresult * PQexecPrepared(PGconn *conn, const char *stmtName, int nParams, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat) @@ -1947,7 +1947,7 @@ PQexecStart(PGconn *conn) { /* In protocol 3, we can get out of a COPY IN state */ if (PQputCopyEnd(conn, - libpq_gettext("COPY terminated by new PQexec")) < 0) + libpq_gettext("COPY terminated by new PQexec")) < 0) return false; /* keep waiting to swallow the copy's failure message */ } @@ -1955,7 +1955,7 @@ PQexecStart(PGconn *conn) { /* In older protocols we have to punt */ printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("COPY IN state must be terminated first\n")); + libpq_gettext("COPY IN state must be terminated first\n")); return false; } } @@ -1975,7 +1975,7 @@ PQexecStart(PGconn *conn) { /* In older protocols we have to punt */ printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("COPY OUT state must be terminated first\n")); + libpq_gettext("COPY OUT state must be terminated first\n")); return false; } } @@ -1983,7 +1983,7 @@ PQexecStart(PGconn *conn) { /* We don't allow PQexec during COPY BOTH */ printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("PQexec not allowed during COPY BOTH\n")); + libpq_gettext("PQexec not allowed during COPY BOTH\n")); return false; } /* check for loss of connection, too */ @@ -2137,7 +2137,7 @@ PQsendDescribe(PGconn *conn, char desc_type, const char *desc_target) if (PG_PROTOCOL_MAJOR(conn->pversion) < 3) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("function requires at least protocol version 3.0\n")); + libpq_gettext("function requires at least protocol version 3.0\n")); return 0; } @@ -3026,7 +3026,7 @@ PQcmdTuples(PGresult *res) while (*p && *p != ' ') p++; if (*p == 0) - goto interpret_error; /* no space? */ + goto interpret_error; /* no space? */ p++; } else if (strncmp(res->cmdStatus, "SELECT ", 7) == 0 || @@ -3293,7 +3293,7 @@ PQescapeStringInternal(PGconn *conn, *error = 1; if (conn) printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("incomplete multibyte character\n")); + libpq_gettext("incomplete multibyte character\n")); for (; i < len; i++) { if (((size_t) (target - to)) / 2 >= length) @@ -3377,7 +3377,7 @@ PQescapeInternal(PGconn *conn, const char *str, size_t len, bool as_ident) if ((s - str) + charlen > len || memchr(s, 0, charlen) != NULL) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("incomplete multibyte character\n")); + libpq_gettext("incomplete multibyte character\n")); return NULL; } diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c index 71c9ff650e..343e5303d9 100644 --- a/src/interfaces/libpq/fe-lobj.c +++ b/src/interfaces/libpq/fe-lobj.c @@ -152,7 +152,7 @@ lo_truncate(PGconn *conn, int fd, size_t len) if (conn->lobjfuncs->fn_lo_truncate == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_truncate\n")); + libpq_gettext("cannot determine OID of function lo_truncate\n")); return -1; } @@ -168,7 +168,7 @@ lo_truncate(PGconn *conn, int fd, size_t len) if (len > (size_t) INT_MAX) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("argument of lo_truncate exceeds integer range\n")); + libpq_gettext("argument of lo_truncate exceeds integer range\n")); return -1; } @@ -219,7 +219,7 @@ lo_truncate64(PGconn *conn, int fd, pg_int64 len) if (conn->lobjfuncs->fn_lo_truncate64 == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_truncate64\n")); + libpq_gettext("cannot determine OID of function lo_truncate64\n")); return -1; } @@ -277,7 +277,7 @@ lo_read(PGconn *conn, int fd, char *buf, size_t len) if (len > (size_t) INT_MAX) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("argument of lo_read exceeds integer range\n")); + libpq_gettext("argument of lo_read exceeds integer range\n")); return -1; } @@ -332,7 +332,7 @@ lo_write(PGconn *conn, int fd, const char *buf, size_t len) if (len > (size_t) INT_MAX) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("argument of lo_write exceeds integer range\n")); + libpq_gettext("argument of lo_write exceeds integer range\n")); return -1; } @@ -423,7 +423,7 @@ lo_lseek64(PGconn *conn, int fd, pg_int64 offset, int whence) if (conn->lobjfuncs->fn_lo_lseek64 == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_lseek64\n")); + libpq_gettext("cannot determine OID of function lo_lseek64\n")); return -1; } @@ -519,7 +519,7 @@ lo_create(PGconn *conn, Oid lobjId) if (conn->lobjfuncs->fn_lo_create == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_create\n")); + libpq_gettext("cannot determine OID of function lo_create\n")); return InvalidOid; } @@ -598,7 +598,7 @@ lo_tell64(PGconn *conn, int fd) if (conn->lobjfuncs->fn_lo_tell64 == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_tell64\n")); + libpq_gettext("cannot determine OID of function lo_tell64\n")); return -1; } @@ -759,7 +759,7 @@ lo_import_internal(PGconn *conn, const char *filename, Oid oid) (void) lo_close(conn, lobj); (void) close(fd); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not read from file \"%s\": %s\n"), + libpq_gettext("could not read from file \"%s\": %s\n"), filename, pqStrerror(save_errno, sebuf, sizeof(sebuf))); return InvalidOid; @@ -833,7 +833,7 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename) (void) lo_close(conn, lobj); (void) close(fd); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not write to file \"%s\": %s\n"), + libpq_gettext("could not write to file \"%s\": %s\n"), filename, pqStrerror(save_errno, sebuf, sizeof(sebuf))); return -1; @@ -857,7 +857,7 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename) if (close(fd) && result >= 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not write to file \"%s\": %s\n"), + libpq_gettext("could not write to file \"%s\": %s\n"), filename, pqStrerror(errno, sebuf, sizeof(sebuf))); result = -1; } @@ -993,56 +993,56 @@ lo_initialize(PGconn *conn) if (lobjfuncs->fn_lo_open == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_open\n")); + libpq_gettext("cannot determine OID of function lo_open\n")); free(lobjfuncs); return -1; } if (lobjfuncs->fn_lo_close == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_close\n")); + libpq_gettext("cannot determine OID of function lo_close\n")); free(lobjfuncs); return -1; } if (lobjfuncs->fn_lo_creat == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_creat\n")); + libpq_gettext("cannot determine OID of function lo_creat\n")); free(lobjfuncs); return -1; } if (lobjfuncs->fn_lo_unlink == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_unlink\n")); + libpq_gettext("cannot determine OID of function lo_unlink\n")); free(lobjfuncs); return -1; } if (lobjfuncs->fn_lo_lseek == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_lseek\n")); + libpq_gettext("cannot determine OID of function lo_lseek\n")); free(lobjfuncs); return -1; } if (lobjfuncs->fn_lo_tell == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lo_tell\n")); + libpq_gettext("cannot determine OID of function lo_tell\n")); free(lobjfuncs); return -1; } if (lobjfuncs->fn_lo_read == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function loread\n")); + libpq_gettext("cannot determine OID of function loread\n")); free(lobjfuncs); return -1; } if (lobjfuncs->fn_lo_write == 0) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("cannot determine OID of function lowrite\n")); + libpq_gettext("cannot determine OID of function lowrite\n")); free(lobjfuncs); return -1; } diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 1d6ea93a0a..cac6359585 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -806,15 +806,15 @@ retry4: definitelyEOF: printfPQExpBuffer(&conn->errorMessage, libpq_gettext( - "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" - "\tbefore or while processing the request.\n")); + "server closed the connection unexpectedly\n" + "\tThis probably means the server terminated abnormally\n" + "\tbefore or while processing the request.\n")); /* Come here if lower-level code already set a suitable errorMessage */ definitelyFailed: /* Do *not* drop any already-read data; caller still wants it */ pqDropConnection(conn, false); - conn->status = CONNECTION_BAD; /* No more connection to backend */ + conn->status = CONNECTION_BAD; /* No more connection to backend */ return -1; } @@ -1165,7 +1165,7 @@ pqSocketPoll(int sock, int forRead, int forWrite, time_t end_time) return select(sock + 1, &input_mask, &output_mask, &except_mask, ptr_timeout); -#endif /* HAVE_POLL */ +#endif /* HAVE_POLL */ } @@ -1259,4 +1259,4 @@ libpq_ngettext(const char *msgid, const char *msgid_plural, unsigned long n) return dngettext(PG_TEXTDOMAIN("libpq"), msgid, msgid_plural, n); } -#endif /* ENABLE_NLS */ +#endif /* ENABLE_NLS */ diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c index fa974540f5..89bc4c5429 100644 --- a/src/interfaces/libpq/fe-print.c +++ b/src/interfaces/libpq/fe-print.c @@ -177,7 +177,7 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) (1 + (po->standard != 0)) >= screen_size.ws_row - (po->header != 0) * (total_line_length / screen_size.ws_col + 1) * 2 - - (po->header != 0) * 2 /* row count and newline */ + - (po->header != 0) * 2 /* row count and newline */ ))) { fout = popen(pagerenv, "w"); @@ -190,8 +190,8 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) sigpipe_masked = true; #else oldsigpipehandler = pqsignal(SIGPIPE, SIG_IGN); -#endif /* ENABLE_THREAD_SAFETY */ -#endif /* WIN32 */ +#endif /* ENABLE_THREAD_SAFETY */ +#endif /* WIN32 */ } else fout = stdout; @@ -271,7 +271,7 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) { if (po->caption) fprintf(fout, - "<table %s><caption align=\"top\">%s</caption>\n", + "<table %s><caption align=\"top\">%s</caption>\n", po->tableOpt ? po->tableOpt : "", po->caption); else @@ -279,7 +279,7 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) "<table %s><caption align=\"top\">" "Retrieved %d rows * %d fields" "</caption>\n", - po->tableOpt ? po->tableOpt : "", nTups, nFields); + po->tableOpt ? po->tableOpt : "", nTups, nFields); } else fprintf(fout, "<table %s>", po->tableOpt ? po->tableOpt : ""); @@ -313,8 +313,8 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po) pq_reset_sigpipe(&osigset, sigpipe_pending, true); #else pqsignal(SIGPIPE, oldsigpipehandler); -#endif /* ENABLE_THREAD_SAFETY */ -#endif /* WIN32 */ +#endif /* ENABLE_THREAD_SAFETY */ +#endif /* WIN32 */ } if (po->html3 && !po->expanded) fputs("</table>\n", fout); @@ -326,7 +326,7 @@ static void do_field(const PQprintOpt *po, const PGresult *res, const int i, const int j, const int fs_len, char **fields, - const int nFields, char const ** fieldNames, + const int nFields, char const **fieldNames, unsigned char *fieldNotNum, int *fieldMax, const int fieldMaxLen, FILE *fout) { diff --git a/src/interfaces/libpq/fe-protocol2.c b/src/interfaces/libpq/fe-protocol2.c index 3b0500fa52..a58f701e18 100644 --- a/src/interfaces/libpq/fe-protocol2.c +++ b/src/interfaces/libpq/fe-protocol2.c @@ -89,7 +89,7 @@ pqSetenvPoll(PGconn *conn) printfPQExpBuffer(&conn->errorMessage, libpq_gettext( "invalid setenv state %c, " - "probably indicative of memory corruption\n" + "probably indicative of memory corruption\n" ), conn->setenv_state); goto error_return; @@ -158,7 +158,7 @@ pqSetenvPoll(PGconn *conn) conn->next_eo->pgName, val); #ifdef CONNECTDEBUG fprintf(stderr, - "Use environment variable %s to send %s\n", + "Use environment variable %s to send %s\n", conn->next_eo->envName, setQuery); #endif if (!PQsendQuery(conn, setQuery)) @@ -388,7 +388,7 @@ pqSetenvPoll(PGconn *conn) default: printfPQExpBuffer(&conn->errorMessage, libpq_gettext("invalid state %c, " - "probably indicative of memory corruption\n"), + "probably indicative of memory corruption\n"), conn->setenv_state); goto error_return; } @@ -476,7 +476,7 @@ pqParseInput2(PGconn *conn) else { pqInternalNotice(&conn->noticeHooks, - "message type 0x%02x arrived from server while idle", + "message type 0x%02x arrived from server while idle", id); /* Discard the unexpected message; good idea?? */ conn->inStart = conn->inEnd; @@ -1099,7 +1099,7 @@ checkXactStatus(PGconn *conn, const char *cmdTag) * However, if we see one of these tags then we know for sure the server * is in abort state ... */ - else if (strcmp(cmdTag, "*ABORT STATE*") == 0) /* pre-7.3 only */ + else if (strcmp(cmdTag, "*ABORT STATE*") == 0) /* pre-7.3 only */ conn->xactStatus = PQTRANS_INERROR; } @@ -1404,7 +1404,7 @@ pqEndcopy2(PGconn *conn) * connection (talk about using a sledgehammer...) */ pqInternalNotice(&conn->noticeHooks, - "lost synchronization with server, resetting connection"); + "lost synchronization with server, resetting connection"); /* * Users doing non-blocking connections need to handle the reset @@ -1526,7 +1526,7 @@ pqFunctionCall2(PGconn *conn, Oid fnid, conn)) continue; } - if (pqGetc(&id, conn)) /* get the last '0' */ + if (pqGetc(&id, conn)) /* get the last '0' */ continue; } if (id == '0') @@ -1538,7 +1538,7 @@ pqFunctionCall2(PGconn *conn, Oid fnid, { /* The backend violates the protocol. */ printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("protocol error: id=0x%x\n"), + libpq_gettext("protocol error: id=0x%x\n"), id); pqSaveErrorResult(conn); conn->inStart = conn->inCursor; diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c index 53776e27b5..a484fe80a1 100644 --- a/src/interfaces/libpq/fe-protocol3.c +++ b/src/interfaces/libpq/fe-protocol3.c @@ -183,7 +183,7 @@ pqParseInput3(PGconn *conn) else { pqInternalNotice(&conn->noticeHooks, - "message type 0x%02x arrived from server while idle", + "message type 0x%02x arrived from server while idle", id); /* Discard the unexpected message */ conn->inCursor += msgLength; @@ -246,11 +246,11 @@ pqParseInput3(PGconn *conn) if (conn->result == NULL) { conn->result = PQmakeEmptyPGresult(conn, - PGRES_COMMAND_OK); + PGRES_COMMAND_OK); if (!conn->result) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("out of memory")); + libpq_gettext("out of memory")); pqSaveErrorResult(conn); } } @@ -326,11 +326,11 @@ pqParseInput3(PGconn *conn) if (conn->result == NULL) { conn->result = PQmakeEmptyPGresult(conn, - PGRES_COMMAND_OK); + PGRES_COMMAND_OK); if (!conn->result) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("out of memory")); + libpq_gettext("out of memory")); pqSaveErrorResult(conn); } } @@ -451,14 +451,14 @@ handleSyncLoss(PGconn *conn, char id, int msgLength) { printfPQExpBuffer(&conn->errorMessage, libpq_gettext( - "lost synchronization with server: got message type \"%c\", length %d\n"), + "lost synchronization with server: got message type \"%c\", length %d\n"), id, msgLength); /* build an error result holding the error message */ pqSaveErrorResult(conn); conn->asyncStatus = PGASYNC_READY; /* drop out of GetResult wait loop */ /* flush input data since we're giving up on processing it */ pqDropConnection(conn, true); - conn->status = CONNECTION_BAD; /* No more connection to backend */ + conn->status = CONNECTION_BAD; /* No more connection to backend */ } /* @@ -1679,7 +1679,7 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async) return -2; } memcpy(*buffer, &conn->inBuffer[conn->inCursor], msgLength); - (*buffer)[msgLength] = '\0'; /* Add terminating null */ + (*buffer)[msgLength] = '\0'; /* Add terminating null */ /* Mark message consumed */ conn->inStart = conn->inCursor + msgLength; @@ -1708,7 +1708,7 @@ pqGetline3(PGconn *conn, char *s, int maxlen) conn->copy_is_binary) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("PQgetline: not doing text COPY OUT\n")); + libpq_gettext("PQgetline: not doing text COPY OUT\n")); *s = '\0'; return EOF; } @@ -1915,8 +1915,8 @@ pqFunctionCall3(PGconn *conn, Oid fnid, if (pqPutMsgStart('F', false, conn) < 0 || /* function call msg */ pqPutInt(fnid, 4, conn) < 0 || /* function id */ - pqPutInt(1, 2, conn) < 0 || /* # of format codes */ - pqPutInt(1, 2, conn) < 0 || /* format code: BINARY */ + pqPutInt(1, 2, conn) < 0 || /* # of format codes */ + pqPutInt(1, 2, conn) < 0 || /* format code: BINARY */ pqPutInt(nargs, 2, conn) < 0) /* # of args */ { pqHandleSendFailure(conn); @@ -1951,7 +1951,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid, } } - if (pqPutInt(1, 2, conn) < 0) /* result format code: BINARY */ + if (pqPutInt(1, 2, conn) < 0) /* result format code: BINARY */ { pqHandleSendFailure(conn); return NULL; diff --git a/src/interfaces/libpq/fe-secure-openssl.c b/src/interfaces/libpq/fe-secure-openssl.c index a7c3d7af64..2f29820e82 100644 --- a/src/interfaces/libpq/fe-secure-openssl.c +++ b/src/interfaces/libpq/fe-secure-openssl.c @@ -91,7 +91,7 @@ static pthread_mutex_t ssl_config_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t ssl_config_mutex = NULL; static long win32_ssl_create_mutex = 0; #endif -#endif /* ENABLE_THREAD_SAFETY */ +#endif /* ENABLE_THREAD_SAFETY */ /* ------------------------------------------------------------ */ @@ -201,7 +201,7 @@ rloop: { /* Not supposed to happen, so we don't translate the msg */ printfPQExpBuffer(&conn->errorMessage, - "SSL_read failed but did not provide error information\n"); + "SSL_read failed but did not provide error information\n"); /* assume the connection is broken */ result_errno = ECONNRESET; } @@ -226,19 +226,19 @@ rloop: result_errno == ECONNRESET) printfPQExpBuffer(&conn->errorMessage, libpq_gettext( - "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" - "\tbefore or while processing the request.\n")); + "server closed the connection unexpectedly\n" + "\tThis probably means the server terminated abnormally\n" + "\tbefore or while processing the request.\n")); else printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL SYSCALL error: %s\n"), + libpq_gettext("SSL SYSCALL error: %s\n"), SOCK_STRERROR(result_errno, sebuf, sizeof(sebuf))); } else { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL SYSCALL error: EOF detected\n")); + libpq_gettext("SSL SYSCALL error: EOF detected\n")); /* assume the connection is broken */ result_errno = ECONNRESET; n = -1; @@ -264,13 +264,13 @@ rloop: * server crash. */ printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL connection has been closed unexpectedly\n")); + libpq_gettext("SSL connection has been closed unexpectedly\n")); result_errno = ECONNRESET; n = -1; break; default: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("unrecognized SSL error code: %d\n"), + libpq_gettext("unrecognized SSL error code: %d\n"), err); /* assume the connection is broken */ result_errno = ECONNRESET; @@ -312,7 +312,7 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len) { /* Not supposed to happen, so we don't translate the msg */ printfPQExpBuffer(&conn->errorMessage, - "SSL_write failed but did not provide error information\n"); + "SSL_write failed but did not provide error information\n"); /* assume the connection is broken */ result_errno = ECONNRESET; } @@ -335,19 +335,19 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len) if (result_errno == EPIPE || result_errno == ECONNRESET) printfPQExpBuffer(&conn->errorMessage, libpq_gettext( - "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" - "\tbefore or while processing the request.\n")); + "server closed the connection unexpectedly\n" + "\tThis probably means the server terminated abnormally\n" + "\tbefore or while processing the request.\n")); else printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL SYSCALL error: %s\n"), + libpq_gettext("SSL SYSCALL error: %s\n"), SOCK_STRERROR(result_errno, sebuf, sizeof(sebuf))); } else { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL SYSCALL error: EOF detected\n")); + libpq_gettext("SSL SYSCALL error: EOF detected\n")); /* assume the connection is broken */ result_errno = ECONNRESET; n = -1; @@ -373,13 +373,13 @@ pgtls_write(PGconn *conn, const void *ptr, size_t len) * server crash. */ printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL connection has been closed unexpectedly\n")); + libpq_gettext("SSL connection has been closed unexpectedly\n")); result_errno = ECONNRESET; n = -1; break; default: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("unrecognized SSL error code: %d\n"), + libpq_gettext("unrecognized SSL error code: %d\n"), err); /* assume the connection is broken */ result_errno = ECONNRESET; @@ -491,7 +491,7 @@ verify_peer_name_matches_certificate_name(PGconn *conn, ASN1_STRING *name_entry, if (name_entry == NULL) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL certificate's name entry is missing\n")); + libpq_gettext("SSL certificate's name entry is missing\n")); return -1; } @@ -525,7 +525,7 @@ verify_peer_name_matches_certificate_name(PGconn *conn, ASN1_STRING *name_entry, { free(name); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL certificate's name contains embedded null\n")); + libpq_gettext("SSL certificate's name contains embedded null\n")); return -1; } @@ -602,7 +602,7 @@ verify_peer_name_matches_certificate(PGconn *conn) names_examined++; rc = verify_peer_name_matches_certificate_name(conn, - name->d.dNSName, + name->d.dNSName, &alt_name); if (rc == -1) got_error = true; @@ -646,8 +646,8 @@ verify_peer_name_matches_certificate(PGconn *conn) names_examined++; rc = verify_peer_name_matches_certificate_name( conn, - X509_NAME_ENTRY_get_data( - X509_NAME_get_entry(subject_name, cn_index)), + X509_NAME_ENTRY_get_data( + X509_NAME_get_entry(subject_name, cn_index)), &first_name); if (rc == -1) @@ -730,7 +730,7 @@ pq_lockingcallback(int mode, int n, const char *file, int line) PGTHREAD_ERROR("failed to unlock mutex"); } } -#endif /* ENABLE_THREAD_SAFETY && HAVE_CRYPTO_LOCK */ +#endif /* ENABLE_THREAD_SAFETY && HAVE_CRYPTO_LOCK */ /* * Initialize SSL library. @@ -809,8 +809,8 @@ pgtls_init(PGconn *conn) CRYPTO_set_locking_callback(pq_lockingcallback); } } -#endif /* HAVE_CRYPTO_LOCK */ -#endif /* ENABLE_THREAD_SAFETY */ +#endif /* HAVE_CRYPTO_LOCK */ +#endif /* ENABLE_THREAD_SAFETY */ if (!ssl_lib_initialized) { @@ -909,7 +909,7 @@ initialize_SSL(PGconn *conn) !(conn->sslrootcert && strlen(conn->sslrootcert) > 0) || !(conn->sslcrl && strlen(conn->sslcrl) > 0)) have_homedir = pqGetHomeDirectory(homedir, sizeof(homedir)); - else /* won't need it */ + else /* won't need it */ have_homedir = false; /* @@ -985,7 +985,7 @@ initialize_SSL(PGconn *conn) /* OpenSSL 0.96 does not support X509_V_FLAG_CRL_CHECK */ #ifdef X509_V_FLAG_CRL_CHECK X509_STORE_set_flags(cvstore, - X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); + X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); #else char *err = SSLerrmessage(ERR_get_error()); @@ -1022,8 +1022,8 @@ initialize_SSL(PGconn *conn) "Either provide the file or change sslmode to disable server certificate verification.\n")); else printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("root certificate file \"%s\" does not exist\n" - "Either provide the file or change sslmode to disable server certificate verification.\n"), fnbuf); + libpq_gettext("root certificate file \"%s\" does not exist\n" + "Either provide the file or change sslmode to disable server certificate verification.\n"), fnbuf); SSL_CTX_free(SSL_context); return -1; } @@ -1053,7 +1053,7 @@ initialize_SSL(PGconn *conn) if (errno != ENOENT && errno != ENOTDIR) { printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not open certificate file \"%s\": %s\n"), + libpq_gettext("could not open certificate file \"%s\": %s\n"), fnbuf, pqStrerror(errno, sebuf, sizeof(sebuf))); SSL_CTX_free(SSL_context); return -1; @@ -1072,7 +1072,7 @@ initialize_SSL(PGconn *conn) char *err = SSLerrmessage(ERR_get_error()); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not read certificate file \"%s\": %s\n"), + libpq_gettext("could not read certificate file \"%s\": %s\n"), fnbuf, err); SSLerrfree(err); SSL_CTX_free(SSL_context); @@ -1097,7 +1097,7 @@ initialize_SSL(PGconn *conn) char *err = SSLerrmessage(ERR_get_error()); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not establish SSL connection: %s\n"), + libpq_gettext("could not establish SSL connection: %s\n"), err); SSLerrfree(err); SSL_CTX_free(SSL_context); @@ -1142,7 +1142,7 @@ initialize_SSL(PGconn *conn) /* cannot return NULL because we already checked before strdup */ engine_colon = strchr(engine_str, ':'); - *engine_colon = '\0'; /* engine_str now has engine name */ + *engine_colon = '\0'; /* engine_str now has engine name */ engine_colon++; /* engine_colon now has key name */ conn->engine = ENGINE_by_id(engine_str); @@ -1151,7 +1151,7 @@ initialize_SSL(PGconn *conn) char *err = SSLerrmessage(ERR_get_error()); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not load SSL engine \"%s\": %s\n"), + libpq_gettext("could not load SSL engine \"%s\": %s\n"), engine_str, err); SSLerrfree(err); free(engine_str); @@ -1163,7 +1163,7 @@ initialize_SSL(PGconn *conn) char *err = SSLerrmessage(ERR_get_error()); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not initialize SSL engine \"%s\": %s\n"), + libpq_gettext("could not initialize SSL engine \"%s\": %s\n"), engine_str, err); SSLerrfree(err); ENGINE_free(conn->engine); @@ -1209,7 +1209,7 @@ initialize_SSL(PGconn *conn) * file */ } else -#endif /* USE_SSL_ENGINE */ +#endif /* USE_SSL_ENGINE */ { /* PGSSLKEY is not an engine, treat it as a filename */ strlcpy(fnbuf, conn->sslkey, sizeof(fnbuf)); @@ -1249,7 +1249,7 @@ initialize_SSL(PGconn *conn) char *err = SSLerrmessage(ERR_get_error()); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not load private key file \"%s\": %s\n"), + libpq_gettext("could not load private key file \"%s\": %s\n"), fnbuf, err); SSLerrfree(err); return -1; @@ -1320,11 +1320,11 @@ open_client_SSL(PGconn *conn) if (r == -1) printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL SYSCALL error: %s\n"), - SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); + libpq_gettext("SSL SYSCALL error: %s\n"), + SOCK_STRERROR(SOCK_ERRNO, sebuf, sizeof(sebuf))); else printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("SSL SYSCALL error: EOF detected\n")); + libpq_gettext("SSL SYSCALL error: EOF detected\n")); pgtls_close(conn); return PGRES_POLLING_FAILED; } @@ -1342,7 +1342,7 @@ open_client_SSL(PGconn *conn) default: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("unrecognized SSL error code: %d\n"), + libpq_gettext("unrecognized SSL error code: %d\n"), err); pgtls_close(conn); return PGRES_POLLING_FAILED; @@ -1363,7 +1363,7 @@ open_client_SSL(PGconn *conn) err = SSLerrmessage(ERR_get_error()); printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("certificate could not be obtained: %s\n"), + libpq_gettext("certificate could not be obtained: %s\n"), err); SSLerrfree(err); pgtls_close(conn); @@ -1660,7 +1660,7 @@ my_BIO_s_socket(void) !BIO_meth_set_puts(my_bio_methods, BIO_meth_get_puts(biom)) || !BIO_meth_set_ctrl(my_bio_methods, BIO_meth_get_ctrl(biom)) || !BIO_meth_set_create(my_bio_methods, BIO_meth_get_create(biom)) || - !BIO_meth_set_destroy(my_bio_methods, BIO_meth_get_destroy(biom)) || + !BIO_meth_set_destroy(my_bio_methods, BIO_meth_get_destroy(biom)) || !BIO_meth_set_callback_ctrl(my_bio_methods, BIO_meth_get_callback_ctrl(biom))) { BIO_meth_free(my_bio_methods); diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c index 8f0d892a34..7c2d0cb4e6 100644 --- a/src/interfaces/libpq/fe-secure.c +++ b/src/interfaces/libpq/fe-secure.c @@ -115,14 +115,14 @@ struct sigpipe_info if (!SIGPIPE_MASKED(conn)) \ pqsignal(SIGPIPE, spinfo); \ } while (0) -#endif /* ENABLE_THREAD_SAFETY */ +#endif /* ENABLE_THREAD_SAFETY */ #else /* WIN32 */ #define DECLARE_SIGPIPE_INFO(spinfo) #define DISABLE_SIGPIPE(conn, spinfo, failaction) #define REMEMBER_EPIPE(spinfo, cond) #define RESTORE_SIGPIPE(conn, spinfo) -#endif /* WIN32 */ +#endif /* WIN32 */ /* ------------------------------------------------------------ */ /* Procedures common to all secure sessions */ @@ -250,15 +250,15 @@ pqsecure_raw_read(PGconn *conn, void *ptr, size_t len) case ECONNRESET: printfPQExpBuffer(&conn->errorMessage, libpq_gettext( - "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" - "\tbefore or while processing the request.\n")); + "server closed the connection unexpectedly\n" + "\tThis probably means the server terminated abnormally\n" + "\tbefore or while processing the request.\n")); break; #endif default: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not receive data from server: %s\n"), + libpq_gettext("could not receive data from server: %s\n"), SOCK_STRERROR(result_errno, sebuf, sizeof(sebuf))); break; @@ -312,7 +312,7 @@ pqsecure_raw_write(PGconn *conn, const void *ptr, size_t len) flags |= MSG_NOSIGNAL; retry_masked: -#endif /* MSG_NOSIGNAL */ +#endif /* MSG_NOSIGNAL */ DISABLE_SIGPIPE(conn, spinfo, return -1); @@ -334,7 +334,7 @@ retry_masked: flags = 0; goto retry_masked; } -#endif /* MSG_NOSIGNAL */ +#endif /* MSG_NOSIGNAL */ /* Set error message if appropriate */ switch (result_errno) @@ -359,14 +359,14 @@ retry_masked: #endif printfPQExpBuffer(&conn->errorMessage, libpq_gettext( - "server closed the connection unexpectedly\n" - "\tThis probably means the server terminated abnormally\n" - "\tbefore or while processing the request.\n")); + "server closed the connection unexpectedly\n" + "\tThis probably means the server terminated abnormally\n" + "\tbefore or while processing the request.\n")); break; default: printfPQExpBuffer(&conn->errorMessage, - libpq_gettext("could not send data to server: %s\n"), + libpq_gettext("could not send data to server: %s\n"), SOCK_STRERROR(result_errno, sebuf, sizeof(sebuf))); break; @@ -415,7 +415,7 @@ PQsslAttributeNames(PGconn *conn) return result; } -#endif /* USE_SSL */ +#endif /* USE_SSL */ #if defined(ENABLE_THREAD_SAFETY) && !defined(WIN32) @@ -502,4 +502,4 @@ pq_reset_sigpipe(sigset_t *osigset, bool sigpipe_pending, bool got_epipe) SOCK_ERRNO_SET(save_errno); } -#endif /* ENABLE_THREAD_SAFETY && !WIN32 */ +#endif /* ENABLE_THREAD_SAFETY && !WIN32 */ diff --git a/src/interfaces/libpq/libpq-events.h b/src/interfaces/libpq/libpq-events.h index b7cd472dea..20af1ffe6d 100644 --- a/src/interfaces/libpq/libpq-events.h +++ b/src/interfaces/libpq/libpq-events.h @@ -19,7 +19,7 @@ #include "libpq-fe.h" #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -91,4 +91,4 @@ extern int PQfireResultCreateEvents(PGconn *conn, PGresult *res); } #endif -#endif /* LIBPQ_EVENTS_H */ +#endif /* LIBPQ_EVENTS_H */ diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index e7496c59db..1d915e7915 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -16,7 +16,7 @@ #define LIBPQ_FE_H #ifdef __cplusplus -extern "C" +extern "C" { #endif @@ -56,8 +56,8 @@ typedef enum */ CONNECTION_STARTED, /* Waiting for connection to be made. */ CONNECTION_MADE, /* Connection OK; waiting to send. */ - CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the - * postmaster. */ + CONNECTION_AWAITING_RESPONSE, /* Waiting for a response from the + * postmaster. */ CONNECTION_AUTH_OK, /* Received authentication; waiting for * backend startup. */ CONNECTION_SETENV, /* Negotiating environment. */ @@ -253,14 +253,14 @@ typedef struct pgresAttDesc /* make a new client connection to the backend */ /* Asynchronous (non-blocking) */ extern PGconn *PQconnectStart(const char *conninfo); -extern PGconn *PQconnectStartParams(const char *const * keywords, - const char *const * values, int expand_dbname); +extern PGconn *PQconnectStartParams(const char *const *keywords, + const char *const *values, int expand_dbname); extern PostgresPollingStatusType PQconnectPoll(PGconn *conn); /* Synchronous (blocking) */ extern PGconn *PQconnectdb(const char *conninfo); -extern PGconn *PQconnectdbParams(const char *const * keywords, - const char *const * values, int expand_dbname); +extern PGconn *PQconnectdbParams(const char *const *keywords, + const char *const *values, int expand_dbname); extern PGconn *PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions, const char *pgtty, const char *dbName, @@ -333,7 +333,7 @@ extern int PQsetClientEncoding(PGconn *conn, const char *encoding); extern int PQsslInUse(PGconn *conn); extern void *PQsslStruct(PGconn *conn, const char *struct_name); extern const char *PQsslAttribute(PGconn *conn, const char *attribute_name); -extern const char *const * PQsslAttributeNames(PGconn *conn); +extern const char *const *PQsslAttributeNames(PGconn *conn); /* Get the OpenSSL structure associated with a connection. Returns NULL for * unencrypted connections or if any other TLS library is in use. */ @@ -383,7 +383,7 @@ extern PGresult *PQexecParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat); @@ -393,7 +393,7 @@ extern PGresult *PQprepare(PGconn *conn, const char *stmtName, extern PGresult *PQexecPrepared(PGconn *conn, const char *stmtName, int nParams, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat); @@ -404,7 +404,7 @@ extern int PQsendQueryParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat); @@ -414,7 +414,7 @@ extern int PQsendPrepare(PGconn *conn, const char *stmtName, extern int PQsendQueryPrepared(PGconn *conn, const char *stmtName, int nParams, - const char *const * paramValues, + const char *const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat); @@ -445,8 +445,8 @@ extern int PQsetnonblocking(PGconn *conn, int arg); extern int PQisnonblocking(const PGconn *conn); extern int PQisthreadsafe(void); extern PGPing PQping(const char *conninfo); -extern PGPing PQpingParams(const char *const * keywords, - const char *const * values, int expand_dbname); +extern PGPing PQpingParams(const char *const *keywords, + const char *const *values, int expand_dbname); /* Force the write buffer to be written (or at least try) */ extern int PQflush(PGconn *conn); @@ -609,4 +609,4 @@ extern int pg_valid_server_encoding_id(int encoding); } #endif -#endif /* LIBPQ_FE_H */ +#endif /* LIBPQ_FE_H */ diff --git a/src/interfaces/libpq/libpq-int.h b/src/interfaces/libpq/libpq-int.h index 335568b790..ff5020fc0c 100644 --- a/src/interfaces/libpq/libpq-int.h +++ b/src/interfaces/libpq/libpq-int.h @@ -69,7 +69,7 @@ typedef struct int length; } gss_buffer_desc; #endif -#endif /* ENABLE_SSPI */ +#endif /* ENABLE_SSPI */ #ifdef USE_OPENSSL #include <openssl/ssl.h> @@ -78,7 +78,7 @@ typedef struct #ifndef OPENSSL_NO_ENGINE #define USE_SSL_ENGINE #endif -#endif /* USE_OPENSSL */ +#endif /* USE_OPENSSL */ /* * POSTGRES backend dependent Constants. @@ -143,7 +143,7 @@ typedef struct pgMessageField { struct pgMessageField *next; /* list link */ char code; /* field code */ - char contents[FLEXIBLE_ARRAY_MEMBER]; /* value, nul-terminated */ + char contents[FLEXIBLE_ARRAY_MEMBER]; /* value, nul-terminated */ } PGMessageField; /* Fields needed for notice handling */ @@ -151,7 +151,7 @@ typedef struct { PQnoticeReceiver noticeRec; /* notice message receiver */ void *noticeRecArg; - PQnoticeProcessor noticeProc; /* notice message processor */ + PQnoticeProcessor noticeProc; /* notice message processor */ void *noticeProcArg; } PGNoticeHooks; @@ -161,7 +161,7 @@ typedef struct PGEvent char *name; /* used only for error messages */ void *passThrough; /* pointer supplied at registration time */ void *data; /* optional state (instance) data */ - bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */ + bool resultInitialized; /* T if RESULTCREATE/COPY succeeded */ } PGEvent; struct pg_result @@ -175,7 +175,7 @@ struct pg_result int numParameters; PGresParamDesc *paramDescs; ExecStatusType resultStatus; - char cmdStatus[CMDSTATUS_LEN]; /* cmd status from the query */ + char cmdStatus[CMDSTATUS_LEN]; /* cmd status from the query */ int binary; /* binary tuple values if binary == 1, * otherwise text */ @@ -255,7 +255,7 @@ typedef struct PQEnvironmentOption /* Typedef for parameter-status list entries */ typedef struct pgParameterStatus { - struct pgParameterStatus *next; /* list link */ + struct pgParameterStatus *next; /* list link */ char *name; /* parameter name */ char *value; /* parameter value */ /* Note: name and value are stored in same malloc block as struct is */ @@ -274,7 +274,7 @@ typedef struct pgLobjfuncs Oid fn_lo_tell; /* OID of backend function lo_tell */ Oid fn_lo_tell64; /* OID of backend function lo_tell64 */ Oid fn_lo_truncate; /* OID of backend function lo_truncate */ - Oid fn_lo_truncate64; /* OID of function lo_truncate64 */ + Oid fn_lo_truncate64; /* OID of function lo_truncate64 */ Oid fn_lo_read; /* OID of backend function LOread */ Oid fn_lo_write; /* OID of backend function LOwrite */ } PGlobjfuncs; @@ -333,7 +333,7 @@ struct pg_conn char *pgtty; /* tty on which the backend messages is * displayed (OBSOLETE, NOT USED) */ char *connect_timeout; /* connection timeout (numeric string) */ - char *client_encoding_initial; /* encoding to use */ + char *client_encoding_initial; /* encoding to use */ char *pgoptions; /* options to start the backend with */ char *appname; /* application name */ char *fbappname; /* fallback application name */ @@ -346,8 +346,8 @@ struct pg_conn char *keepalives_idle; /* time between TCP keepalives */ char *keepalives_interval; /* time between TCP keepalive * retransmits */ - char *keepalives_count; /* maximum number of TCP keepalive - * retransmits */ + char *keepalives_count; /* maximum number of TCP keepalive + * retransmits */ char *sslmode; /* SSL mode (require,prefer,allow,disable) */ char *sslcompression; /* SSL compression (0 or 1) */ char *sslkey; /* client key filename */ @@ -380,14 +380,13 @@ struct pg_conn PGTransactionStatusType xactStatus; /* never changes to ACTIVE */ PGQueryClass queryclass; char *last_query; /* last SQL command, or NULL if unknown */ - char last_sqlstate[6]; /* last reported SQLSTATE */ + char last_sqlstate[6]; /* last reported SQLSTATE */ bool options_valid; /* true if OK to attempt connection */ bool nonblocking; /* whether this connection is using nonblock * sending semantics */ bool singleRowMode; /* return current query result row-by-row? */ char copy_is_binary; /* 1 = copy binary, 0 = copy text */ - int copy_already_done; /* # bytes already returned in COPY - * OUT */ + int copy_already_done; /* # bytes already returned in COPY OUT */ PGnotify *notifyHead; /* oldest unreported Notify msg */ PGnotify *notifyTail; /* newest unreported Notify msg */ @@ -403,8 +402,7 @@ struct pg_conn SockAddr raddr; /* Remote address */ ProtocolVersion pversion; /* FE/BE protocol version in use */ int sversion; /* server version, e.g. 70401 for 7.4.1 */ - bool auth_req_received; /* true if any type of auth req - * received */ + bool auth_req_received; /* true if any type of auth req received */ bool password_needed; /* true if server demanded a password */ bool pgpassfile_used; /* true if password is from pgpassfile */ bool sigpipe_so; /* have we masked SIGPIPE via SO_NOSIGPIPE? */ @@ -468,8 +466,8 @@ struct pg_conn void *engine; /* dummy field to keep struct the same if * OpenSSL version changes */ #endif -#endif /* USE_OPENSSL */ -#endif /* USE_SSL */ +#endif /* USE_OPENSSL */ +#endif /* USE_SSL */ #ifdef ENABLE_GSS gss_ctx_id_t gctx; /* GSS context */ @@ -489,7 +487,7 @@ struct pg_conn #endif /* Buffer for current error message */ - PQExpBufferData errorMessage; /* expansible string */ + PQExpBufferData errorMessage; /* expansible string */ /* Buffer for receiving various parts of messages */ PQExpBufferData workBuffer; /* expansible string */ @@ -528,7 +526,7 @@ extern char *const pgresStatus[]; #define ROOT_CRL_FILE "root.crl" #endif -#endif /* USE_SSL */ +#endif /* USE_SSL */ /* ---------------- * Internal functions of libpq @@ -698,4 +696,4 @@ extern char *libpq_ngettext(const char *msgid, const char *msgid_plural, unsigne #define SOCK_ERRNO_SET(e) (errno = (e)) #endif -#endif /* LIBPQ_INT_H */ +#endif /* LIBPQ_INT_H */ diff --git a/src/interfaces/libpq/pqexpbuffer.c b/src/interfaces/libpq/pqexpbuffer.c index fd62cde99f..f4aa7c9cef 100644 --- a/src/interfaces/libpq/pqexpbuffer.c +++ b/src/interfaces/libpq/pqexpbuffer.c @@ -91,7 +91,7 @@ initPQExpBuffer(PQExpBuffer str) str->data = (char *) malloc(INITIAL_EXPBUFFER_SIZE); if (str->data == NULL) { - str->data = (char *) oom_buffer; /* see comment above */ + str->data = (char *) oom_buffer; /* see comment above */ str->maxlen = 0; str->len = 0; } diff --git a/src/interfaces/libpq/pqexpbuffer.h b/src/interfaces/libpq/pqexpbuffer.h index 239def42b7..19633f9b79 100644 --- a/src/interfaces/libpq/pqexpbuffer.h +++ b/src/interfaces/libpq/pqexpbuffer.h @@ -179,4 +179,4 @@ extern void appendPQExpBufferChar(PQExpBuffer str, char ch); extern void appendBinaryPQExpBuffer(PQExpBuffer str, const char *data, size_t datalen); -#endif /* PQEXPBUFFER_H */ +#endif /* PQEXPBUFFER_H */ diff --git a/src/interfaces/libpq/win32.c b/src/interfaces/libpq/win32.c index f99f9a8cdb..11abb0be04 100644 --- a/src/interfaces/libpq/win32.c +++ b/src/interfaces/libpq/win32.c @@ -44,7 +44,7 @@ static struct WSErrorEntry { DWORD error; const char *description; -} WSErrors[] = +} WSErrors[] = { { @@ -236,7 +236,7 @@ struct MessageDLL const char *dll_name; void *handle; int loaded; /* BOOL */ -} dlls[] = +} dlls[] = { { @@ -307,7 +307,7 @@ winsock_strerror(int err, char *strerrbuf, size_t buflen) success = 0 != FormatMessage( flags, dlls[i].handle, err, - MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), + MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), strerrbuf, buflen - 64, 0 ); diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index ce72dd488e..5a45e3e0aa 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -649,7 +649,7 @@ select_perl_context(bool trusted) ereport(ERROR, (errcode(ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), errmsg("%s", strip_trailing_ws(sv2cstr(ERRSV))), - errcontext("while executing PostgreSQL::InServer::SPI::bootstrap"))); + errcontext("while executing PostgreSQL::InServer::SPI::bootstrap"))); /* Fully initialized, so mark the hashtable entry valid */ interp_desc->interp = interp; @@ -739,7 +739,7 @@ plperl_init_interp(void) STMT_START { \ if (saved != NULL) { setlocale_perl(name, saved); pfree(saved); } \ } STMT_END -#endif /* WIN32 */ +#endif /* WIN32 */ if (plperl_on_init && *plperl_on_init) { @@ -1320,19 +1320,19 @@ plperl_sv_to_datum(SV *sv, Oid typid, int32 typmod, if (!type_is_rowtype(typid)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("cannot convert Perl hash to non-composite type %s", - format_type_be(typid)))); + errmsg("cannot convert Perl hash to non-composite type %s", + format_type_be(typid)))); td = lookup_rowtype_tupdesc_noerror(typid, typmod, true); if (td == NULL) { /* Try to look it up based on our result type */ if (fcinfo == NULL || - get_call_result_type(fcinfo, NULL, &td) != TYPEFUNC_COMPOSITE) + get_call_result_type(fcinfo, NULL, &td) != TYPEFUNC_COMPOSITE) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("function returning record called in context " - "that cannot accept type record"))); + errmsg("function returning record called in context " + "that cannot accept type record"))); } ret = plperl_hash_to_datum(sv, td); @@ -1346,7 +1346,7 @@ plperl_sv_to_datum(SV *sv, Oid typid, int32 typmod, /* Reference, but not reference to hash or array ... */ ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("PL/Perl function must return reference to hash or array"))); + errmsg("PL/Perl function must return reference to hash or array"))); return (Datum) 0; /* shut up compiler */ } else @@ -1436,8 +1436,8 @@ plperl_ref_from_pg_array(Datum arg, Oid typid) /* Check for a transform function */ transform_funcid = get_transform_fromsql(elementtype, - current_call_data->prodesc->lang_oid, - current_call_data->prodesc->trftypes); + current_call_data->prodesc->lang_oid, + current_call_data->prodesc->trftypes); /* Look up transform or output function as appropriate */ if (OidIsValid(transform_funcid)) @@ -1572,7 +1572,7 @@ plperl_trigger_build_args(FunctionCallInfo fcinfo) relid = DatumGetCString( DirectFunctionCall1(oidout, - ObjectIdGetDatum(tdata->tg_relation->rd_id) + ObjectIdGetDatum(tdata->tg_relation->rd_id) ) ); @@ -1725,8 +1725,8 @@ plperl_modify_tuple(HV *hvTD, TriggerData *tdata, HeapTuple otup) key))); modvalues[attn - 1] = plperl_sv_to_datum(val, - tupdesc->attrs[attn - 1]->atttypid, - tupdesc->attrs[attn - 1]->atttypmod, + tupdesc->attrs[attn - 1]->atttypid, + tupdesc->attrs[attn - 1]->atttypmod, NULL, NULL, InvalidOid, @@ -2076,8 +2076,8 @@ plperl_create_sub(plperl_proc_desc *prodesc, char *s, Oid fn_oid) if (!subref) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("didn't get a CODE reference from compiling function \"%s\"", - prodesc->proname))); + errmsg("didn't get a CODE reference from compiling function \"%s\"", + prodesc->proname))); prodesc->reference = subref; @@ -2443,7 +2443,7 @@ plperl_trigger_handler(PG_FUNCTION_ARGS) HV *hvTD; ErrorContextCallback pl_error_context; TriggerData *tdata; - int rc PG_USED_FOR_ASSERTS_ONLY; + int rc PG_USED_FOR_ASSERTS_ONLY; /* Connect to SPI manager */ if (SPI_connect() != SPI_OK_CONNECT) @@ -2527,8 +2527,8 @@ plperl_trigger_handler(PG_FUNCTION_ARGS) { ereport(ERROR, (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED), - errmsg("result of PL/Perl trigger function must be undef, " - "\"SKIP\", or \"MODIFY\""))); + errmsg("result of PL/Perl trigger function must be undef, " + "\"SKIP\", or \"MODIFY\""))); trv = NULL; } retval = PointerGetDatum(trv); @@ -2735,7 +2735,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger) /* Fetch protrftypes */ protrftypes_datum = SysCacheGetAttr(PROCOID, procTup, - Anum_pg_proc_protrftypes, &isnull); + Anum_pg_proc_protrftypes, &isnull); MemoryContextSwitchTo(proc_cxt); prodesc->trftypes = isnull ? NIL : oid_array_to_list(protrftypes_datum); MemoryContextSwitchTo(oldcontext); @@ -2789,7 +2789,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger) prodesc->result_oid = procStruct->prorettype; prodesc->fn_retisset = procStruct->proretset; prodesc->fn_retistuple = (procStruct->prorettype == RECORDOID || - typeStruct->typtype == TYPTYPE_COMPOSITE); + typeStruct->typtype == TYPTYPE_COMPOSITE); prodesc->fn_retisarray = (typeStruct->typlen == -1 && typeStruct->typelem); @@ -2813,7 +2813,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger) for (i = 0; i < prodesc->nargs; i++) { typeTup = SearchSysCache1(TYPEOID, - ObjectIdGetDatum(procStruct->proargtypes.values[i])); + ObjectIdGetDatum(procStruct->proargtypes.values[i])); if (!HeapTupleIsValid(typeTup)) elog(ERROR, "cache lookup failed for type %u", procStruct->proargtypes.values[i]); @@ -2825,7 +2825,7 @@ compile_plperl_function(Oid fn_oid, bool is_trigger, bool is_event_trigger) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("PL/Perl functions cannot accept type %s", - format_type_be(procStruct->proargtypes.values[i])))); + format_type_be(procStruct->proargtypes.values[i])))); if (typeStruct->typtype == TYPTYPE_COMPOSITE || procStruct->proargtypes.values[i] == RECORDOID) @@ -2956,7 +2956,7 @@ plperl_hash_from_tuple(HeapTuple tuple, TupleDesc tupdesc) check_stack_depth(); hv = newHV(); - hv_ksplit(hv, tupdesc->natts); /* pre-grow the hash */ + hv_ksplit(hv, tupdesc->natts); /* pre-grow the hash */ for (i = 0; i < tupdesc->natts; i++) { @@ -3117,7 +3117,7 @@ plperl_spi_execute_fetch_result(SPITupleTable *tuptable, uint64 processed, if (processed > (uint64) AV_SIZE_MAX) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), - errmsg("query result has too many rows to fit in a Perl array"))); + errmsg("query result has too many rows to fit in a Perl array"))); rows = newAV(); av_extend(rows, processed); @@ -3635,7 +3635,7 @@ plperl_spi_exec_prepared(char *query, HV *attr, int argc, SV **argv) * go ************************************************************/ spi_rv = SPI_execute_plan(qdesc->plan, argvalues, nulls, - current_call_data->prodesc->fn_readonly, limit); + current_call_data->prodesc->fn_readonly, limit); ret_hv = plperl_spi_execute_fetch_result(SPI_tuptable, SPI_processed, spi_rv); if (argc > 0) @@ -3933,7 +3933,7 @@ setlocale_perl(int category, char *locale) newctype = RETVAL; new_ctype(newctype); } -#endif /* USE_LOCALE_CTYPE */ +#endif /* USE_LOCALE_CTYPE */ #ifdef USE_LOCALE_COLLATE if (category == LC_COLLATE #ifdef LC_ALL @@ -3951,7 +3951,7 @@ setlocale_perl(int category, char *locale) newcoll = RETVAL; new_collate(newcoll); } -#endif /* USE_LOCALE_COLLATE */ +#endif /* USE_LOCALE_COLLATE */ #ifdef USE_LOCALE_NUMERIC if (category == LC_NUMERIC @@ -3970,7 +3970,7 @@ setlocale_perl(int category, char *locale) newnum = RETVAL; new_numeric(newnum); } -#endif /* USE_LOCALE_NUMERIC */ +#endif /* USE_LOCALE_NUMERIC */ } return RETVAL; diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h index ae367b0fc1..eecd192802 100644 --- a/src/pl/plperl/plperl.h +++ b/src/pl/plperl/plperl.h @@ -62,8 +62,8 @@ #else #define vsnprintf pg_vsnprintf #define snprintf pg_snprintf -#endif /* __GNUC__ */ -#endif /* USE_REPL_SNPRINTF */ +#endif /* __GNUC__ */ +#endif /* USE_REPL_SNPRINTF */ /* perl version and platform portability */ #define NEED_eval_pv @@ -107,4 +107,4 @@ void plperl_spi_freeplan(char *); void plperl_spi_cursor_close(char *); char *plperl_sv_to_literal(SV *, char *); -#endif /* PL_PERL_H */ +#endif /* PL_PERL_H */ diff --git a/src/pl/plperl/plperl_helpers.h b/src/pl/plperl/plperl_helpers.h index f8aa06835c..76124edc07 100644 --- a/src/pl/plperl/plperl_helpers.h +++ b/src/pl/plperl/plperl_helpers.h @@ -158,7 +158,7 @@ croak_cstr(const char *str) sv_setsv(errsv, ssv); croak(NULL); -#endif /* croak_sv */ +#endif /* croak_sv */ } -#endif /* PL_PERL_HELPERS_H */ +#endif /* PL_PERL_HELPERS_H */ diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index cc093556e5..662b3c97d7 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -352,7 +352,7 @@ do_compile(FunctionCallInfo fcinfo, function->fn_tid = procTup->t_self; function->fn_input_collation = fcinfo->fncollation; function->fn_cxt = func_cxt; - function->out_param_varno = -1; /* set up for no OUT param */ + function->out_param_varno = -1; /* set up for no OUT param */ function->resolve_option = plpgsql_variable_conflict; function->print_strict_params = plpgsql_print_strict_params; /* only promote extra warnings and errors at CREATE FUNCTION time */ @@ -421,7 +421,7 @@ do_compile(FunctionCallInfo fcinfo, /* Create datatype info */ argdtype = plpgsql_build_datatype(argtypeid, -1, - function->fn_input_collation); + function->fn_input_collation); /* Disallow pseudotype argument */ /* (note we already replaced polymorphic types) */ @@ -430,8 +430,8 @@ do_compile(FunctionCallInfo fcinfo, argdtype->ttype != PLPGSQL_TTYPE_ROW) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("PL/pgSQL functions cannot accept type %s", - format_type_be(argtypeid)))); + errmsg("PL/pgSQL functions cannot accept type %s", + format_type_be(argtypeid)))); /* Build variable and add to datum list */ argvariable = plpgsql_build_variable(buf, 0, @@ -501,7 +501,7 @@ do_compile(FunctionCallInfo fcinfo, rettypeid = INT4ARRAYOID; else if (rettypeid == ANYRANGEOID) rettypeid = INT4RANGEOID; - else /* ANYELEMENT or ANYNONARRAY */ + else /* ANYELEMENT or ANYNONARRAY */ rettypeid = INT4OID; /* XXX what could we use for ANYENUM? */ } @@ -511,9 +511,9 @@ do_compile(FunctionCallInfo fcinfo, if (!OidIsValid(rettypeid)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("could not determine actual return type " - "for polymorphic function \"%s\"", - plpgsql_error_funcname))); + errmsg("could not determine actual return type " + "for polymorphic function \"%s\"", + plpgsql_error_funcname))); } } @@ -545,8 +545,8 @@ do_compile(FunctionCallInfo fcinfo, else ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("PL/pgSQL functions cannot return type %s", - format_type_be(rettypeid)))); + errmsg("PL/pgSQL functions cannot return type %s", + format_type_be(rettypeid)))); } if (typeStruct->typrelid != InvalidOid || @@ -568,7 +568,7 @@ do_compile(FunctionCallInfo fcinfo, (void) plpgsql_build_variable("$0", 0, build_datatype(typeTup, -1, - function->fn_input_collation), + function->fn_input_collation), true); } } @@ -586,7 +586,7 @@ do_compile(FunctionCallInfo fcinfo, if (procStruct->pronargs != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), - errmsg("trigger functions cannot have declared arguments"), + errmsg("trigger functions cannot have declared arguments"), errhint("The arguments of the trigger can be accessed through TG_NARGS and TG_ARGV instead."))); /* Add the record for referencing NEW ROW */ @@ -609,7 +609,7 @@ do_compile(FunctionCallInfo fcinfo, var = plpgsql_build_variable("tg_when", 0, plpgsql_build_datatype(TEXTOID, -1, - function->fn_input_collation), + function->fn_input_collation), true); function->tg_when_varno = var->dno; @@ -617,7 +617,7 @@ do_compile(FunctionCallInfo fcinfo, var = plpgsql_build_variable("tg_level", 0, plpgsql_build_datatype(TEXTOID, -1, - function->fn_input_collation), + function->fn_input_collation), true); function->tg_level_varno = var->dno; @@ -625,7 +625,7 @@ do_compile(FunctionCallInfo fcinfo, var = plpgsql_build_variable("tg_op", 0, plpgsql_build_datatype(TEXTOID, -1, - function->fn_input_collation), + function->fn_input_collation), true); function->tg_op_varno = var->dno; @@ -673,7 +673,7 @@ do_compile(FunctionCallInfo fcinfo, var = plpgsql_build_variable("tg_argv", 0, plpgsql_build_datatype(TEXTARRAYOID, -1, - function->fn_input_collation), + function->fn_input_collation), true); function->tg_argv_varno = var->dno; @@ -695,7 +695,7 @@ do_compile(FunctionCallInfo fcinfo, var = plpgsql_build_variable("tg_event", 0, plpgsql_build_datatype(TEXTOID, -1, - function->fn_input_collation), + function->fn_input_collation), true); function->tg_event_varno = var->dno; @@ -703,7 +703,7 @@ do_compile(FunctionCallInfo fcinfo, var = plpgsql_build_variable("tg_tag", 0, plpgsql_build_datatype(TEXTOID, -1, - function->fn_input_collation), + function->fn_input_collation), true); function->tg_tag_varno = var->dno; @@ -838,7 +838,7 @@ plpgsql_compile_inline(char *proc_source) function->fn_is_trigger = PLPGSQL_NOT_TRIGGER; function->fn_input_collation = InvalidOid; function->fn_cxt = func_cxt; - function->out_param_varno = -1; /* set up for no OUT param */ + function->out_param_varno = -1; /* set up for no OUT param */ function->resolve_option = plpgsql_variable_conflict; function->print_strict_params = plpgsql_print_strict_params; @@ -1439,7 +1439,7 @@ plpgsql_parse_dblword(char *word1, char *word2, /* Block-qualified reference to scalar variable. */ wdatum->datum = plpgsql_Datums[ns->itemno]; wdatum->ident = NULL; - wdatum->quoted = false; /* not used */ + wdatum->quoted = false; /* not used */ wdatum->idents = idents; return true; @@ -1469,7 +1469,7 @@ plpgsql_parse_dblword(char *word1, char *word2, wdatum->datum = plpgsql_Datums[ns->itemno]; } wdatum->ident = NULL; - wdatum->quoted = false; /* not used */ + wdatum->quoted = false; /* not used */ wdatum->idents = idents; return true; @@ -2034,9 +2034,9 @@ build_row_from_class(Oid classOid) * we ignore this information for now. */ var = plpgsql_build_variable(refname, 0, - plpgsql_build_datatype(attrStruct->atttypid, - attrStruct->atttypmod, - attrStruct->attcollation), + plpgsql_build_datatype(attrStruct->atttypid, + attrStruct->atttypmod, + attrStruct->attcollation), false); /* Add the variable to the row */ @@ -2206,7 +2206,7 @@ build_datatype(HeapTuple typeTup, int32 typmod, Oid collation) /* we can short-circuit looking up base types if it's not varlena */ typ->typisarray = (typeStruct->typlen == -1 && typeStruct->typstorage != 'p' && - OidIsValid(get_base_element_type(typeStruct->typbasetype))); + OidIsValid(get_base_element_type(typeStruct->typbasetype))); } else typ->typisarray = false; @@ -2316,7 +2316,7 @@ plpgsql_start_datums(void) plpgsql_nDatums = 0; /* This is short-lived, so needn't allocate in function's cxt */ plpgsql_Datums = MemoryContextAlloc(plpgsql_compile_tmp_cxt, - sizeof(PLpgSQL_datum *) * datums_alloc); + sizeof(PLpgSQL_datum *) * datums_alloc); /* datums_last tracks what's been seen by plpgsql_add_initdatums() */ datums_last = 0; } @@ -2520,7 +2520,7 @@ plpgsql_resolve_polymorphic_argtypes(int numargs, { case ANYELEMENTOID: case ANYNONARRAYOID: - case ANYENUMOID: /* XXX dubious */ + case ANYENUMOID: /* XXX dubious */ argtypes[i] = INT4OID; break; case ANYARRAYOID: diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index 73dddec35f..5a13ac2bce 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -84,8 +84,8 @@ typedef struct typedef struct SimpleEcontextStackEntry { ExprContext *stack_econtext; /* a stacked econtext */ - SubTransactionId xact_subxid; /* ID for current subxact */ - struct SimpleEcontextStackEntry *next; /* next stack entry up */ + SubTransactionId xact_subxid; /* ID for current subxact */ + struct SimpleEcontextStackEntry *next; /* next stack entry up */ } SimpleEcontextStackEntry; static EState *shared_simple_eval_estate = NULL; @@ -399,8 +399,8 @@ plpgsql_exec_function(PLpgSQL_function *func, FunctionCallInfo fcinfo, { /* take ownership of R/W object */ assign_simple_var(&estate, var, - TransferExpandedObject(var->value, - CurrentMemoryContext), + TransferExpandedObject(var->value, + CurrentMemoryContext), false, true); } @@ -413,7 +413,7 @@ plpgsql_exec_function(PLpgSQL_function *func, FunctionCallInfo fcinfo, /* flat array, so force to expanded form */ assign_simple_var(&estate, var, expand_array(var->value, - CurrentMemoryContext, + CurrentMemoryContext, NULL), false, true); @@ -546,7 +546,7 @@ plpgsql_exec_function(PLpgSQL_function *func, FunctionCallInfo fcinfo, * the generated result type, instead. */ tupdesc = estate.rettupdesc; - if (tupdesc == NULL) /* shouldn't happen */ + if (tupdesc == NULL) /* shouldn't happen */ elog(ERROR, "return type must be a row type"); break; default: @@ -715,7 +715,7 @@ plpgsql_exec_trigger(PLpgSQL_function *func, var = (PLpgSQL_var *) (estate.datums[func->tg_name_varno]); assign_simple_var(&estate, var, DirectFunctionCall1(namein, - CStringGetDatum(trigdata->tg_trigger->tgname)), + CStringGetDatum(trigdata->tg_trigger->tgname)), false, true); var = (PLpgSQL_var *) (estate.datums[func->tg_when_varno]); @@ -744,21 +744,21 @@ plpgsql_exec_trigger(PLpgSQL_function *func, var = (PLpgSQL_var *) (estate.datums[func->tg_relname_varno]); assign_simple_var(&estate, var, DirectFunctionCall1(namein, - CStringGetDatum(RelationGetRelationName(trigdata->tg_relation))), + CStringGetDatum(RelationGetRelationName(trigdata->tg_relation))), false, true); var = (PLpgSQL_var *) (estate.datums[func->tg_table_name_varno]); assign_simple_var(&estate, var, DirectFunctionCall1(namein, - CStringGetDatum(RelationGetRelationName(trigdata->tg_relation))), + CStringGetDatum(RelationGetRelationName(trigdata->tg_relation))), false, true); var = (PLpgSQL_var *) (estate.datums[func->tg_table_schema_varno]); assign_simple_var(&estate, var, DirectFunctionCall1(namein, CStringGetDatum(get_namespace_name( - RelationGetNamespace( - trigdata->tg_relation)))), + RelationGetNamespace( + trigdata->tg_relation)))), false, true); var = (PLpgSQL_var *) (estate.datums[func->tg_nargs_varno]); @@ -821,7 +821,7 @@ plpgsql_exec_trigger(PLpgSQL_function *func, estate.err_text = NULL; ereport(ERROR, (errcode(ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT), - errmsg("control reached end of trigger procedure without RETURN"))); + errmsg("control reached end of trigger procedure without RETURN"))); } estate.err_stmt = NULL; @@ -945,7 +945,7 @@ plpgsql_exec_event_trigger(PLpgSQL_function *func, EventTriggerData *trigdata) estate.err_text = NULL; ereport(ERROR, (errcode(ERRCODE_S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT), - errmsg("control reached end of trigger procedure without RETURN"))); + errmsg("control reached end of trigger procedure without RETURN"))); } estate.err_stmt = NULL; @@ -1716,8 +1716,8 @@ exec_stmt_getdiag(PLpgSQL_execstate *estate, PLpgSQL_stmt_getdiag *stmt) */ if (stmt->is_stacked && estate->cur_error == NULL) ereport(ERROR, - (errcode(ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER), - errmsg("GET STACKED DIAGNOSTICS cannot be used outside an exception handler"))); + (errcode(ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER), + errmsg("GET STACKED DIAGNOSTICS cannot be used outside an exception handler"))); foreach(lc, stmt->diag_items) { @@ -1755,7 +1755,7 @@ exec_stmt_getdiag(PLpgSQL_execstate *estate, PLpgSQL_stmt_getdiag *stmt) case PLPGSQL_GETDIAG_RETURNED_SQLSTATE: exec_assign_c_string(estate, var, - unpack_sql_state(estate->cur_error->sqlerrcode)); + unpack_sql_state(estate->cur_error->sqlerrcode)); break; case PLPGSQL_GETDIAG_COLUMN_NAME: @@ -1880,7 +1880,7 @@ exec_stmt_case(PLpgSQL_execstate *estate, PLpgSQL_stmt_case *stmt) t_var->datatype->atttypmod != t_typmod) t_var->datatype = plpgsql_build_datatype(t_typoid, t_typmod, - estate->func->fn_input_collation); + estate->func->fn_input_collation); /* now we can assign to the variable */ exec_assign_value(estate, @@ -2117,7 +2117,7 @@ exec_stmt_fori(PLpgSQL_execstate *estate, PLpgSQL_stmt_fori *stmt) if (step_value <= 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("BY value of FOR loop must be greater than zero"))); + errmsg("BY value of FOR loop must be greater than zero"))); } else step_value = 1; @@ -2455,8 +2455,8 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt) if (stmt->slice < 0 || stmt->slice > ARR_NDIM(arr)) ereport(ERROR, (errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR), - errmsg("slice dimension (%d) is out of the valid range 0..%d", - stmt->slice, ARR_NDIM(arr)))); + errmsg("slice dimension (%d) is out of the valid range 0..%d", + stmt->slice, ARR_NDIM(arr)))); /* Set up the loop variable and see if it is of an array type */ loop_var = estate->datums[stmt->varno]; @@ -2471,7 +2471,7 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt) } else loop_var_elem_type = get_element_type(plpgsql_exec_get_datum_type(estate, - loop_var)); + loop_var)); /* * Sanity-check the loop variable type. We don't try very hard here, and @@ -2482,11 +2482,11 @@ exec_stmt_foreach_a(PLpgSQL_execstate *estate, PLpgSQL_stmt_foreach_a *stmt) if (stmt->slice > 0 && loop_var_elem_type == InvalidOid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("FOREACH ... SLICE loop variable must be of an array type"))); + errmsg("FOREACH ... SLICE loop variable must be of an array type"))); if (stmt->slice == 0 && loop_var_elem_type != InvalidOid) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("FOREACH loop variable must not be of an array type"))); + errmsg("FOREACH loop variable must not be of an array type"))); /* Create an iterator to step through the array */ array_iterator = array_create_iterator(arr, stmt->slice, NULL); @@ -2729,7 +2729,7 @@ exec_stmt_return(PLpgSQL_execstate *estate, PLpgSQL_stmt_return *stmt) if (!row->rowtupdesc) /* should not happen */ elog(ERROR, "row variable has no tupdesc"); tup = make_tuple_from_row(estate, row, row->rowtupdesc); - if (tup == NULL) /* should not happen */ + if (tup == NULL) /* should not happen */ elog(ERROR, "row not compatible with its own tupdesc"); estate->retval = PointerGetDatum(tup); estate->rettupdesc = row->rowtupdesc; @@ -2849,12 +2849,12 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, if (natts != 1) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("wrong result type supplied in RETURN NEXT"))); + errmsg("wrong result type supplied in RETURN NEXT"))); /* let's be very paranoid about the cast step */ retval = MakeExpandedObjectReadOnly(retval, isNull, - var->datatype->typlen); + var->datatype->typlen); /* coerce type if needed */ retval = exec_cast_value(estate, @@ -2877,11 +2877,11 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, if (!HeapTupleIsValid(rec->tup)) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("record \"%s\" is not assigned yet", - rec->refname), - errdetail("The tuple structure of a not-yet-assigned" - " record is indeterminate."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("record \"%s\" is not assigned yet", + rec->refname), + errdetail("The tuple structure of a not-yet-assigned" + " record is indeterminate."))); /* Use eval_mcontext for tuple conversion work */ oldcontext = MemoryContextSwitchTo(get_eval_mcontext(estate)); @@ -2906,7 +2906,7 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, if (tuple == NULL) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("wrong record type supplied in RETURN NEXT"))); + errmsg("wrong record type supplied in RETURN NEXT"))); tuplestore_puttuple(estate->tuple_store, tuple); MemoryContextSwitchTo(oldcontext); } @@ -2976,7 +2976,7 @@ exec_stmt_return_next(PLpgSQL_execstate *estate, if (natts != 1) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("wrong result type supplied in RETURN NEXT"))); + errmsg("wrong result type supplied in RETURN NEXT"))); /* coerce type if needed */ retval = exec_cast_value(estate, @@ -3045,7 +3045,7 @@ exec_stmt_return_query(PLpgSQL_execstate *estate, tupmap = convert_tuples_by_position(portal->tupDesc, estate->rettupdesc, - gettext_noop("structure of query does not match function result type")); + gettext_noop("structure of query does not match function result type")); while (true) { @@ -3162,8 +3162,8 @@ exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt) ReThrowError(estate->cur_error); /* oops, we're not inside a handler */ ereport(ERROR, - (errcode(ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER), - errmsg("RAISE without parameters cannot be used outside an exception handler"))); + (errcode(ERRCODE_STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER), + errmsg("RAISE without parameters cannot be used outside an exception handler"))); } /* We'll need to accumulate the various strings in stmt_mcontext */ @@ -3215,7 +3215,7 @@ exec_stmt_raise(PLpgSQL_execstate *estate, PLpgSQL_stmt_raise *stmt) elog(ERROR, "unexpected RAISE parameter list length"); paramvalue = exec_eval_expr(estate, - (PLpgSQL_expr *) lfirst(current_param), + (PLpgSQL_expr *) lfirst(current_param), ¶misnull, ¶mtypeid, ¶mtypmod); @@ -3444,7 +3444,7 @@ plpgsql_estate_setup(PLpgSQL_execstate *estate, estate->paramLI->paramFetch = plpgsql_param_fetch; estate->paramLI->paramFetchArg = (void *) estate; estate->paramLI->parserSetup = (ParserSetupHook) plpgsql_parser_setup; - estate->paramLI->parserSetupArg = NULL; /* filled during use */ + estate->paramLI->parserSetupArg = NULL; /* filled during use */ estate->paramLI->numParams = estate->ndatums; estate->paramLI->paramMask = NULL; estate->params_dirty = false; @@ -3459,9 +3459,9 @@ plpgsql_estate_setup(PLpgSQL_execstate *estate, ctl.entrysize = sizeof(plpgsql_CastHashEntry); ctl.hcxt = CurrentMemoryContext; estate->cast_hash = hash_create("PLpgSQL private cast cache", - 16, /* start small and extend */ + 16, /* start small and extend */ &ctl, - HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); + HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); estate->cast_hash_context = CurrentMemoryContext; } else @@ -3472,7 +3472,7 @@ plpgsql_estate_setup(PLpgSQL_execstate *estate, { shared_cast_context = AllocSetContextCreate(TopMemoryContext, "PLpgSQL cast info", - ALLOCSET_DEFAULT_SIZES); + ALLOCSET_DEFAULT_SIZES); memset(&ctl, 0, sizeof(ctl)); ctl.keysize = sizeof(plpgsql_CastHashKey); ctl.entrysize = sizeof(plpgsql_CastHashEntry); @@ -3480,7 +3480,7 @@ plpgsql_estate_setup(PLpgSQL_execstate *estate, shared_cast_hash = hash_create("PLpgSQL cast cache", 16, /* start small and extend */ &ctl, - HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); + HASH_ELEM | HASH_BLOBS | HASH_CONTEXT); } estate->cast_hash = shared_cast_hash; estate->cast_hash_context = shared_cast_context; @@ -3748,7 +3748,7 @@ exec_stmt_execsql(PLpgSQL_execstate *estate, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot begin/end transactions in PL/pgSQL"), - errhint("Use a BEGIN block with an EXCEPTION clause instead."))); + errhint("Use a BEGIN block with an EXCEPTION clause instead."))); default: elog(ERROR, "SPI_execute_plan_with_paramlist failed executing query \"%s\": %s", @@ -3771,7 +3771,7 @@ exec_stmt_execsql(PLpgSQL_execstate *estate, if (tuptab == NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("INTO used with a command that cannot return data"))); + errmsg("INTO used with a command that cannot return data"))); /* Determine if we assign to a record or a row */ if (stmt->rec != NULL) @@ -3938,7 +3938,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot begin/end transactions in PL/pgSQL"), - errhint("Use a BEGIN block with an EXCEPTION clause instead."))); + errhint("Use a BEGIN block with an EXCEPTION clause instead."))); default: elog(ERROR, "SPI_execute failed executing query \"%s\": %s", @@ -3962,7 +3962,7 @@ exec_stmt_dynexecute(PLpgSQL_execstate *estate, if (tuptab == NULL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("INTO used with a command that cannot return data"))); + errmsg("INTO used with a command that cannot return data"))); /* Determine if we assign to a record or a row */ if (stmt->rec != NULL) @@ -4164,7 +4164,7 @@ exec_stmt_open(PLpgSQL_execstate *estate, PLpgSQL_stmt_open *stmt) if (curvar->cursor_explicit_argrow < 0) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("arguments given for cursor without arguments"))); + errmsg("arguments given for cursor without arguments"))); memset(&set_args, 0, sizeof(set_args)); set_args.cmd_type = PLPGSQL_STMT_EXECSQL; @@ -4585,10 +4585,10 @@ exec_assign_value(PLpgSQL_execstate *estate, */ if (!HeapTupleIsValid(rec->tup)) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("record \"%s\" is not assigned yet", - rec->refname), - errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("record \"%s\" is not assigned yet", + rec->refname), + errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); /* * Get the number of the record field to change. Disallow @@ -4707,7 +4707,7 @@ exec_assign_value(PLpgSQL_execstate *estate, if (!OidIsValid(elemtypoid)) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("subscripted object is not an array"))); + errmsg("subscripted object is not an array"))); /* Collect needed data about the types */ arraytyplen = get_typlen(arraytypoid); @@ -4782,7 +4782,7 @@ exec_assign_value(PLpgSQL_execstate *estate, * array, either, so that's a no-op too. This is all ugly but * corresponds to the current behavior of execExpr*.c. */ - if (arrayelem->arraytyplen > 0 && /* fixed-length array? */ + if (arrayelem->arraytyplen > 0 && /* fixed-length array? */ (oldarrayisnull || isNull)) return; @@ -4893,10 +4893,10 @@ exec_eval_datum(PLpgSQL_execstate *estate, if (!HeapTupleIsValid(rec->tup)) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("record \"%s\" is not assigned yet", - rec->refname), - errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("record \"%s\" is not assigned yet", + rec->refname), + errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); Assert(rec->tupdesc != NULL); /* Make sure we have a valid type/typmod setting */ BlessTupleDesc(rec->tupdesc); @@ -4919,10 +4919,10 @@ exec_eval_datum(PLpgSQL_execstate *estate, rec = (PLpgSQL_rec *) (estate->datums[recfield->recparentno]); if (!HeapTupleIsValid(rec->tup)) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("record \"%s\" is not assigned yet", - rec->refname), - errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("record \"%s\" is not assigned yet", + rec->refname), + errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); fno = SPI_fnumber(rec->tupdesc, recfield->fieldname); if (fno == SPI_ERROR_NOATTRIBUTE) ereport(ERROR, @@ -4985,10 +4985,10 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, if (rec->tupdesc == NULL) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("record \"%s\" is not assigned yet", - rec->refname), - errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("record \"%s\" is not assigned yet", + rec->refname), + errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); /* Make sure we have a valid type/typmod setting */ BlessTupleDesc(rec->tupdesc); typeid = rec->tupdesc->tdtypeid; @@ -5004,10 +5004,10 @@ plpgsql_exec_get_datum_type(PLpgSQL_execstate *estate, rec = (PLpgSQL_rec *) (estate->datums[recfield->recparentno]); if (rec->tupdesc == NULL) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("record \"%s\" is not assigned yet", - rec->refname), - errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("record \"%s\" is not assigned yet", + rec->refname), + errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); fno = SPI_fnumber(rec->tupdesc, recfield->fieldname); if (fno == SPI_ERROR_NOATTRIBUTE) ereport(ERROR, @@ -5072,10 +5072,10 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, if (rec->tupdesc == NULL) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("record \"%s\" is not assigned yet", - rec->refname), - errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("record \"%s\" is not assigned yet", + rec->refname), + errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); /* Make sure we have a valid type/typmod setting */ BlessTupleDesc(rec->tupdesc); *typeid = rec->tupdesc->tdtypeid; @@ -5095,10 +5095,10 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, rec = (PLpgSQL_rec *) (estate->datums[recfield->recparentno]); if (rec->tupdesc == NULL) ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("record \"%s\" is not assigned yet", - rec->refname), - errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("record \"%s\" is not assigned yet", + rec->refname), + errdetail("The tuple structure of a not-yet-assigned record is indeterminate."))); fno = SPI_fnumber(rec->tupdesc, recfield->fieldname); if (fno == SPI_ERROR_NOATTRIBUTE) ereport(ERROR, @@ -5112,14 +5112,14 @@ plpgsql_exec_get_datum_type_info(PLpgSQL_execstate *estate, *typmod = -1; if (fno > 0) *collation = rec->tupdesc->attrs[fno - 1]->attcollation; - else /* no system column types have collation */ + else /* no system column types have collation */ *collation = InvalidOid; break; } default: elog(ERROR, "unrecognized dtype: %d", datum->dtype); - *typeid = InvalidOid; /* keep compiler quiet */ + *typeid = InvalidOid; /* keep compiler quiet */ *typmod = -1; *collation = InvalidOid; break; @@ -5856,7 +5856,7 @@ setup_unshared_param_list(PLpgSQL_execstate *estate, PLpgSQL_expr *expr) else prm->value = MakeExpandedObjectReadOnly(var->value, var->isnull, - var->datatype->typlen); + var->datatype->typlen); prm->isnull = var->isnull; prm->pflags = PARAM_FLAG_CONST; prm->ptype = var->datatype->typoid; @@ -5951,7 +5951,7 @@ plpgsql_param_fetch(ParamListInfo params, int paramid) if (datum->dtype == PLPGSQL_DTYPE_VAR && dno != expr->rwparam) prm->value = MakeExpandedObjectReadOnly(prm->value, prm->isnull, - ((PLpgSQL_var *) datum)->datatype->typlen); + ((PLpgSQL_var *) datum)->datatype->typlen); } @@ -6447,7 +6447,7 @@ get_cast_hashentry(PLpgSQL_execstate *estate, /* Now we can fill in a hashtable entry. */ cast_entry = (plpgsql_CastHashEntry *) hash_search(estate->cast_hash, (void *) &cast_key, - HASH_ENTER, &found); + HASH_ENTER, &found); Assert(!found); /* wasn't there a moment ago */ cast_entry->cast_expr = (Expr *) cast_expr; cast_entry->cast_exprstate = NULL; diff --git a/src/pl/plpgsql/src/pl_funcs.c b/src/pl/plpgsql/src/pl_funcs.c index 93f89814b3..cd44a8e9a3 100644 --- a/src/pl/plpgsql/src/pl_funcs.c +++ b/src/pl/plpgsql/src/pl_funcs.c @@ -99,7 +99,7 @@ plpgsql_ns_additem(PLpgSQL_nsitem_type itemtype, int itemno, const char *name) /* first item added must be a label */ Assert(ns_top != NULL || itemtype == PLPGSQL_NSTYPE_LABEL); - nse = palloc(offsetof(PLpgSQL_nsitem, name) +strlen(name) + 1); + nse = palloc(offsetof(PLpgSQL_nsitem, name) + strlen(name) + 1); nse->itemtype = itemtype; nse->itemno = itemno; nse->prev = ns_top; diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c index 83ec4530db..1ebb7a7b5e 100644 --- a/src/pl/plpgsql/src/pl_handler.c +++ b/src/pl/plpgsql/src/pl_handler.c @@ -168,7 +168,7 @@ _PG_init(void) NULL, NULL, NULL); DefineCustomBoolVariable("plpgsql.check_asserts", - gettext_noop("Perform checks given in ASSERT statements."), + gettext_noop("Perform checks given in ASSERT statements."), NULL, &plpgsql_check_asserts, true, @@ -247,7 +247,7 @@ plpgsql_call_handler(PG_FUNCTION_ARGS) */ if (CALLED_AS_TRIGGER(fcinfo)) retval = PointerGetDatum(plpgsql_exec_trigger(func, - (TriggerData *) fcinfo->context)); + (TriggerData *) fcinfo->context)); else if (CALLED_AS_EVENT_TRIGGER(fcinfo)) { plpgsql_exec_event_trigger(func, diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index 43e7eb317b..2b19948562 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -232,10 +232,10 @@ typedef struct PLpgSQL_expr struct PLpgSQL_nsitem *ns; /* fields for "simple expression" fast-path execution: */ - Expr *expr_simple_expr; /* NULL means not a simple expr */ + Expr *expr_simple_expr; /* NULL means not a simple expr */ int expr_simple_generation; /* plancache generation we checked */ - Oid expr_simple_type; /* result type Oid, if simple */ - int32 expr_simple_typmod; /* result typmod, if simple */ + Oid expr_simple_type; /* result type Oid, if simple */ + int32 expr_simple_typmod; /* result typmod, if simple */ /* * if expr is simple AND prepared in current transaction, @@ -243,8 +243,8 @@ typedef struct PLpgSQL_expr * seeing if expr_simple_lxid matches current LXID. (If not, * expr_simple_state probably points at garbage!) */ - ExprState *expr_simple_state; /* eval tree for expr_simple_expr */ - bool expr_simple_in_use; /* true if eval tree is active */ + ExprState *expr_simple_state; /* eval tree for expr_simple_expr */ + bool expr_simple_in_use; /* true if eval tree is active */ LocalTransactionId expr_simple_lxid; } PLpgSQL_expr; @@ -865,7 +865,7 @@ typedef struct PLpgSQL_function /* the datums representing the function's local variables */ int ndatums; PLpgSQL_datum **datums; - Bitmapset *resettable_datums; /* dnos of non-simple vars */ + Bitmapset *resettable_datums; /* dnos of non-simple vars */ /* function body parsetree */ PLpgSQL_stmt_block *action; @@ -897,7 +897,7 @@ typedef struct PLpgSQL_execstate * CONTINUE stmt, if any */ ErrorData *cur_error; /* current exception handler's error */ - Tuplestorestate *tuple_store; /* SRFs accumulate results here */ + Tuplestorestate *tuple_store; /* SRFs accumulate results here */ MemoryContext tuple_store_cxt; ResourceOwner tuple_store_owner; ReturnSetInfo *rsi; @@ -977,7 +977,7 @@ typedef struct PLpgSQL_plugin /* Function pointers set by PL/pgSQL itself */ void (*error_callback) (void *arg); void (*assign_expr) (PLpgSQL_execstate *estate, PLpgSQL_datum *target, - PLpgSQL_expr *expr); + PLpgSQL_expr *expr); } PLpgSQL_plugin; /* @@ -1153,4 +1153,4 @@ extern void plpgsql_scanner_finish(void); */ extern int plpgsql_yyparse(void); -#endif /* PLPGSQL_H */ +#endif /* PLPGSQL_H */ diff --git a/src/pl/plpython/plpy_cursorobject.c b/src/pl/plpython/plpy_cursorobject.c index 18e689f141..2ad663cf66 100644 --- a/src/pl/plpython/plpy_cursorobject.c +++ b/src/pl/plpython/plpy_cursorobject.c @@ -192,8 +192,8 @@ PLy_cursor_plan(PyObject *ob, PyObject *args) PLy_elog(ERROR, "could not execute plan"); sv = PyString_AsString(so); PLy_exception_set_plural(PyExc_TypeError, - "Expected sequence of %d argument, got %d: %s", - "Expected sequence of %d arguments, got %d: %s", + "Expected sequence of %d argument, got %d: %s", + "Expected sequence of %d arguments, got %d: %s", plan->nargs, plan->nargs, nargs, sv); Py_DECREF(so); @@ -501,7 +501,7 @@ PLy_cursor_close(PyObject *self, PyObject *unused) if (!PortalIsValid(portal)) { PLy_exception_set(PyExc_ValueError, - "closing a cursor in an aborted subtransaction"); + "closing a cursor in an aborted subtransaction"); return NULL; } diff --git a/src/pl/plpython/plpy_cursorobject.h b/src/pl/plpython/plpy_cursorobject.h index ef23865dd2..018b169cbf 100644 --- a/src/pl/plpython/plpy_cursorobject.h +++ b/src/pl/plpython/plpy_cursorobject.h @@ -21,4 +21,4 @@ extern void PLy_cursor_init_type(void); extern PyObject *PLy_cursor(PyObject *self, PyObject *args); extern PyObject *PLy_cursor_plan(PyObject *ob, PyObject *args); -#endif /* PLPY_CURSOROBJECT_H */ +#endif /* PLPY_CURSOROBJECT_H */ diff --git a/src/pl/plpython/plpy_elog.c b/src/pl/plpython/plpy_elog.c index c4806274bc..bb864899f6 100644 --- a/src/pl/plpython/plpy_elog.c +++ b/src/pl/plpython/plpy_elog.c @@ -25,10 +25,10 @@ static void PLy_traceback(PyObject *e, PyObject *v, PyObject *tb, char **xmsg, char **tbmsg, int *tb_depth); static void PLy_get_spi_error_data(PyObject *exc, int *sqlerrcode, char **detail, char **hint, char **query, int *position, - char **schema_name, char **table_name, char **column_name, + char **schema_name, char **table_name, char **column_name, char **datatype_name, char **constraint_name); static void PLy_get_error_data(PyObject *exc, int *sqlerrcode, char **detail, - char **hint, char **schema_name, char **table_name, char **column_name, + char **hint, char **schema_name, char **table_name, char **column_name, char **datatype_name, char **constraint_name); static char *get_source_line(const char *src, int lineno); @@ -122,7 +122,7 @@ PLy_elog(int elevel, const char *fmt,...) { ereport(elevel, (errcode(sqlerrcode ? sqlerrcode : ERRCODE_EXTERNAL_ROUTINE_EXCEPTION), - errmsg_internal("%s", primary ? primary : "no exception data"), + errmsg_internal("%s", primary ? primary : "no exception data"), (detail) ? errdetail_internal("%s", detail) : 0, (tb_depth > 0 && tbmsg) ? errcontext("%s", tbmsg) : 0, (hint) ? errhint("%s", hint) : 0, @@ -136,8 +136,8 @@ PLy_elog(int elevel, const char *fmt,...) column_name) : 0, (datatype_name) ? err_generic_string(PG_DIAG_DATATYPE_NAME, datatype_name) : 0, - (constraint_name) ? err_generic_string(PG_DIAG_CONSTRAINT_NAME, - constraint_name) : 0)); + (constraint_name) ? err_generic_string(PG_DIAG_CONSTRAINT_NAME, + constraint_name) : 0)); } PG_CATCH(); { @@ -317,11 +317,11 @@ PLy_traceback(PyObject *e, PyObject *v, PyObject *tb, if (proname == NULL) appendStringInfo( - &tbstr, "\n PL/Python anonymous code block, line %ld, in %s", + &tbstr, "\n PL/Python anonymous code block, line %ld, in %s", plain_lineno - 1, fname); else appendStringInfo( - &tbstr, "\n PL/Python function \"%s\", line %ld, in %s", + &tbstr, "\n PL/Python function \"%s\", line %ld, in %s", proname, plain_lineno - 1, fname); /* diff --git a/src/pl/plpython/plpy_elog.h b/src/pl/plpython/plpy_elog.h index 5dd4ef7a14..e73177d130 100644 --- a/src/pl/plpython/plpy_elog.h +++ b/src/pl/plpython/plpy_elog.h @@ -15,8 +15,8 @@ extern void PLy_elog(int elevel, const char *fmt,...) pg_attribute_printf(2, 3); extern void PLy_exception_set(PyObject *exc, const char *fmt,...) pg_attribute_printf(2, 3); extern void PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural, - unsigned long n,...) pg_attribute_printf(2, 5) pg_attribute_printf(3, 5); + unsigned long n,...) pg_attribute_printf(2, 5) pg_attribute_printf(3, 5); extern void PLy_exception_set_with_details(PyObject *excclass, ErrorData *edata); -#endif /* PLPY_ELOG_H */ +#endif /* PLPY_ELOG_H */ diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c index aa4d68664f..c6938d00aa 100644 --- a/src/pl/plpython/plpy_exec.c +++ b/src/pl/plpython/plpy_exec.c @@ -31,7 +31,7 @@ typedef struct PLySRFState { PyObject *iter; /* Python iterator producing results */ PLySavedArgs *savedargs; /* function argument values */ - MemoryContextCallback callback; /* for releasing refcounts when done */ + MemoryContextCallback callback; /* for releasing refcounts when done */ } PLySRFState; static PyObject *PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc); @@ -345,7 +345,7 @@ PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc) PG_TRY(); { - int rc PG_USED_FOR_ASSERTS_ONLY; + int rc PG_USED_FOR_ASSERTS_ONLY; rc = SPI_register_trigger_data(tdata); Assert(rc >= 0); @@ -376,7 +376,7 @@ PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc) { ereport(ERROR, (errcode(ERRCODE_DATA_EXCEPTION), - errmsg("unexpected return value from trigger procedure"), + errmsg("unexpected return value from trigger procedure"), errdetail("Expected None or a string."))); srv = NULL; /* keep compiler quiet */ } @@ -402,7 +402,7 @@ PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc) */ ereport(ERROR, (errcode(ERRCODE_DATA_EXCEPTION), - errmsg("unexpected return value from trigger procedure"), + errmsg("unexpected return value from trigger procedure"), errdetail("Expected None, \"OK\", \"SKIP\", or \"MODIFY\"."))); } } @@ -487,7 +487,7 @@ PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc) PLy_elog(ERROR, "PyList_SetItem() failed, while setting up arguments"); if (proc->argnames && proc->argnames[i] && - PyDict_SetItemString(proc->globals, proc->argnames[i], arg) == -1) + PyDict_SetItemString(proc->globals, proc->argnames[i], arg) == -1) PLy_elog(ERROR, "PyDict_SetItemString() failed, while setting up arguments"); arg = NULL; } @@ -554,7 +554,7 @@ PLy_function_save_args(PLyProcedure *proc) if (proc->argnames[i]) { result->namedargs[i] = PyDict_GetItemString(proc->globals, - proc->argnames[i]); + proc->argnames[i]); Py_XINCREF(result->namedargs[i]); } } @@ -747,7 +747,7 @@ PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc, HeapTuple *r Py_DECREF(pltname); stroid = DatumGetCString(DirectFunctionCall1(oidout, - ObjectIdGetDatum(tdata->tg_relation->rd_id))); + ObjectIdGetDatum(tdata->tg_relation->rd_id))); pltrelid = PyString_FromString(stroid); PyDict_SetItemString(pltdata, "relid", pltrelid); Py_DECREF(pltrelid); diff --git a/src/pl/plpython/plpy_exec.h b/src/pl/plpython/plpy_exec.h index 439a1d801f..68da1ffcb2 100644 --- a/src/pl/plpython/plpy_exec.h +++ b/src/pl/plpython/plpy_exec.h @@ -10,4 +10,4 @@ extern Datum PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc); extern HeapTuple PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc); -#endif /* PLPY_EXEC_H */ +#endif /* PLPY_EXEC_H */ diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c index 860b804e54..7df50c09c8 100644 --- a/src/pl/plpython/plpy_main.c +++ b/src/pl/plpython/plpy_main.c @@ -214,7 +214,7 @@ plpython2_validator(PG_FUNCTION_ARGS) /* call plpython validator with our fcinfo so it gets our oid */ return plpython_validator(fcinfo); } -#endif /* PY_MAJOR_VERSION < 3 */ +#endif /* PY_MAJOR_VERSION < 3 */ Datum plpython_call_handler(PG_FUNCTION_ARGS) @@ -288,7 +288,7 @@ plpython2_call_handler(PG_FUNCTION_ARGS) { return plpython_call_handler(fcinfo); } -#endif /* PY_MAJOR_VERSION < 3 */ +#endif /* PY_MAJOR_VERSION < 3 */ Datum plpython_inline_handler(PG_FUNCTION_ARGS) @@ -368,7 +368,7 @@ plpython2_inline_handler(PG_FUNCTION_ARGS) { return plpython_inline_handler(fcinfo); } -#endif /* PY_MAJOR_VERSION < 3 */ +#endif /* PY_MAJOR_VERSION < 3 */ static bool PLy_procedure_is_trigger(Form_pg_proc procStruct) diff --git a/src/pl/plpython/plpy_main.h b/src/pl/plpython/plpy_main.h index 10426c4323..e8c97c24d7 100644 --- a/src/pl/plpython/plpy_main.h +++ b/src/pl/plpython/plpy_main.h @@ -28,4 +28,4 @@ extern PLyExecutionContext *PLy_current_execution_context(void); /* Get the scratch memory context for specified execution context */ extern MemoryContext PLy_get_scratch_context(PLyExecutionContext *context); -#endif /* PLPY_MAIN_H */ +#endif /* PLPY_MAIN_H */ diff --git a/src/pl/plpython/plpy_planobject.h b/src/pl/plpython/plpy_planobject.h index c67559266e..5adc957053 100644 --- a/src/pl/plpython/plpy_planobject.h +++ b/src/pl/plpython/plpy_planobject.h @@ -24,4 +24,4 @@ extern void PLy_plan_init_type(void); extern PyObject *PLy_plan_new(void); extern bool is_PLyPlanObject(PyObject *ob); -#endif /* PLPY_PLANOBJECT_H */ +#endif /* PLPY_PLANOBJECT_H */ diff --git a/src/pl/plpython/plpy_plpymodule.c b/src/pl/plpython/plpy_plpymodule.c index ad160aeec3..feaf203256 100644 --- a/src/pl/plpython/plpy_plpymodule.c +++ b/src/pl/plpython/plpy_plpymodule.c @@ -140,7 +140,7 @@ PyInit_plpy(void) return m; } -#endif /* PY_MAJOR_VERSION >= 3 */ +#endif /* PY_MAJOR_VERSION >= 3 */ void PLy_init_plpy(void) @@ -493,7 +493,7 @@ PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw) else { PLy_exception_set(PyExc_TypeError, - "'%s' is an invalid keyword argument for this function", + "'%s' is an invalid keyword argument for this function", keyword); return NULL; } @@ -549,7 +549,7 @@ PLy_output(volatile int level, PyObject *self, PyObject *args, PyObject *kw) (column_name != NULL) ? err_generic_string(PG_DIAG_COLUMN_NAME, column_name) : 0, (constraint_name != NULL) ? - err_generic_string(PG_DIAG_CONSTRAINT_NAME, constraint_name) : 0, + err_generic_string(PG_DIAG_CONSTRAINT_NAME, constraint_name) : 0, (datatype_name != NULL) ? err_generic_string(PG_DIAG_DATATYPE_NAME, datatype_name) : 0, (table_name != NULL) ? diff --git a/src/pl/plpython/plpy_plpymodule.h b/src/pl/plpython/plpy_plpymodule.h index ee089b78a1..54d78101ce 100644 --- a/src/pl/plpython/plpy_plpymodule.h +++ b/src/pl/plpython/plpy_plpymodule.h @@ -16,4 +16,4 @@ PyMODINIT_FUNC PyInit_plpy(void); #endif extern void PLy_init_plpy(void); -#endif /* PLPY_PLPYMODULE_H */ +#endif /* PLPY_PLPYMODULE_H */ diff --git a/src/pl/plpython/plpy_procedure.c b/src/pl/plpython/plpy_procedure.c index e86117c837..26acc88b27 100644 --- a/src/pl/plpython/plpy_procedure.c +++ b/src/pl/plpython/plpy_procedure.c @@ -215,7 +215,7 @@ PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger) Form_pg_type rvTypeStruct; rvTypeTup = SearchSysCache1(TYPEOID, - ObjectIdGetDatum(procStruct->prorettype)); + ObjectIdGetDatum(procStruct->prorettype)); if (!HeapTupleIsValid(rvTypeTup)) elog(ERROR, "cache lookup failed for type %u", procStruct->prorettype); @@ -232,8 +232,8 @@ PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger) procStruct->prorettype != RECORDOID) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("PL/Python functions cannot return type %s", - format_type_be(procStruct->prorettype)))); + errmsg("PL/Python functions cannot return type %s", + format_type_be(procStruct->prorettype)))); } if (rvTypeStruct->typtype == TYPTYPE_COMPOSITE || @@ -313,8 +313,8 @@ PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger) /* Disallow pseudotype argument */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("PL/Python functions cannot accept type %s", - format_type_be(types[i])))); + errmsg("PL/Python functions cannot accept type %s", + format_type_be(types[i])))); break; case TYPTYPE_COMPOSITE: /* we'll set IO funcs at first call */ diff --git a/src/pl/plpython/plpy_procedure.h b/src/pl/plpython/plpy_procedure.h index 8ffa38e068..d05944fc39 100644 --- a/src/pl/plpython/plpy_procedure.h +++ b/src/pl/plpython/plpy_procedure.h @@ -17,7 +17,7 @@ typedef struct PLySavedArgs struct PLySavedArgs *next; /* linked-list pointer */ PyObject *args; /* "args" element of globals dict */ int nargs; /* length of namedargs array */ - PyObject *namedargs[FLEXIBLE_ARRAY_MEMBER]; /* named args */ + PyObject *namedargs[FLEXIBLE_ARRAY_MEMBER]; /* named args */ } PLySavedArgs; /* cached procedure data */ @@ -66,4 +66,4 @@ extern PLyProcedure *PLy_procedure_get(Oid fn_oid, Oid fn_rel, bool is_trigger); extern void PLy_procedure_compile(PLyProcedure *proc, const char *src); extern void PLy_procedure_delete(PLyProcedure *proc); -#endif /* PLPY_PROCEDURE_H */ +#endif /* PLPY_PROCEDURE_H */ diff --git a/src/pl/plpython/plpy_resultobject.h b/src/pl/plpython/plpy_resultobject.h index 314510c40f..bbaca0dd00 100644 --- a/src/pl/plpython/plpy_resultobject.h +++ b/src/pl/plpython/plpy_resultobject.h @@ -22,4 +22,4 @@ typedef struct PLyResultObject extern void PLy_result_init_type(void); extern PyObject *PLy_result_new(void); -#endif /* PLPY_RESULTOBJECT_H */ +#endif /* PLPY_RESULTOBJECT_H */ diff --git a/src/pl/plpython/plpy_spi.c b/src/pl/plpython/plpy_spi.c index c6856ccbac..955769c5e3 100644 --- a/src/pl/plpython/plpy_spi.c +++ b/src/pl/plpython/plpy_spi.c @@ -56,7 +56,7 @@ PLy_spi_prepare(PyObject *self, PyObject *args) if (list && (!PySequence_Check(list))) { PLy_exception_set(PyExc_TypeError, - "second argument of plpy.prepare must be a sequence"); + "second argument of plpy.prepare must be a sequence"); return NULL; } @@ -226,8 +226,8 @@ PLy_spi_execute_plan(PyObject *ob, PyObject *list, long limit) PLy_elog(ERROR, "could not execute plan"); sv = PyString_AsString(so); PLy_exception_set_plural(PyExc_TypeError, - "Expected sequence of %d argument, got %d: %s", - "Expected sequence of %d arguments, got %d: %s", + "Expected sequence of %d argument, got %d: %s", + "Expected sequence of %d arguments, got %d: %s", plan->nargs, plan->nargs, nargs, sv); Py_DECREF(so); @@ -570,7 +570,7 @@ PLy_spi_exception_set(PyObject *excclass, ErrorData *edata) spidata = Py_BuildValue("(izzzizzzzz)", edata->sqlerrcode, edata->detail, edata->hint, edata->internalquery, edata->internalpos, - edata->schema_name, edata->table_name, edata->column_name, + edata->schema_name, edata->table_name, edata->column_name, edata->datatype_name, edata->constraint_name); if (!spidata) goto failure; diff --git a/src/pl/plpython/plpy_spi.h b/src/pl/plpython/plpy_spi.h index 817a7584e7..d6b0a4707b 100644 --- a/src/pl/plpython/plpy_spi.h +++ b/src/pl/plpython/plpy_spi.h @@ -23,4 +23,4 @@ extern void PLy_spi_subtransaction_begin(MemoryContext oldcontext, ResourceOwner extern void PLy_spi_subtransaction_commit(MemoryContext oldcontext, ResourceOwner oldowner); extern void PLy_spi_subtransaction_abort(MemoryContext oldcontext, ResourceOwner oldowner); -#endif /* PLPY_SPI_H */ +#endif /* PLPY_SPI_H */ diff --git a/src/pl/plpython/plpy_subxactobject.h b/src/pl/plpython/plpy_subxactobject.h index d9c3929234..92a9e635f3 100644 --- a/src/pl/plpython/plpy_subxactobject.h +++ b/src/pl/plpython/plpy_subxactobject.h @@ -29,4 +29,4 @@ typedef struct PLySubtransactionData extern void PLy_subtransaction_init_type(void); extern PyObject *PLy_subtransaction_new(PyObject *self, PyObject *unused); -#endif /* PLPY_SUBXACTOBJECT */ +#endif /* PLPY_SUBXACTOBJECT */ diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c index 0e04753fa1..b2db8940a0 100644 --- a/src/pl/plpython/plpy_typeio.c +++ b/src/pl/plpython/plpy_typeio.c @@ -683,7 +683,7 @@ PLyList_FromArray_recurse(PLyDatumToOb *elm, int *dims, int ndim, int dim, PyObject *sublist; sublist = PLyList_FromArray_recurse(elm, dims, ndim, dim + 1, - dataptr_p, bitmap_p, bitmask_p); + dataptr_p, bitmap_p, bitmask_p); PyList_SET_ITEM(list, i, sublist); } } diff --git a/src/pl/plpython/plpy_typeio.h b/src/pl/plpython/plpy_typeio.h index e04722c47a..95f84d8341 100644 --- a/src/pl/plpython/plpy_typeio.h +++ b/src/pl/plpython/plpy_typeio.h @@ -119,4 +119,4 @@ extern PyObject *PLyDict_FromTuple(PLyTypeInfo *info, HeapTuple tuple, TupleDesc /* conversion from Python objects to C strings */ extern char *PLyObject_AsString(PyObject *plrv); -#endif /* PLPY_TYPEIO_H */ +#endif /* PLPY_TYPEIO_H */ diff --git a/src/pl/plpython/plpy_util.c b/src/pl/plpython/plpy_util.c index f2d5949137..35d57a9e80 100644 --- a/src/pl/plpython/plpy_util.c +++ b/src/pl/plpython/plpy_util.c @@ -132,4 +132,4 @@ PLyUnicode_FromString(const char *s) return PLyUnicode_FromStringAndSize(s, strlen(s)); } -#endif /* PY_MAJOR_VERSION >= 3 */ +#endif /* PY_MAJOR_VERSION >= 3 */ diff --git a/src/pl/plpython/plpy_util.h b/src/pl/plpython/plpy_util.h index 66c5ccf8ac..f990bb0890 100644 --- a/src/pl/plpython/plpy_util.h +++ b/src/pl/plpython/plpy_util.h @@ -14,4 +14,4 @@ extern PyObject *PLyUnicode_FromString(const char *s); extern PyObject *PLyUnicode_FromStringAndSize(const char *s, Py_ssize_t size); #endif -#endif /* PLPY_UTIL_H */ +#endif /* PLPY_UTIL_H */ diff --git a/src/pl/plpython/plpython.h b/src/pl/plpython/plpython.h index d687860ab2..9a8e8f246d 100644 --- a/src/pl/plpython/plpython.h +++ b/src/pl/plpython/plpython.h @@ -138,8 +138,8 @@ typedef int Py_ssize_t; #else #define vsnprintf pg_vsnprintf #define snprintf pg_snprintf -#endif /* __GNUC__ */ -#endif /* USE_REPL_SNPRINTF */ +#endif /* __GNUC__ */ +#endif /* USE_REPL_SNPRINTF */ /* * Used throughout, and also by the Python 2/3 porting layer, so it's easier to @@ -147,4 +147,4 @@ typedef int Py_ssize_t; */ #include "plpy_util.h" -#endif /* PLPYTHON_H */ +#endif /* PLPYTHON_H */ diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index ae9ba80cf7..ed494e1210 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -135,16 +135,16 @@ typedef struct pltcl_interp_desc typedef struct pltcl_proc_desc { char *user_proname; /* user's name (from pg_proc.proname) */ - char *internal_proname; /* Tcl name (based on function OID) */ + char *internal_proname; /* Tcl name (based on function OID) */ MemoryContext fn_cxt; /* memory context for this procedure */ unsigned long fn_refcount; /* number of active references */ TransactionId fn_xmin; /* xmin of pg_proc row */ ItemPointerData fn_tid; /* TID of pg_proc row */ bool fn_readonly; /* is function readonly? */ bool lanpltrusted; /* is it pltcl (vs. pltclu)? */ - pltcl_interp_desc *interp_desc; /* interpreter to use */ + pltcl_interp_desc *interp_desc; /* interpreter to use */ FmgrInfo result_in_func; /* input function for fn's result type */ - Oid result_typioparam; /* param to pass to same */ + Oid result_typioparam; /* param to pass to same */ bool fn_retisset; /* true if function returns a set */ bool fn_retistuple; /* true if function returns composite */ int nargs; /* number of arguments */ @@ -221,8 +221,8 @@ typedef struct pltcl_call_state AttInMetadata *attinmeta; /* metadata for building tuples of that type */ ReturnSetInfo *rsi; /* passed-in ReturnSetInfo, if any */ - Tuplestorestate *tuple_store; /* SRFs accumulate result here */ - MemoryContext tuple_store_cxt; /* context and resowner for tuplestore */ + Tuplestorestate *tuple_store; /* SRFs accumulate result here */ + MemoryContext tuple_store_cxt; /* context and resowner for tuplestore */ ResourceOwner tuple_store_owner; } pltcl_call_state; @@ -456,14 +456,14 @@ _PG_init(void) * Define PL/Tcl's custom GUCs ************************************************************/ DefineCustomStringVariable("pltcl.start_proc", - gettext_noop("PL/Tcl function to call once when pltcl is first used."), + gettext_noop("PL/Tcl function to call once when pltcl is first used."), NULL, &pltcl_start_proc, NULL, PGC_SUSET, 0, NULL, NULL, NULL); DefineCustomStringVariable("pltclu.start_proc", - gettext_noop("PL/TclU function to call once when pltclu is first used."), + gettext_noop("PL/TclU function to call once when pltclu is first used."), NULL, &pltclu_start_proc, NULL, @@ -742,7 +742,7 @@ pltcl_handler(PG_FUNCTION_ARGS, bool pltrusted) { /* invoke the trigger handler */ retval = PointerGetDatum(pltcl_trigger_handler(fcinfo, - ¤t_call_state, + ¤t_call_state, pltrusted)); } else if (CALLED_AS_EVENT_TRIGGER(fcinfo)) @@ -899,7 +899,7 @@ pltcl_func_handler(PG_FUNCTION_ARGS, pltcl_call_state *call_state, fcinfo->arg[i]); UTF_BEGIN; Tcl_ListObjAppendElement(NULL, tcl_cmd, - Tcl_NewStringObj(UTF_E2U(tmp), -1)); + Tcl_NewStringObj(UTF_E2U(tmp), -1)); UTF_END; pfree(tmp); } @@ -1039,7 +1039,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS, pltcl_call_state *call_state, const char *result; int result_Objc; Tcl_Obj **result_Objv; - int rc PG_USED_FOR_ASSERTS_ONLY; + int rc PG_USED_FOR_ASSERTS_ONLY; call_state->trigdata = trigdata; @@ -1054,7 +1054,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS, pltcl_call_state *call_state, /* Find or compile the function */ prodesc = compile_pltcl_function(fcinfo->flinfo->fn_oid, RelationGetRelid(trigdata->tg_relation), - false, /* not an event trigger */ + false, /* not an event trigger */ pltrusted); call_state->prodesc = prodesc; @@ -1075,16 +1075,16 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS, pltcl_call_state *call_state, { /* The procedure name (note this is all ASCII, so no utf_e2u) */ Tcl_ListObjAppendElement(NULL, tcl_cmd, - Tcl_NewStringObj(prodesc->internal_proname, -1)); + Tcl_NewStringObj(prodesc->internal_proname, -1)); /* The trigger name for argument TG_name */ Tcl_ListObjAppendElement(NULL, tcl_cmd, - Tcl_NewStringObj(utf_e2u(trigdata->tg_trigger->tgname), -1)); + Tcl_NewStringObj(utf_e2u(trigdata->tg_trigger->tgname), -1)); /* The oid of the trigger relation for argument TG_relid */ /* Consider not converting to a string for more performance? */ stroid = DatumGetCString(DirectFunctionCall1(oidout, - ObjectIdGetDatum(trigdata->tg_relation->rd_id))); + ObjectIdGetDatum(trigdata->tg_relation->rd_id))); Tcl_ListObjAppendElement(NULL, tcl_cmd, Tcl_NewStringObj(stroid, -1)); pfree(stroid); @@ -1208,7 +1208,7 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS, pltcl_call_state *call_state, /* Finally append the arguments from CREATE TRIGGER */ for (i = 0; i < trigdata->tg_trigger->tgnargs; i++) Tcl_ListObjAppendElement(NULL, tcl_cmd, - Tcl_NewStringObj(utf_e2u(trigdata->tg_trigger->tgargs[i]), -1)); + Tcl_NewStringObj(utf_e2u(trigdata->tg_trigger->tgargs[i]), -1)); } PG_CATCH(); @@ -1521,7 +1521,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid, prodesc->fn_retisset = procStruct->proretset; prodesc->fn_retistuple = (procStruct->prorettype == RECORDOID || - typeStruct->typtype == TYPTYPE_COMPOSITE); + typeStruct->typtype == TYPTYPE_COMPOSITE); ReleaseSysCache(typeTup); } @@ -1536,7 +1536,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid, for (i = 0; i < prodesc->nargs; i++) { typeTup = SearchSysCache1(TYPEOID, - ObjectIdGetDatum(procStruct->proargtypes.values[i])); + ObjectIdGetDatum(procStruct->proargtypes.values[i])); if (!HeapTupleIsValid(typeTup)) elog(ERROR, "cache lookup failed for type %u", procStruct->proargtypes.values[i]); @@ -1547,7 +1547,7 @@ compile_pltcl_function(Oid fn_oid, Oid tgreloid, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("PL/Tcl functions cannot accept type %s", - format_type_be(procStruct->proargtypes.values[i])))); + format_type_be(procStruct->proargtypes.values[i])))); if (typeStruct->typtype == TYPTYPE_COMPOSITE) { @@ -1811,11 +1811,11 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_ListObjAppendElement(interp, obj, Tcl_NewStringObj("SQLSTATE", -1)); Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(unpack_sql_state(edata->sqlerrcode), -1)); + Tcl_NewStringObj(unpack_sql_state(edata->sqlerrcode), -1)); Tcl_ListObjAppendElement(interp, obj, Tcl_NewStringObj("condition", -1)); Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(pltcl_get_condition_name(edata->sqlerrcode), -1)); + Tcl_NewStringObj(pltcl_get_condition_name(edata->sqlerrcode), -1)); Tcl_ListObjAppendElement(interp, obj, Tcl_NewStringObj("message", -1)); UTF_BEGIN; @@ -1828,7 +1828,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("detail", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->detail), -1)); + Tcl_NewStringObj(UTF_E2U(edata->detail), -1)); UTF_END; } if (edata->hint) @@ -1846,7 +1846,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("context", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->context), -1)); + Tcl_NewStringObj(UTF_E2U(edata->context), -1)); UTF_END; } if (edata->schema_name) @@ -1855,7 +1855,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("schema", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->schema_name), -1)); + Tcl_NewStringObj(UTF_E2U(edata->schema_name), -1)); UTF_END; } if (edata->table_name) @@ -1864,7 +1864,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("table", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->table_name), -1)); + Tcl_NewStringObj(UTF_E2U(edata->table_name), -1)); UTF_END; } if (edata->column_name) @@ -1873,7 +1873,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("column", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->column_name), -1)); + Tcl_NewStringObj(UTF_E2U(edata->column_name), -1)); UTF_END; } if (edata->datatype_name) @@ -1882,7 +1882,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("datatype", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->datatype_name), -1)); + Tcl_NewStringObj(UTF_E2U(edata->datatype_name), -1)); UTF_END; } if (edata->constraint_name) @@ -1891,7 +1891,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("constraint", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->constraint_name), -1)); + Tcl_NewStringObj(UTF_E2U(edata->constraint_name), -1)); UTF_END; } /* cursorpos is never interesting here; report internal query/pos */ @@ -1901,7 +1901,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("statement", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->internalquery), -1)); + Tcl_NewStringObj(UTF_E2U(edata->internalquery), -1)); UTF_END; } if (edata->internalpos > 0) @@ -1917,7 +1917,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("filename", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->filename), -1)); + Tcl_NewStringObj(UTF_E2U(edata->filename), -1)); UTF_END; } if (edata->lineno > 0) @@ -1933,7 +1933,7 @@ pltcl_construct_errorCode(Tcl_Interp *interp, ErrorData *edata) Tcl_NewStringObj("funcname", -1)); UTF_BEGIN; Tcl_ListObjAppendElement(interp, obj, - Tcl_NewStringObj(UTF_E2U(edata->funcname), -1)); + Tcl_NewStringObj(UTF_E2U(edata->funcname), -1)); UTF_END; } @@ -2038,7 +2038,7 @@ pltcl_argisnull(ClientData cdata, Tcl_Interp *interp, if (fcinfo == NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj("argisnull cannot be used in triggers", -1)); + Tcl_NewStringObj("argisnull cannot be used in triggers", -1)); return TCL_ERROR; } @@ -2091,7 +2091,7 @@ pltcl_returnnull(ClientData cdata, Tcl_Interp *interp, if (fcinfo == NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj("return_null cannot be used in triggers", -1)); + Tcl_NewStringObj("return_null cannot be used in triggers", -1)); return TCL_ERROR; } @@ -2125,7 +2125,7 @@ pltcl_returnnext(ClientData cdata, Tcl_Interp *interp, if (fcinfo == NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj("return_next cannot be used in triggers", -1)); + Tcl_NewStringObj("return_next cannot be used in triggers", -1)); return TCL_ERROR; } @@ -2187,7 +2187,7 @@ pltcl_returnnext(ClientData cdata, Tcl_Interp *interp, elog(ERROR, "wrong result type supplied in return_next"); retval = InputFunctionCall(&prodesc->result_in_func, - utf_u2e((char *) Tcl_GetString(objv[1])), + utf_u2e((char *) Tcl_GetString(objv[1])), prodesc->result_typioparam, -1); tuplestore_putvalues(call_state->tuple_store, call_state->ret_tupdesc, @@ -2322,7 +2322,7 @@ pltcl_SPI_execute(ClientData cdata, Tcl_Interp *interp, if (++i >= objc) { Tcl_SetObjResult(interp, - Tcl_NewStringObj("missing argument to -count or -array", -1)); + Tcl_NewStringObj("missing argument to -count or -array", -1)); return TCL_ERROR; } @@ -2360,7 +2360,7 @@ pltcl_SPI_execute(ClientData cdata, Tcl_Interp *interp, { UTF_BEGIN; spi_rc = SPI_execute(UTF_U2E(Tcl_GetString(objv[query_idx])), - pltcl_current_call_state->prodesc->fn_readonly, count); + pltcl_current_call_state->prodesc->fn_readonly, count); UTF_END; my_rc = pltcl_process_SPI_result(interp, @@ -2695,7 +2695,7 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp, if (i >= objc) { Tcl_SetObjResult(interp, - Tcl_NewStringObj("missing argument to -count or -array", -1)); + Tcl_NewStringObj("missing argument to -count or -array", -1)); return TCL_ERROR; } @@ -2719,7 +2719,7 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp, { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "length of nulls string doesn't match number of arguments", + "length of nulls string doesn't match number of arguments", -1)); return TCL_ERROR; } @@ -2735,7 +2735,7 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp, { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "argument list length doesn't match number of arguments for query" + "argument list length doesn't match number of arguments for query" ,-1)); return TCL_ERROR; } @@ -2753,7 +2753,7 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp, { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "argument list length doesn't match number of arguments for query" + "argument list length doesn't match number of arguments for query" ,-1)); return TCL_ERROR; } @@ -2803,7 +2803,7 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp, { UTF_BEGIN; argvalues[j] = InputFunctionCall(&qdesc->arginfuncs[j], - UTF_U2E(Tcl_GetString(callObjv[j])), + UTF_U2E(Tcl_GetString(callObjv[j])), qdesc->argtypioparams[j], -1); UTF_END; @@ -2814,7 +2814,7 @@ pltcl_SPI_execute_plan(ClientData cdata, Tcl_Interp *interp, * Execute the plan ************************************************************/ spi_rc = SPI_execute_plan(qdesc->plan, argvalues, nulls, - pltcl_current_call_state->prodesc->fn_readonly, + pltcl_current_call_state->prodesc->fn_readonly, count); my_rc = pltcl_process_SPI_result(interp, @@ -3046,7 +3046,7 @@ pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc) UTF_END; UTF_BEGIN; Tcl_ListObjAppendElement(NULL, retobj, - Tcl_NewStringObj(UTF_E2U(outputstr), -1)); + Tcl_NewStringObj(UTF_E2U(outputstr), -1)); UTF_END; pfree(outputstr); } @@ -3097,7 +3097,7 @@ pltcl_build_tuple_result(Tcl_Interp *interp, Tcl_Obj **kvObjv, int kvObjc, if (kvObjc % 2 != 0) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("column name/value list must have even number of elements"))); + errmsg("column name/value list must have even number of elements"))); for (i = 0; i < kvObjc; i += 2) { diff --git a/src/port/chklocale.c b/src/port/chklocale.c index c6ec929702..c357fed6dc 100644 --- a/src/port/chklocale.c +++ b/src/port/chklocale.c @@ -290,7 +290,7 @@ pg_codepage_to_encoding(UINT cp) return -1; } #endif -#endif /* WIN32 */ +#endif /* WIN32 */ #if (defined(HAVE_LANGINFO_H) && defined(CODESET)) || defined(WIN32) @@ -435,4 +435,4 @@ pg_get_encoding_from_locale(const char *ctype, bool write_message) return PG_SQL_ASCII; } -#endif /* (HAVE_LANGINFO_H && CODESET) || WIN32 */ +#endif /* (HAVE_LANGINFO_H && CODESET) || WIN32 */ diff --git a/src/port/crypt.c b/src/port/crypt.c index 6a902ef0fc..786161ff35 100644 --- a/src/port/crypt.c +++ b/src/port/crypt.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)crypt.c 8.1.1.1 (Berkeley) 8/18/93"; #else __RCSID("$NetBSD: crypt.c,v 1.18 2001/03/01 14:37:35 wiz Exp $"); #endif -#endif /* not lint */ +#endif /* not lint */ #include "c.h" @@ -287,7 +287,7 @@ typedef union { C_block tblk; permute(cpp,&tblk,p,8); LOAD (d,d0,d1,tblk); } #define PERM3264(d,d0,d1,cpp,p) \ { C_block tblk; permute(cpp,&tblk,p,4); LOAD (d,d0,d1,tblk); } -#endif /* LARGEDATA */ +#endif /* LARGEDATA */ STATIC init_des(void); STATIC init_perm(C_block[64 / CHUNKBITS][1 << CHUNKBITS], unsigned char[64], int, int); @@ -307,6 +307,7 @@ unsigned char *cp; C_block *out; C_block *p; int chars_in; + { DCL_BLOCK(D, D0, D1); C_block *tp; @@ -325,12 +326,12 @@ int chars_in; } while (--chars_in > 0); STORE(D, D0, D1, *out); } -#endif /* LARGEDATA */ +#endif /* LARGEDATA */ /* ===== (mostly) Standard DES Tables ==================== */ -static const unsigned char IP[] = { /* initial permutation */ +static const unsigned char IP[] = { /* initial permutation */ 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, @@ -343,7 +344,7 @@ static const unsigned char IP[] = { /* initial permutation */ /* The final permutation is the inverse of IP - no table is necessary */ -static const unsigned char ExpandTr[] = { /* expansion operation */ +static const unsigned char ExpandTr[] = { /* expansion operation */ 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, @@ -366,7 +367,7 @@ static const unsigned char PC1[] = { /* permuted choice table 1 */ 21, 13, 5, 28, 20, 12, 4, }; -static const unsigned char Rotates[] = { /* PC1 rotation schedule */ +static const unsigned char Rotates[] = { /* PC1 rotation schedule */ 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, }; @@ -456,7 +457,7 @@ static const unsigned char itoa64[] = /* 0..63 => ascii-64 */ /* ===== Tables that are initialized at run time ==================== */ -static unsigned char a64toi[128]; /* ascii-64 => 0..63 */ +static unsigned char a64toi[128]; /* ascii-64 => 0..63 */ /* Initial key schedule permutation */ static C_block PC1ROT[64 / CHUNKBITS][1 << CHUNKBITS]; @@ -481,7 +482,7 @@ static C_block constdatablock; /* encryption constant */ static char cryptresult[1 + 4 + 4 + 11 + 1]; /* encrypted result */ extern char *__md5crypt(const char *, const char *); /* XXX */ -extern char *__bcrypt(const char *, const char *); /* XXX */ +extern char *__bcrypt(const char *, const char *); /* XXX */ /* @@ -523,7 +524,7 @@ const char *setting; key++; keyblock.b[i] = t; } - if (des_setkey((char *) keyblock.b)) /* also initializes "a64toi" */ + if (des_setkey((char *) keyblock.b)) /* also initializes "a64toi" */ return (NULL); encp = &cryptresult[0]; @@ -714,7 +715,7 @@ int num_iter; R1 = (R1 >> 1) & 0x55555555L; L1 = R0 | R1; /* L1 is the odd-numbered input bits */ STORE(L, L0, L1, B); - PERM3264(L, L0, L1, B.b, (C_block *) IE3264); /* even bits */ + PERM3264(L, L0, L1, B.b, (C_block *) IE3264); /* even bits */ PERM3264(R, R0, R1, B.b + 4, (C_block *) IE3264); /* odd bits */ if (num_iter >= 0) @@ -977,6 +978,7 @@ C_block perm[64 / CHUNKBITS][1 << CHUNKBITS]; unsigned char p[64]; int chars_in, chars_out; + { int i, j, @@ -1068,6 +1070,7 @@ prtab(s, t, num_rows) char *s; unsigned char *t; int num_rows; + { int i, j; diff --git a/src/port/dirent.c b/src/port/dirent.c index 269f7429f8..2bab7938a0 100644 --- a/src/port/dirent.c +++ b/src/port/dirent.c @@ -64,8 +64,7 @@ opendir(const char *dirname) strcpy(d->dirname, dirname); if (d->dirname[strlen(d->dirname) - 1] != '/' && d->dirname[strlen(d->dirname) - 1] != '\\') - strcat(d->dirname, "\\"); /* Append backslash if not already - * there */ + strcat(d->dirname, "\\"); /* Append backslash if not already there */ strcat(d->dirname, "*"); /* Search for entries named anything */ d->handle = INVALID_HANDLE_VALUE; d->ret.d_ino = 0; /* no inodes on win32 */ @@ -102,8 +101,7 @@ readdir(DIR *d) return NULL; } } - strcpy(d->ret.d_name, fd.cFileName); /* Both strings are MAX_PATH - * long */ + strcpy(d->ret.d_name, fd.cFileName); /* Both strings are MAX_PATH long */ d->ret.d_namlen = strlen(d->ret.d_name); return &d->ret; diff --git a/src/port/dirmod.c b/src/port/dirmod.c index bf34835941..eac59bdfda 100644 --- a/src/port/dirmod.c +++ b/src/port/dirmod.c @@ -121,10 +121,10 @@ pgunlink(const char *path) /* We undefined these above; now redefine for possible use below */ #define rename(from, to) pgrename(from, to) #define unlink(path) pgunlink(path) -#endif /* defined(WIN32) || defined(__CYGWIN__) */ +#endif /* defined(WIN32) || defined(__CYGWIN__) */ -#if defined(WIN32) && !defined(__CYGWIN__) /* Cygwin has its own symlinks */ +#if defined(WIN32) && !defined(__CYGWIN__) /* Cygwin has its own symlinks */ /* * pgsymlink support: @@ -168,7 +168,7 @@ pgsymlink(const char *oldpath, const char *newpath) CreateDirectory(newpath, 0); dirhandle = CreateFile(newpath, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, - FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, 0); + FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, 0); if (dirhandle == INVALID_HANDLE_VALUE) return -1; @@ -198,9 +198,9 @@ pgsymlink(const char *oldpath, const char *newpath) * we use our own definition */ if (!DeviceIoControl(dirhandle, - CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS), + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS), reparseBuf, - reparseBuf->ReparseDataLength + REPARSE_JUNCTION_DATA_BUFFER_HEADER_SIZE, + reparseBuf->ReparseDataLength + REPARSE_JUNCTION_DATA_BUFFER_HEADER_SIZE, 0, 0, &len, 0)) { LPSTR msg; @@ -352,7 +352,7 @@ pgwin32_is_junction(const char *path) } return ((attr & FILE_ATTRIBUTE_REPARSE_POINT) == FILE_ATTRIBUTE_REPARSE_POINT); } -#endif /* defined(WIN32) && !defined(__CYGWIN__) */ +#endif /* defined(WIN32) && !defined(__CYGWIN__) */ #if defined(WIN32) && !defined(__CYGWIN__) @@ -365,7 +365,7 @@ pgwin32_is_junction(const char *path) * to update this field. */ int -pgwin32_safestat(const char *path, struct stat * buf) +pgwin32_safestat(const char *path, struct stat *buf) { int r; WIN32_FILE_ATTRIBUTE_DATA attr; diff --git a/src/port/getaddrinfo.c b/src/port/getaddrinfo.c index c0e4b33e20..e5b5702c79 100644 --- a/src/port/getaddrinfo.c +++ b/src/port/getaddrinfo.c @@ -40,17 +40,17 @@ * Here we need to declare what the function pointers look like */ typedef int (__stdcall * getaddrinfo_ptr_t) (const char *nodename, - const char *servname, - const struct addrinfo * hints, - struct addrinfo ** res); + const char *servname, + const struct addrinfo *hints, + struct addrinfo **res); -typedef void (__stdcall * freeaddrinfo_ptr_t) (struct addrinfo * ai); +typedef void (__stdcall * freeaddrinfo_ptr_t) (struct addrinfo *ai); -typedef int (__stdcall * getnameinfo_ptr_t) (const struct sockaddr * sa, - int salen, - char *host, int hostlen, - char *serv, int servlen, - int flags); +typedef int (__stdcall * getnameinfo_ptr_t) (const struct sockaddr *sa, + int salen, + char *host, int hostlen, + char *serv, int servlen, + int flags); /* static pointers to the native routines, so we only do the lookup once. */ static getaddrinfo_ptr_t getaddrinfo_ptr = NULL; @@ -99,7 +99,7 @@ haveNativeWindowsIPv6routines(void) getaddrinfo_ptr = (getaddrinfo_ptr_t) GetProcAddress(hLibrary, "getaddrinfo"); freeaddrinfo_ptr = (freeaddrinfo_ptr_t) GetProcAddress(hLibrary, - "freeaddrinfo"); + "freeaddrinfo"); getnameinfo_ptr = (getnameinfo_ptr_t) GetProcAddress(hLibrary, "getnameinfo"); @@ -135,8 +135,8 @@ haveNativeWindowsIPv6routines(void) */ int getaddrinfo(const char *node, const char *service, - const struct addrinfo * hintp, - struct addrinfo ** res) + const struct addrinfo *hintp, + struct addrinfo **res) { struct addrinfo *ai; struct sockaddr_in sin, @@ -262,7 +262,7 @@ getaddrinfo(const char *node, const char *service, void -freeaddrinfo(struct addrinfo * res) +freeaddrinfo(struct addrinfo *res) { if (res) { @@ -328,7 +328,7 @@ gai_strerror(int errcode) case EAI_MEMORY: return "Not enough memory"; #endif -#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME /* MSVC/WIN64 duplicate */ +#if defined(EAI_NODATA) && EAI_NODATA != EAI_NONAME /* MSVC/WIN64 duplicate */ case EAI_NODATA: return "No host data of that type was found"; #endif @@ -343,7 +343,7 @@ gai_strerror(int errcode) default: return "Unknown server error"; } -#endif /* HAVE_HSTRERROR */ +#endif /* HAVE_HSTRERROR */ } /* @@ -354,7 +354,7 @@ gai_strerror(int errcode) * - No IPv6 support. */ int -getnameinfo(const struct sockaddr * sa, int salen, +getnameinfo(const struct sockaddr *sa, int salen, char *node, int nodelen, char *service, int servicelen, int flags) { diff --git a/src/port/getopt.c b/src/port/getopt.c index f1ad93d7d6..10f4228d7c 100644 --- a/src/port/getopt.c +++ b/src/port/getopt.c @@ -36,7 +36,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; -#endif /* LIBC_SCCS and not lint */ +#endif /* LIBC_SCCS and not lint */ /* @@ -69,7 +69,7 @@ char *optarg; /* argument associated with option */ * returning -1.) */ int -getopt(int nargc, char *const * nargv, const char *ostr) +getopt(int nargc, char *const *nargv, const char *ostr) { static char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ diff --git a/src/port/getopt_long.c b/src/port/getopt_long.c index aa5b7319fd..ff379db29b 100644 --- a/src/port/getopt_long.c +++ b/src/port/getopt_long.c @@ -56,7 +56,7 @@ int getopt_long(int argc, char *const argv[], const char *optstring, - const struct option * longopts, int *longindex) + const struct option *longopts, int *longindex) { static char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ @@ -119,7 +119,7 @@ getopt_long(int argc, char *const argv[], if (opterr && has_arg == required_argument) fprintf(stderr, - "%s: option requires an argument -- %s\n", + "%s: option requires an argument -- %s\n", argv[0], place); place = EMSG; diff --git a/src/port/getrusage.c b/src/port/getrusage.c index 71fce75722..d029fc2c76 100644 --- a/src/port/getrusage.c +++ b/src/port/getrusage.c @@ -28,7 +28,7 @@ */ int -getrusage(int who, struct rusage * rusage) +getrusage(int who, struct rusage *rusage) { #ifdef WIN32 FILETIME starttime; @@ -104,7 +104,7 @@ getrusage(int who, struct rusage * rusage) rusage->ru_utime.tv_usec = TICK_TO_USEC(u, tick_rate); rusage->ru_stime.tv_sec = TICK_TO_SEC(s, tick_rate); rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate); -#endif /* WIN32 */ +#endif /* WIN32 */ return 0; } diff --git a/src/port/gettimeofday.c b/src/port/gettimeofday.c index af1157134b..e11f068052 100644 --- a/src/port/gettimeofday.c +++ b/src/port/gettimeofday.c @@ -45,7 +45,7 @@ static const unsigned __int64 epoch = UINT64CONST(116444736000000000); * signature, so we can just store a pointer to whichever we find. This * is the pointer's type. */ -typedef VOID(WINAPI * PgGetSystemTimeFn) (LPFILETIME); +typedef VOID(WINAPI * PgGetSystemTimeFn) (LPFILETIME); /* One-time initializer function, must match that signature. */ static void WINAPI init_gettimeofday(LPFILETIME lpSystemTimeAsFileTime); @@ -75,8 +75,8 @@ init_gettimeofday(LPFILETIME lpSystemTimeAsFileTime) * version and development SDK specific... */ pg_get_system_time = (PgGetSystemTimeFn) GetProcAddress( - GetModuleHandle(TEXT("kernel32.dll")), - "GetSystemTimePreciseAsFileTime"); + GetModuleHandle(TEXT("kernel32.dll")), + "GetSystemTimePreciseAsFileTime"); if (pg_get_system_time == NULL) { /* @@ -102,7 +102,7 @@ init_gettimeofday(LPFILETIME lpSystemTimeAsFileTime) * elapsed_time(). */ int -gettimeofday(struct timeval * tp, struct timezone * tzp) +gettimeofday(struct timeval *tp, struct timezone *tzp) { FILETIME file_time; ULARGE_INTEGER ularge; diff --git a/src/port/inet_aton.c b/src/port/inet_aton.c index 27e8aaa4ec..68efd4723e 100644 --- a/src/port/inet_aton.c +++ b/src/port/inet_aton.c @@ -51,7 +51,7 @@ * cannot distinguish between failure and a local broadcast address. */ int -inet_aton(const char *cp, struct in_addr * addr) +inet_aton(const char *cp, struct in_addr *addr) { unsigned int val; int base, @@ -120,22 +120,22 @@ inet_aton(const char *cp, struct in_addr * addr) switch (n) { - case 1: /* a -- 32 bits */ + case 1: /* a -- 32 bits */ break; - case 2: /* a.b -- 8.24 bits */ + case 2: /* a.b -- 8.24 bits */ if (val > 0xffffff) return 0; val |= parts[0] << 24; break; - case 3: /* a.b.c -- 8.8.16 bits */ + case 3: /* a.b.c -- 8.8.16 bits */ if (val > 0xffff) return 0; val |= (parts[0] << 24) | (parts[1] << 16); break; - case 4: /* a.b.c.d -- 8.8.8.8 bits */ + case 4: /* a.b.c.d -- 8.8.8.8 bits */ if (val > 0xff) return 0; val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); diff --git a/src/port/inet_net_ntop.c b/src/port/inet_net_ntop.c index cebcda0e61..f27fda96ca 100644 --- a/src/port/inet_net_ntop.c +++ b/src/port/inet_net_ntop.c @@ -258,8 +258,8 @@ inet_net_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size) *tp++ = ':'; /* Is this address an encapsulated IPv4? */ if (i == 6 && best.base == 0 && (best.len == 6 || - (best.len == 7 && words[7] != 0x0001) || - (best.len == 5 && words[5] == 0xffff))) + (best.len == 7 && words[7] != 0x0001) || + (best.len == 5 && words[5] == 0xffff))) { int n; diff --git a/src/port/mkdtemp.c b/src/port/mkdtemp.c index f6316562e8..54844cb2f5 100644 --- a/src/port/mkdtemp.c +++ b/src/port/mkdtemp.c @@ -66,7 +66,7 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: gettemp.c,v 1.17 2014/01/21 19:09:48 seanb Exp $"); #endif -#endif /* LIBC_SCCS and not lint */ +#endif /* LIBC_SCCS and not lint */ #endif #include <sys/types.h> @@ -207,7 +207,7 @@ GETTEMP(char *path, int *doopen, int domkdir) if (isdigit((unsigned char) *trv)) *trv = 'a'; else - ++* trv; + ++*trv; break; } } @@ -215,7 +215,7 @@ GETTEMP(char *path, int *doopen, int domkdir) /* NOTREACHED */ } -#endif /* !HAVE_NBTOOL_CONFIG_H || !HAVE_MKSTEMP || +#endif /* !HAVE_NBTOOL_CONFIG_H || !HAVE_MKSTEMP || * !HAVE_MKDTEMP */ @@ -265,7 +265,7 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93"; #else __RCSID("$NetBSD: mkdtemp.c,v 1.11 2012/03/15 18:22:30 christos Exp $"); #endif -#endif /* LIBC_SCCS and not lint */ +#endif /* LIBC_SCCS and not lint */ #if HAVE_NBTOOL_CONFIG_H #define GETTEMP __nbcompat_gettemp @@ -290,4 +290,4 @@ mkdtemp(char *path) return GETTEMP(path, NULL, 1) ? path : NULL; } -#endif /* !HAVE_NBTOOL_CONFIG_H || !HAVE_MKDTEMP */ +#endif /* !HAVE_NBTOOL_CONFIG_H || !HAVE_MKDTEMP */ diff --git a/src/port/open.c b/src/port/open.c index aa31342261..17a7145ad9 100644 --- a/src/port/open.c +++ b/src/port/open.c @@ -69,7 +69,7 @@ pgwin32_open(const char *fileName, int fileFlags,...) assert((fileFlags & ((O_RDONLY | O_WRONLY | O_RDWR) | O_APPEND | (O_RANDOM | O_SEQUENTIAL | O_TEMPORARY) | _O_SHORT_LIVED | O_DSYNC | O_DIRECT | - (O_CREAT | O_TRUNC | O_EXCL) | (O_TEXT | O_BINARY))) == fileFlags); + (O_CREAT | O_TRUNC | O_EXCL) | (O_TEXT | O_BINARY))) == fileFlags); sa.nLength = sizeof(sa); sa.bInheritHandle = TRUE; @@ -77,19 +77,19 @@ pgwin32_open(const char *fileName, int fileFlags,...) while ((h = CreateFile(fileName, /* cannot use O_RDONLY, as it == 0 */ - (fileFlags & O_RDWR) ? (GENERIC_WRITE | GENERIC_READ) : - ((fileFlags & O_WRONLY) ? GENERIC_WRITE : GENERIC_READ), + (fileFlags & O_RDWR) ? (GENERIC_WRITE | GENERIC_READ) : + ((fileFlags & O_WRONLY) ? GENERIC_WRITE : GENERIC_READ), /* These flags allow concurrent rename/unlink */ - (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE), + (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE), &sa, openFlagsToCreateFileFlags(fileFlags), FILE_ATTRIBUTE_NORMAL | - ((fileFlags & O_RANDOM) ? FILE_FLAG_RANDOM_ACCESS : 0) | - ((fileFlags & O_SEQUENTIAL) ? FILE_FLAG_SEQUENTIAL_SCAN : 0) | - ((fileFlags & _O_SHORT_LIVED) ? FILE_ATTRIBUTE_TEMPORARY : 0) | - ((fileFlags & O_TEMPORARY) ? FILE_FLAG_DELETE_ON_CLOSE : 0) | - ((fileFlags & O_DIRECT) ? FILE_FLAG_NO_BUFFERING : 0) | - ((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0), + ((fileFlags & O_RANDOM) ? FILE_FLAG_RANDOM_ACCESS : 0) | + ((fileFlags & O_SEQUENTIAL) ? FILE_FLAG_SEQUENTIAL_SCAN : 0) | + ((fileFlags & _O_SHORT_LIVED) ? FILE_ATTRIBUTE_TEMPORARY : 0) | + ((fileFlags & O_TEMPORARY) ? FILE_FLAG_DELETE_ON_CLOSE : 0) | + ((fileFlags & O_DIRECT) ? FILE_FLAG_NO_BUFFERING : 0) | + ((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0), NULL)) == INVALID_HANDLE_VALUE) { /* diff --git a/src/port/path.c b/src/port/path.c index 46f20b1ef8..2578393624 100644 --- a/src/port/path.c +++ b/src/port/path.c @@ -475,7 +475,7 @@ get_progname(const char *argv0) #if defined(__CYGWIN__) || defined(WIN32) /* strip ".exe" suffix, regardless of case */ if (strlen(progname) > sizeof(EXE) - 1 && - pg_strcasecmp(progname + strlen(progname) - (sizeof(EXE) - 1), EXE) == 0) + pg_strcasecmp(progname + strlen(progname) - (sizeof(EXE) - 1), EXE) == 0) progname[strlen(progname) - (sizeof(EXE) - 1)] = '\0'; #endif diff --git a/src/port/pg_crc32c_sb8.c b/src/port/pg_crc32c_sb8.c index eff7043202..dfd6cd9f49 100644 --- a/src/port/pg_crc32c_sb8.c +++ b/src/port/pg_crc32c_sb8.c @@ -1165,5 +1165,5 @@ static const uint32 pg_crc32c_table[8][256] = { 0xA1354CE5, 0x864870AC, 0xEFCF3477, 0xC8B2083E, 0xCCB751C4, 0xEBCA6D8D, 0x824D2956, 0xA530151F } -#endif /* WORDS_BIGENDIAN */ +#endif /* WORDS_BIGENDIAN */ }; diff --git a/src/port/pg_crc32c_sse42.c b/src/port/pg_crc32c_sse42.c index 75b4d96c69..d698124121 100644 --- a/src/port/pg_crc32c_sse42.c +++ b/src/port/pg_crc32c_sse42.c @@ -55,7 +55,7 @@ pg_comp_crc32c_sse42(pg_crc32c crc, const void *data, size_t len) crc = _mm_crc32_u32(crc, *((const unsigned int *) p)); p += 4; } -#endif /* __x86_64__ */ +#endif /* __x86_64__ */ /* Process any remaining bytes one at a time. */ while (p < pend) diff --git a/src/port/pgsleep.c b/src/port/pgsleep.c index 9f01b73b0f..f2db68a33d 100644 --- a/src/port/pgsleep.c +++ b/src/port/pgsleep.c @@ -60,4 +60,4 @@ pg_usleep(long microsec) } } -#endif /* defined(FRONTEND) || !defined(WIN32) */ +#endif /* defined(FRONTEND) || !defined(WIN32) */ diff --git a/src/port/pqsignal.c b/src/port/pqsignal.c index e7e445101c..f176387ca2 100644 --- a/src/port/pqsignal.c +++ b/src/port/pqsignal.c @@ -85,6 +85,6 @@ pqsignal_no_restart(int signo, pqsigfunc func) return oact.sa_handler; } -#endif /* !WIN32 */ +#endif /* !WIN32 */ -#endif /* !defined(WIN32) || defined(FRONTEND) */ +#endif /* !defined(WIN32) || defined(FRONTEND) */ diff --git a/src/port/snprintf.c b/src/port/snprintf.c index 62b23b0c1f..231e5d6bdb 100644 --- a/src/port/snprintf.c +++ b/src/port/snprintf.c @@ -364,7 +364,7 @@ nextch1: goto nextch1; case '*': if (afterstar) - have_non_dollar = true; /* multiple stars */ + have_non_dollar = true; /* multiple stars */ afterstar = true; accum = 0; goto nextch1; diff --git a/src/port/thread.c b/src/port/thread.c index b54c871b00..a3f37b1237 100644 --- a/src/port/thread.c +++ b/src/port/thread.c @@ -92,8 +92,8 @@ pqStrerror(int errnum, char *strerrbuf, size_t buflen) */ #ifndef WIN32 int -pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer, - size_t buflen, struct passwd ** result) +pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer, + size_t buflen, struct passwd **result) { #if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(HAVE_GETPWUID_R) return getpwuid_r(uid, resultbuf, buffer, buflen, result); @@ -115,9 +115,9 @@ pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer, #ifndef HAVE_GETADDRINFO int pqGethostbyname(const char *name, - struct hostent * resultbuf, + struct hostent *resultbuf, char *buffer, size_t buflen, - struct hostent ** result, + struct hostent **result, int *herrno) { #if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(HAVE_GETHOSTBYNAME_R) diff --git a/src/port/win32error.c b/src/port/win32error.c index 40655962a8..fe07f6e0a2 100644 --- a/src/port/win32error.c +++ b/src/port/win32error.c @@ -21,7 +21,7 @@ static const struct { DWORD winerr; int doserr; -} doserrors[] = +} doserrors[] = { { diff --git a/src/port/win32security.c b/src/port/win32security.c index 93739e80b9..bb9d034a01 100644 --- a/src/port/win32security.c +++ b/src/port/win32security.c @@ -128,7 +128,7 @@ pgwin32_is_service(void) /* First check for LocalSystem */ if (!AllocateAndInitializeSid(&NtAuthority, 1, - SECURITY_LOCAL_SYSTEM_RID, 0, 0, 0, 0, 0, 0, 0, + SECURITY_LOCAL_SYSTEM_RID, 0, 0, 0, 0, 0, 0, 0, &LocalSystemSid)) { fprintf(stderr, "could not get SID for local system account\n"); diff --git a/src/port/win32setlocale.c b/src/port/win32setlocale.c index cbf109836b..c4da4a8f92 100644 --- a/src/port/win32setlocale.c +++ b/src/port/win32setlocale.c @@ -104,7 +104,7 @@ static const struct locale_map locale_map_result[] = { #define MAX_LOCALE_NAME_LEN 100 static const char * -map_locale(const struct locale_map * map, const char *locale) +map_locale(const struct locale_map *map, const char *locale) { static char aliasbuf[MAX_LOCALE_NAME_LEN]; int i; diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c index 3af5a706ce..ba8082c980 100644 --- a/src/test/isolation/isolationtester.c +++ b/src/test/isolation/isolationtester.c @@ -224,7 +224,7 @@ main(int argc, char **argv) */ initPQExpBuffer(&wait_query); appendPQExpBufferStr(&wait_query, - "SELECT pg_catalog.pg_isolation_test_session_is_blocked($1, '{"); + "SELECT pg_catalog.pg_isolation_test_session_is_blocked($1, '{"); /* The spec syntax requires at least one session; assume that here. */ appendPQExpBufferStr(&wait_query, backend_pids[1]); for (i = 2; i < nconns; i++) @@ -841,7 +841,7 @@ try_complete_step(Step *step, int flags) const char *sev = PQresultErrorField(res, PG_DIAG_SEVERITY); const char *msg = PQresultErrorField(res, - PG_DIAG_MESSAGE_PRIMARY); + PG_DIAG_MESSAGE_PRIMARY); if (sev && msg) step->errormsg = psprintf("%s: %s", sev, msg); diff --git a/src/test/isolation/isolationtester.h b/src/test/isolation/isolationtester.h index a15d5be897..1f28272d65 100644 --- a/src/test/isolation/isolationtester.h +++ b/src/test/isolation/isolationtester.h @@ -60,4 +60,4 @@ extern int spec_yyparse(void); extern int spec_yylex(void); extern void spec_yyerror(const char *str); -#endif /* ISOLATIONTESTER_H */ +#endif /* ISOLATIONTESTER_H */ diff --git a/src/test/modules/test_shm_mq/setup.c b/src/test/modules/test_shm_mq/setup.c index 06c49bdb40..3ae9018360 100644 --- a/src/test/modules/test_shm_mq/setup.c +++ b/src/test/modules/test_shm_mq/setup.c @@ -231,7 +231,7 @@ setup_background_workers(int nworkers, dsm_segment *seg) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_RESOURCES), errmsg("could not register background process"), - errhint("You may need to increase max_worker_processes."))); + errhint("You may need to increase max_worker_processes."))); ++wstate->nworkers; } diff --git a/src/test/modules/test_shm_mq/test.c b/src/test/modules/test_shm_mq/test.c index ea3657d5f0..7a6ad23f75 100644 --- a/src/test/modules/test_shm_mq/test.c +++ b/src/test/modules/test_shm_mq/test.c @@ -218,8 +218,8 @@ test_shm_mq_pipelined(PG_FUNCTION_ARGS) if (send_count != receive_count) ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR), - errmsg("message sent %d times, but received %d times", - send_count, receive_count))); + errmsg("message sent %d times, but received %d times", + send_count, receive_count))); break; } diff --git a/src/test/modules/test_shm_mq/worker.c b/src/test/modules/test_shm_mq/worker.c index f8aef263f7..e7e29f89c2 100644 --- a/src/test/modules/test_shm_mq/worker.c +++ b/src/test/modules/test_shm_mq/worker.c @@ -85,7 +85,7 @@ test_shm_mq_main(Datum main_arg) if (toc == NULL) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("bad magic number in dynamic shared memory segment"))); + errmsg("bad magic number in dynamic shared memory segment"))); /* * Acquire a worker number. diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c index 553baf0045..12c8cd5774 100644 --- a/src/test/modules/worker_spi/worker_spi.c +++ b/src/test/modules/worker_spi/worker_spi.c @@ -137,11 +137,11 @@ initialize_worker_spi(worktable *table) appendStringInfo(&buf, "CREATE SCHEMA \"%s\" " "CREATE TABLE \"%s\" (" - " type text CHECK (type IN ('total', 'delta')), " + " type text CHECK (type IN ('total', 'delta')), " " value integer)" - "CREATE UNIQUE INDEX \"%s_unique_total\" ON \"%s\" (type) " + "CREATE UNIQUE INDEX \"%s_unique_total\" ON \"%s\" (type) " "WHERE type = 'total'", - table->schema, table->name, table->name, table->name); + table->schema, table->name, table->name, table->name); /* set statement start time */ SetCurrentStatementStartTimestamp(); @@ -399,11 +399,11 @@ worker_spi_launch(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_RESOURCES), errmsg("could not start background process"), - errhint("More details may be available in the server log."))); + errhint("More details may be available in the server log."))); if (status == BGWH_POSTMASTER_DIED) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_RESOURCES), - errmsg("cannot start background processes without postmaster"), + errmsg("cannot start background processes without postmaster"), errhint("Kill all remaining database processes and restart the database."))); Assert(status == BGWH_STARTED); diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 42e66edec9..e72c63580d 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -414,6 +414,7 @@ sub init print $conf "restart_after_crash = off\n"; print $conf "log_line_prefix = '%m [%p] %q%a '\n"; print $conf "log_statement = all\n"; + print $conf "wal_retrieve_retry_interval = '500ms'\n"; print $conf "port = $port\n"; if ($params{allows_streaming}) diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl index 266d27c8a2..750e40c3da 100644 --- a/src/test/recovery/t/001_stream_rep.pl +++ b/src/test/recovery/t/001_stream_rep.pl @@ -146,6 +146,20 @@ $node_standby_2->append_conf('postgresql.conf', "wal_receiver_status_interval = 1"); $node_standby_2->restart; +# Wait for given condition on slot's pg_replication_slots row --- useful for +# ensuring we've reached a quiescent condition for reading slot xmins +sub wait_slot_xmins +{ + my ($node, $slot_name, $check_expr) = @_; + + $node->poll_query_until('postgres', qq[ + SELECT $check_expr + FROM pg_catalog.pg_replication_slots + WHERE slot_name = '$slot_name'; + ]); +} + +# Fetch xmin columns from slot's pg_replication_slots row sub get_slot_xmins { my ($node, $slotname) = @_; @@ -156,12 +170,12 @@ sub get_slot_xmins # There's no hot standby feedback and there are no logical slots on either peer # so xmin and catalog_xmin should be null on both slots. my ($xmin, $catalog_xmin) = get_slot_xmins($node_master, $slotname_1); -is($xmin, '', 'non-cascaded slot xmin null with no hs_feedback'); -is($catalog_xmin, '', 'non-cascaded slot xmin null with no hs_feedback'); +is($xmin, '', 'xmin of non-cascaded slot null with no hs_feedback'); +is($catalog_xmin, '', 'catalog xmin of non-cascaded slot null with no hs_feedback'); ($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2); -is($xmin, '', 'cascaded slot xmin null with no hs_feedback'); -is($catalog_xmin, '', 'cascaded slot xmin null with no hs_feedback'); +is($xmin, '', 'xmin of cascaded slot null with no hs_feedback'); +is($catalog_xmin, '', 'catalog xmin of cascaded slot null with no hs_feedback'); # Replication still works? $node_master->safe_psql('postgres', 'CREATE TABLE replayed(val integer);'); @@ -196,15 +210,18 @@ $node_standby_2->safe_psql('postgres', 'ALTER SYSTEM SET hot_standby_feedback = on;'); $node_standby_2->reload; replay_check(); -sleep(2); + +wait_slot_xmins($node_master, $slotname_1, + "xmin IS NOT NULL AND catalog_xmin IS NULL"); ($xmin, $catalog_xmin) = get_slot_xmins($node_master, $slotname_1); -isnt($xmin, '', 'non-cascaded slot xmin non-null with hs feedback'); -is($catalog_xmin, '', 'non-cascaded slot xmin still null with hs_feedback'); +isnt($xmin, '', 'xmin of non-cascaded slot non-null with hs feedback'); +is($catalog_xmin, '', + 'catalog xmin of non-cascaded slot still null with hs_feedback'); ($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2); -isnt($xmin, '', 'cascaded slot xmin non-null with hs feedback'); -is($catalog_xmin, '', 'cascaded slot xmin still null with hs_feedback'); +isnt($xmin, '', 'xmin of cascaded slot non-null with hs feedback'); +is($catalog_xmin, '', 'catalog xmin of cascaded slot still null with hs_feedback'); note "doing some work to advance xmin"; for my $i (10000 .. 11000) @@ -216,15 +233,15 @@ $node_master->safe_psql('postgres', 'CHECKPOINT;'); my ($xmin2, $catalog_xmin2) = get_slot_xmins($node_master, $slotname_1); note "new xmin $xmin2, old xmin $xmin"; -isnt($xmin2, $xmin, 'non-cascaded slot xmin with hs feedback has changed'); +isnt($xmin2, $xmin, 'xmin of non-cascaded slot with hs feedback has changed'); is($catalog_xmin2, '', - 'non-cascaded slot xmin still null with hs_feedback unchanged'); + 'catalog xmin of non-cascaded slot still null with hs_feedback unchanged'); ($xmin2, $catalog_xmin2) = get_slot_xmins($node_standby_1, $slotname_2); note "new xmin $xmin2, old xmin $xmin"; -isnt($xmin2, $xmin, 'cascaded slot xmin with hs feedback has changed'); +isnt($xmin2, $xmin, 'xmin of cascaded slot with hs feedback has changed'); is($catalog_xmin2, '', - 'cascaded slot xmin still null with hs_feedback unchanged'); + 'catalog xmin of cascaded slot still null with hs_feedback unchanged'); note "disabling hot_standby_feedback"; @@ -236,16 +253,22 @@ $node_standby_2->safe_psql('postgres', 'ALTER SYSTEM SET hot_standby_feedback = off;'); $node_standby_2->reload; replay_check(); -sleep(2); + +wait_slot_xmins($node_master, $slotname_1, + "xmin IS NULL AND catalog_xmin IS NULL"); ($xmin, $catalog_xmin) = get_slot_xmins($node_master, $slotname_1); -is($xmin, '', 'non-cascaded slot xmin null with hs feedback reset'); +is($xmin, '', 'xmin of non-cascaded slot null with hs feedback reset'); is($catalog_xmin, '', - 'non-cascaded slot xmin still null with hs_feedback reset'); + 'catalog xmin of non-cascaded slot still null with hs_feedback reset'); + +wait_slot_xmins($node_standby_1, $slotname_2, + "xmin IS NULL AND catalog_xmin IS NULL"); ($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2); -is($xmin, '', 'cascaded slot xmin null with hs feedback reset'); -is($catalog_xmin, '', 'cascaded slot xmin still null with hs_feedback reset'); +is($xmin, '', 'xmin of cascaded slot null with hs feedback reset'); +is($catalog_xmin, '', + 'catalog xmin of cascaded slot still null with hs_feedback reset'); note "re-enabling hot_standby_feedback and disabling while stopped"; $node_standby_2->safe_psql('postgres', @@ -260,11 +283,13 @@ $node_standby_2->safe_psql('postgres', $node_standby_2->stop; ($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2); -isnt($xmin, '', 'cascaded slot xmin non-null with postgres shut down'); +isnt($xmin, '', 'xmin of cascaded slot non-null with postgres shut down'); # Xmin from a previous run should be cleared on startup. $node_standby_2->start; +wait_slot_xmins($node_standby_1, $slotname_2, "xmin IS NULL"); + ($xmin, $catalog_xmin) = get_slot_xmins($node_standby_1, $slotname_2); is($xmin, '', - 'cascaded slot xmin reset after startup with hs feedback reset'); + 'xmin of cascaded slot reset after startup with hs feedback reset'); diff --git a/src/test/regress/expected/create_type.out b/src/test/regress/expected/create_type.out index 7bdad4e9bb..5886a1f37f 100644 --- a/src/test/regress/expected/create_type.out +++ b/src/test/regress/expected/create_type.out @@ -115,6 +115,31 @@ CREATE TYPE not_existing_type (INPUT = array_in, ELEMENT = int, INTERNALLENGTH = 32); ERROR: function array_out(not_existing_type) does not exist +-- Check dependency transfer of opaque functions when creating a new type +CREATE FUNCTION base_fn_in(cstring) RETURNS opaque AS 'boolin' + LANGUAGE internal IMMUTABLE STRICT; +CREATE FUNCTION base_fn_out(opaque) RETURNS opaque AS 'boolout' + LANGUAGE internal IMMUTABLE STRICT; +CREATE TYPE base_type(INPUT = base_fn_in, OUTPUT = base_fn_out); +WARNING: changing argument type of function base_fn_out from "opaque" to base_type +WARNING: changing return type of function base_fn_in from opaque to base_type +WARNING: changing return type of function base_fn_out from opaque to cstring +DROP FUNCTION base_fn_in(cstring); -- error +ERROR: cannot drop function base_fn_in(cstring) because other objects depend on it +DETAIL: type base_type depends on function base_fn_in(cstring) +function base_fn_out(base_type) depends on type base_type +HINT: Use DROP ... CASCADE to drop the dependent objects too. +DROP FUNCTION base_fn_out(opaque); -- error +ERROR: function base_fn_out(opaque) does not exist +DROP TYPE base_type; -- error +ERROR: cannot drop type base_type because other objects depend on it +DETAIL: function base_fn_out(base_type) depends on type base_type +function base_fn_in(cstring) depends on type base_type +HINT: Use DROP ... CASCADE to drop the dependent objects too. +DROP TYPE base_type CASCADE; +NOTICE: drop cascades to 2 other objects +DETAIL: drop cascades to function base_fn_out(base_type) +drop cascades to function base_fn_in(cstring) -- Check usage of typmod with a user-defined type -- (we have borrowed numeric's typmod functions) CREATE TEMP TABLE mytab (foo widget(42,13,7)); -- should fail diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out index 10a9db40e4..53884191b8 100644 --- a/src/test/regress/expected/join.out +++ b/src/test/regress/expected/join.out @@ -5652,6 +5652,41 @@ SELECT count(*) FROM testr WHERE NOT EXISTS (SELECT * FROM testh WHERE testr.b = -- +-- test that foreign key join estimation performs sanely for outer joins +-- +begin; +create table fkest (a int, b int, c int unique, primary key(a,b)); +create table fkest1 (a int, b int, primary key(a,b)); +insert into fkest select x/10, x%10, x from generate_series(1,1000) x; +insert into fkest1 select x/10, x%10 from generate_series(1,1000) x; +alter table fkest1 + add constraint fkest1_a_b_fkey foreign key (a,b) references fkest; +analyze fkest; +analyze fkest1; +explain (costs off) +select * +from fkest f + left join fkest1 f1 on f.a = f1.a and f.b = f1.b + left join fkest1 f2 on f.a = f2.a and f.b = f2.b + left join fkest1 f3 on f.a = f3.a and f.b = f3.b +where f.c = 1; + QUERY PLAN +------------------------------------------------------------------ + Nested Loop Left Join + -> Nested Loop Left Join + -> Nested Loop Left Join + -> Index Scan using fkest_c_key on fkest f + Index Cond: (c = 1) + -> Index Only Scan using fkest1_pkey on fkest1 f1 + Index Cond: ((a = f.a) AND (b = f.b)) + -> Index Only Scan using fkest1_pkey on fkest1 f2 + Index Cond: ((a = f.a) AND (b = f.b)) + -> Index Only Scan using fkest1_pkey on fkest1 f3 + Index Cond: ((a = f.a) AND (b = f.b)) +(11 rows) + +rollback; +-- -- test planner's ability to mark joins as unique -- create table j1 (id int primary key); diff --git a/src/test/regress/expected/misc_sanity.out b/src/test/regress/expected/misc_sanity.out new file mode 100644 index 0000000000..f02689660b --- /dev/null +++ b/src/test/regress/expected/misc_sanity.out @@ -0,0 +1,78 @@ +-- +-- MISC_SANITY +-- Sanity checks for common errors in making system tables that don't fit +-- comfortably into either opr_sanity or type_sanity. +-- +-- Every test failure in this file should be closely inspected. +-- The description of the failing test should be read carefully before +-- adjusting the expected output. In most cases, the queries should +-- not find *any* matching entries. +-- +-- NB: run this test early, because some later tests create bogus entries. +-- **************** pg_depend **************** +-- Look for illegal values in pg_depend fields. +-- classid/objid can be zero, but only in 'p' entries +SELECT * +FROM pg_depend as d1 +WHERE refclassid = 0 OR refobjid = 0 OR + deptype NOT IN ('a', 'e', 'i', 'n', 'p') OR + (deptype != 'p' AND (classid = 0 OR objid = 0)) OR + (deptype = 'p' AND (classid != 0 OR objid != 0 OR objsubid != 0)); + classid | objid | objsubid | refclassid | refobjid | refobjsubid | deptype +---------+-------+----------+------------+----------+-------------+--------- +(0 rows) + +-- **************** pg_shdepend **************** +-- Look for illegal values in pg_shdepend fields. +-- classid/objid can be zero, but only in 'p' entries +SELECT * +FROM pg_shdepend as d1 +WHERE refclassid = 0 OR refobjid = 0 OR + deptype NOT IN ('a', 'o', 'p', 'r') OR + (deptype != 'p' AND (dbid = 0 OR classid = 0 OR objid = 0)) OR + (deptype = 'p' AND (dbid != 0 OR classid != 0 OR objid != 0 OR objsubid != 0)); + dbid | classid | objid | objsubid | refclassid | refobjid | deptype +------+---------+-------+----------+------------+----------+--------- +(0 rows) + +-- Check each OID-containing system catalog to see if its lowest-numbered OID +-- is pinned. If not, and if that OID was generated during initdb, then +-- perhaps initdb forgot to scan that catalog for pinnable entries. +-- Generally, it's okay for a catalog to be listed in the output of this +-- test if that catalog is scanned by initdb.c's setup_depend() function; +-- whatever OID the test is complaining about must have been added later +-- in initdb, where it intentionally isn't pinned. Legitimate exceptions +-- to that rule are listed in the comments in setup_depend(). +do $$ +declare relnm text; + reloid oid; + shared bool; + lowoid oid; + pinned bool; +begin +for relnm, reloid, shared in + select relname, oid, relisshared from pg_class + where relhasoids and oid < 16384 order by 1 +loop + execute 'select min(oid) from ' || relnm into lowoid; + continue when lowoid is null or lowoid >= 16384; + if shared then + pinned := exists(select 1 from pg_shdepend + where refclassid = reloid and refobjid = lowoid + and deptype = 'p'); + else + pinned := exists(select 1 from pg_depend + where refclassid = reloid and refobjid = lowoid + and deptype = 'p'); + end if; + if not pinned then + raise notice '% contains unpinned initdb-created object(s)', relnm; + end if; +end loop; +end$$; +NOTICE: pg_constraint contains unpinned initdb-created object(s) +NOTICE: pg_conversion contains unpinned initdb-created object(s) +NOTICE: pg_database contains unpinned initdb-created object(s) +NOTICE: pg_extension contains unpinned initdb-created object(s) +NOTICE: pg_rewrite contains unpinned initdb-created object(s) +NOTICE: pg_tablespace contains unpinned initdb-created object(s) diff --git a/src/test/regress/expected/opr_sanity.out b/src/test/regress/expected/opr_sanity.out index 746fc5f130..6af64785ec 100644 --- a/src/test/regress/expected/opr_sanity.out +++ b/src/test/regress/expected/opr_sanity.out @@ -96,6 +96,16 @@ WHERE proiswindow AND (proisagg OR proretset); -----+--------- (0 rows) +-- currently, no built-in functions should be SECURITY DEFINER; +-- this might change in future, but there will probably never be many. +SELECT p1.oid, p1.proname +FROM pg_proc AS p1 +WHERE prosecdef +ORDER BY 1; + oid | proname +-----+--------- +(0 rows) + -- pronargdefaults should be 0 iff proargdefaults is null SELECT p1.oid, p1.proname FROM pg_proc AS p1 diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out index e81919fd8c..50592c63a9 100644 --- a/src/test/regress/expected/publication.out +++ b/src/test/regress/expected/publication.out @@ -21,20 +21,20 @@ ERROR: unrecognized publication parameter: foo CREATE PUBLICATION testpub_xxx WITH (publish = 'cluster, vacuum'); ERROR: unrecognized "publish" value: "cluster" \dRp - List of publications - Name | Owner | Inserts | Updates | Deletes ---------------------+--------------------------+---------+---------+--------- - testpib_ins_trunct | regress_publication_user | t | f | f - testpub_default | regress_publication_user | f | t | f + List of publications + Name | Owner | All tables | Inserts | Updates | Deletes +--------------------+--------------------------+------------+---------+---------+--------- + testpib_ins_trunct | regress_publication_user | f | t | f | f + testpub_default | regress_publication_user | f | f | t | f (2 rows) ALTER PUBLICATION testpub_default SET (publish = 'insert, update, delete'); \dRp - List of publications - Name | Owner | Inserts | Updates | Deletes ---------------------+--------------------------+---------+---------+--------- - testpib_ins_trunct | regress_publication_user | t | f | f - testpub_default | regress_publication_user | t | t | t + List of publications + Name | Owner | All tables | Inserts | Updates | Deletes +--------------------+--------------------------+------------+---------+---------+--------- + testpib_ins_trunct | regress_publication_user | f | t | f | f + testpub_default | regress_publication_user | f | t | t | t (2 rows) --- adding tables @@ -75,6 +75,13 @@ Indexes: Publications: "testpub_foralltables" +\dRp+ testpub_foralltables + Publication testpub_foralltables + All tables | Inserts | Updates | Deletes +------------+---------+---------+--------- + t | t | t | f +(1 row) + DROP TABLE testpub_tbl2; DROP PUBLICATION testpub_foralltables; CREATE TABLE testpub_tbl3 (a int); @@ -82,19 +89,19 @@ CREATE TABLE testpub_tbl3a (b text) INHERITS (testpub_tbl3); CREATE PUBLICATION testpub3 FOR TABLE testpub_tbl3; CREATE PUBLICATION testpub4 FOR TABLE ONLY testpub_tbl3; \dRp+ testpub3 - Publication testpub3 - Inserts | Updates | Deletes ----------+---------+--------- - t | t | t + Publication testpub3 + All tables | Inserts | Updates | Deletes +------------+---------+---------+--------- + f | t | t | t Tables: "public.testpub_tbl3" "public.testpub_tbl3a" \dRp+ testpub4 - Publication testpub4 - Inserts | Updates | Deletes ----------+---------+--------- - t | t | t + Publication testpub4 + All tables | Inserts | Updates | Deletes +------------+---------+---------+--------- + f | t | t | t Tables: "public.testpub_tbl3" @@ -112,10 +119,10 @@ ERROR: relation "testpub_tbl1" is already member of publication "testpub_fortbl CREATE PUBLICATION testpub_fortbl FOR TABLE testpub_tbl1; ERROR: publication "testpub_fortbl" already exists \dRp+ testpub_fortbl - Publication testpub_fortbl - Inserts | Updates | Deletes ----------+---------+--------- - t | t | t + Publication testpub_fortbl + All tables | Inserts | Updates | Deletes +------------+---------+---------+--------- + f | t | t | t Tables: "pub_test.testpub_nopk" "public.testpub_tbl1" @@ -158,10 +165,10 @@ Publications: "testpub_fortbl" \dRp+ testpub_default - Publication testpub_default - Inserts | Updates | Deletes ----------+---------+--------- - t | t | t + Publication testpub_default + All tables | Inserts | Updates | Deletes +------------+---------+---------+--------- + f | t | t | t Tables: "pub_test.testpub_nopk" "public.testpub_tbl1" @@ -203,10 +210,10 @@ DROP TABLE testpub_parted; DROP VIEW testpub_view; DROP TABLE testpub_tbl1; \dRp+ testpub_default - Publication testpub_default - Inserts | Updates | Deletes ----------+---------+--------- - t | t | t + Publication testpub_default + All tables | Inserts | Updates | Deletes +------------+---------+---------+--------- + f | t | t | t (1 row) -- fail - must be owner of publication @@ -216,20 +223,20 @@ ERROR: must be owner of publication testpub_default RESET ROLE; ALTER PUBLICATION testpub_default RENAME TO testpub_foo; \dRp testpub_foo - List of publications - Name | Owner | Inserts | Updates | Deletes --------------+--------------------------+---------+---------+--------- - testpub_foo | regress_publication_user | t | t | t + List of publications + Name | Owner | All tables | Inserts | Updates | Deletes +-------------+--------------------------+------------+---------+---------+--------- + testpub_foo | regress_publication_user | f | t | t | t (1 row) -- rename back to keep the rest simple ALTER PUBLICATION testpub_foo RENAME TO testpub_default; ALTER PUBLICATION testpub_default OWNER TO regress_publication_user2; \dRp testpub_default - List of publications - Name | Owner | Inserts | Updates | Deletes ------------------+---------------------------+---------+---------+--------- - testpub_default | regress_publication_user2 | t | t | t + List of publications + Name | Owner | All tables | Inserts | Updates | Deletes +-----------------+---------------------------+------------+---------+---------+--------- + testpub_default | regress_publication_user2 | f | t | t | t (1 row) DROP PUBLICATION testpub_default; diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 8f733b0242..914c122af0 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -2590,6 +2590,11 @@ create table fooview (x int, y text) partition by list (x); create rule "_RETURN" as on select to fooview do instead select 1 as x, 'aaa'::text as y; ERROR: could not convert partitioned table "fooview" to a view +-- nor can one convert a partition to view +create table fooview_part partition of fooview for values in (1); +create rule "_RETURN" as on select to fooview_part do instead + select 1 as x, 'aaa'::text as y; +ERROR: could not convert partition "fooview_part" to a view -- -- check for planner problems with complex inherited UPDATES -- diff --git a/src/test/regress/expected/sequence.out b/src/test/regress/expected/sequence.out index b57471ca5c..82c3acb27e 100644 --- a/src/test/regress/expected/sequence.out +++ b/src/test/regress/expected/sequence.out @@ -308,8 +308,8 @@ DROP SEQUENCE myseq2; ALTER SEQUENCE IF EXISTS sequence_test2 RESTART WITH 24 INCREMENT BY 4 MAXVALUE 36 MINVALUE 5 CYCLE; NOTICE: relation "sequence_test2" does not exist, skipping -ALTER SEQUENCE pg_class CYCLE; -- error, not a sequence -ERROR: "pg_class" is not a sequence +ALTER SEQUENCE serialTest1 CYCLE; -- error, not a sequence +ERROR: "serialtest1" is not a sequence CREATE SEQUENCE sequence_test2 START WITH 32; CREATE SEQUENCE sequence_test4 INCREMENT BY -1; SELECT nextval('sequence_test2'); diff --git a/src/test/regress/expected/stats_ext.out b/src/test/regress/expected/stats_ext.out index 5fd1244bcb..085dce7fd7 100644 --- a/src/test/regress/expected/stats_ext.out +++ b/src/test/regress/expected/stats_ext.out @@ -30,9 +30,11 @@ CREATE STATISTICS tst ON (relpages, reltuples) FROM pg_class; ERROR: only simple column references are allowed in CREATE STATISTICS CREATE STATISTICS tst (unrecognized) ON relname, relnatts FROM pg_class; ERROR: unrecognized statistic type "unrecognized" --- Ensure stats are dropped sanely +-- Ensure stats are dropped sanely, and test IF NOT EXISTS while at it CREATE TABLE ab1 (a INTEGER, b INTEGER, c INTEGER); -CREATE STATISTICS ab1_a_b_stats ON a, b FROM ab1; +CREATE STATISTICS IF NOT EXISTS ab1_a_b_stats ON a, b FROM ab1; +CREATE STATISTICS IF NOT EXISTS ab1_a_b_stats ON a, b FROM ab1; +NOTICE: statistics object "ab1_a_b_stats" already exists, skipping DROP STATISTICS ab1_a_b_stats; CREATE SCHEMA regress_schema_2; CREATE STATISTICS regress_schema_2.ab1_a_b_stats ON a, b FROM ab1; diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule index 4e8f4c7bdd..16e29872d9 100644 --- a/src/test/regress/parallel_schedule +++ b/src/test/regress/parallel_schedule @@ -30,7 +30,7 @@ test: point lseg line box path polygon circle date time timetz timestamp timesta # geometry depends on point, lseg, box, path, polygon and circle # horology depends on interval, timetz, timestamp, timestamptz, reltime and abstime # ---------- -test: geometry horology regex oidjoins type_sanity opr_sanity comments expressions +test: geometry horology regex oidjoins type_sanity opr_sanity misc_sanity comments expressions # ---------- # These four each depend on the previous one diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index 72899c1ae6..616bc25291 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -1177,7 +1177,7 @@ make_temp_sockdir(void) return temp_sockdir; } -#endif /* HAVE_UNIX_SOCKETS */ +#endif /* HAVE_UNIX_SOCKETS */ /* * Check whether string matches pattern @@ -2342,7 +2342,7 @@ wait_for_tests(PID_TYPE * pids, int *statuses, char **names, int num_tests) p = active_pids[r - WAIT_OBJECT_0]; /* compact the active_pids array */ active_pids[r - WAIT_OBJECT_0] = active_pids[tests_left - 1]; -#endif /* WIN32 */ +#endif /* WIN32 */ for (i = 0; i < num_tests; i++) { @@ -2569,8 +2569,8 @@ run_schedule(const char *schedule, test_function tfunc) bool newdiff; if (tl) - tl = tl->next; /* tl has the same length as rl and el - * if it exists */ + tl = tl->next; /* tl has the same length as rl and el if + * it exists */ newdiff = results_differ(tests[i], rl->str, el->str); if (newdiff && tl) @@ -2756,7 +2756,7 @@ create_database(const char *dbname) "ALTER DATABASE \"%s\" SET lc_numeric TO 'C';" "ALTER DATABASE \"%s\" SET lc_time TO 'C';" "ALTER DATABASE \"%s\" SET bytea_output TO 'hex';" - "ALTER DATABASE \"%s\" SET timezone_abbreviations TO 'Default';", + "ALTER DATABASE \"%s\" SET timezone_abbreviations TO 'Default';", dbname, dbname, dbname, dbname, dbname, dbname); /* diff --git a/src/test/regress/pg_regress.h b/src/test/regress/pg_regress.h index f7745b16e1..4abfc628e5 100644 --- a/src/test/regress/pg_regress.h +++ b/src/test/regress/pg_regress.h @@ -26,9 +26,9 @@ typedef struct _stringlist } _stringlist; typedef PID_TYPE(*test_function) (const char *, - _stringlist **, - _stringlist **, - _stringlist **); + _stringlist **, + _stringlist **, + _stringlist **); typedef void (*init_function) (int argc, char **argv); extern char *bindir; diff --git a/src/test/regress/regress.c b/src/test/regress/regress.c index 6b1310344b..b73bccec3d 100644 --- a/src/test/regress/regress.c +++ b/src/test/regress/regress.c @@ -85,7 +85,7 @@ regress_dist_ptpath(PG_FUNCTION_ARGS) regress_lseg_construct(&lseg, &path->p[i], &path->p[i + 1]); tmp = DatumGetFloat8(DirectFunctionCall2(dist_ps, PointPGetDatum(pt), - LsegPGetDatum(&lseg))); + LsegPGetDatum(&lseg))); if (i == 0 || tmp < result) result = tmp; } @@ -277,7 +277,7 @@ widget_out(PG_FUNCTION_ARGS) { WIDGET *widget = (WIDGET *) PG_GETARG_POINTER(0); char *str = psprintf("(%g,%g,%g)", - widget->center.x, widget->center.y, widget->radius); + widget->center.x, widget->center.y, widget->radius); PG_RETURN_CSTRING(str); } @@ -426,11 +426,11 @@ funny_dup17(PG_FUNCTION_ARGS) if (SPI_processed > 0) { selected = DatumGetInt32(DirectFunctionCall1(int4in, - CStringGetDatum(SPI_getvalue( - SPI_tuptable->vals[0], - SPI_tuptable->tupdesc, - 1 - )))); + CStringGetDatum(SPI_getvalue( + SPI_tuptable->vals[0], + SPI_tuptable->tupdesc, + 1 + )))); } elog(DEBUG4, "funny_dup17 (fired %s) on level %3d: " UINT64_FORMAT "/%d tuples inserted/selected", @@ -550,7 +550,7 @@ ttdummy(PG_FUNCTION_ARGS) return PointerGetDatum(NULL); } } - else if (oldoff != TTDUMMY_INFINITY) /* DELETE */ + else if (oldoff != TTDUMMY_INFINITY) /* DELETE */ { pfree(relname); return PointerGetDatum(NULL); @@ -579,7 +579,7 @@ ttdummy(PG_FUNCTION_ARGS) { cvals[attnum[0] - 1] = newoff; /* start_date eq current date */ cnulls[attnum[0] - 1] = ' '; - cvals[attnum[1] - 1] = TTDUMMY_INFINITY; /* stop_date eq INFINITY */ + cvals[attnum[1] - 1] = TTDUMMY_INFINITY; /* stop_date eq INFINITY */ cnulls[attnum[1] - 1] = ' '; } else @@ -630,7 +630,7 @@ ttdummy(PG_FUNCTION_ARGS) /* Tuple to return to upper Executor ... */ if (newtuple) /* UPDATE */ rettuple = SPI_modifytuple(rel, trigtuple, 1, &(attnum[1]), &newoff, NULL); - else /* DELETE */ + else /* DELETE */ rettuple = trigtuple; SPI_finish(); /* don't forget say Bye to SPI mgr */ @@ -708,8 +708,7 @@ Datum int44out(PG_FUNCTION_ARGS) { int32 *an_array = (int32 *) PG_GETARG_POINTER(0); - char *result = (char *) palloc(16 * 4); /* Allow 14 digits + - * sign */ + char *result = (char *) palloc(16 * 4); /* Allow 14 digits + sign */ int i; char *walk; @@ -896,7 +895,7 @@ test_atomic_flag(void) pg_atomic_clear_flag(&flag); } -#endif /* PG_HAVE_ATOMIC_FLAG_SIMULATION */ +#endif /* PG_HAVE_ATOMIC_FLAG_SIMULATION */ static void test_atomic_uint32(void) diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule index 0d60b0c30e..6eb33871d2 100644 --- a/src/test/regress/serial_schedule +++ b/src/test/regress/serial_schedule @@ -49,6 +49,7 @@ test: regex test: oidjoins test: type_sanity test: opr_sanity +test: misc_sanity test: comments test: expressions test: insert diff --git a/src/test/regress/sql/create_type.sql b/src/test/regress/sql/create_type.sql index a1839ef9e7..a28303aa6a 100644 --- a/src/test/regress/sql/create_type.sql +++ b/src/test/regress/sql/create_type.sql @@ -115,6 +115,17 @@ CREATE TYPE not_existing_type (INPUT = array_in, ELEMENT = int, INTERNALLENGTH = 32); +-- Check dependency transfer of opaque functions when creating a new type +CREATE FUNCTION base_fn_in(cstring) RETURNS opaque AS 'boolin' + LANGUAGE internal IMMUTABLE STRICT; +CREATE FUNCTION base_fn_out(opaque) RETURNS opaque AS 'boolout' + LANGUAGE internal IMMUTABLE STRICT; +CREATE TYPE base_type(INPUT = base_fn_in, OUTPUT = base_fn_out); +DROP FUNCTION base_fn_in(cstring); -- error +DROP FUNCTION base_fn_out(opaque); -- error +DROP TYPE base_type; -- error +DROP TYPE base_type CASCADE; + -- Check usage of typmod with a user-defined type -- (we have borrowed numeric's typmod functions) diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql index 83c2b5f5e3..2f70763034 100644 --- a/src/test/regress/sql/join.sql +++ b/src/test/regress/sql/join.sql @@ -1789,6 +1789,34 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT count(*) FROM testr WHERE NOT EXISTS (SELECT SELECT count(*) FROM testr WHERE NOT EXISTS (SELECT * FROM testh WHERE testr.b = testh.b); -- +-- test that foreign key join estimation performs sanely for outer joins +-- + +begin; + +create table fkest (a int, b int, c int unique, primary key(a,b)); +create table fkest1 (a int, b int, primary key(a,b)); + +insert into fkest select x/10, x%10, x from generate_series(1,1000) x; +insert into fkest1 select x/10, x%10 from generate_series(1,1000) x; + +alter table fkest1 + add constraint fkest1_a_b_fkey foreign key (a,b) references fkest; + +analyze fkest; +analyze fkest1; + +explain (costs off) +select * +from fkest f + left join fkest1 f1 on f.a = f1.a and f.b = f1.b + left join fkest1 f2 on f.a = f2.a and f.b = f2.b + left join fkest1 f3 on f.a = f3.a and f.b = f3.b +where f.c = 1; + +rollback; + +-- -- test planner's ability to mark joins as unique -- diff --git a/src/test/regress/sql/misc_sanity.sql b/src/test/regress/sql/misc_sanity.sql new file mode 100644 index 0000000000..5130a4ab79 --- /dev/null +++ b/src/test/regress/sql/misc_sanity.sql @@ -0,0 +1,74 @@ +-- +-- MISC_SANITY +-- Sanity checks for common errors in making system tables that don't fit +-- comfortably into either opr_sanity or type_sanity. +-- +-- Every test failure in this file should be closely inspected. +-- The description of the failing test should be read carefully before +-- adjusting the expected output. In most cases, the queries should +-- not find *any* matching entries. +-- +-- NB: run this test early, because some later tests create bogus entries. + + +-- **************** pg_depend **************** + +-- Look for illegal values in pg_depend fields. +-- classid/objid can be zero, but only in 'p' entries + +SELECT * +FROM pg_depend as d1 +WHERE refclassid = 0 OR refobjid = 0 OR + deptype NOT IN ('a', 'e', 'i', 'n', 'p') OR + (deptype != 'p' AND (classid = 0 OR objid = 0)) OR + (deptype = 'p' AND (classid != 0 OR objid != 0 OR objsubid != 0)); + +-- **************** pg_shdepend **************** + +-- Look for illegal values in pg_shdepend fields. +-- classid/objid can be zero, but only in 'p' entries + +SELECT * +FROM pg_shdepend as d1 +WHERE refclassid = 0 OR refobjid = 0 OR + deptype NOT IN ('a', 'o', 'p', 'r') OR + (deptype != 'p' AND (dbid = 0 OR classid = 0 OR objid = 0)) OR + (deptype = 'p' AND (dbid != 0 OR classid != 0 OR objid != 0 OR objsubid != 0)); + + +-- Check each OID-containing system catalog to see if its lowest-numbered OID +-- is pinned. If not, and if that OID was generated during initdb, then +-- perhaps initdb forgot to scan that catalog for pinnable entries. +-- Generally, it's okay for a catalog to be listed in the output of this +-- test if that catalog is scanned by initdb.c's setup_depend() function; +-- whatever OID the test is complaining about must have been added later +-- in initdb, where it intentionally isn't pinned. Legitimate exceptions +-- to that rule are listed in the comments in setup_depend(). + +do $$ +declare relnm text; + reloid oid; + shared bool; + lowoid oid; + pinned bool; +begin +for relnm, reloid, shared in + select relname, oid, relisshared from pg_class + where relhasoids and oid < 16384 order by 1 +loop + execute 'select min(oid) from ' || relnm into lowoid; + continue when lowoid is null or lowoid >= 16384; + if shared then + pinned := exists(select 1 from pg_shdepend + where refclassid = reloid and refobjid = lowoid + and deptype = 'p'); + else + pinned := exists(select 1 from pg_depend + where refclassid = reloid and refobjid = lowoid + and deptype = 'p'); + end if; + if not pinned then + raise notice '% contains unpinned initdb-created object(s)', relnm; + end if; +end loop; +end$$; diff --git a/src/test/regress/sql/opr_sanity.sql b/src/test/regress/sql/opr_sanity.sql index 106b9d93bf..0279e2a3fa 100644 --- a/src/test/regress/sql/opr_sanity.sql +++ b/src/test/regress/sql/opr_sanity.sql @@ -95,6 +95,13 @@ SELECT p1.oid, p1.proname FROM pg_proc AS p1 WHERE proiswindow AND (proisagg OR proretset); +-- currently, no built-in functions should be SECURITY DEFINER; +-- this might change in future, but there will probably never be many. +SELECT p1.oid, p1.proname +FROM pg_proc AS p1 +WHERE prosecdef +ORDER BY 1; + -- pronargdefaults should be 0 iff proargdefaults is null SELECT p1.oid, p1.proname FROM pg_proc AS p1 diff --git a/src/test/regress/sql/publication.sql b/src/test/regress/sql/publication.sql index cc1f33e72c..815410b3c5 100644 --- a/src/test/regress/sql/publication.sql +++ b/src/test/regress/sql/publication.sql @@ -45,6 +45,7 @@ ALTER PUBLICATION testpub_foralltables SET TABLE pub_test.testpub_nopk; SELECT pubname, puballtables FROM pg_publication WHERE pubname = 'testpub_foralltables'; \d+ testpub_tbl2 +\dRp+ testpub_foralltables DROP TABLE testpub_tbl2; DROP PUBLICATION testpub_foralltables; diff --git a/src/test/regress/sql/rules.sql b/src/test/regress/sql/rules.sql index 742134e971..fb46e95d38 100644 --- a/src/test/regress/sql/rules.sql +++ b/src/test/regress/sql/rules.sql @@ -903,6 +903,11 @@ create table fooview (x int, y text) partition by list (x); create rule "_RETURN" as on select to fooview do instead select 1 as x, 'aaa'::text as y; +-- nor can one convert a partition to view +create table fooview_part partition of fooview for values in (1); +create rule "_RETURN" as on select to fooview_part do instead + select 1 as x, 'aaa'::text as y; + -- -- check for planner problems with complex inherited UPDATES -- diff --git a/src/test/regress/sql/sequence.sql b/src/test/regress/sql/sequence.sql index 769760de3c..b973a2a698 100644 --- a/src/test/regress/sql/sequence.sql +++ b/src/test/regress/sql/sequence.sql @@ -173,7 +173,7 @@ DROP SEQUENCE myseq2; ALTER SEQUENCE IF EXISTS sequence_test2 RESTART WITH 24 INCREMENT BY 4 MAXVALUE 36 MINVALUE 5 CYCLE; -ALTER SEQUENCE pg_class CYCLE; -- error, not a sequence +ALTER SEQUENCE serialTest1 CYCLE; -- error, not a sequence CREATE SEQUENCE sequence_test2 START WITH 32; CREATE SEQUENCE sequence_test4 INCREMENT BY -1; diff --git a/src/test/regress/sql/stats_ext.sql b/src/test/regress/sql/stats_ext.sql index 4c2f514b93..d1ff3a8583 100644 --- a/src/test/regress/sql/stats_ext.sql +++ b/src/test/regress/sql/stats_ext.sql @@ -18,9 +18,10 @@ CREATE STATISTICS tst ON relnatts + relpages FROM pg_class; CREATE STATISTICS tst ON (relpages, reltuples) FROM pg_class; CREATE STATISTICS tst (unrecognized) ON relname, relnatts FROM pg_class; --- Ensure stats are dropped sanely +-- Ensure stats are dropped sanely, and test IF NOT EXISTS while at it CREATE TABLE ab1 (a INTEGER, b INTEGER, c INTEGER); -CREATE STATISTICS ab1_a_b_stats ON a, b FROM ab1; +CREATE STATISTICS IF NOT EXISTS ab1_a_b_stats ON a, b FROM ab1; +CREATE STATISTICS IF NOT EXISTS ab1_a_b_stats ON a, b FROM ab1; DROP STATISTICS ab1_a_b_stats; CREATE SCHEMA regress_schema_2; diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl index 66fa790d12..32df273929 100644 --- a/src/test/ssl/t/001_ssltests.pl +++ b/src/test/ssl/t/001_ssltests.pl @@ -6,19 +6,6 @@ use Test::More tests => 40; use ServerSetup; use File::Copy; -# Like TestLib.pm, we use IPC::Run -BEGIN -{ - eval { - require IPC::Run; - import IPC::Run qw(run start); - 1; - } or do - { - plan skip_all => "IPC::Run not available"; - } -} - #### Some configuration # This is the hostname used to connect to the server. This cannot be a @@ -47,8 +34,6 @@ sub run_test_psql # The first argument is a (part of a) connection string, and it's also printed # out as the test case name. It is appended to $common_connstr global variable, # which also contains a libpq connection string. -# -# The second argument is a hostname to connect to. sub test_connect_ok { my $connstr = $_[0]; diff --git a/src/test/subscription/t/001_rep_changes.pl b/src/test/subscription/t/001_rep_changes.pl index f9cf5e4392..a63c679848 100644 --- a/src/test/subscription/t/001_rep_changes.pl +++ b/src/test/subscription/t/001_rep_changes.pl @@ -3,7 +3,7 @@ use strict; use warnings; use PostgresNode; use TestLib; -use Test::More tests => 15; +use Test::More tests => 16; # Initialize publisher node my $node_publisher = get_new_node('publisher'); @@ -23,6 +23,10 @@ $node_publisher->safe_psql('postgres', $node_publisher->safe_psql('postgres', "CREATE TABLE tab_full AS SELECT generate_series(1,10) AS a"); $node_publisher->safe_psql('postgres', + "CREATE TABLE tab_full2 (x text)"); +$node_publisher->safe_psql('postgres', + "INSERT INTO tab_full2 VALUES ('a'), ('b'), ('b')"); +$node_publisher->safe_psql('postgres', "CREATE TABLE tab_rep (a int primary key)"); $node_publisher->safe_psql('postgres', "CREATE TABLE tab_mixed (a int primary key, b text)"); @@ -33,6 +37,7 @@ $node_publisher->safe_psql('postgres', $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_notrep (a int)"); $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_ins (a int)"); $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full (a int)"); +$node_subscriber->safe_psql('postgres', "CREATE TABLE tab_full2 (x text)"); $node_subscriber->safe_psql('postgres', "CREATE TABLE tab_rep (a int primary key)"); # different column count and order than on publisher @@ -45,7 +50,7 @@ $node_publisher->safe_psql('postgres', "CREATE PUBLICATION tap_pub"); $node_publisher->safe_psql('postgres', "CREATE PUBLICATION tap_pub_ins_only WITH (publish = insert)"); $node_publisher->safe_psql('postgres', - "ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_mixed"); + "ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full, tab_full2, tab_mixed"); $node_publisher->safe_psql('postgres', "ALTER PUBLICATION tap_pub_ins_only ADD TABLE tab_ins"); @@ -109,12 +114,17 @@ $node_publisher->safe_psql('postgres', $node_subscriber->safe_psql('postgres', "ALTER TABLE tab_full REPLICA IDENTITY FULL"); $node_publisher->safe_psql('postgres', + "ALTER TABLE tab_full2 REPLICA IDENTITY FULL"); +$node_subscriber->safe_psql('postgres', + "ALTER TABLE tab_full2 REPLICA IDENTITY FULL"); +$node_publisher->safe_psql('postgres', "ALTER TABLE tab_ins REPLICA IDENTITY FULL"); $node_subscriber->safe_psql('postgres', "ALTER TABLE tab_ins REPLICA IDENTITY FULL"); -# and do the update +# and do the updates $node_publisher->safe_psql('postgres', "UPDATE tab_full SET a = a * a"); +$node_publisher->safe_psql('postgres', "UPDATE tab_full2 SET x = 'bb' WHERE x = 'b'"); # Wait for subscription to catch up $node_publisher->poll_query_until('postgres', $caughtup_query) @@ -125,6 +135,13 @@ $result = $node_subscriber->safe_psql('postgres', is($result, qq(20|1|100), 'update works with REPLICA IDENTITY FULL and duplicate tuples'); +$result = $node_subscriber->safe_psql('postgres', + "SELECT x FROM tab_full2 ORDER BY 1"); +is($result, qq(a +bb +bb), + 'update works with REPLICA IDENTITY FULL and text datums'); + # check that change of connection string and/or publication list causes # restart of subscription workers. Not all of these are registered as tests # as we need to poll for a change but the test suite will fail none the less diff --git a/src/test/thread/thread_test.c b/src/test/thread/thread_test.c index cb93bcc5ab..32ce80e57f 100644 --- a/src/test/thread/thread_test.c +++ b/src/test/thread/thread_test.c @@ -466,4 +466,4 @@ func_call_2(void) pthread_mutex_unlock(&init_mutex); } -#endif /* !ENABLE_THREAD_SAFETY && !IN_CONFIGURE */ +#endif /* !ENABLE_THREAD_SAFETY && !IN_CONFIGURE */ diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c index a2faa82ac8..08642d1236 100644 --- a/src/timezone/localtime.c +++ b/src/timezone/localtime.c @@ -44,7 +44,7 @@ * that tzname[0] has the "normal" length of three characters). */ #define WILDABBR " " -#endif /* !defined WILDABBR */ +#endif /* !defined WILDABBR */ static const char wildabbr[] = WILDABBR; @@ -112,7 +112,7 @@ static struct pg_tm tm; /* Initialize *S to a value based on GMTOFF, ISDST, and ABBRIND. */ static void -init_ttinfo(struct ttinfo * s, int32 gmtoff, bool isdst, int abbrind) +init_ttinfo(struct ttinfo *s, int32 gmtoff, bool isdst, int abbrind) { s->tt_gmtoff = gmtoff; s->tt_isdst = isdst; @@ -189,7 +189,7 @@ union input_buffer /* The entire buffer. */ char buf[2 * sizeof(struct tzhead) + 2 * sizeof(struct state) - + 4 * TZ_MAX_TIMES]; + + 4 * TZ_MAX_TIMES]; }; /* Local storage needed for 'tzloadbody'. */ @@ -215,8 +215,8 @@ union local_storage * given name is stored there (the buffer must be > TZ_STRLEN_MAX bytes!). */ static int -tzloadbody(char const * name, char *canonname, struct state * sp, bool doextend, - union local_storage * lsp) +tzloadbody(char const *name, char *canonname, struct state *sp, bool doextend, + union local_storage *lsp) { int i; int fid; @@ -270,7 +270,7 @@ tzloadbody(char const * name, char *canonname, struct state * sp, bool doextend, return EINVAL; if (nread < (tzheadsize /* struct tzhead */ - + timecnt * stored /* ats */ + + timecnt * stored /* ats */ + timecnt /* types */ + typecnt * 6 /* ttinfos */ + charcnt /* chars */ @@ -553,7 +553,7 @@ tzloadbody(char const * name, char *canonname, struct state * sp, bool doextend, * given name is stored there (the buffer must be > TZ_STRLEN_MAX bytes!). */ int -tzload(const char *name, char *canonname, struct state * sp, bool doextend) +tzload(const char *name, char *canonname, struct state *sp, bool doextend) { union local_storage *lsp = malloc(sizeof *lsp); @@ -569,7 +569,7 @@ tzload(const char *name, char *canonname, struct state * sp, bool doextend) } static bool -typesequiv(const struct state * sp, int a, int b) +typesequiv(const struct state *sp, int a, int b) { bool result; @@ -737,7 +737,7 @@ getoffset(const char *strp, int32 *offsetp) * Otherwise, return a pointer to the first character not part of the rule. */ static const char * -getrule(const char *strp, struct rule * rulep) +getrule(const char *strp, struct rule *rulep) { if (*strp == 'J') { @@ -788,7 +788,7 @@ getrule(const char *strp, struct rule * rulep) strp = getoffset(strp, &rulep->r_time); } else - rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */ + rulep->r_time = 2 * SECSPERHOUR; /* default = 2:00:00 */ return strp; } @@ -797,7 +797,7 @@ getrule(const char *strp, struct rule * rulep) * effect, calculate the year-relative time that rule takes effect. */ static int32 -transtime(int year, const struct rule * rulep, +transtime(int year, const struct rule *rulep, int32 offset) { bool leapyear; @@ -894,7 +894,7 @@ transtime(int year, const struct rule * rulep, * Returns true on success, false on failure. */ bool -tzparse(const char *name, struct state * sp, bool lastditch) +tzparse(const char *name, struct state *sp, bool lastditch) { const char *stdname; const char *dstname = NULL; @@ -921,7 +921,7 @@ tzparse(const char *name, struct state * sp, bool lastditch) stdlen = (sizeof sp->chars) - 1; charcnt = stdlen + 1; stdoffset = 0; - sp->goback = sp->goahead = false; /* simulate failed tzload() */ + sp->goback = sp->goahead = false; /* simulate failed tzload() */ load_ok = false; } else @@ -1217,7 +1217,7 @@ tzparse(const char *name, struct state * sp, bool lastditch) } static void -gmtload(struct state * sp) +gmtload(struct state *sp) { if (tzload(gmt, NULL, sp, true) != 0) tzparse(gmt, sp, true); @@ -1231,8 +1231,8 @@ gmtload(struct state * sp) * but it *is* desirable.) */ static struct pg_tm * -localsub(struct state const * sp, pg_time_t const * timep, - struct pg_tm * tmp) +localsub(struct state const *sp, pg_time_t const *timep, + struct pg_tm *tmp) { const struct ttinfo *ttisp; int i; @@ -1323,7 +1323,7 @@ pg_localtime(const pg_time_t *timep, const pg_tz *tz) * Except we have a private "struct state" for GMT, so no sp is passed in. */ static struct pg_tm * -gmtsub(pg_time_t const * timep, int32 offset, struct pg_tm * tmp) +gmtsub(pg_time_t const *timep, int32 offset, struct pg_tm *tmp) { struct pg_tm *result; @@ -1370,7 +1370,7 @@ leaps_thru_end_of(const int y) static struct pg_tm * timesub(const pg_time_t *timep, int32 offset, - const struct state * sp, struct pg_tm * tmp) + const struct state *sp, struct pg_tm *tmp) { const struct lsinfo *lp; pg_time_t tdays; diff --git a/src/timezone/pgtz.c b/src/timezone/pgtz.c index 846f8898ff..a73dc6188b 100644 --- a/src/timezone/pgtz.c +++ b/src/timezone/pgtz.c @@ -466,7 +466,7 @@ pg_tzenumerate_next(pg_tzenum *dir) /* Step into the subdirectory */ if (dir->depth >= MAX_TZDIR_DEPTH - 1) ereport(ERROR, - (errmsg_internal("timezone directory stack overflow"))); + (errmsg_internal("timezone directory stack overflow"))); dir->depth++; dir->dirname[dir->depth] = pstrdup(fullname); dir->dirdesc[dir->depth] = AllocateDir(fullname); diff --git a/src/timezone/pgtz.h b/src/timezone/pgtz.h index cd193b8255..3d89ba00a7 100644 --- a/src/timezone/pgtz.h +++ b/src/timezone/pgtz.h @@ -50,7 +50,7 @@ struct state unsigned char types[TZ_MAX_TIMES]; struct ttinfo ttis[TZ_MAX_TYPES]; char chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, 3 /* sizeof gmt */ ), - (2 * (TZ_STRLEN_MAX + 1)))]; + (2 * (TZ_STRLEN_MAX + 1)))]; struct lsinfo lsis[TZ_MAX_LEAPS]; int defaulttype; /* for early times or if no transitions */ }; @@ -68,8 +68,8 @@ struct pg_tz extern int pg_open_tzfile(const char *name, char *canonname); /* in localtime.c */ -extern int tzload(const char *name, char *canonname, struct state * sp, +extern int tzload(const char *name, char *canonname, struct state *sp, bool doextend); -extern bool tzparse(const char *name, struct state * sp, bool lastditch); +extern bool tzparse(const char *name, struct state *sp, bool lastditch); -#endif /* _PGTZ_H */ +#endif /* _PGTZ_H */ diff --git a/src/timezone/private.h b/src/timezone/private.h index f031b17b7e..c141fb6131 100644 --- a/src/timezone/private.h +++ b/src/timezone/private.h @@ -40,10 +40,10 @@ #ifndef WIFEXITED #define WIFEXITED(status) (((status) & 0xff) == 0) -#endif /* !defined WIFEXITED */ +#endif /* !defined WIFEXITED */ #ifndef WEXITSTATUS #define WEXITSTATUS(status) (((status) >> 8) & 0xff) -#endif /* !defined WEXITSTATUS */ +#endif /* !defined WEXITSTATUS */ /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */ #define is_digit(c) ((unsigned)(c) - '0' <= 9) @@ -60,7 +60,7 @@ extern int unlink(const char *filename); #define remove unlink -#endif /* !defined remove */ +#endif /* !defined remove */ /* @@ -166,4 +166,4 @@ extern int unlink(const char *filename); ((int64) YEARSPERREPEAT * (int64) AVGSECSPERYEAR) #define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */ -#endif /* !defined PRIVATE_H */ +#endif /* !defined PRIVATE_H */ diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c index 3f6ba395c6..7cbafc9d83 100644 --- a/src/timezone/strftime.c +++ b/src/timezone/strftime.c @@ -120,7 +120,7 @@ static char *_yconv(int, int, bool, bool, char *, const char *); size_t pg_strftime(char *s, size_t maxsize, const char *format, - const struct pg_tm * t) + const struct pg_tm *t) { char *p; int warn; @@ -134,7 +134,7 @@ pg_strftime(char *s, size_t maxsize, const char *format, } static char * -_fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim, +_fmt(const char *format, const struct pg_tm *t, char *pt, const char *ptlim, int *warnp) { for (; *format; ++format) @@ -245,7 +245,7 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim, */ pt = _add("kitchen sink", pt, ptlim); continue; -#endif /* defined KITCHEN_SINK */ +#endif /* defined KITCHEN_SINK */ case 'l': /* diff --git a/src/timezone/tzfile.h b/src/timezone/tzfile.h index 56a5b43472..2843833e49 100644 --- a/src/timezone/tzfile.h +++ b/src/timezone/tzfile.h @@ -34,9 +34,9 @@ struct tzhead { char tzh_magic[4]; /* TZ_MAGIC */ char tzh_version[1]; /* '\0' or '2' or '3' as of 2013 */ - char tzh_reserved[15]; /* reserved; must be zero */ - char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ - char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ + char tzh_reserved[15]; /* reserved; must be zero */ + char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */ + char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */ char tzh_leapcnt[4]; /* coded number of leap seconds */ char tzh_timecnt[4]; /* coded number of transition times */ char tzh_typecnt[4]; /* coded number of local time types */ @@ -100,4 +100,4 @@ struct tzhead #define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */ -#endif /* !defined TZFILE_H */ +#endif /* !defined TZFILE_H */ diff --git a/src/timezone/zic.c b/src/timezone/zic.c index 5fa0a81262..27c841be9e 100644 --- a/src/timezone/zic.c +++ b/src/timezone/zic.c @@ -27,7 +27,7 @@ typedef int64 zic_t; #ifndef ZIC_MAX_ABBR_LEN_WO_WARN #define ZIC_MAX_ABBR_LEN_WO_WARN 6 -#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */ +#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */ #ifndef WIN32 #ifdef S_IRUSR @@ -83,9 +83,9 @@ struct rule * r_dycode r_dayofmonth r_wday */ -#define DC_DOM 0 /* 1..31 */ /* unused */ -#define DC_DOWGEQ 1 /* 1..31 */ /* 0..6 (Sun..Sat) */ -#define DC_DOWLEQ 2 /* 1..31 */ /* 0..6 (Sun..Sat) */ +#define DC_DOM 0 /* 1..31 */ /* unused */ +#define DC_DOWGEQ 1 /* 1..31 */ /* 0..6 (Sun..Sat) */ +#define DC_DOWLEQ 2 /* 1..31 */ /* 0..6 (Sun..Sat) */ struct zone { @@ -137,9 +137,9 @@ static char lowerit(char); static void mkdirs(char const *, bool); static void newabbr(const char *abbr); static zic_t oadd(zic_t t1, zic_t t2); -static void outzone(const struct zone * zp, ptrdiff_t ntzones); -static zic_t rpytime(const struct rule * rp, zic_t wantedy); -static void rulesub(struct rule * rp, +static void outzone(const struct zone *zp, ptrdiff_t ntzones); +static zic_t rpytime(const struct rule *rp, zic_t wantedy); +static void rulesub(struct rule *rp, const char *loyearp, const char *hiyearp, const char *typep, const char *monthp, const char *dayp, const char *timep); @@ -291,7 +291,7 @@ struct lookup }; static struct lookup const *byword(const char *string, - const struct lookup * lp); + const struct lookup *lp); static struct lookup const line_codes[] = { {"Rule", LC_RULE}, @@ -372,7 +372,7 @@ static struct attype zic_t at; bool dontmerge; unsigned char type; -} *attypes; +} *attypes; static zic_t gmtoffs[TZ_MAX_TYPES]; static char isdsts[TZ_MAX_TYPES]; static unsigned char abbrinds[TZ_MAX_TYPES]; @@ -423,7 +423,7 @@ erealloc(void *ptr, size_t size) } static char * -ecpyalloc(char const * str) +ecpyalloc(char const *str) { return memcheck(strdup(str)); } @@ -449,7 +449,7 @@ growalloc(void *ptr, size_t itemsize, ptrdiff_t nitems, ptrdiff_t *nitems_alloc) */ static void -eats(char const * name, lineno_t num, char const * rname, lineno_t rnum) +eats(char const *name, lineno_t num, char const *rname, lineno_t rnum) { filename = name; linenum = num; @@ -458,7 +458,7 @@ eats(char const * name, lineno_t num, char const * rname, lineno_t rnum) } static void -eat(char const * name, lineno_t num) +eat(char const *name, lineno_t num) { eats(name, num, NULL, -1); } @@ -503,7 +503,7 @@ warning(const char *string,...) } static void -close_file(FILE *stream, char const * dir, char const * name) +close_file(FILE *stream, char const *dir, char const *name) { char const *e = (ferror(stream) ? _("I/O error") : fclose(stream) != 0 ? strerror(errno) : NULL); @@ -536,7 +536,7 @@ usage(FILE *stream, int status) ancestors. After this is done, all files are accessed with names relative to DIR. */ static void -change_directory(char const * dir) +change_directory(char const *dir) { if (chdir(dir) != 0) { @@ -572,7 +572,7 @@ main(int argc, char *argv[]) #ifndef WIN32 umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH)); -#endif /* !WIN32 */ +#endif /* !WIN32 */ progname = argv[0]; if (TYPE_BIT(zic_t) <64) { @@ -720,8 +720,8 @@ main(int argc, char *argv[]) } static bool -componentcheck(char const * name, char const * component, - char const * component_end) +componentcheck(char const *name, char const *component, + char const *component_end) { enum { @@ -812,7 +812,7 @@ namecheck(const char *name) */ #ifdef HAVE_SYMLINK static char * -relname(char const * from, char const * to) +relname(char const *from, char const *to) { size_t i, taillen, @@ -852,12 +852,12 @@ relname(char const * from, char const * to) } return result; } -#endif /* HAVE_SYMLINK */ +#endif /* HAVE_SYMLINK */ /* Hard link FROM to TO, following any symbolic links. Return 0 if successful, an error number otherwise. */ static int -hardlinkerr(char const * from, char const * to) +hardlinkerr(char const *from, char const *to) { int r = linkat(AT_FDCWD, from, AT_FDCWD, to, AT_SYMLINK_FOLLOW); @@ -865,7 +865,7 @@ hardlinkerr(char const * from, char const * to) } static void -dolink(char const * fromfield, char const * tofield, bool staysymlink) +dolink(char const *fromfield, char const *tofield, bool staysymlink) { bool todirs_made = false; int link_errno; @@ -920,7 +920,7 @@ dolink(char const * fromfield, char const * tofield, bool staysymlink) strerror(link_errno)); } else -#endif /* HAVE_SYMLINK */ +#endif /* HAVE_SYMLINK */ { FILE *fp, *tp; @@ -1009,7 +1009,7 @@ static const zic_t early_time = (WORK_AROUND_GNOME_BUG_730332 /* Return true if NAME is a directory. */ static bool -itsdir(char const * name) +itsdir(char const *name) { struct stat st; int res = stat(name, &st); @@ -1034,7 +1034,7 @@ itsdir(char const * name) /* Return true if NAME is a symbolic link. */ static bool -itssymlink(char const * name) +itssymlink(char const *name) { #ifdef HAVE_SYMLINK char c; @@ -1250,7 +1250,7 @@ infile(const char *name) * Call error with errstring and return zero on errors. */ static zic_t -gethms(char const * string, char const * errstring, bool signable) +gethms(char const *string, char const *errstring, bool signable) { /* PG: make hh be int not zic_t to avoid sscanf portability issues */ int hh; @@ -1634,7 +1634,7 @@ inlink(char **fields, int nfields) } static void -rulesub(struct rule * rp, const char *loyearp, const char *hiyearp, +rulesub(struct rule *rp, const char *loyearp, const char *hiyearp, const char *typep, const char *monthp, const char *dayp, const char *timep) { @@ -2140,7 +2140,7 @@ writezone(const char *const name, const char *const string, char version) writetype[type] = true; } } -#endif /* !defined +#endif /* !defined * LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH */ thistypecnt = 0; for (i = 0; i < typecnt; ++i) @@ -2323,7 +2323,7 @@ abbroffset(char *buf, zic_t offset) } static size_t -doabbr(char *abbr, struct zone const * zp, char const * letters, +doabbr(char *abbr, struct zone const *zp, char const *letters, zic_t stdoff, bool doquotes) { char *cp; @@ -2409,7 +2409,7 @@ stringoffset(char *result, zic_t offset) } static int -stringrule(char *result, const struct rule * const rp, const zic_t dstoff, +stringrule(char *result, const struct rule *const rp, const zic_t dstoff, const zic_t gmtoff) { zic_t tod = rp->r_tod; @@ -2491,7 +2491,7 @@ stringrule(char *result, const struct rule * const rp, const zic_t dstoff, } static int -rule_cmp(struct rule const * a, struct rule const * b) +rule_cmp(struct rule const *a, struct rule const *b) { if (!a) return -!!b; @@ -2509,7 +2509,7 @@ enum YEAR_BY_YEAR_ZONE = 1}; static int -stringzone(char *result, struct zone const * zpfirst, ptrdiff_t zonecount) +stringzone(char *result, struct zone const *zpfirst, ptrdiff_t zonecount) { const struct zone *zp; struct rule *rp; @@ -2644,7 +2644,7 @@ stringzone(char *result, struct zone const * zpfirst, ptrdiff_t zonecount) } static void -outzone(const struct zone * zpfirst, ptrdiff_t zonecount) +outzone(const struct zone *zpfirst, ptrdiff_t zonecount) { const struct zone *zp; struct rule *rp; @@ -3045,7 +3045,7 @@ addtt(zic_t starttime, int type) } static int -addtype(zic_t gmtoff, char const * abbr, bool isdst, bool ttisstd, bool ttisgmt) +addtype(zic_t gmtoff, char const *abbr, bool isdst, bool ttisstd, bool ttisgmt) { int i, j; @@ -3144,7 +3144,7 @@ adjleap(void) } static char * -shellquote(char *b, char const * s) +shellquote(char *b, char const *s) { *b++ = '\''; while (*s) @@ -3363,7 +3363,7 @@ itsabbr(const char *abbr, const char *word) } static const struct lookup * -byword(const char *word, const struct lookup * table) +byword(const char *word, const struct lookup *table) { const struct lookup *foundlp; const struct lookup *lp; @@ -3478,7 +3478,7 @@ tadd(zic_t t1, zic_t t2) */ static zic_t -rpytime(const struct rule * rp, zic_t wantedy) +rpytime(const struct rule *rp, zic_t wantedy) { int m, i; @@ -3570,7 +3570,7 @@ will not work with pre-2004 versions of zic")); return min_time; if (dayoff > max_time / SECSPERDAY) return max_time; - t = (zic_t) dayoff *SECSPERDAY; + t = (zic_t) dayoff * SECSPERDAY; return tadd(t, rp->r_tod); } @@ -3614,7 +3614,7 @@ newabbr(const char *string) do it for ARGNAME too. Exit with failure if there is trouble. Do not consider an existing non-directory to be trouble. */ static void -mkdirs(char const * argname, bool ancestors) +mkdirs(char const *argname, bool ancestors) { char *name; char *cp; diff --git a/src/tools/entab/.gitignore b/src/tools/entab/.gitignore deleted file mode 100644 index 94db8434f3..0000000000 --- a/src/tools/entab/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/entab diff --git a/src/tools/entab/Makefile b/src/tools/entab/Makefile deleted file mode 100644 index f02730d35f..0000000000 --- a/src/tools/entab/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# -# Makefile -# -# -TARGET = entab -BINDIR = /usr/local/bin -XFLAGS = -CFLAGS = -O $(XFLAGS) -LIBS = - -$(TARGET): entab.o - $(CC) -o $@ $(CFLAGS) $^ $(LIBS) - -clean: - rm -f *.o $(TARGET) log core - -install: $(TARGET) - install -s $(TARGET) $(BINDIR) - rm -f $(BINDIR)/detab - ln $(BINDIR)/$(TARGET) $(BINDIR)/detab diff --git a/src/tools/entab/entab.1 b/src/tools/entab/entab.1 deleted file mode 100644 index bb3dcf45aa..0000000000 --- a/src/tools/entab/entab.1 +++ /dev/null @@ -1,51 +0,0 @@ -.TH ENTAB 1 local -.SH NAME -entab - tab processor -.SH SYNOPSIS -.nf -entab [-cdq] [-s min_spaces] [-t tab_width] [file ... ] -detab [-cq] [-s min_spaces] [-t tab_width] [file ... ] -.fi -.SH DESCRIPTION -Entab is a program designed to selectively add or remove tabs -from a file based on user-supplied criteria. -In default mode, entab prints the specified files to standard output -with the optimal mix of tabs and spaces. -Tabs default to every 8 characters, and tabs are used only when they -can replace more than one space, unlike 'col' which uses tabs wherever -possible. -.LP -The options are: -.in +0.5i -.nf --c Clip trailing tabs and spaces from each line. --d Delete all tabs from output --q Protect single and double-quoted strings from tab replacement. - (This option is useful when operating on source code. - Line continuation with back-slashes is also understood.) --s Minimum spaces needed to replace with a tab (default = 2). --t Number of spaces in a tab stop (default = 8). -.fi -.in -0.5i -Detab is equivalent to entab -d. -.SH NOTES -Entab has improved tab handling for certain situations. -It only replaces tabs if there is a user-defined number of spaces -to be saved. -Other tab replacement programs put tabs wherever -possible, so if two words are separated by one space, and that -space is on a tab stop, a tab is inserted. -Then, when words are added to the left, the words are shifted over, -leaving a large gap. -The quote-protection option allows tab replacement without -quoted strings being changed. -Useful when strings in source code will not have the same tab stops -when executed in the program. -.LP -To change a text file created on a system with one size of tab -stop to display properly on a device with different tab setting, -use detab (or entab -d) to remove tabs from the file with the -tab size set to the original tab size, then use entab to re-tab -the file with the new tab size. -.SH AUTHOR -Bruce Momjian, [email protected] diff --git a/src/tools/entab/entab.c b/src/tools/entab/entab.c deleted file mode 100644 index 2e74cf49bd..0000000000 --- a/src/tools/entab/entab.c +++ /dev/null @@ -1,277 +0,0 @@ -/* - * entab.c - adds/removes tabs from text files - */ - -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <unistd.h> - -#if defined(WIN32) || defined(__CYGWIN__) -#define PG_BINARY_R "rb" -#else -#define PG_BINARY_R "r" -#endif - -#define NUL '\0' - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -extern char *optarg; -extern int optind; - - -static void -output_accumulated_spaces(int *prv_spaces, char **dst) -{ - for (; *prv_spaces > 0; (*prv_spaces)--) - *((*dst)++) = ' '; -} - - -static void -trim_trailing_whitespace(int *prv_spaces, char **dst, char *out_line) -{ - while (*dst > out_line && - (*((*dst) - 1) == ' ' || *((*dst) - 1) == '\t')) - (*dst)--; - *prv_spaces = 0; -} - - -int -main(int argc, char **argv) -{ - int tab_size = 8, - min_spaces = 2, - only_comment_periods = FALSE, - protect_quotes = FALSE, - protect_leading_whitespace = FALSE, - del_tabs = FALSE, - clip_lines = FALSE, - in_comment = FALSE, - was_period = FALSE, - prv_spaces, - col_in_tab, - escaped, - nxt_spaces, - in_leading_whitespace; - char in_line[BUFSIZ], - out_line[BUFSIZ], - *src, - *dst, - quote_char, - *cp; - int ch; - FILE *in_file; - - if ((cp = strrchr(argv[0], '/')) != NULL) - ++cp; - else - cp = argv[0]; - if (strcmp(cp, "detab") == 0) - del_tabs = 1; - - while ((ch = getopt(argc, argv, "cdhlmqs:t:")) != -1) - switch (ch) - { - case 'c': - clip_lines = TRUE; - break; - case 'd': - del_tabs = TRUE; - break; - case 'l': - protect_leading_whitespace = TRUE; - break; - case 'm': - /* only process text followed by periods in C comments */ - only_comment_periods = TRUE; - break; - case 'q': - protect_quotes = TRUE; - break; - case 's': - min_spaces = atoi(optarg); - break; - case 't': - tab_size = atoi(optarg); - break; - case 'h': - case '?': - fprintf(stderr, "USAGE: %s [ -cdqst ] [file ...]\n\ - -c (clip trailing whitespace)\n\ - -d (delete tabs)\n\ - -l (protect leading whitespace)\n\ - -m (only C comment periods)\n\ - -q (protect quotes)\n\ - -s minimum_spaces\n\ - -t tab_width\n", - cp); - exit(0); - } - - argv += optind; - argc -= optind; - - /* process arguments */ - do - { - if (argc < 1) - in_file = stdin; - else - { - if ((in_file = fopen(*argv, PG_BINARY_R)) == NULL) - { - fprintf(stderr, "Cannot open file %s: %s\n", argv[0], strerror(errno)); - exit(1); - } - argv++; - } - - escaped = FALSE; - - /* process lines */ - while (fgets(in_line, sizeof(in_line), in_file) != NULL) - { - col_in_tab = 0; - prv_spaces = 0; - src = in_line; /* points to current processed char */ - dst = out_line; /* points to next unallocated char */ - if (escaped == FALSE) - quote_char = ' '; - escaped = FALSE; - in_leading_whitespace = TRUE; - - /* process line */ - while (*src != NUL) - { - col_in_tab++; - - /* look backward so we handle slash-star-slash properly */ - if (!in_comment && src > in_line && - *(src - 1) == '/' && *src == '*') - in_comment = TRUE; - else if (in_comment && *src == '*' && *(src + 1) == '/') - in_comment = FALSE; - - /* Is this a potential space/tab replacement? */ - if ((!only_comment_periods || (in_comment && was_period)) && - (!protect_leading_whitespace || !in_leading_whitespace) && - quote_char == ' ' && (*src == ' ' || *src == '\t')) - { - if (*src == '\t') - { - prv_spaces += tab_size - col_in_tab + 1; - col_in_tab = tab_size; - } - else - prv_spaces++; - - /* Are we at a tab stop? */ - if (col_in_tab == tab_size) - { - /* - * Is the next character going to be a tab? We do tab - * replacement in the current spot if the next char is - * going to be a tab and ignore min_spaces. - */ - nxt_spaces = 0; - while (1) - { - /* Have we reached non-whitespace? */ - if (*(src + nxt_spaces + 1) == NUL || - (*(src + nxt_spaces + 1) != ' ' && - *(src + nxt_spaces + 1) != '\t')) - break; - /* count spaces */ - if (*(src + nxt_spaces + 1) == ' ') - ++nxt_spaces; - /* Have we found a forward tab? */ - if (*(src + nxt_spaces + 1) == '\t' || - nxt_spaces == tab_size) - { - nxt_spaces = tab_size; - break; - } - } - /* Do tab replacment for spaces? */ - if ((prv_spaces >= min_spaces || - nxt_spaces == tab_size) && - del_tabs == FALSE) - { - *(dst++) = '\t'; - prv_spaces = 0; - } - else - output_accumulated_spaces(&prv_spaces, &dst); - } - } - /* Not a potential space/tab replacement */ - else - { - /* allow leading stars in comments */ - if (in_leading_whitespace && *src != ' ' && *src != '\t' && - (!in_comment || *src != '*')) - in_leading_whitespace = FALSE; - was_period = (*src == '.'); - /* output accumulated spaces */ - output_accumulated_spaces(&prv_spaces, &dst); - /* This can only happen in a quote. */ - if (*src == '\t') - col_in_tab = 0; - /* visual backspace? */ - if (*src == '\b') - col_in_tab -= 2; - /* Do we process quotes? */ - if (escaped == FALSE && protect_quotes == TRUE) - { - if (*src == '\\') - escaped = TRUE; - /* Is this a quote character? */ - if (*src == '"' || *src == '\'') - { - /* toggle quote mode */ - if (quote_char == ' ') - quote_char = *src; - else if (*src == quote_char) - quote_char = ' '; - } - } - /* newlines/CRs do not terminate escapes */ - else if (*src != '\r' && *src != '\n') - escaped = FALSE; - - /* reached newline/CR; clip line? */ - if ((*src == '\r' || *src == '\n') && - clip_lines == TRUE && - quote_char == ' ' && - escaped == FALSE) - trim_trailing_whitespace(&prv_spaces, &dst, out_line); - *(dst++) = *src; - } - col_in_tab %= tab_size; - ++src; - } - /* for cases where the last line of file has no newline */ - if (clip_lines == TRUE && escaped == FALSE) - trim_trailing_whitespace(&prv_spaces, &dst, out_line); - output_accumulated_spaces(&prv_spaces, &dst); - *dst = NUL; - - if (fputs(out_line, stdout) == EOF) - { - fprintf(stderr, "Cannot write to output file %s: %s\n", argv[0], strerror(errno)); - exit(1); - } - } - } while (--argc > 0); - return 0; -} diff --git a/src/tools/findoidjoins/findoidjoins.c b/src/tools/findoidjoins/findoidjoins.c index 267107ddae..7ce519d726 100644 --- a/src/tools/findoidjoins/findoidjoins.c +++ b/src/tools/findoidjoins/findoidjoins.c @@ -51,7 +51,7 @@ main(int argc, char **argv) printfPQExpBuffer(&sql, "%s", "SET search_path = public;" "SELECT c.relname, (SELECT nspname FROM " - "pg_catalog.pg_namespace n WHERE n.oid = c.relnamespace) AS nspname " + "pg_catalog.pg_namespace n WHERE n.oid = c.relnamespace) AS nspname " "FROM pg_catalog.pg_class c " "WHERE c.relkind = " CppAsString2(RELKIND_RELATION) " AND c.relhasoids " diff --git a/src/tools/ifaddrs/test_ifaddrs.c b/src/tools/ifaddrs/test_ifaddrs.c index 100359ade1..b8dbb84945 100644 --- a/src/tools/ifaddrs/test_ifaddrs.c +++ b/src/tools/ifaddrs/test_ifaddrs.c @@ -15,7 +15,7 @@ static void -print_addr(struct sockaddr * addr) +print_addr(struct sockaddr *addr) { char buffer[256]; int ret, @@ -45,7 +45,7 @@ print_addr(struct sockaddr * addr) } static void -callback(struct sockaddr * addr, struct sockaddr * mask, void *unused) +callback(struct sockaddr *addr, struct sockaddr *mask, void *unused) { printf("addr: "); print_addr(addr); diff --git a/src/tools/pgindent/README b/src/tools/pgindent/README index ee27b732ec..ae425da285 100644 --- a/src/tools/pgindent/README +++ b/src/tools/pgindent/README @@ -10,11 +10,11 @@ http://adpgtech.blogspot.com/2015/05/running-pgindent-on-non-core-code-or.html PREREQUISITES: -1) Install pg_bsd_indent in your PATH (see below for details). +1) Install pg_bsd_indent in your PATH. Fetch its source code with + git clone https://git.postgresql.org/git/pg_bsd_indent.git + then follow the directions in README.pg_bsd_indent therein. -2) Install entab (src/tools/entab/). - -3) Install perltidy. Please be sure it is v20090616 (older and newer +2) Install perltidy. Please be sure it is v20090616 (older and newer versions make different formatting choices, and we want consistency). See https://sourceforge.net/projects/perltidy/files/perltidy/perltidy-20090616/ @@ -22,28 +22,21 @@ DOING THE INDENT RUN: 1) Change directory to the top of the source tree. -2) Remove all derived files (pgindent has trouble with flex files, and it - would be pointless to run it on them anyway): - - make maintainer-clean - Or: - git clean -fdx - -3) Download the latest typedef file from the buildfarm: +2) Download the latest typedef file from the buildfarm: wget -O src/tools/pgindent/typedefs.list https://buildfarm.postgresql.org/cgi-bin/typedefs.pl (See https://www.pgbuildfarm.org/cgi-bin/typedefs.pl?show_list for a full list of typedef files, if you want to indent some back branch.) -4) Run pgindent on the C files: +3) Run pgindent on the C files: src/tools/pgindent/pgindent If any files generate errors, restore their original versions with "git checkout", and see below for cleanup ideas. -5) Indent the Perl code using perltidy: +4) Indent the Perl code using perltidy: src/tools/pgindent/pgperltidy @@ -53,16 +46,20 @@ DOING THE INDENT RUN: VALIDATION: 1) Check for any newly-created files using "git status"; there shouldn't - be any. (perltidy tends to leave *.LOG files behind if it has trouble.) + be any. (pgindent leaves *.BAK files behind if it has trouble, while + perltidy leaves *.LOG files behind.) 2) Do a full test build: - ./configure ... + make -s clean make -s all # look for unexpected warnings, and errors of course make check-world Your configure switches should include at least --enable-tap-tests or else much of the Perl code won't get exercised. + The ecpg regression tests may well fail due to pgindent's updates of + header files that get copied into ecpg output; if so, adjust the + expected-files to match. 3) If you have the patience, it's worth eyeballing the "git diff" output for any egregiously ugly changes. See below for cleanup ideas. @@ -106,10 +103,10 @@ you're at it. BSD indent ---------- -We have standardized on NetBSD's indent, and renamed it pg_bsd_indent. -We have fixed a few bugs which requre the NetBSD source to be patched -with indent.bsd.patch patch. A fully patched version is available at -https://ftp.postgresql.org/pub/dev. +We have standardized on FreeBSD's indent, and renamed it pg_bsd_indent. +pg_bsd_indent does differ slightly from FreeBSD's version, mostly in +being more easily portable to non-BSD platforms. You can obtain it from +https://git.postgresql.org/git/pg_bsd_indent.git GNU indent, version 2.2.6, has several problems, and is not recommended. These bugs become pretty major when you are doing >500k lines of code. @@ -127,21 +124,28 @@ Which files are processed ------------------------- The pgindent run processes (nearly) all PostgreSQL *.c and *.h files, -but we currently exclude *.y and *.l files. Exceptions are listed +but we currently exclude *.y and *.l files, as well as *.c and *.h files +derived from *.y and *.l files. Additional exceptions are listed in exclude_file_patterns: src/include/storage/s_lock.h and src/include/port/atomics/ are excluded because they contain assembly code that pgindent tends to mess up. +src/backend/utils/fmgrtab.c is excluded because it confuses pgindent +and it's a derived file anyway. + src/interfaces/ecpg/test/expected/ is excluded to avoid breaking the ecpg -regression tests. Several *.h files are included in regression output so -should not be changed. +regression tests, since what ecpg generates is not necessarily formatted +as pgindent would do it. (Note that we do not exclude ecpg's header files +from the run; some of them get copied verbatim into ecpg's output, meaning +that the expected files may need to be updated to match.) src/include/snowball/libstemmer/ and src/backend/snowball/libstemmer/ are excluded because those files are imported from an external project, not maintained locally, and are machine-generated anyway. Likewise for plperl/ppport.h. + The perltidy run processes all *.pl and *.pm files, plus a few executable Perl scripts that are not named that way. See the "find" rules in pgperltidy for details. diff --git a/src/tools/pgindent/exclude_file_patterns b/src/tools/pgindent/exclude_file_patterns index 97ba092658..cb2f902a90 100644 --- a/src/tools/pgindent/exclude_file_patterns +++ b/src/tools/pgindent/exclude_file_patterns @@ -1,6 +1,7 @@ #list of file patterns to exclude from pgindent runs, see notes in README -/s_lock\.h$ -/atomics/ +/storage/s_lock\.h$ +/port/atomics/ +/utils/fmgrtab\.c$ /ecpg/test/expected/ /snowball/libstemmer/ /pl/plperl/ppport\.h$ diff --git a/src/tools/pgindent/indent.bsd.patch b/src/tools/pgindent/indent.bsd.patch deleted file mode 100644 index 1d7f64bc3d..0000000000 --- a/src/tools/pgindent/indent.bsd.patch +++ /dev/null @@ -1,288 +0,0 @@ -diff -c -r bsd_indent/Makefile pg_bsd_indent/Makefile -*** bsd_indent/Makefile Wed Oct 26 17:13:34 2011 ---- pg_bsd_indent/Makefile Wed Oct 12 12:17:12 2011 -*************** -*** 2,10 **** - # Makefile - # - # -! TARGET = indent - XFLAGS = -Wall -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char *copyright=" -! CFLAGS = -g - LIBS = - - $(TARGET) : args.o indent.o io.o lexi.o parse.o pr_comment.o ---- 2,10 ---- - # Makefile - # - # -! TARGET = pg_bsd_indent - XFLAGS = -Wall -D__RCSID="static char *rcsid=" -D__COPYRIGHT="static char *copyright=" -! CFLAGS = -O - LIBS = - - $(TARGET) : args.o indent.o io.o lexi.o parse.o pr_comment.o -*************** -*** 31,37 **** - clean: - rm -f *.o $(TARGET) log core - -! install: -! make clean -! make CFLAGS=-O - install -s -o bin -g bin $(TARGET) /usr/local/bin ---- 31,35 ---- - clean: - rm -f *.o $(TARGET) log core - -! install: $(TARGET) - install -s -o bin -g bin $(TARGET) /usr/local/bin -diff -c -r bsd_indent/README pg_bsd_indent/README -*** bsd_indent/README Wed Oct 26 17:13:34 2011 ---- pg_bsd_indent/README Mon Nov 14 19:30:24 2005 -*************** -*** 1,3 **** ---- 1,13 ---- -+ -+ This patch is from NetBSD current, 2005-11-14. It contains all the -+ patches need for its use in PostgreSQL. -+ -+ bjm -+ -+ --------------------------------------------------------------------------- -+ -+ -+ - This is the C indenter, it originally came from the University of Illinois - via some distribution tape for PDP-11 Unix. It has subsequently been - hacked upon by James Gosling @ CMU. It isn't very pretty, and really needs -diff -c -r bsd_indent/args.c pg_bsd_indent/args.c -*** bsd_indent/args.c Wed Oct 26 17:13:34 2011 ---- pg_bsd_indent/args.c Wed Oct 26 17:16:56 2011 -*************** -*** 83,88 **** ---- 83,90 ---- - #include <string.h> - #include "indent_globs.h" - -+ #define INDENT_PG_VERSION "1.1" -+ - /* profile types */ - #define PRO_SPECIAL 1 /* special case */ - #define PRO_BOOL 2 /* boolean */ -*************** -*** 99,106 **** ---- 101,113 ---- - #define STDIN 3 /* use stdin */ - #define KEY 4 /* type (keyword) */ - -+ #define KEY_FILE 5 /* only used for args */ -+ #define VERSION 6 /* only used for args */ -+ - char *option_source = "?"; - -+ void add_typedefs_from_file(char *str); -+ - /* - * N.B.: because of the way the table here is scanned, options whose names are - * substrings of other options must occur later; that is, with -lp vs -l, -lp -*************** -*** 118,123 **** ---- 125,136 ---- - "T", PRO_SPECIAL, 0, KEY, 0 - }, - { -+ "U", PRO_SPECIAL, 0, KEY_FILE, 0 -+ }, -+ { -+ "V", PRO_SPECIAL, 0, VERSION, 0 -+ }, -+ { - "bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation - }, - { -*************** -*** 425,430 **** ---- 438,456 ---- - } - break; - -+ case KEY_FILE: -+ if (*param_start == 0) -+ goto need_param; -+ add_typedefs_from_file(param_start); -+ break; -+ -+ case VERSION: -+ { -+ printf("pg_bsd_indent %s\n", INDENT_PG_VERSION); -+ exit(0); -+ } -+ break; -+ - default: - fprintf(stderr, "\ - indent: set_option: internal error: p_special %d\n", p->p_special); -*************** -*** 459,461 **** ---- 485,508 ---- - exit(1); - } - } -+ -+ -+ void -+ add_typedefs_from_file(char *str) -+ { -+ FILE *file; -+ char line[BUFSIZ]; -+ -+ if ((file = fopen(param_start, "r")) == NULL) -+ { -+ fprintf(stderr, "indent: cannot open file %s\n", str); -+ exit(1); -+ } -+ while ((fgets(line, BUFSIZ, file)) != NULL) -+ { -+ /* Remove trailing whitespace */ -+ *(line + strcspn(line, " \t\n\r")) = '\0'; -+ addkey(strdup(line), 4); -+ } -+ fclose(file); -+ } -Only in pg_bsd_indent: args.o -Only in pg_bsd_indent: indent.bsd.patch -Only in pg_bsd_indent: indent.o -diff -c -r bsd_indent/indent_globs.h pg_bsd_indent/indent_globs.h -*** bsd_indent/indent_globs.h Wed Oct 26 17:13:34 2011 ---- pg_bsd_indent/indent_globs.h Mon Nov 14 19:30:24 2005 -*************** -*** 239,245 **** - scomf, /* Same line comment font */ - bodyf; /* major body font */ - -! #define STACK_SIZE 150 - - EXTERN struct parser_state { - int last_token; ---- 239,249 ---- - scomf, /* Same line comment font */ - bodyf; /* major body font */ - -! /* -! * This controls the maximum number of 'else if' clauses supported. -! * If it is exceeded, comments are placed in column 100. -! */ -! #define STACK_SIZE 1000 - - EXTERN struct parser_state { - int last_token; -Only in pg_bsd_indent: io.o -diff -c -r bsd_indent/lexi.c pg_bsd_indent/lexi.c -*** bsd_indent/lexi.c Wed Oct 26 17:13:34 2011 ---- pg_bsd_indent/lexi.c Mon Nov 14 19:30:24 2005 -*************** -*** 93,99 **** - int rwcode; - }; - -! struct templ specials[1000] = - { - {"switch", 1}, - {"case", 2}, ---- 93,99 ---- - int rwcode; - }; - -! struct templ specials[16384] = - { - {"switch", 1}, - {"case", 2}, -*************** -*** 622,629 **** - else - p++; - if (p >= specials + sizeof specials / sizeof specials[0]) -! return; /* For now, table overflows are silently -! * ignored */ - p->rwd = key; - p->rwcode = val; - p[1].rwd = 0; ---- 622,632 ---- - else - p++; - if (p >= specials + sizeof specials / sizeof specials[0]) -! { -! fprintf(stderr, "indent: typedef table overflow\n"); -! exit(1); -! } -! - p->rwd = key; - p->rwcode = val; - p[1].rwd = 0; -Only in pg_bsd_indent: lexi.o -diff -c -r bsd_indent/parse.c pg_bsd_indent/parse.c -*** bsd_indent/parse.c Wed Oct 26 17:13:34 2011 ---- pg_bsd_indent/parse.c Mon Nov 14 19:30:24 2005 -*************** -*** 231,236 **** ---- 231,241 ---- - - } /* end of switch */ - -+ if (ps.tos >= STACK_SIZE) { -+ fprintf(stderr, "indent: stack size overflow\n"); -+ exit(1); -+ } -+ - reduce(); /* see if any reduction can be done */ - - #ifdef debug -Only in pg_bsd_indent: parse.o -diff -c -r bsd_indent/pr_comment.c pg_bsd_indent/pr_comment.c -*** bsd_indent/pr_comment.c Wed Oct 26 17:13:34 2011 ---- pg_bsd_indent/pr_comment.c Mon Nov 14 19:30:24 2005 -*************** -*** 148,154 **** - ps.box_com = true; - ps.com_col = 1; - } else { -! if (*buf_ptr == '-' || *buf_ptr == '*' || *buf_ptr == '\n') { - ps.box_com = true; /* a comment with a '-', '*' - * or newline immediately - * after the start comment is ---- 148,158 ---- - ps.box_com = true; - ps.com_col = 1; - } else { -! /* -! * Don't process '\n' or every comment is treated as a -! * block comment, meaning there is no wrapping. -! */ -! if (*buf_ptr == '-' || *buf_ptr == '*') { - ps.box_com = true; /* a comment with a '-', '*' - * or newline immediately - * after the start comment is -*************** -*** 328,333 **** ---- 332,350 ---- - goto end_of_comment; - } - } while (*buf_ptr == ' ' || *buf_ptr == '\t'); -+ -+ /* -+ * If there is a blank comment line, we need to prefix -+ * the line with the same three spaces that "/* " takes up. -+ * Without this code, blank stared lines in comments have -+ * three too-many characters on the line when wrapped. -+ */ -+ if (s_com == e_com) { -+ *e_com++ = ' '; /* add blanks for continuation */ -+ *e_com++ = ' '; -+ *e_com++ = ' '; -+ now_col += 3; -+ } - } else - if (++buf_ptr >= buf_end) - fill_buffer(); -Only in pg_bsd_indent: pr_comment.o diff --git a/src/tools/pgindent/pgcppindent b/src/tools/pgindent/pgcppindent deleted file mode 100755 index 59ddf4baca..0000000000 --- a/src/tools/pgindent/pgcppindent +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# src/tools/pgindent/pgcppindent - -trap "rm -f /tmp/$$ /tmp/$$a" 0 1 2 3 15 -entab </dev/null >/dev/null -if [ "$?" -ne 0 ] -then echo "Go to the src/tools/entab directory and do a 'make' and 'make install'." >&2 - echo "This will put the 'entab' command in your path." >&2 - echo "Then run $0 again." - exit 1 -fi -astyle --version </dev/null >/dev/null 2>&1 -if [ "$?" -eq 0 ] -then echo "You do not appear to have 'astyle' installed on your system." >&2 - exit 1 -fi - -for FILE -do - astyle --style=ansi -b -p -S < "$FILE" >/tmp/$$ 2>/tmp/$$a - if [ "$?" -ne 0 -o -s /tmp/$$a ] - then echo "$FILE" - cat /tmp/$$a - fi - cat /tmp/$$ | - entab -t4 -qc | - cat >/tmp/$$a && cat /tmp/$$a >"$FILE" -done diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent index f48af32426..104f4c253b 100755 --- a/src/tools/pgindent/pgindent +++ b/src/tools/pgindent/pgindent @@ -12,15 +12,12 @@ use IO::Handle; use Getopt::Long; # Update for pg_bsd_indent version -my $INDENT_VERSION = "1.3"; -my $devnull = File::Spec->devnull; - -# Common indent settings +my $INDENT_VERSION = "2.0"; +# Our standard indent settings my $indent_opts = - "-bad -bap -bc -bl -d0 -cdb -nce -nfc1 -di12 -i4 -l79 -lp -nip -npro -bbb"; + "-bad -bap -bbb -bc -bl -cli1 -cp33 -cdb -nce -d0 -di12 -nfc1 -i4 -l79 -lp -lpl -nip -npro -sac -tpg -ts4"; -# indent-dependent settings -my $extra_opts = ""; +my $devnull = File::Spec->devnull; my ($typedefs_file, $typedef_str, $code_base, $excludes, $indent, $build); @@ -41,9 +38,8 @@ run_build($code_base) if ($build); $typedefs_file ||= shift if @ARGV && $ARGV[0] !~ /\.[ch]$/; $typedefs_file ||= $ENV{PGTYPEDEFS}; -# build mode sets PGINDENT and PGENTAB +# build mode sets PGINDENT $indent ||= $ENV{PGINDENT} || $ENV{INDENT} || "pg_bsd_indent"; -my $entab = $ENV{PGENTAB} || "entab"; # no non-option arguments given. so do everything in the current directory $code_base ||= '.' unless @ARGV; @@ -60,25 +56,15 @@ my $filtered_typedefs_fh; sub check_indent { - system("$entab < $devnull"); - if ($?) - { - print STDERR -"Go to the src/tools/entab directory and do 'make' and 'make install'.\n", - "This will put the 'entab' command in your path.\n", - "Then run $0 again.\n"; - exit 1; - } - system("$indent -? < $devnull > $devnull 2>&1"); if ($? >> 8 != 1) { print STDERR - "You do not appear to have 'indent' installed on your system.\n"; + "You do not appear to have $indent installed on your system.\n"; exit 1; } - if (`$indent -V` !~ m/ $INDENT_VERSION$/) + if (`$indent --version` !~ m/ $INDENT_VERSION$/) { print STDERR "You do not appear to have $indent version $INDENT_VERSION installed on your system.\n"; @@ -89,13 +75,8 @@ sub check_indent if ($? == 0) { print STDERR - "You appear to have GNU indent rather than BSD indent.\n", - "See the pgindent/README file for a description of its problems.\n"; - $extra_opts = "-cdb -bli0 -npcs -cli4 -sc"; - } - else - { - $extra_opts = "-cli1"; + "You appear to have GNU indent rather than BSD indent.\n"; + exit 1; } } @@ -198,60 +179,16 @@ sub pre_indent { my $source = shift; - # remove trailing whitespace - $source =~ s/[ \t]+$//gm; - ## Comments # Convert // comments to /* */ $source =~ s!^([ \t]*)//(.*)$!$1/* $2 */!gm; - # 'else' followed by a single-line comment, followed by - # a brace on the next line confuses BSD indent, so we push - # the comment down to the next line, then later pull it - # back up again. Add space before _PGMV or indent will add - # it for us. - # AMD: A symptom of not getting this right is that you see errors like: - # FILE: ../../../src/backend/rewrite/rewriteHandler.c - # Error@2259: - # Stuff missing from end of file - $source =~ - s!(\}|[ \t])else[ \t]*(/\*)(.*\*/)[ \t]*$!$1else\n $2 _PGMV$3!gm; - - # Indent multi-line after-'else' comment so BSD indent will move it - # properly. We already moved down single-line comments above. - # Check for '*' to make sure we are not in a single-line comment that - # has other text on the line. - $source =~ s!(\}|[ \t])else[ \t]*(/\*[^*]*)[ \t]*$!$1else\n $2!gm; - - # Mark some comments for special treatment later + # Adjust dash-protected block comments so indent won't change them $source =~ s!/\* +---!/*---X_X!g; ## Other - # Work around bug where function that defines no local variables - # misindents switch() case lines and line after #else. Do not do - # for struct/enum. - my @srclines = split(/\n/, $source); - foreach my $lno (1 .. $#srclines) - { - my $l2 = $srclines[$lno]; - - # Line is only a single open brace in column 0 - next unless $l2 =~ /^\{[ \t]*$/; - - # previous line has a closing paren - next unless $srclines[ $lno - 1 ] =~ /\)/; - - # previous line was struct, etc. - next - if $srclines[ $lno - 1 ] =~ - m!=|^(struct|enum|[ \t]*typedef|extern[ \t]+"C")!; - - $srclines[$lno] = "$l2\nint pgindent_func_no_var_fix;"; - } - $source = join("\n", @srclines) . "\n"; # make sure there's a final \n - # Prevent indenting of code in 'extern "C"' blocks. # we replace the braces with comments which we'll reverse later my $extern_c_start = '/* Open extern "C" */'; @@ -260,6 +197,9 @@ sub pre_indent s!(^#ifdef[ \t]+__cplusplus.*\nextern[ \t]+"C"[ \t]*\n)\{[ \t]*$!$1$extern_c_start!gm; $source =~ s!(^#ifdef[ \t]+__cplusplus.*\n)\}[ \t]*$!$1$extern_c_stop!gm; + # Protect backslashes in DATA() and wrapping in CATALOG() + $source =~ s!^((DATA|CATALOG)\(.*)$!/*$1*/!gm; + return $source; } @@ -269,41 +209,27 @@ sub post_indent my $source = shift; my $source_filename = shift; - # put back braces for extern "C" + # Restore DATA/CATALOG lines + $source =~ s!^/\*((DATA|CATALOG)\(.*)\*/$!$1!gm; + + # Put back braces for extern "C" $source =~ s!^/\* Open extern "C" \*/$!{!gm; $source =~ s!^/\* Close extern "C" \*/$!}!gm; ## Comments - # remove special comment marker + # Undo change of dash-protected block comments $source =~ s!/\*---X_X!/* ---!g; - # Pull up single-line comment after 'else' that was pulled down above - $source =~ s!else\n[ \t]+/\* _PGMV!else\t/*!g; - - # Indent single-line after-'else' comment by only one tab. - $source =~ s!(\}|[ \t])else[ \t]+(/\*.*\*/)[ \t]*$!$1else\t$2!gm; - - # Add tab before comments with no whitespace before them (on a tab stop) - $source =~ s!(\S)(/\*.*\*/)$!$1\t$2!gm; - - # Remove blank line between opening brace and block comment. - $source =~ s!(\t*\{\n)\n([ \t]+/\*)$!$1$2!gm; - - # cpp conditionals - - # Reduce whitespace between #endif and comments to one tab - $source =~ s!^\#endif[ \t]+/\*!#endif /*!gm; + # Fix run-together comments to have a tab between them + $source =~ s!\*/(/\*.*\*/)$!*/\t$1!gm; ## Functions - # Work around misindenting of function with no variables defined. - $source =~ s!^[ \t]*int[ \t]+pgindent_func_no_var_fix;[ \t]*\n{1,2}!!gm; - # Use a single space before '*' in function return types $source =~ s!^([A-Za-z_]\S*)[ \t]+\*$!$1 *!gm; - # Move prototype names to the same line as return type. Useful + # Move prototype names to the same line as return type. Useful # for ctags. Indent should do this, but it does not. It formats # prototypes just like real functions. @@ -319,21 +245,6 @@ sub post_indent ) !$1 . (substr($1,-1,1) eq '*' ? '' : ' ') . $2!gmxe; - ## Other - - # Remove too much indenting after closing brace. - $source =~ s!^\}\t[ \t]+!}\t!gm; - - # Workaround indent bug that places excessive space before 'static'. - $source =~ s!^static[ \t]+!static !gm; - - # Remove leading whitespace from typedefs - $source =~ s!^[ \t]+typedef enum!typedef enum!gm - if $source_filename =~ 'libpq-(fe|events).h$'; - - # Remove trailing blank lines - $source =~ s!\n+\z!\n!; - return $source; } @@ -344,7 +255,7 @@ sub run_indent my $error_message = shift; my $cmd = - "$indent $indent_opts $extra_opts -U" . $filtered_typedefs_fh->filename; + "$indent $indent_opts -U" . $filtered_typedefs_fh->filename; my $tmp_fh = new File::Temp(TEMPLATE => "pgsrcXXXXX"); my $filename = $tmp_fh->filename; @@ -366,46 +277,6 @@ sub run_indent } -# XXX Ideally we'd implement entab/detab in pure perl. - -sub detab -{ - my $source = shift; - - my $tmp_fh = new File::Temp(TEMPLATE => "pgdetXXXXX"); - print $tmp_fh $source; - $tmp_fh->close(); - - open(my $entab, '-|', "$entab -d -t4 -qc " . $tmp_fh->filename); - local ($/) = undef; - $source = <$entab>; - close($entab); - - return $source; -} - - -sub entab -{ - my $source = shift; - - my $tmp_fh = new File::Temp(TEMPLATE => "pgentXXXXX"); - print $tmp_fh $source; - $tmp_fh->close(); - - open( - my $entab, - '-|', - "$entab -d -t8 -qc " - . $tmp_fh->filename - . " | $entab -t4 -qc | $entab -d -t4 -m"); - local ($/) = undef; - $source = <$entab>; - close($entab); - - return $source; -} - # for development diagnostics sub diff @@ -461,29 +332,18 @@ sub run_build $ENV{PGTYPEDEFS} = abs_path('tmp_typedefs.list'); - my $pg_bsd_indent_url = - "https://ftp.postgresql.org/pub/dev/pg_bsd_indent-" - . $INDENT_VERSION - . ".tar.gz"; - - $rv = getstore($pg_bsd_indent_url, "pg_bsd_indent.tgz"); - - die "cannot fetch BSD indent tarfile from $pg_bsd_indent_url\n" - unless is_success($rv); - - # XXX add error checking here + my $indentrepo = "https://git.postgresql.org/git/pg_bsd_indent.git"; + system("git clone $indentrepo >$devnull 2>&1"); + die "could not fetch pg_bsd_indent sources from $indentrepo\n" + unless $? == 0; - system("tar -z -xf pg_bsd_indent.tgz"); - chdir "pg_bsd_indent"; - system("make > $devnull 2>&1"); + chdir "pg_bsd_indent" || die; + system("make all check >$devnull"); + die "could not build pg_bsd_indent from source\n" + unless $? == 0; $ENV{PGINDENT} = abs_path('pg_bsd_indent'); - chdir "../../entab"; - system("make > $devnull 2>&1"); - - $ENV{PGENTAB} = abs_path('entab'); - chdir $save_dir; } @@ -504,8 +364,8 @@ sub build_clean chdir "$code_base"; - system("rm -rf src/tools/pgindent/bsdindent"); - system("git clean -q -f src/tools/entab src/tools/pgindent"); + system("rm -rf src/tools/pgindent/pg_bsd_indent"); + system("rm -f src/tools/pgindent/tmp_typedefs.list"); } @@ -529,21 +389,26 @@ $filtered_typedefs_fh = load_typedefs(); check_indent(); -# make sure we process any non-option arguments. +# any non-option arguments are files to be processed push(@files, @ARGV); foreach my $source_filename (@files) { + # Automatically ignore .c and .h files that correspond to a .y or .l + # file. indent tends to get badly confused by Bison/flex output, + # and there's no value in indenting derived files anyway. + my $otherfile = $source_filename; + $otherfile =~ s/\.[ch]$/.y/; + next if $otherfile ne $source_filename && -f $otherfile; + $otherfile =~ s/\.y$/.l/; + next if $otherfile ne $source_filename && -f $otherfile; + my $source = read_source($source_filename); + my $orig_source = $source; my $error_message = ''; $source = pre_indent($source); - # Protect backslashes in DATA() and wrapping in CATALOG() - - $source = detab($source); - $source =~ s!^((DATA|CATALOG)\(.*)$!/*$1*/!gm; - $source = run_indent($source, \$error_message); if ($source eq "") { @@ -551,13 +416,9 @@ foreach my $source_filename (@files) next; } - # Restore DATA/CATALOG lines; must be done here so tab alignment is preserved - $source =~ s!^/\*((DATA|CATALOG)\(.*)\*/$!$1!gm; - $source = entab($source); - $source = post_indent($source, $source_filename); - write_source($source, $source_filename); + write_source($source, $source_filename) if $source ne $orig_source; } build_clean($code_base) if $build; diff --git a/src/tools/pgindent/pgindent.man b/src/tools/pgindent/pgindent.man index 4765d428b6..1c5aedda35 100644 --- a/src/tools/pgindent/pgindent.man +++ b/src/tools/pgindent/pgindent.man @@ -11,18 +11,14 @@ it without any parameters at the top of the source tree you want to process. If you don't have all the requirements installed, pgindent will fetch and build them for you, if you're in a PostgreSQL source tree: - pgindent --build -If your indent program is not installed in your path, you can specify it -by setting the environment variable INDENT, or PGINDENT, or by giving the +If your pg_bsd_indent program is not installed in your path, you can specify +it by setting the environment variable INDENT, or PGINDENT, or by giving the command line option --indent: pgindent --indent=/opt/extras/bsdindent -Similarly, the entab program can be specified using the PGENTAB environment -variable, or using the --entab command line option. - pgindent also needs a file containing a list of typedefs. This can be specified using the PGTYPEDEFS environment variable, or via the command line --typedefs option. If neither is used, it will look for it within the diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list index eaa6d32904..23a4bbd8de 100644 --- a/src/tools/pgindent/typedefs.list +++ b/src/tools/pgindent/typedefs.list @@ -590,6 +590,7 @@ ExplainFormat ExplainOneQuery_hook_type ExplainState ExplainStmt +ExportedSnapshot Expr ExprContext ExprContextCallbackFunction diff --git a/src/tools/testint128.c b/src/tools/testint128.c index b6c8a0a4ef..afdfd15cb0 100644 --- a/src/tools/testint128.c +++ b/src/tools/testint128.c @@ -45,7 +45,7 @@ typedef union int64 hi; #endif } hl; -} test128; +} test128; /* @@ -134,7 +134,7 @@ main(int argc, char **argv) } /* check multiplication */ - t1.i128 = (int128) x *(int128) y; + t1.i128 = (int128) x * (int128) y; t2.hl.hi = t2.hl.lo = 0; int128_add_int64_mul_int64(&t2.I128, x, y); diff --git a/src/tutorial/complex.c b/src/tutorial/complex.c index ea7051bdeb..1b5ebc2ff0 100644 --- a/src/tutorial/complex.c +++ b/src/tutorial/complex.c @@ -18,7 +18,7 @@ typedef struct Complex { double x; double y; -} Complex; +} Complex; /***************************************************************************** diff --git a/src/tutorial/funcs.c b/src/tutorial/funcs.c index 61ad1417a8..721c0c87fc 100644 --- a/src/tutorial/funcs.c +++ b/src/tutorial/funcs.c @@ -25,7 +25,7 @@ float8 *add_one_float8(float8 *arg); Point *makepoint(Point *pointx, Point *pointy); text *copytext(text *t); text *concat_text(text *arg1, text *arg2); -bool c_overpaid(HeapTupleHeader t, /* the current instance of EMP */ +bool c_overpaid(HeapTupleHeader t, /* the current instance of EMP */ int32 limit); @@ -75,9 +75,9 @@ copytext(text *t) /* * VARDATA is a pointer to the data region of the struct. */ - memcpy((void *) VARDATA(new_t), /* destination */ + memcpy((void *) VARDATA(new_t), /* destination */ (void *) VARDATA(t), /* source */ - VARSIZE(t) - VARHDRSZ); /* how many bytes */ + VARSIZE(t) - VARHDRSZ); /* how many bytes */ return new_t; } diff --git a/src/tutorial/funcs_new.c b/src/tutorial/funcs_new.c index 2e09f8de6e..091ca639cf 100644 --- a/src/tutorial/funcs_new.c +++ b/src/tutorial/funcs_new.c @@ -81,9 +81,9 @@ copytext(PG_FUNCTION_ARGS) * VARDATA is a pointer to the data region of the new struct. The source * could be a short datum, so retrieve its data through VARDATA_ANY. */ - memcpy((void *) VARDATA(new_t), /* destination */ - (void *) VARDATA_ANY(t), /* source */ - VARSIZE_ANY_EXHDR(t)); /* how many bytes */ + memcpy((void *) VARDATA(new_t), /* destination */ + (void *) VARDATA_ANY(t), /* source */ + VARSIZE_ANY_EXHDR(t)); /* how many bytes */ PG_RETURN_TEXT_P(new_t); } |