Run pgindent on 9.2 source tree in preparation for first 9.3
authorBruce Momjian <[email protected]>
Sun, 10 Jun 2012 19:20:04 +0000 (15:20 -0400)
committerBruce Momjian <[email protected]>
Sun, 10 Jun 2012 19:20:04 +0000 (15:20 -0400)
commit-fest.

494 files changed:
contrib/auto_explain/auto_explain.c
contrib/dblink/dblink.c
contrib/file_fdw/file_fdw.c
contrib/pg_archivecleanup/pg_archivecleanup.c
contrib/pg_stat_statements/pg_stat_statements.c
contrib/pg_test_fsync/pg_test_fsync.c
contrib/pg_test_timing/pg_test_timing.c
contrib/pg_trgm/trgm_gist.c
contrib/pg_upgrade/check.c
contrib/pg_upgrade/controldata.c
contrib/pg_upgrade/exec.c
contrib/pg_upgrade/file.c
contrib/pg_upgrade/function.c
contrib/pg_upgrade/info.c
contrib/pg_upgrade/option.c
contrib/pg_upgrade/pg_upgrade.c
contrib/pg_upgrade/pg_upgrade.h
contrib/pg_upgrade/relfilenode.c
contrib/pg_upgrade/server.c
contrib/pg_upgrade/tablespace.c
contrib/pg_upgrade/version_old_8_3.c
contrib/pgbench/pgbench.c
contrib/pgcrypto/crypt-md5.c
contrib/pgcrypto/px.h
contrib/pgstattuple/pgstatindex.c
contrib/pgstattuple/pgstattuple.c
contrib/sepgsql/database.c
contrib/sepgsql/dml.c
contrib/sepgsql/hooks.c
contrib/sepgsql/label.c
contrib/sepgsql/proc.c
contrib/sepgsql/relation.c
contrib/sepgsql/schema.c
contrib/sepgsql/sepgsql.h
contrib/sepgsql/uavc.c
contrib/spi/refint.c
contrib/vacuumlo/vacuumlo.c
contrib/xml2/xpath.c
contrib/xml2/xslt_proc.c
src/backend/access/gist/gist.c
src/backend/access/gist/gistbuild.c
src/backend/access/gist/gistbuildbuffers.c
src/backend/access/gist/gistproc.c
src/backend/access/gist/gistscan.c
src/backend/access/gist/gistsplit.c
src/backend/access/hash/hashovfl.c
src/backend/access/heap/heapam.c
src/backend/access/heap/hio.c
src/backend/access/heap/tuptoaster.c
src/backend/access/heap/visibilitymap.c
src/backend/access/index/genam.c
src/backend/access/index/indexam.c
src/backend/access/nbtree/nbtcompare.c
src/backend/access/nbtree/nbtpage.c
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtsearch.c
src/backend/access/nbtree/nbtutils.c
src/backend/access/spgist/spgdoinsert.c
src/backend/access/spgist/spginsert.c
src/backend/access/spgist/spgkdtreeproc.c
src/backend/access/spgist/spgquadtreeproc.c
src/backend/access/spgist/spgscan.c
src/backend/access/spgist/spgtextproc.c
src/backend/access/spgist/spgutils.c
src/backend/access/spgist/spgvacuum.c
src/backend/access/spgist/spgxlog.c
src/backend/access/transam/clog.c
src/backend/access/transam/slru.c
src/backend/access/transam/twophase.c
src/backend/access/transam/varsup.c
src/backend/access/transam/xact.c
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogutils.c
src/backend/catalog/aclchk.c
src/backend/catalog/dependency.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/namespace.c
src/backend/catalog/objectaddress.c
src/backend/catalog/pg_constraint.c
src/backend/catalog/pg_depend.c
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_shdepend.c
src/backend/catalog/storage.c
src/backend/commands/analyze.c
src/backend/commands/cluster.c
src/backend/commands/copy.c
src/backend/commands/createas.c
src/backend/commands/dbcommands.c
src/backend/commands/dropcmds.c
src/backend/commands/explain.c
src/backend/commands/extension.c
src/backend/commands/foreigncmds.c
src/backend/commands/functioncmds.c
src/backend/commands/indexcmds.c
src/backend/commands/lockcmds.c
src/backend/commands/opclasscmds.c
src/backend/commands/prepare.c
src/backend/commands/proclang.c
src/backend/commands/seclabel.c
src/backend/commands/sequence.c
src/backend/commands/tablecmds.c
src/backend/commands/tablespace.c
src/backend/commands/trigger.c
src/backend/commands/typecmds.c
src/backend/commands/user.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/commands/view.c
src/backend/executor/execCurrent.c
src/backend/executor/execMain.c
src/backend/executor/execQual.c
src/backend/executor/execUtils.c
src/backend/executor/functions.c
src/backend/executor/nodeBitmapHeapscan.c
src/backend/executor/nodeIndexonlyscan.c
src/backend/executor/nodeMaterial.c
src/backend/executor/nodeMergeAppend.c
src/backend/executor/nodeMergejoin.c
src/backend/executor/nodeModifyTable.c
src/backend/executor/nodeSetOp.c
src/backend/executor/spi.c
src/backend/libpq/auth.c
src/backend/libpq/be-secure.c
src/backend/libpq/hba.c
src/backend/libpq/pqcomm.c
src/backend/nodes/bitmapset.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/list.c
src/backend/nodes/nodeFuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/print.c
src/backend/nodes/readfuncs.c
src/backend/nodes/tidbitmap.c
src/backend/optimizer/geqo/geqo_selection.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/equivclass.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/planagg.c
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/prep/prepjointree.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/placeholder.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/predtest.c
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/var.c
src/backend/parser/analyze.c
src/backend/parser/parse_coerce.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/parser/parse_relation.c
src/backend/parser/parse_target.c
src/backend/parser/parse_type.c
src/backend/parser/parse_utilcmd.c
src/backend/port/darwin/system.c
src/backend/port/dynloader/aix.h
src/backend/port/dynloader/cygwin.h
src/backend/port/dynloader/freebsd.h
src/backend/port/dynloader/irix.h
src/backend/port/dynloader/linux.h
src/backend/port/dynloader/netbsd.h
src/backend/port/dynloader/openbsd.h
src/backend/port/dynloader/osf.h
src/backend/port/dynloader/sco.h
src/backend/port/dynloader/solaris.h
src/backend/port/dynloader/unixware.h
src/backend/port/dynloader/win32.h
src/backend/port/unix_latch.c
src/backend/port/win32/mingwcompat.c
src/backend/port/win32/socket.c
src/backend/port/win32/timer.c
src/backend/port/win32_latch.c
src/backend/port/win32_sema.c
src/backend/postmaster/autovacuum.c
src/backend/postmaster/bgwriter.c
src/backend/postmaster/checkpointer.c
src/backend/postmaster/pgarch.c
src/backend/postmaster/pgstat.c
src/backend/postmaster/postmaster.c
src/backend/postmaster/syslogger.c
src/backend/postmaster/walwriter.c
src/backend/regex/regc_locale.c
src/backend/regex/regc_pg_locale.c
src/backend/regex/regcomp.c
src/backend/regex/rege_dfa.c
src/backend/regex/regerror.c
src/backend/regex/regexec.c
src/backend/replication/basebackup.c
src/backend/replication/syncrep.c
src/backend/replication/walreceiver.c
src/backend/replication/walreceiverfuncs.c
src/backend/replication/walsender.c
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteSupport.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/freelist.c
src/backend/storage/file/fd.c
src/backend/storage/ipc/pmsignal.c
src/backend/storage/ipc/procarray.c
src/backend/storage/ipc/sinval.c
src/backend/storage/ipc/sinvaladt.c
src/backend/storage/ipc/standby.c
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/lwlock.c
src/backend/storage/lmgr/predicate.c
src/backend/storage/lmgr/proc.c
src/backend/storage/lmgr/s_lock.c
src/backend/storage/smgr/md.c
src/backend/storage/smgr/smgr.c
src/backend/tcop/postgres.c
src/backend/tcop/utility.c
src/backend/tsearch/dict_thesaurus.c
src/backend/tsearch/spell.c
src/backend/tsearch/to_tsany.c
src/backend/tsearch/ts_utils.c
src/backend/utils/adt/acl.c
src/backend/utils/adt/array_selfuncs.c
src/backend/utils/adt/array_typanalyze.c
src/backend/utils/adt/cash.c
src/backend/utils/adt/date.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/dbsize.c
src/backend/utils/adt/float.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/inet_net_pton.c
src/backend/utils/adt/json.c
src/backend/utils/adt/lockfuncs.c
src/backend/utils/adt/mac.c
src/backend/utils/adt/misc.c
src/backend/utils/adt/numeric.c
src/backend/utils/adt/pg_locale.c
src/backend/utils/adt/pgstatfuncs.c
src/backend/utils/adt/rangetypes.c
src/backend/utils/adt/rangetypes_gist.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/tsgistidx.c
src/backend/utils/adt/tsquery_util.c
src/backend/utils/adt/tsrank.c
src/backend/utils/adt/tsvector_op.c
src/backend/utils/adt/varbit.c
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varlena.c
src/backend/utils/adt/xml.c
src/backend/utils/cache/catcache.c
src/backend/utils/cache/inval.c
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/plancache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/ts_cache.c
src/backend/utils/error/elog.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/fmgr/funcapi.c
src/backend/utils/init/miscinit.c
src/backend/utils/mb/wchar.c
src/backend/utils/misc/guc.c
src/backend/utils/mmgr/portalmem.c
src/backend/utils/sort/sortsupport.c
src/backend/utils/sort/tuplesort.c
src/backend/utils/sort/tuplestore.c
src/backend/utils/time/snapmgr.c
src/backend/utils/time/tqual.c
src/bin/initdb/findtimezone.c
src/bin/initdb/initdb.c
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_receivexlog.c
src/bin/pg_basebackup/receivelog.c
src/bin/pg_basebackup/receivelog.h
src/bin/pg_basebackup/streamutil.c
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_dump/common.c
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/dumputils.h
src/bin/pg_dump/pg_backup.h
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_custom.c
src/bin/pg_dump/pg_backup_db.c
src/bin/pg_dump/pg_backup_directory.c
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump_sort.c
src/bin/pg_dump/pg_dumpall.c
src/bin/pgevent/pgevent.c
src/bin/psql/command.c
src/bin/psql/common.c
src/bin/psql/copy.c
src/bin/psql/describe.c
src/bin/psql/help.c
src/bin/psql/input.c
src/bin/psql/print.c
src/bin/psql/print.h
src/bin/psql/startup.c
src/bin/psql/stringutils.c
src/bin/psql/tab-complete.c
src/bin/psql/variables.c
src/bin/scripts/clusterdb.c
src/bin/scripts/common.c
src/bin/scripts/common.h
src/bin/scripts/createlang.c
src/bin/scripts/dropdb.c
src/bin/scripts/droplang.c
src/bin/scripts/reindexdb.c
src/bin/scripts/vacuumdb.c
src/include/access/gist_private.h
src/include/access/heapam.h
src/include/access/htup.h
src/include/access/nbtree.h
src/include/access/slru.h
src/include/access/spgist.h
src/include/access/spgist_private.h
src/include/access/xact.h
src/include/access/xlog_internal.h
src/include/catalog/catalog.h
src/include/catalog/genbki.h
src/include/catalog/index.h
src/include/catalog/namespace.h
src/include/catalog/objectaccess.h
src/include/catalog/objectaddress.h
src/include/catalog/pg_aggregate.h
src/include/catalog/pg_attrdef.h
src/include/catalog/pg_attribute.h
src/include/catalog/pg_constraint.h
src/include/catalog/pg_control.h
src/include/catalog/pg_database.h
src/include/catalog/pg_db_role_setting.h
src/include/catalog/pg_default_acl.h
src/include/catalog/pg_description.h
src/include/catalog/pg_extension.h
src/include/catalog/pg_foreign_data_wrapper.h
src/include/catalog/pg_foreign_server.h
src/include/catalog/pg_foreign_table.h
src/include/catalog/pg_index.h
src/include/catalog/pg_language.h
src/include/catalog/pg_largeobject.h
src/include/catalog/pg_largeobject_metadata.h
src/include/catalog/pg_namespace.h
src/include/catalog/pg_opclass.h
src/include/catalog/pg_operator.h
src/include/catalog/pg_pltemplate.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_range.h
src/include/catalog/pg_rewrite.h
src/include/catalog/pg_seclabel.h
src/include/catalog/pg_shdescription.h
src/include/catalog/pg_shseclabel.h
src/include/catalog/pg_statistic.h
src/include/catalog/pg_tablespace.h
src/include/catalog/pg_trigger.h
src/include/catalog/pg_ts_dict.h
src/include/catalog/pg_type.h
src/include/commands/createas.h
src/include/commands/defrem.h
src/include/commands/explain.h
src/include/commands/tablecmds.h
src/include/commands/typecmds.h
src/include/commands/vacuum.h
src/include/datatype/timestamp.h
src/include/executor/executor.h
src/include/executor/instrument.h
src/include/executor/spi_priv.h
src/include/foreign/fdwapi.h
src/include/lib/stringinfo.h
src/include/libpq/hba.h
src/include/libpq/ip.h
src/include/nodes/execnodes.h
src/include/nodes/parsenodes.h
src/include/nodes/primnodes.h
src/include/nodes/relation.h
src/include/optimizer/cost.h
src/include/optimizer/pathnode.h
src/include/optimizer/paths.h
src/include/optimizer/prep.h
src/include/optimizer/subselect.h
src/include/parser/analyze.h
src/include/pg_config_manual.h
src/include/pg_trace.h
src/include/pgstat.h
src/include/port.h
src/include/port/win32.h
src/include/postgres.h
src/include/postmaster/postmaster.h
src/include/regex/regguts.h
src/include/replication/walprotocol.h
src/include/replication/walreceiver.h
src/include/replication/walsender_private.h
src/include/rewrite/rewriteSupport.h
src/include/snowball/header.h
src/include/storage/barrier.h
src/include/storage/latch.h
src/include/storage/lock.h
src/include/storage/lwlock.h
src/include/storage/predicate.h
src/include/storage/proc.h
src/include/storage/procarray.h
src/include/storage/sinval.h
src/include/storage/smgr.h
src/include/tsearch/ts_public.h
src/include/utils/acl.h
src/include/utils/builtins.h
src/include/utils/guc.h
src/include/utils/guc_tables.h
src/include/utils/json.h
src/include/utils/lsyscache.h
src/include/utils/memutils.h
src/include/utils/pg_crc_tables.h
src/include/utils/plancache.h
src/include/utils/rangetypes.h
src/include/utils/rel.h
src/include/utils/selfuncs.h
src/include/utils/sortsupport.h
src/include/utils/timestamp.h
src/include/utils/tqual.h
src/include/utils/typcache.h
src/include/utils/xml.h
src/interfaces/ecpg/ecpglib/connect.c
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/extern.h
src/interfaces/ecpg/pgtypeslib/dt.h
src/interfaces/ecpg/preproc/type.c
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-protocol2.c
src/interfaces/libpq/fe-protocol3.c
src/interfaces/libpq/fe-secure.c
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-int.h
src/interfaces/libpq/test/uri-regress.c
src/pl/plperl/plperl.c
src/pl/plperl/plperl_helpers.h
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpython/plpy_cursorobject.c
src/pl/plpython/plpy_cursorobject.h
src/pl/plpython/plpy_elog.c
src/pl/plpython/plpy_elog.h
src/pl/plpython/plpy_exec.c
src/pl/plpython/plpy_exec.h
src/pl/plpython/plpy_main.c
src/pl/plpython/plpy_main.h
src/pl/plpython/plpy_planobject.h
src/pl/plpython/plpy_plpymodule.c
src/pl/plpython/plpy_plpymodule.h
src/pl/plpython/plpy_procedure.h
src/pl/plpython/plpy_resultobject.c
src/pl/plpython/plpy_resultobject.h
src/pl/plpython/plpy_spi.c
src/pl/plpython/plpy_spi.h
src/pl/plpython/plpy_subxactobject.c
src/pl/plpython/plpy_subxactobject.h
src/pl/plpython/plpy_typeio.c
src/pl/plpython/plpy_typeio.h
src/pl/plpython/plpy_util.c
src/pl/plpython/plpy_util.h
src/pl/plpython/plpython.h
src/port/erand48.c
src/port/fls.c
src/port/getaddrinfo.c
src/port/path.c
src/port/win32setlocale.c
src/test/isolation/isolationtester.c
src/test/regress/pg_regress.c
src/test/thread/thread_test.c
src/timezone/pgtz.c
src/tools/msvc/Install.pm
src/tools/msvc/MSBuildProject.pm
src/tools/msvc/Mkvcbuild.pm
src/tools/msvc/Project.pm
src/tools/msvc/Solution.pm
src/tools/msvc/VCBuildProject.pm
src/tools/msvc/VSObjectFactory.pm
src/tools/msvc/build.pl
src/tools/msvc/builddoc.pl
src/tools/msvc/config_default.pl
src/tools/msvc/gendef.pl
src/tools/msvc/install.pl
src/tools/msvc/pgbison.pl
src/tools/msvc/pgflex.pl
src/tools/msvc/vcregress.pl

index e48ea489dc5bb87f48037d058a4aae9f30a54f0d..ad333b664471aee25c15ff6dd4dcde5ac702845c 100644 (file)
@@ -23,7 +23,7 @@ static int    auto_explain_log_min_duration = -1; /* msec or -1 */
 static bool auto_explain_log_analyze = false;
 static bool auto_explain_log_verbose = false;
 static bool auto_explain_log_buffers = false;
-static bool auto_explain_log_timing  = false;
+static bool auto_explain_log_timing = false;
 static int     auto_explain_log_format = EXPLAIN_FORMAT_TEXT;
 static bool auto_explain_log_nested_statements = false;
 
index 71acb35af6ff3a7d6e5a7cd3e57688cb56a687fb..1e62d8091a9d2bdf60af6745d5a01ee14ee5cf5a 100644 (file)
@@ -1140,7 +1140,7 @@ storeHandler(PGresult *res, const PGdataValue *columns,
         * strings and add null termination.  As a micro-optimization, allocate
         * all the strings with one palloc.
         */
-       pbuflen = nfields;              /* count the null terminators themselves */
+       pbuflen = nfields;                      /* count the null terminators themselves */
        for (i = 0; i < nfields; i++)
        {
                int                     len = columns[i].len;
index 66fd0e62cc8da2b9f9b31ae4568ddf1fb3b0d3b6..e3b9223b3ee7a102efef7e1c18192eb64494864b 100644 (file)
@@ -109,17 +109,17 @@ PG_FUNCTION_INFO_V1(file_fdw_validator);
  * FDW callback routines
  */
 static void fileGetForeignRelSize(PlannerInfo *root,
-                                                                 RelOptInfo *baserel,
-                                                                 Oid foreigntableid);
+                                         RelOptInfo *baserel,
+                                         Oid foreigntableid);
 static void fileGetForeignPaths(PlannerInfo *root,
-                                                               RelOptInfo *baserel,
-                                                               Oid foreigntableid);
+                                       RelOptInfo *baserel,
+                                       Oid foreigntableid);
 static ForeignScan *fileGetForeignPlan(PlannerInfo *root,
-                                                                          RelOptInfo *baserel,
-                                                                          Oid foreigntableid,
-                                                                          ForeignPath *best_path,
-                                                                          List *tlist,
-                                                                          List *scan_clauses);
+                                  RelOptInfo *baserel,
+                                  Oid foreigntableid,
+                                  ForeignPath *best_path,
+                                  List *tlist,
+                                  List *scan_clauses);
 static void fileExplainForeignScan(ForeignScanState *node, ExplainState *es);
 static void fileBeginForeignScan(ForeignScanState *node, int eflags);
 static TupleTableSlot *fileIterateForeignScan(ForeignScanState *node);
@@ -141,7 +141,7 @@ static void estimate_size(PlannerInfo *root, RelOptInfo *baserel,
 static void estimate_costs(PlannerInfo *root, RelOptInfo *baserel,
                           FileFdwPlanState *fdw_private,
                           Cost *startup_cost, Cost *total_cost);
-static int     file_acquire_sample_rows(Relation onerel, int elevel,
+static int file_acquire_sample_rows(Relation onerel, int elevel,
                                                 HeapTuple *rows, int targrows,
                                                 double *totalrows, double *totaldeadrows);
 
@@ -180,7 +180,7 @@ file_fdw_validator(PG_FUNCTION_ARGS)
        List       *options_list = untransformRelOptions(PG_GETARG_DATUM(0));
        Oid                     catalog = PG_GETARG_OID(1);
        char       *filename = NULL;
-       DefElem    *force_not_null = NULL;
+       DefElem    *force_not_null = NULL;
        List       *other_options = NIL;
        ListCell   *cell;
 
@@ -233,7 +233,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.")));
                }
 
                /*
@@ -393,13 +393,13 @@ get_file_fdw_attribute_options(Oid relid)
                options = GetForeignColumnOptions(relid, attnum);
                foreach(lc, options)
                {
-                       DefElem    *def = (DefElem *) lfirst(lc);
+                       DefElem    *def = (DefElem *) lfirst(lc);
 
                        if (strcmp(def->defname, "force_not_null") == 0)
                        {
                                if (defGetBoolean(def))
                                {
-                                       char   *attname = pstrdup(NameStr(attr->attname));
+                                       char       *attname = pstrdup(NameStr(attr->attname));
 
                                        fnncolumns = lappend(fnncolumns, makeString(attname));
                                }
@@ -429,8 +429,8 @@ fileGetForeignRelSize(PlannerInfo *root,
        FileFdwPlanState *fdw_private;
 
        /*
-        * Fetch options.  We only need filename at this point, but we might
-        * as well get everything and not need to re-fetch it later in planning.
+        * Fetch options.  We only need filename at this point, but we might as
+        * well get everything and not need to re-fetch it later in planning.
         */
        fdw_private = (FileFdwPlanState *) palloc(sizeof(FileFdwPlanState));
        fileGetOptions(foreigntableid,
@@ -468,13 +468,14 @@ fileGetForeignPaths(PlannerInfo *root,
                                                                         baserel->rows,
                                                                         startup_cost,
                                                                         total_cost,
-                                                                        NIL, /* no pathkeys */
-                                                                        NULL, /* no outer rel either */
-                                                                        NIL)); /* no fdw_private data */
+                                                                        NIL,           /* no pathkeys */
+                                                                        NULL,          /* no outer rel either */
+                                                                        NIL));         /* no fdw_private data */
 
        /*
         * If data file was sorted, and we knew it somehow, we could insert
-        * appropriate pathkeys into the ForeignPath node to tell the planner that.
+        * appropriate pathkeys into the ForeignPath node to tell the planner
+        * that.
         */
 }
 
@@ -505,8 +506,8 @@ fileGetForeignPlan(PlannerInfo *root,
        return make_foreignscan(tlist,
                                                        scan_clauses,
                                                        scan_relid,
-                                                       NIL, /* no expressions to evaluate */
-                                                       NIL); /* no private state either */
+                                                       NIL,    /* no expressions to evaluate */
+                                                       NIL);           /* no private state either */
 }
 
 /*
@@ -665,14 +666,14 @@ fileAnalyzeForeignTable(Relation relation,
 {
        char       *filename;
        List       *options;
-       struct stat     stat_buf;
+       struct stat stat_buf;
 
        /* Fetch options of foreign table */
        fileGetOptions(RelationGetRelid(relation), &filename, &options);
 
        /*
-        * Get size of the file.  (XXX if we fail here, would it be better to
-        * just return false to skip analyzing the table?)
+        * Get size of the file.  (XXX if we fail here, would it be better to just
+        * return false to skip analyzing the table?)
         */
        if (stat(filename, &stat_buf) < 0)
                ereport(ERROR,
@@ -746,7 +747,7 @@ estimate_size(PlannerInfo *root, RelOptInfo *baserel,
                 * planner's idea of the relation width; which is bogus if not all
                 * columns are being read, not to mention that the text representation
                 * of a row probably isn't the same size as its internal
-                * representation.  Possibly we could do something better, but the
+                * representation.      Possibly we could do something better, but the
                 * real answer to anyone who complains is "ANALYZE" ...
                 */
                int                     tuple_width;
@@ -811,7 +812,7 @@ estimate_costs(PlannerInfo *root, RelOptInfo *baserel,
  * which must have at least targrows entries.
  * The actual number of rows selected is returned as the function result.
  * We also count the total number of rows in the file and return it into
- * *totalrows.  Note that *totaldeadrows is always set to 0.
+ * *totalrows. Note that *totaldeadrows is always set to 0.
  *
  * Note that the returned list of rows is not always in order by physical
  * position in the file.  Therefore, correlation estimates derived later
@@ -824,7 +825,7 @@ file_acquire_sample_rows(Relation onerel, int elevel,
                                                 double *totalrows, double *totaldeadrows)
 {
        int                     numrows = 0;
-       double          rowstoskip = -1; /* -1 means not set yet */
+       double          rowstoskip = -1;        /* -1 means not set yet */
        double          rstate;
        TupleDesc       tupDesc;
        Datum      *values;
@@ -853,8 +854,8 @@ file_acquire_sample_rows(Relation onerel, int elevel,
        cstate = BeginCopyFrom(onerel, filename, NIL, options);
 
        /*
-        * Use per-tuple memory context to prevent leak of memory used to read rows
-        * from the file with Copy routines.
+        * Use per-tuple memory context to prevent leak of memory used to read
+        * rows from the file with Copy routines.
         */
        tupcontext = AllocSetContextCreate(CurrentMemoryContext,
                                                                           "file_fdw temporary context",
@@ -912,10 +913,10 @@ file_acquire_sample_rows(Relation onerel, int elevel,
                        if (rowstoskip <= 0)
                        {
                                /*
-                                * Found a suitable tuple, so save it, replacing one
-                                * old tuple at random
+                                * Found a suitable tuple, so save it, replacing one old tuple
+                                * at random
                                 */
-                               int             k = (int) (targrows * anl_random_fract());
+                               int                     k = (int) (targrows * anl_random_fract());
 
                                Assert(k >= 0 && k < targrows);
                                heap_freetuple(rows[k]);
index 20977805c8deab6df569263894069afa4a494ca5..a226101bbc47b36e3f21a9ae374b65adbcf5b166 100644 (file)
@@ -37,7 +37,7 @@ 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 */
@@ -136,12 +136,13 @@ CleanupPriorWALFiles(void)
                         * they were originally written, in case this worries you.
                         */
                        if (strlen(walfile) == XLOG_DATA_FNAME_LEN &&
-                       strspn(walfile, "0123456789ABCDEF") == XLOG_DATA_FNAME_LEN &&
+                               strspn(walfile, "0123456789ABCDEF") == XLOG_DATA_FNAME_LEN &&
                                strcmp(walfile + 8, exclusiveCleanupFileName + 8) < 0)
                        {
-                               /* 
-                                * Use the original file name again now, including any extension
-                                * that might have been chopped off before testing the sequence.
+                               /*
+                                * Use the original file name again now, including any
+                                * extension that might have been chopped off before testing
+                                * the sequence.
                                 */
                                snprintf(WALFilePath, MAXPGPATH, "%s/%s",
                                                 archiveLocation, xlde->d_name);
@@ -150,7 +151,7 @@ CleanupPriorWALFiles(void)
                                {
                                        /*
                                         * Prints the name of the file to be removed and skips the
-                                        * actual removal.  The regular printout is so that the
+                                        * actual removal.      The regular printout is so that the
                                         * user can pipe the output into some other program.
                                         */
                                        printf("%s\n", WALFilePath);
@@ -298,7 +299,8 @@ main(int argc, char **argv)
                                dryrun = true;
                                break;
                        case 'x':
-                               additional_ext = optarg; /* Extension to remove from xlogfile names */
+                               additional_ext = optarg;                /* Extension to remove from
+                                                                                                * xlogfile names */
                                break;
                        default:
                                fprintf(stderr, "Try \"%s --help\" for more information.\n", progname);
index 06869fa344e8a5b23c613574f26787dd2e424fb8..aa11c144d68cf4c8a224d1cdcdd61a74c824ed47 100644 (file)
@@ -103,19 +103,19 @@ typedef struct Counters
        int64           calls;                  /* # of times executed */
        double          total_time;             /* total execution time, in msec */
        int64           rows;                   /* total # of retrieved or affected rows */
-       int64           shared_blks_hit;                /* # of shared buffer hits */
+       int64           shared_blks_hit;        /* # of shared buffer hits */
        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_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           temp_blks_read;                 /* # of temp blocks read */
+       int64           temp_blks_read; /* # of temp blocks read */
        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 */
+       double          blk_read_time;  /* time spent reading, in msec */
+       double          blk_write_time; /* time spent writing, in msec */
+       double          usage;                  /* usage factor */
 } Counters;
 
 /*
@@ -140,7 +140,7 @@ typedef struct pgssSharedState
 {
        LWLockId        lock;                   /* protects hashtable search/modification */
        int                     query_size;             /* max query length in bytes */
-       double          cur_median_usage;       /* current median usage in hashtable */
+       double          cur_median_usage;               /* current median usage in hashtable */
 } pgssSharedState;
 
 /*
@@ -150,7 +150,7 @@ typedef struct pgssLocationLen
 {
        int                     location;               /* start offset in query text */
        int                     length;                 /* length in bytes, or -1 to ignore */
-}      pgssLocationLen;
+} pgssLocationLen;
 
 /*
  * Working state for computing a query jumble and producing a normalized
@@ -172,7 +172,7 @@ typedef struct pgssJumbleState
 
        /* Current number of valid entries in clocations array */
        int                     clocations_count;
-}      pgssJumbleState;
+} pgssJumbleState;
 
 /*---- Local variables ----*/
 
@@ -248,21 +248,21 @@ static uint32 pgss_hash_string(const char *str);
 static void pgss_store(const char *query, uint32 queryId,
                   double total_time, uint64 rows,
                   const BufferUsage *bufusage,
-                  pgssJumbleState * jstate);
+                  pgssJumbleState *jstate);
 static Size pgss_memsize(void);
 static pgssEntry *entry_alloc(pgssHashKey *key, const char *query,
-                                                         int query_len, bool sticky);
+                       int query_len, bool sticky);
 static void entry_dealloc(void);
 static void entry_reset(void);
-static void AppendJumble(pgssJumbleState * jstate,
+static void AppendJumble(pgssJumbleState *jstate,
                         const unsigned char *item, Size size);
-static void JumbleQuery(pgssJumbleState * jstate, Query *query);
-static void JumbleRangeTable(pgssJumbleState * jstate, List *rtable);
-static void JumbleExpr(pgssJumbleState * jstate, Node *node);
-static void RecordConstLocation(pgssJumbleState * jstate, int location);
-static char *generate_normalized_query(pgssJumbleState * jstate, const char *query,
+static void JumbleQuery(pgssJumbleState *jstate, Query *query);
+static void JumbleRangeTable(pgssJumbleState *jstate, List *rtable);
+static void JumbleExpr(pgssJumbleState *jstate, Node *node);
+static void RecordConstLocation(pgssJumbleState *jstate, int location);
+static char *generate_normalized_query(pgssJumbleState *jstate, const char *query,
                                                  int *query_len_p, int encoding);
-static void fill_in_constant_lengths(pgssJumbleState * jstate, const char *query);
+static void fill_in_constant_lengths(pgssJumbleState *jstate, const char *query);
 static int     comp_location(const void *a, const void *b);
 
 
@@ -513,8 +513,8 @@ pgss_shmem_startup(void)
        FreeFile(file);
 
        /*
-        * Remove the file so it's not included in backups/replication
-        * slaves, etc. A new file will be written on next shutdown.
+        * Remove the file so it's not included in backups/replication slaves,
+        * etc. A new file will be written on next shutdown.
         */
        unlink(PGSS_DUMP_FILE);
 
@@ -600,7 +600,7 @@ error:
        ereport(LOG,
                        (errcode_for_file_access(),
                         errmsg("could not write pg_stat_statement file \"%s\": %m",
-                                       PGSS_DUMP_FILE  ".tmp")));
+                                       PGSS_DUMP_FILE ".tmp")));
        if (file)
                FreeFile(file);
        unlink(PGSS_DUMP_FILE ".tmp");
@@ -626,8 +626,8 @@ pgss_post_parse_analyze(ParseState *pstate, Query *query)
         * the statement contains an optimizable statement for which a queryId
         * could be derived (such as EXPLAIN or DECLARE CURSOR).  For such cases,
         * runtime control will first go through ProcessUtility and then the
-        * executor, and we don't want the executor hooks to do anything, since
-        * we are already measuring the statement's costs at the utility level.
+        * executor, and we don't want the executor hooks to do anything, since we
+        * are already measuring the statement's costs at the utility level.
         */
        if (query->utilityStmt)
        {
@@ -768,7 +768,7 @@ pgss_ExecutorEnd(QueryDesc *queryDesc)
 
                pgss_store(queryDesc->sourceText,
                                   queryId,
-                                  queryDesc->totaltime->total * 1000.0, /* convert to msec */
+                                  queryDesc->totaltime->total * 1000.0,                /* convert to msec */
                                   queryDesc->estate->es_processed,
                                   &queryDesc->totaltime->bufusage,
                                   NULL);
@@ -789,10 +789,9 @@ pgss_ProcessUtility(Node *parsetree, const char *queryString,
                                        DestReceiver *dest, char *completionTag)
 {
        /*
-        * If it's an EXECUTE statement, we don't track it and don't increment
-        * the nesting level.  This allows the cycles to be charged to the
-        * underlying PREPARE instead (by the Executor hooks), which is much more
-        * useful.
+        * If it's an EXECUTE statement, we don't track it and don't increment the
+        * nesting level.  This allows the cycles to be charged to the underlying
+        * PREPARE instead (by the Executor hooks), which is much more useful.
         *
         * We also don't track execution of PREPARE.  If we did, we would get one
         * hash table entry for the PREPARE (with hash calculated from the query
@@ -942,7 +941,7 @@ static void
 pgss_store(const char *query, uint32 queryId,
                   double total_time, uint64 rows,
                   const BufferUsage *bufusage,
-                  pgssJumbleState * jstate)
+                  pgssJumbleState *jstate)
 {
        pgssHashKey key;
        pgssEntry  *entry;
@@ -1355,7 +1354,7 @@ entry_reset(void)
  * the current jumble.
  */
 static void
-AppendJumble(pgssJumbleState * jstate, const unsigned char *item, Size size)
+AppendJumble(pgssJumbleState *jstate, const unsigned char *item, Size size)
 {
        unsigned char *jumble = jstate->jumble;
        Size            jumble_len = jstate->jumble_len;
@@ -1404,7 +1403,7 @@ AppendJumble(pgssJumbleState * jstate, const unsigned char *item, Size size)
  * of information).
  */
 static void
-JumbleQuery(pgssJumbleState * jstate, Query *query)
+JumbleQuery(pgssJumbleState *jstate, Query *query)
 {
        Assert(IsA(query, Query));
        Assert(query->utilityStmt == NULL);
@@ -1431,7 +1430,7 @@ JumbleQuery(pgssJumbleState * jstate, Query *query)
  * Jumble a range table
  */
 static void
-JumbleRangeTable(pgssJumbleState * jstate, List *rtable)
+JumbleRangeTable(pgssJumbleState *jstate, List *rtable)
 {
        ListCell   *lc;
 
@@ -1485,11 +1484,11 @@ JumbleRangeTable(pgssJumbleState * jstate, List *rtable)
  *
  * Note: the reason we don't simply use expression_tree_walker() is that the
  * point of that function is to support tree walkers that don't care about
- * most tree node types, but here we care about all types.  We should complain
+ * most tree node types, but here we care about all types.     We should complain
  * about any unrecognized node type.
  */
 static void
-JumbleExpr(pgssJumbleState * jstate, Node *node)
+JumbleExpr(pgssJumbleState *jstate, Node *node)
 {
        ListCell   *temp;
 
@@ -1874,7 +1873,7 @@ JumbleExpr(pgssJumbleState * jstate, Node *node)
  * that is currently being walked.
  */
 static void
-RecordConstLocation(pgssJumbleState * jstate, int location)
+RecordConstLocation(pgssJumbleState *jstate, int location)
 {
        /* -1 indicates unknown or undefined location */
        if (location >= 0)
@@ -1909,7 +1908,7 @@ RecordConstLocation(pgssJumbleState * jstate, int location)
  * Returns a palloc'd string, which is not necessarily null-terminated.
  */
 static char *
-generate_normalized_query(pgssJumbleState * jstate, const char *query,
+generate_normalized_query(pgssJumbleState *jstate, const char *query,
                                                  int *query_len_p, int encoding)
 {
        char       *norm_query;
@@ -2007,7 +2006,7 @@ generate_normalized_query(pgssJumbleState * jstate, const char *query,
  * a problem.
  *
  * Duplicate constant pointers are possible, and will have their lengths
- * marked as '-1', so that they are later ignored.  (Actually, we assume the
+ * marked as '-1', so that they are later ignored.     (Actually, we assume the
  * lengths were initialized as -1 to start with, and don't change them here.)
  *
  * N.B. There is an assumption that a '-' character at a Const location begins
@@ -2015,7 +2014,7 @@ generate_normalized_query(pgssJumbleState * jstate, const char *query,
  * reason for a constant to start with a '-'.
  */
 static void
-fill_in_constant_lengths(pgssJumbleState * jstate, const char *query)
+fill_in_constant_lengths(pgssJumbleState *jstate, const char *query)
 {
        pgssLocationLen *locs;
        core_yyscan_t yyscanner;
index 7f92bc88182beedf3bfd1881f90ec5c4d0fcf4ce..9fe2301e419a569d6f6111c606a22c01c2690c9a 100644 (file)
@@ -29,7 +29,7 @@
 
 /* These are macros to avoid timing the function call overhead. */
 #ifndef WIN32
-#define START_TIMER    \
+#define START_TIMER \
 do { \
        alarm_triggered = false; \
        alarm(secs_per_test); \
@@ -37,7 +37,7 @@ do { \
 } while (0)
 #else
 /* WIN32 doesn't support alarm, so we create a thread and sleep there */
-#define START_TIMER    \
+#define START_TIMER \
 do { \
        alarm_triggered = false; \
        if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \
@@ -55,7 +55,7 @@ do { \
        gettimeofday(&stop_t, NULL); \
        print_elapse(start_t, stop_t, ops); \
 } while (0)
-               
+
 
 static const char *progname;
 
@@ -77,6 +77,7 @@ static void test_sync(int writes_per_op);
 static void test_open_syncs(void);
 static void test_open_sync(const char *msg, int writes_size);
 static void test_file_descriptor_sync(void);
+
 #ifndef WIN32
 static void process_alarm(int sig);
 #else
index 4e43694338bed648fe0b674952465b694e058844..b3f98abe5cb6b1bc37253d00d0ba68b6fd75e543 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     pg_test_timing.c
- *             tests overhead of timing calls and their monotonicity:  that
- *             they always move forward
+ *             tests overhead of timing calls and their monotonicity:  that
+ *             they always move forward
  */
 
 #include "postgres_fe.h"
@@ -35,8 +35,8 @@ handle_args(int argc, char *argv[])
                {"duration", required_argument, NULL, 'd'},
                {NULL, 0, NULL, 0}
        };
-       int option;                     /* Command line option */
-       int     optindex = 0;   /* used by getopt_long */
+       int                     option;                 /* Command line option */
+       int                     optindex = 0;   /* used by getopt_long */
 
        if (argc > 1)
        {
@@ -87,7 +87,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);
@@ -98,16 +98,22 @@ handle_args(int argc, char *argv[])
 static void
 test_timing(int32 duration)
 {
-       uint64 total_time;
-       int64 time_elapsed = 0;
-       uint64 loop_count = 0;
-       uint64 prev, cur;
-       int32 diff, i, bits, found;
-
-       instr_time start_time, end_time, temp;
+       uint64          total_time;
+       int64           time_elapsed = 0;
+       uint64          loop_count = 0;
+       uint64          prev,
+                               cur;
+       int32           diff,
+                               i,
+                               bits,
+                               found;
+
+       instr_time      start_time,
+                               end_time,
+                               temp;
 
        static int64 histogram[32];
-       char    buf[100];
+       char            buf[100];
 
        total_time = duration > 0 ? duration * 1000000 : 0;
 
@@ -146,7 +152,7 @@ test_timing(int32 duration)
        INSTR_TIME_SUBTRACT(end_time, start_time);
 
        printf("Per loop time including overhead: %0.2f nsec\n",
-                       INSTR_TIME_GET_DOUBLE(end_time) * 1e9 / loop_count);
+                  INSTR_TIME_GET_DOUBLE(end_time) * 1e9 / loop_count);
        printf("Histogram of timing durations:\n");
        printf("%9s: %10s %9s\n", "< usec", "count", "percent");
 
index 57bce012070a49bb2c5e2d45140bffcd8a307669..d59c8eb670b44c4c8b79e6b92baa0f68e6ce4e73 100644 (file)
@@ -199,9 +199,9 @@ gtrgm_consistent(PG_FUNCTION_ARGS)
         * trigram extraction is relatively CPU-expensive.      We must include
         * strategy number because trigram extraction depends on strategy.
         *
-        * The cached structure contains the strategy number, then the input
-        * query (starting at a MAXALIGN boundary), then the TRGM value (also
-        * starting at a MAXALIGN boundary).
+        * The cached structure contains the strategy number, then the input query
+        * (starting at a MAXALIGN boundary), then the TRGM value (also starting
+        * at a MAXALIGN boundary).
         */
        if (cache == NULL ||
                strategy != *((StrategyNumber *) cache) ||
@@ -341,8 +341,7 @@ gtrgm_distance(PG_FUNCTION_ARGS)
        char       *cache = (char *) fcinfo->flinfo->fn_extra;
 
        /*
-        * Cache the generated trigrams across multiple calls with the same
-        * query.
+        * Cache the generated trigrams across multiple calls with the same query.
         */
        if (cache == NULL ||
                VARSIZE(cache) != querysize ||
index 2669c096586743aa2580696915d00f10abaeed3c..eed4a1eba7c7cebf271aa9ba22728f515a65d358 100644 (file)
@@ -168,7 +168,7 @@ issue_warnings(char *sequence_script_file_name)
                                          SYSTEMQUOTE "\"%s/psql\" --echo-queries "
                                          "--set ON_ERROR_STOP=on "
                                          "--no-psqlrc --port %d --username \"%s\" "
-                                         "-f \"%s\" --dbname template1 >> \"%s\" 2>&1" SYSTEMQUOTE,
+                                  "-f \"%s\" --dbname template1 >> \"%s\" 2>&1" SYSTEMQUOTE,
                                          new_cluster.bindir, new_cluster.port, os_info.user,
                                          sequence_script_file_name, UTILITY_LOG_FILE);
                        unlink(sequence_script_file_name);
@@ -204,7 +204,7 @@ 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);
 
        pg_log(PG_REPORT,
@@ -238,7 +238,8 @@ check_cluster_versions(void)
 
        /*
         * We can't allow downgrading because we use the target pg_dumpall, and
-        * pg_dumpall cannot operate on new database versions, only older versions.
+        * pg_dumpall cannot operate on new database versions, only older
+        * versions.
         */
        if (old_cluster.major_version > new_cluster.major_version)
                pg_log(PG_FATAL, "This utility cannot be used to downgrade to older major PostgreSQL versions.\n");
@@ -402,31 +403,31 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
 #endif
 
        fprintf(script, "echo %sThis script will generate minimal optimizer statistics rapidly%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %sso your system is usable, and then gather statistics twice more%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %swith increasing accuracy.  When it is done, your system will%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %shave the default level of optimizer statistics.%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo\n\n");
 
        fprintf(script, "echo %sIf you have used ALTER TABLE to modify the statistics target for%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %sany tables, you might want to remove them and restore them after%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %srunning this script because they will delay fast statistics generation.%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo\n\n");
 
        fprintf(script, "echo %sIf you would like default statistics as quickly as possible, cancel%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %sthis script and run:%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %s    vacuumdb --all %s%s\n", ECHO_QUOTE,
-               /* Did we copy the free space files? */
-               (GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ?
-               "--analyze-only" : "--analyze", ECHO_QUOTE);
+       /* Did we copy the free space files? */
+                       (GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ?
+                       "--analyze-only" : "--analyze", ECHO_QUOTE);
        fprintf(script, "echo\n\n");
 
 #ifndef WIN32
@@ -441,15 +442,15 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
 #endif
 
        fprintf(script, "echo %sGenerating minimal optimizer statistics (1 target)%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %s--------------------------------------------------%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "vacuumdb --all --analyze-only\n");
        fprintf(script, "echo\n");
        fprintf(script, "echo %sThe server is now available with minimal optimizer statistics.%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %sQuery performance will be optimal once this script completes.%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo\n\n");
 
 #ifndef WIN32
@@ -462,9 +463,9 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
 #endif
 
        fprintf(script, "echo %sGenerating medium optimizer statistics (10 targets)%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %s---------------------------------------------------%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "vacuumdb --all --analyze-only\n");
        fprintf(script, "echo\n\n");
 
@@ -475,17 +476,17 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
 #endif
 
        fprintf(script, "echo %sGenerating default (full) optimizer statistics (100 targets?)%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "echo %s-------------------------------------------------------------%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
        fprintf(script, "vacuumdb --all %s\n",
-               /* Did we copy the free space files? */
-               (GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ?
-               "--analyze-only" : "--analyze");
+       /* Did we copy the free space files? */
+                       (GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ?
+                       "--analyze-only" : "--analyze");
 
        fprintf(script, "echo\n\n");
        fprintf(script, "echo %sDone%s\n",
-                                       ECHO_QUOTE, ECHO_QUOTE);
+                       ECHO_QUOTE, ECHO_QUOTE);
 
        fclose(script);
 
@@ -716,8 +717,8 @@ check_for_isn_and_int8_passing_mismatch(ClusterInfo *cluster)
                pg_log(PG_REPORT, "fatal\n");
                pg_log(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"
@@ -764,9 +765,9 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
                PGconn     *conn = connectToServer(cluster, active_db->db_name);
 
                /*
-                *      While several relkinds don't store any data, e.g. views, they
-                *      can be used to define data types of other columns, so we
-                *      check all relkinds.
+                * While several relkinds don't store any data, e.g. views, they can
+                * be used to define data types of other columns, so we check all
+                * relkinds.
                 */
                res = executeQueryOrDie(conn,
                                                                "SELECT n.nspname, c.relname, a.attname "
@@ -777,16 +778,16 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
                                                                "               NOT a.attisdropped AND "
                                                                "               a.atttypid IN ( "
                  "                     'pg_catalog.regproc'::pg_catalog.regtype, "
-                 "                     'pg_catalog.regprocedure'::pg_catalog.regtype, "
+                                                               "                       'pg_catalog.regprocedure'::pg_catalog.regtype, "
                  "                     'pg_catalog.regoper'::pg_catalog.regtype, "
-                 "                     'pg_catalog.regoperator'::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.regdictionary'::pg_catalog.regtype) AND "
-                 "             c.relnamespace = n.oid AND "
-                 "             n.nspname != 'pg_catalog' AND "
-                 "             n.nspname != 'information_schema'");
+               "                       'pg_catalog.regconfig'::pg_catalog.regtype, "
+                                                               "                       'pg_catalog.regdictionary'::pg_catalog.regtype) AND "
+                                                               "               c.relnamespace = n.oid AND "
+                                                         "             n.nspname != 'pg_catalog' AND "
+                                                "              n.nspname != 'information_schema'");
 
                ntups = PQntuples(res);
                i_nspname = PQfnumber(res, "nspname");
@@ -822,8 +823,8 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
                pg_log(PG_REPORT, "fatal\n");
                pg_log(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);
@@ -836,9 +837,11 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
 static void
 get_bin_version(ClusterInfo *cluster)
 {
-       char            cmd[MAXPGPATH], cmd_output[MAX_STRING];
+       char            cmd[MAXPGPATH],
+                               cmd_output[MAX_STRING];
        FILE       *output;
-       int                     pre_dot, post_dot;
+       int                     pre_dot,
+                               post_dot;
 
        snprintf(cmd, sizeof(cmd), "\"%s/pg_ctl\" --version", cluster->bindir);
 
@@ -858,4 +861,3 @@ get_bin_version(ClusterInfo *cluster)
 
        cluster->bin_version = (pre_dot * 100 + post_dot) * 100;
 }
-
index e01280db9e284b5527c5d7db0afc481247e1e017..6bffe549e59610846eaa391f63bb956ab05d37f3 100644 (file)
@@ -129,6 +129,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
                pg_log(PG_VERBOSE, "%s", bufin);
 
 #ifdef WIN32
+
                /*
                 * Due to an installer bug, LANG=C doesn't work for PG 8.3.3, but does
                 * work 8.2.6 and 8.3.7, so check for non-ASCII output and suggest a
@@ -506,7 +507,7 @@ check_control_data(ControlData *oldctrl,
                 * This is a common 8.3 -> 8.4 upgrade problem, so we are more verbose
                 */
                pg_log(PG_FATAL,
-                          "You will need to rebuild the new server with configure option\n"
+                       "You will need to rebuild the new server with configure option\n"
                           "--disable-integer-datetimes or get server binaries built with those\n"
                           "options.\n");
        }
@@ -531,6 +532,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);
 }
index 68cf0795aabdb7f734d2528980cf4bbad6a8a46f..9e63bd5856839b1c6f099cdb0b5e53ea34ec19d4 100644 (file)
@@ -18,8 +18,9 @@
 static void check_data_dir(const char *pg_data);
 static void check_bin_dir(ClusterInfo *cluster);
 static void validate_exec(const char *dir, const char *cmdName);
+
 #ifdef WIN32
-static int win32_check_directory_write_permissions(void);
+static int     win32_check_directory_write_permissions(void);
 #endif
 
 
@@ -64,7 +65,7 @@ exec_prog(bool throw_error, bool is_priv,
                pg_log(throw_error ? PG_FATAL : PG_REPORT,
                           "Consult the last few lines of \"%s\" for\n"
                           "the probable cause of the failure.\n",
-                               log_file);
+                          log_file);
                return 1;
        }
 
@@ -142,12 +143,12 @@ verify_directories(void)
 static int
 win32_check_directory_write_permissions(void)
 {
-       int fd;
+       int                     fd;
 
        /*
-        *      We open a file we would normally create anyway.  We do this even in
-        *      'check' mode, which isn't ideal, but this is the best we can do.
-        */     
+        * We open a file we would normally create anyway.      We do this even in
+        * 'check' mode, which isn't ideal, but this is the best we can do.
+        */
        if ((fd = open(GLOBALS_DUMP_FILE, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) < 0)
                return -1;
        close(fd);
@@ -184,7 +185,7 @@ check_data_dir(const char *pg_data)
                struct stat statBuf;
 
                snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
-                       /* Win32 can't stat() a directory with a trailing slash. */
+               /* Win32 can't stat() a directory with a trailing slash. */
                                 *requiredSubdirs[subdirnum] ? "/" : "",
                                 requiredSubdirs[subdirnum]);
 
index 0276636e03fa4208134b0d4aa91c2c037c9c432f..1dd3722142c9e83c1ec228099c3a3fd302a2179b 100644 (file)
@@ -233,7 +233,7 @@ copy_file(const char *srcfile, const char *dstfile, bool force)
  * large number of times.
  */
 int
-load_directory(const char *dirname, struct dirent ***namelist)
+load_directory(const char *dirname, struct dirent *** namelist)
 {
        DIR                *dirdesc;
        struct dirent *direntry;
@@ -251,7 +251,7 @@ load_directory(const char *dirname, struct dirent ***namelist)
                count++;
 
                *namelist = (struct dirent **) realloc((void *) (*namelist),
-                                       (size_t) ((name_num + 1) * sizeof(struct dirent *)));
+                                               (size_t) ((name_num + 1) * sizeof(struct dirent *)));
 
                if (*namelist == NULL)
                {
@@ -314,7 +314,6 @@ win32_pghardlink(const char *src, const char *dst)
        else
                return 0;
 }
-
 #endif
 
 
@@ -322,13 +321,11 @@ win32_pghardlink(const char *src, const char *dst)
 FILE *
 fopen_priv(const char *path, const char *mode)
 {
-       mode_t old_umask = umask(S_IRWXG | S_IRWXO);
-       FILE    *fp;
+       mode_t          old_umask = umask(S_IRWXG | S_IRWXO);
+       FILE       *fp;
 
        fp = fopen(path, mode);
        umask(old_umask);
 
        return fp;
 }
-       
-
index b4b17badb28ce8abfa2f946c33572c01f98fa021..77bd3a0359771498d7b6aaabc6467ba37a7ef55c 100644 (file)
@@ -133,7 +133,7 @@ get_loadable_libraries(void)
        int                     totaltups;
        int                     dbnum;
        bool            found_public_plpython_handler = false;
-       
+
        ress = (PGresult **) pg_malloc(old_cluster.dbarr.ndbs * sizeof(PGresult *));
        totaltups = 0;
 
@@ -144,10 +144,10 @@ get_loadable_libraries(void)
                PGconn     *conn = connectToServer(&old_cluster, active_db->db_name);
 
                /*
-                *      Fetch all libraries referenced in this DB.  We can't exclude
-                *      the "pg_catalog" schema because, while such functions are not
-                *      explicitly dumped by pg_dump, they do reference implicit objects
-                *      that pg_dump does dump, e.g. CREATE LANGUAGE plperl.
+                * Fetch all libraries referenced in this DB.  We can't exclude the
+                * "pg_catalog" schema because, while such functions are not
+                * explicitly dumped by pg_dump, they do reference implicit objects
+                * that pg_dump does dump, e.g. CREATE LANGUAGE plperl.
                 */
                ress[dbnum] = executeQueryOrDie(conn,
                                                                                "SELECT DISTINCT probin "
@@ -158,26 +158,26 @@ get_loadable_libraries(void)
                                                                                FirstNormalObjectId);
                totaltups += PQntuples(ress[dbnum]);
 
-                /*
-                 *     Systems that install plpython before 8.1 have
-                 *     plpython_call_handler() defined in the "public" schema, causing
-                 *     pg_dumpall to dump it.  However that function still references
-                 *     "plpython" (no "2"), so it throws an error on restore.  This code
-                 *     checks for the problem function, reports affected databases to the
-                 *     user and explains how to remove them.
-                 *     8.1 git commit: e0dedd0559f005d60c69c9772163e69c204bac69
-                 *     http://archives.postgresql.org/pgsql-hackers/2012-03/msg01101.php
-                 *     http://archives.postgresql.org/pgsql-bugs/2012-05/msg00206.php
-                 */
+               /*
+                * Systems that install plpython before 8.1 have
+                * plpython_call_handler() defined in the "public" schema, causing
+                * pg_dumpall to dump it.  However that function still references
+                * "plpython" (no "2"), so it throws an error on restore.  This code
+                * checks for the problem function, reports affected databases to the
+                * user and explains how to remove them. 8.1 git commit:
+                * e0dedd0559f005d60c69c9772163e69c204bac69
+                * http://archives.postgresql.org/pgsql-hackers/2012-03/msg01101.php
+                * http://archives.postgresql.org/pgsql-bugs/2012-05/msg00206.php
+                */
                if (GET_MAJOR_VERSION(old_cluster.major_version) < 901)
                {
-                       PGresult  *res;
+                       PGresult   *res;
 
                        res = executeQueryOrDie(conn,
                                                                        "SELECT 1 "
-                                                                       "FROM   pg_catalog.pg_proc JOIN pg_namespace "
-                                                                       "               ON pronamespace = pg_namespace.oid "
-                                                                       "WHERE proname = 'plpython_call_handler' AND "
+                                                  "FROM        pg_catalog.pg_proc JOIN pg_namespace "
+                                                        "              ON pronamespace = pg_namespace.oid "
+                                                          "WHERE proname = 'plpython_call_handler' AND "
                                                                        "nspname = 'public' AND "
                                                                        "prolang = 13 /* C */ AND "
                                                                        "probin = '$libdir/plpython' AND "
@@ -188,23 +188,23 @@ get_loadable_libraries(void)
                                if (!found_public_plpython_handler)
                                {
                                        pg_log(PG_WARNING,
-                  "\nThe old cluster has a \"plpython_call_handler\" function defined\n"
-                       "in the \"public\" schema which is a duplicate of the one defined\n"
-                   "in the \"pg_catalog\" schema.  You can confirm this by executing\n"
-                       "in psql:\n"
-                       "\n"
-                       "       \\df *.plpython_call_handler\n"
-                       "\n"
-                       "The \"public\" schema version of this function was created by a\n"
-                       "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"
-                       "\n"
-                             DROP FUNCTION public.plpython_call_handler()\n"
-                       "\n"
-                       "in each affected database:\n"
-                       "\n");
+                                                  "\nThe old cluster has a \"plpython_call_handler\" function defined\n"
+                                                  "in the \"public\" schema which is a duplicate of the one defined\n"
+                                                  "in the \"pg_catalog\" schema.  You can confirm this by executing\n"
+                                                  "in psql:\n"
+                                                  "\n"
+                                                  "    \\df *.plpython_call_handler\n"
+                                                  "\n"
+                                                  "The \"public\" schema version of this function was created by a\n"
+                                                  "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"
+                                                  "\n"
+                                                "      DROP FUNCTION public.plpython_call_handler()\n"
+                                                  "\n"
+                                                  "in each affected database:\n"
+                                                  "\n");
                                }
                                pg_log(PG_WARNING, "    %s\n", active_db->db_name);
                                found_public_plpython_handler = true;
@@ -217,9 +217,9 @@ get_loadable_libraries(void)
 
        if (found_public_plpython_handler)
                pg_log(PG_FATAL,
-                  "Remove the problem functions from the old cluster to continue.\n");
-       
-       totaltups++;    /* reserve for pg_upgrade_support */
+                "Remove the problem functions from the old cluster to continue.\n");
+
+       totaltups++;                            /* reserve for pg_upgrade_support */
 
        /* Allocate what's certainly enough space */
        os_info.libraries = (char **) pg_malloc(totaltups * sizeof(char *));
@@ -293,17 +293,17 @@ check_loadable_libraries(void)
                PGresult   *res;
 
                /*
-                *      In Postgres 9.0, Python 3 support was added, and to do that, a
-                *      plpython2u language was created with library name plpython2.so
-                *      as a symbolic link to plpython.so.  In Postgres 9.1, only the
-                *      plpython2.so library was created, and both plpythonu and
-                *      plpython2u pointing to it.  For this reason, any reference to
-                *      library name "plpython" in an old PG <= 9.1 cluster must look
-                *      for "plpython2" in the new cluster.
+                * In Postgres 9.0, Python 3 support was added, and to do that, a
+                * plpython2u language was created with library name plpython2.so as a
+                * symbolic link to plpython.so.  In Postgres 9.1, only the
+                * plpython2.so library was created, and both plpythonu and plpython2u
+                * pointing to it.      For this reason, any reference to library name
+                * "plpython" in an old PG <= 9.1 cluster must look for "plpython2" in
+                * the new cluster.
                 *
-                *      For this case, we could check pg_pltemplate, but that only works
-                *      for languages, and does not help with function shared objects,
-                *      so we just do a general fix.
+                * For this case, we could check pg_pltemplate, but that only works
+                * for languages, and does not help with function shared objects, so
+                * we just do a general fix.
                 */
                if (GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
                        strcmp(lib, "$libdir/plpython") == 0)
@@ -325,7 +325,7 @@ check_loadable_libraries(void)
                        /* exit and report missing support library with special message */
                        if (strcmp(lib, PG_UPGRADE_SUPPORT) == 0)
                                pg_log(PG_FATAL,
-                                  "The pg_upgrade_support module must be created and installed in the new cluster.\n");
+                                          "The pg_upgrade_support module must be created and installed in the new cluster.\n");
 
                        if (script == NULL && (script = fopen_priv(output_path, "w")) == NULL)
                                pg_log(PG_FATAL, "Could not open file \"%s\": %s\n",
index 5b2b9eb28c18a126b15d9df65d2b17d1d39c7ab6..74b13e782da28e17788f7b44061269cb6acf17fc 100644 (file)
@@ -57,12 +57,12 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
                                   old_db->db_name, old_rel->reloid, new_rel->reloid);
 
                /*
-                * TOAST table names initially match the heap pg_class oid.
-                * In pre-8.4, TOAST table names change during CLUSTER; in pre-9.0,
-                * TOAST table names change during ALTER TABLE ALTER COLUMN SET TYPE.
-                * In >= 9.0, TOAST relation names always use heap table oids, hence
-                * we cannot check relation names when upgrading from pre-9.0.
-                * Clusters upgraded to 9.0 will get matching TOAST names.
+                * TOAST table names initially match the heap pg_class oid. In
+                * pre-8.4, TOAST table names change during CLUSTER; in pre-9.0, TOAST
+                * table names change during ALTER TABLE ALTER COLUMN SET TYPE. In >=
+                * 9.0, TOAST relation names always use heap table oids, hence we
+                * cannot check relation names when upgrading from pre-9.0. Clusters
+                * upgraded to 9.0 will get matching TOAST names.
                 */
                if (strcmp(old_rel->nspname, new_rel->nspname) != 0 ||
                        ((GET_MAJOR_VERSION(old_cluster.major_version) >= 900 ||
@@ -194,16 +194,16 @@ get_db_infos(ClusterInfo *cluster)
        char            query[QUERY_ALLOC];
 
        snprintf(query, sizeof(query),
-                       "SELECT d.oid, d.datname, %s "
-                       "FROM pg_catalog.pg_database d "
-                       " LEFT OUTER JOIN pg_catalog.pg_tablespace t "
-                       " ON d.dattablespace = t.oid "
-                       "WHERE d.datallowconn = true "
+                        "SELECT d.oid, d.datname, %s "
+                        "FROM pg_catalog.pg_database d "
+                        " LEFT OUTER JOIN pg_catalog.pg_tablespace t "
+                        " ON d.dattablespace = t.oid "
+                        "WHERE d.datallowconn = true "
        /* we don't preserve pg_database.oid so we sort by name */
-                       "ORDER BY 2",
+                        "ORDER BY 2",
        /* 9.2 removed the spclocation column */
-                       (GET_MAJOR_VERSION(cluster->major_version) <= 901) ?
-                       "t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation");
+                        (GET_MAJOR_VERSION(cluster->major_version) <= 901) ?
+                        "t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation");
 
        res = executeQueryOrDie(conn, "%s", query);
 
@@ -276,7 +276,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
                         "  LEFT OUTER JOIN pg_catalog.pg_tablespace t "
                         "         ON c.reltablespace = t.oid "
                         "WHERE relkind IN ('r','t', 'i'%s) AND "
-                        /* exclude possible orphaned temp tables */
+       /* exclude possible orphaned temp tables */
                         "  ((n.nspname !~ '^pg_temp_' AND "
                         "    n.nspname !~ '^pg_toast_temp_' AND "
                         "    n.nspname NOT IN ('pg_catalog', 'information_schema', 'binary_upgrade') AND "
index 66a70cac8ac983243a9d8fd6eb391e6af90326eb..ccf00434d3b610238900fa372360a8dcdcbe70b4 100644 (file)
@@ -56,10 +56,10 @@ parseCommandLine(int argc, char *argv[])
        int                     option;                 /* Command line option */
        int                     optindex = 0;   /* used by getopt_long */
        int                     os_user_effective_id;
-       FILE            *fp;
-       char            **filename;
+       FILE       *fp;
+       char      **filename;
        time_t          run_time = time(NULL);
-       
+
        user_opts.transfer_mode = TRANSFER_MODE_COPY;
 
        os_info.progname = get_progname(argv[0]);
@@ -138,11 +138,11 @@ parseCommandLine(int argc, char *argv[])
                                new_cluster.pgopts = pg_strdup(optarg);
                                break;
 
-                       /*
-                        * Someday, the port number option could be removed and
-                        * passed using -o/-O, but that requires postmaster -C
-                        * to be supported on all old/new versions.
-                        */
+                               /*
+                                * Someday, the port number option could be removed and passed
+                                * using -o/-O, but that requires postmaster -C to be
+                                * supported on all old/new versions.
+                                */
                        case 'p':
                                if ((old_cluster.port = atoi(optarg)) <= 0)
                                {
@@ -196,21 +196,21 @@ parseCommandLine(int argc, char *argv[])
                /* Start with newline because we might be appending to a file. */
                fprintf(fp, "\n"
                "-----------------------------------------------------------------\n"
-               "  pg_upgrade run on %s"
-               "-----------------------------------------------------------------\n\n",
-               ctime(&run_time));
+                               "  pg_upgrade run on %s"
+                               "-----------------------------------------------------------------\n\n",
+                               ctime(&run_time));
                fclose(fp);
        }
 
        /* Get values from env if not already set */
        check_required_directory(&old_cluster.bindir, "PGBINOLD", "-b",
-                                                       "old cluster binaries reside");
+                                                        "old cluster binaries reside");
        check_required_directory(&new_cluster.bindir, "PGBINNEW", "-B",
-                                                       "new cluster binaries reside");
+                                                        "new cluster binaries reside");
        check_required_directory(&old_cluster.pgdata, "PGDATAOLD", "-d",
-                                                       "old cluster data resides");
+                                                        "old cluster data resides");
        check_required_directory(&new_cluster.pgdata, "PGDATANEW", "-D",
-                                                       "new cluster data resides");
+                                                        "new cluster data resides");
 }
 
 
@@ -285,7 +285,7 @@ or\n"), old_cluster.port, new_cluster.port, os_info.user);
  */
 static void
 check_required_directory(char **dirpath, char *envVarName,
-                                               char *cmdLineOption, char *description)
+                                                char *cmdLineOption, char *description)
 {
        if (*dirpath == NULL || strlen(*dirpath) == 0)
        {
@@ -322,8 +322,10 @@ void
 adjust_data_dir(ClusterInfo *cluster)
 {
        char            filename[MAXPGPATH];
-       char            cmd[MAXPGPATH], cmd_output[MAX_STRING];
-       FILE       *fp, *output;
+       char            cmd[MAXPGPATH],
+                               cmd_output[MAX_STRING];
+       FILE       *fp,
+                          *output;
 
        /* If there is no postgresql.conf, it can't be a config-only dir */
        snprintf(filename, sizeof(filename), "%s/postgresql.conf", cluster->pgconfig);
@@ -345,10 +347,9 @@ adjust_data_dir(ClusterInfo *cluster)
                                CLUSTER_NAME(cluster));
 
        /*
-        * We don't have a data directory yet, so we can't check the PG
-        * version, so this might fail --- only works for PG 9.2+.   If this
-        * fails, pg_upgrade will fail anyway because the data files will not
-        * be found.
+        * We don't have a data directory yet, so we can't check the PG version,
+        * so this might fail --- only works for PG 9.2+.       If this fails,
+        * pg_upgrade will fail anyway because the data files will not be found.
         */
        snprintf(cmd, sizeof(cmd), "\"%s/postmaster\" -D \"%s\" -C data_directory",
                         cluster->bindir, cluster->pgconfig);
@@ -356,7 +357,7 @@ adjust_data_dir(ClusterInfo *cluster)
        if ((output = popen(cmd, "r")) == NULL ||
                fgets(cmd_output, sizeof(cmd_output), output) == NULL)
                pg_log(PG_FATAL, "Could not get data directory using %s: %s\n",
-               cmd, getErrorText(errno));
+                          cmd, getErrorText(errno));
 
        pclose(output);
 
index 465ecdd6b324275293044646b9fcf49a6d180600..3537fc2bd05bbd9b9c7dfda6028826eb376485a9 100644 (file)
@@ -55,7 +55,7 @@ ClusterInfo old_cluster,
                        new_cluster;
 OSInfo         os_info;
 
-char *output_files[] = {
+char      *output_files[] = {
        SERVER_LOG_FILE,
 #ifdef WIN32
        /* unique file for pg_ctl start */
@@ -122,11 +122,10 @@ main(int argc, char **argv)
        stop_postmaster(false);
 
        /*
-        *      Most failures happen in create_new_objects(), which has
-        *      completed at this point.  We do this here because it is just
-        *      before linking, which will link the old and new cluster data
-        *      files, preventing the old cluster from being safely started
-        *      once the new cluster is started.
+        * Most failures happen in create_new_objects(), which has completed at
+        * this point.  We do this here because it is just before linking, which
+        * will link the old and new cluster data files, preventing the old
+        * cluster from being safely started once the new cluster is started.
         */
        if (user_opts.transfer_mode == TRANSFER_MODE_LINK)
                disable_old_cluster();
@@ -215,8 +214,8 @@ prepare_new_cluster(void)
        exec_prog(true, true, UTILITY_LOG_FILE,
                          SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
                          "--all --analyze %s >> \"%s\" 2>&1" SYSTEMQUOTE,
-         new_cluster.bindir, new_cluster.port, os_info.user,
-         log_opts.verbose ? "--verbose" : "", UTILITY_LOG_FILE);
+                         new_cluster.bindir, new_cluster.port, os_info.user,
+                         log_opts.verbose ? "--verbose" : "", UTILITY_LOG_FILE);
        check_ok();
 
        /*
@@ -229,8 +228,8 @@ prepare_new_cluster(void)
        exec_prog(true, true, UTILITY_LOG_FILE,
                          SYSTEMQUOTE "\"%s/vacuumdb\" --port %d --username \"%s\" "
                          "--all --freeze %s >> \"%s\" 2>&1" SYSTEMQUOTE,
-         new_cluster.bindir, new_cluster.port, os_info.user,
-         log_opts.verbose ? "--verbose" : "", UTILITY_LOG_FILE);
+                         new_cluster.bindir, new_cluster.port, os_info.user,
+                         log_opts.verbose ? "--verbose" : "", UTILITY_LOG_FILE);
        check_ok();
 
        get_pg_database_relfilenode(&new_cluster);
@@ -252,8 +251,8 @@ prepare_new_databases(void)
 
        /*
         * Install support functions in the global-object restore database to
-        * preserve pg_authid.oid.  pg_dumpall uses 'template0' as its template
-        * database so objects we add into 'template1' are not propogated.  They
+        * preserve pg_authid.oid.      pg_dumpall uses 'template0' as its template
+        * database so objects we add into 'template1' are not propogated.      They
         * are removed on pg_upgrade exit.
         */
        install_support_functions_in_new_db("template1");
@@ -267,7 +266,7 @@ prepare_new_databases(void)
        exec_prog(true, true, RESTORE_LOG_FILE,
                          SYSTEMQUOTE "\"%s/psql\" --echo-queries "
                          "--set ON_ERROR_STOP=on "
-                         /* --no-psqlrc prevents AUTOCOMMIT=off */
+       /* --no-psqlrc prevents AUTOCOMMIT=off */
                          "--no-psqlrc --port %d --username \"%s\" "
                          "-f \"%s\" --dbname template1 >> \"%s\" 2>&1" SYSTEMQUOTE,
                          new_cluster.bindir, new_cluster.port, os_info.user,
@@ -453,13 +452,13 @@ set_frozenxids(void)
 static void
 cleanup(void)
 {
-       
+
        fclose(log_opts.internal);
 
        /* Remove dump and log files? */
        if (!log_opts.retain)
        {
-               char            **filename;
+               char      **filename;
 
                for (filename = output_files; *filename != NULL; filename++)
                        unlink(*filename);
index 26aa7bb1d24732f6a1528c662dd4de71dd566e1d..d12590ac6ba294d4d76551b6d5f7726fbcde17ef 100644 (file)
@@ -75,7 +75,7 @@ extern char *output_files[];
 #define RM_CMD                         "rm -f"
 #define RMDIR_CMD                      "rm -rf"
 #define SCRIPT_EXT                     "sh"
-#define        ECHO_QUOTE      "'"
+#define ECHO_QUOTE     "'"
 #else
 #define pg_copy_file           CopyFile
 #define pg_mv_file                     pgrename
@@ -85,7 +85,7 @@ extern char *output_files[];
 #define RMDIR_CMD                      "RMDIR /s/q"
 #define SCRIPT_EXT                     "bat"
 #define EXE_EXT                                ".exe"
-#define        ECHO_QUOTE      ""
+#define ECHO_QUOTE     ""
 #endif
 
 #define CLUSTER_NAME(cluster)  ((cluster) == &old_cluster ? "old" : \
@@ -98,7 +98,7 @@ extern char *output_files[];
 /* postmaster/postgres -b (binary_upgrade) flag added during PG 9.1 development */
 #define BINARY_UPGRADE_SERVER_FLAG_CAT_VER 201104251
 /*
- *     Visibility map changed with this 9.2 commit,
+ *     Visibility map changed with this 9.2 commit,
  *     8f9fe6edce358f7904e0db119416b4d1080a83aa; pick later catalog version.
  */
 #define VISIBILITY_MAP_CRASHSAFE_CAT_VER 201107031
@@ -114,7 +114,7 @@ typedef struct
        Oid                     reloid;                 /* relation oid */
        Oid                     relfilenode;    /* relation relfile node */
        /* relation tablespace path, or "" for the cluster default */
-       char            tablespace[MAXPGPATH];  
+       char            tablespace[MAXPGPATH];
 } RelInfo;
 
 typedef struct
@@ -222,9 +222,11 @@ typedef struct
        ControlData controldata;        /* pg_control information */
        DbInfoArr       dbarr;                  /* dbinfos array */
        char       *pgdata;                     /* pathname for cluster's $PGDATA directory */
-       char       *pgconfig;           /* pathname for cluster's config file directory */
+       char       *pgconfig;           /* pathname for cluster's config file
+                                                                * directory */
        char       *bindir;                     /* pathname for cluster's executable directory */
-       char       *pgopts;                     /* options to pass to the server, like pg_ctl -o */
+       char       *pgopts;                     /* options to pass to the server, like pg_ctl
+                                                                * -o */
        unsigned short port;            /* port number where postmaster is waiting */
        uint32          major_version;  /* PG_VERSION of cluster */
        char            major_version_str[64];  /* string PG_VERSION of cluster */
@@ -291,8 +293,8 @@ void check_old_cluster(bool live_check,
 void           check_new_cluster(void);
 void           report_clusters_compatible(void);
 void           issue_warnings(char *sequence_script_file_name);
-void           output_completion_banner(char *analyze_script_file_name,
-                                                                        char *deletion_script_file_name);
+void output_completion_banner(char *analyze_script_file_name,
+                                                char *deletion_script_file_name);
 void           check_cluster_versions(void);
 void           check_cluster_compatibility(bool live_check);
 void           create_script_for_old_cluster_deletion(char **deletion_script_file_name);
@@ -314,9 +316,10 @@ void               split_old_dump(void);
 
 /* exec.c */
 
-int exec_prog(bool throw_error, bool is_priv,
-       const char *log_file, const char *cmd, ...)
-       __attribute__((format(PG_PRINTF_ATTRIBUTE, 4, 5)));
+int
+exec_prog(bool throw_error, bool is_priv,
+                 const char *log_file, const char *cmd,...)
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 4, 5)));
 void           verify_directories(void);
 bool           is_server_running(const char *datadir);
 
@@ -353,14 +356,14 @@ const char *setupPageConverter(pageCnvCtx **result);
 typedef void *pageCnvCtx;
 #endif
 
-int load_directory(const char *dirname, struct dirent ***namelist);
+int                    load_directory(const char *dirname, struct dirent *** namelist);
 const char *copyAndUpdateFile(pageCnvCtx *pageConverter, const char *src,
                                  const char *dst, bool force);
 const char *linkAndUpdateFile(pageCnvCtx *pageConverter, const char *src,
                                  const char *dst);
 
 void           check_hard_link(void);
-FILE      *fopen_priv(const char *path, const char *mode);
+FILE      *fopen_priv(const char *path, const char *mode);
 
 /* function.c */
 
@@ -399,8 +402,9 @@ void                init_tablespaces(void);
 /* server.c */
 
 PGconn    *connectToServer(ClusterInfo *cluster, const char *db_name);
-PGresult   *executeQueryOrDie(PGconn *conn, const char *fmt, ...)
-       __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
+PGresult *
+executeQueryOrDie(PGconn *conn, const char *fmt,...)
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
 
 void           start_postmaster(ClusterInfo *cluster);
 void           stop_postmaster(bool fast);
@@ -413,12 +417,15 @@ void              check_pghost_envvar(void);
 char      *quote_identifier(const char *s);
 int                    get_user_info(char **user_name);
 void           check_ok(void);
-void           report_status(eLogType type, const char *fmt, ...)
-       __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
-void           pg_log(eLogType type, char *fmt, ...)
-       __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
-void           prep_status(const char *fmt, ...)
-       __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
+void
+report_status(eLogType type, const char *fmt,...)
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
+void
+pg_log(eLogType type, char *fmt,...)
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
+void
+prep_status(const char *fmt,...)
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
 void           check_ok(void);
 char      *pg_strdup(const char *s);
 void      *pg_malloc(int size);
index 45d6c5415bf15a92a16f9ae9d3938408a7c40b47..3509585de7b568af921d09443d077d7ed3b3bf47 100644 (file)
@@ -34,26 +34,28 @@ const char *
 transfer_all_new_dbs(DbInfoArr *old_db_arr,
                                   DbInfoArr *new_db_arr, char *old_pgdata, char *new_pgdata)
 {
-       int                     old_dbnum, new_dbnum;
+       int                     old_dbnum,
+                               new_dbnum;
        const char *msg = NULL;
 
        prep_status("%s user relation files\n",
-               user_opts.transfer_mode == TRANSFER_MODE_LINK ? "Linking" : "Copying");
+         user_opts.transfer_mode == TRANSFER_MODE_LINK ? "Linking" : "Copying");
 
        /* Scan the old cluster databases and transfer their files */
        for (old_dbnum = new_dbnum = 0;
                 old_dbnum < old_db_arr->ndbs;
                 old_dbnum++, new_dbnum++)
        {
-               DbInfo     *old_db = &old_db_arr->dbs[old_dbnum], *new_db = NULL;
+               DbInfo     *old_db = &old_db_arr->dbs[old_dbnum],
+                                  *new_db = NULL;
                FileNameMap *mappings;
                int                     n_maps;
                pageCnvCtx *pageConverter = NULL;
 
                /*
-                *      Advance past any databases that exist in the new cluster
-                *      but not in the old, e.g. "postgres".  (The user might
-                *      have removed the 'postgres' database from the old cluster.)
+                * Advance past any databases that exist in the new cluster but not in
+                * the old, e.g. "postgres".  (The user might have removed the
+                * 'postgres' database from the old cluster.)
                 */
                for (; new_dbnum < new_db_arr->ndbs; new_dbnum++)
                {
@@ -83,8 +85,8 @@ transfer_all_new_dbs(DbInfoArr *old_db_arr,
                }
        }
 
-       prep_status(" ");                       /* in case nothing printed; pass a space so gcc
-                                                                * doesn't complain about empty format
+       prep_status(" ");                       /* in case nothing printed; pass a space so
+                                                                * gcc doesn't complain about empty format
                                                                 * string */
        check_ok();
 
@@ -137,14 +139,14 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
        int                     mapnum;
        int                     fileno;
        bool            vm_crashsafe_change = false;
-       
+
        old_dir[0] = '\0';
 
        /* Do not copy non-crashsafe vm files for binaries that assume crashsafety */
        if (old_cluster.controldata.cat_ver < VISIBILITY_MAP_CRASHSAFE_CAT_VER &&
                new_cluster.controldata.cat_ver >= VISIBILITY_MAP_CRASHSAFE_CAT_VER)
                vm_crashsafe_change = true;
-       
+
        for (mapnum = 0; mapnum < size; mapnum++)
        {
                char            old_file[MAXPGPATH];
@@ -190,8 +192,8 @@ transfer_single_new_db(pageCnvCtx *pageConverter,
 
                        for (fileno = 0; fileno < numFiles; fileno++)
                        {
-                               char *vm_offset = strstr(namelist[fileno]->d_name, "_vm");
-                               bool is_vm_file = false;
+                               char       *vm_offset = strstr(namelist[fileno]->d_name, "_vm");
+                               bool            is_vm_file = false;
 
                                /* Is a visibility map file? (name ends with _vm) */
                                if (vm_offset && strlen(vm_offset) == strlen("_vm"))
index f557453df2d92e0ff946588eacaa1fae5962ca1e..f83d6fa866cc87e142a11a2289ff938c8c2f1ab6 100644 (file)
@@ -161,7 +161,7 @@ start_postmaster(ClusterInfo *cluster)
        snprintf(cmd, sizeof(cmd),
                         SYSTEMQUOTE "\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" "
                         "-o \"-p %d %s %s\" start >> \"%s\" 2>&1" SYSTEMQUOTE,
-                        cluster->bindir, SERVER_LOG_FILE, cluster->pgconfig, cluster->port,
+                 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",
@@ -172,11 +172,11 @@ start_postmaster(ClusterInfo *cluster)
         * it might supply a reason for the failure.
         */
        pg_ctl_return = exec_prog(false, true,
-                                       /* pass both file names if the differ */
-                                       (strcmp(SERVER_LOG_FILE, SERVER_START_LOG_FILE) == 0) ?
-                                               SERVER_LOG_FILE :
-                                               SERVER_LOG_FILE " or " SERVER_START_LOG_FILE,
-                                       "%s", cmd);
+       /* pass both file names if the differ */
+                                         (strcmp(SERVER_LOG_FILE, SERVER_START_LOG_FILE) == 0) ?
+                                                         SERVER_LOG_FILE :
+                                                         SERVER_LOG_FILE " or " SERVER_START_LOG_FILE,
+                                                         "%s", cmd);
 
        /* Check to see if we can connect to the server; if not, report it. */
        if ((conn = get_db_conn(cluster, "template1")) == NULL ||
@@ -211,14 +211,14 @@ stop_postmaster(bool fast)
        else if (os_info.running_cluster == &new_cluster)
                cluster = &new_cluster;
        else
-               return;         /* no cluster running */
+               return;                                 /* no cluster running */
 
        snprintf(cmd, sizeof(cmd),
                         SYSTEMQUOTE "\"%s/pg_ctl\" -w -D \"%s\" -o \"%s\" "
                         "%s stop >> \"%s\" 2>&1" SYSTEMQUOTE,
                         cluster->bindir, cluster->pgconfig,
                         cluster->pgopts ? cluster->pgopts : "",
-                       fast ? "-m fast" : "", SERVER_STOP_LOG_FILE);
+                        fast ? "-m fast" : "", SERVER_STOP_LOG_FILE);
 
        exec_prog(fast ? false : true, true, SERVER_STOP_LOG_FILE, "%s", cmd);
 
index 6b61f4bac11cc320b106ea65adc7152016be4820..b783b6251e6e248f01953fcd0ade964044505363 100644 (file)
@@ -52,8 +52,8 @@ get_tablespace_paths(void)
                         "WHERE spcname != 'pg_default' AND "
                         "              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");
+                        (GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
+       "spclocation" : "pg_catalog.pg_tablespace_location(oid) AS spclocation");
 
        res = executeQueryOrDie(conn, "%s", query);
 
index 542425c7c9eff3d761f7839904fcfab7ac90478f..b681c0984e6e9d0bee6c0a561907d6efbbc3a1a4 100644 (file)
@@ -60,10 +60,10 @@ old_8_3_check_for_name_data_type_usage(ClusterInfo *cluster)
                                                                "               NOT a.attisdropped AND "
                                                                "               a.atttypid = 'pg_catalog.name'::pg_catalog.regtype AND "
                                                                "               c.relnamespace = n.oid AND "
-                                                                /* exclude possible orphaned temp tables */
+               /* exclude possible orphaned temp tables */
                                                                "               n.nspname !~ '^pg_temp_' AND "
-                                                               "               n.nspname !~ '^pg_toast_temp_' AND "
-                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
+                                                "              n.nspname !~ '^pg_toast_temp_' AND "
+                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
 
                ntups = PQntuples(res);
                i_nspname = PQfnumber(res, "nspname");
@@ -98,9 +98,9 @@ old_8_3_check_for_name_data_type_usage(ClusterInfo *cluster)
                pg_log(PG_REPORT, "fatal\n");
                pg_log(PG_FATAL,
                           "Your installation contains the \"name\" data type in user tables.  This\n"
-                          "data type changed its internal alignment between your old and new\n"
+               "data type changed its internal alignment between your old and new\n"
                           "clusters so this cluster cannot currently be upgraded.  You can remove\n"
-                          "the problem tables and restart the upgrade.  A list of the problem\n"
+               "the problem tables and restart the upgrade.  A list of the problem\n"
                           "columns is in the file:\n"
                           "    %s\n\n", output_path);
        }
@@ -150,10 +150,10 @@ old_8_3_check_for_tsquery_usage(ClusterInfo *cluster)
                                                                "               NOT a.attisdropped AND "
                                                                "               a.atttypid = 'pg_catalog.tsquery'::pg_catalog.regtype AND "
                                                                "               c.relnamespace = n.oid AND "
-                                                                /* exclude possible orphaned temp tables */
+               /* exclude possible orphaned temp tables */
                                                                "               n.nspname !~ '^pg_temp_' AND "
-                                                               "               n.nspname !~ '^pg_toast_temp_' AND "
-                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
+                                                "              n.nspname !~ '^pg_toast_temp_' AND "
+                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
 
                ntups = PQntuples(res);
                i_nspname = PQfnumber(res, "nspname");
@@ -189,7 +189,7 @@ old_8_3_check_for_tsquery_usage(ClusterInfo *cluster)
                pg_log(PG_FATAL,
                           "Your installation contains the \"tsquery\" data type.    This data type\n"
                           "added a new internal field between your old and new clusters so this\n"
-                          "cluster cannot currently be upgraded.  You can remove the problem\n"
+               "cluster cannot currently be upgraded.  You can remove the problem\n"
                           "columns and restart the upgrade.  A list of the problem columns is in the\n"
                           "file:\n"
                           "    %s\n\n", output_path);
@@ -328,10 +328,10 @@ old_8_3_rebuild_tsvector_tables(ClusterInfo *cluster, bool check_mode)
                                                                "               NOT a.attisdropped AND "
                                                                "               a.atttypid = 'pg_catalog.tsvector'::pg_catalog.regtype AND "
                                                                "               c.relnamespace = n.oid AND "
-                                                                /* exclude possible orphaned temp tables */
+               /* exclude possible orphaned temp tables */
                                                                "               n.nspname !~ '^pg_temp_' AND "
-                                                               "               n.nspname !~ '^pg_toast_temp_' AND "
-                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
+                                                "              n.nspname !~ '^pg_toast_temp_' AND "
+                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
 
 /*
  *     This macro is used below to avoid reindexing indexes already rebuilt
@@ -527,7 +527,7 @@ old_8_3_invalidate_hash_gin_indexes(ClusterInfo *cluster, bool check_mode)
                                   "must be 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
@@ -648,10 +648,10 @@ old_8_3_invalidate_bpchar_pattern_ops_indexes(ClusterInfo *cluster,
                        pg_log(PG_WARNING, "\n"
                                   "Your installation contains indexes using \"bpchar_pattern_ops\".  These\n"
                                   "indexes have different internal formats between your old and new clusters\n"
-                                  "so they must be reindexed with the REINDEX command.  The file:\n"
+                       "so they must be 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
@@ -699,10 +699,10 @@ old_8_3_create_sequence_script(ClusterInfo *cluster)
                                                                "               pg_catalog.pg_namespace n "
                                                                "WHERE  c.relkind = 'S' AND "
                                                                "               c.relnamespace = n.oid AND "
-                                                                /* exclude possible orphaned temp tables */
+               /* exclude possible orphaned temp tables */
                                                                "               n.nspname !~ '^pg_temp_' AND "
-                                                               "               n.nspname !~ '^pg_toast_temp_' AND "
-                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
+                                                "              n.nspname !~ '^pg_toast_temp_' AND "
+                                                               "               n.nspname NOT IN ('pg_catalog', 'information_schema')");
 
                ntups = PQntuples(res);
                i_nspname = PQfnumber(res, "nspname");
index b0e699187b5c99fd331f3d34348b663173718ab4..25fb15a847155db6f852ae82343bc98b1d5d0b64 100644 (file)
@@ -66,7 +66,7 @@
 typedef struct win32_pthread *pthread_t;
 typedef int pthread_attr_t;
 
-static int     pthread_create(pthread_t *thread, pthread_attr_t * attr, void *(*start_routine) (void *), void *arg);
+static int     pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
 static int     pthread_join(pthread_t th, void **thread_return);
 #elif defined(ENABLE_THREAD_SAFETY)
 /* Use platform-dependent pthread capability */
@@ -84,7 +84,7 @@ static int    pthread_join(pthread_t th, void **thread_return);
 typedef struct fork_pthread *pthread_t;
 typedef int pthread_attr_t;
 
-static int     pthread_create(pthread_t *thread, pthread_attr_t * attr, void *(*start_routine) (void *), void *arg);
+static int     pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
 static int     pthread_join(pthread_t th, void **thread_return);
 #endif
 
@@ -198,7 +198,7 @@ typedef struct
        instr_time      start_time;             /* thread start time */
        instr_time *exec_elapsed;       /* time spent executing cmds (per Command) */
        int                *exec_count;         /* number of cmd executions (per Command) */
-       unsigned short random_state[3]; /* separate randomness for each thread */
+       unsigned short random_state[3];         /* separate randomness for each thread */
 } TState;
 
 #define INVALID_THREAD         ((pthread_t) 0)
@@ -1075,7 +1075,7 @@ top:
 
                        /*
                         * getrand() neeeds to be able to subtract max from min and add
-                        * one the result without overflowing.  Since we know max > min,
+                        * one the result without overflowing.  Since we know max > min,
                         * we can detect overflow just by checking for a negative result.
                         * But we must check both that the subtraction doesn't overflow,
                         * and that adding one to the result doesn't overflow either.
@@ -1267,10 +1267,11 @@ init(void)
         * versions.  Since pgbench has never pretended to be fully TPC-B
         * compliant anyway, we stick with the historical behavior.
         */
-       struct ddlinfo {
-               char *table;
-               char *cols;
-               int declare_fillfactor;
+       struct ddlinfo
+       {
+               char       *table;
+               char       *cols;
+               int                     declare_fillfactor;
        };
        struct ddlinfo DDLs[] = {
                {
@@ -1321,15 +1322,16 @@ init(void)
                /* Construct new create table statement. */
                opts[0] = '\0';
                if (ddl->declare_fillfactor)
-                       snprintf(opts+strlen(opts), 256-strlen(opts),
-                               " with (fillfactor=%d)", fillfactor);
+                       snprintf(opts + strlen(opts), 256 - strlen(opts),
+                                        " with (fillfactor=%d)", fillfactor);
                if (tablespace != NULL)
                {
-                       char *escape_tablespace;
+                       char       *escape_tablespace;
+
                        escape_tablespace = PQescapeIdentifier(con, tablespace,
                                                                                                   strlen(tablespace));
-                       snprintf(opts+strlen(opts), 256-strlen(opts),
-                               " tablespace %s", escape_tablespace);
+                       snprintf(opts + strlen(opts), 256 - strlen(opts),
+                                        " tablespace %s", escape_tablespace);
                        PQfreemem(escape_tablespace);
                }
                snprintf(buffer, 256, "create%s table %s(%s)%s",
@@ -1404,17 +1406,18 @@ init(void)
        fprintf(stderr, "set primary key...\n");
        for (i = 0; i < lengthof(DDLAFTERs); i++)
        {
-               char    buffer[256];
+               char            buffer[256];
 
                strncpy(buffer, DDLAFTERs[i], 256);
 
                if (index_tablespace != NULL)
                {
-                       char *escape_tablespace;
+                       char       *escape_tablespace;
+
                        escape_tablespace = PQescapeIdentifier(con, index_tablespace,
                                                                                                   strlen(index_tablespace));
-                       snprintf(buffer+strlen(buffer), 256-strlen(buffer),
-                               " using index tablespace %s", escape_tablespace);
+                       snprintf(buffer + strlen(buffer), 256 - strlen(buffer),
+                                        " using index tablespace %s", escape_tablespace);
                        PQfreemem(escape_tablespace);
                }
 
@@ -1861,10 +1864,10 @@ main(int argc, char **argv)
        int                     i;
 
        static struct option long_options[] = {
-                       {"index-tablespace", required_argument, NULL, 3},
-                       {"tablespace", required_argument, NULL, 2},
-                       {"unlogged-tables", no_argument, &unlogged_tables, 1},
-                       {NULL, 0, NULL, 0}
+               {"index-tablespace", required_argument, NULL, 3},
+               {"tablespace", required_argument, NULL, 2},
+               {"unlogged-tables", no_argument, &unlogged_tables, 1},
+               {NULL, 0, NULL, 0}
        };
 
 #ifdef HAVE_GETRLIMIT
@@ -2065,10 +2068,10 @@ main(int argc, char **argv)
                        case 0:
                                /* This covers long options which take no argument. */
                                break;
-                       case 2:                                                 /* tablespace */
+                       case 2:                         /* tablespace */
                                tablespace = optarg;
                                break;
-                       case 3:                                                 /* index-tablespace */
+                       case 3:                         /* index-tablespace */
                                index_tablespace = optarg;
                                break;
                        default:
@@ -2571,7 +2574,7 @@ typedef struct fork_pthread
 
 static int
 pthread_create(pthread_t *thread,
-                          pthread_attr_t * attr,
+                          pthread_attr_t *attr,
                           void *(*start_routine) (void *),
                           void *arg)
 {
@@ -2687,7 +2690,7 @@ win32_pthread_run(void *arg)
 
 static int
 pthread_create(pthread_t *thread,
-                          pthread_attr_t * attr,
+                          pthread_attr_t *attr,
                           void *(*start_routine) (void *),
                           void *arg)
 {
index 6c7a2b329e487cd9d5c164f6ca5302ad8c558524..2a5cd70208a90a8cbd047a77aca7e30ed6bd5ea2 100644 (file)
@@ -34,8 +34,8 @@ char *
 px_crypt_md5(const char *pw, const char *salt, char *passwd, unsigned dstlen)
 {
        static char *magic = "$1$"; /* This string is magic for this algorithm.
-                                                                * Having it this way, we can get better
-                                                                * later on */
+                                                                * Having it this way, we can get better later
+                                                                * on */
        static char *p;
        static const char *sp,
                           *ep;
index 610b7fad789a83d655c38e21431d5c1d49c57e3c..80e8624460ddea1549fd868645d3a221137f2990 100644 (file)
@@ -204,8 +204,9 @@ const char *px_resolve_alias(const PX_Alias *aliases, const char *name);
 void           px_set_debug_handler(void (*handler) (const char *));
 
 #ifdef PX_DEBUG
-void           px_debug(const char *fmt, ...)
-       __attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
+void
+px_debug(const char *fmt,...)
+__attribute__((format(PG_PRINTF_ATTRIBUTE, 1, 2)));
 #else
 #define px_debug(...)
 #endif
index 9f2ec1f210840a45852a8b3dbd7d9892c3b1c4c8..d4fc8a0fd609f359c1cfba928f140519c99a17da 100644 (file)
@@ -95,7 +95,7 @@ pgstatindex(PG_FUNCTION_ARGS)
        BlockNumber nblocks;
        BlockNumber blkno;
        BTIndexStat indexStat;
-       BufferAccessStrategy bstrategy = GetAccessStrategy(BAS_BULKREAD);
+       BufferAccessStrategy bstrategy = GetAccessStrategy(BAS_BULKREAD);
 
        if (!superuser())
                ereport(ERROR,
@@ -160,7 +160,7 @@ pgstatindex(PG_FUNCTION_ARGS)
                CHECK_FOR_INTERRUPTS();
 
                /* Read and lock buffer */
-               buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, bstrategy);
+               buffer = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, bstrategy);
                LockBuffer(buffer, BUFFER_LOCK_SHARE);
 
                page = BufferGetPage(buffer);
index c9be8c92e4bf2aecdd53e2e60683cb9a8cd5b524..2b62b7850639d4bbaff7ddb4473ea0d671ba06e5 100644 (file)
@@ -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);
index 0c395c42a3cb0643c6d5f99808c84a625468e316..5a4246752a3d358a0483f5f1f1f5615bad221ce7 100644 (file)
@@ -32,19 +32,19 @@ void
 sepgsql_database_post_create(Oid databaseId, const char *dtemplate)
 {
        Relation        rel;
-       ScanKeyData     skey;
-       SysScanDesc     sscan;
+       ScanKeyData skey;
+       SysScanDesc sscan;
        HeapTuple       tuple;
        char       *tcontext;
        char       *ncontext;
        char            audit_name[NAMEDATALEN + 20];
-       ObjectAddress           object;
-       Form_pg_database        datForm;
+       ObjectAddress object;
+       Form_pg_database datForm;
 
        /*
-        * Oid of the source database is not saved in pg_database catalog,
-        * so we collect its identifier using contextual information.
-        * If NULL, its default is "template1" according to createdb().
+        * Oid of the source database is not saved in pg_database catalog, so we
+        * collect its identifier using contextual information. If NULL, its
+        * default is "template1" according to createdb().
         */
        if (!dtemplate)
                dtemplate = "template1";
@@ -56,6 +56,7 @@ sepgsql_database_post_create(Oid databaseId, const char *dtemplate)
        tcontext = sepgsql_get_label(object.classId,
                                                                 object.objectId,
                                                                 object.objectSubId);
+
        /*
         * check db_database:{getattr} permission
         */
@@ -67,11 +68,11 @@ sepgsql_database_post_create(Oid databaseId, const char *dtemplate)
                                                                  true);
 
        /*
-        * Compute a default security label of the newly created database
-        * based on a pair of security label of client and source database.
+        * Compute a default security label of the newly created database based on
+        * a pair of security label of client and source database.
         *
-        * XXX - uncoming version of libselinux supports to take object
-        * name to handle special treatment on default security label.
+        * XXX - uncoming version of libselinux supports to take object name to
+        * handle special treatment on default security label.
         */
        rel = heap_open(DatabaseRelationId, AccessShareLock);
 
@@ -91,6 +92,7 @@ sepgsql_database_post_create(Oid databaseId, const char *dtemplate)
        ncontext = sepgsql_compute_create(sepgsql_get_client_label(),
                                                                          tcontext,
                                                                          SEPG_CLASS_DB_DATABASE);
+
        /*
         * check db_database:{create} permission
         */
@@ -126,8 +128,8 @@ sepgsql_database_post_create(Oid databaseId, const char *dtemplate)
 void
 sepgsql_database_drop(Oid databaseId)
 {
-       ObjectAddress   object;
-       char               *audit_name;
+       ObjectAddress object;
+       char       *audit_name;
 
        /*
         * check db_database:{drop} permission
@@ -153,8 +155,8 @@ sepgsql_database_drop(Oid databaseId)
 void
 sepgsql_database_relabel(Oid databaseId, const char *seclabel)
 {
-       ObjectAddress   object;
-       char               *audit_name;
+       ObjectAddress object;
+       char       *audit_name;
 
        object.classId = DatabaseRelationId;
        object.objectId = databaseId;
@@ -170,6 +172,7 @@ sepgsql_database_relabel(Oid databaseId, const char *seclabel)
                                                        SEPG_DB_DATABASE__RELABELFROM,
                                                        audit_name,
                                                        true);
+
        /*
         * check db_database:{relabelto} permission
         */
index 17aa41cf4e7eea43ccf033aa49d21a00d9fc153f..47a108741746f99f9a542051f13f68812a43e585 100644 (file)
@@ -150,7 +150,7 @@ check_relation_privileges(Oid relOid,
                                                  uint32 required,
                                                  bool abort)
 {
-       ObjectAddress   object;
+       ObjectAddress object;
        char       *audit_name;
        Bitmapset  *columns;
        int                     index;
index ffa078677c8490ab0973991726be6afc79c288ba..914519109c84bb1053bb3eef9fde06d92a79904d 100644 (file)
@@ -52,9 +52,9 @@ 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;
+static sepgsql_context_info_t sepgsql_context_info;
 
 /*
  * GUC: sepgsql.permissive = (on|off)
@@ -101,7 +101,7 @@ sepgsql_object_access(ObjectAccessType access,
                        {
                                case DatabaseRelationId:
                                        sepgsql_database_post_create(objectId,
-                                                               sepgsql_context_info.createdb_dtemplate);
+                                                                       sepgsql_context_info.createdb_dtemplate);
                                        break;
 
                                case NamespaceRelationId:
@@ -115,9 +115,8 @@ sepgsql_object_access(ObjectAccessType access,
                                                 * All cases we want to apply permission checks on
                                                 * creation of a new relation are invocation of the
                                                 * heap_create_with_catalog via DefineRelation or
-                                                * OpenIntoRel.
-                                                * Elsewhere, we need neither assignment of security
-                                                * label nor permission checks.
+                                                * OpenIntoRel. Elsewhere, we need neither assignment
+                                                * of security label nor permission checks.
                                                 */
                                                switch (sepgsql_context_info.cmdtype)
                                                {
@@ -150,12 +149,12 @@ sepgsql_object_access(ObjectAccessType access,
 
                case OAT_DROP:
                        {
-                               ObjectAccessDrop *drop_arg = (ObjectAccessDrop *)arg;
+                               ObjectAccessDrop *drop_arg = (ObjectAccessDrop *) arg;
 
                                /*
-                                * No need to apply permission checks on object deletion
-                                * due to internal cleanups; such as removal of temporary
-                                * database object on session closed.
+                                * No need to apply permission checks on object deletion due
+                                * to internal cleanups; such as removal of temporary database
+                                * object on session closed.
                                 */
                                if ((drop_arg->dropflags & PERFORM_DELETION_INTERNAL) != 0)
                                        break;
@@ -219,13 +218,13 @@ sepgsql_exec_check_perms(List *rangeTabls, bool abort)
 /*
  * sepgsql_executor_start
  *
- * It saves contextual information during ExecutorStart to distinguish 
+ * It saves contextual information during ExecutorStart to distinguish
  * a case with/without permission checks later.
  */
 static void
 sepgsql_executor_start(QueryDesc *queryDesc, int eflags)
 {
-       sepgsql_context_info_t  saved_context_info = sepgsql_context_info;
+       sepgsql_context_info_t saved_context_info = sepgsql_context_info;
 
        PG_TRY();
        {
@@ -270,28 +269,29 @@ sepgsql_utility_command(Node *parsetree,
                                                DestReceiver *dest,
                                                char *completionTag)
 {
-       sepgsql_context_info_t  saved_context_info = sepgsql_context_info;
-       ListCell           *cell;
+       sepgsql_context_info_t saved_context_info = sepgsql_context_info;
+       ListCell   *cell;
 
        PG_TRY();
        {
                /*
                 * Check command tag to avoid nefarious operations, and save the
-                * current contextual information to determine whether we should
-                * apply permission checks here, or not.
+                * current contextual information to determine whether we should apply
+                * permission checks here, or not.
                 */
                sepgsql_context_info.cmdtype = nodeTag(parsetree);
 
                switch (nodeTag(parsetree))
                {
                        case T_CreatedbStmt:
+
                                /*
                                 * We hope to reference name of the source database, but it
                                 * does not appear in system catalog. So, we save it here.
                                 */
-                               foreach (cell, ((CreatedbStmt *) parsetree)->options)
+                               foreach(cell, ((CreatedbStmt *) parsetree)->options)
                                {
-                                       DefElem    *defel = (DefElem *) lfirst(cell);
+                                       DefElem    *defel = (DefElem *) lfirst(cell);
 
                                        if (strcmp(defel->defname, "template") == 0)
                                        {
@@ -303,6 +303,7 @@ sepgsql_utility_command(Node *parsetree,
                                break;
 
                        case T_LoadStmt:
+
                                /*
                                 * We reject LOAD command across the board on enforcing mode,
                                 * because a binary module can arbitrarily override hooks.
@@ -315,6 +316,7 @@ sepgsql_utility_command(Node *parsetree,
                                }
                                break;
                        default:
+
                                /*
                                 * Right now we don't check any other utility commands,
                                 * because it needs more detailed information to make access
index 85f4efe072ad552e6f93e0b3da6139bc6cf3502d..23577b5844db3d37e3a6aaddbaf39cd6b980b140 100644 (file)
@@ -58,17 +58,18 @@ static fmgr_hook_type next_fmgr_hook = NULL;
  * we use the list client_label_pending of pending_label to keep track of which
  * 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 char *client_label_func         = NULL; /* set by trusted procedure */
-
-typedef struct {
-       SubTransactionId        subid;
-       char                       *label;
-} pending_label;
+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 char *client_label_func = NULL; /* set by trusted procedure */
+
+typedef struct
+{
+       SubTransactionId subid;
+       char       *label;
+}      pending_label;
 
 /*
  * sepgsql_get_client_label
@@ -87,7 +88,7 @@ sepgsql_get_client_label(void)
        /* uncommitted sepgsql_setcon() value */
        if (client_label_pending)
        {
-               pending_label  *plabel = llast(client_label_pending);
+               pending_label *plabel = llast(client_label_pending);
 
                if (plabel->label)
                        return plabel->label;
@@ -104,16 +105,16 @@ sepgsql_get_client_label(void)
  * sepgsql_set_client_label
  *
  * This routine tries to switch the current security label of the client, and
- * checks related permissions.  The supplied new label shall be added to the
+ * checks related permissions. The supplied new label shall be added to the
  * client_label_pending list, then saved at transaction-commit time to ensure
  * transaction-awareness.
  */
 static void
 sepgsql_set_client_label(const char *new_label)
 {
-       const char         *tcontext;
-       MemoryContext   oldcxt;
-       pending_label  *plabel;
+       const char *tcontext;
+       MemoryContext oldcxt;
+       pending_label *plabel;
 
        /* Reset to the initial client label, if NULL */
        if (!new_label)
@@ -140,9 +141,10 @@ sepgsql_set_client_label(const char *new_label)
                                                                  SEPG_PROCESS__DYNTRANSITION,
                                                                  NULL,
                                                                  true);
+
        /*
-        * Append the supplied new_label on the pending list until
-        * the current transaction is committed.
+        * Append the supplied new_label on the pending list until the current
+        * transaction is committed.
         */
        oldcxt = MemoryContextSwitchTo(CurTransactionContext);