summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian2009-06-11 14:49:15 +0000
committerBruce Momjian2009-06-11 14:49:15 +0000
commitd7471402794266078953f1bd113dab4913d631a1 (patch)
tree618e392a84eaf837e00bf78f8694097b78fec227 /src
parent4e86efb4e51b66ef57b3fe6f28576de23a1bf1c6 (diff)
8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/common/heaptuple.c8
-rw-r--r--src/backend/access/common/indextuple.c6
-rw-r--r--src/backend/access/common/printtup.c4
-rw-r--r--src/backend/access/common/reloptions.c168
-rw-r--r--src/backend/access/common/tupdesc.c6
-rw-r--r--src/backend/access/gin/ginarrayproc.c3
-rw-r--r--src/backend/access/gin/ginbulk.c12
-rw-r--r--src/backend/access/gin/gindatapage.c4
-rw-r--r--src/backend/access/gin/ginentrypage.c36
-rw-r--r--src/backend/access/gin/ginfast.c339
-rw-r--r--src/backend/access/gin/ginget.c485
-rw-r--r--src/backend/access/gin/gininsert.c51
-rw-r--r--src/backend/access/gin/ginscan.c28
-rw-r--r--src/backend/access/gin/ginutil.c86
-rw-r--r--src/backend/access/gin/ginvacuum.c14
-rw-r--r--src/backend/access/gin/ginxlog.c87
-rw-r--r--src/backend/access/gist/gistget.c58
-rw-r--r--src/backend/access/gist/gistproc.c17
-rw-r--r--src/backend/access/gist/gistscan.c10
-rw-r--r--src/backend/access/gist/gistsplit.c44
-rw-r--r--src/backend/access/gist/gistutil.c5
-rw-r--r--src/backend/access/gist/gistvacuum.c4
-rw-r--r--src/backend/access/hash/hash.c18
-rw-r--r--src/backend/access/hash/hashfunc.c70
-rw-r--r--src/backend/access/hash/hashpage.c22
-rw-r--r--src/backend/access/hash/hashscan.c6
-rw-r--r--src/backend/access/hash/hashsearch.c14
-rw-r--r--src/backend/access/hash/hashsort.c12
-rw-r--r--src/backend/access/hash/hashutil.c44
-rw-r--r--src/backend/access/heap/heapam.c74
-rw-r--r--src/backend/access/heap/hio.c10
-rw-r--r--src/backend/access/heap/pruneheap.c57
-rw-r--r--src/backend/access/heap/rewriteheap.c4
-rw-r--r--src/backend/access/heap/tuptoaster.c22
-rw-r--r--src/backend/access/heap/visibilitymap.c50
-rw-r--r--src/backend/access/index/genam.c19
-rw-r--r--src/backend/access/index/indexam.c10
-rw-r--r--src/backend/access/nbtree/nbtinsert.c6
-rw-r--r--src/backend/access/nbtree/nbtree.c9
-rw-r--r--src/backend/access/nbtree/nbtxlog.c8
-rw-r--r--src/backend/access/transam/clog.c53
-rw-r--r--src/backend/access/transam/twophase.c4
-rw-r--r--src/backend/access/transam/xact.c107
-rw-r--r--src/backend/access/transam/xlog.c239
-rw-r--r--src/backend/access/transam/xlogutils.c44
-rw-r--r--src/backend/catalog/aclchk.c181
-rw-r--r--src/backend/catalog/catalog.c18
-rw-r--r--src/backend/catalog/dependency.c139
-rw-r--r--src/backend/catalog/heap.c55
-rw-r--r--src/backend/catalog/index.c34
-rw-r--r--src/backend/catalog/namespace.c26
-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_depend.c10
-rw-r--r--src/backend/catalog/pg_inherits.c14
-rw-r--r--src/backend/catalog/pg_operator.c50
-rw-r--r--src/backend/catalog/pg_proc.c27
-rw-r--r--src/backend/catalog/pg_shdepend.c28
-rw-r--r--src/backend/catalog/pg_type.c22
-rw-r--r--src/backend/catalog/storage.c45
-rw-r--r--src/backend/catalog/toasting.c6
-rw-r--r--src/backend/commands/aggregatecmds.c12
-rw-r--r--src/backend/commands/analyze.c86
-rw-r--r--src/backend/commands/async.c35
-rw-r--r--src/backend/commands/cluster.c20
-rw-r--r--src/backend/commands/comment.c10
-rw-r--r--src/backend/commands/conversioncmds.c24
-rw-r--r--src/backend/commands/copy.c75
-rw-r--r--src/backend/commands/dbcommands.c100
-rw-r--r--src/backend/commands/explain.c6
-rw-r--r--src/backend/commands/foreigncmds.c227
-rw-r--r--src/backend/commands/functioncmds.c26
-rw-r--r--src/backend/commands/indexcmds.c28
-rw-r--r--src/backend/commands/lockcmds.c14
-rw-r--r--src/backend/commands/operatorcmds.c20
-rw-r--r--src/backend/commands/portalcmds.c6
-rw-r--r--src/backend/commands/prepare.c4
-rw-r--r--src/backend/commands/proclang.c8
-rw-r--r--src/backend/commands/schemacmds.c12
-rw-r--r--src/backend/commands/sequence.c10
-rw-r--r--src/backend/commands/tablecmds.c278
-rw-r--r--src/backend/commands/trigger.c58
-rw-r--r--src/backend/commands/tsearchcmds.c58
-rw-r--r--src/backend/commands/typecmds.c84
-rw-r--r--src/backend/commands/user.c18
-rw-r--r--src/backend/commands/vacuum.c58
-rw-r--r--src/backend/commands/vacuumlazy.c29
-rw-r--r--src/backend/commands/variable.c8
-rw-r--r--src/backend/commands/view.c14
-rw-r--r--src/backend/executor/execCurrent.c6
-rw-r--r--src/backend/executor/execMain.c42
-rw-r--r--src/backend/executor/execQual.c130
-rw-r--r--src/backend/executor/execTuples.c20
-rw-r--r--src/backend/executor/execUtils.c15
-rw-r--r--src/backend/executor/functions.c99
-rw-r--r--src/backend/executor/nodeBitmapHeapscan.c51
-rw-r--r--src/backend/executor/nodeBitmapIndexscan.c4
-rw-r--r--src/backend/executor/nodeCtescan.c30
-rw-r--r--src/backend/executor/nodeFunctionscan.c4
-rw-r--r--src/backend/executor/nodeHash.c109
-rw-r--r--src/backend/executor/nodeHashjoin.c18
-rw-r--r--src/backend/executor/nodeIndexscan.c24
-rw-r--r--src/backend/executor/nodeLimit.c6
-rw-r--r--src/backend/executor/nodeMaterial.c10
-rw-r--r--src/backend/executor/nodeMergejoin.c6
-rw-r--r--src/backend/executor/nodeNestloop.c6
-rw-r--r--src/backend/executor/nodeRecursiveunion.c26
-rw-r--r--src/backend/executor/nodeSetOp.c22
-rw-r--r--src/backend/executor/nodeSubplan.c34
-rw-r--r--src/backend/executor/nodeTidscan.c10
-rw-r--r--src/backend/executor/nodeUnique.c8
-rw-r--r--src/backend/executor/nodeWindowAgg.c279
-rw-r--r--src/backend/executor/nodeWorktablescan.c14
-rw-r--r--src/backend/executor/spi.c55
-rw-r--r--src/backend/executor/tstoreReceiver.c10
-rw-r--r--src/backend/foreign/foreign.c109
-rw-r--r--src/backend/libpq/auth.c91
-rw-r--r--src/backend/libpq/be-fsstubs.c10
-rw-r--r--src/backend/libpq/be-secure.c38
-rw-r--r--src/backend/libpq/hba.c208
-rw-r--r--src/backend/libpq/ip.c7
-rw-r--r--src/backend/libpq/pqformat.c4
-rw-r--r--src/backend/nodes/copyfuncs.c12
-rw-r--r--src/backend/nodes/equalfuncs.c6
-rw-r--r--src/backend/nodes/list.c4
-rw-r--r--src/backend/nodes/nodeFuncs.c56
-rw-r--r--src/backend/nodes/outfuncs.c8
-rw-r--r--src/backend/nodes/readfuncs.c11
-rw-r--r--src/backend/nodes/tidbitmap.c26
-rw-r--r--src/backend/optimizer/path/allpaths.c43
-rw-r--r--src/backend/optimizer/path/clausesel.c36
-rw-r--r--src/backend/optimizer/path/costsize.c120
-rw-r--r--src/backend/optimizer/path/equivclass.c40
-rw-r--r--src/backend/optimizer/path/indxpath.c40
-rw-r--r--src/backend/optimizer/path/joinpath.c16
-rw-r--r--src/backend/optimizer/path/joinrels.c37
-rw-r--r--src/backend/optimizer/path/orindxpath.c6
-rw-r--r--src/backend/optimizer/plan/createplan.c102
-rw-r--r--src/backend/optimizer/plan/initsplan.c32
-rw-r--r--src/backend/optimizer/plan/planagg.c16
-rw-r--r--src/backend/optimizer/plan/planmain.c8
-rw-r--r--src/backend/optimizer/plan/planner.c213
-rw-r--r--src/backend/optimizer/plan/setrefs.c28
-rw-r--r--src/backend/optimizer/plan/subselect.c173
-rw-r--r--src/backend/optimizer/prep/prepjointree.c174
-rw-r--r--src/backend/optimizer/prep/prepunion.c64
-rw-r--r--src/backend/optimizer/util/clauses.c95
-rw-r--r--src/backend/optimizer/util/pathnode.c53
-rw-r--r--src/backend/optimizer/util/placeholder.c18
-rw-r--r--src/backend/optimizer/util/plancat.c16
-rw-r--r--src/backend/optimizer/util/predtest.c19
-rw-r--r--src/backend/optimizer/util/relnode.c6
-rw-r--r--src/backend/optimizer/util/restrictinfo.c16
-rw-r--r--src/backend/optimizer/util/var.c18
-rw-r--r--src/backend/parser/analyze.c88
-rw-r--r--src/backend/parser/parse_agg.c55
-rw-r--r--src/backend/parser/parse_clause.c128
-rw-r--r--src/backend/parser/parse_coerce.c47
-rw-r--r--src/backend/parser/parse_cte.c203
-rw-r--r--src/backend/parser/parse_expr.c71
-rw-r--r--src/backend/parser/parse_func.c50
-rw-r--r--src/backend/parser/parse_node.c10
-rw-r--r--src/backend/parser/parse_oper.c28
-rw-r--r--src/backend/parser/parse_relation.c54
-rw-r--r--src/backend/parser/parse_target.c22
-rw-r--r--src/backend/parser/parse_type.c9
-rw-r--r--src/backend/parser/parse_utilcmd.c25
-rw-r--r--src/backend/parser/parser.c4
-rw-r--r--src/backend/port/darwin/system.c2
-rw-r--r--src/backend/port/dynloader/sco.c2
-rw-r--r--src/backend/port/dynloader/solaris.c2
-rw-r--r--src/backend/port/dynloader/sunos4.c2
-rw-r--r--src/backend/port/dynloader/svr4.c2
-rw-r--r--src/backend/port/dynloader/univel.c2
-rw-r--r--src/backend/port/dynloader/univel.h2
-rw-r--r--src/backend/port/dynloader/unixware.c2
-rw-r--r--src/backend/port/dynloader/unixware.h2
-rw-r--r--src/backend/port/dynloader/win32.h2
-rw-r--r--src/backend/port/nextstep/port.c2
-rw-r--r--src/backend/port/posix_sema.c10
-rw-r--r--src/backend/port/sysv_sema.c18
-rw-r--r--src/backend/port/win32/mingwcompat.c6
-rw-r--r--src/backend/port/win32/socket.c13
-rw-r--r--src/backend/port/win32/timer.c4
-rw-r--r--src/backend/port/win32_sema.c10
-rw-r--r--src/backend/port/win32_shmem.c33
-rw-r--r--src/backend/postmaster/autovacuum.c88
-rw-r--r--src/backend/postmaster/bgwriter.c36
-rw-r--r--src/backend/postmaster/pgarch.c36
-rw-r--r--src/backend/postmaster/pgstat.c86
-rw-r--r--src/backend/postmaster/postmaster.c144
-rw-r--r--src/backend/postmaster/syslogger.c7
-rw-r--r--src/backend/postmaster/walwriter.c6
-rw-r--r--src/backend/regex/regc_lex.c20
-rw-r--r--src/backend/regex/regc_nfa.c25
-rw-r--r--src/backend/rewrite/rewriteDefine.c10
-rw-r--r--src/backend/rewrite/rewriteHandler.c8
-rw-r--r--src/backend/rewrite/rewriteManip.c22
-rw-r--r--src/backend/rewrite/rewriteRemove.c8
-rw-r--r--src/backend/storage/buffer/bufmgr.c85
-rw-r--r--src/backend/storage/buffer/localbuf.c6
-rw-r--r--src/backend/storage/file/buffile.c4
-rw-r--r--src/backend/storage/file/fd.c23
-rw-r--r--src/backend/storage/freespace/freespace.c131
-rw-r--r--src/backend/storage/freespace/fsmpage.c110
-rw-r--r--src/backend/storage/freespace/indexfsm.c12
-rw-r--r--src/backend/storage/ipc/ipc.c18
-rw-r--r--src/backend/storage/ipc/pmsignal.c9
-rw-r--r--src/backend/storage/ipc/procarray.c25
-rw-r--r--src/backend/storage/ipc/sinval.c23
-rw-r--r--src/backend/storage/ipc/sinvaladt.c64
-rw-r--r--src/backend/storage/large_object/inv_api.c14
-rw-r--r--src/backend/storage/lmgr/deadlock.c4
-rw-r--r--src/backend/storage/lmgr/lock.c20
-rw-r--r--src/backend/storage/lmgr/proc.c10
-rw-r--r--src/backend/storage/smgr/md.c85
-rw-r--r--src/backend/storage/smgr/smgr.c41
-rw-r--r--src/backend/tcop/postgres.c6
-rw-r--r--src/backend/tcop/pquery.c12
-rw-r--r--src/backend/tcop/utility.c15
-rw-r--r--src/backend/tsearch/regis.c14
-rw-r--r--src/backend/tsearch/spell.c43
-rw-r--r--src/backend/tsearch/to_tsany.c44
-rw-r--r--src/backend/tsearch/ts_locale.c14
-rw-r--r--src/backend/tsearch/ts_parse.c22
-rw-r--r--src/backend/tsearch/ts_selfuncs.c77
-rw-r--r--src/backend/tsearch/ts_typanalyze.c128
-rw-r--r--src/backend/tsearch/wparser.c6
-rw-r--r--src/backend/utils/adt/acl.c134
-rw-r--r--src/backend/utils/adt/array_userfuncs.c19
-rw-r--r--src/backend/utils/adt/arrayfuncs.c152
-rw-r--r--src/backend/utils/adt/bool.c4
-rw-r--r--src/backend/utils/adt/cash.c17
-rw-r--r--src/backend/utils/adt/date.c6
-rw-r--r--src/backend/utils/adt/datetime.c238
-rw-r--r--src/backend/utils/adt/dbsize.c4
-rw-r--r--src/backend/utils/adt/float.c6
-rw-r--r--src/backend/utils/adt/formatting.c255
-rw-r--r--src/backend/utils/adt/int8.c14
-rw-r--r--src/backend/utils/adt/like_match.c26
-rw-r--r--src/backend/utils/adt/misc.c8
-rw-r--r--src/backend/utils/adt/nabstime.c4
-rw-r--r--src/backend/utils/adt/network.c68
-rw-r--r--src/backend/utils/adt/numeric.c92
-rw-r--r--src/backend/utils/adt/oracle_compat.c20
-rw-r--r--src/backend/utils/adt/pg_locale.c55
-rw-r--r--src/backend/utils/adt/pg_lzcompress.c64
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c68
-rw-r--r--src/backend/utils/adt/quote.c6
-rw-r--r--src/backend/utils/adt/regexp.c12
-rw-r--r--src/backend/utils/adt/ri_triggers.c22
-rw-r--r--src/backend/utils/adt/rowtypes.c36
-rw-r--r--src/backend/utils/adt/ruleutils.c110
-rw-r--r--src/backend/utils/adt/selfuncs.c186
-rw-r--r--src/backend/utils/adt/timestamp.c71
-rw-r--r--src/backend/utils/adt/trigfuncs.c63
-rw-r--r--src/backend/utils/adt/tsginidx.c79
-rw-r--r--src/backend/utils/adt/tsgistidx.c17
-rw-r--r--src/backend/utils/adt/tsquery.c6
-rw-r--r--src/backend/utils/adt/tsquery_gist.c5
-rw-r--r--src/backend/utils/adt/tsquery_op.c4
-rw-r--r--src/backend/utils/adt/tsquery_util.c4
-rw-r--r--src/backend/utils/adt/tsrank.c40
-rw-r--r--src/backend/utils/adt/tsvector.c14
-rw-r--r--src/backend/utils/adt/tsvector_op.c141
-rw-r--r--src/backend/utils/adt/uuid.c4
-rw-r--r--src/backend/utils/adt/varchar.c4
-rw-r--r--src/backend/utils/adt/varlena.c67
-rw-r--r--src/backend/utils/adt/windowfuncs.c99
-rw-r--r--src/backend/utils/adt/xml.c322
-rw-r--r--src/backend/utils/cache/catcache.c12
-rw-r--r--src/backend/utils/cache/inval.c20
-rw-r--r--src/backend/utils/cache/lsyscache.c4
-rw-r--r--src/backend/utils/cache/plancache.c20
-rw-r--r--src/backend/utils/cache/relcache.c19
-rw-r--r--src/backend/utils/cache/syscache.c14
-rw-r--r--src/backend/utils/error/elog.c20
-rw-r--r--src/backend/utils/fmgr/dfmgr.c22
-rw-r--r--src/backend/utils/fmgr/fmgr.c73
-rw-r--r--src/backend/utils/fmgr/funcapi.c6
-rw-r--r--src/backend/utils/init/miscinit.c8
-rw-r--r--src/backend/utils/init/postinit.c30
-rw-r--r--src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c6
-rw-r--r--src/backend/utils/mb/mbutils.c65
-rw-r--r--src/backend/utils/mb/wchar.c12
-rw-r--r--src/backend/utils/mb/wstrcmp.c2
-rw-r--r--src/backend/utils/mb/wstrncmp.c2
-rw-r--r--src/backend/utils/misc/guc.c475
-rw-r--r--src/backend/utils/misc/help_config.c4
-rw-r--r--src/backend/utils/mmgr/aset.c5
-rw-r--r--src/backend/utils/resowner/resowner.c8
-rw-r--r--src/backend/utils/sort/tuplesort.c22
-rw-r--r--src/backend/utils/sort/tuplestore.c59
-rw-r--r--src/backend/utils/time/snapmgr.c66
-rw-r--r--src/backend/utils/time/tqual.c36
-rw-r--r--src/bin/initdb/initdb.c70
-rw-r--r--src/bin/pg_controldata/pg_controldata.c6
-rw-r--r--src/bin/pg_ctl/pg_ctl.c61
-rw-r--r--src/bin/pg_dump/common.c4
-rw-r--r--src/bin/pg_dump/dumputils.c28
-rw-r--r--src/bin/pg_dump/keywords.c4
-rw-r--r--src/bin/pg_dump/pg_backup.h4
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.c232
-rw-r--r--src/bin/pg_dump/pg_backup_archiver.h13
-rw-r--r--src/bin/pg_dump/pg_backup_custom.c26
-rw-r--r--src/bin/pg_dump/pg_backup_db.c6
-rw-r--r--src/bin/pg_dump/pg_dump.c364
-rw-r--r--src/bin/pg_dump/pg_dump.h6
-rw-r--r--src/bin/pg_dump/pg_dump_sort.c8
-rw-r--r--src/bin/pg_dump/pg_dumpall.c57
-rw-r--r--src/bin/pg_dump/pg_restore.c17
-rw-r--r--src/bin/pg_resetxlog/pg_resetxlog.c8
-rw-r--r--src/bin/pgevent/pgevent.c4
-rw-r--r--src/bin/psql/command.c41
-rw-r--r--src/bin/psql/describe.c429
-rw-r--r--src/bin/psql/help.c10
-rw-r--r--src/bin/psql/mainloop.c9
-rw-r--r--src/bin/psql/mbprint.c16
-rw-r--r--src/bin/psql/mbprint.h4
-rw-r--r--src/bin/psql/print.c129
-rw-r--r--src/bin/psql/print.h49
-rw-r--r--src/bin/psql/tab-complete.c20
-rw-r--r--src/bin/scripts/common.c4
-rw-r--r--src/bin/scripts/reindexdb.c4
-rw-r--r--src/include/access/clog.h6
-rw-r--r--src/include/access/genam.h14
-rw-r--r--src/include/access/gin.h123
-rw-r--r--src/include/access/gist_private.h18
-rw-r--r--src/include/access/hash.h4
-rw-r--r--src/include/access/heapam.h4
-rw-r--r--src/include/access/hio.h6
-rw-r--r--src/include/access/htup.h13
-rw-r--r--src/include/access/nbtree.h8
-rw-r--r--src/include/access/reloptions.h91
-rw-r--r--src/include/access/visibilitymap.h8
-rw-r--r--src/include/access/xact.h6
-rw-r--r--src/include/access/xlogutils.h6
-rw-r--r--src/include/c.h10
-rw-r--r--src/include/catalog/catalog.h6
-rw-r--r--src/include/catalog/catversion.h4
-rw-r--r--src/include/catalog/dependency.h6
-rw-r--r--src/include/catalog/genbki.h4
-rw-r--r--src/include/catalog/heap.h6
-rw-r--r--src/include/catalog/indexing.h4
-rw-r--r--src/include/catalog/namespace.h6
-rw-r--r--src/include/catalog/pg_amop.h264
-rw-r--r--src/include/catalog/pg_attribute.h8
-rw-r--r--src/include/catalog/pg_cast.h4
-rw-r--r--src/include/catalog/pg_class.h4
-rw-r--r--src/include/catalog/pg_conversion_fn.h4
-rw-r--r--src/include/catalog/pg_foreign_server.h4
-rw-r--r--src/include/catalog/pg_operator.h4
-rw-r--r--src/include/catalog/pg_proc.h746
-rw-r--r--src/include/catalog/pg_proc_fn.h4
-rw-r--r--src/include/catalog/pg_shdepend.h8
-rw-r--r--src/include/catalog/pg_statistic.h4
-rw-r--r--src/include/catalog/pg_type.h8
-rw-r--r--src/include/catalog/pg_type_fn.h12
-rw-r--r--src/include/catalog/pg_user_mapping.h7
-rw-r--r--src/include/commands/comment.h2
-rw-r--r--src/include/commands/explain.h10
-rw-r--r--src/include/commands/proclang.h2
-rw-r--r--src/include/commands/tablecmds.h12
-rw-r--r--src/include/commands/trigger.h14
-rw-r--r--src/include/commands/vacuum.h8
-rw-r--r--src/include/executor/executor.h10
-rw-r--r--src/include/executor/hashjoin.h8
-rw-r--r--src/include/executor/spi.h18
-rw-r--r--src/include/executor/tstoreReceiver.h8
-rw-r--r--src/include/executor/tuptable.h6
-rw-r--r--src/include/foreign/foreign.h43
-rw-r--r--src/include/funcapi.h4
-rw-r--r--src/include/libpq/hba.h10
-rw-r--r--src/include/libpq/libpq-be.h8
-rw-r--r--src/include/mb/pg_wchar.h14
-rw-r--r--src/include/miscadmin.h12
-rw-r--r--src/include/nodes/execnodes.h90
-rw-r--r--src/include/nodes/makefuncs.h4
-rw-r--r--src/include/nodes/nodeFuncs.h4
-rw-r--r--src/include/nodes/nodes.h20
-rw-r--r--src/include/nodes/parsenodes.h77
-rw-r--r--src/include/nodes/pg_list.h3
-rw-r--r--src/include/nodes/plannodes.h4
-rw-r--r--src/include/nodes/primnodes.h10
-rw-r--r--src/include/nodes/relation.h44
-rw-r--r--src/include/nodes/tidbitmap.h6
-rw-r--r--src/include/optimizer/clauses.h6
-rw-r--r--src/include/optimizer/cost.h14
-rw-r--r--src/include/optimizer/paths.h6
-rw-r--r--src/include/optimizer/placeholder.h8
-rw-r--r--src/include/optimizer/plancat.h4
-rw-r--r--src/include/optimizer/planmain.h10
-rw-r--r--src/include/optimizer/subselect.h14
-rw-r--r--src/include/parser/gramparse.h4
-rw-r--r--src/include/parser/parse_agg.h4
-rw-r--r--src/include/parser/parse_clause.h8
-rw-r--r--src/include/parser/parse_coerce.h12
-rw-r--r--src/include/parser/parse_node.h6
-rw-r--r--src/include/parser/parse_relation.h12
-rw-r--r--src/include/pg_config_manual.h4
-rw-r--r--src/include/pgstat.h26
-rw-r--r--src/include/port.h7
-rw-r--r--src/include/port/aix.h2
-rw-r--r--src/include/port/bsdi.h3
-rw-r--r--src/include/port/sco.h2
-rw-r--r--src/include/port/sunos4.h2
-rw-r--r--src/include/port/ultrix4.h2
-rw-r--r--src/include/port/univel.h2
-rw-r--r--src/include/port/unixware.h2
-rw-r--r--src/include/port/win32.h13
-rw-r--r--src/include/port/win32/pwd.h3
-rw-r--r--src/include/port/win32/sys/wait.h3
-rw-r--r--src/include/portability/instr_time.h10
-rw-r--r--src/include/postmaster/bgwriter.h4
-rw-r--r--src/include/regex/regex.h6
-rw-r--r--src/include/rewrite/rewriteManip.h4
-rw-r--r--src/include/storage/buf_internals.h4
-rw-r--r--src/include/storage/bufmgr.h23
-rw-r--r--src/include/storage/freespace.h6
-rw-r--r--src/include/storage/fsm_internals.h20
-rw-r--r--src/include/storage/ipc.h6
-rw-r--r--src/include/storage/lmgr.h6
-rw-r--r--src/include/storage/pmsignal.h5
-rw-r--r--src/include/storage/procarray.h4
-rw-r--r--src/include/storage/relfilenode.h3
-rw-r--r--src/include/storage/shmem.h6
-rw-r--r--src/include/storage/sinval.h4
-rw-r--r--src/include/storage/sinvaladt.h6
-rw-r--r--src/include/storage/smgr.h28
-rw-r--r--src/include/tcop/dest.h4
-rw-r--r--src/include/tcop/tcopprot.h4
-rw-r--r--src/include/tsearch/ts_locale.h4
-rw-r--r--src/include/tsearch/ts_public.h4
-rw-r--r--src/include/tsearch/ts_utils.h6
-rw-r--r--src/include/utils/acl.h14
-rw-r--r--src/include/utils/cash.h2
-rw-r--r--src/include/utils/date.h6
-rw-r--r--src/include/utils/datetime.h4
-rw-r--r--src/include/utils/elog.h14
-rw-r--r--src/include/utils/guc.h28
-rw-r--r--src/include/utils/guc_tables.h11
-rw-r--r--src/include/utils/lsyscache.h6
-rw-r--r--src/include/utils/rel.h30
-rw-r--r--src/include/utils/selfuncs.h14
-rw-r--r--src/include/utils/snapmgr.h4
-rw-r--r--src/include/utils/snapshot.h6
-rw-r--r--src/include/utils/timestamp.h9
-rw-r--r--src/include/utils/tuplesort.h6
-rw-r--r--src/include/utils/tuplestore.h6
-rw-r--r--src/include/utils/xml.h6
-rw-r--r--src/include/windowapi.h12
-rw-r--r--src/interfaces/ecpg/compatlib/informix.c4
-rw-r--r--src/interfaces/ecpg/ecpglib/connect.c52
-rw-r--r--src/interfaces/ecpg/ecpglib/descriptor.c4
-rw-r--r--src/interfaces/ecpg/ecpglib/error.c212
-rw-r--r--src/interfaces/ecpg/ecpglib/execute.c38
-rw-r--r--src/interfaces/ecpg/ecpglib/misc.c15
-rw-r--r--src/interfaces/ecpg/ecpglib/prepare.c9
-rw-r--r--src/interfaces/ecpg/include/datetime.h7
-rw-r--r--src/interfaces/ecpg/include/decimal.h9
-rw-r--r--src/interfaces/ecpg/include/ecpglib.h18
-rw-r--r--src/interfaces/ecpg/include/sqlda.h3
-rw-r--r--src/interfaces/ecpg/include/sqltypes.h2
-rw-r--r--src/interfaces/ecpg/pgtypeslib/datetime.c4
-rw-r--r--src/interfaces/ecpg/pgtypeslib/dt.h14
-rw-r--r--src/interfaces/ecpg/pgtypeslib/dt_common.c22
-rw-r--r--src/interfaces/ecpg/pgtypeslib/interval.c240
-rw-r--r--src/interfaces/ecpg/pgtypeslib/timestamp.c2
-rw-r--r--src/interfaces/ecpg/preproc/c_keywords.c9
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c15
-rw-r--r--src/interfaces/ecpg/preproc/ecpg_keywords.c11
-rw-r--r--src/interfaces/ecpg/preproc/extern.h5
-rw-r--r--src/interfaces/ecpg/preproc/output.c20
-rw-r--r--src/interfaces/ecpg/preproc/type.c14
-rw-r--r--src/interfaces/ecpg/preproc/type.h2
-rw-r--r--src/interfaces/ecpg/preproc/variable.c6
-rw-r--r--src/interfaces/libpq/fe-auth.c22
-rw-r--r--src/interfaces/libpq/fe-connect.c43
-rw-r--r--src/interfaces/libpq/fe-exec.c49
-rw-r--r--src/interfaces/libpq/fe-lobj.c4
-rw-r--r--src/interfaces/libpq/fe-misc.c16
-rw-r--r--src/interfaces/libpq/fe-protocol3.c14
-rw-r--r--src/interfaces/libpq/fe-secure.c115
-rw-r--r--src/interfaces/libpq/libpq-events.c18
-rw-r--r--src/interfaces/libpq/libpq-events.h24
-rw-r--r--src/interfaces/libpq/libpq-fe.h14
-rw-r--r--src/interfaces/libpq/libpq-int.h14
-rw-r--r--src/interfaces/libpq/pqexpbuffer.c15
-rw-r--r--src/interfaces/libpq/pqexpbuffer.h8
-rw-r--r--src/interfaces/libpq/pthread-win32.c4
-rw-r--r--src/interfaces/libpq/win32.c2
-rw-r--r--src/interfaces/libpq/win32.h2
-rw-r--r--src/pl/plperl/plperl.c37
-rw-r--r--src/pl/plperl/spi_internal.c2
-rw-r--r--src/pl/plpgsql/src/pl_comp.c26
-rw-r--r--src/pl/plpgsql/src/pl_exec.c142
-rw-r--r--src/pl/plpgsql/src/pl_funcs.c10
-rw-r--r--src/pl/plpgsql/src/plpgsql.h14
-rw-r--r--src/pl/plpython/plpython.c184
-rw-r--r--src/pl/tcl/pltcl.c28
-rw-r--r--src/port/crypt.c4
-rw-r--r--src/port/dirmod.c26
-rw-r--r--src/port/exec.c14
-rw-r--r--src/port/getopt.c4
-rw-r--r--src/port/getopt_long.c3
-rw-r--r--src/port/getrusage.c4
-rw-r--r--src/port/open.c29
-rw-r--r--src/port/path.c4
-rw-r--r--src/port/pipe.c10
-rw-r--r--src/port/pthread-win32.h2
-rw-r--r--src/port/rand.c2
-rw-r--r--src/port/strlcat.c2
-rw-r--r--src/port/strtol.c2
-rw-r--r--src/port/strtoul.c2
-rw-r--r--src/port/win32env.c43
-rw-r--r--src/test/examples/testlibpq.c2
-rw-r--r--src/test/examples/testlibpq2.c4
-rw-r--r--src/test/examples/testlibpq3.c2
-rw-r--r--src/test/examples/testlibpq4.c2
-rw-r--r--src/test/locale/test-ctype.c2
-rw-r--r--src/test/regress/pg_regress.c83
-rw-r--r--src/test/regress/pg_regress_main.c10
-rw-r--r--src/timezone/localtime.c139
-rw-r--r--src/timezone/pgtz.c31
-rw-r--r--src/timezone/pgtz.h6
-rw-r--r--src/timezone/private.h20
-rw-r--r--src/timezone/strftime.c26
-rw-r--r--src/timezone/tzfile.h10
-rw-r--r--src/timezone/zic.c311
-rw-r--r--src/tools/fsync/test_fsync.c2
-rw-r--r--src/tutorial/complex.c2
531 files changed, 10139 insertions, 9694 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index 6499549177..ac5749c713 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -50,7 +50,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.126 2009/03/30 04:08:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.127 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -388,7 +388,7 @@ nocachegetattr(HeapTuple tuple,
* Now check to see if any preceding bits are null...
*/
{
- int byte = attnum >> 3;
+ int byte = attnum >> 3;
int finalbit = attnum & 0x07;
/* check for nulls "before" final bit of last byte */
@@ -1183,7 +1183,7 @@ slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)
{
if (tuple == NULL) /* internal error */
elog(ERROR, "cannot extract system attribute from virtual tuple");
- if (tuple == &(slot->tts_minhdr)) /* internal error */
+ if (tuple == &(slot->tts_minhdr)) /* internal error */
elog(ERROR, "cannot extract system attribute from minimal tuple");
return heap_getsysattr(tuple, attnum, tupleDesc, isnull);
}
@@ -1369,7 +1369,7 @@ slot_attisnull(TupleTableSlot *slot, int attnum)
{
if (tuple == NULL) /* internal error */
elog(ERROR, "cannot extract system attribute from virtual tuple");
- if (tuple == &(slot->tts_minhdr)) /* internal error */
+ if (tuple == &(slot->tts_minhdr)) /* internal error */
elog(ERROR, "cannot extract system attribute from minimal tuple");
return heap_attisnull(tuple, attnum);
}
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index 839d242913..cd3b88654b 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.87 2009/01/01 17:23:34 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.88 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -86,7 +86,7 @@ index_form_tuple(TupleDesc tupleDescriptor,
* try to compress it in-line.
*/
if (!VARATT_IS_EXTENDED(DatumGetPointer(untoasted_values[i])) &&
- VARSIZE(DatumGetPointer(untoasted_values[i])) > TOAST_INDEX_TARGET &&
+ VARSIZE(DatumGetPointer(untoasted_values[i])) > TOAST_INDEX_TARGET &&
(att->attstorage == 'x' || att->attstorage == 'm'))
{
Datum cvalue = toast_compress_datum(untoasted_values[i]);
@@ -270,7 +270,7 @@ nocache_index_getattr(IndexTuple tup,
* Now check to see if any preceding bits are null...
*/
{
- int byte = attnum >> 3;
+ int byte = attnum >> 3;
int finalbit = attnum & 0x07;
/* check for nulls "before" final bit of last byte */
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index 324c978132..13a09dd9b3 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.104 2009/01/01 17:23:34 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.105 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,7 +71,7 @@ printtup_create_DR(CommandDest dest)
{
DR_printtup *self = (DR_printtup *) palloc0(sizeof(DR_printtup));
- self->pub.receiveSlot = printtup; /* might get changed later */
+ self->pub.receiveSlot = printtup; /* might get changed later */
self->pub.rStartup = printtup_startup;
self->pub.rShutdown = printtup_shutdown;
self->pub.rDestroy = printtup_destroy;
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 2668fd8bfe..b970601b1c 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.27 2009/05/24 22:22:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.28 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,7 +65,7 @@ static relopt_bool boolRelOpts[] =
true
},
/* list terminator */
- { { NULL } }
+ {{NULL}}
};
static relopt_int intRelOpts[] =
@@ -158,7 +158,7 @@ static relopt_int intRelOpts[] =
}, 150000000, 0, 2000000000
},
/* list terminator */
- { { NULL } }
+ {{NULL}}
};
static relopt_real realRelOpts[] =
@@ -180,21 +180,21 @@ static relopt_real realRelOpts[] =
0.1, 0.0, 100.0
},
/* list terminator */
- { { NULL } }
+ {{NULL}}
};
static relopt_string stringRelOpts[] =
{
/* list terminator */
- { { NULL } }
+ {{NULL}}
};
static relopt_gen **relOpts = NULL;
static bits32 last_assigned_kind = RELOPT_KIND_LAST_DEFAULT;
-static int num_custom_options = 0;
+static int num_custom_options = 0;
static relopt_gen **custom_options = NULL;
-static bool need_initialization = true;
+static bool need_initialization = true;
static void initialize_reloptions(void);
static void parse_one_reloption(relopt_value *option, char *text_str,
@@ -202,15 +202,15 @@ static void parse_one_reloption(relopt_value *option, char *text_str,
/*
* initialize_reloptions
- * initialization routine, must be called before parsing
+ * initialization routine, must be called before parsing
*
* Initialize the relOpts array and fill each variable's type and name length.
*/
static void
initialize_reloptions(void)
{
- int i;
- int j = 0;
+ int i;
+ int j = 0;
for (i = 0; boolRelOpts[i].gen.name; i++)
j++;
@@ -272,8 +272,8 @@ initialize_reloptions(void)
/*
* add_reloption_kind
- * Create a new relopt_kind value, to be used in custom reloptions by
- * user-defined AMs.
+ * Create a new relopt_kind value, to be used in custom reloptions by
+ * user-defined AMs.
*/
relopt_kind
add_reloption_kind(void)
@@ -282,24 +282,24 @@ add_reloption_kind(void)
if (last_assigned_kind >= RELOPT_KIND_MAX)
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("user-defined relation parameter types limit exceeded")));
+ errmsg("user-defined relation parameter types limit exceeded")));
last_assigned_kind <<= 1;
return (relopt_kind) last_assigned_kind;
}
/*
* add_reloption
- * Add an already-created custom reloption to the list, and recompute the
- * main parser table.
+ * Add an already-created custom reloption to the list, and recompute the
+ * main parser table.
*/
static void
add_reloption(relopt_gen *newoption)
{
- static int max_custom_options = 0;
+ static int max_custom_options = 0;
if (num_custom_options >= max_custom_options)
{
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
oldcxt = MemoryContextSwitchTo(TopMemoryContext);
@@ -312,7 +312,7 @@ add_reloption(relopt_gen *newoption)
{
max_custom_options *= 2;
custom_options = repalloc(custom_options,
- max_custom_options * sizeof(relopt_gen *));
+ max_custom_options * sizeof(relopt_gen *));
}
MemoryContextSwitchTo(oldcxt);
}
@@ -323,15 +323,15 @@ add_reloption(relopt_gen *newoption)
/*
* allocate_reloption
- * Allocate a new reloption and initialize the type-agnostic fields
- * (for types other than string)
+ * Allocate a new reloption and initialize the type-agnostic fields
+ * (for types other than string)
*/
static relopt_gen *
allocate_reloption(bits32 kinds, int type, char *name, char *desc)
{
- MemoryContext oldcxt;
- size_t size;
- relopt_gen *newoption;
+ MemoryContext oldcxt;
+ size_t size;
+ relopt_gen *newoption;
Assert(type != RELOPT_TYPE_STRING);
@@ -350,7 +350,7 @@ allocate_reloption(bits32 kinds, int type, char *name, char *desc)
break;
default:
elog(ERROR, "unsupported option type");
- return NULL; /* keep compiler quiet */
+ return NULL; /* keep compiler quiet */
}
newoption = palloc(size);
@@ -371,12 +371,12 @@ allocate_reloption(bits32 kinds, int type, char *name, char *desc)
/*
* add_bool_reloption
- * Add a new boolean reloption
+ * Add a new boolean reloption
*/
void
add_bool_reloption(bits32 kinds, char *name, char *desc, bool default_val)
{
- relopt_bool *newoption;
+ relopt_bool *newoption;
newoption = (relopt_bool *) allocate_reloption(kinds, RELOPT_TYPE_BOOL,
name, desc);
@@ -387,13 +387,13 @@ add_bool_reloption(bits32 kinds, char *name, char *desc, bool default_val)
/*
* add_int_reloption
- * Add a new integer reloption
+ * Add a new integer reloption
*/
void
add_int_reloption(bits32 kinds, char *name, char *desc, int default_val,
int min_val, int max_val)
{
- relopt_int *newoption;
+ relopt_int *newoption;
newoption = (relopt_int *) allocate_reloption(kinds, RELOPT_TYPE_INT,
name, desc);
@@ -406,13 +406,13 @@ add_int_reloption(bits32 kinds, char *name, char *desc, int default_val,
/*
* add_real_reloption
- * Add a new float reloption
+ * Add a new float reloption
*/
void
add_real_reloption(bits32 kinds, char *name, char *desc, double default_val,
- double min_val, double max_val)
+ double min_val, double max_val)
{
- relopt_real *newoption;
+ relopt_real *newoption;
newoption = (relopt_real *) allocate_reloption(kinds, RELOPT_TYPE_REAL,
name, desc);
@@ -428,7 +428,7 @@ add_real_reloption(bits32 kinds, char *name, char *desc, double default_val,
* Add a new string reloption
*
* "validator" is an optional function pointer that can be used to test the
- * validity of the values. It must elog(ERROR) when the argument string is
+ * validity of the values. It must elog(ERROR) when the argument string is
* not acceptable for the variable. Note that the default value must pass
* the validation.
*/
@@ -436,9 +436,9 @@ void
add_string_reloption(bits32 kinds, char *name, char *desc, char *default_val,
validate_string_relopt validator)
{
- MemoryContext oldcxt;
- relopt_string *newoption;
- int default_len = 0;
+ MemoryContext oldcxt;
+ relopt_string *newoption;
+ int default_len = 0;
oldcxt = MemoryContextSwitchTo(TopMemoryContext);
@@ -495,7 +495,7 @@ add_string_reloption(bits32 kinds, char *name, char *desc, char *default_val,
* Note that this is not responsible for determining whether the options
* are valid, but it does check that namespaces for all the options given are
* listed in validnsps. The NULL namespace is always valid and needs not be
- * explicitely listed. Passing a NULL pointer means that only the NULL
+ * explicitely listed. Passing a NULL pointer means that only the NULL
* namespace is valid.
*
* Both oldOptions and the result are text arrays (or NULL for "default"),
@@ -538,7 +538,7 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace,
/* Search for a match in defList */
foreach(cell, defList)
{
- DefElem *def = (DefElem *) lfirst(cell);
+ DefElem *def = (DefElem *) lfirst(cell);
int kw_len;
/* ignore if not in the same namespace */
@@ -574,7 +574,7 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace,
*/
foreach(cell, defList)
{
- DefElem *def = (DefElem *) lfirst(cell);
+ DefElem *def = (DefElem *) lfirst(cell);
if (isReset)
{
@@ -590,13 +590,13 @@ transformRelOptions(Datum oldOptions, List *defList, char *namspace,
Size len;
/*
- * Error out if the namespace is not valid. A NULL namespace
- * is always valid.
+ * Error out if the namespace is not valid. A NULL namespace is
+ * always valid.
*/
if (def->defnamespace != NULL)
{
- bool valid = false;
- int i;
+ bool valid = false;
+ int i;
if (validnsps)
{
@@ -719,10 +719,10 @@ untransformRelOptions(Datum options)
bytea *
extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, Oid amoptions)
{
- bytea *options;
- bool isnull;
- Datum datum;
- Form_pg_class classForm;
+ bytea *options;
+ bool isnull;
+ Datum datum;
+ Form_pg_class classForm;
datum = fastgetattr(tuple,
Anum_pg_class_reloptions,
@@ -768,7 +768,7 @@ extractRelOptions(HeapTuple tuple, TupleDesc tupdesc, Oid amoptions)
* is returned.
*
* Note: values of type int, bool and real are allocated as part of the
- * returned array. Values of type string are allocated separately and must
+ * returned array. Values of type string are allocated separately and must
* be freed by the caller.
*/
relopt_value *
@@ -894,31 +894,31 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len,
parsed = parse_bool(value, &option->values.bool_val);
if (validate && !parsed)
ereport(ERROR,
- (errmsg("invalid value for boolean option \"%s\": %s",
- option->gen->name, value)));
+ (errmsg("invalid value for boolean option \"%s\": %s",
+ option->gen->name, value)));
}
break;
case RELOPT_TYPE_INT:
{
- relopt_int *optint = (relopt_int *) option->gen;
+ relopt_int *optint = (relopt_int *) option->gen;
parsed = parse_int(value, &option->values.int_val, 0, NULL);
if (validate && !parsed)
ereport(ERROR,
- (errmsg("invalid value for integer option \"%s\": %s",
- option->gen->name, value)));
+ (errmsg("invalid value for integer option \"%s\": %s",
+ option->gen->name, value)));
if (validate && (option->values.int_val < optint->min ||
option->values.int_val > optint->max))
ereport(ERROR,
- (errmsg("value %s out of bounds for option \"%s\"",
- value, option->gen->name),
- errdetail("Valid values are between \"%d\" and \"%d\".",
- optint->min, optint->max)));
+ (errmsg("value %s out of bounds for option \"%s\"",
+ value, option->gen->name),
+ errdetail("Valid values are between \"%d\" and \"%d\".",
+ optint->min, optint->max)));
}
break;
case RELOPT_TYPE_REAL:
{
- relopt_real *optreal = (relopt_real *) option->gen;
+ relopt_real *optreal = (relopt_real *) option->gen;
parsed = parse_real(value, &option->values.real_val);
if (validate && !parsed)
@@ -928,15 +928,15 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len,
if (validate && (option->values.real_val < optreal->min ||
option->values.real_val > optreal->max))
ereport(ERROR,
- (errmsg("value %s out of bounds for option \"%s\"",
- value, option->gen->name),
- errdetail("Valid values are between \"%f\" and \"%f\".",
- optreal->min, optreal->max)));
+ (errmsg("value %s out of bounds for option \"%s\"",
+ value, option->gen->name),
+ errdetail("Valid values are between \"%f\" and \"%f\".",
+ optreal->min, optreal->max)));
}
break;
case RELOPT_TYPE_STRING:
{
- relopt_string *optstring = (relopt_string *) option->gen;
+ relopt_string *optstring = (relopt_string *) option->gen;
option->values.string_val = value;
nofree = true;
@@ -947,7 +947,7 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len,
break;
default:
elog(ERROR, "unsupported reloption type %d", option->gen->type);
- parsed = true; /* quiet compiler */
+ parsed = true; /* quiet compiler */
break;
}
@@ -967,8 +967,8 @@ parse_one_reloption(relopt_value *option, char *text_str, int text_len,
void *
allocateReloptStruct(Size base, relopt_value *options, int numoptions)
{
- Size size = base;
- int i;
+ Size size = base;
+ int i;
for (i = 0; i < numoptions; i++)
if (options[i].gen->type == RELOPT_TYPE_STRING)
@@ -994,21 +994,21 @@ fillRelOptions(void *rdopts, Size basesize,
bool validate,
const relopt_parse_elt *elems, int numelems)
{
- int i;
- int offset = basesize;
+ int i;
+ int offset = basesize;
for (i = 0; i < numoptions; i++)
{
- int j;
- bool found = false;
+ int j;
+ bool found = false;
for (j = 0; j < numelems; j++)
{
if (pg_strcasecmp(options[i].gen->name, elems[j].optname) == 0)
{
relopt_string *optstring;
- char *itempos = ((char *) rdopts) + elems[j].offset;
- char *string_val;
+ char *itempos = ((char *) rdopts) + elems[j].offset;
+ char *string_val;
switch (options[i].gen->type)
{
@@ -1069,31 +1069,31 @@ fillRelOptions(void *rdopts, Size basesize,
bytea *
default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
{
- relopt_value *options;
- StdRdOptions *rdopts;
- int numoptions;
+ relopt_value *options;
+ StdRdOptions *rdopts;
+ int numoptions;
static const relopt_parse_elt tab[] = {
{"fillfactor", RELOPT_TYPE_INT, offsetof(StdRdOptions, fillfactor)},
{"autovacuum_enabled", RELOPT_TYPE_BOOL,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, enabled)},
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, enabled)},
{"autovacuum_vacuum_threshold", RELOPT_TYPE_INT,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_threshold)},
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_threshold)},
{"autovacuum_analyze_threshold", RELOPT_TYPE_INT,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_threshold)},
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_threshold)},
{"autovacuum_vacuum_cost_delay", RELOPT_TYPE_INT,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_delay)},
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_cost_delay)},
{"autovacuum_vacuum_cost_limit", RELOPT_TYPE_INT,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_cost_limit)},
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_cost_limit)},
{"autovacuum_freeze_min_age", RELOPT_TYPE_INT,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_min_age)},
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_min_age)},
{"autovacuum_freeze_max_age", RELOPT_TYPE_INT,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_max_age)},
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_max_age)},
{"autovacuum_freeze_table_age", RELOPT_TYPE_INT,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, freeze_table_age)},
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, freeze_table_age)},
{"autovacuum_vacuum_scale_factor", RELOPT_TYPE_REAL,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, vacuum_scale_factor)},
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, vacuum_scale_factor)},
{"autovacuum_analyze_scale_factor", RELOPT_TYPE_REAL,
- offsetof(StdRdOptions, autovacuum) + offsetof(AutoVacOpts, analyze_scale_factor)}
+ offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_scale_factor)}
};
options = parseRelOptions(reloptions, validate, kind, &numoptions);
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index ea16913c8e..79efec0969 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.125 2009/01/22 20:16:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/tupdesc.c,v 1.126 2009/06/11 14:48:53 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -55,8 +55,8 @@ CreateTemplateTupleDesc(int natts, bool hasoid)
* pointers.
*
* Note: Only the fixed part of pg_attribute rows is included in tuple
- * descriptors, so we only need ATTRIBUTE_FIXED_PART_SIZE space
- * per attr. That might need alignment padding, however.
+ * descriptors, so we only need ATTRIBUTE_FIXED_PART_SIZE space per attr.
+ * That might need alignment padding, however.
*/
attroffset = sizeof(struct tupleDesc) + natts * sizeof(Form_pg_attribute);
attroffset = MAXALIGN(attroffset);
diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c
index 717caaad8b..feff95f1d8 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.15 2009/03/25 22:19:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.16 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
#include "postgres.h"
@@ -95,6 +95,7 @@ ginarrayconsistent(PG_FUNCTION_ARGS)
bool *check = (bool *) PG_GETARG_POINTER(0);
StrategyNumber strategy = PG_GETARG_UINT16(1);
ArrayType *query = PG_GETARG_ARRAYTYPE_P(2);
+
/* int32 nkeys = PG_GETARG_INT32(3); */
/* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
bool *recheck = (bool *) PG_GETARG_POINTER(5);
diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginbulk.c
index a7258619ae..2e800ce44a 100644
--- a/src/backend/access/gin/ginbulk.c
+++ b/src/backend/access/gin/ginbulk.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.15 2009/03/24 20:17:10 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.16 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -84,7 +84,7 @@ ginInsertData(BuildAccumulator *accum, EntryAccumulator *entry, ItemPointer heap
static Datum
getDatumCopy(BuildAccumulator *accum, OffsetNumber attnum, Datum value)
{
- Form_pg_attribute att = accum->ginstate->origTupdesc->attrs[ attnum - 1 ];
+ Form_pg_attribute att = accum->ginstate->origTupdesc->attrs[attnum - 1];
Datum res;
if (att->attbyval)
@@ -161,8 +161,8 @@ ginInsertEntry(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum
* then calls itself for each parts
*/
static void
-ginChooseElem(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum,
- Datum *entries, uint32 nentry,
+ginChooseElem(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum,
+ Datum *entries, uint32 nentry,
uint32 low, uint32 high, uint32 offset)
{
uint32 pos;
@@ -187,8 +187,8 @@ ginChooseElem(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum,
* next middle on left part and middle of right part.
*/
void
-ginInsertRecordBA(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum,
- Datum *entries, int32 nentry)
+ginInsertRecordBA(BuildAccumulator *accum, ItemPointer heapptr, OffsetNumber attnum,
+ Datum *entries, int32 nentry)
{
uint32 i,
nbit = 0,
diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c
index 22199102dd..ebbdaa33e5 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.15 2009/06/06 02:39:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/gindatapage.c,v 1.16 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -47,7 +47,7 @@ MergeItemPointers(ItemPointerData *dst,
while (aptr - a < na && bptr - b < nb)
{
- int cmp = compareItemPointers(aptr, bptr);
+ int cmp = compareItemPointers(aptr, bptr);
if (cmp > 0)
*dptr++ = *bptr++;
diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c
index f35994db95..c4659cde1f 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.20 2009/06/06 02:39:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.21 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -46,23 +46,23 @@
* Attributes of an index tuple are different for single and multicolumn index.
* For single-column case, index tuple stores only value to be indexed.
* For multicolumn case, it stores two attributes: column number of value
- * and value.
+ * and value.
*/
IndexTuple
GinFormTuple(GinState *ginstate, OffsetNumber attnum, Datum key, ItemPointerData *ipd, uint32 nipd)
{
- bool isnull[2] = {FALSE,FALSE};
+ bool isnull[2] = {FALSE, FALSE};
IndexTuple itup;
- if ( ginstate->oneCol )
+ if (ginstate->oneCol)
itup = index_form_tuple(ginstate->origTupdesc, &key, isnull);
else
{
- Datum datums[2];
+ Datum datums[2];
datums[0] = UInt16GetDatum(attnum);
datums[1] = key;
- itup = index_form_tuple(ginstate->tupdesc[attnum-1], datums, isnull);
+ itup = index_form_tuple(ginstate->tupdesc[attnum - 1], datums, isnull);
}
GinSetOrigSizePosting(itup, IndexTupleSize(itup));
@@ -136,12 +136,12 @@ entryIsMoveRight(GinBtree btree, Page page)
if (GinPageRightMost(page))
return FALSE;
- itup = getRightMostTuple(page);
+ itup = getRightMostTuple(page);
if (compareAttEntries(btree->ginstate,
- btree->entryAttnum, btree->entryValue,
- gintuple_get_attrnum(btree->ginstate, itup),
- gin_index_getattr(btree->ginstate, itup)) > 0)
+ btree->entryAttnum, btree->entryValue,
+ gintuple_get_attrnum(btree->ginstate, itup),
+ gin_index_getattr(btree->ginstate, itup)) > 0)
return TRUE;
return FALSE;
@@ -187,10 +187,10 @@ entryLocateEntry(GinBtree btree, GinBtreeStack *stack)
else
{
itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, mid));
- result = compareAttEntries(btree->ginstate,
- btree->entryAttnum, btree->entryValue,
- gintuple_get_attrnum(btree->ginstate, itup),
- gin_index_getattr(btree->ginstate, itup));
+ result = compareAttEntries(btree->ginstate,
+ btree->entryAttnum, btree->entryValue,
+ gintuple_get_attrnum(btree->ginstate, itup),
+ gin_index_getattr(btree->ginstate, itup));
}
if (result == 0)
@@ -252,10 +252,10 @@ entryLocateLeafEntry(GinBtree btree, GinBtreeStack *stack)
int result;
itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, mid));
- result = compareAttEntries(btree->ginstate,
- btree->entryAttnum, btree->entryValue,
- gintuple_get_attrnum(btree->ginstate, itup),
- gin_index_getattr(btree->ginstate, itup));
+ result = compareAttEntries(btree->ginstate,
+ btree->entryAttnum, btree->entryValue,
+ gintuple_get_attrnum(btree->ginstate, itup),
+ gin_index_getattr(btree->ginstate, itup));
if (result == 0)
{
stack->off = mid;
diff --git a/src/backend/access/gin/ginfast.c b/src/backend/access/gin/ginfast.c
index f474ad6598..20887ba56c 100644
--- a/src/backend/access/gin/ginfast.c
+++ b/src/backend/access/gin/ginfast.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/ginfast.c,v 1.2 2009/03/24 22:06:03 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginfast.c,v 1.3 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,9 +33,9 @@
typedef struct DatumArray
{
- Datum *values; /* expansible array */
- int32 nvalues; /* current number of valid entries */
- int32 maxvalues; /* allocated size of array */
+ Datum *values; /* expansible array */
+ int32 nvalues; /* current number of valid entries */
+ int32 maxvalues; /* allocated size of array */
} DatumArray;
@@ -46,11 +46,14 @@ static int32
writeListPage(Relation index, Buffer buffer,
IndexTuple *tuples, int32 ntuples, BlockNumber rightlink)
{
- Page page = BufferGetPage(buffer);
- int i, freesize, size=0;
- OffsetNumber l, off;
- char *workspace;
- char *ptr;
+ Page page = BufferGetPage(buffer);
+ int i,
+ freesize,
+ size = 0;
+ OffsetNumber l,
+ off;
+ char *workspace;
+ char *ptr;
/* workspace could be a local array; we use palloc for alignment */
workspace = palloc(BLCKSZ);
@@ -62,15 +65,15 @@ writeListPage(Relation index, Buffer buffer,
off = FirstOffsetNumber;
ptr = workspace;
- for(i=0; i<ntuples; i++)
+ for (i = 0; i < ntuples; i++)
{
- int this_size = IndexTupleSize(tuples[i]);
+ int this_size = IndexTupleSize(tuples[i]);
memcpy(ptr, tuples[i], this_size);
ptr += this_size;
size += this_size;
- l = PageAddItem(page, (Item)tuples[i], this_size, off, false, false);
+ l = PageAddItem(page, (Item) tuples[i], this_size, off, false, false);
if (l == InvalidOffsetNumber)
elog(ERROR, "failed to add item to index page in \"%s\"",
@@ -84,10 +87,10 @@ writeListPage(Relation index, Buffer buffer,
GinPageGetOpaque(page)->rightlink = rightlink;
/*
- * tail page may contain only the whole row(s) or final
- * part of row placed on previous pages
+ * tail page may contain only the whole row(s) or final part of row placed
+ * on previous pages
*/
- if ( rightlink == InvalidBlockNumber )
+ if (rightlink == InvalidBlockNumber)
{
GinPageSetFullRow(page);
GinPageGetOpaque(page)->maxoff = 1;
@@ -103,15 +106,15 @@ writeListPage(Relation index, Buffer buffer,
if (!index->rd_istemp)
{
- XLogRecData rdata[2];
- ginxlogInsertListPage data;
- XLogRecPtr recptr;
+ XLogRecData rdata[2];
+ ginxlogInsertListPage data;
+ XLogRecPtr recptr;
rdata[0].buffer = buffer;
rdata[0].buffer_std = true;
- rdata[0].data = (char*)&data;
+ rdata[0].data = (char *) &data;
rdata[0].len = sizeof(ginxlogInsertListPage);
- rdata[0].next = rdata+1;
+ rdata[0].next = rdata + 1;
rdata[1].buffer = InvalidBuffer;
rdata[1].data = workspace;
@@ -140,27 +143,29 @@ static void
makeSublist(Relation index, IndexTuple *tuples, int32 ntuples,
GinMetaPageData *res)
{
- Buffer curBuffer = InvalidBuffer;
- Buffer prevBuffer = InvalidBuffer;
- int i, size = 0, tupsize;
- int startTuple = 0;
+ Buffer curBuffer = InvalidBuffer;
+ Buffer prevBuffer = InvalidBuffer;
+ int i,
+ size = 0,
+ tupsize;
+ int startTuple = 0;
Assert(ntuples > 0);
/*
* Split tuples into pages
*/
- for(i=0;i<ntuples;i++)
+ for (i = 0; i < ntuples; i++)
{
- if ( curBuffer == InvalidBuffer )
+ if (curBuffer == InvalidBuffer)
{
curBuffer = GinNewBuffer(index);
- if ( prevBuffer != InvalidBuffer )
+ if (prevBuffer != InvalidBuffer)
{
res->nPendingPages++;
writeListPage(index, prevBuffer,
- tuples+startTuple, i-startTuple,
+ tuples + startTuple, i - startTuple,
BufferGetBlockNumber(curBuffer));
}
else
@@ -175,7 +180,7 @@ makeSublist(Relation index, IndexTuple *tuples, int32 ntuples,
tupsize = MAXALIGN(IndexTupleSize(tuples[i])) + sizeof(ItemIdData);
- if ( size + tupsize >= GinListPageSize )
+ if (size + tupsize >= GinListPageSize)
{
/* won't fit, force a new page and reprocess */
i--;
@@ -192,7 +197,7 @@ makeSublist(Relation index, IndexTuple *tuples, int32 ntuples,
*/
res->tail = BufferGetBlockNumber(curBuffer);
res->tailFreeSize = writeListPage(index, curBuffer,
- tuples+startTuple, ntuples-startTuple,
+ tuples + startTuple, ntuples - startTuple,
InvalidBlockNumber);
res->nPendingPages++;
/* that was only one heap tuple */
@@ -207,17 +212,17 @@ void
ginHeapTupleFastInsert(Relation index, GinState *ginstate,
GinTupleCollector *collector)
{
- Buffer metabuffer;
- Page metapage;
- GinMetaPageData *metadata = NULL;
- XLogRecData rdata[2];
- Buffer buffer = InvalidBuffer;
- Page page = NULL;
- ginxlogUpdateMeta data;
- bool separateList = false;
- bool needCleanup = false;
-
- if ( collector->ntuples == 0 )
+ Buffer metabuffer;
+ Page metapage;
+ GinMetaPageData *metadata = NULL;
+ XLogRecData rdata[2];
+ Buffer buffer = InvalidBuffer;
+ Page page = NULL;
+ ginxlogUpdateMeta data;
+ bool separateList = false;
+ bool needCleanup = false;
+
+ if (collector->ntuples == 0)
return;
data.node = index->rd_node;
@@ -232,7 +237,7 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate,
metabuffer = ReadBuffer(index, GIN_METAPAGE_BLKNO);
metapage = BufferGetPage(metabuffer);
- if ( collector->sumsize + collector->ntuples * sizeof(ItemIdData) > GIN_PAGE_FREESIZE )
+ if (collector->sumsize + collector->ntuples * sizeof(ItemIdData) > GIN_PAGE_FREESIZE)
{
/*
* Total size is greater than one page => make sublist
@@ -244,8 +249,8 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate,
LockBuffer(metabuffer, GIN_EXCLUSIVE);
metadata = GinPageGetMeta(metapage);
- if ( metadata->head == InvalidBlockNumber ||
- collector->sumsize + collector->ntuples * sizeof(ItemIdData) > metadata->tailFreeSize )
+ if (metadata->head == InvalidBlockNumber ||
+ collector->sumsize + collector->ntuples * sizeof(ItemIdData) > metadata->tailFreeSize)
{
/*
* Pending list is empty or total size is greater than freespace
@@ -258,14 +263,14 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate,
}
}
- if ( separateList )
+ if (separateList)
{
- GinMetaPageData sublist;
+ GinMetaPageData sublist;
/*
* We should make sublist separately and append it to the tail
*/
- memset( &sublist, 0, sizeof(GinMetaPageData) );
+ memset(&sublist, 0, sizeof(GinMetaPageData));
makeSublist(index, collector->tuples, collector->ntuples, &sublist);
@@ -275,14 +280,14 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate,
LockBuffer(metabuffer, GIN_EXCLUSIVE);
metadata = GinPageGetMeta(metapage);
- if ( metadata->head == InvalidBlockNumber )
+ if (metadata->head == InvalidBlockNumber)
{
/*
* Sublist becomes main list
*/
START_CRIT_SECTION();
- memcpy(metadata, &sublist, sizeof(GinMetaPageData) );
- memcpy(&data.metadata, &sublist, sizeof(GinMetaPageData) );
+ memcpy(metadata, &sublist, sizeof(GinMetaPageData));
+ memcpy(&data.metadata, &sublist, sizeof(GinMetaPageData));
}
else
{
@@ -305,7 +310,7 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate,
metadata->nPendingPages += sublist.nPendingPages;
metadata->nPendingHeapTuples += sublist.nPendingHeapTuples;
- memcpy(&data.metadata, metadata, sizeof(GinMetaPageData) );
+ memcpy(&data.metadata, metadata, sizeof(GinMetaPageData));
data.newRightlink = sublist.head;
MarkBufferDirty(buffer);
@@ -317,21 +322,23 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate,
* Insert into tail page, metapage is already locked
*/
- OffsetNumber l, off;
- int i, tupsize;
- char *ptr;
+ OffsetNumber l,
+ off;
+ int i,
+ tupsize;
+ char *ptr;
buffer = ReadBuffer(index, metadata->tail);
LockBuffer(buffer, GIN_EXCLUSIVE);
page = BufferGetPage(buffer);
off = (PageIsEmpty(page)) ? FirstOffsetNumber :
- OffsetNumberNext(PageGetMaxOffsetNumber(page));
+ OffsetNumberNext(PageGetMaxOffsetNumber(page));
rdata[0].next = rdata + 1;
rdata[1].buffer = buffer;
rdata[1].buffer_std = true;
- ptr = rdata[1].data = (char *) palloc( collector->sumsize );
+ ptr = rdata[1].data = (char *) palloc(collector->sumsize);
rdata[1].len = collector->sumsize;
rdata[1].next = NULL;
@@ -342,44 +349,44 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate,
/*
* Increase counter of heap tuples
*/
- Assert( GinPageGetOpaque(page)->maxoff <= metadata->nPendingHeapTuples );
+ Assert(GinPageGetOpaque(page)->maxoff <= metadata->nPendingHeapTuples);
GinPageGetOpaque(page)->maxoff++;
metadata->nPendingHeapTuples++;
- for(i=0; i<collector->ntuples; i++)
+ for (i = 0; i < collector->ntuples; i++)
{
tupsize = IndexTupleSize(collector->tuples[i]);
- l = PageAddItem(page, (Item)collector->tuples[i], tupsize, off, false, false);
+ l = PageAddItem(page, (Item) collector->tuples[i], tupsize, off, false, false);
if (l == InvalidOffsetNumber)
elog(ERROR, "failed to add item to index page in \"%s\"",
- RelationGetRelationName(index));
+ RelationGetRelationName(index));
memcpy(ptr, collector->tuples[i], tupsize);
- ptr+=tupsize;
+ ptr += tupsize;
off++;
}
metadata->tailFreeSize -= collector->sumsize + collector->ntuples * sizeof(ItemIdData);
- memcpy(&data.metadata, metadata, sizeof(GinMetaPageData) );
+ memcpy(&data.metadata, metadata, sizeof(GinMetaPageData));
MarkBufferDirty(buffer);
}
/*
- * Make real write
+ * Make real write
*/
MarkBufferDirty(metabuffer);
- if ( !index->rd_istemp )
+ if (!index->rd_istemp)
{
- XLogRecPtr recptr;
+ XLogRecPtr recptr;
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_UPDATE_META_PAGE, rdata);
PageSetLSN(metapage, recptr);
PageSetTLI(metapage, ThisTimeLineID);
- if ( buffer != InvalidBuffer )
+ if (buffer != InvalidBuffer)
{
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
@@ -390,23 +397,22 @@ ginHeapTupleFastInsert(Relation index, GinState *ginstate,
UnlockReleaseBuffer(buffer);
/*
- * Force pending list cleanup when it becomes too long.
- * And, ginInsertCleanup could take significant amount of
- * time, so we prefer to call it when it can do all the work in a
- * single collection cycle. In non-vacuum mode, it shouldn't
- * require maintenance_work_mem, so fire it while pending list is
- * still small enough to fit into work_mem.
+ * Force pending list cleanup when it becomes too long. And,
+ * ginInsertCleanup could take significant amount of time, so we prefer to
+ * call it when it can do all the work in a single collection cycle. In
+ * non-vacuum mode, it shouldn't require maintenance_work_mem, so fire it
+ * while pending list is still small enough to fit into work_mem.
*
* ginInsertCleanup() should not be called inside our CRIT_SECTION.
*/
- if ( metadata->nPendingPages * GIN_PAGE_FREESIZE > work_mem * 1024L )
+ if (metadata->nPendingPages * GIN_PAGE_FREESIZE > work_mem * 1024L)
needCleanup = true;
UnlockReleaseBuffer(metabuffer);
END_CRIT_SECTION();
- if ( needCleanup )
+ if (needCleanup)
ginInsertCleanup(index, ginstate, false, NULL);
}
@@ -432,17 +438,17 @@ ginHeapTupleFastCollect(Relation index, GinState *ginstate,
/*
* Allocate/reallocate memory for storing collected tuples
*/
- if ( collector->tuples == NULL )
+ if (collector->tuples == NULL)
{
collector->lentuples = nentries * index->rd_att->natts;
- collector->tuples = (IndexTuple*)palloc(sizeof(IndexTuple) * collector->lentuples);
+ collector->tuples = (IndexTuple *) palloc(sizeof(IndexTuple) * collector->lentuples);
}
- while ( collector->ntuples + nentries > collector->lentuples )
+ while (collector->ntuples + nentries > collector->lentuples)
{
collector->lentuples *= 2;
- collector->tuples = (IndexTuple*)repalloc( collector->tuples,
- sizeof(IndexTuple) * collector->lentuples);
+ collector->tuples = (IndexTuple *) repalloc(collector->tuples,
+ sizeof(IndexTuple) * collector->lentuples);
}
/*
@@ -450,13 +456,13 @@ ginHeapTupleFastCollect(Relation index, GinState *ginstate,
*/
for (i = 0; i < nentries; i++)
{
- int32 tupsize;
+ int32 tupsize;
collector->tuples[collector->ntuples + i] = GinFormTuple(ginstate, attnum, entries[i], NULL, 0);
collector->tuples[collector->ntuples + i]->t_tid = *item;
tupsize = IndexTupleSize(collector->tuples[collector->ntuples + i]);
- if ( tupsize > TOAST_INDEX_TARGET || tupsize >= GinMaxItemSize)
+ if (tupsize > TOAST_INDEX_TARGET || tupsize >= GinMaxItemSize)
elog(ERROR, "huge tuple");
collector->sumsize += tupsize;
@@ -480,9 +486,9 @@ static bool
shiftList(Relation index, Buffer metabuffer, BlockNumber newHead,
IndexBulkDeleteResult *stats)
{
- Page metapage;
- GinMetaPageData *metadata;
- BlockNumber blknoToDelete;
+ Page metapage;
+ GinMetaPageData *metadata;
+ BlockNumber blknoToDelete;
metapage = BufferGetPage(metabuffer);
metadata = GinPageGetMeta(metapage);
@@ -490,12 +496,12 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead,
do
{
- Page page;
- int i;
- int64 nDeletedHeapTuples = 0;
- ginxlogDeleteListPages data;
- XLogRecData rdata[1];
- Buffer buffers[GIN_NDELETE_AT_ONCE];
+ Page page;
+ int i;
+ int64 nDeletedHeapTuples = 0;
+ ginxlogDeleteListPages data;
+ XLogRecData rdata[1];
+ Buffer buffers[GIN_NDELETE_AT_ONCE];
data.node = index->rd_node;
@@ -507,24 +513,24 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead,
data.ndeleted = 0;
while (data.ndeleted < GIN_NDELETE_AT_ONCE && blknoToDelete != newHead)
{
- data.toDelete[ data.ndeleted ] = blknoToDelete;
- buffers[ data.ndeleted ] = ReadBuffer(index, blknoToDelete);
- LockBuffer( buffers[ data.ndeleted ], GIN_EXCLUSIVE );
- page = BufferGetPage( buffers[ data.ndeleted ] );
+ data.toDelete[data.ndeleted] = blknoToDelete;
+ buffers[data.ndeleted] = ReadBuffer(index, blknoToDelete);
+ LockBuffer(buffers[data.ndeleted], GIN_EXCLUSIVE);
+ page = BufferGetPage(buffers[data.ndeleted]);
data.ndeleted++;
- if ( GinPageIsDeleted(page) )
+ if (GinPageIsDeleted(page))
{
/* concurrent cleanup process is detected */
- for(i=0;i<data.ndeleted;i++)
- UnlockReleaseBuffer( buffers[i] );
+ for (i = 0; i < data.ndeleted; i++)
+ UnlockReleaseBuffer(buffers[i]);
return true;
}
nDeletedHeapTuples += GinPageGetOpaque(page)->maxoff;
- blknoToDelete = GinPageGetOpaque( page )->rightlink;
+ blknoToDelete = GinPageGetOpaque(page)->rightlink;
}
if (stats)
@@ -534,50 +540,50 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead,
metadata->head = blknoToDelete;
- Assert( metadata->nPendingPages >= data.ndeleted );
+ Assert(metadata->nPendingPages >= data.ndeleted);
metadata->nPendingPages -= data.ndeleted;
- Assert( metadata->nPendingHeapTuples >= nDeletedHeapTuples );
+ Assert(metadata->nPendingHeapTuples >= nDeletedHeapTuples);
metadata->nPendingHeapTuples -= nDeletedHeapTuples;
- if ( blknoToDelete == InvalidBlockNumber )
+ if (blknoToDelete == InvalidBlockNumber)
{
metadata->tail = InvalidBlockNumber;
metadata->tailFreeSize = 0;
metadata->nPendingPages = 0;
metadata->nPendingHeapTuples = 0;
}
- memcpy( &data.metadata, metadata, sizeof(GinMetaPageData));
+ memcpy(&data.metadata, metadata, sizeof(GinMetaPageData));
- MarkBufferDirty( metabuffer );
+ MarkBufferDirty(metabuffer);
- for(i=0; i<data.ndeleted; i++)
+ for (i = 0; i < data.ndeleted; i++)
{
- page = BufferGetPage( buffers[ i ] );
- GinPageGetOpaque( page )->flags = GIN_DELETED;
- MarkBufferDirty( buffers[ i ] );
+ page = BufferGetPage(buffers[i]);
+ GinPageGetOpaque(page)->flags = GIN_DELETED;
+ MarkBufferDirty(buffers[i]);
}
- if ( !index->rd_istemp )
+ if (!index->rd_istemp)
{
- XLogRecPtr recptr;
+ XLogRecPtr recptr;
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_DELETE_LISTPAGE, rdata);
PageSetLSN(metapage, recptr);
PageSetTLI(metapage, ThisTimeLineID);
- for(i=0; i<data.ndeleted; i++)
+ for (i = 0; i < data.ndeleted; i++)
{
- page = BufferGetPage( buffers[ i ] );
+ page = BufferGetPage(buffers[i]);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
}
}
- for(i=0; i<data.ndeleted; i++)
- UnlockReleaseBuffer( buffers[ i ] );
+ for (i = 0; i < data.ndeleted; i++)
+ UnlockReleaseBuffer(buffers[i]);
END_CRIT_SECTION();
- } while( blknoToDelete != newHead );
+ } while (blknoToDelete != newHead);
return false;
}
@@ -586,14 +592,14 @@ shiftList(Relation index, Buffer metabuffer, BlockNumber newHead,
static void
addDatum(DatumArray *datums, Datum datum)
{
- if ( datums->nvalues >= datums->maxvalues)
+ if (datums->nvalues >= datums->maxvalues)
{
datums->maxvalues *= 2;
- datums->values = (Datum*)repalloc(datums->values,
- sizeof(Datum)*datums->maxvalues);
+ datums->values = (Datum *) repalloc(datums->values,
+ sizeof(Datum) * datums->maxvalues);
}
- datums->values[ datums->nvalues++ ] = datum;
+ datums->values[datums->nvalues++] = datum;
}
/*
@@ -606,31 +612,33 @@ static void
processPendingPage(BuildAccumulator *accum, DatumArray *da,
Page page, OffsetNumber startoff)
{
- ItemPointerData heapptr;
- OffsetNumber i,maxoff;
- OffsetNumber attrnum, curattnum;
+ ItemPointerData heapptr;
+ OffsetNumber i,
+ maxoff;
+ OffsetNumber attrnum,
+ curattnum;
/* reset *da to empty */
da->nvalues = 0;
maxoff = PageGetMaxOffsetNumber(page);
- Assert( maxoff >= FirstOffsetNumber );
+ Assert(maxoff >= FirstOffsetNumber);
ItemPointerSetInvalid(&heapptr);
attrnum = 0;
for (i = startoff; i <= maxoff; i = OffsetNumberNext(i))
{
- IndexTuple itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, i));
+ IndexTuple itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, i));
curattnum = gintuple_get_attrnum(accum->ginstate, itup);
- if ( !ItemPointerIsValid(&heapptr) )
+ if (!ItemPointerIsValid(&heapptr))
{
heapptr = itup->t_tid;
attrnum = curattnum;
}
- else if ( !(ItemPointerEquals(&heapptr, &itup->t_tid) &&
- curattnum == attrnum) )
+ else if (!(ItemPointerEquals(&heapptr, &itup->t_tid) &&
+ curattnum == attrnum))
{
/*
* We can insert several datums per call, but only for one heap
@@ -652,7 +660,7 @@ processPendingPage(BuildAccumulator *accum, DatumArray *da,
*
* This can be called concurrently by multiple backends, so it must cope.
* On first glance it looks completely not concurrent-safe and not crash-safe
- * either. The reason it's okay is that multiple insertion of the same entry
+ * either. The reason it's okay is that multiple insertion of the same entry
* is detected and treated as a no-op by gininsert.c. If we crash after
* posting entries to the main index and before removing them from the
* pending list, it's okay because when we redo the posting later on, nothing
@@ -671,20 +679,23 @@ void
ginInsertCleanup(Relation index, GinState *ginstate,
bool vac_delay, IndexBulkDeleteResult *stats)
{
- Buffer metabuffer, buffer;
- Page metapage, page;
- GinMetaPageData *metadata;
- MemoryContext opCtx, oldCtx;
- BuildAccumulator accum;
- DatumArray datums;
- BlockNumber blkno;
+ Buffer metabuffer,
+ buffer;
+ Page metapage,
+ page;
+ GinMetaPageData *metadata;
+ MemoryContext opCtx,
+ oldCtx;
+ BuildAccumulator accum;
+ DatumArray datums;
+ BlockNumber blkno;
metabuffer = ReadBuffer(index, GIN_METAPAGE_BLKNO);
LockBuffer(metabuffer, GIN_SHARE);
metapage = BufferGetPage(metabuffer);
metadata = GinPageGetMeta(metapage);
- if ( metadata->head == InvalidBlockNumber )
+ if (metadata->head == InvalidBlockNumber)
{
/* Nothing to do */
UnlockReleaseBuffer(metabuffer);
@@ -702,7 +713,7 @@ ginInsertCleanup(Relation index, GinState *ginstate,
LockBuffer(metabuffer, GIN_UNLOCK);
/*
- * Initialize. All temporary space will be in opCtx
+ * Initialize. All temporary space will be in opCtx
*/
opCtx = AllocSetContextCreate(CurrentMemoryContext,
"GIN insert cleanup temporary context",
@@ -712,24 +723,24 @@ ginInsertCleanup(Relation index, GinState *ginstate,
oldCtx = MemoryContextSwitchTo(opCtx);
- datums.maxvalues=128;
+ datums.maxvalues = 128;
datums.nvalues = 0;
- datums.values = (Datum*)palloc(sizeof(Datum)*datums.maxvalues);
+ datums.values = (Datum *) palloc(sizeof(Datum) * datums.maxvalues);
ginInitBA(&accum);
accum.ginstate = ginstate;
/*
- * At the top of this loop, we have pin and lock on the current page
- * of the pending list. However, we'll release that before exiting
- * the loop. Note we also have pin but not lock on the metapage.
+ * At the top of this loop, we have pin and lock on the current page of
+ * the pending list. However, we'll release that before exiting the loop.
+ * Note we also have pin but not lock on the metapage.
*/
- for(;;)
+ for (;;)
{
- if ( GinPageIsDeleted(page) )
+ if (GinPageIsDeleted(page))
{
/* another cleanup process is running concurrently */
- UnlockReleaseBuffer( buffer );
+ UnlockReleaseBuffer(buffer);
break;
}
@@ -742,9 +753,9 @@ ginInsertCleanup(Relation index, GinState *ginstate,
vacuum_delay_point();
/*
- * Is it time to flush memory to disk? Flush if we are at the end
- * of the pending list, or if we have a full row and memory is
- * getting full.
+ * Is it time to flush memory to disk? Flush if we are at the end of
+ * the pending list, or if we have a full row and memory is getting
+ * full.
*
* XXX using up maintenance_work_mem here is probably unreasonably
* much, since vacuum might already be using that much.
@@ -754,15 +765,16 @@ ginInsertCleanup(Relation index, GinState *ginstate,
(accum.allocatedMemory >= maintenance_work_mem * 1024L ||
accum.maxdepth > GIN_MAX_TREE_DEPTH)))
{
- ItemPointerData *list;
- uint32 nlist;
- Datum entry;
- OffsetNumber maxoff, attnum;
+ ItemPointerData *list;
+ uint32 nlist;
+ Datum entry;
+ OffsetNumber maxoff,
+ attnum;
/*
- * Unlock current page to increase performance.
- * Changes of page will be checked later by comparing
- * maxoff after completion of memory flush.
+ * Unlock current page to increase performance. Changes of page
+ * will be checked later by comparing maxoff after completion of
+ * memory flush.
*/
maxoff = PageGetMaxOffsetNumber(page);
LockBuffer(buffer, GIN_UNLOCK);
@@ -785,7 +797,7 @@ ginInsertCleanup(Relation index, GinState *ginstate,
LockBuffer(metabuffer, GIN_EXCLUSIVE);
LockBuffer(buffer, GIN_SHARE);
- if ( GinPageIsDeleted(page) )
+ if (GinPageIsDeleted(page))
{
/* another cleanup process is running concurrently */
UnlockReleaseBuffer(buffer);
@@ -795,16 +807,16 @@ ginInsertCleanup(Relation index, GinState *ginstate,
/*
* While we left the page unlocked, more stuff might have gotten
- * added to it. If so, process those entries immediately. There
+ * added to it. If so, process those entries immediately. There
* shouldn't be very many, so we don't worry about the fact that
* we're doing this with exclusive lock. Insertion algorithm
* gurantees that inserted row(s) will not continue on next page.
* NOTE: intentionally no vacuum_delay_point in this loop.
*/
- if ( PageGetMaxOffsetNumber(page) != maxoff )
+ if (PageGetMaxOffsetNumber(page) != maxoff)
{
ginInitBA(&accum);
- processPendingPage(&accum, &datums, page, maxoff+1);
+ processPendingPage(&accum, &datums, page, maxoff + 1);
while ((list = ginGetEntry(&accum, &attnum, &entry, &nlist)) != NULL)
ginEntryInsert(index, ginstate, attnum, entry, list, nlist, FALSE);
@@ -814,26 +826,27 @@ ginInsertCleanup(Relation index, GinState *ginstate,
* Remember next page - it will become the new list head
*/
blkno = GinPageGetOpaque(page)->rightlink;
- UnlockReleaseBuffer(buffer); /* shiftList will do exclusive locking */
+ UnlockReleaseBuffer(buffer); /* shiftList will do exclusive
+ * locking */
/*
* remove readed pages from pending list, at this point all
* content of readed pages is in regular structure
*/
- if ( shiftList(index, metabuffer, blkno, stats) )
+ if (shiftList(index, metabuffer, blkno, stats))
{
/* another cleanup process is running concurrently */
LockBuffer(metabuffer, GIN_UNLOCK);
break;
}
- Assert( blkno == metadata->head );
+ Assert(blkno == metadata->head);
LockBuffer(metabuffer, GIN_UNLOCK);
/*
* if we removed the whole pending list just exit
*/
- if ( blkno == InvalidBlockNumber )
+ if (blkno == InvalidBlockNumber)
break;
/*
@@ -842,7 +855,7 @@ ginInsertCleanup(Relation index, GinState *ginstate,
MemoryContextReset(opCtx);
ginInitBA(&accum);
datums.nvalues = 0;
- datums.values = (Datum*)palloc(sizeof(Datum)*datums.maxvalues);
+ datums.values = (Datum *) palloc(sizeof(Datum) * datums.maxvalues);
}
else
{
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index d57ee8febb..f5e0f788d1 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.26 2009/05/19 02:48:26 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.27 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -25,10 +25,10 @@
typedef struct pendingPosition
{
- Buffer pendingBuffer;
- OffsetNumber firstOffset;
- OffsetNumber lastOffset;
- ItemPointerData item;
+ Buffer pendingBuffer;
+ OffsetNumber firstOffset;
+ OffsetNumber lastOffset;
+ ItemPointerData item;
} pendingPosition;
@@ -64,19 +64,19 @@ findItemInPage(Page page, ItemPointer item, OffsetNumber *off)
* Goes to the next page if current offset is outside of bounds
*/
static bool
-moveRightIfItNeeded( GinBtreeData *btree, GinBtreeStack *stack )
+moveRightIfItNeeded(GinBtreeData *btree, GinBtreeStack *stack)
{
- Page page = BufferGetPage(stack->buffer);
+ Page page = BufferGetPage(stack->buffer);
- if ( stack->off > PageGetMaxOffsetNumber(page) )
+ if (stack->off > PageGetMaxOffsetNumber(page))
{
/*
* We scanned the whole page, so we should take right page
*/
stack->blkno = GinPageGetOpaque(page)->rightlink;
- if ( GinPageRightMost(page) )
- return false; /* no more pages */
+ if (GinPageRightMost(page))
+ return false; /* no more pages */
LockBuffer(stack->buffer, GIN_UNLOCK);
stack->buffer = ReleaseAndReadBuffer(stack->buffer, btree->index, stack->blkno);
@@ -92,12 +92,12 @@ moveRightIfItNeeded( GinBtreeData *btree, GinBtreeStack *stack )
* in scanEntry->partialMatch TIDBitmap
*/
static void
-scanForItems( Relation index, GinScanEntry scanEntry, BlockNumber rootPostingTree )
+scanForItems(Relation index, GinScanEntry scanEntry, BlockNumber rootPostingTree)
{
GinPostingTreeScan *gdi;
- Buffer buffer;
- Page page;
- BlockNumber blkno;
+ Buffer buffer;
+ Page page;
+ BlockNumber blkno;
gdi = prepareScanPostingTree(index, rootPostingTree, TRUE);
@@ -110,23 +110,23 @@ scanForItems( Relation index, GinScanEntry scanEntry, BlockNumber rootPostingTre
/*
* Goes through all leaves
*/
- for(;;)
+ for (;;)
{
page = BufferGetPage(buffer);
- if ((GinPageGetOpaque(page)->flags & GIN_DELETED) == 0 && GinPageGetOpaque(page)->maxoff >= FirstOffsetNumber )
+ if ((GinPageGetOpaque(page)->flags & GIN_DELETED) == 0 && GinPageGetOpaque(page)->maxoff >= FirstOffsetNumber)
{
- tbm_add_tuples( scanEntry->partialMatch,
- (ItemPointer)GinDataPageGetItem(page, FirstOffsetNumber),
- GinPageGetOpaque(page)->maxoff, false);
+ tbm_add_tuples(scanEntry->partialMatch,
+ (ItemPointer) GinDataPageGetItem(page, FirstOffsetNumber),
+ GinPageGetOpaque(page)->maxoff, false);
scanEntry->predictNumberResult += GinPageGetOpaque(page)->maxoff;
}
blkno = GinPageGetOpaque(page)->rightlink;
- if ( GinPageRightMost(page) )
+ if (GinPageRightMost(page))
{
UnlockReleaseBuffer(buffer);
- return; /* no more pages */
+ return; /* no more pages */
}
LockBuffer(buffer, GIN_UNLOCK);
@@ -142,21 +142,21 @@ scanForItems( Relation index, GinScanEntry scanEntry, BlockNumber rootPostingTre
* Returns true if done, false if it's needed to restart scan from scratch
*/
static bool
-computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry scanEntry )
+computePartialMatchList(GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry scanEntry)
{
- Page page;
- IndexTuple itup;
+ Page page;
+ IndexTuple itup;
Datum idatum;
int32 cmp;
- scanEntry->partialMatch = tbm_create( work_mem * 1024L );
+ scanEntry->partialMatch = tbm_create(work_mem * 1024L);
- for(;;)
+ for (;;)
{
/*
* stack->off points to the interested entry, buffer is already locked
*/
- if ( moveRightIfItNeeded(btree, stack) == false )
+ if (moveRightIfItNeeded(btree, stack) == false)
return true;
page = BufferGetPage(stack->buffer);
@@ -165,10 +165,10 @@ computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry
/*
* If tuple stores another attribute then stop scan
*/
- if ( gintuple_get_attrnum( btree->ginstate, itup ) != scanEntry->attnum )
+ if (gintuple_get_attrnum(btree->ginstate, itup) != scanEntry->attnum)
return true;
- idatum = gin_index_getattr( btree->ginstate, itup );
+ idatum = gin_index_getattr(btree->ginstate, itup);
/*----------
@@ -178,74 +178,74 @@ computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry
* case cmp < 0 => not match and continue scan
*----------
*/
- cmp = DatumGetInt32(FunctionCall4(&btree->ginstate->comparePartialFn[scanEntry->attnum-1],
+ cmp = DatumGetInt32(FunctionCall4(&btree->ginstate->comparePartialFn[scanEntry->attnum - 1],
scanEntry->entry,
idatum,
UInt16GetDatum(scanEntry->strategy),
- PointerGetDatum(scanEntry->extra_data)));
+ PointerGetDatum(scanEntry->extra_data)));
- if ( cmp > 0 )
+ if (cmp > 0)
return true;
- else if ( cmp < 0 )
+ else if (cmp < 0)
{
stack->off++;
continue;
}
- if ( GinIsPostingTree(itup) )
+ if (GinIsPostingTree(itup))
{
BlockNumber rootPostingTree = GinGetPostingTree(itup);
Datum newDatum,
- savedDatum = datumCopy (
- idatum,
- btree->ginstate->origTupdesc->attrs[scanEntry->attnum-1]->attbyval,
- btree->ginstate->origTupdesc->attrs[scanEntry->attnum-1]->attlen
- );
+ savedDatum = datumCopy(
+ idatum,
+ btree->ginstate->origTupdesc->attrs[scanEntry->attnum - 1]->attbyval,
+ btree->ginstate->origTupdesc->attrs[scanEntry->attnum - 1]->attlen
+ );
+
/*
- * We should unlock current page (but not unpin) during
- * tree scan to prevent deadlock with vacuum processes.
+ * We should unlock current page (but not unpin) during tree scan
+ * to prevent deadlock with vacuum processes.
*
* We save current entry value (savedDatum) to be able to refind
* our tuple after re-locking
*/
LockBuffer(stack->buffer, GIN_UNLOCK);
- scanForItems( btree->index, scanEntry, rootPostingTree );
+ scanForItems(btree->index, scanEntry, rootPostingTree);
/*
- * We lock again the entry page and while it was unlocked
- * insert might occured, so we need to refind our position
+ * We lock again the entry page and while it was unlocked insert
+ * might occured, so we need to refind our position
*/
LockBuffer(stack->buffer, GIN_SHARE);
page = BufferGetPage(stack->buffer);
- if ( !GinPageIsLeaf(page) )
+ if (!GinPageIsLeaf(page))
{
/*
- * Root page becomes non-leaf while we unlock it. We
- * will start again, this situation doesn't cause
- * often - root can became a non-leaf only one per
- * life of index.
+ * Root page becomes non-leaf while we unlock it. We will
+ * start again, this situation doesn't cause often - root can
+ * became a non-leaf only one per life of index.
*/
return false;
}
- for(;;)
+ for (;;)
{
- if ( moveRightIfItNeeded(btree, stack) == false )
- elog(ERROR, "lost saved point in index"); /* must not happen !!! */
+ if (moveRightIfItNeeded(btree, stack) == false)
+ elog(ERROR, "lost saved point in index"); /* must not happen !!! */
page = BufferGetPage(stack->buffer);
itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, stack->off));
- newDatum = gin_index_getattr( btree->ginstate, itup );
+ newDatum = gin_index_getattr(btree->ginstate, itup);
- if ( gintuple_get_attrnum( btree->ginstate, itup ) != scanEntry->attnum )
- elog(ERROR, "lost saved point in index"); /* must not happen !!! */
+ if (gintuple_get_attrnum(btree->ginstate, itup) != scanEntry->attnum)
+ elog(ERROR, "lost saved point in index"); /* must not happen !!! */
- if ( compareEntries(btree->ginstate, scanEntry->attnum, newDatum, savedDatum) == 0 )
+ if (compareEntries(btree->ginstate, scanEntry->attnum, newDatum, savedDatum) == 0)
{
/* Found! */
- if ( btree->ginstate->origTupdesc->attrs[scanEntry->attnum-1]->attbyval == false )
- pfree( DatumGetPointer(savedDatum) );
+ if (btree->ginstate->origTupdesc->attrs[scanEntry->attnum - 1]->attbyval == false)
+ pfree(DatumGetPointer(savedDatum));
break;
}
@@ -254,8 +254,8 @@ computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry
}
else
{
- tbm_add_tuples( scanEntry->partialMatch, GinGetPosting(itup), GinGetNPosting(itup), false);
- scanEntry->predictNumberResult += GinGetNPosting(itup);
+ tbm_add_tuples(scanEntry->partialMatch, GinGetPosting(itup), GinGetNPosting(itup), false);
+ scanEntry->predictNumberResult += GinGetNPosting(itup);
}
/*
@@ -273,10 +273,10 @@ computePartialMatchList( GinBtreeData *btree, GinBtreeStack *stack, GinScanEntry
static void
startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry)
{
- GinBtreeData btreeEntry;
- GinBtreeStack *stackEntry;
- Page page;
- bool needUnlock = TRUE;
+ GinBtreeData btreeEntry;
+ GinBtreeStack *stackEntry;
+ Page page;
+ bool needUnlock = TRUE;
entry->buffer = InvalidBuffer;
entry->offset = InvalidOffsetNumber;
@@ -294,8 +294,8 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry)
}
/*
- * we should find entry, and begin scan of posting tree
- * or just store posting list in memory
+ * we should find entry, and begin scan of posting tree or just store
+ * posting list in memory
*/
prepareEntryScan(&btreeEntry, index, entry->attnum, entry->entry, ginstate);
@@ -305,27 +305,26 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry)
entry->isFinished = TRUE;
- if ( entry->isPartialMatch )
+ if (entry->isPartialMatch)
{
/*
- * btreeEntry.findItem points to the first equal or greater value
- * than needed. So we will scan further and collect all
- * ItemPointers
+ * btreeEntry.findItem points to the first equal or greater value than
+ * needed. So we will scan further and collect all ItemPointers
*/
btreeEntry.findItem(&btreeEntry, stackEntry);
- if ( computePartialMatchList( &btreeEntry, stackEntry, entry ) == false )
+ if (computePartialMatchList(&btreeEntry, stackEntry, entry) == false)
{
/*
- * GIN tree was seriously restructured, so we will
- * cleanup all found data and rescan. See comments near
- * 'return false' in computePartialMatchList()
+ * GIN tree was seriously restructured, so we will cleanup all
+ * found data and rescan. See comments near 'return false' in
+ * computePartialMatchList()
*/
- if ( entry->partialMatch )
+ if (entry->partialMatch)
{
if (entry->partialMatchIterator)
tbm_end_iterate(entry->partialMatchIterator);
entry->partialMatchIterator = NULL;
- tbm_free( entry->partialMatch );
+ tbm_free(entry->partialMatch);
entry->partialMatch = NULL;
}
LockBuffer(stackEntry->buffer, GIN_UNLOCK);
@@ -335,7 +334,7 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry)
return;
}
- if ( entry->partialMatch && !tbm_is_empty(entry->partialMatch) )
+ if (entry->partialMatch && !tbm_is_empty(entry->partialMatch))
{
entry->partialMatchIterator = tbm_begin_iterate(entry->partialMatch);
entry->isFinished = FALSE;
@@ -352,22 +351,22 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry)
Page page;
/*
- * We should unlock entry page before make deal with
- * posting tree to prevent deadlocks with vacuum processes.
- * Because entry is never deleted from page and posting tree is
- * never reduced to the posting list, we can unlock page after
- * getting BlockNumber of root of posting tree.
+ * We should unlock entry page before make deal with posting tree
+ * to prevent deadlocks with vacuum processes. Because entry is
+ * never deleted from page and posting tree is never reduced to
+ * the posting list, we can unlock page after getting BlockNumber
+ * of root of posting tree.
*/
LockBuffer(stackEntry->buffer, GIN_UNLOCK);
needUnlock = FALSE;
gdi = prepareScanPostingTree(index, rootPostingTree, TRUE);
entry->buffer = scanBeginPostingTree(gdi);
+
/*
* We keep buffer pinned because we need to prevent deletion of
- * page during scan. See GIN's vacuum implementation. RefCount
- * is increased to keep buffer pinned after freeGinBtreeStack()
- * call.
+ * page during scan. See GIN's vacuum implementation. RefCount is
+ * increased to keep buffer pinned after freeGinBtreeStack() call.
*/
IncrBufferRefCount(entry->buffer);
@@ -377,10 +376,10 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry)
/*
* Keep page content in memory to prevent durable page locking
*/
- entry->list = (ItemPointerData *) palloc( BLCKSZ );
+ entry->list = (ItemPointerData *) palloc(BLCKSZ);
entry->nlist = GinPageGetOpaque(page)->maxoff;
- memcpy( entry->list, GinDataPageGetItem(page, FirstOffsetNumber),
- GinPageGetOpaque(page)->maxoff * sizeof(ItemPointerData) );
+ memcpy(entry->list, GinDataPageGetItem(page, FirstOffsetNumber),
+ GinPageGetOpaque(page)->maxoff * sizeof(ItemPointerData));
LockBuffer(entry->buffer, GIN_UNLOCK);
freeGinBtreeStack(gdi->stack);
@@ -397,7 +396,7 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry)
}
if (needUnlock)
- LockBuffer(stackEntry->buffer, GIN_UNLOCK);
+ LockBuffer(stackEntry->buffer, GIN_UNLOCK);
freeGinBtreeStack(stackEntry);
}
@@ -419,10 +418,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++)
@@ -459,7 +458,7 @@ entryGetNextItem(Relation index, GinScanEntry entry)
Page page;
BlockNumber blkno;
- for(;;)
+ for (;;)
{
entry->offset++;
@@ -471,7 +470,7 @@ entryGetNextItem(Relation index, GinScanEntry entry)
LockBuffer(entry->buffer, GIN_SHARE);
page = BufferGetPage(entry->buffer);
- for(;;)
+ for (;;)
{
/*
* It's needed to go by right link. During that we should refind
@@ -501,20 +500,20 @@ entryGetNextItem(Relation index, GinScanEntry entry)
* Found position equal to or greater than stored
*/
entry->nlist = GinPageGetOpaque(page)->maxoff;
- memcpy( entry->list, GinDataPageGetItem(page, FirstOffsetNumber),
- GinPageGetOpaque(page)->maxoff * sizeof(ItemPointerData) );
+ memcpy(entry->list, GinDataPageGetItem(page, FirstOffsetNumber),
+ GinPageGetOpaque(page)->maxoff * sizeof(ItemPointerData));
LockBuffer(entry->buffer, GIN_UNLOCK);
- if ( !ItemPointerIsValid(&entry->curItem) ||
- compareItemPointers( &entry->curItem, entry->list + entry->offset - 1 ) == 0 )
+ if (!ItemPointerIsValid(&entry->curItem) ||
+ compareItemPointers(&entry->curItem, entry->list + entry->offset - 1) == 0)
{
/*
- * First pages are deleted or empty, or we found exact position,
- * so break inner loop and continue outer one.
+ * First pages are deleted or empty, or we found exact
+ * position, so break inner loop and continue outer one.
*/
- break;
+ break;
}
/*
@@ -543,7 +542,7 @@ entryGetItem(Relation index, GinScanEntry entry)
entry->isFinished = entry->master->isFinished;
entry->curItem = entry->master->curItem;
}
- else if ( entry->partialMatch )
+ else if (entry->partialMatch)
{
do
{
@@ -552,7 +551,7 @@ entryGetItem(Relation index, GinScanEntry entry)
{
entry->partialMatchResult = tbm_iterate(entry->partialMatchIterator);
- if ( entry->partialMatchResult == NULL )
+ if (entry->partialMatchResult == NULL)
{
ItemPointerSet(&entry->curItem, InvalidBlockNumber, InvalidOffsetNumber);
tbm_end_iterate(entry->partialMatchIterator);
@@ -562,22 +561,23 @@ entryGetItem(Relation index, GinScanEntry entry)
}
/*
- * reset counter to the beginning of entry->partialMatchResult.
- * Note: entry->offset is still greater than
- * partialMatchResult->ntuples if partialMatchResult is
- * lossy. So, on next call we will get next result from
- * TIDBitmap.
+ * reset counter to the beginning of
+ * entry->partialMatchResult. Note: entry->offset is still
+ * greater than partialMatchResult->ntuples if
+ * partialMatchResult is lossy. So, on next call we will get
+ * next result from TIDBitmap.
*/
entry->offset = 0;
}
- if ( entry->partialMatchResult->ntuples < 0 )
+ if (entry->partialMatchResult->ntuples < 0)
{
/*
* lossy result, so we need to check the whole page
*/
ItemPointerSetLossyPage(&entry->curItem,
entry->partialMatchResult->blockno);
+
/*
* We might as well fall out of the loop; we could not
* estimate number of results on this page to support correct
@@ -618,7 +618,7 @@ entryGetItem(Relation index, GinScanEntry entry)
* Sets key->curItem to new found heap item pointer for one scan key
* Returns isFinished, ie TRUE means we did NOT get a new item pointer!
* Also, *keyrecheck is set true if recheck is needed for this scan key.
- * Note: lossy page could be returned after items from the same page.
+ * Note: lossy page could be returned after items from the same page.
*/
static bool
keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx,
@@ -636,10 +636,10 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx,
{
/*
* move forward from previously value and set new curItem, which is
- * minimal from entries->curItems. Lossy page is encoded by ItemPointer
- * with max value for offset (0xffff), so if there is an non-lossy entries
- * on lossy page they will returned too and after that the whole page.
- * That's not a problem for resulting tidbitmap.
+ * minimal from entries->curItems. Lossy page is encoded by
+ * ItemPointer with max value for offset (0xffff), so if there is an
+ * non-lossy entries on lossy page they will returned too and after
+ * that the whole page. That's not a problem for resulting tidbitmap.
*/
ItemPointerSetMax(&key->curItem);
for (i = 0; i < key->nentries; i++)
@@ -649,9 +649,9 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx,
if (key->entryRes[i])
{
/*
- * Move forward only entries which was the least
- * on previous call, key->entryRes[i] points that
- * current entry was a result of loop/call.
+ * Move forward only entries which was the least on previous
+ * call, key->entryRes[i] points that current entry was a
+ * result of loop/call.
*/
if (entry->isFinished == FALSE && entryGetItem(index, entry) == FALSE)
{
@@ -685,10 +685,10 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx,
/*----------
* entryRes array is used for:
* - as an argument for consistentFn
- * - entry->curItem with corresponding key->entryRes[i] == false are
- * greater than key->curItem, so next loop/call they should be
- * renewed by entryGetItem(). So, we need to set up an array before
- * checking of lossy page.
+ * - entry->curItem with corresponding key->entryRes[i] == false are
+ * greater than key->curItem, so next loop/call they should be
+ * renewed by entryGetItem(). So, we need to set up an array before
+ * checking of lossy page.
*----------
*/
for (i = 0; i < key->nentries; i++)
@@ -717,7 +717,7 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx,
return FALSE;
oldCtx = MemoryContextSwitchTo(tempCtx);
- res = DatumGetBool(FunctionCall6(&ginstate->consistentFn[key->attnum-1],
+ res = DatumGetBool(FunctionCall6(&ginstate->consistentFn[key->attnum - 1],
PointerGetDatum(key->entryRes),
UInt16GetDatum(key->strategy),
key->query,
@@ -745,35 +745,36 @@ keyGetItem(Relation index, GinState *ginstate, MemoryContext tempCtx,
static bool
scanGetCandidate(IndexScanDesc scan, pendingPosition *pos)
{
- OffsetNumber maxoff;
- Page page;
- IndexTuple itup;
+ OffsetNumber maxoff;
+ Page page;
+ IndexTuple itup;
- ItemPointerSetInvalid( &pos->item );
- for(;;)
+ ItemPointerSetInvalid(&pos->item);
+ for (;;)
{
page = BufferGetPage(pos->pendingBuffer);
maxoff = PageGetMaxOffsetNumber(page);
- if ( pos->firstOffset > maxoff )
+ if (pos->firstOffset > maxoff)
{
BlockNumber blkno = GinPageGetOpaque(page)->rightlink;
- if ( blkno == InvalidBlockNumber )
+
+ if (blkno == InvalidBlockNumber)
{
UnlockReleaseBuffer(pos->pendingBuffer);
- pos->pendingBuffer=InvalidBuffer;
+ pos->pendingBuffer = InvalidBuffer;
return false;
}
else
{
/*
- * Here we must prevent deletion of next page by
- * insertcleanup process, which may be trying to obtain
- * exclusive lock on current page. So, we lock next
- * page before releasing the current one
+ * Here we must prevent deletion of next page by insertcleanup
+ * process, which may be trying to obtain exclusive lock on
+ * current page. So, we lock next page before releasing the
+ * current one
*/
- Buffer tmpbuf = ReadBuffer(scan->indexRelation, blkno);
+ Buffer tmpbuf = ReadBuffer(scan->indexRelation, blkno);
LockBuffer(tmpbuf, GIN_SHARE);
UnlockReleaseBuffer(pos->pendingBuffer);
@@ -786,12 +787,12 @@ scanGetCandidate(IndexScanDesc scan, pendingPosition *pos)
{
itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, pos->firstOffset));
pos->item = itup->t_tid;
- if ( GinPageHasFullRow(page) )
+ if (GinPageHasFullRow(page))
{
/*
* find itempointer to the next row
*/
- for(pos->lastOffset = pos->firstOffset+1; pos->lastOffset<=maxoff; pos->lastOffset++)
+ for (pos->lastOffset = pos->firstOffset + 1; pos->lastOffset <= maxoff; pos->lastOffset++)
{
itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, pos->lastOffset));
if (!ItemPointerEquals(&pos->item, &itup->t_tid))
@@ -807,9 +808,9 @@ scanGetCandidate(IndexScanDesc scan, pendingPosition *pos)
}
/*
- * Now pos->firstOffset points to the first tuple of current heap row,
- * pos->lastOffset points to the first tuple of second heap row (or
- * to the end of page)
+ * Now pos->firstOffset points to the first tuple of current heap
+ * row, pos->lastOffset points to the first tuple of second heap
+ * row (or to the end of page)
*/
break;
@@ -830,23 +831,23 @@ static bool
matchPartialInPendingList(GinState *ginstate, Page page,
OffsetNumber off, OffsetNumber maxoff,
Datum value, OffsetNumber attrnum,
- Datum *datum, bool *datumExtracted,
+ Datum *datum, bool *datumExtracted,
StrategyNumber strategy,
Pointer extra_data)
{
- IndexTuple itup;
- int32 cmp;
+ IndexTuple itup;
+ int32 cmp;
- while ( off < maxoff )
+ while (off < maxoff)
{
itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, off));
- if ( attrnum != gintuple_get_attrnum(ginstate, itup) )
+ if (attrnum != gintuple_get_attrnum(ginstate, itup))
return false;
- if (datumExtracted[ off-1 ] == false)
+ if (datumExtracted[off - 1] == false)
{
- datum[ off-1 ] = gin_index_getattr(ginstate, itup);
- datumExtracted[ off-1 ] = true;
+ datum[off - 1] = gin_index_getattr(ginstate, itup);
+ datumExtracted[off - 1] = true;
}
/*----------
@@ -856,9 +857,9 @@ matchPartialInPendingList(GinState *ginstate, Page page,
* case cmp < 0 => not match and continue scan
*----------
*/
- cmp = DatumGetInt32(FunctionCall4(&ginstate->comparePartialFn[attrnum-1],
+ cmp = DatumGetInt32(FunctionCall4(&ginstate->comparePartialFn[attrnum - 1],
value,
- datum[off-1],
+ datum[off - 1],
UInt16GetDatum(strategy),
PointerGetDatum(extra_data)));
if (cmp == 0)
@@ -882,12 +883,13 @@ matchPartialInPendingList(GinState *ginstate, Page page,
static bool
collectDatumForItem(IndexScanDesc scan, pendingPosition *pos)
{
- GinScanOpaque so = (GinScanOpaque) scan->opaque;
- OffsetNumber attrnum;
- Page page;
- IndexTuple itup;
- int i, j;
- bool hasMatch = false;
+ GinScanOpaque so = (GinScanOpaque) scan->opaque;
+ OffsetNumber attrnum;
+ Page page;
+ IndexTuple itup;
+ int i,
+ j;
+ bool hasMatch = false;
/*
* Resets entryRes
@@ -895,38 +897,40 @@ collectDatumForItem(IndexScanDesc scan, pendingPosition *pos)
for (i = 0; i < so->nkeys; i++)
{
GinScanKey key = so->keys + i;
- memset( key->entryRes, FALSE, key->nentries );
+
+ memset(key->entryRes, FALSE, key->nentries);
}
- for(;;)
+ for (;;)
{
- Datum datum[ BLCKSZ/sizeof(IndexTupleData) ];
- bool datumExtracted[ BLCKSZ/sizeof(IndexTupleData) ];
+ Datum datum[BLCKSZ / sizeof(IndexTupleData)];
+ bool datumExtracted[BLCKSZ / sizeof(IndexTupleData)];
- Assert( pos->lastOffset > pos->firstOffset );
- memset(datumExtracted + pos->firstOffset - 1, 0, sizeof(bool) * (pos->lastOffset - pos->firstOffset ));
+ Assert(pos->lastOffset > pos->firstOffset);
+ memset(datumExtracted + pos->firstOffset - 1, 0, sizeof(bool) * (pos->lastOffset - pos->firstOffset));
page = BufferGetPage(pos->pendingBuffer);
- for(i = 0; i < so->nkeys; i++)
+ for (i = 0; i < so->nkeys; i++)
{
- GinScanKey key = so->keys + i;
+ GinScanKey key = so->keys + i;
- for(j=0; j<key->nentries; j++)
+ for (j = 0; j < key->nentries; j++)
{
- OffsetNumber StopLow = pos->firstOffset,
- StopHigh = pos->lastOffset,
- StopMiddle;
- GinScanEntry entry = key->scanEntry + j;
+ OffsetNumber StopLow = pos->firstOffset,
+ StopHigh = pos->lastOffset,
+ StopMiddle;
+ GinScanEntry entry = key->scanEntry + j;
/* already true - do not extra work */
- if ( key->entryRes[j] )
+ if (key->entryRes[j])
continue;
/*
- * Interested tuples are from pos->firstOffset to pos->lastOffset
- * and they are ordered by (attnum, Datum) as it's done in entry tree
- * So we could use binary search to prevent linear scanning
+ * Interested tuples are from pos->firstOffset to
+ * pos->lastOffset and they are ordered by (attnum, Datum) as
+ * it's done in entry tree So we could use binary search to
+ * prevent linear scanning
*/
while (StopLow < StopHigh)
{
@@ -941,53 +945,53 @@ collectDatumForItem(IndexScanDesc scan, pendingPosition *pos)
StopLow = StopMiddle + 1;
else
{
- int res;
+ int res;
- if (datumExtracted[ StopMiddle-1 ] == false)
+ if (datumExtracted[StopMiddle - 1] == false)
{
- datum[ StopMiddle-1 ] = gin_index_getattr(&so->ginstate, itup);
- datumExtracted[ StopMiddle-1 ] = true;
+ datum[StopMiddle - 1] = gin_index_getattr(&so->ginstate, itup);
+ datumExtracted[StopMiddle - 1] = true;
}
- res = compareEntries(&so->ginstate,
- entry->attnum,
- entry->entry,
- datum[ StopMiddle-1 ]);
+ res = compareEntries(&so->ginstate,
+ entry->attnum,
+ entry->entry,
+ datum[StopMiddle - 1]);
- if ( res == 0 )
+ if (res == 0)
{
/*
- * The exact match causes, so we just scan from
- * current position to find a partial match.
- * See comment above about tuple's ordering.
+ * The exact match causes, so we just scan from
+ * current position to find a partial match. See
+ * comment above about tuple's ordering.
*/
- if ( entry->isPartialMatch )
+ if (entry->isPartialMatch)
key->entryRes[j] =
matchPartialInPendingList(&so->ginstate,
- page, StopMiddle,
+ page, StopMiddle,
pos->lastOffset,
entry->entry,
entry->attnum,
datum,
datumExtracted,
entry->strategy,
- entry->extra_data);
+ entry->extra_data);
else
key->entryRes[j] = true;
break;
}
- else if ( res < 0 )
+ else if (res < 0)
StopHigh = StopMiddle;
else
StopLow = StopMiddle + 1;
}
}
- if ( StopLow>=StopHigh && entry->isPartialMatch )
+ if (StopLow >= StopHigh && entry->isPartialMatch)
{
- /*
- * The exact match wasn't found, so we need to start
- * scan from first tuple greater then current entry
- * See comment above about tuple's ordering.
+ /*
+ * The exact match wasn't found, so we need to start scan
+ * from first tuple greater then current entry See comment
+ * above about tuple's ordering.
*/
key->entryRes[j] =
matchPartialInPendingList(&so->ginstate,
@@ -1007,7 +1011,7 @@ collectDatumForItem(IndexScanDesc scan, pendingPosition *pos)
pos->firstOffset = pos->lastOffset;
- if ( GinPageHasFullRow(page) )
+ if (GinPageHasFullRow(page))
{
/*
* We scan all values from one tuple, go to next one
@@ -1020,12 +1024,13 @@ collectDatumForItem(IndexScanDesc scan, pendingPosition *pos)
ItemPointerData item = pos->item;
/*
- * need to get next portion of tuples of row containing
- * on several pages
+ * need to get next portion of tuples of row containing on several
+ * pages
*/
- if ( scanGetCandidate(scan, pos) == false || !ItemPointerEquals(&pos->item, &item) )
- elog(ERROR,"Could not process tuple"); /* XXX should not be here ! */
+ if (scanGetCandidate(scan, pos) == false || !ItemPointerEquals(&pos->item, &item))
+ elog(ERROR, "Could not process tuple"); /* XXX should not be
+ * here ! */
}
}
@@ -1039,12 +1044,14 @@ static void
scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids)
{
GinScanOpaque so = (GinScanOpaque) scan->opaque;
- MemoryContext oldCtx;
- bool recheck, keyrecheck, match;
- int i;
- pendingPosition pos;
- Buffer metabuffer = ReadBuffer(scan->indexRelation, GIN_METAPAGE_BLKNO);
- BlockNumber blkno;
+ MemoryContext oldCtx;
+ bool recheck,
+ keyrecheck,
+ match;
+ int i;
+ pendingPosition pos;
+ Buffer metabuffer = ReadBuffer(scan->indexRelation, GIN_METAPAGE_BLKNO);
+ BlockNumber blkno;
*ntids = 0;
@@ -1052,39 +1059,38 @@ scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids)
blkno = GinPageGetMeta(BufferGetPage(metabuffer))->head;
/*
- * fetch head of list before unlocking metapage.
- * head page must be pinned to prevent deletion by vacuum process
+ * fetch head of list before unlocking metapage. head page must be pinned
+ * to prevent deletion by vacuum process
*/
- if ( blkno == InvalidBlockNumber )
+ if (blkno == InvalidBlockNumber)
{
/* No pending list, so proceed with normal scan */
- UnlockReleaseBuffer( metabuffer );
+ UnlockReleaseBuffer(metabuffer);
return;
}
pos.pendingBuffer = ReadBuffer(scan->indexRelation, blkno);
LockBuffer(pos.pendingBuffer, GIN_SHARE);
pos.firstOffset = FirstOffsetNumber;
- UnlockReleaseBuffer( metabuffer );
+ UnlockReleaseBuffer(metabuffer);
/*
- * loop for each heap row. scanGetCandidate returns full row
- * or row's tuples from first page.
+ * loop for each heap row. scanGetCandidate returns full row or row's
+ * tuples from first page.
*/
- while( scanGetCandidate(scan, &pos) )
+ while (scanGetCandidate(scan, &pos))
{
-
/*
- * Check entries in tuple and setup entryRes array
- * If tuples of heap's row are placed on several pages
- * collectDatumForItem will read all of that pages.
+ * Check entries in tuple and setup entryRes array If tuples of heap's
+ * row are placed on several pages collectDatumForItem will read all
+ * of that pages.
*/
if (!collectDatumForItem(scan, &pos))
continue;
/*
- * Matching of entries of one row is finished,
- * so check row by consistent function.
+ * Matching of entries of one row is finished, so check row by
+ * consistent function.
*/
oldCtx = MemoryContextSwitchTo(so->tempCtx);
recheck = false;
@@ -1092,11 +1098,11 @@ scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids)
for (i = 0; i < so->nkeys; i++)
{
- GinScanKey key = so->keys + i;
+ GinScanKey key = so->keys + i;
keyrecheck = true;
- if (!DatumGetBool(FunctionCall6(&so->ginstate.consistentFn[key->attnum-1],
+ if (!DatumGetBool(FunctionCall6(&so->ginstate.consistentFn[key->attnum - 1],
PointerGetDatum(key->entryRes),
UInt16GetDatum(key->strategy),
key->query,
@@ -1114,7 +1120,7 @@ scanPendingInsert(IndexScanDesc scan, TIDBitmap *tbm, int64 *ntids)
MemoryContextSwitchTo(oldCtx);
MemoryContextReset(so->tempCtx);
- if ( match )
+ if (match)
{
tbm_add_tuples(tbm, &pos.item, 1, recheck);
(*ntids)++;
@@ -1137,10 +1143,10 @@ scanGetItem(IndexScanDesc scan, ItemPointerData *item, bool *recheck)
* We return recheck = true if any of the keyGetItem calls return
* keyrecheck = true. Note that because the second loop might advance
* some keys, this could theoretically be too conservative. In practice
- * though, we expect that a consistentFn's recheck result will depend
- * only on the operator and the query, so for any one key it should
- * stay the same regardless of advancing to new items. So it's not
- * worth working harder.
+ * though, we expect that a consistentFn's recheck result will depend only
+ * on the operator and the query, so for any one key it should stay the
+ * same regardless of advancing to new items. So it's not worth working
+ * harder.
*/
*recheck = false;
@@ -1165,13 +1171,13 @@ scanGetItem(IndexScanDesc scan, ItemPointerData *item, bool *recheck)
{
int cmp = compareItemPointers(item, &key->curItem);
- if ( cmp != 0 && (ItemPointerIsLossyPage(item) || ItemPointerIsLossyPage(&key->curItem)) )
+ if (cmp != 0 && (ItemPointerIsLossyPage(item) || ItemPointerIsLossyPage(&key->curItem)))
{
/*
* if one of ItemPointers points to the whole page then
* compare only page's number
*/
- if ( ItemPointerGetBlockNumber(item) == ItemPointerGetBlockNumber(&key->curItem) )
+ if (ItemPointerGetBlockNumber(item) == ItemPointerGetBlockNumber(&key->curItem))
cmp = 0;
else
cmp = (ItemPointerGetBlockNumber(item) > ItemPointerGetBlockNumber(&key->curItem)) ? 1 : -1;
@@ -1205,7 +1211,7 @@ Datum
gingetbitmap(PG_FUNCTION_ARGS)
{
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
- TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
+ TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
int64 ntids;
if (GinIsNewKey(scan))
@@ -1217,15 +1223,14 @@ gingetbitmap(PG_FUNCTION_ARGS)
ntids = 0;
/*
- * First, scan the pending list and collect any matching entries into
- * the bitmap. After we scan a pending item, some other backend could
- * post it into the main index, and so we might visit it a second time
- * during the main scan. This is okay because we'll just re-set the
- * same bit in the bitmap. (The possibility of duplicate visits is a
- * major reason why GIN can't support the amgettuple API, however.)
- * Note that it would not do to scan the main index before the pending
- * list, since concurrent cleanup could then make us miss entries
- * entirely.
+ * First, scan the pending list and collect any matching entries into the
+ * bitmap. After we scan a pending item, some other backend could post it
+ * into the main index, and so we might visit it a second time during the
+ * main scan. This is okay because we'll just re-set the same bit in the
+ * bitmap. (The possibility of duplicate visits is a major reason why GIN
+ * can't support the amgettuple API, however.) Note that it would not do
+ * to scan the main index before the pending list, since concurrent
+ * cleanup could then make us miss entries entirely.
*/
scanPendingInsert(scan, tbm, &ntids);
@@ -1244,7 +1249,7 @@ gingetbitmap(PG_FUNCTION_ARGS)
if (!scanGetItem(scan, &iptr, &recheck))
break;
- if ( ItemPointerIsLossyPage(&iptr) )
+ if (ItemPointerIsLossyPage(&iptr))
tbm_add_page(tbm, ItemPointerGetBlockNumber(&iptr));
else
tbm_add_tuples(tbm, &iptr, 1, recheck);
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index ef3d4bbb03..2adaed43d4 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.21 2009/06/06 02:39:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.22 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -100,15 +100,15 @@ static IndexTuple
addItemPointersToTuple(Relation index, GinState *ginstate, GinBtreeStack *stack,
IndexTuple old, ItemPointerData *items, uint32 nitem, bool isBuild)
{
- Datum key = gin_index_getattr(ginstate, old);
- OffsetNumber attnum = gintuple_get_attrnum(ginstate, old);
- IndexTuple res = GinFormTuple(ginstate, attnum, key,
- NULL, nitem + GinGetNPosting(old));
+ Datum key = gin_index_getattr(ginstate, old);
+ OffsetNumber attnum = gintuple_get_attrnum(ginstate, old);
+ IndexTuple res = GinFormTuple(ginstate, attnum, key,
+ NULL, nitem + GinGetNPosting(old));
if (res)
{
/* good, small enough */
- uint32 newnitem;
+ uint32 newnitem;
newnitem = MergeItemPointers(GinGetPosting(res),
GinGetPosting(old), GinGetNPosting(old),
@@ -236,15 +236,15 @@ ginBuildCallback(Relation index, HeapTuple htup, Datum *values,
{
GinBuildState *buildstate = (GinBuildState *) state;
MemoryContext oldCtx;
- int i;
+ int i;
oldCtx = MemoryContextSwitchTo(buildstate->tmpCtx);
- for(i=0; i<buildstate->ginstate.origTupdesc->natts;i++)
- if ( !isnull[i] )
- buildstate->indtuples += ginHeapTupleBulkInsert(buildstate,
- (OffsetNumber)(i+1), values[i],
- &htup->t_self);
+ for (i = 0; i < buildstate->ginstate.origTupdesc->natts; i++)
+ if (!isnull[i])
+ buildstate->indtuples += ginHeapTupleBulkInsert(buildstate,
+ (OffsetNumber) (i + 1), values[i],
+ &htup->t_self);
/* If we've maxed out our available memory, dump everything to the index */
/* Also dump if the tree seems to be getting too unbalanced */
@@ -254,7 +254,7 @@ ginBuildCallback(Relation index, HeapTuple htup, Datum *values,
ItemPointerData *list;
Datum entry;
uint32 nlist;
- OffsetNumber attnum;
+ OffsetNumber attnum;
while ((list = ginGetEntry(&buildstate->accum, &attnum, &entry, &nlist)) != NULL)
{
@@ -279,7 +279,8 @@ ginbuild(PG_FUNCTION_ARGS)
IndexBuildResult *result;
double reltuples;
GinBuildState buildstate;
- Buffer RootBuffer, MetaBuffer;
+ Buffer RootBuffer,
+ MetaBuffer;
ItemPointerData *list;
Datum entry;
uint32 nlist;
@@ -316,7 +317,7 @@ ginbuild(PG_FUNCTION_ARGS)
rdata.next = NULL;
recptr = XLogInsert(RM_GIN_ID, XLOG_GIN_CREATE_INDEX, &rdata);
-
+
page = BufferGetPage(RootBuffer);
PageSetLSN(page, recptr);
PageSetTLI(page, ThisTimeLineID);
@@ -420,7 +421,7 @@ gininsert(PG_FUNCTION_ARGS)
MemoryContext oldCtx;
MemoryContext insertCtx;
uint32 res = 0;
- int i;
+ int i;
insertCtx = AllocSetContextCreate(CurrentMemoryContext,
"Gin insert temporary context",
@@ -432,24 +433,24 @@ gininsert(PG_FUNCTION_ARGS)
initGinState(&ginstate, index);
- if ( GinGetUseFastUpdate(index) )
+ if (GinGetUseFastUpdate(index))
{
- GinTupleCollector collector;
+ GinTupleCollector collector;
memset(&collector, 0, sizeof(GinTupleCollector));
- for(i=0; i<ginstate.origTupdesc->natts;i++)
- if ( !isnull[i] )
+ for (i = 0; i < ginstate.origTupdesc->natts; i++)
+ if (!isnull[i])
res += ginHeapTupleFastCollect(index, &ginstate, &collector,
- (OffsetNumber)(i+1), values[i], ht_ctid);
+ (OffsetNumber) (i + 1), values[i], ht_ctid);
ginHeapTupleFastInsert(index, &ginstate, &collector);
}
else
{
- for(i=0; i<ginstate.origTupdesc->natts;i++)
- if ( !isnull[i] )
- res += ginHeapTupleInsert(index, &ginstate,
- (OffsetNumber)(i+1), values[i], ht_ctid);
+ for (i = 0; i < ginstate.origTupdesc->natts; i++)
+ if (!isnull[i])
+ res += ginHeapTupleInsert(index, &ginstate,
+ (OffsetNumber) (i + 1), values[i], ht_ctid);
}
diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c
index a3d1135708..bda97033ad 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.23 2009/04/05 11:32:01 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginscan.c,v 1.24 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -37,7 +37,7 @@ ginbeginscan(PG_FUNCTION_ARGS)
static void
fillScanKey(GinState *ginstate, GinScanKey key, OffsetNumber attnum, Datum query,
- Datum *entryValues, bool *partial_matches, uint32 nEntryValues,
+ Datum *entryValues, bool *partial_matches, uint32 nEntryValues,
StrategyNumber strategy, Pointer *extra_data)
{
uint32 i,
@@ -68,8 +68,8 @@ fillScanKey(GinState *ginstate, GinScanKey key, OffsetNumber attnum, Datum query
key->scanEntry[i].strategy = strategy;
key->scanEntry[i].list = NULL;
key->scanEntry[i].nlist = 0;
- key->scanEntry[i].isPartialMatch = ( ginstate->canPartialMatch[attnum - 1] && partial_matches )
- ? partial_matches[i] : false;
+ key->scanEntry[i].isPartialMatch = (ginstate->canPartialMatch[attnum - 1] && partial_matches)
+ ? partial_matches[i] : false;
/* link to the equals entry in current scan key */
key->scanEntry[i].master = NULL;
@@ -172,12 +172,12 @@ newScanKey(IndexScanDesc scan)
ScanKey skey = &scankey[i];
Datum *entryValues;
int32 nEntryValues = 0;
- bool *partial_matches = NULL;
- Pointer *extra_data = NULL;
+ bool *partial_matches = NULL;
+ Pointer *extra_data = NULL;
/*
- * Assume, that GIN-indexable operators are strict, so
- * nothing could be found
+ * Assume, that GIN-indexable operators are strict, so nothing could
+ * be found
*/
if (skey->sk_flags & SK_ISNULL)
{
@@ -196,8 +196,8 @@ newScanKey(IndexScanDesc scan)
if (nEntryValues < 0)
{
/*
- * extractQueryFn signals that nothing can match, so we can
- * just set isVoidRes flag. No need to examine any more keys.
+ * extractQueryFn signals that nothing can match, so we can just
+ * set isVoidRes flag. No need to examine any more keys.
*/
so->isVoidRes = true;
break;
@@ -206,10 +206,10 @@ newScanKey(IndexScanDesc scan)
if (entryValues == NULL || nEntryValues == 0)
{
/*
- * extractQueryFn signals that everything matches. This would
- * require a full scan, which we can't do, but perhaps there
- * is another scankey that provides a restriction to use. So
- * we keep going and check only at the end.
+ * extractQueryFn signals that everything matches. This would
+ * require a full scan, which we can't do, but perhaps there is
+ * another scankey that provides a restriction to use. So we keep
+ * going and check only at the end.
*/
continue;
}
diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c
index e0951a6a4f..3834ae3b56 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.21 2009/03/24 20:17:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.22 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -16,7 +16,7 @@
#include "access/genam.h"
#include "access/gin.h"
#include "access/reloptions.h"
-#include "catalog/pg_type.h"
+#include "catalog/pg_type.h"
#include "storage/bufmgr.h"
#include "storage/freespace.h"
#include "storage/indexfsm.h"
@@ -25,44 +25,44 @@
void
initGinState(GinState *state, Relation index)
{
- int i;
+ int i;
state->origTupdesc = index->rd_att;
state->oneCol = (index->rd_att->natts == 1) ? true : false;
- for(i=0;i<index->rd_att->natts;i++)
+ for (i = 0; i < index->rd_att->natts; i++)
{
- state->tupdesc[i] = CreateTemplateTupleDesc(2,false);
+ state->tupdesc[i] = CreateTemplateTupleDesc(2, false);
- TupleDescInitEntry( state->tupdesc[i], (AttrNumber) 1, NULL,
- INT2OID, -1, 0);
- TupleDescInitEntry( state->tupdesc[i], (AttrNumber) 2, NULL,
- index->rd_att->attrs[i]->atttypid,
- index->rd_att->attrs[i]->atttypmod,
- index->rd_att->attrs[i]->attndims
- );
+ TupleDescInitEntry(state->tupdesc[i], (AttrNumber) 1, NULL,
+ INT2OID, -1, 0);
+ TupleDescInitEntry(state->tupdesc[i], (AttrNumber) 2, NULL,
+ index->rd_att->attrs[i]->atttypid,
+ index->rd_att->attrs[i]->atttypmod,
+ index->rd_att->attrs[i]->attndims
+ );
fmgr_info_copy(&(state->compareFn[i]),
- index_getprocinfo(index, i+1, GIN_COMPARE_PROC),
- CurrentMemoryContext);
+ index_getprocinfo(index, i + 1, GIN_COMPARE_PROC),
+ CurrentMemoryContext);
fmgr_info_copy(&(state->extractValueFn[i]),
- index_getprocinfo(index, i+1, GIN_EXTRACTVALUE_PROC),
- CurrentMemoryContext);
+ index_getprocinfo(index, i + 1, GIN_EXTRACTVALUE_PROC),
+ CurrentMemoryContext);
fmgr_info_copy(&(state->extractQueryFn[i]),
- index_getprocinfo(index, i+1, GIN_EXTRACTQUERY_PROC),
- CurrentMemoryContext);
+ index_getprocinfo(index, i + 1, GIN_EXTRACTQUERY_PROC),
+ CurrentMemoryContext);
fmgr_info_copy(&(state->consistentFn[i]),
- index_getprocinfo(index, i+1, GIN_CONSISTENT_PROC),
- CurrentMemoryContext);
+ index_getprocinfo(index, i + 1, GIN_CONSISTENT_PROC),
+ CurrentMemoryContext);
/*
* Check opclass capability to do partial match.
*/
- if ( index_getprocid(index, i+1, GIN_COMPARE_PARTIAL_PROC) != InvalidOid )
+ if (index_getprocid(index, i + 1, GIN_COMPARE_PARTIAL_PROC) != InvalidOid)
{
fmgr_info_copy(&(state->comparePartialFn[i]),
- index_getprocinfo(index, i+1, GIN_COMPARE_PARTIAL_PROC),
+ index_getprocinfo(index, i + 1, GIN_COMPARE_PARTIAL_PROC),
CurrentMemoryContext);
state->canPartialMatch[i] = true;
@@ -82,21 +82,21 @@ gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple)
{
OffsetNumber colN = FirstOffsetNumber;
- if ( !ginstate->oneCol )
+ if (!ginstate->oneCol)
{
- Datum res;
- bool isnull;
+ Datum res;
+ bool isnull;
/*
- * First attribute is always int16, so we can safely use any
- * tuple descriptor to obtain first attribute of tuple
+ * First attribute is always int16, so we can safely use any tuple
+ * descriptor to obtain first attribute of tuple
*/
res = index_getattr(tuple, FirstOffsetNumber, ginstate->tupdesc[0],
&isnull);
Assert(!isnull);
colN = DatumGetUInt16(res);
- Assert( colN >= FirstOffsetNumber && colN <= ginstate->origTupdesc->natts );
+ Assert(colN >= FirstOffsetNumber && colN <= ginstate->origTupdesc->natts);
}
return colN;
@@ -108,10 +108,10 @@ gintuple_get_attrnum(GinState *ginstate, IndexTuple tuple)
Datum
gin_index_getattr(GinState *ginstate, IndexTuple tuple)
{
- bool isnull;
- Datum res;
+ bool isnull;
+ Datum res;
- if ( ginstate->oneCol )
+ if (ginstate->oneCol)
{
/*
* Single column index doesn't store attribute numbers in tuples
@@ -122,8 +122,8 @@ gin_index_getattr(GinState *ginstate, IndexTuple tuple)
else
{
/*
- * Since the datum type depends on which index column it's from,
- * we must be careful to use the right tuple descriptor here.
+ * Since the datum type depends on which index column it's from, we
+ * must be careful to use the right tuple descriptor here.
*/
OffsetNumber colN = gintuple_get_attrnum(ginstate, tuple);
@@ -216,8 +216,8 @@ GinInitBuffer(Buffer b, uint32 f)
void
GinInitMetabuffer(Buffer b)
{
- GinMetaPageData *metadata;
- Page page = BufferGetPage(b);
+ GinMetaPageData *metadata;
+ Page page = BufferGetPage(b);
GinInitPage(page, GIN_META, BufferGetPageSize(b));
@@ -234,7 +234,7 @@ compareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, Datum b)
{
return DatumGetInt32(
FunctionCall2(
- &ginstate->compareFn[attnum-1],
+ &ginstate->compareFn[attnum - 1],
a, b
)
);
@@ -242,12 +242,12 @@ compareEntries(GinState *ginstate, OffsetNumber attnum, Datum a, Datum b)
int
compareAttEntries(GinState *ginstate, OffsetNumber attnum_a, Datum a,
- OffsetNumber attnum_b, Datum b)
+ OffsetNumber attnum_b, Datum b)
{
- if ( attnum_a == attnum_b )
- return compareEntries( ginstate, attnum_a, a, b);
+ if (attnum_a == attnum_b)
+ return compareEntries(ginstate, attnum_a, a, b);
- return ( attnum_a < attnum_b ) ? -1 : 1;
+ return (attnum_a < attnum_b) ? -1 : 1;
}
typedef struct
@@ -275,7 +275,7 @@ extractEntriesS(GinState *ginstate, OffsetNumber attnum, Datum value, int32 *nen
Datum *entries;
entries = (Datum *) DatumGetPointer(FunctionCall2(
- &ginstate->extractValueFn[attnum-1],
+ &ginstate->extractValueFn[attnum - 1],
value,
PointerGetDatum(nentries)
));
@@ -288,7 +288,7 @@ extractEntriesS(GinState *ginstate, OffsetNumber attnum, Datum value, int32 *nen
{
cmpEntriesData arg;
- arg.cmpDatumFunc = &ginstate->compareFn[attnum-1];
+ arg.cmpDatumFunc = &ginstate->compareFn[attnum - 1];
arg.needUnique = needUnique;
qsort_arg(entries, *nentries, sizeof(Datum),
(qsort_arg_comparator) cmpEntries, (void *) &arg);
@@ -348,7 +348,7 @@ ginoptions(PG_FUNCTION_ARGS)
rdopts = allocateReloptStruct(sizeof(GinOptions), options, numoptions);
fillRelOptions((void *) rdopts, sizeof(GinOptions), options, numoptions,
- validate, tab, lengthof(tab));
+ validate, tab, lengthof(tab));
pfree(options);
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c
index 934bf7c362..7f2ff9896f 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.29 2009/06/06 22:13:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.30 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
@@ -533,8 +533,8 @@ ginVacuumEntryPage(GinVacuumState *gvs, Buffer buffer, BlockNumber *roots, uint3
if (GinGetNPosting(itup) != newN)
{
- Datum value;
- OffsetNumber attnum;
+ Datum value;
+ OffsetNumber attnum;
/*
* Some ItemPointers was deleted, so we should remake our
@@ -724,9 +724,9 @@ ginvacuumcleanup(PG_FUNCTION_ARGS)
PG_RETURN_POINTER(stats);
}
- /*
- * Set up all-zero stats and cleanup pending inserts
- * if ginbulkdelete wasn't called
+ /*
+ * Set up all-zero stats and cleanup pending inserts if ginbulkdelete
+ * wasn't called
*/
if (stats == NULL)
{
@@ -758,7 +758,7 @@ ginvacuumcleanup(PG_FUNCTION_ARGS)
if (needLock)
UnlockRelationForExtension(index, ExclusiveLock);
- totFreePages = 0;
+ totFreePages = 0;
for (blkno = GIN_ROOT_BLKNO + 1; blkno < npages; blkno++)
{
diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c
index 03cdc1129c..1f008b727f 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.18 2009/03/24 20:17:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gin/ginxlog.c,v 1.19 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
#include "postgres.h"
@@ -71,7 +71,8 @@ static void
ginRedoCreateIndex(XLogRecPtr lsn, XLogRecord *record)
{
RelFileNode *node = (RelFileNode *) XLogRecGetData(record);
- Buffer RootBuffer, MetaBuffer;
+ Buffer RootBuffer,
+ MetaBuffer;
Page page;
MetaBuffer = XLogReadBuffer(*node, GIN_METAPAGE_BLKNO, true);
@@ -446,7 +447,7 @@ ginRedoDeletePage(XLogRecPtr lsn, XLogRecord *record)
static void
ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
{
- ginxlogUpdateMeta *data = (ginxlogUpdateMeta*) XLogRecGetData(record);
+ ginxlogUpdateMeta *data = (ginxlogUpdateMeta *) XLogRecGetData(record);
Buffer metabuffer;
Page metapage;
@@ -455,39 +456,41 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
if (!XLByteLE(lsn, PageGetLSN(metapage)))
{
- memcpy( GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
+ memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
PageSetLSN(metapage, lsn);
PageSetTLI(metapage, ThisTimeLineID);
MarkBufferDirty(metabuffer);
}
- if ( data->ntuples > 0 )
+ if (data->ntuples > 0)
{
/*
* insert into tail page
*/
if (!(record->xl_info & XLR_BKP_BLOCK_1))
{
- Buffer buffer = XLogReadBuffer(data->node, data->metadata.tail, false);
- Page page = BufferGetPage(buffer);
+ Buffer buffer = XLogReadBuffer(data->node, data->metadata.tail, false);
+ Page page = BufferGetPage(buffer);
- if ( !XLByteLE(lsn, PageGetLSN(page)))
+ if (!XLByteLE(lsn, PageGetLSN(page)))
{
- OffsetNumber l, off = (PageIsEmpty(page)) ? FirstOffsetNumber :
- OffsetNumberNext(PageGetMaxOffsetNumber(page));
- int i, tupsize;
- IndexTuple tuples = (IndexTuple) (XLogRecGetData(record) + sizeof(ginxlogUpdateMeta));
-
- for(i=0; i<data->ntuples; i++)
+ OffsetNumber l,
+ off = (PageIsEmpty(page)) ? FirstOffsetNumber :
+ OffsetNumberNext(PageGetMaxOffsetNumber(page));
+ int i,
+ tupsize;
+ IndexTuple tuples = (IndexTuple) (XLogRecGetData(record) + sizeof(ginxlogUpdateMeta));
+
+ for (i = 0; i < data->ntuples; i++)
{
tupsize = IndexTupleSize(tuples);
- l = PageAddItem(page, (Item)tuples, tupsize, off, false, false);
+ l = PageAddItem(page, (Item) tuples, tupsize, off, false, false);
if (l == InvalidOffsetNumber)
elog(ERROR, "failed to add item to index page");
- tuples = (IndexTuple)( ((char*)tuples) + tupsize );
+ tuples = (IndexTuple) (((char *) tuples) + tupsize);
}
/*
@@ -502,16 +505,16 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
UnlockReleaseBuffer(buffer);
}
}
- else if ( data->prevTail != InvalidBlockNumber )
+ else if (data->prevTail != InvalidBlockNumber)
{
/*
* New tail
*/
- Buffer buffer = XLogReadBuffer(data->node, data->prevTail, false);
- Page page = BufferGetPage(buffer);
+ Buffer buffer = XLogReadBuffer(data->node, data->prevTail, false);
+ Page page = BufferGetPage(buffer);
- if ( !XLByteLE(lsn, PageGetLSN(page)))
+ if (!XLByteLE(lsn, PageGetLSN(page)))
{
GinPageGetOpaque(page)->rightlink = data->newRightlink;
@@ -528,12 +531,14 @@ ginRedoUpdateMetapage(XLogRecPtr lsn, XLogRecord *record)
static void
ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record)
{
- ginxlogInsertListPage *data = (ginxlogInsertListPage*) XLogRecGetData(record);
- Buffer buffer;
- Page page;
- OffsetNumber l, off = FirstOffsetNumber;
- int i, tupsize;
- IndexTuple tuples = (IndexTuple) (XLogRecGetData(record) + sizeof(ginxlogInsertListPage));
+ ginxlogInsertListPage *data = (ginxlogInsertListPage *) XLogRecGetData(record);
+ Buffer buffer;
+ Page page;
+ OffsetNumber l,
+ off = FirstOffsetNumber;
+ int i,
+ tupsize;
+ IndexTuple tuples = (IndexTuple) (XLogRecGetData(record) + sizeof(ginxlogInsertListPage));
if (record->xl_info & XLR_BKP_BLOCK_1)
return;
@@ -543,7 +548,7 @@ ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record)
GinInitBuffer(buffer, GIN_LIST);
GinPageGetOpaque(page)->rightlink = data->rightlink;
- if ( data->rightlink == InvalidBlockNumber )
+ if (data->rightlink == InvalidBlockNumber)
{
/* tail of sublist */
GinPageSetFullRow(page);
@@ -554,16 +559,16 @@ ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record)
GinPageGetOpaque(page)->maxoff = 0;
}
- for(i=0; i<data->ntuples; i++)
+ for (i = 0; i < data->ntuples; i++)
{
tupsize = IndexTupleSize(tuples);
- l = PageAddItem(page, (Item)tuples, tupsize, off, false, false);
+ l = PageAddItem(page, (Item) tuples, tupsize, off, false, false);
if (l == InvalidOffsetNumber)
elog(ERROR, "failed to add item to index page");
- tuples = (IndexTuple)( ((char*)tuples) + tupsize );
+ tuples = (IndexTuple) (((char *) tuples) + tupsize);
}
PageSetLSN(page, lsn);
@@ -576,28 +581,28 @@ ginRedoInsertListPage(XLogRecPtr lsn, XLogRecord *record)
static void
ginRedoDeleteListPages(XLogRecPtr lsn, XLogRecord *record)
{
- ginxlogDeleteListPages *data = (ginxlogDeleteListPages*) XLogRecGetData(record);
+ ginxlogDeleteListPages *data = (ginxlogDeleteListPages *) XLogRecGetData(record);
Buffer metabuffer;
Page metapage;
- int i;
+ int i;
metabuffer = XLogReadBuffer(data->node, GIN_METAPAGE_BLKNO, false);
metapage = BufferGetPage(metabuffer);
if (!XLByteLE(lsn, PageGetLSN(metapage)))
{
- memcpy( GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
+ memcpy(GinPageGetMeta(metapage), &data->metadata, sizeof(GinMetaPageData));
PageSetLSN(metapage, lsn);
PageSetTLI(metapage, ThisTimeLineID);
MarkBufferDirty(metabuffer);
}
- for(i=0; i<data->ndeleted; i++)
+ for (i = 0; i < data->ndeleted; i++)
{
- Buffer buffer = XLogReadBuffer(data->node,data->toDelete[i],false);
- Page page = BufferGetPage(buffer);
+ Buffer buffer = XLogReadBuffer(data->node, data->toDelete[i], false);
+ Page page = BufferGetPage(buffer);
- if ( !XLByteLE(lsn, PageGetLSN(page)))
+ if (!XLByteLE(lsn, PageGetLSN(page)))
{
GinPageGetOpaque(page)->flags = GIN_DELETED;
@@ -645,7 +650,7 @@ gin_redo(XLogRecPtr lsn, XLogRecord *record)
case XLOG_GIN_INSERT_LISTPAGE:
ginRedoInsertListPage(lsn, record);
break;
- case XLOG_GIN_DELETE_LISTPAGE:
+ case XLOG_GIN_DELETE_LISTPAGE:
ginRedoDeleteListPages(lsn, record);
break;
default:
@@ -705,15 +710,15 @@ gin_desc(StringInfo buf, uint8 xl_info, char *rec)
break;
case XLOG_GIN_UPDATE_META_PAGE:
appendStringInfo(buf, "Update metapage, ");
- desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, ((ginxlogUpdateMeta *) rec)->metadata.tail);
+ desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, ((ginxlogUpdateMeta *) rec)->metadata.tail);
break;
case XLOG_GIN_INSERT_LISTPAGE:
appendStringInfo(buf, "Insert new list page, ");
- desc_node(buf, ((ginxlogInsertListPage *) rec)->node, ((ginxlogInsertListPage *) rec)->blkno);
+ desc_node(buf, ((ginxlogInsertListPage *) rec)->node, ((ginxlogInsertListPage *) rec)->blkno);
break;
case XLOG_GIN_DELETE_LISTPAGE:
appendStringInfo(buf, "Delete list pages (%d), ", ((ginxlogDeleteListPages *) rec)->ndeleted);
- desc_node(buf, ((ginxlogDeleteListPages *) rec)->node, ((ginxlogDeleteListPages *) rec)->metadata.head);
+ desc_node(buf, ((ginxlogDeleteListPages *) rec)->node, ((ginxlogDeleteListPages *) rec)->metadata.head);
break;
default:
elog(PANIC, "gin_desc: unknown op code %u", info);
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index 9701d30e38..e7ca8f6476 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.80 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.81 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -79,7 +79,7 @@ gistgettuple(PG_FUNCTION_ARGS)
so = (GISTScanOpaque) scan->opaque;
- if (dir != ForwardScanDirection)
+ if (dir != ForwardScanDirection)
elog(ERROR, "GiST doesn't support other scan directions than forward");
/*
@@ -101,8 +101,8 @@ Datum
gistgetbitmap(PG_FUNCTION_ARGS)
{
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
- TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
- int64 ntids;
+ TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
+ int64 ntids;
ntids = gistnext(scan, tbm);
@@ -136,10 +136,10 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
so = (GISTScanOpaque) scan->opaque;
- if ( so->qual_ok == false )
+ if (so->qual_ok == false)
return 0;
- if ( so->curbuf == InvalidBuffer )
+ if (so->curbuf == InvalidBuffer)
{
if (ItemPointerIsValid(&so->curpos) == false)
{
@@ -155,7 +155,7 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
stk->block = GIST_ROOT_BLKNO;
pgstat_count_index_scan(scan->indexRelation);
- }
+ }
else
{
/* scan is finished */
@@ -164,25 +164,25 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
}
/*
- * check stored pointers from last visit
+ * check stored pointers from last visit
*/
- if ( so->nPageData > 0 )
+ if (so->nPageData > 0)
{
/*
* gistgetmulti never should go here
*/
- Assert( tbm == NULL );
+ Assert(tbm == NULL);
- if ( so->curPageData < so->nPageData )
+ if (so->curPageData < so->nPageData)
{
- scan->xs_ctup.t_self = so->pageData[ so->curPageData ].heapPtr;
- scan->xs_recheck = so->pageData[ so->curPageData ].recheck;
+ scan->xs_ctup.t_self = so->pageData[so->curPageData].heapPtr;
+ scan->xs_recheck = so->pageData[so->curPageData].recheck;
ItemPointerSet(&so->curpos,
- BufferGetBlockNumber(so->curbuf),
- so->pageData[ so->curPageData ].pageOffset);
+ BufferGetBlockNumber(so->curbuf),
+ so->pageData[so->curPageData].pageOffset);
- so->curPageData ++;
+ so->curPageData++;
return 1;
}
@@ -227,7 +227,7 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
if (!XLogRecPtrIsInvalid(so->stack->parentlsn) &&
XLByteLT(so->stack->parentlsn, opaque->nsn) &&
opaque->rightlink != InvalidBlockNumber /* sanity check */ &&
- (so->stack->next == NULL || so->stack->next->block != opaque->rightlink) /* check if already
+ (so->stack->next == NULL || so->stack->next->block != opaque->rightlink) /* check if already
added */ )
{
/* detect page split, follow right link to add pages */
@@ -272,12 +272,12 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
if (!OffsetNumberIsValid(n))
{
/*
- * If we was called from gistgettuple and current buffer contains
- * something matched then make a recursive call - it will return
- * ItemPointer from so->pageData. But we save buffer pinned to
- * support tuple's killing
+ * If we was called from gistgettuple and current buffer
+ * contains something matched then make a recursive call - it
+ * will return ItemPointer from so->pageData. But we save
+ * buffer pinned to support tuple's killing
*/
- if ( !tbm && so->nPageData > 0 )
+ if (!tbm && so->nPageData > 0)
{
LockBuffer(so->curbuf, GIST_UNLOCK);
return gistnext(scan, NULL);
@@ -324,12 +324,12 @@ gistnext(IndexScanDesc scan, TIDBitmap *tbm)
ntids++;
if (tbm != NULL)
tbm_add_tuples(tbm, &it->t_tid, 1, scan->xs_recheck);
- else
+ else
{
- so->pageData[ so->nPageData ].heapPtr = it->t_tid;
- so->pageData[ so->nPageData ].pageOffset = n;
- so->pageData[ so->nPageData ].recheck = scan->xs_recheck;
- so->nPageData ++;
+ so->pageData[so->nPageData].heapPtr = it->t_tid;
+ so->pageData[so->nPageData].pageOffset = n;
+ so->pageData[so->nPageData].recheck = scan->xs_recheck;
+ so->nPageData++;
}
}
}
@@ -437,8 +437,8 @@ gistindex_keytest(IndexTuple tuple,
/*
* Call the Consistent function to evaluate the test. The
* arguments are the index datum (as a GISTENTRY*), the comparison
- * datum, the comparison operator's strategy number and
- * subtype from pg_amop, and the recheck flag.
+ * datum, the comparison operator's strategy number and subtype
+ * from pg_amop, and the recheck flag.
*
* (Presently there's no need to pass the subtype since it'll
* always be zero, but might as well pass it for possible future
diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c
index 396b93ab97..ef44380e77 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.16 2009/04/06 14:27:27 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.17 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -86,6 +86,7 @@ gist_box_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
BOX *query = PG_GETARG_BOX_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
+
/* Oid subtype = PG_GETARG_OID(3); */
bool *recheck = (bool *) PG_GETARG_POINTER(4);
@@ -279,11 +280,11 @@ chooseLR(GIST_SPLITVEC *v,
static void
fallbackSplit(GistEntryVector *entryvec, GIST_SPLITVEC *v)
{
- OffsetNumber i,
- maxoff;
- BOX *unionL = NULL,
- *unionR = NULL;
- int nbytes;
+ OffsetNumber i,
+ maxoff;
+ BOX *unionL = NULL,
+ *unionR = NULL;
+ int nbytes;
maxoff = entryvec->n - 1;
@@ -294,7 +295,7 @@ fallbackSplit(GistEntryVector *entryvec, GIST_SPLITVEC *v)
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
{
- BOX * cur = DatumGetBoxP(entryvec->vector[i].key);
+ BOX *cur = DatumGetBoxP(entryvec->vector[i].key);
if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
{
@@ -767,6 +768,7 @@ gist_poly_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
POLYGON *query = PG_GETARG_POLYGON_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
+
/* Oid subtype = PG_GETARG_OID(3); */
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool result;
@@ -843,6 +845,7 @@ gist_circle_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
CIRCLE *query = PG_GETARG_CIRCLE_P(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
+
/* Oid subtype = PG_GETARG_OID(3); */
bool *recheck = (bool *) PG_GETARG_POINTER(4);
BOX bbox;
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c
index 68924332b7..aed3e95b4e 100644
--- a/src/backend/access/gist/gistscan.c
+++ b/src/backend/access/gist/gistscan.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.75 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.76 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -94,11 +94,13 @@ gistrescan(PG_FUNCTION_ARGS)
* Next, if any of keys is a NULL and that key is not marked with
* SK_SEARCHNULL then nothing can be found.
*/
- for (i = 0; i < scan->numberOfKeys; i++) {
+ for (i = 0; i < scan->numberOfKeys; i++)
+ {
scan->keyData[i].sk_func = so->giststate->consistentFn[scan->keyData[i].sk_attno - 1];
- if ( scan->keyData[i].sk_flags & SK_ISNULL ) {
- if ( (scan->keyData[i].sk_flags & SK_SEARCHNULL) == 0 )
+ if (scan->keyData[i].sk_flags & SK_ISNULL)
+ {
+ if ((scan->keyData[i].sk_flags & SK_SEARCHNULL) == 0)
so->qual_ok = false;
}
}
diff --git a/src/backend/access/gist/gistsplit.c b/src/backend/access/gist/gistsplit.c
index 0d11e7c9ab..c5e5f6f13a 100644
--- a/src/backend/access/gist/gistsplit.c
+++ b/src/backend/access/gist/gistsplit.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistsplit.c,v 1.9 2009/06/10 20:02:15 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistsplit.c,v 1.10 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -281,7 +281,7 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno, GIST_SPLITVEC
}
/*
- * Trivial picksplit implementaion. Function called only
+ * Trivial picksplit implementaion. Function called only
* if user-defined picksplit puts all keys to the one page.
* That is a bug of user-defined picksplit but we'd like
* to "fix" that.
@@ -289,10 +289,10 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno, GIST_SPLITVEC
static void
genericPickSplit(GISTSTATE *giststate, GistEntryVector *entryvec, GIST_SPLITVEC *v, int attno)
{
- OffsetNumber i,
- maxoff;
- int nbytes;
- GistEntryVector *evec;
+ OffsetNumber i,
+ maxoff;
+ int nbytes;
+ GistEntryVector *evec;
maxoff = entryvec->n - 1;
@@ -320,21 +320,21 @@ genericPickSplit(GISTSTATE *giststate, GistEntryVector *entryvec, GIST_SPLITVEC
* Form unions of each page
*/
- evec = palloc( sizeof(GISTENTRY) * entryvec->n + GEVHDRSZ );
+ evec = palloc(sizeof(GISTENTRY) * entryvec->n + GEVHDRSZ);
evec->n = v->spl_nleft;
- memcpy(evec->vector, entryvec->vector + FirstOffsetNumber,
- sizeof(GISTENTRY) * evec->n);
- v->spl_ldatum = FunctionCall2(&giststate->unionFn[attno],
- PointerGetDatum(evec),
- PointerGetDatum(&nbytes));
+ memcpy(evec->vector, entryvec->vector + FirstOffsetNumber,
+ sizeof(GISTENTRY) * evec->n);
+ v->spl_ldatum = FunctionCall2(&giststate->unionFn[attno],
+ PointerGetDatum(evec),
+ PointerGetDatum(&nbytes));
evec->n = v->spl_nright;
- memcpy(evec->vector, entryvec->vector + FirstOffsetNumber + v->spl_nleft,
- sizeof(GISTENTRY) * evec->n);
- v->spl_rdatum = FunctionCall2(&giststate->unionFn[attno],
- PointerGetDatum(evec),
- PointerGetDatum(&nbytes));
+ memcpy(evec->vector, entryvec->vector + FirstOffsetNumber + v->spl_nleft,
+ sizeof(GISTENTRY) * evec->n);
+ v->spl_rdatum = FunctionCall2(&giststate->unionFn[attno],
+ PointerGetDatum(evec),
+ PointerGetDatum(&nbytes));
}
/*
@@ -365,17 +365,17 @@ gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVec
PointerGetDatum(entryvec),
PointerGetDatum(sv));
- if ( sv->spl_nleft == 0 || sv->spl_nright == 0 )
+ if (sv->spl_nleft == 0 || sv->spl_nright == 0)
{
ereport(DEBUG1,
(errcode(ERRCODE_INTERNAL_ERROR),
- errmsg("picksplit method for %d column of index \"%s\" failed",
- attno+1, RelationGetRelationName(r)),
+ errmsg("picksplit method for %d column of index \"%s\" failed",
+ attno + 1, RelationGetRelationName(r)),
errhint("The index is not optimal. To optimize it, contact a developer, or try to use the column as the second one in the CREATE INDEX command.")));
/*
- * Reinit GIST_SPLITVEC. Although that fields are not used
- * by genericPickSplit(), let us set up it for further processing
+ * Reinit GIST_SPLITVEC. Although that fields are not used by
+ * genericPickSplit(), let us set up it for further processing
*/
sv->spl_ldatum_exists = (v->spl_lisnull[attno]) ? false : true;
sv->spl_rdatum_exists = (v->spl_risnull[attno]) ? false : true;
diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c
index fa1e3088ad..78eb378725 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.33 2009/01/05 17:14:28 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistutil.c,v 1.34 2009/06/11 14:48:53 momjian Exp $
*-------------------------------------------------------------------------
*/
#include "postgres.h"
@@ -43,7 +43,8 @@ gistfillbuffer(Page page, IndexTuple *itup, int len, OffsetNumber off)
for (i = 0; i < len; i++)
{
- Size sz = IndexTupleSize(itup[i]);
+ Size sz = IndexTupleSize(itup[i]);
+
l = PageAddItem(page, (Item) itup[i], sz, off, false, false);
if (l == InvalidOffsetNumber)
elog(ERROR, "failed to add item to GiST index page, item %d out of %d, size %d bytes",
diff --git a/src/backend/access/gist/gistvacuum.c b/src/backend/access/gist/gistvacuum.c
index 833e6c574e..975f9d8c56 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.44 2009/06/06 22:13:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.45 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -510,7 +510,7 @@ gistvacuumcleanup(PG_FUNCTION_ARGS)
Relation rel = info->index;
BlockNumber npages,
blkno;
- BlockNumber totFreePages;
+ BlockNumber totFreePages;
BlockNumber lastBlock = GIST_ROOT_BLKNO,
lastFilledBlock = GIST_ROOT_BLKNO;
bool needLock;
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index 4c1cd5ceda..49b6594f1e 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.111 2009/06/06 22:13:50 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.112 2009/06/11 14:48:53 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -52,7 +52,7 @@ hashbuild(PG_FUNCTION_ARGS)
Relation index = (Relation) PG_GETARG_POINTER(1);
IndexInfo *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
IndexBuildResult *result;
- BlockNumber relpages;
+ BlockNumber relpages;
double reltuples;
uint32 num_buckets;
HashBuildState buildstate;
@@ -76,12 +76,12 @@ hashbuild(PG_FUNCTION_ARGS)
* (assuming their hash codes are pretty random) there will be no locality
* of access to the index, and if the index is bigger than available RAM
* then we'll thrash horribly. To prevent that scenario, we can sort the
- * tuples by (expected) bucket number. However, such a sort is useless
+ * tuples by (expected) bucket number. However, such a sort is useless
* overhead when the index does fit in RAM. We choose to sort if the
* initial index size exceeds NBuffers.
*
- * NOTE: this test will need adjustment if a bucket is ever different
- * from one page.
+ * NOTE: this test will need adjustment if a bucket is ever different from
+ * one page.
*/
if (num_buckets >= (uint32) NBuffers)
buildstate.spool = _h_spoolinit(index, num_buckets);
@@ -285,7 +285,7 @@ Datum
hashgetbitmap(PG_FUNCTION_ARGS)
{
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
- TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
+ TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
HashScanOpaque so = (HashScanOpaque) scan->opaque;
bool res;
int64 ntids = 0;
@@ -294,7 +294,7 @@ hashgetbitmap(PG_FUNCTION_ARGS)
while (res)
{
- bool add_tuple;
+ bool add_tuple;
/*
* Skip killed tuples if asked to.
@@ -312,7 +312,7 @@ hashgetbitmap(PG_FUNCTION_ARGS)
add_tuple = true;
/* Save tuple ID, and continue scanning */
- if (add_tuple)
+ if (add_tuple)
{
/* Note we mark the tuple ID as requiring recheck */
tbm_add_tuples(tbm, &scan->xs_ctup.t_self, 1, true);
@@ -481,7 +481,7 @@ hashbulkdelete(PG_FUNCTION_ARGS)
* each bucket.
*/
metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_READ, LH_META_PAGE);
- metap = HashPageGetMeta(BufferGetPage(metabuf));
+ metap = HashPageGetMeta(BufferGetPage(metabuf));
orig_maxbucket = metap->hashm_maxbucket;
orig_ntuples = metap->hashm_ntuples;
memcpy(&local_metapage, metap, sizeof(local_metapage));
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c
index 4561a09481..3242e2713e 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.58 2009/02/09 21:18:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.59 2009/06/11 14:48:53 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -225,35 +225,35 @@ hashvarlena(PG_FUNCTION_ARGS)
* are sometimes the same for one pair and different for another pair.
* This was tested for:
* * pairs that differed by one bit, by two bits, in any combination
- * of top bits of (a,b,c), or in any combination of bottom bits of
- * (a,b,c).
+ * of top bits of (a,b,c), or in any combination of bottom bits of
+ * (a,b,c).
* * "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
- * the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
- * is commonly produced by subtraction) look like a single 1-bit
- * difference.
+ * the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
+ * is commonly produced by subtraction) look like a single 1-bit
+ * difference.
* * the base values were pseudorandom, all zero but one bit set, or
- * all zero plus a counter that starts at zero.
- *
+ * all zero plus a counter that starts at zero.
+ *
* This does not achieve avalanche. There are input bits of (a,b,c)
* that fail to affect some output bits of (a,b,c), especially of a. The
* most thoroughly mixed value is c, but it doesn't really even achieve
- * avalanche in c.
- *
+ * avalanche in c.
+ *
* This allows some parallelism. Read-after-writes are good at doubling
* the number of bits affected, so the goal of mixing pulls in the opposite
- * direction from the goal of parallelism. I did what I could. Rotates
+ * direction from the goal of parallelism. I did what I could. Rotates
* seem to cost as much as shifts on every machine I could lay my hands on,
* and rotates are much kinder to the top and bottom bits, so I used rotates.
*----------
*/
#define mix(a,b,c) \
{ \
- a -= c; a ^= rot(c, 4); c += b; \
- b -= a; b ^= rot(a, 6); a += c; \
- c -= b; c ^= rot(b, 8); b += a; \
- a -= c; a ^= rot(c,16); c += b; \
- b -= a; b ^= rot(a,19); a += c; \
- c -= b; c ^= rot(b, 4); b += a; \
+ a -= c; a ^= rot(c, 4); c += b; \
+ b -= a; b ^= rot(a, 6); a += c; \
+ c -= b; c ^= rot(b, 8); b += a; \
+ a -= c; a ^= rot(c,16); c += b; \
+ b -= a; b ^= rot(a,19); a += c; \
+ c -= b; c ^= rot(b, 4); b += a; \
}
/*----------
@@ -262,20 +262,20 @@ hashvarlena(PG_FUNCTION_ARGS)
* Pairs of (a,b,c) values differing in only a few bits will usually
* produce values of c that look totally different. This was tested for
* * pairs that differed by one bit, by two bits, in any combination
- * of top bits of (a,b,c), or in any combination of bottom bits of
- * (a,b,c).
+ * of top bits of (a,b,c), or in any combination of bottom bits of
+ * (a,b,c).
* * "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
- * the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
- * is commonly produced by subtraction) look like a single 1-bit
- * difference.
+ * the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
+ * is commonly produced by subtraction) look like a single 1-bit
+ * difference.
* * the base values were pseudorandom, all zero but one bit set, or
- * all zero plus a counter that starts at zero.
- *
+ * all zero plus a counter that starts at zero.
+ *
* The use of separate functions for mix() and final() allow for a
* substantial performance increase since final() does not need to
* do well in reverse, but is does need to affect all output bits.
* mix(), on the other hand, does not need to affect all output
- * bits (affecting 32 bits is enough). The original hash function had
+ * bits (affecting 32 bits is enough). The original hash function had
* a single mixing operation that had to satisfy both sets of requirements
* and was slower as a result.
*----------
@@ -374,9 +374,9 @@ hash_any(register const unsigned char *k, register int keylen)
/* fall through */
case 1:
a += ((uint32) k[0] << 24);
- /* case 0: nothing left to add */
+ /* case 0: nothing left to add */
}
-#else /* !WORDS_BIGENDIAN */
+#else /* !WORDS_BIGENDIAN */
switch (len)
{
case 11:
@@ -413,9 +413,9 @@ hash_any(register const unsigned char *k, register int keylen)
/* fall through */
case 1:
a += k[0];
- /* case 0: nothing left to add */
+ /* case 0: nothing left to add */
}
-#endif /* WORDS_BIGENDIAN */
+#endif /* WORDS_BIGENDIAN */
}
else
{
@@ -428,11 +428,11 @@ hash_any(register const unsigned char *k, register int keylen)
a += (k[3] + ((uint32) k[2] << 8) + ((uint32) k[1] << 16) + ((uint32) k[0] << 24));
b += (k[7] + ((uint32) k[6] << 8) + ((uint32) k[5] << 16) + ((uint32) k[4] << 24));
c += (k[11] + ((uint32) k[10] << 8) + ((uint32) k[9] << 16) + ((uint32) k[8] << 24));
-#else /* !WORDS_BIGENDIAN */
+#else /* !WORDS_BIGENDIAN */
a += (k[0] + ((uint32) k[1] << 8) + ((uint32) k[2] << 16) + ((uint32) k[3] << 24));
b += (k[4] + ((uint32) k[5] << 8) + ((uint32) k[6] << 16) + ((uint32) k[7] << 24));
c += (k[8] + ((uint32) k[9] << 8) + ((uint32) k[10] << 16) + ((uint32) k[11] << 24));
-#endif /* WORDS_BIGENDIAN */
+#endif /* WORDS_BIGENDIAN */
mix(a, b, c);
k += 12;
len -= 12;
@@ -465,9 +465,9 @@ hash_any(register const unsigned char *k, register int keylen)
a += ((uint32) k[1] << 16);
case 1:
a += ((uint32) k[0] << 24);
- /* case 0: nothing left to add */
+ /* case 0: nothing left to add */
}
-#else /* !WORDS_BIGENDIAN */
+#else /* !WORDS_BIGENDIAN */
switch (len) /* all the case statements fall through */
{
case 11:
@@ -493,9 +493,9 @@ hash_any(register const unsigned char *k, register int keylen)
a += ((uint32) k[1] << 8);
case 1:
a += k[0];
- /* case 0: nothing left to add */
+ /* case 0: nothing left to add */
}
-#endif /* WORDS_BIGENDIAN */
+#endif /* WORDS_BIGENDIAN */
}
final(a, b, c);
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c
index f47d213298..bd1f930e06 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.79 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.80 2009/06/11 14:48:53 momjian Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -361,8 +361,8 @@ _hash_metapinit(Relation rel, double num_tuples)
/*
* Choose the number of initial bucket pages to match the fill factor
* given the estimated number of tuples. We round up the result to the
- * next power of 2, however, and always force at least 2 bucket pages.
- * The upper limit is determined by considerations explained in
+ * next power of 2, however, and always force at least 2 bucket pages. The
+ * upper limit is determined by considerations explained in
* _hash_expandtable().
*/
dnumbuckets = num_tuples / ffactor;
@@ -421,8 +421,8 @@ _hash_metapinit(Relation rel, double num_tuples)
/*
* We initialize the index with N buckets, 0 .. N-1, occupying physical
- * blocks 1 to N. The first freespace bitmap page is in block N+1.
- * Since N is a power of 2, we can set the masks this way:
+ * blocks 1 to N. The first freespace bitmap page is in block N+1. Since
+ * N is a power of 2, we can set the masks this way:
*/
metap->hashm_maxbucket = metap->hashm_lowmask = num_buckets - 1;
metap->hashm_highmask = (num_buckets << 1) - 1;
@@ -438,8 +438,8 @@ _hash_metapinit(Relation rel, double num_tuples)
/*
* Release buffer lock on the metapage while we initialize buckets.
* Otherwise, we'll be in interrupt holdoff and the CHECK_FOR_INTERRUPTS
- * won't accomplish anything. It's a bad idea to hold buffer locks
- * for long intervals in any case, since that can block the bgwriter.
+ * won't accomplish anything. It's a bad idea to hold buffer locks for
+ * long intervals in any case, since that can block the bgwriter.
*/
_hash_chgbufaccess(rel, metabuf, HASH_WRITE, HASH_NOLOCK);
@@ -552,8 +552,8 @@ _hash_expandtable(Relation rel, Buffer metabuf)
* _hash_alloc_buckets() would fail, but if we supported buckets smaller
* than a disk block then this would be an independent constraint.
*
- * If you change this, see also the maximum initial number of buckets
- * in _hash_metapinit().
+ * If you change this, see also the maximum initial number of buckets in
+ * _hash_metapinit().
*/
if (metap->hashm_maxbucket >= (uint32) 0x7FFFFFFE)
goto fail;
@@ -839,8 +839,8 @@ _hash_splitbucket(Relation rel,
}
/*
- * Fetch the item's hash key (conveniently stored in the item)
- * and determine which bucket it now belongs in.
+ * Fetch the item's hash key (conveniently stored in the item) and
+ * determine which bucket it now belongs in.
*/
itup = (IndexTuple) PageGetItem(opage, PageGetItemId(opage, ooffnum));
bucket = _hash_hashkey2bucket(_hash_get_indextuple_hashkey(itup),
diff --git a/src/backend/access/hash/hashscan.c b/src/backend/access/hash/hashscan.c
index 8cd371e902..1b0ce2c739 100644
--- a/src/backend/access/hash/hashscan.c
+++ b/src/backend/access/hash/hashscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashscan.c,v 1.46 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashscan.c,v 1.47 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,8 +59,8 @@ ReleaseResources_hash(void)
/*
* Release all HashScanList items belonging to the current ResourceOwner.
* Note that we do not release the underlying IndexScanDesc; that's in
- * executor memory and will go away on its own (in fact quite possibly
- * has gone away already, so we mustn't try to touch it here).
+ * executor memory and will go away on its own (in fact quite possibly has
+ * gone away already, so we mustn't try to touch it here).
*
* Note: this should be a no-op during normal query shutdown. However, in
* an abort situation ExecutorEnd is not called and so there may be open
diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c
index 5a9763fe9a..fec2f5d78a 100644
--- a/src/backend/access/hash/hashsearch.c
+++ b/src/backend/access/hash/hashsearch.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.56 2009/05/05 19:36:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashsearch.c,v 1.57 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -312,15 +312,15 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
for (;;)
{
/*
- * check if we're still in the range of items with
- * the target hash key
+ * check if we're still in the range of items with the
+ * target hash key
*/
if (offnum <= maxoff)
{
Assert(offnum >= FirstOffsetNumber);
itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, offnum));
if (so->hashso_sk_hash == _hash_get_indextuple_hashkey(itup))
- break; /* yes, so exit for-loop */
+ break; /* yes, so exit for-loop */
}
/*
@@ -353,15 +353,15 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
for (;;)
{
/*
- * check if we're still in the range of items with
- * the target hash key
+ * check if we're still in the range of items with the
+ * target hash key
*/
if (offnum >= FirstOffsetNumber)
{
Assert(offnum <= maxoff);
itup = (IndexTuple) PageGetItem(page, PageGetItemId(page, offnum));
if (so->hashso_sk_hash == _hash_get_indextuple_hashkey(itup))
- break; /* yes, so exit for-loop */
+ break; /* yes, so exit for-loop */
}
/*
diff --git a/src/backend/access/hash/hashsort.c b/src/backend/access/hash/hashsort.c
index 6ba8362a9e..00e7dc5f5d 100644
--- a/src/backend/access/hash/hashsort.c
+++ b/src/backend/access/hash/hashsort.c
@@ -8,7 +8,7 @@
* thrashing. We use tuplesort.c to sort the given index tuples into order.
*
* Note: if the number of rows in the table has been underestimated,
- * bucket splits may occur during the index build. In that case we'd
+ * bucket splits may occur during the index build. In that case we'd
* be inserting into two or more buckets for each possible masked-off
* hash code value. That's no big problem though, since we'll still have
* plenty of locality of access.
@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashsort.c,v 1.2 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashsort.c,v 1.3 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,13 +52,13 @@ _h_spoolinit(Relation index, uint32 num_buckets)
hspool->index = index;
/*
- * Determine the bitmask for hash code values. Since there are currently
+ * Determine the bitmask for hash code values. Since there are currently
* num_buckets buckets in the index, the appropriate mask can be computed
* as follows.
*
- * Note: at present, the passed-in num_buckets is always a power of 2,
- * so we could just compute num_buckets - 1. We prefer not to assume
- * that here, though.
+ * Note: at present, the passed-in num_buckets is always a power of 2, so
+ * we could just compute num_buckets - 1. We prefer not to assume that
+ * here, though.
*/
hash_mask = (((uint32) 1) << _hash_log2(num_buckets)) - 1;
diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c
index 42e79376f8..ba1d6fbbf5 100644
--- a/src/backend/access/hash/hashutil.c
+++ b/src/backend/access/hash/hashutil.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.59 2009/01/05 17:14:28 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.60 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,10 +29,10 @@ bool
_hash_checkqual(IndexScanDesc scan, IndexTuple itup)
{
/*
- * Currently, we can't check any of the scan conditions since we do
- * not have the original index entry value to supply to the sk_func.
- * Always return true; we expect that hashgettuple already set the
- * recheck flag to make the main indexscan code do it.
+ * Currently, we can't check any of the scan conditions since we do not
+ * have the original index entry value to supply to the sk_func. Always
+ * return true; we expect that hashgettuple already set the recheck flag
+ * to make the main indexscan code do it.
*/
#ifdef NOT_USED
TupleDesc tupdesc = RelationGetDescr(scan->indexRelation);
@@ -240,8 +240,8 @@ _hash_get_indextuple_hashkey(IndexTuple itup)
char *attp;
/*
- * We assume the hash key is the first attribute and can't be null,
- * so this can be done crudely but very very cheaply ...
+ * We assume the hash key is the first attribute and can't be null, so
+ * this can be done crudely but very very cheaply ...
*/
attp = (char *) itup + IndexInfoFindDataOffset(itup->t_info);
return *((uint32 *) attp);
@@ -253,10 +253,10 @@ _hash_get_indextuple_hashkey(IndexTuple itup)
IndexTuple
_hash_form_tuple(Relation index, Datum *values, bool *isnull)
{
- IndexTuple itup;
- uint32 hashkey;
- Datum hashkeydatum;
- TupleDesc hashdesc;
+ IndexTuple itup;
+ uint32 hashkey;
+ Datum hashkeydatum;
+ TupleDesc hashdesc;
if (isnull[0])
hashkeydatum = (Datum) 0;
@@ -280,14 +280,14 @@ _hash_form_tuple(Relation index, Datum *values, bool *isnull)
*
* Returns the offset of the first index entry having hashkey >= hash_value,
* or the page's max offset plus one if hash_value is greater than all
- * existing hash keys in the page. This is the appropriate place to start
+ * existing hash keys in the page. This is the appropriate place to start
* a search, or to insert a new item.
*/
OffsetNumber
_hash_binsearch(Page page, uint32 hash_value)
{
- OffsetNumber upper;
- OffsetNumber lower;
+ OffsetNumber upper;
+ OffsetNumber lower;
/* Loop invariant: lower <= desired place <= upper */
upper = PageGetMaxOffsetNumber(page) + 1;
@@ -295,9 +295,9 @@ _hash_binsearch(Page page, uint32 hash_value)
while (upper > lower)
{
- OffsetNumber off;
- IndexTuple itup;
- uint32 hashkey;
+ OffsetNumber off;
+ IndexTuple itup;
+ uint32 hashkey;
off = (upper + lower) / 2;
Assert(OffsetNumberIsValid(off));
@@ -324,8 +324,8 @@ _hash_binsearch(Page page, uint32 hash_value)
OffsetNumber
_hash_binsearch_last(Page page, uint32 hash_value)
{
- OffsetNumber upper;
- OffsetNumber lower;
+ OffsetNumber upper;
+ OffsetNumber lower;
/* Loop invariant: lower <= desired place <= upper */
upper = PageGetMaxOffsetNumber(page);
@@ -333,9 +333,9 @@ _hash_binsearch_last(Page page, uint32 hash_value)
while (upper > lower)
{
- IndexTuple itup;
- OffsetNumber off;
- uint32 hashkey;
+ IndexTuple itup;
+ OffsetNumber off;
+ uint32 hashkey;
off = (upper + lower + 1) / 2;
Assert(OffsetNumberIsValid(off));
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 1f6edf6caf..2e45c041a6 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.276 2009/06/10 18:54:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.277 2009/06/11 14:48:53 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -69,7 +69,7 @@
/* GUC variable */
-bool synchronize_seqscans = true;
+bool synchronize_seqscans = true;
static HeapScanDesc heap_beginscan_internal(Relation relation,
@@ -116,9 +116,9 @@ initscan(HeapScanDesc scan, ScanKey key, bool is_rescan)
* 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.
- * (However, some callers need to be able to disable one or both of
- * these behaviors, independently of the size of the table; also there
- * is a GUC variable that can disable synchronized scanning.)
+ * (However, some callers need to be able to disable one or both of these
+ * behaviors, independently of the size of the table; also there is a GUC
+ * variable that can disable synchronized scanning.)
*
* During a rescan, don't make a new strategy object if we don't have to.
*/
@@ -146,8 +146,8 @@ initscan(HeapScanDesc scan, ScanKey key, bool is_rescan)
if (is_rescan)
{
/*
- * If rescan, keep the previous startblock setting so that rewinding
- * a cursor doesn't generate surprising results. Reset the syncscan
+ * If rescan, keep the previous startblock setting so that rewinding a
+ * cursor doesn't generate surprising results. Reset the syncscan
* setting, though.
*/
scan->rs_syncscan = (allow_sync && synchronize_seqscans);
@@ -1793,7 +1793,7 @@ void
FreeBulkInsertState(BulkInsertState bistate)
{
if (bistate->current_buf != InvalidBuffer)
- ReleaseBuffer(bistate->current_buf);
+ ReleaseBuffer(bistate->current_buf);
FreeAccessStrategy(bistate->strategy);
pfree(bistate);
}
@@ -1977,7 +1977,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
/* Clear the bit in the visibility map if necessary */
if (all_visible_cleared)
- visibilitymap_clear(relation,
+ visibilitymap_clear(relation,
ItemPointerGetBlockNumber(&(heaptup->t_self)));
/*
@@ -3437,8 +3437,8 @@ l3:
LockBuffer(*buffer, BUFFER_LOCK_UNLOCK);
/*
- * Don't update the visibility map here. Locking a tuple doesn't
- * change visibility info.
+ * Don't update the visibility map here. Locking a tuple doesn't change
+ * visibility info.
*/
/*
@@ -4115,11 +4115,11 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move)
nowunused, nunused,
clean_move);
- freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
+ freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
/*
- * Note: we don't worry about updating the page's prunability hints.
- * At worst this will cause an extra prune cycle to occur soon.
+ * Note: we don't worry about updating the page's prunability hints. At
+ * worst this will cause an extra prune cycle to occur soon.
*/
PageSetLSN(page, lsn);
@@ -4217,17 +4217,18 @@ heap_xlog_delete(XLogRecPtr lsn, XLogRecord *record)
OffsetNumber offnum;
ItemId lp = NULL;
HeapTupleHeader htup;
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = ItemPointerGetBlockNumber(&(xlrec->target.tid));
/*
- * The visibility map always needs to be updated, even if the heap page
- * is already up-to-date.
+ * The visibility map always needs to be updated, even if the heap page is
+ * already up-to-date.
*/
if (xlrec->all_visible_cleared)
{
- Relation reln = CreateFakeRelcacheEntry(xlrec->target.node);
+ Relation reln = CreateFakeRelcacheEntry(xlrec->target.node);
+
visibilitymap_clear(reln, blkno);
FreeFakeRelcacheEntry(reln);
}
@@ -4294,17 +4295,18 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record)
xl_heap_header xlhdr;
uint32 newlen;
Size freespace;
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = ItemPointerGetBlockNumber(&(xlrec->target.tid));
/*
- * The visibility map always needs to be updated, even if the heap page
- * is already up-to-date.
+ * The visibility map always needs to be updated, even if the heap page is
+ * already up-to-date.
*/
if (xlrec->all_visible_cleared)
{
- Relation reln = CreateFakeRelcacheEntry(xlrec->target.node);
+ Relation reln = CreateFakeRelcacheEntry(xlrec->target.node);
+
visibilitymap_clear(reln, blkno);
FreeFakeRelcacheEntry(reln);
}
@@ -4361,7 +4363,7 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record)
if (offnum == InvalidOffsetNumber)
elog(PANIC, "heap_insert_redo: failed to add tuple");
- freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
+ freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
@@ -4374,8 +4376,8 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record)
/*
* If the page is running low on free space, update the FSM as well.
- * Arbitrarily, our definition of "low" is less than 20%. We can't do
- * much better than that without knowing the fill-factor for the table.
+ * Arbitrarily, our definition of "low" is less than 20%. We can't do much
+ * better than that without knowing the fill-factor for the table.
*
* XXX: We don't get here if the page was restored from full page image.
* We don't bother to update the FSM in that case, it doesn't need to be
@@ -4410,12 +4412,13 @@ heap_xlog_update(XLogRecPtr lsn, XLogRecord *record, bool move, bool hot_update)
Size freespace;
/*
- * The visibility map always needs to be updated, even if the heap page
- * is already up-to-date.
+ * The visibility map always needs to be updated, even if the heap page is
+ * already up-to-date.
*/
if (xlrec->all_visible_cleared)
{
- Relation reln = CreateFakeRelcacheEntry(xlrec->target.node);
+ Relation reln = CreateFakeRelcacheEntry(xlrec->target.node);
+
visibilitymap_clear(reln,
ItemPointerGetBlockNumber(&xlrec->target.tid));
FreeFakeRelcacheEntry(reln);
@@ -4504,12 +4507,13 @@ heap_xlog_update(XLogRecPtr lsn, XLogRecord *record, bool move, bool hot_update)
newt:;
/*
- * The visibility map always needs to be updated, even if the heap page
- * is already up-to-date.
+ * The visibility map always needs to be updated, even if the heap page is
+ * already up-to-date.
*/
if (xlrec->new_all_visible_cleared)
{
- Relation reln = CreateFakeRelcacheEntry(xlrec->target.node);
+ Relation reln = CreateFakeRelcacheEntry(xlrec->target.node);
+
visibilitymap_clear(reln, ItemPointerGetBlockNumber(&xlrec->newtid));
FreeFakeRelcacheEntry(reln);
}
@@ -4595,7 +4599,7 @@ newsame:;
if (xlrec->new_all_visible_cleared)
PageClearAllVisible(page);
- freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
+ freespace = PageGetHeapFreeSpace(page); /* needed to update FSM below */
PageSetLSN(page, lsn);
PageSetTLI(page, ThisTimeLineID);
@@ -4604,8 +4608,8 @@ newsame:;
/*
* If the page is running low on free space, update the FSM as well.
- * Arbitrarily, our definition of "low" is less than 20%. We can't do
- * much better than that without knowing the fill-factor for the table.
+ * Arbitrarily, our definition of "low" is less than 20%. We can't do much
+ * better than that without knowing the fill-factor for the table.
*
* However, don't update the FSM on HOT updates, because after crash
* recovery, either the old or the new tuple will certainly be dead and
@@ -4619,7 +4623,7 @@ newsame:;
*/
if (!hot_update && freespace < BLCKSZ / 5)
XLogRecordPageWithFreeSpace(xlrec->target.node,
- ItemPointerGetBlockNumber(&(xlrec->newtid)), freespace);
+ ItemPointerGetBlockNumber(&(xlrec->newtid)), freespace);
}
static void
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index 1d70e6c01a..7ed8612357 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.75 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/hio.c,v 1.76 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,7 +64,7 @@ static Buffer
ReadBufferBI(Relation relation, BlockNumber targetBlock,
BulkInsertState bistate)
{
- Buffer buffer;
+ Buffer buffer;
/* If not bulk-insert, exactly like ReadBuffer */
if (!bistate)
@@ -118,7 +118,7 @@ ReadBufferBI(Relation relation, BlockNumber targetBlock,
* happen if space is freed in that page after heap_update finds there's not
* enough there). In that case, the page will be pinned and locked only once.
*
- * We normally use FSM to help us find free space. However,
+ * We normally use FSM to help us find free space. However,
* if HEAP_INSERT_SKIP_FSM is specified, we just append a new empty page to
* the end of the relation if the tuple won't fit on the current target page.
* This can save some cycles when we know the relation is new and doesn't
@@ -133,7 +133,7 @@ ReadBufferBI(Relation relation, BlockNumber targetBlock,
* for additional constraints needed for safe usage of this behavior.)
*
* The caller can also provide a BulkInsertState object to optimize many
- * insertions into the same relation. This keeps a pin on the current
+ * insertions into the same relation. This keeps a pin on the current
* insertion target page (to save pin/unpin cycles) and also passes a
* BULKWRITE buffer selection strategy object to the buffer manager.
* Passing NULL for bistate selects the default behavior.
@@ -186,7 +186,7 @@ RelationGetBufferForTuple(Relation relation, Size len,
/*
* We first try to put the tuple on the same page we last inserted a tuple
- * on, as cached in the BulkInsertState or relcache entry. If that
+ * on, as cached in the BulkInsertState or relcache entry. If that
* doesn't work, we ask the Free Space Map to locate a suitable page.
* Since the FSM's info might be out of date, we have to be prepared to
* loop around and retry multiple times. (To insure this isn't an infinite
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index 4b445c7ad8..71ea689d0e 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.17 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.18 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,7 @@
typedef struct
{
TransactionId new_prune_xid; /* new prune hint value for page */
- int nredirected; /* numbers of entries in arrays below */
+ int nredirected; /* numbers of entries in arrays below */
int ndead;
int nunused;
/* arrays that accumulate indexes of items to be changed */
@@ -159,21 +159,21 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
/*
* Our strategy is to scan the page and make lists of items to change,
- * then apply the changes within a critical section. This keeps as
- * much logic as possible out of the critical section, and also ensures
- * that WAL replay will work the same as the normal case.
+ * then apply the changes within a critical section. This keeps as much
+ * logic as possible out of the critical section, and also ensures that
+ * WAL replay will work the same as the normal case.
*
- * First, inform inval.c that upcoming CacheInvalidateHeapTuple calls
- * are nontransactional.
+ * First, inform inval.c that upcoming CacheInvalidateHeapTuple calls are
+ * nontransactional.
*/
if (redirect_move)
BeginNonTransactionalInvalidation();
/*
- * Initialize the new pd_prune_xid value to zero (indicating no
- * prunable tuples). If we find any tuples which may soon become
- * prunable, we will save the lowest relevant XID in new_prune_xid.
- * Also initialize the rest of our working state.
+ * Initialize the new pd_prune_xid value to zero (indicating no prunable
+ * tuples). If we find any tuples which may soon become prunable, we will
+ * save the lowest relevant XID in new_prune_xid. Also initialize the rest
+ * of our working state.
*/
prstate.new_prune_xid = InvalidTransactionId;
prstate.nredirected = prstate.ndead = prstate.nunused = 0;
@@ -204,9 +204,9 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
}
/*
- * Send invalidation messages for any tuples we are about to move.
- * It is safe to do this now, even though we could theoretically still
- * fail before making the actual page update, because a useless cache
+ * Send invalidation messages for any tuples we are about to move. It is
+ * safe to do this now, even though we could theoretically still fail
+ * before making the actual page update, because a useless cache
* invalidation doesn't hurt anything. Also, no one else can reload the
* tuples while we have exclusive buffer lock, so it's not too early to
* send the invals. This avoids sending the invals while inside the
@@ -222,9 +222,8 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
if (prstate.nredirected > 0 || prstate.ndead > 0 || prstate.nunused > 0)
{
/*
- * Apply the planned item changes, then repair page fragmentation,
- * and update the page's hint bit about whether it has free line
- * pointers.
+ * Apply the planned item changes, then repair page fragmentation, and
+ * update the page's hint bit about whether it has free line pointers.
*/
heap_page_prune_execute(buffer,
prstate.redirected, prstate.nredirected,
@@ -268,8 +267,8 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
{
/*
* If we didn't prune anything, but have found a new value for the
- * pd_prune_xid field, update it and mark the buffer dirty.
- * This is treated as a non-WAL-logged hint.
+ * pd_prune_xid field, update it and mark the buffer dirty. This is
+ * treated as a non-WAL-logged hint.
*
* 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
@@ -334,8 +333,8 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
* OldestXmin is the cutoff XID used to identify dead tuples.
*
* We don't actually change the page here, except perhaps for hint-bit updates
- * caused by HeapTupleSatisfiesVacuum. We just add entries to the arrays in
- * prstate showing the changes to be made. Items to be redirected are added
+ * caused by HeapTupleSatisfiesVacuum. We just add entries to the arrays in
+ * prstate showing the changes to be made. Items to be redirected are added
* to the redirected[] array (two entries per redirection); items to be set to
* LP_DEAD state are added to nowdead[]; and items to be set to LP_UNUSED
* state are added to nowunused[].
@@ -598,19 +597,19 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
else if (redirect_move && ItemIdIsRedirected(rootlp))
{
/*
- * If we desire to eliminate LP_REDIRECT items by moving tuples,
- * make a redirection entry for each redirected root item; this
- * will cause heap_page_prune_execute to actually do the move.
- * (We get here only when there are no DEAD tuples in the chain;
- * otherwise the redirection entry was made above.)
+ * If we desire to eliminate LP_REDIRECT items by moving tuples, make
+ * a redirection entry for each redirected root item; this will cause
+ * heap_page_prune_execute to actually do the move. (We get here only
+ * when there are no DEAD tuples in the chain; otherwise the
+ * redirection entry was made above.)
*/
heap_prune_record_redirect(prstate, rootoffnum, chainitems[1]);
redirect_target = chainitems[1];
}
/*
- * If we are going to implement a redirect by moving tuples, we have
- * to issue a cache invalidation against the redirection target tuple,
+ * If we are going to implement a redirect by moving tuples, we have to
+ * issue a cache invalidation against the redirection target tuple,
* because its CTID will be effectively changed by the move. Note that
* CacheInvalidateHeapTuple only queues the request, it doesn't send it;
* if we fail before reaching EndNonTransactionalInvalidation, nothing
@@ -693,7 +692,7 @@ heap_prune_record_unused(PruneState *prstate, OffsetNumber offnum)
* buffer, and is inside a critical section.
*
* This is split out because it is also used by heap_xlog_clean()
- * to replay the WAL record when needed after a crash. Note that the
+ * to replay the WAL record when needed after a crash. Note that the
* arguments are identical to those of log_heap_clean().
*/
void
diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c
index f6a16b8492..6f00c24845 100644
--- a/src/backend/access/heap/rewriteheap.c
+++ b/src/backend/access/heap/rewriteheap.c
@@ -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.17 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/rewriteheap.c,v 1.18 2009/06/11 14:48:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -577,7 +577,7 @@ raw_heap_insert(RewriteState state, HeapTuple tup)
heaptup = toast_insert_or_update(state->rs_new_rel, tup, NULL,
HEAP_INSERT_SKIP_FSM |
(state->rs_use_wal ?
- 0 : HEAP_INSERT_SKIP_WAL));
+ 0 : HEAP_INSERT_SKIP_WAL));
else
heaptup = tup;
diff --git a/src/backend/access/heap/tuptoaster.c b/src/backend/access/heap/tuptoaster.c
index 35019a543c..a3203085b7 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.92 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.93 2009/06/11 14:48:54 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -1073,8 +1073,8 @@ toast_compress_datum(Datum value)
Assert(!VARATT_IS_COMPRESSED(DatumGetPointer(value)));
/*
- * No point in wasting a palloc cycle if value size is out of the
- * allowed range for compression
+ * No point in wasting a palloc cycle if value size is out of the allowed
+ * range for compression
*/
if (valsize < PGLZ_strategy_default->min_input_size ||
valsize > PGLZ_strategy_default->max_input_size)
@@ -1087,10 +1087,10 @@ toast_compress_datum(Datum value)
* because it might be satisfied with having saved as little as one byte
* in the compressed data --- which could turn into a net loss once you
* consider header and alignment padding. Worst case, the compressed
- * format might require three padding bytes (plus header, which is included
- * in VARSIZE(tmp)), whereas the uncompressed format would take only one
- * header byte and no padding if the value is short enough. So we insist
- * on a savings of more than 2 bytes to ensure we have a gain.
+ * format might require three padding bytes (plus header, which is
+ * included in VARSIZE(tmp)), whereas the uncompressed format would take
+ * only one header byte and no padding if the value is short enough. So
+ * we insist on a savings of more than 2 bytes to ensure we have a gain.
*/
if (pglz_compress(VARDATA_ANY(DatumGetPointer(value)), valsize,
(PGLZ_Header *) tmp, PGLZ_strategy_default) &&
@@ -1130,7 +1130,7 @@ toast_save_datum(Relation rel, Datum value, int options)
struct
{
struct varlena hdr;
- char data[TOAST_MAX_CHUNK_SIZE]; /* make struct big enough */
+ char data[TOAST_MAX_CHUNK_SIZE]; /* make struct big enough */
int32 align_it; /* ensure struct is aligned well enough */
} chunk_data;
int32 chunk_size;
@@ -1295,8 +1295,8 @@ toast_delete_datum(Relation rel, Datum value)
/*
* Find all the chunks. (We don't actually care whether we see them in
- * sequence or not, but since we've already locked the index we might
- * as well use systable_beginscan_ordered.)
+ * sequence or not, but since we've already locked the index we might as
+ * well use systable_beginscan_ordered.)
*/
toastscan = systable_beginscan_ordered(toastrel, toastidx,
SnapshotToast, 1, &toastkey);
@@ -1598,7 +1598,7 @@ toast_fetch_datum_slice(struct varlena * attr, int32 sliceoffset, int32 length)
*/
nextidx = startchunk;
toastscan = systable_beginscan_ordered(toastrel, toastidx,
- SnapshotToast, nscankeys, toastkey);
+ SnapshotToast, nscankeys, toastkey);
while ((ttup = systable_getnext_ordered(toastscan, ForwardScanDirection)) != NULL)
{
/*
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c
index 2b5a0704ed..d425e772b9 100644
--- a/src/backend/access/heap/visibilitymap.c
+++ b/src/backend/access/heap/visibilitymap.c
@@ -8,10 +8,10 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/heap/visibilitymap.c,v 1.3 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/heap/visibilitymap.c,v 1.4 2009/06/11 14:48:54 momjian Exp $
*
* INTERFACE ROUTINES
- * visibilitymap_clear - clear a bit in the visibility map
+ * visibilitymap_clear - clear a bit in the visibility map
* visibilitymap_pin - pin a map page for setting a bit
* visibilitymap_set - set a bit in a previously pinned page
* visibilitymap_test - test if a bit is set
@@ -144,7 +144,7 @@ visibilitymap_clear(Relation rel, BlockNumber heapBlk)
mapBuffer = vm_readbuf(rel, mapBlock, false);
if (!BufferIsValid(mapBuffer))
- return; /* nothing to do */
+ return; /* nothing to do */
LockBuffer(mapBuffer, BUFFER_LOCK_EXCLUSIVE);
map = PageGetContents(BufferGetPage(mapBuffer));
@@ -295,10 +295,11 @@ void
visibilitymap_truncate(Relation rel, BlockNumber nheapblocks)
{
BlockNumber newnblocks;
+
/* last remaining block, byte, and bit */
BlockNumber truncBlock = HEAPBLK_TO_MAPBLOCK(nheapblocks);
- uint32 truncByte = HEAPBLK_TO_MAPBYTE(nheapblocks);
- uint8 truncBit = HEAPBLK_TO_MAPBIT(nheapblocks);
+ uint32 truncByte = HEAPBLK_TO_MAPBYTE(nheapblocks);
+ uint8 truncBit = HEAPBLK_TO_MAPBIT(nheapblocks);
#ifdef TRACE_VISIBILITYMAP
elog(DEBUG1, "vm_truncate %s %d", RelationGetRelationName(rel), nheapblocks);
@@ -315,14 +316,14 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks)
* Unless the new size is exactly at a visibility map page boundary, the
* tail bits in the last remaining map page, representing truncated heap
* blocks, need to be cleared. This is not only tidy, but also necessary
- * because we don't get a chance to clear the bits if the heap is
- * extended again.
+ * because we don't get a chance to clear the bits if the heap is extended
+ * again.
*/
if (truncByte != 0 || truncBit != 0)
{
- Buffer mapBuffer;
- Page page;
- char *map;
+ Buffer mapBuffer;
+ Page page;
+ char *map;
newnblocks = truncBlock + 1;
@@ -344,11 +345,8 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks)
/*
* Mask out the unwanted bits of the last remaining byte.
*
- * ((1 << 0) - 1) = 00000000
- * ((1 << 1) - 1) = 00000001
- * ...
- * ((1 << 6) - 1) = 00111111
- * ((1 << 7) - 1) = 01111111
+ * ((1 << 0) - 1) = 00000000 ((1 << 1) - 1) = 00000001 ... ((1 << 6) -
+ * 1) = 00111111 ((1 << 7) - 1) = 01111111
*/
map[truncByte] &= (1 << truncBit) - 1;
@@ -368,8 +366,8 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks)
rel->rd_istemp);
/*
- * Need to invalidate the relcache entry, because rd_vm_nblocks
- * seen by other backends is no longer valid.
+ * Need to invalidate the relcache entry, because rd_vm_nblocks seen by
+ * other backends is no longer valid.
*/
if (!InRecovery)
CacheInvalidateRelcache(rel);
@@ -386,7 +384,7 @@ visibilitymap_truncate(Relation rel, BlockNumber nheapblocks)
static Buffer
vm_readbuf(Relation rel, BlockNumber blkno, bool extend)
{
- Buffer buf;
+ Buffer buf;
RelationOpenSmgr(rel);
@@ -433,20 +431,20 @@ static void
vm_extend(Relation rel, BlockNumber vm_nblocks)
{
BlockNumber vm_nblocks_now;
- Page pg;
+ Page pg;
pg = (Page) palloc(BLCKSZ);
PageInit(pg, BLCKSZ, 0);
/*
- * We use the relation extension lock to lock out other backends trying
- * to extend the visibility map at the same time. It also locks out
- * extension of the main fork, unnecessarily, but extending the
- * visibility map happens seldom enough that it doesn't seem worthwhile to
- * have a separate lock tag type for it.
+ * We use the relation extension lock to lock out other backends trying to
+ * extend the visibility map at the same time. It also locks out extension
+ * of the main fork, unnecessarily, but extending the visibility map
+ * happens seldom enough that it doesn't seem worthwhile to have a
+ * separate lock tag type for it.
*
- * Note that another backend might have extended or created the
- * relation before we get the lock.
+ * Note that another backend might have extended or created the relation
+ * before we get the lock.
*/
LockRelationForExtension(rel, ExclusiveLock);
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c
index 9193ee40eb..a79c392071 100644
--- a/src/backend/access/index/genam.c
+++ b/src/backend/access/index/genam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.73 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/index/genam.c,v 1.74 2009/06/11 14:48:54 momjian Exp $
*
* NOTES
* many of the old access method routines have been turned into
@@ -197,7 +197,7 @@ systable_beginscan(Relation heapRelation,
/* Change attribute numbers to be index column numbers. */
for (i = 0; i < nkeys; i++)
{
- int j;
+ int j;
for (j = 0; j < irel->rd_index->indnatts; j++)
{
@@ -241,12 +241,13 @@ systable_getnext(SysScanDesc sysscan)
if (sysscan->irel)
{
htup = index_getnext(sysscan->iscan, ForwardScanDirection);
+
/*
- * We currently don't need to support lossy index operators for
- * any system catalog scan. It could be done here, using the
- * scan keys to drive the operator calls, if we arranged to save
- * the heap attnums during systable_beginscan(); this is practical
- * because we still wouldn't need to support indexes on expressions.
+ * We currently don't need to support lossy index operators for any
+ * system catalog scan. It could be done here, using the scan keys to
+ * drive the operator calls, if we arranged to save the heap attnums
+ * during systable_beginscan(); this is practical because we still
+ * wouldn't need to support indexes on expressions.
*/
if (htup && sysscan->iscan->xs_recheck)
elog(ERROR, "system catalog scans with lossy index conditions are not implemented");
@@ -326,7 +327,7 @@ systable_endscan(SysScanDesc sysscan)
* index order. Also, for largely historical reasons, the index to use
* is opened and locked by the caller, not here.
*
- * Currently we do not support non-index-based scans here. (In principle
+ * Currently we do not support non-index-based scans here. (In principle
* we could do a heapscan and sort, but the uses are in places that
* probably don't need to still work with corrupted catalog indexes.)
* For the moment, therefore, these functions are merely the thinnest of
@@ -360,7 +361,7 @@ systable_beginscan_ordered(Relation heapRelation,
/* Change attribute numbers to be index column numbers. */
for (i = 0; i < nkeys; i++)
{
- int j;
+ int j;
for (j = 0; j < indexRelation->rd_index->indnatts; j++)
{
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index 197fa3b041..32623965c7 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.113 2009/03/24 20:17:12 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/index/indexam.c,v 1.114 2009/06/11 14:48:54 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relation OID
@@ -21,7 +21,7 @@
* index_markpos - mark a scan position
* index_restrpos - restore a scan position
* index_getnext - get the next tuple from a scan
- * index_getbitmap - get all tuples from a scan
+ * index_getbitmap - get all tuples from a scan
* index_bulk_delete - bulk deletion of index tuples
* index_vacuum_cleanup - post-deletion cleanup of an index
* index_getprocid - get a support procedure OID
@@ -461,9 +461,9 @@ index_getnext(IndexScanDesc scan, ScanDirection direction)
/*
* The AM's gettuple proc finds the next index entry matching the
- * scan keys, and puts the TID in xs_ctup.t_self (ie, *tid).
- * It should also set scan->xs_recheck, though we pay no
- * attention to that here.
+ * scan keys, and puts the TID in xs_ctup.t_self (ie, *tid). It
+ * should also set scan->xs_recheck, though we pay no attention to
+ * that here.
*/
found = DatumGetBool(FunctionCall2(procedure,
PointerGetDatum(scan),
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index b0d14319b7..a06faa2020 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.169 2009/01/01 17:23:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.170 2009/06/11 14:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -374,7 +374,7 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
* removing any LP_DEAD tuples.
*
* On entry, *buf and *offsetptr point to the first legal position
- * where the new tuple could be inserted. The caller should hold an
+ * 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 for the
* right location within the page if needed. On exit, they point to the
@@ -951,7 +951,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
sopaque = (BTPageOpaque) PageGetSpecialPointer(spage);
if (sopaque->btpo_prev != ropaque->btpo_prev)
elog(PANIC, "right sibling's left-link doesn't match: "
- "block %u links to %u instead of expected %u in index \"%s\"",
+ "block %u links to %u instead of expected %u in index \"%s\"",
ropaque->btpo_next, sopaque->btpo_prev, ropaque->btpo_prev,
RelationGetRelationName(rel));
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index 55d947e9f2..2b76e7cd45 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.170 2009/06/06 22:13:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.171 2009/06/11 14:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -290,7 +290,7 @@ Datum
btgetbitmap(PG_FUNCTION_ARGS)
{
IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0);
- TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
+ TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1);
BTScanOpaque so = (BTScanOpaque) scan->opaque;
int64 ntids = 0;
ItemPointer heapTid;
@@ -579,9 +579,8 @@ btvacuumcleanup(PG_FUNCTION_ARGS)
/*
* During a non-FULL vacuum it's quite possible for us to be fooled by
* concurrent page splits into double-counting some index tuples, so
- * disbelieve any total that exceeds the underlying heap's count ...
- * if we know that accurately. Otherwise this might just make matters
- * worse.
+ * disbelieve any total that exceeds the underlying heap's count ... if we
+ * know that accurately. Otherwise this might just make matters worse.
*/
if (!info->vacuum_full && !info->estimated_count)
{
diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c
index 3de7d50e01..d132d6bdee 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.54 2009/01/20 18:59:37 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.55 2009/06/11 14:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -338,8 +338,8 @@ btree_xlog_split(bool onleft, bool isroot,
_bt_restore_page(rpage, datapos, datalen);
/*
- * On leaf level, the high key of the left page is equal to the
- * first key on the right page.
+ * On leaf level, the high key of the left page is equal to the first key
+ * on the right page.
*/
if (xlrec->level == 0)
{
@@ -936,7 +936,7 @@ btree_xlog_cleanup(void)
buf = XLogReadBuffer(action->node, action->delblk, false);
if (BufferIsValid(buf))
{
- Relation reln;
+ Relation reln;
reln = CreateFakeRelcacheEntry(action->node);
if (_bt_pagedel(reln, buf, NULL, true) == 0)
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 368d2c9d1a..8544725abb 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -26,7 +26,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.52 2009/01/20 18:59:37 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.53 2009/06/11 14:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -81,7 +81,7 @@ static bool CLOGPagePrecedes(int page1, int page2);
static void WriteZeroPageXlogRec(int pageno);
static void WriteTruncateXlogRec(int pageno);
static void TransactionIdSetPageStatus(TransactionId xid, int nsubxids,
- TransactionId *subxids, XidStatus status,
+ TransactionId *subxids, XidStatus status,
XLogRecPtr lsn, int pageno);
static void TransactionIdSetStatusBit(TransactionId xid, XidStatus status,
XLogRecPtr lsn, int slotno);
@@ -112,10 +112,10 @@ static void set_status_by_pages(int nsubxids, TransactionId *subxids,
* the same CLOG page as xid. If they all are, then the lock will be grabbed
* only once, and the status will be set to committed directly. Otherwise
* we must
- * 1. set sub-committed all subxids that are not on the same page as the
- * main xid
- * 2. atomically set committed the main xid and the subxids on the same page
- * 3. go over the first bunch again and set them committed
+ * 1. set sub-committed all subxids that are not on the same page as the
+ * main xid
+ * 2. atomically set committed the main xid and the subxids on the same page
+ * 3. go over the first bunch again and set them committed
* Note that as far as concurrent checkers are concerned, main transaction
* commit as a whole is still atomic.
*
@@ -126,13 +126,13 @@ static void set_status_by_pages(int nsubxids, TransactionId *subxids,
* page2: set t2,t3 as sub-committed
* page3: set t4 as sub-committed
* 2. update page1:
- * set t1 as sub-committed,
+ * set t1 as sub-committed,
* then set t as committed,
then set t1 as committed
* 3. update pages2-3:
* page2: set t2,t3 as committed
* page3: set t4 as committed
- *
+ *
* NB: this is a low-level routine and is NOT the preferred entry point
* for most uses; functions in transam.c are the intended callers.
*
@@ -142,16 +142,17 @@ static void set_status_by_pages(int nsubxids, TransactionId *subxids,
*/
void
TransactionIdSetTreeStatus(TransactionId xid, int nsubxids,
- TransactionId *subxids, XidStatus status, XLogRecPtr lsn)
+ TransactionId *subxids, XidStatus status, XLogRecPtr lsn)
{
- int pageno = TransactionIdToPage(xid); /* get page of parent */
- int i;
+ int pageno = TransactionIdToPage(xid); /* get page of parent */
+ int i;
Assert(status == TRANSACTION_STATUS_COMMITTED ||
status == TRANSACTION_STATUS_ABORTED);
/*
- * See how many subxids, if any, are on the same page as the parent, if any.
+ * See how many subxids, if any, are on the same page as the parent, if
+ * any.
*/
for (i = 0; i < nsubxids; i++)
{
@@ -172,14 +173,14 @@ TransactionIdSetTreeStatus(TransactionId xid, int nsubxids,
}
else
{
- int nsubxids_on_first_page = i;
+ int nsubxids_on_first_page = i;
/*
* If this is a commit then we care about doing this correctly (i.e.
- * using the subcommitted intermediate status). By here, we know we're
- * updating more than one page of clog, so we must mark entries that
- * are *not* on the first page so that they show as subcommitted before
- * we then return to update the status to fully committed.
+ * using the subcommitted intermediate status). By here, we know
+ * we're updating more than one page of clog, so we must mark entries
+ * that are *not* on the first page so that they show as subcommitted
+ * before we then return to update the status to fully committed.
*
* To avoid touching the first page twice, skip marking subcommitted
* for the subxids on that first page.
@@ -217,13 +218,13 @@ static void
set_status_by_pages(int nsubxids, TransactionId *subxids,
XidStatus status, XLogRecPtr lsn)
{
- int pageno = TransactionIdToPage(subxids[0]);
- int offset = 0;
- int i = 0;
+ int pageno = TransactionIdToPage(subxids[0]);
+ int offset = 0;
+ int i = 0;
while (i < nsubxids)
{
- int num_on_page = 0;
+ int num_on_page = 0;
while (TransactionIdToPage(subxids[i]) == pageno && i < nsubxids)
{
@@ -251,7 +252,7 @@ TransactionIdSetPageStatus(TransactionId xid, int nsubxids,
XLogRecPtr lsn, int pageno)
{
int slotno;
- int i;
+ int i;
Assert(status == TRANSACTION_STATUS_COMMITTED ||
status == TRANSACTION_STATUS_ABORTED ||
@@ -275,9 +276,9 @@ TransactionIdSetPageStatus(TransactionId xid, int nsubxids,
*
* If we update more than one xid on this page while it is being written
* out, we might find that some of the bits go to disk and others don't.
- * If we are updating commits on the page with the top-level xid that could
- * break atomicity, so we subcommit the subxids first before we mark the
- * top-level commit.
+ * If we are updating commits on the page with the top-level xid that
+ * could break atomicity, so we subcommit the subxids first before we mark
+ * the top-level commit.
*/
if (TransactionIdIsValid(xid))
{
@@ -336,7 +337,7 @@ TransactionIdSetStatusBit(TransactionId xid, XidStatus status, XLogRecPtr lsn, i
curval == TRANSACTION_STATUS_COMMITTED)
return;
- /*
+ /*
* Current state change should be from 0 or subcommitted to target state
* or we should already be there when replaying changes during recovery.
*/
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 4685ccdf10..4a43579c40 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.52 2009/04/23 00:23:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/twophase.c,v 1.53 2009/06/11 14:48:54 momjian Exp $
*
* NOTES
* Each global transaction is associated with a global transaction
@@ -233,7 +233,7 @@ MarkAsPreparing(TransactionId xid, const char *gid,
ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
errmsg("prepared transactions are disabled"),
- errhint("Set max_prepared_transactions to a nonzero value.")));
+ errhint("Set max_prepared_transactions to a nonzero value.")));
LWLockAcquire(TwoPhaseStateLock, LW_EXCLUSIVE);
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index ac330411aa..2b6a222477 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.273 2009/05/13 20:27:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.274 2009/06/11 14:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -456,7 +456,7 @@ GetCurrentSubTransactionId(void)
*
* "used" must be TRUE if the caller intends to use the command ID to mark
* inserted/updated/deleted tuples. FALSE means the ID is being fetched
- * for read-only purposes (ie, as a snapshot validity cutoff). See
+ * for read-only purposes (ie, as a snapshot validity cutoff). See
* CommandCounterIncrement() for discussion.
*/
CommandId
@@ -566,7 +566,8 @@ TransactionIdIsCurrentTransactionId(TransactionId xid)
*/
for (s = CurrentTransactionState; s != NULL; s = s->parent)
{
- int low, high;
+ int low,
+ high;
if (s->state == TRANS_ABORT)
continue;
@@ -579,8 +580,8 @@ TransactionIdIsCurrentTransactionId(TransactionId xid)
high = s->nChildXids - 1;
while (low <= high)
{
- int middle;
- TransactionId probe;
+ int middle;
+ TransactionId probe;
middle = low + (high - low) / 2;
probe = s->childXids[middle];
@@ -604,33 +605,31 @@ void
CommandCounterIncrement(void)
{
/*
- * If the current value of the command counter hasn't been "used" to
- * mark tuples, we need not increment it, since there's no need to
- * distinguish a read-only command from others. This helps postpone
- * command counter overflow, and keeps no-op CommandCounterIncrement
- * operations cheap.
+ * If the current value of the command counter hasn't been "used" to mark
+ * tuples, we need not increment it, since there's no need to distinguish
+ * a read-only command from others. This helps postpone command counter
+ * overflow, and keeps no-op CommandCounterIncrement operations cheap.
*/
if (currentCommandIdUsed)
{
currentCommandId += 1;
- if (currentCommandId == FirstCommandId) /* check for overflow */
+ if (currentCommandId == FirstCommandId) /* check for overflow */
{
currentCommandId -= 1;
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("cannot have more than 2^32-1 commands in a transaction")));
+ errmsg("cannot have more than 2^32-1 commands in a transaction")));
}
currentCommandIdUsed = false;
/* Propagate new command ID into static snapshots */
SnapshotSetCommandId(currentCommandId);
-
+
/*
- * Make any catalog changes done by the just-completed command
- * visible in the local syscache. We obviously don't need to do
- * this after a read-only command. (But see hacks in inval.c
- * to make real sure we don't think a command that queued inval
- * messages was read-only.)
+ * Make any catalog changes done by the just-completed command visible
+ * in the local syscache. We obviously don't need to do this after a
+ * read-only command. (But see hacks in inval.c to make real sure we
+ * don't think a command that queued inval messages was read-only.)
*/
AtCommit_LocalCache();
}
@@ -638,11 +637,11 @@ CommandCounterIncrement(void)
/*
* Make any other backends' catalog changes visible to me.
*
- * XXX this is probably in the wrong place: CommandCounterIncrement
- * should be purely a local operation, most likely. However fooling
- * with this will affect asynchronous cross-backend interactions,
- * which doesn't seem like a wise thing to do in late beta, so save
- * improving this for another day - tgl 2007-11-30
+ * XXX this is probably in the wrong place: CommandCounterIncrement should
+ * be purely a local operation, most likely. However fooling with this
+ * will affect asynchronous cross-backend interactions, which doesn't seem
+ * like a wise thing to do in late beta, so save improving this for
+ * another day - tgl 2007-11-30
*/
AtStart_Cache();
}
@@ -1086,14 +1085,14 @@ AtSubCommit_childXids(void)
/* Allocate or enlarge the parent array if necessary */
if (s->parent->maxChildXids < new_nChildXids)
{
- int new_maxChildXids;
- TransactionId *new_childXids;
+ int new_maxChildXids;
+ TransactionId *new_childXids;
/*
* Make it 2x what's needed right now, to avoid having to enlarge it
- * repeatedly. But we can't go above MaxAllocSize. (The latter
- * limit is what ensures that we don't need to worry about integer
- * overflow here or in the calculation of new_nChildXids.)
+ * repeatedly. But we can't go above MaxAllocSize. (The latter limit
+ * is what ensures that we don't need to worry about integer overflow
+ * here or in the calculation of new_nChildXids.)
*/
new_maxChildXids = Min(new_nChildXids * 2,
(int) (MaxAllocSize / sizeof(TransactionId)));
@@ -1111,13 +1110,13 @@ AtSubCommit_childXids(void)
*/
if (s->parent->childXids == NULL)
new_childXids =
- MemoryContextAlloc(TopTransactionContext,
+ MemoryContextAlloc(TopTransactionContext,
new_maxChildXids * sizeof(TransactionId));
else
- new_childXids = repalloc(s->parent->childXids,
- new_maxChildXids * sizeof(TransactionId));
+ new_childXids = repalloc(s->parent->childXids,
+ new_maxChildXids * sizeof(TransactionId));
- s->parent->childXids = new_childXids;
+ s->parent->childXids = new_childXids;
s->parent->maxChildXids = new_maxChildXids;
}
@@ -1126,9 +1125,9 @@ AtSubCommit_childXids(void)
*
* Note: We rely on the fact that the XID of a child always follows that
* of its parent. By copying the XID of this subtransaction before the
- * XIDs of its children, we ensure that the array stays ordered. Likewise,
- * all XIDs already in the array belong to subtransactions started and
- * subcommitted before us, so their XIDs must precede ours.
+ * XIDs of its children, we ensure that the array stays ordered.
+ * Likewise, all XIDs already in the array belong to subtransactions
+ * started and subcommitted before us, so their XIDs must precede ours.
*/
s->parent->childXids[s->parent->nChildXids] = s->transactionId;
@@ -1801,15 +1800,15 @@ PrepareTransaction(void)
/* NOTIFY and flatfiles will be handled below */
/*
- * Don't allow PREPARE TRANSACTION if we've accessed a temporary table
- * in this transaction. Having the prepared xact hold locks on another
+ * Don't allow PREPARE TRANSACTION if we've accessed a temporary table in
+ * this transaction. Having the prepared xact hold locks on another
* backend's temp table seems a bad idea --- for instance it would prevent
- * the backend from exiting. There are other problems too, such as how
- * to clean up the source backend's local buffers and ON COMMIT state
- * if the prepared xact includes a DROP of a temp table.
+ * the backend from exiting. There are other problems too, such as how to
+ * clean up the source backend's local buffers and ON COMMIT state if the
+ * prepared xact includes a DROP of a temp table.
*
- * We must check this after executing any ON COMMIT actions, because
- * they might still access a temp relation.
+ * We must check this after executing any ON COMMIT actions, because they
+ * might still access a temp relation.
*
* XXX In principle this could be relaxed to allow some useful special
* cases, such as a temp table created and dropped all within the
@@ -2021,8 +2020,8 @@ AbortTransaction(void)
/*
* Reset user ID which might have been changed transiently. We need this
* to clean up in case control escaped out of a SECURITY DEFINER function
- * or other local change of CurrentUserId; therefore, the prior value
- * of SecurityDefinerContext also needs to be restored.
+ * or other local change of CurrentUserId; therefore, the prior value of
+ * SecurityDefinerContext also needs to be restored.
*
* (Note: it is not necessary to restore session authorization or role
* settings here because those can only be changed via GUC, and GUC will
@@ -3749,8 +3748,8 @@ CommitSubTransaction(void)
/* Must CCI to ensure commands of subtransaction are seen as done */
CommandCounterIncrement();
- /*
- * Prior to 8.4 we marked subcommit in clog at this point. We now only
+ /*
+ * Prior to 8.4 we marked subcommit in clog at this point. We now only
* perform that step, if required, as part of the atomic update of the
* whole transaction tree at top level commit or abort.
*/
@@ -3868,8 +3867,8 @@ AbortSubTransaction(void)
s->state = TRANS_ABORT;
/*
- * Reset user ID which might have been changed transiently. (See notes
- * in AbortTransaction.)
+ * Reset user ID which might have been changed transiently. (See notes in
+ * AbortTransaction.)
*/
SetUserIdAndContext(s->prevUser, s->prevSecDefCxt);
@@ -4089,7 +4088,7 @@ ShowTransactionStateRec(TransactionState s)
if (s->nChildXids > 0)
{
- int i;
+ int i;
appendStringInfo(&buf, "%u", s->childXids[0]);
for (i = 1; i < s->nChildXids; i++)
@@ -4241,7 +4240,7 @@ xact_redo_commit(xl_xact_commit *xlrec, TransactionId xid)
for (i = 0; i < xlrec->nrels; i++)
{
SMgrRelation srel = smgropen(xlrec->xnodes[i]);
- ForkNumber fork;
+ ForkNumber fork;
for (fork = 0; fork <= MAX_FORKNUM; fork++)
{
@@ -4284,7 +4283,7 @@ xact_redo_abort(xl_xact_abort *xlrec, TransactionId xid)
for (i = 0; i < xlrec->nrels; i++)
{
SMgrRelation srel = smgropen(xlrec->xnodes[i]);
- ForkNumber fork;
+ ForkNumber fork;
for (fork = 0; fork <= MAX_FORKNUM; fork++)
{
@@ -4353,7 +4352,8 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
appendStringInfo(buf, "; rels:");
for (i = 0; i < xlrec->nrels; i++)
{
- char *path = relpath(xlrec->xnodes[i], MAIN_FORKNUM);
+ char *path = relpath(xlrec->xnodes[i], MAIN_FORKNUM);
+
appendStringInfo(buf, " %s", path);
pfree(path);
}
@@ -4380,7 +4380,8 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec)
appendStringInfo(buf, "; rels:");
for (i = 0; i < xlrec->nrels; i++)
{
- char *path = relpath(xlrec->xnodes[i], MAIN_FORKNUM);
+ char *path = relpath(xlrec->xnodes[i], MAIN_FORKNUM);
+
appendStringInfo(buf, " %s", path);
pfree(path);
}
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index b6171c78c0..d521fa6e7b 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.342 2009/06/02 06:18:06 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.343 2009/06/11 14:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -69,7 +69,7 @@ bool XLogArchiveMode = false;
char *XLogArchiveCommand = NULL;
bool fullPageWrites = true;
bool log_checkpoints = false;
-int sync_method = DEFAULT_SYNC_METHOD;
+int sync_method = DEFAULT_SYNC_METHOD;
#ifdef WAL_DEBUG
bool XLOG_DEBUG = false;
@@ -122,7 +122,7 @@ CheckpointStatsData CheckpointStats;
TimeLineID ThisTimeLineID = 0;
/*
- * Are we doing recovery from XLOG?
+ * Are we doing recovery from XLOG?
*
* This is only ever true in the startup process, even if the system is still
* in recovery. Prior to 8.4, all activity during recovery were carried out
@@ -336,9 +336,8 @@ typedef struct XLogCtlData
bool SharedRecoveryInProgress;
/*
- * During recovery, we keep a copy of the latest checkpoint record
- * here. Used by the background writer when it wants to create
- * a restartpoint.
+ * During recovery, we keep a copy of the latest checkpoint record here.
+ * Used by the background writer when it wants to create a restartpoint.
*
* Protected by info_lck.
*/
@@ -422,8 +421,9 @@ static XLogRecPtr ReadRecPtr; /* start of last record read */
static XLogRecPtr EndRecPtr; /* end+1 of last record read */
static XLogRecord *nextRecord = NULL;
static TimeLineID lastPageTLI = 0;
-static XLogRecPtr minRecoveryPoint; /* local copy of ControlFile->minRecoveryPoint */
-static bool updateMinRecoveryPoint = true;
+static XLogRecPtr minRecoveryPoint; /* local copy of
+ * ControlFile->minRecoveryPoint */
+static bool updateMinRecoveryPoint = true;
static bool InRedo = false;
@@ -432,6 +432,7 @@ static bool InRedo = false;
*/
static volatile sig_atomic_t got_SIGHUP = false;
static volatile sig_atomic_t shutdown_requested = false;
+
/*
* Flag set when executing a restore command, to tell SIGTERM signal handler
* that it's safe to just proc_exit.
@@ -482,6 +483,7 @@ static void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
static void WriteControlFile(void);
static void ReadControlFile(void);
static char *str_time(pg_time_t tnow);
+
#ifdef WAL_DEBUG
static void xlog_outrec(StringInfo buf, XLogRecord *record);
#endif
@@ -490,7 +492,7 @@ static void pg_start_backup_callback(int code, Datum arg);
static bool read_backup_label(XLogRecPtr *checkPointLoc,
XLogRecPtr *minRecoveryLoc);
static void rm_redo_error_callback(void *arg);
-static int get_sync_bit(int method);
+static int get_sync_bit(int method);
/*
@@ -1260,9 +1262,9 @@ XLogArchiveIsBusy(const char *xlog)
return false;
/*
- * Check to see if the WAL file has been removed by checkpoint,
- * which implies it has already been archived, and explains why we
- * can't see a status file for it.
+ * Check to see if the WAL file has been removed by checkpoint, which
+ * implies it has already been archived, and explains why we can't see a
+ * status file for it.
*/
snprintf(archiveStatusPath, MAXPGPATH, XLOGDIR "/%s", xlog);
if (stat(archiveStatusPath, &stat_buf) != 0 &&
@@ -1775,8 +1777,8 @@ XLogSetAsyncCommitLSN(XLogRecPtr asyncCommitLSN)
* Advance minRecoveryPoint in control file.
*
* If we crash during recovery, we must reach this point again before the
- * database is consistent.
- *
+ * database is consistent.
+ *
* If 'force' is true, 'lsn' argument is ignored. Otherwise, minRecoveryPoint
* is is only updated if it's not already greater than or equal to 'lsn'.
*/
@@ -1802,7 +1804,7 @@ UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
{
/* use volatile pointer to prevent code rearrangement */
volatile XLogCtlData *xlogctl = XLogCtl;
- XLogRecPtr newMinRecoveryPoint;
+ XLogRecPtr newMinRecoveryPoint;
/*
* To avoid having to update the control file too often, we update it
@@ -2567,7 +2569,7 @@ XLogFileClose(void)
/*
* WAL segment files will not be re-read in normal operation, so we advise
- * the OS to release any cached pages. But do not do so if WAL archiving
+ * the OS to release any cached pages. But do not do so if WAL archiving
* is active, because archiver process could use the cache to read the WAL
* segment. Also, don't bother with it if we are using O_DIRECT, since
* the kernel is presumably not caching in that case.
@@ -2663,19 +2665,19 @@ RestoreArchivedFile(char *path, const char *xlogfname,
/*
* Calculate the archive file cutoff point for use during log shipping
- * replication. All files earlier than this point can be deleted
- * from the archive, though there is no requirement to do so.
+ * replication. All files earlier than this point can be deleted from the
+ * archive, though there is no requirement to do so.
*
* We initialise this with the filename of an InvalidXLogRecPtr, which
- * will prevent the deletion of any WAL files from the archive
- * because of the alphabetic sorting property of WAL filenames.
+ * will prevent the deletion of any WAL files from the archive because of
+ * the alphabetic sorting property of WAL filenames.
*
* Once we have successfully located the redo pointer of the checkpoint
* from which we start recovery we never request a file prior to the redo
- * pointer of the last restartpoint. When redo begins we know that we
- * have successfully located it, so there is no need for additional
- * status flags to signify the point when we can begin deleting WAL files
- * from the archive.
+ * pointer of the last restartpoint. When redo begins we know that we have
+ * successfully located it, so there is no need for additional status
+ * flags to signify the point when we can begin deleting WAL files from
+ * the archive.
*/
if (InRedo)
{
@@ -2821,9 +2823,9 @@ RestoreArchivedFile(char *path, const char *xlogfname,
* On SIGTERM, assume we have received a fast shutdown request, and exit
* cleanly. It's pure chance whether we receive the SIGTERM first, or the
* child process. If we receive it first, the signal handler will call
- * proc_exit, otherwise we do it here. If we or the child process
- * received SIGTERM for any other reason than a fast shutdown request,
- * postmaster will perform an immediate shutdown when it sees us exiting
+ * proc_exit, otherwise we do it here. If we or the child process received
+ * SIGTERM for any other reason than a fast shutdown request, postmaster
+ * will perform an immediate shutdown when it sees us exiting
* unexpectedly.
*
* Per the Single Unix Spec, shells report exit status > 128 when a called
@@ -2871,19 +2873,19 @@ ExecuteRecoveryEndCommand(void)
/*
* Calculate the archive file cutoff point for use during log shipping
- * replication. All files earlier than this point can be deleted
- * from the archive, though there is no requirement to do so.
+ * replication. All files earlier than this point can be deleted from the
+ * archive, though there is no requirement to do so.
*
* We initialise this with the filename of an InvalidXLogRecPtr, which
- * will prevent the deletion of any WAL files from the archive
- * because of the alphabetic sorting property of WAL filenames.
+ * will prevent the deletion of any WAL files from the archive because of
+ * the alphabetic sorting property of WAL filenames.
*
* Once we have successfully located the redo pointer of the checkpoint
* from which we start recovery we never request a file prior to the redo
- * pointer of the last restartpoint. When redo begins we know that we
- * have successfully located it, so there is no need for additional
- * status flags to signify the point when we can begin deleting WAL files
- * from the archive.
+ * pointer of the last restartpoint. When redo begins we know that we have
+ * successfully located it, so there is no need for additional status
+ * flags to signify the point when we can begin deleting WAL files from
+ * the archive.
*/
if (InRedo)
{
@@ -2948,14 +2950,14 @@ ExecuteRecoveryEndCommand(void)
{
/*
* If the failure was due to any sort of signal, it's best to punt and
- * abort recovery. See also detailed comments on signals in
+ * abort recovery. See also detailed comments on signals in
* RestoreArchivedFile().
*/
signaled = WIFSIGNALED(rc) || WEXITSTATUS(rc) > 125;
ereport(signaled ? FATAL : WARNING,
(errmsg("recovery_end_command \"%s\": return code %d",
- xlogRecoveryEndCmd, rc)));
+ xlogRecoveryEndCmd, rc)));
}
}
@@ -3101,12 +3103,12 @@ static void
ValidateXLOGDirectoryStructure(void)
{
char path[MAXPGPATH];
- struct stat stat_buf;
+ struct stat stat_buf;
/* Check for pg_xlog; if it doesn't exist, error out */
if (stat(XLOGDIR, &stat_buf) != 0 ||
!S_ISDIR(stat_buf.st_mode))
- ereport(FATAL,
+ ereport(FATAL,
(errmsg("required WAL directory \"%s\" does not exist",
XLOGDIR)));
@@ -3116,7 +3118,7 @@ ValidateXLOGDirectoryStructure(void)
{
/* Check for weird cases where it exists but isn't a directory */
if (!S_ISDIR(stat_buf.st_mode))
- ereport(FATAL,
+ ereport(FATAL,
(errmsg("required WAL directory \"%s\" does not exist",
path)));
}
@@ -3125,7 +3127,7 @@ ValidateXLOGDirectoryStructure(void)
ereport(LOG,
(errmsg("creating missing WAL directory \"%s\"", path)));
if (mkdir(path, 0700) < 0)
- ereport(FATAL,
+ ereport(FATAL,
(errmsg("could not create missing directory \"%s\": %m",
path)));
}
@@ -3187,7 +3189,7 @@ CleanupBackupHistory(void)
* ignoring them as already applied, but that's not a huge drawback.
*
* If 'cleanup' is true, a cleanup lock is used when restoring blocks.
- * Otherwise, a normal exclusive lock is used. At the moment, that's just
+ * Otherwise, a normal exclusive lock is used. At the moment, that's just
* pro forma, because there can't be any regular backends in the system
* during recovery. The 'cleanup' argument applies to all backup blocks
* in the WAL record, that suffices for now.
@@ -4283,8 +4285,8 @@ ReadControlFile(void)
ereport(FATAL,
(errmsg("database files are incompatible with server"),
errdetail("The database cluster was initialized with PG_CONTROL_VERSION %d (0x%08x),"
- " but the server was compiled with PG_CONTROL_VERSION %d (0x%08x).",
- ControlFile->pg_control_version, ControlFile->pg_control_version,
+ " but the server was compiled with PG_CONTROL_VERSION %d (0x%08x).",
+ ControlFile->pg_control_version, ControlFile->pg_control_version,
PG_CONTROL_VERSION, PG_CONTROL_VERSION),
errhint("This could be a problem of mismatched byte ordering. It looks like you need to initdb.")));
@@ -4309,8 +4311,8 @@ ReadControlFile(void)
/*
* Do compatibility checking immediately. If the database isn't
- * compatible with the backend executable, we want to abort before we
- * can possibly do any damage.
+ * compatible with the backend executable, we want to abort before we can
+ * possibly do any damage.
*/
if (ControlFile->catalog_version_no != CATALOG_VERSION_NO)
ereport(FATAL,
@@ -4402,14 +4404,14 @@ ReadControlFile(void)
ereport(FATAL,
(errmsg("database files are incompatible with server"),
errdetail("The database cluster was initialized without USE_FLOAT4_BYVAL"
- " but the server was compiled with USE_FLOAT4_BYVAL."),
+ " but the server was compiled with USE_FLOAT4_BYVAL."),
errhint("It looks like you need to recompile or initdb.")));
#else
if (ControlFile->float4ByVal != false)
ereport(FATAL,
(errmsg("database files are incompatible with server"),
- errdetail("The database cluster was initialized with USE_FLOAT4_BYVAL"
- " but the server was compiled without USE_FLOAT4_BYVAL."),
+ errdetail("The database cluster was initialized with USE_FLOAT4_BYVAL"
+ " but the server was compiled without USE_FLOAT4_BYVAL."),
errhint("It looks like you need to recompile or initdb.")));
#endif
@@ -4418,14 +4420,14 @@ ReadControlFile(void)
ereport(FATAL,
(errmsg("database files are incompatible with server"),
errdetail("The database cluster was initialized without USE_FLOAT8_BYVAL"
- " but the server was compiled with USE_FLOAT8_BYVAL."),
+ " but the server was compiled with USE_FLOAT8_BYVAL."),
errhint("It looks like you need to recompile or initdb.")));
#else
if (ControlFile->float8ByVal != false)
ereport(FATAL,
(errmsg("database files are incompatible with server"),
- errdetail("The database cluster was initialized with USE_FLOAT8_BYVAL"
- " but the server was compiled without USE_FLOAT8_BYVAL."),
+ errdetail("The database cluster was initialized with USE_FLOAT8_BYVAL"
+ " but the server was compiled without USE_FLOAT8_BYVAL."),
errhint("It looks like you need to recompile or initdb.")));
#endif
}
@@ -4848,9 +4850,9 @@ readRecoveryCommandFile(void)
* does nothing if a recovery_target is not also set
*/
if (!parse_bool(tok2, &recoveryTargetInclusive))
- ereport(ERROR,
- (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("parameter \"recovery_target_inclusive\" requires a Boolean value")));
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("parameter \"recovery_target_inclusive\" requires a Boolean value")));
ereport(LOG,
(errmsg("recovery_target_inclusive = %s", tok2)));
}
@@ -5204,8 +5206,8 @@ StartupXLOG(void)
/*
* Verify that pg_xlog and pg_xlog/archive_status exist. In cases where
- * someone has performed a copy for PITR, these directories may have
- * been excluded and need to be re-created.
+ * someone has performed a copy for PITR, these directories may have been
+ * excluded and need to be re-created.
*/
ValidateXLOGDirectoryStructure();
@@ -5437,6 +5439,7 @@ StartupXLOG(void)
bool recoveryApply = true;
bool reachedMinRecoveryPoint = false;
ErrorContextCallback errcontext;
+
/* use volatile pointer to prevent code rearrangement */
volatile XLogCtlData *xlogctl = XLogCtl;
@@ -5454,7 +5457,7 @@ StartupXLOG(void)
else
ereport(LOG,
(errmsg("redo starts at %X/%X, consistency will be reached at %X/%X",
- ReadRecPtr.xlogid, ReadRecPtr.xrecoff,
+ ReadRecPtr.xlogid, ReadRecPtr.xrecoff,
minRecoveryPoint.xlogid, minRecoveryPoint.xrecoff)));
/*
@@ -5512,17 +5515,17 @@ StartupXLOG(void)
proc_exit(1);
/*
- * Have we reached our safe starting point? If so, we can
- * tell postmaster that the database is consistent now.
+ * Have we reached our safe starting point? If so, we can tell
+ * postmaster that the database is consistent now.
*/
- if (!reachedMinRecoveryPoint &&
- XLByteLE(minRecoveryPoint, EndRecPtr))
+ if (!reachedMinRecoveryPoint &&
+ XLByteLE(minRecoveryPoint, EndRecPtr))
{
reachedMinRecoveryPoint = true;
if (InArchiveRecovery)
{
ereport(LOG,
- (errmsg("consistent recovery state reached")));
+ (errmsg("consistent recovery state reached")));
if (IsUnderPostmaster)
SendPostmasterSignal(PMSIGNAL_RECOVERY_CONSISTENT);
}
@@ -5554,9 +5557,8 @@ StartupXLOG(void)
}
/*
- * Update shared replayEndRecPtr before replaying this
- * record, so that XLogFlush will update minRecoveryPoint
- * correctly.
+ * Update shared replayEndRecPtr before replaying this record,
+ * so that XLogFlush will update minRecoveryPoint correctly.
*/
SpinLockAcquire(&xlogctl->info_lck);
xlogctl->replayEndRecPtr = EndRecPtr;
@@ -5819,9 +5821,9 @@ bool
RecoveryInProgress(void)
{
/*
- * We check shared state each time only until we leave recovery mode.
- * We can't re-enter recovery, so we rely on the local state variable
- * after that.
+ * We check shared state each time only until we leave recovery mode. We
+ * can't re-enter recovery, so we rely on the local state variable after
+ * that.
*/
if (!LocalRecoveryInProgress)
return false;
@@ -6114,11 +6116,11 @@ ShutdownXLOG(int code, Datum arg)
static void
LogCheckpointStart(int flags, bool restartpoint)
{
- char *msg;
+ char *msg;
/*
- * XXX: This is hopelessly untranslatable. We could call gettext_noop
- * for the main message, but what about all the flags?
+ * XXX: This is hopelessly untranslatable. We could call gettext_noop for
+ * the main message, but what about all the flags?
*/
if (restartpoint)
msg = "restartpoint starting:%s%s%s%s%s%s";
@@ -6561,7 +6563,7 @@ CheckPointGuts(XLogRecPtr checkPointRedo, int flags)
/*
* This is used during WAL recovery to establish a point from which recovery
- * can roll forward without replaying the entire recovery log. This function
+ * can roll forward without replaying the entire recovery log. This function
* is called each time a checkpoint record is read from XLOG. It is stored
* in shared memory, so that it can be used as a restartpoint later on.
*/
@@ -6569,6 +6571,7 @@ static void
RecoveryRestartPoint(const CheckPoint *checkPoint)
{
int rmid;
+
/* use volatile pointer to prevent code rearrangement */
volatile XLogCtlData *xlogctl = XLogCtl;
@@ -6592,8 +6595,8 @@ RecoveryRestartPoint(const CheckPoint *checkPoint)
}
/*
- * Copy the checkpoint record to shared memory, so that bgwriter can
- * use it the next time it wants to perform a restartpoint.
+ * Copy the checkpoint record to shared memory, so that bgwriter can use
+ * it the next time it wants to perform a restartpoint.
*/
SpinLockAcquire(&xlogctl->info_lck);
XLogCtl->lastCheckPointRecPtr = ReadRecPtr;
@@ -6613,8 +6616,9 @@ RecoveryRestartPoint(const CheckPoint *checkPoint)
bool
CreateRestartPoint(int flags)
{
- XLogRecPtr lastCheckPointRecPtr;
- CheckPoint lastCheckPoint;
+ XLogRecPtr lastCheckPointRecPtr;
+ CheckPoint lastCheckPoint;
+
/* use volatile pointer to prevent code rearrangement */
volatile XLogCtlData *xlogctl = XLogCtl;
@@ -6630,14 +6634,14 @@ CreateRestartPoint(int flags)
memcpy(&lastCheckPoint, &XLogCtl->lastCheckPoint, sizeof(CheckPoint));
SpinLockRelease(&xlogctl->info_lck);
- /*
+ /*
* Check that we're still in recovery mode. It's ok if we exit recovery
* mode after this check, the restart point is valid anyway.
*/
if (!RecoveryInProgress())
{
ereport(DEBUG2,
- (errmsg("skipping restartpoint, recovery has already ended")));
+ (errmsg("skipping restartpoint, recovery has already ended")));
LWLockRelease(CheckpointLock);
return false;
}
@@ -6653,16 +6657,17 @@ CreateRestartPoint(int flags)
* possible in case of immediate shutdown, though.
*
* We don't explicitly advance minRecoveryPoint when we do create a
- * restartpoint. It's assumed that flushing the buffers will do that
- * as a side-effect.
+ * restartpoint. It's assumed that flushing the buffers will do that as a
+ * side-effect.
*/
if (XLogRecPtrIsInvalid(lastCheckPointRecPtr) ||
XLByteLE(lastCheckPoint.redo, ControlFile->checkPointCopy.redo))
{
- XLogRecPtr InvalidXLogRecPtr = {0, 0};
+ XLogRecPtr InvalidXLogRecPtr = {0, 0};
+
ereport(DEBUG2,
(errmsg("skipping restartpoint, already performed at %X/%X",
- lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff)));
+ lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff)));
UpdateMinRecoveryPoint(InvalidXLogRecPtr, true);
LWLockRelease(CheckpointLock);
@@ -6694,9 +6699,9 @@ CreateRestartPoint(int flags)
LWLockRelease(ControlFileLock);
/*
- * Currently, there is no need to truncate pg_subtrans during recovery.
- * If we did do that, we will need to have called StartupSUBTRANS()
- * already and then TruncateSUBTRANS() would go here.
+ * Currently, there is no need to truncate pg_subtrans during recovery. If
+ * we did do that, we will need to have called StartupSUBTRANS() already
+ * and then TruncateSUBTRANS() would go here.
*/
/* All real work is done, but log before releasing lock. */
@@ -6705,12 +6710,12 @@ CreateRestartPoint(int flags)
ereport((log_checkpoints ? LOG : DEBUG2),
(errmsg("recovery restart point at %X/%X",
- lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff)));
+ lastCheckPoint.redo.xlogid, lastCheckPoint.redo.xrecoff)));
if (recoveryLastXTime)
ereport((log_checkpoints ? LOG : DEBUG2),
- (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))));
LWLockRelease(CheckpointLock);
return true;
@@ -6828,9 +6833,9 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
(int) checkPoint.ThisTimeLineID))
ereport(PANIC,
(errmsg("unexpected timeline ID %u (after %u) in checkpoint record",
- checkPoint.ThisTimeLineID, ThisTimeLineID)));
- /* Following WAL records should be run with new TLI */
- ThisTimeLineID = checkPoint.ThisTimeLineID;
+ checkPoint.ThisTimeLineID, ThisTimeLineID)));
+ /* Following WAL records should be run with new TLI */
+ ThisTimeLineID = checkPoint.ThisTimeLineID;
}
RecoveryRestartPoint(&checkPoint);
@@ -6948,12 +6953,12 @@ get_sync_bit(int method)
switch (method)
{
- /*
- * enum values for all sync options are defined even if they are not
- * supported on the current platform. But if not, they are not
- * included in the enum option array, and therefore will never be seen
- * here.
- */
+ /*
+ * enum values for all sync options are defined even if they are
+ * not supported on the current platform. But if not, they are
+ * not included in the enum option array, and therefore will never
+ * be seen here.
+ */
case SYNC_METHOD_FSYNC:
case SYNC_METHOD_FSYNC_WRITETHROUGH:
case SYNC_METHOD_FDATASYNC:
@@ -6969,7 +6974,7 @@ get_sync_bit(int method)
default:
/* can't happen (unless we are out of sync with option array) */
elog(ERROR, "unrecognized wal_sync_method: %d", method);
- return 0; /* silence warning */
+ return 0; /* silence warning */
}
}
@@ -7146,8 +7151,8 @@ pg_start_backup(PG_FUNCTION_ARGS)
* have different checkpoint positions and hence different history
* file names, even if nothing happened in between.
*
- * We use CHECKPOINT_IMMEDIATE only if requested by user (via
- * passing fast = true). Otherwise this can take awhile.
+ * We use CHECKPOINT_IMMEDIATE only if requested by user (via passing
+ * fast = true). Otherwise this can take awhile.
*/
RequestCheckpoint(CHECKPOINT_FORCE | CHECKPOINT_WAIT |
(fast ? CHECKPOINT_IMMEDIATE : 0));
@@ -7376,9 +7381,9 @@ pg_stop_backup(PG_FUNCTION_ARGS)
* property of the WAL files ensures any earlier WAL files are safely
* archived as well.
*
- * We wait forever, since archive_command is supposed to work and
- * we assume the admin wanted his backup to work completely. If you
- * don't wish to wait, you can set statement_timeout.
+ * We wait forever, since archive_command is supposed to work and we
+ * assume the admin wanted his backup to work completely. If you don't
+ * wish to wait, you can set statement_timeout.
*/
XLByteToPrevSeg(stoppoint, _logId, _logSeg);
XLogFileName(lastxlogfilename, ThisTimeLineID, _logId, _logSeg);
@@ -7399,7 +7404,7 @@ pg_stop_backup(PG_FUNCTION_ARGS)
if (++waits >= seconds_before_warning)
{
- seconds_before_warning *= 2; /* This wraps in >10 years... */
+ seconds_before_warning *= 2; /* This wraps in >10 years... */
ereport(WARNING,
(errmsg("pg_stop_backup still waiting for archive to complete (%d seconds elapsed)",
waits)));
@@ -7775,7 +7780,7 @@ CancelBackup(void)
ereport(LOG,
(errmsg("online backup mode cancelled"),
errdetail("\"%s\" was renamed to \"%s\".",
- BACKUP_LABEL_FILE, BACKUP_LABEL_OLD)));
+ BACKUP_LABEL_FILE, BACKUP_LABEL_OLD)));
}
else
{
@@ -7783,12 +7788,12 @@ CancelBackup(void)
(errcode_for_file_access(),
errmsg("online backup mode was not cancelled"),
errdetail("Could not rename \"%s\" to \"%s\": %m.",
- BACKUP_LABEL_FILE, BACKUP_LABEL_OLD)));
+ BACKUP_LABEL_FILE, BACKUP_LABEL_OLD)));
}
}
/* ------------------------------------------------------
- * Startup Process main entry point and signal handlers
+ * Startup Process main entry point and signal handlers
* ------------------------------------------------------
*/
@@ -7818,8 +7823,8 @@ startupproc_quickdie(SIGNAL_ARGS)
* system reset cycle if some idiot DBA sends a manual SIGQUIT to a random
* backend. This is necessary precisely because we don't clean up our
* shared memory state. (The "dead man switch" mechanism in pmsignal.c
- * should ensure the postmaster sees this as a crash, too, but no harm
- * in being doubly sure.)
+ * should ensure the postmaster sees this as a crash, too, but no harm in
+ * being doubly sure.)
*/
exit(2);
}
@@ -7858,10 +7863,10 @@ StartupProcessMain(void)
/*
* Properly accept or ignore signals the postmaster might send us
*/
- pqsignal(SIGHUP, StartupProcSigHupHandler); /* reload config file */
- pqsignal(SIGINT, SIG_IGN); /* ignore query cancel */
- pqsignal(SIGTERM, StartupProcShutdownHandler); /* request shutdown */
- pqsignal(SIGQUIT, startupproc_quickdie); /* hard crash time */
+ pqsignal(SIGHUP, StartupProcSigHupHandler); /* reload config file */
+ pqsignal(SIGINT, SIG_IGN); /* ignore query cancel */
+ pqsignal(SIGTERM, StartupProcShutdownHandler); /* request shutdown */
+ pqsignal(SIGQUIT, startupproc_quickdie); /* hard crash time */
pqsignal(SIGALRM, SIG_IGN);
pqsignal(SIGPIPE, SIG_IGN);
pqsignal(SIGUSR1, SIG_IGN);
@@ -7881,13 +7886,13 @@ StartupProcessMain(void)
*/
PG_SETMASK(&UnBlockSig);
- StartupXLOG();
+ StartupXLOG();
BuildFlatFiles(false);
/*
- * Exit normally. Exit code 0 tells postmaster that we completed
- * recovery successfully.
+ * Exit normally. Exit code 0 tells postmaster that we completed recovery
+ * successfully.
*/
proc_exit(0);
}
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c
index 458af10ca1..8c6e339bf4 100644
--- a/src/backend/access/transam/xlogutils.c
+++ b/src/backend/access/transam/xlogutils.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.67 2009/01/20 18:59:37 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlogutils.c,v 1.68 2009/06/11 14:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -68,7 +68,8 @@ log_invalid_page(RelFileNode node, ForkNumber forkno, BlockNumber blkno,
*/
if (log_min_messages <= DEBUG1 || client_min_messages <= DEBUG1)
{
- char *path = relpath(node, forkno);
+ char *path = relpath(node, forkno);
+
if (present)
elog(DEBUG1, "page %u of relation %s is uninitialized",
blkno, path);
@@ -132,7 +133,8 @@ forget_invalid_pages(RelFileNode node, ForkNumber forkno, BlockNumber minblkno)
{
if (log_min_messages <= DEBUG2 || client_min_messages <= DEBUG2)
{
- char *path = relpath(hentry->key.node, forkno);
+ char *path = relpath(hentry->key.node, forkno);
+
elog(DEBUG2, "page %u of relation %s has been dropped",
hentry->key.blkno, path);
pfree(path);
@@ -164,7 +166,8 @@ forget_invalid_pages_db(Oid dbid)
{
if (log_min_messages <= DEBUG2 || client_min_messages <= DEBUG2)
{
- char *path = relpath(hentry->key.node, hentry->key.forkno);
+ char *path = relpath(hentry->key.node, hentry->key.forkno);
+
elog(DEBUG2, "page %u of relation %s has been dropped",
hentry->key.blkno, path);
pfree(path);
@@ -197,7 +200,8 @@ XLogCheckInvalidPages(void)
*/
while ((hentry = (xl_invalid_page *) hash_seq_search(&status)) != NULL)
{
- char *path = relpath(hentry->key.node, hentry->key.forkno);
+ char *path = relpath(hentry->key.node, hentry->key.forkno);
+
if (hentry->present)
elog(WARNING, "page %u of relation %s was uninitialized",
hentry->key.blkno, path);
@@ -237,7 +241,8 @@ XLogCheckInvalidPages(void)
Buffer
XLogReadBuffer(RelFileNode rnode, BlockNumber blkno, bool init)
{
- Buffer buf;
+ Buffer buf;
+
buf = XLogReadBufferExtended(rnode, MAIN_FORKNUM, blkno,
init ? RBM_ZERO : RBM_NORMAL);
if (BufferIsValid(buf))
@@ -344,8 +349,8 @@ XLogReadBufferExtended(RelFileNode rnode, ForkNumber forknum,
*/
typedef struct
{
- RelationData reldata; /* Note: this must be first */
- FormData_pg_class pgc;
+ RelationData reldata; /* Note: this must be first */
+ FormData_pg_class pgc;
} FakeRelCacheEntryData;
typedef FakeRelCacheEntryData *FakeRelCacheEntry;
@@ -354,10 +359,10 @@ typedef FakeRelCacheEntryData *FakeRelCacheEntry;
* Create a fake relation cache entry for a physical relation
*
* It's often convenient to use the same functions in XLOG replay as in the
- * main codepath, but those functions typically work with a relcache entry.
- * We don't have a working relation cache during XLOG replay, but this
- * function can be used to create a fake relcache entry instead. Only the
- * fields related to physical storage, like rd_rel, are initialized, so the
+ * main codepath, but those functions typically work with a relcache entry.
+ * We don't have a working relation cache during XLOG replay, but this
+ * function can be used to create a fake relcache entry instead. Only the
+ * fields related to physical storage, like rd_rel, are initialized, so the
* fake entry is only usable in low-level operations like ReadBuffer().
*
* Caller must free the returned entry with FreeFakeRelcacheEntry().
@@ -366,7 +371,7 @@ Relation
CreateFakeRelcacheEntry(RelFileNode rnode)
{
FakeRelCacheEntry fakeentry;
- Relation rel;
+ Relation rel;
/* Allocate the Relation struct and all related space in one block. */
fakeentry = palloc0(sizeof(FakeRelCacheEntryData));
@@ -381,9 +386,9 @@ CreateFakeRelcacheEntry(RelFileNode rnode)
/*
* We set up the lockRelId in case anything tries to lock the dummy
* relation. Note that this is fairly bogus since relNode may be
- * different from the relation's OID. It shouldn't really matter
- * though, since we are presumably running by ourselves and can't have
- * any lock conflicts ...
+ * different from the relation's OID. It shouldn't really matter though,
+ * since we are presumably running by ourselves and can't have any lock
+ * conflicts ...
*/
rel->rd_lockInfo.lockRelId.dbId = rnode.dbNode;
rel->rd_lockInfo.lockRelId.relId = rnode.relNode;
@@ -427,10 +432,9 @@ XLogDropDatabase(Oid dbid)
{
/*
* This is unnecessarily heavy-handed, as it will close SMgrRelation
- * objects for other databases as well. DROP DATABASE occurs seldom
- * enough that it's not worth introducing a variant of smgrclose for
- * just this purpose. XXX: Or should we rather leave the smgr entries
- * dangling?
+ * objects for other databases as well. DROP DATABASE occurs seldom enough
+ * that it's not worth introducing a variant of smgrclose for just this
+ * purpose. XXX: Or should we rather leave the smgr entries dangling?
*/
smgrcloseall();
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index 2924dddf62..bb15e78d1c 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.153 2009/02/06 21:15:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/aclchk.c,v 1.154 2009/06/11 14:48:54 momjian Exp $
*
* NOTES
* See acl.h.
@@ -62,13 +62,13 @@ static void ExecGrant_Tablespace(InternalGrant *grantStmt);
static List *objectNamesToOids(GrantObjectType objtype, List *objnames);
static void expand_col_privileges(List *colnames, Oid table_oid,
- AclMode this_privileges,
- AclMode *col_privileges,
- int num_col_privileges);
+ AclMode this_privileges,
+ AclMode *col_privileges,
+ int num_col_privileges);
static void expand_all_col_privileges(Oid table_oid, Form_pg_class classForm,
- AclMode this_privileges,
- AclMode *col_privileges,
- int num_col_privileges);
+ AclMode this_privileges,
+ AclMode *col_privileges,
+ int num_col_privileges);
static AclMode string_to_privilege(const char *privname);
static const char *privilege_to_string(AclMode privilege);
static AclMode restrict_and_check_grant(bool is_grant, AclMode avail_goptions,
@@ -77,7 +77,7 @@ static AclMode restrict_and_check_grant(bool is_grant, AclMode avail_goptions,
AclObjectKind objkind, const char *objname,
AttrNumber att_number, const char *colname);
static AclMode pg_aclmask(AclObjectKind objkind, Oid table_oid, AttrNumber attnum,
- Oid roleid, AclMode mask, AclMaskHow how);
+ Oid roleid, AclMode mask, AclMaskHow how);
#ifdef ACLDEBUG
@@ -127,7 +127,7 @@ merge_acl_with_grant(Acl *old_acl, bool is_grant,
AclItem aclitem;
Acl *newer_acl;
- aclitem.ai_grantee = lfirst_oid(j);
+ aclitem. ai_grantee = lfirst_oid(j);
/*
* Grant options can only be granted to individual roles, not PUBLIC.
@@ -140,7 +140,7 @@ merge_acl_with_grant(Acl *old_acl, bool is_grant,
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
errmsg("grant options can only be granted to roles")));
- aclitem.ai_grantor = grantorId;
+ aclitem. ai_grantor = grantorId;
/*
* The asymmetry in the conditions here comes from the spec. In
@@ -314,8 +314,8 @@ ExecuteGrantStmt(GrantStmt *stmt)
}
/*
- * Convert stmt->privileges, a list of AccessPriv nodes, into an
- * AclMode bitmask. Note: objtype can't be ACL_OBJECT_COLUMN.
+ * Convert stmt->privileges, a list of AccessPriv nodes, into an AclMode
+ * bitmask. Note: objtype can't be ACL_OBJECT_COLUMN.
*/
switch (stmt->objtype)
{
@@ -389,8 +389,8 @@ ExecuteGrantStmt(GrantStmt *stmt)
AclMode priv;
/*
- * If it's a column-level specification, we just set it aside
- * in col_privs for the moment; but insist it's for a relation.
+ * If it's a column-level specification, we just set it aside in
+ * col_privs for the moment; but insist it's for a relation.
*/
if (privnode->cols)
{
@@ -402,7 +402,7 @@ ExecuteGrantStmt(GrantStmt *stmt)
continue;
}
- if (privnode->priv_name == NULL) /* parser mistake? */
+ if (privnode->priv_name == NULL) /* parser mistake? */
elog(ERROR, "AccessPriv node must specify privilege or columns");
priv = string_to_privilege(privnode->priv_name);
@@ -421,7 +421,7 @@ ExecuteGrantStmt(GrantStmt *stmt)
/*
* ExecGrantStmt_oids
*
- * "Internal" entrypoint for granting and revoking privileges. This is
+ * "Internal" entrypoint for granting and revoking privileges. This is
* exported for pg_shdepend.c to use in revoking privileges when dropping
* a role.
*/
@@ -586,8 +586,8 @@ objectNamesToOids(GrantObjectType objtype, List *objnames)
case ACL_OBJECT_FDW:
foreach(cell, objnames)
{
- char *fdwname = strVal(lfirst(cell));
- Oid fdwid = GetForeignDataWrapperOidByName(fdwname, false);
+ char *fdwname = strVal(lfirst(cell));
+ Oid fdwid = GetForeignDataWrapperOidByName(fdwname, false);
objects = lappend_oid(objects, fdwid);
}
@@ -595,8 +595,8 @@ objectNamesToOids(GrantObjectType objtype, List *objnames)
case ACL_OBJECT_FOREIGN_SERVER:
foreach(cell, objnames)
{
- char *srvname = strVal(lfirst(cell));
- Oid srvid = GetForeignServerOidByName(srvname, false);
+ char *srvname = strVal(lfirst(cell));
+ Oid srvid = GetForeignServerOidByName(srvname, false);
objects = lappend_oid(objects, srvid);
}
@@ -637,7 +637,7 @@ expand_col_privileges(List *colnames, Oid table_oid,
colname, get_rel_name(table_oid))));
attnum -= FirstLowInvalidHeapAttributeNumber;
if (attnum <= 0 || attnum >= num_col_privileges)
- elog(ERROR, "column number out of range"); /* safety check */
+ elog(ERROR, "column number out of range"); /* safety check */
col_privileges[attnum] |= this_privileges;
}
}
@@ -705,24 +705,24 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
AttrNumber attnum, Oid ownerId, AclMode col_privileges,
Relation attRelation, const Acl *old_rel_acl)
{
- HeapTuple attr_tuple;
- Form_pg_attribute pg_attribute_tuple;
- Acl *old_acl;
- Acl *new_acl;
- Acl *merged_acl;
- Datum aclDatum;
- bool isNull;
- Oid grantorId;
- AclMode avail_goptions;
- bool need_update;
- HeapTuple newtuple;
- Datum values[Natts_pg_attribute];
- bool nulls[Natts_pg_attribute];
- bool replaces[Natts_pg_attribute];
- int noldmembers;
- int nnewmembers;
- Oid *oldmembers;
- Oid *newmembers;
+ HeapTuple attr_tuple;
+ Form_pg_attribute pg_attribute_tuple;
+ Acl *old_acl;
+ Acl *new_acl;
+ Acl *merged_acl;
+ Datum aclDatum;
+ bool isNull;
+ Oid grantorId;
+ AclMode avail_goptions;
+ bool need_update;
+ HeapTuple newtuple;
+ Datum values[Natts_pg_attribute];
+ bool nulls[Natts_pg_attribute];
+ bool replaces[Natts_pg_attribute];
+ int noldmembers;
+ int nnewmembers;
+ Oid *oldmembers;
+ Oid *newmembers;
attr_tuple = SearchSysCache(ATTNUM,
ObjectIdGetDatum(relOid),
@@ -734,8 +734,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
pg_attribute_tuple = (Form_pg_attribute) GETSTRUCT(attr_tuple);
/*
- * Get working copy of existing ACL. If there's no ACL,
- * substitute the proper default.
+ * Get working copy of existing ACL. If there's no ACL, substitute the
+ * proper default.
*/
aclDatum = SysCacheGetAttr(ATTNUM, attr_tuple, Anum_pg_attribute_attacl,
&isNull);
@@ -747,8 +747,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
/*
* In select_best_grantor we should consider existing table-level ACL bits
* as well as the per-column ACL. Build a new ACL that is their
- * concatenation. (This is a bit cheap and dirty compared to merging
- * them properly with no duplications, but it's all we need here.)
+ * concatenation. (This is a bit cheap and dirty compared to merging them
+ * properly with no duplications, but it's all we need here.)
*/
merged_acl = aclconcat(old_rel_acl, old_acl);
@@ -760,12 +760,12 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
pfree(merged_acl);
/*
- * Restrict the privileges to what we can actually grant, and emit
- * the standards-mandated warning and error messages. Note: we don't
- * track whether the user actually used the ALL PRIVILEGES(columns)
- * syntax for each column; we just approximate it by whether all the
- * possible privileges are specified now. Since the all_privs flag only
- * determines whether a warning is issued, this seems close enough.
+ * Restrict the privileges to what we can actually grant, and emit the
+ * standards-mandated warning and error messages. Note: we don't track
+ * whether the user actually used the ALL PRIVILEGES(columns) syntax for
+ * each column; we just approximate it by whether all the possible
+ * privileges are specified now. Since the all_privs flag only determines
+ * whether a warning is issued, this seems close enough.
*/
col_privileges =
restrict_and_check_grant(istmt->is_grant, avail_goptions,
@@ -778,8 +778,8 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
/*
* Generate new ACL.
*
- * We need the members of both old and new ACLs so we can correct
- * the shared dependency information.
+ * We need the members of both old and new ACLs so we can correct the
+ * shared dependency information.
*/
noldmembers = aclmembers(old_acl, &oldmembers);
@@ -797,11 +797,11 @@ ExecGrant_Attribute(InternalGrant *istmt, Oid relOid, const char *relname,
MemSet(replaces, false, sizeof(replaces));
/*
- * If the updated ACL is empty, we can set attacl to null, and maybe
- * even avoid an update of the pg_attribute row. This is worth testing
- * because we'll come through here multiple times for any relation-level
- * REVOKE, even if there were never any column GRANTs. Note we are
- * assuming that the "default" ACL state for columns is empty.
+ * If the updated ACL is empty, we can set attacl to null, and maybe even
+ * avoid an update of the pg_attribute row. This is worth testing because
+ * we'll come through here multiple times for any relation-level REVOKE,
+ * even if there were never any column GRANTs. Note we are assuming that
+ * the "default" ACL state for columns is empty.
*/
if (ACL_NUM(new_acl) > 0)
{
@@ -857,7 +857,7 @@ ExecGrant_Relation(InternalGrant *istmt)
Form_pg_class pg_class_tuple;
bool isNull;
AclMode this_privileges;
- AclMode *col_privileges;
+ AclMode *col_privileges;
int num_col_privileges;
bool have_col_privileges;
Acl *old_acl;
@@ -954,7 +954,7 @@ ExecGrant_Relation(InternalGrant *istmt)
/*
* Set up array in which we'll accumulate any column privilege bits
- * that need modification. The array is indexed such that entry [0]
+ * that need modification. The array is indexed such that entry [0]
* corresponds to FirstLowInvalidHeapAttributeNumber.
*/
num_col_privileges = pg_class_tuple->relnatts - FirstLowInvalidHeapAttributeNumber + 1;
@@ -1025,7 +1025,7 @@ ExecGrant_Relation(InternalGrant *istmt)
restrict_and_check_grant(istmt->is_grant, avail_goptions,
istmt->all_privs, this_privileges,
relOid, grantorId,
- pg_class_tuple->relkind == RELKIND_SEQUENCE
+ pg_class_tuple->relkind == RELKIND_SEQUENCE
? ACL_KIND_SEQUENCE : ACL_KIND_CLASS,
NameStr(pg_class_tuple->relname),
0, NULL);
@@ -1081,7 +1081,7 @@ ExecGrant_Relation(InternalGrant *istmt)
*/
foreach(cell_colprivs, istmt->col_privs)
{
- AccessPriv *col_privs = (AccessPriv *) lfirst(cell_colprivs);
+ AccessPriv *col_privs = (AccessPriv *) lfirst(cell_colprivs);
if (col_privs->priv_name == NULL)
this_privileges = ACL_ALL_RIGHTS_COLUMN;
@@ -1099,8 +1099,8 @@ ExecGrant_Relation(InternalGrant *istmt)
{
/*
* The only column privilege allowed on sequences is SELECT.
- * This is a warning not error because we do it that way
- * for relation-level privileges.
+ * This is a warning not error because we do it that way for
+ * relation-level privileges.
*/
ereport(WARNING,
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
@@ -1119,7 +1119,7 @@ ExecGrant_Relation(InternalGrant *istmt)
if (have_col_privileges)
{
- AttrNumber i;
+ AttrNumber i;
for (i = 0; i < num_col_privileges; i++)
{
@@ -1385,7 +1385,8 @@ ExecGrant_Fdw(InternalGrant *istmt)
heap_close(relation, RowExclusiveLock);
}
-static void ExecGrant_ForeignServer(InternalGrant *istmt)
+static void
+ExecGrant_ForeignServer(InternalGrant *istmt)
{
Relation relation;
ListCell *cell;
@@ -1450,7 +1451,7 @@ static void ExecGrant_ForeignServer(InternalGrant *istmt)
this_privileges =
restrict_and_check_grant(istmt->is_grant, avail_goptions,
istmt->all_privs, istmt->privileges,
- srvid, grantorId, ACL_KIND_FOREIGN_SERVER,
+ srvid, grantorId, ACL_KIND_FOREIGN_SERVER,
NameStr(pg_server_tuple->srvname),
0, NULL);
@@ -2274,7 +2275,7 @@ pg_aclmask(AclObjectKind objkind, Oid table_oid, AttrNumber attnum, Oid roleid,
*
* Note: this considers only privileges granted specifically on the column.
* It is caller's responsibility to take relation-level privileges into account
- * as appropriate. (For the same reason, we have no special case for
+ * as appropriate. (For the same reason, we have no special case for
* superuser-ness here.)
*/
AclMode
@@ -2316,9 +2317,9 @@ pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, Oid roleid,
&isNull);
/*
- * Here we hard-wire knowledge that the default ACL for a column
- * grants no privileges, so that we can fall out quickly in the
- * very common case where attacl is null.
+ * Here we hard-wire knowledge that the default ACL for a column grants no
+ * privileges, so that we can fall out quickly in the very common case
+ * where attacl is null.
*/
if (isNull)
{
@@ -2328,11 +2329,11 @@ pg_attribute_aclmask(Oid table_oid, AttrNumber attnum, Oid roleid,
/*
* Must get the relation's ownerId from pg_class. Since we already found
- * a pg_attribute entry, the only likely reason for this to fail is that
- * a concurrent DROP of the relation committed since then (which could
- * only happen if we don't have lock on the relation). We prefer to
- * report "no privileges" rather than failing in such a case, so as to
- * avoid unwanted failures in has_column_privilege() tests.
+ * a pg_attribute entry, the only likely reason for this to fail is that a
+ * concurrent DROP of the relation committed since then (which could only
+ * happen if we don't have lock on the relation). We prefer to report "no
+ * privileges" rather than failing in such a case, so as to avoid unwanted
+ * failures in has_column_privilege() tests.
*/
classTuple = SearchSysCache(RELOID,
ObjectIdGetDatum(table_oid),
@@ -2804,7 +2805,7 @@ pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid,
0, 0, 0);
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
- (errmsg("foreign-data wrapper with OID %u does not exist",
+ (errmsg("foreign-data wrapper with OID %u does not exist",
fdw_oid)));
fdwForm = (Form_pg_foreign_data_wrapper) GETSTRUCT(tuple);
@@ -2844,7 +2845,7 @@ pg_foreign_data_wrapper_aclmask(Oid fdw_oid, Oid roleid,
*/
AclMode
pg_foreign_server_aclmask(Oid srv_oid, Oid roleid,
- AclMode mask, AclMaskHow how)
+ AclMode mask, AclMaskHow how)
{
AclMode result;
HeapTuple tuple;
@@ -2867,7 +2868,7 @@ pg_foreign_server_aclmask(Oid srv_oid, Oid roleid,
0, 0, 0);
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
- (errmsg("foreign server with OID %u does not exist",
+ (errmsg("foreign server with OID %u does not exist",
srv_oid)));
srvForm = (Form_pg_foreign_server) GETSTRUCT(tuple);
@@ -2944,16 +2945,16 @@ AclResult
pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode,
AclMaskHow how)
{
- AclResult result;
- HeapTuple classTuple;
- Form_pg_class classForm;
- AttrNumber nattrs;
- AttrNumber curr_att;
+ AclResult result;
+ HeapTuple classTuple;
+ Form_pg_class classForm;
+ AttrNumber nattrs;
+ AttrNumber curr_att;
/*
* Must fetch pg_class row to check number of attributes. As in
- * pg_attribute_aclmask, we prefer to return "no privileges" instead
- * of throwing an error if we get any unexpected lookup errors.
+ * pg_attribute_aclmask, we prefer to return "no privileges" instead of
+ * throwing an error if we get any unexpected lookup errors.
*/
classTuple = SearchSysCache(RELOID,
ObjectIdGetDatum(table_oid),
@@ -2967,8 +2968,8 @@ pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode,
ReleaseSysCache(classTuple);
/*
- * Initialize result in case there are no non-dropped columns. We want
- * to report failure in such cases for either value of 'how'.
+ * Initialize result in case there are no non-dropped columns. We want to
+ * report failure in such cases for either value of 'how'.
*/
result = ACLCHECK_NO_PRIV;
@@ -2993,8 +2994,8 @@ pg_attribute_aclcheck_all(Oid table_oid, Oid roleid, AclMode mode,
/*
* Here we hard-wire knowledge that the default ACL for a column
- * grants no privileges, so that we can fall out quickly in the
- * very common case where attacl is null.
+ * grants no privileges, so that we can fall out quickly in the very
+ * common case where attacl is null.
*/
if (heap_attisnull(attTuple, Anum_pg_attribute_attacl))
attmask = 0;
@@ -3466,8 +3467,8 @@ pg_foreign_server_ownercheck(Oid srv_oid, Oid roleid)
if (!HeapTupleIsValid(tuple))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("foreign server with OID %u does not exist",
- srv_oid)));
+ errmsg("foreign server with OID %u does not exist",
+ srv_oid)));
ownerId = ((Form_pg_foreign_server) GETSTRUCT(tuple))->srvowner;
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index a4a527f963..42371d5137 100644
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.82 2009/03/25 14:11:48 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/catalog.c,v 1.83 2009/06/11 14:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,8 +42,8 @@
#include "utils/tqual.h"
-#define OIDCHARS 10 /* max chars printed by %u */
-#define FORKNAMECHARS 4 /* max chars for a fork name */
+#define OIDCHARS 10 /* max chars printed by %u */
+#define FORKNAMECHARS 4 /* max chars for a fork name */
/*
* Lookup table of fork name by fork number.
@@ -53,9 +53,9 @@
* up-to-date.
*/
const char *forkNames[] = {
- "main", /* MAIN_FORKNUM */
- "fsm", /* FSM_FORKNUM */
- "vm" /* VISIBILITYMAP_FORKNUM */
+ "main", /* MAIN_FORKNUM */
+ "fsm", /* FSM_FORKNUM */
+ "vm" /* VISIBILITYMAP_FORKNUM */
};
/*
@@ -64,7 +64,7 @@ const char *forkNames[] = {
ForkNumber
forkname_to_number(char *forkName)
{
- ForkNumber forkNum;
+ ForkNumber forkNum;
for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++)
if (strcmp(forkNames[forkNum], forkName) == 0)
@@ -74,7 +74,7 @@ forkname_to_number(char *forkName)
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid fork name"),
errhint("Valid fork names are \"main\", \"fsm\", and \"vm\".")));
- return InvalidForkNumber; /* keep compiler quiet */
+ return InvalidForkNumber; /* keep compiler quiet */
}
/*
@@ -407,7 +407,7 @@ GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
{
Oid newOid;
SnapshotData SnapshotDirty;
- SysScanDesc scan;
+ SysScanDesc scan;
ScanKeyData key;
bool collides;
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index 377ae8b712..8181cae64a 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.88 2009/06/04 18:33:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.89 2009/06/11 14:48:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -94,7 +94,7 @@ typedef struct
struct ObjectAddresses
{
ObjectAddress *refs; /* => palloc'd array */
- ObjectAddressExtra *extras; /* => palloc'd array, or NULL if not used */
+ ObjectAddressExtra *extras; /* => palloc'd array, or NULL if not used */
int numrefs; /* current number of references */
int maxrefs; /* current size of palloc'd array(s) */
};
@@ -104,9 +104,9 @@ struct ObjectAddresses
/* threaded list of ObjectAddresses, for recursion detection */
typedef struct ObjectAddressStack
{
- const ObjectAddress *object; /* object being visited */
+ const ObjectAddress *object; /* object being visited */
int flags; /* its current flag bits */
- struct ObjectAddressStack *next; /* next outer stack level */
+ struct ObjectAddressStack *next; /* next outer stack level */
} ObjectAddressStack;
/* for find_expr_references_walker */
@@ -171,8 +171,8 @@ static void add_exact_object_address_extra(const ObjectAddress *object,
const ObjectAddressExtra *extra,
ObjectAddresses *addrs);
static bool object_address_present_add_flags(const ObjectAddress *object,
- int flags,
- ObjectAddresses *addrs);
+ int flags,
+ ObjectAddresses *addrs);
static void getRelationDescription(StringInfo buffer, Oid relid);
static void getOpFamilyDescription(StringInfo buffer, Oid opfid);
@@ -204,7 +204,7 @@ performDeletion(const ObjectAddress *object,
depRel = heap_open(DependRelationId, RowExclusiveLock);
/*
- * Acquire deletion lock on the target object. (Ideally the caller has
+ * Acquire deletion lock on the target object. (Ideally the caller has
* done this already, but many places are sloppy about it.)
*/
AcquireDeletionLock(object);
@@ -276,10 +276,10 @@ performMultipleDeletions(const ObjectAddresses *objects,
/*
* Construct a list of objects to delete (ie, the given objects plus
* everything directly or indirectly dependent on them). Note that
- * because we pass the whole objects list as pendingObjects context,
- * we won't get a failure from trying to delete an object that is
- * internally dependent on another one in the list; we'll just skip
- * that object and delete it when we reach its owner.
+ * because we pass the whole objects list as pendingObjects context, we
+ * won't get a failure from trying to delete an object that is internally
+ * dependent on another one in the list; we'll just skip that object and
+ * delete it when we reach its owner.
*/
targetObjects = new_object_addresses();
@@ -295,7 +295,7 @@ performMultipleDeletions(const ObjectAddresses *objects,
findDependentObjects(thisobj,
DEPFLAG_ORIGINAL,
- NULL, /* empty stack */
+ NULL, /* empty stack */
targetObjects,
objects,
depRel);
@@ -304,8 +304,8 @@ performMultipleDeletions(const ObjectAddresses *objects,
/*
* Check if deletion is allowed, and report about cascaded deletes.
*
- * If there's exactly one object being deleted, report it the same
- * way as in performDeletion(), else we have to be vaguer.
+ * If there's exactly one object being deleted, report it the same way as
+ * in performDeletion(), else we have to be vaguer.
*/
reportDependentObjects(targetObjects,
behavior,
@@ -352,7 +352,7 @@ deleteWhatDependsOn(const ObjectAddress *object,
depRel = heap_open(DependRelationId, RowExclusiveLock);
/*
- * Acquire deletion lock on the target object. (Ideally the caller has
+ * Acquire deletion lock on the target object. (Ideally the caller has
* done this already, but many places are sloppy about it.)
*/
AcquireDeletionLock(object);
@@ -404,7 +404,7 @@ deleteWhatDependsOn(const ObjectAddress *object,
*
* For every object that depends on the starting object, acquire a deletion
* lock on the object, add it to targetObjects (if not already there),
- * and recursively find objects that depend on it. An object's dependencies
+ * and recursively find objects that depend on it. An object's dependencies
* will be placed into targetObjects before the object itself; this means
* that the finished list's order represents a safe deletion order.
*
@@ -446,8 +446,8 @@ findDependentObjects(const ObjectAddress *object,
/*
* If the target object is already being visited in an outer recursion
- * level, just report the current flags back to that level and exit.
- * This is needed to avoid infinite recursion in the face of circular
+ * level, just report the current flags back to that level and exit. This
+ * is needed to avoid infinite recursion in the face of circular
* dependencies.
*
* The stack check alone would result in dependency loops being broken at
@@ -457,7 +457,7 @@ findDependentObjects(const ObjectAddress *object,
* will not break a loop at an internal dependency: if we enter the loop
* at an "owned" object we will switch and start at the "owning" object
* instead. We could probably hack something up to avoid breaking at an
- * auto dependency, too, if we had to. However there are no known cases
+ * auto dependency, too, if we had to. However there are no known cases
* where that would be necessary.
*/
for (stackptr = stack; stackptr; stackptr = stackptr->next)
@@ -470,6 +470,7 @@ findDependentObjects(const ObjectAddress *object,
stackptr->flags |= flags;
return;
}
+
/*
* Could visit column with whole table already on stack; this is
* the same case noted in object_address_present_add_flags().
@@ -487,8 +488,8 @@ findDependentObjects(const ObjectAddress *object,
* specified flags to its entry and return.
*
* (Note: in these early-exit cases we could release the caller-taken
- * lock, since the object is presumably now locked multiple times;
- * but it seems not worth the cycles.)
+ * lock, since the object is presumably now locked multiple times; but it
+ * seems not worth the cycles.)
*/
if (object_address_present_add_flags(object, flags, targetObjects))
return;
@@ -499,7 +500,7 @@ findDependentObjects(const ObjectAddress *object,
* object, we have to transform this deletion request into a deletion
* request of the owning object. (We'll eventually recurse back to this
* object, but the owning object has to be visited first so it will be
- * deleted after.) The way to find out about this is to scan the
+ * deleted after.) The way to find out about this is to scan the
* pg_depend entries that show what this object depends on.
*/
ScanKeyInit(&key[0],
@@ -546,10 +547,10 @@ findDependentObjects(const ObjectAddress *object,
*
* 1. At the outermost recursion level, disallow the DROP. (We
* just ereport here, rather than proceeding, since no other
- * dependencies are likely to be interesting.) However, if
+ * dependencies are likely to be interesting.) However, if
* the other object is listed in pendingObjects, just release
- * the caller's lock and return; we'll eventually complete
- * the DROP when we reach that entry in the pending list.
+ * the caller's lock and return; we'll eventually complete the
+ * DROP when we reach that entry in the pending list.
*/
if (stack == NULL)
{
@@ -597,8 +598,8 @@ findDependentObjects(const ObjectAddress *object,
AcquireDeletionLock(&otherObject);
/*
- * The other object might have been deleted while we waited
- * to lock it; if so, neither it nor the current object are
+ * The other object might have been deleted while we waited to
+ * lock it; if so, neither it nor the current object are
* interesting anymore. We test this by checking the
* pg_depend entry (see notes below).
*/
@@ -610,10 +611,10 @@ findDependentObjects(const ObjectAddress *object,
}
/*
- * Okay, recurse to the other object instead of proceeding.
- * We treat this exactly as if the original reference had
- * linked to that object instead of this one; hence, pass
- * through the same flags and stack.
+ * Okay, recurse to the other object instead of proceeding. We
+ * treat this exactly as if the original reference had linked
+ * to that object instead of this one; hence, pass through the
+ * same flags and stack.
*/
findDependentObjects(&otherObject,
flags,
@@ -643,8 +644,8 @@ findDependentObjects(const ObjectAddress *object,
systable_endscan(scan);
/*
- * Now recurse to any dependent objects. We must visit them first
- * since they have to be deleted before the current object.
+ * Now recurse to any dependent objects. We must visit them first since
+ * they have to be deleted before the current object.
*/
mystack.object = object; /* set up a new stack level */
mystack.flags = flags;
@@ -675,7 +676,7 @@ findDependentObjects(const ObjectAddress *object,
while (HeapTupleIsValid(tup = systable_getnext(scan)))
{
Form_pg_depend foundDep = (Form_pg_depend) GETSTRUCT(tup);
- int subflags;
+ int subflags;
otherObject.classId = foundDep->classid;
otherObject.objectId = foundDep->objid;
@@ -687,11 +688,11 @@ findDependentObjects(const ObjectAddress *object,
AcquireDeletionLock(&otherObject);
/*
- * The dependent object might have been deleted while we waited
- * to lock it; if so, we don't need to do anything more with it.
- * We can test this cheaply and independently of the object's type
- * by seeing if the pg_depend tuple we are looking at is still live.
- * (If the object got deleted, the tuple would have been deleted too.)
+ * The dependent object might have been deleted while we waited to
+ * lock it; if so, we don't need to do anything more with it. We can
+ * test this cheaply and independently of the object's type by seeing
+ * if the pg_depend tuple we are looking at is still live. (If the
+ * object got deleted, the tuple would have been deleted too.)
*/
if (!systable_recheck_tuple(scan, tup))
{
@@ -743,9 +744,9 @@ findDependentObjects(const ObjectAddress *object,
systable_endscan(scan);
/*
- * Finally, we can add the target object to targetObjects. Be careful
- * to include any flags that were passed back down to us from inner
- * recursion levels.
+ * Finally, we can add the target object to targetObjects. Be careful to
+ * include any flags that were passed back down to us from inner recursion
+ * levels.
*/
extra.flags = mystack.flags;
if (stack)
@@ -782,8 +783,8 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
int i;
/*
- * If no error is to be thrown, and the msglevel is too low to be shown
- * to either client or server log, there's no need to do any of the work.
+ * If no error is to be thrown, and the msglevel is too low to be shown to
+ * either client or server log, there's no need to do any of the work.
*
* Note: this code doesn't know all there is to be known about elog
* levels, but it works for NOTICE and DEBUG2, which are the only values
@@ -822,16 +823,16 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
objDesc = getObjectDescription(obj);
/*
- * If, at any stage of the recursive search, we reached the object
- * via an AUTO or INTERNAL dependency, then it's okay to delete it
- * even in RESTRICT mode.
+ * If, at any stage of the recursive search, we reached the object via
+ * an AUTO or INTERNAL dependency, then it's okay to delete it even in
+ * RESTRICT mode.
*/
if (extra->flags & (DEPFLAG_AUTO | DEPFLAG_INTERNAL))
{
/*
- * auto-cascades are reported at DEBUG2, not msglevel. We
- * don't try to combine them with the regular message because
- * the results are too confusing when client_min_messages and
+ * auto-cascades are reported at DEBUG2, not msglevel. We don't
+ * try to combine them with the regular message because the
+ * results are too confusing when client_min_messages and
* log_min_messages are different.
*/
ereport(DEBUG2,
@@ -840,7 +841,7 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
}
else if (behavior == DROP_RESTRICT)
{
- char *otherDesc = getObjectDescription(&extra->dependee);
+ char *otherDesc = getObjectDescription(&extra->dependee);
if (numReportedClient < MAX_REPORTED_DEPS)
{
@@ -897,8 +898,8 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
if (origObject)
ereport(ERROR,
(errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
- errmsg("cannot drop %s because other objects depend on it",
- getObjectDescription(origObject)),
+ errmsg("cannot drop %s because other objects depend on it",
+ getObjectDescription(origObject)),
errdetail("%s", clientdetail.data),
errdetail_log("%s", logdetail.data),
errhint("Use DROP ... CASCADE to drop the dependent objects too.")));
@@ -913,7 +914,7 @@ reportDependentObjects(const ObjectAddresses *targetObjects,
else if (numReportedClient > 1)
{
ereport(msglevel,
- /* translator: %d always has a value larger than 1 */
+ /* translator: %d always has a value larger than 1 */
(errmsg_plural("drop cascades to %d other object",
"drop cascades to %d other objects",
numReportedClient + numNotReportedClient,
@@ -947,7 +948,7 @@ deleteOneObject(const ObjectAddress *object, Relation depRel)
/*
* First remove any pg_depend records that link from this object to
- * others. (Any records linking to this object should be gone already.)
+ * others. (Any records linking to this object should be gone already.)
*
* When dropping a whole object (subId = 0), remove all pg_depend records
* for its sub-objects too.
@@ -982,8 +983,8 @@ deleteOneObject(const ObjectAddress *object, Relation depRel)
systable_endscan(scan);
/*
- * Delete shared dependency references related to this object. Again,
- * if subId = 0, remove records for sub-objects too.
+ * Delete shared dependency references related to this object. Again, if
+ * subId = 0, remove records for sub-objects too.
*/
deleteSharedDependencyRecordsFor(object->classId, object->objectId,
object->objectSubId);
@@ -1651,9 +1652,9 @@ eliminate_duplicate_dependencies(ObjectAddresses *addrs)
newrefs;
/*
- * We can't sort if the array has "extra" data, because there's no way
- * to keep it in sync. Fortunately that combination of features is
- * not needed.
+ * We can't sort if the array has "extra" data, because there's no way to
+ * keep it in sync. Fortunately that combination of features is not
+ * needed.
*/
Assert(!addrs->extras);
@@ -1828,7 +1829,7 @@ add_exact_object_address_extra(const ObjectAddress *object,
addrs->refs = (ObjectAddress *)
repalloc(addrs->refs, addrs->maxrefs * sizeof(ObjectAddress));
addrs->extras = (ObjectAddressExtra *)
- repalloc(addrs->extras, addrs->maxrefs * sizeof(ObjectAddressExtra));
+ repalloc(addrs->extras, addrs->maxrefs * sizeof(ObjectAddressExtra));
}
/* record this item */
item = addrs->refs + addrs->numrefs;
@@ -1894,7 +1895,7 @@ object_address_present_add_flags(const ObjectAddress *object,
{
/*
* We get here if we find a need to delete a column after
- * having already decided to drop its whole table. Obviously
+ * having already decided to drop its whole table. Obviously
* we no longer need to drop the column. But don't plaster
* its flags on the table.
*/
@@ -2136,7 +2137,7 @@ getObjectDescription(const ObjectAddress *object)
if (OidIsValid(con->conrelid))
{
- StringInfoData rel;
+ StringInfoData rel;
initStringInfo(&rel);
getRelationDescription(&rel, con->conrelid);
@@ -2304,10 +2305,11 @@ getObjectDescription(const ObjectAddress *object)
initStringInfo(&opfam);
getOpFamilyDescription(&opfam, amopForm->amopfamily);
+
/*
* translator: %d is the operator strategy (a number), the
- * first %s is the textual form of the operator, and the second
- * %s is the description of the operator family.
+ * first %s is the textual form of the operator, and the
+ * second %s is the description of the operator family.
*/
appendStringInfo(&buffer, _("operator %d %s of %s"),
amopForm->amopstrategy,
@@ -2350,6 +2352,7 @@ getObjectDescription(const ObjectAddress *object)
initStringInfo(&opfam);
getOpFamilyDescription(&opfam, amprocForm->amprocfamily);
+
/*
* translator: %d is the function number, the first %s is the
* textual form of the function with arguments, and the second
@@ -2563,9 +2566,9 @@ getObjectDescription(const ObjectAddress *object)
case OCLASS_USER_MAPPING:
{
- HeapTuple tup;
- Oid useid;
- char *usename;
+ HeapTuple tup;
+ Oid useid;
+ char *usename;
tup = SearchSysCache(USERMAPPINGOID,
ObjectIdGetDatum(object->objectId),
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index bc03ef6033..f4cf829b46 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.353 2009/04/19 19:46:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.354 2009/06/11 14:48:54 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -83,10 +83,10 @@ static Oid AddNewRelationType(const char *typeName,
Oid new_array_type);
static void RelationRemoveInheritance(Oid relid);
static void StoreRelCheck(Relation rel, char *ccname, Node *expr,
- bool is_local, int inhcount);
+ bool is_local, int inhcount);
static void StoreConstraints(Relation rel, List *cooked_constraints);
static bool MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr,
- bool allow_merge, bool is_local);
+ bool allow_merge, bool is_local);
static void SetRelationNumChecks(Relation rel, int numchecks);
static Node *cookConstraint(ParseState *pstate,
Node *raw_constraint,
@@ -113,37 +113,37 @@ static List *insert_ordered_unique_oid(List *list, Oid datum);
static FormData_pg_attribute a1 = {
0, {"ctid"}, TIDOID, 0, sizeof(ItemPointerData),
SelfItemPointerAttributeNumber, 0, -1, -1,
- false, 'p', 's', true, false, false, true, 0, { 0 }
+ false, 'p', 's', true, false, false, true, 0, {0}
};
static FormData_pg_attribute a2 = {
0, {"oid"}, OIDOID, 0, sizeof(Oid),
ObjectIdAttributeNumber, 0, -1, -1,
- true, 'p', 'i', true, false, false, true, 0, { 0 }
+ true, 'p', 'i', true, false, false, true, 0, {0}
};
static FormData_pg_attribute a3 = {
0, {"xmin"}, XIDOID, 0, sizeof(TransactionId),
MinTransactionIdAttributeNumber, 0, -1, -1,
- true, 'p', 'i', true, false, false, true, 0, { 0 }
+ true, 'p', 'i', true, false, false, true, 0, {0}
};
static FormData_pg_attribute a4 = {
0, {"cmin"}, CIDOID, 0, sizeof(CommandId),
MinCommandIdAttributeNumber, 0, -1, -1,
- true, 'p', 'i', true, false, false, true, 0, { 0 }
+ true, 'p', 'i', true, false, false, true, 0, {0}
};
static FormData_pg_attribute a5 = {
0, {"xmax"}, XIDOID, 0, sizeof(TransactionId),
MaxTransactionIdAttributeNumber, 0, -1, -1,
- true, 'p', 'i', true, false, false, true, 0, { 0 }
+ true, 'p', 'i', true, false, false, true, 0, {0}
};
static FormData_pg_attribute a6 = {
0, {"cmax"}, CIDOID, 0, sizeof(CommandId),
MaxCommandIdAttributeNumber, 0, -1, -1,
- true, 'p', 'i', true, false, false, true, 0, { 0 }
+ true, 'p', 'i', true, false, false, true, 0, {0}
};
/*
@@ -155,7 +155,7 @@ static FormData_pg_attribute a6 = {
static FormData_pg_attribute a7 = {
0, {"tableoid"}, OIDOID, 0, sizeof(Oid),
TableOidAttributeNumber, 0, -1, -1,
- true, 'p', 'i', true, false, false, true, 0, { 0 }
+ true, 'p', 'i', true, false, false, true, 0, {0}
};
static const Form_pg_attribute SysAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6, &a7};
@@ -478,7 +478,7 @@ CheckAttributeType(const char *attname, Oid atttypid)
* Caller has already opened and locked pg_attribute. new_attribute is the
* attribute to insert (but we ignore its attacl, if indeed it has one).
*
- * indstate is the index state for CatalogIndexInsert. It can be passed as
+ * indstate is the index state for CatalogIndexInsert. It can be passed as
* NULL, in which case we'll fetch the necessary info. (Don't do this when
* inserting multiple attributes, because it's a tad more expensive.)
*
@@ -530,6 +530,7 @@ InsertPgAttributeTuple(Relation pg_attribute_rel,
heap_freetuple(tup);
}
+
/* --------------------------------
* AddNewAttributeTuples
*
@@ -798,7 +799,7 @@ AddNewRelationType(const char *typeName,
ownerid, /* owner's ID */
-1, /* internal size (varlena) */
TYPTYPE_COMPOSITE, /* type-type (composite) */
- TYPCATEGORY_COMPOSITE, /* type-category (ditto) */
+ TYPCATEGORY_COMPOSITE, /* type-category (ditto) */
false, /* composite types are never preferred */
DEFAULT_TYPDELIM, /* default array delimiter */
F_RECORD_IN, /* input procedure */
@@ -979,7 +980,7 @@ heap_create_with_catalog(const char *relname,
ownerid, /* owner's ID */
-1, /* Internal size (varlena) */
TYPTYPE_BASE, /* Not composite - typelem is */
- TYPCATEGORY_ARRAY, /* type-category (array) */
+ TYPCATEGORY_ARRAY, /* type-category (array) */
false, /* array types are never preferred */
DEFAULT_TYPDELIM, /* default array delimiter */
F_ARRAY_IN, /* array input proc */
@@ -1671,8 +1672,8 @@ StoreRelCheck(Relation rel, char *ccname, Node *expr,
expr, /* Tree form check constraint */
ccbin, /* Binary form check constraint */
ccsrc, /* Source form check constraint */
- is_local, /* conislocal */
- inhcount); /* coninhcount */
+ is_local, /* conislocal */
+ inhcount); /* coninhcount */
pfree(ccbin);
pfree(ccsrc);
@@ -1889,10 +1890,10 @@ AddRelationNewConstraints(Relation rel,
checknames = lappend(checknames, ccname);
/*
- * Check against pre-existing constraints. If we are allowed
- * to merge with an existing constraint, there's no more to
- * do here. (We omit the duplicate constraint from the result,
- * which is what ATAddCheckConstraint wants.)
+ * Check against pre-existing constraints. If we are allowed to
+ * merge with an existing constraint, there's no more to do here.
+ * (We omit the duplicate constraint from the result, which is
+ * what ATAddCheckConstraint wants.)
*/
if (MergeWithExistingConstraint(rel, ccname, expr,
allow_merge, is_local))
@@ -2010,8 +2011,8 @@ MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr,
/* Found it. Conflicts if not identical check constraint */
if (con->contype == CONSTRAINT_CHECK)
{
- Datum val;
- bool isnull;
+ Datum val;
+ bool isnull;
val = fastgetattr(tup,
Anum_pg_constraint_conbin,
@@ -2029,8 +2030,8 @@ MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr,
ccname, RelationGetRelationName(rel))));
/* OK to update the tuple */
ereport(NOTICE,
- (errmsg("merging constraint \"%s\" with inherited definition",
- ccname)));
+ (errmsg("merging constraint \"%s\" with inherited definition",
+ ccname)));
tup = heap_copytuple(tup);
con = (Form_pg_constraint) GETSTRUCT(tup);
if (is_local)
@@ -2152,7 +2153,7 @@ cookDefault(ParseState *pstate,
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("cannot use window function in default expression")));
+ errmsg("cannot use window function in default expression")));
/*
* Coerce the expression to the correct type and typmod, if given. This
@@ -2212,8 +2213,8 @@ cookConstraint(ParseState *pstate,
if (list_length(pstate->p_rtable) != 1)
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
- errmsg("only table \"%s\" can be referenced in check constraint",
- relname)));
+ errmsg("only table \"%s\" can be referenced in check constraint",
+ relname)));
/*
* No subplans or aggregates, either...
@@ -2225,7 +2226,7 @@ cookConstraint(ParseState *pstate,
if (pstate->p_hasAggs)
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
- errmsg("cannot use aggregate function in check constraint")));
+ errmsg("cannot use aggregate function in check constraint")));
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 1e19cbff31..b75aac04e1 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.317 2009/06/06 22:13:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/index.c,v 1.318 2009/06/11 14:48:55 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -745,8 +745,8 @@ index_create(Oid heapRelationId,
NULL, /* no check constraint */
NULL,
NULL,
- true, /* islocal */
- 0); /* inhcount */
+ true, /* islocal */
+ 0); /* inhcount */
referenced.classId = ConstraintRelationId;
referenced.objectId = conOid;
@@ -1383,8 +1383,8 @@ index_build(Relation heapRelation,
Assert(RegProcedureIsValid(procedure));
/*
- * Switch to the table owner's userid, so that any index functions are
- * run as that user.
+ * Switch to the table owner's userid, so that any index functions are run
+ * as that user.
*/
GetUserIdAndContext(&save_userid, &save_secdefcxt);
SetUserIdAndContext(heapRelation->rd_rel->relowner, true);
@@ -1544,9 +1544,9 @@ IndexBuildHeapScan(Relation heapRelation,
scan = heap_beginscan_strat(heapRelation, /* relation */
snapshot, /* snapshot */
- 0, /* number of keys */
- NULL, /* scan key */
- true, /* buffer access strategy OK */
+ 0, /* number of keys */
+ NULL, /* scan key */
+ true, /* buffer access strategy OK */
allow_sync); /* syncscan OK? */
reltuples = 0;
@@ -1926,8 +1926,8 @@ validate_index(Oid heapId, Oid indexId, Snapshot snapshot)
indexInfo->ii_Concurrent = true;
/*
- * Switch to the table owner's userid, so that any index functions are
- * run as that user.
+ * Switch to the table owner's userid, so that any index functions are run
+ * as that user.
*/
GetUserIdAndContext(&save_userid, &save_secdefcxt);
SetUserIdAndContext(heapRelation->rd_rel->relowner, true);
@@ -2050,10 +2050,10 @@ validate_index_heapscan(Relation heapRelation,
*/
scan = heap_beginscan_strat(heapRelation, /* relation */
snapshot, /* snapshot */
- 0, /* number of keys */
- NULL, /* scan key */
- true, /* buffer access strategy OK */
- false); /* syncscan not OK */
+ 0, /* number of keys */
+ NULL, /* scan key */
+ true, /* buffer access strategy OK */
+ false); /* syncscan not OK */
/*
* Scan all tuples matching the snapshot.
@@ -2267,11 +2267,11 @@ reindex_index(Oid indexId)
if (RELATION_IS_OTHER_TEMP(iRel))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot reindex temporary tables of other sessions")));
+ errmsg("cannot reindex temporary tables of other sessions")));
/*
- * Also check for active uses of the index in the current transaction;
- * we don't want to reindex underneath an open indexscan.
+ * Also check for active uses of the index in the current transaction; we
+ * don't want to reindex underneath an open indexscan.
*/
CheckTableNotInUse(iRel, "REINDEX INDEX");
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index f38568bed8..12cb1720cd 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.117 2009/03/31 22:12:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.118 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -573,7 +573,7 @@ TypeIsVisible(Oid typid)
* and the returned nvargs will always be zero.
*
* If expand_defaults is true, functions that could match after insertion of
- * default argument values will also be retrieved. In this case the returned
+ * default argument values will also be retrieved. In this case the returned
* structs could have nargs > passed-in nargs, and ndargs is set to the number
* of additional args (which can be retrieved from the function's
* proargdefaults entry).
@@ -726,7 +726,7 @@ FuncnameGetCandidates(List *names, int nargs,
pronargs * sizeof(Oid));
if (variadic)
{
- int i;
+ int i;
newResult->nvargs = effective_nargs - pronargs + 1;
/* Expand variadic argument into N copies of element type */
@@ -774,7 +774,7 @@ FuncnameGetCandidates(List *names, int nargs,
}
else
{
- int cmp_nargs = newResult->nargs - newResult->ndargs;
+ int cmp_nargs = newResult->nargs - newResult->ndargs;
for (prevResult = resultList;
prevResult;
@@ -791,13 +791,13 @@ FuncnameGetCandidates(List *names, int nargs,
if (prevResult)
{
/*
- * We have a match with a previous result. Decide which one
+ * We have a match with a previous result. Decide which one
* to keep, or mark it ambiguous if we can't decide. The
* logic here is preference > 0 means prefer the old result,
* preference < 0 means prefer the new, preference = 0 means
* ambiguous.
*/
- int preference;
+ int preference;
if (pathpos != prevResult->pathpos)
{
@@ -810,9 +810,9 @@ FuncnameGetCandidates(List *names, int nargs,
{
/*
* With variadic functions we could have, for example,
- * both foo(numeric) and foo(variadic numeric[]) in
- * the same namespace; if so we prefer the
- * non-variadic match on efficiency grounds.
+ * both foo(numeric) and foo(variadic numeric[]) in the
+ * same namespace; if so we prefer the non-variadic match
+ * on efficiency grounds.
*/
preference = 1;
}
@@ -858,7 +858,7 @@ FuncnameGetCandidates(List *names, int nargs,
break;
}
}
- Assert(prevPrevResult); /* assert we found it */
+ Assert(prevPrevResult); /* assert we found it */
}
pfree(prevResult);
/* fall through to add newResult to list */
@@ -2865,8 +2865,8 @@ InitTempTableNamespace(void)
}
/*
- * If the corresponding toast-table namespace doesn't exist yet, create it.
- * (We assume there is no need to clean it out if it does exist, since
+ * If the corresponding toast-table namespace doesn't exist yet, create
+ * it. (We assume there is no need to clean it out if it does exist, since
* dropping a parent table should make its toast table go away.)
*/
snprintf(namespaceName, sizeof(namespaceName), "pg_toast_temp_%d",
@@ -3230,7 +3230,7 @@ fetch_search_path(bool includeImplicit)
/*
* Fetch the active search path into a caller-allocated array of OIDs.
- * Returns the number of path entries. (If this is more than sarray_len,
+ * Returns the number of path entries. (If this is more than sarray_len,
* then the data didn't fit and is not all stored.)
*
* The returned list always includes the implicitly-prepended namespaces,
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index 5af71a54ea..8c9f8bce7a 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.101 2009/01/01 17:23:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.102 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -180,9 +180,9 @@ AggregateCreate(const char *aggName,
/*
* Also, the return type can't be INTERNAL unless there's at least one
- * INTERNAL argument. This is the same type-safety restriction we
- * enforce for regular functions, but at the level of aggregates. We
- * must test this explicitly because we allow INTERNAL as the transtype.
+ * INTERNAL argument. This is the same type-safety restriction we enforce
+ * for regular functions, but at the level of aggregates. We must test
+ * this explicitly because we allow INTERNAL as the transtype.
*/
if (finaltype == INTERNALOID && !hasInternalArg)
ereport(ERROR,
@@ -228,7 +228,7 @@ AggregateCreate(const char *aggName,
PointerGetDatum(NULL), /* allParamTypes */
PointerGetDatum(NULL), /* parameterModes */
PointerGetDatum(NULL), /* parameterNames */
- NIL, /* parameterDefaults */
+ NIL, /* parameterDefaults */
PointerGetDatum(NULL), /* proconfig */
1, /* procost */
0); /* prorows */
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c
index e3e46afd40..9e13872fa8 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.44 2009/01/01 17:23:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_constraint.c,v 1.45 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -600,8 +600,8 @@ RenameConstraintById(Oid conId, const char *newname)
con = (Form_pg_constraint) GETSTRUCT(tuple);
/*
- * We need to check whether the name is already in use --- note that
- * there currently is not a unique index that would catch this.
+ * We need to check whether the name is already in use --- note that there
+ * currently is not a unique index that would catch this.
*/
if (OidIsValid(con->conrelid) &&
ConstraintNameIsUsed(CONSTRAINT_RELATION,
@@ -610,8 +610,8 @@ RenameConstraintById(Oid conId, const char *newname)
newname))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
- errmsg("constraint \"%s\" for relation \"%s\" already exists",
- newname, get_rel_name(con->conrelid))));
+ errmsg("constraint \"%s\" for relation \"%s\" already exists",
+ newname, get_rel_name(con->conrelid))));
if (OidIsValid(con->contypid) &&
ConstraintNameIsUsed(CONSTRAINT_DOMAIN,
con->contypid,
diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c
index 1508243c08..9867cc2c67 100644
--- a/src/backend/catalog/pg_depend.c
+++ b/src/backend/catalog/pg_depend.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.31 2009/01/01 17:23:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_depend.c,v 1.32 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -427,8 +427,8 @@ getOwnedSequences(Oid relid)
{
List *result = NIL;
Relation depRel;
- ScanKeyData key[2];
- SysScanDesc scan;
+ ScanKeyData key[2];
+ SysScanDesc scan;
HeapTuple tup;
depRel = heap_open(DependRelationId, AccessShareLock);
@@ -571,8 +571,8 @@ get_index_constraint(Oid indexId)
Form_pg_depend deprec = (Form_pg_depend) GETSTRUCT(tup);
/*
- * We assume any internal dependency on a constraint
- * must be what we are looking for.
+ * We assume any internal dependency on a constraint must be what we
+ * are looking for.
*/
if (deprec->refclassid == ConstraintRelationId &&
deprec->refobjsubid == 0 &&
diff --git a/src/backend/catalog/pg_inherits.c b/src/backend/catalog/pg_inherits.c
index 49342dc345..8ae368b741 100644
--- a/src/backend/catalog/pg_inherits.c
+++ b/src/backend/catalog/pg_inherits.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/pg_inherits.c,v 1.2 2009/05/12 03:11:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_inherits.c,v 1.3 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -82,8 +82,8 @@ find_inheritance_children(Oid parentrelId, LOCKMODE lockmode)
/*
* Now that we have the lock, double-check to see if the relation
- * really exists or not. If not, assume it was dropped while
- * we waited to acquire lock, and ignore it.
+ * really exists or not. If not, assume it was dropped while we
+ * waited to acquire lock, and ignore it.
*/
if (!SearchSysCacheExists(RELOID,
ObjectIdGetDatum(inhrelid),
@@ -235,10 +235,10 @@ typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId)
HeapTuple inhtup;
/*
- * If we've seen this relid already, skip it. This avoids extra
- * work in multiple-inheritance scenarios, and also protects us
- * from an infinite loop in case there is a cycle in pg_inherits
- * (though theoretically that shouldn't happen).
+ * If we've seen this relid already, skip it. This avoids extra work
+ * in multiple-inheritance scenarios, and also protects us from an
+ * infinite loop in case there is a cycle in pg_inherits (though
+ * theoretically that shouldn't happen).
*/
if (list_member_oid(visited, this_relid))
continue;
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index 12ffd74256..90c4acc9b2 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.108 2009/01/22 20:16:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_operator.c,v 1.109 2009/06/11 14:48:55 momjian Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -391,11 +391,11 @@ OperatorCreate(const char *operatorName,
if (OidIsValid(restrictionId))
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
- errmsg("only boolean operators can have restriction selectivity")));
+ errmsg("only boolean operators can have restriction selectivity")));
if (OidIsValid(joinId))
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
- errmsg("only boolean operators can have join selectivity")));
+ errmsg("only boolean operators can have join selectivity")));
if (canMerge)
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
@@ -420,8 +420,8 @@ OperatorCreate(const char *operatorName,
/*
* At this point, if operatorObjectId is not InvalidOid then we are
- * filling in a previously-created shell. Insist that the user own
- * any such shell.
+ * filling in a previously-created shell. Insist that the user own any
+ * such shell.
*/
if (OidIsValid(operatorObjectId) &&
!pg_oper_ownercheck(operatorObjectId, GetUserId()))
@@ -499,10 +499,10 @@ OperatorCreate(const char *operatorName,
values[i++] = ObjectIdGetDatum(rightTypeId); /* oprright */
values[i++] = ObjectIdGetDatum(operResultType); /* oprresult */
values[i++] = ObjectIdGetDatum(commutatorId); /* oprcom */
- values[i++] = ObjectIdGetDatum(negatorId); /* oprnegate */
- values[i++] = ObjectIdGetDatum(procedureId); /* oprcode */
- values[i++] = ObjectIdGetDatum(restrictionId); /* oprrest */
- values[i++] = ObjectIdGetDatum(joinId); /* oprjoin */
+ values[i++] = ObjectIdGetDatum(negatorId); /* oprnegate */
+ values[i++] = ObjectIdGetDatum(procedureId); /* oprcode */
+ values[i++] = ObjectIdGetDatum(restrictionId); /* oprrest */
+ values[i++] = ObjectIdGetDatum(joinId); /* oprjoin */
pg_operator_desc = heap_open(OperatorRelationId, RowExclusiveLock);
@@ -519,10 +519,10 @@ OperatorCreate(const char *operatorName,
operatorObjectId);
tup = heap_modify_tuple(tup,
- RelationGetDescr(pg_operator_desc),
- values,
- nulls,
- replaces);
+ RelationGetDescr(pg_operator_desc),
+ values,
+ nulls,
+ replaces);
simple_heap_update(pg_operator_desc, &tup->t_self, tup);
}
@@ -690,10 +690,10 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
}
tup = heap_modify_tuple(tup,
- RelationGetDescr(pg_operator_desc),
- values,
- nulls,
- replaces);
+ RelationGetDescr(pg_operator_desc),
+ values,
+ nulls,
+ replaces);
simple_heap_update(pg_operator_desc, &tup->t_self, tup);
@@ -715,10 +715,10 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
replaces[Anum_pg_operator_oprcom - 1] = true;
tup = heap_modify_tuple(tup,
- RelationGetDescr(pg_operator_desc),
- values,
- nulls,
- replaces);
+ RelationGetDescr(pg_operator_desc),
+ values,
+ nulls,
+ replaces);
simple_heap_update(pg_operator_desc, &tup->t_self, tup);
@@ -741,10 +741,10 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
replaces[Anum_pg_operator_oprnegate - 1] = true;
tup = heap_modify_tuple(tup,
- RelationGetDescr(pg_operator_desc),
- values,
- nulls,
- replaces);
+ RelationGetDescr(pg_operator_desc),
+ values,
+ nulls,
+ replaces);
simple_heap_update(pg_operator_desc, &tup->t_self, tup);
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index ce42910e78..64920f5d2a 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.163 2009/06/04 18:33:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.164 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -232,10 +232,11 @@ ProcedureCreate(const char *procedureName,
ARR_ELEMTYPE(modesArray) != CHAROID)
elog(ERROR, "parameterModes is not a 1-D char array");
modes = (char *) ARR_DATA_PTR(modesArray);
+
/*
- * Only the last input parameter can be variadic; if it is, save
- * its element type. Errors here are just elog since caller should
- * have checked this already.
+ * Only the last input parameter can be variadic; if it is, save its
+ * element type. Errors here are just elog since caller should have
+ * checked this already.
*/
for (i = 0; i < allParamCount; i++)
{
@@ -393,11 +394,11 @@ ProcedureCreate(const char *procedureName,
/*
* If there are existing defaults, check compatibility: redefinition
- * must not remove any defaults nor change their types. (Removing
- * a default might cause a function to fail to satisfy an existing
- * call. Changing type would only be possible if the associated
- * parameter is polymorphic, and in such cases a change of default
- * type might alter the resolved output type of existing calls.)
+ * must not remove any defaults nor change their types. (Removing a
+ * default might cause a function to fail to satisfy an existing call.
+ * Changing type would only be possible if the associated parameter is
+ * polymorphic, and in such cases a change of default type might alter
+ * the resolved output type of existing calls.)
*/
if (oldproc->pronargdefaults != 0)
{
@@ -430,8 +431,8 @@ ProcedureCreate(const char *procedureName,
foreach(oldlc, oldDefaults)
{
- Node *oldDef = (Node *) lfirst(oldlc);
- Node *newDef = (Node *) lfirst(newlc);
+ Node *oldDef = (Node *) lfirst(oldlc);
+ Node *newDef = (Node *) lfirst(newlc);
if (exprType(oldDef) != exprType(newDef))
ereport(ERROR,
@@ -453,8 +454,8 @@ ProcedureCreate(const char *procedureName,
else
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
- errmsg("function \"%s\" is not an aggregate function",
- procedureName)));
+ errmsg("function \"%s\" is not an aggregate function",
+ procedureName)));
}
if (oldproc->proiswindow != isWindowFunc)
{
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index 19cfe08f4f..08977c3863 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.33 2009/06/04 18:33:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_shdepend.c,v 1.34 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,18 +56,18 @@ static int getOidListDiff(Oid *list1, int nlist1, Oid *list2, int nlist2,
static Oid classIdGetDbId(Oid classId);
static void shdepLockAndCheckObject(Oid classId, Oid objectId);
static void shdepChangeDep(Relation sdepRel,
- Oid classid, Oid objid, int32 objsubid,
- Oid refclassid, Oid refobjid,
- SharedDependencyType deptype);
+ Oid classid, Oid objid, int32 objsubid,
+ Oid refclassid, Oid refobjid,
+ SharedDependencyType deptype);
static void shdepAddDependency(Relation sdepRel,
- Oid classId, Oid objectId, int32 objsubId,
- Oid refclassId, Oid refobjId,
- SharedDependencyType deptype);
+ Oid classId, Oid objectId, int32 objsubId,
+ Oid refclassId, Oid refobjId,
+ SharedDependencyType deptype);
static void shdepDropDependency(Relation sdepRel,
- Oid classId, Oid objectId, int32 objsubId,
- bool drop_subobjects,
- Oid refclassId, Oid refobjId,
- SharedDependencyType deptype);
+ Oid classId, Oid objectId, int32 objsubId,
+ bool drop_subobjects,
+ Oid refclassId, Oid refobjId,
+ SharedDependencyType deptype);
static void storeObjectDescription(StringInfo descs, objectType type,
ObjectAddress *object,
SharedDependencyType deptype,
@@ -216,7 +216,7 @@ shdepChangeDep(Relation sdepRel,
/* Caller screwed up if multiple matches */
if (oldtup)
elog(ERROR,
- "multiple pg_shdepend entries for object %u/%u/%d deptype %c",
+ "multiple pg_shdepend entries for object %u/%u/%d deptype %c",
classid, objid, objsubid, deptype);
oldtup = heap_copytuple(scantup);
}
@@ -450,7 +450,7 @@ updateAclDependencies(Oid classId, Oid objectId, int32 objsubId,
SHARED_DEPENDENCY_ACL);
else
shdepDropDependency(sdepRel, classId, objectId, objsubId,
- false, /* exact match on objsubId */
+ false, /* exact match on objsubId */
AuthIdRelationId, roleid,
SHARED_DEPENDENCY_ACL);
}
@@ -664,7 +664,7 @@ checkSharedDependencies(Oid classId, Oid objectId,
if (numNotReportedDbs > 0)
appendStringInfo(&descs, ngettext("\nand objects in %d other database "
"(see server log for list)",
- "\nand objects in %d other databases "
+ "\nand objects in %d other databases "
"(see server log for list)",
numNotReportedDbs),
numNotReportedDbs);
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index c7daed4e32..4c7e3f5078 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.125 2009/02/24 01:38:09 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/pg_type.c,v 1.126 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -278,14 +278,14 @@ TypeCreate(Oid newTypeOid,
if (internalSize == -1 && !(alignment == 'i' || alignment == 'd'))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("alignment \"%c\" is invalid for variable-length type",
- alignment)));
+ errmsg("alignment \"%c\" is invalid for variable-length type",
+ alignment)));
/* cstring must have char alignment */
if (internalSize == -2 && !(alignment == 'c'))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("alignment \"%c\" is invalid for variable-length type",
- alignment)));
+ errmsg("alignment \"%c\" is invalid for variable-length type",
+ alignment)));
}
/* Only varlena types can be toasted */
@@ -392,10 +392,10 @@ TypeCreate(Oid newTypeOid,
* Okay to update existing shell type tuple
*/
tup = heap_modify_tuple(tup,
- RelationGetDescr(pg_type_desc),
- values,
- nulls,
- replaces);
+ RelationGetDescr(pg_type_desc),
+ values,
+ nulls,
+ replaces);
simple_heap_update(pg_type_desc, &tup->t_self, tup);
@@ -406,8 +406,8 @@ TypeCreate(Oid newTypeOid,
else
{
tup = heap_form_tuple(RelationGetDescr(pg_type_desc),
- values,
- nulls);
+ values,
+ nulls);
/* Force the OID if requested by caller, else heap_insert does it */
if (OidIsValid(newTypeOid))
diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c
index e1a0f6254c..8f4612dda4 100644
--- a/src/backend/catalog/storage.c
+++ b/src/backend/catalog/storage.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/storage.c,v 1.5 2009/01/20 18:59:37 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/storage.c,v 1.6 2009/06/11 14:48:55 momjian Exp $
*
* NOTES
* Some of this code used to be in storage/smgr/smgr.c, and the
@@ -109,8 +109,8 @@ RelationCreateStorage(RelFileNode rnode, bool istemp)
if (!istemp)
{
/*
- * Make an XLOG entry showing the file creation. If we abort, the file
- * will be dropped at abort time.
+ * Make an XLOG entry showing the file creation. If we abort, the
+ * file will be dropped at abort time.
*/
xlrec.rnode = rnode;
@@ -175,8 +175,8 @@ RelationDropStorage(Relation rel)
void
RelationTruncate(Relation rel, BlockNumber nblocks)
{
- bool fsm;
- bool vm;
+ bool fsm;
+ bool vm;
/* Open it at the smgr level if not already done */
RelationOpenSmgr(rel);
@@ -195,13 +195,13 @@ RelationTruncate(Relation rel, BlockNumber nblocks)
visibilitymap_truncate(rel, nblocks);
/*
- * We WAL-log the truncation before actually truncating, which
- * means trouble if the truncation fails. If we then crash, the WAL
- * replay likely isn't going to succeed in the truncation either, and
- * cause a PANIC. It's tempting to put a critical section here, but
- * that cure would be worse than the disease. It would turn a usually
- * harmless failure to truncate, that could spell trouble at WAL replay,
- * into a certain PANIC.
+ * We WAL-log the truncation before actually truncating, which means
+ * trouble if the truncation fails. If we then crash, the WAL replay
+ * likely isn't going to succeed in the truncation either, and cause a
+ * PANIC. It's tempting to put a critical section here, but that cure
+ * would be worse than the disease. It would turn a usually harmless
+ * failure to truncate, that could spell trouble at WAL replay, into a
+ * certain PANIC.
*/
if (!rel->rd_istemp)
{
@@ -223,11 +223,11 @@ RelationTruncate(Relation rel, BlockNumber nblocks)
lsn = XLogInsert(RM_SMGR_ID, XLOG_SMGR_TRUNCATE, &rdata);
/*
- * Flush, because otherwise the truncation of the main relation
- * might hit the disk before the WAL record, and the truncation of
- * the FSM or visibility map. If we crashed during that window, we'd
- * be left with a truncated heap, but the FSM or visibility map would
- * still contain entries for the non-existent heap pages.
+ * Flush, because otherwise the truncation of the main relation might
+ * hit the disk before the WAL record, and the truncation of the FSM
+ * or visibility map. If we crashed during that window, we'd be left
+ * with a truncated heap, but the FSM or visibility map would still
+ * contain entries for the non-existent heap pages.
*/
if (fsm || vm)
XLogFlush(lsn);
@@ -270,7 +270,7 @@ smgrDoPendingDeletes(bool isCommit)
/* do deletion if called for */
if (pending->atCommit == isCommit)
{
- int i;
+ int i;
/* schedule unlinking old files */
SMgrRelation srel;
@@ -431,11 +431,12 @@ smgr_redo(XLogRecPtr lsn, XLogRecord *record)
/* Also tell xlogutils.c about it */
XLogTruncateRelation(xlrec->rnode, MAIN_FORKNUM, xlrec->blkno);
-
+
/* Truncate FSM too */
if (smgrexists(reln, FSM_FORKNUM))
{
- Relation rel = CreateFakeRelcacheEntry(xlrec->rnode);
+ Relation rel = CreateFakeRelcacheEntry(xlrec->rnode);
+
FreeSpaceMapTruncateRel(rel, xlrec->blkno);
FreeFakeRelcacheEntry(rel);
}
@@ -453,7 +454,7 @@ smgr_desc(StringInfo buf, uint8 xl_info, char *rec)
if (info == XLOG_SMGR_CREATE)
{
xl_smgr_create *xlrec = (xl_smgr_create *) rec;
- char *path = relpath(xlrec->rnode, MAIN_FORKNUM);
+ char *path = relpath(xlrec->rnode, MAIN_FORKNUM);
appendStringInfo(buf, "file create: %s", path);
pfree(path);
@@ -461,7 +462,7 @@ smgr_desc(StringInfo buf, uint8 xl_info, char *rec)
else if (info == XLOG_SMGR_TRUNCATE)
{
xl_smgr_truncate *xlrec = (xl_smgr_truncate *) rec;
- char *path = relpath(xlrec->rnode, MAIN_FORKNUM);
+ char *path = relpath(xlrec->rnode, MAIN_FORKNUM);
appendStringInfo(buf, "file truncate: %s to %u blocks", path,
xlrec->blkno);
diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c
index ff9499ca35..510c88ec33 100644
--- a/src/backend/catalog/toasting.c
+++ b/src/backend/catalog/toasting.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.15 2009/05/07 22:58:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/catalog/toasting.c,v 1.16 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -145,8 +145,8 @@ create_toast_table(Relation rel, Oid toastOid, Oid toastIndexOid,
/*
* Check to see whether the table actually needs a TOAST table.
*
- * Caller can optionally override this check. (Note: at present
- * no callers in core Postgres do so, but this option is needed by
+ * Caller can optionally override this check. (Note: at present no
+ * callers in core Postgres do so, but this option is needed by
* pg_migrator.)
*/
if (!force && !needs_toast_table(rel))
diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c
index 7b2d8915df..461f81005c 100644
--- a/src/backend/commands/aggregatecmds.c
+++ b/src/backend/commands/aggregatecmds.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.48 2009/01/01 17:23:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.49 2009/06/11 14:48:55 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -173,18 +173,18 @@ DefineAggregate(List *name, List *args, bool oldstyle, List *parameters)
*
* transtype can't be a pseudo-type, since we need to be able to store
* values of the transtype. However, we can allow polymorphic transtype
- * in some cases (AggregateCreate will check). Also, we allow "internal"
+ * in some cases (AggregateCreate will check). Also, we allow "internal"
* for functions that want to pass pointers to private data structures;
- * but allow that only to superusers, since you could crash the system
- * (or worse) by connecting up incompatible internal-using functions
- * in an aggregate.
+ * but allow that only to superusers, since you could crash the system (or
+ * worse) by connecting up incompatible internal-using functions in an
+ * aggregate.
*/
transTypeId = typenameTypeId(NULL, transType, NULL);
if (get_typtype(transTypeId) == TYPTYPE_PSEUDO &&
!IsPolymorphicType(transTypeId))
{
if (transTypeId == INTERNALOID && superuser())
- /* okay */ ;
+ /* okay */ ;
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index d549fa3bb9..f5e76e2aed 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.138 2009/06/06 22:13:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.139 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,8 +177,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
{
if (onerel->rd_rel->relisshared)
ereport(WARNING,
- (errmsg("skipping \"%s\" --- only superuser can analyze it",
- RelationGetRelationName(onerel))));
+ (errmsg("skipping \"%s\" --- only superuser can analyze it",
+ RelationGetRelationName(onerel))));
else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE)
ereport(WARNING,
(errmsg("skipping \"%s\" --- only superuser or database owner can analyze it",
@@ -234,8 +234,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
RelationGetRelationName(onerel))));
/*
- * Switch to the table owner's userid, so that any index functions are
- * run as that user.
+ * Switch to the table owner's userid, so that any index functions are run
+ * as that user.
*/
GetUserIdAndContext(&save_userid, &save_secdefcxt);
SetUserIdAndContext(onerel->rd_rel->relowner, true);
@@ -467,7 +467,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
/*
* Same for indexes. Vacuum always scans all indexes, so if we're part of
- * VACUUM ANALYZE, don't overwrite the accurate count already inserted by
+ * VACUUM ANALYZE, don't overwrite the accurate count already inserted by
* VACUUM.
*/
if (!vacstmt->vacuum)
@@ -719,8 +719,8 @@ examine_attribute(Relation onerel, int attnum)
return NULL;
/*
- * Create the VacAttrStats struct. Note that we only have a copy of
- * the fixed fields of the pg_attribute tuple.
+ * Create the VacAttrStats struct. Note that we only have a copy of the
+ * fixed fields of the pg_attribute tuple.
*/
stats = (VacAttrStats *) palloc0(sizeof(VacAttrStats));
stats->attr = (Form_pg_attribute) palloc(ATTRIBUTE_FIXED_PART_SIZE);
@@ -737,10 +737,9 @@ examine_attribute(Relation onerel, int attnum)
stats->tupattnum = attnum;
/*
- * The fields describing the stats->stavalues[n] element types default
- * to the type of the field being analyzed, but the type-specific
- * typanalyze function can change them if it wants to store something
- * else.
+ * The fields describing the stats->stavalues[n] element types default to
+ * the type of the field being analyzed, but the type-specific typanalyze
+ * function can change them if it wants to store something else.
*/
for (i = 0; i < STATISTIC_NUM_SLOTS; i++)
{
@@ -894,7 +893,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
double *totalrows, double *totaldeadrows)
{
int numrows = 0; /* # rows now in reservoir */
- double samplerows = 0; /* total # rows collected */
+ double samplerows = 0; /* total # rows collected */
double liverows = 0; /* # live rows seen */
double deadrows = 0; /* # dead rows seen */
double rowstoskip = -1; /* -1 means not set yet */
@@ -931,9 +930,9 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
* the maxoffset value stays good (else concurrent VACUUM might delete
* tuples out from under us). Hence, pin the page until we are done
* looking at it. We also choose to hold sharelock on the buffer
- * throughout --- we could release and re-acquire sharelock for
- * each tuple, but since we aren't doing much work per tuple, the
- * extra lock traffic is probably better avoided.
+ * throughout --- we could release and re-acquire sharelock for each
+ * tuple, but since we aren't doing much work per tuple, the extra
+ * lock traffic is probably better avoided.
*/
targbuffer = ReadBufferExtended(onerel, MAIN_FORKNUM, targblock,
RBM_NORMAL, vac_strategy);
@@ -952,9 +951,9 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
/*
* We ignore unused and redirect line pointers. DEAD line
- * pointers should be counted as dead, because we need vacuum
- * to run to get rid of them. Note that this rule agrees with
- * the way that heap_page_prune() counts things.
+ * pointers should be counted as dead, because we need vacuum to
+ * run to get rid of them. Note that this rule agrees with the
+ * way that heap_page_prune() counts things.
*/
if (!ItemIdIsNormal(itemid))
{
@@ -984,6 +983,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
break;
case HEAPTUPLE_INSERT_IN_PROGRESS:
+
/*
* Insert-in-progress rows are not counted. We assume
* that when the inserting transaction commits or aborts,
@@ -991,17 +991,17 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
* count. This works right only if that transaction ends
* after we finish analyzing the table; if things happen
* in the other order, its stats update will be
- * overwritten by ours. However, the error will be
- * large only if the other transaction runs long enough
- * to insert many tuples, so assuming it will finish
- * after us is the safer option.
+ * overwritten by ours. However, the error will be large
+ * only if the other transaction runs long enough to
+ * insert many tuples, so assuming it will finish after us
+ * is the safer option.
*
* A special case is that the inserting transaction might
- * be our own. In this case we should count and sample
+ * be our own. In this case we should count and sample
* the row, to accommodate users who load a table and
* analyze it in one transaction. (pgstat_report_analyze
- * has to adjust the numbers we send to the stats collector
- * to make this come out right.)
+ * has to adjust the numbers we send to the stats
+ * collector to make this come out right.)
*/
if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(targtuple.t_data)))
{
@@ -1011,6 +1011,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
break;
case HEAPTUPLE_DELETE_IN_PROGRESS:
+
/*
* We count delete-in-progress rows as still live, using
* the same reasoning given above; but we don't bother to
@@ -1019,8 +1020,8 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
* If the delete was done by our own transaction, however,
* we must count the row as dead to make
* pgstat_report_analyze's stats adjustments come out
- * right. (Note: this works out properly when the row
- * was both inserted and deleted in our xact.)
+ * right. (Note: this works out properly when the row was
+ * both inserted and deleted in our xact.)
*/
if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(targtuple.t_data)))
deadrows += 1;
@@ -1054,8 +1055,8 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
/*
* t in Vitter's paper is the number of records already
* processed. If we need to compute a new S value, we
- * must use the not-yet-incremented value of samplerows
- * as t.
+ * must use the not-yet-incremented value of samplerows as
+ * t.
*/
if (rowstoskip < 0)
rowstoskip = get_next_S(samplerows, targrows, &rstate);
@@ -1385,10 +1386,10 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
{
/* Yes, replace it */
stup = heap_modify_tuple(oldtup,
- RelationGetDescr(sd),
- values,
- nulls,
- replaces);
+ RelationGetDescr(sd),
+ values,
+ nulls,
+ replaces);
ReleaseSysCache(oldtup);
simple_heap_update(sd, &stup->t_self, stup);
}
@@ -1883,9 +1884,10 @@ compute_minimal_stats(VacAttrStatsP stats,
stats->numnumbers[0] = num_mcv;
stats->stavalues[0] = mcv_values;
stats->numvalues[0] = num_mcv;
+
/*
- * Accept the defaults for stats->statypid and others.
- * They have been set before we were called (see vacuum.h)
+ * Accept the defaults for stats->statypid and others. They have
+ * been set before we were called (see vacuum.h)
*/
}
}
@@ -2232,9 +2234,10 @@ compute_scalar_stats(VacAttrStatsP stats,
stats->numnumbers[slot_idx] = num_mcv;
stats->stavalues[slot_idx] = mcv_values;
stats->numvalues[slot_idx] = num_mcv;
+
/*
- * Accept the defaults for stats->statypid and others.
- * They have been set before we were called (see vacuum.h)
+ * Accept the defaults for stats->statypid and others. They have
+ * been set before we were called (see vacuum.h)
*/
slot_idx++;
}
@@ -2312,7 +2315,7 @@ compute_scalar_stats(VacAttrStatsP stats,
/*
* The object of this loop is to copy the first and last values[]
- * entries along with evenly-spaced values in between. So the
+ * entries along with evenly-spaced values in between. So the
* i'th value is values[(i * (nvals - 1)) / (num_hist - 1)]. But
* computing that subscript directly risks integer overflow when
* the stats target is more than a couple thousand. Instead we
@@ -2344,9 +2347,10 @@ compute_scalar_stats(VacAttrStatsP stats,
stats->staop[slot_idx] = mystats->ltopr;
stats->stavalues[slot_idx] = hist_values;
stats->numvalues[slot_idx] = num_hist;
+
/*
- * Accept the defaults for stats->statypid and others.
- * They have been set before we were called (see vacuum.h)
+ * Accept the defaults for stats->statypid and others. They have
+ * been set before we were called (see vacuum.h)
*/
slot_idx++;
}
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 745f455853..9da815d481 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.146 2009/02/13 17:12:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.147 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,7 +53,7 @@
* transaction.
*
* Like NOTIFY, LISTEN and UNLISTEN just add the desired action to a list
- * of pending actions. If we reach transaction commit, the changes are
+ * of pending actions. If we reach transaction commit, the changes are
* applied to pg_listener just before executing any pending NOTIFYs. This
* method is necessary because to avoid race conditions, we must hold lock
* on pg_listener from when we insert a new listener tuple until we commit.
@@ -124,12 +124,12 @@ typedef enum
typedef struct
{
ListenActionKind action;
- char condname[1]; /* actually, as long as needed */
+ char condname[1]; /* actually, as long as needed */
} ListenAction;
-static List *pendingActions = NIL; /* list of ListenAction */
+static List *pendingActions = NIL; /* list of ListenAction */
-static List *upperPendingActions = NIL; /* list of upper-xact lists */
+static List *upperPendingActions = NIL; /* list of upper-xact lists */
/*
* State for outbound notifies consists of a list of all relnames NOTIFYed
@@ -147,7 +147,7 @@ static List *upperPendingActions = NIL; /* list of upper-xact lists */
* condition name, it will get a self-notify at commit. This is a bit odd
* but is consistent with our historical behavior.
*/
-static List *pendingNotifies = NIL; /* list of C strings */
+static List *pendingNotifies = NIL; /* list of C strings */
static List *upperPendingNotifies = NIL; /* list of upper-xact lists */
@@ -209,10 +209,9 @@ Async_Notify(const char *relname)
oldcontext = MemoryContextSwitchTo(CurTransactionContext);
/*
- * Ordering of the list isn't important. We choose to put new
- * entries on the front, as this might make duplicate-elimination
- * a tad faster when the same condition is signaled many times in
- * a row.
+ * Ordering of the list isn't important. We choose to put new entries
+ * on the front, as this might make duplicate-elimination a tad faster
+ * when the same condition is signaled many times in a row.
*/
pendingNotifies = lcons(pstrdup(relname), pendingNotifies);
@@ -235,10 +234,10 @@ queue_listen(ListenActionKind action, const char *condname)
ListenAction *actrec;
/*
- * Unlike Async_Notify, we don't try to collapse out duplicates.
- * It would be too complicated to ensure we get the right interactions
- * of conflicting LISTEN/UNLISTEN/UNLISTEN_ALL, and it's unlikely that
- * there would be any performance benefit anyway in sane applications.
+ * Unlike Async_Notify, we don't try to collapse out duplicates. It would
+ * be too complicated to ensure we get the right interactions of
+ * conflicting LISTEN/UNLISTEN/UNLISTEN_ALL, and it's unlikely that there
+ * would be any performance benefit anyway in sane applications.
*/
oldcontext = MemoryContextSwitchTo(CurTransactionContext);
@@ -488,7 +487,7 @@ Exec_Listen(Relation lRel, const char *relname)
namestrcpy(&condname, relname);
values[Anum_pg_listener_relname - 1] = NameGetDatum(&condname);
values[Anum_pg_listener_pid - 1] = Int32GetDatum(MyProcPid);
- values[Anum_pg_listener_notify - 1] = Int32GetDatum(0); /* no notifies pending */
+ values[Anum_pg_listener_notify - 1] = Int32GetDatum(0); /* no notifies pending */
tuple = heap_form_tuple(RelationGetDescr(lRel), values, nulls);
@@ -755,9 +754,9 @@ AtSubAbort_Notify(void)
int my_level = GetCurrentTransactionNestLevel();
/*
- * All we have to do is pop the stack --- the actions/notifies made in this
- * subxact are no longer interesting, and the space will be freed when
- * CurTransactionContext is recycled.
+ * All we have to do is pop the stack --- the actions/notifies made in
+ * this subxact are no longer interesting, and the space will be freed
+ * when CurTransactionContext is recycled.
*
* This routine could be called more than once at a given nesting level if
* there is trouble during subxact abort. Avoid dumping core by using
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 08c09ed435..ca9999d5f4 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.184 2009/05/07 22:58:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.185 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -631,9 +631,9 @@ rebuild_relation(Relation OldHeap, Oid indexOid)
/*
* At this point, everything is kosher except that the toast table's name
- * corresponds to the temporary table. The name is irrelevant to
- * the backend because it's referenced by OID, but users looking at the
- * catalogs could be confused. Rename it to prevent this problem.
+ * corresponds to the temporary table. The name is irrelevant to the
+ * backend because it's referenced by OID, but users looking at the
+ * catalogs could be confused. Rename it to prevent this problem.
*
* Note no lock required on the relation, because we already hold an
* exclusive lock on it.
@@ -679,10 +679,10 @@ make_new_heap(Oid OIDOldHeap, const char *NewName, Oid NewTableSpace)
/*
* Need to make a copy of the tuple descriptor, since
- * heap_create_with_catalog modifies it. Note that the NewHeap will
- * not receive any of the defaults or constraints associated with the
- * OldHeap; we don't need 'em, and there's no reason to spend cycles
- * inserting them into the catalogs only to delete them.
+ * heap_create_with_catalog modifies it. Note that the NewHeap will not
+ * receive any of the defaults or constraints associated with the OldHeap;
+ * we don't need 'em, and there's no reason to spend cycles inserting them
+ * into the catalogs only to delete them.
*/
tupdesc = CreateTupleDescCopy(OldHeapDesc);
@@ -811,8 +811,8 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
&OldestXmin, &FreezeXid, NULL);
/*
- * FreezeXid will become the table's new relfrozenxid, and that mustn't
- * go backwards, so take the max.
+ * FreezeXid will become the table's new relfrozenxid, and that mustn't go
+ * backwards, so take the max.
*/
if (TransactionIdPrecedes(FreezeXid, OldHeap->rd_rel->relfrozenxid))
FreezeXid = OldHeap->rd_rel->relfrozenxid;
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index 5f5da2a895..b6a90a248b 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -7,7 +7,7 @@
* Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.106 2009/01/01 17:23:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.107 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -249,7 +249,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
else
{
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(description), values,
- nulls, replaces);
+ nulls, replaces);
simple_heap_update(description, &oldtuple->t_self, newtuple);
}
@@ -263,7 +263,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
if (newtuple == NULL && comment != NULL)
{
newtuple = heap_form_tuple(RelationGetDescr(description),
- values, nulls);
+ values, nulls);
simple_heap_insert(description, newtuple);
}
@@ -344,7 +344,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
else
{
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(shdescription),
- values, nulls, replaces);
+ values, nulls, replaces);
simple_heap_update(shdescription, &oldtuple->t_self, newtuple);
}
@@ -358,7 +358,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
if (newtuple == NULL && comment != NULL)
{
newtuple = heap_form_tuple(RelationGetDescr(shdescription),
- values, nulls);
+ values, nulls);
simple_heap_insert(shdescription, newtuple);
}
diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c
index 13c55d51bf..8f5093f808 100644
--- a/src/backend/commands/conversioncmds.c
+++ b/src/backend/commands/conversioncmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.38 2009/02/27 16:35:26 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.39 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,8 +87,8 @@ CreateConversionCommand(CreateConversionStmt *stmt)
if (get_func_rettype(funcoid) != VOIDOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("encoding conversion function %s must return type \"void\"",
- NameListToString(func_name))));
+ errmsg("encoding conversion function %s must return type \"void\"",
+ NameListToString(func_name))));
/* Check we have EXECUTE rights for the function */
aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE);
@@ -97,10 +97,10 @@ CreateConversionCommand(CreateConversionStmt *stmt)
NameListToString(func_name));
/*
- * Check that the conversion function is suitable for the requested
- * source and target encodings. We do that by calling the function with
- * an empty string; the conversion function should throw an error if it
- * can't perform the requested conversion.
+ * Check that the conversion function is suitable for the requested source
+ * and target encodings. We do that by calling the function with an empty
+ * string; the conversion function should throw an error if it can't
+ * perform the requested conversion.
*/
OidFunctionCall5(funcoid,
Int32GetDatum(from_encoding),
@@ -124,19 +124,19 @@ void
DropConversionsCommand(DropStmt *drop)
{
ObjectAddresses *objects;
- ListCell *cell;
+ ListCell *cell;
/*
* First we identify all the conversions, then we delete them in a single
- * performMultipleDeletions() call. This is to avoid unwanted
- * DROP RESTRICT errors if one of the conversions depends on another.
- * (Not that that is very likely, but we may as well do this consistently.)
+ * performMultipleDeletions() call. This is to avoid unwanted DROP
+ * RESTRICT errors if one of the conversions depends on another. (Not that
+ * that is very likely, but we may as well do this consistently.)
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
- List *name = (List *) lfirst(cell);
+ List *name = (List *) lfirst(cell);
Oid conversionOid;
HeapTuple tuple;
Form_pg_conversion con;
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 7840e7b52c..c464ed7f6c 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.311 2009/06/03 15:06:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.312 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -178,7 +178,7 @@ typedef struct
* function call overhead in tight COPY loops.
*
* We must use "if (1)" because the usual "do {...} while(0)" wrapper would
- * prevent the continue/break processing from working. We end the "if (1)"
+ * prevent the continue/break processing from working. We end the "if (1)"
* with "else ((void) 0)" to ensure the "if" does not unintentionally match
* any "else" in the calling code, and to avoid any compiler warnings about
* empty statements. See http://www.cit.gu.edu.au/~anthony/info/C/C.macros.
@@ -859,7 +859,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString)
if (strlen(cstate->delim) != 1)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY delimiter must be a single one-byte character")));
+ errmsg("COPY delimiter must be a single one-byte character")));
/* Disallow end-of-line characters */
if (strchr(cstate->delim, '\r') != NULL ||
@@ -879,8 +879,8 @@ DoCopy(const CopyStmt *stmt, const char *queryString)
* backslash because it would be ambiguous. We can't allow the other
* cases because data characters matching the delimiter must be
* backslashed, and certain backslash combinations are interpreted
- * non-literally by COPY IN. Disallowing all lower case ASCII letters
- * is more than strictly necessary, but seems best for consistency and
+ * non-literally by COPY IN. Disallowing all lower case ASCII letters is
+ * more than strictly necessary, but seems best for consistency and
* future-proofing. Likewise we disallow all digits though only octal
* digits are actually dangerous.
*/
@@ -1670,7 +1670,7 @@ CopyFrom(CopyState cstate)
MemoryContext oldcontext = CurrentMemoryContext;
ErrorContextCallback errcontext;
CommandId mycid = GetCurrentCommandId(true);
- int hi_options = 0; /* start with default heap_insert options */
+ int hi_options = 0; /* start with default heap_insert options */
BulkInsertState bistate;
Assert(cstate->rel);
@@ -2454,10 +2454,10 @@ CopyReadLineText(CopyState cstate)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
- errmsg("literal carriage return found in data") :
- errmsg("unquoted carriage return found in data"),
+ errmsg("literal carriage return found in data") :
+ errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
- errhint("Use \"\\r\" to represent carriage return.") :
+ errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/*
@@ -2474,7 +2474,7 @@ CopyReadLineText(CopyState cstate)
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
- errhint("Use \"\\r\" to represent carriage return.") :
+ errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/* If reach here, we have found the line terminator */
break;
@@ -2491,7 +2491,7 @@ CopyReadLineText(CopyState cstate)
errmsg("unquoted newline found in data"),
!cstate->csv_mode ?
errhint("Use \"\\n\" to represent newline.") :
- errhint("Use quoted CSV field to represent newline.")));
+ errhint("Use quoted CSV field to represent newline.")));
cstate->eol_type = EOL_NL; /* in case not set yet */
/* If reach here, we have found the line terminator */
break;
@@ -2847,9 +2847,9 @@ CopyReadAttributesText(CopyState cstate, int maxfields, char **fieldvals)
*output_ptr++ = '\0';
/*
- * If we de-escaped a non-7-bit-ASCII char, 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 non-7-bit-ASCII char, make sure we still have
+ * valid data for the db encoding. Avoid calling strlen here for the
+ * sake of efficiency.
*/
if (saw_non_ascii)
{
@@ -2945,12 +2945,12 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals)
start_ptr = cur_ptr;
fieldvals[fieldno] = output_ptr;
- /* Scan data for field,
+ /*
+ * Scan data for field,
*
- * The loop starts in "not quote" mode and then toggles between
- * that and "in quote" mode.
- * The loop exits normally if it is in "not quote" mode and a
- * delimiter or line end is seen.
+ * The loop starts in "not quote" mode and then toggles between that
+ * and "in quote" mode. The loop exits normally if it is in "not
+ * quote" mode and a delimiter or line end is seen.
*/
for (;;)
{
@@ -2994,8 +2994,8 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals)
if (c == escapec)
{
/*
- * peek at the next char if available, and escape it if it is
- * an escape char or a quote char
+ * peek at the next char if available, and escape it if it
+ * is an escape char or a quote char
*/
if (cur_ptr < line_end_ptr)
{
@@ -3009,10 +3009,11 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals)
}
}
}
+
/*
- * end of quoted field. Must do this test after testing for escape
- * in case quote char and escape char are the same (which is the
- * common case).
+ * end of quoted field. Must do this test after testing for
+ * escape in case quote char and escape char are the same
+ * (which is the common case).
*/
if (c == quotec)
break;
@@ -3021,7 +3022,7 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals)
*output_ptr++ = c;
}
}
- endfield:
+endfield:
/* Terminate attribute value in output area */
*output_ptr++ = '\0';
@@ -3144,11 +3145,11 @@ CopyAttributeOutText(CopyState cstate, char *string)
if ((unsigned char) c < (unsigned char) 0x20)
{
/*
- * \r and \n must be escaped, the others are traditional.
- * We prefer to dump these using the C-like notation, rather
- * than a backslash and the literal character, because it
- * makes the dump file a bit more proof against Microsoftish
- * data mangling.
+ * \r and \n must be escaped, the others are traditional. We
+ * prefer to dump these using the C-like notation, rather than
+ * a backslash and the literal character, because it makes the
+ * dump file a bit more proof against Microsoftish data
+ * mangling.
*/
switch (c)
{
@@ -3182,7 +3183,7 @@ CopyAttributeOutText(CopyState cstate, char *string)
DUMPSOFAR();
CopySendChar(cstate, '\\');
CopySendChar(cstate, c);
- start = ++ptr; /* do not include char in next run */
+ start = ++ptr; /* do not include char in next run */
}
else if (c == '\\' || c == delimc)
{
@@ -3204,11 +3205,11 @@ CopyAttributeOutText(CopyState cstate, char *string)
if ((unsigned char) c < (unsigned char) 0x20)
{
/*
- * \r and \n must be escaped, the others are traditional.
- * We prefer to dump these using the C-like notation, rather
- * than a backslash and the literal character, because it
- * makes the dump file a bit more proof against Microsoftish
- * data mangling.
+ * \r and \n must be escaped, the others are traditional. We
+ * prefer to dump these using the C-like notation, rather than
+ * a backslash and the literal character, because it makes the
+ * dump file a bit more proof against Microsoftish data
+ * mangling.
*/
switch (c)
{
@@ -3242,7 +3243,7 @@ CopyAttributeOutText(CopyState cstate, char *string)
DUMPSOFAR();
CopySendChar(cstate, '\\');
CopySendChar(cstate, c);
- start = ++ptr; /* do not include char in next run */
+ start = ++ptr; /* do not include char in next run */
}
else if (c == '\\' || c == delimc)
{
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 8d5972dfa5..1ea84fdbb2 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.224 2009/05/06 16:15:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.225 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -334,8 +334,8 @@ createdb(const CreatedbStmt *stmt)
/*
* Check whether chosen encoding matches chosen locale settings. This
* restriction is necessary because libc's locale-specific code usually
- * fails when presented with data in an encoding it's not expecting.
- * We allow mismatch in three cases:
+ * fails when presented with data in an encoding it's not expecting. We
+ * allow mismatch in three cases:
*
* 1. locale encoding = SQL_ASCII, which means either that the locale is
* C/POSIX which works with any encoding, or that we couldn't determine
@@ -365,8 +365,8 @@ createdb(const CreatedbStmt *stmt)
errmsg("encoding %s does not match locale %s",
pg_encoding_to_char(encoding),
dbctype),
- errdetail("The chosen LC_CTYPE setting requires encoding %s.",
- pg_encoding_to_char(ctype_encoding))));
+ errdetail("The chosen LC_CTYPE setting requires encoding %s.",
+ pg_encoding_to_char(ctype_encoding))));
if (!(collate_encoding == encoding ||
collate_encoding == PG_SQL_ASCII ||
@@ -554,7 +554,7 @@ createdb(const CreatedbStmt *stmt)
new_record_nulls[Anum_pg_database_datacl - 1] = true;
tuple = heap_form_tuple(RelationGetDescr(pg_database_rel),
- new_record, new_record_nulls);
+ new_record, new_record_nulls);
HeapTupleSetOid(tuple, dboid);
@@ -716,9 +716,9 @@ createdb_failure_callback(int code, Datum arg)
createdb_failure_params *fparms = (createdb_failure_params *) DatumGetPointer(arg);
/*
- * Release lock on source database before doing recursive remove.
- * This is not essential but it seems desirable to release the lock
- * as soon as possible.
+ * Release lock on source database before doing recursive remove. This is
+ * not essential but it seems desirable to release the lock as soon as
+ * possible.
*/
UnlockSharedObject(DatabaseRelationId, fparms->src_dboid, 0, ShareLock);
@@ -842,9 +842,9 @@ dropdb(const char *dbname, bool missing_ok)
/*
* Tell bgwriter to forget any pending fsync and unlink requests for files
- * in the database; else the fsyncs will fail at next checkpoint, or worse,
- * it will delete files that belong to a newly created database with the
- * same OID.
+ * in the database; else the fsyncs will fail at next checkpoint, or
+ * worse, it will delete files that belong to a newly created database
+ * with the same OID.
*/
ForgetDatabaseFsyncRequests(db_id);
@@ -975,21 +975,23 @@ RenameDatabase(const char *oldname, const char *newname)
static void
movedb(const char *dbname, const char *tblspcname)
{
- Oid db_id;
- Relation pgdbrel;
- int notherbackends;
- int npreparedxacts;
- HeapTuple oldtuple, newtuple;
- Oid src_tblspcoid, dst_tblspcoid;
- Datum new_record[Natts_pg_database];
- bool new_record_nulls[Natts_pg_database];
- bool new_record_repl[Natts_pg_database];
- ScanKeyData scankey;
- SysScanDesc sysscan;
- AclResult aclresult;
- char *src_dbpath;
- char *dst_dbpath;
- DIR *dstdir;
+ Oid db_id;
+ Relation pgdbrel;
+ int notherbackends;
+ int npreparedxacts;
+ HeapTuple oldtuple,
+ newtuple;
+ Oid src_tblspcoid,
+ dst_tblspcoid;
+ Datum new_record[Natts_pg_database];
+ bool new_record_nulls[Natts_pg_database];
+ bool new_record_repl[Natts_pg_database];
+ ScanKeyData scankey;
+ SysScanDesc sysscan;
+ AclResult aclresult;
+ char *src_dbpath;
+ char *dst_dbpath;
+ DIR *dstdir;
struct dirent *xlde;
movedb_failure_params fparms;
@@ -1089,13 +1091,13 @@ movedb(const char *dbname, const char *tblspcname)
/*
* Force a checkpoint before proceeding. This will force dirty buffers out
- * to disk, to ensure source database is up-to-date on disk for the
- * copy. FlushDatabaseBuffers() would suffice for that, but we also want
- * to process any pending unlink requests. Otherwise, the check for
- * existing files in the target directory might fail unnecessarily, not to
- * mention that the copy might fail due to source files getting deleted
- * under it. On Windows, this also ensures that the bgwriter doesn't hold
- * any open files, which would cause rmdir() to fail.
+ * to disk, to ensure source database is up-to-date on disk for the copy.
+ * FlushDatabaseBuffers() would suffice for that, but we also want to
+ * process any pending unlink requests. Otherwise, the check for existing
+ * files in the target directory might fail unnecessarily, not to mention
+ * that the copy might fail due to source files getting deleted under it.
+ * On Windows, this also ensures that the bgwriter doesn't hold any open
+ * files, which would cause rmdir() to fail.
*/
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
@@ -1125,8 +1127,8 @@ movedb(const char *dbname, const char *tblspcname)
FreeDir(dstdir);
/*
- * The directory exists but is empty.
- * We must remove it before using the copydir function.
+ * The directory exists but is empty. We must remove it before using
+ * the copydir function.
*/
if (rmdir(dst_dbpath) != 0)
elog(ERROR, "could not remove directory \"%s\": %m",
@@ -1135,7 +1137,7 @@ movedb(const char *dbname, const char *tblspcname)
/*
* Use an ENSURE block to make sure we remove the debris if the copy fails
- * (eg, due to out-of-disk-space). This is not a 100% solution, because
+ * (eg, due to out-of-disk-space). This is not a 100% solution, because
* of the possibility of failure during transaction commit, but it should
* handle most scenarios.
*/
@@ -1179,7 +1181,7 @@ movedb(const char *dbname, const char *tblspcname)
sysscan = systable_beginscan(pgdbrel, DatabaseNameIndexId, true,
SnapshotNow, 1, &scankey);
oldtuple = systable_getnext(sysscan);
- if (!HeapTupleIsValid(oldtuple)) /* shouldn't happen... */
+ if (!HeapTupleIsValid(oldtuple)) /* shouldn't happen... */
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", dbname)));
@@ -1228,13 +1230,13 @@ movedb(const char *dbname, const char *tblspcname)
PointerGetDatum(&fparms));
/*
- * Commit the transaction so that the pg_database update is committed.
- * If we crash while removing files, the database won't be corrupt,
- * we'll just leave some orphaned files in the old directory.
+ * Commit the transaction so that the pg_database update is committed. If
+ * we crash while removing files, the database won't be corrupt, we'll
+ * just leave some orphaned files in the old directory.
*
* (This is OK because we know we aren't inside a transaction block.)
*
- * XXX would it be safe/better to do this inside the ensure block? Not
+ * XXX would it be safe/better to do this inside the ensure block? Not
* convinced it's a good idea; consider elog just after the transaction
* really commits.
*/
@@ -1389,7 +1391,7 @@ AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel)
}
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), new_record,
- new_record_nulls, new_record_repl);
+ new_record_nulls, new_record_repl);
simple_heap_update(rel, &tuple->t_self, newtuple);
/* Update indexes */
@@ -1482,7 +1484,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
}
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel),
- repl_val, repl_null, repl_repl);
+ repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tuple->t_self, newtuple);
/* Update indexes */
@@ -1720,11 +1722,11 @@ get_db_info(const char *name, LOCKMODE lockmode,
/* default tablespace for this database */
if (dbTablespace)
*dbTablespace = dbform->dattablespace;
- /* default locale settings for this database */
- if (dbCollate)
- *dbCollate = pstrdup(NameStr(dbform->datcollate));
- if (dbCtype)
- *dbCtype = pstrdup(NameStr(dbform->datctype));
+ /* default locale settings for this database */
+ if (dbCollate)
+ *dbCollate = pstrdup(NameStr(dbform->datcollate));
+ if (dbCtype)
+ *dbCtype = pstrdup(NameStr(dbform->datctype));
ReleaseSysCache(tuple);
result = true;
break;
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index d8f27a1175..45e8edf595 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.185 2009/04/05 19:59:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.186 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,7 +61,7 @@ static void explain_outNode(StringInfo str,
Plan *outer_plan,
int indent, ExplainState *es);
static void show_plan_tlist(Plan *plan,
- StringInfo str, int indent, ExplainState *es);
+ StringInfo str, int indent, ExplainState *es);
static void show_scan_qual(List *qual, const char *qlabel,
int scanrelid, Plan *scan_plan, Plan *outer_plan,
StringInfo str, int indent, ExplainState *es);
@@ -342,7 +342,7 @@ void
ExplainPrintPlan(StringInfo str, QueryDesc *queryDesc,
bool analyze, bool verbose)
{
- ExplainState es;
+ ExplainState es;
Assert(queryDesc->plannedstmt != NULL);
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index 74021efdae..79706b0837 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.7 2009/04/04 21:12:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.8 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,8 +47,8 @@
static Datum
optionListToArray(List *options)
{
- ArrayBuildState *astate = NULL;
- ListCell *cell;
+ ArrayBuildState *astate = NULL;
+ ListCell *cell;
foreach(cell, options)
{
@@ -76,7 +76,7 @@ optionListToArray(List *options)
/*
- * Transform a list of DefElem into text array format. This is substantially
+ * Transform a list of DefElem into text array format. This is substantially
* the same thing as optionListToArray(), except we recognize SET/ADD/DROP
* actions for modifying an existing list of options, which is passed in
* Datum form as oldOptions. Also, if fdwvalidator isn't InvalidOid
@@ -92,23 +92,23 @@ transformGenericOptions(Datum oldOptions,
List *options,
Oid fdwvalidator)
{
- List *resultOptions = untransformRelOptions(oldOptions);
- ListCell *optcell;
- Datum result;
+ List *resultOptions = untransformRelOptions(oldOptions);
+ ListCell *optcell;
+ Datum result;
foreach(optcell, options)
{
- DefElem *od = lfirst(optcell);
+ DefElem *od = lfirst(optcell);
ListCell *cell;
ListCell *prev = NULL;
/*
- * Find the element in resultOptions. We need this for
- * validation in all cases. Also identify the previous element.
+ * Find the element in resultOptions. We need this for validation in
+ * all cases. Also identify the previous element.
*/
- foreach (cell, resultOptions)
+ foreach(cell, resultOptions)
{
- DefElem *def = lfirst(cell);
+ DefElem *def = lfirst(cell);
if (strcmp(def->defname, od->defname) == 0)
break;
@@ -117,10 +117,10 @@ transformGenericOptions(Datum oldOptions,
}
/*
- * It is possible to perform multiple SET/DROP actions on the
- * same option. The standard permits this, as long as the
- * options to be added are unique. Note that an unspecified
- * action is taken to be ADD.
+ * It is possible to perform multiple SET/DROP actions on the same
+ * option. The standard permits this, as long as the options to be
+ * added are unique. Note that an unspecified action is taken to be
+ * ADD.
*/
switch (od->defaction)
{
@@ -174,16 +174,16 @@ transformGenericOptions(Datum oldOptions,
static Oid
GetUserOidFromMapping(const char *username, bool missing_ok)
{
- if (!username)
- /* PUBLIC user mapping */
- return InvalidOid;
+ if (!username)
+ /* PUBLIC user mapping */
+ return InvalidOid;
- if (strcmp(username, "current_user") == 0)
- /* map to the owner */
- return GetUserId();
+ if (strcmp(username, "current_user") == 0)
+ /* map to the owner */
+ return GetUserId();
- /* map to provided user */
- return missing_ok ? get_roleid(username) : get_roleid_checked(username);
+ /* map to provided user */
+ return missing_ok ? get_roleid(username) : get_roleid_checked(username);
}
@@ -201,7 +201,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
Oid fdwId;
Form_pg_foreign_data_wrapper form;
- /* Must be a superuser to change a FDW owner */
+ /* Must be a superuser to change a FDW owner */
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
@@ -209,13 +209,13 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
name),
errhint("Must be superuser to change owner of a foreign-data wrapper.")));
- /* New owner must also be a superuser */
+ /* New owner must also be a superuser */
if (!superuser_arg(newOwnerId))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to change owner of foreign-data wrapper \"%s\"",
name),
- errhint("The owner of a foreign-data wrapper must be a superuser.")));
+ errhint("The owner of a foreign-data wrapper must be a superuser.")));
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
@@ -226,7 +226,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("foreign-data wrapper \"%s\" does not exist", name)));
+ errmsg("foreign-data wrapper \"%s\" does not exist", name)));
fdwId = HeapTupleGetOid(tup);
form = (Form_pg_foreign_data_wrapper) GETSTRUCT(tup);
@@ -268,9 +268,9 @@ AlterForeignServerOwner(const char *name, Oid newOwnerId)
0, 0, 0);
if (!HeapTupleIsValid(tup))
- ereport(ERROR,
- (errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("server \"%s\" does not exist", name)));
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("server \"%s\" does not exist", name)));
srvId = HeapTupleGetOid(tup);
form = (Form_pg_foreign_server) GETSTRUCT(tup);
@@ -334,22 +334,22 @@ lookup_fdw_validator_func(List *validator)
void
CreateForeignDataWrapper(CreateFdwStmt *stmt)
{
- Relation rel;
- Datum values[Natts_pg_foreign_data_wrapper];
- bool nulls[Natts_pg_foreign_data_wrapper];
- HeapTuple tuple;
- Oid fdwId;
- Oid fdwvalidator;
- Datum fdwoptions;
- Oid ownerId;
+ Relation rel;
+ Datum values[Natts_pg_foreign_data_wrapper];
+ bool nulls[Natts_pg_foreign_data_wrapper];
+ HeapTuple tuple;
+ Oid fdwId;
+ Oid fdwvalidator;
+ Datum fdwoptions;
+ Oid ownerId;
/* Must be super user */
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied to create foreign-data wrapper \"%s\"",
- stmt->fdwname),
- errhint("Must be superuser to create a foreign-data wrapper.")));
+ errmsg("permission denied to create foreign-data wrapper \"%s\"",
+ stmt->fdwname),
+ errhint("Must be superuser to create a foreign-data wrapper.")));
/* For now the owner cannot be specified on create. Use effective user ID. */
ownerId = GetUserId();
@@ -440,9 +440,9 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied to alter foreign-data wrapper \"%s\"",
- stmt->fdwname),
- errhint("Must be superuser to alter a foreign-data wrapper.")));
+ errmsg("permission denied to alter foreign-data wrapper \"%s\"",
+ stmt->fdwname),
+ errhint("Must be superuser to alter a foreign-data wrapper.")));
tp = SearchSysCacheCopy(FOREIGNDATAWRAPPERNAME,
CStringGetDatum(stmt->fdwname),
@@ -451,7 +451,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
if (!HeapTupleIsValid(tp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("foreign-data wrapper \"%s\" does not exist", stmt->fdwname)));
+ errmsg("foreign-data wrapper \"%s\" does not exist", stmt->fdwname)));
fdwId = HeapTupleGetOid(tp);
@@ -467,18 +467,17 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
/*
* It could be that the options for the FDW, SERVER and USER MAPPING
- * are no longer valid with the new validator. Warn about this.
+ * are no longer valid with the new validator. Warn about this.
*/
if (stmt->validator)
ereport(WARNING,
- (errmsg("changing the foreign-data wrapper validator can cause "
- "the options for dependent objects to become invalid")));
+ (errmsg("changing the foreign-data wrapper validator can cause "
+ "the options for dependent objects to become invalid")));
}
else
{
/*
- * Validator is not changed, but we need it for validating
- * options.
+ * Validator is not changed, but we need it for validating options.
*/
datum = SysCacheGetAttr(FOREIGNDATAWRAPPEROID,
tp,
@@ -517,7 +516,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
- repl_val, repl_null, repl_repl);
+ repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tp->t_self, tp);
CatalogUpdateIndexes(rel, tp);
@@ -533,30 +532,30 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
void
RemoveForeignDataWrapper(DropFdwStmt *stmt)
{
- Oid fdwId;
- ObjectAddress object;
+ Oid fdwId;
+ ObjectAddress object;
fdwId = GetForeignDataWrapperOidByName(stmt->fdwname, true);
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
- errmsg("permission denied to drop foreign-data wrapper \"%s\"",
- stmt->fdwname),
- errhint("Must be superuser to drop a foreign-data wrapper.")));
+ errmsg("permission denied to drop foreign-data wrapper \"%s\"",
+ stmt->fdwname),
+ errhint("Must be superuser to drop a foreign-data wrapper.")));
if (!OidIsValid(fdwId))
{
if (!stmt->missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("foreign-data wrapper \"%s\" does not exist",
- stmt->fdwname)));
+ errmsg("foreign-data wrapper \"%s\" does not exist",
+ stmt->fdwname)));
/* IF EXISTS specified, just note it */
ereport(NOTICE,
- (errmsg("foreign-data wrapper \"%s\" does not exist, skipping",
- stmt->fdwname)));
+ (errmsg("foreign-data wrapper \"%s\" does not exist, skipping",
+ stmt->fdwname)));
return;
}
@@ -603,16 +602,16 @@ RemoveForeignDataWrapperById(Oid fdwId)
void
CreateForeignServer(CreateForeignServerStmt *stmt)
{
- Relation rel;
- Datum srvoptions;
- Datum values[Natts_pg_foreign_server];
- bool nulls[Natts_pg_foreign_server];
- HeapTuple tuple;
- Oid srvId;
- Oid ownerId;
- AclResult aclresult;
- ObjectAddress myself;
- ObjectAddress referenced;
+ Relation rel;
+ Datum srvoptions;
+ Datum values[Natts_pg_foreign_server];
+ bool nulls[Natts_pg_foreign_server];
+ HeapTuple tuple;
+ Oid srvId;
+ Oid ownerId;
+ AclResult aclresult;
+ ObjectAddress myself;
+ ObjectAddress referenced;
ForeignDataWrapper *fdw;
/* For now the owner cannot be specified on create. Use effective user ID. */
@@ -628,8 +627,8 @@ CreateForeignServer(CreateForeignServerStmt *stmt)
stmt->servername)));
/*
- * Check that the FDW exists and that we have USAGE on it.
- * Also get the actual FDW for option validation etc.
+ * Check that the FDW exists and that we have USAGE on it. Also get the
+ * actual FDW for option validation etc.
*/
fdw = GetForeignDataWrapperByName(stmt->fdwname, false);
@@ -712,7 +711,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
bool repl_null[Natts_pg_foreign_server];
bool repl_repl[Natts_pg_foreign_server];
Oid srvId;
- Form_pg_foreign_server srvForm;
+ Form_pg_foreign_server srvForm;
tp = SearchSysCacheCopy(FOREIGNSERVERNAME,
CStringGetDatum(stmt->servername),
@@ -721,7 +720,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
if (!HeapTupleIsValid(tp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("server \"%s\" does not exist", stmt->servername)));
+ errmsg("server \"%s\" does not exist", stmt->servername)));
srvId = HeapTupleGetOid(tp);
srvForm = (Form_pg_foreign_server) GETSTRUCT(tp);
@@ -754,8 +753,8 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
if (stmt->options)
{
ForeignDataWrapper *fdw = GetForeignDataWrapper(srvForm->srvfdw);
- Datum datum;
- bool isnull;
+ Datum datum;
+ bool isnull;
/* Extract the current srvoptions */
datum = SysCacheGetAttr(FOREIGNSERVEROID,
@@ -782,7 +781,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
- repl_val, repl_null, repl_repl);
+ repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tp->t_self, tp);
CatalogUpdateIndexes(rel, tp);
@@ -798,8 +797,8 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
void
RemoveForeignServer(DropForeignServerStmt *stmt)
{
- Oid srvId;
- ObjectAddress object;
+ Oid srvId;
+ ObjectAddress object;
srvId = GetForeignServerOidByName(stmt->servername, true);
@@ -809,7 +808,7 @@ RemoveForeignServer(DropForeignServerStmt *stmt)
if (!stmt->missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("server \"%s\" does not exist", stmt->servername)));
+ errmsg("server \"%s\" does not exist", stmt->servername)));
/* IF EXISTS specified, just note it */
ereport(NOTICE,
@@ -871,7 +870,7 @@ user_mapping_ddl_aclcheck(Oid umuserid, Oid serverid, const char *servername)
{
if (umuserid == curuserid)
{
- AclResult aclresult;
+ AclResult aclresult;
aclresult = pg_foreign_server_aclcheck(serverid, curuserid, ACL_USAGE);
if (aclresult != ACLCHECK_OK)
@@ -890,16 +889,16 @@ user_mapping_ddl_aclcheck(Oid umuserid, Oid serverid, const char *servername)
void
CreateUserMapping(CreateUserMappingStmt *stmt)
{
- Relation rel;
- Datum useoptions;
- Datum values[Natts_pg_user_mapping];
- bool nulls[Natts_pg_user_mapping];
- HeapTuple tuple;
- Oid useId;
- Oid umId;
- ObjectAddress myself;
- ObjectAddress referenced;
- ForeignServer *srv;
+ Relation rel;
+ Datum useoptions;
+ Datum values[Natts_pg_user_mapping];
+ bool nulls[Natts_pg_user_mapping];
+ HeapTuple tuple;
+ Oid useId;
+ Oid umId;
+ ObjectAddress myself;
+ ObjectAddress referenced;
+ ForeignServer *srv;
ForeignDataWrapper *fdw;
useId = GetUserOidFromMapping(stmt->username, false);
@@ -913,9 +912,9 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
* Check that the user mapping is unique within server.
*/
umId = GetSysCacheOid(USERMAPPINGUSERSERVER,
- ObjectIdGetDatum(useId),
- ObjectIdGetDatum(srv->serverid),
- 0, 0);
+ ObjectIdGetDatum(useId),
+ ObjectIdGetDatum(srv->serverid),
+ 0, 0);
if (OidIsValid(umId))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -984,7 +983,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
bool repl_repl[Natts_pg_user_mapping];
Oid useId;
Oid umId;
- ForeignServer *srv;
+ ForeignServer *srv;
useId = GetUserOidFromMapping(stmt->username, false);
srv = GetForeignServerByName(stmt->servername, false);
@@ -996,8 +995,8 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
if (!OidIsValid(umId))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("user mapping \"%s\" does not exist for the server",
- MappingUserName(useId))));
+ errmsg("user mapping \"%s\" does not exist for the server",
+ MappingUserName(useId))));
user_mapping_ddl_aclcheck(useId, srv->serverid, stmt->servername);
@@ -1014,9 +1013,9 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
if (stmt->options)
{
- ForeignDataWrapper *fdw;
- Datum datum;
- bool isnull;
+ ForeignDataWrapper *fdw;
+ Datum datum;
+ bool isnull;
/*
* Process the options.
@@ -1048,7 +1047,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
rel = heap_open(UserMappingRelationId, RowExclusiveLock);
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
- repl_val, repl_null, repl_repl);
+ repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tp->t_self, tp);
CatalogUpdateIndexes(rel, tp);
@@ -1064,10 +1063,10 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
void
RemoveUserMapping(DropUserMappingStmt *stmt)
{
- ObjectAddress object;
- Oid useId;
- Oid umId;
- ForeignServer *srv;
+ ObjectAddress object;
+ Oid useId;
+ Oid umId;
+ ForeignServer *srv;
useId = GetUserOidFromMapping(stmt->username, stmt->missing_ok);
srv = GetForeignServerByName(stmt->servername, true);
@@ -1075,8 +1074,8 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
if (stmt->username && !OidIsValid(useId))
{
/*
- * IF EXISTS specified, role not found and not public.
- * Notice this and leave.
+ * IF EXISTS specified, role not found and not public. Notice this and
+ * leave.
*/
elog(NOTICE, "role \"%s\" does not exist, skipping", stmt->username);
return;
@@ -1087,8 +1086,8 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
if (!stmt->missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("server \"%s\" does not exist",
- stmt->servername)));
+ errmsg("server \"%s\" does not exist",
+ stmt->servername)));
/* IF EXISTS, just note it */
ereport(NOTICE, (errmsg("server does not exist, skipping")));
return;
@@ -1104,13 +1103,13 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
if (!stmt->missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("user mapping \"%s\" does not exist for the server",
- MappingUserName(useId))));
+ errmsg("user mapping \"%s\" does not exist for the server",
+ MappingUserName(useId))));
/* IF EXISTS specified, just note it */
ereport(NOTICE,
- (errmsg("user mapping \"%s\" does not exist for the server, skipping",
- MappingUserName(useId))));
+ (errmsg("user mapping \"%s\" does not exist for the server, skipping",
+ MappingUserName(useId))));
return;
}
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index a6dd2cb6db..2151fd94f0 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.109 2009/03/04 11:53:53 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.110 2009/06/11 14:48:55 momjian Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -274,7 +274,7 @@ examine_parameter_list(List *parameters, Oid languageOid,
if (!OidIsValid(get_element_type(toid)))
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
- errmsg("VARIADIC parameter must be an array")));
+ errmsg("VARIADIC parameter must be an array")));
break;
}
}
@@ -291,12 +291,12 @@ examine_parameter_list(List *parameters, Oid languageOid,
if (fp->defexpr)
{
- Node *def;
+ Node *def;
if (!isinput)
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
- errmsg("only input parameters can have default values")));
+ errmsg("only input parameters can have default values")));
def = transformExpr(pstate, fp->defexpr);
def = coerce_to_specific_type(pstate, def, toid, "DEFAULT");
@@ -324,7 +324,7 @@ examine_parameter_list(List *parameters, Oid languageOid,
if (pstate->p_hasSubLinks)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot use subquery in parameter default value")));
+ errmsg("cannot use subquery in parameter default value")));
if (pstate->p_hasAggs)
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
@@ -685,7 +685,7 @@ interpret_AS_clause(Oid languageOid, const char *languageName,
{
/*
* For "C" language, store the file name in probin and, when given,
- * the link symbol name in prosrc. If link symbol is omitted,
+ * the link symbol name in prosrc. If link symbol is omitted,
* substitute procedure name. We also allow link symbol to be
* specified as "-", since that was the habit in PG versions before
* 8.4, and there might be dump files out there that don't translate
@@ -1243,7 +1243,7 @@ AlterFunctionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
}
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val,
- repl_null, repl_repl);
+ repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);
@@ -1375,7 +1375,7 @@ AlterFunction(AlterFunctionStmt *stmt)
}
tup = heap_modify_tuple(tup, RelationGetDescr(rel),
- repl_val, repl_null, repl_repl);
+ repl_val, repl_null, repl_repl);
}
/* Do the update */
@@ -1513,7 +1513,7 @@ CreateCast(CreateCastStmt *stmt)
/* Detemine the cast method */
if (stmt->func != NULL)
castmethod = COERCION_METHOD_FUNCTION;
- else if(stmt->inout)
+ else if (stmt->inout)
castmethod = COERCION_METHOD_INOUT;
else
castmethod = COERCION_METHOD_BINARY;
@@ -1541,7 +1541,7 @@ CreateCast(CreateCastStmt *stmt)
if (!IsBinaryCoercible(sourcetypeid, procstruct->proargtypes.values[0]))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("argument of cast function must match or be binary-coercible from source data type")));
+ errmsg("argument of cast function must match or be binary-coercible from source data type")));
if (nargs > 1 && procstruct->proargtypes.values[1] != INT4OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
@@ -1573,7 +1573,7 @@ CreateCast(CreateCastStmt *stmt)
if (procstruct->proiswindow)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("cast function must not be a window function")));
+ errmsg("cast function must not be a window function")));
if (procstruct->proretset)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
@@ -1622,7 +1622,7 @@ CreateCast(CreateCastStmt *stmt)
/*
* We know that composite, enum and array types are never binary-
- * compatible with each other. They all have OIDs embedded in them.
+ * compatible with each other. They all have OIDs embedded in them.
*
* Theoretically you could build a user-defined base type that is
* binary-compatible with a composite, enum, or array type. But we
@@ -1633,7 +1633,7 @@ CreateCast(CreateCastStmt *stmt)
targettyptype == TYPTYPE_COMPOSITE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("composite data types are not binary-compatible")));
+ errmsg("composite data types are not binary-compatible")));
if (sourcetyptype == TYPTYPE_ENUM ||
targettyptype == TYPTYPE_ENUM)
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index f2ff5b6da2..c6a01f5b75 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.184 2009/04/04 17:40:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.185 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -639,25 +639,25 @@ DefineIndex(RangeVar *heapRelation,
* We can exclude any running transactions that have xmin > the xmin of
* our reference snapshot; their oldest snapshot must be newer than ours.
* We can also exclude any transactions that have xmin = zero, since they
- * evidently have no live snapshot at all (and any one they might be
- * in process of taking is certainly newer than ours). Transactions in
- * other DBs can be ignored too, since they'll never even be able to see
- * this index.
+ * evidently have no live snapshot at all (and any one they might be in
+ * process of taking is certainly newer than ours). Transactions in other
+ * DBs can be ignored too, since they'll never even be able to see this
+ * index.
*
* We can also exclude autovacuum processes and processes running manual
* lazy VACUUMs, because they won't be fazed by missing index entries
- * either. (Manual ANALYZEs, however, can't be excluded because they
+ * either. (Manual ANALYZEs, however, can't be excluded because they
* might be within transactions that are going to do arbitrary operations
* later.)
*
* Also, GetCurrentVirtualXIDs never reports our own vxid, so we need not
* check for that.
*
- * If a process goes idle-in-transaction with xmin zero, we do not need
- * to wait for it anymore, per the above argument. We do not have the
- * infrastructure right now to stop waiting if that happens, but we can
- * at least avoid the folly of waiting when it is idle at the time we
- * would begin to wait. We do this by repeatedly rechecking the output of
+ * If a process goes idle-in-transaction with xmin zero, we do not need to
+ * wait for it anymore, per the above argument. We do not have the
+ * infrastructure right now to stop waiting if that happens, but we can at
+ * least avoid the folly of waiting when it is idle at the time we would
+ * begin to wait. We do this by repeatedly rechecking the output of
* GetCurrentVirtualXIDs. If, during any iteration, a particular vxid
* doesn't show up in the output, we know we can forget about it.
*/
@@ -680,12 +680,12 @@ DefineIndex(RangeVar *heapRelation,
newer_snapshots = GetCurrentVirtualXIDs(snapshot->xmin,
true, false,
- PROC_IS_AUTOVACUUM | PROC_IN_VACUUM,
+ PROC_IS_AUTOVACUUM | PROC_IN_VACUUM,
&n_newer_snapshots);
for (j = i; j < n_old_snapshots; j++)
{
if (!VirtualTransactionIdIsValid(old_snapshots[j]))
- continue; /* found uninteresting in previous cycle */
+ continue; /* found uninteresting in previous cycle */
for (k = 0; k < n_newer_snapshots; k++)
{
if (VirtualTransactionIdEquals(old_snapshots[j],
@@ -1058,7 +1058,7 @@ GetDefaultOpClass(Oid type_id, Oid am_id)
ScanKeyData skey[1];
SysScanDesc scan;
HeapTuple tup;
- TYPCATEGORY tcategory;
+ TYPCATEGORY tcategory;
/* If it's a domain, look at the base type instead */
type_id = getBaseType(type_id);
diff --git a/src/backend/commands/lockcmds.c b/src/backend/commands/lockcmds.c
index 1e9b5dd961..043d68ac7a 100644
--- a/src/backend/commands/lockcmds.c
+++ b/src/backend/commands/lockcmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/lockcmds.c,v 1.24 2009/05/12 16:43:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/lockcmds.c,v 1.25 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,7 +25,7 @@
#include "utils/lsyscache.h"
static void LockTableRecurse(Oid reloid, RangeVar *rv,
- LOCKMODE lockmode, bool nowait, bool recurse);
+ LOCKMODE lockmode, bool nowait, bool recurse);
/*
@@ -67,9 +67,9 @@ LockTableRecurse(Oid reloid, RangeVar *rv,
AclResult aclresult;
/*
- * Acquire the lock. We must do this first to protect against
- * concurrent drops. Note that a lock against an already-dropped
- * relation's OID won't fail.
+ * Acquire the lock. We must do this first to protect against concurrent
+ * drops. Note that a lock against an already-dropped relation's OID
+ * won't fail.
*/
if (nowait)
{
@@ -148,8 +148,8 @@ LockTableRecurse(Oid reloid, RangeVar *rv,
*/
if (recurse)
{
- List *children = find_inheritance_children(reloid, NoLock);
- ListCell *lc;
+ List *children = find_inheritance_children(reloid, NoLock);
+ ListCell *lc;
foreach(lc, children)
{
diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c
index 0e454f8d02..daa8549e49 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.42 2009/01/01 17:23:39 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.43 2009/06/11 14:48:56 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -188,9 +188,9 @@ DefineOperator(List *names, List *parameters)
functionOid = LookupFuncName(functionName, nargs, typeId, false);
/*
- * We require EXECUTE rights for the function. This isn't strictly
- * necessary, since EXECUTE will be checked at any attempted use of
- * the operator, but it seems like a good idea anyway.
+ * We require EXECUTE rights for the function. This isn't strictly
+ * necessary, since EXECUTE will be checked at any attempted use of the
+ * operator, but it seems like a good idea anyway.
*/
aclresult = pg_proc_aclcheck(functionOid, GetUserId(), ACL_EXECUTE);
if (aclresult != ACLCHECK_OK)
@@ -237,9 +237,9 @@ DefineOperator(List *names, List *parameters)
typeId[4] = INTERNALOID; /* SpecialJoinInfo */
/*
- * As of Postgres 8.4, the preferred signature for join estimators
- * has 5 arguments, but we still allow the old 4-argument form.
- * Try the preferred form first.
+ * As of Postgres 8.4, the preferred signature for join estimators has
+ * 5 arguments, but we still allow the old 4-argument form. Try the
+ * preferred form first.
*/
joinOid = LookupFuncName(joinName, 5, typeId, true);
if (!OidIsValid(joinOid))
@@ -252,8 +252,8 @@ DefineOperator(List *names, List *parameters)
if (get_func_rettype(joinOid) != FLOAT8OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
- errmsg("join estimator function %s must return type \"float8\"",
- NameListToString(joinName))));
+ errmsg("join estimator function %s must return type \"float8\"",
+ NameListToString(joinName))));
/* Require EXECUTE rights for the estimator */
aclresult = pg_proc_aclcheck(joinOid, GetUserId(), ACL_EXECUTE);
@@ -271,7 +271,7 @@ DefineOperator(List *names, List *parameters)
oprNamespace, /* namespace */
typeId1, /* left type id */
typeId2, /* right type id */
- functionOid, /* function for operator */
+ functionOid, /* function for operator */
commutatorName, /* optional commutator operator name */
negatorName, /* optional negator operator name */
restrictionOid, /* optional restrict. sel. procedure */
diff --git a/src/backend/commands/portalcmds.c b/src/backend/commands/portalcmds.c
index 9940b92df5..1719234173 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.78 2009/01/01 17:23:39 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.79 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -352,8 +352,8 @@ PersistHoldablePortal(Portal portal)
ExecutorRewind(queryDesc);
/*
- * Change the destination to output to the tuplestore. Note we
- * tell the tuplestore receiver to detoast all data passed through it.
+ * Change the destination to output to the tuplestore. Note we tell
+ * the tuplestore receiver to detoast all data passed through it.
*/
queryDesc->dest = CreateDestReceiver(DestTuplestore);
SetTuplestoreDestReceiverParams(queryDesc->dest,
diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c
index e1c0edb8e8..0e948e4b72 100644
--- a/src/backend/commands/prepare.c
+++ b/src/backend/commands/prepare.c
@@ -10,7 +10,7 @@
* Copyright (c) 2002-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.96 2009/01/02 20:42:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.97 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -350,7 +350,7 @@ EvaluateParams(PreparedStatement *pstmt, List *params,
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("cannot use window function in EXECUTE parameter")));
+ errmsg("cannot use window function in EXECUTE parameter")));
given_type_id = exprType(expr);
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index 9d30d57a57..afb61981ce 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.84 2009/01/01 17:23:39 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.85 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -140,7 +140,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
pltemplate->tmplhandler,
pltemplate->tmpllibrary,
false, /* isAgg */
- false, /* isWindowFunc */
+ false, /* isWindowFunc */
false, /* security_definer */
false, /* isStrict */
PROVOLATILE_VOLATILE,
@@ -175,7 +175,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
pltemplate->tmplvalidator,
pltemplate->tmpllibrary,
false, /* isAgg */
- false, /* isWindowFunc */
+ false, /* isWindowFunc */
false, /* security_definer */
false, /* isStrict */
PROVOLATILE_VOLATILE,
@@ -635,7 +635,7 @@ AlterLanguageOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId)
}
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel),
- repl_val, repl_null, repl_repl);
+ repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index 5b5c466ea9..5680da3657 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.52 2009/01/01 17:23:39 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.53 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,8 +87,8 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString)
* temporarily set the current user so that the object(s) will be created
* with the correct ownership.
*
- * (The setting will be restored at the end of this routine, or in case
- * of error, transaction abort will clean things up.)
+ * (The setting will be restored at the end of this routine, or in case of
+ * error, transaction abort will clean things up.)
*/
if (saved_uid != owner_uid)
SetUserIdAndContext(owner_uid, true);
@@ -155,12 +155,12 @@ void
RemoveSchemas(DropStmt *drop)
{
ObjectAddresses *objects;
- ListCell *cell;
+ ListCell *cell;
/*
* First we identify all the schemas, then we delete them in a single
- * performMultipleDeletions() call. This is to avoid unwanted
- * DROP RESTRICT errors if one of the schemas depends on another.
+ * performMultipleDeletions() call. This is to avoid unwanted DROP
+ * RESTRICT errors if one of the schemas depends on another.
*/
objects = new_object_addresses();
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 4da934970c..e6c75ab014 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.159 2009/04/04 21:12:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.160 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1199,8 +1199,8 @@ init_params(List *options, bool isInit,
snprintf(bufm, sizeof(bufm), INT64_FORMAT, new->min_value);
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("RESTART value (%s) cannot be less than MINVALUE (%s)",
- bufs, bufm)));
+ errmsg("RESTART value (%s) cannot be less than MINVALUE (%s)",
+ bufs, bufm)));
}
if (new->last_value > new->max_value)
{
@@ -1211,8 +1211,8 @@ init_params(List *options, bool isInit,
snprintf(bufm, sizeof(bufm), INT64_FORMAT, new->max_value);
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("RESTART value (%s) cannot be greater than MAXVALUE (%s)",
- bufs, bufm)));
+ errmsg("RESTART value (%s) cannot be greater than MAXVALUE (%s)",
+ bufs, bufm)));
}
/* CACHE */
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index bc077c9d09..56bf67eef4 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.285 2009/05/20 08:48:10 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.286 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -137,7 +137,7 @@ typedef struct AlteredTableInfo
List *constraints; /* List of NewConstraint */
List *newvals; /* List of NewColumnValue */
bool new_notnull; /* T if we added new NOT NULL constraints */
- bool new_changeoids; /* T if we added/dropped the OID column */
+ bool new_changeoids; /* T if we added/dropped the OID column */
Oid newTableSpace; /* new tablespace; 0 means no change */
/* Objects to rebuild after completing ALTER TYPE operations */
List *changedConstraintOids; /* OIDs of constraints to rebuild */
@@ -187,35 +187,35 @@ struct dropmsgstrings
static const struct dropmsgstrings dropmsgstringarray[] = {
{RELKIND_RELATION,
- ERRCODE_UNDEFINED_TABLE,
- gettext_noop("table \"%s\" does not exist"),
- gettext_noop("table \"%s\" does not exist, skipping"),
- gettext_noop("\"%s\" is not a table"),
- gettext_noop("Use DROP TABLE to remove a table.")},
+ ERRCODE_UNDEFINED_TABLE,
+ gettext_noop("table \"%s\" does not exist"),
+ gettext_noop("table \"%s\" does not exist, skipping"),
+ gettext_noop("\"%s\" is not a table"),
+ gettext_noop("Use DROP TABLE to remove a table.")},
{RELKIND_SEQUENCE,
- ERRCODE_UNDEFINED_TABLE,
- gettext_noop("sequence \"%s\" does not exist"),
- gettext_noop("sequence \"%s\" does not exist, skipping"),
- gettext_noop("\"%s\" is not a sequence"),
- gettext_noop("Use DROP SEQUENCE to remove a sequence.")},
+ ERRCODE_UNDEFINED_TABLE,
+ gettext_noop("sequence \"%s\" does not exist"),
+ gettext_noop("sequence \"%s\" does not exist, skipping"),
+ gettext_noop("\"%s\" is not a sequence"),
+ gettext_noop("Use DROP SEQUENCE to remove a sequence.")},
{RELKIND_VIEW,
- ERRCODE_UNDEFINED_TABLE,
- gettext_noop("view \"%s\" does not exist"),
- gettext_noop("view \"%s\" does not exist, skipping"),
- gettext_noop("\"%s\" is not a view"),
- gettext_noop("Use DROP VIEW to remove a view.")},
+ ERRCODE_UNDEFINED_TABLE,
+ gettext_noop("view \"%s\" does not exist"),
+ gettext_noop("view \"%s\" does not exist, skipping"),
+ gettext_noop("\"%s\" is not a view"),
+ gettext_noop("Use DROP VIEW to remove a view.")},
{RELKIND_INDEX,
- ERRCODE_UNDEFINED_OBJECT,
- gettext_noop("index \"%s\" does not exist"),
- gettext_noop("index \"%s\" does not exist, skipping"),
- gettext_noop("\"%s\" is not an index"),
- gettext_noop("Use DROP INDEX to remove an index.")},
+ ERRCODE_UNDEFINED_OBJECT,
+ gettext_noop("index \"%s\" does not exist"),
+ gettext_noop("index \"%s\" does not exist, skipping"),
+ gettext_noop("\"%s\" is not an index"),
+ gettext_noop("Use DROP INDEX to remove an index.")},
{RELKIND_COMPOSITE_TYPE,
- ERRCODE_UNDEFINED_OBJECT,
- gettext_noop("type \"%s\" does not exist"),
- gettext_noop("type \"%s\" does not exist, skipping"),
- gettext_noop("\"%s\" is not a type"),
- gettext_noop("Use DROP TYPE to remove a type.")},
+ ERRCODE_UNDEFINED_OBJECT,
+ gettext_noop("type \"%s\" does not exist"),
+ gettext_noop("type \"%s\" does not exist, skipping"),
+ gettext_noop("\"%s\" is not a type"),
+ gettext_noop("Use DROP TYPE to remove a type.")},
{'\0', 0, NULL, NULL, NULL, NULL}
};
@@ -256,7 +256,7 @@ static void ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
bool recurse, bool recursing);
static void ATRewriteCatalogs(List **wqueue);
static void ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
- AlterTableCmd *cmd);
+ AlterTableCmd *cmd);
static void ATRewriteTables(List **wqueue);
static void ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap);
static AlteredTableInfo *ATGetQueueEntry(List **wqueue, Relation rel);
@@ -272,7 +272,7 @@ static void ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
ColumnDef *colDef, bool isOid);
static void add_column_datatype_dependency(Oid relid, int32 attnum, Oid typid);
static void ATPrepAddOids(List **wqueue, Relation rel, bool recurse,
- AlterTableCmd *cmd);
+ AlterTableCmd *cmd);
static void ATExecDropNotNull(Relation rel, const char *colName);
static void ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
const char *colName);
@@ -290,17 +290,17 @@ static void ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
static void ATExecAddIndex(AlteredTableInfo *tab, Relation rel,
IndexStmt *stmt, bool is_rebuild);
static void ATExecAddConstraint(List **wqueue,
- AlteredTableInfo *tab, Relation rel,
- Node *newConstraint, bool recurse);
+ AlteredTableInfo *tab, Relation rel,
+ Node *newConstraint, bool recurse);
static void ATAddCheckConstraint(List **wqueue,
- AlteredTableInfo *tab, Relation rel,
- Constraint *constr,
- bool recurse, bool recursing);
+ AlteredTableInfo *tab, Relation rel,
+ Constraint *constr,
+ bool recurse, bool recursing);
static void ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
FkConstraint *fkconstraint);
static void ATExecDropConstraint(Relation rel, const char *constrName,
- DropBehavior behavior,
- bool recurse, bool recursing);
+ DropBehavior behavior,
+ bool recurse, bool recursing);
static void ATPrepAlterColumnType(List **wqueue,
AlteredTableInfo *tab, Relation rel,
bool recurse, bool recursing,
@@ -324,7 +324,7 @@ static void ATExecEnableDisableRule(Relation rel, char *rulename,
static void ATExecAddInherit(Relation rel, RangeVar *parent);
static void ATExecDropInherit(Relation rel, RangeVar *parent);
static void copy_relation_data(SMgrRelation rel, SMgrRelation dst,
- ForkNumber forkNum, bool istemp);
+ ForkNumber forkNum, bool istemp);
/* ----------------------------------------------------------------
@@ -353,7 +353,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
Datum reloptions;
ListCell *listptr;
AttrNumber attnum;
- static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
+ static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
/*
* Truncate relname to appropriate length (probably a waste of time, as
@@ -435,7 +435,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
&inheritOids, &old_constraints, &parentOidCount);
/*
- * Create a tuple descriptor from the relation schema. Note that this
+ * Create a tuple descriptor from the relation schema. Note that this
* deals with column names, types, and NOT NULL constraints, but not
* default values or CHECK constraints; we handle those below.
*/
@@ -448,9 +448,9 @@ DefineRelation(CreateStmt *stmt, char relkind)
* Find columns with default values and prepare for insertion of the
* defaults. Pre-cooked (that is, inherited) defaults go into a list of
* CookedConstraint structs that we'll pass to heap_create_with_catalog,
- * while raw defaults go into a list of RawColumnDefault structs that
- * will be processed by AddRelationNewConstraints. (We can't deal with
- * raw expressions until we can do transformExpr.)
+ * while raw defaults go into a list of RawColumnDefault structs that will
+ * be processed by AddRelationNewConstraints. (We can't deal with raw
+ * expressions until we can do transformExpr.)
*
* We can set the atthasdef flags now in the tuple descriptor; this just
* saves StoreAttrDefault from having to do an immediate update of the
@@ -495,9 +495,9 @@ DefineRelation(CreateStmt *stmt, char relkind)
}
/*
- * Create the relation. Inherited defaults and constraints are passed
- * in for immediate handling --- since they don't need parsing, they
- * can be stored immediately.
+ * Create the relation. Inherited defaults and constraints are passed in
+ * for immediate handling --- since they don't need parsing, they can be
+ * stored immediately.
*/
relationId = heap_create_with_catalog(relname,
namespaceId,
@@ -606,7 +606,7 @@ DropErrorMsgWrongType(const char *relname, char wrongkind, char rightkind)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg(rentry->nota_msg, relname),
- (wentry->kind != '\0') ? errhint("%s", _(wentry->drophint_msg)) : 0));
+ (wentry->kind != '\0') ? errhint("%s", _(wentry->drophint_msg)) : 0));
}
/*
@@ -622,8 +622,8 @@ RemoveRelations(DropStmt *drop)
/*
* First we identify all the relations, then we delete them in a single
- * performMultipleDeletions() call. This is to avoid unwanted
- * DROP RESTRICT errors if one of the relations depends on another.
+ * performMultipleDeletions() call. This is to avoid unwanted DROP
+ * RESTRICT errors if one of the relations depends on another.
*/
/* Determine required relkind */
@@ -648,7 +648,7 @@ RemoveRelations(DropStmt *drop)
default:
elog(ERROR, "unrecognized drop object type: %d",
(int) drop->removeType);
- relkind = 0; /* keep compiler quiet */
+ relkind = 0; /* keep compiler quiet */
break;
}
@@ -862,11 +862,11 @@ ExecuteTruncate(TruncateStmt *stmt)
#endif
/*
- * If we are asked to restart sequences, find all the sequences,
- * lock them (we only need AccessShareLock because that's all that
- * ALTER SEQUENCE takes), and check permissions. We want to do this
- * early since it's pointless to do all the truncation work only to fail
- * on sequence permissions.
+ * If we are asked to restart sequences, find all the sequences, lock them
+ * (we only need AccessShareLock because that's all that ALTER SEQUENCE
+ * takes), and check permissions. We want to do this early since it's
+ * pointless to do all the truncation work only to fail on sequence
+ * permissions.
*/
if (stmt->restart_seqs)
{
@@ -878,8 +878,8 @@ ExecuteTruncate(TruncateStmt *stmt)
foreach(seqcell, seqlist)
{
- Oid seq_relid = lfirst_oid(seqcell);
- Relation seq_rel;
+ Oid seq_relid = lfirst_oid(seqcell);
+ Relation seq_rel;
seq_rel = relation_open(seq_relid, AccessShareLock);
@@ -899,8 +899,8 @@ ExecuteTruncate(TruncateStmt *stmt)
AfterTriggerBeginQuery();
/*
- * To fire triggers, we'll need an EState as well as a ResultRelInfo
- * for each relation.
+ * To fire triggers, we'll need an EState as well as a ResultRelInfo for
+ * each relation.
*/
estate = CreateExecutorState();
resultRelInfos = (ResultRelInfo *)
@@ -912,7 +912,7 @@ ExecuteTruncate(TruncateStmt *stmt)
InitResultRelInfo(resultRelInfo,
rel,
- 0, /* dummy rangetable index */
+ 0, /* dummy rangetable index */
CMD_DELETE, /* don't need any index info */
false);
resultRelInfo++;
@@ -922,9 +922,9 @@ ExecuteTruncate(TruncateStmt *stmt)
/*
* Process all BEFORE STATEMENT TRUNCATE triggers before we begin
- * truncating (this is because one of them might throw an error).
- * Also, if we were to allow them to prevent statement execution,
- * that would need to be handled here.
+ * truncating (this is because one of them might throw an error). Also, if
+ * we were to allow them to prevent statement execution, that would need
+ * to be handled here.
*/
resultRelInfo = resultRelInfos;
foreach(cell, rels)
@@ -996,18 +996,18 @@ ExecuteTruncate(TruncateStmt *stmt)
/*
* Lastly, restart any owned sequences if we were asked to. This is done
- * last because it's nontransactional: restarts will not roll back if
- * we abort later. Hence it's important to postpone them as long as
+ * last because it's nontransactional: restarts will not roll back if we
+ * abort later. Hence it's important to postpone them as long as
* possible. (This is also a big reason why we locked and
* permission-checked the sequences beforehand.)
*/
if (stmt->restart_seqs)
{
- List *options = list_make1(makeDefElem("restart", NULL));
+ List *options = list_make1(makeDefElem("restart", NULL));
foreach(cell, seq_relids)
{
- Oid seq_relid = lfirst_oid(cell);
+ Oid seq_relid = lfirst_oid(cell);
AlterSequenceInternal(seq_relid, options);
}
@@ -1361,7 +1361,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
/*
* Now copy the CHECK constraints of this parent, adjusting attnos
- * using the completed newattno[] map. Identically named constraints
+ * using the completed newattno[] map. Identically named constraints
* are merged if possible, else we throw error.
*/
if (constr && constr->num_check > 0)
@@ -1387,7 +1387,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
cooked = (CookedConstraint *) palloc(sizeof(CookedConstraint));
cooked->contype = CONSTR_CHECK;
cooked->name = pstrdup(name);
- cooked->attnum = 0; /* not used for constraints */
+ cooked->attnum = 0; /* not used for constraints */
cooked->expr = expr;
cooked->is_local = false;
cooked->inhcount = 1;
@@ -2052,8 +2052,8 @@ RenameRelation(Oid myrelid, const char *newrelname, ObjectType reltype)
RelationGetRelationName(targetrelation))));
/*
- * Don't allow ALTER TABLE on composite types.
- * We want people to use ALTER TYPE for that.
+ * Don't allow ALTER TABLE on composite types. We want people to use ALTER
+ * TYPE for that.
*/
if (relkind == RELKIND_COMPOSITE_TYPE)
ereport(ERROR,
@@ -2089,8 +2089,8 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId)
Form_pg_class relform;
/*
- * 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);
@@ -2166,7 +2166,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId)
* We also reject these commands if there are any pending AFTER trigger events
* for the rel. This is certainly necessary for the rewriting variants of
* ALTER TABLE, because they don't preserve tuple TIDs and so the pending
- * events would try to fetch the wrong tuples. It might be overly cautious
+ * events would try to fetch the wrong tuples. It might be overly cautious
* in other cases, but again it seems better to err on the side of paranoia.
*
* REINDEX calls this with "rel" referencing the index to be rebuilt; here
@@ -2184,7 +2184,7 @@ CheckTableNotInUse(Relation rel, const char *stmt)
if (rel->rd_refcnt != expected_refcnt)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE),
- /* translator: first %s is a SQL command, eg ALTER TABLE */
+ /* translator: first %s is a SQL command, eg ALTER TABLE */
errmsg("cannot %s \"%s\" because "
"it is being used by active queries in this session",
stmt, RelationGetRelationName(rel))));
@@ -2193,7 +2193,7 @@ CheckTableNotInUse(Relation rel, const char *stmt)
AfterTriggerPendingOnRel(RelationGetRelid(rel)))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE),
- /* translator: first %s is a SQL command, eg ALTER TABLE */
+ /* translator: first %s is a SQL command, eg ALTER TABLE */
errmsg("cannot %s \"%s\" because "
"it has pending trigger events",
stmt, RelationGetRelationName(rel))));
@@ -2220,7 +2220,7 @@ CheckTableNotInUse(Relation rel, const char *stmt)
* expressions that need to be evaluated with respect to the old table
* schema.
*
- * ATRewriteCatalogs performs phase 2 for each affected table. (Note that
+ * ATRewriteCatalogs performs phase 2 for each affected table. (Note that
* phases 2 and 3 normally do no explicit recursion, since phase 1 already
* did it --- although some subcommands have to recurse in phase 2 instead.)
* Certain subcommands need to be performed before others to avoid
@@ -2244,9 +2244,10 @@ AlterTable(AlterTableStmt *stmt)
switch (stmt->relkind)
{
case OBJECT_TABLE:
+
/*
- * For mostly-historical reasons, we allow ALTER TABLE to apply
- * to all relation types.
+ * For mostly-historical reasons, we allow ALTER TABLE to apply to
+ * all relation types.
*/
break;
@@ -2363,7 +2364,8 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
ATPrepAddColumn(wqueue, rel, recurse, cmd);
pass = AT_PASS_ADD_COL;
break;
- case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
+ case AT_AddColumnToView: /* add column via CREATE OR REPLACE
+ * VIEW */
ATSimplePermissions(rel, true);
/* Performs own recursion */
ATPrepAddColumn(wqueue, rel, recurse, cmd);
@@ -2597,7 +2599,8 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
switch (cmd->subtype)
{
case AT_AddColumn: /* ADD COLUMN */
- case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
+ case AT_AddColumnToView: /* add column via CREATE OR REPLACE
+ * VIEW */
ATExecAddColumn(tab, rel, (ColumnDef *) cmd->def, false);
break;
case AT_ColumnDefault: /* ALTER COLUMN DEFAULT */
@@ -3539,8 +3542,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
if (isOid && childatt->attnum != ObjectIdAttributeNumber)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("child table \"%s\" has a conflicting \"%s\" column",
- RelationGetRelationName(rel), colDef->colname)));
+ errmsg("child table \"%s\" has a conflicting \"%s\" column",
+ RelationGetRelationName(rel), colDef->colname)));
/* Bump the existing child att's inhcount */
childatt->attinhcount++;
@@ -3690,10 +3693,10 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
* returned by AddRelationNewConstraints, so that the right thing happens
* when a datatype's default applies.
*
- * We skip this step completely for views. For a view, we can only get
+ * We skip this step completely for views. For a view, we can only get
* here from CREATE OR REPLACE VIEW, which historically doesn't set up
- * defaults, not even for domain-typed columns. And in any case we mustn't
- * invoke Phase 3 on a view, since it has no storage.
+ * defaults, not even for domain-typed columns. And in any case we
+ * mustn't invoke Phase 3 on a view, since it has no storage.
*/
if (relkind != RELKIND_VIEW && attribute.attnum > 0)
{
@@ -3715,7 +3718,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST,
-1);
- if (defval == NULL) /* should not happen */
+ if (defval == NULL) /* should not happen */
elog(ERROR, "failed to coerce base type to domain");
}
@@ -3740,8 +3743,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
}
/*
- * If we are adding an OID column, we have to tell Phase 3 to rewrite
- * the table to fix that.
+ * If we are adding an OID column, we have to tell Phase 3 to rewrite the
+ * table to fix that.
*/
if (isOid)
tab->new_changeoids = true;
@@ -3773,7 +3776,7 @@ add_column_datatype_dependency(Oid relid, int32 attnum, Oid typid)
/*
* ALTER TABLE SET WITH OIDS
*
- * Basically this is an ADD COLUMN for the special OID column. We have
+ * Basically this is an ADD COLUMN for the special OID column. We have
* to cons up a ColumnDef node because the ADD COLUMN code needs one.
*/
static void
@@ -4295,8 +4298,8 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
performDeletion(&object, behavior);
/*
- * If we dropped the OID column, must adjust pg_class.relhasoids and
- * tell Phase 3 to physically get rid of the column.
+ * If we dropped the OID column, must adjust pg_class.relhasoids and tell
+ * Phase 3 to physically get rid of the column.
*/
if (attnum == ObjectIdAttributeNumber)
{
@@ -4410,8 +4413,8 @@ ATExecAddConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
FkConstraint *fkconstraint = (FkConstraint *) newConstraint;
/*
- * Note that we currently never recurse for FK constraints,
- * so the "recurse" flag is silently ignored.
+ * Note that we currently never recurse for FK constraints, so
+ * the "recurse" flag is silently ignored.
*
* Assign or validate constraint name
*/
@@ -4473,8 +4476,8 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
/*
* Call AddRelationNewConstraints to do the work, making sure it works on
- * a copy of the Constraint so transformExpr can't modify the original.
- * It returns a list of cooked constraints.
+ * a copy of the Constraint so transformExpr can't modify the original. It
+ * returns a list of cooked constraints.
*
* If the constraint ends up getting merged with a pre-existing one, it's
* omitted from the returned list, which is what we want: we do not need
@@ -4584,7 +4587,8 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
pkrel = heap_openrv(fkconstraint->pktable, AccessExclusiveLock);
/*
- * Validity checks (permission checks wait till we have the column numbers)
+ * Validity checks (permission checks wait till we have the column
+ * numbers)
*/
if (pkrel->rd_rel->relkind != RELKIND_RELATION)
ereport(ERROR,
@@ -4810,8 +4814,8 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
NULL, /* no check constraint */
NULL,
NULL,
- true, /* islocal */
- 0); /* inhcount */
+ true, /* islocal */
+ 0); /* inhcount */
/*
* Create the triggers that will enforce the constraint.
@@ -5400,9 +5404,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
/* Don't drop inherited constraints */
if (con->coninhcount > 0 && !recursing)
ereport(ERROR,
- (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
- errmsg("cannot drop inherited constraint \"%s\" of relation \"%s\"",
- constrName, RelationGetRelationName(rel))));
+ (errcode(ERRCODE_INVALID_TABLE_DEFINITION),
+ errmsg("cannot drop inherited constraint \"%s\" of relation \"%s\"",
+ constrName, RelationGetRelationName(rel))));
/* Right now only CHECK constraints can be inherited */
if (con->contype == CONSTRAINT_CHECK)
@@ -5459,7 +5463,7 @@ ATExecDropConstraint(Relation rel, const char *constrName,
while (HeapTupleIsValid(tuple = systable_getnext(scan)))
{
- HeapTuple copy_tuple;
+ HeapTuple copy_tuple;
con = (Form_pg_constraint) GETSTRUCT(tuple);
@@ -5472,7 +5476,7 @@ ATExecDropConstraint(Relation rel, const char *constrName,
found = true;
- if (con->coninhcount <= 0) /* shouldn't happen */
+ if (con->coninhcount <= 0) /* shouldn't happen */
elog(ERROR, "relation %u has non-inherited constraint \"%s\"",
childrelid, constrName);
@@ -5482,9 +5486,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
if (recurse)
{
/*
- * If the child constraint has other definition sources,
- * just decrement its inheritance count; if not, recurse
- * to delete it.
+ * If the child constraint has other definition sources, just
+ * decrement its inheritance count; if not, recurse to delete
+ * it.
*/
if (con->coninhcount == 1 && !con->conislocal)
{
@@ -5506,9 +5510,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
else
{
/*
- * If we were told to drop ONLY in this table (no
- * recursion), we need to mark the inheritors' constraints
- * as locally defined rather than inherited.
+ * If we were told to drop ONLY in this table (no recursion),
+ * we need to mark the inheritors' constraints as locally
+ * defined rather than inherited.
*/
con->coninhcount--;
con->conislocal = true;
@@ -5528,9 +5532,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
if (!found)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("constraint \"%s\" of relation \"%s\" does not exist",
- constrName,
- RelationGetRelationName(childrel))));
+ errmsg("constraint \"%s\" of relation \"%s\" does not exist",
+ constrName,
+ RelationGetRelationName(childrel))));
heap_close(childrel, NoLock);
}
@@ -5628,7 +5632,7 @@ ATPrepAlterColumnType(List **wqueue,
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("cannot use window function in transform expression")));
+ errmsg("cannot use window function in transform expression")));
}
else
{
@@ -5745,8 +5749,8 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
if (defaultexpr == NULL)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("default for column \"%s\" cannot be cast to type %s",
- colName, format_type_be(targettype))));
+ errmsg("default for column \"%s\" cannot be cast to type %s",
+ colName, format_type_be(targettype))));
}
else
defaultexpr = NULL;
@@ -6536,7 +6540,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
Datum repl_val[Natts_pg_class];
bool repl_null[Natts_pg_class];
bool repl_repl[Natts_pg_class];
- static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
+ static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
if (defList == NIL)
return; /* nothing to do */
@@ -6555,7 +6559,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
/* Generate new proposed reloptions (text array) */
newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
- defList, NULL, validnsps, false, isReset);
+ defList, NULL, validnsps, false, isReset);
/* Validate */
switch (rel->rd_rel->relkind)
@@ -6591,7 +6595,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
repl_repl[Anum_pg_class_reloptions - 1] = true;
newtuple = heap_modify_tuple(tuple, RelationGetDescr(pgclass),
- repl_val, repl_null, repl_repl);
+ repl_val, repl_null, repl_repl);
simple_heap_update(pgclass, &newtuple->t_self, newtuple);
@@ -6619,7 +6623,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
datum = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions, &isnull);
newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
- defList, "toast", validnsps, false, isReset);
+ defList, "toast", validnsps, false, isReset);
(void) heap_reloptions(RELKIND_TOASTVALUE, newOptions, true);
@@ -6749,11 +6753,11 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace)
RelationOpenSmgr(rel);
/*
- * Create and copy all forks of the relation, and schedule unlinking
- * of old physical files.
+ * Create and copy all forks of the relation, and schedule unlinking of
+ * old physical files.
*
* NOTE: any conflict in relfilenode value will be caught in
- * RelationCreateStorage().
+ * RelationCreateStorage().
*/
RelationCreateStorage(newrnode, rel->rd_istemp);
@@ -7163,11 +7167,11 @@ MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel)
while (HeapTupleIsValid(parent_tuple = systable_getnext(parent_scan)))
{
- Form_pg_constraint parent_con = (Form_pg_constraint) GETSTRUCT(parent_tuple);
- SysScanDesc child_scan;
- ScanKeyData child_key;
- HeapTuple child_tuple;
- bool found = false;
+ Form_pg_constraint parent_con = (Form_pg_constraint) GETSTRUCT(parent_tuple);
+ SysScanDesc child_scan;
+ ScanKeyData child_key;
+ HeapTuple child_tuple;
+ bool found = false;
if (parent_con->contype != CONSTRAINT_CHECK)
continue;
@@ -7182,8 +7186,8 @@ MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel)
while (HeapTupleIsValid(child_tuple = systable_getnext(child_scan)))
{
- Form_pg_constraint child_con = (Form_pg_constraint) GETSTRUCT(child_tuple);
- HeapTuple child_copy;
+ Form_pg_constraint child_con = (Form_pg_constraint) GETSTRUCT(child_tuple);
+ HeapTuple child_copy;
if (child_con->contype != CONSTRAINT_CHECK)
continue;
@@ -7344,8 +7348,8 @@ ATExecDropInherit(Relation rel, RangeVar *parent)
heap_close(catalogRelation, RowExclusiveLock);
/*
- * Likewise, find inherited check constraints and disinherit them.
- * To do this, we first need a list of the names of the parent's check
+ * Likewise, find inherited check constraints and disinherit them. To do
+ * this, we first need a list of the names of the parent's check
* constraints. (We cheat a bit by only checking for name matches,
* assuming that the expressions will match.)
*/
@@ -7380,14 +7384,14 @@ ATExecDropInherit(Relation rel, RangeVar *parent)
while (HeapTupleIsValid(constraintTuple = systable_getnext(scan)))
{
Form_pg_constraint con = (Form_pg_constraint) GETSTRUCT(constraintTuple);
- bool match;
- ListCell *lc;
+ bool match;
+ ListCell *lc;
if (con->contype != CONSTRAINT_CHECK)
continue;
match = false;
- foreach (lc, connames)
+ foreach(lc, connames)
{
if (strcmp(NameStr(con->conname), (char *) lfirst(lc)) == 0)
{
@@ -7401,6 +7405,7 @@ ATExecDropInherit(Relation rel, RangeVar *parent)
/* Decrement inhcount and possibly set islocal to true */
HeapTuple copyTuple = heap_copytuple(constraintTuple);
Form_pg_constraint copy_con = (Form_pg_constraint) GETSTRUCT(copyTuple);
+
if (copy_con->coninhcount <= 0) /* shouldn't happen */
elog(ERROR, "relation %u has non-inherited constraint \"%s\"",
RelationGetRelid(rel), NameStr(copy_con->conname));
@@ -7484,9 +7489,10 @@ AlterTableNamespace(RangeVar *relation, const char *newschema,
switch (stmttype)
{
case OBJECT_TABLE:
+
/*
- * For mostly-historical reasons, we allow ALTER TABLE to apply
- * to all relation types.
+ * For mostly-historical reasons, we allow ALTER TABLE to apply to
+ * all relation types.
*/
break;
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index ce276e5fe5..08d9593de9 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.246 2009/01/22 20:16:02 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.247 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -274,8 +274,8 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid, bool checkPermissions)
}
/*
- * Scan pg_trigger for existing triggers on relation. We do this only
- * to give a nice error message if there's already a trigger of the same
+ * Scan pg_trigger for existing triggers on relation. We do this only to
+ * give a nice error message if there's already a trigger of the same
* name. (The unique index on tgrelid/tgname would complain anyway.)
*
* NOTE that this is cool only because we have AccessExclusiveLock on the
@@ -857,12 +857,12 @@ RemoveTriggerById(Oid trigOid)
/*
* We do not bother to try to determine whether any other triggers remain,
- * which would be needed in order to decide whether it's safe to clear
- * the relation's relhastriggers. (In any case, there might be a
- * concurrent process adding new triggers.) Instead, just force a
- * relcache inval to make other backends (and this one too!) rebuild
- * their relcache entries. There's no great harm in leaving relhastriggers
- * true even if there are no triggers left.
+ * which would be needed in order to decide whether it's safe to clear the
+ * relation's relhastriggers. (In any case, there might be a concurrent
+ * process adding new triggers.) Instead, just force a relcache inval to
+ * make other backends (and this one too!) rebuild their relcache entries.
+ * There's no great harm in leaving relhastriggers true even if there are
+ * no triggers left.
*/
CacheInvalidateRelcache(rel);
@@ -1118,8 +1118,8 @@ RelationBuildTriggers(Relation relation)
int i;
/*
- * Allocate a working array to hold the triggers (the array is extended
- * if necessary)
+ * Allocate a working array to hold the triggers (the array is extended if
+ * necessary)
*/
maxtrigs = 16;
triggers = (Trigger *) palloc(maxtrigs * sizeof(Trigger));
@@ -2095,8 +2095,8 @@ ExecBSTruncateTriggers(EState *estate, ResultRelInfo *relinfo)
if (newtuple)
ereport(ERROR,
- (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
- errmsg("BEFORE STATEMENT trigger cannot return a value")));
+ (errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
+ errmsg("BEFORE STATEMENT trigger cannot return a value")));
}
}
@@ -2264,7 +2264,7 @@ typedef SetConstraintStateData *SetConstraintState;
* Per-trigger-event data
*
* The actual per-event data, AfterTriggerEventData, includes DONE/IN_PROGRESS
- * status bits and one or two tuple CTIDs. Each event record also has an
+ * status bits and one or two tuple CTIDs. Each event record also has an
* associated AfterTriggerSharedData that is shared across all instances
* of similar events within a "chunk".
*
@@ -2278,12 +2278,13 @@ typedef SetConstraintStateData *SetConstraintState;
* Although this is mutable state, we can keep it in AfterTriggerSharedData
* because all instances of the same type of event in a given event list will
* be fired at the same time, if they were queued between the same firing
- * cycles. So we need only ensure that ats_firing_id is zero when attaching
+ * cycles. So we need only ensure that ats_firing_id is zero when attaching
* a new event to an existing AfterTriggerSharedData record.
*/
typedef uint32 TriggerFlags;
-#define AFTER_TRIGGER_OFFSET 0x0FFFFFFF /* must be low-order bits */
+#define AFTER_TRIGGER_OFFSET 0x0FFFFFFF /* must be low-order
+ * bits */
#define AFTER_TRIGGER_2CTIDS 0x10000000
#define AFTER_TRIGGER_DONE 0x20000000
#define AFTER_TRIGGER_IN_PROGRESS 0x40000000
@@ -2324,13 +2325,13 @@ typedef struct AfterTriggerEventDataOneCtid
/*
* To avoid palloc overhead, we keep trigger events in arrays in successively-
* larger chunks (a slightly more sophisticated version of an expansible
- * array). The space between CHUNK_DATA_START and freeptr is occupied by
+ * array). The space between CHUNK_DATA_START and freeptr is occupied by
* AfterTriggerEventData records; the space between endfree and endptr is
* occupied by AfterTriggerSharedData records.
*/
typedef struct AfterTriggerEventChunk
{
- struct AfterTriggerEventChunk *next; /* list link */
+ struct AfterTriggerEventChunk *next; /* list link */
char *freeptr; /* start of free space in chunk */
char *endfree; /* end of free space in chunk */
char *endptr; /* end of chunk */
@@ -2555,9 +2556,9 @@ afterTriggerAddEvent(AfterTriggerEventList *events,
/* check number of shared records in preceding chunk */
if ((chunk->endptr - chunk->endfree) <=
(100 * sizeof(AfterTriggerSharedData)))
- chunksize *= 2; /* okay, double it */
+ chunksize *= 2; /* okay, double it */
else
- chunksize /= 2; /* too many shared records */
+ chunksize /= 2; /* too many shared records */
chunksize = Min(chunksize, MAX_CHUNK_SIZE);
}
chunk = MemoryContextAlloc(afterTriggers->event_cxt, chunksize);
@@ -2574,8 +2575,8 @@ afterTriggerAddEvent(AfterTriggerEventList *events,
}
/*
- * Try to locate a matching shared-data record already in the chunk.
- * If none, make a new one.
+ * Try to locate a matching shared-data record already in the chunk. If
+ * none, make a new one.
*/
for (newshared = ((AfterTriggerShared) chunk->endptr) - 1;
(char *) newshared >= chunk->endfree;
@@ -2590,7 +2591,7 @@ afterTriggerAddEvent(AfterTriggerEventList *events,
if ((char *) newshared < chunk->endfree)
{
*newshared = *evtshared;
- newshared->ats_firing_id = 0; /* just to be sure */
+ newshared->ats_firing_id = 0; /* just to be sure */
chunk->endfree = (char *) newshared;
}
@@ -2658,6 +2659,7 @@ afterTriggerRestoreEventList(AfterTriggerEventList *events,
/* and clean up the tail chunk to be the right length */
events->tail->next = NULL;
events->tail->freeptr = events->tailfree;
+
/*
* We don't make any effort to remove now-unused shared data records.
* They might still be useful, anyway.
@@ -2940,7 +2942,7 @@ afterTriggerInvokeEvents(AfterTriggerEventList *events,
trigdesc = rInfo->ri_TrigDesc;
finfo = rInfo->ri_TrigFunctions;
instr = rInfo->ri_TrigInstrument;
- if (trigdesc == NULL) /* should not happen */
+ if (trigdesc == NULL) /* should not happen */
elog(ERROR, "relation %u has no triggers",
evtshared->ats_relid);
}
@@ -3015,7 +3017,7 @@ AfterTriggerBeginXact(void)
MemoryContextAlloc(TopTransactionContext,
sizeof(AfterTriggersData));
- afterTriggers->firing_counter = (CommandId) 1; /* mustn't be 0 */
+ afterTriggers->firing_counter = (CommandId) 1; /* mustn't be 0 */
afterTriggers->state = SetConstraintStateCreate(8);
afterTriggers->events.head = NULL;
afterTriggers->events.tail = NULL;
@@ -3348,8 +3350,8 @@ AfterTriggerEndSubXact(bool isCommit)
else
{
/*
- * Aborting. Release any event lists from queries being aborted,
- * and restore query_depth to its pre-subxact value.
+ * Aborting. Release any event lists from queries being aborted, and
+ * restore query_depth to its pre-subxact value.
*/
while (afterTriggers->query_depth > afterTriggers->depth_stack[my_level])
{
@@ -3721,7 +3723,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
/*
* Make sure a snapshot has been established in case trigger
- * functions need one. Note that we avoid setting a snapshot if
+ * functions need one. Note that we avoid setting a snapshot if
* we don't find at least one trigger that has to be fired now.
* This is so that BEGIN; SET CONSTRAINTS ...; SET TRANSACTION
* ISOLATION LEVEL SERIALIZABLE; ... works properly. (If we are
diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c
index 7276cd50d4..5339e1783c 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.16 2009/01/22 20:16:02 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.17 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -275,7 +275,7 @@ void
RemoveTSParsers(DropStmt *drop)
{
ObjectAddresses *objects;
- ListCell *cell;
+ ListCell *cell;
if (!superuser())
ereport(ERROR,
@@ -284,14 +284,14 @@ RemoveTSParsers(DropStmt *drop)
/*
* First we identify all the objects, then we delete them in a single
- * performMultipleDeletions() call. This is to avoid unwanted
- * DROP RESTRICT errors if one of the objects depends on another.
+ * performMultipleDeletions() call. This is to avoid unwanted DROP
+ * RESTRICT errors if one of the objects depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
- List *names = (List *) lfirst(cell);
+ List *names = (List *) lfirst(cell);
Oid prsOid;
ObjectAddress object;
@@ -309,8 +309,8 @@ RemoveTSParsers(DropStmt *drop)
else
{
ereport(NOTICE,
- (errmsg("text search parser \"%s\" does not exist, skipping",
- NameListToString(names))));
+ (errmsg("text search parser \"%s\" does not exist, skipping",
+ NameListToString(names))));
}
continue;
}
@@ -636,18 +636,18 @@ void
RemoveTSDictionaries(DropStmt *drop)
{
ObjectAddresses *objects;
- ListCell *cell;
+ ListCell *cell;
/*
* First we identify all the objects, then we delete them in a single
- * performMultipleDeletions() call. This is to avoid unwanted
- * DROP RESTRICT errors if one of the objects depends on another.
+ * performMultipleDeletions() call. This is to avoid unwanted DROP
+ * RESTRICT errors if one of the objects depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
- List *names = (List *) lfirst(cell);
+ List *names = (List *) lfirst(cell);
Oid dictOid;
ObjectAddress object;
HeapTuple tup;
@@ -661,14 +661,14 @@ RemoveTSDictionaries(DropStmt *drop)
{
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("text search dictionary \"%s\" does not exist",
- NameListToString(names))));
+ errmsg("text search dictionary \"%s\" does not exist",
+ NameListToString(names))));
}
else
{
ereport(NOTICE,
- (errmsg("text search dictionary \"%s\" does not exist, skipping",
- NameListToString(names))));
+ (errmsg("text search dictionary \"%s\" does not exist, skipping",
+ NameListToString(names))));
}
continue;
}
@@ -676,7 +676,7 @@ RemoveTSDictionaries(DropStmt *drop)
tup = SearchSysCache(TSDICTOID,
ObjectIdGetDatum(dictOid),
0, 0, 0);
- if (!HeapTupleIsValid(tup)) /* should not happen */
+ if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search dictionary %u",
dictOid);
@@ -824,7 +824,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
repl_repl[Anum_pg_ts_dict_dictinitoption - 1] = true;
newtup = heap_modify_tuple(tup, RelationGetDescr(rel),
- repl_val, repl_null, repl_repl);
+ repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtup->t_self, newtup);
@@ -1127,7 +1127,7 @@ void
RemoveTSTemplates(DropStmt *drop)
{
ObjectAddresses *objects;
- ListCell *cell;
+ ListCell *cell;
if (!superuser())
ereport(ERROR,
@@ -1136,14 +1136,14 @@ RemoveTSTemplates(DropStmt *drop)
/*
* First we identify all the objects, then we delete them in a single
- * performMultipleDeletions() call. This is to avoid unwanted
- * DROP RESTRICT errors if one of the objects depends on another.
+ * performMultipleDeletions() call. This is to avoid unwanted DROP
+ * RESTRICT errors if one of the objects depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
- List *names = (List *) lfirst(cell);
+ List *names = (List *) lfirst(cell);
Oid tmplOid;
ObjectAddress object;
@@ -1534,18 +1534,18 @@ void
RemoveTSConfigurations(DropStmt *drop)
{
ObjectAddresses *objects;
- ListCell *cell;
+ ListCell *cell;
/*
* First we identify all the objects, then we delete them in a single
- * performMultipleDeletions() call. This is to avoid unwanted
- * DROP RESTRICT errors if one of the objects depends on another.
+ * performMultipleDeletions() call. This is to avoid unwanted DROP
+ * RESTRICT errors if one of the objects depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
- List *names = (List *) lfirst(cell);
+ List *names = (List *) lfirst(cell);
Oid cfgOid;
Oid namespaceId;
ObjectAddress object;
@@ -1559,8 +1559,8 @@ RemoveTSConfigurations(DropStmt *drop)
{
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("text search configuration \"%s\" does not exist",
- NameListToString(names))));
+ errmsg("text search configuration \"%s\" does not exist",
+ NameListToString(names))));
}
else
{
@@ -1923,8 +1923,8 @@ MakeConfigurationMapping(AlterTSConfigurationStmt *stmt,
repl_repl[Anum_pg_ts_config_map_mapdict - 1] = true;
newtup = heap_modify_tuple(maptup,
- RelationGetDescr(relMap),
- repl_val, repl_null, repl_repl);
+ RelationGetDescr(relMap),
+ repl_val, repl_null, repl_repl);
simple_heap_update(relMap, &newtup->t_self, newtup);
CatalogUpdateIndexes(relMap, newtup);
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index cfbc2a75ae..f791c53fe4 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.133 2009/04/04 21:12:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.134 2009/06/11 14:48:56 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -115,23 +115,23 @@ DefineType(List *names, List *parameters)
bool byValue = false;
char alignment = 'i'; /* default alignment */
char storage = 'p'; /* default TOAST storage method */
- DefElem *likeTypeEl = NULL;
- DefElem *internalLengthEl = NULL;
- DefElem *inputNameEl = NULL;
- DefElem *outputNameEl = NULL;
- DefElem *receiveNameEl = NULL;
- DefElem *sendNameEl = NULL;
- DefElem *typmodinNameEl = NULL;
- DefElem *typmodoutNameEl = NULL;
- DefElem *analyzeNameEl = NULL;
- DefElem *categoryEl = NULL;
- DefElem *preferredEl = NULL;
- DefElem *delimiterEl = NULL;
- DefElem *elemTypeEl = NULL;
- DefElem *defaultValueEl = NULL;
- DefElem *byValueEl = NULL;
- DefElem *alignmentEl = NULL;
- DefElem *storageEl = NULL;
+ DefElem *likeTypeEl = NULL;
+ DefElem *internalLengthEl = NULL;
+ DefElem *inputNameEl = NULL;
+ DefElem *outputNameEl = NULL;
+ DefElem *receiveNameEl = NULL;
+ DefElem *sendNameEl = NULL;
+ DefElem *typmodinNameEl = NULL;
+ DefElem *typmodoutNameEl = NULL;
+ DefElem *analyzeNameEl = NULL;
+ DefElem *categoryEl = NULL;
+ DefElem *preferredEl = NULL;
+ DefElem *delimiterEl = NULL;
+ DefElem *elemTypeEl = NULL;
+ DefElem *defaultValueEl = NULL;
+ DefElem *byValueEl = NULL;
+ DefElem *alignmentEl = NULL;
+ DefElem *storageEl = NULL;
Oid inputOid;
Oid outputOid;
Oid receiveOid = InvalidOid;
@@ -150,8 +150,8 @@ DefineType(List *names, List *parameters)
* As of Postgres 8.4, we require superuser privilege to create a base
* type. This is simple paranoia: there are too many ways to mess up the
* system with an incorrect type definition (for instance, representation
- * parameters that don't match what the C code expects). In practice
- * it takes superuser privilege to create the I/O functions, and so the
+ * parameters that don't match what the C code expects). In practice it
+ * takes superuser privilege to create the I/O functions, and so the
* former requirement that you own the I/O functions pretty much forced
* superuserness anyway. We're just making doubly sure here.
*
@@ -277,13 +277,13 @@ DefineType(List *names, List *parameters)
}
/*
- * Now interpret the options; we do this separately so that LIKE can
- * be overridden by other options regardless of the ordering in the
- * parameter list.
+ * Now interpret the options; we do this separately so that LIKE can be
+ * overridden by other options regardless of the ordering in the parameter
+ * list.
*/
if (likeTypeEl)
{
- Type likeType;
+ Type likeType;
Form_pg_type likeForm;
likeType = typenameType(NULL, defGetTypeName(likeTypeEl), NULL);
@@ -319,8 +319,8 @@ DefineType(List *names, List *parameters)
if (category < 32 || category > 126)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("invalid type category \"%s\": must be simple ASCII",
- p)));
+ errmsg("invalid type category \"%s\": must be simple ASCII",
+ p)));
}
if (preferredEl)
preferred = defGetBoolean(preferredEl);
@@ -351,8 +351,8 @@ DefineType(List *names, List *parameters)
/*
* Note: if argument was an unquoted identifier, parser will have
- * applied translations to it, so be prepared to recognize
- * translated type names as well as the nominal form.
+ * applied translations to it, so be prepared to recognize translated
+ * type names as well as the nominal form.
*/
if (pg_strcasecmp(a, "double") == 0 ||
pg_strcasecmp(a, "float8") == 0 ||
@@ -536,7 +536,7 @@ DefineType(List *names, List *parameters)
typeNamespace, /* namespace */
InvalidOid, /* relation oid (n/a here) */
0, /* relation kind (ditto) */
- GetUserId(), /* owner's ID */
+ GetUserId(), /* owner's ID */
internalLength, /* internal size */
TYPTYPE_BASE, /* type-type (base type) */
category, /* type-category */
@@ -578,7 +578,7 @@ DefineType(List *names, List *parameters)
GetUserId(), /* owner's ID */
-1, /* internal size (always varlena) */
TYPTYPE_BASE, /* type-type (base type) */
- TYPCATEGORY_ARRAY, /* type-category (array) */
+ TYPCATEGORY_ARRAY, /* type-category (array) */
false, /* array types are never preferred */
delimiter, /* array element delimiter */
F_ARRAY_IN, /* input procedure */
@@ -616,18 +616,18 @@ void
RemoveTypes(DropStmt *drop)
{
ObjectAddresses *objects;
- ListCell *cell;
+ ListCell *cell;
/*
* First we identify all the types, then we delete them in a single
- * performMultipleDeletions() call. This is to avoid unwanted
- * DROP RESTRICT errors if one of the types depends on another.
+ * performMultipleDeletions() call. This is to avoid unwanted DROP
+ * RESTRICT errors if one of the types depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
- List *names = (List *) lfirst(cell);
+ List *names = (List *) lfirst(cell);
TypeName *typename;
Oid typeoid;
HeapTuple tup;
@@ -1020,7 +1020,7 @@ DefineDomain(CreateDomainStmt *stmt)
domainNamespace, /* namespace */
InvalidOid, /* relation oid (n/a here) */
0, /* relation kind (ditto) */
- GetUserId(), /* owner's ID */
+ GetUserId(), /* owner's ID */
internalLength, /* internal size */
TYPTYPE_DOMAIN, /* type-type (domain type) */
category, /* type-category */
@@ -1134,7 +1134,7 @@ DefineEnum(CreateEnumStmt *stmt)
enumNamespace, /* namespace */
InvalidOid, /* relation oid (n/a here) */
0, /* relation kind (ditto) */
- GetUserId(), /* owner's ID */
+ GetUserId(), /* owner's ID */
sizeof(Oid), /* internal size */
TYPTYPE_ENUM, /* type-type (enum type) */
TYPCATEGORY_ENUM, /* type-category (enum type) */
@@ -1176,7 +1176,7 @@ DefineEnum(CreateEnumStmt *stmt)
GetUserId(), /* owner's ID */
-1, /* internal size (always varlena) */
TYPTYPE_BASE, /* type-type (base type) */
- TYPCATEGORY_ARRAY, /* type-category (array) */
+ TYPCATEGORY_ARRAY, /* type-category (array) */
false, /* array types are never preferred */
DEFAULT_TYPDELIM, /* array element delimiter */
F_ARRAY_IN, /* input procedure */
@@ -1610,8 +1610,8 @@ AlterDomainDefault(List *names, Node *defaultRaw)
}
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel),
- new_record, new_record_nulls,
- new_record_repl);
+ new_record, new_record_nulls,
+ new_record_repl);
simple_heap_update(rel, &tup->t_self, newtuple);
@@ -2472,8 +2472,8 @@ RenameType(List *names, const char *newTypeName)
/*
* 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)
@@ -2493,7 +2493,7 @@ RenameType(List *names, const char *newTypeName)
errhint("You can alter type %s, which will alter the array type as well.",
format_type_be(typTup->typelem))));
- /*
+ /*
* If type is composite we need to rename associated pg_class entry too.
* RenameRelationInternal will call RenameTypeInternal automatically.
*/
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 22491cf3f7..6796a1f5e2 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.186 2009/01/30 17:24:47 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.187 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -684,7 +684,7 @@ AlterRole(AlterRoleStmt *stmt)
}
new_tuple = heap_modify_tuple(tuple, pg_authid_dsc, new_record,
- new_record_nulls, new_record_repl);
+ new_record_nulls, new_record_repl);
simple_heap_update(pg_authid_rel, &tuple->t_self, new_tuple);
/* Update indexes */
@@ -802,7 +802,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
}
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(rel),
- repl_val, repl_null, repl_repl);
+ repl_val, repl_null, repl_repl);
simple_heap_update(rel, &oldtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);
@@ -1143,7 +1143,7 @@ GrantRole(GrantRoleStmt *stmt)
if (rolename == NULL || priv->cols != NIL)
ereport(ERROR,
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
- errmsg("column names cannot be included in GRANT/REVOKE ROLE")));
+ errmsg("column names cannot be included in GRANT/REVOKE ROLE")));
roleid = get_roleid_checked(rolename);
if (stmt->is_grant)
@@ -1366,8 +1366,8 @@ AddRoleMems(const char *rolename, Oid roleid,
new_record_repl[Anum_pg_auth_members_grantor - 1] = true;
new_record_repl[Anum_pg_auth_members_admin_option - 1] = true;
tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc,
- new_record,
- new_record_nulls, new_record_repl);
+ new_record,
+ new_record_nulls, new_record_repl);
simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple);
CatalogUpdateIndexes(pg_authmem_rel, tuple);
ReleaseSysCache(authmem_tuple);
@@ -1375,7 +1375,7 @@ AddRoleMems(const char *rolename, Oid roleid,
else
{
tuple = heap_form_tuple(pg_authmem_dsc,
- new_record, new_record_nulls);
+ new_record, new_record_nulls);
simple_heap_insert(pg_authmem_rel, tuple);
CatalogUpdateIndexes(pg_authmem_rel, tuple);
}
@@ -1485,8 +1485,8 @@ DelRoleMems(const char *rolename, Oid roleid,
new_record_repl[Anum_pg_auth_members_admin_option - 1] = true;
tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc,
- new_record,
- new_record_nulls, new_record_repl);
+ new_record,
+ new_record_nulls, new_record_repl);
simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple);
CatalogUpdateIndexes(pg_authmem_rel, tuple);
}
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 4a5ae53d48..732f6d09c3 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.388 2009/06/06 22:13:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.389 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -655,7 +655,7 @@ vacuum_set_xid_limits(int freeze_min_age,
if (freezeTableLimit != NULL)
{
- int freezetable;
+ int freezetable;
/*
* Determine the table freeze age to use: as specified by the caller,
@@ -671,8 +671,8 @@ vacuum_set_xid_limits(int freeze_min_age,
Assert(freezetable >= 0);
/*
- * Compute the cutoff XID, being careful not to generate a
- * "permanent" XID.
+ * Compute the cutoff XID, being careful not to generate a "permanent"
+ * XID.
*/
limit = ReadNewTransactionId() - freezetable;
if (!TransactionIdIsNormal(limit))
@@ -1031,16 +1031,16 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
StartTransactionCommand();
/*
- * Functions in indexes may want a snapshot set. Also, setting
- * a snapshot ensures that RecentGlobalXmin is kept truly recent.
+ * Functions in indexes may want a snapshot set. Also, setting a snapshot
+ * ensures that RecentGlobalXmin is kept truly recent.
*/
PushActiveSnapshot(GetTransactionSnapshot());
if (!vacstmt->full)
{
/*
- * In lazy vacuum, we can set the PROC_IN_VACUUM flag, which lets other
- * concurrent VACUUMs know that they can ignore this one while
+ * In lazy vacuum, we can 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
@@ -1049,9 +1049,9 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
* contents of other tables is arguably broken, but we won't break it
* here by violating transaction semantics.)
*
- * We also set the VACUUM_FOR_WRAPAROUND flag, which is passed down
- * by autovacuum; it's used to avoid cancelling a vacuum that was
- * invoked in an emergency.
+ * We also set the VACUUM_FOR_WRAPAROUND flag, which is passed down by
+ * autovacuum; it's used to avoid cancelling a vacuum that was invoked
+ * in an emergency.
*
* Note: these flags remain set until CommitTransaction or
* AbortTransaction. We don't want to clear them until we reset
@@ -1108,8 +1108,8 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
{
if (onerel->rd_rel->relisshared)
ereport(WARNING,
- (errmsg("skipping \"%s\" --- only superuser can vacuum it",
- RelationGetRelationName(onerel))));
+ (errmsg("skipping \"%s\" --- only superuser can vacuum it",
+ RelationGetRelationName(onerel))));
else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE)
ereport(WARNING,
(errmsg("skipping \"%s\" --- only superuser or database owner can vacuum it",
@@ -1125,8 +1125,9 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
}
/*
- * Check that it's a vacuumable table; we used to do this in get_rel_oids()
- * but seems safer to check after we've locked the relation.
+ * Check that it's a vacuumable table; we used to do this in
+ * get_rel_oids() but seems safer to check after we've locked the
+ * relation.
*/
if (onerel->rd_rel->relkind != RELKIND_RELATION &&
onerel->rd_rel->relkind != RELKIND_TOASTVALUE)
@@ -1178,9 +1179,8 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
toast_relid = InvalidOid;
/*
- * Switch to the table owner's userid, so that any index functions are
- * run as that user. (This is unnecessary, but harmless, for lazy
- * VACUUM.)
+ * Switch to the table owner's userid, so that any index functions are run
+ * as that user. (This is unnecessary, but harmless, for lazy VACUUM.)
*/
GetUserIdAndContext(&save_userid, &save_secdefcxt);
SetUserIdAndContext(onerel->rd_rel->relowner, true);
@@ -1740,13 +1740,13 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
/*
* Add the page to vacuum_pages if it requires reaping, and add it to
* fraged_pages if it has a useful amount of free space. "Useful"
- * means enough for a minimal-sized tuple. But we don't know that
+ * means enough for a minimal-sized tuple. But we don't know that
* accurately near the start of the relation, so add pages
* unconditionally if they have >= BLCKSZ/10 free space. Also
* forcibly add pages with no live tuples, to avoid confusing the
* empty_end_pages logic. (In the presence of unreasonably small
- * fillfactor, it seems possible that such pages might not pass
- * the free-space test, but they had better be in the list anyway.)
+ * fillfactor, it seems possible that such pages might not pass the
+ * free-space test, but they had better be in the list anyway.)
*/
do_frag = (vacpage->free >= min_tlen || vacpage->free >= BLCKSZ / 10 ||
notup);
@@ -2228,7 +2228,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
/* assume block# is OK (see heap_fetch comments) */
nextBuf = ReadBufferExtended(onerel, MAIN_FORKNUM,
ItemPointerGetBlockNumber(&nextTid),
- RBM_NORMAL, vac_strategy);
+ RBM_NORMAL, vac_strategy);
nextPage = BufferGetPage(nextBuf);
/* If bogus or unused slot, assume tp is end of chain */
nextOffnum = ItemPointerGetOffsetNumber(&nextTid);
@@ -2373,7 +2373,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
tp.t_self = vtlp->this_tid;
Pbuf = ReadBufferExtended(onerel, MAIN_FORKNUM,
ItemPointerGetBlockNumber(&(tp.t_self)),
- RBM_NORMAL, vac_strategy);
+ RBM_NORMAL, vac_strategy);
Ppage = BufferGetPage(Pbuf);
Pitemid = PageGetItemId(Ppage,
ItemPointerGetOffsetNumber(&(tp.t_self)));
@@ -2457,7 +2457,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
tuple.t_self = vtmove[ti].tid;
Cbuf = ReadBufferExtended(onerel, MAIN_FORKNUM,
ItemPointerGetBlockNumber(&(tuple.t_self)),
- RBM_NORMAL, vac_strategy);
+ RBM_NORMAL, vac_strategy);
/* Get page to move to */
dst_buffer = ReadBufferExtended(onerel, MAIN_FORKNUM,
@@ -3400,8 +3400,8 @@ scan_index(Relation indrel, double num_tuples)
return;
/*
- * Now update statistics in pg_class, but only if the index says the
- * count is accurate.
+ * Now update statistics in pg_class, but only if the index says the count
+ * is accurate.
*/
if (!stats->estimated_count)
vac_update_relstats(indrel,
@@ -3477,8 +3477,8 @@ vacuum_index(VacPageList vacpagelist, Relation indrel,
return;
/*
- * Now update statistics in pg_class, but only if the index says the
- * count is accurate.
+ * Now update statistics in pg_class, but only if the index says the count
+ * is accurate.
*/
if (!stats->estimated_count)
vac_update_relstats(indrel,
@@ -3835,7 +3835,7 @@ PageGetFreeSpaceWithFillFactor(Relation relation, Page page)
{
/*
* It is correct to use PageGetExactFreeSpace() here, *not*
- * PageGetHeapFreeSpace(). This is because (a) we do our own, exact
+ * PageGetHeapFreeSpace(). This is because (a) we do our own, exact
* accounting for whether line pointers must be added, and (b) we will
* recycle any LP_DEAD line pointers before starting to add rows to a
* page, but that may not have happened yet at the time this function is
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index dd0691d0fe..01aa11a6d2 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -29,7 +29,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.120 2009/06/06 22:13:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.121 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,7 +87,7 @@ typedef struct LVRelStats
bool scanned_all; /* have we scanned all pages (this far)? */
/* Overall statistics about rel */
BlockNumber rel_pages;
- double old_rel_tuples; /* previous value of pg_class.reltuples */
+ double old_rel_tuples; /* previous value of pg_class.reltuples */
double rel_tuples; /* counts only tuples on scanned pages */
BlockNumber pages_removed;
double tuples_deleted;
@@ -175,14 +175,14 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
vacrelstats = (LVRelStats *) palloc0(sizeof(LVRelStats));
- vacrelstats->scanned_all = true; /* will be cleared if we skip a page */
+ vacrelstats->scanned_all = true; /* will be cleared if we skip a page */
vacrelstats->old_rel_tuples = onerel->rd_rel->reltuples;
vacrelstats->num_index_scans = 0;
/* Open all indexes of the relation */
vac_open_indexes(onerel, RowExclusiveLock, &nindexes, &Irel);
vacrelstats->hasindex = (nindexes > 0);
-
+
/* Do the vacuuming */
lazy_scan_heap(onerel, vacrelstats, Irel, nindexes, scan_all);
@@ -208,9 +208,9 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
* Update statistics in pg_class. But only if we didn't skip any pages;
* the tuple count only includes tuples from the pages we've visited, and
* we haven't frozen tuples in unvisited pages either. The page count is
- * accurate in any case, but because we use the reltuples / relpages
- * ratio in the planner, it's better to not update relpages either if we
- * can't update reltuples.
+ * accurate in any case, but because we use the reltuples / relpages ratio
+ * in the planner, it's better to not update relpages either if we can't
+ * update reltuples.
*/
if (vacrelstats->scanned_all)
vac_update_relstats(onerel,
@@ -279,7 +279,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
int i;
PGRUsage ru0;
Buffer vmbuffer = InvalidBuffer;
- BlockNumber all_visible_streak;
+ BlockNumber all_visible_streak;
pg_rusage_init(&ru0);
@@ -318,8 +318,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
bool all_visible;
/*
- * Skip pages that don't require vacuuming according to the
- * visibility map. But only if we've seen a streak of at least
+ * Skip pages that don't require vacuuming according to the visibility
+ * map. But only if we've seen a streak of at least
* SKIP_PAGES_THRESHOLD pages marked as clean. Since we're reading
* sequentially, the OS should be doing readahead for us and there's
* no gain in skipping a page now and then. You need a longer run of
@@ -558,9 +558,10 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
all_visible = false;
break;
}
+
/*
- * The inserter definitely committed. But is it
- * old enough that everyone sees it as committed?
+ * The inserter definitely committed. But is it old
+ * enough that everyone sees it as committed?
*/
xmin = HeapTupleHeaderGetXmin(tuple.t_data);
if (!TransactionIdPrecedes(xmin, OldestXmin))
@@ -922,8 +923,8 @@ lazy_cleanup_index(Relation indrel,
return;
/*
- * Now update statistics in pg_class, but only if the index says the
- * count is accurate.
+ * Now update statistics in pg_class, but only if the index says the count
+ * is accurate.
*/
if (!stats->estimated_count)
vac_update_relstats(indrel,
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index c9236f7e80..1374b65122 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.129 2009/01/01 17:23:40 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.130 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -268,7 +268,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
/*
* Try to parse it. XXX an invalid interval format will result in
- * ereport(ERROR), which is not desirable for GUC. We did what we
+ * ereport(ERROR), which is not desirable for GUC. We did what we
* could to guard against this in flatten_set_variable_args, but a
* string coming in from postgresql.conf might contain anything.
*/
@@ -290,7 +290,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
{
ereport(GUC_complaint_elevel(source),
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("invalid interval value for time zone: day not allowed")));
+ errmsg("invalid interval value for time zone: day not allowed")));
pfree(interval);
return NULL;
}
@@ -843,7 +843,7 @@ assign_role(const char *value, bool doit, GucSource source)
/*
* Disallow SET ROLE inside a security definer context. We need to do
* this because when we exit the context, GUC won't be notified,
- * leaving things out of sync. Note that this test is arranged so
+ * leaving things out of sync. Note that this test is arranged so
* that restoring a previously saved setting isn't prevented.
*
* XXX it would be nice to allow this case in future, with the
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index ab8e6a78fc..b06a48b7ab 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.115 2009/04/04 21:12:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.116 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -185,14 +185,14 @@ DefineVirtualRelation(const RangeVar *relation, List *tlist, bool replace)
checkViewTupleDesc(descriptor, rel->rd_att);
/*
- * If new attributes have been added, we must add pg_attribute entries
+ * If new attributes have been added, we must add pg_attribute entries
* for them. It is convenient (although overkill) to use the ALTER
* TABLE ADD COLUMN infrastructure for this.
*/
if (list_length(attrList) > rel->rd_att->natts)
{
- List *atcmds = NIL;
- ListCell *c;
+ List *atcmds = NIL;
+ ListCell *c;
int skip = rel->rd_att->natts;
foreach(c, attrList)
@@ -273,9 +273,9 @@ checkViewTupleDesc(TupleDesc newdesc, TupleDesc olddesc)
if (strcmp(NameStr(newattr->attname), NameStr(oldattr->attname)) != 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
- errmsg("cannot change name of view column \"%s\" to \"%s\"",
- NameStr(oldattr->attname),
- NameStr(newattr->attname))));
+ errmsg("cannot change name of view column \"%s\" to \"%s\"",
+ NameStr(oldattr->attname),
+ NameStr(newattr->attname))));
/* XXX would it be safe to allow atttypmod to change? Not sure */
if (newattr->atttypid != oldattr->atttypid ||
newattr->atttypmod != oldattr->atttypmod)
diff --git a/src/backend/executor/execCurrent.c b/src/backend/executor/execCurrent.c
index 2c1a1731db..d9ecc973e1 100644
--- a/src/backend/executor/execCurrent.c
+++ b/src/backend/executor/execCurrent.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/executor/execCurrent.c,v 1.9 2009/01/01 17:23:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execCurrent.c,v 1.10 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -138,8 +138,8 @@ execCurrentOf(CurrentOfExpr *cexpr,
/*
* This table didn't produce the cursor's current row; some other
- * inheritance child of the same parent must have. Signal caller
- * to do nothing on this table.
+ * inheritance child of the same parent must have. Signal caller to
+ * do nothing on this table.
*/
return false;
}
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 03461a235a..1c6fd02e1f 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.324 2009/05/07 22:58:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.325 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,9 +62,9 @@
/* Hooks for plugins to get control in ExecutorStart/Run/End() */
-ExecutorStart_hook_type ExecutorStart_hook = NULL;
-ExecutorRun_hook_type ExecutorRun_hook = NULL;
-ExecutorEnd_hook_type ExecutorEnd_hook = NULL;
+ExecutorStart_hook_type ExecutorStart_hook = NULL;
+ExecutorRun_hook_type ExecutorRun_hook = NULL;
+ExecutorEnd_hook_type ExecutorEnd_hook = NULL;
typedef struct evalPlanQual
{
@@ -552,17 +552,17 @@ ExecCheckRTEPerms(RangeTblEntry *rte)
}
/*
- * Basically the same for the mod columns, with either INSERT or UPDATE
- * privilege as specified by remainingPerms.
+ * Basically the same for the mod columns, with either INSERT or
+ * UPDATE privilege as specified by remainingPerms.
*/
remainingPerms &= ~ACL_SELECT;
if (remainingPerms != 0)
{
/*
- * When the query doesn't explicitly change any columns, allow
- * the query if we have permission on any column of the rel. This
- * is to handle SELECT FOR UPDATE as well as possible corner cases
- * in INSERT and UPDATE.
+ * When the query doesn't explicitly change any columns, allow the
+ * query if we have permission on any column of the rel. This is
+ * to handle SELECT FOR UPDATE as well as possible corner cases in
+ * INSERT and UPDATE.
*/
if (bms_is_empty(rte->modifiedCols))
{
@@ -843,9 +843,9 @@ InitPlan(QueryDesc *queryDesc, int eflags)
/*
* Initialize the junk filter if needed. SELECT and INSERT queries need a
- * filter if there are any junk attrs in the tlist. UPDATE and
- * DELETE always need a filter, since there's always a junk 'ctid'
- * attribute present --- no need to look first.
+ * filter if there are any junk attrs in the tlist. UPDATE and DELETE
+ * always need a filter, since there's always a junk 'ctid' attribute
+ * present --- no need to look first.
*
* This section of code is also a convenient place to verify that the
* output of an INSERT or UPDATE matches the target table(s).
@@ -1194,7 +1194,7 @@ ExecCheckPlanOutput(Relation resultRel, List *targetList)
errdetail("Table has type %s at ordinal position %d, but query expects %s.",
format_type_be(attr->atttypid),
attno,
- format_type_be(exprType((Node *) tle->expr)))));
+ format_type_be(exprType((Node *) tle->expr)))));
}
else
{
@@ -1215,7 +1215,7 @@ ExecCheckPlanOutput(Relation resultRel, List *targetList)
if (attno != resultDesc->natts)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
- errmsg("table row type and query-specified row type do not match"),
+ errmsg("table row type and query-specified row type do not match"),
errdetail("Query has too few columns.")));
}
@@ -1547,7 +1547,7 @@ lnext: ;
/* if child rel, must check whether it produced this row */
if (erm->rti != erm->prti)
{
- Oid tableoid;
+ Oid tableoid;
datum = ExecGetJunkAttribute(slot,
erm->toidAttNo,
@@ -1774,8 +1774,8 @@ ExecInsert(TupleTableSlot *slot,
* rowtype.
*
* XXX if we ever wanted to allow users to assign their own OIDs to new
- * rows, this'd be the place to do it. For the moment, we make a point
- * of doing this before calling triggers, so that a user-supplied trigger
+ * rows, this'd be the place to do it. For the moment, we make a point of
+ * doing this before calling triggers, so that a user-supplied trigger
* could hack the OID if desired.
*/
if (resultRelationDesc->rd_rel->relhasoids)
@@ -2847,7 +2847,7 @@ OpenIntoRel(QueryDesc *queryDesc)
Oid intoRelationId;
TupleDesc tupdesc;
DR_intorel *myState;
- static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
+ static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
Assert(into);
@@ -2970,8 +2970,8 @@ OpenIntoRel(QueryDesc *queryDesc)
myState->rel = intoRelationDesc;
/*
- * We can skip WAL-logging the insertions, unless PITR is in use. We
- * can skip the FSM in any case.
+ * We can skip WAL-logging the insertions, unless PITR is in use. We can
+ * skip the FSM in any case.
*/
myState->hi_options = HEAP_INSERT_SKIP_FSM |
(XLogArchivingActive() ? 0 : HEAP_INSERT_SKIP_WAL);
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 65bf01c6a8..a0e4566630 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.248 2009/06/09 22:00:57 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.249 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,8 +63,8 @@ static Datum ExecEvalAggref(AggrefExprState *aggref,
ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalWindowFunc(WindowFuncExprState *wfunc,
- ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+ ExprContext *econtext,
+ bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalScalarVar(ExprState *exprstate, ExprContext *econtext,
@@ -78,7 +78,7 @@ static Datum ExecEvalConst(ExprState *exprstate, ExprContext *econtext,
static Datum ExecEvalParam(ExprState *exprstate, ExprContext *econtext,
bool *isNull, ExprDoneCond *isDone);
static void init_fcache(Oid foid, FuncExprState *fcache,
- MemoryContext fcacheCxt, bool needDescForSets);
+ MemoryContext fcacheCxt, bool needDescForSets);
static void ShutdownFuncExpr(Datum arg);
static TupleDesc get_cached_rowtype(Oid type_id, int32 typmod,
TupleDesc *cache_field, ExprContext *econtext);
@@ -617,7 +617,7 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("table row type and query-specified row type do not match"),
errdetail_plural("Table row contains %d attribute, but query expects %d.",
- "Table row contains %d attributes, but query expects %d.",
+ "Table row contains %d attributes, but query expects %d.",
slot_tupdesc->natts,
slot_tupdesc->natts,
var_tupdesc->natts)));
@@ -1044,10 +1044,10 @@ init_fcache(Oid foid, FuncExprState *fcache,
if (list_length(fcache->args) > FUNC_MAX_ARGS)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
- errmsg_plural("cannot pass more than %d argument to a function",
- "cannot pass more than %d arguments to a function",
- FUNC_MAX_ARGS,
- FUNC_MAX_ARGS)));
+ errmsg_plural("cannot pass more than %d argument to a function",
+ "cannot pass more than %d arguments to a function",
+ FUNC_MAX_ARGS,
+ FUNC_MAX_ARGS)));
/* Set up the primary fmgr lookup information */
fmgr_info_cxt(foid, &(fcache->func), fcacheCxt);
@@ -1237,7 +1237,7 @@ ExecEvalFuncArgs(FunctionCallInfo fcinfo,
* ExecPrepareTuplestoreResult
*
* Subroutine for ExecMakeFunctionResult: prepare to extract rows from a
- * tuplestore function result. We must set up a funcResultSlot (unless
+ * tuplestore function result. We must set up a funcResultSlot (unless
* already done in a previous call cycle) and verify that the function
* returned the expected tuple descriptor.
*/
@@ -1268,9 +1268,8 @@ ExecPrepareTuplestoreResult(FuncExprState *fcache,
}
/*
- * If function provided a tupdesc, cross-check it. We only really
- * need to do this for functions returning RECORD, but might as well
- * do it always.
+ * If function provided a tupdesc, cross-check it. We only really need to
+ * do this for functions returning RECORD, but might as well do it always.
*/
if (resultDesc)
{
@@ -1316,7 +1315,7 @@ tupledesc_match(TupleDesc dst_tupdesc, TupleDesc src_tupdesc)
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("function return row and query-specified return row do not match"),
errdetail_plural("Returned row contains %d attribute, but query expects %d.",
- "Returned row contains %d attributes, but query expects %d.",
+ "Returned row contains %d attributes, but query expects %d.",
src_tupdesc->natts,
src_tupdesc->natts, dst_tupdesc->natts)));
@@ -1353,7 +1352,7 @@ tupledesc_match(TupleDesc dst_tupdesc, TupleDesc src_tupdesc)
* init_fcache is presumed already run on the FuncExprState.
*
* This function handles the most general case, wherein the function or
- * one of its arguments might (or might not) return a set. If we find
+ * one of its arguments might (or might not) return a set. If we find
* no sets involved, we will change the FuncExprState's function pointer
* to use a simpler method on subsequent calls.
*/
@@ -1379,13 +1378,13 @@ restart:
check_stack_depth();
/*
- * If a previous call of the function returned a set result in the form
- * of a tuplestore, continue reading rows from the tuplestore until it's
+ * If a previous call of the function returned a set result in the form of
+ * a tuplestore, continue reading rows from the tuplestore until it's
* empty.
*/
if (fcache->funcResultStore)
{
- Assert(isDone); /* it was provided before ... */
+ Assert(isDone); /* it was provided before ... */
if (tuplestore_gettupleslot(fcache->funcResultStore, true, false,
fcache->funcResultSlot))
{
@@ -1420,10 +1419,10 @@ restart:
* For non-set-returning functions, we just use a local-variable
* FunctionCallInfoData. For set-returning functions we keep the callinfo
* record in fcache->setArgs so that it can survive across multiple
- * value-per-call invocations. (The reason we don't just do the latter
- * all the time is that plpgsql expects to be able to use simple expression
- * trees re-entrantly. Which might not be a good idea, but the penalty
- * for not doing so is high.)
+ * value-per-call invocations. (The reason we don't just do the latter
+ * all the time is that plpgsql expects to be able to use simple
+ * expression trees re-entrantly. Which might not be a good idea, but the
+ * penalty for not doing so is high.)
*/
if (fcache->func.fn_retset)
fcinfo = &fcache->setArgs;
@@ -1534,7 +1533,7 @@ restart:
*isDone = rsinfo.isDone;
pgstat_end_function_usage(&fcusage,
- rsinfo.isDone != ExprMultipleResult);
+ rsinfo.isDone != ExprMultipleResult);
}
else
{
@@ -1564,7 +1563,7 @@ restart:
{
RegisterExprContextCallback(econtext,
ShutdownFuncExpr,
- PointerGetDatum(fcache));
+ PointerGetDatum(fcache));
fcache->shutdown_reg = true;
}
}
@@ -2043,9 +2042,8 @@ no_function_result:
}
/*
- * If function provided a tupdesc, cross-check it. We only really
- * need to do this for functions returning RECORD, but might as well
- * do it always.
+ * If function provided a tupdesc, cross-check it. We only really need to
+ * do this for functions returning RECORD, but might as well do it always.
*/
if (rsinfo.setDesc)
{
@@ -3229,41 +3227,41 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
break;
case IS_XMLFOREST:
- {
- StringInfoData buf;
-
- initStringInfo(&buf);
- forboth(arg, xmlExpr->named_args, narg, xexpr->arg_names)
{
- ExprState *e = (ExprState *) lfirst(arg);
- char *argname = strVal(lfirst(narg));
+ StringInfoData buf;
- value = ExecEvalExpr(e, econtext, &isnull, NULL);
- if (!isnull)
+ initStringInfo(&buf);
+ forboth(arg, xmlExpr->named_args, narg, xexpr->arg_names)
{
- appendStringInfo(&buf, "<%s>%s</%s>",
- argname,
- map_sql_value_to_xml_value(value, exprType((Node *) e->expr), true),
- argname);
- *isNull = false;
+ ExprState *e = (ExprState *) lfirst(arg);
+ char *argname = strVal(lfirst(narg));
+
+ value = ExecEvalExpr(e, econtext, &isnull, NULL);
+ if (!isnull)
+ {
+ appendStringInfo(&buf, "<%s>%s</%s>",
+ argname,
+ map_sql_value_to_xml_value(value, exprType((Node *) e->expr), true),
+ argname);
+ *isNull = false;
+ }
}
- }
- if (*isNull)
- {
- pfree(buf.data);
- return (Datum) 0;
- }
- else
- {
- text *result;
+ if (*isNull)
+ {
+ pfree(buf.data);
+ return (Datum) 0;
+ }
+ else
+ {
+ text *result;
- result = cstring_to_text_with_len(buf.data, buf.len);
- pfree(buf.data);
+ result = cstring_to_text_with_len(buf.data, buf.len);
+ pfree(buf.data);
- return PointerGetDatum(result);
+ return PointerGetDatum(result);
+ }
}
- }
break;
case IS_XMLELEMENT:
@@ -4095,9 +4093,9 @@ ExecEvalExprSwitchContext(ExprState *expression,
*
* Any Aggref, WindowFunc, or SubPlan nodes found in the tree are added to the
* lists of such nodes held by the parent PlanState. Otherwise, we do very
- * little initialization here other than building the state-node tree. Any
+ * little initialization here other than building the state-node tree. Any
* nontrivial work associated with initializing runtime info for a node should
- * happen during the first actual evaluation of that node. (This policy lets
+ * happen during the first actual evaluation of that node. (This policy lets
* us avoid work if the node is never actually evaluated.)
*
* Note: there is no ExecEndExpr function; we assume that any resource
@@ -4209,7 +4207,7 @@ ExecInitExpr(Expr *node, PlanState *parent)
if (nfuncs != winstate->numfuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("window function calls cannot be nested")));
+ errmsg("window function calls cannot be nested")));
}
else
{
@@ -5156,11 +5154,11 @@ ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone)
numSimpleVars = projInfo->pi_numSimpleVars;
if (numSimpleVars > 0)
{
- Datum *values = slot->tts_values;
- bool *isnull = slot->tts_isnull;
- int *varSlotOffsets = projInfo->pi_varSlotOffsets;
- int *varNumbers = projInfo->pi_varNumbers;
- int i;
+ Datum *values = slot->tts_values;
+ bool *isnull = slot->tts_isnull;
+ int *varSlotOffsets = projInfo->pi_varSlotOffsets;
+ int *varNumbers = projInfo->pi_varNumbers;
+ int i;
if (projInfo->pi_directMap)
{
@@ -5178,7 +5176,7 @@ ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone)
else
{
/* we have to pay attention to varOutputCols[] */
- int *varOutputCols = projInfo->pi_varOutputCols;
+ int *varOutputCols = projInfo->pi_varOutputCols;
for (i = 0; i < numSimpleVars; i++)
{
@@ -5195,9 +5193,9 @@ ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone)
/*
* If there are any generic expressions, evaluate them. It's possible
- * that there are set-returning functions in such expressions; if so
- * and we have reached the end of the set, we return the result slot,
- * which we already marked empty.
+ * that there are set-returning functions in such expressions; if so and
+ * we have reached the end of the set, we return the result slot, which we
+ * already marked empty.
*/
if (projInfo->pi_targetlist)
{
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 1d0a5854fb..7b5ba41f5f 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.106 2009/03/30 04:08:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.107 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -756,9 +756,9 @@ ExecFetchSlotMinimalTuple(TupleTableSlot *slot)
/*
* Note: we may now have a situation where we have a local minimal tuple
- * attached to a virtual or non-local physical tuple. There seems no
- * harm in that at the moment, but if any materializes, we should change
- * this function to force the slot into minimal-tuple-only state.
+ * attached to a virtual or non-local physical tuple. There seems no harm
+ * in that at the moment, but if any materializes, we should change this
+ * function to force the slot into minimal-tuple-only state.
*/
return slot->tts_mintuple;
@@ -843,9 +843,9 @@ ExecMaterializeSlot(TupleTableSlot *slot)
slot->tts_buffer = InvalidBuffer;
/*
- * Mark extracted state invalid. This is important because the slot
- * is not supposed to depend any more on the previous external data;
- * we mustn't leave any dangling pass-by-reference datums in tts_values.
+ * Mark extracted state invalid. This is important because the slot is
+ * not supposed to depend any more on the previous external data; we
+ * mustn't leave any dangling pass-by-reference datums in tts_values.
* However, we have not actually invalidated any such datums, if there
* happen to be any previously fetched from the slot. (Note in particular
* that we have not pfree'd tts_mintuple, if there is one.)
@@ -854,9 +854,9 @@ ExecMaterializeSlot(TupleTableSlot *slot)
/*
* On the same principle of not depending on previous remote storage,
- * forget the mintuple if it's not local storage. (If it is local storage,
- * we must not pfree it now, since callers might have already fetched
- * datum pointers referencing it.)
+ * forget the mintuple if it's not local storage. (If it is local
+ * storage, we must not pfree it now, since callers might have already
+ * fetched datum pointers referencing it.)
*/
if (!slot->tts_shouldFreeMin)
slot->tts_mintuple = NULL;
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 4b3d92d48b..360ee40858 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.158 2009/04/02 22:39:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.159 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -584,8 +584,8 @@ ExecBuildProjectionInfo(List *targetList,
/*
* We separate the target list elements into simple Var references and
- * expressions which require the full ExecTargetList machinery. To be
- * a simple Var, a Var has to be a user attribute and not mismatch the
+ * expressions which require the full ExecTargetList machinery. To be a
+ * simple Var, a Var has to be a user attribute and not mismatch the
* inputDesc. (Note: if there is a type mismatch then ExecEvalVar will
* probably throw an error at runtime, but we leave that to it.)
*/
@@ -621,7 +621,7 @@ ExecBuildProjectionInfo(List *targetList,
varNumbers[numSimpleVars] = attnum;
varOutputCols[numSimpleVars] = tle->resno;
- if (tle->resno != numSimpleVars+1)
+ if (tle->resno != numSimpleVars + 1)
directMap = false;
switch (variable->varno)
@@ -683,7 +683,7 @@ get_last_attnums(Node *node, ProjectionInfo *projInfo)
return false;
if (IsA(node, Var))
{
- Var *variable = (Var *) node;
+ Var *variable = (Var *) node;
AttrNumber attnum = variable->varattno;
switch (variable->varno)
@@ -705,9 +705,10 @@ get_last_attnums(Node *node, ProjectionInfo *projInfo)
}
return false;
}
+
/*
- * Don't examine the arguments of Aggrefs or WindowFuncs, because those
- * do not represent expressions to be evaluated within the overall
+ * Don't examine the arguments of Aggrefs or WindowFuncs, because those do
+ * not represent expressions to be evaluated within the overall
* targetlist's econtext.
*/
if (IsA(node, Aggref))
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index f71807835f..b0d8b9008a 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.133 2009/03/27 18:30:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.134 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -101,8 +101,8 @@ typedef SQLFunctionCache *SQLFunctionCachePtr;
/* non-export function prototypes */
static execution_state *init_execution_state(List *queryTree_list,
- SQLFunctionCachePtr fcache,
- bool lazyEvalOK);
+ SQLFunctionCachePtr fcache,
+ bool lazyEvalOK);
static void init_sql_fcache(FmgrInfo *finfo, bool lazyEvalOK);
static void postquel_start(execution_state *es, SQLFunctionCachePtr fcache);
static bool postquel_getnext(execution_state *es, SQLFunctionCachePtr fcache);
@@ -168,8 +168,8 @@ init_execution_state(List *queryTree_list,
newes->next = NULL;
newes->status = F_EXEC_START;
- newes->setsResult = false; /* might change below */
- newes->lazyEval = false; /* might change below */
+ newes->setsResult = false; /* might change below */
+ newes->lazyEval = false; /* might change below */
newes->stmt = stmt;
newes->qd = NULL;
@@ -180,9 +180,9 @@ init_execution_state(List *queryTree_list,
}
/*
- * Mark the last canSetTag query as delivering the function result;
- * then, if it is a plain SELECT, mark it for lazy evaluation.
- * If it's not a SELECT we must always run it to completion.
+ * Mark the last canSetTag query as delivering the function result; then,
+ * if it is a plain SELECT, mark it for lazy evaluation. If it's not a
+ * SELECT we must always run it to completion.
*
* Note: at some point we might add additional criteria for whether to use
* lazy eval. However, we should prefer to use it whenever the function
@@ -191,8 +191,8 @@ init_execution_state(List *queryTree_list,
*
* Note: don't set setsResult if the function returns VOID, as evidenced
* by not having made a junkfilter. This ensures we'll throw away any
- * output from a utility statement that check_sql_fn_retval deemed to
- * not have output.
+ * output from a utility statement that check_sql_fn_retval deemed to not
+ * have output.
*/
if (lasttages && fcache->junkFilter)
{
@@ -326,10 +326,10 @@ init_sql_fcache(FmgrInfo *finfo, bool lazyEvalOK)
* 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. (However, we have to
- * force lazy eval mode in that case; otherwise we'd need extra code to
- * expand the rowtype column into multiple columns, since we have no
- * way to notify the caller that it should do that.)
+ * result case, even if it's a rowtype column. (However, we have to force
+ * lazy eval mode in that case; otherwise we'd need extra code to expand
+ * the rowtype column into multiple columns, since we have no way to
+ * notify the caller that it should do that.)
*
* check_sql_fn_retval will also construct a JunkFilter we can use to
* coerce the returned rowtype to the desired form (unless the result type
@@ -459,7 +459,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 = true; /* never stops early */
@@ -566,7 +566,7 @@ postquel_get_single_result(TupleTableSlot *slot,
/*
* Set up to return the function value. For pass-by-reference datatypes,
* be sure to allocate the result in resultcontext, not the current memory
- * context (which has query lifespan). We can't leave the data in the
+ * context (which has query lifespan). We can't leave the data in the
* TupleTableSlot because we intend to clear the slot before returning.
*/
oldcontext = MemoryContextSwitchTo(resultcontext);
@@ -670,8 +670,8 @@ fmgr_sql(PG_FUNCTION_ARGS)
postquel_sub_params(fcache, fcinfo);
/*
- * Build tuplestore to hold results, if we don't have one already.
- * Note it's in the query-lifespan context.
+ * Build tuplestore to hold results, if we don't have one already. Note
+ * it's in the query-lifespan context.
*/
if (!fcache->tstore)
fcache->tstore = tuplestore_begin_heap(randomAccess, false, work_mem);
@@ -688,7 +688,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
*/
while (es)
{
- bool completed;
+ bool completed;
if (es->status == F_EXEC_START)
postquel_start(es, fcache);
@@ -696,22 +696,22 @@ fmgr_sql(PG_FUNCTION_ARGS)
completed = postquel_getnext(es, fcache);
/*
- * If we ran the command to completion, we can shut it down now.
- * Any row(s) we need to return are safely stashed in the tuplestore,
- * and we want to be sure that, for example, AFTER triggers get fired
+ * If we ran the command to completion, we can shut it down now. Any
+ * row(s) we need to return are safely stashed in the tuplestore, and
+ * we want to be sure that, for example, AFTER triggers get fired
* before we return anything. Also, if the function doesn't return
- * set, we can shut it down anyway because it must be a SELECT and
- * we don't care about fetching any more result rows.
+ * set, we can shut it down anyway because it must be a SELECT and we
+ * don't care about fetching any more result rows.
*/
if (completed || !fcache->returnsSet)
postquel_end(es);
/*
* Break from loop if we didn't shut down (implying we got a
- * lazily-evaluated row). Otherwise we'll press on till the
- * whole function is done, relying on the tuplestore to keep hold
- * of the data to eventually be returned. This is necessary since
- * an INSERT/UPDATE/DELETE RETURNING that sets the result might be
+ * lazily-evaluated row). Otherwise we'll press on till the whole
+ * function is done, relying on the tuplestore to keep hold of the
+ * data to eventually be returned. This is necessary since an
+ * INSERT/UPDATE/DELETE RETURNING that sets the result might be
* followed by additional rule-inserted commands, and we want to
* finish doing all those commands before we return anything.
*/
@@ -730,7 +730,8 @@ fmgr_sql(PG_FUNCTION_ARGS)
if (es)
{
/*
- * If we stopped short of being done, we must have a lazy-eval row.
+ * If we stopped short of being done, we must have a lazy-eval
+ * row.
*/
Assert(es->lazyEval);
/* Re-use the junkfilter's output slot to fetch back the tuple */
@@ -765,7 +766,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
else if (fcache->lazyEval)
{
/*
- * We are done with a lazy evaluation. Clean up.
+ * We are done with a lazy evaluation. Clean up.
*/
tuplestore_clear(fcache->tstore);
@@ -789,9 +790,9 @@ fmgr_sql(PG_FUNCTION_ARGS)
else
{
/*
- * We are done with a non-lazy evaluation. Return whatever is
- * in the tuplestore. (It is now caller's responsibility to
- * free the tuplestore when done.)
+ * We are done with a non-lazy evaluation. Return whatever is in
+ * the tuplestore. (It is now caller's responsibility to free the
+ * tuplestore when done.)
*/
rsi->returnMode = SFRM_Materialize;
rsi->setResult = fcache->tstore;
@@ -844,8 +845,8 @@ fmgr_sql(PG_FUNCTION_ARGS)
}
/*
- * If we've gone through every command in the function, we are done.
- * Reset the execution states to start over again on next call.
+ * If we've gone through every command in the function, we are done. Reset
+ * the execution states to start over again on next call.
*/
if (es == NULL)
{
@@ -997,7 +998,7 @@ ShutdownSQLFunction(Datum arg)
* function definition of a polymorphic function.)
*
* This function returns true if the sql function returns the entire tuple
- * result of its final statement, and false otherwise. Note that because we
+ * result of its final statement, and false otherwise. Note that because we
* allow "SELECT rowtype_expression", this may be false even when the declared
* function return type is a rowtype.
*
@@ -1029,14 +1030,14 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
*junkFilter = NULL; /* initialize in case of VOID result */
/*
- * Find the last canSetTag query in the list. This isn't necessarily
- * the last parsetree, because rule rewriting can insert queries after
- * what the user wrote.
+ * Find the last canSetTag query in the list. This isn't necessarily the
+ * last parsetree, because rule rewriting can insert queries after what
+ * the user wrote.
*/
parse = NULL;
foreach(lc, queryTreeList)
{
- Query *q = (Query *) lfirst(lc);
+ Query *q = (Query *) lfirst(lc);
if (q->canSetTag)
parse = q;
@@ -1044,12 +1045,12 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
/*
* If it's a plain SELECT, it returns whatever the targetlist says.
- * Otherwise, if it's INSERT/UPDATE/DELETE with RETURNING, it returns that.
- * Otherwise, the function return type must be VOID.
+ * Otherwise, if it's INSERT/UPDATE/DELETE with RETURNING, it returns
+ * that. Otherwise, the function return type must be VOID.
*
* Note: eventually replace this test with QueryReturnsTuples? We'd need
- * a more general method of determining the output type, though. Also,
- * it seems too dangerous to consider FETCH or EXECUTE as returning a
+ * a more general method of determining the output type, though. Also, it
+ * seems too dangerous to consider FETCH or EXECUTE as returning a
* determinable rowtype, since they depend on relatively short-lived
* entities.
*/
@@ -1076,7 +1077,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("return type mismatch in function declared to return %s",
format_type_be(rettype)),
- errdetail("Function's final statement must be SELECT or INSERT/UPDATE/DELETE RETURNING.")));
+ errdetail("Function's final statement must be SELECT or INSERT/UPDATE/DELETE RETURNING.")));
return false;
}
@@ -1112,7 +1113,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("return type mismatch in function declared to return %s",
format_type_be(rettype)),
- errdetail("Final statement must return exactly one column.")));
+ errdetail("Final statement must return exactly one column.")));
/* We assume here that non-junk TLEs must come first in tlists */
tle = (TargetEntry *) linitial(tlist);
@@ -1148,8 +1149,8 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
* If the target list is of length 1, and the type of the varnode in
* the target list matches the declared return type, this is okay.
* This can happen, for example, where the body of the function is
- * 'SELECT func2()', where func2 has the same composite return type
- * as the function that's calling it.
+ * 'SELECT func2()', where func2 has the same composite return type as
+ * the function that's calling it.
*/
if (tlistlen == 1)
{
@@ -1211,7 +1212,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("return type mismatch in function declared to return %s",
format_type_be(rettype)),
- errdetail("Final statement returns too many columns.")));
+ errdetail("Final statement returns too many columns.")));
attr = tupdesc->attrs[colindex - 1];
} while (attr->attisdropped);
tuplogcols++;
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index b2aad2133c..306e7f6e17 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.34 2009/01/12 16:00:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.35 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -114,17 +114,17 @@ BitmapHeapNext(BitmapHeapScanState *node)
}
/*
- * If we haven't yet performed the underlying index scan, do it, and
- * begin the iteration over the bitmap.
+ * If we haven't yet performed the underlying index scan, do it, and begin
+ * the iteration over the bitmap.
*
* For prefetching, we use *two* iterators, one for the pages we are
* actually scanning and another that runs ahead of the first for
- * prefetching. node->prefetch_pages tracks exactly how many pages
- * ahead the prefetch iterator is. Also, node->prefetch_target tracks
- * the desired prefetch distance, which starts small and increases up
- * to the GUC-controlled maximum, target_prefetch_pages. This is to
- * avoid doing a lot of prefetching in a scan that stops after a few
- * tuples because of a LIMIT.
+ * prefetching. node->prefetch_pages tracks exactly how many pages ahead
+ * the prefetch iterator is. Also, node->prefetch_target tracks the
+ * desired prefetch distance, which starts small and increases up to the
+ * GUC-controlled maximum, target_prefetch_pages. This is to avoid doing
+ * a lot of prefetching in a scan that stops after a few tuples because of
+ * a LIMIT.
*/
if (tbm == NULL)
{
@@ -144,7 +144,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
node->prefetch_pages = 0;
node->prefetch_target = -1;
}
-#endif /* USE_PREFETCH */
+#endif /* USE_PREFETCH */
}
for (;;)
@@ -178,7 +178,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
if (tbmpre == NULL || tbmpre->blockno != tbmres->blockno)
elog(ERROR, "prefetch and main iterators are out of sync");
}
-#endif /* USE_PREFETCH */
+#endif /* USE_PREFETCH */
/*
* Ignore any claimed entries past what we think is the end of the
@@ -203,21 +203,22 @@ BitmapHeapNext(BitmapHeapScanState *node)
scan->rs_cindex = 0;
#ifdef USE_PREFETCH
+
/*
- * Increase prefetch target if it's not yet at the max. Note
- * that we will increase it to zero after fetching the very
- * first page/tuple, then to one after the second tuple is
- * fetched, then it doubles as later pages are fetched.
+ * Increase prefetch target if it's not yet at the max. Note that
+ * we will increase it to zero after fetching the very first
+ * page/tuple, then to one after the second tuple is fetched, then
+ * it doubles as later pages are fetched.
*/
if (node->prefetch_target >= target_prefetch_pages)
- /* don't increase any further */ ;
+ /* don't increase any further */ ;
else if (node->prefetch_target >= target_prefetch_pages / 2)
node->prefetch_target = target_prefetch_pages;
else if (node->prefetch_target > 0)
node->prefetch_target *= 2;
else
node->prefetch_target++;
-#endif /* USE_PREFETCH */
+#endif /* USE_PREFETCH */
}
else
{
@@ -227,13 +228,14 @@ BitmapHeapNext(BitmapHeapScanState *node)
scan->rs_cindex++;
#ifdef USE_PREFETCH
+
/*
* Try to prefetch at least a few pages even before we get to the
* second page if we don't stop reading after the first tuple.
*/
if (node->prefetch_target < target_prefetch_pages)
node->prefetch_target++;
-#endif /* USE_PREFETCH */
+#endif /* USE_PREFETCH */
}
/*
@@ -246,12 +248,13 @@ BitmapHeapNext(BitmapHeapScanState *node)
}
#ifdef USE_PREFETCH
+
/*
- * We issue prefetch requests *after* fetching the current page
- * to try to avoid having prefetching interfere with the main I/O.
- * Also, this should happen only when we have determined there is
- * still something to do on the current page, else we may uselessly
- * prefetch the same page we are just about to request for real.
+ * We issue prefetch requests *after* fetching the current page to try
+ * to avoid having prefetching interfere with the main I/O. Also, this
+ * should happen only when we have determined there is still something
+ * to do on the current page, else we may uselessly prefetch the same
+ * page we are just about to request for real.
*/
if (prefetch_iterator)
{
@@ -270,7 +273,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
PrefetchBuffer(scan->rs_rd, MAIN_FORKNUM, tbmpre->blockno);
}
}
-#endif /* USE_PREFETCH */
+#endif /* USE_PREFETCH */
/*
* Okay to fetch the tuple
diff --git a/src/backend/executor/nodeBitmapIndexscan.c b/src/backend/executor/nodeBitmapIndexscan.c
index 5cae058921..1ef6c988ce 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.29 2009/01/01 17:23:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.30 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -94,7 +94,7 @@ MultiExecBitmapIndexScan(BitmapIndexScanState *node)
doscan = ExecIndexAdvanceArrayKeys(node->biss_ArrayKeys,
node->biss_NumArrayKeys);
- if (doscan) /* reset index scan */
+ if (doscan) /* reset index scan */
index_rescan(node->biss_ScanDesc, node->biss_ScanKeys);
}
diff --git a/src/backend/executor/nodeCtescan.c b/src/backend/executor/nodeCtescan.c
index 67589908ce..81469c41d7 100644
--- a/src/backend/executor/nodeCtescan.c
+++ b/src/backend/executor/nodeCtescan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.4 2009/03/27 18:30:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeCtescan.c,v 1.5 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,8 +73,8 @@ CteScanNext(CteScanState *node)
* If we can fetch another tuple from the tuplestore, return it.
*
* Note: we have to use copy=true in the tuplestore_gettupleslot call,
- * because we are sharing the tuplestore with other nodes that might
- * write into the tuplestore before we get called again.
+ * because we are sharing the tuplestore with other nodes that might write
+ * into the tuplestore before we get called again.
*/
if (!eof_tuplestore)
{
@@ -111,16 +111,16 @@ CteScanNext(CteScanState *node)
* Append a copy of the returned tuple to tuplestore. NOTE: because
* our read pointer is certainly in EOF state, its read position will
* move forward over the added tuple. This is what we want. Also,
- * any other readers will *not* move past the new tuple, which is
- * what they want.
+ * any other readers will *not* move past the new tuple, which is what
+ * they want.
*/
tuplestore_puttupleslot(tuplestorestate, cteslot);
/*
- * We MUST copy the CTE query's output tuple into our own slot.
- * This is because other CteScan nodes might advance the CTE query
- * before we are called again, and our output tuple must stay
- * stable over that.
+ * We MUST copy the CTE query's output tuple into our own slot. This
+ * is because other CteScan nodes might advance the CTE query before
+ * we are called again, and our output tuple must stay stable over
+ * that.
*/
return ExecCopySlot(slot, cteslot);
}
@@ -193,10 +193,10 @@ ExecInitCteScan(CteScan *node, EState *estate, int eflags)
node->ctePlanId - 1);
/*
- * The Param slot associated with the CTE query is used to hold a
- * pointer to the CteState of the first CteScan node that initializes
- * for this CTE. This node will be the one that holds the shared
- * state for all the CTEs.
+ * The Param slot associated with the CTE query is used to hold a pointer
+ * to the CteState of the first CteScan node that initializes for this
+ * CTE. This node will be the one that holds the shared state for all the
+ * CTEs.
*/
prmdata = &(estate->es_param_exec_vals[node->cteParam]);
Assert(prmdata->execPlan == NULL);
@@ -315,8 +315,8 @@ ExecCteScanReScan(CteScanState *node, ExprContext *exprCtxt)
if (node->leader == node)
{
/*
- * The leader is responsible for clearing the tuplestore if a new
- * scan of the underlying CTE is required.
+ * The leader is responsible for clearing the tuplestore if a new scan
+ * of the underlying CTE is required.
*/
if (node->cteplanstate->chgParam != NULL)
{
diff --git a/src/backend/executor/nodeFunctionscan.c b/src/backend/executor/nodeFunctionscan.c
index 3f34e7c835..f38199650e 100644
--- a/src/backend/executor/nodeFunctionscan.c
+++ b/src/backend/executor/nodeFunctionscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.51 2009/03/27 18:30:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeFunctionscan.c,v 1.52 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -277,7 +277,7 @@ ExecFunctionReScan(FunctionScanState *node, ExprContext *exprCtxt)
/*
* Here we have a choice whether to drop the tuplestore (and recompute the
* function outputs) or just rescan it. We must recompute if the
- * expression contains parameters, else we rescan. XXX maybe we should
+ * expression contains parameters, else we rescan. XXX maybe we should
* recompute if the function is volatile?
*/
if (node->ss.ps.chgParam != NULL)
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 4a85dc97c3..471534538a 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.120 2009/04/02 20:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.121 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,11 +41,11 @@
static void ExecHashIncreaseNumBatches(HashJoinTable hashtable);
static void ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node,
- int mcvsToUse);
+ int mcvsToUse);
static void ExecHashSkewTableInsert(HashJoinTable hashtable,
- TupleTableSlot *slot,
- uint32 hashvalue,
- int bucketNumber);
+ TupleTableSlot *slot,
+ uint32 hashvalue,
+ int bucketNumber);
static void ExecHashRemoveNextSkewBucket(HashJoinTable hashtable);
@@ -108,7 +108,7 @@ MultiExecHash(HashState *node)
if (ExecHashGetHashValue(hashtable, econtext, hashkeys, false, false,
&hashvalue))
{
- int bucketNumber;
+ int bucketNumber;
bucketNumber = ExecHashGetSkewBucket(hashtable, hashvalue);
if (bucketNumber != INVALID_SKEW_BUCKET_NO)
@@ -373,7 +373,7 @@ ExecHashTableCreate(Hash *node, List *hashOperators)
/*
* Set up for skew optimization, if possible and there's a need for more
- * than one batch. (In a one-batch join, there's no point in it.)
+ * than one batch. (In a one-batch join, there's no point in it.)
*/
if (nbatch > 1)
ExecHashBuildSkewHash(hashtable, node, num_skew_mcvs);
@@ -446,14 +446,14 @@ ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew,
skew_table_bytes = hash_table_bytes * SKEW_WORK_MEM_PERCENT / 100;
*num_skew_mcvs = skew_table_bytes / (
- /* size of a hash tuple */
- tupsize +
- /* worst-case size of skewBucket[] per MCV */
- (8 * sizeof(HashSkewBucket *)) +
- /* size of skewBucketNums[] entry */
- sizeof(int) +
- /* size of skew bucket struct itself */
- SKEW_BUCKET_OVERHEAD
+ /* size of a hash tuple */
+ tupsize +
+ /* worst-case size of skewBucket[] per MCV */
+ (8 * sizeof(HashSkewBucket *)) +
+ /* size of skewBucketNums[] entry */
+ sizeof(int) +
+ /* size of skew bucket struct itself */
+ SKEW_BUCKET_OVERHEAD
);
if (*num_skew_mcvs > 0)
@@ -983,11 +983,11 @@ ExecReScanHash(HashState *node, ExprContext *exprCtxt)
static void
ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
{
- HeapTupleData *statsTuple;
- Datum *values;
- int nvalues;
- float4 *numbers;
- int nnumbers;
+ HeapTupleData *statsTuple;
+ Datum *values;
+ int nvalues;
+ float4 *numbers;
+ int nnumbers;
/* Do nothing if planner didn't identify the outer relation's join key */
if (!OidIsValid(node->skewTable))
@@ -1040,11 +1040,12 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
*
* skewBucket[] is an open addressing hashtable with a power of 2 size
* that is greater than the number of MCV values. (This ensures there
- * will be at least one null entry, so searches will always terminate.)
+ * will be at least one null entry, so searches will always
+ * terminate.)
*
- * Note: this code could fail if mcvsToUse exceeds INT_MAX/8, but
- * that is not currently possible since we limit pg_statistic entries
- * to much less than that.
+ * Note: this code could fail if mcvsToUse exceeds INT_MAX/8, but that
+ * is not currently possible since we limit pg_statistic entries to
+ * much less than that.
*/
nbuckets = 2;
while (nbuckets <= mcvsToUse)
@@ -1056,9 +1057,9 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
hashtable->skewBucketLen = nbuckets;
/*
- * We allocate the bucket memory in the hashtable's batch context.
- * It is only needed during the first batch, and this ensures it
- * will be automatically removed once the first batch is done.
+ * We allocate the bucket memory in the hashtable's batch context. It
+ * is only needed during the first batch, and this ensures it will be
+ * automatically removed once the first batch is done.
*/
hashtable->skewBucket = (HashSkewBucket **)
MemoryContextAllocZero(hashtable->batchCxt,
@@ -1075,18 +1076,18 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
/*
* Create a skew bucket for each MCV hash value.
*
- * Note: it is very important that we create the buckets in order
- * of decreasing MCV frequency. If we have to remove some buckets,
- * they must be removed in reverse order of creation (see notes in
- * ExecHashRemoveNextSkewBucket) and we want the least common MCVs
- * to be removed first.
+ * Note: it is very important that we create the buckets in order of
+ * decreasing MCV frequency. If we have to remove some buckets, they
+ * must be removed in reverse order of creation (see notes in
+ * ExecHashRemoveNextSkewBucket) and we want the least common MCVs to
+ * be removed first.
*/
hashfunctions = hashtable->outer_hashfunctions;
for (i = 0; i < mcvsToUse; i++)
{
- uint32 hashvalue;
- int bucket;
+ uint32 hashvalue;
+ int bucket;
hashvalue = DatumGetUInt32(FunctionCall1(&hashfunctions[0],
values[i]));
@@ -1094,7 +1095,7 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
/*
* While we have not hit a hole in the hashtable and have not hit
* the desired bucket, we have collided with some previous hash
- * value, so try the next bucket location. NB: this code must
+ * value, so try the next bucket location. NB: this code must
* match ExecHashGetSkewBucket.
*/
bucket = hashvalue & (nbuckets - 1);
@@ -1103,8 +1104,8 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
bucket = (bucket + 1) & (nbuckets - 1);
/*
- * If we found an existing bucket with the same hashvalue,
- * leave it alone. It's okay for two MCVs to share a hashvalue.
+ * If we found an existing bucket with the same hashvalue, leave
+ * it alone. It's okay for two MCVs to share a hashvalue.
*/
if (hashtable->skewBucket[bucket] != NULL)
continue;
@@ -1141,8 +1142,8 @@ ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue)
int bucket;
/*
- * Always return INVALID_SKEW_BUCKET_NO if not doing skew optimization
- * (in particular, this happens after the initial batch is done).
+ * Always return INVALID_SKEW_BUCKET_NO if not doing skew optimization (in
+ * particular, this happens after the initial batch is done).
*/
if (!hashtable->skewEnabled)
return INVALID_SKEW_BUCKET_NO;
@@ -1154,8 +1155,8 @@ ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue)
/*
* While we have not hit a hole in the hashtable and have not hit the
- * desired bucket, we have collided with some other hash value, so try
- * the next bucket location.
+ * desired bucket, we have collided with some other hash value, so try the
+ * next bucket location.
*/
while (hashtable->skewBucket[bucket] != NULL &&
hashtable->skewBucket[bucket]->hashvalue != hashvalue)
@@ -1222,11 +1223,11 @@ ExecHashSkewTableInsert(HashJoinTable hashtable,
static void
ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
{
- int bucketToRemove;
+ int bucketToRemove;
HashSkewBucket *bucket;
- uint32 hashvalue;
- int bucketno;
- int batchno;
+ uint32 hashvalue;
+ int bucketno;
+ int batchno;
HashJoinTuple hashTuple;
/* Locate the bucket to remove */
@@ -1236,8 +1237,8 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
/*
* Calculate which bucket and batch the tuples belong to in the main
* hashtable. They all have the same hash value, so it's the same for all
- * of them. Also note that it's not possible for nbatch to increase
- * while we are processing the tuples.
+ * of them. Also note that it's not possible for nbatch to increase while
+ * we are processing the tuples.
*/
hashvalue = bucket->hashvalue;
ExecHashGetBucketAndBatch(hashtable, hashvalue, &bucketno, &batchno);
@@ -1248,7 +1249,7 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
{
HashJoinTuple nextHashTuple = hashTuple->next;
MinimalTuple tuple;
- Size tupleSize;
+ Size tupleSize;
/*
* This code must agree with ExecHashTableInsert. We do not use
@@ -1286,12 +1287,12 @@ ExecHashRemoveNextSkewBucket(HashJoinTable hashtable)
*
* NOTE: this is not nearly as simple as it looks on the surface, because
* of the possibility of collisions in the hashtable. Suppose that hash
- * values A and B collide at a particular hashtable entry, and that A
- * was entered first so B gets shifted to a different table entry. If
- * we were to remove A first then ExecHashGetSkewBucket would mistakenly
- * start reporting that B is not in the hashtable, because it would hit
- * the NULL before finding B. However, we always remove entries in the
- * reverse order of creation, so this failure cannot happen.
+ * values A and B collide at a particular hashtable entry, and that A was
+ * entered first so B gets shifted to a different table entry. If we were
+ * to remove A first then ExecHashGetSkewBucket would mistakenly start
+ * reporting that B is not in the hashtable, because it would hit the NULL
+ * before finding B. However, we always remove entries in the reverse
+ * order of creation, so this failure cannot happen.
*/
hashtable->skewBucket[bucketToRemove] = NULL;
hashtable->nSkewBuckets--;
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index c7a0576291..bfb07472b0 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.100 2009/04/02 20:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.101 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,7 +23,7 @@
/* Returns true for JOIN_LEFT and JOIN_ANTI jointypes */
-#define HASHJOIN_IS_OUTER(hjstate) ((hjstate)->hj_NullInnerTupleSlot != NULL)
+#define HASHJOIN_IS_OUTER(hjstate) ((hjstate)->hj_NullInnerTupleSlot != NULL)
static TupleTableSlot *ExecHashJoinOuterGetTuple(PlanState *outerNode,
HashJoinState *hjstate,
@@ -210,8 +210,8 @@ ExecHashJoin(HashJoinState *node)
/*
* Now we've got an outer tuple and the corresponding hash bucket,
- * but it might not belong to the current batch, or it might
- * match a skew bucket.
+ * but it might not belong to the current batch, or it might match
+ * a skew bucket.
*/
if (batchno != hashtable->curbatch &&
node->hj_CurSkewBucketNo == INVALID_SKEW_BUCKET_NO)
@@ -656,13 +656,13 @@ start_over:
BufFileClose(hashtable->outerBatchFile[curbatch]);
hashtable->outerBatchFile[curbatch] = NULL;
}
- else /* we just finished the first batch */
+ else /* we just finished the first batch */
{
/*
- * Reset some of the skew optimization state variables, since we
- * no longer need to consider skew tuples after the first batch.
- * The memory context reset we are about to do will release the
- * skew hashtable itself.
+ * Reset some of the skew optimization state variables, since we no
+ * longer need to consider skew tuples after the first batch. The
+ * memory context reset we are about to do will release the skew
+ * hashtable itself.
*/
hashtable->skewEnabled = false;
hashtable->skewBucket = NULL;
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index f440da756a..d0f1899fca 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.131 2009/01/01 17:23:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.132 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -367,8 +367,8 @@ ExecIndexAdvanceArrayKeys(IndexArrayKeyInfo *arrayKeys, int numArrayKeys)
/*
* Note we advance the rightmost array key most quickly, since it will
* correspond to the lowest-order index column among the available
- * qualifications. This is hypothesized to result in better locality
- * of access in the index.
+ * qualifications. This is hypothesized to result in better locality of
+ * access in the index.
*/
for (j = numArrayKeys - 1; j >= 0; j--)
{
@@ -716,8 +716,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid,
extra_scan_keys = n_scan_keys;
/*
- * for each opclause in the given qual, convert the opclause into
- * a single scan key
+ * for each opclause in the given qual, convert the opclause into a single
+ * scan key
*/
j = 0;
foreach(qual_cell, quals)
@@ -727,8 +727,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid,
Oid opno; /* operator's OID */
RegProcedure opfuncid; /* operator proc id used in scan */
Oid opfamily; /* opfamily of index column */
- int op_strategy; /* operator's strategy number */
- Oid op_lefttype; /* operator's declared input types */
+ int op_strategy; /* operator's strategy number */
+ Oid op_lefttype; /* operator's declared input types */
Oid op_righttype;
Expr *leftop; /* expr on lhs of operator */
Expr *rightop; /* expr on rhs ... */
@@ -805,8 +805,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid,
ScanKeyEntryInitialize(this_scan_key,
flags,
varattno, /* attribute number to scan */
- op_strategy, /* op's strategy */
- op_righttype, /* strategy subtype */
+ op_strategy, /* op's strategy */
+ op_righttype, /* strategy subtype */
opfuncid, /* reg proc to use */
scanvalue); /* constant */
}
@@ -983,8 +983,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid,
ScanKeyEntryInitialize(this_scan_key,
0, /* flags */
varattno, /* attribute number to scan */
- op_strategy, /* op's strategy */
- op_righttype, /* strategy subtype */
+ op_strategy, /* op's strategy */
+ op_righttype, /* strategy subtype */
opfuncid, /* reg proc to use */
(Datum) 0); /* constant */
}
@@ -1015,7 +1015,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index, Index scanrelid,
ScanKeyEntryInitialize(this_scan_key,
SK_ISNULL | SK_SEARCHNULL,
varattno, /* attribute number to scan */
- InvalidStrategy, /* no strategy */
+ InvalidStrategy, /* no strategy */
InvalidOid, /* no 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 f7c1c7acdc..0626b8be37 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.38 2009/04/02 20:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.39 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -247,8 +247,8 @@ recompute_limits(LimitState *node)
node->offset = DatumGetInt64(val);
if (node->offset < 0)
ereport(ERROR,
- (errcode(ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE),
- errmsg("OFFSET must not be negative")));
+ (errcode(ERRCODE_INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE),
+ errmsg("OFFSET must not be negative")));
}
}
else
diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c
index 9282bf130d..817a7e7824 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.68 2009/04/02 20:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.69 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,10 +63,10 @@ ExecMaterial(MaterialState *node)
if (node->eflags & EXEC_FLAG_MARK)
{
/*
- * Allocate a second read pointer to serve as the mark.
- * We know it must have index 1, so needn't store that.
+ * Allocate a second read pointer to serve as the mark. We know it
+ * must have index 1, so needn't store that.
*/
- int ptrno;
+ int ptrno;
ptrno = tuplestore_alloc_read_pointer(tuplestorestate,
node->eflags);
@@ -185,7 +185,7 @@ ExecInitMaterial(Material *node, EState *estate, int eflags)
/*
* Tuplestore's interpretation of the flag bits is subtly different from
* the general executor meaning: it doesn't think BACKWARD necessarily
- * means "backwards all the way to start". If told to support BACKWARD we
+ * means "backwards all the way to start". If told to support BACKWARD we
* must include REWIND in the tuplestore eflags, else tuplestore_trim
* might throw away too much.
*/
diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c
index 52bdf3bfe5..3b9bcb7d56 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.96 2009/04/02 20:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.97 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -774,8 +774,8 @@ ExecMergeJoin(MergeJoinState *node)
}
/*
- * In a semijoin, we'll consider returning the first match,
- * but after that we're done with this outer tuple.
+ * In a semijoin, we'll consider returning the first
+ * match, but after that we're done with this outer tuple.
*/
if (node->js.jointype == JOIN_SEMI)
node->mj_JoinState = EXEC_MJ_NEXTOUTER;
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index 93f7e81e67..338ee07e62 100644
--- a/src/backend/executor/nodeNestloop.c
+++ b/src/backend/executor/nodeNestloop.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.52 2009/04/02 20:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.53 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -225,8 +225,8 @@ ExecNestLoop(NestLoopState *node)
}
/*
- * In a semijoin, we'll consider returning the first match,
- * but after that we're done with this outer tuple.
+ * In a semijoin, we'll consider returning the first match, but
+ * after that we're done with this outer tuple.
*/
if (node->js.jointype == JOIN_SEMI)
node->nl_NeedNewOuter = true;
diff --git a/src/backend/executor/nodeRecursiveunion.c b/src/backend/executor/nodeRecursiveunion.c
index 4c674d0315..39b687f221 100644
--- a/src/backend/executor/nodeRecursiveunion.c
+++ b/src/backend/executor/nodeRecursiveunion.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeRecursiveunion.c,v 1.3 2009/01/01 17:23:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeRecursiveunion.c,v 1.4 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,7 @@ typedef struct RUHashEntryData
static void
build_hash_table(RecursiveUnionState *rustate)
{
- RecursiveUnion *node = (RecursiveUnion *) rustate->ps.plan;
+ RecursiveUnion *node = (RecursiveUnion *) rustate->ps.plan;
Assert(node->numCols > 0);
Assert(node->numGroups > 0);
@@ -58,7 +58,7 @@ build_hash_table(RecursiveUnionState *rustate)
* ExecRecursiveUnion(node)
*
* Scans the recursive query sequentially and returns the next
- * qualifying tuple.
+ * qualifying tuple.
*
* 1. evaluate non recursive term and assign the result to RT
*
@@ -151,8 +151,8 @@ ExecRecursiveUnion(RecursiveUnionState *node)
}
/* Else, tuple is good; stash it in intermediate table ... */
- node->intermediate_empty = false;
- tuplestore_puttupleslot(node->intermediate_table, slot);
+ node->intermediate_empty = false;
+ tuplestore_puttupleslot(node->intermediate_table, slot);
/* ... and return it */
return slot;
}
@@ -240,8 +240,8 @@ ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags)
ExecInitResultTupleSlot(estate, &rustate->ps);
/*
- * Initialize result tuple type and projection info. (Note: we have
- * to set up the result type before initializing child nodes, because
+ * Initialize result tuple type and projection info. (Note: we have to
+ * set up the result type before initializing child nodes, because
* nodeWorktablescan.c expects it to be valid.)
*/
ExecAssignResultTypeFromTL(&rustate->ps);
@@ -254,8 +254,8 @@ ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags)
innerPlanState(rustate) = ExecInitNode(innerPlan(node), estate, eflags);
/*
- * If hashing, precompute fmgr lookup data for inner loop, and create
- * the hash table.
+ * If hashing, precompute fmgr lookup data for inner loop, and create the
+ * hash table.
*/
if (node->numCols > 0)
{
@@ -322,15 +322,15 @@ ExecRecursiveUnionReScan(RecursiveUnionState *node, ExprContext *exprCtxt)
RecursiveUnion *plan = (RecursiveUnion *) node->ps.plan;
/*
- * Set recursive term's chgParam to tell it that we'll modify the
- * working table and therefore it has to rescan.
+ * Set recursive term's chgParam to tell it that we'll modify the working
+ * table and therefore it has to rescan.
*/
innerPlan->chgParam = bms_add_member(innerPlan->chgParam, plan->wtParam);
/*
* if chgParam of subnode is not null then plan will be re-scanned by
- * first ExecProcNode. Because of above, we only have to do this to
- * the non-recursive term.
+ * first ExecProcNode. Because of above, we only have to do this to the
+ * non-recursive term.
*/
if (outerPlan->chgParam == NULL)
ExecReScan(outerPlan, exprCtxt);
diff --git a/src/backend/executor/nodeSetOp.c b/src/backend/executor/nodeSetOp.c
index 3611ae7ddc..cff155abe6 100644
--- a/src/backend/executor/nodeSetOp.c
+++ b/src/backend/executor/nodeSetOp.c
@@ -5,7 +5,7 @@
*
* The input of a SetOp node consists of tuples from two relations,
* which have been combined into one dataset, with a junk attribute added
- * that shows which relation each tuple came from. In SETOP_SORTED mode,
+ * that shows which relation each tuple came from. In SETOP_SORTED mode,
* the input has furthermore been sorted according to all the grouping
* columns (ie, all the non-junk attributes). The SetOp node scans each
* group of identical tuples to determine how many came from each input
@@ -18,7 +18,7 @@
* relation is the left-hand one for EXCEPT, and tries to make the smaller
* input relation come first for INTERSECT. We build a hash table in memory
* with one entry for each group of identical tuples, and count the number of
- * tuples in the group from each relation. After seeing all the input, we
+ * tuples in the group from each relation. After seeing all the input, we
* scan the hashtable and generate the correct output using those counts.
* We can avoid making hashtable entries for any tuples appearing only in the
* second input relation, since they cannot result in any output.
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeSetOp.c,v 1.30 2009/04/02 20:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeSetOp.c,v 1.31 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -266,15 +266,15 @@ setop_retrieve_direct(SetOpState *setopstate)
}
/*
- * Store the copied first input tuple in the tuple table slot
- * reserved for it. The tuple will be deleted when it is cleared
- * from the slot.
+ * Store the copied first input tuple in the tuple table slot reserved
+ * for it. The tuple will be deleted when it is cleared from the
+ * slot.
*/
ExecStoreTuple(setopstate->grp_firstTuple,
resultTupleSlot,
InvalidBuffer,
true);
- setopstate->grp_firstTuple = NULL; /* don't keep two pointers */
+ setopstate->grp_firstTuple = NULL; /* don't keep two pointers */
/* Initialize working state for a new input tuple group */
initialize_counts(pergroup);
@@ -318,8 +318,8 @@ setop_retrieve_direct(SetOpState *setopstate)
}
/*
- * Done scanning input tuple group. See if we should emit any
- * copies of result tuple, and if so return the first copy.
+ * Done scanning input tuple group. See if we should emit any copies
+ * of result tuple, and if so return the first copy.
*/
set_output_count(setopstate, pergroup);
@@ -533,8 +533,8 @@ ExecInitSetOp(SetOp *node, EState *estate, int eflags)
/*
* initialize child nodes
*
- * If we are hashing then the child plan does not need
- * to handle REWIND efficiently; see ExecReScanSetOp.
+ * If we are hashing then the child plan does not need to handle REWIND
+ * efficiently; see ExecReScanSetOp.
*/
if (node->strategy == SETOP_HASHED)
eflags &= ~EXEC_FLAG_REWIND;
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index ed00ba33e7..016dbc378b 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.98 2009/04/02 20:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.99 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,9 +34,9 @@ static Datum ExecSubPlan(SubPlanState *node,
bool *isNull,
ExprDoneCond *isDone);
static Datum ExecAlternativeSubPlan(AlternativeSubPlanState *node,
- ExprContext *econtext,
- bool *isNull,
- ExprDoneCond *isDone);
+ ExprContext *econtext,
+ bool *isNull,
+ ExprDoneCond *isDone);
static Datum ExecHashSubPlan(SubPlanState *node,
ExprContext *econtext,
bool *isNull);
@@ -1073,8 +1073,8 @@ ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent)
*
* CTE subplans are never executed via parameter recalculation; instead
* they get run when called by nodeCtescan.c. So don't mark the output
- * parameter of a CTE subplan as dirty, but do set the chgParam bit
- * for it so that dependent plan nodes will get told to rescan.
+ * parameter of a CTE subplan as dirty, but do set the chgParam bit for it
+ * so that dependent plan nodes will get told to rescan.
*/
foreach(l, subplan->setParam)
{
@@ -1099,8 +1099,8 @@ ExecInitAlternativeSubPlan(AlternativeSubPlan *asplan, PlanState *parent)
{
AlternativeSubPlanState *asstate = makeNode(AlternativeSubPlanState);
double num_calls;
- SubPlan *subplan1;
- SubPlan *subplan2;
+ SubPlan *subplan1;
+ SubPlan *subplan2;
Cost cost1;
Cost cost2;
@@ -1108,18 +1108,18 @@ ExecInitAlternativeSubPlan(AlternativeSubPlan *asplan, PlanState *parent)
asstate->xprstate.expr = (Expr *) asplan;
/*
- * Initialize subplans. (Can we get away with only initializing the
- * one we're going to use?)
+ * Initialize subplans. (Can we get away with only initializing the one
+ * we're going to use?)
*/
asstate->subplans = (List *) ExecInitExpr((Expr *) asplan->subplans,
parent);
/*
- * Select the one to be used. For this, we need an estimate of the
- * number of executions of the subplan. We use the number of output
- * rows expected from the parent plan node. This is a good estimate
- * if we are in the parent's targetlist, and an underestimate (but
- * probably not by more than a factor of 2) if we are in the qual.
+ * Select the one to be used. For this, we need an estimate of the number
+ * of executions of the subplan. We use the number of output rows
+ * expected from the parent plan node. This is a good estimate if we are
+ * in the parent's targetlist, and an underestimate (but probably not by
+ * more than a factor of 2) if we are in the qual.
*/
num_calls = parent->plan->plan_rows;
@@ -1157,8 +1157,8 @@ ExecAlternativeSubPlan(AlternativeSubPlanState *node,
ExprDoneCond *isDone)
{
/* Just pass control to the active subplan */
- SubPlanState *activesp = (SubPlanState *) list_nth(node->subplans,
- node->active);
+ SubPlanState *activesp = (SubPlanState *) list_nth(node->subplans,
+ node->active);
Assert(IsA(activesp, SubPlanState));
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index c0132c943f..1a7c5a7aa7 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.61 2009/01/01 17:23:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.62 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,10 +63,10 @@ TidListCreate(TidScanState *tidstate)
ListCell *l;
/*
- * We silently discard any TIDs that are out of range at the time of
- * scan start. (Since we hold at least AccessShareLock on the table,
- * it won't be possible for someone to truncate away the blocks we
- * intend to visit.)
+ * We silently discard any TIDs that are out of range at the time of scan
+ * start. (Since we hold at least AccessShareLock on the table, it won't
+ * be possible for someone to truncate away the blocks we intend to
+ * visit.)
*/
nblocks = RelationGetNumberOfBlocks(tidstate->ss.ss_currentRelation);
diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c
index b3c256923d..8878e6ede9 100644
--- a/src/backend/executor/nodeUnique.c
+++ b/src/backend/executor/nodeUnique.c
@@ -4,7 +4,7 @@
* Routines to handle unique'ing of queries where appropriate
*
* Unique is a very simple node type that just filters out duplicate
- * tuples from a stream of sorted tuples from its subplan. It's essentially
+ * tuples from a stream of sorted tuples from its subplan. It's essentially
* a dumbed-down form of Group: the duplicate-removal functionality is
* identical. However, Unique doesn't do projection nor qual checking,
* so it's marginally more efficient for cases where neither is needed.
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.60 2009/04/02 20:59:10 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeUnique.c,v 1.61 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,8 +58,8 @@ ExecUnique(UniqueState *node)
/*
* now loop, returning only non-duplicate tuples. We assume that the
- * tuples arrive in sorted order so we can detect duplicates easily.
- * The first tuple of each group is returned.
+ * tuples arrive in sorted order so we can detect duplicates easily. The
+ * first tuple of each group is returned.
*/
for (;;)
{
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index 263cb0a78c..0d9eb21a91 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -4,7 +4,7 @@
* routines to handle WindowAgg nodes.
*
* A WindowAgg node evaluates "window functions" across suitable partitions
- * of the input tuple set. Any one WindowAgg works for just a single window
+ * of the input tuple set. Any one WindowAgg works for just a single window
* specification, though it can evaluate multiple window functions sharing
* identical window specifications. The input tuples are required to be
* delivered in sorted order, with the PARTITION BY columns (if any) as
@@ -14,7 +14,7 @@
*
* Since window functions can require access to any or all of the rows in
* the current partition, we accumulate rows of the partition into a
- * tuplestore. The window functions are called using the WindowObject API
+ * tuplestore. The window functions are called using the WindowObject API
* so that they can access those rows as needed.
*
* We also support using plain aggregate functions as window functions.
@@ -27,7 +27,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeWindowAgg.c,v 1.4 2009/03/27 18:30:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeWindowAgg.c,v 1.5 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -75,15 +75,15 @@ typedef struct WindowStatePerFuncData
{
/* Links to WindowFunc expr and state nodes this working state is for */
WindowFuncExprState *wfuncstate;
- WindowFunc *wfunc;
+ WindowFunc *wfunc;
int numArguments; /* number of arguments */
FmgrInfo flinfo; /* fmgr lookup data for window function */
/*
- * We need the len and byval info for the result of each function
- * in order to know how to copy/delete values.
+ * We need the len and byval info for the result of each function in order
+ * to know how to copy/delete values.
*/
int16 resulttypeLen;
bool resulttypeByVal;
@@ -91,7 +91,7 @@ typedef struct WindowStatePerFuncData
bool plain_agg; /* is it just a plain aggregate function? */
int aggno; /* if so, index of its PerAggData */
- WindowObject winobj; /* object used in window function API */
+ WindowObject winobj; /* object used in window function API */
} WindowStatePerFuncData;
/*
@@ -144,38 +144,38 @@ typedef struct WindowStatePerAggData
} WindowStatePerAggData;
static void initialize_windowaggregate(WindowAggState *winstate,
- WindowStatePerFunc perfuncstate,
- WindowStatePerAgg peraggstate);
+ WindowStatePerFunc perfuncstate,
+ WindowStatePerAgg peraggstate);
static void advance_windowaggregate(WindowAggState *winstate,
- WindowStatePerFunc perfuncstate,
- WindowStatePerAgg peraggstate);
+ WindowStatePerFunc perfuncstate,
+ WindowStatePerAgg peraggstate);
static void finalize_windowaggregate(WindowAggState *winstate,
- WindowStatePerFunc perfuncstate,
- WindowStatePerAgg peraggstate,
- Datum *result, bool *isnull);
+ WindowStatePerFunc perfuncstate,
+ WindowStatePerAgg peraggstate,
+ Datum *result, bool *isnull);
static void eval_windowaggregates(WindowAggState *winstate);
static void eval_windowfunction(WindowAggState *winstate,
- WindowStatePerFunc perfuncstate,
- Datum *result, bool *isnull);
+ WindowStatePerFunc perfuncstate,
+ Datum *result, bool *isnull);
static void begin_partition(WindowAggState *winstate);
static void spool_tuples(WindowAggState *winstate, int64 pos);
static void release_partition(WindowAggState *winstate);
static bool row_is_in_frame(WindowAggState *winstate, int64 pos,
- TupleTableSlot *slot);
+ TupleTableSlot *slot);
static void update_frametailpos(WindowObject winobj, TupleTableSlot *slot);
static WindowStatePerAggData *initialize_peragg(WindowAggState *winstate,
- WindowFunc *wfunc,
- WindowStatePerAgg peraggstate);
+ WindowFunc *wfunc,
+ WindowStatePerAgg peraggstate);
static Datum GetAggInitVal(Datum textInitVal, Oid transtype);
static bool are_peers(WindowAggState *winstate, TupleTableSlot *slot1,
- TupleTableSlot *slot2);
+ TupleTableSlot *slot2);
static bool window_gettupleslot(WindowObject winobj, int64 pos,
- TupleTableSlot *slot);
+ TupleTableSlot *slot);
/*
@@ -187,7 +187,7 @@ initialize_windowaggregate(WindowAggState *winstate,
WindowStatePerFunc perfuncstate,
WindowStatePerAgg peraggstate)
{
- MemoryContext oldContext;
+ MemoryContext oldContext;
if (peraggstate->initValueIsNull)
peraggstate->transValue = peraggstate->initValue;
@@ -213,14 +213,14 @@ advance_windowaggregate(WindowAggState *winstate,
WindowStatePerFunc perfuncstate,
WindowStatePerAgg peraggstate)
{
- WindowFuncExprState *wfuncstate = perfuncstate->wfuncstate;
- int numArguments = perfuncstate->numArguments;
- FunctionCallInfoData fcinfodata;
- FunctionCallInfo fcinfo = &fcinfodata;
- Datum newVal;
- ListCell *arg;
- int i;
- MemoryContext oldContext;
+ WindowFuncExprState *wfuncstate = perfuncstate->wfuncstate;
+ int numArguments = perfuncstate->numArguments;
+ FunctionCallInfoData fcinfodata;
+ FunctionCallInfo fcinfo = &fcinfodata;
+ Datum newVal;
+ ListCell *arg;
+ int i;
+ MemoryContext oldContext;
ExprContext *econtext = winstate->tmpcontext;
oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
@@ -229,7 +229,7 @@ advance_windowaggregate(WindowAggState *winstate,
i = 1;
foreach(arg, wfuncstate->args)
{
- ExprState *argstate = (ExprState *) lfirst(arg);
+ ExprState *argstate = (ExprState *) lfirst(arg);
fcinfo->arg[i] = ExecEvalExpr(argstate, econtext,
&fcinfo->argnull[i], NULL);
@@ -263,8 +263,8 @@ advance_windowaggregate(WindowAggState *winstate,
*/
MemoryContextSwitchTo(winstate->wincontext);
peraggstate->transValue = datumCopy(fcinfo->arg[1],
- peraggstate->transtypeByVal,
- peraggstate->transtypeLen);
+ peraggstate->transtypeByVal,
+ peraggstate->transtypeLen);
peraggstate->transValueIsNull = false;
peraggstate->noTransValue = false;
MemoryContextSwitchTo(oldContext);
@@ -327,7 +327,7 @@ finalize_windowaggregate(WindowAggState *winstate,
WindowStatePerAgg peraggstate,
Datum *result, bool *isnull)
{
- MemoryContext oldContext;
+ MemoryContext oldContext;
oldContext = MemoryContextSwitchTo(winstate->ss.ps.ps_ExprContext->ecxt_per_tuple_memory);
@@ -336,7 +336,7 @@ finalize_windowaggregate(WindowAggState *winstate,
*/
if (OidIsValid(peraggstate->finalfn_oid))
{
- FunctionCallInfoData fcinfo;
+ FunctionCallInfoData fcinfo;
InitFunctionCallInfoData(fcinfo, &(peraggstate->finalfn), 1,
(void *) winstate, NULL);
@@ -384,12 +384,13 @@ finalize_windowaggregate(WindowAggState *winstate,
static void
eval_windowaggregates(WindowAggState *winstate)
{
- WindowStatePerAgg peraggstate;
- int wfuncno, numaggs;
- int i;
- MemoryContext oldContext;
- ExprContext *econtext;
- TupleTableSlot *agg_row_slot;
+ WindowStatePerAgg peraggstate;
+ int wfuncno,
+ numaggs;
+ int i;
+ MemoryContext oldContext;
+ ExprContext *econtext;
+ TupleTableSlot *agg_row_slot;
numaggs = winstate->numaggs;
if (numaggs == 0)
@@ -400,44 +401,43 @@ eval_windowaggregates(WindowAggState *winstate)
/*
* Currently, we support only a subset of the SQL-standard window framing
- * rules. In all the supported cases, the window frame always consists
- * of a contiguous group of rows extending forward from the start of the
- * partition, and rows only enter the frame, never exit it, as the
- * current row advances forward. This makes it possible to use an
- * incremental strategy for evaluating aggregates: we run the transition
- * function for each row added to the frame, and run the final function
- * whenever we need the current aggregate value. This is considerably
- * more efficient than the naive approach of re-running the entire
- * aggregate calculation for each current row. It does assume that the
- * final function doesn't damage the running transition value. (Some
- * C-coded aggregates do that for efficiency's sake --- but they are
- * supposed to do so only when their fcinfo->context is an AggState, not
- * a WindowAggState.)
+ * rules. In all the supported cases, the window frame always consists of
+ * a contiguous group of rows extending forward from the start of the
+ * partition, and rows only enter the frame, never exit it, as the current
+ * row advances forward. This makes it possible to use an incremental
+ * strategy for evaluating aggregates: we run the transition function for
+ * each row added to the frame, and run the final function whenever we
+ * need the current aggregate value. This is considerably more efficient
+ * than the naive approach of re-running the entire aggregate calculation
+ * for each current row. It does assume that the final function doesn't
+ * damage the running transition value. (Some C-coded aggregates do that
+ * for efficiency's sake --- but they are supposed to do so only when
+ * their fcinfo->context is an AggState, not a WindowAggState.)
*
- * In many common cases, multiple rows share the same frame and hence
- * the same aggregate value. (In particular, if there's no ORDER BY in
- * a RANGE window, then all rows are peers and so they all have window
- * frame equal to the whole partition.) We optimize such cases by
- * calculating the aggregate value once when we reach the first row of a
- * peer group, and then returning the saved value for all subsequent rows.
+ * In many common cases, multiple rows share the same frame and hence the
+ * same aggregate value. (In particular, if there's no ORDER BY in a RANGE
+ * window, then all rows are peers and so they all have window frame equal
+ * to the whole partition.) We optimize such cases by calculating the
+ * aggregate value once when we reach the first row of a peer group, and
+ * then returning the saved value for all subsequent rows.
*
* 'aggregatedupto' keeps track of the first row that has not yet been
* accumulated into the aggregate transition values. Whenever we start a
* new peer group, we accumulate forward to the end of the peer group.
*
- * TODO: In the future, we should implement the full SQL-standard set
- * of framing rules. We could implement the other cases by recalculating
- * the aggregates whenever a row exits the frame. That would be pretty
- * slow, though. For aggregates like SUM and COUNT we could implement a
+ * TODO: In the future, we should implement the full SQL-standard set of
+ * framing rules. We could implement the other cases by recalculating the
+ * aggregates whenever a row exits the frame. That would be pretty slow,
+ * though. For aggregates like SUM and COUNT we could implement a
* "negative transition function" that would be called for each row as it
* exits the frame. We'd have to think about avoiding recalculation of
* volatile arguments of aggregate functions, too.
*/
/*
- * If we've already aggregated up through current row, reuse the
- * saved result values. NOTE: this test works for the currently
- * supported framing rules, but will need fixing when more are added.
+ * If we've already aggregated up through current row, reuse the saved
+ * result values. NOTE: this test works for the currently supported
+ * framing rules, but will need fixing when more are added.
*/
if (winstate->aggregatedupto > winstate->currentpos)
{
@@ -467,9 +467,9 @@ eval_windowaggregates(WindowAggState *winstate)
/*
* Advance until we reach a row not in frame (or end of partition).
*
- * Note the loop invariant: agg_row_slot is either empty or holds the
- * row at position aggregatedupto. The agg_ptr read pointer must always
- * point to the next row to read into agg_row_slot.
+ * Note the loop invariant: agg_row_slot is either empty or holds the row
+ * at position aggregatedupto. The agg_ptr read pointer must always point
+ * to the next row to read into agg_row_slot.
*/
agg_row_slot = winstate->agg_row_slot;
for (;;)
@@ -530,16 +530,16 @@ eval_windowaggregates(WindowAggState *winstate)
/*
* save the result in case next row shares the same frame.
*
- * XXX in some framing modes, eg ROWS/END_CURRENT_ROW, we can know
- * in advance that the next row can't possibly share the same frame.
- * Is it worth detecting that and skipping this code?
+ * XXX in some framing modes, eg ROWS/END_CURRENT_ROW, we can know in
+ * advance that the next row can't possibly share the same frame. Is
+ * it worth detecting that and skipping this code?
*/
if (!peraggstate->resulttypeByVal)
{
/*
- * clear old resultValue in order not to leak memory. (Note:
- * the new result can't possibly be the same datum as old
- * resultValue, because we never passed it to the trans function.)
+ * clear old resultValue in order not to leak memory. (Note: the
+ * new result can't possibly be the same datum as old resultValue,
+ * because we never passed it to the trans function.)
*/
if (!peraggstate->resultValueIsNull)
pfree(DatumGetPointer(peraggstate->resultValue));
@@ -579,15 +579,15 @@ eval_windowfunction(WindowAggState *winstate, WindowStatePerFunc perfuncstate,
Datum *result, bool *isnull)
{
FunctionCallInfoData fcinfo;
- MemoryContext oldContext;
+ MemoryContext oldContext;
oldContext = MemoryContextSwitchTo(winstate->ss.ps.ps_ExprContext->ecxt_per_tuple_memory);
/*
- * We don't pass any normal arguments to a window function, but we do
- * pass it the number of arguments, in order to permit window function
- * implementations to support varying numbers of arguments. The real
- * info goes through the WindowObject, which is passed via fcinfo->context.
+ * We don't pass any normal arguments to a window function, but we do pass
+ * it the number of arguments, in order to permit window function
+ * implementations to support varying numbers of arguments. The real info
+ * goes through the WindowObject, which is passed via fcinfo->context.
*/
InitFunctionCallInfoData(fcinfo, &(perfuncstate->flinfo),
perfuncstate->numArguments,
@@ -599,9 +599,9 @@ eval_windowfunction(WindowAggState *winstate, WindowStatePerFunc perfuncstate,
*isnull = fcinfo.isnull;
/*
- * Make sure pass-by-ref data is allocated in the appropriate context.
- * (We need this in case the function returns a pointer into some
- * short-lived tuple, as is entirely possible.)
+ * Make sure pass-by-ref data is allocated in the appropriate context. (We
+ * need this in case the function returns a pointer into some short-lived
+ * tuple, as is entirely possible.)
*/
if (!perfuncstate->resulttypeByVal && !fcinfo.isnull &&
!MemoryContextContains(CurrentMemoryContext,
@@ -620,9 +620,9 @@ eval_windowfunction(WindowAggState *winstate, WindowStatePerFunc perfuncstate,
static void
begin_partition(WindowAggState *winstate)
{
- PlanState *outerPlan = outerPlanState(winstate);
- int numfuncs = winstate->numfuncs;
- int i;
+ PlanState *outerPlan = outerPlanState(winstate);
+ int numfuncs = winstate->numfuncs;
+ int i;
winstate->partition_spooled = false;
winstate->frametail_valid = false;
@@ -633,15 +633,15 @@ begin_partition(WindowAggState *winstate)
ExecClearTuple(winstate->agg_row_slot);
/*
- * If this is the very first partition, we need to fetch the first
- * input row to store in first_part_slot.
+ * If this is the very first partition, we need to fetch the first input
+ * row to store in first_part_slot.
*/
if (TupIsNull(winstate->first_part_slot))
{
TupleTableSlot *outerslot = ExecProcNode(outerPlan);
if (!TupIsNull(outerslot))
- ExecCopySlot(winstate->first_part_slot, outerslot);
+ ExecCopySlot(winstate->first_part_slot, outerslot);
else
{
/* outer plan is empty, so we have nothing to do */
@@ -671,16 +671,16 @@ begin_partition(WindowAggState *winstate)
/* create mark and read pointers for each real window function */
for (i = 0; i < numfuncs; i++)
{
- WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]);
+ WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]);
if (!perfuncstate->plain_agg)
{
- WindowObject winobj = perfuncstate->winobj;
+ WindowObject winobj = perfuncstate->winobj;
winobj->markptr = tuplestore_alloc_read_pointer(winstate->buffer,
0);
winobj->readptr = tuplestore_alloc_read_pointer(winstate->buffer,
- EXEC_FLAG_BACKWARD);
+ EXEC_FLAG_BACKWARD);
winobj->markpos = -1;
winobj->seekpos = -1;
}
@@ -701,8 +701,8 @@ begin_partition(WindowAggState *winstate)
static void
spool_tuples(WindowAggState *winstate, int64 pos)
{
- WindowAgg *node = (WindowAgg *) winstate->ss.ps.plan;
- PlanState *outerPlan;
+ WindowAgg *node = (WindowAgg *) winstate->ss.ps.plan;
+ PlanState *outerPlan;
TupleTableSlot *outerslot;
MemoryContext oldcontext;
@@ -713,7 +713,7 @@ spool_tuples(WindowAggState *winstate, int64 pos)
/*
* If the tuplestore has spilled to disk, alternate reading and writing
- * becomes quite expensive due to frequent buffer flushes. It's cheaper
+ * becomes quite expensive due to frequent buffer flushes. It's cheaper
* to force the entire partition to get spooled in one go.
*
* XXX this is a horrid kluge --- it'd be better to fix the performance
@@ -773,11 +773,11 @@ spool_tuples(WindowAggState *winstate, int64 pos)
static void
release_partition(WindowAggState *winstate)
{
- int i;
+ int i;
for (i = 0; i < winstate->numfuncs; i++)
{
- WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]);
+ WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]);
/* Release any partition-local state of this window function */
if (perfuncstate->winobj)
@@ -804,7 +804,7 @@ release_partition(WindowAggState *winstate)
* to our window framing rule
*
* The caller must have already determined that the row is in the partition
- * and fetched it into a slot. This function just encapsulates the framing
+ * and fetched it into a slot. This function just encapsulates the framing
* rules.
*/
static bool
@@ -895,8 +895,8 @@ update_frametailpos(WindowObject winobj, TupleTableSlot *slot)
}
/*
- * Else we have to search for the first non-peer of the current row.
- * We assume the current value of frametailpos is a lower bound on the
+ * Else we have to search for the first non-peer of the current row. We
+ * assume the current value of frametailpos is a lower bound on the
* possible frame tail location, ie, frame tail never goes backward, and
* that currentpos is also a lower bound, ie, current row is always in
* frame.
@@ -929,18 +929,18 @@ TupleTableSlot *
ExecWindowAgg(WindowAggState *winstate)
{
TupleTableSlot *result;
- ExprDoneCond isDone;
- ExprContext *econtext;
- int i;
- int numfuncs;
+ ExprDoneCond isDone;
+ ExprContext *econtext;
+ int i;
+ int numfuncs;
if (winstate->all_done)
return NULL;
/*
- * Check to see if we're still projecting out tuples from a previous output
- * tuple (because there is a function-returning-set in the projection
- * expressions). If so, try to project another one.
+ * Check to see if we're still projecting out tuples from a previous
+ * output tuple (because there is a function-returning-set in the
+ * projection expressions). If so, try to project another one.
*/
if (winstate->ss.ps.ps_TupFromTlist)
{
@@ -1003,8 +1003,8 @@ restart:
* Read the current row from the tuplestore, and save in ScanTupleSlot.
* (We can't rely on the outerplan's output slot because we may have to
* read beyond the current row. Also, we have to actually copy the row
- * out of the tuplestore, since window function evaluation might cause
- * the tuplestore to dump its state to disk.)
+ * out of the tuplestore, since window function evaluation might cause the
+ * tuplestore to dump its state to disk.)
*
* Current row must be in the tuplestore, since we spooled it above.
*/
@@ -1019,13 +1019,13 @@ restart:
numfuncs = winstate->numfuncs;
for (i = 0; i < numfuncs; i++)
{
- WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]);
+ WindowStatePerFunc perfuncstate = &(winstate->perfunc[i]);
if (perfuncstate->plain_agg)
continue;
eval_windowfunction(winstate, perfuncstate,
- &(econtext->ecxt_aggvalues[perfuncstate->wfuncstate->wfuncno]),
- &(econtext->ecxt_aggnulls[perfuncstate->wfuncstate->wfuncno]));
+ &(econtext->ecxt_aggvalues[perfuncstate->wfuncstate->wfuncno]),
+ &(econtext->ecxt_aggnulls[perfuncstate->wfuncstate->wfuncno]));
}
/*
@@ -1040,9 +1040,9 @@ restart:
tuplestore_trim(winstate->buffer);
/*
- * Form and return a projection tuple using the windowfunc results
- * and the current row. Setting ecxt_outertuple arranges that any
- * Vars will be evaluated with respect to that row.
+ * Form and return a projection tuple using the windowfunc results and the
+ * current row. Setting ecxt_outertuple arranges that any Vars will be
+ * evaluated with respect to that row.
*/
econtext->ecxt_outertuple = winstate->ss.ss_ScanTupleSlot;
result = ExecProject(winstate->ss.ps.ps_ProjInfo, &isDone);
@@ -1072,8 +1072,8 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
Plan *outerPlan;
ExprContext *econtext;
ExprContext *tmpcontext;
- WindowStatePerFunc perfunc;
- WindowStatePerAgg peragg;
+ WindowStatePerFunc perfunc;
+ WindowStatePerAgg peragg;
int numfuncs,
wfuncno,
numaggs,
@@ -1163,7 +1163,7 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
/* Set up data for comparing tuples */
if (node->partNumCols > 0)
winstate->partEqfunctions = execTuplesMatchPrepare(node->partNumCols,
- node->partOperators);
+ node->partOperators);
if (node->ordNumCols > 0)
winstate->ordEqfunctions = execTuplesMatchPrepare(node->ordNumCols,
node->ordOperators);
@@ -1189,13 +1189,13 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
aggno = -1;
foreach(l, winstate->funcs)
{
- WindowFuncExprState *wfuncstate = (WindowFuncExprState *) lfirst(l);
- WindowFunc *wfunc = (WindowFunc *) wfuncstate->xprstate.expr;
+ WindowFuncExprState *wfuncstate = (WindowFuncExprState *) lfirst(l);
+ WindowFunc *wfunc = (WindowFunc *) wfuncstate->xprstate.expr;
WindowStatePerFunc perfuncstate;
AclResult aclresult;
int i;
- if (wfunc->winref != node->winref) /* planner screwed up? */
+ if (wfunc->winref != node->winref) /* planner screwed up? */
elog(ERROR, "WindowFunc with winref %u assigned to WindowAgg with winref %u",
wfunc->winref, node->winref);
@@ -1239,13 +1239,13 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
&perfuncstate->resulttypeByVal);
/*
- * If it's really just a plain aggregate function,
- * we'll emulate the Agg environment for it.
+ * If it's really just a plain aggregate function, we'll emulate the
+ * Agg environment for it.
*/
perfuncstate->plain_agg = wfunc->winagg;
if (wfunc->winagg)
{
- WindowStatePerAgg peraggstate;
+ WindowStatePerAgg peraggstate;
perfuncstate->aggno = ++aggno;
peraggstate = &winstate->peragg[aggno];
@@ -1325,7 +1325,7 @@ ExecEndWindowAgg(WindowAggState *node)
void
ExecReScanWindowAgg(WindowAggState *node, ExprContext *exprCtxt)
{
- ExprContext *econtext = node->ss.ps.ps_ExprContext;
+ ExprContext *econtext = node->ss.ps.ps_ExprContext;
node->all_done = false;
@@ -1489,11 +1489,10 @@ initialize_peragg(WindowAggState *winstate, WindowFunc *wfunc,
aggtranstype);
/*
- * If the transfn is strict and the initval is NULL, make sure input
- * type and transtype are the same (or at least binary-compatible), so
- * that it's OK to use the first input value as the initial
- * transValue. This should have been checked at agg definition time,
- * but just in case...
+ * If the transfn is strict and the initval is NULL, make sure input type
+ * and transtype are the same (or at least binary-compatible), so that
+ * it's OK to use the first input value as the initial transValue. This
+ * should have been checked at agg definition time, but just in case...
*/
if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull)
{
@@ -1579,10 +1578,10 @@ window_gettupleslot(WindowObject winobj, int64 pos, TupleTableSlot *slot)
tuplestore_select_read_pointer(winstate->buffer, winobj->readptr);
/*
- * There's no API to refetch the tuple at the current position. We
- * have to move one tuple forward, and then one backward. (We don't
- * do it the other way because we might try to fetch the row before
- * our mark, which isn't allowed.)
+ * There's no API to refetch the tuple at the current position. We have to
+ * move one tuple forward, and then one backward. (We don't do it the
+ * other way because we might try to fetch the row before our mark, which
+ * isn't allowed.)
*/
if (winobj->seekpos == pos)
{
@@ -1623,7 +1622,7 @@ window_gettupleslot(WindowObject winobj, int64 pos, TupleTableSlot *slot)
* requested amount of space. Subsequent calls just return the same chunk.
*
* Memory obtained this way is normally used to hold state that should be
- * automatically reset for each new partition. If a window function wants
+ * automatically reset for each new partition. If a window function wants
* to hold state across the whole query, fcinfo->fn_extra can be used in the
* usual way for that.
*/
@@ -1710,10 +1709,10 @@ bool
WinRowsArePeers(WindowObject winobj, int64 pos1, int64 pos2)
{
WindowAggState *winstate;
- WindowAgg *node;
+ WindowAgg *node;
TupleTableSlot *slot1;
TupleTableSlot *slot2;
- bool res;
+ bool res;
Assert(WindowObjectIsValid(winobj));
winstate = winobj->winstate;
@@ -1789,7 +1788,7 @@ WinGetFuncArgInPartition(WindowObject winobj, int argno,
break;
default:
elog(ERROR, "unrecognized window seek type: %d", seektype);
- abs_pos = 0; /* keep compiler quiet */
+ abs_pos = 0; /* keep compiler quiet */
break;
}
@@ -1862,7 +1861,7 @@ WinGetFuncArgInFrame(WindowObject winobj, int argno,
break;
default:
elog(ERROR, "unrecognized window seek type: %d", seektype);
- abs_pos = 0; /* keep compiler quiet */
+ abs_pos = 0; /* keep compiler quiet */
break;
}
diff --git a/src/backend/executor/nodeWorktablescan.c b/src/backend/executor/nodeWorktablescan.c
index 24fd2c5f73..87a0204525 100644
--- a/src/backend/executor/nodeWorktablescan.c
+++ b/src/backend/executor/nodeWorktablescan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeWorktablescan.c,v 1.6 2009/03/27 18:30:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeWorktablescan.c,v 1.7 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,10 +73,10 @@ TupleTableSlot *
ExecWorkTableScan(WorkTableScanState *node)
{
/*
- * On the first call, find the ancestor RecursiveUnion's state
- * via the Param slot reserved for it. (We can't do this during node
- * init because there are corner cases where we'll get the init call
- * before the RecursiveUnion does.)
+ * On the first call, find the ancestor RecursiveUnion's state via the
+ * Param slot reserved for it. (We can't do this during node init because
+ * there are corner cases where we'll get the init call before the
+ * RecursiveUnion does.)
*/
if (node->rustate == NULL)
{
@@ -100,8 +100,8 @@ ExecWorkTableScan(WorkTableScanState *node)
ExecGetResultType(&node->rustate->ps));
/*
- * Now we can initialize the projection info. This must be
- * completed before we can call ExecScan().
+ * Now we can initialize the projection info. This must be completed
+ * before we can call ExecScan().
*/
ExecAssignScanProjectionInfo(&node->ss);
}
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index f750560c6f..40f43ee011 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.207 2009/01/21 11:02:40 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.208 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,11 +45,11 @@ static int _SPI_connected = -1;
static int _SPI_curid = -1;
static Portal SPI_cursor_open_internal(const char *name, SPIPlanPtr plan,
- Datum *Values, const char *Nulls,
- bool read_only, int pflags);
+ Datum *Values, const char *Nulls,
+ bool read_only, int pflags);
static void _SPI_prepare_plan(const char *src, SPIPlanPtr plan,
- ParamListInfo boundParams);
+ ParamListInfo boundParams);
static int _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
Snapshot snapshot, Snapshot crosscheck_snapshot,
@@ -308,7 +308,7 @@ SPI_pop(void)
bool
SPI_push_conditional(void)
{
- bool pushed = (_SPI_curid != _SPI_connected);
+ bool pushed = (_SPI_curid != _SPI_connected);
if (pushed)
{
@@ -962,7 +962,7 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
/*
* SPI_cursor_open_with_args()
*
- * Parse and plan a query and open it as a portal. Like SPI_execute_with_args,
+ * Parse and plan a query and open it as a portal. Like SPI_execute_with_args,
* we can tell the planner to rely on the parameter values as constants,
* because the plan will only be used once.
*/
@@ -1212,8 +1212,8 @@ SPI_cursor_open_internal(const char *name, SPIPlanPtr plan,
}
/*
- * Set up the snapshot to use. (PortalStart will do PushActiveSnapshot, so
- * we skip that here.)
+ * Set up the snapshot to use. (PortalStart will do PushActiveSnapshot,
+ * so we skip that here.)
*/
if (read_only)
snapshot = GetActiveSnapshot();
@@ -1767,13 +1767,13 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
if (read_only && !CommandIsReadOnly(stmt))
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(stmt))));
+ /* translator: %s is a SQL statement name */
+ errmsg("%s is not allowed in a non-volatile function",
+ CreateCommandTag(stmt))));
/*
- * If not read-only mode, advance the command counter before
- * each command.
+ * If not read-only mode, advance the command counter before each
+ * command.
*/
if (!read_only)
CommandCounterIncrement();
@@ -1784,7 +1784,8 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
{
/*
* Default read_only behavior is to use the entry-time
- * ActiveSnapshot, if any; if read-write, grab a full new snap.
+ * ActiveSnapshot, if any; if read-write, grab a full new
+ * snap.
*/
if (read_only)
{
@@ -1804,8 +1805,8 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
{
/*
* We interpret read_only with a specified snapshot to be
- * exactly that snapshot, but read-write means use the
- * snap with advancing of command ID.
+ * exactly that snapshot, but read-write means use the snap
+ * with advancing of command ID.
*/
if (read_only)
PushActiveSnapshot(snapshot);
@@ -1839,7 +1840,7 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
ProcessUtility(stmt,
plansource->query_string,
paramLI,
- false, /* not top level */
+ false, /* not top level */
dest,
NULL);
/* Update "processed" if stmt returned tuples */
@@ -1853,9 +1854,9 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
PopActiveSnapshot();
/*
- * The last canSetTag query sets the status values returned to
- * the caller. Be careful to free any tuptables not returned,
- * to avoid intratransaction memory leak.
+ * The last canSetTag query sets the status values returned to the
+ * caller. Be careful to free any tuptables not returned, to
+ * avoid intratransaction memory leak.
*/
if (canSetTag)
{
@@ -1884,9 +1885,9 @@ _SPI_execute_plan(SPIPlanPtr plan, ParamListInfo paramLI,
cplan = NULL;
/*
- * If not read-only mode, advance the command counter after the
- * last command. This ensures that its effects are visible, in
- * case it was DDL that would affect the next CachedPlanSource.
+ * If not read-only mode, advance the command counter after the last
+ * command. This ensures that its effects are visible, in case it was
+ * DDL that would affect the next CachedPlanSource.
*/
if (!read_only)
CommandCounterIncrement();
@@ -1912,9 +1913,9 @@ fail:
_SPI_current->tuptable = NULL;
/*
- * If none of the queries had canSetTag, return SPI_OK_REWRITTEN. Prior
- * to 8.4, we used return the last query's result code, but not its
- * auxiliary results, but that's confusing.
+ * If none of the queries had canSetTag, return SPI_OK_REWRITTEN. Prior to
+ * 8.4, we used return the last query's result code, but not its auxiliary
+ * results, but that's confusing.
*/
if (my_res == 0)
my_res = SPI_OK_REWRITTEN;
@@ -1938,7 +1939,7 @@ _SPI_convert_params(int nargs, Oid *argtypes,
/* sizeof(ParamListInfoData) includes the first array element */
paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) +
- (nargs - 1) *sizeof(ParamExternData));
+ (nargs - 1) *sizeof(ParamExternData));
paramLI->numParams = nargs;
for (i = 0; i < nargs; i++)
diff --git a/src/backend/executor/tstoreReceiver.c b/src/backend/executor/tstoreReceiver.c
index a8ad1dc3ff..19f348f13f 100644
--- a/src/backend/executor/tstoreReceiver.c
+++ b/src/backend/executor/tstoreReceiver.c
@@ -5,7 +5,7 @@
* a Tuplestore.
*
* Optionally, we can force detoasting (but not decompression) of out-of-line
- * toasted values. This is to support cursors WITH HOLD, which must retain
+ * toasted values. This is to support cursors WITH HOLD, which must retain
* data even if the underlying table is dropped.
*
*
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/tstoreReceiver.c,v 1.22 2009/01/01 17:23:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/tstoreReceiver.c,v 1.23 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -121,8 +121,8 @@ tstoreReceiveSlot_detoast(TupleTableSlot *slot, DestReceiver *self)
/*
* Fetch back any out-of-line datums. We build the new datums array in
- * myState->outvalues[] (but we can re-use the slot's isnull array).
- * Also, remember the fetched values to free afterwards.
+ * myState->outvalues[] (but we can re-use the slot's isnull array). Also,
+ * remember the fetched values to free afterwards.
*/
nfree = 0;
for (i = 0; i < natts; i++)
@@ -136,7 +136,7 @@ tstoreReceiveSlot_detoast(TupleTableSlot *slot, DestReceiver *self)
if (VARATT_IS_EXTERNAL(DatumGetPointer(val)))
{
val = PointerGetDatum(heap_tuple_fetch_attr((struct varlena *)
- DatumGetPointer(val)));
+ DatumGetPointer(val)));
myState->tofree[nfree++] = val;
}
}
diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c
index 3ec4250677..4fb00328ca 100644
--- a/src/backend/foreign/foreign.c
+++ b/src/backend/foreign/foreign.c
@@ -1,12 +1,12 @@
/*-------------------------------------------------------------------------
*
* foreign.c
- * support for foreign-data wrappers, servers and user mappings.
+ * support for foreign-data wrappers, servers and user mappings.
*
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/foreign/foreign.c,v 1.3 2009/02/24 10:06:32 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/foreign/foreign.c,v 1.4 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,16 +36,16 @@ extern Datum postgresql_fdw_validator(PG_FUNCTION_ARGS);
/*
- * GetForeignDataWrapper - look up the foreign-data wrapper by OID.
+ * GetForeignDataWrapper - look up the foreign-data wrapper by OID.
*/
ForeignDataWrapper *
GetForeignDataWrapper(Oid fdwid)
{
- Form_pg_foreign_data_wrapper fdwform;
- ForeignDataWrapper *fdw;
- Datum datum;
- HeapTuple tp;
- bool isnull;
+ Form_pg_foreign_data_wrapper fdwform;
+ ForeignDataWrapper *fdw;
+ Datum datum;
+ HeapTuple tp;
+ bool isnull;
tp = SearchSysCache(FOREIGNDATAWRAPPEROID,
ObjectIdGetDatum(fdwid),
@@ -82,7 +82,7 @@ GetForeignDataWrapper(Oid fdwid)
Oid
GetForeignDataWrapperOidByName(const char *fdwname, bool missing_ok)
{
- Oid fdwId;
+ Oid fdwId;
fdwId = GetSysCacheOid(FOREIGNDATAWRAPPERNAME,
CStringGetDatum(fdwname),
@@ -91,7 +91,7 @@ GetForeignDataWrapperOidByName(const char *fdwname, bool missing_ok)
if (!OidIsValid(fdwId) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("foreign-data wrapper \"%s\" does not exist", fdwname)));
+ errmsg("foreign-data wrapper \"%s\" does not exist", fdwname)));
return fdwId;
}
@@ -104,7 +104,7 @@ GetForeignDataWrapperOidByName(const char *fdwname, bool missing_ok)
ForeignDataWrapper *
GetForeignDataWrapperByName(const char *fdwname, bool missing_ok)
{
- Oid fdwId = GetForeignDataWrapperOidByName(fdwname, missing_ok);
+ Oid fdwId = GetForeignDataWrapperOidByName(fdwname, missing_ok);
if (!OidIsValid(fdwId) && missing_ok)
return NULL;
@@ -119,11 +119,11 @@ GetForeignDataWrapperByName(const char *fdwname, bool missing_ok)
ForeignServer *
GetForeignServer(Oid serverid)
{
- Form_pg_foreign_server serverform;
- ForeignServer *server;
- HeapTuple tp;
- Datum datum;
- bool isnull;
+ Form_pg_foreign_server serverform;
+ ForeignServer *server;
+ HeapTuple tp;
+ Datum datum;
+ bool isnull;
tp = SearchSysCache(FOREIGNSERVEROID,
ObjectIdGetDatum(serverid),
@@ -175,7 +175,7 @@ GetForeignServer(Oid serverid)
Oid
GetForeignServerOidByName(const char *srvname, bool missing_ok)
{
- Oid serverid;
+ Oid serverid;
serverid = GetSysCacheOid(FOREIGNSERVERNAME,
CStringGetDatum(srvname),
@@ -184,7 +184,7 @@ GetForeignServerOidByName(const char *srvname, bool missing_ok)
if (!OidIsValid(serverid) && !missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("server \"%s\" does not exist", srvname)));
+ errmsg("server \"%s\" does not exist", srvname)));
return serverid;
}
@@ -196,7 +196,7 @@ GetForeignServerOidByName(const char *srvname, bool missing_ok)
ForeignServer *
GetForeignServerByName(const char *srvname, bool missing_ok)
{
- Oid serverid = GetForeignServerOidByName(srvname, missing_ok);
+ Oid serverid = GetForeignServerOidByName(srvname, missing_ok);
if (!OidIsValid(serverid) && missing_ok)
return NULL;
@@ -214,11 +214,11 @@ GetForeignServerByName(const char *srvname, bool missing_ok)
UserMapping *
GetUserMapping(Oid userid, Oid serverid)
{
- Form_pg_user_mapping umform;
+ Form_pg_user_mapping umform;
Datum datum;
- HeapTuple tp;
+ HeapTuple tp;
bool isnull;
- UserMapping *um;
+ UserMapping *um;
tp = SearchSysCache(USERMAPPINGUSERSERVER,
ObjectIdGetDatum(userid),
@@ -237,8 +237,8 @@ GetUserMapping(Oid userid, Oid serverid)
if (!HeapTupleIsValid(tp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("user mapping not found for \"%s\"",
- MappingUserName(userid))));
+ errmsg("user mapping not found for \"%s\"",
+ MappingUserName(userid))));
umform = (Form_pg_user_mapping) GETSTRUCT(tp);
@@ -270,7 +270,7 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options)
TupleDesc tupdesc;
Tuplestorestate *tupstore;
Datum values[2];
- bool nulls[2] = { 0 };
+ bool nulls[2] = {0};
MemoryContext per_query_ctx;
MemoryContext oldcontext;
@@ -296,12 +296,12 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options)
rsinfo->setResult = tupstore;
rsinfo->setDesc = tupdesc;
- foreach (cell, options)
+ foreach(cell, options)
{
- DefElem *def = lfirst(cell);
+ DefElem *def = lfirst(cell);
values[0] = CStringGetTextDatum(def->defname);
- values[1] = CStringGetTextDatum(((Value *)def->arg)->val.str);
+ values[1] = CStringGetTextDatum(((Value *) def->arg)->val.str);
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
}
@@ -319,7 +319,7 @@ deflist_to_tuplestore(ReturnSetInfo *rsinfo, List *options)
Datum
pg_options_to_table(PG_FUNCTION_ARGS)
{
- Datum array = PG_GETARG_DATUM(0);
+ Datum array = PG_GETARG_DATUM(0);
deflist_to_tuplestore((ReturnSetInfo *) fcinfo->resultinfo, untransformRelOptions(array));
@@ -330,9 +330,10 @@ pg_options_to_table(PG_FUNCTION_ARGS)
/*
* Describes the valid options for postgresql FDW, server, and user mapping.
*/
-struct ConnectionOption {
- const char *optname;
- Oid optcontext; /* Oid of catalog in which option may appear */
+struct ConnectionOption
+{
+ const char *optname;
+ Oid optcontext; /* Oid of catalog in which option may appear */
};
/*
@@ -341,21 +342,21 @@ struct ConnectionOption {
* The list is small - don't bother with bsearch if it stays so.
*/
static struct ConnectionOption libpq_conninfo_options[] = {
- { "authtype", ForeignServerRelationId },
- { "service", ForeignServerRelationId },
- { "user", UserMappingRelationId },
- { "password", UserMappingRelationId },
- { "connect_timeout", ForeignServerRelationId },
- { "dbname", ForeignServerRelationId },
- { "host", ForeignServerRelationId },
- { "hostaddr", ForeignServerRelationId },
- { "port", ForeignServerRelationId },
- { "tty", ForeignServerRelationId },
- { "options", ForeignServerRelationId },
- { "requiressl", ForeignServerRelationId },
- { "sslmode", ForeignServerRelationId },
- { "gsslib", ForeignServerRelationId },
- { NULL, InvalidOid }
+ {"authtype", ForeignServerRelationId},
+ {"service", ForeignServerRelationId},
+ {"user", UserMappingRelationId},
+ {"password", UserMappingRelationId},
+ {"connect_timeout", ForeignServerRelationId},
+ {"dbname", ForeignServerRelationId},
+ {"host", ForeignServerRelationId},
+ {"hostaddr", ForeignServerRelationId},
+ {"port", ForeignServerRelationId},
+ {"tty", ForeignServerRelationId},
+ {"options", ForeignServerRelationId},
+ {"requiressl", ForeignServerRelationId},
+ {"sslmode", ForeignServerRelationId},
+ {"gsslib", ForeignServerRelationId},
+ {NULL, InvalidOid}
};
@@ -387,19 +388,19 @@ is_conninfo_option(const char *option, Oid context)
Datum
postgresql_fdw_validator(PG_FUNCTION_ARGS)
{
- List* options_list = untransformRelOptions(PG_GETARG_DATUM(0));
- Oid catalog = PG_GETARG_OID(1);
+ List *options_list = untransformRelOptions(PG_GETARG_DATUM(0));
+ Oid catalog = PG_GETARG_OID(1);
- ListCell *cell;
+ ListCell *cell;
- foreach (cell, options_list)
+ foreach(cell, options_list)
{
DefElem *def = lfirst(cell);
if (!is_conninfo_option(def->defname, catalog))
{
- struct ConnectionOption *opt;
- StringInfoData buf;
+ struct ConnectionOption *opt;
+ StringInfoData buf;
/*
* Unknown option specified, complain about it. Provide a hint
@@ -414,7 +415,7 @@ postgresql_fdw_validator(PG_FUNCTION_ARGS)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid option \"%s\"", def->defname),
- errhint("Valid options in this context are: %s", buf.data)));
+ errhint("Valid options in this context are: %s", buf.data)));
PG_RETURN_BOOL(false);
}
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index fb51d8df04..84d72cb241 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.181 2009/05/27 21:08:22 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.182 2009/06/11 14:48:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,7 +22,7 @@
#include <sys/ucred.h>
#endif
#ifdef HAVE_UCRED_H
-# include <ucred.h>
+#include <ucred.h>
#endif
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -36,7 +36,7 @@
#include "storage/ipc.h"
/*----------------------------------------------------------------
- * Global authentication functions
+ * Global authentication functions
*----------------------------------------------------------------
*/
static void sendAuthRequest(Port *port, AuthRequest areq);
@@ -55,7 +55,7 @@ static int recv_and_check_password_packet(Port *port);
/* Standard TCP port number for Ident service. Assigned by IANA */
#define IDENT_PORT 113
-static int authident(hbaPort *port);
+static int authident(hbaPort *port);
/*----------------------------------------------------------------
@@ -101,17 +101,17 @@ static Port *pam_port_cludge; /* Workaround for passing "Port *port" into
/* Correct header from the Platform SDK */
typedef
-ULONG(*__ldap_start_tls_sA) (
- IN PLDAP ExternalHandle,
- OUT PULONG ServerReturnValue,
- OUT LDAPMessage ** result,
- IN PLDAPControlA * ServerControls,
- IN PLDAPControlA * ClientControls
+ULONG (*__ldap_start_tls_sA) (
+ IN PLDAP ExternalHandle,
+ OUT PULONG ServerReturnValue,
+ OUT LDAPMessage **result,
+ IN PLDAPControlA * ServerControls,
+ IN PLDAPControlA * ClientControls
);
#endif
static int CheckLDAPAuth(Port *port);
-#endif /* USE_LDAP */
+#endif /* USE_LDAP */
/*----------------------------------------------------------------
* Cert authentication
@@ -136,7 +136,7 @@ bool pg_krb_caseins_users;
*----------------------------------------------------------------
*/
#ifdef KRB5
-static int pg_krb5_recvauth(Port *port);
+static int pg_krb5_recvauth(Port *port);
#include <krb5.h>
/* Some old versions of Kerberos do not include <com_err.h> in <krb5.h> */
@@ -151,7 +151,7 @@ static int pg_krb5_initialised;
static krb5_context pg_krb5_context;
static krb5_keytab pg_krb5_keytab;
static krb5_principal pg_krb5_server;
-#endif /* KRB5 */
+#endif /* KRB5 */
/*----------------------------------------------------------------
@@ -165,8 +165,8 @@ static krb5_principal pg_krb5_server;
#include <gssapi/gssapi.h>
#endif
-static int pg_GSS_recvauth(Port *port);
-#endif /* ENABLE_GSS */
+static int pg_GSS_recvauth(Port *port);
+#endif /* ENABLE_GSS */
/*----------------------------------------------------------------
@@ -174,10 +174,10 @@ static int pg_GSS_recvauth(Port *port);
*----------------------------------------------------------------
*/
#ifdef ENABLE_SSPI
-typedef SECURITY_STATUS
+typedef SECURITY_STATUS
(WINAPI * QUERY_SECURITY_CONTEXT_TOKEN_FN) (
PCtxtHandle, void **);
-static int pg_SSPI_recvauth(Port *port);
+static int pg_SSPI_recvauth(Port *port);
#endif
@@ -282,10 +282,9 @@ ClientAuthentication(Port *port)
errhint("See server log for details.")));
/*
- * This is the first point where we have access to the hba record for
- * the current connection, so perform any verifications based on the
- * hba options field that should be done *before* the authentication
- * here.
+ * This is the first point where we have access to the hba record for the
+ * current connection, so perform any verifications based on the hba
+ * options field that should be done *before* the authentication here.
*/
if (port->hba->clientcert)
{
@@ -301,12 +300,13 @@ ClientAuthentication(Port *port)
{
ereport(FATAL,
(errcode(ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION),
- errmsg("connection requires a valid client certificate")));
+ errmsg("connection requires a valid client certificate")));
}
#else
+
/*
- * hba.c makes sure hba->clientcert can't be set unless OpenSSL
- * is present.
+ * hba.c makes sure hba->clientcert can't be set unless OpenSSL is
+ * present.
*/
Assert(false);
#endif
@@ -738,9 +738,9 @@ pg_krb5_recvauth(Port *port)
if (cp)
{
/*
- * If we are not going to include the realm in the username that is passed
- * to the ident map, destructively modify it here to remove the realm. Then
- * advance past the separator to check the realm.
+ * If we are not going to include the realm in the username that is
+ * passed to the ident map, destructively modify it here to remove the
+ * realm. Then advance past the separator to check the realm.
*/
if (!port->hba->include_realm)
*cp = '\0';
@@ -766,7 +766,7 @@ pg_krb5_recvauth(Port *port)
}
}
}
- else if (port->hba->krb_realm&& strlen(port->hba->krb_realm))
+ else if (port->hba->krb_realm && strlen(port->hba->krb_realm))
{
elog(DEBUG2,
"krb5 did not return realm but realm matching was requested");
@@ -867,8 +867,8 @@ pg_GSS_recvauth(Port *port)
/*
* GSS auth is not supported for protocol versions before 3, because it
* relies on the overall message length word to determine the GSS payload
- * size in AuthenticationGSSContinue and PasswordMessage messages.
- * (This is, in fact, a design error in our GSS support, because protocol
+ * size in AuthenticationGSSContinue and PasswordMessage messages. (This
+ * is, in fact, a design error in our GSS support, because protocol
* messages are supposed to be parsable without relying on the length
* word; but it's not worth changing it now.)
*/
@@ -887,8 +887,8 @@ pg_GSS_recvauth(Port *port)
*/
if (getenv("KRB5_KTNAME") == NULL)
{
- size_t kt_len = strlen(pg_krb_server_keyfile) + 14;
- char *kt_path = malloc(kt_len);
+ size_t kt_len = strlen(pg_krb_server_keyfile) + 14;
+ char *kt_path = malloc(kt_len);
if (!kt_path)
{
@@ -1030,9 +1030,9 @@ pg_GSS_recvauth(Port *port)
char *cp = strchr(gbuf.value, '@');
/*
- * If we are not going to include the realm in the username that is passed
- * to the ident map, destructively modify it here to remove the realm. Then
- * advance past the separator to check the realm.
+ * If we are not going to include the realm in the username that is
+ * passed to the ident map, destructively modify it here to remove the
+ * realm. Then advance past the separator to check the realm.
*/
if (!port->hba->include_realm)
*cp = '\0';
@@ -1128,8 +1128,8 @@ pg_SSPI_recvauth(Port *port)
/*
* SSPI auth is not supported for protocol versions before 3, because it
* relies on the overall message length word to determine the SSPI payload
- * size in AuthenticationGSSContinue and PasswordMessage messages.
- * (This is, in fact, a design error in our SSPI support, because protocol
+ * size in AuthenticationGSSContinue and PasswordMessage messages. (This
+ * is, in fact, a design error in our SSPI support, because protocol
* messages are supposed to be parsable without relying on the length
* word; but it's not worth changing it now.)
*/
@@ -1355,8 +1355,8 @@ pg_SSPI_recvauth(Port *port)
*/
if (port->hba->include_realm)
{
- char *namebuf;
- int retval;
+ char *namebuf;
+ int retval;
namebuf = palloc(strlen(accountname) + strlen(domainname) + 2);
sprintf(namebuf, "%s@%s", accountname, domainname);
@@ -1697,9 +1697,9 @@ ident_unix(int sock, char *ident_user)
/* Solaris > 10 */
uid_t uid;
struct passwd *pass;
- ucred_t *ucred;
+ ucred_t *ucred;
- ucred = NULL; /* must be initialized to NULL */
+ ucred = NULL; /* must be initialized to NULL */
if (getpeerucred(sock, &ucred) == -1)
{
ereport(LOG,
@@ -1712,7 +1712,7 @@ ident_unix(int sock, char *ident_user)
{
ereport(LOG,
(errcode_for_socket_access(),
- errmsg("could not get effective UID from peer credentials: %m")));
+ errmsg("could not get effective UID from peer credentials: %m")));
return false;
}
@@ -1722,8 +1722,8 @@ ident_unix(int sock, char *ident_user)
if (pass == NULL)
{
ereport(LOG,
- (errmsg("local user with ID %d does not exist",
- (int) uid)));
+ (errmsg("local user with ID %d does not exist",
+ (int) uid)));
return false;
}
@@ -2050,7 +2050,7 @@ CheckLDAPAuth(Port *port)
int ldapversion = LDAP_VERSION3;
char fulluser[NAMEDATALEN + 256 + 1];
- if (!port->hba->ldapserver|| port->hba->ldapserver[0] == '\0')
+ if (!port->hba->ldapserver || port->hba->ldapserver[0] == '\0')
{
ereport(LOG,
(errmsg("LDAP server not specified")));
@@ -2188,4 +2188,5 @@ CheckCertAuth(Port *port)
/* Just pass the certificate CN to the usermap check */
return check_usermap(port->hba->usermap, port->user_name, port->peer_cn, false);
}
+
#endif
diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c
index ead962d692..24605b5490 100644
--- a/src/backend/libpq/be-fsstubs.c
+++ b/src/backend/libpq/be-fsstubs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/be-fsstubs.c,v 1.90 2009/01/01 17:23:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/be-fsstubs.c,v 1.91 2009/06/11 14:48:58 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
@@ -80,7 +80,7 @@ static MemoryContext fscxt = NULL;
static int newLOfd(LargeObjectDesc *lobjCookie);
static void deleteLOfd(int fd);
-static Oid lo_import_internal(text *filename, Oid lobjOid);
+static Oid lo_import_internal(text *filename, Oid lobjOid);
/*****************************************************************************
@@ -334,7 +334,7 @@ Datum
lo_import_with_oid(PG_FUNCTION_ARGS)
{
text *filename = PG_GETARG_TEXT_PP(0);
- Oid oid = PG_GETARG_OID(1);
+ Oid oid = PG_GETARG_OID(1);
PG_RETURN_OID(lo_import_internal(filename, oid));
}
@@ -348,8 +348,8 @@ lo_import_internal(text *filename, Oid lobjOid)
char buf[BUFSIZE];
char fnamebuf[MAXPGPATH];
LargeObjectDesc *lobj;
- Oid oid;
-
+ Oid oid;
+
#ifndef ALLOW_DANGEROUS_LO_FUNCTIONS
if (!superuser())
ereport(ERROR,
diff --git a/src/backend/libpq/be-secure.c b/src/backend/libpq/be-secure.c
index a6478b5523..ef2db7f174 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.91 2009/05/11 08:06:21 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/be-secure.c,v 1.92 2009/06/11 14:48:58 momjian Exp $
*
* Since the server static private key ($DataDir/server.key)
* will normally be stored unencrypted so that the database
@@ -730,7 +730,7 @@ initialize_SSL(void)
* Load and verify certificate and private key
*/
if (SSL_CTX_use_certificate_chain_file(SSL_context,
- SERVER_CERT_FILE) != 1)
+ SERVER_CERT_FILE) != 1)
ereport(FATAL,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("could not load server certificate file \"%s\": %s",
@@ -754,14 +754,14 @@ initialize_SSL(void)
if (!S_ISREG(buf.st_mode) || buf.st_mode & (S_IRWXG | S_IRWXO))
ereport(FATAL,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
- errmsg("private key file \"%s\" has group or world access",
- SERVER_PRIVATE_KEY_FILE),
- errdetail("Permissions should be u=rw (0600) or less.")));
+ errmsg("private key file \"%s\" has group or world access",
+ SERVER_PRIVATE_KEY_FILE),
+ errdetail("Permissions should be u=rw (0600) or less.")));
#endif
if (SSL_CTX_use_PrivateKey_file(SSL_context,
- SERVER_PRIVATE_KEY_FILE,
- SSL_FILETYPE_PEM) != 1)
+ SERVER_PRIVATE_KEY_FILE,
+ SSL_FILETYPE_PEM) != 1)
ereport(FATAL,
(errmsg("could not load private key file \"%s\": %s",
SERVER_PRIVATE_KEY_FILE, SSLerrmessage())));
@@ -781,29 +781,32 @@ initialize_SSL(void)
elog(FATAL, "could not set the cipher list (no valid ciphers available)");
/*
- * Attempt to load CA store, so we can verify client certificates if needed.
+ * Attempt to load CA store, so we can verify client certificates if
+ * needed.
*/
if (access(ROOT_CERT_FILE, R_OK))
{
ssl_loaded_verify_locations = false;
/*
- * If root certificate file simply not found. Don't log an error here, because
- * it's quite likely the user isn't planning on using client certificates.
- * If we can't access it for other reasons, it is an error.
+ * If root certificate file simply not found. Don't log an error here,
+ * because it's quite likely the user isn't planning on using client
+ * certificates. If we can't access it for other reasons, it is an
+ * error.
*/
if (errno != ENOENT)
{
ereport(FATAL,
- (errmsg("could not access root certificate file \"%s\": %m",
- ROOT_CERT_FILE)));
+ (errmsg("could not access root certificate file \"%s\": %m",
+ ROOT_CERT_FILE)));
}
}
else if (SSL_CTX_load_verify_locations(SSL_context, ROOT_CERT_FILE, NULL) != 1)
{
/*
- * File was there, but we could not load it. This means the file is somehow
- * broken, and we cannot do verification at all - so abort here.
+ * File was there, but we could not load it. This means the file is
+ * somehow broken, and we cannot do verification at all - so abort
+ * here.
*/
ssl_loaded_verify_locations = false;
ereport(FATAL,
@@ -843,8 +846,9 @@ initialize_SSL(void)
}
/*
- * Always ask for SSL client cert, but don't fail if it's not presented. We'll fail later in this case,
- * based on what we find in pg_hba.conf.
+ * Always ask for SSL client cert, but don't fail if it's not
+ * presented. We'll fail later in this case, based on what we find
+ * in pg_hba.conf.
*/
SSL_CTX_set_verify(SSL_context,
(SSL_VERIFY_PEER |
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 63cb204a8d..0b9e0378a3 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.185 2009/04/15 21:42:50 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.186 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -568,12 +568,12 @@ check_db(const char *dbname, const char *role, char *param_str)
/*
* Macros used to check and report on invalid configuration options.
* INVALID_AUTH_OPTION = reports when an option is specified for a method where it's
- * not supported.
+ * not supported.
* REQUIRE_AUTH_OPTION = same as INVALID_AUTH_OPTION, except it also checks if the
- * method is actually the one specified. Used as a shortcut when
- * the option is only valid for one authentication method.
+ * method is actually the one specified. Used as a shortcut when
+ * the option is only valid for one authentication method.
* MANDATORY_AUTH_ARG = check if a required option is set for an authentication method,
- * reporting error if it's not.
+ * reporting error if it's not.
*/
#define INVALID_AUTH_OPTION(optname, validmethods) do {\
ereport(LOG, \
@@ -642,9 +642,9 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
ereport(LOG,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("hostssl not supported on this platform"),
- errhint("compile with --enable-ssl to use SSL connections"),
+ errhint("compile with --enable-ssl to use SSL connections"),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
#endif
}
@@ -654,12 +654,12 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
parsedline->conntype = ctHostNoSSL;
}
#endif
- else
+ else
{
/* "host", or "hostnossl" and SSL support not built in */
parsedline->conntype = ctHost;
}
- } /* record type */
+ } /* record type */
else
{
ereport(LOG,
@@ -667,7 +667,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
errmsg("invalid connection type \"%s\"",
token),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
@@ -679,7 +679,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("end-of-line before database specification"),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
parsedline->database = pstrdup(lfirst(line_item));
@@ -692,7 +692,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("end-of-line before role specification"),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
parsedline->role = pstrdup(lfirst(line_item));
@@ -707,7 +707,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("end-of-line before ip address specification"),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
token = pstrdup(lfirst(line_item));
@@ -735,7 +735,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
errmsg("invalid IP address \"%s\": %s",
token, gai_strerror(ret)),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
if (cidr_slash)
*cidr_slash = '/';
if (gai_result)
@@ -760,7 +760,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
errmsg("invalid CIDR mask in address \"%s\"",
token),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
}
@@ -774,7 +774,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("end-of-line before netmask specification"),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
token = lfirst(line_item);
@@ -787,7 +787,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
errmsg("invalid IP mask \"%s\": %s",
token, gai_strerror(ret)),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
if (gai_result)
pg_freeaddrinfo_all(hints.ai_family, gai_result);
return false;
@@ -805,7 +805,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
return false;
}
}
- } /* != ctLocal */
+ } /* != ctLocal */
/* Get the authentication method */
line_item = lnext(line_item);
@@ -815,7 +815,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("end-of-line before authentication method"),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
token = lfirst(line_item);
@@ -883,7 +883,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
errmsg("invalid authentication method \"%s\"",
token),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
@@ -894,7 +894,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
errmsg("invalid authentication method \"%s\": not supported on this platform",
token),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
@@ -904,9 +904,9 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
{
ereport(LOG,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
- errmsg("krb5 authentication is not supported on local sockets"),
+ errmsg("krb5 authentication is not supported on local sockets"),
errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ line_num, HbaFileName)));
return false;
}
@@ -924,7 +924,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
/* Parse remaining arguments */
while ((line_item = lnext(line_item)) != NULL)
{
- char *c;
+ char *c;
token = lfirst(line_item);
@@ -945,7 +945,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
}
else
{
- *c++ = '\0'; /* token now holds "name", c holds "value" */
+ *c++ = '\0'; /* token now holds "name", c holds "value" */
if (strcmp(token, "map") == 0)
{
if (parsedline->auth_method != uaIdent &&
@@ -959,16 +959,17 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
else if (strcmp(token, "clientcert") == 0)
{
/*
- * Since we require ctHostSSL, this really can never happen on non-SSL-enabled
- * builds, so don't bother checking for USE_SSL.
+ * Since we require ctHostSSL, this really can never happen on
+ * non-SSL-enabled builds, so don't bother checking for
+ * USE_SSL.
*/
if (parsedline->conntype != ctHostSSL)
{
ereport(LOG,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("clientcert can only be configured for \"hostssl\" rows"),
- errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ errcontext("line %d of configuration file \"%s\"",
+ line_num, HbaFileName)));
return false;
}
if (strcmp(c, "1") == 0)
@@ -979,8 +980,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("client certificates can only be checked if a root certificate store is available"),
errdetail("make sure the root certificate store is present and readable"),
- errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ errcontext("line %d of configuration file \"%s\"",
+ line_num, HbaFileName)));
return false;
}
parsedline->clientcert = true;
@@ -992,8 +993,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
ereport(LOG,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("clientcert can not be set to 0 when using \"cert\" authentication"),
- errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ errcontext("line %d of configuration file \"%s\"",
+ line_num, HbaFileName)));
return false;
}
parsedline->clientcert = false;
@@ -1026,8 +1027,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
ereport(LOG,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("invalid LDAP port number: \"%s\"", c),
- errcontext("line %d of configuration file \"%s\"",
- line_num, HbaFileName)));
+ errcontext("line %d of configuration file \"%s\"",
+ line_num, HbaFileName)));
return false;
}
}
@@ -1069,7 +1070,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
{
ereport(LOG,
(errcode(ERRCODE_CONFIG_FILE_ERROR),
- errmsg("unknown authentication option name: \"%s\"", token),
+ errmsg("unknown authentication option name: \"%s\"", token),
errcontext("line %d of configuration file \"%s\"",
line_num, HbaFileName)));
return false;
@@ -1078,8 +1079,8 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
}
/*
- * Check if the selected authentication method has any mandatory arguments that
- * are not set.
+ * Check if the selected authentication method has any mandatory arguments
+ * that are not set.
*/
if (parsedline->auth_method == uaLDAP)
{
@@ -1093,7 +1094,7 @@ parse_hba_line(List *line, int line_num, HbaLine *parsedline)
{
parsedline->clientcert = true;
}
-
+
return true;
}
@@ -1106,7 +1107,7 @@ static bool
check_hba(hbaPort *port)
{
ListCell *line;
- HbaLine *hba;
+ HbaLine *hba;
foreach(line, parsed_hba_lines)
{
@@ -1150,28 +1151,30 @@ check_hba(hbaPort *port)
continue;
}
#ifdef HAVE_IPV6
- else if (hba->addr.ss_family == AF_INET &&
- port->raddr.addr.ss_family == AF_INET6)
+ else if (hba->addr.ss_family == AF_INET &&
+ port->raddr.addr.ss_family == AF_INET6)
{
/*
- * Wrong address family. We allow only one case: if the file has
- * IPv4 and the port is IPv6, promote the file address to IPv6 and
- * try to match that way.
+ * Wrong address family. We allow only one case: if the file
+ * has IPv4 and the port is IPv6, promote the file address to
+ * IPv6 and try to match that way.
*/
- struct sockaddr_storage addrcopy, maskcopy;
+ struct sockaddr_storage addrcopy,
+ maskcopy;
+
memcpy(&addrcopy, &hba->addr, sizeof(addrcopy));
memcpy(&maskcopy, &hba->mask, sizeof(maskcopy));
pg_promote_v4_to_v6_addr(&addrcopy);
pg_promote_v4_to_v6_mask(&maskcopy);
-
+
if (!pg_range_sockaddr(&port->raddr.addr, &addrcopy, &maskcopy))
continue;
}
-#endif /* HAVE_IPV6 */
+#endif /* HAVE_IPV6 */
else
/* Wrong address family, no IPV6 */
continue;
- } /* != ctLocal */
+ } /* != ctLocal */
/* Check database and role */
if (!check_db(port->database_name, port->user_name, hba->database))
@@ -1191,8 +1194,8 @@ check_hba(hbaPort *port)
port->hba = hba;
return true;
- /* XXX:
- * Return false only happens if we have a parsing error, which we can
+ /*
+ * XXX: Return false only happens if we have a parsing error, which we can
* no longer have (parsing now in postmaster). Consider changing API.
*/
}
@@ -1279,11 +1282,12 @@ free_hba_record(HbaLine *record)
static void
clean_hba_list(List *lines)
{
- ListCell *line;
+ ListCell *line;
foreach(line, lines)
{
- HbaLine *parsed = (HbaLine *)lfirst(line);
+ HbaLine *parsed = (HbaLine *) lfirst(line);
+
if (parsed)
free_hba_record(parsed);
}
@@ -1301,11 +1305,12 @@ bool
load_hba(void)
{
FILE *file;
- List *hba_lines = NIL;
- List *hba_line_nums = NIL;
- ListCell *line, *line_num;
- List *new_parsed_lines = NIL;
- bool ok = true;
+ List *hba_lines = NIL;
+ List *hba_line_nums = NIL;
+ ListCell *line,
+ *line_num;
+ List *new_parsed_lines = NIL;
+ bool ok = true;
file = AllocateFile(HbaFileName, "r");
if (file == NULL)
@@ -1314,10 +1319,11 @@ load_hba(void)
(errcode_for_file_access(),
errmsg("could not open configuration file \"%s\": %m",
HbaFileName)));
+
/*
* Caller will take care of making this a FATAL error in case this is
- * the initial startup. If it happens on reload, we just keep the
- * old version around.
+ * the initial startup. If it happens on reload, we just keep the old
+ * version around.
*/
return false;
}
@@ -1328,7 +1334,7 @@ load_hba(void)
/* Now parse all the lines */
forboth(line, hba_lines, line_num, hba_line_nums)
{
- HbaLine *newline;
+ HbaLine *newline;
newline = palloc0(sizeof(HbaLine));
@@ -1339,9 +1345,9 @@ load_hba(void)
pfree(newline);
/*
- * Keep parsing the rest of the file so we can report errors
- * on more than the first row. Error has already been reported
- * in the parsing function, so no need to log it here.
+ * Keep parsing the rest of the file so we can report errors on
+ * more than the first row. Error has already been reported in the
+ * parsing function, so no need to log it here.
*/
ok = false;
continue;
@@ -1461,10 +1467,10 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name,
if (file_ident_user[0] == '/')
{
/*
- * When system username starts with a slash, treat it as a regular expression.
- * In this case, we process the system username as a regular expression that
- * returns exactly one match. This is replaced for \1 in the database username
- * string, if present.
+ * When system username starts with a slash, treat it as a regular
+ * expression. In this case, we process the system username as a
+ * regular expression that returns exactly one match. This is replaced
+ * for \1 in the database username string, if present.
*/
int r;
regex_t re;
@@ -1474,22 +1480,22 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name,
char *ofs;
char *regexp_pgrole;
- wstr = palloc((strlen(file_ident_user+1) + 1) * sizeof(pg_wchar));
- wlen = pg_mb2wchar_with_len(file_ident_user+1, wstr, strlen(file_ident_user+1));
+ wstr = palloc((strlen(file_ident_user + 1) + 1) * sizeof(pg_wchar));
+ wlen = pg_mb2wchar_with_len(file_ident_user + 1, wstr, strlen(file_ident_user + 1));
/*
- * XXX: Major room for optimization: regexps could be compiled when the file is loaded
- * and then re-used in every connection.
+ * XXX: Major room for optimization: regexps could be compiled when
+ * the file is loaded and then re-used in every connection.
*/
r = pg_regcomp(&re, wstr, wlen, REG_ADVANCED);
if (r)
{
- char errstr[100];
+ char errstr[100];
pg_regerror(r, &re, errstr, sizeof(errstr));
ereport(ERROR,
(errcode(ERRCODE_INVALID_REGULAR_EXPRESSION),
- errmsg("invalid regular expression \"%s\": %s", file_ident_user+1, errstr)));
+ errmsg("invalid regular expression \"%s\": %s", file_ident_user + 1, errstr)));
pfree(wstr);
*error_p = true;
@@ -1500,10 +1506,10 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name,
wstr = palloc((strlen(ident_user) + 1) * sizeof(pg_wchar));
wlen = pg_mb2wchar_with_len(ident_user, wstr, strlen(ident_user));
- r = pg_regexec(&re, wstr, wlen, 0, NULL, 2, matches,0);
+ r = pg_regexec(&re, wstr, wlen, 0, NULL, 2, matches, 0);
if (r)
{
- char errstr[100];
+ char errstr[100];
if (r != REG_NOMATCH)
{
@@ -1511,7 +1517,7 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name,
pg_regerror(r, &re, errstr, sizeof(errstr));
ereport(ERROR,
(errcode(ERRCODE_INVALID_REGULAR_EXPRESSION),
- errmsg("regular expression match for \"%s\" failed: %s", file_ident_user+1, errstr)));
+ errmsg("regular expression match for \"%s\" failed: %s", file_ident_user + 1, errstr)));
*error_p = true;
}
@@ -1528,14 +1534,18 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name,
ereport(ERROR,
(errcode(ERRCODE_INVALID_REGULAR_EXPRESSION),
errmsg("regular expression \"%s\" has no subexpressions as requested by backreference in \"%s\"",
- file_ident_user+1, file_pgrole)));
- /* length: original length minus length of \1 plus length of match plus null terminator */
- regexp_pgrole = palloc0(strlen(file_pgrole) - 2 + (matches[1].rm_eo-matches[1].rm_so) + 1);
- strncpy(regexp_pgrole, file_pgrole, (ofs-file_pgrole));
- memcpy(regexp_pgrole+strlen(regexp_pgrole),
- ident_user+matches[1].rm_so,
- matches[1].rm_eo-matches[1].rm_so);
- strcat(regexp_pgrole, ofs+2);
+ file_ident_user + 1, file_pgrole)));
+
+ /*
+ * length: original length minus length of \1 plus length of match
+ * plus null terminator
+ */
+ regexp_pgrole = palloc0(strlen(file_pgrole) - 2 + (matches[1].rm_eo - matches[1].rm_so) + 1);
+ strncpy(regexp_pgrole, file_pgrole, (ofs - file_pgrole));
+ memcpy(regexp_pgrole + strlen(regexp_pgrole),
+ ident_user + matches[1].rm_so,
+ matches[1].rm_eo - matches[1].rm_so);
+ strcat(regexp_pgrole, ofs + 2);
}
else
{
@@ -1545,7 +1555,10 @@ parse_ident_usermap(List *line, int line_number, const char *usermap_name,
pg_regfree(&re);
- /* now check if the username actually matched what the user is trying to connect as */
+ /*
+ * now check if the username actually matched what the user is trying
+ * to connect as
+ */
if (case_insensitive)
{
if (pg_strcasecmp(regexp_pgrole, pg_role) == 0)
@@ -1594,8 +1607,8 @@ ident_syntax:
* See if the user with ident username "ident_user" is allowed to act
* as Postgres user "pgrole" according to usermap "usermap_name".
*
- * Special case: Usermap NULL, equivalent to what was previously called
- * "sameuser" or "samerole", don't look in the usermap
+ * Special case: Usermap NULL, equivalent to what was previously called
+ * "sameuser" or "samerole", don't look in the usermap
* file. That's an implied map where "pgrole" must be identical to
* "ident_user" in order to be authorized.
*
@@ -1603,9 +1616,9 @@ ident_syntax:
*/
int
check_usermap(const char *usermap_name,
- const char *pg_role,
- const char *auth_user,
- bool case_insensitive)
+ const char *pg_role,
+ const char *auth_user,
+ bool case_insensitive)
{
bool found_entry = false,
error = false;
@@ -1617,7 +1630,8 @@ check_usermap(const char *usermap_name,
if (pg_strcasecmp(pg_role, auth_user) == 0)
return STATUS_OK;
}
- else {
+ else
+ {
if (strcmp(pg_role, auth_user) == 0)
return STATUS_OK;
}
@@ -1634,7 +1648,7 @@ check_usermap(const char *usermap_name,
forboth(line_cell, ident_lines, num_cell, ident_line_nums)
{
parse_ident_usermap(lfirst(line_cell), lfirst_int(num_cell),
- usermap_name, pg_role, auth_user, case_insensitive,
+ usermap_name, pg_role, auth_user, case_insensitive,
&found_entry, &error);
if (found_entry || error)
break;
@@ -1643,11 +1657,11 @@ check_usermap(const char *usermap_name,
if (!found_entry && !error)
{
ereport(LOG,
- (errmsg("no match in usermap for user \"%s\" authenticated as \"%s\"",
- pg_role, auth_user),
- errcontext("usermap \"%s\"", usermap_name)));
+ (errmsg("no match in usermap for user \"%s\" authenticated as \"%s\"",
+ pg_role, auth_user),
+ errcontext("usermap \"%s\"", usermap_name)));
}
- return found_entry?STATUS_OK:STATUS_ERROR;
+ return found_entry ? STATUS_OK : STATUS_ERROR;
}
diff --git a/src/backend/libpq/ip.c b/src/backend/libpq/ip.c
index 76f472b629..80880b3807 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.45 2009/04/23 23:25:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.46 2009/06/11 14:48:58 momjian Exp $
*
* This file and the IPV6 implementation were initially provided by
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
@@ -78,8 +78,7 @@ pg_getaddrinfo_all(const char *hostname, const char *servname,
/* NULL has special meaning to getaddrinfo(). */
rc = getaddrinfo((!hostname || hostname[0] == '\0') ? NULL : hostname,
servname, hintp, result);
-
-#else /* _AIX */
+#else /* _AIX */
/*
* Various versions of AIX have various bugs in getaddrinfo()'s handling
@@ -113,7 +112,7 @@ pg_getaddrinfo_all(const char *hostname, const char *servname,
}
}
}
-#endif /* _AIX */
+#endif /* _AIX */
return rc;
}
diff --git a/src/backend/libpq/pqformat.c b/src/backend/libpq/pqformat.c
index 83d7a2bbf7..7731d19eaf 100644
--- a/src/backend/libpq/pqformat.c
+++ b/src/backend/libpq/pqformat.c
@@ -24,7 +24,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.49 2009/03/02 21:18:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/pqformat.c,v 1.50 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -218,7 +218,7 @@ pq_send_ascii_string(StringInfo buf, const char *str)
{
while (*str)
{
- char ch = *str++;
+ char ch = *str++;
if (IS_HIGHBIT_SET(ch))
ch = '?';
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index a587ef5df5..4917986e89 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.430 2009/04/16 20:42:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.431 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -182,7 +182,7 @@ _copyAppend(Append *from)
static RecursiveUnion *
_copyRecursiveUnion(RecursiveUnion *from)
{
- RecursiveUnion *newnode = makeNode(RecursiveUnion);
+ RecursiveUnion *newnode = makeNode(RecursiveUnion);
/*
* copy node superclass fields
@@ -455,7 +455,7 @@ _copyValuesScan(ValuesScan *from)
static CteScan *
_copyCteScan(CteScan *from)
{
- CteScan *newnode = makeNode(CteScan);
+ CteScan *newnode = makeNode(CteScan);
/*
* copy node superclass fields
@@ -1916,7 +1916,7 @@ _copyFuncCall(FuncCall *from)
static A_Star *
_copyAStar(A_Star *from)
{
- A_Star *newnode = makeNode(A_Star);
+ A_Star *newnode = makeNode(A_Star);
return newnode;
}
@@ -1946,7 +1946,7 @@ _copyA_Indirection(A_Indirection *from)
static A_ArrayExpr *
_copyA_ArrayExpr(A_ArrayExpr *from)
{
- A_ArrayExpr *newnode = makeNode(A_ArrayExpr);
+ A_ArrayExpr *newnode = makeNode(A_ArrayExpr);
COPY_NODE_FIELD(elements);
COPY_LOCATION_FIELD(location);
@@ -2382,7 +2382,7 @@ _copyClusterStmt(ClusterStmt *from)
COPY_NODE_FIELD(relation);
COPY_STRING_FIELD(indexname);
- COPY_SCALAR_FIELD(verbose) ;
+ COPY_SCALAR_FIELD(verbose);
return newnode;
}
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index d4c8b7262c..78756e6e78 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -22,7 +22,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.353 2009/04/16 20:42:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.354 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -773,9 +773,9 @@ static bool
_equalPlaceHolderVar(PlaceHolderVar *a, PlaceHolderVar *b)
{
/*
- * We intentionally do not compare phexpr. Two PlaceHolderVars with the
+ * We intentionally do not compare phexpr. Two PlaceHolderVars with the
* same ID and levelsup should be considered equal even if the contained
- * expressions have managed to mutate to different states. One way in
+ * expressions have managed to mutate to different states. One way in
* which that can happen is that initplan sublinks would get replaced by
* differently-numbered Params when sublink folding is done. (The end
* result of such a situation would be some unreferenced initplans, which
diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c
index 33adc0ff58..04e17439e8 100644
--- a/src/backend/nodes/list.c
+++ b/src/backend/nodes/list.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.71 2009/01/01 17:23:43 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/list.c,v 1.72 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -793,7 +793,7 @@ list_union_oid(List *list1, List *list2)
* "intersection" if list1 is known unique beforehand.
*
* This variant works on lists of pointers, and determines list
- * membership via equal(). Note that the list1 member will be pointed
+ * membership via equal(). Note that the list1 member will be pointed
* to in the result.
*/
List *
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c
index d0a3434783..0d21c9fcb0 100644
--- a/src/backend/nodes/nodeFuncs.c
+++ b/src/backend/nodes/nodeFuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/nodeFuncs.c,v 1.39 2009/03/10 22:09:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/nodeFuncs.c,v 1.40 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -231,7 +231,7 @@ exprType(Node *expr)
/*
* exprTypmod -
* returns the type-specific modifier of the expression's result type,
- * if it can be determined. In many cases, it can't and we return -1.
+ * if it can be determined. In many cases, it can't and we return -1.
*/
int32
exprTypmod(Node *expr)
@@ -680,7 +680,7 @@ exprLocation(Node *expr)
case T_DistinctExpr: /* struct-equivalent to OpExpr */
case T_NullIfExpr: /* struct-equivalent to OpExpr */
{
- OpExpr *opexpr = (OpExpr *) expr;
+ OpExpr *opexpr = (OpExpr *) expr;
/* consider both operator name and leftmost arg */
loc = leftmostLoc(opexpr->location,
@@ -711,7 +711,7 @@ exprLocation(Node *expr)
break;
case T_SubLink:
{
- SubLink *sublink = (SubLink *) expr;
+ SubLink *sublink = (SubLink *) expr;
/* check the testexpr, if any, and the operator/keyword */
loc = leftmostLoc(exprLocation(sublink->testexpr),
@@ -792,7 +792,7 @@ exprLocation(Node *expr)
break;
case T_XmlExpr:
{
- XmlExpr *xexpr = (XmlExpr *) expr;
+ XmlExpr *xexpr = (XmlExpr *) expr;
/* consider both function name and leftmost arg */
loc = leftmostLoc(xexpr->location,
@@ -846,7 +846,7 @@ exprLocation(Node *expr)
break;
case T_A_Expr:
{
- A_Expr *aexpr = (A_Expr *) expr;
+ A_Expr *aexpr = (A_Expr *) expr;
/* use leftmost of operator or left operand (if any) */
/* we assume right operand can't be to left of operator */
@@ -865,7 +865,7 @@ exprLocation(Node *expr)
break;
case T_FuncCall:
{
- FuncCall *fc = (FuncCall *) expr;
+ FuncCall *fc = (FuncCall *) expr;
/* consider both function name and leftmost arg */
loc = leftmostLoc(fc->location,
@@ -882,11 +882,11 @@ exprLocation(Node *expr)
break;
case T_TypeCast:
{
- TypeCast *tc = (TypeCast *) expr;
+ TypeCast *tc = (TypeCast *) expr;
/*
- * This could represent CAST(), ::, or TypeName 'literal',
- * so any of the components might be leftmost.
+ * This could represent CAST(), ::, or TypeName 'literal', so
+ * any of the components might be leftmost.
*/
loc = exprLocation(tc->arg);
loc = leftmostLoc(loc, tc->typename->location);
@@ -1265,7 +1265,7 @@ expression_tree_walker(Node *node,
break;
case T_WindowClause:
{
- WindowClause *wc = (WindowClause *) node;
+ WindowClause *wc = (WindowClause *) node;
if (walker(wc->partitionClause, context))
return true;
@@ -1278,8 +1278,8 @@ expression_tree_walker(Node *node,
CommonTableExpr *cte = (CommonTableExpr *) node;
/*
- * Invoke the walker on the CTE's Query node, so it
- * can recurse into the sub-query if it wants to.
+ * Invoke the walker on the CTE's Query node, so it can
+ * recurse into the sub-query if it wants to.
*/
return walker(cte->ctequery, context);
}
@@ -1423,7 +1423,7 @@ range_table_walker(List *rtable,
{
case RTE_RELATION:
case RTE_SPECIAL:
- case RTE_CTE:
+ case RTE_CTE:
/* nothing to do */
break;
case RTE_SUBQUERY:
@@ -1904,8 +1904,8 @@ expression_tree_mutator(Node *node,
return node;
case T_WindowClause:
{
- WindowClause *wc = (WindowClause *) node;
- WindowClause *newnode;
+ WindowClause *wc = (WindowClause *) node;
+ WindowClause *newnode;
FLATCOPY(newnode, wc, WindowClause);
MUTATE(newnode->partitionClause, wc->partitionClause, List *);
@@ -1921,8 +1921,8 @@ expression_tree_mutator(Node *node,
FLATCOPY(newnode, cte, CommonTableExpr);
/*
- * Also invoke the mutator on the CTE's Query node, so it
- * can recurse into the sub-query if it wants to.
+ * Also invoke the mutator on the CTE's Query node, so it can
+ * recurse into the sub-query if it wants to.
*/
MUTATE(newnode->ctequery, cte->ctequery, Node *);
return (Node *) newnode;
@@ -2070,7 +2070,7 @@ query_tree_mutator(Query *query,
MUTATE(query->limitCount, query->limitCount, Node *);
if (!(flags & QTW_IGNORE_CTE_SUBQUERIES))
MUTATE(query->cteList, query->cteList, List *);
- else /* else copy CTE list as-is */
+ else /* else copy CTE list as-is */
query->cteList = copyObject(query->cteList);
query->rtable = range_table_mutator(query->rtable,
mutator, context, flags);
@@ -2198,7 +2198,7 @@ query_or_expression_tree_mutator(Node *node,
* that could appear under it, but not other statement types.
*/
bool
-raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
+ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
{
ListCell *temp;
@@ -2356,7 +2356,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
break;
case T_A_Expr:
{
- A_Expr *expr = (A_Expr *) node;
+ A_Expr *expr = (A_Expr *) node;
if (walker(expr->lexpr, context))
return true;
@@ -2370,7 +2370,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
break;
case T_FuncCall:
{
- FuncCall *fcall = (FuncCall *) node;
+ FuncCall *fcall = (FuncCall *) node;
if (walker(fcall->args, context))
return true;
@@ -2381,7 +2381,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
break;
case T_A_Indices:
{
- A_Indices *indices = (A_Indices *) node;
+ A_Indices *indices = (A_Indices *) node;
if (walker(indices->lidx, context))
return true;
@@ -2403,7 +2403,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
return walker(((A_ArrayExpr *) node)->elements, context);
case T_ResTarget:
{
- ResTarget *rt = (ResTarget *) node;
+ ResTarget *rt = (ResTarget *) node;
if (walker(rt->indirection, context))
return true;
@@ -2413,7 +2413,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
break;
case T_TypeCast:
{
- TypeCast *tc = (TypeCast *) node;
+ TypeCast *tc = (TypeCast *) node;
if (walker(tc->arg, context))
return true;
@@ -2425,7 +2425,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
return walker(((SortBy *) node)->node, context);
case T_WindowDef:
{
- WindowDef *wd = (WindowDef *) node;
+ WindowDef *wd = (WindowDef *) node;
if (walker(wd->partitionClause, context))
return true;
@@ -2455,7 +2455,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
break;
case T_TypeName:
{
- TypeName *tn = (TypeName *) node;
+ TypeName *tn = (TypeName *) node;
if (walker(tn->typmods, context))
return true;
@@ -2466,7 +2466,7 @@ raw_expression_tree_walker(Node *node, bool (*walker) (), void *context)
break;
case T_ColumnDef:
{
- ColumnDef *coldef = (ColumnDef *) node;
+ ColumnDef *coldef = (ColumnDef *) node;
if (walker(coldef->typename, context))
return true;
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index 18e9a5792f..d79bd750d0 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.359 2009/04/16 20:42:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.360 2009/06/11 14:48:58 momjian Exp $
*
* NOTES
* Every node type that can appear in stored rules' parsetrees *must*
@@ -332,7 +332,7 @@ _outAppend(StringInfo str, Append *node)
static void
_outRecursiveUnion(StringInfo str, RecursiveUnion *node)
{
- int i;
+ int i;
WRITE_NODE_TYPE("RECURSIVEUNION");
@@ -544,7 +544,7 @@ _outHashJoin(StringInfo str, HashJoin *node)
static void
_outAgg(StringInfo str, Agg *node)
{
- int i;
+ int i;
WRITE_NODE_TYPE("AGG");
@@ -587,7 +587,7 @@ _outWindowAgg(StringInfo str, WindowAgg *node)
WRITE_INT_FIELD(ordNumCols);
appendStringInfo(str, " :ordColIdx");
- for (i = 0; i< node->ordNumCols; i++)
+ for (i = 0; i < node->ordNumCols; i++)
appendStringInfo(str, " %d", node->ordColIdx[i]);
appendStringInfo(str, " :ordOperations");
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index de62e53d1d..b27cd513a5 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.221 2009/01/22 20:16:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.222 2009/06/11 14:48:58 momjian Exp $
*
* NOTES
* Path and Plan nodes do not have any readfuncs support, because we
@@ -107,7 +107,7 @@
#define READ_LOCATION_FIELD(fldname) \
token = pg_strtok(&length); /* skip :fldname */ \
token = pg_strtok(&length); /* get field value */ \
- local_node->fldname = -1 /* set field to "unknown" */
+ local_node->fldname = -1 /* set field to "unknown" */
/* Read a Node field */
#define READ_NODE_FIELD(fldname) \
@@ -148,7 +148,8 @@ static Datum readDatum(bool typbyval);
static Bitmapset *
_readBitmapset(void)
{
- Bitmapset *result = NULL;
+ Bitmapset *result = NULL;
+
READ_TEMP_LOCALS();
token = pg_strtok(&length);
@@ -165,8 +166,8 @@ _readBitmapset(void)
for (;;)
{
- int val;
- char *endptr;
+ int val;
+ char *endptr;
token = pg_strtok(&length);
if (token == NULL)
diff --git a/src/backend/nodes/tidbitmap.c b/src/backend/nodes/tidbitmap.c
index e56b4696b4..79e036e8bf 100644
--- a/src/backend/nodes/tidbitmap.c
+++ b/src/backend/nodes/tidbitmap.c
@@ -19,7 +19,7 @@
* of lossiness. In theory we could fall back to page ranges at some
* point, but for now that seems useless complexity.
*
- * We also support the notion of candidate matches, or rechecking. This
+ * We also support the notion of candidate matches, or rechecking. This
* means we know that a search need visit only some tuples on a page,
* but we are not certain that all of those tuples are real matches.
* So the eventual heap scan must recheck the quals for these tuples only,
@@ -32,7 +32,7 @@
* Copyright (c) 2003-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.18 2009/03/24 20:17:14 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/tidbitmap.c,v 1.19 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -143,7 +143,7 @@ struct TIDBitmap
/*
* When iterating over a bitmap in sorted order, a TBMIterator is used to
- * track our progress. There can be several iterators scanning the same
+ * track our progress. There can be several iterators scanning the same
* bitmap concurrently. Note that the bitmap becomes read-only as soon as
* any iterator is created.
*/
@@ -511,10 +511,10 @@ tbm_intersect_page(TIDBitmap *a, PagetableEntry *apage, const TIDBitmap *b)
else if (tbm_page_is_lossy(b, apage->blockno))
{
/*
- * Some of the tuples in 'a' might not satisfy the quals for 'b',
- * but because the page 'b' is lossy, we don't know which ones.
- * Therefore we mark 'a' as requiring rechecks, to indicate that
- * at most those tuples set in 'a' are matches.
+ * Some of the tuples in 'a' might not satisfy the quals for 'b', but
+ * because the page 'b' is lossy, we don't know which ones. Therefore
+ * we mark 'a' as requiring rechecks, to indicate that at most those
+ * tuples set in 'a' are matches.
*/
apage->recheck = true;
return false;
@@ -573,7 +573,7 @@ tbm_begin_iterate(TIDBitmap *tbm)
* needs of the TBMIterateResult sub-struct.
*/
iterator = (TBMIterator *) palloc(sizeof(TBMIterator) +
- MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber));
+ MAX_TUPLES_PER_PAGE * sizeof(OffsetNumber));
iterator->tbm = tbm;
/*
@@ -584,10 +584,10 @@ tbm_begin_iterate(TIDBitmap *tbm)
iterator->schunkbit = 0;
/*
- * If we have a hashtable, create and fill the sorted page lists,
- * unless we already did that for a previous iterator. Note that the
- * lists are attached to the bitmap not the iterator, so they can be
- * used by more than one iterator.
+ * If we have a hashtable, create and fill the sorted page lists, unless
+ * we already did that for a previous iterator. Note that the lists are
+ * attached to the bitmap not the iterator, so they can be used by more
+ * than one iterator.
*/
if (tbm->status == TBM_HASH && !tbm->iterating)
{
@@ -644,7 +644,7 @@ tbm_begin_iterate(TIDBitmap *tbm)
TBMIterateResult *
tbm_iterate(TBMIterator *iterator)
{
- TIDBitmap *tbm = iterator->tbm;
+ TIDBitmap *tbm = iterator->tbm;
TBMIterateResult *output = &(iterator->output);
Assert(tbm->iterating);
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index fee9b8fac8..4a0a1012c0 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.182 2009/04/19 19:46:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.183 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,9 +58,9 @@ static void set_function_pathlist(PlannerInfo *root, RelOptInfo *rel,
static void set_values_pathlist(PlannerInfo *root, RelOptInfo *rel,
RangeTblEntry *rte);
static void set_cte_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static void set_worktable_pathlist(PlannerInfo *root, RelOptInfo *rel,
- RangeTblEntry *rte);
+ RangeTblEntry *rte);
static RelOptInfo *make_rel_from_joinlist(PlannerInfo *root, List *joinlist);
static bool subquery_is_pushdown_safe(Query *subquery, Query *topquery,
bool *differentTypes);
@@ -292,13 +292,13 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
/*
* Initialize to compute size estimates for whole append relation.
*
- * We handle width estimates by weighting the widths of different
- * child rels proportionally to their number of rows. This is sensible
- * because the use of width estimates is mainly to compute the total
- * relation "footprint" if we have to sort or hash it. To do this,
- * we sum the total equivalent size (in "double" arithmetic) and then
- * divide by the total rowcount estimate. This is done separately for
- * the total rel width and each attribute.
+ * We handle width estimates by weighting the widths of different child
+ * rels proportionally to their number of rows. This is sensible because
+ * the use of width estimates is mainly to compute the total relation
+ * "footprint" if we have to sort or hash it. To do this, we sum the
+ * total equivalent size (in "double" arithmetic) and then divide by the
+ * total rowcount estimate. This is done separately for the total rel
+ * width and each attribute.
*
* Note: if you consider changing this logic, beware that child rels could
* have zero rows and/or width, if they were excluded by constraints.
@@ -377,11 +377,11 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
}
/*
- * Note: we could compute appropriate attr_needed data for the
- * child's variables, by transforming the parent's attr_needed
- * through the translated_vars mapping. However, currently there's
- * no need because attr_needed is only examined for base relations
- * not otherrels. So we just leave the child's attr_needed empty.
+ * Note: we could compute appropriate attr_needed data for the child's
+ * variables, by transforming the parent's attr_needed through the
+ * translated_vars mapping. However, currently there's no need
+ * because attr_needed is only examined for base relations not
+ * otherrels. So we just leave the child's attr_needed empty.
*/
/*
@@ -438,7 +438,7 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
rel->rows = parent_rows;
if (parent_rows > 0)
{
- int i;
+ int i;
rel->width = rint(parent_size / parent_rows);
for (i = 0; i < nattrs; i++)
@@ -681,6 +681,7 @@ set_cte_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
if (!cteroot) /* shouldn't happen */
elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename);
}
+
/*
* Note: cte_plan_ids can be shorter than cteList, if we are still working
* on planning the CTEs (ie, this is a side-reference from another CTE).
@@ -726,8 +727,8 @@ set_worktable_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
/*
* We need to find the non-recursive term's plan, which is in the plan
- * level that's processing the recursive UNION, which is one level
- * *below* where the CTE comes from.
+ * level that's processing the recursive UNION, which is one level *below*
+ * where the CTE comes from.
*/
levelsup = rte->ctelevelsup;
if (levelsup == 0) /* shouldn't happen */
@@ -1087,7 +1088,7 @@ compare_tlist_datatypes(List *tlist, List *colTypes,
* of rows returned. (This condition is vacuous for DISTINCT, because then
* there are no non-DISTINCT output columns, so we needn't check. But note
* we are assuming that the qual can't distinguish values that the DISTINCT
- * operator sees as equal. This is a bit shaky but we have no way to test
+ * operator sees as equal. This is a bit shaky but we have no way to test
* for the case, and it's unlikely enough that we shouldn't refuse the
* optimization just because it could theoretically happen.)
*
@@ -1113,8 +1114,8 @@ qual_is_pushdown_safe(Query *subquery, Index rti, Node *qual,
return false;
/*
- * It would be unsafe to push down window function calls, but at least
- * for the moment we could never see any in a qual anyhow.
+ * It would be unsafe to push down window function calls, but at least for
+ * the moment we could never see any in a qual anyhow.
*/
Assert(!contain_window_function(qual));
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c
index ee02689d29..34407af607 100644
--- a/src/backend/optimizer/path/clausesel.c
+++ b/src/backend/optimizer/path/clausesel.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.97 2009/02/06 23:43:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/clausesel.c,v 1.98 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -102,8 +102,8 @@ clauselist_selectivity(PlannerInfo *root,
ListCell *l;
/*
- * If there's exactly one clause, then no use in trying to match up
- * pairs, so just go directly to clause_selectivity().
+ * If there's exactly one clause, then no use in trying to match up pairs,
+ * so just go directly to clause_selectivity().
*/
if (list_length(clauses) == 1)
return clause_selectivity(root, (Node *) linitial(clauses),
@@ -410,30 +410,30 @@ treat_as_join_clause(Node *clause, RestrictInfo *rinfo,
if (varRelid != 0)
{
/*
- * Caller is forcing restriction mode (eg, because we are examining
- * an inner indexscan qual).
+ * Caller is forcing restriction mode (eg, because we are examining an
+ * inner indexscan qual).
*/
return false;
}
else if (sjinfo == NULL)
{
/*
- * It must be a restriction clause, since it's being evaluated at
- * a scan node.
+ * It must be a restriction clause, since it's being evaluated at a
+ * scan node.
*/
return false;
}
else
{
/*
- * Otherwise, it's a join if there's more than one relation used.
- * We can optimize this calculation if an rinfo was passed.
+ * Otherwise, it's a join if there's more than one relation used. We
+ * can optimize this calculation if an rinfo was passed.
*
- * XXX Since we know the clause is being evaluated at a join,
- * the only way it could be single-relation is if it was delayed
- * by outer joins. Although we can make use of the restriction
- * qual estimators anyway, it seems likely that we ought to account
- * for the probability of injected nulls somehow.
+ * XXX Since we know the clause is being evaluated at a join, the
+ * only way it could be single-relation is if it was delayed by outer
+ * joins. Although we can make use of the restriction qual estimators
+ * anyway, it seems likely that we ought to account for the
+ * probability of injected nulls somehow.
*/
if (rinfo)
return (bms_membership(rinfo->clause_relids) == BMS_MULTIPLE);
@@ -467,7 +467,7 @@ treat_as_join_clause(Node *clause, RestrictInfo *rinfo,
* if the clause isn't a join clause.
*
* sjinfo is NULL for a non-join clause, otherwise it provides additional
- * context information about the join being performed. There are some
+ * context information about the join being performed. There are some
* special cases:
* 1. For a special (not INNER) join, sjinfo is always a member of
* root->join_info_list.
@@ -525,7 +525,7 @@ clause_selectivity(PlannerInfo *root,
* contains only vars of that relid --- otherwise varRelid will affect
* the result, so mustn't cache. Outer join quals might be examined
* with either their join's actual jointype or JOIN_INNER, so we need
- * two cache variables to remember both cases. Note: we assume the
+ * two cache variables to remember both cases. Note: we assume the
* result won't change if we are switching the input relations or
* considering a unique-ified case, so we only need one cache variable
* for all non-JOIN_INNER cases.
@@ -571,8 +571,8 @@ clause_selectivity(PlannerInfo *root,
{
/*
* A Var at the top of a clause must be a bool Var. This is
- * equivalent to the clause reln.attribute = 't', so we
- * compute the selectivity as if that is what we have.
+ * equivalent to the clause reln.attribute = 't', so we compute
+ * the selectivity as if that is what we have.
*/
s1 = restriction_selectivity(root,
BooleanEqualOperator,
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index eca0f80b8c..08f1d361ba 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.208 2009/05/09 22:51:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/costsize.c,v 1.209 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -126,7 +126,7 @@ static bool adjust_semi_join(PlannerInfo *root, JoinPath *path,
Selectivity *match_count,
bool *indexed_join_quals);
static double approx_tuple_count(PlannerInfo *root, JoinPath *path,
- List *quals);
+ List *quals);
static void set_rel_width(PlannerInfo *root, RelOptInfo *rel);
static double relation_byte_size(double tuples, int width);
static double page_size(double tuples, int width);
@@ -946,7 +946,7 @@ cost_valuesscan(Path *path, PlannerInfo *root, RelOptInfo *baserel)
*
* Note: this is used for both self-reference and regular CTEs; the
* possible cost differences are below the threshold of what we could
- * estimate accurately anyway. Note that the costs of evaluating the
+ * estimate accurately anyway. Note that the costs of evaluating the
* referenced CTE query are added into the final plan as initplan costs,
* and should NOT be counted here.
*/
@@ -998,9 +998,9 @@ cost_recursive_union(Plan *runion, Plan *nrterm, Plan *rterm)
/*
* We arbitrarily assume that about 10 recursive iterations will be
- * needed, and that we've managed to get a good fix on the cost and
- * output size of each one of them. These are mighty shaky assumptions
- * but it's hard to see how to do better.
+ * needed, and that we've managed to get a good fix on the cost and output
+ * size of each one of them. These are mighty shaky assumptions but it's
+ * hard to see how to do better.
*/
total_cost += 10 * rterm->total_cost;
total_rows += 10 * rterm->plan_rows;
@@ -1406,8 +1406,8 @@ cost_nestloop(NestPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
double outer_path_rows = PATH_ROWS(outer_path);
double inner_path_rows = nestloop_inner_path_rows(inner_path);
double ntuples;
- Selectivity outer_match_frac;
- Selectivity match_count;
+ Selectivity outer_match_frac;
+ Selectivity match_count;
bool indexed_join_quals;
if (!enable_nestloop)
@@ -1446,7 +1446,7 @@ cost_nestloop(NestPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
&indexed_join_quals))
{
double outer_matched_rows;
- Selectivity inner_scan_frac;
+ Selectivity inner_scan_frac;
/*
* SEMI or ANTI join: executor will stop after first match.
@@ -1470,11 +1470,11 @@ cost_nestloop(NestPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
/*
* For unmatched outer-rel rows, there are two cases. If the inner
- * path is an indexscan using all the joinquals as indexquals, then
- * an unmatched row results in an indexscan returning no rows, which
- * is probably quite cheap. We estimate this case as the same cost
- * to return the first tuple of a nonempty scan. Otherwise, the
- * executor will have to scan the whole inner rel; not so cheap.
+ * path is an indexscan using all the joinquals as indexquals, then an
+ * unmatched row results in an indexscan returning no rows, which is
+ * probably quite cheap. We estimate this case as the same cost to
+ * return the first tuple of a nonempty scan. Otherwise, the executor
+ * will have to scan the whole inner rel; not so cheap.
*/
if (indexed_join_quals)
{
@@ -1569,7 +1569,7 @@ cost_mergejoin(MergePath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
qp_qual_cost.per_tuple -= merge_qual_cost.per_tuple;
/*
- * Get approx # tuples passing the mergequals. We use approx_tuple_count
+ * Get approx # tuples passing the mergequals. We use approx_tuple_count
* here because we need an estimate done with JOIN_INNER semantics.
*/
mergejointuples = approx_tuple_count(root, &path->jpath, mergeclauses);
@@ -1586,7 +1586,7 @@ cost_mergejoin(MergePath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
* estimated approximately as size of merge join output minus size of
* inner relation. Assume that the distinct key values are 1, 2, ..., and
* denote the number of values of each key in the outer relation as m1,
- * m2, ...; in the inner relation, n1, n2, ... Then we have
+ * m2, ...; in the inner relation, n1, n2, ... Then we have
*
* size of join = m1 * n1 + m2 * n2 + ...
*
@@ -1620,11 +1620,11 @@ cost_mergejoin(MergePath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
* (unless it's an outer join, in which case the outer side has to be
* scanned all the way anyway). Estimate fraction of the left and right
* inputs that will actually need to be scanned. Likewise, we can
- * estimate the number of rows that will be skipped before the first
- * join pair is found, which should be factored into startup cost.
- * We use only the first (most significant) merge clause for this purpose.
- * Since mergejoinscansel() is a fairly expensive computation, we cache
- * the results in the merge clause RestrictInfo.
+ * estimate the number of rows that will be skipped before the first join
+ * pair is found, which should be factored into startup cost. We use only
+ * the first (most significant) merge clause for this purpose. Since
+ * mergejoinscansel() is a fairly expensive computation, we cache the
+ * results in the merge clause RestrictInfo.
*/
if (mergeclauses && path->jpath.jointype != JOIN_FULL)
{
@@ -1795,8 +1795,8 @@ cost_mergejoin(MergePath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
* clauses that are to be applied at the join. (This is pessimistic since
* not all of the quals may get evaluated at each tuple.)
*
- * Note: we could adjust for SEMI/ANTI joins skipping some qual evaluations
- * here, but it's probably not worth the trouble.
+ * Note: we could adjust for SEMI/ANTI joins skipping some qual
+ * evaluations here, but it's probably not worth the trouble.
*/
startup_cost += qp_qual_cost.startup;
cpu_per_tuple = cpu_tuple_cost + qp_qual_cost.per_tuple;
@@ -1890,8 +1890,8 @@ cost_hashjoin(HashPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
int num_skew_mcvs;
double virtualbuckets;
Selectivity innerbucketsize;
- Selectivity outer_match_frac;
- Selectivity match_count;
+ Selectivity outer_match_frac;
+ Selectivity match_count;
ListCell *hcl;
if (!enable_hashjoin)
@@ -1937,11 +1937,12 @@ cost_hashjoin(HashPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
*/
ExecChooseHashTableSize(inner_path_rows,
inner_path->parent->width,
- true, /* useskew */
+ true, /* useskew */
&numbuckets,
&numbatches,
&num_skew_mcvs);
virtualbuckets = (double) numbuckets *(double) numbatches;
+
/* mark the path with estimated # of batches */
path->num_batches = numbatches;
@@ -2038,7 +2039,7 @@ cost_hashjoin(HashPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
NULL))
{
double outer_matched_rows;
- Selectivity inner_scan_frac;
+ Selectivity inner_scan_frac;
/*
* SEMI or ANTI join: executor will stop after first match.
@@ -2064,12 +2065,12 @@ cost_hashjoin(HashPath *path, PlannerInfo *root, SpecialJoinInfo *sjinfo)
* preferentially hit heavily-populated buckets; instead assume they
* are uncorrelated with the inner distribution and so they see an
* average bucket size of inner_path_rows / virtualbuckets. In the
- * second place, it seems likely that they will have few if any
- * exact hash-code matches and so very few of the tuples in the
- * bucket will actually require eval of the hash quals. We don't
- * have any good way to estimate how many will, but for the moment
- * assume that the effective cost per bucket entry is one-tenth what
- * it is for matchable tuples.
+ * second place, it seems likely that they will have few if any exact
+ * hash-code matches and so very few of the tuples in the bucket will
+ * actually require eval of the hash quals. We don't have any good
+ * way to estimate how many will, but for the moment assume that the
+ * effective cost per bucket entry is one-tenth what it is for
+ * matchable tuples.
*/
run_cost += hash_qual_cost.per_tuple *
(outer_path_rows - outer_matched_rows) *
@@ -2151,18 +2152,17 @@ cost_subplan(PlannerInfo *root, SubPlan *subplan, Plan *plan)
/*
* The per-tuple costs include the cost of evaluating the lefthand
* expressions, plus the cost of probing the hashtable. We already
- * accounted for the lefthand expressions as part of the testexpr,
- * and will also have counted one cpu_operator_cost for each
- * comparison operator. That is probably too low for the probing
- * cost, but it's hard to make a better estimate, so live with it for
- * now.
+ * accounted for the lefthand expressions as part of the testexpr, and
+ * will also have counted one cpu_operator_cost for each comparison
+ * operator. That is probably too low for the probing cost, but it's
+ * hard to make a better estimate, so live with it for now.
*/
}
else
{
/*
* 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 the
* tuple_fraction estimates used by make_subplan() in
* plan/subselect.c.
@@ -2315,9 +2315,9 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context)
* Vars and Consts are charged zero, and so are boolean operators (AND,
* OR, NOT). Simplistic, but a lot better than no model at all.
*
- * Note that Aggref and WindowFunc nodes are (and should be) treated
- * like Vars --- whatever execution cost they have is absorbed into
- * plan-node-specific costing. As far as expression evaluation is
+ * Note that Aggref and WindowFunc nodes are (and should be) treated like
+ * Vars --- whatever execution cost they have is absorbed into
+ * plan-node-specific costing. As far as expression evaluation is
* concerned they're just like Vars.
*
* Should we try to account for the possibility of short-circuit
@@ -2425,10 +2425,10 @@ cost_qual_eval_walker(Node *node, cost_qual_eval_context *context)
else if (IsA(node, AlternativeSubPlan))
{
/*
- * Arbitrarily use the first alternative plan for costing. (We should
+ * Arbitrarily use the first alternative plan for costing. (We should
* certainly only include one alternative, and we don't yet have
- * enough information to know which one the executor is most likely
- * to use.)
+ * enough information to know which one the executor is most likely to
+ * use.)
*/
AlternativeSubPlan *asplan = (AlternativeSubPlan *) node;
@@ -2495,8 +2495,8 @@ adjust_semi_join(PlannerInfo *root, JoinPath *path, SpecialJoinInfo *sjinfo,
*/
/*
- * In an ANTI join, we must ignore clauses that are "pushed down",
- * since those won't affect the match logic. In a SEMI join, we do not
+ * In an ANTI join, we must ignore clauses that are "pushed down", since
+ * those won't affect the match logic. In a SEMI join, we do not
* distinguish joinquals from "pushed down" quals, so just use the whole
* restrictinfo list.
*/
@@ -2550,15 +2550,15 @@ adjust_semi_join(PlannerInfo *root, JoinPath *path, SpecialJoinInfo *sjinfo,
/*
* jselec can be interpreted as the fraction of outer-rel rows that have
- * any matches (this is true for both SEMI and ANTI cases). And nselec
- * is the fraction of the Cartesian product that matches. So, the
- * average number of matches for each outer-rel row that has at least
- * one match is nselec * inner_rows / jselec.
+ * any matches (this is true for both SEMI and ANTI cases). And nselec is
+ * the fraction of the Cartesian product that matches. So, the average
+ * number of matches for each outer-rel row that has at least one match is
+ * nselec * inner_rows / jselec.
*
* Note: it is correct to use the inner rel's "rows" count here, not
* PATH_ROWS(), even if the inner path under consideration is an inner
- * indexscan. This is because we have included all the join clauses
- * in the selectivity estimate, even ones used in an inner indexscan.
+ * indexscan. This is because we have included all the join clauses in
+ * the selectivity estimate, even ones used in an inner indexscan.
*/
if (jselec > 0) /* protect against zero divide */
{
@@ -2573,10 +2573,9 @@ adjust_semi_join(PlannerInfo *root, JoinPath *path, SpecialJoinInfo *sjinfo,
*match_count = avgmatch;
/*
- * If requested, check whether the inner path uses all the joinquals
- * as indexquals. (If that's true, we can assume that an unmatched
- * outer tuple is cheap to process, whereas otherwise it's probably
- * expensive.)
+ * If requested, check whether the inner path uses all the joinquals as
+ * indexquals. (If that's true, we can assume that an unmatched outer
+ * tuple is cheap to process, whereas otherwise it's probably expensive.)
*/
if (indexed_join_quals)
{
@@ -2906,8 +2905,8 @@ set_cte_size_estimates(PlannerInfo *root, RelOptInfo *rel, Plan *cteplan)
if (rte->self_reference)
{
/*
- * In a self-reference, arbitrarily assume the average worktable
- * size is about 10 times the nonrecursive term's size.
+ * In a self-reference, arbitrarily assume the average worktable size
+ * is about 10 times the nonrecursive term's size.
*/
rel->tuples = 10 * cteplan->plan_rows;
}
@@ -2959,7 +2958,8 @@ set_rel_width(PlannerInfo *root, RelOptInfo *rel)
ndx = var->varattno - rel->min_attr;
/*
- * The width probably hasn't been cached yet, but may as well check
+ * The width probably hasn't been cached yet, but may as well
+ * check
*/
if (rel->attr_widths[ndx] > 0)
{
diff --git a/src/backend/optimizer/path/equivclass.c b/src/backend/optimizer/path/equivclass.c
index 17c9539679..17d24e400f 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.18 2009/04/19 19:46:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/equivclass.c,v 1.19 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -438,9 +438,9 @@ get_eclass_for_sort_expr(PlannerInfo *root,
/*
* add_eq_member doesn't check for volatile functions, set-returning
- * functions, aggregates, or window functions, but such could appear
- * in sort expressions; so we have to check whether its const-marking
- * was correct.
+ * functions, aggregates, or window functions, but such could appear in
+ * sort expressions; so we have to check whether its const-marking was
+ * correct.
*/
if (newec->ec_has_const)
{
@@ -563,11 +563,11 @@ generate_base_implied_equalities_const(PlannerInfo *root,
ListCell *lc;
/*
- * In the trivial case where we just had one "var = const" clause,
- * push the original clause back into the main planner machinery. There
- * is nothing to be gained by doing it differently, and we save the
- * effort to re-build and re-analyze an equality clause that will be
- * exactly equivalent to the old one.
+ * In the trivial case where we just had one "var = const" clause, push
+ * the original clause back into the main planner machinery. There is
+ * nothing to be gained by doing it differently, and we save the effort to
+ * re-build and re-analyze an equality clause that will be exactly
+ * equivalent to the old one.
*/
if (list_length(ec->ec_members) == 2 &&
list_length(ec->ec_sources) == 1)
@@ -1166,7 +1166,7 @@ create_join_clause(PlannerInfo *root,
*
* Outer join clauses that are marked outerjoin_delayed are special: this
* condition means that one or both VARs might go to null due to a lower
- * outer join. We can still push a constant through the clause, but only
+ * outer join. We can still push a constant through the clause, but only
* if its operator is strict; and we *have to* throw the clause back into
* regular joinclause processing. By keeping the strict join clause,
* we ensure that any null-extended rows that are mistakenly generated due
@@ -1816,11 +1816,11 @@ have_relevant_eclass_joinclause(PlannerInfo *root,
* path to look through ec_sources. Checking the members anyway is OK
* as a possibly-overoptimistic heuristic.
*
- * We don't test ec_has_const either, even though a const eclass
- * won't generate real join clauses. This is because if we had
- * "WHERE a.x = b.y and a.x = 42", it is worth considering a join
- * between a and b, since the join result is likely to be small even
- * though it'll end up being an unqualified nestloop.
+ * We don't test ec_has_const either, even though a const eclass won't
+ * generate real join clauses. This is because if we had "WHERE a.x =
+ * b.y and a.x = 42", it is worth considering a join between a and b,
+ * since the join result is likely to be small even though it'll end
+ * up being an unqualified nestloop.
*/
/* Needn't scan if it couldn't contain members from each rel */
@@ -1890,11 +1890,11 @@ has_relevant_eclass_joinclause(PlannerInfo *root, RelOptInfo *rel1)
* path to look through ec_sources. Checking the members anyway is OK
* as a possibly-overoptimistic heuristic.
*
- * We don't test ec_has_const either, even though a const eclass
- * won't generate real join clauses. This is because if we had
- * "WHERE a.x = b.y and a.x = 42", it is worth considering a join
- * between a and b, since the join result is likely to be small even
- * though it'll end up being an unqualified nestloop.
+ * We don't test ec_has_const either, even though a const eclass won't
+ * generate real join clauses. This is because if we had "WHERE a.x =
+ * b.y and a.x = 42", it is worth considering a join between a and b,
+ * since the join result is likely to be small even though it'll end
+ * up being an unqualified nestloop.
*/
/* Needn't scan if it couldn't contain members from each rel */
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index db271e4f1e..b3f96eb773 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.239 2009/04/16 20:42:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.240 2009/06/11 14:48:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -179,14 +179,14 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel)
true, NULL, SAOP_FORBID, ST_ANYSCAN);
/*
- * Submit all the ones that can form plain IndexScan plans to add_path.
- * (A plain IndexPath always represents a plain IndexScan plan; however
- * some of the indexes might support only bitmap scans, and those we
- * mustn't submit to add_path here.) Also, pick out the ones that might
- * be useful as bitmap scans. For that, we must discard indexes that
- * don't support bitmap scans, and we also are only interested in paths
- * that have some selectivity; we should discard anything that was
- * generated solely for ordering purposes.
+ * Submit all the ones that can form plain IndexScan plans to add_path. (A
+ * plain IndexPath always represents a plain IndexScan plan; however some
+ * of the indexes might support only bitmap scans, and those we mustn't
+ * submit to add_path here.) Also, pick out the ones that might be useful
+ * as bitmap scans. For that, we must discard indexes that don't support
+ * bitmap scans, and we also are only interested in paths that have some
+ * selectivity; we should discard anything that was generated solely for
+ * ordering purposes.
*/
bitindexpaths = NIL;
foreach(l, indexpaths)
@@ -1628,13 +1628,13 @@ eclass_matches_any_index(EquivalenceClass *ec, EquivalenceMember *em,
/*
* If it's a btree index, we can reject it if its opfamily isn't
- * compatible with the EC, since no clause generated from the
- * EC could be used with the index. For non-btree indexes,
- * we can't easily tell whether clauses generated from the EC
- * could be used with the index, so only check for expression
- * match. This might mean we return "true" for a useless index,
- * but that will just cause some wasted planner cycles; it's
- * better than ignoring useful indexes.
+ * compatible with the EC, since no clause generated from the EC
+ * could be used with the index. For non-btree indexes, we can't
+ * easily tell whether clauses generated from the EC could be used
+ * with the index, so only check for expression match. This might
+ * mean we return "true" for a useless index, but that will just
+ * cause some wasted planner cycles; it's better than ignoring
+ * useful indexes.
*/
if ((index->relam != BTREE_AM_OID ||
list_member_oid(ec->ec_opfamilies, curFamily)) &&
@@ -2223,9 +2223,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.
*
- * Note: actually, in the Pattern_Prefix_Exact case, we only need "="
- * so a hash index would work. Currently it doesn't seem worth checking
- * for that, however.
+ * Note: actually, in the Pattern_Prefix_Exact case, we only need "=" so a
+ * hash index would work. Currently it doesn't seem worth checking for
+ * that, however.
*
* 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
@@ -2460,7 +2460,7 @@ expand_indexqual_opclause(RestrictInfo *rinfo, Oid opfamily)
/*
* LIKE and regex operators are not members of any btree index opfamily,
* but they can be members of opfamilies for more exotic index types such
- * as GIN. Therefore, we should only do expansion if the operator is
+ * as GIN. Therefore, we should only do expansion if the operator is
* actually not in the opfamily. But checking that requires a syscache
* lookup, so it's best to first see if the operator is one we are
* interested in.
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index e172c43c3c..bc0831933e 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.121 2009/02/05 01:24:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.122 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1022,14 +1022,14 @@ select_mergejoin_clauses(PlannerInfo *root,
* Note: it would be bad if this condition failed for an otherwise
* mergejoinable FULL JOIN clause, since that would result in
* undesirable planner failure. I believe that is not possible
- * however; a variable involved in a full join could only appear
- * in below_outer_join eclasses, which aren't considered redundant.
+ * however; a variable involved in a full join could only appear in
+ * below_outer_join eclasses, which aren't considered redundant.
*
- * This case *can* happen for left/right join clauses: the
- * outer-side variable could be equated to a constant. Because we
- * will propagate that constant across the join clause, the loss of
- * ability to do a mergejoin is not really all that big a deal, and
- * so it's not clear that improving this is important.
+ * This case *can* happen for left/right join clauses: the outer-side
+ * variable could be equated to a constant. Because we will propagate
+ * that constant across the join clause, the loss of ability to do a
+ * mergejoin is not really all that big a deal, and so it's not clear
+ * that improving this is important.
*/
cache_mergeclause_eclasses(root, restrictinfo);
diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c
index 7c38607db6..9e6f57f4c9 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.99 2009/02/27 22:41:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/joinrels.c,v 1.100 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -353,7 +353,7 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
ListCell *l;
/*
- * Ensure output params are set on failure return. This is just to
+ * Ensure output params are set on failure return. This is just to
* suppress uninitialized-variable warnings from overly anal compilers.
*/
*sjinfo_p = NULL;
@@ -361,7 +361,7 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
/*
* If we have any special joins, the proposed join might be illegal; and
- * in any case we have to determine its join type. Scan the join info
+ * in any case we have to determine its join type. Scan the join info
* list for conflicts.
*/
match_sjinfo = NULL;
@@ -569,7 +569,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
/*
* If it's a plain inner join, then we won't have found anything in
- * join_info_list. Make up a SpecialJoinInfo so that selectivity
+ * join_info_list. Make up a SpecialJoinInfo so that selectivity
* estimation functions will know what's being joined.
*/
if (sjinfo == NULL)
@@ -595,8 +595,8 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
&restrictlist);
/*
- * If we've already proven this join is empty, we needn't consider
- * any more paths for it.
+ * If we've already proven this join is empty, we needn't consider any
+ * more paths for it.
*/
if (is_dummy_rel(joinrel))
{
@@ -605,19 +605,19 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
}
/*
- * Consider paths using each rel as both outer and inner. Depending
- * on the join type, a provably empty outer or inner rel might mean
- * the join is provably empty too; in which case throw away any
- * previously computed paths and mark the join as dummy. (We do it
- * this way since it's conceivable that dummy-ness of a multi-element
- * join might only be noticeable for certain construction paths.)
+ * Consider paths using each rel as both outer and inner. Depending on
+ * the join type, a provably empty outer or inner rel might mean the join
+ * is provably empty too; in which case throw away any previously computed
+ * paths and mark the join as dummy. (We do it this way since it's
+ * conceivable that dummy-ness of a multi-element join might only be
+ * noticeable for certain construction paths.)
*
* Also, a provably constant-false join restriction typically means that
- * we can skip evaluating one or both sides of the join. We do this
- * by marking the appropriate rel as dummy.
+ * we can skip evaluating one or both sides of the join. We do this by
+ * marking the appropriate rel as dummy.
*
- * We need only consider the jointypes that appear in join_info_list,
- * plus JOIN_INNER.
+ * We need only consider the jointypes that appear in join_info_list, plus
+ * JOIN_INNER.
*/
switch (sjinfo->jointype)
{
@@ -665,6 +665,7 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
restrictlist);
break;
case JOIN_SEMI:
+
/*
* We might have a normal semijoin, or a case where we don't have
* enough rels to do the semijoin but can unique-ify the RHS and
@@ -971,12 +972,12 @@ restriction_is_constant_false(List *restrictlist)
*/
foreach(lc, restrictlist)
{
- RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
+ RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
Assert(IsA(rinfo, RestrictInfo));
if (rinfo->clause && IsA(rinfo->clause, Const))
{
- Const *con = (Const *) rinfo->clause;
+ Const *con = (Const *) rinfo->clause;
/* constant NULL is as good as constant FALSE for our purposes */
if (con->constisnull)
diff --git a/src/backend/optimizer/path/orindxpath.c b/src/backend/optimizer/path/orindxpath.c
index c84591fe0c..6a644f9a0f 100644
--- a/src/backend/optimizer/path/orindxpath.c
+++ b/src/backend/optimizer/path/orindxpath.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.89 2009/04/16 20:42:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.90 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -96,10 +96,10 @@ create_or_index_quals(PlannerInfo *root, RelOptInfo *rel)
* enforced at the relation scan level.
*
* We must also ignore clauses that are marked !is_pushed_down (ie they
- * are themselves outer-join clauses). It would be safe to extract an
+ * are themselves outer-join clauses). It would be safe to extract an
* index condition from such a clause if we are within the nullable rather
* than the non-nullable side of its join, but we haven't got enough
- * context here to tell which applies. OR clauses in outer-join quals
+ * context here to tell which applies. OR clauses in outer-join quals
* aren't exactly common, so we'll let that case go unoptimized for now.
*/
foreach(i, rel->joininfo)
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index 2aabd880aa..ab07a0dbea 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.259 2009/05/09 22:51:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.260 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,9 +63,9 @@ static FunctionScan *create_functionscan_plan(PlannerInfo *root, Path *best_path
static ValuesScan *create_valuesscan_plan(PlannerInfo *root, Path *best_path,
List *tlist, List *scan_clauses);
static CteScan *create_ctescan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static WorkTableScan *create_worktablescan_plan(PlannerInfo *root, Path *best_path,
- List *tlist, List *scan_clauses);
+ List *tlist, List *scan_clauses);
static NestLoop *create_nestloop_plan(PlannerInfo *root, NestPath *best_path,
Plan *outer_plan, Plan *inner_plan);
static MergeJoin *create_mergejoin_plan(PlannerInfo *root, MergePath *best_path,
@@ -98,9 +98,9 @@ static FunctionScan *make_functionscan(List *qptlist, List *qpqual,
static ValuesScan *make_valuesscan(List *qptlist, List *qpqual,
Index scanrelid, List *values_lists);
static CteScan *make_ctescan(List *qptlist, List *qpqual,
- Index scanrelid, int ctePlanId, int cteParam);
+ Index scanrelid, int ctePlanId, int cteParam);
static WorkTableScan *make_worktablescan(List *qptlist, List *qpqual,
- Index scanrelid, int wtParam);
+ Index scanrelid, int wtParam);
static BitmapAnd *make_bitmap_and(List *bitmapplans);
static BitmapOr *make_bitmap_or(List *bitmapplans);
static NestLoop *make_nestloop(List *tlist,
@@ -113,10 +113,10 @@ static HashJoin *make_hashjoin(List *tlist,
Plan *lefttree, Plan *righttree,
JoinType jointype);
static Hash *make_hash(Plan *lefttree,
- Oid skewTable,
- AttrNumber skewColumn,
- Oid skewColType,
- int32 skewColTypmod);
+ Oid skewTable,
+ AttrNumber skewColumn,
+ Oid skewColType,
+ int32 skewColTypmod);
static MergeJoin *make_mergejoin(List *tlist,
List *joinclauses, List *otherclauses,
List *mergeclauses,
@@ -329,7 +329,7 @@ build_relation_tlist(RelOptInfo *rel)
foreach(v, rel->reltargetlist)
{
/* Do we really need to copy here? Not sure */
- Node *node = (Node *) copyObject(lfirst(v));
+ Node *node = (Node *) copyObject(lfirst(v));
tlist = lappend(tlist, makeTargetEntry((Expr *) node,
resno,
@@ -657,20 +657,20 @@ create_unique_plan(PlannerInfo *root, UniquePath *best_path)
return subplan;
/*
- * As constructed, the subplan has a "flat" tlist containing just the
- * Vars needed here and at upper levels. The values we are supposed
- * to unique-ify may be expressions in these variables. We have to
- * add any such expressions to the subplan's tlist.
+ * As constructed, the subplan has a "flat" tlist containing just the Vars
+ * needed here and at upper levels. The values we are supposed to
+ * unique-ify may be expressions in these variables. We have to add any
+ * such expressions to the subplan's tlist.
*
- * The subplan may have a "physical" tlist if it is a simple scan plan.
- * If we're going to sort, this should be reduced to the regular tlist,
- * so that we don't sort more data than we need to. For hashing, the
- * tlist should be left as-is if we don't need to add any expressions;
- * but if we do have to add expressions, then a projection step will be
- * needed at runtime anyway, so we may as well remove unneeded items.
- * Therefore newtlist starts from build_relation_tlist() not just a
- * copy of the subplan's tlist; and we don't install it into the subplan
- * unless we are sorting or stuff has to be added.
+ * The subplan may have a "physical" tlist if it is a simple scan plan. If
+ * we're going to sort, this should be reduced to the regular tlist, so
+ * that we don't sort more data than we need to. For hashing, the tlist
+ * should be left as-is if we don't need to add any expressions; but if we
+ * do have to add expressions, then a projection step will be needed at
+ * runtime anyway, so we may as well remove unneeded items. Therefore
+ * newtlist starts from build_relation_tlist() not just a copy of the
+ * subplan's tlist; and we don't install it into the subplan unless we are
+ * sorting or stuff has to be added.
*/
in_operators = best_path->in_operators;
uniq_exprs = best_path->uniq_exprs;
@@ -1063,10 +1063,10 @@ create_bitmap_scan_plan(PlannerInfo *root,
qpqual = order_qual_clauses(root, qpqual);
/*
- * When dealing with special operators, we will at this point
- * have duplicate clauses in qpqual and bitmapqualorig. We may as well
- * drop 'em from bitmapqualorig, since there's no point in making the
- * tests twice.
+ * When dealing with special operators, we will at this point have
+ * duplicate clauses in qpqual and bitmapqualorig. We may as well drop
+ * 'em from bitmapqualorig, since there's no point in making the tests
+ * twice.
*/
bitmapqualorig = list_difference_ptr(bitmapqualorig, qpqual);
@@ -1414,10 +1414,10 @@ static CteScan *
create_ctescan_plan(PlannerInfo *root, Path *best_path,
List *tlist, List *scan_clauses)
{
- CteScan *scan_plan;
+ CteScan *scan_plan;
Index scan_relid = best_path->parent->relid;
RangeTblEntry *rte;
- SubPlan *ctesplan = NULL;
+ SubPlan *ctesplan = NULL;
int plan_id;
int cte_param_id;
PlannerInfo *cteroot;
@@ -1441,6 +1441,7 @@ create_ctescan_plan(PlannerInfo *root, Path *best_path,
if (!cteroot) /* shouldn't happen */
elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename);
}
+
/*
* Note: cte_plan_ids can be shorter than cteList, if we are still working
* on planning the CTEs (ie, this is a side-reference from another CTE).
@@ -1471,8 +1472,8 @@ create_ctescan_plan(PlannerInfo *root, Path *best_path,
elog(ERROR, "could not find plan for CTE \"%s\"", rte->ctename);
/*
- * We need the CTE param ID, which is the sole member of the
- * SubPlan's setParam list.
+ * We need the CTE param ID, which is the sole member of the SubPlan's
+ * setParam list.
*/
cte_param_id = linitial_int(ctesplan->setParam);
@@ -1512,12 +1513,12 @@ create_worktablescan_plan(PlannerInfo *root, Path *best_path,
/*
* We need to find the worktable param ID, which is in the plan level
- * that's processing the recursive UNION, which is one level *below*
- * where the CTE comes from.
+ * that's processing the recursive UNION, which is one level *below* where
+ * the CTE comes from.
*/
levelsup = rte->ctelevelsup;
if (levelsup == 0) /* shouldn't happen */
- elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename);
+ elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename);
levelsup--;
cteroot = root;
while (levelsup-- > 0)
@@ -1526,7 +1527,7 @@ create_worktablescan_plan(PlannerInfo *root, Path *best_path,
if (!cteroot) /* shouldn't happen */
elog(ERROR, "bad levelsup for CTE \"%s\"", rte->ctename);
}
- if (cteroot->wt_param_id < 0) /* shouldn't happen */
+ if (cteroot->wt_param_id < 0) /* shouldn't happen */
elog(ERROR, "could not find param ID for CTE \"%s\"", rte->ctename);
/* Sort clauses into best execution order */
@@ -1563,10 +1564,9 @@ create_nestloop_plan(PlannerInfo *root,
NestLoop *join_plan;
/*
- * If the inner path is a nestloop inner indexscan, it might be using
- * some of the join quals as index quals, in which case we don't have
- * to check them again at the join node. Remove any join quals that
- * are redundant.
+ * If the inner path is a nestloop inner indexscan, it might be using some
+ * of the join quals as index quals, in which case we don't have to check
+ * them again at the join node. Remove any join quals that are redundant.
*/
joinrestrictclauses =
select_nonredundant_join_clauses(root,
@@ -1869,12 +1869,12 @@ create_hashjoin_plan(PlannerInfo *root,
disuse_physical_tlist(outer_plan, best_path->jpath.outerjoinpath);
/*
- * If there is a single join clause and we can identify the outer
- * variable as a simple column reference, supply its identity for
- * possible use in skew optimization. (Note: in principle we could
- * do skew optimization with multiple join clauses, but we'd have to
- * be able to determine the most common combinations of outer values,
- * which we don't currently have enough stats for.)
+ * If there is a single join clause and we can identify the outer variable
+ * as a simple column reference, supply its identity for possible use in
+ * skew optimization. (Note: in principle we could do skew optimization
+ * with multiple join clauses, but we'd have to be able to determine the
+ * most common combinations of outer values, which we don't currently have
+ * enough stats for.)
*/
if (list_length(hashclauses) == 1)
{
@@ -1887,7 +1887,7 @@ create_hashjoin_plan(PlannerInfo *root,
node = (Node *) ((RelabelType *) node)->arg;
if (IsA(node, Var))
{
- Var *var = (Var *) node;
+ Var *var = (Var *) node;
RangeTblEntry *rte;
rte = root->simple_rte_array[var->varno];
@@ -2029,8 +2029,8 @@ fix_indexqual_references(List *indexquals, IndexPath *index_path)
/* Never need to commute... */
/*
- * Determine which index attribute this is and change the
- * indexkey operand as needed.
+ * Determine which index attribute this is and change the indexkey
+ * operand as needed.
*/
linitial(saop->args) = fix_indexqual_operand(linitial(saop->args),
index);
@@ -2506,7 +2506,7 @@ make_ctescan(List *qptlist,
int ctePlanId,
int cteParam)
{
- CteScan *node = makeNode(CteScan);
+ CteScan *node = makeNode(CteScan);
Plan *plan = &node->scan.plan;
/* cost should be inserted by caller */
@@ -3282,7 +3282,7 @@ make_windowagg(PlannerInfo *root, List *tlist,
{
WindowAgg *node = makeNode(WindowAgg);
Plan *plan = &node->plan;
- Path windowagg_path; /* dummy for result of cost_windowagg */
+ Path windowagg_path; /* dummy for result of cost_windowagg */
QualCost qual_cost;
node->winref = winref;
@@ -3294,7 +3294,7 @@ make_windowagg(PlannerInfo *root, List *tlist,
node->ordOperators = ordOperators;
node->frameOptions = frameOptions;
- copy_plan_costsize(plan, lefttree); /* only care about copying size */
+ copy_plan_costsize(plan, lefttree); /* only care about copying size */
cost_windowagg(&windowagg_path, root,
numWindowFuncs, partNumCols, ordNumCols,
lefttree->startup_cost,
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index 56100ba6cc..8a189d4443 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.153 2009/05/07 20:13:09 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.154 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -332,7 +332,7 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join,
*/
foreach(l, (List *) f->quals)
{
- Node *qual = (Node *) lfirst(l);
+ Node *qual = (Node *) lfirst(l);
distribute_qual_to_rels(root, qual,
false, below_outer_join, JOIN_INNER,
@@ -430,8 +430,8 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join,
* we mustn't add it to join_info_list just yet, because we don't want
* distribute_qual_to_rels to think it is an outer join below us.
*
- * Semijoins are a bit of a hybrid: we build a SpecialJoinInfo,
- * but we want ojscope = NULL for distribute_qual_to_rels.
+ * Semijoins are a bit of a hybrid: we build a SpecialJoinInfo, but we
+ * want ojscope = NULL for distribute_qual_to_rels.
*/
if (j->jointype != JOIN_INNER)
{
@@ -455,7 +455,7 @@ deconstruct_recurse(PlannerInfo *root, Node *jtnode, bool below_outer_join,
/* Process the qual clauses */
foreach(l, (List *) j->quals)
{
- Node *qual = (Node *) lfirst(l);
+ Node *qual = (Node *) lfirst(l);
distribute_qual_to_rels(root, qual,
false, below_outer_join, j->jointype,
@@ -629,9 +629,9 @@ make_outerjoininfo(PlannerInfo *root,
* 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.) Also, if the
- * current join is an antijoin, we must preserve ordering regardless
- * of strictness.
+ * commute with them if we don't with this one.) Also, if the current
+ * join is an antijoin, we must preserve ordering regardless of
+ * strictness.
*
* 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.
@@ -882,7 +882,7 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
* 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 it is mergejoinable. So consider adding it to the
+ * deductions, if it is mergejoinable. So consider adding it to the
* lists of set-aside outer-join clauses.
*/
is_pushed_down = false;
@@ -937,8 +937,8 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
/*
* It's possible that this is an IS NULL clause that's redundant
* with a lower antijoin; if so we can just discard it. We need
- * not test in any of the other cases, because this will only
- * be possible for pushed-down, delayed clauses.
+ * not test in any of the other cases, because this will only be
+ * possible for pushed-down, delayed clauses.
*/
if (check_redundant_nullability_qual(root, clause))
return;
@@ -1122,8 +1122,8 @@ distribute_qual_to_rels(PlannerInfo *root, Node *clause,
*/
static bool
check_outerjoin_delay(PlannerInfo *root,
- Relids *relids_p, /* in/out parameter */
- Relids *nullable_relids_p, /* output parameter */
+ Relids *relids_p, /* in/out parameter */
+ Relids *nullable_relids_p, /* output parameter */
bool is_pushed_down)
{
Relids relids;
@@ -1215,8 +1215,8 @@ check_redundant_nullability_qual(PlannerInfo *root, Node *clause)
forced_null_rel = forced_null_var->varno;
/*
- * If the Var comes from the nullable side of a lower antijoin, the
- * IS NULL condition is necessarily true.
+ * If the Var comes from the nullable side of a lower antijoin, the IS
+ * NULL condition is necessarily true.
*/
foreach(lc, root->join_info_list)
{
@@ -1393,7 +1393,7 @@ build_implied_join_equality(Oid opno,
true, /* is_pushed_down */
false, /* outerjoin_delayed */
false, /* pseudoconstant */
- qualscope, /* required_relids */
+ qualscope, /* required_relids */
NULL); /* nullable_relids */
/* Set mergejoinability info always, and hashjoinability if enabled */
diff --git a/src/backend/optimizer/plan/planagg.c b/src/backend/optimizer/plan/planagg.c
index 0cdcb74dfe..6bdbd2a913 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.45 2009/01/01 17:23:44 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planagg.c,v 1.46 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -96,8 +96,8 @@ optimize_minmax_aggregates(PlannerInfo *root, List *tlist, Path *best_path)
* Reject unoptimizable cases.
*
* We don't handle GROUP BY or windowing, because our current
- * implementations of grouping require looking at all the rows anyway,
- * and so there's not much point in optimizing MIN/MAX.
+ * implementations of grouping require looking at all the rows anyway, and
+ * so there's not much point in optimizing MIN/MAX.
*/
if (parse->groupClause || parse->hasWindowFuncs)
return NULL;
@@ -189,12 +189,12 @@ optimize_minmax_aggregates(PlannerInfo *root, List *tlist, Path *best_path)
&aggs_list);
/*
- * We have to replace Aggrefs with Params in equivalence classes too,
- * else ORDER BY or DISTINCT on an optimized aggregate will fail.
+ * We have to replace Aggrefs with Params in equivalence classes too, else
+ * ORDER BY or DISTINCT on an optimized aggregate will fail.
*
- * Note: at some point it might become necessary to mutate other
- * data structures too, such as the query's sortClause or distinctClause.
- * Right now, those won't be examined after this point.
+ * Note: at some point it might become necessary to mutate other data
+ * structures too, such as the query's sortClause or distinctClause. Right
+ * now, those won't be examined after this point.
*/
mutate_eclass_expressions(root,
replace_aggs_with_params_mutator,
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c
index c87da7a071..0b75d150ab 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.114 2009/01/01 17:23:44 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planmain.c,v 1.115 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -289,13 +289,13 @@ query_planner(PlannerInfo *root, List *tlist,
/*
* If both GROUP BY and ORDER BY are specified, we will need two
* levels of sort --- and, therefore, certainly need to read all the
- * tuples --- unless ORDER BY is a subset of GROUP BY. Likewise if
- * we have both DISTINCT and GROUP BY, or if we have a window
+ * tuples --- unless ORDER BY is a subset of GROUP BY. Likewise if we
+ * have both DISTINCT and GROUP BY, or if we have a window
* specification not compatible with the GROUP BY.
*/
if (!pathkeys_contained_in(root->sort_pathkeys, root->group_pathkeys) ||
!pathkeys_contained_in(root->distinct_pathkeys, root->group_pathkeys) ||
- !pathkeys_contained_in(root->window_pathkeys, root->group_pathkeys))
+ !pathkeys_contained_in(root->window_pathkeys, root->group_pathkeys))
tuple_fraction = 0.0;
}
else if (parse->hasAggs || root->hasHavingQual)
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 7ad15d9da2..3f344b3a14 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.255 2009/04/28 21:31:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/planner.c,v 1.256 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,7 +43,7 @@
/* GUC parameter */
-double cursor_tuple_fraction = DEFAULT_CURSOR_TUPLE_FRACTION;
+double cursor_tuple_fraction = DEFAULT_CURSOR_TUPLE_FRACTION;
/* Hook for plugins to get control in planner() */
planner_hook_type planner_hook = NULL;
@@ -84,18 +84,18 @@ static void locate_grouping_columns(PlannerInfo *root,
static List *postprocess_setop_tlist(List *new_tlist, List *orig_tlist);
static List *select_active_windows(PlannerInfo *root, WindowFuncLists *wflists);
static List *add_volatile_sort_exprs(List *window_tlist, List *tlist,
- List *activeWindows);
+ List *activeWindows);
static List *make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc,
- List *tlist, bool canonicalize);
+ List *tlist, bool canonicalize);
static void get_column_info_for_window(PlannerInfo *root, WindowClause *wc,
- List *tlist,
- int numSortCols, AttrNumber *sortColIdx,
- int *partNumCols,
- AttrNumber **partColIdx,
- Oid **partOperators,
- int *ordNumCols,
- AttrNumber **ordColIdx,
- Oid **ordOperators);
+ List *tlist,
+ int numSortCols, AttrNumber *sortColIdx,
+ int *partNumCols,
+ AttrNumber **partColIdx,
+ Oid **partOperators,
+ int *ordNumCols,
+ AttrNumber **ordColIdx,
+ Oid **ordOperators);
/*****************************************************************************
@@ -171,10 +171,9 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
tuple_fraction = cursor_tuple_fraction;
/*
- * We document cursor_tuple_fraction as simply being a fraction,
- * which means the edge cases 0 and 1 have to be treated specially
- * here. We convert 1 to 0 ("all the tuples") and 0 to a very small
- * fraction.
+ * We document cursor_tuple_fraction as simply being a fraction, which
+ * means the edge cases 0 and 1 have to be treated specially here. We
+ * convert 1 to 0 ("all the tuples") and 0 to a very small fraction.
*/
if (tuple_fraction >= 1.0)
tuple_fraction = 0.0;
@@ -297,8 +296,8 @@ subquery_planner(PlannerGlobal *glob, Query *parse,
root->non_recursive_plan = NULL;
/*
- * If there is a WITH list, process each WITH query and build an
- * initplan SubPlan structure for it.
+ * If there is a WITH list, process each WITH query and build an initplan
+ * SubPlan structure for it.
*/
if (parse->cteList)
SS_process_ctes(root);
@@ -313,8 +312,8 @@ subquery_planner(PlannerGlobal *glob, Query *parse,
pull_up_sublinks(root);
/*
- * Scan the rangetable for set-returning functions, and inline them
- * if possible (producing subqueries that might get pulled up next).
+ * Scan the rangetable for set-returning functions, and inline them if
+ * possible (producing subqueries that might get pulled up next).
* Recursion issues here are handled in the same way as for SubLinks.
*/
inline_set_returning_functions(root);
@@ -329,8 +328,8 @@ subquery_planner(PlannerGlobal *glob, Query *parse,
/*
* Detect whether any rangetable entries are RTE_JOIN kind; if not, we can
* avoid the expense of doing flatten_join_alias_vars(). Also check for
- * outer joins --- if none, we can skip reduce_outer_joins().
- * This must be done after we have done pull_up_subqueries, of course.
+ * outer joins --- if none, we can skip reduce_outer_joins(). This must be
+ * done after we have done pull_up_subqueries, of course.
*/
root->hasJoinRTEs = false;
hasOuterJoins = false;
@@ -528,7 +527,7 @@ preprocess_expression(PlannerInfo *root, Node *expr, int kind)
* Simplify constant expressions.
*
* Note: one essential effect here is to insert the current actual values
- * of any default arguments for functions. To ensure that happens, we
+ * of any default arguments for functions. To ensure that happens, we
* *must* process all expressions here. Previous PG versions sometimes
* skipped const-simplification if it didn't seem worth the trouble, but
* we can't do that anymore.
@@ -797,8 +796,8 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
/*
* If there's a top-level ORDER BY, assume we have to fetch all the
* tuples. This might be too simplistic given all the hackery below
- * to possibly avoid the sort; but the odds of accurate estimates
- * here are pretty low anyway.
+ * to possibly avoid the sort; but the odds of accurate estimates here
+ * are pretty low anyway.
*/
if (parse->sortClause)
tuple_fraction = 0.0;
@@ -908,9 +907,9 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
/*
* Calculate pathkeys that represent grouping/ordering requirements.
* Stash them in PlannerInfo so that query_planner can canonicalize
- * them after EquivalenceClasses have been formed. The sortClause
- * is certainly sort-able, but GROUP BY and DISTINCT might not be,
- * in which case we just leave their pathkeys empty.
+ * them after EquivalenceClasses have been formed. The sortClause is
+ * certainly sort-able, but GROUP BY and DISTINCT might not be, in
+ * which case we just leave their pathkeys empty.
*/
if (parse->groupClause &&
grouping_is_sortable(parse->groupClause))
@@ -982,7 +981,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
* Note: if we have both ORDER BY and GROUP BY, and ORDER BY is a
* superset of GROUP BY, it would be tempting to request sort by ORDER
* BY --- but that might just leave us failing to exploit an available
- * sort order at all. Needs more thought. The choice for DISTINCT
+ * sort order at all. Needs more thought. The choice for DISTINCT
* versus ORDER BY is much easier, since we know that the parser
* ensured that one is a superset of the other.
*/
@@ -1012,12 +1011,12 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
*/
if (parse->groupClause)
{
- bool can_hash;
- bool can_sort;
+ bool can_hash;
+ bool can_sort;
/*
* Executor doesn't support hashed aggregation with DISTINCT
- * aggregates. (Doing so would imply storing *all* the input
+ * aggregates. (Doing so would imply storing *all* the input
* values in the hash table, which seems like a certain loser.)
*/
can_hash = (agg_counts.numDistinctAggs == 0 &&
@@ -1079,16 +1078,17 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
* Normal case --- create a plan according to query_planner's
* results.
*/
- bool need_sort_for_grouping = false;
+ bool need_sort_for_grouping = false;
result_plan = create_plan(root, best_path);
current_pathkeys = best_path->pathkeys;
/* Detect if we'll need an explicit sort for grouping */
if (parse->groupClause && !use_hashed_grouping &&
- !pathkeys_contained_in(root->group_pathkeys, current_pathkeys))
+ !pathkeys_contained_in(root->group_pathkeys, current_pathkeys))
{
need_sort_for_grouping = true;
+
/*
* Always override query_planner's tlist, so that we don't
* sort useless data from a "physical" tlist.
@@ -1275,9 +1275,9 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
} /* end of non-minmax-aggregate case */
/*
- * Since each window function could require a different sort order,
- * we stack up a WindowAgg node for each window, with sort steps
- * between them as needed.
+ * Since each window function could require a different sort order, we
+ * stack up a WindowAgg node for each window, with sort steps between
+ * them as needed.
*/
if (activeWindows)
{
@@ -1286,12 +1286,12 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
/*
* If the top-level plan node is one that cannot do expression
- * evaluation, we must insert a Result node to project the
- * desired tlist. (In some cases this might not really be
- * required, but it's not worth trying to avoid it.) Note that
- * on second and subsequent passes through the following loop,
- * the top-level node will be a WindowAgg which we know can
- * project; so we only need to check once.
+ * evaluation, we must insert a Result node to project the desired
+ * tlist. (In some cases this might not really be required, but
+ * it's not worth trying to avoid it.) Note that on second and
+ * subsequent passes through the following loop, the top-level
+ * node will be a WindowAgg which we know can project; so we only
+ * need to check once.
*/
if (!is_projection_capable_plan(result_plan))
{
@@ -1302,21 +1302,20 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
}
/*
- * The "base" targetlist for all steps of the windowing process
- * is a flat tlist of all Vars and Aggs needed in the result.
- * (In some cases we wouldn't need to propagate all of these
- * all the way to the top, since they might only be needed as
- * inputs to WindowFuncs. It's probably not worth trying to
- * optimize that though.) We also need any volatile sort
- * expressions, because make_sort_from_pathkeys won't add those
- * on its own, and anyway we want them evaluated only once at
- * the bottom of the stack. As we climb up the stack, we add
- * outputs for the WindowFuncs computed at each level. Also,
- * each input tlist has to present all the columns needed to
- * sort the data for the next WindowAgg step. That's handled
- * internally by make_sort_from_pathkeys, but we need the
- * copyObject steps here to ensure that each plan node has
- * a separately modifiable tlist.
+ * The "base" targetlist for all steps of the windowing process is
+ * a flat tlist of all Vars and Aggs needed in the result. (In
+ * some cases we wouldn't need to propagate all of these all the
+ * way to the top, since they might only be needed as inputs to
+ * WindowFuncs. It's probably not worth trying to optimize that
+ * though.) We also need any volatile sort expressions, because
+ * make_sort_from_pathkeys won't add those on its own, and anyway
+ * we want them evaluated only once at the bottom of the stack.
+ * As we climb up the stack, we add outputs for the WindowFuncs
+ * computed at each level. Also, each input tlist has to present
+ * all the columns needed to sort the data for the next WindowAgg
+ * step. That's handled internally by make_sort_from_pathkeys,
+ * but we need the copyObject steps here to ensure that each plan
+ * node has a separately modifiable tlist.
*/
window_tlist = flatten_tlist(tlist);
if (parse->hasAggs)
@@ -1392,7 +1391,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
{
/* Add the current WindowFuncs to the running tlist */
window_tlist = add_to_flat_tlist(window_tlist,
- wflists->windowFuncs[wc->winref]);
+ wflists->windowFuncs[wc->winref]);
}
else
{
@@ -1404,7 +1403,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
result_plan = (Plan *)
make_windowagg(root,
(List *) copyObject(window_tlist),
- list_length(wflists->windowFuncs[wc->winref]),
+ list_length(wflists->windowFuncs[wc->winref]),
wc->winref,
partNumCols,
partColIdx,
@@ -1423,11 +1422,11 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
*/
if (parse->distinctClause)
{
- double dNumDistinctRows;
- long numDistinctRows;
- bool use_hashed_distinct;
- bool can_sort;
- bool can_hash;
+ double dNumDistinctRows;
+ long numDistinctRows;
+ bool use_hashed_distinct;
+ bool can_sort;
+ bool can_hash;
/*
* If there was grouping or aggregation, use the current number of
@@ -1472,7 +1471,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("could not implement DISTINCT"),
errdetail("Some of the datatypes only support hashing, while others only support sorting.")));
- use_hashed_distinct = false; /* keep compiler quiet */
+ use_hashed_distinct = false; /* keep compiler quiet */
}
}
@@ -1483,10 +1482,10 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
result_plan->targetlist,
NIL,
AGG_HASHED,
- list_length(parse->distinctClause),
- extract_grouping_cols(parse->distinctClause,
- result_plan->targetlist),
- extract_grouping_ops(parse->distinctClause),
+ list_length(parse->distinctClause),
+ extract_grouping_cols(parse->distinctClause,
+ result_plan->targetlist),
+ extract_grouping_ops(parse->distinctClause),
numDistinctRows,
0,
result_plan);
@@ -1502,11 +1501,11 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
* rigorous of DISTINCT and ORDER BY, to avoid a second sort
* below. However, for regular DISTINCT, don't sort now if we
* don't have to --- sorting afterwards will likely be cheaper,
- * and also has the possibility of optimizing via LIMIT. But
- * for DISTINCT ON, we *must* force the final sort now, else
- * it won't have the desired behavior.
+ * and also has the possibility of optimizing via LIMIT. But for
+ * DISTINCT ON, we *must* force the final sort now, else it won't
+ * have the desired behavior.
*/
- List *needed_pathkeys;
+ List *needed_pathkeys;
if (parse->hasDistinctOn &&
list_length(root->distinct_pathkeys) <
@@ -1530,7 +1529,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
result_plan = (Plan *) make_sort_from_pathkeys(root,
result_plan,
- current_pathkeys,
+ current_pathkeys,
-1.0);
}
@@ -1551,7 +1550,7 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
{
result_plan = (Plan *) make_sort_from_pathkeys(root,
result_plan,
- root->sort_pathkeys,
+ root->sort_pathkeys,
limit_tuples);
current_pathkeys = root->sort_pathkeys;
}
@@ -1883,12 +1882,12 @@ preprocess_groupclause(PlannerInfo *root)
return;
/*
- * Add any remaining GROUP BY items to the new list, but only if we
- * were able to make a complete match. In other words, we only
- * rearrange the GROUP BY list if the result is that one list is a
- * prefix of the other --- otherwise there's no possibility of a
- * common sort. Also, give up if there are any non-sortable GROUP BY
- * items, since then there's no hope anyway.
+ * Add any remaining GROUP BY items to the new list, but only if we were
+ * able to make a complete match. In other words, we only rearrange the
+ * GROUP BY list if the result is that one list is a prefix of the other
+ * --- otherwise there's no possibility of a common sort. Also, give up
+ * if there are any non-sortable GROUP BY items, since then there's no
+ * hope anyway.
*/
foreach(gl, parse->groupClause)
{
@@ -1962,11 +1961,10 @@ choose_hashed_grouping(PlannerInfo *root,
/*
* When we have both GROUP BY and DISTINCT, use the more-rigorous of
- * DISTINCT and ORDER BY as the assumed required output sort order.
- * This is an oversimplification because the DISTINCT might get
- * implemented via hashing, but it's not clear that the case is common
- * enough (or that our estimates are good enough) to justify trying to
- * solve it exactly.
+ * DISTINCT and ORDER BY as the assumed required output sort order. This
+ * is an oversimplification because the DISTINCT might get implemented via
+ * hashing, but it's not clear that the case is common enough (or that our
+ * estimates are good enough) to justify trying to solve it exactly.
*/
if (list_length(root->distinct_pathkeys) >
list_length(root->sort_pathkeys))
@@ -2056,7 +2054,7 @@ choose_hashed_grouping(PlannerInfo *root,
* differences that it doesn't seem worth trying to unify the two functions.
*
* But note that making the two choices independently is a bit bogus in
- * itself. If the two could be combined into a single choice operation
+ * itself. If the two could be combined into a single choice operation
* it'd probably be better, but that seems far too unwieldy to be practical,
* especially considering that the combination of GROUP BY and DISTINCT
* isn't very common in real queries. By separating them, we are giving
@@ -2098,8 +2096,8 @@ choose_hashed_distinct(PlannerInfo *root,
* comparison.
*
* We need to consider input_plan + hashagg [+ final sort] versus
- * input_plan [+ sort] + group [+ final sort] where brackets indicate
- * a step that may not be needed.
+ * input_plan [+ sort] + group [+ final sort] where brackets indicate a
+ * step that may not be needed.
*
* These path variables are dummies that just hold cost fields; we don't
* make actual Paths for these steps.
@@ -2108,16 +2106,17 @@ choose_hashed_distinct(PlannerInfo *root,
numDistinctCols, dNumDistinctRows,
input_plan->startup_cost, input_plan->total_cost,
input_plan->plan_rows);
+
/*
- * Result of hashed agg is always unsorted, so if ORDER BY is present
- * we need to charge for the final sort.
+ * Result of hashed agg is always unsorted, so if ORDER BY is present we
+ * need to charge for the final sort.
*/
if (root->parse->sortClause)
cost_sort(&hashed_p, root, root->sort_pathkeys, hashed_p.total_cost,
dNumDistinctRows, input_plan->plan_width, limit_tuples);
/*
- * Now for the GROUP case. See comments in grouping_planner about the
+ * Now for the GROUP case. See comments in grouping_planner about the
* sorting choices here --- this code should match that code.
*/
sorted_p.startup_cost = input_plan->startup_cost;
@@ -2398,10 +2397,10 @@ select_active_windows(PlannerInfo *root, WindowFuncLists *wflists)
* are otherwise distinct (eg, different names or framing clauses).
*
* There is room to be much smarter here, for example detecting whether
- * one window's sort keys are a prefix of another's (so that sorting
- * for the latter would do for the former), or putting windows first
- * that match a sort order available for the underlying query. For the
- * moment we are content with meeting the spec.
+ * one window's sort keys are a prefix of another's (so that sorting for
+ * the latter would do for the former), or putting windows first that
+ * match a sort order available for the underlying query. For the moment
+ * we are content with meeting the spec.
*/
result = NIL;
while (actives != NIL)
@@ -2469,12 +2468,12 @@ add_volatile_sort_exprs(List *window_tlist, List *tlist, List *activeWindows)
}
/*
- * Now scan the original tlist to find the referenced expressions.
- * Any that are volatile must be added to window_tlist.
+ * Now scan the original tlist to find the referenced expressions. Any
+ * that are volatile must be added to window_tlist.
*
- * Note: we know that the input window_tlist contains no items marked
- * with ressortgrouprefs, so we don't have to worry about collisions
- * of the reference numbers.
+ * Note: we know that the input window_tlist contains no items marked with
+ * ressortgrouprefs, so we don't have to worry about collisions of the
+ * reference numbers.
*/
foreach(lc, tlist)
{
@@ -2524,7 +2523,7 @@ make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc,
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("could not implement window ORDER BY"),
- errdetail("Window ordering columns must be of sortable datatypes.")));
+ errdetail("Window ordering columns must be of sortable datatypes.")));
/* Okay, make the combined pathkeys */
window_sortclauses = list_concat(list_copy(wc->partitionClause),
@@ -2545,7 +2544,7 @@ make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc,
* This depends on the behavior of make_pathkeys_for_window()!
*
* We are given the target WindowClause and an array of the input column
- * numbers associated with the resulting pathkeys. In the easy case, there
+ * numbers associated with the resulting pathkeys. In the easy case, there
* are the same number of pathkey columns as partitioning + ordering columns
* and we just have to copy some data around. However, it's possible that
* some of the original partitioning + ordering columns were eliminated as
@@ -2553,11 +2552,11 @@ make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc,
* though the parser gets rid of obvious duplicates. A typical scenario is a
* window specification "PARTITION BY x ORDER BY y" coupled with a clause
* "WHERE x = y" that causes the two sort columns to be recognized as
- * redundant.) In that unusual case, we have to work a lot harder to
+ * redundant.) In that unusual case, we have to work a lot harder to
* determine which keys are significant.
*
* The method used here is a bit brute-force: add the sort columns to a list
- * one at a time and note when the resulting pathkey list gets longer. But
+ * one at a time and note when the resulting pathkey list gets longer. But
* it's a sufficiently uncommon case that a faster way doesn't seem worth
* the amount of code refactoring that'd be needed.
*----------
@@ -2659,7 +2658,7 @@ get_column_info_for_window(PlannerInfo *root, WindowClause *wc, List *tlist,
* Currently, we disallow sublinks in standalone expressions, so there's no
* real "planning" involved here. (That might not always be true though.)
* What we must do is run eval_const_expressions to ensure that any function
- * default arguments get inserted. The fact that constant subexpressions
+ * default arguments get inserted. The fact that constant subexpressions
* get simplified is a side-effect that is useful when the expression will
* get evaluated more than once. Also, we must fix operator function IDs.
*
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index 17016d5f3b..11e14f96c5 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.149 2009/01/22 20:16:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.150 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,7 +116,7 @@ static Node *fix_upper_expr_mutator(Node *node,
fix_upper_expr_context *context);
static bool fix_opfuncids_walker(Node *node, void *context);
static bool extract_query_dependencies_walker(Node *node,
- PlannerGlobal *context);
+ PlannerGlobal *context);
/*****************************************************************************
@@ -349,7 +349,7 @@ set_plan_refs(PlannerGlobal *glob, Plan *plan, int rtoffset)
break;
case T_CteScan:
{
- CteScan *splan = (CteScan *) plan;
+ CteScan *splan = (CteScan *) plan;
splan->scan.scanrelid += rtoffset;
splan->scan.plan.targetlist =
@@ -713,13 +713,13 @@ fix_expr_common(PlannerGlobal *glob, Node *node)
{
set_sa_opfuncid((ScalarArrayOpExpr *) node);
record_plan_function_dependency(glob,
- ((ScalarArrayOpExpr *) node)->opfuncid);
+ ((ScalarArrayOpExpr *) node)->opfuncid);
}
else if (IsA(node, ArrayCoerceExpr))
{
if (OidIsValid(((ArrayCoerceExpr *) node)->elemfuncid))
record_plan_function_dependency(glob,
- ((ArrayCoerceExpr *) node)->elemfuncid);
+ ((ArrayCoerceExpr *) node)->elemfuncid);
}
else if (IsA(node, Const))
{
@@ -759,8 +759,8 @@ fix_scan_expr(PlannerGlobal *glob, Node *node, int rtoffset)
* If rtoffset == 0, we don't need to change any Vars, and if there
* are no placeholders anywhere we won't need to remove them. Then
* it's OK to just scribble on the input node tree instead of copying
- * (since the only change, filling in any unset opfuncid fields,
- * is harmless). This saves just enough cycles to be noticeable on
+ * (since the only change, filling in any unset opfuncid fields, is
+ * harmless). This saves just enough cycles to be noticeable on
* trivial queries.
*/
(void) fix_scan_expr_walker(node, &context);
@@ -1633,11 +1633,11 @@ set_returning_clause_references(PlannerGlobal *glob,
* entries, while leaving result-rel Vars as-is.
*
* PlaceHolderVars will also be sought in the targetlist, but no
- * more-complex expressions will be. Note that it is not possible for
- * a PlaceHolderVar to refer to the result relation, since the result
- * is never below an outer join. If that case could happen, we'd have
- * to be prepared to pick apart the PlaceHolderVar and evaluate its
- * contained expression instead.
+ * more-complex expressions will be. Note that it is not possible for a
+ * PlaceHolderVar to refer to the result relation, since the result is
+ * never below an outer join. If that case could happen, we'd have to be
+ * prepared to pick apart the PlaceHolderVar and evaluate its contained
+ * expression instead.
*/
itlist = build_tlist_index_other_vars(topplan->targetlist, resultRelation);
@@ -1734,8 +1734,8 @@ record_plan_function_dependency(PlannerGlobal *glob, Oid funcid)
* we just assume they'll never change (or at least not in ways that'd
* invalidate plans using them). For this purpose we can consider a
* built-in function to be one with OID less than FirstBootstrapObjectId.
- * Note that the OID generator guarantees never to generate such an
- * OID after startup, even at OID wraparound.
+ * Note that the OID generator guarantees never to generate such an OID
+ * after startup, even at OID wraparound.
*/
if (funcid >= (Oid) FirstBootstrapObjectId)
{
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index 6839e5d99b..cdff123828 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.149 2009/04/25 16:44:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.150 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,9 +56,9 @@ static Node *build_subplan(PlannerInfo *root, Plan *plan, List *rtable,
SubLinkType subLinkType, Node *testexpr,
bool adjust_testexpr, bool unknownEqFalse);
static List *generate_subquery_params(PlannerInfo *root, List *tlist,
- List **paramIds);
+ List **paramIds);
static List *generate_subquery_vars(PlannerInfo *root, List *tlist,
- Index varno);
+ Index varno);
static Node *convert_testexpr(PlannerInfo *root,
Node *testexpr,
List *subst_nodes);
@@ -308,7 +308,7 @@ make_subplan(PlannerInfo *root, Query *orig_subquery, SubLinkType subLinkType,
* path/costsize.c.
*
* XXX If an ANY subplan is uncorrelated, build_subplan may decide to hash
- * its output. In that case it would've been better to specify full
+ * its output. In that case it would've been better to specify full
* retrieval. At present, however, we can only check hashability after
* we've made the subplan :-(. (Determining whether it'll fit in work_mem
* is the really hard part.) Therefore, we don't want to be too
@@ -338,11 +338,11 @@ make_subplan(PlannerInfo *root, Query *orig_subquery, SubLinkType subLinkType,
/*
* If it's a correlated EXISTS with an unimportant targetlist, we might be
* able to transform it to the equivalent of an IN and then implement it
- * by hashing. We don't have enough information yet to tell which way
- * is likely to be better (it depends on the expected number of executions
- * of the EXISTS qual, and we are much too early in planning the outer
- * query to be able to guess that). So we generate both plans, if
- * possible, and leave it to the executor to decide which to use.
+ * by hashing. We don't have enough information yet to tell which way is
+ * likely to be better (it depends on the expected number of executions of
+ * the EXISTS qual, and we are much too early in planning the outer query
+ * to be able to guess that). So we generate both plans, if possible, and
+ * leave it to the executor to decide which to use.
*/
if (simple_exists && IsA(result, SubPlan))
{
@@ -368,7 +368,7 @@ make_subplan(PlannerInfo *root, Query *orig_subquery, SubLinkType subLinkType,
/* Now we can check if it'll fit in work_mem */
if (subplan_is_hashable(plan))
{
- SubPlan *hashplan;
+ SubPlan *hashplan;
AlternativeSubPlan *asplan;
/* OK, convert to SubPlan format. */
@@ -437,7 +437,7 @@ build_subplan(PlannerInfo *root, Plan *plan, List *rtable,
if (pitem->abslevel == root->query_level)
{
- Node *arg;
+ Node *arg;
/*
* The Var or Aggref has already been adjusted to have the correct
@@ -447,8 +447,8 @@ build_subplan(PlannerInfo *root, Plan *plan, List *rtable,
arg = copyObject(pitem->item);
/*
- * If it's an Aggref, its arguments might contain SubLinks,
- * which have not yet been processed. Do that now.
+ * If it's an Aggref, its arguments might contain SubLinks, which
+ * have not yet been processed. Do that now.
*/
if (IsA(arg, Aggref))
arg = SS_process_sublinks(root, arg, false);
@@ -714,7 +714,7 @@ generate_subquery_vars(PlannerInfo *root, List *tlist, Index varno)
/*
* convert_testexpr: convert the testexpr given by the parser into
* actually executable form. This entails replacing PARAM_SUBLINK Params
- * with Params or Vars representing the results of the sub-select. The
+ * with Params or Vars representing the results of the sub-select. The
* nodes to be substituted are passed in as the List result from
* generate_subquery_params or generate_subquery_vars.
*
@@ -794,8 +794,8 @@ static bool
testexpr_is_hashable(Node *testexpr)
{
/*
- * The testexpr must be a single OpExpr, or an AND-clause containing
- * only OpExprs.
+ * The testexpr must be a single OpExpr, or an AND-clause containing only
+ * OpExprs.
*
* The combining operators must be hashable and strict. The need for
* hashability is obvious, since we want to use hashing. Without
@@ -892,8 +892,8 @@ SS_process_ctes(PlannerInfo *root)
}
/*
- * Copy the source Query node. Probably not necessary, but let's
- * keep this similar to make_subplan.
+ * Copy the source Query node. Probably not necessary, but let's keep
+ * this similar to make_subplan.
*/
subquery = (Query *) copyObject(cte->ctequery);
@@ -907,7 +907,7 @@ SS_process_ctes(PlannerInfo *root)
&subroot);
/*
- * Make a SubPlan node for it. This is just enough unlike
+ * Make a SubPlan node for it. This is just enough unlike
* build_subplan that we can't share code.
*
* Note plan_id, plan_name, and cost fields are set further down.
@@ -925,8 +925,8 @@ SS_process_ctes(PlannerInfo *root)
/*
* Make parParam and args lists of param IDs and expressions that
- * current query level will pass to this child plan. Even though
- * this is an initplan, there could be side-references to earlier
+ * current query level will pass to this child plan. Even though this
+ * is an initplan, there could be side-references to earlier
* initplan's outputs, specifically their CTE output parameters.
*/
tmpset = bms_copy(plan->extParam);
@@ -948,8 +948,8 @@ SS_process_ctes(PlannerInfo *root)
bms_free(tmpset);
/*
- * Assign a param to represent the query output. We only really
- * care about reserving a parameter ID number.
+ * Assign a param to represent the query output. We only really care
+ * about reserving a parameter ID number.
*/
prm = generate_new_param(root, INTERNALOID, -1);
splan->setParam = list_make1_int(prm->paramid);
@@ -1028,9 +1028,9 @@ convert_ANY_sublink_to_join(PlannerInfo *root, SubLink *sublink,
return NULL;
/*
- * The test expression must contain some Vars of the parent query,
- * else it's not gonna be a join. (Note that it won't have Vars
- * referring to the subquery, rather Params.)
+ * The test expression must contain some Vars of the parent query, else
+ * it's not gonna be a join. (Note that it won't have Vars referring to
+ * the subquery, rather Params.)
*/
upper_varnos = pull_varnos(sublink->testexpr);
if (bms_is_empty(upper_varnos))
@@ -1126,10 +1126,10 @@ convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink,
subselect = (Query *) copyObject(subselect);
/*
- * See if the subquery can be simplified based on the knowledge that
- * it's being used in EXISTS(). If we aren't able to get rid of its
- * targetlist, we have to fail, because the pullup operation leaves
- * us with noplace to evaluate the targetlist.
+ * See if the subquery can be simplified based on the knowledge that it's
+ * being used in EXISTS(). If we aren't able to get rid of its
+ * targetlist, we have to fail, because the pullup operation leaves us
+ * with noplace to evaluate the targetlist.
*/
if (!simplify_EXISTS_query(subselect))
return NULL;
@@ -1175,13 +1175,13 @@ convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink,
* to the inner (necessarily true). Therefore this is a lot easier than
* what pull_up_subqueries has to go through.
*
- * In fact, it's even easier than what convert_ANY_sublink_to_join has
- * to do. The machinations of simplify_EXISTS_query ensured that there
- * is nothing interesting in the subquery except an rtable and jointree,
- * and even the jointree FromExpr no longer has quals. So we can just
- * append the rtable to our own and use the FromExpr in our jointree.
- * But first, adjust all level-zero varnos in the subquery to account
- * for the rtable merger.
+ * In fact, it's even easier than what convert_ANY_sublink_to_join has to
+ * do. The machinations of simplify_EXISTS_query ensured that there is
+ * nothing interesting in the subquery except an rtable and jointree, and
+ * even the jointree FromExpr no longer has quals. So we can just append
+ * the rtable to our own and use the FromExpr in our jointree. But first,
+ * adjust all level-zero varnos in the subquery to account for the rtable
+ * merger.
*/
rtoffset = list_length(parse->rtable);
OffsetVarNodes((Node *) subselect, rtoffset, 0);
@@ -1198,8 +1198,8 @@ convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink,
/*
* Now that the WHERE clause is adjusted to match the parent query
* environment, we can easily identify all the level-zero rels it uses.
- * The ones <= rtoffset belong to the upper query; the ones > rtoffset
- * do not.
+ * The ones <= rtoffset belong to the upper query; the ones > rtoffset do
+ * not.
*/
clause_varnos = pull_varnos(whereClause);
upper_varnos = NULL;
@@ -1212,8 +1212,8 @@ convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink,
Assert(!bms_is_empty(upper_varnos));
/*
- * Now that we've got the set of upper-level varnos, we can make the
- * last check: only available_rels can be referenced.
+ * Now that we've got the set of upper-level varnos, we can make the last
+ * check: only available_rels can be referenced.
*/
if (!bms_is_subset(upper_varnos, available_rels))
return NULL;
@@ -1308,7 +1308,7 @@ simplify_EXISTS_query(Query *query)
*
* On success, the modified subselect is returned, and we store a suitable
* upper-level test expression at *testexpr, plus a list of the subselect's
- * output Params at *paramIds. (The test expression is already Param-ified
+ * output Params at *paramIds. (The test expression is already Param-ified
* and hence need not go through convert_testexpr, which is why we have to
* deal with the Param IDs specially.)
*
@@ -1365,32 +1365,32 @@ convert_EXISTS_to_ANY(PlannerInfo *root, Query *subselect,
/*
* Clean up the WHERE clause by doing const-simplification etc on it.
* Aside from simplifying the processing we're about to do, this is
- * important for being able to pull chunks of the WHERE clause up into
- * the parent query. Since we are invoked partway through the parent's
+ * important for being able to pull chunks of the WHERE clause up into the
+ * parent query. Since we are invoked partway through the parent's
* preprocess_expression() work, earlier steps of preprocess_expression()
- * wouldn't get applied to the pulled-up stuff unless we do them here.
- * For the parts of the WHERE clause that get put back into the child
- * query, this work is partially duplicative, but it shouldn't hurt.
+ * wouldn't get applied to the pulled-up stuff unless we do them here. For
+ * the parts of the WHERE clause that get put back into the child query,
+ * this work is partially duplicative, but it shouldn't hurt.
*
- * Note: we do not run flatten_join_alias_vars. This is OK because
- * any parent aliases were flattened already, and we're not going to
- * pull any child Vars (of any description) into the parent.
+ * Note: we do not run flatten_join_alias_vars. This is OK because any
+ * parent aliases were flattened already, and we're not going to pull any
+ * child Vars (of any description) into the parent.
*
- * Note: passing the parent's root to eval_const_expressions is technically
- * wrong, but we can get away with it since only the boundParams (if any)
- * are used, and those would be the same in a subroot.
+ * Note: passing the parent's root to eval_const_expressions is
+ * technically wrong, but we can get away with it since only the
+ * boundParams (if any) are used, and those would be the same in a
+ * subroot.
*/
whereClause = eval_const_expressions(root, whereClause);
whereClause = (Node *) canonicalize_qual((Expr *) whereClause);
whereClause = (Node *) make_ands_implicit((Expr *) whereClause);
/*
- * We now have a flattened implicit-AND list of clauses, which we
- * try to break apart into "outervar = innervar" hash clauses.
- * Anything that can't be broken apart just goes back into the
- * newWhere list. Note that we aren't trying hard yet to ensure
- * that we have only outer or only inner on each side; we'll check
- * that if we get to the end.
+ * We now have a flattened implicit-AND list of clauses, which we try to
+ * break apart into "outervar = innervar" hash clauses. Anything that
+ * can't be broken apart just goes back into the newWhere list. Note that
+ * we aren't trying hard yet to ensure that we have only outer or only
+ * inner on each side; we'll check that if we get to the end.
*/
leftargs = rightargs = opids = newWhere = NIL;
foreach(lc, (List *) whereClause)
@@ -1400,8 +1400,8 @@ convert_EXISTS_to_ANY(PlannerInfo *root, Query *subselect,
if (IsA(expr, OpExpr) &&
hash_ok_operator(expr))
{
- Node *leftarg = (Node *) linitial(expr->args);
- Node *rightarg = (Node *) lsecond(expr->args);
+ Node *leftarg = (Node *) linitial(expr->args);
+ Node *rightarg = (Node *) lsecond(expr->args);
if (contain_vars_of_level(leftarg, 1))
{
@@ -1459,15 +1459,15 @@ convert_EXISTS_to_ANY(PlannerInfo *root, Query *subselect,
/*
* And there can't be any child Vars in the stuff we intend to pull up.
- * (Note: we'd need to check for child Aggs too, except we know the
- * child has no aggs at all because of simplify_EXISTS_query's check.
- * The same goes for window functions.)
+ * (Note: we'd need to check for child Aggs too, except we know the child
+ * has no aggs at all because of simplify_EXISTS_query's check. The same
+ * goes for window functions.)
*/
if (contain_vars_of_level((Node *) leftargs, 0))
return NULL;
/*
- * Also reject sublinks in the stuff we intend to pull up. (It might be
+ * Also reject sublinks in the stuff we intend to pull up. (It might be
* possible to support this, but doesn't seem worth the complication.)
*/
if (contain_subplans((Node *) leftargs))
@@ -1485,11 +1485,10 @@ convert_EXISTS_to_ANY(PlannerInfo *root, Query *subselect,
subselect->jointree->quals = (Node *) make_ands_explicit(newWhere);
/*
- * Build a new targetlist for the child that emits the expressions
- * we need. Concurrently, build a testexpr for the parent using
- * Params to reference the child outputs. (Since we generate Params
- * directly here, there will be no need to convert the testexpr in
- * build_subplan.)
+ * Build a new targetlist for the child that emits the expressions we
+ * need. Concurrently, build a testexpr for the parent using Params to
+ * reference the child outputs. (Since we generate Params directly here,
+ * there will be no need to convert the testexpr in build_subplan.)
*/
tlist = testlist = paramids = NIL;
resno = 1;
@@ -1625,10 +1624,10 @@ process_sublinks_mutator(Node *node, process_sublinks_context *context)
}
/*
- * Don't recurse into the arguments of an outer aggregate here.
- * Any SubLinks in the arguments have to be dealt with at the outer
- * query level; they'll be handled when build_subplan collects the
- * Aggref into the arguments to be passed down to the current subplan.
+ * Don't recurse into the arguments of an outer aggregate here. Any
+ * SubLinks in the arguments have to be dealt with at the outer query
+ * level; they'll be handled when build_subplan collects the Aggref into
+ * the arguments to be passed down to the current subplan.
*/
if (IsA(node, Aggref))
{
@@ -1655,7 +1654,7 @@ process_sublinks_mutator(Node *node, process_sublinks_context *context)
* is needed for a bare List.)
*
* Anywhere within the top-level AND/OR clause structure, we can tell
- * make_subplan() that NULL and FALSE are interchangeable. So isTopQual
+ * make_subplan() that NULL and FALSE are interchangeable. So isTopQual
* propagates down in both cases. (Note that this is unlike the meaning
* of "top level qual" used in most other places in Postgres.)
*/
@@ -1702,8 +1701,8 @@ process_sublinks_mutator(Node *node, process_sublinks_context *context)
}
/*
- * If we recurse down through anything other than an AND or OR node,
- * we are definitely not at top qual level anymore.
+ * If we recurse down through anything other than an AND or OR node, we
+ * are definitely not at top qual level anymore.
*/
locContext.isTopQual = false;
@@ -1759,8 +1758,8 @@ SS_finalize_plan(PlannerInfo *root, Plan *plan, bool attach_initplans)
/*
* Now determine the set of params that are validly referenceable in this
* query level; to wit, those available from outer query levels plus the
- * output parameters of any initPlans. (We do not include output
- * parameters of regular subplans. Those should only appear within the
+ * output parameters of any initPlans. (We do not include output
+ * parameters of regular subplans. Those should only appear within the
* testexpr of SubPlan nodes, and are taken care of locally within
* finalize_primnode.)
*
@@ -1809,7 +1808,7 @@ SS_finalize_plan(PlannerInfo *root, Plan *plan, bool attach_initplans)
if (attach_initplans)
{
plan->initPlan = root->init_plans;
- root->init_plans = NIL; /* make sure they're not attached twice */
+ root->init_plans = NIL; /* make sure they're not attached twice */
/* allParam must include all these params */
plan->allParam = bms_add_members(plan->allParam, initExtParam);
@@ -2043,9 +2042,9 @@ finalize_plan(PlannerInfo *root, Plan *plan, Bitmapset *valid_params)
/*
* Note: by definition, extParam and allParam should have the same value
- * in any plan node that doesn't have child initPlans. We set them
- * equal here, and later SS_finalize_plan will update them properly
- * in node(s) that it attaches initPlans to.
+ * in any plan node that doesn't have child initPlans. We set them equal
+ * here, and later SS_finalize_plan will update them properly in node(s)
+ * that it attaches initPlans to.
*
* For speed at execution time, make sure extParam/allParam are actually
* NULL if they are empty sets.
@@ -2095,7 +2094,7 @@ finalize_primnode(Node *node, finalize_primnode_context *context)
/*
* Remove any param IDs of output parameters of the subplan that were
- * referenced in the testexpr. These are not interesting for
+ * referenced in the testexpr. These are not interesting for
* parameter change signaling since we always re-evaluate the subplan.
* Note that this wouldn't work too well if there might be uses of the
* same param IDs elsewhere in the plan, but that can't happen because
@@ -2167,9 +2166,9 @@ SS_make_initplan_from_plan(PlannerInfo *root, Plan *plan,
root->parse->rtable);
/*
- * Create a SubPlan node and add it to the outer list of InitPlans.
- * Note it has to appear after any other InitPlans it might depend on
- * (see comments in ExecReScan).
+ * Create a SubPlan node and add it to the outer list of InitPlans. Note
+ * it has to appear after any other InitPlans it might depend on (see
+ * comments in ExecReScan).
*/
node = makeNode(SubPlan);
node->subLinkType = EXPR_SUBLINK;
diff --git a/src/backend/optimizer/prep/prepjointree.c b/src/backend/optimizer/prep/prepjointree.c
index 3df9d57c1d..fd451b338b 100644
--- a/src/backend/optimizer/prep/prepjointree.c
+++ b/src/backend/optimizer/prep/prepjointree.c
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.65 2009/04/28 21:31:16 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepjointree.c,v 1.66 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,16 +52,16 @@ static Node *pull_up_simple_subquery(PlannerInfo *root, Node *jtnode,
static Node *pull_up_simple_union_all(PlannerInfo *root, Node *jtnode,
RangeTblEntry *rte);
static void pull_up_union_leaf_queries(Node *setOp, PlannerInfo *root,
- int parentRTindex, Query *setOpQuery,
- int childRToffset);
+ int parentRTindex, Query *setOpQuery,
+ int childRToffset);
static void make_setop_translation_list(Query *query, Index newvarno,
- List **translated_vars);
+ List **translated_vars);
static bool is_simple_subquery(Query *subquery);
static bool is_simple_union_all(Query *subquery);
static bool is_simple_union_all_recurse(Node *setOp, Query *setOpQuery,
List *colTypes);
static List *insert_targetlist_placeholders(PlannerInfo *root, List *tlist,
- int varno, bool wrap_non_vars);
+ int varno, bool wrap_non_vars);
static bool is_safe_append_member(Query *subquery);
static void resolvenew_in_jointree(Node *jtnode, int varno, RangeTblEntry *rte,
List *subtlist, List *subtlist_with_phvs,
@@ -74,7 +74,7 @@ static void reduce_outer_joins_pass2(Node *jtnode,
List *nonnullable_vars,
List *forced_null_vars);
static void substitute_multiple_relids(Node *node,
- int varno, Relids subrelids);
+ int varno, Relids subrelids);
static void fix_append_rel_relids(List *append_rel_list, int varno,
Relids subrelids);
static Node *find_jointree_node_for_rel(Node *jtnode, int relid);
@@ -87,7 +87,7 @@ static Node *find_jointree_node_for_rel(Node *jtnode, int relid);
*
* A clause "foo op ANY (sub-SELECT)" can be processed by pulling the
* sub-SELECT up to become a rangetable entry and treating the implied
- * comparisons as quals of a semijoin. However, this optimization *only*
+ * comparisons as quals of a semijoin. However, this optimization *only*
* works at the top level of WHERE or a JOIN/ON clause, because we cannot
* distinguish whether the ANY ought to return FALSE or NULL in cases
* involving NULL inputs. Also, in an outer join's ON clause we can only
@@ -104,7 +104,7 @@ static Node *find_jointree_node_for_rel(Node *jtnode, int relid);
* transformations if any are found.
*
* This routine has to run before preprocess_expression(), so the quals
- * clauses are not yet reduced to implicit-AND format. That means we need
+ * clauses are not yet reduced to implicit-AND format. That means we need
* to recursively search through explicit AND clauses, which are
* probably only binary ANDs. We stop as soon as we hit a non-AND item.
*/
@@ -162,8 +162,8 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
/* First, recurse to process children and collect their relids */
foreach(l, f->fromlist)
{
- Node *newchild;
- Relids childrelids;
+ Node *newchild;
+ Relids childrelids;
newchild = pull_up_sublinks_jointree_recurse(root,
lfirst(l),
@@ -181,8 +181,8 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
/*
* Note that the result will be either newf, or a stack of JoinExprs
- * with newf at the base. We rely on subsequent optimization steps
- * to flatten this and rearrange the joins as needed.
+ * with newf at the base. We rely on subsequent optimization steps to
+ * flatten this and rearrange the joins as needed.
*
* Although we could include the pulled-up subqueries in the returned
* relids, there's no need since upper quals couldn't refer to their
@@ -199,8 +199,8 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
Node *jtlink;
/*
- * Make a modifiable copy of join node, but don't bother copying
- * its subnodes (yet).
+ * Make a modifiable copy of join node, but don't bother copying its
+ * subnodes (yet).
*/
j = (JoinExpr *) palloc(sizeof(JoinExpr));
memcpy(j, jtnode, sizeof(JoinExpr));
@@ -214,19 +214,19 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
/*
* Now process qual, showing appropriate child relids as available,
- * and attach any pulled-up jointree items at the right place.
- * In the inner-join case we put new JoinExprs above the existing one
- * (much as for a FromExpr-style join). In outer-join cases the
- * new JoinExprs must go into the nullable side of the outer join.
- * The point of the available_rels machinations is to ensure that we
- * only pull up quals for which that's okay.
+ * and attach any pulled-up jointree items at the right place. In the
+ * inner-join case we put new JoinExprs above the existing one (much
+ * as for a FromExpr-style join). In outer-join cases the new
+ * JoinExprs must go into the nullable side of the outer join. The
+ * point of the available_rels machinations is to ensure that we only
+ * pull up quals for which that's okay.
*
* XXX for the moment, we refrain from pulling up IN/EXISTS clauses
- * appearing in LEFT or RIGHT join conditions. Although it is
+ * appearing in LEFT or RIGHT join conditions. Although it is
* semantically valid to do so under the above conditions, we end up
* with a query in which the semijoin or antijoin must be evaluated
- * below the outer join, which could perform far worse than leaving
- * it as a sublink that is executed only for row pairs that meet the
+ * below the outer join, which could perform far worse than leaving it
+ * as a sublink that is executed only for row pairs that meet the
* other join conditions. Fixing this seems to require considerable
* restructuring of the executor, but maybe someday it can happen.
*
@@ -238,7 +238,7 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
case JOIN_INNER:
j->quals = pull_up_sublinks_qual_recurse(root, j->quals,
bms_union(leftrelids,
- rightrelids),
+ rightrelids),
&jtlink);
break;
case JOIN_LEFT:
@@ -267,7 +267,7 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
/*
* Although we could include the pulled-up subqueries in the returned
* relids, there's no need since upper quals couldn't refer to their
- * outputs anyway. But we *do* need to include the join's own rtindex
+ * outputs anyway. But we *do* need to include the join's own rtindex
* because we haven't yet collapsed join alias variables, so upper
* levels would mistakenly think they couldn't use references to this
* join.
@@ -416,7 +416,7 @@ inline_set_returning_functions(PlannerInfo *root)
if (rte->rtekind == RTE_FUNCTION)
{
- Query *funcquery;
+ Query *funcquery;
/* Check safety of expansion, and expand if possible */
funcquery = inline_set_returning_function(root, rte);
@@ -495,10 +495,10 @@ pull_up_subqueries(PlannerInfo *root, Node *jtnode,
* Alternatively, is it a simple UNION ALL subquery? If so, flatten
* into an "append relation".
*
- * It's safe to do this regardless of whether this query is
- * itself an appendrel member. (If you're thinking we should try to
- * flatten the two levels of appendrel together, you're right; but we
- * handle that in set_append_rel_pathlist, not here.)
+ * It's safe to do this regardless of whether this query is itself an
+ * appendrel member. (If you're thinking we should try to flatten the
+ * two levels of appendrel together, you're right; but we handle that
+ * in set_append_rel_pathlist, not here.)
*/
if (rte->rtekind == RTE_SUBQUERY &&
is_simple_union_all(rte->subquery))
@@ -637,10 +637,10 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte,
* pull_up_subqueries' processing is complete for its jointree and
* rangetable.
*
- * Note: we should pass NULL for containing-join info even if we are within
- * an outer join in the upper query; the lower query starts with a clean
- * slate for outer-join semantics. Likewise, we say we aren't handling an
- * appendrel member.
+ * Note: we should pass NULL for containing-join info even if we are
+ * within an outer join in the upper query; the lower query starts with a
+ * clean slate for outer-join semantics. Likewise, we say we aren't
+ * handling an appendrel member.
*/
subquery->jointree = (FromExpr *)
pull_up_subqueries(subroot, (Node *) subquery->jointree, NULL, NULL);
@@ -673,8 +673,8 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte,
/*
* Adjust level-0 varnos in subquery so that we can append its rangetable
- * to upper query's. We have to fix the subquery's append_rel_list
- * as well.
+ * to upper query's. We have to fix the subquery's append_rel_list as
+ * well.
*/
rtoffset = list_length(parse->rtable);
OffsetVarNodes((Node *) subquery, rtoffset, 0);
@@ -691,15 +691,15 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte,
* The subquery's targetlist items are now in the appropriate form to
* insert into the top query, but if we are under an outer join then
* non-nullable items may have to be turned into PlaceHolderVars. If we
- * are dealing with an appendrel member then anything that's not a
- * simple Var has to be turned into a PlaceHolderVar.
+ * are dealing with an appendrel member then anything that's not a simple
+ * Var has to be turned into a PlaceHolderVar.
*/
subtlist = subquery->targetList;
if (lowest_outer_join != NULL || containing_appendrel != NULL)
subtlist_with_phvs = insert_targetlist_placeholders(root,
subtlist,
varno,
- containing_appendrel != NULL);
+ containing_appendrel != NULL);
else
subtlist_with_phvs = subtlist;
@@ -709,7 +709,7 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte,
* replace any of the jointree structure. (This'd be a lot cleaner if we
* could use query_tree_mutator.) We have to use PHVs in the targetList,
* returningList, and havingQual, since those are certainly above any
- * outer join. resolvenew_in_jointree tracks its location in the jointree
+ * outer join. resolvenew_in_jointree tracks its location in the jointree
* and uses PHVs or not appropriately.
*/
parse->targetList = (List *)
@@ -730,11 +730,11 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte,
subtlist_with_phvs, CMD_SELECT, 0);
/*
- * Replace references in the translated_vars lists of appendrels.
- * When pulling up an appendrel member, we do not need PHVs in the list
- * of the parent appendrel --- there isn't any outer join between.
- * Elsewhere, use PHVs for safety. (This analysis could be made tighter
- * but it seems unlikely to be worth much trouble.)
+ * Replace references in the translated_vars lists of appendrels. When
+ * pulling up an appendrel member, we do not need PHVs in the list of the
+ * parent appendrel --- there isn't any outer join between. Elsewhere, use
+ * PHVs for safety. (This analysis could be made tighter but it seems
+ * unlikely to be worth much trouble.)
*/
foreach(lc, root->append_rel_list)
{
@@ -753,9 +753,9 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte,
*
* You might think that we could avoid using PHVs for alias vars of joins
* below lowest_outer_join, but that doesn't work because the alias vars
- * could be referenced above that join; we need the PHVs to be present
- * in such references after the alias vars get flattened. (It might be
- * worth trying to be smarter here, someday.)
+ * could be referenced above that join; we need the PHVs to be present in
+ * such references after the alias vars get flattened. (It might be worth
+ * trying to be smarter here, someday.)
*/
foreach(lc, parse->rtable)
{
@@ -789,9 +789,9 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte,
* will be adjusted, so having created them with the subquery's varno is
* correct.
*
- * Likewise, relids appearing in AppendRelInfo nodes have to be fixed.
- * We already checked that this won't require introducing multiple
- * subrelids into the single-slot AppendRelInfo structs.
+ * Likewise, relids appearing in AppendRelInfo nodes have to be fixed. We
+ * already checked that this won't require introducing multiple subrelids
+ * into the single-slot AppendRelInfo structs.
*/
if (parse->hasSubLinks || root->glob->lastPHId != 0 ||
root->append_rel_list)
@@ -822,9 +822,10 @@ pull_up_simple_subquery(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte,
* Miscellaneous housekeeping.
*/
parse->hasSubLinks |= subquery->hasSubLinks;
+
/*
- * subquery won't be pulled up if it hasAggs or hasWindowFuncs, so no
- * work needed on those flags
+ * subquery won't be pulled up if it hasAggs or hasWindowFuncs, so no work
+ * needed on those flags
*/
/*
@@ -859,10 +860,10 @@ pull_up_simple_union_all(PlannerInfo *root, Node *jtnode, RangeTblEntry *rte)
/*
* Append child RTEs to parent rtable.
*
- * Upper-level vars in subquery are now one level closer to their
- * parent than before. We don't have to worry about offsetting
- * varnos, though, because any such vars must refer to stuff above the
- * level of the query we are pulling into.
+ * Upper-level vars in subquery are now one level closer to their parent
+ * than before. We don't have to worry about offsetting varnos, though,
+ * because any such vars must refer to stuff above the level of the query
+ * we are pulling into.
*/
rtable = copyObject(subquery->rtable);
IncrementVarSublevelsUp_rtable(rtable, -1, 1);
@@ -1049,11 +1050,11 @@ is_simple_subquery(Query *subquery)
* query_planner() will correctly generate a Result plan for a jointree
* that's totally empty, but I don't think the right things happen if an
* empty FromExpr appears lower down in a jointree. It would pose a
- * problem for the PlaceHolderVar mechanism too, since we'd have no
- * way to identify where to evaluate a PHV coming out of the subquery.
- * Not worth working hard on this, just to collapse SubqueryScan/Result
- * into Result; especially since the SubqueryScan can often be optimized
- * away by setrefs.c anyway.
+ * problem for the PlaceHolderVar mechanism too, since we'd have no way to
+ * identify where to evaluate a PHV coming out of the subquery. Not worth
+ * working hard on this, just to collapse SubqueryScan/Result into Result;
+ * especially since the SubqueryScan can often be optimized away by
+ * setrefs.c anyway.
*/
if (subquery->jointree->fromlist == NIL)
return false;
@@ -1167,8 +1168,8 @@ insert_targetlist_placeholders(PlannerInfo *root, List *tlist,
}
/*
- * Simple Vars always escape being wrapped. This is common enough
- * to deserve a fast path even if we aren't doing wrap_non_vars.
+ * Simple Vars always escape being wrapped. This is common enough to
+ * deserve a fast path even if we aren't doing wrap_non_vars.
*/
if (tle->expr && IsA(tle->expr, Var) &&
((Var *) tle->expr)->varlevelsup == 0)
@@ -1180,8 +1181,8 @@ insert_targetlist_placeholders(PlannerInfo *root, List *tlist,
if (!wrap_non_vars)
{
/*
- * If it contains a Var of current level, and does not contain
- * any non-strict constructs, then it's certainly nullable and we
+ * If it contains a Var of current level, and does not contain any
+ * non-strict constructs, then it's certainly nullable and we
* don't need to insert a PlaceHolderVar. (Note: in future maybe
* we should insert PlaceHolderVars anyway, when a tlist item is
* expensive to evaluate?
@@ -1248,7 +1249,7 @@ is_safe_append_member(Query *subquery)
* but there's no other way...
*
* If we are above lowest_outer_join then use subtlist_with_phvs; at or
- * below it, use subtlist. (When no outer joins are in the picture,
+ * below it, use subtlist. (When no outer joins are in the picture,
* these will be the same list.)
*/
static void
@@ -1328,7 +1329,7 @@ resolvenew_in_jointree(Node *jtnode, int varno, RangeTblEntry *rte,
* SELECT ... FROM a LEFT JOIN b ON (a.x = b.y) WHERE b.y IS NULL;
* If the join clause is strict for b.y, then only null-extended rows could
* pass the upper WHERE, and we can conclude that what the query is really
- * specifying is an anti-semijoin. We change the join type from JOIN_LEFT
+ * specifying is an anti-semijoin. We change the join type from JOIN_LEFT
* to JOIN_ANTI. The IS NULL clause then becomes redundant, and must be
* removed to prevent bogus selectivity calculations, but we leave it to
* distribute_qual_to_rels to get rid of such clauses.
@@ -1533,6 +1534,7 @@ reduce_outer_joins_pass2(Node *jtnode,
break;
case JOIN_SEMI:
case JOIN_ANTI:
+
/*
* These could only have been introduced by pull_up_sublinks,
* so there's no way that upper quals could refer to their
@@ -1565,14 +1567,14 @@ reduce_outer_joins_pass2(Node *jtnode,
}
/*
- * See if we can reduce JOIN_LEFT to JOIN_ANTI. This is the case
- * if the join's own quals are strict for any var that was forced
- * null by higher qual levels. NOTE: there are other ways that we
- * could detect an anti-join, in particular if we were to check
- * whether Vars coming from the RHS must be non-null because of
- * table constraints. That seems complicated and expensive though
- * (in particular, one would have to be wary of lower outer joins).
- * For the moment this seems sufficient.
+ * See if we can reduce JOIN_LEFT to JOIN_ANTI. This is the case if
+ * the join's own quals are strict for any var that was forced null by
+ * higher qual levels. NOTE: there are other ways that we could
+ * detect an anti-join, in particular if we were to check whether Vars
+ * coming from the RHS must be non-null because of table constraints.
+ * That seems complicated and expensive though (in particular, one
+ * would have to be wary of lower outer joins). For the moment this
+ * seems sufficient.
*/
if (jointype == JOIN_LEFT)
{
@@ -1582,8 +1584,8 @@ reduce_outer_joins_pass2(Node *jtnode,
computed_local_nonnullable_vars = true;
/*
- * It's not sufficient to check whether local_nonnullable_vars
- * and forced_null_vars overlap: we need to know if the overlap
+ * It's not sufficient to check whether local_nonnullable_vars and
+ * forced_null_vars overlap: we need to know if the overlap
* includes any RHS variables.
*/
overlap = list_intersection(local_nonnullable_vars,
@@ -1621,11 +1623,11 @@ reduce_outer_joins_pass2(Node *jtnode,
* side, because an outer join never eliminates any rows from its
* non-nullable side. Also, there is no point in passing upper
* constraints into the nullable side, since if there were any
- * we'd have been able to reduce the join. (In the case of
- * upper forced-null constraints, we *must not* pass them into
- * the nullable side --- they either applied here, or not.)
- * The upshot is that we pass either the local or the upper
- * constraints, never both, to the children of an outer join.
+ * we'd have been able to reduce the join. (In the case of upper
+ * forced-null constraints, we *must not* pass them into the
+ * nullable side --- they either applied here, or not.) The upshot
+ * is that we pass either the local or the upper constraints,
+ * never both, to the children of an outer join.
*
* At a FULL join we just punt and pass nothing down --- is it
* possible to be smarter?
@@ -1640,7 +1642,7 @@ reduce_outer_joins_pass2(Node *jtnode,
{
/* OK to merge upper and local constraints */
local_nonnullable_rels = bms_add_members(local_nonnullable_rels,
- nonnullable_rels);
+ nonnullable_rels);
local_nonnullable_vars = list_concat(local_nonnullable_vars,
nonnullable_vars);
local_forced_null_vars = list_concat(local_forced_null_vars,
@@ -1663,7 +1665,7 @@ reduce_outer_joins_pass2(Node *jtnode,
pass_nonnullable_vars = local_nonnullable_vars;
pass_forced_null_vars = local_forced_null_vars;
}
- else if (jointype != JOIN_FULL) /* ie, LEFT/SEMI/ANTI */
+ else if (jointype != JOIN_FULL) /* ie, LEFT/SEMI/ANTI */
{
/* can't pass local constraints to non-nullable side */
pass_nonnullable_rels = nonnullable_rels;
@@ -1722,7 +1724,7 @@ reduce_outer_joins_pass2(Node *jtnode,
* top query could (yet) contain such a reference.
*
* NOTE: although this has the form of a walker, we cheat and modify the
- * nodes in-place. This should be OK since the tree was copied by ResolveNew
+ * nodes in-place. This should be OK since the tree was copied by ResolveNew
* earlier. Avoid scribbling on the original values of the bitmapsets, though,
* because expression_tree_mutator doesn't copy those.
*/
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 09acdaca65..b5e10a9180 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.170 2009/05/12 03:11:01 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.171 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -97,7 +97,7 @@ static void make_inh_translation_list(Relation oldrelation,
Index newvarno,
List **translated_vars);
static Bitmapset *translate_col_privs(const Bitmapset *parent_privs,
- List *translated_vars);
+ List *translated_vars);
static Node *adjust_appendrel_attrs_mutator(Node *node,
AppendRelInfo *context);
static Relids adjust_relid_set(Relids relids, Index oldrelid, Index newrelid);
@@ -220,9 +220,9 @@ recurse_set_operations(Node *setOp, PlannerInfo *root,
&subroot);
/*
- * Estimate number of groups if caller wants it. If the subquery
- * used grouping or aggregation, its output is probably mostly
- * unique anyway; otherwise do statistical estimation.
+ * Estimate number of groups if caller wants it. If the subquery used
+ * grouping or aggregation, its output is probably mostly unique
+ * anyway; otherwise do statistical estimation.
*/
if (pNumGroups)
{
@@ -231,7 +231,7 @@ recurse_set_operations(Node *setOp, PlannerInfo *root,
*pNumGroups = subplan->plan_rows;
else
*pNumGroups = estimate_num_groups(subroot,
- get_tlist_exprs(subquery->targetList, false),
+ get_tlist_exprs(subquery->targetList, false),
subplan->plan_rows);
}
@@ -361,7 +361,7 @@ generate_recursion_plan(SetOperationStmt *setOp, PlannerInfo *root,
}
else
{
- double dNumGroups;
+ double dNumGroups;
/* Identify the grouping semantics */
groupList = generate_setop_grouplist(setOp, tlist);
@@ -374,8 +374,8 @@ generate_recursion_plan(SetOperationStmt *setOp, PlannerInfo *root,
errdetail("All column datatypes must be hashable.")));
/*
- * For the moment, take the number of distinct groups as equal to
- * the total input size, ie, the worst case.
+ * For the moment, take the number of distinct groups as equal to the
+ * total input size, ie, the worst case.
*/
dNumGroups = lplan->plan_rows + rplan->plan_rows * 10;
@@ -460,9 +460,9 @@ generate_union_plan(SetOperationStmt *op, PlannerInfo *root,
plan = make_union_unique(op, plan, root, tuple_fraction, sortClauses);
/*
- * Estimate number of groups if caller wants it. For now we just
- * assume the output is unique --- this is certainly true for the
- * UNION case, and we want worst-case estimates anyway.
+ * Estimate number of groups if caller wants it. For now we just assume
+ * the output is unique --- this is certainly true for the UNION case, and
+ * we want worst-case estimates anyway.
*/
if (pNumGroups)
*pNumGroups = plan->plan_rows;
@@ -555,8 +555,8 @@ generate_nonunion_plan(SetOperationStmt *op, PlannerInfo *root,
* Estimate number of distinct groups that we'll need hashtable entries
* for; this is the size of the left-hand input for EXCEPT, or the smaller
* input for INTERSECT. Also estimate the number of eventual output rows.
- * In non-ALL cases, we estimate each group produces one output row;
- * in ALL cases use the relevant relation size. These are worst-case
+ * In non-ALL cases, we estimate each group produces one output row; in
+ * ALL cases use the relevant relation size. These are worst-case
* estimates, of course, but we need to be conservative.
*/
if (op->op == SETOP_EXCEPT)
@@ -578,7 +578,7 @@ generate_nonunion_plan(SetOperationStmt *op, PlannerInfo *root,
*/
use_hash = choose_hashed_setop(root, groupList, plan,
dNumGroups, dNumOutputRows, tuple_fraction,
- (op->op == SETOP_INTERSECT) ? "INTERSECT" : "EXCEPT");
+ (op->op == SETOP_INTERSECT) ? "INTERSECT" : "EXCEPT");
if (!use_hash)
plan = (Plan *) make_sort_from_sortclauses(root, groupList, plan);
@@ -687,12 +687,12 @@ make_union_unique(SetOperationStmt *op, Plan *plan,
}
/*
- * XXX for the moment, take the number of distinct groups as equal to
- * the total input size, ie, the worst case. This is too conservative,
- * but we don't want to risk having the hashtable overrun memory; also,
- * it's not clear how to get a decent estimate of the true size. One
- * should note as well the propensity of novices to write UNION rather
- * than UNION ALL even when they don't expect any duplicates...
+ * XXX for the moment, take the number of distinct groups as equal to the
+ * total input size, ie, the worst case. This is too conservative, but we
+ * don't want to risk having the hashtable overrun memory; also, it's not
+ * clear how to get a decent estimate of the true size. One should note
+ * as well the propensity of novices to write UNION rather than UNION ALL
+ * even when they don't expect any duplicates...
*/
dNumGroups = plan->plan_rows;
@@ -763,7 +763,7 @@ choose_hashed_setop(PlannerInfo *root, List *groupClauses,
else
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- /* translator: %s is UNION, INTERSECT, or EXCEPT */
+ /* translator: %s is UNION, INTERSECT, or EXCEPT */
errmsg("could not implement %s", construct),
errdetail("Some of the datatypes only support hashing, while others only support sorting.")));
@@ -1260,16 +1260,16 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti)
appinfos = lappend(appinfos, appinfo);
/*
- * Translate the column permissions bitmaps to the child's attnums
- * (we have to build the translated_vars list before we can do this).
- * But if this is the parent table, leave copyObject's result alone.
+ * Translate the column permissions bitmaps to the child's attnums (we
+ * have to build the translated_vars list before we can do this). But
+ * if this is the parent table, leave copyObject's result alone.
*/
if (childOID != parentOID)
{
childrte->selectedCols = translate_col_privs(rte->selectedCols,
- appinfo->translated_vars);
+ appinfo->translated_vars);
childrte->modifiedCols = translate_col_privs(rte->modifiedCols,
- appinfo->translated_vars);
+ appinfo->translated_vars);
}
/*
@@ -1420,7 +1420,7 @@ make_inh_translation_list(Relation oldrelation, Relation newrelation,
* parent rel's attribute numbering to the child's.
*
* The only surprise here is that we don't translate a parent whole-row
- * reference into a child whole-row reference. That would mean requiring
+ * reference into a child whole-row reference. That would mean requiring
* permissions on all child columns, which is overly strict, since the
* query is really only going to reference the inherited columns. Instead
* we set the per-column bits for all inherited columns.
@@ -1435,12 +1435,12 @@ translate_col_privs(const Bitmapset *parent_privs,
ListCell *lc;
/* System attributes have the same numbers in all tables */
- for (attno = FirstLowInvalidHeapAttributeNumber+1; attno < 0; attno++)
+ for (attno = FirstLowInvalidHeapAttributeNumber + 1; attno < 0; attno++)
{
if (bms_is_member(attno - FirstLowInvalidHeapAttributeNumber,
parent_privs))
child_privs = bms_add_member(child_privs,
- attno - FirstLowInvalidHeapAttributeNumber);
+ attno - FirstLowInvalidHeapAttributeNumber);
}
/* Check if parent has whole-row reference */
@@ -1451,7 +1451,7 @@ translate_col_privs(const Bitmapset *parent_privs,
attno = InvalidAttrNumber;
foreach(lc, translated_vars)
{
- Var *var = (Var *) lfirst(lc);
+ Var *var = (Var *) lfirst(lc);
attno++;
if (var == NULL) /* ignore dropped columns */
@@ -1461,7 +1461,7 @@ translate_col_privs(const Bitmapset *parent_privs,
bms_is_member(attno - FirstLowInvalidHeapAttributeNumber,
parent_privs))
child_privs = bms_add_member(child_privs,
- var->varattno - FirstLowInvalidHeapAttributeNumber);
+ var->varattno - FirstLowInvalidHeapAttributeNumber);
}
return child_privs;
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index c9c7270d2b..75c5d0c94d 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.276 2009/02/25 03:30:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.277 2009/06/11 14:48:59 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -98,8 +98,8 @@ static Expr *simplify_function(Oid funcid,
bool allow_inline,
eval_const_expressions_context *context);
static List *add_function_defaults(List *args, Oid result_type,
- HeapTuple func_tuple,
- eval_const_expressions_context *context);
+ HeapTuple func_tuple,
+ eval_const_expressions_context *context);
static Expr *evaluate_function(Oid funcid,
Oid result_type, int32 result_typmod, List *args,
HeapTuple func_tuple,
@@ -114,9 +114,9 @@ static Node *substitute_actual_parameters_mutator(Node *node,
static void sql_inline_error_callback(void *arg);
static Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod);
static Query *substitute_actual_srf_parameters(Query *expr,
- int nargs, List *args);
+ int nargs, List *args);
static Node *substitute_actual_srf_parameters_mutator(Node *node,
- substitute_actual_srf_parameters_context *context);
+ substitute_actual_srf_parameters_context *context);
static bool tlist_matches_coltypelist(List *tlist, List *coltypelist);
@@ -612,7 +612,8 @@ find_window_functions_walker(Node *node, WindowFuncLists *lists)
lists->numWindowFuncs++;
/*
- * Complain if the window function's arguments contain window functions
+ * Complain if the window function's arguments contain window
+ * functions
*/
if (contain_window_function((Node *) wfunc->args))
ereport(ERROR,
@@ -1557,8 +1558,8 @@ find_forced_null_vars(Node *node)
/*
* We don't bother considering the OR case, because it's fairly
- * unlikely anyone would write "v1 IS NULL OR v1 IS NULL".
- * Likewise, the NOT case isn't worth expending code on.
+ * unlikely anyone would write "v1 IS NULL OR v1 IS NULL". Likewise,
+ * the NOT case isn't worth expending code on.
*/
if (expr->boolop == AND_EXPR)
{
@@ -1594,7 +1595,7 @@ find_forced_null_var(Node *node)
if (expr->nulltesttype == IS_NULL)
{
- Var *var = (Var *) expr->arg;
+ Var *var = (Var *) expr->arg;
if (var && IsA(var, Var) &&
var->varlevelsup == 0)
@@ -1608,7 +1609,7 @@ find_forced_null_var(Node *node)
if (expr->booltesttype == IS_UNKNOWN)
{
- Var *var = (Var *) expr->arg;
+ Var *var = (Var *) expr->arg;
if (var && IsA(var, Var) &&
var->varlevelsup == 0)
@@ -2013,7 +2014,7 @@ eval_const_expressions(PlannerInfo *root, Node *node)
if (root)
{
context.boundParams = root->glob->boundParams; /* bound Params */
- context.glob = root->glob; /* for inlined-function dependencies */
+ context.glob = root->glob; /* for inlined-function dependencies */
}
else
{
@@ -2453,9 +2454,9 @@ eval_const_expressions_mutator(Node *node,
/*
* CoerceViaIO represents calling the source type's output function
- * then the result type's input function. So, try to simplify it
- * as though it were a stack of two such function calls. First we
- * need to know what the functions are.
+ * then the result type's input function. So, try to simplify it as
+ * though it were a stack of two such function calls. First we need
+ * to know what the functions are.
*/
getTypeOutputInfo(exprType((Node *) arg), &outfunc, &outtypisvarlena);
getTypeInputInfo(expr->resulttype, &infunc, &intypioparam);
@@ -2505,8 +2506,8 @@ eval_const_expressions_mutator(Node *node,
ArrayCoerceExpr *newexpr;
/*
- * Reduce constants in the ArrayCoerceExpr's argument, then build
- * a new ArrayCoerceExpr.
+ * Reduce constants in the ArrayCoerceExpr's argument, then build a
+ * new ArrayCoerceExpr.
*/
arg = (Expr *) eval_const_expressions_mutator((Node *) expr->arg,
context);
@@ -2925,7 +2926,7 @@ eval_const_expressions_mutator(Node *node,
newbtest->booltesttype = btest->booltesttype;
return (Node *) newbtest;
}
- if (IsA(node, PlaceHolderVar) && context->estimate)
+ if (IsA(node, PlaceHolderVar) &&context->estimate)
{
/*
* In estimation mode, just strip the PlaceHolderVar node altogether;
@@ -3266,7 +3267,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
*
* It is possible for some of the defaulted arguments to be polymorphic;
* therefore we can't assume that the default expressions have the correct
- * data types already. We have to re-resolve polymorphics and do coercion
+ * data types already. We have to re-resolve polymorphics and do coercion
* just like the parser did.
*/
static List *
@@ -3594,7 +3595,7 @@ inline_function(Oid funcid, Oid result_type, List *args,
/*
* 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 that check_sql_fn_retval will also insert
+ * fail at runtime anyway. Note that check_sql_fn_retval will also insert
* a RelabelType if needed to make the tlist expression match the declared
* type of the function.
*
@@ -3695,8 +3696,8 @@ inline_function(Oid funcid, Oid result_type, List *args,
MemoryContextDelete(mycxt);
/*
- * Since there is now no trace of the function in the plan tree, we
- * must explicitly record the plan's dependency on the function.
+ * Since there is now no trace of the function in the plan tree, we must
+ * explicitly record the plan's dependency on the function.
*/
if (context->glob)
record_plan_function_dependency(context->glob, funcid);
@@ -3825,7 +3826,7 @@ evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod)
fix_opfuncids((Node *) expr);
/*
- * Prepare expr for execution. (Note: we can't use ExecPrepareExpr
+ * Prepare expr for execution. (Note: we can't use ExecPrepareExpr
* because it'd result in recursively invoking eval_const_expressions.)
*/
exprstate = ExecInitExpr(expr, NULL);
@@ -3908,10 +3909,10 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
Assert(rte->rtekind == RTE_FUNCTION);
/*
- * It doesn't make a lot of sense for a SQL SRF to refer to itself
- * in its own FROM clause, since that must cause infinite recursion
- * at runtime. It will cause this code to recurse too, so check
- * for stack overflow. (There's no need to do more.)
+ * It doesn't make a lot of sense for a SQL SRF to refer to itself in its
+ * own FROM clause, since that must cause infinite recursion at runtime.
+ * It will cause this code to recurse too, so check for stack overflow.
+ * (There's no need to do more.)
*/
check_stack_depth();
@@ -3922,8 +3923,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
/*
* The function must be declared to return a set, else inlining would
- * change the results if the contained SELECT didn't return exactly
- * one row.
+ * change the results if the contained SELECT didn't return exactly one
+ * row.
*/
if (!fexpr->funcretset)
return NULL;
@@ -3932,7 +3933,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
* Refuse to inline if the arguments contain any volatile functions or
* sub-selects. Volatile functions are rejected because inlining may
* result in the arguments being evaluated multiple times, risking a
- * change in behavior. Sub-selects are rejected partly for implementation
+ * change in behavior. Sub-selects are rejected partly for implementation
* reasons (pushing them down another level might change their behavior)
* and partly because they're likely to be expensive and so multiple
* evaluation would be bad.
@@ -3957,7 +3958,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
/*
* Forget it if the function is not SQL-language or has other showstopper
- * properties. In particular it mustn't be declared STRICT, since we
+ * properties. In particular it mustn't be declared STRICT, since we
* couldn't enforce that. It also mustn't be VOLATILE, because that is
* supposed to cause it to be executed with its own snapshot, rather than
* sharing the snapshot of the calling query. (The nargs check is just
@@ -4017,16 +4018,16 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
src = TextDatumGetCString(tmp);
/*
- * Parse, analyze, and rewrite (unlike inline_function(), we can't
- * skip rewriting here). We can fail as soon as we find more than
- * one query, though.
+ * Parse, analyze, and rewrite (unlike inline_function(), we can't skip
+ * rewriting here). We can fail as soon as we find more than one query,
+ * though.
*/
raw_parsetree_list = pg_parse_query(src);
if (list_length(raw_parsetree_list) != 1)
goto fail;
querytree_list = pg_analyze_and_rewrite(linitial(raw_parsetree_list), src,
- argtypes, funcform->pronargs);
+ argtypes, funcform->pronargs);
if (list_length(querytree_list) != 1)
goto fail;
querytree = linitial(querytree_list);
@@ -4043,13 +4044,13 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
/*
* 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 that check_sql_fn_retval will also insert
+ * fail at runtime anyway. Note that check_sql_fn_retval will also insert
* RelabelType(s) if needed to make the tlist expression(s) match the
* declared type of the function.
*
- * If the function returns a composite type, don't inline unless the
- * check shows it's returning a whole tuple result; otherwise what
- * it's returning is a single composite column which is not what we need.
+ * If the function returns a composite type, don't inline unless the check
+ * shows it's returning a whole tuple result; otherwise what it's
+ * returning is a single composite column which is not what we need.
*/
if (!check_sql_fn_retval(fexpr->funcid, fexpr->funcresulttype,
querytree_list,
@@ -4076,8 +4077,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
fexpr->args);
/*
- * Copy the modified query out of the temporary memory context,
- * and clean up.
+ * Copy the modified query out of the temporary memory context, and clean
+ * up.
*/
MemoryContextSwitchTo(oldcxt);
@@ -4088,8 +4089,8 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
ReleaseSysCache(func_tuple);
/*
- * Since there is now no trace of the function in the plan tree, we
- * must explicitly record the plan's dependency on the function.
+ * Since there is now no trace of the function in the plan tree, we must
+ * explicitly record the plan's dependency on the function.
*/
record_plan_function_dependency(root->glob, fexpr->funcid);
@@ -4128,9 +4129,9 @@ substitute_actual_srf_parameters(Query *expr, int nargs, List *args)
static Node *
substitute_actual_srf_parameters_mutator(Node *node,
- substitute_actual_srf_parameters_context *context)
+ substitute_actual_srf_parameters_context *context)
{
- Node *result;
+ Node *result;
if (node == NULL)
return NULL;
@@ -4138,7 +4139,7 @@ substitute_actual_srf_parameters_mutator(Node *node,
{
context->sublevels_up++;
result = (Node *) query_tree_mutator((Query *) node,
- substitute_actual_srf_parameters_mutator,
+ substitute_actual_srf_parameters_mutator,
(void *) context,
0);
context->sublevels_up--;
@@ -4154,8 +4155,8 @@ substitute_actual_srf_parameters_mutator(Node *node,
elog(ERROR, "invalid paramid: %d", param->paramid);
/*
- * Since the parameter is being inserted into a subquery,
- * we must adjust levels.
+ * Since the parameter is being inserted into a subquery, we must
+ * adjust levels.
*/
result = copyObject(list_nth(context->args, param->paramid - 1));
IncrementVarSublevelsUp(result, context->sublevels_up, 0);
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 5ba413bb1a..b0358cb112 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.151 2009/03/26 17:15:35 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/pathnode.c,v 1.152 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -797,7 +797,7 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
in_operators = NIL;
uniq_exprs = NIL;
all_btree = true;
- all_hash = enable_hashagg; /* don't consider hash if not enabled */
+ all_hash = enable_hashagg; /* don't consider hash if not enabled */
foreach(lc, sjinfo->join_quals)
{
OpExpr *op = (OpExpr *) lfirst(lc);
@@ -904,8 +904,8 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
goto no_unique_path;
/*
- * If we get here, we can unique-ify using at least one of sorting
- * and hashing. Start building the result Path object.
+ * If we get here, we can unique-ify using at least one of sorting and
+ * hashing. Start building the result Path object.
*/
pathnode = makeNode(UniquePath);
@@ -972,8 +972,8 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
-1.0);
/*
- * Charge one cpu_operator_cost per comparison per input tuple.
- * We assume all columns get compared at most of the tuples. (XXX
+ * Charge one cpu_operator_cost per comparison per input tuple. We
+ * assume all columns get compared at most of the tuples. (XXX
* probably this is an overestimate.) This should agree with
* make_unique.
*/
@@ -1030,7 +1030,7 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
return pathnode;
-no_unique_path: /* failure exit */
+no_unique_path: /* failure exit */
/* Mark the SpecialJoinInfo as not unique-able */
sjinfo->join_quals = NIL;
@@ -1404,27 +1404,27 @@ create_mergejoin_path(PlannerInfo *root,
* selected as the input of a mergejoin, and they don't support
* mark/restore at present.
*
- * Note: Sort supports mark/restore, so no materialize is really needed
- * in that case; but one may be desirable anyway to optimize the sort.
- * However, since we aren't representing the sort step separately in
- * the Path tree, we can't explicitly represent the materialize either.
- * So that case is not handled here. Instead, cost_mergejoin has to
- * factor in the cost and create_mergejoin_plan has to add the plan node.
+ * Note: Sort supports mark/restore, so no materialize is really needed in
+ * that case; but one may be desirable anyway to optimize the sort.
+ * However, since we aren't representing the sort step separately in the
+ * Path tree, we can't explicitly represent the materialize either. So
+ * that case is not handled here. Instead, cost_mergejoin has to factor
+ * in the cost and create_mergejoin_plan has to add the plan node.
*/
if (innersortkeys == NIL &&
!ExecSupportsMarkRestore(inner_path->pathtype))
{
- Path *mpath;
+ Path *mpath;
mpath = (Path *) create_material_path(inner_path->parent, inner_path);
/*
- * We expect the materialize won't spill to disk (it could only do
- * so if there were a whole lot of duplicate tuples, which is a case
- * cost_mergejoin will avoid choosing anyway). Therefore
- * cost_material's cost estimate is bogus and we should charge
- * just cpu_tuple_cost per tuple. (Keep this estimate in sync with
- * similar ones in cost_mergejoin and create_mergejoin_plan.)
+ * We expect the materialize won't spill to disk (it could only do so
+ * if there were a whole lot of duplicate tuples, which is a case
+ * cost_mergejoin will avoid choosing anyway). Therefore
+ * cost_material's cost estimate is bogus and we should charge just
+ * cpu_tuple_cost per tuple. (Keep this estimate in sync with similar
+ * ones in cost_mergejoin and create_mergejoin_plan.)
*/
mpath->startup_cost = inner_path->startup_cost;
mpath->total_cost = inner_path->total_cost;
@@ -1480,16 +1480,17 @@ create_hashjoin_path(PlannerInfo *root,
pathnode->jpath.outerjoinpath = outer_path;
pathnode->jpath.innerjoinpath = inner_path;
pathnode->jpath.joinrestrictinfo = restrict_clauses;
+
/*
* A hashjoin never has pathkeys, since its output ordering is
- * unpredictable due to possible batching. XXX If the inner relation is
+ * unpredictable due to possible batching. XXX If the inner relation is
* small enough, we could instruct the executor that it must not batch,
* and then we could assume that the output inherits the outer relation's
- * ordering, which might save a sort step. However there is considerable
- * downside if our estimate of the inner relation size is badly off.
- * For the moment we don't risk it. (Note also that if we wanted to take
- * this seriously, joinpath.c would have to consider many more paths for
- * the outer rel than it does now.)
+ * ordering, which might save a sort step. However there is considerable
+ * downside if our estimate of the inner relation size is badly off. For
+ * the moment we don't risk it. (Note also that if we wanted to take this
+ * seriously, joinpath.c would have to consider many more paths for the
+ * outer rel than it does now.)
*/
pathnode->jpath.path.pathkeys = NIL;
pathnode->path_hashclauses = hashclauses;
diff --git a/src/backend/optimizer/util/placeholder.c b/src/backend/optimizer/util/placeholder.c
index 019352158d..b06c48c1e4 100644
--- a/src/backend/optimizer/util/placeholder.c
+++ b/src/backend/optimizer/util/placeholder.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/placeholder.c,v 1.4 2009/04/19 19:46:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/placeholder.c,v 1.5 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,7 +72,7 @@ find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv)
phinfo->ph_var = copyObject(phv);
phinfo->ph_eval_at = pull_varnos((Node *) phv);
/* ph_eval_at may change later, see fix_placeholder_eval_levels */
- phinfo->ph_needed = NULL; /* initially it's unused */
+ phinfo->ph_needed = NULL; /* initially it's unused */
/* for the moment, estimate width using just the datatype info */
phinfo->ph_width = get_typavgwidth(exprType((Node *) phv->phexpr),
exprTypmod((Node *) phv->phexpr));
@@ -88,7 +88,7 @@ find_placeholder_info(PlannerInfo *root, PlaceHolderVar *phv)
*
* The initial eval_at level set by find_placeholder_info was the set of
* rels used in the placeholder's expression (or the whole subselect if
- * the expr is variable-free). If the subselect contains any outer joins
+ * the expr is variable-free). If the subselect contains any outer joins
* that can null any of those rels, we must delay evaluation to above those
* joins.
*
@@ -153,11 +153,11 @@ fix_placeholder_eval_levels(PlannerInfo *root)
/*
* Now that we know where to evaluate the placeholder, make sure that
* any vars or placeholders it uses will be available at that join
- * level. NOTE: this could cause more PlaceHolderInfos to be added
- * to placeholder_list. That is okay because we'll process them
- * before falling out of the foreach loop. Also, it could cause
- * the ph_needed sets of existing list entries to expand, which
- * is also okay because this loop doesn't examine those.
+ * level. NOTE: this could cause more PlaceHolderInfos to be added to
+ * placeholder_list. That is okay because we'll process them before
+ * falling out of the foreach loop. Also, it could cause the
+ * ph_needed sets of existing list entries to expand, which is also
+ * okay because this loop doesn't examine those.
*/
if (bms_membership(eval_at) == BMS_MULTIPLE)
{
@@ -173,7 +173,7 @@ fix_placeholder_eval_levels(PlannerInfo *root)
* Now, if any placeholder can be computed at a base rel and is needed
* above it, add it to that rel's targetlist. (This is essentially the
* same logic as in add_placeholders_to_joinrel, but we can't do that part
- * until joinrels are formed.) We have to do this as a separate step
+ * until joinrels are formed.) We have to do this as a separate step
* because the ph_needed values aren't stable until the previous loop
* finishes.
*/
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index 0479e93ec8..4f07cade68 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.157 2009/05/12 00:56:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.158 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -525,7 +525,7 @@ get_relation_constraints(PlannerInfo *root,
/* Add NOT NULL constraints in expression form, if requested */
if (include_notnull && constr->has_not_null)
{
- int natts = relation->rd_att->natts;
+ int natts = relation->rd_att->natts;
for (i = 1; i <= natts; i++)
{
@@ -533,7 +533,7 @@ get_relation_constraints(PlannerInfo *root,
if (att->attnotnull && !att->attisdropped)
{
- NullTest *ntest = makeNode(NullTest);
+ NullTest *ntest = makeNode(NullTest);
ntest->arg = (Expr *) makeVar(varno,
i,
@@ -604,7 +604,7 @@ relation_excluded_by_constraints(PlannerInfo *root,
return false;
/*
- * OK to fetch the constraint expressions. Include "col IS NOT NULL"
+ * OK to fetch the constraint expressions. Include "col IS NOT NULL"
* expressions for attnotnull columns, in case we can refute those.
*/
constraint_pred = get_relation_constraints(root, rte->relid, rel, true);
@@ -865,10 +865,10 @@ has_unique_index(RelOptInfo *rel, AttrNumber attno)
/*
* Note: ignore partial indexes, since they don't allow us to conclude
* that all attr values are distinct, *unless* they are marked predOK
- * which means we know the index's predicate is satisfied by the query.
- * We don't take any interest in expressional indexes either. Also, a
- * multicolumn unique index doesn't allow us to conclude that just the
- * specified attr is unique.
+ * which means we know the index's predicate is satisfied by the
+ * query. We don't take any interest in expressional indexes either.
+ * Also, a multicolumn unique index doesn't allow us to conclude that
+ * just the specified attr is unique.
*/
if (index->unique &&
index->ncolumns == 1 &&
diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c
index 3249b2726e..2b9f7727d8 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.26 2009/05/11 17:56:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/predtest.c,v 1.27 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -98,7 +98,7 @@ static Node *extract_not_arg(Node *clause);
static bool list_member_strip(List *list, Expr *datum);
static bool btree_predicate_proof(Expr *predicate, Node *clause,
bool refute_it);
-static Oid get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it);
+static Oid get_btree_test_op(Oid pred_op, Oid clause_op, bool refute_it);
static void InvalidateOprProofCacheCallBack(Datum arg, int cacheid, ItemPointer tuplePtr);
@@ -134,7 +134,7 @@ predicate_implied_by(List *predicate_list, List *restrictinfo_list)
/*
* If either input is a single-element list, replace it with its lone
- * member; this avoids one useless level of AND-recursion. We only need
+ * member; this avoids one useless level of AND-recursion. We only need
* to worry about this at top level, since eval_const_expressions should
* have gotten rid of any trivial ANDs or ORs below that.
*/
@@ -192,7 +192,7 @@ predicate_refuted_by(List *predicate_list, List *restrictinfo_list)
/*
* If either input is a single-element list, replace it with its lone
- * member; this avoids one useless level of AND-recursion. We only need
+ * member; this avoids one useless level of AND-recursion. We only need
* to worry about this at top level, since eval_const_expressions should
* have gotten rid of any trivial ANDs or ORs below that.
*/
@@ -652,13 +652,14 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate)
case CLASS_ATOM:
#ifdef NOT_USED
+
/*
* If A is a NOT-clause, A R=> B if B => A's arg
*
* Unfortunately not: this would only prove that B is not-TRUE,
* not that it's not NULL either. Keep this code as a comment
- * because it would be useful if we ever had a need for the
- * weak form of refutation.
+ * because it would be useful if we ever had a need for the weak
+ * form of refutation.
*/
not_arg = extract_not_arg(clause);
if (not_arg &&
@@ -738,7 +739,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate)
* This function also implements enforcement of MAX_SAOP_ARRAY_SIZE: if a
* ScalarArrayOpExpr's array has too many elements, we just classify it as an
* atom. (This will result in its being passed as-is to the simple_clause
- * functions, which will fail to prove anything about it.) Note that we
+ * functions, which will fail to prove anything about it.) Note that we
* cannot just stop after considering MAX_SAOP_ARRAY_SIZE elements; in general
* that would result in wrong proofs, rather than failing to prove anything.
*/
@@ -1484,8 +1485,8 @@ typedef struct OprProofCacheEntry
bool have_implic; /* do we know the implication result? */
bool have_refute; /* do we know the refutation result? */
- Oid implic_test_op; /* OID of the operator, or 0 if none */
- Oid refute_test_op; /* OID of the operator, or 0 if none */
+ Oid implic_test_op; /* OID of the operator, or 0 if none */
+ Oid refute_test_op; /* OID of the operator, or 0 if none */
} OprProofCacheEntry;
static HTAB *OprProofCacheHash = NULL;
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
index 2d289cae71..4ca3eeaaf2 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.93 2009/01/01 17:23:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.94 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -430,8 +430,8 @@ build_joinrel_tlist(PlannerInfo *root, RelOptInfo *joinrel,
int ndx;
/*
- * Ignore PlaceHolderVars in the input tlists; we'll make our
- * own decisions about whether to copy them.
+ * Ignore PlaceHolderVars in the input tlists; we'll make our own
+ * decisions about whether to copy them.
*/
if (IsA(origvar, PlaceHolderVar))
continue;
diff --git a/src/backend/optimizer/util/restrictinfo.c b/src/backend/optimizer/util/restrictinfo.c
index 5b75d2de3b..47086a4bfc 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.59 2009/05/09 22:51:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/restrictinfo.c,v 1.60 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -593,9 +593,9 @@ select_nonredundant_join_clauses(PlannerInfo *root,
* OK because we're only trying to prove we can dispense with some
* join quals; failing to prove that doesn't result in an incorrect
* plan. It's quite unlikely that a join qual could be proven
- * redundant by an index predicate anyway. (Also, if we did manage
- * to prove it, we'd have to have a special case for update targets;
- * see notes about EvalPlanQual testing in create_indexscan_plan().)
+ * redundant by an index predicate anyway. (Also, if we did manage to
+ * prove it, we'd have to have a special case for update targets; see
+ * notes about EvalPlanQual testing in create_indexscan_plan().)
*/
BitmapHeapPath *innerpath = (BitmapHeapPath *) inner_path;
@@ -614,10 +614,10 @@ select_nonredundant_join_clauses(PlannerInfo *root,
}
/*
- * XXX the inner path of a nestloop could also be an append relation
- * whose elements use join quals. However, they might each use different
- * quals; we could only remove join quals that are enforced by all the
- * appendrel members. For the moment we don't bother to try.
+ * XXX the inner path of a nestloop could also be an append relation whose
+ * elements use join quals. However, they might each use different quals;
+ * we could only remove join quals that are enforced by all the appendrel
+ * members. For the moment we don't bother to try.
*/
return restrictinfo_list;
diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c
index cd88c337f1..deb9ef8ebd 100644
--- a/src/backend/optimizer/util/var.c
+++ b/src/backend/optimizer/util/var.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.85 2009/04/19 19:46:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/var.c,v 1.86 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,9 +71,9 @@ static bool pull_varattnos_walker(Node *node, Bitmapset **varattnos);
static bool contain_var_clause_walker(Node *node, void *context);
static bool contain_vars_of_level_walker(Node *node, int *sublevels_up);
static bool locate_var_of_level_walker(Node *node,
- locate_var_of_level_context *context);
+ locate_var_of_level_context *context);
static bool locate_var_of_relation_walker(Node *node,
- locate_var_of_relation_context *context);
+ locate_var_of_relation_context *context);
static bool find_minimum_var_level_walker(Node *node,
find_minimum_var_level_context *context);
static bool pull_var_clause_walker(Node *node,
@@ -318,7 +318,7 @@ contain_vars_of_level_walker(Node *node, int *sublevels_up)
* Find the parse location of any Var of the specified query level.
*
* Returns -1 if no such Var is in the querytree, or if they all have
- * unknown parse location. (The former case is probably caller error,
+ * unknown parse location. (The former case is probably caller error,
* but we don't bother to distinguish it from the latter case.)
*
* Will recurse into sublinks. Also, may be invoked directly on a Query.
@@ -333,7 +333,7 @@ locate_var_of_level(Node *node, int levelsup)
{
locate_var_of_level_context context;
- context.var_location = -1; /* in case we find nothing */
+ context.var_location = -1; /* in case we find nothing */
context.sublevels_up = levelsup;
(void) query_or_expression_tree_walker(node,
@@ -352,7 +352,7 @@ locate_var_of_level_walker(Node *node,
return false;
if (IsA(node, Var))
{
- Var *var = (Var *) node;
+ Var *var = (Var *) node;
if (var->varlevelsup == context->sublevels_up &&
var->location >= 0)
@@ -401,7 +401,7 @@ locate_var_of_relation(Node *node, int relid, int levelsup)
{
locate_var_of_relation_context context;
- context.var_location = -1; /* in case we find nothing */
+ context.var_location = -1; /* in case we find nothing */
context.relid = relid;
context.sublevels_up = levelsup;
@@ -421,7 +421,7 @@ locate_var_of_relation_walker(Node *node,
return false;
if (IsA(node, Var))
{
- Var *var = (Var *) node;
+ Var *var = (Var *) node;
if (var->varno == context->relid &&
var->varlevelsup == context->sublevels_up &&
@@ -625,7 +625,7 @@ find_minimum_var_level_walker(Node *node,
* Upper-level vars (with varlevelsup > 0) are not included.
* (These probably represent errors too, but we don't complain.)
*
- * Returns list of nodes found. Note the nodes themselves are not
+ * Returns list of nodes found. Note the nodes themselves are not
* copied, only referenced.
*
* Does not examine subqueries, therefore must only be used after reduction
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 397e951c71..97c560b309 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -17,7 +17,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.388 2009/01/22 20:16:04 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.389 2009/06/11 14:48:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,7 +50,7 @@ static Query *transformSelectStmt(ParseState *pstate, SelectStmt *stmt);
static Query *transformValuesClause(ParseState *pstate, SelectStmt *stmt);
static Query *transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt);
static Node *transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
- List **colInfo);
+ List **colInfo);
static void applyColumnNames(List *dst, List *src);
static Query *transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt);
static List *transformReturningList(ParseState *pstate, List *returningList);
@@ -59,7 +59,7 @@ static Query *transformDeclareCursorStmt(ParseState *pstate,
static Query *transformExplainStmt(ParseState *pstate,
ExplainStmt *stmt);
static void transformLockingClause(ParseState *pstate,
- Query *qry, LockingClause *lc);
+ Query *qry, LockingClause *lc);
static bool check_parameter_resolution_walker(Node *node, ParseState *pstate);
@@ -81,7 +81,7 @@ parse_analyze(Node *parseTree, const char *sourceText,
ParseState *pstate = make_parsestate(NULL);
Query *query;
- Assert(sourceText != NULL); /* required as of 8.4 */
+ Assert(sourceText != NULL); /* required as of 8.4 */
pstate->p_sourcetext = sourceText;
pstate->p_paramtypes = paramTypes;
@@ -109,7 +109,7 @@ parse_analyze_varparams(Node *parseTree, const char *sourceText,
ParseState *pstate = make_parsestate(NULL);
Query *query;
- Assert(sourceText != NULL); /* required as of 8.4 */
+ Assert(sourceText != NULL); /* required as of 8.4 */
pstate->p_sourcetext = sourceText;
pstate->p_paramtypes = *paramTypes;
@@ -255,6 +255,7 @@ analyze_requires_snapshot(Node *parseTree)
break;
case T_ExplainStmt:
+
/*
* We only need a snapshot in varparams case, but it doesn't seem
* worth complicating this function's API to distinguish that.
@@ -423,7 +424,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
* bugs of just that nature...)
*/
sub_pstate->p_rtable = sub_rtable;
- sub_pstate->p_joinexprs = NIL; /* sub_rtable has no joins */
+ sub_pstate->p_joinexprs = NIL; /* sub_rtable has no joins */
sub_pstate->p_relnamespace = sub_relnamespace;
sub_pstate->p_varnamespace = sub_varnamespace;
@@ -441,7 +442,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("INSERT ... SELECT cannot specify INTO"),
parser_errposition(pstate,
- exprLocation((Node *) selectQuery->intoClause))));
+ exprLocation((Node *) selectQuery->intoClause))));
/*
* Make the source be a subquery in the INSERT's rangetable, and add
@@ -485,11 +486,12 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
expr = tle->expr;
else
{
- Var *var = makeVar(rtr->rtindex,
- tle->resno,
- exprType((Node *) tle->expr),
- exprTypmod((Node *) tle->expr),
- 0);
+ Var *var = makeVar(rtr->rtindex,
+ tle->resno,
+ exprType((Node *) tle->expr),
+ exprTypmod((Node *) tle->expr),
+ 0);
+
var->location = exprLocation((Node *) tle->expr);
expr = (Expr *) var;
}
@@ -563,7 +565,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("VALUES must not contain table references"),
parser_errposition(pstate,
- locate_var_of_level((Node *) exprsLists, 0))));
+ locate_var_of_level((Node *) exprsLists, 0))));
/*
* Another thing we can't currently support is NEW/OLD references in
@@ -578,7 +580,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
errmsg("VALUES must not contain OLD or NEW references"),
errhint("Use SELECT ... UNION ALL ... instead."),
parser_errposition(pstate,
- locate_var_of_level((Node *) exprsLists, 0))));
+ locate_var_of_level((Node *) exprsLists, 0))));
/*
* Generate the VALUES RTE
@@ -655,7 +657,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
qry->targetList = lappend(qry->targetList, tle);
rte->modifiedCols = bms_add_member(rte->modifiedCols,
- attr_num - FirstLowInvalidHeapAttributeNumber);
+ attr_num - FirstLowInvalidHeapAttributeNumber);
icols = lnext(icols);
attnos = lnext(attnos);
@@ -727,7 +729,7 @@ transformInsertRow(ParseState *pstate, List *exprlist,
errmsg("INSERT has more expressions than target columns"),
parser_errposition(pstate,
exprLocation(list_nth(exprlist,
- list_length(icolumns))))));
+ list_length(icolumns))))));
if (stmtcols != NIL &&
list_length(exprlist) < list_length(icolumns))
ereport(ERROR,
@@ -735,7 +737,7 @@ transformInsertRow(ParseState *pstate, List *exprlist,
errmsg("INSERT has more target columns than expressions"),
parser_errposition(pstate,
exprLocation(list_nth(icolumns,
- list_length(exprlist))))));
+ list_length(exprlist))))));
/*
* Prepare columns for assignment to target table.
@@ -816,9 +818,9 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
/*
* Transform sorting/grouping stuff. Do ORDER BY first because both
- * transformGroupClause and transformDistinctClause need the results.
- * Note that these functions can also change the targetList, so it's
- * passed to them by reference.
+ * transformGroupClause and transformDistinctClause need the results. Note
+ * that these functions can also change the targetList, so it's passed to
+ * them by reference.
*/
qry->sortClause = transformSortClause(pstate,
stmt->sortClause,
@@ -1068,7 +1070,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("VALUES must not contain table references"),
parser_errposition(pstate,
- locate_var_of_level((Node *) newExprsLists, 0))));
+ locate_var_of_level((Node *) newExprsLists, 0))));
/*
* Another thing we can't currently support is NEW/OLD references in rules
@@ -1083,7 +1085,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
errmsg("VALUES must not contain OLD or NEW references"),
errhint("Use SELECT ... UNION ALL ... instead."),
parser_errposition(pstate,
- locate_var_of_level((Node *) newExprsLists, 0))));
+ locate_var_of_level((Node *) newExprsLists, 0))));
qry->rtable = pstate->p_rtable;
qry->jointree = makeFromExpr(pstate->p_joinlist, NULL);
@@ -1095,13 +1097,13 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("cannot use aggregate function in VALUES"),
parser_errposition(pstate,
- locate_agg_of_level((Node *) newExprsLists, 0))));
+ locate_agg_of_level((Node *) newExprsLists, 0))));
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot use window function in VALUES"),
parser_errposition(pstate,
- locate_windowfunc((Node *) newExprsLists))));
+ locate_windowfunc((Node *) newExprsLists))));
return qry;
}
@@ -1302,7 +1304,7 @@ transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt)
errdetail("Only result column names can be used, not expressions or functions."),
errhint("Add the expression/function to every SELECT, or move the UNION into a FROM clause."),
parser_errposition(pstate,
- exprLocation(list_nth(qry->targetList, tllen)))));
+ exprLocation(list_nth(qry->targetList, tllen)))));
qry->limitOffset = transformLimitClause(pstate, limitOffset,
"OFFSET");
@@ -1368,7 +1370,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("INTO is only allowed on first SELECT of UNION/INTERSECT/EXCEPT"),
parser_errposition(pstate,
- exprLocation((Node *) stmt->intoClause))));
+ exprLocation((Node *) stmt->intoClause))));
/* We don't support FOR UPDATE/SHARE with set ops at the moment. */
if (stmt->lockingClause)
@@ -1428,7 +1430,7 @@ transformSetOperationTree(ParseState *pstate, SelectStmt *stmt,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("UNION/INTERSECT/EXCEPT member statement cannot refer to other relations of same query level"),
parser_errposition(pstate,
- locate_var_of_level((Node *) selectQuery, 1))));
+ locate_var_of_level((Node *) selectQuery, 1))));
}
/*
@@ -1790,8 +1792,8 @@ transformReturningList(ParseState *pstate, List *returningList)
/* no new relation references please */
if (list_length(pstate->p_rtable) != length_rtable)
{
- int vlocation = -1;
- int relid;
+ int vlocation = -1;
+ int relid;
/* try to locate such a reference to point to */
for (relid = length_rtable + 1; relid <= list_length(pstate->p_rtable); relid++)
@@ -1802,7 +1804,7 @@ transformReturningList(ParseState *pstate, List *returningList)
}
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("RETURNING cannot contain references to other relations"),
+ errmsg("RETURNING cannot contain references to other relations"),
parser_errposition(pstate, vlocation)));
}
@@ -1857,7 +1859,7 @@ transformDeclareCursorStmt(ParseState *pstate, DeclareCursorStmt *stmt)
(errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
errmsg("DECLARE CURSOR cannot specify INTO"),
parser_errposition(pstate,
- exprLocation((Node *) result->intoClause))));
+ exprLocation((Node *) result->intoClause))));
/* FOR UPDATE and WITH HOLD are not compatible */
if (result->rowMarks != NIL && (stmt->options & CURSOR_OPT_HOLD))
@@ -2006,10 +2008,10 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc)
{
/*
* We allow FOR UPDATE/SHARE of a WITH query to be
- * propagated into the WITH, but it doesn't seem
- * very sane to allow this for a reference to an
- * outer-level WITH. And it definitely wouldn't
- * work for a self-reference, since we're not done
+ * propagated into the WITH, but it doesn't seem very
+ * sane to allow this for a reference to an
+ * outer-level WITH. And it definitely wouldn't work
+ * for a self-reference, since we're not done
* analyzing the CTE anyway.
*/
CommonTableExpr *cte;
@@ -2073,25 +2075,25 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SELECT FOR UPDATE/SHARE cannot be applied to a join"),
- parser_errposition(pstate, thisrel->location)));
+ parser_errposition(pstate, thisrel->location)));
break;
case RTE_SPECIAL:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SELECT FOR UPDATE/SHARE cannot be applied to NEW or OLD"),
- parser_errposition(pstate, thisrel->location)));
+ parser_errposition(pstate, thisrel->location)));
break;
case RTE_FUNCTION:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SELECT FOR UPDATE/SHARE cannot be applied to a function"),
- parser_errposition(pstate, thisrel->location)));
+ parser_errposition(pstate, thisrel->location)));
break;
case RTE_VALUES:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SELECT FOR UPDATE/SHARE cannot be applied to VALUES"),
- parser_errposition(pstate, thisrel->location)));
+ parser_errposition(pstate, thisrel->location)));
break;
case RTE_CTE:
{
@@ -2108,14 +2110,14 @@ transformLockingClause(ParseState *pstate, Query *qry, LockingClause *lc)
if (rte->ctelevelsup > 0 || rte->self_reference)
ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("SELECT FOR UPDATE/SHARE cannot be applied to an outer-level WITH query"),
- parser_errposition(pstate, thisrel->location)));
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("SELECT FOR UPDATE/SHARE cannot be applied to an outer-level WITH query"),
+ parser_errposition(pstate, thisrel->location)));
cte = GetCTEForRTE(pstate, rte, -1);
/* should be analyzed by now */
Assert(IsA(cte->ctequery, Query));
transformLockingClause(pstate,
- (Query *) cte->ctequery,
+ (Query *) cte->ctequery,
allrels);
}
break;
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index dea9c54693..0594396921 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.87 2009/01/01 17:23:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_agg.c,v 1.88 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -73,7 +73,7 @@ transformAggregateCall(ParseState *pstate, Aggref *agg)
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregate function calls cannot be nested"),
parser_errposition(pstate,
- locate_agg_of_level((Node *) agg->args, 0))));
+ locate_agg_of_level((Node *) agg->args, 0))));
}
/* It can't contain window functions either */
@@ -111,8 +111,8 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
WindowDef *windef)
{
/*
- * A window function call can't contain another one (but aggs are OK).
- * XXX is this required by spec, or just an unimplemented feature?
+ * A window function call can't contain another one (but aggs are OK). XXX
+ * is this required by spec, or just an unimplemented feature?
*/
if (pstate->p_hasWindowFuncs &&
checkExprHasWindowFuncs((Node *) wfunc->args))
@@ -120,13 +120,13 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("window function calls cannot be nested"),
parser_errposition(pstate,
- locate_windowfunc((Node *) wfunc->args))));
+ locate_windowfunc((Node *) wfunc->args))));
/*
- * If the OVER clause just specifies a window name, find that
- * WINDOW clause (which had better be present). Otherwise, try to
- * match all the properties of the OVER clause, and make a new entry
- * in the p_windowdefs list if no luck.
+ * If the OVER clause just specifies a window name, find that WINDOW
+ * clause (which had better be present). Otherwise, try to match all the
+ * properties of the OVER clause, and make a new entry in the p_windowdefs
+ * list if no luck.
*/
if (windef->name)
{
@@ -140,7 +140,7 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
foreach(lc, pstate->p_windowdefs)
{
- WindowDef *refwin = (WindowDef *) lfirst(lc);
+ WindowDef *refwin = (WindowDef *) lfirst(lc);
winref++;
if (refwin->name && strcmp(refwin->name, windef->name) == 0)
@@ -162,14 +162,14 @@ transformWindowFuncCall(ParseState *pstate, WindowFunc *wfunc,
foreach(lc, pstate->p_windowdefs)
{
- WindowDef *refwin = (WindowDef *) lfirst(lc);
+ WindowDef *refwin = (WindowDef *) lfirst(lc);
winref++;
if (refwin->refname && windef->refname &&
strcmp(refwin->refname, windef->refname) == 0)
- /* matched on refname */ ;
+ /* matched on refname */ ;
else if (!refwin->refname && !windef->refname)
- /* matched, no refname */ ;
+ /* matched, no refname */ ;
else
continue;
if (equal(refwin->partitionClause, windef->partitionClause) &&
@@ -242,13 +242,13 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregates not allowed in WHERE clause"),
parser_errposition(pstate,
- locate_agg_of_level(qry->jointree->quals, 0))));
+ locate_agg_of_level(qry->jointree->quals, 0))));
if (checkExprHasAggs((Node *) qry->jointree->fromlist))
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("aggregates not allowed in JOIN conditions"),
parser_errposition(pstate,
- locate_agg_of_level((Node *) qry->jointree->fromlist, 0))));
+ locate_agg_of_level((Node *) qry->jointree->fromlist, 0))));
/*
* No aggregates allowed in GROUP BY clauses, either.
@@ -277,10 +277,9 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
* If there are join alias vars involved, we have to flatten them to the
* underlying vars, so that aliased and unaliased vars will be correctly
* taken as equal. We can skip the expense of doing this if no rangetable
- * entries are RTE_JOIN kind.
- * We use the planner's flatten_join_alias_vars routine to do the
- * flattening; it wants a PlannerInfo root node, which fortunately can be
- * mostly dummy.
+ * entries are RTE_JOIN kind. We use the planner's flatten_join_alias_vars
+ * routine to do the flattening; it wants a PlannerInfo root node, which
+ * fortunately can be mostly dummy.
*/
if (hasJoinRTEs)
{
@@ -315,7 +314,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
*
* Note: because we check resjunk tlist elements as well as regular ones,
* this will also find ungrouped variables that came from ORDER BY and
- * WINDOW clauses. For that matter, it's also going to examine the
+ * WINDOW clauses. For that matter, it's also going to examine the
* grouping expressions themselves --- but they'll all pass the test ...
*/
clause = (Node *) qry->targetList;
@@ -346,14 +345,14 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
* Check for window functions where they shouldn't be.
*
* We have to forbid window functions in WHERE, JOIN/ON, HAVING, GROUP BY,
- * and window specifications. (Other clauses, such as RETURNING and LIMIT,
+ * and window specifications. (Other clauses, such as RETURNING and LIMIT,
* have already been checked.) Transformation of all these clauses must
* be completed already.
*/
void
parseCheckWindowFuncs(ParseState *pstate, Query *qry)
{
- ListCell *l;
+ ListCell *l;
/* This should only be called if we found window functions */
Assert(pstate->p_hasWindowFuncs);
@@ -363,13 +362,13 @@ parseCheckWindowFuncs(ParseState *pstate, Query *qry)
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("window functions not allowed in WHERE clause"),
parser_errposition(pstate,
- locate_windowfunc(qry->jointree->quals))));
+ locate_windowfunc(qry->jointree->quals))));
if (checkExprHasWindowFuncs((Node *) qry->jointree->fromlist))
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("window functions not allowed in JOIN conditions"),
parser_errposition(pstate,
- locate_windowfunc((Node *) qry->jointree->fromlist))));
+ locate_windowfunc((Node *) qry->jointree->fromlist))));
if (checkExprHasWindowFuncs(qry->havingQual))
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
@@ -386,14 +385,14 @@ parseCheckWindowFuncs(ParseState *pstate, Query *qry)
if (checkExprHasWindowFuncs(expr))
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("window functions not allowed in GROUP BY clause"),
+ errmsg("window functions not allowed in GROUP BY clause"),
parser_errposition(pstate,
locate_windowfunc(expr))));
}
foreach(l, qry->windowClause)
{
- WindowClause *wc = (WindowClause *) lfirst(l);
+ WindowClause *wc = (WindowClause *) lfirst(l);
ListCell *l2;
foreach(l2, wc->partitionClause)
@@ -405,7 +404,7 @@ parseCheckWindowFuncs(ParseState *pstate, Query *qry)
if (checkExprHasWindowFuncs(expr))
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("window functions not allowed in window definition"),
+ errmsg("window functions not allowed in window definition"),
parser_errposition(pstate,
locate_windowfunc(expr))));
}
@@ -418,7 +417,7 @@ parseCheckWindowFuncs(ParseState *pstate, Query *qry)
if (checkExprHasWindowFuncs(expr))
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("window functions not allowed in window definition"),
+ errmsg("window functions not allowed in window definition"),
parser_errposition(pstate,
locate_windowfunc(expr))));
}
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index 2deffa9139..8a42f5bf0a 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.188 2009/04/04 21:12:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_clause.c,v 1.189 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,7 +42,7 @@
#define DISTINCT_ON_CLAUSE 2
#define PARTITION_CLAUSE 3
-static const char * const clauseText[] = {
+static const char *const clauseText[] = {
"ORDER BY",
"GROUP BY",
"DISTINCT ON",
@@ -75,8 +75,8 @@ static Node *buildMergedJoinVar(ParseState *pstate, JoinType jointype,
Var *l_colvar, Var *r_colvar);
static TargetEntry *findTargetlistEntry(ParseState *pstate, Node *node,
List **tlist, int clause);
-static int get_matching_location(int sortgroupref,
- List *sortgrouprefs, List *exprs);
+static int get_matching_location(int sortgroupref,
+ List *sortgrouprefs, List *exprs);
static List *addTargetToSortList(ParseState *pstate, TargetEntry *tle,
List *sortlist, List *targetlist, SortBy *sortby,
bool resolveUnknown);
@@ -414,7 +414,7 @@ transformJoinOnClause(ParseState *pstate, JoinExpr *j,
errmsg("JOIN/ON clause refers to \"%s\", which is not part of JOIN",
rt_fetch(varno, pstate->p_rtable)->eref->aliasname),
parser_errposition(pstate,
- locate_var_of_relation(result, varno, 0))));
+ locate_var_of_relation(result, varno, 0))));
}
bms_free(clause_varnos);
@@ -493,7 +493,7 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("subquery in FROM cannot have SELECT INTO"),
parser_errposition(pstate,
- exprLocation((Node *) query->intoClause))));
+ exprLocation((Node *) query->intoClause))));
/*
* The subquery cannot make use of any variables from FROM items created
@@ -515,7 +515,7 @@ transformRangeSubselect(ParseState *pstate, RangeSubselect *r)
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("subquery in FROM cannot refer to other relations of same query level"),
parser_errposition(pstate,
- locate_var_of_level((Node *) query, 1))));
+ locate_var_of_level((Node *) query, 1))));
}
/*
@@ -584,7 +584,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r)
checkExprHasWindowFuncs(funcexpr))
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("cannot use window function in function expression in FROM"),
+ errmsg("cannot use window function in function expression in FROM"),
parser_errposition(pstate,
locate_windowfunc(funcexpr))));
@@ -649,7 +649,7 @@ transformFromClauseItem(ParseState *pstate, Node *n,
if (IsA(n, RangeVar))
{
/* Plain relation reference, or perhaps a CTE reference */
- RangeVar *rv = (RangeVar *) n;
+ RangeVar *rv = (RangeVar *) n;
RangeTblRef *rtr;
RangeTblEntry *rte = NULL;
int rtindex;
@@ -658,7 +658,7 @@ transformFromClauseItem(ParseState *pstate, Node *n,
if (!rv->schemaname)
{
CommonTableExpr *cte;
- Index levelsup;
+ Index levelsup;
cte = scanNameSpaceForCTE(pstate, rv->relname, &levelsup);
if (cte)
@@ -1432,11 +1432,11 @@ transformGroupClause(ParseState *pstate, List *grouplist,
* info from the (first) matching ORDER BY item. This means that if
* you write something like "GROUP BY foo ORDER BY foo USING <<<", the
* GROUP BY operation silently takes on the equality semantics implied
- * by the ORDER BY. There are two reasons to do this: it improves
- * the odds that we can implement both GROUP BY and ORDER BY with a
- * single sort step, and it allows the user to choose the equality
- * semantics used by GROUP BY, should she be working with a datatype
- * that has more than one equality operator.
+ * by the ORDER BY. There are two reasons to do this: it improves the
+ * odds that we can implement both GROUP BY and ORDER BY with a single
+ * sort step, and it allows the user to choose the equality semantics
+ * used by GROUP BY, should she be working with a datatype that has
+ * more than one equality operator.
*/
if (tle->ressortgroupref > 0)
{
@@ -1456,8 +1456,8 @@ transformGroupClause(ParseState *pstate, List *grouplist,
}
/*
- * If no match in ORDER BY, just add it to the result using
- * default sort/group semantics.
+ * If no match in ORDER BY, just add it to the result using default
+ * sort/group semantics.
*/
if (!found)
result = addTargetToGroupList(pstate, tle,
@@ -1516,10 +1516,10 @@ transformWindowDefinitions(ParseState *pstate,
foreach(lc, windowdefs)
{
- WindowDef *windef = (WindowDef *) lfirst(lc);
+ WindowDef *windef = (WindowDef *) lfirst(lc);
WindowClause *refwc = NULL;
- List *partitionClause;
- List *orderClause;
+ List *partitionClause;
+ List *orderClause;
WindowClause *wc;
winref++;
@@ -1550,8 +1550,8 @@ transformWindowDefinitions(ParseState *pstate,
/*
* Transform PARTITION and ORDER specs, if any. These are treated
- * exactly like top-level GROUP BY and ORDER BY clauses, including
- * the special handling of nondefault operator semantics.
+ * exactly like top-level GROUP BY and ORDER BY clauses, including the
+ * special handling of nondefault operator semantics.
*/
orderClause = transformSortClause(pstate,
windef->orderClause,
@@ -1573,19 +1573,19 @@ transformWindowDefinitions(ParseState *pstate,
/*
* Per spec, a windowdef that references a previous one copies the
* previous partition clause (and mustn't specify its own). It can
- * specify its own ordering clause. but only if the previous one
- * had none. It always specifies its own frame clause, and the
- * previous one must not have a frame clause. (Yeah, it's bizarre
- * that each of these cases works differently, but SQL:2008 says so;
- * see 7.11 <window clause> syntax rule 10 and general rule 1.)
+ * specify its own ordering clause. but only if the previous one had
+ * none. It always specifies its own frame clause, and the previous
+ * one must not have a frame clause. (Yeah, it's bizarre that each of
+ * these cases works differently, but SQL:2008 says so; see 7.11
+ * <window clause> syntax rule 10 and general rule 1.)
*/
if (refwc)
{
if (partitionClause)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("cannot override PARTITION BY clause of window \"%s\"",
- windef->refname),
+ errmsg("cannot override PARTITION BY clause of window \"%s\"",
+ windef->refname),
parser_errposition(pstate, windef->location)));
wc->partitionClause = copyObject(refwc->partitionClause);
}
@@ -1596,8 +1596,8 @@ transformWindowDefinitions(ParseState *pstate,
if (orderClause && refwc->orderClause)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("cannot override ORDER BY clause of window \"%s\"",
- windef->refname),
+ errmsg("cannot override ORDER BY clause of window \"%s\"",
+ windef->refname),
parser_errposition(pstate, windef->location)));
if (orderClause)
{
@@ -1652,19 +1652,19 @@ transformDistinctClause(ParseState *pstate,
ListCell *tlitem;
/*
- * The distinctClause should consist of all ORDER BY items followed
- * by all other non-resjunk targetlist items. There must not be any
- * resjunk ORDER BY items --- that would imply that we are sorting
- * by a value that isn't necessarily unique within a DISTINCT group,
- * so the results wouldn't be well-defined. This construction
- * ensures we follow the rule that sortClause and distinctClause match;
- * in fact the sortClause will always be a prefix of distinctClause.
+ * The distinctClause should consist of all ORDER BY items followed by all
+ * other non-resjunk targetlist items. There must not be any resjunk
+ * ORDER BY items --- that would imply that we are sorting by a value that
+ * isn't necessarily unique within a DISTINCT group, so the results
+ * wouldn't be well-defined. This construction ensures we follow the rule
+ * that sortClause and distinctClause match; in fact the sortClause will
+ * always be a prefix of distinctClause.
*
- * Note a corner case: the same TLE could be in the ORDER BY list
- * multiple times with different sortops. We have to include it in
- * the distinctClause the same way to preserve the prefix property.
- * The net effect will be that the TLE value will be made unique
- * according to both sortops.
+ * Note a corner case: the same TLE could be in the ORDER BY list multiple
+ * times with different sortops. We have to include it in the
+ * distinctClause the same way to preserve the prefix property. The net
+ * effect will be that the TLE value will be made unique according to both
+ * sortops.
*/
foreach(slitem, sortClause)
{
@@ -1681,8 +1681,8 @@ transformDistinctClause(ParseState *pstate,
}
/*
- * Now add any remaining non-resjunk tlist items, using default
- * sort/group semantics for their data types.
+ * Now add any remaining non-resjunk tlist items, using default sort/group
+ * semantics for their data types.
*/
foreach(tlitem, *targetlist)
{
@@ -1724,11 +1724,11 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist,
/*
* Add all the DISTINCT ON expressions to the tlist (if not already
- * present, they are added as resjunk items). Assign sortgroupref
- * numbers to them, and make a list of these numbers. (NB: we rely
- * below on the sortgrouprefs list being one-for-one with the original
- * distinctlist. Also notice that we could have duplicate DISTINCT ON
- * expressions and hence duplicate entries in sortgrouprefs.)
+ * present, they are added as resjunk items). Assign sortgroupref numbers
+ * to them, and make a list of these numbers. (NB: we rely below on the
+ * sortgrouprefs list being one-for-one with the original distinctlist.
+ * Also notice that we could have duplicate DISTINCT ON expressions and
+ * hence duplicate entries in sortgrouprefs.)
*/
foreach(lc, distinctlist)
{
@@ -1743,12 +1743,12 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist,
}
/*
- * If the user writes both DISTINCT ON and ORDER BY, adopt the
- * sorting semantics from ORDER BY items that match DISTINCT ON
- * items, and also adopt their column sort order. We insist that
- * the distinctClause and sortClause match, so throw error if we
- * find the need to add any more distinctClause items after we've
- * skipped an ORDER BY item that wasn't in DISTINCT ON.
+ * If the user writes both DISTINCT ON and ORDER BY, adopt the sorting
+ * semantics from ORDER BY items that match DISTINCT ON items, and also
+ * adopt their column sort order. We insist that the distinctClause and
+ * sortClause match, so throw error if we find the need to add any more
+ * distinctClause items after we've skipped an ORDER BY item that wasn't
+ * in DISTINCT ON.
*/
skipped_sortitem = false;
foreach(lc, sortClause)
@@ -1762,9 +1762,9 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("SELECT DISTINCT ON expressions must match initial ORDER BY expressions"),
parser_errposition(pstate,
- get_matching_location(scl->tleSortGroupRef,
- sortgrouprefs,
- distinctlist))));
+ get_matching_location(scl->tleSortGroupRef,
+ sortgrouprefs,
+ distinctlist))));
else
result = lappend(result, copyObject(scl));
}
@@ -1774,8 +1774,8 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist,
/*
* Now add any remaining DISTINCT ON items, using default sort/group
- * semantics for their data types. (Note: this is pretty questionable;
- * if the ORDER BY list doesn't include all the DISTINCT ON items and more
+ * semantics for their data types. (Note: this is pretty questionable; if
+ * the ORDER BY list doesn't include all the DISTINCT ON items and more
* besides, you certainly aren't using DISTINCT ON in the intended way,
* and you probably aren't going to get consistent results. It might be
* better to throw an error or warning here. But historically we've
@@ -1870,9 +1870,9 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle,
* Rather than clutter the API of get_sort_group_operators and the other
* functions we're about to use, make use of error context callback to
* mark any error reports with a parse position. We point to the operator
- * location if present, else to the expression being sorted. (NB: use
- * the original untransformed expression here; the TLE entry might well
- * point at a duplicate expression in the regular SELECT list.)
+ * location if present, else to the expression being sorted. (NB: use the
+ * original untransformed expression here; the TLE entry might well point
+ * at a duplicate expression in the regular SELECT list.)
*/
location = sortby->location;
if (location < 0)
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index 8513741fa4..0aec4a850e 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.176 2009/05/12 03:11:02 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.177 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -200,10 +200,10 @@ coerce_type(ParseState *pstate, Node *node,
* For most types we pass typmod -1 to the input routine, because
* existing input routines follow implicit-coercion semantics for
* length checks, which is not always what we want here. Any length
- * constraint will be applied later by our caller. An exception
+ * constraint will be applied later by our caller. An exception
* however is the INTERVAL type, for which we *must* pass the typmod
- * or it won't be able to obey the bizarre SQL-spec input rules.
- * (Ugly as sin, but so is this part of the spec...)
+ * or it won't be able to obey the bizarre SQL-spec input rules. (Ugly
+ * as sin, but so is this part of the spec...)
*/
if (baseTypeId == INTERVALOID)
inputTypeMod = baseTypeMod;
@@ -226,8 +226,8 @@ coerce_type(ParseState *pstate, Node *node,
newcon->location = location;
/*
- * Set up to point at the constant's text if the input routine
- * throws an error.
+ * Set up to point at the constant's text if the input routine throws
+ * an error.
*/
setup_parser_errposition_callback(&pcbstate, pstate, con->location);
@@ -510,9 +510,10 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
continue;
#ifdef NOT_USED /* not implemented yet */
+
/*
- * If input is record[] and target is a composite array type,
- * assume we can coerce (may need tighter checking here)
+ * If input is record[] and target is a composite array type, assume
+ * we can coerce (may need tighter checking here)
*/
if (inputTypeId == RECORDARRAYOID &&
is_complex_array(targetTypeId))
@@ -984,7 +985,7 @@ coerce_to_boolean(ParseState *pstate, Node *node,
if (inputTypeId != BOOLOID)
{
- Node *newnode;
+ Node *newnode;
newnode = coerce_to_target_type(pstate, node, inputTypeId,
BOOLOID, -1,
@@ -995,8 +996,8 @@ coerce_to_boolean(ParseState *pstate, Node *node,
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
/* translator: first %s is name of a SQL construct, eg WHERE */
- errmsg("argument of %s must be type boolean, not type %s",
- constructName, format_type_be(inputTypeId)),
+ errmsg("argument of %s must be type boolean, not type %s",
+ constructName, format_type_be(inputTypeId)),
parser_errposition(pstate, exprLocation(node))));
node = newnode;
}
@@ -1031,7 +1032,7 @@ coerce_to_specific_type(ParseState *pstate, Node *node,
if (inputTypeId != targetTypeId)
{
- Node *newnode;
+ Node *newnode;
newnode = coerce_to_target_type(pstate, node, inputTypeId,
targetTypeId, -1,
@@ -1104,7 +1105,7 @@ select_common_type(ParseState *pstate, List *exprs, const char *context,
{
Node *pexpr;
Oid ptype;
- TYPCATEGORY pcategory;
+ TYPCATEGORY pcategory;
bool pispreferred;
ListCell *lc;
@@ -1122,8 +1123,8 @@ select_common_type(ParseState *pstate, List *exprs, const char *context,
{
for_each_cell(lc, lc)
{
- Node *nexpr = (Node *) lfirst(lc);
- Oid ntype = exprType(nexpr);
+ Node *nexpr = (Node *) lfirst(lc);
+ Oid ntype = exprType(nexpr);
if (ntype != ptype)
break;
@@ -1137,9 +1138,9 @@ select_common_type(ParseState *pstate, List *exprs, const char *context,
}
/*
- * Nope, so set up for the full algorithm. Note that at this point,
- * lc points to the first list item with type different from pexpr's;
- * we need not re-examine any items the previous loop advanced over.
+ * Nope, so set up for the full algorithm. Note that at this point, lc
+ * points to the first list item with type different from pexpr's; we need
+ * not re-examine any items the previous loop advanced over.
*/
ptype = getBaseType(ptype);
get_type_category_preferred(ptype, &pcategory, &pispreferred);
@@ -1152,7 +1153,7 @@ select_common_type(ParseState *pstate, List *exprs, const char *context,
/* move on to next one if no new information... */
if (ntype != UNKNOWNOID && ntype != ptype)
{
- TYPCATEGORY ncategory;
+ TYPCATEGORY ncategory;
bool nispreferred;
get_type_category_preferred(ntype, &ncategory, &nispreferred);
@@ -1422,14 +1423,14 @@ check_generic_type_consistency(Oid *actual_arg_types,
*
* When allow_poly is false, we are not expecting any of the actual_arg_types
* to be polymorphic, and we should not return a polymorphic result type
- * either. When allow_poly is true, it is okay to have polymorphic "actual"
+ * either. When allow_poly is true, it is okay to have polymorphic "actual"
* arg types, and we can return ANYARRAY or ANYELEMENT as the result. (This
* case is currently used only to check compatibility of an aggregate's
* declaration with the underlying transfn.)
*
* A special case is that we could see ANYARRAY as an actual_arg_type even
* when allow_poly is false (this is possible only because pg_statistic has
- * columns shown as anyarray in the catalogs). We allow this to match a
+ * columns shown as anyarray in the catalogs). We allow this to match a
* declared ANYARRAY argument, but only if there is no ANYELEMENT argument
* or result (since we can't determine a specific element type to match to
* ANYELEMENT). Note this means that functions taking ANYARRAY had better
@@ -1995,8 +1996,8 @@ 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 string types
- * and explicit casts from string types to be handled this way. (The
+ * using I/O functions. We allow assignment casts to string types and
+ * explicit casts from string 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,
diff --git a/src/backend/parser/parse_cte.c b/src/backend/parser/parse_cte.c
index 7da578c22f..c18b4336ad 100644
--- a/src/backend/parser/parse_cte.c
+++ b/src/backend/parser/parse_cte.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_cte.c,v 2.5 2009/01/01 17:23:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_cte.c,v 2.6 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,7 +25,7 @@
typedef enum
{
RECURSION_OK,
- RECURSION_NONRECURSIVETERM, /* inside the left-hand term */
+ RECURSION_NONRECURSIVETERM, /* inside the left-hand term */
RECURSION_SUBLINK, /* inside a sublink */
RECURSION_OUTERJOIN, /* inside nullable side of an outer join */
RECURSION_INTERSECT, /* underneath INTERSECT (ALL) */
@@ -33,7 +33,7 @@ typedef enum
} RecursionContext;
/* Associated error messages --- each must have one %s for CTE name */
-static const char * const recursion_errormsgs[] = {
+static const char *const recursion_errormsgs[] = {
/* RECURSION_OK */
NULL,
/* RECURSION_NONRECURSIVETERM */
@@ -56,10 +56,11 @@ static const char * const recursion_errormsgs[] = {
*/
typedef struct CteItem
{
- CommonTableExpr *cte; /* One CTE to examine */
- int id; /* Its ID number for dependencies */
- Node *non_recursive_term; /* Its nonrecursive part, if identified */
- Bitmapset *depends_on; /* CTEs depended on (not including self) */
+ CommonTableExpr *cte; /* One CTE to examine */
+ int id; /* Its ID number for dependencies */
+ Node *non_recursive_term; /* Its nonrecursive part, if
+ * identified */
+ Bitmapset *depends_on; /* CTEs depended on (not including self) */
} CteItem;
/* CteState is what we need to pass around in the tree walkers */
@@ -67,7 +68,7 @@ typedef struct CteState
{
/* global state: */
ParseState *pstate; /* global parse state */
- CteItem *items; /* array of CTEs and extra data */
+ CteItem *items; /* array of CTEs and extra data */
int numitems; /* number of CTEs */
/* working state during a tree walk: */
int curitem; /* index of item currently being examined */
@@ -94,8 +95,8 @@ static void checkWellFormedSelectStmt(SelectStmt *stmt, CteState *cstate);
/*
* transformWithClause -
- * Transform the list of WITH clause "common table expressions" into
- * Query nodes.
+ * Transform the list of WITH clause "common table expressions" into
+ * Query nodes.
*
* The result is the list of transformed CTEs to be put into the output
* Query. (This is in fact the same as the ending value of p_ctenamespace,
@@ -111,11 +112,11 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
Assert(pstate->p_future_ctes == NIL);
/*
- * For either type of WITH, there must not be duplicate CTE names in
- * the list. Check this right away so we needn't worry later.
+ * For either type of WITH, there must not be duplicate CTE names in the
+ * list. Check this right away so we needn't worry later.
*
- * Also, tentatively mark each CTE as non-recursive, and initialize
- * its reference count to zero.
+ * Also, tentatively mark each CTE as non-recursive, and initialize its
+ * reference count to zero.
*/
foreach(lc, withClause->ctes)
{
@@ -129,8 +130,8 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
if (strcmp(cte->ctename, cte2->ctename) == 0)
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_ALIAS),
- errmsg("WITH query name \"%s\" specified more than once",
- cte2->ctename),
+ errmsg("WITH query name \"%s\" specified more than once",
+ cte2->ctename),
parser_errposition(pstate, cte2->location)));
}
@@ -141,12 +142,12 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
if (withClause->recursive)
{
/*
- * For WITH RECURSIVE, we rearrange the list elements if needed
- * to eliminate forward references. First, build a work array
- * and set up the data structure needed by the tree walkers.
+ * For WITH RECURSIVE, we rearrange the list elements if needed to
+ * eliminate forward references. First, build a work array and set up
+ * the data structure needed by the tree walkers.
*/
- CteState cstate;
- int i;
+ CteState cstate;
+ int i;
cstate.pstate = pstate;
cstate.numitems = list_length(withClause->ctes);
@@ -171,10 +172,10 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
checkWellFormedRecursion(&cstate);
/*
- * Set up the ctenamespace for parse analysis. Per spec, all
- * the WITH items are visible to all others, so stuff them all in
- * before parse analysis. We build the list in safe processing
- * order so that the planner can process the queries in sequence.
+ * Set up the ctenamespace for parse analysis. Per spec, all the WITH
+ * items are visible to all others, so stuff them all in before parse
+ * analysis. We build the list in safe processing order so that the
+ * planner can process the queries in sequence.
*/
for (i = 0; i < cstate.numitems; i++)
{
@@ -191,14 +192,14 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
CommonTableExpr *cte = cstate.items[i].cte;
/*
- * If it's recursive, we have to do a throwaway parse analysis
- * of the non-recursive term in order to determine the set of
- * output columns for the recursive CTE.
+ * If it's recursive, we have to do a throwaway parse analysis of
+ * the non-recursive term in order to determine the set of output
+ * columns for the recursive CTE.
*/
if (cte->cterecursive)
{
- Node *nrt;
- Query *nrq;
+ Node *nrt;
+ Query *nrq;
if (!cstate.items[i].non_recursive_term)
elog(ERROR, "could not find non-recursive term for %s",
@@ -216,11 +217,10 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
{
/*
* For non-recursive WITH, just analyze each CTE in sequence and then
- * add it to the ctenamespace. This corresponds to the spec's
- * definition of the scope of each WITH name. However, to allow
- * error reports to be aware of the possibility of an erroneous
- * reference, we maintain a list in p_future_ctes of the
- * not-yet-visible CTEs.
+ * add it to the ctenamespace. This corresponds to the spec's
+ * definition of the scope of each WITH name. However, to allow error
+ * reports to be aware of the possibility of an erroneous reference,
+ * we maintain a list in p_future_ctes of the not-yet-visible CTEs.
*/
pstate->p_future_ctes = list_copy(withClause->ctes);
@@ -232,7 +232,7 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
pstate->p_ctenamespace = lappend(pstate->p_ctenamespace, cte);
pstate->p_future_ctes = list_delete_first(pstate->p_future_ctes);
}
- }
+ }
return pstate->p_ctenamespace;
}
@@ -246,7 +246,7 @@ transformWithClause(ParseState *pstate, WithClause *withClause)
static void
analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
{
- Query *query;
+ Query *query;
/* Analysis not done already */
Assert(IsA(cte->ctequery, SelectStmt));
@@ -268,7 +268,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("subquery in WITH cannot have SELECT INTO"),
parser_errposition(pstate,
- exprLocation((Node *) query->intoClause))));
+ exprLocation((Node *) query->intoClause))));
if (!cte->cterecursive)
{
@@ -279,9 +279,9 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
{
/*
* Verify that the previously determined output column types match
- * what the query really produced. We have to check this because
- * the recursive term could have overridden the non-recursive term,
- * and we don't have any easy way to fix that.
+ * what the query really produced. We have to check this because the
+ * recursive term could have overridden the non-recursive term, and we
+ * don't have any easy way to fix that.
*/
ListCell *lctlist,
*lctyp,
@@ -294,7 +294,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
foreach(lctlist, query->targetList)
{
TargetEntry *te = (TargetEntry *) lfirst(lctlist);
- Node *texpr;
+ Node *texpr;
if (te->resjunk)
continue;
@@ -310,7 +310,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
errmsg("recursive query \"%s\" column %d has type %s in non-recursive term but type %s overall",
cte->ctename, varattno,
format_type_with_typemod(lfirst_oid(lctyp),
- lfirst_int(lctypmod)),
+ lfirst_int(lctypmod)),
format_type_with_typemod(exprType(texpr),
exprTypmod(texpr))),
errhint("Cast the output of the non-recursive term to the correct type."),
@@ -318,7 +318,7 @@ analyzeCTE(ParseState *pstate, CommonTableExpr *cte)
lctyp = lnext(lctyp);
lctypmod = lnext(lctypmod);
}
- if (lctyp != NULL || lctypmod != NULL) /* shouldn't happen */
+ if (lctyp != NULL || lctypmod != NULL) /* shouldn't happen */
elog(ERROR, "wrong number of output columns in WITH");
}
}
@@ -335,10 +335,10 @@ analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist)
/*
* We need to determine column names and types. The alias column names
- * override anything coming from the query itself. (Note: the SQL spec
- * says that the alias list must be empty or exactly as long as the
- * output column set; but we allow it to be shorter for consistency
- * with Alias handling.)
+ * override anything coming from the query itself. (Note: the SQL spec
+ * says that the alias list must be empty or exactly as long as the output
+ * column set; but we allow it to be shorter for consistency with Alias
+ * handling.)
*/
cte->ctecolnames = copyObject(cte->aliascolnames);
cte->ctecoltypes = cte->ctecoltypmods = NIL;
@@ -363,13 +363,14 @@ analyzeCTETargetList(ParseState *pstate, CommonTableExpr *cte, List *tlist)
}
coltype = exprType((Node *) te->expr);
coltypmod = exprTypmod((Node *) te->expr);
+
/*
* If the CTE is recursive, force the exposed column type of any
- * "unknown" column to "text". This corresponds to the fact that
- * SELECT 'foo' UNION SELECT 'bar' will ultimately produce text.
- * We might see "unknown" as a result of an untyped literal in
- * the non-recursive term's select list, and if we don't convert
- * to text then we'll have a mismatch against the UNION result.
+ * "unknown" column to "text". This corresponds to the fact that
+ * SELECT 'foo' UNION SELECT 'bar' will ultimately produce text. We
+ * might see "unknown" as a result of an untyped literal in the
+ * non-recursive term's select list, and if we don't convert to text
+ * then we'll have a mismatch against the UNION result.
*/
if (cte->cterecursive && coltype == UNKNOWNOID)
{
@@ -426,21 +427,21 @@ makeDependencyGraphWalker(Node *node, CteState *cstate)
/* If unqualified name, might be a CTE reference */
if (!rv->schemaname)
{
- ListCell *lc;
- int i;
+ ListCell *lc;
+ int i;
/* ... but first see if it's captured by an inner WITH */
foreach(lc, cstate->innerwiths)
{
- List *withlist = (List *) lfirst(lc);
- ListCell *lc2;
+ List *withlist = (List *) lfirst(lc);
+ ListCell *lc2;
foreach(lc2, withlist)
{
CommonTableExpr *cte = (CommonTableExpr *) lfirst(lc2);
if (strcmp(rv->relname, cte->ctename) == 0)
- return false; /* yes, so bail out */
+ return false; /* yes, so bail out */
}
}
@@ -451,7 +452,7 @@ makeDependencyGraphWalker(Node *node, CteState *cstate)
if (strcmp(rv->relname, cte->ctename) == 0)
{
- int myindex = cstate->curitem;
+ int myindex = cstate->curitem;
if (i != myindex)
{
@@ -474,7 +475,7 @@ makeDependencyGraphWalker(Node *node, CteState *cstate)
if (IsA(node, SelectStmt))
{
SelectStmt *stmt = (SelectStmt *) node;
- ListCell *lc;
+ ListCell *lc;
if (stmt->withClause)
{
@@ -482,8 +483,8 @@ makeDependencyGraphWalker(Node *node, CteState *cstate)
{
/*
* In the RECURSIVE case, all query names of the WITH are
- * visible to all WITH items as well as the main query.
- * So push them all on, process, pop them all off.
+ * visible to all WITH items as well as the main query. So
+ * push them all on, process, pop them all off.
*/
cstate->innerwiths = lcons(stmt->withClause->ctes,
cstate->innerwiths);
@@ -501,8 +502,8 @@ makeDependencyGraphWalker(Node *node, CteState *cstate)
else
{
/*
- * In the non-RECURSIVE case, query names are visible to
- * the WITH items after them and to the main query.
+ * In the non-RECURSIVE case, query names are visible to the
+ * WITH items after them and to the main query.
*/
ListCell *cell1;
@@ -528,9 +529,9 @@ makeDependencyGraphWalker(Node *node, CteState *cstate)
if (IsA(node, WithClause))
{
/*
- * Prevent raw_expression_tree_walker from recursing directly into
- * a WITH clause. We need that to happen only under the control
- * of the code above.
+ * Prevent raw_expression_tree_walker from recursing directly into a
+ * WITH clause. We need that to happen only under the control of the
+ * code above.
*/
return false;
}
@@ -545,7 +546,8 @@ makeDependencyGraphWalker(Node *node, CteState *cstate)
static void
TopologicalSort(ParseState *pstate, CteItem *items, int numitems)
{
- int i, j;
+ int i,
+ j;
/* for each position in sequence ... */
for (i = 0; i < numitems; i++)
@@ -561,24 +563,25 @@ TopologicalSort(ParseState *pstate, CteItem *items, int numitems)
if (j >= numitems)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("mutual recursion between WITH items is not implemented"),
+ errmsg("mutual recursion between WITH items is not implemented"),
parser_errposition(pstate, items[i].cte->location)));
/*
- * Found one. Move it to front and remove it from every other
- * item's dependencies.
+ * Found one. Move it to front and remove it from every other item's
+ * dependencies.
*/
if (i != j)
{
- CteItem tmp;
-
+ CteItem tmp;
+
tmp = items[i];
items[i] = items[j];
items[j] = tmp;
}
+
/*
- * Items up through i are known to have no dependencies left,
- * so we can skip them in this loop.
+ * Items up through i are known to have no dependencies left, so we
+ * can skip them in this loop.
*/
for (j = i + 1; j < numitems; j++)
{
@@ -600,9 +603,9 @@ checkWellFormedRecursion(CteState *cstate)
for (i = 0; i < cstate->numitems; i++)
{
CommonTableExpr *cte = cstate->items[i].cte;
- SelectStmt *stmt = (SelectStmt *) cte->ctequery;
+ SelectStmt *stmt = (SelectStmt *) cte->ctequery;
- Assert(IsA(stmt, SelectStmt)); /* not analyzed yet */
+ Assert(IsA(stmt, SelectStmt)); /* not analyzed yet */
/* Ignore items that weren't found to be recursive */
if (!cte->cterecursive)
@@ -631,22 +634,22 @@ checkWellFormedRecursion(CteState *cstate)
cstate->context = RECURSION_OK;
checkWellFormedRecursionWalker((Node *) stmt->rarg, cstate);
Assert(cstate->innerwiths == NIL);
- if (cstate->selfrefcount != 1) /* shouldn't happen */
+ if (cstate->selfrefcount != 1) /* shouldn't happen */
elog(ERROR, "missing recursive reference");
/*
- * Disallow ORDER BY and similar decoration atop the UNION.
- * These don't make sense because it's impossible to figure out what
- * they mean when we have only part of the recursive query's results.
- * (If we did allow them, we'd have to check for recursive references
+ * Disallow ORDER BY and similar decoration atop the UNION. These
+ * don't make sense because it's impossible to figure out what they
+ * mean when we have only part of the recursive query's results. (If
+ * we did allow them, we'd have to check for recursive references
* inside these subtrees.)
*/
if (stmt->sortClause)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("ORDER BY in a recursive query is not implemented"),
+ errmsg("ORDER BY in a recursive query is not implemented"),
parser_errposition(cstate->pstate,
- exprLocation((Node *) stmt->sortClause))));
+ exprLocation((Node *) stmt->sortClause))));
if (stmt->limitOffset)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
@@ -664,7 +667,7 @@ checkWellFormedRecursion(CteState *cstate)
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("FOR UPDATE/SHARE in a recursive query is not implemented"),
parser_errposition(cstate->pstate,
- exprLocation((Node *) stmt->lockingClause))));
+ exprLocation((Node *) stmt->lockingClause))));
/*
* Save non_recursive_term.
@@ -690,21 +693,21 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate)
/* If unqualified name, might be a CTE reference */
if (!rv->schemaname)
{
- ListCell *lc;
+ ListCell *lc;
CommonTableExpr *mycte;
/* ... but first see if it's captured by an inner WITH */
foreach(lc, cstate->innerwiths)
{
- List *withlist = (List *) lfirst(lc);
- ListCell *lc2;
+ List *withlist = (List *) lfirst(lc);
+ ListCell *lc2;
foreach(lc2, withlist)
{
CommonTableExpr *cte = (CommonTableExpr *) lfirst(lc2);
if (strcmp(rv->relname, cte->ctename) == 0)
- return false; /* yes, so bail out */
+ return false; /* yes, so bail out */
}
}
@@ -735,7 +738,7 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate)
if (IsA(node, SelectStmt))
{
SelectStmt *stmt = (SelectStmt *) node;
- ListCell *lc;
+ ListCell *lc;
if (stmt->withClause)
{
@@ -743,8 +746,8 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate)
{
/*
* In the RECURSIVE case, all query names of the WITH are
- * visible to all WITH items as well as the main query.
- * So push them all on, process, pop them all off.
+ * visible to all WITH items as well as the main query. So
+ * push them all on, process, pop them all off.
*/
cstate->innerwiths = lcons(stmt->withClause->ctes,
cstate->innerwiths);
@@ -760,8 +763,8 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate)
else
{
/*
- * In the non-RECURSIVE case, query names are visible to
- * the WITH items after them and to the main query.
+ * In the non-RECURSIVE case, query names are visible to the
+ * WITH items after them and to the main query.
*/
ListCell *cell1;
@@ -779,22 +782,22 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate)
}
}
else
- checkWellFormedSelectStmt(stmt, cstate);
+ checkWellFormedSelectStmt(stmt, cstate);
/* We're done examining the SelectStmt */
return false;
}
if (IsA(node, WithClause))
{
/*
- * Prevent raw_expression_tree_walker from recursing directly into
- * a WITH clause. We need that to happen only under the control
- * of the code above.
+ * Prevent raw_expression_tree_walker from recursing directly into a
+ * WITH clause. We need that to happen only under the control of the
+ * code above.
*/
return false;
}
if (IsA(node, JoinExpr))
{
- JoinExpr *j = (JoinExpr *) node;
+ JoinExpr *j = (JoinExpr *) node;
switch (j->jointype)
{
@@ -835,7 +838,7 @@ checkWellFormedRecursionWalker(Node *node, CteState *cstate)
}
if (IsA(node, SubLink))
{
- SubLink *sl = (SubLink *) node;
+ SubLink *sl = (SubLink *) node;
/*
* we intentionally override outer context, since subquery is
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 2bf6174866..08e062d311 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.240 2009/01/22 20:16:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.241 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -147,10 +147,10 @@ transformExpr(ParseState *pstate, Node *expr)
TypeCast *tc = (TypeCast *) expr;
/*
- * If the subject of the typecast is an ARRAY[] construct
- * and the target type is an array type, we invoke
- * transformArrayExpr() directly so that we can pass down
- * the type information. This avoids some cases where
+ * If the subject of the typecast is an ARRAY[] construct and
+ * the target type is an array type, we invoke
+ * transformArrayExpr() directly so that we can pass down the
+ * type information. This avoids some cases where
* transformArrayExpr() might not infer the correct type.
*/
if (IsA(tc->arg, A_ArrayExpr))
@@ -173,8 +173,8 @@ transformExpr(ParseState *pstate, Node *expr)
}
/*
- * Corner case: ARRAY[] cast to a non-array type.
- * Fall through to do it the standard way.
+ * Corner case: ARRAY[] cast to a non-array type. Fall
+ * through to do it the standard way.
*/
}
@@ -961,10 +961,10 @@ transformAExprIn(ParseState *pstate, A_Expr *a)
* We try to generate a ScalarArrayOpExpr from IN/NOT IN, but this is only
* possible if the inputs are all scalars (no RowExprs) and there is a
* suitable array type available. If not, we fall back to a boolean
- * condition tree with multiple copies of the lefthand expression.
- * Also, any IN-list items that contain Vars are handled as separate
- * boolean conditions, because that gives the planner more scope for
- * optimization on such clauses.
+ * condition tree with multiple copies of the lefthand expression. Also,
+ * any IN-list items that contain Vars are handled as separate boolean
+ * conditions, because that gives the planner more scope for optimization
+ * on such clauses.
*
* First step: transform all the inputs, and detect whether any are
* RowExprs or contain Vars.
@@ -985,8 +985,8 @@ transformAExprIn(ParseState *pstate, A_Expr *a)
}
/*
- * ScalarArrayOpExpr is only going to be useful if there's more than
- * one non-Var righthand item. Also, it won't work for RowExprs.
+ * ScalarArrayOpExpr is only going to be useful if there's more than one
+ * non-Var righthand item. Also, it won't work for RowExprs.
*/
if (!haveRowExpr && list_length(rnonvars) > 1)
{
@@ -995,7 +995,7 @@ transformAExprIn(ParseState *pstate, A_Expr *a)
Oid array_type;
/*
- * Try to select a common type for the array elements. Note that
+ * Try to select a common type for the array elements. Note that
* since the LHS' type is first in the list, it will be preferred when
* there is doubt (eg, when all the RHS items are unknown literals).
*
@@ -1266,7 +1266,7 @@ transformSubLink(ParseState *pstate, SubLink *sublink)
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("subquery cannot have SELECT INTO"),
parser_errposition(pstate,
- exprLocation((Node *) qtree->intoClause))));
+ exprLocation((Node *) qtree->intoClause))));
sublink->subselect = (Node *) qtree;
@@ -1398,12 +1398,12 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
Oid coerce_type;
bool coerce_hard;
- /*
- * Transform the element expressions
+ /*
+ * Transform the element expressions
*
- * Assume that the array is one-dimensional unless we find an
- * array-type element expression.
- */
+ * Assume that the array is one-dimensional unless we find an array-type
+ * element expression.
+ */
newa->multidims = false;
foreach(element, a->elements)
{
@@ -1411,8 +1411,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
Node *newe;
/*
- * If an element is itself an A_ArrayExpr, recurse directly so that
- * we can pass down any target type we were given.
+ * If an element is itself an A_ArrayExpr, recurse directly so that we
+ * can pass down any target type we were given.
*/
if (IsA(e, A_ArrayExpr))
{
@@ -1428,9 +1428,10 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
else
{
newe = transformExpr(pstate, e);
+
/*
- * Check for sub-array expressions, if we haven't already
- * found one.
+ * Check for sub-array expressions, if we haven't already found
+ * one.
*/
if (!newa->multidims && type_is_array(exprType(newe)))
newa->multidims = true;
@@ -1439,7 +1440,7 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
newelems = lappend(newelems, newe);
}
- /*
+ /*
* Select a target type for the elements.
*
* If we haven't been given a target array type, we must try to deduce a
@@ -1473,8 +1474,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
if (!OidIsValid(element_type))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("could not find element type for data type %s",
- format_type_be(array_type)),
+ errmsg("could not find element type for data type %s",
+ format_type_be(array_type)),
parser_errposition(pstate, a->location)));
}
else
@@ -1492,7 +1493,7 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
}
/*
- * Coerce elements to target type
+ * Coerce elements to target type
*
* If the array has been explicitly cast, then the elements are in turn
* explicitly coerced.
@@ -1500,7 +1501,7 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
* If the array's type was merely derived from the common type of its
* elements, then the elements are implicitly coerced to the common type.
* This is consistent with other uses of select_common_type().
- */
+ */
foreach(element, newelems)
{
Node *e = (Node *) lfirst(element);
@@ -1508,9 +1509,9 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
if (coerce_hard)
{
- newe = coerce_to_target_type(pstate, e,
+ newe = coerce_to_target_type(pstate, e,
exprType(e),
- coerce_type,
+ coerce_type,
typmod,
COERCION_EXPLICIT,
COERCE_EXPLICIT_CAST,
@@ -1671,8 +1672,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
x->op == IS_XMLELEMENT
- ? errmsg("unnamed XML attribute value must be a column reference")
- : errmsg("unnamed XML element value must be a column reference"),
+ ? errmsg("unnamed XML attribute value must be a column reference")
+ : errmsg("unnamed XML element value must be a column reference"),
parser_errposition(pstate, r->location)));
argname = NULL; /* keep compiler quiet */
}
@@ -1687,8 +1688,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x)
if (strcmp(argname, strVal(lfirst(lc2))) == 0)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("XML attribute name \"%s\" appears more than once",
- argname),
+ errmsg("XML attribute name \"%s\" appears more than once",
+ argname),
parser_errposition(pstate, r->location)));
}
}
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 260f74d595..fd0706e960 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.215 2009/06/04 18:33:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_func.c,v 1.216 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -85,10 +85,10 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (list_length(fargs) > FUNC_MAX_ARGS)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
- errmsg_plural("cannot pass more than %d argument to a function",
- "cannot pass more than %d arguments to a function",
- FUNC_MAX_ARGS,
- FUNC_MAX_ARGS),
+ errmsg_plural("cannot pass more than %d argument to a function",
+ "cannot pass more than %d arguments to a function",
+ FUNC_MAX_ARGS,
+ FUNC_MAX_ARGS),
parser_errposition(pstate, location)));
/*
@@ -198,7 +198,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("OVER specified, but %s is not a window function nor an aggregate function",
- NameListToString(funcname)),
+ NameListToString(funcname)),
parser_errposition(pstate, location)));
}
else if (!(fdresult == FUNCDETAIL_AGGREGATE ||
@@ -245,22 +245,22 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
* If there are default arguments, we have to include their types in
* actual_arg_types for the purpose of checking generic type consistency.
* However, we do NOT put them into the generated parse node, because
- * their actual values might change before the query gets run. The
+ * their actual values might change before the query gets run. The
* planner has to insert the up-to-date values at plan time.
*/
nargsplusdefs = nargs;
foreach(l, argdefaults)
{
- Node *expr = (Node *) lfirst(l);
+ Node *expr = (Node *) lfirst(l);
/* probably shouldn't happen ... */
if (nargsplusdefs >= FUNC_MAX_ARGS)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
- errmsg_plural("cannot pass more than %d argument to a function",
- "cannot pass more than %d arguments to a function",
- FUNC_MAX_ARGS,
- FUNC_MAX_ARGS),
+ errmsg_plural("cannot pass more than %d argument to a function",
+ "cannot pass more than %d arguments to a function",
+ FUNC_MAX_ARGS,
+ FUNC_MAX_ARGS),
parser_errposition(pstate, location)));
actual_arg_types[nargsplusdefs++] = exprType(expr);
@@ -286,9 +286,9 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
*/
if (nvargs > 0 && declared_arg_types[nargs - 1] != ANYOID)
{
- ArrayExpr *newa = makeNode(ArrayExpr);
- int non_var_args = nargs - nvargs;
- List *vargs;
+ ArrayExpr *newa = makeNode(ArrayExpr);
+ int non_var_args = nargs - nvargs;
+ List *vargs;
Assert(non_var_args >= 0);
vargs = list_copy_tail(fargs, non_var_args);
@@ -303,7 +303,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find array type for data type %s",
format_type_be(newa->element_typeid)),
- parser_errposition(pstate, exprLocation((Node *) vargs))));
+ parser_errposition(pstate, exprLocation((Node *) vargs))));
newa->multidims = false;
newa->location = exprLocation((Node *) vargs);
@@ -386,7 +386,7 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
if (agg_distinct)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("DISTINCT is not implemented for window functions"),
+ errmsg("DISTINCT is not implemented for window functions"),
parser_errposition(pstate, location)));
/*
@@ -528,7 +528,7 @@ func_select_candidate(int nargs,
int nbestMatch,
nmatch;
Oid input_base_typeids[FUNC_MAX_ARGS];
- TYPCATEGORY slot_category[FUNC_MAX_ARGS],
+ TYPCATEGORY slot_category[FUNC_MAX_ARGS],
current_category;
bool current_is_preferred;
bool slot_has_preferred_type[FUNC_MAX_ARGS];
@@ -538,10 +538,10 @@ func_select_candidate(int nargs,
if (nargs > FUNC_MAX_ARGS)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
- errmsg_plural("cannot pass more than %d argument to a function",
- "cannot pass more than %d arguments to a function",
- FUNC_MAX_ARGS,
- FUNC_MAX_ARGS)));
+ errmsg_plural("cannot pass more than %d argument to a function",
+ "cannot pass more than %d arguments to a function",
+ FUNC_MAX_ARGS,
+ FUNC_MAX_ARGS)));
/*
* If any input types are domains, reduce them to their base types. This
@@ -830,7 +830,7 @@ func_get_detail(List *funcname,
*nvargs = 0;
*true_typeids = NULL;
if (argdefaults)
- *argdefaults = NIL;
+ *argdefaults = NIL;
/* Get list of possible candidates from namespace search */
raw_candidates = FuncnameGetCandidates(funcname, nargs,
@@ -968,8 +968,8 @@ func_get_detail(List *funcname,
/*
* If expanding variadics or defaults, the "best candidate" might
- * represent multiple equivalently good functions; treat this case
- * as ambiguous.
+ * represent multiple equivalently good functions; treat this case as
+ * ambiguous.
*/
if (!OidIsValid(best_candidate->oid))
return FUNCDETAIL_MULTIPLE;
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index 17500f5545..f775850e04 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.104 2009/01/01 17:23:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_node.c,v 1.105 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -122,7 +122,7 @@ parser_errposition(ParseState *pstate, int location)
* Sometimes the parser calls functions that aren't part of the parser
* subsystem and can't reasonably be passed a ParseState; yet we would
* like any errors thrown in those functions to be tagged with a parse
- * error location. Use this function to set up an error context stack
+ * error location. Use this function to set up an error context stack
* entry that will accomplish that. Usage pattern:
*
* declare a local variable "ParseCallbackState pcbstate"
@@ -311,7 +311,7 @@ transformArraySubscripts(ParseState *pstate,
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("array subscript must have type integer"),
- parser_errposition(pstate, exprLocation(ai->lidx))));
+ parser_errposition(pstate, exprLocation(ai->lidx))));
}
else
{
@@ -364,7 +364,7 @@ transformArraySubscripts(ParseState *pstate,
" but expression is of type %s",
format_type_be(typeneeded),
format_type_be(typesource)),
- errhint("You will need to rewrite or cast the expression."),
+ errhint("You will need to rewrite or cast the expression."),
parser_errposition(pstate, exprLocation(assignFrom))));
assignFrom = newFrom;
}
@@ -447,7 +447,7 @@ make_const(ParseState *pstate, Value *value, int location)
typeid = INT8OID;
typelen = sizeof(int64);
- typebyval = FLOAT8PASSBYVAL; /* int8 and float8 alike */
+ typebyval = FLOAT8PASSBYVAL; /* int8 and float8 alike */
}
}
else
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index 871a6b9f23..b8555c4615 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.107 2009/01/01 17:23:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_oper.c,v 1.108 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,7 +59,7 @@ typedef struct OprCacheKey
typedef struct OprCacheEntry
{
/* the hash lookup key MUST BE FIRST */
- OprCacheKey key;
+ OprCacheKey key;
Oid opr_oid; /* OID of the resolved operator */
} OprCacheEntry;
@@ -76,7 +76,7 @@ static void op_error(ParseState *pstate, List *op, char oprkind,
Oid arg1, Oid arg2,
FuncDetailCode fdresult, int location);
static bool make_oper_cache_key(OprCacheKey *key, List *opname,
- Oid ltypeId, Oid rtypeId);
+ Oid ltypeId, Oid rtypeId);
static Oid find_oper_cache_entry(OprCacheKey *key);
static void make_oper_cache_entry(OprCacheKey *key, Oid opr_oid);
static void InvalidateOprCacheCallBack(Datum arg, int cacheid, ItemPointer tuplePtr);
@@ -194,7 +194,7 @@ get_sort_group_operators(Oid argtype,
* are consistent, ie all from the same opclass.
*/
typentry = lookup_type_cache(argtype,
- TYPECACHE_LT_OPR | TYPECACHE_EQ_OPR | TYPECACHE_GT_OPR);
+ TYPECACHE_LT_OPR | TYPECACHE_EQ_OPR | TYPECACHE_GT_OPR);
lt_opr = typentry->lt_opr;
eq_opr = typentry->eq_opr;
gt_opr = typentry->gt_opr;
@@ -202,8 +202,8 @@ get_sort_group_operators(Oid argtype,
/*
* If the datatype is an array, then we can use array_lt and friends ...
* but only if there are suitable operators for the element type. (This
- * check is not in the raw typcache.c code ... should it be?) Testing
- * all three operator IDs here should be redundant.
+ * check is not in the raw typcache.c code ... should it be?) Testing all
+ * three operator IDs here should be redundant.
*/
if (lt_opr == ARRAY_LT_OP ||
eq_opr == ARRAY_EQ_OP ||
@@ -214,7 +214,7 @@ get_sort_group_operators(Oid argtype,
if (OidIsValid(elem_type))
{
typentry = lookup_type_cache(elem_type,
- TYPECACHE_LT_OPR | TYPECACHE_EQ_OPR | TYPECACHE_GT_OPR);
+ TYPECACHE_LT_OPR | TYPECACHE_EQ_OPR | TYPECACHE_GT_OPR);
if (!OidIsValid(typentry->lt_opr))
lt_opr = InvalidOid; /* element type has no "<" */
if (!OidIsValid(typentry->eq_opr))
@@ -223,7 +223,7 @@ get_sort_group_operators(Oid argtype,
gt_opr = InvalidOid; /* element type has no ">" */
}
else
- lt_opr = eq_opr = gt_opr = InvalidOid; /* bogus array type? */
+ lt_opr = eq_opr = gt_opr = InvalidOid; /* bogus array type? */
}
/* Report errors if needed */
@@ -388,7 +388,7 @@ oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId,
bool noError, int location)
{
Oid operOid;
- OprCacheKey key;
+ OprCacheKey key;
bool key_ok;
FuncDetailCode fdresult = FUNCDETAIL_NOTFOUND;
HeapTuple tup = NULL;
@@ -538,7 +538,7 @@ Operator
right_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
{
Oid operOid;
- OprCacheKey key;
+ OprCacheKey key;
bool key_ok;
FuncDetailCode fdresult = FUNCDETAIL_NOTFOUND;
HeapTuple tup = NULL;
@@ -620,7 +620,7 @@ Operator
left_oper(ParseState *pstate, List *op, Oid arg, bool noError, int location)
{
Oid operOid;
- OprCacheKey key;
+ OprCacheKey key;
bool key_ok;
FuncDetailCode fdresult = FUNCDETAIL_NOTFOUND;
HeapTuple tup = NULL;
@@ -1003,7 +1003,7 @@ make_scalar_array_op(ParseState *pstate, List *opname,
* mapping is pretty expensive to compute, especially for ambiguous operators;
* this is mainly because there are a *lot* of instances of popular operator
* names such as "=", and we have to check each one to see which is the
- * best match. So once we have identified the correct mapping, we save it
+ * best match. So once we have identified the correct mapping, we save it
* in a cache that need only be flushed on pg_operator or pg_cast change.
* (pg_cast must be considered because changes in the set of implicit casts
* affect the set of applicable operators for any given input datatype.)
@@ -1056,7 +1056,7 @@ make_oper_cache_key(OprCacheKey *key, List *opname, Oid ltypeId, Oid rtypeId)
{
/* get the active search path */
if (fetch_search_path_array(key->search_path,
- MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN)
+ MAX_CACHED_PATH_LEN) > MAX_CACHED_PATH_LEN)
return false; /* oops, didn't fit */
}
@@ -1087,7 +1087,7 @@ find_oper_cache_entry(OprCacheKey *key)
ctl.entrysize = sizeof(OprCacheEntry);
ctl.hash = tag_hash;
OprCacheHash = hash_create("Operator lookup cache", 256,
- &ctl, HASH_ELEM | HASH_FUNCTION);
+ &ctl, HASH_ELEM | HASH_FUNCTION);
/* Arrange to flush cache on pg_operator and pg_cast changes */
CacheRegisterSyscacheCallback(OPERNAMENSP,
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index eb98f470ee..b506c042c5 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.141 2009/01/22 20:16:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.142 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,9 +38,9 @@ bool add_missing_from;
static RangeTblEntry *scanNameSpaceForRefname(ParseState *pstate,
const char *refname, int location);
static RangeTblEntry *scanNameSpaceForRelid(ParseState *pstate, Oid relid,
- int location);
+ int location);
static void markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte,
- int rtindex, AttrNumber col);
+ int rtindex, AttrNumber col);
static bool isLockedRel(ParseState *pstate, char *refname);
static void expandRelation(Oid relid, Alias *eref,
int rtindex, int sublevels_up,
@@ -194,13 +194,13 @@ CommonTableExpr *
scanNameSpaceForCTE(ParseState *pstate, const char *refname,
Index *ctelevelsup)
{
- Index levelsup;
+ Index levelsup;
for (levelsup = 0;
pstate != NULL;
pstate = pstate->parentParseState, levelsup++)
{
- ListCell *lc;
+ ListCell *lc;
foreach(lc, pstate->p_ctenamespace)
{
@@ -226,7 +226,7 @@ isFutureCTE(ParseState *pstate, const char *refname)
{
for (; pstate != NULL; pstate = pstate->parentParseState)
{
- ListCell *lc;
+ ListCell *lc;
foreach(lc, pstate->p_future_ctes)
{
@@ -264,9 +264,9 @@ searchRangeTable(ParseState *pstate, RangeVar *relation)
Index levelsup;
/*
- * If it's an unqualified name, check for possible CTE matches.
- * A CTE hides any real relation matches. If no CTE, look for
- * a matching relation.
+ * If it's an unqualified name, check for possible CTE matches. A CTE
+ * hides any real relation matches. If no CTE, look for a matching
+ * relation.
*/
if (!relation->schemaname)
cte = scanNameSpaceForCTE(pstate, refname, &ctelevelsup);
@@ -616,15 +616,15 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte,
rte->requiredPerms |= ACL_SELECT;
/* Must offset the attnum to fit in a bitmapset */
rte->selectedCols = bms_add_member(rte->selectedCols,
- col - FirstLowInvalidHeapAttributeNumber);
+ col - FirstLowInvalidHeapAttributeNumber);
}
else if (rte->rtekind == RTE_JOIN)
{
if (col == InvalidAttrNumber)
{
/*
- * A whole-row reference to a join has to be treated as
- * whole-row references to the two inputs.
+ * A whole-row reference to a join has to be treated as whole-row
+ * references to the two inputs.
*/
JoinExpr *j;
@@ -639,13 +639,13 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte,
/* Note: we can't see FromExpr here */
if (IsA(j->larg, RangeTblRef))
{
- int varno = ((RangeTblRef *) j->larg)->rtindex;
+ int varno = ((RangeTblRef *) j->larg)->rtindex;
markRTEForSelectPriv(pstate, NULL, varno, InvalidAttrNumber);
}
else if (IsA(j->larg, JoinExpr))
{
- int varno = ((JoinExpr *) j->larg)->rtindex;
+ int varno = ((JoinExpr *) j->larg)->rtindex;
markRTEForSelectPriv(pstate, NULL, varno, InvalidAttrNumber);
}
@@ -654,13 +654,13 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte,
(int) nodeTag(j->larg));
if (IsA(j->rarg, RangeTblRef))
{
- int varno = ((RangeTblRef *) j->rarg)->rtindex;
+ int varno = ((RangeTblRef *) j->rarg)->rtindex;
markRTEForSelectPriv(pstate, NULL, varno, InvalidAttrNumber);
}
else if (IsA(j->rarg, JoinExpr))
{
- int varno = ((JoinExpr *) j->rarg)->rtindex;
+ int varno = ((JoinExpr *) j->rarg)->rtindex;
markRTEForSelectPriv(pstate, NULL, varno, InvalidAttrNumber);
}
@@ -676,10 +676,10 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte,
* The aliasvar could be either a Var or a COALESCE expression,
* but in the latter case we should already have marked the two
* referent variables as being selected, due to their use in the
- * JOIN clause. So we need only be concerned with the simple
- * Var case.
+ * JOIN clause. So we need only be concerned with the simple Var
+ * case.
*/
- Var *aliasvar;
+ Var *aliasvar;
Assert(col > 0 && col <= list_length(rte->joinaliasvars));
aliasvar = (Var *) list_nth(rte->joinaliasvars, col - 1);
@@ -700,7 +700,7 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte,
void
markVarForSelectPriv(ParseState *pstate, Var *var, RangeTblEntry *rte)
{
- Index lv;
+ Index lv;
Assert(IsA(var, Var));
/* Find the appropriate pstate if it's an uplevel Var */
@@ -1325,8 +1325,8 @@ addRangeTableEntryForJoin(ParseState *pstate,
int numaliases;
/*
- * Fail if join has too many columns --- we must be able to reference
- * any of the columns with an AttrNumber.
+ * Fail if join has too many columns --- we must be able to reference any
+ * of the columns with an AttrNumber.
*/
if (list_length(aliasvars) > MaxAttrNumber)
ereport(ERROR,
@@ -1816,8 +1816,8 @@ expandRTE(RangeTblEntry *rte, int rtindex, int sublevels_up,
varattno = 0;
forboth(lct, rte->ctecoltypes, lcm, rte->ctecoltypmods)
{
- Oid coltype = lfirst_oid(lct);
- int32 coltypmod = lfirst_int(lcm);
+ Oid coltype = lfirst_oid(lct);
+ int32 coltypmod = lfirst_int(lcm);
varattno++;
@@ -1971,7 +1971,7 @@ expandRelAttrs(ParseState *pstate, RangeTblEntry *rte,
markVarForSelectPriv(pstate, varnode, rte);
}
- Assert(name == NULL && var == NULL); /* lists not the same length? */
+ Assert(name == NULL && var == NULL); /* lists not the same length? */
return te_list;
}
@@ -2457,8 +2457,8 @@ warnAutoRange(ParseState *pstate, RangeVar *relation)
if (rte)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_TABLE),
- errmsg("invalid reference to FROM-clause entry for table \"%s\"",
- relation->relname),
+ errmsg("invalid reference to FROM-clause entry for table \"%s\"",
+ relation->relname),
(badAlias ?
errhint("Perhaps you meant to reference the table alias \"%s\".",
badAlias) :
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index 3f804472c7..c9ec7c33e2 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.170 2009/01/22 20:16:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_target.c,v 1.171 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -297,14 +297,14 @@ markTargetListOrigin(ParseState *pstate, TargetEntry *tle,
/* not a simple relation, leave it unmarked */
break;
case RTE_CTE:
+
/*
- * CTE reference: copy up from the subquery, if possible.
- * If the RTE is a recursive self-reference then we can't do
- * anything because we haven't finished analyzing it yet.
- * However, it's no big loss because we must be down inside
- * the recursive term of a recursive CTE, and so any markings
- * on the current targetlist are not going to affect the results
- * anyway.
+ * CTE reference: copy up from the subquery, if possible. If the
+ * RTE is a recursive self-reference then we can't do anything
+ * because we haven't finished analyzing it yet. However, it's no
+ * big loss because we must be down inside the recursive term of a
+ * recursive CTE, and so any markings on the current targetlist
+ * are not going to affect the results anyway.
*/
if (attnum != InvalidAttrNumber && !rte->self_reference)
{
@@ -346,7 +346,7 @@ markTargetListOrigin(ParseState *pstate, TargetEntry *tle,
*
* Note: location points at the target column name (SET target or INSERT
* column name list entry), and must therefore be -1 in an INSERT that
- * omits the column name list. So we should usually prefer to use
+ * omits the column name list. So we should usually prefer to use
* exprLocation(expr) for errors that can happen in a default INSERT.
*/
Expr *
@@ -451,7 +451,7 @@ transformAssignedExpr(ParseState *pstate,
* For normal non-qualified target column, do type checking and
* coercion.
*/
- Node *orig_expr = (Node *) expr;
+ Node *orig_expr = (Node *) expr;
expr = (Expr *)
coerce_to_target_type(pstate,
@@ -957,7 +957,7 @@ ExpandColumnRefStar(ParseState *pstate, ColumnRef *cref,
/* Require read access to each column */
foreach(l, vars)
{
- Var *var = (Var *) lfirst(l);
+ Var *var = (Var *) lfirst(l);
markVarForSelectPriv(pstate, var, rte);
}
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index a74f597259..295763fc48 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.102 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_type.c,v 1.103 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -498,15 +498,16 @@ stringTypeDatum(Type tp, char *string, int32 atttypmod)
typioparam, atttypmod);
#ifdef RANDOMIZE_ALLOCATED_MEMORY
+
/*
* For pass-by-reference data types, repeat the conversion to see if the
* input function leaves any uninitialized bytes in the result. We can
- * only detect that reliably if RANDOMIZE_ALLOCATED_MEMORY is enabled,
- * so we don't bother testing otherwise. The reason we don't want any
+ * only detect that reliably if RANDOMIZE_ALLOCATED_MEMORY is enabled, so
+ * we don't bother testing otherwise. The reason we don't want any
* instability in the input function is that comparison of Const nodes
* relies on bytewise comparison of the datums, so if the input function
* leaves garbage then subexpressions that should be identical may not get
- * recognized as such. See pgsql-hackers discussion of 2008-04-04.
+ * recognized as such. See pgsql-hackers discussion of 2008-04-04.
*/
if (string && !typform->typbyval)
{
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index e011208ad8..e5a3621cce 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -19,7 +19,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.20 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.21 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -287,9 +287,9 @@ transformColumnDefinition(ParseState *pstate, CreateStmtContext *cxt,
}
/*
- * We have to reject "serial[]" explicitly, because once we've
- * set typeid, LookupTypeName won't notice arrayBounds. We don't
- * need any special coding for serial(typmod) though.
+ * We have to reject "serial[]" explicitly, because once we've set
+ * typeid, LookupTypeName won't notice arrayBounds. We don't need any
+ * special coding for serial(typmod) though.
*/
if (is_serial && column->typename->arrayBounds != NIL)
ereport(ERROR,
@@ -800,9 +800,9 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
index->idxname = NULL;
/*
- * If the index is marked PRIMARY, it's certainly from a constraint;
- * else, if it's not marked UNIQUE, it certainly isn't; else, we have
- * to search pg_depend to see if there's an associated unique constraint.
+ * If the index is marked PRIMARY, it's certainly from a constraint; else,
+ * if it's not marked UNIQUE, it certainly isn't; else, we have to search
+ * pg_depend to see if there's an associated unique constraint.
*/
if (index->primary)
index->isconstraint = true;
@@ -876,10 +876,10 @@ generateClonedIndexStmt(CreateStmtContext *cxt, Relation source_idx,
if (amrec->amcanorder)
{
/*
- * If it supports sort ordering, copy DESC and NULLS opts.
- * Don't set non-default settings unnecessarily, though,
- * so as to improve the chance of recognizing equivalence
- * to constraint indexes.
+ * If it supports sort ordering, copy DESC and NULLS opts. Don't
+ * set non-default settings unnecessarily, though, so as to
+ * improve the chance of recognizing equivalence to constraint
+ * indexes.
*/
if (opt & INDOPTION_DESC)
{
@@ -1042,6 +1042,7 @@ transformIndexConstraints(ParseState *pstate, CreateStmtContext *cxt)
strcmp(index->accessMethod, priorindex->accessMethod) == 0)
{
priorindex->unique |= index->unique;
+
/*
* If the prior index is as yet unnamed, and this one is
* named, then transfer the name to the prior index. This
@@ -1475,7 +1476,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
- errmsg("cannot use window function in rule WHERE condition")));
+ errmsg("cannot use window function in rule WHERE condition")));
/*
* 'instead nothing' rules with a qualification need a query rangetable so
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index 2e42b6f668..ee77c38f86 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.77 2009/04/19 21:50:08 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parser.c,v 1.78 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -77,7 +77,7 @@ raw_parser(const char *str)
char *
pg_parse_string_token(const char *token)
{
- int ctoken;
+ int ctoken;
scanner_init(token);
diff --git a/src/backend/port/darwin/system.c b/src/backend/port/darwin/system.c
index f6586505ba..9cdcbddae5 100644
--- a/src/backend/port/darwin/system.c
+++ b/src/backend/port/darwin/system.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/darwin/system.c,v 1.7 2008/05/17 01:28:22 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/port/darwin/system.c,v 1.8 2009/06/11 14:49:00 momjian Exp $
*
* only needed in OS X 10.1 and possibly early 10.2 releases */
#include <AvailabilityMacros.h>
diff --git a/src/backend/port/dynloader/sco.c b/src/backend/port/dynloader/sco.c
index da09a25591..0d108cbff5 100644
--- a/src/backend/port/dynloader/sco.c
+++ b/src/backend/port/dynloader/sco.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/sco.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/sco.c,v 1.3 2009/06/11 14:49:00 momjian Exp $
*
* Dummy file used for nothing at this point
*
diff --git a/src/backend/port/dynloader/solaris.c b/src/backend/port/dynloader/solaris.c
index 27f555e1b4..9f5b5cfbde 100644
--- a/src/backend/port/dynloader/solaris.c
+++ b/src/backend/port/dynloader/solaris.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/solaris.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/solaris.c,v 1.3 2009/06/11 14:49:00 momjian Exp $
*
* Dummy file used for nothing at this point
*
diff --git a/src/backend/port/dynloader/sunos4.c b/src/backend/port/dynloader/sunos4.c
index 659964cdca..a354b0dad4 100644
--- a/src/backend/port/dynloader/sunos4.c
+++ b/src/backend/port/dynloader/sunos4.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/sunos4.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/sunos4.c,v 1.3 2009/06/11 14:49:00 momjian Exp $
*
* Dummy file used for nothing at this point
*
diff --git a/src/backend/port/dynloader/svr4.c b/src/backend/port/dynloader/svr4.c
index 2cafa40e55..290367060e 100644
--- a/src/backend/port/dynloader/svr4.c
+++ b/src/backend/port/dynloader/svr4.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/svr4.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/svr4.c,v 1.3 2009/06/11 14:49:00 momjian Exp $
*
* Dummy file used for nothing at this point
*
diff --git a/src/backend/port/dynloader/univel.c b/src/backend/port/dynloader/univel.c
index 0f6cc80fe1..95d40f015d 100644
--- a/src/backend/port/dynloader/univel.c
+++ b/src/backend/port/dynloader/univel.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/univel.c,v 1.4 2008/05/17 01:28:23 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/univel.c,v 1.5 2009/06/11 14:49:00 momjian Exp $
*
* Dummy file used for nothing at this point
*
diff --git a/src/backend/port/dynloader/univel.h b/src/backend/port/dynloader/univel.h
index 0c72aef1b8..f5ca7205df 100644
--- a/src/backend/port/dynloader/univel.h
+++ b/src/backend/port/dynloader/univel.h
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/univel.h,v 1.23 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/univel.h,v 1.24 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*
diff --git a/src/backend/port/dynloader/unixware.c b/src/backend/port/dynloader/unixware.c
index 2db3fa9367..682340c694 100644
--- a/src/backend/port/dynloader/unixware.c
+++ b/src/backend/port/dynloader/unixware.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/unixware.c,v 1.2 2008/05/17 01:28:23 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/unixware.c,v 1.3 2009/06/11 14:49:00 momjian Exp $
*
* Dummy file used for nothing at this point
*
diff --git a/src/backend/port/dynloader/unixware.h b/src/backend/port/dynloader/unixware.h
index 53baa47bf9..259fca3e95 100644
--- a/src/backend/port/dynloader/unixware.h
+++ b/src/backend/port/dynloader/unixware.h
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/unixware.h,v 1.21 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/unixware.h,v 1.22 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*
diff --git a/src/backend/port/dynloader/win32.h b/src/backend/port/dynloader/win32.h
index fa44b7f54e..c6952dfda3 100644
--- a/src/backend/port/dynloader/win32.h
+++ b/src/backend/port/dynloader/win32.h
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/dynloader/win32.h,v 1.4 2008/05/17 01:28:23 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/port/dynloader/win32.h,v 1.5 2009/06/11 14:49:00 momjian Exp $
*/
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
diff --git a/src/backend/port/nextstep/port.c b/src/backend/port/nextstep/port.c
index abeb70546d..fd5461c321 100644
--- a/src/backend/port/nextstep/port.c
+++ b/src/backend/port/nextstep/port.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/backend/port/nextstep/port.c,v 1.11 2008/05/17 01:28:23 adunstan Exp $
+ * $PostgreSQL: pgsql/src/backend/port/nextstep/port.c,v 1.12 2009/06/11 14:49:00 momjian Exp $
*/
#include "postgres.h"
diff --git a/src/backend/port/posix_sema.c b/src/backend/port/posix_sema.c
index e6f3ce80b4..5b829149ed 100644
--- a/src/backend/port/posix_sema.c
+++ b/src/backend/port/posix_sema.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/posix_sema.c,v 1.21 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/posix_sema.c,v 1.22 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -241,10 +241,10 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK)
int errStatus;
/*
- * See notes in sysv_sema.c's implementation of PGSemaphoreLock.
- * Just as that code does for semop(), we handle both the case where
- * sem_wait() returns errno == EINTR after a signal, and the case
- * where it just keeps waiting.
+ * See notes in sysv_sema.c's implementation of PGSemaphoreLock. Just as
+ * that code does for semop(), we handle both the case where sem_wait()
+ * returns errno == EINTR after a signal, and the case where it just keeps
+ * waiting.
*/
do
{
diff --git a/src/backend/port/sysv_sema.c b/src/backend/port/sysv_sema.c
index 41ac4329a9..3cb31baa69 100644
--- a/src/backend/port/sysv_sema.c
+++ b/src/backend/port/sysv_sema.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/sysv_sema.c,v 1.24 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/sysv_sema.c,v 1.25 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -377,11 +377,11 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK)
* from the operation prematurely because we were sent a signal. So we
* try and lock the semaphore again.
*
- * Each time around the loop, we check for a cancel/die interrupt. On
- * some platforms, if such an interrupt comes in while we are waiting,
- * it will cause the semop() call to exit with errno == EINTR, allowing
- * us to service the interrupt (if not in a critical section already)
- * during the next loop iteration.
+ * Each time around the loop, we check for a cancel/die interrupt. On
+ * some platforms, if such an interrupt comes in while we are waiting, it
+ * will cause the semop() call to exit with errno == EINTR, allowing us to
+ * service the interrupt (if not in a critical section already) during the
+ * next loop iteration.
*
* Once we acquire the lock, we do NOT check for an interrupt before
* returning. The caller needs to be able to record ownership of the lock
@@ -407,10 +407,10 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK)
*
* On some platforms, signals marked SA_RESTART (which is most, for us)
* will not interrupt the semop(); it will just keep waiting. Therefore
- * it's necessary for cancel/die interrupts to be serviced directly by
- * the signal handler. On these platforms the behavior is really the same
+ * it's necessary for cancel/die interrupts to be serviced directly by the
+ * signal handler. On these platforms the behavior is really the same
* whether the signal arrives just before the semop() begins, or while it
- * is waiting. The loop on EINTR is thus important only for other types
+ * is waiting. The loop on EINTR is thus important only for other types
* of interrupts.
*/
do
diff --git a/src/backend/port/win32/mingwcompat.c b/src/backend/port/win32/mingwcompat.c
index fe185f8f6c..a9b38d5320 100644
--- a/src/backend/port/win32/mingwcompat.c
+++ b/src/backend/port/win32/mingwcompat.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32/mingwcompat.c,v 1.5 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32/mingwcompat.c,v 1.6 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,8 +45,8 @@ LoadKernel32()
* kernel32.dll·
*/
typedef
-BOOL(WINAPI * __RegisterWaitForSingleObject)
-(PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG);
+BOOL (WINAPI * __RegisterWaitForSingleObject)
+ (PHANDLE, HANDLE, WAITORTIMERCALLBACK, PVOID, ULONG, ULONG);
static __RegisterWaitForSingleObject _RegisterWaitForSingleObject = NULL;
BOOL WINAPI
diff --git a/src/backend/port/win32/socket.c b/src/backend/port/win32/socket.c
index 49631fa793..a8fa0e0806 100644
--- a/src/backend/port/win32/socket.c
+++ b/src/backend/port/win32/socket.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.21 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32/socket.c,v 1.22 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -434,7 +434,8 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c
r = WSASend(writefds->fd_array[i], &buf, 1, &sent, 0, NULL, NULL);
if (r == 0) /* Completed - means things are fine! */
- FD_SET(writefds->fd_array[i], &outwritefds);
+ FD_SET (writefds->fd_array[i], &outwritefds);
+
else
{ /* Not completed */
if (WSAGetLastError() != WSAEWOULDBLOCK)
@@ -443,7 +444,7 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c
* Not completed, and not just "would block", so an error
* occured
*/
- FD_SET(writefds->fd_array[i], &outwritefds);
+ FD_SET (writefds->fd_array[i], &outwritefds);
}
}
if (outwritefds.fd_count > 0)
@@ -530,7 +531,8 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c
(resEvents.lNetworkEvents & FD_ACCEPT) ||
(resEvents.lNetworkEvents & FD_CLOSE))
{
- FD_SET(sockets[i], &outreadfds);
+ FD_SET (sockets[i], &outreadfds);
+
nummatches++;
}
}
@@ -540,7 +542,8 @@ pgwin32_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, c
if ((resEvents.lNetworkEvents & FD_WRITE) ||
(resEvents.lNetworkEvents & FD_CLOSE))
{
- FD_SET(sockets[i], &outwritefds);
+ FD_SET (sockets[i], &outwritefds);
+
nummatches++;
}
}
diff --git a/src/backend/port/win32/timer.c b/src/backend/port/win32/timer.c
index bf315bd652..8dd0e91a23 100644
--- a/src/backend/port/win32/timer.c
+++ b/src/backend/port/win32/timer.c
@@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.16 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.17 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,7 +27,7 @@ typedef struct timerCA
struct itimerval value;
HANDLE event;
CRITICAL_SECTION crit_sec;
-} timerCA;
+} timerCA;
static timerCA timerCommArea;
static HANDLE timerThreadHandle = INVALID_HANDLE_VALUE;
diff --git a/src/backend/port/win32_sema.c b/src/backend/port/win32_sema.c
index bf68b4c60e..2942ff138b 100644
--- a/src/backend/port/win32_sema.c
+++ b/src/backend/port/win32_sema.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32_sema.c,v 1.8 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32_sema.c,v 1.9 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -125,10 +125,10 @@ PGSemaphoreLock(PGSemaphore sema, bool interruptOK)
wh[1] = pgwin32_signal_event;
/*
- * As in other implementations of PGSemaphoreLock, we need to check
- * for cancel/die interrupts each time through the loop. But here,
- * there is no hidden magic about whether the syscall will internally
- * service a signal --- we do that ourselves.
+ * As in other implementations of PGSemaphoreLock, we need to check for
+ * cancel/die interrupts each time through the loop. But here, there is
+ * no hidden magic about whether the syscall will internally service a
+ * signal --- we do that ourselves.
*/
do
{
diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c
index 5651a31e44..4e819d0c65 100644
--- a/src/backend/port/win32_shmem.c
+++ b/src/backend/port/win32_shmem.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.10 2009/05/05 21:51:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/port/win32_shmem.c,v 1.11 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,11 +57,11 @@ GetSharedMemName(void)
elog(FATAL, "could not generate full pathname for datadir %s: %lu",
DataDir, GetLastError());
- /*
+ /*
* XXX: Intentionally overwriting the Global\ part here. This was not the
* original approach, but putting it in the actual Global\ namespace
- * causes permission errors in a lot of cases, so we leave it in
- * the default namespace for now.
+ * causes permission errors in a lot of cases, so we leave it in the
+ * default namespace for now.
*/
for (cp = retptr; *cp; cp++)
if (*cp == '\\')
@@ -135,19 +135,22 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
/*
* When recycling a shared memory segment, it may take a short while
* before it gets dropped from the global namespace. So re-try after
- * sleeping for a second, and continue retrying 10 times.
- * (both the 1 second time and the 10 retries are completely arbitrary)
+ * sleeping for a second, and continue retrying 10 times. (both the 1
+ * second time and the 10 retries are completely arbitrary)
*/
for (i = 0; i < 10; i++)
{
- /* In case CreateFileMapping() doesn't set the error code to 0 on success */
+ /*
+ * In case CreateFileMapping() doesn't set the error code to 0 on
+ * success
+ */
SetLastError(0);
- hmap = CreateFileMapping((HANDLE) 0xFFFFFFFF, /* Use the pagefile */
- NULL, /* Default security attrs */
- PAGE_READWRITE, /* Memory is Read/Write */
+ hmap = CreateFileMapping((HANDLE) 0xFFFFFFFF, /* Use the pagefile */
+ NULL, /* Default security attrs */
+ PAGE_READWRITE, /* Memory is Read/Write */
0L, /* Size Upper 32 Bits */
- (DWORD) size, /* Size Lower 32 bits */
+ (DWORD) size, /* Size Lower 32 bits */
szShareMem);
if (!hmap)
@@ -162,8 +165,8 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
*/
if (GetLastError() == ERROR_ALREADY_EXISTS)
{
- CloseHandle(hmap); /* Close the handle, since we got a valid
- * one to the previous segment. */
+ CloseHandle(hmap); /* Close the handle, since we got a valid one
+ * to the previous segment. */
hmap = NULL;
Sleep(1000);
continue;
@@ -177,8 +180,8 @@ PGSharedMemoryCreate(Size size, bool makePrivate, int port)
*/
if (!hmap)
ereport(FATAL,
- (errmsg("pre-existing shared memory block is still in use"),
- errhint("Check if there are any old server processes still running, and terminate them.")));
+ (errmsg("pre-existing shared memory block is still in use"),
+ errhint("Check if there are any old server processes still running, and terminate them.")));
free(szShareMem);
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index 2e63e9bbfa..7584dc3906 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -55,7 +55,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.97 2009/06/09 19:36:28 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/autovacuum.c,v 1.98 2009/06/11 14:49:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -124,7 +124,7 @@ int Log_autovacuum_min_duration = -1;
#define STATS_READ_DELAY 1000
/* the minimum allowed time between two awakenings of the launcher */
-#define MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */
+#define MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */
/* Flags to tell if we are in an autovacuum process */
static bool am_autovacuum_launcher = false;
@@ -168,8 +168,8 @@ typedef struct av_relation
Oid ar_toastrelid; /* hash key - must be first */
Oid ar_relid;
bool ar_hasrelopts;
- AutoVacOpts ar_reloptions; /* copy of AutoVacOpts from the main table's
- reloptions, or NULL if none */
+ AutoVacOpts ar_reloptions; /* copy of AutoVacOpts from the main table's
+ * reloptions, or NULL if none */
} av_relation;
/* struct to keep track of tables to vacuum and/or analyze, after rechecking */
@@ -362,7 +362,7 @@ StartAutoVacLauncher(void)
{
case -1:
ereport(LOG,
- (errmsg("could not fork autovacuum launcher process: %m")));
+ (errmsg("could not fork autovacuum launcher process: %m")));
return 0;
#ifndef EXEC_BACKEND
@@ -1000,8 +1000,8 @@ rebuild_database_list(Oid newdb)
qsort(dbary, nelems, sizeof(avl_dbase), db_comparator);
/*
- * Determine the time interval between databases in the schedule.
- * If we see that the configured naptime would take us to sleep times
+ * Determine the time interval between databases in the schedule. If
+ * we see that the configured naptime would take us to sleep times
* lower than our min sleep time (which launcher_determine_sleep is
* coded not to allow), silently use a larger naptime (but don't touch
* the GUC variable).
@@ -1362,8 +1362,8 @@ avl_quickdie(SIGNAL_ARGS)
* system reset cycle if some idiot DBA sends a manual SIGQUIT to a random
* backend. This is necessary precisely because we don't clean up our
* shared memory state. (The "dead man switch" mechanism in pmsignal.c
- * should ensure the postmaster sees this as a crash, too, but no harm
- * in being doubly sure.)
+ * should ensure the postmaster sees this as a crash, too, but no harm in
+ * being doubly sure.)
*/
exit(2);
}
@@ -1849,7 +1849,7 @@ do_autovacuum(void)
PgStat_StatDBEntry *shared;
PgStat_StatDBEntry *dbentry;
BufferAccessStrategy bstrategy;
- ScanKeyData key;
+ ScanKeyData key;
TupleDesc pg_class_desc;
/*
@@ -1881,8 +1881,8 @@ do_autovacuum(void)
pgstat_vacuum_stat();
/*
- * Find the pg_database entry and select the default freeze ages. We
- * use zero in template and nonconnectable databases, else the system-wide
+ * Find the pg_database entry and select the default freeze ages. We use
+ * zero in template and nonconnectable databases, else the system-wide
* default.
*/
tuple = SearchSysCache(DATABASEOID,
@@ -1930,12 +1930,12 @@ do_autovacuum(void)
/*
* Scan pg_class to determine which tables to vacuum.
*
- * We do this in two passes: on the first one we collect the list of
- * plain relations, and on the second one we collect TOAST tables.
- * The reason for doing the second pass is that during it we want to use
- * the main relation's pg_class.reloptions entry if the TOAST table does
- * not have any, and we cannot obtain it unless we know beforehand what's
- * the main table OID.
+ * We do this in two passes: on the first one we collect the list of plain
+ * relations, and on the second one we collect TOAST tables. The reason
+ * for doing the second pass is that during it we want to use the main
+ * relation's pg_class.reloptions entry if the TOAST table does not have
+ * any, and we cannot obtain it unless we know beforehand what's the main
+ * table OID.
*
* We need to check TOAST tables separately because in cases with short,
* wide tables there might be proportionally much more activity in the
@@ -1949,8 +1949,8 @@ do_autovacuum(void)
relScan = heap_beginscan(classRel, SnapshotNow, 1, &key);
/*
- * On the first pass, we collect main tables to vacuum, and also the
- * main table relid to TOAST relid mapping.
+ * On the first pass, we collect main tables to vacuum, and also the main
+ * table relid to TOAST relid mapping.
*/
while ((tuple = heap_getnext(relScan, ForwardScanDirection)) != NULL)
{
@@ -1998,7 +1998,7 @@ do_autovacuum(void)
ereport(LOG,
(errmsg("autovacuum: dropping orphan temp table \"%s\".\"%s\" in database \"%s\"",
- get_namespace_name(classForm->relnamespace),
+ get_namespace_name(classForm->relnamespace),
NameStr(classForm->relname),
get_database_name(MyDatabaseId))));
object.classId = RelationRelationId;
@@ -2010,7 +2010,7 @@ do_autovacuum(void)
{
ereport(LOG,
(errmsg("autovacuum: found orphan temp table \"%s\".\"%s\" in database \"%s\"",
- get_namespace_name(classForm->relnamespace),
+ get_namespace_name(classForm->relnamespace),
NameStr(classForm->relname),
get_database_name(MyDatabaseId))));
}
@@ -2065,7 +2065,7 @@ do_autovacuum(void)
{
Form_pg_class classForm = (Form_pg_class) GETSTRUCT(tuple);
PgStat_StatTabEntry *tabentry;
- Oid relid;
+ Oid relid;
AutoVacOpts *relopts = NULL;
bool dovacuum;
bool doanalyze;
@@ -2080,14 +2080,14 @@ do_autovacuum(void)
relid = HeapTupleGetOid(tuple);
/*
- * fetch reloptions -- if this toast table does not have them,
- * try the main rel
+ * fetch reloptions -- if this toast table does not have them, try the
+ * main rel
*/
relopts = extract_autovac_opts(tuple, pg_class_desc);
if (relopts == NULL)
{
- av_relation *hentry;
- bool found;
+ av_relation *hentry;
+ bool found;
hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
if (found && hentry->ar_hasrelopts)
@@ -2187,10 +2187,10 @@ do_autovacuum(void)
* It could have changed if something else processed the table while
* we weren't looking.
*
- * Note: we have a special case in pgstat code to ensure that the stats
- * we read are as up-to-date as possible, to avoid the problem that
- * somebody just finished vacuuming this table. The window to the race
- * condition is not closed but it is very small.
+ * Note: we have a special case in pgstat code to ensure that the
+ * stats we read are as up-to-date as possible, to avoid the problem
+ * that somebody just finished vacuuming this table. The window to
+ * the race condition is not closed but it is very small.
*/
MemoryContextSwitchTo(AutovacMemCxt);
tab = table_recheck_autovac(relid, table_toast_map, pg_class_desc);
@@ -2231,7 +2231,7 @@ do_autovacuum(void)
/*
* Save the relation name for a possible error message, to avoid a
- * catalog lookup in case of an error. If any of these return NULL,
+ * catalog lookup in case of an error. If any of these return NULL,
* then the relation has been dropped since last we checked; skip it.
* Note: they must live in a long-lived memory context because we call
* vacuum and analyze in different transactions.
@@ -2307,8 +2307,8 @@ deleted:
}
/*
- * We leak table_toast_map here (among other things), but since we're going
- * away soon, it's not a problem.
+ * We leak table_toast_map here (among other things), but since we're
+ * going away soon, it's not a problem.
*/
/*
@@ -2339,7 +2339,7 @@ extract_autovac_opts(HeapTuple tup, TupleDesc pg_class_desc)
relopts = extractRelOptions(tup, pg_class_desc, InvalidOid);
if (relopts == NULL)
return NULL;
-
+
av = palloc(sizeof(AutoVacOpts));
memcpy(av, &(((StdRdOptions *) relopts)->autovacuum), sizeof(AutoVacOpts));
pfree(relopts);
@@ -2392,7 +2392,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
PgStat_StatDBEntry *shared;
PgStat_StatDBEntry *dbentry;
bool wraparound;
- AutoVacOpts *avopts;
+ AutoVacOpts *avopts;
/* use fresh stats */
autovac_refresh_stats();
@@ -2408,16 +2408,16 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
return NULL;
classForm = (Form_pg_class) GETSTRUCT(classTup);
- /*
+ /*
* Get the applicable reloptions. If it is a TOAST table, try to get the
* main table reloptions if the toast table itself doesn't have.
*/
avopts = extract_autovac_opts(classTup, pg_class_desc);
- if (classForm->relkind == RELKIND_TOASTVALUE &&
+ if (classForm->relkind == RELKIND_TOASTVALUE &&
avopts == NULL && table_toast_map != NULL)
{
- av_relation *hentry;
- bool found;
+ av_relation *hentry;
+ bool found;
hentry = hash_search(table_toast_map, &relid, HASH_FIND, &found);
if (found && hentry->ar_hasrelopts)
@@ -2516,7 +2516,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
*
* A table whose autovacuum_enabled option 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
+ * Thus 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
@@ -2684,8 +2684,8 @@ static void
autovac_report_activity(autovac_table *tab)
{
#define MAX_AUTOVAC_ACTIV_LEN (NAMEDATALEN * 2 + 56)
- char activity[MAX_AUTOVAC_ACTIV_LEN];
- int len;
+ char activity[MAX_AUTOVAC_ACTIV_LEN];
+ int len;
/* Report the command and possible options */
if (tab->at_dovacuum)
@@ -2703,7 +2703,7 @@ autovac_report_activity(autovac_table *tab)
snprintf(activity + len, MAX_AUTOVAC_ACTIV_LEN - len,
" %s.%s%s", tab->at_nspname, tab->at_relname,
- tab->at_wraparound ? " (to prevent wraparound)" : "");
+ tab->at_wraparound ? " (to prevent wraparound)" : "");
/* Set statement_timestamp() to current time for pg_stat_activity */
SetCurrentStatementStartTimestamp();
diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c
index b2a90528b6..629565a810 100644
--- a/src/backend/postmaster/bgwriter.c
+++ b/src/backend/postmaster/bgwriter.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.59 2009/06/04 18:33:07 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/bgwriter.c,v 1.60 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -113,7 +113,7 @@
typedef struct
{
RelFileNode rnode;
- ForkNumber forknum;
+ ForkNumber forknum;
BlockNumber segno; /* see md.c for special values */
/* might add a real request-type field later; not needed yet */
} BgWriterRequest;
@@ -424,16 +424,16 @@ BackgroundWriterMain(void)
*/
if (do_checkpoint)
{
- bool ckpt_performed = false;
- bool do_restartpoint;
+ bool ckpt_performed = false;
+ bool do_restartpoint;
/* use volatile pointer to prevent code rearrangement */
volatile BgWriterShmemStruct *bgs = BgWriterShmem;
/*
- * Check if we should perform a checkpoint or a restartpoint.
- * As a side-effect, RecoveryInProgress() initializes
- * TimeLineID if it's not set yet.
+ * Check if we should perform a checkpoint or a restartpoint. As a
+ * side-effect, RecoveryInProgress() initializes TimeLineID if
+ * it's not set yet.
*/
do_restartpoint = RecoveryInProgress();
@@ -460,7 +460,7 @@ BackgroundWriterMain(void)
elapsed_secs < CheckPointWarning)
ereport(LOG,
(errmsg_plural("checkpoints are occurring too frequently (%d second apart)",
- "checkpoints are occurring too frequently (%d seconds apart)",
+ "checkpoints are occurring too frequently (%d seconds apart)",
elapsed_secs,
elapsed_secs),
errhint("Consider increasing the configuration parameter \"checkpoint_segments\".")));
@@ -812,8 +812,8 @@ bg_quickdie(SIGNAL_ARGS)
* system reset cycle if some idiot DBA sends a manual SIGQUIT to a random
* backend. This is necessary precisely because we don't clean up our
* shared memory state. (The "dead man switch" mechanism in pmsignal.c
- * should ensure the postmaster sees this as a crash, too, but no harm
- * in being doubly sure.)
+ * should ensure the postmaster sees this as a crash, too, but no harm in
+ * being doubly sure.)
*/
exit(2);
}
@@ -952,25 +952,25 @@ RequestCheckpoint(int flags)
/*
* Send signal to request checkpoint. It's possible that the bgwriter
- * hasn't started yet, or is in process of restarting, so we will retry
- * a few times if needed. Also, if not told to wait for the checkpoint
- * to occur, we consider failure to send the signal to be nonfatal and
- * merely LOG it.
+ * hasn't started yet, or is in process of restarting, so we will retry a
+ * few times if needed. Also, if not told to wait for the checkpoint to
+ * occur, we consider failure to send the signal to be nonfatal and merely
+ * LOG it.
*/
- for (ntries = 0; ; ntries++)
+ for (ntries = 0;; ntries++)
{
if (BgWriterShmem->bgwriter_pid == 0)
{
- if (ntries >= 20) /* max wait 2.0 sec */
+ if (ntries >= 20) /* max wait 2.0 sec */
{
elog((flags & CHECKPOINT_WAIT) ? ERROR : LOG,
- "could not request checkpoint because bgwriter not running");
+ "could not request checkpoint because bgwriter not running");
break;
}
}
else if (kill(BgWriterShmem->bgwriter_pid, SIGINT) != 0)
{
- if (ntries >= 20) /* max wait 2.0 sec */
+ if (ntries >= 20) /* max wait 2.0 sec */
{
elog((flags & CHECKPOINT_WAIT) ? ERROR : LOG,
"could not signal for checkpoint: %m");
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c
index 5ed6c02cb7..28306729ac 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.39 2009/01/01 17:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgarch.c,v 1.40 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -348,8 +348,8 @@ pgarch_MainLoop(void)
* If we've gotten SIGTERM, we normally just sit and do nothing until
* SIGUSR2 arrives. However, that means a random SIGTERM would
* disable archiving indefinitely, which doesn't seem like a good
- * idea. If more than 60 seconds pass since SIGTERM, exit anyway,
- * so that the postmaster can start a new archiver if needed.
+ * idea. If more than 60 seconds pass since SIGTERM, exit anyway, so
+ * that the postmaster can start a new archiver if needed.
*/
if (got_SIGTERM)
{
@@ -432,10 +432,10 @@ pgarch_ArchiverCopyLoop(void)
{
/*
* Do not initiate any more archive commands after receiving
- * SIGTERM, nor after the postmaster has died unexpectedly.
- * The first condition is to try to keep from having init
- * SIGKILL the command, and the second is to avoid conflicts
- * with another archiver spawned by a newer postmaster.
+ * SIGTERM, nor after the postmaster has died unexpectedly. The
+ * first condition is to try to keep from having init SIGKILL the
+ * command, and the second is to avoid conflicts with another
+ * archiver spawned by a newer postmaster.
*/
if (got_SIGTERM || !PostmasterIsAlive(true))
return;
@@ -549,7 +549,7 @@ pgarch_archiveXlog(char *xlog)
* Per the Single Unix Spec, shells report exit status > 128 when a
* called command died on a signal.
*/
- int lev = (WIFSIGNALED(rc) || WEXITSTATUS(rc) > 128) ? FATAL : LOG;
+ int lev = (WIFSIGNALED(rc) || WEXITSTATUS(rc) > 128) ? FATAL : LOG;
if (WIFEXITED(rc))
{
@@ -563,16 +563,16 @@ pgarch_archiveXlog(char *xlog)
{
#if defined(WIN32)
ereport(lev,
- (errmsg("archive command was terminated by exception 0x%X",
- WTERMSIG(rc)),
- errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
- errdetail("The failed archive command was: %s",
- xlogarchcmd)));
+ (errmsg("archive command was terminated by exception 0x%X",
+ WTERMSIG(rc)),
+ errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
+ errdetail("The failed archive command was: %s",
+ xlogarchcmd)));
#elif defined(HAVE_DECL_SYS_SIGLIST) && HAVE_DECL_SYS_SIGLIST
ereport(lev,
(errmsg("archive command was terminated by signal %d: %s",
WTERMSIG(rc),
- WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"),
+ WTERMSIG(rc) < NSIG ? sys_siglist[WTERMSIG(rc)] : "(unknown)"),
errdetail("The failed archive command was: %s",
xlogarchcmd)));
#else
@@ -586,10 +586,10 @@ pgarch_archiveXlog(char *xlog)
else
{
ereport(lev,
- (errmsg("archive command exited with unrecognized status %d",
- rc),
- errdetail("The failed archive command was: %s",
- xlogarchcmd)));
+ (errmsg("archive command exited with unrecognized status %d",
+ rc),
+ errdetail("The failed archive command was: %s",
+ xlogarchcmd)));
}
snprintf(activitymsg, sizeof(activitymsg), "failed on %s", xlog);
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 4925e6b3b8..37808735c9 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -13,7 +13,7 @@
*
* Copyright (c) 2001-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.188 2009/06/06 22:13:51 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.189 2009/06/11 14:49:01 momjian Exp $
* ----------
*/
#include "postgres.h"
@@ -217,6 +217,7 @@ static PgStat_GlobalStats globalStats;
/* Last time the collector successfully wrote the stats file */
static TimestampTz last_statwrite;
+
/* Latest statistics request time from backends */
static TimestampTz last_statrequest;
@@ -425,7 +426,8 @@ retry1:
for (;;) /* need a loop to handle EINTR */
{
FD_ZERO(&rset);
- FD_SET(pgStatSock, &rset);
+ FD_SET (pgStatSock, &rset);
+
tv.tv_sec = 0;
tv.tv_usec = 500000;
sel_res = select(pgStatSock + 1, &rset, NULL, NULL, &tv);
@@ -1213,14 +1215,14 @@ pgstat_report_analyze(Relation rel, PgStat_Counter livetuples,
return;
/*
- * Unlike VACUUM, ANALYZE might be running inside a transaction that
- * has already inserted and/or deleted rows in the target table.
- * ANALYZE will have counted such rows as live or dead respectively.
- * Because we will report our counts of such rows at transaction end,
- * we should subtract off these counts from what we send to the collector
- * now, else they'll be double-counted after commit. (This approach also
- * ensures that the collector ends up with the right numbers if we abort
- * instead of committing.)
+ * Unlike VACUUM, ANALYZE might be running inside a transaction that has
+ * already inserted and/or deleted rows in the target table. ANALYZE will
+ * have counted such rows as live or dead respectively. Because we will
+ * report our counts of such rows at transaction end, we should subtract
+ * off these counts from what we send to the collector now, else they'll
+ * be double-counted after commit. (This approach also ensures that the
+ * collector ends up with the right numbers if we abort instead of
+ * committing.)
*/
if (rel->pgstat_info != NULL)
{
@@ -1241,7 +1243,7 @@ pgstat_report_analyze(Relation rel, PgStat_Counter livetuples,
pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_ANALYZE);
msg.m_databaseid = rel->rd_rel->relisshared ? InvalidOid : MyDatabaseId;
msg.m_tableoid = RelationGetRelid(rel);
- 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;
@@ -1294,7 +1296,7 @@ pgstat_init_function_usage(FunctionCallInfoData *fcinfo,
PgStat_FunctionCallUsage *fcu)
{
PgStat_BackendFunctionEntry *htabent;
- bool found;
+ bool found;
if (pgstat_track_functions <= fcinfo->flinfo->fn_stats)
{
@@ -1374,8 +1376,8 @@ pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
* Compute the new total f_time as the total elapsed time added to the
* pre-call value of f_time. This is necessary to avoid double-counting
* any time taken by recursive calls of myself. (We do not need any
- * similar kluge for self time, since that already excludes any
- * recursive calls.)
+ * similar kluge for self time, since that already excludes any recursive
+ * calls.)
*/
INSTR_TIME_ADD(f_total, fcu->save_f_time);
@@ -2068,7 +2070,7 @@ pgstat_fetch_global(void)
static PgBackendStatus *BackendStatusArray = NULL;
static PgBackendStatus *MyBEEntry = NULL;
-static char *BackendActivityBuffer = NULL;
+static char *BackendActivityBuffer = NULL;
/*
@@ -2111,7 +2113,7 @@ CreateSharedBackendStatus(void)
/* Create or attach to the shared activity buffer */
size = mul_size(pgstat_track_activity_query_size, MaxBackends);
- BackendActivityBuffer = (char*)
+ BackendActivityBuffer = (char *)
ShmemInitStruct("Backend Activity Buffer", size, &found);
if (!found)
@@ -2120,7 +2122,8 @@ CreateSharedBackendStatus(void)
/* Initialize st_activity pointers. */
buffer = BackendActivityBuffer;
- for (i = 0; i < MaxBackends; i++) {
+ for (i = 0; i < MaxBackends; i++)
+ {
BackendStatusArray[i].st_activity = buffer;
buffer += pgstat_track_activity_query_size;
}
@@ -2350,7 +2353,7 @@ pgstat_read_current_status(void)
volatile PgBackendStatus *beentry;
PgBackendStatus *localtable;
PgBackendStatus *localentry;
- char *localactivity;
+ char *localactivity;
int i;
Assert(!pgStatRunningInCollector);
@@ -2386,6 +2389,7 @@ pgstat_read_current_status(void)
if (localentry->st_procpid > 0)
{
memcpy(localentry, (char *) beentry, sizeof(PgBackendStatus));
+
/*
* strcpy is safe even if the string is modified concurrently,
* because there's always a \0 at the end of the buffer.
@@ -2421,12 +2425,12 @@ pgstat_read_current_status(void)
* pgstat_get_backend_current_activity() -
*
* Return a string representing the current activity of the backend with
- * the specified PID. This looks directly at the BackendStatusArray,
+ * the specified PID. This looks directly at the BackendStatusArray,
* and so will provide current information regardless of the age of our
* transaction's snapshot of the status array.
*
* It is the caller's responsibility to invoke this only for backends whose
- * state is expected to remain stable while the result is in use. The
+ * state is expected to remain stable while the result is in use. The
* only current use is in deadlock reporting, where we can expect that
* the target backend is blocked on a lock. (There are corner cases
* where the target's wait could get aborted while we are looking at it,
@@ -2452,11 +2456,11 @@ pgstat_get_backend_current_activity(int pid, bool checkUser)
* must follow the protocol of retrying if st_changecount changes
* while we examine the entry, or if it's odd. (This might be
* unnecessary, since fetching or storing an int is almost certainly
- * atomic, but let's play it safe.) We use a volatile pointer here
- * to ensure the compiler doesn't try to get cute.
+ * atomic, but let's play it safe.) We use a volatile pointer here to
+ * ensure the compiler doesn't try to get cute.
*/
volatile PgBackendStatus *vbeentry = beentry;
- bool found;
+ bool found;
for (;;)
{
@@ -2664,7 +2668,7 @@ PgstatCollectorMain(int argc, char *argv[])
*
* For performance reasons, we don't want to do a PostmasterIsAlive() test
* after every message; instead, do it only when select()/poll() is
- * interrupted by timeout. In essence, we'll stay alive as long as
+ * interrupted by timeout. In essence, we'll stay alive as long as
* backends keep sending us stuff often, even if the postmaster is gone.
*/
for (;;)
@@ -2722,7 +2726,7 @@ PgstatCollectorMain(int argc, char *argv[])
got_data = (input_fd.revents != 0);
#else /* !HAVE_POLL */
- FD_SET(pgStatSock, &rfds);
+ FD_SET (pgStatSock, &rfds);
/*
* timeout struct is modified by select() on some operating systems,
@@ -2821,9 +2825,9 @@ PgstatCollectorMain(int argc, char *argv[])
pgstat_recv_bgwriter((PgStat_MsgBgWriter *) &msg, len);
break;
- case PGSTAT_MTYPE_FUNCSTAT:
- pgstat_recv_funcstat((PgStat_MsgFuncstat *) &msg, len);
- break;
+ case PGSTAT_MTYPE_FUNCSTAT:
+ pgstat_recv_funcstat((PgStat_MsgFuncstat *) &msg, len);
+ break;
case PGSTAT_MTYPE_FUNCPURGE:
pgstat_recv_funcpurge((PgStat_MsgFuncpurge *) &msg, len);
@@ -2949,8 +2953,8 @@ pgstat_write_statsfile(bool permanent)
PgStat_StatFuncEntry *funcentry;
FILE *fpout;
int32 format_id;
- const char *tmpfile = permanent?PGSTAT_STAT_PERMANENT_TMPFILE:pgstat_stat_tmpname;
- const char *statfile = permanent?PGSTAT_STAT_PERMANENT_FILENAME:pgstat_stat_filename;
+ const char *tmpfile = permanent ? PGSTAT_STAT_PERMANENT_TMPFILE : pgstat_stat_tmpname;
+ const char *statfile = permanent ? PGSTAT_STAT_PERMANENT_FILENAME : pgstat_stat_filename;
/*
* Open the statistics temp file to write out the current values.
@@ -2989,8 +2993,8 @@ pgstat_write_statsfile(bool permanent)
{
/*
* Write out the DB entry including the number of live backends. We
- * don't write the tables or functions pointers, since they're of
- * no use to any other process.
+ * don't write the tables or functions pointers, since they're of no
+ * use to any other process.
*/
fputc('D', fpout);
fwrite(dbentry, offsetof(PgStat_StatDBEntry, tables), 1, fpout);
@@ -3098,7 +3102,7 @@ pgstat_read_statsfile(Oid onlydb, bool permanent)
FILE *fpin;
int32 format_id;
bool found;
- const char *statfile = permanent?PGSTAT_STAT_PERMANENT_FILENAME:pgstat_stat_filename;
+ const char *statfile = permanent ? PGSTAT_STAT_PERMANENT_FILENAME : pgstat_stat_filename;
/*
* The tables will live in pgStatLocalContext.
@@ -3220,6 +3224,7 @@ pgstat_read_statsfile(Oid onlydb, bool permanent)
PGSTAT_FUNCTION_HASH_SIZE,
&hash_ctl,
HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT);
+
/*
* Arrange that following records add entries to this
* database's hash tables.
@@ -3287,7 +3292,7 @@ pgstat_read_statsfile(Oid onlydb, bool permanent)
break;
funcentry = (PgStat_StatFuncEntry *) hash_search(funchash,
- (void *) &funcbuf.functionid,
+ (void *) &funcbuf.functionid,
HASH_ENTER, &found);
if (found)
@@ -3335,7 +3340,7 @@ pgstat_read_statsfile_timestamp(bool permanent, TimestampTz *ts)
PgStat_GlobalStats myGlobalStats;
FILE *fpin;
int32 format_id;
- const char *statfile = permanent?PGSTAT_STAT_PERMANENT_FILENAME:pgstat_stat_filename;
+ const char *statfile = permanent ? PGSTAT_STAT_PERMANENT_FILENAME : pgstat_stat_filename;
/*
* Try to open the status file.
@@ -3386,14 +3391,14 @@ backend_read_statsfile(void)
/*
* We set the minimum acceptable timestamp to PGSTAT_STAT_INTERVAL msec
- * before now. This indirectly ensures that the collector needn't write
+ * before now. This indirectly ensures that the collector needn't write
* the file more often than PGSTAT_STAT_INTERVAL. In an autovacuum
* worker, however, we want a lower delay to avoid using stale data, so we
* use PGSTAT_RETRY_DELAY (since the number of worker is low, this
* shouldn't be a problem).
*
* Note that we don't recompute min_ts after sleeping; so we might end up
- * accepting a file a bit older than PGSTAT_STAT_INTERVAL. In practice
+ * accepting a file a bit older than PGSTAT_STAT_INTERVAL. In practice
* that shouldn't happen, though, as long as the sleep time is less than
* PGSTAT_STAT_INTERVAL; and we don't want to lie to the collector about
* what our cutoff time really is.
@@ -3407,7 +3412,8 @@ backend_read_statsfile(void)
/*
* Loop until fresh enough stats file is available or we ran out of time.
- * The stats inquiry message is sent repeatedly in case collector drops it.
+ * The stats inquiry message is sent repeatedly in case collector drops
+ * it.
*/
for (count = 0; count < PGSTAT_POLL_LOOP_COUNT; count++)
{
@@ -3871,8 +3877,8 @@ pgstat_recv_funcstat(PgStat_MsgFuncstat *msg, int len)
for (i = 0; i < msg->m_nentries; i++, funcmsg++)
{
funcentry = (PgStat_StatFuncEntry *) hash_search(dbentry->functions,
- (void *) &(funcmsg->f_id),
- HASH_ENTER, &found);
+ (void *) &(funcmsg->f_id),
+ HASH_ENTER, &found);
if (!found)
{
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index fbeb342a90..c9b0e0ab2e 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.581 2009/05/05 19:59:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.582 2009/06/11 14:49:01 momjian Exp $
*
* NOTES
*
@@ -219,7 +219,7 @@ static pid_t StartupPID = 0,
static int Shutdown = NoShutdown;
static bool FatalError = false; /* T if recovering from backend crash */
-static bool RecoveryError = false; /* T if WAL recovery failed */
+static bool RecoveryError = false; /* T if WAL recovery failed */
/*
* We use a simple state machine to control startup, shutdown, and
@@ -230,8 +230,8 @@ static bool RecoveryError = false; /* T if WAL recovery failed */
* reading the control file and other preliminary initialization steps. When
* it's ready to start WAL redo, it signals postmaster, and we switch to
* PM_RECOVERY phase. The background writer is launched, while the startup
- * process continues applying WAL.
- *
+ * process continues applying WAL.
+ *
* After reaching a consistent point in WAL redo, startup process signals
* us again, and we switch to PM_RECOVERY_CONSISTENT phase. There's currently
* no difference between PM_RECOVERY and PM_RECOVERY_CONSISTENT, but we
@@ -365,7 +365,7 @@ typedef struct
HANDLE waitHandle;
HANDLE procHandle;
DWORD procId;
-} win32_deadchild_waitinfo;
+} win32_deadchild_waitinfo;
HANDLE PostmasterHandle;
#endif
@@ -380,7 +380,7 @@ typedef struct
SOCKET origsocket; /* Original socket value, or -1 if not a
* socket */
WSAPROTOCOL_INFO wsainfo;
-} InheritableSocket;
+} InheritableSocket;
#else
typedef int InheritableSocket;
#endif
@@ -425,15 +425,15 @@ typedef struct
char ExtraOptions[MAXPGPATH];
char lc_collate[NAMEDATALEN];
char lc_ctype[NAMEDATALEN];
-} BackendParameters;
+} BackendParameters;
static void read_backend_variables(char *id, Port *port);
-static void restore_backend_variables(BackendParameters * param, Port *port);
+static void restore_backend_variables(BackendParameters *param, Port *port);
#ifndef WIN32
-static bool save_backend_variables(BackendParameters * param, Port *port);
+static bool save_backend_variables(BackendParameters *param, Port *port);
#else
-static bool save_backend_variables(BackendParameters * param, Port *port,
+static bool save_backend_variables(BackendParameters *param, Port *port,
HANDLE childProcess, pid_t childPid);
#endif
@@ -898,8 +898,8 @@ PostmasterMain(int argc, char *argv[])
*/
if (!load_hba())
{
- /*
- * It makes no sense continue if we fail to load the HBA file, since
+ /*
+ * It makes no sense continue if we fail to load the HBA file, since
* there is no way to connect to the database in this case.
*/
ereport(FATAL,
@@ -1076,11 +1076,11 @@ getInstallationPaths(const char *argv0)
get_pkglib_path(my_exec_path, pkglib_path);
/*
- * Verify that there's a readable directory there; otherwise the
- * Postgres installation is incomplete or corrupt. (A typical cause
- * of this failure is that the postgres executable has been moved or
- * hardlinked to some directory that's not a sibling of the installation
- * lib/ directory.)
+ * Verify that there's a readable directory there; otherwise the Postgres
+ * installation is incomplete or corrupt. (A typical cause of this
+ * failure is that the postgres executable has been moved or hardlinked to
+ * some directory that's not a sibling of the installation lib/
+ * directory.)
*/
pdir = AllocateDir(pkglib_path);
if (pdir == NULL)
@@ -1093,8 +1093,8 @@ getInstallationPaths(const char *argv0)
FreeDir(pdir);
/*
- * XXX is it worth similarly checking the share/ directory? If the
- * lib/ directory is there, then share/ probably is too.
+ * XXX is it worth similarly checking the share/ directory? If the lib/
+ * directory is there, then share/ probably is too.
*/
}
@@ -1363,7 +1363,7 @@ ServerLoop(void)
* fails, we'll just try again later.
*/
if (BgWriterPID == 0 &&
- (pmState == PM_RUN || pmState == PM_RECOVERY ||
+ (pmState == PM_RUN || pmState == PM_RECOVERY ||
pmState == PM_RECOVERY_CONSISTENT))
BgWriterPID = StartBackgroundWriter();
@@ -1426,7 +1426,8 @@ initMasks(fd_set *rmask)
if (fd == -1)
break;
- FD_SET(fd, rmask);
+ FD_SET (fd, rmask);
+
if (fd > maxsock)
maxsock = fd;
}
@@ -1811,7 +1812,7 @@ canAcceptConnections(void)
if (pmState != PM_RUN)
{
if (pmState == PM_WAIT_BACKUP)
- return CAC_WAITBACKUP; /* allow superusers only */
+ return CAC_WAITBACKUP; /* allow superusers only */
if (Shutdown > NoShutdown)
return CAC_SHUTDOWN; /* shutdown is pending */
if (!FatalError &&
@@ -2064,9 +2065,9 @@ pmdie(SIGNAL_ARGS)
}
/*
- * Now wait for online backup mode to end and
- * backends to exit. If that is already the case,
- * PostmasterStateMachine will take the next step.
+ * Now wait for online backup mode to end and backends to exit.
+ * If that is already the case, PostmasterStateMachine will take
+ * the next step.
*/
PostmasterStateMachine();
break;
@@ -2194,8 +2195,8 @@ reaper(SIGNAL_ARGS)
/*
* Unexpected exit of startup process (including FATAL exit)
- * during PM_STARTUP is treated as catastrophic. There is no
- * other processes running yet, so we can just exit.
+ * during PM_STARTUP is treated as catastrophic. There is no other
+ * processes running yet, so we can just exit.
*/
if (pmState == PM_STARTUP && !EXIT_STATUS_0(exitstatus))
{
@@ -2205,9 +2206,10 @@ reaper(SIGNAL_ARGS)
(errmsg("aborting startup due to startup process failure")));
ExitPostmaster(1);
}
+
/*
- * Startup process exited in response to a shutdown request (or
- * it completed normally regardless of the shutdown request).
+ * Startup process exited in response to a shutdown request (or it
+ * completed normally regardless of the shutdown request).
*/
if (Shutdown > NoShutdown &&
(EXIT_STATUS_0(exitstatus) || EXIT_STATUS_1(exitstatus)))
@@ -2216,10 +2218,11 @@ reaper(SIGNAL_ARGS)
/* PostmasterStateMachine logic does the rest */
continue;
}
+
/*
* Any unexpected exit (including FATAL exit) of the startup
- * process is treated as a crash, except that we don't want
- * to reinitialize.
+ * process is treated as a crash, except that we don't want to
+ * reinitialize.
*/
if (!EXIT_STATUS_0(exitstatus))
{
@@ -2454,8 +2457,8 @@ CleanupBackend(int pid,
if (!ReleasePostmasterChildSlot(bp->child_slot))
{
/*
- * Uh-oh, the child failed to clean itself up. Treat
- * as a crash after all.
+ * Uh-oh, the child failed to clean itself up. Treat as a
+ * crash after all.
*/
HandleChildCrash(pid, exitstatus, _("server process"));
return;
@@ -2733,8 +2736,8 @@ PostmasterStateMachine(void)
pmState = PM_WAIT_DEAD_END;
/*
- * We already SIGQUIT'd the archiver and stats processes,
- * if any, when we entered FatalError state.
+ * We already SIGQUIT'd the archiver and stats processes, if
+ * any, when we entered FatalError state.
*/
}
else
@@ -2825,8 +2828,8 @@ PostmasterStateMachine(void)
else
{
/*
- * Terminate backup mode to avoid recovery after a
- * clean fast shutdown.
+ * Terminate backup mode to avoid recovery after a clean fast
+ * shutdown.
*/
CancelBackup();
@@ -2836,17 +2839,17 @@ PostmasterStateMachine(void)
}
/*
- * If recovery failed, wait for all non-syslogger children to exit,
- * and then exit postmaster. We don't try to reinitialize when recovery
- * fails, because more than likely it will just fail again and we will
- * keep trying forever.
+ * If recovery failed, wait for all non-syslogger children to exit, and
+ * then exit postmaster. We don't try to reinitialize when recovery fails,
+ * because more than likely it will just fail again and we will keep
+ * trying forever.
*/
if (RecoveryError && pmState == PM_NO_CHILDREN)
- ExitPostmaster(1);
+ ExitPostmaster(1);
/*
- * If we need to recover from a crash, wait for all non-syslogger
- * children to exit, then reset shmem and StartupDataBase.
+ * If we need to recover from a crash, wait for all non-syslogger children
+ * to exit, then reset shmem and StartupDataBase.
*/
if (FatalError && pmState == PM_NO_CHILDREN)
{
@@ -2940,8 +2943,8 @@ BackendStartup(Port *port)
pid_t pid;
/*
- * Create backend data structure. Better before the fork() so we
- * can handle failure cleanly.
+ * Create backend data structure. Better before the fork() so we can
+ * handle failure cleanly.
*/
bn = (Backend *) malloc(sizeof(Backend));
if (!bn)
@@ -3225,8 +3228,8 @@ BackendInitialize(Port *port)
if (!load_hba())
{
- /*
- * It makes no sense continue if we fail to load the HBA file, since
+ /*
+ * It makes no sense continue if we fail to load the HBA file, since
* there is no way to connect to the database in this case.
*/
ereport(FATAL,
@@ -3800,10 +3803,10 @@ SubPostmasterMain(int argc, char *argv[])
read_nondefault_variables();
/*
- * Reload any libraries that were preloaded by the postmaster. Since
- * we exec'd this process, those libraries didn't come along with us;
- * but we should load them into all child processes to be consistent
- * with the non-EXEC_BACKEND behavior.
+ * Reload any libraries that were preloaded by the postmaster. Since we
+ * exec'd this process, those libraries didn't come along with us; but we
+ * should load them into all child processes to be consistent with the
+ * non-EXEC_BACKEND behavior.
*/
process_shared_preload_libraries();
@@ -3991,8 +3994,8 @@ sigusr1_handler(SIGNAL_ARGS)
FatalError = false;
/*
- * Crank up the background writer. It doesn't matter if this
- * fails, we'll just try again later.
+ * Crank up the background writer. It doesn't matter if this fails,
+ * we'll just try again later.
*/
Assert(BgWriterPID == 0);
BgWriterPID = StartBackgroundWriter();
@@ -4005,7 +4008,7 @@ sigusr1_handler(SIGNAL_ARGS)
/*
* Load the flat authorization file into postmaster's cache. The
* startup process won't have recomputed this from the database yet,
- * so we it may change following recovery.
+ * so we it may change following recovery.
*/
load_role();
@@ -4292,10 +4295,10 @@ StartAutovacuumWorker(void)
if (bn)
{
/*
- * 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.
+ * 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.
*/
MyCancelKey = PostmasterRandom();
bn->cancel_key = MyCancelKey;
@@ -4379,9 +4382,9 @@ CreateOptsFile(int argc, char *argv[], char *fullprogname)
* This reports the number of entries needed in per-child-process arrays
* (the PMChildFlags array, and if EXEC_BACKEND the ShmemBackendArray).
* These arrays include regular backends and autovac workers, but not special
- * children nor dead_end children. This allows the arrays to have a fixed
+ * children nor dead_end children. This allows the arrays to have a fixed
* maximum size, to wit the same too-many-children limit enforced by
- * canAcceptConnections(). The exact value isn't too critical as long as
+ * canAcceptConnections(). The exact value isn't too critical as long as
* it's more than MaxBackends.
*/
int
@@ -4409,20 +4412,20 @@ extern int pgStatSock;
#define write_inheritable_socket(dest, src, childpid) (*(dest) = (src))
#define read_inheritable_socket(dest, src) (*(dest) = *(src))
#else
-static void write_duplicated_handle(HANDLE * dest, HANDLE src, HANDLE child);
-static void write_inheritable_socket(InheritableSocket * dest, SOCKET src,
+static void write_duplicated_handle(HANDLE *dest, HANDLE src, HANDLE child);
+static void write_inheritable_socket(InheritableSocket *dest, SOCKET src,
pid_t childPid);
-static void read_inheritable_socket(SOCKET * dest, InheritableSocket * src);
+static void read_inheritable_socket(SOCKET *dest, InheritableSocket *src);
#endif
/* Save critical backend variables into the BackendParameters struct */
#ifndef WIN32
static bool
-save_backend_variables(BackendParameters * param, Port *port)
+save_backend_variables(BackendParameters *param, Port *port)
#else
static bool
-save_backend_variables(BackendParameters * param, Port *port,
+save_backend_variables(BackendParameters *param, Port *port,
HANDLE childProcess, pid_t childPid)
#endif
{
@@ -4484,7 +4487,7 @@ save_backend_variables(BackendParameters * param, Port *port,
* process instance of the handle to the parameter file.
*/
static void
-write_duplicated_handle(HANDLE * dest, HANDLE src, HANDLE childProcess)
+write_duplicated_handle(HANDLE *dest, HANDLE src, HANDLE childProcess)
{
HANDLE hChild = INVALID_HANDLE_VALUE;
@@ -4510,7 +4513,7 @@ write_duplicated_handle(HANDLE * dest, HANDLE src, HANDLE childProcess)
* straight socket inheritance.
*/
static void
-write_inheritable_socket(InheritableSocket * dest, SOCKET src, pid_t childpid)
+write_inheritable_socket(InheritableSocket *dest, SOCKET src, pid_t childpid)
{
dest->origsocket = src;
if (src != 0 && src != -1)
@@ -4527,7 +4530,7 @@ write_inheritable_socket(InheritableSocket * dest, SOCKET src, pid_t childpid)
* Read a duplicate socket structure back, and get the socket descriptor.
*/
static void
-read_inheritable_socket(SOCKET * dest, InheritableSocket * src)
+read_inheritable_socket(SOCKET *dest, InheritableSocket *src)
{
SOCKET s;
@@ -4632,7 +4635,7 @@ read_backend_variables(char *id, Port *port)
/* Restore critical backend variables from the BackendParameters struct */
static void
-restore_backend_variables(BackendParameters * param, Port *port)
+restore_backend_variables(BackendParameters *param, Port *port)
{
memcpy(port, &param->port, sizeof(Port));
read_inheritable_socket(&port->sock, &param->portsocket);
@@ -4717,7 +4720,6 @@ ShmemBackendArrayRemove(Backend *bn)
/* Mark the slot as empty */
ShmemBackendArray[i].pid = 0;
}
-
#endif /* EXEC_BACKEND */
diff --git a/src/backend/postmaster/syslogger.c b/src/backend/postmaster/syslogger.c
index 8475bdbd88..e6577c944d 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.50 2009/03/18 08:44:49 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.51 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -368,7 +368,8 @@ SysLoggerMain(int argc, char *argv[])
* Wait for some data, timing out after 1 second
*/
FD_ZERO(&rfds);
- FD_SET(syslogPipe[0], &rfds);
+ FD_SET (syslogPipe[0], &rfds);
+
timeout.tv_sec = 1;
timeout.tv_usec = 0;
@@ -1194,7 +1195,7 @@ logfile_getname(pg_time_t timestamp, char *suffix)
/* treat it as a strftime pattern */
pg_strftime(filename + len, MAXPGPATH - len, Log_filename,
- pg_localtime(&timestamp, log_timezone));
+ pg_localtime(&timestamp, log_timezone));
if (suffix != NULL)
{
diff --git a/src/backend/postmaster/walwriter.c b/src/backend/postmaster/walwriter.c
index 414731ebc5..9e08a5b710 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.6 2009/05/15 15:56:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/walwriter.c,v 1.7 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -302,8 +302,8 @@ wal_quickdie(SIGNAL_ARGS)
* system reset cycle if some idiot DBA sends a manual SIGQUIT to a random
* backend. This is necessary precisely because we don't clean up our
* shared memory state. (The "dead man switch" mechanism in pmsignal.c
- * should ensure the postmaster sees this as a crash, too, but no harm
- * in being doubly sure.)
+ * should ensure the postmaster sees this as a crash, too, but no harm in
+ * being doubly sure.)
*/
exit(2);
}
diff --git a/src/backend/regex/regc_lex.c b/src/backend/regex/regc_lex.c
index d2fc591ed8..782c0085c2 100644
--- a/src/backend/regex/regc_lex.c
+++ b/src/backend/regex/regc_lex.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_lex.c,v 1.8 2008/02/14 17:33:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/regex/regc_lex.c,v 1.9 2009/06/11 14:49:01 momjian Exp $
*
*/
@@ -214,47 +214,47 @@ lexnest(struct vars * v,
/*
* string constants to interpolate as expansions of things like \d
*/
-static const chr backd[] = { /* \d */
+static const chr backd[] = { /* \d */
CHR('['), CHR('['), CHR(':'),
CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'),
CHR(':'), CHR(']'), CHR(']')
};
-static const chr backD[] = { /* \D */
+static const chr backD[] = { /* \D */
CHR('['), CHR('^'), CHR('['), CHR(':'),
CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'),
CHR(':'), CHR(']'), CHR(']')
};
-static const chr brbackd[] = { /* \d within brackets */
+static const chr brbackd[] = { /* \d within brackets */
CHR('['), CHR(':'),
CHR('d'), CHR('i'), CHR('g'), CHR('i'), CHR('t'),
CHR(':'), CHR(']')
};
-static const chr backs[] = { /* \s */
+static const chr backs[] = { /* \s */
CHR('['), CHR('['), CHR(':'),
CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'),
CHR(':'), CHR(']'), CHR(']')
};
-static const chr backS[] = { /* \S */
+static const chr backS[] = { /* \S */
CHR('['), CHR('^'), CHR('['), CHR(':'),
CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'),
CHR(':'), CHR(']'), CHR(']')
};
-static const chr brbacks[] = { /* \s within brackets */
+static const chr brbacks[] = { /* \s within brackets */
CHR('['), CHR(':'),
CHR('s'), CHR('p'), CHR('a'), CHR('c'), CHR('e'),
CHR(':'), CHR(']')
};
-static const chr backw[] = { /* \w */
+static const chr backw[] = { /* \w */
CHR('['), CHR('['), CHR(':'),
CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'),
CHR(':'), CHR(']'), CHR('_'), CHR(']')
};
-static const chr backW[] = { /* \W */
+static const chr backW[] = { /* \W */
CHR('['), CHR('^'), CHR('['), CHR(':'),
CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'),
CHR(':'), CHR(']'), CHR('_'), CHR(']')
};
-static const chr brbackw[] = { /* \w within brackets */
+static const chr brbackw[] = { /* \w within brackets */
CHR('['), CHR(':'),
CHR('a'), CHR('l'), CHR('n'), CHR('u'), CHR('m'),
CHR(':'), CHR(']'), CHR('_')
diff --git a/src/backend/regex/regc_nfa.c b/src/backend/regex/regc_nfa.c
index 4e307f5c15..ef56630173 100644
--- a/src/backend/regex/regc_nfa.c
+++ b/src/backend/regex/regc_nfa.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_nfa.c,v 1.6 2008/02/14 17:33:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/regex/regc_nfa.c,v 1.7 2009/06/11 14:49:01 momjian Exp $
*
*
* One or two things that technically ought to be in here
@@ -93,7 +93,7 @@ newnfa(struct vars * v,
* TooManyStates - checks if the max states exceeds the compile-time value
*/
static int
-TooManyStates(struct nfa *nfa)
+TooManyStates(struct nfa * nfa)
{
struct nfa *parent = nfa->parent;
size_t sz = nfa->size;
@@ -112,7 +112,7 @@ TooManyStates(struct nfa *nfa)
* IncrementSize - increases the tracked size of the NFA and its parents.
*/
static void
-IncrementSize(struct nfa *nfa)
+IncrementSize(struct nfa * nfa)
{
struct nfa *parent = nfa->parent;
@@ -128,7 +128,7 @@ IncrementSize(struct nfa *nfa)
* DecrementSize - decreases the tracked size of the NFA and its parents.
*/
static void
-DecrementSize(struct nfa *nfa)
+DecrementSize(struct nfa * nfa)
{
struct nfa *parent = nfa->parent;
@@ -856,7 +856,8 @@ pull(struct nfa * nfa,
/*
* DGP 2007-11-15: Cloning a state with a circular constraint on its list
- * of outs can lead to trouble [Tcl Bug 1810038], so get rid of them first.
+ * of outs can lead to trouble [Tcl Bug 1810038], so get rid of them
+ * first.
*/
for (a = from->outs; a != NULL; a = nexta)
{
@@ -998,12 +999,12 @@ push(struct nfa * nfa,
}
/*
- * DGP 2007-11-15: Here we duplicate the same protections as appear
- * in pull() above to avoid troubles with cloning a state with a
- * circular constraint on its list of ins. It is not clear whether
- * this is necessary, or is protecting against a "can't happen".
- * Any test case that actually leads to a freearc() call here would
- * be a welcome addition to the test suite.
+ * DGP 2007-11-15: Here we duplicate the same protections as appear in
+ * pull() above to avoid troubles with cloning a state with a circular
+ * constraint on its list of ins. It is not clear whether this is
+ * necessary, or is protecting against a "can't happen". Any test case
+ * that actually leads to a freearc() call here would be a welcome
+ * addition to the test suite.
*/
for (a = to->ins; a != NULL; a = nexta)
{
@@ -1143,7 +1144,7 @@ fixempties(struct nfa * nfa,
{
progress = 0;
for (s = nfa->states; s != NULL && !NISERR() &&
- s->no != FREESTATE; s = nexts)
+ s->no != FREESTATE; s = nexts)
{
nexts = s->next;
for (a = s->outs; a != NULL && !NISERR(); a = nexta)
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index b1f8c6e3ff..77a889412f 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.137 2009/05/13 22:32:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.138 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -120,7 +120,7 @@ InsertRule(char *rulname,
replaces[Anum_pg_rewrite_ev_action - 1] = true;
tup = heap_modify_tuple(oldtup, RelationGetDescr(pg_rewrite_desc),
- values, nulls, replaces);
+ values, nulls, replaces);
simple_heap_update(pg_rewrite_desc, &tup->t_self, tup);
@@ -388,9 +388,9 @@ DefineQueryRewrite(char *rulename,
*
* If so, check that the relation is empty because the storage for the
* relation is going to be deleted. Also insist that the rel not have
- * any triggers, indexes, or child tables. (Note: these tests are
- * too strict, because they will reject relations that once had such
- * but don't anymore. But we don't really care, because this whole
+ * any triggers, indexes, or child tables. (Note: these tests are too
+ * strict, because they will reject relations that once had such but
+ * don't anymore. But we don't really care, because this whole
* business of converting relations to views is just a kluge to allow
* loading ancient pg_dump files.)
*/
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index 336ae829ce..c1233b6357 100644
--- a/src/backend/rewrite/rewriteHandler.c
+++ b/src/backend/rewrite/rewriteHandler.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.185 2009/01/27 12:40:15 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteHandler.c,v 1.186 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -381,7 +381,7 @@ rewriteRuleAction(Query *parsetree,
break;
}
if (sub_action->hasSubLinks)
- break; /* no need to keep scanning rtable */
+ break; /* no need to keep scanning rtable */
}
}
@@ -501,7 +501,7 @@ rewriteRuleAction(Query *parsetree,
*/
if (parsetree->hasSubLinks && !rule_action->hasSubLinks)
rule_action->hasSubLinks =
- checkExprHasSubLink((Node *) rule_action->returningList);
+ checkExprHasSubLink((Node *) rule_action->returningList);
}
return rule_action;
@@ -1261,7 +1261,7 @@ markQueryForLocking(Query *qry, Node *jtnode, bool forUpdate, bool noWait)
if (strcmp(cte->ctename, rte->ctename) == 0)
break;
}
- if (lc == NULL) /* shouldn't happen */
+ if (lc == NULL) /* shouldn't happen */
elog(ERROR, "could not find CTE \"%s\"", rte->ctename);
/* should be analyzed by now */
Assert(IsA(cte->ctequery, Query));
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c
index 72cddaaa34..570434ed83 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.121 2009/02/25 03:30:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.122 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,12 +40,12 @@ typedef struct
} locate_windowfunc_context;
static bool contain_aggs_of_level_walker(Node *node,
- contain_aggs_of_level_context *context);
+ contain_aggs_of_level_context *context);
static bool locate_agg_of_level_walker(Node *node,
- locate_agg_of_level_context *context);
+ locate_agg_of_level_context *context);
static bool contain_windowfuncs_walker(Node *node, void *context);
static bool locate_windowfunc_walker(Node *node,
- locate_windowfunc_context *context);
+ locate_windowfunc_context *context);
static bool checkExprHasSubLink_walker(Node *node, void *context);
static Relids offset_relid_set(Relids relids, int offset);
static Relids adjust_relid_set(Relids relids, int oldrelid, int newrelid);
@@ -68,7 +68,7 @@ checkExprHasAggs(Node *node)
* specified query level.
*
* The objective of this routine is to detect whether there are aggregates
- * belonging to the given query level. Aggregates belonging to subqueries
+ * belonging to the given query level. Aggregates belonging to subqueries
* or outer queries do NOT cause a true result. We must recurse into
* subqueries to detect outer-reference aggregates that logically belong to
* the specified query level.
@@ -123,7 +123,7 @@ contain_aggs_of_level_walker(Node *node,
* Find the parse location of any aggregate of the specified query level.
*
* Returns -1 if no such agg is in the querytree, or if they all have
- * unknown parse location. (The former case is probably caller error,
+ * unknown parse location. (The former case is probably caller error,
* but we don't bother to distinguish it from the latter case.)
*
* Note: it might seem appropriate to merge this functionality into
@@ -136,7 +136,7 @@ locate_agg_of_level(Node *node, int levelsup)
{
locate_agg_of_level_context context;
- context.agg_location = -1; /* in case we find nothing */
+ context.agg_location = -1; /* in case we find nothing */
context.sublevels_up = levelsup;
/*
@@ -207,7 +207,7 @@ contain_windowfuncs_walker(Node *node, void *context)
if (node == NULL)
return false;
if (IsA(node, WindowFunc))
- return true; /* abort the tree traversal and return true */
+ return true; /* abort the tree traversal and return true */
/* Mustn't recurse into subselects */
return expression_tree_walker(node, contain_windowfuncs_walker,
(void *) context);
@@ -218,7 +218,7 @@ contain_windowfuncs_walker(Node *node, void *context)
* Find the parse location of any windowfunc of the current query level.
*
* Returns -1 if no such windowfunc is in the querytree, or if they all have
- * unknown parse location. (The former case is probably caller error,
+ * unknown parse location. (The former case is probably caller error,
* but we don't bother to distinguish it from the latter case.)
*
* Note: it might seem appropriate to merge this functionality into
@@ -231,7 +231,7 @@ locate_windowfunc(Node *node)
{
locate_windowfunc_context context;
- context.win_location = -1; /* in case we find nothing */
+ context.win_location = -1; /* in case we find nothing */
/*
* Must be prepared to start with a Query or a bare expression tree; if
@@ -1169,7 +1169,7 @@ ResolveNew_mutator(Node *node, ResolveNew_context *context)
* If generating an expansion for a var of a named rowtype
* (ie, this is a plain relation RTE), then we must include
* dummy items for dropped columns. If the var is RECORD (ie,
- * this is a JOIN), then omit dropped columns. Either way,
+ * this is a JOIN), then omit dropped columns. Either way,
* attach column names to the RowExpr for use of ruleutils.c.
*/
expandRTE(context->target_rte,
diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c
index a7b4413e3e..f40b207718 100644
--- a/src/backend/rewrite/rewriteRemove.c
+++ b/src/backend/rewrite/rewriteRemove.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.77 2009/01/27 12:40:15 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.78 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -126,9 +126,9 @@ RemoveRewriteRuleById(Oid ruleOid)
elog(ERROR, "could not find tuple for rule %u", ruleOid);
/*
- * We had better grab AccessExclusiveLock to ensure that no queries
- * are going on that might depend on this rule. (Note: a weaker lock
- * would suffice if it's not an ON SELECT rule.)
+ * We had better grab AccessExclusiveLock to ensure that no queries are
+ * going on that might depend on this rule. (Note: a weaker lock would
+ * suffice if it's not an ON SELECT rule.)
*/
eventRelationOid = ((Form_pg_rewrite) GETSTRUCT(tuple))->ev_class;
event_relation = heap_open(eventRelationOid, AccessExclusiveLock);
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index da5f8a7414..be4c86bd38 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.251 2009/04/03 18:17:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/bufmgr.c,v 1.252 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -81,9 +81,9 @@ static volatile BufferDesc *PinCountWaitBuf = NULL;
static Buffer ReadBuffer_common(SMgrRelation reln, bool isLocalBuf,
- ForkNumber forkNum, BlockNumber blockNum,
- ReadBufferMode mode , BufferAccessStrategy strategy,
- bool *hit);
+ ForkNumber forkNum, BlockNumber blockNum,
+ ReadBufferMode mode, BufferAccessStrategy strategy,
+ bool *hit);
static bool PinBuffer(volatile BufferDesc *buf, BufferAccessStrategy strategy);
static void PinBuffer_Locked(volatile BufferDesc *buf);
static void UnpinBuffer(volatile BufferDesc *buf, bool fixOwner);
@@ -106,7 +106,7 @@ static void AtProcExit_Buffers(int code, Datum arg);
* PrefetchBuffer -- initiate asynchronous read of a block of a relation
*
* This is named by analogy to ReadBuffer but doesn't actually allocate a
- * buffer. Instead it tries to ensure that a future ReadBuffer for the given
+ * buffer. Instead it tries to ensure that a future ReadBuffer for the given
* block will not be delayed by the I/O. Prefetching is optional.
* No-op if prefetching isn't compiled in.
*/
@@ -126,16 +126,16 @@ PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum)
if (RELATION_IS_OTHER_TEMP(reln))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot access temporary tables of other sessions")));
+ errmsg("cannot access temporary tables of other sessions")));
/* pass it off to localbuf.c */
LocalPrefetchBuffer(reln->rd_smgr, forkNum, blockNum);
}
else
{
- BufferTag newTag; /* identity of requested block */
- uint32 newHash; /* hash value for newTag */
- LWLockId newPartitionLock; /* buffer partition lock for it */
+ BufferTag newTag; /* identity of requested block */
+ uint32 newHash; /* hash value for newTag */
+ LWLockId newPartitionLock; /* buffer partition lock for it */
int buf_id;
/* create a tag so we can lookup the buffer */
@@ -156,17 +156,17 @@ PrefetchBuffer(Relation reln, ForkNumber forkNum, BlockNumber blockNum)
/*
* If the block *is* in buffers, we do nothing. This is not really
- * ideal: the block might be just about to be evicted, which would
- * be stupid since we know we are going to need it soon. But the
- * only easy answer is to bump the usage_count, which does not seem
- * like a great solution: when the caller does ultimately touch the
- * block, usage_count would get bumped again, resulting in too much
- * favoritism for blocks that are involved in a prefetch sequence.
- * A real fix would involve some additional per-buffer state, and
- * it's not clear that there's enough of a problem to justify that.
+ * ideal: the block might be just about to be evicted, which would be
+ * stupid since we know we are going to need it soon. But the only
+ * easy answer is to bump the usage_count, which does not seem like a
+ * great solution: when the caller does ultimately touch the block,
+ * usage_count would get bumped again, resulting in too much
+ * favoritism for blocks that are involved in a prefetch sequence. A
+ * real fix would involve some additional per-buffer state, and it's
+ * not clear that there's enough of a problem to justify that.
*/
}
-#endif /* USE_PREFETCH */
+#endif /* USE_PREFETCH */
}
@@ -202,7 +202,7 @@ ReadBuffer(Relation reln, BlockNumber blockNum)
* for non-critical data, where the caller is prepared to repair errors.
*
* In RBM_ZERO mode, if the page isn't in buffer cache already, it's filled
- * with zeros instead of reading it from disk. Useful when the caller is
+ * with zeros instead of reading it from disk. Useful when the caller is
* going to fill the page from scratch, since this saves I/O and avoids
* unnecessary failure if the page-on-disk has corrupt page headers.
* Caution: do not use this mode to read a page that is beyond the relation's
@@ -216,16 +216,16 @@ Buffer
ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum,
ReadBufferMode mode, BufferAccessStrategy strategy)
{
- bool hit;
- Buffer buf;
+ bool hit;
+ Buffer buf;
/* Open it at the smgr level if not already done */
RelationOpenSmgr(reln);
/*
- * Reject attempts to read non-local temporary relations; we would
- * be likely to get wrong data since we have no visibility into the
- * owning session's local buffers.
+ * Reject attempts to read non-local temporary relations; we would be
+ * likely to get wrong data since we have no visibility into the owning
+ * session's local buffers.
*/
if (RELATION_IS_OTHER_TEMP(reln))
ereport(ERROR,
@@ -233,8 +233,8 @@ ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum,
errmsg("cannot access temporary tables of other sessions")));
/*
- * Read the buffer, and update pgstat counters to reflect a cache
- * hit or miss.
+ * Read the buffer, and update pgstat counters to reflect a cache hit or
+ * miss.
*/
pgstat_count_buffer_read(reln);
buf = ReadBuffer_common(reln->rd_smgr, reln->rd_istemp, forkNum, blockNum,
@@ -256,9 +256,10 @@ ReadBufferWithoutRelcache(RelFileNode rnode, bool isTemp,
ForkNumber forkNum, BlockNumber blockNum,
ReadBufferMode mode, BufferAccessStrategy strategy)
{
- bool hit;
+ bool hit;
SMgrRelation smgr = smgropen(rnode);
+
return ReadBuffer_common(smgr, isTemp, forkNum, blockNum, mode, strategy,
&hit);
}
@@ -357,9 +358,9 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
bufBlock = isLocalBuf ? LocalBufHdrGetBlock(bufHdr) : BufHdrGetBlock(bufHdr);
if (!PageIsNew((Page) bufBlock))
ereport(ERROR,
- (errmsg("unexpected data beyond EOF in block %u of relation %s",
- blockNum, relpath(smgr->smgr_rnode, forkNum)),
- errhint("This has been seen to occur with buggy kernels; consider updating your system.")));
+ (errmsg("unexpected data beyond EOF in block %u of relation %s",
+ blockNum, relpath(smgr->smgr_rnode, forkNum)),
+ errhint("This has been seen to occur with buggy kernels; consider updating your system.")));
/*
* We *must* do smgrextend before succeeding, else the page will not
@@ -439,9 +440,9 @@ ReadBuffer_common(SMgrRelation smgr, bool isLocalBuf, ForkNumber forkNum,
else
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
- errmsg("invalid page header in block %u of relation %s",
- blockNum,
- relpath(smgr->smgr_rnode, forkNum))));
+ errmsg("invalid page header in block %u of relation %s",
+ blockNum,
+ relpath(smgr->smgr_rnode, forkNum))));
}
}
}
@@ -631,17 +632,17 @@ BufferAlloc(SMgrRelation smgr, ForkNumber forkNum,
/* OK, do the I/O */
TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_START(forkNum, blockNum,
- smgr->smgr_rnode.spcNode,
- smgr->smgr_rnode.dbNode,
- smgr->smgr_rnode.relNode);
+ smgr->smgr_rnode.spcNode,
+ smgr->smgr_rnode.dbNode,
+ smgr->smgr_rnode.relNode);
FlushBuffer(buf, NULL);
LWLockRelease(buf->content_lock);
TRACE_POSTGRESQL_BUFFER_WRITE_DIRTY_DONE(forkNum, blockNum,
- smgr->smgr_rnode.spcNode,
+ smgr->smgr_rnode.spcNode,
smgr->smgr_rnode.dbNode,
- smgr->smgr_rnode.relNode);
+ smgr->smgr_rnode.relNode);
}
else
{
@@ -983,7 +984,7 @@ ReleaseAndReadBuffer(Buffer buffer,
Relation relation,
BlockNumber blockNum)
{
- ForkNumber forkNum = MAIN_FORKNUM;
+ ForkNumber forkNum = MAIN_FORKNUM;
volatile BufferDesc *bufHdr;
if (BufferIsValid(buffer))
@@ -2708,7 +2709,8 @@ AbortBufferIO(void)
if (sv_flags & BM_IO_ERROR)
{
/* Buffer is pinned, so we can read tag without spinlock */
- char *path = relpath(buf->tag.rnode, buf->tag.forkNum);
+ char *path = relpath(buf->tag.rnode, buf->tag.forkNum);
+
ereport(WARNING,
(errcode(ERRCODE_IO_ERROR),
errmsg("could not write block %u of %s",
@@ -2732,7 +2734,8 @@ buffer_write_error_callback(void *arg)
/* Buffer is pinned, so we can read the tag without locking the spinlock */
if (bufHdr != NULL)
{
- char *path = relpath(bufHdr->tag.rnode, bufHdr->tag.forkNum);
+ char *path = relpath(bufHdr->tag.rnode, bufHdr->tag.forkNum);
+
errcontext("writing block %u of relation %s",
bufHdr->tag.blockNum, path);
pfree(path);
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index 5431419cfe..3caa42a1a6 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.86 2009/01/12 05:10:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/buffer/localbuf.c,v 1.87 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -85,7 +85,7 @@ LocalPrefetchBuffer(SMgrRelation smgr, ForkNumber forkNum,
/* Not in buffers, so initiate prefetch */
smgrprefetch(smgr, forkNum, blockNum);
-#endif /* USE_PREFETCH */
+#endif /* USE_PREFETCH */
}
@@ -149,7 +149,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
#ifdef LBDEBUG
fprintf(stderr, "LB ALLOC (%u,%d,%d) %d\n",
- smgr->smgr_rnode.relNode, forkNum, blockNum, -nextFreeLocalBuf - 1);
+ smgr->smgr_rnode.relNode, forkNum, blockNum, -nextFreeLocalBuf - 1);
#endif
/*
diff --git a/src/backend/storage/file/buffile.c b/src/backend/storage/file/buffile.c
index 3779a28d3d..9516c88acd 100644
--- a/src/backend/storage/file/buffile.c
+++ b/src/backend/storage/file/buffile.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.33 2009/01/01 17:23:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/file/buffile.c,v 1.34 2009/06/11 14:49:01 momjian Exp $
*
* NOTES:
*
@@ -125,7 +125,7 @@ extendBufFile(BufFile *file)
file->files = (File *) repalloc(file->files,
(file->numFiles + 1) * sizeof(File));
file->offsets = (off_t *) repalloc(file->offsets,
- (file->numFiles + 1) * sizeof(off_t));
+ (file->numFiles + 1) * sizeof(off_t));
file->files[file->numFiles] = pfile;
file->offsets[file->numFiles] = 0L;
file->numFiles++;
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 7749d5a405..e0742701f1 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.148 2009/03/04 09:12:49 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/file/fd.c,v 1.149 2009/06/11 14:49:01 momjian Exp $
*
* NOTES:
*
@@ -128,13 +128,13 @@ static int max_safe_fds = 32; /* default if not changed */
* Flag to tell whether it's worth scanning VfdCache looking for temp files to
* close
*/
-static bool have_xact_temporary_files = false;
+static bool have_xact_temporary_files = false;
typedef struct vfd
{
int fd; /* current FD, or VFD_CLOSED if none */
unsigned short fdstate; /* bitflags for VFD's state */
- SubTransactionId create_subid; /* for TEMPORARY fds, creating subxact */
+ SubTransactionId create_subid; /* for TEMPORARY fds, creating subxact */
File nextFree; /* link to next free VFD, if in freelist */
File lruMoreRecently; /* doubly linked recency-of-use list */
File lruLessRecently;
@@ -364,6 +364,7 @@ count_usable_fds(int max_to_probe, int *usable_fds, int *already_open)
int used = 0;
int highestfd = 0;
int j;
+
#ifdef HAVE_GETRLIMIT
struct rlimit rlim;
int getrlimit_status;
@@ -373,14 +374,14 @@ count_usable_fds(int max_to_probe, int *usable_fds, int *already_open)
fd = (int *) palloc(size * sizeof(int));
#ifdef HAVE_GETRLIMIT
-# ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */
+#ifdef RLIMIT_NOFILE /* most platforms use RLIMIT_NOFILE */
getrlimit_status = getrlimit(RLIMIT_NOFILE, &rlim);
-# else /* but BSD doesn't ... */
+#else /* but BSD doesn't ... */
getrlimit_status = getrlimit(RLIMIT_OFILE, &rlim);
-# endif /* RLIMIT_NOFILE */
+#endif /* RLIMIT_NOFILE */
if (getrlimit_status != 0)
ereport(WARNING, (errmsg("getrlimit failed: %m")));
-#endif /* HAVE_GETRLIMIT */
+#endif /* HAVE_GETRLIMIT */
/* dup until failure or probe limit reached */
for (;;)
@@ -388,7 +389,11 @@ count_usable_fds(int max_to_probe, int *usable_fds, int *already_open)
int thisfd;
#ifdef HAVE_GETRLIMIT
- /* don't go beyond RLIMIT_NOFILE; causes irritating kernel logs on some platforms */
+
+ /*
+ * don't go beyond RLIMIT_NOFILE; causes irritating kernel logs on
+ * some platforms
+ */
if (getrlimit_status == 0 && highestfd >= rlim.rlim_cur - 1)
break;
#endif
@@ -1069,7 +1074,7 @@ FilePrefetch(File file, off_t offset, int amount)
int returnCode;
Assert(FileIsValid(file));
-
+
DO_DB(elog(LOG, "FilePrefetch: %d (%s) " INT64_FORMAT " %d",
file, VfdCache[file].fileName,
(int64) offset, amount));
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c
index 558c56f80d..f61c5143ba 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -8,16 +8,16 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/freespace/freespace.c,v 1.72 2009/01/20 18:59:37 heikki Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/freespace/freespace.c,v 1.73 2009/06/11 14:49:01 momjian Exp $
*
*
* NOTES:
*
- * Free Space Map keeps track of the amount of free space on pages, and
- * allows quickly searching for a page with enough free space. The FSM is
- * stored in a dedicated relation fork of all heap relations, and those
- * index access methods that need it (see also indexfsm.c). See README for
- * more information.
+ * Free Space Map keeps track of the amount of free space on pages, and
+ * allows quickly searching for a page with enough free space. The FSM is
+ * stored in a dedicated relation fork of all heap relations, and those
+ * index access methods that need it (see also indexfsm.c). See README for
+ * more information.
*
*-------------------------------------------------------------------------
*/
@@ -49,10 +49,10 @@
* look like this
*
*
- * Range Category
- * 0 - 31 0
- * 32 - 63 1
- * ... ... ...
+ * Range Category
+ * 0 - 31 0
+ * 32 - 63 1
+ * ... ... ...
* 8096 - 8127 253
* 8128 - 8163 254
* 8164 - 8192 255
@@ -86,12 +86,12 @@
*/
typedef struct
{
- int level; /* level */
- int logpageno; /* page number within the level */
+ int level; /* level */
+ int logpageno; /* page number within the level */
} FSMAddress;
/* Address of the root page. */
-static const FSMAddress FSM_ROOT_ADDRESS = { FSM_ROOT_LEVEL, 0 };
+static const FSMAddress FSM_ROOT_ADDRESS = {FSM_ROOT_LEVEL, 0};
/* functions to navigate the tree */
static FSMAddress fsm_get_child(FSMAddress parent, uint16 slot);
@@ -106,11 +106,11 @@ static void fsm_extend(Relation rel, BlockNumber fsm_nblocks);
/* functions to convert amount of free space to a FSM category */
static uint8 fsm_space_avail_to_cat(Size avail);
static uint8 fsm_space_needed_to_cat(Size needed);
-static Size fsm_space_cat_to_avail(uint8 cat);
+static Size fsm_space_cat_to_avail(uint8 cat);
/* workhorse functions for various operations */
static int fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot,
- uint8 newValue, uint8 minValue);
+ uint8 newValue, uint8 minValue);
static BlockNumber fsm_search(Relation rel, uint8 min_cat);
static uint8 fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof);
@@ -133,7 +133,8 @@ static uint8 fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof);
BlockNumber
GetPageWithFreeSpace(Relation rel, Size spaceNeeded)
{
- uint8 min_cat = fsm_space_needed_to_cat(spaceNeeded);
+ uint8 min_cat = fsm_space_needed_to_cat(spaceNeeded);
+
return fsm_search(rel, min_cat);
}
@@ -259,7 +260,7 @@ GetRecordedFreeSpace(Relation rel, BlockNumber heapBlk)
void
FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks)
{
- BlockNumber new_nfsmblocks;
+ BlockNumber new_nfsmblocks;
FSMAddress first_removed_address;
uint16 first_removed_slot;
Buffer buf;
@@ -278,15 +279,15 @@ FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks)
/*
* Zero out the tail of the last remaining FSM page. If the slot
- * representing the first removed heap block is at a page boundary, as
- * the first slot on the FSM page that first_removed_address points to,
- * we can just truncate that page altogether.
+ * representing the first removed heap block is at a page boundary, as the
+ * first slot on the FSM page that first_removed_address points to, we can
+ * just truncate that page altogether.
*/
if (first_removed_slot > 0)
{
buf = fsm_readbuf(rel, first_removed_address, false);
if (!BufferIsValid(buf))
- return; /* nothing to do; the FSM was already smaller */
+ return; /* nothing to do; the FSM was already smaller */
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
fsm_truncate_avail(BufferGetPage(buf), first_removed_slot);
MarkBufferDirty(buf);
@@ -298,15 +299,15 @@ FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks)
{
new_nfsmblocks = fsm_logical_to_physical(first_removed_address);
if (smgrnblocks(rel->rd_smgr, FSM_FORKNUM) <= new_nfsmblocks)
- return; /* nothing to do; the FSM was already smaller */
+ return; /* nothing to do; the FSM was already smaller */
}
/* Truncate the unused FSM pages */
smgrtruncate(rel->rd_smgr, FSM_FORKNUM, new_nfsmblocks, rel->rd_istemp);
/*
- * Need to invalidate the relcache entry, because rd_fsm_nblocks
- * seen by other backends is no longer valid.
+ * Need to invalidate the relcache entry, because rd_fsm_nblocks seen by
+ * other backends is no longer valid.
*/
if (!InRecovery)
CacheInvalidateRelcache(rel);
@@ -320,7 +321,7 @@ FreeSpaceMapTruncateRel(Relation rel, BlockNumber nblocks)
void
FreeSpaceMapVacuum(Relation rel)
{
- bool dummy;
+ bool dummy;
/*
* Traverse the tree in depth-first order. The tree is stored physically
@@ -337,7 +338,7 @@ FreeSpaceMapVacuum(Relation rel)
static uint8
fsm_space_avail_to_cat(Size avail)
{
- int cat;
+ int cat;
Assert(avail < BLCKSZ);
@@ -377,12 +378,12 @@ fsm_space_cat_to_avail(uint8 cat)
static uint8
fsm_space_needed_to_cat(Size needed)
{
- int cat;
+ int cat;
/* Can't ask for more space than the highest category represents */
if (needed > MaxFSMRequestSize)
- elog(ERROR, "invalid FSM request size %lu",
- (unsigned long) needed);
+ elog(ERROR, "invalid FSM request size %lu",
+ (unsigned long) needed);
if (needed == 0)
return 1;
@@ -402,8 +403,8 @@ static BlockNumber
fsm_logical_to_physical(FSMAddress addr)
{
BlockNumber pages;
- int leafno;
- int l;
+ int leafno;
+ int l;
/*
* Calculate the logical page number of the first leaf page below the
@@ -422,8 +423,8 @@ fsm_logical_to_physical(FSMAddress addr)
}
/*
- * If the page we were asked for wasn't at the bottom level, subtract
- * the additional lower level pages we counted above.
+ * If the page we were asked for wasn't at the bottom level, subtract the
+ * additional lower level pages we counted above.
*/
pages -= addr.level;
@@ -437,7 +438,7 @@ fsm_logical_to_physical(FSMAddress addr)
static FSMAddress
fsm_get_location(BlockNumber heapblk, uint16 *slot)
{
- FSMAddress addr;
+ FSMAddress addr;
addr.level = FSM_BOTTOM_LEVEL;
addr.logpageno = heapblk / SlotsPerFSMPage;
@@ -463,7 +464,7 @@ fsm_get_heap_blk(FSMAddress addr, uint16 slot)
static FSMAddress
fsm_get_parent(FSMAddress child, uint16 *slot)
{
- FSMAddress parent;
+ FSMAddress parent;
Assert(child.level < FSM_ROOT_LEVEL);
@@ -481,7 +482,7 @@ fsm_get_parent(FSMAddress child, uint16 *slot)
static FSMAddress
fsm_get_child(FSMAddress parent, uint16 slot)
{
- FSMAddress child;
+ FSMAddress child;
Assert(parent.level > FSM_BOTTOM_LEVEL);
@@ -501,7 +502,7 @@ static Buffer
fsm_readbuf(Relation rel, FSMAddress addr, bool extend)
{
BlockNumber blkno = fsm_logical_to_physical(addr);
- Buffer buf;
+ Buffer buf;
RelationOpenSmgr(rel);
@@ -545,20 +546,20 @@ static void
fsm_extend(Relation rel, BlockNumber fsm_nblocks)
{
BlockNumber fsm_nblocks_now;
- Page pg;
+ Page pg;
pg = (Page) palloc(BLCKSZ);
PageInit(pg, BLCKSZ, 0);
/*
- * We use the relation extension lock to lock out other backends
- * trying to extend the FSM at the same time. It also locks out
- * extension of the main fork, unnecessarily, but extending the
- * FSM happens seldom enough that it doesn't seem worthwhile to
- * have a separate lock tag type for it.
+ * We use the relation extension lock to lock out other backends trying to
+ * extend the FSM at the same time. It also locks out extension of the
+ * main fork, unnecessarily, but extending the FSM happens seldom enough
+ * that it doesn't seem worthwhile to have a separate lock tag type for
+ * it.
*
- * Note that another backend might have extended or created the
- * relation before we get the lock.
+ * Note that another backend might have extended or created the relation
+ * before we get the lock.
*/
LockRelationForExtension(rel, ExclusiveLock);
@@ -631,14 +632,14 @@ fsm_set_and_search(Relation rel, FSMAddress addr, uint16 slot,
static BlockNumber
fsm_search(Relation rel, uint8 min_cat)
{
- int restarts = 0;
- FSMAddress addr = FSM_ROOT_ADDRESS;
+ int restarts = 0;
+ FSMAddress addr = FSM_ROOT_ADDRESS;
for (;;)
{
- int slot;
- Buffer buf;
- uint8 max_avail = 0;
+ int slot;
+ Buffer buf;
+ uint8 max_avail = 0;
/* Read the FSM page. */
buf = fsm_readbuf(rel, addr, false);
@@ -678,8 +679,8 @@ fsm_search(Relation rel, uint8 min_cat)
}
else
{
- uint16 parentslot;
- FSMAddress parent;
+ uint16 parentslot;
+ FSMAddress parent;
/*
* At lower level, failure can happen if the value in the upper-
@@ -697,11 +698,11 @@ fsm_search(Relation rel, uint8 min_cat)
fsm_set_and_search(rel, parent, parentslot, max_avail, 0);
/*
- * If the upper pages are badly out of date, we might need to
- * loop quite a few times, updating them as we go. Any
- * inconsistencies should eventually be corrected and the loop
- * should end. Looping indefinitely is nevertheless scary, so
- * provide an emergency valve.
+ * If the upper pages are badly out of date, we might need to loop
+ * quite a few times, updating them as we go. Any inconsistencies
+ * should eventually be corrected and the loop should end. Looping
+ * indefinitely is nevertheless scary, so provide an emergency
+ * valve.
*/
if (restarts++ > 10000)
return InvalidBlockNumber;
@@ -719,9 +720,9 @@ fsm_search(Relation rel, uint8 min_cat)
static uint8
fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof_p)
{
- Buffer buf;
- Page page;
- uint8 max_avail;
+ Buffer buf;
+ Page page;
+ uint8 max_avail;
/* Read the page if it exists, or return EOF */
buf = fsm_readbuf(rel, addr, false);
@@ -736,17 +737,17 @@ fsm_vacuum_page(Relation rel, FSMAddress addr, bool *eof_p)
page = BufferGetPage(buf);
/*
- * Recurse into children, and fix the information stored about them
- * at this level.
+ * Recurse into children, and fix the information stored about them at
+ * this level.
*/
if (addr.level > FSM_BOTTOM_LEVEL)
{
- int slot;
- bool eof = false;
+ int slot;
+ bool eof = false;
for (slot = 0; slot < SlotsPerFSMPage; slot++)
{
- int child_avail;
+ int child_avail;
/* After we hit end-of-file, just clear the rest of the slots */
if (!eof)
diff --git a/src/backend/storage/freespace/fsmpage.c b/src/backend/storage/freespace/fsmpage.c
index 13fe0015a1..e8feaf0aa2 100644
--- a/src/backend/storage/freespace/fsmpage.c
+++ b/src/backend/storage/freespace/fsmpage.c
@@ -8,15 +8,15 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/freespace/fsmpage.c,v 1.4 2009/01/01 17:23:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/freespace/fsmpage.c,v 1.5 2009/06/11 14:49:01 momjian Exp $
*
* NOTES:
*
- * The public functions in this file form an API that hides the internal
- * structure of a FSM page. This allows freespace.c to treat each FSM page
- * as a black box with SlotsPerPage "slots". fsm_set_avail() and
- * fsm_get_avail() let you get/set the value of a slot, and
- * fsm_search_avail() lets you search for a slot with value >= X.
+ * The public functions in this file form an API that hides the internal
+ * structure of a FSM page. This allows freespace.c to treat each FSM page
+ * as a black box with SlotsPerPage "slots". fsm_set_avail() and
+ * fsm_get_avail() let you get/set the value of a slot, and
+ * fsm_search_avail() lets you search for a slot with value >= X.
*
*-------------------------------------------------------------------------
*/
@@ -43,9 +43,9 @@ rightneighbor(int x)
x++;
/*
- * Check if we stepped to the leftmost node at next level, and correct
- * if so. The leftmost nodes at each level are numbered x = 2^level - 1,
- * so check if (x + 1) is a power of two, using a standard
+ * Check if we stepped to the leftmost node at next level, and correct if
+ * so. The leftmost nodes at each level are numbered x = 2^level - 1, so
+ * check if (x + 1) is a power of two, using a standard
* twos-complement-arithmetic trick.
*/
if (((x + 1) & x) == 0)
@@ -62,9 +62,9 @@ rightneighbor(int x)
bool
fsm_set_avail(Page page, int slot, uint8 value)
{
- int nodeno = NonLeafNodesPerPage + slot;
- FSMPage fsmpage = (FSMPage) PageGetContents(page);
- uint8 oldvalue;
+ int nodeno = NonLeafNodesPerPage + slot;
+ FSMPage fsmpage = (FSMPage) PageGetContents(page);
+ uint8 oldvalue;
Assert(slot < LeafNodesPerPage);
@@ -77,14 +77,14 @@ fsm_set_avail(Page page, int slot, uint8 value)
fsmpage->fp_nodes[nodeno] = value;
/*
- * Propagate up, until we hit the root or a node that doesn't
- * need to be updated.
+ * Propagate up, until we hit the root or a node that doesn't need to be
+ * updated.
*/
do
{
- uint8 newvalue = 0;
- int lchild;
- int rchild;
+ uint8 newvalue = 0;
+ int lchild;
+ int rchild;
nodeno = parentof(nodeno);
lchild = leftchild(nodeno);
@@ -103,8 +103,8 @@ fsm_set_avail(Page page, int slot, uint8 value)
} while (nodeno > 0);
/*
- * sanity check: if the new value is (still) higher than the value
- * at the top, the tree is corrupt. If so, rebuild.
+ * sanity check: if the new value is (still) higher than the value at the
+ * top, the tree is corrupt. If so, rebuild.
*/
if (value > fsmpage->fp_nodes[0])
fsm_rebuild_page(page);
@@ -121,7 +121,7 @@ fsm_set_avail(Page page, int slot, uint8 value)
uint8
fsm_get_avail(Page page, int slot)
{
- FSMPage fsmpage = (FSMPage) PageGetContents(page);
+ FSMPage fsmpage = (FSMPage) PageGetContents(page);
Assert(slot < LeafNodesPerPage);
@@ -137,7 +137,7 @@ fsm_get_avail(Page page, int slot)
uint8
fsm_get_max_avail(Page page)
{
- FSMPage fsmpage = (FSMPage) PageGetContents(page);
+ FSMPage fsmpage = (FSMPage) PageGetContents(page);
return fsmpage->fp_nodes[0];
}
@@ -158,16 +158,17 @@ int
fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext,
bool exclusive_lock_held)
{
- Page page = BufferGetPage(buf);
- FSMPage fsmpage = (FSMPage) PageGetContents(page);
- int nodeno;
- int target;
- uint16 slot;
+ Page page = BufferGetPage(buf);
+ FSMPage fsmpage = (FSMPage) PageGetContents(page);
+ int nodeno;
+ int target;
+ uint16 slot;
+
+restart:
- restart:
/*
- * Check the root first, and exit quickly if there's no leaf with
- * enough free space
+ * Check the root first, and exit quickly if there's no leaf with enough
+ * free space
*/
if (fsmpage->fp_nodes[0] < minvalue)
return -1;
@@ -184,13 +185,13 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext,
/*----------
* Start the search from the target slot. At every step, move one
- * node to the right, then climb up to the parent. Stop when we reach
+ * node to the right, then climb up to the parent. Stop when we reach
* a node with enough free space (as we must, since the root has enough
* space).
*
* The idea is to gradually expand our "search triangle", that is, all
* nodes covered by the current node, and to be sure we search to the
- * right from the start point. At the first step, only the target slot
+ * right from the start point. At the first step, only the target slot
* is examined. When we move up from a left child to its parent, we are
* adding the right-hand subtree of that parent to the search triangle.
* When we move right then up from a right child, we are dropping the
@@ -207,11 +208,11 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext,
*
* For example, consider this tree:
*
- * 7
- * 7 6
- * 5 7 6 5
- * 4 5 5 7 2 6 5 2
- * T
+ * 7
+ * 7 6
+ * 5 7 6 5
+ * 4 5 5 7 2 6 5 2
+ * T
*
* Assume that the target node is the node indicated by the letter T,
* and we're searching for a node with value of 6 or higher. The search
@@ -230,8 +231,8 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext,
break;
/*
- * Move to the right, wrapping around on same level if necessary,
- * then climb up.
+ * Move to the right, wrapping around on same level if necessary, then
+ * climb up.
*/
nodeno = parentof(rightneighbor(nodeno));
}
@@ -243,7 +244,7 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext,
*/
while (nodeno < NonLeafNodesPerPage)
{
- int childnodeno = leftchild(nodeno);
+ int childnodeno = leftchild(nodeno);
if (childnodeno < NodesPerPage &&
fsmpage->fp_nodes[childnodeno] >= minvalue)
@@ -260,17 +261,16 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext,
else
{
/*
- * Oops. The parent node promised that either left or right
- * child has enough space, but neither actually did. This can
- * happen in case of a "torn page", IOW if we crashed earlier
- * while writing the page to disk, and only part of the page
- * made it to disk.
+ * Oops. The parent node promised that either left or right child
+ * has enough space, but neither actually did. This can happen in
+ * case of a "torn page", IOW if we crashed earlier while writing
+ * the page to disk, and only part of the page made it to disk.
*
* Fix the corruption and restart.
*/
- RelFileNode rnode;
+ RelFileNode rnode;
ForkNumber forknum;
- BlockNumber blknum;
+ BlockNumber blknum;
BufferGetTag(buf, &rnode, &forknum, &blknum);
elog(DEBUG1, "fixing corrupt FSM block %u, relation %u/%u/%u",
@@ -312,9 +312,9 @@ fsm_search_avail(Buffer buf, uint8 minvalue, bool advancenext,
bool
fsm_truncate_avail(Page page, int nslots)
{
- FSMPage fsmpage = (FSMPage) PageGetContents(page);
- uint8 *ptr;
- bool changed = false;
+ FSMPage fsmpage = (FSMPage) PageGetContents(page);
+ uint8 *ptr;
+ bool changed = false;
Assert(nslots >= 0 && nslots < LeafNodesPerPage);
@@ -341,9 +341,9 @@ fsm_truncate_avail(Page page, int nslots)
bool
fsm_rebuild_page(Page page)
{
- FSMPage fsmpage = (FSMPage) PageGetContents(page);
- bool changed = false;
- int nodeno;
+ FSMPage fsmpage = (FSMPage) PageGetContents(page);
+ bool changed = false;
+ int nodeno;
/*
* Start from the lowest non-leaf level, at last node, working our way
@@ -351,9 +351,9 @@ fsm_rebuild_page(Page page)
*/
for (nodeno = NonLeafNodesPerPage - 1; nodeno >= 0; nodeno--)
{
- int lchild = leftchild(nodeno);
- int rchild = lchild + 1;
- uint8 newvalue = 0;
+ int lchild = leftchild(nodeno);
+ int rchild = lchild + 1;
+ uint8 newvalue = 0;
/* The first few nodes we examine might have zero or one child. */
if (lchild < NodesPerPage)
diff --git a/src/backend/storage/freespace/indexfsm.c b/src/backend/storage/freespace/indexfsm.c
index ef396a00e7..616e6b1ffc 100644
--- a/src/backend/storage/freespace/indexfsm.c
+++ b/src/backend/storage/freespace/indexfsm.c
@@ -8,15 +8,15 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/freespace/indexfsm.c,v 1.4 2009/01/01 17:23:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/freespace/indexfsm.c,v 1.5 2009/06/11 14:49:01 momjian Exp $
*
*
* NOTES:
*
- * This is similar to the FSM used for heap, in freespace.c, but instead
- * of tracking the amount of free space on pages, we only track whether
- * pages are completely free or in-use. We use the same FSM implementation
- * as for heaps, using BLCKSZ - 1 to denote used pages, and 0 for unused.
+ * This is similar to the FSM used for heap, in freespace.c, but instead
+ * of tracking the amount of free space on pages, we only track whether
+ * pages are completely free or in-use. We use the same FSM implementation
+ * as for heaps, using BLCKSZ - 1 to denote used pages, and 0 for unused.
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,7 @@
BlockNumber
GetFreeIndexPage(Relation rel)
{
- BlockNumber blkno = GetPageWithFreeSpace(rel, BLCKSZ/2);
+ BlockNumber blkno = GetPageWithFreeSpace(rel, BLCKSZ / 2);
if (blkno != InvalidBlockNumber)
RecordUsedIndexPage(rel, blkno);
diff --git a/src/backend/storage/ipc/ipc.c b/src/backend/storage/ipc/ipc.c
index 5fa2d5d37c..2616ffb817 100644
--- a/src/backend/storage/ipc/ipc.c
+++ b/src/backend/storage/ipc/ipc.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.104 2009/05/15 15:56:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/ipc.c,v 1.105 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -83,7 +83,7 @@ static int on_proc_exit_index,
* -cim 2/6/90
*
* Unfortunately, we can't really guarantee that add-on code
- * obeys the rule of not calling exit() directly. So, while
+ * obeys the rule of not calling exit() directly. So, while
* this is the preferred way out of the system, we also register
* an atexit callback that will make sure cleanup happens.
* ----------------------------------------------------------------
@@ -113,10 +113,10 @@ proc_exit(int code)
*
* Note that we do this here instead of in an on_proc_exit() callback
* because we want to ensure that this code executes last - we don't
- * want to interfere with any other on_proc_exit() callback. For
- * the same reason, we do not include it in proc_exit_prepare ...
- * so if you are exiting in the "wrong way" you won't drop your profile
- * in a nice place.
+ * want to interfere with any other on_proc_exit() callback. For the
+ * same reason, we do not include it in proc_exit_prepare ... so if
+ * you are exiting in the "wrong way" you won't drop your profile in a
+ * nice place.
*/
char gprofDirName[32];
@@ -229,8 +229,7 @@ atexit_callback(void)
/* ... too bad we don't know the real exit code ... */
proc_exit_prepare(-1);
}
-
-#else /* assume we have on_exit instead */
+#else /* assume we have on_exit instead */
static void
atexit_callback(int exitstatus, void *arg)
@@ -238,8 +237,7 @@ atexit_callback(int exitstatus, void *arg)
/* Clean up everything that must be cleaned up */
proc_exit_prepare(exitstatus);
}
-
-#endif /* HAVE_ATEXIT */
+#endif /* HAVE_ATEXIT */
/* ----------------------------------------------------------------
* on_proc_exit
diff --git a/src/backend/storage/ipc/pmsignal.c b/src/backend/storage/ipc/pmsignal.c
index c77831dd25..1b77f463b6 100644
--- a/src/backend/storage/ipc/pmsignal.c
+++ b/src/backend/storage/ipc/pmsignal.c
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/pmsignal.c,v 1.27 2009/05/05 19:59:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/pmsignal.c,v 1.28 2009/06/11 14:49:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,7 +41,7 @@
* have three possible states: UNUSED, ASSIGNED, ACTIVE. An UNUSED slot is
* available for assignment. An ASSIGNED slot is associated with a postmaster
* child process, but either the process has not touched shared memory yet,
- * or it has successfully cleaned up after itself. A ACTIVE slot means the
+ * or it has successfully cleaned up after itself. A ACTIVE slot means the
* process is actively using shared memory. The slots are assigned to
* child processes at random, and postmaster.c is responsible for tracking
* which one goes with which PID.
@@ -57,8 +57,8 @@ struct PMSignalData
/* per-reason flags */
sig_atomic_t PMSignalFlags[NUM_PMSIGNALS];
/* per-child-process flags */
- int num_child_flags; /* # of entries in PMChildFlags[] */
- int next_child_flag; /* next slot to try to assign */
+ int num_child_flags; /* # of entries in PMChildFlags[] */
+ int next_child_flag; /* next slot to try to assign */
sig_atomic_t PMChildFlags[1]; /* VARIABLE LENGTH ARRAY */
};
@@ -181,6 +181,7 @@ ReleasePostmasterChildSlot(int slot)
Assert(slot > 0 && slot <= PMSignalState->num_child_flags);
slot--;
+
/*
* Note: the slot state might already be unused, because the logic in
* postmaster.c is such that this might get called twice when a child
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 30f66c089c..e71b95c826 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -23,7 +23,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.49 2009/04/04 17:40:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.50 2009/06/11 14:49:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -829,8 +829,8 @@ GetSnapshotData(Snapshot snapshot)
snapshot->curcid = GetCurrentCommandId(false);
/*
- * This is a new snapshot, so set both refcounts are zero, and mark it
- * as not copied in persistent memory.
+ * This is a new snapshot, so set both refcounts are zero, and mark it as
+ * not copied in persistent memory.
*/
snapshot->active_count = 0;
snapshot->regd_count = 0;
@@ -1038,7 +1038,7 @@ IsBackendPid(int pid)
* some snapshot we have. Since we examine the procarray with only shared
* lock, there are race conditions: a backend could set its xmin just after
* we look. Indeed, on multiprocessors with weak memory ordering, the
- * other backend could have set its xmin *before* we look. We know however
+ * other backend could have set its xmin *before* we look. We know however
* that such a backend must have held shared ProcArrayLock overlapping our
* own hold of ProcArrayLock, else we would see its xmin update. Therefore,
* any snapshot the other backend is taking concurrently with our scan cannot
@@ -1133,9 +1133,9 @@ CountActiveBackends(void)
*
* If someone just decremented numProcs, 'proc' could also point to a
* PGPROC entry that's no longer in the array. It still points to a
- * PGPROC struct, though, because freed PGPPROC entries just go to
- * the free list and are recycled. Its contents are nonsense in that
- * case, but that's acceptable for this function.
+ * PGPROC struct, though, because freed PGPPROC entries just go to the
+ * free list and are recycled. Its contents are nonsense in that case,
+ * but that's acceptable for this function.
*/
if (proc != NULL)
continue;
@@ -1235,7 +1235,8 @@ bool
CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared)
{
ProcArrayStruct *arrayP = procArray;
-#define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */
+
+#define MAXAUTOVACPIDS 10 /* max autovacs to SIGTERM per iteration */
int autovac_pids[MAXAUTOVACPIDS];
int tries;
@@ -1280,10 +1281,10 @@ CountOtherDBBackends(Oid databaseId, int *nbackends, int *nprepared)
return false; /* no conflicting backends, so done */
/*
- * Send SIGTERM to any conflicting autovacuums before sleeping.
- * We postpone this step until after the loop because we don't
- * want to hold ProcArrayLock while issuing kill().
- * We have no idea what might block kill() inside the kernel...
+ * Send SIGTERM to any conflicting autovacuums before sleeping. We
+ * postpone this step until after the loop because we don't want to
+ * hold ProcArrayLock while issuing kill(). We have no idea what might
+ * block kill() inside the kernel...
*/
for (index = 0; index < nautovacs; index++)
(void) kill(autovac_pids[index], SIGTERM); /* ignore any error */
diff --git a/src/backend/storage/ipc/sinval.c b/src/backend/storage/ipc/sinval.c
index 2cd3530092..3f063989e0 100644
--- a/src/backend/storage/ipc/sinval.c
+++ b/src/backend/storage/ipc/sinval.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.89 2009/01/01 17:23:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/sinval.c,v 1.90 2009/06/11 14:49:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,7 +65,7 @@ SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n)
* NOTE: it is entirely possible for this routine to be invoked recursively
* as a consequence of processing inside the invalFunction or resetFunction.
* Furthermore, such a recursive call must guarantee that all outstanding
- * inval messages have been processed before it exits. This is the reason
+ * inval messages have been processed before it exits. This is the reason
* for the strange-looking choice to use a statically allocated buffer array
* and counters; it's so that a recursive call can process messages already
* sucked out of sinvaladt.c.
@@ -77,9 +77,10 @@ ReceiveSharedInvalidMessages(
{
#define MAXINVALMSGS 32
static SharedInvalidationMessage messages[MAXINVALMSGS];
+
/*
- * We use volatile here to prevent bugs if a compiler doesn't realize
- * that recursion is a possibility ...
+ * We use volatile here to prevent bugs if a compiler doesn't realize that
+ * recursion is a possibility ...
*/
static volatile int nextmsg = 0;
static volatile int nummsgs = 0;
@@ -121,18 +122,18 @@ ReceiveSharedInvalidMessages(
}
/*
- * We only need to loop if the last SIGetDataEntries call (which
- * might have been within a recursive call) returned a full buffer.
+ * We only need to loop if the last SIGetDataEntries call (which might
+ * have been within a recursive call) returned a full buffer.
*/
} while (nummsgs == MAXINVALMSGS);
/*
* We are now caught up. If we received a catchup signal, reset that
- * flag, and call SICleanupQueue(). This is not so much because we
- * need to flush dead messages right now, as that we want to pass on
- * the catchup signal to the next slowest backend. "Daisy chaining" the
- * catchup signal this way avoids creating spikes in system load for
- * what should be just a background maintenance activity.
+ * flag, and call SICleanupQueue(). This is not so much because we need
+ * to flush dead messages right now, as that we want to pass on the
+ * catchup signal to the next slowest backend. "Daisy chaining" the
+ * catchup signal this way avoids creating spikes in system load for what
+ * should be just a background maintenance activity.
*/
if (catchupInterruptOccurred)
{
diff --git a/src/backend/storage/ipc/sinvaladt.c b/src/backend/storage/ipc/sinvaladt.c
index cb911c468d..fcd1e42a7f 100644
--- a/src/backend/storage/ipc/sinvaladt.c
+++ b/src/backend/storage/ipc/sinvaladt.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.77 2009/01/01 17:23:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.78 2009/06/11 14:49:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,7 @@
* normal behavior is that at most one such interrupt is in flight at a time;
* when a backend completes processing a catchup interrupt, it executes
* SICleanupQueue, which will signal the next-furthest-behind backend if
- * needed. This avoids undue contention from multiple backends all trying
+ * needed. This avoids undue contention from multiple backends all trying
* to catch up at once. However, the furthest-back backend might be stuck
* in a state where it can't catch up. Eventually it will get reset, so it
* won't cause any more problems for anyone but itself. But we don't want
@@ -88,7 +88,7 @@
* the writer wants to change maxMsgNum while readers need to read it.
* We deal with that by having a spinlock that readers must take for just
* long enough to read maxMsgNum, while writers take it for just long enough
- * to write maxMsgNum. (The exact rule is that you need the spinlock to
+ * to write maxMsgNum. (The exact rule is that you need the spinlock to
* read maxMsgNum if you are not holding SInvalWriteLock, and you need the
* spinlock to write maxMsgNum unless you are holding both locks.)
*
@@ -146,8 +146,8 @@ typedef struct ProcState
/*
* Next LocalTransactionId to use for each idle backend slot. We keep
* this here because it is indexed by BackendId and it is convenient to
- * copy the value to and from local memory when MyBackendId is set.
- * It's meaningless in an active ProcState entry.
+ * copy the value to and from local memory when MyBackendId is set. It's
+ * meaningless in an active ProcState entry.
*/
LocalTransactionId nextLXID;
} ProcState;
@@ -235,8 +235,8 @@ CreateSharedInvalidationState(void)
/* Mark all backends inactive, and initialize nextLXID */
for (i = 0; i < shmInvalBuffer->maxBackends; i++)
{
- shmInvalBuffer->procState[i].procPid = 0; /* inactive */
- shmInvalBuffer->procState[i].nextMsgNum = 0; /* meaningless */
+ shmInvalBuffer->procState[i].procPid = 0; /* inactive */
+ shmInvalBuffer->procState[i].nextMsgNum = 0; /* meaningless */
shmInvalBuffer->procState[i].resetState = false;
shmInvalBuffer->procState[i].signaled = false;
shmInvalBuffer->procState[i].nextLXID = InvalidLocalTransactionId;
@@ -255,11 +255,11 @@ SharedInvalBackendInit(void)
SISeg *segP = shmInvalBuffer;
/*
- * This can run in parallel with read operations, and for that matter
- * with write operations; but not in parallel with additions and removals
- * of backends, nor in parallel with SICleanupQueue. It doesn't seem
- * worth having a third lock, so we choose to use SInvalWriteLock to
- * serialize additions/removals.
+ * This can run in parallel with read operations, and for that matter with
+ * write operations; but not in parallel with additions and removals of
+ * backends, nor in parallel with SICleanupQueue. It doesn't seem worth
+ * having a third lock, so we choose to use SInvalWriteLock to serialize
+ * additions/removals.
*/
LWLockAcquire(SInvalWriteLock, LW_EXCLUSIVE);
@@ -394,7 +394,7 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n)
SISeg *segP = shmInvalBuffer;
/*
- * N can be arbitrarily large. We divide the work into groups of no more
+ * N can be arbitrarily large. We divide the work into groups of no more
* than WRITE_QUANTUM messages, to be sure that we don't hold the lock for
* an unreasonably long time. (This is not so much because we care about
* letting in other writers, as that some just-caught-up backend might be
@@ -404,9 +404,9 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n)
*/
while (n > 0)
{
- int nthistime = Min(n, WRITE_QUANTUM);
- int numMsgs;
- int max;
+ int nthistime = Min(n, WRITE_QUANTUM);
+ int numMsgs;
+ int max;
n -= nthistime;
@@ -416,7 +416,7 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n)
* If the buffer is full, we *must* acquire some space. Clean the
* queue and reset anyone who is preventing space from being freed.
* Otherwise, clean the queue only when it's exceeded the next
- * fullness threshold. We have to loop and recheck the buffer state
+ * fullness threshold. We have to loop and recheck the buffer state
* after any call of SICleanupQueue.
*/
for (;;)
@@ -458,9 +458,9 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n)
* get next SI message(s) for current backend, if there are any
*
* Possible return values:
- * 0: no SI message available
+ * 0: no SI message available
* n>0: next n SI messages have been extracted into data[]
- * -1: SI reset message extracted
+ * -1: SI reset message extracted
*
* If the return value is less than the array size "datasize", the caller
* can assume that there are no more SI messages after the one(s) returned.
@@ -470,11 +470,11 @@ SIInsertDataEntries(const SharedInvalidationMessage *data, int n)
* executing on behalf of other backends, since each instance will modify only
* fields of its own backend's ProcState, and no instance will look at fields
* of other backends' ProcStates. We express this by grabbing SInvalReadLock
- * in shared mode. Note that this is not exactly the normal (read-only)
+ * in shared mode. Note that this is not exactly the normal (read-only)
* interpretation of a shared lock! Look closely at the interactions before
* allowing SInvalReadLock to be grabbed in shared mode for any other reason!
*
- * NB: this can also run in parallel with SIInsertDataEntries. It is not
+ * NB: this can also run in parallel with SIInsertDataEntries. It is not
* guaranteed that we will return any messages added after the routine is
* entered.
*
@@ -488,7 +488,7 @@ SIGetDataEntries(SharedInvalidationMessage *data, int datasize)
ProcState *stateP;
int max;
int n;
-
+
LWLockAcquire(SInvalReadLock, LW_SHARED);
segP = shmInvalBuffer;
@@ -557,7 +557,7 @@ SIGetDataEntries(SharedInvalidationMessage *data, int datasize)
*
* Caution: because we transiently release write lock when we have to signal
* some other backend, it is NOT guaranteed that there are still minFree
- * free message slots at exit. Caller must recheck and perhaps retry.
+ * free message slots at exit. Caller must recheck and perhaps retry.
*/
void
SICleanupQueue(bool callerHasWriteLock, int minFree)
@@ -576,9 +576,9 @@ SICleanupQueue(bool callerHasWriteLock, int minFree)
LWLockAcquire(SInvalReadLock, LW_EXCLUSIVE);
/*
- * Recompute minMsgNum = minimum of all backends' nextMsgNum, identify
- * the furthest-back backend that needs signaling (if any), and reset
- * any backends that are too far back.
+ * Recompute minMsgNum = minimum of all backends' nextMsgNum, identify the
+ * furthest-back backend that needs signaling (if any), and reset any
+ * backends that are too far back.
*/
min = segP->maxMsgNum;
minsig = min - SIG_THRESHOLD;
@@ -587,15 +587,15 @@ SICleanupQueue(bool callerHasWriteLock, int minFree)
for (i = 0; i < segP->lastBackend; i++)
{
ProcState *stateP = &segP->procState[i];
- int n = stateP->nextMsgNum;
+ int n = stateP->nextMsgNum;
/* Ignore if inactive or already in reset state */
if (stateP->procPid == 0 || stateP->resetState)
continue;
/*
- * If we must free some space and this backend is preventing it,
- * force him into reset state and then ignore until he catches up.
+ * If we must free some space and this backend is preventing it, force
+ * him into reset state and then ignore until he catches up.
*/
if (n < lowbound)
{
@@ -619,8 +619,8 @@ SICleanupQueue(bool callerHasWriteLock, int minFree)
/*
* When minMsgNum gets really large, decrement all message counters so as
- * to forestall overflow of the counters. This happens seldom enough
- * that folding it into the previous loop would be a loser.
+ * to forestall overflow of the counters. This happens seldom enough that
+ * folding it into the previous loop would be a loser.
*/
if (min >= MSGNUMWRAPAROUND)
{
@@ -649,7 +649,7 @@ SICleanupQueue(bool callerHasWriteLock, int minFree)
*/
if (needSig)
{
- pid_t his_pid = needSig->procPid;
+ pid_t his_pid = needSig->procPid;
needSig->signaled = true;
LWLockRelease(SInvalReadLock);
diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c
index 56a10d762b..0def1decd0 100644
--- a/src/backend/storage/large_object/inv_api.c
+++ b/src/backend/storage/large_object/inv_api.c
@@ -24,7 +24,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/large_object/inv_api.c,v 1.137 2009/01/01 17:23:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/large_object/inv_api.c,v 1.138 2009/06/11 14:49:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -248,12 +248,12 @@ inv_open(Oid lobjId, int flags, MemoryContext mcxt)
else if (flags & INV_READ)
{
/*
- * We must register the snapshot in TopTransaction's resowner,
- * because it must stay alive until the LO is closed rather than until
- * the current portal shuts down.
+ * We must register the snapshot in TopTransaction's resowner, because
+ * it must stay alive until the LO is closed rather than until the
+ * current portal shuts down.
*/
retval->snapshot = RegisterSnapshotOnOwner(GetActiveSnapshot(),
- TopTransactionResourceOwner);
+ TopTransactionResourceOwner);
retval->flags = IFS_RDLOCK;
}
else
@@ -641,7 +641,7 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes)
values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf);
replace[Anum_pg_largeobject_data - 1] = true;
newtup = heap_modify_tuple(oldtuple, RelationGetDescr(lo_heap_r),
- values, nulls, replace);
+ values, nulls, replace);
simple_heap_update(lo_heap_r, &newtup->t_self, newtup);
CatalogIndexInsert(indstate, newtup);
heap_freetuple(newtup);
@@ -810,7 +810,7 @@ inv_truncate(LargeObjectDesc *obj_desc, int len)
values[Anum_pg_largeobject_data - 1] = PointerGetDatum(&workbuf);
replace[Anum_pg_largeobject_data - 1] = true;
newtup = heap_modify_tuple(oldtuple, RelationGetDescr(lo_heap_r),
- values, nulls, replace);
+ values, nulls, replace);
simple_heap_update(lo_heap_r, &newtup->t_self, newtup);
CatalogIndexInsert(indstate, newtup);
heap_freetuple(newtup);
diff --git a/src/backend/storage/lmgr/deadlock.c b/src/backend/storage/lmgr/deadlock.c
index 25a329f284..590e732f22 100644
--- a/src/backend/storage/lmgr/deadlock.c
+++ b/src/backend/storage/lmgr/deadlock.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/deadlock.c,v 1.56 2009/01/01 17:23:47 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/deadlock.c,v 1.57 2009/06/11 14:49:02 momjian Exp $
*
* Interface:
*
@@ -933,7 +933,7 @@ DeadLockReport(void)
appendStringInfo(&logbuf,
_("Process %d: %s"),
info->pid,
- pgstat_get_backend_current_activity(info->pid, false));
+ pgstat_get_backend_current_activity(info->pid, false));
}
ereport(ERROR,
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 97c525d17a..6a29210496 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.187 2009/03/23 01:52:38 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.188 2009/06/11 14:49:02 momjian Exp $
*
* NOTES
* A lock table is a shared memory hash table. When
@@ -1112,7 +1112,7 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner)
{
LOCKMETHODID lockmethodid = LOCALLOCK_LOCKMETHOD(*locallock);
LockMethod lockMethodTable = LockMethods[lockmethodid];
- char * volatile new_status = NULL;
+ char *volatile new_status = NULL;
LOCK_PRINT("WaitOnLock: sleeping on lock",
locallock->lock, locallock->tag.mode);
@@ -1145,20 +1145,20 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner)
* the locktable state must fully reflect the fact that we own the lock;
* we can't do additional work on return.
*
- * We can and do use a PG_TRY block to try to clean up after failure,
- * but this still has a major limitation: elog(FATAL) can occur while
- * waiting (eg, a "die" interrupt), and then control won't come back here.
- * So all cleanup of essential state should happen in LockWaitCancel,
- * not here. We can use PG_TRY to clear the "waiting" status flags,
- * since doing that is unimportant if the process exits.
+ * We can and do use a PG_TRY block to try to clean up after failure, but
+ * this still has a major limitation: elog(FATAL) can occur while waiting
+ * (eg, a "die" interrupt), and then control won't come back here. So all
+ * cleanup of essential state should happen in LockWaitCancel, not here.
+ * We can use PG_TRY to clear the "waiting" status flags, since doing that
+ * is unimportant if the process exits.
*/
PG_TRY();
{
if (ProcSleep(locallock, lockMethodTable) != STATUS_OK)
{
/*
- * We failed as a result of a deadlock, see CheckDeadLock().
- * Quit now.
+ * We failed as a result of a deadlock, see CheckDeadLock(). Quit
+ * now.
*/
awaitedLock = NULL;
LOCK_PRINT("WaitOnLock: aborting on lock",
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 8f5b4e3304..4ae977154a 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.206 2009/05/05 19:59:00 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/lmgr/proc.c,v 1.207 2009/06/11 14:49:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -277,8 +277,8 @@ InitProcess(void)
/*
* Now that we have a PGPROC, mark ourselves as an active postmaster
- * child; this is so that the postmaster can detect it if we exit
- * without cleaning up.
+ * child; this is so that the postmaster can detect it if we exit without
+ * cleaning up.
*/
if (IsUnderPostmaster)
MarkPostmasterChildActive();
@@ -1184,8 +1184,8 @@ CheckDeadLock(void)
* Check to see if we've been awoken by anyone in the interim.
*
* If we have, we can return and resume our transaction -- happy day.
- * Before we are awoken the process releasing the lock grants it to us
- * so we know that we don't have to wait anymore.
+ * Before we are awoken the process releasing the lock grants it to us so
+ * we know that we don't have to wait anymore.
*
* We check by looking to see if we've been unlinked from the wait queue.
* This is quicker than checking our semaphore's state, since no kernel
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 361d020679..8655e90d29 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.145 2009/03/11 23:19:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.146 2009/06/11 14:49:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -120,7 +120,7 @@ static MemoryContext MdCxt; /* context for all md.c allocations */
typedef struct
{
RelFileNode rnode; /* the targeted relation */
- ForkNumber forknum;
+ ForkNumber forknum;
BlockNumber segno; /* which segment */
} PendingOperationTag;
@@ -154,18 +154,18 @@ typedef enum /* behavior for mdopen & _mdfd_getseg */
} ExtensionBehavior;
/* local routines */
-static MdfdVec *mdopen(SMgrRelation reln, ForkNumber forknum,
- ExtensionBehavior behavior);
+static MdfdVec *mdopen(SMgrRelation reln, ForkNumber forknum,
+ ExtensionBehavior behavior);
static void register_dirty_segment(SMgrRelation reln, ForkNumber forknum,
- MdfdVec *seg);
+ MdfdVec *seg);
static void register_unlink(RelFileNode rnode);
static MdfdVec *_fdvec_alloc(void);
static MdfdVec *_mdfd_openseg(SMgrRelation reln, ForkNumber forkno,
- BlockNumber segno, int oflags);
+ BlockNumber segno, int oflags);
static MdfdVec *_mdfd_getseg(SMgrRelation reln, ForkNumber forkno,
BlockNumber blkno, bool isTemp, ExtensionBehavior behavior);
static BlockNumber _mdnblocks(SMgrRelation reln, ForkNumber forknum,
- MdfdVec *seg);
+ MdfdVec *seg);
/*
@@ -204,7 +204,7 @@ mdinit(void)
}
/*
- * mdexists() -- Does the physical file exist?
+ * mdexists() -- Does the physical file exist?
*
* Note: this will return true for lingering files, with pending deletions
*/
@@ -212,8 +212,8 @@ bool
mdexists(SMgrRelation reln, ForkNumber forkNum)
{
/*
- * Close it first, to ensure that we notice if the fork has been
- * unlinked since we opened it.
+ * Close it first, to ensure that we notice if the fork has been unlinked
+ * since we opened it.
*/
mdclose(reln, forkNum);
@@ -369,8 +369,8 @@ mdunlink(RelFileNode rnode, ForkNumber forkNum, bool isRedo)
if (errno != ENOENT)
ereport(WARNING,
(errcode_for_file_access(),
- errmsg("could not remove segment %u of relation %s: %m",
- segno, path)));
+ errmsg("could not remove segment %u of relation %s: %m",
+ segno, path)));
break;
}
}
@@ -420,7 +420,8 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
v = _mdfd_getseg(reln, forknum, blocknum, isTemp, EXTENSION_CREATE);
- seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
+ seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
+
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
/*
@@ -535,7 +536,7 @@ mdclose(SMgrRelation reln, ForkNumber forknum)
if (v == NULL)
return;
- reln->md_fd[forknum] = NULL; /* prevent dangling pointer after error */
+ reln->md_fd[forknum] = NULL; /* prevent dangling pointer after error */
while (v != NULL)
{
@@ -562,11 +563,12 @@ mdprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL);
- seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
+ seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
+
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
(void) FilePrefetch(v->mdfd_vfd, seekpos, BLCKSZ);
-#endif /* USE_PREFETCH */
+#endif /* USE_PREFETCH */
}
@@ -588,7 +590,8 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL);
- seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
+ seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
+
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
@@ -611,8 +614,8 @@ mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
if (nbytes < 0)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not read block %u of relation %s: %m",
- blocknum, relpath(reln->smgr_rnode, forknum))));
+ errmsg("could not read block %u of relation %s: %m",
+ blocknum, relpath(reln->smgr_rnode, forknum))));
/*
* Short read: we are at or past EOF, or we read a partial block at
@@ -660,7 +663,8 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
v = _mdfd_getseg(reln, forknum, blocknum, isTemp, EXTENSION_FAIL);
- seekpos = (off_t) BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE));
+ seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));
+
Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);
if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
@@ -683,8 +687,8 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
if (nbytes < 0)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not write block %u of relation %s: %m",
- blocknum, relpath(reln->smgr_rnode, forknum))));
+ errmsg("could not write block %u of relation %s: %m",
+ blocknum, relpath(reln->smgr_rnode, forknum))));
/* short write: complain appropriately */
ereport(ERROR,
(errcode(ERRCODE_DISK_FULL),
@@ -757,9 +761,9 @@ mdnblocks(SMgrRelation reln, ForkNumber forknum)
if (v->mdfd_chain == NULL)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not open segment %u of relation %s: %m",
- segno,
- relpath(reln->smgr_rnode, forknum))));
+ errmsg("could not open segment %u of relation %s: %m",
+ segno,
+ relpath(reln->smgr_rnode, forknum))));
}
v = v->mdfd_chain;
@@ -812,13 +816,14 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks,
if (FileTruncate(v->mdfd_vfd, 0) < 0)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not truncate relation %s to %u blocks: %m",
- relpath(reln->smgr_rnode, forknum),
- nblocks)));
+ errmsg("could not truncate relation %s to %u blocks: %m",
+ relpath(reln->smgr_rnode, forknum),
+ nblocks)));
if (!isTemp)
register_dirty_segment(reln, forknum, v);
v = v->mdfd_chain;
- Assert(ov != reln->md_fd[forknum]); /* we never drop the 1st segment */
+ Assert(ov != reln->md_fd[forknum]); /* we never drop the 1st
+ * segment */
pfree(ov);
}
else if (priorblocks + ((BlockNumber) RELSEG_SIZE) > nblocks)
@@ -836,9 +841,9 @@ mdtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks,
if (FileTruncate(v->mdfd_vfd, (off_t) lastsegblocks * BLCKSZ) < 0)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not truncate relation %s to %u blocks: %m",
- relpath(reln->smgr_rnode, forknum),
- nblocks)));
+ errmsg("could not truncate relation %s to %u blocks: %m",
+ relpath(reln->smgr_rnode, forknum),
+ nblocks)));
if (!isTemp)
register_dirty_segment(reln, forknum, v);
v = v->mdfd_chain;
@@ -1055,8 +1060,8 @@ mdsync(void)
failures > 0)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not fsync segment %u of relation %s: %m",
- entry->tag.segno, path)));
+ errmsg("could not fsync segment %u of relation %s: %m",
+ entry->tag.segno, path)));
else
ereport(DEBUG1,
(errcode_for_file_access(),
@@ -1268,7 +1273,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
hash_seq_init(&hstat, pendingOpsTable);
while ((entry = (PendingOperationEntry *) hash_seq_search(&hstat)) != NULL)
{
- if (RelFileNodeEquals(entry->tag.rnode, rnode) &&
+ if (RelFileNodeEquals(entry->tag.rnode, rnode) &&
entry->tag.forknum == forknum)
{
/* Okay, cancel this entry */
@@ -1281,7 +1286,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
/* Remove any pending requests for the entire database */
HASH_SEQ_STATUS hstat;
PendingOperationEntry *entry;
- ListCell *cell,
+ ListCell *cell,
*prev,
*next;
@@ -1295,7 +1300,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
entry->canceled = true;
}
}
-
+
/* Remove unlink requests */
prev = NULL;
for (cell = list_head(pendingUnlinks); cell; cell = next)
@@ -1303,7 +1308,7 @@ RememberFsyncRequest(RelFileNode rnode, ForkNumber forknum, BlockNumber segno)
PendingUnlinkEntry *entry = (PendingUnlinkEntry *) lfirst(cell);
next = lnext(cell);
- if (entry->rnode.dbNode == rnode.dbNode)
+ if (entry->rnode.dbNode == rnode.dbNode)
{
pendingUnlinks = list_delete_cell(pendingUnlinks, cell, prev);
pfree(entry);
@@ -1569,8 +1574,8 @@ _mdnblocks(SMgrRelation reln, ForkNumber forknum, MdfdVec *seg)
if (len < 0)
ereport(ERROR,
(errcode_for_file_access(),
- errmsg("could not seek to end of segment %u of relation %s: %m",
- seg->mdfd_segno, relpath(reln->smgr_rnode, forknum))));
+ errmsg("could not seek to end of segment %u of relation %s: %m",
+ seg->mdfd_segno, relpath(reln->smgr_rnode, forknum))));
/* note that this calculation will ignore any partial block at EOF */
return (BlockNumber) (len / BLCKSZ);
}
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c
index f2cc449f17..7d1cd5af16 100644
--- a/src/backend/storage/smgr/smgr.c
+++ b/src/backend/storage/smgr/smgr.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.116 2009/01/12 05:10:44 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/storage/smgr/smgr.c,v 1.117 2009/06/11 14:49:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,21 +42,21 @@ typedef struct f_smgr
void (*smgr_shutdown) (void); /* may be NULL */
void (*smgr_close) (SMgrRelation reln, ForkNumber forknum);
void (*smgr_create) (SMgrRelation reln, ForkNumber forknum,
- bool isRedo);
+ bool isRedo);
bool (*smgr_exists) (SMgrRelation reln, ForkNumber forknum);
void (*smgr_unlink) (RelFileNode rnode, ForkNumber forknum,
- bool isRedo);
+ bool isRedo);
void (*smgr_extend) (SMgrRelation reln, ForkNumber forknum,
BlockNumber blocknum, char *buffer, bool isTemp);
void (*smgr_prefetch) (SMgrRelation reln, ForkNumber forknum,
- BlockNumber blocknum);
+ BlockNumber blocknum);
void (*smgr_read) (SMgrRelation reln, ForkNumber forknum,
- BlockNumber blocknum, char *buffer);
- void (*smgr_write) (SMgrRelation reln, ForkNumber forknum,
- BlockNumber blocknum, char *buffer, bool isTemp);
+ BlockNumber blocknum, char *buffer);
+ void (*smgr_write) (SMgrRelation reln, ForkNumber forknum,
+ BlockNumber blocknum, char *buffer, bool isTemp);
BlockNumber (*smgr_nblocks) (SMgrRelation reln, ForkNumber forknum);
void (*smgr_truncate) (SMgrRelation reln, ForkNumber forknum,
- BlockNumber nblocks, bool isTemp);
+ BlockNumber nblocks, bool isTemp);
void (*smgr_immedsync) (SMgrRelation reln, ForkNumber forknum);
void (*smgr_pre_ckpt) (void); /* may be NULL */
void (*smgr_sync) (void); /* may be NULL */
@@ -82,8 +82,8 @@ static HTAB *SMgrRelationHash = NULL;
/* local function prototypes */
static void smgrshutdown(int code, Datum arg);
-static void smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum,
- int which, bool isTemp, bool isRedo);
+static void smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum,
+ int which, bool isTemp, bool isRedo);
/*
@@ -156,14 +156,14 @@ smgropen(RelFileNode rnode)
/* Initialize it if not present before */
if (!found)
{
- int forknum;
+ int forknum;
/* hash_search already filled in the lookup key */
reln->smgr_owner = NULL;
reln->smgr_which = 0; /* we only have md.c at present */
/* mark it not open */
- for(forknum = 0; forknum <= MAX_FORKNUM; forknum++)
+ for (forknum = 0; forknum <= MAX_FORKNUM; forknum++)
reln->md_fd[forknum] = NULL;
}
@@ -209,7 +209,7 @@ void
smgrclose(SMgrRelation reln)
{
SMgrRelation *owner;
- ForkNumber forknum;
+ ForkNumber forknum;
for (forknum = 0; forknum <= MAX_FORKNUM; forknum++)
(*(smgrsw[reln->smgr_which].smgr_close)) (reln, forknum);
@@ -286,9 +286,9 @@ void
smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo)
{
/*
- * Exit quickly in WAL replay mode if we've already opened the file.
- * If it's open, it surely must exist.
- */
+ * Exit quickly in WAL replay mode if we've already opened the file. If
+ * it's open, it surely must exist.
+ */
if (isRedo && reln->md_fd[forknum] != NULL)
return;
@@ -334,7 +334,7 @@ smgrdounlink(SMgrRelation reln, ForkNumber forknum, bool isTemp, bool isRedo)
* Shared subroutine that actually does the unlink ...
*/
static void
-smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum,
+smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum,
int which, bool isTemp, bool isRedo)
{
/*
@@ -370,7 +370,7 @@ smgr_internal_unlink(RelFileNode rnode, ForkNumber forknum,
* causes intervening file space to become filled with zeroes.
*/
void
-smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
+smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
char *buffer, bool isTemp)
{
(*(smgrsw[reln->smgr_which].smgr_extend)) (reln, forknum, blocknum,
@@ -395,7 +395,7 @@ smgrprefetch(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum)
* return pages in the format that POSTGRES expects.
*/
void
-smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
+smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
char *buffer)
{
(*(smgrsw[reln->smgr_which].smgr_read)) (reln, forknum, blocknum, buffer);
@@ -417,7 +417,7 @@ smgrread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
* made to fsync the write before checkpointing.
*/
void
-smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
+smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
char *buffer, bool isTemp)
{
(*(smgrsw[reln->smgr_which].smgr_write)) (reln, forknum, blocknum,
@@ -527,4 +527,3 @@ smgrpostckpt(void)
(*(smgrsw[i].smgr_post_ckpt)) ();
}
}
-
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index c84fea522a..2ed386a222 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.566 2009/05/15 15:56:39 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.567 2009/06/11 14:49:02 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
@@ -2509,8 +2509,8 @@ quickdie(SIGNAL_ARGS)
* system reset cycle if some idiot DBA sends a manual SIGQUIT to a random
* backend. This is necessary precisely because we don't clean up our
* shared memory state. (The "dead man switch" mechanism in pmsignal.c
- * should ensure the postmaster sees this as a crash, too, but no harm
- * in being doubly sure.)
+ * should ensure the postmaster sees this as a crash, too, but no harm in
+ * being doubly sure.)
*/
exit(2);
}
diff --git a/src/backend/tcop/pquery.c b/src/backend/tcop/pquery.c
index 2521ee010a..98716830cd 100644
--- a/src/backend/tcop/pquery.c
+++ b/src/backend/tcop/pquery.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.130 2009/03/27 18:30:21 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.131 2009/06/11 14:49:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,7 +74,7 @@ CreateQueryDesc(PlannedStmt *plannedstmt,
qd->operation = plannedstmt->commandType; /* operation */
qd->plannedstmt = plannedstmt; /* plan */
qd->utilitystmt = plannedstmt->utilityStmt; /* in case DECLARE CURSOR */
- qd->sourceText = sourceText; /* query text */
+ qd->sourceText = sourceText; /* query text */
qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */
/* RI check snapshot */
qd->crosscheck_snapshot = RegisterSnapshot(crosscheck_snapshot);
@@ -106,7 +106,7 @@ CreateUtilityQueryDesc(Node *utilitystmt,
qd->operation = CMD_UTILITY; /* operation */
qd->plannedstmt = NULL;
qd->utilitystmt = utilitystmt; /* utility command */
- qd->sourceText = sourceText; /* query text */
+ qd->sourceText = sourceText; /* query text */
qd->snapshot = RegisterSnapshot(snapshot); /* snapshot */
qd->crosscheck_snapshot = InvalidSnapshot; /* RI check snapshot */
qd->dest = dest; /* output dest */
@@ -871,7 +871,7 @@ PortalRun(Portal portal, long count, bool isTopLevel,
if (log_executor_stats && portal->strategy != PORTAL_MULTI_QUERY)
ShowUsage("EXECUTOR STATISTICS");
-
+
TRACE_POSTGRESQL_QUERY_EXECUTE_DONE();
return result;
@@ -1156,7 +1156,7 @@ static void
PortalRunUtility(Portal portal, Node *utilityStmt, bool isTopLevel,
DestReceiver *dest, char *completionTag)
{
- bool active_snapshot_set;
+ bool active_snapshot_set;
elog(DEBUG3, "ProcessUtility");
@@ -1201,7 +1201,7 @@ PortalRunUtility(Portal portal, Node *utilityStmt, bool isTopLevel,
/*
* Some utility commands may pop the ActiveSnapshot stack from under us,
- * so we only pop the stack if we actually see a snapshot set. Note that
+ * so we only pop the stack if we actually see a snapshot set. Note that
* the set of utility commands that do this must be the same set
* disallowed to run inside a transaction; otherwise, we could be popping
* a snapshot that belongs to some other operation.
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index 63aca25ebd..84b357665d 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.307 2009/05/07 22:58:28 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.308 2009/06/11 14:49:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -148,8 +148,8 @@ check_xact_readonly(Node *parsetree)
/*
* Note: Commands that need to do more complicated checking are handled
- * elsewhere, in particular COPY and plannable statements do their
- * own checking.
+ * elsewhere, in particular COPY and plannable statements do their own
+ * checking.
*/
switch (nodeTag(parsetree))
@@ -252,7 +252,7 @@ ProcessUtility(Node *parsetree,
DestReceiver *dest,
char *completionTag)
{
- Assert(queryString != NULL); /* required as of 8.4 */
+ Assert(queryString != NULL); /* required as of 8.4 */
check_xact_readonly(parsetree);
@@ -423,8 +423,8 @@ ProcessUtility(Node *parsetree,
if (IsA(stmt, CreateStmt))
{
- Datum toast_options;
- static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
+ Datum toast_options;
+ static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
/* Create the table itself */
relOid = DefineRelation((CreateStmt *) stmt,
@@ -438,7 +438,7 @@ ProcessUtility(Node *parsetree,
/* parse and validate reloptions for the toast table */
toast_options = transformRelOptions((Datum) 0,
- ((CreateStmt *)stmt)->options,
+ ((CreateStmt *) stmt)->options,
"toast",
validnsps,
true, false);
@@ -1000,6 +1000,7 @@ ProcessUtility(Node *parsetree,
break;
case T_LockStmt:
+
/*
* Since the lock would just get dropped immediately, LOCK TABLE
* outside a transaction block is presumed to be user error.
diff --git a/src/backend/tsearch/regis.c b/src/backend/tsearch/regis.c
index dbeb039bde..4b71872dcf 100644
--- a/src/backend/tsearch/regis.c
+++ b/src/backend/tsearch/regis.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tsearch/regis.c,v 1.6 2009/01/01 17:23:48 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tsearch/regis.c,v 1.7 2009/06/11 14:49:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,7 @@ RS_isRegis(const char *str)
if (state == RS_IN_WAIT)
{
if (t_isalpha(c))
- /* okay */ ;
+ /* okay */ ;
else if (t_iseq(c, '['))
state = RS_IN_ONEOF;
else
@@ -56,7 +56,7 @@ RS_isRegis(const char *str)
else if (state == RS_IN_ONEOF_IN || state == RS_IN_NONEOF)
{
if (t_isalpha(c))
- /* okay */ ;
+ /* okay */ ;
else if (t_iseq(c, ']'))
state = RS_IN_WAIT;
else
@@ -115,7 +115,7 @@ RS_compile(Regis *r, bool issuffix, const char *str)
ptr->type = RSF_ONEOF;
state = RS_IN_ONEOF;
}
- else /* shouldn't get here */
+ else /* shouldn't get here */
elog(ERROR, "invalid regis pattern: \"%s\"", str);
}
else if (state == RS_IN_ONEOF)
@@ -131,7 +131,7 @@ RS_compile(Regis *r, bool issuffix, const char *str)
ptr->len = pg_mblen(c);
state = RS_IN_ONEOF_IN;
}
- else /* shouldn't get here */
+ else /* shouldn't get here */
elog(ERROR, "invalid regis pattern: \"%s\"", str);
}
else if (state == RS_IN_ONEOF_IN || state == RS_IN_NONEOF)
@@ -143,7 +143,7 @@ RS_compile(Regis *r, bool issuffix, const char *str)
}
else if (t_iseq(c, ']'))
state = RS_IN_WAIT;
- else /* shouldn't get here */
+ else /* shouldn't get here */
elog(ERROR, "invalid regis pattern: \"%s\"", str);
}
else
@@ -151,7 +151,7 @@ RS_compile(Regis *r, bool issuffix, const char *str)
c += pg_mblen(c);
}
- if (state != RS_IN_WAIT) /* shouldn't get here */
+ if (state != RS_IN_WAIT) /* shouldn't get here */
elog(ERROR, "invalid regis pattern: \"%s\"", str);
ptr = r->node;
diff --git a/src/backend/tsearch/spell.c b/src/backend/tsearch/spell.c
index 71a77a1dcc..71a3d94001 100644
--- a/src/backend/tsearch/spell.c
+++ b/src/backend/tsearch/spell.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.15 2009/01/29 16:22:10 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.16 2009/06/11 14:49:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -521,7 +521,7 @@ addFlagValue(IspellDict *Conf, char *s, uint32 val)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("multibyte flag character is not allowed")));
- Conf->flagval[*(unsigned char*) s] = (unsigned char) val;
+ Conf->flagval[*(unsigned char *) s] = (unsigned char) val;
Conf->usecompound = true;
}
@@ -654,7 +654,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
ptr = repl + (ptr - prepl) + 1;
while (*ptr)
{
- aflg |= Conf->flagval[*(unsigned char*) ptr];
+ aflg |= Conf->flagval[*(unsigned char *) ptr];
ptr++;
}
}
@@ -735,7 +735,7 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
if (*s && pg_mblen(s) == 1)
{
- Conf->flagval[*(unsigned char*) s] = FF_COMPOUNDFLAG;
+ Conf->flagval[*(unsigned char *) s] = FF_COMPOUNDFLAG;
Conf->usecompound = true;
}
oldformat = true;
@@ -791,7 +791,7 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
(errcode(ERRCODE_CONFIG_FILE_ERROR),
errmsg("multibyte flag character is not allowed")));
- flag = *(unsigned char*) s;
+ flag = *(unsigned char *) s;
goto nextline;
}
if (STRNCMP(recoded, "COMPOUNDFLAG") == 0 || STRNCMP(recoded, "COMPOUNDMIN") == 0 ||
@@ -851,7 +851,7 @@ makeCompoundFlags(IspellDict *Conf, int affix)
while (str && *str)
{
- flag |= Conf->flagval[*(unsigned char*) str];
+ flag |= Conf->flagval[*(unsigned char *) str];
str++;
}
@@ -1306,7 +1306,7 @@ addToResult(char **forms, char **cur, char *word)
if (forms == cur || strcmp(word, *(cur - 1)) != 0)
{
*cur = pstrdup(word);
- *(cur+1) = NULL;
+ *(cur + 1) = NULL;
return 1;
}
@@ -1497,7 +1497,7 @@ CopyVar(SplitVar *s, int makedup)
static void
AddStem(SplitVar *v, char *word)
{
- if ( v->nstem >= v->lenstem )
+ if (v->nstem >= v->lenstem)
{
v->lenstem *= 2;
v->stem = (char **) repalloc(v->stem, sizeof(char *) * v->lenstem);
@@ -1546,8 +1546,8 @@ SplitToVariants(IspellDict *Conf, SPNode *snode, SplitVar *orig, char *word, int
if (level + lenaff - 1 <= minpos)
continue;
- if ( lenaff >= MAXNORMLEN )
- continue; /* skip too big value */
+ if (lenaff >= MAXNORMLEN)
+ continue; /* skip too big value */
if (lenaff > 0)
memcpy(buf, word + startpos, lenaff);
buf[lenaff] = '\0';
@@ -1570,7 +1570,7 @@ SplitToVariants(IspellDict *Conf