summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2007-11-15 21:14:46 +0000
committerBruce Momjian2007-11-15 21:14:46 +0000
commitfdf5a5efb7b28c13085fe7313658de8d7b9914f6 (patch)
treea75cf1422fa1eef4e801cf502b148d8ce1b5dfe7
parent3adc760fb92eab1a8720337a8bf9b66486609eb3 (diff)
pgindent run for 8.3.
-rw-r--r--contrib/cube/cube.c102
-rw-r--r--contrib/dblink/dblink.c10
-rw-r--r--contrib/dict_int/dict_int.c37
-rw-r--r--contrib/dict_xsyn/dict_xsyn.c79
-rw-r--r--contrib/hstore/hstore.h4
-rw-r--r--contrib/hstore/hstore_gin.c98
-rw-r--r--contrib/hstore/hstore_op.c26
-rw-r--r--contrib/intarray/_int_gin.c13
-rw-r--r--contrib/intarray/_int_gist.c5
-rw-r--r--contrib/isn/isn.c4
-rw-r--r--contrib/pageinspect/btreefuncs.c6
-rw-r--r--contrib/pageinspect/heapfuncs.c87
-rw-r--r--contrib/pageinspect/rawpage.c34
-rw-r--r--contrib/pg_buffercache/pg_buffercache_pages.c8
-rw-r--r--contrib/pg_standby/pg_standby.c296
-rw-r--r--contrib/pg_trgm/trgm_gin.c36
-rw-r--r--contrib/pgbench/pgbench.c41
-rw-r--r--contrib/pgcrypto/blf.c21
-rw-r--r--contrib/pgcrypto/blf.h20
-rw-r--r--contrib/pgcrypto/crypt-blowfish.c4
-rw-r--r--contrib/pgcrypto/imath.h7
-rw-r--r--contrib/pgcrypto/internal.c6
-rw-r--r--contrib/pgcrypto/openssl.c68
-rw-r--r--contrib/pgcrypto/pgp-compress.c3
-rw-r--r--contrib/pgcrypto/px.c4
-rw-r--r--contrib/pgcrypto/sha2.c4
-rw-r--r--contrib/pgstattuple/pgstatindex.c9
-rw-r--r--contrib/tablefunc/tablefunc.c8
-rw-r--r--contrib/test_parser/test_parser.c70
-rw-r--r--contrib/tsearch2/tsearch2.c120
-rw-r--r--contrib/uuid-ossp/uuid-ossp.c46
-rw-r--r--src/backend/access/common/heaptuple.c92
-rw-r--r--src/backend/access/common/indextuple.c24
-rw-r--r--src/backend/access/common/reloptions.c6
-rw-r--r--src/backend/access/gin/ginarrayproc.c13
-rw-r--r--src/backend/access/gin/ginbtree.c6
-rw-r--r--src/backend/access/gin/gindatapage.c20
-rw-r--r--src/backend/access/gin/ginentrypage.c18
-rw-r--r--src/backend/access/gin/ginget.c54
-rw-r--r--src/backend/access/gin/ginscan.c12
-rw-r--r--src/backend/access/gin/ginutil.c8
-rw-r--r--src/backend/access/gin/ginvacuum.c35
-rw-r--r--src/backend/access/gin/ginxlog.c11
-rw-r--r--src/backend/access/gist/gist.c6
-rw-r--r--src/backend/access/gist/gistget.c21
-rw-r--r--src/backend/access/gist/gistproc.c26
-rw-r--r--src/backend/access/gist/gistvacuum.c4
-rw-r--r--src/backend/access/hash/hash.c4
-rw-r--r--src/backend/access/hash/hashfunc.c6
-rw-r--r--src/backend/access/hash/hashovfl.c12
-rw-r--r--src/backend/access/hash/hashpage.c48
-rw-r--r--src/backend/access/heap/heapam.c213
-rw-r--r--src/backend/access/heap/pruneheap.c218
-rw-r--r--src/backend/access/heap/rewriteheap.c203
-rw-r--r--src/backend/access/heap/syncscan.c58
-rw-r--r--src/backend/access/heap/tuptoaster.c69
-rw-r--r--src/backend/access/index/indexam.c45
-rw-r--r--src/backend/access/nbtree/nbtinsert.c130
-rw-r--r--src/backend/access/nbtree/nbtpage.c56
-rw-r--r--src/backend/access/nbtree/nbtsearch.c10
-rw-r--r--src/backend/access/nbtree/nbtutils.c49
-rw-r--r--src/backend/access/nbtree/nbtxlog.c41
-rw-r--r--src/backend/access/transam/clog.c18
-rw-r--r--src/backend/access/transam/multixact.c8
-rw-r--r--src/backend/access/transam/transam.c14
-rw-r--r--src/backend/access/transam/twophase.c48
-rw-r--r--src/backend/access/transam/twophase_rmgr.c4
-rw-r--r--src/backend/access/transam/varsup.c26
-rw-r--r--src/backend/access/transam/xact.c156
-rw-r--r--src/backend/access/transam/xlog.c150
-rw-r--r--src/backend/bootstrap/bootstrap.c8
-rw-r--r--src/backend/catalog/aclchk.c6
-rw-r--r--src/backend/catalog/dependency.c54
-rw-r--r--src/backend/catalog/heap.c121
-rw-r--r--src/backend/catalog/index.c133
-rw-r--r--src/backend/catalog/namespace.c93
-rw-r--r--src/backend/catalog/pg_aggregate.c10
-rw-r--r--src/backend/catalog/pg_constraint.c10
-rw-r--r--src/backend/catalog/pg_conversion.c3
-rw-r--r--src/backend/catalog/pg_enum.c39
-rw-r--r--src/backend/catalog/pg_operator.c4
-rw-r--r--src/backend/catalog/pg_proc.c4
-rw-r--r--src/backend/catalog/pg_shdepend.c6
-rw-r--r--src/backend/catalog/pg_type.c34
-rw-r--r--src/backend/commands/analyze.c6
-rw-r--r--src/backend/commands/cluster.c36
-rw-r--r--src/backend/commands/comment.c6
-rw-r--r--src/backend/commands/copy.c50
-rw-r--r--src/backend/commands/dbcommands.c42
-rw-r--r--src/backend/commands/discard.c12
-rw-r--r--src/backend/commands/explain.c33
-rw-r--r--src/backend/commands/functioncmds.c18
-rw-r--r--src/backend/commands/indexcmds.c74
-rw-r--r--src/backend/commands/opclasscmds.c72
-rw-r--r--src/backend/commands/operatorcmds.c4
-rw-r--r--src/backend/commands/portalcmds.c12
-rw-r--r--src/backend/commands/prepare.c30
-rw-r--r--src/backend/commands/schemacmds.c18
-rw-r--r--src/backend/commands/sequence.c8
-rw-r--r--src/backend/commands/tablecmds.c204
-rw-r--r--src/backend/commands/tablespace.c50
-rw-r--r--src/backend/commands/tsearchcmds.c72
-rw-r--r--src/backend/commands/typecmds.c190
-rw-r--r--src/backend/commands/vacuum.c221
-rw-r--r--src/backend/commands/vacuumlazy.c78
-rw-r--r--src/backend/commands/variable.c20
-rw-r--r--src/backend/commands/view.c13
-rw-r--r--src/backend/executor/execAmi.c13
-rw-r--r--src/backend/executor/execCurrent.c73
-rw-r--r--src/backend/executor/execMain.c70
-rw-r--r--src/backend/executor/execQual.c154
-rw-r--r--src/backend/executor/execScan.c11
-rw-r--r--src/backend/executor/execUtils.c6
-rw-r--r--src/backend/executor/functions.c37
-rw-r--r--src/backend/executor/nodeAgg.c12
-rw-r--r--src/backend/executor/nodeBitmapHeapscan.c4
-rw-r--r--src/backend/executor/nodeBitmapIndexscan.c8
-rw-r--r--src/backend/executor/nodeHash.c20
-rw-r--r--src/backend/executor/nodeHashjoin.c8
-rw-r--r--src/backend/executor/nodeIndexscan.c14
-rw-r--r--src/backend/executor/nodeLimit.c23
-rw-r--r--src/backend/executor/nodeMaterial.c10
-rw-r--r--src/backend/executor/nodeMergejoin.c32
-rw-r--r--src/backend/executor/nodeResult.c12
-rw-r--r--src/backend/executor/nodeSubplan.c24
-rw-r--r--src/backend/executor/nodeSubqueryscan.c4
-rw-r--r--src/backend/executor/nodeTidscan.c12
-rw-r--r--src/backend/executor/spi.c48
-rw-r--r--src/backend/lib/stringinfo.c6
-rw-r--r--src/backend/libpq/auth.c312
-rw-r--r--src/backend/libpq/be-secure.c21
-rw-r--r--src/backend/libpq/hba.c4
-rw-r--r--src/backend/libpq/ip.c3
-rw-r--r--src/backend/libpq/pqcomm.c23
-rw-r--r--src/backend/libpq/pqformat.c6
-rw-r--r--src/backend/main/main.c4
-rw-r--r--src/backend/nodes/copyfuncs.c40
-rw-r--r--src/backend/nodes/equalfuncs.c32
-rw-r--r--src/backend/nodes/outfuncs.c26
-rw-r--r--src/backend/nodes/print.c4
-rw-r--r--src/backend/optimizer/geqo/geqo_eval.c6
-rw-r--r--src/backend/optimizer/path/allpaths.c16
-rw-r--r--src/backend/optimizer/path/costsize.c96
-rw-r--r--src/backend/optimizer/path/equivclass.c303
-rw-r--r--src/backend/optimizer/path/indxpath.c136
-rw-r--r--src/backend/optimizer/path/joinpath.c6
-rw-r--r--src/backend/optimizer/path/joinrels.c40
-rw-r--r--src/backend/optimizer/path/pathkeys.c150
-rw-r--r--src/backend/optimizer/plan/createplan.c64
-rw-r--r--src/backend/optimizer/plan/initsplan.c149
-rw-r--r--src/backend/optimizer/plan/planagg.c20
-rw-r--r--src/backend/optimizer/plan/planmain.c19
-rw-r--r--src/backend/optimizer/plan/planner.c21
-rw-r--r--src/backend/optimizer/plan/setrefs.c145
-rw-r--r--src/backend/optimizer/plan/subselect.c52
-rw-r--r--src/backend/optimizer/prep/prepunion.c16
-rw-r--r--src/backend/optimizer/util/clauses.c77
-rw-r--r--src/backend/optimizer/util/joininfo.c6
-rw-r--r--src/backend/optimizer/util/pathnode.c19
-rw-r--r--src/backend/optimizer/util/plancat.c23
-rw-r--r--src/backend/optimizer/util/predtest.c11
-rw-r--r--src/backend/optimizer/util/relnode.c19
-rw-r--r--src/backend/optimizer/util/restrictinfo.c4
-rw-r--r--src/backend/optimizer/util/tlist.c4
-rw-r--r--src/backend/optimizer/util/var.c4
-rw-r--r--src/backend/parser/analyze.c14
-rw-r--r--src/backend/parser/keywords.c7
-rw-r--r--src/backend/parser/parse_clause.c17
-rw-r--r--src/backend/parser/parse_coerce.c51
-rw-r--r--src/backend/parser/parse_expr.c64
-rw-r--r--src/backend/parser/parse_func.c14
-rw-r--r--src/backend/parser/parse_oper.c10
-rw-r--r--src/backend/parser/parse_target.c12
-rw-r--r--src/backend/parser/parse_type.c36
-rw-r--r--src/backend/parser/parse_utilcmd.c171
-rw-r--r--src/backend/parser/parser.c8
-rw-r--r--src/backend/port/dynloader/darwin.c7
-rw-r--r--src/backend/port/sysv_shmem.c4
-rw-r--r--src/backend/port/win32/mingwcompat.c16
-rw-r--r--src/backend/port/win32/socket.c72
-rw-r--r--src/backend/postmaster/autovacuum.c395
-rw-r--r--src/backend/postmaster/bgwriter.c92
-rw-r--r--src/backend/postmaster/pgarch.c16
-rw-r--r--src/backend/postmaster/pgstat.c142
-rw-r--r--src/backend/postmaster/postmaster.c269
-rw-r--r--src/backend/postmaster/syslogger.c165
-rw-r--r--src/backend/postmaster/walwriter.c18
-rw-r--r--src/backend/regex/regc_color.c9
-rw-r--r--src/backend/rewrite/rewriteDefine.c12
-rw-r--r--src/backend/rewrite/rewriteManip.c12
-rw-r--r--src/backend/snowball/dict_snowball.c13
-rw-r--r--src/backend/storage/buffer/bufmgr.c138
-rw-r--r--src/backend/storage/buffer/freelist.c58
-rw-r--r--src/backend/storage/buffer/localbuf.c6
-rw-r--r--src/backend/storage/file/fd.c37
-rw-r--r--src/backend/storage/ipc/ipc.c31
-rw-r--r--src/backend/storage/ipc/ipci.c4
-rw-r--r--src/backend/storage/ipc/procarray.c113
-rw-r--r--src/backend/storage/ipc/sinvaladt.c5
-rw-r--r--src/backend/storage/large_object/inv_api.c54
-rw-r--r--src/backend/storage/lmgr/deadlock.c16
-rw-r--r--src/backend/storage/lmgr/lmgr.c8
-rw-r--r--src/backend/storage/lmgr/lock.c30
-rw-r--r--src/backend/storage/lmgr/lwlock.c8
-rw-r--r--src/backend/storage/lmgr/proc.c65
-rw-r--r--src/backend/storage/page/bufpage.c19
-rw-r--r--src/backend/storage/smgr/md.c253
-rw-r--r--src/backend/storage/smgr/smgr.c18
-rw-r--r--src/backend/tcop/postgres.c58
-rw-r--r--src/backend/tcop/pquery.c26
-rw-r--r--src/backend/tcop/utility.c59
-rw-r--r--src/backend/tsearch/dict.c6
-rw-r--r--src/backend/tsearch/dict_ispell.c10
-rw-r--r--src/backend/tsearch/dict_simple.c10
-rw-r--r--src/backend/tsearch/dict_synonym.c16
-rw-r--r--src/backend/tsearch/dict_thesaurus.c31
-rw-r--r--src/backend/tsearch/spell.c55
-rw-r--r--src/backend/tsearch/to_tsany.c25
-rw-r--r--src/backend/tsearch/ts_locale.c24
-rw-r--r--src/backend/tsearch/ts_parse.c10
-rw-r--r--src/backend/tsearch/ts_utils.c23
-rw-r--r--src/backend/tsearch/wparser.c24
-rw-r--r--src/backend/tsearch/wparser_def.c22
-rw-r--r--src/backend/utils/adt/arrayutils.c4
-rw-r--r--src/backend/utils/adt/bool.c16
-rw-r--r--src/backend/utils/adt/cash.c14
-rw-r--r--src/backend/utils/adt/date.c35
-rw-r--r--src/backend/utils/adt/datetime.c51
-rw-r--r--src/backend/utils/adt/dbsize.c7
-rw-r--r--src/backend/utils/adt/enum.c118
-rw-r--r--src/backend/utils/adt/float.c98
-rw-r--r--src/backend/utils/adt/format_type.c6
-rw-r--r--src/backend/utils/adt/formatting.c92
-rw-r--r--src/backend/utils/adt/geo_ops.c23
-rw-r--r--src/backend/utils/adt/like.c24
-rw-r--r--src/backend/utils/adt/like_match.c52
-rw-r--r--src/backend/utils/adt/lockfuncs.c4
-rw-r--r--src/backend/utils/adt/network.c10
-rw-r--r--src/backend/utils/adt/numeric.c73
-rw-r--r--src/backend/utils/adt/oracle_compat.c117
-rw-r--r--src/backend/utils/adt/pg_lzcompress.c14
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c24
-rw-r--r--src/backend/utils/adt/regexp.c143
-rw-r--r--src/backend/utils/adt/regproc.c8
-rw-r--r--src/backend/utils/adt/ri_triggers.c172
-rw-r--r--src/backend/utils/adt/ruleutils.c99
-rw-r--r--src/backend/utils/adt/selfuncs.c95
-rw-r--r--src/backend/utils/adt/timestamp.c82
-rw-r--r--src/backend/utils/adt/tsginidx.c9
-rw-r--r--src/backend/utils/adt/tsquery.c101
-rw-r--r--src/backend/utils/adt/tsquery_cleanup.c28
-rw-r--r--src/backend/utils/adt/tsquery_gist.c4
-rw-r--r--src/backend/utils/adt/tsquery_rewrite.c19
-rw-r--r--src/backend/utils/adt/tsquery_util.c24
-rw-r--r--src/backend/utils/adt/tsrank.c78
-rw-r--r--src/backend/utils/adt/tsvector.c61
-rw-r--r--src/backend/utils/adt/tsvector_parser.c47
-rw-r--r--src/backend/utils/adt/txid.c128
-rw-r--r--src/backend/utils/adt/uuid.c88
-rw-r--r--src/backend/utils/adt/varbit.c18
-rw-r--r--src/backend/utils/adt/varchar.c49
-rw-r--r--src/backend/utils/adt/varlena.c39
-rw-r--r--src/backend/utils/adt/xml.c849
-rw-r--r--src/backend/utils/cache/catcache.c10
-rw-r--r--src/backend/utils/cache/inval.c6
-rw-r--r--src/backend/utils/cache/lsyscache.c19
-rw-r--r--src/backend/utils/cache/plancache.c104
-rw-r--r--src/backend/utils/cache/relcache.c37
-rw-r--r--src/backend/utils/cache/ts_cache.c24
-rw-r--r--src/backend/utils/cache/typcache.c4
-rw-r--r--src/backend/utils/error/elog.c185
-rw-r--r--src/backend/utils/fmgr/fmgr.c14
-rw-r--r--src/backend/utils/hash/dynahash.c16
-rw-r--r--src/backend/utils/init/flatfiles.c48
-rw-r--r--src/backend/utils/init/globals.c4
-rw-r--r--src/backend/utils/init/postinit.c15
-rw-r--r--src/backend/utils/mb/conversion_procs/euc_jis_2004_and_shift_jis_2004/euc_jis_2004_and_shift_jis_2004.c38
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c8
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_euc_jis_2004/utf8_and_euc_jis_2004.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_shift_jis_2004/utf8_and_shift_jis_2004.c6
-rw-r--r--src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c6
-rw-r--r--src/backend/utils/mb/encnames.c12
-rw-r--r--src/backend/utils/mb/mbutils.c34
-rw-r--r--src/backend/utils/mb/wchar.c18
-rw-r--r--src/backend/utils/misc/guc.c268
-rw-r--r--src/backend/utils/misc/ps_status.c4
-rw-r--r--src/backend/utils/mmgr/aset.c22
-rw-r--r--src/backend/utils/mmgr/portalmem.c17
-rw-r--r--src/backend/utils/resowner/resowner.c10
-rw-r--r--src/backend/utils/sort/tuplesort.c80
-rw-r--r--src/backend/utils/sort/tuplestore.c25
-rw-r--r--src/backend/utils/time/combocid.c44
-rw-r--r--src/backend/utils/time/tqual.c22
-rw-r--r--src/bin/initdb/initdb.c85
-rw-r--r--src/bin/pg_ctl/pg_ctl.c47
-rw-r--r--src/bin/pg_dump/common.c26
-rw-r--r--src/bin/pg_dump/dumputils.c28
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c10
-rw-r--r--src/bin/pg_dump/pg_backup_tar.c13
-rw-r--r--src/bin/pg_dump/pg_dump.c168
-rw-r--r--src/bin/pg_dump/pg_dump.h30
-rw-r--r--src/bin/pg_dump/pg_dumpall.c83
-rw-r--r--src/bin/pg_resetxlog/pg_resetxlog.c27
-rw-r--r--src/bin/psql/command.c19
-rw-r--r--src/bin/psql/common.c8
-rw-r--r--src/bin/psql/copy.c14
-rw-r--r--src/bin/psql/describe.c115
-rw-r--r--src/bin/psql/help.c4
-rw-r--r--src/bin/psql/tab-complete.c74
-rw-r--r--src/bin/scripts/common.c5
-rw-r--r--src/bin/scripts/common.h4
-rw-r--r--src/include/access/genam.h4
-rw-r--r--src/include/access/gin.h8
-rw-r--r--src/include/access/hash.h14
-rw-r--r--src/include/access/heapam.h22
-rw-r--r--src/include/access/htup.h16
-rw-r--r--src/include/access/nbtree.h20
-rw-r--r--src/include/access/relscan.h8
-rw-r--r--src/include/access/rewriteheap.h4
-rw-r--r--src/include/access/slru.h6
-rw-r--r--src/include/access/transam.h4
-rw-r--r--src/include/access/tupmacs.h8
-rw-r--r--src/include/access/tuptoaster.h14
-rw-r--r--src/include/access/xact.h6
-rw-r--r--src/include/access/xlog.h32
-rw-r--r--src/include/bootstrap/bootstrap.h6
-rw-r--r--src/include/catalog/dependency.h6
-rw-r--r--src/include/catalog/indexing.h26
-rw-r--r--src/include/catalog/namespace.h8
-rw-r--r--src/include/catalog/pg_am.h8
-rw-r--r--src/include/catalog/pg_amop.h258
-rw-r--r--src/include/catalog/pg_amproc.h16
-rw-r--r--src/include/catalog/pg_autovacuum.h18
-rw-r--r--src/include/catalog/pg_cast.h16
-rw-r--r--src/include/catalog/pg_class.h4
-rw-r--r--src/include/catalog/pg_database.h4
-rw-r--r--src/include/catalog/pg_enum.h4
-rw-r--r--src/include/catalog/pg_opclass.h6
-rw-r--r--src/include/catalog/pg_operator.h146
-rw-r--r--src/include/catalog/pg_proc.h106
-rw-r--r--src/include/catalog/pg_trigger.h6
-rw-r--r--src/include/catalog/pg_ts_config.h4
-rw-r--r--src/include/catalog/pg_ts_config_map.h8
-rw-r--r--src/include/catalog/pg_ts_dict.h8
-rw-r--r--src/include/catalog/pg_ts_parser.h4
-rw-r--r--src/include/catalog/pg_ts_template.h6
-rw-r--r--src/include/catalog/pg_type.h52
-rw-r--r--src/include/commands/defrem.h20
-rw-r--r--src/include/commands/discard.h4
-rw-r--r--src/include/commands/explain.h24
-rw-r--r--src/include/commands/portalcmds.h6
-rw-r--r--src/include/commands/prepare.h10
-rw-r--r--src/include/commands/schemacmds.h4
-rw-r--r--src/include/commands/tablecmds.h6
-rw-r--r--src/include/commands/trigger.h12
-rw-r--r--src/include/commands/typecmds.h10
-rw-r--r--src/include/commands/vacuum.h11
-rw-r--r--src/include/commands/variable.h4
-rw-r--r--src/include/executor/execdesc.h12
-rw-r--r--src/include/executor/executor.h22
-rw-r--r--src/include/executor/spi.h12
-rw-r--r--src/include/executor/spi_priv.h8
-rw-r--r--src/include/fmgr.h4
-rw-r--r--src/include/libpq/libpq-be.h35
-rw-r--r--src/include/libpq/pqcomm.h4
-rw-r--r--src/include/mb/pg_wchar.h44
-rw-r--r--src/include/miscadmin.h4
-rw-r--r--src/include/nodes/execnodes.h26
-rw-r--r--src/include/nodes/params.h4
-rw-r--r--src/include/nodes/parsenodes.h70
-rw-r--r--src/include/nodes/plannodes.h10
-rw-r--r--src/include/nodes/primnodes.h18
-rw-r--r--src/include/nodes/relation.h78
-rw-r--r--src/include/optimizer/joininfo.h4
-rw-r--r--src/include/optimizer/paths.h50
-rw-r--r--src/include/optimizer/plancat.h8
-rw-r--r--src/include/optimizer/planmain.h28
-rw-r--r--src/include/optimizer/planner.h16
-rw-r--r--src/include/optimizer/tlist.h4
-rw-r--r--src/include/parser/parse_coerce.h16
-rw-r--r--src/include/parser/parse_type.h10
-rw-r--r--src/include/parser/parse_utilcmd.h6
-rw-r--r--src/include/pgstat.h67
-rw-r--r--src/include/port.h7
-rw-r--r--src/include/port/linux.h4
-rw-r--r--src/include/port/solaris.h4
-rw-r--r--src/include/port/win32.h24
-rw-r--r--src/include/postgres.h72
-rw-r--r--src/include/postmaster/autovacuum.h3
-rw-r--r--src/include/postmaster/syslogger.h21
-rw-r--r--src/include/rewrite/rewriteDefine.h10
-rw-r--r--src/include/snowball/header.h4
-rw-r--r--src/include/storage/buf_internals.h6
-rw-r--r--src/include/storage/bufmgr.h13
-rw-r--r--src/include/storage/bufpage.h13
-rw-r--r--src/include/storage/itemid.h4
-rw-r--r--src/include/storage/large_object.h4
-rw-r--r--src/include/storage/lock.h19
-rw-r--r--src/include/storage/pmsignal.h6
-rw-r--r--src/include/storage/proc.h6
-rw-r--r--src/include/storage/procarray.h8
-rw-r--r--src/include/storage/sinvaladt.h4
-rw-r--r--src/include/storage/smgr.h6
-rw-r--r--src/include/tcop/tcopprot.h6
-rw-r--r--src/include/tcop/utility.h6
-rw-r--r--src/include/tsearch/dicts/regis.h6
-rw-r--r--src/include/tsearch/dicts/spell.h32
-rw-r--r--src/include/tsearch/ts_cache.h12
-rw-r--r--src/include/tsearch/ts_locale.h8
-rw-r--r--src/include/tsearch/ts_public.h24
-rw-r--r--src/include/tsearch/ts_type.h75
-rw-r--r--src/include/tsearch/ts_utils.h49
-rw-r--r--src/include/utils/builtins.h6
-rw-r--r--src/include/utils/elog.h4
-rw-r--r--src/include/utils/guc.h6
-rw-r--r--src/include/utils/guc_tables.h8
-rw-r--r--src/include/utils/inet.h6
-rw-r--r--src/include/utils/lsyscache.h22
-rw-r--r--src/include/utils/pg_lzcompress.h10
-rw-r--r--src/include/utils/plancache.h56
-rw-r--r--src/include/utils/portal.h4
-rw-r--r--src/include/utils/rel.h18
-rw-r--r--src/include/utils/resowner.h6
-rw-r--r--src/include/utils/timestamp.h10
-rw-r--r--src/include/utils/tqual.h35
-rw-r--r--src/include/utils/typcache.h4
-rw-r--r--src/include/utils/uuid.h4
-rw-r--r--src/include/utils/xml.h16
-rw-r--r--src/interfaces/ecpg/compatlib/informix.c6
-rw-r--r--src/interfaces/ecpg/ecpglib/connect.c37
-rw-r--r--src/interfaces/ecpg/ecpglib/data.c46
-rw-r--r--src/interfaces/ecpg/ecpglib/descriptor.c37
-rw-r--r--src/interfaces/ecpg/ecpglib/error.c14
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c175
-rw-r--r--src/interfaces/ecpg/ecpglib/extern.h32
-rw-r--r--src/interfaces/ecpg/ecpglib/memory.c18
-rw-r--r--src/interfaces/ecpg/ecpglib/misc.c24
-rw-r--r--src/interfaces/ecpg/ecpglib/prepare.c363
-rw-r--r--src/interfaces/ecpg/ecpglib/typename.c4
-rw-r--r--src/interfaces/ecpg/include/ecpg-pthread-win32.h19
-rw-r--r--src/interfaces/ecpg/pgtypeslib/datetime.c4
-rw-r--r--src/interfaces/ecpg/pgtypeslib/dt.h38
-rw-r--r--src/interfaces/ecpg/pgtypeslib/dt_common.c19
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c28
-rw-r--r--src/interfaces/ecpg/preproc/ecpg_keywords.c3
-rw-r--r--src/interfaces/ecpg/preproc/extern.h6
-rw-r--r--src/interfaces/ecpg/preproc/keywords.c3
-rw-r--r--src/interfaces/ecpg/preproc/output.c19
-rw-r--r--src/interfaces/ecpg/preproc/parser.c8
-rw-r--r--src/interfaces/ecpg/preproc/type.c8
-rw-r--r--src/interfaces/ecpg/preproc/type.h8
-rw-r--r--src/interfaces/ecpg/test/pg_regress_ecpg.c46
-rw-r--r--src/interfaces/libpq/fe-auth.c265
-rw-r--r--src/interfaces/libpq/fe-auth.h4
-rw-r--r--src/interfaces/libpq/fe-connect.c101
-rw-r--r--src/interfaces/libpq/fe-lobj.c8
-rw-r--r--src/interfaces/libpq/fe-secure.c66
-rw-r--r--src/interfaces/libpq/libpq-int.h39
-rw-r--r--src/pl/plperl/plperl.c73
-rw-r--r--src/pl/plpgsql/src/pl_comp.c15
-rw-r--r--src/pl/plpgsql/src/pl_exec.c98
-rw-r--r--src/pl/plpgsql/src/pl_funcs.c13
-rw-r--r--src/pl/plpgsql/src/plpgsql.h14
-rw-r--r--src/pl/plpython/plpython.c55
-rw-r--r--src/pl/tcl/pltcl.c28
-rw-r--r--src/port/chklocale.c32
-rw-r--r--src/port/dirmod.c27
-rw-r--r--src/port/exec.c8
-rw-r--r--src/port/open.c10
-rw-r--r--src/port/path.c15
-rw-r--r--src/port/strlcat.c18
-rw-r--r--src/test/regress/pg_regress.c332
-rw-r--r--src/test/regress/pg_regress.h24
-rw-r--r--src/test/regress/pg_regress_main.c8
-rw-r--r--src/timezone/localtime.c13
-rw-r--r--src/timezone/pgtz.c33
-rw-r--r--src/timezone/pgtz.h6
-rw-r--r--src/tools/fsync/test_fsync.c39
486 files changed, 10078 insertions, 9698 deletions
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c
index ec8cb72e3b..c57b9919c4 100644
--- a/contrib/cube/cube.c
+++ b/contrib/cube/cube.c
@@ -1,5 +1,5 @@
/******************************************************************************
- $PostgreSQL: pgsql/contrib/cube/cube.c,v 1.33 2007/06/05 21:31:03 tgl Exp $
+ $PostgreSQL: pgsql/contrib/cube/cube.c,v 1.34 2007/11/15 21:14:29 momjian Exp $
This file contains routines that can be bound to a Postgres backend and
called by the backend in the process of processing queries. The calling
@@ -306,7 +306,7 @@ cube_subset(PG_FUNCTION_ARGS)
result->x[i + dim] = c->x[dx[i] + c->dim - 1];
}
- PG_FREE_IF_COPY(c,0);
+ PG_FREE_IF_COPY(c, 0);
PG_RETURN_NDBOX(result);
}
@@ -360,7 +360,7 @@ cube_out(PG_FUNCTION_ARGS)
appendStringInfoChar(&buf, ')');
}
- PG_FREE_IF_COPY(cube,0);
+ PG_FREE_IF_COPY(cube, 0);
PG_RETURN_CSTRING(buf.data);
}
@@ -381,20 +381,20 @@ g_cube_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
NDBOX *query = PG_GETARG_NDBOX(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
- bool res;
+ bool res;
/*
* if entry is not leaf, use g_cube_internal_consistent, else use
* g_cube_leaf_consistent
*/
if (GIST_LEAF(entry))
- res = g_cube_leaf_consistent( DatumGetNDBOX(entry->key),
- query, strategy);
+ res = g_cube_leaf_consistent(DatumGetNDBOX(entry->key),
+ query, strategy);
else
- res = g_cube_internal_consistent( DatumGetNDBOX(entry->key),
- query, strategy);
+ res = g_cube_internal_consistent(DatumGetNDBOX(entry->key),
+ query, strategy);
- PG_FREE_IF_COPY(query,1);
+ PG_FREE_IF_COPY(query, 1);
PG_RETURN_BOOL(res);
}
@@ -451,14 +451,15 @@ Datum
g_cube_decompress(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
- NDBOX *key = DatumGetNDBOX(PG_DETOAST_DATUM(entry->key));
+ NDBOX *key = DatumGetNDBOX(PG_DETOAST_DATUM(entry->key));
if (key != DatumGetNDBOX(entry->key))
{
GISTENTRY *retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
+
gistentryinit(*retval, PointerGetDatum(key),
- entry->rel, entry->page,
- entry->offset, FALSE);
+ entry->rel, entry->page,
+ entry->offset, FALSE);
PG_RETURN_POINTER(retval);
}
PG_RETURN_POINTER(entry);
@@ -479,8 +480,8 @@ g_cube_penalty(PG_FUNCTION_ARGS)
double tmp1,
tmp2;
- ud = cube_union_v0( DatumGetNDBOX(origentry->key),
- DatumGetNDBOX(newentry->key));
+ ud = cube_union_v0(DatumGetNDBOX(origentry->key),
+ DatumGetNDBOX(newentry->key));
rt_cube_size(ud, &tmp1);
rt_cube_size(DatumGetNDBOX(origentry->key), &tmp2);
*result = (float) (tmp1 - tmp2);
@@ -812,12 +813,12 @@ cube_union(PG_FUNCTION_ARGS)
{
NDBOX *a = PG_GETARG_NDBOX(0),
*b = PG_GETARG_NDBOX(1);
- NDBOX *res;
+ NDBOX *res;
res = cube_union_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_NDBOX(res);
}
@@ -876,8 +877,9 @@ cube_inter(PG_FUNCTION_ARGS)
a->x[i + a->dim]), result->x[i + a->dim]);
}
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
+
/*
* Is it OK to return a non-null intersection for non-overlapping boxes?
*/
@@ -899,7 +901,7 @@ cube_size(PG_FUNCTION_ARGS)
for (i = 0, j = a->dim; i < a->dim; i++, j++)
result = result * Abs((a->x[j] - a->x[i]));
- PG_FREE_IF_COPY(a,0);
+ PG_FREE_IF_COPY(a, 0);
PG_RETURN_FLOAT8(result);
}
@@ -1011,8 +1013,8 @@ cube_cmp(PG_FUNCTION_ARGS)
res = cube_cmp_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_INT32(res);
}
@@ -1026,8 +1028,8 @@ cube_eq(PG_FUNCTION_ARGS)
res = cube_cmp_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_BOOL(res == 0);
}
@@ -1041,8 +1043,8 @@ cube_ne(PG_FUNCTION_ARGS)
res = cube_cmp_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_BOOL(res != 0);
}
@@ -1056,8 +1058,8 @@ cube_lt(PG_FUNCTION_ARGS)
res = cube_cmp_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_BOOL(res < 0);
}
@@ -1071,8 +1073,8 @@ cube_gt(PG_FUNCTION_ARGS)
res = cube_cmp_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_BOOL(res > 0);
}
@@ -1086,8 +1088,8 @@ cube_le(PG_FUNCTION_ARGS)
res = cube_cmp_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_BOOL(res <= 0);
}
@@ -1101,8 +1103,8 @@ cube_ge(PG_FUNCTION_ARGS)
res = cube_cmp_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_BOOL(res >= 0);
}
@@ -1157,8 +1159,8 @@ cube_contains(PG_FUNCTION_ARGS)
res = cube_contains_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_BOOL(res);
}
@@ -1173,8 +1175,8 @@ cube_contained(PG_FUNCTION_ARGS)
res = cube_contains_v0(b, a);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_BOOL(res);
}
@@ -1234,8 +1236,8 @@ cube_overlap(PG_FUNCTION_ARGS)
res = cube_overlap_v0(a, b);
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_BOOL(res);
}
@@ -1281,8 +1283,8 @@ cube_distance(PG_FUNCTION_ARGS)
distance += d * d;
}
- PG_FREE_IF_COPY(a,0);
- PG_FREE_IF_COPY(b,1);
+ PG_FREE_IF_COPY(a, 0);
+ PG_FREE_IF_COPY(b, 1);
PG_RETURN_FLOAT8(sqrt(distance));
}
@@ -1317,7 +1319,7 @@ cube_is_point(PG_FUNCTION_ARGS)
PG_RETURN_BOOL(FALSE);
}
- PG_FREE_IF_COPY(a,0);
+ PG_FREE_IF_COPY(a, 0);
PG_RETURN_BOOL(TRUE);
}
@@ -1331,7 +1333,7 @@ cube_dim(PG_FUNCTION_ARGS)
c = PG_GETARG_NDBOX(0);
dim = c->dim;
- PG_FREE_IF_COPY(c,0);
+ PG_FREE_IF_COPY(c, 0);
PG_RETURN_INT32(c->dim);
}
@@ -1350,7 +1352,7 @@ cube_ll_coord(PG_FUNCTION_ARGS)
if (c->dim >= n && n > 0)
result = Min(c->x[n - 1], c->x[c->dim + n - 1]);
- PG_FREE_IF_COPY(c,0);
+ PG_FREE_IF_COPY(c, 0);
PG_RETURN_FLOAT8(result);
}
@@ -1369,7 +1371,7 @@ cube_ur_coord(PG_FUNCTION_ARGS)
if (c->dim >= n && n > 0)
result = Max(c->x[n - 1], c->x[c->dim + n - 1]);
- PG_FREE_IF_COPY(c,0);
+ PG_FREE_IF_COPY(c, 0);
PG_RETURN_FLOAT8(result);
}
@@ -1384,7 +1386,7 @@ cube_enlarge(PG_FUNCTION_ARGS)
j,
k;
NDBOX *a;
- double r;
+ double r;
int4 n;
a = PG_GETARG_NDBOX(0);
@@ -1426,7 +1428,7 @@ cube_enlarge(PG_FUNCTION_ARGS)
result->x[j] = r;
}
- PG_FREE_IF_COPY(a,0);
+ PG_FREE_IF_COPY(a, 0);
PG_RETURN_NDBOX(result);
}
@@ -1490,7 +1492,7 @@ cube_c_f8(PG_FUNCTION_ARGS)
result->x[result->dim - 1] = x;
result->x[2 * result->dim - 1] = x;
- PG_FREE_IF_COPY(c,0);
+ PG_FREE_IF_COPY(c, 0);
PG_RETURN_NDBOX(result);
}
@@ -1521,6 +1523,6 @@ cube_c_f8_f8(PG_FUNCTION_ARGS)
result->x[result->dim - 1] = x1;
result->x[2 * result->dim - 1] = x2;
- PG_FREE_IF_COPY(c,0);
+ PG_FREE_IF_COPY(c, 0);
PG_RETURN_NDBOX(result);
}
diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c
index 295a779772..dd5cfc7f86 100644
--- a/contrib/dblink/dblink.c
+++ b/contrib/dblink/dblink.c
@@ -8,7 +8,7 @@
* Darko Prenosil <[email protected]>
* Shridhar Daithankar <[email protected]>
*
- * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.65 2007/08/27 01:24:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.66 2007/11/15 21:14:29 momjian Exp $
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
* ALL RIGHTS RESERVED;
*
@@ -256,10 +256,10 @@ dblink_connect(PG_FUNCTION_ARGS)
pfree(rconn);
ereport(ERROR,
- (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED),
- errmsg("password is required"),
- errdetail("Non-superuser cannot connect if the server does not request a password."),
- errhint("Target server's authentication method must be changed.")));
+ (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED),
+ errmsg("password is required"),
+ errdetail("Non-superuser cannot connect if the server does not request a password."),
+ errhint("Target server's authentication method must be changed.")));
}
}
diff --git a/contrib/dict_int/dict_int.c b/contrib/dict_int/dict_int.c
index 85d45491cc..5cc2111adc 100644
--- a/contrib/dict_int/dict_int.c
+++ b/contrib/dict_int/dict_int.c
@@ -6,7 +6,7 @@
* Copyright (c) 2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/dict_int/dict_int.c,v 1.1 2007/10/15 21:36:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/dict_int/dict_int.c,v 1.2 2007/11/15 21:14:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,24 +19,25 @@
PG_MODULE_MAGIC;
-typedef struct {
- int maxlen;
- bool rejectlong;
-} DictInt;
+typedef struct
+{
+ int maxlen;
+ bool rejectlong;
+} DictInt;
PG_FUNCTION_INFO_V1(dintdict_init);
-Datum dintdict_init(PG_FUNCTION_ARGS);
+Datum dintdict_init(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(dintdict_lexize);
-Datum dintdict_lexize(PG_FUNCTION_ARGS);
+Datum dintdict_lexize(PG_FUNCTION_ARGS);
Datum
dintdict_init(PG_FUNCTION_ARGS)
{
- List *dictoptions = (List *) PG_GETARG_POINTER(0);
- DictInt *d;
- ListCell *l;
+ List *dictoptions = (List *) PG_GETARG_POINTER(0);
+ DictInt *d;
+ ListCell *l;
d = (DictInt *) palloc0(sizeof(DictInt));
d->maxlen = 6;
@@ -44,7 +45,7 @@ dintdict_init(PG_FUNCTION_ARGS)
foreach(l, dictoptions)
{
- DefElem *defel = (DefElem *) lfirst(l);
+ DefElem *defel = (DefElem *) lfirst(l);
if (pg_strcasecmp(defel->defname, "MAXLEN") == 0)
{
@@ -62,22 +63,22 @@ dintdict_init(PG_FUNCTION_ARGS)
defel->defname)));
}
}
-
+
PG_RETURN_POINTER(d);
}
Datum
dintdict_lexize(PG_FUNCTION_ARGS)
{
- DictInt *d = (DictInt*)PG_GETARG_POINTER(0);
- char *in = (char*)PG_GETARG_POINTER(1);
- char *txt = pnstrdup(in, PG_GETARG_INT32(2));
- TSLexeme *res=palloc(sizeof(TSLexeme)*2);
+ DictInt *d = (DictInt *) PG_GETARG_POINTER(0);
+ char *in = (char *) PG_GETARG_POINTER(1);
+ char *txt = pnstrdup(in, PG_GETARG_INT32(2));
+ TSLexeme *res = palloc(sizeof(TSLexeme) * 2);
res[1].lexeme = NULL;
- if (PG_GETARG_INT32(2) > d->maxlen)
+ if (PG_GETARG_INT32(2) > d->maxlen)
{
- if ( d->rejectlong )
+ if (d->rejectlong)
{
/* reject by returning void array */
pfree(txt);
diff --git a/contrib/dict_xsyn/dict_xsyn.c b/contrib/dict_xsyn/dict_xsyn.c
index 1cd53a26bd..753886117d 100644
--- a/contrib/dict_xsyn/dict_xsyn.c
+++ b/contrib/dict_xsyn/dict_xsyn.c
@@ -6,7 +6,7 @@
* Copyright (c) 2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/dict_xsyn/dict_xsyn.c,v 1.1 2007/10/15 21:36:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/dict_xsyn/dict_xsyn.c,v 1.2 2007/11/15 21:14:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,29 +24,30 @@ PG_MODULE_MAGIC;
typedef struct
{
- char *key; /* Word */
- char *value; /* Unparsed list of synonyms, including the word itself */
+ char *key; /* Word */
+ char *value; /* Unparsed list of synonyms, including the
+ * word itself */
} Syn;
typedef struct
{
- int len;
- Syn *syn;
+ int len;
+ Syn *syn;
- bool keeporig;
+ bool keeporig;
} DictSyn;
PG_FUNCTION_INFO_V1(dxsyn_init);
-Datum dxsyn_init(PG_FUNCTION_ARGS);
+Datum dxsyn_init(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(dxsyn_lexize);
-Datum dxsyn_lexize(PG_FUNCTION_ARGS);
+Datum dxsyn_lexize(PG_FUNCTION_ARGS);
static char *
find_word(char *in, char **end)
{
- char *start;
+ char *start;
*end = NULL;
while (*in && t_isspace(in))
@@ -71,12 +72,12 @@ compare_syn(const void *a, const void *b)
}
static void
-read_dictionary(DictSyn *d, char *filename)
+read_dictionary(DictSyn * d, char *filename)
{
- char *real_filename = get_tsearch_config_filename(filename, "rules");
- FILE *fin;
- char *line;
- int cur = 0;
+ char *real_filename = get_tsearch_config_filename(filename, "rules");
+ FILE *fin;
+ char *line;
+ int cur = 0;
if ((fin = AllocateFile(real_filename, "r")) == NULL)
ereport(ERROR,
@@ -86,9 +87,9 @@ read_dictionary(DictSyn *d, char *filename)
while ((line = t_readline(fin)) != NULL)
{
- char *value;
- char *key;
- char *end = NULL;
+ char *value;
+ char *key;
+ char *end = NULL;
if (*line == '\0')
continue;
@@ -130,9 +131,9 @@ read_dictionary(DictSyn *d, char *filename)
Datum
dxsyn_init(PG_FUNCTION_ARGS)
{
- List *dictoptions = (List *) PG_GETARG_POINTER(0);
- DictSyn *d;
- ListCell *l;
+ List *dictoptions = (List *) PG_GETARG_POINTER(0);
+ DictSyn *d;
+ ListCell *l;
d = (DictSyn *) palloc0(sizeof(DictSyn));
d->len = 0;
@@ -141,7 +142,7 @@ dxsyn_init(PG_FUNCTION_ARGS)
foreach(l, dictoptions)
{
- DefElem *defel = (DefElem *) lfirst(l);
+ DefElem *defel = (DefElem *) lfirst(l);
if (pg_strcasecmp(defel->defname, "KEEPORIG") == 0)
{
@@ -166,19 +167,19 @@ dxsyn_init(PG_FUNCTION_ARGS)
Datum
dxsyn_lexize(PG_FUNCTION_ARGS)
{
- DictSyn *d = (DictSyn *) PG_GETARG_POINTER(0);
- char *in = (char *) PG_GETARG_POINTER(1);
- int length = PG_GETARG_INT32(2);
- Syn word;
- Syn *found;
- TSLexeme *res = NULL;
+ DictSyn *d = (DictSyn *) PG_GETARG_POINTER(0);
+ char *in = (char *) PG_GETARG_POINTER(1);
+ int length = PG_GETARG_INT32(2);
+ Syn word;
+ Syn *found;
+ TSLexeme *res = NULL;
if (!length || d->len == 0)
PG_RETURN_POINTER(NULL);
/* Create search pattern */
{
- char *temp = pnstrdup(in, length);
+ char *temp = pnstrdup(in, length);
word.key = lowerstr(temp);
pfree(temp);
@@ -186,7 +187,7 @@ dxsyn_lexize(PG_FUNCTION_ARGS)
}
/* Look for matching syn */
- found = (Syn *)bsearch(&word, d->syn, d->len, sizeof(Syn), compare_syn);
+ found = (Syn *) bsearch(&word, d->syn, d->len, sizeof(Syn), compare_syn);
pfree(word.key);
if (!found)
@@ -194,28 +195,28 @@ dxsyn_lexize(PG_FUNCTION_ARGS)
/* Parse string of synonyms and return array of words */
{
- char *value = pstrdup(found->value);
- int value_length = strlen(value);
- char *pos = value;
- int nsyns = 0;
- bool is_first = true;
+ char *value = pstrdup(found->value);
+ int value_length = strlen(value);
+ char *pos = value;
+ int nsyns = 0;
+ bool is_first = true;
res = palloc(0);
- while(pos < value + value_length)
+ while (pos < value + value_length)
{
- char *end;
- char *syn = find_word(pos, &end);
+ char *end;
+ char *syn = find_word(pos, &end);
if (!syn)
break;
*end = '\0';
- res = repalloc(res, sizeof(TSLexeme)*(nsyns + 2));
+ res = repalloc(res, sizeof(TSLexeme) * (nsyns + 2));
res[nsyns].lexeme = NULL;
/* first word is added to result only if KEEPORIG flag is set */
- if(d->keeporig || !is_first)
+ if (d->keeporig || !is_first)
{
res[nsyns].lexeme = pstrdup(syn);
res[nsyns + 1].lexeme = NULL;
diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h
index 5ef18abd8e..48ec6e0648 100644
--- a/contrib/hstore/hstore.h
+++ b/contrib/hstore/hstore.h
@@ -50,7 +50,7 @@ typedef struct
int comparePairs(const void *a, const void *b);
int uniquePairs(Pairs * a, int4 l, int4 *buflen);
-#define HStoreContainsStrategyNumber 7
-#define HStoreExistsStrategyNumber 9
+#define HStoreContainsStrategyNumber 7
+#define HStoreExistsStrategyNumber 9
#endif
diff --git a/contrib/hstore/hstore_gin.c b/contrib/hstore/hstore_gin.c
index f6fab2b89d..144758f3cd 100644
--- a/contrib/hstore/hstore_gin.c
+++ b/contrib/hstore/hstore_gin.c
@@ -1,24 +1,24 @@
#include "hstore.h"
-#include "access/gin.h"
+#include "access/gin.h"
-#define KEYFLAG 'K'
-#define VALFLAG 'V'
-#define NULLFLAG 'N'
+#define KEYFLAG 'K'
+#define VALFLAG 'V'
+#define NULLFLAG 'N'
PG_FUNCTION_INFO_V1(gin_extract_hstore);
-Datum gin_extract_hstore(PG_FUNCTION_ARGS);
+Datum gin_extract_hstore(PG_FUNCTION_ARGS);
-static text*
-makeitem( char *str, int len )
+static text *
+makeitem(char *str, int len)
{
- text *item;
+ text *item;
- item = (text*)palloc( VARHDRSZ + len + 1 );
+ item = (text *) palloc(VARHDRSZ + len + 1);
SET_VARSIZE(item, VARHDRSZ + len + 1);
- if ( str && len > 0 )
- memcpy( VARDATA(item)+1, str, len );
+ if (str && len > 0)
+ memcpy(VARDATA(item) + 1, str, len);
return item;
}
@@ -26,37 +26,37 @@ makeitem( char *str, int len )
Datum
gin_extract_hstore(PG_FUNCTION_ARGS)
{
- HStore *hs = PG_GETARG_HS(0);
- int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
- Datum *entries = NULL;
+ HStore *hs = PG_GETARG_HS(0);
+ int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
+ Datum *entries = NULL;
- *nentries = 2*hs->size;
+ *nentries = 2 * hs->size;
- if ( hs->size > 0 )
+ if (hs->size > 0)
{
- HEntry *ptr = ARRPTR(hs);
- char *words = STRPTR(hs);
- int i=0;
+ HEntry *ptr = ARRPTR(hs);
+ char *words = STRPTR(hs);
+ int i = 0;
- entries = (Datum*)palloc( sizeof(Datum) * 2 * hs->size );
+ entries = (Datum *) palloc(sizeof(Datum) * 2 * hs->size);
while (ptr - ARRPTR(hs) < hs->size)
{
- text *item;
+ text *item;
- item = makeitem( words + ptr->pos, ptr->keylen );
+ item = makeitem(words + ptr->pos, ptr->keylen);
*VARDATA(item) = KEYFLAG;
entries[i++] = PointerGetDatum(item);
- if ( ptr->valisnull )
+ if (ptr->valisnull)
{
- item = makeitem( NULL, 0 );
+ item = makeitem(NULL, 0);
*VARDATA(item) = NULLFLAG;
}
else
{
- item = makeitem( words + ptr->pos + ptr->keylen, ptr->vallen );
+ item = makeitem(words + ptr->pos + ptr->keylen, ptr->vallen);
*VARDATA(item) = VALFLAG;
}
entries[i++] = PointerGetDatum(item);
@@ -65,36 +65,37 @@ gin_extract_hstore(PG_FUNCTION_ARGS)
}
}
- PG_FREE_IF_COPY(hs,0);
+ PG_FREE_IF_COPY(hs, 0);
PG_RETURN_POINTER(entries);
}
PG_FUNCTION_INFO_V1(gin_extract_hstore_query);
-Datum gin_extract_hstore_query(PG_FUNCTION_ARGS);
+Datum gin_extract_hstore_query(PG_FUNCTION_ARGS);
Datum
gin_extract_hstore_query(PG_FUNCTION_ARGS)
{
StrategyNumber strategy = PG_GETARG_UINT16(2);
- if ( strategy == HStoreContainsStrategyNumber )
+ if (strategy == HStoreContainsStrategyNumber)
{
- PG_RETURN_DATUM( DirectFunctionCall2(
- gin_extract_hstore,
- PG_GETARG_DATUM(0),
- PG_GETARG_DATUM(1)
- ));
+ PG_RETURN_DATUM(DirectFunctionCall2(
+ gin_extract_hstore,
+ PG_GETARG_DATUM(0),
+ PG_GETARG_DATUM(1)
+ ));
}
- else if ( strategy == HStoreExistsStrategyNumber )
+ else if (strategy == HStoreExistsStrategyNumber)
{
- text *item, *q = PG_GETARG_TEXT_P(0);
- int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
- Datum *entries = NULL;
+ text *item,
+ *q = PG_GETARG_TEXT_P(0);
+ int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
+ Datum *entries = NULL;
*nentries = 1;
- entries = (Datum*)palloc( sizeof(Datum) );
+ entries = (Datum *) palloc(sizeof(Datum));
- item = makeitem( VARDATA(q), VARSIZE(q)-VARHDRSZ );
+ item = makeitem(VARDATA(q), VARSIZE(q) - VARHDRSZ);
*VARDATA(item) = KEYFLAG;
entries[0] = PointerGetDatum(item);
@@ -107,29 +108,28 @@ gin_extract_hstore_query(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(gin_consistent_hstore);
-Datum gin_consistent_hstore(PG_FUNCTION_ARGS);
+Datum gin_consistent_hstore(PG_FUNCTION_ARGS);
Datum
gin_consistent_hstore(PG_FUNCTION_ARGS)
{
StrategyNumber strategy = PG_GETARG_UINT16(1);
- bool res = true;
+ bool res = true;
- if ( strategy == HStoreContainsStrategyNumber )
+ if (strategy == HStoreContainsStrategyNumber)
{
- bool *check = (bool *) PG_GETARG_POINTER(0);
- HStore *query = PG_GETARG_HS(2);
- int i;
+ bool *check = (bool *) PG_GETARG_POINTER(0);
+ HStore *query = PG_GETARG_HS(2);
+ int i;
- for(i=0;res && i<2*query->size;i++)
- if ( check[i] == false )
+ for (i = 0; res && i < 2 * query->size; i++)
+ if (check[i] == false)
res = false;
}
- else if ( strategy == HStoreExistsStrategyNumber )
+ else if (strategy == HStoreExistsStrategyNumber)
res = true;
else
elog(ERROR, "Unsupported strategy number: %d", strategy);
PG_RETURN_BOOL(res);
}
-
diff --git a/contrib/hstore/hstore_op.c b/contrib/hstore/hstore_op.c
index 74597c3490..bcac30ee6f 100644
--- a/contrib/hstore/hstore_op.c
+++ b/contrib/hstore/hstore_op.c
@@ -275,13 +275,13 @@ tconvert(PG_FUNCTION_ARGS)
int len;
HStore *out;
- if ( PG_ARGISNULL(0) )
+ if (PG_ARGISNULL(0))
PG_RETURN_NULL();
key = PG_GETARG_TEXT_P(0);
- if ( PG_ARGISNULL(1) )
- len = CALCDATASIZE(1, VARSIZE(key) );
+ if (PG_ARGISNULL(1))
+ len = CALCDATASIZE(1, VARSIZE(key));
else
{
val = PG_GETARG_TEXT_P(1);
@@ -292,7 +292,7 @@ tconvert(PG_FUNCTION_ARGS)
out->size = 1;
ARRPTR(out)->keylen = VARSIZE(key) - VARHDRSZ;
- if ( PG_ARGISNULL(1) )
+ if (PG_ARGISNULL(1))
{
ARRPTR(out)->vallen = 0;
ARRPTR(out)->valisnull = true;
@@ -537,18 +537,18 @@ hs_contains(PG_FUNCTION_ARGS)
if (entry)
{
- if ( te->valisnull || entry->valisnull )
+ if (te->valisnull || entry->valisnull)
{
- if ( !(te->valisnull && entry->valisnull) )
+ if (!(te->valisnull && entry->valisnull))
res = false;
}
- else if ( te->vallen != entry->vallen ||
- strncmp(
- vv + entry->pos + entry->keylen,
- tv + te->pos + te->keylen,
- te->vallen)
- )
- res = false;
+ else if (te->vallen != entry->vallen ||
+ strncmp(
+ vv + entry->pos + entry->keylen,
+ tv + te->pos + te->keylen,
+ te->vallen)
+ )
+ res = false;
}
else
res = false;
diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c
index 2248428786..6856a68e03 100644
--- a/contrib/intarray/_int_gin.c
+++ b/contrib/intarray/_int_gin.c
@@ -57,16 +57,17 @@ ginint4_queryextract(PG_FUNCTION_ARGS)
}
}
- if ( nentries == 0 )
+ if (nentries == 0)
{
- switch( strategy )
+ switch (strategy)
{
case BooleanSearchStrategy:
case RTOverlapStrategyNumber:
- *nentries = -1; /* nobody can be found */
- break;
- default: /* require fullscan: GIN can't find void arrays */
- break;
+ *nentries = -1; /* nobody can be found */
+ break;
+ default: /* require fullscan: GIN can't find void
+ * arrays */
+ break;
}
}
diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c
index 3c34cb67a7..51cc77b863 100644
--- a/contrib/intarray/_int_gist.c
+++ b/contrib/intarray/_int_gist.c
@@ -233,10 +233,11 @@ g_int_decompress(PG_FUNCTION_ARGS)
CHECKARRVALID(in);
if (ARRISVOID(in))
{
- if (in != (ArrayType *) DatumGetPointer(entry->key)) {
+ if (in != (ArrayType *) DatumGetPointer(entry->key))
+ {
retval = palloc(sizeof(GISTENTRY));
gistentryinit(*retval, PointerGetDatum(in),
- entry->rel, entry->page, entry->offset, FALSE);
+ entry->rel, entry->page, entry->offset, FALSE);
PG_RETURN_POINTER(retval);
}
diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c
index 1dfb940e92..9134fc06d8 100644
--- a/contrib/isn/isn.c
+++ b/contrib/isn/isn.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/isn/isn.c,v 1.6 2007/06/05 21:31:03 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/isn/isn.c,v 1.7 2007/11/15 21:14:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -506,7 +506,7 @@ ean2UPC(char *isn)
* Returns the ean13 value of the string.
*/
static
-ean13
+ ean13
str2ean(const char *num)
{
ean13 ean = 0; /* current ean */
diff --git a/contrib/pageinspect/btreefuncs.c b/contrib/pageinspect/btreefuncs.c
index 6251fd5b5f..ce8b97e46b 100644
--- a/contrib/pageinspect/btreefuncs.c
+++ b/contrib/pageinspect/btreefuncs.c
@@ -302,9 +302,9 @@ bt_page_items(PG_FUNCTION_ARGS)
buffer = ReadBuffer(rel, blkno);
/*
- * We copy the page into local storage to avoid holding pin on
- * the buffer longer than we must, and possibly failing to
- * release it at all if the calling query doesn't fetch all rows.
+ * We copy the page into local storage to avoid holding pin on the
+ * buffer longer than we must, and possibly failing to release it at
+ * all if the calling query doesn't fetch all rows.
*/
mctx = MemoryContextSwitchTo(fctx->multi_call_memory_ctx);
diff --git a/contrib/pageinspect/heapfuncs.c b/contrib/pageinspect/heapfuncs.c
index 931c1a5036..31b5b2e642 100644
--- a/contrib/pageinspect/heapfuncs.c
+++ b/contrib/pageinspect/heapfuncs.c
@@ -8,17 +8,17 @@
* information as possible, even if it's nonsense. That's because if a
* page is corrupt, we don't know why and how exactly it is corrupt, so we
* let the user to judge it.
- *
+ *
* These functions are restricted to superusers for the fear of introducing
- * security holes if the input checking isn't as water-tight as it should.
- * You'd need to be superuser to obtain a raw page image anyway, so
+ * security holes if the input checking isn't as water-tight as it should.
+ * You'd need to be superuser to obtain a raw page image anyway, so
* there's hardly any use case for using these without superuser-rights
* anyway.
*
* Copyright (c) 2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/pageinspect/heapfuncs.c,v 1.2 2007/09/12 22:10:25 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pageinspect/heapfuncs.c,v 1.3 2007/11/15 21:14:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,10 +34,10 @@
#include "utils/builtins.h"
#include "miscadmin.h"
-Datum heap_page_items(PG_FUNCTION_ARGS);
+Datum heap_page_items(PG_FUNCTION_ARGS);
#define GET_TEXT(str_) \
- DirectFunctionCall1(textin, CStringGetDatum(str_))
+ DirectFunctionCall1(textin, CStringGetDatum(str_))
/*
* bits_to_text
@@ -48,12 +48,12 @@ Datum heap_page_items(PG_FUNCTION_ARGS);
static char *
bits_to_text(bits8 *bits, int len)
{
- int i;
- char *str;
+ int i;
+ char *str;
str = palloc(len + 1);
-
- for(i = 0; i < len; i++)
+
+ for (i = 0; i < len; i++)
str[i] = (bits[(i / 8)] & (1 << (i % 8))) ? '1' : '0';
str[i] = '\0';
@@ -74,15 +74,15 @@ typedef struct heap_page_items_state
TupleDesc tupd;
Page page;
uint16 offset;
-} heap_page_items_state;
+} heap_page_items_state;
Datum
heap_page_items(PG_FUNCTION_ARGS)
{
- bytea *raw_page = PG_GETARG_BYTEA_P(0);
+ bytea *raw_page = PG_GETARG_BYTEA_P(0);
heap_page_items_state *inter_call_data = NULL;
FuncCallContext *fctx;
- int raw_page_size;
+ int raw_page_size;
if (!superuser())
ereport(ERROR,
@@ -96,10 +96,10 @@ heap_page_items(PG_FUNCTION_ARGS)
TupleDesc tupdesc;
MemoryContext mctx;
- if(raw_page_size < SizeOfPageHeaderData)
- ereport(ERROR,
+ if (raw_page_size < SizeOfPageHeaderData)
+ ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("input page too small (%d bytes)", raw_page_size)));
+ errmsg("input page too small (%d bytes)", raw_page_size)));
fctx = SRF_FIRSTCALL_INIT();
mctx = MemoryContextSwitchTo(fctx->multi_call_memory_ctx);
@@ -132,42 +132,42 @@ heap_page_items(PG_FUNCTION_ARGS)
ItemId id;
Datum values[13];
bool nulls[13];
- uint16 lp_offset;
+ uint16 lp_offset;
uint16 lp_flags;
uint16 lp_len;
memset(nulls, 0, sizeof(nulls));
/* Extract information from the line pointer */
-
+
id = PageGetItemId(page, inter_call_data->offset);
- lp_offset = ItemIdGetOffset(id);
- lp_flags = ItemIdGetFlags(id);
- lp_len = ItemIdGetLength(id);
+ lp_offset = ItemIdGetOffset(id);
+ lp_flags = ItemIdGetFlags(id);
+ lp_len = ItemIdGetLength(id);
values[0] = UInt16GetDatum(inter_call_data->offset);
values[1] = UInt16GetDatum(lp_offset);
values[2] = UInt16GetDatum(lp_flags);
values[3] = UInt16GetDatum(lp_len);
- /* We do just enough validity checking to make sure we don't
- * reference data outside the page passed to us. The page
- * could be corrupt in many other ways, but at least we won't
- * crash.
+ /*
+ * We do just enough validity checking to make sure we don't reference
+ * data outside the page passed to us. The page could be corrupt in
+ * many other ways, but at least we won't crash.
*/
if (ItemIdHasStorage(id) &&
lp_len >= sizeof(HeapTupleHeader) &&
lp_offset == MAXALIGN(lp_offset) &&
lp_offset + lp_len <= raw_page_size)
{
- HeapTupleHeader tuphdr;
- int bits_len;
+ HeapTupleHeader tuphdr;
+ int bits_len;
/* Extract information from the tuple header */
tuphdr = (HeapTupleHeader) PageGetItem(page, id);
-
+
values[4] = UInt32GetDatum(HeapTupleHeaderGetXmin(tuphdr));
values[5] = UInt32GetDatum(HeapTupleHeaderGetXmax(tuphdr));
values[6] = UInt32GetDatum(HeapTupleHeaderGetRawCommandId(tuphdr)); /* shared with xvac */
@@ -176,22 +176,23 @@ heap_page_items(PG_FUNCTION_ARGS)
values[9] = UInt16GetDatum(tuphdr->t_infomask);
values[10] = UInt8GetDatum(tuphdr->t_hoff);
- /* We already checked that the item as is completely within
- * the raw page passed to us, with the length given in the line
+ /*
+ * We already checked that the item as is completely within the
+ * raw page passed to us, with the length given in the line
* pointer.. Let's check that t_hoff doesn't point over lp_len,
* before using it to access t_bits and oid.
*/
- if (tuphdr->t_hoff >= sizeof(HeapTupleHeader) &&
+ if (tuphdr->t_hoff >= sizeof(HeapTupleHeader) &&
tuphdr->t_hoff <= lp_len)
{
if (tuphdr->t_infomask & HEAP_HASNULL)
{
- bits_len = tuphdr->t_hoff -
- (((char *)tuphdr->t_bits) - ((char *)tuphdr));
+ bits_len = tuphdr->t_hoff -
+ (((char *) tuphdr->t_bits) -((char *) tuphdr));
values[11] = GET_TEXT(
- bits_to_text(tuphdr->t_bits, bits_len * 8));
- }
+ bits_to_text(tuphdr->t_bits, bits_len * 8));
+ }
else
nulls[11] = true;
@@ -208,17 +209,19 @@ heap_page_items(PG_FUNCTION_ARGS)
}
else
{
- /* The line pointer is not used, or it's invalid. Set the rest of
- * the fields to NULL */
- int i;
+ /*
+ * The line pointer is not used, or it's invalid. Set the rest of
+ * the fields to NULL
+ */
+ int i;
- for(i = 4; i <= 12; i++)
+ for (i = 4; i <= 12; i++)
nulls[i] = true;
}
- /* Build and return the result tuple. */
- resultTuple = heap_form_tuple(inter_call_data->tupd, values, nulls);
- result = HeapTupleGetDatum(resultTuple);
+ /* Build and return the result tuple. */
+ resultTuple = heap_form_tuple(inter_call_data->tupd, values, nulls);
+ result = HeapTupleGetDatum(resultTuple);
inter_call_data->offset++;
diff --git a/contrib/pageinspect/rawpage.c b/contrib/pageinspect/rawpage.c
index 80632be9fb..7d69fd5e22 100644
--- a/contrib/pageinspect/rawpage.c
+++ b/contrib/pageinspect/rawpage.c
@@ -8,7 +8,7 @@
* Copyright (c) 2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.2 2007/09/21 21:25:42 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.3 2007/11/15 21:14:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,8 +26,8 @@
PG_MODULE_MAGIC;
-Datum get_raw_page(PG_FUNCTION_ARGS);
-Datum page_header(PG_FUNCTION_ARGS);
+Datum get_raw_page(PG_FUNCTION_ARGS);
+Datum page_header(PG_FUNCTION_ARGS);
/*
* get_raw_page
@@ -43,9 +43,9 @@ get_raw_page(PG_FUNCTION_ARGS)
uint32 blkno = PG_GETARG_UINT32(1);
Relation rel;
- RangeVar *relrv;
- bytea *raw_page;
- char *raw_page_data;
+ RangeVar *relrv;
+ bytea *raw_page;
+ char *raw_page_data;
Buffer buf;
if (!superuser())
@@ -61,12 +61,12 @@ get_raw_page(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("cannot get raw page from view \"%s\"",
- RelationGetRelationName(rel))));
+ RelationGetRelationName(rel))));
if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("cannot get raw page from composite type \"%s\"",
- RelationGetRelationName(rel))));
+ RelationGetRelationName(rel))));
if (blkno >= RelationGetNumberOfBlocks(rel))
elog(ERROR, "block number %u is out of range for relation \"%s\"",
@@ -125,13 +125,13 @@ page_header(PG_FUNCTION_ARGS)
raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
/*
- * Check that enough data was supplied, so that we don't try to access
- * fields outside the supplied buffer.
+ * Check that enough data was supplied, so that we don't try to access
+ * fields outside the supplied buffer.
*/
- if(raw_page_size < sizeof(PageHeaderData))
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("input page too small (%d bytes)", raw_page_size)));
+ if (raw_page_size < sizeof(PageHeaderData))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("input page too small (%d bytes)", raw_page_size)));
page = (PageHeader) VARDATA(raw_page);
@@ -154,12 +154,12 @@ page_header(PG_FUNCTION_ARGS)
values[7] = UInt16GetDatum(PageGetPageLayoutVersion(page));
values[8] = TransactionIdGetDatum(page->pd_prune_xid);
- /* Build and return the tuple. */
+ /* Build and return the tuple. */
memset(nulls, 0, sizeof(nulls));
- tuple = heap_form_tuple(tupdesc, values, nulls);
- result = HeapTupleGetDatum(tuple);
+ tuple = heap_form_tuple(tupdesc, values, nulls);
+ result = HeapTupleGetDatum(tuple);
PG_RETURN_DATUM(result);
}
diff --git a/contrib/pg_buffercache/pg_buffercache_pages.c b/contrib/pg_buffercache/pg_buffercache_pages.c
index e7c5b06a56..21ac8da176 100644
--- a/contrib/pg_buffercache/pg_buffercache_pages.c
+++ b/contrib/pg_buffercache/pg_buffercache_pages.c
@@ -3,7 +3,7 @@
* pg_buffercache_pages.c
* display some contents of the buffer cache
*
- * $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.13 2007/07/16 21:20:36 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.14 2007/11/15 21:14:30 momjian Exp $
*-------------------------------------------------------------------------
*/
#include "postgres.h"
@@ -149,9 +149,9 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
/*
* And release locks. We do this in reverse order for two reasons:
* (1) Anyone else who needs more than one of the locks will be trying
- * to lock them in increasing order; we don't want to release the other
- * process until it can get all the locks it needs.
- * (2) This avoids O(N^2) behavior inside LWLockRelease.
+ * to lock them in increasing order; we don't want to release the
+ * other process until it can get all the locks it needs. (2) This
+ * avoids O(N^2) behavior inside LWLockRelease.
*/
for (i = NUM_BUFFER_PARTITIONS; --i >= 0;)
LWLockRelease(FirstBufMappingLock + i);
diff --git a/contrib/pg_standby/pg_standby.c b/contrib/pg_standby/pg_standby.c
index 35c90fde48..41b3500dd1 100644
--- a/contrib/pg_standby/pg_standby.c
+++ b/contrib/pg_standby/pg_standby.c
@@ -1,12 +1,12 @@
/*
* pg_standby.c
- *
+ *
* Production-ready example of how to create a Warm Standby
- * database server using continuous archiving as a
+ * database server using continuous archiving as a
* replication mechanism
*
* We separate the parameters for archive and nextWALfile
- * so that we can check the archive exists, even if the
+ * so that we can check the archive exists, even if the
* WAL file doesn't (yet).
*
* This program will be executed once in full for each file
@@ -14,9 +14,9 @@
*
* It is designed to cater to a variety of needs, as well
* providing a customizable section.
- *
- * Original author: Simon Riggs [email protected]
- * Current maintainer: Simon Riggs
+ *
+ * Original author: Simon Riggs [email protected]
+ * Current maintainer: Simon Riggs
*/
#include "postgres_fe.h"
@@ -26,7 +26,7 @@
#include <signal.h>
#ifdef WIN32
-int getopt(int argc, char * const argv[], const char *optstring);
+int getopt(int argc, char *const argv[], const char *optstring);
#else
#include <sys/time.h>
#include <unistd.h>
@@ -34,42 +34,44 @@ int getopt(int argc, char * const argv[], const char *optstring);
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
-
#endif /* ! WIN32 */
extern char *optarg;
extern int optind;
/* Options and defaults */
-int sleeptime = 5; /* amount of time to sleep between file checks */
-int waittime = -1; /* how long we have been waiting, -1 no wait yet */
-int maxwaittime = 0; /* how long are we prepared to wait for? */
-int keepfiles = 0; /* number of WAL files to keep, 0 keep all */
-int maxretries = 3; /* number of retries on restore command */
-bool debug = false; /* are we debugging? */
-bool triggered = false; /* have we been triggered? */
-bool need_cleanup = false; /* do we need to remove files from archive? */
+int sleeptime = 5; /* amount of time to sleep between file checks */
+int waittime = -1; /* how long we have been waiting, -1 no wait
+ * yet */
+int maxwaittime = 0; /* how long are we prepared to wait for? */
+int keepfiles = 0; /* number of WAL files to keep, 0 keep all */
+int maxretries = 3; /* number of retries on restore command */
+bool debug = false; /* are we debugging? */
+bool triggered = false; /* have we been triggered? */
+bool need_cleanup = false; /* do we need to remove files from
+ * archive? */
static volatile sig_atomic_t signaled = false;
-char *archiveLocation; /* where to find the archive? */
-char *triggerPath; /* where to find the trigger file? */
-char *xlogFilePath; /* where we are going to restore to */
-char *nextWALFileName; /* the file we need to get from archive */
-char *restartWALFileName; /* the file from which we can restart restore */
-char *priorWALFileName; /* the file we need to get from archive */
-char WALFilePath[MAXPGPATH];/* the file path including archive */
-char restoreCommand[MAXPGPATH]; /* run this to restore */
-char exclusiveCleanupFileName[MAXPGPATH]; /* the file we need to get from archive */
+char *archiveLocation; /* where to find the archive? */
+char *triggerPath; /* where to find the trigger file? */
+char *xlogFilePath; /* where we are going to restore to */
+char *nextWALFileName; /* the file we need to get from archive */
+char *restartWALFileName; /* the file from which we can restart restore */
+char *priorWALFileName; /* the file we need to get from archive */
+char WALFilePath[MAXPGPATH]; /* the file path including archive */
+char restoreCommand[MAXPGPATH]; /* run this to restore */
+char exclusiveCleanupFileName[MAXPGPATH]; /* the file we need to
+ * get from archive */
#define RESTORE_COMMAND_COPY 0
#define RESTORE_COMMAND_LINK 1
-int restoreCommandType;
+int restoreCommandType;
#define XLOG_DATA 0
#define XLOG_HISTORY 1
#define XLOG_BACKUP_LABEL 2
-int nextWALFileType;
+int nextWALFileType;
#define SET_RESTORE_COMMAND(cmd, arg1, arg2) \
snprintf(restoreCommand, MAXPGPATH, cmd " \"%s\" \"%s\"", arg1, arg2)
@@ -86,21 +88,21 @@ struct stat stat_buf;
* accessible directory. If you want to make other assumptions,
* such as using a vendor-specific archive and access API, these
* routines are the ones you'll need to change. You're
- * enouraged to submit any changes to [email protected]
- * or personally to the current maintainer. Those changes may be
+ * enouraged to submit any changes to [email protected]
+ * or personally to the current maintainer. Those changes may be
* folded in to later versions of this program.
*/
-#define XLOG_DATA_FNAME_LEN 24
+#define XLOG_DATA_FNAME_LEN 24
/* Reworked from access/xlog_internal.h */
#define XLogFileName(fname, tli, log, seg) \
snprintf(fname, XLOG_DATA_FNAME_LEN + 1, "%08X%08X%08X", tli, log, seg)
/*
- * Initialize allows customized commands into the warm standby program.
+ * Initialize allows customized commands into the warm standby program.
*
- * As an example, and probably the common case, we use either
- * cp/ln commands on *nix, or copy/move command on Windows.
+ * As an example, and probably the common case, we use either
+ * cp/ln commands on *nix, or copy/move command on Windows.
*
*/
static void
@@ -111,79 +113,79 @@ CustomizableInitialize(void)
switch (restoreCommandType)
{
case RESTORE_COMMAND_LINK:
- SET_RESTORE_COMMAND("mklink",WALFilePath, xlogFilePath);
+ SET_RESTORE_COMMAND("mklink", WALFilePath, xlogFilePath);
case RESTORE_COMMAND_COPY:
default:
- SET_RESTORE_COMMAND("copy",WALFilePath, xlogFilePath);
+ SET_RESTORE_COMMAND("copy", WALFilePath, xlogFilePath);
break;
- }
+ }
#else
snprintf(WALFilePath, MAXPGPATH, "%s/%s", archiveLocation, nextWALFileName);
switch (restoreCommandType)
{
case RESTORE_COMMAND_LINK:
#if HAVE_WORKING_LINK
- SET_RESTORE_COMMAND("ln -s -f",WALFilePath, xlogFilePath);
+ SET_RESTORE_COMMAND("ln -s -f", WALFilePath, xlogFilePath);
break;
#endif
case RESTORE_COMMAND_COPY:
default:
- SET_RESTORE_COMMAND("cp",WALFilePath, xlogFilePath);
+ SET_RESTORE_COMMAND("cp", WALFilePath, xlogFilePath);
break;
- }
+ }
#endif
/*
- * This code assumes that archiveLocation is a directory
- * You may wish to add code to check for tape libraries, etc..
- * So, since it is a directory, we use stat to test if its accessible
+ * This code assumes that archiveLocation is a directory You may wish to
+ * add code to check for tape libraries, etc.. So, since it is a
+ * directory, we use stat to test if its accessible
*/
if (stat(archiveLocation, &stat_buf) != 0)
{
- fprintf(stderr, "pg_standby: archiveLocation \"%s\" does not exist\n", archiveLocation);
+ fprintf(stderr, "pg_standby: archiveLocation \"%s\" does not exist\n", archiveLocation);
fflush(stderr);
- exit(2);
+ exit(2);
}
}
/*
* CustomizableNextWALFileReady()
- *
+ *
* Is the requested file ready yet?
*/
-static bool
+static bool
CustomizableNextWALFileReady()
{
if (stat(WALFilePath, &stat_buf) == 0)
{
/*
- * If its a backup file, return immediately
- * If its a regular file return only if its the right size already
+ * If its a backup file, return immediately If its a regular file
+ * return only if its the right size already
*/
if (strlen(nextWALFileName) > 24 &&
strspn(nextWALFileName, "0123456789ABCDEF") == 24 &&
- strcmp(nextWALFileName + strlen(nextWALFileName) - strlen(".backup"),
- ".backup") == 0)
+ strcmp(nextWALFileName + strlen(nextWALFileName) - strlen(".backup"),
+ ".backup") == 0)
{
nextWALFileType = XLOG_BACKUP_LABEL;
- return true;
+ return true;
}
- else
- if (stat_buf.st_size == XLOG_SEG_SIZE)
- {
+ else if (stat_buf.st_size == XLOG_SEG_SIZE)
+ {
#ifdef WIN32
- /*
- * Windows reports that the file has the right number of bytes
- * even though the file is still being copied and cannot be
- * opened by pg_standby yet. So we wait for sleeptime secs
- * before attempting to restore. If that is not enough, we
- * will rely on the retry/holdoff mechanism.
- */
- pg_usleep(sleeptime * 1000000L);
+
+ /*
+ * Windows reports that the file has the right number of bytes
+ * even though the file is still being copied and cannot be opened
+ * by pg_standby yet. So we wait for sleeptime secs before
+ * attempting to restore. If that is not enough, we will rely on
+ * the retry/holdoff mechanism.
+ */
+ pg_usleep(sleeptime * 1000000L);
#endif
- nextWALFileType = XLOG_DATA;
- return true;
- }
+ nextWALFileType = XLOG_DATA;
+ return true;
+ }
/*
* If still too small, wait until it is the correct size
@@ -192,10 +194,10 @@ CustomizableNextWALFileReady()
{
if (debug)
{
- fprintf(stderr, "file size greater than expected\n");
+ fprintf(stderr, "file size greater than expected\n");
fflush(stderr);
}
- exit(3);
+ exit(3);
}
}
@@ -212,35 +214,36 @@ CustomizableCleanupPriorWALFiles(void)
*/
if (nextWALFileType == XLOG_DATA)
{
- int rc;
- DIR *xldir;
- struct dirent *xlde;
+ int rc;
+ DIR *xldir;
+ struct dirent *xlde;
/*
- * Assume its OK to keep failing. The failure situation may change over
- * time, so we'd rather keep going on the main processing than fail
- * because we couldnt clean up yet.
+ * Assume its OK to keep failing. The failure situation may change
+ * over time, so we'd rather keep going on the main processing than
+ * fail because we couldnt clean up yet.
*/
if ((xldir = opendir(archiveLocation)) != NULL)
{
while ((xlde = readdir(xldir)) != NULL)
{
/*
- * We ignore the timeline part of the XLOG segment identifiers in
- * deciding whether a segment is still needed. This ensures that we
- * won't prematurely remove a segment from a parent timeline. We could
- * probably be a little more proactive about removing segments of
- * non-parent timelines, but that would be a whole lot more
- * complicated.
+ * We ignore the timeline part of the XLOG segment identifiers
+ * in deciding whether a segment is still needed. This
+ * ensures that we won't prematurely remove a segment from a
+ * parent timeline. We could probably be a little more
+ * proactive about removing segments of non-parent timelines,
+ * but that would be a whole lot more complicated.
*
- * We use the alphanumeric sorting property of the filenames to decide
- * which ones are earlier than the exclusiveCleanupFileName file.
- * Note that this means files are not removed in the order they were
- * originally written, in case this worries you.
+ * We use the alphanumeric sorting property of the filenames
+ * to decide which ones are earlier than the
+ * exclusiveCleanupFileName file. Note that this means files
+ * are not removed in the order they were originally written,
+ * in case this worries you.
*/
if (strlen(xlde->d_name) == XLOG_DATA_FNAME_LEN &&
strspn(xlde->d_name, "0123456789ABCDEF") == XLOG_DATA_FNAME_LEN &&
- strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
+ strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
{
#ifdef WIN32
snprintf(WALFilePath, MAXPGPATH, "%s\\%s", archiveLocation, xlde->d_name);
@@ -249,7 +252,7 @@ CustomizableCleanupPriorWALFiles(void)
#endif
if (debug)
- fprintf(stderr, "\nremoving \"%s\"", WALFilePath);
+ fprintf(stderr, "\nremoving \"%s\"", WALFilePath);
rc = unlink(WALFilePath);
if (rc != 0)
@@ -264,7 +267,7 @@ CustomizableCleanupPriorWALFiles(void)
fprintf(stderr, "\n");
}
else
- fprintf(stderr, "pg_standby: archiveLocation \"%s\" open error\n", archiveLocation);
+ fprintf(stderr, "pg_standby: archiveLocation \"%s\" open error\n", archiveLocation);
closedir(xldir);
fflush(stderr);
@@ -278,19 +281,19 @@ CustomizableCleanupPriorWALFiles(void)
/*
* SetWALFileNameForCleanup()
- *
+ *
* Set the earliest WAL filename that we want to keep on the archive
- * and decide whether we need_cleanup
+ * and decide whether we need_cleanup
*/
static bool
SetWALFileNameForCleanup(void)
{
- uint32 tli = 1,
- log = 0,
- seg = 0;
- uint32 log_diff = 0,
- seg_diff = 0;
- bool cleanup = false;
+ uint32 tli = 1,
+ log = 0,
+ seg = 0;
+ uint32 log_diff = 0,
+ seg_diff = 0;
+ bool cleanup = false;
if (restartWALFileName)
{
@@ -305,7 +308,7 @@ SetWALFileNameForCleanup(void)
{
log_diff = keepfiles / MaxSegmentsPerLogFile;
seg_diff = keepfiles % MaxSegmentsPerLogFile;
- if (seg_diff > seg)
+ if (seg_diff > seg)
{
log_diff++;
seg = MaxSegmentsPerLogFile - seg_diff;
@@ -333,31 +336,30 @@ SetWALFileNameForCleanup(void)
/*
* CheckForExternalTrigger()
- *
+ *
* Is there a trigger file?
*/
-static bool
+static bool
CheckForExternalTrigger(void)
{
- int rc;
+ int rc;
/*
- * Look for a trigger file, if that option has been selected
+ * Look for a trigger file, if that option has been selected
*
- * We use stat() here because triggerPath is always a file
- * rather than potentially being in an archive
+ * We use stat() here because triggerPath is always a file rather than
+ * potentially being in an archive
*/
if (triggerPath && stat(triggerPath, &stat_buf) == 0)
{
- fprintf(stderr, "trigger file found\n");
+ fprintf(stderr, "trigger file found\n");
fflush(stderr);
/*
- * If trigger file found, we *must* delete it. Here's why:
- * When recovery completes, we will be asked again
- * for the same file from the archive using pg_standby
- * so must remove trigger file so we can reload file again
- * and come up correctly.
+ * If trigger file found, we *must* delete it. Here's why: When
+ * recovery completes, we will be asked again for the same file from
+ * the archive using pg_standby so must remove trigger file so we can
+ * reload file again and come up correctly.
*/
rc = unlink(triggerPath);
if (rc != 0)
@@ -374,14 +376,14 @@ CheckForExternalTrigger(void)
/*
* RestoreWALFileForRecovery()
- *
+ *
* Perform the action required to restore the file from archive
*/
static bool
RestoreWALFileForRecovery(void)
{
- int rc = 0;
- int numretries = 0;
+ int rc = 0;
+ int numretries = 0;
if (debug)
{
@@ -401,7 +403,7 @@ RestoreWALFileForRecovery(void)
}
return true;
}
- pg_usleep(numretries++ * sleeptime * 1000000L);
+ pg_usleep(numretries++ * sleeptime * 1000000L);
}
/*
@@ -441,13 +443,13 @@ sighandler(int sig)
}
/*------------ MAIN ----------------------------------------*/
-int
+int
main(int argc, char **argv)
{
int c;
- (void) signal(SIGINT, sighandler);
- (void) signal(SIGQUIT, sighandler);
+ (void) signal(SIGINT, sighandler);
+ (void) signal(SIGQUIT, sighandler);
while ((c = getopt(argc, argv, "cdk:lr:s:t:w:")) != -1)
{
@@ -492,8 +494,8 @@ main(int argc, char **argv)
case 't': /* Trigger file */
triggerPath = optarg;
if (CheckForExternalTrigger())
- exit(1); /* Normal exit, with non-zero */
- break;
+ exit(1); /* Normal exit, with non-zero */
+ break;
case 'w': /* Max wait time */
maxwaittime = atoi(optarg);
if (maxwaittime < 0)
@@ -510,7 +512,7 @@ main(int argc, char **argv)
}
}
- /*
+ /*
* Parameter checking - after checking to see if trigger file present
*/
if (argc == 1)
@@ -521,8 +523,8 @@ main(int argc, char **argv)
/*
* We will go to the archiveLocation to get nextWALFileName.
- * nextWALFileName may not exist yet, which would not be an error,
- * so we separate the archiveLocation and nextWALFileName so we can check
+ * nextWALFileName may not exist yet, which would not be an error, so we
+ * separate the archiveLocation and nextWALFileName so we can check
* separately whether archiveLocation exists, if not that is an error
*/
if (optind < argc)
@@ -532,7 +534,7 @@ main(int argc, char **argv)
}
else
{
- fprintf(stderr, "pg_standby: must specify archiveLocation\n");
+ fprintf(stderr, "pg_standby: must specify archiveLocation\n");
usage();
exit(2);
}
@@ -544,7 +546,7 @@ main(int argc, char **argv)
}
else
{
- fprintf(stderr, "pg_standby: use %%f to specify nextWALFileName\n");
+ fprintf(stderr, "pg_standby: use %%f to specify nextWALFileName\n");
usage();
exit(2);
}
@@ -556,7 +558,7 @@ main(int argc, char **argv)
}
else
{
- fprintf(stderr, "pg_standby: use %%p to specify xlogFilePath\n");
+ fprintf(stderr, "pg_standby: use %%p to specify xlogFilePath\n");
usage();
exit(2);
}
@@ -573,14 +575,14 @@ main(int argc, char **argv)
if (debug)
{
- fprintf(stderr, "\nTrigger file : %s", triggerPath ? triggerPath : "<not set>");
- fprintf(stderr, "\nWaiting for WAL file : %s", nextWALFileName);
- fprintf(stderr, "\nWAL file path : %s", WALFilePath);
- fprintf(stderr, "\nRestoring to... : %s", xlogFilePath);
- fprintf(stderr, "\nSleep interval : %d second%s",
- sleeptime, (sleeptime > 1 ? "s" : " "));
- fprintf(stderr, "\nMax wait interval : %d %s",
- maxwaittime, (maxwaittime > 0 ? "seconds" : "forever"));
+ fprintf(stderr, "\nTrigger file : %s", triggerPath ? triggerPath : "<not set>");
+ fprintf(stderr, "\nWaiting for WAL file : %s", nextWALFileName);
+ fprintf(stderr, "\nWAL file path : %s", WALFilePath);
+ fprintf(stderr, "\nRestoring to... : %s", xlogFilePath);
+ fprintf(stderr, "\nSleep interval : %d second%s",
+ sleeptime, (sleeptime > 1 ? "s" : " "));
+ fprintf(stderr, "\nMax wait interval : %d %s",
+ maxwaittime, (maxwaittime > 0 ? "seconds" : "forever"));
fprintf(stderr, "\nCommand for restore : %s", restoreCommand);
fprintf(stderr, "\nKeep archive history : %s and later", exclusiveCleanupFileName);
fflush(stderr);
@@ -609,20 +611,20 @@ main(int argc, char **argv)
}
}
- /*
+ /*
* Main wait loop
*/
while (!CustomizableNextWALFileReady() && !triggered)
{
if (sleeptime <= 60)
- pg_usleep(sleeptime * 1000000L);
+ pg_usleep(sleeptime * 1000000L);
if (signaled)
{
triggered = true;
if (debug)
{
- fprintf(stderr, "\nsignaled to exit\n");
+ fprintf(stderr, "\nsignaled to exit\n");
fflush(stderr);
}
}
@@ -631,36 +633,34 @@ main(int argc, char **argv)
if (debug)
{
- fprintf(stderr, "\nWAL file not present yet.");
+ fprintf(stderr, "\nWAL file not present yet.");
if (triggerPath)
- fprintf(stderr, " Checking for trigger file...");
+ fprintf(stderr, " Checking for trigger file...");
fflush(stderr);
}
waittime += sleeptime;
-
+
if (!triggered && (CheckForExternalTrigger() || (waittime >= maxwaittime && maxwaittime > 0)))
{
triggered = true;
if (debug && waittime >= maxwaittime && maxwaittime > 0)
- fprintf(stderr, "\nTimed out after %d seconds\n",waittime);
+ fprintf(stderr, "\nTimed out after %d seconds\n", waittime);
}
}
}
- /*
- * Action on exit
+ /*
+ * Action on exit
*/
if (triggered)
- exit(1); /* Normal exit, with non-zero */
-
- /*
- * Once we have restored this file successfully we
- * can remove some prior WAL files.
- * If this restore fails we musn't remove any
- * file because some of them will be requested again
- * immediately after the failed restore, or when
- * we restart recovery.
+ exit(1); /* Normal exit, with non-zero */
+
+ /*
+ * Once we have restored this file successfully we can remove some prior
+ * WAL files. If this restore fails we musn't remove any file because some
+ * of them will be requested again immediately after the failed restore,
+ * or when we restart recovery.
*/
if (RestoreWALFileForRecovery() && need_cleanup)
CustomizableCleanupPriorWALFiles();
diff --git a/contrib/pg_trgm/trgm_gin.c b/contrib/pg_trgm/trgm_gin.c
index ed2ba0eae7..33d005ae9a 100644
--- a/contrib/pg_trgm/trgm_gin.c
+++ b/contrib/pg_trgm/trgm_gin.c
@@ -16,23 +16,23 @@ Datum gin_trgm_consistent(PG_FUNCTION_ARGS);
Datum
gin_extract_trgm(PG_FUNCTION_ARGS)
{
- text *val = (text *) PG_GETARG_TEXT_P(0);
- int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
- Datum *entries = NULL;
- TRGM *trg;
+ text *val = (text *) PG_GETARG_TEXT_P(0);
+ int32 *nentries = (int32 *) PG_GETARG_POINTER(1);
+ Datum *entries = NULL;
+ TRGM *trg;
int4 trglen;
-
+
*nentries = 0;
-
+
trg = generate_trgm(VARDATA(val), VARSIZE(val) - VARHDRSZ);
trglen = ARRNELEM(trg);
-
+
if (trglen > 0)
{
- trgm *ptr;
- int4 i = 0,
- item;
-
+ trgm *ptr;
+ int4 i = 0,
+ item;
+
*nentries = (int32) trglen;
entries = (Datum *) palloc(sizeof(Datum) * trglen);
@@ -41,7 +41,7 @@ gin_extract_trgm(PG_FUNCTION_ARGS)
{
item = TRGMINT(ptr);
entries[i++] = Int32GetDatum(item);
-
+
ptr++;
}
}
@@ -52,20 +52,20 @@ gin_extract_trgm(PG_FUNCTION_ARGS)
Datum
gin_trgm_consistent(PG_FUNCTION_ARGS)
{
- bool *check = (bool *) PG_GETARG_POINTER(0);
- text *query = (text *) PG_GETARG_TEXT_P(2);
+ bool *check = (bool *) PG_GETARG_POINTER(0);
+ text *query = (text *) PG_GETARG_TEXT_P(2);
bool res = FALSE;
- TRGM *trg;
+ TRGM *trg;
int4 i,
trglen,
ntrue = 0;
-
+
trg = generate_trgm(VARDATA(query), VARSIZE(query) - VARHDRSZ);
trglen = ARRNELEM(trg);
-
+
for (i = 0; i < trglen; i++)
if (check[i])
- ntrue ++;
+ ntrue++;
#ifdef DIVUNION
res = (trglen == ntrue) ? true : ((((((float4) ntrue) / ((float4) (trglen - ntrue)))) >= trgm_limit) ? true : false);
diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c
index a5e57ce955..5fe48b96a3 100644
--- a/contrib/pgbench/pgbench.c
+++ b/contrib/pgbench/pgbench.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.73 2007/10/22 10:40:47 mha Exp $
+ * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.74 2007/11/15 21:14:31 momjian Exp $
*
* pgbench: a simple benchmark program for PostgreSQL
* written by Tatsuo Ishii
@@ -53,9 +53,9 @@ extern int optind;
/* max number of clients allowed */
#ifdef FD_SETSIZE
-#define MAXCLIENTS (FD_SETSIZE - 10)
+#define MAXCLIENTS (FD_SETSIZE - 10)
#else
-#define MAXCLIENTS 1024
+#define MAXCLIENTS 1024
#endif
int nclients = 1; /* default number of simulated clients */
@@ -201,7 +201,7 @@ getrand(int min, int max)
/* call PQexec() and exit() on failure */
static void
-executeStatement(PGconn *con, const char* sql)
+executeStatement(PGconn *con, const char *sql)
{
PGresult *res;
@@ -262,7 +262,7 @@ discard_response(CState * state)
/* check to see if the SQL result was good */
static int
-check(CState *state, PGresult *res, int n)
+check(CState * state, PGresult *res, int n)
{
CState *st = &state[n];
@@ -275,7 +275,7 @@ check(CState *state, PGresult *res, int n)
default:
fprintf(stderr, "Client %d aborted in state %d: %s",
n, st->state, PQerrorMessage(st->con));
- remains--; /* I've aborted */
+ remains--; /* I've aborted */
PQfinish(st->con);
st->con = NULL;
return (-1);
@@ -452,12 +452,12 @@ top:
if (st->sleeping)
{ /* are we sleeping? */
- int usec;
- struct timeval now;
+ int usec;
+ struct timeval now;
gettimeofday(&now, NULL);
usec = (st->until.tv_sec - now.tv_sec) * 1000000 +
- st->until.tv_usec - now.tv_usec;
+ st->until.tv_usec - now.tv_usec;
if (usec <= 0)
st->sleeping = 0; /* Done sleeping, go ahead with next command */
else
@@ -798,11 +798,11 @@ init(void)
"drop table if exists accounts",
"create table accounts(aid int not null,bid int,abalance int,filler char(84)) with (fillfactor=%d)",
"drop table if exists history",
- "create table history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22))"};
+ "create table history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22))"};
static char *DDLAFTERs[] = {
"alter table branches add primary key (bid)",
"alter table tellers add primary key (tid)",
- "alter table accounts add primary key (aid)"};
+ "alter table accounts add primary key (aid)"};
char sql[256];
@@ -821,7 +821,8 @@ init(void)
(strstr(DDLs[i], "create table tellers") == DDLs[i]) ||
(strstr(DDLs[i], "create table accounts") == DDLs[i]))
{
- char ddl_stmt[128];
+ char ddl_stmt[128];
+
snprintf(ddl_stmt, 128, DDLs[i], fillfactor);
executeStatement(con, ddl_stmt);
continue;
@@ -990,7 +991,7 @@ process_commands(char *buf)
pg_strcasecmp(my_commands->argv[2], "ms") != 0 &&
pg_strcasecmp(my_commands->argv[2], "s"))
{
- fprintf(stderr, "%s: unknown time unit '%s' - must be us, ms or s\n",
+ fprintf(stderr, "%s: unknown time unit '%s' - must be us, ms or s\n",
my_commands->argv[0], my_commands->argv[2]);
return NULL;
}
@@ -1204,7 +1205,7 @@ main(int argc, char **argv)
int c;
int is_init_mode = 0; /* initialize mode? */
int is_no_vacuum = 0; /* no vacuum at all before testing? */
- int do_vacuum_accounts = 0; /* do vacuum accounts before testing? */
+ int do_vacuum_accounts = 0; /* do vacuum accounts before testing? */
int debug = 0; /* debug flag */
int ttype = 0; /* transaction type. 0: TPC-B, 1: SELECT only,
* 2: skip update of branches and tellers */
@@ -1308,7 +1309,7 @@ main(int argc, char **argv)
fprintf(stderr, "Use limit/ulimit to increase the limit before using pgbench.\n");
exit(1);
}
-#endif /* HAVE_GETRLIMIT */
+#endif /* HAVE_GETRLIMIT */
break;
case 'C':
is_connect = 1;
@@ -1615,8 +1616,8 @@ main(int argc, char **argv)
if (state[i].sleeping)
{
- int this_usec;
- int sock = PQsocket(state[i].con);
+ int this_usec;
+ int sock = PQsocket(state[i].con);
if (min_usec < 0)
{
@@ -1625,7 +1626,7 @@ main(int argc, char **argv)
}
this_usec = (state[i].until.tv_sec - now.tv_sec) * 1000000 +
- state[i].until.tv_usec - now.tv_usec;
+ state[i].until.tv_usec - now.tv_usec;
if (this_usec > 0 && (min_usec == 0 || this_usec < min_usec))
min_usec = this_usec;
@@ -1657,11 +1658,11 @@ main(int argc, char **argv)
timeout.tv_usec = min_usec % 1000000;
nsocks = select(maxsock + 1, &input_mask, (fd_set *) NULL,
- (fd_set *) NULL, &timeout);
+ (fd_set *) NULL, &timeout);
}
else
nsocks = select(maxsock + 1, &input_mask, (fd_set *) NULL,
- (fd_set *) NULL, (struct timeval *) NULL);
+ (fd_set *) NULL, (struct timeval *) NULL);
if (nsocks < 0)
{
if (errno == EINTR)
diff --git a/contrib/pgcrypto/blf.c b/contrib/pgcrypto/blf.c
index 93a6183fca..7138ffa903 100644
--- a/contrib/pgcrypto/blf.c
+++ b/contrib/pgcrypto/blf.c
@@ -1,7 +1,7 @@
/*
* Butchered version of sshblowf.c from putty-0.59.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.8 2007/03/28 22:48:58 neilc Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.9 2007/11/15 21:14:31 momjian Exp $
*/
/*
@@ -251,7 +251,7 @@ static const uint32 sbox3[] = {
static void
blowfish_encrypt(uint32 xL, uint32 xR, uint32 *output,
- BlowfishContext *ctx)
+ BlowfishContext * ctx)
{
uint32 *S0 = ctx->S0;
uint32 *S1 = ctx->S1;
@@ -285,7 +285,7 @@ blowfish_encrypt(uint32 xL, uint32 xR, uint32 *output,
static void
blowfish_decrypt(uint32 xL, uint32 xR, uint32 *output,
- BlowfishContext *ctx)
+ BlowfishContext * ctx)
{
uint32 *S0 = ctx->S0;
uint32 *S1 = ctx->S1;
@@ -318,7 +318,7 @@ blowfish_decrypt(uint32 xL, uint32 xR, uint32 *output,
}
void
-blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
+blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx)
{
uint32 xL,
xR,
@@ -351,7 +351,7 @@ blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
}
void
-blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
+blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx)
{
uint32 xL,
xR,
@@ -384,7 +384,7 @@ blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
}
void
-blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
+blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx)
{
uint32 xL,
xR,
@@ -405,7 +405,7 @@ blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
}
void
-blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
+blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx)
{
uint32 xL,
xR,
@@ -426,7 +426,7 @@ blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
}
void
-blowfish_setkey(BlowfishContext *ctx,
+blowfish_setkey(BlowfishContext * ctx,
const uint8 *key, short keybytes)
{
uint32 *S0 = ctx->S0;
@@ -437,7 +437,7 @@ blowfish_setkey(BlowfishContext *ctx,
uint32 str[2];
int i;
- Assert(keybytes > 0 && keybytes <= (448/8));
+ Assert(keybytes > 0 && keybytes <= (448 / 8));
for (i = 0; i < 18; i++)
{
@@ -492,9 +492,8 @@ blowfish_setkey(BlowfishContext *ctx,
}
void
-blowfish_setiv(BlowfishContext *ctx, const uint8 *iv)
+blowfish_setiv(BlowfishContext * ctx, const uint8 *iv)
{
ctx->iv0 = GET_32BIT_MSB_FIRST(iv);
ctx->iv1 = GET_32BIT_MSB_FIRST(iv + 4);
}
-
diff --git a/contrib/pgcrypto/blf.h b/contrib/pgcrypto/blf.h
index 7e11dc9aeb..6e280d8754 100644
--- a/contrib/pgcrypto/blf.h
+++ b/contrib/pgcrypto/blf.h
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.6 2007/03/28 22:48:58 neilc Exp $ */
+/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.7 2007/11/15 21:14:31 momjian Exp $ */
/*
* PuTTY is copyright 1997-2007 Simon Tatham.
*
@@ -35,14 +35,12 @@ typedef struct
S3[256],
P[18];
uint32 iv0,
- iv1; /* for CBC mode */
-} BlowfishContext;
-
-void blowfish_setkey(BlowfishContext *ctx, const uint8 *key, short keybytes);
-void blowfish_setiv(BlowfishContext *ctx, const uint8 *iv);
-void blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx);
-void blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx);
-void blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx);
-void blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx);
-
+ iv1; /* for CBC mode */
+} BlowfishContext;
+void blowfish_setkey(BlowfishContext * ctx, const uint8 *key, short keybytes);
+void blowfish_setiv(BlowfishContext * ctx, const uint8 *iv);
+void blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx);
+void blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx);
+void blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx);
+void blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx);
diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c
index f951f2c411..84b4d758af 100644
--- a/contrib/pgcrypto/crypt-blowfish.c
+++ b/contrib/pgcrypto/crypt-blowfish.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.12 2007/04/06 05:36:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.13 2007/11/15 21:14:31 momjian Exp $
*
* This code comes from John the Ripper password cracker, with reentrant
* and crypt(3) interfaces added, but optimizations specific to password
@@ -436,7 +436,7 @@ BF_encode(char *dst, const BF_word * src, int size)
}
static void
-BF_swap(BF_word *x, int count)
+BF_swap(BF_word * x, int count)
{
/* Swap on little-endian hardware, else do nothing */
#ifndef WORDS_BIGENDIAN
diff --git a/contrib/pgcrypto/imath.h b/contrib/pgcrypto/imath.h
index f730b32050..5bc335e582 100644
--- a/contrib/pgcrypto/imath.h
+++ b/contrib/pgcrypto/imath.h
@@ -26,7 +26,7 @@
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
-/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.h,v 1.5 2006/10/04 00:29:46 momjian Exp $ */
+/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.h,v 1.6 2007/11/15 21:14:31 momjian Exp $ */
#ifndef IMATH_H_
#define IMATH_H_
@@ -115,11 +115,12 @@ mp_result mp_int_mul(mp_int a, mp_int b, mp_int c); /* c = a * b */
mp_result mp_int_mul_value(mp_int a, int value, mp_int c);
mp_result mp_int_mul_pow2(mp_int a, int p2, mp_int c);
mp_result mp_int_sqr(mp_int a, mp_int c); /* c = a * a */
+
mp_result
-mp_int_div(mp_int a, mp_int b, /* q = a / b */
+mp_int_div(mp_int a, mp_int b, /* q = a / b */
mp_int q, mp_int r); /* r = a % b */
mp_result
-mp_int_div_value(mp_int a, int value, /* q = a / value */
+mp_int_div_value(mp_int a, int value, /* q = a / value */
mp_int q, int *r); /* r = a % value */
mp_result
mp_int_div_pow2(mp_int a, int p2, /* q = a / 2^p2 */
diff --git a/contrib/pgcrypto/internal.c b/contrib/pgcrypto/internal.c
index 24db7c0cc8..594308673b 100644
--- a/contrib/pgcrypto/internal.c
+++ b/contrib/pgcrypto/internal.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.26 2007/03/28 22:48:58 neilc Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.27 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@@ -251,7 +251,7 @@ struct int_ctx
uint8 iv[INT_MAX_IV];
union
{
- BlowfishContext bf;
+ BlowfishContext bf;
rijndael_ctx rj;
} ctx;
unsigned keylen;
@@ -426,7 +426,7 @@ bf_block_size(PX_Cipher * c)
static unsigned
bf_key_size(PX_Cipher * c)
{
- return 448/8;
+ return 448 / 8;
}
static unsigned
diff --git a/contrib/pgcrypto/openssl.c b/contrib/pgcrypto/openssl.c
index 10df87f2bf..0f46580005 100644
--- a/contrib/pgcrypto/openssl.c
+++ b/contrib/pgcrypto/openssl.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.31 2007/09/29 02:18:15 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.32 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@@ -98,10 +98,13 @@ static void
AES_cbc_encrypt(const uint8 *src, uint8 *dst, int len, AES_KEY *ctx, uint8 *iv, int enc)
{
memcpy(dst, src, len);
- if (enc) {
+ if (enc)
+ {
aes_cbc_encrypt(ctx, iv, dst, len);
memcpy(iv, dst + len - 16, 16);
- } else {
+ }
+ else
+ {
aes_cbc_decrypt(ctx, iv, dst, len);
memcpy(iv, src + len - 16, 16);
}
@@ -394,26 +397,27 @@ static int
bf_check_supported_key_len(void)
{
static const uint8 key[56] = {
- 0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87,0x78,0x69,
- 0x5a,0x4b,0x3c,0x2d,0x1e,0x0f,0x00,0x11,0x22,0x33,
- 0x44,0x55,0x66,0x77,0x04,0x68,0x91,0x04,0xc2,0xfd,
- 0x3b,0x2f,0x58,0x40,0x23,0x64,0x1a,0xba,0x61,0x76,
- 0x1f,0x1f,0x1f,0x1f,0x0e,0x0e,0x0e,0x0e,0xff,0xff,
- 0xff,0xff,0xff,0xff,0xff,0xff
+ 0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, 0x78, 0x69,
+ 0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, 0x00, 0x11, 0x22, 0x33,
+ 0x44, 0x55, 0x66, 0x77, 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd,
+ 0x3b, 0x2f, 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
+ 0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
- static const uint8 data[8] = {0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
- static const uint8 res[8] = {0xc0,0x45,0x04,0x01,0x2e,0x4e,0x1f,0x53};
+ static const uint8 data[8] = {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
+ static const uint8 res[8] = {0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53};
static uint8 out[8];
- BF_KEY bf_key;
+ BF_KEY bf_key;
/* encrypt with 448bits key and verify output */
BF_set_key(&bf_key, 56, key);
BF_ecb_encrypt(data, out, &bf_key, BF_ENCRYPT);
- if (memcmp(out, res, 8) != 0)
- return 0; /* Output does not match -> strong cipher is not supported */
+ if (memcmp(out, res, 8) != 0)
+ return 0; /* Output does not match -> strong cipher is
+ * not supported */
return 1;
}
@@ -421,18 +425,19 @@ static int
bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
{
ossldata *od = c->ptr;
- static int bf_is_strong = -1;
+ static int bf_is_strong = -1;
/*
- * Test if key len is supported. BF_set_key silently cut large keys and it could be
- * be a problem when user transfer crypted data from one server to another.
+ * Test if key len is supported. BF_set_key silently cut large keys and it
+ * could be be a problem when user transfer crypted data from one server
+ * to another.
*/
-
- if( bf_is_strong == -1)
+
+ if (bf_is_strong == -1)
bf_is_strong = bf_check_supported_key_len();
- if( !bf_is_strong && klen>16 )
- return PXE_KEY_TOO_BIG;
+ if (!bf_is_strong && klen > 16)
+ return PXE_KEY_TOO_BIG;
/* Key len is supported. We can use it. */
BF_set_key(&od->u.bf.key, klen, key);
@@ -750,13 +755,14 @@ ossl_aes_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
static int
ossl_aes_key_init(ossldata * od, int type)
{
- int err;
+ int err;
+
/*
- * Strong key support could be missing on some openssl installations.
- * We must check return value from set key function.
- */
+ * Strong key support could be missing on some openssl installations. We
+ * must check return value from set key function.
+ */
if (type == AES_ENCRYPT)
- err = AES_set_encrypt_key(od->key, od->klen * 8, &od->u.aes_key);
+ err = AES_set_encrypt_key(od->key, od->klen * 8, &od->u.aes_key);
else
err = AES_set_decrypt_key(od->key, od->klen * 8, &od->u.aes_key);
@@ -776,7 +782,7 @@ ossl_aes_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
unsigned bs = gen_ossl_block_size(c);
ossldata *od = c->ptr;
const uint8 *end = data + dlen - bs;
- int err;
+ int err;
if (!od->init)
if ((err = ossl_aes_key_init(od, AES_ENCRYPT)) != 0)
@@ -794,7 +800,7 @@ ossl_aes_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
unsigned bs = gen_ossl_block_size(c);
ossldata *od = c->ptr;
const uint8 *end = data + dlen - bs;
- int err;
+ int err;
if (!od->init)
if ((err = ossl_aes_key_init(od, AES_DECRYPT)) != 0)
@@ -810,12 +816,12 @@ ossl_aes_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
- int err;
+ int err;
if (!od->init)
if ((err = ossl_aes_key_init(od, AES_ENCRYPT)) != 0)
return err;
-
+
AES_cbc_encrypt(data, res, dlen, &od->u.aes_key, od->iv, AES_ENCRYPT);
return 0;
}
@@ -825,7 +831,7 @@ ossl_aes_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
uint8 *res)
{
ossldata *od = c->ptr;
- int err;
+ int err;
if (!od->init)
if ((err = ossl_aes_key_init(od, AES_DECRYPT)) != 0)
diff --git a/contrib/pgcrypto/pgp-compress.c b/contrib/pgcrypto/pgp-compress.c
index 2942edf2ad..9d2f61ed8e 100644
--- a/contrib/pgcrypto/pgp-compress.c
+++ b/contrib/pgcrypto/pgp-compress.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-compress.c,v 1.6 2007/01/14 20:55:14 alvherre Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-compress.c,v 1.7 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@@ -312,7 +312,6 @@ pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src)
{
return pullf_create(res, &decompress_filter, ctx, src);
}
-
#else /* !HAVE_ZLIB */
int
diff --git a/contrib/pgcrypto/px.c b/contrib/pgcrypto/px.c
index 81222873b6..d1b22d7ec7 100644
--- a/contrib/pgcrypto/px.c
+++ b/contrib/pgcrypto/px.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.16 2007/08/23 16:15:51 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.17 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@@ -286,7 +286,7 @@ combo_decrypt(PX_Combo * cx, const uint8 *data, unsigned dlen,
/* with padding, empty ciphertext is not allowed */
if (cx->padding)
return PXE_DECRYPT_FAILED;
-
+
/* without padding, report empty result */
*rlen = 0;
return 0;
diff --git a/contrib/pgcrypto/sha2.c b/contrib/pgcrypto/sha2.c
index e25f35acde..c2e9da965b 100644
--- a/contrib/pgcrypto/sha2.c
+++ b/contrib/pgcrypto/sha2.c
@@ -33,7 +33,7 @@
*
* $From: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
*
- * $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.9 2007/04/06 05:36:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.10 2007/11/15 21:14:31 momjian Exp $
*/
#include "postgres.h"
@@ -78,7 +78,7 @@
(x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \
((tmp & 0x0000ffff0000ffffULL) << 16); \
}
-#endif /* not bigendian */
+#endif /* not bigendian */
/*
* Macro for incrementally adding the unsigned 64-bit integer n to the
diff --git a/contrib/pgstattuple/pgstatindex.c b/contrib/pgstattuple/pgstatindex.c
index 3018b6aedd..3cd3147895 100644
--- a/contrib/pgstattuple/pgstatindex.c
+++ b/contrib/pgstattuple/pgstatindex.c
@@ -159,16 +159,17 @@ pgstatindex(PG_FUNCTION_ARGS)
else if (P_ISLEAF(opaque))
{
- int max_avail;
- max_avail = BLCKSZ - (BLCKSZ - ((PageHeader)page)->pd_special + SizeOfPageHeaderData);
+ int max_avail;
+
+ max_avail = BLCKSZ - (BLCKSZ - ((PageHeader) page)->pd_special + SizeOfPageHeaderData);
indexStat.max_avail += max_avail;
indexStat.free_space += PageGetFreeSpace(page);
indexStat.leaf_pages++;
/*
- * If the next leaf is on an earlier block, it
- * means a fragmentation.
+ * If the next leaf is on an earlier block, it means a
+ * fragmentation.
*/
if (opaque->btpo_next != P_NONE && opaque->btpo_next < blkno)
indexStat.fragments++;
diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c
index 22dc2f2e0e..fd7cafea4b 100644
--- a/contrib/tablefunc/tablefunc.c
+++ b/contrib/tablefunc/tablefunc.c
@@ -552,8 +552,8 @@ crosstab(PG_FUNCTION_ARGS)
xpstrdup(values[0], rowid);
/*
- * Check to see if the rowid is the same as that of the last
- * tuple sent -- if so, skip this tuple entirely
+ * Check to see if the rowid is the same as that of the
+ * last tuple sent -- if so, skip this tuple entirely
*/
if (!firstpass && xstreq(lastrowid, rowid))
{
@@ -563,8 +563,8 @@ crosstab(PG_FUNCTION_ARGS)
}
/*
- * If rowid hasn't changed on us, continue building the
- * ouput tuple.
+ * If rowid hasn't changed on us, continue building the ouput
+ * tuple.
*/
if (xstreq(rowid, values[0]))
{
diff --git a/contrib/test_parser/test_parser.c b/contrib/test_parser/test_parser.c
index 728bf4098f..784d2d43ad 100644
--- a/contrib/test_parser/test_parser.c
+++ b/contrib/test_parser/test_parser.c
@@ -6,7 +6,7 @@
* Copyright (c) 2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/test_parser/test_parser.c,v 1.1 2007/10/15 21:36:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/test_parser/test_parser.c,v 1.2 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,40 +22,44 @@ PG_MODULE_MAGIC;
*/
/* self-defined type */
-typedef struct {
- char * buffer; /* text to parse */
- int len; /* length of the text in buffer */
- int pos; /* position of the parser */
-} ParserState;
+typedef struct
+{
+ char *buffer; /* text to parse */
+ int len; /* length of the text in buffer */
+ int pos; /* position of the parser */
+} ParserState;
/* copy-paste from wparser.h of tsearch2 */
-typedef struct {
- int lexid;
- char *alias;
- char *descr;
-} LexDescr;
+typedef struct
+{
+ int lexid;
+ char *alias;
+ char *descr;
+} LexDescr;
/*
* prototypes
*/
PG_FUNCTION_INFO_V1(testprs_start);
-Datum testprs_start(PG_FUNCTION_ARGS);
+Datum testprs_start(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(testprs_getlexeme);
-Datum testprs_getlexeme(PG_FUNCTION_ARGS);
+Datum testprs_getlexeme(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(testprs_end);
-Datum testprs_end(PG_FUNCTION_ARGS);
+Datum testprs_end(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(testprs_lextype);
-Datum testprs_lextype(PG_FUNCTION_ARGS);
+Datum testprs_lextype(PG_FUNCTION_ARGS);
/*
* functions
*/
-Datum testprs_start(PG_FUNCTION_ARGS)
+Datum
+testprs_start(PG_FUNCTION_ARGS)
{
ParserState *pst = (ParserState *) palloc0(sizeof(ParserState));
+
pst->buffer = (char *) PG_GETARG_POINTER(0);
pst->len = PG_GETARG_INT32(1);
pst->pos = 0;
@@ -63,15 +67,16 @@ Datum testprs_start(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(pst);
}
-Datum testprs_getlexeme(PG_FUNCTION_ARGS)
+Datum
+testprs_getlexeme(PG_FUNCTION_ARGS)
{
- ParserState *pst = (ParserState *) PG_GETARG_POINTER(0);
- char **t = (char **) PG_GETARG_POINTER(1);
- int *tlen = (int *) PG_GETARG_POINTER(2);
+ ParserState *pst = (ParserState *) PG_GETARG_POINTER(0);
+ char **t = (char **) PG_GETARG_POINTER(1);
+ int *tlen = (int *) PG_GETARG_POINTER(2);
int type;
*tlen = pst->pos;
- *t = pst->buffer + pst->pos;
+ *t = pst->buffer + pst->pos;
if ((pst->buffer)[pst->pos] == ' ')
{
@@ -81,7 +86,9 @@ Datum testprs_getlexeme(PG_FUNCTION_ARGS)
while ((pst->buffer)[pst->pos] == ' ' &&
pst->pos < pst->len)
(pst->pos)++;
- } else {
+ }
+ else
+ {
/* word type */
type = 3;
/* go to the next white-space character */
@@ -94,28 +101,29 @@ Datum testprs_getlexeme(PG_FUNCTION_ARGS)
/* we are finished if (*tlen == 0) */
if (*tlen == 0)
- type=0;
+ type = 0;
PG_RETURN_INT32(type);
}
-Datum testprs_end(PG_FUNCTION_ARGS)
+Datum
+testprs_end(PG_FUNCTION_ARGS)
{
ParserState *pst = (ParserState *) PG_GETARG_POINTER(0);
+
pfree(pst);
PG_RETURN_VOID();
}
-Datum testprs_lextype(PG_FUNCTION_ARGS)
+Datum
+testprs_lextype(PG_FUNCTION_ARGS)
{
/*
- * Remarks:
- * - we have to return the blanks for headline reason
- * - we use the same lexids like Teodor in the default
- * word parser; in this way we can reuse the headline
- * function of the default word parser.
+ * Remarks: - we have to return the blanks for headline reason - we use
+ * the same lexids like Teodor in the default word parser; in this way we
+ * can reuse the headline function of the default word parser.
*/
- LexDescr *descr = (LexDescr *) palloc(sizeof(LexDescr) * (2+1));
+ LexDescr *descr = (LexDescr *) palloc(sizeof(LexDescr) * (2 + 1));
/* there are only two types in this parser */
descr[0].lexid = 3;
diff --git a/contrib/tsearch2/tsearch2.c b/contrib/tsearch2/tsearch2.c
index 25fb697529..e0f0f651b8 100644
--- a/contrib/tsearch2/tsearch2.c
+++ b/contrib/tsearch2/tsearch2.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.2 2007/11/13 22:14:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.3 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,8 +24,8 @@
PG_MODULE_MAGIC;
-static Oid current_dictionary_oid = InvalidOid;
-static Oid current_parser_oid = InvalidOid;
+static Oid current_dictionary_oid = InvalidOid;
+static Oid current_parser_oid = InvalidOid;
/* insert given value at argument position 0 */
#define INSERT_ARGUMENT0(argument, isnull) \
@@ -65,27 +65,27 @@ static Oid current_parser_oid = InvalidOid;
} \
PG_FUNCTION_INFO_V1(name)
-static Oid GetCurrentDict(void);
-static Oid GetCurrentParser(void);
-
-Datum tsa_lexize_byname(PG_FUNCTION_ARGS);
-Datum tsa_lexize_bycurrent(PG_FUNCTION_ARGS);
-Datum tsa_set_curdict(PG_FUNCTION_ARGS);
-Datum tsa_set_curdict_byname(PG_FUNCTION_ARGS);
-Datum tsa_token_type_current(PG_FUNCTION_ARGS);
-Datum tsa_set_curprs(PG_FUNCTION_ARGS);
-Datum tsa_set_curprs_byname(PG_FUNCTION_ARGS);
-Datum tsa_parse_current(PG_FUNCTION_ARGS);
-Datum tsa_set_curcfg(PG_FUNCTION_ARGS);
-Datum tsa_set_curcfg_byname(PG_FUNCTION_ARGS);
-Datum tsa_to_tsvector_name(PG_FUNCTION_ARGS);
-Datum tsa_to_tsquery_name(PG_FUNCTION_ARGS);
-Datum tsa_plainto_tsquery_name(PG_FUNCTION_ARGS);
-Datum tsa_headline_byname(PG_FUNCTION_ARGS);
-Datum tsa_ts_stat(PG_FUNCTION_ARGS);
-Datum tsa_tsearch2(PG_FUNCTION_ARGS);
-Datum tsa_rewrite_accum(PG_FUNCTION_ARGS);
-Datum tsa_rewrite_finish(PG_FUNCTION_ARGS);
+static Oid GetCurrentDict(void);
+static Oid GetCurrentParser(void);
+
+Datum tsa_lexize_byname(PG_FUNCTION_ARGS);
+Datum tsa_lexize_bycurrent(PG_FUNCTION_ARGS);
+Datum tsa_set_curdict(PG_FUNCTION_ARGS);
+Datum tsa_set_curdict_byname(PG_FUNCTION_ARGS);
+Datum tsa_token_type_current(PG_FUNCTION_ARGS);
+Datum tsa_set_curprs(PG_FUNCTION_ARGS);
+Datum tsa_set_curprs_byname(PG_FUNCTION_ARGS);
+Datum tsa_parse_current(PG_FUNCTION_ARGS);
+Datum tsa_set_curcfg(PG_FUNCTION_ARGS);
+Datum tsa_set_curcfg_byname(PG_FUNCTION_ARGS);
+Datum tsa_to_tsvector_name(PG_FUNCTION_ARGS);
+Datum tsa_to_tsquery_name(PG_FUNCTION_ARGS);
+Datum tsa_plainto_tsquery_name(PG_FUNCTION_ARGS);
+Datum tsa_headline_byname(PG_FUNCTION_ARGS);
+Datum tsa_ts_stat(PG_FUNCTION_ARGS);
+Datum tsa_tsearch2(PG_FUNCTION_ARGS);
+Datum tsa_rewrite_accum(PG_FUNCTION_ARGS);
+Datum tsa_rewrite_finish(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(tsa_lexize_byname);
PG_FUNCTION_INFO_V1(tsa_lexize_bycurrent);
@@ -150,11 +150,11 @@ UNSUPPORTED_FUNCTION(tsa_get_covers);
Datum
tsa_lexize_byname(PG_FUNCTION_ARGS)
{
- text *dictname = PG_GETARG_TEXT_P(0);
- Datum arg1 = PG_GETARG_DATUM(1);
+ text *dictname = PG_GETARG_TEXT_P(0);
+ Datum arg1 = PG_GETARG_DATUM(1);
return DirectFunctionCall2(ts_lexize,
- ObjectIdGetDatum(TextGetObjectId(regdictionaryin, dictname)),
+ ObjectIdGetDatum(TextGetObjectId(regdictionaryin, dictname)),
arg1);
}
@@ -162,8 +162,8 @@ tsa_lexize_byname(PG_FUNCTION_ARGS)
Datum
tsa_lexize_bycurrent(PG_FUNCTION_ARGS)
{
- Datum arg0 = PG_GETARG_DATUM(0);
- Oid id = GetCurrentDict();
+ Datum arg0 = PG_GETARG_DATUM(0);
+ Oid id = GetCurrentDict();
return DirectFunctionCall2(ts_lexize,
ObjectIdGetDatum(id),
@@ -174,7 +174,7 @@ tsa_lexize_bycurrent(PG_FUNCTION_ARGS)
Datum
tsa_set_curdict(PG_FUNCTION_ARGS)
{
- Oid dict_oid = PG_GETARG_OID(0);
+ Oid dict_oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(TSDICTOID,
ObjectIdGetDatum(dict_oid),
@@ -191,8 +191,8 @@ tsa_set_curdict(PG_FUNCTION_ARGS)
Datum
tsa_set_curdict_byname(PG_FUNCTION_ARGS)
{
- text *name = PG_GETARG_TEXT_P(0);
- Oid dict_oid;
+ text *name = PG_GETARG_TEXT_P(0);
+ Oid dict_oid;
dict_oid = TSDictionaryGetDictid(stringToQualifiedNameList(TextPGetCString(name)), false);
@@ -213,7 +213,7 @@ tsa_token_type_current(PG_FUNCTION_ARGS)
Datum
tsa_set_curprs(PG_FUNCTION_ARGS)
{
- Oid parser_oid = PG_GETARG_OID(0);
+ Oid parser_oid = PG_GETARG_OID(0);
if (!SearchSysCacheExists(TSPARSEROID,
ObjectIdGetDatum(parser_oid),
@@ -230,8 +230,8 @@ tsa_set_curprs(PG_FUNCTION_ARGS)
Datum
tsa_set_curprs_byname(PG_FUNCTION_ARGS)
{
- text *name = PG_GETARG_TEXT_P(0);
- Oid parser_oid;
+ text *name = PG_GETARG_TEXT_P(0);
+ Oid parser_oid;
parser_oid = TSParserGetPrsid(stringToQualifiedNameList(TextPGetCString(name)), false);
@@ -252,12 +252,12 @@ tsa_parse_current(PG_FUNCTION_ARGS)
Datum
tsa_set_curcfg(PG_FUNCTION_ARGS)
{
- Oid arg0 = PG_GETARG_OID(0);
- char *name;
+ Oid arg0 = PG_GETARG_OID(0);
+ char *name;
name = DatumGetCString(DirectFunctionCall1(regconfigout,
ObjectIdGetDatum(arg0)));
-
+
set_config_option("default_text_search_config", name,
PGC_USERSET,
PGC_S_SESSION,
@@ -271,8 +271,8 @@ tsa_set_curcfg(PG_FUNCTION_ARGS)
Datum
tsa_set_curcfg_byname(PG_FUNCTION_ARGS)
{
- text *arg0 = PG_GETARG_TEXT_P(0);
- char *name;
+ text *arg0 = PG_GETARG_TEXT_P(0);
+ char *name;
name = TextPGetCString(arg0);
@@ -289,9 +289,9 @@ tsa_set_curcfg_byname(PG_FUNCTION_ARGS)
Datum
tsa_to_tsvector_name(PG_FUNCTION_ARGS)
{
- text *cfgname = PG_GETARG_TEXT_P(0);
- Datum arg1 = PG_GETARG_DATUM(1);
- Oid config_oid;
+ text *cfgname = PG_GETARG_TEXT_P(0);
+ Datum arg1 = PG_GETARG_DATUM(1);
+ Oid config_oid;
config_oid = TextGetObjectId(regconfigin, cfgname);
@@ -303,9 +303,9 @@ tsa_to_tsvector_name(PG_FUNCTION_ARGS)
Datum
tsa_to_tsquery_name(PG_FUNCTION_ARGS)
{
- text *cfgname = PG_GETARG_TEXT_P(0);
- Datum arg1 = PG_GETARG_DATUM(1);
- Oid config_oid;
+ text *cfgname = PG_GETARG_TEXT_P(0);
+ Datum arg1 = PG_GETARG_DATUM(1);
+ Oid config_oid;
config_oid = TextGetObjectId(regconfigin, cfgname);
@@ -318,9 +318,9 @@ tsa_to_tsquery_name(PG_FUNCTION_ARGS)
Datum
tsa_plainto_tsquery_name(PG_FUNCTION_ARGS)
{
- text *cfgname = PG_GETARG_TEXT_P(0);
- Datum arg1 = PG_GETARG_DATUM(1);
- Oid config_oid;
+ text *cfgname = PG_GETARG_TEXT_P(0);
+ Datum arg1 = PG_GETARG_DATUM(1);
+ Oid config_oid;
config_oid = TextGetObjectId(regconfigin, cfgname);
@@ -332,22 +332,22 @@ tsa_plainto_tsquery_name(PG_FUNCTION_ARGS)
Datum
tsa_headline_byname(PG_FUNCTION_ARGS)
{
- Datum arg0 = PG_GETARG_DATUM(0);
- Datum arg1 = PG_GETARG_DATUM(1);
- Datum arg2 = PG_GETARG_DATUM(2);
- Datum result;
- Oid config_oid;
+ Datum arg0 = PG_GETARG_DATUM(0);
+ Datum arg1 = PG_GETARG_DATUM(1);
+ Datum arg2 = PG_GETARG_DATUM(2);
+ Datum result;
+ Oid config_oid;
/* first parameter has to be converted to oid */
config_oid = DatumGetObjectId(DirectFunctionCall1(regconfigin,
- DirectFunctionCall1(textout, arg0)));
+ DirectFunctionCall1(textout, arg0)));
if (PG_NARGS() == 3)
result = DirectFunctionCall3(ts_headline_byid,
- ObjectIdGetDatum(config_oid), arg1, arg2);
+ ObjectIdGetDatum(config_oid), arg1, arg2);
else
{
- Datum arg3 = PG_GETARG_DATUM(3);
+ Datum arg3 = PG_GETARG_DATUM(3);
result = DirectFunctionCall4(ts_headline_byid_opt,
ObjectIdGetDatum(config_oid),
@@ -371,11 +371,11 @@ tsa_tsearch2(PG_FUNCTION_ARGS)
{
TriggerData *trigdata;
Trigger *trigger;
- char **tgargs;
+ char **tgargs;
int i;
/* Check call context */
- if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */
+ if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */
elog(ERROR, "tsvector_update_trigger: not fired by trigger manager");
trigdata = (TriggerData *) fcinfo->context;
@@ -388,7 +388,7 @@ tsa_tsearch2(PG_FUNCTION_ARGS)
tgargs = (char **) palloc((trigger->tgnargs + 1) * sizeof(char *));
tgargs[0] = trigger->tgargs[0];
for (i = 1; i < trigger->tgnargs; i++)
- tgargs[i+1] = trigger->tgargs[i];
+ tgargs[i + 1] = trigger->tgargs[i];
tgargs[1] = pstrdup(GetConfigOptionByName("default_text_search_config",
NULL));
diff --git a/contrib/uuid-ossp/uuid-ossp.c b/contrib/uuid-ossp/uuid-ossp.c
index d711f47207..e1aa8af094 100644
--- a/contrib/uuid-ossp/uuid-ossp.c
+++ b/contrib/uuid-ossp/uuid-ossp.c
@@ -4,7 +4,7 @@
*
* Copyright (c) 2007 PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/contrib/uuid-ossp/uuid-ossp.c,v 1.3 2007/10/23 21:38:16 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/uuid-ossp/uuid-ossp.c,v 1.4 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,17 +39,17 @@
PG_MODULE_MAGIC;
-Datum uuid_nil(PG_FUNCTION_ARGS);
-Datum uuid_ns_dns(PG_FUNCTION_ARGS);
-Datum uuid_ns_url(PG_FUNCTION_ARGS);
-Datum uuid_ns_oid(PG_FUNCTION_ARGS);
-Datum uuid_ns_x500(PG_FUNCTION_ARGS);
+Datum uuid_nil(PG_FUNCTION_ARGS);
+Datum uuid_ns_dns(PG_FUNCTION_ARGS);
+Datum uuid_ns_url(PG_FUNCTION_ARGS);
+Datum uuid_ns_oid(PG_FUNCTION_ARGS);
+Datum uuid_ns_x500(PG_FUNCTION_ARGS);
-Datum uuid_generate_v1(PG_FUNCTION_ARGS);
-Datum uuid_generate_v1mc(PG_FUNCTION_ARGS);
-Datum uuid_generate_v3(PG_FUNCTION_ARGS);
-Datum uuid_generate_v4(PG_FUNCTION_ARGS);
-Datum uuid_generate_v5(PG_FUNCTION_ARGS);
+Datum uuid_generate_v1(PG_FUNCTION_ARGS);
+Datum uuid_generate_v1mc(PG_FUNCTION_ARGS);
+Datum uuid_generate_v3(PG_FUNCTION_ARGS);
+Datum uuid_generate_v4(PG_FUNCTION_ARGS);
+Datum uuid_generate_v5(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(uuid_nil);
@@ -66,11 +66,11 @@ PG_FUNCTION_INFO_V1(uuid_generate_v5);
static char *
-uuid_to_string(const uuid_t *uuid)
+uuid_to_string(const uuid_t * uuid)
{
- char *buf = palloc(UUID_LEN_STR + 1);
- void *ptr = buf;
- size_t len = UUID_LEN_STR + 1;
+ char *buf = palloc(UUID_LEN_STR + 1);
+ void *ptr = buf;
+ size_t len = UUID_LEN_STR + 1;
uuid_export(uuid, UUID_FMT_STR, &ptr, &len);
@@ -79,7 +79,7 @@ uuid_to_string(const uuid_t *uuid)
static void
-string_to_uuid(const char *str, uuid_t *uuid)
+string_to_uuid(const char *str, uuid_t * uuid)
{
uuid_import(uuid, UUID_FMT_STR, str, UUID_LEN_STR + 1);
}
@@ -88,8 +88,8 @@ string_to_uuid(const char *str, uuid_t *uuid)
static Datum
special_uuid_value(const char *name)
{
- uuid_t *uuid;
- char *str;
+ uuid_t *uuid;
+ char *str;
uuid_create(&uuid);
uuid_load(uuid, name);
@@ -136,10 +136,10 @@ uuid_ns_x500(PG_FUNCTION_ARGS)
static Datum
-uuid_generate_internal(int mode, const uuid_t *ns, const char *name)
+uuid_generate_internal(int mode, const uuid_t * ns, const char *name)
{
- uuid_t *uuid;
- char *str;
+ uuid_t *uuid;
+ char *str;
uuid_create(&uuid);
uuid_make(uuid, mode, ns, name);
@@ -165,7 +165,7 @@ uuid_generate_v1mc(PG_FUNCTION_ARGS)
static Datum
-uuid_generate_v35_internal(int mode, pg_uuid_t *ns, text *name)
+uuid_generate_v35_internal(int mode, pg_uuid_t * ns, text *name)
{
uuid_t *ns_uuid;
Datum result;
@@ -176,7 +176,7 @@ uuid_generate_v35_internal(int mode, pg_uuid_t *ns, text *name)
result = uuid_generate_internal(mode,
ns_uuid,
- DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(name))));
+ DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(name))));
uuid_destroy(ns_uuid);
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index a6dab8da12..eb8b136cbd 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -28,7 +28,7 @@
* without explicitly invoking the toaster.
*
* This change will break any code that assumes it needn't detoast values
- * that have been put into a tuple but never sent to disk. Hopefully there
+ * that have been put into a tuple but never sent to disk. Hopefully there
* are few such places.
*
* Varlenas still have alignment 'i' (or 'd') in pg_type/pg_attribute, since
@@ -57,7 +57,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.118 2007/11/07 12:24:23 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.119 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -99,19 +99,19 @@ heap_compute_data_size(TupleDesc tupleDesc,
for (i = 0; i < numberOfAttributes; i++)
{
- Datum val;
+ Datum val;
if (isnull[i])
continue;
val = values[i];
- if (ATT_IS_PACKABLE(att[i]) &&
+ if (ATT_IS_PACKABLE(att[i]) &&
VARATT_CAN_MAKE_SHORT(DatumGetPointer(val)))
{
/*
- * we're anticipating converting to a short varlena header,
- * so adjust length and don't count any alignment
+ * we're anticipating converting to a short varlena header, so
+ * adjust length and don't count any alignment
*/
data_length += VARATT_CONVERTED_SHORT_SIZE(DatumGetPointer(val));
}
@@ -147,19 +147,19 @@ ComputeDataSize(TupleDesc tupleDesc,
for (i = 0; i < numberOfAttributes; i++)
{
- Datum val;
+ Datum val;
if (nulls[i] != ' ')
continue;
val = values[i];
- if (ATT_IS_PACKABLE(att[i]) &&
+ if (ATT_IS_PACKABLE(att[i]) &&
VARATT_CAN_MAKE_SHORT(DatumGetPointer(val)))
{
/*
- * we're anticipating converting to a short varlena header,
- * so adjust length and don't count any alignment
+ * we're anticipating converting to a short varlena header, so
+ * adjust length and don't count any alignment
*/
data_length += VARATT_CONVERTED_SHORT_SIZE(DatumGetPointer(val));
}
@@ -195,6 +195,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
int i;
int numberOfAttributes = tupleDesc->natts;
Form_pg_attribute *att = tupleDesc->attrs;
+
#ifdef USE_ASSERT_CHECKING
char *start = data;
#endif
@@ -238,8 +239,8 @@ heap_fill_tuple(TupleDesc tupleDesc,
}
/*
- * XXX we use the att_align macros on the pointer value itself,
- * not on an offset. This is a bit of a hack.
+ * XXX we use the att_align macros on the pointer value itself, not on
+ * an offset. This is a bit of a hack.
*/
if (att[i]->attbyval)
@@ -327,6 +328,7 @@ DataFill(TupleDesc tupleDesc,
int i;
int numberOfAttributes = tupleDesc->natts;
Form_pg_attribute *att = tupleDesc->attrs;
+
#ifdef USE_ASSERT_CHECKING
char *start = data;
#endif
@@ -370,8 +372,8 @@ DataFill(TupleDesc tupleDesc,
}
/*
- * XXX we use the att_align macros on the pointer value itself,
- * not on an offset. This is a bit of a hack.
+ * XXX we use the att_align macros on the pointer value itself, not on
+ * an offset. This is a bit of a hack.
*/
if (att[i]->attbyval)
@@ -611,8 +613,8 @@ nocachegetattr(HeapTuple tuple,
/*
* Otherwise, check for non-fixed-length attrs up to and including
- * target. If there aren't any, it's safe to cheaply initialize
- * the cached offsets for these attrs.
+ * target. If there aren't any, it's safe to cheaply initialize the
+ * cached offsets for these attrs.
*/
if (HeapTupleHasVarWidth(tuple))
{
@@ -673,8 +675,8 @@ nocachegetattr(HeapTuple tuple,
int i;
/*
- * Now we know that we have to walk the tuple CAREFULLY. But we
- * still might be able to cache some offsets for next time.
+ * Now we know that we have to walk the tuple CAREFULLY. But we still
+ * might be able to cache some offsets for next time.
*
* Note - This loop is a little tricky. For each non-null attribute,
* we have to first account for alignment padding before the attr,
@@ -683,12 +685,12 @@ nocachegetattr(HeapTuple tuple,
* attcacheoff until we reach either a null or a var-width attribute.
*/
off = 0;
- for (i = 0; ; i++) /* loop exit is at "break" */
+ for (i = 0;; i++) /* loop exit is at "break" */
{
if (HeapTupleHasNulls(tuple) && att_isnull(i, bp))
{
usecache = false;
- continue; /* this cannot be the target att */
+ continue; /* this cannot be the target att */
}
/* If we know the next offset, we can skip the rest */
@@ -697,10 +699,10 @@ nocachegetattr(HeapTuple tuple,
else if (att[i]->attlen == -1)
{
/*
- * We can only cache the offset for a varlena attribute
- * if the offset is already suitably aligned, so that there
- * would be no pad bytes in any case: then the offset will
- * be valid for either an aligned or unaligned value.
+ * We can only cache the offset for a varlena attribute if the
+ * offset is already suitably aligned, so that there would be
+ * no pad bytes in any case: then the offset will be valid for
+ * either an aligned or unaligned value.
*/
if (usecache &&
off == att_align_nominal(off, att[i]->attalign))
@@ -771,11 +773,12 @@ heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
break;
case MinCommandIdAttributeNumber:
case MaxCommandIdAttributeNumber:
+
/*
- * cmin and cmax are now both aliases for the same field,
- * which can in fact also be a combo command id. XXX perhaps we
- * should return the "real" cmin or cmax if possible, that is
- * if we are inside the originating transaction?
+ * cmin and cmax are now both aliases for the same field, which
+ * can in fact also be a combo command id. XXX perhaps we should
+ * return the "real" cmin or cmax if possible, that is if we are
+ * inside the originating transaction?
*/
result = CommandIdGetDatum(HeapTupleHeaderGetRawCommandId(tup->t_data));
break;
@@ -855,7 +858,8 @@ heap_form_tuple(TupleDesc tupleDescriptor,
{
HeapTuple tuple; /* return tuple */
HeapTupleHeader td; /* tuple data */
- Size len, data_len;
+ Size len,
+ data_len;
int hoff;
bool hasnull = false;
Form_pg_attribute *att = tupleDescriptor->attrs;
@@ -965,7 +969,8 @@ heap_formtuple(TupleDesc tupleDescriptor,
{
HeapTuple tuple; /* return tuple */
HeapTupleHeader td; /* tuple data */
- Size len, data_len;
+ Size len,
+ data_len;
int hoff;
bool hasnull = false;
Form_pg_attribute *att = tupleDescriptor->attrs;
@@ -1263,10 +1268,10 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
else if (thisatt->attlen == -1)
{
/*
- * We can only cache the offset for a varlena attribute
- * if the offset is already suitably aligned, so that there
- * would be no pad bytes in any case: then the offset will
- * be valid for either an aligned or unaligned value.
+ * We can only cache the offset for a varlena attribute if the
+ * offset is already suitably aligned, so that there would be no
+ * pad bytes in any case: then the offset will be valid for either
+ * an aligned or unaligned value.
*/
if (!slow &&
off == att_align_nominal(off, thisatt->attalign))
@@ -1375,10 +1380,10 @@ heap_deformtuple(HeapTuple tuple,
else if (thisatt->attlen == -1)
{
/*
- * We can only cache the offset for a varlena attribute
- * if the offset is already suitably aligned, so that there
- * would be no pad bytes in any case: then the offset will
- * be valid for either an aligned or unaligned value.
+ * We can only cache the offset for a varlena attribute if the
+ * offset is already suitably aligned, so that there would be no
+ * pad bytes in any case: then the offset will be valid for either
+ * an aligned or unaligned value.
*/
if (!slow &&
off == att_align_nominal(off, thisatt->attalign))
@@ -1484,10 +1489,10 @@ slot_deform_tuple(TupleTableSlot *slot, int natts)
else if (thisatt->attlen == -1)
{
/*
- * We can only cache the offset for a varlena attribute
- * if the offset is already suitably aligned, so that there
- * would be no pad bytes in any case: then the offset will
- * be valid for either an aligned or unaligned value.
+ * We can only cache the offset for a varlena attribute if the
+ * offset is already suitably aligned, so that there would be no
+ * pad bytes in any case: then the offset will be valid for either
+ * an aligned or unaligned value.
*/
if (!slow &&
off == att_align_nominal(off, thisatt->attalign))
@@ -1791,7 +1796,8 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor,
bool *isnull)
{
MinimalTuple tuple; /* return tuple */
- Size len, data_len;
+ Size len,
+ data_len;
int hoff;
bool hasnull = false;
Form_pg_attribute *att = tupleDescriptor->attrs;
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index 5412ca0cf3..892363b3a9 100644
--- a/src/backend/access/common/indextuple.c
+++ b/src/backend/access/common/indextuple.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.83 2007/11/07 12:24:24 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.84 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -77,7 +77,7 @@ index_form_tuple(TupleDesc tupleDescriptor,
{
untoasted_values[i] =
PointerGetDatum(heap_tuple_fetch_attr((struct varlena *)
- DatumGetPointer(values[i])));
+ DatumGetPointer(values[i])));
untoasted_free[i] = true;
}
@@ -309,8 +309,8 @@ nocache_index_getattr(IndexTuple tup,
/*
* Otherwise, check for non-fixed-length attrs up to and including
- * target. If there aren't any, it's safe to cheaply initialize
- * the cached offsets for these attrs.
+ * target. If there aren't any, it's safe to cheaply initialize the
+ * cached offsets for these attrs.
*/
if (IndexTupleHasVarwidths(tup))
{
@@ -371,8 +371,8 @@ nocache_index_getattr(IndexTuple tup,
int i;
/*
- * Now we know that we have to walk the tuple CAREFULLY. But we
- * still might be able to cache some offsets for next time.
+ * Now we know that we have to walk the tuple CAREFULLY. But we still
+ * might be able to cache some offsets for next time.
*
* Note - This loop is a little tricky. For each non-null attribute,
* we have to first account for alignment padding before the attr,
@@ -381,12 +381,12 @@ nocache_index_getattr(IndexTuple tup,
* attcacheoff until we reach either a null or a var-width attribute.
*/
off = 0;
- for (i = 0; ; i++) /* loop exit is at "break" */
+ for (i = 0;; i++) /* loop exit is at "break" */
{
if (IndexTupleHasNulls(tup) && att_isnull(i, bp))
{
usecache = false;
- continue; /* this cannot be the target att */
+ continue; /* this cannot be the target att */
}
/* If we know the next offset, we can skip the rest */
@@ -395,10 +395,10 @@ nocache_index_getattr(IndexTuple tup,
else if (att[i]->attlen == -1)
{
/*
- * We can only cache the offset for a varlena attribute
- * if the offset is already suitably aligned, so that there
- * would be no pad bytes in any case: then the offset will
- * be valid for either an aligned or unaligned value.
+ * We can only cache the offset for a varlena attribute if the
+ * offset is already suitably aligned, so that there would be
+ * no pad bytes in any case: then the offset will be valid for
+ * either an aligned or unaligned value.
*/
if (usecache &&
off == att_align_nominal(off, att[i]->attalign))
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 9f40fc59d3..7e4afd70bd 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.5 2007/06/03 22:16:02 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.6 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -206,8 +206,8 @@ parseRelOptions(Datum options, int numkeywords, const char *const * keywords,
if (values[j] && validate)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("parameter \"%s\" specified more than once",
- keywords[j])));
+ errmsg("parameter \"%s\" specified more than once",
+ keywords[j])));
value_len = text_len - kw_len - 1;
value = (char *) palloc(value_len + 1);
memcpy(value, text_str + kw_len + 1, value_len);
diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index d608bedb60..430b72a92b 100644
--- a/src/backend/access/gin/ginarrayproc.c
+++ b/src/backend/access/gin/ginarrayproc.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.10 2007/08/21 01:11:12 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
*-------------------------------------------------------------------------
*/
#include "postgres.h"
@@ -60,17 +60,18 @@ ginarrayextract(PG_FUNCTION_ARGS)
elmlen, elmbyval, elmalign,
&entries, NULL, (int *) nentries);
- if ( *nentries == 0 && PG_NARGS() == 3 )
+ if (*nentries == 0 && PG_NARGS() == 3)
{
- switch( PG_GETARG_UINT16(2) ) /* StrategyNumber */
+ switch (PG_GETARG_UINT16(2)) /* StrategyNumber */
{
case GinOverlapStrategy:
- *nentries = -1; /* nobody can be found */
- break;
+ *nentries = -1; /* nobody can be found */
+ break;
case GinContainsStrategy:
case GinContainedStrategy:
case GinEqualStrategy:
- default: /* require fullscan: GIN can't find void arrays */
+ default: /* require fullscan: GIN can't find void
+ * arrays */
break;
}
}
diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c
index 1a711e93c6..a89c384dfc 100644
--- a/src/backend/access/gin/ginbtree.c
+++ b/src/backend/access/gin/ginbtree.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginbtree.c,v 1.9 2007/06/05 12:47:49 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginbtree.c,v 1.10 2007/11/15 21:14:31 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -317,8 +317,8 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack)
Page newlpage;
/*
- * newlpage is a pointer to memory page, it doesn't associate
- * with buffer, stack->buffer should be untouched
+ * newlpage is a pointer to memory page, it doesn't associate with
+ * buffer, stack->buffer should be untouched
*/
newlpage = btree->splitPage(btree, stack->buffer, rbuffer, stack->off, &rdata);
diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c
index d9242c667a..eb6ccfc0b4 100644
--- a/src/backend/access/gin/gindatapage.c
+++ b/src/backend/access/gin/gindatapage.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/gindatapage.c,v 1.7 2007/06/04 15:56:28 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/gindatapage.c,v 1.8 2007/11/15 21:14:31 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -358,7 +358,7 @@ dataPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prda
static XLogRecData rdata[3];
int sizeofitem = GinSizeOfItem(page);
static ginxlogInsert data;
- int cnt=0;
+ int cnt = 0;
*prdata = rdata;
Assert(GinPageIsData(page));
@@ -373,14 +373,14 @@ dataPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prda
data.isData = TRUE;
data.isLeaf = GinPageIsLeaf(page) ? TRUE : FALSE;
- /*
- * Prevent full page write if child's split occurs. That is needed
- * to remove incomplete splits while replaying WAL
- *
- * data.updateBlkno contains new block number (of newly created right page)
- * for recently splited page.
+ /*
+ * Prevent full page write if child's split occurs. That is needed to
+ * remove incomplete splits while replaying WAL
+ *
+ * data.updateBlkno contains new block number (of newly created right
+ * page) for recently splited page.
*/
- if ( data.updateBlkno == InvalidBlockNumber )
+ if (data.updateBlkno == InvalidBlockNumber)
{
rdata[0].buffer = buf;
rdata[0].buffer_std = FALSE;
@@ -393,7 +393,7 @@ dataPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prda
rdata[cnt].buffer = InvalidBuffer;
rdata[cnt].data = (char *) &data;
rdata[cnt].len = sizeof(ginxlogInsert);
- rdata[cnt].next = &rdata[cnt+1];
+ rdata[cnt].next = &rdata[cnt + 1];
cnt++;
rdata[cnt].buffer = InvalidBuffer;
diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c
index 2c335aea0c..134c5f99dd 100644
--- a/src/backend/access/gin/ginentrypage.c
+++ b/src/backend/access/gin/ginentrypage.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.10 2007/10/29 13:49:21 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -354,7 +354,7 @@ entryPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prd
static XLogRecData rdata[3];
OffsetNumber placed;
static ginxlogInsert data;
- int cnt=0;
+ int cnt = 0;
*prdata = rdata;
data.updateBlkno = entryPreparePage(btree, page, off);
@@ -372,14 +372,14 @@ entryPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prd
data.isData = false;
data.isLeaf = GinPageIsLeaf(page) ? TRUE : FALSE;
- /*
- * Prevent full page write if child's split occurs. That is needed
- * to remove incomplete splits while replaying WAL
+ /*
+ * Prevent full page write if child's split occurs. That is needed to
+ * remove incomplete splits while replaying WAL
*
- * data.updateBlkno contains new block number (of newly created right page)
- * for recently splited page.
+ * data.updateBlkno contains new block number (of newly created right
+ * page) for recently splited page.
*/
- if ( data.updateBlkno == InvalidBlockNumber )
+ if (data.updateBlkno == InvalidBlockNumber)
{
rdata[0].buffer = buf;
rdata[0].buffer_std = TRUE;
@@ -392,7 +392,7 @@ entryPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prd
rdata[cnt].buffer = InvalidBuffer;
rdata[cnt].data = (char *) &data;
rdata[cnt].len = sizeof(ginxlogInsert);
- rdata[cnt].next = &rdata[cnt+1];
+ rdata[cnt].next = &rdata[cnt + 1];
cnt++;
rdata[cnt].buffer = InvalidBuffer;
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index 66949f964c..b964f036a0 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.8 2007/06/04 15:56:28 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.9 2007/11/15 21:14:31 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -23,29 +23,29 @@ findItemInPage(Page page, ItemPointer item, OffsetNumber *off)
OffsetNumber maxoff = GinPageGetOpaque(page)->maxoff;
int res;
- if ( GinPageGetOpaque(page)->flags & GIN_DELETED )
+ if (GinPageGetOpaque(page)->flags & GIN_DELETED)
/* page was deleted by concurrent vacuum */
return false;
- if ( *off > maxoff || *off == InvalidOffsetNumber )
+ if (*off > maxoff || *off == InvalidOffsetNumber)
res = -1;
else
res = compareItemPointers(item, (ItemPointer) GinDataPageGetItem(page, *off));
- if ( res == 0 )
+ if (res == 0)
{
/* page isn't changed */
- return true;
- }
- else if ( res > 0 )
+ return true;
+ }
+ else if (res > 0)
{
- /*
- * some items was added before our position, look further to find
- * it or first greater
+ /*
+ * some items was added before our position, look further to find it
+ * or first greater
*/
-
+
(*off)++;
- for (; *off <= maxoff; (*off)++)
+ for (; *off <= maxoff; (*off)++)
{
res = compareItemPointers(item, (ItemPointer) GinDataPageGetItem(page, *off));
@@ -53,7 +53,7 @@ findItemInPage(Page page, ItemPointer item, OffsetNumber *off)
return true;
if (res < 0)
- {
+ {
(*off)--;
return true;
}
@@ -61,20 +61,20 @@ findItemInPage(Page page, ItemPointer item, OffsetNumber *off)
}
else
{
- /*
- * some items was deleted before our position, look from begining
- * to find it or first greater
+ /*
+ * some items was deleted before our position, look from begining to
+ * find it or first greater
*/
- for(*off = FirstOffsetNumber; *off<= maxoff; (*off)++)
+ for (*off = FirstOffsetNumber; *off <= maxoff; (*off)++)
{
res = compareItemPointers(item, (ItemPointer) GinDataPageGetItem(page, *off));
- if ( res == 0 )
+ if (res == 0)
return true;
if (res < 0)
- {
+ {
(*off)--;
return true;
}
@@ -174,7 +174,7 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry, bool firs
page = BufferGetPage(entry->buffer);
/* try to find curItem in current buffer */
- if ( findItemInPage(page, &entry->curItem, &entry->offset) )
+ if (findItemInPage(page, &entry->curItem, &entry->offset))
return;
/* walk to right */
@@ -186,13 +186,13 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry, bool firs
page = BufferGetPage(entry->buffer);
entry->offset = InvalidOffsetNumber;
- if ( findItemInPage(page, &entry->curItem, &entry->offset) )
+ if (findItemInPage(page, &entry->curItem, &entry->offset))
return;
}
/*
- * curItem and any greated items was deleted by concurrent vacuum,
- * so we finished scan with currrent entry
+ * curItem and any greated items was deleted by concurrent vacuum, so
+ * we finished scan with currrent entry
*/
}
}
@@ -221,10 +221,10 @@ startScanKey(Relation index, GinState *ginstate, GinScanKey key)
if (GinFuzzySearchLimit > 0)
{
/*
- * If all of keys more than threshold we will try to reduce result,
- * we hope (and only hope, for intersection operation of array our
- * supposition isn't true), that total result will not more than
- * minimal predictNumberResult.
+ * If all of keys more than threshold we will try to reduce
+ * result, we hope (and only hope, for intersection operation of
+ * array our supposition isn't true), that total result will not
+ * more than minimal predictNumberResult.
*/
for (i = 0; i < key->nentries; i++)
diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c
index 2eb1ba95b4..2e40f8b8d8 100644
--- a/src/backend/access/gin/ginscan.c
+++ b/src/backend/access/gin/ginscan.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginscan.c,v 1.10 2007/05/27 03:50:38 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginscan.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -164,13 +164,13 @@ newScanKey(IndexScanDesc scan)
UInt16GetDatum(scankey[i].sk_strategy)
)
);
- if ( nEntryValues < 0 )
+ if (nEntryValues < 0)
{
/*
- * extractQueryFn signals that nothing will be found,
- * so we can just set isVoidRes flag...
+ * extractQueryFn signals that nothing will be found, so we can
+ * just set isVoidRes flag...
*/
- so->isVoidRes = true;
+ so->isVoidRes = true;
break;
}
if (entryValues == NULL || nEntryValues == 0)
@@ -187,7 +187,7 @@ newScanKey(IndexScanDesc scan)
if (so->nkeys == 0 && !so->isVoidRes)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("GIN index does not support search with void query")));
+ errmsg("GIN index does not support search with void query")));
pgstat_count_index_scan(scan->indexRelation);
}
diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c
index e704e8051e..488a58beb5 100644
--- a/src/backend/access/gin/ginutil.c
+++ b/src/backend/access/gin/ginutil.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.10 2007/01/31 15:09:45 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -126,17 +126,17 @@ compareEntries(GinState *ginstate, Datum a, Datum b)
&ginstate->compareFn,
a, b
)
- );
+ );
}
typedef struct
{
FmgrInfo *cmpDatumFunc;
bool *needUnique;
-} cmpEntriesData;
+} cmpEntriesData;
static int
-cmpEntries(const Datum *a, const Datum *b, cmpEntriesData *arg)
+cmpEntries(const Datum *a, const Datum *b, cmpEntriesData * arg)
{
int res = DatumGetInt32(FunctionCall2(arg->cmpDatumFunc,
*a, *b));
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c
index 1f26869d64..9c0482a890 100644
--- a/src/backend/access/gin/ginvacuum.c
+++ b/src/backend/access/gin/ginvacuum.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.17 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.18 2007/11/15 21:14:31 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -28,7 +28,7 @@ typedef struct
IndexBulkDeleteCallback callback;
void *callback_state;
GinState ginstate;
- BufferAccessStrategy strategy;
+ BufferAccessStrategy strategy;
} GinVacuumState;
@@ -160,14 +160,14 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot,
/*
* We should be sure that we don't concurrent with inserts, insert process
* never release root page until end (but it can unlock it and lock
- * again). New scan can't start but previously started
- * ones work concurrently.
+ * again). New scan can't start but previously started ones work
+ * concurrently.
*/
- if ( isRoot )
+ if (isRoot)
LockBufferForCleanup(buffer);
else
- LockBuffer(buffer, GIN_EXCLUSIVE);
+ LockBuffer(buffer, GIN_EXCLUSIVE);
Assert(GinPageIsData(page));
@@ -240,8 +240,8 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
BlockNumber parentBlkno, OffsetNumber myoff, bool isParentRoot)
{
Buffer dBuffer = ReadBufferWithStrategy(gvs->index, deleteBlkno, gvs->strategy);
- Buffer lBuffer = (leftBlkno == InvalidBlockNumber) ?
- InvalidBuffer : ReadBufferWithStrategy(gvs->index, leftBlkno, gvs->strategy);
+ Buffer lBuffer = (leftBlkno == InvalidBlockNumber) ?
+ InvalidBuffer : ReadBufferWithStrategy(gvs->index, leftBlkno, gvs->strategy);
Buffer pBuffer = ReadBufferWithStrategy(gvs->index, parentBlkno, gvs->strategy);
Page page,
parentPage;
@@ -268,17 +268,20 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
parentPage = BufferGetPage(pBuffer);
#ifdef USE_ASSERT_CHECKING
- do {
- PostingItem *tod=(PostingItem *) GinDataPageGetItem(parentPage, myoff);
- Assert( PostingItemGetBlockNumber(tod) == deleteBlkno );
- } while(0);
+ do
+ {
+ PostingItem *tod = (PostingItem *) GinDataPageGetItem(parentPage, myoff);
+
+ Assert(PostingItemGetBlockNumber(tod) == deleteBlkno);
+ } while (0);
#endif
PageDeletePostingItem(parentPage, myoff);
page = BufferGetPage(dBuffer);
+
/*
- * we shouldn't change rightlink field to save
- * workability of running search scan
+ * we shouldn't change rightlink field to save workability of running
+ * search scan
*/
GinPageGetOpaque(page)->flags = GIN_DELETED;
@@ -363,8 +366,8 @@ typedef struct DataPageDeleteStack
struct DataPageDeleteStack *child;
struct DataPageDeleteStack *parent;
- BlockNumber blkno; /* current block number */
- BlockNumber leftBlkno; /* rightest non-deleted page on left */
+ BlockNumber blkno; /* current block number */
+ BlockNumber leftBlkno; /* rightest non-deleted page on left */
bool isRoot;
} DataPageDeleteStack;
diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c
index 79fbb496b5..7649e4c900 100644
--- a/src/backend/access/gin/ginxlog.c
+++ b/src/backend/access/gin/ginxlog.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginxlog.c,v 1.10 2007/10/29 19:26:57 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginxlog.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
*-------------------------------------------------------------------------
*/
#include "postgres.h"
@@ -135,7 +135,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
Assert(data->isDelete == FALSE);
Assert(GinPageIsData(page));
- if ( ! XLByteLE(lsn, PageGetLSN(page)) )
+ if (!XLByteLE(lsn, PageGetLSN(page)))
{
if (data->isLeaf)
{
@@ -170,6 +170,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
if (!data->isLeaf && data->updateBlkno != InvalidBlockNumber)
{
PostingItem *pitem = (PostingItem *) (XLogRecGetData(record) + sizeof(ginxlogInsert));
+
forgetIncompleteSplit(data->node, PostingItemGetBlockNumber(pitem), data->updateBlkno);
}
@@ -180,7 +181,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
Assert(!GinPageIsData(page));
- if ( ! XLByteLE(lsn, PageGetLSN(page)) )
+ if (!XLByteLE(lsn, PageGetLSN(page)))
{
if (data->updateBlkno != InvalidBlockNumber)
{
@@ -202,7 +203,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
if (PageAddItem(page, (Item) itup, IndexTupleSize(itup), data->offset, false, false) == InvalidOffsetNumber)
elog(ERROR, "failed to add item to index page in %u/%u/%u",
- data->node.spcNode, data->node.dbNode, data->node.relNode);
+ data->node.spcNode, data->node.dbNode, data->node.relNode);
}
if (!data->isLeaf && data->updateBlkno != InvalidBlockNumber)
@@ -212,7 +213,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
}
}
- if ( ! XLByteLE(lsn, PageGetLSN(page)) )
+ if (!XLByteLE(lsn, PageGetLSN(page)))
{
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 0c1b94d7d3..770c2023bd 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.147 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.148 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -360,8 +360,8 @@ gistplacetopage(GISTInsertState *state, GISTSTATE *giststate)
ptr->block.blkno = BufferGetBlockNumber(ptr->buffer);
/*
- * fill page, we can do it because all these pages are new
- * (ie not linked in tree or masked by temp page
+ * fill page, we can do it because all these pages are new (ie not
+ * linked in tree or masked by temp page
*/
data = (char *) (ptr->list);
for (i = 0; i < ptr->block.num; i++)
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index ba7a8ab959..cb1919ac6e 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.67 2007/09/12 22:10:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.68 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -383,13 +383,12 @@ gistindex_keytest(IndexTuple tuple,
/*
* On non-leaf page we can't conclude that child hasn't NULL
* values because of assumption in GiST: uinon (VAL, NULL) is VAL
- * But if on non-leaf page key IS NULL then all childs
- * has NULL.
+ * But if on non-leaf page key IS NULL then all childs has NULL.
*/
- Assert( key->sk_flags & SK_SEARCHNULL );
+ Assert(key->sk_flags & SK_SEARCHNULL);
- if ( GistPageIsLeaf(p) && !isNull )
+ if (GistPageIsLeaf(p) && !isNull)
return false;
}
else if (isNull)
@@ -404,12 +403,14 @@ gistindex_keytest(IndexTuple tuple,
FALSE, isNull);
/*
- * Call the Consistent function to evaluate the test. The arguments
- * are the index datum (as a GISTENTRY*), the comparison datum, and
- * the comparison operator's strategy number and subtype from pg_amop.
+ * Call the Consistent function to evaluate the test. The
+ * arguments are the index datum (as a GISTENTRY*), the comparison
+ * datum, and the comparison operator's strategy number and
+ * subtype from pg_amop.
*
- * (Presently there's no need to pass the subtype since it'll always
- * be zero, but might as well pass it for possible future use.)
+ * (Presently there's no need to pass the subtype since it'll
+ * always be zero, but might as well pass it for possible future
+ * use.)
*/
test = FunctionCall4(&key->sk_func,
PointerGetDatum(&de),
diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c
index 590be9133f..e461b5923d 100644
--- a/src/backend/access/gist/gistproc.c
+++ b/src/backend/access/gist/gistproc.c
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.11 2007/09/07 17:04:26 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.12 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -394,20 +394,22 @@ gist_box_picksplit(PG_FUNCTION_ARGS)
ADDLIST(listT, unionT, posT, i);
}
-#define LIMIT_RATIO 0.1
+#define LIMIT_RATIO 0.1
#define _IS_BADRATIO(x,y) ( (y) == 0 || (float)(x)/(float)(y) < LIMIT_RATIO )
#define IS_BADRATIO(x,y) ( _IS_BADRATIO((x),(y)) || _IS_BADRATIO((y),(x)) )
/* bad disposition, try to split by centers of boxes */
- if ( IS_BADRATIO(posR, posL) && IS_BADRATIO(posT, posB) )
+ if (IS_BADRATIO(posR, posL) && IS_BADRATIO(posT, posB))
{
- double avgCenterX=0.0, avgCenterY=0.0;
- double CenterX, CenterY;
+ double avgCenterX = 0.0,
+ avgCenterY = 0.0;
+ double CenterX,
+ CenterY;
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
{
cur = DatumGetBoxP(entryvec->vector[i].key);
- avgCenterX += ((double)cur->high.x + (double)cur->low.x)/2.0;
- avgCenterY += ((double)cur->high.y + (double)cur->low.y)/2.0;
+ avgCenterX += ((double) cur->high.x + (double) cur->low.x) / 2.0;
+ avgCenterY += ((double) cur->high.y + (double) cur->low.y) / 2.0;
}
avgCenterX /= maxoff;
@@ -417,11 +419,11 @@ gist_box_picksplit(PG_FUNCTION_ARGS)
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
{
cur = DatumGetBoxP(entryvec->vector[i].key);
-
- CenterX = ((double)cur->high.x + (double)cur->low.x)/2.0;
- CenterY = ((double)cur->high.y + (double)cur->low.y)/2.0;
- if (CenterX < avgCenterX)
+ CenterX = ((double) cur->high.x + (double) cur->low.x) / 2.0;
+ CenterY = ((double) cur->high.y + (double) cur->low.y) / 2.0;
+
+ if (CenterX < avgCenterX)
ADDLIST(listL, unionL, posL, i);
else if (CenterX == avgCenterX)
{
@@ -442,7 +444,7 @@ gist_box_picksplit(PG_FUNCTION_ARGS)
else
ADDLIST(listB, unionB, posB, i);
}
- else
+ else
ADDLIST(listT, unionT, posT, i);
}
}
diff --git a/src/backend/access/gist/gistvacuum.c b/src/backend/access/gist/gistvacuum.c
index 212995e7c5..dace2c8906 100644
--- a/src/backend/access/gist/gistvacuum.c
+++ b/src/backend/access/gist/gistvacuum.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.32 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.33 2007/11/15 21:14:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@ typedef struct
Relation index;
MemoryContext opCtx;
GistBulkDeleteResult *result;
- BufferAccessStrategy strategy;
+ BufferAccessStrategy strategy;
} GistVacuum;
typedef struct
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index d3f54c934b..5933b02e8e 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.96 2007/09/12 22:10:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.97 2007/11/15 21:14:32 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -548,7 +548,7 @@ loop_top:
vacuum_delay_point();
buf = _hash_getbuf_with_strategy(rel, blkno, HASH_WRITE,
- LH_BUCKET_PAGE | LH_OVERFLOW_PAGE,
+ LH_BUCKET_PAGE | LH_OVERFLOW_PAGE,
info->strategy);
page = BufferGetPage(buf);
opaque = (HashPageOpaque) PageGetSpecialPointer(page);
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c
index 71fe34c8a2..4d1b1ed45c 100644
--- a/src/backend/access/hash/hashfunc.c
+++ b/src/backend/access/hash/hashfunc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.53 2007/09/21 22:52:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.54 2007/11/15 21:14:32 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -103,8 +103,8 @@ hashfloat4(PG_FUNCTION_ARGS)
* To support cross-type hashing of float8 and float4, we want to return
* the same hash value hashfloat8 would produce for an equal float8 value.
* So, widen the value to float8 and hash that. (We must do this rather
- * than have hashfloat8 try to narrow its value to float4; that could
- * fail on overflow.)
+ * than have hashfloat8 try to narrow its value to float4; that could fail
+ * on overflow.)
*/
key8 = key;
diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c
index e4ea24a62d..c510c6e65b 100644
--- a/src/backend/access/hash/hashovfl.c
+++ b/src/backend/access/hash/hashovfl.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.60 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.61 2007/11/15 21:14:32 momjian Exp $
*
* NOTES
* Overflow pages look like ordinary relation pages.
@@ -156,7 +156,7 @@ _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf)
/*
* _hash_getovflpage()
*
- * Find an available overflow page and return it. The returned buffer
+ * Find an available overflow page and return it. The returned buffer
* is pinned and write-locked, and has had _hash_pageinit() applied,
* but it is caller's responsibility to fill the special space.
*
@@ -402,9 +402,9 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf,
bucket = ovflopaque->hasho_bucket;
/*
- * Zero the page for debugging's sake; then write and release it.
- * (Note: if we failed to zero the page here, we'd have problems
- * with the Assert in _hash_pageinit() when the page is reused.)
+ * Zero the page for debugging's sake; then write and release it. (Note:
+ * if we failed to zero the page here, we'd have problems with the Assert
+ * in _hash_pageinit() when the page is reused.)
*/
MemSet(ovflpage, 0, BufferGetPageSize(ovflbuf));
_hash_wrtbuf(rel, ovflbuf);
@@ -420,7 +420,7 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf,
Buffer prevbuf = _hash_getbuf_with_strategy(rel,
prevblkno,
HASH_WRITE,
- LH_BUCKET_PAGE | LH_OVERFLOW_PAGE,
+ LH_BUCKET_PAGE | LH_OVERFLOW_PAGE,
bstrategy);
Page prevpage = BufferGetPage(prevbuf);
HashPageOpaque prevopaque = (HashPageOpaque) PageGetSpecialPointer(prevpage);
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c
index 807dbed8a8..07f27001a8 100644
--- a/src/backend/access/hash/hashpage.c
+++ b/src/backend/access/hash/hashpage.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.70 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.71 2007/11/15 21:14:32 momjian Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -37,7 +37,7 @@
static bool _hash_alloc_buckets(Relation rel, BlockNumber firstblock,
- uint32 nblocks);
+ uint32 nblocks);
static void _hash_splitbucket(Relation rel, Buffer metabuf,
Bucket obucket, Bucket nbucket,
BlockNumber start_oblkno,
@@ -138,7 +138,7 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access, int flags)
*
* This must be used only to fetch pages that are known to be before
* the index's filesystem EOF, but are to be filled from scratch.
- * _hash_pageinit() is applied automatically. Otherwise it has
+ * _hash_pageinit() is applied automatically. Otherwise it has
* effects similar to _hash_getbuf() with access = HASH_WRITE.
*
* When this routine returns, a write lock is set on the
@@ -184,7 +184,7 @@ _hash_getinitbuf(Relation rel, BlockNumber blkno)
Buffer
_hash_getnewbuf(Relation rel, BlockNumber blkno)
{
- BlockNumber nblocks = RelationGetNumberOfBlocks(rel);
+ BlockNumber nblocks = RelationGetNumberOfBlocks(rel);
Buffer buf;
if (blkno == P_NEW)
@@ -354,10 +354,10 @@ _hash_metapinit(Relation rel)
ffactor = 10;
/*
- * We initialize the metapage, the first two bucket pages, and the
- * first bitmap page in sequence, using _hash_getnewbuf to cause
- * smgrextend() calls to occur. This ensures that the smgr level
- * has the right idea of the physical index length.
+ * We initialize the metapage, the first two bucket pages, and the first
+ * bitmap page in sequence, using _hash_getnewbuf to cause smgrextend()
+ * calls to occur. This ensures that the smgr level has the right idea of
+ * the physical index length.
*/
metabuf = _hash_getnewbuf(rel, HASH_METAPAGE);
pg = BufferGetPage(metabuf);
@@ -501,15 +501,16 @@ _hash_expandtable(Relation rel, Buffer metabuf)
goto fail;
/*
- * Can't split anymore if maxbucket has reached its maximum possible value.
+ * Can't split anymore if maxbucket has reached its maximum possible
+ * value.
*
* Ideally we'd allow bucket numbers up to UINT_MAX-1 (no higher because
* the calculation maxbucket+1 mustn't overflow). Currently we restrict
* to half that because of overflow looping in _hash_log2() and
* insufficient space in hashm_spares[]. It's moot anyway because an
- * index with 2^32 buckets would certainly overflow BlockNumber and
- * hence _hash_alloc_buckets() would fail, but if we supported buckets
- * smaller than a disk block then this would be an independent constraint.
+ * index with 2^32 buckets would certainly overflow BlockNumber and hence
+ * _hash_alloc_buckets() would fail, but if we supported buckets smaller
+ * than a disk block then this would be an independent constraint.
*/
if (metap->hashm_maxbucket >= (uint32) 0x7FFFFFFE)
goto fail;
@@ -536,10 +537,10 @@ _hash_expandtable(Relation rel, Buffer metabuf)
/*
* Likewise lock the new bucket (should never fail).
*
- * Note: it is safe to compute the new bucket's blkno here, even though
- * we may still need to update the BUCKET_TO_BLKNO mapping. This is
- * because the current value of hashm_spares[hashm_ovflpoint] correctly
- * shows where we are going to put a new splitpoint's worth of buckets.
+ * Note: it is safe to compute the new bucket's blkno here, even though we
+ * may still need to update the BUCKET_TO_BLKNO mapping. This is because
+ * the current value of hashm_spares[hashm_ovflpoint] correctly shows
+ * where we are going to put a new splitpoint's worth of buckets.
*/
start_nblkno = BUCKET_TO_BLKNO(metap, new_bucket);
@@ -557,11 +558,12 @@ _hash_expandtable(Relation rel, Buffer metabuf)
if (spare_ndx > metap->hashm_ovflpoint)
{
Assert(spare_ndx == metap->hashm_ovflpoint + 1);
+
/*
- * The number of buckets in the new splitpoint is equal to the
- * total number already in existence, i.e. new_bucket. Currently
- * this maps one-to-one to blocks required, but someday we may need
- * a more complicated calculation here.
+ * The number of buckets in the new splitpoint is equal to the total
+ * number already in existence, i.e. new_bucket. Currently this maps
+ * one-to-one to blocks required, but someday we may need a more
+ * complicated calculation here.
*/
if (!_hash_alloc_buckets(rel, start_nblkno, new_bucket))
{
@@ -673,14 +675,14 @@ fail:
static bool
_hash_alloc_buckets(Relation rel, BlockNumber firstblock, uint32 nblocks)
{
- BlockNumber lastblock;
+ BlockNumber lastblock;
char zerobuf[BLCKSZ];
lastblock = firstblock + nblocks - 1;
/*
- * Check for overflow in block number calculation; if so, we cannot
- * extend the index anymore.
+ * Check for overflow in block number calculation; if so, we cannot extend
+ * the index anymore.
*/
if (lastblock < firstblock || lastblock == InvalidBlockNumber)
return false;
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 052393fc6b..20027592b5 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.244 2007/11/07 12:24:24 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.245 2007/11/15 21:14:32 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -60,9 +60,9 @@
static HeapScanDesc heap_beginscan_internal(Relation relation,
- Snapshot snapshot,
- int nkeys, ScanKey key,
- bool is_bitmapscan);
+ Snapshot snapshot,
+ int nkeys, ScanKey key,
+ bool is_bitmapscan);
static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
ItemPointerData from, Buffer newbuf, HeapTuple newtup, bool move);
static bool HeapSatisfiesHOTUpdate(Relation relation, Bitmapset *hot_attrs,
@@ -85,18 +85,18 @@ initscan(HeapScanDesc scan, ScanKey key)
* Determine the number of blocks we have to scan.
*
* It is sufficient to do this once at scan start, since any tuples added
- * while the scan is in progress will be invisible to my snapshot
- * anyway. (That is not true when using a non-MVCC snapshot. However,
- * we couldn't guarantee to return tuples added after scan start anyway,
- * since they might go into pages we already scanned. To guarantee
- * consistent results for a non-MVCC snapshot, the caller must hold some
- * higher-level lock that ensures the interesting tuple(s) won't change.)
+ * while the scan is in progress will be invisible to my snapshot anyway.
+ * (That is not true when using a non-MVCC snapshot. However, we couldn't
+ * guarantee to return tuples added after scan start anyway, since they
+ * might go into pages we already scanned. To guarantee consistent
+ * results for a non-MVCC snapshot, the caller must hold some higher-level
+ * lock that ensures the interesting tuple(s) won't change.)
*/
scan->rs_nblocks = RelationGetNumberOfBlocks(scan->rs_rd);
/*
* If the table is large relative to NBuffers, use a bulk-read access
- * strategy and enable synchronized scanning (see syncscan.c). Although
+ * strategy and enable synchronized scanning (see syncscan.c). Although
* the thresholds for these features could be different, we make them the
* same so that there are only two behaviors to tune rather than four.
*
@@ -140,8 +140,8 @@ initscan(HeapScanDesc scan, ScanKey key)
memcpy(scan->rs_key, key, scan->rs_nkeys * sizeof(ScanKeyData));
/*
- * Currently, we don't have a stats counter for bitmap heap scans
- * (but the underlying bitmap index scans will be counted).
+ * Currently, we don't have a stats counter for bitmap heap scans (but the
+ * underlying bitmap index scans will be counted).
*/
if (!scan->rs_bitmapscan)
pgstat_count_heap_scan(scan->rs_rd);
@@ -283,7 +283,7 @@ heapgettup(HeapScanDesc scan,
tuple->t_data = NULL;
return;
}
- page = scan->rs_startblock; /* first page */
+ page = scan->rs_startblock; /* first page */
heapgetpage(scan, page);
lineoff = FirstOffsetNumber; /* first offnum */
scan->rs_inited = true;
@@ -317,6 +317,7 @@ heapgettup(HeapScanDesc scan,
tuple->t_data = NULL;
return;
}
+
/*
* Disable reporting to syncscan logic in a backwards scan; it's
* not very likely anyone else is doing the same thing at the same
@@ -459,9 +460,9 @@ heapgettup(HeapScanDesc scan,
finished = (page == scan->rs_startblock);
/*
- * Report our new scan position for synchronization purposes.
- * We don't do that when moving backwards, however. That would
- * just mess up any other forward-moving scanners.
+ * Report our new scan position for synchronization purposes. We
+ * don't do that when moving backwards, however. That would just
+ * mess up any other forward-moving scanners.
*
* Note: we do this before checking for end of scan so that the
* final state of the position hint is back at the start of the
@@ -554,7 +555,7 @@ heapgettup_pagemode(HeapScanDesc scan,
tuple->t_data = NULL;
return;
}
- page = scan->rs_startblock; /* first page */
+ page = scan->rs_startblock; /* first page */
heapgetpage(scan, page);
lineindex = 0;
scan->rs_inited = true;
@@ -585,6 +586,7 @@ heapgettup_pagemode(HeapScanDesc scan,
tuple->t_data = NULL;
return;
}
+
/*
* Disable reporting to syncscan logic in a backwards scan; it's
* not very likely anyone else is doing the same thing at the same
@@ -719,9 +721,9 @@ heapgettup_pagemode(HeapScanDesc scan,
finished = (page == scan->rs_startblock);
/*
- * Report our new scan position for synchronization purposes.
- * We don't do that when moving backwards, however. That would
- * just mess up any other forward-moving scanners.
+ * Report our new scan position for synchronization purposes. We
+ * don't do that when moving backwards, however. That would just
+ * mess up any other forward-moving scanners.
*
* Note: we do this before checking for end of scan so that the
* final state of the position hint is back at the start of the
@@ -1057,7 +1059,7 @@ heap_openrv(const RangeVar *relation, LOCKMODE lockmode)
* heap_beginscan - begin relation scan
*
* heap_beginscan_bm is an alternative entry point for setting up a HeapScanDesc
- * for a bitmap heap scan. Although that scan technology is really quite
+ * for a bitmap heap scan. Although that scan technology is really quite
* unlike a standard seqscan, there is just enough commonality to make it
* worth using the same data structure.
* ----------------
@@ -1423,10 +1425,10 @@ bool
heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
bool *all_dead)
{
- Page dp = (Page) BufferGetPage(buffer);
+ Page dp = (Page) BufferGetPage(buffer);
TransactionId prev_xmax = InvalidTransactionId;
OffsetNumber offnum;
- bool at_chain_start;
+ bool at_chain_start;
if (all_dead)
*all_dead = true;
@@ -1438,7 +1440,7 @@ heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
/* Scan through possible multiple members of HOT-chain */
for (;;)
{
- ItemId lp;
+ ItemId lp;
HeapTupleData heapTuple;
/* check for bogus TID */
@@ -1472,7 +1474,8 @@ heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
break;
/*
- * The xmin should match the previous xmax value, else chain is broken.
+ * The xmin should match the previous xmax value, else chain is
+ * broken.
*/
if (TransactionIdIsValid(prev_xmax) &&
!TransactionIdEquals(prev_xmax,
@@ -1499,8 +1502,8 @@ heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
*all_dead = false;
/*
- * Check to see if HOT chain continues past this tuple; if so
- * fetch the next offnum and loop around.
+ * Check to see if HOT chain continues past this tuple; if so fetch
+ * the next offnum and loop around.
*/
if (HeapTupleIsHotUpdated(&heapTuple))
{
@@ -1511,7 +1514,7 @@ heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
prev_xmax = HeapTupleHeaderGetXmax(heapTuple.t_data);
}
else
- break; /* end of chain */
+ break; /* end of chain */
}
return false;
@@ -1528,8 +1531,8 @@ bool
heap_hot_search(ItemPointer tid, Relation relation, Snapshot snapshot,
bool *all_dead)
{
- bool result;
- Buffer buffer;
+ bool result;
+ Buffer buffer;
buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid));
LockBuffer(buffer, BUFFER_LOCK_SHARE);
@@ -1665,7 +1668,7 @@ heap_get_latest_tid(Relation relation,
*
* This is called after we have waited for the XMAX transaction to terminate.
* If the transaction aborted, we guarantee the XMAX_INVALID hint bit will
- * be set on exit. If the transaction committed, we set the XMAX_COMMITTED
+ * be set on exit. If the transaction committed, we set the XMAX_COMMITTED
* hint bit if possible --- but beware that that may not yet be possible,
* if the transaction committed asynchronously. Hence callers should look
* only at XMAX_INVALID.
@@ -2069,7 +2072,7 @@ l1:
/*
* If this transaction commits, the tuple will become DEAD sooner or
* later. Set flag that this page is a candidate for pruning once our xid
- * falls below the OldestXmin horizon. If the transaction finally aborts,
+ * falls below the OldestXmin horizon. If the transaction finally aborts,
* the subsequent page pruning will be a no-op and the hint will be
* cleared.
*/
@@ -2252,15 +2255,15 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
/*
* Fetch the list of attributes to be checked for HOT update. This is
- * wasted effort if we fail to update or have to put the new tuple on
- * a different page. But we must compute the list before obtaining
- * buffer lock --- in the worst case, if we are doing an update on one
- * of the relevant system catalogs, we could deadlock if we try to
- * fetch the list later. In any case, the relcache caches the data
- * so this is usually pretty cheap.
+ * wasted effort if we fail to update or have to put the new tuple on a
+ * different page. But we must compute the list before obtaining buffer
+ * lock --- in the worst case, if we are doing an update on one of the
+ * relevant system catalogs, we could deadlock if we try to fetch the list
+ * later. In any case, the relcache caches the data so this is usually
+ * pretty cheap.
*
- * Note that we get a copy here, so we need not worry about relcache
- * flush happening midway through.
+ * Note that we get a copy here, so we need not worry about relcache flush
+ * happening midway through.
*/
hot_attrs = RelationGetIndexAttrBitmap(relation);
@@ -2555,7 +2558,7 @@ l2:
{
/*
* Since the new tuple is going into the same page, we might be able
- * to do a HOT update. Check if any of the index columns have been
+ * to do a HOT update. Check if any of the index columns have been
* changed. If not, then HOT update is possible.
*/
if (HeapSatisfiesHOTUpdate(relation, hot_attrs, &oldtup, heaptup))
@@ -2573,14 +2576,14 @@ l2:
/*
* If this transaction commits, the old tuple will become DEAD sooner or
* later. Set flag that this page is a candidate for pruning once our xid
- * falls below the OldestXmin horizon. If the transaction finally aborts,
+ * falls below the OldestXmin horizon. If the transaction finally aborts,
* the subsequent page pruning will be a no-op and the hint will be
* cleared.
*
- * XXX Should we set hint on newbuf as well? If the transaction
- * aborts, there would be a prunable tuple in the newbuf; but for now
- * we choose not to optimize for aborts. Note that heap_xlog_update
- * must be kept in sync if this decision changes.
+ * XXX Should we set hint on newbuf as well? If the transaction aborts,
+ * there would be a prunable tuple in the newbuf; but for now we choose
+ * not to optimize for aborts. Note that heap_xlog_update must be kept in
+ * sync if this decision changes.
*/
PageSetPrunable(dp, xid);
@@ -2695,22 +2698,24 @@ static bool
heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
HeapTuple tup1, HeapTuple tup2)
{
- Datum value1, value2;
- bool isnull1, isnull2;
+ Datum value1,
+ value2;
+ bool isnull1,
+ isnull2;
Form_pg_attribute att;
/*
* If it's a whole-tuple reference, say "not equal". It's not really
- * worth supporting this case, since it could only succeed after a
- * no-op update, which is hardly a case worth optimizing for.
+ * worth supporting this case, since it could only succeed after a no-op
+ * update, which is hardly a case worth optimizing for.
*/
if (attrnum == 0)
return false;
/*
- * Likewise, automatically say "not equal" for any system attribute
- * other than OID and tableOID; we cannot expect these to be consistent
- * in a HOT chain, or even to be set correctly yet in the new tuple.
+ * Likewise, automatically say "not equal" for any system attribute other
+ * than OID and tableOID; we cannot expect these to be consistent in a HOT
+ * chain, or even to be set correctly yet in the new tuple.
*/
if (attrnum < 0)
{
@@ -2720,17 +2725,17 @@ heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
}
/*
- * Extract the corresponding values. XXX this is pretty inefficient
- * if there are many indexed columns. Should HeapSatisfiesHOTUpdate
- * do a single heap_deform_tuple call on each tuple, instead? But
- * that doesn't work for system columns ...
+ * Extract the corresponding values. XXX this is pretty inefficient if
+ * there are many indexed columns. Should HeapSatisfiesHOTUpdate do a
+ * single heap_deform_tuple call on each tuple, instead? But that doesn't
+ * work for system columns ...
*/
value1 = heap_getattr(tup1, attrnum, tupdesc, &isnull1);
value2 = heap_getattr(tup2, attrnum, tupdesc, &isnull2);
/*
- * If one value is NULL and other is not, then they are certainly
- * not equal
+ * If one value is NULL and other is not, then they are certainly not
+ * equal
*/
if (isnull1 != isnull2)
return false;
@@ -2744,7 +2749,7 @@ heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
/*
* We do simple binary comparison of the two datums. This may be overly
* strict because there can be multiple binary representations for the
- * same logical value. But we should be OK as long as there are no false
+ * same logical value. But we should be OK as long as there are no false
* positives. Using a type-specific equality operator is messy because
* there could be multiple notions of equality in different operator
* classes; furthermore, we cannot safely invoke user-defined functions
@@ -2758,7 +2763,7 @@ heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
else
{
Assert(attrnum <= tupdesc->natts);
- att = tupdesc->attrs[attrnum - 1];
+ att = tupdesc->attrs[attrnum - 1];
return datumIsEqual(value1, value2, att->attbyval, att->attlen);
}
}
@@ -2779,7 +2784,7 @@ static bool
HeapSatisfiesHOTUpdate(Relation relation, Bitmapset *hot_attrs,
HeapTuple oldtup, HeapTuple newtup)
{
- int attrnum;
+ int attrnum;
while ((attrnum = bms_first_member(hot_attrs)) >= 0)
{
@@ -3094,15 +3099,15 @@ l3:
}
/*
- * We might already hold the desired lock (or stronger), possibly under
- * a different subtransaction of the current top transaction. If so,
- * there is no need to change state or issue a WAL record. We already
- * handled the case where this is true for xmax being a MultiXactId,
- * so now check for cases where it is a plain TransactionId.
+ * We might already hold the desired lock (or stronger), possibly under a
+ * different subtransaction of the current top transaction. If so, there
+ * is no need to change state or issue a WAL record. We already handled
+ * the case where this is true for xmax being a MultiXactId, so now check
+ * for cases where it is a plain TransactionId.
*
* Note in particular that this covers the case where we already hold
- * exclusive lock on the tuple and the caller only wants shared lock.
- * It would certainly not do to give up the exclusive lock.
+ * exclusive lock on the tuple and the caller only wants shared lock. It
+ * would certainly not do to give up the exclusive lock.
*/
xmax = HeapTupleHeaderGetXmax(tuple->t_data);
old_infomask = tuple->t_data->t_infomask;
@@ -3179,8 +3184,8 @@ l3:
{
/*
* If the XMAX is a valid TransactionId, then we need to
- * create a new MultiXactId that includes both the old
- * locker and our own TransactionId.
+ * create a new MultiXactId that includes both the old locker
+ * and our own TransactionId.
*/
xid = MultiXactIdCreate(xmax, xid);
new_infomask |= HEAP_XMAX_IS_MULTI;
@@ -3214,8 +3219,8 @@ l3:
/*
* Store transaction information of xact locking the tuple.
*
- * Note: Cmax is meaningless in this context, so don't set it; this
- * avoids possibly generating a useless combo CID.
+ * Note: Cmax is meaningless in this context, so don't set it; this avoids
+ * possibly generating a useless combo CID.
*/
tuple->t_data->t_infomask = new_infomask;
HeapTupleHeaderClearHotUpdated(tuple->t_data);
@@ -3425,6 +3430,7 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
buf = InvalidBuffer;
}
HeapTupleHeaderSetXmin(tuple, FrozenTransactionId);
+
/*
* Might as well fix the hint bits too; usually XMIN_COMMITTED will
* already be set here, but there's a small chance not.
@@ -3437,9 +3443,9 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
/*
* When we release shared lock, it's possible for someone else to change
* xmax before we get the lock back, so repeat the check after acquiring
- * exclusive lock. (We don't need this pushup for xmin, because only
- * VACUUM could be interested in changing an existing tuple's xmin,
- * and there's only one VACUUM allowed on a table at a time.)
+ * exclusive lock. (We don't need this pushup for xmin, because only
+ * VACUUM could be interested in changing an existing tuple's xmin, and
+ * there's only one VACUUM allowed on a table at a time.)
*/
recheck_xmax:
if (!(tuple->t_infomask & HEAP_XMAX_IS_MULTI))
@@ -3454,13 +3460,14 @@ recheck_xmax:
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
buf = InvalidBuffer;
- goto recheck_xmax; /* see comment above */
+ goto recheck_xmax; /* see comment above */
}
HeapTupleHeaderSetXmax(tuple, InvalidTransactionId);
+
/*
- * The tuple might be marked either XMAX_INVALID or
- * XMAX_COMMITTED + LOCKED. Normalize to INVALID just to be
- * sure no one gets confused.
+ * The tuple might be marked either XMAX_INVALID or XMAX_COMMITTED
+ * + LOCKED. Normalize to INVALID just to be sure no one gets
+ * confused.
*/
tuple->t_infomask &= ~HEAP_XMAX_COMMITTED;
tuple->t_infomask |= HEAP_XMAX_INVALID;
@@ -3506,8 +3513,9 @@ recheck_xvac:
LockBuffer(buf, BUFFER_LOCK_UNLOCK);
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
buf = InvalidBuffer;
- goto recheck_xvac; /* see comment above */
+ goto recheck_xvac; /* see comment above */
}
+
/*
* If a MOVED_OFF tuple is not dead, the xvac transaction must
* have failed; whereas a non-dead MOVED_IN tuple must mean the
@@ -3517,9 +3525,10 @@ recheck_xvac:
HeapTupleHeaderSetXvac(tuple, InvalidTransactionId);
else
HeapTupleHeaderSetXvac(tuple, FrozenTransactionId);
+
/*
- * Might as well fix the hint bits too; usually XMIN_COMMITTED will
- * already be set here, but there's a small chance not.
+ * Might as well fix the hint bits too; usually XMIN_COMMITTED
+ * will already be set here, but there's a small chance not.
*/
Assert(!(tuple->t_infomask & HEAP_XMIN_INVALID));
tuple->t_infomask |= HEAP_XMIN_COMMITTED;
@@ -3632,8 +3641,8 @@ log_heap_clean(Relation reln, Buffer buffer,
/*
* The OffsetNumber arrays are not actually in the buffer, but we pretend
* that they are. When XLogInsert stores the whole buffer, the offset
- * arrays need not be stored too. Note that even if all three arrays
- * are empty, we want to expose the buffer as a candidate for whole-page
+ * arrays need not be stored too. Note that even if all three arrays are
+ * empty, we want to expose the buffer as a candidate for whole-page
* storage, since this record type implies a defragmentation operation
* even if no item pointers changed state.
*/
@@ -3686,7 +3695,7 @@ log_heap_clean(Relation reln, Buffer buffer,
}
/*
- * Perform XLogInsert for a heap-freeze operation. Caller must already
+ * Perform XLogInsert for a heap-freeze operation. Caller must already
* have modified the buffer and marked it dirty.
*/
XLogRecPtr
@@ -3711,9 +3720,9 @@ log_heap_freeze(Relation reln, Buffer buffer,
rdata[0].next = &(rdata[1]);
/*
- * The tuple-offsets array is not actually in the buffer, but pretend
- * that it is. When XLogInsert stores the whole buffer, the offsets array
- * need not be stored too.
+ * The tuple-offsets array is not actually in the buffer, but pretend that
+ * it is. When XLogInsert stores the whole buffer, the offsets array need
+ * not be stored too.
*/
if (offcnt > 0)
{
@@ -3853,7 +3862,7 @@ log_heap_move(Relation reln, Buffer oldbuf, ItemPointerData from,
* for writing the page to disk after calling this routine.
*
* Note: all current callers build pages in private memory and write them
- * directly to smgr, rather than using bufmgr. Therefore there is no need
+ * directly to smgr, rather than using bufmgr. Therefore there is no need
* to pass a buffer ID to XLogInsert, nor to perform MarkBufferDirty within
* the critical section.
*
@@ -3905,9 +3914,9 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move)
Page page;
OffsetNumber *offnum;
OffsetNumber *end;
- int nredirected;
- int ndead;
- int i;
+ int nredirected;
+ int ndead;
+ int i;
if (record->xl_info & XLR_BKP_BLOCK_1)
return;
@@ -3934,12 +3943,12 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move)
{
OffsetNumber fromoff = *offnum++;
OffsetNumber tooff = *offnum++;
- ItemId fromlp = PageGetItemId(page, fromoff);
+ ItemId fromlp = PageGetItemId(page, fromoff);
if (clean_move)
{
/* Physically move the "to" item to the "from" slot */
- ItemId tolp = PageGetItemId(page, tooff);
+ ItemId tolp = PageGetItemId(page, tooff);
HeapTupleHeader htup;
*fromlp = *tolp;
@@ -3962,7 +3971,7 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move)
for (i = 0; i < ndead; i++)
{
OffsetNumber off = *offnum++;
- ItemId lp = PageGetItemId(page, off);
+ ItemId lp = PageGetItemId(page, off);
ItemIdSetDead(lp);
}
@@ -3971,14 +3980,14 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move)
while (offnum < end)
{
OffsetNumber off = *offnum++;
- ItemId lp = PageGetItemId(page, off);
+ ItemId lp = PageGetItemId(page, off);
ItemIdSetUnused(lp);
}
/*
- * Finally, repair any fragmentation, and update the page's hint bit
- * about whether it has free pointers.
+ * Finally, repair any fragmentation, and update the page's hint bit about
+ * whether it has free pointers.
*/
PageRepairFragmentation(page);
@@ -4617,7 +4626,7 @@ heap_desc(StringInfo buf, uint8 xl_info, char *rec)
{
xl_heap_update *xlrec = (xl_heap_update *) rec;
- if (xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
+ if (xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
appendStringInfo(buf, "hot_update(init): ");
else
appendStringInfo(buf, "hot_update: ");
@@ -4724,7 +4733,7 @@ heap_sync(Relation rel)
/* toast heap, if any */
if (OidIsValid(rel->rd_rel->reltoastrelid))
{
- Relation toastrel;
+ Relation toastrel;
toastrel = heap_open(rel->rd_rel->reltoastrelid, AccessShareLock);
FlushRelationBuffers(toastrel);
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index 9723241547..067b23f24c 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.3 2007/10/24 13:05:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.4 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,21 +22,21 @@
/* Local functions */
-static int heap_prune_chain(Relation relation, Buffer buffer,
- OffsetNumber rootoffnum,
- TransactionId OldestXmin,
- OffsetNumber *redirected, int *nredirected,
- OffsetNumber *nowdead, int *ndead,
- OffsetNumber *nowunused, int *nunused,
- bool redirect_move);
+static int heap_prune_chain(Relation relation, Buffer buffer,
+ OffsetNumber rootoffnum,
+ TransactionId OldestXmin,
+ OffsetNumber *redirected, int *nredirected,
+ OffsetNumber *nowdead, int *ndead,
+ OffsetNumber *nowunused, int *nunused,
+ bool redirect_move);
static void heap_prune_record_redirect(OffsetNumber *redirected,
- int *nredirected,
- OffsetNumber offnum,
- OffsetNumber rdoffnum);
+ int *nredirected,
+ OffsetNumber offnum,
+ OffsetNumber rdoffnum);
static void heap_prune_record_dead(OffsetNumber *nowdead, int *ndead,
- OffsetNumber offnum);
+ OffsetNumber offnum);
static void heap_prune_record_unused(OffsetNumber *nowunused, int *nunused,
- OffsetNumber offnum);
+ OffsetNumber offnum);
/*
@@ -70,16 +70,16 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
return;
/*
- * We prune when a previous UPDATE failed to find enough space on the
- * page for a new tuple version, or when free space falls below the
- * relation's fill-factor target (but not less than 10%).
+ * We prune when a previous UPDATE failed to find enough space on the page
+ * for a new tuple version, or when free space falls below the relation's
+ * fill-factor target (but not less than 10%).
*
- * Checking free space here is questionable since we aren't holding
- * any lock on the buffer; in the worst case we could get a bogus
- * answer. It's unlikely to be *seriously* wrong, though, since
- * reading either pd_lower or pd_upper is probably atomic. Avoiding
- * taking a lock seems better than sometimes getting a wrong answer
- * in what is after all just a heuristic estimate.
+ * Checking free space here is questionable since we aren't holding any
+ * lock on the buffer; in the worst case we could get a bogus answer.
+ * It's unlikely to be *seriously* wrong, though, since reading either
+ * pd_lower or pd_upper is probably atomic. Avoiding taking a lock seems
+ * better than sometimes getting a wrong answer in what is after all just
+ * a heuristic estimate.
*/
minfree = RelationGetTargetPageFreeSpace(relation,
HEAP_DEFAULT_FILLFACTOR);
@@ -93,9 +93,9 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
/*
* Now that we have buffer lock, get accurate information about the
- * page's free space, and recheck the heuristic about whether to prune.
- * (We needn't recheck PageIsPrunable, since no one else could have
- * pruned while we hold pin.)
+ * page's free space, and recheck the heuristic about whether to
+ * prune. (We needn't recheck PageIsPrunable, since no one else could
+ * have pruned while we hold pin.)
*/
if (PageIsFull(dp) || PageGetHeapFreeSpace((Page) dp) < minfree)
{
@@ -119,7 +119,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
*
* If redirect_move is set, we remove redirecting line pointers by
* updating the root line pointer to point directly to the first non-dead
- * tuple in the chain. NOTE: eliminating the redirect changes the first
+ * tuple in the chain. NOTE: eliminating the redirect changes the first
* tuple's effective CTID, and is therefore unsafe except within VACUUM FULL.
* The only reason we support this capability at all is that by using it,
* VACUUM FULL need not cope with LP_REDIRECT items at all; which seems a
@@ -136,18 +136,18 @@ int
heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
bool redirect_move, bool report_stats)
{
- int ndeleted = 0;
- Page page = BufferGetPage(buffer);
- OffsetNumber offnum,
- maxoff;
- OffsetNumber redirected[MaxHeapTuplesPerPage * 2];
- OffsetNumber nowdead[MaxHeapTuplesPerPage];
- OffsetNumber nowunused[MaxHeapTuplesPerPage];
- int nredirected = 0;
- int ndead = 0;
- int nunused = 0;
- bool page_was_full = false;
- TransactionId save_prune_xid;
+ int ndeleted = 0;
+ Page page = BufferGetPage(buffer);
+ OffsetNumber offnum,
+ maxoff;
+ OffsetNumber redirected[MaxHeapTuplesPerPage * 2];
+ OffsetNumber nowdead[MaxHeapTuplesPerPage];
+ OffsetNumber nowunused[MaxHeapTuplesPerPage];
+ int nredirected = 0;
+ int ndead = 0;
+ int nunused = 0;
+ bool page_was_full = false;
+ TransactionId save_prune_xid;
START_CRIT_SECTION();
@@ -159,7 +159,7 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
save_prune_xid = ((PageHeader) page)->pd_prune_xid;
PageClearPrunable(page);
- /*
+ /*
* Also clear the "page is full" flag if it is set, since there's no point
* in repeating the prune/defrag process until something else happens to
* the page.
@@ -176,7 +176,7 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
- ItemId itemid = PageGetItemId(page, offnum);
+ ItemId itemid = PageGetItemId(page, offnum);
/* Nothing to do if slot is empty or already dead */
if (!ItemIdIsUsed(itemid) || ItemIdIsDead(itemid))
@@ -233,9 +233,9 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
END_CRIT_SECTION();
/*
- * If requested, report the number of tuples reclaimed to pgstats.
- * This is ndeleted minus ndead, because we don't want to count a now-DEAD
- * root item as a deletion for this purpose.
+ * If requested, report the number of tuples reclaimed to pgstats. This is
+ * ndeleted minus ndead, because we don't want to count a now-DEAD root
+ * item as a deletion for this purpose.
*/
if (report_stats && ndeleted > ndead)
pgstat_update_heap_dead_tuples(relation, ndeleted - ndead);
@@ -243,19 +243,17 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
/*
* XXX Should we update the FSM information of this page ?
*
- * There are two schools of thought here. We may not want to update
- * FSM information so that the page is not used for unrelated
- * UPDATEs/INSERTs and any free space in this page will remain
- * available for further UPDATEs in *this* page, thus improving
- * chances for doing HOT updates.
+ * There are two schools of thought here. We may not want to update FSM
+ * information so that the page is not used for unrelated UPDATEs/INSERTs
+ * and any free space in this page will remain available for further
+ * UPDATEs in *this* page, thus improving chances for doing HOT updates.
*
- * But for a large table and where a page does not receive further
- * UPDATEs for a long time, we might waste this space by not
- * updating the FSM information. The relation may get extended and
- * fragmented further.
+ * But for a large table and where a page does not receive further UPDATEs
+ * for a long time, we might waste this space by not updating the FSM
+ * information. The relation may get extended and fragmented further.
*
- * One possibility is to leave "fillfactor" worth of space in this
- * page and update FSM with the remaining space.
+ * One possibility is to leave "fillfactor" worth of space in this page
+ * and update FSM with the remaining space.
*
* In any case, the current FSM implementation doesn't accept
* one-page-at-a-time updates, so this is all academic for now.
@@ -298,17 +296,17 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
OffsetNumber *nowunused, int *nunused,
bool redirect_move)
{
- int ndeleted = 0;
- Page dp = (Page) BufferGetPage(buffer);
- TransactionId priorXmax = InvalidTransactionId;
- ItemId rootlp;
- HeapTupleHeader htup;
- OffsetNumber latestdead = InvalidOffsetNumber,
- maxoff = PageGetMaxOffsetNumber(dp),
- offnum;
- OffsetNumber chainitems[MaxHeapTuplesPerPage];
- int nchain = 0,
- i;
+ int ndeleted = 0;
+ Page dp = (Page) BufferGetPage(buffer);
+ TransactionId priorXmax = InvalidTransactionId;
+ ItemId rootlp;
+ HeapTupleHeader htup;
+ OffsetNumber latestdead = InvalidOffsetNumber,
+ maxoff = PageGetMaxOffsetNumber(dp),
+ offnum;
+ OffsetNumber chainitems[MaxHeapTuplesPerPage];
+ int nchain = 0,
+ i;
rootlp = PageGetItemId(dp, rootoffnum);
@@ -321,14 +319,14 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
if (HeapTupleHeaderIsHeapOnly(htup))
{
/*
- * If the tuple is DEAD and doesn't chain to anything else, mark it
- * unused immediately. (If it does chain, we can only remove it as
- * part of pruning its chain.)
+ * If the tuple is DEAD and doesn't chain to anything else, mark
+ * it unused immediately. (If it does chain, we can only remove
+ * it as part of pruning its chain.)
*
* We need this primarily to handle aborted HOT updates, that is,
- * XMIN_INVALID heap-only tuples. Those might not be linked to
- * by any chain, since the parent tuple might be re-updated before
- * any pruning occurs. So we have to be able to reap them
+ * XMIN_INVALID heap-only tuples. Those might not be linked to by
+ * any chain, since the parent tuple might be re-updated before
+ * any pruning occurs. So we have to be able to reap them
* separately from chain-pruning.
*
* Note that we might first arrive at a dead heap-only tuple
@@ -354,9 +352,9 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
/* while not end of the chain */
for (;;)
{
- ItemId lp;
- bool tupdead,
- recent_dead;
+ ItemId lp;
+ bool tupdead,
+ recent_dead;
/* Some sanity checks */
if (offnum < FirstOffsetNumber || offnum > maxoff)
@@ -368,9 +366,9 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
break;
/*
- * If we are looking at the redirected root line pointer,
- * jump to the first normal tuple in the chain. If we find
- * a redirect somewhere else, stop --- it must not be same chain.
+ * If we are looking at the redirected root line pointer, jump to the
+ * first normal tuple in the chain. If we find a redirect somewhere
+ * else, stop --- it must not be same chain.
*/
if (ItemIdIsRedirected(lp))
{
@@ -382,9 +380,9 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
}
/*
- * Likewise, a dead item pointer can't be part of the chain.
- * (We already eliminated the case of dead root tuple outside
- * this function.)
+ * Likewise, a dead item pointer can't be part of the chain. (We
+ * already eliminated the case of dead root tuple outside this
+ * function.)
*/
if (ItemIdIsDead(lp))
break;
@@ -417,6 +415,7 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
case HEAPTUPLE_RECENTLY_DEAD:
recent_dead = true;
+
/*
* This tuple may soon become DEAD. Update the hint field so
* that the page is reconsidered for pruning in future.
@@ -425,6 +424,7 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
break;
case HEAPTUPLE_DELETE_IN_PROGRESS:
+
/*
* This tuple may soon become DEAD. Update the hint field so
* that the page is reconsidered for pruning in future.
@@ -434,11 +434,12 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
case HEAPTUPLE_LIVE:
case HEAPTUPLE_INSERT_IN_PROGRESS:
+
/*
* If we wanted to optimize for aborts, we might consider
* marking the page prunable when we see INSERT_IN_PROGRESS.
- * But we don't. See related decisions about when to mark
- * the page prunable in heapam.c.
+ * But we don't. See related decisions about when to mark the
+ * page prunable in heapam.c.
*/
break;
@@ -486,12 +487,12 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
* Mark as unused each intermediate item that we are able to remove
* from the chain.
*
- * When the previous item is the last dead tuple seen, we are at
- * the right candidate for redirection.
+ * When the previous item is the last dead tuple seen, we are at the
+ * right candidate for redirection.
*/
for (i = 1; (i < nchain) && (chainitems[i - 1] != latestdead); i++)
{
- ItemId lp = PageGetItemId(dp, chainitems[i]);
+ ItemId lp = PageGetItemId(dp, chainitems[i]);
ItemIdSetUnused(lp);
heap_prune_record_unused(nowunused, nunused, chainitems[i]);
@@ -499,17 +500,17 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
}
/*
- * If the root entry had been a normal tuple, we are deleting it,
- * so count it in the result. But changing a redirect (even to
- * DEAD state) doesn't count.
+ * If the root entry had been a normal tuple, we are deleting it, so
+ * count it in the result. But changing a redirect (even to DEAD
+ * state) doesn't count.
*/
if (ItemIdIsNormal(rootlp))
ndeleted++;
/*
* If the DEAD tuple is at the end of the chain, the entire chain is
- * dead and the root line pointer can be marked dead. Otherwise
- * just redirect the root to the correct chain member.
+ * dead and the root line pointer can be marked dead. Otherwise just
+ * redirect the root to the correct chain member.
*/
if (i >= nchain)
{
@@ -528,25 +529,25 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
{
/*
* We found a redirect item that doesn't point to a valid follow-on
- * item. This can happen if the loop in heap_page_prune caused us
- * to visit the dead successor of a redirect item before visiting
- * the redirect item. We can clean up by setting the redirect item
- * to DEAD state.
+ * item. This can happen if the loop in heap_page_prune caused us to
+ * visit the dead successor of a redirect item before visiting the
+ * redirect item. We can clean up by setting the redirect item to
+ * DEAD state.
*/
ItemIdSetDead(rootlp);
heap_prune_record_dead(nowdead, ndead, rootoffnum);
}
/*
- * If requested, eliminate LP_REDIRECT items by moving tuples. Note that
+ * If requested, eliminate LP_REDIRECT items by moving tuples. Note that
* if the root item is LP_REDIRECT and doesn't point to a valid follow-on
* item, we already killed it above.
*/
if (redirect_move && ItemIdIsRedirected(rootlp))
{
OffsetNumber firstoffnum = ItemIdGetRedirect(rootlp);
- ItemId firstlp = PageGetItemId(dp, firstoffnum);
- HeapTupleData firsttup;
+ ItemId firstlp = PageGetItemId(dp, firstoffnum);
+ HeapTupleData firsttup;
Assert(ItemIdIsNormal(firstlp));
/* Set up firsttup to reference the tuple at its existing CTID */
@@ -558,15 +559,15 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
firsttup.t_tableOid = RelationGetRelid(relation);
/*
- * Mark the tuple for invalidation. Needed because we're changing
- * its CTID.
+ * Mark the tuple for invalidation. Needed because we're changing its
+ * CTID.
*/
CacheInvalidateHeapTuple(relation, &firsttup);
/*
- * Change heap-only status of the tuple because after the line
- * pointer manipulation, it's no longer a heap-only tuple, but is
- * directly pointed to by index entries.
+ * Change heap-only status of the tuple because after the line pointer
+ * manipulation, it's no longer a heap-only tuple, but is directly
+ * pointed to by index entries.
*/
Assert(HeapTupleIsHeapOnly(&firsttup));
HeapTupleClearHeapOnly(&firsttup);
@@ -594,7 +595,7 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
/* Record newly-redirected item pointer */
static void
heap_prune_record_redirect(OffsetNumber *redirected, int *nredirected,
- OffsetNumber offnum, OffsetNumber rdoffnum)
+ OffsetNumber offnum, OffsetNumber rdoffnum)
{
Assert(*nredirected < MaxHeapTuplesPerPage);
redirected[*nredirected * 2] = offnum;
@@ -641,17 +642,18 @@ heap_prune_record_unused(OffsetNumber *nowunused, int *nunused,
void
heap_get_root_tuples(Page page, OffsetNumber *root_offsets)
{
- OffsetNumber offnum, maxoff;
+ OffsetNumber offnum,
+ maxoff;
MemSet(root_offsets, 0, MaxHeapTuplesPerPage * sizeof(OffsetNumber));
maxoff = PageGetMaxOffsetNumber(page);
for (offnum = FirstOffsetNumber; offnum <= maxoff; offnum++)
{
- ItemId lp = PageGetItemId(page, offnum);
- HeapTupleHeader htup;
- OffsetNumber nextoffnum;
- TransactionId priorXmax;
+ ItemId lp = PageGetItemId(page, offnum);
+ HeapTupleHeader htup;
+ OffsetNumber nextoffnum;
+ TransactionId priorXmax;
/* skip unused and dead items */
if (!ItemIdIsUsed(lp) || ItemIdIsDead(lp))
diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c
index e8c5eec50a..20c5938ff2 100644
--- a/src/backend/access/heap/rewriteheap.c
+++ b/src/backend/access/heap/rewriteheap.c
@@ -10,7 +10,7 @@
*
* The caller is responsible for creating the new heap, all catalog
* changes, supplying the tuples to be written to the new heap, and
- * rebuilding indexes. The caller must hold AccessExclusiveLock on the
+ * rebuilding indexes. The caller must hold AccessExclusiveLock on the
* target table, because we assume no one else is writing into it.
*
* To use the facility:
@@ -18,13 +18,13 @@
* begin_heap_rewrite
* while (fetch next tuple)
* {
- * if (tuple is dead)
- * rewrite_heap_dead_tuple
- * else
- * {
- * // do any transformations here if required
- * rewrite_heap_tuple
- * }
+ * if (tuple is dead)
+ * rewrite_heap_dead_tuple
+ * else
+ * {
+ * // do any transformations here if required
+ * rewrite_heap_tuple
+ * }
* }
* end_heap_rewrite
*
@@ -43,7 +43,7 @@
* to substitute the correct ctid instead.
*
* For each ctid reference from A -> B, we might encounter either A first
- * or B first. (Note that a tuple in the middle of a chain is both A and B
+ * or B first. (Note that a tuple in the middle of a chain is both A and B
* of different pairs.)
*
* If we encounter A first, we'll store the tuple in the unresolved_tups
@@ -58,11 +58,11 @@
* and can write A immediately with the correct ctid.
*
* Entries in the hash tables can be removed as soon as the later tuple
- * is encountered. That helps to keep the memory usage down. At the end,
+ * is encountered. That helps to keep the memory usage down. At the end,
* both tables are usually empty; we should have encountered both A and B
* of each pair. However, it's possible for A to be RECENTLY_DEAD and B
* entirely DEAD according to HeapTupleSatisfiesVacuum, because the test
- * for deadness using OldestXmin is not exact. In such a case we might
+ * for deadness using OldestXmin is not exact. In such a case we might
* encounter B first, and skip it, and find A later. Then A would be added
* to unresolved_tups, and stay there until end of the rewrite. Since
* this case is very unusual, we don't worry about the memory usage.
@@ -78,7 +78,7 @@
* of CLUSTERing on an unchanging key column, we'll see all the versions
* of a given tuple together anyway, and so the peak memory usage is only
* proportional to the number of RECENTLY_DEAD versions of a single row, not
- * in the whole table. Note that if we do fail halfway through a CLUSTER,
+ * in the whole table. Note that if we do fail halfway through a CLUSTER,
* the old table is still valid, so failure is not catastrophic.
*
* We can't use the normal heap_insert function to insert into the new
@@ -96,7 +96,7 @@
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/rewriteheap.c,v 1.7 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/rewriteheap.c,v 1.8 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,20 +116,20 @@
*/
typedef struct RewriteStateData
{
- Relation rs_new_rel; /* destination heap */
- Page rs_buffer; /* page currently being built */
- BlockNumber rs_blockno; /* block where page will go */
- bool rs_buffer_valid; /* T if any tuples in buffer */
- bool rs_use_wal; /* must we WAL-log inserts? */
- TransactionId rs_oldest_xmin; /* oldest xmin used by caller to
+ Relation rs_new_rel; /* destination heap */
+ Page rs_buffer; /* page currently being built */
+ BlockNumber rs_blockno; /* block where page will go */
+ bool rs_buffer_valid; /* T if any tuples in buffer */
+ bool rs_use_wal; /* must we WAL-log inserts? */
+ TransactionId rs_oldest_xmin; /* oldest xmin used by caller to
* determine tuple visibility */
- TransactionId rs_freeze_xid; /* Xid that will be used as freeze
- * cutoff point */
- MemoryContext rs_cxt; /* for hash tables and entries and
- * tuples in them */
- HTAB *rs_unresolved_tups; /* unmatched A tuples */
- HTAB *rs_old_new_tid_map; /* unmatched B tuples */
-} RewriteStateData;
+ TransactionId rs_freeze_xid;/* Xid that will be used as freeze cutoff
+ * point */
+ MemoryContext rs_cxt; /* for hash tables and entries and tuples in
+ * them */
+ HTAB *rs_unresolved_tups; /* unmatched A tuples */
+ HTAB *rs_old_new_tid_map; /* unmatched B tuples */
+} RewriteStateData;
/*
* The lookup keys for the hash tables are tuple TID and xmin (we must check
@@ -139,27 +139,27 @@ typedef struct RewriteStateData
*/
typedef struct
{
- TransactionId xmin; /* tuple xmin */
+ TransactionId xmin; /* tuple xmin */
ItemPointerData tid; /* tuple location in old heap */
-} TidHashKey;
+} TidHashKey;
/*
* Entry structures for the hash tables
*/
typedef struct
{
- TidHashKey key; /* expected xmin/old location of B tuple */
+ TidHashKey key; /* expected xmin/old location of B tuple */
ItemPointerData old_tid; /* A's location in the old heap */
- HeapTuple tuple; /* A's tuple contents */
-} UnresolvedTupData;
+ HeapTuple tuple; /* A's tuple contents */
+} UnresolvedTupData;
typedef UnresolvedTupData *UnresolvedTup;
typedef struct
{
- TidHashKey key; /* actual xmin/old location of B tuple */
+ TidHashKey key; /* actual xmin/old location of B tuple */
ItemPointerData new_tid; /* where we put it in the new heap */
-} OldToNewMappingData;
+} OldToNewMappingData;
typedef OldToNewMappingData *OldToNewMapping;
@@ -189,8 +189,8 @@ begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
HASHCTL hash_ctl;
/*
- * To ease cleanup, make a separate context that will contain
- * the RewriteState struct itself plus all subsidiary data.
+ * To ease cleanup, make a separate context that will contain the
+ * RewriteState struct itself plus all subsidiary data.
*/
rw_cxt = AllocSetContextCreate(CurrentMemoryContext,
"Table rewrite",
@@ -221,7 +221,7 @@ begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
state->rs_unresolved_tups =
hash_create("Rewrite / Unresolved ctids",
- 128, /* arbitrary initial size */
+ 128, /* arbitrary initial size */
&hash_ctl,
HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
@@ -229,7 +229,7 @@ begin_heap_rewrite(Relation new_heap, TransactionId oldest_xmin,
state->rs_old_new_tid_map =
hash_create("Rewrite / Old to new tid map",
- 128, /* arbitrary initial size */
+ 128, /* arbitrary initial size */
&hash_ctl,
HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
@@ -250,8 +250,8 @@ end_heap_rewrite(RewriteState state)
UnresolvedTup unresolved;
/*
- * Write any remaining tuples in the UnresolvedTups table. If we have
- * any left, they should in fact be dead, but let's err on the safe side.
+ * Write any remaining tuples in the UnresolvedTups table. If we have any
+ * left, they should in fact be dead, but let's err on the safe side.
*
* XXX this really is a waste of code no?
*/
@@ -276,15 +276,15 @@ end_heap_rewrite(RewriteState state)
}
/*
- * If the rel isn't temp, must fsync before commit. We use heap_sync
- * to ensure that the toast table gets fsync'd too.
+ * If the rel isn't temp, must fsync before commit. We use heap_sync to
+ * ensure that the toast table gets fsync'd too.
*
* It's obvious that we must do this when not WAL-logging. It's less
- * obvious that we have to do it even if we did WAL-log the pages.
- * The reason is the same as in tablecmds.c's copy_relation_data():
- * we're writing data that's not in shared buffers, and so a CHECKPOINT
- * occurring during the rewriteheap operation won't have fsync'd data
- * we wrote before the checkpoint.
+ * obvious that we have to do it even if we did WAL-log the pages. The
+ * reason is the same as in tablecmds.c's copy_relation_data(): we're
+ * writing data that's not in shared buffers, and so a CHECKPOINT
+ * occurring during the rewriteheap operation won't have fsync'd data we
+ * wrote before the checkpoint.
*/
if (!state->rs_new_rel->rd_istemp)
heap_sync(state->rs_new_rel);
@@ -310,17 +310,17 @@ rewrite_heap_tuple(RewriteState state,
{
MemoryContext old_cxt;
ItemPointerData old_tid;
- TidHashKey hashkey;
- bool found;
- bool free_new;
+ TidHashKey hashkey;
+ bool found;
+ bool free_new;
old_cxt = MemoryContextSwitchTo(state->rs_cxt);
/*
* Copy the original tuple's visibility information into new_tuple.
*
- * XXX we might later need to copy some t_infomask2 bits, too?
- * Right now, we intentionally clear the HOT status bits.
+ * XXX we might later need to copy some t_infomask2 bits, too? Right now,
+ * we intentionally clear the HOT status bits.
*/
memcpy(&new_tuple->t_data->t_choice.t_heap,
&old_tuple->t_data->t_choice.t_heap,
@@ -335,16 +335,16 @@ rewrite_heap_tuple(RewriteState state,
* While we have our hands on the tuple, we may as well freeze any
* very-old xmin or xmax, so that future VACUUM effort can be saved.
*
- * Note we abuse heap_freeze_tuple() a bit here, since it's expecting
- * to be given a pointer to a tuple in a disk buffer. It happens
- * though that we can get the right things to happen by passing
- * InvalidBuffer for the buffer.
+ * Note we abuse heap_freeze_tuple() a bit here, since it's expecting to
+ * be given a pointer to a tuple in a disk buffer. It happens though that
+ * we can get the right things to happen by passing InvalidBuffer for the
+ * buffer.
*/
heap_freeze_tuple(new_tuple->t_data, state->rs_freeze_xid, InvalidBuffer);
/*
- * Invalid ctid means that ctid should point to the tuple itself.
- * We'll override it later if the tuple is part of an update chain.
+ * Invalid ctid means that ctid should point to the tuple itself. We'll
+ * override it later if the tuple is part of an update chain.
*/
ItemPointerSetInvalid(&new_tuple->t_data->t_ctid);
@@ -369,9 +369,9 @@ rewrite_heap_tuple(RewriteState state,
if (mapping != NULL)
{
/*
- * We've already copied the tuple that t_ctid points to, so we
- * can set the ctid of this tuple to point to the new location,
- * and insert it right away.
+ * We've already copied the tuple that t_ctid points to, so we can
+ * set the ctid of this tuple to point to the new location, and
+ * insert it right away.
*/
new_tuple->t_data->t_ctid = mapping->new_tid;
@@ -405,10 +405,10 @@ rewrite_heap_tuple(RewriteState state,
}
/*
- * Now we will write the tuple, and then check to see if it is the
- * B tuple in any new or known pair. When we resolve a known pair,
- * we will be able to write that pair's A tuple, and then we have to
- * check if it resolves some other pair. Hence, we need a loop here.
+ * Now we will write the tuple, and then check to see if it is the B tuple
+ * in any new or known pair. When we resolve a known pair, we will be
+ * able to write that pair's A tuple, and then we have to check if it
+ * resolves some other pair. Hence, we need a loop here.
*/
old_tid = old_tuple->t_self;
free_new = false;
@@ -422,13 +422,12 @@ rewrite_heap_tuple(RewriteState state,
new_tid = new_tuple->t_self;
/*
- * If the tuple is the updated version of a row, and the prior
- * version wouldn't be DEAD yet, then we need to either resolve
- * the prior version (if it's waiting in rs_unresolved_tups),
- * or make an entry in rs_old_new_tid_map (so we can resolve it
- * when we do see it). The previous tuple's xmax would equal this
- * one's xmin, so it's RECENTLY_DEAD if and only if the xmin is
- * not before OldestXmin.
+ * If the tuple is the updated version of a row, and the prior version
+ * wouldn't be DEAD yet, then we need to either resolve the prior
+ * version (if it's waiting in rs_unresolved_tups), or make an entry
+ * in rs_old_new_tid_map (so we can resolve it when we do see it).
+ * The previous tuple's xmax would equal this one's xmin, so it's
+ * RECENTLY_DEAD if and only if the xmin is not before OldestXmin.
*/
if ((new_tuple->t_data->t_infomask & HEAP_UPDATED) &&
!TransactionIdPrecedes(HeapTupleHeaderGetXmin(new_tuple->t_data),
@@ -449,9 +448,9 @@ rewrite_heap_tuple(RewriteState state,
if (unresolved != NULL)
{
/*
- * We have seen and memorized the previous tuple already.
- * Now that we know where we inserted the tuple its t_ctid
- * points to, fix its t_ctid and insert it to the new heap.
+ * We have seen and memorized the previous tuple already. Now
+ * that we know where we inserted the tuple its t_ctid points
+ * to, fix its t_ctid and insert it to the new heap.
*/
if (free_new)
heap_freetuple(new_tuple);
@@ -461,8 +460,8 @@ rewrite_heap_tuple(RewriteState state,
new_tuple->t_data->t_ctid = new_tid;
/*
- * We don't need the hash entry anymore, but don't free
- * its tuple just yet.
+ * We don't need the hash entry anymore, but don't free its
+ * tuple just yet.
*/
hash_search(state->rs_unresolved_tups, &hashkey,
HASH_REMOVE, &found);
@@ -474,8 +473,8 @@ rewrite_heap_tuple(RewriteState state,
else
{
/*
- * Remember the new tid of this tuple. We'll use it to set
- * the ctid when we find the previous tuple in the chain.
+ * Remember the new tid of this tuple. We'll use it to set the
+ * ctid when we find the previous tuple in the chain.
*/
OldToNewMapping mapping;
@@ -506,22 +505,22 @@ rewrite_heap_dead_tuple(RewriteState state, HeapTuple old_tuple)
{
/*
* If we have already seen an earlier tuple in the update chain that
- * points to this tuple, let's forget about that earlier tuple. It's
- * in fact dead as well, our simple xmax < OldestXmin test in
- * HeapTupleSatisfiesVacuum just wasn't enough to detect it. It
- * happens when xmin of a tuple is greater than xmax, which sounds
+ * points to this tuple, let's forget about that earlier tuple. It's in
+ * fact dead as well, our simple xmax < OldestXmin test in
+ * HeapTupleSatisfiesVacuum just wasn't enough to detect it. It happens
+ * when xmin of a tuple is greater than xmax, which sounds
* counter-intuitive but is perfectly valid.
*
- * We don't bother to try to detect the situation the other way
- * round, when we encounter the dead tuple first and then the
- * recently dead one that points to it. If that happens, we'll
- * have some unmatched entries in the UnresolvedTups hash table
- * at the end. That can happen anyway, because a vacuum might
- * have removed the dead tuple in the chain before us.
+ * We don't bother to try to detect the situation the other way round,
+ * when we encounter the dead tuple first and then the recently dead one
+ * that points to it. If that happens, we'll have some unmatched entries
+ * in the UnresolvedTups hash table at the end. That can happen anyway,
+ * because a vacuum might have removed the dead tuple in the chain before
+ * us.
*/
UnresolvedTup unresolved;
- TidHashKey hashkey;
- bool found;
+ TidHashKey hashkey;
+ bool found;
memset(&hashkey, 0, sizeof(hashkey));
hashkey.xmin = HeapTupleHeaderGetXmin(old_tuple->t_data);
@@ -541,7 +540,7 @@ rewrite_heap_dead_tuple(RewriteState state, HeapTuple old_tuple)
}
/*
- * Insert a tuple to the new relation. This has to track heap_insert
+ * Insert a tuple to the new relation. This has to track heap_insert
* and its subsidiary functions!
*
* t_self of the tuple is set to the new TID of the tuple. If t_ctid of the
@@ -551,11 +550,12 @@ rewrite_heap_dead_tuple(RewriteState state, HeapTuple old_tuple)
static void
raw_heap_insert(RewriteState state, HeapTuple tup)
{
- Page page = state->rs_buffer;
- Size pageFreeSpace, saveFreeSpace;
- Size len;
- OffsetNumber newoff;
- HeapTuple heaptup;
+ Page page = state->rs_buffer;
+ Size pageFreeSpace,
+ saveFreeSpace;
+ Size len;
+ OffsetNumber newoff;
+ HeapTuple heaptup;
/*
* If the new tuple is too big for storage or contains already toasted
@@ -610,7 +610,8 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
/*
* Now write the page. We say isTemp = true even if it's not a
* temp table, because there's no need for smgr to schedule an
- * fsync for this write; we'll do it ourselves in end_heap_rewrite.
+ * fsync for this write; we'll do it ourselves in
+ * end_heap_rewrite.
*/
RelationOpenSmgr(state->rs_new_rel);
smgrextend(state->rs_new_rel->rd_smgr, state->rs_blockno,
@@ -638,12 +639,12 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
ItemPointerSet(&(tup->t_self), state->rs_blockno, newoff);
/*
- * Insert the correct position into CTID of the stored tuple, too,
- * if the caller didn't supply a valid CTID.
+ * Insert the correct position into CTID of the stored tuple, too, if the
+ * caller didn't supply a valid CTID.
*/
- if(!ItemPointerIsValid(&tup->t_data->t_ctid))
+ if (!ItemPointerIsValid(&tup->t_data->t_ctid))
{
- ItemId newitemid;
+ ItemId newitemid;
HeapTupleHeader onpage_tup;
newitemid = PageGetItemId(page, newoff);
diff --git a/src/backend/access/heap/syncscan.c b/src/backend/access/heap/syncscan.c
index 795efccc09..7b0653c9ba 100644
--- a/src/backend/access/heap/syncscan.c
+++ b/src/backend/access/heap/syncscan.c
@@ -4,7 +4,7 @@
* heap scan synchronization support
*
* When multiple backends run a sequential scan on the same table, we try
- * to keep them synchronized to reduce the overall I/O needed. The goal is
+ * to keep them synchronized to reduce the overall I/O needed. The goal is
* to read each page into shared buffer cache only once, and let all backends
* that take part in the shared scan process the page before it falls out of
* the cache.
@@ -26,7 +26,7 @@
* don't want such queries to slow down others.
*
* There can realistically only be a few large sequential scans on different
- * tables in progress at any time. Therefore we just keep the scan positions
+ * tables in progress at any time. Therefore we just keep the scan positions
* in a small LRU list which we scan every time we need to look up or update a
* scan position. The whole mechanism is only applied for tables exceeding
* a threshold size (but that is not the concern of this module).
@@ -40,7 +40,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/syncscan.c,v 1.1 2007/06/08 18:23:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/syncscan.c,v 1.2 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,7 +52,7 @@
/* GUC variables */
#ifdef TRACE_SYNCSCAN
-bool trace_syncscan = false;
+bool trace_syncscan = false;
#endif
@@ -89,21 +89,21 @@ typedef struct ss_scan_location_t
{
RelFileNode relfilenode; /* identity of a relation */
BlockNumber location; /* last-reported location in the relation */
-} ss_scan_location_t;
+} ss_scan_location_t;
typedef struct ss_lru_item_t
{
- struct ss_lru_item_t *prev;
- struct ss_lru_item_t *next;
- ss_scan_location_t location;
-} ss_lru_item_t;
+ struct ss_lru_item_t *prev;
+ struct ss_lru_item_t *next;
+ ss_scan_location_t location;
+} ss_lru_item_t;
typedef struct ss_scan_locations_t
{
- ss_lru_item_t *head;
- ss_lru_item_t *tail;
- ss_lru_item_t items[1]; /* SYNC_SCAN_NELEM items */
-} ss_scan_locations_t;
+ ss_lru_item_t *head;
+ ss_lru_item_t *tail;
+ ss_lru_item_t items[1]; /* SYNC_SCAN_NELEM items */
+} ss_scan_locations_t;
#define SizeOfScanLocations(N) offsetof(ss_scan_locations_t, items[N])
@@ -112,7 +112,7 @@ static ss_scan_locations_t *scan_locations;
/* prototypes for internal functions */
static BlockNumber ss_search(RelFileNode relfilenode,
- BlockNumber location, bool set);
+ BlockNumber location, bool set);
/*
@@ -130,8 +130,8 @@ SyncScanShmemSize(void)
void
SyncScanShmemInit(void)
{
- int i;
- bool found;
+ int i;
+ bool found;
scan_locations = (ss_scan_locations_t *)
ShmemInitStruct("Sync Scan Locations List",
@@ -186,20 +186,20 @@ SyncScanShmemInit(void)
static BlockNumber
ss_search(RelFileNode relfilenode, BlockNumber location, bool set)
{
- ss_lru_item_t *item;
+ ss_lru_item_t *item;
item = scan_locations->head;
for (;;)
{
- bool match;
+ bool match;
match = RelFileNodeEquals(item->location.relfilenode, relfilenode);
if (match || item->next == NULL)
{
/*
- * If we reached the end of list and no match was found,
- * take over the last entry
+ * If we reached the end of list and no match was found, take over
+ * the last entry
*/
if (!match)
{
@@ -242,7 +242,7 @@ ss_search(RelFileNode relfilenode, BlockNumber location, bool set)
* relation, or 0 if no valid location is found.
*
* We expect the caller has just done RelationGetNumberOfBlocks(), and
- * so that number is passed in rather than computing it again. The result
+ * so that number is passed in rather than computing it again. The result
* is guaranteed less than relnblocks (assuming that's > 0).
*/
BlockNumber
@@ -257,8 +257,8 @@ ss_get_location(Relation rel, BlockNumber relnblocks)
/*
* If the location is not a valid block number for this scan, start at 0.
*
- * This can happen if for instance a VACUUM truncated the table
- * since the location was saved.
+ * This can happen if for instance a VACUUM truncated the table since the
+ * location was saved.
*/
if (startloc >= relnblocks)
startloc = 0;
@@ -294,12 +294,12 @@ ss_report_location(Relation rel, BlockNumber location)
#endif
/*
- * To reduce lock contention, only report scan progress every N pages.
- * For the same reason, don't block if the lock isn't immediately
- * available. Missing a few updates isn't critical, it just means that a
- * new scan that wants to join the pack will start a little bit behind the
- * head of the scan. Hopefully the pages are still in OS cache and the
- * scan catches up quickly.
+ * To reduce lock contention, only report scan progress every N pages. For
+ * the same reason, don't block if the lock isn't immediately available.
+ * Missing a few updates isn't critical, it just means that a new scan
+ * that wants to join the pack will start a little bit behind the head of
+ * the scan. Hopefully the pages are still in OS cache and the scan
+ * catches up quickly.
*/
if ((location % SYNC_SCAN_REPORT_INTERVAL) == 0)
{
diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c
index 4f62b1f859..0a8873f994 100644
--- a/src/backend/access/heap/tuptoaster.c
+++ b/src/backend/access/heap/tuptoaster.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.78 2007/10/11 18:19:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.79 2007/11/15 21:14:32 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -72,9 +72,9 @@ do { \
static void toast_delete_datum(Relation rel, Datum value);
static Datum toast_save_datum(Relation rel, Datum value,
- bool use_wal, bool use_fsm);
-static struct varlena *toast_fetch_datum(struct varlena *attr);
-static struct varlena *toast_fetch_datum_slice(struct varlena *attr,
+ bool use_wal, bool use_fsm);
+static struct varlena *toast_fetch_datum(struct varlena * attr);
+static struct varlena *toast_fetch_datum_slice(struct varlena * attr,
int32 sliceoffset, int32 length);
@@ -90,9 +90,9 @@ static struct varlena *toast_fetch_datum_slice(struct varlena *attr,
----------
*/
struct varlena *
-heap_tuple_fetch_attr(struct varlena *attr)
+heap_tuple_fetch_attr(struct varlena * attr)
{
- struct varlena *result;
+ struct varlena *result;
if (VARATT_IS_EXTERNAL(attr))
{
@@ -121,7 +121,7 @@ heap_tuple_fetch_attr(struct varlena *attr)
* ----------
*/
struct varlena *
-heap_tuple_untoast_attr(struct varlena *attr)
+heap_tuple_untoast_attr(struct varlena * attr)
{
if (VARATT_IS_EXTERNAL(attr))
{
@@ -156,8 +156,8 @@ heap_tuple_untoast_attr(struct varlena *attr)
/*
* This is a short-header varlena --- convert to 4-byte header format
*/
- Size data_size = VARSIZE_SHORT(attr) - VARHDRSZ_SHORT;
- Size new_size = data_size + VARHDRSZ;
+ Size data_size = VARSIZE_SHORT(attr) - VARHDRSZ_SHORT;
+ Size new_size = data_size + VARHDRSZ;
struct varlena *new_attr;
new_attr = (struct varlena *) palloc(new_size);
@@ -178,12 +178,12 @@ heap_tuple_untoast_attr(struct varlena *attr)
* ----------
*/
struct varlena *
-heap_tuple_untoast_attr_slice(struct varlena *attr,
+heap_tuple_untoast_attr_slice(struct varlena * attr,
int32 sliceoffset, int32 slicelength)
{
struct varlena *preslice;
struct varlena *result;
- char *attrdata;
+ char *attrdata;
int32 attrsize;
if (VARATT_IS_EXTERNAL(attr))
@@ -205,7 +205,7 @@ heap_tuple_untoast_attr_slice(struct varlena *attr,
if (VARATT_IS_COMPRESSED(preslice))
{
PGLZ_Header *tmp = (PGLZ_Header *) preslice;
- Size size = PGLZ_RAW_SIZE(tmp) + VARHDRSZ;
+ Size size = PGLZ_RAW_SIZE(tmp) + VARHDRSZ;
preslice = (struct varlena *) palloc(size);
SET_VARSIZE(preslice, size);
@@ -300,7 +300,7 @@ toast_raw_datum_size(Datum value)
Size
toast_datum_size(Datum value)
{
- struct varlena *attr = (struct varlena *) DatumGetPointer(value);
+ struct varlena *attr = (struct varlena *) DatumGetPointer(value);
Size result;
if (VARATT_IS_EXTERNAL(attr))
@@ -469,8 +469,8 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
for (i = 0; i < numAttrs; i++)
{
- struct varlena *old_value;
- struct varlena *new_value;
+ struct varlena *old_value;
+ struct varlena *new_value;
if (oldtup != NULL)
{
@@ -488,7 +488,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
VARATT_IS_EXTERNAL(old_value))
{
if (toast_isnull[i] || !VARATT_IS_EXTERNAL(new_value) ||
- memcmp((char *) old_value, (char *) new_value,
+ memcmp((char *) old_value, (char *) new_value,
VARSIZE_EXTERNAL(old_value)) != 0)
{
/*
@@ -543,7 +543,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
* We took care of UPDATE above, so any external value we find
* still in the tuple must be someone else's we cannot reuse.
* Fetch it back (without decompression, unless we are forcing
- * PLAIN storage). If necessary, we'll push it out as a new
+ * PLAIN storage). If necessary, we'll push it out as a new
* external value below.
*/
if (VARATT_IS_EXTERNAL(new_value))
@@ -656,7 +656,7 @@ toast_insert_or_update(Relation rel, HeapTuple newtup, HeapTuple oldtup,
/*
* Second we look for attributes of attstorage 'x' or 'e' that are still
- * inline. But skip this if there's no toast table to push them to.
+ * inline. But skip this if there's no toast table to push them to.
*/
while (heap_compute_data_size(tupleDesc,
toast_values, toast_isnull) > maxDataLen &&
@@ -956,7 +956,7 @@ toast_flatten_tuple_attribute(Datum value,
has_nulls = true;
else if (att[i]->attlen == -1)
{
- struct varlena *new_value;
+ struct varlena *new_value;
new_value = (struct varlena *) DatumGetPointer(toast_values[i]);
if (VARATT_IS_EXTERNAL(new_value) ||
@@ -1046,7 +1046,8 @@ toast_compress_datum(Datum value)
Assert(!VARATT_IS_COMPRESSED(value));
/*
- * No point in wasting a palloc cycle if value is too short for compression
+ * No point in wasting a palloc cycle if value is too short for
+ * compression
*/
if (valsize < PGLZ_strategy_default->min_input_size)
return PointerGetDatum(NULL);
@@ -1110,8 +1111,8 @@ toast_save_datum(Relation rel, Datum value,
/*
* Get the data pointer and length, and compute va_rawsize and va_extsize.
*
- * va_rawsize is the size of the equivalent fully uncompressed datum,
- * so we have to adjust for short headers.
+ * va_rawsize is the size of the equivalent fully uncompressed datum, so
+ * we have to adjust for short headers.
*
* va_extsize is the actual size of the data payload in the toast records.
*/
@@ -1119,7 +1120,7 @@ toast_save_datum(Relation rel, Datum value,
{
data_p = VARDATA_SHORT(value);
data_todo = VARSIZE_SHORT(value) - VARHDRSZ_SHORT;
- toast_pointer.va_rawsize = data_todo + VARHDRSZ; /* as if not short */
+ toast_pointer.va_rawsize = data_todo + VARHDRSZ; /* as if not short */
toast_pointer.va_extsize = data_todo;
}
else if (VARATT_IS_COMPRESSED(value))
@@ -1283,7 +1284,7 @@ toast_delete_datum(Relation rel, Datum value)
* ----------
*/
static struct varlena *
-toast_fetch_datum(struct varlena *attr)
+toast_fetch_datum(struct varlena * attr)
{
Relation toastrel;
Relation toastidx;
@@ -1299,7 +1300,7 @@ toast_fetch_datum(struct varlena *attr)
int32 numchunks;
Pointer chunk;
bool isnull;
- char *chunkdata;
+ char *chunkdata;
int32 chunksize;
/* Must copy to access aligned fields */
@@ -1365,7 +1366,7 @@ toast_fetch_datum(struct varlena *attr)
{
/* should never happen */
elog(ERROR, "found toasted toast chunk");
- chunksize = 0; /* keep compiler quiet */
+ chunksize = 0; /* keep compiler quiet */
chunkdata = NULL;
}
@@ -1384,12 +1385,12 @@ toast_fetch_datum(struct varlena *attr)
residx, numchunks,
toast_pointer.va_valueid);
}
- else if (residx == numchunks-1)
+ else if (residx == numchunks - 1)
{
if ((residx * TOAST_MAX_CHUNK_SIZE + chunksize) != ressize)
elog(ERROR, "unexpected chunk size %d (expected %d) in final chunk %d for toast value %u",
chunksize,
- (int) (ressize - residx*TOAST_MAX_CHUNK_SIZE),
+ (int) (ressize - residx * TOAST_MAX_CHUNK_SIZE),
residx,
toast_pointer.va_valueid);
}
@@ -1397,7 +1398,7 @@ toast_fetch_datum(struct varlena *attr)
elog(ERROR, "unexpected chunk number %d for toast value %u (out of range %d..%d)",
residx,
toast_pointer.va_valueid,
- 0, numchunks-1);
+ 0, numchunks - 1);
/*
* Copy the data into proper place in our result
@@ -1435,7 +1436,7 @@ toast_fetch_datum(struct varlena *attr)
* ----------
*/
static struct varlena *
-toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
+toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length)
{
Relation toastrel;
Relation toastidx;
@@ -1457,7 +1458,7 @@ toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
int totalchunks;
Pointer chunk;
bool isnull;
- char *chunkdata;
+ char *chunkdata;
int32 chunksize;
int32 chcpystrt;
int32 chcpyend;
@@ -1574,7 +1575,7 @@ toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
{
/* should never happen */
elog(ERROR, "found toasted toast chunk");
- chunksize = 0; /* keep compiler quiet */
+ chunksize = 0; /* keep compiler quiet */
chunkdata = NULL;
}
@@ -1593,7 +1594,7 @@ toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
residx, totalchunks,
toast_pointer.va_valueid);
}
- else if (residx == totalchunks-1)
+ else if (residx == totalchunks - 1)
{
if ((residx * TOAST_MAX_CHUNK_SIZE + chunksize) != attrsize)
elog(ERROR, "unexpected chunk size %d (expected %d) in final chunk %d for toast value %u when fetching slice",
@@ -1606,7 +1607,7 @@ toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
elog(ERROR, "unexpected chunk number %d for toast value %u (out of range %d..%d)",
residx,
toast_pointer.va_valueid,
- 0, totalchunks-1);
+ 0, totalchunks - 1);
/*
* Copy the data into proper place in our result
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index fd727ca68c..5f1092db05 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.99 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.100 2007/11/15 21:14:32 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relation OID
@@ -379,7 +379,7 @@ index_markpos(IndexScanDesc scan)
* returnable tuple in each HOT chain, and so restoring the prior state at the
* granularity of the index AM is sufficient. Since the only current user
* of mark/restore functionality is nodeMergejoin.c, this effectively means
- * that merge-join plans only work for MVCC snapshots. This could be fixed
+ * that merge-join plans only work for MVCC snapshots. This could be fixed
* if necessary, but for now it seems unimportant.
* ----------------
*/
@@ -413,7 +413,7 @@ HeapTuple
index_getnext(IndexScanDesc scan, ScanDirection direction)
{
HeapTuple heapTuple = &scan->xs_ctup;
- ItemPointer tid = &heapTuple->t_self;
+ ItemPointer tid = &heapTuple->t_self;
FmgrInfo *procedure;
SCAN_CHECKS;
@@ -429,14 +429,14 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
for (;;)
{
OffsetNumber offnum;
- bool at_chain_start;
- Page dp;
+ bool at_chain_start;
+ Page dp;
if (scan->xs_next_hot != InvalidOffsetNumber)
{
/*
- * We are resuming scan of a HOT chain after having returned
- * an earlier member. Must still hold pin on current heap page.
+ * We are resuming scan of a HOT chain after having returned an
+ * earlier member. Must still hold pin on current heap page.
*/
Assert(BufferIsValid(scan->xs_cbuf));
Assert(ItemPointerGetBlockNumber(tid) ==
@@ -506,7 +506,7 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
/* Scan through possible multiple members of HOT-chain */
for (;;)
{
- ItemId lp;
+ ItemId lp;
ItemPointer ctid;
/* check for bogus TID */
@@ -532,8 +532,8 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
}
/*
- * We must initialize all of *heapTuple (ie, scan->xs_ctup)
- * since it is returned to the executor on success.
+ * We must initialize all of *heapTuple (ie, scan->xs_ctup) since
+ * it is returned to the executor on success.
*/
heapTuple->t_data = (HeapTupleHeader) PageGetItem(dp, lp);
heapTuple->t_len = ItemIdGetLength(lp);
@@ -544,20 +544,21 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
/*
* Shouldn't see a HEAP_ONLY tuple at chain start. (This test
* should be unnecessary, since the chain root can't be removed
- * while we have pin on the index entry, but let's make it anyway.)
+ * while we have pin on the index entry, but let's make it
+ * anyway.)
*/
if (at_chain_start && HeapTupleIsHeapOnly(heapTuple))
break;
/*
* The xmin should match the previous xmax value, else chain is
- * broken. (Note: this test is not optional because it protects
- * us against the case where the prior chain member's xmax
- * aborted since we looked at it.)
+ * broken. (Note: this test is not optional because it protects
+ * us against the case where the prior chain member's xmax aborted
+ * since we looked at it.)
*/
if (TransactionIdIsValid(scan->xs_prev_xmax) &&
!TransactionIdEquals(scan->xs_prev_xmax,
- HeapTupleHeaderGetXmin(heapTuple->t_data)))
+ HeapTupleHeaderGetXmin(heapTuple->t_data)))
break;
/* If it's visible per the snapshot, we must return it */
@@ -565,10 +566,10 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
scan->xs_cbuf))
{
/*
- * If the snapshot is MVCC, we know that it could accept
- * at most one member of the HOT chain, so we can skip
- * examining any more members. Otherwise, check for
- * continuation of the HOT-chain, and set state for next time.
+ * If the snapshot is MVCC, we know that it could accept at
+ * most one member of the HOT chain, so we can skip examining
+ * any more members. Otherwise, check for continuation of the
+ * HOT-chain, and set state for next time.
*/
if (IsMVCCSnapshot(scan->xs_snapshot))
scan->xs_next_hot = InvalidOffsetNumber;
@@ -615,7 +616,7 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
}
else
break; /* end of chain */
- } /* loop over a single HOT chain */
+ } /* loop over a single HOT chain */
LockBuffer(scan->xs_cbuf, BUFFER_LOCK_UNLOCK);
@@ -788,7 +789,7 @@ index_vacuum_cleanup(IndexVacuumInfo *info,
* particular indexed attribute are those with both types equal to
* the index opclass' opcintype (note that this is subtly different
* from the indexed attribute's own type: it may be a binary-compatible
- * type instead). Only the default functions are stored in relcache
+ * type instead). Only the default functions are stored in relcache
* entries --- access methods can use the syscache to look up non-default
* functions.
*
@@ -822,7 +823,7 @@ index_getprocid(Relation irel,
* index_getprocinfo
*
* This routine allows index AMs to keep fmgr lookup info for
- * support procs in the relcache. As above, only the "default"
+ * support procs in the relcache. As above, only the "default"
* functions for any particular indexed attribute are cached.
*
* Note: the return value points into cached data that will be lost during
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index 5f7ecbe16d..413767ffee 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.160 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.161 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,7 +32,7 @@ typedef struct
OffsetNumber newitemoff; /* where the new item is to be inserted */
int leftspace; /* space available for items on left page */
int rightspace; /* space available for items on right page */
- int olddataitemstotal; /* space taken by old items */
+ int olddataitemstotal; /* space taken by old items */
bool have_split; /* found a valid split? */
@@ -222,7 +222,7 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
if (!ItemIdIsDead(curitemid))
{
ItemPointerData htid;
- bool all_dead;
+ bool all_dead;
/*
* _bt_compare returns 0 for (1,NULL) and (1,NULL) - this's
@@ -239,8 +239,8 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
/*
* We check the whole HOT-chain to see if there is any tuple
- * that satisfies SnapshotDirty. This is necessary because
- * we have just a single index entry for the entire chain.
+ * that satisfies SnapshotDirty. This is necessary because we
+ * have just a single index entry for the entire chain.
*/
if (heap_hot_search(&htid, heapRel, &SnapshotDirty, &all_dead))
{
@@ -267,15 +267,16 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
* is itself now committed dead --- if so, don't complain.
* This is a waste of time in normal scenarios but we must
* do it to support CREATE INDEX CONCURRENTLY.
- *
+ *
* We must follow HOT-chains here because during
* concurrent index build, we insert the root TID though
* the actual tuple may be somewhere in the HOT-chain.
- * While following the chain we might not stop at the exact
- * tuple which triggered the insert, but that's OK because
- * if we find a live tuple anywhere in this chain, we have
- * a unique key conflict. The other live tuple is not part
- * of this chain because it had a different index entry.
+ * While following the chain we might not stop at the
+ * exact tuple which triggered the insert, but that's OK
+ * because if we find a live tuple anywhere in this chain,
+ * we have a unique key conflict. The other live tuple is
+ * not part of this chain because it had a different index
+ * entry.
*/
htid = itup->t_tid;
if (heap_hot_search(&htid, heapRel, SnapshotSelf, NULL))
@@ -293,8 +294,8 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
ereport(ERROR,
(errcode(ERRCODE_UNIQUE_VIOLATION),
- errmsg("duplicate key value violates unique constraint \"%s\"",
- RelationGetRelationName(rel))));
+ errmsg("duplicate key value violates unique constraint \"%s\"",
+ RelationGetRelationName(rel))));
}
else if (all_dead)
{
@@ -372,7 +373,7 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
* On entry, *buf and *offsetptr point to the first legal position
* where the new tuple could be inserted. The caller should hold an
* exclusive lock on *buf. *offsetptr can also be set to
- * InvalidOffsetNumber, in which case the function will search the right
+ * InvalidOffsetNumber, in which case the function will search the right
* location within the page if needed. On exit, they point to the chosen
* insert location. If findinsertloc decided to move right, the lock and
* pin on the original page will be released and the new page returned to
@@ -389,11 +390,12 @@ _bt_findinsertloc(Relation rel,
ScanKey scankey,
IndexTuple newtup)
{
- Buffer buf = *bufptr;
- Page page = BufferGetPage(buf);
- Size itemsz;
+ Buffer buf = *bufptr;
+ Page page = BufferGetPage(buf);
+ Size itemsz;
BTPageOpaque lpageop;
- bool movedright, vacuumed;
+ bool movedright,
+ vacuumed;
OffsetNumber newitemoff;
OffsetNumber firstlegaloff = *offsetptr;
@@ -447,19 +449,21 @@ _bt_findinsertloc(Relation rel,
Buffer rbuf;
/*
- * before considering moving right, see if we can obtain enough
- * space by erasing LP_DEAD items
+ * before considering moving right, see if we can obtain enough space
+ * by erasing LP_DEAD items
*/
if (P_ISLEAF(lpageop) && P_HAS_GARBAGE(lpageop))
{
_bt_vacuum_one_page(rel, buf);
- /* remember that we vacuumed this page, because that makes
- * the hint supplied by the caller invalid */
+ /*
+ * remember that we vacuumed this page, because that makes the
+ * hint supplied by the caller invalid
+ */
vacuumed = true;
if (PageGetFreeSpace(page) >= itemsz)
- break; /* OK, now we have enough space */
+ break; /* OK, now we have enough space */
}
/*
@@ -473,11 +477,10 @@ _bt_findinsertloc(Relation rel,
/*
* step right to next non-dead page
*
- * must write-lock that page before releasing write lock on
- * current page; else someone else's _bt_check_unique scan could
- * fail to see our insertion. write locks on intermediate dead
- * pages won't do because we don't know when they will get
- * de-linked from the tree.
+ * must write-lock that page before releasing write lock on current
+ * page; else someone else's _bt_check_unique scan could fail to see
+ * our insertion. write locks on intermediate dead pages won't do
+ * because we don't know when they will get de-linked from the tree.
*/
rbuf = InvalidBuffer;
@@ -501,17 +504,16 @@ _bt_findinsertloc(Relation rel,
}
/*
- * Now we are on the right page, so find the insert position. If we
- * moved right at all, we know we should insert at the start of the
- * page. If we didn't move right, we can use the firstlegaloff hint
- * if the caller supplied one, unless we vacuumed the page which
- * might have moved tuples around making the hint invalid. If we
- * didn't move right or can't use the hint, find the position
- * by searching.
+ * Now we are on the right page, so find the insert position. If we moved
+ * right at all, we know we should insert at the start of the page. If we
+ * didn't move right, we can use the firstlegaloff hint if the caller
+ * supplied one, unless we vacuumed the page which might have moved tuples
+ * around making the hint invalid. If we didn't move right or can't use
+ * the hint, find the position by searching.
*/
if (movedright)
newitemoff = P_FIRSTDATAKEY(lpageop);
- else if(firstlegaloff != InvalidOffsetNumber && !vacuumed)
+ else if (firstlegaloff != InvalidOffsetNumber && !vacuumed)
newitemoff = firstlegaloff;
else
newitemoff = _bt_binsrch(rel, buf, keysz, scankey, false);
@@ -982,8 +984,8 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
* the data by reinserting it into a new left page. (XXX the latter
* comment is probably obsolete.)
*
- * We need to do this before writing the WAL record, so that XLogInsert can
- * WAL log an image of the page if necessary.
+ * We need to do this before writing the WAL record, so that XLogInsert
+ * can WAL log an image of the page if necessary.
*/
PageRestoreTempPage(leftpage, origpage);
@@ -1033,10 +1035,10 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
* Log the new item and its offset, if it was inserted on the left
* page. (If it was put on the right page, we don't need to explicitly
* WAL log it because it's included with all the other items on the
- * right page.) Show the new item as belonging to the left page buffer,
- * so that it is not stored if XLogInsert decides it needs a full-page
- * image of the left page. We store the offset anyway, though, to
- * support archive compression of these records.
+ * right page.) Show the new item as belonging to the left page
+ * buffer, so that it is not stored if XLogInsert decides it needs a
+ * full-page image of the left page. We store the offset anyway,
+ * though, to support archive compression of these records.
*/
if (newitemonleft)
{
@@ -1052,31 +1054,31 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
lastrdata->data = (char *) newitem;
lastrdata->len = MAXALIGN(newitemsz);
- lastrdata->buffer = buf; /* backup block 1 */
+ lastrdata->buffer = buf; /* backup block 1 */
lastrdata->buffer_std = true;
}
else
{
/*
- * Although we don't need to WAL-log the new item, we still
- * need XLogInsert to consider storing a full-page image of the
- * left page, so make an empty entry referencing that buffer.
- * This also ensures that the left page is always backup block 1.
+ * Although we don't need to WAL-log the new item, we still need
+ * XLogInsert to consider storing a full-page image of the left
+ * page, so make an empty entry referencing that buffer. This also
+ * ensures that the left page is always backup block 1.
*/
lastrdata->next = lastrdata + 1;
lastrdata++;
lastrdata->data = NULL;
lastrdata->len = 0;
- lastrdata->buffer = buf; /* backup block 1 */
+ lastrdata->buffer = buf; /* backup block 1 */
lastrdata->buffer_std = true;
}
/*
* Log the contents of the right page in the format understood by
* _bt_restore_page(). We set lastrdata->buffer to InvalidBuffer,
- * because we're going to recreate the whole page anyway, so it
- * should never be stored by XLogInsert.
+ * because we're going to recreate the whole page anyway, so it should
+ * never be stored by XLogInsert.
*
* Direct access to page is not good but faster - we should implement
* some new func in page API. Note we only store the tuples
@@ -1101,7 +1103,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
lastrdata->data = NULL;
lastrdata->len = 0;
- lastrdata->buffer = sbuf; /* backup block 2 */
+ lastrdata->buffer = sbuf; /* backup block 2 */
lastrdata->buffer_std = true;
}
@@ -1275,9 +1277,10 @@ _bt_findsplitloc(Relation rel,
olddataitemstoleft += itemsz;
}
- /* If the new item goes as the last item, check for splitting so that
- * all the old items go to the left page and the new item goes to the
- * right page.
+ /*
+ * If the new item goes as the last item, check for splitting so that all
+ * the old items go to the left page and the new item goes to the right
+ * page.
*/
if (newitemoff > maxoff && !goodenoughfound)
_bt_checksplitloc(&state, newitemoff, false, olddataitemstotal, 0);
@@ -1314,16 +1317,16 @@ _bt_checksplitloc(FindSplitData *state,
int olddataitemstoleft,
Size firstoldonrightsz)
{
- int leftfree,
- rightfree;
- Size firstrightitemsz;
- bool newitemisfirstonright;
+ int leftfree,
+ rightfree;
+ Size firstrightitemsz;
+ bool newitemisfirstonright;
/* Is the new item going to be the first item on the right page? */
newitemisfirstonright = (firstoldonright == state->newitemoff
&& !newitemonleft);
- if(newitemisfirstonright)
+ if (newitemisfirstonright)
firstrightitemsz = state->newitemsz;
else
firstrightitemsz = firstoldonrightsz;
@@ -1334,9 +1337,8 @@ _bt_checksplitloc(FindSplitData *state,
(state->olddataitemstotal - olddataitemstoleft);
/*
- * The first item on the right page becomes the high key of the
- * left page; therefore it counts against left space as well as right
- * space.
+ * The first item on the right page becomes the high key of the left page;
+ * therefore it counts against left space as well as right space.
*/
leftfree -= firstrightitemsz;
@@ -1875,8 +1877,8 @@ _bt_vacuum_one_page(Relation rel, Buffer buffer)
BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page);
/*
- * Scan over all items to see which ones need to be deleted
- * according to LP_DEAD flags.
+ * Scan over all items to see which ones need to be deleted according to
+ * LP_DEAD flags.
*/
minoff = P_FIRSTDATAKEY(opaque);
maxoff = PageGetMaxOffsetNumber(page);
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c
index f62e4b3c5e..8eee5a74cc 100644
--- a/src/backend/access/nbtree/nbtpage.c
+++ b/src/backend/access/nbtree/nbtpage.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.103 2007/09/12 22:10:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.104 2007/11/15 21:14:32 momjian Exp $
*
* NOTES
* Postgres btree pages look like ordinary relation pages. The opaque
@@ -751,8 +751,8 @@ _bt_parent_deletion_safe(Relation rel, BlockNumber target, BTStack stack)
/*
* In recovery mode, assume the deletion being replayed is valid. We
- * can't always check it because we won't have a full search stack,
- * and we should complain if there's a problem, anyway.
+ * can't always check it because we won't have a full search stack, and we
+ * should complain if there's a problem, anyway.
*/
if (InRecovery)
return true;
@@ -781,8 +781,8 @@ _bt_parent_deletion_safe(Relation rel, BlockNumber target, BTStack stack)
{
/*
* It's only child, so safe if parent would itself be removable.
- * We have to check the parent itself, and then recurse to
- * test the conditions at the parent's parent.
+ * We have to check the parent itself, and then recurse to test
+ * the conditions at the parent's parent.
*/
if (P_RIGHTMOST(opaque) || P_ISROOT(opaque))
{
@@ -887,18 +887,18 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack, bool vacuum_full)
targetkey = CopyIndexTuple((IndexTuple) PageGetItem(page, itemid));
/*
- * To avoid deadlocks, we'd better drop the target page lock before
- * going further.
+ * To avoid deadlocks, we'd better drop the target page lock before going
+ * further.
*/
_bt_relbuf(rel, buf);
/*
- * We need an approximate pointer to the page's parent page. We use
- * the standard search mechanism to search for the page's high key; this
- * will give us a link to either the current parent or someplace to its
- * left (if there are multiple equal high keys). In recursion cases,
- * the caller already generated a search stack and we can just re-use
- * that work.
+ * We need an approximate pointer to the page's parent page. We use the
+ * standard search mechanism to search for the page's high key; this will
+ * give us a link to either the current parent or someplace to its left
+ * (if there are multiple equal high keys). In recursion cases, the
+ * caller already generated a search stack and we can just re-use that
+ * work.
*/
if (stack == NULL)
{
@@ -933,11 +933,11 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack, bool vacuum_full)
/*
* During WAL recovery, we can't use _bt_search (for one reason,
* it might invoke user-defined comparison functions that expect
- * facilities not available in recovery mode). Instead, just
- * set up a dummy stack pointing to the left end of the parent
- * tree level, from which _bt_getstackbuf will walk right to the
- * parent page. Painful, but we don't care too much about
- * performance in this scenario.
+ * facilities not available in recovery mode). Instead, just set
+ * up a dummy stack pointing to the left end of the parent tree
+ * level, from which _bt_getstackbuf will walk right to the parent
+ * page. Painful, but we don't care too much about performance in
+ * this scenario.
*/
pbuf = _bt_get_endpoint(rel, targetlevel + 1, false);
stack = (BTStack) palloc(sizeof(BTStackData));
@@ -951,10 +951,10 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack, bool vacuum_full)
/*
* We cannot delete a page that is the rightmost child of its immediate
- * parent, unless it is the only child --- in which case the parent has
- * to be deleted too, and the same condition applies recursively to it.
- * We have to check this condition all the way up before trying to delete.
- * We don't need to re-test when deleting a non-leaf page, though.
+ * parent, unless it is the only child --- in which case the parent has to
+ * be deleted too, and the same condition applies recursively to it. We
+ * have to check this condition all the way up before trying to delete. We
+ * don't need to re-test when deleting a non-leaf page, though.
*/
if (targetlevel == 0 &&
!_bt_parent_deletion_safe(rel, target, stack))
@@ -1072,8 +1072,8 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack, bool vacuum_full)
* might be possible to push the fast root even further down, but the odds
* of doing so are slim, and the locking considerations daunting.)
*
- * We don't support handling this in the case where the parent is
- * becoming half-dead, even though it theoretically could occur.
+ * We don't support handling this in the case where the parent is becoming
+ * half-dead, even though it theoretically could occur.
*
* We can safely acquire a lock on the metapage here --- see comments for
* _bt_newroot().
@@ -1287,10 +1287,10 @@ _bt_pagedel(Relation rel, Buffer buf, BTStack stack, bool vacuum_full)
_bt_relbuf(rel, lbuf);
/*
- * If parent became half dead, recurse to delete it. Otherwise, if
- * right sibling is empty and is now the last child of the parent, recurse
- * to try to delete it. (These cases cannot apply at the same time,
- * though the second case might itself recurse to the first.)
+ * If parent became half dead, recurse to delete it. Otherwise, if right
+ * sibling is empty and is now the last child of the parent, recurse to
+ * try to delete it. (These cases cannot apply at the same time, though
+ * the second case might itself recurse to the first.)
*
* When recursing to parent, we hold the lock on the target page until
* done. This delays any insertions into the keyspace that was just
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index b947d770aa..7b71f544f8 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.113 2007/05/27 03:50:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.114 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -637,17 +637,17 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
* even if the row comparison is of ">" or "<" type, because the
* condition applied to all but the last row member is effectively
* ">=" or "<=", and so the extra keys don't break the positioning
- * scheme. But, by the same token, if we aren't able to use all
+ * scheme. But, by the same token, if we aren't able to use all
* the row members, then the part of the row comparison that we
- * did use has to be treated as just a ">=" or "<=" condition,
- * and so we'd better adjust strat_total accordingly.
+ * did use has to be treated as just a ">=" or "<=" condition, and
+ * so we'd better adjust strat_total accordingly.
*/
if (i == keysCount - 1)
{
bool used_all_subkeys = false;
Assert(!(subkey->sk_flags & SK_ROW_END));
- for(;;)
+ for (;;)
{
subkey++;
Assert(subkey->sk_flags & SK_ROW_MEMBER);
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index 6d85695c3d..a1b0125f78 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.86 2007/09/12 22:10:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.87 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -205,7 +205,7 @@ _bt_freestack(BTStack stack)
* that's the only one returned. (So, we return either a single = key,
* or one or two boundary-condition keys for each attr.) However, if we
* cannot compare two keys for lack of a suitable cross-type operator,
- * we cannot eliminate either. If there are two such keys of the same
+ * we cannot eliminate either. If there are two such keys of the same
* operator strategy, the second one is just pushed into the output array
* without further processing here. We may also emit both >/>= or both
* </<= keys if we can't compare them. The logic about required keys still
@@ -265,13 +265,13 @@ _bt_preprocess_keys(IndexScanDesc scan)
{
/*
* We treat all btree operators as strict (even if they're not so
- * marked in pg_proc). This means that it is impossible for an
- * operator condition with a NULL comparison constant to succeed,
- * and we can reject it right away.
+ * marked in pg_proc). This means that it is impossible for an
+ * operator condition with a NULL comparison constant to succeed, and
+ * we can reject it right away.
*
* However, we now also support "x IS NULL" clauses as search
- * conditions, so in that case keep going. The planner has not
- * filled in any particular strategy in this case, so set it to
+ * conditions, so in that case keep going. The planner has not filled
+ * in any particular strategy in this case, so set it to
* BTEqualStrategyNumber --- we can treat IS NULL as an equality
* operator for purposes of search strategy.
*/
@@ -303,8 +303,8 @@ _bt_preprocess_keys(IndexScanDesc scan)
/*
* Initialize for processing of keys for attr 1.
*
- * xform[i] points to the currently best scan key of strategy type i+1;
- * it is NULL if we haven't yet found such a key for this attr.
+ * xform[i] points to the currently best scan key of strategy type i+1; it
+ * is NULL if we haven't yet found such a key for this attr.
*/
attno = 1;
memset(xform, 0, sizeof(xform));
@@ -464,6 +464,7 @@ _bt_preprocess_keys(IndexScanDesc scan)
memcpy(outkey, cur, sizeof(ScanKeyData));
if (numberOfEqualCols == attno - 1)
_bt_mark_scankey_required(outkey);
+
/*
* We don't support RowCompare using equality; such a qual would
* mess up the numberOfEqualCols tracking.
@@ -514,9 +515,9 @@ _bt_preprocess_keys(IndexScanDesc scan)
else
{
/*
- * We can't determine which key is more restrictive. Keep
- * the previous one in xform[j] and push this one directly
- * to the output array.
+ * We can't determine which key is more restrictive. Keep the
+ * previous one in xform[j] and push this one directly to the
+ * output array.
*/
ScanKey outkey = &outkeys[new_numberOfKeys++];
@@ -542,7 +543,7 @@ _bt_preprocess_keys(IndexScanDesc scan)
* and amoplefttype/amoprighttype equal to the two argument datatypes.
*
* If the opfamily doesn't supply a complete set of cross-type operators we
- * may not be able to make the comparison. If we can make the comparison
+ * may not be able to make the comparison. If we can make the comparison
* we store the operator result in *result and return TRUE. We return FALSE
* if the comparison could not be made.
*
@@ -608,8 +609,8 @@ _bt_compare_scankey_args(IndexScanDesc scan, ScanKey op,
* indexscan initiated by syscache lookup will use cross-data-type
* operators.)
*
- * If the sk_strategy was flipped by _bt_mark_scankey_with_indoption,
- * we have to un-flip it to get the correct opfamily member.
+ * If the sk_strategy was flipped by _bt_mark_scankey_with_indoption, we
+ * have to un-flip it to get the correct opfamily member.
*/
strat = op->sk_strategy;
if (op->sk_flags & SK_BT_DESC)
@@ -654,7 +655,7 @@ _bt_compare_scankey_args(IndexScanDesc scan, ScanKey op,
static void
_bt_mark_scankey_with_indoption(ScanKey skey, int16 *indoption)
{
- int addflags;
+ int addflags;
addflags = indoption[skey->sk_attno - 1] << SK_BT_INDOPTION_SHIFT;
if ((addflags & SK_BT_DESC) && !(skey->sk_flags & SK_BT_DESC))
@@ -874,8 +875,8 @@ _bt_checkkeys(IndexScanDesc scan,
/*
* Since NULLs are sorted before non-NULLs, we know we have
* reached the lower limit of the range of values for this
- * index attr. On a backward scan, we can stop if this qual is
- * one of the "must match" subset. On a forward scan,
+ * index attr. On a backward scan, we can stop if this qual
+ * is one of the "must match" subset. On a forward scan,
* however, we should keep going.
*/
if ((key->sk_flags & SK_BT_REQBKWD) &&
@@ -887,8 +888,8 @@ _bt_checkkeys(IndexScanDesc scan,
/*
* Since NULLs are sorted after non-NULLs, we know we have
* reached the upper limit of the range of values for this
- * index attr. On a forward scan, we can stop if this qual is
- * one of the "must match" subset. On a backward scan,
+ * index attr. On a forward scan, we can stop if this qual is
+ * one of the "must match" subset. On a backward scan,
* however, we should keep going.
*/
if ((key->sk_flags & SK_BT_REQFWD) &&
@@ -978,7 +979,7 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, TupleDesc tupdesc,
* Since NULLs are sorted before non-NULLs, we know we have
* reached the lower limit of the range of values for this
* index attr. On a backward scan, we can stop if this qual is
- * one of the "must match" subset. On a forward scan,
+ * one of the "must match" subset. On a forward scan,
* however, we should keep going.
*/
if ((subkey->sk_flags & SK_BT_REQBKWD) &&
@@ -991,7 +992,7 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, TupleDesc tupdesc,
* Since NULLs are sorted after non-NULLs, we know we have
* reached the upper limit of the range of values for this
* index attr. On a forward scan, we can stop if this qual is
- * one of the "must match" subset. On a backward scan,
+ * one of the "must match" subset. On a backward scan,
* however, we should keep going.
*/
if ((subkey->sk_flags & SK_BT_REQFWD) &&
@@ -1264,8 +1265,8 @@ _bt_start_vacuum(Relation rel)
LWLockAcquire(BtreeVacuumLock, LW_EXCLUSIVE);
/*
- * Assign the next cycle ID, being careful to avoid zero as well as
- * the reserved high values.
+ * Assign the next cycle ID, being careful to avoid zero as well as the
+ * reserved high values.
*/
result = ++(btvacinfo->cycle_ctr);
if (result == 0 || result > MAX_BT_CYCLE_ID)
diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c
index 499129c48f..79aae66201 100644
--- a/src/backend/access/nbtree/nbtxlog.c
+++ b/src/backend/access/nbtree/nbtxlog.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.46 2007/09/20 17:56:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.47 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,7 +40,7 @@ typedef struct bt_incomplete_action
BlockNumber rightblk; /* right half of split */
/* these fields are for a delete: */
BlockNumber delblk; /* parent block to be deleted */
-} bt_incomplete_action;
+} bt_incomplete_action;
static List *incomplete_actions;
@@ -271,8 +271,8 @@ btree_xlog_split(bool onleft, bool isroot,
char *datapos;
int datalen;
OffsetNumber newitemoff = 0;
- Item newitem = NULL;
- Size newitemsz = 0;
+ Item newitem = NULL;
+ Size newitemsz = 0;
reln = XLogOpenRelation(xlrec->node);
@@ -343,15 +343,15 @@ btree_xlog_split(bool onleft, bool isroot,
* Reconstruct left (original) sibling if needed. Note that this code
* ensures that the items remaining on the left page are in the correct
* item number order, but it does not reproduce the physical order they
- * would have had. Is this worth changing? See also _bt_restore_page().
+ * would have had. Is this worth changing? See also _bt_restore_page().
*/
if (!(record->xl_info & XLR_BKP_BLOCK_1))
{
- Buffer lbuf = XLogReadBuffer(reln, xlrec->leftsib, false);
+ Buffer lbuf = XLogReadBuffer(reln, xlrec->leftsib, false);
if (BufferIsValid(lbuf))
{
- Page lpage = (Page) BufferGetPage(lbuf);
+ Page lpage = (Page) BufferGetPage(lbuf);
BTPageOpaque lopaque = (BTPageOpaque) PageGetSpecialPointer(lpage);
if (!XLByteLE(lsn, PageGetLSN(lpage)))
@@ -359,19 +359,20 @@ btree_xlog_split(bool onleft, bool isroot,
OffsetNumber off;
OffsetNumber maxoff = PageGetMaxOffsetNumber(lpage);
OffsetNumber deletable[MaxOffsetNumber];
- int ndeletable = 0;
- ItemId hiItemId;
- Item hiItem;
+ int ndeletable = 0;
+ ItemId hiItemId;
+ Item hiItem;
/*
- * Remove the items from the left page that were copied to
- * the right page. Also remove the old high key, if any.
- * (We must remove everything before trying to insert any
- * items, else we risk not having enough space.)
+ * Remove the items from the left page that were copied to the
+ * right page. Also remove the old high key, if any. (We must
+ * remove everything before trying to insert any items, else
+ * we risk not having enough space.)
*/
if (!P_RIGHTMOST(lopaque))
{
deletable[ndeletable++] = P_HIKEY;
+
/*
* newitemoff is given to us relative to the original
* page's item numbering, so adjust it for this deletion.
@@ -421,11 +422,11 @@ btree_xlog_split(bool onleft, bool isroot,
/* Fix left-link of the page to the right of the new right sibling */
if (xlrec->rnext != P_NONE && !(record->xl_info & XLR_BKP_BLOCK_2))
{
- Buffer buffer = XLogReadBuffer(reln, xlrec->rnext, false);
+ Buffer buffer = XLogReadBuffer(reln, xlrec->rnext, false);
if (BufferIsValid(buffer))
{
- Page page = (Page) BufferGetPage(buffer);
+ Page page = (Page) BufferGetPage(buffer);
if (!XLByteLE(lsn, PageGetLSN(page)))
{
@@ -795,7 +796,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
xlrec->node.spcNode, xlrec->node.dbNode,
xlrec->node.relNode);
appendStringInfo(buf, "left %u, right %u, next %u, level %u, firstright %d",
- xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
+ xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
xlrec->level, xlrec->firstright);
break;
}
@@ -807,7 +808,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
xlrec->node.spcNode, xlrec->node.dbNode,
xlrec->node.relNode);
appendStringInfo(buf, "left %u, right %u, next %u, level %u, firstright %d",
- xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
+ xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
xlrec->level, xlrec->firstright);
break;
}
@@ -819,7 +820,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
xlrec->node.spcNode, xlrec->node.dbNode,
xlrec->node.relNode);
appendStringInfo(buf, "left %u, right %u, next %u, level %u, firstright %d",
- xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
+ xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
xlrec->level, xlrec->firstright);
break;
}
@@ -831,7 +832,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
xlrec->node.spcNode, xlrec->node.dbNode,
xlrec->node.relNode);
appendStringInfo(buf, "left %u, right %u, next %u, level %u, firstright %d",
- xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
+ xlrec->leftsib, xlrec->rightsib, xlrec->rnext,
xlrec->level, xlrec->firstright);
break;
}
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 419c865606..72be0e855a 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -14,19 +14,19 @@
* CLOG page is initialized to zeroes. Other writes of CLOG come from
* recording of transaction commit or abort in xact.c, which generates its
* own XLOG records for these events and will re-perform the status update
- * on redo; so we need make no additional XLOG entry here. For synchronous
+ * on redo; so we need make no additional XLOG entry here. For synchronous
* transaction commits, the XLOG is guaranteed flushed through the XLOG commit
* record before we are called to log a commit, so the WAL rule "write xlog
* before data" is satisfied automatically. However, for async commits we
* must track the latest LSN affecting each CLOG page, so that we can flush
- * XLOG that far and satisfy the WAL rule. We don't have to worry about this
+ * XLOG that far and satisfy the WAL rule. We don't have to worry about this
* for aborts (whether sync or async), since the post-crash assumption would
* be that such transactions failed anyway.
*
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.44 2007/09/05 18:10:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.45 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -60,8 +60,8 @@
#define TransactionIdToBIndex(xid) ((xid) % (TransactionId) CLOG_XACTS_PER_BYTE)
/* We store the latest async LSN for each group of transactions */
-#define CLOG_XACTS_PER_LSN_GROUP 32 /* keep this a power of 2 */
-#define CLOG_LSNS_PER_PAGE (CLOG_XACTS_PER_PAGE / CLOG_XACTS_PER_LSN_GROUP)
+#define CLOG_XACTS_PER_LSN_GROUP 32 /* keep this a power of 2 */
+#define CLOG_LSNS_PER_PAGE (CLOG_XACTS_PER_PAGE / CLOG_XACTS_PER_LSN_GROUP)
#define GetLSNIndex(slotno, xid) ((slotno) * CLOG_LSNS_PER_PAGE + \
((xid) % (TransactionId) CLOG_XACTS_PER_PAGE) / CLOG_XACTS_PER_LSN_GROUP)
@@ -85,7 +85,7 @@ static void WriteTruncateXlogRec(int pageno);
* Record the final state of a transaction in the commit log.
*
* lsn must be the WAL location of the commit record when recording an async
- * commit. For a synchronous commit it can be InvalidXLogRecPtr, since the
+ * commit. For a synchronous commit it can be InvalidXLogRecPtr, since the
* caller guarantees the commit record is already flushed in that case. It
* should be InvalidXLogRecPtr for abort cases, too.
*
@@ -159,7 +159,7 @@ TransactionIdSetStatus(TransactionId xid, XidStatus status, XLogRecPtr lsn)
* an LSN that is late enough to be able to guarantee that if we flush up to
* that LSN then we will have flushed the transaction's commit record to disk.
* The result is not necessarily the exact LSN of the transaction's commit
- * record! For example, for long-past transactions (those whose clog pages
+ * record! For example, for long-past transactions (those whose clog pages
* already migrated to disk), we'll return InvalidXLogRecPtr. Also, because
* we group transactions on the same clog page to conserve storage, we might
* return the LSN of a later transaction that falls into the same group.
@@ -486,8 +486,8 @@ clog_redo(XLogRecPtr lsn, XLogRecord *record)
memcpy(&pageno, XLogRecGetData(record), sizeof(int));
/*
- * During XLOG replay, latest_page_number isn't set up yet; insert
- * a suitable value to bypass the sanity test in SimpleLruTruncate.
+ * During XLOG replay, latest_page_number isn't set up yet; insert a
+ * suitable value to bypass the sanity test in SimpleLruTruncate.
*/
ClogCtl->shared->latest_page_number = pageno;
diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c
index b34fa9be78..61a59961d7 100644
--- a/src/backend/access/transam/multixact.c
+++ b/src/backend/access/transam/multixact.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.25 2007/09/05 18:10:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/multixact.c,v 1.26 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -380,9 +380,9 @@ MultiXactIdIsRunning(MultiXactId multi)
}
/*
- * Checking for myself is cheap compared to looking in shared memory,
- * so first do the equivalent of MultiXactIdIsCurrent(). This is not
- * needed for correctness, it's just a fast path.
+ * Checking for myself is cheap compared to looking in shared memory, so
+ * first do the equivalent of MultiXactIdIsCurrent(). This is not needed
+ * for correctness, it's just a fast path.
*/
for (i = 0; i < nmembers; i++)
{
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index e53b05e04d..db0f79c47c 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/transam.c,v 1.71 2007/09/08 20:31:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/transam.c,v 1.72 2007/11/15 21:14:32 momjian Exp $
*
* NOTES
* This file contains the high level access-method interface to the
@@ -440,14 +440,14 @@ TransactionId
TransactionIdLatest(TransactionId mainxid,
int nxids, const TransactionId *xids)
{
- TransactionId result;
+ TransactionId result;
/*
- * In practice it is highly likely that the xids[] array is sorted, and
- * so we could save some cycles by just taking the last child XID, but
- * this probably isn't so performance-critical that it's worth depending
- * on that assumption. But just to show we're not totally stupid, scan
- * the array back-to-front to avoid useless assignments.
+ * In practice it is highly likely that the xids[] array is sorted, and so
+ * we could save some cycles by just taking the last child XID, but this
+ * probably isn't so performance-critical that it's worth depending on
+ * that assumption. But just to show we're not totally stupid, scan the
+ * array back-to-front to avoid useless assignments.
*/
result = mainxid;
while (--nxids >= 0)
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 6ce9d1b586..2888adbc37 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.37 2007/10/24 20:55:36 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.38 2007/11/15 21:14:32 momjian Exp $
*
* NOTES
* Each global transaction is associated with a global transaction
@@ -397,15 +397,15 @@ LockGXact(const char *gid, Oid user)
errhint("Must be superuser or the user that prepared the transaction.")));
/*
- * Note: it probably would be possible to allow committing from another
- * database; but at the moment NOTIFY is known not to work and there
- * may be some other issues as well. Hence disallow until someone
- * gets motivated to make it work.
+ * Note: it probably would be possible to allow committing from
+ * another database; but at the moment NOTIFY is known not to work and
+ * there may be some other issues as well. Hence disallow until
+ * someone gets motivated to make it work.
*/
if (MyDatabaseId != gxact->proc.databaseId)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("prepared transaction belongs to another database"),
+ errmsg("prepared transaction belongs to another database"),
errhint("Connect to the database where the transaction was prepared to finish it.")));
/* OK for me to lock it */
@@ -937,11 +937,11 @@ EndPrepare(GlobalTransaction gxact)
* odds of a PANIC actually occurring should be very tiny given that we
* were able to write the bogus CRC above.
*
- * We have to set inCommit here, too; otherwise a checkpoint
- * starting immediately after the WAL record is inserted could complete
- * without fsync'ing our state file. (This is essentially the same kind
- * of race condition as the COMMIT-to-clog-write case that
- * RecordTransactionCommit uses inCommit for; see notes there.)
+ * We have to set inCommit here, too; otherwise a checkpoint starting
+ * immediately after the WAL record is inserted could complete without
+ * fsync'ing our state file. (This is essentially the same kind of race
+ * condition as the COMMIT-to-clog-write case that RecordTransactionCommit
+ * uses inCommit for; see notes there.)
*
* We save the PREPARE record's location in the gxact for later use by
* CheckPointTwoPhase.
@@ -985,8 +985,8 @@ EndPrepare(GlobalTransaction gxact)
MarkAsPrepared(gxact);
/*
- * Now we can mark ourselves as out of the commit critical section:
- * a checkpoint starting after this will certainly see the gxact as a
+ * Now we can mark ourselves as out of the commit critical section: a
+ * checkpoint starting after this will certainly see the gxact as a
* candidate for fsyncing.
*/
MyProc->inCommit = false;
@@ -1272,8 +1272,8 @@ RemoveTwoPhaseFile(TransactionId xid, bool giveWarning)
if (errno != ENOENT || giveWarning)
ereport(WARNING,
(errcode_for_file_access(),
- errmsg("could not remove two-phase state file \"%s\": %m",
- path)));
+ errmsg("could not remove two-phase state file \"%s\": %m",
+ path)));
}
/*
@@ -1500,8 +1500,8 @@ PrescanPreparedTransactions(void)
if (buf == NULL)
{
ereport(WARNING,
- (errmsg("removing corrupt two-phase state file \"%s\"",
- clde->d_name)));
+ (errmsg("removing corrupt two-phase state file \"%s\"",
+ clde->d_name)));
RemoveTwoPhaseFile(xid, true);
continue;
}
@@ -1511,8 +1511,8 @@ PrescanPreparedTransactions(void)
if (!TransactionIdEquals(hdr->xid, xid))
{
ereport(WARNING,
- (errmsg("removing corrupt two-phase state file \"%s\"",
- clde->d_name)));
+ (errmsg("removing corrupt two-phase state file \"%s\"",
+ clde->d_name)));
RemoveTwoPhaseFile(xid, true);
pfree(buf);
continue;
@@ -1599,8 +1599,8 @@ RecoverPreparedTransactions(void)
if (buf == NULL)
{
ereport(WARNING,
- (errmsg("removing corrupt two-phase state file \"%s\"",
- clde->d_name)));
+ (errmsg("removing corrupt two-phase state file \"%s\"",
+ clde->d_name)));
RemoveTwoPhaseFile(xid, true);
continue;
}
@@ -1711,9 +1711,9 @@ RecordTransactionCommitPrepared(TransactionId xid,
recptr = XLogInsert(RM_XACT_ID, XLOG_XACT_COMMIT_PREPARED, rdata);
/*
- * We don't currently try to sleep before flush here ... nor is there
- * any support for async commit of a prepared xact (the very idea is
- * probably a contradiction)
+ * We don't currently try to sleep before flush here ... nor is there any
+ * support for async commit of a prepared xact (the very idea is probably
+ * a contradiction)
*/
/* Flush XLOG to disk */
diff --git a/src/backend/access/transam/twophase_rmgr.c b/src/backend/access/transam/twophase_rmgr.c
index 9c2f14a1a3..84d1e9caef 100644
--- a/src/backend/access/transam/twophase_rmgr.c
+++ b/src/backend/access/transam/twophase_rmgr.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/twophase_rmgr.c,v 1.5 2007/05/27 03:50:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/twophase_rmgr.c,v 1.6 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,7 @@ const TwoPhaseCallback twophase_postcommit_callbacks[TWOPHASE_RM_MAX_ID + 1] =
lock_twophase_postcommit, /* Lock */
inval_twophase_postcommit, /* Inval */
flatfile_twophase_postcommit, /* flat file update */
- notify_twophase_postcommit, /* notify/listen */
+ notify_twophase_postcommit, /* notify/listen */
pgstat_twophase_postcommit /* pgstat */
};
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 14332c6ab2..d7a5183d4c 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -6,7 +6,7 @@
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.79 2007/09/08 20:31:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.80 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,9 +73,9 @@ GetNewTransactionId(bool isSubXact)
TransactionIdIsValid(ShmemVariableCache->xidVacLimit))
{
/*
- * To avoid swamping the postmaster with signals, we issue the
- * autovac request only once per 64K transaction starts. This
- * still gives plenty of chances before we get into real trouble.
+ * To avoid swamping the postmaster with signals, we issue the autovac
+ * request only once per 64K transaction starts. This still gives
+ * plenty of chances before we get into real trouble.
*/
if (IsUnderPostmaster && (xid % 65536) == 0)
SendPostmasterSignal(PMSIGNAL_START_AUTOVAC_LAUNCHER);
@@ -119,9 +119,9 @@ GetNewTransactionId(bool isSubXact)
/*
* We must store the new XID into the shared ProcArray before releasing
- * XidGenLock. This ensures that every active XID older than
- * latestCompletedXid is present in the ProcArray, which is essential
- * for correct OldestXmin tracking; see src/backend/access/transam/README.
+ * XidGenLock. This ensures that every active XID older than
+ * latestCompletedXid is present in the ProcArray, which is essential for
+ * correct OldestXmin tracking; see src/backend/access/transam/README.
*
* XXX by storing xid into MyProc without acquiring ProcArrayLock, we are
* relying on fetch/store of an xid to be atomic, else other backends
@@ -249,18 +249,18 @@ SetTransactionIdLimit(TransactionId oldest_datfrozenxid,
xidWarnLimit -= FirstNormalTransactionId;
/*
- * We'll start trying to force autovacuums when oldest_datfrozenxid
- * gets to be more than autovacuum_freeze_max_age transactions old.
+ * We'll start trying to force autovacuums when oldest_datfrozenxid gets
+ * to be more than autovacuum_freeze_max_age transactions old.
*
- * Note: guc.c ensures that autovacuum_freeze_max_age is in a sane
- * range, so that xidVacLimit will be well before xidWarnLimit.
+ * Note: guc.c ensures that autovacuum_freeze_max_age is in a sane range,
+ * so that xidVacLimit will be well before xidWarnLimit.
*
* Note: autovacuum_freeze_max_age is a PGC_POSTMASTER parameter so that
* we don't have to worry about dealing with on-the-fly changes in its
* value. It doesn't look practical to update shared state from a GUC
* assign hook (too many processes would try to execute the hook,
- * resulting in race conditions as well as crashes of those not
- * connected to shared memory). Perhaps this can be improved someday.
+ * resulting in race conditions as well as crashes of those not connected
+ * to shared memory). Perhaps this can be improved someday.
*/
xidVacLimit = oldest_datfrozenxid + autovacuum_freeze_max_age;
if (xidVacLimit < FirstNormalTransactionId)
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index b7ab958586..04804c3871 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.252 2007/11/10 14:36:44 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.253 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -274,8 +274,8 @@ IsTransactionState(void)
TransactionState s = CurrentTransactionState;
/*
- * TRANS_DEFAULT and TRANS_ABORT are obviously unsafe states. However,
- * we also reject the startup/shutdown states TRANS_START, TRANS_COMMIT,
+ * TRANS_DEFAULT and TRANS_ABORT are obviously unsafe states. However, we
+ * also reject the startup/shutdown states TRANS_START, TRANS_COMMIT,
* TRANS_PREPARE since it might be too soon or too late within those
* transition states to do anything interesting. Hence, the only "valid"
* state is TRANS_INPROGRESS.
@@ -372,7 +372,7 @@ GetCurrentTransactionIdIfAny(void)
static void
AssignTransactionId(TransactionState s)
{
- bool isSubXact = (s->parent != NULL);
+ bool isSubXact = (s->parent != NULL);
ResourceOwner currentOwner;
/* Assert that caller didn't screw up */
@@ -400,9 +400,9 @@ AssignTransactionId(TransactionState s)
SubTransSetParent(s->transactionId, s->parent->transactionId);
/*
- * Acquire lock on the transaction XID. (We assume this cannot block.)
- * We have to ensure that the lock is assigned to the transaction's
- * own ResourceOwner.
+ * Acquire lock on the transaction XID. (We assume this cannot block.) We
+ * have to ensure that the lock is assigned to the transaction's own
+ * ResourceOwner.
*/
currentOwner = CurrentResourceOwner;
PG_TRY();
@@ -626,9 +626,9 @@ AtStart_Memory(void)
/*
* If this is the first time through, create a private context for
* AbortTransaction to work in. By reserving some space now, we can
- * insulate AbortTransaction from out-of-memory scenarios. Like
- * ErrorContext, we set it up with slow growth rate and a nonzero
- * minimum size, so that space will be reserved immediately.
+ * insulate AbortTransaction from out-of-memory scenarios. Like
+ * ErrorContext, we set it up with slow growth rate and a nonzero minimum
+ * size, so that space will be reserved immediately.
*/
if (TransactionAbortContext == NULL)
TransactionAbortContext =
@@ -749,7 +749,7 @@ AtSubStart_ResourceOwner(void)
* RecordTransactionCommit
*
* Returns latest XID among xact and its children, or InvalidTransactionId
- * if the xact has no XID. (We compute that here just because it's easier.)
+ * if the xact has no XID. (We compute that here just because it's easier.)
*
* This is exported only to support an ugly hack in VACUUM FULL.
*/
@@ -757,7 +757,7 @@ TransactionId
RecordTransactionCommit(void)
{
TransactionId xid = GetTopTransactionIdIfAny();
- bool markXidCommitted = TransactionIdIsValid(xid);
+ bool markXidCommitted = TransactionIdIsValid(xid);
TransactionId latestXid = InvalidTransactionId;
int nrels;
RelFileNode *rels;
@@ -770,29 +770,29 @@ RecordTransactionCommit(void)
nchildren = xactGetCommittedChildren(&children);
/*
- * If we haven't been assigned an XID yet, we neither can, nor do we
- * want to write a COMMIT record.
+ * If we haven't been assigned an XID yet, we neither can, nor do we want
+ * to write a COMMIT record.
*/
if (!markXidCommitted)
{
/*
* We expect that every smgrscheduleunlink is followed by a catalog
- * update, and hence XID assignment, so we shouldn't get here with
- * any pending deletes. Use a real test not just an Assert to check
- * this, since it's a bit fragile.
+ * update, and hence XID assignment, so we shouldn't get here with any
+ * pending deletes. Use a real test not just an Assert to check this,
+ * since it's a bit fragile.
*/
if (nrels != 0)
elog(ERROR, "cannot commit a transaction that deleted files but has no xid");
/* Can't have child XIDs either; AssignTransactionId enforces this */
Assert(nchildren == 0);
-
+
/*
* If we didn't create XLOG entries, we're done here; otherwise we
- * should flush those entries the same as a commit record. (An
+ * should flush those entries the same as a commit record. (An
* example of a possible record that wouldn't cause an XID to be
- * assigned is a sequence advance record due to nextval() --- we
- * want to flush that to disk before reporting commit.)
+ * assigned is a sequence advance record due to nextval() --- we want
+ * to flush that to disk before reporting commit.)
*/
if (XactLastRecEnd.xrecoff == 0)
goto cleanup;
@@ -802,30 +802,29 @@ RecordTransactionCommit(void)
/*
* Begin commit critical section and insert the commit XLOG record.
*/
- XLogRecData rdata[3];
- int lastrdata = 0;
- xl_xact_commit xlrec;
+ XLogRecData rdata[3];
+ int lastrdata = 0;
+ xl_xact_commit xlrec;
/* Tell bufmgr and smgr to prepare for commit */
BufmgrCommit();
/*
- * Mark ourselves as within our "commit critical section". This
+ * Mark ourselves as within our "commit critical section". This
* forces any concurrent checkpoint to wait until we've updated
- * pg_clog. Without this, it is possible for the checkpoint to
- * set REDO after the XLOG record but fail to flush the pg_clog
- * update to disk, leading to loss of the transaction commit if
- * the system crashes a little later.
+ * pg_clog. Without this, it is possible for the checkpoint to set
+ * REDO after the XLOG record but fail to flush the pg_clog update to
+ * disk, leading to loss of the transaction commit if the system
+ * crashes a little later.
*
* Note: we could, but don't bother to, set this flag in
- * RecordTransactionAbort. That's because loss of a transaction
- * abort is noncritical; the presumption would be that it aborted,
- * anyway.
+ * RecordTransactionAbort. That's because loss of a transaction abort
+ * is noncritical; the presumption would be that it aborted, anyway.
*
- * It's safe to change the inCommit flag of our own backend
- * without holding the ProcArrayLock, since we're the only one
- * modifying it. This makes checkpoint's determination of which
- * xacts are inCommit a bit fuzzy, but it doesn't matter.
+ * It's safe to change the inCommit flag of our own backend without
+ * holding the ProcArrayLock, since we're the only one modifying it.
+ * This makes checkpoint's determination of which xacts are inCommit a
+ * bit fuzzy, but it doesn't matter.
*/
START_CRIT_SECTION();
MyProc->inCommit = true;
@@ -864,7 +863,7 @@ RecordTransactionCommit(void)
* Check if we want to commit asynchronously. If the user has set
* synchronous_commit = off, and we're not doing cleanup of any non-temp
* rels nor committing any command that wanted to force sync commit, then
- * we can defer flushing XLOG. (We must not allow asynchronous commit if
+ * we can defer flushing XLOG. (We must not allow asynchronous commit if
* there are any non-temp tables to be deleted, because we might delete
* the files before the COMMIT record is flushed to disk. We do allow
* asynchronous commit if all to-be-deleted tables are temporary though,
@@ -875,15 +874,14 @@ RecordTransactionCommit(void)
/*
* Synchronous commit case.
*
- * Sleep before flush! So we can flush more than one commit
- * records per single fsync. (The idea is some other backend
- * may do the XLogFlush while we're sleeping. This needs work
- * still, because on most Unixen, the minimum select() delay
- * is 10msec or more, which is way too long.)
+ * Sleep before flush! So we can flush more than one commit records
+ * per single fsync. (The idea is some other backend may do the
+ * XLogFlush while we're sleeping. This needs work still, because on
+ * most Unixen, the minimum select() delay is 10msec or more, which is
+ * way too long.)
*
- * We do not sleep if enableFsync is not turned on, nor if
- * there are fewer than CommitSiblings other backends with
- * active transactions.
+ * We do not sleep if enableFsync is not turned on, nor if there are
+ * fewer than CommitSiblings other backends with active transactions.
*/
if (CommitDelay > 0 && enableFsync &&
CountActiveBackends() >= CommitSiblings)
@@ -906,15 +904,15 @@ RecordTransactionCommit(void)
/*
* Asynchronous commit case.
*
- * Report the latest async commit LSN, so that
- * the WAL writer knows to flush this commit.
+ * Report the latest async commit LSN, so that the WAL writer knows to
+ * flush this commit.
*/
XLogSetAsyncCommitLSN(XactLastRecEnd);
/*
- * We must not immediately update the CLOG, since we didn't
- * flush the XLOG. Instead, we store the LSN up to which
- * the XLOG must be flushed before the CLOG may be updated.
+ * We must not immediately update the CLOG, since we didn't flush the
+ * XLOG. Instead, we store the LSN up to which the XLOG must be
+ * flushed before the CLOG may be updated.
*/
if (markXidCommitted)
{
@@ -925,8 +923,8 @@ RecordTransactionCommit(void)
}
/*
- * If we entered a commit critical section, leave it now, and
- * let checkpoints proceed.
+ * If we entered a commit critical section, leave it now, and let
+ * checkpoints proceed.
*/
if (markXidCommitted)
{
@@ -1068,11 +1066,11 @@ RecordSubTransactionCommit(void)
* We do not log the subcommit in XLOG; it doesn't matter until the
* top-level transaction commits.
*
- * We must mark the subtransaction subcommitted in the CLOG if
- * it had a valid XID assigned. If it did not, nobody else will
- * ever know about the existence of this subxact. We don't
- * have to deal with deletions scheduled for on-commit here, since
- * they'll be reassigned to our parent (who might still abort).
+ * We must mark the subtransaction subcommitted in the CLOG if it had a
+ * valid XID assigned. If it did not, nobody else will ever know about
+ * the existence of this subxact. We don't have to deal with deletions
+ * scheduled for on-commit here, since they'll be reassigned to our parent
+ * (who might still abort).
*/
if (TransactionIdIsValid(xid))
{
@@ -1095,7 +1093,7 @@ RecordSubTransactionCommit(void)
* RecordTransactionAbort
*
* Returns latest XID among xact and its children, or InvalidTransactionId
- * if the xact has no XID. (We compute that here just because it's easier.)
+ * if the xact has no XID. (We compute that here just because it's easier.)
*/
static TransactionId
RecordTransactionAbort(bool isSubXact)
@@ -1106,15 +1104,15 @@ RecordTransactionAbort(bool isSubXact)
RelFileNode *rels;
int nchildren;
TransactionId *children;
- XLogRecData rdata[3];
- int lastrdata = 0;
- xl_xact_abort xlrec;
+ XLogRecData rdata[3];
+ int lastrdata = 0;
+ xl_xact_abort xlrec;
/*
- * If we haven't been assigned an XID, nobody will care whether we
- * aborted or not. Hence, we're done in that case. It does not matter
- * if we have rels to delete (note that this routine is not responsible
- * for actually deleting 'em). We cannot have any child XIDs, either.
+ * If we haven't been assigned an XID, nobody will care whether we aborted
+ * or not. Hence, we're done in that case. It does not matter if we have
+ * rels to delete (note that this routine is not responsible for actually
+ * deleting 'em). We cannot have any child XIDs, either.
*/
if (!TransactionIdIsValid(xid))
{
@@ -1128,7 +1126,7 @@ RecordTransactionAbort(bool isSubXact)
* We have a valid XID, so we should write an ABORT record for it.
*
* We do not flush XLOG to disk here, since the default assumption after a
- * crash would be that we aborted, anyway. For the same reason, we don't
+ * crash would be that we aborted, anyway. For the same reason, we don't
* need to worry about interlocking against checkpoint start.
*/
@@ -1189,10 +1187,10 @@ RecordTransactionAbort(bool isSubXact)
* having flushed the ABORT record to disk, because in event of a crash
* we'd be assumed to have aborted anyway.
*
- * The ordering here isn't critical but it seems best to mark the
- * parent first. This assures an atomic transition of all the
- * subtransactions to aborted state from the point of view of
- * concurrent TransactionIdDidAbort calls.
+ * The ordering here isn't critical but it seems best to mark the parent
+ * first. This assures an atomic transition of all the subtransactions to
+ * aborted state from the point of view of concurrent
+ * TransactionIdDidAbort calls.
*/
TransactionIdAbort(xid);
TransactionIdAbortTree(nchildren, children);
@@ -1231,9 +1229,9 @@ static void
AtAbort_Memory(void)
{
/*
- * Switch into TransactionAbortContext, which should have some free
- * space even if nothing else does. We'll work in this context until
- * we've finished cleaning up.
+ * Switch into TransactionAbortContext, which should have some free space
+ * even if nothing else does. We'll work in this context until we've
+ * finished cleaning up.
*
* It is barely possible to get here when we've not been able to create
* TransactionAbortContext yet; if so use TopMemoryContext.
@@ -1438,7 +1436,7 @@ StartTransaction(void)
VirtualXactLockTableInsert(vxid);
/*
- * Advertise it in the proc array. We assume assignment of
+ * Advertise it in the proc array. We assume assignment of
* LocalTransactionID is atomic, and the backendId should be set already.
*/
Assert(MyProc->backendId == vxid.backendId);
@@ -1449,8 +1447,8 @@ StartTransaction(void)
/*
* set transaction_timestamp() (a/k/a now()). We want this to be the same
* as the first command's statement_timestamp(), so don't do a fresh
- * GetCurrentTimestamp() call (which'd be expensive anyway). Also,
- * mark xactStopTimestamp as unset.
+ * GetCurrentTimestamp() call (which'd be expensive anyway). Also, mark
+ * xactStopTimestamp as unset.
*/
xactStartTimestamp = stmtStartTimestamp;
xactStopTimestamp = 0;
@@ -1576,8 +1574,8 @@ CommitTransaction(void)
PG_TRACE1(transaction__commit, MyProc->lxid);
/*
- * Let others know about no transaction in progress by me. Note that
- * this must be done _before_ releasing locks we hold and _after_
+ * Let others know about no transaction in progress by me. Note that this
+ * must be done _before_ releasing locks we hold and _after_
* RecordTransactionCommit.
*/
ProcArrayEndTransaction(MyProc, latestXid);
@@ -2503,7 +2501,7 @@ AbortCurrentTransaction(void)
* inside a function or multi-query querystring. (We will always fail if
* this is false, but it's convenient to centralize the check here instead of
* making callers do it.)
- * stmtType: statement type name, for error messages.
+ * stmtType: statement type name, for error messages.
*/
void
PreventTransactionChain(bool isTopLevel, const char *stmtType)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 36adc20848..3218c134e5 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.287 2007/11/15 20:36:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.288 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,7 +80,7 @@ bool XLOG_DEBUG = false;
* future XLOG segment as long as there aren't already XLOGfileslop future
* segments; else we'll delete it. This could be made a separate GUC
* variable, but at present I think it's sufficient to hardwire it as
- * 2*CheckPointSegments+1. Under normal conditions, a checkpoint will free
+ * 2*CheckPointSegments+1. Under normal conditions, a checkpoint will free
* no more than 2*CheckPointSegments log segments, and we want to recycle all
* of them; the +1 allows boundary cases to happen without wasting a
* delete/create-segment cycle.
@@ -287,7 +287,7 @@ typedef struct XLogCtlData
XLogwrtResult LogwrtResult;
uint32 ckptXidEpoch; /* nextXID & epoch of latest checkpoint */
TransactionId ckptXid;
- XLogRecPtr asyncCommitLSN; /* LSN of newest async commit */
+ XLogRecPtr asyncCommitLSN; /* LSN of newest async commit */
/* Protected by WALWriteLock: */
XLogCtlWrite Write;
@@ -737,8 +737,8 @@ begin:;
* full-block records into the non-full-block format.
*
* Note: we could just set the flag whenever !forcePageWrites, but
- * defining it like this leaves the info bit free for some potential
- * other use in records without any backup blocks.
+ * defining it like this leaves the info bit free for some potential other
+ * use in records without any backup blocks.
*/
if ((info & XLR_BKP_BLOCK_MASK) && !Insert->forcePageWrites)
info |= XLR_BKP_REMOVABLE;
@@ -1345,10 +1345,10 @@ static bool
XLogCheckpointNeeded(void)
{
/*
- * A straight computation of segment number could overflow 32
- * bits. Rather than assuming we have working 64-bit
- * arithmetic, we compare the highest-order bits separately,
- * and force a checkpoint immediately when they change.
+ * A straight computation of segment number could overflow 32 bits.
+ * Rather than assuming we have working 64-bit arithmetic, we compare the
+ * highest-order bits separately, and force a checkpoint immediately when
+ * they change.
*/
uint32 old_segno,
new_segno;
@@ -1361,7 +1361,7 @@ XLogCheckpointNeeded(void)
new_segno = (openLogId % XLogSegSize) * XLogSegsPerFile + openLogSeg;
new_highbits = openLogId / XLogSegSize;
if (new_highbits != old_highbits ||
- new_segno >= old_segno + (uint32) (CheckPointSegments-1))
+ new_segno >= old_segno + (uint32) (CheckPointSegments - 1))
return true;
return false;
}
@@ -1558,9 +1558,9 @@ XLogWrite(XLogwrtRqst WriteRqst, bool flexible, bool xlog_switch)
/*
* Signal bgwriter to start a checkpoint if we've consumed too
* much xlog since the last one. For speed, we first check
- * using the local copy of RedoRecPtr, which might be
- * out of date; if it looks like a checkpoint is needed,
- * forcibly update RedoRecPtr and recheck.
+ * using the local copy of RedoRecPtr, which might be out of
+ * date; if it looks like a checkpoint is needed, forcibly
+ * update RedoRecPtr and recheck.
*/
if (IsUnderPostmaster &&
XLogCheckpointNeeded())
@@ -1779,9 +1779,9 @@ XLogFlush(XLogRecPtr record)
* We normally flush only completed blocks; but if there is nothing to do on
* that basis, we check for unflushed async commits in the current incomplete
* block, and flush through the latest one of those. Thus, if async commits
- * are not being used, we will flush complete blocks only. We can guarantee
+ * are not being used, we will flush complete blocks only. We can guarantee
* that async commits reach disk after at most three cycles; normally only
- * one or two. (We allow XLogWrite to write "flexibly", meaning it can stop
+ * one or two. (We allow XLogWrite to write "flexibly", meaning it can stop
* at the end of the buffer ring; this makes a difference only with very high
* load or long wal_writer_delay, but imposes one extra cycle for the worst
* case for async commits.)
@@ -1861,6 +1861,7 @@ void
XLogAsyncCommitFlush(void)
{
XLogRecPtr WriteRqstPtr;
+
/* use volatile pointer to prevent code rearrangement */
volatile XLogCtlData *xlogctl = XLogCtl;
@@ -2252,7 +2253,7 @@ InstallXLogFileSegment(uint32 *log, uint32 *seg, char *tmppath,
LWLockRelease(ControlFileLock);
return false;
}
-#endif /* WIN32 */
+#endif /* WIN32 */
ereport(ERROR,
(errcode_for_file_access(),
@@ -2432,8 +2433,8 @@ RestoreArchivedFile(char *path, const char *xlogfname,
int rc;
bool signaled;
struct stat stat_buf;
- uint32 restartLog;
- uint32 restartSeg;
+ uint32 restartLog;
+ uint32 restartSeg;
/*
* When doing archive recovery, we always prefer an archived log file even
@@ -2511,8 +2512,8 @@ RestoreArchivedFile(char *path, const char *xlogfname,
sp++;
XLByteToSeg(ControlFile->checkPointCopy.redo,
restartLog, restartSeg);
- XLogFileName(lastRestartPointFname,
- ControlFile->checkPointCopy.ThisTimeLineID,
+ XLogFileName(lastRestartPointFname,
+ ControlFile->checkPointCopy.ThisTimeLineID,
restartLog, restartSeg);
StrNCpy(dp, lastRestartPointFname, endp - dp);
dp += strlen(dp);
@@ -2594,17 +2595,17 @@ RestoreArchivedFile(char *path, const char *xlogfname,
* incorrectly. We have to assume the former.
*
* However, if the failure was due to any sort of signal, it's best to
- * punt and abort recovery. (If we "return false" here, upper levels
- * will assume that recovery is complete and start up the database!)
- * It's essential to abort on child SIGINT and SIGQUIT, because per spec
+ * punt and abort recovery. (If we "return false" here, upper levels will
+ * assume that recovery is complete and start up the database!) It's
+ * essential to abort on child SIGINT and SIGQUIT, because per spec
* system() ignores SIGINT and SIGQUIT while waiting; if we see one of
* those it's a good bet we should have gotten it too. Aborting on other
* signals such as SIGTERM seems a good idea as well.
*
- * Per the Single Unix Spec, shells report exit status > 128 when
- * a called command died on a signal. Also, 126 and 127 are used to
- * report problems such as an unfindable command; treat those as fatal
- * errors too.
+ * Per the Single Unix Spec, shells report exit status > 128 when a called
+ * command died on a signal. Also, 126 and 127 are used to report
+ * problems such as an unfindable command; treat those as fatal errors
+ * too.
*/
signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 125;
@@ -3981,8 +3982,8 @@ ReadControlFile(void)
ereport(FATAL,
(errmsg("database files are incompatible with server"),
errdetail("The database cluster was initialized with TOAST_MAX_CHUNK_SIZE %d,"
- " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.",
- ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE),
+ " but the server was compiled with TOAST_MAX_CHUNK_SIZE %d.",
+ ControlFile->toast_max_chunk_size, (int) TOAST_MAX_CHUNK_SIZE),
errhint("It looks like you need to recompile or initdb.")));
#ifdef HAVE_INT64_TIMESTAMP
@@ -4430,7 +4431,7 @@ readRecoveryCommandFile(void)
*/
recoveryTargetTime =
DatumGetTimestampTz(DirectFunctionCall3(timestamptz_in,
- CStringGetDatum(tok2),
+ CStringGetDatum(tok2),
ObjectIdGetDatum(InvalidOid),
Int32GetDatum(-1)));
ereport(LOG,
@@ -4629,7 +4630,7 @@ recoveryStopsHere(XLogRecord *record, bool *includeThis)
{
bool stopsHere;
uint8 record_info;
- TimestampTz recordXtime;
+ TimestampTz recordXtime;
/* We only consider stopping at COMMIT or ABORT records */
if (record->xl_rmid != RM_XACT_ID)
@@ -4781,11 +4782,11 @@ StartupXLOG(void)
(errmsg("database system was interrupted while in recovery at log time %s",
str_time(ControlFile->checkPointCopy.time)),
errhint("If this has occurred more than once some data might be corrupted"
- " and you might need to choose an earlier recovery target.")));
+ " and you might need to choose an earlier recovery target.")));
else if (ControlFile->state == DB_IN_PRODUCTION)
ereport(LOG,
- (errmsg("database system was interrupted; last known up at %s",
- str_time(ControlFile->time))));
+ (errmsg("database system was interrupted; last known up at %s",
+ str_time(ControlFile->time))));
/* This is just to allow attaching to startup process with a debugger */
#ifdef XLOG_REPLAY_DELAY
@@ -4879,9 +4880,9 @@ StartupXLOG(void)
wasShutdown = (record->xl_info == XLOG_CHECKPOINT_SHUTDOWN);
ereport(DEBUG1,
- (errmsg("redo record is at %X/%X; shutdown %s",
- checkPoint.redo.xlogid, checkPoint.redo.xrecoff,
- wasShutdown ? "TRUE" : "FALSE")));
+ (errmsg("redo record is at %X/%X; shutdown %s",
+ checkPoint.redo.xlogid, checkPoint.redo.xrecoff,
+ wasShutdown ? "TRUE" : "FALSE")));
ereport(DEBUG1,
(errmsg("next transaction ID: %u/%u; next OID: %u",
checkPoint.nextXidEpoch, checkPoint.nextXid,
@@ -4920,7 +4921,7 @@ StartupXLOG(void)
{
if (wasShutdown)
ereport(PANIC,
- (errmsg("invalid redo record in shutdown checkpoint")));
+ (errmsg("invalid redo record in shutdown checkpoint")));
InRecovery = true;
}
else if (ControlFile->state != DB_SHUTDOWNED)
@@ -5045,7 +5046,7 @@ StartupXLOG(void)
*/
if (recoveryStopsHere(record, &recoveryApply))
{
- reachedStopPoint = true; /* see below */
+ reachedStopPoint = true; /* see below */
recoveryContinue = false;
if (!recoveryApply)
break;
@@ -5087,8 +5088,8 @@ StartupXLOG(void)
ReadRecPtr.xlogid, ReadRecPtr.xrecoff)));
if (recoveryLastXTime)
ereport(LOG,
- (errmsg("last completed transaction was at log time %s",
- timestamptz_to_str(recoveryLastXTime))));
+ (errmsg("last completed transaction was at log time %s",
+ timestamptz_to_str(recoveryLastXTime))));
InRedo = false;
}
else
@@ -5116,7 +5117,7 @@ StartupXLOG(void)
if (reachedStopPoint) /* stopped because of stop request */
ereport(FATAL,
(errmsg("requested recovery stop point is before end time of backup dump")));
- else /* ran off end of WAL */
+ else /* ran off end of WAL */
ereport(FATAL,
(errmsg("WAL ends before end time of backup dump")));
}
@@ -5124,12 +5125,12 @@ StartupXLOG(void)
/*
* Consider whether we need to assign a new timeline ID.
*
- * If we are doing an archive recovery, we always assign a new ID. This
- * handles a couple of issues. If we stopped short of the end of WAL
+ * If we are doing an archive recovery, we always assign a new ID. This
+ * handles a couple of issues. If we stopped short of the end of WAL
* during recovery, then we are clearly generating a new timeline and must
* assign it a unique new ID. Even if we ran to the end, modifying the
- * current last segment is problematic because it may result in trying
- * to overwrite an already-archived copy of that segment, and we encourage
+ * current last segment is problematic because it may result in trying to
+ * overwrite an already-archived copy of that segment, and we encourage
* DBAs to make their archive_commands reject that. We can dodge the
* problem by making the new active segment have a new timeline ID.
*
@@ -5472,7 +5473,7 @@ GetInsertRecPtr(void)
{
/* use volatile pointer to prevent code rearrangement */
volatile XLogCtlData *xlogctl = XLogCtl;
- XLogRecPtr recptr;
+ XLogRecPtr recptr;
SpinLockAcquire(&xlogctl->info_lck);
recptr = xlogctl->LogwrtRqst.Write;
@@ -5576,8 +5577,12 @@ LogCheckpointStart(int flags)
static void
LogCheckpointEnd(void)
{
- long write_secs, sync_secs, total_secs;
- int write_usecs, sync_usecs, total_usecs;
+ long write_secs,
+ sync_secs,
+ total_secs;
+ int write_usecs,
+ sync_usecs,
+ total_usecs;
CheckpointStats.ckpt_end_t = GetCurrentTimestamp();
@@ -5601,9 +5606,9 @@ LogCheckpointEnd(void)
CheckpointStats.ckpt_segs_added,
CheckpointStats.ckpt_segs_removed,
CheckpointStats.ckpt_segs_recycled,
- write_secs, write_usecs/1000,
- sync_secs, sync_usecs/1000,
- total_secs, total_usecs/1000);
+ write_secs, write_usecs / 1000,
+ sync_secs, sync_usecs / 1000,
+ total_secs, total_usecs / 1000);
}
/*
@@ -5665,9 +5670,9 @@ CreateCheckPoint(int flags)
}
/*
- * Let smgr prepare for checkpoint; this has to happen before we
- * determine the REDO pointer. Note that smgr must not do anything
- * that'd have to be undone if we decide no checkpoint is needed.
+ * Let smgr prepare for checkpoint; this has to happen before we determine
+ * the REDO pointer. Note that smgr must not do anything that'd have to
+ * be undone if we decide no checkpoint is needed.
*/
smgrpreckpt();
@@ -5761,8 +5766,8 @@ CreateCheckPoint(int flags)
LWLockRelease(WALInsertLock);
/*
- * If enabled, log checkpoint start. We postpone this until now
- * so as not to log anything if we decided to skip the checkpoint.
+ * If enabled, log checkpoint start. We postpone this until now so as not
+ * to log anything if we decided to skip the checkpoint.
*/
if (log_checkpoints)
LogCheckpointStart(flags);
@@ -5782,11 +5787,11 @@ CreateCheckPoint(int flags)
* checkpoint take a bit longer than to hold locks longer than necessary.
* (In fact, the whole reason we have this issue is that xact.c does
* commit record XLOG insertion and clog update as two separate steps
- * protected by different locks, but again that seems best on grounds
- * of minimizing lock contention.)
+ * protected by different locks, but again that seems best on grounds of
+ * minimizing lock contention.)
*
- * A transaction that has not yet set inCommit when we look cannot be
- * at risk, since he's not inserted his commit record yet; and one that's
+ * A transaction that has not yet set inCommit when we look cannot be at
+ * risk, since he's not inserted his commit record yet; and one that's
* already cleared it is not at risk either, since he's done fixing clog
* and we will correctly flush the update below. So we cannot miss any
* xacts we need to wait for.
@@ -5794,8 +5799,9 @@ CreateCheckPoint(int flags)
nInCommit = GetTransactionsInCommit(&inCommitXids);
if (nInCommit > 0)
{
- do {
- pg_usleep(10000L); /* wait for 10 msec */
+ do
+ {
+ pg_usleep(10000L); /* wait for 10 msec */
} while (HaveTransactionsInCommit(inCommitXids, nInCommit));
}
pfree(inCommitXids);
@@ -5946,7 +5952,7 @@ CheckPointGuts(XLogRecPtr checkPointRedo, int flags)
CheckPointCLOG();
CheckPointSUBTRANS();
CheckPointMultiXact();
- CheckPointBuffers(flags); /* performs all required fsyncs */
+ CheckPointBuffers(flags); /* performs all required fsyncs */
/* We deliberately delay 2PC checkpointing as long as possible */
CheckPointTwoPhase(checkPointRedo);
}
@@ -6046,14 +6052,14 @@ XLogPutNextOid(Oid nextOid)
* does.
*
* Note, however, that the above statement only covers state "within" the
- * database. When we use a generated OID as a file or directory name,
- * we are in a sense violating the basic WAL rule, because that filesystem
+ * database. When we use a generated OID as a file or directory name, we
+ * are in a sense violating the basic WAL rule, because that filesystem
* change may reach disk before the NEXTOID WAL record does. The impact
- * of this is that if a database crash occurs immediately afterward,
- * we might after restart re-generate the same OID and find that it
- * conflicts with the leftover file or directory. But since for safety's
- * sake we always loop until finding a nonconflicting filename, this poses
- * no real problem in practice. See pgsql-hackers discussion 27-Sep-2006.
+ * of this is that if a database crash occurs immediately afterward, we
+ * might after restart re-generate the same OID and find that it conflicts
+ * with the leftover file or directory. But since for safety's sake we
+ * always loop until finding a nonconflicting filename, this poses no real
+ * problem in practice. See pgsql-hackers discussion 27-Sep-2006.
*/
}
@@ -6673,7 +6679,7 @@ pg_switch_xlog(PG_FUNCTION_ARGS)
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- (errmsg("must be superuser to switch transaction log files"))));
+ (errmsg("must be superuser to switch transaction log files"))));
switchpoint = RequestXLogSwitch();
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index c142085637..83b5ee878c 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.236 2007/08/02 23:39:44 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.237 2007/11/15 21:14:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -205,7 +205,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
{
char *progname = argv[0];
int flag;
- AuxProcType auxType = CheckerProcess;
+ AuxProcType auxType = CheckerProcess;
char *userDoption = NULL;
/*
@@ -431,7 +431,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
InitXLOGAccess();
WalWriterMain();
proc_exit(1); /* should never return */
-
+
default:
elog(PANIC, "unrecognized process type: %d", auxType);
proc_exit(1);
@@ -568,7 +568,7 @@ bootstrap_signals(void)
}
/*
- * Begin shutdown of an auxiliary process. This is approximately the equivalent
+ * Begin shutdown of an auxiliary process. This is approximately the equivalent
* of ShutdownPostgres() in postinit.c. We can't run transactions in an
* auxiliary process, so most of the work of AbortTransaction() is not needed,
* but we do need to make sure we've released any LWLocks we are holding.
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 622901a69d..e8c9ea296f 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.141 2007/10/12 18:55:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.142 2007/11/15 21:14:32 momjian Exp $
*
* NOTES
* See acl.h.
@@ -2348,8 +2348,8 @@ pg_ts_config_ownercheck(Oid cfg_oid, Oid roleid)
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("text search configuration with OID %u does not exist",
- cfg_oid)));
+ errmsg("text search configuration with OID %u does not exist",
+ cfg_oid)));
ownerId = ((Form_pg_ts_config) GETSTRUCT(tuple))->cfgowner;
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index 51bb4ba17f..c562223ddb 100644
--- a/src/backend/catalog/dependency.c
+++ b/src/backend/catalog/dependency.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.67 2007/08/21 01:11:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.68 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -85,29 +85,29 @@ typedef struct
* See also getObjectClass().
*/
static const Oid object_classes[MAX_OCLASS] = {
- RelationRelationId, /* OCLASS_CLASS */
- ProcedureRelationId, /* OCLASS_PROC */
- TypeRelationId, /* OCLASS_TYPE */
- CastRelationId, /* OCLASS_CAST */
- ConstraintRelationId, /* OCLASS_CONSTRAINT */
- ConversionRelationId, /* OCLASS_CONVERSION */
- AttrDefaultRelationId, /* OCLASS_DEFAULT */
- LanguageRelationId, /* OCLASS_LANGUAGE */
- OperatorRelationId, /* OCLASS_OPERATOR */
- OperatorClassRelationId, /* OCLASS_OPCLASS */
- OperatorFamilyRelationId, /* OCLASS_OPFAMILY */
+ RelationRelationId, /* OCLASS_CLASS */
+ ProcedureRelationId, /* OCLASS_PROC */
+ TypeRelationId, /* OCLASS_TYPE */
+ CastRelationId, /* OCLASS_CAST */
+ ConstraintRelationId, /* OCLASS_CONSTRAINT */
+ ConversionRelationId, /* OCLASS_CONVERSION */
+ AttrDefaultRelationId, /* OCLASS_DEFAULT */
+ LanguageRelationId, /* OCLASS_LANGUAGE */
+ OperatorRelationId, /* OCLASS_OPERATOR */
+ OperatorClassRelationId, /* OCLASS_OPCLASS */
+ OperatorFamilyRelationId, /* OCLASS_OPFAMILY */
AccessMethodOperatorRelationId, /* OCLASS_AMOP */
AccessMethodProcedureRelationId, /* OCLASS_AMPROC */
- RewriteRelationId, /* OCLASS_REWRITE */
- TriggerRelationId, /* OCLASS_TRIGGER */
- NamespaceRelationId, /* OCLASS_SCHEMA */
- TSParserRelationId, /* OCLASS_TSPARSER */
- TSDictionaryRelationId, /* OCLASS_TSDICT */
- TSTemplateRelationId, /* OCLASS_TSTEMPLATE */
- TSConfigRelationId, /* OCLASS_TSCONFIG */
- AuthIdRelationId, /* OCLASS_ROLE */
- DatabaseRelationId, /* OCLASS_DATABASE */
- TableSpaceRelationId /* OCLASS_TBLSPACE */
+ RewriteRelationId, /* OCLASS_REWRITE */
+ TriggerRelationId, /* OCLASS_TRIGGER */
+ NamespaceRelationId, /* OCLASS_SCHEMA */
+ TSParserRelationId, /* OCLASS_TSPARSER */
+ TSDictionaryRelationId, /* OCLASS_TSDICT */
+ TSTemplateRelationId, /* OCLASS_TSTEMPLATE */
+ TSConfigRelationId, /* OCLASS_TSCONFIG */
+ AuthIdRelationId, /* OCLASS_ROLE */
+ DatabaseRelationId, /* OCLASS_DATABASE */
+ TableSpaceRelationId /* OCLASS_TBLSPACE */
};
@@ -1012,7 +1012,7 @@ doDeletion(const ObjectAddress *object)
RemoveTSConfigurationById(object->objectId);
break;
- /* OCLASS_ROLE, OCLASS_DATABASE, OCLASS_TBLSPACE not handled */
+ /* OCLASS_ROLE, OCLASS_DATABASE, OCLASS_TBLSPACE not handled */
default:
elog(ERROR, "unrecognized object class: %u",
@@ -2162,7 +2162,7 @@ getObjectDescription(const ObjectAddress *object)
elog(ERROR, "cache lookup failed for text search parser %u",
object->objectId);
appendStringInfo(&buffer, _("text search parser %s"),
- NameStr(((Form_pg_ts_parser) GETSTRUCT(tup))->prsname));
+ NameStr(((Form_pg_ts_parser) GETSTRUCT(tup))->prsname));
ReleaseSysCache(tup);
break;
}
@@ -2178,7 +2178,7 @@ getObjectDescription(const ObjectAddress *object)
elog(ERROR, "cache lookup failed for text search dictionary %u",
object->objectId);
appendStringInfo(&buffer, _("text search dictionary %s"),
- NameStr(((Form_pg_ts_dict) GETSTRUCT(tup))->dictname));
+ NameStr(((Form_pg_ts_dict) GETSTRUCT(tup))->dictname));
ReleaseSysCache(tup);
break;
}
@@ -2194,7 +2194,7 @@ getObjectDescription(const ObjectAddress *object)
elog(ERROR, "cache lookup failed for text search template %u",
object->objectId);
appendStringInfo(&buffer, _("text search template %s"),
- NameStr(((Form_pg_ts_template) GETSTRUCT(tup))->tmplname));
+ NameStr(((Form_pg_ts_template) GETSTRUCT(tup))->tmplname));
ReleaseSysCache(tup);
break;
}
@@ -2210,7 +2210,7 @@ getObjectDescription(const ObjectAddress *object)
elog(ERROR, "cache lookup failed for text search configuration %u",
object->objectId);
appendStringInfo(&buffer, _("text search configuration %s"),
- NameStr(((Form_pg_ts_config) GETSTRUCT(tup))->cfgname));
+ NameStr(((Form_pg_ts_config) GETSTRUCT(tup))->cfgname));
ReleaseSysCache(tup);
break;
}
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index d22bb77a50..d436760b97 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.325 2007/10/29 19:40:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.326 2007/11/15 21:14:33 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -408,7 +408,7 @@ CheckAttributeType(const char *attname, Oid atttypid)
{
/*
* Warn user, but don't fail, if column to be created has UNKNOWN type
- * (usually as a result of a 'retrieve into' - jolly)
+ * (usually as a result of a 'retrieve into' - jolly)
*/
ereport(WARNING,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
@@ -418,8 +418,8 @@ CheckAttributeType(const char *attname, Oid atttypid)
else if (att_typtype == TYPTYPE_PSEUDO)
{
/*
- * Refuse any attempt to create a pseudo-type column, except for
- * a special hack for pg_statistic: allow ANYARRAY during initdb
+ * Refuse any attempt to create a pseudo-type column, except for a
+ * special hack for pg_statistic: allow ANYARRAY during initdb
*/
if (atttypid != ANYARRAYOID || IsUnderPostmaster)
ereport(ERROR,
@@ -430,13 +430,13 @@ CheckAttributeType(const char *attname, Oid atttypid)
else if (att_typtype == TYPTYPE_COMPOSITE)
{
/*
- * For a composite type, recurse into its attributes. You might
- * think this isn't necessary, but since we allow system catalogs
- * to break the rule, we have to guard against the case.
+ * For a composite type, recurse into its attributes. You might think
+ * this isn't necessary, but since we allow system catalogs to break
+ * the rule, we have to guard against the case.
*/
- Relation relation;
- TupleDesc tupdesc;
- int i;
+ Relation relation;
+ TupleDesc tupdesc;
+ int i;
relation = relation_open(get_typ_typrelid(atttypid), AccessShareLock);
@@ -702,17 +702,17 @@ AddNewRelationTuple(Relation pg_class_desc,
{
/*
* Initialize to the minimum XID that could put tuples in the table.
- * We know that no xacts older than RecentXmin are still running,
- * so that will do.
+ * We know that no xacts older than RecentXmin are still running, so
+ * that will do.
*/
new_rel_reltup->relfrozenxid = RecentXmin;
}
else
{
/*
- * Other relation types will not contain XIDs, so set relfrozenxid
- * to InvalidTransactionId. (Note: a sequence does contain a tuple,
- * but we force its xmin to be FrozenTransactionId always; see
+ * Other relation types will not contain XIDs, so set relfrozenxid to
+ * InvalidTransactionId. (Note: a sequence does contain a tuple, but
+ * we force its xmin to be FrozenTransactionId always; see
* commands/sequence.c.)
*/
new_rel_reltup->relfrozenxid = InvalidTransactionId;
@@ -740,7 +740,7 @@ AddNewRelationType(const char *typeName,
Oid typeNamespace,
Oid new_rel_oid,
char new_rel_kind,
- Oid new_array_type)
+ Oid new_array_type)
{
return
TypeCreate(InvalidOid, /* no predetermined OID */
@@ -760,7 +760,7 @@ AddNewRelationType(const char *typeName,
InvalidOid, /* analyze procedure - default */
InvalidOid, /* array element type - irrelevant */
false, /* this is not an array type */
- new_array_type, /* array type if any */
+ new_array_type, /* array type if any */
InvalidOid, /* domain base type - irrelevant */
NULL, /* default value - none */
NULL, /* default binary representation */
@@ -797,7 +797,7 @@ heap_create_with_catalog(const char *relname,
Relation new_rel_desc;
Oid old_type_oid;
Oid new_type_oid;
- Oid new_array_oid = InvalidOid;
+ Oid new_array_oid = InvalidOid;
pg_class_desc = heap_open(RelationRelationId, RowExclusiveLock);
@@ -815,9 +815,9 @@ heap_create_with_catalog(const char *relname,
/*
* Since we are going to create a rowtype as well, also check for
- * collision with an existing type name. If there is one and it's
- * an autogenerated array, we can rename it out of the way; otherwise
- * we can at least give a good error message.
+ * collision with an existing type name. If there is one and it's an
+ * autogenerated array, we can rename it out of the way; otherwise we can
+ * at least give a good error message.
*/
old_type_oid = GetSysCacheOid(TYPENAMENSP,
CStringGetDatum(relname),
@@ -829,9 +829,9 @@ heap_create_with_catalog(const char *relname,
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("type \"%s\" already exists", relname),
- errhint("A relation has an associated type of the same name, "
- "so you must use a name that doesn't conflict "
- "with any existing type.")));
+ errhint("A relation has an associated type of the same name, "
+ "so you must use a name that doesn't conflict "
+ "with any existing type.")));
}
/*
@@ -880,9 +880,9 @@ heap_create_with_catalog(const char *relname,
Assert(relid == RelationGetRelid(new_rel_desc));
/*
- * Decide whether to create an array type over the relation's rowtype.
- * We do not create any array types for system catalogs (ie, those made
- * during initdb). We create array types for regular relations, views,
+ * Decide whether to create an array type over the relation's rowtype. We
+ * do not create any array types for system catalogs (ie, those made
+ * during initdb). We create array types for regular relations, views,
* and composite types ... but not, eg, for toast tables or sequences.
*/
if (IsUnderPostmaster && (relkind == RELKIND_RELATION ||
@@ -890,7 +890,7 @@ heap_create_with_catalog(const char *relname,
relkind == RELKIND_COMPOSITE_TYPE))
{
/* OK, so pre-assign a type OID for the array type */
- Relation pg_type = heap_open(TypeRelationId, AccessShareLock);
+ Relation pg_type = heap_open(TypeRelationId, AccessShareLock);
new_array_oid = GetNewOid(pg_type);
heap_close(pg_type, AccessShareLock);
@@ -901,14 +901,15 @@ heap_create_with_catalog(const char *relname,
* system type corresponding to the new relation.
*
* NOTE: we could get a unique-index failure here, in case someone else is
- * creating the same type name in parallel but hadn't committed yet
- * when we checked for a duplicate name above.
+ * creating the same type name in parallel but hadn't committed yet when
+ * we checked for a duplicate name above.
*/
new_type_oid = AddNewRelationType(relname,
relnamespace,
relid,
relkind,
- new_array_oid);
+ new_array_oid);
+
/*
* Now make the array type if wanted.
*/
@@ -919,32 +920,32 @@ heap_create_with_catalog(const char *relname,
relarrayname = makeArrayTypeName(relname, relnamespace);
TypeCreate(new_array_oid, /* force the type's OID to this */
- relarrayname, /* Array type name */
- relnamespace, /* Same namespace as parent */
- InvalidOid, /* Not composite, no relationOid */
- 0, /* relkind, also N/A here */
- -1, /* Internal size (varlena) */
- TYPTYPE_BASE, /* Not composite - typelem is */
+ relarrayname, /* Array type name */
+ relnamespace, /* Same namespace as parent */
+ InvalidOid, /* Not composite, no relationOid */
+ 0, /* relkind, also N/A here */
+ -1, /* Internal size (varlena) */
+ TYPTYPE_BASE, /* Not composite - typelem is */
DEFAULT_TYPDELIM, /* default array delimiter */
- F_ARRAY_IN, /* array input proc */
- F_ARRAY_OUT, /* array output proc */
- F_ARRAY_RECV, /* array recv (bin) proc */
- F_ARRAY_SEND, /* array send (bin) proc */
- InvalidOid, /* typmodin procedure - none */
- InvalidOid, /* typmodout procedure - none */
- InvalidOid, /* analyze procedure - default */
- new_type_oid, /* array element type - the rowtype */
- true, /* yes, this is an array type */
- InvalidOid, /* this has no array type */
- InvalidOid, /* domain base type - irrelevant */
- NULL, /* default value - none */
- NULL, /* default binary representation */
- false, /* passed by reference */
- 'd', /* alignment - must be the largest! */
- 'x', /* fully TOASTable */
- -1, /* typmod */
- 0, /* array dimensions for typBaseType */
- false); /* Type NOT NULL */
+ F_ARRAY_IN, /* array input proc */
+ F_ARRAY_OUT, /* array output proc */
+ F_ARRAY_RECV, /* array recv (bin) proc */
+ F_ARRAY_SEND, /* array send (bin) proc */
+ InvalidOid, /* typmodin procedure - none */
+ InvalidOid, /* typmodout procedure - none */
+ InvalidOid, /* analyze procedure - default */
+ new_type_oid, /* array element type - the rowtype */
+ true, /* yes, this is an array type */
+ InvalidOid, /* this has no array type */
+ InvalidOid, /* domain base type - irrelevant */
+ NULL, /* default value - none */
+ NULL, /* default binary representation */
+ false, /* passed by reference */
+ 'd', /* alignment - must be the largest! */
+ 'x', /* fully TOASTable */
+ -1, /* typmod */
+ 0, /* array dimensions for typBaseType */
+ false); /* Type NOT NULL */
pfree(relarrayname);
}
@@ -1723,9 +1724,9 @@ AddRelationRawConstraints(Relation rel,
NameStr(atp->attname));
/*
- * If the expression is just a NULL constant, we do not bother
- * to make an explicit pg_attrdef entry, since the default behavior
- * is equivalent.
+ * If the expression is just a NULL constant, we do not bother to make
+ * an explicit pg_attrdef entry, since the default behavior is
+ * equivalent.
*
* Note a nonobvious property of this test: if the column is of a
* domain type, what we'll get is not a bare null Const but a
@@ -1734,7 +1735,7 @@ AddRelationRawConstraints(Relation rel,
* override any default that the domain might have.
*/
if (expr == NULL ||
- (IsA(expr, Const) && ((Const *) expr)->constisnull))
+ (IsA(expr, Const) &&((Const *) expr)->constisnull))
continue;
StoreAttrDefault(rel, colDef->attnum, nodeToString(expr));
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 7f2bad8c0f..28caf71595 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.287 2007/11/08 23:22:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.288 2007/11/15 21:14:33 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -724,7 +724,7 @@ index_create(Oid heapRelationId,
}
else
{
- bool have_simple_col = false;
+ bool have_simple_col = false;
/* Create auto dependencies on simply-referenced columns */
for (i = 0; i < indexInfo->ii_NumIndexAttrs; i++)
@@ -742,15 +742,15 @@ index_create(Oid heapRelationId,
}
/*
- * It's possible for an index to not depend on any columns of
- * the table at all, in which case we need to give it a dependency
- * on the table as a whole; else it won't get dropped when the
- * table is dropped. This edge case is not totally useless;
- * for example, a unique index on a constant expression can serve
- * to prevent a table from containing more than one row.
+ * It's possible for an index to not depend on any columns of the
+ * table at all, in which case we need to give it a dependency on
+ * the table as a whole; else it won't get dropped when the table
+ * is dropped. This edge case is not totally useless; for
+ * example, a unique index on a constant expression can serve to
+ * prevent a table from containing more than one row.
*/
if (!have_simple_col &&
- !contain_vars_of_level((Node *) indexInfo->ii_Expressions, 0) &&
+ !contain_vars_of_level((Node *) indexInfo->ii_Expressions, 0) &&
!contain_vars_of_level((Node *) indexInfo->ii_Predicate, 0))
{
referenced.classId = RelationRelationId;
@@ -1360,15 +1360,15 @@ index_build(Relation heapRelation,
Assert(PointerIsValid(stats));
/*
- * If we found any potentially broken HOT chains, mark the index as
- * not being usable until the current transaction is below the event
- * horizon. See src/backend/access/heap/README.HOT for discussion.
+ * If we found any potentially broken HOT chains, mark the index as not
+ * being usable until the current transaction is below the event horizon.
+ * See src/backend/access/heap/README.HOT for discussion.
*/
if (indexInfo->ii_BrokenHotChain)
{
- Oid indexId = RelationGetRelid(indexRelation);
- Relation pg_index;
- HeapTuple indexTuple;
+ Oid indexId = RelationGetRelid(indexRelation);
+ Relation pg_index;
+ HeapTuple indexTuple;
Form_pg_index indexForm;
pg_index = heap_open(IndexRelationId, RowExclusiveLock);
@@ -1515,19 +1515,19 @@ IndexBuildHeapScan(Relation heapRelation,
CHECK_FOR_INTERRUPTS();
/*
- * When dealing with a HOT-chain of updated tuples, we want to
- * index the values of the live tuple (if any), but index it
- * under the TID of the chain's root tuple. This approach is
- * necessary to preserve the HOT-chain structure in the heap.
- * So we need to be able to find the root item offset for every
- * tuple that's in a HOT-chain. When first reaching a new page
- * of the relation, call heap_get_root_tuples() to build a map
- * of root item offsets on the page.
+ * When dealing with a HOT-chain of updated tuples, we want to index
+ * the values of the live tuple (if any), but index it under the TID
+ * of the chain's root tuple. This approach is necessary to preserve
+ * the HOT-chain structure in the heap. So we need to be able to find
+ * the root item offset for every tuple that's in a HOT-chain. When
+ * first reaching a new page of the relation, call
+ * heap_get_root_tuples() to build a map of root item offsets on the
+ * page.
*
* It might look unsafe to use this information across buffer
* lock/unlock. However, we hold ShareLock on the table so no
- * ordinary insert/update/delete should occur; and we hold pin on
- * the buffer continuously while visiting the page, so no pruning
+ * ordinary insert/update/delete should occur; and we hold pin on the
+ * buffer continuously while visiting the page, so no pruning
* operation can occur either.
*
* Note the implied assumption that there is no more than one live
@@ -1535,7 +1535,7 @@ IndexBuildHeapScan(Relation heapRelation,
*/
if (scan->rs_cblock != root_blkno)
{
- Page page = BufferGetPage(scan->rs_cbuf);
+ Page page = BufferGetPage(scan->rs_cbuf);
LockBuffer(scan->rs_cbuf, BUFFER_LOCK_SHARE);
heap_get_root_tuples(page, root_offsets);
@@ -1549,12 +1549,13 @@ IndexBuildHeapScan(Relation heapRelation,
/* do our own time qual check */
bool indexIt;
- recheck:
+ recheck:
+
/*
* We could possibly get away with not locking the buffer here,
* since caller should hold ShareLock on the relation, but let's
- * be conservative about it. (This remark is still correct
- * even with HOT-pruning: our pin on the buffer prevents pruning.)
+ * be conservative about it. (This remark is still correct even
+ * with HOT-pruning: our pin on the buffer prevents pruning.)
*/
LockBuffer(scan->rs_cbuf, BUFFER_LOCK_SHARE);
@@ -1580,9 +1581,9 @@ IndexBuildHeapScan(Relation heapRelation,
* building it, and may need to see such tuples.)
*
* However, if it was HOT-updated then we must only index
- * the live tuple at the end of the HOT-chain. Since this
- * breaks semantics for pre-existing snapshots, mark
- * the index as unusable for them.
+ * the live tuple at the end of the HOT-chain. Since this
+ * breaks semantics for pre-existing snapshots, mark the
+ * index as unusable for them.
*
* If we've already decided that the index will be unsafe
* for old snapshots, we may as well stop indexing
@@ -1611,13 +1612,13 @@ IndexBuildHeapScan(Relation heapRelation,
* followed by CREATE INDEX within a transaction.) An
* exception occurs when reindexing a system catalog,
* because we often release lock on system catalogs before
- * committing. In that case we wait for the inserting
+ * committing. In that case we wait for the inserting
* transaction to finish and check again. (We could do
* that on user tables too, but since the case is not
* expected it seems better to throw an error.)
*/
if (!TransactionIdIsCurrentTransactionId(
- HeapTupleHeaderGetXmin(heapTuple->t_data)))
+ HeapTupleHeaderGetXmin(heapTuple->t_data)))
{
if (!IsSystemRelation(heapRelation))
elog(ERROR, "concurrent insert in progress");
@@ -1627,11 +1628,13 @@ IndexBuildHeapScan(Relation heapRelation,
* Must drop the lock on the buffer before we wait
*/
TransactionId xwait = HeapTupleHeaderGetXmin(heapTuple->t_data);
+
LockBuffer(scan->rs_cbuf, BUFFER_LOCK_UNLOCK);
XactLockTableWait(xwait);
goto recheck;
}
}
+
/*
* We must index such tuples, since if the index build
* commits then they're good.
@@ -1648,14 +1651,14 @@ IndexBuildHeapScan(Relation heapRelation,
* followed by CREATE INDEX within a transaction.) An
* exception occurs when reindexing a system catalog,
* because we often release lock on system catalogs before
- * committing. In that case we wait for the deleting
+ * committing. In that case we wait for the deleting
* transaction to finish and check again. (We could do
* that on user tables too, but since the case is not
* expected it seems better to throw an error.)
*/
Assert(!(heapTuple->t_data->t_infomask & HEAP_XMAX_IS_MULTI));
if (!TransactionIdIsCurrentTransactionId(
- HeapTupleHeaderGetXmax(heapTuple->t_data)))
+ HeapTupleHeaderGetXmax(heapTuple->t_data)))
{
if (!IsSystemRelation(heapRelation))
elog(ERROR, "concurrent delete in progress");
@@ -1665,11 +1668,13 @@ IndexBuildHeapScan(Relation heapRelation,
* Must drop the lock on the buffer before we wait
*/
TransactionId xwait = HeapTupleHeaderGetXmax(heapTuple->t_data);
+
LockBuffer(scan->rs_cbuf, BUFFER_LOCK_UNLOCK);
XactLockTableWait(xwait);
goto recheck;
}
}
+
/*
* Otherwise, we have to treat these tuples just like
* RECENTLY_DELETED ones.
@@ -1689,7 +1694,7 @@ IndexBuildHeapScan(Relation heapRelation,
break;
default:
elog(ERROR, "unexpected HeapTupleSatisfiesVacuum result");
- indexIt = tupleIsAlive = false; /* keep compiler quiet */
+ indexIt = tupleIsAlive = false; /* keep compiler quiet */
break;
}
@@ -1741,11 +1746,11 @@ IndexBuildHeapScan(Relation heapRelation,
if (HeapTupleIsHeapOnly(heapTuple))
{
/*
- * For a heap-only tuple, pretend its TID is that of the root.
- * See src/backend/access/heap/README.HOT for discussion.
+ * For a heap-only tuple, pretend its TID is that of the root. See
+ * src/backend/access/heap/README.HOT for discussion.
*/
- HeapTupleData rootTuple;
- OffsetNumber offnum;
+ HeapTupleData rootTuple;
+ OffsetNumber offnum;
rootTuple = *heapTuple;
offnum = ItemPointerGetOffsetNumber(&heapTuple->t_self);
@@ -1787,11 +1792,11 @@ IndexBuildHeapScan(Relation heapRelation,
* We do a concurrent index build by first inserting the catalog entry for the
* index via index_create(), marking it not indisready and not indisvalid.
* Then we commit our transaction and start a new one, then we wait for all
- * transactions that could have been modifying the table to terminate. Now
+ * transactions that could have been modifying the table to terminate. Now
* we know that any subsequently-started transactions will see the index and
* honor its constraints on HOT updates; so while existing HOT-chains might
* be broken with respect to the index, no currently live tuple will have an
- * incompatible HOT update done to it. We now build the index normally via
+ * incompatible HOT update done to it. We now build the index normally via
* index_build(), while holding a weak lock that allows concurrent
* insert/update/delete. Also, we index only tuples that are valid
* as of the start of the scan (see IndexBuildHeapScan), whereas a normal
@@ -1805,7 +1810,7 @@ IndexBuildHeapScan(Relation heapRelation,
*
* Next, we mark the index "indisready" (but still not "indisvalid") and
* commit the second transaction and start a third. Again we wait for all
- * transactions that could have been modifying the table to terminate. Now
+ * transactions that could have been modifying the table to terminate. Now
* we know that any subsequently-started transactions will see the index and
* insert their new tuples into it. We then take a new reference snapshot
* which is passed to validate_index(). Any tuples that are valid according
@@ -1945,8 +1950,8 @@ validate_index_heapscan(Relation heapRelation,
EState *estate;
ExprContext *econtext;
BlockNumber root_blkno = InvalidBlockNumber;
- OffsetNumber root_offsets[MaxHeapTuplesPerPage];
- bool in_index[MaxHeapTuplesPerPage];
+ OffsetNumber root_offsets[MaxHeapTuplesPerPage];
+ bool in_index[MaxHeapTuplesPerPage];
/* state variables for the merge */
ItemPointer indexcursor = NULL;
@@ -1989,29 +1994,29 @@ validate_index_heapscan(Relation heapRelation,
{
ItemPointer heapcursor = &heapTuple->t_self;
ItemPointerData rootTuple;
- OffsetNumber root_offnum;
+ OffsetNumber root_offnum;
CHECK_FOR_INTERRUPTS();
state->htups += 1;
/*
- * As commented in IndexBuildHeapScan, we should index heap-only tuples
- * under the TIDs of their root tuples; so when we advance onto a new
- * heap page, build a map of root item offsets on the page.
+ * As commented in IndexBuildHeapScan, we should index heap-only
+ * tuples under the TIDs of their root tuples; so when we advance onto
+ * a new heap page, build a map of root item offsets on the page.
*
* This complicates merging against the tuplesort output: we will
* visit the live tuples in order by their offsets, but the root
- * offsets that we need to compare against the index contents might
- * be ordered differently. So we might have to "look back" within
- * the tuplesort output, but only within the current page. We handle
- * that by keeping a bool array in_index[] showing all the
- * already-passed-over tuplesort output TIDs of the current page.
- * We clear that array here, when advancing onto a new heap page.
+ * offsets that we need to compare against the index contents might be
+ * ordered differently. So we might have to "look back" within the
+ * tuplesort output, but only within the current page. We handle that
+ * by keeping a bool array in_index[] showing all the
+ * already-passed-over tuplesort output TIDs of the current page. We
+ * clear that array here, when advancing onto a new heap page.
*/
if (scan->rs_cblock != root_blkno)
{
- Page page = BufferGetPage(scan->rs_cbuf);
+ Page page = BufferGetPage(scan->rs_cbuf);
LockBuffer(scan->rs_cbuf, BUFFER_LOCK_SHARE);
heap_get_root_tuples(page, root_offsets);
@@ -2102,14 +2107,14 @@ validate_index_heapscan(Relation heapRelation,
/*
* If the tuple is already committed dead, you might think we
- * could suppress uniqueness checking, but this is no longer
- * true in the presence of HOT, because the insert is actually
- * a proxy for a uniqueness check on the whole HOT-chain. That
- * is, the tuple we have here could be dead because it was already
+ * could suppress uniqueness checking, but this is no longer true
+ * in the presence of HOT, because the insert is actually a proxy
+ * for a uniqueness check on the whole HOT-chain. That is, the
+ * tuple we have here could be dead because it was already
* HOT-updated, and if so the updating transaction will not have
- * thought it should insert index entries. The index AM will
- * check the whole HOT-chain and correctly detect a conflict
- * if there is one.
+ * thought it should insert index entries. The index AM will
+ * check the whole HOT-chain and correctly detect a conflict if
+ * there is one.
*/
index_insert(indexRelation,
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 46e0312b99..4e2bb1de5a 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.99 2007/08/27 03:36:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.100 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -75,11 +75,11 @@
*
* The textual specification of search_path can include "$user" to refer to
* the namespace named the same as the current user, if any. (This is just
- * ignored if there is no such namespace.) Also, it can include "pg_temp"
+ * ignored if there is no such namespace.) Also, it can include "pg_temp"
* to refer to the current backend's temp namespace. This is usually also
* ignorable if the temp namespace hasn't been set up, but there's a special
* case: if "pg_temp" appears first then it should be the default creation
- * target. We kluge this case a little bit so that the temp namespace isn't
+ * target. We kluge this case a little bit so that the temp namespace isn't
* set up until the first attempt to create something in it. (The reason for
* klugery is that we can't create the temp namespace outside a transaction,
* but initial GUC processing of search_path happens outside a transaction.)
@@ -144,10 +144,10 @@ static bool baseSearchPathValid = true;
typedef struct
{
- List *searchPath; /* the desired search path */
+ List *searchPath; /* the desired search path */
Oid creationNamespace; /* the desired creation namespace */
- int nestLevel; /* subtransaction nesting level */
-} OverrideStackEntry;
+ int nestLevel; /* subtransaction nesting level */
+} OverrideStackEntry;
static List *overrideStack = NIL;
@@ -157,7 +157,7 @@ static List *overrideStack = NIL;
* command is first executed). Thereafter it's the OID of the temp namespace.
*
* myTempToastNamespace is the OID of the namespace for my temp tables' toast
- * tables. It is set when myTempNamespace is, and is InvalidOid before that.
+ * tables. It is set when myTempNamespace is, and is InvalidOid before that.
*
* myTempNamespaceSubID shows whether we've created the TEMP namespace in the
* current subtransaction. The flag propagates up the subtransaction tree,
@@ -241,10 +241,10 @@ RangeVarGetRelid(const RangeVar *relation, bool failOK)
if (relation->schemaname)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
- errmsg("temporary tables cannot specify a schema name")));
+ errmsg("temporary tables cannot specify a schema name")));
if (OidIsValid(myTempNamespace))
relId = get_relname_relid(relation->relname, myTempNamespace);
- else /* this probably can't happen? */
+ else /* this probably can't happen? */
relId = InvalidOid;
}
else if (relation->schemaname)
@@ -308,7 +308,7 @@ RangeVarGetCreationNamespace(const RangeVar *newRelation)
if (newRelation->schemaname)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
- errmsg("temporary tables cannot specify a schema name")));
+ errmsg("temporary tables cannot specify a schema name")));
/* Initialize temp namespace if first time through */
if (!OidIsValid(myTempNamespace))
InitTempTableNamespace();
@@ -619,8 +619,8 @@ FuncnameGetCandidates(List *names, int nargs)
else
{
/*
- * Consider only procs that are in the search path and are not
- * in the temp namespace.
+ * Consider only procs that are in the search path and are not in
+ * the temp namespace.
*/
ListCell *nsp;
@@ -949,8 +949,8 @@ OpernameGetCandidates(List *names, char oprkind)
else
{
/*
- * Consider only opers that are in the search path and are not
- * in the temp namespace.
+ * Consider only opers that are in the search path and are not in
+ * the temp namespace.
*/
ListCell *nsp;
@@ -1377,7 +1377,7 @@ TSParserGetPrsid(List *names, bool failOK)
namespaceId = lfirst_oid(l);
if (namespaceId == myTempNamespace)
- continue; /* do not look in temp namespace */
+ continue; /* do not look in temp namespace */
prsoid = GetSysCacheOid(TSPARSERNAMENSP,
PointerGetDatum(parser_name),
@@ -1433,8 +1433,8 @@ TSParserIsVisible(Oid prsId)
{
/*
* If it is in the path, it might still not be visible; it could be
- * hidden by another parser of the same name earlier in the path. So we
- * must do a slow check for conflicting parsers.
+ * hidden by another parser of the same name earlier in the path. So
+ * we must do a slow check for conflicting parsers.
*/
char *name = NameStr(form->prsname);
ListCell *l;
@@ -1445,7 +1445,7 @@ TSParserIsVisible(Oid prsId)
Oid namespaceId = lfirst_oid(l);
if (namespaceId == myTempNamespace)
- continue; /* do not look in temp namespace */
+ continue; /* do not look in temp namespace */
if (namespaceId == namespace)
{
@@ -1505,7 +1505,7 @@ TSDictionaryGetDictid(List *names, bool failOK)
namespaceId = lfirst_oid(l);
if (namespaceId == myTempNamespace)
- continue; /* do not look in temp namespace */
+ continue; /* do not look in temp namespace */
dictoid = GetSysCacheOid(TSDICTNAMENSP,
PointerGetDatum(dict_name),
@@ -1562,8 +1562,8 @@ TSDictionaryIsVisible(Oid dictId)
{
/*
* If it is in the path, it might still not be visible; it could be
- * hidden by another dictionary of the same name earlier in the
- * path. So we must do a slow check for conflicting dictionaries.
+ * hidden by another dictionary of the same name earlier in the path.
+ * So we must do a slow check for conflicting dictionaries.
*/
char *name = NameStr(form->dictname);
ListCell *l;
@@ -1574,7 +1574,7 @@ TSDictionaryIsVisible(Oid dictId)
Oid namespaceId = lfirst_oid(l);
if (namespaceId == myTempNamespace)
- continue; /* do not look in temp namespace */
+ continue; /* do not look in temp namespace */
if (namespaceId == namespace)
{
@@ -1634,7 +1634,7 @@ TSTemplateGetTmplid(List *names, bool failOK)
namespaceId = lfirst_oid(l);
if (namespaceId == myTempNamespace)
- continue; /* do not look in temp namespace */
+ continue; /* do not look in temp namespace */
tmploid = GetSysCacheOid(TSTEMPLATENAMENSP,
PointerGetDatum(template_name),
@@ -1690,8 +1690,8 @@ TSTemplateIsVisible(Oid tmplId)
{
/*
* If it is in the path, it might still not be visible; it could be
- * hidden by another template of the same name earlier in the path.
- * So we must do a slow check for conflicting templates.
+ * hidden by another template of the same name earlier in the path. So
+ * we must do a slow check for conflicting templates.
*/
char *name = NameStr(form->tmplname);
ListCell *l;
@@ -1702,7 +1702,7 @@ TSTemplateIsVisible(Oid tmplId)
Oid namespaceId = lfirst_oid(l);
if (namespaceId == myTempNamespace)
- continue; /* do not look in temp namespace */
+ continue; /* do not look in temp namespace */
if (namespaceId == namespace)
{
@@ -1762,7 +1762,7 @@ TSConfigGetCfgid(List *names, bool failOK)
namespaceId = lfirst_oid(l);
if (namespaceId == myTempNamespace)
- continue; /* do not look in temp namespace */
+ continue; /* do not look in temp namespace */
cfgoid = GetSysCacheOid(TSCONFIGNAMENSP,
PointerGetDatum(config_name),
@@ -1785,7 +1785,7 @@ TSConfigGetCfgid(List *names, bool failOK)
/*
* TSConfigIsVisible
* Determine whether a text search configuration (identified by OID)
- * is visible in the current search path. Visible means "would be found
+ * is visible in the current search path. Visible means "would be found
* by searching for the unqualified text search configuration name".
*/
bool
@@ -1831,7 +1831,7 @@ TSConfigIsVisible(Oid cfgid)
Oid namespaceId = lfirst_oid(l);
if (namespaceId == myTempNamespace)
- continue; /* do not look in temp namespace */
+ continue; /* do not look in temp namespace */
if (namespaceId == namespace)
{
@@ -1925,11 +1925,12 @@ LookupExplicitNamespace(const char *nspname)
{
if (OidIsValid(myTempNamespace))
return myTempNamespace;
+
/*
- * Since this is used only for looking up existing objects, there
- * is no point in trying to initialize the temp namespace here;
- * and doing so might create problems for some callers.
- * Just fall through and give the "does not exist" error.
+ * Since this is used only for looking up existing objects, there is
+ * no point in trying to initialize the temp namespace here; and doing
+ * so might create problems for some callers. Just fall through and
+ * give the "does not exist" error.
*/
}
@@ -2166,7 +2167,7 @@ bool
isTempOrToastNamespace(Oid namespaceId)
{
if (OidIsValid(myTempNamespace) &&
- (myTempNamespace == namespaceId || myTempToastNamespace == namespaceId))
+ (myTempNamespace == namespaceId || myTempToastNamespace == namespaceId))
return true;
return false;
}
@@ -2208,7 +2209,7 @@ isOtherTempNamespace(Oid namespaceId)
/*
* GetTempToastNamespace - get the OID of my temporary-toast-table namespace,
- * which must already be assigned. (This is only used when creating a toast
+ * which must already be assigned. (This is only used when creating a toast
* table for a temp table, so we must have already done InitTempTableNamespace)
*/
Oid
@@ -2265,7 +2266,7 @@ GetOverrideSearchPath(MemoryContext context)
* search_path variable is ignored while an override is active.
*/
void
-PushOverrideSearchPath(OverrideSearchPath *newpath)
+PushOverrideSearchPath(OverrideSearchPath * newpath)
{
OverrideStackEntry *entry;
List *oidlist;
@@ -2315,7 +2316,7 @@ PushOverrideSearchPath(OverrideSearchPath *newpath)
/* And make it active. */
activeSearchPath = entry->searchPath;
activeCreationNamespace = entry->creationNamespace;
- activeTempCreationPending = false; /* XXX is this OK? */
+ activeTempCreationPending = false; /* XXX is this OK? */
MemoryContextSwitchTo(oldcxt);
}
@@ -2349,7 +2350,7 @@ PopOverrideSearchPath(void)
entry = (OverrideStackEntry *) linitial(overrideStack);
activeSearchPath = entry->searchPath;
activeCreationNamespace = entry->creationNamespace;
- activeTempCreationPending = false; /* XXX is this OK? */
+ activeTempCreationPending = false; /* XXX is this OK? */
}
else
{
@@ -2392,7 +2393,7 @@ FindConversionByName(List *name)
namespaceId = lfirst_oid(l);
if (namespaceId == myTempNamespace)
- continue; /* do not look in temp namespace */
+ continue; /* do not look in temp namespace */
conoid = FindConversion(conversion_name, namespaceId);
if (OidIsValid(conoid))
@@ -2533,7 +2534,7 @@ recomputeNamespacePath(void)
}
/*
- * Remember the first member of the explicit list. (Note: this is
+ * Remember the first member of the explicit list. (Note: this is
* nominally wrong if temp_missing, but we need it anyway to distinguish
* explicit from implicit mention of pg_catalog.)
*/
@@ -2696,7 +2697,7 @@ AtEOXact_Namespace(bool isCommit)
{
myTempNamespace = InvalidOid;
myTempToastNamespace = InvalidOid;
- baseSearchPathValid = false; /* need to rebuild list */
+ baseSearchPathValid = false; /* need to rebuild list */
}
myTempNamespaceSubID = InvalidSubTransactionId;
}
@@ -2748,7 +2749,7 @@ AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
/* TEMP namespace creation failed, so reset state */
myTempNamespace = InvalidOid;
myTempToastNamespace = InvalidOid;
- baseSearchPathValid = false; /* need to rebuild list */
+ baseSearchPathValid = false; /* need to rebuild list */
}
}
@@ -2773,7 +2774,7 @@ AtEOSubXact_Namespace(bool isCommit, SubTransactionId mySubid,
entry = (OverrideStackEntry *) linitial(overrideStack);
activeSearchPath = entry->searchPath;
activeCreationNamespace = entry->creationNamespace;
- activeTempCreationPending = false; /* XXX is this OK? */
+ activeTempCreationPending = false; /* XXX is this OK? */
}
else
{
@@ -2983,9 +2984,9 @@ fetch_search_path(bool includeImplicit)
recomputeNamespacePath();
/*
- * If the temp namespace should be first, force it to exist. This is
- * so that callers can trust the result to reflect the actual default
- * creation namespace. It's a bit bogus to do this here, since
+ * If the temp namespace should be first, force it to exist. This is so
+ * that callers can trust the result to reflect the actual default
+ * creation namespace. It's a bit bogus to do this here, since
* current_schema() is supposedly a stable function without side-effects,
* but the alternatives seem worse.
*/
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index 3c161ba512..d43823f287 100644
--- a/src/backend/catalog/pg_aggregate.c
+++ b/src/backend/catalog/pg_aggregate.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.87 2007/09/03 00:39:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.88 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -172,8 +172,8 @@ AggregateCreate(const char *aggName,
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("cannot determine result data type"),
- errdetail("An aggregate returning a polymorphic type "
- "must have at least one polymorphic argument.")));
+ errdetail("An aggregate returning a polymorphic type "
+ "must have at least one polymorphic argument.")));
/* handle sortop, if supplied */
if (aggsortopName)
@@ -213,8 +213,8 @@ AggregateCreate(const char *aggName,
PointerGetDatum(NULL), /* parameterModes */
PointerGetDatum(NULL), /* parameterNames */
PointerGetDatum(NULL), /* proconfig */
- 1, /* procost */
- 0); /* prorows */
+ 1, /* procost */
+ 0); /* prorows */
/*
* Okay to create the pg_aggregate entry.
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c
index ede6607b85..2e10b11e71 100644
--- a/src/backend/catalog/pg_constraint.c
+++ b/src/backend/catalog/pg_constraint.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.35 2007/02/14 01:58:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.36 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -286,10 +286,10 @@ CreateConstraintEntry(const char *constraintName,
if (foreignNKeys > 0)
{
/*
- * Register normal dependencies on the equality operators that
- * support a foreign-key constraint. If the PK and FK types
- * are the same then all three operators for a column are the
- * same; otherwise they are different.
+ * Register normal dependencies on the equality operators that support
+ * a foreign-key constraint. If the PK and FK types are the same then
+ * all three operators for a column are the same; otherwise they are
+ * different.
*/
ObjectAddress oprobject;
diff --git a/src/backend/catalog/pg_conversion.c b/src/backend/catalog/pg_conversion.c
index e9c75ebdb6..22292e00f2 100644
--- a/src/backend/catalog/pg_conversion.c
+++ b/src/backend/catalog/pg_conversion.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.38 2007/09/24 01:29:28 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_conversion.c,v 1.39 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -275,4 +275,3 @@ FindConversion(const char *conname, Oid connamespace)
return conoid;
}
-
diff --git a/src/backend/catalog/pg_enum.c b/src/backend/catalog/pg_enum.c
index 6a09886435..c82b3aff3f 100644
--- a/src/backend/catalog/pg_enum.c
+++ b/src/backend/catalog/pg_enum.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.2 2007/04/02 22:14:17 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.3 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,32 +37,33 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
TupleDesc tupDesc;
NameData enumlabel;
Oid *oids;
- int i, n;
+ int i,
+ n;
Datum values[Natts_pg_enum];
char nulls[Natts_pg_enum];
ListCell *lc;
- HeapTuple tup;
+ HeapTuple tup;
n = list_length(vals);
/*
- * XXX we do not bother to check the list of values for duplicates ---
- * if you have any, you'll get a less-than-friendly unique-index
- * violation. Is it worth trying harder?
+ * XXX we do not bother to check the list of values for duplicates --- if
+ * you have any, you'll get a less-than-friendly unique-index violation.
+ * Is it worth trying harder?
*/
pg_enum = heap_open(EnumRelationId, RowExclusiveLock);
tupDesc = pg_enum->rd_att;
/*
- * Allocate oids. While this method does not absolutely guarantee
- * that we generate no duplicate oids (since we haven't entered each
- * oid into the table before allocating the next), trouble could only
- * occur if the oid counter wraps all the way around before we finish.
- * Which seems unlikely.
+ * Allocate oids. While this method does not absolutely guarantee that we
+ * generate no duplicate oids (since we haven't entered each oid into the
+ * table before allocating the next), trouble could only occur if the oid
+ * counter wraps all the way around before we finish. Which seems
+ * unlikely.
*/
oids = (Oid *) palloc(n * sizeof(Oid));
- for(i = 0; i < n; i++)
+ for (i = 0; i < n; i++)
{
oids[i] = GetNewOid(pg_enum);
}
@@ -76,9 +77,9 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
i = 0;
foreach(lc, vals)
{
- char *lab = strVal(lfirst(lc));
+ char *lab = strVal(lfirst(lc));
- /*
+ /*
* labels are stored in a name field, for easier syscache lookup, so
* check the length to make sure it's within range.
*/
@@ -86,9 +87,9 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
if (strlen(lab) > (NAMEDATALEN - 1))
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
- errmsg("invalid enum label \"%s\", must be %d characters or less",
- lab,
- NAMEDATALEN - 1)));
+ errmsg("invalid enum label \"%s\", must be %d characters or less",
+ lab,
+ NAMEDATALEN - 1)));
values[Anum_pg_enum_enumtypid - 1] = ObjectIdGetDatum(enumTypeOid);
@@ -148,8 +149,8 @@ EnumValuesDelete(Oid enumTypeOid)
static int
oid_cmp(const void *p1, const void *p2)
{
- Oid v1 = *((const Oid *) p1);
- Oid v2 = *((const Oid *) p2);
+ Oid v1 = *((const Oid *) p1);
+ Oid v2 = *((const Oid *) p2);
if (v1 < v2)
return -1;
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index 55a0cc0839..99a5959252 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.101 2007/11/07 12:24:24 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.102 2007/11/15 21:14:33 momjian Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -868,7 +868,7 @@ makeOperatorDependencies(HeapTuple tuple)
* operators oprcom and oprnegate. We would not want to delete this
* operator if those go away, but only reset the link fields; which is not
* a function that the dependency code can presently handle. (Something
- * could perhaps be done with objectSubId though.) For now, it's okay to
+ * could perhaps be done with objectSubId though.) For now, it's okay to
* let those links dangle if a referenced operator is removed.
*/
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index 6b5a7d0fd9..9487b66dde 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.146 2007/09/03 00:39:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.147 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -139,7 +139,7 @@ ProcedureCreate(const char *procedureName,
/*
* Do not allow polymorphic return type unless at least one input argument
- * is polymorphic. Also, do not allow return type INTERNAL unless at
+ * is polymorphic. Also, do not allow return type INTERNAL unless at
* least one input argument is INTERNAL.
*/
for (i = 0; i < parameterCount; i++)
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index ef1a83b4e4..5272edfe19 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.20 2007/05/14 20:07:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.21 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -487,7 +487,7 @@ checkSharedDependencies(Oid classId, Oid objectId)
/*
* We limit the number of dependencies reported to the client to
* MAX_REPORTED_DEPS, since client software may not deal well with
- * enormous error strings. The server log always gets a full report,
+ * enormous error strings. The server log always gets a full report,
* which is collected in a separate StringInfo if and only if we detect
* that the client report is going to be truncated.
*/
@@ -662,7 +662,7 @@ checkSharedDependencies(Oid classId, Oid objectId)
if (numNotReportedDeps > 0 || numNotReportedDbs > 0)
{
- ObjectAddress obj;
+ ObjectAddress obj;
obj.classId = classId;
obj.objectId = objectId;
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 7419b36338..bcfc14195f 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.113 2007/05/12 00:54:59 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.114 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -88,7 +88,7 @@ TypeShellMake(const char *typeName, Oid typeNamespace)
values[i++] = ObjectIdGetDatum(GetUserId()); /* typowner */
values[i++] = Int16GetDatum(sizeof(int4)); /* typlen */
values[i++] = BoolGetDatum(true); /* typbyval */
- values[i++] = CharGetDatum(TYPTYPE_PSEUDO); /* typtype */
+ values[i++] = CharGetDatum(TYPTYPE_PSEUDO); /* typtype */
values[i++] = BoolGetDatum(false); /* typisdefined */
values[i++] = CharGetDatum(DEFAULT_TYPDELIM); /* typdelim */
values[i++] = ObjectIdGetDatum(InvalidOid); /* typrelid */
@@ -255,13 +255,13 @@ TypeCreate(Oid newTypeOid,
values[i++] = CharGetDatum(typDelim); /* typdelim */
values[i++] = ObjectIdGetDatum(relationOid); /* typrelid */
values[i++] = ObjectIdGetDatum(elementType); /* typelem */
- values[i++] = ObjectIdGetDatum(arrayType); /* typarray */
+ values[i++] = ObjectIdGetDatum(arrayType); /* typarray */
values[i++] = ObjectIdGetDatum(inputProcedure); /* typinput */
values[i++] = ObjectIdGetDatum(outputProcedure); /* typoutput */
values[i++] = ObjectIdGetDatum(receiveProcedure); /* typreceive */
values[i++] = ObjectIdGetDatum(sendProcedure); /* typsend */
values[i++] = ObjectIdGetDatum(typmodinProcedure); /* typmodin */
- values[i++] = ObjectIdGetDatum(typmodoutProcedure); /* typmodout */
+ values[i++] = ObjectIdGetDatum(typmodoutProcedure); /* typmodout */
values[i++] = ObjectIdGetDatum(analyzeProcedure); /* typanalyze */
values[i++] = CharGetDatum(alignment); /* typalign */
values[i++] = CharGetDatum(storage); /* typstorage */
@@ -397,8 +397,8 @@ TypeCreate(Oid newTypeOid,
void
GenerateTypeDependencies(Oid typeNamespace,
Oid typeObjectId,
- Oid relationOid, /* only for relation rowtypes */
- char relationKind, /* ditto */
+ Oid relationOid, /* only for relation rowtypes */
+ char relationKind, /* ditto */
Oid owner,
Oid inputProcedure,
Oid outputProcedure,
@@ -534,7 +534,7 @@ GenerateTypeDependencies(Oid typeNamespace,
referenced.objectId = elementType;
referenced.objectSubId = 0;
recordDependencyOn(&myself, &referenced,
- isImplicitArray ? DEPENDENCY_INTERNAL : DEPENDENCY_NORMAL);
+ isImplicitArray ? DEPENDENCY_INTERNAL : DEPENDENCY_NORMAL);
}
/* Normal dependency from a domain to its base type. */
@@ -604,7 +604,7 @@ TypeRename(Oid typeOid, const char *newTypeName, Oid typeNamespace)
/* If the type has an array type, recurse to handle that */
if (OidIsValid(arrayOid))
{
- char *arrname = makeArrayTypeName(newTypeName, typeNamespace);
+ char *arrname = makeArrayTypeName(newTypeName, typeNamespace);
TypeRename(arrayOid, arrname, typeNamespace);
pfree(arrname);
@@ -622,12 +622,12 @@ char *
makeArrayTypeName(const char *typeName, Oid typeNamespace)
{
char *arr;
- int i;
+ int i;
Relation pg_type_desc;
/*
- * The idea is to prepend underscores as needed until we make a name
- * that doesn't collide with anything...
+ * The idea is to prepend underscores as needed until we make a name that
+ * doesn't collide with anything...
*/
arr = palloc(NAMEDATALEN);
@@ -647,10 +647,10 @@ makeArrayTypeName(const char *typeName, Oid typeNamespace)
heap_close(pg_type_desc, AccessShareLock);
- if (i >= NAMEDATALEN-1)
+ if (i >= NAMEDATALEN - 1)
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
- errmsg("could not form array type name for type \"%s\"",
+ errmsg("could not form array type name for type \"%s\"",
typeName)));
return arr;
@@ -698,10 +698,10 @@ moveArrayTypeName(Oid typeOid, const char *typeName, Oid typeNamespace)
return false;
/*
- * OK, use makeArrayTypeName to pick an unused modification of the
- * name. Note that since makeArrayTypeName is an iterative process,
- * this will produce a name that it might have produced the first time,
- * had the conflicting type we are about to create already existed.
+ * OK, use makeArrayTypeName to pick an unused modification of the name.
+ * Note that since makeArrayTypeName is an iterative process, this will
+ * produce a name that it might have produced the first time, had the
+ * conflicting type we are about to create already existed.
*/
newname = makeArrayTypeName(typeName, typeNamespace);
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 51944c54c2..20ece6d6eb 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.110 2007/10/24 20:55:36 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.111 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -118,7 +118,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
totaldeadrows;
HeapTuple *rows;
PGRUsage ru0;
- TimestampTz starttime = 0;
+ TimestampTz starttime = 0;
if (vacstmt->verbose)
elevel = INFO;
@@ -1346,7 +1346,7 @@ typedef struct
FmgrInfo *cmpFn;
int cmpFlags;
int *tupnoLink;
-} CompareScalarsContext;
+} CompareScalarsContext;
static void compute_minimal_stats(VacAttrStatsP stats,
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 736e74882d..0789d1a1e5 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.164 2007/09/29 18:05:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.165 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,7 +80,7 @@ static List *get_tables_to_cluster(MemoryContext cluster_context);
*
* The single-relation case does not have any such overhead.
*
- * We also allow a relation to be specified without index. In that case,
+ * We also allow a relation to be specified without index. In that case,
* the indisclustered bit will be looked up, and an ERROR will be thrown
* if there is no index with the bit set.
*---------------------------------------------------------------------------
@@ -107,13 +107,13 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
RelationGetRelationName(rel));
/*
- * Reject clustering a remote temp table ... their local buffer manager
- * is not going to cope.
+ * Reject clustering a remote temp table ... their local buffer
+ * manager is not going to cope.
*/
if (isOtherTempNamespace(RelationGetNamespace(rel)))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot cluster temporary tables of other sessions")));
+ errmsg("cannot cluster temporary tables of other sessions")));
if (stmt->indexname == NULL)
{
@@ -289,7 +289,7 @@ cluster_rel(RelToCluster *rvtc, bool recheck)
* check in the "recheck" case is appropriate (which currently means
* somebody is executing a database-wide CLUSTER), because there is
* another check in cluster() which will stop any attempt to cluster
- * remote temp tables by name. There is another check in
+ * remote temp tables by name. There is another check in
* check_index_is_clusterable which is redundant, but we leave it for
* extra safety.
*/
@@ -733,8 +733,8 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
/*
* compute xids used to freeze and weed out dead tuples. We use -1
- * freeze_min_age to avoid having CLUSTER freeze tuples earlier than
- * a plain VACUUM would.
+ * freeze_min_age to avoid having CLUSTER freeze tuples earlier than a
+ * plain VACUUM would.
*/
vacuum_set_xid_limits(-1, OldHeap->rd_rel->relisshared,
&OldestXmin, &FreezeXid);
@@ -745,8 +745,8 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
/*
* Scan through the OldHeap in OldIndex order and copy each tuple into the
* NewHeap. To ensure we see recently-dead tuples that still need to be
- * copied, we scan with SnapshotAny and use HeapTupleSatisfiesVacuum
- * for the visibility test.
+ * copied, we scan with SnapshotAny and use HeapTupleSatisfiesVacuum for
+ * the visibility test.
*/
scan = index_beginscan(OldHeap, OldIndex,
SnapshotAny, 0, (ScanKey) NULL);
@@ -774,31 +774,33 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
isdead = false;
break;
case HEAPTUPLE_INSERT_IN_PROGRESS:
+
/*
- * We should not see this unless it's been inserted earlier
- * in our own transaction.
+ * We should not see this unless it's been inserted earlier in
+ * our own transaction.
*/
if (!TransactionIdIsCurrentTransactionId(
- HeapTupleHeaderGetXmin(tuple->t_data)))
+ HeapTupleHeaderGetXmin(tuple->t_data)))
elog(ERROR, "concurrent insert in progress");
/* treat as live */
isdead = false;
break;
case HEAPTUPLE_DELETE_IN_PROGRESS:
+
/*
- * We should not see this unless it's been deleted earlier
- * in our own transaction.
+ * We should not see this unless it's been deleted earlier in
+ * our own transaction.
*/
Assert(!(tuple->t_data->t_infomask & HEAP_XMAX_IS_MULTI));
if (!TransactionIdIsCurrentTransactionId(
- HeapTupleHeaderGetXmax(tuple->t_data)))
+ HeapTupleHeaderGetXmax(tuple->t_data)))
elog(ERROR, "concurrent delete in progress");
/* treat as recently dead */
isdead = false;
break;
default:
elog(ERROR, "unexpected HeapTupleSatisfiesVacuum result");
- isdead = false; /* keep compiler quiet */
+ isdead = false; /* keep compiler quiet */
break;
}
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index c175523c36..38c9b7c9a5 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -7,7 +7,7 @@
* Copyright (c) 1996-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.98 2007/11/11 19:22:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.99 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1493,7 +1493,7 @@ CommentTSParser(List *qualname, char *comment)
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("must be superuser to comment on text search parser")));
+ errmsg("must be superuser to comment on text search parser")));
CreateComments(prsId, TSParserRelationId, 0, comment);
}
@@ -1522,7 +1522,7 @@ CommentTSTemplate(List *qualname, char *comment)
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("must be superuser to comment on text search template")));
+ errmsg("must be superuser to comment on text search template")));
CreateComments(tmplId, TSTemplateRelationId, 0, comment);
}
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index fdfe5ea965..ef7e04ca28 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.287 2007/09/12 20:49:27 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.288 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -997,7 +997,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString)
errmsg("COPY (SELECT) WITH OIDS is not supported")));
/*
- * Run parse analysis and rewrite. Note this also acquires sufficient
+ * Run parse analysis and rewrite. Note this also acquires sufficient
* locks on the source table(s).
*
* Because the parser and planner tend to scribble on their input, we
@@ -1638,8 +1638,8 @@ CopyFrom(CopyState cstate)
MemoryContext oldcontext = CurrentMemoryContext;
ErrorContextCallback errcontext;
CommandId mycid = GetCurrentCommandId();
- bool use_wal = true; /* by default, use WAL logging */
- bool use_fsm = true; /* by default, use FSM for free space */
+ bool use_wal = true; /* by default, use WAL logging */
+ bool use_fsm = true; /* by default, use FSM for free space */
Assert(cstate->rel);
@@ -2148,7 +2148,7 @@ CopyFrom(CopyState cstate)
cstate->filename)));
}
- /*
+ /*
* If we skipped writing WAL, then we need to sync the heap (but not
* indexes since those use WAL anyway)
*/
@@ -2685,7 +2685,7 @@ CopyReadAttributesText(CopyState cstate, int maxfields, char **fieldvals)
char *start_ptr;
char *end_ptr;
int input_len;
- bool saw_high_bit = false;
+ bool saw_high_bit = false;
/* Make sure space remains in fieldvals[] */
if (fieldno >= maxfields)
@@ -2776,7 +2776,7 @@ CopyReadAttributesText(CopyState cstate, int maxfields, char **fieldvals)
}
c = val & 0xff;
if (IS_HIGHBIT_SET(c))
- saw_high_bit = true;
+ saw_high_bit = true;
}
}
break;
@@ -2804,7 +2804,7 @@ CopyReadAttributesText(CopyState cstate, int maxfields, char **fieldvals)
* literally
*/
}
- }
+ }
/* Add c to output string */
*output_ptr++ = c;
@@ -2813,13 +2813,15 @@ CopyReadAttributesText(CopyState cstate, int maxfields, char **fieldvals)
/* Terminate attribute value in output area */
*output_ptr++ = '\0';
- /* If we de-escaped a char with the high bit set, make sure
- * we still have valid data for the db encoding. Avoid calling strlen
- * here for the sake of efficiency.
+ /*
+ * If we de-escaped a char with the high bit set, make sure we still
+ * have valid data for the db encoding. Avoid calling strlen here for
+ * the sake of efficiency.
*/
if (saw_high_bit)
{
- char *fld = fieldvals[fieldno];
+ char *fld = fieldvals[fieldno];
+
pg_verifymbstr(fld, output_ptr - (fld + 1), false);
}
@@ -3077,15 +3079,15 @@ CopyAttributeOutText(CopyState cstate, char *string)
* We have to grovel through the string searching for control characters
* and instances of the delimiter character. In most cases, though, these
* are infrequent. To avoid overhead from calling CopySendData once per
- * character, we dump out all characters between escaped characters in
- * a single call. The loop invariant is that the data from "start" to
- * "ptr" can be sent literally, but hasn't yet been.
+ * character, we dump out all characters between escaped characters in a
+ * single call. The loop invariant is that the data from "start" to "ptr"
+ * can be sent literally, but hasn't yet been.
*
* We can skip pg_encoding_mblen() overhead when encoding is safe, because
* in valid backend encodings, extra bytes of a multibyte character never
* look like ASCII. This loop is sufficiently performance-critical that
- * it's worth making two copies of it to get the IS_HIGHBIT_SET() test
- * out of the normal safe-encoding path.
+ * it's worth making two copies of it to get the IS_HIGHBIT_SET() test out
+ * of the normal safe-encoding path.
*/
if (cstate->encoding_embeds_ascii)
{
@@ -3096,13 +3098,16 @@ CopyAttributeOutText(CopyState cstate, char *string)
{
DUMPSOFAR();
CopySendChar(cstate, '\\');
- start = ptr++; /* we include char in next run */
+ start = ptr++; /* we include char in next run */
}
else if ((unsigned char) c < (unsigned char) 0x20)
{
switch (c)
{
- /* \r and \n must be escaped, the others are traditional */
+ /*
+ * \r and \n must be escaped, the others are
+ * traditional
+ */
case '\b':
case '\f':
case '\n':
@@ -3134,13 +3139,16 @@ CopyAttributeOutText(CopyState cstate, char *string)
{
DUMPSOFAR();
CopySendChar(cstate, '\\');
- start = ptr++; /* we include char in next run */
+ start = ptr++; /* we include char in next run */
}
else if ((unsigned char) c < (unsigned char) 0x20)
{
switch (c)
{
- /* \r and \n must be escaped, the others are traditional */
+ /*
+ * \r and \n must be escaped, the others are
+ * traditional
+ */
case '\b':
case '\f':
case '\n':
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 3090ae0af4..2d455ed31f 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.202 2007/10/16 11:30:16 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.203 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -260,17 +260,17 @@ createdb(const CreatedbStmt *stmt)
* Check whether encoding matches server locale settings. We allow
* mismatch in three cases:
*
- * 1. ctype_encoding = SQL_ASCII, which means either that the locale
- * is C/POSIX which works with any encoding, or that we couldn't determine
+ * 1. ctype_encoding = SQL_ASCII, which means either that the locale is
+ * C/POSIX which works with any encoding, or that we couldn't determine
* the locale's encoding and have to trust the user to get it right.
*
- * 2. selected encoding is SQL_ASCII, but only if you're a superuser.
- * This is risky but we have historically allowed it --- notably, the
+ * 2. selected encoding is SQL_ASCII, but only if you're a superuser. This
+ * is risky but we have historically allowed it --- notably, the
* regression tests require it.
*
* 3. selected encoding is UTF8 and platform is win32. This is because
- * UTF8 is a pseudo codepage that is supported in all locales since
- * it's converted to UTF16 before being used.
+ * UTF8 is a pseudo codepage that is supported in all locales since it's
+ * converted to UTF16 before being used.
*
* Note: if you change this policy, fix initdb to match.
*/
@@ -286,8 +286,8 @@ createdb(const CreatedbStmt *stmt)
(errmsg("encoding %s does not match server's locale %s",
pg_encoding_to_char(encoding),
setlocale(LC_CTYPE, NULL)),
- errdetail("The server's LC_CTYPE setting requires encoding %s.",
- pg_encoding_to_char(ctype_encoding))));
+ errdetail("The server's LC_CTYPE setting requires encoding %s.",
+ pg_encoding_to_char(ctype_encoding))));
/* Resolve default tablespace for new database */
if (dtablespacename && dtablespacename->arg)
@@ -313,7 +313,7 @@ createdb(const CreatedbStmt *stmt)
if (dst_deftablespace == GLOBALTABLESPACE_OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("pg_global cannot be used as default tablespace")));
+ errmsg("pg_global cannot be used as default tablespace")));
/*
* If we are trying to change the default tablespace of the template,
@@ -375,12 +375,12 @@ createdb(const CreatedbStmt *stmt)
if (CheckOtherDBBackends(src_dboid))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE),
- errmsg("source database \"%s\" is being accessed by other users",
- dbtemplate)));
+ errmsg("source database \"%s\" is being accessed by other users",
+ dbtemplate)));
/*
- * Select an OID for the new database, checking that it doesn't have
- * a filename conflict with anything already existing in the tablespace
+ * Select an OID for the new database, checking that it doesn't have a
+ * filename conflict with anything already existing in the tablespace
* directories.
*/
pg_database_rel = heap_open(DatabaseRelationId, RowExclusiveLock);
@@ -558,9 +558,9 @@ createdb(const CreatedbStmt *stmt)
/*
* Set flag to update flat database file at commit. Note: this also
* forces synchronous commit, which minimizes the window between
- * creation of the database files and commital of the transaction.
- * If we crash before committing, we'll have a DB that's taking up
- * disk space but is not in pg_database, which is not good.
+ * creation of the database files and commital of the transaction. If
+ * we crash before committing, we'll have a DB that's taking up disk
+ * space but is not in pg_database, which is not good.
*/
database_file_update_needed();
}
@@ -721,10 +721,10 @@ dropdb(const char *dbname, bool missing_ok)
/*
* Set flag to update flat database file at commit. Note: this also
- * forces synchronous commit, which minimizes the window between
- * removal of the database files and commital of the transaction.
- * If we crash before committing, we'll have a DB that's gone on disk
- * but still there according to pg_database, which is not good.
+ * forces synchronous commit, which minimizes the window between removal
+ * of the database files and commital of the transaction. If we crash
+ * before committing, we'll have a DB that's gone on disk but still there
+ * according to pg_database, which is not good.
*/
database_file_update_needed();
}
diff --git a/src/backend/commands/discard.c b/src/backend/commands/discard.c
index d2ae6defd0..7af6ce0122 100644
--- a/src/backend/commands/discard.c
+++ b/src/backend/commands/discard.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/discard.c,v 1.1 2007/04/26 16:13:10 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/discard.c,v 1.2 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,7 +28,7 @@ static void DiscardAll(bool isTopLevel);
* DISCARD { ALL | TEMP | PLANS }
*/
void
-DiscardCommand(DiscardStmt *stmt, bool isTopLevel)
+DiscardCommand(DiscardStmt * stmt, bool isTopLevel)
{
switch (stmt->target)
{
@@ -54,10 +54,10 @@ DiscardAll(bool isTopLevel)
{
/*
* Disallow DISCARD ALL in a transaction block. This is arguably
- * inconsistent (we don't make a similar check in the command
- * sequence that DISCARD ALL is equivalent to), but the idea is
- * to catch mistakes: DISCARD ALL inside a transaction block
- * would leave the transaction still uncommitted.
+ * inconsistent (we don't make a similar check in the command sequence
+ * that DISCARD ALL is equivalent to), but the idea is to catch mistakes:
+ * DISCARD ALL inside a transaction block would leave the transaction
+ * still uncommitted.
*/
PreventTransactionChain(isTopLevel, "DISCARD ALL");
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index c9d454bc49..c385d952d2 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.165 2007/08/15 21:39:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.166 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,6 +35,7 @@
/* Hook for plugins to get control in ExplainOneQuery() */
ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL;
+
/* Hook for plugins to get control in explain_get_index_name() */
explain_get_index_name_hook_type explain_get_index_name_hook = NULL;
@@ -50,10 +51,10 @@ typedef struct ExplainState
} ExplainState;
static void ExplainOneQuery(Query *query, ExplainStmt *stmt,
- const char *queryString,
- ParamListInfo params, TupOutputState *tstate);
+ const char *queryString,
+ ParamListInfo params, TupOutputState *tstate);
static void report_triggers(ResultRelInfo *rInfo, bool show_relname,
- StringInfo buf);
+ StringInfo buf);
static double elapsed_time(instr_time *starttime);
static void explain_outNode(StringInfo str,
Plan *plan, PlanState *planstate,
@@ -90,14 +91,14 @@ ExplainQuery(ExplainStmt *stmt, const char *queryString,
getParamListTypes(params, &param_types, &num_params);
/*
- * Run parse analysis and rewrite. Note this also acquires sufficient
+ * Run parse analysis and rewrite. Note this also acquires sufficient
* locks on the source table(s).
*
- * Because the parser and planner tend to scribble on their input, we
- * make a preliminary copy of the source querytree. This prevents
- * problems in the case that the EXPLAIN is in a portal or plpgsql
- * function and is executed repeatedly. (See also the same hack in
- * DECLARE CURSOR and PREPARE.) XXX FIXME someday.
+ * Because the parser and planner tend to scribble on their input, we make
+ * a preliminary copy of the source querytree. This prevents problems in
+ * the case that the EXPLAIN is in a portal or plpgsql function and is
+ * executed repeatedly. (See also the same hack in DECLARE CURSOR and
+ * PREPARE.) XXX FIXME someday.
*/
rewritten = pg_analyze_and_rewrite((Node *) copyObject(stmt->query),
queryString, param_types, num_params);
@@ -215,7 +216,7 @@ ExplainOneUtility(Node *utilityStmt, ExplainStmt *stmt,
* to call it.
*/
void
-ExplainOnePlan(PlannedStmt *plannedstmt, ParamListInfo params,
+ExplainOnePlan(PlannedStmt * plannedstmt, ParamListInfo params,
ExplainStmt *stmt, TupOutputState *tstate)
{
QueryDesc *queryDesc;
@@ -376,8 +377,8 @@ report_triggers(ResultRelInfo *rInfo, bool show_relname, StringInfo buf)
InstrEndLoop(instr);
/*
- * We ignore triggers that were never invoked; they likely
- * aren't relevant to the current query type.
+ * We ignore triggers that were never invoked; they likely aren't
+ * relevant to the current query type.
*/
if (instr->ntuples == 0)
continue;
@@ -624,7 +625,7 @@ explain_outNode(StringInfo str,
if (ScanDirectionIsBackward(((IndexScan *) plan)->indexorderdir))
appendStringInfoString(str, " Backward");
appendStringInfo(str, " using %s",
- explain_get_index_name(((IndexScan *) plan)->indexid));
+ explain_get_index_name(((IndexScan *) plan)->indexid));
/* FALL THRU */
case T_SeqScan:
case T_BitmapHeapScan:
@@ -1137,7 +1138,7 @@ show_sort_keys(Plan *sortplan, int nkeys, AttrNumber *keycols,
/* Set up deparsing context */
context = deparse_context_for_plan((Node *) outerPlan(sortplan),
- NULL, /* Sort has no innerPlan */
+ NULL, /* Sort has no innerPlan */
es->rtable);
useprefix = list_length(es->rtable) > 1;
@@ -1192,7 +1193,7 @@ show_sort_info(SortState *sortstate,
static const char *
explain_get_index_name(Oid indexId)
{
- const char *result;
+ const char *result;
if (explain_get_index_name_hook)
result = (*explain_get_index_name_hook) (indexId);
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 3a55661502..892bd7c9f3 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.86 2007/11/11 19:22:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.87 2007/11/15 21:14:33 momjian Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -56,7 +56,7 @@
static void AlterFunctionOwner_internal(Relation rel, HeapTuple tup,
- Oid newOwnerId);
+ Oid newOwnerId);
/*
@@ -121,8 +121,8 @@ compute_return_type(TypeName *returnType, Oid languageOid,
if (returnType->typmods != NIL)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("type modifier cannot be specified for shell type \"%s\"",
- typnam)));
+ errmsg("type modifier cannot be specified for shell type \"%s\"",
+ typnam)));
/* Otherwise, go ahead and make a shell type */
ereport(NOTICE,
@@ -285,7 +285,7 @@ examine_parameter_list(List *parameters, Oid languageOid,
* FUNCTION and ALTER FUNCTION and return it via one of the out
* parameters. Returns true if the passed option was recognized. If
* the out parameter we were going to assign to points to non-NULL,
- * raise a duplicate-clause error. (We don't try to detect duplicate
+ * raise a duplicate-clause error. (We don't try to detect duplicate
* SET parameters though --- if you're redundant, the last one wins.)
*/
static bool
@@ -390,7 +390,7 @@ update_proconfig_value(ArrayType *a, List *set_items)
if (valuestr)
a = GUCArrayAdd(a, sstmt->name, valuestr);
- else /* RESET */
+ else /* RESET */
a = GUCArrayDelete(a, sstmt->name);
}
}
@@ -1598,9 +1598,9 @@ DropCast(DropCastStmt *stmt)
TypeNameToString(stmt->targettype))));
else
ereport(NOTICE,
- (errmsg("cast from type %s to type %s does not exist, skipping",
- TypeNameToString(stmt->sourcetype),
- TypeNameToString(stmt->targettype))));
+ (errmsg("cast from type %s to type %s does not exist, skipping",
+ TypeNameToString(stmt->sourcetype),
+ TypeNameToString(stmt->targettype))));
return;
}
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index 943978e589..dc53546a05 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.166 2007/09/20 17:56:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.167 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -396,10 +396,9 @@ DefineIndex(RangeVar *heapRelation,
}
/*
- * Parse AM-specific options, convert to text array form,
- * validate. The src_options introduced due to using indexes
- * via the "CREATE LIKE INCLUDING INDEXES" statement also need to
- * be merged here
+ * Parse AM-specific options, convert to text array form, validate. The
+ * src_options introduced due to using indexes via the "CREATE LIKE
+ * INCLUDING INDEXES" statement also need to be merged here
*/
if (src_options)
reloptions = unflatten_reloptions(src_options);
@@ -452,7 +451,7 @@ DefineIndex(RangeVar *heapRelation,
{
indexRelationId =
index_create(relationId, indexRelationName, indexRelationId,
- indexInfo, accessMethodId, tablespaceId, classObjectId,
+ indexInfo, accessMethodId, tablespaceId, classObjectId,
coloptions, reloptions, primary, isconstraint,
allowSystemTableMods, skip_build, concurrent);
@@ -461,18 +460,18 @@ DefineIndex(RangeVar *heapRelation,
/*
* For a concurrent build, we next insert the catalog entry and add
- * constraints. We don't build the index just yet; we must first make
- * the catalog entry so that the new index is visible to updating
+ * constraints. We don't build the index just yet; we must first make the
+ * catalog entry so that the new index is visible to updating
* transactions. That will prevent them from making incompatible HOT
* updates. The new index will be marked not indisready and not
* indisvalid, so that no one else tries to either insert into it or use
- * it for queries. We pass skip_build = true to prevent the build.
+ * it for queries. We pass skip_build = true to prevent the build.
*/
indexRelationId =
index_create(relationId, indexRelationName, indexRelationId,
indexInfo, accessMethodId, tablespaceId, classObjectId,
coloptions, reloptions, primary, isconstraint,
- allowSystemTableMods, true, concurrent);
+ allowSystemTableMods, true, concurrent);
/*
* We must commit our current transaction so that the index becomes
@@ -506,15 +505,15 @@ DefineIndex(RangeVar *heapRelation,
* xacts that open the table for writing after this point; they will see
* the new index when they open it.
*
- * Note: the reason we use actual lock acquisition here, rather than
- * just checking the ProcArray and sleeping, is that deadlock is possible
- * if one of the transactions in question is blocked trying to acquire
- * an exclusive lock on our table. The lock code will detect deadlock
- * and error out properly.
+ * Note: the reason we use actual lock acquisition here, rather than just
+ * checking the ProcArray and sleeping, is that deadlock is possible if
+ * one of the transactions in question is blocked trying to acquire an
+ * exclusive lock on our table. The lock code will detect deadlock and
+ * error out properly.
*
* Note: GetLockConflicts() never reports our own xid, hence we need not
- * check for that. Also, prepared xacts are not reported, which is
- * fine since they certainly aren't going to do anything more.
+ * check for that. Also, prepared xacts are not reported, which is fine
+ * since they certainly aren't going to do anything more.
*/
old_lockholders = GetLockConflicts(&heaplocktag, ShareLock);
@@ -530,15 +529,15 @@ DefineIndex(RangeVar *heapRelation,
* indexes. We have waited out all the existing transactions and any new
* transaction will have the new index in its list, but the index is still
* marked as "not-ready-for-inserts". The index is consulted while
- * deciding HOT-safety though. This arrangement ensures that no new HOT
+ * deciding HOT-safety though. This arrangement ensures that no new HOT
* chains can be created where the new tuple and the old tuple in the
* chain have different index keys.
*
* We now take a new snapshot, and build the index using all tuples that
- * are visible in this snapshot. We can be sure that any HOT updates
- * to these tuples will be compatible with the index, since any updates
- * made by transactions that didn't know about the index are now committed
- * or rolled back. Thus, each visible tuple is either the end of its
+ * are visible in this snapshot. We can be sure that any HOT updates to
+ * these tuples will be compatible with the index, since any updates made
+ * by transactions that didn't know about the index are now committed or
+ * rolled back. Thus, each visible tuple is either the end of its
* HOT-chain or the extension of the chain is HOT-safe for this index.
*/
@@ -565,10 +564,9 @@ DefineIndex(RangeVar *heapRelation,
index_close(indexRelation, NoLock);
/*
- * Update the pg_index row to mark the index as ready for inserts.
- * Once we commit this transaction, any new transactions that
- * open the table must insert new entries into the index for insertions
- * and non-HOT updates.
+ * Update the pg_index row to mark the index as ready for inserts. Once we
+ * commit this transaction, any new transactions that open the table must
+ * insert new entries into the index for insertions and non-HOT updates.
*/
pg_index = heap_open(IndexRelationId, RowExclusiveLock);
@@ -611,8 +609,8 @@ DefineIndex(RangeVar *heapRelation,
/*
* Now take the "reference snapshot" that will be used by validate_index()
- * to filter candidate tuples. Beware! There might still be snapshots
- * in use that treat some transaction as in-progress that our reference
+ * to filter candidate tuples. Beware! There might still be snapshots in
+ * use that treat some transaction as in-progress that our reference
* snapshot treats as committed. If such a recently-committed transaction
* deleted tuples in the table, we will not include them in the index; yet
* those transactions which see the deleting one as still-in-progress will
@@ -636,15 +634,15 @@ DefineIndex(RangeVar *heapRelation,
* The index is now valid in the sense that it contains all currently
* interesting tuples. But since it might not contain tuples deleted just
* before the reference snap was taken, we have to wait out any
- * transactions that might have older snapshots. Obtain a list of
- * VXIDs of such transactions, and wait for them individually.
+ * transactions that might have older snapshots. Obtain a list of VXIDs
+ * of such transactions, and wait for them individually.
*
* We can exclude any running transactions that have xmin >= the xmax of
* our reference snapshot, since they are clearly not interested in any
* missing older tuples. Transactions in other DBs aren't a problem
- * either, since they'll never even be able to see this index.
- * Also, GetCurrentVirtualXIDs never reports our own vxid, so we
- * need not check for that.
+ * either, since they'll never even be able to see this index. Also,
+ * GetCurrentVirtualXIDs never reports our own vxid, so we need not check
+ * for that.
*/
old_snapshots = GetCurrentVirtualXIDs(ActiveSnapshot->xmax, false);
@@ -681,8 +679,8 @@ DefineIndex(RangeVar *heapRelation,
* relcache entries for the index itself, but we should also send a
* relcache inval on the parent table to force replanning of cached plans.
* Otherwise existing sessions might fail to use the new index where it
- * would be useful. (Note that our earlier commits did not create
- * reasons to replan; relcache flush on the index itself was sufficient.)
+ * would be useful. (Note that our earlier commits did not create reasons
+ * to replan; relcache flush on the index itself was sufficient.)
*/
CacheInvalidateRelcacheByRelid(heaprelid.relId);
@@ -837,9 +835,9 @@ ComputeIndexAttrs(IndexInfo *indexInfo,
accessMethodId);
/*
- * Set up the per-column options (indoption field). For now, this
- * is zero for any un-ordered index, while ordered indexes have DESC
- * and NULLS FIRST/LAST options.
+ * Set up the per-column options (indoption field). For now, this is
+ * zero for any un-ordered index, while ordered indexes have DESC and
+ * NULLS FIRST/LAST options.
*/
colOptionP[attn] = 0;
if (amcanorder)
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index cc15e2b2cd..05b94d6283 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.55 2007/11/11 19:22:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/opclasscmds.c,v 1.56 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,33 +52,33 @@ typedef struct
Oid lefttype; /* lefttype */
Oid righttype; /* righttype */
bool recheck; /* oper recheck flag (unused for proc) */
-} OpFamilyMember;
+} OpFamilyMember;
static void AlterOpFamilyAdd(List *opfamilyname, Oid amoid, Oid opfamilyoid,
int maxOpNumber, int maxProcNumber,
List *items);
static void AlterOpFamilyDrop(List *opfamilyname, Oid amoid, Oid opfamilyoid,
- int maxOpNumber, int maxProcNumber,
- List *items);
+ int maxOpNumber, int maxProcNumber,
+ List *items);
static void processTypesSpec(List *args, Oid *lefttype, Oid *righttype);
-static void assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid);
-static void assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid);
-static void addFamilyMember(List **list, OpFamilyMember *member, bool isProc);
+static void assignOperTypes(OpFamilyMember * member, Oid amoid, Oid typeoid);
+static void assignProcTypes(OpFamilyMember * member, Oid amoid, Oid typeoid);
+static void addFamilyMember(List **list, OpFamilyMember * member, bool isProc);
static void storeOperators(List *opfamilyname, Oid amoid,
- Oid opfamilyoid, Oid opclassoid,
- List *operators, bool isAdd);
+ Oid opfamilyoid, Oid opclassoid,
+ List *operators, bool isAdd);
static void storeProcedures(List *opfamilyname, Oid amoid,
- Oid opfamilyoid, Oid opclassoid,
- List *procedures, bool isAdd);
+ Oid opfamilyoid, Oid opclassoid,
+ List *procedures, bool isAdd);
static void dropOperators(List *opfamilyname, Oid amoid, Oid opfamilyoid,
- List *operators);
+ List *operators);
static void dropProcedures(List *opfamilyname, Oid amoid, Oid opfamilyoid,
- List *procedures);
+ List *procedures);
static void AlterOpClassOwner_internal(Relation rel, HeapTuple tuple,
Oid newOwnerId);
static void AlterOpFamilyOwner_internal(Relation rel, HeapTuple tuple,
- Oid newOwnerId);
+ Oid newOwnerId);
/*
@@ -111,7 +111,7 @@ OpFamilyCacheLookup(Oid amID, List *opfamilyname)
else
{
/* Unqualified opfamily name, so search the search path */
- Oid opfID = OpfamilynameGetOpfid(amID, opfname);
+ Oid opfID = OpfamilynameGetOpfid(amID, opfname);
if (!OidIsValid(opfID))
return NULL;
@@ -151,7 +151,7 @@ OpClassCacheLookup(Oid amID, List *opclassname)
else
{
/* Unqualified opclass name, so search the search path */
- Oid opcID = OpclassnameGetOpcid(amID, opcname);
+ Oid opcID = OpclassnameGetOpcid(amID, opcname);
if (!OidIsValid(opcID))
return NULL;
@@ -348,8 +348,9 @@ DefineOpClass(CreateOpClassStmt *stmt)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("operator family \"%s\" does not exist for access method \"%s\"",
- NameListToString(stmt->opfamilyname), stmt->amname)));
+ NameListToString(stmt->opfamilyname), stmt->amname)));
opfamilyoid = HeapTupleGetOid(tup);
+
/*
* XXX given the superuser check above, there's no need for an
* ownership check here
@@ -367,6 +368,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
if (HeapTupleIsValid(tup))
{
opfamilyoid = HeapTupleGetOid(tup);
+
/*
* XXX given the superuser check above, there's no need for an
* ownership check here
@@ -597,7 +599,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
opclassoid, procedures, false);
/*
- * Create dependencies for the opclass proper. Note: we do not create a
+ * Create dependencies for the opclass proper. Note: we do not create a
* dependency link to the AM, because we don't currently support DROP
* ACCESS METHOD.
*/
@@ -644,7 +646,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
* Define a new index operator family.
*/
void
-DefineOpFamily(CreateOpFamilyStmt *stmt)
+DefineOpFamily(CreateOpFamilyStmt * stmt)
{
char *opfname; /* name of opfamily we're creating */
Oid amoid, /* our AM's oid */
@@ -686,8 +688,8 @@ DefineOpFamily(CreateOpFamilyStmt *stmt)
ReleaseSysCache(tup);
/*
- * Currently, we require superuser privileges to create an opfamily.
- * See comments in DefineOpClass.
+ * Currently, we require superuser privileges to create an opfamily. See
+ * comments in DefineOpClass.
*
* XXX re-enable NOT_USED code sections below if you remove this test.
*/
@@ -763,7 +765,7 @@ DefineOpFamily(CreateOpFamilyStmt *stmt)
* different code paths.
*/
void
-AlterOpFamily(AlterOpFamilyStmt *stmt)
+AlterOpFamily(AlterOpFamilyStmt * stmt)
{
Oid amoid, /* our AM's oid */
opfamilyoid; /* oid of opfamily */
@@ -876,7 +878,7 @@ AlterOpFamilyAdd(List *opfamilyname, Oid amoid, Oid opfamilyoid,
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("operator argument types must be specified in ALTER OPERATOR FAMILY")));
- operOid = InvalidOid; /* keep compiler quiet */
+ operOid = InvalidOid; /* keep compiler quiet */
}
#ifdef NOT_USED
@@ -932,7 +934,7 @@ AlterOpFamilyAdd(List *opfamilyname, Oid amoid, Oid opfamilyoid,
case OPCLASS_ITEM_STORAGETYPE:
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("STORAGE cannot be specified in ALTER OPERATOR FAMILY")));
+ errmsg("STORAGE cannot be specified in ALTER OPERATOR FAMILY")));
break;
default:
elog(ERROR, "unrecognized item type: %d", item->itemtype);
@@ -1057,7 +1059,7 @@ processTypesSpec(List *args, Oid *lefttype, Oid *righttype)
* and do any validity checking we can manage.
*/
static void
-assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
+assignOperTypes(OpFamilyMember * member, Oid amoid, Oid typeoid)
{
Operator optup;
Form_pg_operator opform;
@@ -1098,7 +1100,7 @@ assignOperTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
* and do any validity checking we can manage.
*/
static void
-assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
+assignProcTypes(OpFamilyMember * member, Oid amoid, Oid typeoid)
{
HeapTuple proctup;
Form_pg_proc procform;
@@ -1156,10 +1158,10 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
else
{
/*
- * The default for GiST and GIN in CREATE OPERATOR CLASS is to use
- * the class' opcintype as lefttype and righttype. In CREATE or
- * ALTER OPERATOR FAMILY, opcintype isn't available, so make the
- * user specify the types.
+ * The default for GiST and GIN in CREATE OPERATOR CLASS is to use the
+ * class' opcintype as lefttype and righttype. In CREATE or ALTER
+ * OPERATOR FAMILY, opcintype isn't available, so make the user
+ * specify the types.
*/
if (!OidIsValid(member->lefttype))
member->lefttype = typeoid;
@@ -1179,7 +1181,7 @@ assignProcTypes(OpFamilyMember *member, Oid amoid, Oid typeoid)
* duplicated strategy or proc number.
*/
static void
-addFamilyMember(List **list, OpFamilyMember *member, bool isProc)
+addFamilyMember(List **list, OpFamilyMember * member, bool isProc)
{
ListCell *l;
@@ -1560,7 +1562,7 @@ RemoveOpClass(RemoveOpClassStmt *stmt)
* Deletes an opfamily.
*/
void
-RemoveOpFamily(RemoveOpFamilyStmt *stmt)
+RemoveOpFamily(RemoveOpFamilyStmt * stmt)
{
Oid amID,
opfID;
@@ -1589,11 +1591,11 @@ RemoveOpFamily(RemoveOpFamilyStmt *stmt)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("operator family \"%s\" does not exist for access method \"%s\"",
- NameListToString(stmt->opfamilyname), stmt->amname)));
+ NameListToString(stmt->opfamilyname), stmt->amname)));
else
ereport(NOTICE,
(errmsg("operator family \"%s\" does not exist for access method \"%s\"",
- NameListToString(stmt->opfamilyname), stmt->amname)));
+ NameListToString(stmt->opfamilyname), stmt->amname)));
return;
}
@@ -2120,7 +2122,7 @@ AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwnerId)
}
/*
- * The first parameter is pg_opfamily, opened and suitably locked. The second
+ * The first parameter is pg_opfamily, opened and suitably locked. The second
* parameter is a copy of the tuple from pg_opfamily we want to modify.
*/
static void
diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c
index 8de6b4bebf..1ae9d5186b 100644
--- a/src/backend/commands/operatorcmds.c
+++ b/src/backend/commands/operatorcmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.37 2007/11/11 19:22:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.38 2007/11/15 21:14:33 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -65,7 +65,7 @@ DefineOperator(List *names, List *parameters)
Oid oprNamespace;
AclResult aclresult;
bool canMerge = false; /* operator merges */
- bool canHash = false; /* operator hashes */
+ bool canHash = false; /* operator hashes */
List *functionName = NIL; /* function for operator */
TypeName *typeName1 = NULL; /* first type name */
TypeName *typeName2 = NULL; /* second type name */
diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c
index e8f21d4f08..ba9e9a2320 100644
--- a/src/backend/commands/portalcmds.c
+++ b/src/backend/commands/portalcmds.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.66 2007/10/24 23:27:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.67 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,7 @@
* utilityStmt field is set.
*/
void
-PerformCursorOpen(PlannedStmt *stmt, ParamListInfo params,
+PerformCursorOpen(PlannedStmt * stmt, ParamListInfo params,
const char *queryString, bool isTopLevel)
{
DeclareCursorStmt *cstmt = (DeclareCursorStmt *) stmt->utilityStmt;
@@ -102,7 +102,7 @@ PerformCursorOpen(PlannedStmt *stmt, ParamListInfo params,
*
* If the user didn't specify a SCROLL type, allow or disallow scrolling
* based on whether it would require any additional runtime overhead to do
- * so. Also, we disallow scrolling for FOR UPDATE cursors.
+ * so. Also, we disallow scrolling for FOR UPDATE cursors.
*/
portal->cursorOptions = cstmt->options;
if (!(portal->cursorOptions & (CURSOR_OPT_SCROLL | CURSOR_OPT_NO_SCROLL)))
@@ -369,8 +369,8 @@ PersistHoldablePortal(Portal portal)
* to be at, but the tuplestore API doesn't support that. So we start
* at the beginning of the tuplestore and iterate through it until we
* reach where we need to be. FIXME someday? (Fortunately, the
- * typical case is that we're supposed to be at or near the start
- * of the result set, so this isn't as bad as it sounds.)
+ * typical case is that we're supposed to be at or near the start of
+ * the result set, so this isn't as bad as it sounds.)
*/
MemoryContextSwitchTo(portal->holdContext);
@@ -378,7 +378,7 @@ PersistHoldablePortal(Portal portal)
{
/* we can handle this case even if posOverflow */
while (tuplestore_advance(portal->holdStore, true))
- /* continue */ ;
+ /* continue */ ;
}
else
{
diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c
index 0a7f565316..4e86b7eebf 100644
--- a/src/backend/commands/prepare.c
+++ b/src/backend/commands/prepare.c
@@ -10,7 +10,7 @@
* Copyright (c) 2002-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.78 2007/11/11 19:22:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.79 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,7 +44,7 @@ static HTAB *prepared_queries = NULL;
static void InitQueryHashTable(void);
static ParamListInfo EvaluateParams(PreparedStatement *pstmt, List *params,
- const char *queryString, EState *estate);
+ const char *queryString, EState *estate);
static Datum build_regtype_array(Oid *param_types, int num_params);
/*
@@ -101,8 +101,8 @@ PrepareQuery(PrepareStmt *stmt, const char *queryString)
* passed in from above us will not be visible to it), allowing
* information about unknown parameters to be deduced from context.
*
- * Because parse analysis scribbles on the raw querytree, we must make
- * a copy to ensure we have a pristine raw tree to cache. FIXME someday.
+ * Because parse analysis scribbles on the raw querytree, we must make a
+ * copy to ensure we have a pristine raw tree to cache. FIXME someday.
*/
query = parse_analyze_varparams((Node *) copyObject(stmt->query),
queryString,
@@ -155,7 +155,7 @@ PrepareQuery(PrepareStmt *stmt, const char *queryString)
CreateCommandTag((Node *) query),
argtypes,
nargs,
- 0, /* default cursor options */
+ 0, /* default cursor options */
plan_list,
true);
}
@@ -299,8 +299,8 @@ EvaluateParams(PreparedStatement *pstmt, List *params,
if (nparams != num_params)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("wrong number of parameters for prepared statement \"%s\"",
- pstmt->stmt_name),
+ errmsg("wrong number of parameters for prepared statement \"%s\"",
+ pstmt->stmt_name),
errdetail("Expected %d parameters but got %d.",
num_params, nparams)));
@@ -309,8 +309,8 @@ EvaluateParams(PreparedStatement *pstmt, List *params,
return NULL;
/*
- * We have to run parse analysis for the expressions. Since the
- * parser is not cool about scribbling on its input, copy first.
+ * We have to run parse analysis for the expressions. Since the parser is
+ * not cool about scribbling on its input, copy first.
*/
params = (List *) copyObject(params);
@@ -334,7 +334,7 @@ EvaluateParams(PreparedStatement *pstmt, List *params,
if (pstate->p_hasAggs)
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
- errmsg("cannot use aggregate function in EXECUTE parameter")));
+ errmsg("cannot use aggregate function in EXECUTE parameter")));
given_type_id = exprType(expr);
@@ -350,7 +350,7 @@ EvaluateParams(PreparedStatement *pstmt, List *params,
i + 1,
format_type_be(given_type_id),
format_type_be(expected_type_id)),
- errhint("You will need to rewrite or cast the expression.")));
+ errhint("You will need to rewrite or cast the expression.")));
lfirst(l) = expr;
i++;
@@ -734,8 +734,8 @@ pg_prepared_statement(PG_FUNCTION_ARGS)
oldcontext = MemoryContextSwitchTo(per_query_ctx);
/*
- * build tupdesc for result tuples. This must match the definition of
- * the pg_prepared_statements view in system_views.sql
+ * build tupdesc for result tuples. This must match the definition of the
+ * pg_prepared_statements view in system_views.sql
*/
tupdesc = CreateTemplateTupleDesc(5, false);
TupleDescInitEntry(tupdesc, (AttrNumber) 1, "name",
@@ -780,11 +780,11 @@ pg_prepared_statement(PG_FUNCTION_ARGS)
nulls[1] = true;
else
values[1] = DirectFunctionCall1(textin,
- CStringGetDatum(prep_stmt->plansource->query_string));
+ CStringGetDatum(prep_stmt->plansource->query_string));
values[2] = TimestampTzGetDatum(prep_stmt->prepare_time);
values[3] = build_regtype_array(prep_stmt->plansource->param_types,
- prep_stmt->plansource->num_params);
+ prep_stmt->plansource->num_params);
values[4] = BoolGetDatum(prep_stmt->from_sql);
tuple = heap_form_tuple(tupdesc, values, nulls);
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index b103667935..80e5d3d7dc 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.46 2007/06/23 22:12:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.47 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -111,17 +111,17 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString)
/*
* Examine the list of commands embedded in the CREATE SCHEMA command, and
* reorganize them into a sequentially executable order with no forward
- * references. Note that the result is still a list of raw parsetrees
- * --- we cannot, in general, run parse analysis on one statement until
- * we have actually executed the prior ones.
+ * references. Note that the result is still a list of raw parsetrees ---
+ * we cannot, in general, run parse analysis on one statement until we
+ * have actually executed the prior ones.
*/
parsetree_list = transformCreateSchemaStmt(stmt);
/*
- * Execute each command contained in the CREATE SCHEMA. Since the
- * grammar allows only utility commands in CREATE SCHEMA, there is
- * no need to pass them through parse_analyze() or the rewriter;
- * we can just hand them straight to ProcessUtility.
+ * Execute each command contained in the CREATE SCHEMA. Since the grammar
+ * allows only utility commands in CREATE SCHEMA, there is no need to pass
+ * them through parse_analyze() or the rewriter; we can just hand them
+ * straight to ProcessUtility.
*/
foreach(parsetree_item, parsetree_list)
{
@@ -131,7 +131,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString)
ProcessUtility(stmt,
queryString,
NULL,
- false, /* not top level */
+ false, /* not top level */
None_Receiver,
NULL);
/* make sure later steps can see the object created here */
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 619e289206..54799447c4 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.147 2007/10/25 18:54:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.148 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1145,8 +1145,8 @@ init_params(List *options, bool isInit,
snprintf(bufm, sizeof(bufm), INT64_FORMAT, new->max_value);
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("START value (%s) cannot be greater than MAXVALUE (%s)",
- bufs, bufm)));
+ errmsg("START value (%s) cannot be greater than MAXVALUE (%s)",
+ bufs, bufm)));
}
/* CACHE */
@@ -1221,7 +1221,7 @@ process_owned_by(Relation seqrel, List *owned_by)
if (seqrel->rd_rel->relowner != tablerel->rd_rel->relowner)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
- errmsg("sequence must have same owner as table it is linked to")));
+ errmsg("sequence must have same owner as table it is linked to")));
if (RelationGetNamespace(seqrel) != RelationGetNamespace(tablerel))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 23f3619369..285bc23496 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.235 2007/11/11 19:22:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.236 2007/11/15 21:14:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -169,7 +169,7 @@ static List *MergeAttributes(List *schema, List *supers, bool istemp,
static void MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel);
static void MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel);
static void add_nonduplicate_constraint(Constraint *cdef,
- ConstrCheck *check, int *ncheck);
+ ConstrCheck *check, int *ncheck);
static bool change_varattnos_walker(Node *node, const AttrNumber *newattno);
static void StoreCatalogInheritance(Oid relationId, List *supers);
static void StoreCatalogInheritance1(Oid relationId, Oid parentOid,
@@ -256,7 +256,7 @@ static void ATExecSetRelOptions(Relation rel, List *defList, bool isReset);
static void ATExecEnableDisableTrigger(Relation rel, char *trigname,
char fires_when, bool skip_system);
static void ATExecEnableDisableRule(Relation rel, char *rulename,
- char fires_when);
+ char fires_when);
static void ATExecAddInherit(Relation rel, RangeVar *parent);
static void ATExecDropInherit(Relation rel, RangeVar *parent);
static void copy_relation_data(Relation rel, SMgrRelation dst);
@@ -395,6 +395,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
if (cdef->contype == CONSTR_CHECK)
add_nonduplicate_constraint(cdef, check, &ncheck);
}
+
/*
* parse_utilcmd.c might have passed some precooked constraints too,
* due to LIKE tab INCLUDING CONSTRAINTS
@@ -841,8 +842,8 @@ MergeAttributes(List *schema, List *supers, bool istemp,
if (list_member_oid(parentOids, RelationGetRelid(relation)))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_TABLE),
- errmsg("relation \"%s\" would be inherited from more than once",
- parent->relname)));
+ errmsg("relation \"%s\" would be inherited from more than once",
+ parent->relname)));
parentOids = lappend_oid(parentOids, RelationGetRelid(relation));
@@ -888,8 +889,8 @@ MergeAttributes(List *schema, List *supers, bool istemp,
exist_attno = findAttrByName(attributeName, inhSchema);
if (exist_attno > 0)
{
- Oid defTypeId;
- int32 deftypmod;
+ Oid defTypeId;
+ int32 deftypmod;
/*
* Yes, try to merge the two column definitions. They must
@@ -1032,8 +1033,10 @@ MergeAttributes(List *schema, List *supers, bool istemp,
if (exist_attno > 0)
{
ColumnDef *def;
- Oid defTypeId, newTypeId;
- int32 deftypmod, newtypmod;
+ Oid defTypeId,
+ newTypeId;
+ int32 deftypmod,
+ newtypmod;
/*
* Yes, try to merge the two column definitions. They must
@@ -1632,8 +1635,8 @@ renamerel(Oid myrelid, const char *newrelname, ObjectType reltype)
bool relhastriggers;
/*
- * Grab an exclusive lock on the target table, index, sequence or
- * view, which we will NOT release until end of transaction.
+ * Grab an exclusive lock on the target table, index, sequence or view,
+ * which we will NOT release until end of transaction.
*/
targetrelation = relation_open(myrelid, AccessExclusiveLock);
@@ -1647,9 +1650,8 @@ renamerel(Oid myrelid, const char *newrelname, ObjectType reltype)
RelationGetRelationName(targetrelation))));
/*
- * For compatibility with prior releases, we don't complain if
- * ALTER TABLE or ALTER INDEX is used to rename a sequence or
- * view.
+ * For compatibility with prior releases, we don't complain if ALTER TABLE
+ * or ALTER INDEX is used to rename a sequence or view.
*/
relkind = targetrelation->rd_rel->relkind;
if (reltype == OBJECT_SEQUENCE && relkind != 'S')
@@ -1746,19 +1748,19 @@ renamerel(Oid myrelid, const char *newrelname, ObjectType reltype)
void
AlterTable(AlterTableStmt *stmt)
{
- Relation rel = relation_openrv(stmt->relation, AccessExclusiveLock);
+ Relation rel = relation_openrv(stmt->relation, AccessExclusiveLock);
int expected_refcnt;
/*
- * Disallow ALTER TABLE when the current backend has any open reference
- * to it besides the one we just got (such as an open cursor or active
- * plan); our AccessExclusiveLock doesn't protect us against stomping on
- * our own foot, only other people's feet!
+ * Disallow ALTER TABLE when the current backend has any open reference to
+ * it besides the one we just got (such as an open cursor or active plan);
+ * our AccessExclusiveLock doesn't protect us against stomping on our own
+ * foot, only other people's feet!
*
- * Note: the only case known to cause serious trouble is ALTER COLUMN TYPE,
- * and some changes are obviously pretty benign, so this could possibly
- * be relaxed to only error out for certain types of alterations. But
- * the use-case for allowing any of these things is not obvious, so we
+ * Note: the only case known to cause serious trouble is ALTER COLUMN
+ * TYPE, and some changes are obviously pretty benign, so this could
+ * possibly be relaxed to only error out for certain types of alterations.
+ * But the use-case for allowing any of these things is not obvious, so we
* won't work hard at it for now.
*/
expected_refcnt = rel->rd_isnailed ? 2 : 1;
@@ -1784,7 +1786,7 @@ AlterTable(AlterTableStmt *stmt)
void
AlterTableInternal(Oid relid, List *cmds, bool recurse)
{
- Relation rel = relation_open(relid, AccessExclusiveLock);
+ Relation rel = relation_open(relid, AccessExclusiveLock);
ATController(rel, cmds, recurse);
}
@@ -2153,54 +2155,54 @@ ATExecCmd(AlteredTableInfo *tab, Relation rel, AlterTableCmd *cmd)
ATExecSetRelOptions(rel, (List *) cmd->def, true);
break;
- case AT_EnableTrig: /* ENABLE TRIGGER name */
- ATExecEnableDisableTrigger(rel, cmd->name,
- TRIGGER_FIRES_ON_ORIGIN, false);
+ case AT_EnableTrig: /* ENABLE TRIGGER name */
+ ATExecEnableDisableTrigger(rel, cmd->name,
+ TRIGGER_FIRES_ON_ORIGIN, false);
break;
- case AT_EnableAlwaysTrig: /* ENABLE ALWAYS TRIGGER name */
- ATExecEnableDisableTrigger(rel, cmd->name,
- TRIGGER_FIRES_ALWAYS, false);
+ case AT_EnableAlwaysTrig: /* ENABLE ALWAYS TRIGGER name */
+ ATExecEnableDisableTrigger(rel, cmd->name,
+ TRIGGER_FIRES_ALWAYS, false);
break;
- case AT_EnableReplicaTrig: /* ENABLE REPLICA TRIGGER name */
- ATExecEnableDisableTrigger(rel, cmd->name,
- TRIGGER_FIRES_ON_REPLICA, false);
+ case AT_EnableReplicaTrig: /* ENABLE REPLICA TRIGGER name */
+ ATExecEnableDisableTrigger(rel, cmd->name,
+ TRIGGER_FIRES_ON_REPLICA, false);
break;
case AT_DisableTrig: /* DISABLE TRIGGER name */
- ATExecEnableDisableTrigger(rel, cmd->name,
- TRIGGER_DISABLED, false);
+ ATExecEnableDisableTrigger(rel, cmd->name,
+ TRIGGER_DISABLED, false);
break;
case AT_EnableTrigAll: /* ENABLE TRIGGER ALL */
- ATExecEnableDisableTrigger(rel, NULL,
- TRIGGER_FIRES_ON_ORIGIN, false);
+ ATExecEnableDisableTrigger(rel, NULL,
+ TRIGGER_FIRES_ON_ORIGIN, false);
break;
case AT_DisableTrigAll: /* DISABLE TRIGGER ALL */
- ATExecEnableDisableTrigger(rel, NULL,
- TRIGGER_DISABLED, false);
+ ATExecEnableDisableTrigger(rel, NULL,
+ TRIGGER_DISABLED, false);
break;
case AT_EnableTrigUser: /* ENABLE TRIGGER USER */
- ATExecEnableDisableTrigger(rel, NULL,
- TRIGGER_FIRES_ON_ORIGIN, true);
+ ATExecEnableDisableTrigger(rel, NULL,
+ TRIGGER_FIRES_ON_ORIGIN, true);
break;
case AT_DisableTrigUser: /* DISABLE TRIGGER USER */
- ATExecEnableDisableTrigger(rel, NULL,
- TRIGGER_DISABLED, true);
+ ATExecEnableDisableTrigger(rel, NULL,
+ TRIGGER_DISABLED, true);
break;
- case AT_EnableRule: /* ENABLE RULE name */
- ATExecEnableDisableRule(rel, cmd->name,
- RULE_FIRES_ON_ORIGIN);
+ case AT_EnableRule: /* ENABLE RULE name */
+ ATExecEnableDisableRule(rel, cmd->name,
+ RULE_FIRES_ON_ORIGIN);
break;
- case AT_EnableAlwaysRule: /* ENABLE ALWAYS RULE name */
- ATExecEnableDisableRule(rel, cmd->name,
- RULE_FIRES_ALWAYS);
+ case AT_EnableAlwaysRule: /* ENABLE ALWAYS RULE name */
+ ATExecEnableDisableRule(rel, cmd->name,
+ RULE_FIRES_ALWAYS);
break;
- case AT_EnableReplicaRule: /* ENABLE REPLICA RULE name */
- ATExecEnableDisableRule(rel, cmd->name,
- RULE_FIRES_ON_REPLICA);
+ case AT_EnableReplicaRule: /* ENABLE REPLICA RULE name */
+ ATExecEnableDisableRule(rel, cmd->name,
+ RULE_FIRES_ON_REPLICA);
break;
case AT_DisableRule: /* DISABLE RULE name */
- ATExecEnableDisableRule(rel, cmd->name,
- RULE_DISABLED);
+ ATExecEnableDisableRule(rel, cmd->name,
+ RULE_DISABLED);
break;
case AT_AddInherit:
@@ -2303,8 +2305,8 @@ ATRewriteTables(List **wqueue)
/*
* Swap the physical files of the old and new heaps. Since we are
- * generating a new heap, we can use RecentXmin for the table's new
- * relfrozenxid because we rewrote all the tuples on
+ * generating a new heap, we can use RecentXmin for the table's
+ * new relfrozenxid because we rewrote all the tuples on
* ATRewriteTable, so no older Xid remains on the table.
*/
swap_relation_files(tab->relid, OIDNewHeap, RecentXmin);
@@ -3011,8 +3013,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
if (HeapTupleIsValid(tuple))
{
Form_pg_attribute childatt = (Form_pg_attribute) GETSTRUCT(tuple);
- Oid ctypeId;
- int32 ctypmod;
+ Oid ctypeId;
+ int32 ctypmod;
/* Okay if child matches by type */
ctypeId = typenameTypeId(NULL, colDef->typename, &ctypmod);
@@ -3819,8 +3821,8 @@ ATExecAddConstraint(AlteredTableInfo *tab, Relation rel, Node *newConstraint)
/*
* Currently, we only expect to see CONSTR_CHECK nodes
* arriving here (see the preprocessing done in
- * parse_utilcmd.c). Use a switch anyway to make it easier
- * to add more code later.
+ * parse_utilcmd.c). Use a switch anyway to make it easier to
+ * add more code later.
*/
switch (constr->contype)
{
@@ -4030,7 +4032,7 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
*
* Note that we have to be careful about the difference between the actual
* PK column type and the opclass' declared input type, which might be
- * only binary-compatible with it. The declared opcintype is the right
+ * only binary-compatible with it. The declared opcintype is the right
* thing to probe pg_amop with.
*/
if (numfks != numpks)
@@ -4067,10 +4069,10 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
/*
* Check it's a btree; currently this can never fail since no other
- * index AMs support unique indexes. If we ever did have other
- * types of unique indexes, we'd need a way to determine which
- * operator strategy number is equality. (Is it reasonable to
- * insist that every such index AM use btree's number for equality?)
+ * index AMs support unique indexes. If we ever did have other types
+ * of unique indexes, we'd need a way to determine which operator
+ * strategy number is equality. (Is it reasonable to insist that
+ * every such index AM use btree's number for equality?)
*/
if (amid != BTREE_AM_OID)
elog(ERROR, "only b-tree indexes are supported for foreign keys");
@@ -4088,8 +4090,8 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
eqstrategy, opcintype, opcintype, opfamily);
/*
- * Are there equality operators that take exactly the FK type?
- * Assume we should look through any domain here.
+ * Are there equality operators that take exactly the FK type? Assume
+ * we should look through any domain here.
*/
fktyped = getBaseType(fktype);
@@ -4099,21 +4101,21 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
ffeqop = get_opfamily_member(opfamily, fktyped, fktyped,
eqstrategy);
else
- ffeqop = InvalidOid; /* keep compiler quiet */
+ ffeqop = InvalidOid; /* keep compiler quiet */
if (!(OidIsValid(pfeqop) && OidIsValid(ffeqop)))
{
/*
- * Otherwise, look for an implicit cast from the FK type to
- * the opcintype, and if found, use the primary equality operator.
+ * Otherwise, look for an implicit cast from the FK type to the
+ * opcintype, and if found, use the primary equality operator.
* This is a bit tricky because opcintype might be a generic type
* such as ANYARRAY, and so what we have to test is whether the
* two actual column types can be concurrently cast to that type.
* (Otherwise, we'd fail to reject combinations such as int[] and
* point[].)
*/
- Oid input_typeids[2];
- Oid target_typeids[2];
+ Oid input_typeids[2];
+ Oid target_typeids[2];
input_typeids[0] = pktype;
input_typeids[1] = fktype;
@@ -5255,10 +5257,10 @@ ATPostAlterTypeParse(char *cmd, List **wqueue)
ListCell *list_item;
/*
- * We expect that we will get only ALTER TABLE and CREATE INDEX statements.
- * Hence, there is no need to pass them through parse_analyze() or the
- * rewriter, but instead we need to pass them through parse_utilcmd.c
- * to make them ready for execution.
+ * We expect that we will get only ALTER TABLE and CREATE INDEX
+ * statements. Hence, there is no need to pass them through
+ * parse_analyze() or the rewriter, but instead we need to pass them
+ * through parse_utilcmd.c to make them ready for execution.
*/
raw_parsetree_list = raw_parser(cmd);
querytree_list = NIL;
@@ -5272,8 +5274,8 @@ ATPostAlterTypeParse(char *cmd, List **wqueue)
cmd));
else if (IsA(stmt, AlterTableStmt))
querytree_list = list_concat(querytree_list,
- transformAlterTableStmt((AlterTableStmt *) stmt,
- cmd));
+ transformAlterTableStmt((AlterTableStmt *) stmt,
+ cmd));
else
querytree_list = lappend(querytree_list, stmt);
}
@@ -5528,7 +5530,7 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing)
*/
if (tuple_class->relkind != RELKIND_INDEX)
AlterTypeOwnerInternal(tuple_class->reltype, newOwnerId,
- tuple_class->relkind == RELKIND_COMPOSITE_TYPE);
+ tuple_class->relkind == RELKIND_COMPOSITE_TYPE);
/*
* If we are operating on a table, also change the ownership of any
@@ -5983,7 +5985,7 @@ ATExecEnableDisableTrigger(Relation rel, char *trigname,
*/
static void
ATExecEnableDisableRule(Relation rel, char *trigname,
- char fires_when)
+ char fires_when)
{
EnableDisableRule(rel, trigname, fires_when);
}
@@ -6051,8 +6053,8 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent)
if (inh->inhparent == RelationGetRelid(parent_rel))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_TABLE),
- errmsg("relation \"%s\" would be inherited from more than once",
- RelationGetRelationName(parent_rel))));
+ errmsg("relation \"%s\" would be inherited from more than once",
+ RelationGetRelationName(parent_rel))));
if (inh->inhseqno > inhseqno)
inhseqno = inh->inhseqno;
}
@@ -6063,12 +6065,12 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent)
* (In particular, this disallows making a rel inherit from itself.)
*
* This is not completely bulletproof because of race conditions: in
- * multi-level inheritance trees, someone else could concurrently
- * be making another inheritance link that closes the loop but does
- * not join either of the rels we have locked. Preventing that seems
- * to require exclusive locks on the entire inheritance tree, which is
- * a cure worse than the disease. find_all_inheritors() will cope with
- * circularity anyway, so don't sweat it too much.
+ * multi-level inheritance trees, someone else could concurrently be
+ * making another inheritance link that closes the loop but does not join
+ * either of the rels we have locked. Preventing that seems to require
+ * exclusive locks on the entire inheritance tree, which is a cure worse
+ * than the disease. find_all_inheritors() will cope with circularity
+ * anyway, so don't sweat it too much.
*/
children = find_all_inheritors(RelationGetRelid(child_rel));
@@ -6095,7 +6097,7 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent)
MergeConstraintsIntoExisting(child_rel, parent_rel);
/*
- * OK, it looks valid. Make the catalog entries that show inheritance.
+ * OK, it looks valid. Make the catalog entries that show inheritance.
*/
StoreCatalogInheritance1(RelationGetRelid(child_rel),
RelationGetRelid(parent_rel),
@@ -6189,8 +6191,8 @@ MergeAttributesIntoExisting(Relation child_rel, Relation parent_rel)
if (attribute->attnotnull && !childatt->attnotnull)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("column \"%s\" in child table must be marked NOT NULL",
- attributeName)));
+ errmsg("column \"%s\" in child table must be marked NOT NULL",
+ attributeName)));
/*
* OK, bump the child column's inheritance count. (If we fail
@@ -6345,20 +6347,20 @@ ATExecDropInherit(Relation rel, RangeVar *parent)
bool found = false;
/*
- * AccessShareLock on the parent is probably enough, seeing that DROP TABLE
- * doesn't lock parent tables at all. We need some lock since we'll be
- * inspecting the parent's schema.
+ * AccessShareLock on the parent is probably enough, seeing that DROP
+ * TABLE doesn't lock parent tables at all. We need some lock since we'll
+ * be inspecting the parent's schema.
*/
parent_rel = heap_openrv(parent, AccessShareLock);
/*
- * We don't bother to check ownership of the parent table --- ownership
- * of the child is presumed enough rights.
+ * We don't bother to check ownership of the parent table --- ownership of
+ * the child is presumed enough rights.
*/
/*
- * Find and destroy the pg_inherits entry linking the two, or error out
- * if there is none.
+ * Find and destroy the pg_inherits entry linking the two, or error out if
+ * there is none.
*/
catalogRelation = heap_open(InheritsRelationId, RowExclusiveLock);
ScanKeyInit(&key[0],
@@ -6508,9 +6510,9 @@ AlterTableNamespace(RangeVar *relation, const char *newschema)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot move an owned sequence into another schema"),
- errdetail("Sequence \"%s\" is linked to table \"%s\".",
- RelationGetRelationName(rel),
- get_rel_name(tableId))));
+ errdetail("Sequence \"%s\" is linked to table \"%s\".",
+ RelationGetRelationName(rel),
+ get_rel_name(tableId))));
}
break;
case RELKIND_COMPOSITE_TYPE:
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 305da59da0..b212fe0823 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.50 2007/11/15 20:36:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.51 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -223,7 +223,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
if (strchr(location, '\''))
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
- errmsg("tablespace location cannot contain single quotes")));
+ errmsg("tablespace location cannot contain single quotes")));
/*
* Allowing relative paths seems risky
@@ -356,10 +356,10 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
}
/*
- * Force synchronous commit, to minimize the window between creating
- * the symlink on-disk and marking the transaction committed. It's
- * not great that there is any window at all, but definitely we don't
- * want to make it larger than necessary.
+ * Force synchronous commit, to minimize the window between creating the
+ * symlink on-disk and marking the transaction committed. It's not great
+ * that there is any window at all, but definitely we don't want to make
+ * it larger than necessary.
*/
ForceSyncCommit();
@@ -461,7 +461,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
LWLockAcquire(TablespaceCreateLock, LW_EXCLUSIVE);
/*
- * Try to remove the physical infrastructure.
+ * Try to remove the physical infrastructure.
*/
if (!remove_tablespace_directories(tablespaceoid, false))
{
@@ -469,7 +469,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
* Not all files deleted? However, there can be lingering empty files
* in the directories, left behind by for example DROP TABLE, that
* have been scheduled for deletion at next checkpoint (see comments
- * in mdunlink() for details). We could just delete them immediately,
+ * in mdunlink() for details). We could just delete them immediately,
* but we can't tell them apart from important data files that we
* mustn't delete. So instead, we force a checkpoint which will clean
* out any lingering files, and try again.
@@ -506,10 +506,10 @@ DropTableSpace(DropTableSpaceStmt *stmt)
*/
/*
- * Force synchronous commit, to minimize the window between removing
- * the files on-disk and marking the transaction committed. It's
- * not great that there is any window at all, but definitely we don't
- * want to make it larger than necessary.
+ * Force synchronous commit, to minimize the window between removing the
+ * files on-disk and marking the transaction committed. It's not great
+ * that there is any window at all, but definitely we don't want to make
+ * it larger than necessary.
*/
ForceSyncCommit();
@@ -561,7 +561,7 @@ remove_tablespace_directories(Oid tablespaceoid, bool redo)
*
* If redo is true then ENOENT is a likely outcome here, and we allow it
* to pass without comment. In normal operation we still allow it, but
- * with a warning. This is because even though ProcessUtility disallows
+ * with a warning. This is because even though ProcessUtility disallows
* DROP TABLESPACE in a transaction block, it's possible that a previous
* DROP failed and rolled back after removing the tablespace directories
* and symlink. We want to allow a new DROP attempt to succeed at
@@ -1019,12 +1019,12 @@ assign_temp_tablespaces(const char *newval, bool doit, GucSource source)
* transaction, we'll leak a bit of TopTransactionContext memory.
* Doesn't seem worth worrying about.
*/
- Oid *tblSpcs;
- int numSpcs;
+ Oid *tblSpcs;
+ int numSpcs;
ListCell *l;
tblSpcs = (Oid *) MemoryContextAlloc(TopTransactionContext,
- list_length(namelist) * sizeof(Oid));
+ list_length(namelist) * sizeof(Oid));
numSpcs = 0;
foreach(l, namelist)
{
@@ -1112,10 +1112,10 @@ PrepareTempTablespaces(void)
return;
/*
- * Can't do catalog access unless within a transaction. This is just
- * a safety check in case this function is called by low-level code that
- * could conceivably execute outside a transaction. Note that in such
- * a scenario, fd.c will fall back to using the current database's default
+ * Can't do catalog access unless within a transaction. This is just a
+ * safety check in case this function is called by low-level code that
+ * could conceivably execute outside a transaction. Note that in such a
+ * scenario, fd.c will fall back to using the current database's default
* tablespace, which should always be OK.
*/
if (!IsTransactionState())
@@ -1136,7 +1136,7 @@ PrepareTempTablespaces(void)
/* Store tablespace OIDs in an array in TopTransactionContext */
tblSpcs = (Oid *) MemoryContextAlloc(TopTransactionContext,
- list_length(namelist) * sizeof(Oid));
+ list_length(namelist) * sizeof(Oid));
numSpcs = 0;
foreach(l, namelist)
{
@@ -1160,8 +1160,8 @@ PrepareTempTablespaces(void)
}
/*
- * Allow explicit specification of database's default tablespace
- * in temp_tablespaces without triggering permissions checks.
+ * Allow explicit specification of database's default tablespace in
+ * temp_tablespaces without triggering permissions checks.
*/
if (curoid == MyDatabaseTableSpace)
{
@@ -1241,8 +1241,8 @@ get_tablespace_name(Oid spc_oid)
/*
* Search pg_tablespace. We use a heapscan here even though there is an
- * index on oid, on the theory that pg_tablespace will usually have just
- * a few entries and so an indexed lookup is a waste of effort.
+ * index on oid, on the theory that pg_tablespace will usually have just a
+ * few entries and so an indexed lookup is a waste of effort.
*/
rel = heap_open(TableSpaceRelationId, AccessShareLock);
diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c
index ca3b2ec2ce..608293cac3 100644
--- a/src/backend/commands/tsearchcmds.c
+++ b/src/backend/commands/tsearchcmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.5 2007/08/22 22:30:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.6 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,10 +46,10 @@
#include "utils/syscache.h"
-static void MakeConfigurationMapping(AlterTSConfigurationStmt *stmt,
- HeapTuple tup, Relation relMap);
-static void DropConfigurationMapping(AlterTSConfigurationStmt *stmt,
- HeapTuple tup, Relation relMap);
+static void MakeConfigurationMapping(AlterTSConfigurationStmt * stmt,
+ HeapTuple tup, Relation relMap);
+static void DropConfigurationMapping(AlterTSConfigurationStmt * stmt,
+ HeapTuple tup, Relation relMap);
/* --------------------- TS Parser commands ------------------------ */
@@ -220,8 +220,8 @@ DefineTSParser(List *names, List *parameters)
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("text search parser parameter \"%s\" not recognized",
- defel->defname)));
+ errmsg("text search parser parameter \"%s\" not recognized",
+ defel->defname)));
}
/*
@@ -366,7 +366,7 @@ RenameTSParser(List *oldname, const char *newname)
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
errmsg("text search parser \"%s\" already exists",
- newname)));
+ newname)));
namestrcpy(&(((Form_pg_ts_parser) GETSTRUCT(tup))->prsname), newname);
simple_heap_update(rel, &tup->t_self, tup);
@@ -421,10 +421,9 @@ verify_dictoptions(Oid tmplId, List *dictoptions)
/*
* Suppress this test when running in a standalone backend. This is a
* hack to allow initdb to create prefab dictionaries that might not
- * actually be usable in template1's encoding (due to using external
- * files that can't be translated into template1's encoding). We want
- * to create them anyway, since they might be usable later in other
- * databases.
+ * actually be usable in template1's encoding (due to using external files
+ * that can't be translated into template1's encoding). We want to create
+ * them anyway, since they might be usable later in other databases.
*/
if (!IsUnderPostmaster)
return;
@@ -445,14 +444,14 @@ verify_dictoptions(Oid tmplId, List *dictoptions)
if (dictoptions)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("text search template \"%s\" does not accept options",
- NameStr(tform->tmplname))));
+ errmsg("text search template \"%s\" does not accept options",
+ NameStr(tform->tmplname))));
}
else
{
/*
- * Copy the options just in case init method thinks it can scribble
- * on them ...
+ * Copy the options just in case init method thinks it can scribble on
+ * them ...
*/
dictoptions = copyObject(dictoptions);
@@ -793,8 +792,8 @@ AlterTSDictionary(AlterTSDictionaryStmt * stmt)
/*
* NOTE: because we only support altering the options, not the template,
- * there is no need to update dependencies. This might have to change
- * if the options ever reference inside-the-database objects.
+ * there is no need to update dependencies. This might have to change if
+ * the options ever reference inside-the-database objects.
*/
heap_freetuple(newtup);
@@ -966,7 +965,7 @@ DefineTSTemplate(List *names, List *parameters)
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("must be superuser to create text search templates")));
+ errmsg("must be superuser to create text search templates")));
/* Convert list of names to a name and namespace */
namespaceoid = QualifiedNameGetCreationNamespace(names, &tmplname);
@@ -1048,7 +1047,7 @@ RenameTSTemplate(List *oldname, const char *newname)
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("must be superuser to rename text search templates")));
+ errmsg("must be superuser to rename text search templates")));
rel = heap_open(TSTemplateRelationId, RowExclusiveLock);
@@ -1633,7 +1632,7 @@ AlterTSConfigurationOwner(List *name, Oid newOwnerId)
* ALTER TEXT SEARCH CONFIGURATION - main entry point
*/
void
-AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
+AlterTSConfiguration(AlterTSConfigurationStmt * stmt)
{
HeapTuple tup;
Relation relMap;
@@ -1727,7 +1726,7 @@ getTokenTypes(Oid prsId, List *tokennames)
* ALTER TEXT SEARCH CONFIGURATION ADD/ALTER MAPPING
*/
static void
-MakeConfigurationMapping(AlterTSConfigurationStmt *stmt,
+MakeConfigurationMapping(AlterTSConfigurationStmt * stmt,
HeapTuple tup, Relation relMap)
{
Oid cfgId = HeapTupleGetOid(tup);
@@ -1889,7 +1888,7 @@ MakeConfigurationMapping(AlterTSConfigurationStmt *stmt,
* ALTER TEXT SEARCH CONFIGURATION DROP MAPPING
*/
static void
-DropConfigurationMapping(AlterTSConfigurationStmt *stmt,
+DropConfigurationMapping(AlterTSConfigurationStmt * stmt,
HeapTuple tup, Relation relMap)
{
Oid cfgId = HeapTupleGetOid(tup);
@@ -1981,7 +1980,7 @@ serialize_deflist(List *deflist)
char *val = defGetString(defel);
appendStringInfo(&buf, "%s = ",
- quote_identifier(defel->defname));
+ quote_identifier(defel->defname));
/* If backslashes appear, force E syntax to determine their handling */
if (strchr(val, '\\'))
appendStringInfoChar(&buf, ESCAPE_STRING_SYNTAX);
@@ -2014,7 +2013,7 @@ serialize_deflist(List *deflist)
List *
deserialize_deflist(Datum txt)
{
- text *in = DatumGetTextP(txt); /* in case it's toasted */
+ text *in = DatumGetTextP(txt); /* in case it's toasted */
List *result = NIL;
int len = VARSIZE(in) - VARHDRSZ;
char *ptr,
@@ -2022,7 +2021,8 @@ deserialize_deflist(Datum txt)
*workspace,
*wsptr = NULL,
*startvalue = NULL;
- typedef enum {
+ typedef enum
+ {
CS_WAITKEY,
CS_INKEY,
CS_INQKEY,
@@ -2031,7 +2031,7 @@ deserialize_deflist(Datum txt)
CS_INSQVALUE,
CS_INDQVALUE,
CS_INWVALUE
- } ds_state;
+ } ds_state;
ds_state state = CS_WAITKEY;
workspace = (char *) palloc(len + 1); /* certainly enough room */
@@ -2075,7 +2075,7 @@ deserialize_deflist(Datum txt)
case CS_INQKEY:
if (*ptr == '"')
{
- if (ptr+1 < endptr && ptr[1] == '"')
+ if (ptr + 1 < endptr && ptr[1] == '"')
{
/* copy only one of the two quotes */
*wsptr++ = *ptr++;
@@ -2106,7 +2106,7 @@ deserialize_deflist(Datum txt)
startvalue = wsptr;
state = CS_INSQVALUE;
}
- else if (*ptr == 'E' && ptr+1 < endptr && ptr[1] == '\'')
+ else if (*ptr == 'E' && ptr + 1 < endptr && ptr[1] == '\'')
{
ptr++;
startvalue = wsptr;
@@ -2127,7 +2127,7 @@ deserialize_deflist(Datum txt)
case CS_INSQVALUE:
if (*ptr == '\'')
{
- if (ptr+1 < endptr && ptr[1] == '\'')
+ if (ptr + 1 < endptr && ptr[1] == '\'')
{
/* copy only one of the two quotes */
*wsptr++ = *ptr++;
@@ -2137,13 +2137,13 @@ deserialize_deflist(Datum txt)
*wsptr++ = '\0';
result = lappend(result,
makeDefElem(pstrdup(workspace),
- (Node *) makeString(pstrdup(startvalue))));
+ (Node *) makeString(pstrdup(startvalue))));
state = CS_WAITKEY;
}
}
else if (*ptr == '\\')
{
- if (ptr+1 < endptr && ptr[1] == '\\')
+ if (ptr + 1 < endptr && ptr[1] == '\\')
{
/* copy only one of the two backslashes */
*wsptr++ = *ptr++;
@@ -2159,7 +2159,7 @@ deserialize_deflist(Datum txt)
case CS_INDQVALUE:
if (*ptr == '"')
{
- if (ptr+1 < endptr && ptr[1] == '"')
+ if (ptr + 1 < endptr && ptr[1] == '"')
{
/* copy only one of the two quotes */
*wsptr++ = *ptr++;
@@ -2169,7 +2169,7 @@ deserialize_deflist(Datum txt)
*wsptr++ = '\0';
result = lappend(result,
makeDefElem(pstrdup(workspace),
- (Node *) makeString(pstrdup(startvalue))));
+ (Node *) makeString(pstrdup(startvalue))));
state = CS_WAITKEY;
}
}
@@ -2184,7 +2184,7 @@ deserialize_deflist(Datum txt)
*wsptr++ = '\0';
result = lappend(result,
makeDefElem(pstrdup(workspace),
- (Node *) makeString(pstrdup(startvalue))));
+ (Node *) makeString(pstrdup(startvalue))));
state = CS_WAITKEY;
}
else
@@ -2203,7 +2203,7 @@ deserialize_deflist(Datum txt)
*wsptr++ = '\0';
result = lappend(result,
makeDefElem(pstrdup(workspace),
- (Node *) makeString(pstrdup(startvalue))));
+ (Node *) makeString(pstrdup(startvalue))));
}
else if (state != CS_WAITKEY)
ereport(ERROR,
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 230004c59b..e93f3b9a4f 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.110 2007/11/11 19:22:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.111 2007/11/15 21:14:34 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -120,11 +120,11 @@ DefineType(List *names, List *parameters)
Oid typmodoutOid = InvalidOid;
Oid analyzeOid = InvalidOid;
char *array_type;
- Oid array_oid;
+ Oid array_oid;
ListCell *pl;
Oid typoid;
Oid resulttype;
- Relation pg_type;
+ Relation pg_type;
/* Convert list of names to a name and namespace */
typeNamespace = QualifiedNameGetCreationNamespace(names, &typeName);
@@ -145,8 +145,8 @@ DefineType(List *names, List *parameters)
0, 0);
/*
- * If it's not a shell, see if it's an autogenerated array type,
- * and if so rename it out of the way.
+ * If it's not a shell, see if it's an autogenerated array type, and if so
+ * rename it out of the way.
*/
if (OidIsValid(typoid) && get_typisdefined(typoid))
{
@@ -155,8 +155,8 @@ DefineType(List *names, List *parameters)
}
/*
- * If it doesn't exist, create it as a shell, so that the OID is known
- * for use in the I/O function definitions.
+ * If it doesn't exist, create it as a shell, so that the OID is known for
+ * use in the I/O function definitions.
*/
if (!OidIsValid(typoid))
{
@@ -404,7 +404,7 @@ DefineType(List *names, List *parameters)
NameListToString(analyzeName));
/* Preassign array type OID so we can insert it in pg_type.typarray */
- pg_type = heap_open(TypeRelationId, AccessShareLock);
+ pg_type = heap_open(TypeRelationId, AccessShareLock);
array_oid = GetNewOid(pg_type);
heap_close(pg_type, AccessShareLock);
@@ -418,14 +418,14 @@ DefineType(List *names, List *parameters)
InvalidOid, /* relation oid (n/a here) */
0, /* relation kind (ditto) */
internalLength, /* internal size */
- TYPTYPE_BASE, /* type-type (base type) */
+ TYPTYPE_BASE, /* type-type (base type) */
delimiter, /* array element delimiter */
inputOid, /* input procedure */
outputOid, /* output procedure */
receiveOid, /* receive procedure */
sendOid, /* send procedure */
typmodinOid, /* typmodin procedure */
- typmodoutOid,/* typmodout procedure */
+ typmodoutOid, /* typmodout procedure */
analyzeOid, /* analyze procedure */
elemType, /* element type ID */
false, /* this is not an array type */
@@ -517,7 +517,7 @@ RemoveType(List *names, DropBehavior behavior, bool missing_ok)
return;
}
- typeoid = typeTypeId(tup);
+ typeoid = typeTypeId(tup);
typ = (Form_pg_type) GETSTRUCT(tup);
/* Permission check: must own type or its namespace */
@@ -564,9 +564,9 @@ RemoveTypeById(Oid typeOid)
simple_heap_delete(relation, &tup->t_self);
/*
- * If it is an enum, delete the pg_enum entries too; we don't bother
- * with making dependency entries for those, so it has to be done
- * "by hand" here.
+ * If it is an enum, delete the pg_enum entries too; we don't bother with
+ * making dependency entries for those, so it has to be done "by hand"
+ * here.
*/
if (((Form_pg_type) GETSTRUCT(tup))->typtype == TYPTYPE_ENUM)
EnumValuesDelete(typeOid);
@@ -628,7 +628,7 @@ DefineDomain(CreateDomainStmt *stmt)
get_namespace_name(domainNamespace));
/*
- * Check for collision with an existing type name. If there is one and
+ * Check for collision with an existing type name. If there is one and
* it's an autogenerated array, we can rename it out of the way.
*/
old_type_oid = GetSysCacheOid(TYPENAMENSP,
@@ -651,10 +651,9 @@ DefineDomain(CreateDomainStmt *stmt)
basetypeoid = HeapTupleGetOid(typeTup);
/*
- * Base type must be a plain base type, another domain or an enum.
- * Domains over pseudotypes would create a security hole. Domains
- * over composite types might be made to work in the future, but not
- * today.
+ * Base type must be a plain base type, another domain or an enum. Domains
+ * over pseudotypes would create a security hole. Domains over composite
+ * types might be made to work in the future, but not today.
*/
typtype = baseType->typtype;
if (typtype != TYPTYPE_BASE &&
@@ -751,8 +750,8 @@ DefineDomain(CreateDomainStmt *stmt)
pstate = make_parsestate(NULL);
/*
- * Cook the constr->raw_expr into an expression.
- * Note: name is strictly for error message
+ * Cook the constr->raw_expr into an expression. Note:
+ * name is strictly for error message
*/
defaultExpr = cookDefault(pstate, constr->raw_expr,
basetypeoid,
@@ -760,8 +759,8 @@ DefineDomain(CreateDomainStmt *stmt)
domainName);
/*
- * If the expression is just a NULL constant, we treat
- * it like not having a default.
+ * If the expression is just a NULL constant, we treat it
+ * like not having a default.
*
* Note that if the basetype is another domain, we'll see
* a CoerceToDomain expr here and not discard the default.
@@ -786,7 +785,7 @@ DefineDomain(CreateDomainStmt *stmt)
defaultValue =
deparse_expression(defaultExpr,
deparse_context_for(domainName,
- InvalidOid),
+ InvalidOid),
false, false);
defaultValueBin = nodeToString(defaultExpr);
}
@@ -872,8 +871,8 @@ DefineDomain(CreateDomainStmt *stmt)
outputProcedure, /* output procedure */
receiveProcedure, /* receive procedure */
sendProcedure, /* send procedure */
- InvalidOid, /* typmodin procedure - none */
- InvalidOid, /* typmodout procedure - none */
+ InvalidOid, /* typmodin procedure - none */
+ InvalidOid, /* typmodout procedure - none */
analyzeProcedure, /* analyze procedure */
typelem, /* element type ID */
false, /* this isn't an array */
@@ -961,7 +960,7 @@ RemoveDomain(List *names, DropBehavior behavior, bool missing_ok)
return;
}
- typeoid = typeTypeId(tup);
+ typeoid = typeTypeId(tup);
/* Permission check: must own type or its namespace */
if (!pg_type_ownercheck(typeoid, GetUserId()) &&
@@ -996,16 +995,16 @@ RemoveDomain(List *names, DropBehavior behavior, bool missing_ok)
* Registers a new enum.
*/
void
-DefineEnum(CreateEnumStmt *stmt)
+DefineEnum(CreateEnumStmt * stmt)
{
- char *enumName;
- char *enumArrayName;
- Oid enumNamespace;
- Oid enumTypeOid;
+ char *enumName;
+ char *enumArrayName;
+ Oid enumNamespace;
+ Oid enumTypeOid;
AclResult aclresult;
- Oid old_type_oid;
- Oid enumArrayOid;
- Relation pg_type;
+ Oid old_type_oid;
+ Oid enumArrayOid;
+ Relation pg_type;
/* Convert list of names to a name and namespace */
enumNamespace = QualifiedNameGetCreationNamespace(stmt->typename,
@@ -1018,7 +1017,7 @@ DefineEnum(CreateEnumStmt *stmt)
get_namespace_name(enumNamespace));
/*
- * Check for collision with an existing type name. If there is one and
+ * Check for collision with an existing type name. If there is one and
* it's an autogenerated array, we can rename it out of the way.
*/
old_type_oid = GetSysCacheOid(TYPENAMENSP,
@@ -1034,39 +1033,39 @@ DefineEnum(CreateEnumStmt *stmt)
}
/* Preassign array type OID so we can insert it in pg_type.typarray */
- pg_type = heap_open(TypeRelationId, AccessShareLock);
+ pg_type = heap_open(TypeRelationId, AccessShareLock);
enumArrayOid = GetNewOid(pg_type);
heap_close(pg_type, AccessShareLock);
/* Create the pg_type entry */
- enumTypeOid =
- TypeCreate(InvalidOid, /* no predetermined type OID */
- enumName, /* type name */
- enumNamespace, /* namespace */
- InvalidOid, /* relation oid (n/a here) */
- 0, /* relation kind (ditto) */
- sizeof(Oid), /* internal size */
+ enumTypeOid =
+ TypeCreate(InvalidOid, /* no predetermined type OID */
+ enumName, /* type name */
+ enumNamespace, /* namespace */
+ InvalidOid, /* relation oid (n/a here) */
+ 0, /* relation kind (ditto) */
+ sizeof(Oid), /* internal size */
TYPTYPE_ENUM, /* type-type (enum type) */
DEFAULT_TYPDELIM, /* array element delimiter */
- F_ENUM_IN, /* input procedure */
- F_ENUM_OUT, /* output procedure */
- F_ENUM_RECV, /* receive procedure */
- F_ENUM_SEND, /* send procedure */
- InvalidOid, /* typmodin procedure - none */
- InvalidOid, /* typmodout procedure - none */
- InvalidOid, /* analyze procedure - default */
- InvalidOid, /* element type ID */
- false, /* this is not an array type */
+ F_ENUM_IN, /* input procedure */
+ F_ENUM_OUT, /* output procedure */
+ F_ENUM_RECV, /* receive procedure */
+ F_ENUM_SEND, /* send procedure */
+ InvalidOid, /* typmodin procedure - none */
+ InvalidOid, /* typmodout procedure - none */
+ InvalidOid, /* analyze procedure - default */
+ InvalidOid, /* element type ID */
+ false, /* this is not an array type */
enumArrayOid, /* array type we are about to create */
- InvalidOid, /* base type ID (only for domains) */
- NULL, /* never a default type value */
- NULL, /* binary default isn't sent either */
- true, /* always passed by value */
- 'i', /* int alignment */
- 'p', /* TOAST strategy always plain */
- -1, /* typMod (Domains only) */
- 0, /* Array dimensions of typbasetype */
- false); /* Type NOT NULL */
+ InvalidOid, /* base type ID (only for domains) */
+ NULL, /* never a default type value */
+ NULL, /* binary default isn't sent either */
+ true, /* always passed by value */
+ 'i', /* int alignment */
+ 'p', /* TOAST strategy always plain */
+ -1, /* typMod (Domains only) */
+ 0, /* Array dimensions of typbasetype */
+ false); /* Type NOT NULL */
/* Enter the enum's values into pg_enum */
EnumValuesCreate(enumTypeOid, stmt->vals);
@@ -1077,31 +1076,31 @@ DefineEnum(CreateEnumStmt *stmt)
enumArrayName = makeArrayTypeName(enumName, enumNamespace);
TypeCreate(enumArrayOid, /* force assignment of this type OID */
- enumArrayName, /* type name */
- enumNamespace, /* namespace */
- InvalidOid, /* relation oid (n/a here) */
- 0, /* relation kind (ditto) */
- -1, /* internal size (always varlena) */
+ enumArrayName, /* type name */
+ enumNamespace, /* namespace */
+ InvalidOid, /* relation oid (n/a here) */
+ 0, /* relation kind (ditto) */
+ -1, /* internal size (always varlena) */
TYPTYPE_BASE, /* type-type (base type) */
- DEFAULT_TYPDELIM, /* array element delimiter */
- F_ARRAY_IN, /* input procedure */
- F_ARRAY_OUT, /* output procedure */
- F_ARRAY_RECV, /* receive procedure */
- F_ARRAY_SEND, /* send procedure */
+ DEFAULT_TYPDELIM, /* array element delimiter */
+ F_ARRAY_IN, /* input procedure */
+ F_ARRAY_OUT, /* output procedure */
+ F_ARRAY_RECV, /* receive procedure */
+ F_ARRAY_SEND, /* send procedure */
InvalidOid, /* typmodin procedure - none */
InvalidOid, /* typmodout procedure - none */
- InvalidOid, /* analyze procedure - default */
- enumTypeOid, /* element type ID */
+ InvalidOid, /* analyze procedure - default */
+ enumTypeOid, /* element type ID */
true, /* yes this is an array type */
InvalidOid, /* no further array type */
- InvalidOid, /* base type ID */
- NULL, /* never a default type value */
- NULL, /* binary default isn't sent either */
- false, /* never passed by value */
- 'i', /* enums have align i, so do their arrays */
- 'x', /* ARRAY is always toastable */
- -1, /* typMod (Domains only) */
- 0, /* Array dimensions of typbasetype */
+ InvalidOid, /* base type ID */
+ NULL, /* never a default type value */
+ NULL, /* binary default isn't sent either */
+ false, /* never passed by value */
+ 'i', /* enums have align i, so do their arrays */
+ 'x', /* ARRAY is always toastable */
+ -1, /* typMod (Domains only) */
+ 0, /* Array dimensions of typbasetype */
false); /* Type NOT NULL */
pfree(enumArrayName);
@@ -1475,7 +1474,7 @@ AlterDomainDefault(List *names, Node *defaultRaw)
* DefineDomain.)
*/
if (defaultExpr == NULL ||
- (IsA(defaultExpr, Const) && ((Const *) defaultExpr)->constisnull))
+ (IsA(defaultExpr, Const) &&((Const *) defaultExpr)->constisnull))
{
/* Default is NULL, drop it */
new_record_nulls[Anum_pg_type_typdefaultbin - 1] = 'n';
@@ -1493,13 +1492,13 @@ AlterDomainDefault(List *names, Node *defaultRaw)
defaultValue = deparse_expression(defaultExpr,
deparse_context_for(NameStr(typTup->typname),
InvalidOid),
- false, false);
+ false, false);
/*
* Form an updated tuple with the new default and write it back.
*/
new_record[Anum_pg_type_typdefaultbin - 1] = DirectFunctionCall1(textin,
- CStringGetDatum(nodeToString(defaultExpr)));
+ CStringGetDatum(nodeToString(defaultExpr)));
new_record_repl[Anum_pg_type_typdefaultbin - 1] = 'r';
new_record[Anum_pg_type_typdefault - 1] = DirectFunctionCall1(textin,
@@ -1527,7 +1526,7 @@ AlterDomainDefault(List *names, Node *defaultRaw)
/* Rebuild dependencies */
GenerateTypeDependencies(typTup->typnamespace,
domainoid,
- InvalidOid, /* typrelid is n/a */
+ InvalidOid, /* typrelid is n/a */
0, /* relation kind is n/a */
typTup->typowner,
typTup->typinput,
@@ -1956,9 +1955,10 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
if (pg_depend->classid == TypeRelationId)
{
Assert(get_typtype(pg_depend->objid) == TYPTYPE_DOMAIN);
+
/*
- * Recursively add dependent columns to the output list. This
- * is a bit inefficient since we may fail to combine RelToCheck
+ * Recursively add dependent columns to the output list. This is
+ * a bit inefficient since we may fail to combine RelToCheck
* entries when attributes of the same rel have different derived
* domain types, but it's probably not worth improving.
*/
@@ -2365,7 +2365,7 @@ AlterTypeOwner(List *names, Oid newOwnerId)
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("type \"%s\" does not exist",
TypeNameToString(typename))));
- typeOid = typeTypeId(tup);
+ typeOid = typeTypeId(tup);
/* Copy the syscache entry so we can scribble on it below */
newtup = heap_copytuple(tup);
@@ -2375,8 +2375,8 @@ AlterTypeOwner(List *names, Oid newOwnerId)
/*
* If it's a composite type, we need to check that it really is a
- * free-standing composite type, and not a table's rowtype. We
- * want people to use ALTER TABLE not ALTER TYPE for that case.
+ * free-standing composite type, and not a table's rowtype. We want people
+ * to use ALTER TABLE not ALTER TYPE for that case.
*/
if (typTup->typtype == TYPTYPE_COMPOSITE &&
get_rel_relkind(typTup->typrelid) != RELKIND_COMPOSITE_TYPE)
@@ -2423,8 +2423,8 @@ AlterTypeOwner(List *names, Oid newOwnerId)
}
/*
- * If it's a composite type, invoke ATExecChangeOwner so that we
- * fix up the pg_class entry properly. That will call back to
+ * If it's a composite type, invoke ATExecChangeOwner so that we fix
+ * up the pg_class entry properly. That will call back to
* AlterTypeOwnerInternal to take care of the pg_type entry(s).
*/
if (typTup->typtype == TYPTYPE_COMPOSITE)
@@ -2458,7 +2458,7 @@ AlterTypeOwner(List *names, Oid newOwnerId)
/*
* AlterTypeOwnerInternal - change type owner unconditionally
*
- * This is currently only used to propagate ALTER TABLE/TYPE OWNER to a
+ * This is currently only used to propagate ALTER TABLE/TYPE OWNER to a
* table's rowtype or an array type, and to implement REASSIGN OWNED BY.
* It assumes the caller has done all needed checks. The function will
* automatically recurse to an array type if the type has one.
@@ -2547,7 +2547,7 @@ AlterTypeNamespace(List *names, const char *newschema)
* Caller must have already checked privileges.
*
* The function automatically recurses to process the type's array type,
- * if any. isImplicitArray should be TRUE only when doing this internal
+ * if any. isImplicitArray should be TRUE only when doing this internal
* recursion (outside callers must never try to move an array type directly).
*
* If errorOnTableType is TRUE, the function errors out if the type is
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 55ce0dbade..c0d58d33ea 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.360 2007/10/24 20:55:36 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.361 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -592,19 +592,19 @@ vacuum_set_xid_limits(int freeze_min_age, bool sharedRel,
/*
* We can always ignore processes running lazy vacuum. This is because we
* use these values only for deciding which tuples we must keep in the
- * tables. Since lazy vacuum doesn't write its XID anywhere, it's
- * safe to ignore it. In theory it could be problematic to ignore lazy
- * vacuums on a full vacuum, but keep in mind that only one vacuum process
- * can be working on a particular table at any time, and that each vacuum
- * is always an independent transaction.
+ * tables. Since lazy vacuum doesn't write its XID anywhere, it's safe to
+ * ignore it. In theory it could be problematic to ignore lazy vacuums on
+ * a full vacuum, but keep in mind that only one vacuum process can be
+ * working on a particular table at any time, and that each vacuum is
+ * always an independent transaction.
*/
*oldestXmin = GetOldestXmin(sharedRel, true);
Assert(TransactionIdIsNormal(*oldestXmin));
/*
- * Determine the minimum freeze age to use: as specified by the caller,
- * or vacuum_freeze_min_age, but in any case not more than half
+ * Determine the minimum freeze age to use: as specified by the caller, or
+ * vacuum_freeze_min_age, but in any case not more than half
* autovacuum_freeze_max_age, so that autovacuums to prevent XID
* wraparound won't occur too frequently.
*/
@@ -623,8 +623,8 @@ vacuum_set_xid_limits(int freeze_min_age, bool sharedRel,
/*
* If oldestXmin is very far back (in practice, more than
- * autovacuum_freeze_max_age / 2 XIDs old), complain and force a
- * minimum freeze age of zero.
+ * autovacuum_freeze_max_age / 2 XIDs old), complain and force a minimum
+ * freeze age of zero.
*/
safeLimit = ReadNewTransactionId() - autovacuum_freeze_max_age;
if (!TransactionIdIsNormal(safeLimit))
@@ -758,7 +758,7 @@ vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples,
* advance pg_database.datfrozenxid, also try to truncate pg_clog.
*
* We violate transaction semantics here by overwriting the database's
- * existing pg_database tuple with the new value. This is reasonably
+ * existing pg_database tuple with the new value. This is reasonably
* safe since the new value is correct whether or not this transaction
* commits. As with vac_update_relstats, this avoids leaving dead tuples
* behind after a VACUUM.
@@ -777,7 +777,7 @@ vac_update_datfrozenxid(void)
bool dirty = false;
/*
- * Initialize the "min" calculation with RecentGlobalXmin. Any
+ * Initialize the "min" calculation with RecentGlobalXmin. Any
* not-yet-committed pg_class entries for new tables must have
* relfrozenxid at least this high, because any other open xact must have
* RecentXmin >= its PGPROC.xmin >= our RecentGlobalXmin; see
@@ -848,8 +848,7 @@ vac_update_datfrozenxid(void)
/*
* If we were able to advance datfrozenxid, mark the flat-file copy of
- * pg_database for update at commit, and see if we can truncate
- * pg_clog.
+ * pg_database for update at commit, and see if we can truncate pg_clog.
*/
if (dirty)
{
@@ -893,10 +892,10 @@ vac_truncate_clog(TransactionId frozenXID)
* inserted by CREATE DATABASE. Any such entry will have a copy of some
* existing DB's datfrozenxid, and that source DB cannot be ours because
* of the interlock against copying a DB containing an active backend.
- * Hence the new entry will not reduce the minimum. Also, if two
- * VACUUMs concurrently modify the datfrozenxid's of different databases,
- * the worst possible outcome is that pg_clog is not truncated as
- * aggressively as it could be.
+ * Hence the new entry will not reduce the minimum. Also, if two VACUUMs
+ * concurrently modify the datfrozenxid's of different databases, the
+ * worst possible outcome is that pg_clog is not truncated as aggressively
+ * as it could be.
*/
relation = heap_open(DatabaseRelationId, AccessShareLock);
@@ -989,13 +988,13 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind)
*
* We can furthermore set the PROC_IN_VACUUM flag, which lets other
* concurrent VACUUMs know that they can ignore this one while
- * determining their OldestXmin. (The reason we don't set it
- * during a full VACUUM is exactly that we may have to run user-
- * defined functions for functional indexes, and we want to make sure
- * that if they use the snapshot set above, any tuples it requires
- * can't get removed from other tables. An index function that
- * depends on the contents of other tables is arguably broken, but we
- * won't break it here by violating transaction semantics.)
+ * determining their OldestXmin. (The reason we don't set it during a
+ * full VACUUM is exactly that we may have to run user- defined
+ * functions for functional indexes, and we want to make sure that if
+ * they use the snapshot set above, any tuples it requires can't get
+ * removed from other tables. An index function that depends on the
+ * contents of other tables is arguably broken, but we won't break it
+ * here by violating transaction semantics.)
*
* Note: this flag remains set until CommitTransaction or
* AbortTransaction. We don't want to clear it until we reset
@@ -1168,8 +1167,8 @@ full_vacuum_rel(Relation onerel, VacuumStmt *vacstmt)
/*
* Flush any previous async-commit transactions. This does not guarantee
- * that we will be able to set hint bits for tuples they inserted, but
- * it improves the probability, especially in simple sequential-commands
+ * that we will be able to set hint bits for tuples they inserted, but it
+ * improves the probability, especially in simple sequential-commands
* cases. See scan_heap() and repair_frag() for more about this.
*/
XLogAsyncCommitFlush();
@@ -1319,10 +1318,11 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
* dirty. To ensure that invalid data doesn't get written to disk, we
* must take exclusive buffer lock wherever we potentially modify
* pages. In fact, we insist on cleanup lock so that we can safely
- * call heap_page_prune(). (This might be overkill, since the bgwriter
- * pays no attention to individual tuples, but on the other hand it's
- * unlikely that the bgwriter has this particular page pinned at this
- * instant. So violating the coding rule would buy us little anyway.)
+ * call heap_page_prune(). (This might be overkill, since the
+ * bgwriter pays no attention to individual tuples, but on the other
+ * hand it's unlikely that the bgwriter has this particular page
+ * pinned at this instant. So violating the coding rule would buy us
+ * little anyway.)
*/
LockBufferForCleanup(buf);
@@ -1365,7 +1365,7 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
continue;
}
- /*
+ /*
* Prune all HOT-update chains in this page.
*
* We use the redirect_move option so that redirecting line pointers
@@ -1377,8 +1377,8 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
true, false);
/*
- * Now scan the page to collect vacuumable items and check for
- * tuples requiring freezing.
+ * Now scan the page to collect vacuumable items and check for tuples
+ * requiring freezing.
*/
nfrozen = 0;
notup = true;
@@ -1393,9 +1393,9 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
/*
* Collect un-used items too - it's possible to have indexes
- * pointing here after crash. (That's an ancient comment and
- * is likely obsolete with WAL, but we might as well continue
- * to check for such problems.)
+ * pointing here after crash. (That's an ancient comment and is
+ * likely obsolete with WAL, but we might as well continue to
+ * check for such problems.)
*/
if (!ItemIdIsUsed(itemid))
{
@@ -1406,9 +1406,9 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
/*
* DEAD item pointers are to be vacuumed normally; but we don't
- * count them in tups_vacuumed, else we'd be double-counting
- * (at least in the common case where heap_page_prune() just
- * freed up a non-HOT tuple).
+ * count them in tups_vacuumed, else we'd be double-counting (at
+ * least in the common case where heap_page_prune() just freed up
+ * a non-HOT tuple).
*/
if (ItemIdIsDead(itemid))
{
@@ -1433,12 +1433,13 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
!OidIsValid(HeapTupleGetOid(&tuple)))
elog(WARNING, "relation \"%s\" TID %u/%u: OID is invalid",
relname, blkno, offnum);
+
/*
* The shrinkage phase of VACUUM FULL requires that all
* live tuples have XMIN_COMMITTED set --- see comments in
* repair_frag()'s walk-along-page loop. Use of async
* commit may prevent HeapTupleSatisfiesVacuum from
- * setting the bit for a recently committed tuple. Rather
+ * setting the bit for a recently committed tuple. Rather
* than trying to handle this corner case, we just give up
* and don't shrink.
*/
@@ -1448,30 +1449,31 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
ereport(LOG,
(errmsg("relation \"%s\" TID %u/%u: XMIN_COMMITTED not set for transaction %u --- cannot shrink relation",
relname, blkno, offnum,
- HeapTupleHeaderGetXmin(tuple.t_data))));
+ HeapTupleHeaderGetXmin(tuple.t_data))));
do_shrinking = false;
}
break;
case HEAPTUPLE_DEAD:
+
/*
* Ordinarily, DEAD tuples would have been removed by
* heap_page_prune(), but it's possible that the tuple
* state changed since heap_page_prune() looked. In
* particular an INSERT_IN_PROGRESS tuple could have
* changed to DEAD if the inserter aborted. So this
- * cannot be considered an error condition, though it
- * does suggest that someone released a lock early.
+ * cannot be considered an error condition, though it does
+ * suggest that someone released a lock early.
*
* If the tuple is HOT-updated then it must only be
* removed by a prune operation; so we keep it as if it
* were RECENTLY_DEAD, and abandon shrinking. (XXX is it
- * worth trying to make the shrinking code smart enough
- * to handle this? It's an unusual corner case.)
+ * worth trying to make the shrinking code smart enough to
+ * handle this? It's an unusual corner case.)
*
* DEAD heap-only tuples can safely be removed if they
* aren't themselves HOT-updated, although this is a bit
- * inefficient since we'll uselessly try to remove
- * index entries for them.
+ * inefficient since we'll uselessly try to remove index
+ * entries for them.
*/
if (HeapTupleIsHotUpdated(&tuple))
{
@@ -1484,7 +1486,8 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
}
else
{
- tupgone = true; /* we can delete the tuple */
+ tupgone = true; /* we can delete the tuple */
+
/*
* We need not require XMIN_COMMITTED or
* XMAX_COMMITTED to be set, since we will remove the
@@ -1502,8 +1505,8 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
nkeep += 1;
/*
- * As with the LIVE case, shrinkage requires XMIN_COMMITTED
- * to be set.
+ * As with the LIVE case, shrinkage requires
+ * XMIN_COMMITTED to be set.
*/
if (do_shrinking &&
!(tuple.t_data->t_infomask & HEAP_XMIN_COMMITTED))
@@ -1511,7 +1514,7 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
ereport(LOG,
(errmsg("relation \"%s\" TID %u/%u: XMIN_COMMITTED not set for transaction %u --- cannot shrink relation",
relname, blkno, offnum,
- HeapTupleHeaderGetXmin(tuple.t_data))));
+ HeapTupleHeaderGetXmin(tuple.t_data))));
do_shrinking = false;
}
@@ -1542,15 +1545,15 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
* This should not happen, since we hold exclusive lock on
* the relation; shouldn't we raise an error? (Actually,
* it can happen in system catalogs, since we tend to
- * release write lock before commit there.) As above,
- * we can't apply repair_frag() if the tuple state is
+ * release write lock before commit there.) As above, we
+ * can't apply repair_frag() if the tuple state is
* uncertain.
*/
if (do_shrinking)
ereport(LOG,
(errmsg("relation \"%s\" TID %u/%u: InsertTransactionInProgress %u --- cannot shrink relation",
relname, blkno, offnum,
- HeapTupleHeaderGetXmin(tuple.t_data))));
+ HeapTupleHeaderGetXmin(tuple.t_data))));
do_shrinking = false;
break;
case HEAPTUPLE_DELETE_IN_PROGRESS:
@@ -1559,15 +1562,15 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
* This should not happen, since we hold exclusive lock on
* the relation; shouldn't we raise an error? (Actually,
* it can happen in system catalogs, since we tend to
- * release write lock before commit there.) As above,
- * we can't apply repair_frag() if the tuple state is
+ * release write lock before commit there.) As above, we
+ * can't apply repair_frag() if the tuple state is
* uncertain.
*/
if (do_shrinking)
ereport(LOG,
(errmsg("relation \"%s\" TID %u/%u: DeleteTransactionInProgress %u --- cannot shrink relation",
relname, blkno, offnum,
- HeapTupleHeaderGetXmax(tuple.t_data))));
+ HeapTupleHeaderGetXmax(tuple.t_data))));
do_shrinking = false;
break;
default:
@@ -1615,8 +1618,8 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
max_tlen = tuple.t_len;
/*
- * Each non-removable tuple must be checked to see if it
- * needs freezing.
+ * Each non-removable tuple must be checked to see if it needs
+ * freezing.
*/
if (heap_freeze_tuple(tuple.t_data, FreezeLimit,
InvalidBuffer))
@@ -1996,11 +1999,12 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
if (i >= vacpage->offsets_free) /* not found */
{
vacpage->offsets[vacpage->offsets_free++] = offnum;
+
/*
* If this is not a heap-only tuple, there must be an
* index entry for this item which will be removed in
- * the index cleanup. Decrement the keep_indexed_tuples
- * count to remember this.
+ * the index cleanup. Decrement the
+ * keep_indexed_tuples count to remember this.
*/
if (!HeapTupleHeaderIsHeapOnly(tuple.t_data))
keep_indexed_tuples--;
@@ -2010,11 +2014,12 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
else
{
vacpage->offsets[vacpage->offsets_free++] = offnum;
+
/*
* If this is not a heap-only tuple, there must be an
- * index entry for this item which will be removed in
- * the index cleanup. Decrement the keep_indexed_tuples
- * count to remember this.
+ * index entry for this item which will be removed in the
+ * index cleanup. Decrement the keep_indexed_tuples count
+ * to remember this.
*/
if (!HeapTupleHeaderIsHeapOnly(tuple.t_data))
keep_indexed_tuples--;
@@ -2051,10 +2056,10 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
* Also, because we distinguish DEAD and RECENTLY_DEAD tuples
* using OldestXmin, which is a rather coarse test, it is quite
* possible to have an update chain in which a tuple we think is
- * RECENTLY_DEAD links forward to one that is definitely DEAD.
- * In such a case the RECENTLY_DEAD tuple must actually be dead,
- * but it seems too complicated to try to make VACUUM remove it.
- * We treat each contiguous set of RECENTLY_DEAD tuples as a
+ * RECENTLY_DEAD links forward to one that is definitely DEAD. In
+ * such a case the RECENTLY_DEAD tuple must actually be dead, but
+ * it seems too complicated to try to make VACUUM remove it. We
+ * treat each contiguous set of RECENTLY_DEAD tuples as a
* separately movable chain, ignoring any intervening DEAD ones.
*/
if (((tuple.t_data->t_infomask & HEAP_UPDATED) &&
@@ -2096,11 +2101,11 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
* If this tuple is in the begin/middle of the chain then we
* have to move to the end of chain. As with any t_ctid
* chase, we have to verify that each new tuple is really the
- * descendant of the tuple we came from; however, here we
- * need even more than the normal amount of paranoia.
- * If t_ctid links forward to a tuple determined to be DEAD,
- * then depending on where that tuple is, it might already
- * have been removed, and perhaps even replaced by a MOVED_IN
+ * descendant of the tuple we came from; however, here we need
+ * even more than the normal amount of paranoia. If t_ctid
+ * links forward to a tuple determined to be DEAD, then
+ * depending on where that tuple is, it might already have
+ * been removed, and perhaps even replaced by a MOVED_IN
* tuple. We don't want to include any DEAD tuples in the
* chain, so we have to recheck HeapTupleSatisfiesVacuum.
*/
@@ -2116,7 +2121,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
OffsetNumber nextOffnum;
ItemId nextItemid;
HeapTupleHeader nextTdata;
- HTSV_Result nextTstatus;
+ HTSV_Result nextTstatus;
nextTid = tp.t_data->t_ctid;
priorXmax = HeapTupleHeaderGetXmax(tp.t_data);
@@ -2148,10 +2153,11 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
ReleaseBuffer(nextBuf);
break;
}
+
/*
- * Must check for DEAD or MOVED_IN tuple, too. This
- * could potentially update hint bits, so we'd better
- * hold the buffer content lock.
+ * Must check for DEAD or MOVED_IN tuple, too. This could
+ * potentially update hint bits, so we'd better hold the
+ * buffer content lock.
*/
LockBuffer(nextBuf, BUFFER_LOCK_SHARE);
nextTstatus = HeapTupleSatisfiesVacuum(nextTdata,
@@ -2266,7 +2272,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
}
tp.t_self = vtlp->this_tid;
Pbuf = ReadBufferWithStrategy(onerel,
- ItemPointerGetBlockNumber(&(tp.t_self)),
+ ItemPointerGetBlockNumber(&(tp.t_self)),
vac_strategy);
Ppage = BufferGetPage(Pbuf);
Pitemid = PageGetItemId(Ppage,
@@ -2350,7 +2356,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
/* Get page to move from */
tuple.t_self = vtmove[ti].tid;
Cbuf = ReadBufferWithStrategy(onerel,
- ItemPointerGetBlockNumber(&(tuple.t_self)),
+ ItemPointerGetBlockNumber(&(tuple.t_self)),
vac_strategy);
/* Get page to move to */
@@ -2375,10 +2381,10 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
&ec, &Ctid, vtmove[ti].cleanVpd);
/*
- * If the tuple we are moving is a heap-only tuple,
- * this move will generate an additional index entry,
- * so increment the rel_indexed_tuples count.
- */
+ * If the tuple we are moving is a heap-only tuple, this
+ * move will generate an additional index entry, so
+ * increment the rel_indexed_tuples count.
+ */
if (HeapTupleHeaderIsHeapOnly(tuple.t_data))
vacrelstats->rel_indexed_tuples++;
@@ -2398,22 +2404,22 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
/*
* When we move tuple chains, we may need to move
* tuples from a block that we haven't yet scanned in
- * the outer walk-along-the-relation loop. Note that we
- * can't be moving a tuple from a block that we have
- * already scanned because if such a tuple exists, then
- * we must have moved the chain along with that tuple
- * when we scanned that block. IOW the test of
- * (Cbuf != buf) guarantees that the tuple we are
- * looking at right now is in a block which is yet to
- * be scanned.
+ * the outer walk-along-the-relation loop. Note that
+ * we can't be moving a tuple from a block that we
+ * have already scanned because if such a tuple
+ * exists, then we must have moved the chain along
+ * with that tuple when we scanned that block. IOW the
+ * test of (Cbuf != buf) guarantees that the tuple we
+ * are looking at right now is in a block which is yet
+ * to be scanned.
*
* We maintain two counters to correctly count the
* moved-off tuples from blocks that are not yet
* scanned (keep_tuples) and how many of them have
* index pointers (keep_indexed_tuples). The main
- * reason to track the latter is to help verify
- * that indexes have the expected number of entries
- * when all the dust settles.
+ * reason to track the latter is to help verify that
+ * indexes have the expected number of entries when
+ * all the dust settles.
*/
if (!HeapTupleHeaderIsHeapOnly(tuple.t_data))
keep_indexed_tuples++;
@@ -2467,9 +2473,9 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
dst_buffer, dst_page, dst_vacpage, &ec);
/*
- * If the tuple we are moving is a heap-only tuple,
- * this move will generate an additional index entry,
- * so increment the rel_indexed_tuples count.
+ * If the tuple we are moving is a heap-only tuple, this move will
+ * generate an additional index entry, so increment the
+ * rel_indexed_tuples count.
*/
if (HeapTupleHeaderIsHeapOnly(tuple.t_data))
vacrelstats->rel_indexed_tuples++;
@@ -2538,11 +2544,12 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
{
vacpage->offsets[vacpage->offsets_free++] = off;
Assert(keep_tuples > 0);
+
/*
* If this is not a heap-only tuple, there must be an
* index entry for this item which will be removed in
- * the index cleanup. Decrement the keep_indexed_tuples
- * count to remember this.
+ * the index cleanup. Decrement the
+ * keep_indexed_tuples count to remember this.
*/
if (!HeapTupleHeaderIsHeapOnly(htup))
keep_indexed_tuples--;
@@ -2594,14 +2601,14 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
* exclusive access to the relation. However, that would require a
* lot of extra code to close and re-open the relation, indexes, etc.
* For now, a quick hack: record status of current transaction as
- * committed, and continue. We force the commit to be synchronous
- * so that it's down to disk before we truncate. (Note: tqual.c
- * knows that VACUUM FULL always uses sync commit, too.) The
- * transaction continues to be shown as running in the ProcArray.
+ * committed, and continue. We force the commit to be synchronous so
+ * that it's down to disk before we truncate. (Note: tqual.c knows
+ * that VACUUM FULL always uses sync commit, too.) The transaction
+ * continues to be shown as running in the ProcArray.
*
- * XXX This desperately needs to be revisited. Any failure after
- * this point will result in a PANIC "cannot abort transaction nnn,
- * it was already committed"!
+ * XXX This desperately needs to be revisited. Any failure after this
+ * point will result in a PANIC "cannot abort transaction nnn, it was
+ * already committed"!
*/
ForceSyncCommit();
(void) RecordTransactionCommit();
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index d3aa277ce8..3f7032fbcd 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -13,7 +13,7 @@
* We are willing to use at most maintenance_work_mem memory space to keep
* track of dead tuples. We initially allocate an array of TIDs of that size,
* with an upper limit that depends on table size (this limit ensures we don't
- * allocate a huge area uselessly for vacuuming small tables). If the array
+ * allocate a huge area uselessly for vacuuming small tables). If the array
* threatens to overflow, we suspend the heap scan phase and perform a pass of
* index cleanup and page compaction, then resume the heap scan with an empty
* TID array.
@@ -38,7 +38,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.101 2007/09/26 20:16:28 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.102 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -157,7 +157,7 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
int nindexes;
BlockNumber possibly_freeable;
PGRUsage ru0;
- TimestampTz starttime = 0;
+ TimestampTz starttime = 0;
pg_rusage_init(&ru0);
@@ -212,10 +212,10 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
(errmsg("relation \"%s.%s\" contains more than \"max_fsm_pages\" pages with useful free space",
get_namespace_name(RelationGetNamespace(onerel)),
RelationGetRelationName(onerel)),
- errhint((vacrelstats->tot_free_pages > vacrelstats->rel_pages * 0.20 ?
- /* Only suggest VACUUM FULL if 20% free */
- "Consider using VACUUM FULL on this relation or increasing the configuration parameter \"max_fsm_pages\"." :
- "Consider increasing the configuration parameter \"max_fsm_pages\"."))));
+ errhint((vacrelstats->tot_free_pages > vacrelstats->rel_pages * 0.20 ?
+ /* Only suggest VACUUM FULL if 20% free */
+ "Consider using VACUUM FULL on this relation or increasing the configuration parameter \"max_fsm_pages\"." :
+ "Consider increasing the configuration parameter \"max_fsm_pages\"."))));
/* Update statistics in pg_class */
vac_update_relstats(RelationGetRelid(onerel),
@@ -243,8 +243,8 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
get_namespace_name(RelationGetNamespace(onerel)),
RelationGetRelationName(onerel),
vacrelstats->num_index_scans,
- vacrelstats->pages_removed, vacrelstats->rel_pages,
- vacrelstats->tuples_deleted, vacrelstats->rel_tuples,
+ vacrelstats->pages_removed, vacrelstats->rel_pages,
+ vacrelstats->tuples_deleted, vacrelstats->rel_tuples,
pg_rusage_show(&ru0))));
}
}
@@ -350,9 +350,9 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
* page that someone has just added to the relation and not yet
* been able to initialize (see RelationGetBufferForTuple). To
* protect against that, release the buffer lock, grab the
- * relation extension lock momentarily, and re-lock the buffer.
- * If the page is still uninitialized by then, it must be left
- * over from a crashed backend, and we can initialize it.
+ * relation extension lock momentarily, and re-lock the buffer. If
+ * the page is still uninitialized by then, it must be left over
+ * from a crashed backend, and we can initialize it.
*
* We don't really need the relation lock when this is a new or
* temp relation, but it's probably not worth the code space to
@@ -389,7 +389,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
continue;
}
- /*
+ /*
* Prune all HOT-update chains in this page.
*
* We count tuples removed by the pruning step as removed by VACUUM.
@@ -398,8 +398,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
false, false);
/*
- * Now scan the page to collect vacuumable items and check for
- * tuples requiring freezing.
+ * Now scan the page to collect vacuumable items and check for tuples
+ * requiring freezing.
*/
nfrozen = 0;
hastup = false;
@@ -421,19 +421,19 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
}
/* Redirect items mustn't be touched */
- if (ItemIdIsRedirected(itemid))
- {
+ if (ItemIdIsRedirected(itemid))
+ {
hastup = true; /* this page won't be truncatable */
- continue;
- }
+ continue;
+ }
- ItemPointerSet(&(tuple.t_self), blkno, offnum);
+ ItemPointerSet(&(tuple.t_self), blkno, offnum);
/*
* DEAD item pointers are to be vacuumed normally; but we don't
- * count them in tups_vacuumed, else we'd be double-counting
- * (at least in the common case where heap_page_prune() just
- * freed up a non-HOT tuple).
+ * count them in tups_vacuumed, else we'd be double-counting (at
+ * least in the common case where heap_page_prune() just freed up
+ * a non-HOT tuple).
*/
if (ItemIdIsDead(itemid))
{
@@ -451,6 +451,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
switch (HeapTupleSatisfiesVacuum(tuple.t_data, OldestXmin, buf))
{
case HEAPTUPLE_DEAD:
+
/*
* Ordinarily, DEAD tuples would have been removed by
* heap_page_prune(), but it's possible that the tuple
@@ -460,17 +461,17 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
* cannot be considered an error condition.
*
* If the tuple is HOT-updated then it must only be
- * removed by a prune operation; so we keep it just as
- * if it were RECENTLY_DEAD. Also, if it's a heap-only
- * tuple, we choose to keep it, because it'll be a
- * lot cheaper to get rid of it in the next pruning pass
- * than to treat it like an indexed tuple.
+ * removed by a prune operation; so we keep it just as if
+ * it were RECENTLY_DEAD. Also, if it's a heap-only
+ * tuple, we choose to keep it, because it'll be a lot
+ * cheaper to get rid of it in the next pruning pass than
+ * to treat it like an indexed tuple.
*/
if (HeapTupleIsHotUpdated(&tuple) ||
HeapTupleIsHeapOnly(&tuple))
nkeep += 1;
else
- tupgone = true; /* we can delete the tuple */
+ tupgone = true; /* we can delete the tuple */
break;
case HEAPTUPLE_LIVE:
/* Tuple is good --- but let's do some validity checks */
@@ -509,8 +510,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
hastup = true;
/*
- * Each non-removable tuple must be checked to see if it
- * needs freezing. Note we already have exclusive buffer lock.
+ * Each non-removable tuple must be checked to see if it needs
+ * freezing. Note we already have exclusive buffer lock.
*/
if (heap_freeze_tuple(tuple.t_data, FreezeLimit,
InvalidBuffer))
@@ -864,11 +865,11 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats)
RelationTruncate(onerel, new_rel_pages);
/*
- * Note: once we have truncated, we *must* keep the exclusive lock
- * until commit. The sinval message that will be sent at commit
- * (as a result of vac_update_relstats()) must be received by other
- * backends, to cause them to reset their rd_targblock values, before
- * they can safely access the table again.
+ * Note: once we have truncated, we *must* keep the exclusive lock until
+ * commit. The sinval message that will be sent at commit (as a result of
+ * vac_update_relstats()) must be received by other backends, to cause
+ * them to reset their rd_targblock values, before they can safely access
+ * the table again.
*/
/*
@@ -933,9 +934,8 @@ count_nondeletable_pages(Relation onerel, LVRelStats *vacrelstats)
/*
* We don't insert a vacuum delay point here, because we have an
- * exclusive lock on the table which we want to hold for as short
- * a time as possible. We still need to check for interrupts
- * however.
+ * exclusive lock on the table which we want to hold for as short a
+ * time as possible. We still need to check for interrupts however.
*/
CHECK_FOR_INTERRUPTS();
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 8a04a975ca..e4ea35ab53 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.121 2007/08/04 01:26:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.122 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -463,16 +463,16 @@ assign_log_timezone(const char *value, bool doit, GucSource source)
{
/*
* UNKNOWN is the value shown as the "default" for log_timezone in
- * guc.c. We interpret it as being a complete no-op; we don't
- * change the timezone setting. Note that if there is a known
- * timezone setting, we will return that name rather than UNKNOWN
- * as the canonical spelling.
+ * guc.c. We interpret it as being a complete no-op; we don't change
+ * the timezone setting. Note that if there is a known timezone
+ * setting, we will return that name rather than UNKNOWN as the
+ * canonical spelling.
*
- * During GUC initialization, since the timezone library isn't set
- * up yet, pg_get_timezone_name will return NULL and we will leave
- * the setting as UNKNOWN. If this isn't overridden from the
- * config file then pg_timezone_initialize() will eventually
- * select a default value from the environment.
+ * During GUC initialization, since the timezone library isn't set up
+ * yet, pg_get_timezone_name will return NULL and we will leave the
+ * setting as UNKNOWN. If this isn't overridden from the config file
+ * then pg_timezone_initialize() will eventually select a default
+ * value from the environment.
*/
if (doit)
{
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index a6ef94dcef..810d70b37f 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.102 2007/08/27 03:36:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.103 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -273,6 +273,7 @@ DefineViewRules(Oid viewOid, Query *viewParse, bool replace)
true,
replace,
list_make1(viewParse));
+
/*
* Someday: automatic ON INSERT, etc
*/
@@ -356,8 +357,8 @@ DefineView(ViewStmt *stmt, const char *queryString)
RangeVar *view;
/*
- * Run parse analysis to convert the raw parse tree to a Query. Note
- * this also acquires sufficient locks on the source table(s).
+ * Run parse analysis to convert the raw parse tree to a Query. Note this
+ * also acquires sufficient locks on the source table(s).
*
* Since parse analysis scribbles on its input, copy the raw parse tree;
* this ensures we don't corrupt a prepared statement, for example.
@@ -404,14 +405,14 @@ DefineView(ViewStmt *stmt, const char *queryString)
/*
* If the user didn't explicitly ask for a temporary view, check whether
- * we need one implicitly. We allow TEMP to be inserted automatically
- * as long as the CREATE command is consistent with that --- no explicit
+ * we need one implicitly. We allow TEMP to be inserted automatically as
+ * long as the CREATE command is consistent with that --- no explicit
* schema name.
*/
view = stmt->view;
if (!view->istemp && isViewOnTempTable(viewParse))
{
- view = copyObject(view); /* don't corrupt original command */
+ view = copyObject(view); /* don't corrupt original command */
view->istemp = true;
ereport(NOTICE,
(errmsg("view \"%s\" will be a temporary view",
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 3b48a5cf18..9c96d67efd 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.92 2007/02/19 02:23:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.93 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -337,12 +337,13 @@ ExecSupportsMarkRestore(NodeTag plantype)
return true;
case T_Result:
+
/*
- * T_Result only supports mark/restore if it has a child plan
- * that does, so we do not have enough information to give a
- * really correct answer. However, for current uses it's
- * enough to always say "false", because this routine is not
- * asked about gating Result plans, only base-case Results.
+ * T_Result only supports mark/restore if it has a child plan that
+ * does, so we do not have enough information to give a really
+ * correct answer. However, for current uses it's enough to
+ * always say "false", because this routine is not asked about
+ * gating Result plans, only base-case Results.
*/
return false;
diff --git a/src/backend/executor/execCurrent.c b/src/backend/executor/execCurrent.c
index 72bccd4438..9f63d99d65 100644
--- a/src/backend/executor/execCurrent.c
+++ b/src/backend/executor/execCurrent.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/executor/execCurrent.c,v 1.2 2007/06/11 22:22:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execCurrent.c,v 1.3 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,7 +36,7 @@ static ScanState *search_plan_tree(PlanState *node, Oid table_oid);
* valid updatable scan of the specified table.
*/
bool
-execCurrentOf(CurrentOfExpr *cexpr,
+execCurrentOf(CurrentOfExpr * cexpr,
ExprContext *econtext,
Oid table_oid,
ItemPointer current_tid)
@@ -44,10 +44,10 @@ execCurrentOf(CurrentOfExpr *cexpr,
char *cursor_name;
char *table_name;
Portal portal;
- QueryDesc *queryDesc;
+ QueryDesc *queryDesc;
ScanState *scanstate;
- bool lisnull;
- Oid tuple_tableoid;
+ bool lisnull;
+ Oid tuple_tableoid;
ItemPointer tuple_tid;
/* Get the cursor name --- may have to look up a parameter reference */
@@ -85,24 +85,23 @@ execCurrentOf(CurrentOfExpr *cexpr,
cursor_name)));
/*
- * Dig through the cursor's plan to find the scan node. Fail if it's
- * not there or buried underneath aggregation.
+ * Dig through the cursor's plan to find the scan node. Fail if it's not
+ * there or buried underneath aggregation.
*/
scanstate = search_plan_tree(ExecGetActivePlanTree(queryDesc),
table_oid);
if (!scanstate)
ereport(ERROR,
(errcode(ERRCODE_INVALID_CURSOR_STATE),
- errmsg("cursor \"%s\" is not a simply updatable scan of table \"%s\"",
- cursor_name, table_name)));
+ errmsg("cursor \"%s\" is not a simply updatable scan of table \"%s\"",
+ cursor_name, table_name)));
/*
- * The cursor must have a current result row: per the SQL spec, it's
- * an error if not. We test this at the top level, rather than at
- * the scan node level, because in inheritance cases any one table
- * scan could easily not be on a row. We want to return false, not
- * raise error, if the passed-in table OID is for one of the inactive
- * scans.
+ * The cursor must have a current result row: per the SQL spec, it's an
+ * error if not. We test this at the top level, rather than at the scan
+ * node level, because in inheritance cases any one table scan could
+ * easily not be on a row. We want to return false, not raise error, if
+ * the passed-in table OID is for one of the inactive scans.
*/
if (portal->atStart || portal->atEnd)
ereport(ERROR,
@@ -182,37 +181,37 @@ search_plan_tree(PlanState *node, Oid table_oid)
case T_IndexScanState:
case T_BitmapHeapScanState:
case T_TidScanState:
- {
- ScanState *sstate = (ScanState *) node;
+ {
+ ScanState *sstate = (ScanState *) node;
- if (RelationGetRelid(sstate->ss_currentRelation) == table_oid)
- return sstate;
- break;
- }
+ if (RelationGetRelid(sstate->ss_currentRelation) == table_oid)
+ return sstate;
+ break;
+ }
/*
* For Append, we must look through the members; watch out for
* multiple matches (possible if it was from UNION ALL)
*/
case T_AppendState:
- {
- AppendState *astate = (AppendState *) node;
- ScanState *result = NULL;
- int i;
-
- for (i = 0; i < astate->as_nplans; i++)
{
- ScanState *elem = search_plan_tree(astate->appendplans[i],
- table_oid);
-
- if (!elem)
- continue;
- if (result)
- return NULL; /* multiple matches */
- result = elem;
+ AppendState *astate = (AppendState *) node;
+ ScanState *result = NULL;
+ int i;
+
+ for (i = 0; i < astate->as_nplans; i++)
+ {
+ ScanState *elem = search_plan_tree(astate->appendplans[i],
+ table_oid);
+
+ if (!elem)
+ continue;
+ if (result)
+ return NULL; /* multiple matches */
+ result = elem;
+ }
+ return result;
}
- return result;
- }
/*
* Result and Limit can be descended through (these are safe
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 485f6ddc1e..90136981fb 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.298 2007/09/20 17:56:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.299 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -95,7 +95,7 @@ static TupleTableSlot *EvalPlanQualNext(EState *estate);
static void EndEvalPlanQual(EState *estate);
static void ExecCheckRTPerms(List *rangeTable);
static void ExecCheckRTEPerms(RangeTblEntry *rte);
-static void ExecCheckXactReadOnly(PlannedStmt *plannedstmt);
+static void ExecCheckXactReadOnly(PlannedStmt * plannedstmt);
static void EvalPlanQualStart(evalPlanQual *epq, EState *estate,
evalPlanQual *priorepq);
static void EvalPlanQualStop(evalPlanQual *epq);
@@ -411,7 +411,7 @@ ExecCheckRTEPerms(RangeTblEntry *rte)
* Check that the query does not imply any writes to non-temp tables.
*/
static void
-ExecCheckXactReadOnly(PlannedStmt *plannedstmt)
+ExecCheckXactReadOnly(PlannedStmt * plannedstmt)
{
ListCell *l;
@@ -536,8 +536,8 @@ InitPlan(QueryDesc *queryDesc, int eflags)
/*
* Have to lock relations selected FOR UPDATE/FOR SHARE before we
- * initialize the plan tree, else we'd be doing a lock upgrade.
- * While we are at it, build the ExecRowMark list.
+ * initialize the plan tree, else we'd be doing a lock upgrade. While we
+ * are at it, build the ExecRowMark list.
*/
estate->es_rowMarks = NIL;
foreach(l, plannedstmt->rowMarks)
@@ -573,7 +573,7 @@ InitPlan(QueryDesc *queryDesc, int eflags)
/* Add slots for subplans and initplans */
foreach(l, plannedstmt->subplans)
{
- Plan *subplan = (Plan *) lfirst(l);
+ Plan *subplan = (Plan *) lfirst(l);
nSlots += ExecCountSlotsNode(subplan);
}
@@ -602,23 +602,22 @@ InitPlan(QueryDesc *queryDesc, int eflags)
estate->es_useEvalPlan = false;
/*
- * Initialize private state information for each SubPlan. We must do
- * this before running ExecInitNode on the main query tree, since
+ * Initialize private state information for each SubPlan. We must do this
+ * before running ExecInitNode on the main query tree, since
* ExecInitSubPlan expects to be able to find these entries.
*/
Assert(estate->es_subplanstates == NIL);
i = 1; /* subplan indices count from 1 */
foreach(l, plannedstmt->subplans)
{
- Plan *subplan = (Plan *) lfirst(l);
- PlanState *subplanstate;
- int sp_eflags;
+ Plan *subplan = (Plan *) lfirst(l);
+ PlanState *subplanstate;
+ int sp_eflags;
/*
- * A subplan will never need to do BACKWARD scan nor MARK/RESTORE.
- * If it is a parameterless subplan (not initplan), we suggest that it
- * be prepared to handle REWIND efficiently; otherwise there is no
- * need.
+ * A subplan will never need to do BACKWARD scan nor MARK/RESTORE. If
+ * it is a parameterless subplan (not initplan), we suggest that it be
+ * prepared to handle REWIND efficiently; otherwise there is no need.
*/
sp_eflags = eflags & EXEC_FLAG_EXPLAIN_ONLY;
if (bms_is_member(i, plannedstmt->rewindPlanIDs))
@@ -714,11 +713,12 @@ InitPlan(QueryDesc *queryDesc, int eflags)
j = ExecInitJunkFilter(subplan->plan->targetlist,
resultRelInfo->ri_RelationDesc->rd_att->tdhasoid,
ExecAllocTableSlot(estate->es_tupleTable));
+
/*
- * Since it must be UPDATE/DELETE, there had better be
- * a "ctid" junk attribute in the tlist ... but ctid could
- * be at a different resno for each result relation.
- * We look up the ctid resnos now and save them in the
+ * Since it must be UPDATE/DELETE, there had better be a
+ * "ctid" junk attribute in the tlist ... but ctid could
+ * be at a different resno for each result relation. We
+ * look up the ctid resnos now and save them in the
* junkfilters.
*/
j->jf_junkAttNo = ExecFindJunkAttribute(j, "ctid");
@@ -813,7 +813,7 @@ InitPlan(QueryDesc *queryDesc, int eflags)
rliststate = (List *) ExecInitExpr((Expr *) rlist, planstate);
resultRelInfo->ri_projectReturning =
ExecBuildProjectionInfo(rliststate, econtext, slot,
- resultRelInfo->ri_RelationDesc->rd_att);
+ resultRelInfo->ri_RelationDesc->rd_att);
resultRelInfo++;
}
}
@@ -843,8 +843,8 @@ initResultRelInfo(ResultRelInfo *resultRelInfo,
bool doInstrument)
{
/*
- * Check valid relkind ... parser and/or planner should have noticed
- * this already, but let's make sure.
+ * Check valid relkind ... parser and/or planner should have noticed this
+ * already, but let's make sure.
*/
switch (resultRelationDesc->rd_rel->relkind)
{
@@ -928,7 +928,7 @@ initResultRelInfo(ResultRelInfo *resultRelInfo,
* if so it doesn't matter which one we pick.) However, it is sometimes
* necessary to fire triggers on other relations; this happens mainly when an
* RI update trigger queues additional triggers on other relations, which will
- * be processed in the context of the outer query. For efficiency's sake,
+ * be processed in the context of the outer query. For efficiency's sake,
* we want to have a ResultRelInfo for those triggers too; that can avoid
* repeated re-opening of the relation. (It also provides a way for EXPLAIN
* ANALYZE to report the runtimes of such triggers.) So we make additional
@@ -964,15 +964,15 @@ ExecGetTriggerResultRel(EState *estate, Oid relid)
/*
* Open the target relation's relcache entry. We assume that an
- * appropriate lock is still held by the backend from whenever the
- * trigger event got queued, so we need take no new lock here.
+ * appropriate lock is still held by the backend from whenever the trigger
+ * event got queued, so we need take no new lock here.
*/
rel = heap_open(relid, NoLock);
/*
- * Make the new entry in the right context. Currently, we don't need
- * any index information in ResultRelInfos used only for triggers,
- * so tell initResultRelInfo it's a DELETE.
+ * Make the new entry in the right context. Currently, we don't need any
+ * index information in ResultRelInfos used only for triggers, so tell
+ * initResultRelInfo it's a DELETE.
*/
oldcontext = MemoryContextSwitchTo(estate->es_query_cxt);
rInfo = makeNode(ResultRelInfo);
@@ -1080,7 +1080,7 @@ ExecEndPlan(PlanState *planstate, EState *estate)
*/
foreach(l, estate->es_subplanstates)
{
- PlanState *subplanstate = (PlanState *) lfirst(l);
+ PlanState *subplanstate = (PlanState *) lfirst(l);
ExecEndNode(subplanstate);
}
@@ -2398,15 +2398,15 @@ EvalPlanQualStart(evalPlanQual *epq, EState *estate, evalPlanQual *priorepq)
ExecCreateTupleTable(estate->es_tupleTable->size);
/*
- * Initialize private state information for each SubPlan. We must do
- * this before running ExecInitNode on the main query tree, since
+ * Initialize private state information for each SubPlan. We must do this
+ * before running ExecInitNode on the main query tree, since
* ExecInitSubPlan expects to be able to find these entries.
*/
Assert(epqstate->es_subplanstates == NIL);
foreach(l, estate->es_plannedstmt->subplans)
{
- Plan *subplan = (Plan *) lfirst(l);
- PlanState *subplanstate;
+ Plan *subplan = (Plan *) lfirst(l);
+ PlanState *subplanstate;
subplanstate = ExecInitNode(subplan, epqstate, 0);
@@ -2429,7 +2429,7 @@ EvalPlanQualStart(evalPlanQual *epq, EState *estate, evalPlanQual *priorepq)
*
* This is a cut-down version of ExecutorEnd(); basically we want to do most
* of the normal cleanup, but *not* close result relations (which we are
- * just sharing from the outer query). We do, however, have to close any
+ * just sharing from the outer query). We do, however, have to close any
* trigger target relations that got opened, since those are not shared.
*/
static void
@@ -2445,7 +2445,7 @@ EvalPlanQualStop(evalPlanQual *epq)
foreach(l, epqstate->es_subplanstates)
{
- PlanState *subplanstate = (PlanState *) lfirst(l);
+ PlanState *subplanstate = (PlanState *) lfirst(l);
ExecEndNode(subplanstate);
}
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 53ddc65819..8c917c8418 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.223 2007/10/24 18:37:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.224 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,11 +65,11 @@ static Datum ExecEvalAggref(AggrefExprState *aggref,
static Datum ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalScalarVar(ExprState *exprstate, ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+ bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalWholeRowVar(ExprState *exprstate, ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalWholeRowSlow(ExprState *exprstate, ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+ bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalConst(ExprState *exprstate, ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalParam(ExprState *exprstate, ExprContext *econtext,
@@ -121,8 +121,8 @@ static Datum ExecEvalCoalesce(CoalesceExprState *coalesceExpr,
static Datum ExecEvalMinMax(MinMaxExprState *minmaxExpr,
ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
-static Datum ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+static Datum ExecEvalXml(XmlExprState * xmlExpr, ExprContext *econtext,
+ bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalNullIf(FuncExprState *nullIfExpr,
ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
@@ -147,14 +147,14 @@ static Datum ExecEvalFieldStore(FieldStoreState *fstate,
static Datum ExecEvalRelabelType(GenericExprState *exprstate,
ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
-static Datum ExecEvalCoerceViaIO(CoerceViaIOState *iostate,
- ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
-static Datum ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate,
- ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+static Datum ExecEvalCoerceViaIO(CoerceViaIOState * iostate,
+ ExprContext *econtext,
+ bool *isNull, ExprDoneCond *isDone);
+static Datum ExecEvalArrayCoerceExpr(ArrayCoerceExprState * astate,
+ ExprContext *econtext,
+ bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalCurrentOfExpr(ExprState *exprstate, ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+ bool *isNull, ExprDoneCond *isDone);
/* ----------------------------------------------------------------
@@ -489,21 +489,21 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
* Scalar variable case.
*
* If it's a user attribute, check validity (bogus system attnums will
- * be caught inside slot_getattr). What we have to check for here
- * is the possibility of an attribute having been changed in type
- * since the plan tree was created. Ideally the plan would get
- * invalidated and not re-used, but until that day arrives, we need
- * defenses. Fortunately it's sufficient to check once on the first
- * time through.
+ * be caught inside slot_getattr). What we have to check for here is
+ * the possibility of an attribute having been changed in type since
+ * the plan tree was created. Ideally the plan would get invalidated
+ * and not re-used, but until that day arrives, we need defenses.
+ * Fortunately it's sufficient to check once on the first time
+ * through.
*
* Note: we allow a reference to a dropped attribute. slot_getattr
* will force a NULL result in such cases.
*
* Note: ideally we'd check typmod as well as typid, but that seems
- * impractical at the moment: in many cases the tupdesc will have
- * been generated by ExecTypeFromTL(), and that can't guarantee to
- * generate an accurate typmod in all cases, because some expression
- * node types don't carry typmod.
+ * impractical at the moment: in many cases the tupdesc will have been
+ * generated by ExecTypeFromTL(), and that can't guarantee to generate
+ * an accurate typmod in all cases, because some expression node types
+ * don't carry typmod.
*/
if (attnum > 0)
{
@@ -522,9 +522,9 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
if (variable->vartype != attr->atttypid)
ereport(ERROR,
(errmsg("attribute %d has wrong type", attnum),
- errdetail("Table has type %s, but query expects %s.",
- format_type_be(attr->atttypid),
- format_type_be(variable->vartype))));
+ errdetail("Table has type %s, but query expects %s.",
+ format_type_be(attr->atttypid),
+ format_type_be(variable->vartype))));
}
}
@@ -570,10 +570,10 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
* looking at the output of a subplan that includes resjunk
* columns. (XXX it would be nice to verify that the extra
* columns are all marked resjunk, but we haven't got access to
- * the subplan targetlist here...) Resjunk columns should always
+ * the subplan targetlist here...) Resjunk columns should always
* be at the end of a targetlist, so it's sufficient to ignore
- * them here; but we need to use ExecEvalWholeRowSlow to get
- * rid of them in the eventual output tuples.
+ * them here; but we need to use ExecEvalWholeRowSlow to get rid
+ * of them in the eventual output tuples.
*/
var_tupdesc = lookup_rowtype_tupdesc(variable->vartype, -1);
@@ -592,7 +592,7 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
Form_pg_attribute sattr = slot_tupdesc->attrs[i];
if (vattr->atttypid == sattr->atttypid)
- continue; /* no worries */
+ continue; /* no worries */
if (!vattr->attisdropped)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
@@ -737,12 +737,12 @@ ExecEvalWholeRowSlow(ExprState *exprstate, ExprContext *econtext,
*isNull = false;
/*
- * Currently, the only case handled here is stripping of trailing
- * resjunk fields, which we do in a slightly chintzy way by just
- * adjusting the tuple's natts header field. Possibly there will someday
- * be a need for more-extensive rearrangements, in which case it'd
- * be worth disassembling and reassembling the tuple (perhaps use a
- * JunkFilter for that?)
+ * Currently, the only case handled here is stripping of trailing resjunk
+ * fields, which we do in a slightly chintzy way by just adjusting the
+ * tuple's natts header field. Possibly there will someday be a need for
+ * more-extensive rearrangements, in which case it'd be worth
+ * disassembling and reassembling the tuple (perhaps use a JunkFilter for
+ * that?)
*/
Assert(variable->vartype != RECORDOID);
var_tupdesc = lookup_rowtype_tupdesc(variable->vartype, -1);
@@ -2577,9 +2577,9 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
/*
* If all items were null or empty arrays, return an empty array;
- * otherwise, if some were and some weren't, raise error. (Note:
- * we must special-case this somehow to avoid trying to generate
- * a 1-D array formed from empty arrays. It's not ideal...)
+ * otherwise, if some were and some weren't, raise error. (Note: we
+ * must special-case this somehow to avoid trying to generate a 1-D
+ * array formed from empty arrays. It's not ideal...)
*/
if (haveempty)
{
@@ -2844,17 +2844,17 @@ ExecEvalMinMax(MinMaxExprState *minmaxExpr, ExprContext *econtext,
* ----------------------------------------------------------------
*/
static Datum
-ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
+ExecEvalXml(XmlExprState * xmlExpr, ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone)
{
- XmlExpr *xexpr = (XmlExpr *) xmlExpr->xprstate.expr;
- text *result;
- StringInfoData buf;
- Datum value;
- bool isnull;
- ListCell *arg;
+ XmlExpr *xexpr = (XmlExpr *) xmlExpr->xprstate.expr;
+ text *result;
+ StringInfoData buf;
+ Datum value;
+ bool isnull;
+ ListCell *arg;
ListCell *narg;
- int i;
+ int i;
if (isDone)
*isDone = ExprSingleResult;
@@ -2864,11 +2864,11 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
{
case IS_XMLCONCAT:
{
- List *values = NIL;
+ List *values = NIL;
foreach(arg, xmlExpr->args)
{
- ExprState *e = (ExprState *) lfirst(arg);
+ ExprState *e = (ExprState *) lfirst(arg);
value = ExecEvalExpr(e, econtext, &isnull, NULL);
if (!isnull)
@@ -2888,8 +2888,8 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
i = 0;
forboth(arg, xmlExpr->named_args, narg, xexpr->arg_names)
{
- ExprState *e = (ExprState *) lfirst(arg);
- char *argname = strVal(lfirst(narg));
+ ExprState *e = (ExprState *) lfirst(arg);
+ char *argname = strVal(lfirst(narg));
value = ExecEvalExpr(e, econtext, &isnull, NULL);
if (!isnull)
@@ -2912,8 +2912,8 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
case IS_XMLPARSE:
{
- ExprState *e;
- text *data;
+ ExprState *e;
+ text *data;
bool preserve_whitespace;
/* arguments are known to be text, bool */
@@ -2941,8 +2941,8 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
case IS_XMLPI:
{
- ExprState *e;
- text *arg;
+ ExprState *e;
+ text *arg;
/* optional argument is known to be text */
Assert(list_length(xmlExpr->args) <= 1);
@@ -2968,9 +2968,9 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
case IS_XMLROOT:
{
- ExprState *e;
- xmltype *data;
- text *version;
+ ExprState *e;
+ xmltype *data;
+ text *version;
int standalone;
/* arguments are known to be xml, text, int */
@@ -3003,7 +3003,7 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
case IS_XMLSERIALIZE:
{
- ExprState *e;
+ ExprState *e;
/* argument type is known to be xml */
Assert(list_length(xmlExpr->args) == 1);
@@ -3021,7 +3021,7 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
case IS_DOCUMENT:
{
- ExprState *e;
+ ExprState *e;
/* optional argument is known to be xml */
Assert(list_length(xmlExpr->args) == 1);
@@ -3043,7 +3043,7 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
result = NULL;
else
{
- int len = buf.len + VARHDRSZ;
+ int len = buf.len + VARHDRSZ;
result = palloc(len);
SET_VARSIZE(result, len);
@@ -3431,9 +3431,9 @@ ExecEvalFieldSelect(FieldSelectState *fstate,
/* Check for dropped column, and force a NULL result if so */
if (fieldnum <= 0 ||
- fieldnum > tupDesc->natts) /* should never happen */
- elog(ERROR, "attribute number %d exceeds number of columns %d",
- fieldnum, tupDesc->natts);
+ fieldnum > tupDesc->natts) /* should never happen */
+ elog(ERROR, "attribute number %d exceeds number of columns %d",
+ fieldnum, tupDesc->natts);
attr = tupDesc->attrs[fieldnum - 1];
if (attr->attisdropped)
{
@@ -3587,7 +3587,7 @@ ExecEvalRelabelType(GenericExprState *exprstate,
* ----------------------------------------------------------------
*/
static Datum
-ExecEvalCoerceViaIO(CoerceViaIOState *iostate,
+ExecEvalCoerceViaIO(CoerceViaIOState * iostate,
ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone)
{
@@ -3621,7 +3621,7 @@ ExecEvalCoerceViaIO(CoerceViaIOState *iostate,
* ----------------------------------------------------------------
*/
static Datum
-ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate,
+ExecEvalArrayCoerceExpr(ArrayCoerceExprState * astate,
ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone)
{
@@ -3820,7 +3820,7 @@ ExecInitExpr(Expr *node, PlanState *parent)
if (naggs != aggstate->numaggs)
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
- errmsg("aggregate function calls cannot be nested")));
+ errmsg("aggregate function calls cannot be nested")));
}
else
{
@@ -3980,8 +3980,8 @@ ExecInitExpr(Expr *node, PlanState *parent)
{
CoerceViaIO *iocoerce = (CoerceViaIO *) node;
CoerceViaIOState *iostate = makeNode(CoerceViaIOState);
- Oid iofunc;
- bool typisvarlena;
+ Oid iofunc;
+ bool typisvarlena;
iostate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalCoerceViaIO;
iostate->arg = ExecInitExpr(iocoerce->arg, parent);
@@ -4268,11 +4268,11 @@ ExecInitExpr(Expr *node, PlanState *parent)
break;
case T_XmlExpr:
{
- XmlExpr *xexpr = (XmlExpr *) node;
- XmlExprState *xstate = makeNode(XmlExprState);
- List *outlist;
- ListCell *arg;
- int i;
+ XmlExpr *xexpr = (XmlExpr *) node;
+ XmlExprState *xstate = makeNode(XmlExprState);
+ List *outlist;
+ ListCell *arg;
+ int i;
xstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalXml;
xstate->named_outfuncs = (FmgrInfo *)
@@ -4281,8 +4281,8 @@ ExecInitExpr(Expr *node, PlanState *parent)
i = 0;
foreach(arg, xexpr->named_args)
{
- Expr *e = (Expr *) lfirst(arg);
- ExprState *estate;
+ Expr *e = (Expr *) lfirst(arg);
+ ExprState *estate;
Oid typOutFunc;
bool typIsVarlena;
@@ -4299,8 +4299,8 @@ ExecInitExpr(Expr *node, PlanState *parent)
outlist = NIL;
foreach(arg, xexpr->args)
{
- Expr *e = (Expr *) lfirst(arg);
- ExprState *estate;
+ Expr *e = (Expr *) lfirst(arg);
+ ExprState *estate;
estate = ExecInitExpr(e, parent);
outlist = lappend(outlist, estate);
diff --git a/src/backend/executor/execScan.c b/src/backend/executor/execScan.c
index 7ee4dc3841..c0fddcec22 100644
--- a/src/backend/executor/execScan.c
+++ b/src/backend/executor/execScan.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execScan.c,v 1.41 2007/02/02 00:07:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execScan.c,v 1.42 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -217,13 +217,14 @@ tlist_matches_tupdesc(PlanState *ps, List *tlist, Index varno, TupleDesc tupdesc
return false; /* out of order */
if (att_tup->attisdropped)
return false; /* table contains dropped columns */
+
/*
- * Note: usually the Var's type should match the tupdesc exactly,
- * but in situations involving unions of columns that have different
+ * Note: usually the Var's type should match the tupdesc exactly, but
+ * in situations involving unions of columns that have different
* typmods, the Var may have come from above the union and hence have
* typmod -1. This is a legitimate situation since the Var still
- * describes the column, just not as exactly as the tupdesc does.
- * We could change the planner to prevent it, but it'd then insert
+ * describes the column, just not as exactly as the tupdesc does. We
+ * could change the planner to prevent it, but it'd then insert
* projection steps just to convert from specific typmod to typmod -1,
* which is pretty silly.
*/
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 790a9dccc1..230d5c919f 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.151 2007/09/20 17:56:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.152 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -546,7 +546,7 @@ ExecGetResultType(PlanState *planstate)
* the given tlist should be a list of ExprState nodes, not Expr nodes.
*
* inputDesc can be NULL, but if it is not, we check to see whether simple
- * Vars in the tlist match the descriptor. It is important to provide
+ * Vars in the tlist match the descriptor. It is important to provide
* inputDesc for relation-scan plan nodes, as a cross check that the relation
* hasn't been changed since the plan was made. At higher levels of a plan,
* there is no need to recheck.
@@ -573,7 +573,7 @@ ExecBuildProjectionInfo(List *targetList,
* Determine whether the target list consists entirely of simple Var
* references (ie, references to non-system attributes) that match the
* input. If so, we can use the simpler ExecVariableList instead of
- * ExecTargetList. (Note: if there is a type mismatch then ExecEvalVar
+ * ExecTargetList. (Note: if there is a type mismatch then ExecEvalVar
* will probably throw an error at runtime, but we leave that to it.)
*/
isVarList = true;
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index d5ff4c1213..c03232ff0f 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.118 2007/06/17 18:57:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.119 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -85,7 +85,7 @@ static execution_state *init_execution_state(List *queryTree_list,
static void init_sql_fcache(FmgrInfo *finfo);
static void postquel_start(execution_state *es, SQLFunctionCachePtr fcache);
static TupleTableSlot *postquel_getnext(execution_state *es,
- SQLFunctionCachePtr fcache);
+ SQLFunctionCachePtr fcache);
static void postquel_end(execution_state *es);
static void postquel_sub_params(SQLFunctionCachePtr fcache,
FunctionCallInfo fcinfo);
@@ -251,16 +251,16 @@ init_sql_fcache(FmgrInfo *finfo)
queryTree_list = pg_parse_and_rewrite(fcache->src, argOidVect, nargs);
/*
- * Check that the function returns the type it claims to. Although
- * in simple cases this was already done when the function was defined,
- * we have to recheck because database objects used in the function's
- * queries might have changed type. We'd have to do it anyway if the
- * function had any polymorphic arguments.
+ * Check that the function returns the type it claims to. Although in
+ * simple cases this was already done when the function was defined, we
+ * have to recheck because database objects used in the function's queries
+ * might have changed type. We'd have to do it anyway if the function had
+ * any polymorphic arguments.
*
- * Note: we set fcache->returnsTuple according to whether we are
- * returning the whole tuple result or just a single column. In the
- * latter case we clear returnsTuple because we need not act different
- * from the scalar result case, even if it's a rowtype column.
+ * Note: we set fcache->returnsTuple according to whether we are returning
+ * the whole tuple result or just a single column. In the latter case we
+ * clear returnsTuple because we need not act different from the scalar
+ * result case, even if it's a rowtype column.
*
* In the returnsTuple case, check_sql_fn_retval will also construct a
* JunkFilter we can use to coerce the returned rowtype to the desired
@@ -320,8 +320,8 @@ postquel_start(execution_state *es, SQLFunctionCachePtr fcache)
if (es->qd->utilitystmt == NULL)
{
/*
- * Only set up to collect queued triggers if it's not a SELECT.
- * This isn't just an optimization, but is necessary in case a SELECT
+ * Only set up to collect queued triggers if it's not a SELECT. This
+ * isn't just an optimization, but is necessary in case a SELECT
* returns multiple rows to caller --- we mustn't exit from the
* function execution with a stacked AfterTrigger level still active.
*/
@@ -354,7 +354,7 @@ postquel_getnext(execution_state *es, SQLFunctionCachePtr fcache)
es->qd->utilitystmt),
fcache->src,
es->qd->params,
- false, /* not top level */
+ false, /* not top level */
es->qd->dest,
NULL);
result = NULL;
@@ -907,7 +907,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
/*
* If the last query isn't a SELECT, the return type must be VOID.
*
- * Note: eventually replace this test with QueryReturnsTuples? We'd need
+ * Note: eventually replace this test with QueryReturnsTuples? We'd need
* a more general method of determining the output type, though.
*/
if (!(parse->commandType == CMD_SELECT &&
@@ -926,10 +926,9 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
/*
* OK, it's a SELECT, so it must return something matching the declared
* type. (We used to insist that the declared type not be VOID in this
- * case, but that makes it hard to write a void function that exits
- * after calling another void function. Instead, we insist that the
- * SELECT return void ... so void is treated as if it were a scalar type
- * below.)
+ * case, but that makes it hard to write a void function that exits after
+ * calling another void function. Instead, we insist that the SELECT
+ * return void ... so void is treated as if it were a scalar type below.)
*/
/*
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 644268b635..e86b44c914 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -61,7 +61,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.153 2007/08/08 18:07:05 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.154 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1363,8 +1363,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
/*
* Get actual datatypes of the inputs. These could be different from
- * the agg's declared input types, when the agg accepts ANY or
- * a polymorphic type.
+ * the agg's declared input types, when the agg accepts ANY or a
+ * polymorphic type.
*/
i = 0;
foreach(lc, aggref->args)
@@ -1647,9 +1647,9 @@ ExecReScanAgg(AggState *node, ExprContext *exprCtxt)
MemSet(econtext->ecxt_aggnulls, 0, sizeof(bool) * node->numaggs);
/*
- * Release all temp storage. Note that with AGG_HASHED, the hash table
- * is allocated in a sub-context of the aggcontext. We're going to
- * rebuild the hash table from scratch, so we need to use
+ * Release all temp storage. Note that with AGG_HASHED, the hash table is
+ * allocated in a sub-context of the aggcontext. We're going to rebuild
+ * the hash table from scratch, so we need to use
* MemoryContextResetAndDeleteChildren() to avoid leaking the old hash
* table's memory context header.
*/
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 87e0063a03..779f83de47 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -21,7 +21,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.20 2007/09/20 17:56:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.21 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -277,7 +277,7 @@ bitgetpage(HeapScanDesc scan, TBMIterateResult *tbmres)
* tbmres; but we have to follow any HOT chain starting at each such
* offset.
*/
- int curslot;
+ int curslot;
for (curslot = 0; curslot < tbmres->ntuples; curslot++)
{
diff --git a/src/backend/executor/nodeBitmapIndexscan.c b/src/backend/executor/nodeBitmapIndexscan.c
index 6c14b8a413..3f65d4cd71 100644
--- a/src/backend/executor/nodeBitmapIndexscan.c
+++ b/src/backend/executor/nodeBitmapIndexscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.23 2007/05/25 17:54:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.24 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -259,9 +259,9 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
indexstate->ss.ss_currentScanDesc = NULL;
/*
- * If we are just doing EXPLAIN (ie, aren't going to run the plan),
- * stop here. This allows an index-advisor plugin to EXPLAIN a plan
- * containing references to nonexistent indexes.
+ * If we are just doing EXPLAIN (ie, aren't going to run the plan), stop
+ * here. This allows an index-advisor plugin to EXPLAIN a plan containing
+ * references to nonexistent indexes.
*/
if (eflags & EXEC_FLAG_EXPLAIN_ONLY)
return indexstate;
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index b5cabd81a4..b22295d35f 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.114 2007/06/07 19:19:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.115 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -271,8 +271,8 @@ ExecHashTableCreate(Hash *node, List *hashOperators)
hashtable->spaceAllowed = work_mem * 1024L;
/*
- * Get info about the hash functions to be used for each hash key.
- * Also remember whether the join operators are strict.
+ * Get info about the hash functions to be used for each hash key. Also
+ * remember whether the join operators are strict.
*/
nkeys = list_length(hashOperators);
hashtable->outer_hashfunctions =
@@ -423,8 +423,8 @@ ExecChooseHashTableSize(double ntuples, int tupwidth,
/*
* Both nbuckets and nbatch must be powers of 2 to make
- * ExecHashGetBucketAndBatch fast. We already fixed nbatch; now inflate
- * nbuckets to the next larger power of 2. We also force nbuckets to not
+ * ExecHashGetBucketAndBatch fast. We already fixed nbatch; now inflate
+ * nbuckets to the next larger power of 2. We also force nbuckets to not
* be real small, by starting the search at 2^10.
*/
i = 10;
@@ -718,22 +718,22 @@ ExecHashGetHashValue(HashJoinTable hashtable,
/*
* If the attribute is NULL, and the join operator is strict, then
* this tuple cannot pass the join qual so we can reject it
- * immediately (unless we're scanning the outside of an outer join,
- * in which case we must not reject it). Otherwise we act like the
+ * immediately (unless we're scanning the outside of an outer join, in
+ * which case we must not reject it). Otherwise we act like the
* hashcode of NULL is zero (this will support operators that act like
* IS NOT DISTINCT, though not any more-random behavior). We treat
* the hash support function as strict even if the operator is not.
*
* Note: currently, all hashjoinable operators must be strict since
- * the hash index AM assumes that. However, it takes so little
- * extra code here to allow non-strict that we may as well do it.
+ * the hash index AM assumes that. However, it takes so little extra
+ * code here to allow non-strict that we may as well do it.
*/
if (isNull)
{
if (hashtable->hashStrict[i] && !keep_nulls)
{
MemoryContextSwitchTo(oldContext);
- return false; /* cannot match */
+ return false; /* cannot match */
}
/* else, leave hashkey unmodified, equivalent to hashcode 0 */
}
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index a07024585e..d986872bff 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.91 2007/06/07 19:19:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.92 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -569,7 +569,7 @@ ExecHashJoinOuterGetTuple(PlanState *outerNode,
econtext->ecxt_outertuple = slot;
if (ExecHashGetHashValue(hashtable, econtext,
hjstate->hj_OuterHashKeys,
- true, /* outer tuple */
+ true, /* outer tuple */
(hjstate->js.jointype == JOIN_LEFT),
hashvalue))
{
@@ -580,8 +580,8 @@ ExecHashJoinOuterGetTuple(PlanState *outerNode,
}
/*
- * That tuple couldn't match because of a NULL, so discard it
- * and continue with the next one.
+ * That tuple couldn't match because of a NULL, so discard it and
+ * continue with the next one.
*/
slot = ExecProcNode(outerNode);
}
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index a1fb29ad2c..d1c8dbd544 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.123 2007/05/31 20:45:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.124 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -529,9 +529,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
ExecAssignScanProjectionInfo(&indexstate->ss);
/*
- * If we are just doing EXPLAIN (ie, aren't going to run the plan),
- * stop here. This allows an index-advisor plugin to EXPLAIN a plan
- * containing references to nonexistent indexes.
+ * If we are just doing EXPLAIN (ie, aren't going to run the plan), stop
+ * here. This allows an index-advisor plugin to EXPLAIN a plan containing
+ * references to nonexistent indexes.
*/
if (eflags & EXEC_FLAG_EXPLAIN_ONLY)
return indexstate;
@@ -981,7 +981,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
if (leftop && IsA(leftop, RelabelType))
leftop = ((RelabelType *) leftop)->arg;
- Assert(leftop != NULL);
+ Assert(leftop != NULL);
if (!(IsA(leftop, Var) &&
var_is_rel((Var *) leftop)))
@@ -994,8 +994,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
*/
ScanKeyEntryInitialize(this_scan_key,
SK_ISNULL | SK_SEARCHNULL,
- varattno, /* attribute number to scan */
- strategy, /* op's strategy */
+ varattno, /* attribute number to scan */
+ strategy, /* op's strategy */
subtype, /* strategy subtype */
InvalidOid, /* no reg proc for this */
(Datum) 0); /* constant */
diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c
index 76296cfd87..b3ed076ada 100644
--- a/src/backend/executor/nodeLimit.c
+++ b/src/backend/executor/nodeLimit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.31 2007/05/17 19:35:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.32 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,8 +57,8 @@ ExecLimit(LimitState *node)
/*
* First call for this node, so compute limit/offset. (We can't do
* this any earlier, because parameters from upper nodes will not
- * be set during ExecInitLimit.) This also sets position = 0
- * and changes the state to LIMIT_RESCAN.
+ * be set during ExecInitLimit.) This also sets position = 0 and
+ * changes the state to LIMIT_RESCAN.
*/
recompute_limits(node);
@@ -295,17 +295,18 @@ recompute_limits(LimitState *node)
*
* This is a bit of a kluge, but we don't have any more-abstract way of
* communicating between the two nodes; and it doesn't seem worth trying
- * to invent one without some more examples of special communication needs.
+ * to invent one without some more examples of special communication
+ * needs.
*
* Note: it is the responsibility of nodeSort.c to react properly to
- * changes of these parameters. If we ever do redesign this, it'd be
- * a good idea to integrate this signaling with the parameter-change
+ * changes of these parameters. If we ever do redesign this, it'd be a
+ * good idea to integrate this signaling with the parameter-change
* mechanism.
*/
if (IsA(outerPlanState(node), SortState))
{
- SortState *sortState = (SortState *) outerPlanState(node);
- int64 tuples_needed = node->count + node->offset;
+ SortState *sortState = (SortState *) outerPlanState(node);
+ int64 tuples_needed = node->count + node->offset;
/* negative test checks for overflow */
if (node->noCount || tuples_needed < 0)
@@ -412,9 +413,9 @@ void
ExecReScanLimit(LimitState *node, ExprContext *exprCtxt)
{
/*
- * Recompute limit/offset in case parameters changed, and reset the
- * state machine. We must do this before rescanning our child node,
- * in case it's a Sort that we are passing the parameters down to.
+ * Recompute limit/offset in case parameters changed, and reset the state
+ * machine. We must do this before rescanning our child node, in case
+ * it's a Sort that we are passing the parameters down to.
*/
recompute_limits(node);
diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c
index e216c1f9e9..4d19e793e8 100644
--- a/src/backend/executor/nodeMaterial.c
+++ b/src/backend/executor/nodeMaterial.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.59 2007/05/21 17:57:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.60 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -312,10 +312,10 @@ ExecMaterialReScan(MaterialState *node, ExprContext *exprCtxt)
/*
* If subnode is to be rescanned then we forget previous stored
- * results; we have to re-read the subplan and re-store. Also,
- * if we told tuplestore it needn't support rescan, we lose and
- * must re-read. (This last should not happen in common cases;
- * else our caller lied by not passing EXEC_FLAG_REWIND to us.)
+ * results; we have to re-read the subplan and re-store. Also, if we
+ * told tuplestore it needn't support rescan, we lose and must
+ * re-read. (This last should not happen in common cases; else our
+ * caller lied by not passing EXEC_FLAG_REWIND to us.)
*
* Otherwise we can just rewind and rescan the stored output. The
* state of the subnode does not change.
diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c
index 794871e5ba..5f213b20a3 100644
--- a/src/backend/executor/nodeMergejoin.c
+++ b/src/backend/executor/nodeMergejoin.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.88 2007/05/21 17:57:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.89 2007/11/15 21:14:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,7 +41,7 @@
*
* Therefore, rather than directly executing the merge join clauses,
* we evaluate the left and right key expressions separately and then
- * compare the columns one at a time (see MJCompare). The planner
+ * compare the columns one at a time (see MJCompare). The planner
* passes us enough information about the sort ordering of the inputs
* to allow us to determine how to make the comparison. We may use the
* appropriate btree comparison function, since Postgres' only notion
@@ -152,7 +152,7 @@ typedef struct MergeJoinClauseData
* sort ordering for each merge key. The mergejoinable operator is an
* equality operator in this opfamily, and the two inputs are guaranteed to be
* ordered in either increasing or decreasing (respectively) order according
- * to this opfamily, with nulls at the indicated end of the range. This
+ * to this opfamily, with nulls at the indicated end of the range. This
* allows us to obtain the needed comparison function from the opfamily.
*/
static MergeJoinClause
@@ -199,7 +199,7 @@ MJExamineQuals(List *mergeclauses,
&op_lefttype,
&op_righttype,
&op_recheck);
- if (op_strategy != BTEqualStrategyNumber) /* should not happen */
+ if (op_strategy != BTEqualStrategyNumber) /* should not happen */
elog(ERROR, "cannot merge using non-equality operator %u",
qual->opno);
Assert(!op_recheck); /* never true for btree */
@@ -209,7 +209,7 @@ MJExamineQuals(List *mergeclauses,
op_lefttype,
op_righttype,
BTORDER_PROC);
- if (!RegProcedureIsValid(cmpproc)) /* should not happen */
+ if (!RegProcedureIsValid(cmpproc)) /* should not happen */
elog(ERROR, "missing support function %d(%u,%u) in opfamily %u",
BTORDER_PROC, op_lefttype, op_righttype, opfamily);
@@ -227,7 +227,7 @@ MJExamineQuals(List *mergeclauses,
clause->reverse = false;
else if (opstrategy == BTGreaterStrategyNumber)
clause->reverse = true;
- else /* planner screwed up */
+ else /* planner screwed up */
elog(ERROR, "unsupported mergejoin strategy %d", opstrategy);
clause->nulls_first = nulls_first;
@@ -354,21 +354,21 @@ MJCompare(MergeJoinState *mergestate)
{
if (clause->risnull)
{
- nulleqnull = true; /* NULL "=" NULL */
+ nulleqnull = true; /* NULL "=" NULL */
continue;
}
if (clause->nulls_first)
- result = -1; /* NULL "<" NOT_NULL */
+ result = -1; /* NULL "<" NOT_NULL */
else
- result = 1; /* NULL ">" NOT_NULL */
+ result = 1; /* NULL ">" NOT_NULL */
break;
}
if (clause->risnull)
{
if (clause->nulls_first)
- result = 1; /* NOT_NULL ">" NULL */
+ result = 1; /* NOT_NULL ">" NULL */
else
- result = -1; /* NOT_NULL "<" NULL */
+ result = -1; /* NOT_NULL "<" NULL */
break;
}
@@ -384,7 +384,7 @@ MJCompare(MergeJoinState *mergestate)
fresult = FunctionCallInvoke(&fcinfo);
if (fcinfo.isnull)
{
- nulleqnull = true; /* treat like NULL = NULL */
+ nulleqnull = true; /* treat like NULL = NULL */
continue;
}
result = DatumGetInt32(fresult);
@@ -1447,10 +1447,10 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags)
/*
* For certain types of inner child nodes, it is advantageous to issue
- * MARK every time we advance past an inner tuple we will never return
- * to. For other types, MARK on a tuple we cannot return to is a waste
- * of cycles. Detect which case applies and set mj_ExtraMarks if we
- * want to issue "unnecessary" MARK calls.
+ * MARK every time we advance past an inner tuple we will never return to.
+ * For other types, MARK on a tuple we cannot return to is a waste of
+ * cycles. Detect which case applies and set mj_ExtraMarks if we want to
+ * issue "unnecessary" MARK calls.
*
* Currently, only Material wants the extra MARKs, and it will be helpful
* only if eflags doesn't specify REWIND.
diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c
index 5ea5132dd2..01046190d2 100644
--- a/src/backend/executor/nodeResult.c
+++ b/src/backend/executor/nodeResult.c
@@ -38,7 +38,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.40 2007/02/22 23:44:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.41 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -133,8 +133,8 @@ ExecResult(ResultState *node)
return NULL;
/*
- * prepare to compute projection expressions, which will expect
- * to access the input tuples as varno OUTER.
+ * prepare to compute projection expressions, which will expect to
+ * access the input tuples as varno OUTER.
*/
econtext->ecxt_outertuple = outerTupleSlot;
}
@@ -308,9 +308,9 @@ ExecReScanResult(ResultState *node, ExprContext *exprCtxt)
/*
* If chgParam of subnode is not null then plan will be re-scanned by
- * first ExecProcNode. However, if caller is passing us an exprCtxt
- * then forcibly rescan the subnode now, so that we can pass the
- * exprCtxt down to the subnode (needed for gated indexscan).
+ * first ExecProcNode. However, if caller is passing us an exprCtxt then
+ * forcibly rescan the subnode now, so that we can pass the exprCtxt down
+ * to the subnode (needed for gated indexscan).
*/
if (node->ps.lefttree &&
(node->ps.lefttree->chgParam == NULL || exprCtxt != NULL))
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index f12d0143a3..9074f78842 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.90 2007/08/26 21:44:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.91 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -259,14 +259,14 @@ ExecScanSubPlan(SubPlanState *node,
* ROWCOMPARE_SUBLINK.
*
* For EXPR_SUBLINK we require the subplan to produce no more than one
- * tuple, else an error is raised. If zero tuples are produced, we return
+ * tuple, else an error is raised. If zero tuples are produced, we return
* NULL. Assuming we get a tuple, we just use its first column (there can
* be only one non-junk column in this case).
*
* For ARRAY_SUBLINK we allow the subplan to produce any number of tuples,
* and form an array of the first column's values. Note in particular
- * that we produce a zero-element array if no tuples are produced (this
- * is a change from pre-8.3 behavior of returning NULL).
+ * that we produce a zero-element array if no tuples are produced (this is
+ * a change from pre-8.3 behavior of returning NULL).
*/
result = BoolGetDatum(subLinkType == ALL_SUBLINK);
*isNull = false;
@@ -859,17 +859,17 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
slot = ExecAllocTableSlot(tupTable);
ExecSetSlotDescriptor(slot, tupDesc);
sstate->projLeft = ExecBuildProjectionInfo(lefttlist,
- NULL,
- slot,
- NULL);
+ NULL,
+ slot,
+ NULL);
tupDesc = ExecTypeFromTL(rightptlist, false);
slot = ExecAllocTableSlot(tupTable);
ExecSetSlotDescriptor(slot, tupDesc);
sstate->projRight = ExecBuildProjectionInfo(righttlist,
- sstate->innerecontext,
- slot,
- NULL);
+ sstate->innerecontext,
+ slot,
+ NULL);
}
return sstate;
@@ -910,8 +910,8 @@ ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
elog(ERROR, "ANY/ALL subselect unsupported as initplan");
/*
- * By definition, an initplan has no parameters from our query level,
- * but it could have some from an outer level. Rescan it if needed.
+ * By definition, an initplan has no parameters from our query level, but
+ * it could have some from an outer level. Rescan it if needed.
*/
if (planstate->chgParam != NULL)
ExecReScan(planstate, NULL);
diff --git a/src/backend/executor/nodeSubqueryscan.c b/src/backend/executor/nodeSubqueryscan.c
index 159ee1b34d..d81773a67d 100644
--- a/src/backend/executor/nodeSubqueryscan.c
+++ b/src/backend/executor/nodeSubqueryscan.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.37 2007/02/27 01:11:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.38 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -98,7 +98,7 @@ ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags)
Assert(!(eflags & EXEC_FLAG_MARK));
/*
- * SubqueryScan should not have any "normal" children. Also, if planner
+ * SubqueryScan should not have any "normal" children. Also, if planner
* left anything in subrtable, it's fishy.
*/
Assert(outerPlan(node) == NULL);
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index 8c217a442b..d33d92bbb7 100644
--- a/src/backend/executor/nodeTidscan.c
+++ b/src/backend/executor/nodeTidscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.56 2007/10/24 18:37:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.57 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -155,7 +155,7 @@ TidListCreate(TidScanState *tidstate)
ItemPointerData cursor_tid;
if (execCurrentOf(cexpr, econtext,
- RelationGetRelid(tidstate->ss.ss_currentRelation),
+ RelationGetRelid(tidstate->ss.ss_currentRelation),
&cursor_tid))
{
if (numTids >= numAllocTids)
@@ -274,8 +274,8 @@ TidNext(TidScanState *node)
/*
* XXX shouldn't we check here to make sure tuple matches TID list? In
- * runtime-key case this is not certain, is it? However, in the
- * WHERE CURRENT OF case it might not match anyway ...
+ * runtime-key case this is not certain, is it? However, in the WHERE
+ * CURRENT OF case it might not match anyway ...
*/
ExecStoreTuple(estate->es_evTuple[scanrelid - 1],
@@ -328,8 +328,8 @@ TidNext(TidScanState *node)
/*
* For WHERE CURRENT OF, the tuple retrieved from the cursor might
- * since have been updated; if so, we should fetch the version that
- * is current according to our snapshot.
+ * since have been updated; if so, we should fetch the version that is
+ * current according to our snapshot.
*/
if (node->tss_isCurrentOf)
heap_get_latest_tid(heapRelation, snapshot, &tuple->t_self);
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 0ea017906e..3d72fa20a5 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.183 2007/10/25 13:48:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.184 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,8 +46,8 @@ static int _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, long tcount);
static void _SPI_error_callback(void *arg);
static void _SPI_cursor_operation(Portal portal,
- FetchDirection direction, long count,
- DestReceiver *dest);
+ FetchDirection direction, long count,
+ DestReceiver *dest);
static SPIPlanPtr _SPI_copy_plan(SPIPlanPtr plan, MemoryContext parentcxt);
static SPIPlanPtr _SPI_save_plan(SPIPlanPtr plan);
@@ -910,7 +910,7 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
oldcontext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
/* sizeof(ParamListInfoData) includes the first array element */
paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) +
- (plan->nargs - 1) *sizeof(ParamExternData));
+ (plan->nargs - 1) *sizeof(ParamExternData));
paramLI->numParams = plan->nargs;
for (k = 0; k < plan->nargs; k++)
@@ -967,8 +967,8 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
cplan);
/*
- * Set up options for portal. Default SCROLL type is chosen the same
- * way as PerformCursorOpen does it.
+ * Set up options for portal. Default SCROLL type is chosen the same way
+ * as PerformCursorOpen does it.
*/
portal->cursorOptions = plan->cursor_options;
if (!(portal->cursorOptions & (CURSOR_OPT_SCROLL | CURSOR_OPT_NO_SCROLL)))
@@ -983,9 +983,9 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
}
/*
- * Disallow SCROLL with SELECT FOR UPDATE. This is not redundant with
- * the check in transformDeclareCursorStmt because the cursor options
- * might not have come through there.
+ * Disallow SCROLL with SELECT FOR UPDATE. This is not redundant with the
+ * check in transformDeclareCursorStmt because the cursor options might
+ * not have come through there.
*/
if (portal->cursorOptions & CURSOR_OPT_SCROLL)
{
@@ -999,9 +999,9 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
}
/*
- * If told to be read-only, we'd better check for read-only queries.
- * This can't be done earlier because we need to look at the finished,
- * planned queries. (In particular, we don't want to do it between
+ * If told to be read-only, we'd better check for read-only queries. This
+ * can't be done earlier because we need to look at the finished, planned
+ * queries. (In particular, we don't want to do it between
* RevalidateCachedPlan and PortalDefineQuery, because throwing an error
* between those steps would result in leaking our plancache refcount.)
*/
@@ -1011,14 +1011,14 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
foreach(lc, stmt_list)
{
- Node *pstmt = (Node *) lfirst(lc);
+ Node *pstmt = (Node *) lfirst(lc);
if (!CommandIsReadOnly(pstmt))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is a SQL statement name */
- errmsg("%s is not allowed in a non-volatile function",
- CreateCommandTag(pstmt))));
+ /* translator: %s is a SQL statement name */
+ errmsg("%s is not allowed in a non-volatile function",
+ CreateCommandTag(pstmt))));
}
}
@@ -1396,8 +1396,8 @@ _SPI_prepare_plan(const char *src, SPIPlanPtr plan)
raw_parsetree_list = pg_parse_query(src);
/*
- * Do parse analysis and rule rewrite for each raw parsetree, then
- * cons up a phony plancache entry for each one.
+ * Do parse analysis and rule rewrite for each raw parsetree, then cons up
+ * a phony plancache entry for each one.
*/
plancache_list = NIL;
@@ -1416,9 +1416,9 @@ _SPI_prepare_plan(const char *src, SPIPlanPtr plan)
plansource = (CachedPlanSource *) palloc0(sizeof(CachedPlanSource));
cplan = (CachedPlan *) palloc0(sizeof(CachedPlan));
- plansource->raw_parse_tree = parsetree;
+ plansource->raw_parse_tree = parsetree;
/* cast-away-const here is a bit ugly, but there's no reason to copy */
- plansource->query_string = (char *) src;
+ plansource->query_string = (char *) src;
plansource->commandTag = CreateCommandTag(parsetree);
plansource->param_types = argtypes;
plansource->num_params = nargs;
@@ -1621,7 +1621,7 @@ _SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls,
ProcessUtility(stmt,
plansource->query_string,
paramLI,
- false, /* not top level */
+ false, /* not top level */
dest,
NULL);
/* Update "processed" if stmt returned tuples */
@@ -1713,7 +1713,7 @@ _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, long tcount)
{
case CMD_SELECT:
Assert(queryDesc->plannedstmt->utilityStmt == NULL);
- if (queryDesc->plannedstmt->intoClause) /* select into table? */
+ if (queryDesc->plannedstmt->intoClause) /* select into table? */
res = SPI_OK_SELINTO;
else if (queryDesc->dest->mydest != DestSPI)
{
@@ -1984,8 +1984,8 @@ _SPI_copy_plan(SPIPlanPtr plan, MemoryContext parentcxt)
newsource = (CachedPlanSource *) palloc0(sizeof(CachedPlanSource));
newcplan = (CachedPlan *) palloc0(sizeof(CachedPlan));
- newsource->raw_parse_tree = copyObject(plansource->raw_parse_tree);
- newsource->query_string = pstrdup(plansource->query_string);
+ newsource->raw_parse_tree = copyObject(plansource->raw_parse_tree);
+ newsource->query_string = pstrdup(plansource->query_string);
newsource->commandTag = plansource->commandTag;
newsource->param_types = newplan->argtypes;
newsource->num_params = newplan->nargs;
diff --git a/src/backend/lib/stringinfo.c b/src/backend/lib/stringinfo.c
index fc403648bc..598570a267 100644
--- a/src/backend/lib/stringinfo.c
+++ b/src/backend/lib/stringinfo.c
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/lib/stringinfo.c,v 1.47 2007/08/12 20:18:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/lib/stringinfo.c,v 1.48 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ makeStringInfo(void)
void
initStringInfo(StringInfo str)
{
- int size = 1024; /* initial default buffer size */
+ int size = 1024; /* initial default buffer size */
str->data = (char *) palloc(size);
str->maxlen = size;
@@ -234,7 +234,7 @@ enlargeStringInfo(StringInfo str, int needed)
int newlen;
/*
- * Guard against out-of-range "needed" values. Without this, we can get
+ * Guard against out-of-range "needed" values. Without this, we can get
* an overflow or infinite loop in the following.
*/
if (needed < 0) /* should not happen */
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 22a03f3afc..89cb3e9ad4 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.158 2007/11/15 20:04:38 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.159 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -197,7 +197,7 @@ pg_krb5_recvauth(Port *port)
if (get_role_line(port->user_name) == NULL)
return STATUS_ERROR;
-
+
ret = pg_krb5_init();
if (ret != STATUS_OK)
return ret;
@@ -326,7 +326,7 @@ pg_krb5_recvauth(Port *port)
* from src/athena/auth/krb5/src/lib/gssapi/generic/gssapi_generic.c
*/
static const gss_OID_desc GSS_C_NT_USER_NAME_desc =
- {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"};
+{10, (void *) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"};
static GSS_DLLIMP gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_desc;
#endif
@@ -334,30 +334,33 @@ static GSS_DLLIMP gss_OID GSS_C_NT_USER_NAME = &GSS_C_NT_USER_NAME_desc;
static void
pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
{
- gss_buffer_desc gmsg;
- OM_uint32 lmaj_s, lmin_s, msg_ctx;
- char msg_major[128],
- msg_minor[128];
+ gss_buffer_desc gmsg;
+ OM_uint32 lmaj_s,
+ lmin_s,
+ msg_ctx;
+ char msg_major[128],
+ msg_minor[128];
/* Fetch major status message */
msg_ctx = 0;
lmaj_s = gss_display_status(&lmin_s, maj_stat, GSS_C_GSS_CODE,
- GSS_C_NO_OID, &msg_ctx, &gmsg);
+ GSS_C_NO_OID, &msg_ctx, &gmsg);
strlcpy(msg_major, gmsg.value, sizeof(msg_major));
gss_release_buffer(&lmin_s, &gmsg);
if (msg_ctx)
- /* More than one message available.
- * XXX: Should we loop and read all messages?
- * (same below)
+
+ /*
+ * More than one message available. XXX: Should we loop and read all
+ * messages? (same below)
*/
- ereport(WARNING,
+ ereport(WARNING,
(errmsg_internal("incomplete GSS error report")));
/* Fetch mechanism minor status message */
msg_ctx = 0;
lmaj_s = gss_display_status(&lmin_s, min_stat, GSS_C_MECH_CODE,
- GSS_C_NO_OID, &msg_ctx, &gmsg);
+ GSS_C_NO_OID, &msg_ctx, &gmsg);
strlcpy(msg_minor, gmsg.value, sizeof(msg_minor));
gss_release_buffer(&lmin_s, &gmsg);
@@ -365,8 +368,10 @@ pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
ereport(WARNING,
(errmsg_internal("incomplete GSS minor error report")));
- /* errmsg_internal, since translation of the first part must be
- * done before calling this function anyway. */
+ /*
+ * errmsg_internal, since translation of the first part must be done
+ * before calling this function anyway.
+ */
ereport(severity,
(errmsg_internal("%s", errmsg),
errdetail("%s: %s", msg_major, msg_minor)));
@@ -375,36 +380,38 @@ pg_GSS_error(int severity, char *errmsg, OM_uint32 maj_stat, OM_uint32 min_stat)
static int
pg_GSS_recvauth(Port *port)
{
- OM_uint32 maj_stat, min_stat, lmin_s, gflags;
- char *kt_path;
- int mtype;
- int ret;
- StringInfoData buf;
- gss_buffer_desc gbuf;
+ OM_uint32 maj_stat,
+ min_stat,
+ lmin_s,
+ gflags;
+ char *kt_path;
+ int mtype;
+ int ret;
+ StringInfoData buf;
+ gss_buffer_desc gbuf;
if (pg_krb_server_keyfile && strlen(pg_krb_server_keyfile) > 0)
{
/*
* Set default Kerberos keytab file for the Krb5 mechanism.
*
- * setenv("KRB5_KTNAME", pg_krb_server_keyfile, 0);
- * except setenv() not always available.
+ * setenv("KRB5_KTNAME", pg_krb_server_keyfile, 0); except setenv()
+ * not always available.
*/
if (!getenv("KRB5_KTNAME"))
{
kt_path = palloc(MAXPGPATH + 13);
snprintf(kt_path, MAXPGPATH + 13,
- "KRB5_KTNAME=%s", pg_krb_server_keyfile);
+ "KRB5_KTNAME=%s", pg_krb_server_keyfile);
putenv(kt_path);
}
}
/*
- * We accept any service principal that's present in our
- * keytab. This increases interoperability between kerberos
- * implementations that see for example case sensitivity
- * differently, while not really opening up any vector
- * of attack.
+ * We accept any service principal that's present in our keytab. This
+ * increases interoperability between kerberos implementations that see
+ * for example case sensitivity differently, while not really opening up
+ * any vector of attack.
*/
port->gss->cred = GSS_C_NO_CREDENTIAL;
@@ -414,12 +421,12 @@ pg_GSS_recvauth(Port *port)
port->gss->ctx = GSS_C_NO_CONTEXT;
/*
- * Loop through GSSAPI message exchange. This exchange can consist
- * of multiple messags sent in both directions. First message is always
- * from the client. All messages from client to server are password
- * packets (type 'p').
+ * Loop through GSSAPI message exchange. This exchange can consist of
+ * multiple messags sent in both directions. First message is always from
+ * the client. All messages from client to server are password packets
+ * (type 'p').
*/
- do
+ do
{
mtype = pq_getbyte();
if (mtype != 'p')
@@ -429,7 +436,7 @@ pg_GSS_recvauth(Port *port)
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("expected GSS response, got message type %d",
- mtype)));
+ mtype)));
return STATUS_ERROR;
}
@@ -446,21 +453,21 @@ pg_GSS_recvauth(Port *port)
gbuf.length = buf.len;
gbuf.value = buf.data;
- elog(DEBUG4, "Processing received GSS token of length %u",
+ elog(DEBUG4, "Processing received GSS token of length %u",
(unsigned int) gbuf.length);
maj_stat = gss_accept_sec_context(
- &min_stat,
- &port->gss->ctx,
- port->gss->cred,
- &gbuf,
- GSS_C_NO_CHANNEL_BINDINGS,
- &port->gss->name,
- NULL,
- &port->gss->outbuf,
- &gflags,
- NULL,
- NULL);
+ &min_stat,
+ &port->gss->ctx,
+ port->gss->cred,
+ &gbuf,
+ GSS_C_NO_CHANNEL_BINDINGS,
+ &port->gss->name,
+ NULL,
+ &port->gss->outbuf,
+ &gflags,
+ NULL,
+ NULL);
/* gbuf no longer used */
pfree(buf.data);
@@ -488,10 +495,11 @@ pg_GSS_recvauth(Port *port)
if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED)
{
OM_uint32 lmin_s;
+
gss_delete_sec_context(&lmin_s, &port->gss->ctx, GSS_C_NO_BUFFER);
- pg_GSS_error(ERROR,
- gettext_noop("accepting GSS security context failed"),
- maj_stat, min_stat);
+ pg_GSS_error(ERROR,
+ gettext_noop("accepting GSS security context failed"),
+ maj_stat, min_stat);
}
if (maj_stat == GSS_S_CONTINUE_NEEDED)
@@ -510,8 +518,8 @@ pg_GSS_recvauth(Port *port)
/*
* GSS_S_COMPLETE indicates that authentication is now complete.
*
- * Get the name of the user that authenticated, and compare it to the
- * pg username that was specified for the connection.
+ * Get the name of the user that authenticated, and compare it to the pg
+ * username that was specified for the connection.
*/
maj_stat = gss_display_name(&min_stat, port->gss->name, &gbuf, NULL);
if (maj_stat != GSS_S_COMPLETE)
@@ -524,7 +532,8 @@ pg_GSS_recvauth(Port *port)
*/
if (strchr(gbuf.value, '@'))
{
- char *cp = strchr(gbuf.value, '@');
+ char *cp = strchr(gbuf.value, '@');
+
*cp = '\0';
cp++;
@@ -542,7 +551,7 @@ pg_GSS_recvauth(Port *port)
{
/* GSS realm does not match */
elog(DEBUG2,
- "GSSAPI realm (%s) and configured realm (%s) don't match",
+ "GSSAPI realm (%s) and configured realm (%s) don't match",
cp, pg_krb_realm);
gss_release_buffer(&lmin_s, &gbuf);
return STATUS_ERROR;
@@ -566,20 +575,19 @@ pg_GSS_recvauth(Port *port)
if (ret)
{
/* GSS name and PGUSER are not equivalent */
- elog(DEBUG2,
+ elog(DEBUG2,
"provided username (%s) and GSSAPI username (%s) don't match",
- port->user_name, (char *)gbuf.value);
+ port->user_name, (char *) gbuf.value);
gss_release_buffer(&lmin_s, &gbuf);
return STATUS_ERROR;
}
-
+
gss_release_buffer(&lmin_s, &gbuf);
return STATUS_OK;
}
-
-#else /* no ENABLE_GSS */
+#else /* no ENABLE_GSS */
static int
pg_GSS_recvauth(Port *port)
{
@@ -588,78 +596,78 @@ pg_GSS_recvauth(Port *port)
errmsg("GSSAPI not implemented on this server")));
return STATUS_ERROR;
}
-#endif /* ENABLE_GSS */
+#endif /* ENABLE_GSS */
#ifdef ENABLE_SSPI
static void
pg_SSPI_error(int severity, char *errmsg, SECURITY_STATUS r)
{
- char sysmsg[256];
+ char sysmsg[256];
if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, r, 0, sysmsg, sizeof(sysmsg), NULL) == 0)
ereport(severity,
- (errmsg_internal("%s", errmsg),
- errdetail("sspi error %x", (unsigned int)r)));
+ (errmsg_internal("%s", errmsg),
+ errdetail("sspi error %x", (unsigned int) r)));
else
ereport(severity,
- (errmsg_internal("%s", errmsg),
- errdetail("%s (%x)", sysmsg, (unsigned int)r)));
+ (errmsg_internal("%s", errmsg),
+ errdetail("%s (%x)", sysmsg, (unsigned int) r)));
}
-typedef SECURITY_STATUS
-(WINAPI * QUERY_SECURITY_CONTEXT_TOKEN_FN)(
- PCtxtHandle, void **);
+typedef SECURITY_STATUS
+ (WINAPI * QUERY_SECURITY_CONTEXT_TOKEN_FN) (
+ PCtxtHandle, void **);
static int
pg_SSPI_recvauth(Port *port)
{
- int mtype;
- StringInfoData buf;
+ int mtype;
+ StringInfoData buf;
SECURITY_STATUS r;
- CredHandle sspicred;
- CtxtHandle *sspictx = NULL,
- newctx;
- TimeStamp expiry;
- ULONG contextattr;
- SecBufferDesc inbuf;
- SecBufferDesc outbuf;
- SecBuffer OutBuffers[1];
- SecBuffer InBuffers[1];
- HANDLE token;
- TOKEN_USER *tokenuser;
- DWORD retlen;
- char accountname[MAXPGPATH];
- char domainname[MAXPGPATH];
- DWORD accountnamesize = sizeof(accountname);
- DWORD domainnamesize = sizeof(domainname);
- SID_NAME_USE accountnameuse;
- HMODULE secur32;
- QUERY_SECURITY_CONTEXT_TOKEN_FN _QuerySecurityContextToken;
+ CredHandle sspicred;
+ CtxtHandle *sspictx = NULL,
+ newctx;
+ TimeStamp expiry;
+ ULONG contextattr;
+ SecBufferDesc inbuf;
+ SecBufferDesc outbuf;
+ SecBuffer OutBuffers[1];
+ SecBuffer InBuffers[1];
+ HANDLE token;
+ TOKEN_USER *tokenuser;
+ DWORD retlen;
+ char accountname[MAXPGPATH];
+ char domainname[MAXPGPATH];
+ DWORD accountnamesize = sizeof(accountname);
+ DWORD domainnamesize = sizeof(domainname);
+ SID_NAME_USE accountnameuse;
+ HMODULE secur32;
+ QUERY_SECURITY_CONTEXT_TOKEN_FN _QuerySecurityContextToken;
/*
* Acquire a handle to the server credentials.
*/
r = AcquireCredentialsHandle(NULL,
- "negotiate",
- SECPKG_CRED_INBOUND,
- NULL,
- NULL,
- NULL,
- NULL,
- &sspicred,
- &expiry);
+ "negotiate",
+ SECPKG_CRED_INBOUND,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &sspicred,
+ &expiry);
if (r != SEC_E_OK)
- pg_SSPI_error(ERROR,
- gettext_noop("could not acquire SSPI credentials handle"), r);
+ pg_SSPI_error(ERROR,
+ gettext_noop("could not acquire SSPI credentials handle"), r);
/*
- * Loop through SSPI message exchange. This exchange can consist
- * of multiple messags sent in both directions. First message is always
- * from the client. All messages from client to server are password
- * packets (type 'p').
+ * Loop through SSPI message exchange. This exchange can consist of
+ * multiple messags sent in both directions. First message is always from
+ * the client. All messages from client to server are password packets
+ * (type 'p').
*/
- do
+ do
{
mtype = pq_getbyte();
if (mtype != 'p')
@@ -669,7 +677,7 @@ pg_SSPI_recvauth(Port *port)
ereport(COMMERROR,
(errcode(ERRCODE_PROTOCOL_VIOLATION),
errmsg("expected SSPI response, got message type %d",
- mtype)));
+ mtype)));
return STATUS_ERROR;
}
@@ -699,18 +707,18 @@ pg_SSPI_recvauth(Port *port)
outbuf.ulVersion = SECBUFFER_VERSION;
- elog(DEBUG4, "Processing received SSPI token of length %u",
+ elog(DEBUG4, "Processing received SSPI token of length %u",
(unsigned int) buf.len);
r = AcceptSecurityContext(&sspicred,
- sspictx,
- &inbuf,
- ASC_REQ_ALLOCATE_MEMORY,
- SECURITY_NETWORK_DREP,
- &newctx,
- &outbuf,
- &contextattr,
- NULL);
+ sspictx,
+ &inbuf,
+ ASC_REQ_ALLOCATE_MEMORY,
+ SECURITY_NETWORK_DREP,
+ &newctx,
+ &outbuf,
+ &contextattr,
+ NULL);
/* input buffer no longer used */
pfree(buf.data);
@@ -739,8 +747,8 @@ pg_SSPI_recvauth(Port *port)
free(sspictx);
}
FreeCredentialsHandle(&sspicred);
- pg_SSPI_error(ERROR,
- gettext_noop("could not accept SSPI security context"), r);
+ pg_SSPI_error(ERROR,
+ gettext_noop("could not accept SSPI security context"), r);
}
if (sspictx == NULL)
@@ -748,7 +756,7 @@ pg_SSPI_recvauth(Port *port)
sspictx = malloc(sizeof(CtxtHandle));
if (sspictx == NULL)
ereport(ERROR,
- (errmsg("out of memory")));
+ (errmsg("out of memory")));
memcpy(sspictx, &newctx, sizeof(CtxtHandle));
}
@@ -768,18 +776,18 @@ pg_SSPI_recvauth(Port *port)
/*
* SEC_E_OK indicates that authentication is now complete.
*
- * Get the name of the user that authenticated, and compare it to the
- * pg username that was specified for the connection.
+ * Get the name of the user that authenticated, and compare it to the pg
+ * username that was specified for the connection.
*
- * MingW is missing the export for QuerySecurityContextToken in
- * the secur32 library, so we have to load it dynamically.
+ * MingW is missing the export for QuerySecurityContextToken in the
+ * secur32 library, so we have to load it dynamically.
*/
secur32 = LoadLibrary("SECUR32.DLL");
if (secur32 == NULL)
ereport(ERROR,
- (errmsg_internal("could not load secur32.dll: %d",
- (int)GetLastError())));
+ (errmsg_internal("could not load secur32.dll: %d",
+ (int) GetLastError())));
_QuerySecurityContextToken = (QUERY_SECURITY_CONTEXT_TOKEN_FN)
GetProcAddress(secur32, "QuerySecurityContextToken");
@@ -787,16 +795,16 @@ pg_SSPI_recvauth(Port *port)
{
FreeLibrary(secur32);
ereport(ERROR,
- (errmsg_internal("could not locate QuerySecurityContextToken in secur32.dll: %d",
- (int)GetLastError())));
+ (errmsg_internal("could not locate QuerySecurityContextToken in secur32.dll: %d",
+ (int) GetLastError())));
}
- r = (_QuerySecurityContextToken)(sspictx, &token);
+ r = (_QuerySecurityContextToken) (sspictx, &token);
if (r != SEC_E_OK)
{
FreeLibrary(secur32);
pg_SSPI_error(ERROR,
- gettext_noop("could not get security token from context"), r);
+ gettext_noop("could not get security token from context"), r);
}
FreeLibrary(secur32);
@@ -810,8 +818,8 @@ pg_SSPI_recvauth(Port *port)
if (!GetTokenInformation(token, TokenUser, NULL, 0, &retlen) && GetLastError() != 122)
ereport(ERROR,
- (errmsg_internal("could not get token user size: error code %d",
- (int) GetLastError())));
+ (errmsg_internal("could not get token user size: error code %d",
+ (int) GetLastError())));
tokenuser = malloc(retlen);
if (tokenuser == NULL)
@@ -821,18 +829,19 @@ pg_SSPI_recvauth(Port *port)
if (!GetTokenInformation(token, TokenUser, tokenuser, retlen, &retlen))
ereport(ERROR,
(errmsg_internal("could not get user token: error code %d",
- (int) GetLastError())));
+ (int) GetLastError())));
- if (!LookupAccountSid(NULL, tokenuser->User.Sid, accountname, &accountnamesize,
- domainname, &domainnamesize, &accountnameuse))
+ if (!LookupAccountSid(NULL, tokenuser->User.Sid, accountname, &accountnamesize,
+ domainname, &domainnamesize, &accountnameuse))
ereport(ERROR,
- (errmsg_internal("could not lookup acconut sid: error code %d",
- (int) GetLastError())));
+ (errmsg_internal("could not lookup acconut sid: error code %d",
+ (int) GetLastError())));
free(tokenuser);
- /*
- * Compare realm/domain if requested. In SSPI, always compare case insensitive.
+ /*
+ * Compare realm/domain if requested. In SSPI, always compare case
+ * insensitive.
*/
if (pg_krb_realm && strlen(pg_krb_realm))
{
@@ -841,28 +850,28 @@ pg_SSPI_recvauth(Port *port)
elog(DEBUG2,
"SSPI domain (%s) and configured domain (%s) don't match",
domainname, pg_krb_realm);
-
+
return STATUS_ERROR;
}
}
/*
- * We have the username (without domain/realm) in accountname, compare
- * to the supplied value. In SSPI, always compare case insensitive.
+ * We have the username (without domain/realm) in accountname, compare to
+ * the supplied value. In SSPI, always compare case insensitive.
*/
if (pg_strcasecmp(port->user_name, accountname))
{
/* GSS name and PGUSER are not equivalent */
- elog(DEBUG2,
+ elog(DEBUG2,
"provided username (%s) and SSPI username (%s) don't match",
port->user_name, accountname);
return STATUS_ERROR;
}
-
+
return STATUS_OK;
}
-#else /* no ENABLE_SSPI */
+#else /* no ENABLE_SSPI */
static int
pg_SSPI_recvauth(Port *port)
{
@@ -871,7 +880,7 @@ pg_SSPI_recvauth(Port *port)
errmsg("SSPI not implemented on this server")));
return STATUS_ERROR;
}
-#endif /* ENABLE_SSPI */
+#endif /* ENABLE_SSPI */
/*
@@ -1113,8 +1122,11 @@ sendAuthRequest(Port *port, AuthRequest areq)
pq_sendbytes(&buf, port->cryptSalt, 2);
#if defined(ENABLE_GSS) || defined(ENABLE_SSPI)
- /* Add the authentication data for the next step of
- * the GSSAPI or SSPI negotiation. */
+
+ /*
+ * Add the authentication data for the next step of the GSSAPI or SSPI
+ * negotiation.
+ */
else if (areq == AUTH_REQ_GSS_CONT)
{
if (port->gss->outbuf.length > 0)
@@ -1413,7 +1425,7 @@ CheckLDAPAuth(Port *port)
{
ldap_unbind(ldap);
ereport(LOG,
- (errmsg("could not set LDAP protocol version: error code %d", r)));
+ (errmsg("could not set LDAP protocol version: error code %d", r)));
return STATUS_ERROR;
}
@@ -1456,9 +1468,9 @@ CheckLDAPAuth(Port *port)
}
/*
- * Leak LDAP handle on purpose, because we need the library to stay
- * open. This is ok because it will only ever be leaked once per
- * process and is automatically cleaned up on process exit.
+ * Leak LDAP handle on purpose, because we need the library to
+ * stay open. This is ok because it will only ever be leaked once
+ * per process and is automatically cleaned up on process exit.
*/
}
if ((r = _ldap_start_tls_sA(ldap, NULL, NULL, NULL, NULL)) != LDAP_SUCCESS)
@@ -1466,7 +1478,7 @@ CheckLDAPAuth(Port *port)
{
ldap_unbind(ldap);
ereport(LOG,
- (errmsg("could not start LDAP TLS session: error code %d", r)));
+ (errmsg("could not start LDAP TLS session: error code %d", r)));
return STATUS_ERROR;
}
}
diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c
index efb8ecbb77..d7df99e496 100644
--- a/src/backend/libpq/be-secure.c
+++ b/src/backend/libpq/be-secure.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.81 2007/11/07 12:24:24 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.82 2007/11/15 21:14:35 momjian Exp $
*
* Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database
@@ -95,7 +95,7 @@
#if SSLEAY_VERSION_NUMBER >= 0x0907000L
#include <openssl/conf.h>
#endif
-#endif /* USE_SSL */
+#endif /* USE_SSL */
#include "libpq/libpq.h"
#include "tcop/tcopprot.h"
@@ -130,8 +130,7 @@ static const char *SSLerrmessage(void);
static SSL_CTX *SSL_context = NULL;
/* GUC variable controlling SSL cipher list */
-char *SSLCipherSuites = NULL;
-
+char *SSLCipherSuites = NULL;
#endif
/* ------------------------------------------------------------ */
@@ -282,7 +281,7 @@ rloop:
#ifdef WIN32
pgwin32_waitforsinglesocket(SSL_get_fd(port->ssl),
(err == SSL_ERROR_WANT_READ) ?
- FD_READ | FD_CLOSE : FD_WRITE | FD_CLOSE,
+ FD_READ | FD_CLOSE : FD_WRITE | FD_CLOSE,
INFINITE);
#endif
goto rloop;
@@ -376,7 +375,7 @@ wloop:
#ifdef WIN32
pgwin32_waitforsinglesocket(SSL_get_fd(port->ssl),
(err == SSL_ERROR_WANT_READ) ?
- FD_READ | FD_CLOSE : FD_WRITE | FD_CLOSE,
+ FD_READ | FD_CLOSE : FD_WRITE | FD_CLOSE,
INFINITE);
#endif
goto wloop;
@@ -811,9 +810,9 @@ initialize_SSL(void)
X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
#else
ereport(LOG,
- (errmsg("SSL certificate revocation list file \"%s\" ignored",
- ROOT_CRL_FILE),
- errdetail("SSL library does not support certificate revocation lists.")));
+ (errmsg("SSL certificate revocation list file \"%s\" ignored",
+ ROOT_CRL_FILE),
+ errdetail("SSL library does not support certificate revocation lists.")));
#endif
else
{
@@ -821,7 +820,7 @@ initialize_SSL(void)
ereport(LOG,
(errmsg("SSL certificate revocation list file \"%s\" not found, skipping: %s",
ROOT_CRL_FILE, SSLerrmessage()),
- errdetail("Certificates will not be checked against revocation list.")));
+ errdetail("Certificates will not be checked against revocation list.")));
}
}
@@ -889,7 +888,7 @@ aloop:
#ifdef WIN32
pgwin32_waitforsinglesocket(SSL_get_fd(port->ssl),
(err == SSL_ERROR_WANT_READ) ?
- FD_READ | FD_CLOSE | FD_ACCEPT : FD_WRITE | FD_CLOSE,
+ FD_READ | FD_CLOSE | FD_ACCEPT : FD_WRITE | FD_CLOSE,
INFINITE);
#endif
goto aloop;
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index c3cde8cb1b..e1be331b79 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.162 2007/07/23 10:16:53 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.163 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1595,7 +1595,7 @@ authident(hbaPort *port)
if (get_role_line(port->user_name) == NULL)
return STATUS_ERROR;
-
+
switch (port->raddr.addr.ss_family)
{
case AF_INET:
diff --git a/src/backend/libpq/ip.c b/src/backend/libpq/ip.c
index 2e9bd98890..69c4189e95 100644
--- a/src/backend/libpq/ip.c
+++ b/src/backend/libpq/ip.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.40 2007/02/10 14:58:54 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.41 2007/11/15 21:14:35 momjian Exp $
*
* This file and the IPV6 implementation were initially provided by
* Nigel Kukard <[email protected]>, Linux Based Systems Design
@@ -79,6 +79,7 @@ pg_getaddrinfo_all(const char *hostname, const char *servname,
servname, hintp, result);
#ifdef _AIX
+
/*
* It seems some versions of AIX's getaddrinfo don't reliably zero
* sin_port when servname is NULL, so clean up after it.
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index ae9d47076a..4ed6722557 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -30,7 +30,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.196 2007/09/14 15:58:02 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.197 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -183,11 +183,11 @@ pq_close(int code, Datum arg)
if (MyProcPort->gss->cred != GSS_C_NO_CREDENTIAL)
gss_release_cred(&min_s, &MyProcPort->gss->cred);
-#endif /* ENABLE_GSS */
+#endif /* ENABLE_GSS */
/* GSS and SSPI share the port->gss struct */
free(MyProcPort->gss);
-#endif /* ENABLE_GSS || ENABLE_SSPI */
+#endif /* ENABLE_GSS || ENABLE_SSPI */
/* Cleanly shut down SSL layer */
secure_close(MyProcPort);
@@ -255,6 +255,7 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
struct addrinfo hint;
int listen_index = 0;
int added = 0;
+
#if !defined(WIN32) || defined(IPV6_V6ONLY)
int one = 1;
#endif
@@ -356,14 +357,17 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
}
#ifndef WIN32
+
/*
- * Without the SO_REUSEADDR flag, a new postmaster can't be started right away after
- * a stop or crash, giving "address already in use" error on TCP ports.
+ * Without the SO_REUSEADDR flag, a new postmaster can't be started
+ * right away after a stop or crash, giving "address already in use"
+ * error on TCP ports.
*
- * On win32, however, this behavior only happens if the SO_EXLUSIVEADDRUSE is set.
- * With SO_REUSEADDR, win32 allows multiple servers to listen on the same address,
- * resulting in unpredictable behavior. With no flags at all, win32 behaves as
- * Unix with SO_REUSEADDR.
+ * On win32, however, this behavior only happens if the
+ * SO_EXLUSIVEADDRUSE is set. With SO_REUSEADDR, win32 allows multiple
+ * servers to listen on the same address, resulting in unpredictable
+ * behavior. With no flags at all, win32 behaves as Unix with
+ * SO_REUSEADDR.
*/
if (!IS_AF_UNIX(addr->ai_family))
{
@@ -577,6 +581,7 @@ StreamConnection(int server_fd, Port *port)
ereport(LOG,
(errcode_for_socket_access(),
errmsg("could not accept new connection: %m")));
+
/*
* If accept() fails then postmaster.c will still see the server
* socket as read-ready, and will immediately try again. To avoid
diff --git a/src/backend/libpq/pqformat.c b/src/backend/libpq/pqformat.c
index 606bb14a69..747e7b6163 100644
--- a/src/backend/libpq/pqformat.c
+++ b/src/backend/libpq/pqformat.c
@@ -24,7 +24,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.45 2007/04/06 05:36:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.46 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -318,7 +318,7 @@ pq_sendfloat8(StringInfo buf, float8 f)
appendBinaryStringInfo(buf, (char *) &swap.h[1], 4);
appendBinaryStringInfo(buf, (char *) &swap.h[0], 4);
#endif
-#else /* INT64 works */
+#else /* INT64 works */
union
{
float8 f;
@@ -552,7 +552,7 @@ pq_getmsgfloat8(StringInfo msg)
swap.h[0] = pq_getmsgint(msg, 4);
#endif
return swap.f;
-#else /* INT64 works */
+#else /* INT64 works */
union
{
float8 f;
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 65d42e9de5..0b61a7174b 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.108 2007/03/07 13:35:02 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.109 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,7 +177,7 @@ main(int argc, char *argv[])
#endif
if (argc > 1 && strcmp(argv[1], "--boot") == 0)
- AuxiliaryProcessMain(argc, argv); /* does not return */
+ AuxiliaryProcessMain(argc, argv); /* does not return */
if (argc > 1 && strcmp(argv[1], "--describe-config") == 0)
exit(GucInfoMain());
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index c6393effcd..d3396a8d0f 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.383 2007/10/11 18:05:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.384 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -68,9 +68,9 @@
* _copyPlannedStmt
*/
static PlannedStmt *
-_copyPlannedStmt(PlannedStmt *from)
+_copyPlannedStmt(PlannedStmt * from)
{
- PlannedStmt *newnode = makeNode(PlannedStmt);
+ PlannedStmt *newnode = makeNode(PlannedStmt);
COPY_SCALAR_FIELD(commandType);
COPY_SCALAR_FIELD(canSetTag);
@@ -727,9 +727,9 @@ _copyRangeVar(RangeVar *from)
* _copyIntoClause
*/
static IntoClause *
-_copyIntoClause(IntoClause *from)
+_copyIntoClause(IntoClause * from)
{
- IntoClause *newnode = makeNode(IntoClause);
+ IntoClause *newnode = makeNode(IntoClause);
COPY_NODE_FIELD(rel);
COPY_NODE_FIELD(colNames);
@@ -1026,9 +1026,9 @@ _copyRelabelType(RelabelType *from)
* _copyCoerceViaIO
*/
static CoerceViaIO *
-_copyCoerceViaIO(CoerceViaIO *from)
+_copyCoerceViaIO(CoerceViaIO * from)
{
- CoerceViaIO *newnode = makeNode(CoerceViaIO);
+ CoerceViaIO *newnode = makeNode(CoerceViaIO);
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(resulttype);
@@ -1041,9 +1041,9 @@ _copyCoerceViaIO(CoerceViaIO *from)
* _copyArrayCoerceExpr
*/
static ArrayCoerceExpr *
-_copyArrayCoerceExpr(ArrayCoerceExpr *from)
+_copyArrayCoerceExpr(ArrayCoerceExpr * from)
{
- ArrayCoerceExpr *newnode = makeNode(ArrayCoerceExpr);
+ ArrayCoerceExpr *newnode = makeNode(ArrayCoerceExpr);
COPY_NODE_FIELD(arg);
COPY_SCALAR_FIELD(elemfuncid);
@@ -1195,9 +1195,9 @@ _copyMinMaxExpr(MinMaxExpr *from)
* _copyXmlExpr
*/
static XmlExpr *
-_copyXmlExpr(XmlExpr *from)
+_copyXmlExpr(XmlExpr * from)
{
- XmlExpr *newnode = makeNode(XmlExpr);
+ XmlExpr *newnode = makeNode(XmlExpr);
COPY_SCALAR_FIELD(op);
COPY_STRING_FIELD(name);
@@ -1304,7 +1304,7 @@ _copySetToDefault(SetToDefault *from)
* _copyCurrentOfExpr
*/
static CurrentOfExpr *
-_copyCurrentOfExpr(CurrentOfExpr *from)
+_copyCurrentOfExpr(CurrentOfExpr * from)
{
CurrentOfExpr *newnode = makeNode(CurrentOfExpr);
@@ -1393,9 +1393,9 @@ _copyFromExpr(FromExpr *from)
* _copyPathKey
*/
static PathKey *
-_copyPathKey(PathKey *from)
+_copyPathKey(PathKey * from)
{
- PathKey *newnode = makeNode(PathKey);
+ PathKey *newnode = makeNode(PathKey);
/* EquivalenceClasses are never moved, so just shallow-copy the pointer */
COPY_SCALAR_FIELD(pk_eclass);
@@ -1833,7 +1833,7 @@ _copyLockingClause(LockingClause *from)
}
static XmlSerialize *
-_copyXmlSerialize(XmlSerialize *from)
+_copyXmlSerialize(XmlSerialize * from)
{
XmlSerialize *newnode = makeNode(XmlSerialize);
@@ -2271,7 +2271,7 @@ _copyRemoveOpClassStmt(RemoveOpClassStmt *from)
}
static RemoveOpFamilyStmt *
-_copyRemoveOpFamilyStmt(RemoveOpFamilyStmt *from)
+_copyRemoveOpFamilyStmt(RemoveOpFamilyStmt * from)
{
RemoveOpFamilyStmt *newnode = makeNode(RemoveOpFamilyStmt);
@@ -2398,7 +2398,7 @@ _copyCompositeTypeStmt(CompositeTypeStmt *from)
}
static CreateEnumStmt *
-_copyCreateEnumStmt(CreateEnumStmt *from)
+_copyCreateEnumStmt(CreateEnumStmt * from)
{
CreateEnumStmt *newnode = makeNode(CreateEnumStmt);
@@ -2475,7 +2475,7 @@ _copyCreateOpClassItem(CreateOpClassItem *from)
}
static CreateOpFamilyStmt *
-_copyCreateOpFamilyStmt(CreateOpFamilyStmt *from)
+_copyCreateOpFamilyStmt(CreateOpFamilyStmt * from)
{
CreateOpFamilyStmt *newnode = makeNode(CreateOpFamilyStmt);
@@ -2486,7 +2486,7 @@ _copyCreateOpFamilyStmt(CreateOpFamilyStmt *from)
}
static AlterOpFamilyStmt *
-_copyAlterOpFamilyStmt(AlterOpFamilyStmt *from)
+_copyAlterOpFamilyStmt(AlterOpFamilyStmt * from)
{
AlterOpFamilyStmt *newnode = makeNode(AlterOpFamilyStmt);
@@ -2616,7 +2616,7 @@ _copyVariableShowStmt(VariableShowStmt *from)
}
static DiscardStmt *
-_copyDiscardStmt(DiscardStmt *from)
+_copyDiscardStmt(DiscardStmt * from)
{
DiscardStmt *newnode = makeNode(DiscardStmt);
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index a12351ae28..0a832113b0 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.313 2007/09/03 18:46:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.314 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -103,7 +103,7 @@ _equalRangeVar(RangeVar *a, RangeVar *b)
}
static bool
-_equalIntoClause(IntoClause *a, IntoClause *b)
+_equalIntoClause(IntoClause * a, IntoClause * b)
{
COMPARE_NODE_FIELD(rel);
COMPARE_NODE_FIELD(colNames);
@@ -360,7 +360,7 @@ _equalRelabelType(RelabelType *a, RelabelType *b)
}
static bool
-_equalCoerceViaIO(CoerceViaIO *a, CoerceViaIO *b)
+_equalCoerceViaIO(CoerceViaIO * a, CoerceViaIO * b)
{
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(resulttype);
@@ -378,7 +378,7 @@ _equalCoerceViaIO(CoerceViaIO *a, CoerceViaIO *b)
}
static bool
-_equalArrayCoerceExpr(ArrayCoerceExpr *a, ArrayCoerceExpr *b)
+_equalArrayCoerceExpr(ArrayCoerceExpr * a, ArrayCoerceExpr * b)
{
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(elemfuncid);
@@ -506,7 +506,7 @@ _equalMinMaxExpr(MinMaxExpr *a, MinMaxExpr *b)
}
static bool
-_equalXmlExpr(XmlExpr *a, XmlExpr *b)
+_equalXmlExpr(XmlExpr * a, XmlExpr * b)
{
COMPARE_SCALAR_FIELD(op);
COMPARE_STRING_FIELD(name);
@@ -599,7 +599,7 @@ _equalSetToDefault(SetToDefault *a, SetToDefault *b)
}
static bool
-_equalCurrentOfExpr(CurrentOfExpr *a, CurrentOfExpr *b)
+_equalCurrentOfExpr(CurrentOfExpr * a, CurrentOfExpr * b)
{
COMPARE_SCALAR_FIELD(cvarno);
COMPARE_STRING_FIELD(cursor_name);
@@ -660,12 +660,12 @@ _equalFromExpr(FromExpr *a, FromExpr *b)
*/
static bool
-_equalPathKey(PathKey *a, PathKey *b)
+_equalPathKey(PathKey * a, PathKey * b)
{
/*
- * This is normally used on non-canonicalized PathKeys, so must chase
- * up to the topmost merged EquivalenceClass and see if those are the
- * same (by pointer equality).
+ * This is normally used on non-canonicalized PathKeys, so must chase up
+ * to the topmost merged EquivalenceClass and see if those are the same
+ * (by pointer equality).
*/
EquivalenceClass *a_eclass;
EquivalenceClass *b_eclass;
@@ -1112,7 +1112,7 @@ _equalRemoveOpClassStmt(RemoveOpClassStmt *a, RemoveOpClassStmt *b)
}
static bool
-_equalRemoveOpFamilyStmt(RemoveOpFamilyStmt *a, RemoveOpFamilyStmt *b)
+_equalRemoveOpFamilyStmt(RemoveOpFamilyStmt * a, RemoveOpFamilyStmt * b)
{
COMPARE_NODE_FIELD(opfamilyname);
COMPARE_STRING_FIELD(amname);
@@ -1219,7 +1219,7 @@ _equalCompositeTypeStmt(CompositeTypeStmt *a, CompositeTypeStmt *b)
}
static bool
-_equalCreateEnumStmt(CreateEnumStmt *a, CreateEnumStmt *b)
+_equalCreateEnumStmt(CreateEnumStmt * a, CreateEnumStmt * b)
{
COMPARE_NODE_FIELD(typename);
COMPARE_NODE_FIELD(vals);
@@ -1284,7 +1284,7 @@ _equalCreateOpClassItem(CreateOpClassItem *a, CreateOpClassItem *b)
}
static bool
-_equalCreateOpFamilyStmt(CreateOpFamilyStmt *a, CreateOpFamilyStmt *b)
+_equalCreateOpFamilyStmt(CreateOpFamilyStmt * a, CreateOpFamilyStmt * b)
{
COMPARE_NODE_FIELD(opfamilyname);
COMPARE_STRING_FIELD(amname);
@@ -1293,7 +1293,7 @@ _equalCreateOpFamilyStmt(CreateOpFamilyStmt *a, CreateOpFamilyStmt *b)
}
static bool
-_equalAlterOpFamilyStmt(AlterOpFamilyStmt *a, AlterOpFamilyStmt *b)
+_equalAlterOpFamilyStmt(AlterOpFamilyStmt * a, AlterOpFamilyStmt * b)
{
COMPARE_NODE_FIELD(opfamilyname);
COMPARE_STRING_FIELD(amname);
@@ -1401,7 +1401,7 @@ _equalVariableShowStmt(VariableShowStmt *a, VariableShowStmt *b)
}
static bool
-_equalDiscardStmt(DiscardStmt *a, DiscardStmt *b)
+_equalDiscardStmt(DiscardStmt * a, DiscardStmt * b)
{
COMPARE_SCALAR_FIELD(target);
@@ -1893,7 +1893,7 @@ _equalFkConstraint(FkConstraint *a, FkConstraint *b)
}
static bool
-_equalXmlSerialize(XmlSerialize *a, XmlSerialize *b)
+_equalXmlSerialize(XmlSerialize * a, XmlSerialize * b)
{
COMPARE_SCALAR_FIELD(xmloption);
COMPARE_NODE_FIELD(expr);
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index fc4f7d2dac..d97e56e4e4 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.316 2007/11/08 21:49:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.317 2007/11/15 21:14:35 momjian Exp $
*
* NOTES
* Every node type that can appear in stored rules' parsetrees *must*
@@ -235,7 +235,7 @@ _outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
*/
static void
-_outPlannedStmt(StringInfo str, PlannedStmt *node)
+_outPlannedStmt(StringInfo str, PlannedStmt * node)
{
WRITE_NODE_TYPE("PLANNEDSTMT");
@@ -656,7 +656,7 @@ _outRangeVar(StringInfo str, RangeVar *node)
}
static void
-_outIntoClause(StringInfo str, IntoClause *node)
+_outIntoClause(StringInfo str, IntoClause * node)
{
WRITE_NODE_TYPE("INTOCLAUSE");
@@ -872,7 +872,7 @@ _outRelabelType(StringInfo str, RelabelType *node)
}
static void
-_outCoerceViaIO(StringInfo str, CoerceViaIO *node)
+_outCoerceViaIO(StringInfo str, CoerceViaIO * node)
{
WRITE_NODE_TYPE("COERCEVIAIO");
@@ -882,7 +882,7 @@ _outCoerceViaIO(StringInfo str, CoerceViaIO *node)
}
static void
-_outArrayCoerceExpr(StringInfo str, ArrayCoerceExpr *node)
+_outArrayCoerceExpr(StringInfo str, ArrayCoerceExpr * node)
{
WRITE_NODE_TYPE("ARRAYCOERCEEXPR");
@@ -986,10 +986,10 @@ _outMinMaxExpr(StringInfo str, MinMaxExpr *node)
}
static void
-_outXmlExpr(StringInfo str, XmlExpr *node)
+_outXmlExpr(StringInfo str, XmlExpr * node)
{
WRITE_NODE_TYPE("XMLEXPR");
-
+
WRITE_ENUM_FIELD(op, XmlExprOp);
WRITE_STRING_FIELD(name);
WRITE_NODE_FIELD(named_args);
@@ -1060,7 +1060,7 @@ _outSetToDefault(StringInfo str, SetToDefault *node)
}
static void
-_outCurrentOfExpr(StringInfo str, CurrentOfExpr *node)
+_outCurrentOfExpr(StringInfo str, CurrentOfExpr * node)
{
WRITE_NODE_TYPE("CURRENTOFEXPR");
@@ -1291,7 +1291,7 @@ _outHashPath(StringInfo str, HashPath *node)
}
static void
-_outPlannerGlobal(StringInfo str, PlannerGlobal *node)
+_outPlannerGlobal(StringInfo str, PlannerGlobal * node)
{
WRITE_NODE_TYPE("PLANNERGLOBAL");
@@ -1385,7 +1385,7 @@ _outIndexOptInfo(StringInfo str, IndexOptInfo *node)
}
static void
-_outEquivalenceClass(StringInfo str, EquivalenceClass *node)
+_outEquivalenceClass(StringInfo str, EquivalenceClass * node)
{
/*
* To simplify reading, we just chase up to the topmost merged EC and
@@ -1409,7 +1409,7 @@ _outEquivalenceClass(StringInfo str, EquivalenceClass *node)
}
static void
-_outEquivalenceMember(StringInfo str, EquivalenceMember *node)
+_outEquivalenceMember(StringInfo str, EquivalenceMember * node)
{
WRITE_NODE_TYPE("EQUIVALENCEMEMBER");
@@ -1421,7 +1421,7 @@ _outEquivalenceMember(StringInfo str, EquivalenceMember *node)
}
static void
-_outPathKey(StringInfo str, PathKey *node)
+_outPathKey(StringInfo str, PathKey * node)
{
WRITE_NODE_TYPE("PATHKEY");
@@ -1627,7 +1627,7 @@ _outLockingClause(StringInfo str, LockingClause *node)
}
static void
-_outXmlSerialize(StringInfo str, XmlSerialize *node)
+_outXmlSerialize(StringInfo str, XmlSerialize * node)
{
WRITE_NODE_TYPE("XMLSERIALIZE");
diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c
index c6edfbed8a..a12b6d5d62 100644
--- a/src/backend/nodes/print.c
+++ b/src/backend/nodes/print.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.85 2007/02/22 22:00:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/print.c,v 1.86 2007/11/15 21:14:35 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -413,7 +413,7 @@ print_pathkeys(List *pathkeys, List *rtable)
printf("(");
foreach(i, pathkeys)
{
- PathKey *pathkey = (PathKey *) lfirst(i);
+ PathKey *pathkey = (PathKey *) lfirst(i);
EquivalenceClass *eclass;
ListCell *k;
bool first = true;
diff --git a/src/backend/optimizer/geqo/geqo_eval.c b/src/backend/optimizer/geqo/geqo_eval.c
index d528720c3e..957e86abe2 100644
--- a/src/backend/optimizer/geqo/geqo_eval.c
+++ b/src/backend/optimizer/geqo/geqo_eval.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.85 2007/02/16 00:14:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.86 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -254,8 +254,8 @@ desirable_join(PlannerInfo *root,
RelOptInfo *outer_rel, RelOptInfo *inner_rel)
{
/*
- * Join if there is an applicable join clause, or if there is a join
- * order restriction forcing these rels to be joined.
+ * Join if there is an applicable join clause, or if there is a join order
+ * restriction forcing these rels to be joined.
*/
if (have_relevant_joinclause(root, outer_rel, inner_rel) ||
have_join_order_restriction(root, outer_rel, inner_rel))
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index cc82380dc6..cc36a36964 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.165 2007/09/26 18:51:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.166 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,7 +43,7 @@ join_search_hook_type join_search_hook = NULL;
static void set_base_rel_pathlists(PlannerInfo *root);
static void set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
- Index rti, RangeTblEntry *rte);
+ Index rti, RangeTblEntry *rte);
static void set_plain_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
RangeTblEntry *rte);
static void set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
@@ -312,10 +312,10 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
/*
* We have to copy the parent's targetlist and quals to the child,
- * with appropriate substitution of variables. However, only the
+ * with appropriate substitution of variables. However, only the
* baserestrictinfo quals are needed before we can check for
- * constraint exclusion; so do that first and then check to see
- * if we can disregard this child.
+ * constraint exclusion; so do that first and then check to see if we
+ * can disregard this child.
*/
childrel->baserestrictinfo = (List *)
adjust_appendrel_attrs((Node *) rel->baserestrictinfo,
@@ -325,8 +325,8 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
{
/*
* This child need not be scanned, so we can omit it from the
- * appendrel. Mark it with a dummy cheapest-path though, in
- * case best_appendrel_indexscan() looks at it later.
+ * appendrel. Mark it with a dummy cheapest-path though, in case
+ * best_appendrel_indexscan() looks at it later.
*/
set_dummy_rel_pathlist(childrel);
continue;
@@ -709,7 +709,7 @@ make_rel_from_joinlist(PlannerInfo *root, List *joinlist)
* needed for these paths need have been instantiated.
*
* Note to plugin authors: the functions invoked during standard_join_search()
- * modify root->join_rel_list and root->join_rel_hash. If you want to do more
+ * modify root->join_rel_list and root->join_rel_hash. If you want to do more
* than one join-order search, you'll probably need to save and restore the
* original states of those data structures. See geqo_eval() for an example.
*/
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index c722070abc..52f6e14bda 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -54,7 +54,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.187 2007/10/24 18:37:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.188 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -112,12 +112,12 @@ typedef struct
{
PlannerInfo *root;
QualCost total;
-} cost_qual_eval_context;
+} cost_qual_eval_context;
static MergeScanSelCache *cached_scansel(PlannerInfo *root,
- RestrictInfo *rinfo,
- PathKey *pathkey);
-static bool cost_qual_eval_walker(Node *node, cost_qual_eval_context *context);
+ RestrictInfo *rinfo,
+ PathKey * pathkey);
+static bool cost_qual_eval_walker(Node *node, cost_qual_eval_context * context);
static Selectivity approx_selectivity(PlannerInfo *root, List *quals,
JoinType jointype);
static Selectivity join_in_selectivity(JoinPath *path, PlannerInfo *root);
@@ -303,15 +303,14 @@ cost_index(IndexPath *path, PlannerInfo *root,
max_IO_cost = (pages_fetched * random_page_cost) / num_scans;
/*
- * In the perfectly correlated case, the number of pages touched
- * by each scan is selectivity * table_size, and we can use the
- * Mackert and Lohman formula at the page level to estimate how
- * much work is saved by caching across scans. We still assume
- * all the fetches are random, though, which is an overestimate
- * that's hard to correct for without double-counting the cache
- * effects. (But in most cases where such a plan is actually
- * interesting, only one page would get fetched per scan anyway,
- * so it shouldn't matter much.)
+ * In the perfectly correlated case, the number of pages touched by
+ * each scan is selectivity * table_size, and we can use the Mackert
+ * and Lohman formula at the page level to estimate how much work is
+ * saved by caching across scans. We still assume all the fetches are
+ * random, though, which is an overestimate that's hard to correct for
+ * without double-counting the cache effects. (But in most cases
+ * where such a plan is actually interesting, only one page would get
+ * fetched per scan anyway, so it shouldn't matter much.)
*/
pages_fetched = ceil(indexSelectivity * (double) baserel->pages);
@@ -344,8 +343,8 @@ cost_index(IndexPath *path, PlannerInfo *root,
}
/*
- * Now interpolate based on estimated index order correlation to get
- * total disk I/O cost for main table accesses.
+ * Now interpolate based on estimated index order correlation to get total
+ * disk I/O cost for main table accesses.
*/
csquared = indexCorrelation * indexCorrelation;
@@ -643,11 +642,12 @@ cost_bitmap_tree_node(Path *path, Cost *cost, Selectivity *selec)
{
*cost = ((IndexPath *) path)->indextotalcost;
*selec = ((IndexPath *) path)->indexselectivity;
+
/*
* Charge a small amount per retrieved tuple to reflect the costs of
* manipulating the bitmap. This is mostly to make sure that a bitmap
- * scan doesn't look to be the same cost as an indexscan to retrieve
- * a single tuple.
+ * scan doesn't look to be the same cost as an indexscan to retrieve a
+ * single tuple.
*/
*cost += 0.1 * cpu_operator_cost * ((IndexPath *) path)->rows;
}
@@ -806,7 +806,7 @@ cost_tidscan(Path *path, PlannerInfo *root,
/*
* We must force TID scan for WHERE CURRENT OF, because only nodeTidscan.c
- * understands how to do it correctly. Therefore, honor enable_tidscan
+ * understands how to do it correctly. Therefore, honor enable_tidscan
* only when CURRENT OF isn't present. Also note that cost_qual_eval
* counts a CurrentOfExpr as having startup cost disable_cost, which we
* subtract off here; that's to prevent other plan types such as seqscan
@@ -1043,10 +1043,10 @@ cost_sort(Path *path, PlannerInfo *root,
else if (tuples > 2 * output_tuples || input_bytes > work_mem_bytes)
{
/*
- * We'll use a bounded heap-sort keeping just K tuples in memory,
- * for a total number of tuple comparisons of N log2 K; but the
- * constant factor is a bit higher than for quicksort. Tweak it
- * so that the cost curve is continuous at the crossover point.
+ * We'll use a bounded heap-sort keeping just K tuples in memory, for
+ * a total number of tuple comparisons of N log2 K; but the constant
+ * factor is a bit higher than for quicksort. Tweak it so that the
+ * cost curve is continuous at the crossover point.
*/
startup_cost += 2.0 * cpu_operator_cost * tuples * LOG2(2.0 * output_tuples);
}
@@ -1454,8 +1454,8 @@ cost_mergejoin(MergePath *path, PlannerInfo *root)
RestrictInfo *firstclause = (RestrictInfo *) linitial(mergeclauses);
List *opathkeys;
List *ipathkeys;
- PathKey *opathkey;
- PathKey *ipathkey;
+ PathKey *opathkey;
+ PathKey *ipathkey;
MergeScanSelCache *cache;
/* Get the input pathkeys to determine the sort-order details */
@@ -1593,7 +1593,7 @@ cost_mergejoin(MergePath *path, PlannerInfo *root)
* run mergejoinscansel() with caching
*/
static MergeScanSelCache *
-cached_scansel(PlannerInfo *root, RestrictInfo *rinfo, PathKey *pathkey)
+cached_scansel(PlannerInfo *root, RestrictInfo *rinfo, PathKey * pathkey)
{
MergeScanSelCache *cache;
ListCell *lc;
@@ -1787,8 +1787,8 @@ cost_hashjoin(HashPath *path, PlannerInfo *root)
* If inner relation is too big then we will need to "batch" the join,
* which implies writing and reading most of the tuples to disk an extra
* time. Charge seq_page_cost per page, since the I/O should be nice and
- * sequential. Writing the inner rel counts as startup cost,
- * all the rest as run cost.
+ * sequential. Writing the inner rel counts as startup cost, all the rest
+ * as run cost.
*/
if (numbatches > 1)
{
@@ -1891,16 +1891,16 @@ cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root)
}
static bool
-cost_qual_eval_walker(Node *node, cost_qual_eval_context *context)
+cost_qual_eval_walker(Node *node, cost_qual_eval_context * context)
{
if (node == NULL)
return false;
/*
* RestrictInfo nodes contain an eval_cost field reserved for this
- * routine's use, so that it's not necessary to evaluate the qual
- * clause's cost more than once. If the clause's cost hasn't been
- * computed yet, the field's startup value will contain -1.
+ * routine's use, so that it's not necessary to evaluate the qual clause's
+ * cost more than once. If the clause's cost hasn't been computed yet,
+ * the field's startup value will contain -1.
*/
if (IsA(node, RestrictInfo))
{
@@ -1913,14 +1913,16 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context)
locContext.root = context->root;
locContext.total.startup = 0;
locContext.total.per_tuple = 0;
+
/*
- * For an OR clause, recurse into the marked-up tree so that
- * we set the eval_cost for contained RestrictInfos too.
+ * For an OR clause, recurse into the marked-up tree so that we
+ * set the eval_cost for contained RestrictInfos too.
*/
if (rinfo->orclause)
cost_qual_eval_walker((Node *) rinfo->orclause, &locContext);
else
cost_qual_eval_walker((Node *) rinfo->clause, &locContext);
+
/*
* If the RestrictInfo is marked pseudoconstant, it will be tested
* only once, so treat its cost as all startup cost.
@@ -1941,8 +1943,8 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context)
/*
* For each operator or function node in the given tree, we charge the
- * estimated execution cost given by pg_proc.procost (remember to
- * multiply this by cpu_operator_cost).
+ * estimated execution cost given by pg_proc.procost (remember to multiply
+ * this by cpu_operator_cost).
*
* Vars and Consts are charged zero, and so are boolean operators (AND,
* OR, NOT). Simplistic, but a lot better than no model at all.
@@ -1951,7 +1953,7 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context)
* evaluation of AND/OR? Probably *not*, because that would make the
* results depend on the clause ordering, and we are not in any position
* to expect that the current ordering of the clauses is the one that's
- * going to end up being used. (Is it worth applying order_qual_clauses
+ * going to end up being used. (Is it worth applying order_qual_clauses
* much earlier in the planning process to fix this?)
*/
if (IsA(node, FuncExpr))
@@ -1984,9 +1986,9 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context)
else if (IsA(node, CoerceViaIO))
{
CoerceViaIO *iocoerce = (CoerceViaIO *) node;
- Oid iofunc;
- Oid typioparam;
- bool typisvarlena;
+ Oid iofunc;
+ Oid typioparam;
+ bool typisvarlena;
/* check the result type's input function */
getTypeInputInfo(iocoerce->resulttype,
@@ -2014,7 +2016,7 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context)
foreach(lc, rcexpr->opnos)
{
- Oid opid = lfirst_oid(lc);
+ Oid opid = lfirst_oid(lc);
context->total.per_tuple += get_func_cost(get_opcode(opid)) *
cpu_operator_cost;
@@ -2069,7 +2071,7 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context)
{
/*
* Otherwise we will be rescanning the subplan output on each
- * evaluation. We need to estimate how much of the output we will
+ * evaluation. We need to estimate how much of the output we will
* actually need to scan. NOTE: this logic should agree with
* get_initplan_cost, below, and with the estimates used by
* make_subplan() in plan/subselect.c.
@@ -2266,9 +2268,9 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
* double-counting them because they were not considered in estimating the
* sizes of the component rels.
*
- * For an outer join, we have to distinguish the selectivity of the
- * join's own clauses (JOIN/ON conditions) from any clauses that were
- * "pushed down". For inner joins we just count them all as joinclauses.
+ * For an outer join, we have to distinguish the selectivity of the join's
+ * own clauses (JOIN/ON conditions) from any clauses that were "pushed
+ * down". For inner joins we just count them all as joinclauses.
*/
if (IS_OUTER_JOIN(jointype))
{
@@ -2316,7 +2318,7 @@ set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel,
*
* If we are doing an outer join, take that into account: the joinqual
* selectivity has to be clamped using the knowledge that the output must
- * be at least as large as the non-nullable input. However, any
+ * be at least as large as the non-nullable input. However, any
* pushed-down quals are applied after the outer join, so their
* selectivity applies fully.
*
@@ -2515,7 +2517,7 @@ set_rel_width(PlannerInfo *root, RelOptInfo *rel)
if (rel->relid > 0)
rel_reloid = getrelid(rel->relid, root->parse->rtable);
else
- rel_reloid = InvalidOid; /* probably can't happen */
+ rel_reloid = InvalidOid; /* probably can't happen */
foreach(tllist, rel->reltargetlist)
{
diff --git a/src/backend/optimizer/path/equivclass.c b/src/backend/optimizer/path/equivclass.c
index 18c6ff9368..67204728a5 100644
--- a/src/backend/optimizer/path/equivclass.c
+++ b/src/backend/optimizer/path/equivclass.c
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/equivclass.c,v 1.4 2007/11/08 21:49:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/equivclass.c,v 1.5 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,37 +26,37 @@
#include "utils/lsyscache.h"
-static EquivalenceMember *add_eq_member(EquivalenceClass *ec,
- Expr *expr, Relids relids,
- bool is_child, Oid datatype);
+static EquivalenceMember *add_eq_member(EquivalenceClass * ec,
+ Expr *expr, Relids relids,
+ bool is_child, Oid datatype);
static void generate_base_implied_equalities_const(PlannerInfo *root,
- EquivalenceClass *ec);
+ EquivalenceClass * ec);
static void generate_base_implied_equalities_no_const(PlannerInfo *root,
- EquivalenceClass *ec);
+ EquivalenceClass * ec);
static void generate_base_implied_equalities_broken(PlannerInfo *root,
- EquivalenceClass *ec);
+ EquivalenceClass * ec);
static List *generate_join_implied_equalities_normal(PlannerInfo *root,
- EquivalenceClass *ec,
+ EquivalenceClass * ec,
RelOptInfo *joinrel,
RelOptInfo *outer_rel,
RelOptInfo *inner_rel);
static List *generate_join_implied_equalities_broken(PlannerInfo *root,
- EquivalenceClass *ec,
+ EquivalenceClass * ec,
RelOptInfo *joinrel,
RelOptInfo *outer_rel,
RelOptInfo *inner_rel);
-static Oid select_equality_operator(EquivalenceClass *ec,
- Oid lefttype, Oid righttype);
+static Oid select_equality_operator(EquivalenceClass * ec,
+ Oid lefttype, Oid righttype);
static RestrictInfo *create_join_clause(PlannerInfo *root,
- EquivalenceClass *ec, Oid opno,
- EquivalenceMember *leftem,
- EquivalenceMember *rightem,
- EquivalenceClass *parent_ec);
+ EquivalenceClass * ec, Oid opno,
+ EquivalenceMember * leftem,
+ EquivalenceMember * rightem,
+ EquivalenceClass * parent_ec);
static void reconsider_outer_join_clause(PlannerInfo *root,
- RestrictInfo *rinfo,
- bool outer_on_left);
+ RestrictInfo *rinfo,
+ bool outer_on_left);
static void reconsider_full_join_clause(PlannerInfo *root,
- RestrictInfo *rinfo);
+ RestrictInfo *rinfo);
/*
@@ -70,7 +70,7 @@ static void reconsider_full_join_clause(PlannerInfo *root,
*
* If below_outer_join is true, then the clause was found below the nullable
* side of an outer join, so its sides might validly be both NULL rather than
- * strictly equal. We can still deduce equalities in such cases, but we take
+ * strictly equal. We can still deduce equalities in such cases, but we take
* care to mark an EquivalenceClass if it came from any such clauses. Also,
* we have to check that both sides are either pseudo-constants or strict
* functions of Vars, else they might not both go to NULL above the outer
@@ -127,37 +127,37 @@ process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo,
}
/*
- * We use the declared input types of the operator, not exprType() of
- * the inputs, as the nominal datatypes for opfamily lookup. This
- * presumes that btree operators are always registered with amoplefttype
- * and amoprighttype equal to their declared input types. We will need
- * this info anyway to build EquivalenceMember nodes, and by extracting
- * it now we can use type comparisons to short-circuit some equal() tests.
+ * We use the declared input types of the operator, not exprType() of the
+ * inputs, as the nominal datatypes for opfamily lookup. This presumes
+ * that btree operators are always registered with amoplefttype and
+ * amoprighttype equal to their declared input types. We will need this
+ * info anyway to build EquivalenceMember nodes, and by extracting it now
+ * we can use type comparisons to short-circuit some equal() tests.
*/
op_input_types(opno, &item1_type, &item2_type);
opfamilies = restrictinfo->mergeopfamilies;
/*
- * Sweep through the existing EquivalenceClasses looking for matches
- * to item1 and item2. These are the possible outcomes:
+ * Sweep through the existing EquivalenceClasses looking for matches to
+ * item1 and item2. These are the possible outcomes:
*
- * 1. We find both in the same EC. The equivalence is already known,
- * so there's nothing to do.
+ * 1. We find both in the same EC. The equivalence is already known, so
+ * there's nothing to do.
*
* 2. We find both in different ECs. Merge the two ECs together.
*
* 3. We find just one. Add the other to its EC.
*
- * 4. We find neither. Make a new, two-entry EC.
+ * 4. We find neither. Make a new, two-entry EC.
*
* Note: since all ECs are built through this process, it's impossible
* that we'd match an item in more than one existing EC. It is possible
* to match more than once within an EC, if someone fed us something silly
* like "WHERE X=X". (However, we can't simply discard such clauses,
- * since they should fail when X is null; so we will build a 2-member
- * EC to ensure the correct restriction clause gets generated. Hence
- * there is no shortcut here for item1 and item2 equal.)
+ * since they should fail when X is null; so we will build a 2-member EC
+ * to ensure the correct restriction clause gets generated. Hence there
+ * is no shortcut here for item1 and item2 equal.)
*/
ec1 = ec2 = NULL;
em1 = em2 = NULL;
@@ -182,11 +182,11 @@ process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo,
{
EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc2);
- Assert(!cur_em->em_is_child); /* no children yet */
+ Assert(!cur_em->em_is_child); /* no children yet */
/*
- * If below an outer join, don't match constants: they're not
- * as constant as they look.
+ * If below an outer join, don't match constants: they're not as
+ * constant as they look.
*/
if ((below_outer_join || cur_ec->ec_below_outer_join) &&
cur_em->em_is_const)
@@ -234,11 +234,11 @@ process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo,
}
/*
- * Case 2: need to merge ec1 and ec2. We add ec2's items to ec1,
- * then set ec2's ec_merged link to point to ec1 and remove ec2
- * from the eq_classes list. We cannot simply delete ec2 because
- * that could leave dangling pointers in existing PathKeys. We
- * leave it behind with a link so that the merged EC can be found.
+ * Case 2: need to merge ec1 and ec2. We add ec2's items to ec1, then
+ * set ec2's ec_merged link to point to ec1 and remove ec2 from the
+ * eq_classes list. We cannot simply delete ec2 because that could
+ * leave dangling pointers in existing PathKeys. We leave it behind
+ * with a link so that the merged EC can be found.
*/
ec1->ec_members = list_concat(ec1->ec_members, ec2->ec_members);
ec1->ec_sources = list_concat(ec1->ec_sources, ec2->ec_sources);
@@ -313,7 +313,7 @@ process_equivalence(PlannerInfo *root, RestrictInfo *restrictinfo,
* add_eq_member - build a new EquivalenceMember and add it to an EC
*/
static EquivalenceMember *
-add_eq_member(EquivalenceClass *ec, Expr *expr, Relids relids,
+add_eq_member(EquivalenceClass * ec, Expr *expr, Relids relids,
bool is_child, Oid datatype)
{
EquivalenceMember *em = makeNode(EquivalenceMember);
@@ -327,10 +327,10 @@ add_eq_member(EquivalenceClass *ec, Expr *expr, Relids relids,
if (bms_is_empty(relids))
{
/*
- * No Vars, assume it's a pseudoconstant. This is correct for
- * entries generated from process_equivalence(), because a WHERE
- * clause can't contain aggregates or SRFs, and non-volatility was
- * checked before process_equivalence() ever got called. But
+ * No Vars, assume it's a pseudoconstant. This is correct for entries
+ * generated from process_equivalence(), because a WHERE clause can't
+ * contain aggregates or SRFs, and non-volatility was checked before
+ * process_equivalence() ever got called. But
* get_eclass_for_sort_expr() has to work harder. We put the tests
* there not here to save cycles in the equivalence case.
*/
@@ -399,8 +399,8 @@ get_eclass_for_sort_expr(PlannerInfo *root,
EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc2);
/*
- * If below an outer join, don't match constants: they're not
- * as constant as they look.
+ * If below an outer join, don't match constants: they're not as
+ * constant as they look.
*/
if (cur_ec->ec_below_outer_join &&
cur_em->em_is_const)
@@ -408,15 +408,15 @@ get_eclass_for_sort_expr(PlannerInfo *root,
if (expr_datatype == cur_em->em_datatype &&
equal(expr, cur_em->em_expr))
- return cur_ec; /* Match! */
+ return cur_ec; /* Match! */
}
}
/*
* No match, so build a new single-member EC
*
- * Here, we must be sure that we construct the EC in the right context.
- * We can assume, however, that the passed expr is long-lived.
+ * Here, we must be sure that we construct the EC in the right context. We
+ * can assume, however, that the passed expr is long-lived.
*/
oldcontext = MemoryContextSwitchTo(root->planner_cxt);
@@ -437,8 +437,8 @@ get_eclass_for_sort_expr(PlannerInfo *root,
/*
* add_eq_member doesn't check for volatile functions, set-returning
- * functions, or aggregates, but such could appear in sort expressions;
- * so we have to check whether its const-marking was correct.
+ * functions, or aggregates, but such could appear in sort expressions; so
+ * we have to check whether its const-marking was correct.
*/
if (newec->ec_has_const)
{
@@ -466,7 +466,7 @@ get_eclass_for_sort_expr(PlannerInfo *root,
*
* When an EC contains pseudoconstants, our strategy is to generate
* "member = const1" clauses where const1 is the first constant member, for
- * every other member (including other constants). If we are able to do this
+ * every other member (including other constants). If we are able to do this
* then we don't need any "var = var" comparisons because we've successfully
* constrained all the vars at their points of creation. If we fail to
* generate any of these clauses due to lack of cross-type operators, we fall
@@ -491,7 +491,7 @@ get_eclass_for_sort_expr(PlannerInfo *root,
* "WHERE a.x = b.y AND b.y = a.z", the scheme breaks down if we cannot
* generate "a.x = a.z" as a restriction clause for A.) In this case we mark
* the EC "ec_broken" and fall back to regurgitating its original source
- * RestrictInfos at appropriate times. We do not try to retract any derived
+ * RestrictInfos at appropriate times. We do not try to retract any derived
* clauses already generated from the broken EC, so the resulting plan could
* be poor due to bad selectivity estimates caused by redundant clauses. But
* the correct solution to that is to fix the opfamilies ...
@@ -517,8 +517,8 @@ generate_base_implied_equalities(PlannerInfo *root)
{
EquivalenceClass *ec = (EquivalenceClass *) lfirst(lc);
- Assert(ec->ec_merged == NULL); /* else shouldn't be in list */
- Assert(!ec->ec_broken); /* not yet anyway... */
+ Assert(ec->ec_merged == NULL); /* else shouldn't be in list */
+ Assert(!ec->ec_broken); /* not yet anyway... */
/* Single-member ECs won't generate any deductions */
if (list_length(ec->ec_members) <= 1)
@@ -535,9 +535,8 @@ generate_base_implied_equalities(PlannerInfo *root)
}
/*
- * This is also a handy place to mark base rels (which should all
- * exist by now) with flags showing whether they have pending eclass
- * joins.
+ * This is also a handy place to mark base rels (which should all exist by
+ * now) with flags showing whether they have pending eclass joins.
*/
for (rti = 1; rti < root->simple_rel_array_size; rti++)
{
@@ -555,7 +554,7 @@ generate_base_implied_equalities(PlannerInfo *root)
*/
static void
generate_base_implied_equalities_const(PlannerInfo *root,
- EquivalenceClass *ec)
+ EquivalenceClass * ec)
{
EquivalenceMember *const_em = NULL;
ListCell *lc;
@@ -579,7 +578,7 @@ generate_base_implied_equalities_const(PlannerInfo *root,
EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc);
Oid eq_op;
- Assert(!cur_em->em_is_child); /* no children yet */
+ Assert(!cur_em->em_is_child); /* no children yet */
if (cur_em == const_em)
continue;
eq_op = select_equality_operator(ec,
@@ -604,7 +603,7 @@ generate_base_implied_equalities_const(PlannerInfo *root,
*/
static void
generate_base_implied_equalities_no_const(PlannerInfo *root,
- EquivalenceClass *ec)
+ EquivalenceClass * ec)
{
EquivalenceMember **prev_ems;
ListCell *lc;
@@ -613,9 +612,10 @@ generate_base_implied_equalities_no_const(PlannerInfo *root,
* We scan the EC members once and track the last-seen member for each
* base relation. When we see another member of the same base relation,
* we generate "prev_mem = cur_mem". This results in the minimum number
- * of derived clauses, but it's possible that it will fail when a different
- * ordering would succeed. XXX FIXME: use a UNION-FIND algorithm similar
- * to the way we build merged ECs. (Use a list-of-lists for each rel.)
+ * of derived clauses, but it's possible that it will fail when a
+ * different ordering would succeed. XXX FIXME: use a UNION-FIND
+ * algorithm similar to the way we build merged ECs. (Use a list-of-lists
+ * for each rel.)
*/
prev_ems = (EquivalenceMember **)
palloc0(root->simple_rel_array_size * sizeof(EquivalenceMember *));
@@ -625,7 +625,7 @@ generate_base_implied_equalities_no_const(PlannerInfo *root,
EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc);
int relid;
- Assert(!cur_em->em_is_child); /* no children yet */
+ Assert(!cur_em->em_is_child); /* no children yet */
if (bms_membership(cur_em->em_relids) != BMS_SINGLETON)
continue;
relid = bms_singleton_member(cur_em->em_relids);
@@ -657,12 +657,12 @@ generate_base_implied_equalities_no_const(PlannerInfo *root,
pfree(prev_ems);
/*
- * We also have to make sure that all the Vars used in the member
- * clauses will be available at any join node we might try to reference
- * them at. For the moment we force all the Vars to be available at
- * all join nodes for this eclass. Perhaps this could be improved by
- * doing some pre-analysis of which members we prefer to join, but it's
- * no worse than what happened in the pre-8.3 code.
+ * We also have to make sure that all the Vars used in the member clauses
+ * will be available at any join node we might try to reference them at.
+ * For the moment we force all the Vars to be available at all join nodes
+ * for this eclass. Perhaps this could be improved by doing some
+ * pre-analysis of which members we prefer to join, but it's no worse than
+ * what happened in the pre-8.3 code.
*/
foreach(lc, ec->ec_members)
{
@@ -685,7 +685,7 @@ generate_base_implied_equalities_no_const(PlannerInfo *root,
*/
static void
generate_base_implied_equalities_broken(PlannerInfo *root,
- EquivalenceClass *ec)
+ EquivalenceClass * ec)
{
ListCell *lc;
@@ -720,7 +720,7 @@ generate_base_implied_equalities_broken(PlannerInfo *root,
* we consider different join paths, we avoid generating multiple copies:
* whenever we select a particular pair of EquivalenceMembers to join,
* we check to see if the pair matches any original clause (in ec_sources)
- * or previously-built clause (in ec_derives). This saves memory and allows
+ * or previously-built clause (in ec_derives). This saves memory and allows
* re-use of information cached in RestrictInfos.
*/
List *
@@ -735,7 +735,7 @@ generate_join_implied_equalities(PlannerInfo *root,
foreach(lc, root->eq_classes)
{
EquivalenceClass *ec = (EquivalenceClass *) lfirst(lc);
- List *sublist = NIL;
+ List *sublist = NIL;
/* ECs containing consts do not need any further enforcement */
if (ec->ec_has_const)
@@ -775,7 +775,7 @@ generate_join_implied_equalities(PlannerInfo *root,
*/
static List *
generate_join_implied_equalities_normal(PlannerInfo *root,
- EquivalenceClass *ec,
+ EquivalenceClass * ec,
RelOptInfo *joinrel,
RelOptInfo *outer_rel,
RelOptInfo *inner_rel)
@@ -787,13 +787,13 @@ generate_join_implied_equalities_normal(PlannerInfo *root,
ListCell *lc1;
/*
- * First, scan the EC to identify member values that are computable
- * at the outer rel, at the inner rel, or at this relation but not in
- * either input rel. The outer-rel members should already be enforced
- * equal, likewise for the inner-rel members. We'll need to create
- * clauses to enforce that any newly computable members are all equal
- * to each other as well as to at least one input member, plus enforce
- * at least one outer-rel member equal to at least one inner-rel member.
+ * First, scan the EC to identify member values that are computable at the
+ * outer rel, at the inner rel, or at this relation but not in either
+ * input rel. The outer-rel members should already be enforced equal,
+ * likewise for the inner-rel members. We'll need to create clauses to
+ * enforce that any newly computable members are all equal to each other
+ * as well as to at least one input member, plus enforce at least one
+ * outer-rel member equal to at least one inner-rel member.
*/
foreach(lc1, ec->ec_members)
{
@@ -813,20 +813,20 @@ generate_join_implied_equalities_normal(PlannerInfo *root,
}
/*
- * First, select the joinclause if needed. We can equate any one outer
+ * First, select the joinclause if needed. We can equate any one outer
* member to any one inner member, but we have to find a datatype
- * combination for which an opfamily member operator exists. If we
- * have choices, we prefer simple Var members (possibly with RelabelType)
- * since these are (a) cheapest to compute at runtime and (b) most likely
- * to have useful statistics. Also, if enable_hashjoin is on, we prefer
+ * combination for which an opfamily member operator exists. If we have
+ * choices, we prefer simple Var members (possibly with RelabelType) since
+ * these are (a) cheapest to compute at runtime and (b) most likely to
+ * have useful statistics. Also, if enable_hashjoin is on, we prefer
* operators that are also hashjoinable.
*/
if (outer_members && inner_members)
{
EquivalenceMember *best_outer_em = NULL;
EquivalenceMember *best_inner_em = NULL;
- Oid best_eq_op = InvalidOid;
- int best_score = -1;
+ Oid best_eq_op = InvalidOid;
+ int best_score = -1;
RestrictInfo *rinfo;
foreach(lc1, outer_members)
@@ -837,8 +837,8 @@ generate_join_implied_equalities_normal(PlannerInfo *root,
foreach(lc2, inner_members)
{
EquivalenceMember *inner_em = (EquivalenceMember *) lfirst(lc2);
- Oid eq_op;
- int score;
+ Oid eq_op;
+ int score;
eq_op = select_equality_operator(ec,
outer_em->em_datatype,
@@ -863,11 +863,11 @@ generate_join_implied_equalities_normal(PlannerInfo *root,
best_eq_op = eq_op;
best_score = score;
if (best_score == 3)
- break; /* no need to look further */
+ break; /* no need to look further */
}
}
if (best_score == 3)
- break; /* no need to look further */
+ break; /* no need to look further */
}
if (best_score < 0)
{
@@ -892,8 +892,8 @@ generate_join_implied_equalities_normal(PlannerInfo *root,
* Vars from both sides of the join. We have to equate all of these to
* each other as well as to at least one old member (if any).
*
- * XXX as in generate_base_implied_equalities_no_const, we could be a
- * lot smarter here to avoid unnecessary failures in cross-type situations.
+ * XXX as in generate_base_implied_equalities_no_const, we could be a lot
+ * smarter here to avoid unnecessary failures in cross-type situations.
* For now, use the same left-to-right method used there.
*/
if (new_members)
@@ -944,7 +944,7 @@ generate_join_implied_equalities_normal(PlannerInfo *root,
*/
static List *
generate_join_implied_equalities_broken(PlannerInfo *root,
- EquivalenceClass *ec,
+ EquivalenceClass * ec,
RelOptInfo *joinrel,
RelOptInfo *outer_rel,
RelOptInfo *inner_rel)
@@ -957,7 +957,7 @@ generate_join_implied_equalities_broken(PlannerInfo *root,
RestrictInfo *restrictinfo = (RestrictInfo *) lfirst(lc);
if (bms_is_subset(restrictinfo->required_relids, joinrel->relids) &&
- !bms_is_subset(restrictinfo->required_relids, outer_rel->relids) &&
+ !bms_is_subset(restrictinfo->required_relids, outer_rel->relids) &&
!bms_is_subset(restrictinfo->required_relids, inner_rel->relids))
result = lappend(result, restrictinfo);
}
@@ -973,14 +973,14 @@ generate_join_implied_equalities_broken(PlannerInfo *root,
* Returns InvalidOid if no operator can be found for this datatype combination
*/
static Oid
-select_equality_operator(EquivalenceClass *ec, Oid lefttype, Oid righttype)
+select_equality_operator(EquivalenceClass * ec, Oid lefttype, Oid righttype)
{
ListCell *lc;
foreach(lc, ec->ec_opfamilies)
{
- Oid opfamily = lfirst_oid(lc);
- Oid opno;
+ Oid opfamily = lfirst_oid(lc);
+ Oid opno;
opno = get_opfamily_member(opfamily, lefttype, righttype,
BTEqualStrategyNumber);
@@ -1003,10 +1003,10 @@ select_equality_operator(EquivalenceClass *ec, Oid lefttype, Oid righttype)
*/
static RestrictInfo *
create_join_clause(PlannerInfo *root,
- EquivalenceClass *ec, Oid opno,
- EquivalenceMember *leftem,
- EquivalenceMember *rightem,
- EquivalenceClass *parent_ec)
+ EquivalenceClass * ec, Oid opno,
+ EquivalenceMember * leftem,
+ EquivalenceMember * rightem,
+ EquivalenceClass * parent_ec)
{
RestrictInfo *rinfo;
ListCell *lc;
@@ -1014,8 +1014,8 @@ create_join_clause(PlannerInfo *root,
/*
* Search to see if we already built a RestrictInfo for this pair of
- * EquivalenceMembers. We can use either original source clauses or
- * previously-derived clauses. The check on opno is probably redundant,
+ * EquivalenceMembers. We can use either original source clauses or
+ * previously-derived clauses. The check on opno is probably redundant,
* but be safe ...
*/
foreach(lc, ec->ec_sources)
@@ -1039,8 +1039,8 @@ create_join_clause(PlannerInfo *root,
}
/*
- * Not there, so build it, in planner context so we can re-use it.
- * (Not important in normal planning, but definitely so in GEQO.)
+ * Not there, so build it, in planner context so we can re-use it. (Not
+ * important in normal planning, but definitely so in GEQO.)
*/
oldcontext = MemoryContextSwitchTo(root->planner_cxt);
@@ -1216,10 +1216,9 @@ reconsider_outer_join_clause(PlannerInfo *root, RestrictInfo *rinfo,
continue; /* no match, so ignore this EC */
/*
- * Yes it does! Try to generate a clause INNERVAR = CONSTANT for
- * each CONSTANT in the EC. Note that we must succeed with at
- * least one constant before we can decide to throw away the
- * outer-join clause.
+ * Yes it does! Try to generate a clause INNERVAR = CONSTANT for each
+ * CONSTANT in the EC. Note that we must succeed with at least one
+ * constant before we can decide to throw away the outer-join clause.
*/
match = false;
foreach(lc2, cur_ec->ec_members)
@@ -1300,15 +1299,15 @@ reconsider_full_join_clause(PlannerInfo *root, RestrictInfo *rinfo)
/*
* Does it contain a COALESCE(leftvar, rightvar) construct?
*
- * We can assume the COALESCE() inputs are in the same order as
- * the join clause, since both were automatically generated in the
- * cases we care about.
+ * We can assume the COALESCE() inputs are in the same order as the
+ * join clause, since both were automatically generated in the cases
+ * we care about.
*
- * XXX currently this may fail to match in cross-type cases
- * because the COALESCE will contain typecast operations while the
- * join clause may not (if there is a cross-type mergejoin
- * operator available for the two column types). Is it OK to strip
- * implicit coercions from the COALESCE arguments?
+ * XXX currently this may fail to match in cross-type cases because
+ * the COALESCE will contain typecast operations while the join clause
+ * may not (if there is a cross-type mergejoin operator available for
+ * the two column types). Is it OK to strip implicit coercions from
+ * the COALESCE arguments?
*/
match = false;
foreach(lc2, cur_ec->ec_members)
@@ -1337,9 +1336,9 @@ reconsider_full_join_clause(PlannerInfo *root, RestrictInfo *rinfo)
/*
* Yes it does! Try to generate clauses LEFTVAR = CONSTANT and
- * RIGHTVAR = CONSTANT for each CONSTANT in the EC. Note that we
- * must succeed with at least one constant for each var before
- * we can decide to throw away the outer-join clause.
+ * RIGHTVAR = CONSTANT for each CONSTANT in the EC. Note that we must
+ * succeed with at least one constant for each var before we can
+ * decide to throw away the outer-join clause.
*/
matchleft = matchright = false;
foreach(lc2, cur_ec->ec_members)
@@ -1378,16 +1377,17 @@ reconsider_full_join_clause(PlannerInfo *root, RestrictInfo *rinfo)
/*
* If we were able to equate both vars to constants, we're done, and
- * we can throw away the full-join clause as redundant. Moreover,
- * we can remove the COALESCE entry from the EC, since the added
- * restrictions ensure it will always have the expected value.
- * (We don't bother trying to update ec_relids or ec_sources.)
+ * we can throw away the full-join clause as redundant. Moreover, we
+ * can remove the COALESCE entry from the EC, since the added
+ * restrictions ensure it will always have the expected value. (We
+ * don't bother trying to update ec_relids or ec_sources.)
*/
if (matchleft && matchright)
{
cur_ec->ec_members = list_delete_ptr(cur_ec->ec_members, coal_em);
return;
}
+
/*
* Otherwise, fall out of the search loop, since we know the COALESCE
* appears in at most one EC (XXX might stop being true if we allow
@@ -1489,8 +1489,8 @@ add_child_rel_equivalences(PlannerInfo *root,
if (bms_equal(cur_em->em_relids, parent_rel->relids))
{
/* Yes, generate transformed child version */
- Expr *child_expr;
-
+ Expr *child_expr;
+
child_expr = (Expr *)
adjust_appendrel_attrs((Node *) cur_em->em_expr,
appinfo);
@@ -1528,8 +1528,8 @@ find_eclass_clauses_for_index_join(PlannerInfo *root, RelOptInfo *rel,
continue;
/*
- * No point in searching if rel not mentioned in eclass (but we
- * can't tell that for a child rel).
+ * No point in searching if rel not mentioned in eclass (but we can't
+ * tell that for a child rel).
*/
if (!is_child_rel &&
!bms_is_subset(rel->relids, cur_ec->ec_relids))
@@ -1543,7 +1543,7 @@ find_eclass_clauses_for_index_join(PlannerInfo *root, RelOptInfo *rel,
{
EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc2);
EquivalenceMember *best_outer_em = NULL;
- Oid best_eq_op = InvalidOid;
+ Oid best_eq_op = InvalidOid;
ListCell *lc3;
if (!bms_equal(cur_em->em_relids, rel->relids) ||
@@ -1552,14 +1552,14 @@ find_eclass_clauses_for_index_join(PlannerInfo *root, RelOptInfo *rel,
/*
* Found one, so try to generate a join clause. This is like
- * generate_join_implied_equalities_normal, except simpler
- * since our only preference item is to pick a Var on the
- * outer side. We only need one join clause per index col.
+ * generate_join_implied_equalities_normal, except simpler since
+ * our only preference item is to pick a Var on the outer side.
+ * We only need one join clause per index col.
*/
foreach(lc3, cur_ec->ec_members)
{
EquivalenceMember *outer_em = (EquivalenceMember *) lfirst(lc3);
- Oid eq_op;
+ Oid eq_op;
if (!bms_is_subset(outer_em->em_relids, outer_relids))
continue;
@@ -1573,7 +1573,7 @@ find_eclass_clauses_for_index_join(PlannerInfo *root, RelOptInfo *rel,
if (IsA(outer_em->em_expr, Var) ||
(IsA(outer_em->em_expr, RelabelType) &&
IsA(((RelabelType *) outer_em->em_expr)->arg, Var)))
- break; /* no need to look further */
+ break; /* no need to look further */
}
if (best_outer_em)
@@ -1587,9 +1587,10 @@ find_eclass_clauses_for_index_join(PlannerInfo *root, RelOptInfo *rel,
cur_ec);
result = lappend(result, rinfo);
+
/*
- * Note: we keep scanning here because we want to provide
- * a clause for every possible indexcol.
+ * Note: we keep scanning here because we want to provide a
+ * clause for every possible indexcol.
*/
}
}
@@ -1605,7 +1606,7 @@ find_eclass_clauses_for_index_join(PlannerInfo *root, RelOptInfo *rel,
* a joinclause between the two given relations.
*
* This is essentially a very cut-down version of
- * generate_join_implied_equalities(). Note it's OK to occasionally say "yes"
+ * generate_join_implied_equalities(). Note it's OK to occasionally say "yes"
* incorrectly. Hence we don't bother with details like whether the lack of a
* cross-type operator might prevent the clause from actually being generated.
*/
@@ -1647,7 +1648,7 @@ have_relevant_eclass_joinclause(PlannerInfo *root,
EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc2);
if (cur_em->em_is_child)
- continue; /* ignore children here */
+ continue; /* ignore children here */
if (bms_is_subset(cur_em->em_relids, rel1->relids))
{
has_rel1 = true;
@@ -1715,7 +1716,7 @@ has_relevant_eclass_joinclause(PlannerInfo *root, RelOptInfo *rel1)
EquivalenceMember *cur_em = (EquivalenceMember *) lfirst(lc2);
if (cur_em->em_is_child)
- continue; /* ignore children here */
+ continue; /* ignore children here */
if (bms_is_subset(cur_em->em_relids, rel1->relids))
{
has_rel1 = true;
@@ -1744,12 +1745,12 @@ has_relevant_eclass_joinclause(PlannerInfo *root, RelOptInfo *rel1)
* against the specified relation.
*
* This is just a heuristic test and doesn't have to be exact; it's better
- * to say "yes" incorrectly than "no". Hence we don't bother with details
+ * to say "yes" incorrectly than "no". Hence we don't bother with details
* like whether the lack of a cross-type operator might prevent the clause
* from actually being generated.
*/
bool
-eclass_useful_for_merging(EquivalenceClass *eclass,
+eclass_useful_for_merging(EquivalenceClass * eclass,
RelOptInfo *rel)
{
ListCell *lc;
@@ -1757,16 +1758,16 @@ eclass_useful_for_merging(EquivalenceClass *eclass,
Assert(!eclass->ec_merged);
/*
- * Won't generate joinclauses if const or single-member (the latter
- * test covers the volatile case too)
+ * Won't generate joinclauses if const or single-member (the latter test
+ * covers the volatile case too)
*/
if (eclass->ec_has_const || list_length(eclass->ec_members) <= 1)
return false;
/*
- * Note we don't test ec_broken; if we did, we'd need a separate code
- * path to look through ec_sources. Checking the members anyway is OK
- * as a possibly-overoptimistic heuristic.
+ * Note we don't test ec_broken; if we did, we'd need a separate code path
+ * to look through ec_sources. Checking the members anyway is OK as a
+ * possibly-overoptimistic heuristic.
*/
/* If rel already includes all members of eclass, no point in searching */
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 47dd3ec55b..4bd9392313 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.223 2007/11/07 22:37:24 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.224 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,7 +39,7 @@
/*
* DoneMatchingIndexKeys() - MACRO
*/
-#define DoneMatchingIndexKeys(families) (families[0] == InvalidOid)
+#define DoneMatchingIndexKeys(families) (families[0] == InvalidOid)
#define IsBooleanOpfamily(opfamily) \
((opfamily) == BOOL_BTREE_FAM_OID || (opfamily) == BOOL_HASH_FAM_OID)
@@ -52,7 +52,7 @@ typedef struct
List *quals; /* the WHERE clauses it uses */
List *preds; /* predicates of its partial index(es) */
Bitmapset *clauseids; /* quals+preds represented as a bitmapset */
-} PathClauseUsage;
+} PathClauseUsage;
static List *find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
@@ -70,7 +70,7 @@ static Cost bitmap_scan_cost_est(PlannerInfo *root, RelOptInfo *rel,
static Cost bitmap_and_cost_est(PlannerInfo *root, RelOptInfo *rel,
List *paths, RelOptInfo *outer_rel);
static PathClauseUsage *classify_index_clause_usage(Path *path,
- List **clauselist);
+ List **clauselist);
static void find_indexpath_quals(Path *bitmapqual, List **quals, List **preds);
static int find_list_position(Node *node, List **nodelist);
static bool match_clause_to_indexcol(IndexOptInfo *index,
@@ -382,8 +382,8 @@ find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
}
/*
- * 4. If the index is ordered, a backwards scan might be
- * interesting. Again, this is only interesting at top level.
+ * 4. If the index is ordered, a backwards scan might be interesting.
+ * Again, this is only interesting at top level.
*/
if (index_is_ordered && possibly_useful_pathkeys &&
istoplevel && outer_rel == NULL)
@@ -581,7 +581,8 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
List *clauselist;
List *bestpaths = NIL;
Cost bestcost = 0;
- int i, j;
+ int i,
+ j;
ListCell *l;
Assert(npaths > 0); /* else caller error */
@@ -592,40 +593,39 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
* In theory we should consider every nonempty subset of the given paths.
* In practice that seems like overkill, given the crude nature of the
* estimates, not to mention the possible effects of higher-level AND and
- * OR clauses. Moreover, it's completely impractical if there are a large
+ * OR clauses. Moreover, it's completely impractical if there are a large
* number of paths, since the work would grow as O(2^N).
*
- * As a heuristic, we first check for paths using exactly the same
- * sets of WHERE clauses + index predicate conditions, and reject all
- * but the cheapest-to-scan in any such group. This primarily gets rid
- * of indexes that include the interesting columns but also irrelevant
- * columns. (In situations where the DBA has gone overboard on creating
- * variant indexes, this can make for a very large reduction in the number
- * of paths considered further.)
+ * As a heuristic, we first check for paths using exactly the same sets of
+ * WHERE clauses + index predicate conditions, and reject all but the
+ * cheapest-to-scan in any such group. This primarily gets rid of indexes
+ * that include the interesting columns but also irrelevant columns. (In
+ * situations where the DBA has gone overboard on creating variant
+ * indexes, this can make for a very large reduction in the number of
+ * paths considered further.)
*
- * We then sort the surviving paths with the cheapest-to-scan first,
- * and for each path, consider using that path alone as the basis for
- * a bitmap scan. Then we consider bitmap AND scans formed from that
- * path plus each subsequent (higher-cost) path, adding on a subsequent
- * path if it results in a reduction in the estimated total scan cost.
- * This means we consider about O(N^2) rather than O(2^N) path
- * combinations, which is quite tolerable, especially given than N is
- * usually reasonably small because of the prefiltering step. The
- * cheapest of these is returned.
+ * We then sort the surviving paths with the cheapest-to-scan first, and
+ * for each path, consider using that path alone as the basis for a bitmap
+ * scan. Then we consider bitmap AND scans formed from that path plus
+ * each subsequent (higher-cost) path, adding on a subsequent path if it
+ * results in a reduction in the estimated total scan cost. This means we
+ * consider about O(N^2) rather than O(2^N) path combinations, which is
+ * quite tolerable, especially given than N is usually reasonably small
+ * because of the prefiltering step. The cheapest of these is returned.
*
- * We will only consider AND combinations in which no two indexes use
- * the same WHERE clause. This is a bit of a kluge: it's needed because
+ * We will only consider AND combinations in which no two indexes use the
+ * same WHERE clause. This is a bit of a kluge: it's needed because
* costsize.c and clausesel.c aren't very smart about redundant clauses.
* They will usually double-count the redundant clauses, producing a
* too-small selectivity that makes a redundant AND step look like it
- * reduces the total cost. Perhaps someday that code will be smarter and
+ * reduces the total cost. Perhaps someday that code will be smarter and
* we can remove this limitation. (But note that this also defends
* against flat-out duplicate input paths, which can happen because
* best_inner_indexscan will find the same OR join clauses that
* create_or_index_quals has pulled OR restriction clauses out of.)
*
* For the same reason, we reject AND combinations in which an index
- * predicate clause duplicates another clause. Here we find it necessary
+ * predicate clause duplicates another clause. Here we find it necessary
* to be even stricter: we'll reject a partial index if any of its
* predicate clauses are implied by the set of WHERE clauses and predicate
* clauses used so far. This covers cases such as a condition "x = 42"
@@ -639,9 +639,9 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
*/
/*
- * Extract clause usage info and detect any paths that use exactly
- * the same set of clauses; keep only the cheapest-to-scan of any such
- * groups. The surviving paths are put into an array for qsort'ing.
+ * Extract clause usage info and detect any paths that use exactly the
+ * same set of clauses; keep only the cheapest-to-scan of any such groups.
+ * The surviving paths are put into an array for qsort'ing.
*/
pathinfoarray = (PathClauseUsage **)
palloc(npaths * sizeof(PathClauseUsage *));
@@ -649,7 +649,7 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
npaths = 0;
foreach(l, paths)
{
- Path *ipath = (Path *) lfirst(l);
+ Path *ipath = (Path *) lfirst(l);
pathinfo = classify_index_clause_usage(ipath, &clauselist);
for (i = 0; i < npaths; i++)
@@ -686,9 +686,9 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
path_usage_comparator);
/*
- * For each surviving index, consider it as an "AND group leader", and
- * see whether adding on any of the later indexes results in an AND path
- * with cheaper total cost than before. Then take the cheapest AND group.
+ * For each surviving index, consider it as an "AND group leader", and see
+ * whether adding on any of the later indexes results in an AND path with
+ * cheaper total cost than before. Then take the cheapest AND group.
*/
for (i = 0; i < npaths; i++)
{
@@ -705,17 +705,17 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
clauseidsofar = bms_copy(pathinfo->clauseids);
lastcell = list_head(paths); /* for quick deletions */
- for (j = i+1; j < npaths; j++)
+ for (j = i + 1; j < npaths; j++)
{
Cost newcost;
pathinfo = pathinfoarray[j];
/* Check for redundancy */
if (bms_overlap(pathinfo->clauseids, clauseidsofar))
- continue; /* consider it redundant */
+ continue; /* consider it redundant */
if (pathinfo->preds)
{
- bool redundant = false;
+ bool redundant = false;
/* we check each predicate clause separately */
foreach(l, pathinfo->preds)
@@ -725,7 +725,7 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
if (predicate_implied_by(list_make1(np), qualsofar))
{
redundant = true;
- break; /* out of inner foreach loop */
+ break; /* out of inner foreach loop */
}
}
if (redundant)
@@ -766,7 +766,7 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
}
if (list_length(bestpaths) == 1)
- return (Path *) linitial(bestpaths); /* no need for AND */
+ return (Path *) linitial(bestpaths); /* no need for AND */
return (Path *) create_bitmap_and_path(root, rel, bestpaths);
}
@@ -774,8 +774,8 @@ choose_bitmap_and(PlannerInfo *root, RelOptInfo *rel,
static int
path_usage_comparator(const void *a, const void *b)
{
- PathClauseUsage *pa = *(PathClauseUsage *const *) a;
- PathClauseUsage *pb = *(PathClauseUsage *const *) b;
+ PathClauseUsage *pa = *(PathClauseUsage * const *) a;
+ PathClauseUsage *pb = *(PathClauseUsage * const *) b;
Cost acost;
Cost bcost;
Selectivity aselec;
@@ -872,14 +872,14 @@ classify_index_clause_usage(Path *path, List **clauselist)
clauseids = NULL;
foreach(lc, result->quals)
{
- Node *node = (Node *) lfirst(lc);
+ Node *node = (Node *) lfirst(lc);
clauseids = bms_add_member(clauseids,
find_list_position(node, clauselist));
}
foreach(lc, result->preds)
{
- Node *node = (Node *) lfirst(lc);
+ Node *node = (Node *) lfirst(lc);
clauseids = bms_add_member(clauseids,
find_list_position(node, clauselist));
@@ -944,7 +944,7 @@ find_indexpath_quals(Path *bitmapqual, List **quals, List **preds)
/*
* find_list_position
* Return the given node's position (counting from 0) in the given
- * list of nodes. If it's not equal() to any existing list member,
+ * list of nodes. If it's not equal() to any existing list member,
* add it at the end, and return that position.
*/
static int
@@ -956,7 +956,7 @@ find_list_position(Node *node, List **nodelist)
i = 0;
foreach(lc, *nodelist)
{
- Node *oldnode = (Node *) lfirst(lc);
+ Node *oldnode = (Node *) lfirst(lc);
if (equal(node, oldnode))
return i;
@@ -1218,7 +1218,7 @@ match_clause_to_indexcol(IndexOptInfo *index,
}
else if (index->amsearchnulls && IsA(clause, NullTest))
{
- NullTest *nt = (NullTest *) clause;
+ NullTest *nt = (NullTest *) clause;
if (nt->nulltesttype == IS_NULL &&
match_index_to_operand((Node *) nt->arg, indexcol, index))
@@ -1315,12 +1315,12 @@ match_rowcompare_to_indexcol(IndexOptInfo *index,
/*
* We could do the matching on the basis of insisting that the opfamily
* shown in the RowCompareExpr be the same as the index column's opfamily,
- * but that could fail in the presence of reverse-sort opfamilies: it'd
- * be a matter of chance whether RowCompareExpr had picked the forward
- * or reverse-sort family. So look only at the operator, and match
- * if it is a member of the index's opfamily (after commutation, if the
- * indexkey is on the right). We'll worry later about whether any
- * additional operators are matchable to the index.
+ * but that could fail in the presence of reverse-sort opfamilies: it'd be
+ * a matter of chance whether RowCompareExpr had picked the forward or
+ * reverse-sort family. So look only at the operator, and match if it is
+ * a member of the index's opfamily (after commutation, if the indexkey is
+ * on the right). We'll worry later about whether any additional
+ * operators are matchable to the index.
*/
leftop = (Node *) linitial(clause->largs);
rightop = (Node *) linitial(clause->rargs);
@@ -1421,8 +1421,8 @@ indexable_outerrelids(PlannerInfo *root, RelOptInfo *rel)
}
/*
- * We also have to look through the query's EquivalenceClasses to see
- * if any of them could generate indexable join conditions for this rel.
+ * We also have to look through the query's EquivalenceClasses to see if
+ * any of them could generate indexable join conditions for this rel.
*/
if (rel->has_eclass_joins)
{
@@ -1434,8 +1434,8 @@ indexable_outerrelids(PlannerInfo *root, RelOptInfo *rel)
ListCell *lc2;
/*
- * Won't generate joinclauses if const or single-member (the latter
- * test covers the volatile case too)
+ * Won't generate joinclauses if const or single-member (the
+ * latter test covers the volatile case too)
*/
if (cur_ec->ec_has_const || list_length(cur_ec->ec_members) <= 1)
continue;
@@ -1569,7 +1569,7 @@ matches_any_index(RestrictInfo *rinfo, RelOptInfo *rel, Relids outer_relids)
* This is also exported for use by find_eclass_clauses_for_index_join.
*/
bool
-eclass_matches_any_index(EquivalenceClass *ec, EquivalenceMember *em,
+eclass_matches_any_index(EquivalenceClass * ec, EquivalenceMember * em,
RelOptInfo *rel)
{
ListCell *l;
@@ -1831,14 +1831,14 @@ find_clauses_for_join(PlannerInfo *root, RelOptInfo *rel,
/*
* Also check to see if any EquivalenceClasses can produce a relevant
- * joinclause. Since all such clauses are effectively pushed-down,
- * this doesn't apply to outer joins.
+ * joinclause. Since all such clauses are effectively pushed-down, this
+ * doesn't apply to outer joins.
*/
if (!isouterjoin && rel->has_eclass_joins)
clause_list = list_concat(clause_list,
find_eclass_clauses_for_index_join(root,
rel,
- outer_relids));
+ outer_relids));
/* If no join clause was matched then forget it, per comments above */
if (clause_list == NIL)
@@ -2150,9 +2150,9 @@ match_special_index_operator(Expr *clause, Oid opfamily,
* want to apply. (A hash index, for example, will not support ">=".)
* Currently, only btree supports the operators we need.
*
- * We insist on the opfamily being the specific one we expect, else we'd do
- * the wrong thing if someone were to make a reverse-sort opfamily with the
- * same operators.
+ * We insist on the opfamily being the specific one we expect, else we'd
+ * do the wrong thing if someone were to make a reverse-sort opfamily with
+ * the same operators.
*/
switch (expr_op)
{
@@ -2260,7 +2260,7 @@ expand_indexqual_conditions(IndexOptInfo *index, List *clausegroups)
{
resultquals = list_concat(resultquals,
expand_indexqual_opclause(rinfo,
- curFamily));
+ curFamily));
}
else if (IsA(clause, ScalarArrayOpExpr))
{
@@ -2602,9 +2602,9 @@ expand_indexqual_rowcompare(RestrictInfo *rinfo,
righttypes_cell = list_head(righttypes);
foreach(opfamilies_cell, opfamilies)
{
- Oid opfam = lfirst_oid(opfamilies_cell);
- Oid lefttype = lfirst_oid(lefttypes_cell);
- Oid righttype = lfirst_oid(righttypes_cell);
+ Oid opfam = lfirst_oid(opfamilies_cell);
+ Oid lefttype = lfirst_oid(lefttypes_cell);
+ Oid righttype = lfirst_oid(righttypes_cell);
expr_op = get_opfamily_member(opfam, lefttype, righttype,
op_strategy);
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index 3671d6974c..4282a9912f 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.112 2007/05/22 01:40:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.113 2007/11/15 21:14:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -200,7 +200,7 @@ sort_inner_and_outer(PlannerInfo *root,
*
* Actually, it's not quite true that every mergeclause ordering will
* generate a different path order, because some of the clauses may be
- * partially redundant (refer to the same EquivalenceClasses). Therefore,
+ * partially redundant (refer to the same EquivalenceClasses). Therefore,
* what we do is convert the mergeclause list to a list of canonical
* pathkeys, and then consider different orderings of the pathkeys.
*
@@ -237,7 +237,7 @@ sort_inner_and_outer(PlannerInfo *root,
list_delete_ptr(list_copy(all_pathkeys),
front_pathkey));
else
- outerkeys = all_pathkeys; /* no work at first one... */
+ outerkeys = all_pathkeys; /* no work at first one... */
/* Sort the mergeclauses into the corresponding ordering */
cur_mergeclauses = find_mergeclauses_for_pathkeys(root,
diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c
index 18fa47c02e..4265a29ea4 100644
--- a/src/backend/optimizer/path/joinrels.c
+++ b/src/backend/optimizer/path/joinrels.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/joinrels.c,v 1.88 2007/10/26 18:10:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/joinrels.c,v 1.89 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -346,8 +346,8 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
ListCell *l;
/*
- * Ensure *jointype_p is set on failure return. This is just to
- * suppress uninitialized-variable warnings from overly anal compilers.
+ * Ensure *jointype_p is set on failure return. This is just to suppress
+ * uninitialized-variable warnings from overly anal compilers.
*/
*jointype_p = JOIN_INNER;
@@ -398,14 +398,14 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
bms_is_subset(ojinfo->min_righthand, rel2->relids))
{
if (jointype != JOIN_INNER)
- return false; /* invalid join path */
+ return false; /* invalid join path */
jointype = ojinfo->is_full_join ? JOIN_FULL : JOIN_LEFT;
}
else if (bms_is_subset(ojinfo->min_lefthand, rel2->relids) &&
bms_is_subset(ojinfo->min_righthand, rel1->relids))
{
if (jointype != JOIN_INNER)
- return false; /* invalid join path */
+ return false; /* invalid join path */
jointype = ojinfo->is_full_join ? JOIN_FULL : JOIN_RIGHT;
}
else
@@ -520,7 +520,7 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
else if (bms_equal(ininfo->righthand, rel2->relids))
jointype = JOIN_UNIQUE_INNER;
else
- return false; /* invalid join path */
+ return false; /* invalid join path */
}
/* Join is valid */
@@ -666,9 +666,9 @@ have_join_order_restriction(PlannerInfo *root,
ListCell *l;
/*
- * It's possible that the rels correspond to the left and right sides
- * of a degenerate outer join, that is, one with no joinclause mentioning
- * the non-nullable side; in which case we should force the join to occur.
+ * It's possible that the rels correspond to the left and right sides of a
+ * degenerate outer join, that is, one with no joinclause mentioning the
+ * non-nullable side; in which case we should force the join to occur.
*
* Also, the two rels could represent a clauseless join that has to be
* completed to build up the LHS or RHS of an outer join.
@@ -696,9 +696,9 @@ have_join_order_restriction(PlannerInfo *root,
}
/*
- * Might we need to join these rels to complete the RHS? We have
- * to use "overlap" tests since either rel might include a lower OJ
- * that has been proven to commute with this one.
+ * Might we need to join these rels to complete the RHS? We have to
+ * use "overlap" tests since either rel might include a lower OJ that
+ * has been proven to commute with this one.
*/
if (bms_overlap(ojinfo->min_righthand, rel1->relids) &&
bms_overlap(ojinfo->min_righthand, rel2->relids))
@@ -761,13 +761,13 @@ have_join_order_restriction(PlannerInfo *root,
}
/*
- * We do not force the join to occur if either input rel can legally
- * be joined to anything else using joinclauses. This essentially
- * means that clauseless bushy joins are put off as long as possible.
- * The reason is that when there is a join order restriction high up
- * in the join tree (that is, with many rels inside the LHS or RHS),
- * we would otherwise expend lots of effort considering very stupid
- * join combinations within its LHS or RHS.
+ * We do not force the join to occur if either input rel can legally be
+ * joined to anything else using joinclauses. This essentially means that
+ * clauseless bushy joins are put off as long as possible. The reason is
+ * that when there is a join order restriction high up in the join tree
+ * (that is, with many rels inside the LHS or RHS), we would otherwise
+ * expend lots of effort considering very stupid join combinations within
+ * its LHS or RHS.
*/
if (result)
{
@@ -787,7 +787,7 @@ have_join_order_restriction(PlannerInfo *root,
*
* Essentially, this tests whether have_join_order_restriction() could
* succeed with this rel and some other one. It's OK if we sometimes
- * say "true" incorrectly. (Therefore, we don't bother with the relatively
+ * say "true" incorrectly. (Therefore, we don't bother with the relatively
* expensive has_legal_joinclause test.)
*/
static bool
diff --git a/src/backend/optimizer/path/pathkeys.c b/src/backend/optimizer/path/pathkeys.c
index 846fe78ee6..7d22194860 100644
--- a/src/backend/optimizer/path/pathkeys.c
+++ b/src/backend/optimizer/path/pathkeys.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.89 2007/11/08 21:49:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/pathkeys.c,v 1.90 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,12 +37,12 @@
#define MUST_BE_REDUNDANT(eclass) \
((eclass)->ec_has_const && !(eclass)->ec_below_outer_join)
-static PathKey *makePathKey(EquivalenceClass *eclass, Oid opfamily,
- int strategy, bool nulls_first);
+static PathKey *makePathKey(EquivalenceClass * eclass, Oid opfamily,
+ int strategy, bool nulls_first);
static PathKey *make_canonical_pathkey(PlannerInfo *root,
- EquivalenceClass *eclass, Oid opfamily,
+ EquivalenceClass * eclass, Oid opfamily,
int strategy, bool nulls_first);
-static bool pathkey_is_redundant(PathKey *new_pathkey, List *pathkeys);
+static bool pathkey_is_redundant(PathKey * new_pathkey, List *pathkeys);
static PathKey *make_pathkey_from_sortinfo(PlannerInfo *root,
Expr *expr, Oid ordering_op,
bool nulls_first,
@@ -50,7 +50,7 @@ static PathKey *make_pathkey_from_sortinfo(PlannerInfo *root,
bool canonicalize);
static Var *find_indexkey_var(PlannerInfo *root, RelOptInfo *rel,
AttrNumber varattno);
-static bool right_merge_direction(PlannerInfo *root, PathKey *pathkey);
+static bool right_merge_direction(PlannerInfo *root, PathKey * pathkey);
/****************************************************************************
@@ -65,10 +65,10 @@ static bool right_merge_direction(PlannerInfo *root, PathKey *pathkey);
* convenience routine to build the specified node.
*/
static PathKey *
-makePathKey(EquivalenceClass *eclass, Oid opfamily,
+makePathKey(EquivalenceClass * eclass, Oid opfamily,
int strategy, bool nulls_first)
{
- PathKey *pk = makeNode(PathKey);
+ PathKey *pk = makeNode(PathKey);
pk->pk_eclass = eclass;
pk->pk_opfamily = opfamily;
@@ -89,10 +89,10 @@ makePathKey(EquivalenceClass *eclass, Oid opfamily,
*/
static PathKey *
make_canonical_pathkey(PlannerInfo *root,
- EquivalenceClass *eclass, Oid opfamily,
+ EquivalenceClass * eclass, Oid opfamily,
int strategy, bool nulls_first)
{
- PathKey *pk;
+ PathKey *pk;
ListCell *lc;
MemoryContext oldcontext;
@@ -155,7 +155,7 @@ make_canonical_pathkey(PlannerInfo *root,
* pointer comparison is enough to decide whether canonical ECs are the same.
*/
static bool
-pathkey_is_redundant(PathKey *new_pathkey, List *pathkeys)
+pathkey_is_redundant(PathKey * new_pathkey, List *pathkeys)
{
EquivalenceClass *new_ec = new_pathkey->pk_eclass;
ListCell *lc;
@@ -170,7 +170,7 @@ pathkey_is_redundant(PathKey *new_pathkey, List *pathkeys)
/* If same EC already used in list, then redundant */
foreach(lc, pathkeys)
{
- PathKey *old_pathkey = (PathKey *) lfirst(lc);
+ PathKey *old_pathkey = (PathKey *) lfirst(lc);
/* Assert we've been given canonical pathkeys */
Assert(!old_pathkey->pk_eclass->ec_merged);
@@ -197,9 +197,9 @@ canonicalize_pathkeys(PlannerInfo *root, List *pathkeys)
foreach(l, pathkeys)
{
- PathKey *pathkey = (PathKey *) lfirst(l);
+ PathKey *pathkey = (PathKey *) lfirst(l);
EquivalenceClass *eclass;
- PathKey *cpathkey;
+ PathKey *cpathkey;
/* Find the canonical (merged) EquivalenceClass */
eclass = pathkey->pk_eclass;
@@ -255,13 +255,13 @@ make_pathkey_from_sortinfo(PlannerInfo *root,
EquivalenceClass *eclass;
/*
- * An ordering operator fully determines the behavior of its opfamily,
- * so could only meaningfully appear in one family --- or perhaps two
- * if one builds a reverse-sort opfamily, but there's not much point in
- * that anymore. But EquivalenceClasses need to contain opfamily lists
- * based on the family membership of equality operators, which could
- * easily be bigger. So, look up the equality operator that goes with
- * the ordering operator (this should be unique) and get its membership.
+ * An ordering operator fully determines the behavior of its opfamily, so
+ * could only meaningfully appear in one family --- or perhaps two if one
+ * builds a reverse-sort opfamily, but there's not much point in that
+ * anymore. But EquivalenceClasses need to contain opfamily lists based
+ * on the family membership of equality operators, which could easily be
+ * bigger. So, look up the equality operator that goes with the ordering
+ * operator (this should be unique) and get its membership.
*/
/* Find the operator in pg_amop --- failure shouldn't happen */
@@ -284,15 +284,15 @@ make_pathkey_from_sortinfo(PlannerInfo *root,
/*
* When dealing with binary-compatible opclasses, we have to ensure that
- * the exposed type of the expression tree matches the declared input
- * type of the opclass, except when that is a polymorphic type
- * (compare the behavior of parse_coerce.c). This ensures that we can
- * correctly match the indexkey or sortclause expression to other
- * expressions we find in the query, because arguments of ordinary
- * operator expressions will be cast that way. (We have to do this
- * for indexkeys because they are represented without any explicit
- * relabel in pg_index, and for sort clauses because the parser is
- * likewise cavalier about putting relabels on them.)
+ * the exposed type of the expression tree matches the declared input type
+ * of the opclass, except when that is a polymorphic type (compare the
+ * behavior of parse_coerce.c). This ensures that we can correctly match
+ * the indexkey or sortclause expression to other expressions we find in
+ * the query, because arguments of ordinary operator expressions will be
+ * cast that way. (We have to do this for indexkeys because they are
+ * represented without any explicit relabel in pg_index, and for sort
+ * clauses because the parser is likewise cavalier about putting relabels
+ * on them.)
*/
if (exprType((Node *) expr) != opcintype &&
!IsPolymorphicType(opcintype))
@@ -341,8 +341,8 @@ compare_pathkeys(List *keys1, List *keys2)
forboth(key1, keys1, key2, keys2)
{
- PathKey *pathkey1 = (PathKey *) lfirst(key1);
- PathKey *pathkey2 = (PathKey *) lfirst(key2);
+ PathKey *pathkey1 = (PathKey *) lfirst(key1);
+ PathKey *pathkey2 = (PathKey *) lfirst(key2);
/*
* XXX would like to check that we've been given canonicalized input,
@@ -495,7 +495,7 @@ build_index_pathkeys(PlannerInfo *root,
bool nulls_first;
int ikey;
Expr *indexkey;
- PathKey *cpathkey;
+ PathKey *cpathkey;
if (ScanDirectionIsBackward(scandir))
{
@@ -601,9 +601,9 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
foreach(i, subquery_pathkeys)
{
- PathKey *sub_pathkey = (PathKey *) lfirst(i);
+ PathKey *sub_pathkey = (PathKey *) lfirst(i);
EquivalenceClass *sub_eclass = sub_pathkey->pk_eclass;
- PathKey *best_pathkey = NULL;
+ PathKey *best_pathkey = NULL;
if (sub_eclass->ec_has_volatile)
{
@@ -614,7 +614,7 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
*/
TargetEntry *tle;
- if (sub_eclass->ec_sortref == 0) /* can't happen */
+ if (sub_eclass->ec_sortref == 0) /* can't happen */
elog(ERROR, "volatile EquivalenceClass has no sortref");
tle = get_sortgroupref_tle(sub_eclass->ec_sortref, sub_tlist);
Assert(tle);
@@ -653,11 +653,11 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
/*
* Otherwise, the sub_pathkey's EquivalenceClass could contain
* multiple elements (representing knowledge that multiple items
- * are effectively equal). Each element might match none, one, or
- * more of the output columns that are visible to the outer
- * query. This means we may have multiple possible representations
- * of the sub_pathkey in the context of the outer query. Ideally
- * we would generate them all and put them all into an EC of the
+ * are effectively equal). Each element might match none, one, or
+ * more of the output columns that are visible to the outer query.
+ * This means we may have multiple possible representations of the
+ * sub_pathkey in the context of the outer query. Ideally we
+ * would generate them all and put them all into an EC of the
* outer query, thereby propagating equality knowledge up to the
* outer query. Right now we cannot do so, because the outer
* query's EquivalenceClasses are already frozen when this is
@@ -680,7 +680,8 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
* We handle two cases: the sub_pathkey key can be either an
* exact match for a targetlist entry, or it could match after
* stripping RelabelType nodes. (We need that case since
- * make_pathkey_from_sortinfo could add or remove RelabelType.)
+ * make_pathkey_from_sortinfo could add or remove
+ * RelabelType.)
*/
sub_stripped = sub_expr;
while (sub_stripped && IsA(sub_stripped, RelabelType))
@@ -691,7 +692,7 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
TargetEntry *tle = (TargetEntry *) lfirst(k);
Expr *outer_expr;
EquivalenceClass *outer_ec;
- PathKey *outer_pk;
+ PathKey *outer_pk;
int score;
/* resjunk items aren't visible to outer query */
@@ -729,7 +730,7 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
exprType((Node *) sub_expr))
outer_expr = (Expr *)
makeRelabelType(outer_expr,
- exprType((Node *) sub_expr),
+ exprType((Node *) sub_expr),
-1,
COERCE_DONTCARE);
}
@@ -740,14 +741,14 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
/* Found a representation for this sub_pathkey */
outer_ec = get_eclass_for_sort_expr(root,
outer_expr,
- sub_member->em_datatype,
- sub_eclass->ec_opfamilies,
+ sub_member->em_datatype,
+ sub_eclass->ec_opfamilies,
0);
outer_pk = make_canonical_pathkey(root,
outer_ec,
- sub_pathkey->pk_opfamily,
- sub_pathkey->pk_strategy,
- sub_pathkey->pk_nulls_first);
+ sub_pathkey->pk_opfamily,
+ sub_pathkey->pk_strategy,
+ sub_pathkey->pk_nulls_first);
/* score = # of equivalence peers */
score = list_length(outer_ec->ec_members) - 1;
/* +1 if it matches the proper query_pathkeys item */
@@ -854,7 +855,7 @@ make_pathkeys_for_sortclauses(PlannerInfo *root,
{
SortClause *sortcl = (SortClause *) lfirst(l);
Expr *sortkey;
- PathKey *pathkey;
+ PathKey *pathkey;
sortkey = (Expr *) get_sortgroupclause_expr(sortcl, tlist);
pathkey = make_pathkey_from_sortinfo(root,
@@ -961,7 +962,7 @@ find_mergeclauses_for_pathkeys(PlannerInfo *root,
foreach(i, pathkeys)
{
- PathKey *pathkey = (PathKey *) lfirst(i);
+ PathKey *pathkey = (PathKey *) lfirst(i);
EquivalenceClass *pathkey_ec = pathkey->pk_eclass;
List *matched_restrictinfos = NIL;
ListCell *j;
@@ -1042,7 +1043,7 @@ find_mergeclauses_for_pathkeys(PlannerInfo *root,
* Returns a pathkeys list that can be applied to the outer relation.
*
* Since we assume here that a sort is required, there is no particular use
- * in matching any available ordering of the outerrel. (joinpath.c has an
+ * in matching any available ordering of the outerrel. (joinpath.c has an
* entirely separate code path for considering sort-free mergejoins.) Rather,
* it's interesting to try to match the requested query_pathkeys so that a
* second output sort may be avoided; and failing that, we try to list "more
@@ -1117,16 +1118,15 @@ select_outer_pathkeys_for_merge(PlannerInfo *root,
}
/*
- * Find out if we have all the ECs mentioned in query_pathkeys; if so
- * we can generate a sort order that's also useful for final output.
- * There is no percentage in a partial match, though, so we have to
- * have 'em all.
+ * Find out if we have all the ECs mentioned in query_pathkeys; if so we
+ * can generate a sort order that's also useful for final output. There is
+ * no percentage in a partial match, though, so we have to have 'em all.
*/
if (root->query_pathkeys)
{
foreach(lc, root->query_pathkeys)
{
- PathKey *query_pathkey = (PathKey *) lfirst(lc);
+ PathKey *query_pathkey = (PathKey *) lfirst(lc);
EquivalenceClass *query_ec = query_pathkey->pk_eclass;
for (j = 0; j < necs; j++)
@@ -1145,7 +1145,7 @@ select_outer_pathkeys_for_merge(PlannerInfo *root,
/* mark their ECs as already-emitted */
foreach(lc, root->query_pathkeys)
{
- PathKey *query_pathkey = (PathKey *) lfirst(lc);
+ PathKey *query_pathkey = (PathKey *) lfirst(lc);
EquivalenceClass *query_ec = query_pathkey->pk_eclass;
for (j = 0; j < necs; j++)
@@ -1161,16 +1161,16 @@ select_outer_pathkeys_for_merge(PlannerInfo *root,
}
/*
- * Add remaining ECs to the list in popularity order, using a default
- * sort ordering. (We could use qsort() here, but the list length is
- * usually so small it's not worth it.)
+ * Add remaining ECs to the list in popularity order, using a default sort
+ * ordering. (We could use qsort() here, but the list length is usually
+ * so small it's not worth it.)
*/
for (;;)
{
- int best_j;
- int best_score;
+ int best_j;
+ int best_score;
EquivalenceClass *ec;
- PathKey *pathkey;
+ PathKey *pathkey;
best_j = 0;
best_score = scores[0];
@@ -1230,7 +1230,7 @@ make_inner_pathkeys_for_merge(PlannerInfo *root,
{
List *pathkeys = NIL;
EquivalenceClass *lastoeclass;
- PathKey *opathkey;
+ PathKey *opathkey;
ListCell *lc;
ListCell *lop;
@@ -1243,7 +1243,7 @@ make_inner_pathkeys_for_merge(PlannerInfo *root,
RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
EquivalenceClass *oeclass;
EquivalenceClass *ieclass;
- PathKey *pathkey;
+ PathKey *pathkey;
cache_mergeclause_eclasses(root, rinfo);
@@ -1332,7 +1332,7 @@ pathkeys_useful_for_merging(PlannerInfo *root, RelOptInfo *rel, List *pathkeys)
foreach(i, pathkeys)
{
- PathKey *pathkey = (PathKey *) lfirst(i);
+ PathKey *pathkey = (PathKey *) lfirst(i);
bool matched = false;
ListCell *j;
@@ -1392,23 +1392,23 @@ pathkeys_useful_for_merging(PlannerInfo *root, RelOptInfo *rel, List *pathkeys)
* for merging its target column.
*/
static bool
-right_merge_direction(PlannerInfo *root, PathKey *pathkey)
+right_merge_direction(PlannerInfo *root, PathKey * pathkey)
{
ListCell *l;
foreach(l, root->query_pathkeys)
{
- PathKey *query_pathkey = (PathKey *) lfirst(l);
+ PathKey *query_pathkey = (PathKey *) lfirst(l);
if (pathkey->pk_eclass == query_pathkey->pk_eclass &&
pathkey->pk_opfamily == query_pathkey->pk_opfamily)
{
/*
- * Found a matching query sort column. Prefer this pathkey's
+ * Found a matching query sort column. Prefer this pathkey's
* direction iff it matches. Note that we ignore pk_nulls_first,
- * which means that a sort might be needed anyway ... but we
- * still want to prefer only one of the two possible directions,
- * and we might as well use this one.
+ * which means that a sort might be needed anyway ... but we still
+ * want to prefer only one of the two possible directions, and we
+ * might as well use this one.
*/
return (pathkey->pk_strategy == query_pathkey->pk_strategy);
}
@@ -1480,13 +1480,13 @@ truncate_useless_pathkeys(PlannerInfo *root,
* useful according to truncate_useless_pathkeys().
*
* This is a cheap test that lets us skip building pathkeys at all in very
- * simple queries. It's OK to err in the direction of returning "true" when
+ * simple queries. It's OK to err in the direction of returning "true" when
* there really aren't any usable pathkeys, but erring in the other direction
* is bad --- so keep this in sync with the routines above!
*
* We could make the test more complex, for example checking to see if any of
* the joinclauses are really mergejoinable, but that likely wouldn't win
- * often enough to repay the extra cycles. Queries with neither a join nor
+ * often enough to repay the extra cycles. Queries with neither a join nor
* a sort are reasonably common, though, so this much work seems worthwhile.
*/
bool
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index e2b46f970c..eed6446c8a 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.234 2007/11/08 21:49:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.235 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -723,8 +723,8 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path)
/*
* Get the hashable equality operators for the Agg node to use.
* Normally these are the same as the IN clause operators, but if
- * those are cross-type operators then the equality operators are
- * the ones for the IN clause operators' RHS datatype.
+ * those are cross-type operators then the equality operators are the
+ * ones for the IN clause operators' RHS datatype.
*/
groupOperators = (Oid *) palloc(numGroupCols * sizeof(Oid));
groupColPos = 0;
@@ -769,7 +769,7 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path)
SortClause *sortcl;
sortop = get_ordering_op_for_equality_op(in_oper, false);
- if (!OidIsValid(sortop)) /* shouldn't happen */
+ if (!OidIsValid(sortop)) /* shouldn't happen */
elog(ERROR, "could not find ordering operator for equality operator %u",
in_oper);
tle = get_tle_by_resno(subplan->targetlist,
@@ -1530,8 +1530,8 @@ create_mergejoin_plan(PlannerInfo *root,
int i;
EquivalenceClass *lastoeclass;
EquivalenceClass *lastieclass;
- PathKey *opathkey;
- PathKey *ipathkey;
+ PathKey *opathkey;
+ PathKey *ipathkey;
ListCell *lc;
ListCell *lop;
ListCell *lip;
@@ -1603,8 +1603,8 @@ create_mergejoin_plan(PlannerInfo *root,
/*
* If inner plan is a sort that is expected to spill to disk, add a
* materialize node to shield it from the need to handle mark/restore.
- * This will allow it to perform the last merge pass on-the-fly, while
- * in most cases not requiring the materialize to spill to disk.
+ * This will allow it to perform the last merge pass on-the-fly, while in
+ * most cases not requiring the materialize to spill to disk.
*
* XXX really, Sort oughta do this for itself, probably, to avoid the
* overhead of a separate plan node.
@@ -1645,7 +1645,7 @@ create_mergejoin_plan(PlannerInfo *root,
i = 0;
foreach(lc, best_path->path_mergeclauses)
{
- RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
+ RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
EquivalenceClass *oeclass;
EquivalenceClass *ieclass;
@@ -1938,7 +1938,7 @@ fix_indexqual_references(List *indexquals, IndexPath *index_path,
}
else if (IsA(clause, NullTest))
{
- NullTest *nt = (NullTest *) clause;
+ NullTest *nt = (NullTest *) clause;
Assert(nt->nulltesttype == IS_NULL);
nt->arg = (Expr *) fix_indexqual_operand((Node *) nt->arg,
@@ -2139,9 +2139,9 @@ order_qual_clauses(PlannerInfo *root, List *clauses)
{
typedef struct
{
- Node *clause;
- Cost cost;
- } QualItem;
+ Node *clause;
+ Cost cost;
+ } QualItem;
int nitems = list_length(clauses);
QualItem *items;
ListCell *lc;
@@ -2171,8 +2171,8 @@ order_qual_clauses(PlannerInfo *root, List *clauses)
/*
* Sort. We don't use qsort() because it's not guaranteed stable for
- * equal keys. The expected number of entries is small enough that
- * a simple insertion sort should be good enough.
+ * equal keys. The expected number of entries is small enough that a
+ * simple insertion sort should be good enough.
*/
for (i = 1; i < nitems; i++)
{
@@ -2182,9 +2182,9 @@ order_qual_clauses(PlannerInfo *root, List *clauses)
/* insert newitem into the already-sorted subarray */
for (j = i; j > 0; j--)
{
- if (newitem.cost >= items[j-1].cost)
+ if (newitem.cost >= items[j - 1].cost)
break;
- items[j] = items[j-1];
+ items[j] = items[j - 1];
}
items[j] = newitem;
}
@@ -2616,7 +2616,7 @@ make_mergejoin(List *tlist,
* make_sort --- basic routine to build a Sort plan node
*
* Caller must have built the sortColIdx, sortOperators, and nullsFirst
- * arrays already. limit_tuples is as for cost_sort (in particular, pass
+ * arrays already. limit_tuples is as for cost_sort (in particular, pass
* -1 if no limit)
*/
static Sort *
@@ -2667,8 +2667,8 @@ add_sort_column(AttrNumber colIdx, Oid sortOp, bool nulls_first,
for (i = 0; i < numCols; i++)
{
/*
- * Note: we check sortOp because it's conceivable that "ORDER BY
- * foo USING <, foo USING <<<" is not redundant, if <<< distinguishes
+ * Note: we check sortOp because it's conceivable that "ORDER BY foo
+ * USING <, foo USING <<<" is not redundant, if <<< distinguishes
* values that < considers equal. We need not check nulls_first
* however because a lower-order column with the same sortop but
* opposite nulls direction is redundant.
@@ -2729,7 +2729,7 @@ make_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree, List *pathkeys,
foreach(i, pathkeys)
{
- PathKey *pathkey = (PathKey *) lfirst(i);
+ PathKey *pathkey = (PathKey *) lfirst(i);
EquivalenceClass *ec = pathkey->pk_eclass;
TargetEntry *tle = NULL;
Oid pk_datatype = InvalidOid;
@@ -2743,7 +2743,7 @@ make_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree, List *pathkeys,
* have come from an ORDER BY clause, and we have to match it to
* that same targetlist entry.
*/
- if (ec->ec_sortref == 0) /* can't happen */
+ if (ec->ec_sortref == 0) /* can't happen */
elog(ERROR, "volatile EquivalenceClass has no sortref");
tle = get_sortgroupref_tle(ec->ec_sortref, tlist);
Assert(tle);
@@ -2755,7 +2755,7 @@ make_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree, List *pathkeys,
/*
* Otherwise, we can sort by any non-constant expression listed in
* the pathkey's EquivalenceClass. For now, we take the first one
- * that corresponds to an available item in the tlist. If there
+ * that corresponds to an available item in the tlist. If there
* isn't any, use the first one that is an expression in the
* input's vars. (The non-const restriction only matters if the
* EC is below_outer_join; but if it isn't, it won't contain
@@ -2779,28 +2779,28 @@ make_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree, List *pathkeys,
if (tle)
{
pk_datatype = em->em_datatype;
- break; /* found expr already in tlist */
+ break; /* found expr already in tlist */
}
/*
* We can also use it if the pathkey expression is a relabel
* of the tlist entry, or vice versa. This is needed for
* binary-compatible cases (cf. make_pathkey_from_sortinfo).
- * We prefer an exact match, though, so we do the basic
- * search first.
+ * We prefer an exact match, though, so we do the basic search
+ * first.
*/
tle = tlist_member_ignore_relabel((Node *) em->em_expr, tlist);
if (tle)
{
pk_datatype = em->em_datatype;
- break; /* found expr already in tlist */
+ break; /* found expr already in tlist */
}
}
if (!tle)
{
/* No matching tlist item; look for a computable expression */
- Expr *sortexpr = NULL;
+ Expr *sortexpr = NULL;
foreach(j, ec->ec_members)
{
@@ -2821,7 +2821,7 @@ make_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree, List *pathkeys,
if (!k)
{
pk_datatype = em->em_datatype;
- break; /* found usable expression */
+ break; /* found usable expression */
}
}
if (!j)
@@ -3172,7 +3172,7 @@ make_group(PlannerInfo *root,
/*
* distinctList is a list of SortClauses, identifying the targetlist items
- * that should be considered by the Unique filter. The input path must
+ * that should be considered by the Unique filter. The input path must
* already be sorted accordingly.
*/
Unique *
@@ -3221,7 +3221,7 @@ make_unique(Plan *lefttree, List *distinctList)
uniqColIdx[keyno] = tle->resno;
uniqOperators[keyno] = get_equality_op_for_ordering_op(sortcl->sortop);
- if (!OidIsValid(uniqOperators[keyno])) /* shouldn't happen */
+ if (!OidIsValid(uniqOperators[keyno])) /* shouldn't happen */
elog(ERROR, "could not find equality operator for ordering operator %u",
sortcl->sortop);
keyno++;
@@ -3287,7 +3287,7 @@ make_setop(SetOpCmd cmd, Plan *lefttree,
dupColIdx[keyno] = tle->resno;
dupOperators[keyno] = get_equality_op_for_ordering_op(sortcl->sortop);
- if (!OidIsValid(dupOperators[keyno])) /* shouldn't happen */
+ if (!OidIsValid(dupOperators[keyno])) /* shouldn't happen */
elog(ERROR, "could not find equality operator for ordering operator %u",
sortcl->sortop);
keyno++;
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index bacd875abf..a567197d75 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.135 2007/10/24 20:54:27 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.136 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,7 +51,7 @@ static void distribute_qual_to_rels(PlannerInfo *root, Node *clause,
Relids ojscope,
Relids outerjoin_nonnullable);
static bool check_outerjoin_delay(PlannerInfo *root, Relids *relids_p,
- bool is_pushed_down);
+ bool is_pushed_down);
static void check_mergejoinable(RestrictInfo *restrictinfo);
static void check_hashjoinable(RestrictInfo *restrictinfo);
@@ -329,10 +329,10 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join,
/*
* A FROM with more than one list element is an inner join subsuming
- * all below it, so we should report inner_join_rels = qualscope.
- * If there was exactly one element, we should (and already did) report
- * whatever its inner_join_rels were. If there were no elements
- * (is that possible?) the initialization before the loop fixed it.
+ * all below it, so we should report inner_join_rels = qualscope. If
+ * there was exactly one element, we should (and already did) report
+ * whatever its inner_join_rels were. If there were no elements (is
+ * that possible?) the initialization before the loop fixed it.
*/
if (list_length(f->fromlist) > 1)
*inner_join_rels = *qualscope;
@@ -478,8 +478,8 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join,
else
{
/* can't combine, but needn't force join order above here */
- Node *leftpart,
- *rightpart;
+ Node *leftpart,
+ *rightpart;
/* avoid creating useless 1-element sublists */
if (list_length(leftjoinlist) == 1)
@@ -590,13 +590,13 @@ make_outerjoininfo(PlannerInfo *root,
ojinfo->lhs_strict = bms_overlap(strict_relids, left_rels);
/*
- * Required LHS always includes the LHS rels mentioned in the clause.
- * We may have to add more rels based on lower outer joins; see below.
+ * Required LHS always includes the LHS rels mentioned in the clause. We
+ * may have to add more rels based on lower outer joins; see below.
*/
min_lefthand = bms_intersect(clause_relids, left_rels);
/*
- * Similarly for required RHS. But here, we must also include any lower
+ * Similarly for required RHS. But here, we must also include any lower
* inner joins, to ensure we don't try to commute with any of them.
*/
min_righthand = bms_int_members(bms_union(clause_relids, inner_join_rels),
@@ -614,10 +614,10 @@ make_outerjoininfo(PlannerInfo *root,
* For a lower OJ in our LHS, if our join condition uses the lower
* join's RHS and is not strict for that rel, we must preserve the
* ordering of the two OJs, so add lower OJ's full syntactic relset to
- * min_lefthand. (We must use its full syntactic relset, not just
- * its min_lefthand + min_righthand. This is because there might
- * be other OJs below this one that this one can commute with,
- * but we cannot commute with them if we don't with this one.)
+ * min_lefthand. (We must use its full syntactic relset, not just its
+ * min_lefthand + min_righthand. This is because there might be other
+ * OJs below this one that this one can commute with, but we cannot
+ * commute with them if we don't with this one.)
*
* Note: I believe we have to insist on being strict for at least one
* rel in the lower OJ's min_righthand, not its whole syn_righthand.
@@ -635,19 +635,19 @@ make_outerjoininfo(PlannerInfo *root,
/*
* For a lower OJ in our RHS, if our join condition does not use the
* lower join's RHS and the lower OJ's join condition is strict, we
- * can interchange the ordering of the two OJs; otherwise we must
- * add lower OJ's full syntactic relset to min_righthand.
+ * can interchange the ordering of the two OJs; otherwise we must add
+ * lower OJ's full syntactic relset to min_righthand.
*
- * Here, we have to consider that "our join condition" includes
- * any clauses that syntactically appeared above the lower OJ and
- * below ours; those are equivalent to degenerate clauses in our
- * OJ and must be treated as such. Such clauses obviously can't
- * reference our LHS, and they must be non-strict for the lower OJ's
- * RHS (else reduce_outer_joins would have reduced the lower OJ to
- * a plain join). Hence the other ways in which we handle clauses
- * within our join condition are not affected by them. The net
- * effect is therefore sufficiently represented by the
- * delay_upper_joins flag saved for us by check_outerjoin_delay.
+ * Here, we have to consider that "our join condition" includes any
+ * clauses that syntactically appeared above the lower OJ and below
+ * ours; those are equivalent to degenerate clauses in our OJ and must
+ * be treated as such. Such clauses obviously can't reference our
+ * LHS, and they must be non-strict for the lower OJ's RHS (else
+ * reduce_outer_joins would have reduced the lower OJ to a plain
+ * join). Hence the other ways in which we handle clauses within our
+ * join condition are not affected by them. The net effect is
+ * therefore sufficiently represented by the delay_upper_joins flag
+ * saved for us by check_outerjoin_delay.
*/
if (bms_overlap(right_rels, otherinfo->syn_righthand))
{
@@ -817,7 +817,7 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
* Note: it is not immediately obvious that a simple boolean is enough
* for this: if for some reason we were to attach a degenerate qual to
* its original join level, it would need to be treated as an outer join
- * qual there. However, this cannot happen, because all the rels the
+ * qual there. However, this cannot happen, because all the rels the
* clause mentions must be in the outer join's min_righthand, therefore
* the join it needs must be formed before the outer join; and we always
* attach quals to the lowest level where they can be evaluated. But
@@ -828,10 +828,10 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
if (is_deduced)
{
/*
- * If the qual came from implied-equality deduction, it should
- * not be outerjoin-delayed, else deducer blew it. But we can't
- * check this because the ojinfo list may now contain OJs above
- * where the qual belongs.
+ * If the qual came from implied-equality deduction, it should not be
+ * outerjoin-delayed, else deducer blew it. But we can't check this
+ * because the ojinfo list may now contain OJs above where the qual
+ * belongs.
*/
Assert(!ojscope);
is_pushed_down = true;
@@ -846,9 +846,9 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
* The qual is attached to an outer join and mentions (some of the)
* rels on the nonnullable side, so it's not degenerate.
*
- * We can't use such a clause to deduce equivalence (the left and right
- * sides might be unequal above the join because one of them has gone
- * to NULL) ... but we might be able to use it for more limited
+ * We can't use such a clause to deduce equivalence (the left and
+ * right sides might be unequal above the join because one of them has
+ * gone to NULL) ... but we might be able to use it for more limited
* deductions, if there are no lower outer joins that delay its
* application. If so, consider adding it to the lists of set-aside
* clauses.
@@ -875,8 +875,8 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
else
{
/*
- * Normal qual clause or degenerate outer-join clause. Either way,
- * we can mark it as pushed-down.
+ * Normal qual clause or degenerate outer-join clause. Either way, we
+ * can mark it as pushed-down.
*/
is_pushed_down = true;
@@ -887,6 +887,7 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
{
/* Should still be a subset of current scope ... */
Assert(bms_is_subset(relids, qualscope));
+
/*
* Because application of the qual will be delayed by outer join,
* we mustn't assume its vars are equal everywhere.
@@ -896,12 +897,11 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
else
{
/*
- * Qual is not delayed by any lower outer-join restriction, so
- * we can consider feeding it to the equivalence machinery.
- * However, if it's itself within an outer-join clause, treat it
- * as though it appeared below that outer join (note that we can
- * only get here when the clause references only nullable-side
- * rels).
+ * Qual is not delayed by any lower outer-join restriction, so we
+ * can consider feeding it to the equivalence machinery. However,
+ * if it's itself within an outer-join clause, treat it as though
+ * it appeared below that outer join (note that we can only get
+ * here when the clause references only nullable-side rels).
*/
maybe_equivalence = true;
if (outerjoin_nonnullable != NULL)
@@ -926,9 +926,9 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
/*
* If it's a join clause (either naturally, or because delayed by
- * outer-join rules), add vars used in the clause to targetlists of
- * their relations, so that they will be emitted by the plan nodes that
- * scan those relations (else they won't be available at the join node!).
+ * outer-join rules), add vars used in the clause to targetlists of their
+ * relations, so that they will be emitted by the plan nodes that scan
+ * those relations (else they won't be available at the join node!).
*
* Note: if the clause gets absorbed into an EquivalenceClass then this
* may be unnecessary, but for now we have to do it to cover the case
@@ -955,23 +955,23 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
* machinery. We do *not* attach it directly to any restriction or join
* lists. The EC code will propagate it to the appropriate places later.
*
- * If the clause has a mergejoinable operator and is not outerjoin-delayed,
- * yet isn't an equivalence because it is an outer-join clause, the EC
- * code may yet be able to do something with it. We add it to appropriate
- * lists for further consideration later. Specifically:
+ * If the clause has a mergejoinable operator and is not
+ * outerjoin-delayed, yet isn't an equivalence because it is an outer-join
+ * clause, the EC code may yet be able to do something with it. We add it
+ * to appropriate lists for further consideration later. Specifically:
*
- * If it is a left or right outer-join qualification that relates the
- * two sides of the outer join (no funny business like leftvar1 =
- * leftvar2 + rightvar), we add it to root->left_join_clauses or
+ * If it is a left or right outer-join qualification that relates the two
+ * sides of the outer join (no funny business like leftvar1 = leftvar2 +
+ * rightvar), we add it to root->left_join_clauses or
* root->right_join_clauses according to which side the nonnullable
* variable appears on.
*
* If it is a full outer-join qualification, we add it to
* root->full_join_clauses. (Ideally we'd discard cases that aren't
* leftvar = rightvar, as we do for left/right joins, but this routine
- * doesn't have the info needed to do that; and the current usage of
- * the full_join_clauses list doesn't require that, so it's not
- * currently worth complicating this routine's API to make it possible.)
+ * doesn't have the info needed to do that; and the current usage of the
+ * full_join_clauses list doesn't require that, so it's not currently
+ * worth complicating this routine's API to make it possible.)
*
* If none of the above hold, pass it off to
* distribute_restrictinfo_to_rels().
@@ -997,9 +997,9 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
return;
}
if (bms_is_subset(restrictinfo->right_relids,
- outerjoin_nonnullable) &&
- !bms_overlap(restrictinfo->left_relids,
- outerjoin_nonnullable))
+ outerjoin_nonnullable) &&
+ !bms_overlap(restrictinfo->left_relids,
+ outerjoin_nonnullable))
{
/* we have innervar = outervar */
root->right_join_clauses = lappend(root->right_join_clauses,
@@ -1034,7 +1034,7 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
* For an is_pushed_down qual, we can evaluate the qual as soon as (1) we have
* all the rels it mentions, and (2) we are at or above any outer joins that
* can null any of these rels and are below the syntactic location of the
- * given qual. We must enforce (2) because pushing down such a clause below
+ * given qual. We must enforce (2) because pushing down such a clause below
* the OJ might cause the OJ to emit null-extended rows that should not have
* been formed, or that should have been rejected by the clause. (This is
* only an issue for non-strict quals, since if we can prove a qual mentioning
@@ -1043,7 +1043,7 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
*
* To enforce (2), scan the oj_info_list and merge the required-relid sets of
* any such OJs into the clause's own reference list. At the time we are
- * called, the oj_info_list contains only outer joins below this qual. We
+ * called, the oj_info_list contains only outer joins below this qual. We
* have to repeat the scan until no new relids get added; this ensures that
* the qual is suitably delayed regardless of the order in which OJs get
* executed. As an example, if we have one OJ with LHS=A, RHS=B, and one with
@@ -1060,7 +1060,7 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
* required relids overlap the LHS too) causes that OJ's delay_upper_joins
* flag to be set TRUE. This will prevent any higher-level OJs from
* being interchanged with that OJ, which would result in not having any
- * correct place to evaluate the qual. (The case we care about here is a
+ * correct place to evaluate the qual. (The case we care about here is a
* sub-select WHERE clause within the RHS of some outer join. The WHERE
* clause must effectively be treated as a degenerate clause of that outer
* join's condition. Rather than trying to match such clauses with joins
@@ -1077,7 +1077,8 @@ check_outerjoin_delay(PlannerInfo *root, Relids *relids_p,
bool found_some;
outerjoin_delayed = false;
- do {
+ do
+ {
ListCell *l;
found_some = false;
@@ -1134,8 +1135,8 @@ distribute_restrictinfo_to_rels(PlannerInfo *root,
case BMS_SINGLETON:
/*
- * There is only one relation participating in the clause, so
- * it is a restriction clause for that relation.
+ * There is only one relation participating in the clause, so it
+ * is a restriction clause for that relation.
*/
rel = find_base_rel(root, bms_singleton_member(relids));
@@ -1151,8 +1152,8 @@ distribute_restrictinfo_to_rels(PlannerInfo *root,
*/
/*
- * Check for hashjoinable operators. (We don't bother setting
- * the hashjoin info if we're not going to need it.)
+ * Check for hashjoinable operators. (We don't bother setting the
+ * hashjoin info if we're not going to need it.)
*/
if (enable_hashjoin)
check_hashjoinable(restrictinfo);
@@ -1222,7 +1223,7 @@ process_implied_equality(PlannerInfo *root,
/* If we produced const TRUE, just drop the clause */
if (clause && IsA(clause, Const))
{
- Const *cclause = (Const *) clause;
+ Const *cclause = (Const *) clause;
Assert(cclause->consttype == BOOLOID);
if (!cclause->constisnull && DatumGetBool(cclause->constvalue))
@@ -1273,9 +1274,9 @@ build_implied_join_equality(Oid opno,
* Build the RestrictInfo node itself.
*/
restrictinfo = make_restrictinfo(clause,
- true, /* is_pushed_down */
- false, /* outerjoin_delayed */
- false, /* pseudoconstant */
+ true, /* is_pushed_down */
+ false, /* outerjoin_delayed */
+ false, /* pseudoconstant */
qualscope);
/* Set mergejoinability info always, and hashjoinability if enabled */
@@ -1322,9 +1323,9 @@ check_mergejoinable(RestrictInfo *restrictinfo)
restrictinfo->mergeopfamilies = get_mergejoin_opfamilies(opno);
/*
- * Note: op_mergejoinable is just a hint; if we fail to find the
- * operator in any btree opfamilies, mergeopfamilies remains NIL
- * and so the clause is not treated as mergejoinable.
+ * Note: op_mergejoinable is just a hint; if we fail to find the operator
+ * in any btree opfamilies, mergeopfamilies remains NIL and so the clause
+ * is not treated as mergejoinable.
*/
}
diff --git a/src/backend/optimizer/plan/planagg.c b/src/backend/optimizer/plan/planagg.c
index 80d01c0294..09302d3fc1 100644
--- a/src/backend/optimizer/plan/planagg.c
+++ b/src/backend/optimizer/plan/planagg.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.33 2007/10/13 00:58:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.34 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -298,9 +298,9 @@ build_minmax_path(PlannerInfo *root, RelOptInfo *rel, MinMaxAggInfo *info)
info->notnulltest = (Expr *) ntest;
/*
- * Build list of existing restriction clauses plus the notnull test.
- * We cheat a bit by not bothering with a RestrictInfo node for the
- * notnull test --- predicate_implied_by() won't care.
+ * Build list of existing restriction clauses plus the notnull test. We
+ * cheat a bit by not bothering with a RestrictInfo node for the notnull
+ * test --- predicate_implied_by() won't care.
*/
allquals = list_concat(list_make1(ntest), rel->baserestrictinfo);
@@ -320,9 +320,9 @@ build_minmax_path(PlannerInfo *root, RelOptInfo *rel, MinMaxAggInfo *info)
continue;
/*
- * Ignore partial indexes that do not match the query --- unless
- * their predicates can be proven from the baserestrict list plus
- * the IS NOT NULL test. In that case we can use them.
+ * Ignore partial indexes that do not match the query --- unless their
+ * predicates can be proven from the baserestrict list plus the IS NOT
+ * NULL test. In that case we can use them.
*/
if (index->indpred != NIL && !index->predOK &&
!predicate_implied_by(index->indpred, allquals))
@@ -434,7 +434,7 @@ build_minmax_path(PlannerInfo *root, RelOptInfo *rel, MinMaxAggInfo *info)
static ScanDirection
match_agg_to_index_col(MinMaxAggInfo *info, IndexOptInfo *index, int indexcol)
{
- ScanDirection result;
+ ScanDirection result;
/* Check for operator match first (cheaper) */
if (info->aggsortop == index->fwdsortop[indexcol])
@@ -519,8 +519,8 @@ make_agg_subplan(PlannerInfo *root, MinMaxAggInfo *info)
* have stuck a gating Result atop that, if there were any pseudoconstant
* quals.
*
- * We can skip adding the NOT NULL qual if it's redundant with either
- * an already-given WHERE condition, or a clause of the index predicate.
+ * We can skip adding the NOT NULL qual if it's redundant with either an
+ * already-given WHERE condition, or a clause of the index predicate.
*/
plan = create_plan(&subroot, (Path *) info->path);
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c
index 772ee84e8d..f7bef9004b 100644
--- a/src/backend/optimizer/plan/planmain.c
+++ b/src/backend/optimizer/plan/planmain.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/planmain.c,v 1.103 2007/10/04 20:44:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planmain.c,v 1.104 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -110,9 +110,10 @@ query_planner(PlannerInfo *root, List *tlist,
*cheapest_path = (Path *)
create_result_path((List *) parse->jointree->quals);
*sorted_path = NULL;
+
/*
- * We still are required to canonicalize any pathkeys, in case
- * it's something like "SELECT 2+2 ORDER BY 1".
+ * We still are required to canonicalize any pathkeys, in case it's
+ * something like "SELECT 2+2 ORDER BY 1".
*/
root->canon_pathkeys = NIL;
root->query_pathkeys = canonicalize_pathkeys(root,
@@ -143,8 +144,8 @@ query_planner(PlannerInfo *root, List *tlist,
root->oj_info_list = NIL;
/*
- * Make a flattened version of the rangetable for faster access (this
- * is OK because the rangetable won't change any more).
+ * Make a flattened version of the rangetable for faster access (this is
+ * OK because the rangetable won't change any more).
*/
root->simple_rte_array = (RangeTblEntry **)
palloc0(root->simple_rel_array_size * sizeof(RangeTblEntry *));
@@ -198,8 +199,8 @@ query_planner(PlannerInfo *root, List *tlist,
* Examine the targetlist and qualifications, adding entries to baserel
* targetlists for all referenced Vars. Restrict and join clauses are
* added to appropriate lists belonging to the mentioned relations. We
- * also build EquivalenceClasses for provably equivalent expressions,
- * and form a target joinlist for make_one_rel() to work from.
+ * also build EquivalenceClasses for provably equivalent expressions, and
+ * form a target joinlist for make_one_rel() to work from.
*
* Note: all subplan nodes will have "flat" (var-only) tlists. This
* implies that all expression evaluations are done at the root of the
@@ -227,14 +228,14 @@ query_planner(PlannerInfo *root, List *tlist,
/*
* If we formed any equivalence classes, generate additional restriction
- * clauses as appropriate. (Implied join clauses are formed on-the-fly
+ * clauses as appropriate. (Implied join clauses are formed on-the-fly
* later.)
*/
generate_base_implied_equalities(root);
/*
* We have completed merging equivalence sets, so it's now possible to
- * convert the requested query_pathkeys to canonical form. Also
+ * convert the requested query_pathkeys to canonical form. Also
* canonicalize the groupClause and sortClause pathkeys for use later.
*/
root->query_pathkeys = canonicalize_pathkeys(root, root->query_pathkeys);
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index c55f89da78..5234e0433d 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.223 2007/10/11 18:05:27 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.224 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -174,8 +174,8 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
Assert(list_length(glob->subplans) == list_length(glob->subrtables));
forboth(lp, glob->subplans, lr, glob->subrtables)
{
- Plan *subplan = (Plan *) lfirst(lp);
- List *subrtable = (List *) lfirst(lr);
+ Plan *subplan = (Plan *) lfirst(lp);
+ List *subrtable = (List *) lfirst(lr);
lfirst(lp) = set_plan_references(glob, subplan, subrtable);
}
@@ -229,7 +229,7 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
*--------------------
*/
Plan *
-subquery_planner(PlannerGlobal *glob, Query *parse,
+subquery_planner(PlannerGlobal * glob, Query *parse,
Index level, double tuple_fraction,
PlannerInfo **subroot)
{
@@ -741,9 +741,10 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
{
tuple_fraction = preprocess_limit(root, tuple_fraction,
&offset_est, &count_est);
+
/*
- * If we have a known LIMIT, and don't have an unknown OFFSET,
- * we can estimate the effects of using a bounded sort.
+ * If we have a known LIMIT, and don't have an unknown OFFSET, we can
+ * estimate the effects of using a bounded sort.
*/
if (count_est > 0 && offset_est >= 0)
limit_tuples = (double) count_est + (double) offset_est;
@@ -777,7 +778,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
*/
current_pathkeys = make_pathkeys_for_sortclauses(root,
set_sortclauses,
- result_plan->targetlist,
+ result_plan->targetlist,
true);
/*
@@ -1446,7 +1447,7 @@ extract_grouping_ops(List *groupClause)
GroupClause *groupcl = (GroupClause *) lfirst(glitem);
groupOperators[colno] = get_equality_op_for_ordering_op(groupcl->sortop);
- if (!OidIsValid(groupOperators[colno])) /* shouldn't happen */
+ if (!OidIsValid(groupOperators[colno])) /* shouldn't happen */
elog(ERROR, "could not find equality operator for ordering operator %u",
groupcl->sortop);
colno++;
@@ -1477,8 +1478,8 @@ choose_hashed_grouping(PlannerInfo *root,
/*
* Check can't-do-it conditions, including whether the grouping operators
* are hashjoinable. (We assume hashing is OK if they are marked
- * oprcanhash. If there isn't actually a supporting hash function,
- * the executor will complain at runtime.)
+ * oprcanhash. If there isn't actually a supporting hash function, the
+ * executor will complain at runtime.)
*
* Executor doesn't support hashed aggregation with DISTINCT aggregates.
* (Doing so would imply storing *all* the input values in the hash table,
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index bc8ce00d4e..af7ab0d7f3 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.137 2007/10/11 18:05:27 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.138 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ typedef struct
{
PlannerGlobal *glob;
int rtoffset;
-} fix_scan_expr_context;
+} fix_scan_expr_context;
typedef struct
{
@@ -54,29 +54,29 @@ typedef struct
indexed_tlist *inner_itlist;
Index acceptable_rel;
int rtoffset;
-} fix_join_expr_context;
+} fix_join_expr_context;
typedef struct
{
PlannerGlobal *glob;
indexed_tlist *subplan_itlist;
int rtoffset;
-} fix_upper_expr_context;
+} fix_upper_expr_context;
#define fix_scan_list(glob, lst, rtoffset) \
((List *) fix_scan_expr(glob, (Node *) (lst), rtoffset))
-static Plan *set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset);
-static Plan *set_subqueryscan_references(PlannerGlobal *glob,
- SubqueryScan *plan,
- int rtoffset);
+static Plan *set_plan_refs(PlannerGlobal * glob, Plan *plan, int rtoffset);
+static Plan *set_subqueryscan_references(PlannerGlobal * glob,
+ SubqueryScan *plan,
+ int rtoffset);
static bool trivial_subqueryscan(SubqueryScan *plan);
-static Node *fix_scan_expr(PlannerGlobal *glob, Node *node, int rtoffset);
-static Node *fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context);
-static void set_join_references(PlannerGlobal *glob, Join *join, int rtoffset);
-static void set_inner_join_references(PlannerGlobal *glob, Plan *inner_plan,
+static Node *fix_scan_expr(PlannerGlobal * glob, Node *node, int rtoffset);
+static Node *fix_scan_expr_mutator(Node *node, fix_scan_expr_context * context);
+static void set_join_references(PlannerGlobal * glob, Join *join, int rtoffset);
+static void set_inner_join_references(PlannerGlobal * glob, Plan *inner_plan,
indexed_tlist *outer_itlist);
-static void set_upper_references(PlannerGlobal *glob, Plan *plan, int rtoffset);
+static void set_upper_references(PlannerGlobal * glob, Plan *plan, int rtoffset);
static void set_dummy_tlist_references(Plan *plan, int rtoffset);
static indexed_tlist *build_tlist_index(List *tlist);
static Var *search_indexed_tlist_for_var(Var *var,
@@ -86,19 +86,19 @@ static Var *search_indexed_tlist_for_var(Var *var,
static Var *search_indexed_tlist_for_non_var(Node *node,
indexed_tlist *itlist,
Index newvarno);
-static List *fix_join_expr(PlannerGlobal *glob,
- List *clauses,
- indexed_tlist *outer_itlist,
- indexed_tlist *inner_itlist,
- Index acceptable_rel, int rtoffset);
+static List *fix_join_expr(PlannerGlobal * glob,
+ List *clauses,
+ indexed_tlist *outer_itlist,
+ indexed_tlist *inner_itlist,
+ Index acceptable_rel, int rtoffset);
static Node *fix_join_expr_mutator(Node *node,
- fix_join_expr_context *context);
-static Node *fix_upper_expr(PlannerGlobal *glob,
- Node *node,
- indexed_tlist *subplan_itlist,
- int rtoffset);
+ fix_join_expr_context * context);
+static Node *fix_upper_expr(PlannerGlobal * glob,
+ Node *node,
+ indexed_tlist *subplan_itlist,
+ int rtoffset);
static Node *fix_upper_expr_mutator(Node *node,
- fix_upper_expr_context *context);
+ fix_upper_expr_context * context);
static bool fix_opfuncids_walker(Node *node, void *context);
@@ -155,26 +155,26 @@ static bool fix_opfuncids_walker(Node *node, void *context);
* the list of relation OIDs is appended to glob->relationOids.
*
* Notice that we modify Plan nodes in-place, but use expression_tree_mutator
- * to process targetlist and qual expressions. We can assume that the Plan
+ * to process targetlist and qual expressions. We can assume that the Plan
* nodes were just built by the planner and are not multiply referenced, but
* it's not so safe to assume that for expression tree nodes.
*/
Plan *
-set_plan_references(PlannerGlobal *glob, Plan *plan, List *rtable)
+set_plan_references(PlannerGlobal * glob, Plan *plan, List *rtable)
{
int rtoffset = list_length(glob->finalrtable);
ListCell *lc;
/*
- * In the flat rangetable, we zero out substructure pointers that are
- * not needed by the executor; this reduces the storage space and
- * copying cost for cached plans. We keep only the alias and eref
- * Alias fields, which are needed by EXPLAIN.
+ * In the flat rangetable, we zero out substructure pointers that are not
+ * needed by the executor; this reduces the storage space and copying cost
+ * for cached plans. We keep only the alias and eref Alias fields, which
+ * are needed by EXPLAIN.
*/
foreach(lc, rtable)
{
- RangeTblEntry *rte = (RangeTblEntry *) lfirst(lc);
- RangeTblEntry *newrte;
+ RangeTblEntry *rte = (RangeTblEntry *) lfirst(lc);
+ RangeTblEntry *newrte;
/* flat copy to duplicate all the scalar fields */
newrte = (RangeTblEntry *) palloc(sizeof(RangeTblEntry));
@@ -193,11 +193,11 @@ set_plan_references(PlannerGlobal *glob, Plan *plan, List *rtable)
/*
* If it's a plain relation RTE, add the table to relationOids.
*
- * We do this even though the RTE might be unreferenced in the
- * plan tree; this would correspond to cases such as views that
- * were expanded, child tables that were eliminated by constraint
- * exclusion, etc. Schema invalidation on such a rel must still
- * force rebuilding of the plan.
+ * We do this even though the RTE might be unreferenced in the plan
+ * tree; this would correspond to cases such as views that were
+ * expanded, child tables that were eliminated by constraint
+ * exclusion, etc. Schema invalidation on such a rel must still force
+ * rebuilding of the plan.
*
* Note we don't bother to avoid duplicate list entries. We could,
* but it would probably cost more cycles than it would save.
@@ -215,7 +215,7 @@ set_plan_references(PlannerGlobal *glob, Plan *plan, List *rtable)
* set_plan_refs: recurse through the Plan nodes of a single subquery level
*/
static Plan *
-set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
+set_plan_refs(PlannerGlobal * glob, Plan *plan, int rtoffset)
{
ListCell *l;
@@ -229,7 +229,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
{
case T_SeqScan:
{
- SeqScan *splan = (SeqScan *) plan;
+ SeqScan *splan = (SeqScan *) plan;
splan->scanrelid += rtoffset;
splan->plan.targetlist =
@@ -240,7 +240,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
break;
case T_IndexScan:
{
- IndexScan *splan = (IndexScan *) plan;
+ IndexScan *splan = (IndexScan *) plan;
splan->scan.scanrelid += rtoffset;
splan->scan.plan.targetlist =
@@ -282,7 +282,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
break;
case T_TidScan:
{
- TidScan *splan = (TidScan *) plan;
+ TidScan *splan = (TidScan *) plan;
splan->scan.scanrelid += rtoffset;
splan->scan.plan.targetlist =
@@ -340,11 +340,12 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
/*
* These plan types don't actually bother to evaluate their
* targetlists, because they just return their unmodified input
- * tuples. Even though the targetlist won't be used by the
+ * tuples. Even though the targetlist won't be used by the
* executor, we fix it up for possible use by EXPLAIN (not to
* mention ease of debugging --- wrong varnos are very confusing).
*/
set_dummy_tlist_references(plan, rtoffset);
+
/*
* Since these plan types don't check quals either, we should not
* find any qual expression attached to them.
@@ -353,13 +354,13 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
break;
case T_Limit:
{
- Limit *splan = (Limit *) plan;
+ Limit *splan = (Limit *) plan;
/*
* Like the plan types above, Limit doesn't evaluate its tlist
* or quals. It does have live expressions for limit/offset,
- * however; and those cannot contain subplan variable refs,
- * so fix_scan_expr works for them.
+ * however; and those cannot contain subplan variable refs, so
+ * fix_scan_expr works for them.
*/
set_dummy_tlist_references(plan, rtoffset);
Assert(splan->plan.qual == NIL);
@@ -376,7 +377,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
break;
case T_Result:
{
- Result *splan = (Result *) plan;
+ Result *splan = (Result *) plan;
/*
* Result may or may not have a subplan; if not, it's more
@@ -398,7 +399,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
break;
case T_Append:
{
- Append *splan = (Append *) plan;
+ Append *splan = (Append *) plan;
/*
* Append, like Sort et al, doesn't actually evaluate its
@@ -416,7 +417,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
break;
case T_BitmapAnd:
{
- BitmapAnd *splan = (BitmapAnd *) plan;
+ BitmapAnd *splan = (BitmapAnd *) plan;
/* BitmapAnd works like Append, but has no tlist */
Assert(splan->plan.targetlist == NIL);
@@ -431,7 +432,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
break;
case T_BitmapOr:
{
- BitmapOr *splan = (BitmapOr *) plan;
+ BitmapOr *splan = (BitmapOr *) plan;
/* BitmapOr works like Append, but has no tlist */
Assert(splan->plan.targetlist == NIL);
@@ -472,7 +473,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
* to do the normal processing on it.
*/
static Plan *
-set_subqueryscan_references(PlannerGlobal *glob,
+set_subqueryscan_references(PlannerGlobal * glob,
SubqueryScan *plan,
int rtoffset)
{
@@ -618,7 +619,7 @@ copyVar(Var *var)
* and adding OIDs from regclass Const nodes into glob->relationOids.
*/
static Node *
-fix_scan_expr(PlannerGlobal *glob, Node *node, int rtoffset)
+fix_scan_expr(PlannerGlobal * glob, Node *node, int rtoffset)
{
fix_scan_expr_context context;
@@ -628,7 +629,7 @@ fix_scan_expr(PlannerGlobal *glob, Node *node, int rtoffset)
}
static Node *
-fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context)
+fix_scan_expr_mutator(Node *node, fix_scan_expr_context * context)
{
if (node == NULL)
return NULL;
@@ -637,9 +638,10 @@ fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context)
Var *var = copyVar((Var *) node);
Assert(var->varlevelsup == 0);
+
/*
* We should not see any Vars marked INNER, but in a nestloop inner
- * scan there could be OUTER Vars. Leave them alone.
+ * scan there could be OUTER Vars. Leave them alone.
*/
Assert(var->varno != INNER);
if (var->varno > 0 && var->varno != OUTER)
@@ -657,9 +659,10 @@ fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context)
cexpr->cvarno += context->rtoffset;
return (Node *) cexpr;
}
+
/*
- * Since we update opcode info in-place, this part could possibly
- * scribble on the planner's input data structures, but it's OK.
+ * Since we update opcode info in-place, this part could possibly scribble
+ * on the planner's input data structures, but it's OK.
*/
if (IsA(node, OpExpr))
set_opfuncid((OpExpr *) node);
@@ -697,7 +700,7 @@ fix_scan_expr_mutator(Node *node, fix_scan_expr_context *context)
* quals of the child indexscan. set_inner_join_references does that.
*/
static void
-set_join_references(PlannerGlobal *glob, Join *join, int rtoffset)
+set_join_references(PlannerGlobal * glob, Join *join, int rtoffset)
{
Plan *outer_plan = join->plan.lefttree;
Plan *inner_plan = join->plan.righttree;
@@ -774,7 +777,7 @@ set_join_references(PlannerGlobal *glob, Join *join, int rtoffset)
* recursion reaches the inner indexscan, and so we'd have done it twice.
*/
static void
-set_inner_join_references(PlannerGlobal *glob, Plan *inner_plan,
+set_inner_join_references(PlannerGlobal * glob, Plan *inner_plan,
indexed_tlist *outer_itlist)
{
if (IsA(inner_plan, IndexScan))
@@ -966,7 +969,7 @@ set_inner_join_references(PlannerGlobal *glob, Plan *inner_plan,
* the expression.
*/
static void
-set_upper_references(PlannerGlobal *glob, Plan *plan, int rtoffset)
+set_upper_references(PlannerGlobal * glob, Plan *plan, int rtoffset)
{
Plan *subplan = plan->lefttree;
indexed_tlist *subplan_itlist;
@@ -1038,7 +1041,7 @@ set_dummy_tlist_references(Plan *plan, int rtoffset)
}
else
{
- newvar->varnoold = 0; /* wasn't ever a plain Var */
+ newvar->varnoold = 0; /* wasn't ever a plain Var */
newvar->varoattno = 0;
}
@@ -1251,7 +1254,7 @@ search_indexed_tlist_for_non_var(Node *node,
* not modified.
*/
static List *
-fix_join_expr(PlannerGlobal *glob,
+fix_join_expr(PlannerGlobal * glob,
List *clauses,
indexed_tlist *outer_itlist,
indexed_tlist *inner_itlist,
@@ -1269,7 +1272,7 @@ fix_join_expr(PlannerGlobal *glob,
}
static Node *
-fix_join_expr_mutator(Node *node, fix_join_expr_context *context)
+fix_join_expr_mutator(Node *node, fix_join_expr_context * context)
{
Var *newvar;
@@ -1325,9 +1328,10 @@ fix_join_expr_mutator(Node *node, fix_join_expr_context *context)
if (newvar)
return (Node *) newvar;
}
+
/*
- * Since we update opcode info in-place, this part could possibly
- * scribble on the planner's input data structures, but it's OK.
+ * Since we update opcode info in-place, this part could possibly scribble
+ * on the planner's input data structures, but it's OK.
*/
if (IsA(node, OpExpr))
set_opfuncid((OpExpr *) node);
@@ -1381,7 +1385,7 @@ fix_join_expr_mutator(Node *node, fix_join_expr_context *context)
* The original tree is not modified.
*/
static Node *
-fix_upper_expr(PlannerGlobal *glob,
+fix_upper_expr(PlannerGlobal * glob,
Node *node,
indexed_tlist *subplan_itlist,
int rtoffset)
@@ -1395,7 +1399,7 @@ fix_upper_expr(PlannerGlobal *glob,
}
static Node *
-fix_upper_expr_mutator(Node *node, fix_upper_expr_context *context)
+fix_upper_expr_mutator(Node *node, fix_upper_expr_context * context)
{
Var *newvar;
@@ -1422,9 +1426,10 @@ fix_upper_expr_mutator(Node *node, fix_upper_expr_context *context)
if (newvar)
return (Node *) newvar;
}
+
/*
- * Since we update opcode info in-place, this part could possibly
- * scribble on the planner's input data structures, but it's OK.
+ * Since we update opcode info in-place, this part could possibly scribble
+ * on the planner's input data structures, but it's OK.
*/
if (IsA(node, OpExpr))
set_opfuncid((OpExpr *) node);
@@ -1474,7 +1479,7 @@ fix_upper_expr_mutator(Node *node, fix_upper_expr_context *context)
* they are not coming from a subplan.
*/
List *
-set_returning_clause_references(PlannerGlobal *glob,
+set_returning_clause_references(PlannerGlobal * glob,
List *rlist,
Plan *topplan,
Index resultRelation)
@@ -1485,8 +1490,8 @@ set_returning_clause_references(PlannerGlobal *glob,
* We can perform the desired Var fixup by abusing the fix_join_expr
* machinery that normally handles inner indexscan fixup. We search the
* top plan's targetlist for Vars of non-result relations, and use
- * fix_join_expr to convert RETURNING Vars into references to those
- * tlist entries, while leaving result-rel Vars as-is.
+ * fix_join_expr to convert RETURNING Vars into references to those tlist
+ * entries, while leaving result-rel Vars as-is.
*/
itlist = build_tlist_index_other_vars(topplan->targetlist, resultRelation);
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index 76d80bfce0..8177f291b0 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.125 2007/09/22 21:36:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.126 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,7 +43,7 @@ typedef struct process_sublinks_context
{
PlannerInfo *root;
bool isTopQual;
-} process_sublinks_context;
+} process_sublinks_context;
typedef struct finalize_primnode_context
{
@@ -54,16 +54,16 @@ typedef struct finalize_primnode_context
static Node *convert_testexpr(PlannerInfo *root,
- Node *testexpr,
- int rtindex,
- List **righthandIds);
+ Node *testexpr,
+ int rtindex,
+ List **righthandIds);
static Node *convert_testexpr_mutator(Node *node,
convert_testexpr_context *context);
static bool subplan_is_hashable(SubLink *slink, SubPlan *node, Plan *plan);
static bool hash_ok_operator(OpExpr *expr);
static Node *replace_correlation_vars_mutator(Node *node, PlannerInfo *root);
static Node *process_sublinks_mutator(Node *node,
- process_sublinks_context *context);
+ process_sublinks_context * context);
static Bitmapset *finalize_plan(PlannerInfo *root,
Plan *plan,
Bitmapset *outer_params,
@@ -88,13 +88,13 @@ replace_outer_var(PlannerInfo *root, Var *var)
abslevel = root->query_level - var->varlevelsup;
/*
- * If there's already a paramlist entry for this same Var, just use
- * it. NOTE: in sufficiently complex querytrees, it is possible for the
- * same varno/abslevel to refer to different RTEs in different parts of
- * the parsetree, so that different fields might end up sharing the same
- * Param number. As long as we check the vartype as well, I believe that
- * this sort of aliasing will cause no trouble. The correct field should
- * get stored into the Param slot at execution in each part of the tree.
+ * If there's already a paramlist entry for this same Var, just use it.
+ * NOTE: in sufficiently complex querytrees, it is possible for the same
+ * varno/abslevel to refer to different RTEs in different parts of the
+ * parsetree, so that different fields might end up sharing the same Param
+ * number. As long as we check the vartype as well, I believe that this
+ * sort of aliasing will cause no trouble. The correct field should get
+ * stored into the Param slot at execution in each part of the tree.
*
* We also need to demand a match on vartypmod. This does not matter for
* the Param itself, since those are not typmod-dependent, but it does
@@ -470,11 +470,10 @@ make_subplan(PlannerInfo *root, SubLink *slink, Node *testexpr, bool isTopQual)
/*
* A parameterless subplan (not initplan) should be prepared to handle
- * REWIND efficiently. If it has direct parameters then there's no point
- * since it'll be reset on each scan anyway; and if it's an initplan
- * then there's no point since it won't get re-run without parameter
- * changes anyway. The input of a hashed subplan doesn't need REWIND
- * either.
+ * REWIND efficiently. If it has direct parameters then there's no point
+ * since it'll be reset on each scan anyway; and if it's an initplan then
+ * there's no point since it won't get re-run without parameter changes
+ * anyway. The input of a hashed subplan doesn't need REWIND either.
*/
if (splan->parParam == NIL && !isInitPlan && !splan->useHashTable)
root->glob->rewindPlanIDs = bms_add_member(root->glob->rewindPlanIDs,
@@ -625,13 +624,12 @@ subplan_is_hashable(SubLink *slink, SubPlan *node, Plan *plan)
return false;
/*
- * The combining operators must be hashable and strict.
- * The need for hashability is obvious, since we want to use hashing.
- * Without strictness, behavior in the presence of nulls is too
- * unpredictable. We actually must assume even more than plain
- * strictness: they can't yield NULL for non-null inputs, either
- * (see nodeSubplan.c). However, hash indexes and hash joins assume
- * that too.
+ * The combining operators must be hashable and strict. The need for
+ * hashability is obvious, since we want to use hashing. Without
+ * strictness, behavior in the presence of nulls is too unpredictable. We
+ * actually must assume even more than plain strictness: they can't yield
+ * NULL for non-null inputs, either (see nodeSubplan.c). However, hash
+ * indexes and hash joins assume that too.
*/
if (IsA(slink->testexpr, OpExpr))
{
@@ -730,7 +728,7 @@ convert_IN_to_join(PlannerInfo *root, SubLink *sublink)
in_operators = NIL;
foreach(lc, ((BoolExpr *) sublink->testexpr)->args)
{
- OpExpr *op = (OpExpr *) lfirst(lc);
+ OpExpr *op = (OpExpr *) lfirst(lc);
if (!IsA(op, OpExpr)) /* probably shouldn't happen */
return NULL;
@@ -867,7 +865,7 @@ SS_process_sublinks(PlannerInfo *root, Node *expr, bool isQual)
}
static Node *
-process_sublinks_mutator(Node *node, process_sublinks_context *context)
+process_sublinks_mutator(Node *node, process_sublinks_context * context)
{
process_sublinks_context locContext;
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 1d92cc5628..d8c98c927e 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -22,7 +22,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.144 2007/10/22 17:04:35 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.145 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -224,11 +224,11 @@ recurse_set_operations(Node *setOp, PlannerInfo *root,
* output columns.
*
* XXX you don't really want to know about this: setrefs.c will apply
- * fix_upper_expr() to the Result node's tlist. This
- * would fail if the Vars generated by generate_setop_tlist() were not
- * exactly equal() to the corresponding tlist entries of the subplan.
- * However, since the subplan was generated by generate_union_plan()
- * or generate_nonunion_plan(), and hence its tlist was generated by
+ * fix_upper_expr() to the Result node's tlist. This would fail if the
+ * Vars generated by generate_setop_tlist() were not exactly equal()
+ * to the corresponding tlist entries of the subplan. However, since
+ * the subplan was generated by generate_union_plan() or
+ * generate_nonunion_plan(), and hence its tlist was generated by
* generate_append_tlist(), this will work. We just tell
* generate_setop_tlist() to use varno 0.
*/
@@ -972,8 +972,8 @@ make_inh_translation_lists(Relation oldrelation, Relation newrelation,
* Otherwise we have to search for the matching column by name.
* There's no guarantee it'll have the same column position, because
* of cases like ALTER TABLE ADD COLUMN and multiple inheritance.
- * However, in simple cases it will be the same column number, so
- * try that before we go groveling through all the columns.
+ * However, in simple cases it will be the same column number, so try
+ * that before we go groveling through all the columns.
*
* Note: the test for (att = ...) != NULL cannot fail, it's just a
* notational device to include the assignment into the if-clause.
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index c541713f3f..5b0ca6deec 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.250 2007/10/11 21:27:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.251 2007/11/15 21:14:36 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -576,7 +576,7 @@ expression_returns_set_walker(Node *node, void *context)
* Estimate the number of rows in a set result.
*
* We use the product of the rowcount estimates of all the functions in
- * the given tree. The result is 1 if there are no set-returning functions.
+ * the given tree. The result is 1 if there are no set-returning functions.
*/
double
expression_returns_set_rows(Node *clause)
@@ -738,9 +738,9 @@ contain_mutable_functions_walker(Node *node, void *context)
else if (IsA(node, CoerceViaIO))
{
CoerceViaIO *expr = (CoerceViaIO *) node;
- Oid iofunc;
- Oid typioparam;
- bool typisvarlena;
+ Oid iofunc;
+ Oid typioparam;
+ bool typisvarlena;
/* check the result type's input function */
getTypeInputInfo(expr->resulttype,
@@ -849,9 +849,9 @@ contain_volatile_functions_walker(Node *node, void *context)
else if (IsA(node, CoerceViaIO))
{
CoerceViaIO *expr = (CoerceViaIO *) node;
- Oid iofunc;
- Oid typioparam;
- bool typisvarlena;
+ Oid iofunc;
+ Oid typioparam;
+ bool typisvarlena;
/* check the result type's input function */
getTypeInputInfo(expr->resulttype,
@@ -1065,13 +1065,13 @@ find_nonnullable_rels_walker(Node *node, bool top_level)
else if (IsA(node, List))
{
/*
- * At top level, we are examining an implicit-AND list: if any of
- * the arms produces FALSE-or-NULL then the result is FALSE-or-NULL.
- * If not at top level, we are examining the arguments of a strict
+ * At top level, we are examining an implicit-AND list: if any of the
+ * arms produces FALSE-or-NULL then the result is FALSE-or-NULL. If
+ * not at top level, we are examining the arguments of a strict
* function: if any of them produce NULL then the result of the
* function must be NULL. So in both cases, the set of nonnullable
- * rels is the union of those found in the arms, and we pass down
- * the top_level flag unmodified.
+ * rels is the union of those found in the arms, and we pass down the
+ * top_level flag unmodified.
*/
foreach(l, (List *) node)
{
@@ -1115,15 +1115,17 @@ find_nonnullable_rels_walker(Node *node, bool top_level)
top_level);
break;
}
+
/*
* Below top level, even if one arm produces NULL, the result
* could be FALSE (hence not NULL). However, if *all* the
- * arms produce NULL then the result is NULL, so we can
- * take the intersection of the sets of nonnullable rels,
- * just as for OR. Fall through to share code.
+ * arms produce NULL then the result is NULL, so we can take
+ * the intersection of the sets of nonnullable rels, just as
+ * for OR. Fall through to share code.
*/
/* FALL THRU */
case OR_EXPR:
+
/*
* OR is strict if all of its arms are, so we can take the
* intersection of the sets of nonnullable rels for each arm.
@@ -1135,13 +1137,14 @@ find_nonnullable_rels_walker(Node *node, bool top_level)
subresult = find_nonnullable_rels_walker(lfirst(l),
top_level);
- if (result == NULL) /* first subresult? */
+ if (result == NULL) /* first subresult? */
result = subresult;
else
result = bms_int_members(result, subresult);
+
/*
- * If the intersection is empty, we can stop looking.
- * This also justifies the test for first-subresult above.
+ * If the intersection is empty, we can stop looking. This
+ * also justifies the test for first-subresult above.
*/
if (bms_is_empty(result))
break;
@@ -1669,7 +1672,7 @@ eval_const_expressions(Node *node)
{
eval_const_expressions_context context;
- context.boundParams = NULL; /* don't use any bound params */
+ context.boundParams = NULL; /* don't use any bound params */
context.active_fns = NIL; /* nothing being recursively simplified */
context.case_val = NULL; /* no CASE being examined */
context.estimate = false; /* safe transformations only */
@@ -1697,7 +1700,7 @@ estimate_expression_value(PlannerInfo *root, Node *node)
{
eval_const_expressions_context context;
- context.boundParams = root->glob->boundParams; /* bound Params */
+ context.boundParams = root->glob->boundParams; /* bound Params */
context.active_fns = NIL; /* nothing being recursively simplified */
context.case_val = NULL; /* no CASE being examined */
context.estimate = true; /* unsafe transformations OK */
@@ -3015,11 +3018,11 @@ inline_function(Oid funcid, Oid result_type, List *args,
newexpr = (Node *) ((TargetEntry *) linitial(querytree->targetList))->expr;
/*
- * Make sure the function (still) returns what it's declared to. This will
- * raise an error if wrong, but that's okay since the function would fail
- * at runtime anyway. Note we do not try this until we have verified that
- * no rewriting was needed; that's probably not important, but let's be
- * careful.
+ * Make sure the function (still) returns what it's declared to. This
+ * will raise an error if wrong, but that's okay since the function would
+ * fail at runtime anyway. Note we do not try this until we have verified
+ * that no rewriting was needed; that's probably not important, but let's
+ * be careful.
*/
if (check_sql_fn_retval(funcid, result_type, list_make1(querytree), NULL))
goto fail; /* reject whole-tuple-result cases */
@@ -3580,8 +3583,8 @@ expression_tree_walker(Node *node,
return walker(((MinMaxExpr *) node)->args, context);
case T_XmlExpr:
{
- XmlExpr *xexpr = (XmlExpr *) node;
-
+ XmlExpr *xexpr = (XmlExpr *) node;
+
if (walker(xexpr->named_args, context))
return true;
/* we assume walker doesn't care about arg_names */
@@ -3853,15 +3856,15 @@ expression_tree_mutator(Node *node,
switch (nodeTag(node))
{
- /*
- * Primitive node types with no expression subnodes. Var and Const
- * are frequent enough to deserve special cases, the others we just
- * use copyObject for.
- */
+ /*
+ * Primitive node types with no expression subnodes. Var and
+ * Const are frequent enough to deserve special cases, the others
+ * we just use copyObject for.
+ */
case T_Var:
{
- Var *var = (Var *) node;
- Var *newnode;
+ Var *var = (Var *) node;
+ Var *newnode;
FLATCOPY(newnode, var, Var);
return (Node *) newnode;
@@ -4130,8 +4133,8 @@ expression_tree_mutator(Node *node,
break;
case T_XmlExpr:
{
- XmlExpr *xexpr = (XmlExpr *) node;
- XmlExpr *newnode;
+ XmlExpr *xexpr = (XmlExpr *) node;
+ XmlExpr *newnode;
FLATCOPY(newnode, xexpr, XmlExpr);
MUTATE(newnode->named_args, xexpr->named_args, List *);
diff --git a/src/backend/optimizer/util/joininfo.c b/src/backend/optimizer/util/joininfo.c
index 6a31a02835..9fc68a0f6d 100644
--- a/src/backend/optimizer/util/joininfo.c
+++ b/src/backend/optimizer/util/joininfo.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/joininfo.c,v 1.48 2007/02/16 00:14:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/joininfo.c,v 1.49 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,8 +56,8 @@ have_relevant_joinclause(PlannerInfo *root,
}
/*
- * We also need to check the EquivalenceClass data structure, which
- * might contain relationships not emitted into the joininfo lists.
+ * We also need to check the EquivalenceClass data structure, which might
+ * contain relationships not emitted into the joininfo lists.
*/
if (!result && rel1->has_eclass_joins && rel2->has_eclass_joins)
result = have_relevant_eclass_joinclause(root, rel1, rel2);
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index bd95a0e0e2..d6bfa2e35f 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.140 2007/05/04 01:13:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.141 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -771,7 +771,7 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath)
/*
* Try to identify the targetlist that will actually be unique-ified. In
* current usage, this routine is only used for sub-selects of IN clauses,
- * so we should be able to find the tlist in in_info_list. Get the IN
+ * so we should be able to find the tlist in in_info_list. Get the IN
* clause's operators, too, because they determine what "unique" means.
*/
sub_targetlist = NIL;
@@ -931,7 +931,7 @@ translate_sub_tlist(List *tlist, int relid)
*
* colnos is an integer list of output column numbers (resno's). We are
* interested in whether rows consisting of just these columns are certain
- * to be distinct. "Distinctness" is defined according to whether the
+ * to be distinct. "Distinctness" is defined according to whether the
* corresponding upper-level equality operators listed in opids would think
* the values are distinct. (Note: the opids entries could be cross-type
* operators, and thus not exactly the equality operators that the subquery
@@ -948,8 +948,8 @@ query_is_distinct_for(Query *query, List *colnos, List *opids)
/*
* DISTINCT (including DISTINCT ON) guarantees uniqueness if all the
- * columns in the DISTINCT clause appear in colnos and operator
- * semantics match.
+ * columns in the DISTINCT clause appear in colnos and operator semantics
+ * match.
*/
if (query->distinctClause)
{
@@ -1004,9 +1004,8 @@ query_is_distinct_for(Query *query, List *colnos, List *opids)
*
* XXX this code knows that prepunion.c will adopt the default ordering
* operator for each column datatype as the sortop. It'd probably be
- * better if these operators were chosen at parse time and stored into
- * the parsetree, instead of leaving bits of the planner to decide
- * semantics.
+ * better if these operators were chosen at parse time and stored into the
+ * parsetree, instead of leaving bits of the planner to decide semantics.
*/
if (query->setOperations)
{
@@ -1028,7 +1027,7 @@ query_is_distinct_for(Query *query, List *colnos, List *opids)
opid = distinct_col_search(tle->resno, colnos, opids);
if (!OidIsValid(opid) ||
!ops_in_same_btree_opfamily(opid,
- ordering_oper_opid(exprType((Node *) tle->expr))))
+ ordering_oper_opid(exprType((Node *) tle->expr))))
break; /* exit early if no match */
}
if (l == NULL) /* had matches for all? */
@@ -1048,7 +1047,7 @@ query_is_distinct_for(Query *query, List *colnos, List *opids)
* distinct_col_search - subroutine for query_is_distinct_for
*
* If colno is in colnos, return the corresponding element of opids,
- * else return InvalidOid. (We expect colnos does not contain duplicates,
+ * else return InvalidOid. (We expect colnos does not contain duplicates,
* so the result is well-defined.)
*/
static Oid
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index 21dd342593..5c11418e0d 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.137 2007/09/20 17:56:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.138 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -166,9 +166,9 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
}
/*
- * If the index is valid, but cannot yet be used, ignore it;
- * but mark the plan we are generating as transient.
- * See src/backend/access/heap/README.HOT for discussion.
+ * If the index is valid, but cannot yet be used, ignore it; but
+ * mark the plan we are generating as transient. See
+ * src/backend/access/heap/README.HOT for discussion.
*/
if (index->indcheckxmin &&
!TransactionIdPrecedes(HeapTupleHeaderGetXmin(indexRelation->rd_indextuple->t_data),
@@ -187,7 +187,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
/*
* Allocate per-column info arrays. To save a few palloc cycles
- * we allocate all the Oid-type arrays in one request. Note that
+ * we allocate all the Oid-type arrays in one request. Note that
* the opfamily array needs an extra, terminating zero at the end.
* We pre-zero the ordering info in case the index is unordered.
*/
@@ -221,9 +221,9 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
for (i = 0; i < ncolumns; i++)
{
- int16 opt = indexRelation->rd_indoption[i];
- int fwdstrat;
- int revstrat;
+ int16 opt = indexRelation->rd_indoption[i];
+ int fwdstrat;
+ int revstrat;
if (opt & INDOPTION_DESC)
{
@@ -235,10 +235,11 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
fwdstrat = BTLessStrategyNumber;
revstrat = BTGreaterStrategyNumber;
}
+
/*
- * Index AM must have a fixed set of strategies for it
- * to make sense to specify amcanorder, so we
- * need not allow the case amstrategies == 0.
+ * Index AM must have a fixed set of strategies for it to
+ * make sense to specify amcanorder, so we need not allow
+ * the case amstrategies == 0.
*/
if (fwdstrat > 0)
{
diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c
index 3280612dfd..53f8db6d22 100644
--- a/src/backend/optimizer/util/predtest.c
+++ b/src/backend/optimizer/util/predtest.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.16 2007/07/24 17:22:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.17 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1109,7 +1109,7 @@ list_member_strip(List *list, Expr *datum)
foreach(cell, list)
{
- Expr *elem = (Expr *) lfirst(cell);
+ Expr *elem = (Expr *) lfirst(cell);
if (elem && IsA(elem, RelabelType))
elem = ((RelabelType *) elem)->arg;
@@ -1342,7 +1342,8 @@ btree_predicate_proof(Expr *predicate, Node *clause, bool refute_it)
*
* We must find a btree opfamily that contains both operators, else the
* implication can't be determined. Also, the opfamily must contain a
- * suitable test operator taking the pred_const and clause_const datatypes.
+ * suitable test operator taking the pred_const and clause_const
+ * datatypes.
*
* If there are multiple matching opfamilies, assume we can use any one to
* determine the logical relationship of the two operators and the correct
@@ -1354,8 +1355,8 @@ btree_predicate_proof(Expr *predicate, Node *clause, bool refute_it)
0, 0, 0);
/*
- * If we couldn't find any opfamily containing the pred_op, perhaps it is a
- * <> operator. See if it has a negator that is in an opfamily.
+ * If we couldn't find any opfamily containing the pred_op, perhaps it is
+ * a <> operator. See if it has a negator that is in an opfamily.
*/
pred_op_negated = false;
if (catlist->n_members == 0)
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
index 56f8f3493c..b205195998 100644
--- a/src/backend/optimizer/util/relnode.c
+++ b/src/backend/optimizer/util/relnode.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.87 2007/04/21 21:01:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.88 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,9 +32,9 @@ typedef struct JoinHashEntry
static void build_joinrel_tlist(PlannerInfo *root, RelOptInfo *joinrel,
RelOptInfo *input_rel);
static List *build_joinrel_restrictlist(PlannerInfo *root,
- RelOptInfo *joinrel,
- RelOptInfo *outer_rel,
- RelOptInfo *inner_rel);
+ RelOptInfo *joinrel,
+ RelOptInfo *outer_rel,
+ RelOptInfo *inner_rel);
static void build_joinrel_joinlist(RelOptInfo *joinrel,
RelOptInfo *outer_rel,
RelOptInfo *inner_rel);
@@ -510,8 +510,9 @@ build_joinrel_restrictlist(PlannerInfo *root,
*/
result = subbuild_joinrel_restrictlist(joinrel, outer_rel->joininfo, NIL);
result = subbuild_joinrel_restrictlist(joinrel, inner_rel->joininfo, result);
+
/*
- * Add on any clauses derived from EquivalenceClasses. These cannot be
+ * Add on any clauses derived from EquivalenceClasses. These cannot be
* redundant with the clauses in the joininfo lists, so don't bother
* checking.
*/
@@ -599,10 +600,10 @@ subbuild_joinrel_joinlist(RelOptInfo *joinrel,
{
/*
* This clause is still a join clause at this level, so add it to
- * the new joininfo list, being careful to eliminate
- * duplicates. (Since RestrictInfo nodes in different joinlists
- * will have been multiply-linked rather than copied, pointer
- * equality should be a sufficient test.)
+ * the new joininfo list, being careful to eliminate duplicates.
+ * (Since RestrictInfo nodes in different joinlists will have been
+ * multiply-linked rather than copied, pointer equality should be
+ * a sufficient test.)
*/
new_joininfo = list_append_unique_ptr(new_joininfo, rinfo);
}
diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c
index 8251e75d65..6a843c8c04 100644
--- a/src/backend/optimizer/util/restrictinfo.c
+++ b/src/backend/optimizer/util/restrictinfo.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.53 2007/01/22 20:00:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.54 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -534,7 +534,7 @@ extract_actual_join_clauses(List *restrictinfo_list,
*
* Given a list of RestrictInfo clauses that are to be applied in a join,
* select the ones that are not redundant with any clause in the
- * reference_list. This is used only for nestloop-with-inner-indexscan
+ * reference_list. This is used only for nestloop-with-inner-indexscan
* joins: any clauses being checked by the index should be removed from
* the qpquals list.
*
diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c
index d2ac14cfa1..7073f0b1e8 100644
--- a/src/backend/optimizer/util/tlist.c
+++ b/src/backend/optimizer/util/tlist.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/tlist.c,v 1.76 2007/11/08 21:49:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/tlist.c,v 1.77 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,7 +61,7 @@ tlist_member_ignore_relabel(Node *node, List *targetlist)
foreach(temp, targetlist)
{
TargetEntry *tlentry = (TargetEntry *) lfirst(temp);
- Expr *tlexpr = tlentry->expr;
+ Expr *tlexpr = tlentry->expr;
while (tlexpr && IsA(tlexpr, RelabelType))
tlexpr = ((RelabelType *) tlexpr)->arg;
diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c
index efb1ad9343..75564f2b5f 100644
--- a/src/backend/optimizer/util/var.c
+++ b/src/backend/optimizer/util/var.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.71 2007/09/20 17:56:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.72 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -166,7 +166,7 @@ pull_varattnos_walker(Node *node, Bitmapset **varattnos)
Assert(var->varno == 1);
*varattnos = bms_add_member(*varattnos,
- var->varattno - FirstLowInvalidHeapAttributeNumber);
+ var->varattno - FirstLowInvalidHeapAttributeNumber);
return false;
}
/* Should not find a subquery or subplan */
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 099a7c7446..ed837f1ca6 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -17,7 +17,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.369 2007/10/25 13:48:57 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.370 2007/11/15 21:14:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,7 +61,7 @@ static List *transformReturningList(ParseState *pstate, List *returningList);
static Query *transformDeclareCursorStmt(ParseState *pstate,
DeclareCursorStmt *stmt);
static Query *transformExplainStmt(ParseState *pstate,
- ExplainStmt *stmt);
+ ExplainStmt *stmt);
static void transformLockingClause(Query *qry, LockingClause *lc);
static bool check_parameter_resolution_walker(Node *node,
check_parameter_resolution_context *context);
@@ -77,7 +77,7 @@ static bool check_parameter_resolution_walker(Node *node,
* Optionally, information about $n parameter types can be supplied.
* References to $n indexes not defined by paramTypes[] are disallowed.
*
- * The result is a Query node. Optimizable statements require considerable
+ * The result is a Query node. Optimizable statements require considerable
* transformation, while utility-type statements are simply hung off
* a dummy CMD_UTILITY Query node.
*/
@@ -1565,7 +1565,7 @@ transformReturningList(ParseState *pstate, List *returningList)
if (list_length(pstate->p_rtable) != length_rtable)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("RETURNING cannot contain references to other relations")));
+ errmsg("RETURNING cannot contain references to other relations")));
/* mark column origins */
markTargetListOrigins(pstate, rlist);
@@ -1620,21 +1620,21 @@ transformDeclareCursorStmt(ParseState *pstate, DeclareCursorStmt *stmt)
if (result->rowMarks != NIL && (stmt->options & CURSOR_OPT_HOLD))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("DECLARE CURSOR WITH HOLD ... FOR UPDATE/SHARE is not supported"),
+ errmsg("DECLARE CURSOR WITH HOLD ... FOR UPDATE/SHARE is not supported"),
errdetail("Holdable cursors must be READ ONLY.")));
/* FOR UPDATE and SCROLL are not compatible */
if (result->rowMarks != NIL && (stmt->options & CURSOR_OPT_SCROLL))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("DECLARE SCROLL CURSOR ... FOR UPDATE/SHARE is not supported"),
+ errmsg("DECLARE SCROLL CURSOR ... FOR UPDATE/SHARE is not supported"),
errdetail("Scrollable cursors must be READ ONLY.")));
/* FOR UPDATE and INSENSITIVE are not compatible */
if (result->rowMarks != NIL && (stmt->options & CURSOR_OPT_INSENSITIVE))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("DECLARE INSENSITIVE CURSOR ... FOR UPDATE/SHARE is not supported"),
+ errmsg("DECLARE INSENSITIVE CURSOR ... FOR UPDATE/SHARE is not supported"),
errdetail("Insensitive cursors must be READ ONLY.")));
/* We won't need the raw querytree any more */
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index 473ba15252..0c45ab3bb2 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.192 2007/09/24 01:29:29 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/keywords.c,v 1.193 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -387,13 +387,14 @@ static const ScanKeyword ScanKeywords[] = {
{"when", WHEN, RESERVED_KEYWORD},
{"where", WHERE, RESERVED_KEYWORD},
{"whitespace", WHITESPACE_P, UNRESERVED_KEYWORD},
+
/*
* XXX we mark WITH as reserved to force it to be quoted in dumps, even
* though it is currently unreserved according to gram.y. This is because
* we expect we'll have to make it reserved to implement SQL WITH clauses.
* If that patch manages to do without reserving WITH, adjust this entry
- * at that time; in any case this should be back in sync with gram.y
- * after WITH clauses are implemented.
+ * at that time; in any case this should be back in sync with gram.y after
+ * WITH clauses are implemented.
*/
{"with", WITH, RESERVED_KEYWORD},
{"without", WITHOUT, UNRESERVED_KEYWORD},
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index 28717020e3..174e96adac 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.166 2007/06/23 22:12:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.167 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -152,8 +152,8 @@ setTargetTable(ParseState *pstate, RangeVar *relation,
* Open target rel and grab suitable lock (which we will hold till end of
* transaction).
*
- * free_parsestate() will eventually do the corresponding
- * heap_close(), but *not* release the lock.
+ * free_parsestate() will eventually do the corresponding heap_close(),
+ * but *not* release the lock.
*/
pstate->p_target_relation = heap_openrv(relation, RowExclusiveLock);
@@ -1665,21 +1665,22 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle,
restype,
restype,
false);
+
/*
- * Verify it's a valid ordering operator, and determine
- * whether to consider it like ASC or DESC.
+ * Verify it's a valid ordering operator, and determine whether to
+ * consider it like ASC or DESC.
*/
if (!get_compare_function_for_ordering_op(sortop,
&cmpfunc, &reverse))
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
- errmsg("operator %s is not a valid ordering operator",
- strVal(llast(sortby_opname))),
+ errmsg("operator %s is not a valid ordering operator",
+ strVal(llast(sortby_opname))),
errhint("Ordering operators must be \"<\" or \">\" members of btree operator families.")));
break;
default:
elog(ERROR, "unrecognized sortby_dir: %d", sortby_dir);
- sortop = InvalidOid; /* keep compiler quiet */
+ sortop = InvalidOid; /* keep compiler quiet */
reverse = false;
break;
}
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 79bfe4f7e3..98b9aba238 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.157 2007/09/06 17:31:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.158 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,10 +37,10 @@ static Node *coerce_type_typmod(Node *node,
bool hideInputCoercion);
static void hide_coercion_node(Node *node);
static Node *build_coercion_expression(Node *node,
- CoercionPathType pathtype,
- Oid funcId,
- Oid targetTypeId, int32 targetTypMod,
- CoercionForm cformat, bool isExplicit);
+ CoercionPathType pathtype,
+ Oid funcId,
+ Oid targetTypeId, int32 targetTypMod,
+ CoercionForm cformat, bool isExplicit);
static Node *coerce_record_to_complex(ParseState *pstate, Node *node,
Oid targetTypeId,
CoercionContext ccontext,
@@ -142,7 +142,7 @@ coerce_type(ParseState *pstate, Node *node,
*
* Note: by returning the unmodified node here, we are saying that
* it's OK to treat an UNKNOWN constant as a valid input for a
- * function accepting ANY, ANYELEMENT, or ANYNONARRAY. This should be
+ * function accepting ANY, ANYELEMENT, or ANYNONARRAY. This should be
* all right, since an UNKNOWN value is still a perfectly valid Datum.
* However an UNKNOWN value is definitely *not* an array, and so we
* mustn't accept it for ANYARRAY. (Instead, we will call anyarray_in
@@ -271,12 +271,13 @@ coerce_type(ParseState *pstate, Node *node,
}
param->paramtype = targetTypeId;
+
/*
* Note: it is tempting here to set the Param's paramtypmod to
* targetTypeMod, but that is probably unwise because we have no
- * infrastructure that enforces that the value delivered for a
- * Param will match any particular typmod. Leaving it -1 ensures
- * that a run-time length check/coercion will occur if needed.
+ * infrastructure that enforces that the value delivered for a Param
+ * will match any particular typmod. Leaving it -1 ensures that a
+ * run-time length check/coercion will occur if needed.
*/
param->paramtypmod = -1;
@@ -720,10 +721,11 @@ build_coercion_expression(Node *node,
acoerce->arg = (Expr *) node;
acoerce->elemfuncid = funcId;
acoerce->resulttype = targetTypeId;
+
/*
* Label the output as having a particular typmod only if we are
- * really invoking a length-coercion function, ie one with more
- * than one argument.
+ * really invoking a length-coercion function, ie one with more than
+ * one argument.
*/
acoerce->resulttypmod = (nargs >= 2) ? targetTypMod : -1;
acoerce->isExplicit = isExplicit;
@@ -934,10 +936,10 @@ coerce_to_specific_type(ParseState *pstate, Node *node,
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
/* translator: first %s is name of a SQL construct, eg LIMIT */
- errmsg("argument of %s must be type %s, not type %s",
- constructName,
- format_type_be(targetTypeId),
- format_type_be(inputTypeId))));
+ errmsg("argument of %s must be type %s, not type %s",
+ constructName,
+ format_type_be(targetTypeId),
+ format_type_be(inputTypeId))));
}
if (expression_returns_set(node))
@@ -1304,7 +1306,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
/*
* Fast Track: if none of the arguments are polymorphic, return the
- * unmodified rettype. We assume it can't be polymorphic either.
+ * unmodified rettype. We assume it can't be polymorphic either.
*/
if (!have_generics)
return rettype;
@@ -1359,8 +1361,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (type_is_array(elem_typeid))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("type matched to anynonarray is an array type: %s",
- format_type_be(elem_typeid))));
+ errmsg("type matched to anynonarray is an array type: %s",
+ format_type_be(elem_typeid))));
}
if (have_anyenum)
@@ -1921,13 +1923,12 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
/*
* If we still haven't found a possibility, consider automatic casting
* using I/O functions. We allow assignment casts to textual types
- * and explicit casts from textual types to be handled this way.
- * (The CoerceViaIO mechanism is a lot more general than that, but
- * this is all we want to allow in the absence of a pg_cast entry.)
- * It would probably be better to insist on explicit casts in both
- * directions, but this is a compromise to preserve something of the
- * pre-8.3 behavior that many types had implicit (yipes!) casts to
- * text.
+ * and explicit casts from textual types to be handled this way. (The
+ * CoerceViaIO mechanism is a lot more general than that, but this is
+ * all we want to allow in the absence of a pg_cast entry.) It would
+ * probably be better to insist on explicit casts in both directions,
+ * but this is a compromise to preserve something of the pre-8.3
+ * behavior that many types had implicit (yipes!) casts to text.
*/
if (result == COERCION_PATH_NONE)
{
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 52957e825e..85800ea3ea 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.223 2007/11/11 19:22:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.224 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,10 +56,10 @@ static Node *transformArrayExpr(ParseState *pstate, ArrayExpr *a);
static Node *transformRowExpr(ParseState *pstate, RowExpr *r);
static Node *transformCoalesceExpr(ParseState *pstate, CoalesceExpr *c);
static Node *transformMinMaxExpr(ParseState *pstate, MinMaxExpr *m);
-static Node *transformXmlExpr(ParseState *pstate, XmlExpr *x);
-static Node *transformXmlSerialize(ParseState *pstate, XmlSerialize *xs);
+static Node *transformXmlExpr(ParseState *pstate, XmlExpr * x);
+static Node *transformXmlSerialize(ParseState *pstate, XmlSerialize * xs);
static Node *transformBooleanTest(ParseState *pstate, BooleanTest *b);
-static Node *transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr);
+static Node *transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr * cexpr);
static Node *transformColumnRef(ParseState *pstate, ColumnRef *cref);
static Node *transformWholeRowRef(ParseState *pstate, char *schemaname,
char *relname, int location);
@@ -545,7 +545,7 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref)
static Oid *
find_param_type(ParseState *pstate, int paramno)
{
- Oid *result;
+ Oid *result;
/*
* Find topmost ParseState, which is where paramtype info lives.
@@ -612,7 +612,7 @@ exprIsNullConstant(Node *arg)
{
if (arg && IsA(arg, A_Const))
{
- A_Const *con = (A_Const *) arg;
+ A_Const *con = (A_Const *) arg;
if (con->val.type == T_Null &&
con->typename == NULL)
@@ -1411,10 +1411,10 @@ transformMinMaxExpr(ParseState *pstate, MinMaxExpr *m)
}
static Node *
-transformXmlExpr(ParseState *pstate, XmlExpr *x)
+transformXmlExpr(ParseState *pstate, XmlExpr * x)
{
- XmlExpr *newx = makeNode(XmlExpr);
- ListCell *lc;
+ XmlExpr *newx = makeNode(XmlExpr);
+ ListCell *lc;
int i;
newx->op = x->op;
@@ -1424,7 +1424,7 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
newx->name = NULL;
/*
- * gram.y built the named args as a list of ResTarget. Transform each,
+ * gram.y built the named args as a list of ResTarget. Transform each,
* and break the names out as a separate list.
*/
newx->named_args = NIL;
@@ -1432,9 +1432,9 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
foreach(lc, x->named_args)
{
- ResTarget *r = (ResTarget *) lfirst(lc);
- Node *expr;
- char *argname;
+ ResTarget *r = (ResTarget *) lfirst(lc);
+ Node *expr;
+ char *argname;
Assert(IsA(r, ResTarget));
@@ -1450,7 +1450,7 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
x->op == IS_XMLELEMENT
- ? errmsg("unnamed XML attribute value must be a column reference")
+ ? errmsg("unnamed XML attribute value must be a column reference")
: errmsg("unnamed XML element value must be a column reference")));
argname = NULL; /* keep compiler quiet */
}
@@ -1465,7 +1465,7 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
{
foreach(lc, newx->arg_names)
{
- ListCell *lc2;
+ ListCell *lc2;
for_each_cell(lc2, lnext(lc))
{
@@ -1537,16 +1537,16 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
}
static Node *
-transformXmlSerialize(ParseState *pstate, XmlSerialize *xs)
+transformXmlSerialize(ParseState *pstate, XmlSerialize * xs)
{
Oid targetType;
int32 targetTypmod;
- XmlExpr *xexpr;
+ XmlExpr *xexpr;
xexpr = makeNode(XmlExpr);
xexpr->op = IS_XMLSERIALIZE;
xexpr->args = list_make1(coerce_to_specific_type(pstate,
- transformExpr(pstate, xs->expr),
+ transformExpr(pstate, xs->expr),
XMLOID,
"XMLSERIALIZE"));
@@ -1558,13 +1558,13 @@ transformXmlSerialize(ParseState *pstate, XmlSerialize *xs)
xexpr->typmod = targetTypmod;
/*
- * The actual target type is determined this way. SQL allows char
- * and varchar as target types. We allow anything that can be
- * cast implicitly from text. This way, user-defined text-like
- * data types automatically fit in.
+ * The actual target type is determined this way. SQL allows char and
+ * varchar as target types. We allow anything that can be cast implicitly
+ * from text. This way, user-defined text-like data types automatically
+ * fit in.
*/
return (Node *) coerce_to_target_type(pstate, (Node *) xexpr, TEXTOID, targetType, targetTypmod,
- COERCION_IMPLICIT, COERCE_IMPLICIT_CAST);
+ COERCION_IMPLICIT, COERCE_IMPLICIT_CAST);
}
static Node *
@@ -1608,9 +1608,9 @@ transformBooleanTest(ParseState *pstate, BooleanTest *b)
}
static Node *
-transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr *cexpr)
+transformCurrentOfExpr(ParseState *pstate, CurrentOfExpr * cexpr)
{
- int sublevels_up;
+ int sublevels_up;
/* CURRENT OF can only appear at top level of UPDATE/DELETE */
Assert(pstate->p_target_rangetblentry != NULL);
@@ -1851,7 +1851,7 @@ exprType(Node *expr)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find array type for data type %s",
- format_type_be(subplan->firstColType))));
+ format_type_be(subplan->firstColType))));
}
}
else
@@ -2153,8 +2153,8 @@ exprIsLengthCoercion(Node *expr, int32 *coercedTypmod)
*coercedTypmod = -1; /* default result on failure */
/*
- * Scalar-type length coercions are FuncExprs, array-type length
- * coercions are ArrayCoerceExprs
+ * Scalar-type length coercions are FuncExprs, array-type length coercions
+ * are ArrayCoerceExprs
*/
if (expr && IsA(expr, FuncExpr))
{
@@ -2336,9 +2336,9 @@ make_row_comparison_op(ParseState *pstate, List *opname,
/*
* Now we must determine which row comparison semantics (= <> < <= > >=)
- * apply to this set of operators. We look for btree opfamilies containing
- * the operators, and see which interpretations (strategy numbers) exist
- * for each operator.
+ * apply to this set of operators. We look for btree opfamilies
+ * containing the operators, and see which interpretations (strategy
+ * numbers) exist for each operator.
*/
opfamily_lists = (List **) palloc(nopers * sizeof(List *));
opstrat_lists = (List **) palloc(nopers * sizeof(List *));
@@ -2421,7 +2421,7 @@ make_row_comparison_op(ParseState *pstate, List *opname,
}
if (OidIsValid(opfamily))
opfamilies = lappend_oid(opfamilies, opfamily);
- else /* should not happen */
+ else /* should not happen */
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("could not determine interpretation of row comparison operator %s",
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 76dcd29185..f8264688f0 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.198 2007/11/11 19:22:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.199 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -727,9 +727,9 @@ func_get_detail(List *funcname,
* This interpretation needs to be given higher priority than
* interpretations involving a type coercion followed by a function
* call, otherwise we can produce surprising results. For example, we
- * want "text(varchar)" to be interpreted as a simple coercion, not
- * as "text(name(varchar))" which the code below this point is
- * entirely capable of selecting.
+ * want "text(varchar)" to be interpreted as a simple coercion, not as
+ * "text(name(varchar))" which the code below this point is entirely
+ * capable of selecting.
*
* We also treat a coercion of a previously-unknown-type literal
* constant to a specific type this way.
@@ -738,8 +738,8 @@ func_get_detail(List *funcname,
* cast implementation function to be named after the target type.
* Thus the function will be found by normal lookup if appropriate.
*
- * The reason we reject COERCION_PATH_ARRAYCOERCE is mainly that
- * you can't write "foo[] (something)" as a function call. In theory
+ * The reason we reject COERCION_PATH_ARRAYCOERCE is mainly that you
+ * can't write "foo[] (something)" as a function call. In theory
* someone might want to invoke it as "_foo (something)" but we have
* never supported that historically, so we can insist that people
* write it as a normal cast instead. Lack of historical support is
@@ -747,7 +747,7 @@ func_get_detail(List *funcname,
*
* NB: it's important that this code does not exceed what coerce_type
* can do, because the caller will try to apply coerce_type if we
- * return FUNCDETAIL_COERCION. If we return that result for something
+ * return FUNCDETAIL_COERCION. If we return that result for something
* coerce_type can't handle, we'll cause infinite recursion between
* this module and coerce_type!
*/
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index a51a4d6215..3367ee2a87 100644
--- a/src/backend/parser/parse_oper.c
+++ b/src/backend/parser/parse_oper.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.96 2007/11/11 19:22:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.97 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -887,8 +887,8 @@ make_scalar_array_op(ParseState *pstate, List *opname,
/*
* enforce consistency with polymorphic argument and return types,
- * possibly adjusting return type or declared_arg_types (which will
- * be used as the cast destination by make_fn_arguments)
+ * possibly adjusting return type or declared_arg_types (which will be
+ * used as the cast destination by make_fn_arguments)
*/
rettype = enforce_generic_type_consistency(actual_arg_types,
declared_arg_types,
@@ -997,8 +997,8 @@ make_op_expr(ParseState *pstate, Operator op,
/*
* enforce consistency with polymorphic argument and return types,
- * possibly adjusting return type or declared_arg_types (which will
- * be used as the cast destination by make_fn_arguments)
+ * possibly adjusting return type or declared_arg_types (which will be
+ * used as the cast destination by make_fn_arguments)
*/
rettype = enforce_generic_type_consistency(actual_arg_types,
declared_arg_types,
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index af26c4c1c9..e8122ad14b 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.156 2007/09/27 17:42:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.157 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -827,8 +827,8 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref,
*
* Since the grammar only accepts bare '*' at top level of SELECT, we
* need not handle the targetlist==false case here. However, we must
- * test for it because the grammar currently fails to distinguish
- * a quoted name "*" from a real asterisk.
+ * test for it because the grammar currently fails to distinguish a
+ * quoted name "*" from a real asterisk.
*/
if (!targetlist)
elog(ERROR, "invalid use of *");
@@ -1320,8 +1320,8 @@ FigureColnameInternal(Node *node, char **name)
break;
case T_XmlExpr:
/* make SQL/XML functions act like a regular function */
- switch (((XmlExpr*) node)->op)
- {
+ switch (((XmlExpr *) node)->op)
+ {
case IS_XMLCONCAT:
*name = "xmlconcat";
return 2;
@@ -1346,7 +1346,7 @@ FigureColnameInternal(Node *node, char **name)
case IS_DOCUMENT:
/* nothing */
break;
- }
+ }
break;
case T_XmlSerialize:
*name = "xmlserialize";
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index e61cf08576..6de2adf7a3 100644
--- a/src/backend/parser/parse_type.c
+++ b/src/backend/parser/parse_type.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.92 2007/11/11 19:22:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.93 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,13 +27,13 @@
static int32 typenameTypeMod(ParseState *pstate, const TypeName *typename,
- Type typ);
+ Type typ);
/*
* LookupTypeName
* Given a TypeName object, lookup the pg_type syscache entry of the type.
- * Returns NULL if no such type can be found. If the type is found,
+ * Returns NULL if no such type can be found. If the type is found,
* the typmod value represented in the TypeName struct is computed and
* stored into *typmod_p.
*
@@ -46,7 +46,7 @@ static int32 typenameTypeMod(ParseState *pstate, const TypeName *typename,
*
* typmod_p can be passed as NULL if the caller does not care to know the
* typmod value, but the typmod decoration (if any) will be validated anyway,
- * except in the case where the type is not found. Note that if the type is
+ * except in the case where the type is not found. Note that if the type is
* found but is a shell, and there is typmod decoration, an error will be
* thrown --- this is intentional.
*
@@ -252,15 +252,15 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
return typename->typemod;
/*
- * Else, type had better accept typmods. We give a special error
- * message for the shell-type case, since a shell couldn't possibly
- * have a typmodin function.
+ * Else, type had better accept typmods. We give a special error message
+ * for the shell-type case, since a shell couldn't possibly have a
+ * typmodin function.
*/
if (!((Form_pg_type) GETSTRUCT(typ))->typisdefined)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("type modifier cannot be specified for shell type \"%s\"",
- TypeNameToString(typename)),
+ errmsg("type modifier cannot be specified for shell type \"%s\"",
+ TypeNameToString(typename)),
parser_errposition(pstate, typename->location)));
typmodin = ((Form_pg_type) GETSTRUCT(typ))->typmodin;
@@ -281,24 +281,24 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
n = 0;
foreach(l, typename->typmods)
{
- Node *tm = (Node *) lfirst(l);
- char *cstr = NULL;
+ Node *tm = (Node *) lfirst(l);
+ char *cstr = NULL;
if (IsA(tm, A_Const))
{
- A_Const *ac = (A_Const *) tm;
+ A_Const *ac = (A_Const *) tm;
/*
- * The grammar hands back some integers with ::int4 attached,
- * so allow a cast decoration if it's an Integer value, but
- * not otherwise.
+ * The grammar hands back some integers with ::int4 attached, so
+ * allow a cast decoration if it's an Integer value, but not
+ * otherwise.
*/
if (IsA(&ac->val, Integer))
{
cstr = (char *) palloc(32);
snprintf(cstr, 32, "%ld", (long) ac->val.val.ival);
}
- else if (ac->typename == NULL) /* no casts allowed */
+ else if (ac->typename == NULL) /* no casts allowed */
{
/* otherwise we can just use the str field directly. */
cstr = ac->val.val.str;
@@ -306,7 +306,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
}
else if (IsA(tm, ColumnRef))
{
- ColumnRef *cr = (ColumnRef *) tm;
+ ColumnRef *cr = (ColumnRef *) tm;
if (list_length(cr->fields) == 1)
cstr = strVal(linitial(cr->fields));
@@ -314,7 +314,7 @@ typenameTypeMod(ParseState *pstate, const TypeName *typename, Type typ)
if (!cstr)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("type modifiers must be simple constants or identifiers"),
+ errmsg("type modifiers must be simple constants or identifiers"),
parser_errposition(pstate, typename->location)));
datums[n++] = CStringGetDatum(cstr);
}
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index a6306a435c..2ff6f9274d 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -19,7 +19,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.5 2007/11/11 19:22:49 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.6 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -98,13 +98,13 @@ static void transformTableConstraint(ParseState *pstate,
Constraint *constraint);
static void transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
InhRelation *inhrelation);
-static IndexStmt *generateClonedIndexStmt(CreateStmtContext *cxt,
- Relation parent_index, AttrNumber *attmap);
+static IndexStmt *generateClonedIndexStmt(CreateStmtContext *cxt,
+ Relation parent_index, AttrNumber *attmap);
static List *get_opclass(Oid opclass, Oid actual_datatype);
static void transformIndexConstraints(ParseState *pstate,
CreateStmtContext *cxt);
static IndexStmt *transformIndexConstraint(Constraint *constraint,
- CreateStmtContext *cxt);
+ CreateStmtContext *cxt);
static void transformFKConstraints(ParseState *pstate,
CreateStmtContext *cxt,
bool skipValidation,
@@ -138,21 +138,21 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString)
ListCell *elements;
/*
- * We must not scribble on the passed-in CreateStmt, so copy it. (This
- * is overkill, but easy.)
+ * We must not scribble on the passed-in CreateStmt, so copy it. (This is
+ * overkill, but easy.)
*/
stmt = (CreateStmt *) copyObject(stmt);
/*
* If the target relation name isn't schema-qualified, make it so. This
* prevents some corner cases in which added-on rewritten commands might
- * think they should apply to other relations that have the same name
- * and are earlier in the search path. "istemp" is equivalent to a
+ * think they should apply to other relations that have the same name and
+ * are earlier in the search path. "istemp" is equivalent to a
* specification of pg_temp, so no need for anything extra in that case.
*/
if (stmt->relation->schemaname == NULL && !stmt->relation->istemp)
{
- Oid namespaceid = RangeVarGetCreationNamespace(stmt->relation);
+ Oid namespaceid = RangeVarGetCreationNamespace(stmt->relation);
stmt->relation->schemaname = get_namespace_name(namespaceid);
}
@@ -580,8 +580,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
}
/*
- * Insert the copied attributes into the cxt for the new table
- * definition.
+ * Insert the copied attributes into the cxt for the new table definition.
*/
for (parent_attno = 1; parent_attno <= tupleDesc->natts;
parent_attno++)
@@ -650,8 +649,8 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
}
/*
- * Copy CHECK constraints if requested, being careful to adjust
- * attribute numbers
+ * Copy CHECK constraints if requested, being careful to adjust attribute
+ * numbers
*/
if (including_constraints && tupleDesc->constr)
{
@@ -687,9 +686,9 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
foreach(l, parent_indexes)
{
- Oid parent_index_oid = lfirst_oid(l);
- Relation parent_index;
- IndexStmt *index_stmt;
+ Oid parent_index_oid = lfirst_oid(l);
+ Relation parent_index;
+ IndexStmt *index_stmt;
parent_index = index_open(parent_index_oid, AccessShareLock);
@@ -723,25 +722,25 @@ static IndexStmt *
generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
AttrNumber *attmap)
{
- HeapTuple ht_idx;
- HeapTuple ht_idxrel;
- HeapTuple ht_am;
- Form_pg_index idxrec;
- Form_pg_class idxrelrec;
- Form_pg_am amrec;
- List *indexprs = NIL;
- ListCell *indexpr_item;
- Oid indrelid;
- Oid source_relid;
- int keyno;
- Oid keycoltype;
- Datum indclassDatum;
- Datum indoptionDatum;
- bool isnull;
- oidvector *indclass;
- int2vector *indoption;
- IndexStmt *index;
- Datum reloptions;
+ HeapTuple ht_idx;
+ HeapTuple ht_idxrel;
+ HeapTuple ht_am;
+ Form_pg_index idxrec;
+ Form_pg_class idxrelrec;
+ Form_pg_am amrec;
+ List *indexprs = NIL;
+ ListCell *indexpr_item;
+ Oid indrelid;
+ Oid source_relid;
+ int keyno;
+ Oid keycoltype;
+ Datum indclassDatum;
+ Datum indoptionDatum;
+ bool isnull;
+ oidvector *indclass;
+ int2vector *indoption;
+ IndexStmt *index;
+ Datum reloptions;
source_relid = RelationGetRelid(source_idx);
@@ -825,7 +824,7 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
for (keyno = 0; keyno < idxrec->indnatts; keyno++)
{
- IndexElem *iparam;
+ IndexElem *iparam;
AttrNumber attnum = idxrec->indkey.values[keyno];
int16 opt = indoption->values[keyno];
@@ -914,9 +913,9 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
static List *
get_opclass(Oid opclass, Oid actual_datatype)
{
- HeapTuple ht_opc;
- Form_pg_opclass opc_rec;
- List *result = NIL;
+ HeapTuple ht_opc;
+ Form_pg_opclass opc_rec;
+ List *result = NIL;
ht_opc = SearchSysCache(CLAOID,
ObjectIdGetDatum(opclass),
@@ -928,8 +927,8 @@ get_opclass(Oid opclass, Oid actual_datatype)
if (!OidIsValid(actual_datatype) ||
GetDefaultOpClass(actual_datatype, opc_rec->opcmethod) != opclass)
{
- char *nsp_name = get_namespace_name(opc_rec->opcnamespace);
- char *opc_name = NameStr(opc_rec->opcname);
+ char *nsp_name = get_namespace_name(opc_rec->opcnamespace);
+ char *opc_name = NameStr(opc_rec->opcname);
result = list_make2(makeString(nsp_name), makeString(opc_name));
}
@@ -1038,9 +1037,9 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
static IndexStmt *
transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
{
- IndexStmt *index;
- ListCell *keys;
- IndexElem *iparam;
+ IndexStmt *index;
+ ListCell *keys;
+ IndexElem *iparam;
Assert(constraint->contype == CONSTR_PRIMARY ||
constraint->contype == CONSTR_UNIQUE);
@@ -1054,8 +1053,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
if (cxt->pkey != NULL)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
- errmsg("multiple primary keys for table \"%s\" are not allowed",
- cxt->relation->relname)));
+ errmsg("multiple primary keys for table \"%s\" are not allowed",
+ cxt->relation->relname)));
cxt->pkey = index;
/*
@@ -1068,7 +1067,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
if (constraint->name != NULL)
index->idxname = pstrdup(constraint->name);
else
- index->idxname = NULL; /* DefineIndex will choose name */
+ index->idxname = NULL; /* DefineIndex will choose name */
index->relation = cxt->relation;
index->accessMethod = DEFAULT_INDEX_TYPE;
@@ -1079,10 +1078,10 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
index->concurrent = false;
/*
- * Make sure referenced keys exist. If we are making a PRIMARY KEY
- * index, also make sure they are NOT NULL, if possible. (Although we
- * could leave it to DefineIndex to mark the columns NOT NULL, it's
- * more efficient to get it right the first time.)
+ * Make sure referenced keys exist. If we are making a PRIMARY KEY index,
+ * also make sure they are NOT NULL, if possible. (Although we could leave
+ * it to DefineIndex to mark the columns NOT NULL, it's more efficient to
+ * get it right the first time.)
*/
foreach(keys, constraint->keys)
{
@@ -1110,9 +1109,9 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
else if (SystemAttributeByName(key, cxt->hasoids) != NULL)
{
/*
- * column will be a system column in the new table, so accept
- * it. System columns can't ever be null, so no need to worry
- * about PRIMARY/NOT NULL constraint.
+ * column will be a system column in the new table, so accept it.
+ * System columns can't ever be null, so no need to worry about
+ * PRIMARY/NOT NULL constraint.
*/
found = true;
}
@@ -1132,8 +1131,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
if (rel->rd_rel->relkind != RELKIND_RELATION)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
- errmsg("inherited relation \"%s\" is not a table",
- inh->relname)));
+ errmsg("inherited relation \"%s\" is not a table",
+ inh->relname)));
for (count = 0; count < rel->rd_att->natts; count++)
{
Form_pg_attribute inhattr = rel->rd_att->attrs[count];
@@ -1146,10 +1145,10 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
found = true;
/*
- * We currently have no easy way to force an
- * inherited column to be NOT NULL at creation, if
- * its parent wasn't so already. We leave it to
- * DefineIndex to fix things up in this case.
+ * We currently have no easy way to force an inherited
+ * column to be NOT NULL at creation, if its parent
+ * wasn't so already. We leave it to DefineIndex to
+ * fix things up in this case.
*/
break;
}
@@ -1162,9 +1161,9 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
/*
* In the ALTER TABLE case, don't complain about index keys not
- * created in the command; they may well exist already.
- * DefineIndex will complain about them if not, and will also take
- * care of marking them NOT NULL.
+ * created in the command; they may well exist already. DefineIndex
+ * will complain about them if not, and will also take care of marking
+ * them NOT NULL.
*/
if (!found && !cxt->isalter)
ereport(ERROR,
@@ -1186,8 +1185,8 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
else
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_COLUMN),
- errmsg("column \"%s\" appears twice in unique constraint",
- key)));
+ errmsg("column \"%s\" appears twice in unique constraint",
+ key)));
}
}
@@ -1269,7 +1268,7 @@ transformFKConstraints(ParseState *pstate, CreateStmtContext *cxt,
* transformIndexStmt - parse analysis for CREATE INDEX
*
* Note: this is a no-op for an index not using either index expressions or
- * a predicate expression. There are several code paths that create indexes
+ * a predicate expression. There are several code paths that create indexes
* without bothering to call this, because they know they don't have any
* such expressions to deal with.
*/
@@ -1282,28 +1281,28 @@ transformIndexStmt(IndexStmt *stmt, const char *queryString)
ListCell *l;
/*
- * We must not scribble on the passed-in IndexStmt, so copy it. (This
- * is overkill, but easy.)
+ * We must not scribble on the passed-in IndexStmt, so copy it. (This is
+ * overkill, but easy.)
*/
stmt = (IndexStmt *) copyObject(stmt);
/*
- * Open the parent table with appropriate locking. We must do this
+ * Open the parent table with appropriate locking. We must do this
* because addRangeTableEntry() would acquire only AccessShareLock,
- * leaving DefineIndex() needing to do a lock upgrade with consequent
- * risk of deadlock. Make sure this stays in sync with the type of
- * lock DefineIndex() wants.
+ * leaving DefineIndex() needing to do a lock upgrade with consequent risk
+ * of deadlock. Make sure this stays in sync with the type of lock
+ * DefineIndex() wants.
*/
rel = heap_openrv(stmt->relation,
- (stmt->concurrent ? ShareUpdateExclusiveLock : ShareLock));
+ (stmt->concurrent ? ShareUpdateExclusiveLock : ShareLock));
/* Set up pstate */
pstate = make_parsestate(NULL);
pstate->p_sourcetext = queryString;
/*
- * Put the parent table into the rtable so that the expressions can
- * refer to its fields without qualification.
+ * Put the parent table into the rtable so that the expressions can refer
+ * to its fields without qualification.
*/
rte = addRangeTableEntry(pstate, stmt->relation, NULL, false, true);
@@ -1432,7 +1431,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
/* take care of the where clause */
*whereClause = transformWhereClause(pstate,
- (Node *) copyObject(stmt->whereClause),
+ (Node *) copyObject(stmt->whereClause),
"WHERE");
if (list_length(pstate->p_rtable) != 2) /* naughty, naughty... */
@@ -1458,7 +1457,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
nothing_qry->commandType = CMD_NOTHING;
nothing_qry->rtable = pstate->p_rtable;
- nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */
+ nothing_qry->jointree = makeFromExpr(NIL, NULL); /* no join wanted */
*actions = list_make1(nothing_qry);
}
@@ -1480,8 +1479,8 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
has_new;
/*
- * Since outer ParseState isn't parent of inner, have to pass
- * down the query text by hand.
+ * Since outer ParseState isn't parent of inner, have to pass down
+ * the query text by hand.
*/
sub_pstate->p_sourcetext = queryString;
@@ -1650,17 +1649,17 @@ transformAlterTableStmt(AlterTableStmt *stmt, const char *queryString)
AlterTableCmd *newcmd;
/*
- * We must not scribble on the passed-in AlterTableStmt, so copy it.
- * (This is overkill, but easy.)
+ * We must not scribble on the passed-in AlterTableStmt, so copy it. (This
+ * is overkill, but easy.)
*/
stmt = (AlterTableStmt *) copyObject(stmt);
/*
- * Acquire exclusive lock on the target relation, which will be held
- * until end of transaction. This ensures any decisions we make here
- * based on the state of the relation will still be good at execution.
- * We must get exclusive lock now because execution will; taking a lower
- * grade lock now and trying to upgrade later risks deadlock.
+ * Acquire exclusive lock on the target relation, which will be held until
+ * end of transaction. This ensures any decisions we make here based on
+ * the state of the relation will still be good at execution. We must get
+ * exclusive lock now because execution will; taking a lower grade lock
+ * now and trying to upgrade later risks deadlock.
*/
rel = relation_openrv(stmt->relation, AccessExclusiveLock);
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index b9c0b9a985..4a16c7eac7 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -14,7 +14,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.71 2007/01/09 02:14:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.72 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,8 +28,8 @@
List *parsetree; /* result of parsing is left here */
-static bool have_lookahead; /* is lookahead info valid? */
-static int lookahead_token; /* one-token lookahead */
+static bool have_lookahead; /* is lookahead info valid? */
+static int lookahead_token; /* one-token lookahead */
static YYSTYPE lookahead_yylval; /* yylval for lookahead token */
static YYLTYPE lookahead_yylloc; /* yylloc for lookahead token */
@@ -98,6 +98,7 @@ filtered_base_yylex(void)
switch (cur_token)
{
case NULLS_P:
+
/*
* NULLS FIRST and NULLS LAST must be reduced to one token
*/
@@ -126,6 +127,7 @@ filtered_base_yylex(void)
break;
case WITH:
+
/*
* WITH CASCADED, LOCAL, or CHECK must be reduced to one token
*
diff --git a/src/backend/port/dynloader/darwin.c b/src/backend/port/dynloader/darwin.c
index 8d01c554a0..8d84bcfbb9 100644
--- a/src/backend/port/dynloader/darwin.c
+++ b/src/backend/port/dynloader/darwin.c
@@ -4,7 +4,7 @@
* If dlopen() is available (Darwin 10.3 and later), we just use it.
* Otherwise we emulate it with the older, now deprecated, NSLinkModule API.
*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/darwin.c,v 1.11 2006/10/08 19:31:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/darwin.c,v 1.12 2007/11/15 21:14:37 momjian Exp $
*/
#include "postgres.h"
@@ -43,8 +43,7 @@ pg_dlerror(void)
{
return dlerror();
}
-
-#else /* !HAVE_DLOPEN */
+#else /* !HAVE_DLOPEN */
/*
* These routines were taken from the Apache source, but were made
@@ -132,4 +131,4 @@ pg_dlerror(void)
return (char *) errorString;
}
-#endif /* HAVE_DLOPEN */
+#endif /* HAVE_DLOPEN */
diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index 08662d1fb3..b9b8e8453f 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -10,7 +10,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.51 2007/07/02 20:11:54 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.52 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -247,7 +247,7 @@ PGSharedMemoryIsInUse(unsigned long id1, unsigned long id2)
/*
* Try to attach to the segment and see if it matches our data directory.
* This avoids shmid-conflict problems on machines that are running
- * several postmasters under the same userid.
+ * several postmasters under the same userid.
*/
if (stat(DataDir, &statbuf) < 0)
return true; /* if can't stat, be conservative */
diff --git a/src/backend/port/win32/mingwcompat.c b/src/backend/port/win32/mingwcompat.c
index 20b8cc7ee7..7b6581192d 100644
--- a/src/backend/port/win32/mingwcompat.c
+++ b/src/backend/port/win32/mingwcompat.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32/mingwcompat.c,v 1.2 2007/10/29 14:04:42 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32/mingwcompat.c,v 1.3 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -14,7 +14,7 @@
#include "postgres.h"
/*
- * This file contains loaders for functions that are missing in the MinGW
+ * This file contains loaders for functions that are missing in the MinGW
* import libraries. It's only for actual Win32 API functions, so they are
* all present in proper Win32 compilers.
*/
@@ -36,7 +36,7 @@ LoadKernel32()
if (kernel32 == NULL)
ereport(FATAL,
(errmsg_internal("could not load kernel32.dll: %d",
- (int)GetLastError())));
+ (int) GetLastError())));
}
@@ -44,11 +44,12 @@ LoadKernel32()
* Replacement for RegisterWaitForSingleObject(), which lives in
* kernel32.dll·
*/
-typedef BOOL (WINAPI * __RegisterWaitForSingleObject)
- (PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG);
+typedef
+BOOL(WINAPI * __RegisterWaitForSingleObject)
+(PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG);
static __RegisterWaitForSingleObject _RegisterWaitForSingleObject = NULL;
-BOOL WINAPI
+BOOL WINAPI
RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
HANDLE hObject,
WAITORTIMERCALLBACK Callback,
@@ -66,7 +67,7 @@ RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
if (_RegisterWaitForSingleObject == NULL)
ereport(FATAL,
(errmsg_internal("could not locate RegisterWaitForSingleObject in kernel32.dll: %d",
- (int)GetLastError())));
+ (int) GetLastError())));
}
return (_RegisterWaitForSingleObject)
@@ -74,4 +75,3 @@ RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
}
#endif
-
diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socket.c
index 3c6fbdb60d..93d8f55d73 100644
--- a/src/backend/port/win32/socket.c
+++ b/src/backend/port/win32/socket.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.18 2007/06/04 13:39:28 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.19 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -103,14 +103,15 @@ pgwin32_poll_signals(void)
}
static int
-isDataGram(SOCKET s) {
- int type;
- int typelen = sizeof(type);
+isDataGram(SOCKET s)
+{
+ int type;
+ int typelen = sizeof(type);
- if ( getsockopt(s, SOL_SOCKET, SO_TYPE, (char*)&type, &typelen) )
+ if (getsockopt(s, SOL_SOCKET, SO_TYPE, (char *) &type, &typelen))
return 1;
- return ( type == SOCK_DGRAM ) ? 1 : 0;
+ return (type == SOCK_DGRAM) ? 1 : 0;
}
int
@@ -118,7 +119,7 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
{
static HANDLE waitevent = INVALID_HANDLE_VALUE;
static SOCKET current_socket = -1;
- static int isUDP = 0;
+ static int isUDP = 0;
HANDLE events[2];
int r;
@@ -139,9 +140,9 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
* socket from a previous call
*/
- if (current_socket != s)
+ if (current_socket != s)
{
- if ( current_socket != -1 )
+ if (current_socket != -1)
WSAEventSelect(current_socket, waitevent, 0);
isUDP = isDataGram(s);
}
@@ -157,34 +158,32 @@ pgwin32_waitforsinglesocket(SOCKET s, int what, int timeout)
events[0] = pgwin32_signal_event;
events[1] = waitevent;
- /*
- * Just a workaround of unknown locking problem with writing
- * in UDP socket under high load:
- * Client's pgsql backend sleeps infinitely in
- * WaitForMultipleObjectsEx, pgstat process sleeps in
- * pgwin32_select(). So, we will wait with small
- * timeout(0.1 sec) and if sockect is still blocked,
- * try WSASend (see comments in pgwin32_select) and wait again.
+ /*
+ * Just a workaround of unknown locking problem with writing in UDP socket
+ * under high load: Client's pgsql backend sleeps infinitely in
+ * WaitForMultipleObjectsEx, pgstat process sleeps in pgwin32_select().
+ * So, we will wait with small timeout(0.1 sec) and if sockect is still
+ * blocked, try WSASend (see comments in pgwin32_select) and wait again.
*/
if ((what & FD_WRITE) && isUDP)
{
- for(;;)
+ for (;;)
{
r = WaitForMultipleObjectsEx(2, events, FALSE, 100, TRUE);
- if ( r == WAIT_TIMEOUT )
+ if (r == WAIT_TIMEOUT)
{
- char c;
- WSABUF buf;
- DWORD sent;
+ char c;
+ WSABUF buf;
+ DWORD sent;
buf.buf = &c;
buf.len = 0;
r = WSASend(s, &buf, 1, &sent, 0, NULL, NULL);
- if (r == 0) /* Completed - means things are fine! */
+ if (r == 0) /* Completed - means things are fine! */
return 1;
- else if ( WSAGetLastError() != WSAEWOULDBLOCK )
+ else if (WSAGetLastError() != WSAEWOULDBLOCK)
{
TranslateSocketError();
return 0;
@@ -291,7 +290,7 @@ pgwin32_recv(SOCKET s, char *buf, int len, int f)
int r;
DWORD b;
DWORD flags = f;
- int n;
+ int n;
if (pgwin32_poll_signals())
return -1;
@@ -317,8 +316,8 @@ pgwin32_recv(SOCKET s, char *buf, int len, int f)
{
if (pgwin32_waitforsinglesocket(s, FD_READ | FD_CLOSE | FD_ACCEPT,
INFINITE) == 0)
- return -1; /* errno already set */
-
+ return -1; /* errno already set */
+
r = WSARecv(s, &wbuf, 1, &b, &flags, NULL, NULL);
if (r == SOCKET_ERROR)
{
@@ -326,10 +325,11 @@ pgwin32_recv(SOCKET s, char *buf, int len, int f)
{
/*
* There seem to be cases on win2k (at least) where WSARecv
- * can return WSAEWOULDBLOCK even when pgwin32_waitforsinglesocket
- * claims the socket is readable. In this case, just sleep for a
- * moment and try again. We try up to 5 times - if it fails more than
- * that it's not likely to ever come back.
+ * can return WSAEWOULDBLOCK even when
+ * pgwin32_waitforsinglesocket claims the socket is readable.
+ * In this case, just sleep for a moment and try again. We try
+ * up to 5 times - if it fails more than that it's not likely
+ * to ever come back.
*/
pg_usleep(10000);
continue;
@@ -340,7 +340,7 @@ pgwin32_recv(SOCKET s, char *buf, int len, int f)
return b;
}
ereport(NOTICE,
- (errmsg_internal("Failed to read from ready socket (after retries)")));
+ (errmsg_internal("Failed to read from ready socket (after retries)")));
errno = EWOULDBLOCK;
return -1;
}
@@ -359,11 +359,11 @@ pgwin32_send(SOCKET s, char *buf, int len, int flags)
wbuf.buf = buf;
/*
- * Readiness of socket to send data to UDP socket
- * may be not true: socket can become busy again! So loop
- * until send or error occurs.
+ * Readiness of socket to send data to UDP socket may be not true: socket
+ * can become busy again! So loop until send or error occurs.
*/
- for(;;) {
+ for (;;)
+ {
r = WSASend(s, &wbuf, 1, &b, flags, NULL, NULL);
if (r != SOCKET_ERROR && b > 0)
/* Write succeeded right away */
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index b8300f00cf..060fc06dfa 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -21,21 +21,21 @@
* There is an autovacuum shared memory area, where the launcher stores
* information about the database it wants vacuumed. When it wants a new
* worker to start, it sets a flag in shared memory and sends a signal to the
- * postmaster. Then postmaster knows nothing more than it must start a worker;
- * so it forks a new child, which turns into a worker. This new process
+ * postmaster. Then postmaster knows nothing more than it must start a worker;
+ * so it forks a new child, which turns into a worker. This new process
* connects to shared memory, and there it can inspect the information that the
* launcher has set up.
*
* If the fork() call fails in the postmaster, it sets a flag in the shared
* memory area, and sends a signal to the launcher. The launcher, upon
* noticing the flag, can try starting the worker again by resending the
- * signal. Note that the failure can only be transient (fork failure due to
+ * signal. Note that the failure can only be transient (fork failure due to
* high load, memory pressure, too many processes, etc); more permanent
* problems, like failure to connect to a database, are detected later in the
* worker and dealt with just by having the worker exit normally. The launcher
* will launch a new worker again later, per schedule.
*
- * When the worker is done vacuuming it sends SIGUSR1 to the launcher. The
+ * When the worker is done vacuuming it sends SIGUSR1 to the launcher. The
* launcher then wakes up and is able to launch another worker, if the schedule
* is so tight that a new worker is needed immediately. At this time the
* launcher can also balance the settings for the various remaining workers'
@@ -55,7 +55,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.67 2007/10/29 22:17:41 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.68 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -141,10 +141,10 @@ static MemoryContext AutovacMemCxt;
/* struct to keep track of databases in launcher */
typedef struct avl_dbase
{
- Oid adl_datid; /* hash key -- must be first */
- TimestampTz adl_next_worker;
+ Oid adl_datid; /* hash key -- must be first */
+ TimestampTz adl_next_worker;
int adl_score;
-} avl_dbase;
+} avl_dbase;
/* struct to keep track of databases in worker */
typedef struct avw_dbase
@@ -153,14 +153,14 @@ typedef struct avw_dbase
char *adw_name;
TransactionId adw_frozenxid;
PgStat_StatDBEntry *adw_entry;
-} avw_dbase;
+} avw_dbase;
/* struct to keep track of tables to vacuum and/or analyze, in 1st pass */
typedef struct av_relation
{
- Oid ar_relid;
- Oid ar_toastrelid;
-} av_relation;
+ Oid ar_relid;
+ Oid ar_toastrelid;
+} av_relation;
/* struct to keep track of tables to vacuum and/or analyze, after rechecking */
typedef struct autovac_table
@@ -198,11 +198,11 @@ typedef struct WorkerInfoData
Oid wi_dboid;
Oid wi_tableoid;
PGPROC *wi_proc;
- TimestampTz wi_launchtime;
+ TimestampTz wi_launchtime;
int wi_cost_delay;
int wi_cost_limit;
int wi_cost_limit_base;
-} WorkerInfoData;
+} WorkerInfoData;
typedef struct WorkerInfoData *WorkerInfo;
@@ -211,16 +211,16 @@ typedef struct WorkerInfoData *WorkerInfo;
* stored atomically in shared memory so that other processes can set them
* without locking.
*/
-typedef enum
+typedef enum
{
- AutoVacForkFailed, /* failed trying to start a worker */
- AutoVacRebalance, /* rebalance the cost limits */
- AutoVacNumSignals = AutoVacRebalance /* must be last */
+ AutoVacForkFailed, /* failed trying to start a worker */
+ AutoVacRebalance, /* rebalance the cost limits */
+ AutoVacNumSignals = AutoVacRebalance /* must be last */
} AutoVacuumSignal;
/*-------------
* The main autovacuum shmem struct. On shared memory we store this main
- * struct and the array of WorkerInfo structs. This struct keeps:
+ * struct and the array of WorkerInfo structs. This struct keeps:
*
* av_signal set by other processes to indicate various conditions
* av_launcherpid the PID of the autovacuum launcher
@@ -235,12 +235,12 @@ typedef enum
*/
typedef struct
{
- sig_atomic_t av_signal[AutoVacNumSignals];
- pid_t av_launcherpid;
- SHMEM_OFFSET av_freeWorkers;
- SHM_QUEUE av_runningWorkers;
- SHMEM_OFFSET av_startingWorker;
-} AutoVacuumShmemStruct;
+ sig_atomic_t av_signal[AutoVacNumSignals];
+ pid_t av_launcherpid;
+ SHMEM_OFFSET av_freeWorkers;
+ SHM_QUEUE av_runningWorkers;
+ SHMEM_OFFSET av_startingWorker;
+} AutoVacuumShmemStruct;
static AutoVacuumShmemStruct *AutoVacuumShmem;
@@ -249,10 +249,10 @@ static Dllist *DatabaseList = NULL;
static MemoryContext DatabaseListCxt = NULL;
/* Pointer to my own WorkerInfo, valid on each worker */
-static WorkerInfo MyWorkerInfo = NULL;
+static WorkerInfo MyWorkerInfo = NULL;
/* PID of launcher, valid only in worker while shutting down */
-int AutovacuumLauncherPid = 0;
+int AutovacuumLauncherPid = 0;
#ifdef EXEC_BACKEND
static pid_t avlauncher_forkexec(void);
@@ -261,20 +261,20 @@ static pid_t avworker_forkexec(void);
NON_EXEC_STATIC void AutoVacWorkerMain(int argc, char *argv[]);
NON_EXEC_STATIC void AutoVacLauncherMain(int argc, char *argv[]);
-static Oid do_start_worker(void);
+static Oid do_start_worker(void);
static void launcher_determine_sleep(bool canlaunch, bool recursing,
- struct timeval *nap);
+ struct timeval * nap);
static void launch_worker(TimestampTz now);
static List *get_database_list(void);
static void rebuild_database_list(Oid newdb);
-static int db_comparator(const void *a, const void *b);
+static int db_comparator(const void *a, const void *b);
static void autovac_balance_cost(void);
static void do_autovacuum(void);
static void FreeWorkerInfo(int code, Datum arg);
static void relation_check_autovac(Oid relid, Form_pg_class classForm,
- Form_pg_autovacuum avForm, PgStat_StatTabEntry *tabentry,
+ Form_pg_autovacuum avForm, PgStat_StatTabEntry *tabentry,
List **table_oids, List **table_toast_list,
List **toast_oids);
static autovac_table *table_recheck_autovac(Oid relid);
@@ -300,7 +300,7 @@ static void autovac_refresh_stats(void);
/********************************************************************
- * AUTOVACUUM LAUNCHER CODE
+ * AUTOVACUUM LAUNCHER CODE
********************************************************************/
#ifdef EXEC_BACKEND
@@ -403,9 +403,9 @@ AutoVacLauncherMain(int argc, char *argv[])
/*
* If possible, make this process a group leader, so that the postmaster
- * can signal any child processes too. (autovacuum probably never has
- * any child processes, but for consistency we make all postmaster
- * child processes do this.)
+ * can signal any child processes too. (autovacuum probably never has any
+ * child processes, but for consistency we make all postmaster child
+ * processes do this.)
*/
#ifdef HAVE_SETSID
if (setsid() < 0)
@@ -475,7 +475,7 @@ AutoVacLauncherMain(int argc, char *argv[])
/*
* These operations are really just a minimal subset of
- * AbortTransaction(). We don't have very many resources to worry
+ * AbortTransaction(). We don't have very many resources to worry
* about, but we do have LWLocks.
*/
LWLockReleaseAll();
@@ -525,7 +525,7 @@ AutoVacLauncherMain(int argc, char *argv[])
if (!AutoVacuumingActive())
{
do_start_worker();
- proc_exit(0); /* done */
+ proc_exit(0); /* done */
}
AutoVacuumShmem->av_launcherpid = MyProcPid;
@@ -543,8 +543,8 @@ AutoVacLauncherMain(int argc, char *argv[])
{
struct timeval nap;
TimestampTz current_time = 0;
- bool can_launch;
- Dlelem *elem;
+ bool can_launch;
+ Dlelem *elem;
/*
* Emergency bailout if postmaster has died. This is to avoid the
@@ -554,7 +554,7 @@ AutoVacLauncherMain(int argc, char *argv[])
exit(1);
launcher_determine_sleep(AutoVacuumShmem->av_freeWorkers !=
- INVALID_OFFSET, false, &nap);
+ INVALID_OFFSET, false, &nap);
/*
* Sleep for a while according to schedule.
@@ -566,7 +566,7 @@ AutoVacLauncherMain(int argc, char *argv[])
*/
while (nap.tv_sec > 0 || nap.tv_usec > 0)
{
- uint32 sleeptime;
+ uint32 sleeptime;
if (nap.tv_sec > 0)
{
@@ -643,7 +643,7 @@ AutoVacLauncherMain(int argc, char *argv[])
* of a worker will continue to fail in the same way.
*/
AutoVacuumShmem->av_signal[AutoVacForkFailed] = false;
- pg_usleep(100000L); /* 100ms */
+ pg_usleep(100000L); /* 100ms */
SendPostmasterSignal(PMSIGNAL_START_AUTOVAC_WORKER);
continue;
}
@@ -652,8 +652,8 @@ AutoVacLauncherMain(int argc, char *argv[])
/*
* There are some conditions that we need to check before trying to
* start a launcher. First, we need to make sure that there is a
- * launcher slot available. Second, we need to make sure that no other
- * worker failed while starting up.
+ * launcher slot available. Second, we need to make sure that no
+ * other worker failed while starting up.
*/
current_time = GetCurrentTimestamp();
@@ -663,23 +663,24 @@ AutoVacLauncherMain(int argc, char *argv[])
if (AutoVacuumShmem->av_startingWorker != INVALID_OFFSET)
{
- int waittime;
+ int waittime;
- WorkerInfo worker = (WorkerInfo) MAKE_PTR(AutoVacuumShmem->av_startingWorker);
+ WorkerInfo worker = (WorkerInfo) MAKE_PTR(AutoVacuumShmem->av_startingWorker);
/*
* We can't launch another worker when another one is still
* starting up (or failed while doing so), so just sleep for a bit
* more; that worker will wake us up again as soon as it's ready.
- * We will only wait autovacuum_naptime seconds (up to a maximum of
- * 60 seconds) for this to happen however. Note that failure to
- * connect to a particular database is not a problem here, because
- * the worker removes itself from the startingWorker pointer before
- * trying to connect. Problems detected by the postmaster (like
- * fork() failure) are also reported and handled differently. The
- * only problems that may cause this code to fire are errors in the
- * earlier sections of AutoVacWorkerMain, before the worker removes
- * the WorkerInfo from the startingWorker pointer.
+ * We will only wait autovacuum_naptime seconds (up to a maximum
+ * of 60 seconds) for this to happen however. Note that failure
+ * to connect to a particular database is not a problem here,
+ * because the worker removes itself from the startingWorker
+ * pointer before trying to connect. Problems detected by the
+ * postmaster (like fork() failure) are also reported and handled
+ * differently. The only problems that may cause this code to
+ * fire are errors in the earlier sections of AutoVacWorkerMain,
+ * before the worker removes the WorkerInfo from the
+ * startingWorker pointer.
*/
waittime = Min(autovacuum_naptime, 60) * 1000;
if (TimestampDifferenceExceeds(worker->wi_launchtime, current_time,
@@ -687,6 +688,7 @@ AutoVacLauncherMain(int argc, char *argv[])
{
LWLockRelease(AutovacuumLock);
LWLockAcquire(AutovacuumLock, LW_EXCLUSIVE);
+
/*
* No other process can put a worker in starting mode, so if
* startingWorker is still INVALID after exchanging our lock,
@@ -709,7 +711,7 @@ AutoVacLauncherMain(int argc, char *argv[])
else
can_launch = false;
}
- LWLockRelease(AutovacuumLock); /* either shared or exclusive */
+ LWLockRelease(AutovacuumLock); /* either shared or exclusive */
/* if we can't do anything, just go back to sleep */
if (!can_launch)
@@ -720,10 +722,11 @@ AutoVacLauncherMain(int argc, char *argv[])
elem = DLGetTail(DatabaseList);
if (elem != NULL)
{
- avl_dbase *avdb = DLE_VAL(elem);
+ avl_dbase *avdb = DLE_VAL(elem);
/*
- * launch a worker if next_worker is right now or it is in the past
+ * launch a worker if next_worker is right now or it is in the
+ * past
*/
if (TimestampDifferenceExceeds(avdb->adl_next_worker,
current_time, 0))
@@ -748,7 +751,7 @@ AutoVacLauncherMain(int argc, char *argv[])
(errmsg("autovacuum launcher shutting down")));
AutoVacuumShmem->av_launcherpid = 0;
- proc_exit(0); /* done */
+ proc_exit(0); /* done */
}
/*
@@ -759,14 +762,14 @@ AutoVacLauncherMain(int argc, char *argv[])
* cause a long sleep, which will be interrupted when a worker exits.
*/
static void
-launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval *nap)
+launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval * nap)
{
- Dlelem *elem;
+ Dlelem *elem;
/*
* We sleep until the next scheduled vacuum. We trust that when the
- * database list was built, care was taken so that no entries have times in
- * the past; if the first entry has too close a next_worker value, or a
+ * database list was built, care was taken so that no entries have times
+ * in the past; if the first entry has too close a next_worker value, or a
* time in the past, we will sleep a small nominal time.
*/
if (!canlaunch)
@@ -777,10 +780,10 @@ launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval *nap)
else if ((elem = DLGetTail(DatabaseList)) != NULL)
{
avl_dbase *avdb = DLE_VAL(elem);
- TimestampTz current_time = GetCurrentTimestamp();
- TimestampTz next_wakeup;
- long secs;
- int usecs;
+ TimestampTz current_time = GetCurrentTimestamp();
+ TimestampTz next_wakeup;
+ long secs;
+ int usecs;
next_wakeup = avdb->adl_next_worker;
TimestampDifference(current_time, next_wakeup, &secs, &usecs);
@@ -829,7 +832,7 @@ launcher_determine_sleep(bool canlaunch, bool recursing, struct timeval *nap)
* this the "new" database, because when the database was already present on
* the list, we expect that this function is not called at all). The
* preexisting list, if any, will be used to preserve the order of the
- * databases in the autovacuum_naptime period. The new database is put at the
+ * databases in the autovacuum_naptime period. The new database is put at the
* end of the interval. The actual values are not saved, which should not be
* much of a problem.
*/
@@ -864,14 +867,14 @@ rebuild_database_list(Oid newdb)
/*
* Implementing this is not as simple as it sounds, because we need to put
* the new database at the end of the list; next the databases that were
- * already on the list, and finally (at the tail of the list) all the other
- * databases that are not on the existing list.
+ * already on the list, and finally (at the tail of the list) all the
+ * other databases that are not on the existing list.
*
* To do this, we build an empty hash table of scored databases. We will
- * start with the lowest score (zero) for the new database, then increasing
- * scores for the databases in the existing list, in order, and lastly
- * increasing scores for all databases gotten via get_database_list() that
- * are not already on the hash.
+ * start with the lowest score (zero) for the new database, then
+ * increasing scores for the databases in the existing list, in order, and
+ * lastly increasing scores for all databases gotten via
+ * get_database_list() that are not already on the hash.
*
* Then we will put all the hash elements into an array, sort the array by
* score, and finally put the array elements into the new doubly linked
@@ -888,7 +891,7 @@ rebuild_database_list(Oid newdb)
score = 0;
if (OidIsValid(newdb))
{
- avl_dbase *db;
+ avl_dbase *db;
PgStat_StatDBEntry *entry;
/* only consider this database if it has a pgstat entry */
@@ -907,7 +910,7 @@ rebuild_database_list(Oid newdb)
/* Now insert the databases from the existing list */
if (DatabaseList != NULL)
{
- Dlelem *elem;
+ Dlelem *elem;
elem = DLGetHead(DatabaseList);
while (elem != NULL)
@@ -920,8 +923,8 @@ rebuild_database_list(Oid newdb)
elem = DLGetSucc(elem);
/*
- * skip databases with no stat entries -- in particular, this
- * gets rid of dropped databases
+ * skip databases with no stat entries -- in particular, this gets
+ * rid of dropped databases
*/
entry = pgstat_fetch_stat_dbentry(avdb->adl_datid);
if (entry == NULL)
@@ -969,12 +972,12 @@ rebuild_database_list(Oid newdb)
if (nelems > 0)
{
- TimestampTz current_time;
- int millis_increment;
- avl_dbase *dbary;
- avl_dbase *db;
- HASH_SEQ_STATUS seq;
- int i;
+ TimestampTz current_time;
+ int millis_increment;
+ avl_dbase *dbary;
+ avl_dbase *db;
+ HASH_SEQ_STATUS seq;
+ int i;
/* put all the hash elements into an array */
dbary = palloc(nelems * sizeof(avl_dbase));
@@ -992,7 +995,7 @@ rebuild_database_list(Oid newdb)
current_time = GetCurrentTimestamp();
/*
- * move the elements from the array into the dllist, setting the
+ * move the elements from the array into the dllist, setting the
* next_worker while walking the array
*/
for (i = 0; i < nelems; i++)
@@ -1033,7 +1036,7 @@ db_comparator(const void *a, const void *b)
*
* Bare-bones procedure for starting an autovacuum worker from the launcher.
* It determines what database to work on, sets up shared memory stuff and
- * signals postmaster to start the worker. It fails gracefully if invoked when
+ * signals postmaster to start the worker. It fails gracefully if invoked when
* autovacuum_workers are already active.
*
* Return value is the OID of the database that the worker is going to process,
@@ -1047,11 +1050,11 @@ do_start_worker(void)
TransactionId xidForceLimit;
bool for_xid_wrap;
avw_dbase *avdb;
- TimestampTz current_time;
+ TimestampTz current_time;
bool skipit = false;
Oid retval = InvalidOid;
MemoryContext tmpcxt,
- oldcxt;
+ oldcxt;
/* return quickly when there are no free workers */
LWLockAcquire(AutovacuumLock, LW_SHARED);
@@ -1080,8 +1083,8 @@ do_start_worker(void)
dblist = get_database_list();
/*
- * Determine the oldest datfrozenxid/relfrozenxid that we will allow
- * to pass without forcing a vacuum. (This limit can be tightened for
+ * Determine the oldest datfrozenxid/relfrozenxid that we will allow to
+ * pass without forcing a vacuum. (This limit can be tightened for
* particular tables, but not loosened.)
*/
recentXid = ReadNewTransactionId();
@@ -1121,7 +1124,7 @@ do_start_worker(void)
if (TransactionIdPrecedes(tmp->adw_frozenxid, xidForceLimit))
{
if (avdb == NULL ||
- TransactionIdPrecedes(tmp->adw_frozenxid, avdb->adw_frozenxid))
+ TransactionIdPrecedes(tmp->adw_frozenxid, avdb->adw_frozenxid))
avdb = tmp;
for_xid_wrap = true;
continue;
@@ -1151,7 +1154,7 @@ do_start_worker(void)
while (elem != NULL)
{
- avl_dbase *dbp = DLE_VAL(elem);
+ avl_dbase *dbp = DLE_VAL(elem);
if (dbp->adl_datid == tmp->adw_datid)
{
@@ -1160,7 +1163,7 @@ do_start_worker(void)
* the current time and the current time plus naptime.
*/
if (!TimestampDifferenceExceeds(dbp->adl_next_worker,
- current_time, 0) &&
+ current_time, 0) &&
!TimestampDifferenceExceeds(current_time,
dbp->adl_next_worker,
autovacuum_naptime * 1000))
@@ -1174,8 +1177,8 @@ do_start_worker(void)
continue;
/*
- * Remember the db with oldest autovac time. (If we are here,
- * both tmp->entry and db->entry must be non-null.)
+ * Remember the db with oldest autovac time. (If we are here, both
+ * tmp->entry and db->entry must be non-null.)
*/
if (avdb == NULL ||
tmp->adw_entry->last_autovac_time < avdb->adw_entry->last_autovac_time)
@@ -1192,7 +1195,8 @@ do_start_worker(void)
/*
* Get a worker entry from the freelist. We checked above, so there
- * really should be a free slot -- complain very loudly if there isn't.
+ * really should be a free slot -- complain very loudly if there
+ * isn't.
*/
sworker = AutoVacuumShmem->av_freeWorkers;
if (sworker == INVALID_OFFSET)
@@ -1243,8 +1247,8 @@ do_start_worker(void)
static void
launch_worker(TimestampTz now)
{
- Oid dbid;
- Dlelem *elem;
+ Oid dbid;
+ Dlelem *elem;
dbid = do_start_worker();
if (OidIsValid(dbid))
@@ -1256,7 +1260,7 @@ launch_worker(TimestampTz now)
elem = (DatabaseList == NULL) ? NULL : DLGetHead(DatabaseList);
while (elem != NULL)
{
- avl_dbase *avdb = DLE_VAL(elem);
+ avl_dbase *avdb = DLE_VAL(elem);
if (avdb->adl_datid == dbid)
{
@@ -1274,11 +1278,11 @@ launch_worker(TimestampTz now)
}
/*
- * If the database was not present in the database list, we rebuild the
- * list. It's possible that the database does not get into the list
- * anyway, for example if it's a database that doesn't have a pgstat
- * entry, but this is not a problem because we don't want to schedule
- * workers regularly into those in any case.
+ * If the database was not present in the database list, we rebuild
+ * the list. It's possible that the database does not get into the
+ * list anyway, for example if it's a database that doesn't have a
+ * pgstat entry, but this is not a problem because we don't want to
+ * schedule workers regularly into those in any case.
*/
if (elem == NULL)
rebuild_database_list(dbid);
@@ -1287,7 +1291,7 @@ launch_worker(TimestampTz now)
/*
* Called from postmaster to signal a failure to fork a process to become
- * worker. The postmaster should kill(SIGUSR1) the launcher shortly
+ * worker. The postmaster should kill(SIGUSR1) the launcher shortly
* after calling this function.
*/
void
@@ -1343,7 +1347,7 @@ avl_quickdie(SIGNAL_ARGS)
/********************************************************************
- * AUTOVACUUM WORKER CODE
+ * AUTOVACUUM WORKER CODE
********************************************************************/
#ifdef EXEC_BACKEND
@@ -1445,9 +1449,9 @@ AutoVacWorkerMain(int argc, char *argv[])
/*
* If possible, make this process a group leader, so that the postmaster
- * can signal any child processes too. (autovacuum probably never has
- * any child processes, but for consistency we make all postmaster
- * child processes do this.)
+ * can signal any child processes too. (autovacuum probably never has any
+ * child processes, but for consistency we make all postmaster child
+ * processes do this.)
*/
#ifdef HAVE_SETSID
if (setsid() < 0)
@@ -1465,8 +1469,8 @@ AutoVacWorkerMain(int argc, char *argv[])
pqsignal(SIGHUP, SIG_IGN);
/*
- * SIGINT is used to signal cancelling the current table's vacuum;
- * SIGTERM means abort and exit cleanly, and SIGQUIT means abandon ship.
+ * SIGINT is used to signal cancelling the current table's vacuum; SIGTERM
+ * means abort and exit cleanly, and SIGQUIT means abandon ship.
*/
pqsignal(SIGINT, StatementCancelHandler);
pqsignal(SIGTERM, die);
@@ -1538,9 +1542,10 @@ AutoVacWorkerMain(int argc, char *argv[])
LWLockAcquire(AutovacuumLock, LW_EXCLUSIVE);
/*
- * beware of startingWorker being INVALID; this should normally not happen,
- * but if a worker fails after forking and before this, the launcher might
- * have decided to remove it from the queue and start again.
+ * beware of startingWorker being INVALID; this should normally not
+ * happen, but if a worker fails after forking and before this, the
+ * launcher might have decided to remove it from the queue and start
+ * again.
*/
if (AutoVacuumShmem->av_startingWorker != INVALID_OFFSET)
{
@@ -1549,7 +1554,7 @@ AutoVacWorkerMain(int argc, char *argv[])
MyWorkerInfo->wi_proc = MyProc;
/* insert into the running list */
- SHMQueueInsertBefore(&AutoVacuumShmem->av_runningWorkers,
+ SHMQueueInsertBefore(&AutoVacuumShmem->av_runningWorkers,
&MyWorkerInfo->wi_links);
/*
@@ -1575,7 +1580,7 @@ AutoVacWorkerMain(int argc, char *argv[])
if (OidIsValid(dbid))
{
- char *dbname;
+ char *dbname;
/*
* Report autovac startup to the stats collector. We deliberately do
@@ -1629,7 +1634,7 @@ FreeWorkerInfo(int code, Datum arg)
/*
* Wake the launcher up so that he can launch a new worker immediately
* if required. We only save the launcher's PID in local memory here;
- * the actual signal will be sent when the PGPROC is recycled. Note
+ * the actual signal will be sent when the PGPROC is recycled. Note
* that we always do this, so that the launcher can rebalance the cost
* limit setting of the remaining workers.
*
@@ -1686,16 +1691,17 @@ static void
autovac_balance_cost(void)
{
WorkerInfo worker;
+
/*
* note: in cost_limit, zero also means use value from elsewhere, because
* zero is not a valid value.
*/
- int vac_cost_limit = (autovacuum_vac_cost_limit > 0 ?
- autovacuum_vac_cost_limit : VacuumCostLimit);
- int vac_cost_delay = (autovacuum_vac_cost_delay >= 0 ?
- autovacuum_vac_cost_delay : VacuumCostDelay);
- double cost_total;
- double cost_avail;
+ int vac_cost_limit = (autovacuum_vac_cost_limit > 0 ?
+ autovacuum_vac_cost_limit : VacuumCostLimit);
+ int vac_cost_delay = (autovacuum_vac_cost_delay >= 0 ?
+ autovacuum_vac_cost_delay : VacuumCostDelay);
+ double cost_total;
+ double cost_avail;
/* not set? nothing to do */
if (vac_cost_limit <= 0 || vac_cost_delay <= 0)
@@ -1715,15 +1721,15 @@ autovac_balance_cost(void)
worker = (WorkerInfo) SHMQueueNext(&AutoVacuumShmem->av_runningWorkers,
&worker->wi_links,
- offsetof(WorkerInfoData, wi_links));
+ offsetof(WorkerInfoData, wi_links));
}
/* there are no cost limits -- nothing to do */
if (cost_total <= 0)
return;
/*
- * Adjust each cost limit of active workers to balance the total of
- * cost limit to autovacuum_vacuum_cost_limit.
+ * Adjust each cost limit of active workers to balance the total of cost
+ * limit to autovacuum_vacuum_cost_limit.
*/
cost_avail = (double) vac_cost_limit / vac_cost_delay;
worker = (WorkerInfo) SHMQueueNext(&AutoVacuumShmem->av_runningWorkers,
@@ -1734,8 +1740,8 @@ autovac_balance_cost(void)
if (worker->wi_proc != NULL &&
worker->wi_cost_limit_base > 0 && worker->wi_cost_delay > 0)
{
- int limit = (int)
- (cost_avail * worker->wi_cost_limit_base / cost_total);
+ int limit = (int)
+ (cost_avail * worker->wi_cost_limit_base / cost_total);
/*
* We put a lower bound of 1 to the cost_limit, to avoid division-
@@ -1750,7 +1756,7 @@ autovac_balance_cost(void)
worker = (WorkerInfo) SHMQueueNext(&AutoVacuumShmem->av_runningWorkers,
&worker->wi_links,
- offsetof(WorkerInfoData, wi_links));
+ offsetof(WorkerInfoData, wi_links));
}
}
@@ -1781,7 +1787,7 @@ get_database_list(void)
while (read_pg_database_line(db_file, thisname, &db_id,
&db_tablespace, &db_frozenxid))
{
- avw_dbase *avdb;
+ avw_dbase *avdb;
avdb = (avw_dbase *) palloc(sizeof(avw_dbase));
@@ -1817,7 +1823,7 @@ do_autovacuum(void)
List *table_oids = NIL;
List *toast_oids = NIL;
List *table_toast_list = NIL;
- ListCell * volatile cell;
+ ListCell *volatile cell;
PgStat_StatDBEntry *shared;
PgStat_StatDBEntry *dbentry;
BufferAccessStrategy bstrategy;
@@ -1835,8 +1841,8 @@ do_autovacuum(void)
MemoryContextSwitchTo(AutovacMemCxt);
/*
- * may be NULL if we couldn't find an entry (only happens if we
- * are forcing a vacuum for anti-wrap purposes).
+ * may be NULL if we couldn't find an entry (only happens if we are
+ * forcing a vacuum for anti-wrap purposes).
*/
dbentry = pgstat_fetch_stat_dbentry(MyDatabaseId);
@@ -1854,9 +1860,9 @@ do_autovacuum(void)
pgstat_vacuum_tabstat();
/*
- * Find the pg_database entry and select the default freeze_min_age.
- * We use zero in template and nonconnectable databases,
- * else the system-wide default.
+ * Find the pg_database entry and select the default freeze_min_age. We
+ * use zero in template and nonconnectable databases, else the system-wide
+ * default.
*/
tuple = SearchSysCache(DATABASEOID,
ObjectIdGetDatum(MyDatabaseId),
@@ -1948,12 +1954,12 @@ do_autovacuum(void)
*/
foreach(cell, toast_oids)
{
- Oid toastoid = lfirst_oid(cell);
- ListCell *cell2;
+ Oid toastoid = lfirst_oid(cell);
+ ListCell *cell2;
foreach(cell2, table_toast_list)
{
- av_relation *ar = lfirst(cell2);
+ av_relation *ar = lfirst(cell2);
if (ar->ar_toastrelid == toastoid)
{
@@ -1969,9 +1975,9 @@ do_autovacuum(void)
toast_oids = NIL;
/*
- * Create a buffer access strategy object for VACUUM to use. We want
- * to use the same one across all the vacuum operations we perform,
- * since the point is for VACUUM not to blow out the shared cache.
+ * Create a buffer access strategy object for VACUUM to use. We want to
+ * use the same one across all the vacuum operations we perform, since the
+ * point is for VACUUM not to blow out the shared cache.
*/
bstrategy = GetAccessStrategy(BAS_VACUUM);
@@ -1990,10 +1996,10 @@ do_autovacuum(void)
*/
foreach(cell, table_oids)
{
- Oid relid = lfirst_oid(cell);
+ Oid relid = lfirst_oid(cell);
autovac_table *tab;
WorkerInfo worker;
- bool skipit;
+ bool skipit;
char *datname,
*nspname,
*relname;
@@ -2001,9 +2007,9 @@ do_autovacuum(void)
CHECK_FOR_INTERRUPTS();
/*
- * hold schedule lock from here until we're sure that this table
- * still needs vacuuming. We also need the AutovacuumLock to walk
- * the worker array, but we'll let go of that one quickly.
+ * hold schedule lock from here until we're sure that this table still
+ * needs vacuuming. We also need the AutovacuumLock to walk the
+ * worker array, but we'll let go of that one quickly.
*/
LWLockAcquire(AutovacuumScheduleLock, LW_EXCLUSIVE);
LWLockAcquire(AutovacuumLock, LW_SHARED);
@@ -2014,8 +2020,8 @@ do_autovacuum(void)
*/
skipit = false;
worker = (WorkerInfo) SHMQueueNext(&AutoVacuumShmem->av_runningWorkers,
- &AutoVacuumShmem->av_runningWorkers,
- offsetof(WorkerInfoData, wi_links));
+ &AutoVacuumShmem->av_runningWorkers,
+ offsetof(WorkerInfoData, wi_links));
while (worker)
{
/* ignore myself */
@@ -2032,10 +2038,10 @@ do_autovacuum(void)
break;
}
-next_worker:
+ next_worker:
worker = (WorkerInfo) SHMQueueNext(&AutoVacuumShmem->av_runningWorkers,
&worker->wi_links,
- offsetof(WorkerInfoData, wi_links));
+ offsetof(WorkerInfoData, wi_links));
}
LWLockRelease(AutovacuumLock);
if (skipit)
@@ -2046,8 +2052,8 @@ next_worker:
/*
* Check whether pgstat data still says we need to vacuum this table.
- * It could have changed if something else processed the table while we
- * weren't looking.
+ * It could have changed if something else processed the table while
+ * we weren't looking.
*
* FIXME we ignore the possibility that the table was finished being
* vacuumed in the last 500ms (PGSTAT_STAT_INTERVAL). This is a bug.
@@ -2062,7 +2068,7 @@ next_worker:
}
/*
- * Ok, good to go. Store the table in shared memory before releasing
+ * Ok, good to go. Store the table in shared memory before releasing
* the lock so that other workers don't vacuum it concurrently.
*/
MyWorkerInfo->wi_tableoid = relid;
@@ -2099,7 +2105,7 @@ next_worker:
/*
* Save the relation name for a possible error message, to avoid a
- * catalog lookup in case of an error. Note: they must live in a
+ * catalog lookup in case of an error. Note: they must live in a
* long-lived memory context because we call vacuum and analyze in
* different transactions.
*/
@@ -2124,9 +2130,9 @@ next_worker:
/*
* Clear a possible query-cancel signal, to avoid a late reaction
- * to an automatically-sent signal because of vacuuming the current
- * table (we're done with it, so it would make no sense to cancel
- * at this point.)
+ * to an automatically-sent signal because of vacuuming the
+ * current table (we're done with it, so it would make no sense to
+ * cancel at this point.)
*/
QueryCancelPending = false;
}
@@ -2171,8 +2177,8 @@ next_worker:
}
/*
- * Update pg_database.datfrozenxid, and truncate pg_clog if possible.
- * We only need to do this once, not after each table.
+ * Update pg_database.datfrozenxid, and truncate pg_clog if possible. We
+ * only need to do this once, not after each table.
*/
vac_update_datfrozenxid();
@@ -2249,13 +2255,13 @@ get_pgstat_tabentry_relid(Oid relid, bool isshared, PgStat_StatDBEntry *shared,
*/
static void
relation_check_autovac(Oid relid, Form_pg_class classForm,
- Form_pg_autovacuum avForm, PgStat_StatTabEntry *tabentry,
+ Form_pg_autovacuum avForm, PgStat_StatTabEntry *tabentry,
List **table_oids, List **table_toast_list,
List **toast_oids)
{
- bool dovacuum;
- bool doanalyze;
- bool dummy;
+ bool dovacuum;
+ bool doanalyze;
+ bool dummy;
relation_needs_vacanalyze(relid, avForm, classForm, tabentry,
&dovacuum, &doanalyze, &dummy);
@@ -2273,7 +2279,7 @@ relation_check_autovac(Oid relid, Form_pg_class classForm,
*table_oids = lappend_oid(*table_oids, relid);
else if (OidIsValid(classForm->reltoastrelid))
{
- av_relation *rel = palloc(sizeof(av_relation));
+ av_relation *rel = palloc(sizeof(av_relation));
rel->ar_relid = relid;
rel->ar_toastrelid = classForm->reltoastrelid;
@@ -2341,7 +2347,7 @@ table_recheck_autovac(Oid relid)
/* it doesn't need vacuum, but what about it's TOAST table? */
else if (OidIsValid(classForm->reltoastrelid))
{
- Oid toastrelid = classForm->reltoastrelid;
+ Oid toastrelid = classForm->reltoastrelid;
HeapTuple toastClassTup;
toastClassTup = SearchSysCacheCopy(RELOID,
@@ -2349,15 +2355,15 @@ table_recheck_autovac(Oid relid)
0, 0, 0);
if (HeapTupleIsValid(toastClassTup))
{
- bool toast_dovacuum;
- bool toast_doanalyze;
- bool toast_wraparound;
- Form_pg_class toastClassForm;
+ bool toast_dovacuum;
+ bool toast_doanalyze;
+ bool toast_wraparound;
+ Form_pg_class toastClassForm;
PgStat_StatTabEntry *toasttabentry;
toastClassForm = (Form_pg_class) GETSTRUCT(toastClassTup);
toasttabentry = get_pgstat_tabentry_relid(toastrelid,
- toastClassForm->relisshared,
+ toastClassForm->relisshared,
shared, dbentry);
/* note we use the pg_autovacuum entry for the main table */
@@ -2386,8 +2392,8 @@ table_recheck_autovac(Oid relid)
int vac_cost_delay;
/*
- * Calculate the vacuum cost parameters and the minimum freeze age. If
- * there is a tuple in pg_autovacuum, use it; else, use the GUC
+ * Calculate the vacuum cost parameters and the minimum freeze age.
+ * If there is a tuple in pg_autovacuum, use it; else, use the GUC
* defaults. Note that the fields may contain "-1" (or indeed any
* negative value), which means use the GUC defaults for each setting.
* In cost_limit, the value 0 also means to use the value from
@@ -2442,7 +2448,7 @@ table_recheck_autovac(Oid relid)
*
* Check whether a relation needs to be vacuumed or analyzed; return each into
* "dovacuum" and "doanalyze", respectively. Also return whether the vacuum is
- * being forced because of Xid wraparound. avForm and tabentry can be NULL,
+ * being forced because of Xid wraparound. avForm and tabentry can be NULL,
* classForm shouldn't.
*
* A table needs to be vacuumed if the number of dead tuples exceeds a
@@ -2461,7 +2467,7 @@ table_recheck_autovac(Oid relid)
*
* A table whose pg_autovacuum.enabled value is false, is automatically
* skipped (unless we have to vacuum it due to freeze_max_age). Thus
- * autovacuum can be disabled for specific tables. Also, when the stats
+ * autovacuum can be disabled for specific tables. Also, when the stats
* collector does not have data about a table, it will be skipped.
*
* A table whose vac_base_thresh value is <0 takes the base value from the
@@ -2474,24 +2480,28 @@ relation_needs_vacanalyze(Oid relid,
Form_pg_autovacuum avForm,
Form_pg_class classForm,
PgStat_StatTabEntry *tabentry,
- /* output params below */
+ /* output params below */
bool *dovacuum,
bool *doanalyze,
bool *wraparound)
{
bool force_vacuum;
float4 reltuples; /* pg_class.reltuples */
+
/* constants from pg_autovacuum or GUC variables */
int vac_base_thresh,
anl_base_thresh;
float4 vac_scale_factor,
anl_scale_factor;
+
/* thresholds calculated from above constants */
float4 vacthresh,
anlthresh;
+
/* number of vacuum (resp. analyze) tuples at this time */
float4 vactuples,
anltuples;
+
/* freeze parameters */
int freeze_max_age;
TransactionId xidForceLimit;
@@ -2501,9 +2511,9 @@ relation_needs_vacanalyze(Oid relid,
/*
* Determine vacuum/analyze equation parameters. If there is a tuple in
- * pg_autovacuum, use it; else, use the GUC defaults. Note that the fields
- * may contain "-1" (or indeed any negative value), which means use the GUC
- * defaults for each setting.
+ * pg_autovacuum, use it; else, use the GUC defaults. Note that the
+ * fields may contain "-1" (or indeed any negative value), which means use
+ * the GUC defaults for each setting.
*/
if (avForm != NULL)
{
@@ -2575,9 +2585,9 @@ relation_needs_vacanalyze(Oid relid,
else
{
/*
- * Skip a table not found in stat hash, unless we have to force
- * vacuum for anti-wrap purposes. If it's not acted upon, there's
- * no need to vacuum it.
+ * Skip a table not found in stat hash, unless we have to force vacuum
+ * for anti-wrap purposes. If it's not acted upon, there's no need to
+ * vacuum it.
*/
*dovacuum = force_vacuum;
*doanalyze = false;
@@ -2641,6 +2651,7 @@ autovac_report_activity(VacuumStmt *vacstmt, Oid relid)
{
char *relname = get_rel_name(relid);
char *nspname = get_namespace_name(get_rel_namespace(relid));
+
#define MAX_AUTOVAC_ACTIV_LEN (NAMEDATALEN * 2 + 32)
char activity[MAX_AUTOVAC_ACTIV_LEN];
@@ -2656,9 +2667,9 @@ autovac_report_activity(VacuumStmt *vacstmt, Oid relid)
/*
* Report the qualified name of the relation.
*
- * Paranoia is appropriate here in case relation was recently dropped
- * --- the lsyscache routines we just invoked will return NULL rather
- * than failing.
+ * Paranoia is appropriate here in case relation was recently dropped ---
+ * the lsyscache routines we just invoked will return NULL rather than
+ * failing.
*/
if (relname && nspname)
{
@@ -2722,12 +2733,12 @@ IsAutoVacuumWorkerProcess(void)
/*
* AutoVacuumShmemSize
- * Compute space needed for autovacuum-related shared memory
+ * Compute space needed for autovacuum-related shared memory
*/
Size
AutoVacuumShmemSize(void)
{
- Size size;
+ Size size;
/*
* Need the fixed struct and the array of WorkerInfoData.
@@ -2746,7 +2757,7 @@ AutoVacuumShmemSize(void)
void
AutoVacuumShmemInit(void)
{
- bool found;
+ bool found;
AutoVacuumShmem = (AutoVacuumShmemStruct *)
ShmemInitStruct("AutoVacuum Data",
@@ -2785,10 +2796,10 @@ AutoVacuumShmemInit(void)
/*
* autovac_refresh_stats
- * Refresh pgstats data for an autovacuum process
+ * Refresh pgstats data for an autovacuum process
*
* Cause the next pgstats read operation to obtain fresh data, but throttle
- * such refreshing in the autovacuum launcher. This is mostly to avoid
+ * such refreshing in the autovacuum launcher. This is mostly to avoid
* rereading the pgstats files too many times in quick succession when there
* are many databases.
*
@@ -2800,8 +2811,8 @@ autovac_refresh_stats(void)
{
if (IsAutoVacuumLauncherProcess())
{
- static TimestampTz last_read = 0;
- TimestampTz current_time;
+ static TimestampTz last_read = 0;
+ TimestampTz current_time;
current_time = GetCurrentTimestamp();
diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c
index f75e9f37d8..7f2d3b820a 100644
--- a/src/backend/postmaster/bgwriter.c
+++ b/src/backend/postmaster/bgwriter.c
@@ -2,7 +2,7 @@
*
* bgwriter.c
*
- * The background writer (bgwriter) is new as of Postgres 8.0. It attempts
+ * The background writer (bgwriter) is new as of Postgres 8.0. It attempts
* to keep regular backends from having to write out dirty shared buffers
* (which they would only do when needing to free a shared buffer to read in
* another page). In the best scenario all writes from shared buffers will
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.46 2007/11/14 21:19:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.47 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -128,7 +128,7 @@ typedef struct
int ckpt_flags; /* checkpoint flags, as defined in xlog.h */
- uint32 num_backend_writes; /* counts non-bgwriter buffer writes */
+ uint32 num_backend_writes; /* counts non-bgwriter buffer writes */
int num_requests; /* current # of requests */
int max_requests; /* allocated array size */
@@ -202,9 +202,9 @@ BackgroundWriterMain(void)
/*
* If possible, make this process a group leader, so that the postmaster
- * can signal any child processes too. (bgwriter probably never has
- * any child processes, but for consistency we make all postmaster
- * child processes do this.)
+ * can signal any child processes too. (bgwriter probably never has any
+ * child processes, but for consistency we make all postmaster child
+ * processes do this.)
*/
#ifdef HAVE_SETSID
if (setsid() < 0)
@@ -402,10 +402,10 @@ BackgroundWriterMain(void)
}
/*
- * Force a checkpoint if too much time has elapsed since the
- * last one. Note that we count a timed checkpoint in stats only
- * when this occurs without an external request, but we set the
- * CAUSE_TIME flag bit even if there is also an external request.
+ * Force a checkpoint if too much time has elapsed since the last one.
+ * Note that we count a timed checkpoint in stats only when this
+ * occurs without an external request, but we set the CAUSE_TIME flag
+ * bit even if there is also an external request.
*/
now = time(NULL);
elapsed_secs = now - last_checkpoint_time;
@@ -427,10 +427,9 @@ BackgroundWriterMain(void)
volatile BgWriterShmemStruct *bgs = BgWriterShmem;
/*
- * Atomically fetch the request flags to figure out what
- * kind of a checkpoint we should perform, and increase the
- * started-counter to acknowledge that we've started
- * a new checkpoint.
+ * Atomically fetch the request flags to figure out what kind of a
+ * checkpoint we should perform, and increase the started-counter
+ * to acknowledge that we've started a new checkpoint.
*/
SpinLockAcquire(&bgs->ckpt_lck);
flags |= bgs->ckpt_flags;
@@ -518,8 +517,8 @@ CheckArchiveTimeout(void)
return;
/*
- * Update local state ... note that last_xlog_switch_time is the
- * last time a switch was performed *or requested*.
+ * Update local state ... note that last_xlog_switch_time is the last time
+ * a switch was performed *or requested*.
*/
last_time = GetLastSegSwitchTime();
@@ -534,17 +533,17 @@ CheckArchiveTimeout(void)
switchpoint = RequestXLogSwitch();
/*
- * If the returned pointer points exactly to a segment
- * boundary, assume nothing happened.
+ * If the returned pointer points exactly to a segment boundary,
+ * assume nothing happened.
*/
if ((switchpoint.xrecoff % XLogSegSize) != 0)
ereport(DEBUG1,
- (errmsg("transaction log switch forced (archive_timeout=%d)",
- XLogArchiveTimeout)));
+ (errmsg("transaction log switch forced (archive_timeout=%d)",
+ XLogArchiveTimeout)));
/*
- * Update state in any case, so we don't retry constantly when
- * the system is idle.
+ * Update state in any case, so we don't retry constantly when the
+ * system is idle.
*/
last_xlog_switch_time = now;
}
@@ -577,14 +576,14 @@ BgWriterNap(void)
if (bgwriter_lru_maxpages > 0 || ckpt_active)
udelay = BgWriterDelay * 1000L;
else if (XLogArchiveTimeout > 0)
- udelay = 1000000L; /* One second */
+ udelay = 1000000L; /* One second */
else
- udelay = 10000000L; /* Ten seconds */
+ udelay = 10000000L; /* Ten seconds */
while (udelay > 999999L)
{
if (got_SIGHUP || shutdown_requested ||
- (ckpt_active ? ImmediateCheckpointRequested() : checkpoint_requested))
+ (ckpt_active ? ImmediateCheckpointRequested() : checkpoint_requested))
break;
pg_usleep(1000000L);
AbsorbFsyncRequests();
@@ -592,12 +591,12 @@ BgWriterNap(void)
}
if (!(got_SIGHUP || shutdown_requested ||
- (ckpt_active ? ImmediateCheckpointRequested() : checkpoint_requested)))
+ (ckpt_active ? ImmediateCheckpointRequested() : checkpoint_requested)))
pg_usleep(udelay);
}
/*
- * Returns true if an immediate checkpoint request is pending. (Note that
+ * Returns true if an immediate checkpoint request is pending. (Note that
* this does not check the *current* checkpoint's IMMEDIATE flag, but whether
* there is one pending behind it.)
*/
@@ -635,7 +634,7 @@ ImmediateCheckpointRequested(void)
void
CheckpointWriteDelay(int flags, double progress)
{
- static int absorb_counter = WRITES_PER_ABSORB;
+ static int absorb_counter = WRITES_PER_ABSORB;
/* Do nothing if checkpoint is being executed by non-bgwriter process */
if (!am_bg_writer)
@@ -687,7 +686,7 @@ static bool
IsCheckpointOnSchedule(double progress)
{
XLogRecPtr recptr;
- struct timeval now;
+ struct timeval now;
double elapsed_xlogs,
elapsed_time;
@@ -697,7 +696,7 @@ IsCheckpointOnSchedule(double progress)
progress *= CheckPointCompletionTarget;
/*
- * Check against the cached value first. Only do the more expensive
+ * Check against the cached value first. Only do the more expensive
* calculations once we reach the target previously calculated. Since
* neither time or WAL insert pointer moves backwards, a freshly
* calculated value can only be greater than or equal to the cached value.
@@ -708,12 +707,12 @@ IsCheckpointOnSchedule(double progress)
/*
* Check progress against WAL segments written and checkpoint_segments.
*
- * We compare the current WAL insert location against the location
+ * We compare the current WAL insert location against the location
* computed before calling CreateCheckPoint. The code in XLogInsert that
* actually triggers a checkpoint when checkpoint_segments is exceeded
* compares against RedoRecptr, so this is not completely accurate.
- * However, it's good enough for our purposes, we're only calculating
- * an estimate anyway.
+ * However, it's good enough for our purposes, we're only calculating an
+ * estimate anyway.
*/
recptr = GetInsertRecPtr();
elapsed_xlogs =
@@ -852,7 +851,7 @@ BgWriterShmemInit(void)
* flags is a bitwise OR of the following:
* CHECKPOINT_IS_SHUTDOWN: checkpoint is for database shutdown.
* CHECKPOINT_IMMEDIATE: finish the checkpoint ASAP,
- * ignoring checkpoint_completion_target parameter.
+ * ignoring checkpoint_completion_target parameter.
* CHECKPOINT_FORCE: force a checkpoint even if no XLOG activity has occured
* since the last one (implied by CHECKPOINT_IS_SHUTDOWN).
* CHECKPOINT_WAIT: wait for completion before returning (otherwise,
@@ -865,7 +864,8 @@ RequestCheckpoint(int flags)
{
/* use volatile pointer to prevent code rearrangement */
volatile BgWriterShmemStruct *bgs = BgWriterShmem;
- int old_failed, old_started;
+ int old_failed,
+ old_started;
/*
* If in a standalone backend, just do it ourselves.
@@ -873,9 +873,8 @@ RequestCheckpoint(int flags)
if (!IsPostmasterEnvironment)
{
/*
- * There's no point in doing slow checkpoints in a standalone
- * backend, because there's no other backends the checkpoint could
- * disrupt.
+ * There's no point in doing slow checkpoints in a standalone backend,
+ * because there's no other backends the checkpoint could disrupt.
*/
CreateCheckPoint(flags | CHECKPOINT_IMMEDIATE);
@@ -906,8 +905,8 @@ RequestCheckpoint(int flags)
SpinLockRelease(&bgs->ckpt_lck);
/*
- * Send signal to request checkpoint. When not waiting, we
- * consider failure to send the signal to be nonfatal.
+ * Send signal to request checkpoint. When not waiting, we consider
+ * failure to send the signal to be nonfatal.
*/
if (BgWriterShmem->bgwriter_pid == 0)
elog((flags & CHECKPOINT_WAIT) ? ERROR : LOG,
@@ -922,18 +921,19 @@ RequestCheckpoint(int flags)
*/
if (flags & CHECKPOINT_WAIT)
{
- int new_started, new_failed;
+ int new_started,
+ new_failed;
/* Wait for a new checkpoint to start. */
- for(;;)
+ for (;;)
{
SpinLockAcquire(&bgs->ckpt_lck);
new_started = bgs->ckpt_started;
SpinLockRelease(&bgs->ckpt_lck);
-
+
if (new_started != old_started)
break;
-
+
CHECK_FOR_INTERRUPTS();
pg_usleep(100000L);
}
@@ -941,9 +941,9 @@ RequestCheckpoint(int flags)
/*
* We are waiting for ckpt_done >= new_started, in a modulo sense.
*/
- for(;;)
+ for (;;)
{
- int new_done;
+ int new_done;
SpinLockAcquire(&bgs->ckpt_lck);
new_done = bgs->ckpt_done;
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c
index 1b0ad2786c..37e25861e7 100644
--- a/src/backend/postmaster/pgarch.c
+++ b/src/backend/postmaster/pgarch.c
@@ -19,7 +19,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.31 2007/09/26 22:36:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.32 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -223,7 +223,7 @@ PgArchiverMain(int argc, char *argv[])
MyProcPid = getpid(); /* reset MyProcPid */
- MyStartTime = time(NULL); /* record Start Time for logging */
+ MyStartTime = time(NULL); /* record Start Time for logging */
/*
* If possible, make this process a group leader, so that the postmaster
@@ -360,7 +360,7 @@ pgarch_ArchiverCopyLoop(void)
if (!XLogArchiveCommandSet())
{
ereport(WARNING,
- (errmsg("archive_mode enabled, yet archive_command is not set")));
+ (errmsg("archive_mode enabled, yet archive_command is not set")));
/* can't do anything if no command ... */
return;
}
@@ -476,15 +476,15 @@ pgarch_archiveXlog(char *xlog)
{
/*
* If either the shell itself, or a called command, died on a signal,
- * abort the archiver. We do this because system() ignores SIGINT and
+ * abort the archiver. We do this because system() ignores SIGINT and
* SIGQUIT while waiting; so a signal is very likely something that
- * should have interrupted us too. If we overreact it's no big deal,
+ * should have interrupted us too. If we overreact it's no big deal,
* the postmaster will just start the archiver again.
*
- * Per the Single Unix Spec, shells report exit status > 128 when
- * a called command died on a signal.
+ * Per the Single Unix Spec, shells report exit status > 128 when a
+ * called command died on a signal.
*/
- bool signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 128;
+ bool signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 128;
ereport(signaled ? FATAL : LOG,
(errmsg("archive command \"%s\" failed: return code %d",
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 8623dbd005..22ba2ee344 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2007, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.166 2007/09/25 20:03:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.167 2007/11/15 21:14:37 momjian Exp $
* ----------
*/
#include "postgres.h"
@@ -127,14 +127,14 @@ static bool pgStatRunningInCollector = false;
* avoiding repeated searches in pgstat_initstats() when a relation is
* repeatedly opened during a transaction.
*/
-#define TABSTAT_QUANTUM 100 /* we alloc this many at a time */
+#define TABSTAT_QUANTUM 100 /* we alloc this many at a time */
typedef struct TabStatusArray
{
struct TabStatusArray *tsa_next; /* link to next array, if any */
- int tsa_used; /* # entries currently used */
+ int tsa_used; /* # entries currently used */
PgStat_TableStatus tsa_entries[TABSTAT_QUANTUM]; /* per-table data */
-} TabStatusArray;
+} TabStatusArray;
static TabStatusArray *pgStatTabList = NULL;
@@ -147,10 +147,10 @@ static TabStatusArray *pgStatTabList = NULL;
*/
typedef struct PgStat_SubXactStatus
{
- int nest_level; /* subtransaction nest level */
+ int nest_level; /* subtransaction nest level */
struct PgStat_SubXactStatus *prev; /* higher-level subxact if any */
PgStat_TableXactStatus *first; /* head of list for this subxact */
-} PgStat_SubXactStatus;
+} PgStat_SubXactStatus;
static PgStat_SubXactStatus *pgStatXactStack = NULL;
@@ -160,11 +160,11 @@ static int pgStatXactRollback = 0;
/* Record that's written to 2PC state file when pgstat state is persisted */
typedef struct TwoPhasePgStatRecord
{
- PgStat_Counter tuples_inserted; /* tuples inserted in xact */
- PgStat_Counter tuples_deleted; /* tuples deleted in xact */
- Oid t_id; /* table's OID */
- bool t_shared; /* is it a shared catalog? */
-} TwoPhasePgStatRecord;
+ PgStat_Counter tuples_inserted; /* tuples inserted in xact */
+ PgStat_Counter tuples_deleted; /* tuples deleted in xact */
+ Oid t_id; /* table's OID */
+ bool t_shared; /* is it a shared catalog? */
+} TwoPhasePgStatRecord;
/*
* Info about current "snapshot" of stats file
@@ -221,7 +221,7 @@ static void pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len);
static void pgstat_recv_autovac(PgStat_MsgAutovacStart *msg, int len);
static void pgstat_recv_vacuum(PgStat_MsgVacuum *msg, int len);
static void pgstat_recv_analyze(PgStat_MsgAnalyze *msg, int len);
-static void pgstat_recv_bgwriter(PgStat_MsgBgWriter *msg, int len);
+static void pgstat_recv_bgwriter(PgStat_MsgBgWriter * msg, int len);
/* ------------------------------------------------------------
@@ -470,9 +470,9 @@ startup_failed:
/*
* Adjust GUC variables to suppress useless activity, and for debugging
- * purposes (seeing track_counts off is a clue that we failed here).
- * We use PGC_S_OVERRIDE because there is no point in trying to turn it
- * back on from postgresql.conf without a restart.
+ * purposes (seeing track_counts off is a clue that we failed here). We
+ * use PGC_S_OVERRIDE because there is no point in trying to turn it back
+ * on from postgresql.conf without a restart.
*/
SetConfigOption("track_counts", "off", PGC_INTERNAL, PGC_S_OVERRIDE);
}
@@ -531,8 +531,8 @@ pgstat_start(void)
pid_t pgStatPid;
/*
- * Check that the socket is there, else pgstat_init failed and we can
- * do nothing useful.
+ * Check that the socket is there, else pgstat_init failed and we can do
+ * nothing useful.
*/
if (pgStatSock < 0)
return 0;
@@ -587,9 +587,10 @@ pgstat_start(void)
return 0;
}
-void allow_immediate_pgstat_restart(void)
+void
+allow_immediate_pgstat_restart(void)
{
- last_pgstat_start_time = 0;
+ last_pgstat_start_time = 0;
}
/* ------------------------------------------------------------
@@ -612,7 +613,7 @@ pgstat_report_tabstat(bool force)
{
/* we assume this inits to all zeroes: */
static const PgStat_TableCounts all_zeroes;
- static TimestampTz last_report = 0;
+ static TimestampTz last_report = 0;
TimestampTz now;
PgStat_MsgTabstat regular_msg;
@@ -638,8 +639,8 @@ pgstat_report_tabstat(bool force)
/*
* Scan through the TabStatusArray struct(s) to find tables that actually
* have counts, and build messages to send. We have to separate shared
- * relations from regular ones because the databaseid field in the
- * message header has to depend on that.
+ * relations from regular ones because the databaseid field in the message
+ * header has to depend on that.
*/
regular_msg.m_databaseid = MyDatabaseId;
shared_msg.m_databaseid = InvalidOid;
@@ -658,12 +659,13 @@ pgstat_report_tabstat(bool force)
Assert(entry->trans == NULL);
/*
- * Ignore entries that didn't accumulate any actual counts,
- * such as indexes that were opened by the planner but not used.
+ * Ignore entries that didn't accumulate any actual counts, such
+ * as indexes that were opened by the planner but not used.
*/
if (memcmp(&entry->t_counts, &all_zeroes,
sizeof(PgStat_TableCounts)) == 0)
continue;
+
/*
* OK, insert data into the appropriate message, and send if full.
*/
@@ -885,7 +887,7 @@ pgstat_collect_oids(Oid catalogid)
scan = heap_beginscan(rel, SnapshotNow, 0, NULL);
while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
{
- Oid thisoid = HeapTupleGetOid(tup);
+ Oid thisoid = HeapTupleGetOid(tup);
CHECK_FOR_INTERRUPTS();
@@ -950,7 +952,7 @@ pgstat_drop_relation(Oid relid)
msg.m_databaseid = MyDatabaseId;
pgstat_send(&msg, len);
}
-#endif /* NOT_USED */
+#endif /* NOT_USED */
/* ----------
@@ -1021,7 +1023,7 @@ pgstat_report_vacuum(Oid tableoid, bool shared,
msg.m_databaseid = shared ? InvalidOid : MyDatabaseId;
msg.m_tableoid = tableoid;
msg.m_analyze = analyze;
- msg.m_autovacuum = IsAutoVacuumWorkerProcess(); /* is this autovacuum? */
+ msg.m_autovacuum = IsAutoVacuumWorkerProcess(); /* is this autovacuum? */
msg.m_vacuumtime = GetCurrentTimestamp();
msg.m_tuples = tuples;
pgstat_send(&msg, sizeof(msg));
@@ -1045,7 +1047,7 @@ pgstat_report_analyze(Oid tableoid, bool shared, PgStat_Counter livetuples,
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_ANALYZE);
msg.m_databaseid = shared ? InvalidOid : MyDatabaseId;
msg.m_tableoid = tableoid;
- msg.m_autovacuum = IsAutoVacuumWorkerProcess(); /* is this autovacuum? */
+ msg.m_autovacuum = IsAutoVacuumWorkerProcess(); /* is this autovacuum? */
msg.m_analyzetime = GetCurrentTimestamp();
msg.m_live_tuples = livetuples;
msg.m_dead_tuples = deadtuples;
@@ -1107,8 +1109,8 @@ pgstat_initstats(Relation rel)
}
/*
- * If we already set up this relation in the current transaction,
- * nothing to do.
+ * If we already set up this relation in the current transaction, nothing
+ * to do.
*/
if (rel->pgstat_info != NULL &&
rel->pgstat_info->t_id == rel_id)
@@ -1145,9 +1147,9 @@ get_tabstat_entry(Oid rel_id, bool isshared)
if (tsa->tsa_used < TABSTAT_QUANTUM)
{
/*
- * It must not be present, but we found a free slot instead.
- * Fine, let's use this one. We assume the entry was already
- * zeroed, either at creation or after last use.
+ * It must not be present, but we found a free slot instead. Fine,
+ * let's use this one. We assume the entry was already zeroed,
+ * either at creation or after last use.
*/
entry = &tsa->tsa_entries[tsa->tsa_used++];
entry->t_id = rel_id;
@@ -1201,14 +1203,14 @@ get_tabstat_stack_level(int nest_level)
* add_tabstat_xact_level - add a new (sub)transaction state record
*/
static void
-add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level)
+add_tabstat_xact_level(PgStat_TableStatus * pgstat_info, int nest_level)
{
PgStat_SubXactStatus *xact_state;
PgStat_TableXactStatus *trans;
/*
- * If this is the first rel to be modified at the current nest level,
- * we first have to push a transaction stack entry.
+ * If this is the first rel to be modified at the current nest level, we
+ * first have to push a transaction stack entry.
*/
xact_state = get_tabstat_stack_level(nest_level);
@@ -1234,7 +1236,7 @@ pgstat_count_heap_insert(Relation rel)
if (pgstat_track_counts && pgstat_info != NULL)
{
- int nest_level = GetCurrentTransactionNestLevel();
+ int nest_level = GetCurrentTransactionNestLevel();
/* t_tuples_inserted is nontransactional, so just advance it */
pgstat_info->t_counts.t_tuples_inserted++;
@@ -1258,7 +1260,7 @@ pgstat_count_heap_update(Relation rel, bool hot)
if (pgstat_track_counts && pgstat_info != NULL)
{
- int nest_level = GetCurrentTransactionNestLevel();
+ int nest_level = GetCurrentTransactionNestLevel();
/* t_tuples_updated is nontransactional, so just advance it */
pgstat_info->t_counts.t_tuples_updated++;
@@ -1287,7 +1289,7 @@ pgstat_count_heap_delete(Relation rel)
if (pgstat_track_counts && pgstat_info != NULL)
{
- int nest_level = GetCurrentTransactionNestLevel();
+ int nest_level = GetCurrentTransactionNestLevel();
/* t_tuples_deleted is nontransactional, so just advance it */
pgstat_info->t_counts.t_tuples_deleted++;
@@ -1341,8 +1343,8 @@ AtEOXact_PgStat(bool isCommit)
/*
* Transfer transactional insert/update counts into the base tabstat
- * entries. We don't bother to free any of the transactional state,
- * since it's all in TopTransactionContext and will go away anyway.
+ * entries. We don't bother to free any of the transactional state, since
+ * it's all in TopTransactionContext and will go away anyway.
*/
xact_state = pgStatXactStack;
if (xact_state != NULL)
@@ -1424,11 +1426,11 @@ AtEOSubXact_PgStat(bool isCommit, int nestDepth)
else
{
/*
- * When there isn't an immediate parent state, we can
- * just reuse the record instead of going through a
+ * When there isn't an immediate parent state, we can just
+ * reuse the record instead of going through a
* palloc/pfree pushup (this works since it's all in
- * TopTransactionContext anyway). We have to re-link
- * it into the parent level, though, and that might mean
+ * TopTransactionContext anyway). We have to re-link it
+ * into the parent level, though, and that might mean
* pushing a new entry into the pgStatXactStack.
*/
PgStat_SubXactStatus *upper_xact_state;
@@ -1500,7 +1502,7 @@ AtPrepare_PgStat(void)
* Clean up after successful PREPARE.
*
* All we need do here is unlink the transaction stats state from the
- * nontransactional state. The nontransactional action counts will be
+ * nontransactional state. The nontransactional action counts will be
* reported to the stats collector immediately, while the effects on live
* and dead tuple counts are preserved in the 2PC state file.
*
@@ -1512,8 +1514,8 @@ PostPrepare_PgStat(void)
PgStat_SubXactStatus *xact_state;
/*
- * We don't bother to free any of the transactional state,
- * since it's all in TopTransactionContext and will go away anyway.
+ * We don't bother to free any of the transactional state, since it's all
+ * in TopTransactionContext and will go away anyway.
*/
xact_state = pgStatXactStack;
if (xact_state != NULL)
@@ -1701,8 +1703,8 @@ pgstat_fetch_stat_numbackends(void)
* ---------
* pgstat_fetch_global() -
*
- * Support function for the SQL-callable pgstat* functions. Returns
- * a pointer to the global statistics struct.
+ * Support function for the SQL-callable pgstat* functions. Returns
+ * a pointer to the global statistics struct.
* ---------
*/
PgStat_GlobalStats *
@@ -1795,8 +1797,8 @@ pgstat_bestart(void)
volatile PgBackendStatus *beentry;
/*
- * To minimize the time spent modifying the PgBackendStatus entry,
- * fetch all the needed data first.
+ * To minimize the time spent modifying the PgBackendStatus entry, fetch
+ * all the needed data first.
*
* If we have a MyProcPort, use its session start time (for consistency,
* and to save a kernel call).
@@ -1930,8 +1932,8 @@ pgstat_report_xact_timestamp(TimestampTz tstamp)
/*
* Update my status entry, following the protocol of bumping
- * st_changecount before and after. We use a volatile pointer
- * here to ensure the compiler doesn't try to get cute.
+ * st_changecount before and after. We use a volatile pointer here to
+ * ensure the compiler doesn't try to get cute.
*/
beentry->st_changecount++;
beentry->st_xact_start_timestamp = tstamp;
@@ -2085,7 +2087,7 @@ pgstat_send(void *msg, int len)
/* ----------
* pgstat_send_bgwriter() -
*
- * Send bgwriter statistics to the collector
+ * Send bgwriter statistics to the collector
* ----------
*/
void
@@ -2095,9 +2097,9 @@ pgstat_send_bgwriter(void)
static const PgStat_MsgBgWriter all_zeroes;
/*
- * This function can be called even if nothing at all has happened.
- * In this case, avoid sending a completely empty message to
- * the stats collector.
+ * This function can be called even if nothing at all has happened. In
+ * this case, avoid sending a completely empty message to the stats
+ * collector.
*/
if (memcmp(&BgWriterStats, &all_zeroes, sizeof(PgStat_MsgBgWriter)) == 0)
return;
@@ -2145,13 +2147,13 @@ PgstatCollectorMain(int argc, char *argv[])
MyProcPid = getpid(); /* reset MyProcPid */
- MyStartTime = time(NULL); /* record Start Time for logging */
+ MyStartTime = time(NULL); /* record Start Time for logging */
/*
* If possible, make this process a group leader, so that the postmaster
- * can signal any child processes too. (pgstat probably never has
- * any child processes, but for consistency we make all postmaster
- * child processes do this.)
+ * can signal any child processes too. (pgstat probably never has any
+ * child processes, but for consistency we make all postmaster child
+ * processes do this.)
*/
#ifdef HAVE_SETSID
if (setsid() < 0)
@@ -2250,8 +2252,8 @@ PgstatCollectorMain(int argc, char *argv[])
* poll/select call, so this also limits speed of response to SIGQUIT,
* which is more important.)
*
- * We use poll(2) if available, otherwise select(2).
- * Win32 has its own implementation.
+ * We use poll(2) if available, otherwise select(2). Win32 has its own
+ * implementation.
*/
#ifndef WIN32
#ifdef HAVE_POLL
@@ -2291,9 +2293,9 @@ PgstatCollectorMain(int argc, char *argv[])
got_data = FD_ISSET(pgStatSock, &rfds);
#endif /* HAVE_POLL */
-#else /* WIN32 */
+#else /* WIN32 */
got_data = pgwin32_waitforsinglesocket(pgStatSock, FD_READ,
- PGSTAT_SELECT_TIMEOUT*1000);
+ PGSTAT_SELECT_TIMEOUT * 1000);
#endif
/*
@@ -2363,7 +2365,7 @@ PgstatCollectorMain(int argc, char *argv[])
break;
case PGSTAT_MTYPE_BGWRITER:
- pgstat_recv_bgwriter((PgStat_MsgBgWriter *) &msg, len);
+ pgstat_recv_bgwriter((PgStat_MsgBgWriter *) & msg, len);
break;
default:
@@ -2704,7 +2706,7 @@ pgstat_read_statsfile(Oid onlydb)
dbentry->tables = hash_create("Per-database table",
PGSTAT_TAB_HASH_SIZE,
&hash_ctl,
- HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
+ HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
/*
* Arrange that following 'T's add entries to this database's
@@ -2813,7 +2815,7 @@ pgstat_setup_memcxt(void)
/* ----------
* pgstat_clear_snapshot() -
*
- * Discard any data collected in the current transaction. Any subsequent
+ * Discard any data collected in the current transaction. Any subsequent
* request will cause new snapshots to be read.
*
* This is also invoked during transaction commit or abort to discard
@@ -3158,7 +3160,7 @@ pgstat_recv_analyze(PgStat_MsgAnalyze *msg, int len)
* ----------
*/
static void
-pgstat_recv_bgwriter(PgStat_MsgBgWriter *msg, int len)
+pgstat_recv_bgwriter(PgStat_MsgBgWriter * msg, int len)
{
globalStats.timed_checkpoints += msg->m_timed_checkpoints;
globalStats.requested_checkpoints += msg->m_requested_checkpoints;
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 9af6526159..c83e4e73d8 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.546 2007/11/15 20:04:38 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.547 2007/11/15 21:14:37 momjian Exp $
*
* NOTES
*
@@ -130,10 +130,10 @@
* children we have and send them appropriate signals when necessary.
*
* "Special" children such as the startup, bgwriter and autovacuum launcher
- * tasks are not in this list. Autovacuum worker processes are in it.
+ * tasks are not in this list. Autovacuum worker processes are in it.
* Also, "dead_end" children are in it: these are children launched just
* for the purpose of sending a friendly rejection message to a would-be
- * client. We must track them because they are attached to shared memory,
+ * client. We must track them because they are attached to shared memory,
* but we know they will never become live backends.
*/
typedef struct bkend
@@ -189,7 +189,7 @@ static char ExtraOptions[MAXPGPATH];
* backend dumps core. Normally, it kills all peers of the dead backend
* and reinitializes shared memory. By specifying -s or -n, we can have
* the postmaster stop (rather than kill) peers and not reinitialize
- * shared data structures. (Reinit is currently dead code, though.)
+ * shared data structures. (Reinit is currently dead code, though.)
*/
static bool Reinit = true;
static int SendStop = false;
@@ -213,8 +213,8 @@ static pid_t StartupPID = 0,
WalWriterPID = 0,
AutoVacPID = 0,
PgArchPID = 0,
- PgStatPID = 0,
- SysLoggerPID = 0;
+ PgStatPID = 0,
+ SysLoggerPID = 0;
/* Startup/shutdown state */
#define NoShutdown 0
@@ -243,12 +243,13 @@ static bool FatalError = false; /* T if recovering from backend crash */
*
* Notice that this state variable does not distinguish *why* we entered
* PM_WAIT_BACKENDS or later states --- Shutdown and FatalError must be
- * consulted to find that out. FatalError is never true in PM_RUN state, nor
+ * consulted to find that out. FatalError is never true in PM_RUN state, nor
* in PM_SHUTDOWN state (because we don't enter that state when trying to
* recover from a crash). It can be true in PM_STARTUP state, because we
* don't clear it until we've successfully recovered.
*/
-typedef enum {
+typedef enum
+{
PM_INIT, /* postmaster starting */
PM_STARTUP, /* waiting for startup subprocess */
PM_RUN, /* normal "database is alive" state */
@@ -256,14 +257,14 @@ typedef enum {
PM_SHUTDOWN, /* waiting for bgwriter to do shutdown ckpt */
PM_WAIT_DEAD_END, /* waiting for dead_end children to exit */
PM_NO_CHILDREN /* all important children have exited */
-} PMState;
+} PMState;
static PMState pmState = PM_INIT;
bool ClientAuthInProgress = false; /* T during new-client
* authentication */
-bool redirection_done = false; /* stderr redirected for syslogger? */
+bool redirection_done = false; /* stderr redirected for syslogger? */
/* received START_AUTOVAC_LAUNCHER signal */
static volatile sig_atomic_t start_autovac_launcher = false;
@@ -321,6 +322,7 @@ static long PostmasterRandom(void);
static void RandomSalt(char *cryptSalt, char *md5Salt);
static void signal_child(pid_t pid, int signal);
static void SignalSomeChildren(int signal, bool only_autovac);
+
#define SignalChildren(sig) SignalSomeChildren(sig, false)
#define SignalAutovacWorkers(sig) SignalSomeChildren(sig, true)
static int CountChildren(void);
@@ -336,12 +338,12 @@ static void WINAPI pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOr
static HANDLE win32ChildQueue;
-typedef struct
+typedef struct
{
- HANDLE waitHandle;
- HANDLE procHandle;
- DWORD procId;
-} win32_deadchild_waitinfo;
+ HANDLE waitHandle;
+ HANDLE procHandle;
+ DWORD procId;
+} win32_deadchild_waitinfo;
HANDLE PostmasterHandle;
#endif
@@ -385,7 +387,7 @@ typedef struct
InheritableSocket pgStatSock;
pid_t PostmasterPid;
TimestampTz PgStartTime;
- bool redirection_done;
+ bool redirection_done;
#ifdef WIN32
HANDLE PostmasterHandle;
HANDLE initial_signal_pipe;
@@ -477,9 +479,9 @@ PostmasterMain(int argc, char *argv[])
opterr = 1;
/*
- * Parse command-line options. CAUTION: keep this in sync with
- * tcop/postgres.c (the option sets should not conflict)
- * and with the common help() function in main/main.c.
+ * Parse command-line options. CAUTION: keep this in sync with
+ * tcop/postgres.c (the option sets should not conflict) and with the
+ * common help() function in main/main.c.
*/
while ((opt = getopt(argc, argv, "A:B:c:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:W:-:")) != -1)
{
@@ -907,7 +909,7 @@ PostmasterMain(int argc, char *argv[])
win32ChildQueue = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 1);
if (win32ChildQueue == NULL)
ereport(FATAL,
- (errmsg("could not create I/O completion port for child queue")));
+ (errmsg("could not create I/O completion port for child queue")));
/*
* Set up a handle that child processes can use to check whether the
@@ -1158,8 +1160,8 @@ pmdaemonize(void)
MyStartTime = time(NULL);
/*
- * GH: If there's no setsid(), we hopefully don't need silent mode.
- * Until there's a better solution.
+ * GH: If there's no setsid(), we hopefully don't need silent mode. Until
+ * there's a better solution.
*/
#ifdef HAVE_SETSID
if (setsid() < 0)
@@ -1207,9 +1209,9 @@ ServerLoop(void)
* We wait at most one minute, to ensure that the other background
* tasks handled below get done even when no requests are arriving.
*
- * If we are in PM_WAIT_DEAD_END state, then we don't want to
- * accept any new connections, so we don't call select() at all;
- * just sleep for a little bit with signals unblocked.
+ * If we are in PM_WAIT_DEAD_END state, then we don't want to accept
+ * any new connections, so we don't call select() at all; just sleep
+ * for a little bit with signals unblocked.
*/
memcpy((char *) &rmask, (char *) &readmask, sizeof(fd_set));
@@ -1217,7 +1219,7 @@ ServerLoop(void)
if (pmState == PM_WAIT_DEAD_END)
{
- pg_usleep(100000L); /* 100 msec seems reasonable */
+ pg_usleep(100000L); /* 100 msec seems reasonable */
selres = 0;
}
else
@@ -1294,8 +1296,8 @@ ServerLoop(void)
BgWriterPID = StartBackgroundWriter();
/*
- * Likewise, if we have lost the walwriter process, try to start a
- * new one.
+ * Likewise, if we have lost the walwriter process, try to start a new
+ * one.
*/
if (WalWriterPID == 0 && pmState == PM_RUN)
WalWriterPID = StartWalWriter();
@@ -1307,13 +1309,13 @@ ServerLoop(void)
{
AutoVacPID = StartAutoVacLauncher();
if (AutoVacPID != 0)
- start_autovac_launcher = false; /* signal processed */
+ start_autovac_launcher = false; /* signal processed */
}
- /*
- * If we have lost the archiver, try to start a new one.
- * We do this even if we are shutting down, to allow archiver to
- * take care of any remaining WAL files.
+ /*
+ * If we have lost the archiver, try to start a new one. We do this
+ * even if we are shutting down, to allow archiver to take care of any
+ * remaining WAL files.
*/
if (XLogArchivingActive() && PgArchPID == 0 && pmState >= PM_RUN)
PgArchPID = pgarch_start();
@@ -1732,10 +1734,10 @@ canAcceptConnections(void)
if (pmState != PM_RUN)
{
if (Shutdown > NoShutdown)
- return CAC_SHUTDOWN; /* shutdown is pending */
+ return CAC_SHUTDOWN; /* shutdown is pending */
if (pmState == PM_STARTUP && !FatalError)
- return CAC_STARTUP; /* normal startup */
- return CAC_RECOVERY; /* else must be crash recovery */
+ return CAC_STARTUP; /* normal startup */
+ return CAC_RECOVERY; /* else must be crash recovery */
}
/*
@@ -1793,11 +1795,11 @@ ConnCreate(int serverFd)
}
/*
- * Allocate GSSAPI specific state struct
+ * Allocate GSSAPI specific state struct
*/
#ifndef EXEC_BACKEND
-#if defined(ENABLE_GSS) || defined(ENABLE_SSPI)
- port->gss = (pg_gssinfo *)calloc(1, sizeof(pg_gssinfo));
+#if defined(ENABLE_GSS) || defined(ENABLE_SSPI)
+ port->gss = (pg_gssinfo *) calloc(1, sizeof(pg_gssinfo));
if (!port->gss)
{
ereport(LOG,
@@ -2062,14 +2064,16 @@ reaper(SIGNAL_ARGS)
/* These macros hide platform variations in getting child status */
#ifdef HAVE_WAITPID
int status; /* child exit status */
+
#define LOOPTEST() ((pid = waitpid(-1, &status, WNOHANG)) > 0)
#define LOOPHEADER() (exitstatus = status)
-#else /* !HAVE_WAITPID */
+#else /* !HAVE_WAITPID */
#ifndef WIN32
union wait status; /* child exit status */
+
#define LOOPTEST() ((pid = wait3(&status, WNOHANG, NULL)) > 0)
#define LOOPHEADER() (exitstatus = status.w_status)
-#else /* WIN32 */
+#else /* WIN32 */
#define LOOPTEST() ((pid = win32_waitpid(&exitstatus)) > 0)
#define LOOPHEADER()
#endif /* WIN32 */
@@ -2152,7 +2156,7 @@ reaper(SIGNAL_ARGS)
/* at this point we are really open for business */
ereport(LOG,
- (errmsg("database system is ready to accept connections")));
+ (errmsg("database system is ready to accept connections")));
continue;
}
@@ -2166,13 +2170,13 @@ reaper(SIGNAL_ARGS)
if (EXIT_STATUS_0(exitstatus) && pmState == PM_SHUTDOWN)
{
/*
- * OK, we saw normal exit of the bgwriter after it's been
- * told to shut down. We expect that it wrote a shutdown
- * checkpoint. (If for some reason it didn't, recovery will
+ * OK, we saw normal exit of the bgwriter after it's been told
+ * to shut down. We expect that it wrote a shutdown
+ * checkpoint. (If for some reason it didn't, recovery will
* occur on next postmaster start.)
*
- * At this point we should have no normal children left
- * (else we'd not be in PM_SHUTDOWN state) but we might have
+ * At this point we should have no normal children left (else
+ * we'd not be in PM_SHUTDOWN state) but we might have
* dead_end children.
*/
Assert(Shutdown > NoShutdown);
@@ -2192,9 +2196,9 @@ reaper(SIGNAL_ARGS)
}
/*
- * Was it the wal writer? Normal exit can be ignored; we'll
- * start a new one at the next iteration of the postmaster's main loop,
- * if necessary. Any other exit condition is treated as a crash.
+ * Was it the wal writer? Normal exit can be ignored; we'll start a
+ * new one at the next iteration of the postmaster's main loop, if
+ * necessary. Any other exit condition is treated as a crash.
*/
if (pid == WalWriterPID)
{
@@ -2206,9 +2210,10 @@ reaper(SIGNAL_ARGS)
}
/*
- * Was it the autovacuum launcher? Normal exit can be ignored; we'll
- * start a new one at the next iteration of the postmaster's main loop,
- * if necessary. Any other exit condition is treated as a crash.
+ * Was it the autovacuum launcher? Normal exit can be ignored; we'll
+ * start a new one at the next iteration of the postmaster's main
+ * loop, if necessary. Any other exit condition is treated as a
+ * crash.
*/
if (pid == AutoVacPID)
{
@@ -2433,8 +2438,8 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
/*
* Force a power-cycle of the pgarch process too. (This isn't absolutely
* necessary, but it seems like a good idea for robustness, and it
- * simplifies the state-machine logic in the case where a shutdown
- * request arrives during crash processing.)
+ * simplifies the state-machine logic in the case where a shutdown request
+ * arrives during crash processing.)
*/
if (PgArchPID != 0 && !FatalError)
{
@@ -2448,8 +2453,8 @@ HandleChildCrash(int pid, int exitstatus, const char *procname)
/*
* Force a power-cycle of the pgstat process too. (This isn't absolutely
* necessary, but it seems like a good idea for robustness, and it
- * simplifies the state-machine logic in the case where a shutdown
- * request arrives during crash processing.)
+ * simplifies the state-machine logic in the case where a shutdown request
+ * arrives during crash processing.)
*/
if (PgStatPID != 0 && !FatalError)
{
@@ -2494,15 +2499,15 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
procname, pid, WTERMSIG(exitstatus)),
errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value.")));
#elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST
- ereport(lev,
-
- /*------
- translator: %s is a noun phrase describing a child process, such as
- "server process" */
- (errmsg("%s (PID %d) was terminated by signal %d: %s",
- procname, pid, WTERMSIG(exitstatus),
- WTERMSIG(exitstatus) < NSIG ?
- sys_siglist[WTERMSIG(exitstatus)] : "(unknown)")));
+ ereport(lev,
+
+ /*------
+ translator: %s is a noun phrase describing a child process, such as
+ "server process" */
+ (errmsg("%s (PID %d) was terminated by signal %d: %s",
+ procname, pid, WTERMSIG(exitstatus),
+ WTERMSIG(exitstatus) < NSIG ?
+ sys_siglist[WTERMSIG(exitstatus)] : "(unknown)")));
#else
ereport(lev,
@@ -2532,18 +2537,18 @@ static void
PostmasterStateMachine(void)
{
/*
- * If we are in a state-machine state that implies waiting for backends
- * to exit, see if they're all gone, and change state if so.
+ * If we are in a state-machine state that implies waiting for backends to
+ * exit, see if they're all gone, and change state if so.
*/
if (pmState == PM_WAIT_BACKENDS)
{
/*
* PM_WAIT_BACKENDS state ends when we have no regular backends
* (including autovac workers) and no walwriter or autovac launcher.
- * If we are doing crash recovery then we expect the bgwriter to
- * exit too, otherwise not. The archiver, stats, and syslogger
- * processes are disregarded since they are not connected to shared
- * memory; we also disregard dead_end children here.
+ * If we are doing crash recovery then we expect the bgwriter to exit
+ * too, otherwise not. The archiver, stats, and syslogger processes
+ * are disregarded since they are not connected to shared memory; we
+ * also disregard dead_end children here.
*/
if (CountChildren() == 0 &&
StartupPID == 0 &&
@@ -2554,7 +2559,7 @@ PostmasterStateMachine(void)
if (FatalError)
{
/*
- * Start waiting for dead_end children to die. This state
+ * Start waiting for dead_end children to die. This state
* change causes ServerLoop to stop creating new ones.
*/
pmState = PM_WAIT_DEAD_END;
@@ -2562,9 +2567,9 @@ PostmasterStateMachine(void)
else
{
/*
- * If we get here, we are proceeding with normal shutdown.
- * All the regular children are gone, and it's time to tell
- * the bgwriter to do a shutdown checkpoint.
+ * If we get here, we are proceeding with normal shutdown. All
+ * the regular children are gone, and it's time to tell the
+ * bgwriter to do a shutdown checkpoint.
*/
Assert(Shutdown > NoShutdown);
/* Start the bgwriter if not running */
@@ -2579,10 +2584,10 @@ PostmasterStateMachine(void)
else
{
/*
- * If we failed to fork a bgwriter, just shut down.
- * Any required cleanup will happen at next restart.
- * We set FatalError so that an "abnormal shutdown"
- * message gets logged when we exit.
+ * If we failed to fork a bgwriter, just shut down. Any
+ * required cleanup will happen at next restart. We set
+ * FatalError so that an "abnormal shutdown" message gets
+ * logged when we exit.
*/
FatalError = true;
pmState = PM_WAIT_DEAD_END;
@@ -2600,8 +2605,8 @@ PostmasterStateMachine(void)
if (pmState == PM_WAIT_DEAD_END)
{
/*
- * PM_WAIT_DEAD_END state ends when the BackendList is entirely
- * empty (ie, no dead_end children remain).
+ * PM_WAIT_DEAD_END state ends when the BackendList is entirely empty
+ * (ie, no dead_end children remain).
*/
if (!DLGetHead(BackendList))
{
@@ -2617,7 +2622,7 @@ PostmasterStateMachine(void)
/*
* If we've been told to shut down, we exit as soon as there are no
- * remaining children. If there was a crash, cleanup will occur at the
+ * remaining children. If there was a crash, cleanup will occur at the
* next startup. (Before PostgreSQL 8.3, we tried to recover from the
* crash before exiting, but that seems unwise if we are quitting because
* we got SIGTERM from init --- there may well not be time for recovery
@@ -2627,7 +2632,7 @@ PostmasterStateMachine(void)
* processes. They've been sent SIGQUIT by this point (either when we
* entered PM_SHUTDOWN state, or when we set FatalError, and at least one
* of those must have happened by now). In any case they contain logic to
- * commit hara-kiri if they notice the postmaster is gone. Since they
+ * commit hara-kiri if they notice the postmaster is gone. Since they
* aren't connected to shared memory, they pose no problem for shutdown.
* The syslogger is not considered either, since it's intended to survive
* till the postmaster exits.
@@ -2648,7 +2653,7 @@ PostmasterStateMachine(void)
/*
* If we need to recover from a crash, wait for all shmem-connected
- * children to exit, then reset shmem and StartupDataBase. (We can ignore
+ * children to exit, then reset shmem and StartupDataBase. (We can ignore
* the archiver and stats processes here since they are not connected to
* shmem.)
*/
@@ -2678,7 +2683,7 @@ PostmasterStateMachine(void)
* system().
*
* There is a race condition for recently-forked children: they might not
- * have executed setsid() yet. So we signal the child directly as well as
+ * have executed setsid() yet. So we signal the child directly as well as
* the group. We assume such a child will handle the signal before trying
* to spawn any grandchild processes. We also assume that signaling the
* child twice will not cause any problems.
@@ -2945,7 +2950,7 @@ BackendInitialize(Port *port)
/*
* If possible, make this process a group leader, so that the postmaster
- * can signal any child processes too. (We do this now on the off chance
+ * can signal any child processes too. (We do this now on the off chance
* that something might spawn a child process during authentication.)
*/
#ifdef HAVE_SETSID
@@ -3448,17 +3453,18 @@ internal_forkexec(int argc, char *argv[], Port *port)
}
/*
- * Queue a waiter for to signal when this child dies. The wait will be handled automatically
- * by an operating system thread pool.
+ * Queue a waiter for to signal when this child dies. The wait will be
+ * handled automatically by an operating system thread pool.
*
- * Note: use malloc instead of palloc, since it needs to be thread-safe. Struct will be
- * free():d from the callback function that runs on a different thread.
+ * Note: use malloc instead of palloc, since it needs to be thread-safe.
+ * Struct will be free():d from the callback function that runs on a
+ * different thread.
*/
childinfo = malloc(sizeof(win32_deadchild_waitinfo));
if (!childinfo)
ereport(FATAL,
- (errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
+ (errcode(ERRCODE_OUT_OF_MEMORY),
+ errmsg("out of memory")));
childinfo->procHandle = pi.hProcess;
childinfo->procId = pi.dwProcessId;
@@ -3468,10 +3474,10 @@ internal_forkexec(int argc, char *argv[], Port *port)
pgwin32_deadchild_callback,
childinfo,
INFINITE,
- WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD))
+ WT_EXECUTEONLYONCE | WT_EXECUTEINWAITTHREAD))
ereport(FATAL,
- (errmsg_internal("could not register process for wait: error code %d",
- (int) GetLastError())));
+ (errmsg_internal("could not register process for wait: error code %d",
+ (int) GetLastError())));
/* Don't close pi.hProcess here - the wait thread needs access to it */
@@ -3505,13 +3511,14 @@ SubPostmasterMain(int argc, char *argv[])
MyStartTime = time(NULL);
- /* make sure stderr is in binary mode before anything can
- * possibly be written to it, in case it's actually the syslogger pipe,
- * so the pipe chunking protocol isn't disturbed. Non-logpipe data
- * gets translated on redirection (e.g. via pg_ctl -l) anyway.
+ /*
+ * make sure stderr is in binary mode before anything can possibly be
+ * written to it, in case it's actually the syslogger pipe, so the pipe
+ * chunking protocol isn't disturbed. Non-logpipe data gets translated on
+ * redirection (e.g. via pg_ctl -l) anyway.
*/
#ifdef WIN32
- _setmode(fileno(stderr),_O_BINARY);
+ _setmode(fileno(stderr), _O_BINARY);
#endif
/* Lose the postmaster's on-exit routines (really a no-op) */
@@ -3529,12 +3536,12 @@ SubPostmasterMain(int argc, char *argv[])
memset(&port, 0, sizeof(Port));
read_backend_variables(argv[2], &port);
- /*
- * Set up memory area for GSS information. Mirrors the code in
- * ConnCreate for the non-exec case.
+ /*
+ * Set up memory area for GSS information. Mirrors the code in ConnCreate
+ * for the non-exec case.
*/
#if defined(ENABLE_GSS) || defined(ENABLE_SSPI)
- port.gss = (pg_gssinfo *)calloc(1, sizeof(pg_gssinfo));
+ port.gss = (pg_gssinfo *) calloc(1, sizeof(pg_gssinfo));
if (!port.gss)
ereport(FATAL,
(errcode(ERRCODE_OUT_OF_MEMORY),
@@ -3601,8 +3608,8 @@ SubPostmasterMain(int argc, char *argv[])
* process any libraries that should be preloaded at postmaster start
*
* NOTE: we have to re-load the shared_preload_libraries here because
- * this backend is not fork()ed so we can't inherit any shared
- * libraries / DLL's from our parent (the postmaster).
+ * this backend is not fork()ed so we can't inherit any shared
+ * libraries / DLL's from our parent (the postmaster).
*/
process_shared_preload_libraries();
@@ -3899,6 +3906,7 @@ PostmasterRandom(void)
struct timeval random_stop_time;
gettimeofday(&random_stop_time, NULL);
+
/*
* We are not sure how much precision is in tv_usec, so we swap
* the high and low 16 bits of 'random_stop_time' and XOR them
@@ -4014,7 +4022,7 @@ StartChildProcess(AuxProcType type)
break;
case WalWriterProcess:
ereport(LOG,
- (errmsg("could not fork WAL writer process: %m")));
+ (errmsg("could not fork WAL writer process: %m")));
break;
default:
ereport(LOG,
@@ -4049,7 +4057,7 @@ StartChildProcess(AuxProcType type)
static void
StartAutovacuumWorker(void)
{
- Backend *bn;
+ Backend *bn;
/*
* If not in condition to run a process, don't try, but handle it like a
@@ -4061,8 +4069,8 @@ StartAutovacuumWorker(void)
if (canAcceptConnections() == CAC_OK)
{
/*
- * Compute the cancel key that will be assigned to this session.
- * We probably don't need cancel keys for autovac workers, but we'd
+ * Compute the cancel key that will be assigned to this session. We
+ * probably don't need cancel keys for autovac workers, but we'd
* better have something random in the field to prevent unfriendly
* people from sending cancels to them.
*/
@@ -4098,9 +4106,9 @@ StartAutovacuumWorker(void)
}
/*
- * Report the failure to the launcher, if it's running. (If it's not,
- * we might not even be connected to shared memory, so don't try to
- * call AutoVacWorkerFailed.)
+ * Report the failure to the launcher, if it's running. (If it's not, we
+ * might not even be connected to shared memory, so don't try to call
+ * AutoVacWorkerFailed.)
*/
if (AutoVacPID != 0)
{
@@ -4487,16 +4495,17 @@ ShmemBackendArrayRemove(pid_t pid)
static pid_t
win32_waitpid(int *exitstatus)
{
- DWORD dwd;
- ULONG_PTR key;
- OVERLAPPED* ovl;
+ DWORD dwd;
+ ULONG_PTR key;
+ OVERLAPPED *ovl;
/*
- * Check if there are any dead children. If there are, return the pid of the first one that died.
+ * Check if there are any dead children. If there are, return the pid of
+ * the first one that died.
*/
if (GetQueuedCompletionStatus(win32ChildQueue, &dwd, &key, &ovl, 0))
{
- *exitstatus = (int)key;
+ *exitstatus = (int) key;
return dwd;
}
@@ -4510,13 +4519,17 @@ win32_waitpid(int *exitstatus)
static void WINAPI
pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
{
- win32_deadchild_waitinfo *childinfo = (win32_deadchild_waitinfo *)lpParameter;
+ win32_deadchild_waitinfo *childinfo = (win32_deadchild_waitinfo *) lpParameter;
DWORD exitcode;
if (TimerOrWaitFired)
- return; /* timeout. Should never happen, since we use INFINITE as timeout value. */
+ return; /* timeout. Should never happen, since we use
+ * INFINITE as timeout value. */
- /* Remove handle from wait - required even though it's set to wait only once */
+ /*
+ * Remove handle from wait - required even though it's set to wait only
+ * once
+ */
UnregisterWaitEx(childinfo->waitHandle, NULL);
if (!GetExitCodeProcess(childinfo->procHandle, &exitcode))
@@ -4528,13 +4541,19 @@ pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired)
exitcode = 255;
}
- if (!PostQueuedCompletionStatus(win32ChildQueue, childinfo->procId, (ULONG_PTR)exitcode, NULL))
+ if (!PostQueuedCompletionStatus(win32ChildQueue, childinfo->procId, (ULONG_PTR) exitcode, NULL))
write_stderr("could not post child completion status\n");
- /* Handle is per-process, so we close it here instead of in the originating thread */
+ /*
+ * Handle is per-process, so we close it here instead of in the
+ * originating thread
+ */
CloseHandle(childinfo->procHandle);
- /* Free struct that was allocated before the call to RegisterWaitForSingleObject() */
+ /*
+ * Free struct that was allocated before the call to
+ * RegisterWaitForSingleObject()
+ */
free(childinfo);
/* Queue SIGCHLD signal */
diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c
index 8ac38f0baa..0a255b5e07 100644
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -18,7 +18,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.40 2007/09/22 18:19:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.41 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,7 +55,7 @@
#define LBF_MODE _IOLBF
#endif
-/*
+/*
* We read() into a temp buffer twice as big as a chunk, so that any fragment
* left after processing can be moved down to the front and we'll still have
* room to read a full chunk.
@@ -91,7 +91,7 @@ static FILE *csvlogFile = NULL;
static char *last_file_name = NULL;
static char *last_csvfile_name = NULL;
-/*
+/*
* Buffers for saving partial messages from different backends. We don't expect
* that there will be very many outstanding at one time, so 20 seems plenty of
* leeway. If this array gets full we won't lose messages, but we will lose
@@ -101,9 +101,9 @@ static char *last_csvfile_name = NULL;
*/
typedef struct
{
- int32 pid; /* PID of source process */
+ int32 pid; /* PID of source process */
StringInfoData data; /* accumulated data, as a StringInfo */
-} save_buffer;
+} save_buffer;
#define CHUNK_SLOTS 20
static save_buffer saved_chunks[CHUNK_SLOTS];
@@ -140,7 +140,7 @@ static void open_csvlogfile(void);
static unsigned int __stdcall pipeThread(void *arg);
#endif
static void logfile_rotate(bool time_based_rotation, int size_rotation_for);
-static char *logfile_getname(pg_time_t timestamp, char * suffix);
+static char *logfile_getname(pg_time_t timestamp, char *suffix);
static void set_next_rotation_time(void);
static void sigHupHandler(SIGNAL_ARGS);
static void sigUsr1Handler(SIGNAL_ARGS);
@@ -165,7 +165,7 @@ SysLoggerMain(int argc, char *argv[])
MyProcPid = getpid(); /* reset MyProcPid */
- MyStartTime = time(NULL); /* set our start time in case we call elog */
+ MyStartTime = time(NULL); /* set our start time in case we call elog */
#ifdef EXEC_BACKEND
syslogger_parseArgs(argc, argv);
@@ -199,13 +199,14 @@ SysLoggerMain(int argc, char *argv[])
close(fd);
}
- /* Syslogger's own stderr can't be the syslogPipe, so set it back to
- * text mode if we didn't just close it.
- * (It was set to binary in SubPostmasterMain).
+ /*
+ * Syslogger's own stderr can't be the syslogPipe, so set it back to text
+ * mode if we didn't just close it. (It was set to binary in
+ * SubPostmasterMain).
*/
#ifdef WIN32
else
- _setmode(_fileno(stderr),_O_TEXT);
+ _setmode(_fileno(stderr), _O_TEXT);
#endif
/*
@@ -225,9 +226,9 @@ SysLoggerMain(int argc, char *argv[])
/*
* If possible, make this process a group leader, so that the postmaster
- * can signal any child processes too. (syslogger probably never has
- * any child processes, but for consistency we make all postmaster
- * child processes do this.)
+ * can signal any child processes too. (syslogger probably never has any
+ * child processes, but for consistency we make all postmaster child
+ * processes do this.)
*/
#ifdef HAVE_SETSID
if (setsid() < 0)
@@ -284,7 +285,8 @@ SysLoggerMain(int argc, char *argv[])
for (;;)
{
bool time_based_rotation = false;
- int size_rotation_for = 0;
+ int size_rotation_for = 0;
+
#ifndef WIN32
int bytesRead;
int rc;
@@ -348,14 +350,14 @@ SysLoggerMain(int argc, char *argv[])
rotation_requested = true;
size_rotation_for |= LOG_DESTINATION_CSVLOG;
}
-
+
}
if (rotation_requested)
{
/*
- * Force rotation when both values are zero.
- * It means the request was sent by pg_rotate_logfile.
+ * Force rotation when both values are zero. It means the request
+ * was sent by pg_rotate_logfile.
*/
if (!time_based_rotation && size_rotation_for == 0)
size_rotation_for = LOG_DESTINATION_STDERR | LOG_DESTINATION_CSVLOG;
@@ -425,8 +427,9 @@ SysLoggerMain(int argc, char *argv[])
if (pipe_eof_seen)
{
- /* seeing this message on the real stderr is annoying - so we
- * make it DEBUG1 to suppress in normal use.
+ /*
+ * seeing this message on the real stderr is annoying - so we make
+ * it DEBUG1 to suppress in normal use.
*/
ereport(DEBUG1,
(errmsg("logger shutting down")));
@@ -566,9 +569,9 @@ SysLogger_Start(void)
int fd;
/*
- * open the pipe in binary mode and make sure
- * stderr is binary after it's been dup'ed into, to avoid
- * disturbing the pipe chunking protocol.
+ * open the pipe in binary mode and make sure stderr is binary
+ * after it's been dup'ed into, to avoid disturbing the pipe
+ * chunking protocol.
*/
fflush(stderr);
fd = _open_osfhandle((long) syslogPipe[1],
@@ -578,7 +581,7 @@ SysLogger_Start(void)
(errcode_for_file_access(),
errmsg("could not redirect stderr: %m")));
close(fd);
- _setmode(_fileno(stderr),_O_BINARY);
+ _setmode(_fileno(stderr), _O_BINARY);
/* Now we are done with the write end of the pipe. */
CloseHandle(syslogPipe[1]);
syslogPipe[1] = 0;
@@ -682,10 +685,10 @@ syslogger_parseArgs(int argc, char *argv[])
* Process data received through the syslogger pipe.
*
* This routine interprets the log pipe protocol which sends log messages as
- * (hopefully atomic) chunks - such chunks are detected and reassembled here.
+ * (hopefully atomic) chunks - such chunks are detected and reassembled here.
*
* The protocol has a header that starts with two nul bytes, then has a 16 bit
- * length, the pid of the sending process, and a flag to indicate if it is
+ * length, the pid of the sending process, and a flag to indicate if it is
* the last chunk in a message. Incomplete chunks are saved until we read some
* more, and non-final chunks are accumulated until we get the final chunk.
*
@@ -704,23 +707,23 @@ syslogger_parseArgs(int argc, char *argv[])
static void
process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
{
- char *cursor = logbuffer;
- int count = *bytes_in_logbuffer;
- int dest = LOG_DESTINATION_STDERR;
+ char *cursor = logbuffer;
+ int count = *bytes_in_logbuffer;
+ int dest = LOG_DESTINATION_STDERR;
/* While we have enough for a header, process data... */
while (count >= (int) sizeof(PipeProtoHeader))
{
PipeProtoHeader p;
- int chunklen;
+ int chunklen;
/* Do we have a valid header? */
memcpy(&p, cursor, sizeof(PipeProtoHeader));
if (p.nuls[0] == '\0' && p.nuls[1] == '\0' &&
p.len > 0 && p.len <= PIPE_MAX_PAYLOAD &&
p.pid != 0 &&
- (p.is_last == 't' || p.is_last == 'f' ||
- p.is_last == 'T' || p.is_last == 'F' ))
+ (p.is_last == 't' || p.is_last == 'f' ||
+ p.is_last == 'T' || p.is_last == 'F'))
{
chunklen = PIPE_HEADER_SIZE + p.len;
@@ -728,18 +731,19 @@ process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
if (count < chunklen)
break;
- dest = (p.is_last == 'T' || p.is_last == 'F' ) ?
+ dest = (p.is_last == 'T' || p.is_last == 'F') ?
LOG_DESTINATION_CSVLOG : LOG_DESTINATION_STDERR;
if (p.is_last == 'f' || p.is_last == 'F')
{
- /*
- * Save a complete non-final chunk in the per-pid buffer
- * if possible - if not just write it out.
+ /*
+ * Save a complete non-final chunk in the per-pid buffer if
+ * possible - if not just write it out.
*/
- int free_slot = -1, existing_slot = -1;
- int i;
- StringInfo str;
+ int free_slot = -1,
+ existing_slot = -1;
+ int i;
+ StringInfo str;
for (i = 0; i < CHUNK_SLOTS; i++)
{
@@ -755,7 +759,7 @@ process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
{
str = &(saved_chunks[existing_slot].data);
appendBinaryStringInfo(str,
- cursor + PIPE_HEADER_SIZE,
+ cursor + PIPE_HEADER_SIZE,
p.len);
}
else if (free_slot >= 0)
@@ -764,29 +768,29 @@ process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
str = &(saved_chunks[free_slot].data);
initStringInfo(str);
appendBinaryStringInfo(str,
- cursor + PIPE_HEADER_SIZE,
+ cursor + PIPE_HEADER_SIZE,
p.len);
}
else
{
- /*
+ /*
* If there is no free slot we'll just have to take our
* chances and write out a partial message and hope that
* it's not followed by something from another pid.
*/
- write_syslogger_file(cursor + PIPE_HEADER_SIZE, p.len,
+ write_syslogger_file(cursor + PIPE_HEADER_SIZE, p.len,
dest);
}
}
else
{
- /*
+ /*
* Final chunk --- add it to anything saved for that pid, and
* either way write the whole thing out.
*/
- int existing_slot = -1;
- int i;
- StringInfo str;
+ int existing_slot = -1;
+ int i;
+ StringInfo str;
for (i = 0; i < CHUNK_SLOTS; i++)
{
@@ -810,7 +814,7 @@ process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
{
/* The whole message was one chunk, evidently. */
write_syslogger_file(cursor + PIPE_HEADER_SIZE, p.len,
- dest);
+ dest);
}
}
@@ -818,18 +822,18 @@ process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
cursor += chunklen;
count -= chunklen;
}
- else
+ else
{
/* Process non-protocol data */
/*
* Look for the start of a protocol header. If found, dump data
* up to there and repeat the loop. Otherwise, dump it all and
- * fall out of the loop. (Note: we want to dump it all if
- * at all possible, so as to avoid dividing non-protocol messages
- * across logfiles. We expect that in many scenarios, a
- * non-protocol message will arrive all in one read(), and we
- * want to respect the read() boundary if possible.)
+ * fall out of the loop. (Note: we want to dump it all if at all
+ * possible, so as to avoid dividing non-protocol messages across
+ * logfiles. We expect that in many scenarios, a non-protocol
+ * message will arrive all in one read(), and we want to respect
+ * the read() boundary if possible.)
*/
for (chunklen = 1; chunklen < count; chunklen++)
{
@@ -858,8 +862,8 @@ process_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
static void
flush_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
{
- int i;
- StringInfo str;
+ int i;
+ StringInfo str;
/* Dump any incomplete protocol messages */
for (i = 0; i < CHUNK_SLOTS; i++)
@@ -872,12 +876,13 @@ flush_pipe_input(char *logbuffer, int *bytes_in_logbuffer)
pfree(str->data);
}
}
+
/*
* Force out any remaining pipe data as-is; we don't bother trying to
* remove any protocol headers that may exist in it.
*/
if (*bytes_in_logbuffer > 0)
- write_syslogger_file(logbuffer, *bytes_in_logbuffer,
+ write_syslogger_file(logbuffer, *bytes_in_logbuffer,
LOG_DESTINATION_STDERR);
*bytes_in_logbuffer = 0;
}
@@ -899,12 +904,12 @@ void
write_syslogger_file(const char *buffer, int count, int destination)
{
int rc;
- FILE * logfile;
+ FILE *logfile;
if (destination == LOG_DESTINATION_CSVLOG && csvlogFile == NULL)
open_csvlogfile();
- logfile = destination == LOG_DESTINATION_CSVLOG ? csvlogFile : syslogFile ;
+ logfile = destination == LOG_DESTINATION_CSVLOG ? csvlogFile : syslogFile;
#ifndef WIN32
rc = fwrite(buffer, 1, count, logfile);
@@ -972,16 +977,16 @@ pipeThread(void *arg)
#endif /* WIN32 */
/*
- * open the csv log file - we do this opportunistically, because
+ * open the csv log file - we do this opportunistically, because
* we don't know if CSV logging will be wanted.
*/
static void
open_csvlogfile(void)
{
- char *filename;
- FILE *fh;
+ char *filename;
+ FILE *fh;
- filename = logfile_getname(time(NULL),".csv");
+ filename = logfile_getname(time(NULL), ".csv");
fh = fopen(filename, "a");
@@ -994,7 +999,7 @@ open_csvlogfile(void)
setvbuf(fh, NULL, LBF_MODE, 0);
#ifdef WIN32
- _setmode(_fileno(fh), _O_TEXT); /* use CRLF line endings on Windows */
+ _setmode(_fileno(fh), _O_TEXT); /* use CRLF line endings on Windows */
#endif
csvlogFile = fh;
@@ -1010,7 +1015,7 @@ static void
logfile_rotate(bool time_based_rotation, int size_rotation_for)
{
char *filename;
- char *csvfilename = NULL;
+ char *csvfilename = NULL;
FILE *fh;
rotation_requested = false;
@@ -1066,10 +1071,10 @@ logfile_rotate(bool time_based_rotation, int size_rotation_for)
filename)));
/*
- * ENFILE/EMFILE are not too surprising on a busy system; just keep
- * using the old file till we manage to get a new one. Otherwise,
- * assume something's wrong with Log_directory and stop trying to
- * create files.
+ * ENFILE/EMFILE are not too surprising on a busy system; just
+ * keep using the old file till we manage to get a new one.
+ * Otherwise, assume something's wrong with Log_directory and stop
+ * trying to create files.
*/
if (saveerrno != ENFILE && saveerrno != EMFILE)
{
@@ -1108,14 +1113,14 @@ logfile_rotate(bool time_based_rotation, int size_rotation_for)
/* same as above, but for csv file. */
- if (csvlogFile != NULL && (
- time_based_rotation ||
- (size_rotation_for & LOG_DESTINATION_STDERR)))
+ if (csvlogFile != NULL && (
+ time_based_rotation ||
+ (size_rotation_for & LOG_DESTINATION_STDERR)))
{
if (Log_truncate_on_rotation && time_based_rotation &&
- last_csvfile_name != NULL &&
+ last_csvfile_name != NULL &&
strcmp(csvfilename, last_csvfile_name) != 0)
-
+
fh = fopen(csvfilename, "w");
else
fh = fopen(csvfilename, "a");
@@ -1130,10 +1135,10 @@ logfile_rotate(bool time_based_rotation, int size_rotation_for)
csvfilename)));
/*
- * ENFILE/EMFILE are not too surprising on a busy system; just keep
- * using the old file till we manage to get a new one. Otherwise,
- * assume something's wrong with Log_directory and stop trying to
- * create files.
+ * ENFILE/EMFILE are not too surprising on a busy system; just
+ * keep using the old file till we manage to get a new one.
+ * Otherwise, assume something's wrong with Log_directory and stop
+ * trying to create files.
*/
if (saveerrno != ENFILE && saveerrno != EMFILE)
{
@@ -1179,7 +1184,7 @@ logfile_rotate(bool time_based_rotation, int size_rotation_for)
* Result is palloc'd.
*/
static char *
-logfile_getname(pg_time_t timestamp, char * suffix)
+logfile_getname(pg_time_t timestamp, char *suffix)
{
char *filename;
int len;
@@ -1206,7 +1211,7 @@ logfile_getname(pg_time_t timestamp, char * suffix)
if (suffix != NULL)
{
len = strlen(filename);
- if (len > 4 && (strcmp(filename+(len-4),".log") == 0))
+ if (len > 4 && (strcmp(filename + (len - 4), ".log") == 0))
len -= 4;
strncpy(filename + len, suffix, MAXPGPATH - len);
}
diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c
index d5736b7e69..0780403a8d 100644
--- a/src/backend/postmaster/walwriter.c
+++ b/src/backend/postmaster/walwriter.c
@@ -34,7 +34,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.2 2007/09/11 17:15:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.3 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -92,9 +92,9 @@ WalWriterMain(void)
/*
* If possible, make this process a group leader, so that the postmaster
- * can signal any child processes too. (walwriter probably never has
- * any child processes, but for consistency we make all postmaster
- * child processes do this.)
+ * can signal any child processes too. (walwriter probably never has any
+ * child processes, but for consistency we make all postmaster child
+ * processes do this.)
*/
#ifdef HAVE_SETSID
if (setsid() < 0)
@@ -107,14 +107,14 @@ WalWriterMain(void)
* We have no particular use for SIGINT at the moment, but seems
* reasonable to treat like SIGTERM.
*/
- pqsignal(SIGHUP, WalSigHupHandler); /* set flag to read config file */
+ pqsignal(SIGHUP, WalSigHupHandler); /* set flag to read config file */
pqsignal(SIGINT, WalShutdownHandler); /* request shutdown */
pqsignal(SIGTERM, WalShutdownHandler); /* request shutdown */
- pqsignal(SIGQUIT, wal_quickdie); /* hard crash time */
+ pqsignal(SIGQUIT, wal_quickdie); /* hard crash time */
pqsignal(SIGALRM, SIG_IGN);
pqsignal(SIGPIPE, SIG_IGN);
pqsignal(SIGUSR1, SIG_IGN); /* reserve for sinval */
- pqsignal(SIGUSR2, SIG_IGN); /* not used */
+ pqsignal(SIGUSR2, SIG_IGN); /* not used */
/*
* Reset some signals that are accepted by postmaster but not here
@@ -133,8 +133,8 @@ WalWriterMain(void)
#endif
/*
- * Create a resource owner to keep track of our resources (not clear
- * that we need this, but may as well have one).
+ * Create a resource owner to keep track of our resources (not clear that
+ * we need this, but may as well have one).
*/
CurrentResourceOwner = ResourceOwnerCreate(NULL, "Wal Writer");
diff --git a/src/backend/regex/regc_color.c b/src/backend/regex/regc_color.c
index 0264760ea7..268e072c59 100644
--- a/src/backend/regex/regc_color.c
+++ b/src/backend/regex/regc_color.c
@@ -28,7 +28,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/src/backend/regex/regc_color.c,v 1.6 2007/10/06 16:18:09 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/regex/regc_color.c,v 1.7 2007/11/15 21:14:37 momjian Exp $
*
*
* Note that there are some incestuous relationships between this code and
@@ -722,13 +722,14 @@ dumpcolors(struct colormap * cm,
else
fprintf(f, "#%2ld%s(%2d): ", (long) co,
has, cd->nchrs);
+
/*
* Unfortunately, it's hard to do this next bit more efficiently.
*
* Spencer's original coding has the loop iterating from CHR_MIN
- * to CHR_MAX, but that's utterly unusable for 32-bit chr.
- * For debugging purposes it seems fine to print only chr
- * codes up to 1000 or so.
+ * to CHR_MAX, but that's utterly unusable for 32-bit chr. For
+ * debugging purposes it seems fine to print only chr codes up to
+ * 1000 or so.
*/
for (c = CHR_MIN; c < 1000; c++)
if (GETCOLOR(cm, c) == co)
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index 34c13068f9..51ce0da2d2 100644
--- a/src/backend/rewrite/rewriteDefine.c
+++ b/src/backend/rewrite/rewriteDefine.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.122 2007/08/27 03:36:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.123 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -671,16 +671,16 @@ EnableDisableRule(Relation rel, const char *rulename,
Assert(eventRelationOid == owningRel);
if (!pg_class_ownercheck(eventRelationOid, GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_CLASS,
- get_rel_name(eventRelationOid));
-
+ get_rel_name(eventRelationOid));
+
/*
* Change ev_enabled if it is different from the desired new state.
*/
if (DatumGetChar(((Form_pg_rewrite) GETSTRUCT(ruletup))->ev_enabled) !=
- fires_when)
- {
+ fires_when)
+ {
((Form_pg_rewrite) GETSTRUCT(ruletup))->ev_enabled =
- CharGetDatum(fires_when);
+ CharGetDatum(fires_when);
simple_heap_update(pg_rewrite_desc, &ruletup->t_self, ruletup);
/* keep system catalog indexes current */
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c
index 6170b2f984..a639a5420a 100644
--- a/src/backend/rewrite/rewriteManip.c
+++ b/src/backend/rewrite/rewriteManip.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.105 2007/09/06 17:31:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.106 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -975,14 +975,14 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
context->sublevels_up == 0)
{
/*
- * We get here if a WHERE CURRENT OF expression turns out to
- * apply to a view. Someday we might be able to translate
- * the expression to apply to an underlying table of the view,
- * but right now it's not implemented.
+ * We get here if a WHERE CURRENT OF expression turns out to apply
+ * to a view. Someday we might be able to translate the
+ * expression to apply to an underlying table of the view, but
+ * right now it's not implemented.
*/
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("WHERE CURRENT OF on a view is not implemented")));
+ errmsg("WHERE CURRENT OF on a view is not implemented")));
}
/* otherwise fall through to copy the expr normally */
}
diff --git a/src/backend/snowball/dict_snowball.c b/src/backend/snowball/dict_snowball.c
index 57aac234ed..94786975d7 100644
--- a/src/backend/snowball/dict_snowball.c
+++ b/src/backend/snowball/dict_snowball.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/snowball/dict_snowball.c,v 1.3 2007/08/25 00:03:59 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/snowball/dict_snowball.c,v 1.4 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,6 +66,7 @@ PG_MODULE_MAGIC;
PG_FUNCTION_INFO_V1(dsnowball_init);
Datum dsnowball_init(PG_FUNCTION_ARGS);
+
PG_FUNCTION_INFO_V1(dsnowball_lexize);
Datum dsnowball_lexize(PG_FUNCTION_ARGS);
@@ -77,7 +78,7 @@ typedef struct stemmer_module
struct SN_env *(*create) (void);
void (*close) (struct SN_env *);
int (*stem) (struct SN_env *);
-} stemmer_module;
+} stemmer_module;
static const stemmer_module stemmer_modules[] =
{
@@ -139,7 +140,7 @@ typedef struct DictSnowball
* context, so we just remember CurrentMemoryContext
*/
MemoryContext dictCtx;
-} DictSnowball;
+} DictSnowball;
static void
@@ -238,7 +239,7 @@ dsnowball_lexize(PG_FUNCTION_ARGS)
{
DictSnowball *d = (DictSnowball *) PG_GETARG_POINTER(0);
char *in = (char *) PG_GETARG_POINTER(1);
- int32 len = PG_GETARG_INT32(2);
+ int32 len = PG_GETARG_INT32(2);
char *txt = lowerstr_with_len(in, len);
TSLexeme *res = palloc0(sizeof(TSLexeme) * 2);
@@ -259,7 +260,7 @@ dsnowball_lexize(PG_FUNCTION_ARGS)
recoded = (char *) pg_do_encoding_conversion((unsigned char *) txt,
strlen(txt),
- GetDatabaseEncoding(),
+ GetDatabaseEncoding(),
PG_UTF8);
if (recoded == NULL)
elog(ERROR, "encoding conversion failed");
@@ -292,7 +293,7 @@ dsnowball_lexize(PG_FUNCTION_ARGS)
recoded = (char *) pg_do_encoding_conversion((unsigned char *) txt,
strlen(txt),
PG_UTF8,
- GetDatabaseEncoding());
+ GetDatabaseEncoding());
if (recoded == NULL)
elog(ERROR, "encoding conversion failed");
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index ce7c54deee..6a18e274e1 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.226 2007/09/25 22:11:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.227 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -77,8 +77,8 @@ static volatile BufferDesc *PinCountWaitBuf = NULL;
static Buffer ReadBuffer_common(Relation reln, BlockNumber blockNum,
- bool zeroPage,
- BufferAccessStrategy strategy);
+ bool zeroPage,
+ BufferAccessStrategy strategy);
static bool PinBuffer(volatile BufferDesc *buf, BufferAccessStrategy strategy);
static void PinBuffer_Locked(volatile BufferDesc *buf);
static void UnpinBuffer(volatile BufferDesc *buf, bool fixOwner);
@@ -90,8 +90,8 @@ static void TerminateBufferIO(volatile BufferDesc *buf, bool clear_dirty,
int set_flag_bits);
static void buffer_write_error_callback(void *arg);
static volatile BufferDesc *BufferAlloc(Relation reln, BlockNumber blockNum,
- BufferAccessStrategy strategy,
- bool *foundPtr);
+ BufferAccessStrategy strategy,
+ bool *foundPtr);
static void FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln);
static void AtProcExit_Buffers(int code, Datum arg);
@@ -215,10 +215,10 @@ ReadBuffer_common(Relation reln, BlockNumber blockNum, bool zeroPage,
* This can happen because mdread doesn't complain about reads beyond
* EOF (when zero_damaged_pages is ON) and so a previous attempt to
* read a block beyond EOF could have left a "valid" zero-filled
- * buffer. Unfortunately, we have also seen this case occurring
+ * buffer. Unfortunately, we have also seen this case occurring
* because of buggy Linux kernels that sometimes return an
- * lseek(SEEK_END) result that doesn't account for a recent write.
- * In that situation, the pre-existing buffer would contain valid data
+ * lseek(SEEK_END) result that doesn't account for a recent write. In
+ * that situation, the pre-existing buffer would contain valid data
* that we don't want to overwrite. Since the legitimate case should
* always have left a zero-filled buffer, complain if not PageIsNew.
*/
@@ -283,9 +283,9 @@ ReadBuffer_common(Relation reln, BlockNumber blockNum, bool zeroPage,
}
else
{
- /*
- * Read in the page, unless the caller intends to overwrite it
- * and just wants us to allocate a buffer.
+ /*
+ * Read in the page, unless the caller intends to overwrite it and
+ * just wants us to allocate a buffer.
*/
if (zeroPage)
MemSet((char *) bufBlock, 0, BLCKSZ);
@@ -420,7 +420,7 @@ BufferAlloc(Relation reln,
/* Loop here in case we have to try another victim buffer */
for (;;)
{
- bool lock_held;
+ bool lock_held;
/*
* Select a victim buffer. The buffer is returned with its header
@@ -472,7 +472,7 @@ BufferAlloc(Relation reln,
* If using a nondefault strategy, and writing the buffer
* would require a WAL flush, let the strategy decide whether
* to go ahead and write/reuse the buffer or to choose another
- * victim. We need lock to inspect the page LSN, so this
+ * victim. We need lock to inspect the page LSN, so this
* can't be done inside StrategyGetBuffer.
*/
if (strategy != NULL &&
@@ -630,8 +630,8 @@ BufferAlloc(Relation reln,
*
* Clearing BM_VALID here is necessary, clearing the dirtybits is just
* paranoia. We also reset the usage_count since any recency of use of
- * the old content is no longer relevant. (The usage_count starts out
- * at 1 so that the buffer can survive one clock-sweep pass.)
+ * the old content is no longer relevant. (The usage_count starts out at
+ * 1 so that the buffer can survive one clock-sweep pass.)
*/
buf->tag = newTag;
buf->flags &= ~(BM_VALID | BM_DIRTY | BM_JUST_DIRTIED | BM_CHECKPOINT_NEEDED | BM_IO_ERROR);
@@ -865,7 +865,7 @@ ReleaseAndReadBuffer(Buffer buffer,
* when we first pin it; for other strategies we just make sure the usage_count
* isn't zero. (The idea of the latter is that we don't want synchronized
* heap scans to inflate the count, but we need it to not be zero to discourage
- * other backends from stealing buffers from our ring. As long as we cycle
+ * other backends from stealing buffers from our ring. As long as we cycle
* through the ring faster than the global clock-sweep cycles, buffers in
* our ring won't be chosen as victims for replacement by other backends.)
*
@@ -1016,9 +1016,8 @@ BufferSync(int flags)
* have the flag set.
*
* Note that if we fail to write some buffer, we may leave buffers with
- * BM_CHECKPOINT_NEEDED still set. This is OK since any such buffer
- * would certainly need to be written for the next checkpoint attempt,
- * too.
+ * BM_CHECKPOINT_NEEDED still set. This is OK since any such buffer would
+ * certainly need to be written for the next checkpoint attempt, too.
*/
num_to_write = 0;
for (buf_id = 0; buf_id < NBuffers; buf_id++)
@@ -1045,11 +1044,11 @@ BufferSync(int flags)
/*
* Loop over all buffers again, and write the ones (still) marked with
- * BM_CHECKPOINT_NEEDED. In this loop, we start at the clock sweep
- * point since we might as well dump soon-to-be-recycled buffers first.
+ * BM_CHECKPOINT_NEEDED. In this loop, we start at the clock sweep point
+ * since we might as well dump soon-to-be-recycled buffers first.
*
- * Note that we don't read the buffer alloc count here --- that should
- * be left untouched till the next BgBufferSync() call.
+ * Note that we don't read the buffer alloc count here --- that should be
+ * left untouched till the next BgBufferSync() call.
*/
buf_id = StrategySyncStart(NULL, NULL);
num_to_scan = NBuffers;
@@ -1067,8 +1066,8 @@ BufferSync(int flags)
* examine the bit here and the time SyncOneBuffer acquires lock,
* someone else not only wrote the buffer but replaced it with another
* page and dirtied it. In that improbable case, SyncOneBuffer will
- * write the buffer though we didn't need to. It doesn't seem
- * worth guarding against this, though.
+ * write the buffer though we didn't need to. It doesn't seem worth
+ * guarding against this, though.
*/
if (bufHdr->flags & BM_CHECKPOINT_NEEDED)
{
@@ -1092,8 +1091,8 @@ BufferSync(int flags)
break;
/*
- * Perform normal bgwriter duties and sleep to throttle
- * our I/O rate.
+ * Perform normal bgwriter duties and sleep to throttle our
+ * I/O rate.
*/
CheckpointWriteDelay(flags,
(double) num_written / num_to_write);
@@ -1105,8 +1104,8 @@ BufferSync(int flags)
}
/*
- * Update checkpoint statistics. As noted above, this doesn't
- * include buffers written by other backends or bgwriter scan.
+ * Update checkpoint statistics. As noted above, this doesn't include
+ * buffers written by other backends or bgwriter scan.
*/
CheckpointStats.ckpt_bufs_written += num_written;
}
@@ -1128,7 +1127,7 @@ BgBufferSync(void)
* Information saved between calls so we can determine the strategy
* point's advance rate and avoid scanning already-cleaned buffers.
*/
- static bool saved_info_valid = false;
+ static bool saved_info_valid = false;
static int prev_strategy_buf_id;
static uint32 prev_strategy_passes;
static int next_to_clean;
@@ -1157,8 +1156,8 @@ BgBufferSync(void)
int reusable_buffers;
/*
- * Find out where the freelist clock sweep currently is, and how
- * many buffer allocations have happened since our last call.
+ * Find out where the freelist clock sweep currently is, and how many
+ * buffer allocations have happened since our last call.
*/
strategy_buf_id = StrategySyncStart(&strategy_passes, &recent_alloc);
@@ -1166,9 +1165,9 @@ BgBufferSync(void)
BgWriterStats.m_buf_alloc += recent_alloc;
/*
- * If we're not running the LRU scan, just stop after doing the
- * stats stuff. We mark the saved state invalid so that we can recover
- * sanely if LRU scan is turned back on later.
+ * If we're not running the LRU scan, just stop after doing the stats
+ * stuff. We mark the saved state invalid so that we can recover sanely
+ * if LRU scan is turned back on later.
*/
if (bgwriter_lru_maxpages <= 0)
{
@@ -1178,18 +1177,19 @@ BgBufferSync(void)
/*
* Compute strategy_delta = how many buffers have been scanned by the
- * clock sweep since last time. If first time through, assume none.
- * Then see if we are still ahead of the clock sweep, and if so, how many
- * buffers we could scan before we'd catch up with it and "lap" it.
- * Note: weird-looking coding of xxx_passes comparisons are to avoid
- * bogus behavior when the passes counts wrap around.
+ * clock sweep since last time. If first time through, assume none. Then
+ * see if we are still ahead of the clock sweep, and if so, how many
+ * buffers we could scan before we'd catch up with it and "lap" it. Note:
+ * weird-looking coding of xxx_passes comparisons are to avoid bogus
+ * behavior when the passes counts wrap around.
*/
if (saved_info_valid)
{
- int32 passes_delta = strategy_passes - prev_strategy_passes;
+ int32 passes_delta = strategy_passes - prev_strategy_passes;
strategy_delta = strategy_buf_id - prev_strategy_buf_id;
- strategy_delta += (long) passes_delta * NBuffers;
+ strategy_delta += (long) passes_delta *NBuffers;
+
Assert(strategy_delta >= 0);
if ((int32) (next_passes - strategy_passes) > 0)
@@ -1218,8 +1218,8 @@ BgBufferSync(void)
else
{
/*
- * We're behind, so skip forward to the strategy point
- * and start cleaning from there.
+ * We're behind, so skip forward to the strategy point and start
+ * cleaning from there.
*/
#ifdef BGW_DEBUG
elog(DEBUG2, "bgwriter behind: bgw %u-%u strategy %u-%u delta=%ld",
@@ -1235,8 +1235,8 @@ BgBufferSync(void)
else
{
/*
- * Initializing at startup or after LRU scanning had been off.
- * Always start at the strategy point.
+ * Initializing at startup or after LRU scanning had been off. Always
+ * start at the strategy point.
*/
#ifdef BGW_DEBUG
elog(DEBUG2, "bgwriter initializing: strategy %u-%u",
@@ -1254,8 +1254,8 @@ BgBufferSync(void)
saved_info_valid = true;
/*
- * Compute how many buffers had to be scanned for each new allocation,
- * ie, 1/density of reusable buffers, and track a moving average of that.
+ * Compute how many buffers had to be scanned for each new allocation, ie,
+ * 1/density of reusable buffers, and track a moving average of that.
*
* If the strategy point didn't move, we don't update the density estimate
*/
@@ -1268,16 +1268,16 @@ BgBufferSync(void)
/*
* Estimate how many reusable buffers there are between the current
- * strategy point and where we've scanned ahead to, based on the
- * smoothed density estimate.
+ * strategy point and where we've scanned ahead to, based on the smoothed
+ * density estimate.
*/
bufs_ahead = NBuffers - bufs_to_lap;
reusable_buffers_est = (float) bufs_ahead / smoothed_density;
/*
- * Track a moving average of recent buffer allocations. Here, rather
- * than a true average we want a fast-attack, slow-decline behavior:
- * we immediately follow any increase.
+ * Track a moving average of recent buffer allocations. Here, rather than
+ * a true average we want a fast-attack, slow-decline behavior: we
+ * immediately follow any increase.
*/
if (smoothed_alloc <= (float) recent_alloc)
smoothed_alloc = recent_alloc;
@@ -1291,12 +1291,12 @@ BgBufferSync(void)
/*
* Even in cases where there's been little or no buffer allocation
* activity, we want to make a small amount of progress through the buffer
- * cache so that as many reusable buffers as possible are clean
- * after an idle period.
+ * cache so that as many reusable buffers as possible are clean after an
+ * idle period.
*
- * (scan_whole_pool_milliseconds / BgWriterDelay) computes how many
- * times the BGW will be called during the scan_whole_pool time;
- * slice the buffer pool into that many sections.
+ * (scan_whole_pool_milliseconds / BgWriterDelay) computes how many times
+ * the BGW will be called during the scan_whole_pool time; slice the
+ * buffer pool into that many sections.
*/
min_scan_buffers = (int) (NBuffers / (scan_whole_pool_milliseconds / BgWriterDelay));
@@ -1311,9 +1311,9 @@ BgBufferSync(void)
/*
* Now write out dirty reusable buffers, working forward from the
- * next_to_clean point, until we have lapped the strategy scan, or
- * cleaned enough buffers to match our estimate of the next cycle's
- * allocation requirements, or hit the bgwriter_lru_maxpages limit.
+ * next_to_clean point, until we have lapped the strategy scan, or cleaned
+ * enough buffers to match our estimate of the next cycle's allocation
+ * requirements, or hit the bgwriter_lru_maxpages limit.
*/
/* Make sure we can handle the pin inside SyncOneBuffer */
@@ -1326,7 +1326,7 @@ BgBufferSync(void)
/* Execute the LRU scan */
while (num_to_scan > 0 && reusable_buffers < upcoming_alloc_est)
{
- int buffer_state = SyncOneBuffer(next_to_clean, true);
+ int buffer_state = SyncOneBuffer(next_to_clean, true);
if (++next_to_clean >= NBuffers)
{
@@ -1361,11 +1361,11 @@ BgBufferSync(void)
/*
* Consider the above scan as being like a new allocation scan.
- * Characterize its density and update the smoothed one based on it.
- * This effectively halves the moving average period in cases where
- * both the strategy and the background writer are doing some useful
- * scanning, which is helpful because a long memory isn't as desirable
- * on the density estimates.
+ * Characterize its density and update the smoothed one based on it. This
+ * effectively halves the moving average period in cases where both the
+ * strategy and the background writer are doing some useful scanning,
+ * which is helpful because a long memory isn't as desirable on the
+ * density estimates.
*/
strategy_delta = bufs_to_lap - num_to_scan;
recent_alloc = reusable_buffers - reusable_buffers_est;
@@ -1402,7 +1402,7 @@ static int
SyncOneBuffer(int buf_id, bool skip_recently_used)
{
volatile BufferDesc *bufHdr = &BufferDescriptors[buf_id];
- int result = 0;
+ int result = 0;
/*
* Check whether buffer needs writing.
@@ -2312,7 +2312,7 @@ LockBufferForCleanup(Buffer buffer)
*
* We won't loop, but just check once to see if the pin count is OK. If
* not, return FALSE with no lock held.
- */
+ */
bool
ConditionalLockBufferForCleanup(Buffer buffer)
{
diff --git a/src/backend/storage/buffer/freelist.c b/src/backend/storage/buffer/freelist.c
index 781b754cfc..b1219b58f7 100644
--- a/src/backend/storage/buffer/freelist.c
+++ b/src/backend/storage/buffer/freelist.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/buffer/freelist.c,v 1.61 2007/09/25 20:03:38 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/freelist.c,v 1.62 2007/11/15 21:14:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,10 +36,10 @@ typedef struct
*/
/*
- * Statistics. These counters should be wide enough that they can't
+ * Statistics. These counters should be wide enough that they can't
* overflow during a single bgwriter cycle.
*/
- uint32 completePasses; /* Complete cycles of the clock sweep */
+ uint32 completePasses; /* Complete cycles of the clock sweep */
uint32 numBufferAllocs; /* Buffers allocated since last reset */
} BufferStrategyControl;
@@ -57,31 +57,33 @@ typedef struct BufferAccessStrategyData
BufferAccessStrategyType btype;
/* Number of elements in buffers[] array */
int ring_size;
+
/*
* Index of the "current" slot in the ring, ie, the one most recently
* returned by GetBufferFromRing.
*/
int current;
+
/*
- * True if the buffer just returned by StrategyGetBuffer had been in
- * the ring already.
+ * True if the buffer just returned by StrategyGetBuffer had been in the
+ * ring already.
*/
bool current_was_in_ring;
/*
- * Array of buffer numbers. InvalidBuffer (that is, zero) indicates
- * we have not yet selected a buffer for this ring slot. For allocation
+ * Array of buffer numbers. InvalidBuffer (that is, zero) indicates we
+ * have not yet selected a buffer for this ring slot. For allocation
* simplicity this is palloc'd together with the fixed fields of the
* struct.
*/
- Buffer buffers[1]; /* VARIABLE SIZE ARRAY */
-} BufferAccessStrategyData;
+ Buffer buffers[1]; /* VARIABLE SIZE ARRAY */
+} BufferAccessStrategyData;
/* Prototypes for internal functions */
static volatile BufferDesc *GetBufferFromRing(BufferAccessStrategy strategy);
static void AddBufferToRing(BufferAccessStrategy strategy,
- volatile BufferDesc *buf);
+ volatile BufferDesc *buf);
/*
@@ -108,8 +110,8 @@ StrategyGetBuffer(BufferAccessStrategy strategy, bool *lock_held)
int trycounter;
/*
- * If given a strategy object, see whether it can select a buffer.
- * We assume strategy objects don't need the BufFreelistLock.
+ * If given a strategy object, see whether it can select a buffer. We
+ * assume strategy objects don't need the BufFreelistLock.
*/
if (strategy != NULL)
{
@@ -127,7 +129,7 @@ StrategyGetBuffer(BufferAccessStrategy strategy, bool *lock_held)
/*
* We count buffer allocation requests so that the bgwriter can estimate
- * the rate of buffer consumption. Note that buffers recycled by a
+ * the rate of buffer consumption. Note that buffers recycled by a
* strategy object are intentionally not counted here.
*/
StrategyControl->numBufferAllocs++;
@@ -151,8 +153,8 @@ StrategyGetBuffer(BufferAccessStrategy strategy, bool *lock_held)
* If the buffer is pinned or has a nonzero usage_count, we cannot use
* it; discard it and retry. (This can only happen if VACUUM put a
* valid buffer in the freelist and then someone else used it before
- * we got to it. It's probably impossible altogether as of 8.3,
- * but we'd better check anyway.)
+ * we got to it. It's probably impossible altogether as of 8.3, but
+ * we'd better check anyway.)
*/
LockBufHdr(buf);
if (buf->refcount == 0 && buf->usage_count == 0)
@@ -246,7 +248,7 @@ StrategyFreeBuffer(volatile BufferDesc *buf)
*
* In addition, we return the completed-pass count (which is effectively
* the higher-order bits of nextVictimBuffer) and the count of recent buffer
- * allocs if non-NULL pointers are passed. The alloc count is reset after
+ * allocs if non-NULL pointers are passed. The alloc count is reset after
* being read.
*/
int
@@ -363,12 +365,12 @@ BufferAccessStrategy
GetAccessStrategy(BufferAccessStrategyType btype)
{
BufferAccessStrategy strategy;
- int ring_size;
+ int ring_size;
/*
- * Select ring size to use. See buffer/README for rationales.
- * (Currently all cases are the same size, but keep this code
- * structure for flexibility.)
+ * Select ring size to use. See buffer/README for rationales. (Currently
+ * all cases are the same size, but keep this code structure for
+ * flexibility.)
*
* Note: if you change the ring size for BAS_BULKREAD, see also
* SYNC_SCAN_REPORT_INTERVAL in access/heap/syncscan.c.
@@ -438,9 +440,9 @@ GetBufferFromRing(BufferAccessStrategy strategy)
strategy->current = 0;
/*
- * If the slot hasn't been filled yet, tell the caller to allocate
- * a new buffer with the normal allocation strategy. He will then
- * fill this slot by calling AddBufferToRing with the new buffer.
+ * If the slot hasn't been filled yet, tell the caller to allocate a new
+ * buffer with the normal allocation strategy. He will then fill this
+ * slot by calling AddBufferToRing with the new buffer.
*/
bufnum = strategy->buffers[strategy->current];
if (bufnum == InvalidBuffer)
@@ -454,9 +456,9 @@ GetBufferFromRing(BufferAccessStrategy strategy)
*
* If usage_count is 0 or 1 then the buffer is fair game (we expect 1,
* since our own previous usage of the ring element would have left it
- * there, but it might've been decremented by clock sweep since then).
- * A higher usage_count indicates someone else has touched the buffer,
- * so we shouldn't re-use it.
+ * there, but it might've been decremented by clock sweep since then). A
+ * higher usage_count indicates someone else has touched the buffer, so we
+ * shouldn't re-use it.
*/
buf = &BufferDescriptors[bufnum - 1];
LockBufHdr(buf);
@@ -492,7 +494,7 @@ AddBufferToRing(BufferAccessStrategy strategy, volatile BufferDesc *buf)
*
* When a nondefault strategy is used, the buffer manager calls this function
* when it turns out that the buffer selected by StrategyGetBuffer needs to
- * be written out and doing so would require flushing WAL too. This gives us
+ * be written out and doing so would require flushing WAL too. This gives us
* a chance to choose a different victim.
*
* Returns true if buffer manager should ask for a new victim, and false
@@ -507,7 +509,7 @@ StrategyRejectBuffer(BufferAccessStrategy strategy, volatile BufferDesc *buf)
/* Don't muck with behavior of normal buffer-replacement strategy */
if (!strategy->current_was_in_ring ||
- strategy->buffers[strategy->current] != BufferDescriptorGetBuffer(buf))
+ strategy->buffers[strategy->current] != BufferDescriptorGetBuffer(buf))
return false;
/*
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index ad2bcf8dac..42d68a8f7e 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.77 2007/05/30 20:11:59 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.78 2007/11/15 21:14:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -139,7 +139,7 @@ LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool *foundPtr)
/* Found a usable buffer */
LocalRefCount[b]++;
ResourceOwnerRememberBuffer(CurrentResourceOwner,
- BufferDescriptorGetBuffer(bufHdr));
+ BufferDescriptorGetBuffer(bufHdr));
break;
}
}
@@ -364,7 +364,7 @@ GetLocalBufferStorage(void)
if (next_buf_in_block >= num_bufs_in_block)
{
/* Need to make a new request to memmgr */
- int num_bufs;
+ int num_bufs;
/* Start with a 16-buffer request; subsequent ones double each time */
num_bufs = Max(num_bufs_in_block * 2, 16);
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 79da1f9c6f..6d70fea77d 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.140 2007/07/26 15:15:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.141 2007/11/15 21:14:38 momjian Exp $
*
* NOTES:
*
@@ -855,16 +855,16 @@ OpenTemporaryFile(bool interXact)
/*
* If some temp tablespace(s) have been given to us, try to use the next
- * one. If a given tablespace can't be found, we silently fall back
- * to the database's default tablespace.
+ * one. If a given tablespace can't be found, we silently fall back to
+ * the database's default tablespace.
*
* BUT: if the temp file is slated to outlive the current transaction,
- * force it into the database's default tablespace, so that it will
- * not pose a threat to possible tablespace drop attempts.
+ * force it into the database's default tablespace, so that it will not
+ * pose a threat to possible tablespace drop attempts.
*/
if (numTempTableSpaces > 0 && !interXact)
{
- Oid tblspcOid = GetNextTempTableSpace();
+ Oid tblspcOid = GetNextTempTableSpace();
if (OidIsValid(tblspcOid))
file = OpenTemporaryFileInTablespace(tblspcOid, false);
@@ -872,7 +872,7 @@ OpenTemporaryFile(bool interXact)
/*
* If not, or if tablespace is bad, create in database's default
- * tablespace. MyDatabaseTableSpace should normally be set before we get
+ * tablespace. MyDatabaseTableSpace should normally be set before we get
* here, but just in case it isn't, fall back to pg_default tablespace.
*/
if (file <= 0)
@@ -941,8 +941,8 @@ OpenTemporaryFileInTablespace(Oid tblspcOid, bool rejectError)
if (fi