summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian1997-09-08 02:41:22 +0000
committerBruce Momjian1997-09-08 02:41:22 +0000
commit319dbfa7364721d3343af03a7ce063c2a2c9d385 (patch)
treea2146fe02c49ce1e497b7c287dfcaa367a703ae4
parenta90f12fd9d6886da4f0734288496361a304d3882 (diff)
Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.
-rw-r--r--contrib/array/array_iterator.c46
-rw-r--r--contrib/datetime/datetime_functions.c35
-rw-r--r--contrib/int8/int8.c102
-rw-r--r--contrib/pginterface/halt.c8
-rw-r--r--contrib/pginterface/halt.h2
-rw-r--r--contrib/pginterface/pginsert.c22
-rw-r--r--contrib/pginterface/pginterface.c28
-rw-r--r--contrib/pginterface/pginterface.h14
-rw-r--r--contrib/pginterface/pgnulltest.c40
-rw-r--r--contrib/pginterface/pgwordcount.c8
-rw-r--r--contrib/soundex/soundex.c20
-rw-r--r--contrib/string/string_io.c256
-rw-r--r--src/backend/access/common/heaptuple.c678
-rw-r--r--src/backend/access/common/heapvalid.c18
-rw-r--r--src/backend/access/common/indextuple.c192
-rw-r--r--src/backend/access/common/indexvalid.c10
-rw-r--r--src/backend/access/common/printtup.c78
-rw-r--r--src/backend/access/common/tupdesc.c64
-rw-r--r--src/backend/access/gist/gist.c334
-rw-r--r--src/backend/access/gist/gistget.c78
-rw-r--r--src/backend/access/gist/gistscan.c112
-rw-r--r--src/backend/access/hash/hash.c72
-rw-r--r--src/backend/access/hash/hashfunc.c170
-rw-r--r--src/backend/access/hash/hashinsert.c44
-rw-r--r--src/backend/access/hash/hashovfl.c136
-rw-r--r--src/backend/access/hash/hashpage.c190
-rw-r--r--src/backend/access/hash/hashscan.c32
-rw-r--r--src/backend/access/hash/hashsearch.c242
-rw-r--r--src/backend/access/hash/hashstrat.c8
-rw-r--r--src/backend/access/hash/hashutil.c34
-rw-r--r--src/backend/access/heap/heapam.c62
-rw-r--r--src/backend/access/heap/hio.c30
-rw-r--r--src/backend/access/heap/stats.c6
-rw-r--r--src/backend/access/index/genam.c4
-rw-r--r--src/backend/access/index/indexam.c32
-rw-r--r--src/backend/access/index/istrat.c166
-rw-r--r--src/backend/access/nbtree/nbtcompare.c14
-rw-r--r--src/backend/access/nbtree/nbtinsert.c326
-rw-r--r--src/backend/access/nbtree/nbtpage.c98
-rw-r--r--src/backend/access/nbtree/nbtree.c86
-rw-r--r--src/backend/access/nbtree/nbtscan.c66
-rw-r--r--src/backend/access/nbtree/nbtsearch.c406
-rw-r--r--src/backend/access/nbtree/nbtsort.c300
-rw-r--r--src/backend/access/nbtree/nbtstrat.c12
-rw-r--r--src/backend/access/nbtree/nbtutils.c84
-rw-r--r--src/backend/access/rtree/rtget.c56
-rw-r--r--src/backend/access/rtree/rtproc.c20
-rw-r--r--src/backend/access/rtree/rtree.c292
-rw-r--r--src/backend/access/rtree/rtscan.c104
-rw-r--r--src/backend/access/rtree/rtstrat.c12
-rw-r--r--src/backend/access/transam/transam.c60
-rw-r--r--src/backend/access/transam/transsup.c114
-rw-r--r--src/backend/access/transam/varsup.c46
-rw-r--r--src/backend/access/transam/xact.c476
-rw-r--r--src/backend/access/transam/xid.c6
-rw-r--r--src/backend/bootstrap/bootstrap.c227
-rw-r--r--src/backend/catalog/catalog.c16
-rw-r--r--src/backend/catalog/heap.c240
-rw-r--r--src/backend/catalog/index.c274
-rw-r--r--src/backend/catalog/indexing.c139
-rw-r--r--src/backend/catalog/pg_aggregate.c50
-rw-r--r--src/backend/catalog/pg_operator.c122
-rw-r--r--src/backend/catalog/pg_proc.c40
-rw-r--r--src/backend/catalog/pg_type.c86
-rw-r--r--src/backend/commands/_deadcode/version.c26
-rw-r--r--src/backend/commands/async.c130
-rw-r--r--src/backend/commands/cluster.c80
-rw-r--r--src/backend/commands/command.c60
-rw-r--r--src/backend/commands/copy.c418
-rw-r--r--src/backend/commands/creatinh.c166
-rw-r--r--src/backend/commands/defind.c102
-rw-r--r--src/backend/commands/define.c127
-rw-r--r--src/backend/commands/explain.c150
-rw-r--r--src/backend/commands/purge.c32
-rw-r--r--src/backend/commands/recipe.c674
-rw-r--r--src/backend/commands/remove.c96
-rw-r--r--src/backend/commands/rename.c36
-rw-r--r--src/backend/commands/sequence.c204
-rw-r--r--src/backend/commands/trigger.c170
-rw-r--r--src/backend/commands/vacuum.c540
-rw-r--r--src/backend/commands/view.c50
-rw-r--r--src/backend/executor/execAmi.c160
-rw-r--r--src/backend/executor/execFlatten.c38
-rw-r--r--src/backend/executor/execJunk.c104
-rw-r--r--src/backend/executor/execMain.c395
-rw-r--r--src/backend/executor/execProcnode.c592
-rw-r--r--src/backend/executor/execQual.c444
-rw-r--r--src/backend/executor/execScan.c12
-rw-r--r--src/backend/executor/execTuples.c258
-rw-r--r--src/backend/executor/execUtils.c194
-rw-r--r--src/backend/executor/functions.c70
-rw-r--r--src/backend/executor/nodeAgg.c164
-rw-r--r--src/backend/executor/nodeAppend.c88
-rw-r--r--src/backend/executor/nodeGroup.c54
-rw-r--r--src/backend/executor/nodeHash.c148
-rw-r--r--src/backend/executor/nodeHashjoin.c136
-rw-r--r--src/backend/executor/nodeIndexscan.c157
-rw-r--r--src/backend/executor/nodeMaterial.c42
-rw-r--r--src/backend/executor/nodeMergejoin.c997
-rw-r--r--src/backend/executor/nodeNestloop.c26
-rw-r--r--src/backend/executor/nodeResult.c18
-rw-r--r--src/backend/executor/nodeSeqscan.c60
-rw-r--r--src/backend/executor/nodeSort.c50
-rw-r--r--src/backend/executor/nodeTee.c72
-rw-r--r--src/backend/executor/nodeUnique.c50
-rw-r--r--src/backend/executor/spi.c252
-rw-r--r--src/backend/lib/dllist.c38
-rw-r--r--src/backend/lib/fstack.c14
-rw-r--r--src/backend/lib/hasht.c8
-rw-r--r--src/backend/lib/lispsort.c14
-rw-r--r--src/backend/lib/qsort.c36
-rw-r--r--src/backend/lib/stringinfo.c12
-rw-r--r--src/backend/libpq/auth.c232
-rw-r--r--src/backend/libpq/be-dumpdata.c56
-rw-r--r--src/backend/libpq/be-fsstubs.c52
-rw-r--r--src/backend/libpq/be-pqexec.c106
-rw-r--r--src/backend/libpq/hba.c134
-rw-r--r--src/backend/libpq/password.c24
-rw-r--r--src/backend/libpq/portal.c100
-rw-r--r--src/backend/libpq/portalbuf.c62
-rw-r--r--src/backend/libpq/pqcomm.c100
-rw-r--r--src/backend/libpq/pqcomprim.c22
-rw-r--r--src/backend/libpq/pqpacket.c22
-rw-r--r--src/backend/libpq/pqsignal.c4
-rw-r--r--src/backend/libpq/util.c16
-rw-r--r--src/backend/main/main.c4
-rw-r--r--src/backend/nodes/copyfuncs.c620
-rw-r--r--src/backend/nodes/equalfuncs.c334
-rw-r--r--src/backend/nodes/list.c122
-rw-r--r--src/backend/nodes/makefuncs.c18
-rw-r--r--src/backend/nodes/nodeFuncs.c8
-rw-r--r--src/backend/nodes/nodes.c6
-rw-r--r--src/backend/nodes/outfuncs.c498
-rw-r--r--src/backend/nodes/print.c288
-rw-r--r--src/backend/nodes/read.c174
-rw-r--r--src/backend/nodes/readfuncs.c336
-rw-r--r--src/backend/optimizer/geqo/geqo_copy.c4
-rw-r--r--src/backend/optimizer/geqo/geqo_cx.c12
-rw-r--r--src/backend/optimizer/geqo/geqo_erx.c66
-rw-r--r--src/backend/optimizer/geqo/geqo_eval.c162
-rw-r--r--src/backend/optimizer/geqo/geqo_main.c38
-rw-r--r--src/backend/optimizer/geqo/geqo_misc.c136
-rw-r--r--src/backend/optimizer/geqo/geqo_mutation.c10
-rw-r--r--src/backend/optimizer/geqo/geqo_ox1.c12
-rw-r--r--src/backend/optimizer/geqo/geqo_ox2.c14
-rw-r--r--src/backend/optimizer/geqo/geqo_params.c36
-rw-r--r--src/backend/optimizer/geqo/geqo_paths.c30
-rw-r--r--src/backend/optimizer/geqo/geqo_pmx.c30
-rw-r--r--src/backend/optimizer/geqo/geqo_pool.c44
-rw-r--r--src/backend/optimizer/geqo/geqo_px.c12
-rw-r--r--src/backend/optimizer/geqo/geqo_recombination.c14
-rw-r--r--src/backend/optimizer/geqo/geqo_selection.c12
-rw-r--r--src/backend/optimizer/geqo/minspantree.c46
-rw-r--r--src/backend/optimizer/path/allpaths.c154
-rw-r--r--src/backend/optimizer/path/clausesel.c66
-rw-r--r--src/backend/optimizer/path/costsize.c74
-rw-r--r--src/backend/optimizer/path/hashutils.c32
-rw-r--r--src/backend/optimizer/path/indxpath.c266
-rw-r--r--src/backend/optimizer/path/joinpath.c152
-rw-r--r--src/backend/optimizer/path/joinrels.c168
-rw-r--r--src/backend/optimizer/path/joinutils.c108
-rw-r--r--src/backend/optimizer/path/mergeutils.c32
-rw-r--r--src/backend/optimizer/path/orindxpath.c52
-rw-r--r--src/backend/optimizer/path/predmig.c134
-rw-r--r--src/backend/optimizer/path/prune.c48
-rw-r--r--src/backend/optimizer/path/xfunc.c217
-rw-r--r--src/backend/optimizer/plan/createplan.c400
-rw-r--r--src/backend/optimizer/plan/initsplan.c90
-rw-r--r--src/backend/optimizer/plan/planmain.c138
-rw-r--r--src/backend/optimizer/plan/planner.c82
-rw-r--r--src/backend/optimizer/plan/setrefs.c154
-rw-r--r--src/backend/optimizer/prep/archive.c18
-rw-r--r--src/backend/optimizer/prep/prepqual.c148
-rw-r--r--src/backend/optimizer/prep/preptlist.c170
-rw-r--r--src/backend/optimizer/prep/prepunion.c232
-rw-r--r--src/backend/optimizer/util/clauseinfo.c48
-rw-r--r--src/backend/optimizer/util/clauses.c106
-rw-r--r--src/backend/optimizer/util/indexnode.c16
-rw-r--r--src/backend/optimizer/util/internal.c8
-rw-r--r--src/backend/optimizer/util/joininfo.c22
-rw-r--r--src/backend/optimizer/util/keys.c48
-rw-r--r--src/backend/optimizer/util/ordering.c8
-rw-r--r--src/backend/optimizer/util/pathnode.c70
-rw-r--r--src/backend/optimizer/util/plancat.c102
-rw-r--r--src/backend/optimizer/util/relnode.c22
-rw-r--r--src/backend/optimizer/util/tlist.c150
-rw-r--r--src/backend/optimizer/util/var.c60
-rw-r--r--src/backend/parser/analyze.c1654
-rw-r--r--src/backend/parser/catalog_utils.c358
-rw-r--r--src/backend/parser/dbcommands.c50
-rw-r--r--src/backend/parser/keywords.c22
-rw-r--r--src/backend/parser/parse_query.c311
-rw-r--r--src/backend/parser/parser.c350
-rw-r--r--src/backend/parser/scansup.c110
-rw-r--r--src/backend/parser/sysfunc.c18
-rw-r--r--src/backend/port/BSD44_derived/dl.c18
-rw-r--r--src/backend/port/BSD44_derived/port-protos.h10
-rw-r--r--src/backend/port/aix/dlfcn.c146
-rw-r--r--src/backend/port/aix/dlfcn.h22
-rw-r--r--src/backend/port/alpha/port-protos.h4
-rw-r--r--src/backend/port/alpha/port.c6
-rw-r--r--src/backend/port/bsdi/dynloader.c12
-rw-r--r--src/backend/port/bsdi/port-protos.h4
-rw-r--r--src/backend/port/dgux/dynloader.c14
-rw-r--r--src/backend/port/hpux/dynloader.c12
-rw-r--r--src/backend/port/hpux/fixade.h6
-rw-r--r--src/backend/port/hpux/port-protos.h14
-rw-r--r--src/backend/port/hpux/rusagestub.h6
-rw-r--r--src/backend/port/i386_solaris/port-protos.h6
-rw-r--r--src/backend/port/i386_solaris/port.c32
-rw-r--r--src/backend/port/i386_solaris/rusagestub.h8
-rw-r--r--src/backend/port/inet_aton.c42
-rw-r--r--src/backend/port/inet_aton.h2
-rw-r--r--src/backend/port/irix5/port-protos.h2
-rw-r--r--src/backend/port/linux/dynloader.c14
-rw-r--r--src/backend/port/nextstep/dynloader.c28
-rw-r--r--src/backend/port/nextstep/port-protos.h8
-rw-r--r--src/backend/port/nextstep/port.c14
-rw-r--r--src/backend/port/sco/port.c30
-rw-r--r--src/backend/port/sco/rusagestub.h6
-rw-r--r--src/backend/port/sparc_solaris/port-protos.h12
-rw-r--r--src/backend/port/sparc_solaris/port.c32
-rw-r--r--src/backend/port/sparc_solaris/rusagestub.h8
-rw-r--r--src/backend/port/strerror.c6
-rw-r--r--src/backend/port/sunos4/strtol.c16
-rw-r--r--src/backend/port/svr4/port-protos.h4
-rw-r--r--src/backend/port/svr4/port.c34
-rw-r--r--src/backend/port/svr4/rusagestub.h6
-rw-r--r--src/backend/port/ultrix4/dl.h84
-rw-r--r--src/backend/port/ultrix4/dynloader.c14
-rw-r--r--src/backend/port/ultrix4/port-protos.h16
-rw-r--r--src/backend/port/ultrix4/strdup.c6
-rw-r--r--src/backend/port/univel/frontend-port-protos.h8
-rw-r--r--src/backend/port/univel/port-protos.h8
-rw-r--r--src/backend/port/univel/port.c36
-rw-r--r--src/backend/port/univel/rusagestub.h6
-rw-r--r--src/backend/postmaster/postmaster.c470
-rw-r--r--src/backend/regex/engine.c1032
-rw-r--r--src/backend/regex/regcomp.c961
-rw-r--r--src/backend/regex/regerror.c34
-rw-r--r--src/backend/regex/regexec.c14
-rw-r--r--src/backend/regex/regfree.c4
-rw-r--r--src/backend/rewrite/locks.c84
-rw-r--r--src/backend/rewrite/rewriteDefine.c56
-rw-r--r--src/backend/rewrite/rewriteHandler.c186
-rw-r--r--src/backend/rewrite/rewriteManip.c448
-rw-r--r--src/backend/rewrite/rewriteRemove.c34
-rw-r--r--src/backend/rewrite/rewriteSupport.c60
-rw-r--r--src/backend/storage/buffer/buf_init.c68
-rw-r--r--src/backend/storage/buffer/buf_table.c28
-rw-r--r--src/backend/storage/buffer/bufmgr.c221
-rw-r--r--src/backend/storage/buffer/freelist.c22
-rw-r--r--src/backend/storage/buffer/localbuf.c44
-rw-r--r--src/backend/storage/file/fd.c158
-rw-r--r--src/backend/storage/ipc/ipc.c146
-rw-r--r--src/backend/storage/ipc/ipci.c6
-rw-r--r--src/backend/storage/ipc/s_lock.c20
-rw-r--r--src/backend/storage/ipc/shmem.c72
-rw-r--r--src/backend/storage/ipc/shmqueue.c24
-rw-r--r--src/backend/storage/ipc/sinval.c14
-rw-r--r--src/backend/storage/ipc/sinvaladt.c108
-rw-r--r--src/backend/storage/ipc/spin.c20
-rw-r--r--src/backend/storage/large_object/inv_api.c154
-rw-r--r--src/backend/storage/lmgr/lmgr.c34
-rw-r--r--src/backend/storage/lmgr/lock.c166
-rw-r--r--src/backend/storage/lmgr/multi.c206
-rw-r--r--src/backend/storage/lmgr/proc.c96
-rw-r--r--src/backend/storage/lmgr/single.c6
-rw-r--r--src/backend/storage/page/bufpage.c76
-rw-r--r--src/backend/storage/smgr/md.c152
-rw-r--r--src/backend/storage/smgr/mm.c110
-rw-r--r--src/backend/storage/smgr/smgr.c74
-rw-r--r--src/backend/storage/smgr/smgrtype.c16
-rw-r--r--src/backend/tcop/aclchk.c245
-rw-r--r--src/backend/tcop/dest.c387
-rw-r--r--src/backend/tcop/fastpath.c48
-rw-r--r--src/backend/tcop/postgres.c865
-rw-r--r--src/backend/tcop/pquery.c88
-rw-r--r--src/backend/tcop/utility.c1052
-rw-r--r--src/backend/tcop/variable.c64
-rw-r--r--src/backend/tioga/Arr_TgRecipe.h30
-rw-r--r--src/backend/tioga/Varray.c4
-rw-r--r--src/backend/tioga/Varray.h16
-rw-r--r--src/backend/tioga/tgRecipe.c204
-rw-r--r--src/backend/tioga/tgRecipe.h79
-rw-r--r--src/backend/utils/adt/acl.c278
-rw-r--r--src/backend/utils/adt/arrayfuncs.c692
-rw-r--r--src/backend/utils/adt/arrayutils.c32
-rw-r--r--src/backend/utils/adt/bool.c6
-rw-r--r--src/backend/utils/adt/cash.c102
-rw-r--r--src/backend/utils/adt/char.c77
-rw-r--r--src/backend/utils/adt/chunk.c185
-rw-r--r--src/backend/utils/adt/date.c200
-rw-r--r--src/backend/utils/adt/datetime.c192
-rw-r--r--src/backend/utils/adt/datum.c22
-rw-r--r--src/backend/utils/adt/dt.c1646
-rw-r--r--src/backend/utils/adt/filename.c32
-rw-r--r--src/backend/utils/adt/float.c238
-rw-r--r--src/backend/utils/adt/geo_ops.c840
-rw-r--r--src/backend/utils/adt/geo_selfuncs.c14
-rw-r--r--src/backend/utils/adt/int.c191
-rw-r--r--src/backend/utils/adt/like.c60
-rw-r--r--src/backend/utils/adt/misc.c4
-rw-r--r--src/backend/utils/adt/nabstime.c188
-rw-r--r--src/backend/utils/adt/name.c18
-rw-r--r--src/backend/utils/adt/not_in.c34
-rw-r--r--src/backend/utils/adt/numutils.c128
-rw-r--r--src/backend/utils/adt/oid.c20
-rw-r--r--src/backend/utils/adt/oidint2.c12
-rw-r--r--src/backend/utils/adt/oidint4.c16
-rw-r--r--src/backend/utils/adt/oidname.c16
-rw-r--r--src/backend/utils/adt/oracle_compat.c140
-rw-r--r--src/backend/utils/adt/regexp.c38
-rw-r--r--src/backend/utils/adt/regproc.c82
-rw-r--r--src/backend/utils/adt/selfuncs.c88
-rw-r--r--src/backend/utils/adt/sets.c32
-rw-r--r--src/backend/utils/adt/tid.c26
-rw-r--r--src/backend/utils/adt/timestamp.c42
-rw-r--r--src/backend/utils/adt/varchar.c210
-rw-r--r--src/backend/utils/adt/varlena.c110
-rw-r--r--src/backend/utils/cache/catcache.c252
-rw-r--r--src/backend/utils/cache/fcache.c42
-rw-r--r--src/backend/utils/cache/inval.c110
-rw-r--r--src/backend/utils/cache/lsyscache.c16
-rw-r--r--src/backend/utils/cache/relcache.c380
-rw-r--r--src/backend/utils/cache/syscache.c76
-rw-r--r--src/backend/utils/error/assert.c6
-rw-r--r--src/backend/utils/error/elog.c86
-rw-r--r--src/backend/utils/error/exc.c22
-rw-r--r--src/backend/utils/error/excid.c22
-rw-r--r--src/backend/utils/error/format.c8
-rw-r--r--src/backend/utils/fmgr/dfmgr.c40
-rw-r--r--src/backend/utils/fmgr/fmgr.c191
-rw-r--r--src/backend/utils/hash/dynahash.c242
-rw-r--r--src/backend/utils/hash/hashfn.c158
-rw-r--r--src/backend/utils/init/findbe.c58
-rw-r--r--src/backend/utils/init/globals.c62
-rw-r--r--src/backend/utils/init/miscinit.c28
-rw-r--r--src/backend/utils/init/postinit.c59
-rw-r--r--src/backend/utils/misc/superuser.c6
-rw-r--r--src/backend/utils/mmgr/aset.c38
-rw-r--r--src/backend/utils/mmgr/mcxt.c40
-rw-r--r--src/backend/utils/mmgr/oset.c10
-rw-r--r--src/backend/utils/mmgr/palloc.c10
-rw-r--r--src/backend/utils/mmgr/portalmem.c80
-rw-r--r--src/backend/utils/sort/lselect.c32
-rw-r--r--src/backend/utils/sort/psort.c83
-rw-r--r--src/backend/utils/time/tqual.c74
-rw-r--r--src/bin/pg_dump/common.c82
-rw-r--r--src/bin/pg_dump/pg_dump.c682
-rw-r--r--src/bin/pg_dump/pg_dump.h227
-rw-r--r--src/bin/pg_id/pg_id.c16
-rw-r--r--src/bin/pg_passwd/pg_passwd.c106
-rw-r--r--src/bin/pg_version/pg_version.c6
-rw-r--r--src/bin/pgtclsh/pgtclAppInit.c4
-rw-r--r--src/bin/pgtclsh/pgtkAppInit.c4
-rw-r--r--src/bin/psql/psql.c1149
-rw-r--r--src/bin/psql/psqlHelp.h8
-rw-r--r--src/bin/psql/stringutils.c22
-rw-r--r--src/bin/psql/stringutils.h6
-rw-r--r--src/include/access/attnum.h4
-rw-r--r--src/include/access/funcindex.h12
-rw-r--r--src/include/access/genam.h26
-rw-r--r--src/include/access/gist.h86
-rw-r--r--src/include/access/gistscan.h12
-rw-r--r--src/include/access/giststrat.h2
-rw-r--r--src/include/access/hash.h162
-rw-r--r--src/include/access/heapam.h145
-rw-r--r--src/include/access/hio.h4
-rw-r--r--src/include/access/htup.h30
-rw-r--r--src/include/access/ibit.h8
-rw-r--r--src/include/access/iqual.h6
-rw-r--r--src/include/access/istrat.h10
-rw-r--r--src/include/access/itup.h24
-rw-r--r--src/include/access/nbtree.h140
-rw-r--r--src/include/access/printtup.h14
-rw-r--r--src/include/access/relscan.h48
-rw-r--r--src/include/access/rtree.h40
-rw-r--r--src/include/access/rtscan.h4
-rw-r--r--src/include/access/rtstrat.h4
-rw-r--r--src/include/access/skey.h18
-rw-r--r--src/include/access/strat.h35
-rw-r--r--src/include/access/transam.h52
-rw-r--r--src/include/access/tupdesc.h40
-rw-r--r--src/include/access/valid.h8
-rw-r--r--src/include/access/xact.h68
-rw-r--r--src/include/bootstrap/bootstrap.h38
-rw-r--r--src/include/c.h48
-rw-r--r--src/include/catalog/catalog.h12
-rw-r--r--src/include/catalog/catname.h4
-rw-r--r--src/include/catalog/heap.h12
-rw-r--r--src/include/catalog/index.h16
-rw-r--r--src/include/catalog/indexing.h30
-rw-r--r--src/include/catalog/pg_aggregate.h26
-rw-r--r--src/include/catalog/pg_am.h46
-rw-r--r--src/include/catalog/pg_amop.h14
-rw-r--r--src/include/catalog/pg_amproc.h10
-rw-r--r--src/include/catalog/pg_attrdef.h8
-rw-r--r--src/include/catalog/pg_attribute.h28
-rw-r--r--src/include/catalog/pg_class.h40
-rw-r--r--src/include/catalog/pg_database.h8
-rw-r--r--src/include/catalog/pg_defaults.h6
-rw-r--r--src/include/catalog/pg_demon.h10
-rw-r--r--src/include/catalog/pg_group.h8
-rw-r--r--src/include/catalog/pg_hosts.h8
-rw-r--r--src/include/catalog/pg_index.h25
-rw-r--r--src/include/catalog/pg_inheritproc.h10
-rw-r--r--src/include/catalog/pg_inherits.h8
-rw-r--r--src/include/catalog/pg_ipl.h8
-rw-r--r--src/include/catalog/pg_language.h6
-rw-r--r--src/include/catalog/pg_listener.h8
-rw-r--r--src/include/catalog/pg_log.h4
-rw-r--r--src/include/catalog/pg_magic.h6
-rw-r--r--src/include/catalog/pg_opclass.h6
-rw-r--r--src/include/catalog/pg_operator.h34
-rw-r--r--src/include/catalog/pg_parg.h10
-rw-r--r--src/include/catalog/pg_proc.h36
-rw-r--r--src/include/catalog/pg_relcheck.h8
-rw-r--r--src/include/catalog/pg_rewrite.h16
-rw-r--r--src/include/catalog/pg_server.h8
-rw-r--r--src/include/catalog/pg_statistic.h12
-rw-r--r--src/include/catalog/pg_time.h4
-rw-r--r--src/include/catalog/pg_trigger.h14
-rw-r--r--src/include/catalog/pg_type.h44
-rw-r--r--src/include/catalog/pg_user.h16
-rw-r--r--src/include/catalog/pg_variable.h4
-rw-r--r--src/include/catalog/pg_version.h8
-rw-r--r--src/include/commands/async.h12
-rw-r--r--src/include/commands/cluster.h4
-rw-r--r--src/include/commands/command.h6
-rw-r--r--src/include/commands/creatinh.h8
-rw-r--r--src/include/commands/defrem.h20
-rw-r--r--src/include/commands/explain.h4
-rw-r--r--src/include/commands/purge.h4
-rw-r--r--src/include/commands/recipe.h4
-rw-r--r--src/include/commands/sequence.h8
-rw-r--r--src/include/commands/trigger.h28
-rw-r--r--src/include/commands/vacuum.h116
-rw-r--r--src/include/commands/view.h8
-rw-r--r--src/include/executor/execFlatten.h6
-rw-r--r--src/include/executor/execdebug.h20
-rw-r--r--src/include/executor/execdesc.h12
-rw-r--r--src/include/executor/executor.h70
-rw-r--r--src/include/executor/functions.h6
-rw-r--r--src/include/executor/hashjoin.h62
-rw-r--r--src/include/executor/nodeAgg.h8
-rw-r--r--src/include/executor/nodeAppend.h8
-rw-r--r--src/include/executor/nodeGroup.h8
-rw-r--r--src/include/executor/nodeHash.h14
-rw-r--r--src/include/executor/nodeHashjoin.h10
-rw-r--r--src/include/executor/nodeIndexscan.h18
-rw-r--r--src/include/executor/nodeMaterial.h12
-rw-r--r--src/include/executor/nodeMergejoin.h8
-rw-r--r--src/include/executor/nodeNestloop.h8
-rw-r--r--src/include/executor/nodeResult.h8
-rw-r--r--src/include/executor/nodeSeqscan.h14
-rw-r--r--src/include/executor/nodeSort.h12
-rw-r--r--src/include/executor/nodeTee.h10
-rw-r--r--src/include/executor/nodeUnique.h8
-rw-r--r--src/include/executor/spi.h38
-rw-r--r--src/include/executor/tuptable.h24
-rw-r--r--src/include/lib/dllist.h44
-rw-r--r--src/include/lib/fstack.h20
-rw-r--r--src/include/lib/hasht.h6
-rw-r--r--src/include/lib/stringinfo.h12
-rw-r--r--src/include/libpq/auth.h14
-rw-r--r--src/include/libpq/be-fsstubs.h24
-rw-r--r--src/include/libpq/libpq-be.h18
-rw-r--r--src/include/libpq/libpq-fs.h8
-rw-r--r--src/include/libpq/libpq.h220
-rw-r--r--src/include/libpq/pqcomm.h73
-rw-r--r--src/include/libpq/pqsignal.h4
-rw-r--r--src/include/miscadmin.h98
-rw-r--r--src/include/nodes/execnodes.h244
-rw-r--r--src/include/nodes/makefuncs.h10
-rw-r--r--src/include/nodes/memnodes.h40
-rw-r--r--src/include/nodes/nodeFuncs.h12
-rw-r--r--src/include/nodes/nodes.h24
-rw-r--r--src/include/nodes/params.h20
-rw-r--r--src/include/nodes/parsenodes.h730
-rw-r--r--src/include/nodes/pg_list.h88
-rw-r--r--src/include/nodes/plannodes.h207
-rw-r--r--src/include/nodes/primnodes.h174
-rw-r--r--src/include/nodes/print.h18
-rw-r--r--src/include/nodes/readfuncs.h8
-rw-r--r--src/include/nodes/relation.h234
-rw-r--r--src/include/optimizer/clauseinfo.h8
-rw-r--r--src/include/optimizer/clauses.h58
-rw-r--r--src/include/optimizer/cost.h46
-rw-r--r--src/include/optimizer/geqo.h20
-rw-r--r--src/include/optimizer/geqo_copy.h4
-rw-r--r--src/include/optimizer/geqo_gene.h18
-rw-r--r--src/include/optimizer/geqo_misc.h14
-rw-r--r--src/include/optimizer/geqo_mutation.h4
-rw-r--r--src/include/optimizer/geqo_paths.h6
-rw-r--r--src/include/optimizer/geqo_pool.h14
-rw-r--r--src/include/optimizer/geqo_recombination.h44
-rw-r--r--src/include/optimizer/geqo_selection.h4
-rw-r--r--src/include/optimizer/internal.h4
-rw-r--r--src/include/optimizer/joininfo.h8
-rw-r--r--src/include/optimizer/keys.h10
-rw-r--r--src/include/optimizer/ordering.h8
-rw-r--r--src/include/optimizer/pathnode.h18
-rw-r--r--src/include/optimizer/paths.h40
-rw-r--r--src/include/optimizer/plancat.h32
-rw-r--r--src/include/optimizer/planmain.h36
-rw-r--r--src/include/optimizer/planner.h6
-rw-r--r--src/include/optimizer/prep.h20
-rw-r--r--src/include/optimizer/tlist.h24
-rw-r--r--src/include/optimizer/var.h10
-rw-r--r--src/include/optimizer/xfunc.h54
-rw-r--r--src/include/parser/catalog_utils.h54
-rw-r--r--src/include/parser/dbcommands.h6
-rw-r--r--src/include/parser/gramparse.h8
-rw-r--r--src/include/parser/keywords.h10
-rw-r--r--src/include/parser/parse_query.h40
-rw-r--r--src/include/parser/parse_state.h24
-rw-r--r--src/include/parser/scansup.h4
-rw-r--r--src/include/parser/sysfunc.h2
-rw-r--r--src/include/port/hpux.h4
-rw-r--r--src/include/port/nextstep.h4
-rw-r--r--src/include/port/ultrix4.h56
-rw-r--r--src/include/port/univel.h8
-rw-r--r--src/include/postgres.h60
-rw-r--r--src/include/regex/cclass.h8
-rw-r--r--src/include/regex/cname.h6
-rw-r--r--src/include/regex/regex.h22
-rw-r--r--src/include/regex/regex2.h56
-rw-r--r--src/include/regex/regexp.h16
-rw-r--r--src/include/rewrite/locks.h4
-rw-r--r--src/include/rewrite/prs2lock.h22
-rw-r--r--src/include/rewrite/rewriteDefine.h4
-rw-r--r--src/include/rewrite/rewriteHandler.h24
-rw-r--r--src/include/rewrite/rewriteManip.h14
-rw-r--r--src/include/rewrite/rewriteRemove.h8
-rw-r--r--src/include/rewrite/rewriteSupport.h6
-rw-r--r--src/include/storage/backendid.h6
-rw-r--r--src/include/storage/block.h10
-rw-r--r--src/include/storage/buf.h4
-rw-r--r--src/include/storage/buf_internals.h117
-rw-r--r--src/include/storage/bufmgr.h58
-rw-r--r--src/include/storage/bufpage.h38
-rw-r--r--src/include/storage/fd.h50
-rw-r--r--src/include/storage/ipc.h86
-rw-r--r--src/include/storage/itemid.h16
-rw-r--r--src/include/storage/itempos.h12
-rw-r--r--src/include/storage/itemptr.h10
-rw-r--r--src/include/storage/large_object.h34
-rw-r--r--src/include/storage/lmgr.h48
-rw-r--r--src/include/storage/lock.h96
-rw-r--r--src/include/storage/multilev.h12
-rw-r--r--src/include/storage/off.h4
-rw-r--r--src/include/storage/pagenum.h6
-rw-r--r--src/include/storage/pos.h4
-rw-r--r--src/include/storage/proc.h64
-rw-r--r--src/include/storage/shmem.h46
-rw-r--r--src/include/storage/sinval.h12
-rw-r--r--src/include/storage/sinvaladt.h66
-rw-r--r--src/include/storage/smgr.h84
-rw-r--r--src/include/storage/spin.h12
-rw-r--r--src/include/strdup.h2
-rw-r--r--src/include/tcop/dest.h16
-rw-r--r--src/include/tcop/fastpath.h4
-rw-r--r--src/include/tcop/pquery.h4
-rw-r--r--src/include/tcop/tcopprot.h16
-rw-r--r--src/include/tcop/utility.h4
-rw-r--r--src/include/tcop/variable.h12
-rw-r--r--src/include/utils/acl.h52
-rw-r--r--src/include/utils/array.h56
-rw-r--r--src/include/utils/bit.h12
-rw-r--r--src/include/utils/builtins.h810
-rw-r--r--src/include/utils/cash.h32
-rw-r--r--src/include/utils/catcache.h46
-rw-r--r--src/include/utils/datetime.h6
-rw-r--r--src/include/utils/datum.h10
-rw-r--r--src/include/utils/dt.h86
-rw-r--r--src/include/utils/dynahash.h4
-rw-r--r--src/include/utils/dynamic_loader.h18
-rw-r--r--src/include/utils/elog.h6
-rw-r--r--src/include/utils/exc.h26
-rw-r--r--src/include/utils/fcache.h36
-rw-r--r--src/include/utils/fcache2.h4
-rw-r--r--src/include/utils/fmgrtab.h14
-rw-r--r--src/include/utils/geo_decls.h396
-rw-r--r--src/include/utils/hsearch.h98
-rw-r--r--src/include/utils/inval.h14
-rw-r--r--src/include/utils/lselect.h26
-rw-r--r--src/include/utils/lsyscache.h32
-rw-r--r--src/include/utils/mcxt.h12
-rw-r--r--src/include/utils/memutils.h52
-rw-r--r--src/include/utils/module.h4
-rw-r--r--src/include/utils/nabstime.h34
-rw-r--r--src/include/utils/oidcompos.h62
-rw-r--r--src/include/utils/palloc.h10
-rw-r--r--src/include/utils/portal.h38
-rw-r--r--src/include/utils/psort.h51
-rw-r--r--src/include/utils/rel.h74
-rw-r--r--src/include/utils/relcache.h18
-rw-r--r--src/include/utils/sets.h6
-rw-r--r--src/include/utils/syscache.h28
-rw-r--r--src/include/utils/tqual.h14
-rw-r--r--src/include/version.h6
-rw-r--r--src/interfaces/libpgtcl/libpgtcl.h6
-rw-r--r--src/interfaces/libpgtcl/pgtcl.c12
-rw-r--r--src/interfaces/libpgtcl/pgtclCmds.c445
-rw-r--r--src/interfaces/libpgtcl/pgtclCmds.h28
-rw-r--r--src/interfaces/libpgtcl/pgtclId.c42
-rw-r--r--src/interfaces/libpgtcl/pgtclId.h14
-rw-r--r--src/interfaces/libpq/fe-auth.c174
-rw-r--r--src/interfaces/libpq/fe-auth.h4
-rw-r--r--src/interfaces/libpq/fe-connect.c106
-rw-r--r--src/interfaces/libpq/fe-connect.h6
-rw-r--r--src/interfaces/libpq/fe-exec.c646
-rw-r--r--src/interfaces/libpq/fe-lobj.c98
-rw-r--r--src/interfaces/libpq/fe-misc.c50
-rw-r--r--src/interfaces/libpq/libpq-fe.h315
-rw-r--r--src/interfaces/libpq/pqsignal.c4
-rw-r--r--src/interfaces/libpq/pqsignal.h4
-rw-r--r--src/test/examples/testlibpq.c22
-rw-r--r--src/test/examples/testlibpq2.c24
-rw-r--r--src/test/examples/testlibpq3.c36
-rw-r--r--src/test/examples/testlibpq4.c30
-rw-r--r--src/test/examples/testlo.c54
-rw-r--r--src/test/examples/testlo2.c54
-rw-r--r--src/test/regress/regress.c198
-rw-r--r--src/tools/entab/entab.c82
-rw-r--r--src/tools/entab/halt.c8
-rw-r--r--src/tutorial/C-code/beard.c18
-rw-r--r--src/tutorial/C-code/complex.c70
-rw-r--r--src/tutorial/C-code/funcs.c19
-rw-r--r--src/utils/strdup.c6
-rw-r--r--src/utils/version.c16
632 files changed, 28319 insertions, 28238 deletions
diff --git a/contrib/array/array_iterator.c b/contrib/array/array_iterator.c
index c0c61f0b6a..23478fb738 100644
--- a/contrib/array/array_iterator.c
+++ b/contrib/array/array_iterator.c
@@ -40,21 +40,21 @@
#include "utils/builtins.h"
#include "utils/elog.h"
-static int32
+static int32
array_iterator(Oid elemtype, Oid proc, int and, ArrayType * array, Datum value)
{
- HeapTuple typ_tuple;
- TypeTupleForm typ_struct;
- bool typbyval;
- int typlen;
- func_ptr proc_fn;
- int pronargs;
- int nitems,
- i,
- result;
- int ndim,
- *dim;
- char *p;
+ HeapTuple typ_tuple;
+ TypeTupleForm typ_struct;
+ bool typbyval;
+ int typlen;
+ func_ptr proc_fn;
+ int pronargs;
+ int nitems,
+ i,
+ result;
+ int ndim,
+ *dim;
+ char *p;
/* Sanity checks */
if ((array == (ArrayType *) NULL)
@@ -101,16 +101,16 @@ array_iterator(Oid elemtype, Oid proc, int and, ArrayType * array, Datum value)
{
switch (typlen)
{
- case 1:
- result = (int) (*proc_fn) (*p, value);
- break;
- case 2:
- result = (int) (*proc_fn) (*(int16 *) p, value);
- break;
- case 3:
- case 4:
- result = (int) (*proc_fn) (*(int32 *) p, value);
- break;
+ case 1:
+ result = (int) (*proc_fn) (*p, value);
+ break;
+ case 2:
+ result = (int) (*proc_fn) (*(int16 *) p, value);
+ break;
+ case 3:
+ case 4:
+ result = (int) (*proc_fn) (*(int32 *) p, value);
+ break;
}
p += typlen;
}
diff --git a/contrib/datetime/datetime_functions.c b/contrib/datetime/datetime_functions.c
index 08e7250700..a59bd20db6 100644
--- a/contrib/datetime/datetime_functions.c
+++ b/contrib/datetime/datetime_functions.c
@@ -13,33 +13,34 @@
#include "utils/datetime.h"
-TimeADT *
+TimeADT *
time_difference(TimeADT * time1, TimeADT * time2)
{
- TimeADT *result = (TimeADT *) palloc(sizeof(TimeADT));
+ TimeADT *result = (TimeADT *) palloc(sizeof(TimeADT));
*result = *time1 - *time2;
return (result);
}
-TimeADT *
+TimeADT *
currenttime()
{
- time_t current_time;
- struct tm *tm;
- TimeADT *result = (TimeADT *) palloc(sizeof(TimeADT));
+ time_t current_time;
+ struct tm *tm;
+ TimeADT *result = (TimeADT *) palloc(sizeof(TimeADT));
current_time = time(NULL);
tm = localtime(&current_time);
*result = ((((tm->tm_hour * 60) + tm->tm_min) * 60) + tm->tm_sec);
return (result);
}
+
DateADT
currentdate()
{
- time_t current_time;
- struct tm *tm;
- DateADT result;
+ time_t current_time;
+ struct tm *tm;
+ DateADT result;
current_time = time(NULL);
tm = localtime(&current_time);
@@ -48,6 +49,7 @@ currentdate()
date2j(100, 1, 1);
return (result);
}
+
int4
hours(TimeADT * time)
{
@@ -65,47 +67,52 @@ seconds(TimeADT * time)
{
return (((int) *time) % 60);
}
+
int4
day(DateADT * date)
{
- struct tm tm;
+ struct tm tm;
j2date((*date + date2j(2000, 1, 1)),
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
return (tm.tm_mday);
}
+
int4
month(DateADT * date)
{
- struct tm tm;
+ struct tm tm;
j2date((*date + date2j(2000, 1, 1)),
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
return (tm.tm_mon);
}
+
int4
year(DateADT * date)
{
- struct tm tm;
+ struct tm tm;
j2date((*date + date2j(2000, 1, 1)),
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
return (tm.tm_year);
}
+
int4
asminutes(TimeADT * time)
{
- int seconds = (int) *time;
+ int seconds = (int) *time;
return (seconds / 60);
}
+
int4
asseconds(TimeADT * time)
{
- int seconds = (int) *time;
+ int seconds = (int) *time;
return (seconds);
}
diff --git a/contrib/int8/int8.c b/contrib/int8/int8.c
index a73986beeb..ac59515a2c 100644
--- a/contrib/int8/int8.c
+++ b/contrib/int8/int8.c
@@ -26,7 +26,7 @@
#endif
#ifndef HAVE_64BIT_INTS
-typedef char [8] int64;
+typedef char[8] int64;
#elif defined(__alpha)
typedef long int int64;
@@ -44,40 +44,40 @@ typedef long int int64;
#define INT64_FORMAT "%ld"
#endif
-int64 *int8in(char *str);
-char *int8out(int64 * val);
+int64 *int8in(char *str);
+char *int8out(int64 * val);
-bool int8eq(int64 * val1, int64 * val2);
-bool int8ne(int64 * val1, int64 * val2);
-bool int8lt(int64 * val1, int64 * val2);
-bool int8gt(int64 * val1, int64 * val2);
-bool int8le(int64 * val1, int64 * val2);
-bool int8ge(int64 * val1, int64 * val2);
+bool int8eq(int64 * val1, int64 * val2);
+bool int8ne(int64 * val1, int64 * val2);
+bool int8lt(int64 * val1, int64 * val2);
+bool int8gt(int64 * val1, int64 * val2);
+bool int8le(int64 * val1, int64 * val2);
+bool int8ge(int64 * val1, int64 * val2);
-bool int84eq(int64 * val1, int32 val2);
-bool int84ne(int64 * val1, int32 val2);
-bool int84lt(int64 * val1, int32 val2);
-bool int84gt(int64 * val1, int32 val2);
-bool int84le(int64 * val1, int32 val2);
-bool int84ge(int64 * val1, int32 val2);
+bool int84eq(int64 * val1, int32 val2);
+bool int84ne(int64 * val1, int32 val2);
+bool int84lt(int64 * val1, int32 val2);
+bool int84gt(int64 * val1, int32 val2);
+bool int84le(int64 * val1, int32 val2);
+bool int84ge(int64 * val1, int32 val2);
-int64 *int8um(int64 * val);
-int64 *int8pl(int64 * val1, int64 * val2);
-int64 *int8mi(int64 * val1, int64 * val2);
-int64 *int8mul(int64 * val1, int64 * val2);
-int64 *int8div(int64 * val1, int64 * val2);
+int64 *int8um(int64 * val);
+int64 *int8pl(int64 * val1, int64 * val2);
+int64 *int8mi(int64 * val1, int64 * val2);
+int64 *int8mul(int64 * val1, int64 * val2);
+int64 *int8div(int64 * val1, int64 * val2);
-int64 *int48(int32 val);
-int32 int84(int64 * val);
+int64 *int48(int32 val);
+int32 int84(int64 * val);
#if FALSE
-int64 *int28(int16 val);
-int16 int82(int64 * val);
+int64 *int28(int16 val);
+int16 int82(int64 * val);
#endif
-float64 i8tod(int64 * val);
-int64 *dtoi8(float64 val);
+float64 i8tod(int64 * val);
+int64 *dtoi8(float64 val);
#if USE_LOCAL_CODE
@@ -103,10 +103,10 @@ int64 *dtoi8(float64 val);
/* int8in()
*/
-int64 *
+int64 *
int8in(char *str)
{
- int64 *result = PALLOCTYPE(int64);
+ int64 *result = PALLOCTYPE(int64);
#if HAVE_64BIT_INTS
if (!PointerIsValid(str))
@@ -126,13 +126,13 @@ int8in(char *str)
/* int8out()
*/
-char *
+char *
int8out(int64 * val)
{
- char *result;
+ char *result;
- int len;
- char buf[MAXINT8LEN + 1];
+ int len;
+ char buf[MAXINT8LEN + 1];
#if HAVE_64BIT_INTS
if (!PointerIsValid(val))
@@ -242,10 +242,10 @@ int84ge(int64 * val1, int32 val2)
* Arithmetic operators on 64-bit integers.
*---------------------------------------------------------*/
-int64 *
+int64 *
int8um(int64 * val)
{
- int64 *result = PALLOCTYPE(int64);
+ int64 *result = PALLOCTYPE(int64);
if (!PointerIsValid(val))
return NULL;
@@ -255,10 +255,10 @@ int8um(int64 * val)
return (result);
} /* int8um() */
-int64 *
+int64 *
int8pl(int64 * val1, int64 * val2)
{
- int64 *result = PALLOCTYPE(int64);
+ int64 *result = PALLOCTYPE(int64);
if ((!PointerIsValid(val1)) || (!PointerIsValid(val2)))
return NULL;
@@ -268,10 +268,10 @@ int8pl(int64 * val1, int64 * val2)
return (result);
} /* int8pl() */
-int64 *
+int64 *
int8mi(int64 * val1, int64 * val2)
{
- int64 *result = PALLOCTYPE(int64);
+ int64 *result = PALLOCTYPE(int64);
if ((!PointerIsValid(val1)) || (!PointerIsValid(val2)))
return NULL;
@@ -281,10 +281,10 @@ int8mi(int64 * val1, int64 * val2)
return (result);
} /* int8mi() */
-int64 *
+int64 *
int8mul(int64 * val1, int64 * val2)
{
- int64 *result = PALLOCTYPE(int64);
+ int64 *result = PALLOCTYPE(int64);
if ((!PointerIsValid(val1)) || (!PointerIsValid(val2)))
return NULL;
@@ -294,10 +294,10 @@ int8mul(int64 * val1, int64 * val2)
return (result);
} /* int8mul() */
-int64 *
+int64 *
int8div(int64 * val1, int64 * val2)
{
- int64 *result = PALLOCTYPE(int64);
+ int64 *result = PALLOCTYPE(int64);
if ((!PointerIsValid(val1)) || (!PointerIsValid(val2)))
return NULL;
@@ -312,10 +312,10 @@ int8div(int64 * val1, int64 * val2)
* Conversion operators.
*---------------------------------------------------------*/
-int64 *
+int64 *
int48(int32 val)
{
- int64 *result = PALLOCTYPE(int64);
+ int64 *result = PALLOCTYPE(int64);
*result = val;
@@ -325,7 +325,7 @@ int48(int32 val)
int32
int84(int64 * val)
{
- int32 result;
+ int32 result;
if (!PointerIsValid(val))
elog(WARN, "Invalid (null) int64, can't convert int8 to int4", NULL);
@@ -339,10 +339,10 @@ int84(int64 * val)
} /* int84() */
#if FALSE
-int64 *
+int64 *
int28(int16 val)
{
- int64 *result;
+ int64 *result;
if (!PointerIsValid(result = PALLOCTYPE(int64)))
elog(WARN, "Memory allocation failed, can't convert int8 to int2", NULL);
@@ -355,7 +355,7 @@ int28(int16 val)
int16
int82(int64 * val)
{
- int16 result;
+ int16 result;
if (!PointerIsValid(val))
elog(WARN, "Invalid (null) int8, can't convert to int2", NULL);
@@ -370,17 +370,17 @@ int82(int64 * val)
float64
i8tod(int64 * val)
{
- float64 result = PALLOCTYPE(float64data);
+ float64 result = PALLOCTYPE(float64data);
*result = *val;
return (result);
} /* i8tod() */
-int64 *
+int64 *
dtoi8(float64 val)
{
- int64 *result = PALLOCTYPE(int64);
+ int64 *result = PALLOCTYPE(int64);
if ((*val < (-pow(2, 64) + 1)) || (*val > (pow(2, 64) - 1)))
elog(WARN, "Floating point conversion to int64 is out of range", NULL);
diff --git a/contrib/pginterface/halt.c b/contrib/pginterface/halt.c
index 000e4a9c40..a9db390de7 100644
--- a/contrib/pginterface/halt.c
+++ b/contrib/pginterface/halt.c
@@ -24,10 +24,10 @@ void
halt(va_alist)
va_dcl
{
- va_list arg_ptr;
- char *format,
- *pstr;
- void (*sig_func) ();
+ va_list arg_ptr;
+ char *format,
+ *pstr;
+ void (*sig_func) ();
va_start(arg_ptr);
format = va_arg(arg_ptr, char *);
diff --git a/contrib/pginterface/halt.h b/contrib/pginterface/halt.h
index 8e1af05e4c..8d83ede83a 100644
--- a/contrib/pginterface/halt.h
+++ b/contrib/pginterface/halt.h
@@ -3,4 +3,4 @@
**
*/
-void halt();
+void halt();
diff --git a/contrib/pginterface/pginsert.c b/contrib/pginterface/pginsert.c
index 9946b258ff..82838c2f8c 100644
--- a/contrib/pginterface/pginsert.c
+++ b/contrib/pginterface/pginsert.c
@@ -13,17 +13,17 @@
int
main(int argc, char **argv)
{
- char query[4000];
- int row = 1;
- int aint;
- float afloat;
- double adouble;
- char achar[11],
- achar16[17],
- abpchar[11],
- avarchar[51],
- atext[51];
- time_t aabstime;
+ char query[4000];
+ int row = 1;
+ int aint;
+ float afloat;
+ double adouble;
+ char achar[11],
+ achar16[17],
+ abpchar[11],
+ avarchar[51],
+ atext[51];
+ time_t aabstime;
if (argc != 2)
halt("Usage: %s database\n", argv[0]);
diff --git a/contrib/pginterface/pginterface.c b/contrib/pginterface/pginterface.c
index f1ade9dcd4..cdc419352a 100644
--- a/contrib/pginterface/pginterface.c
+++ b/contrib/pginterface/pginterface.c
@@ -12,31 +12,31 @@
#include "halt.h"
#include "pginterface.h"
-static void sig_disconnect();
-static void set_signals();
+static void sig_disconnect();
+static void set_signals();
#define NUL '\0'
/* GLOBAL VARIABLES */
-static PGconn *conn;
+static PGconn *conn;
static PGresult *res = NULL;
#define ON_ERROR_STOP 0
#define ON_ERROR_CONTINUE 1
-static int on_error_state = ON_ERROR_STOP;
+static int on_error_state = ON_ERROR_STOP;
/* LOCAL VARIABLES */
static sigset_t block_sigs,
- unblock_sigs;
-static int tuple;
+ unblock_sigs;
+static int tuple;
/*
**
** connectdb - returns PGconn structure
**
*/
-PGconn *
+PGconn *
connectdb(char *dbName,
char *pghost,
char *pgport,
@@ -68,7 +68,7 @@ disconnectdb()
** doquery - returns PGresult structure
**
*/
-PGresult *
+PGresult *
doquery(char *query)
{
if (res != NULL)
@@ -104,9 +104,9 @@ doquery(char *query)
int
fetch(void *param,...)
{
- va_list ap;
- int arg,
- num_fields;
+ va_list ap;
+ int arg,
+ num_fields;
num_fields = PQnfields(res);
@@ -142,9 +142,9 @@ fetch(void *param,...)
int
fetchwithnulls(void *param,...)
{
- va_list ap;
- int arg,
- num_fields;
+ va_list ap;
+ int arg,
+ num_fields;
num_fields = PQnfields(res);
diff --git a/contrib/pginterface/pginterface.h b/contrib/pginterface/pginterface.h
index 65894eae34..ad8320aca9 100644
--- a/contrib/pginterface/pginterface.h
+++ b/contrib/pginterface/pginterface.h
@@ -3,12 +3,12 @@
*
*/
-PGresult *doquery(char *query);
-PGconn *connectdb();
-void disconnectdb();
-int fetch(void *param,...);
-int fetchwithnulls(void *param,...);
-void on_error_continue();
-void on_error_stop();
+PGresult *doquery(char *query);
+PGconn *connectdb();
+void disconnectdb();
+int fetch(void *param,...);
+int fetchwithnulls(void *param,...);
+void on_error_continue();
+void on_error_stop();
#define END_OF_TUPLES (-1)
diff --git a/contrib/pginterface/pgnulltest.c b/contrib/pginterface/pgnulltest.c
index 2622edcaf6..96873ca7c8 100644
--- a/contrib/pginterface/pgnulltest.c
+++ b/contrib/pginterface/pgnulltest.c
@@ -15,26 +15,26 @@
int
main(int argc, char **argv)
{
- char query[4000];
- int row = 1;
- int aint;
- float afloat;
- double adouble;
- char achar[11],
- achar16[17],
- abpchar[11],
- avarchar[51],
- atext[51];
- time_t aabstime;
- int aint_null,
- afloat_null,
- adouble_null,
- achar_null,
- achar16_null,
- abpchar_null,
- avarchar_null,
- atext_null,
- aabstime_null;
+ char query[4000];
+ int row = 1;
+ int aint;
+ float afloat;
+ double adouble;
+ char achar[11],
+ achar16[17],
+ abpchar[11],
+ avarchar[51],
+ atext[51];
+ time_t aabstime;
+ int aint_null,
+ afloat_null,
+ adouble_null,
+ achar_null,
+ achar16_null,
+ abpchar_null,
+ avarchar_null,
+ atext_null,
+ aabstime_null;
if (argc != 2)
halt("Usage: %s database\n", argv[0]);
diff --git a/contrib/pginterface/pgwordcount.c b/contrib/pginterface/pgwordcount.c
index c447cdcaa0..859cf90b2a 100644
--- a/contrib/pginterface/pgwordcount.c
+++ b/contrib/pginterface/pgwordcount.c
@@ -13,10 +13,10 @@
int
main(int argc, char **argv)
{
- char query[4000];
- int row = 0;
- int count;
- char line[4000];
+ char query[4000];
+ int row = 0;
+ int count;
+ char line[4000];
if (argc != 2)
halt("Usage: %s database\n", argv[0]);
diff --git a/contrib/soundex/soundex.c b/contrib/soundex/soundex.c
index 44ad25808d..9b06808fa2 100644
--- a/contrib/soundex/soundex.c
+++ b/contrib/soundex/soundex.c
@@ -11,18 +11,18 @@
#include <ctype.h>
/* prototype for soundex function */
-char *soundex(char *instr, char *outstr);
+char *soundex(char *instr, char *outstr);
-text *
+text *
text_soundex(text * t)
{
/* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
- char *table = "01230120022455012623010202";
- int count = 0;
- text *new_t;
+ char *table = "01230120022455012623010202";
+ int count = 0;
+ text *new_t;
- char outstr[6 + 1]; /* max length of soundex is 6 */
- char *instr;
+ char outstr[6 + 1]; /* max length of soundex is 6 */
+ char *instr;
/* make a null-terminated string */
instr = palloc(VARSIZE(t) + 1);
@@ -47,11 +47,11 @@ text_soundex(text * t)
return (new_t);
}
-char *
+char *
soundex(char *instr, char *outstr)
{ /* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
- char *table = "01230120022455012623010202";
- int count = 0;
+ char *table = "01230120022455012623010202";
+ int count = 0;
while (!isalpha(instr[0]) && instr[0])
++instr;
diff --git a/contrib/string/string_io.c b/contrib/string/string_io.c
index e2cb2017c6..c45db69187 100644
--- a/contrib/string/string_io.c
+++ b/contrib/string/string_io.c
@@ -45,15 +45,15 @@
* representation of data.
*/
-char *
+char *
string_output(char *data, int size)
{
register unsigned char c,
- *p,
- *r,
- *result;
- register int l,
- len;
+ *p,
+ *r,
+ *result;
+ register int l,
+ len;
if (data == NULL)
{
@@ -74,23 +74,23 @@ string_output(char *data, int size)
{
switch (*p)
{
- case '\\':
- case '"':
- case '{':
- case '}':
- case '\b':
- case '\f':
- case '\n':
- case '\r':
- case '\t':
- case '\v':
- len++;
- break;
- default:
- if (NOTPRINTABLE(*p))
- {
- len += 3;
- }
+ case '\\':
+ case '"':
+ case '{':
+ case '}':
+ case '\b':
+ case '\f':
+ case '\n':
+ case '\r':
+ case '\t':
+ case '\v':
+ len++;
+ break;
+ default:
+ if (NOTPRINTABLE(*p))
+ {
+ len += 3;
+ }
}
}
len++;
@@ -101,53 +101,53 @@ string_output(char *data, int size)
{
switch (c)
{
- case '\\':
- case '"':
- case '{':
- case '}':
- *r++ = '\\';
- *r++ = c;
- break;
- case '\b':
- *r++ = '\\';
- *r++ = 'b';
- break;
- case '\f':
- *r++ = '\\';
- *r++ = 'f';
- break;
- case '\n':
- *r++ = '\\';
- *r++ = 'n';
- break;
- case '\r':
- *r++ = '\\';
- *r++ = 'r';
- break;
- case '\t':
- *r++ = '\\';
- *r++ = 't';
- break;
- case '\v':
- *r++ = '\\';
- *r++ = 'v';
- break;
- default:
- if (NOTPRINTABLE(c))
- {
- *r = '\\';
- r += 3;
- *r-- = DIGIT(c & 07);
- c >>= 3;
- *r-- = DIGIT(c & 07);
- c >>= 3;
- *r = DIGIT(c & 03);
- r += 3;
- }
- else
- {
+ case '\\':
+ case '"':
+ case '{':
+ case '}':
+ *r++ = '\\';
*r++ = c;
- }
+ break;
+ case '\b':
+ *r++ = '\\';
+ *r++ = 'b';
+ break;
+ case '\f':
+ *r++ = '\\';
+ *r++ = 'f';
+ break;
+ case '\n':
+ *r++ = '\\';
+ *r++ = 'n';
+ break;
+ case '\r':
+ *r++ = '\\';
+ *r++ = 'r';
+ break;
+ case '\t':
+ *r++ = '\\';
+ *r++ = 't';
+ break;
+ case '\v':
+ *r++ = '\\';
+ *r++ = 'v';
+ break;
+ default:
+ if (NOTPRINTABLE(c))
+ {
+ *r = '\\';
+ r += 3;
+ *r-- = DIGIT(c & 07);
+ c >>= 3;
+ *r-- = DIGIT(c & 07);
+ c >>= 3;
+ *r = DIGIT(c & 03);
+ r += 3;
+ }
+ else
+ {
+ *r++ = c;
+ }
}
}
*r = '\0';
@@ -181,13 +181,13 @@ string_output(char *data, int size)
* a pointer to the new string or the header.
*/
-char *
+char *
string_input(char *str, int size, int hdrsize, int *rtn_size)
{
register unsigned char *p,
- *r;
- unsigned char *result;
- int len;
+ *r;
+ unsigned char *result;
+ int len;
if ((str == NULL) || (hdrsize < 0))
{
@@ -247,48 +247,48 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
{
switch (c = *p++)
{
- case '\0':
- p--;
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- c = VALUE(c);
- if (isdigit(*p))
- {
- c = (c << 3) + VALUE(*p++);
- }
- if (isdigit(*p))
- {
- c = (c << 3) + VALUE(*p++);
- }
- *r++ = c;
- break;
- case 'b':
- *r++ = '\b';
- break;
- case 'f':
- *r++ = '\f';
- break;
- case 'n':
- *r++ = '\n';
- break;
- case 'r':
- *r++ = '\r';
- break;
- case 't':
- *r++ = '\t';
- break;
- case 'v':
- *r++ = '\v';
- break;
- default:
- *r++ = c;
+ case '\0':
+ p--;
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ c = VALUE(c);
+ if (isdigit(*p))
+ {
+ c = (c << 3) + VALUE(*p++);
+ }
+ if (isdigit(*p))
+ {
+ c = (c << 3) + VALUE(*p++);
+ }
+ *r++ = c;
+ break;
+ case 'b':
+ *r++ = '\b';
+ break;
+ case 'f':
+ *r++ = '\f';
+ break;
+ case 'n':
+ *r++ = '\n';
+ break;
+ case 'r':
+ *r++ = '\r';
+ break;
+ case 't':
+ *r++ = '\t';
+ break;
+ case 'v':
+ *r++ = '\v';
+ break;
+ default:
+ *r++ = c;
}
}
else
@@ -300,10 +300,10 @@ string_input(char *str, int size, int hdrsize, int *rtn_size)
return ((char *) result);
}
-char *
+char *
c_charout(int32 c)
{
- char str[2];
+ char str[2];
str[0] = (char) c;
str[1] = '\0';
@@ -311,25 +311,25 @@ c_charout(int32 c)
return (string_output(str, 1));
}
-char *
+char *
c_char2out(uint16 s)
{
return (string_output((char *) &s, 2));
}
-char *
+char *
c_char4out(uint32 s)
{
return (string_output((char *) &s, 4));
}
-char *
+char *
c_char8out(char *s)
{
return (string_output(s, 8));
}
-char *
+char *
c_char16out(char *s)
{
return (string_output(s, 16));
@@ -339,11 +339,11 @@ c_char16out(char *s)
* This can be used for text, bytea, SET and unknown data types
*/
-char *
+char *
c_textout(struct varlena * vlena)
{
- int len = 0;
- char *s = NULL;
+ int len = 0;
+ char *s = NULL;
if (vlena)
{
@@ -357,10 +357,10 @@ c_textout(struct varlena * vlena)
* This can be used for varchar and bpchar strings
*/
-char *
+char *
c_varcharout(char *s)
{
- int len;
+ int len;
if (s)
{
@@ -375,7 +375,7 @@ struct varlena *
c_textin(char *str)
{
struct varlena *result;
- int len;
+ int len;
if (str == NULL)
{
@@ -388,7 +388,7 @@ c_textin(char *str)
return (result);
}
-char *
+char *
c_char16in(char *str)
{
return (string_input(str, 16, 0, NULL));
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index 1725769030..9ce59d8165 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.22 1997/09/07 04:37:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.23 1997/09/08 02:19:47 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
@@ -53,9 +53,9 @@ ComputeDataSize(TupleDesc tupleDesc,
Datum value[],
char nulls[])
{
- uint32 data_length;
- int i;
- int numberOfAttributes = tupleDesc->natts;
+ uint32 data_length;
+ int i;
+ int numberOfAttributes = tupleDesc->natts;
AttributeTupleForm *att = tupleDesc->attrs;
for (data_length = 0, i = 0; i < numberOfAttributes; i++)
@@ -65,41 +65,41 @@ ComputeDataSize(TupleDesc tupleDesc,
switch (att[i]->attlen)
{
- case -1:
+ case -1:
- /*
- * This is the size of the disk representation and so must
- * include the additional sizeof long.
- */
- if (att[i]->attalign == 'd')
- {
- data_length = DOUBLEALIGN(data_length)
- + VARSIZE(DatumGetPointer(value[i]));
- }
- else
- {
- data_length = INTALIGN(data_length)
- + VARSIZE(DatumGetPointer(value[i]));
- }
- break;
- case sizeof(char):
- data_length++;
- break;
- case sizeof(short):
- data_length = SHORTALIGN(data_length + sizeof(short));
- break;
- case sizeof(int32):
- data_length = INTALIGN(data_length + sizeof(int32));
- break;
- default:
- if (att[i]->attlen < sizeof(int32))
- elog(WARN, "ComputeDataSize: attribute %d has len %d",
- i, att[i]->attlen);
- if (att[i]->attalign == 'd')
- data_length = DOUBLEALIGN(data_length) + att[i]->attlen;
- else
- data_length = LONGALIGN(data_length) + att[i]->attlen;
- break;
+ /*
+ * This is the size of the disk representation and so must
+ * include the additional sizeof long.
+ */
+ if (att[i]->attalign == 'd')
+ {
+ data_length = DOUBLEALIGN(data_length)
+ + VARSIZE(DatumGetPointer(value[i]));
+ }
+ else
+ {
+ data_length = INTALIGN(data_length)
+ + VARSIZE(DatumGetPointer(value[i]));
+ }
+ break;
+ case sizeof(char):
+ data_length++;
+ break;
+ case sizeof(short):
+ data_length = SHORTALIGN(data_length + sizeof(short));
+ break;
+ case sizeof(int32):
+ data_length = INTALIGN(data_length + sizeof(int32));
+ break;
+ default:
+ if (att[i]->attlen < sizeof(int32))
+ elog(WARN, "ComputeDataSize: attribute %d has len %d",
+ i, att[i]->attlen);
+ if (att[i]->attalign == 'd')
+ data_length = DOUBLEALIGN(data_length) + att[i]->attlen;
+ else
+ data_length = LONGALIGN(data_length) + att[i]->attlen;
+ break;
}
}
@@ -118,11 +118,11 @@ DataFill(char *data,
char *infomask,
bits8 * bit)
{
- bits8 *bitP = 0;
- int bitmask = 0;
- uint32 data_length;
- int i;
- int numberOfAttributes = tupleDesc->natts;
+ bits8 *bitP = 0;
+ int bitmask = 0;
+ uint32 data_length;
+ int i;
+ int numberOfAttributes = tupleDesc->natts;
AttributeTupleForm *att = tupleDesc->attrs;
if (bit != NULL)
@@ -159,58 +159,58 @@ DataFill(char *data,
switch (att[i]->attlen)
{
- case -1:
- *infomask |= HEAP_HASVARLENA;
- if (att[i]->attalign == 'd')
- {
- data = (char *) DOUBLEALIGN(data);
- }
- else
- {
+ case -1:
+ *infomask |= HEAP_HASVARLENA;
+ if (att[i]->attalign == 'd')
+ {
+ data = (char *) DOUBLEALIGN(data);
+ }
+ else
+ {
+ data = (char *) INTALIGN(data);
+ }
+ data_length = VARSIZE(DatumGetPointer(value[i]));
+ memmove(data, DatumGetPointer(value[i]), data_length);
+ data += data_length;
+ break;
+ case sizeof(char):
+ *data = att[i]->attbyval ?
+ DatumGetChar(value[i]) : *((char *) value[i]);
+ data += sizeof(char);
+ break;
+ case sizeof(int16):
+ data = (char *) SHORTALIGN(data);
+ *(short *) data = (att[i]->attbyval ?
+ DatumGetInt16(value[i]) :
+ *((short *) value[i]));
+ data += sizeof(short);
+ break;
+ case sizeof(int32):
data = (char *) INTALIGN(data);
- }
- data_length = VARSIZE(DatumGetPointer(value[i]));
- memmove(data, DatumGetPointer(value[i]), data_length);
- data += data_length;
- break;
- case sizeof(char):
- *data = att[i]->attbyval ?
- DatumGetChar(value[i]) : *((char *) value[i]);
- data += sizeof(char);
- break;
- case sizeof(int16):
- data = (char *) SHORTALIGN(data);
- *(short *) data = (att[i]->attbyval ?
- DatumGetInt16(value[i]) :
- *((short *) value[i]));
- data += sizeof(short);
- break;
- case sizeof(int32):
- data = (char *) INTALIGN(data);
- *(int32 *) data = (att[i]->attbyval ?
- DatumGetInt32(value[i]) :
- *((int32 *) value[i]));
- data += sizeof(int32);
- break;
- default:
- if (att[i]->attlen < sizeof(int32))
- elog(WARN, "DataFill: attribute %d has len %d",
- i, att[i]->attlen);
- if (att[i]->attalign == 'd')
- {
- data = (char *) DOUBLEALIGN(data);
- memmove(data, DatumGetPointer(value[i]),
- att[i]->attlen);
- data += att[i]->attlen;
- }
- else
- {
- data = (char *) LONGALIGN(data);
- memmove(data, DatumGetPointer(value[i]),
- att[i]->attlen);
- data += att[i]->attlen;
- }
- break;
+ *(int32 *) data = (att[i]->attbyval ?
+ DatumGetInt32(value[i]) :
+ *((int32 *) value[i]));
+ data += sizeof(int32);
+ break;
+ default:
+ if (att[i]->attlen < sizeof(int32))
+ elog(WARN, "DataFill: attribute %d has len %d",
+ i, att[i]->attlen);
+ if (att[i]->attalign == 'd')
+ {
+ data = (char *) DOUBLEALIGN(data);
+ memmove(data, DatumGetPointer(value[i]),
+ att[i]->attlen);
+ data += att[i]->attlen;
+ }
+ else
+ {
+ data = (char *) LONGALIGN(data);
+ memmove(data, DatumGetPointer(value[i]),
+ att[i]->attlen);
+ data += att[i]->attlen;
+ }
+ break;
}
}
}
@@ -240,24 +240,24 @@ heap_attisnull(HeapTuple tup, int attnum)
else
switch (attnum)
{
- case SelfItemPointerAttributeNumber:
- case ObjectIdAttributeNumber:
- case MinTransactionIdAttributeNumber:
- case MinCommandIdAttributeNumber:
- case MaxTransactionIdAttributeNumber:
- case MaxCommandIdAttributeNumber:
- case ChainItemPointerAttributeNumber:
- case AnchorItemPointerAttributeNumber:
- case MinAbsoluteTimeAttributeNumber:
- case MaxAbsoluteTimeAttributeNumber:
- case VersionTypeAttributeNumber:
- break;
+ case SelfItemPointerAttributeNumber:
+ case ObjectIdAttributeNumber:
+ case MinTransactionIdAttributeNumber:
+ case MinCommandIdAttributeNumber:
+ case MaxTransactionIdAttributeNumber:
+ case MaxCommandIdAttributeNumber:
+ case ChainItemPointerAttributeNumber:
+ case AnchorItemPointerAttributeNumber:
+ case MinAbsoluteTimeAttributeNumber:
+ case MaxAbsoluteTimeAttributeNumber:
+ case VersionTypeAttributeNumber:
+ break;
- case 0:
- elog(WARN, "heap_attisnull: zero attnum disallowed");
+ case 0:
+ elog(WARN, "heap_attisnull: zero attnum disallowed");
- default:
- elog(WARN, "heap_attisnull: undefined negative attnum");
+ default:
+ elog(WARN, "heap_attisnull: undefined negative attnum");
}
return (0);
@@ -277,38 +277,38 @@ heap_attisnull(HeapTuple tup, int attnum)
int
heap_sysattrlen(AttrNumber attno)
{
- HeapTupleData *f = NULL;
+ HeapTupleData *f = NULL;
switch (attno)
{
- case SelfItemPointerAttributeNumber:
- return sizeof f->t_ctid;
- case ObjectIdAttributeNumber:
- return sizeof f->t_oid;
- case MinTransactionIdAttributeNumber:
- return sizeof f->t_xmin;
- case MinCommandIdAttributeNumber:
- return sizeof f->t_cmin;
- case MaxTransactionIdAttributeNumber:
- return sizeof f->t_xmax;
- case MaxCommandIdAttributeNumber:
- return sizeof f->t_cmax;
- case ChainItemPointerAttributeNumber:
- return sizeof f->t_chain;
- case MinAbsoluteTimeAttributeNumber:
- return sizeof f->t_tmin;
- case MaxAbsoluteTimeAttributeNumber:
- return sizeof f->t_tmax;
- case VersionTypeAttributeNumber:
- return sizeof f->t_vtype;
-
- case AnchorItemPointerAttributeNumber:
- elog(WARN, "heap_sysattrlen: field t_anchor does not exist!");
- return 0;
-
- default:
- elog(WARN, "sysattrlen: System attribute number %d unknown.", attno);
- return 0;
+ case SelfItemPointerAttributeNumber:
+ return sizeof f->t_ctid;
+ case ObjectIdAttributeNumber:
+ return sizeof f->t_oid;
+ case MinTransactionIdAttributeNumber:
+ return sizeof f->t_xmin;
+ case MinCommandIdAttributeNumber:
+ return sizeof f->t_cmin;
+ case MaxTransactionIdAttributeNumber:
+ return sizeof f->t_xmax;
+ case MaxCommandIdAttributeNumber:
+ return sizeof f->t_cmax;
+ case ChainItemPointerAttributeNumber:
+ return sizeof f->t_chain;
+ case MinAbsoluteTimeAttributeNumber:
+ return sizeof f->t_tmin;
+ case MaxAbsoluteTimeAttributeNumber:
+ return sizeof f->t_tmax;
+ case VersionTypeAttributeNumber:
+ return sizeof f->t_vtype;
+
+ case AnchorItemPointerAttributeNumber:
+ elog(WARN, "heap_sysattrlen: field t_anchor does not exist!");
+ return 0;
+
+ default:
+ elog(WARN, "sysattrlen: System attribute number %d unknown.", attno);
+ return 0;
}
}
@@ -321,48 +321,48 @@ heap_sysattrlen(AttrNumber attno)
bool
heap_sysattrbyval(AttrNumber attno)
{
- bool byval;
+ bool byval;
switch (attno)
{
- case SelfItemPointerAttributeNumber:
- byval = false;
- break;
- case ObjectIdAttributeNumber:
- byval = true;
- break;
- case MinTransactionIdAttributeNumber:
- byval = true;
- break;
- case MinCommandIdAttributeNumber:
- byval = true;
- break;
- case MaxTransactionIdAttributeNumber:
- byval = true;
- break;
- case MaxCommandIdAttributeNumber:
- byval = true;
- break;
- case ChainItemPointerAttributeNumber:
- byval = false;
- break;
- case AnchorItemPointerAttributeNumber:
- byval = false;
- break;
- case MinAbsoluteTimeAttributeNumber:
- byval = true;
- break;
- case MaxAbsoluteTimeAttributeNumber:
- byval = true;
- break;
- case VersionTypeAttributeNumber:
- byval = true;
- break;
- default:
- byval = true;
- elog(WARN, "sysattrbyval: System attribute number %d unknown.",
- attno);
- break;
+ case SelfItemPointerAttributeNumber:
+ byval = false;
+ break;
+ case ObjectIdAttributeNumber:
+ byval = true;
+ break;
+ case MinTransactionIdAttributeNumber:
+ byval = true;
+ break;
+ case MinCommandIdAttributeNumber:
+ byval = true;
+ break;
+ case MaxTransactionIdAttributeNumber:
+ byval = true;
+ break;
+ case MaxCommandIdAttributeNumber:
+ byval = true;
+ break;
+ case ChainItemPointerAttributeNumber:
+ byval = false;
+ break;
+ case AnchorItemPointerAttributeNumber:
+ byval = false;
+ break;
+ case MinAbsoluteTimeAttributeNumber:
+ byval = true;
+ break;
+ case MaxAbsoluteTimeAttributeNumber:
+ byval = true;
+ break;
+ case VersionTypeAttributeNumber:
+ byval = true;
+ break;
+ default:
+ byval = true;
+ elog(WARN, "sysattrbyval: System attribute number %d unknown.",
+ attno);
+ break;
}
return byval;
@@ -372,57 +372,57 @@ heap_sysattrbyval(AttrNumber attno)
* heap_getsysattr
* ----------------
*/
-char *
+char *
heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
{
switch (attnum)
{
- case SelfItemPointerAttributeNumber:
- return ((char *) &tup->t_ctid);
- case ObjectIdAttributeNumber:
- return ((char *) (long) tup->t_oid);
- case MinTransactionIdAttributeNumber:
- return ((char *) (long) tup->t_xmin);
- case MinCommandIdAttributeNumber:
- return ((char *) (long) tup->t_cmin);
- case MaxTransactionIdAttributeNumber:
- return ((char *) (long) tup->t_xmax);
- case MaxCommandIdAttributeNumber:
- return ((char *) (long) tup->t_cmax);
- case ChainItemPointerAttributeNumber:
- return ((char *) &tup->t_chain);
- case AnchorItemPointerAttributeNumber:
- elog(WARN, "heap_getsysattr: t_anchor does not exist!");
- break;
+ case SelfItemPointerAttributeNumber:
+ return ((char *) &tup->t_ctid);
+ case ObjectIdAttributeNumber:
+ return ((char *) (long) tup->t_oid);
+ case MinTransactionIdAttributeNumber:
+ return ((char *) (long) tup->t_xmin);
+ case MinCommandIdAttributeNumber:
+ return ((char *) (long) tup->t_cmin);
+ case MaxTransactionIdAttributeNumber:
+ return ((char *) (long) tup->t_xmax);
+ case MaxCommandIdAttributeNumber:
+ return ((char *) (long) tup->t_cmax);
+ case ChainItemPointerAttributeNumber:
+ return ((char *) &tup->t_chain);
+ case AnchorItemPointerAttributeNumber:
+ elog(WARN, "heap_getsysattr: t_anchor does not exist!");
+ break;
- /*
- * For tmin and tmax, we need to do some extra work. These don't
- * get filled in until the vacuum cleaner runs (or we manage to
- * flush a page after setting the value correctly below). If the
- * vacuum cleaner hasn't run yet, then the times stored in the
- * tuple are wrong, and we need to look up the commit time of the
- * transaction. We cache this value in the tuple to avoid doing
- * the work more than once.
- */
+ /*
+ * For tmin and tmax, we need to do some extra work. These
+ * don't get filled in until the vacuum cleaner runs (or we
+ * manage to flush a page after setting the value correctly
+ * below). If the vacuum cleaner hasn't run yet, then the
+ * times stored in the tuple are wrong, and we need to look up
+ * the commit time of the transaction. We cache this value in
+ * the tuple to avoid doing the work more than once.
+ */
- case MinAbsoluteTimeAttributeNumber:
- if (!AbsoluteTimeIsBackwardCompatiblyValid(tup->t_tmin) &&
- TransactionIdDidCommit(tup->t_xmin))
- tup->t_tmin = TransactionIdGetCommitTime(tup->t_xmin);
- return ((char *) (long) tup->t_tmin);
- case MaxAbsoluteTimeAttributeNumber:
- if (!AbsoluteTimeIsBackwardCompatiblyReal(tup->t_tmax))
- {
- if (TransactionIdDidCommit(tup->t_xmax))
- tup->t_tmax = TransactionIdGetCommitTime(tup->t_xmax);
- else
- tup->t_tmax = CURRENT_ABSTIME;
- }
- return ((char *) (long) tup->t_tmax);
- case VersionTypeAttributeNumber:
- return ((char *) (long) tup->t_vtype);
- default:
- elog(WARN, "heap_getsysattr: undefined attnum %d", attnum);
+ case MinAbsoluteTimeAttributeNumber:
+ if (!AbsoluteTimeIsBackwardCompatiblyValid(tup->t_tmin) &&
+ TransactionIdDidCommit(tup->t_xmin))
+ tup->t_tmin = TransactionIdGetCommitTime(tup->t_xmin);
+ return ((char *) (long) tup->t_tmin);
+ case MaxAbsoluteTimeAttributeNumber:
+ if (!AbsoluteTimeIsBackwardCompatiblyReal(tup->t_tmax))
+ {
+ if (TransactionIdDidCommit(tup->t_xmax))
+ tup->t_tmax = TransactionIdGetCommitTime(tup->t_xmax);
+ else
+ tup->t_tmax = CURRENT_ABSTIME;
+ }
+ return ((char *) (long) tup->t_tmax);
+ case VersionTypeAttributeNumber:
+ return ((char *) (long) tup->t_vtype);
+ default:
+ elog(WARN, "heap_getsysattr: undefined attnum %d", attnum);
}
return (NULL);
}
@@ -444,15 +444,15 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
* the same attribute descriptor will go much quicker. -cim 5/4/91
* ----------------
*/
-char *
+char *
fastgetattr(HeapTuple tup,
int attnum,
TupleDesc tupleDesc,
bool * isnull)
{
- char *tp; /* ptr to att in tuple */
- bits8 *bp = NULL; /* ptr to att in tuple */
- int slow; /* do we have to walk nulls? */
+ char *tp; /* ptr to att in tuple */
+ bits8 *bp = NULL; /* ptr to att in tuple */
+ int slow; /* do we have to walk nulls? */
AttributeTupleForm *att = tupleDesc->attrs;
/* ----------------
@@ -526,7 +526,7 @@ fastgetattr(HeapTuple tup,
*/
{
- register int i = 0; /* current offset in bp */
+ register int i = 0; /* current offset in bp */
for (i = 0; i < attnum && !slow; i++)
{
@@ -554,7 +554,7 @@ fastgetattr(HeapTuple tup,
}
else if (!HeapTupleAllFixed(tup))
{
- register int j = 0;
+ register int j = 0;
for (j = 0; j < attnum && !slow; j++)
if (att[j]->attlen < 1)
@@ -569,8 +569,8 @@ fastgetattr(HeapTuple tup,
*/
if (!slow)
{
- register int j = 1;
- register long off;
+ register int j = 1;
+ register long off;
/*
* need to set cache for some atts
@@ -587,30 +587,30 @@ fastgetattr(HeapTuple tup,
{
switch (att[j]->attlen)
{
- case -1:
- off = (att[j]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[j]->attlen < sizeof(int32))
- {
- elog(WARN,
- "fastgetattr: attribute %d has len %d",
- j, att[j]->attlen);
- }
- if (att[j]->attalign == 'd')
- off = DOUBLEALIGN(off);
- else
- off = LONGALIGN(off);
- break;
+ case -1:
+ off = (att[j]->attalign == 'd') ?
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
+ case sizeof(char):
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off);
+ break;
+ default:
+ if (att[j]->attlen < sizeof(int32))
+ {
+ elog(WARN,
+ "fastgetattr: attribute %d has len %d",
+ j, att[j]->attlen);
+ }
+ if (att[j]->attalign == 'd')
+ off = DOUBLEALIGN(off);
+ else
+ off = LONGALIGN(off);
+ break;
}
att[j]->attcacheoff = off;
@@ -622,9 +622,9 @@ fastgetattr(HeapTuple tup,
}
else
{
- register bool usecache = true;
- register int off = 0;
- register int i;
+ register bool usecache = true;
+ register int off = 0;
+ register int i;
/*
* Now we know that we have to walk the tuple CAREFULLY.
@@ -648,28 +648,28 @@ fastgetattr(HeapTuple tup,
}
switch (att[i]->attlen)
{
- case -1:
- off = (att[i]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[i]->attlen < sizeof(int32))
- elog(WARN,
- "fastgetattr2: attribute %d has len %d",
- i, att[i]->attlen);
- if (att[i]->attalign == 'd')
- off = DOUBLEALIGN(off);
- else
- off = LONGALIGN(off);
- break;
+ case -1:
+ off = (att[i]->attalign == 'd') ?
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
+ case sizeof(char):
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off);
+ break;
+ default:
+ if (att[i]->attlen < sizeof(int32))
+ elog(WARN,
+ "fastgetattr2: attribute %d has len %d",
+ i, att[i]->attlen);
+ if (att[i]->attalign == 'd')
+ off = DOUBLEALIGN(off);
+ else
+ off = LONGALIGN(off);
+ break;
}
if (usecache && att[i]->attcacheoff > 0)
{
@@ -687,47 +687,47 @@ fastgetattr(HeapTuple tup,
switch (att[i]->attlen)
{
+ case sizeof(char):
+ off++;
+ break;
+ case sizeof(int16):
+ off += sizeof(int16);
+ break;
+ case sizeof(int32):
+ off += sizeof(int32);
+ break;
+ case -1:
+ usecache = false;
+ off += VARSIZE(tp + off);
+ break;
+ default:
+ off += att[i]->attlen;
+ break;
+ }
+ }
+ switch (att[attnum]->attlen)
+ {
+ case -1:
+ off = (att[attnum]->attalign == 'd') ?
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
case sizeof(char):
- off++;
break;
- case sizeof(int16):
- off += sizeof(int16);
+ case sizeof(short):
+ off = SHORTALIGN(off);
break;
case sizeof(int32):
- off += sizeof(int32);
- break;
- case -1:
- usecache = false;
- off += VARSIZE(tp + off);
+ off = INTALIGN(off);
break;
default:
- off += att[i]->attlen;
+ if (att[attnum]->attlen < sizeof(int32))
+ elog(WARN, "fastgetattr3: attribute %d has len %d",
+ attnum, att[attnum]->attlen);
+ if (att[attnum]->attalign == 'd')
+ off = DOUBLEALIGN(off);
+ else
+ off = LONGALIGN(off);
break;
- }
- }
- switch (att[attnum]->attlen)
- {
- case -1:
- off = (att[attnum]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[attnum]->attlen < sizeof(int32))
- elog(WARN, "fastgetattr3: attribute %d has len %d",
- attnum, att[attnum]->attlen);
- if (att[attnum]->attalign == 'd')
- off = DOUBLEALIGN(off);
- else
- off = LONGALIGN(off);
- break;
}
return ((char *) fetchatt(&(att[attnum]), tp + off));
}
@@ -742,7 +742,7 @@ fastgetattr(HeapTuple tup,
HeapTuple
heap_copytuple(HeapTuple tuple)
{
- HeapTuple newTuple;
+ HeapTuple newTuple;
if (!HeapTupleIsValid(tuple))
return (NULL);
@@ -772,15 +772,15 @@ heap_deformtuple(HeapTuple tuple,
Datum values[],
char nulls[])
{
- int i;
- int natts;
+ int i;
+ int natts;
Assert(HeapTupleIsValid(tuple));
natts = tuple->t_natts;
for (i = 0; i < natts; i++)
{
- bool isnull;
+ bool isnull;
values[i] = (Datum) heap_getattr(tuple,
InvalidBuffer,
@@ -819,14 +819,14 @@ heap_formtuple(TupleDesc tupleDescriptor,
Datum value[],
char nulls[])
{
- char *tp; /* tuple pointer */
- HeapTuple tuple; /* return tuple */
- int bitmaplen;
- long len;
- int hoff;
- bool hasnull = false;
- int i;
- int numberOfAttributes = tupleDescriptor->natts;
+ char *tp; /* tuple pointer */
+ HeapTuple tuple; /* return tuple */
+ int bitmaplen;
+ long len;
+ int hoff;
+ bool hasnull = false;
+ int i;
+ int numberOfAttributes = tupleDescriptor->natts;
len = sizeof *tuple - sizeof tuple->t_bits;
@@ -885,14 +885,14 @@ heap_modifytuple(HeapTuple tuple,
char replNull[],
char repl[])
{
- int attoff;
- int numberOfAttributes;
- Datum *value;
- char *nulls;
- bool isNull;
- HeapTuple newTuple;
- int madecopy;
- uint8 infomask;
+ int attoff;
+ int numberOfAttributes;
+ Datum *value;
+ char *nulls;
+ bool isNull;
+ HeapTuple newTuple;
+ int madecopy;
+ uint8 infomask;
/* ----------------
* sanity checks
@@ -936,7 +936,7 @@ heap_modifytuple(HeapTuple tuple,
if (repl[attoff] == ' ')
{
- char *attr;
+ char *attr;
attr =
heap_getattr(tuple,
@@ -1001,10 +1001,10 @@ heap_addheader(uint32 natts, /* max domain index */
int structlen, /* its length */
char *structure) /* pointer to the struct */
{
- register char *tp; /* tuple data pointer */
- HeapTuple tup;
- long len;
- int hoff;
+ register char *tp; /* tuple data pointer */
+ HeapTuple tup;
+ long len;
+ int hoff;
AssertArg(natts > 0);
diff --git a/src/backend/access/common/heapvalid.c b/src/backend/access/common/heapvalid.c
index 0caeb54e17..ce0cb58d7d 100644
--- a/src/backend/access/common/heapvalid.c
+++ b/src/backend/access/common/heapvalid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.17 1997/09/07 04:37:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/heapvalid.c,v 1.18 1997/09/08 02:19:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,9 +36,9 @@ heap_keytest(HeapTuple t,
int nkeys,
ScanKey keys)
{
- bool isnull;
- Datum atp;
- int test;
+ bool isnull;
+ Datum atp;
+ int test;
for (; nkeys--; keys++)
{
@@ -101,11 +101,11 @@ heap_tuple_satisfies(ItemId itemId,
int nKeys,
ScanKey key)
{
- HeapTuple tuple,
- result;
- bool res;
- TransactionId old_tmin,
- old_tmax;
+ HeapTuple tuple,
+ result;
+ bool res;
+ TransactionId old_tmin,
+ old_tmax;
if (!ItemIdIsUsed(itemId))
return NULL;
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index c133693801..e0a6e2ba5c 100644
--- a/src/backend/access/common/indextuple.c
+++ b/src/backend/access/common/indextuple.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.16 1997/09/07 04:37:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.17 1997/09/08 02:19:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,8 +26,8 @@
#include <string.h>
#endif
-static Size IndexInfoFindDataOffset(unsigned short t_info);
-static char *
+static Size IndexInfoFindDataOffset(unsigned short t_info);
+static char *
fastgetiattr(IndexTuple tup, int attnum,
TupleDesc att, bool * isnull);
@@ -45,15 +45,15 @@ index_formtuple(TupleDesc tupleDescriptor,
Datum value[],
char null[])
{
- register char *tp; /* tuple pointer */
- IndexTuple tuple; /* return tuple */
- Size size,
- hoff;
- int i;
- unsigned short infomask = 0;
- bool hasnull = false;
- char tupmask = 0;
- int numberOfAttributes = tupleDescriptor->natts;
+ register char *tp; /* tuple pointer */
+ IndexTuple tuple; /* return tuple */
+ Size size,
+ hoff;
+ int i;
+ unsigned short infomask = 0;
+ bool hasnull = false;
+ char tupmask = 0;
+ int numberOfAttributes = tupleDescriptor->natts;
if (numberOfAttributes > MaxIndexAttributeNumber)
elog(WARN, "index_formtuple: numberOfAttributes of %d > %d",
@@ -133,16 +133,16 @@ index_formtuple(TupleDesc tupleDescriptor,
* the same attribute descriptor will go much quicker. -cim 5/4/91
* ----------------
*/
-static char *
+static char *
fastgetiattr(IndexTuple tup,
int attnum,
TupleDesc tupleDesc,
bool * isnull)
{
- register char *tp; /* ptr to att in tuple */
- register char *bp = NULL; /* ptr to att in tuple */
- int slow; /* do we have to walk nulls? */
- register int data_off; /* tuple data offset */
+ register char *tp; /* ptr to att in tuple */
+ register char *bp = NULL; /* ptr to att in tuple */
+ int slow; /* do we have to walk nulls? */
+ register int data_off; /* tuple data offset */
AttributeTupleForm *att = tupleDesc->attrs;
/* ----------------
@@ -212,11 +212,11 @@ fastgetiattr(IndexTuple tup,
* ----------------
*/
{
- register int i = 0; /* current offset in bp */
- register int mask; /* bit in byte we're looking at */
- register char n; /* current byte in bp */
- register int byte,
- finalbit;
+ register int i = 0; /* current offset in bp */
+ register int mask; /* bit in byte we're looking at */
+ register char n; /* current byte in bp */
+ register int byte,
+ finalbit;
byte = attnum >> 3;
finalbit = attnum & 0x07;
@@ -256,7 +256,7 @@ fastgetiattr(IndexTuple tup,
}
else if (!IndexTupleAllFixed(tup))
{
- register int j = 0;
+ register int j = 0;
for (j = 0; j < attnum && !slow; j++)
if (att[j]->attlen < 1)
@@ -272,8 +272,8 @@ fastgetiattr(IndexTuple tup,
if (!slow)
{
- register int j = 1;
- register long off;
+ register int j = 1;
+ register long off;
/*
* need to set cache for some atts
@@ -297,26 +297,26 @@ fastgetiattr(IndexTuple tup,
switch (att[j]->attlen)
{
- case -1:
- off = (att[j]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[j]->attlen > sizeof(int32))
+ case -1:
off = (att[j]->attalign == 'd') ?
- DOUBLEALIGN(off) : LONGALIGN(off);
- else
- elog(WARN, "fastgetiattr: attribute %d has len %d",
- j, att[j]->attlen);
- break;
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
+ case sizeof(char):
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off);
+ break;
+ default:
+ if (att[j]->attlen > sizeof(int32))
+ off = (att[j]->attalign == 'd') ?
+ DOUBLEALIGN(off) : LONGALIGN(off);
+ else
+ elog(WARN, "fastgetiattr: attribute %d has len %d",
+ j, att[j]->attlen);
+ break;
}
@@ -329,9 +329,9 @@ fastgetiattr(IndexTuple tup,
}
else
{
- register bool usecache = true;
- register int off = 0;
- register int i;
+ register bool usecache = true;
+ register int off = 0;
+ register int i;
/*
* Now we know that we have to walk the tuple CAREFULLY.
@@ -361,31 +361,31 @@ fastgetiattr(IndexTuple tup,
att[i]->attcacheoff = off;
switch (att[i]->attlen)
{
- case sizeof(char):
- off++;
- break;
- case sizeof(short):
- off = SHORTALIGN(off) +sizeof(short);
- break;
- case sizeof(int32):
- off = INTALIGN(off) + sizeof(int32);
- break;
- case -1:
- usecache = false;
- off = (att[i]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- off += VARSIZE(tp + off);
- break;
- default:
- if (att[i]->attlen > sizeof(int32))
+ case sizeof(char):
+ off++;
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off) +sizeof(short);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off) + sizeof(int32);
+ break;
+ case -1:
+ usecache = false;
off = (att[i]->attalign == 'd') ?
- DOUBLEALIGN(off) + att[i]->attlen :
- LONGALIGN(off) + att[i]->attlen;
- else
- elog(WARN, "fastgetiattr2: attribute %d has len %d",
- i, att[i]->attlen);
-
- break;
+ DOUBLEALIGN(off) : INTALIGN(off);
+ off += VARSIZE(tp + off);
+ break;
+ default:
+ if (att[i]->attlen > sizeof(int32))
+ off = (att[i]->attalign == 'd') ?
+ DOUBLEALIGN(off) + att[i]->attlen :
+ LONGALIGN(off) + att[i]->attlen;
+ else
+ elog(WARN, "fastgetiattr2: attribute %d has len %d",
+ i, att[i]->attlen);
+
+ break;
}
}
@@ -395,27 +395,27 @@ fastgetiattr(IndexTuple tup,
*/
switch (att[attnum]->attlen)
{
- case -1:
- off = (att[attnum]->attalign == 'd') ?
- DOUBLEALIGN(off) : INTALIGN(off);
- break;
- case sizeof(char):
- break;
- case sizeof(short):
- off = SHORTALIGN(off);
- break;
- case sizeof(int32):
- off = INTALIGN(off);
- break;
- default:
- if (att[attnum]->attlen < sizeof(int32))
- elog(WARN, "fastgetattr3: attribute %d has len %d",
- attnum, att[attnum]->attlen);
- if (att[attnum]->attalign == 'd')
- off = DOUBLEALIGN(off);
- else
- off = LONGALIGN(off);
- break;
+ case -1:
+ off = (att[attnum]->attalign == 'd') ?
+ DOUBLEALIGN(off) : INTALIGN(off);
+ break;
+ case sizeof(char):
+ break;
+ case sizeof(short):
+ off = SHORTALIGN(off);
+ break;
+ case sizeof(int32):
+ off = INTALIGN(off);
+ break;
+ default:
+ if (att[attnum]->attlen < sizeof(int32))
+ elog(WARN, "fastgetattr3: attribute %d has len %d",
+ attnum, att[attnum]->attlen);
+ if (att[attnum]->attalign == 'd')
+ off = DOUBLEALIGN(off);
+ else
+ off = LONGALIGN(off);
+ break;
}
return (fetchatt(&att[attnum], tp + off));
@@ -461,14 +461,14 @@ FormRetrieveIndexResult(ItemPointer indexItemPointer,
*
* Change me if adding an attribute to IndexTuples!!!!!!!!!!!
*/
-static Size
+static Size
IndexInfoFindDataOffset(unsigned short t_info)
{
if (!(t_info & INDEX_NULL_MASK))
return ((Size) sizeof(IndexTupleData));
else
{
- Size size = sizeof(IndexTupleData);
+ Size size = sizeof(IndexTupleData);
if (t_info & INDEX_NULL_MASK)
{
@@ -485,8 +485,8 @@ IndexInfoFindDataOffset(unsigned short t_info)
void
CopyIndexTuple(IndexTuple source, IndexTuple * target)
{
- Size size;
- IndexTuple ret;
+ Size size;
+ IndexTuple ret;
size = IndexTupleSize(source);
if (*target == NULL)
diff --git a/src/backend/access/common/indexvalid.c b/src/backend/access/common/indexvalid.c
index 9f8501beb2..5a9f351568 100644
--- a/src/backend/access/common/indexvalid.c
+++ b/src/backend/access/common/indexvalid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.15 1997/09/07 04:37:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/Attic/indexvalid.c,v 1.16 1997/09/08 02:19:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
* index scan key qualification code
* ----------------------------------------------------------------
*/
-int NIndexTupleProcessed;
+int NIndexTupleProcessed;
/* ----------------
* index_keytest
@@ -40,9 +40,9 @@ index_keytest(IndexTuple tuple,
int scanKeySize,
ScanKey key)
{
- bool isNull;
- Datum datum;
- int test;
+ bool isNull;
+ Datum datum;
+ int test;
IncrIndexProcessed();
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c
index 599ac59a45..f8ff685e38 100644
--- a/src/backend/access/common/printtup.c
+++ b/src/backend/access/common/printtup.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.16 1997/09/07 04:37:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/printtup.c,v 1.17 1997/09/08 02:19:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@
Oid
typtoout(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -52,7 +52,7 @@ typtoout(Oid type)
Oid
gettypelem(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -73,13 +73,13 @@ gettypelem(Oid type)
void
printtup(HeapTuple tuple, TupleDesc typeinfo)
{
- int i,
- j,
- k;
- char *outputstr,
- *attr;
- bool isnull;
- Oid typoutput;
+ int i,
+ j,
+ k;
+ char *outputstr,
+ *attr;
+ bool isnull;
+ Oid typoutput;
/* ----------------
* tell the frontend to expect new tuple data
@@ -158,8 +158,8 @@ printatt(unsigned attributeId,
void
showatts(char *name, TupleDesc tupleDesc)
{
- int i;
- int natts = tupleDesc->natts;
+ int i;
+ int natts = tupleDesc->natts;
AttributeTupleForm *attinfo = tupleDesc->attrs;
puts(name);
@@ -175,11 +175,11 @@ showatts(char *name, TupleDesc tupleDesc)
void
debugtup(HeapTuple tuple, TupleDesc typeinfo)
{
- register int i;
- char *attr,
- *value;
- bool isnull;
- Oid typoutput;
+ register int i;
+ char *attr,
+ *value;
+ bool isnull;
+ Oid typoutput;
for (i = 0; i < tuple->t_natts; ++i)
{
@@ -209,11 +209,11 @@ debugtup(HeapTuple tuple, TupleDesc typeinfo)
void
printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
{
- int i,
- j,
- k;
- char *attr;
- bool isnull;
+ int i,
+ j,
+ k;
+ char *attr;
+ bool isnull;
/* ----------------
* tell the frontend to expect new tuple data
@@ -254,7 +254,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
#endif
for (i = 0; i < tuple->t_natts; ++i)
{
- int32 len = typeinfo->attrs[i]->attlen;
+ int32 len = typeinfo->attrs[i]->attlen;
attr = heap_getattr(tuple, InvalidBuffer, i + 1, typeinfo, &isnull);
if (!isnull)
@@ -269,7 +269,7 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
pq_putnchar(VARDATA(attr), len);
#ifdef IPORTAL_DEBUG
{
- char *d = VARDATA(attr);
+ char *d = VARDATA(attr);
fprintf(stderr, "length %d data %x%x%x%x\n",
len, *d, *(d + 1), *(d + 2), *(d + 3));
@@ -281,25 +281,25 @@ printtup_internal(HeapTuple tuple, TupleDesc typeinfo)
/* fixed size */
if (typeinfo->attrs[i]->attbyval)
{
- int8 i8;
- int16 i16;
- int32 i32;
+ int8 i8;
+ int16 i16;
+ int32 i32;
pq_putint(len, sizeof(int32));
switch (len)
{
- case sizeof(int8):
- i8 = DatumGetChar(attr);
- pq_putnchar((char *) &i8, len);
- break;
- case sizeof(int16):
- i16 = DatumGetInt16(attr);
- pq_putnchar((char *) &i16, len);
- break;
- case sizeof(int32):
- i32 = DatumGetInt32(attr);
- pq_putnchar((char *) &i32, len);
- break;
+ case sizeof(int8):
+ i8 = DatumGetChar(attr);
+ pq_putnchar((char *) &i8, len);
+ break;
+ case sizeof(int16):
+ i16 = DatumGetInt16(attr);
+ pq_putnchar((char *) &i16, len);
+ break;
+ case sizeof(int32):
+ i32 = DatumGetInt32(attr);
+ pq_putnchar((char *) &i32, len);
+ break;
}
#ifdef IPORTAL_DEBUG
fprintf(stderr, "byval length %d data %d\n", len, attr);
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index e616702a8e..d4b5e893bd 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.20 1997/09/07 04:37:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.21 1997/09/08 02:19:56 momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
@@ -42,8 +42,8 @@
TupleDesc
CreateTemplateTupleDesc(int natts)
{
- uint32 size;
- TupleDesc desc;
+ uint32 size;
+ TupleDesc desc;
/* ----------------
* sanity checks
@@ -77,7 +77,7 @@ CreateTemplateTupleDesc(int natts)
TupleDesc
CreateTupleDesc(int natts, AttributeTupleForm * attrs)
{
- TupleDesc desc;
+ TupleDesc desc;
/* ----------------
* sanity checks
@@ -105,9 +105,9 @@ CreateTupleDesc(int natts, AttributeTupleForm * attrs)
TupleDesc
CreateTupleDescCopy(TupleDesc tupdesc)
{
- TupleDesc desc;
- int i,
- size;
+ TupleDesc desc;
+ int i,
+ size;
desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
desc->natts = tupdesc->natts;
@@ -139,10 +139,10 @@ CreateTupleDescCopy(TupleDesc tupdesc)
TupleDesc
CreateTupleDescCopyConstr(TupleDesc tupdesc)
{
- TupleDesc desc;
- TupleConstr *constr = tupdesc->constr;
- int i,
- size;
+ TupleDesc desc;
+ TupleConstr *constr = tupdesc->constr;
+ int i,
+ size;
desc = (TupleDesc) palloc(sizeof(struct tupleDesc));
desc->natts = tupdesc->natts;
@@ -158,7 +158,7 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc)
}
if (constr)
{
- TupleConstr *cpy = (TupleConstr *) palloc(sizeof(TupleConstr));
+ TupleConstr *cpy = (TupleConstr *) palloc(sizeof(TupleConstr));
cpy->has_not_null = constr->has_not_null;
@@ -201,7 +201,7 @@ CreateTupleDescCopyConstr(TupleDesc tupdesc)
void
FreeTupleDesc(TupleDesc tupdesc)
{
- int i;
+ int i;
for (i = 0; i < tupdesc->natts; i++)
pfree(tupdesc->attrs[i]);
@@ -210,7 +210,7 @@ FreeTupleDesc(TupleDesc tupdesc)
{
if (tupdesc->constr->num_defval > 0)
{
- AttrDefault *attrdef = tupdesc->constr->defval;
+ AttrDefault *attrdef = tupdesc->constr->defval;
for (i = tupdesc->constr->num_defval - 1; i >= 0; i--)
{
@@ -223,7 +223,7 @@ FreeTupleDesc(TupleDesc tupdesc)
}
if (tupdesc->constr->num_check > 0)
{
- ConstrCheck *check = tupdesc->constr->check;
+ ConstrCheck *check = tupdesc->constr->check;
for (i = tupdesc->constr->num_check - 1; i >= 0; i--)
{
@@ -258,8 +258,8 @@ TupleDescInitEntry(TupleDesc desc,
int attdim,
bool attisset)
{
- HeapTuple tuple;
- TypeTupleForm typeForm;
+ HeapTuple tuple;
+ TypeTupleForm typeForm;
AttributeTupleForm att;
/* ----------------
@@ -378,7 +378,7 @@ TupleDescInitEntry(TupleDesc desc,
*/
if (attisset)
{
- Type t = type("oid");
+ Type t = type("oid");
att->attlen = tlen(t);
att->attbyval = tbyval(t);
@@ -411,7 +411,7 @@ TupleDescMakeSelfReference(TupleDesc desc,
char *relname)
{
AttributeTupleForm att;
- Type t = type("oid");
+ Type t = type("oid");
att = desc->attrs[attnum - 1];
att->atttypid = TypeShellMake(relname);
@@ -439,17 +439,17 @@ TupleDescMakeSelfReference(TupleDesc desc,
TupleDesc
BuildDescForRelation(List * schema, char *relname)
{
- int natts;
- AttrNumber attnum;
- List *p;
- TupleDesc desc;
- AttrDefault *attrdef = NULL;
- TupleConstr *constr = (TupleConstr *) palloc(sizeof(TupleConstr));
- char *attname;
- char *typename;
- int attdim;
- int ndef = 0;
- bool attisset;
+ int natts;
+ AttrNumber attnum;
+ List *p;
+ TupleDesc desc;
+ AttrDefault *attrdef = NULL;
+ TupleConstr *constr = (TupleConstr *) palloc(sizeof(TupleConstr));
+ char *attname;
+ char *typename;
+ int attdim;
+ int ndef = 0;
+ bool attisset;
/* ----------------
* allocate a new tuple descriptor
@@ -465,8 +465,8 @@ BuildDescForRelation(List * schema, char *relname)
foreach(p, schema)
{
- ColumnDef *entry;
- List *arry;
+ ColumnDef *entry;
+ List *arry;
/* ----------------
* for each entry in the list, get the name and type
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 598f9ed8f0..d12e4e5c6e 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -55,7 +55,7 @@ gistSplit(Relation r, Buffer buffer,
static void
gistnewroot(GISTSTATE * giststate, Relation r, IndexTuple lt,
IndexTuple rt);
-static void GISTInitBuffer(Buffer b, uint32 f);
+static void GISTInitBuffer(Buffer b, uint32 f);
static BlockNumber
gistChooseSubtree(Relation r, IndexTuple itup, int level,
GISTSTATE * giststate,
@@ -63,13 +63,13 @@ gistChooseSubtree(Relation r, IndexTuple itup, int level,
static OffsetNumber
gistchoose(Relation r, Page p, IndexTuple it,
GISTSTATE * giststate);
-static int gistnospace(Page p, IndexTuple it);
-void gistdelete(Relation r, ItemPointer tid);
+static int gistnospace(Page p, IndexTuple it);
+void gistdelete(Relation r, ItemPointer tid);
static IndexTuple gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t);
static void
gistcentryinit(GISTSTATE * giststate, GISTENTRY * e, char *pr,
Relation r, Page pg, OffsetNumber o, int b, bool l);
-static char *int_range_out(INTRANGE * r);
+static char *int_range_out(INTRANGE * r);
/*
** routine to build an index. Basically calls insert over and over
@@ -85,33 +85,33 @@ gistbuild(Relation heap,
FuncIndexInfo * finfo,
PredInfo * predInfo)
{
- HeapScanDesc scan;
- Buffer buffer;
- AttrNumber i;
- HeapTuple htup;
- IndexTuple itup;
- TupleDesc hd,
- id;
+ HeapScanDesc scan;
+ Buffer buffer;
+ AttrNumber i;
+ HeapTuple htup;
+ IndexTuple itup;
+ TupleDesc hd,
+ id;
InsertIndexResult res;
- Datum *d;
- bool *nulls;
- int nb,
- nh,
- ni;
+ Datum *d;
+ bool *nulls;
+ int nb,
+ nh,
+ ni;
#ifndef OMIT_PARTIAL_INDEX
- ExprContext *econtext;
- TupleTable tupleTable;
+ ExprContext *econtext;
+ TupleTable tupleTable;
TupleTableSlot *slot;
#endif
- Oid hrelid,
- irelid;
- Node *pred,
- *oldPred;
- GISTSTATE giststate;
- GISTENTRY tmpcentry;
- bool *compvec;
+ Oid hrelid,
+ irelid;
+ Node *pred,
+ *oldPred;
+ GISTSTATE giststate;
+ GISTENTRY tmpcentry;
+ bool *compvec;
/* GiSTs only know how to do stupid locking now */
RelationSetLockForWrite(index);
@@ -220,8 +220,8 @@ gistbuild(Relation heap,
for (i = 1; i <= natts; i++)
{
- int attoff;
- bool attnull;
+ int attoff;
+ bool attnull;
/*
* Offsets are from the start of the tuple, and are
@@ -331,11 +331,11 @@ InsertIndexResult
gistinsert(Relation r, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
{
InsertIndexResult res;
- IndexTuple itup;
- GISTSTATE giststate;
- GISTENTRY tmpentry;
- int i;
- bool *compvec;
+ IndexTuple itup;
+ GISTSTATE giststate;
+ GISTENTRY tmpentry;
+ int i;
+ bool *compvec;
initGISTstate(&giststate, r);
@@ -373,7 +373,7 @@ gistinsert(Relation r, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation
** that knowledge (some compression routines may want to fish around
** on the page, for example, or do something special for leaf nodes.)
*/
-static OffsetNumber
+static OffsetNumber
gistPageAddItem(GISTSTATE * giststate,
Relation r,
Page page,
@@ -384,8 +384,8 @@ gistPageAddItem(GISTSTATE * giststate,
GISTENTRY * dentry,
IndexTuple * newtup)
{
- GISTENTRY tmpcentry;
- IndexTuple itup = (IndexTuple) item;
+ GISTENTRY tmpcentry;
+ IndexTuple itup = (IndexTuple) item;
/*
* recompress the item given that we now know the exact page and
@@ -408,20 +408,20 @@ gistPageAddItem(GISTSTATE * giststate,
}
-static InsertIndexResult
+static InsertIndexResult
gistdoinsert(Relation r,
IndexTuple itup, /* itup contains compressed entry */
GISTSTATE * giststate)
{
- GISTENTRY tmpdentry;
+ GISTENTRY tmpdentry;
InsertIndexResult res;
- OffsetNumber l;
- GISTSTACK *stack;
- Buffer buffer;
- BlockNumber blk;
- Page page;
- OffsetNumber off;
- IndexTuple newtup;
+ OffsetNumber l;
+ GISTSTACK *stack;
+ Buffer buffer;
+ BlockNumber blk;
+ Page page;
+ OffsetNumber off;
+ IndexTuple newtup;
/* 3rd arg is ignored for now */
blk = gistChooseSubtree(r, itup, 0, giststate, &stack, &buffer);
@@ -464,7 +464,7 @@ gistdoinsert(Relation r,
}
-static BlockNumber
+static BlockNumber
gistChooseSubtree(Relation r, IndexTuple itup, /* itup has compressed
* entry */
int level,
@@ -472,12 +472,12 @@ gistChooseSubtree(Relation r, IndexTuple itup, /* itup has compressed
GISTSTACK ** retstack /* out */ ,
Buffer * leafbuf /* out */ )
{
- Buffer buffer;
- BlockNumber blk;
- GISTSTACK *stack;
- Page page;
- GISTPageOpaque opaque;
- IndexTuple which;
+ Buffer buffer;
+ BlockNumber blk;
+ GISTSTACK *stack;
+ Page page;
+ GISTPageOpaque opaque;
+ IndexTuple which;
blk = GISTP_ROOT;
buffer = InvalidBuffer;
@@ -496,8 +496,8 @@ gistChooseSubtree(Relation r, IndexTuple itup, /* itup has compressed
opaque = (GISTPageOpaque) PageGetSpecialPointer(page);
if (!(opaque->flags & F_LEAF))
{
- GISTSTACK *n;
- ItemId iid;
+ GISTSTACK *n;
+ ItemId iid;
n = (GISTSTACK *) palloc(sizeof(GISTSTACK));
n->gs_parent = stack;
@@ -526,17 +526,17 @@ gistAdjustKeys(Relation r,
int att_size,
GISTSTATE * giststate)
{
- char *oldud;
- Page p;
- Buffer b;
- bool result;
- bytea *evec;
- GISTENTRY centry,
- *ev0p,
- *ev1p;
- int size,
- datumsize;
- IndexTuple tid;
+ char *oldud;
+ Page p;
+ Buffer b;
+ bool result;
+ bytea *evec;
+ GISTENTRY centry,
+ *ev0p,
+ *ev1p;
+ int size,
+ datumsize;
+ IndexTuple tid;
if (stk == (GISTSTACK *) NULL)
return;
@@ -570,7 +570,7 @@ gistAdjustKeys(Relation r,
(giststate->equalFn) (ev0p->pred, datum, &result);
if (!result)
{
- TupleDesc td = RelationGetTupleDescriptor(r);
+ TupleDesc td = RelationGetTupleDescriptor(r);
/* compress datum for storage on page */
gistcentryinit(giststate, &centry, datum, ev0p->rel, ev0p->page,
@@ -595,10 +595,10 @@ gistAdjustKeys(Relation r,
* delete the old entry and insert the new * one. Note that
* this may cause a split here!
*/
- IndexTuple newtup;
+ IndexTuple newtup;
ItemPointerData oldtid;
- char *isnull;
- TupleDesc tupDesc;
+ char *isnull;
+ TupleDesc tupDesc;
InsertIndexResult res;
/* delete old tuple */
@@ -641,41 +641,41 @@ gistAdjustKeys(Relation r,
* gistSplit -- split a page in the tree.
*
*/
-static InsertIndexResult
+static InsertIndexResult
gistSplit(Relation r,
Buffer buffer,
GISTSTACK * stack,
IndexTuple itup, /* contains compressed entry */
GISTSTATE * giststate)
{
- Page p;
- Buffer leftbuf,
- rightbuf;
- Page left,
- right;
- ItemId itemid;
- IndexTuple item;
- IndexTuple ltup,
- rtup,
- newtup;
- OffsetNumber maxoff;
- OffsetNumber i;
- OffsetNumber leftoff,
- rightoff;
- BlockNumber lbknum,
- rbknum;
- BlockNumber bufblock;
- GISTPageOpaque opaque;
- int blank;
+ Page p;
+ Buffer leftbuf,
+ rightbuf;
+ Page left,
+ right;
+ ItemId itemid;
+ IndexTuple item;
+ IndexTuple ltup,
+ rtup,
+ newtup;
+ OffsetNumber maxoff;
+ OffsetNumber i;
+ OffsetNumber leftoff,
+ rightoff;
+ BlockNumber lbknum,
+ rbknum;
+ BlockNumber bufblock;
+ GISTPageOpaque opaque;
+ int blank;
InsertIndexResult res;
- char *isnull;
- GIST_SPLITVEC v;
- TupleDesc tupDesc;
- bytea *entryvec;
- bool *decompvec;
- IndexTuple item_1;
- GISTENTRY tmpdentry,
- tmpentry;
+ char *isnull;
+ GIST_SPLITVEC v;
+ TupleDesc tupDesc;
+ bytea *entryvec;
+ bool *decompvec;
+ IndexTuple item_1;
+ GISTENTRY tmpdentry,
+ tmpentry;
isnull = (char *) palloc(r->rd_rel->relnatts);
for (blank = 0; blank < r->rd_rel->relnatts; blank++)
@@ -911,11 +911,11 @@ static void
gistentryinserttwo(Relation r, GISTSTACK * stk, IndexTuple ltup,
IndexTuple rtup, GISTSTATE * giststate)
{
- Buffer b;
- Page p;
+ Buffer b;
+ Page p;
InsertIndexResult res;
- GISTENTRY tmpentry;
- IndexTuple newtup;
+ GISTENTRY tmpentry;
+ IndexTuple newtup;
b = ReadBuffer(r, stk->gs_blk);
p = BufferGetPage(b);
@@ -949,16 +949,16 @@ gistentryinserttwo(Relation r, GISTSTACK * stk, IndexTuple ltup,
/*
** Insert an entry onto a page
*/
-static InsertIndexResult
+static InsertIndexResult
gistentryinsert(Relation r, GISTSTACK * stk, IndexTuple tup,
GISTSTATE * giststate)
{
- Buffer b;
- Page p;
+ Buffer b;
+ Page p;
InsertIndexResult res;
- OffsetNumber off;
- GISTENTRY tmpentry;
- IndexTuple newtup;
+ OffsetNumber off;
+ GISTENTRY tmpentry;
+ IndexTuple newtup;
b = ReadBuffer(r, stk->gs_blk);
p = BufferGetPage(b);
@@ -992,10 +992,10 @@ gistentryinsert(Relation r, GISTSTACK * stk, IndexTuple tup,
static void
gistnewroot(GISTSTATE * giststate, Relation r, IndexTuple lt, IndexTuple rt)
{
- Buffer b;
- Page p;
- GISTENTRY tmpentry;
- IndexTuple newtup;
+ Buffer b;
+ Page p;
+ GISTENTRY tmpentry;
+ IndexTuple newtup;
b = ReadBuffer(r, GISTP_ROOT);
GISTInitBuffer(b, 0);
@@ -1022,9 +1022,9 @@ gistnewroot(GISTSTATE * giststate, Relation r, IndexTuple lt, IndexTuple rt)
static void
GISTInitBuffer(Buffer b, uint32 f)
{
- GISTPageOpaque opaque;
- Page page;
- Size pageSize;
+ GISTPageOpaque opaque;
+ Page page;
+ Size pageSize;
pageSize = BufferGetPageSize(b);
@@ -1040,21 +1040,21 @@ GISTInitBuffer(Buffer b, uint32 f)
/*
** find entry with lowest penalty
*/
-static OffsetNumber
+static OffsetNumber
gistchoose(Relation r, Page p, IndexTuple it, /* it has compressed entry */
GISTSTATE * giststate)
{
- OffsetNumber maxoff;
- OffsetNumber i;
- char *id;
- char *datum;
- float usize;
- OffsetNumber which;
- float which_grow;
- GISTENTRY entry,
- identry;
- int size,
- idsize;
+ OffsetNumber maxoff;
+ OffsetNumber i;
+ char *id;
+ char *datum;
+ float usize;
+ OffsetNumber which;
+ float which_grow;
+ GISTENTRY entry,
+ identry;
+ int size,
+ idsize;
idsize = IndexTupleSize(it) - sizeof(IndexTupleData);
id = ((char *) it) + sizeof(IndexTupleData);
@@ -1097,7 +1097,7 @@ gistnospace(Page p, IndexTuple it)
void
gistfreestack(GISTSTACK * s)
{
- GISTSTACK *p;
+ GISTSTACK *p;
while (s != (GISTSTACK *) NULL)
{
@@ -1114,10 +1114,10 @@ gistfreestack(GISTSTACK * s)
void
gistdelete(Relation r, ItemPointer tid)
{
- BlockNumber blkno;
- OffsetNumber offnum;
- Buffer buf;
- Page page;
+ BlockNumber blkno;
+ OffsetNumber offnum;
+ Buffer buf;
+ Page page;
/* must write-lock on delete */
RelationSetLockForWrite(r);
@@ -1142,17 +1142,17 @@ gistdelete(Relation r, ItemPointer tid)
void
initGISTstate(GISTSTATE * giststate, Relation index)
{
- RegProcedure consistent_proc,
- union_proc,
- compress_proc,
- decompress_proc;
- RegProcedure penalty_proc,
- picksplit_proc,
- equal_proc;
- func_ptr user_fn;
- int pronargs;
- HeapTuple htup;
- IndexTupleForm itupform;
+ RegProcedure consistent_proc,
+ union_proc,
+ compress_proc,
+ decompress_proc;
+ RegProcedure penalty_proc,
+ picksplit_proc,
+ equal_proc;
+ func_ptr user_fn;
+ int pronargs;
+ HeapTuple htup;
+ IndexTupleForm itupform;
consistent_proc = index_getprocid(index, 1, GIST_CONSISTENT_PROC);
union_proc = index_getprocid(index, 1, GIST_UNION_PROC);
@@ -1209,10 +1209,10 @@ initGISTstate(GISTSTATE * giststate, Relation index)
** the key with another key, which may involve generating a new IndexTuple
** if the sizes don't match
*/
-static IndexTuple
+static IndexTuple
gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
{
- char *datum = (((char *) t) + sizeof(IndexTupleData));
+ char *datum = (((char *) t) + sizeof(IndexTupleData));
/* if new entry fits in index tuple, copy it in */
if (entry.bytes < IndexTupleSize(t) - sizeof(IndexTupleData))
@@ -1228,10 +1228,10 @@ gist_tuple_replacekey(Relation r, GISTENTRY entry, IndexTuple t)
else
{
/* generate a new index tuple for the compressed entry */
- TupleDesc tupDesc = r->rd_att;
- IndexTuple newtup;
- char *isnull;
- int blank;
+ TupleDesc tupDesc = r->rd_att;
+ IndexTuple newtup;
+ char *isnull;
+ int blank;
isnull = (char *) palloc(r->rd_rel->relnatts);
for (blank = 0; blank < r->rd_rel->relnatts; blank++)
@@ -1253,7 +1253,7 @@ void
gistdentryinit(GISTSTATE * giststate, GISTENTRY * e, char *pr, Relation r,
Page pg, OffsetNumber o, int b, bool l)
{
- GISTENTRY *dep;
+ GISTENTRY *dep;
gistentryinit(*e, pr, r, pg, o, b, l);
if (giststate->haskeytype)
@@ -1274,7 +1274,7 @@ static void
gistcentryinit(GISTSTATE * giststate, GISTENTRY * e, char *pr, Relation r,
Page pg, OffsetNumber o, int b, bool l)
{
- GISTENTRY *cep;
+ GISTENTRY *cep;
gistentryinit(*e, pr, r, pg, o, b, l);
if (giststate->haskeytype)
@@ -1299,18 +1299,18 @@ gistcentryinit(GISTSTATE * giststate, GISTENTRY * e, char *pr, Relation r,
void
_gistdump(Relation r)
{
- Buffer buf;
- Page page;
- OffsetNumber offnum,
- maxoff;
- BlockNumber blkno;
- BlockNumber nblocks;
- GISTPageOpaque po;
- IndexTuple itup;
- BlockNumber itblkno;
- OffsetNumber itoffno;
- char *datum;
- char *itkey;
+ Buffer buf;
+ Page page;
+ OffsetNumber offnum,
+ maxoff;
+ BlockNumber blkno;
+ BlockNumber nblocks;
+ GISTPageOpaque po;
+ IndexTuple itup;
+ BlockNumber itblkno;
+ OffsetNumber itoffno;
+ char *datum;
+ char *itkey;
nblocks = RelationGetNumberOfBlocks(r);
for (blkno = 0; blkno < nblocks; blkno++)
@@ -1350,12 +1350,12 @@ _gistdump(Relation r)
}
#ifdef NOT_USED
-static char *
+static char *
text_range_out(TXTRANGE * r)
{
- char *result;
- char *lower,
- *upper;
+ char *result;
+ char *lower,
+ *upper;
if (r == NULL)
return (NULL);
@@ -1377,10 +1377,10 @@ text_range_out(TXTRANGE * r)
#endif
-static char *
+static char *
int_range_out(INTRANGE * r)
{
- char *result;
+ char *result;
if (r == NULL)
return (NULL);
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index cad4cef267..0820389ff4 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -62,19 +62,19 @@ gistgettuple(IndexScanDesc s, ScanDirection dir)
return (res);
}
-static RetrieveIndexResult
+static RetrieveIndexResult
gistfirst(IndexScanDesc s, ScanDirection dir)
{
- Buffer b;
- Page p;
- OffsetNumber n;
- OffsetNumber maxoff;
+ Buffer b;
+ Page p;
+ OffsetNumber n;
+ OffsetNumber maxoff;
RetrieveIndexResult res;
- GISTPageOpaque po;
- GISTScanOpaque so;
- GISTSTACK *stk;
- BlockNumber blk;
- IndexTuple it;
+ GISTPageOpaque po;
+ GISTScanOpaque so;
+ GISTSTACK *stk;
+ BlockNumber blk;
+ IndexTuple it;
b = ReadBuffer(s->relation, GISTP_ROOT);
p = BufferGetPage(b);
@@ -145,19 +145,19 @@ gistfirst(IndexScanDesc s, ScanDirection dir)
}
}
-static RetrieveIndexResult
+static RetrieveIndexResult
gistnext(IndexScanDesc s, ScanDirection dir)
{
- Buffer b;
- Page p;
- OffsetNumber n;
- OffsetNumber maxoff;
+ Buffer b;
+ Page p;
+ OffsetNumber n;
+ OffsetNumber maxoff;
RetrieveIndexResult res;
- GISTPageOpaque po;
- GISTScanOpaque so;
- GISTSTACK *stk;
- BlockNumber blk;
- IndexTuple it;
+ GISTPageOpaque po;
+ GISTScanOpaque so;
+ GISTSTACK *stk;
+ BlockNumber blk;
+ IndexTuple it;
blk = ItemPointerGetBlockNumber(&(s->currentItemData));
n = ItemPointerGetOffsetNumber(&(s->currentItemData));
@@ -247,7 +247,7 @@ gistnext(IndexScanDesc s, ScanDirection dir)
}
/* Similar to index_keytest, but decompresses the key in the IndexTuple */
-static bool
+static bool
gistindex_keytest(IndexTuple tuple,
TupleDesc tupdesc,
int scanKeySize,
@@ -257,10 +257,10 @@ gistindex_keytest(IndexTuple tuple,
Page p,
OffsetNumber offset)
{
- bool isNull;
- Datum datum;
- int test;
- GISTENTRY de;
+ bool isNull;
+ Datum datum;
+ int test;
+ GISTENTRY de;
IncrIndexProcessed();
@@ -308,14 +308,14 @@ gistindex_keytest(IndexTuple tuple,
}
-static OffsetNumber
+static OffsetNumber
gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
{
- OffsetNumber maxoff;
- char *it;
- GISTPageOpaque po;
- GISTScanOpaque so;
- GISTSTATE *giststate;
+ OffsetNumber maxoff;
+ char *it;
+ GISTPageOpaque po;
+ GISTScanOpaque so;
+ GISTSTATE *giststate;
maxoff = PageGetMaxOffsetNumber(p);
po = (GISTPageOpaque) PageGetSpecialPointer(p);
@@ -355,11 +355,11 @@ gistfindnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
return (n);
}
-static RetrieveIndexResult
+static RetrieveIndexResult
gistscancache(IndexScanDesc s, ScanDirection dir)
{
RetrieveIndexResult res;
- ItemPointer ip;
+ ItemPointer ip;
if (!(ScanDirectionIsNoMovement(dir)
&& ItemPointerIsValid(&(s->currentItemData))))
@@ -384,14 +384,14 @@ gistscancache(IndexScanDesc s, ScanDirection dir)
* gistheapptr returns the item pointer to the tuple in the heap relation
* for which itemp is the index relation item pointer.
*/
-static ItemPointer
+static ItemPointer
gistheapptr(Relation r, ItemPointer itemp)
{
- Buffer b;
- Page p;
- IndexTuple it;
- ItemPointer ip;
- OffsetNumber n;
+ Buffer b;
+ Page p;
+ IndexTuple it;
+ ItemPointer ip;
+ OffsetNumber n;
ip = (ItemPointer) palloc(sizeof(ItemPointerData));
if (ItemPointerIsValid(itemp))
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c
index ec680558d8..6707099775 100644
--- a/src/backend/access/gist/gistscan.c
+++ b/src/backend/access/gist/gistscan.c
@@ -27,8 +27,8 @@
#endif
/* routines defined and used here */
-static void gistregscan(IndexScanDesc s);
-static void gistdropscan(IndexScanDesc s);
+static void gistregscan(IndexScanDesc s);
+static void gistdropscan(IndexScanDesc s);
static void
gistadjone(IndexScanDesc s, int op, BlockNumber blkno,
OffsetNumber offnum);
@@ -51,9 +51,9 @@ adjustiptr(IndexScanDesc s, ItemPointer iptr,
typedef struct GISTScanListData
{
- IndexScanDesc gsl_scan;
+ IndexScanDesc gsl_scan;
struct GISTScanListData *gsl_next;
-} GISTScanListData;
+} GISTScanListData;
typedef GISTScanListData *GISTScanList;
@@ -66,7 +66,7 @@ gistbeginscan(Relation r,
uint16 nkeys,
ScanKey key)
{
- IndexScanDesc s;
+ IndexScanDesc s;
RelationSetLockForRead(r);
s = RelationGetIndexScan(r, fromEnd, nkeys, key);
@@ -78,8 +78,8 @@ gistbeginscan(Relation r,
void
gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
{
- GISTScanOpaque p;
- int i;
+ GISTScanOpaque p;
+ int i;
if (!IndexScanIsValid(s))
{
@@ -173,10 +173,10 @@ gistrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
void
gistmarkpos(IndexScanDesc s)
{
- GISTScanOpaque p;
- GISTSTACK *o,
- *n,
- *tmp;
+ GISTScanOpaque p;
+ GISTSTACK *o,
+ *n,
+ *tmp;
s->currentMarkData = s->currentItemData;
p = (GISTScanOpaque) s->opaque;
@@ -206,10 +206,10 @@ gistmarkpos(IndexScanDesc s)
void
gistrestrpos(IndexScanDesc s)
{
- GISTScanOpaque p;
- GISTSTACK *o,
- *n,
- *tmp;
+ GISTScanOpaque p;
+ GISTSTACK *o,
+ *n,
+ *tmp;
s->currentItemData = s->currentMarkData;
p = (GISTScanOpaque) s->opaque;
@@ -239,7 +239,7 @@ gistrestrpos(IndexScanDesc s)
void
gistendscan(IndexScanDesc s)
{
- GISTScanOpaque p;
+ GISTScanOpaque p;
p = (GISTScanOpaque) s->opaque;
@@ -257,7 +257,7 @@ gistendscan(IndexScanDesc s)
static void
gistregscan(IndexScanDesc s)
{
- GISTScanList l;
+ GISTScanList l;
l = (GISTScanList) palloc(sizeof(GISTScanListData));
l->gsl_scan = s;
@@ -268,8 +268,8 @@ gistregscan(IndexScanDesc s)
static void
gistdropscan(IndexScanDesc s)
{
- GISTScanList l;
- GISTScanList prev;
+ GISTScanList l;
+ GISTScanList prev;
prev = (GISTScanList) NULL;
@@ -294,8 +294,8 @@ gistdropscan(IndexScanDesc s)
void
gistadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum)
{
- GISTScanList l;
- Oid relid;
+ GISTScanList l;
+ Oid relid;
relid = r->rd_id;
for (l = GISTScans; l != (GISTScanList) NULL; l = l->gsl_next)
@@ -321,7 +321,7 @@ gistadjone(IndexScanDesc s,
BlockNumber blkno,
OffsetNumber offnum)
{
- GISTScanOpaque so;
+ GISTScanOpaque so;
adjustiptr(s, &(s->currentItemData), op, blkno, offnum);
adjustiptr(s, &(s->currentMarkData), op, blkno, offnum);
@@ -349,8 +349,8 @@ adjustiptr(IndexScanDesc s,
BlockNumber blkno,
OffsetNumber offnum)
{
- OffsetNumber curoff;
- GISTScanOpaque so;
+ OffsetNumber curoff;
+ GISTScanOpaque so;
if (ItemPointerIsValid(iptr))
{
@@ -361,39 +361,43 @@ adjustiptr(IndexScanDesc s,
switch (op)
{
- case GISTOP_DEL:
- /* back up one if we need to */
- if (curoff >= offnum)
- {
-
- if (curoff > FirstOffsetNumber)
- {
- /* just adjust the item pointer */
- ItemPointerSet(iptr, blkno, OffsetNumberPrev(curoff));
- }
- else
+ case GISTOP_DEL:
+ /* back up one if we need to */
+ if (curoff >= offnum)
{
- /* remember that we're before the current tuple */
- ItemPointerSet(iptr, blkno, FirstOffsetNumber);
- if (iptr == &(s->currentItemData))
- so->s_flags |= GS_CURBEFORE;
+
+ if (curoff > FirstOffsetNumber)
+ {
+ /* just adjust the item pointer */
+ ItemPointerSet(iptr, blkno, OffsetNumberPrev(curoff));
+ }
else
- so->s_flags |= GS_MRKBEFORE;
+ {
+
+ /*
+ * remember that we're before the current
+ * tuple
+ */
+ ItemPointerSet(iptr, blkno, FirstOffsetNumber);
+ if (iptr == &(s->currentItemData))
+ so->s_flags |= GS_CURBEFORE;
+ else
+ so->s_flags |= GS_MRKBEFORE;
+ }
}
- }
- break;
-
- case GISTOP_SPLIT:
- /* back to start of page on split */
- ItemPointerSet(iptr, blkno, FirstOffsetNumber);
- if (iptr == &(s->currentItemData))
- so->s_flags &= ~GS_CURBEFORE;
- else
- so->s_flags &= ~GS_MRKBEFORE;
- break;
-
- default:
- elog(WARN, "Bad operation in GiST scan adjust: %d", op);
+ break;
+
+ case GISTOP_SPLIT:
+ /* back to start of page on split */
+ ItemPointerSet(iptr, blkno, FirstOffsetNumber);
+ if (iptr == &(s->currentItemData))
+ so->s_flags &= ~GS_CURBEFORE;
+ else
+ so->s_flags &= ~GS_MRKBEFORE;
+ break;
+
+ default:
+ elog(WARN, "Bad operation in GiST scan adjust: %d", op);
}
}
}
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index e13539c4ad..97e1a631a1 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.13 1997/09/07 04:37:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.14 1997/09/08 02:20:10 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -31,7 +31,7 @@
#include <string.h>
#endif
-bool BuildingHash = false;
+bool BuildingHash = false;
/*
* hashbuild() -- build a new hash index.
@@ -52,30 +52,30 @@ hashbuild(Relation heap,
FuncIndexInfo * finfo,
PredInfo * predInfo)
{
- HeapScanDesc hscan;
- Buffer buffer;
- HeapTuple htup;
- IndexTuple itup;
- TupleDesc htupdesc,
- itupdesc;
- Datum *attdata;
- bool *nulls;
+ HeapScanDesc hscan;
+ Buffer buffer;
+ HeapTuple htup;
+ IndexTuple itup;
+ TupleDesc htupdesc,
+ itupdesc;
+ Datum *attdata;
+ bool *nulls;
InsertIndexResult res;
- int nhtups,
- nitups;
- int i;
- HashItem hitem;
+ int nhtups,
+ nitups;
+ int i;
+ HashItem hitem;
#ifndef OMIT_PARTIAL_INDEX
- ExprContext *econtext;
- TupleTable tupleTable;
+ ExprContext *econtext;
+ TupleTable tupleTable;
TupleTableSlot *slot;
#endif
- Oid hrelid,
- irelid;
- Node *pred,
- *oldPred;
+ Oid hrelid,
+ irelid;
+ Node *pred,
+ *oldPred;
/* note that this is a new btree */
BuildingHash = true;
@@ -171,8 +171,8 @@ hashbuild(Relation heap,
*/
for (i = 1; i <= natts; i++)
{
- int attoff;
- bool attnull;
+ int attoff;
+ bool attnull;
/*
* Offsets are from the start of the tuple, and are
@@ -280,8 +280,8 @@ hashbuild(Relation heap,
InsertIndexResult
hashinsert(Relation rel, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
{
- HashItem hitem;
- IndexTuple itup;
+ HashItem hitem;
+ IndexTuple itup;
InsertIndexResult res;
@@ -306,7 +306,7 @@ hashinsert(Relation rel, Datum * datum, char *nulls, ItemPointer ht_ctid, Relati
/*
* hashgettuple() -- Get the next tuple in the scan.
*/
-char *
+char *
hashgettuple(IndexScanDesc scan, ScanDirection dir)
{
RetrieveIndexResult res;
@@ -329,14 +329,14 @@ hashgettuple(IndexScanDesc scan, ScanDirection dir)
/*
* hashbeginscan() -- start a scan on a hash index
*/
-char *
+char *
hashbeginscan(Relation rel,
bool fromEnd,
uint16 keysz,
ScanKey scankey)
{
- IndexScanDesc scan;
- HashScanOpaque so;
+ IndexScanDesc scan;
+ HashScanOpaque so;
scan = RelationGetIndexScan(rel, fromEnd, keysz, scankey);
so = (HashScanOpaque) palloc(sizeof(HashScanOpaqueData));
@@ -356,8 +356,8 @@ hashbeginscan(Relation rel,
void
hashrescan(IndexScanDesc scan, bool fromEnd, ScanKey scankey)
{
- ItemPointer iptr;
- HashScanOpaque so;
+ ItemPointer iptr;
+ HashScanOpaque so;
so = (HashScanOpaque) scan->opaque;
@@ -391,8 +391,8 @@ void
hashendscan(IndexScanDesc scan)
{
- ItemPointer iptr;
- HashScanOpaque so;
+ ItemPointer iptr;
+ HashScanOpaque so;
so = (HashScanOpaque) scan->opaque;
@@ -426,8 +426,8 @@ hashendscan(IndexScanDesc scan)
void
hashmarkpos(IndexScanDesc scan)
{
- ItemPointer iptr;
- HashScanOpaque so;
+ ItemPointer iptr;
+ HashScanOpaque so;
/*
* see if we ever call this code. if we do, then so_mrkbuf a useful
@@ -463,8 +463,8 @@ hashmarkpos(IndexScanDesc scan)
void
hashrestrpos(IndexScanDesc scan)
{
- ItemPointer iptr;
- HashScanOpaque so;
+ ItemPointer iptr;
+ HashScanOpaque so;
/*
* see if we ever call this code. if we do, then so_mrkbuf a useful
diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c
index a3cbaa1a94..1178586769 100644
--- a/src/backend/access/hash/hashfunc.c
+++ b/src/backend/access/hash/hashfunc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.4 1997/09/07 04:37:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.5 1997/09/08 02:20:13 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -36,10 +36,10 @@ hashint4(uint32 key)
uint32
hashfloat4(float32 keyp)
{
- int len;
- int loop;
- uint32 h;
- char *kp = (char *) keyp;
+ int len;
+ int loop;
+ uint32 h;
+ char *kp = (char *) keyp;
len = sizeof(float32data);
@@ -55,25 +55,25 @@ hashfloat4(float32 keyp)
switch (len & (8 - 1))
{
- case 0:
- do
- { /* All fall throughs */
- HASH4;
- case 7:
- HASH4;
- case 6:
- HASH4;
- case 5:
- HASH4;
- case 4:
- HASH4;
- case 3:
- HASH4;
- case 2:
- HASH4;
- case 1:
- HASH4;
- } while (--loop);
+ case 0:
+ do
+ { /* All fall throughs */
+ HASH4;
+ case 7:
+ HASH4;
+ case 6:
+ HASH4;
+ case 5:
+ HASH4;
+ case 4:
+ HASH4;
+ case 3:
+ HASH4;
+ case 2:
+ HASH4;
+ case 1:
+ HASH4;
+ } while (--loop);
}
}
return (h);
@@ -83,10 +83,10 @@ hashfloat4(float32 keyp)
uint32
hashfloat8(float64 keyp)
{
- int len;
- int loop;
- uint32 h;
- char *kp = (char *) keyp;
+ int len;
+ int loop;
+ uint32 h;
+ char *kp = (char *) keyp;
len = sizeof(float64data);
@@ -102,25 +102,25 @@ hashfloat8(float64 keyp)
switch (len & (8 - 1))
{
- case 0:
- do
- { /* All fall throughs */
- HASH4;
- case 7:
- HASH4;
- case 6:
- HASH4;
- case 5:
- HASH4;
- case 4:
- HASH4;
- case 3:
- HASH4;
- case 2:
- HASH4;
- case 1:
- HASH4;
- } while (--loop);
+ case 0:
+ do
+ { /* All fall throughs */
+ HASH4;
+ case 7:
+ HASH4;
+ case 6:
+ HASH4;
+ case 5:
+ HASH4;
+ case 4:
+ HASH4;
+ case 3:
+ HASH4;
+ case 2:
+ HASH4;
+ case 1:
+ HASH4;
+ } while (--loop);
}
}
return (h);
@@ -137,8 +137,8 @@ hashoid(Oid key)
uint32
hashchar(char key)
{
- int len;
- uint32 h;
+ int len;
+ uint32 h;
len = sizeof(char);
@@ -156,9 +156,9 @@ hashchar(char key)
uint32
hashchar2(uint16 intkey)
{
- uint32 h;
- int len;
- char *key = (char *) &intkey;
+ uint32 h;
+ int len;
+ char *key = (char *) &intkey;
h = 0;
len = sizeof(uint16);
@@ -173,9 +173,9 @@ hashchar2(uint16 intkey)
uint32
hashchar4(uint32 intkey)
{
- uint32 h;
- int len;
- char *key = (char *) &intkey;
+ uint32 h;
+ int len;
+ char *key = (char *) &intkey;
h = 0;
len = sizeof(uint32);
@@ -190,8 +190,8 @@ hashchar4(uint32 intkey)
uint32
hashchar8(char *key)
{
- uint32 h;
- int len;
+ uint32 h;
+ int len;
h = 0;
len = sizeof(char8);
@@ -206,9 +206,9 @@ hashchar8(char *key)
uint32
hashname(NameData * n)
{
- uint32 h;
- int len;
- char *key;
+ uint32 h;
+ int len;
+ char *key;
key = n->data;
@@ -226,8 +226,8 @@ hashname(NameData * n)
uint32
hashchar16(char *key)
{
- uint32 h;
- int len;
+ uint32 h;
+ int len;
h = 0;
len = sizeof(char16);
@@ -254,10 +254,10 @@ hashchar16(char *key)
uint32
hashtext(struct varlena * key)
{
- int keylen;
- char *keydata;
- uint32 n;
- int loop;
+ int keylen;
+ char *keydata;
+ uint32 n;
+ int loop;
keydata = VARDATA(key);
keylen = VARSIZE(key);
@@ -274,25 +274,25 @@ hashtext(struct varlena * key)
switch (keylen & (8 - 1))
{
- case 0:
- do
- { /* All fall throughs */
- HASHC;
- case 7:
- HASHC;
- case 6:
- HASHC;
- case 5:
- HASHC;
- case 4:
- HASHC;
- case 3:
- HASHC;
- case 2:
- HASHC;
- case 1:
- HASHC;
- } while (--loop);
+ case 0:
+ do
+ { /* All fall throughs */
+ HASHC;
+ case 7:
+ HASHC;
+ case 6:
+ HASHC;
+ case 5:
+ HASHC;
+ case 4:
+ HASHC;
+ case 3:
+ HASHC;
+ case 2:
+ HASHC;
+ case 1:
+ HASHC;
+ } while (--loop);
}
}
return (n);
diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c
index 4829093589..f76aba4179 100644
--- a/src/backend/access/hash/hashinsert.c
+++ b/src/backend/access/hash/hashinsert.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.9 1997/09/07 04:37:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashinsert.c,v 1.10 1997/09/08 02:20:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,15 +32,15 @@ static OffsetNumber _hash_pgaddtup(Relation rel, Buffer buf, int keysz, ScanKey
InsertIndexResult
_hash_doinsert(Relation rel, HashItem hitem)
{
- Buffer buf;
- Buffer metabuf;
- BlockNumber blkno;
- HashMetaPage metap;
- IndexTuple itup;
+ Buffer buf;
+ Buffer metabuf;
+ BlockNumber blkno;
+ HashMetaPage metap;
+ IndexTuple itup;
InsertIndexResult res;
- ScanKey itup_scankey;
- int natts;
- Page page;
+ ScanKey itup_scankey;
+ int natts;
+ Page page;
metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_READ);
metap = (HashMetaPage) BufferGetPage(metabuf);
@@ -101,7 +101,7 @@ _hash_doinsert(Relation rel, HashItem hitem)
* we will have dropped both the pin and the write lock on the buffer.
*
*/
-static InsertIndexResult
+static InsertIndexResult
_hash_insertonpg(Relation rel,
Buffer buf,
int keysz,
@@ -110,15 +110,15 @@ _hash_insertonpg(Relation rel,
Buffer metabuf)
{
InsertIndexResult res;
- Page page;
- BlockNumber itup_blkno;
- OffsetNumber itup_off;
- int itemsz;
- HashPageOpaque pageopaque;
- bool do_expand = false;
- Buffer ovflbuf;
- HashMetaPage metap;
- Bucket bucket;
+ Page page;
+ BlockNumber itup_blkno;
+ OffsetNumber itup_off;
+ int itemsz;
+ HashPageOpaque pageopaque;
+ bool do_expand = false;
+ Buffer ovflbuf;
+ HashMetaPage metap;
+ Bucket bucket;
metap = (HashMetaPage) BufferGetPage(metabuf);
_hash_checkpage((Page) metap, LH_META_PAGE);
@@ -218,7 +218,7 @@ _hash_insertonpg(Relation rel,
* write lock and reference associated with the page's buffer. It is
* an error to call pgaddtup() without a write lock and reference.
*/
-static OffsetNumber
+static OffsetNumber
_hash_pgaddtup(Relation rel,
Buffer buf,
int keysz,
@@ -226,8 +226,8 @@ _hash_pgaddtup(Relation rel,
Size itemsize,
HashItem hitem)
{
- OffsetNumber itup_off;
- Page page;
+ OffsetNumber itup_off;
+ Page page;
page = BufferGetPage(buf);
_hash_checkpage(page, LH_BUCKET_PAGE | LH_OVERFLOW_PAGE);
diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c
index b6882d4d3e..5d764b3472 100644
--- a/src/backend/access/hash/hashovfl.c
+++ b/src/backend/access/hash/hashovfl.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.10 1997/09/07 04:37:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashovfl.c,v 1.11 1997/09/08 02:20:17 momjian Exp $
*
* NOTES
* Overflow pages look like ordinary relation pages.
@@ -27,7 +27,7 @@
#endif
static OverflowPageAddress _hash_getovfladdr(Relation rel, Buffer * metabufp);
-static uint32 _hash_firstfreebit(uint32 map);
+static uint32 _hash_firstfreebit(uint32 map);
/*
* _hash_addovflpage
@@ -44,13 +44,13 @@ _hash_addovflpage(Relation rel, Buffer * metabufp, Buffer buf)
{
OverflowPageAddress oaddr;
- BlockNumber ovflblkno;
- Buffer ovflbuf;
- HashMetaPage metap;
- HashPageOpaque ovflopaque;
- HashPageOpaque pageopaque;
- Page page;
- Page ovflpage;
+ BlockNumber ovflblkno;
+ Buffer ovflbuf;
+ HashMetaPage metap;
+ HashPageOpaque ovflopaque;
+ HashPageOpaque pageopaque;
+ Page page;
+ Page ovflpage;
/* this had better be the last page in a bucket chain */
page = BufferGetPage(buf);
@@ -99,24 +99,24 @@ _hash_addovflpage(Relation rel, Buffer * metabufp, Buffer buf)
* is exchanged for a read lock.
*
*/
-static OverflowPageAddress
+static OverflowPageAddress
_hash_getovfladdr(Relation rel, Buffer * metabufp)
{
- HashMetaPage metap;
- Buffer mapbuf = 0;
- BlockNumber blkno;
- PageOffset offset;
+ HashMetaPage metap;
+ Buffer mapbuf = 0;
+ BlockNumber blkno;
+ PageOffset offset;
OverflowPageAddress oaddr;
- SplitNumber splitnum;
- uint32 *freep = NULL;
- uint32 max_free;
- uint32 bit;
- uint32 first_page;
- uint32 free_bit;
- uint32 free_page;
- uint32 in_use_bits;
- uint32 i,
- j;
+ SplitNumber splitnum;
+ uint32 *freep = NULL;
+ uint32 max_free;
+ uint32 bit;
+ uint32 first_page;
+ uint32 free_bit;
+ uint32 free_page;
+ uint32 in_use_bits;
+ uint32 i,
+ j;
metap = (HashMetaPage) _hash_chgbufaccess(rel, metabufp, HASH_READ, HASH_WRITE);
@@ -130,7 +130,7 @@ _hash_getovfladdr(Relation rel, Buffer * metabufp)
first_page = metap->LAST_FREED >> (metap->BSHIFT + BYTE_TO_BIT);
for (i = first_page; i <= free_page; i++)
{
- Page mappage;
+ Page mappage;
blkno = metap->hashm_mapp[i];
mapbuf = _hash_getbuf(rel, blkno, HASH_WRITE);
@@ -279,11 +279,11 @@ found:
* splitnumber.
*
*/
-static uint32
+static uint32
_hash_firstfreebit(uint32 map)
{
- uint32 i,
- mask;
+ uint32 i,
+ mask;
mask = 0x1;
for (i = 0; i < BITS_PER_MAP; i++)
@@ -306,22 +306,22 @@ _hash_firstfreebit(uint32 map)
Buffer
_hash_freeovflpage(Relation rel, Buffer ovflbuf)
{
- HashMetaPage metap;
- Buffer metabuf;
- Buffer mapbuf;
- BlockNumber prevblkno;
- BlockNumber blkno;
- BlockNumber nextblkno;
- HashPageOpaque ovflopaque;
- Page ovflpage;
- Page mappage;
+ HashMetaPage metap;
+ Buffer metabuf;
+ Buffer mapbuf;
+ BlockNumber prevblkno;
+ BlockNumber blkno;
+ BlockNumber nextblkno;
+ HashPageOpaque ovflopaque;
+ Page ovflpage;
+ Page mappage;
OverflowPageAddress addr;
- SplitNumber splitnum;
- uint32 *freep;
- uint32 ovflpgno;
- int32 bitmappage,
- bitmapbit;
- Bucket bucket;
+ SplitNumber splitnum;
+ uint32 *freep;
+ uint32 ovflpgno;
+ int32 bitmappage,
+ bitmapbit;
+ Bucket bucket;
metabuf = _hash_getbuf(rel, HASH_METAPAGE, HASH_WRITE);
metap = (HashMetaPage) BufferGetPage(metabuf);
@@ -348,9 +348,9 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf)
*/
if (BlockNumberIsValid(prevblkno))
{
- Buffer prevbuf = _hash_getbuf(rel, prevblkno, HASH_WRITE);
- Page prevpage = BufferGetPage(prevbuf);
- HashPageOpaque prevopaque =
+ Buffer prevbuf = _hash_getbuf(rel, prevblkno, HASH_WRITE);
+ Page prevpage = BufferGetPage(prevbuf);
+ HashPageOpaque prevopaque =
(HashPageOpaque) PageGetSpecialPointer(prevpage);
_hash_checkpage(prevpage, LH_BUCKET_PAGE | LH_OVERFLOW_PAGE);
@@ -360,9 +360,9 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf)
}
if (BlockNumberIsValid(nextblkno))
{
- Buffer nextbuf = _hash_getbuf(rel, nextblkno, HASH_WRITE);
- Page nextpage = BufferGetPage(nextbuf);
- HashPageOpaque nextopaque =
+ Buffer nextbuf = _hash_getbuf(rel, nextblkno, HASH_WRITE);
+ Page nextpage = BufferGetPage(nextbuf);
+ HashPageOpaque nextopaque =
(HashPageOpaque) PageGetSpecialPointer(nextpage);
_hash_checkpage(nextpage, LH_OVERFLOW_PAGE);
@@ -436,13 +436,13 @@ _hash_initbitmap(Relation rel,
int32 nbits,
int32 ndx)
{
- Buffer buf;
- BlockNumber blkno;
- Page pg;
- HashPageOpaque op;
- uint32 *freep;
- int clearbytes,
- clearints;
+ Buffer buf;
+ BlockNumber blkno;
+ Page pg;
+ HashPageOpaque op;
+ uint32 *freep;
+ int clearbytes,
+ clearints;
blkno = OADDR_TO_BLKNO(pnum);
buf = _hash_getbuf(rel, blkno, HASH_WRITE);
@@ -496,18 +496,18 @@ _hash_squeezebucket(Relation rel,
HashMetaPage metap,
Bucket bucket)
{
- Buffer wbuf;
- Buffer rbuf = 0;
- BlockNumber wblkno;
- BlockNumber rblkno;
- Page wpage;
- Page rpage;
- HashPageOpaque wopaque;
- HashPageOpaque ropaque;
- OffsetNumber woffnum;
- OffsetNumber roffnum;
- HashItem hitem;
- int itemsz;
+ Buffer wbuf;
+ Buffer rbuf = 0;
+ BlockNumber wblkno;
+ BlockNumber rblkno;
+ Page wpage;
+ Page rpage;
+ HashPageOpaque wopaque;
+ HashPageOpaque ropaque;
+ OffsetNumber woffnum;
+ OffsetNumber roffnum;
+ HashItem hitem;
+ int itemsz;
/* elog(DEBUG, "_hash_squeezebucket: squeezing bucket %d", bucket); */
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c
index 6c819b652d..17fdaab37f 100644
--- a/src/backend/access/hash/hashpage.c
+++ b/src/backend/access/hash/hashpage.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.10 1997/09/07 04:38:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashpage.c,v 1.11 1997/09/08 02:20:18 momjian Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -38,9 +38,9 @@
#include <string.h>
#endif
-static void _hash_setpagelock(Relation rel, BlockNumber blkno, int access);
-static void _hash_unsetpagelock(Relation rel, BlockNumber blkno, int access);
-static void _hash_splitpage(Relation rel, Buffer metabuf, Bucket obucket, Bucket nbucket);
+static void _hash_setpagelock(Relation rel, BlockNumber blkno, int access);
+static void _hash_unsetpagelock(Relation rel, BlockNumber blkno, int access);
+static void _hash_splitpage(Relation rel, Buffer metabuf, Bucket obucket, Bucket nbucket);
/*
* We use high-concurrency locking on hash indices. There are two cases in
@@ -68,16 +68,16 @@ static void _hash_splitpage(Relation rel, Buffer metabuf, Bucket obucket, Bucke
void
_hash_metapinit(Relation rel)
{
- HashMetaPage metap;
- HashPageOpaque pageopaque;
- Buffer metabuf;
- Buffer buf;
- Page pg;
- int nbuckets;
- uint32 nelem; /* number elements */
- uint32 lg2nelem; /* _hash_log2(nelem) */
- uint32 nblocks;
- uint16 i;
+ HashMetaPage metap;
+ HashPageOpaque pageopaque;
+ Buffer metabuf;
+ Buffer buf;
+ Page pg;
+ int nbuckets;
+ uint32 nelem; /* number elements */
+ uint32 lg2nelem; /* _hash_log2(nelem) */
+ uint32 nblocks;
+ uint16 i;
/* can't be sharing this with anyone, now... */
if (USELOCKING)
@@ -188,7 +188,7 @@ _hash_metapinit(Relation rel)
Buffer
_hash_getbuf(Relation rel, BlockNumber blkno, int access)
{
- Buffer buf;
+ Buffer buf;
if (blkno == P_NEW)
{
@@ -196,14 +196,14 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access)
}
switch (access)
{
- case HASH_WRITE:
- case HASH_READ:
- _hash_setpagelock(rel, blkno, access);
- break;
- default:
- elog(WARN, "_hash_getbuf: invalid access (%d) on new blk: %s",
- access, RelationGetRelationName(rel));
- break;
+ case HASH_WRITE:
+ case HASH_READ:
+ _hash_setpagelock(rel, blkno, access);
+ break;
+ default:
+ elog(WARN, "_hash_getbuf: invalid access (%d) on new blk: %s",
+ access, RelationGetRelationName(rel));
+ break;
}
buf = ReadBuffer(rel, blkno);
@@ -217,19 +217,19 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access)
void
_hash_relbuf(Relation rel, Buffer buf, int access)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
switch (access)
{
- case HASH_WRITE:
- case HASH_READ:
- _hash_unsetpagelock(rel, blkno, access);
- break;
- default:
- elog(WARN, "_hash_relbuf: invalid access (%d) on blk %x: %s",
- access, blkno, RelationGetRelationName(rel));
+ case HASH_WRITE:
+ case HASH_READ:
+ _hash_unsetpagelock(rel, blkno, access);
+ break;
+ default:
+ elog(WARN, "_hash_relbuf: invalid access (%d) on blk %x: %s",
+ access, blkno, RelationGetRelationName(rel));
}
ReleaseBuffer(buf);
@@ -245,7 +245,7 @@ _hash_relbuf(Relation rel, Buffer buf, int access)
void
_hash_wrtbuf(Relation rel, Buffer buf)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
WriteBuffer(buf);
@@ -262,7 +262,7 @@ _hash_wrtbuf(Relation rel, Buffer buf)
void
_hash_wrtnorelbuf(Relation rel, Buffer buf)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
WriteNoReleaseBuffer(buf);
@@ -274,22 +274,22 @@ _hash_chgbufaccess(Relation rel,
int from_access,
int to_access)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(*bufp);
switch (from_access)
{
- case HASH_WRITE:
- _hash_wrtbuf(rel, *bufp);
- break;
- case HASH_READ:
- _hash_relbuf(rel, *bufp, from_access);
- break;
- default:
- elog(WARN, "_hash_chgbufaccess: invalid access (%d) on blk %x: %s",
- from_access, blkno, RelationGetRelationName(rel));
- break;
+ case HASH_WRITE:
+ _hash_wrtbuf(rel, *bufp);
+ break;
+ case HASH_READ:
+ _hash_relbuf(rel, *bufp, from_access);
+ break;
+ default:
+ elog(WARN, "_hash_chgbufaccess: invalid access (%d) on blk %x: %s",
+ from_access, blkno, RelationGetRelationName(rel));
+ break;
}
*bufp = _hash_getbuf(rel, blkno, to_access);
return (BufferGetPage(*bufp));
@@ -328,16 +328,16 @@ _hash_setpagelock(Relation rel,
switch (access)
{
- case HASH_WRITE:
- RelationSetSingleWLockPage(rel, &iptr);
- break;
- case HASH_READ:
- RelationSetSingleRLockPage(rel, &iptr);
- break;
- default:
- elog(WARN, "_hash_setpagelock: invalid access (%d) on blk %x: %s",
- access, blkno, RelationGetRelationName(rel));
- break;
+ case HASH_WRITE:
+ RelationSetSingleWLockPage(rel, &iptr);
+ break;
+ case HASH_READ:
+ RelationSetSingleRLockPage(rel, &iptr);
+ break;
+ default:
+ elog(WARN, "_hash_setpagelock: invalid access (%d) on blk %x: %s",
+ access, blkno, RelationGetRelationName(rel));
+ break;
}
}
}
@@ -355,16 +355,16 @@ _hash_unsetpagelock(Relation rel,
switch (access)
{
- case HASH_WRITE:
- RelationUnsetSingleWLockPage(rel, &iptr);
- break;
- case HASH_READ:
- RelationUnsetSingleRLockPage(rel, &iptr);
- break;
- default:
- elog(WARN, "_hash_unsetpagelock: invalid access (%d) on blk %x: %s",
- access, blkno, RelationGetRelationName(rel));
- break;
+ case HASH_WRITE:
+ RelationUnsetSingleWLockPage(rel, &iptr);
+ break;
+ case HASH_READ:
+ RelationUnsetSingleRLockPage(rel, &iptr);
+ break;
+ default:
+ elog(WARN, "_hash_unsetpagelock: invalid access (%d) on blk %x: %s",
+ access, blkno, RelationGetRelationName(rel));
+ break;
}
}
}
@@ -372,13 +372,13 @@ _hash_unsetpagelock(Relation rel,
void
_hash_pagedel(Relation rel, ItemPointer tid)
{
- Buffer buf;
- Buffer metabuf;
- Page page;
- BlockNumber blkno;
- OffsetNumber offno;
- HashMetaPage metap;
- HashPageOpaque opaque;
+ Buffer buf;
+ Buffer metabuf;
+ Page page;
+ BlockNumber blkno;
+ OffsetNumber offno;
+ HashMetaPage metap;
+ HashPageOpaque opaque;
blkno = ItemPointerGetBlockNumber(tid);
offno = ItemPointerGetOffsetNumber(tid);
@@ -414,10 +414,10 @@ _hash_pagedel(Relation rel, ItemPointer tid)
void
_hash_expandtable(Relation rel, Buffer metabuf)
{
- HashMetaPage metap;
- Bucket old_bucket;
- Bucket new_bucket;
- uint32 spare_ndx;
+ HashMetaPage metap;
+ Bucket old_bucket;
+ Bucket new_bucket;
+ uint32 spare_ndx;
/* elog(DEBUG, "_hash_expandtable: expanding..."); */
@@ -472,26 +472,26 @@ _hash_splitpage(Relation rel,
Bucket obucket,
Bucket nbucket)
{
- Bucket bucket;
- Buffer obuf;
- Buffer nbuf;
- Buffer ovflbuf;
- BlockNumber oblkno;
- BlockNumber nblkno;
- bool null;
- Datum datum;
- HashItem hitem;
- HashPageOpaque oopaque;
- HashPageOpaque nopaque;
- HashMetaPage metap;
- IndexTuple itup;
- int itemsz;
- OffsetNumber ooffnum;
- OffsetNumber noffnum;
- OffsetNumber omaxoffnum;
- Page opage;
- Page npage;
- TupleDesc itupdesc;
+ Bucket bucket;
+ Buffer obuf;
+ Buffer nbuf;
+ Buffer ovflbuf;
+ BlockNumber oblkno;
+ BlockNumber nblkno;
+ bool null;
+ Datum datum;
+ HashItem hitem;
+ HashPageOpaque oopaque;
+ HashPageOpaque nopaque;
+ HashMetaPage metap;
+ IndexTuple itup;
+ int itemsz;
+ OffsetNumber ooffnum;
+ OffsetNumber noffnum;
+ OffsetNumber omaxoffnum;
+ Page opage;
+ Page npage;
+ TupleDesc itupdesc;
/* elog(DEBUG, "_hash_splitpage: splitting %d into %d,%d",
obucket, obucket, nbucket);
diff --git a/src/backend/access/hash/hashscan.c b/src/backend/access/hash/hashscan.c
index 79fa33f747..de64ebdd06 100644
--- a/src/backend/access/hash/hashscan.c
+++ b/src/backend/access/hash/hashscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.9 1997/09/07 04:38:01 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashscan.c,v 1.10 1997/09/08 02:20:20 momjian Exp $
*
* NOTES
* Because we can be doing an index scan on a relation while we
@@ -31,14 +31,14 @@
#include <access/hash.h>
-static void _hash_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
-static bool _hash_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
+static void _hash_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
+static bool _hash_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
typedef struct HashScanListData
{
- IndexScanDesc hashsl_scan;
+ IndexScanDesc hashsl_scan;
struct HashScanListData *hashsl_next;
-} HashScanListData;
+} HashScanListData;
typedef HashScanListData *HashScanList;
@@ -50,7 +50,7 @@ static HashScanList HashScans = (HashScanList) NULL;
void
_hash_regscan(IndexScanDesc scan)
{
- HashScanList new_el;
+ HashScanList new_el;
new_el = (HashScanList) palloc(sizeof(HashScanListData));
new_el->hashsl_scan = scan;
@@ -64,8 +64,8 @@ _hash_regscan(IndexScanDesc scan)
void
_hash_dropscan(IndexScanDesc scan)
{
- HashScanList chk,
- last;
+ HashScanList chk,
+ last;
last = (HashScanList) NULL;
for (chk = HashScans;
@@ -89,8 +89,8 @@ _hash_dropscan(IndexScanDesc scan)
void
_hash_adjscans(Relation rel, ItemPointer tid)
{
- HashScanList l;
- Oid relid;
+ HashScanList l;
+ Oid relid;
relid = rel->rd_id;
for (l = HashScans; l != (HashScanList) NULL; l = l->hashsl_next)
@@ -104,10 +104,10 @@ _hash_adjscans(Relation rel, ItemPointer tid)
static void
_hash_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
{
- ItemPointer current;
- Buffer buf;
- Buffer metabuf;
- HashScanOpaque so;
+ ItemPointer current;
+ Buffer buf;
+ Buffer metabuf;
+ HashScanOpaque so;
if (!_hash_scantouched(scan, blkno, offno))
return;
@@ -144,12 +144,12 @@ _hash_scandel(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
}
}
-static bool
+static bool
_hash_scantouched(IndexScanDesc scan,
BlockNumber blkno,
OffsetNumber offno)
{
- ItemPointer current;
+ ItemPointer current;
current = &(scan->currentItemData);
if (ItemPointerIsValid(current)
diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c
index 0a42ad0506..7c3b91b9c0 100644
--- a/src/backend/access/hash/hashsearch.c
+++ b/src/backend/access/hash/hashsearch.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.11 1997/09/07 04:38:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.12 1997/09/08 02:20:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,9 +34,9 @@ _hash_search(Relation rel,
Buffer * bufP,
HashMetaPage metap)
{
- BlockNumber blkno;
- Datum keyDatum;
- Bucket bucket;
+ BlockNumber blkno;
+ Datum keyDatum;
+ Bucket bucket;
if (scankey == (ScanKey) NULL ||
(keyDatum = scankey[0].sk_argument) == (Datum) NULL)
@@ -70,16 +70,16 @@ _hash_search(Relation rel,
RetrieveIndexResult
_hash_next(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- Buffer buf;
- Buffer metabuf;
- Page page;
- OffsetNumber offnum;
+ Relation rel;
+ Buffer buf;
+ Buffer metabuf;
+ Page page;
+ OffsetNumber offnum;
RetrieveIndexResult res;
- ItemPointer current;
- HashItem hitem;
- IndexTuple itup;
- HashScanOpaque so;
+ ItemPointer current;
+ HashItem hitem;
+ IndexTuple itup;
+ HashScanOpaque so;
rel = scan->relation;
so = (HashScanOpaque) scan->opaque;
@@ -129,7 +129,7 @@ static void
_hash_readnext(Relation rel,
Buffer * bufp, Page * pagep, HashPageOpaque * opaquep)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = (*opaquep)->hasho_nextblkno;
_hash_relbuf(rel, *bufp, HASH_READ);
@@ -148,7 +148,7 @@ static void
_hash_readprev(Relation rel,
Buffer * bufp, Page * pagep, HashPageOpaque * opaquep)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = (*opaquep)->hasho_prevblkno;
_hash_relbuf(rel, *bufp, HASH_READ);
@@ -180,18 +180,18 @@ _hash_readprev(Relation rel,
RetrieveIndexResult
_hash_first(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- Buffer buf;
- Buffer metabuf;
- Page page;
- HashPageOpaque opaque;
- HashMetaPage metap;
- HashItem hitem;
- IndexTuple itup;
- ItemPointer current;
- OffsetNumber offnum;
+ Relation rel;
+ Buffer buf;
+ Buffer metabuf;
+ Page page;
+ HashPageOpaque opaque;
+ HashMetaPage metap;
+ HashItem hitem;
+ IndexTuple itup;
+ ItemPointer current;
+ OffsetNumber offnum;
RetrieveIndexResult res;
- HashScanOpaque so;
+ HashScanOpaque so;
rel = scan->relation;
so = (HashScanOpaque) scan->opaque;
@@ -286,20 +286,20 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
bool
_hash_step(IndexScanDesc scan, Buffer * bufP, ScanDirection dir, Buffer metabuf)
{
- Relation rel;
- ItemPointer current;
- HashScanOpaque so;
- int allbuckets;
- HashMetaPage metap;
- Buffer buf;
- Page page;
- HashPageOpaque opaque;
- OffsetNumber maxoff;
- OffsetNumber offnum;
- Bucket bucket;
- BlockNumber blkno;
- HashItem hitem;
- IndexTuple itup;
+ Relation rel;
+ ItemPointer current;
+ HashScanOpaque so;
+ int allbuckets;
+ HashMetaPage metap;
+ Buffer buf;
+ Page page;
+ HashPageOpaque opaque;
+ OffsetNumber maxoff;
+ OffsetNumber offnum;
+ Bucket bucket;
+ BlockNumber blkno;
+ HashItem hitem;
+ IndexTuple itup;
rel = scan->relation;
current = &(scan->currentItemData);
@@ -341,107 +341,107 @@ _hash_step(IndexScanDesc scan, Buffer * bufP, ScanDirection dir, Buffer metabuf)
switch (dir)
{
- case ForwardScanDirection:
- if (offnum != InvalidOffsetNumber)
- {
- offnum = OffsetNumberNext(offnum); /* move forward */
- }
- else
- {
- offnum = FirstOffsetNumber; /* new page */
- }
- while (offnum > maxoff)
- {
+ case ForwardScanDirection:
+ if (offnum != InvalidOffsetNumber)
+ {
+ offnum = OffsetNumberNext(offnum); /* move forward */
+ }
+ else
+ {
+ offnum = FirstOffsetNumber; /* new page */
+ }
+ while (offnum > maxoff)
+ {
- /*
- * either this page is empty (maxoff ==
- * InvalidOffsetNumber) or we ran off the end.
- */
- _hash_readnext(rel, &buf, &page, &opaque);
- if (BufferIsInvalid(buf))
- { /* end of chain */
- if (allbuckets && bucket < metap->hashm_maxbucket)
- {
- ++bucket;
- blkno = BUCKET_TO_BLKNO(bucket);
- buf = _hash_getbuf(rel, blkno, HASH_READ);
- page = BufferGetPage(buf);
- _hash_checkpage(page, LH_BUCKET_PAGE);
- opaque = (HashPageOpaque) PageGetSpecialPointer(page);
- Assert(opaque->hasho_bucket == bucket);
- while (PageIsEmpty(page) &&
+ /*
+ * either this page is empty (maxoff ==
+ * InvalidOffsetNumber) or we ran off the end.
+ */
+ _hash_readnext(rel, &buf, &page, &opaque);
+ if (BufferIsInvalid(buf))
+ { /* end of chain */
+ if (allbuckets && bucket < metap->hashm_maxbucket)
+ {
+ ++bucket;
+ blkno = BUCKET_TO_BLKNO(bucket);
+ buf = _hash_getbuf(rel, blkno, HASH_READ);
+ page = BufferGetPage(buf);
+ _hash_checkpage(page, LH_BUCKET_PAGE);
+ opaque = (HashPageOpaque) PageGetSpecialPointer(page);
+ Assert(opaque->hasho_bucket == bucket);
+ while (PageIsEmpty(page) &&
BlockNumberIsValid(opaque->hasho_nextblkno))
+ {
+ _hash_readnext(rel, &buf, &page, &opaque);
+ }
+ maxoff = PageGetMaxOffsetNumber(page);
+ offnum = FirstOffsetNumber;
+ }
+ else
{
- _hash_readnext(rel, &buf, &page, &opaque);
+ maxoff = offnum = InvalidOffsetNumber;
+ break; /* while */
}
- maxoff = PageGetMaxOffsetNumber(page);
- offnum = FirstOffsetNumber;
}
else
{
- maxoff = offnum = InvalidOffsetNumber;
- break; /* while */
+ /* _hash_readnext never returns an empty page */
+ maxoff = PageGetMaxOffsetNumber(page);
+ offnum = FirstOffsetNumber;
}
}
+ break;
+ case BackwardScanDirection:
+ if (offnum != InvalidOffsetNumber)
+ {
+ offnum = OffsetNumberPrev(offnum); /* move back */
+ }
else
{
- /* _hash_readnext never returns an empty page */
- maxoff = PageGetMaxOffsetNumber(page);
- offnum = FirstOffsetNumber;
+ offnum = maxoff; /* new page */
}
- }
- break;
- case BackwardScanDirection:
- if (offnum != InvalidOffsetNumber)
- {
- offnum = OffsetNumberPrev(offnum); /* move back */
- }
- else
- {
- offnum = maxoff;/* new page */
- }
- while (offnum < FirstOffsetNumber)
- {
+ while (offnum < FirstOffsetNumber)
+ {
- /*
- * either this page is empty (offnum ==
- * InvalidOffsetNumber) or we ran off the end.
- */
- _hash_readprev(rel, &buf, &page, &opaque);
- if (BufferIsInvalid(buf))
- { /* end of chain */
- if (allbuckets && bucket > 0)
- {
- --bucket;
- blkno = BUCKET_TO_BLKNO(bucket);
- buf = _hash_getbuf(rel, blkno, HASH_READ);
- page = BufferGetPage(buf);
- _hash_checkpage(page, LH_BUCKET_PAGE);
- opaque = (HashPageOpaque) PageGetSpecialPointer(page);
- Assert(opaque->hasho_bucket == bucket);
- while (BlockNumberIsValid(opaque->hasho_nextblkno))
+ /*
+ * either this page is empty (offnum ==
+ * InvalidOffsetNumber) or we ran off the end.
+ */
+ _hash_readprev(rel, &buf, &page, &opaque);
+ if (BufferIsInvalid(buf))
+ { /* end of chain */
+ if (allbuckets && bucket > 0)
{
- _hash_readnext(rel, &buf, &page, &opaque);
+ --bucket;
+ blkno = BUCKET_TO_BLKNO(bucket);
+ buf = _hash_getbuf(rel, blkno, HASH_READ);
+ page = BufferGetPage(buf);
+ _hash_checkpage(page, LH_BUCKET_PAGE);
+ opaque = (HashPageOpaque) PageGetSpecialPointer(page);
+ Assert(opaque->hasho_bucket == bucket);
+ while (BlockNumberIsValid(opaque->hasho_nextblkno))
+ {
+ _hash_readnext(rel, &buf, &page, &opaque);
+ }
+ maxoff = offnum = PageGetMaxOffsetNumber(page);
+ }
+ else
+ {
+ maxoff = offnum = InvalidOffsetNumber;
+ break; /* while */
}
- maxoff = offnum = PageGetMaxOffsetNumber(page);
}
else
{
- maxoff = offnum = InvalidOffsetNumber;
- break; /* while */
+ /* _hash_readprev never returns an empty page */
+ maxoff = offnum = PageGetMaxOffsetNumber(page);
}
}
- else
- {
- /* _hash_readprev never returns an empty page */
- maxoff = offnum = PageGetMaxOffsetNumber(page);
- }
- }
- break;
- default:
- /* NoMovementScanDirection */
- /* this should not be reached */
- break;
+ break;
+ default:
+ /* NoMovementScanDirection */
+ /* this should not be reached */
+ break;
}
/* we ran off the end of the world without finding a match */
diff --git a/src/backend/access/hash/hashstrat.c b/src/backend/access/hash/hashstrat.c
index f1bdbdb8a3..a3a3656d76 100644
--- a/src/backend/access/hash/hashstrat.c
+++ b/src/backend/access/hash/hashstrat.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.10 1997/09/07 04:38:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/Attic/hashstrat.c,v 1.11 1997/09/08 02:20:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,12 +52,12 @@ static StrategyEvaluationData HTEvaluationData = {
*/
#ifdef NOT_USED
-static StrategyNumber
+static StrategyNumber
_hash_getstrat(Relation rel,
AttrNumber attno,
RegProcedure proc)
{
- StrategyNumber strat;
+ StrategyNumber strat;
strat = RelationGetStrategy(rel, attno, &HTEvaluationData, proc);
@@ -69,7 +69,7 @@ _hash_getstrat(Relation rel,
#endif
#ifdef NOT_USED
-static bool
+static bool
_hash_invokestrat(Relation rel,
AttrNumber attno,
StrategyNumber strat,
diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c
index f9fbe0e2d1..573c6c2dd4 100644
--- a/src/backend/access/hash/hashutil.c
+++ b/src/backend/access/hash/hashutil.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.10 1997/09/07 04:38:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/hash/hashutil.c,v 1.11 1997/09/08 02:20:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,13 +28,13 @@
ScanKey
_hash_mkscankey(Relation rel, IndexTuple itup, HashMetaPage metap)
{
- ScanKey skey;
- TupleDesc itupdesc;
- int natts;
- AttrNumber i;
- Datum arg;
- RegProcedure proc;
- bool null;
+ ScanKey skey;
+ TupleDesc itupdesc;
+ int natts;
+ AttrNumber i;
+ Datum arg;
+ RegProcedure proc;
+ bool null;
natts = rel->rd_rel->relnatts;
itupdesc = RelationGetTupleDescriptor(rel);
@@ -73,9 +73,9 @@ _hash_checkqual(IndexScanDesc scan, IndexTuple itup)
HashItem
_hash_formitem(IndexTuple itup)
{
- int nbytes_hitem;
- HashItem hitem;
- Size tuplen;
+ int nbytes_hitem;
+ HashItem hitem;
+ Size tuplen;
/* disallow nulls in hash keys */
if (itup->t_info & INDEX_NULL_MASK)
@@ -95,9 +95,9 @@ _hash_formitem(IndexTuple itup)
Bucket
_hash_call(Relation rel, HashMetaPage metap, Datum key)
{
- uint32 n;
- Bucket bucket;
- RegProcedure proc;
+ uint32 n;
+ Bucket bucket;
+ RegProcedure proc;
proc = metap->hashm_procid;
n = (uint32) fmgr(proc, key);
@@ -113,8 +113,8 @@ _hash_call(Relation rel, HashMetaPage metap, Datum key)
uint32
_hash_log2(uint32 num)
{
- uint32 i,
- limit;
+ uint32 i,
+ limit;
limit = 1;
for (i = 0; limit < num; limit = limit << 1, i++)
@@ -128,7 +128,7 @@ _hash_log2(uint32 num)
void
_hash_checkpage(Page page, int flags)
{
- HashPageOpaque opaque;
+ HashPageOpaque opaque;
Assert(page);
Assert(((PageHeader) (page))->pd_lower >= (sizeof(PageHeaderData) - sizeof(ItemIdData)));
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index b7ab862514..fa4dbae7ae 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.16 1997/09/07 04:38:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.17 1997/09/08 02:20:28 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -96,7 +96,7 @@
#include <string.h>
#endif
-static bool ImmediateInvalidation;
+static bool ImmediateInvalidation;
/* ----------------------------------------------------------------
* heap support routines
@@ -210,7 +210,7 @@ nextpage(int page, int dir)
* real work in scanning tuples.
* ----------------
*/
-static HeapTuple
+static HeapTuple
heapgettup(Relation relation,
ItemPointer tid,
int dir,
@@ -219,14 +219,14 @@ heapgettup(Relation relation,
int nkeys,
ScanKey key)
{
- ItemId lpp;
- Page dp;
- int page;
- int pages;
- int lines;
- HeapTuple rtup;
- OffsetNumber lineoff;
- int linesleft;
+ ItemId lpp;
+ Page dp;
+ int page;
+ int pages;
+ int lines;
+ HeapTuple rtup;
+ OffsetNumber lineoff;
+ int linesleft;
/* ----------------
* increment access statistics
@@ -432,7 +432,7 @@ heapgettup(Relation relation,
if ((rtup = heap_tuple_satisfies(lpp, relation, *b, (PageHeader) dp,
timeQual, nkeys, key)) != NULL)
{
- ItemPointer iptr = &(rtup->t_ctid);
+ ItemPointer iptr = &(rtup->t_ctid);
if (ItemPointerGetBlockNumber(iptr) != page)
{
@@ -541,7 +541,7 @@ SetHeapAccessMethodImmediateInvalidation(bool on)
Relation
heap_open(Oid relationId)
{
- Relation r;
+ Relation r;
/* ----------------
* increment access statistics
@@ -570,7 +570,7 @@ heap_open(Oid relationId)
Relation
heap_openr(char *relationName)
{
- Relation r;
+ Relation r;
/* ----------------
* increment access statistics
@@ -621,7 +621,7 @@ heap_beginscan(Relation relation,
unsigned nkeys,
ScanKey key)
{
- HeapScanDesc sdesc;
+ HeapScanDesc sdesc;
/* ----------------
* increment access statistics
@@ -808,7 +808,7 @@ heap_getnext(HeapScanDesc scandesc,
Buffer * b)
{
register HeapScanDesc sdesc = scandesc;
- Buffer localb;
+ Buffer localb;
/* ----------------
* increment access statistics
@@ -880,7 +880,7 @@ heap_getnext(HeapScanDesc scandesc,
}
else
{ /* NONTUP */
- ItemPointer iptr;
+ ItemPointer iptr;
iptr = (sdesc->rs_ctup != NULL) ?
&(sdesc->rs_ctup->t_ctid) : (ItemPointer) NULL;
@@ -967,7 +967,7 @@ heap_getnext(HeapScanDesc scandesc,
}
else
{ /* NONTUP */
- ItemPointer iptr;
+ ItemPointer iptr;
iptr = (sdesc->rs_ctup != NULL) ?
&sdesc->rs_ctup->t_ctid : (ItemPointer) NULL;
@@ -1035,11 +1035,11 @@ heap_fetch(Relation relation,
ItemPointer tid,
Buffer * b)
{
- ItemId lp;
- Buffer buffer;
- PageHeader dp;
- HeapTuple tuple;
- OffsetNumber offnum;
+ ItemId lp;
+ Buffer buffer;
+ PageHeader dp;
+ HeapTuple tuple;
+ OffsetNumber offnum;
/* ----------------
* increment access statistics
@@ -1203,10 +1203,10 @@ heap_insert(Relation relation, HeapTuple tup)
int
heap_delete(Relation relation, ItemPointer tid)
{
- ItemId lp;
- HeapTuple tp;
- PageHeader dp;
- Buffer b;
+ ItemId lp;
+ HeapTuple tp;
+ PageHeader dp;
+ Buffer b;
/* ----------------
* increment access statistics
@@ -1313,10 +1313,10 @@ heap_delete(Relation relation, ItemPointer tid)
int
heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
{
- ItemId lp;
- HeapTuple tp;
- Page dp;
- Buffer buffer;
+ ItemId lp;
+ HeapTuple tp;
+ Page dp;
+ Buffer buffer;
/* ----------------
* increment access statistics
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index 0854b69bf0..21202b1537 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Id: hio.c,v 1.10 1997/09/07 04:38:11 momjian Exp $
+ * $Id: hio.c,v 1.11 1997/09/08 02:20:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,13 +35,13 @@ RelationPutHeapTuple(Relation relation,
BlockNumber blockIndex,
HeapTuple tuple)
{
- Buffer buffer;
- Page pageHeader;
- BlockNumber numberOfBlocks;
- OffsetNumber offnum;
- unsigned int len;
- ItemId itemId;
- Item item;
+ Buffer buffer;
+ Page pageHeader;
+ BlockNumber numberOfBlocks;
+ OffsetNumber offnum;
+ unsigned int len;
+ ItemId itemId;
+ Item item;
/* ----------------
* increment access statistics
@@ -108,13 +108,13 @@ RelationPutHeapTuple(Relation relation,
void
RelationPutHeapTupleAtEnd(Relation relation, HeapTuple tuple)
{
- Buffer buffer;
- Page pageHeader;
- BlockNumber lastblock;
- OffsetNumber offnum;
- unsigned int len;
- ItemId itemId;
- Item item;
+ Buffer buffer;
+ Page pageHeader;
+ BlockNumber lastblock;
+ OffsetNumber offnum;
+ unsigned int len;
+ ItemId itemId;
+ Item item;
Assert(RelationIsValid(relation));
Assert(HeapTupleIsValid(tuple));
diff --git a/src/backend/access/heap/stats.c b/src/backend/access/heap/stats.c
index aa16803779..2bebfd9b0b 100644
--- a/src/backend/access/heap/stats.c
+++ b/src/backend/access/heap/stats.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/Attic/stats.c,v 1.12 1997/09/07 04:38:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/Attic/stats.c,v 1.13 1997/09/08 02:20:31 momjian Exp $
*
* NOTES
* initam should be moved someplace else.
@@ -28,7 +28,7 @@
#include <string.h>
#endif
-static void InitHeapAccessStatistics(void);
+static void InitHeapAccessStatistics(void);
/* ----------------
* InitHeapAccessStatistics
@@ -39,7 +39,7 @@ HeapAccessStatistics heap_access_stats = (HeapAccessStatistics) NULL;
static void
InitHeapAccessStatistics()
{
- MemoryContext oldContext;
+ MemoryContext oldContext;
HeapAccessStatistics stats;
/* ----------------
diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c
index da7fc0dc09..83655b7d61 100644
--- a/src/backend/access/index/genam.c
+++ b/src/backend/access/index/genam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.8 1997/09/07 04:38:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/genam.c,v 1.9 1997/09/08 02:20:33 momjian Exp $
*
* NOTES
* many of the old access method routines have been turned into
@@ -98,7 +98,7 @@ RelationGetIndexScan(Relation relation,
uint16 numberOfKeys,
ScanKey key)
{
- IndexScanDesc scan;
+ IndexScanDesc scan;
if (!RelationIsValid(relation))
elog(WARN, "RelationGetIndexScan: relation invalid");
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index 6841899fa3..9d0eee39b6 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.14 1997/09/07 04:38:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/indexam.c,v 1.15 1997/09/08 02:20:37 momjian Exp $
*
* INTERFACE ROUTINES
* index_open - open an index relation by relationId
@@ -167,7 +167,7 @@ index_insert(Relation relation,
ItemPointer heap_t_ctid,
Relation heapRel)
{
- RegProcedure procedure;
+ RegProcedure procedure;
InsertIndexResult specificResult;
RELATION_CHECKS;
@@ -207,7 +207,7 @@ index_insert(Relation relation,
void
index_delete(Relation relation, ItemPointer indexItem)
{
- RegProcedure procedure;
+ RegProcedure procedure;
RELATION_CHECKS;
GET_REL_PROCEDURE(delete, amdelete);
@@ -225,8 +225,8 @@ index_beginscan(Relation relation,
uint16 numberOfKeys,
ScanKey key)
{
- IndexScanDesc scandesc;
- RegProcedure procedure;
+ IndexScanDesc scandesc;
+ RegProcedure procedure;
RELATION_CHECKS;
GET_REL_PROCEDURE(beginscan, ambeginscan);
@@ -246,7 +246,7 @@ index_beginscan(Relation relation,
void
index_rescan(IndexScanDesc scan, bool scanFromEnd, ScanKey key)
{
- RegProcedure procedure;
+ RegProcedure procedure;
SCAN_CHECKS;
GET_SCAN_PROCEDURE(rescan, amrescan);
@@ -261,7 +261,7 @@ index_rescan(IndexScanDesc scan, bool scanFromEnd, ScanKey key)
void
index_endscan(IndexScanDesc scan)
{
- RegProcedure procedure;
+ RegProcedure procedure;
SCAN_CHECKS;
GET_SCAN_PROCEDURE(endscan, amendscan);
@@ -279,7 +279,7 @@ index_endscan(IndexScanDesc scan)
void
index_markpos(IndexScanDesc scan)
{
- RegProcedure procedure;
+ RegProcedure procedure;
SCAN_CHECKS;
GET_SCAN_PROCEDURE(markpos, ammarkpos);
@@ -297,7 +297,7 @@ index_markpos(IndexScanDesc scan)
void
index_restrpos(IndexScanDesc scan)
{
- RegProcedure procedure;
+ RegProcedure procedure;
SCAN_CHECKS;
GET_SCAN_PROCEDURE(restrpos, amrestrpos);
@@ -317,7 +317,7 @@ RetrieveIndexResult
index_getnext(IndexScanDesc scan,
ScanDirection direction)
{
- RegProcedure procedure;
+ RegProcedure procedure;
RetrieveIndexResult result;
SCAN_CHECKS;
@@ -354,8 +354,8 @@ index_getprocid(Relation irel,
AttrNumber attnum,
uint16 procnum)
{
- RegProcedure *loc;
- int natts;
+ RegProcedure *loc;
+ int natts;
natts = irel->rd_rel->relnatts;
@@ -375,13 +375,13 @@ GetIndexValue(HeapTuple tuple,
bool * attNull,
Buffer buffer)
{
- Datum returnVal;
- bool isNull;
+ Datum returnVal;
+ bool isNull;
if (PointerIsValid(fInfo) && FIgetProcOid(fInfo) != InvalidOid)
{
- int i;
- Datum *attData = (Datum *) palloc(FIgetnArgs(fInfo) * sizeof(Datum));
+ int i;
+ Datum *attData = (Datum *) palloc(FIgetnArgs(fInfo) * sizeof(Datum));
for (i = 0; i < FIgetnArgs(fInfo); i++)
{
diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c
index 35158c2217..9cc9c06e98 100644
--- a/src/backend/access/index/istrat.c
+++ b/src/backend/access/index/istrat.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.10 1997/09/07 04:38:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.11 1997/09/08 02:20:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,7 +27,7 @@
#include <fmgr.h>
#ifndef NO_ASSERT_CHECKING
-static bool StrategyEvaluationIsValid(StrategyEvaluation evaluation);
+static bool StrategyEvaluationIsValid(StrategyEvaluation evaluation);
static bool
StrategyExpressionIsValid(StrategyExpression expression,
StrategyNumber maxStrategy);
@@ -68,7 +68,7 @@ StrategyTermIsValid(StrategyTerm term,
* Assumes that the index strategy number is valid.
* Bounds checking should be done outside this routine.
*/
-static ScanKey
+static ScanKey
StrategyMapGetScanKeyEntry(StrategyMap map,
StrategyNumber strategyNumber)
{
@@ -122,7 +122,7 @@ AttributeNumberGetIndexStrategySize(AttrNumber maxAttributeNumber,
* StrategyOperatorIsValid
* ----------------
*/
-static bool
+static bool
StrategyOperatorIsValid(StrategyOperator operator,
StrategyNumber maxStrategy)
{
@@ -136,11 +136,11 @@ StrategyOperatorIsValid(StrategyOperator operator,
* StrategyTermIsValid
* ----------------
*/
-static bool
+static bool
StrategyTermIsValid(StrategyTerm term,
StrategyNumber maxStrategy)
{
- Index index;
+ Index index;
if (!PointerIsValid(term) || term->degree == 0)
return false;
@@ -162,11 +162,11 @@ StrategyTermIsValid(StrategyTerm term,
* StrategyExpressionIsValid
* ----------------
*/
-static bool
+static bool
StrategyExpressionIsValid(StrategyExpression expression,
StrategyNumber maxStrategy)
{
- StrategyTerm *termP;
+ StrategyTerm *termP;
if (!PointerIsValid(expression))
return true;
@@ -186,10 +186,10 @@ StrategyExpressionIsValid(StrategyExpression expression,
* StrategyEvaluationIsValid
* ----------------
*/
-static bool
+static bool
StrategyEvaluationIsValid(StrategyEvaluation evaluation)
{
- Index index;
+ Index index;
if (!PointerIsValid(evaluation) ||
!StrategyNumberIsValid(evaluation->maxStrategy) ||
@@ -219,17 +219,17 @@ StrategyEvaluationIsValid(StrategyEvaluation evaluation)
* StrategyTermEvaluate
* ----------------
*/
-static bool
+static bool
StrategyTermEvaluate(StrategyTerm term,
StrategyMap map,
Datum left,
Datum right)
{
- Index index;
- long tmpres = 0;
- bool result = 0;
+ Index index;
+ long tmpres = 0;
+ bool result = 0;
StrategyOperator operator;
- ScanKey entry;
+ ScanKey entry;
for (index = 0, operator = &term->operatorData[0];
index < term->degree; index += 1, operator += 1)
@@ -241,29 +241,29 @@ StrategyTermEvaluate(StrategyTerm term,
switch (operator->flags ^ entry->sk_flags)
{
- case 0x0:
- tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
- left, right);
- break;
-
- case SK_NEGATE:
- tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
- left, right);
- break;
-
- case SK_COMMUTE:
- tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
- right, left);
- break;
-
- case SK_NEGATE | SK_COMMUTE:
- tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
- right, left);
- break;
-
- default:
- elog(FATAL, "StrategyTermEvaluate: impossible case %d",
- operator->flags ^ entry->sk_flags);
+ case 0x0:
+ tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
+ left, right);
+ break;
+
+ case SK_NEGATE:
+ tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
+ left, right);
+ break;
+
+ case SK_COMMUTE:
+ tmpres = (long) FMGR_PTR2(entry->sk_func, entry->sk_procedure,
+ right, left);
+ break;
+
+ case SK_NEGATE | SK_COMMUTE:
+ tmpres = (long) !FMGR_PTR2(entry->sk_func, entry->sk_procedure,
+ right, left);
+ break;
+
+ default:
+ elog(FATAL, "StrategyTermEvaluate: impossible case %d",
+ operator->flags ^ entry->sk_flags);
}
result = (bool) tmpres;
@@ -285,11 +285,11 @@ RelationGetStrategy(Relation relation,
StrategyEvaluation evaluation,
RegProcedure procedure)
{
- StrategyNumber strategy;
- StrategyMap strategyMap;
- ScanKey entry;
- Index index;
- int numattrs;
+ StrategyNumber strategy;
+ StrategyMap strategyMap;
+ ScanKey entry;
+ Index index;
+ int numattrs;
Assert(RelationIsValid(relation));
numattrs = RelationGetNumberOfAttributes(relation);
@@ -325,23 +325,23 @@ RelationGetStrategy(Relation relation,
switch (entry->sk_flags & (SK_NEGATE | SK_COMMUTE))
{
- case 0x0:
- return strategy;
+ case 0x0:
+ return strategy;
- case SK_NEGATE:
- strategy = evaluation->negateTransform->strategy[strategy - 1];
- break;
+ case SK_NEGATE:
+ strategy = evaluation->negateTransform->strategy[strategy - 1];
+ break;
- case SK_COMMUTE:
- strategy = evaluation->commuteTransform->strategy[strategy - 1];
- break;
+ case SK_COMMUTE:
+ strategy = evaluation->commuteTransform->strategy[strategy - 1];
+ break;
- case SK_NEGATE | SK_COMMUTE:
- strategy = evaluation->negateCommuteTransform->strategy[strategy - 1];
- break;
+ case SK_NEGATE | SK_COMMUTE:
+ strategy = evaluation->negateCommuteTransform->strategy[strategy - 1];
+ break;
- default:
- elog(FATAL, "RelationGetStrategy: impossible case %d", entry->sk_flags);
+ default:
+ elog(FATAL, "RelationGetStrategy: impossible case %d", entry->sk_flags);
}
@@ -368,11 +368,11 @@ RelationInvokeStrategy(Relation relation,
Datum left,
Datum right)
{
- StrategyNumber newStrategy;
- StrategyMap strategyMap;
- ScanKey entry;
+ StrategyNumber newStrategy;
+ StrategyMap strategyMap;
+ ScanKey entry;
StrategyTermData termData;
- int numattrs;
+ int numattrs;
Assert(RelationIsValid(relation));
Assert(relation->rd_rel->relkind == RELKIND_INDEX); /* XXX use accessor */
@@ -453,12 +453,12 @@ RelationInvokeStrategy(Relation relation,
if (PointerIsValid(evaluation->expression[strategy - 1]))
{
- StrategyTerm *termP;
+ StrategyTerm *termP;
termP = &evaluation->expression[strategy - 1]->term[0];
while (PointerIsValid(*termP))
{
- Index index;
+ Index index;
for (index = 0; index < (*termP)->degree; index += 1)
{
@@ -499,9 +499,9 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
Oid operatorObjectId,
ScanKey entry)
{
- HeapScanDesc scan;
- ScanKeyData scanKeyData;
- HeapTuple tuple;
+ HeapScanDesc scan;
+ ScanKeyData scanKeyData;
+ HeapTuple tuple;
ScanKeyEntryInitialize(&scanKeyData, 0,
ObjectIdAttributeNumber,
@@ -547,15 +547,15 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
StrategyNumber maxSupportNumber,
AttrNumber maxAttributeNumber)
{
- Relation relation;
- Relation operatorRelation;
- HeapScanDesc scan;
- HeapTuple tuple;
- ScanKeyData entry[2];
- StrategyMap map;
- AttrNumber attributeNumber;
- int attributeIndex;
- Oid operatorClassObjectId[MaxIndexAttributeNumber];
+ Relation relation;
+ Relation operatorRelation;
+ HeapScanDesc scan;
+ HeapTuple tuple;
+ ScanKeyData entry[2];
+ StrategyMap map;
+ AttrNumber attributeNumber;
+ int attributeIndex;
+ Oid operatorClassObjectId[MaxIndexAttributeNumber];
maxStrategyNumber = AMStrategies(maxStrategyNumber);
@@ -575,7 +575,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
*/
for (attributeIndex = 0; attributeIndex < maxAttributeNumber; attributeIndex++)
{
- IndexTupleForm iform;
+ IndexTupleForm iform;
iform = (IndexTupleForm) GETSTRUCT(tuple);
@@ -614,9 +614,9 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
attributeNumber--)
{
- int16 support;
- Form_pg_amproc form;
- RegProcedure *loc;
+ int16 support;
+ Form_pg_amproc form;
+ RegProcedure *loc;
loc = &indexSupport[((attributeNumber - 1) * maxSupportNumber)];
@@ -659,7 +659,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
attributeNumber--)
{
- StrategyNumber strategy;
+ StrategyNumber strategy;
entry[1].sk_argument =
ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
@@ -676,7 +676,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
HeapTupleIsValid(tuple))
{
- Form_pg_amop form;
+ Form_pg_amop form;
form = (Form_pg_amop) GETSTRUCT(tuple);
@@ -702,9 +702,9 @@ IndexStrategyDisplay(IndexStrategy indexStrategy,
StrategyNumber numberOfStrategies,
int numberOfAttributes)
{
- StrategyMap strategyMap;
- AttrNumber attributeNumber;
- StrategyNumber strategyNumber;
+ StrategyMap strategyMap;
+ AttrNumber attributeNumber;
+ StrategyNumber strategyNumber;
for (attributeNumber = 1; attributeNumber <= numberOfAttributes;
attributeNumber += 1)
diff --git a/src/backend/access/nbtree/nbtcompare.c b/src/backend/access/nbtree/nbtcompare.c
index 0312bbb69d..f107e2138a 100644
--- a/src/backend/access/nbtree/nbtcompare.c
+++ b/src/backend/access/nbtree/nbtcompare.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.11 1997/09/07 04:38:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.12 1997/09/08 02:20:44 momjian Exp $
*
* NOTES
* These functions are stored in pg_amproc. For each operator class
@@ -134,13 +134,13 @@ btnamecmp(NameData * a, NameData * b)
int32
bttextcmp(struct varlena * a, struct varlena * b)
{
- int res;
- unsigned char *ap,
- *bp;
+ int res;
+ unsigned char *ap,
+ *bp;
#ifdef USE_LOCALE
- int la = VARSIZE(a) - VARHDRSZ;
- int lb = VARSIZE(b) - VARHDRSZ;
+ int la = VARSIZE(a) - VARHDRSZ;
+ int lb = VARSIZE(b) - VARHDRSZ;
ap = (unsigned char *) palloc(la + 1);
bp = (unsigned char *) palloc(lb + 1);
@@ -156,7 +156,7 @@ bttextcmp(struct varlena * a, struct varlena * b)
pfree(bp);
#else
- int len = VARSIZE(a);
+ int len = VARSIZE(a);
/* len is the length of the shorter of the two strings */
if (len > VARSIZE(b))
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index 4bafbc2ddb..53c56d43ec 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.18 1997/09/07 04:38:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.19 1997/09/08 02:20:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,13 +28,13 @@
#endif
static InsertIndexResult _bt_insertonpg(Relation rel, Buffer buf, BTStack stack, int keysz, ScanKey scankey, BTItem btitem, BTItem afteritem);
-static Buffer _bt_split(Relation rel, Buffer buf, OffsetNumber firstright);
+static Buffer _bt_split(Relation rel, Buffer buf, OffsetNumber firstright);
static OffsetNumber _bt_findsplitloc(Relation rel, Page page, OffsetNumber start, OffsetNumber maxoff, Size llimit);
-static void _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf);
+static void _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf);
static OffsetNumber _bt_pgaddtup(Relation rel, Buffer buf, int keysz, ScanKey itup_scankey, Size itemsize, BTItem btitem, BTItem afteritem);
-static bool _bt_goesonpg(Relation rel, Buffer buf, Size keysz, ScanKey scankey, BTItem afteritem);
-static void _bt_updateitem(Relation rel, Size keysz, Buffer buf, BTItem oldItem, BTItem newItem);
-static bool _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum, int keysz, ScanKey scankey);
+static bool _bt_goesonpg(Relation rel, Buffer buf, Size keysz, ScanKey scankey, BTItem afteritem);
+static void _bt_updateitem(Relation rel, Size keysz, Buffer buf, BTItem oldItem, BTItem newItem);
+static bool _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum, int keysz, ScanKey scankey);
/*
* _bt_doinsert() -- Handle insertion of a single btitem in the tree.
@@ -46,12 +46,12 @@ static bool _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum, int
InsertIndexResult
_bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel)
{
- ScanKey itup_scankey;
- IndexTuple itup;
- BTStack stack;
- Buffer buf;
- BlockNumber blkno;
- int natts = rel->rd_rel->relnatts;
+ ScanKey itup_scankey;
+ IndexTuple itup;
+ BTStack stack;
+ Buffer buf;
+ BlockNumber blkno;
+ int natts = rel->rd_rel->relnatts;
InsertIndexResult res;
itup = &(btitem->bti_itup);
@@ -82,9 +82,9 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
/* already in the node */
if (index_is_unique)
{
- OffsetNumber offset,
- maxoff;
- Page page;
+ OffsetNumber offset,
+ maxoff;
+ Page page;
page = BufferGetPage(buf);
maxoff = PageGetMaxOffsetNumber(page);
@@ -95,13 +95,13 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
/* key on the page before trying to compare it */
if (!PageIsEmpty(page) && offset <= maxoff)
{
- TupleDesc itupdesc;
- BTItem btitem;
- IndexTuple itup;
- HeapTuple htup;
- BTPageOpaque opaque;
- Buffer nbuf;
- BlockNumber blkno;
+ TupleDesc itupdesc;
+ BTItem btitem;
+ IndexTuple itup;
+ HeapTuple htup;
+ BTPageOpaque opaque;
+ Buffer nbuf;
+ BlockNumber blkno;
itupdesc = RelationGetTupleDescriptor(rel);
nbuf = InvalidBuffer;
@@ -213,7 +213,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
* 'afteritem' parameter to position ourselves correctly for the
* insertion on internal pages.
*/
-static InsertIndexResult
+static InsertIndexResult
_bt_insertonpg(Relation rel,
Buffer buf,
BTStack stack,
@@ -223,14 +223,14 @@ _bt_insertonpg(Relation rel,
BTItem afteritem)
{
InsertIndexResult res;
- Page page;
- BTPageOpaque lpageop;
- BlockNumber itup_blkno;
- OffsetNumber itup_off;
- OffsetNumber firstright = InvalidOffsetNumber;
- int itemsz;
- bool do_split = false;
- bool keys_equal = false;
+ Page page;
+ BTPageOpaque lpageop;
+ BlockNumber itup_blkno;
+ OffsetNumber itup_off;
+ OffsetNumber firstright = InvalidOffsetNumber;
+ int itemsz;
+ bool do_split = false;
+ bool keys_equal = false;
page = BufferGetPage(buf);
lpageop = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -251,9 +251,9 @@ _bt_insertonpg(Relation rel,
*/
if (lpageop->btpo_flags & BTP_CHAIN)
{
- OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
- ItemId hitemid;
- BTItem hitem;
+ OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
+ ItemId hitemid;
+ BTItem hitem;
Assert(!P_RIGHTMOST(lpageop));
hitemid = PageGetItemId(page, P_HIKEY);
@@ -280,8 +280,8 @@ _bt_insertonpg(Relation rel,
else
/* "eat" page */
{
- Buffer pbuf;
- Page ppage;
+ Buffer pbuf;
+ Page ppage;
itup_blkno = BufferGetBlockNumber(buf);
itup_off = PageAddItem(page, (Item) btitem, itemsz,
@@ -315,13 +315,13 @@ _bt_insertonpg(Relation rel,
do_split = true;
else if (PageGetFreeSpace(page) < 3 * itemsz + 2 * sizeof(ItemIdData))
{
- OffsetNumber offnum = (P_RIGHTMOST(lpageop)) ? P_HIKEY : P_FIRSTKEY;
- OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
- ItemId itid;
- BTItem previtem,
- chkitem;
- Size maxsize;
- Size currsize;
+ OffsetNumber offnum = (P_RIGHTMOST(lpageop)) ? P_HIKEY : P_FIRSTKEY;
+ OffsetNumber maxoff = PageGetMaxOffsetNumber(page);
+ ItemId itid;
+ BTItem previtem,
+ chkitem;
+ Size maxsize;
+ Size currsize;
itid = PageGetItemId(page, offnum);
previtem = (BTItem) PageGetItem(page, itid);
@@ -351,19 +351,19 @@ _bt_insertonpg(Relation rel,
if (do_split)
{
- Buffer rbuf;
- Page rpage;
- BTItem ritem;
- BlockNumber rbknum;
- BTPageOpaque rpageop;
- Buffer pbuf;
- Page ppage;
- BTPageOpaque ppageop;
- BlockNumber bknum = BufferGetBlockNumber(buf);
- BTItem lowLeftItem;
- OffsetNumber maxoff;
- bool shifted = false;
- bool left_chained = (lpageop->btpo_flags & BTP_CHAIN) ? true : false;
+ Buffer rbuf;
+ Page rpage;
+ BTItem ritem;
+ BlockNumber rbknum;
+ BTPageOpaque rpageop;
+ Buffer pbuf;
+ Page ppage;
+ BTPageOpaque ppageop;
+ BlockNumber bknum = BufferGetBlockNumber(buf);
+ BTItem lowLeftItem;
+ OffsetNumber maxoff;
+ bool shifted = false;
+ bool left_chained = (lpageop->btpo_flags & BTP_CHAIN) ? true : false;
/*
* If we have to split leaf page in the chain of duplicates by new
@@ -372,7 +372,7 @@ _bt_insertonpg(Relation rel,
if ((lpageop->btpo_flags & BTP_CHAIN) &&
(lpageop->btpo_flags & BTP_LEAF) && keys_equal)
{
- bool use_left = true;
+ bool use_left = true;
rbuf = _bt_getbuf(rel, lpageop->btpo_next, BT_WRITE);
rpage = BufferGetPage(rbuf);
@@ -429,8 +429,8 @@ _bt_insertonpg(Relation rel,
*/
else if (!(lpageop->btpo_flags & BTP_CHAIN))
{
- OffsetNumber start = (P_RIGHTMOST(lpageop)) ? P_HIKEY : P_FIRSTKEY;
- Size llimit;
+ OffsetNumber start = (P_RIGHTMOST(lpageop)) ? P_HIKEY : P_FIRSTKEY;
+ Size llimit;
maxoff = PageGetMaxOffsetNumber(page);
llimit = PageGetPageSize(page) - sizeof(PageHeaderData) -
@@ -547,13 +547,13 @@ _bt_insertonpg(Relation rel,
}
else
{
- ScanKey newskey;
+ ScanKey newskey;
InsertIndexResult newres;
- BTItem new_item;
- OffsetNumber upditem_offset = P_HIKEY;
- bool do_update = false;
- bool update_in_place = true;
- bool parent_chained;
+ BTItem new_item;
+ OffsetNumber upditem_offset = P_HIKEY;
+ bool do_update = false;
+ bool update_in_place = true;
+ bool parent_chained;
/* form a index tuple that points at the new right page */
rbknum = BufferGetBlockNumber(rbuf);
@@ -790,27 +790,27 @@ _bt_insertonpg(Relation rel,
* Returns the new right sibling of buf, pinned and write-locked. The
* pin and lock on buf are maintained.
*/
-static Buffer
+static Buffer
_bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
{
- Buffer rbuf;
- Page origpage;
- Page leftpage,
- rightpage;
- BTPageOpaque ropaque,
- lopaque,
- oopaque;
- Buffer sbuf;
- Page spage;
- BTPageOpaque sopaque;
- Size itemsz;
- ItemId itemid;
- BTItem item;
- OffsetNumber leftoff,
- rightoff;
- OffsetNumber start;
- OffsetNumber maxoff;
- OffsetNumber i;
+ Buffer rbuf;
+ Page origpage;
+ Page leftpage,
+ rightpage;
+ BTPageOpaque ropaque,
+ lopaque,
+ oopaque;
+ Buffer sbuf;
+ Page spage;
+ BTPageOpaque sopaque;
+ Size itemsz;
+ ItemId itemid;
+ BTItem item;
+ OffsetNumber leftoff,
+ rightoff;
+ OffsetNumber start;
+ OffsetNumber maxoff;
+ OffsetNumber i;
rbuf = _bt_getbuf(rel, P_NEW, BT_WRITE);
origpage = BufferGetPage(buf);
@@ -871,7 +871,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
maxoff = PageGetMaxOffsetNumber(origpage);
if (firstright == InvalidOffsetNumber)
{
- Size llimit = PageGetFreeSpace(leftpage) / 2;
+ Size llimit = PageGetFreeSpace(leftpage) / 2;
firstright = _bt_findsplitloc(rel, origpage, start, maxoff, llimit);
}
@@ -987,21 +987,21 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright)
* may be split as
* [2 2 2 2] [2 3 4].
*/
-static OffsetNumber
+static OffsetNumber
_bt_findsplitloc(Relation rel,
Page page,
OffsetNumber start,
OffsetNumber maxoff,
Size llimit)
{
- OffsetNumber i;
- OffsetNumber saferight;
- ItemId nxtitemid,
- safeitemid;
- BTItem safeitem,
- nxtitem;
- Size nbytes;
- int natts;
+ OffsetNumber i;
+ OffsetNumber saferight;
+ ItemId nxtitemid,
+ safeitemid;
+ BTItem safeitem,
+ nxtitem;
+ Size nbytes;
+ int natts;
if (start >= maxoff)
elog(FATAL, "btree: cannot split if start (%d) >= maxoff (%d)",
@@ -1072,18 +1072,18 @@ _bt_findsplitloc(Relation rel,
static void
_bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
{
- Buffer rootbuf;
- Page lpage,
- rpage,
- rootpage;
- BlockNumber lbkno,
- rbkno;
- BlockNumber rootbknum;
- BTPageOpaque rootopaque;
- ItemId itemid;
- BTItem item;
- Size itemsz;
- BTItem new_item;
+ Buffer rootbuf;
+ Page lpage,
+ rpage,
+ rootpage;
+ BlockNumber lbkno,
+ rbkno;
+ BlockNumber rootbknum;
+ BTPageOpaque rootopaque;
+ ItemId itemid;
+ BTItem item;
+ Size itemsz;
+ BTItem new_item;
/* get a new root page */
rootbuf = _bt_getbuf(rel, P_NEW, BT_WRITE);
@@ -1158,7 +1158,7 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
* to follow. Otherwise, we do a binary search for the correct place
* and insert the new item there.
*/
-static OffsetNumber
+static OffsetNumber
_bt_pgaddtup(Relation rel,
Buffer buf,
int keysz,
@@ -1167,11 +1167,11 @@ _bt_pgaddtup(Relation rel,
BTItem btitem,
BTItem afteritem)
{
- OffsetNumber itup_off;
- OffsetNumber first;
- Page page;
- BTPageOpaque opaque;
- BTItem chkitem;
+ OffsetNumber itup_off;
+ OffsetNumber first;
+ Page page;
+ BTPageOpaque opaque;
+ BTItem chkitem;
page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -1213,20 +1213,20 @@ _bt_pgaddtup(Relation rel,
* + the item it is to follow ("afteritem") appears on this
* page.
*/
-static bool
+static bool
_bt_goesonpg(Relation rel,
Buffer buf,
Size keysz,
ScanKey scankey,
BTItem afteritem)
{
- Page page;
- ItemId hikey;
- BTPageOpaque opaque;
- BTItem chkitem;
- OffsetNumber offnum,
- maxoff;
- bool found;
+ Page page;
+ ItemId hikey;
+ BTPageOpaque opaque;
+ BTItem chkitem;
+ OffsetNumber offnum,
+ maxoff;
+ bool found;
page = BufferGetPage(buf);
@@ -1314,16 +1314,16 @@ _bt_itemcmp(Relation rel,
BTItem item2,
StrategyNumber strat)
{
- TupleDesc tupDes;
- IndexTuple indexTuple1,
- indexTuple2;
- Datum attrDatum1,
- attrDatum2;
- int i;
- bool isFirstNull,
- isSecondNull;
- bool compare;
- bool useEqual = false;
+ TupleDesc tupDes;
+ IndexTuple indexTuple1,
+ indexTuple2;
+ Datum attrDatum1,
+ attrDatum2;
+ int i;
+ bool isFirstNull,
+ isSecondNull;
+ bool compare;
+ bool useEqual = false;
if (strat == BTLessEqualStrategyNumber)
{
@@ -1406,14 +1406,14 @@ _bt_updateitem(Relation rel,
BTItem oldItem,
BTItem newItem)
{
- Page page;
- OffsetNumber maxoff;
- OffsetNumber i;
+ Page page;
+ OffsetNumber maxoff;
+ OffsetNumber i;
ItemPointerData itemPtrData;
- BTItem item;
- IndexTuple oldIndexTuple,
- newIndexTuple;
- int first;
+ BTItem item;
+ IndexTuple oldIndexTuple,
+ newIndexTuple;
+ int first;
page = BufferGetPage(buf);
maxoff = PageGetMaxOffsetNumber(page);
@@ -1460,18 +1460,18 @@ _bt_updateitem(Relation rel,
*
* Rule is simple: NOT_NULL not equal NULL, NULL not_equal NULL too.
*/
-static bool
+static bool
_bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum,
int keysz, ScanKey scankey)
{
- Datum datum;
- BTItem btitem;
- IndexTuple itup;
- ScanKey entry;
- AttrNumber attno;
- long result;
- int i;
- bool null;
+ Datum datum;
+ BTItem btitem;
+ IndexTuple itup;
+ ScanKey entry;
+ AttrNumber attno;
+ long result;
+ int i;
+ bool null;
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offnum));
itup = &(btitem->bti_itup);
@@ -1504,27 +1504,27 @@ _bt_isequal(TupleDesc itupdesc, Page page, OffsetNumber offnum,
*
* NOTE: tested for shifting leftmost page only, having btitem < hikey.
*/
-static InsertIndexResult
+static InsertIndexResult
_bt_shift(Relation rel, Buffer buf, BTStack stack, int keysz,
ScanKey scankey, BTItem btitem, BTItem hikey)
{
InsertIndexResult res;
- int itemsz;
- Page page;
- BlockNumber bknum;
- BTPageOpaque pageop;
- Buffer rbuf;
- Page rpage;
- BTPageOpaque rpageop;
- Buffer pbuf;
- Page ppage;
- BTPageOpaque ppageop;
- Buffer nbuf;
- Page npage;
- BTPageOpaque npageop;
- BlockNumber nbknum;
- BTItem nitem;
- OffsetNumber afteroff;
+ int itemsz;
+ Page page;
+ BlockNumber bknum;
+ BTPageOpaque pageop;
+ Buffer rbuf;
+ Page rpage;
+ BTPageOpaque rpageop;
+ Buffer pbuf;
+ Page ppage;
+ BTPageOpaque ppageop;
+ Buffer nbuf;
+ Page npage;
+ BTPageOpaque npageop;
+ BlockNumber nbknum;
+ BTItem nitem;
+ OffsetNumber afteroff;
btitem = _bt_formitem(&(btitem->bti_itup));
hikey = _bt_formitem(&(hikey->bti_itup));
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c
index 6551af4c17..fe3bebbccd 100644
--- a/src/backend/access/nbtree/nbtpage.c
+++ b/src/backend/access/nbtree/nbtpage.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.10 1997/09/07 04:38:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.11 1997/09/08 02:20:49 momjian Exp $
*
* NOTES
* Postgres btree pages look like ordinary relation pages. The opaque
@@ -36,8 +36,8 @@
#include <string.h>
#endif
-static void _bt_setpagelock(Relation rel, BlockNumber blkno, int access);
-static void _bt_unsetpagelock(Relation rel, BlockNumber blkno, int access);
+static void _bt_setpagelock(Relation rel, BlockNumber blkno, int access);
+static void _bt_unsetpagelock(Relation rel, BlockNumber blkno, int access);
#define BTREE_METAPAGE 0
#define BTREE_MAGIC 0x053162
@@ -50,18 +50,18 @@ static void _bt_unsetpagelock(Relation rel, BlockNumber blkno, int access);
typedef struct BTMetaPageData
{
- uint32 btm_magic;
- uint32 btm_version;
- BlockNumber btm_root;
+ uint32 btm_magic;
+ uint32 btm_version;
+ BlockNumber btm_root;
#ifdef BTREE_VERSION_1
- int32 btm_level;
+ int32 btm_level;
#endif
-} BTMetaPageData;
+} BTMetaPageData;
#define BTPageGetMeta(p) \
((BTMetaPageData *) &((PageHeader) p)->pd_linp[0])
-extern bool BuildingBtree;
+extern bool BuildingBtree;
/*
* We use high-concurrency locking on btrees. There are two cases in
@@ -85,11 +85,11 @@ extern bool BuildingBtree;
void
_bt_metapinit(Relation rel)
{
- Buffer buf;
- Page pg;
- int nblocks;
- BTMetaPageData metad;
- BTPageOpaque op;
+ Buffer buf;
+ Page pg;
+ int nblocks;
+ BTMetaPageData metad;
+ BTPageOpaque op;
/* can't be sharing this with anyone, now... */
if (USELOCKING)
@@ -131,11 +131,11 @@ _bt_metapinit(Relation rel)
void
_bt_checkmeta(Relation rel)
{
- Buffer metabuf;
- Page metap;
+ Buffer metabuf;
+ Page metap;
BTMetaPageData *metad;
- BTPageOpaque op;
- int nblocks;
+ BTPageOpaque op;
+ int nblocks;
/* if the relation is empty, this is init time; don't complain */
if ((nblocks = RelationGetNumberOfBlocks(rel)) == 0)
@@ -187,13 +187,13 @@ _bt_checkmeta(Relation rel)
Buffer
_bt_getroot(Relation rel, int access)
{
- Buffer metabuf;
- Page metapg;
- BTPageOpaque metaopaque;
- Buffer rootbuf;
- Page rootpg;
- BTPageOpaque rootopaque;
- BlockNumber rootblkno;
+ Buffer metabuf;
+ Page metapg;
+ BTPageOpaque metaopaque;
+ Buffer rootbuf;
+ Page rootpg;
+ BTPageOpaque rootopaque;
+ BlockNumber rootblkno;
BTMetaPageData *metad;
metabuf = _bt_getbuf(rel, BTREE_METAPAGE, BT_READ);
@@ -319,8 +319,8 @@ _bt_getroot(Relation rel, int access)
Buffer
_bt_getbuf(Relation rel, BlockNumber blkno, int access)
{
- Buffer buf;
- Page page;
+ Buffer buf;
+ Page page;
/*
* If we want a new block, we can't set a lock of the appropriate type
@@ -359,7 +359,7 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access)
void
_bt_relbuf(Relation rel, Buffer buf, int access)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
@@ -382,7 +382,7 @@ _bt_relbuf(Relation rel, Buffer buf, int access)
void
_bt_wrtbuf(Relation rel, Buffer buf)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
WriteBuffer(buf);
@@ -399,7 +399,7 @@ _bt_wrtbuf(Relation rel, Buffer buf)
void
_bt_wrtnorelbuf(Relation rel, Buffer buf)
{
- BlockNumber blkno;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(buf);
WriteNoReleaseBuffer(buf);
@@ -439,9 +439,9 @@ _bt_pageinit(Page page, Size size)
void
_bt_metaproot(Relation rel, BlockNumber rootbknum, int level)
{
- Buffer metabuf;
- Page metap;
- BTPageOpaque metaopaque;
+ Buffer metabuf;
+ Page metap;
+ BTPageOpaque metaopaque;
BTMetaPageData *metad;
metabuf = _bt_getbuf(rel, BTREE_METAPAGE, BT_WRITE);
@@ -473,18 +473,18 @@ _bt_metaproot(Relation rel, BlockNumber rootbknum, int level)
Buffer
_bt_getstackbuf(Relation rel, BTStack stack, int access)
{
- Buffer buf;
- BlockNumber blkno;
- OffsetNumber start,
- offnum,
- maxoff;
- OffsetNumber i;
- Page page;
- ItemId itemid;
- BTItem item;
- BTPageOpaque opaque;
- BTItem item_save;
- int item_nbytes;
+ Buffer buf;
+ BlockNumber blkno;
+ OffsetNumber start,
+ offnum,
+ maxoff;
+ OffsetNumber i;
+ Page page;
+ ItemId itemid;
+ BTItem item;
+ BTPageOpaque opaque;
+ BTItem item_save;
+ int item_nbytes;
blkno = stack->bts_blkno;
buf = _bt_getbuf(rel, blkno, access);
@@ -603,10 +603,10 @@ _bt_unsetpagelock(Relation rel, BlockNumber blkno, int access)
void
_bt_pagedel(Relation rel, ItemPointer tid)
{
- Buffer buf;
- Page page;
- BlockNumber blkno;
- OffsetNumber offno;
+ Buffer buf;
+ Page page;
+ BlockNumber blkno;
+ OffsetNumber offno;
blkno = ItemPointerGetBlockNumber(tid);
offno = ItemPointerGetOffsetNumber(tid);
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index dccbd77b35..9f7b59327a 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.20 1997/09/07 04:38:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.21 1997/09/08 02:20:50 momjian Exp $
*
* NOTES
* This file contains only the public interface routines.
@@ -35,14 +35,14 @@
#ifdef BTREE_BUILD_STATS
#include <tcop/tcopprot.h>
-extern int ShowExecutorStats;
+extern int ShowExecutorStats;
#endif
-bool BuildingBtree = false; /* see comment in btbuild() */
-bool FastBuild = true; /* use sort/build instead of
- * insertion build */
+bool BuildingBtree = false; /* see comment in btbuild() */
+bool FastBuild = true; /* use sort/build instead of insertion
+ * build */
/*
* btbuild() -- build a new btree index.
@@ -63,33 +63,33 @@ btbuild(Relation heap,
FuncIndexInfo * finfo,
PredInfo * predInfo)
{
- HeapScanDesc hscan;
- Buffer buffer;
- HeapTuple htup;
- IndexTuple itup;
- TupleDesc htupdesc,
- itupdesc;
- Datum *attdata;
- bool *nulls;
+ HeapScanDesc hscan;
+ Buffer buffer;
+ HeapTuple htup;
+ IndexTuple itup;
+ TupleDesc htupdesc,
+ itupdesc;
+ Datum *attdata;
+ bool *nulls;
InsertIndexResult res = 0;
- int nhtups,
- nitups;
- int i;
- BTItem btitem;
+ int nhtups,
+ nitups;
+ int i;
+ BTItem btitem;
#ifndef OMIT_PARTIAL_INDEX
- ExprContext *econtext = (ExprContext *) NULL;
- TupleTable tupleTable = (TupleTable) NULL;
+ ExprContext *econtext = (ExprContext *) NULL;
+ TupleTable tupleTable = (TupleTable) NULL;
TupleTableSlot *slot = (TupleTableSlot *) NULL;
#endif
- Oid hrelid,
- irelid;
- Node *pred,
- *oldPred;
- void *spool = (void *) NULL;
- bool isunique;
- bool usefast;
+ Oid hrelid,
+ irelid;
+ Node *pred,
+ *oldPred;
+ void *spool = (void *) NULL;
+ bool isunique;
+ bool usefast;
/* note that this is a new btree */
BuildingBtree = true;
@@ -211,8 +211,8 @@ btbuild(Relation heap,
for (i = 1; i <= natts; i++)
{
- int attoff;
- bool attnull;
+ int attoff;
+ bool attnull;
/*
* Offsets are from the start of the tuple, and are
@@ -358,8 +358,8 @@ btbuild(Relation heap,
InsertIndexResult
btinsert(Relation rel, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
{
- BTItem btitem;
- IndexTuple itup;
+ BTItem btitem;
+ IndexTuple itup;
InsertIndexResult res;
/* generate an index tuple */
@@ -389,7 +389,7 @@ btinsert(Relation rel, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation
/*
* btgettuple() -- Get the next tuple in the scan.
*/
-char *
+char *
btgettuple(IndexScanDesc scan, ScanDirection dir)
{
RetrieveIndexResult res;
@@ -411,10 +411,10 @@ btgettuple(IndexScanDesc scan, ScanDirection dir)
/*
* btbeginscan() -- start a scan on a btree index
*/
-char *
+char *
btbeginscan(Relation rel, bool fromEnd, uint16 keysz, ScanKey scankey)
{
- IndexScanDesc scan;
+ IndexScanDesc scan;
/* get the scan */
scan = RelationGetIndexScan(rel, fromEnd, keysz, scankey);
@@ -431,8 +431,8 @@ btbeginscan(Relation rel, bool fromEnd, uint16 keysz, ScanKey scankey)
void
btrescan(IndexScanDesc scan, bool fromEnd, ScanKey scankey)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
@@ -483,8 +483,8 @@ btrescan(IndexScanDesc scan, bool fromEnd, ScanKey scankey)
void
btmovescan(IndexScanDesc scan, Datum v)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
@@ -506,8 +506,8 @@ btmovescan(IndexScanDesc scan, Datum v)
void
btendscan(IndexScanDesc scan)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
@@ -541,8 +541,8 @@ btendscan(IndexScanDesc scan)
void
btmarkpos(IndexScanDesc scan)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
@@ -570,8 +570,8 @@ btmarkpos(IndexScanDesc scan)
void
btrestrpos(IndexScanDesc scan)
{
- ItemPointer iptr;
- BTScanOpaque so;
+ ItemPointer iptr;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
diff --git a/src/backend/access/nbtree/nbtscan.c b/src/backend/access/nbtree/nbtscan.c
index 8a2042403a..4f3ee1ffe6 100644
--- a/src/backend/access/nbtree/nbtscan.c
+++ b/src/backend/access/nbtree/nbtscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.8 1997/09/07 04:38:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtscan.c,v 1.9 1997/09/08 02:20:52 momjian Exp $
*
*
* NOTES
@@ -34,16 +34,16 @@
typedef struct BTScanListData
{
- IndexScanDesc btsl_scan;
+ IndexScanDesc btsl_scan;
struct BTScanListData *btsl_next;
-} BTScanListData;
+} BTScanListData;
typedef BTScanListData *BTScanList;
static BTScanList BTScans = (BTScanList) NULL;
-static void _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno);
-static bool _bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
+static void _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno);
+static bool _bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno);
/*
* _bt_regscan() -- register a new scan.
@@ -51,7 +51,7 @@ static bool _bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber
void
_bt_regscan(IndexScanDesc scan)
{
- BTScanList new_el;
+ BTScanList new_el;
new_el = (BTScanList) palloc(sizeof(BTScanListData));
new_el->btsl_scan = scan;
@@ -65,8 +65,8 @@ _bt_regscan(IndexScanDesc scan)
void
_bt_dropscan(IndexScanDesc scan)
{
- BTScanList chk,
- last;
+ BTScanList chk,
+ last;
last = (BTScanList) NULL;
for (chk = BTScans;
@@ -94,8 +94,8 @@ _bt_dropscan(IndexScanDesc scan)
void
_bt_adjscans(Relation rel, ItemPointer tid, int op)
{
- BTScanList l;
- Oid relid;
+ BTScanList l;
+ Oid relid;
relid = rel->rd_id;
for (l = BTScans; l != (BTScanList) NULL; l = l->btsl_next)
@@ -130,9 +130,9 @@ _bt_adjscans(Relation rel, ItemPointer tid, int op)
static void
_bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
{
- ItemPointer current;
- Buffer buf;
- BTScanOpaque so;
+ ItemPointer current;
+ Buffer buf;
+ BTScanOpaque so;
if (!_bt_scantouched(scan, blkno, offno))
return;
@@ -147,15 +147,15 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
{
switch (op)
{
- case BT_INSERT:
- _bt_step(scan, &buf, ForwardScanDirection);
- break;
- case BT_DELETE:
- _bt_step(scan, &buf, BackwardScanDirection);
- break;
- default:
- elog(WARN, "_bt_scandel: bad operation '%d'", op);
- /* NOTREACHED */
+ case BT_INSERT:
+ _bt_step(scan, &buf, ForwardScanDirection);
+ break;
+ case BT_DELETE:
+ _bt_step(scan, &buf, BackwardScanDirection);
+ break;
+ default:
+ elog(WARN, "_bt_scandel: bad operation '%d'", op);
+ /* NOTREACHED */
}
so->btso_curbuf = buf;
}
@@ -172,15 +172,15 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
scan->currentItemData = tmp;
switch (op)
{
- case BT_INSERT:
- _bt_step(scan, &buf, ForwardScanDirection);
- break;
- case BT_DELETE:
- _bt_step(scan, &buf, BackwardScanDirection);
- break;
- default:
- elog(WARN, "_bt_scandel: bad operation '%d'", op);
- /* NOTREACHED */
+ case BT_INSERT:
+ _bt_step(scan, &buf, ForwardScanDirection);
+ break;
+ case BT_DELETE:
+ _bt_step(scan, &buf, BackwardScanDirection);
+ break;
+ default:
+ elog(WARN, "_bt_scandel: bad operation '%d'", op);
+ /* NOTREACHED */
}
so->btso_mrkbuf = buf;
tmp = *current;
@@ -193,10 +193,10 @@ _bt_scandel(IndexScanDesc scan, int op, BlockNumber blkno, OffsetNumber offno)
* _bt_scantouched() -- check to see if a scan is affected by a given
* change to the index
*/
-static bool
+static bool
_bt_scantouched(IndexScanDesc scan, BlockNumber blkno, OffsetNumber offno)
{
- ItemPointer current;
+ ItemPointer current;
current = &(scan->currentItemData);
if (ItemPointerIsValid(current)
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index 8b1f75b753..50f2031779 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.24 1997/09/07 04:38:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsearch.c,v 1.25 1997/09/08 02:20:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,19 +28,19 @@
#endif
-static BTStack
+static BTStack
_bt_searchr(Relation rel, int keysz, ScanKey scankey,
Buffer * bufP, BTStack stack_in);
-static OffsetNumber
+static OffsetNumber
_bt_firsteq(Relation rel, TupleDesc itupdesc, Page page,
Size keysz, ScanKey scankey, OffsetNumber offnum);
static int
_bt_compare(Relation rel, TupleDesc itupdesc, Page page,
int keysz, ScanKey scankey, OffsetNumber offnum);
-static bool
- _bt_twostep(IndexScanDesc scan, Buffer * bufP, ScanDirection dir);
-static RetrieveIndexResult
- _bt_endpoint(IndexScanDesc scan, ScanDirection dir);
+static bool
+ _bt_twostep(IndexScanDesc scan, Buffer * bufP, ScanDirection dir);
+static RetrieveIndexResult
+ _bt_endpoint(IndexScanDesc scan, ScanDirection dir);
/*
* _bt_search() -- Search for a scan key in the index.
@@ -58,24 +58,24 @@ _bt_search(Relation rel, int keysz, ScanKey scankey, Buffer * bufP)
/*
* _bt_searchr() -- Search the tree recursively for a particular scankey.
*/
-static BTStack
+static BTStack
_bt_searchr(Relation rel,
int keysz,
ScanKey scankey,
Buffer * bufP,
BTStack stack_in)
{
- BTStack stack;
- OffsetNumber offnum;
- Page page;
- BTPageOpaque opaque;
- BlockNumber par_blkno;
- BlockNumber blkno;
- ItemId itemid;
- BTItem btitem;
- BTItem item_save;
- int item_nbytes;
- IndexTuple itup;
+ BTStack stack;
+ OffsetNumber offnum;
+ Page page;
+ BTPageOpaque opaque;
+ BlockNumber par_blkno;
+ BlockNumber blkno;
+ ItemId itemid;
+ BTItem btitem;
+ BTItem item_save;
+ int item_nbytes;
+ IndexTuple itup;
/* if this is a leaf page, we're done */
page = BufferGetPage(*bufP);
@@ -155,11 +155,11 @@ _bt_moveright(Relation rel,
ScanKey scankey,
int access)
{
- Page page;
- BTPageOpaque opaque;
- ItemId hikey;
- BlockNumber rblkno;
- int natts = rel->rd_rel->relnatts;
+ Page page;
+ BTPageOpaque opaque;
+ ItemId hikey;
+ BlockNumber rblkno;
+ int natts = rel->rd_rel->relnatts;
page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -183,7 +183,7 @@ _bt_moveright(Relation rel,
/* move right as long as we need to */
do
{
- OffsetNumber offmax = PageGetMaxOffsetNumber(page);
+ OffsetNumber offmax = PageGetMaxOffsetNumber(page);
/*
* If this page consists of all duplicate keys (hikey and
@@ -197,8 +197,8 @@ _bt_moveright(Relation rel,
* if number of attrs > keysize. Example: (2,0) - last items
* on this page, (2,1) - first item on next page (hikey), our
* scankey is x = 2. Scankey == (2,1) because of we compare
- * first attrs only, but we shouldn't to move right of here.
- * - vadim 04/15/97
+ * first attrs only, but we shouldn't to move right of here. -
+ * vadim 04/15/97
*/
if (_bt_skeycmp(rel, keysz, scankey, page, hikey,
@@ -268,17 +268,17 @@ _bt_skeycmp(Relation rel,
ItemId itemid,
StrategyNumber strat)
{
- BTItem item;
- IndexTuple indexTuple;
- TupleDesc tupDes;
- ScanKey entry;
- int i;
- Datum attrDatum;
- Datum keyDatum;
- bool compare;
- bool isNull;
- bool useEqual = false;
- bool keyNull;
+ BTItem item;
+ IndexTuple indexTuple;
+ TupleDesc tupDes;
+ ScanKey entry;
+ int i;
+ Datum attrDatum;
+ Datum keyDatum;
+ bool compare;
+ bool isNull;
+ bool useEqual = false;
+ bool keyNull;
if (strat == BTLessEqualStrategyNumber)
{
@@ -382,14 +382,14 @@ _bt_binsrch(Relation rel,
ScanKey scankey,
int srchtype)
{
- TupleDesc itupdesc;
- Page page;
- BTPageOpaque opaque;
- OffsetNumber low,
- mid,
- high;
- int natts = rel->rd_rel->relnatts;
- int result;
+ TupleDesc itupdesc;
+ Page page;
+ BTPageOpaque opaque;
+ OffsetNumber low,
+ mid,
+ high;
+ int natts = rel->rd_rel->relnatts;
+ int result;
itupdesc = RelationGetTupleDescriptor(rel);
page = BufferGetPage(buf);
@@ -515,7 +515,7 @@ _bt_binsrch(Relation rel,
}
}
-static OffsetNumber
+static OffsetNumber
_bt_firsteq(Relation rel,
TupleDesc itupdesc,
Page page,
@@ -523,8 +523,8 @@ _bt_firsteq(Relation rel,
ScanKey scankey,
OffsetNumber offnum)
{
- BTPageOpaque opaque;
- OffsetNumber limit;
+ BTPageOpaque opaque;
+ OffsetNumber limit;
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
@@ -572,16 +572,16 @@ _bt_compare(Relation rel,
ScanKey scankey,
OffsetNumber offnum)
{
- Datum datum;
- BTItem btitem;
- ItemId itemid;
- IndexTuple itup;
- BTPageOpaque opaque;
- ScanKey entry;
- AttrNumber attno;
- int result;
- int i;
- bool null;
+ Datum datum;
+ BTItem btitem;
+ ItemId itemid;
+ IndexTuple itup;
+ BTPageOpaque opaque;
+ ScanKey entry;
+ AttrNumber attno;
+ int result;
+ int i;
+ bool null;
/*
* If this is a leftmost internal page, and if our comparison is with
@@ -650,7 +650,7 @@ _bt_compare(Relation rel,
for (i = 1; i <= keysz; i++)
{
- long tmpres;
+ long tmpres;
entry = &scankey[i - 1];
attno = entry->sk_attno;
@@ -697,16 +697,16 @@ _bt_compare(Relation rel,
RetrieveIndexResult
_bt_next(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- Buffer buf;
- Page page;
- OffsetNumber offnum;
+ Relation rel;
+ Buffer buf;
+ Page page;
+ OffsetNumber offnum;
RetrieveIndexResult res;
- ItemPointer current;
- BTItem btitem;
- IndexTuple itup;
- BTScanOpaque so;
- Size keysok;
+ ItemPointer current;
+ BTItem btitem;
+ IndexTuple itup;
+ BTScanOpaque so;
+ Size keysok;
rel = scan->relation;
so = (BTScanOpaque) scan->opaque;
@@ -769,26 +769,26 @@ _bt_next(IndexScanDesc scan, ScanDirection dir)
RetrieveIndexResult
_bt_first(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- TupleDesc itupdesc;
- Buffer buf;
- Page page;
- BTPageOpaque pop;
- BTStack stack;
- OffsetNumber offnum,
- maxoff;
- bool offGmax = false;
- BTItem btitem;
- IndexTuple itup;
- ItemPointer current;
- BlockNumber blkno;
- StrategyNumber strat;
+ Relation rel;
+ TupleDesc itupdesc;
+ Buffer buf;
+ Page page;
+ BTPageOpaque pop;
+ BTStack stack;
+ OffsetNumber offnum,
+ maxoff;
+ bool offGmax = false;
+ BTItem btitem;
+ IndexTuple itup;
+ ItemPointer current;
+ BlockNumber blkno;
+ StrategyNumber strat;
RetrieveIndexResult res;
- RegProcedure proc;
- int result;
- BTScanOpaque so;
- ScanKeyData skdata;
- Size keysok;
+ RegProcedure proc;
+ int result;
+ BTScanOpaque so;
+ ScanKeyData skdata;
+ Size keysok;
rel = scan->relation;
so = (BTScanOpaque) scan->opaque;
@@ -915,69 +915,69 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
switch (strat)
{
- case BTLessStrategyNumber:
- if (result <= 0)
- {
- do
+ case BTLessStrategyNumber:
+ if (result <= 0)
{
- if (!_bt_twostep(scan, &buf, BackwardScanDirection))
- break;
+ do
+ {
+ if (!_bt_twostep(scan, &buf, BackwardScanDirection))
+ break;
- offnum = ItemPointerGetOffsetNumber(current);
- page = BufferGetPage(buf);
- result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
- } while (result <= 0);
+ offnum = ItemPointerGetOffsetNumber(current);
+ page = BufferGetPage(buf);
+ result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
+ } while (result <= 0);
- /* if this is true, the key we just looked at is gone */
- if (result > 0)
- _bt_twostep(scan, &buf, ForwardScanDirection);
- }
- break;
+ /* if this is true, the key we just looked at is gone */
+ if (result > 0)
+ _bt_twostep(scan, &buf, ForwardScanDirection);
+ }
+ break;
- case BTLessEqualStrategyNumber:
- if (result >= 0)
- {
- do
+ case BTLessEqualStrategyNumber:
+ if (result >= 0)
{
- if (!_bt_twostep(scan, &buf, ForwardScanDirection))
- break;
+ do
+ {
+ if (!_bt_twostep(scan, &buf, ForwardScanDirection))
+ break;
- offnum = ItemPointerGetOffsetNumber(current);
- page = BufferGetPage(buf);
- result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
- } while (result >= 0);
+ offnum = ItemPointerGetOffsetNumber(current);
+ page = BufferGetPage(buf);
+ result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
+ } while (result >= 0);
- if (result < 0)
- _bt_twostep(scan, &buf, BackwardScanDirection);
- }
- break;
+ if (result < 0)
+ _bt_twostep(scan, &buf, BackwardScanDirection);
+ }
+ break;
- case BTEqualStrategyNumber:
- if (result != 0)
- {
- _bt_relbuf(scan->relation, buf, BT_READ);
- so->btso_curbuf = InvalidBuffer;
- ItemPointerSetInvalid(&(scan->currentItemData));
- return ((RetrieveIndexResult) NULL);
- }
- break;
+ case BTEqualStrategyNumber:
+ if (result != 0)
+ {
+ _bt_relbuf(scan->relation, buf, BT_READ);
+ so->btso_curbuf = InvalidBuffer;
+ ItemPointerSetInvalid(&(scan->currentItemData));
+ return ((RetrieveIndexResult) NULL);
+ }
+ break;
- case BTGreaterEqualStrategyNumber:
- if (offGmax)
- {
- if (result < 0)
+ case BTGreaterEqualStrategyNumber:
+ if (offGmax)
{
- Assert(!P_RIGHTMOST(pop) && maxoff == P_HIKEY);
- if (!_bt_step(scan, &buf, ForwardScanDirection))
+ if (result < 0)
{
- _bt_relbuf(scan->relation, buf, BT_READ);
- so->btso_curbuf = InvalidBuffer;
- ItemPointerSetInvalid(&(scan->currentItemData));
- return ((RetrieveIndexResult) NULL);
+ Assert(!P_RIGHTMOST(pop) && maxoff == P_HIKEY);
+ if (!_bt_step(scan, &buf, ForwardScanDirection))
+ {
+ _bt_relbuf(scan->relation, buf, BT_READ);
+ so->btso_curbuf = InvalidBuffer;
+ ItemPointerSetInvalid(&(scan->currentItemData));
+ return ((RetrieveIndexResult) NULL);
+ }
}
- }
- else if (result > 0)
- { /* Just remember: _bt_binsrch() returns
+ else if (result > 0)
+ { /* Just remember: _bt_binsrch() returns
* the OffsetNumber of the first matching
* key on the page, or the OffsetNumber at
* which the matching key WOULD APPEAR IF
@@ -985,41 +985,41 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
* page, but offnum from _bt_binsrch()
* greater maxoff - have to move right. -
* vadim 12/06/96 */
- _bt_twostep(scan, &buf, ForwardScanDirection);
+ _bt_twostep(scan, &buf, ForwardScanDirection);
+ }
}
- }
- else if (result < 0)
- {
- do
+ else if (result < 0)
{
- if (!_bt_twostep(scan, &buf, BackwardScanDirection))
- break;
+ do
+ {
+ if (!_bt_twostep(scan, &buf, BackwardScanDirection))
+ break;
- page = BufferGetPage(buf);
- offnum = ItemPointerGetOffsetNumber(current);
- result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
- } while (result < 0);
+ page = BufferGetPage(buf);
+ offnum = ItemPointerGetOffsetNumber(current);
+ result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
+ } while (result < 0);
- if (result > 0)
- _bt_twostep(scan, &buf, ForwardScanDirection);
- }
- break;
+ if (result > 0)
+ _bt_twostep(scan, &buf, ForwardScanDirection);
+ }
+ break;
- case BTGreaterStrategyNumber:
- /* offGmax helps as above */
- if (result >= 0 || offGmax)
- {
- do
+ case BTGreaterStrategyNumber:
+ /* offGmax helps as above */
+ if (result >= 0 || offGmax)
{
- if (!_bt_twostep(scan, &buf, ForwardScanDirection))
- break;
+ do
+ {
+ if (!_bt_twostep(scan, &buf, ForwardScanDirection))
+ break;
- offnum = ItemPointerGetOffsetNumber(current);
- page = BufferGetPage(buf);
- result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
- } while (result >= 0);
- }
- break;
+ offnum = ItemPointerGetOffsetNumber(current);
+ page = BufferGetPage(buf);
+ result = _bt_compare(rel, itupdesc, page, 1, &skdata, offnum);
+ } while (result >= 0);
+ }
+ break;
}
/* okay, current item pointer for the scan is right */
@@ -1062,16 +1062,16 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
bool
_bt_step(IndexScanDesc scan, Buffer * bufP, ScanDirection dir)
{
- Page page;
- BTPageOpaque opaque;
- OffsetNumber offnum,
- maxoff;
- OffsetNumber start;
- BlockNumber blkno;
- BlockNumber obknum;
- BTScanOpaque so;
- ItemPointer current;
- Relation rel;
+ Page page;
+ BTPageOpaque opaque;
+ OffsetNumber offnum,
+ maxoff;
+ OffsetNumber start;
+ BlockNumber blkno;
+ BlockNumber obknum;
+ BTScanOpaque so;
+ ItemPointer current;
+ Relation rel;
rel = scan->relation;
current = &(scan->currentItemData);
@@ -1235,20 +1235,20 @@ _bt_step(IndexScanDesc scan, Buffer * bufP, ScanDirection dir)
* proper state and acquires a lock and pin on *bufP. If the twostep
* succeeded, we return true; otherwise, we return false.
*/
-static bool
+static bool
_bt_twostep(IndexScanDesc scan, Buffer * bufP, ScanDirection dir)
{
- Page page;
- BTPageOpaque opaque;
- OffsetNumber offnum,
- maxoff;
- OffsetNumber start;
- ItemPointer current;
- ItemId itemid;
- int itemsz;
- BTItem btitem;
- BTItem svitem;
- BlockNumber blkno;
+ Page page;
+ BTPageOpaque opaque;
+ OffsetNumber offnum,
+ maxoff;
+ OffsetNumber start;
+ ItemPointer current;
+ ItemId itemid;
+ int itemsz;
+ BTItem btitem;
+ BTItem svitem;
+ BlockNumber blkno;
blkno = BufferGetBlockNumber(*bufP);
page = BufferGetPage(*bufP);
@@ -1333,23 +1333,23 @@ _bt_twostep(IndexScanDesc scan, Buffer * bufP, ScanDirection dir)
/*
* _bt_endpoint() -- Find the first or last key in the index.
*/
-static RetrieveIndexResult
+static RetrieveIndexResult
_bt_endpoint(IndexScanDesc scan, ScanDirection dir)
{
- Relation rel;
- Buffer buf;
- Page page;
- BTPageOpaque opaque;
- ItemPointer current;
- OffsetNumber offnum,
- maxoff;
- OffsetNumber start = 0;
- BlockNumber blkno;
- BTItem btitem;
- IndexTuple itup;
- BTScanOpaque so;
+ Relation rel;
+ Buffer buf;
+ Page page;
+ BTPageOpaque opaque;
+ ItemPointer current;
+ OffsetNumber offnum,
+ maxoff;
+ OffsetNumber start = 0;
+ BlockNumber blkno;
+ BTItem btitem;
+ IndexTuple itup;
+ BTScanOpaque so;
RetrieveIndexResult res;
- Size keysok;
+ Size keysok;
rel = scan->relation;
current = &(scan->currentItemData);
diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c
index 09cb43769f..fae0fc27da 100644
--- a/src/backend/access/nbtree/nbtsort.c
+++ b/src/backend/access/nbtree/nbtsort.c
@@ -5,7 +5,7 @@
*
*
* IDENTIFICATION
- * $Id: nbtsort.c,v 1.20 1997/09/07 04:39:02 momjian Exp $
+ * $Id: nbtsort.c,v 1.21 1997/09/08 02:20:58 momjian Exp $
*
* NOTES
*
@@ -65,14 +65,14 @@
#ifdef BTREE_BUILD_STATS
#include <tcop/tcopprot.h>
-extern int ShowExecutorStats;
+extern int ShowExecutorStats;
#endif
-static BTItem _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags);
-static BTItem _bt_minitem(Page opage, BlockNumber oblkno, int atend);
-static void *_bt_pagestate(Relation index, int flags, int level, bool doupper);
-static void _bt_uppershutdown(Relation index, BTPageState * state);
+static BTItem _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags);
+static BTItem _bt_minitem(Page opage, BlockNumber oblkno, int atend);
+static void *_bt_pagestate(Relation index, int flags, int level, bool doupper);
+static void _bt_uppershutdown(Relation index, BTPageState * state);
/*
* turn on debugging output.
@@ -88,9 +88,9 @@ static void _bt_uppershutdown(Relation index, BTPageState * state);
#define TAPEBLCKSZ (MAXBLCKSZ << 2)
#define TAPETEMP "pg_btsortXXXXXX"
-extern int NDirectFileRead;
-extern int NDirectFileWrite;
-extern char *mktemp(char *template);
+extern int NDirectFileRead;
+extern int NDirectFileWrite;
+extern char *mktemp(char *template);
/*
* this is what we use to shovel BTItems in and out of memory. it's
@@ -107,13 +107,13 @@ extern char *mktemp(char *template);
*/
typedef struct
{
- int bttb_magic; /* magic number */
- int bttb_fd; /* file descriptor */
- int bttb_top; /* top of free space within bttb_data */
- short bttb_ntup; /* number of tuples in this block */
- short bttb_eor; /* End-Of-Run marker */
- char bttb_data[TAPEBLCKSZ - 2 * sizeof(double)];
-} BTTapeBlock;
+ int bttb_magic; /* magic number */
+ int bttb_fd; /* file descriptor */
+ int bttb_top; /* top of free space within bttb_data */
+ short bttb_ntup; /* number of tuples in this block */
+ short bttb_eor; /* End-Of-Run marker */
+ char bttb_data[TAPEBLCKSZ - 2 * sizeof(double)];
+} BTTapeBlock;
/*
* this structure holds the bookkeeping for a simple balanced multiway
@@ -124,12 +124,12 @@ typedef struct
*/
typedef struct
{
- int bts_ntapes;
- int bts_tape;
- BTTapeBlock **bts_itape; /* input tape blocks */
- BTTapeBlock **bts_otape; /* output tape blocks */
- bool isunique;
-} BTSpool;
+ int bts_ntapes;
+ int bts_tape;
+ BTTapeBlock **bts_itape; /* input tape blocks */
+ BTTapeBlock **bts_otape; /* output tape blocks */
+ bool isunique;
+} BTSpool;
/*-------------------------------------------------------------------------
* sorting comparison routine - returns {-1,0,1} depending on whether
@@ -151,13 +151,13 @@ typedef struct
*/
typedef struct
{
- Datum *btsk_datum;
- char *btsk_nulls;
- BTItem btsk_item;
-} BTSortKey;
+ Datum *btsk_datum;
+ char *btsk_nulls;
+ BTItem btsk_item;
+} BTSortKey;
static Relation _bt_sortrel;
-static int _bt_nattr;
+static int _bt_nattr;
static BTSpool *_bt_inspool;
static void
@@ -171,12 +171,12 @@ _bt_isortcmpinit(Relation index, BTSpool * spool)
static int
_bt_isortcmp(BTSortKey * k1, BTSortKey * k2)
{
- Datum *k1_datum = k1->btsk_datum;
- Datum *k2_datum = k2->btsk_datum;
- char *k1_nulls = k1->btsk_nulls;
- char *k2_nulls = k2->btsk_nulls;
- bool equal_isnull = false;
- int i;
+ Datum *k1_datum = k1->btsk_datum;
+ Datum *k2_datum = k2->btsk_datum;
+ char *k1_nulls = k1->btsk_nulls;
+ char *k2_nulls = k2->btsk_nulls;
+ bool equal_isnull = false;
+ int i;
if (k1->btsk_item == (BTItem) NULL)
{
@@ -226,12 +226,12 @@ _bt_setsortkey(Relation index, BTItem bti, BTSortKey * sk)
if (bti != (BTItem) NULL)
{
- IndexTuple it = &(bti->bti_itup);
- TupleDesc itdesc = index->rd_att;
- Datum *dp = (Datum *) palloc(_bt_nattr * sizeof(Datum));
- char *np = (char *) palloc(_bt_nattr * sizeof(char));
- bool isnull;
- int i;
+ IndexTuple it = &(bti->bti_itup);
+ TupleDesc itdesc = index->rd_att;
+ Datum *dp = (Datum *) palloc(_bt_nattr * sizeof(Datum));
+ char *np = (char *) palloc(_bt_nattr * sizeof(char));
+ bool isnull;
+ int i;
for (i = 0; i < _bt_nattr; i++)
{
@@ -260,17 +260,17 @@ _bt_setsortkey(Relation index, BTItem bti, BTSortKey * sk)
*/
typedef struct
{
- int btpqe_tape; /* tape identifier */
- BTSortKey btpqe_item; /* pointer to BTItem in tape buffer */
-} BTPriQueueElem;
+ int btpqe_tape; /* tape identifier */
+ BTSortKey btpqe_item; /* pointer to BTItem in tape buffer */
+} BTPriQueueElem;
#define MAXELEM MAXTAPES
typedef struct
{
- int btpq_nelem;
- BTPriQueueElem btpq_queue[MAXELEM];
- Relation btpq_rel;
-} BTPriQueue;
+ int btpq_nelem;
+ BTPriQueueElem btpq_queue[MAXELEM];
+ Relation btpq_rel;
+} BTPriQueue;
/* be sure to call _bt_isortcmpinit first */
#define GREATER(a, b) \
@@ -279,8 +279,8 @@ typedef struct
static void
_bt_pqsift(BTPriQueue * q, int parent)
{
- int child;
- BTPriQueueElem e;
+ int child;
+ BTPriQueueElem e;
for (child = parent * 2 + 1;
child < q->btpq_nelem;
@@ -328,8 +328,8 @@ _bt_pqnext(BTPriQueue * q, BTPriQueueElem * e)
static void
_bt_pqadd(BTPriQueue * q, BTPriQueueElem * e)
{
- int child,
- parent;
+ int child,
+ parent;
if (q->btpq_nelem >= MAXELEM)
{
@@ -422,7 +422,7 @@ _bt_tapeclear(BTTapeBlock * tape)
static BTTapeBlock *
_bt_tapecreate(char *fname)
{
- BTTapeBlock *tape = (BTTapeBlock *) palloc(sizeof(BTTapeBlock));
+ BTTapeBlock *tape = (BTTapeBlock *) palloc(sizeof(BTTapeBlock));
if (tape == (BTTapeBlock *) NULL)
{
@@ -474,8 +474,8 @@ _bt_tapewrite(BTTapeBlock * tape, int eor)
static int
_bt_taperead(BTTapeBlock * tape)
{
- int fd;
- int nread;
+ int fd;
+ int nread;
if (tape->bttb_eor)
{
@@ -510,11 +510,11 @@ _bt_taperead(BTTapeBlock * tape)
* side effects:
* - sets 'pos' to the current position within the block.
*/
-static BTItem
+static BTItem
_bt_tapenext(BTTapeBlock * tape, char **pos)
{
- Size itemsz;
- BTItem bti;
+ Size itemsz;
+ BTItem bti;
if (*pos >= tape->bttb_data + tape->bttb_top)
{
@@ -554,12 +554,12 @@ _bt_tapeadd(BTTapeBlock * tape, BTItem item, int itemsz)
* create and initialize a spool structure, including the underlying
* files.
*/
-void *
+void *
_bt_spoolinit(Relation index, int ntapes, bool isunique)
{
- BTSpool *btspool = (BTSpool *) palloc(sizeof(BTSpool));
- int i;
- char *fname = (char *) palloc(sizeof(TAPETEMP) + 1);
+ BTSpool *btspool = (BTSpool *) palloc(sizeof(BTSpool));
+ int i;
+ char *fname = (char *) palloc(sizeof(TAPETEMP) + 1);
if (btspool == (BTSpool *) NULL || fname == (char *) NULL)
{
@@ -600,8 +600,8 @@ _bt_spoolinit(Relation index, int ntapes, bool isunique)
void
_bt_spooldestroy(void *spool)
{
- BTSpool *btspool = (BTSpool *) spool;
- int i;
+ BTSpool *btspool = (BTSpool *) spool;
+ int i;
for (i = 0; i < btspool->bts_ntapes; ++i)
{
@@ -617,7 +617,7 @@ _bt_spooldestroy(void *spool)
static void
_bt_spoolflush(BTSpool * btspool)
{
- int i;
+ int i;
for (i = 0; i < btspool->bts_ntapes; ++i)
{
@@ -637,10 +637,10 @@ _bt_spoolflush(BTSpool * btspool)
static void
_bt_spoolswap(BTSpool * btspool)
{
- File tmpfd;
- BTTapeBlock *itape;
- BTTapeBlock *otape;
- int i;
+ File tmpfd;
+ BTTapeBlock *itape;
+ BTTapeBlock *otape;
+ int i;
for (i = 0; i < btspool->bts_ntapes; ++i)
{
@@ -682,9 +682,9 @@ _bt_spoolswap(BTSpool * btspool)
void
_bt_spool(Relation index, BTItem btitem, void *spool)
{
- BTSpool *btspool = (BTSpool *) spool;
- BTTapeBlock *itape;
- Size itemsz;
+ BTSpool *btspool = (BTSpool *) spool;
+ BTTapeBlock *itape;
+ Size itemsz;
_bt_isortcmpinit(index, btspool);
@@ -699,13 +699,13 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
*/
if (btitem == (BTItem) NULL || SPCLEFT(itape) < itemsz)
{
- BTSortKey *parray = (BTSortKey *) NULL;
- BTTapeBlock *otape;
- BTItem bti;
- char *pos;
- int btisz;
- int it_ntup = itape->bttb_ntup;
- int i;
+ BTSortKey *parray = (BTSortKey *) NULL;
+ BTTapeBlock *otape;
+ BTItem bti;
+ char *pos;
+ int btisz;
+ int it_ntup = itape->bttb_ntup;
+ int i;
/*
* build an array of pointers to the BTItemDatas on the input
@@ -745,9 +745,9 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
_bt_tapeadd(otape, bti, btisz);
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_SPOOL)
{
- bool isnull;
- Datum d = index_getattr(&(bti->bti_itup), 1, index->rd_att,
- &isnull);
+ bool isnull;
+ Datum d = index_getattr(&(bti->bti_itup), 1, index->rd_att,
+ &isnull);
printf("_bt_spool: inserted <%x> into output tape %d\n",
d, btspool->bts_tape);
@@ -802,7 +802,7 @@ _bt_spool(Relation index, BTItem btitem, void *spool)
static void
_bt_blnewpage(Relation index, Buffer * buf, Page * page, int flags)
{
- BTPageOpaque opaque;
+ BTPageOpaque opaque;
*buf = _bt_getbuf(index, P_NEW, BT_WRITE);
#if 0
@@ -824,10 +824,10 @@ _bt_blnewpage(Relation index, Buffer * buf, Page * page, int flags)
static void
_bt_slideleft(Relation index, Buffer buf, Page page)
{
- OffsetNumber off;
- OffsetNumber maxoff;
- ItemId previi;
- ItemId thisii;
+ OffsetNumber off;
+ OffsetNumber maxoff;
+ ItemId previi;
+ ItemId thisii;
if (!PageIsEmpty(page))
{
@@ -847,10 +847,10 @@ _bt_slideleft(Relation index, Buffer buf, Page page)
* allocate and initialize a new BTPageState. the returned structure
* is suitable for immediate use by _bt_buildadd.
*/
-static void *
+static void *
_bt_pagestate(Relation index, int flags, int level, bool doupper)
{
- BTPageState *state = (BTPageState *) palloc(sizeof(BTPageState));
+ BTPageState *state = (BTPageState *) palloc(sizeof(BTPageState));
memset((char *) state, 0, sizeof(BTPageState));
_bt_blnewpage(index, &(state->btps_buf), &(state->btps_page), flags);
@@ -870,12 +870,12 @@ _bt_pagestate(Relation index, int flags, int level, bool doupper)
* the page to which the item used to point, e.g., a heap page if
* 'opage' is a leaf page).
*/
-static BTItem
+static BTItem
_bt_minitem(Page opage, BlockNumber oblkno, int atend)
{
- OffsetNumber off;
- BTItem obti;
- BTItem nbti;
+ OffsetNumber off;
+ BTItem obti;
+ BTItem nbti;
off = atend ? P_HIKEY : P_FIRSTKEY;
obti = (BTItem) PageGetItem(opage, PageGetItemId(opage, off));
@@ -924,18 +924,18 @@ _bt_minitem(Page opage, BlockNumber oblkno, int atend)
*
* if all keys are unique, 'first' will always be the same as 'last'.
*/
-static BTItem
+static BTItem
_bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
{
- BTPageState *state = (BTPageState *) pstate;
- Buffer nbuf;
- Page npage;
- BTItem last_bti;
- OffsetNumber first_off;
- OffsetNumber last_off;
- OffsetNumber off;
- Size pgspc;
- Size btisz;
+ BTPageState *state = (BTPageState *) pstate;
+ Buffer nbuf;
+ Page npage;
+ BTItem last_bti;
+ OffsetNumber first_off;
+ OffsetNumber last_off;
+ OffsetNumber off;
+ Size pgspc;
+ Size btisz;
nbuf = state->btps_buf;
npage = state->btps_page;
@@ -948,12 +948,12 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
btisz = DOUBLEALIGN(btisz);
if (pgspc < btisz)
{
- Buffer obuf = nbuf;
- Page opage = npage;
- OffsetNumber o,
- n;
- ItemId ii;
- ItemId hii;
+ Buffer obuf = nbuf;
+ Page opage = npage;
+ OffsetNumber o,
+ n;
+ ItemId ii;
+ ItemId hii;
_bt_blnewpage(index, &nbuf, &npage, flags);
@@ -989,11 +989,11 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
#if 0
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- BTItem tmpbti =
+ bool isnull;
+ BTItem tmpbti =
(BTItem) PageGetItem(npage, PageGetItemId(npage, n));
- Datum d = index_getattr(&(tmpbti->bti_itup), 1,
- index->rd_att, &isnull);
+ Datum d = index_getattr(&(tmpbti->bti_itup), 1,
+ index->rd_att, &isnull);
printf("_bt_buildadd: moved <%x> to offset %d at level %d\n",
d, n, state->btps_level);
@@ -1026,8 +1026,8 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
* set the page (side link) pointers.
*/
{
- BTPageOpaque oopaque = (BTPageOpaque) PageGetSpecialPointer(opage);
- BTPageOpaque nopaque = (BTPageOpaque) PageGetSpecialPointer(npage);
+ BTPageOpaque oopaque = (BTPageOpaque) PageGetSpecialPointer(opage);
+ BTPageOpaque nopaque = (BTPageOpaque) PageGetSpecialPointer(npage);
oopaque->btpo_next = BufferGetBlockNumber(nbuf);
nopaque->btpo_prev = BufferGetBlockNumber(obuf);
@@ -1047,7 +1047,7 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
*/
if (state->btps_doupper)
{
- BTItem nbti;
+ BTItem nbti;
if (state->btps_next == (BTPageState *) NULL)
{
@@ -1077,8 +1077,8 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
#if 0
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- Datum d = index_getattr(&(bti->bti_itup), 1, index->rd_att, &isnull);
+ bool isnull;
+ Datum d = index_getattr(&(bti->bti_itup), 1, index->rd_att, &isnull);
printf("_bt_buildadd: inserted <%x> at offset %d at level %d\n",
d, off, state->btps_level);
@@ -1109,10 +1109,10 @@ _bt_buildadd(Relation index, void *pstate, BTItem bti, int flags)
static void
_bt_uppershutdown(Relation index, BTPageState * state)
{
- BTPageState *s;
- BlockNumber blkno;
- BTPageOpaque opaque;
- BTItem bti;
+ BTPageState *s;
+ BlockNumber blkno;
+ BTPageOpaque opaque;
+ BTItem bti;
for (s = state; s != (BTPageState *) NULL; s = s->btps_next)
{
@@ -1160,21 +1160,21 @@ _bt_uppershutdown(Relation index, BTPageState * state)
static void
_bt_merge(Relation index, BTSpool * btspool)
{
- BTPageState *state;
- BTPriQueue q;
- BTPriQueueElem e;
- BTSortKey btsk;
- BTItem bti;
- BTTapeBlock *itape;
- BTTapeBlock *otape;
- char *tapepos[MAXTAPES];
- int tapedone[MAXTAPES];
- int t;
- int goodtapes;
- int npass;
- int nruns;
- Size btisz;
- bool doleaf = false;
+ BTPageState *state;
+ BTPriQueue q;
+ BTPriQueueElem e;
+ BTSortKey btsk;
+ BTItem bti;
+ BTTapeBlock *itape;
+ BTTapeBlock *otape;
+ char *tapepos[MAXTAPES];
+ int tapedone[MAXTAPES];
+ int t;
+ int goodtapes;
+ int npass;
+ int nruns;
+ Size btisz;
+ bool doleaf = false;
/*
* initialize state needed for the merge into the btree leaf pages.
@@ -1279,8 +1279,8 @@ _bt_merge(Relation index, BTSpool * btspool)
_bt_buildadd(index, state, bti, BTP_LEAF);
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- Datum d = index_getattr(&(bti->bti_itup), 1,
+ bool isnull;
+ Datum d = index_getattr(&(bti->bti_itup), 1,
index->rd_att, &isnull);
printf("_bt_merge: [pass %d run %d] inserted <%x> from tape %d into block %d\n",
@@ -1308,8 +1308,8 @@ _bt_merge(Relation index, BTSpool * btspool)
_bt_tapeadd(otape, bti, btisz);
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- Datum d = index_getattr(&(bti->bti_itup), 1,
+ bool isnull;
+ Datum d = index_getattr(&(bti->bti_itup), 1,
index->rd_att, &isnull);
printf("_bt_merge: [pass %d run %d] inserted <%x> from tape %d into output tape %d\n",
@@ -1328,7 +1328,7 @@ _bt_merge(Relation index, BTSpool * btspool)
itape = btspool->bts_itape[t];
if (!tapedone[t])
{
- BTItem newbti = _bt_tapenext(itape, &tapepos[t]);
+ BTItem newbti = _bt_tapenext(itape, &tapepos[t]);
if (newbti == (BTItem) NULL)
{
@@ -1347,7 +1347,7 @@ _bt_merge(Relation index, BTSpool * btspool)
}
if (newbti != (BTItem) NULL)
{
- BTPriQueueElem nexte;
+ BTPriQueueElem nexte;
nexte.btpqe_tape = t;
_bt_setsortkey(index, newbti, &(nexte.btpqe_item));
@@ -1397,12 +1397,12 @@ _bt_merge(Relation index, BTSpool * btspool)
void
_bt_upperbuild(Relation index)
{
- Buffer rbuf;
- BlockNumber blk;
- Page rpage;
- BTPageOpaque ropaque;
- BTPageState *state;
- BTItem nbti;
+ Buffer rbuf;
+ BlockNumber blk;
+ Page rpage;
+ BTPageOpaque ropaque;
+ BTPageState *state;
+ BTItem nbti;
/*
* find the first leaf block. while we're at it, clear the BTP_ROOT
@@ -1438,9 +1438,9 @@ _bt_upperbuild(Relation index)
nbti = _bt_minitem(rpage, blk, P_RIGHTMOST(ropaque));
#if defined(FASTBUILD_DEBUG) && defined(FASTBUILD_MERGE)
{
- bool isnull;
- Datum d = index_getattr(&(nbti->bti_itup), 1, index->rd_att,
- &isnull);
+ bool isnull;
+ Datum d = index_getattr(&(nbti->bti_itup), 1, index->rd_att,
+ &isnull);
printf("_bt_upperbuild: inserting <%x> at %d\n",
d, state->btps_level);
diff --git a/src/backend/access/nbtree/nbtstrat.c b/src/backend/access/nbtree/nbtstrat.c
index 5215d2000d..6af9df2b65 100644
--- a/src/backend/access/nbtree/nbtstrat.c
+++ b/src/backend/access/nbtree/nbtstrat.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.5 1997/09/07 04:39:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/Attic/nbtstrat.c,v 1.6 1997/09/08 02:20:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,7 +47,7 @@ static StrategyNumber BTNegateCommute[5] = {
BTGreaterEqualStrategyNumber
};
-static uint16 BTLessTermData[] = { /* XXX type clash */
+static uint16 BTLessTermData[] = { /* XXX type clash */
2,
BTLessStrategyNumber,
SK_NEGATE,
@@ -55,7 +55,7 @@ static uint16 BTLessTermData[] = { /* XXX type clash */
SK_NEGATE | SK_COMMUTE
};
-static uint16 BTLessEqualTermData[] = { /* XXX type clash */
+static uint16 BTLessEqualTermData[] = { /* XXX type clash */
2,
BTLessEqualStrategyNumber,
0x0,
@@ -63,7 +63,7 @@ static uint16 BTLessEqualTermData[] = { /* XXX type clash */
SK_COMMUTE
};
-static uint16 BTGreaterEqualTermData[] = { /* XXX type clash */
+static uint16 BTGreaterEqualTermData[] = { /* XXX type clash */
2,
BTGreaterEqualStrategyNumber,
0x0,
@@ -71,7 +71,7 @@ static uint16 BTGreaterEqualTermData[] = { /* XXX type clash */
SK_COMMUTE
};
-static uint16 BTGreaterTermData[] = { /* XXX type clash */
+static uint16 BTGreaterTermData[] = { /* XXX type clash */
2,
BTGreaterStrategyNumber,
SK_NEGATE,
@@ -109,7 +109,7 @@ _bt_getstrat(Relation rel,
AttrNumber attno,
RegProcedure proc)
{
- StrategyNumber strat;
+ StrategyNumber strat;
strat = RelationGetStrategy(rel, attno, &BTEvaluationData, proc);
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index 096f1d2691..0ee1ef9d32 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.12 1997/09/07 04:39:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtutils.c,v 1.13 1997/09/08 02:21:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,7 +23,7 @@
#include <catalog/pg_proc.h>
#include <executor/execdebug.h>
-extern int NIndexTupleProcessed;
+extern int NIndexTupleProcessed;
#ifndef HAVE_MEMMOVE
@@ -35,14 +35,14 @@ extern int NIndexTupleProcessed;
ScanKey
_bt_mkscankey(Relation rel, IndexTuple itup)
{
- ScanKey skey;
- TupleDesc itupdesc;
- int natts;
- int i;
- Datum arg;
- RegProcedure proc;
- bool null;
- bits16 flag;
+ ScanKey skey;
+ TupleDesc itupdesc;
+ int natts;
+ int i;
+ Datum arg;
+ RegProcedure proc;
+ bool null;
+ bits16 flag;
natts = rel->rd_rel->relnatts;
itupdesc = RelationGetTupleDescriptor(rel);
@@ -78,7 +78,7 @@ _bt_freeskey(ScanKey skey)
void
_bt_freestack(BTStack stack)
{
- BTStack ostack;
+ BTStack ostack;
while (stack != (BTStack) NULL)
{
@@ -99,18 +99,18 @@ _bt_freestack(BTStack stack)
void
_bt_orderkeys(Relation relation, BTScanOpaque so)
{
- ScanKey xform;
- ScanKeyData *cur;
- StrategyMap map;
- int nbytes;
- long test;
- int i,
- j;
- int init[BTMaxStrategyNumber + 1];
- ScanKey key;
- uint16 numberOfKeys = so->numberOfKeys;
- uint16 new_numberOfKeys = 0;
- AttrNumber attno = 1;
+ ScanKey xform;
+ ScanKeyData *cur;
+ StrategyMap map;
+ int nbytes;
+ long test;
+ int i,
+ j;
+ int init[BTMaxStrategyNumber + 1];
+ ScanKey key;
+ uint16 numberOfKeys = so->numberOfKeys;
+ uint16 new_numberOfKeys = 0;
+ AttrNumber attno = 1;
if (numberOfKeys < 1)
return;
@@ -169,8 +169,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
*/
if (init[BTEqualStrategyNumber - 1])
{
- ScanKeyData *eq,
- *chk;
+ ScanKeyData *eq,
+ *chk;
eq = &xform[BTEqualStrategyNumber - 1];
for (j = BTMaxStrategyNumber; --j >= 0;)
@@ -192,8 +192,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
if (init[BTLessStrategyNumber - 1]
&& init[BTLessEqualStrategyNumber - 1])
{
- ScanKeyData *lt,
- *le;
+ ScanKeyData *lt,
+ *le;
lt = &xform[BTLessStrategyNumber - 1];
le = &xform[BTLessEqualStrategyNumber - 1];
@@ -216,8 +216,8 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
if (init[BTGreaterStrategyNumber - 1]
&& init[BTGreaterEqualStrategyNumber - 1])
{
- ScanKeyData *gt,
- *ge;
+ ScanKeyData *gt,
+ *ge;
gt = &xform[BTGreaterStrategyNumber - 1];
ge = &xform[BTGreaterEqualStrategyNumber - 1];
@@ -288,10 +288,10 @@ _bt_orderkeys(Relation relation, BTScanOpaque so)
BTItem
_bt_formitem(IndexTuple itup)
{
- int nbytes_btitem;
- BTItem btitem;
- Size tuplen;
- extern Oid newoid();
+ int nbytes_btitem;
+ BTItem btitem;
+ Size tuplen;
+ extern Oid newoid();
/*
* see comments in btbuild
@@ -318,7 +318,7 @@ _bt_formitem(IndexTuple itup)
bool
_bt_checkqual(IndexScanDesc scan, IndexTuple itup)
{
- BTScanOpaque so;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
if (so->numberOfKeys > 0)
@@ -334,7 +334,7 @@ _bt_checkqual(IndexScanDesc scan, IndexTuple itup)
bool
_bt_checkforkeys(IndexScanDesc scan, IndexTuple itup, Size keysz)
{
- BTScanOpaque so;
+ BTScanOpaque so;
so = (BTScanOpaque) scan->opaque;
if (keysz > 0 && so->numberOfKeys >= keysz)
@@ -349,13 +349,13 @@ _bt_checkforkeys(IndexScanDesc scan, IndexTuple itup, Size keysz)
bool
_bt_checkkeys(IndexScanDesc scan, IndexTuple tuple, Size * keysok)
{
- BTScanOpaque so = (BTScanOpaque) scan->opaque;
- Size keysz = so->numberOfKeys;
- TupleDesc tupdesc;
- ScanKey key;
- Datum datum;
- bool isNull;
- int test;
+ BTScanOpaque so = (BTScanOpaque) scan->opaque;
+ Size keysz = so->numberOfKeys;
+ TupleDesc tupdesc;
+ ScanKey key;
+ Datum datum;
+ bool isNull;
+ int test;
*keysok = 0;
if (keysz == 0)
diff --git a/src/backend/access/rtree/rtget.c b/src/backend/access/rtree/rtget.c
index eaf16c1ae9..6a13b81a1f 100644
--- a/src/backend/access/rtree/rtget.c
+++ b/src/backend/access/rtree/rtget.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.8 1997/09/07 04:39:11 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtget.c,v 1.9 1997/09/08 02:21:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,19 +57,19 @@ rtgettuple(IndexScanDesc s, ScanDirection dir)
return (res);
}
-static RetrieveIndexResult
+static RetrieveIndexResult
rtfirst(IndexScanDesc s, ScanDirection dir)
{
- Buffer b;
- Page p;
- OffsetNumber n;
- OffsetNumber maxoff;
+ Buffer b;
+ Page p;
+ OffsetNumber n;
+ OffsetNumber maxoff;
RetrieveIndexResult res;
RTreePageOpaque po;
RTreeScanOpaque so;
- RTSTACK *stk;
- BlockNumber blk;
- IndexTuple it;
+ RTSTACK *stk;
+ BlockNumber blk;
+ IndexTuple it;
b = ReadBuffer(s->relation, P_ROOT);
p = BufferGetPage(b);
@@ -140,19 +140,19 @@ rtfirst(IndexScanDesc s, ScanDirection dir)
}
}
-static RetrieveIndexResult
+static RetrieveIndexResult
rtnext(IndexScanDesc s, ScanDirection dir)
{
- Buffer b;
- Page p;
- OffsetNumber n;
- OffsetNumber maxoff;
+ Buffer b;
+ Page p;
+ OffsetNumber n;
+ OffsetNumber maxoff;
RetrieveIndexResult res;
RTreePageOpaque po;
RTreeScanOpaque so;
- RTSTACK *stk;
- BlockNumber blk;
- IndexTuple it;
+ RTSTACK *stk;
+ BlockNumber blk;
+ IndexTuple it;
blk = ItemPointerGetBlockNumber(&(s->currentItemData));
n = ItemPointerGetOffsetNumber(&(s->currentItemData));
@@ -241,11 +241,11 @@ rtnext(IndexScanDesc s, ScanDirection dir)
}
}
-static OffsetNumber
+static OffsetNumber
findnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
{
- OffsetNumber maxoff;
- IndexTuple it;
+ OffsetNumber maxoff;
+ IndexTuple it;
RTreePageOpaque po;
RTreeScanOpaque so;
@@ -295,11 +295,11 @@ findnext(IndexScanDesc s, Page p, OffsetNumber n, ScanDirection dir)
return (n);
}
-static RetrieveIndexResult
+static RetrieveIndexResult
rtscancache(IndexScanDesc s, ScanDirection dir)
{
RetrieveIndexResult res;
- ItemPointer ip;
+ ItemPointer ip;
if (!(ScanDirectionIsNoMovement(dir)
&& ItemPointerIsValid(&(s->currentItemData))))
@@ -324,14 +324,14 @@ rtscancache(IndexScanDesc s, ScanDirection dir)
* rtheapptr returns the item pointer to the tuple in the heap relation
* for which itemp is the index relation item pointer.
*/
-static ItemPointer
+static ItemPointer
rtheapptr(Relation r, ItemPointer itemp)
{
- Buffer b;
- Page p;
- IndexTuple it;
- ItemPointer ip;
- OffsetNumber n;
+ Buffer b;
+ Page p;
+ IndexTuple it;
+ ItemPointer ip;
+ OffsetNumber n;
ip = (ItemPointer) palloc(sizeof(ItemPointerData));
if (ItemPointerIsValid(itemp))
diff --git a/src/backend/access/rtree/rtproc.c b/src/backend/access/rtree/rtproc.c
index 4b7a9f2a26..5f1d4846f6 100644
--- a/src/backend/access/rtree/rtproc.c
+++ b/src/backend/access/rtree/rtproc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.8 1997/09/07 04:39:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.9 1997/09/08 02:21:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,7 +25,7 @@
BOX
* rt_box_union(BOX * a, BOX * b)
{
- BOX *n;
+ BOX *n;
if ((n = (BOX *) palloc(sizeof(*n))) == (BOX *) NULL)
elog(WARN, "Cannot allocate box for union");
@@ -38,10 +38,10 @@ BOX
return (n);
}
-BOX *
+BOX *
rt_box_inter(BOX * a, BOX * b)
{
- BOX *n;
+ BOX *n;
if ((n = (BOX *) palloc(sizeof(*n))) == (BOX *) NULL)
elog(WARN, "Cannot allocate box for union");
@@ -85,10 +85,10 @@ rt_bigbox_size(BOX * a, float *size)
rt_box_size(a, size);
}
-POLYGON *
+POLYGON *
rt_poly_union(POLYGON * a, POLYGON * b)
{
- POLYGON *p;
+ POLYGON *p;
p = (POLYGON *) PALLOCTYPE(POLYGON);
@@ -108,8 +108,8 @@ rt_poly_union(POLYGON * a, POLYGON * b)
void
rt_poly_size(POLYGON * a, float *size)
{
- double xdim,
- ydim;
+ double xdim,
+ ydim;
size = (float *) palloc(sizeof(float));
if (a == (POLYGON *) NULL ||
@@ -127,10 +127,10 @@ rt_poly_size(POLYGON * a, float *size)
return;
}
-POLYGON *
+POLYGON *
rt_poly_inter(POLYGON * a, POLYGON * b)
{
- POLYGON *p;
+ POLYGON *p;
p = (POLYGON *) PALLOCTYPE(POLYGON);
diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c
index ae92ea2013..8b1aa533e8 100644
--- a/src/backend/access/rtree/rtree.c
+++ b/src/backend/access/rtree/rtree.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.14 1997/09/07 04:39:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.15 1997/09/08 02:21:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,20 +34,20 @@
typedef struct SPLITVEC
{
- OffsetNumber *spl_left;
- int spl_nleft;
- char *spl_ldatum;
- OffsetNumber *spl_right;
- int spl_nright;
- char *spl_rdatum;
-} SPLITVEC;
+ OffsetNumber *spl_left;
+ int spl_nleft;
+ char *spl_ldatum;
+ OffsetNumber *spl_right;
+ int spl_nright;
+ char *spl_rdatum;
+} SPLITVEC;
typedef struct RTSTATE
{
- func_ptr unionFn; /* union function */
- func_ptr sizeFn; /* size function */
- func_ptr interFn; /* intersection function */
-} RTSTATE;
+ func_ptr unionFn; /* union function */
+ func_ptr sizeFn; /* size function */
+ func_ptr interFn; /* intersection function */
+} RTSTATE;
/* non-export function prototypes */
static InsertIndexResult
@@ -62,16 +62,16 @@ dosplit(Relation r, Buffer buffer, RTSTACK * stack,
static void
rtintinsert(Relation r, RTSTACK * stk, IndexTuple ltup,
IndexTuple rtup, RTSTATE * rtstate);
-static void rtnewroot(Relation r, IndexTuple lt, IndexTuple rt);
+static void rtnewroot(Relation r, IndexTuple lt, IndexTuple rt);
static void
picksplit(Relation r, Page page, SPLITVEC * v, IndexTuple itup,
RTSTATE * rtstate);
-static void RTInitBuffer(Buffer b, uint32 f);
+static void RTInitBuffer(Buffer b, uint32 f);
static OffsetNumber
choose(Relation r, Page p, IndexTuple it,
RTSTATE * rtstate);
-static int nospace(Page p, IndexTuple it);
-static void initRtstate(RTSTATE * rtstate, Relation index);
+static int nospace(Page p, IndexTuple it);
+static void initRtstate(RTSTATE * rtstate, Relation index);
void
@@ -85,31 +85,31 @@ rtbuild(Relation heap,
FuncIndexInfo * finfo,
PredInfo * predInfo)
{
- HeapScanDesc scan;
- Buffer buffer;
- AttrNumber i;
- HeapTuple htup;
- IndexTuple itup;
- TupleDesc hd,
- id;
+ HeapScanDesc scan;
+ Buffer buffer;
+ AttrNumber i;
+ HeapTuple htup;
+ IndexTuple itup;
+ TupleDesc hd,
+ id;
InsertIndexResult res;
- Datum *d;
- bool *nulls;
- int nb,
- nh,
- ni;
+ Datum *d;
+ bool *nulls;
+ int nb,
+ nh,
+ ni;
#ifndef OMIT_PARTIAL_INDEX
- ExprContext *econtext;
- TupleTable tupleTable;
+ ExprContext *econtext;
+ TupleTable tupleTable;
TupleTableSlot *slot;
#endif
- Oid hrelid,
- irelid;
- Node *pred,
- *oldPred;
- RTSTATE rtState;
+ Oid hrelid,
+ irelid;
+ Node *pred,
+ *oldPred;
+ RTSTATE rtState;
initRtstate(&rtState, index);
@@ -215,8 +215,8 @@ rtbuild(Relation heap,
for (i = 1; i <= natts; i++)
{
- int attoff;
- bool attnull;
+ int attoff;
+ bool attnull;
/*
* Offsets are from the start of the tuple, and are
@@ -308,8 +308,8 @@ InsertIndexResult
rtinsert(Relation r, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation heapRel)
{
InsertIndexResult res;
- IndexTuple itup;
- RTSTATE rtState;
+ IndexTuple itup;
+ RTSTATE rtState;
/* generate an index tuple */
itup = index_formtuple(RelationGetTupleDescriptor(r), datum, nulls);
@@ -323,18 +323,18 @@ rtinsert(Relation r, Datum * datum, char *nulls, ItemPointer ht_ctid, Relation h
return (res);
}
-static InsertIndexResult
+static InsertIndexResult
rtdoinsert(Relation r, IndexTuple itup, RTSTATE * rtstate)
{
- Page page;
- Buffer buffer;
- BlockNumber blk;
- IndexTuple which;
- OffsetNumber l;
- RTSTACK *stack;
+ Page page;
+ Buffer buffer;
+ BlockNumber blk;
+ IndexTuple which;
+ OffsetNumber l;
+ RTSTACK *stack;
InsertIndexResult res;
RTreePageOpaque opaque;
- char *datum;
+ char *datum;
blk = P_ROOT;
buffer = InvalidBuffer;
@@ -353,8 +353,8 @@ rtdoinsert(Relation r, IndexTuple itup, RTSTATE * rtstate)
opaque = (RTreePageOpaque) PageGetSpecialPointer(page);
if (!(opaque->flags & F_LEAF))
{
- RTSTACK *n;
- ItemId iid;
+ RTSTACK *n;
+ ItemId iid;
n = (RTSTACK *) palloc(sizeof(RTSTACK));
n->rts_parent = stack;
@@ -414,12 +414,12 @@ rttighten(Relation r,
int att_size,
RTSTATE * rtstate)
{
- char *oldud;
- char *tdatum;
- Page p;
- float old_size,
- newd_size;
- Buffer b;
+ char *oldud;
+ char *tdatum;
+ Page p;
+ float old_size,
+ newd_size;
+ Buffer b;
if (stk == (RTSTACK *) NULL)
return;
@@ -437,7 +437,7 @@ rttighten(Relation r,
if (newd_size != old_size)
{
- TupleDesc td = RelationGetTupleDescriptor(r);
+ TupleDesc td = RelationGetTupleDescriptor(r);
if (td->attrs[0]->attlen < 0)
{
@@ -480,35 +480,35 @@ rttighten(Relation r,
* his paper. The reason we chose it is that you can implement this
* with less information about the data types on which you're operating.
*/
-static InsertIndexResult
+static InsertIndexResult
dosplit(Relation r,
Buffer buffer,
RTSTACK * stack,
IndexTuple itup,
RTSTATE * rtstate)
{
- Page p;
- Buffer leftbuf,
- rightbuf;
- Page left,
- right;
- ItemId itemid;
- IndexTuple item;
- IndexTuple ltup,
- rtup;
- OffsetNumber maxoff;
- OffsetNumber i;
- OffsetNumber leftoff,
- rightoff;
- BlockNumber lbknum,
- rbknum;
- BlockNumber bufblock;
+ Page p;
+ Buffer leftbuf,
+ rightbuf;
+ Page left,
+ right;
+ ItemId itemid;
+ IndexTuple item;
+ IndexTuple ltup,
+ rtup;
+ OffsetNumber maxoff;
+ OffsetNumber i;
+ OffsetNumber leftoff,
+ rightoff;
+ BlockNumber lbknum,
+ rbknum;
+ BlockNumber bufblock;
RTreePageOpaque opaque;
- int blank;
+ int blank;
InsertIndexResult res;
- char *isnull;
- SPLITVEC v;
- TupleDesc tupDesc;
+ char *isnull;
+ SPLITVEC v;
+ TupleDesc tupDesc;
isnull = (char *) palloc(r->rd_rel->relnatts);
for (blank = 0; blank < r->rd_rel->relnatts; blank++)
@@ -638,12 +638,12 @@ rtintinsert(Relation r,
IndexTuple rtup,
RTSTATE * rtstate)
{
- IndexTuple old;
- Buffer b;
- Page p;
- char *ldatum,
- *rdatum,
- *newdatum;
+ IndexTuple old;
+ Buffer b;
+ Page p;
+ char *ldatum,
+ *rdatum,
+ *newdatum;
InsertIndexResult res;
if (stk == (RTSTACK *) NULL)
@@ -698,8 +698,8 @@ rtintinsert(Relation r,
static void
rtnewroot(Relation r, IndexTuple lt, IndexTuple rt)
{
- Buffer b;
- Page p;
+ Buffer b;
+ Page p;
b = ReadBuffer(r, P_ROOT);
RTInitBuffer(b, 0);
@@ -718,33 +718,33 @@ picksplit(Relation r,
IndexTuple itup,
RTSTATE * rtstate)
{
- OffsetNumber maxoff;
- OffsetNumber i,
- j;
- IndexTuple item_1,
- item_2;
- char *datum_alpha,
- *datum_beta;
- char *datum_l,
- *datum_r;
- char *union_d,
- *union_dl,
- *union_dr;
- char *inter_d;
- bool firsttime;
- float size_alpha,
- size_beta,
- size_union,
- size_inter;
- float size_waste,
- waste;
- float size_l,
- size_r;
- int nbytes;
- OffsetNumber seed_1 = 0,
- seed_2 = 0;
- OffsetNumber *left,
- *right;
+ OffsetNumber maxoff;
+ OffsetNumber i,
+ j;
+ IndexTuple item_1,
+ item_2;
+ char *datum_alpha,
+ *datum_beta;
+ char *datum_l,
+ *datum_r;
+ char *union_d,
+ *union_dl,
+ *union_dr;
+ char *inter_d;
+ bool firsttime;
+ float size_alpha,
+ size_beta,
+ size_union,
+ size_inter;
+ float size_waste,
+ waste;
+ float size_l,
+ size_r;
+ int nbytes;
+ OffsetNumber seed_1 = 0,
+ seed_2 = 0;
+ OffsetNumber *left,
+ *right;
maxoff = PageGetMaxOffsetNumber(page);
@@ -886,8 +886,8 @@ static void
RTInitBuffer(Buffer b, uint32 f)
{
RTreePageOpaque opaque;
- Page page;
- Size pageSize;
+ Page page;
+ Size pageSize;
pageSize = BufferGetPageSize(b);
@@ -899,18 +899,18 @@ RTInitBuffer(Buffer b, uint32 f)
opaque->flags = f;
}
-static OffsetNumber
+static OffsetNumber
choose(Relation r, Page p, IndexTuple it, RTSTATE * rtstate)
{
- OffsetNumber maxoff;
- OffsetNumber i;
- char *ud,
- *id;
- char *datum;
- float usize,
- dsize;
- OffsetNumber which;
- float which_grow;
+ OffsetNumber maxoff;
+ OffsetNumber i;
+ char *ud,
+ *id;
+ char *datum;
+ float usize,
+ dsize;
+ OffsetNumber which;
+ float which_grow;
id = ((char *) it) + sizeof(IndexTupleData);
maxoff = PageGetMaxOffsetNumber(p);
@@ -946,7 +946,7 @@ nospace(Page p, IndexTuple it)
void
freestack(RTSTACK * s)
{
- RTSTACK *p;
+ RTSTACK *p;
while (s != (RTSTACK *) NULL)
{
@@ -956,13 +956,13 @@ freestack(RTSTACK * s)
}
}
-char *
+char *
rtdelete(Relation r, ItemPointer tid)
{
- BlockNumber blkno;
- OffsetNumber offnum;
- Buffer buf;
- Page page;
+ BlockNumber blkno;
+ OffsetNumber offnum;
+ Buffer buf;
+ Page page;
/* must write-lock on delete */
RelationSetLockForWrite(r);
@@ -988,11 +988,11 @@ rtdelete(Relation r, ItemPointer tid)
static void
initRtstate(RTSTATE * rtstate, Relation index)
{
- RegProcedure union_proc,
- size_proc,
- inter_proc;
- func_ptr user_fn;
- int pronargs;
+ RegProcedure union_proc,
+ size_proc,
+ inter_proc;
+ func_ptr user_fn;
+ int pronargs;
union_proc = index_getprocid(index, 1, RT_UNION_PROC);
size_proc = index_getprocid(index, 1, RT_SIZE_PROC);
@@ -1011,18 +1011,18 @@ initRtstate(RTSTATE * rtstate, Relation index)
void
_rtdump(Relation r)
{
- Buffer buf;
- Page page;
- OffsetNumber offnum,
- maxoff;
- BlockNumber blkno;
- BlockNumber nblocks;
+ Buffer buf;
+ Page page;
+ OffsetNumber offnum,
+ maxoff;
+ BlockNumber blkno;
+ BlockNumber nblocks;
RTreePageOpaque po;
- IndexTuple itup;
- BlockNumber itblkno;
- OffsetNumber itoffno;
- char *datum;
- char *itkey;
+ IndexTuple itup;
+ BlockNumber itblkno;
+ OffsetNumber itoffno;
+ char *datum;
+ char *itkey;
nblocks = RelationGetNumberOfBlocks(r);
for (blkno = 0; blkno < nblocks; blkno++)
diff --git a/src/backend/access/rtree/rtscan.c b/src/backend/access/rtree/rtscan.c
index 26590059d6..2a4810ccae 100644
--- a/src/backend/access/rtree/rtscan.c
+++ b/src/backend/access/rtree/rtscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.11 1997/09/07 04:39:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.12 1997/09/08 02:21:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,8 +28,8 @@
/* routines defined and used here */
-static void rtregscan(IndexScanDesc s);
-static void rtdropscan(IndexScanDesc s);
+static void rtregscan(IndexScanDesc s);
+static void rtdropscan(IndexScanDesc s);
static void
rtadjone(IndexScanDesc s, int op, BlockNumber blkno,
OffsetNumber offnum);
@@ -52,9 +52,9 @@ adjustiptr(IndexScanDesc s, ItemPointer iptr,
typedef struct RTScanListData
{
- IndexScanDesc rtsl_scan;
+ IndexScanDesc rtsl_scan;
struct RTScanListData *rtsl_next;
-} RTScanListData;
+} RTScanListData;
typedef RTScanListData *RTScanList;
@@ -67,7 +67,7 @@ rtbeginscan(Relation r,
uint16 nkeys,
ScanKey key)
{
- IndexScanDesc s;
+ IndexScanDesc s;
RelationSetLockForRead(r);
s = RelationGetIndexScan(r, fromEnd, nkeys, key);
@@ -80,8 +80,8 @@ void
rtrescan(IndexScanDesc s, bool fromEnd, ScanKey key)
{
RTreeScanOpaque p;
- RegProcedure internal_proc;
- int i;
+ RegProcedure internal_proc;
+ int i;
if (!IndexScanIsValid(s))
{
@@ -177,9 +177,9 @@ void
rtmarkpos(IndexScanDesc s)
{
RTreeScanOpaque p;
- RTSTACK *o,
- *n,
- *tmp;
+ RTSTACK *o,
+ *n,
+ *tmp;
s->currentMarkData = s->currentItemData;
p = (RTreeScanOpaque) s->opaque;
@@ -210,9 +210,9 @@ void
rtrestrpos(IndexScanDesc s)
{
RTreeScanOpaque p;
- RTSTACK *o,
- *n,
- *tmp;
+ RTSTACK *o,
+ *n,
+ *tmp;
s->currentItemData = s->currentMarkData;
p = (RTreeScanOpaque) s->opaque;
@@ -260,7 +260,7 @@ rtendscan(IndexScanDesc s)
static void
rtregscan(IndexScanDesc s)
{
- RTScanList l;
+ RTScanList l;
l = (RTScanList) palloc(sizeof(RTScanListData));
l->rtsl_scan = s;
@@ -271,8 +271,8 @@ rtregscan(IndexScanDesc s)
static void
rtdropscan(IndexScanDesc s)
{
- RTScanList l;
- RTScanList prev;
+ RTScanList l;
+ RTScanList prev;
prev = (RTScanList) NULL;
@@ -297,8 +297,8 @@ rtdropscan(IndexScanDesc s)
void
rtadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum)
{
- RTScanList l;
- Oid relid;
+ RTScanList l;
+ Oid relid;
relid = r->rd_id;
for (l = RTScans; l != (RTScanList) NULL; l = l->rtsl_next)
@@ -352,7 +352,7 @@ adjustiptr(IndexScanDesc s,
BlockNumber blkno,
OffsetNumber offnum)
{
- OffsetNumber curoff;
+ OffsetNumber curoff;
RTreeScanOpaque so;
if (ItemPointerIsValid(iptr))
@@ -364,39 +364,43 @@ adjustiptr(IndexScanDesc s,
switch (op)
{
- case RTOP_DEL:
- /* back up one if we need to */
- if (curoff >= offnum)
- {
-
- if (curoff > FirstOffsetNumber)
- {
- /* just adjust the item pointer */
- ItemPointerSet(iptr, blkno, OffsetNumberPrev(curoff));
- }
- else
+ case RTOP_DEL:
+ /* back up one if we need to */
+ if (curoff >= offnum)
{
- /* remember that we're before the current tuple */
- ItemPointerSet(iptr, blkno, FirstOffsetNumber);
- if (iptr == &(s->currentItemData))
- so->s_flags |= RTS_CURBEFORE;
+
+ if (curoff > FirstOffsetNumber)
+ {
+ /* just adjust the item pointer */
+ ItemPointerSet(iptr, blkno, OffsetNumberPrev(curoff));
+ }
else
- so->s_flags |= RTS_MRKBEFORE;
+ {
+
+ /*
+ * remember that we're before the current
+ * tuple
+ */
+ ItemPointerSet(iptr, blkno, FirstOffsetNumber);
+ if (iptr == &(s->currentItemData))
+ so->s_flags |= RTS_CURBEFORE;
+ else
+ so->s_flags |= RTS_MRKBEFORE;
+ }
}
- }
- break;
-
- case RTOP_SPLIT:
- /* back to start of page on split */
- ItemPointerSet(iptr, blkno, FirstOffsetNumber);
- if (iptr == &(s->currentItemData))
- so->s_flags &= ~RTS_CURBEFORE;
- else
- so->s_flags &= ~RTS_MRKBEFORE;
- break;
-
- default:
- elog(WARN, "Bad operation in rtree scan adjust: %d", op);
+ break;
+
+ case RTOP_SPLIT:
+ /* back to start of page on split */
+ ItemPointerSet(iptr, blkno, FirstOffsetNumber);
+ if (iptr == &(s->currentItemData))
+ so->s_flags &= ~RTS_CURBEFORE;
+ else
+ so->s_flags &= ~RTS_MRKBEFORE;
+ break;
+
+ default:
+ elog(WARN, "Bad operation in rtree scan adjust: %d", op);
}
}
}
diff --git a/src/backend/access/rtree/rtstrat.c b/src/backend/access/rtree/rtstrat.c
index c71059d3f0..028625d48a 100644
--- a/src/backend/access/rtree/rtstrat.c
+++ b/src/backend/access/rtree/rtstrat.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.7 1997/09/07 04:39:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtstrat.c,v 1.8 1997/09/08 02:21:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -118,7 +118,7 @@ static StrategyNumber RTNegateCommute[RTNStrategies] = {
*/
/* if you only have "contained-by", how do you determine equality? */
-static uint16 RTContainedByTermData[] = {
+static uint16 RTContainedByTermData[] = {
2, /* make two comparisons */
RTContainedByStrategyNumber,/* use "a contained-by b" */
0x0, /* without any magic */
@@ -127,7 +127,7 @@ static uint16 RTContainedByTermData[] = {
};
/* if you only have "contains", how do you determine equality? */
-static uint16 RTContainsTermData[] = {
+static uint16 RTContainsTermData[] = {
2, /* make two comparisons */
RTContainsStrategyNumber, /* use "a contains b" */
0x0, /* without any magic */
@@ -204,7 +204,7 @@ static StrategyNumber RTOperMap[RTNStrategies] = {
RTOverlapStrategyNumber
};
-static StrategyNumber
+static StrategyNumber
RelationGetRTStrategy(Relation r,
AttrNumber attnum,
RegProcedure proc)
@@ -231,8 +231,8 @@ RTMapOperator(Relation r,
AttrNumber attnum,
RegProcedure proc)
{
- StrategyNumber procstrat;
- StrategyMap strategyMap;
+ StrategyNumber procstrat;
+ StrategyMap strategyMap;
procstrat = RelationGetRTStrategy(r, attnum, proc);
strategyMap = IndexStrategyGetStrategyMap(RelationGetIndexStrategy(r),
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 6d721fe96a..03b82872fd 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.10 1997/09/07 04:39:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.11 1997/09/08 02:21:14 momjian Exp $
*
* NOTES
* This file contains the high level access-method interface to the
@@ -26,9 +26,9 @@
#include <storage/spin.h>
#include <commands/vacuum.h>
-static int RecoveryCheckingEnabled(void);
-static void TransRecover(Relation logRelation);
-static bool TransactionLogTest(TransactionId transactionId, XidStatus status);
+static int RecoveryCheckingEnabled(void);
+static void TransRecover(Relation logRelation);
+static bool TransactionLogTest(TransactionId transactionId, XidStatus status);
static void
TransactionLogUpdate(TransactionId transactionId,
XidStatus status);
@@ -40,18 +40,18 @@ TransactionLogUpdate(TransactionId transactionId,
* ----------------
*/
-Relation LogRelation = (Relation) NULL;
-Relation TimeRelation = (Relation) NULL;
-Relation VariableRelation = (Relation) NULL;
+Relation LogRelation = (Relation) NULL;
+Relation TimeRelation = (Relation) NULL;
+Relation VariableRelation = (Relation) NULL;
/* ----------------
* global variables holding cached transaction id's and statuses.
* ----------------
*/
-TransactionId cachedGetCommitTimeXid;
-AbsoluteTime cachedGetCommitTime;
-TransactionId cachedTestXid;
-XidStatus cachedTestXidStatus;
+TransactionId cachedGetCommitTimeXid;
+AbsoluteTime cachedGetCommitTime;
+TransactionId cachedTestXid;
+XidStatus cachedTestXidStatus;
/* ----------------
* transaction system constants
@@ -65,11 +65,11 @@ XidStatus cachedTestXidStatus;
* FirstTransactionId. -cim 3/23/90
* ----------------------------------------------------------------
*/
-TransactionId NullTransactionId = (TransactionId) 0;
+TransactionId NullTransactionId = (TransactionId) 0;
-TransactionId AmiTransactionId = (TransactionId) 512;
+TransactionId AmiTransactionId = (TransactionId) 512;
-TransactionId FirstTransactionId = (TransactionId) 514;
+TransactionId FirstTransactionId = (TransactionId) 514;
/* ----------------
* transaction recovery state variables
@@ -83,19 +83,19 @@ TransactionId FirstTransactionId = (TransactionId) 514;
* goes from zero to one. -cim 3/21/90
* ----------------
*/
-int RecoveryCheckingEnableState = 0;
+int RecoveryCheckingEnableState = 0;
/* ------------------
* spinlock for oid generation
* -----------------
*/
-extern int OidGenLockId;
+extern int OidGenLockId;
/* ----------------
* globals that must be reset at abort
* ----------------
*/
-extern bool BuildingBtree;
+extern bool BuildingBtree;
/* ----------------
@@ -134,14 +134,14 @@ SetRecoveryCheckingEnabled(bool state)
* --------------------------------
*/
-static bool /* true/false: does transaction id have
+static bool /* true/false: does transaction id have
* specified status? */
TransactionLogTest(TransactionId transactionId, /* transaction id to test */
XidStatus status) /* transaction status */
{
- BlockNumber blockNumber;
- XidStatus xidstatus; /* recorded status of xid */
- bool fail = false; /* success/failure */
+ BlockNumber blockNumber;
+ XidStatus xidstatus; /* recorded status of xid */
+ bool fail = false; /* success/failure */
/* ----------------
* during initialization consider all transactions
@@ -202,9 +202,9 @@ static void
TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
XidStatus status) /* new trans status */
{
- BlockNumber blockNumber;
- bool fail = false; /* success/failure */
- AbsoluteTime currentTime;/* time of this transaction */
+ BlockNumber blockNumber;
+ bool fail = false; /* success/failure */
+ AbsoluteTime currentTime; /* time of this transaction */
/* ----------------
* during initialization we don't record any updates.
@@ -276,9 +276,9 @@ AbsoluteTime /* commit time of transaction id */
TransactionIdGetCommitTime(TransactionId transactionId) /* transaction id to
* test */
{
- BlockNumber blockNumber;
- AbsoluteTime commitTime; /* commit time */
- bool fail = false; /* success/failure */
+ BlockNumber blockNumber;
+ AbsoluteTime commitTime; /* commit time */
+ bool fail = false; /* success/failure */
/* ----------------
* return invalid if we aren't running yet...
@@ -471,9 +471,9 @@ TransRecover(Relation logRelation)
void
InitializeTransactionLog(void)
{
- Relation logRelation;
- Relation timeRelation;
- MemoryContext oldContext;
+ Relation logRelation;
+ Relation timeRelation;
+ MemoryContext oldContext;
/* ----------------
* don't do anything during bootstrapping
diff --git a/src/backend/access/transam/transsup.c b/src/backend/access/transam/transsup.c
index 9809190c94..acdfe93ea9 100644
--- a/src/backend/access/transam/transsup.c
+++ b/src/backend/access/transam/transsup.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.10 1997/09/07 04:39:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.11 1997/09/08 02:21:18 momjian Exp $
*
* NOTES
* This file contains support functions for the high
@@ -63,7 +63,7 @@ TransComputeBlockNumber(Relation relation, /* relation to test */
* test */
BlockNumber * blockNumberOutP)
{
- long itemsPerBlock = 0;
+ long itemsPerBlock = 0;
/* ----------------
* we calculate the block number of our transaction
@@ -108,17 +108,17 @@ TransComputeBlockNumber(Relation relation, /* relation to test */
*/
#ifdef NOT_USED
-static XidStatus
+static XidStatus
TransBlockGetLastTransactionIdStatus(Block tblock,
TransactionId baseXid,
TransactionId * returnXidP)
{
- Index index;
- Index maxIndex;
- bits8 bit1;
- bits8 bit2;
- BitIndex offset;
- XidStatus xstatus;
+ Index index;
+ Index maxIndex;
+ bits8 bit1;
+ bits8 bit2;
+ BitIndex offset;
+ XidStatus xstatus;
/* ----------------
* sanity check
@@ -188,14 +188,14 @@ TransBlockGetLastTransactionIdStatus(Block tblock,
* --------------------------------
*/
-static XidStatus
+static XidStatus
TransBlockGetXidStatus(Block tblock,
TransactionId transactionId)
{
- Index index;
- bits8 bit1;
- bits8 bit2;
- BitIndex offset;
+ Index index;
+ bits8 bit1;
+ bits8 bit2;
+ BitIndex offset;
/* ----------------
* sanity check
@@ -245,8 +245,8 @@ TransBlockSetXidStatus(Block tblock,
TransactionId transactionId,
XidStatus xstatus)
{
- Index index;
- BitIndex offset;
+ Index index;
+ BitIndex offset;
/* ----------------
* sanity check
@@ -275,23 +275,23 @@ TransBlockSetXidStatus(Block tblock,
*/
switch (xstatus)
{
- case XID_COMMIT: /* set 10 */
- BitArraySetBit((BitArray) tblock, offset);
- BitArrayClearBit((BitArray) tblock, offset + 1);
- break;
- case XID_ABORT: /* set 01 */
- BitArrayClearBit((BitArray) tblock, offset);
- BitArraySetBit((BitArray) tblock, offset + 1);
- break;
- case XID_INPROGRESS: /* set 00 */
- BitArrayClearBit((BitArray) tblock, offset);
- BitArrayClearBit((BitArray) tblock, offset + 1);
- break;
- default:
- elog(NOTICE,
- "TransBlockSetXidStatus: invalid status: %d (ignored)",
- xstatus);
- break;
+ case XID_COMMIT: /* set 10 */
+ BitArraySetBit((BitArray) tblock, offset);
+ BitArrayClearBit((BitArray) tblock, offset + 1);
+ break;
+ case XID_ABORT: /* set 01 */
+ BitArrayClearBit((BitArray) tblock, offset);
+ BitArraySetBit((BitArray) tblock, offset + 1);
+ break;
+ case XID_INPROGRESS: /* set 00 */
+ BitArrayClearBit((BitArray) tblock, offset);
+ BitArrayClearBit((BitArray) tblock, offset + 1);
+ break;
+ default:
+ elog(NOTICE,
+ "TransBlockSetXidStatus: invalid status: %d (ignored)",
+ xstatus);
+ break;
}
}
@@ -302,12 +302,12 @@ TransBlockSetXidStatus(Block tblock,
* specified transaction id in the trans block.
* --------------------------------
*/
-static AbsoluteTime
+static AbsoluteTime
TransBlockGetCommitTime(Block tblock,
TransactionId transactionId)
{
- Index index;
- AbsoluteTime *timeArray;
+ Index index;
+ AbsoluteTime *timeArray;
/* ----------------
* sanity check
@@ -348,8 +348,8 @@ TransBlockSetCommitTime(Block tblock,
TransactionId transactionId,
AbsoluteTime commitTime)
{
- Index index;
- AbsoluteTime *timeArray;
+ Index index;
+ AbsoluteTime *timeArray;
/* ----------------
* sanity check
@@ -394,10 +394,10 @@ TransBlockNumberGetXidStatus(Relation relation,
TransactionId xid,
bool * failP)
{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing xstatus */
- XidStatus xstatus; /* recorded status of xid */
- bool localfail; /* bool used if failP = NULL */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing xstatus */
+ XidStatus xstatus; /* recorded status of xid */
+ bool localfail; /* bool used if failP = NULL */
/* ----------------
* SOMEDAY place a read lock on the log relation
@@ -451,9 +451,9 @@ TransBlockNumberSetXidStatus(Relation relation,
XidStatus xstatus,
bool * failP)
{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing xstatus */
- bool localfail; /* bool used if failP = NULL */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing xstatus */
+ bool localfail; /* bool used if failP = NULL */
/* ----------------
* SOMEDAY gain exclusive access to the log relation
@@ -504,10 +504,10 @@ TransBlockNumberGetCommitTime(Relation relation,
TransactionId xid,
bool * failP)
{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing commit time */
- bool localfail; /* bool used if failP = NULL */
- AbsoluteTime xtime; /* commit time */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing commit time */
+ bool localfail; /* bool used if failP = NULL */
+ AbsoluteTime xtime; /* commit time */
/* ----------------
* SOMEDAY place a read lock on the time relation
@@ -565,9 +565,9 @@ TransBlockNumberSetCommitTime(Relation relation,
AbsoluteTime xtime,
bool * failP)
{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing commit time */
- bool localfail; /* bool used if failP = NULL */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing commit time */
+ bool localfail; /* bool used if failP = NULL */
/* ----------------
* SOMEDAY gain exclusive access to the time relation
@@ -620,11 +620,11 @@ TransGetLastRecordedTransaction(Relation relation,
* id */
bool * failP)
{
- BlockNumber blockNumber;/* block number */
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing xid status */
- BlockNumber n; /* number of blocks in the relation */
- TransactionId baseXid;
+ BlockNumber blockNumber; /* block number */
+ Buffer buffer; /* buffer associated with block */
+ Block block; /* block containing xid status */
+ BlockNumber n; /* number of blocks in the relation */
+ TransactionId baseXid;
(*failP) = false;
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 8b4b8557eb..fb44b210be 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.10 1997/09/07 04:39:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.11 1997/09/08 02:21:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,18 +20,18 @@
#include <access/heapam.h>
#include <catalog/catname.h>
-static void GetNewObjectIdBlock(Oid * oid_return, int oid_block_size);
-static void VariableRelationGetNextOid(Oid * oid_return);
-static void VariableRelationGetNextXid(TransactionId * xidP);
-static void VariableRelationPutLastXid(TransactionId xid);
-static void VariableRelationPutNextOid(Oid * oidP);
-static void VariableRelationGetLastXid(TransactionId * xidP);
+static void GetNewObjectIdBlock(Oid * oid_return, int oid_block_size);
+static void VariableRelationGetNextOid(Oid * oid_return);
+static void VariableRelationGetNextXid(TransactionId * xidP);
+static void VariableRelationPutLastXid(TransactionId xid);
+static void VariableRelationPutNextOid(Oid * oidP);
+static void VariableRelationGetLastXid(TransactionId * xidP);
/* ---------------------
* spin lock for oid generation
* ---------------------
*/
-int OidGenLockId;
+int OidGenLockId;
/* ----------------------------------------------------------------
* variable relation query/update routines
@@ -45,7 +45,7 @@ int OidGenLockId;
static void
VariableRelationGetNextXid(TransactionId * xidP)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -87,7 +87,7 @@ VariableRelationGetNextXid(TransactionId * xidP)
static void
VariableRelationGetLastXid(TransactionId * xidP)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -130,9 +130,9 @@ VariableRelationGetLastXid(TransactionId * xidP)
void
VariableRelationPutNextXid(TransactionId xid)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
- int flushmode;
+ int flushmode;
/* ----------------
* We assume that a spinlock has been acquire to guarantee
@@ -176,7 +176,7 @@ VariableRelationPutNextXid(TransactionId xid)
static void
VariableRelationPutLastXid(TransactionId xid)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -219,7 +219,7 @@ VariableRelationPutLastXid(TransactionId xid)
static void
VariableRelationGetNextOid(Oid * oid_return)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -289,7 +289,7 @@ VariableRelationGetNextOid(Oid * oid_return)
static void
VariableRelationPutNextOid(Oid * oidP)
{
- Buffer buf;
+ Buffer buf;
VariableRelationContents var;
/* ----------------
@@ -383,13 +383,13 @@ VariableRelationPutNextOid(Oid * oidP)
#define VAR_XID_PREFETCH 32
-static int prefetched_xid_count = 0;
+static int prefetched_xid_count = 0;
static TransactionId next_prefetched_xid;
void
GetNewTransactionId(TransactionId * xid)
{
- TransactionId nextid;
+ TransactionId nextid;
/* ----------------
* during bootstrap initialization, we return the special
@@ -457,7 +457,7 @@ GetNewTransactionId(TransactionId * xid)
void
UpdateLastCommittedXid(TransactionId xid)
{
- TransactionId lastid;
+ TransactionId lastid;
/*
@@ -501,7 +501,7 @@ GetNewObjectIdBlock(Oid * oid_return, /* place to return the new object
* id */
int oid_block_size) /* number of oids desired */
{
- Oid nextoid;
+ Oid nextoid;
/* ----------------
* SOMEDAY obtain exclusive access to the variable relation page
@@ -554,8 +554,8 @@ GetNewObjectIdBlock(Oid * oid_return, /* place to return the new object
#define VAR_OID_PREFETCH 32
-static int prefetched_oid_count = 0;
-static Oid next_prefetched_oid;
+static int prefetched_oid_count = 0;
+static Oid next_prefetched_oid;
void
GetNewObjectId(Oid * oid_return)/* place to return the new object id */
@@ -568,7 +568,7 @@ GetNewObjectId(Oid * oid_return)/* place to return the new object id */
if (prefetched_oid_count == 0)
{
- int oid_block_size = VAR_OID_PREFETCH;
+ int oid_block_size = VAR_OID_PREFETCH;
/* ----------------
* during bootstrap time, we want to allocate oids
@@ -609,7 +609,7 @@ GetNewObjectId(Oid * oid_return)/* place to return the new object id */
void
CheckMaxObjectId(Oid assigned_oid)
{
- Oid pass_oid;
+ Oid pass_oid;
if (prefetched_oid_count == 0) /* make sure next/max is set, or
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index da32570d87..b6ff2dd296 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.14 1997/09/07 04:39:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.15 1997/09/08 02:21:22 momjian Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -151,20 +151,20 @@
#include <commands/async.h>
#include <commands/sequence.h>
-static void AbortTransaction(void);
-static void AtAbort_Cache(void);
-static void AtAbort_Locks(void);
-static void AtAbort_Memory(void);
-static void AtCommit_Cache(void);
-static void AtCommit_Locks(void);
-static void AtCommit_Memory(void);
-static void AtStart_Cache(void);
-static void AtStart_Locks(void);
-static void AtStart_Memory(void);
-static void CommitTransaction(void);
-static void RecordTransactionAbort(void);
-static void RecordTransactionCommit(void);
-static void StartTransaction(void);
+static void AbortTransaction(void);
+static void AtAbort_Cache(void);
+static void AtAbort_Locks(void);
+static void AtAbort_Memory(void);
+static void AtCommit_Cache(void);
+static void AtCommit_Locks(void);
+static void AtCommit_Memory(void);
+static void AtStart_Cache(void);
+static void AtStart_Locks(void);
+static void AtStart_Memory(void);
+static void CommitTransaction(void);
+static void RecordTransactionAbort(void);
+static void RecordTransactionCommit(void);
+static void StartTransaction(void);
/* ----------------
* global variables holding the current transaction state.
@@ -202,17 +202,17 @@ TransactionState CurrentTransactionState =
* V1 transaction system. -cim 3/18/90
* ----------------
*/
-TransactionId DisabledTransactionId = (TransactionId) - 1;
+TransactionId DisabledTransactionId = (TransactionId) - 1;
-CommandId DisabledCommandId = (CommandId) - 1;
+CommandId DisabledCommandId = (CommandId) - 1;
-AbsoluteTime DisabledStartTime = (AbsoluteTime) BIG_ABSTIME; /* 1073741823; */
+AbsoluteTime DisabledStartTime = (AbsoluteTime) BIG_ABSTIME; /* 1073741823; */
/* ----------------
* overflow flag
* ----------------
*/
-bool CommandIdCounterOverflowFlag;
+bool CommandIdCounterOverflowFlag;
/* ----------------
* catalog creation transaction bootstrapping flag.
@@ -220,7 +220,7 @@ bool CommandIdCounterOverflowFlag;
* state stuff. -cim 3/19/90
* ----------------
*/
-bool AMI_OVERRIDE = false;
+bool AMI_OVERRIDE = false;
/* ----------------------------------------------------------------
* transaction state accessors
@@ -239,7 +239,7 @@ bool AMI_OVERRIDE = false;
* only do writes as necessary.
* --------------------------------
*/
-static int TransactionFlushState = 1;
+static int TransactionFlushState = 1;
int
TransactionFlushEnabled(void)
@@ -270,18 +270,18 @@ IsTransactionState(void)
switch (s->state)
{
- case TRANS_DEFAULT:
- return false;
- case TRANS_START:
- return true;
- case TRANS_INPROGRESS:
- return true;
- case TRANS_COMMIT:
- return true;
- case TRANS_ABORT:
- return true;
- case TRANS_DISABLED:
- return false;
+ case TRANS_DEFAULT:
+ return false;
+ case TRANS_START:
+ return true;
+ case TRANS_INPROGRESS:
+ return true;
+ case TRANS_COMMIT:
+ return true;
+ case TRANS_ABORT:
+ return true;
+ case TRANS_DISABLED:
+ return false;
}
/*
@@ -317,7 +317,7 @@ IsAbortedTransactionBlockState()
* themselves.
* --------------------------------
*/
-int SavedTransactionState;
+int SavedTransactionState;
void
OverrideTransactionSystem(bool flag)
@@ -564,8 +564,8 @@ AtStart_Locks()
static void
AtStart_Memory()
{
- Portal portal;
- MemoryContext portalContext;
+ Portal portal;
+ MemoryContext portalContext;
/* ----------------
* get the blank portal and its memory context
@@ -601,8 +601,8 @@ AtStart_Memory()
static void
RecordTransactionCommit()
{
- TransactionId xid;
- int leak;
+ TransactionId xid;
+ int leak;
/* ----------------
* get the current transaction id
@@ -701,7 +701,7 @@ AtCommit_Memory()
static void
RecordTransactionAbort()
{
- TransactionId xid;
+ TransactionId xid;
/* ----------------
* get the current transaction id
@@ -994,73 +994,73 @@ StartTransactionCommand()
switch (s->blockState)
{
- /* ----------------
- * if we aren't in a transaction block, we
- * just do our usual start transaction.
- * ----------------
- */
- case TBLOCK_DEFAULT:
- StartTransaction();
- break;
-
- /* ----------------
- * We should never experience this -- if we do it
- * means the BEGIN state was not changed in the previous
- * CommitTransactionCommand(). If we get it, we print
- * a warning and change to the in-progress state.
- * ----------------
- */
- case TBLOCK_BEGIN:
- elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_BEGIN");
- s->blockState = TBLOCK_INPROGRESS;
- break;
-
- /* ----------------
- * This is the case when are somewhere in a transaction
- * block and about to start a new command. For now we
- * do nothing but someday we may do command-local resource
- * initialization.
- * ----------------
- */
- case TBLOCK_INPROGRESS:
- break;
-
- /* ----------------
- * As with BEGIN, we should never experience this --
- * if we do it means the END state was not changed in the
- * previous CommitTransactionCommand(). If we get it, we
- * print a warning, commit the transaction, start a new
- * transaction and change to the default state.
- * ----------------
- */
- case TBLOCK_END:
- elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_END");
- s->blockState = TBLOCK_DEFAULT;
- CommitTransaction();
- StartTransaction();
- break;
-
- /* ----------------
- * Here we are in the middle of a transaction block but
- * one of the commands caused an abort so we do nothing
- * but remain in the abort state. Eventually we will get
- * to the "END TRANSACTION" which will set things straight.
- * ----------------
- */
- case TBLOCK_ABORT:
- break;
-
- /* ----------------
- * This means we somehow aborted and the last call to
- * CommitTransactionCommand() didn't clear the state so
- * we remain in the ENDABORT state and mabey next time
- * we get to CommitTransactionCommand() the state will
- * get reset to default.
- * ----------------
- */
- case TBLOCK_ENDABORT:
- elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_ENDABORT");
- break;
+ /* ----------------
+ * if we aren't in a transaction block, we
+ * just do our usual start transaction.
+ * ----------------
+ */
+ case TBLOCK_DEFAULT:
+ StartTransaction();
+ break;
+
+ /* ----------------
+ * We should never experience this -- if we do it
+ * means the BEGIN state was not changed in the previous
+ * CommitTransactionCommand(). If we get it, we print
+ * a warning and change to the in-progress state.
+ * ----------------
+ */
+ case TBLOCK_BEGIN:
+ elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_BEGIN");
+ s->blockState = TBLOCK_INPROGRESS;
+ break;
+
+ /* ----------------
+ * This is the case when are somewhere in a transaction
+ * block and about to start a new command. For now we
+ * do nothing but someday we may do command-local resource
+ * initialization.
+ * ----------------
+ */
+ case TBLOCK_INPROGRESS:
+ break;
+
+ /* ----------------
+ * As with BEGIN, we should never experience this --
+ * if we do it means the END state was not changed in the
+ * previous CommitTransactionCommand(). If we get it, we
+ * print a warning, commit the transaction, start a new
+ * transaction and change to the default state.
+ * ----------------
+ */
+ case TBLOCK_END:
+ elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_END");
+ s->blockState = TBLOCK_DEFAULT;
+ CommitTransaction();
+ StartTransaction();
+ break;
+
+ /* ----------------
+ * Here we are in the middle of a transaction block but
+ * one of the commands caused an abort so we do nothing
+ * but remain in the abort state. Eventually we will get
+ * to the "END TRANSACTION" which will set things straight.
+ * ----------------
+ */
+ case TBLOCK_ABORT:
+ break;
+
+ /* ----------------
+ * This means we somehow aborted and the last call to
+ * CommitTransactionCommand() didn't clear the state so
+ * we remain in the ENDABORT state and mabey next time
+ * we get to CommitTransactionCommand() the state will
+ * get reset to default.
+ * ----------------
+ */
+ case TBLOCK_ENDABORT:
+ elog(NOTICE, "StartTransactionCommand: unexpected TBLOCK_ENDABORT");
+ break;
}
}
@@ -1075,75 +1075,75 @@ CommitTransactionCommand()
switch (s->blockState)
{
- /* ----------------
- * if we aren't in a transaction block, we
- * just do our usual transaction commit
- * ----------------
- */
- case TBLOCK_DEFAULT:
- CommitTransaction();
- break;
-
- /* ----------------
- * This is the case right after we get a "BEGIN TRANSACTION"
- * command, but the user hasn't done anything else yet, so
- * we change to the "transaction block in progress" state
- * and return.
- * ----------------
- */
- case TBLOCK_BEGIN:
- s->blockState = TBLOCK_INPROGRESS;
- break;
-
- /* ----------------
- * This is the case when we have finished executing a command
- * someplace within a transaction block. We increment the
- * command counter and return. Someday we may free resources
- * local to the command.
- *
- * That someday is today, at least for memory allocated by
- * command in the BlankPortal' HeapMemory context.
- * - vadim 03/25/97
- * ----------------
- */
- case TBLOCK_INPROGRESS:
- CommandCounterIncrement();
+ /* ----------------
+ * if we aren't in a transaction block, we
+ * just do our usual transaction commit
+ * ----------------
+ */
+ case TBLOCK_DEFAULT:
+ CommitTransaction();
+ break;
+
+ /* ----------------
+ * This is the case right after we get a "BEGIN TRANSACTION"
+ * command, but the user hasn't done anything else yet, so
+ * we change to the "transaction block in progress" state
+ * and return.
+ * ----------------
+ */
+ case TBLOCK_BEGIN:
+ s->blockState = TBLOCK_INPROGRESS;
+ break;
+
+ /* ----------------
+ * This is the case when we have finished executing a command
+ * someplace within a transaction block. We increment the
+ * command counter and return. Someday we may free resources
+ * local to the command.
+ *
+ * That someday is today, at least for memory allocated by
+ * command in the BlankPortal' HeapMemory context.
+ * - vadim 03/25/97
+ * ----------------
+ */
+ case TBLOCK_INPROGRESS:
+ CommandCounterIncrement();
#ifdef TBL_FREE_CMD_MEMORY
- EndPortalAllocMode();
- StartPortalAllocMode(DefaultAllocMode, 0);
+ EndPortalAllocMode();
+ StartPortalAllocMode(DefaultAllocMode, 0);
#endif
- break;
-
- /* ----------------
- * This is the case when we just got the "END TRANSACTION"
- * statement, so we go back to the default state and
- * commit the transaction.
- * ----------------
- */
- case TBLOCK_END:
- s->blockState = TBLOCK_DEFAULT;
- CommitTransaction();
- break;
-
- /* ----------------
- * Here we are in the middle of a transaction block but
- * one of the commands caused an abort so we do nothing
- * but remain in the abort state. Eventually we will get
- * to the "END TRANSACTION" which will set things straight.
- * ----------------
- */
- case TBLOCK_ABORT:
- break;
-
- /* ----------------
- * Here we were in an aborted transaction block which
- * just processed the "END TRANSACTION" command from the
- * user, so now we return the to default state.
- * ----------------
- */
- case TBLOCK_ENDABORT:
- s->blockState = TBLOCK_DEFAULT;
- break;
+ break;
+
+ /* ----------------
+ * This is the case when we just got the "END TRANSACTION"
+ * statement, so we go back to the default state and
+ * commit the transaction.
+ * ----------------
+ */
+ case TBLOCK_END:
+ s->blockState = TBLOCK_DEFAULT;
+ CommitTransaction();
+ break;
+
+ /* ----------------
+ * Here we are in the middle of a transaction block but
+ * one of the commands caused an abort so we do nothing
+ * but remain in the abort state. Eventually we will get
+ * to the "END TRANSACTION" which will set things straight.
+ * ----------------
+ */
+ case TBLOCK_ABORT:
+ break;
+
+ /* ----------------
+ * Here we were in an aborted transaction block which
+ * just processed the "END TRANSACTION" command from the
+ * user, so now we return the to default state.
+ * ----------------
+ */
+ case TBLOCK_ENDABORT:
+ s->blockState = TBLOCK_DEFAULT;
+ break;
}
}
@@ -1158,71 +1158,71 @@ AbortCurrentTransaction()
switch (s->blockState)
{
- /* ----------------
- * if we aren't in a transaction block, we
- * just do our usual abort transaction.
- * ----------------
- */
- case TBLOCK_DEFAULT:
- AbortTransaction();
- break;
-
- /* ----------------
- * If we are in the TBLOCK_BEGIN it means something
- * screwed up right after reading "BEGIN TRANSACTION"
- * so we enter the abort state. Eventually an "END
- * TRANSACTION" will fix things.
- * ----------------
- */
- case TBLOCK_BEGIN:
- s->blockState = TBLOCK_ABORT;
- AbortTransaction();
- break;
-
- /* ----------------
- * This is the case when are somewhere in a transaction
- * block which aborted so we abort the transaction and
- * set the ABORT state. Eventually an "END TRANSACTION"
- * will fix things and restore us to a normal state.
- * ----------------
- */
- case TBLOCK_INPROGRESS:
- s->blockState = TBLOCK_ABORT;
- AbortTransaction();
- break;
-
- /* ----------------
- * Here, the system was fouled up just after the
- * user wanted to end the transaction block so we
- * abort the transaction and put us back into the
- * default state.
- * ----------------
- */
- case TBLOCK_END:
- s->blockState = TBLOCK_DEFAULT;
- AbortTransaction();
- break;
-
- /* ----------------
- * Here, we are already in an aborted transaction
- * state and are waiting for an "END TRANSACTION" to
- * come along and lo and behold, we abort again!
- * So we just remain in the abort state.
- * ----------------
- */
- case TBLOCK_ABORT:
- break;
-
- /* ----------------
- * Here we were in an aborted transaction block which
- * just processed the "END TRANSACTION" command but somehow
- * aborted again.. since we must have done the abort
- * processing, we return to the default state.
- * ----------------
- */
- case TBLOCK_ENDABORT:
- s->blockState = TBLOCK_DEFAULT;
- break;
+ /* ----------------
+ * if we aren't in a transaction block, we
+ * just do our usual abort transaction.
+ * ----------------
+ */
+ case TBLOCK_DEFAULT:
+ AbortTransaction();
+ break;
+
+ /* ----------------
+ * If we are in the TBLOCK_BEGIN it means something
+ * screwed up right after reading "BEGIN TRANSACTION"
+ * so we enter the abort state. Eventually an "END
+ * TRANSACTION" will fix things.
+ * ----------------
+ */
+ case TBLOCK_BEGIN:
+ s->blockState = TBLOCK_ABORT;
+ AbortTransaction();
+ break;
+
+ /* ----------------
+ * This is the case when are somewhere in a transaction
+ * block which aborted so we abort the transaction and
+ * set the ABORT state. Eventually an "END TRANSACTION"
+ * will fix things and restore us to a normal state.
+ * ----------------
+ */
+ case TBLOCK_INPROGRESS:
+ s->blockState = TBLOCK_ABORT;
+ AbortTransaction();
+ break;
+
+ /* ----------------
+ * Here, the system was fouled up just after the
+ * user wanted to end the transaction block so we
+ * abort the transaction and put us back into the
+ * default state.
+ * ----------------
+ */
+ case TBLOCK_END:
+ s->blockState = TBLOCK_DEFAULT;
+ AbortTransaction();
+ break;
+
+ /* ----------------
+ * Here, we are already in an aborted transaction
+ * state and are waiting for an "END TRANSACTION" to
+ * come along and lo and behold, we abort again!
+ * So we just remain in the abort state.
+ * ----------------
+ */
+ case TBLOCK_ABORT:
+ break;
+
+ /* ----------------
+ * Here we were in an aborted transaction block which
+ * just processed the "END TRANSACTION" command but somehow
+ * aborted again.. since we must have done the abort
+ * processing, we return to the default state.
+ * ----------------
+ */
+ case TBLOCK_ENDABORT:
+ s->blockState = TBLOCK_DEFAULT;
+ break;
}
}
diff --git a/src/backend/access/transam/xid.c b/src/backend/access/transam/xid.c
index 910d6ac732..9cfc8235d4 100644
--- a/src/backend/access/transam/xid.c
+++ b/src/backend/access/transam/xid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.8 1997/09/07 04:39:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.9 1997/09/08 02:21:24 momjian Exp $
*
* OLD COMMENTS
* XXX WARNING
@@ -50,11 +50,11 @@ xidin(char *representation)
}
/* XXX char16 name for catalogs */
-char *
+char *
xidout(TransactionId transactionId)
{
/* return(TransactionIdFormString(transactionId)); */
- char *representation;
+ char *representation;
/* maximum 32 bit unsigned integer representation takes 10 chars */
representation = palloc(11);
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 9fd4bf719b..f96abbd4cb 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -7,7 +7,7 @@
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.22 1997/09/07 04:39:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.23 1997/09/08 02:21:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -103,14 +103,14 @@
#define ALLOC(t, c) (t *)calloc((unsigned)(c), sizeof(t))
#define FIRST_TYPE_OID 16 /* OID of the first type */
-extern int Int_yyparse(void);
+extern int Int_yyparse(void);
static hashnode *AddStr(char *str, int strlength, int mderef);
static AttributeTupleForm AllocateAttribute(void);
-static bool BootstrapAlreadySeen(Oid id);
-static int CompHash(char *str, int len);
+static bool BootstrapAlreadySeen(Oid id);
+static int CompHash(char *str, int len);
static hashnode *FindStr(char *str, int length, hashnode * mderef);
-static int gettype(char *type);
-static void cleanup(void);
+static int gettype(char *type);
+static void cleanup(void);
/* ----------------
* global variables
@@ -134,11 +134,10 @@ static void cleanup(void);
#define NUMSQR 529
#define NUMCUBE 12167
-char *strtable[STRTABLESIZE];
-hashnode *hashtable[HASHTABLESIZE];
+char *strtable[STRTABLESIZE];
+hashnode *hashtable[HASHTABLESIZE];
-static int strtable_end = -1; /* Tells us last occupied string
- * space */
+static int strtable_end = -1; /* Tells us last occupied string space */
/*-
* Basic information associated with each type. This is used before
@@ -150,12 +149,12 @@ static int strtable_end = -1; /* Tells us last occupied string
*/
struct typinfo
{
- char name[NAMEDATALEN];
- Oid oid;
- Oid elem;
- int16 len;
- Oid inproc;
- Oid outproc;
+ char name[NAMEDATALEN];
+ Oid oid;
+ Oid elem;
+ int16 len;
+ Oid inproc;
+ Oid outproc;
};
static struct typinfo Procid[] = {
@@ -180,29 +179,29 @@ static struct typinfo Procid[] = {
{"_aclitem", 1034, 1033, -1, F_ARRAY_IN, F_ARRAY_OUT}
};
-static int n_types = sizeof(Procid) / sizeof(struct typinfo);
+static int n_types = sizeof(Procid) / sizeof(struct typinfo);
struct typmap
{ /* a hack */
- Oid am_oid;
+ Oid am_oid;
TypeTupleFormData am_typ;
};
static struct typmap **Typ = (struct typmap **) NULL;
static struct typmap *Ap = (struct typmap *) NULL;
-static int Warnings = 0;
-static char Blanks[MAXATTR];
+static int Warnings = 0;
+static char Blanks[MAXATTR];
-static char *relname; /* current relation name */
+static char *relname; /* current relation name */
AttributeTupleForm attrtypes[MAXATTR]; /* points to attribute info */
-static char *values[MAXATTR];/* cooresponding attribute values */
-int numattr; /* number of attributes for cur. rel */
-extern int fsyncOff; /* do not fsync the database */
+static char *values[MAXATTR]; /* cooresponding attribute values */
+int numattr; /* number of attributes for cur. rel */
+extern int fsyncOff; /* do not fsync the database */
#ifndef HAVE_SIGSETJMP
-static jmp_buf Warn_restart;
+static jmp_buf Warn_restart;
#define sigsetjmp(x,y) setjmp(x)
#define siglongjmp longjmp
@@ -211,12 +210,12 @@ static sigjmp_buf Warn_restart;
#endif
-int DebugMode;
+int DebugMode;
static GlobalMemory nogc = (GlobalMemory) NULL; /* special no-gc mem
* context */
-extern int optind;
-extern char *optarg;
+extern int optind;
+extern char *optarg;
/*
* At bootstrap time, we first declare all the indices to be built, and
@@ -226,20 +225,20 @@ extern char *optarg;
typedef struct _IndexList
{
- char *il_heap;
- char *il_ind;
- int il_natts;
- AttrNumber *il_attnos;
- uint16 il_nparams;
- Datum *il_params;
- FuncIndexInfo *il_finfo;
- PredInfo *il_predInfo;
+ char *il_heap;
+ char *il_ind;
+ int il_natts;
+ AttrNumber *il_attnos;
+ uint16 il_nparams;
+ Datum *il_params;
+ FuncIndexInfo *il_finfo;
+ PredInfo *il_predInfo;
struct _IndexList *il_next;
-} IndexList;
+} IndexList;
static IndexList *ILHead = (IndexList *) NULL;
-typedef void (*sig_func) ();
+typedef void (*sig_func) ();
@@ -293,15 +292,15 @@ BootstrapMain(int argc, char *argv[])
* ----------------------------------------------------------------
*/
{
- int i;
- int portFd = -1;
- char *dbName;
- int flag;
- int override = 1; /* use BootstrapProcessing or
- * InitProcessing mode */
+ int i;
+ int portFd = -1;
+ char *dbName;
+ int flag;
+ int override = 1; /* use BootstrapProcessing or
+ * InitProcessing mode */
- extern int optind;
- extern char *optarg;
+ extern int optind;
+ extern char *optarg;
/* ----------------
* initialize signal handlers
@@ -335,30 +334,30 @@ BootstrapMain(int argc, char *argv[])
{
switch (flag)
{
- case 'D':
- DataDir = optarg;
- break;
- case 'd':
- DebugMode = 1; /* print out debugging info while parsing */
- break;
- case 'C':
- Noversion = 1;
- break;
- case 'F':
- fsyncOff = 1;
- break;
- case 'O':
- override = true;
- break;
- case 'Q':
- Quiet = 1;
- break;
- case 'P': /* specify port */
- portFd = atoi(optarg);
- break;
- default:
- usage();
- break;
+ case 'D':
+ DataDir = optarg;
+ break;
+ case 'd':
+ DebugMode = 1; /* print out debugging info while parsing */
+ break;
+ case 'C':
+ Noversion = 1;
+ break;
+ case 'F':
+ fsyncOff = 1;
+ break;
+ case 'O':
+ override = true;
+ break;
+ case 'Q':
+ Quiet = 1;
+ break;
+ case 'P': /* specify port */
+ portFd = atoi(optarg);
+ break;
+ default:
+ usage();
+ break;
}
} /* while */
@@ -475,11 +474,11 @@ BootstrapMain(int argc, char *argv[])
void
boot_openrel(char *relname)
{
- int i;
+ int i;
struct typmap **app;
- Relation rdesc;
- HeapScanDesc sdesc;
- HeapTuple tup;
+ Relation rdesc;
+ HeapScanDesc sdesc;
+ HeapTuple tup;
if (strlen(relname) > 15)
relname[15] = '\000';
@@ -603,8 +602,8 @@ closerel(char *name)
void
DefineAttr(char *name, char *type, int attnum)
{
- int attlen;
- int t;
+ int attlen;
+ int t;
if (reldesc != NULL)
{
@@ -646,10 +645,10 @@ DefineAttr(char *name, char *type, int attnum)
void
InsertOneTuple(Oid objectid)
{
- HeapTuple tuple;
- TupleDesc tupDesc;
+ HeapTuple tuple;
+ TupleDesc tupDesc;
- int i;
+ int i;
if (DebugMode)
{
@@ -687,8 +686,8 @@ InsertOneTuple(Oid objectid)
void
InsertOneValue(Oid objectid, char *value, int i)
{
- int typeindex;
- char *prt;
+ int typeindex;
+ char *prt;
struct typmap **app;
if (DebugMode)
@@ -701,7 +700,7 @@ InsertOneValue(Oid objectid, char *value, int i)
if (Typ != (struct typmap **) NULL)
{
- struct typmap *ap;
+ struct typmap *ap;
if (DebugMode)
puts("Typ != NULL");
@@ -767,13 +766,13 @@ InsertOneNull(int i)
#define MORE_THAN_THE_NUMBER_OF_CATALOGS 256
-static bool
+static bool
BootstrapAlreadySeen(Oid id)
{
- static Oid seenArray[MORE_THAN_THE_NUMBER_OF_CATALOGS];
- static int nseen = 0;
- bool seenthis;
- int i;
+ static Oid seenArray[MORE_THAN_THE_NUMBER_OF_CATALOGS];
+ static int nseen = 0;
+ bool seenthis;
+ int i;
seenthis = false;
@@ -800,7 +799,7 @@ BootstrapAlreadySeen(Oid id)
static void
cleanup()
{
- static int beenhere = 0;
+ static int beenhere = 0;
if (!beenhere)
beenhere = 1;
@@ -824,10 +823,10 @@ cleanup()
static int
gettype(char *type)
{
- int i;
- Relation rdesc;
- HeapScanDesc sdesc;
- HeapTuple tup;
+ int i;
+ Relation rdesc;
+ HeapScanDesc sdesc;
+ HeapTuple tup;
struct typmap **app;
if (Typ != (struct typmap **) NULL)
@@ -885,7 +884,7 @@ gettype(char *type)
* AllocateAttribute
* ----------------
*/
-static AttributeTupleForm /* XXX */
+static AttributeTupleForm /* XXX */
AllocateAttribute()
{
AttributeTupleForm attribute =
@@ -914,13 +913,13 @@ AllocateAttribute()
* be freed by the CALLER.
* ----------------
*/
-char *
+char *
MapArrayTypeName(char *s)
{
- int i,
- j;
- static char newStr[NAMEDATALEN]; /* array type names <
- * NAMEDATALEN long */
+ int i,
+ j;
+ static char newStr[NAMEDATALEN]; /* array type names < NAMEDATALEN
+ * long */
if (s == NULL || s[0] == '\0')
return s;
@@ -944,8 +943,8 @@ MapArrayTypeName(char *s)
int
EnterString(char *str)
{
- hashnode *node;
- int len;
+ hashnode *node;
+ int len;
len = strlen(str);
@@ -967,7 +966,7 @@ EnterString(char *str)
* associated with the idnum
* ----------------
*/
-char *
+char *
LexIDStr(int ident_num)
{
return (strtable[ident_num]);
@@ -986,7 +985,7 @@ LexIDStr(int ident_num)
static int
CompHash(char *str, int len)
{
- register int result;
+ register int result;
result = (NUM * str[0] + NUMSQR * str[len - 1] + NUMCUBE * str[(len - 1) / 2]);
@@ -1005,7 +1004,7 @@ CompHash(char *str, int len)
static hashnode *
FindStr(char *str, int length, hashnode * mderef)
{
- hashnode *node;
+ hashnode *node;
node = hashtable[CompHash(str, length)];
while (node != NULL)
@@ -1040,11 +1039,11 @@ FindStr(char *str, int length, hashnode * mderef)
static hashnode *
AddStr(char *str, int strlength, int mderef)
{
- hashnode *temp,
- *trail,
- *newnode;
- int hashresult;
- int len;
+ hashnode *temp,
+ *trail,
+ *newnode;
+ int hashresult;
+ int len;
if (++strtable_end == STRTABLESIZE)
{
@@ -1118,10 +1117,10 @@ index_register(char *heap,
FuncIndexInfo * finfo,
PredInfo * predInfo)
{
- Datum *v;
- IndexList *newind;
- int len;
- MemoryContext oldcxt;
+ Datum *v;
+ IndexList *newind;
+ int len;
+ MemoryContext oldcxt;
/*
* XXX mao 10/31/92 -- don't gc index reldescs, associated info at
@@ -1193,8 +1192,8 @@ index_register(char *heap,
void
build_indices()
{
- Relation heap;
- Relation ind;
+ Relation heap;
+ Relation ind;
for (; ILHead != (IndexList *) NULL; ILHead = ILHead->il_next)
{
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index a8abbb01ee..779dfec4b2 100644
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.8 1997/09/07 04:40:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.9 1997/09/08 02:21:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,10 +26,10 @@
* relpath - path to the relation
* Perhaps this should be in-line code in relopen().
*/
-char *
+char *
relpath(char relname[])
{
- char *path;
+ char *path;
if (IsSharedSystemRelationName(relname))
{
@@ -91,7 +91,7 @@ IsSystemRelationName(char *relname)
bool
IsSharedSystemRelationName(char *relname)
{
- int i;
+ int i;
/*
* Quick out: if it's not a system relation, it can't be a shared
@@ -128,7 +128,7 @@ IsSharedSystemRelationName(char *relname)
Oid
newoid()
{
- Oid lastoid;
+ Oid lastoid;
GetNewObjectId(&lastoid);
if (!OidIsValid(lastoid))
@@ -156,9 +156,9 @@ fillatt(TupleDesc tupleDesc)
{
AttributeTupleForm *attributeP;
register TypeTupleForm typp;
- HeapTuple tuple;
- int i;
- int natts = tupleDesc->natts;
+ HeapTuple tuple;
+ int i;
+ int natts = tupleDesc->natts;
AttributeTupleForm *att = tupleDesc->attrs;
if (natts < 0 || natts > MaxHeapAttributeNumber)
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index c80ddb9727..1fbb505400 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.25 1997/09/07 04:40:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.26 1997/09/08 02:21:37 momjian Exp $
*
* INTERFACE ROUTINES
* heap_creatr() - Create an uncataloged heap relation
@@ -61,17 +61,17 @@
static void
AddPgRelationTuple(Relation pg_class_desc,
Relation new_rel_desc, Oid new_rel_oid, int arch, unsigned natts);
-static void AddToTempRelList(Relation r);
-static void DeletePgAttributeTuples(Relation rdesc);
-static void DeletePgRelationTuple(Relation rdesc);
-static void DeletePgTypeTuple(Relation rdesc);
-static int RelationAlreadyExists(Relation pg_class_desc, char relname[]);
-static void RelationRemoveIndexes(Relation relation);
-static void RelationRemoveInheritance(Relation relation);
-static void RemoveFromTempRelList(Relation r);
-static void addNewRelationType(char *typeName, Oid new_rel_oid);
-static void StoreConstraints(Relation rel);
-static void RemoveConstraints(Relation rel);
+static void AddToTempRelList(Relation r);
+static void DeletePgAttributeTuples(Relation rdesc);
+static void DeletePgRelationTuple(Relation rdesc);
+static void DeletePgTypeTuple(Relation rdesc);
+static int RelationAlreadyExists(Relation pg_class_desc, char relname[]);
+static void RelationRemoveIndexes(Relation relation);
+static void RelationRemoveInheritance(Relation relation);
+static void RemoveFromTempRelList(Relation r);
+static void addNewRelationType(char *typeName, Oid new_rel_oid);
+static void StoreConstraints(Relation rel);
+static void RemoveConstraints(Relation rel);
/* ----------------------------------------------------------------
@@ -160,11 +160,11 @@ static AttributeTupleForm HeapAtt[] =
*/
typedef struct tempRelList
{
- Relation *rels; /* array of relation descriptors */
- int num; /* number of temporary relations */
- int size; /* size of space allocated for the rels
+ Relation *rels; /* array of relation descriptors */
+ int num; /* number of temporary relations */
+ int size; /* size of space allocated for the rels
* array */
-} TempRelList;
+} TempRelList;
#define TEMP_REL_LIST_SIZE 32
@@ -194,19 +194,19 @@ heap_creatr(char *name,
TupleDesc tupDesc)
{
register unsigned i;
- Oid relid;
- Relation rdesc;
- int len;
- bool nailme = false;
- char *relname = name;
- char tempname[40];
- int isTemp = 0;
- int natts = tupDesc->natts;
+ Oid relid;
+ Relation rdesc;
+ int len;
+ bool nailme = false;
+ char *relname = name;
+ char tempname[40];
+ int isTemp = 0;
+ int natts = tupDesc->natts;
/* AttributeTupleForm *att = tupDesc->attrs; */
extern GlobalMemory CacheCxt;
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
/* ----------------
* sanity checks
@@ -425,9 +425,9 @@ heap_creatr(char *name,
static void
CheckAttributeNames(TupleDesc tupdesc)
{
- unsigned i;
- unsigned j;
- int natts = tupdesc->natts;
+ unsigned i;
+ unsigned j;
+ int natts = tupdesc->natts;
/* ----------------
* first check for collision with system attribute names
@@ -487,9 +487,9 @@ CheckAttributeNames(TupleDesc tupdesc)
static int
RelationAlreadyExists(Relation pg_class_desc, char relname[])
{
- ScanKeyData key;
- HeapScanDesc pg_class_scan;
- HeapTuple tup;
+ ScanKeyData key;
+ HeapScanDesc pg_class_scan;
+ HeapTuple tup;
/*
* If this is not bootstrap (initdb) time, use the catalog index on
@@ -558,12 +558,12 @@ AddNewAttributeTuples(Oid new_rel_oid,
TupleDesc tupdesc)
{
AttributeTupleForm *dpp;
- unsigned i;
- HeapTuple tup;
- Relation rdesc;
- bool hasindex;
- Relation idescs[Num_pg_attr_indices];
- int natts = tupdesc->natts;
+ unsigned i;
+ HeapTuple tup;
+ Relation rdesc;
+ bool hasindex;
+ Relation idescs[Num_pg_attr_indices];
+ int natts = tupdesc->natts;
/* ----------------
* open pg_attribute
@@ -659,12 +659,12 @@ AddPgRelationTuple(Relation pg_class_desc,
int arch,
unsigned natts)
{
- Form_pg_class new_rel_reltup;
- HeapTuple tup;
- Relation idescs[Num_pg_class_indices];
- bool isBootstrap;
- extern bool ItsSequenceCreation; /* It's hack, I know... -
- * vadim 03/28/97 */
+ Form_pg_class new_rel_reltup;
+ HeapTuple tup;
+ Relation idescs[Num_pg_class_indices];
+ bool isBootstrap;
+ extern bool ItsSequenceCreation; /* It's hack, I know... - vadim
+ * 03/28/97 */
/* ----------------
* first we munge some of the information in our
@@ -737,7 +737,7 @@ AddPgRelationTuple(Relation pg_class_desc,
static void
addNewRelationType(char *typeName, Oid new_rel_oid)
{
- Oid new_type_oid;
+ Oid new_type_oid;
/*
* The sizes are set to oid size because it makes implementing sets
@@ -778,12 +778,12 @@ heap_create(char relname[],
unsigned smgr,
TupleDesc tupdesc)
{
- Relation pg_class_desc;
- Relation new_rel_desc;
- Oid new_rel_oid;
+ Relation pg_class_desc;
+ Relation new_rel_desc;
+ Oid new_rel_oid;
/* NameData typeNameData; */
- int natts = tupdesc->natts;
+ int natts = tupdesc->natts;
/* ----------------
* sanity checks
@@ -906,10 +906,10 @@ heap_create(char relname[],
static void
RelationRemoveInheritance(Relation relation)
{
- Relation catalogRelation;
- HeapTuple tuple;
- HeapScanDesc scan;
- ScanKeyData entry;
+ Relation catalogRelation;
+ HeapTuple tuple;
+ HeapScanDesc scan;
+ ScanKeyData entry;
/* ----------------
* open pg_inherits
@@ -1010,10 +1010,10 @@ RelationRemoveInheritance(Relation relation)
static void
RelationRemoveIndexes(Relation relation)
{
- Relation indexRelation;
- HeapTuple tuple;
- HeapScanDesc scan;
- ScanKeyData entry;
+ Relation indexRelation;
+ HeapTuple tuple;
+ HeapScanDesc scan;
+ ScanKeyData entry;
indexRelation = heap_openr(IndexRelationName);
@@ -1050,10 +1050,10 @@ RelationRemoveIndexes(Relation relation)
static void
DeletePgRelationTuple(Relation rdesc)
{
- Relation pg_class_desc;
- HeapScanDesc pg_class_scan;
- ScanKeyData key;
- HeapTuple tup;
+ Relation pg_class_desc;
+ HeapScanDesc pg_class_scan;
+ ScanKeyData key;
+ HeapTuple tup;
/* ----------------
* open pg_class
@@ -1108,10 +1108,10 @@ DeletePgRelationTuple(Relation rdesc)
static void
DeletePgAttributeTuples(Relation rdesc)
{
- Relation pg_attribute_desc;
- HeapScanDesc pg_attribute_scan;
- ScanKeyData key;
- HeapTuple tup;
+ Relation pg_attribute_desc;
+ HeapScanDesc pg_attribute_scan;
+ ScanKeyData key;
+ HeapTuple tup;
/* ----------------
* open pg_attribute
@@ -1178,15 +1178,15 @@ DeletePgAttributeTuples(Relation rdesc)
static void
DeletePgTypeTuple(Relation rdesc)
{
- Relation pg_type_desc;
- HeapScanDesc pg_type_scan;
- Relation pg_attribute_desc;
- HeapScanDesc pg_attribute_scan;
- ScanKeyData key;
- ScanKeyData attkey;
- HeapTuple tup;
- HeapTuple atttup;
- Oid typoid;
+ Relation pg_type_desc;
+ HeapScanDesc pg_type_scan;
+ Relation pg_attribute_desc;
+ HeapScanDesc pg_attribute_scan;
+ ScanKeyData key;
+ ScanKeyData attkey;
+ HeapTuple tup;
+ HeapTuple atttup;
+ Oid typoid;
/* ----------------
* open pg_type
@@ -1254,7 +1254,7 @@ DeletePgTypeTuple(Relation rdesc)
if (PointerIsValid(atttup))
{
- Oid relid = ((AttributeTupleForm) GETSTRUCT(atttup))->attrelid;
+ Oid relid = ((AttributeTupleForm) GETSTRUCT(atttup))->attrelid;
heap_endscan(pg_type_scan);
heap_close(pg_type_desc);
@@ -1287,8 +1287,8 @@ DeletePgTypeTuple(Relation rdesc)
void
heap_destroy(char *relname)
{
- Relation rdesc;
- Oid rid;
+ Relation rdesc;
+ Oid rid;
/* ----------------
* first open the relation. if the relation does exist,
@@ -1458,7 +1458,7 @@ InitTempRelList(void)
static void
RemoveFromTempRelList(Relation r)
{
- int i;
+ int i;
if (!tempRels)
return;
@@ -1500,8 +1500,8 @@ AddToTempRelList(Relation r)
void
DestroyTempRels(void)
{
- int i;
- Relation rdesc;
+ int i;
+ Relation rdesc;
if (!tempRels)
return;
@@ -1518,30 +1518,30 @@ DestroyTempRels(void)
tempRels = NULL;
}
-extern List *flatten_tlist(List * tlist);
-extern List *
+extern List *flatten_tlist(List * tlist);
+extern List *
pg_plan(char *query_string, Oid * typev, int nargs,
QueryTreeList ** queryListP, CommandDest dest);
static void
StoreAttrDefault(Relation rel, AttrDefault * attrdef)
{
- char str[MAX_PARSE_BUFFER];
- char cast[2 * NAMEDATALEN] = {0};
+ char str[MAX_PARSE_BUFFER];
+ char cast[2 * NAMEDATALEN] = {0};
AttributeTupleForm atp = rel->rd_att->attrs[attrdef->adnum - 1];
- QueryTreeList *queryTree_list;
- Query *query;
- List *planTree_list;
- TargetEntry *te;
- Resdom *resdom;
- Node *expr;
- char *adbin;
- MemoryContext oldcxt;
- Relation adrel;
- Relation idescs[Num_pg_attrdef_indices];
- HeapTuple tuple;
- Datum values[4];
- char nulls[4] = {' ', ' ', ' ', ' '};
+ QueryTreeList *queryTree_list;
+ Query *query;
+ List *planTree_list;
+ TargetEntry *te;
+ Resdom *resdom;
+ Node *expr;
+ char *adbin;
+ MemoryContext oldcxt;
+ Relation adrel;
+ Relation idescs[Num_pg_attrdef_indices];
+ HeapTuple tuple;
+ Datum values[4];
+ char nulls[4] = {' ', ' ', ' ', ' '};
extern GlobalMemory CacheCxt;
start:;
@@ -1600,19 +1600,19 @@ start:;
static void
StoreRelCheck(Relation rel, ConstrCheck * check)
{
- char str[MAX_PARSE_BUFFER];
- QueryTreeList *queryTree_list;
- Query *query;
- List *planTree_list;
- Plan *plan;
- List *qual;
- char *ccbin;
- MemoryContext oldcxt;
- Relation rcrel;
- Relation idescs[Num_pg_relcheck_indices];
- HeapTuple tuple;
- Datum values[4];
- char nulls[4] = {' ', ' ', ' ', ' '};
+ char str[MAX_PARSE_BUFFER];
+ QueryTreeList *queryTree_list;
+ Query *query;
+ List *planTree_list;
+ Plan *plan;
+ List *qual;
+ char *ccbin;
+ MemoryContext oldcxt;
+ Relation rcrel;
+ Relation idescs[Num_pg_relcheck_indices];
+ HeapTuple tuple;
+ Datum values[4];
+ char nulls[4] = {' ', ' ', ' ', ' '};
extern GlobalMemory CacheCxt;
sprintf(str, "select 1 from %.*s where %s",
@@ -1659,8 +1659,8 @@ StoreRelCheck(Relation rel, ConstrCheck * check)
static void
StoreConstraints(Relation rel)
{
- TupleConstr *constr = rel->rd_att->constr;
- int i;
+ TupleConstr *constr = rel->rd_att->constr;
+ int i;
if (!constr)
return;
@@ -1683,10 +1683,10 @@ StoreConstraints(Relation rel)
static void
RemoveAttrDefault(Relation rel)
{
- Relation adrel;
- HeapScanDesc adscan;
- ScanKeyData key;
- HeapTuple tup;
+ Relation adrel;
+ HeapScanDesc adscan;
+ ScanKeyData key;
+ HeapTuple tup;
adrel = heap_openr(AttrDefaultRelationName);
@@ -1710,10 +1710,10 @@ RemoveAttrDefault(Relation rel)
static void
RemoveRelCheck(Relation rel)
{
- Relation rcrel;
- HeapScanDesc rcscan;
- ScanKeyData key;
- HeapTuple tup;
+ Relation rcrel;
+ HeapScanDesc rcscan;
+ ScanKeyData key;
+ HeapTuple tup;
rcrel = heap_openr(RelCheckRelationName);
@@ -1737,7 +1737,7 @@ RemoveRelCheck(Relation rel)
static void
RemoveConstraints(Relation rel)
{
- TupleConstr *constr = rel->rd_att->constr;
+ TupleConstr *constr = rel->rd_att->constr;
if (!constr)
return;
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 6dd7574279..d6459fbe2b 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.20 1997/09/07 04:40:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.21 1997/09/08 02:21:40 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -66,21 +66,21 @@
static Oid
RelationNameGetObjectId(char *relationName, Relation pg_class,
bool setHasIndexAttribute);
-static Oid GetHeapRelationOid(char *heapRelationName, char *indexRelationName);
+static Oid GetHeapRelationOid(char *heapRelationName, char *indexRelationName);
static TupleDesc BuildFuncTupleDesc(FuncIndexInfo * funcInfo);
static TupleDesc
ConstructTupleDescriptor(Oid heapoid, Relation heapRelation,
List * attributeList,
int numatts, AttrNumber attNums[]);
-static void ConstructIndexReldesc(Relation indexRelation, Oid amoid);
-static Oid UpdateRelationRelation(Relation indexRelation);
+static void ConstructIndexReldesc(Relation indexRelation, Oid amoid);
+static Oid UpdateRelationRelation(Relation indexRelation);
static void
InitializeAttributeOids(Relation indexRelation,
int numatts,
Oid indexoid);
static void
- AppendAttributeTuples(Relation indexRelation, int numatts);
+ AppendAttributeTuples(Relation indexRelation, int numatts);
static void
UpdateIndexRelation(Oid indexoid, Oid heapoid,
FuncIndexInfo * funcInfo, int natts,
@@ -144,16 +144,16 @@ static FormData_pg_attribute sysatts[] = {
* Assumes relation descriptor is valid.
* ----------------------------------------------------------------
*/
-static Oid
+static Oid
RelationNameGetObjectId(char *relationName,
Relation pg_class,
bool setHasIndexAttribute)
{
- HeapScanDesc pg_class_scan;
- HeapTuple pg_class_tuple;
- Oid relationObjectId;
- Buffer buffer;
- ScanKeyData key;
+ HeapScanDesc pg_class_scan;
+ HeapTuple pg_class_tuple;
+ Oid relationObjectId;
+ Buffer buffer;
+ ScanKeyData key;
/*
* If this isn't bootstrap time, we can use the system catalogs to
@@ -217,12 +217,12 @@ RelationNameGetObjectId(char *relationName,
* GetHeapRelationOid
* ----------------------------------------------------------------
*/
-static Oid
+static Oid
GetHeapRelationOid(char *heapRelationName, char *indexRelationName)
{
- Relation pg_class;
- Oid indoid;
- Oid heapoid;
+ Relation pg_class;
+ Oid indoid;
+ Oid heapoid;
/* ----------------
* XXX ADD INDEXING HERE
@@ -268,15 +268,15 @@ GetHeapRelationOid(char *heapRelationName, char *indexRelationName)
return heapoid;
}
-static TupleDesc
+static TupleDesc
BuildFuncTupleDesc(FuncIndexInfo * funcInfo)
{
- HeapTuple tuple;
- TupleDesc funcTupDesc;
- Oid retType;
- char *funcname;
- int4 nargs;
- Oid *argtypes;
+ HeapTuple tuple;
+ TupleDesc funcTupDesc;
+ Oid retType;
+ char *funcname;
+ int4 nargs;
+ Oid *argtypes;
/*
* Allocate and zero a tuple descriptor.
@@ -331,23 +331,23 @@ BuildFuncTupleDesc(FuncIndexInfo * funcInfo)
* ConstructTupleDescriptor
* ----------------------------------------------------------------
*/
-static TupleDesc
+static TupleDesc
ConstructTupleDescriptor(Oid heapoid,
Relation heapRelation,
List * attributeList,
int numatts,
AttrNumber attNums[])
{
- TupleDesc heapTupDesc;
- TupleDesc indexTupDesc;
- IndexElem *IndexKey;
- TypeName *IndexKeyType;
- AttrNumber atnum; /* attributeNumber[attributeOffset] */
- AttrNumber atind;
- int natts; /* RelationTupleForm->relnatts */
- char *from; /* used to simplify memcpy below */
- char *to; /* used to simplify memcpy below */
- int i;
+ TupleDesc heapTupDesc;
+ TupleDesc indexTupDesc;
+ IndexElem *IndexKey;
+ TypeName *IndexKeyType;
+ AttrNumber atnum; /* attributeNumber[attributeOffset] */
+ AttrNumber atind;
+ int natts; /* RelationTupleForm->relnatts */
+ char *from; /* used to simplify memcpy below */
+ char *to; /* used to simplify memcpy below */
+ int i;
/* ----------------
* allocate the new tuple descriptor
@@ -447,7 +447,7 @@ ConstructTupleDescriptor(Oid heapoid,
*/
if (IndexKeyType != NULL)
{
- HeapTuple tup;
+ HeapTuple tup;
tup = SearchSysCacheTuple(TYPNAME,
PointerGetDatum(IndexKeyType->name),
@@ -491,11 +491,11 @@ ConstructTupleDescriptor(Oid heapoid,
Form_pg_am
AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId)
{
- Relation pg_am_desc;
- HeapScanDesc pg_am_scan;
- HeapTuple pg_am_tuple;
- ScanKeyData key;
- Form_pg_am form;
+ Relation pg_am_desc;
+ HeapScanDesc pg_am_scan;
+ HeapTuple pg_am_tuple;
+ ScanKeyData key;
+ Form_pg_am form;
/* ----------------
* form a scan key for the pg_am relation
@@ -546,7 +546,7 @@ static void
ConstructIndexReldesc(Relation indexRelation, Oid amoid)
{
extern GlobalMemory CacheCxt;
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
/* ----------------
* here we make certain to allocate the access method
@@ -583,13 +583,13 @@ ConstructIndexReldesc(Relation indexRelation, Oid amoid)
* UpdateRelationRelation
* ----------------------------------------------------------------
*/
-static Oid
+static Oid
UpdateRelationRelation(Relation indexRelation)
{
- Relation pg_class;
- HeapTuple tuple;
- Oid tupleOid;
- Relation idescs[Num_pg_class_indices];
+ Relation pg_class;
+ HeapTuple tuple;
+ Oid tupleOid;
+ Relation idescs[Num_pg_class_indices];
pg_class = heap_openr(RelationRelationName);
@@ -637,8 +637,8 @@ InitializeAttributeOids(Relation indexRelation,
int numatts,
Oid indexoid)
{
- TupleDesc tupleDescriptor;
- int i;
+ TupleDesc tupleDescriptor;
+ int i;
tupleDescriptor = RelationGetTupleDescriptor(indexRelation);
@@ -655,18 +655,18 @@ InitializeAttributeOids(Relation indexRelation,
static void
AppendAttributeTuples(Relation indexRelation, int numatts)
{
- Relation pg_attribute;
- HeapTuple tuple;
- HeapTuple newtuple;
- bool hasind;
- Relation idescs[Num_pg_attr_indices];
+ Relation pg_attribute;
+ HeapTuple tuple;
+ HeapTuple newtuple;
+ bool hasind;
+ Relation idescs[Num_pg_attr_indices];
- Datum value[Natts_pg_attribute];
- char nullv[Natts_pg_attribute];
- char replace[Natts_pg_attribute];
+ Datum value[Natts_pg_attribute];
+ char nullv[Natts_pg_attribute];
+ char replace[Natts_pg_attribute];
- TupleDesc indexTupDesc;
- int i;
+ TupleDesc indexTupDesc;
+ int i;
/* ----------------
* open the attribute relation
@@ -786,15 +786,15 @@ UpdateIndexRelation(Oid indexoid,
bool islossy,
bool unique)
{
- IndexTupleForm indexForm;
- IndexElem *IndexKey;
- char *predString;
- text *predText;
- int predLen,
- itupLen;
- Relation pg_index;
- HeapTuple tuple;
- int i;
+ IndexTupleForm indexForm;
+ IndexElem *IndexKey;
+ char *predString;
+ text *predText;
+ int predLen,
+ itupLen;
+ Relation pg_index;
+ HeapTuple tuple;
+ int i;
/* ----------------
* allocate an IndexTupleForm big enough to hold the
@@ -903,19 +903,19 @@ UpdateIndexRelation(Oid indexoid,
void
UpdateIndexPredicate(Oid indexoid, Node * oldPred, Node * predicate)
{
- Node *newPred;
- char *predString;
- text *predText;
- Relation pg_index;
- HeapTuple tuple;
- HeapTuple newtup;
- ScanKeyData entry;
- HeapScanDesc scan;
- Buffer buffer;
- int i;
- Datum values[Natts_pg_index];
- char nulls[Natts_pg_index];
- char replace[Natts_pg_index];
+ Node *newPred;
+ char *predString;
+ text *predText;
+ Relation pg_index;
+ HeapTuple tuple;
+ HeapTuple newtup;
+ ScanKeyData entry;
+ HeapScanDesc scan;
+ Buffer buffer;
+ int i;
+ Datum values[Natts_pg_index];
+ char nulls[Natts_pg_index];
+ char replace[Natts_pg_index];
/*
* Construct newPred as a CNF expression equivalent to the OR of the
@@ -988,12 +988,12 @@ InitIndexStrategy(int numatts,
Relation indexRelation,
Oid accessMethodObjectId)
{
- IndexStrategy strategy;
- RegProcedure *support;
- uint16 amstrategies;
- uint16 amsupport;
- Oid attrelid;
- Size strsize;
+ IndexStrategy strategy;
+ RegProcedure *support;
+ uint16 amstrategies;
+ uint16 amsupport;
+ Oid attrelid;
+ Size strsize;
extern GlobalMemory CacheCxt;
/* ----------------
@@ -1077,12 +1077,12 @@ index_create(char *heapRelationName,
bool islossy,
bool unique)
{
- Relation heapRelation;
- Relation indexRelation;
- TupleDesc indexTupDesc;
- Oid heapoid;
- Oid indexoid;
- PredInfo *predInfo;
+ Relation heapRelation;
+ Relation indexRelation;
+ TupleDesc indexTupDesc;
+ Oid heapoid;
+ Oid indexoid;
+ PredInfo *predInfo;
/* ----------------
* check parameters
@@ -1150,7 +1150,7 @@ index_create(char *heapRelationName,
if (PointerIsValid(funcInfo))
{
- HeapTuple proc_tup;
+ HeapTuple proc_tup;
proc_tup = SearchSysCacheTuple(PRONAME,
PointerGetDatum(FIgetname(funcInfo)),
@@ -1231,11 +1231,11 @@ index_create(char *heapRelationName,
void
index_destroy(Oid indexId)
{
- Relation indexRelation;
- Relation catalogRelation;
- HeapTuple tuple;
- HeapScanDesc scan;
- ScanKeyData entry;
+ Relation indexRelation;
+ Relation catalogRelation;
+ HeapTuple tuple;
+ HeapScanDesc scan;
+ ScanKeyData entry;
Assert(OidIsValid(indexId));
@@ -1325,9 +1325,9 @@ FormIndexDatum(int numberOfAttributes,
char *nullv,
FuncIndexInfoPtr fInfo)
{
- AttrNumber i;
- int offset;
- bool isNull;
+ AttrNumber i;
+ int offset;
+ bool isNull;
/* ----------------
* for each attribute we need from the heap tuple,
@@ -1361,23 +1361,23 @@ FormIndexDatum(int numberOfAttributes,
void
UpdateStats(Oid relid, long reltuples, bool hasindex)
{
- Relation whichRel;
- Relation pg_class;
- HeapScanDesc pg_class_scan;
- HeapTuple htup;
- HeapTuple newtup;
- long relpages;
- Buffer buffer;
- int i;
- Form_pg_class rd_rel;
- Relation idescs[Num_pg_class_indices];
+ Relation whichRel;
+ Relation pg_class;
+ HeapScanDesc pg_class_scan;
+ HeapTuple htup;
+ HeapTuple newtup;
+ long relpages;
+ Buffer buffer;
+ int i;
+ Form_pg_class rd_rel;
+ Relation idescs[Num_pg_class_indices];
static ScanKeyData key[1] = {
{0, ObjectIdAttributeNumber, ObjectIdEqualRegProcedure}
};
- Datum values[Natts_pg_class];
- char nulls[Natts_pg_class];
- char replace[Natts_pg_class];
+ Datum values[Natts_pg_class];
+ char nulls[Natts_pg_class];
+ char replace[Natts_pg_class];
fmgr_info(ObjectIdEqualRegProcedure, (func_ptr *) & key[0].sk_func,
&key[0].sk_nargs);
@@ -1534,26 +1534,26 @@ DefaultBuild(Relation heapRelation,
FuncIndexInfoPtr funcInfo,
PredInfo * predInfo)
{
- HeapScanDesc scan;
- HeapTuple heapTuple;
- Buffer buffer;
-
- IndexTuple indexTuple;
- TupleDesc heapDescriptor;
- TupleDesc indexDescriptor;
- Datum *datum;
- char *nullv;
- long reltuples,
- indtuples;
+ HeapScanDesc scan;
+ HeapTuple heapTuple;
+ Buffer buffer;
+
+ IndexTuple indexTuple;
+ TupleDesc heapDescriptor;
+ TupleDesc indexDescriptor;
+ Datum *datum;
+ char *nullv;
+ long reltuples,
+ indtuples;
#ifndef OMIT_PARTIAL_INDEX
- ExprContext *econtext;
- TupleTable tupleTable;
+ ExprContext *econtext;
+ TupleTable tupleTable;
TupleTableSlot *slot;
#endif
- Node *predicate;
- Node *oldPred;
+ Node *predicate;
+ Node *oldPred;
InsertIndexResult insertResult;
@@ -1736,7 +1736,7 @@ index_build(Relation heapRelation,
FuncIndexInfo * funcInfo,
PredInfo * predInfo)
{
- RegProcedure procedure;
+ RegProcedure procedure;
/* ----------------
* sanity checks
@@ -1781,8 +1781,8 @@ index_build(Relation heapRelation,
bool
IndexIsUnique(Oid indexId)
{
- HeapTuple tuple;
- IndexTupleForm index;
+ HeapTuple tuple;
+ IndexTupleForm index;
tuple = SearchSysCacheTuple(INDEXRELID,
ObjectIdGetDatum(indexId),
@@ -1813,12 +1813,12 @@ IndexIsUnique(Oid indexId)
bool
IndexIsUniqueNoCache(Oid indexId)
{
- Relation pg_index;
- ScanKeyData skey[1];
- HeapScanDesc scandesc;
- HeapTuple tuple;
- IndexTupleForm index;
- bool isunique;
+ Relation pg_index;
+ ScanKeyData skey[1];
+ HeapScanDesc scandesc;
+ HeapTuple tuple;
+ IndexTupleForm index;
+ bool isunique;
pg_index = heap_openr(IndexRelationName);
diff --git a/src/backend/catalog/indexing.c b/src/backend/catalog/indexing.c
index 6a89258d97..5dca2e3d9a 100644
--- a/src/backend/catalog/indexing.c
+++ b/src/backend/catalog/indexing.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.12 1997/09/07 04:40:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.13 1997/09/08 02:21:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,21 +44,21 @@
* pg_trigger
*/
-char *Name_pg_attr_indices[Num_pg_attr_indices] = {AttributeNameIndex,
+char *Name_pg_attr_indices[Num_pg_attr_indices] = {AttributeNameIndex,
AttributeNumIndex,
AttributeRelidIndex};
-char *Name_pg_proc_indices[Num_pg_proc_indices] = {ProcedureNameIndex,
+char *Name_pg_proc_indices[Num_pg_proc_indices] = {ProcedureNameIndex,
ProcedureOidIndex,
ProcedureSrcIndex};
-char *Name_pg_type_indices[Num_pg_type_indices] = {TypeNameIndex,
+char *Name_pg_type_indices[Num_pg_type_indices] = {TypeNameIndex,
TypeOidIndex};
-char *Name_pg_class_indices[Num_pg_class_indices] = {ClassNameIndex,
+char *Name_pg_class_indices[Num_pg_class_indices] = {ClassNameIndex,
ClassOidIndex};
-char *Name_pg_attrdef_indices[Num_pg_attrdef_indices] = {AttrDefaultIndex};
+char *Name_pg_attrdef_indices[Num_pg_attrdef_indices] = {AttrDefaultIndex};
-char *Name_pg_relcheck_indices[Num_pg_relcheck_indices] = {RelCheckIndex};
+char *Name_pg_relcheck_indices[Num_pg_relcheck_indices] = {RelCheckIndex};
-char *Name_pg_trigger_indices[Num_pg_trigger_indices] = {TriggerRelidIndex};
+char *Name_pg_trigger_indices[Num_pg_trigger_indices] = {TriggerRelidIndex};
static HeapTuple
@@ -76,7 +76,7 @@ CatalogIndexFetchTuple(Relation heapRelation,
void
CatalogOpenIndices(int nIndices, char *names[], Relation idescs[])
{
- int i;
+ int i;
for (i = 0; i < nIndices; i++)
{
@@ -90,7 +90,7 @@ CatalogOpenIndices(int nIndices, char *names[], Relation idescs[])
void
CatalogCloseIndices(int nIndices, Relation * idescs)
{
- int i;
+ int i;
for (i = 0; i < nIndices; i++)
index_close(idescs[i]);
@@ -108,22 +108,22 @@ CatalogIndexInsert(Relation * idescs,
Relation heapRelation,
HeapTuple heapTuple)
{
- HeapTuple pgIndexTup;
- TupleDesc heapDescriptor;
- IndexTupleForm pgIndexP;
- Datum datum;
- int natts;
- AttrNumber *attnumP;
- FuncIndexInfo finfo,
- *finfoP;
- char nulls[INDEX_MAX_KEYS];
- int i;
+ HeapTuple pgIndexTup;
+ TupleDesc heapDescriptor;
+ IndexTupleForm pgIndexP;
+ Datum datum;
+ int natts;
+ AttrNumber *attnumP;
+ FuncIndexInfo finfo,
+ *finfoP;
+ char nulls[INDEX_MAX_KEYS];
+ int i;
heapDescriptor = RelationGetTupleDescriptor(heapRelation);
for (i = 0; i < nIndices; i++)
{
- TupleDesc indexDescriptor;
+ TupleDesc indexDescriptor;
InsertIndexResult indexRes;
indexDescriptor = RelationGetTupleDescriptor(idescs[i]);
@@ -176,10 +176,10 @@ CatalogIndexInsert(Relation * idescs,
bool
CatalogHasIndex(char *catName, Oid catId)
{
- Relation pg_class;
- HeapTuple htup;
- Form_pg_class pgRelP;
- int i;
+ Relation pg_class;
+ HeapTuple htup;
+ Form_pg_class pgRelP;
+ int i;
Assert(IsSystemRelationName(catName));
@@ -221,15 +221,15 @@ CatalogHasIndex(char *catName, Oid catId)
* iterate until we find a tuple that's valid and satisfies the scan
* key.
*/
-static HeapTuple
+static HeapTuple
CatalogIndexFetchTuple(Relation heapRelation,
Relation idesc,
ScanKey skey)
{
- IndexScanDesc sd;
+ IndexScanDesc sd;
RetrieveIndexResult indexRes;
- HeapTuple tuple;
- Buffer buffer;
+ HeapTuple tuple;
+ Buffer buffer;
sd = index_beginscan(idesc, false, 1, skey);
tuple = (HeapTuple) NULL;
@@ -239,7 +239,7 @@ CatalogIndexFetchTuple(Relation heapRelation,
indexRes = index_getnext(sd, ForwardScanDirection);
if (indexRes)
{
- ItemPointer iptr;
+ ItemPointer iptr;
iptr = &indexRes->heap_iptr;
tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
@@ -271,10 +271,10 @@ AttributeNameIndexScan(Relation heapRelation,
Oid relid,
char *attname)
{
- Relation idesc;
- ScanKeyData skey;
- OidName keyarg;
- HeapTuple tuple;
+ Relation idesc;
+ ScanKeyData skey;
+ OidName keyarg;
+ HeapTuple tuple;
keyarg = mkoidname(relid, attname);
ScanKeyEntryInitialize(&skey,
@@ -297,10 +297,10 @@ AttributeNumIndexScan(Relation heapRelation,
Oid relid,
AttrNumber attnum)
{
- Relation idesc;
- ScanKeyData skey;
- OidInt2 keyarg;
- HeapTuple tuple;
+ Relation idesc;
+ ScanKeyData skey;
+ OidInt2 keyarg;
+ HeapTuple tuple;
keyarg = mkoidint2(relid, (uint16) attnum);
ScanKeyEntryInitialize(&skey,
@@ -321,9 +321,9 @@ AttributeNumIndexScan(Relation heapRelation,
HeapTuple
ProcedureOidIndexScan(Relation heapRelation, Oid procId)
{
- Relation idesc;
- ScanKeyData skey;
- HeapTuple tuple;
+ Relation idesc;
+ ScanKeyData skey;
+ HeapTuple tuple;
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
@@ -347,22 +347,21 @@ ProcedureNameIndexScan(Relation heapRelation,
int nargs,
Oid * argTypes)
{
- Relation idesc;
- ScanKeyData skey;
- HeapTuple tuple; /* tuple being tested */
- HeapTuple return_tuple; /* The tuple pointer we eventually
- * return */
- IndexScanDesc sd;
+ Relation idesc;
+ ScanKeyData skey;
+ HeapTuple tuple; /* tuple being tested */
+ HeapTuple return_tuple; /* The tuple pointer we eventually return */
+ IndexScanDesc sd;
RetrieveIndexResult indexRes;
- Buffer buffer;
- Form_pg_proc pgProcP;
- bool ScanComplete;
+ Buffer buffer;
+ Form_pg_proc pgProcP;
+ bool ScanComplete;
/*
* The index scan is complete, i.e. we've scanned everything there is
* to scan.
*/
- bool FoundMatch;
+ bool FoundMatch;
/*
* In scanning pg_proc, we have found a row that meets our search
@@ -392,7 +391,7 @@ ProcedureNameIndexScan(Relation heapRelation,
indexRes = index_getnext(sd, ForwardScanDirection);
if (indexRes)
{
- ItemPointer iptr;
+ ItemPointer iptr;
iptr = &indexRes->heap_iptr;
tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
@@ -438,12 +437,12 @@ ProcedureNameIndexScan(Relation heapRelation,
HeapTuple
ProcedureSrcIndexScan(Relation heapRelation, text * procSrc)
{
- Relation idesc;
- IndexScanDesc sd;
- ScanKeyData skey;
+ Relation idesc;
+ IndexScanDesc sd;
+ ScanKeyData skey;
RetrieveIndexResult indexRes;
- HeapTuple tuple;
- Buffer buffer;
+ HeapTuple tuple;
+ Buffer buffer;
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
@@ -457,7 +456,7 @@ ProcedureSrcIndexScan(Relation heapRelation, text * procSrc)
indexRes = index_getnext(sd, ForwardScanDirection);
if (indexRes)
{
- ItemPointer iptr;
+ ItemPointer iptr;
iptr = &indexRes->heap_iptr;
tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
@@ -480,9 +479,9 @@ ProcedureSrcIndexScan(Relation heapRelation, text * procSrc)
HeapTuple
TypeOidIndexScan(Relation heapRelation, Oid typeId)
{
- Relation idesc;
- ScanKeyData skey;
- HeapTuple tuple;
+ Relation idesc;
+ ScanKeyData skey;
+ HeapTuple tuple;
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
@@ -501,9 +500,9 @@ TypeOidIndexScan(Relation heapRelation, Oid typeId)
HeapTuple
TypeNameIndexScan(Relation heapRelation, char *typeName)
{
- Relation idesc;
- ScanKeyData skey;
- HeapTuple tuple;
+ Relation idesc;
+ ScanKeyData skey;
+ HeapTuple tuple;
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
@@ -522,9 +521,9 @@ TypeNameIndexScan(Relation heapRelation, char *typeName)
HeapTuple
ClassNameIndexScan(Relation heapRelation, char *relName)
{
- Relation idesc;
- ScanKeyData skey;
- HeapTuple tuple;
+ Relation idesc;
+ ScanKeyData skey;
+ HeapTuple tuple;
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
@@ -543,9 +542,9 @@ ClassNameIndexScan(Relation heapRelation, char *relName)
HeapTuple
ClassOidIndexScan(Relation heapRelation, Oid relId)
{
- Relation idesc;
- ScanKeyData skey;
- HeapTuple tuple;
+ Relation idesc;
+ ScanKeyData skey;
+ HeapTuple tuple;
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index 540350bac9..32c89110c0 100644
--- a/src/backend/catalog/pg_aggregate.c
+++ b/src/backend/catalog/pg_aggregate.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.6 1997/09/07 04:40:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.7 1997/09/08 02:21:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,21 +64,21 @@ AggregateCreate(char *aggName,
char *agginitval1,
char *agginitval2)
{
- register i;
- Relation aggdesc;
- HeapTuple tup;
- char nulls[Natts_pg_aggregate];
- Datum values[Natts_pg_aggregate];
- Form_pg_proc proc;
- Oid xfn1 = InvalidOid;
- Oid xfn2 = InvalidOid;
- Oid ffn = InvalidOid;
- Oid xbase = InvalidOid;
- Oid xret1 = InvalidOid;
- Oid xret2 = InvalidOid;
- Oid fret = InvalidOid;
- Oid fnArgs[8];
- TupleDesc tupDesc;
+ register i;
+ Relation aggdesc;
+ HeapTuple tup;
+ char nulls[Natts_pg_aggregate];
+ Datum values[Natts_pg_aggregate];
+ Form_pg_proc proc;
+ Oid xfn1 = InvalidOid;
+ Oid xfn2 = InvalidOid;
+ Oid ffn = InvalidOid;
+ Oid xbase = InvalidOid;
+ Oid xret1 = InvalidOid;
+ Oid xret2 = InvalidOid;
+ Oid fret = InvalidOid;
+ Oid fnArgs[8];
+ TupleDesc tupDesc;
memset(fnArgs, 0, 8 * sizeof(Oid));
@@ -267,16 +267,16 @@ AggregateCreate(char *aggName,
}
-char *
+char *
AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool * isNull)
{
- HeapTuple tup;
- Relation aggRel;
- int initValAttno;
- Oid transtype;
- text *textInitVal;
- char *strInitVal,
- *initVal;
+ HeapTuple tup;
+ Relation aggRel;
+ int initValAttno;
+ Oid transtype;
+ text *textInitVal;
+ char *strInitVal,
+ *initVal;
Assert(PointerIsValid(aggName));
Assert(PointerIsValid(isNull));
@@ -295,7 +295,7 @@ AggNameGetInitVal(char *aggName, Oid basetype, int xfuncno, bool * isNull)
initValAttno = Anum_pg_aggregate_agginitval1;
}
else
- /* can only be 1 or 2 */
+ /* can only be 1 or 2 */
{
transtype = ((Form_pg_aggregate) GETSTRUCT(tup))->aggtranstype2;
initValAttno = Anum_pg_aggregate_agginitval2;
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index 67a3a2f149..422c212811 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.12 1997/09/07 04:40:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.13 1997/09/08 02:21:48 momjian Exp $
*
* NOTES
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -66,7 +66,7 @@ OperatorDef(char *operatorName,
bool canHash,
char *leftSortName,
char *rightSortName);
-static void OperatorUpd(Oid baseId, Oid commId, Oid negId);
+static void OperatorUpd(Oid baseId, Oid commId, Oid negId);
/* ----------------------------------------------------------------
* OperatorGetWithOpenRelation
@@ -79,15 +79,15 @@ static void OperatorUpd(Oid baseId, Oid commId, Oid negId);
* leftObjectId -- left oid of operator to fetch
* rightObjectId -- right oid of operator to fetch
*/
-static Oid
+static Oid
OperatorGetWithOpenRelation(Relation pg_operator_desc,
const char *operatorName,
Oid leftObjectId,
Oid rightObjectId)
{
- HeapScanDesc pg_operator_scan;
- Oid operatorObjectId;
- HeapTuple tup;
+ HeapScanDesc pg_operator_scan;
+ Oid operatorObjectId;
+ HeapTuple tup;
static ScanKeyData opKey[3] = {
{0, Anum_pg_operator_oprname, NameEqualRegProcedure},
@@ -145,18 +145,18 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
* and left and right type names.
* ----------------------------------------------------------------
*/
-static Oid
+static Oid
OperatorGet(char *operatorName,
char *leftTypeName,
char *rightTypeName)
{
- Relation pg_operator_desc;
+ Relation pg_operator_desc;
- Oid operatorObjectId;
- Oid leftObjectId = InvalidOid;
- Oid rightObjectId = InvalidOid;
- bool leftDefined = false;
- bool rightDefined = false;
+ Oid operatorObjectId;
+ Oid leftObjectId = InvalidOid;
+ Oid rightObjectId = InvalidOid;
+ bool leftDefined = false;
+ bool rightDefined = false;
/* ----------------
* look up the operator types.
@@ -216,18 +216,18 @@ OperatorGet(char *operatorName,
*
* ----------------------------------------------------------------
*/
-static Oid
+static Oid
OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
char *operatorName,
Oid leftObjectId,
Oid rightObjectId)
{
- register int i;
- HeapTuple tup;
- Datum values[Natts_pg_operator];
- char nulls[Natts_pg_operator];
- Oid operatorObjectId;
- TupleDesc tupDesc;
+ register int i;
+ HeapTuple tup;
+ Datum values[Natts_pg_operator];
+ char nulls[Natts_pg_operator];
+ Oid operatorObjectId;
+ TupleDesc tupDesc;
/* ----------------
* initialize our nulls[] and values[] arrays
@@ -300,18 +300,18 @@ OperatorShellMakeWithOpenRelation(Relation pg_operator_desc,
* to the caller.
* ----------------------------------------------------------------
*/
-static Oid
+static Oid
OperatorShellMake(char *operatorName,
char *leftTypeName,
char *rightTypeName)
{
- Relation pg_operator_desc;
- Oid operatorObjectId;
+ Relation pg_operator_desc;
+ Oid operatorObjectId;
- Oid leftObjectId = InvalidOid;
- Oid rightObjectId = InvalidOid;
- bool leftDefined = false;
- bool rightDefined = false;
+ Oid leftObjectId = InvalidOid;
+ Oid rightObjectId = InvalidOid;
+ bool leftDefined = false;
+ bool rightDefined = false;
/* ----------------
* get the left and right type oid's for this operator
@@ -450,29 +450,29 @@ OperatorDef(char *operatorName,
char *leftSortName,
char *rightSortName)
{
- register i,
- j;
- Relation pg_operator_desc;
+ register i,
+ j;
+ Relation pg_operator_desc;
- HeapScanDesc pg_operator_scan;
- HeapTuple tup;
- Buffer buffer;
+ HeapScanDesc pg_operator_scan;
+ HeapTuple tup;
+ Buffer buffer;
ItemPointerData itemPointerData;
- char nulls[Natts_pg_operator];
- char replaces[Natts_pg_operator];
- Datum values[Natts_pg_operator];
- Oid other_oid = 0;
- Oid operatorObjectId;
- Oid leftTypeId = InvalidOid;
- Oid rightTypeId = InvalidOid;
- Oid commutatorId = InvalidOid;
- Oid negatorId = InvalidOid;
- bool leftDefined = false;
- bool rightDefined = false;
- char *name[4];
- Oid typeId[8];
- int nargs;
- TupleDesc tupDesc;
+ char nulls[Natts_pg_operator];
+ char replaces[Natts_pg_operator];
+ Datum values[Natts_pg_operator];
+ Oid other_oid = 0;
+ Oid operatorObjectId;
+ Oid leftTypeId = InvalidOid;
+ Oid rightTypeId = InvalidOid;
+ Oid commutatorId = InvalidOid;
+ Oid negatorId = InvalidOid;
+ bool leftDefined = false;
+ bool rightDefined = false;
+ char *name[4];
+ Oid typeId[8];
+ int nargs;
+ TupleDesc tupDesc;
static ScanKeyData opKey[3] = {
{0, Anum_pg_operator_oprname, NameEqualRegProcedure},
@@ -765,15 +765,15 @@ OperatorDef(char *operatorName,
static void
OperatorUpd(Oid baseId, Oid commId, Oid negId)
{
- register i;
- Relation pg_operator_desc;
- HeapScanDesc pg_operator_scan;
- HeapTuple tup;
- Buffer buffer;
+ register i;
+ Relation pg_operator_desc;
+ HeapScanDesc pg_operator_scan;
+ HeapTuple tup;
+ Buffer buffer;
ItemPointerData itemPointerData;
- char nulls[Natts_pg_operator];
- char replaces[Natts_pg_operator];
- Datum values[Natts_pg_operator];
+ char nulls[Natts_pg_operator];
+ char replaces[Natts_pg_operator];
+ Datum values[Natts_pg_operator];
static ScanKeyData opKey[1] = {
{0, ObjectIdAttributeNumber, ObjectIdEqualRegProcedure},
@@ -985,11 +985,11 @@ OperatorCreate(char *operatorName,
char *leftSortName,
char *rightSortName)
{
- Oid commObjectId,
- negObjectId;
- Oid leftSortObjectId,
- rightSortObjectId;
- int definedOK;
+ Oid commObjectId,
+ negObjectId;
+ Oid leftSortObjectId,
+ rightSortObjectId;
+ int definedOK;
if (!leftTypeName && !rightTypeName)
elog(WARN, "OperatorCreate : at least one of leftarg or rightarg must be defined");
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index 1dd1b0867c..e135784ca6 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.6 1997/09/07 04:40:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.7 1997/09/08 02:21:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,23 +55,23 @@ ProcedureCreate(char *procedureName,
List * argList,
CommandDest dest)
{
- register i;
- Relation rdesc;
- HeapTuple tup;
- bool defined;
- uint16 parameterCount;
- char nulls[Natts_pg_proc];
- Datum values[Natts_pg_proc];
- Oid languageObjectId;
- Oid typeObjectId;
- List *x;
- QueryTreeList *querytree_list;
- List *plan_list;
- Oid typev[8];
- Oid relid;
- Oid toid;
- text *prosrctext;
- TupleDesc tupDesc;
+ register i;
+ Relation rdesc;
+ HeapTuple tup;
+ bool defined;
+ uint16 parameterCount;
+ char nulls[Natts_pg_proc];
+ Datum values[Natts_pg_proc];
+ Oid languageObjectId;
+ Oid typeObjectId;
+ List *x;
+ QueryTreeList *querytree_list;
+ List *plan_list;
+ Oid typev[8];
+ Oid relid;
+ Oid toid;
+ text *prosrctext;
+ TupleDesc tupDesc;
/* ----------------
* sanity checks
@@ -84,7 +84,7 @@ ProcedureCreate(char *procedureName,
memset(typev, 0, 8 * sizeof(Oid));
foreach(x, argList)
{
- Value *t = lfirst(x);
+ Value *t = lfirst(x);
if (parameterCount == 8)
elog(WARN, "Procedures cannot take more than 8 arguments");
@@ -270,7 +270,7 @@ ProcedureCreate(char *procedureName,
if (RelationGetRelationTupleForm(rdesc)->relhasindex)
{
- Relation idescs[Num_pg_proc_indices];
+ Relation idescs[Num_pg_proc_indices];
CatalogOpenIndices(Num_pg_proc_indices, Name_pg_proc_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_proc_indices, rdesc, tup);
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 9a31030421..63bae1ec59 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.8 1997/09/07 04:40:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.9 1997/09/08 02:21:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,13 +44,13 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc,
* typeName -- name of type to be fetched
* defined -- has the type been defined?
*/
-static Oid
+static Oid
TypeGetWithOpenRelation(Relation pg_type_desc,
char *typeName,
bool * defined)
{
- HeapScanDesc scan;
- HeapTuple tup;
+ HeapScanDesc scan;
+ HeapTuple tup;
static ScanKeyData typeKey[1] = {
{0, Anum_pg_type_typname, NameEqualRegProcedure}
@@ -118,8 +118,8 @@ Oid
TypeGet(char *typeName, /* name of type to be fetched */
bool * defined) /* has the type been defined? */
{
- Relation pg_type_desc;
- Oid typeoid;
+ Relation pg_type_desc;
+ Oid typeoid;
/* ----------------
* open the pg_type relation
@@ -150,15 +150,15 @@ TypeGet(char *typeName, /* name of type to be fetched */
*
* ----------------------------------------------------------------
*/
-static Oid
+static Oid
TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
{
- register int i;
- HeapTuple tup;
- Datum values[Natts_pg_type];
- char nulls[Natts_pg_type];
- Oid typoid;
- TupleDesc tupDesc;
+ register int i;
+ HeapTuple tup;
+ Datum values[Natts_pg_type];
+ char nulls[Natts_pg_type];
+ Oid typoid;
+ TupleDesc tupDesc;
/* ----------------
* initialize our nulls[] and values[] arrays
@@ -214,7 +214,7 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
if (RelationGetRelationTupleForm(pg_type_desc)->relhasindex)
{
- Relation idescs[Num_pg_type_indices];
+ Relation idescs[Num_pg_type_indices];
CatalogOpenIndices(Num_pg_type_indices, Name_pg_type_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_type_indices, pg_type_desc, tup);
@@ -246,8 +246,8 @@ TypeShellMakeWithOpenRelation(Relation pg_type_desc, char *typeName)
Oid
TypeShellMake(char *typeName)
{
- Relation pg_type_desc;
- Oid typoid;
+ Relation pg_type_desc;
+ Oid typoid;
Assert(PointerIsValid(typeName));
@@ -295,27 +295,27 @@ TypeCreate(char *typeName,
bool passedByValue,
char alignment)
{
- register i,
- j;
- Relation pg_type_desc;
- HeapScanDesc pg_type_scan;
-
- Oid typeObjectId;
- Oid elementObjectId = InvalidOid;
-
- HeapTuple tup;
- char nulls[Natts_pg_type];
- char replaces[Natts_pg_type];
- Datum values[Natts_pg_type];
-
- Buffer buffer;
- char *procname;
- char *procs[4];
- bool defined;
+ register i,
+ j;
+ Relation pg_type_desc;
+ HeapScanDesc pg_type_scan;
+
+ Oid typeObjectId;
+ Oid elementObjectId = InvalidOid;
+
+ HeapTuple tup;
+ char nulls[Natts_pg_type];
+ char replaces[Natts_pg_type];
+ Datum values[Natts_pg_type];
+
+ Buffer buffer;
+ char *procname;
+ char *procs[4];
+ bool defined;
ItemPointerData itemPointerData;
- TupleDesc tupDesc;
+ TupleDesc tupDesc;
- Oid argList[8];
+ Oid argList[8];
static ScanKeyData typeKey[1] = {
@@ -522,7 +522,7 @@ TypeCreate(char *typeName,
if (RelationGetRelationTupleForm(pg_type_desc)->relhasindex)
{
- Relation idescs[Num_pg_type_indices];
+ Relation idescs[Num_pg_type_indices];
CatalogOpenIndices(Num_pg_type_indices, Name_pg_type_indices, idescs);
CatalogIndexInsert(idescs, Num_pg_type_indices, pg_type_desc, tup);
@@ -545,11 +545,11 @@ TypeCreate(char *typeName,
void
TypeRename(char *oldTypeName, char *newTypeName)
{
- Relation pg_type_desc;
- Relation idescs[Num_pg_type_indices];
- Oid type_oid;
- HeapTuple tup;
- bool defined;
+ Relation pg_type_desc;
+ Relation idescs[Num_pg_type_indices];
+ Oid type_oid;
+ HeapTuple tup;
+ bool defined;
ItemPointerData itemPointerData;
/* check that that the new type is not already defined */
@@ -603,10 +603,10 @@ TypeRename(char *oldTypeName, char *newTypeName)
* the CALLER is responsible for pfreeing the
*/
-char *
+char *
makeArrayTypeName(char *typeName)
{
- char *arr;
+ char *arr;
if (!typeName)
return NULL;
diff --git a/src/backend/commands/_deadcode/version.c b/src/backend/commands/_deadcode/version.c
index c3eb6f4779..0059405767 100644
--- a/src/backend/commands/_deadcode/version.c
+++ b/src/backend/commands/_deadcode/version.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.6 1997/09/07 04:41:04 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/version.c,v 1.7 1997/09/08 02:22:18 momjian Exp $
*
* NOTES
* At the point the version is defined, 2 physical relations are created
@@ -34,10 +34,10 @@
#define MAX_QUERY_LEN 1024
-char rule_buf[MAX_QUERY_LEN];
+char rule_buf[MAX_QUERY_LEN];
#ifdef NOT_USED
-static char attr_list[MAX_QUERY_LEN];
+static char attr_list[MAX_QUERY_LEN];
#endif
@@ -105,9 +105,9 @@ eval_as_new_xact(char *query)
void
DefineVersion(char *name, char *fromRelname, char *date)
{
- char *bname;
- static char saved_basename[512];
- static char saved_snapshot[512];
+ char *bname;
+ static char saved_basename[512];
+ static char saved_snapshot[512];
if (date == NULL)
{
@@ -148,7 +148,7 @@ DefineVersion(char *name, char *fromRelname, char *date)
void
VersionCreate(char *vname, char *bname)
{
- static char query_buf[MAX_QUERY_LEN];
+ static char query_buf[MAX_QUERY_LEN];
/*
* Creating the dummy version relation for triggering rules.
@@ -184,12 +184,12 @@ VersionCreate(char *vname, char *bname)
static void
setAttrList(char *bname)
{
- Relation rdesc;
- int i = 0;
- int maxattrs = 0;
- char *attrname;
- char temp_buf[512];
- int notfirst = 0;
+ Relation rdesc;
+ int i = 0;
+ int maxattrs = 0;
+ char *attrname;
+ char temp_buf[512];
+ int notfirst = 0;
rdesc = heap_openr(bname);
if (rdesc == NULL)
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 42d440a867..ee5b9baf55 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.18 1997/09/07 04:40:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.19 1997/09/08 02:21:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -86,16 +86,16 @@
#include <storage/lmgr.h>
-static int notifyFrontEndPending = 0;
-static int notifyIssued = 0;
-static Dllist *pendingNotifies = NULL;
+static int notifyFrontEndPending = 0;
+static int notifyIssued = 0;
+static Dllist *pendingNotifies = NULL;
-static int AsyncExistsPendingNotify(char *);
-static void ClearPendingNotify(void);
-static void Async_NotifyFrontEnd(void);
-static void Async_Unlisten(char *relname, int pid);
-static void Async_UnlistenOnExit(int code, char *relname);
+static int AsyncExistsPendingNotify(char *);
+static void ClearPendingNotify(void);
+static void Async_NotifyFrontEnd(void);
+static void Async_Unlisten(char *relname, int pid);
+static void Async_UnlistenOnExit(int code, char *relname);
/*
*--------------------------------------------------------------
@@ -169,20 +169,20 @@ void
Async_Notify(char *relname)
{
- HeapTuple lTuple,
- rTuple;
- Relation lRel;
- HeapScanDesc sRel;
- TupleDesc tdesc;
- ScanKeyData key;
- Buffer b;
- Datum d,
- value[3];
- bool isnull;
- char repl[3],
- nulls[3];
-
- char *notifyName;
+ HeapTuple lTuple,
+ rTuple;
+ Relation lRel;
+ HeapScanDesc sRel;
+ TupleDesc tdesc;
+ ScanKeyData key;
+ Buffer b;
+ Datum d,
+ value[3];
+ bool isnull;
+ char repl[3],
+ nulls[3];
+
+ char *notifyName;
#ifdef ASYNC_DEBUG
elog(DEBUG, "Async_Notify: %s", relname);
@@ -256,15 +256,15 @@ Async_Notify(char *relname)
void
Async_NotifyAtCommit()
{
- HeapTuple lTuple;
- Relation lRel;
- HeapScanDesc sRel;
- TupleDesc tdesc;
- ScanKeyData key;
- Datum d;
- int ourpid;
- bool isnull;
- Buffer b;
+ HeapTuple lTuple;
+ Relation lRel;
+ HeapScanDesc sRel;
+ TupleDesc tdesc;
+ ScanKeyData key;
+ Datum d;
+ int ourpid;
+ bool isnull;
+ Buffer b;
extern TransactionState CurrentTransactionState;
if (!pendingNotifies)
@@ -406,21 +406,21 @@ Async_NotifyAtAbort()
void
Async_Listen(char *relname, int pid)
{
- Datum values[Natts_pg_listener];
- char nulls[Natts_pg_listener];
- TupleDesc tdesc;
- HeapScanDesc s;
- HeapTuple htup,
- tup;
- Relation lDesc;
- Buffer b;
- Datum d;
- int i;
- bool isnull;
- int alreadyListener = 0;
- int ourPid = getpid();
- char *relnamei;
- TupleDesc tupDesc;
+ Datum values[Natts_pg_listener];
+ char nulls[Natts_pg_listener];
+ TupleDesc tdesc;
+ HeapScanDesc s;
+ HeapTuple htup,
+ tup;
+ Relation lDesc;
+ Buffer b;
+ Datum d;
+ int i;
+ bool isnull;
+ int alreadyListener = 0;
+ int ourPid = getpid();
+ char *relnamei;
+ TupleDesc tupDesc;
#ifdef ASYNC_DEBUG
elog(DEBUG, "Async_Listen: %s", relname);
@@ -513,8 +513,8 @@ Async_Listen(char *relname, int pid)
static void
Async_Unlisten(char *relname, int pid)
{
- Relation lDesc;
- HeapTuple lTuple;
+ Relation lDesc;
+ HeapTuple lTuple;
lTuple = SearchSysCacheTuple(LISTENREL, PointerGetDatum(relname),
Int32GetDatum(pid),
@@ -560,25 +560,25 @@ Async_UnlistenOnExit(int code, /* from exitpg */
*
* --------------------------------------------------------------
*/
-GlobalMemory notifyContext = NULL;
+GlobalMemory notifyContext = NULL;
static void
Async_NotifyFrontEnd()
{
extern CommandDest whereToSendOutput;
- HeapTuple lTuple,
- rTuple;
- Relation lRel;
- HeapScanDesc sRel;
- TupleDesc tdesc;
- ScanKeyData key[2];
- Datum d,
- value[3];
- char repl[3],
- nulls[3];
- Buffer b;
- int ourpid;
- bool isnull;
+ HeapTuple lTuple,
+ rTuple;
+ Relation lRel;
+ HeapScanDesc sRel;
+ TupleDesc tdesc;
+ ScanKeyData key[2];
+ Datum d,
+ value[3];
+ char repl[3],
+ nulls[3];
+ Buffer b;
+ int ourpid;
+ bool isnull;
notifyFrontEndPending = 0;
@@ -635,7 +635,7 @@ Async_NotifyFrontEnd()
static int
AsyncExistsPendingNotify(char *relname)
{
- Dlelem *p;
+ Dlelem *p;
for (p = DLGetHead(pendingNotifies);
p != NULL;
@@ -652,7 +652,7 @@ AsyncExistsPendingNotify(char *relname)
static void
ClearPendingNotify()
{
- Dlelem *p;
+ Dlelem *p;
while ((p = DLRemHead(pendingNotifies)) != NULL)
free(DLE_VAL(p));
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 2b18cb46df..9e93388f72 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.14 1997/09/07 04:40:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.15 1997/09/08 02:21:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,8 +50,8 @@
#endif /* !NO_SECURITY */
static Relation copy_heap(Oid OIDOldHeap);
-static void copy_index(Oid OIDOldIndex, Oid OIDNewHeap);
-static void rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex);
+static void copy_index(Oid OIDOldIndex, Oid OIDNewHeap);
+static void rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex);
/*
* cluster
@@ -82,18 +82,18 @@ static void rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex);
void
cluster(char oldrelname[], char oldindexname[])
{
- Oid OIDOldHeap,
- OIDOldIndex,
- OIDNewHeap;
+ Oid OIDOldHeap,
+ OIDOldIndex,
+ OIDNewHeap;
- Relation OldHeap,
- OldIndex;
- Relation NewHeap;
+ Relation OldHeap,
+ OldIndex;
+ Relation NewHeap;
- char NewIndexName[NAMEDATALEN];
- char NewHeapName[NAMEDATALEN];
- char saveoldrelname[NAMEDATALEN];
- char saveoldindexname[NAMEDATALEN];
+ char NewIndexName[NAMEDATALEN];
+ char NewHeapName[NAMEDATALEN];
+ char saveoldrelname[NAMEDATALEN];
+ char saveoldindexname[NAMEDATALEN];
/*
@@ -189,15 +189,15 @@ cluster(char oldrelname[], char oldindexname[])
StartTransactionCommand();
}
-static Relation
+static Relation
copy_heap(Oid OIDOldHeap)
{
- char NewName[NAMEDATALEN];
- TupleDesc OldHeapDesc,
- tupdesc;
- Oid OIDNewHeap;
- Relation NewHeap,
- OldHeap;
+ char NewName[NAMEDATALEN];
+ TupleDesc OldHeapDesc,
+ tupdesc;
+ Oid OIDNewHeap;
+ Relation NewHeap,
+ OldHeap;
/*
* Create a new heap relation with a temporary name, which has the
@@ -235,18 +235,18 @@ copy_heap(Oid OIDOldHeap)
static void
copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
{
- Relation OldIndex,
- NewHeap;
- HeapTuple Old_pg_index_Tuple,
- Old_pg_index_relation_Tuple,
- pg_proc_Tuple;
- IndexTupleForm Old_pg_index_Form;
- Form_pg_class Old_pg_index_relation_Form;
- Form_pg_proc pg_proc_Form;
- char *NewIndexName;
- AttrNumber *attnumP;
- int natts;
- FuncIndexInfo *finfo;
+ Relation OldIndex,
+ NewHeap;
+ HeapTuple Old_pg_index_Tuple,
+ Old_pg_index_relation_Tuple,
+ pg_proc_Tuple;
+ IndexTupleForm Old_pg_index_Form;
+ Form_pg_class Old_pg_index_relation_Form;
+ Form_pg_proc pg_proc_Form;
+ char *NewIndexName;
+ AttrNumber *attnumP;
+ int natts;
+ FuncIndexInfo *finfo;
NewHeap = heap_open(OIDNewHeap);
OldIndex = index_open(OIDOldIndex);
@@ -330,15 +330,15 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
static void
rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
{
- Relation LocalNewHeap,
- LocalOldHeap,
- LocalOldIndex;
- IndexScanDesc ScanDesc;
+ Relation LocalNewHeap,
+ LocalOldHeap,
+ LocalOldIndex;
+ IndexScanDesc ScanDesc;
RetrieveIndexResult ScanResult;
- ItemPointer HeapTid;
- HeapTuple LocalHeapTuple;
- Buffer LocalBuffer;
- Oid OIDNewHeapInsert;
+ ItemPointer HeapTid;
+ HeapTuple LocalHeapTuple;
+ Buffer LocalBuffer;
+ Oid OIDNewHeapInsert;
/*
* Open the relations I need. Scan through the OldHeap on the OldIndex
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index 7af9b37c07..0e409396ac 100644
--- a/src/backend/commands/command.c
+++ b/src/backend/commands/command.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.14 1997/09/07 04:40:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.15 1997/09/08 02:22:01 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
@@ -46,7 +46,7 @@
* This is where the XXXSuperDuperHacky code was. -cim 3/15/90
* ----------------
*/
-MemoryContext PortalExecutorHeapMemory = NULL;
+MemoryContext PortalExecutorHeapMemory = NULL;
/* --------------------------------
* PortalCleanup
@@ -55,7 +55,7 @@ MemoryContext PortalExecutorHeapMemory = NULL;
void
PortalCleanup(Portal portal)
{
- MemoryContext context;
+ MemoryContext context;
/* ----------------
* sanity checks
@@ -97,10 +97,10 @@ PerformPortalFetch(char *name,
char *tag,
CommandDest dest)
{
- Portal portal;
- int feature;
- QueryDesc *queryDesc;
- MemoryContext context;
+ Portal portal;
+ int feature;
+ QueryDesc *queryDesc;
+ MemoryContext context;
/* ----------------
* sanity checks
@@ -151,7 +151,7 @@ PerformPortalFetch(char *name,
BeginCommand(name,
queryDesc->operation,
portal->attinfo, /* QueryDescGetTypeInfo(queryDesc),
- * */
+ * */
false, /* portal fetches don't end up in
* relations */
false, /* this is a portal fetch, not a "retrieve
@@ -190,7 +190,7 @@ PerformPortalFetch(char *name,
void
PerformPortalClose(char *name, CommandDest dest)
{
- Portal portal;
+ Portal portal;
/* ----------------
* sanity checks
@@ -257,22 +257,22 @@ PerformAddAttribute(char *relationName,
bool inherits,
ColumnDef * colDef)
{
- Relation relrdesc,
- attrdesc;
- HeapScanDesc attsdesc;
- HeapTuple reltup;
- HeapTuple attributeTuple;
+ Relation relrdesc,
+ attrdesc;
+ HeapScanDesc attsdesc;
+ HeapTuple reltup;
+ HeapTuple attributeTuple;
AttributeTupleForm attribute;
FormData_pg_attribute attributeD;
- int i;
- int minattnum,
- maxatts;
- HeapTuple tup;
- ScanKeyData key[2];
+ int i;
+ int minattnum,
+ maxatts;
+ HeapTuple tup;
+ ScanKeyData key[2];
ItemPointerData oldTID;
- Relation idescs[Num_pg_attr_indices];
- Relation ridescs[Num_pg_class_indices];
- bool hasindex;
+ Relation idescs[Num_pg_attr_indices];
+ Relation ridescs[Num_pg_class_indices];
+ bool hasindex;
/*
* permissions checking. this would normally be done in utility.c,
@@ -310,10 +310,10 @@ PerformAddAttribute(char *relationName,
{
if (inherits)
{
- Oid myrelid,
- childrelid;
- List *child,
- *children;
+ Oid myrelid,
+ childrelid;
+ List *child,
+ *children;
relrdesc = heap_openr(relationName);
if (!RelationIsValid(relrdesc))
@@ -418,10 +418,10 @@ PerformAddAttribute(char *relationName,
i = 1 + minattnum;
{
- HeapTuple typeTuple;
- TypeTupleForm form;
- char *p;
- int attnelems;
+ HeapTuple typeTuple;
+ TypeTupleForm form;
+ char *p;
+ int attnelems;
/*
* XXX use syscache here as an optimization
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 795e9f5584..d1e1db0cd4 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.30 1997/09/07 04:40:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.31 1997/09/08 02:22:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,33 +42,33 @@
/* non-export function prototypes */
-static void CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim);
-static void CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim);
-static Oid GetOutputFunction(Oid type);
-static Oid GetTypeElement(Oid type);
-static Oid GetInputFunction(Oid type);
-static Oid IsTypeByVal(Oid type);
+static void CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim);
+static void CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim);
+static Oid GetOutputFunction(Oid type);
+static Oid GetTypeElement(Oid type);
+static Oid GetInputFunction(Oid type);
+static Oid IsTypeByVal(Oid type);
static void
GetIndexRelations(Oid main_relation_oid,
int *n_indices,
Relation ** index_rels);
#ifdef COPY_PATCH
-static void CopyReadNewline(FILE * fp, int *newline);
-static char *CopyReadAttribute(FILE * fp, bool * isnull, char *delim, int *newline);
+static void CopyReadNewline(FILE * fp, int *newline);
+static char *CopyReadAttribute(FILE * fp, bool * isnull, char *delim, int *newline);
#else
-static char *CopyReadAttribute(FILE * fp, bool * isnull, char *delim);
+static char *CopyReadAttribute(FILE * fp, bool * isnull, char *delim);
#endif
-static void CopyAttributeOut(FILE * fp, char *string, char *delim);
-static int CountTuples(Relation relation);
+static void CopyAttributeOut(FILE * fp, char *string, char *delim);
+static int CountTuples(Relation relation);
-extern FILE *Pfout,
- *Pfin;
+extern FILE *Pfout,
+ *Pfin;
#ifdef COPY_DEBUG
-static int lineno;
+static int lineno;
#endif
@@ -107,11 +107,11 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
the class.
----------------------------------------------------------------------------*/
- FILE *fp;
- Relation rel;
- extern char *UserName; /* defined in global.c */
- const AclMode required_access = from ? ACL_WR : ACL_RD;
- int result;
+ FILE *fp;
+ Relation rel;
+ extern char *UserName; /* defined in global.c */
+ const AclMode required_access = from ? ACL_WR : ACL_RD;
+ int result;
rel = heap_openr(relname);
if (rel == NULL)
@@ -169,7 +169,7 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
}
else
{
- mode_t oumask; /* Pre-existing umask value */
+ mode_t oumask; /* Pre-existing umask value */
oumask = umask((mode_t) 0);
fp = AllocateFile(filename, "w");
@@ -199,19 +199,19 @@ DoCopy(char *relname, bool binary, bool oids, bool from, bool pipe,
static void
CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
{
- HeapTuple tuple;
- HeapScanDesc scandesc;
+ HeapTuple tuple;
+ HeapScanDesc scandesc;
- int32 attr_count,
- i;
+ int32 attr_count,
+ i;
AttributeTupleForm *attr;
- func_ptr *out_functions;
- int dummy;
- Oid out_func_oid;
- Oid *elements;
- Datum value;
- bool isnull; /* The attribute we are copying is null */
- char *nulls;
+ func_ptr *out_functions;
+ int dummy;
+ Oid out_func_oid;
+ Oid *elements;
+ Datum value;
+ bool isnull; /* The attribute we are copying is null */
+ char *nulls;
/*
* <nulls> is a (dynamically allocated) array with one character per
@@ -220,9 +220,9 @@ CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
*
* <nulls> is meaningful only if we are doing a binary copy.
*/
- char *string;
- int32 ntuples;
- TupleDesc tupDesc;
+ char *string;
+ int32 ntuples;
+ TupleDesc tupDesc;
scandesc = heap_beginscan(rel, 0, NULL, 0, NULL);
@@ -311,8 +311,8 @@ CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
if (binary)
{
- int32 null_ct = 0,
- length;
+ int32 null_ct = 0,
+ length;
for (i = 0; i < attr_count; i++)
{
@@ -358,54 +358,54 @@ CopyTo(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
static void
CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
{
- HeapTuple tuple;
- AttrNumber attr_count;
+ HeapTuple tuple;
+ AttrNumber attr_count;
AttributeTupleForm *attr;
- func_ptr *in_functions;
- int i,
- dummy;
- Oid in_func_oid;
- Datum *values;
- char *nulls,
- *index_nulls;
- bool *byval;
- bool isnull;
- bool has_index;
- int done = 0;
- char *string = NULL,
- *ptr;
- Relation *index_rels;
- int32 len,
- null_ct,
- null_id;
- int32 ntuples,
- tuples_read = 0;
- bool reading_to_eof = true;
- Oid *elements;
- FuncIndexInfo *finfo,
- **finfoP = NULL;
- TupleDesc *itupdescArr;
- HeapTuple pgIndexTup;
+ func_ptr *in_functions;
+ int i,
+ dummy;
+ Oid in_func_oid;
+ Datum *values;
+ char *nulls,
+ *index_nulls;
+ bool *byval;
+ bool isnull;
+ bool has_index;
+ int done = 0;
+ char *string = NULL,
+ *ptr;
+ Relation *index_rels;
+ int32 len,
+ null_ct,
+ null_id;
+ int32 ntuples,
+ tuples_read = 0;
+ bool reading_to_eof = true;
+ Oid *elements;
+ FuncIndexInfo *finfo,
+ **finfoP = NULL;
+ TupleDesc *itupdescArr;
+ HeapTuple pgIndexTup;
IndexTupleForm *pgIndexP = NULL;
- int *indexNatts = NULL;
- char *predString;
- Node **indexPred = NULL;
- TupleDesc rtupdesc;
- ExprContext *econtext = NULL;
+ int *indexNatts = NULL;
+ char *predString;
+ Node **indexPred = NULL;
+ TupleDesc rtupdesc;
+ ExprContext *econtext = NULL;
#ifndef OMIT_PARTIAL_INDEX
- TupleTable tupleTable;
+ TupleTable tupleTable;
TupleTableSlot *slot = NULL;
#endif
- int natts;
- AttrNumber *attnumP;
- Datum *idatum;
- int n_indices;
+ int natts;
+ AttrNumber *attnumP;
+ Datum *idatum;
+ int n_indices;
InsertIndexResult indexRes;
- TupleDesc tupDesc;
- Oid loaded_oid;
- bool skip_tuple = false;
+ TupleDesc tupDesc;
+ Oid loaded_oid;
+ bool skip_tuple = false;
tupDesc = RelationGetTupleDescriptor(rel);
attr = tupDesc->attrs;
@@ -541,7 +541,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
if (!binary)
{
#ifdef COPY_PATCH
- int newline = 0;
+ int newline = 0;
#endif
#ifdef COPY_DEBUG
@@ -647,58 +647,58 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
switch (attr[i]->attlen)
{
- case sizeof(char):
- values[i] = (Datum) * (unsigned char *) ptr;
- ptr += sizeof(char);
- break;
- case sizeof(short):
- ptr = (char *) SHORTALIGN(ptr);
- values[i] = (Datum) * (unsigned short *) ptr;
- ptr += sizeof(short);
- break;
- case sizeof(int32):
- ptr = (char *) INTALIGN(ptr);
- values[i] = (Datum) * (uint32 *) ptr;
- ptr += sizeof(int32);
- break;
- default:
- elog(WARN, "COPY BINARY: impossible size!");
- break;
+ case sizeof(char):
+ values[i] = (Datum) * (unsigned char *) ptr;
+ ptr += sizeof(char);
+ break;
+ case sizeof(short):
+ ptr = (char *) SHORTALIGN(ptr);
+ values[i] = (Datum) * (unsigned short *) ptr;
+ ptr += sizeof(short);
+ break;
+ case sizeof(int32):
+ ptr = (char *) INTALIGN(ptr);
+ values[i] = (Datum) * (uint32 *) ptr;
+ ptr += sizeof(int32);
+ break;
+ default:
+ elog(WARN, "COPY BINARY: impossible size!");
+ break;
}
}
else if (nulls[i] != 'n')
{
switch (attr[i]->attlen)
{
- case -1:
- if (attr[i]->attalign == 'd')
- ptr = (char *) DOUBLEALIGN(ptr);
- else
+ case -1:
+ if (attr[i]->attalign == 'd')
+ ptr = (char *) DOUBLEALIGN(ptr);
+ else
+ ptr = (char *) INTALIGN(ptr);
+ values[i] = (Datum) ptr;
+ ptr += *(uint32 *) ptr;
+ break;
+ case sizeof(char):
+ values[i] = (Datum) ptr;
+ ptr += attr[i]->attlen;
+ break;
+ case sizeof(short):
+ ptr = (char *) SHORTALIGN(ptr);
+ values[i] = (Datum) ptr;
+ ptr += attr[i]->attlen;
+ break;
+ case sizeof(int32):
ptr = (char *) INTALIGN(ptr);
- values[i] = (Datum) ptr;
- ptr += *(uint32 *) ptr;
- break;
- case sizeof(char):
- values[i] = (Datum) ptr;
- ptr += attr[i]->attlen;
- break;
- case sizeof(short):
- ptr = (char *) SHORTALIGN(ptr);
- values[i] = (Datum) ptr;
- ptr += attr[i]->attlen;
- break;
- case sizeof(int32):
- ptr = (char *) INTALIGN(ptr);
- values[i] = (Datum) ptr;
- ptr += attr[i]->attlen;
- break;
- default:
- if (attr[i]->attalign == 'd')
- ptr = (char *) DOUBLEALIGN(ptr);
- else
- ptr = (char *) LONGALIGN(ptr);
- values[i] = (Datum) ptr;
- ptr += attr[i]->attlen;
+ values[i] = (Datum) ptr;
+ ptr += attr[i]->attlen;
+ break;
+ default:
+ if (attr[i]->attalign == 'd')
+ ptr = (char *) DOUBLEALIGN(ptr);
+ else
+ ptr = (char *) LONGALIGN(ptr);
+ values[i] = (Datum) ptr;
+ ptr += attr[i]->attlen;
}
}
}
@@ -721,7 +721,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
if (rel->trigdesc &&
rel->trigdesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecBRInsertTriggers(rel, tuple);
@@ -743,7 +743,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
if (rel->rd_att->constr)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecConstraints("CopyFrom", rel, tuple);
@@ -826,10 +826,10 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE * fp, char *delim)
-static Oid
+static Oid
GetOutputFunction(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -842,10 +842,10 @@ GetOutputFunction(Oid type)
return (InvalidOid);
}
-static Oid
+static Oid
GetTypeElement(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -859,10 +859,10 @@ GetTypeElement(Oid type)
return (InvalidOid);
}
-static Oid
+static Oid
GetInputFunction(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -875,10 +875,10 @@ GetInputFunction(Oid type)
return (InvalidOid);
}
-static Oid
+static Oid
IsTypeByVal(Oid type)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type),
@@ -902,24 +902,24 @@ IsTypeByVal(Oid type)
typedef struct rel_list
{
- Oid index_rel_oid;
+ Oid index_rel_oid;
struct rel_list *next;
-} RelationList;
+} RelationList;
static void
GetIndexRelations(Oid main_relation_oid,
int *n_indices,
Relation ** index_rels)
{
- RelationList *head,
- *scan;
- Relation pg_index_rel;
- HeapScanDesc scandesc;
- Oid index_relation_oid;
- HeapTuple tuple;
- TupleDesc tupDesc;
- int i;
- bool isnull;
+ RelationList *head,
+ *scan;
+ Relation pg_index_rel;
+ HeapScanDesc scandesc;
+ Oid index_relation_oid;
+ HeapTuple tuple;
+ TupleDesc tupDesc;
+ int i;
+ bool isnull;
pg_index_rel = heap_openr(IndexRelationName);
scandesc = heap_beginscan(pg_index_rel, 0, NULL, 0, NULL);
@@ -978,10 +978,10 @@ GetIndexRelations(Oid main_relation_oid,
/*
returns 1 is c is in s
*/
-static bool
+static bool
inString(char c, char *s)
{
- int i;
+ int i;
if (s)
{
@@ -1026,17 +1026,17 @@ CopyReadNewline(FILE * fp, int *newline)
* can be used as standard input.
*/
-static char *
+static char *
#ifdef COPY_PATCH
CopyReadAttribute(FILE * fp, bool * isnull, char *delim, int *newline)
#else
CopyReadAttribute(FILE * fp, bool * isnull, char *delim)
#endif
{
- static char attribute[EXT_ATTLEN];
- char c;
- int done = 0;
- int i = 0;
+ static char attribute[EXT_ATTLEN];
+ char c;
+ int done = 0;
+ int i = 0;
#ifdef COPY_PATCH
/* if last delimiter was a newline return a NULL attribute */
@@ -1064,26 +1064,33 @@ CopyReadAttribute(FILE * fp, bool * isnull, char *delim)
return (NULL);
switch (c)
{
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- int val;
-
- val = VALUE(c);
- c = getc(fp);
- if (ISOCTAL(c))
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
{
- val = (val << 3) + VALUE(c);
+ int val;
+
+ val = VALUE(c);
c = getc(fp);
if (ISOCTAL(c))
{
val = (val << 3) + VALUE(c);
+ c = getc(fp);
+ if (ISOCTAL(c))
+ {
+ val = (val << 3) + VALUE(c);
+ }
+ else
+ {
+ if (feof(fp))
+ return (NULL);
+ ungetc(c, fp);
+ }
}
else
{
@@ -1091,44 +1098,37 @@ CopyReadAttribute(FILE * fp, bool * isnull, char *delim)
return (NULL);
ungetc(c, fp);
}
+ c = val & 0377;
}
- else
- {
- if (feof(fp))
- return (NULL);
- ungetc(c, fp);
- }
- c = val & 0377;
- }
- break;
- case 'b':
- c = '\b';
- break;
- case 'f':
- c = '\f';
- break;
- case 'n':
- c = '\n';
- break;
- case 'r':
- c = '\r';
- break;
- case 't':
- c = '\t';
- break;
- case 'v':
- c = '\v';
- break;
- case 'N':
- attribute[0] = '\0'; /* just to be safe */
- *isnull = (bool) true;
- break;
- case '.':
- c = getc(fp);
- if (c != '\n')
- elog(WARN, "CopyReadAttribute - end of record marker corrupted");
- return (NULL);
- break;
+ break;
+ case 'b':
+ c = '\b';
+ break;
+ case 'f':
+ c = '\f';
+ break;
+ case 'n':
+ c = '\n';
+ break;
+ case 'r':
+ c = '\r';
+ break;
+ case 't':
+ c = '\t';
+ break;
+ case 'v':
+ c = '\v';
+ break;
+ case 'N':
+ attribute[0] = '\0'; /* just to be safe */
+ *isnull = (bool) true;
+ break;
+ case '.':
+ c = getc(fp);
+ if (c != '\n')
+ elog(WARN, "CopyReadAttribute - end of record marker corrupted");
+ return (NULL);
+ break;
}
}
else if (inString(c, delim) || c == '\n')
@@ -1153,9 +1153,9 @@ CopyReadAttribute(FILE * fp, bool * isnull, char *delim)
static void
CopyAttributeOut(FILE * fp, char *string, char *delim)
{
- char c;
- int is_array = false;
- int len = strlen(string);
+ char c;
+ int is_array = false;
+ int len = strlen(string);
/* XXX - This is a kludge, we should check the data type */
if (len && (string[0] == '{') && (string[len - 1] == '}'))
@@ -1194,10 +1194,10 @@ CopyAttributeOut(FILE * fp, char *string, char *delim)
static int
CountTuples(Relation relation)
{
- HeapScanDesc scandesc;
- HeapTuple tuple;
+ HeapScanDesc scandesc;
+ HeapTuple tuple;
- int i;
+ int i;
scandesc = heap_beginscan(relation, 0, NULL, 0, NULL);
diff --git a/src/backend/commands/creatinh.c b/src/backend/commands/creatinh.c
index 92641ca70d..e1dac613fe 100644
--- a/src/backend/commands/creatinh.c
+++ b/src/backend/commands/creatinh.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.15 1997/09/07 04:40:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.16 1997/09/08 02:22:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,8 +36,8 @@
static int
checkAttrExists(char *attributeName,
char *attributeType, List * schema);
-static List *MergeAttributes(List * schema, List * supers, List ** supconstr);
-static void StoreCatalogInheritance(Oid relationId, List * supers);
+static List *MergeAttributes(List * schema, List * supers, List ** supconstr);
+static void StoreCatalogInheritance(Oid relationId, List * supers);
/* ----------------------------------------------------------------
* DefineRelation --
@@ -47,20 +47,20 @@ static void StoreCatalogInheritance(Oid relationId, List * supers);
void
DefineRelation(CreateStmt * stmt)
{
- char *relname = palloc(NAMEDATALEN);
- List *schema = stmt->tableElts;
- int numberOfAttributes;
- Oid relationId;
- char archChar;
- List *inheritList = NULL;
- char *archiveName = NULL;
- TupleDesc descriptor;
- List *constraints;
- int heaploc,
- archloc;
-
- char *typename = NULL; /* the typename of this relation.
- * not useod for now */
+ char *relname = palloc(NAMEDATALEN);
+ List *schema = stmt->tableElts;
+ int numberOfAttributes;
+ Oid relationId;
+ char archChar;
+ List *inheritList = NULL;
+ char *archiveName = NULL;
+ TupleDesc descriptor;
+ List *constraints;
+ int heaploc,
+ archloc;
+
+ char *typename = NULL;/* the typename of this relation. not
+ * useod for now */
if (strlen(stmt->relname) >= NAMEDATALEN)
elog(WARN, "the relation name %s is >= %d characters long", stmt->relname,
@@ -84,19 +84,19 @@ DefineRelation(CreateStmt * stmt)
switch (stmt->archiveType)
{
- case ARCH_NONE:
- archChar = 'n';
- break;
- case ARCH_LIGHT:
- archChar = 'l';
- break;
- case ARCH_HEAVY:
- archChar = 'h';
- break;
- default:
- elog(WARN, "Botched archive mode %d, ignoring",
- stmt->archiveType);
- break;
+ case ARCH_NONE:
+ archChar = 'n';
+ break;
+ case ARCH_LIGHT:
+ archChar = 'l';
+ break;
+ case ARCH_HEAVY:
+ archChar = 'h';
+ break;
+ default:
+ elog(WARN, "Botched archive mode %d, ignoring",
+ stmt->archiveType);
+ break;
}
if (stmt->location == -1)
@@ -145,15 +145,15 @@ DefineRelation(CreateStmt * stmt)
if (constraints != NIL)
{
- List *entry;
- int nconstr = length(constraints);
- ConstrCheck *check = (ConstrCheck *) palloc(nconstr * sizeof(ConstrCheck));
- int ncheck = 0;
- int i;
+ List *entry;
+ int nconstr = length(constraints);
+ ConstrCheck *check = (ConstrCheck *) palloc(nconstr * sizeof(ConstrCheck));
+ int ncheck = 0;
+ int i;
foreach(entry, constraints)
{
- ConstraintDef *cdef = (ConstraintDef *) lfirst(entry);
+ ConstraintDef *cdef = (ConstraintDef *) lfirst(entry);
if (cdef->type == CONSTR_CHECK)
{
@@ -204,7 +204,7 @@ DefineRelation(CreateStmt * stmt)
*/
if (archChar != 'n')
{
- TupleDesc tupdesc;
+ TupleDesc tupdesc;
/*
* Need to create an archive relation for this heap relation. We
@@ -279,12 +279,12 @@ RemoveRelation(char *name)
* \ /
* stud_emp {7:percent}
*/
-static List *
+static List *
MergeAttributes(List * schema, List * supers, List ** supconstr)
{
- List *entry;
- List *inhSchema = NIL;
- List *constraints = NIL;
+ List *entry;
+ List *inhSchema = NIL;
+ List *constraints = NIL;
/*
* Validates that there are no duplications. Validity checking of
@@ -292,8 +292,8 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
*/
foreach(entry, schema)
{
- List *rest;
- ColumnDef *coldef = lfirst(entry);
+ List *rest;
+ ColumnDef *coldef = lfirst(entry);
foreach(rest, lnext(entry))
{
@@ -301,7 +301,7 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
/*
* check for duplicated relation names
*/
- ColumnDef *restdef = lfirst(rest);
+ ColumnDef *restdef = lfirst(rest);
if (!strcmp(coldef->colname, restdef->colname))
{
@@ -312,7 +312,7 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
}
foreach(entry, supers)
{
- List *rest;
+ List *rest;
foreach(rest, lnext(entry))
{
@@ -329,12 +329,12 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
*/
foreach(entry, supers)
{
- char *name = strVal(lfirst(entry));
- Relation relation;
- List *partialResult = NIL;
- AttrNumber attrno;
- TupleDesc tupleDesc;
- TupleConstr *constr;
+ char *name = strVal(lfirst(entry));
+ Relation relation;
+ List *partialResult = NIL;
+ AttrNumber attrno;
+ TupleDesc tupleDesc;
+ TupleConstr *constr;
relation = heap_openr(name);
if (relation == NULL)
@@ -354,11 +354,11 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
for (attrno = relation->rd_rel->relnatts - 1; attrno >= 0; attrno--)
{
AttributeTupleForm attribute = tupleDesc->attrs[attrno];
- char *attributeName;
- char *attributeType;
- HeapTuple tuple;
- ColumnDef *def;
- TypeName *typename;
+ char *attributeName;
+ char *attributeType;
+ HeapTuple tuple;
+ ColumnDef *def;
+ TypeName *typename;
/*
* form name, type and constraints
@@ -398,8 +398,8 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
def->defval = NULL;
if (attribute->atthasdef)
{
- AttrDefault *attrdef = constr->defval;
- int i;
+ AttrDefault *attrdef = constr->defval;
+ int i;
Assert(constr != NULL && constr->num_defval > 0);
@@ -417,12 +417,12 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
if (constr && constr->num_check > 0)
{
- ConstrCheck *check = constr->check;
- int i;
+ ConstrCheck *check = constr->check;
+ int i;
for (i = 0; i < constr->num_check; i++)
{
- ConstraintDef *cdef = (ConstraintDef *) palloc(sizeof(ConstraintDef));
+ ConstraintDef *cdef = (ConstraintDef *) palloc(sizeof(ConstraintDef));
cdef->type = CONSTR_CHECK;
if (check[i].ccname[0] == '$')
@@ -461,12 +461,12 @@ MergeAttributes(List * schema, List * supers, List ** supconstr)
static void
StoreCatalogInheritance(Oid relationId, List * supers)
{
- Relation relation;
- TupleDesc desc;
- int16 seqNumber;
- List *entry;
- List *idList;
- HeapTuple tuple;
+ Relation relation;
+ TupleDesc desc;
+ int16 seqNumber;
+ List *entry;
+ List *idList;
+ HeapTuple tuple;
/* ----------------
* sanity checks
@@ -488,8 +488,8 @@ StoreCatalogInheritance(Oid relationId, List * supers)
idList = NIL;
foreach(entry, supers)
{
- Datum datum[Natts_pg_inherits];
- char nullarr[Natts_pg_inherits];
+ Datum datum[Natts_pg_inherits];
+ char nullarr[Natts_pg_inherits];
tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(strVal(lfirst(entry))),
@@ -536,11 +536,11 @@ StoreCatalogInheritance(Oid relationId, List * supers)
*/
foreach(entry, idList)
{
- HeapTuple tuple;
- Oid id;
- int16 number;
- List *next;
- List *current;
+ HeapTuple tuple;
+ Oid id;
+ int16 number;
+ List *next;
+ List *current;
id = (Oid) lfirsti(entry);
current = entry;
@@ -572,9 +572,9 @@ StoreCatalogInheritance(Oid relationId, List * supers)
*/
foreach(entry, idList)
{
- Oid name;
- List *rest;
- bool found = false;
+ Oid name;
+ List *rest;
+ bool found = false;
again:
name = lfirsti(entry);
@@ -613,8 +613,8 @@ again:
foreach(entry, idList)
{
- Datum datum[Natts_pg_ipl];
- char nullarr[Natts_pg_ipl];
+ Datum datum[Natts_pg_ipl];
+ char nullarr[Natts_pg_ipl];
datum[0] = ObjectIdGetDatum(relationId); /* iplrel */
datum[1] = ObjectIdGetDatum(lfirsti(entry));
@@ -642,11 +642,11 @@ again:
static int
checkAttrExists(char *attributeName, char *attributeType, List * schema)
{
- List *s;
+ List *s;
foreach(s, schema)
{
- ColumnDef *def = lfirst(s);
+ ColumnDef *def = lfirst(s);
if (!strcmp(attributeName, def->colname))
{
@@ -672,10 +672,10 @@ checkAttrExists(char *attributeName, char *attributeType, List * schema)
* the CALLER is responsible for freeing the memory allocated
*/
-char *
+char *
MakeArchiveName(Oid relationId)
{
- char *arch;
+ char *arch;
/*
* Archive relations are named a,XXXXX where XXXXX == the OID of the
diff --git a/src/backend/commands/defind.c b/src/backend/commands/defind.c
index 9b8c5a0218..92bb0e7c09 100644
--- a/src/backend/commands/defind.c
+++ b/src/backend/commands/defind.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.13 1997/09/07 04:40:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.14 1997/09/08 02:22:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,19 +39,19 @@
#define IsFuncIndex(ATTR_LIST) (((IndexElem*)lfirst(ATTR_LIST))->args!=NULL)
/* non-export function prototypes */
-static void CheckPredicate(List * predList, List * rangeTable, Oid baseRelOid);
+static void CheckPredicate(List * predList, List * rangeTable, Oid baseRelOid);
static void
CheckPredExpr(Node * predicate, List * rangeTable,
Oid baseRelOid);
static void
- CheckPredClause(Expr * predicate, List * rangeTable, Oid baseRelOid);
+ CheckPredClause(Expr * predicate, List * rangeTable, Oid baseRelOid);
static void
FuncIndexArgs(IndexElem * funcIndex, AttrNumber * attNumP,
Oid * argTypes, Oid * opOidP, Oid relId);
static void
NormIndexAttrs(List * attList, AttrNumber * attNumP,
Oid * opOidP, Oid relId);
-static char *GetDefaultOpClass(Oid atttypid);
+static char *GetDefaultOpClass(Oid atttypid);
/*
* DefineIndex --
@@ -76,18 +76,18 @@ DefineIndex(char *heapRelationName,
Expr * predicate,
List * rangetable)
{
- Oid *classObjectId;
- Oid accessMethodId;
- Oid relationId;
- int numberOfAttributes;
- AttrNumber *attributeNumberA;
- HeapTuple tuple;
- uint16 parameterCount = 0;
- Datum *parameterA = NULL;
- FuncIndexInfo fInfo;
- List *cnfPred = NULL;
- bool lossy = FALSE;
- List *pl;
+ Oid *classObjectId;
+ Oid accessMethodId;
+ Oid relationId;
+ int numberOfAttributes;
+ AttrNumber *attributeNumberA;
+ HeapTuple tuple;
+ uint16 parameterCount = 0;
+ Datum *parameterA = NULL;
+ FuncIndexInfo fInfo;
+ List *cnfPred = NULL;
+ bool lossy = FALSE;
+ List *pl;
/*
* Handle attributes
@@ -138,7 +138,7 @@ DefineIndex(char *heapRelationName,
*/
foreach(pl, parameterList)
{
- ParamString *param = (ParamString *) lfirst(pl);
+ ParamString *param = (ParamString *) lfirst(pl);
if (!strcasecmp(param->name, "islossy"))
lossy = TRUE;
@@ -162,8 +162,8 @@ DefineIndex(char *heapRelationName,
if (IsFuncIndex(attributeList))
{
- IndexElem *funcIndex = lfirst(attributeList);
- int nargs;
+ IndexElem *funcIndex = lfirst(attributeList);
+ int nargs;
nargs = length(funcIndex->args);
if (nargs > INDEX_MAX_KEYS)
@@ -225,23 +225,23 @@ DefineIndex(char *heapRelationName,
void
ExtendIndex(char *indexRelationName, Expr * predicate, List * rangetable)
{
- Oid *classObjectId;
- Oid accessMethodId;
- Oid indexId,
- relationId;
- Oid indproc;
- int numberOfAttributes;
- AttrNumber *attributeNumberA;
- HeapTuple tuple;
- FuncIndexInfo fInfo;
- FuncIndexInfo *funcInfo = NULL;
- IndexTupleForm index;
- Node *oldPred = NULL;
- List *cnfPred = NULL;
- PredInfo *predInfo;
- Relation heapRelation;
- Relation indexRelation;
- int i;
+ Oid *classObjectId;
+ Oid accessMethodId;
+ Oid indexId,
+ relationId;
+ Oid indproc;
+ int numberOfAttributes;
+ AttrNumber *attributeNumberA;
+ HeapTuple tuple;
+ FuncIndexInfo fInfo;
+ FuncIndexInfo *funcInfo = NULL;
+ IndexTupleForm index;
+ Node *oldPred = NULL;
+ List *cnfPred = NULL;
+ PredInfo *predInfo;
+ Relation heapRelation;
+ Relation indexRelation;
+ int i;
/*
* compute index relation id and access method id
@@ -283,7 +283,7 @@ ExtendIndex(char *indexRelationName, Expr * predicate, List * rangetable)
if (VARSIZE(&index->indpred) != 0)
{
- char *predString;
+ char *predString;
predString = fmgr(F_TEXTOUT, &index->indpred);
oldPred = stringToNode(predString);
@@ -366,7 +366,7 @@ ExtendIndex(char *indexRelationName, Expr * predicate, List * rangetable)
static void
CheckPredicate(List * predList, List * rangeTable, Oid baseRelOid)
{
- List *item;
+ List *item;
foreach(item, predList)
{
@@ -377,8 +377,8 @@ CheckPredicate(List * predList, List * rangeTable, Oid baseRelOid)
static void
CheckPredExpr(Node * predicate, List * rangeTable, Oid baseRelOid)
{
- List *clauses = NIL,
- *clause;
+ List *clauses = NIL,
+ *clause;
if (is_opclause(predicate))
{
@@ -401,8 +401,8 @@ CheckPredExpr(Node * predicate, List * rangeTable, Oid baseRelOid)
static void
CheckPredClause(Expr * predicate, List * rangeTable, Oid baseRelOid)
{
- Var *pred_var;
- Const *pred_const;
+ Var *pred_var;
+ Const *pred_const;
pred_var = (Var *) get_leftop(predicate);
pred_const = (Const *) get_rightop(predicate);
@@ -427,8 +427,8 @@ FuncIndexArgs(IndexElem * funcIndex,
Oid * opOidP,
Oid relId)
{
- List *rest;
- HeapTuple tuple;
+ List *rest;
+ HeapTuple tuple;
AttributeTupleForm att;
tuple = SearchSysCacheTuple(CLANAME,
@@ -449,7 +449,7 @@ FuncIndexArgs(IndexElem * funcIndex,
*/
for (rest = funcIndex->args; rest != NIL; rest = lnext(rest))
{
- char *arg;
+ char *arg;
arg = strVal(lfirst(rest));
@@ -475,8 +475,8 @@ NormIndexAttrs(List * attList, /* list of IndexElem's */
Oid * opOidP,
Oid relId)
{
- List *rest;
- HeapTuple tuple;
+ List *rest;
+ HeapTuple tuple;
/*
* process attributeList
@@ -484,7 +484,7 @@ NormIndexAttrs(List * attList, /* list of IndexElem's */
for (rest = attList; rest != NIL; rest = lnext(rest))
{
- IndexElem *attribute;
+ IndexElem *attribute;
AttributeTupleForm attform;
attribute = lfirst(rest);
@@ -531,10 +531,10 @@ NormIndexAttrs(List * attList, /* list of IndexElem's */
}
}
-static char *
+static char *
GetDefaultOpClass(Oid atttypid)
{
- HeapTuple tuple;
+ HeapTuple tuple;
tuple = SearchSysCacheTuple(CLADEFTYPE,
ObjectIdGetDatum(atttypid),
@@ -559,7 +559,7 @@ GetDefaultOpClass(Oid atttypid)
void
RemoveIndex(char *name)
{
- HeapTuple tuple;
+ HeapTuple tuple;
tuple = SearchSysCacheTuple(RELNAME,
PointerGetDatum(name),
diff --git a/src/backend/commands/define.c b/src/backend/commands/define.c
index fb1df213ce..52a0b716f9 100644
--- a/src/backend/commands/define.c
+++ b/src/backend/commands/define.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.14 1997/09/07 04:40:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.15 1997/09/08 02:22:09 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -53,8 +53,8 @@
#include <tcop/dest.h>
#include <catalog/pg_user.h>
-static char *defGetString(DefElem * def);
-static int defGetTypeLength(DefElem * def);
+static char *defGetString(DefElem * def);
+static int defGetTypeLength(DefElem * def);
#define DEFAULT_TYPDELIM ','
@@ -66,7 +66,7 @@ case_translate_language_name(const char *input, char *output)
Translate the input language name to lower case, except if it's C,
translate to upper case.
--------------------------------------------------------------------------*/
- int i;
+ int i;
for (i = 0; i < NAMEDATALEN && input[i] != '\0'; ++i)
output[i] = tolower(input[i]);
@@ -90,7 +90,7 @@ compute_return_type(const Node * returnType,
if (nodeTag(returnType) == T_TypeName)
{
/* a set of values */
- TypeName *setType = (TypeName *) returnType;
+ TypeName *setType = (TypeName *) returnType;
*prorettype_p = setType->name;
*returnsSet_p = true;
@@ -116,7 +116,7 @@ compute_full_attributes(const List * parameters, int32 * byte_pct_p,
These are the full parameters of a C or internal function.
---------------------------------------------------------------------------*/
- List *pl;
+ List *pl;
/* the defaults */
*byte_pct_p = BYTE_PCT;
@@ -126,7 +126,7 @@ compute_full_attributes(const List * parameters, int32 * byte_pct_p,
foreach(pl, (List *) parameters)
{
- ParamString *param = (ParamString *) lfirst(pl);
+ ParamString *param = (ParamString *) lfirst(pl);
if (strcasecmp(param->name, "iscachable") == 0)
{
@@ -153,8 +153,8 @@ compute_full_attributes(const List * parameters, int32 * byte_pct_p,
{
if (sscanf(param->val, "%d", perbyte_cpu_p) == 0)
{
- int count;
- char *ptr;
+ int count;
+ char *ptr;
for (count = 0, ptr = param->val; *ptr != '\0'; ptr++)
if (*ptr == '!')
@@ -166,8 +166,8 @@ compute_full_attributes(const List * parameters, int32 * byte_pct_p,
{
if (sscanf(param->val, "%d", percall_cpu_p) == 0)
{
- int count;
- char *ptr;
+ int count;
+ char *ptr;
for (count = 0, ptr = param->val; *ptr != '\0'; ptr++)
if (*ptr == '!')
@@ -212,16 +212,16 @@ interpret_AS_clause(const char languageName[], const char as[],
void
CreateFunction(ProcedureStmt * stmt, CommandDest dest)
{
- char *probin_str;
+ char *probin_str;
/* pathname of executable file that executes this function, if any */
- char *prosrc_str;
+ char *prosrc_str;
/* SQL that executes this function, if any */
- char *prorettype;
+ char *prorettype;
/* Type of return value (or member of set of values) from function */
- char languageName[NAMEDATALEN];
+ char languageName[NAMEDATALEN];
/*
* name of language of function, with case adjusted: "C", "internal",
@@ -232,12 +232,12 @@ CreateFunction(ProcedureStmt * stmt, CommandDest dest)
* The following are attributes of the function, as expressed in the
* CREATE FUNCTION statement, where applicable.
*/
- int32 byte_pct,
- perbyte_cpu,
- percall_cpu,
- outin_ratio;
- bool canCache;
- bool returnsSet;
+ int32 byte_pct,
+ perbyte_cpu,
+ percall_cpu,
+ outin_ratio;
+ bool canCache;
+ bool returnsSet;
/* The function returns a set of values, as opposed to a singleton. */
@@ -317,30 +317,29 @@ void
DefineOperator(char *oprName,
List * parameters)
{
- uint16 precedence = 0; /* operator precedence */
- bool canHash = false; /* operator hashes */
- bool isLeftAssociative = true; /* operator is left
+ uint16 precedence = 0; /* operator precedence */
+ bool canHash = false;/* operator hashes */
+ bool isLeftAssociative = true; /* operator is left
* associative */
- char *functionName = NULL; /* function for operator */
- char *typeName1 = NULL; /* first type name */
- char *typeName2 = NULL; /* second type name */
- char *commutatorName = NULL; /* optional commutator
- * operator name */
- char *negatorName = NULL; /* optional negator operator name */
- char *restrictionName = NULL; /* optional restrict. sel.
- * procedure */
- char *joinName = NULL; /* optional join sel. procedure
+ char *functionName = NULL; /* function for operator */
+ char *typeName1 = NULL; /* first type name */
+ char *typeName2 = NULL; /* second type name */
+ char *commutatorName = NULL; /* optional commutator operator
* name */
- char *sortName1 = NULL; /* optional first sort operator */
- char *sortName2 = NULL; /* optional second sort operator */
- List *pl;
+ char *negatorName = NULL; /* optional negator operator name */
+ char *restrictionName = NULL; /* optional restrict. sel.
+ * procedure */
+ char *joinName = NULL;/* optional join sel. procedure name */
+ char *sortName1 = NULL; /* optional first sort operator */
+ char *sortName2 = NULL; /* optional second sort operator */
+ List *pl;
/*
* loop over the definition list and extract the information we need.
*/
foreach(pl, parameters)
{
- DefElem *defel = (DefElem *) lfirst(pl);
+ DefElem *defel = (DefElem *) lfirst(pl);
if (!strcasecmp(defel->defname, "leftarg"))
{
@@ -465,19 +464,19 @@ void
DefineAggregate(char *aggName, List * parameters)
{
- char *stepfunc1Name = NULL;
- char *stepfunc2Name = NULL;
- char *finalfuncName = NULL;
- char *baseType = NULL;
- char *stepfunc1Type = NULL;
- char *stepfunc2Type = NULL;
- char *init1 = NULL;
- char *init2 = NULL;
- List *pl;
+ char *stepfunc1Name = NULL;
+ char *stepfunc2Name = NULL;
+ char *finalfuncName = NULL;
+ char *baseType = NULL;
+ char *stepfunc1Type = NULL;
+ char *stepfunc2Type = NULL;
+ char *init1 = NULL;
+ char *init2 = NULL;
+ List *pl;
foreach(pl, parameters)
{
- DefElem *defel = (DefElem *) lfirst(pl);
+ DefElem *defel = (DefElem *) lfirst(pl);
/*
* sfunc1
@@ -573,19 +572,19 @@ DefineAggregate(char *aggName, List * parameters)
void
DefineType(char *typeName, List * parameters)
{
- int16 internalLength = 0; /* int2 */
- int16 externalLength = 0; /* int2 */
- char *elemName = NULL;
- char *inputName = NULL;
- char *outputName = NULL;
- char *sendName = NULL;
- char *receiveName = NULL;
- char *defaultValue = NULL; /* Datum */
- bool byValue = false;
- char delimiter = DEFAULT_TYPDELIM;
- char *shadow_type;
- List *pl;
- char alignment = 'i'; /* default alignment */
+ int16 internalLength = 0; /* int2 */
+ int16 externalLength = 0; /* int2 */
+ char *elemName = NULL;
+ char *inputName = NULL;
+ char *outputName = NULL;
+ char *sendName = NULL;
+ char *receiveName = NULL;
+ char *defaultValue = NULL; /* Datum */
+ bool byValue = false;
+ char delimiter = DEFAULT_TYPDELIM;
+ char *shadow_type;
+ List *pl;
+ char alignment = 'i';/* default alignment */
/*
* Type names can only be 15 characters long, so that the shadow type
@@ -599,7 +598,7 @@ DefineType(char *typeName, List * parameters)
foreach(pl, parameters)
{
- DefElem *defel = (DefElem *) lfirst(pl);
+ DefElem *defel = (DefElem *) lfirst(pl);
if (!strcasecmp(defel->defname, "internallength"))
{
@@ -623,7 +622,7 @@ DefineType(char *typeName, List * parameters)
}
else if (!strcasecmp(defel->defname, "delimiter"))
{
- char *p = defGetString(defel);
+ char *p = defGetString(defel);
delimiter = p[0];
}
@@ -645,7 +644,7 @@ DefineType(char *typeName, List * parameters)
}
else if (!strcasecmp(defel->defname, "alignment"))
{
- char *a = defGetString(defel);
+ char *a = defGetString(defel);
if (!strcasecmp(a, "double"))
{
@@ -720,7 +719,7 @@ DefineType(char *typeName, List * parameters)
pfree(shadow_type);
}
-static char *
+static char *
defGetString(DefElem * def)
{
if (nodeTag(def->arg) != T_String)
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 192076e391..c1ad092e92 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.11 1997/09/07 04:40:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.12 1997/09/08 02:22:10 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,13 +28,13 @@
typedef struct ExplainState
{
/* options */
- bool printCost; /* print cost */
- bool printNodes; /* do nodeToString() instead */
+ bool printCost; /* print cost */
+ bool printNodes; /* do nodeToString() instead */
/* other states */
- List *rtable; /* range table */
-} ExplainState;
+ List *rtable; /* range table */
+} ExplainState;
-static char *Explain_PlanToString(Plan * plan, ExplainState * es);
+static char *Explain_PlanToString(Plan * plan, ExplainState * es);
/*
* ExplainQuery -
@@ -44,15 +44,15 @@ static char *Explain_PlanToString(Plan * plan, ExplainState * es);
void
ExplainQuery(Query * query, bool verbose, CommandDest dest)
{
- char *s = NULL,
- *s2;
- Plan *plan;
- ExplainState *es;
- int len;
+ char *s = NULL,
+ *s2;
+ Plan *plan;
+ ExplainState *es;
+ int len;
if (IsAbortedTransactionBlockState())
{
- char *tag = "*ABORT STATE*";
+ char *tag = "*ABORT STATE*";
EndCommand(tag, dest);
@@ -118,9 +118,9 @@ ExplainQuery(Query * query, bool verbose, CommandDest dest)
static void
explain_outNode(StringInfo str, Plan * plan, int indent, ExplainState * es)
{
- char *pname;
- char buf[1000];
- int i;
+ char *pname;
+ char buf[1000];
+ int i;
if (plan == NULL)
{
@@ -130,51 +130,51 @@ explain_outNode(StringInfo str, Plan * plan, int indent, ExplainState * es)
switch (nodeTag(plan))
{
- case T_Result:
- pname = "Result";
- break;
- case T_Append:
- pname = "Append";
- break;
- case T_NestLoop:
- pname = "Nested Loop";
- break;
- case T_MergeJoin:
- pname = "Merge Join";
- break;
- case T_HashJoin:
- pname = "Hash Join";
- break;
- case T_SeqScan:
- pname = "Seq Scan";
- break;
- case T_IndexScan:
- pname = "Index Scan";
- break;
- case T_Temp:
- pname = "Temp Scan";
- break;
- case T_Sort:
- pname = "Sort";
- break;
- case T_Group:
- pname = "Group";
- break;
- case T_Agg:
- pname = "Aggregate";
- break;
- case T_Unique:
- pname = "Unique";
- break;
- case T_Hash:
- pname = "Hash";
- break;
- case T_Tee:
- pname = "Tee";
- break;
- default:
- pname = "";
- break;
+ case T_Result:
+ pname = "Result";
+ break;
+ case T_Append:
+ pname = "Append";
+ break;
+ case T_NestLoop:
+ pname = "Nested Loop";
+ break;
+ case T_MergeJoin:
+ pname = "Merge Join";
+ break;
+ case T_HashJoin:
+ pname = "Hash Join";
+ break;
+ case T_SeqScan:
+ pname = "Seq Scan";
+ break;
+ case T_IndexScan:
+ pname = "Index Scan";
+ break;
+ case T_Temp:
+ pname = "Temp Scan";
+ break;
+ case T_Sort:
+ pname = "Sort";
+ break;
+ case T_Group:
+ pname = "Group";
+ break;
+ case T_Agg:
+ pname = "Aggregate";
+ break;
+ case T_Unique:
+ pname = "Unique";
+ break;
+ case T_Hash:
+ pname = "Hash";
+ break;
+ case T_Tee:
+ pname = "Tee";
+ break;
+ default:
+ pname = "";
+ break;
}
for (i = 0; i < indent; i++)
@@ -183,18 +183,18 @@ explain_outNode(StringInfo str, Plan * plan, int indent, ExplainState * es)
appendStringInfo(str, pname);
switch (nodeTag(plan))
{
- case T_SeqScan:
- case T_IndexScan:
- if (((Scan *) plan)->scanrelid > 0)
- {
- RangeTblEntry *rte = nth(((Scan *) plan)->scanrelid - 1, es->rtable);
-
- sprintf(buf, " on %s", rte->refname);
- appendStringInfo(str, buf);
- }
- break;
- default:
- break;
+ case T_SeqScan:
+ case T_IndexScan:
+ if (((Scan *) plan)->scanrelid > 0)
+ {
+ RangeTblEntry *rte = nth(((Scan *) plan)->scanrelid - 1, es->rtable);
+
+ sprintf(buf, " on %s", rte->refname);
+ appendStringInfo(str, buf);
+ }
+ break;
+ default:
+ break;
}
if (es->printCost)
{
@@ -224,11 +224,11 @@ explain_outNode(StringInfo str, Plan * plan, int indent, ExplainState * es)
return;
}
-static char *
+static char *
Explain_PlanToString(Plan * plan, ExplainState * es)
{
- StringInfo str;
- char *s;
+ StringInfo str;
+ char *s;
if (plan == NULL)
return "";
diff --git a/src/backend/commands/purge.c b/src/backend/commands/purge.c
index 8000bbc735..78265c93cc 100644
--- a/src/backend/commands/purge.c
+++ b/src/backend/commands/purge.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/purge.c,v 1.7 1997/09/07 04:40:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/purge.c,v 1.8 1997/09/08 02:22:11 momjian Exp $
*
* Note:
* XXX There are many instances of int32 instead of ...Time. These
@@ -28,7 +28,7 @@
#include <commands/purge.h>
#include <utils/builtins.h> /* for isreltime() */
-static char cmdname[] = "RelationPurge";
+static char cmdname[] = "RelationPurge";
#define RELATIVE 01
#define ABSOLUTE 02
@@ -38,23 +38,23 @@ RelationPurge(char *relationName,
char *absoluteTimeString,
char *relativeTimeString)
{
- register i;
- AbsoluteTime absoluteTime = INVALID_ABSTIME;
- RelativeTime relativeTime = INVALID_RELTIME;
- bits8 dateTag;
- Relation relation;
- HeapScanDesc scan;
+ register i;
+ AbsoluteTime absoluteTime = INVALID_ABSTIME;
+ RelativeTime relativeTime = INVALID_RELTIME;
+ bits8 dateTag;
+ Relation relation;
+ HeapScanDesc scan;
static ScanKeyData key[1] = {
{0, Anum_pg_class_relname, F_NAMEEQ}
};
- Buffer buffer;
- HeapTuple newTuple,
- oldTuple;
- AbsoluteTime currentTime;
- char *values[Natts_pg_class];
- char nulls[Natts_pg_class];
- char replace[Natts_pg_class];
- Relation idescs[Num_pg_class_indices];
+ Buffer buffer;
+ HeapTuple newTuple,
+ oldTuple;
+ AbsoluteTime currentTime;
+ char *values[Natts_pg_class];
+ char nulls[Natts_pg_class];
+ char replace[Natts_pg_class];
+ Relation idescs[Num_pg_class_indices];
/*
* XXX for some reason getmyrelids (in inval.c) barfs when you
diff --git a/src/backend/commands/recipe.c b/src/backend/commands/recipe.c
index bf05c293d1..7796b164c3 100644
--- a/src/backend/commands/recipe.c
+++ b/src/backend/commands/recipe.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.7 1997/09/07 04:40:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.8 1997/09/08 02:22:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,26 +50,26 @@ beginRecipe(RecipeStmt * stmt)
/* structure to keep track of the tee node plans */
typedef struct _teePlanInfo
{
- char *tpi_relName;
- Query *tpi_parsetree;
- Plan *tpi_plan;
-} TeePlanInfo;
+ char *tpi_relName;
+ Query *tpi_parsetree;
+ Plan *tpi_plan;
+} TeePlanInfo;
typedef struct _teeInfo
{
- int num;
- TeePlanInfo *val;
-} TeeInfo;
+ int num;
+ TeePlanInfo *val;
+} TeeInfo;
-QueryTreeList *appendQlist(QueryTreeList * q1, QueryTreeList * q2);
-void OffsetVarAttno(Node * node, int varno, int offset);
+QueryTreeList *appendQlist(QueryTreeList * q1, QueryTreeList * q2);
+void OffsetVarAttno(Node * node, int varno, int offset);
static void
appendTeeQuery(TeeInfo * teeInfo,
QueryTreeList * q,
char *teeNodeName);
-static Plan *
+static Plan *
replaceTeeScans(Plan * plan,
Query * parsetree,
TeeInfo * teeInfo);
@@ -83,12 +83,12 @@ static void
tg_rewriteQuery(TgRecipe * r, TgNode * n,
QueryTreeList * q,
QueryTreeList * inputQlist);
-static Node *
+static Node *
tg_replaceNumberedParam(Node * expression,
int pnum,
int rt_ind,
char *teeRelName);
-static Node *
+static Node *
tg_rewriteParamsInExpr(Node * expression,
QueryTreeList * inputQlist);
static QueryTreeList *
@@ -129,18 +129,18 @@ tg_parseTeeNode(TgRecipe * r,
void
beginRecipe(RecipeStmt * stmt)
{
- TgRecipe *r;
- int i;
- QueryTreeList *qList;
- char portalName[1024];
+ TgRecipe *r;
+ int i;
+ QueryTreeList *qList;
+ char portalName[1024];
- Plan *plan;
- TupleDesc attinfo;
- QueryDesc *queryDesc;
- Query *parsetree;
+ Plan *plan;
+ TupleDesc attinfo;
+ QueryDesc *queryDesc;
+ Query *parsetree;
- int numTees;
- TeeInfo *teeInfo;
+ int numTees;
+ TeeInfo *teeInfo;
/*
* retrieveRecipe() reads the recipe from the database and returns a
@@ -177,7 +177,7 @@ beginRecipe(RecipeStmt * stmt)
*/
for (i = 0; i < r->eyes->num; i++)
{
- TgNodePtr e;
+ TgNodePtr e;
e = r->eyes->val[i];
if (e->inNodes->num > 1)
@@ -231,9 +231,9 @@ beginRecipe(RecipeStmt * stmt)
* ---------------------------------------------------------- */
if (teeInfo)
{
- int t;
- Plan *tplan;
- Tee *newplan;
+ int t;
+ Plan *tplan;
+ Tee *newplan;
for (t = 0; t < teeInfo->num; t++)
{
@@ -320,12 +320,12 @@ tg_rewriteQuery(TgRecipe * r,
QueryTreeList * q,
QueryTreeList * inputQlist)
{
- Query *orig;
- Query *inputQ;
- int i;
- List *rtable;
- List *input_rtable;
- int rt_length;
+ Query *orig;
+ Query *inputQ;
+ int i;
+ List *rtable;
+ List *input_rtable;
+ int rt_length;
/* orig is the original parse tree of the node */
orig = q->qtrees[0];
@@ -380,8 +380,8 @@ tg_rewriteQuery(TgRecipe * r,
*/
if (orig->targetList != NIL)
{
- List *tl;
- TargetEntry *tle;
+ List *tl;
+ TargetEntry *tle;
foreach(tl, orig->targetList)
{
@@ -425,134 +425,134 @@ tg_rewriteQuery(TgRecipe * r,
it returns a (possibly modified) Node*.
*/
-static Node *
+static Node *
tg_replaceNumberedParam(Node * expression,
int pnum, /* the number of the parameter */
int rt_ind, /* the range table index */
char *teeRelName) /* the relname of the tee
* table */
{
- TargetEntry *param_tle;
- Param *p;
- Var *newVar,
- *oldVar;
+ TargetEntry *param_tle;
+ Param *p;
+ Var *newVar,
+ *oldVar;
if (expression == NULL)
return NULL;
switch (nodeTag(expression))
{
- case T_Param:
- {
-
- /*
- * the node is a parameter, substitute the entry from the
- * target list of the child that corresponds to the parameter
- * number
- */
- p = (Param *) expression;
-
- /* we only deal with the case of numbered parameters */
- if (p->paramkind == PARAM_NUM && p->paramid == pnum)
+ case T_Param:
{
- if (p->param_tlist)
- {
-
- /*
- * we have a parameter with an attribute like $N.foo
- * so replace it with a new var node
- */
+ /*
+ * the node is a parameter, substitute the entry from the
+ * target list of the child that corresponds to the
+ * parameter number
+ */
+ p = (Param *) expression;
- /* param tlist can only have one entry in them! */
- param_tle = (TargetEntry *) (lfirst(p->param_tlist));
- oldVar = (Var *) param_tle->expr;
- oldVar->varno = rt_ind;
- oldVar->varnoold = rt_ind;
- return (Node *) oldVar;
- }
- else
+ /* we only deal with the case of numbered parameters */
+ if (p->paramkind == PARAM_NUM && p->paramid == pnum)
{
- /* we have $N without the .foo */
- bool defined;
- bool isRel;
-
- /*
- * TODO here, we need to check to see whether the type
- * of the tee is a complex type (relation) or a simple
- * type
- */
- /*
- * if it is a simple type, then we need to get the
- * "result" attribute from the tee relation
- */
-
- isRel = (typeid_get_relid(p->paramtype) != 0);
- if (isRel)
+ if (p->param_tlist)
{
- newVar = makeVar(rt_ind,
- 0, /* the whole tuple */
- TypeGet(teeRelName, &defined),
- rt_ind,
- 0);
- return (Node *) newVar;
+
+ /*
+ * we have a parameter with an attribute like
+ * $N.foo so replace it with a new var node
+ */
+
+ /* param tlist can only have one entry in them! */
+ param_tle = (TargetEntry *) (lfirst(p->param_tlist));
+ oldVar = (Var *) param_tle->expr;
+ oldVar->varno = rt_ind;
+ oldVar->varnoold = rt_ind;
+ return (Node *) oldVar;
}
else
- newVar = makeVar(rt_ind,
- 1, /* just the first field,
+ {
+ /* we have $N without the .foo */
+ bool defined;
+ bool isRel;
+
+ /*
+ * TODO here, we need to check to see whether the
+ * type of the tee is a complex type (relation) or
+ * a simple type
+ */
+
+ /*
+ * if it is a simple type, then we need to get the
+ * "result" attribute from the tee relation
+ */
+
+ isRel = (typeid_get_relid(p->paramtype) != 0);
+ if (isRel)
+ {
+ newVar = makeVar(rt_ind,
+ 0, /* the whole tuple */
+ TypeGet(teeRelName, &defined),
+ rt_ind,
+ 0);
+ return (Node *) newVar;
+ }
+ else
+ newVar = makeVar(rt_ind,
+ 1, /* just the first field,
* which is 'result' */
- TypeGet(teeRelName, &defined),
- rt_ind,
- 0);
- return (Node *) newVar;
+ TypeGet(teeRelName, &defined),
+ rt_ind,
+ 0);
+ return (Node *) newVar;
+ }
+ }
+ else
+ {
+ elog(NOTICE, "tg_replaceNumberedParam: unexpected paramkind value of %d", p->paramkind);
}
}
- else
+ break;
+ case T_Expr:
{
- elog(NOTICE, "tg_replaceNumberedParam: unexpected paramkind value of %d", p->paramkind);
- }
- }
- break;
- case T_Expr:
- {
- /*
- * the node is an expression, we need to recursively call
- * ourselves until we find parameter nodes
- */
- List *l;
- Expr *expr = (Expr *) expression;
- List *newArgs;
+ /*
+ * the node is an expression, we need to recursively call
+ * ourselves until we find parameter nodes
+ */
+ List *l;
+ Expr *expr = (Expr *) expression;
+ List *newArgs;
- /*
- * we have to make a new args lists because Params can be
- * replaced by Var nodes in tg_replaceNumberedParam()
- */
- newArgs = NIL;
+ /*
+ * we have to make a new args lists because Params can be
+ * replaced by Var nodes in tg_replaceNumberedParam()
+ */
+ newArgs = NIL;
- /*
- * we only care about argument to expressions, it doesn't
- * matter when the opType is
- */
- /* recursively rewrite the arguments of this expression */
- foreach(l, expr->args)
+ /*
+ * we only care about argument to expressions, it doesn't
+ * matter when the opType is
+ */
+ /* recursively rewrite the arguments of this expression */
+ foreach(l, expr->args)
+ {
+ newArgs = lappend(newArgs,
+ tg_replaceNumberedParam(lfirst(l),
+ pnum,
+ rt_ind,
+ teeRelName));
+ }
+ /* change the arguments of the expression */
+ expr->args = newArgs;
+ }
+ break;
+ default:
{
- newArgs = lappend(newArgs,
- tg_replaceNumberedParam(lfirst(l),
- pnum,
- rt_ind,
- teeRelName));
+ /* ignore other expr types */
}
- /* change the arguments of the expression */
- expr->args = newArgs;
- }
- break;
- default:
- {
- /* ignore other expr types */
- }
}
return expression;
@@ -572,118 +572,118 @@ tg_replaceNumberedParam(Node * expression,
it returns a (possibly modified) Node*.
*/
-static Node *
+static Node *
tg_rewriteParamsInExpr(Node * expression, QueryTreeList * inputQlist)
{
- List *tl;
- TargetEntry *param_tle,
- *tle;
- Param *p;
- int childno;
- char *resname;
+ List *tl;
+ TargetEntry *param_tle,
+ *tle;
+ Param *p;
+ int childno;
+ char *resname;
if (expression == NULL)
return NULL;
switch (nodeTag(expression))
{
- case T_Param:
- {
-
- /*
- * the node is a parameter, substitute the entry from the
- * target list of the child that corresponds to the parameter
- * number
- */
- p = (Param *) expression;
-
- /* we only deal with the case of numbered parameters */
- if (p->paramkind == PARAM_NUM)
+ case T_Param:
{
- /* paramid's start from 1 */
- childno = p->paramid - 1;
- if (p->param_tlist)
+ /*
+ * the node is a parameter, substitute the entry from the
+ * target list of the child that corresponds to the
+ * parameter number
+ */
+ p = (Param *) expression;
+
+ /* we only deal with the case of numbered parameters */
+ if (p->paramkind == PARAM_NUM)
{
+ /* paramid's start from 1 */
+ childno = p->paramid - 1;
- /*
- * we have a parameter with an attribute like $N.foo
- * so match the resname "foo" against the target list
- * of the (N-1)th inputQlist
- */
+ if (p->param_tlist)
+ {
- /* param tlist can only have one entry in them! */
- param_tle = (TargetEntry *) (lfirst(p->param_tlist));
- resname = param_tle->resdom->resname;
+ /*
+ * we have a parameter with an attribute like
+ * $N.foo so match the resname "foo" against the
+ * target list of the (N-1)th inputQlist
+ */
- if (inputQlist->qtrees[childno])
- {
- foreach(tl, inputQlist->qtrees[childno]->targetList)
+ /* param tlist can only have one entry in them! */
+ param_tle = (TargetEntry *) (lfirst(p->param_tlist));
+ resname = param_tle->resdom->resname;
+
+ if (inputQlist->qtrees[childno])
{
- tle = lfirst(tl);
- if (strcmp(resname, tle->resdom->resname) == 0)
+ foreach(tl, inputQlist->qtrees[childno]->targetList)
{
- return tle->expr;
+ tle = lfirst(tl);
+ if (strcmp(resname, tle->resdom->resname) == 0)
+ {
+ return tle->expr;
+ }
}
}
+ else
+ {
+ elog(WARN, "tg_rewriteParamsInExpr:can't substitute for parameter %d when that input is unconnected", p->paramid);
+ }
+
}
else
{
- elog(WARN, "tg_rewriteParamsInExpr:can't substitute for parameter %d when that input is unconnected", p->paramid);
+ /* we have $N without the .foo */
+ /* use the first resdom in the targetlist of the */
+ /* appropriate child query */
+ tl = inputQlist->qtrees[childno]->targetList;
+ tle = lfirst(tl);
+ return tle->expr;
}
-
}
else
{
- /* we have $N without the .foo */
- /* use the first resdom in the targetlist of the */
- /* appropriate child query */
- tl = inputQlist->qtrees[childno]->targetList;
- tle = lfirst(tl);
- return tle->expr;
+ elog(NOTICE, "tg_rewriteParamsInExpr: unexpected paramkind value of %d", p->paramkind);
}
}
- else
+ break;
+ case T_Expr:
{
- elog(NOTICE, "tg_rewriteParamsInExpr: unexpected paramkind value of %d", p->paramkind);
- }
- }
- break;
- case T_Expr:
- {
- /*
- * the node is an expression, we need to recursively call
- * ourselves until we find parameter nodes
- */
- List *l;
- Expr *expr = (Expr *) expression;
- List *newArgs;
+ /*
+ * the node is an expression, we need to recursively call
+ * ourselves until we find parameter nodes
+ */
+ List *l;
+ Expr *expr = (Expr *) expression;
+ List *newArgs;
- /*
- * we have to make a new args lists because Params can be
- * replaced by Var nodes in tg_rewriteParamsInExpr()
- */
- newArgs = NIL;
+ /*
+ * we have to make a new args lists because Params can be
+ * replaced by Var nodes in tg_rewriteParamsInExpr()
+ */
+ newArgs = NIL;
- /*
- * we only care about argument to expressions, it doesn't
- * matter when the opType is
- */
- /* recursively rewrite the arguments of this expression */
- foreach(l, expr->args)
- {
- newArgs = lappend(newArgs,
+ /*
+ * we only care about argument to expressions, it doesn't
+ * matter when the opType is
+ */
+ /* recursively rewrite the arguments of this expression */
+ foreach(l, expr->args)
+ {
+ newArgs = lappend(newArgs,
tg_rewriteParamsInExpr(lfirst(l), inputQlist));
+ }
+ /* change the arguments of the expression */
+ expr->args = newArgs;
+ }
+ break;
+ default:
+ {
+ /* ignore other expr types */
}
- /* change the arguments of the expression */
- expr->args = newArgs;
- }
- break;
- default:
- {
- /* ignore other expr types */
- }
}
return expression;
@@ -703,12 +703,12 @@ static int
getParamTypes(TgElement * elem, Oid typev[])
{
/* this code is similar to ProcedureDefine() */
- int16 parameterCount;
- bool defined;
- Oid toid;
- char *t;
- int i,
- j;
+ int16 parameterCount;
+ bool defined;
+ Oid toid;
+ char *t;
+ int i,
+ j;
parameterCount = 0;
for (i = 0; i < 8; i++)
@@ -763,10 +763,10 @@ tg_parseTeeNode(TgRecipe * r,
TeeInfo * teeInfo)
{
- QueryTreeList *q;
- char *tt;
- int rt_ind;
- Query *orig;
+ QueryTreeList *q;
+ char *tt;
+ int rt_ind;
+ Query *orig;
/*
* the input Node is a tee node, so we need to do the following: we
@@ -831,21 +831,21 @@ tg_parseTeeNode(TgRecipe * r,
static QueryTreeList *
tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
{
- TgElement *elem;
- char *funcName;
- Oid typev[8]; /* eight arguments maximum */
- int i;
- int parameterCount;
-
- QueryTreeList *qList; /* the parse tree of the nodeElement */
- QueryTreeList *inputQlist; /* the list of parse trees for the inputs
+ TgElement *elem;
+ char *funcName;
+ Oid typev[8]; /* eight arguments maximum */
+ int i;
+ int parameterCount;
+
+ QueryTreeList *qList; /* the parse tree of the nodeElement */
+ QueryTreeList *inputQlist; /* the list of parse trees for the inputs
* to this node */
- QueryTreeList *q;
- Oid relid;
- TgNode *child;
- Relation rel;
- unsigned int len;
- TupleDesc tupdesc;
+ QueryTreeList *q;
+ Oid relid;
+ TgNode *child;
+ Relation rel;
+ unsigned int len;
+ TupleDesc tupdesc;
qList = NULL;
@@ -856,79 +856,79 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo)
elem = n->nodeElem;
switch (elem->srcLang)
{
- case TG_SQL:
- {
+ case TG_SQL:
+ {
- /*
- * for SQL ingredients, the SQL query is contained in the
- * 'src' field
- */
+ /*
+ * for SQL ingredients, the SQL query is contained in
+ * the 'src' field
+ */
#ifdef DEBUG_RECIPE
- elog(NOTICE, "calling parser with %s", elem->src);
+ elog(NOTICE, "calling parser with %s", elem->src);
#endif /* DEBUG_RECIPE */
- parameterCount = getParamTypes(elem, typev);
+ parameterCount = getParamTypes(elem, typev);
- qList = parser(elem->src, typev, parameterCount);
+ qList = parser(elem->src, typev, parameterCount);
- if (qList->len > 1)
- {
- elog(NOTICE,
- "tg_parseSubQuery: parser produced > 1 query tree");
+ if (qList->len > 1)
+ {
+ elog(NOTICE,
+ "tg_parseSubQuery: parser produced > 1 query tree");
+ }
}
- }
- break;
- case TG_C:
- {
- /* C ingredients are registered functions in postgres */
-
- /*
- * we create a new query string by using the function name
- * (found in the 'src' field) and adding parameters to it
- * so if the function was FOOBAR and took in two
- * arguments, we would create a string select
- * FOOBAR($1,$2)
- */
- char newquery[1000];
+ break;
+ case TG_C:
+ {
+ /* C ingredients are registered functions in postgres */
- funcName = elem->src;
- parameterCount = getParamTypes(elem, typev);
+ /*
+ * we create a new query string by using the function
+ * name (found in the 'src' field) and adding
+ * parameters to it so if the function was FOOBAR and
+ * took in two arguments, we would create a string
+ * select FOOBAR($1,$2)
+ */
+ char newquery[1000];
- if (parameterCount > 0)
- {
- int i;
+ funcName = elem->src;
+ parameterCount = getParamTypes(elem, typev);
- sprintf(newquery, "select %s($1", funcName);
- for (i = 1; i < parameterCount; i++)
+ if (parameterCount > 0)
{
- sprintf(newquery, "%s,$%d", newquery, i);
+ int i;
+
+ sprintf(newquery, "select %s($1", funcName);
+ for (i = 1; i < parameterCount; i++)
+ {
+ sprintf(newquery, "%s,$%d", newquery, i);
+ }
+ sprintf(newquery, "%s)", newquery);
}
- sprintf(newquery, "%s)", newquery);
- }
- else
- sprintf(newquery, "select %s()", funcName);
+ else
+ sprintf(newquery, "select %s()", funcName);
#ifdef DEBUG_RECIPE
- elog(NOTICE, "calling parser with %s", newquery);
+ elog(NOTICE, "calling parser with %s", newquery);
#endif /* DEBUG_RECIPE */
- qList = parser(newquery, typev, parameterCount);
- if (qList->len > 1)
- {
- elog(NOTICE,
- "tg_parseSubQuery: parser produced > 1 query tree");
+ qList = parser(newquery, typev, parameterCount);
+ if (qList->len > 1)
+ {
+ elog(NOTICE,
+ "tg_parseSubQuery: parser produced > 1 query tree");
+ }
}
- }
- break;
- case TG_RECIPE_GRAPH:
- elog(NOTICE, "tg_parseSubQuery: can't parse recipe graph ingredients yet!");
- break;
- case TG_COMPILED:
- elog(NOTICE, "tg_parseSubQuery: can't parse compiled ingredients yet!");
- break;
- default:
- elog(NOTICE, "tg_parseSubQuery: unknown srcLang: %d", elem->srcLang);
+ break;
+ case TG_RECIPE_GRAPH:
+ elog(NOTICE, "tg_parseSubQuery: can't parse recipe graph ingredients yet!");
+ break;
+ case TG_COMPILED:
+ elog(NOTICE, "tg_parseSubQuery: can't parse compiled ingredients yet!");
+ break;
+ default:
+ elog(NOTICE, "tg_parseSubQuery: unknown srcLang: %d", elem->srcLang);
}
/* parse each of the subrecipes that are input to this node */
@@ -1110,41 +1110,41 @@ OffsetVarAttno(Node * node, int varno, int offset)
return;
switch (nodeTag(node))
{
- case T_TargetEntry:
- {
- TargetEntry *tle = (TargetEntry *) node;
-
- OffsetVarAttno(tle->expr, varno, offset);
- }
- break;
- case T_Expr:
- {
- Expr *expr = (Expr *) node;
+ case T_TargetEntry:
+ {
+ TargetEntry *tle = (TargetEntry *) node;
- OffsetVarAttno((Node *) expr->args, varno, offset);
- }
- break;
- case T_Var:
- {
- Var *var = (Var *) node;
+ OffsetVarAttno(tle->expr, varno, offset);
+ }
+ break;
+ case T_Expr:
+ {
+ Expr *expr = (Expr *) node;
- if (var->varno == varno)
- var->varattno += offset;
- }
- break;
- case T_List:
- {
- List *l;
+ OffsetVarAttno((Node *) expr->args, varno, offset);
+ }
+ break;
+ case T_Var:
+ {
+ Var *var = (Var *) node;
- foreach(l, (List *) node)
+ if (var->varno == varno)
+ var->varattno += offset;
+ }
+ break;
+ case T_List:
{
- OffsetVarAttno(lfirst(l), varno, offset);
+ List *l;
+
+ foreach(l, (List *) node)
+ {
+ OffsetVarAttno(lfirst(l), varno, offset);
+ }
}
- }
- break;
- default:
- /* ignore the others */
- break;
+ break;
+ default:
+ /* ignore the others */
+ break;
}
}
@@ -1156,13 +1156,13 @@ OffsetVarAttno(Node * node, int varno, int offset)
* returns a new querytree list
*/
-QueryTreeList *
+QueryTreeList *
appendQlist(QueryTreeList * q1, QueryTreeList * q2)
{
- QueryTreeList *newq;
- int i,
- j;
- int newlen;
+ QueryTreeList *newq;
+ int i,
+ j;
+ int newlen;
if (q1 == NULL)
return q2;
@@ -1191,7 +1191,7 @@ appendQlist(QueryTreeList * q1, QueryTreeList * q2)
static void
appendTeeQuery(TeeInfo * teeInfo, QueryTreeList * q, char *teeNodeName)
{
- int i;
+ int i;
Assert(teeInfo);
@@ -1223,9 +1223,9 @@ static void
replaceSeqScan(Plan * plan, Plan * parent,
int rt_ind, Plan * tplan)
{
- Scan *snode;
- Tee *teePlan;
- Result *newPlan;
+ Scan *snode;
+ Tee *teePlan;
+ Result *newPlan;
if (plan == NULL)
{
@@ -1306,16 +1306,16 @@ replaceSeqScan(Plan * plan, Plan * parent,
* places the sequential scans of the Tee table with
* a connection to the actual tee plan node
*/
-static Plan *
+static Plan *
replaceTeeScans(Plan * plan, Query * parsetree, TeeInfo * teeInfo)
{
- int i;
- List *rtable;
- RangeTblEntry *rte;
- char prefix[5];
- int rt_ind;
- Plan *tplan;
+ int i;
+ List *rtable;
+ RangeTblEntry *rte;
+ char prefix[5];
+ int rt_ind;
+ Plan *tplan;
rtable = parsetree->rtable;
if (rtable == NULL)
diff --git a/src/backend/commands/remove.c b/src/backend/commands/remove.c
index cafe4d0971..5b31866cf2 100644
--- a/src/backend/commands/remove.c
+++ b/src/backend/commands/remove.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.11 1997/09/07 04:40:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.12 1997/09/08 02:22:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,16 +48,16 @@ RemoveOperator(char *operatorName, /* operator name */
char *typeName1, /* first type name */
char *typeName2) /* optional second type name */
{
- Relation relation;
- HeapScanDesc scan;
- HeapTuple tup;
- Oid typeId1 = InvalidOid;
- Oid typeId2 = InvalidOid;
- bool defined;
+ Relation relation;
+ HeapScanDesc scan;
+ HeapTuple tup;
+ Oid typeId1 = InvalidOid;
+ Oid typeId2 = InvalidOid;
+ bool defined;
ItemPointerData itemPointerData;
- Buffer buffer;
- ScanKeyData operatorKey[3];
- char *userName;
+ Buffer buffer;
+ ScanKeyData operatorKey[3];
+ char *userName;
if (typeName1)
{
@@ -148,14 +148,14 @@ RemoveOperator(char *operatorName, /* operator name */
static void
SingleOpOperatorRemove(Oid typeOid)
{
- Relation rdesc;
- ScanKeyData key[3];
- HeapScanDesc sdesc;
- HeapTuple tup;
+ Relation rdesc;
+ ScanKeyData key[3];
+ HeapScanDesc sdesc;
+ HeapTuple tup;
ItemPointerData itemPointerData;
- Buffer buffer;
- static attnums[3] = {7, 8, 9}; /* left, right, return */
- register i;
+ Buffer buffer;
+ static attnums[3] = {7, 8, 9}; /* left, right, return */
+ register i;
ScanKeyEntryInitialize(&key[0],
0, 0, ObjectIdEqualRegProcedure, (Datum) typeOid);
@@ -186,17 +186,17 @@ AttributeAndRelationRemove(Oid typeOid)
{
struct oidlist
{
- Oid reloid;
+ Oid reloid;
struct oidlist *next;
};
struct oidlist *oidptr,
- *optr;
- Relation rdesc;
- ScanKeyData key[1];
- HeapScanDesc sdesc;
- HeapTuple tup;
+ *optr;
+ Relation rdesc;
+ ScanKeyData key[1];
+ HeapScanDesc sdesc;
+ HeapTuple tup;
ItemPointerData itemPointerData;
- Buffer buffer;
+ Buffer buffer;
/*
* Get the oid's of the relations to be removed by scanning the entire
@@ -237,7 +237,7 @@ AttributeAndRelationRemove(Oid typeOid)
tup = heap_getnext(sdesc, 0, &buffer);
if (PointerIsValid(tup))
{
- char *name;
+ char *name;
name = (((Form_pg_class) GETSTRUCT(tup))->relname).data;
heap_destroy(name);
@@ -257,16 +257,16 @@ AttributeAndRelationRemove(Oid typeOid)
void
RemoveType(char *typeName) /* type name to be removed */
{
- Relation relation;
- HeapScanDesc scan;
- HeapTuple tup;
- Oid typeOid;
+ Relation relation;
+ HeapScanDesc scan;
+ HeapTuple tup;
+ Oid typeOid;
ItemPointerData itemPointerData;
static ScanKeyData typeKey[1] = {
{0, Anum_pg_type_typname, NameEqualRegProcedure}
};
- char *shadow_type;
- char *userName;
+ char *shadow_type;
+ char *userName;
#ifndef NO_SECURITY
userName = GetPgUserName();
@@ -332,20 +332,20 @@ RemoveFunction(char *functionName, /* function name to be removed */
int nargs,
List * argNameList /* list of TypeNames */ )
{
- Relation relation;
- HeapScanDesc scan;
- HeapTuple tup;
- Buffer buffer = InvalidBuffer;
- bool bufferUsed = FALSE;
- Oid argList[8];
- Form_pg_proc the_proc = NULL;
+ Relation relation;
+ HeapScanDesc scan;
+ HeapTuple tup;
+ Buffer buffer = InvalidBuffer;
+ bool bufferUsed = FALSE;
+ Oid argList[8];
+ Form_pg_proc the_proc = NULL;
ItemPointerData itemPointerData;
static ScanKeyData key[3] = {
{0, Anum_pg_proc_proname, NameEqualRegProcedure}
};
- char *userName;
- char *typename;
- int i;
+ char *userName;
+ char *typename;
+ int i;
memset(argList, 0, 8 * sizeof(Oid));
for (i = 0; i < nargs; i++)
@@ -431,14 +431,14 @@ RemoveFunction(char *functionName, /* function name to be removed */
void
RemoveAggregate(char *aggName, char *aggType)
{
- Relation relation;
- HeapScanDesc scan;
- HeapTuple tup;
+ Relation relation;
+ HeapScanDesc scan;
+ HeapTuple tup;
ItemPointerData itemPointerData;
- char *userName;
- Oid basetypeID = InvalidOid;
- bool defined;
- ScanKeyData aggregateKey[3];
+ char *userName;
+ Oid basetypeID = InvalidOid;
+ bool defined;
+ ScanKeyData aggregateKey[3];
/*
diff --git a/src/backend/commands/rename.c b/src/backend/commands/rename.c
index 9b8df69834..d96fb762f2 100644
--- a/src/backend/commands/rename.c
+++ b/src/backend/commands/rename.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.8 1997/09/07 04:40:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.9 1997/09/08 02:22:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,13 +66,13 @@ renameatt(char *relname,
char *userName,
int recurse)
{
- Relation relrdesc,
- attrdesc;
- HeapTuple reltup,
- oldatttup,
- newatttup;
+ Relation relrdesc,
+ attrdesc;
+ HeapTuple reltup,
+ oldatttup,
+ newatttup;
ItemPointerData oldTID;
- Relation idescs[Num_pg_attr_indices];
+ Relation idescs[Num_pg_attr_indices];
/*
* permissions checking. this would normally be done in utility.c,
@@ -101,10 +101,10 @@ renameatt(char *relname,
*/
if (recurse)
{
- Oid myrelid,
- childrelid;
- List *child,
- *children;
+ Oid myrelid,
+ childrelid;
+ List *child,
+ *children;
relrdesc = heap_openr(relname);
if (!RelationIsValid(relrdesc))
@@ -126,7 +126,7 @@ renameatt(char *relname,
*/
foreach(child, children)
{
- char *childname;
+ char *childname;
childrelid = lfirsti(child);
if (childrelid == myrelid)
@@ -213,13 +213,13 @@ renameatt(char *relname,
void
renamerel(char oldrelname[], char newrelname[])
{
- Relation relrdesc; /* for RELATION relation */
- HeapTuple oldreltup,
- newreltup;
+ Relation relrdesc; /* for RELATION relation */
+ HeapTuple oldreltup,
+ newreltup;
ItemPointerData oldTID;
- char oldpath[MAXPGPATH],
- newpath[MAXPGPATH];
- Relation idescs[Num_pg_class_indices];
+ char oldpath[MAXPGPATH],
+ newpath[MAXPGPATH];
+ Relation idescs[Num_pg_class_indices];
if (IsSystemRelationName(oldrelname))
{
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index c4bd8c40dc..3f5bc37163 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -24,37 +24,37 @@
#define SEQ_MAXVALUE ((int4)0x7FFFFFFF)
#define SEQ_MINVALUE -(SEQ_MAXVALUE)
-bool ItsSequenceCreation = false;
+bool ItsSequenceCreation = false;
typedef struct FormData_pg_sequence
{
- NameData sequence_name;
- int4 last_value;
- int4 increment_by;
- int4 max_value;
- int4 min_value;
- int4 cache_value;
- char is_cycled;
- char is_called;
-} FormData_pg_sequence;
+ NameData sequence_name;
+ int4 last_value;
+ int4 increment_by;
+ int4 max_value;
+ int4 min_value;
+ int4 cache_value;
+ char is_cycled;
+ char is_called;
+} FormData_pg_sequence;
typedef FormData_pg_sequence *SequenceTupleForm;
typedef struct sequence_magic
{
- uint32 magic;
-} sequence_magic;
+ uint32 magic;
+} sequence_magic;
typedef struct SeqTableData
{
- char *name;
- Oid relid;
- Relation rel;
- int4 cached;
- int4 last;
- int4 increment;
+ char *name;
+ Oid relid;
+ Relation rel;
+ int4 cached;
+ int4 last;
+ int4 increment;
struct SeqTableData *next;
-} SeqTableData;
+} SeqTableData;
typedef SeqTableData *SeqTable;
@@ -62,8 +62,8 @@ static SeqTable seqtab = NULL;
static SeqTable init_sequence(char *caller, char *name);
static SequenceTupleForm read_info(char *caller, SeqTable elm, Buffer * buf);
-static void init_params(CreateSeqStmt * seq, SequenceTupleForm new);
-static int get_param(DefElem * def);
+static void init_params(CreateSeqStmt * seq, SequenceTupleForm new);
+static int get_param(DefElem * def);
/*
* DefineSequence --
@@ -73,18 +73,18 @@ void
DefineSequence(CreateSeqStmt * seq)
{
FormData_pg_sequence new;
- CreateStmt *stmt = makeNode(CreateStmt);
- ColumnDef *coldef;
- TypeName *typnam;
- Relation rel;
- Buffer buf;
- PageHeader page;
+ CreateStmt *stmt = makeNode(CreateStmt);
+ ColumnDef *coldef;
+ TypeName *typnam;
+ Relation rel;
+ Buffer buf;
+ PageHeader page;
sequence_magic *sm;
- HeapTuple tuple;
- TupleDesc tupDesc;
- Datum value[SEQ_COL_LASTCOL];
- char null[SEQ_COL_LASTCOL];
- int i;
+ HeapTuple tuple;
+ TupleDesc tupDesc;
+ Datum value[SEQ_COL_LASTCOL];
+ char null[SEQ_COL_LASTCOL];
+ int i;
/* Check and set values */
init_params(seq, &new);
@@ -106,46 +106,46 @@ DefineSequence(CreateSeqStmt * seq)
switch (i)
{
- case SEQ_COL_NAME:
- typnam->name = "name";
- coldef->colname = "sequence_name";
- value[i - 1] = PointerGetDatum(seq->seqname);
- break;
- case SEQ_COL_LASTVAL:
- typnam->name = "int4";
- coldef->colname = "last_value";
- value[i - 1] = Int32GetDatum(new.last_value);
- break;
- case SEQ_COL_INCBY:
- typnam->name = "int4";
- coldef->colname = "increment_by";
- value[i - 1] = Int32GetDatum(new.increment_by);
- break;
- case SEQ_COL_MAXVALUE:
- typnam->name = "int4";
- coldef->colname = "max_value";
- value[i - 1] = Int32GetDatum(new.max_value);
- break;
- case SEQ_COL_MINVALUE:
- typnam->name = "int4";
- coldef->colname = "min_value";
- value[i - 1] = Int32GetDatum(new.min_value);
- break;
- case SEQ_COL_CACHE:
- typnam->name = "int4";
- coldef->colname = "cache_value";
- value[i - 1] = Int32GetDatum(new.cache_value);
- break;
- case SEQ_COL_CYCLE:
- typnam->name = "char";
- coldef->colname = "is_cycled";
- value[i - 1] = CharGetDatum(new.is_cycled);
- break;
- case SEQ_COL_CALLED:
- typnam->name = "char";
- coldef->colname = "is_called";
- value[i - 1] = CharGetDatum('f');
- break;
+ case SEQ_COL_NAME:
+ typnam->name = "name";
+ coldef->colname = "sequence_name";
+ value[i - 1] = PointerGetDatum(seq->seqname);
+ break;
+ case SEQ_COL_LASTVAL:
+ typnam->name = "int4";
+ coldef->colname = "last_value";
+ value[i - 1] = Int32GetDatum(new.last_value);
+ break;
+ case SEQ_COL_INCBY:
+ typnam->name = "int4";
+ coldef->colname = "increment_by";
+ value[i - 1] = Int32GetDatum(new.increment_by);
+ break;
+ case SEQ_COL_MAXVALUE:
+ typnam->name = "int4";
+ coldef->colname = "max_value";
+ value[i - 1] = Int32GetDatum(new.max_value);
+ break;
+ case SEQ_COL_MINVALUE:
+ typnam->name = "int4";
+ coldef->colname = "min_value";
+ value[i - 1] = Int32GetDatum(new.min_value);
+ break;
+ case SEQ_COL_CACHE:
+ typnam->name = "int4";
+ coldef->colname = "cache_value";
+ value[i - 1] = Int32GetDatum(new.cache_value);
+ break;
+ case SEQ_COL_CYCLE:
+ typnam->name = "char";
+ coldef->colname = "is_cycled";
+ value[i - 1] = CharGetDatum(new.is_cycled);
+ break;
+ case SEQ_COL_CALLED:
+ typnam->name = "char";
+ coldef->colname = "is_called";
+ value[i - 1] = CharGetDatum('f');
+ break;
}
stmt->tableElts = lappend(stmt->tableElts, coldef);
}
@@ -203,18 +203,18 @@ DefineSequence(CreateSeqStmt * seq)
int4
nextval(struct varlena * seqin)
{
- char *seqname = textout(seqin);
- SeqTable elm;
- Buffer buf;
+ char *seqname = textout(seqin);
+ SeqTable elm;
+ Buffer buf;
SequenceTupleForm seq;
ItemPointerData iptr;
- int4 incby,
- maxv,
- minv,
- cache;
- int4 result,
- next,
- rescnt = 0;
+ int4 incby,
+ maxv,
+ minv,
+ cache;
+ int4 result,
+ next,
+ rescnt = 0;
/* open and WIntentLock sequence */
elm = init_sequence("nextval", seqname);
@@ -303,9 +303,9 @@ nextval(struct varlena * seqin)
int4
currval(struct varlena * seqin)
{
- char *seqname = textout(seqin);
- SeqTable elm;
- int4 result;
+ char *seqname = textout(seqin);
+ SeqTable elm;
+ int4 result;
/* open and WIntentLock sequence */
elm = init_sequence("currval", seqname);
@@ -322,13 +322,13 @@ currval(struct varlena * seqin)
}
-static SequenceTupleForm
+static SequenceTupleForm
read_info(char *caller, SeqTable elm, Buffer * buf)
{
ItemPointerData iptr;
- PageHeader page;
- ItemId lp;
- HeapTuple tuple;
+ PageHeader page;
+ ItemId lp;
+ HeapTuple tuple;
sequence_magic *sm;
SequenceTupleForm seq;
@@ -362,12 +362,12 @@ read_info(char *caller, SeqTable elm, Buffer * buf)
}
-static SeqTable
+static SeqTable
init_sequence(char *caller, char *name)
{
- SeqTable elm,
- priv = (SeqTable) NULL;
- SeqTable temp;
+ SeqTable elm,
+ priv = (SeqTable) NULL;
+ SeqTable temp;
for (elm = seqtab; elm != (SeqTable) NULL;)
{
@@ -436,8 +436,8 @@ init_sequence(char *caller, char *name)
void
CloseSequences(void)
{
- SeqTable elm;
- Relation rel;
+ SeqTable elm;
+ Relation rel;
ItsSequenceCreation = false;
@@ -461,17 +461,17 @@ CloseSequences(void)
static void
init_params(CreateSeqStmt * seq, SequenceTupleForm new)
{
- DefElem *last_value = NULL;
- DefElem *increment_by = NULL;
- DefElem *max_value = NULL;
- DefElem *min_value = NULL;
- DefElem *cache_value = NULL;
- List *option;
+ DefElem *last_value = NULL;
+ DefElem *increment_by = NULL;
+ DefElem *max_value = NULL;
+ DefElem *min_value = NULL;
+ DefElem *cache_value = NULL;
+ List *option;
new->is_cycled = 'f';
foreach(option, seq->options)
{
- DefElem *defel = (DefElem *) lfirst(option);
+ DefElem *defel = (DefElem *) lfirst(option);
if (!strcasecmp(defel->defname, "increment"))
increment_by = defel;
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 53ab1838cf..e25c955d8d 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -32,36 +32,36 @@
#include "utils/syscache.h"
#endif
-TriggerData *CurrentTriggerData = NULL;
+TriggerData *CurrentTriggerData = NULL;
-void RelationBuildTriggers(Relation relation);
-void FreeTriggerDesc(Relation relation);
+void RelationBuildTriggers(Relation relation);
+void FreeTriggerDesc(Relation relation);
-static void DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger);
+static void DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger);
-extern void fmgr_info(Oid procedureId, func_ptr * function, int *nargs);
+extern void fmgr_info(Oid procedureId, func_ptr * function, int *nargs);
extern GlobalMemory CacheCxt;
void
CreateTrigger(CreateTrigStmt * stmt)
{
- int16 tgtype;
- int16 tgattr[8] = {0};
- Datum values[Natts_pg_trigger];
- char nulls[Natts_pg_trigger];
- Relation rel;
- Relation tgrel;
- HeapScanDesc tgscan;
- ScanKeyData key;
- Relation relrdesc;
- HeapTuple tuple;
+ int16 tgtype;
+ int16 tgattr[8] = {0};
+ Datum values[Natts_pg_trigger];
+ char nulls[Natts_pg_trigger];
+ Relation rel;
+ Relation tgrel;
+ HeapScanDesc tgscan;
+ ScanKeyData key;
+ Relation relrdesc;
+ HeapTuple tuple;
ItemPointerData oldTID;
- Relation idescs[Num_pg_trigger_indices];
- Relation ridescs[Num_pg_class_indices];
- MemoryContext oldcxt;
- Oid fargtypes[8];
- int found = 0;
- int i;
+ Relation idescs[Num_pg_trigger_indices];
+ Relation ridescs[Num_pg_class_indices];
+ MemoryContext oldcxt;
+ Oid fargtypes[8];
+ int found = 0;
+ int i;
if (IsSystemRelationName(stmt->relname))
elog(WARN, "CreateTrigger: can't create trigger for system relation %s", stmt->relname);
@@ -86,24 +86,24 @@ CreateTrigger(CreateTrigStmt * stmt)
{
switch (stmt->actions[i])
{
- case 'i':
- if (TRIGGER_FOR_INSERT(tgtype))
- elog(WARN, "CreateTrigger: double INSERT event specified");
- TRIGGER_SETT_INSERT(tgtype);
- break;
- case 'd':
- if (TRIGGER_FOR_DELETE(tgtype))
- elog(WARN, "CreateTrigger: double DELETE event specified");
- TRIGGER_SETT_DELETE(tgtype);
- break;
- case 'u':
- if (TRIGGER_FOR_UPDATE(tgtype))
- elog(WARN, "CreateTrigger: double UPDATE event specified");
- TRIGGER_SETT_UPDATE(tgtype);
- break;
- default:
- elog(WARN, "CreateTrigger: unknown event specified");
- break;
+ case 'i':
+ if (TRIGGER_FOR_INSERT(tgtype))
+ elog(WARN, "CreateTrigger: double INSERT event specified");
+ TRIGGER_SETT_INSERT(tgtype);
+ break;
+ case 'd':
+ if (TRIGGER_FOR_DELETE(tgtype))
+ elog(WARN, "CreateTrigger: double DELETE event specified");
+ TRIGGER_SETT_DELETE(tgtype);
+ break;
+ case 'u':
+ if (TRIGGER_FOR_UPDATE(tgtype))
+ elog(WARN, "CreateTrigger: double UPDATE event specified");
+ TRIGGER_SETT_UPDATE(tgtype);
+ break;
+ default:
+ elog(WARN, "CreateTrigger: unknown event specified");
+ break;
}
}
@@ -145,14 +145,14 @@ CreateTrigger(CreateTrigStmt * stmt)
values[Anum_pg_trigger_tgtype - 1] = Int16GetDatum(tgtype);
if (stmt->args)
{
- List *le;
- char *args;
- int16 nargs = length(stmt->args);
- int len = 0;
+ List *le;
+ char *args;
+ int16 nargs = length(stmt->args);
+ int len = 0;
foreach(le, stmt->args)
{
- char *ar = (char *) lfirst(le);
+ char *ar = (char *) lfirst(le);
len += strlen(ar) + 4;
}
@@ -213,17 +213,17 @@ CreateTrigger(CreateTrigStmt * stmt)
void
DropTrigger(DropTrigStmt * stmt)
{
- Relation rel;
- Relation tgrel;
- HeapScanDesc tgscan;
- ScanKeyData key;
- Relation relrdesc;
- HeapTuple tuple;
+ Relation rel;
+ Relation tgrel;
+ HeapScanDesc tgscan;
+ ScanKeyData key;
+ Relation relrdesc;
+ HeapTuple tuple;
ItemPointerData oldTID;
- Relation ridescs[Num_pg_class_indices];
- MemoryContext oldcxt;
- int found = 0;
- int tgfound = 0;
+ Relation ridescs[Num_pg_class_indices];
+ MemoryContext oldcxt;
+ int found = 0;
+ int tgfound = 0;
#ifndef NO_SECURITY
if (!pg_ownercheck(GetPgUserName(), stmt->relname, RELNAME))
@@ -295,10 +295,10 @@ DropTrigger(DropTrigStmt * stmt)
void
RelationRemoveTriggers(Relation rel)
{
- Relation tgrel;
- HeapScanDesc tgscan;
- ScanKeyData key;
- HeapTuple tup;
+ Relation tgrel;
+ HeapScanDesc tgscan;
+ ScanKeyData key;
+ HeapTuple tup;
tgrel = heap_openr(TriggerRelationName);
RelationSetLockForWrite(tgrel);
@@ -319,22 +319,22 @@ RelationRemoveTriggers(Relation rel)
void
RelationBuildTriggers(Relation relation)
{
- TriggerDesc *trigdesc = (TriggerDesc *) palloc(sizeof(TriggerDesc));
- int ntrigs = relation->rd_rel->reltriggers;
- Trigger *triggers = NULL;
- Trigger *build;
- Relation tgrel;
+ TriggerDesc *trigdesc = (TriggerDesc *) palloc(sizeof(TriggerDesc));
+ int ntrigs = relation->rd_rel->reltriggers;
+ Trigger *triggers = NULL;
+ Trigger *build;
+ Relation tgrel;
Form_pg_trigger pg_trigger;
- Relation irel;
- ScanKeyData skey;
- HeapTuple tuple;
- IndexScanDesc sd;
+ Relation irel;
+ ScanKeyData skey;
+ HeapTuple tuple;
+ IndexScanDesc sd;
RetrieveIndexResult indexRes;
- Buffer buffer;
- ItemPointer iptr;
+ Buffer buffer;
+ ItemPointer iptr;
struct varlena *val;
- bool isnull;
- int found;
+ bool isnull;
+ int found;
memset(trigdesc, 0, sizeof(TriggerDesc));
@@ -386,8 +386,8 @@ RelationBuildTriggers(Relation relation)
NAMEDATALEN, relation->rd_rel->relname.data);
if (build->tgnargs > 0)
{
- char *p;
- int i;
+ char *p;
+ int i;
val = (struct varlena *) fastgetattr(tuple,
Anum_pg_trigger_tgargs,
@@ -437,10 +437,10 @@ RelationBuildTriggers(Relation relation)
void
FreeTriggerDesc(Relation relation)
{
- TriggerDesc *trigdesc = relation->trigdesc;
- Trigger ***t;
- Trigger *trigger;
- int i;
+ TriggerDesc *trigdesc = relation->trigdesc;
+ Trigger ***t;
+ Trigger *trigger;
+ int i;
if (trigdesc == NULL)
return;
@@ -483,9 +483,9 @@ FreeTriggerDesc(Relation relation)
static void
DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger)
{
- uint16 *n;
- Trigger ***t,
- ***tp;
+ uint16 *n;
+ Trigger ***t,
+ ***tp;
if (TRIGGER_FOR_ROW(trigger->tgtype)) /* Is ROW/STATEMENT
* trigger */
@@ -557,11 +557,11 @@ DescribeTrigger(TriggerDesc * trigdesc, Trigger * trigger)
HeapTuple
ExecBRInsertTriggers(Relation rel, HeapTuple tuple)
{
- int ntrigs = rel->trigdesc->n_before_row[TRIGGER_EVENT_INSERT];
- Trigger **trigger = rel->trigdesc->tg_before_row[TRIGGER_EVENT_INSERT];
- HeapTuple newtuple = tuple;
- int nargs;
- int i;
+ int ntrigs = rel->trigdesc->n_before_row[TRIGGER_EVENT_INSERT];
+ Trigger **trigger = rel->trigdesc->tg_before_row[TRIGGER_EVENT_INSERT];
+ HeapTuple newtuple = tuple;
+ int nargs;
+ int i;
CurrentTriggerData = (TriggerData *) palloc(sizeof(TriggerData));
CurrentTriggerData->tg_event = TRIGGER_EVENT_INSERT | TRIGGER_EVENT_ROW;
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 30690f0f32..66fbbd5db2 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.43 1997/09/07 04:41:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.44 1997/09/08 02:22:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,11 +56,11 @@
#include <port-protos.h>
-bool VacuumRunning = false;
+bool VacuumRunning = false;
-static Portal vc_portal;
+static Portal vc_portal;
-static int MESSAGE_LEVEL; /* message level */
+static int MESSAGE_LEVEL; /* message level */
#define swapLong(a,b) {long tmp; tmp=a; a=b; b=tmp;}
#define swapInt(a,b) {int tmp; tmp=a; a=b; b=tmp;}
@@ -72,46 +72,46 @@ static int MESSAGE_LEVEL; /* message level */
/* non-export function prototypes */
-static void vc_init(void);
-static void vc_shutdown(void);
-static void vc_vacuum(NameData * VacRelP, bool analyze, List * va_cols);
+static void vc_init(void);
+static void vc_shutdown(void);
+static void vc_vacuum(NameData * VacRelP, bool analyze, List * va_cols);
static VRelList vc_getrels(NameData * VacRelP);
-static void vc_vacone(Oid relid, bool analyze, List * va_cols);
-static void vc_scanheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl, VPageList Fvpl);
-static void vc_rpfheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl, VPageList Fvpl, int nindices, Relation * Irel);
-static void vc_vacheap(VRelStats * vacrelstats, Relation onerel, VPageList vpl);
-static void vc_vacpage(Page page, VPageDescr vpd, Relation archrel);
-static void vc_vaconeind(VPageList vpl, Relation indrel, int nhtups);
-static void vc_scanoneind(Relation indrel, int nhtups);
-static void vc_attrstats(Relation onerel, VRelStats * vacrelstats, HeapTuple htup);
-static void vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum * bucket, int16 * bucket_len);
-static void vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrelstats);
-static void vc_delhilowstats(Oid relid, int attcnt, int *attnums);
-static void vc_setpagelock(Relation rel, BlockNumber blkno);
+static void vc_vacone(Oid relid, bool analyze, List * va_cols);
+static void vc_scanheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl, VPageList Fvpl);
+static void vc_rpfheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl, VPageList Fvpl, int nindices, Relation * Irel);
+static void vc_vacheap(VRelStats * vacrelstats, Relation onerel, VPageList vpl);
+static void vc_vacpage(Page page, VPageDescr vpd, Relation archrel);
+static void vc_vaconeind(VPageList vpl, Relation indrel, int nhtups);
+static void vc_scanoneind(Relation indrel, int nhtups);
+static void vc_attrstats(Relation onerel, VRelStats * vacrelstats, HeapTuple htup);
+static void vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum * bucket, int16 * bucket_len);
+static void vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrelstats);
+static void vc_delhilowstats(Oid relid, int attcnt, int *attnums);
+static void vc_setpagelock(Relation rel, BlockNumber blkno);
static VPageDescr vc_tidreapped(ItemPointer itemptr, VPageList vpl);
-static void vc_reappage(VPageList vpl, VPageDescr vpc);
-static void vc_vpinsert(VPageList vpl, VPageDescr vpnew);
-static void vc_free(VRelList vrl);
-static void vc_getindices(Oid relid, int *nindices, Relation ** Irel);
-static void vc_clsindices(int nindices, Relation * Irel);
+static void vc_reappage(VPageList vpl, VPageDescr vpc);
+static void vc_vpinsert(VPageList vpl, VPageDescr vpnew);
+static void vc_free(VRelList vrl);
+static void vc_getindices(Oid relid, int *nindices, Relation ** Irel);
+static void vc_clsindices(int nindices, Relation * Irel);
static Relation vc_getarchrel(Relation heaprel);
-static void vc_archive(Relation archrel, HeapTuple htup);
-static bool vc_isarchrel(char *rname);
-static void vc_mkindesc(Relation onerel, int nindices, Relation * Irel, IndDesc ** Idesc);
-static char *vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, char *));
-static int vc_cmp_blk(char *left, char *right);
-static int vc_cmp_offno(char *left, char *right);
-static bool vc_enough_space(VPageDescr vpd, Size len);
+static void vc_archive(Relation archrel, HeapTuple htup);
+static bool vc_isarchrel(char *rname);
+static void vc_mkindesc(Relation onerel, int nindices, Relation * Irel, IndDesc ** Idesc);
+static char *vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, char *));
+static int vc_cmp_blk(char *left, char *right);
+static int vc_cmp_offno(char *left, char *right);
+static bool vc_enough_space(VPageDescr vpd, Size len);
void
vacuum(char *vacrel, bool verbose, bool analyze, List * va_spec)
{
- char *pname;
- MemoryContext old;
+ char *pname;
+ MemoryContext old;
PortalVariableMemory pmem;
- NameData VacRel;
- List *le;
- List *va_cols = NIL;
+ NameData VacRel;
+ List *le;
+ List *va_cols = NIL;
/*
* Create a portal for safe memory across transctions. We need to
@@ -139,8 +139,8 @@ vacuum(char *vacrel, bool verbose, bool analyze, List * va_spec)
Assert(va_spec == NIL || analyze);
foreach(le, va_spec)
{
- char *col = (char *) lfirst(le);
- char *dest;
+ char *col = (char *) lfirst(le);
+ char *dest;
dest = (char *) palloc(strlen(col) + 1);
strcpy(dest, col);
@@ -183,7 +183,7 @@ vacuum(char *vacrel, bool verbose, bool analyze, List * va_spec)
static void
vc_init()
{
- int fd;
+ int fd;
if ((fd = open("pg_vlock", O_CREAT | O_EXCL, 0600)) < 0)
elog(WARN, "can't create lock file -- another vacuum cleaner running?");
@@ -238,8 +238,8 @@ vc_abort()
static void
vc_vacuum(NameData * VacRelP, bool analyze, List * va_cols)
{
- VRelList vrl,
- cur;
+ VRelList vrl,
+ cur;
/* get list of relations */
vrl = vc_getrels(VacRelP);
@@ -254,25 +254,25 @@ vc_vacuum(NameData * VacRelP, bool analyze, List * va_cols)
vc_free(vrl);
}
-static VRelList
+static VRelList
vc_getrels(NameData * VacRelP)
{
- Relation pgclass;
- TupleDesc pgcdesc;
- HeapScanDesc pgcscan;
- HeapTuple pgctup;
- Buffer buf;
+ Relation pgclass;
+ TupleDesc pgcdesc;
+ HeapScanDesc pgcscan;
+ HeapTuple pgctup;
+ Buffer buf;
PortalVariableMemory portalmem;
- MemoryContext old;
- VRelList vrl,
- cur;
- Datum d;
- char *rname;
- char rkind;
- int16 smgrno;
- bool n;
- ScanKeyData pgckey;
- bool found = false;
+ MemoryContext old;
+ VRelList vrl,
+ cur;
+ Datum d;
+ char *rname;
+ char rkind;
+ int16 smgrno;
+ bool n;
+ ScanKeyData pgckey;
+ bool found = false;
StartTransactionCommand();
@@ -404,23 +404,23 @@ vc_getrels(NameData * VacRelP)
static void
vc_vacone(Oid relid, bool analyze, List * va_cols)
{
- Relation pgclass;
- TupleDesc pgcdesc;
- HeapTuple pgctup,
- pgttup;
- Buffer pgcbuf;
- HeapScanDesc pgcscan;
- Relation onerel;
- ScanKeyData pgckey;
- VPageListData Vvpl; /* List of pages to vacuum and/or clean
+ Relation pgclass;
+ TupleDesc pgcdesc;
+ HeapTuple pgctup,
+ pgttup;
+ Buffer pgcbuf;
+ HeapScanDesc pgcscan;
+ Relation onerel;
+ ScanKeyData pgckey;
+ VPageListData Vvpl; /* List of pages to vacuum and/or clean
* indices */
- VPageListData Fvpl; /* List of pages with space enough for
+ VPageListData Fvpl; /* List of pages with space enough for
* re-using */
- VPageDescr *vpp;
- Relation *Irel;
- int32 nindices,
- i;
- VRelStats *vacrelstats;
+ VPageDescr *vpp;
+ Relation *Irel;
+ int32 nindices,
+ i;
+ VRelStats *vacrelstats;
StartTransactionCommand();
@@ -454,8 +454,8 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
vacrelstats->hasindex = false;
if (analyze && !IsSystemRelationName((RelationGetRelationName(onerel))->data))
{
- int attr_cnt,
- *attnums = NULL;
+ int attr_cnt,
+ *attnums = NULL;
AttributeTupleForm *attr;
attr_cnt = onerel->rd_att->natts;
@@ -463,8 +463,8 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
if (va_cols != NIL)
{
- int tcnt = 0;
- List *le;
+ int tcnt = 0;
+ List *le;
if (length(va_cols) > attr_cnt)
elog(WARN, "vacuum: too many attributes specified for relation %s",
@@ -472,7 +472,7 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
attnums = (int *) palloc(attr_cnt * sizeof(int));
foreach(le, va_cols)
{
- char *col = (char *) lfirst(le);
+ char *col = (char *) lfirst(le);
for (i = 0; i < attr_cnt; i++)
{
@@ -495,9 +495,9 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
for (i = 0; i < attr_cnt; i++)
{
- Operator func_operator;
+ Operator func_operator;
OperatorTupleForm pgopform;
- VacAttrStats *stats;
+ VacAttrStats *stats;
stats = &vacrelstats->vacattrstats[i];
stats->attr = palloc(ATTRIBUTE_TUPLE_SIZE);
@@ -513,7 +513,7 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
func_operator = oper("=", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL)
{
- int nargs;
+ int nargs;
pgopform = (OperatorTupleForm) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmpeq), &nargs);
@@ -524,7 +524,7 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
func_operator = oper("<", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL)
{
- int nargs;
+ int nargs;
pgopform = (OperatorTupleForm) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmplt), &nargs);
@@ -535,7 +535,7 @@ vc_vacone(Oid relid, bool analyze, List * va_cols)
func_operator = oper(">", stats->attr->atttypid, stats->attr->atttypid, true);
if (func_operator != NULL)
{
- int nargs;
+ int nargs;
pgopform = (OperatorTupleForm) GETSTRUCT(func_operator);
fmgr_info(pgopform->oprcode, &(stats->f_cmpgt), &nargs);
@@ -642,39 +642,39 @@ static void
vc_scanheap(VRelStats * vacrelstats, Relation onerel,
VPageList Vvpl, VPageList Fvpl)
{
- int nblocks,
- blkno;
- ItemId itemid;
- ItemPointer itemptr;
- HeapTuple htup;
- Buffer buf;
- Page page,
- tempPage = NULL;
- OffsetNumber offnum,
- maxoff;
- bool pgchanged,
- tupgone,
- dobufrel,
- notup;
- char *relname;
- VPageDescr vpc,
- vp;
- uint32 nvac,
- ntups,
- nunused,
- ncrash,
- nempg,
- nnepg,
- nchpg,
- nemend;
- Size frsize,
- frsusf;
- Size min_tlen = MAXTUPLEN;
- Size max_tlen = 0;
- int32 i /* , attr_cnt */ ;
- struct rusage ru0,
- ru1;
- bool do_shrinking = true;
+ int nblocks,
+ blkno;
+ ItemId itemid;
+ ItemPointer itemptr;
+ HeapTuple htup;
+ Buffer buf;
+ Page page,
+ tempPage = NULL;
+ OffsetNumber offnum,
+ maxoff;
+ bool pgchanged,
+ tupgone,
+ dobufrel,
+ notup;
+ char *relname;
+ VPageDescr vpc,
+ vp;
+ uint32 nvac,
+ ntups,
+ nunused,
+ ncrash,
+ nempg,
+ nnepg,
+ nchpg,
+ nemend;
+ Size frsize,
+ frsusf;
+ Size min_tlen = MAXTUPLEN;
+ Size max_tlen = 0;
+ int32 i /* , attr_cnt */ ;
+ struct rusage ru0,
+ ru1;
+ bool do_shrinking = true;
getrusage(RUSAGE_SELF, &ru0);
@@ -844,11 +844,11 @@ DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d.",
if (tupgone)
{
- ItemId lpp;
+ ItemId lpp;
if (tempPage == (Page) NULL)
{
- Size pageSize;
+ Size pageSize;
pageSize = PageGetPageSize(page);
tempPage = (Page) palloc(pageSize);
@@ -927,7 +927,7 @@ DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d.",
*/
if (do_shrinking && Vvpl->vpl_npages - nemend > 0)
{
- int nusf; /* blocks usefull for re-using */
+ int nusf; /* blocks usefull for re-using */
nusf = Vvpl->vpl_npages - nemend;
if ((Vvpl->vpl_pgdesc[nusf - 1])->vpd_blkno == nblocks - nemend - 1)
@@ -972,50 +972,50 @@ static void
vc_rpfheap(VRelStats * vacrelstats, Relation onerel,
VPageList Vvpl, VPageList Fvpl, int nindices, Relation * Irel)
{
- TransactionId myXID;
- CommandId myCID;
- AbsoluteTime myCTM = 0;
- Buffer buf,
- ToBuf;
- int nblocks,
- blkno;
- Page page,
- ToPage = NULL;
- OffsetNumber offnum = 0,
- maxoff = 0,
- newoff,
- moff;
- ItemId itemid,
- newitemid;
- HeapTuple htup,
- newtup;
- TupleDesc tupdesc = NULL;
- Datum *idatum = NULL;
- char *inulls = NULL;
+ TransactionId myXID;
+ CommandId myCID;
+ AbsoluteTime myCTM = 0;
+ Buffer buf,
+ ToBuf;
+ int nblocks,
+ blkno;
+ Page page,
+ ToPage = NULL;
+ OffsetNumber offnum = 0,
+ maxoff = 0,
+ newoff,
+ moff;
+ ItemId itemid,
+ newitemid;
+ HeapTuple htup,
+ newtup;
+ TupleDesc tupdesc = NULL;
+ Datum *idatum = NULL;
+ char *inulls = NULL;
InsertIndexResult iresult;
- VPageListData Nvpl;
- VPageDescr ToVpd = NULL,
- Fvplast,
- Vvplast,
- vpc,
- *vpp;
- int ToVpI = 0;
- IndDesc *Idesc,
- *idcur;
- int Fblklast,
- Vblklast,
- i;
- Size tlen;
- int nmoved,
- Fnpages,
- Vnpages;
- int nchkmvd,
- ntups;
- bool isempty,
- dowrite;
- Relation archrel;
- struct rusage ru0,
- ru1;
+ VPageListData Nvpl;
+ VPageDescr ToVpd = NULL,
+ Fvplast,
+ Vvplast,
+ vpc,
+ *vpp;
+ int ToVpI = 0;
+ IndDesc *Idesc,
+ *idcur;
+ int Fblklast,
+ Vblklast,
+ i;
+ Size tlen;
+ int nmoved,
+ Fnpages,
+ Vnpages;
+ int nchkmvd,
+ ntups;
+ bool isempty,
+ dowrite;
+ Relation archrel;
+ struct rusage ru0,
+ ru1;
getrusage(RUSAGE_SELF, &ru0);
@@ -1342,9 +1342,9 @@ Elapsed %u/%u sec.",
/* vacuum indices again if needed */
if (Irel != (Relation *) NULL)
{
- VPageDescr *vpleft,
- *vpright,
- vpsave;
+ VPageDescr *vpleft,
+ *vpright,
+ vpsave;
/* re-sort Nvpl.vpl_pgdesc */
for (vpleft = Nvpl.vpl_pgdesc,
@@ -1426,12 +1426,12 @@ Elapsed %u/%u sec.",
static void
vc_vacheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl)
{
- Buffer buf;
- Page page;
- VPageDescr *vpp;
- Relation archrel;
- int nblocks;
- int i;
+ Buffer buf;
+ Page page;
+ VPageDescr *vpp;
+ Relation archrel;
+ int nblocks;
+ int i;
nblocks = Vvpl->vpl_npages;
/* if the relation has an archive, open it */
@@ -1486,9 +1486,9 @@ vc_vacheap(VRelStats * vacrelstats, Relation onerel, VPageList Vvpl)
static void
vc_vacpage(Page page, VPageDescr vpd, Relation archrel)
{
- ItemId itemid;
- HeapTuple htup;
- int i;
+ ItemId itemid;
+ HeapTuple htup;
+ int i;
Assert(vpd->vpd_nusd == 0);
for (i = 0; i < vpd->vpd_noff; i++)
@@ -1513,11 +1513,11 @@ static void
vc_scanoneind(Relation indrel, int nhtups)
{
RetrieveIndexResult res;
- IndexScanDesc iscan;
- int nitups;
- int nipages;
- struct rusage ru0,
- ru1;
+ IndexScanDesc iscan;
+ int nitups;
+ int nipages;
+ struct rusage ru0,
+ ru1;
getrusage(RUSAGE_SELF, &ru0);
@@ -1567,14 +1567,14 @@ static void
vc_vaconeind(VPageList vpl, Relation indrel, int nhtups)
{
RetrieveIndexResult res;
- IndexScanDesc iscan;
- ItemPointer heapptr;
- int nvac;
- int nitups;
- int nipages;
- VPageDescr vp;
- struct rusage ru0,
- ru1;
+ IndexScanDesc iscan;
+ ItemPointer heapptr;
+ int nvac;
+ int nitups;
+ int nipages;
+ VPageDescr vp;
+ struct rusage ru0,
+ ru1;
getrusage(RUSAGE_SELF, &ru0);
@@ -1639,14 +1639,14 @@ vc_vaconeind(VPageList vpl, Relation indrel, int nhtups)
*
* vpl->VPageDescr_array is sorted in right order.
*/
-static VPageDescr
+static VPageDescr
vc_tidreapped(ItemPointer itemptr, VPageList vpl)
{
- OffsetNumber ioffno;
- OffsetNumber *voff;
- VPageDescr vp,
- *vpp;
- VPageDescrData vpd;
+ OffsetNumber ioffno;
+ OffsetNumber *voff;
+ VPageDescr vp,
+ *vpp;
+ VPageDescrData vpd;
vpd.vpd_blkno = ItemPointerGetBlockNumber(itemptr);
ioffno = ItemPointerGetOffsetNumber(itemptr);
@@ -1702,17 +1702,17 @@ vc_tidreapped(ItemPointer itemptr, VPageList vpl)
static void
vc_attrstats(Relation onerel, VRelStats * vacrelstats, HeapTuple htup)
{
- int i,
- attr_cnt = vacrelstats->va_natts;
- VacAttrStats *vacattrstats = vacrelstats->vacattrstats;
- TupleDesc tupDesc = onerel->rd_att;
- Datum value;
- bool isnull;
+ int i,
+ attr_cnt = vacrelstats->va_natts;
+ VacAttrStats *vacattrstats = vacrelstats->vacattrstats;
+ TupleDesc tupDesc = onerel->rd_att;
+ Datum value;
+ bool isnull;
for (i = 0; i < attr_cnt; i++)
{
- VacAttrStats *stats = &vacattrstats[i];
- bool value_hit = true;
+ VacAttrStats *stats = &vacattrstats[i];
+ bool value_hit = true;
value = (Datum) heap_getattr(htup, InvalidBuffer,
stats->attr->attnum, tupDesc, &isnull);
@@ -1806,7 +1806,7 @@ vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum * bucket, int16 * bucke
*bucket = value;
else
{
- int len = (attr->attlen != -1 ? attr->attlen : VARSIZE(value));
+ int len = (attr->attlen != -1 ? attr->attlen : VARSIZE(value));
if (len > *bucket_len)
{
@@ -1833,20 +1833,20 @@ vc_bucketcpy(AttributeTupleForm attr, Datum value, Datum * bucket, int16 * bucke
static void
vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrelstats)
{
- Relation rd,
- ad,
- sd;
- HeapScanDesc rsdesc,
- asdesc;
- TupleDesc sdesc;
- HeapTuple rtup,
- atup,
- stup;
- Buffer rbuf,
- abuf;
- Form_pg_class pgcform;
- ScanKeyData rskey,
- askey;
+ Relation rd,
+ ad,
+ sd;
+ HeapScanDesc rsdesc,
+ asdesc;
+ TupleDesc sdesc;
+ HeapTuple rtup,
+ atup,
+ stup;
+ Buffer rbuf,
+ abuf;
+ Form_pg_class pgcform;
+ ScanKeyData rskey,
+ askey;
AttributeTupleForm attp;
/*
@@ -1872,8 +1872,8 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
if (vacrelstats != NULL && vacrelstats->va_natts > 0)
{
- VacAttrStats *vacattrstats = vacrelstats->vacattrstats;
- int natts = vacrelstats->va_natts;
+ VacAttrStats *vacattrstats = vacrelstats->vacattrstats;
+ int natts = vacrelstats->va_natts;
ad = heap_openr(AttributeRelationName);
sd = heap_openr(StatisticRelationName);
@@ -1884,12 +1884,12 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
while (HeapTupleIsValid(atup = heap_getnext(asdesc, 0, &abuf)))
{
- int i;
- float32data selratio; /* average ratio of rows selected
+ int i;
+ float32data selratio; /* average ratio of rows selected
* for a random constant */
- VacAttrStats *stats;
- Datum values[Natts_pg_statistic];
- char nulls[Natts_pg_statistic];
+ VacAttrStats *stats;
+ Datum values[Natts_pg_statistic];
+ char nulls[Natts_pg_statistic];
attp = (AttributeTupleForm) GETSTRUCT(atup);
if (attp->attnum <= 0) /* skip system attributes for now, */
@@ -1916,18 +1916,18 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
selratio = 0;
else if (VacAttrStatsLtGtValid(stats) && stats->min_cnt + stats->max_cnt == stats->nonnull_cnt)
{
- double min_cnt_d = stats->min_cnt,
- max_cnt_d = stats->max_cnt,
- null_cnt_d = stats->null_cnt,
- nonnullcnt_d = stats->nonnull_cnt; /* prevent overflow */
+ double min_cnt_d = stats->min_cnt,
+ max_cnt_d = stats->max_cnt,
+ null_cnt_d = stats->null_cnt,
+ nonnullcnt_d = stats->nonnull_cnt; /* prevent overflow */
selratio = (min_cnt_d * min_cnt_d + max_cnt_d * max_cnt_d + null_cnt_d * null_cnt_d) /
(nonnullcnt_d + null_cnt_d) / (nonnullcnt_d + null_cnt_d);
}
else
{
- double most = (double) (stats->best_cnt > stats->null_cnt ? stats->best_cnt : stats->null_cnt);
- double total = ((double) stats->nonnull_cnt) + ((double) stats->null_cnt);
+ double most = (double) (stats->best_cnt > stats->null_cnt ? stats->best_cnt : stats->null_cnt);
+ double total = ((double) stats->nonnull_cnt) + ((double) stats->null_cnt);
/*
* we assume count of other values are 20% of best
@@ -1948,12 +1948,12 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
*/
if (VacAttrStatsLtGtValid(stats) && stats->initialized /* &&
* !IsSystemRelationName(
- * pgcform->relname.data)
- */ )
+ *
+ pgcform->relname.data) */ )
{
- func_ptr out_function;
- char *out_string;
- int dummy;
+ func_ptr out_function;
+ char *out_string;
+ int dummy;
for (i = 0; i < Natts_pg_statistic; ++i)
nulls[i] = ' ';
@@ -2016,10 +2016,10 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats * vacrels
static void
vc_delhilowstats(Oid relid, int attcnt, int *attnums)
{
- Relation pgstatistic;
- HeapScanDesc pgsscan;
- HeapTuple pgstup;
- ScanKeyData pgskey;
+ Relation pgstatistic;
+ HeapScanDesc pgsscan;
+ HeapTuple pgstup;
+ ScanKeyData pgskey;
pgstatistic = heap_openr(StatisticRelationName);
@@ -2038,7 +2038,7 @@ vc_delhilowstats(Oid relid, int attcnt, int *attnums)
if (attcnt > 0)
{
Form_pg_statistic pgs = (Form_pg_statistic) GETSTRUCT(pgstup);
- int i;
+ int i;
for (i = 0; i < attcnt; i++)
{
@@ -2075,7 +2075,7 @@ vc_setpagelock(Relation rel, BlockNumber blkno)
static void
vc_reappage(VPageList vpl, VPageDescr vpc)
{
- VPageDescr newvpd;
+ VPageDescr newvpd;
/* allocate a VPageDescrData entry */
newvpd = (VPageDescr) palloc(sizeof(VPageDescrData) + vpc->vpd_noff * sizeof(OffsetNumber));
@@ -2110,8 +2110,8 @@ vc_vpinsert(VPageList vpl, VPageDescr vpnew)
static void
vc_free(VRelList vrl)
{
- VRelList p_vrl;
- MemoryContext old;
+ VRelList p_vrl;
+ MemoryContext old;
PortalVariableMemory pmem;
pmem = PortalGetVariableMemory(vc_portal);
@@ -2138,11 +2138,11 @@ vc_free(VRelList vrl)
#define ARCHIVE_PREFIX "a,"
-static Relation
+static Relation
vc_getarchrel(Relation heaprel)
{
- Relation archrel;
- char *archrelname;
+ Relation archrel;
+ char *archrelname;
archrelname = palloc(sizeof(ARCHIVE_PREFIX) + NAMEDATALEN); /* bogus */
sprintf(archrelname, "%s%d", ARCHIVE_PREFIX, heaprel->rd_id);
@@ -2165,7 +2165,7 @@ vc_archive(Relation archrel, HeapTuple htup)
doinsert(archrel, htup);
}
-static bool
+static bool
vc_isarchrel(char *rname)
{
if (strncmp(ARCHIVE_PREFIX, rname, strlen(ARCHIVE_PREFIX)) == 0)
@@ -2174,14 +2174,14 @@ vc_isarchrel(char *rname)
return (false);
}
-static char *
+static char *
vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, char *))
{
- int res;
- int last = nelem - 1;
- int celm = nelem / 2;
- bool last_move,
- first_move;
+ int res;
+ int last = nelem - 1;
+ int celm = nelem / 2;
+ bool last_move,
+ first_move;
last_move = first_move = true;
for (;;)
@@ -2231,8 +2231,8 @@ vc_find_eq(char *bot, int nelem, int size, char *elm, int (*compar) (char *, cha
static int
vc_cmp_blk(char *left, char *right)
{
- BlockNumber lblk,
- rblk;
+ BlockNumber lblk,
+ rblk;
lblk = (*((VPageDescr *) left))->vpd_blkno;
rblk = (*((VPageDescr *) right))->vpd_blkno;
@@ -2261,17 +2261,17 @@ vc_cmp_offno(char *left, char *right)
static void
vc_getindices(Oid relid, int *nindices, Relation ** Irel)
{
- Relation pgindex;
- Relation irel;
- TupleDesc pgidesc;
- HeapTuple pgitup;
- HeapScanDesc pgiscan;
- Datum d;
- int i,
- k;
- bool n;
- ScanKeyData pgikey;
- Oid *ioid;
+ Relation pgindex;
+ Relation irel;
+ TupleDesc pgidesc;
+ HeapTuple pgitup;
+ HeapScanDesc pgiscan;
+ Datum d;
+ int i,
+ k;
+ bool n;
+ ScanKeyData pgikey;
+ Oid *ioid;
*nindices = i = 0;
@@ -2354,11 +2354,11 @@ vc_clsindices(int nindices, Relation * Irel)
static void
vc_mkindesc(Relation onerel, int nindices, Relation * Irel, IndDesc ** Idesc)
{
- IndDesc *idcur;
- HeapTuple pgIndexTup;
- AttrNumber *attnumP;
- int natts;
- int i;
+ IndDesc *idcur;
+ HeapTuple pgIndexTup;
+ AttrNumber *attnumP;
+ int natts;
+ int i;
*Idesc = (IndDesc *) palloc(nindices * sizeof(IndDesc));
@@ -2390,7 +2390,7 @@ vc_mkindesc(Relation onerel, int nindices, Relation * Irel, IndDesc ** Idesc)
} /* vc_mkindesc */
-static bool
+static bool
vc_enough_space(VPageDescr vpd, Size len)
{
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index 99439de9ce..c4f411021a 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.9 1997/09/07 04:41:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.10 1997/09/08 02:22:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,13 +44,13 @@
static void
DefineVirtualRelation(char *relname, List * tlist)
{
- CreateStmt createStmt;
- List *attrList,
- *t;
- TargetEntry *entry;
- Resdom *res;
- char *resname;
- char *restypename;
+ CreateStmt createStmt;
+ List *attrList,
+ *t;
+ TargetEntry *entry;
+ Resdom *res;
+ char *resname;
+ char *restypename;
/*
* create a list with one entry per attribute of this relation. Each
@@ -63,8 +63,8 @@ DefineVirtualRelation(char *relname, List * tlist)
{
foreach(t, tlist)
{
- ColumnDef *def = makeNode(ColumnDef);
- TypeName *typename;
+ ColumnDef *def = makeNode(ColumnDef);
+ TypeName *typename;
/*
* find the names of the attribute & its type
@@ -123,7 +123,7 @@ DefineVirtualRelation(char *relname, List * tlist)
* XXX it also means viewName cannot be 16 chars long! - ay 11/94
*------------------------------------------------------------------
*/
-char *
+char *
MakeRetrieveViewRuleName(char *viewName)
{
/*
@@ -135,7 +135,7 @@ MakeRetrieveViewRuleName(char *viewName)
namestrcpy(rule_name, buf);
*/
- char *buf;
+ char *buf;
buf = palloc(strlen(viewName) + 5);
sprintf(buf, "_RET%s", viewName);
@@ -145,9 +145,9 @@ MakeRetrieveViewRuleName(char *viewName)
static RuleStmt *
FormViewRetrieveRule(char *viewName, Query * viewParse)
{
- RuleStmt *rule;
- char *rname;
- Attr *attr;
+ RuleStmt *rule;
+ char *rname;
+ Attr *attr;
/*
* Create a RuleStmt that corresponds to the suitable rewrite rule
@@ -172,12 +172,12 @@ FormViewRetrieveRule(char *viewName, Query * viewParse)
static void
DefineViewRules(char *viewName, Query * viewParse)
{
- RuleStmt *retrieve_rule = NULL;
+ RuleStmt *retrieve_rule = NULL;
#ifdef NOTYET
- RuleStmt *replace_rule = NULL;
- RuleStmt *append_rule = NULL;
- RuleStmt *delete_rule = NULL;
+ RuleStmt *replace_rule = NULL;
+ RuleStmt *append_rule = NULL;
+ RuleStmt *delete_rule = NULL;
#endif
@@ -226,10 +226,10 @@ DefineViewRules(char *viewName, Query * viewParse)
static void
UpdateRangeTableOfViewParse(char *viewName, Query * viewParse)
{
- List *old_rt;
- List *new_rt;
- RangeTblEntry *rt_entry1,
- *rt_entry2;
+ List *old_rt;
+ List *new_rt;
+ RangeTblEntry *rt_entry1,
+ *rt_entry2;
/*
* first offset all var nodes by 2
@@ -277,7 +277,7 @@ UpdateRangeTableOfViewParse(char *viewName, Query * viewParse)
void
DefineView(char *viewName, Query * viewParse)
{
- List *viewTlist;
+ List *viewTlist;
viewTlist = viewParse->targetList;
@@ -313,7 +313,7 @@ DefineView(char *viewName, Query * viewParse)
void
RemoveView(char *viewName)
{
- char *rname;
+ char *rname;
/*
* first remove all the "view" rules... Currently we only have one!
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 401924485e..3aeb78ed37 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.6 1997/09/07 04:41:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.7 1997/09/08 02:22:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,8 +74,8 @@ ExecOpenScanR(Oid relOid,
Relation * returnRelation, /* return */
Pointer * returnScanDesc) /* return */
{
- Relation relation;
- Pointer scanDesc;
+ Relation relation;
+ Pointer scanDesc;
/* ----------------
* note: scanDesc returned by ExecBeginScan can be either
@@ -104,10 +104,10 @@ ExecOpenScanR(Oid relOid,
* returns a relation descriptor given an object id.
* ----------------------------------------------------------------
*/
-static Relation
+static Relation
ExecOpenR(Oid relationOid, bool isindex)
{
- Relation relation;
+ Relation relation;
relation = (Relation) NULL;
@@ -141,7 +141,7 @@ ExecOpenR(Oid relationOid, bool isindex)
* -cim 9/14/89
* ----------------------------------------------------------------
*/
-static Pointer
+static Pointer
ExecBeginScan(Relation relation,
int nkeys,
ScanKey skeys,
@@ -149,7 +149,7 @@ ExecBeginScan(Relation relation,
ScanDirection dir,
TimeQual time_range)
{
- Pointer scanDesc;
+ Pointer scanDesc;
scanDesc = NULL;
@@ -198,8 +198,8 @@ void
ExecCloseR(Plan * node)
{
CommonScanState *state;
- Relation relation;
- HeapScanDesc scanDesc;
+ Relation relation;
+ HeapScanDesc scanDesc;
/* ----------------
* shut down the heap scan and close the heap relation
@@ -208,29 +208,29 @@ ExecCloseR(Plan * node)
switch (nodeTag(node))
{
- case T_SeqScan:
- state = ((SeqScan *) node)->scanstate;
- break;
+ case T_SeqScan:
+ state = ((SeqScan *) node)->scanstate;
+ break;
- case T_IndexScan:
- state = ((IndexScan *) node)->scan.scanstate;
- break;
+ case T_IndexScan:
+ state = ((IndexScan *) node)->scan.scanstate;
+ break;
- case T_Material:
- state = &(((Material *) node)->matstate->csstate);
- break;
+ case T_Material:
+ state = &(((Material *) node)->matstate->csstate);
+ break;
- case T_Sort:
- state = &(((Sort *) node)->sortstate->csstate);
- break;
+ case T_Sort:
+ state = &(((Sort *) node)->sortstate->csstate);
+ break;
- case T_Agg:
- state = &(((Agg *) node)->aggstate->csstate);
- break;
+ case T_Agg:
+ state = &(((Agg *) node)->aggstate->csstate);
+ break;
- default:
- elog(DEBUG, "ExecCloseR: not a scan, material, or sort node!");
- return;
+ default:
+ elog(DEBUG, "ExecCloseR: not a scan, material, or sort node!");
+ return;
}
relation = state->css_currentRelation;
@@ -249,12 +249,12 @@ ExecCloseR(Plan * node)
*/
if (nodeTag(node) == T_IndexScan)
{
- IndexScan *iscan = (IndexScan *) node;
+ IndexScan *iscan = (IndexScan *) node;
IndexScanState *indexstate;
- int numIndices;
- RelationPtr indexRelationDescs;
+ int numIndices;
+ RelationPtr indexRelationDescs;
IndexScanDescPtr indexScanDescs;
- int i;
+ int i;
indexstate = iscan->indxstate;
numIndices = indexstate->iss_NumIndices;
@@ -292,32 +292,32 @@ ExecReScan(Plan * node, ExprContext * exprCtxt, Plan * parent)
{
switch (nodeTag(node))
{
- case T_SeqScan:
- ExecSeqReScan((SeqScan *) node, exprCtxt, parent);
- return;
-
- case T_IndexScan:
- ExecIndexReScan((IndexScan *) node, exprCtxt, parent);
- return;
-
- case T_Material:
-
- /*
- * the first call to ExecReScan should have no effect because
- * everything is initialized properly already. the following
- * calls will be handled by ExecSeqReScan() because the nodes
- * below the Material node have already been materialized into a
- * temp relation.
- */
- return;
+ case T_SeqScan:
+ ExecSeqReScan((SeqScan *) node, exprCtxt, parent);
+ return;
+
+ case T_IndexScan:
+ ExecIndexReScan((IndexScan *) node, exprCtxt, parent);
+ return;
+
+ case T_Material:
+
+ /*
+ * the first call to ExecReScan should have no effect because
+ * everything is initialized properly already. the following
+ * calls will be handled by ExecSeqReScan() because the nodes
+ * below the Material node have already been materialized into
+ * a temp relation.
+ */
+ return;
- case T_Tee:
- ExecTeeReScan((Tee *) node, exprCtxt, parent);
- break;
+ case T_Tee:
+ ExecTeeReScan((Tee *) node, exprCtxt, parent);
+ break;
- default:
- elog(WARN, "ExecReScan: not a seqscan or indexscan node.");
- return;
+ default:
+ elog(WARN, "ExecReScan: not a seqscan or indexscan node.");
+ return;
}
}
@@ -355,21 +355,21 @@ ExecMarkPos(Plan * node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
- ExecSeqMarkPos((SeqScan *) node);
- break;
+ case T_SeqScan:
+ ExecSeqMarkPos((SeqScan *) node);
+ break;
- case T_IndexScan:
- ExecIndexMarkPos((IndexScan *) node);
- break;
+ case T_IndexScan:
+ ExecIndexMarkPos((IndexScan *) node);
+ break;
- case T_Sort:
- ExecSortMarkPos((Sort *) node);
- break;
+ case T_Sort:
+ ExecSortMarkPos((Sort *) node);
+ break;
- default:
- /* elog(DEBUG, "ExecMarkPos: unsupported node type"); */
- break;
+ default:
+ /* elog(DEBUG, "ExecMarkPos: unsupported node type"); */
+ break;
}
return;
}
@@ -385,21 +385,21 @@ ExecRestrPos(Plan * node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
- ExecSeqRestrPos((SeqScan *) node);
- return;
+ case T_SeqScan:
+ ExecSeqRestrPos((SeqScan *) node);
+ return;
- case T_IndexScan:
- ExecIndexRestrPos((IndexScan *) node);
- return;
+ case T_IndexScan:
+ ExecIndexRestrPos((IndexScan *) node);
+ return;
- case T_Sort:
- ExecSortRestrPos((Sort *) node);
- return;
+ case T_Sort:
+ ExecSortRestrPos((Sort *) node);
+ return;
- default:
- /* elog(DEBUG, "ExecRestrPos: node type not supported"); */
- return;
+ default:
+ /* elog(DEBUG, "ExecRestrPos: node type not supported"); */
+ return;
}
}
@@ -422,7 +422,7 @@ Relation
ExecCreatR(TupleDesc tupType,
Oid relationOid)
{
- Relation relDesc;
+ Relation relDesc;
EU3_printf("ExecCreatR: %s type=%d oid=%d\n",
"entering: ", tupType, relationOid);
diff --git a/src/backend/executor/execFlatten.c b/src/backend/executor/execFlatten.c
index 43d616712f..cc98dd6e20 100644
--- a/src/backend/executor/execFlatten.c
+++ b/src/backend/executor/execFlatten.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.3 1997/09/07 04:41:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.4 1997/09/08 02:22:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ ExecEvalIter(Iter * iterNode,
bool * resultIsNull,
bool * iterIsDone)
{
- Node *expression;
+ Node *expression;
expression = iterNode->iterexpr;
@@ -66,13 +66,13 @@ ExecEvalFjoin(TargetEntry * tlist,
{
#ifdef SETS_FIXED
- bool isDone;
- int curNode;
- List *tlistP;
+ bool isDone;
+ int curNode;
+ List *tlistP;
- Fjoin *fjNode = tlist->fjoin;
- DatumPtr resVect = fjNode->fj_results;
- BoolPtr alwaysDone = fjNode->fj_alwaysDone;
+ Fjoin *fjNode = tlist->fjoin;
+ DatumPtr resVect = fjNode->fj_results;
+ BoolPtr alwaysDone = fjNode->fj_alwaysDone;
if (fj_isDone)
*fj_isDone = false;
@@ -90,7 +90,7 @@ ExecEvalFjoin(TargetEntry * tlist,
curNode = 1;
foreach(tlistP, lnext(tlist))
{
- TargetEntry *tle = lfirst(tlistP);
+ TargetEntry *tle = lfirst(tlistP);
resVect[curNode] = ExecEvalIter((Iter *) tle->expr,
econtext,
@@ -181,19 +181,19 @@ ExecEvalFjoin(TargetEntry * tlist,
}
#ifdef SETS_FIXED
-static bool
+static bool
FjoinBumpOuterNodes(TargetEntry * tlist,
ExprContext * econtext,
DatumPtr results,
char *nulls)
{
- bool funcIsDone = true;
- Fjoin *fjNode = tlist->fjoin;
- char *alwaysDone = fjNode->fj_alwaysDone;
- List *outerList = lnext(tlist);
- List *trailers = lnext(tlist);
- int trailNode = 1;
- int curNode = 1;
+ bool funcIsDone = true;
+ Fjoin *fjNode = tlist->fjoin;
+ char *alwaysDone = fjNode->fj_alwaysDone;
+ List *outerList = lnext(tlist);
+ List *trailers = lnext(tlist);
+ int trailNode = 1;
+ int curNode = 1;
/*
* Run through list of functions until we get to one that isn't yet
@@ -201,7 +201,7 @@ FjoinBumpOuterNodes(TargetEntry * tlist,
*/
while ((funcIsDone == true) && (outerList != NIL))
{
- TargetEntry *tle = lfirst(outerList);
+ TargetEntry *tle = lfirst(outerList);
if (alwaysDone[curNode] == true)
nulls[curNode] = 'n';
@@ -232,7 +232,7 @@ FjoinBumpOuterNodes(TargetEntry * tlist,
trailNode = 1;
while (trailNode != curNode - 1)
{
- TargetEntry *tle = lfirst(trailers);
+ TargetEntry *tle = lfirst(trailers);
if (alwaysDone[trailNode] != true)
results[trailNode] = ExecEvalIter((Iter) tle->expr,
diff --git a/src/backend/executor/execJunk.c b/src/backend/executor/execJunk.c
index 3ad41bd393..1c9476fc35 100644
--- a/src/backend/executor/execJunk.c
+++ b/src/backend/executor/execJunk.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.6 1997/09/07 04:41:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.7 1997/09/08 02:22:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -60,24 +60,24 @@
* Initialize the Junk filter.
*-------------------------------------------------------------------------
*/
-JunkFilter *
+JunkFilter *
ExecInitJunkFilter(List * targetList)
{
- JunkFilter *junkfilter;
- List *cleanTargetList;
- int len,
- cleanLength;
- TupleDesc tupType,
- cleanTupType;
- List *t;
- TargetEntry *tle;
- Resdom *resdom,
- *cleanResdom;
- int resjunk;
- AttrNumber cleanResno;
- AttrNumber *cleanMap;
- Size size;
- Node *expr;
+ JunkFilter *junkfilter;
+ List *cleanTargetList;
+ int len,
+ cleanLength;
+ TupleDesc tupType,
+ cleanTupType;
+ List *t;
+ TargetEntry *tle;
+ Resdom *resdom,
+ *cleanResdom;
+ int resjunk;
+ AttrNumber cleanResno;
+ AttrNumber *cleanMap;
+ Size size;
+ Node *expr;
/* ---------------------
* First find the "clean" target list, i.e. all the entries
@@ -91,7 +91,7 @@ ExecInitJunkFilter(List * targetList)
foreach(t, targetList)
{
- TargetEntry *rtarget = lfirst(t);
+ TargetEntry *rtarget = lfirst(t);
if (rtarget->resdom != NULL)
{
@@ -120,11 +120,11 @@ ExecInitJunkFilter(List * targetList)
else
{
#ifdef SETS_FIXED
- List *fjListP;
- Fjoin *cleanFjoin;
- List *cleanFjList;
- List *fjList = lfirst(t);
- Fjoin *fjNode = (Fjoin *) tl_node(fjList);
+ List *fjListP;
+ Fjoin *cleanFjoin;
+ List *cleanFjList;
+ List *fjList = lfirst(t);
+ Fjoin *fjNode = (Fjoin *) tl_node(fjList);
cleanFjoin = (Fjoin) copyObject((Node) fjNode);
cleanFjList = lcons(cleanFjoin, NIL);
@@ -139,7 +139,7 @@ ExecInitJunkFilter(List * targetList)
foreach(fjListP, lnext(fjList))
{
- TargetEntry *tle = lfirst(fjListP);
+ TargetEntry *tle = lfirst(fjListP);
resdom = tle->resdom;
expr = tle->expr;
@@ -189,7 +189,7 @@ ExecInitJunkFilter(List * targetList)
cleanResno = 1;
foreach(t, targetList)
{
- TargetEntry *tle = lfirst(t);
+ TargetEntry *tle = lfirst(t);
if (tle->resdom != NULL)
{
@@ -205,9 +205,9 @@ ExecInitJunkFilter(List * targetList)
else
{
#ifdef SETS_FIXED
- List fjListP;
- List fjList = lfirst(t);
- Fjoin fjNode = (Fjoin) lfirst(fjList);
+ List fjListP;
+ List fjList = lfirst(t);
+ Fjoin fjNode = (Fjoin) lfirst(fjList);
/* what the hell is this????? */
resdom = (Resdom) lfirst(get_fj_innerNode(fjNode));
@@ -219,7 +219,7 @@ ExecInitJunkFilter(List * targetList)
#ifdef SETS_FIXED
foreach(fjListP, lnext(fjList))
{
- TargetEntry *tle = lfirst(fjListP);
+ TargetEntry *tle = lfirst(fjListP);
resdom = tle->resdom;
cleanMap[cleanResno - 1] = resdom->resno;
@@ -270,14 +270,14 @@ ExecGetJunkAttribute(JunkFilter * junkfilter,
Datum * value,
bool * isNull)
{
- List *targetList;
- List *t;
- Resdom *resdom;
- AttrNumber resno;
- char *resname;
- int resjunk;
- TupleDesc tupType;
- HeapTuple tuple;
+ List *targetList;
+ List *t;
+ Resdom *resdom;
+ AttrNumber resno;
+ char *resname;
+ int resjunk;
+ TupleDesc tupType;
+ HeapTuple tuple;
/* ---------------------
* first look in the junkfilter's target list for
@@ -289,7 +289,7 @@ ExecGetJunkAttribute(JunkFilter * junkfilter,
foreach(t, targetList)
{
- TargetEntry *tle = lfirst(t);
+ TargetEntry *tle = lfirst(t);
resdom = tle->resdom;
resname = resdom->resname;
@@ -330,19 +330,19 @@ ExecGetJunkAttribute(JunkFilter * junkfilter,
HeapTuple
ExecRemoveJunk(JunkFilter * junkfilter, TupleTableSlot * slot)
{
- HeapTuple tuple;
- HeapTuple cleanTuple;
- AttrNumber *cleanMap;
- TupleDesc cleanTupType;
- TupleDesc tupType;
- int cleanLength;
- bool isNull;
- int i;
- Size size;
- Datum *values;
- char *nulls;
- Datum values_array[64];
- char nulls_array[64];
+ HeapTuple tuple;
+ HeapTuple cleanTuple;
+ AttrNumber *cleanMap;
+ TupleDesc cleanTupType;
+ TupleDesc tupType;
+ int cleanLength;
+ bool isNull;
+ int i;
+ Size size;
+ Datum *values;
+ char *nulls;
+ Datum values_array[64];
+ char nulls_array[64];
/* ----------------
* get info from the slot and the junk filter
@@ -391,7 +391,7 @@ ExecRemoveJunk(JunkFilter * junkfilter, TupleTableSlot * slot)
*/
for (i = 0; i < cleanLength; i++)
{
- Datum d = (Datum)
+ Datum d = (Datum)
heap_getattr(tuple, InvalidBuffer, cleanMap[i], tupType, &isNull);
values[i] = d;
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 2bf0edaf35..c7ff5aa910 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.23 1997/09/07 04:41:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.24 1997/09/08 02:22:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,14 +62,14 @@ ExecCheckPerms(CmdType operation, int resultRelation, List * rangeTable,
static TupleDesc
InitPlan(CmdType operation, Query * parseTree,
Plan * plan, EState * estate);
-static void EndPlan(Plan * plan, EState * estate);
+static void EndPlan(Plan * plan, EState * estate);
static TupleTableSlot *
ExecutePlan(EState * estate, Plan * plan,
Query * parseTree, CmdType operation,
int numberTuples, ScanDirection direction,
void (*printfunc) ());
-static void ExecRetrieve(TupleTableSlot * slot, void (*printfunc) (),
- EState * estate);
+static void ExecRetrieve(TupleTableSlot * slot, void (*printfunc) (),
+ EState * estate);
static void
ExecAppend(TupleTableSlot * slot, ItemPointer tupleid,
EState * estate);
@@ -83,7 +83,7 @@ ExecReplace(TupleTableSlot * slot, ItemPointer tupleid,
/* end of local decls */
#ifdef QUERY_LIMIT
-static int queryLimit = ALL_TUPLES;
+static int queryLimit = ALL_TUPLES;
#undef ALL_TUPLES
#define ALL_TUPLES queryLimit
@@ -112,7 +112,7 @@ ExecutorLimit(int limit)
TupleDesc
ExecutorStart(QueryDesc * queryDesc, EState * estate)
{
- TupleDesc result;
+ TupleDesc result;
/* sanity checks */
Assert(queryDesc != NULL);
@@ -157,12 +157,12 @@ ExecutorStart(QueryDesc * queryDesc, EState * estate)
TupleTableSlot *
ExecutorRun(QueryDesc * queryDesc, EState * estate, int feature, int count)
{
- CmdType operation;
- Query *parseTree;
- Plan *plan;
+ CmdType operation;
+ Query *parseTree;
+ Plan *plan;
TupleTableSlot *result;
- CommandDest dest;
- void (*destination) ();
+ CommandDest dest;
+ void (*destination) ();
/* ----------------
* sanity checks
@@ -200,7 +200,7 @@ ExecutorRun(QueryDesc * queryDesc, EState * estate, int feature, int count)
if ((nodeTag(plan) == T_IndexScan) &&
(((IndexScan *) plan)->indxstate->iss_RuntimeKeyInfo != NULL))
{
- ExprContext *econtext;
+ ExprContext *econtext;
econtext = ((IndexScan *) plan)->scan.scanstate->cstate.cs_ExprContext;
ExecIndexReScan((IndexScan *) plan, econtext, plan);
@@ -211,57 +211,57 @@ ExecutorRun(QueryDesc * queryDesc, EState * estate, int feature, int count)
switch (feature)
{
- case EXEC_RUN:
- result = ExecutePlan(estate,
- plan,
- parseTree,
- operation,
- ALL_TUPLES,
- ForwardScanDirection,
- destination);
- break;
- case EXEC_FOR:
- result = ExecutePlan(estate,
- plan,
- parseTree,
- operation,
- count,
- ForwardScanDirection,
- destination);
- break;
+ case EXEC_RUN:
+ result = ExecutePlan(estate,
+ plan,
+ parseTree,
+ operation,
+ ALL_TUPLES,
+ ForwardScanDirection,
+ destination);
+ break;
+ case EXEC_FOR:
+ result = ExecutePlan(estate,
+ plan,
+ parseTree,
+ operation,
+ count,
+ ForwardScanDirection,
+ destination);
+ break;
- /* ----------------
- * retrieve next n "backward" tuples
- * ----------------
- */
- case EXEC_BACK:
- result = ExecutePlan(estate,
- plan,
- parseTree,
- operation,
- count,
- BackwardScanDirection,
- destination);
- break;
+ /* ----------------
+ * retrieve next n "backward" tuples
+ * ----------------
+ */
+ case EXEC_BACK:
+ result = ExecutePlan(estate,
+ plan,
+ parseTree,
+ operation,
+ count,
+ BackwardScanDirection,
+ destination);
+ break;
- /* ----------------
- * return one tuple but don't "retrieve" it.
- * (this is used by the rule manager..) -cim 9/14/89
- * ----------------
- */
- case EXEC_RETONE:
- result = ExecutePlan(estate,
- plan,
- parseTree,
- operation,
- ONE_TUPLE,
- ForwardScanDirection,
- destination);
- break;
- default:
- result = NULL;
- elog(DEBUG, "ExecutorRun: Unknown feature %d", feature);
- break;
+ /* ----------------
+ * return one tuple but don't "retrieve" it.
+ * (this is used by the rule manager..) -cim 9/14/89
+ * ----------------
+ */
+ case EXEC_RETONE:
+ result = ExecutePlan(estate,
+ plan,
+ parseTree,
+ operation,
+ ONE_TUPLE,
+ ForwardScanDirection,
+ destination);
+ break;
+ default:
+ result = NULL;
+ elog(DEBUG, "ExecutorRun: Unknown feature %d", feature);
+ break;
}
return result;
@@ -303,17 +303,17 @@ ExecCheckPerms(CmdType operation,
List * rangeTable,
Query * parseTree)
{
- int i = 1;
- Oid relid;
- HeapTuple htp;
- List *lp;
- List *qvars,
- *tvars;
- int32 ok = 1,
- aclcheck_result = -1;
- char *opstr;
- NameData rname;
- char *userName;
+ int i = 1;
+ Oid relid;
+ HeapTuple htp;
+ List *lp;
+ List *qvars,
+ *tvars;
+ int32 ok = 1,
+ aclcheck_result = -1;
+ char *opstr;
+ NameData rname;
+ char *userName;
#define CHECK(MODE) pg_aclcheck(rname.data, userName, MODE)
@@ -321,7 +321,7 @@ ExecCheckPerms(CmdType operation,
foreach(lp, rangeTable)
{
- RangeTblEntry *rte = lfirst(lp);
+ RangeTblEntry *rte = lfirst(lp);
relid = rte->relid;
htp = SearchSysCacheTuple(RELOID,
@@ -348,20 +348,21 @@ ExecCheckPerms(CmdType operation,
}
switch (operation)
{
- case CMD_INSERT:
- ok = ((aclcheck_result = CHECK(ACL_AP)) == ACLCHECK_OK) ||
- ((aclcheck_result = CHECK(ACL_WR)) == ACLCHECK_OK);
- opstr = "append";
- break;
- case CMD_NOTIFY: /* what does this mean?? -- jw, 1/6/94 */
- case CMD_DELETE:
- case CMD_UPDATE:
- ok = ((aclcheck_result = CHECK(ACL_WR)) == ACLCHECK_OK);
- opstr = "write";
- break;
- default:
- elog(WARN, "ExecCheckPerms: bogus operation %d",
- operation);
+ case CMD_INSERT:
+ ok = ((aclcheck_result = CHECK(ACL_AP)) == ACLCHECK_OK) ||
+ ((aclcheck_result = CHECK(ACL_WR)) == ACLCHECK_OK);
+ opstr = "append";
+ break;
+ case CMD_NOTIFY: /* what does this mean?? -- jw,
+ * 1/6/94 */
+ case CMD_DELETE:
+ case CMD_UPDATE:
+ ok = ((aclcheck_result = CHECK(ACL_WR)) == ACLCHECK_OK);
+ opstr = "write";
+ break;
+ default:
+ elog(WARN, "ExecCheckPerms: bogus operation %d",
+ operation);
}
}
else
@@ -388,16 +389,16 @@ ExecCheckPerms(CmdType operation,
* and start up the rule manager
* ----------------------------------------------------------------
*/
-static TupleDesc
+static TupleDesc
InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
{
- List *rangeTable;
- int resultRelation;
- Relation intoRelationDesc;
+ List *rangeTable;
+ int resultRelation;
+ Relation intoRelationDesc;
- TupleDesc tupType;
- List *targetList;
- int len;
+ TupleDesc tupType;
+ List *targetList;
+ int len;
/* ----------------
* get information from query descriptor
@@ -434,11 +435,11 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
* initialize the result relation info stuff.
* ----------------
*/
- RelationInfo *resultRelationInfo;
- Index resultRelationIndex;
- RangeTblEntry *rtentry;
- Oid resultRelationOid;
- Relation resultRelationDesc;
+ RelationInfo *resultRelationInfo;
+ Index resultRelationIndex;
+ RangeTblEntry *rtentry;
+ Oid resultRelationOid;
+ Relation resultRelationDesc;
resultRelationIndex = resultRelation;
rtentry = rt_fetch(resultRelationIndex, rangeTable);
@@ -492,8 +493,8 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
* ----------------
*/
{
- int nSlots = ExecCountSlotsNode(plan);
- TupleTable tupleTable = ExecCreateTupleTable(nSlots + 10); /* why add ten? - jolly */
+ int nSlots = ExecCountSlotsNode(plan);
+ TupleTable tupleTable = ExecCreateTupleTable(nSlots + 10); /* why add ten? - jolly */
estate->es_tupleTable = tupleTable;
}
@@ -530,7 +531,7 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
operation == CMD_INSERT)
{
- JunkFilter *j = (JunkFilter *) ExecInitJunkFilter(targetList);
+ JunkFilter *j = (JunkFilter *) ExecInitJunkFilter(targetList);
estate->es_junkFilter = j;
}
@@ -545,10 +546,10 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
if (operation == CMD_SELECT)
{
- char *intoName;
- char archiveMode;
- Oid intoRelationId;
- TupleDesc tupdesc;
+ char *intoName;
+ char archiveMode;
+ Oid intoRelationId;
+ TupleDesc tupdesc;
if (!parseTree->isPortal)
{
@@ -626,8 +627,8 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
static void
EndPlan(Plan * plan, EState * estate)
{
- RelationInfo *resultRelationInfo;
- Relation intoRelationDesc;
+ RelationInfo *resultRelationInfo;
+ Relation intoRelationDesc;
/* ----------------
* get information from state
@@ -647,7 +648,7 @@ EndPlan(Plan * plan, EState * estate)
* ----------------
*/
{
- TupleTable tupleTable = (TupleTable) estate->es_tupleTable;
+ TupleTable tupleTable = (TupleTable) estate->es_tupleTable;
ExecDestroyTupleTable(tupleTable, true); /* was missing last arg */
estate->es_tupleTable = NULL;
@@ -659,7 +660,7 @@ EndPlan(Plan * plan, EState * estate)
*/
if (resultRelationInfo != NULL)
{
- Relation resultRelationDesc;
+ Relation resultRelationDesc;
resultRelationDesc = resultRelationInfo->ri_RelationDesc;
heap_close(resultRelationDesc);
@@ -706,12 +707,12 @@ ExecutePlan(EState * estate,
ScanDirection direction,
void (*printfunc) ())
{
- JunkFilter *junkfilter;
+ JunkFilter *junkfilter;
TupleTableSlot *slot;
- ItemPointer tupleid = NULL;
+ ItemPointer tupleid = NULL;
ItemPointerData tuple_ctid;
- int current_tuple_count;
+ int current_tuple_count;
TupleTableSlot *result;
/* ----------------
@@ -770,11 +771,11 @@ ExecutePlan(EState * estate,
*/
if ((junkfilter = estate->es_junkFilter) != (JunkFilter *) NULL)
{
- Datum datum;
+ Datum datum;
/* NameData attrName; */
- HeapTuple newTuple;
- bool isNull;
+ HeapTuple newTuple;
+ bool isNull;
/* ---------------
* extract the 'ctid' junk attribute.
@@ -822,50 +823,50 @@ ExecutePlan(EState * estate,
switch (operation)
{
- case CMD_SELECT:
- ExecRetrieve(slot, /* slot containing tuple */
- printfunc, /* print function */
- estate); /* */
- result = slot;
- break;
+ case CMD_SELECT:
+ ExecRetrieve(slot, /* slot containing tuple */
+ printfunc, /* print function */
+ estate); /* */
+ result = slot;
+ break;
- case CMD_INSERT:
- ExecAppend(slot, tupleid, estate);
- result = NULL;
- break;
+ case CMD_INSERT:
+ ExecAppend(slot, tupleid, estate);
+ result = NULL;
+ break;
- case CMD_DELETE:
- ExecDelete(slot, tupleid, estate);
- result = NULL;
- break;
+ case CMD_DELETE:
+ ExecDelete(slot, tupleid, estate);
+ result = NULL;
+ break;
- case CMD_UPDATE:
- ExecReplace(slot, tupleid, estate, parseTree);
- result = NULL;
- break;
+ case CMD_UPDATE:
+ ExecReplace(slot, tupleid, estate, parseTree);
+ result = NULL;
+ break;
- /*
- * Total hack. I'm ignoring any accessor functions for
- * Relation, RelationTupleForm, NameData. Assuming that
- * NameData.data has offset 0.
- */
- case CMD_NOTIFY:
- {
- RelationInfo *rInfo = estate->es_result_relation_info;
- Relation rDesc = rInfo->ri_RelationDesc;
+ /*
+ * Total hack. I'm ignoring any accessor functions for
+ * Relation, RelationTupleForm, NameData. Assuming that
+ * NameData.data has offset 0.
+ */
+ case CMD_NOTIFY:
+ {
+ RelationInfo *rInfo = estate->es_result_relation_info;
+ Relation rDesc = rInfo->ri_RelationDesc;
+
+ Async_Notify(rDesc->rd_rel->relname.data);
+ result = NULL;
+ current_tuple_count = 0;
+ numberTuples = 1;
+ elog(DEBUG, "ExecNotify %s", &rDesc->rd_rel->relname);
+ }
+ break;
- Async_Notify(rDesc->rd_rel->relname.data);
+ default:
+ elog(DEBUG, "ExecutePlan: unknown operation in queryDesc");
result = NULL;
- current_tuple_count = 0;
- numberTuples = 1;
- elog(DEBUG, "ExecNotify %s", &rDesc->rd_rel->relname);
- }
- break;
-
- default:
- elog(DEBUG, "ExecutePlan: unknown operation in queryDesc");
- result = NULL;
- break;
+ break;
}
/* ----------------
* check our tuple count.. if we've returned the
@@ -901,8 +902,8 @@ ExecRetrieve(TupleTableSlot * slot,
void (*printfunc) (),
EState * estate)
{
- HeapTuple tuple;
- TupleDesc attrtype;
+ HeapTuple tuple;
+ TupleDesc attrtype;
/* ----------------
* get the heap tuple out of the tuple table slot
@@ -944,11 +945,11 @@ ExecAppend(TupleTableSlot * slot,
ItemPointer tupleid,
EState * estate)
{
- HeapTuple tuple;
- RelationInfo *resultRelationInfo;
- Relation resultRelationDesc;
- int numIndices;
- Oid newId;
+ HeapTuple tuple;
+ RelationInfo *resultRelationInfo;
+ Relation resultRelationDesc;
+ int numIndices;
+ Oid newId;
/* ----------------
* get the heap tuple out of the tuple table slot
@@ -973,7 +974,7 @@ ExecAppend(TupleTableSlot * slot,
if (resultRelationDesc->trigdesc &&
resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecBRInsertTriggers(resultRelationDesc, tuple);
@@ -995,7 +996,7 @@ ExecAppend(TupleTableSlot * slot,
if (resultRelationDesc->rd_att->constr)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecConstraints("ExecAppend", resultRelationDesc, tuple);
@@ -1049,8 +1050,8 @@ ExecDelete(TupleTableSlot * slot,
ItemPointer tupleid,
EState * estate)
{
- RelationInfo *resultRelationInfo;
- Relation resultRelationDesc;
+ RelationInfo *resultRelationInfo;
+ Relation resultRelationDesc;
/* ----------------
* get the result relation information
@@ -1063,7 +1064,7 @@ ExecDelete(TupleTableSlot * slot,
if (resultRelationDesc->trigdesc &&
resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_DELETE] > 0)
{
- bool dodelete;
+ bool dodelete;
dodelete = ExecBRDeleteTriggers(resultRelationDesc, tupleid);
@@ -1118,10 +1119,10 @@ ExecReplace(TupleTableSlot * slot,
EState * estate,
Query * parseTree)
{
- HeapTuple tuple;
- RelationInfo *resultRelationInfo;
- Relation resultRelationDesc;
- int numIndices;
+ HeapTuple tuple;
+ RelationInfo *resultRelationInfo;
+ Relation resultRelationDesc;
+ int numIndices;
/* ----------------
* abort the operation if not running transactions
@@ -1158,7 +1159,7 @@ ExecReplace(TupleTableSlot * slot,
if (resultRelationDesc->trigdesc &&
resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_UPDATE] > 0)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecBRUpdateTriggers(resultRelationDesc, tupleid, tuple);
@@ -1180,7 +1181,7 @@ ExecReplace(TupleTableSlot * slot,
if (resultRelationDesc->rd_att->constr)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecConstraints("ExecReplace", resultRelationDesc, tuple);
@@ -1244,21 +1245,21 @@ ExecReplace(TupleTableSlot * slot,
ExecARUpdateTriggers(resultRelationDesc, tupleid, tuple);
}
-static HeapTuple
+static HeapTuple
ExecAttrDefault(Relation rel, HeapTuple tuple)
{
- int ndef = rel->rd_att->constr->num_defval;
- AttrDefault *attrdef = rel->rd_att->constr->defval;
- ExprContext *econtext = makeNode(ExprContext);
- HeapTuple newtuple;
- Node *expr;
- bool isnull;
- bool isdone;
- Datum val;
- Datum *replValue = NULL;
- char *replNull = NULL;
- char *repl = NULL;
- int i;
+ int ndef = rel->rd_att->constr->num_defval;
+ AttrDefault *attrdef = rel->rd_att->constr->defval;
+ ExprContext *econtext = makeNode(ExprContext);
+ HeapTuple newtuple;
+ Node *expr;
+ bool isnull;
+ bool isdone;
+ Datum val;
+ Datum *replValue = NULL;
+ char *replNull = NULL;
+ char *repl = NULL;
+ int i;
econtext->ecxt_scantuple = NULL; /* scan tuple slot */
econtext->ecxt_innertuple = NULL; /* inner tuple slot */
@@ -1309,18 +1310,18 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
}
-static char *
+static char *
ExecRelCheck(Relation rel, HeapTuple tuple)
{
- int ncheck = rel->rd_att->constr->num_check;
- ConstrCheck *check = rel->rd_att->constr->check;
- ExprContext *econtext = makeNode(ExprContext);
+ int ncheck = rel->rd_att->constr->num_check;
+ ConstrCheck *check = rel->rd_att->constr->check;
+ ExprContext *econtext = makeNode(ExprContext);
TupleTableSlot *slot = makeNode(TupleTableSlot);
- RangeTblEntry *rte = makeNode(RangeTblEntry);
- List *rtlist;
- List *qual;
- bool res;
- int i;
+ RangeTblEntry *rte = makeNode(RangeTblEntry);
+ List *rtlist;
+ List *qual;
+ bool res;
+ int i;
slot->val = tuple;
slot->ttc_shouldFree = false;
@@ -1370,7 +1371,7 @@ ExecRelCheck(Relation rel, HeapTuple tuple)
HeapTuple
ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
{
- HeapTuple newtuple = tuple;
+ HeapTuple newtuple = tuple;
Assert(rel->rd_att->constr);
@@ -1379,7 +1380,7 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
if (rel->rd_att->constr->has_not_null)
{
- int attrChk;
+ int attrChk;
for (attrChk = 1; attrChk <= rel->rd_att->natts; attrChk++)
{
@@ -1391,7 +1392,7 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
if (rel->rd_att->constr->num_check > 0)
{
- char *failed;
+ char *failed;
if ((failed = ExecRelCheck(rel, tuple)) != NULL)
elog(WARN, "%s: rejected due to CHECK constraint %s", caller, failed);
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c
index 89caefd162..7e8cce52c7 100644
--- a/src/backend/executor/execProcnode.c
+++ b/src/backend/executor/execProcnode.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.3 1997/09/07 04:41:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.4 1997/09/08 02:22:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -105,7 +105,7 @@
bool
ExecInitNode(Plan * node, EState * estate, Plan * parent)
{
- bool result;
+ bool result;
/* ----------------
* do nothing when we get to the end
@@ -117,82 +117,82 @@ ExecInitNode(Plan * node, EState * estate, Plan * parent)
switch (nodeTag(node))
{
- /* ----------------
- * control nodes
- * ----------------
- */
- case T_Result:
- result = ExecInitResult((Result *) node, estate, parent);
- break;
-
- case T_Append:
- result = ExecInitAppend((Append *) node, estate, parent);
- break;
-
- /* ----------------
- * scan nodes
- * ----------------
- */
- case T_SeqScan:
- result = ExecInitSeqScan((SeqScan *) node, estate, parent);
- break;
-
- case T_IndexScan:
- result = ExecInitIndexScan((IndexScan *) node, estate, parent);
- break;
-
- /* ----------------
- * join nodes
- * ----------------
- */
- case T_NestLoop:
- result = ExecInitNestLoop((NestLoop *) node, estate, parent);
- break;
-
- case T_MergeJoin:
- result = ExecInitMergeJoin((MergeJoin *) node, estate, parent);
- break;
-
- /* ----------------
- * materialization nodes
- * ----------------
- */
- case T_Material:
- result = ExecInitMaterial((Material *) node, estate, parent);
- break;
-
- case T_Sort:
- result = ExecInitSort((Sort *) node, estate, parent);
- break;
-
- case T_Unique:
- result = ExecInitUnique((Unique *) node, estate, parent);
- break;
-
- case T_Group:
- result = ExecInitGroup((Group *) node, estate, parent);
- break;
-
- case T_Agg:
- result = ExecInitAgg((Agg *) node, estate, parent);
- break;
-
- case T_Hash:
- result = ExecInitHash((Hash *) node, estate, parent);
- break;
-
- case T_HashJoin:
- result = ExecInitHashJoin((HashJoin *) node, estate, parent);
- break;
-
- case T_Tee:
- result = ExecInitTee((Tee *) node, estate, parent);
- break;
-
- default:
- elog(DEBUG, "ExecInitNode: node not yet supported: %d",
- nodeTag(node));
- result = FALSE;
+ /* ----------------
+ * control nodes
+ * ----------------
+ */
+ case T_Result:
+ result = ExecInitResult((Result *) node, estate, parent);
+ break;
+
+ case T_Append:
+ result = ExecInitAppend((Append *) node, estate, parent);
+ break;
+
+ /* ----------------
+ * scan nodes
+ * ----------------
+ */
+ case T_SeqScan:
+ result = ExecInitSeqScan((SeqScan *) node, estate, parent);
+ break;
+
+ case T_IndexScan:
+ result = ExecInitIndexScan((IndexScan *) node, estate, parent);
+ break;
+
+ /* ----------------
+ * join nodes
+ * ----------------
+ */
+ case T_NestLoop:
+ result = ExecInitNestLoop((NestLoop *) node, estate, parent);
+ break;
+
+ case T_MergeJoin:
+ result = ExecInitMergeJoin((MergeJoin *) node, estate, parent);
+ break;
+
+ /* ----------------
+ * materialization nodes
+ * ----------------
+ */
+ case T_Material:
+ result = ExecInitMaterial((Material *) node, estate, parent);
+ break;
+
+ case T_Sort:
+ result = ExecInitSort((Sort *) node, estate, parent);
+ break;
+
+ case T_Unique:
+ result = ExecInitUnique((Unique *) node, estate, parent);
+ break;
+
+ case T_Group:
+ result = ExecInitGroup((Group *) node, estate, parent);
+ break;
+
+ case T_Agg:
+ result = ExecInitAgg((Agg *) node, estate, parent);
+ break;
+
+ case T_Hash:
+ result = ExecInitHash((Hash *) node, estate, parent);
+ break;
+
+ case T_HashJoin:
+ result = ExecInitHashJoin((HashJoin *) node, estate, parent);
+ break;
+
+ case T_Tee:
+ result = ExecInitTee((Tee *) node, estate, parent);
+ break;
+
+ default:
+ elog(DEBUG, "ExecInitNode: node not yet supported: %d",
+ nodeTag(node));
+ result = FALSE;
}
return result;
@@ -220,82 +220,82 @@ ExecProcNode(Plan * node, Plan * parent)
switch (nodeTag(node))
{
- /* ----------------
- * control nodes
- * ----------------
- */
- case T_Result:
- result = ExecResult((Result *) node);
- break;
-
- case T_Append:
- result = ExecProcAppend((Append *) node);
- break;
-
- /* ----------------
- * scan nodes
- * ----------------
- */
- case T_SeqScan:
- result = ExecSeqScan((SeqScan *) node);
- break;
-
- case T_IndexScan:
- result = ExecIndexScan((IndexScan *) node);
- break;
-
- /* ----------------
- * join nodes
- * ----------------
- */
- case T_NestLoop:
- result = ExecNestLoop((NestLoop *) node, parent);
- break;
-
- case T_MergeJoin:
- result = ExecMergeJoin((MergeJoin *) node);
- break;
-
- /* ----------------
- * materialization nodes
- * ----------------
- */
- case T_Material:
- result = ExecMaterial((Material *) node);
- break;
-
- case T_Sort:
- result = ExecSort((Sort *) node);
- break;
-
- case T_Unique:
- result = ExecUnique((Unique *) node);
- break;
-
- case T_Group:
- result = ExecGroup((Group *) node);
- break;
-
- case T_Agg:
- result = ExecAgg((Agg *) node);
- break;
-
- case T_Hash:
- result = ExecHash((Hash *) node);
- break;
-
- case T_HashJoin:
- result = ExecHashJoin((HashJoin *) node);
- break;
-
- case T_Tee:
- result = ExecTee((Tee *) node, parent);
- break;
-
- default:
- elog(DEBUG, "ExecProcNode: node not yet supported: %d",
- nodeTag(node));
- result = FALSE;
+ /* ----------------
+ * control nodes
+ * ----------------
+ */
+ case T_Result:
+ result = ExecResult((Result *) node);
+ break;
+
+ case T_Append:
+ result = ExecProcAppend((Append *) node);
+ break;
+
+ /* ----------------
+ * scan nodes
+ * ----------------
+ */
+ case T_SeqScan:
+ result = ExecSeqScan((SeqScan *) node);
+ break;
+
+ case T_IndexScan:
+ result = ExecIndexScan((IndexScan *) node);
+ break;
+
+ /* ----------------
+ * join nodes
+ * ----------------
+ */
+ case T_NestLoop:
+ result = ExecNestLoop((NestLoop *) node, parent);
+ break;
+
+ case T_MergeJoin:
+ result = ExecMergeJoin((MergeJoin *) node);
+ break;
+
+ /* ----------------
+ * materialization nodes
+ * ----------------
+ */
+ case T_Material:
+ result = ExecMaterial((Material *) node);
+ break;
+
+ case T_Sort:
+ result = ExecSort((Sort *) node);
+ break;
+
+ case T_Unique:
+ result = ExecUnique((Unique *) node);
+ break;
+
+ case T_Group:
+ result = ExecGroup((Group *) node);
+ break;
+
+ case T_Agg:
+ result = ExecAgg((Agg *) node);
+ break;
+
+ case T_Hash:
+ result = ExecHash((Hash *) node);
+ break;
+
+ case T_HashJoin:
+ result = ExecHashJoin((HashJoin *) node);
+ break;
+
+ case T_Tee:
+ result = ExecTee((Tee *) node, parent);
+ break;
+
+ default:
+ elog(DEBUG, "ExecProcNode: node not yet supported: %d",
+ nodeTag(node));
+ result = FALSE;
}
return result;
@@ -309,68 +309,68 @@ ExecCountSlotsNode(Plan * node)
switch (nodeTag(node))
{
- /* ----------------
- * control nodes
- * ----------------
- */
- case T_Result:
- return ExecCountSlotsResult((Result *) node);
-
- case T_Append:
- return ExecCountSlotsAppend((Append *) node);
-
- /* ----------------
- * scan nodes
- * ----------------
- */
- case T_SeqScan:
- return ExecCountSlotsSeqScan((SeqScan *) node);
-
- case T_IndexScan:
- return ExecCountSlotsIndexScan((IndexScan *) node);
-
- /* ----------------
- * join nodes
- * ----------------
- */
- case T_NestLoop:
- return ExecCountSlotsNestLoop((NestLoop *) node);
-
- case T_MergeJoin:
- return ExecCountSlotsMergeJoin((MergeJoin *) node);
-
- /* ----------------
- * materialization nodes
- * ----------------
- */
- case T_Material:
- return ExecCountSlotsMaterial((Material *) node);
-
- case T_Sort:
- return ExecCountSlotsSort((Sort *) node);
-
- case T_Unique:
- return ExecCountSlotsUnique((Unique *) node);
-
- case T_Group:
- return ExecCountSlotsGroup((Group *) node);
-
- case T_Agg:
- return ExecCountSlotsAgg((Agg *) node);
-
- case T_Hash:
- return ExecCountSlotsHash((Hash *) node);
-
- case T_HashJoin:
- return ExecCountSlotsHashJoin((HashJoin *) node);
-
- case T_Tee:
- return ExecCountSlotsTee((Tee *) node);
-
- default:
- elog(WARN, "ExecCountSlotsNode: node not yet supported: %d",
- nodeTag(node));
- break;
+ /* ----------------
+ * control nodes
+ * ----------------
+ */
+ case T_Result:
+ return ExecCountSlotsResult((Result *) node);
+
+ case T_Append:
+ return ExecCountSlotsAppend((Append *) node);
+
+ /* ----------------
+ * scan nodes
+ * ----------------
+ */
+ case T_SeqScan:
+ return ExecCountSlotsSeqScan((SeqScan *) node);
+
+ case T_IndexScan:
+ return ExecCountSlotsIndexScan((IndexScan *) node);
+
+ /* ----------------
+ * join nodes
+ * ----------------
+ */
+ case T_NestLoop:
+ return ExecCountSlotsNestLoop((NestLoop *) node);
+
+ case T_MergeJoin:
+ return ExecCountSlotsMergeJoin((MergeJoin *) node);
+
+ /* ----------------
+ * materialization nodes
+ * ----------------
+ */
+ case T_Material:
+ return ExecCountSlotsMaterial((Material *) node);
+
+ case T_Sort:
+ return ExecCountSlotsSort((Sort *) node);
+
+ case T_Unique:
+ return ExecCountSlotsUnique((Unique *) node);
+
+ case T_Group:
+ return ExecCountSlotsGroup((Group *) node);
+
+ case T_Agg:
+ return ExecCountSlotsAgg((Agg *) node);
+
+ case T_Hash:
+ return ExecCountSlotsHash((Hash *) node);
+
+ case T_HashJoin:
+ return ExecCountSlotsHashJoin((HashJoin *) node);
+
+ case T_Tee:
+ return ExecCountSlotsTee((Tee *) node);
+
+ default:
+ elog(WARN, "ExecCountSlotsNode: node not yet supported: %d",
+ nodeTag(node));
+ break;
}
return 0;
}
@@ -399,85 +399,85 @@ ExecEndNode(Plan * node, Plan * parent)
switch (nodeTag(node))
{
- /* ----------------
- * control nodes
- * ----------------
- */
- case T_Result:
- ExecEndResult((Result *) node);
- break;
-
- case T_Append:
- ExecEndAppend((Append *) node);
- break;
-
- /* ----------------
- * scan nodes
- * ----------------
- */
- case T_SeqScan:
- ExecEndSeqScan((SeqScan *) node);
- break;
-
- case T_IndexScan:
- ExecEndIndexScan((IndexScan *) node);
- break;
-
- /* ----------------
- * join nodes
- * ----------------
- */
- case T_NestLoop:
- ExecEndNestLoop((NestLoop *) node);
- break;
-
- case T_MergeJoin:
- ExecEndMergeJoin((MergeJoin *) node);
- break;
-
- /* ----------------
- * materialization nodes
- * ----------------
- */
- case T_Material:
- ExecEndMaterial((Material *) node);
- break;
-
- case T_Sort:
- ExecEndSort((Sort *) node);
- break;
-
- case T_Unique:
- ExecEndUnique((Unique *) node);
- break;
-
- case T_Group:
- ExecEndGroup((Group *) node);
- break;
-
- case T_Agg:
- ExecEndAgg((Agg *) node);
- break;
-
- /* ----------------
- * XXX add hooks to these
- * ----------------
- */
- case T_Hash:
- ExecEndHash((Hash *) node);
- break;
-
- case T_HashJoin:
- ExecEndHashJoin((HashJoin *) node);
- break;
-
- case T_Tee:
- ExecEndTee((Tee *) node, parent);
- break;
-
- default:
- elog(DEBUG, "ExecEndNode: node not yet supported",
- nodeTag(node));
- break;
+ /* ----------------
+ * control nodes
+ * ----------------
+ */
+ case T_Result:
+ ExecEndResult((Result *) node);
+ break;
+
+ case T_Append:
+ ExecEndAppend((Append *) node);
+ break;
+
+ /* ----------------
+ * scan nodes
+ * ----------------
+ */
+ case T_SeqScan:
+ ExecEndSeqScan((SeqScan *) node);
+ break;
+
+ case T_IndexScan:
+ ExecEndIndexScan((IndexScan *) node);
+ break;
+
+ /* ----------------
+ * join nodes
+ * ----------------
+ */
+ case T_NestLoop:
+ ExecEndNestLoop((NestLoop *) node);
+ break;
+
+ case T_MergeJoin:
+ ExecEndMergeJoin((MergeJoin *) node);
+ break;
+
+ /* ----------------
+ * materialization nodes
+ * ----------------
+ */
+ case T_Material:
+ ExecEndMaterial((Material *) node);
+ break;
+
+ case T_Sort:
+ ExecEndSort((Sort *) node);
+ break;
+
+ case T_Unique:
+ ExecEndUnique((Unique *) node);
+ break;
+
+ case T_Group:
+ ExecEndGroup((Group *) node);
+ break;
+
+ case T_Agg:
+ ExecEndAgg((Agg *) node);
+ break;
+
+ /* ----------------
+ * XXX add hooks to these
+ * ----------------
+ */
+ case T_Hash:
+ ExecEndHash((Hash *) node);
+ break;
+
+ case T_HashJoin:
+ ExecEndHashJoin((HashJoin *) node);
+ break;
+
+ case T_Tee:
+ ExecEndTee((Tee *) node, parent);
+ break;
+
+ default:
+ elog(DEBUG, "ExecEndNode: node not yet supported",
+ nodeTag(node));
+ break;
}
}
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 7b8cb18ef2..a1e0140265 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.13 1997/09/07 04:41:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.14 1997/09/08 02:22:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,31 +65,31 @@
* Currently only used by ExecHashGetBucket and set only by ExecMakeVarConst
* and by ExecEvalArrayRef.
*/
-bool execConstByVal;
-int execConstLen;
+bool execConstByVal;
+int execConstLen;
/* static functions decls */
-static Datum ExecEvalAggreg(Aggreg * agg, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalAggreg(Aggreg * agg, ExprContext * econtext, bool * isNull);
static Datum
ExecEvalArrayRef(ArrayRef * arrayRef, ExprContext * econtext,
bool * isNull, bool * isDone);
-static Datum ExecEvalAnd(Expr * andExpr, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalAnd(Expr * andExpr, ExprContext * econtext, bool * isNull);
static Datum
ExecEvalFunc(Expr * funcClause, ExprContext * econtext,
bool * isNull, bool * isDone);
static void
ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext * econtext,
List * argList, Datum argV[], bool * argIsDone);
-static Datum ExecEvalNot(Expr * notclause, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalNot(Expr * notclause, ExprContext * econtext, bool * isNull);
static Datum
ExecEvalOper(Expr * opClause, ExprContext * econtext,
bool * isNull);
-static Datum ExecEvalOr(Expr * orExpr, ExprContext * econtext, bool * isNull);
-static Datum ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalOr(Expr * orExpr, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull);
static Datum
ExecMakeFunctionResult(Node * node, List * arguments,
ExprContext * econtext, bool * isNull, bool * isDone);
-static bool ExecQualClause(Node * clause, ExprContext * econtext);
+static bool ExecQualClause(Node * clause, ExprContext * econtext);
/* --------------------------------
* ExecEvalArrayRef
@@ -100,24 +100,24 @@ static bool ExecQualClause(Node * clause, ExprContext * econtext);
*
* --------------------------------
*/
-static Datum
+static Datum
ExecEvalArrayRef(ArrayRef * arrayRef,
ExprContext * econtext,
bool * isNull,
bool * isDone)
{
- bool dummy;
- int i = 0,
- j = 0;
- ArrayType *array_scanner;
- List *upperIndexpr,
- *lowerIndexpr;
- Node *assgnexpr;
- List *elt;
- IntArray upper,
- lower;
- int *lIndex;
- char *dataPtr;
+ bool dummy;
+ int i = 0,
+ j = 0;
+ ArrayType *array_scanner;
+ List *upperIndexpr,
+ *lowerIndexpr;
+ Node *assgnexpr;
+ List *elt;
+ IntArray upper,
+ lower;
+ int *lIndex;
+ char *dataPtr;
*isNull = false;
array_scanner = (ArrayType *) ExecEvalExpr(arrayRef->refexpr,
@@ -199,7 +199,7 @@ ExecEvalArrayRef(ArrayRef * arrayRef,
* aggregate found in the given expression context.
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalAggreg(Aggreg * agg, ExprContext * econtext, bool * isNull)
{
@@ -230,17 +230,17 @@ ExecEvalAggreg(Aggreg * agg, ExprContext * econtext, bool * isNull)
* We have an Assert to make sure this entry condition is met.
*
* ---------------------------------------------------------------- */
-static Datum
+static Datum
ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull)
{
- Datum result;
+ Datum result;
TupleTableSlot *slot;
- AttrNumber attnum;
- HeapTuple heapTuple;
- TupleDesc tuple_type;
- Buffer buffer;
- bool byval;
- int16 len;
+ AttrNumber attnum;
+ HeapTuple heapTuple;
+ TupleDesc tuple_type;
+ Buffer buffer;
+ bool byval;
+ int16 len;
/* ----------------
* get the slot we want
@@ -248,18 +248,18 @@ ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull)
*/
switch (variable->varno)
{
- case INNER: /* get the tuple from the inner node */
- slot = econtext->ecxt_innertuple;
- break;
+ case INNER: /* get the tuple from the inner node */
+ slot = econtext->ecxt_innertuple;
+ break;
- case OUTER: /* get the tuple from the outer node */
- slot = econtext->ecxt_outertuple;
- break;
+ case OUTER: /* get the tuple from the outer node */
+ slot = econtext->ecxt_outertuple;
+ break;
- default: /* get the tuple from the relation being
+ default: /* get the tuple from the relation being
* scanned */
- slot = econtext->ecxt_scantuple;
- break;
+ slot = econtext->ecxt_scantuple;
+ break;
}
/* ----------------
@@ -286,8 +286,8 @@ ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull)
if (attnum == InvalidAttrNumber)
{
TupleTableSlot *tempSlot;
- TupleDesc td;
- HeapTuple tup;
+ TupleDesc td;
+ HeapTuple tup;
tempSlot = makeNode(TupleTableSlot);
tempSlot->ttc_shouldFree = false;
@@ -380,11 +380,11 @@ Datum
ExecEvalParam(Param * expression, ExprContext * econtext, bool * isNull)
{
- char *thisParameterName;
- int thisParameterKind;
- AttrNumber thisParameterId;
- int matchFound;
- ParamListInfo paramList;
+ char *thisParameterName;
+ int thisParameterKind;
+ AttrNumber thisParameterId;
+ int matchFound;
+ ParamListInfo paramList;
thisParameterName = expression->paramname;
thisParameterKind = expression->paramkind;
@@ -409,44 +409,44 @@ ExecEvalParam(Param * expression, ExprContext * econtext, bool * isNull)
{
switch (thisParameterKind)
{
- case PARAM_NAMED:
- if (thisParameterKind == paramList->kind &&
- strcmp(paramList->name, thisParameterName) == 0)
- {
- matchFound = 1;
- }
- break;
- case PARAM_NUM:
- if (thisParameterKind == paramList->kind &&
- paramList->id == thisParameterId)
- {
- matchFound = 1;
- }
- break;
- case PARAM_OLD:
- case PARAM_NEW:
- if (thisParameterKind == paramList->kind &&
- paramList->id == thisParameterId)
- {
- matchFound = 1;
-
- /*
- * sanity check
- */
- if (strcmp(paramList->name, thisParameterName) != 0)
+ case PARAM_NAMED:
+ if (thisParameterKind == paramList->kind &&
+ strcmp(paramList->name, thisParameterName) == 0)
{
- elog(WARN,
- "ExecEvalParam: new/old params with same id & diff names");
+ matchFound = 1;
}
- }
- break;
- default:
+ break;
+ case PARAM_NUM:
+ if (thisParameterKind == paramList->kind &&
+ paramList->id == thisParameterId)
+ {
+ matchFound = 1;
+ }
+ break;
+ case PARAM_OLD:
+ case PARAM_NEW:
+ if (thisParameterKind == paramList->kind &&
+ paramList->id == thisParameterId)
+ {
+ matchFound = 1;
+
+ /*
+ * sanity check
+ */
+ if (strcmp(paramList->name, thisParameterName) != 0)
+ {
+ elog(WARN,
+ "ExecEvalParam: new/old params with same id & diff names");
+ }
+ }
+ break;
+ default:
- /*
- * oops! this is not supposed to happen!
- */
- elog(WARN, "ExecEvalParam: invalid paramkind %d",
- thisParameterKind);
+ /*
+ * oops! this is not supposed to happen!
+ */
+ elog(WARN, "ExecEvalParam: invalid paramkind %d",
+ thisParameterKind);
}
if (!matchFound)
{
@@ -477,10 +477,10 @@ ExecEvalParam(Param * expression, ExprContext * econtext, bool * isNull)
if (expression->param_tlist != NIL)
{
- HeapTuple tup;
- Datum value;
- List *tlist = expression->param_tlist;
- TargetEntry *tle = (TargetEntry *) lfirst(tlist);
+ HeapTuple tup;
+ Datum value;
+ List *tlist = expression->param_tlist;
+ TargetEntry *tle = (TargetEntry *) lfirst(tlist);
TupleTableSlot *slot = (TupleTableSlot *) paramList->value;
tup = slot->val;
@@ -508,12 +508,12 @@ ExecEvalParam(Param * expression, ExprContext * econtext, bool * isNull)
* ----------------
*/
#ifdef NOT_USED
-static char *
+static char *
GetAttributeByNum(TupleTableSlot * slot,
AttrNumber attrno,
bool * isNull)
{
- Datum retval;
+ Datum retval;
if (!AttributeNumberIsValid(attrno))
elog(WARN, "GetAttributeByNum: Invalid attribute number");
@@ -545,7 +545,7 @@ GetAttributeByNum(TupleTableSlot * slot,
/* XXX char16 name for catalogs */
#ifdef NOT_USED
-char *
+char *
att_by_num(TupleTableSlot * slot,
AttrNumber attrno,
bool * isNull)
@@ -555,15 +555,15 @@ att_by_num(TupleTableSlot * slot,
#endif
-char *
+char *
GetAttributeByName(TupleTableSlot * slot, char *attname, bool * isNull)
{
- AttrNumber attrno;
- TupleDesc tupdesc;
- HeapTuple tuple;
- Datum retval;
- int natts;
- int i;
+ AttrNumber attrno;
+ TupleDesc tupdesc;
+ HeapTuple tuple;
+ Datum retval;
+ int natts;
+ int i;
if (attname == NULL)
elog(WARN, "GetAttributeByName: Invalid attribute name");
@@ -608,7 +608,7 @@ GetAttributeByName(TupleTableSlot * slot, char *attname, bool * isNull)
/* XXX char16 name for catalogs */
#ifdef NOT_USED
-char *
+char *
att_by_name(TupleTableSlot * slot, char *attname, bool * isNull)
{
return (GetAttributeByName(slot, attname, isNull));
@@ -623,10 +623,10 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
Datum argV[],
bool * argIsDone)
{
- int i;
- bool argIsNull,
- *nullVect;
- List *arg;
+ int i;
+ bool argIsNull,
+ *nullVect;
+ List *arg;
nullVect = fcache->nullVect;
@@ -663,18 +663,18 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
* ExecMakeFunctionResult
* ----------------
*/
-static Datum
+static Datum
ExecMakeFunctionResult(Node * node,
List * arguments,
ExprContext * econtext,
bool * isNull,
bool * isDone)
{
- Datum argv[MAXFMGRARGS];
+ Datum argv[MAXFMGRARGS];
FunctionCachePtr fcache;
- Func *funcNode = NULL;
- Oper *operNode = NULL;
- bool funcisset = false;
+ Func *funcNode = NULL;
+ Oper *operNode = NULL;
+ bool funcisset = false;
/*
* This is kind of ugly, Func nodes now have targetlists so that we
@@ -703,7 +703,7 @@ ExecMakeFunctionResult(Node * node,
*/
if (fcache->nargs != 0)
{
- bool argDone;
+ bool argDone;
if (fcache->nargs > MAXFMGRARGS)
elog(WARN, "ExecMakeFunctionResult: too many arguments");
@@ -774,7 +774,7 @@ ExecMakeFunctionResult(Node * node,
*/
if (fcache->language == SQLlanguageId)
{
- Datum result;
+ Datum result;
Assert(funcNode);
result = postquel_function(funcNode, (char **) argv, isNull, isDone);
@@ -788,7 +788,7 @@ ExecMakeFunctionResult(Node * node,
*/
if ((*isDone) && (fcache->hasSetArg))
{
- bool argDone;
+ bool argDone;
ExecEvalFuncArgs(fcache, econtext, arguments, argv, &argDone);
@@ -828,7 +828,7 @@ ExecMakeFunctionResult(Node * node,
}
else
{
- int i;
+ int i;
if (isDone)
*isDone = true;
@@ -863,13 +863,13 @@ ExecMakeFunctionResult(Node * node,
* ExecEvalOper
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalOper(Expr * opClause, ExprContext * econtext, bool * isNull)
{
- Oper *op;
- List *argList;
+ Oper *op;
+ List *argList;
FunctionCachePtr fcache;
- bool isDone;
+ bool isDone;
/* ----------------
* an opclause is a list (op args). (I think)
@@ -908,14 +908,14 @@ ExecEvalOper(Expr * opClause, ExprContext * econtext, bool * isNull)
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalFunc(Expr * funcClause,
ExprContext * econtext,
bool * isNull,
bool * isDone)
{
- Func *func;
- List *argList;
+ Func *func;
+ List *argList;
FunctionCachePtr fcache;
/* ----------------
@@ -963,12 +963,12 @@ ExecEvalFunc(Expr * funcClause,
* need to know this, mind you...
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalNot(Expr * notclause, ExprContext * econtext, bool * isNull)
{
- Datum expr_value;
- Node *clause;
- bool isDone;
+ Datum expr_value;
+ Node *clause;
+ bool isDone;
clause = lfirst(notclause->args);
@@ -1002,14 +1002,14 @@ ExecEvalNot(Expr * notclause, ExprContext * econtext, bool * isNull)
* ExecEvalOr
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalOr(Expr * orExpr, ExprContext * econtext, bool * isNull)
{
- List *clauses;
- List *clause;
- bool isDone;
- bool IsNull;
- Datum const_value = 0;
+ List *clauses;
+ List *clause;
+ bool isDone;
+ bool IsNull;
+ Datum const_value = 0;
IsNull = false;
clauses = orExpr->args;
@@ -1066,14 +1066,14 @@ ExecEvalOr(Expr * orExpr, ExprContext * econtext, bool * isNull)
* ExecEvalAnd
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalAnd(Expr * andExpr, ExprContext * econtext, bool * isNull)
{
- List *clauses;
- List *clause;
- Datum const_value = 0;
- bool isDone;
- bool IsNull;
+ List *clauses;
+ List *clause;
+ Datum const_value = 0;
+ bool isDone;
+ bool IsNull;
IsNull = false;
@@ -1149,7 +1149,7 @@ ExecEvalExpr(Node * expression,
bool * isNull,
bool * isDone)
{
- Datum retDatum = 0;
+ Datum retDatum = 0;
*isNull = false;
@@ -1173,68 +1173,68 @@ ExecEvalExpr(Node * expression,
switch (nodeTag(expression))
{
- case T_Var:
- retDatum = (Datum) ExecEvalVar((Var *) expression, econtext, isNull);
- break;
- case T_Const:
- {
- Const *con = (Const *) expression;
+ case T_Var:
+ retDatum = (Datum) ExecEvalVar((Var *) expression, econtext, isNull);
+ break;
+ case T_Const:
+ {
+ Const *con = (Const *) expression;
- if (con->constisnull)
- *isNull = true;
- retDatum = con->constvalue;
+ if (con->constisnull)
+ *isNull = true;
+ retDatum = con->constvalue;
+ break;
+ }
+ case T_Param:
+ retDatum = (Datum) ExecEvalParam((Param *) expression, econtext, isNull);
break;
- }
- case T_Param:
- retDatum = (Datum) ExecEvalParam((Param *) expression, econtext, isNull);
- break;
- case T_Iter:
- retDatum = (Datum) ExecEvalIter((Iter *) expression,
- econtext,
- isNull,
- isDone);
- break;
- case T_Aggreg:
- retDatum = (Datum) ExecEvalAggreg((Aggreg *) expression,
- econtext,
- isNull);
- break;
- case T_ArrayRef:
- retDatum = (Datum) ExecEvalArrayRef((ArrayRef *) expression,
+ case T_Iter:
+ retDatum = (Datum) ExecEvalIter((Iter *) expression,
econtext,
isNull,
isDone);
- break;
- case T_Expr:
- {
- Expr *expr = (Expr *) expression;
-
- switch (expr->opType)
+ break;
+ case T_Aggreg:
+ retDatum = (Datum) ExecEvalAggreg((Aggreg *) expression,
+ econtext,
+ isNull);
+ break;
+ case T_ArrayRef:
+ retDatum = (Datum) ExecEvalArrayRef((ArrayRef *) expression,
+ econtext,
+ isNull,
+ isDone);
+ break;
+ case T_Expr:
{
- case OP_EXPR:
- retDatum = (Datum) ExecEvalOper(expr, econtext, isNull);
- break;
- case FUNC_EXPR:
- retDatum = (Datum) ExecEvalFunc(expr, econtext, isNull, isDone);
- break;
- case OR_EXPR:
- retDatum = (Datum) ExecEvalOr(expr, econtext, isNull);
- break;
- case AND_EXPR:
- retDatum = (Datum) ExecEvalAnd(expr, econtext, isNull);
- break;
- case NOT_EXPR:
- retDatum = (Datum) ExecEvalNot(expr, econtext, isNull);
- break;
- default:
- elog(WARN, "ExecEvalExpr: unknown expression type");
+ Expr *expr = (Expr *) expression;
+
+ switch (expr->opType)
+ {
+ case OP_EXPR:
+ retDatum = (Datum) ExecEvalOper(expr, econtext, isNull);
+ break;
+ case FUNC_EXPR:
+ retDatum = (Datum) ExecEvalFunc(expr, econtext, isNull, isDone);
+ break;
+ case OR_EXPR:
+ retDatum = (Datum) ExecEvalOr(expr, econtext, isNull);
+ break;
+ case AND_EXPR:
+ retDatum = (Datum) ExecEvalAnd(expr, econtext, isNull);
+ break;
+ case NOT_EXPR:
+ retDatum = (Datum) ExecEvalNot(expr, econtext, isNull);
+ break;
+ default:
+ elog(WARN, "ExecEvalExpr: unknown expression type");
+ break;
+ }
break;
}
+ default:
+ elog(WARN, "ExecEvalExpr: unknown expression type");
break;
- }
- default:
- elog(WARN, "ExecEvalExpr: unknown expression type");
- break;
}
return retDatum;
@@ -1256,12 +1256,12 @@ ExecEvalExpr(Node * expression,
* rest of the qualification)
* ----------------------------------------------------------------
*/
-static bool
+static bool
ExecQualClause(Node * clause, ExprContext * econtext)
{
- Datum expr_value;
- bool isNull;
- bool isDone;
+ Datum expr_value;
+ bool isNull;
+ bool isDone;
/* when there is a null clause, consider the qualification to be true */
if (clause == NULL)
@@ -1304,8 +1304,8 @@ ExecQualClause(Node * clause, ExprContext * econtext)
bool
ExecQual(List * qual, ExprContext * econtext)
{
- List *clause;
- bool result;
+ List *clause;
+ bool result;
/* ----------------
* debugging stuff
@@ -1356,9 +1356,9 @@ ExecQual(List * qual, ExprContext * econtext)
int
ExecTargetListLength(List * targetlist)
{
- int len;
- List *tl;
- TargetEntry *curTle;
+ int len;
+ List *tl;
+ TargetEntry *curTle;
len = 0;
foreach(tl, targetlist)
@@ -1380,7 +1380,7 @@ ExecTargetListLength(List * targetlist)
* expression context and return a tuple.
* ----------------------------------------------------------------
*/
-static HeapTuple
+static HeapTuple
ExecTargetList(List * targetlist,
int nodomains,
TupleDesc targettype,
@@ -1388,18 +1388,18 @@ ExecTargetList(List * targetlist,
ExprContext * econtext,
bool * isDone)
{
- char nulls_array[64];
- bool fjNullArray[64];
- bool *fjIsNull;
- char *null_head;
- List *tl;
- TargetEntry *tle;
- Node *expr;
- Resdom *resdom;
- AttrNumber resind;
- Datum constvalue;
- HeapTuple newTuple;
- bool isNull;
+ char nulls_array[64];
+ bool fjNullArray[64];
+ bool *fjIsNull;
+ char *null_head;
+ List *tl;
+ TargetEntry *tle;
+ Node *expr;
+ Resdom *resdom;
+ AttrNumber resind;
+ Datum constvalue;
+ HeapTuple newTuple;
+ bool isNull;
/* ----------------
* debugging stuff
@@ -1497,12 +1497,12 @@ ExecTargetList(List * targetlist,
}
else
{
- int curNode;
- Resdom *fjRes;
- List *fjTlist = (List *) tle->expr;
- Fjoin *fjNode = tle->fjoin;
- int nNodes = fjNode->fj_nNodes;
- DatumPtr results = fjNode->fj_results;
+ int curNode;
+ Resdom *fjRes;
+ List *fjTlist = (List *) tle->expr;
+ Fjoin *fjNode = tle->fjoin;
+ int nNodes = fjNode->fj_nNodes;
+ DatumPtr results = fjNode->fj_results;
ExecEvalFjoin(tle, econtext, fjIsNull, isDone);
if (*isDone)
@@ -1529,7 +1529,7 @@ ExecTargetList(List * targetlist,
curNode++, fjTlist = lnext(fjTlist))
{
#if 0 /* what is this?? */
- Node *outernode = lfirst(fjTlist);
+ Node *outernode = lfirst(fjTlist);
fjRes = (Resdom *) outernode->iterexpr;
#endif
@@ -1582,12 +1582,12 @@ TupleTableSlot *
ExecProject(ProjectionInfo * projInfo, bool * isDone)
{
TupleTableSlot *slot;
- List *targetlist;
- int len;
- TupleDesc tupType;
- Datum *tupValue;
- ExprContext *econtext;
- HeapTuple newTuple;
+ List *targetlist;
+ int len;
+ TupleDesc tupType;
+ Datum *tupValue;
+ ExprContext *econtext;
+ HeapTuple newTuple;
/* ----------------
* sanity checks
diff --git a/src/backend/executor/execScan.c b/src/backend/executor/execScan.c
index 6ea50bb2a9..84dac56a23 100644
--- a/src/backend/executor/execScan.c
+++ b/src/backend/executor/execScan.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.4 1997/09/07 04:41:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.5 1997/09/08 02:22:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,15 +48,15 @@ ExecScan(Scan * node,
* tuple */
{
CommonScanState *scanstate;
- EState *estate;
- List *qual;
- bool isDone;
+ EState *estate;
+ List *qual;
+ bool isDone;
TupleTableSlot *slot;
TupleTableSlot *resultSlot;
- HeapTuple newTuple;
+ HeapTuple newTuple;
- ExprContext *econtext;
+ ExprContext *econtext;
ProjectionInfo *projInfo;
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 287f75699a..373e94ae1a 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.7 1997/09/07 04:41:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.8 1997/09/08 02:22:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -153,7 +153,7 @@ TupleTable /* return: address of table */
ExecCreateTupleTable(int initialSize) /* initial number of slots
* in table */
{
- TupleTable newtable; /* newly allocated table */
+ TupleTable newtable; /* newly allocated table */
TupleTableSlot *array; /* newly allocated slot array */
/* ----------------
@@ -200,9 +200,9 @@ ExecDestroyTupleTable(TupleTable table, /* tuple table */
bool shouldFree) /* true if we should free slot
* contents */
{
- int next; /* next avaliable slot */
+ int next; /* next avaliable slot */
TupleTableSlot *array; /* start of table array */
- int i; /* counter */
+ int i; /* counter */
/* ----------------
* sanity checks
@@ -229,8 +229,8 @@ ExecDestroyTupleTable(TupleTable table, /* tuple table */
if (shouldFree)
for (i = 0; i < next; i++)
{
- TupleTableSlot slot;
- HeapTuple tuple;
+ TupleTableSlot slot;
+ HeapTuple tuple;
slot = array[i];
tuple = slot.val;
@@ -280,7 +280,7 @@ TupleTableSlot * /* return: the slot allocated in the tuple
* table */
ExecAllocTableSlot(TupleTable table)
{
- int slotnum; /* new slot number */
+ int slotnum; /* new slot number */
/* ----------------
* sanity checks
@@ -383,7 +383,7 @@ ExecStoreTuple(HeapTuple tuple, /* tuple to store */
TupleTableSlot * /* return: slot passed */
ExecClearTuple(TupleTableSlot * slot) /* slot in which to store tuple */
{
- HeapTuple oldtuple; /* prior contents of slot */
+ HeapTuple oldtuple; /* prior contents of slot */
/* ----------------
* sanity checks
@@ -462,7 +462,7 @@ ExecSetSlotPolicy(TupleTableSlot * slot, /* slot to change */
bool shouldFree) /* true if we call pfree() when we
* gc. */
{
- bool old_shouldFree = slot->ttc_shouldFree;
+ bool old_shouldFree = slot->ttc_shouldFree;
slot->ttc_shouldFree = shouldFree;
@@ -490,7 +490,7 @@ TupleDesc /* return: old slot tuple descriptor */
ExecSetSlotDescriptor(TupleTableSlot * slot, /* slot to change */
TupleDesc tupdesc) /* tuple descriptor */
{
- TupleDesc old_tupdesc = slot->ttc_tupleDescriptor;
+ TupleDesc old_tupdesc = slot->ttc_tupleDescriptor;
slot->ttc_tupleDescriptor = tupdesc;
return old_tupdesc;
@@ -521,7 +521,7 @@ TupleDesc /* return: old slot tuple descriptor */
ExecSetNewSlotDescriptor(TupleTableSlot * slot, /* slot to change */
TupleDesc tupdesc) /* tuple descriptor */
{
- TupleDesc old_tupdesc = slot->ttc_tupleDescriptor;
+ TupleDesc old_tupdesc = slot->ttc_tupleDescriptor;
slot->ttc_tupleDescriptor = tupdesc;
slot->ttc_descIsNew = true;
@@ -557,7 +557,7 @@ Buffer /* return: old slot buffer */
ExecSetSlotBuffer(TupleTableSlot * slot, /* slot to change */
Buffer b) /* tuple descriptor */
{
- Buffer oldb = slot->ttc_buffer;
+ Buffer oldb = slot->ttc_buffer;
slot->ttc_buffer = b;
@@ -578,7 +578,7 @@ void
ExecIncrSlotBufferRefcnt(TupleTableSlot * slot) /* slot to bump refcnt */
{
/* Buffer b = SlotBuffer((TupleTableSlot*) slot); */
- Buffer b = slot->ttc_buffer;
+ Buffer b = slot->ttc_buffer;
if (BufferIsValid(b))
IncrBufferRefCount(b);
@@ -599,7 +599,7 @@ ExecIncrSlotBufferRefcnt(TupleTableSlot * slot) /* slot to bump refcnt */
bool /* return: true if tuple in slot is NULL */
TupIsNull(TupleTableSlot * slot) /* slot to check */
{
- HeapTuple tuple; /* contents of slot (returned) */
+ HeapTuple tuple; /* contents of slot (returned) */
/* ----------------
* if the slot itself is null then we return true
@@ -733,136 +733,136 @@ NodeGetResultTupleSlot(Plan * node)
switch (nodeTag(node))
{
- case T_Result:
- {
- ResultState *resstate = ((Result *) node)->resstate;
-
- slot = resstate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Result:
+ {
+ ResultState *resstate = ((Result *) node)->resstate;
- case T_SeqScan:
- {
- CommonScanState *scanstate = ((SeqScan *) node)->scanstate;
+ slot = resstate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = scanstate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_SeqScan:
+ {
+ CommonScanState *scanstate = ((SeqScan *) node)->scanstate;
- case T_NestLoop:
- {
- NestLoopState *nlstate = ((NestLoop *) node)->nlstate;
+ slot = scanstate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = nlstate->jstate.cs_ResultTupleSlot;
- }
- break;
+ case T_NestLoop:
+ {
+ NestLoopState *nlstate = ((NestLoop *) node)->nlstate;
- case T_Append:
- {
- Append *n = (Append *) node;
- AppendState *unionstate;
- List *unionplans;
- int whichplan;
- Plan *subplan;
-
- unionstate = n->unionstate;
- unionplans = n->unionplans;
- whichplan = unionstate->as_whichplan;
-
- subplan = (Plan *) nth(whichplan, unionplans);
- slot = NodeGetResultTupleSlot(subplan);
+ slot = nlstate->jstate.cs_ResultTupleSlot;
+ }
break;
- }
- case T_IndexScan:
- {
- CommonScanState *scanstate = ((IndexScan *) node)->scan.scanstate;
+ case T_Append:
+ {
+ Append *n = (Append *) node;
+ AppendState *unionstate;
+ List *unionplans;
+ int whichplan;
+ Plan *subplan;
+
+ unionstate = n->unionstate;
+ unionplans = n->unionplans;
+ whichplan = unionstate->as_whichplan;
+
+ subplan = (Plan *) nth(whichplan, unionplans);
+ slot = NodeGetResultTupleSlot(subplan);
+ break;
+ }
- slot = scanstate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_IndexScan:
+ {
+ CommonScanState *scanstate = ((IndexScan *) node)->scan.scanstate;
- case T_Material:
- {
- MaterialState *matstate = ((Material *) node)->matstate;
+ slot = scanstate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = matstate->csstate.css_ScanTupleSlot;
- }
- break;
+ case T_Material:
+ {
+ MaterialState *matstate = ((Material *) node)->matstate;
- case T_Sort:
- {
- SortState *sortstate = ((Sort *) node)->sortstate;
+ slot = matstate->csstate.css_ScanTupleSlot;
+ }
+ break;
- slot = sortstate->csstate.css_ScanTupleSlot;
- }
- break;
+ case T_Sort:
+ {
+ SortState *sortstate = ((Sort *) node)->sortstate;
- case T_Agg:
- {
- AggState *aggstate = ((Agg *) node)->aggstate;
+ slot = sortstate->csstate.css_ScanTupleSlot;
+ }
+ break;
- slot = aggstate->csstate.cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Agg:
+ {
+ AggState *aggstate = ((Agg *) node)->aggstate;
- case T_Group:
- {
- GroupState *grpstate = ((Group *) node)->grpstate;
+ slot = aggstate->csstate.cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = grpstate->csstate.cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Group:
+ {
+ GroupState *grpstate = ((Group *) node)->grpstate;
- case T_Hash:
- {
- HashState *hashstate = ((Hash *) node)->hashstate;
+ slot = grpstate->csstate.cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = hashstate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Hash:
+ {
+ HashState *hashstate = ((Hash *) node)->hashstate;
- case T_Unique:
- {
- UniqueState *uniquestate = ((Unique *) node)->uniquestate;
+ slot = hashstate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = uniquestate->cs_ResultTupleSlot;
- }
- break;
+ case T_Unique:
+ {
+ UniqueState *uniquestate = ((Unique *) node)->uniquestate;
- case T_MergeJoin:
- {
- MergeJoinState *mergestate = ((MergeJoin *) node)->mergestate;
+ slot = uniquestate->cs_ResultTupleSlot;
+ }
+ break;
- slot = mergestate->jstate.cs_ResultTupleSlot;
- }
- break;
+ case T_MergeJoin:
+ {
+ MergeJoinState *mergestate = ((MergeJoin *) node)->mergestate;
- case T_HashJoin:
- {
- HashJoinState *hashjoinstate = ((HashJoin *) node)->hashjoinstate;
+ slot = mergestate->jstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = hashjoinstate->jstate.cs_ResultTupleSlot;
- }
- break;
+ case T_HashJoin:
+ {
+ HashJoinState *hashjoinstate = ((HashJoin *) node)->hashjoinstate;
- case T_Tee:
- {
- TeeState *teestate = ((Tee *) node)->teestate;
+ slot = hashjoinstate->jstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = teestate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Tee:
+ {
+ TeeState *teestate = ((Tee *) node)->teestate;
- default:
- /* ----------------
- * should never get here
- * ----------------
- */
- elog(WARN, "NodeGetResultTupleSlot: node not yet supported: %d ",
- nodeTag(node));
+ slot = teestate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- return NULL;
+ default:
+ /* ----------------
+ * should never get here
+ * ----------------
+ */
+ elog(WARN, "NodeGetResultTupleSlot: node not yet supported: %d ",
+ nodeTag(node));
+
+ return NULL;
}
return slot;
}
@@ -897,7 +897,7 @@ TupleDesc
ExecGetTupType(Plan * node)
{
TupleTableSlot *slot;
- TupleDesc tupType;
+ TupleDesc tupType;
if (node == NULL)
return NULL;
@@ -948,11 +948,11 @@ ExecCopyTupType(TupleDesc td, int natts)
TupleDesc
ExecTypeFromTL(List * targetList)
{
- List *tlcdr;
- TupleDesc typeInfo;
- Resdom *resdom;
- Oid restype;
- int len;
+ List *tlcdr;
+ TupleDesc typeInfo;
+ Resdom *resdom;
+ Oid restype;
+ int len;
/* ----------------
* examine targetlist - if empty then return NULL
@@ -977,7 +977,7 @@ ExecTypeFromTL(List * targetList)
tlcdr = targetList;
while (tlcdr != NIL)
{
- TargetEntry *tle = lfirst(tlcdr);
+ TargetEntry *tle = lfirst(tlcdr);
if (tle->resdom != NULL)
{
@@ -1005,13 +1005,13 @@ ExecTypeFromTL(List * targetList)
}
else
{
- Resdom *fjRes;
- List *fjTlistP;
- List *fjList = lfirst(tlcdr);
+ Resdom *fjRes;
+ List *fjTlistP;
+ List *fjList = lfirst(tlcdr);
#ifdef SETS_FIXED
- TargetEntry *tle;
- Fjoin *fjNode = ((TargetEntry *) lfirst(fjList))->fjoin;
+ TargetEntry *tle;
+ Fjoin *fjNode = ((TargetEntry *) lfirst(fjList))->fjoin;
tle = fjNode->fj_innerNode; /* ??? */
#endif
@@ -1037,7 +1037,7 @@ ExecTypeFromTL(List * targetList)
foreach(fjTlistP, lnext(fjList))
{
- TargetEntry *fjTle = lfirst(fjTlistP);
+ TargetEntry *fjTle = lfirst(fjTlistP);
fjRes = fjTle->resdom;
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 3795c2d101..0f3338d3cb 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.15 1997/09/07 04:41:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.16 1997/09/08 02:22:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,13 +67,13 @@ ExecGetIndexKeyInfo(IndexTupleForm indexTuple, int *numAttsOutP,
* appended, replaced, deleted.
* ----------------------------------------------------------------
*/
-int NTupleProcessed;
-int NTupleRetrieved;
-int NTupleReplaced;
-int NTupleAppended;
-int NTupleDeleted;
-int NIndexTupleInserted;
-extern int NIndexTupleProcessed; /* have to be defined in the
+int NTupleProcessed;
+int NTupleRetrieved;
+int NTupleReplaced;
+int NTupleAppended;
+int NTupleDeleted;
+int NIndexTupleInserted;
+extern int NIndexTupleProcessed; /* have to be defined in the
* access method level so that the
* cinterface.a will link ok. */
@@ -159,7 +159,7 @@ DisplayTupleCount(FILE * statfp)
void
ExecAssignNodeBaseInfo(EState * estate, CommonState * cstate, Plan * parent)
{
- int baseId;
+ int baseId;
baseId = estate->es_BaseId;
cstate->cs_base_id = baseId;
@@ -178,9 +178,9 @@ ExecAssignNodeBaseInfo(EState * estate, CommonState * cstate, Plan * parent)
void
ExecAssignExprContext(EState * estate, CommonState * commonstate)
{
- ExprContext *econtext;
- ParamListInfo paraminfo;
- List *rangeTable;
+ ExprContext *econtext;
+ ParamListInfo paraminfo;
+ List *rangeTable;
paraminfo = estate->es_param_list_info;
rangeTable = estate->es_range_table;
@@ -223,8 +223,8 @@ ExecAssignResultType(CommonState * commonstate,
void
ExecAssignResultTypeFromOuterPlan(Plan * node, CommonState * commonstate)
{
- Plan *outerPlan;
- TupleDesc tupDesc;
+ Plan *outerPlan;
+ TupleDesc tupDesc;
outerPlan = outerPlan(node);
tupDesc = ExecGetTupType(outerPlan);
@@ -239,13 +239,13 @@ ExecAssignResultTypeFromOuterPlan(Plan * node, CommonState * commonstate)
void
ExecAssignResultTypeFromTL(Plan * node, CommonState * commonstate)
{
- List *targetList;
- int i;
- int len;
- List *tl;
- TargetEntry *tle;
- List *fjtl;
- TupleDesc origTupDesc;
+ List *targetList;
+ int i;
+ int len;
+ List *tl;
+ TargetEntry *tle;
+ List *fjtl;
+ TupleDesc origTupDesc;
targetList = node->targetlist;
origTupDesc = ExecTypeFromTL(targetList);
@@ -269,7 +269,7 @@ ExecAssignResultTypeFromTL(Plan * node, CommonState * commonstate)
#ifdef SETS_FIXED
if (!tl_is_resdom(tle))
{
- Fjoin *fj = (Fjoin *) lfirst(tle);
+ Fjoin *fj = (Fjoin *) lfirst(tle);
/* it is a FJoin */
fjtl = lnext(tle);
@@ -309,7 +309,7 @@ void
ExecFreeResultType(CommonState * commonstate)
{
TupleTableSlot *slot;
- TupleDesc tupType;
+ TupleDesc tupType;
slot = commonstate->cs_ResultTupleSlot;
tupType = slot->ttc_tupleDescriptor;
@@ -329,8 +329,8 @@ void
ExecAssignProjectionInfo(Plan * node, CommonState * commonstate)
{
ProjectionInfo *projInfo;
- List *targetList;
- int len;
+ List *targetList;
+ int len;
targetList = node->targetlist;
len = ExecTargetListLength(targetList);
@@ -407,7 +407,7 @@ void
ExecFreeScanType(CommonScanState * csstate)
{
TupleTableSlot *slot;
- TupleDesc tupType;
+ TupleDesc tupType;
slot = csstate->css_ScanTupleSlot;
tupType = slot->ttc_tupleDescriptor;
@@ -439,8 +439,8 @@ ExecAssignScanType(CommonScanState * csstate,
void
ExecAssignScanTypeFromOuterPlan(Plan * node, CommonScanState * csstate)
{
- Plan *outerPlan;
- TupleDesc tupDesc;
+ Plan *outerPlan;
+ TupleDesc tupDesc;
outerPlan = outerPlan(node);
tupDesc = ExecGetTupType(outerPlan);
@@ -571,10 +571,10 @@ ExecFreeTypeInfo(TupleDesc typeInfo)
TupleDesc
QueryDescGetTypeInfo(QueryDesc * queryDesc)
{
- Plan *plan;
- TupleDesc tupleType;
- List *targetList;
- AttrInfo *attinfo = (AttrInfo *) palloc(sizeof(AttrInfo));
+ Plan *plan;
+ TupleDesc tupleType;
+ List *targetList;
+ AttrInfo *attinfo = (AttrInfo *) palloc(sizeof(AttrInfo));
plan = queryDesc->plantree;
tupleType = (TupleDesc) ExecGetTupType(plan);
@@ -611,9 +611,9 @@ ExecGetIndexKeyInfo(IndexTupleForm indexTuple,
AttrNumber ** attsOutP,
FuncIndexInfoPtr fInfoP)
{
- int i;
- int numKeys;
- AttrNumber *attKeys;
+ int i;
+ int numKeys;
+ AttrNumber *attKeys;
/* ----------------
* check parameters
@@ -708,32 +708,32 @@ void
ExecOpenIndices(Oid resultRelationOid,
RelationInfo * resultRelationInfo)
{
- Relation indexRd;
- HeapScanDesc indexSd;
- ScanKeyData key;
- HeapTuple tuple;
- IndexTupleForm indexStruct;
- Oid indexOid;
- List *oidList;
- List *nkeyList;
- List *keyList;
- List *fiList;
- char *predString;
- List *predList;
- List *indexoid;
- List *numkeys;
- List *indexkeys;
- List *indexfuncs;
- List *indexpreds;
- int len;
-
- RelationPtr relationDescs;
- IndexInfo **indexInfoArray;
+ Relation indexRd;
+ HeapScanDesc indexSd;
+ ScanKeyData key;
+ HeapTuple tuple;
+ IndexTupleForm indexStruct;
+ Oid indexOid;
+ List *oidList;
+ List *nkeyList;
+ List *keyList;
+ List *fiList;
+ char *predString;
+ List *predList;
+ List *indexoid;
+ List *numkeys;
+ List *indexkeys;
+ List *indexfuncs;
+ List *indexpreds;
+ int len;
+
+ RelationPtr relationDescs;
+ IndexInfo **indexInfoArray;
FuncIndexInfoPtr fInfoP;
- int numKeyAtts;
- AttrNumber *indexKeyAtts;
- PredInfo *predicate;
- int i;
+ int numKeyAtts;
+ AttrNumber *indexKeyAtts;
+ PredInfo *predicate;
+ int i;
/* ----------------
* open pg_index
@@ -857,7 +857,7 @@ ExecOpenIndices(Oid resultRelationOid,
for (i = 0; i < len; i++)
{
- IndexInfo *ii = makeNode(IndexInfo);
+ IndexInfo *ii = makeNode(IndexInfo);
ii->ii_NumKeyAttributes = 0;
ii->ii_KeyAttributeNumbers = (AttrNumber *) NULL;
@@ -875,7 +875,7 @@ ExecOpenIndices(Oid resultRelationOid,
i = 0;
foreach(indexoid, oidList)
{
- Relation indexDesc;
+ Relation indexDesc;
indexOid = lfirsti(indexoid);
indexDesc = index_open(indexOid);
@@ -954,9 +954,9 @@ ExecOpenIndices(Oid resultRelationOid,
void
ExecCloseIndices(RelationInfo * resultRelationInfo)
{
- int i;
- int numIndices;
- RelationPtr relationDescs;
+ int i;
+ int numIndices;
+ RelationPtr relationDescs;
numIndices = resultRelationInfo->ri_NumIndices;
relationDescs = resultRelationInfo->ri_IndexRelationDescs;
@@ -986,14 +986,14 @@ ExecFormIndexTuple(HeapTuple heapTuple,
Relation indexRelation,
IndexInfo * indexInfo)
{
- IndexTuple indexTuple;
- TupleDesc heapDescriptor;
- TupleDesc indexDescriptor;
- Datum *datum;
- char *nulls;
-
- int numberOfAttributes;
- AttrNumber *keyAttributeNumbers;
+ IndexTuple indexTuple;
+ TupleDesc heapDescriptor;
+ TupleDesc indexDescriptor;
+ Datum *datum;
+ char *nulls;
+
+ int numberOfAttributes;
+ AttrNumber *keyAttributeNumbers;
FuncIndexInfoPtr fInfoP;
/* ----------------
@@ -1075,24 +1075,24 @@ ExecInsertIndexTuples(TupleTableSlot * slot,
EState * estate,
bool is_update)
{
- HeapTuple heapTuple;
- RelationInfo *resultRelationInfo;
- int i;
- int numIndices;
- RelationPtr relationDescs;
- Relation heapRelation;
- IndexInfo **indexInfoArray;
- IndexInfo *indexInfo;
- Node *predicate;
- bool satisfied;
- ExprContext *econtext;
+ HeapTuple heapTuple;
+ RelationInfo *resultRelationInfo;
+ int i;
+ int numIndices;
+ RelationPtr relationDescs;
+ Relation heapRelation;
+ IndexInfo **indexInfoArray;
+ IndexInfo *indexInfo;
+ Node *predicate;
+ bool satisfied;
+ ExprContext *econtext;
InsertIndexResult result;
- int numberOfAttributes;
- AttrNumber *keyAttributeNumbers;
+ int numberOfAttributes;
+ AttrNumber *keyAttributeNumbers;
FuncIndexInfoPtr fInfoP;
- TupleDesc heapDescriptor;
- Datum *datum;
- char *nulls;
+ TupleDesc heapDescriptor;
+ Datum *datum;
+ char *nulls;
heapTuple = slot->val;
@@ -1189,10 +1189,10 @@ void
setVarAttrLenForCreateTable(TupleDesc tupType, List * targetList,
List * rangeTable)
{
- List *tl;
- TargetEntry *tle;
- Node *expr;
- int varno;
+ List *tl;
+ TargetEntry *tle;
+ Node *expr;
+ int varno;
tl = targetList;
@@ -1206,9 +1206,9 @@ setVarAttrLenForCreateTable(TupleDesc tupType, List * targetList,
expr = tle->expr;
if (expr && IsA(expr, Var))
{
- Var *var;
- RangeTblEntry *rtentry;
- Relation rd;
+ Var *var;
+ RangeTblEntry *rtentry;
+ Relation rd;
var = (Var *) expr;
rtentry = rt_fetch(var->varnoold, rangeTable);
@@ -1238,7 +1238,7 @@ setVarAttrLenForCreateTable(TupleDesc tupType, List * targetList,
void
resetVarAttrLenForCreateTable(TupleDesc tupType)
{
- int varno;
+ int varno;
for (varno = 0; varno < tupType->natts; varno++)
{
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 96b9b19dcb..6b10ead651 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.8 1997/09/07 04:41:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.9 1997/09/08 02:22:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,15 +44,15 @@
typedef enum
{
F_EXEC_START, F_EXEC_RUN, F_EXEC_DONE
-} ExecStatus;
+} ExecStatus;
typedef struct local_es
{
- QueryDesc *qd;
- EState *estate;
+ QueryDesc *qd;
+ EState *estate;
struct local_es *next;
- ExecStatus status;
-} execution_state;
+ ExecStatus status;
+} execution_state;
#define LAST_POSTQUEL_COMMAND(es) ((es)->next == (execution_state *)NULL)
@@ -62,7 +62,7 @@ static execution_state *
init_execution_state(FunctionCachePtr fcache,
char *args[]);
static TupleTableSlot *postquel_getnext(execution_state * es);
-static void postquel_end(execution_state * es);
+static void postquel_end(execution_state * es);
static void
postquel_sub_params(execution_state * es, int nargs,
char *args[], bool * nullV);
@@ -77,10 +77,10 @@ ProjectAttribute(TupleDesc TD,
HeapTuple tup,
bool * isnullP)
{
- Datum val,
- valueP;
- Var *attrVar = (Var *) tlist->expr;
- AttrNumber attrno = attrVar->varattno;
+ Datum val,
+ valueP;
+ Var *attrVar = (Var *) tlist->expr;
+ AttrNumber attrno = attrVar->varattno;
val = PointerGetDatum(heap_getattr(tup,
@@ -105,10 +105,10 @@ init_execution_state(FunctionCachePtr fcache,
execution_state *newes;
execution_state *nextes;
execution_state *preves;
- QueryTreeList *queryTree_list;
- int i;
- List *planTree_list;
- int nargs;
+ QueryTreeList *queryTree_list;
+ int i;
+ List *planTree_list;
+ int nargs;
nargs = fcache->nargs;
@@ -122,9 +122,9 @@ init_execution_state(FunctionCachePtr fcache,
for (i = 0; i < queryTree_list->len; i++)
{
- EState *estate;
- Query *queryTree = (Query *) (queryTree_list->qtrees[i]);
- Plan *planTree = lfirst(planTree_list);
+ EState *estate;
+ Query *queryTree = (Query *) (queryTree_list->qtrees[i]);
+ Plan *planTree = lfirst(planTree_list);
if (!nextes)
nextes = (execution_state *) palloc(sizeof(execution_state));
@@ -140,8 +140,8 @@ init_execution_state(FunctionCachePtr fcache,
if (nargs > 0)
{
- int i;
- ParamListInfo paramLI;
+ int i;
+ ParamListInfo paramLI;
paramLI =
(ParamListInfo) palloc((nargs + 1) * sizeof(ParamListInfoData));
@@ -171,7 +171,7 @@ init_execution_state(FunctionCachePtr fcache,
return newes;
}
-static TupleDesc
+static TupleDesc
postquel_start(execution_state * es)
{
#ifdef FUNC_UTIL_PATCH
@@ -191,7 +191,7 @@ postquel_start(execution_state * es)
static TupleTableSlot *
postquel_getnext(execution_state * es)
{
- int feature;
+ int feature;
#ifdef FUNC_UTIL_PATCH
if (es->qd->operation == CMD_UTILITY)
@@ -236,8 +236,8 @@ postquel_sub_params(execution_state * es,
char *args[],
bool * nullV)
{
- ParamListInfo paramLI;
- EState *estate;
+ ParamListInfo paramLI;
+ EState *estate;
estate = es->estate;
paramLI = estate->es_param_list_info;
@@ -259,9 +259,9 @@ copy_function_result(FunctionCachePtr fcache,
TupleTableSlot * resultSlot)
{
TupleTableSlot *funcSlot;
- TupleDesc resultTd;
- HeapTuple newTuple;
- HeapTuple oldTuple;
+ TupleDesc resultTd;
+ HeapTuple newTuple;
+ HeapTuple oldTuple;
Assert(!TupIsNull(resultSlot));
oldTuple = resultSlot->val;
@@ -279,8 +279,8 @@ copy_function_result(FunctionCachePtr fcache,
*/
if (TupIsNull(funcSlot))
{
- int i = 0;
- TupleDesc funcTd = funcSlot->ttc_tupleDescriptor;
+ int i = 0;
+ TupleDesc funcTd = funcSlot->ttc_tupleDescriptor;
while (i < oldTuple->t_natts)
{
@@ -298,7 +298,7 @@ copy_function_result(FunctionCachePtr fcache,
return ExecStoreTuple(newTuple, funcSlot, InvalidBuffer, true);
}
-static Datum
+static Datum
postquel_execute(execution_state * es,
FunctionCachePtr fcache,
List * fTlist,
@@ -306,7 +306,7 @@ postquel_execute(execution_state * es,
bool * isNull)
{
TupleTableSlot *slot;
- Datum value;
+ Datum value;
#ifdef INDEXSCAN_PATCH
@@ -360,8 +360,8 @@ postquel_execute(execution_state * es,
resSlot = copy_function_result(fcache, slot);
if (fTlist != NIL)
{
- HeapTuple tup;
- TargetEntry *tle = lfirst(fTlist);
+ HeapTuple tup;
+ TargetEntry *tle = lfirst(fTlist);
tup = resSlot->val;
value = ProjectAttribute(resSlot->ttc_tupleDescriptor,
@@ -401,9 +401,9 @@ Datum
postquel_function(Func * funcNode, char **args, bool * isNull, bool * isDone)
{
execution_state *es;
- Datum result = 0;
+ Datum result = 0;
FunctionCachePtr fcache = funcNode->func_fcache;
- CommandId savedId;
+ CommandId savedId;
/*
* Before we start do anything we must save CurrentScanCommandId to
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index ee03f6854d..92fa9bbe1e 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -36,18 +36,18 @@
*/
typedef struct AggFuncInfo
{
- Oid xfn1_oid;
- Oid xfn2_oid;
- Oid finalfn_oid;
- func_ptr xfn1;
- func_ptr xfn2;
- func_ptr finalfn;
- int xfn1_nargs;
- int xfn2_nargs;
- int finalfn_nargs;
-} AggFuncInfo;
+ Oid xfn1_oid;
+ Oid xfn2_oid;
+ Oid finalfn_oid;
+ func_ptr xfn1;
+ func_ptr xfn2;
+ func_ptr finalfn;
+ int xfn1_nargs;
+ int xfn2_nargs;
+ int finalfn_nargs;
+} AggFuncInfo;
-static Datum aggGetAttr(TupleTableSlot * tuple, Aggreg * agg, bool * isNull);
+static Datum aggGetAttr(TupleTableSlot * tuple, Aggreg * agg, bool * isNull);
/* ---------------------------------------
@@ -90,26 +90,26 @@ static Datum aggGetAttr(TupleTableSlot * tuple, Aggreg * agg, bool * isNull);
TupleTableSlot *
ExecAgg(Agg * node)
{
- AggState *aggstate;
- EState *estate;
- Aggreg **aggregates;
- Plan *outerPlan;
- int i,
- nagg;
- Datum *value1,
- *value2;
- int *noInitValue;
- AggFuncInfo *aggFuncInfo;
- long nTuplesAgged = 0;
- ExprContext *econtext;
+ AggState *aggstate;
+ EState *estate;
+ Aggreg **aggregates;
+ Plan *outerPlan;
+ int i,
+ nagg;
+ Datum *value1,
+ *value2;
+ int *noInitValue;
+ AggFuncInfo *aggFuncInfo;
+ long nTuplesAgged = 0;
+ ExprContext *econtext;
ProjectionInfo *projInfo;
TupleTableSlot *resultSlot;
- HeapTuple oneTuple;
- char *nulls;
- bool isDone;
- bool isNull = FALSE,
- isNull1 = FALSE,
- isNull2 = FALSE;
+ HeapTuple oneTuple;
+ char *nulls;
+ bool isDone;
+ bool isNull = FALSE,
+ isNull1 = FALSE,
+ isNull2 = FALSE;
/* ---------------------
* get state info from node
@@ -143,19 +143,19 @@ ExecAgg(Agg * node)
for (i = 0; i < nagg; i++)
{
- Aggreg *agg;
- char *aggname;
- HeapTuple aggTuple;
+ Aggreg *agg;
+ char *aggname;
+ HeapTuple aggTuple;
Form_pg_aggregate aggp;
- Oid xfn1_oid,
- xfn2_oid,
- finalfn_oid;
- func_ptr xfn1_ptr,
- xfn2_ptr,
- finalfn_ptr;
- int xfn1_nargs,
- xfn2_nargs,
- finalfn_nargs;
+ Oid xfn1_oid,
+ xfn2_oid,
+ finalfn_oid;
+ func_ptr xfn1_ptr,
+ xfn2_ptr,
+ finalfn_ptr;
+ int xfn1_nargs,
+ xfn2_nargs,
+ finalfn_nargs;
agg = aggregates[i];
@@ -240,7 +240,7 @@ ExecAgg(Agg * node)
*/
for (;;)
{
- HeapTuple outerTuple = NULL;
+ HeapTuple outerTuple = NULL;
TupleTableSlot *outerslot;
isNull = isNull1 = isNull2 = 0;
@@ -258,9 +258,9 @@ ExecAgg(Agg * node)
*/
if (nTuplesAgged == 0)
{
- TupleDesc tupType;
- Datum *tupValue;
- char *null_array;
+ TupleDesc tupType;
+ Datum *tupValue;
+ char *null_array;
tupType = aggstate->csstate.css_ScanTupleSlot->ttc_tupleDescriptor;
tupValue = projInfo->pi_tupValue;
@@ -277,29 +277,29 @@ ExecAgg(Agg * node)
for (i = 0; i < nagg; i++)
{
- AttrNumber attnum;
- int2 attlen;
- Datum newVal = (Datum) NULL;
- AggFuncInfo *aggfns = &aggFuncInfo[i];
- Datum args[2];
- Node *tagnode = NULL;
+ AttrNumber attnum;
+ int2 attlen;
+ Datum newVal = (Datum) NULL;
+ AggFuncInfo *aggfns = &aggFuncInfo[i];
+ Datum args[2];
+ Node *tagnode = NULL;
switch (nodeTag(aggregates[i]->target))
{
- case T_Var:
- tagnode = NULL;
- newVal = aggGetAttr(outerslot,
- aggregates[i],
- &isNull);
- break;
- case T_Expr:
- tagnode = ((Expr *) aggregates[i]->target)->oper;
- econtext->ecxt_scantuple = outerslot;
- newVal = ExecEvalExpr(aggregates[i]->target, econtext,
- &isNull, NULL);
- break;
- default:
- elog(WARN, "ExecAgg: Bad Agg->Target for Agg %d", i);
+ case T_Var:
+ tagnode = NULL;
+ newVal = aggGetAttr(outerslot,
+ aggregates[i],
+ &isNull);
+ break;
+ case T_Expr:
+ tagnode = ((Expr *) aggregates[i]->target)->oper;
+ econtext->ecxt_scantuple = outerslot;
+ newVal = ExecEvalExpr(aggregates[i]->target, econtext,
+ &isNull, NULL);
+ break;
+ default:
+ elog(WARN, "ExecAgg: Bad Agg->Target for Agg %d", i);
}
if (isNull)
@@ -309,7 +309,7 @@ ExecAgg(Agg * node)
{
if (noInitValue[i])
{
- int byVal;
+ int byVal;
/*
* value1 and value2 has not been initialized. This is
@@ -371,7 +371,7 @@ ExecAgg(Agg * node)
if (aggfns->xfn2)
{
- Datum xfn2_val = value2[i];
+ Datum xfn2_val = value2[i];
value2[i] =
(Datum) fmgr_c(aggfns->xfn2, aggfns->xfn2_oid,
@@ -399,8 +399,8 @@ ExecAgg(Agg * node)
*/
for (i = 0; i < nagg; i++)
{
- char *args[2];
- AggFuncInfo *aggfns = &aggFuncInfo[i];
+ char *args[2];
+ AggFuncInfo *aggfns = &aggFuncInfo[i];
if (noInitValue[i])
{
@@ -490,9 +490,9 @@ ExecAgg(Agg * node)
bool
ExecInitAgg(Agg * node, EState * estate, Plan * parent)
{
- AggState *aggstate;
- Plan *outerPlan;
- ExprContext *econtext;
+ AggState *aggstate;
+ Plan *outerPlan;
+ ExprContext *econtext;
/*
* assign the node's execution state
@@ -566,8 +566,8 @@ ExecCountSlotsAgg(Agg * node)
void
ExecEndAgg(Agg * node)
{
- AggState *aggstate;
- Plan *outerPlan;
+ AggState *aggstate;
+ Plan *outerPlan;
aggstate = node->aggstate;
@@ -590,16 +590,16 @@ ExecEndAgg(Agg * node)
* get the attribute (specified in the Var node in agg) to aggregate
* over from the tuple
*/
-static Datum
+static Datum
aggGetAttr(TupleTableSlot * slot,
Aggreg * agg,
bool * isNull)
{
- Datum result;
- AttrNumber attnum;
- HeapTuple heapTuple;
- TupleDesc tuple_type;
- Buffer buffer;
+ Datum result;
+ AttrNumber attnum;
+ HeapTuple heapTuple;
+ TupleDesc tuple_type;
+ Buffer buffer;
/* ----------------
* extract tuple information from the slot
@@ -619,8 +619,8 @@ aggGetAttr(TupleTableSlot * slot,
if (attnum == InvalidAttrNumber)
{
TupleTableSlot *tempSlot;
- TupleDesc td;
- HeapTuple tup;
+ TupleDesc td;
+ HeapTuple tup;
tempSlot = makeNode(TupleTableSlot);
tempSlot->ttc_shouldFree = false;
diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c
index 043ad5d974..da43dc8ee3 100644
--- a/src/backend/executor/nodeAppend.c
+++ b/src/backend/executor/nodeAppend.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.6 1997/09/07 04:41:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.7 1997/09/08 02:22:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,7 +64,7 @@
#include "utils/mcxt.h"
#include "parser/parsetree.h" /* for rt_store() macro */
-static bool exec_append_initialize_next(Append * node);
+static bool exec_append_initialize_next(Append * node);
/* ----------------------------------------------------------------
* exec-append-initialize-next
@@ -75,20 +75,20 @@ static bool exec_append_initialize_next(Append * node);
* Returns t iff there is a "next" scan to process.
* ----------------------------------------------------------------
*/
-static bool
+static bool
exec_append_initialize_next(Append * node)
{
- EState *estate;
- AppendState *unionstate;
+ EState *estate;
+ AppendState *unionstate;
TupleTableSlot *result_slot;
- List *rangeTable;
+ List *rangeTable;
- int whichplan;
- int nplans;
- List *rtentries;
- ResTarget *rtentry;
+ int whichplan;
+ int nplans;
+ List *rtentries;
+ ResTarget *rtentry;
- Index unionrelid;
+ Index unionrelid;
/* ----------------
* get information from the append node
@@ -184,16 +184,16 @@ exec_append_initialize_next(Append * node)
bool
ExecInitAppend(Append * node, EState * estate, Plan * parent)
{
- AppendState *unionstate;
- int nplans;
- List *resultList = NULL;
- List *rtentries;
- List *unionplans;
- bool *initialized;
- int i;
- Plan *initNode;
- List *junkList;
- RelationInfo *es_rri = estate->es_result_relation_info;
+ AppendState *unionstate;
+ int nplans;
+ List *resultList = NULL;
+ List *rtentries;
+ List *unionplans;
+ bool *initialized;
+ int i;
+ Plan *initNode;
+ List *junkList;
+ RelationInfo *es_rri = estate->es_result_relation_info;
/* ----------------
* assign execution state to node and get information
@@ -251,13 +251,13 @@ ExecInitAppend(Append * node, EState * estate, Plan * parent)
if ((es_rri != (RelationInfo *) NULL) &&
(node->unionrelid == es_rri->ri_RangeTableIndex))
{
- RelationInfo *rri;
- List *rtentryP;
+ RelationInfo *rri;
+ List *rtentryP;
foreach(rtentryP, rtentries)
{
- Oid reloid;
- RangeTblEntry *rtentry = lfirst(rtentryP);
+ Oid reloid;
+ RangeTblEntry *rtentry = lfirst(rtentryP);
reloid = rtentry->relid;
rri = makeNode(RelationInfo);
@@ -281,8 +281,8 @@ ExecInitAppend(Append * node, EState * estate, Plan * parent)
for (i = 0; i < nplans; i++)
{
- JunkFilter *j;
- List *targetList;
+ JunkFilter *j;
+ List *targetList;
/* ----------------
* NOTE: we first modify range table in
@@ -343,9 +343,9 @@ ExecInitAppend(Append * node, EState * estate, Plan * parent)
int
ExecCountSlotsAppend(Append * node)
{
- List *plan;
- List *unionplans = node->unionplans;
- int nSlots = 0;
+ List *plan;
+ List *unionplans = node->unionplans;
+ int nSlots = 0;
foreach(plan, unionplans)
{
@@ -365,15 +365,15 @@ ExecCountSlotsAppend(Append * node)
TupleTableSlot *
ExecProcAppend(Append * node)
{
- EState *estate;
- AppendState *unionstate;
+ EState *estate;
+ AppendState *unionstate;
- int whichplan;
- List *unionplans;
- Plan *subnode;
+ int whichplan;
+ List *unionplans;
+ Plan *subnode;
TupleTableSlot *result;
TupleTableSlot *result_slot;
- ScanDirection direction;
+ ScanDirection direction;
/* ----------------
* get information from the node
@@ -458,13 +458,13 @@ ExecProcAppend(Append * node)
void
ExecEndAppend(Append * node)
{
- AppendState *unionstate;
- int nplans;
- List *unionplans;
- bool *initialized;
- int i;
- List *resultRelationInfoList;
- RelationInfo *resultRelationInfo;
+ AppendState *unionstate;
+ int nplans;
+ List *unionplans;
+ bool *initialized;
+ int i;
+ List *resultRelationInfoList;
+ RelationInfo *resultRelationInfo;
/* ----------------
* get information from the node
@@ -494,7 +494,7 @@ ExecEndAppend(Append * node)
resultRelationInfoList = unionstate->as_result_relation_info_list;
while (resultRelationInfoList != NIL)
{
- Relation resultRelationDesc;
+ Relation resultRelationDesc;
resultRelationInfo = (RelationInfo *) lfirst(resultRelationInfoList);
resultRelationDesc = resultRelationInfo->ri_RelationDesc;
diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c
index 1a96a1ee91..c7e63696c0 100644
--- a/src/backend/executor/nodeGroup.c
+++ b/src/backend/executor/nodeGroup.c
@@ -13,7 +13,7 @@
* columns. (ie. tuples from the same group are consecutive)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.6 1997/09/07 04:41:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.7 1997/09/08 02:22:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,17 +66,17 @@ ExecGroup(Group * node)
static TupleTableSlot *
ExecGroupEveryTuple(Group * node)
{
- GroupState *grpstate;
- EState *estate;
- ExprContext *econtext;
+ GroupState *grpstate;
+ EState *estate;
+ ExprContext *econtext;
- HeapTuple outerTuple = NULL;
+ HeapTuple outerTuple = NULL;
TupleTableSlot *outerslot,
- *lastslot;
+ *lastslot;
ProjectionInfo *projInfo;
TupleTableSlot *resultSlot;
- bool isDone;
+ bool isDone;
/* ---------------------
* get state info from node
@@ -167,17 +167,17 @@ ExecGroupEveryTuple(Group * node)
static TupleTableSlot *
ExecGroupOneTuple(Group * node)
{
- GroupState *grpstate;
- EState *estate;
- ExprContext *econtext;
+ GroupState *grpstate;
+ EState *estate;
+ ExprContext *econtext;
- HeapTuple outerTuple = NULL;
+ HeapTuple outerTuple = NULL;
TupleTableSlot *outerslot,
- *lastslot;
+ *lastslot;
ProjectionInfo *projInfo;
TupleTableSlot *resultSlot;
- bool isDone;
+ bool isDone;
/* ---------------------
* get state info from node
@@ -291,8 +291,8 @@ ExecGroupOneTuple(Group * node)
bool
ExecInitGroup(Group * node, EState * estate, Plan * parent)
{
- GroupState *grpstate;
- Plan *outerPlan;
+ GroupState *grpstate;
+ Plan *outerPlan;
/*
* assign the node's execution state
@@ -358,8 +358,8 @@ ExecCountSlotsGroup(Group * node)
void
ExecEndGroup(Group * node)
{
- GroupState *grpstate;
- Plan *outerPlan;
+ GroupState *grpstate;
+ Plan *outerPlan;
grpstate = node->grpstate;
@@ -379,22 +379,22 @@ ExecEndGroup(Group * node)
/*
* code swiped from nodeUnique.c
*/
-static bool
+static bool
sameGroup(TupleTableSlot * oldslot,
TupleTableSlot * newslot,
int numCols,
AttrNumber * grpColIdx,
TupleDesc tupdesc)
{
- bool isNull1,
- isNull2;
- char *attr1,
- *attr2;
- char *val1,
- *val2;
- int i;
- AttrNumber att;
- Oid typoutput;
+ bool isNull1,
+ isNull2;
+ char *attr1,
+ *attr2;
+ char *val1,
+ *val2;
+ int i;
+ AttrNumber att;
+ Oid typoutput;
for (i = 0; i < numCols; i++)
{
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index b25939fa83..b0e7ca4dd5 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.11 1997/09/07 04:41:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.12 1997/09/08 02:22:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,12 +42,12 @@
#include "utils/palloc.h"
#include "utils/hsearch.h"
-extern int NBuffers;
-static int HashTBSize;
+extern int NBuffers;
+static int HashTBSize;
-static void mk_hj_temp(char *tempname);
-static int hashFunc(char *key, int len);
-static int ExecHashPartition(Hash * node);
+static void mk_hj_temp(char *tempname);
+static int hashFunc(char *key, int len);
+static int ExecHashPartition(Hash * node);
static RelativeAddr hashTableAlloc(int size, HashJoinTable hashtable);
static void
ExecHashOverflowInsert(HashJoinTable hashtable,
@@ -64,20 +64,20 @@ ExecHashOverflowInsert(HashJoinTable hashtable,
TupleTableSlot *
ExecHash(Hash * node)
{
- EState *estate;
- HashState *hashstate;
- Plan *outerNode;
- Var *hashkey;
- HashJoinTable hashtable;
+ EState *estate;
+ HashState *hashstate;
+ Plan *outerNode;
+ Var *hashkey;
+ HashJoinTable hashtable;
TupleTableSlot *slot;
- ExprContext *econtext;
+ ExprContext *econtext;
- int nbatch;
- File *batches = NULL;
- RelativeAddr *batchPos;
- int *batchSizes;
- int i;
- RelativeAddr *innerbatchNames;
+ int nbatch;
+ File *batches = NULL;
+ RelativeAddr *batchPos;
+ int *batchSizes;
+ int i;
+ RelativeAddr *innerbatchNames;
/* ----------------
* get state info from node
@@ -167,8 +167,8 @@ ExecHash(Hash * node)
bool
ExecInitHash(Hash * node, EState * estate, Plan * parent)
{
- HashState *hashstate;
- Plan *outerPlan;
+ HashState *hashstate;
+ Plan *outerPlan;
SO1_printf("ExecInitHash: %s\n",
"initializing hash node");
@@ -240,9 +240,9 @@ ExecCountSlotsHash(Hash * node)
void
ExecEndHash(Hash * node)
{
- HashState *hashstate;
- Plan *outerPlan;
- File *batches;
+ HashState *hashstate;
+ Plan *outerPlan;
+ File *batches;
/* ----------------
* get info from the hash state
@@ -268,10 +268,10 @@ ExecEndHash(Hash * node)
ExecEndNode(outerPlan, (Plan *) node);
}
-static RelativeAddr
+static RelativeAddr
hashTableAlloc(int size, HashJoinTable hashtable)
{
- RelativeAddr p;
+ RelativeAddr p;
p = hashtable->top;
hashtable->top += size;
@@ -290,23 +290,23 @@ hashTableAlloc(int size, HashJoinTable hashtable)
HashJoinTable
ExecHashTableCreate(Hash * node)
{
- Plan *outerNode;
- int nbatch;
- int ntuples;
- int tupsize;
- IpcMemoryId shmid;
- HashJoinTable hashtable;
- HashBucket bucket;
- int nbuckets;
- int totalbuckets;
- int bucketsize;
- int i;
- RelativeAddr *outerbatchNames;
- RelativeAddr *outerbatchPos;
- RelativeAddr *innerbatchNames;
- RelativeAddr *innerbatchPos;
- int *innerbatchSizes;
- RelativeAddr tempname;
+ Plan *outerNode;
+ int nbatch;
+ int ntuples;
+ int tupsize;
+ IpcMemoryId shmid;
+ HashJoinTable hashtable;
+ HashBucket bucket;
+ int nbuckets;
+ int totalbuckets;
+ int bucketsize;
+ int i;
+ RelativeAddr *outerbatchNames;
+ RelativeAddr *outerbatchPos;
+ RelativeAddr *innerbatchNames;
+ RelativeAddr *innerbatchPos;
+ int *innerbatchSizes;
+ RelativeAddr tempname;
nbatch = -1;
HashTBSize = NBuffers / 2;
@@ -461,15 +461,15 @@ ExecHashTableInsert(HashJoinTable hashtable,
File * batches)
{
TupleTableSlot *slot;
- HeapTuple heapTuple;
- HashBucket bucket;
- int bucketno;
- int nbatch;
- int batchno;
- char *buffer;
- RelativeAddr *batchPos;
- int *batchSizes;
- char *pos;
+ HeapTuple heapTuple;
+ HashBucket bucket;
+ int bucketno;
+ int nbatch;
+ int batchno;
+ char *buffer;
+ RelativeAddr *batchPos;
+ int *batchSizes;
+ char *pos;
nbatch = hashtable->nbatch;
batchPos = (RelativeAddr *) ABSADDR(hashtable->innerbatchPos);
@@ -551,9 +551,9 @@ ExecHashGetBucket(HashJoinTable hashtable,
ExprContext * econtext,
Var * hashkey)
{
- int bucketno;
- Datum keyval;
- bool isNull;
+ int bucketno;
+ Datum keyval;
+ bool isNull;
/* ----------------
@@ -606,10 +606,10 @@ ExecHashOverflowInsert(HashJoinTable hashtable,
HashBucket bucket,
HeapTuple heapTuple)
{
- OverflowTuple otuple;
- RelativeAddr newend;
- OverflowTuple firstotuple;
- OverflowTuple lastotuple;
+ OverflowTuple otuple;
+ RelativeAddr newend;
+ OverflowTuple firstotuple;
+ OverflowTuple lastotuple;
firstotuple = (OverflowTuple) ABSADDR(bucket->firstotuple);
lastotuple = (OverflowTuple) ABSADDR(bucket->lastotuple);
@@ -687,14 +687,14 @@ ExecScanHashBucket(HashJoinState * hjstate,
List * hjclauses,
ExprContext * econtext)
{
- HeapTuple heapTuple;
- bool qualResult;
- OverflowTuple otuple = NULL;
- OverflowTuple curotuple;
+ HeapTuple heapTuple;
+ bool qualResult;
+ OverflowTuple otuple = NULL;
+ OverflowTuple curotuple;
TupleTableSlot *inntuple;
- OverflowTuple firstotuple;
- OverflowTuple lastotuple;
- HashJoinTable hashtable;
+ OverflowTuple firstotuple;
+ OverflowTuple lastotuple;
+ HashJoinTable hashtable;
hashtable = hjstate->hj_HashTable;
firstotuple = (OverflowTuple) ABSADDR(bucket->firstotuple);
@@ -785,7 +785,7 @@ static int
hashFunc(char *key, int len)
{
register unsigned int h;
- register int l;
+ register int l;
register unsigned char *k;
/*
@@ -828,11 +828,11 @@ hashFunc(char *key, int len)
static int
ExecHashPartition(Hash * node)
{
- Plan *outerNode;
- int b;
- int pages;
- int ntuples;
- int tupsize;
+ Plan *outerNode;
+ int b;
+ int pages;
+ int ntuples;
+ int tupsize;
/*
* get size information for plan node
@@ -866,8 +866,8 @@ ExecHashPartition(Hash * node)
void
ExecHashTableReset(HashJoinTable hashtable, int ntuples)
{
- int i;
- HashBucket bucket;
+ int i;
+ HashBucket bucket;
hashtable->nbuckets = hashtable->totalbuckets
= ceil((double) ntuples / NTUP_PER_BUCKET);
@@ -886,7 +886,7 @@ ExecHashTableReset(HashJoinTable hashtable, int ntuples)
hashtable->pcount = hashtable->nprocess;
}
-static int hjtmpcnt = 0;
+static int hjtmpcnt = 0;
static void
mk_hj_temp(char *tempname)
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index 3548e38cc8..b0c6eec3c0 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.6 1997/09/07 04:41:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.7 1997/09/08 02:22:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,7 @@
#include "utils/palloc.h"
static TupleTableSlot *
- ExecHashJoinOuterGetTuple(Plan * node, Plan * parent, HashJoinState * hjstate);
+ ExecHashJoinOuterGetTuple(Plan * node, Plan * parent, HashJoinState * hjstate);
static TupleTableSlot *
ExecHashJoinGetSavedTuple(HashJoinState * hjstate, char *buffer,
@@ -43,7 +43,7 @@ static int
ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable,
int nbatch);
-static int ExecHashJoinNewBatch(HashJoinState * hjstate);
+static int ExecHashJoinNewBatch(HashJoinState * hjstate);
@@ -59,39 +59,39 @@ static int ExecHashJoinNewBatch(HashJoinState * hjstate);
TupleTableSlot * /* return: a tuple or NULL */
ExecHashJoin(HashJoin * node)
{
- HashJoinState *hjstate;
- EState *estate;
- Plan *outerNode;
- Hash *hashNode;
- List *hjclauses;
- Expr *clause;
- List *qual;
- ScanDirection dir;
+ HashJoinState *hjstate;
+ EState *estate;
+ Plan *outerNode;
+ Hash *hashNode;
+ List *hjclauses;
+ Expr *clause;
+ List *qual;
+ ScanDirection dir;
TupleTableSlot *inntuple;
- Var *outerVar;
- ExprContext *econtext;
+ Var *outerVar;
+ ExprContext *econtext;
- HashJoinTable hashtable;
- int bucketno;
- HashBucket bucket;
- HeapTuple curtuple;
+ HashJoinTable hashtable;
+ int bucketno;
+ HashBucket bucket;
+ HeapTuple curtuple;
- bool qualResult;
+ bool qualResult;
TupleTableSlot *outerTupleSlot;
TupleTableSlot *innerTupleSlot;
- int nbatch;
- int curbatch;
- File *outerbatches;
- RelativeAddr *outerbatchNames;
- RelativeAddr *outerbatchPos;
- Var *innerhashkey;
- int batch;
- int batchno;
- char *buffer;
- int i;
- bool hashPhaseDone;
- char *pos;
+ int nbatch;
+ int curbatch;
+ File *outerbatches;
+ RelativeAddr *outerbatchNames;
+ RelativeAddr *outerbatchPos;
+ Var *innerhashkey;
+ int batch;
+ int batchno;
+ char *buffer;
+ int i;
+ bool hashPhaseDone;
+ char *pos;
/* ----------------
* get information from HashJoin node
@@ -125,7 +125,7 @@ ExecHashJoin(HashJoin * node)
if (hjstate->jstate.cs_TupFromTlist)
{
TupleTableSlot *result;
- bool isDone;
+ bool isDone;
result = ExecProject(hjstate->jstate.cs_ProjInfo, &isDone);
if (!isDone)
@@ -322,7 +322,7 @@ ExecHashJoin(HashJoin * node)
{
ProjectionInfo *projInfo;
TupleTableSlot *result;
- bool isDone;
+ bool isDone;
hjstate->hj_CurBucket = bucket;
hjstate->hj_CurTuple = curtuple;
@@ -394,9 +394,9 @@ ExecHashJoin(HashJoin * node)
bool /* return: initialization status */
ExecInitHashJoin(HashJoin * node, EState * estate, Plan * parent)
{
- HashJoinState *hjstate;
- Plan *outerNode;
- Hash *hashNode;
+ HashJoinState *hjstate;
+ Plan *outerNode;
+ Hash *hashNode;
/* ----------------
* assign the node's execution state
@@ -451,7 +451,7 @@ ExecInitHashJoin(HashJoin * node, EState * estate, Plan * parent)
* ----------------
*/
{
- HashState *hashstate = hashNode->hashstate;
+ HashState *hashstate = hashNode->hashstate;
TupleTableSlot *slot =
hashstate->cstate.cs_ResultTupleSlot;
@@ -513,7 +513,7 @@ ExecCountSlotsHashJoin(HashJoin * node)
void
ExecEndHashJoin(HashJoin * node)
{
- HashJoinState *hjstate;
+ HashJoinState *hjstate;
/* ----------------
* get info from the HashJoin state
@@ -572,13 +572,13 @@ static TupleTableSlot *
ExecHashJoinOuterGetTuple(Plan * node, Plan * parent, HashJoinState * hjstate)
{
TupleTableSlot *slot;
- HashJoinTable hashtable;
- int curbatch;
- File *outerbatches;
- char *outerreadPos;
- int batchno;
- char *outerreadBuf;
- int outerreadBlk;
+ HashJoinTable hashtable;
+ int curbatch;
+ File *outerbatches;
+ char *outerreadPos;
+ int batchno;
+ char *outerreadBuf;
+ int outerreadBlk;
hashtable = hjstate->hj_HashTable;
curbatch = hashtable->curbatch;
@@ -626,11 +626,11 @@ ExecHashJoinGetSavedTuple(HashJoinState * hjstate,
int *block, /* return parameter */
char **position) /* return parameter */
{
- char *bufstart;
- char *bufend;
- int cc;
- HeapTuple heapTuple;
- HashJoinTable hashtable;
+ char *bufstart;
+ char *bufend;
+ int cc;
+ HeapTuple heapTuple;
+ HashJoinTable hashtable;
hashtable = hjstate->hj_HashTable;
bufend = buffer + *(long *) buffer;
@@ -666,20 +666,20 @@ ExecHashJoinGetSavedTuple(HashJoinState * hjstate,
static int
ExecHashJoinNewBatch(HashJoinState * hjstate)
{
- File *innerBatches;
- File *outerBatches;
- int *innerBatchSizes;
- Var *innerhashkey;
- HashJoinTable hashtable;
- int nbatch;
- char *readPos;
- int readBlk;
- char *readBuf;
+ File *innerBatches;
+ File *outerBatches;
+ int *innerBatchSizes;
+ Var *innerhashkey;
+ HashJoinTable hashtable;
+ int nbatch;
+ char *readPos;
+ int readBlk;
+ char *readBuf;
TupleTableSlot *slot;
- ExprContext *econtext;
- int i;
- int cc;
- int newbatch;
+ ExprContext *econtext;
+ int i;
+ int cc;
+ int newbatch;
hashtable = hjstate->hj_HashTable;
outerBatches = hjstate->hj_OuterBatches;
@@ -793,7 +793,7 @@ ExecHashJoinNewBatch(HashJoinState * hjstate)
static int
ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable, int nbatch)
{
- int b;
+ int b;
if (bucketno < hashtable->nbuckets || nbatch == 0)
return 0;
@@ -813,16 +813,16 @@ ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable, int nbatch)
* ----------------------------------------------------------------
*/
-char *
+char *
ExecHashJoinSaveTuple(HeapTuple heapTuple,
char *buffer,
File file,
char *position)
{
- long *pageend;
- char *pagestart;
- char *pagebound;
- int cc;
+ long *pageend;
+ char *pagestart;
+ char *pagebound;
+ int cc;
pageend = (long *) buffer;
pagestart = (char *) (buffer + sizeof(long));
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index c89a4fcb08..61fca80a0c 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.8 1997/09/07 04:41:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.9 1997/09/08 02:22:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -82,19 +82,19 @@ static TupleTableSlot *IndexNext(IndexScan * node);
static TupleTableSlot *
IndexNext(IndexScan * node)
{
- EState *estate;
+ EState *estate;
CommonScanState *scanstate;
IndexScanState *indexstate;
- ScanDirection direction;
- int indexPtr;
+ ScanDirection direction;
+ int indexPtr;
IndexScanDescPtr scanDescs;
- IndexScanDesc scandesc;
- Relation heapRelation;
+ IndexScanDesc scandesc;
+ Relation heapRelation;
RetrieveIndexResult result;
- ItemPointer iptr;
- HeapTuple tuple;
+ ItemPointer iptr;
+ HeapTuple tuple;
TupleTableSlot *slot;
- Buffer buffer = InvalidBuffer;
+ Buffer buffer = InvalidBuffer;
/* ----------------
* extract necessary information from index scan node
@@ -219,30 +219,30 @@ ExecIndexScan(IndexScan * node)
void
ExecIndexReScan(IndexScan * node, ExprContext * exprCtxt, Plan * parent)
{
- EState *estate;
+ EState *estate;
IndexScanState *indexstate;
- ScanDirection direction;
+ ScanDirection direction;
IndexScanDescPtr scanDescs;
- ScanKey *scanKeys;
- IndexScanDesc sdesc;
- ScanKey skey;
- int numIndices;
- int i;
-
- Pointer *runtimeKeyInfo;
- int indexPtr;
- int *numScanKeys;
- List *indxqual;
- List *qual;
- int n_keys;
- ScanKey scan_keys;
- int *run_keys;
- int j;
- Expr *clause;
- Node *scanexpr;
- Datum scanvalue;
- bool isNull;
- bool isDone;
+ ScanKey *scanKeys;
+ IndexScanDesc sdesc;
+ ScanKey skey;
+ int numIndices;
+ int i;
+
+ Pointer *runtimeKeyInfo;
+ int indexPtr;
+ int *numScanKeys;
+ List *indxqual;
+ List *qual;
+ int n_keys;
+ ScanKey scan_keys;
+ int *run_keys;
+ int j;
+ Expr *clause;
+ Node *scanexpr;
+ Datum scanvalue;
+ bool isNull;
+ bool isDone;
indexstate = node->indxstate;
estate = node->scan.plan.state;
@@ -335,9 +335,9 @@ ExecEndIndexScan(IndexScan * node)
{
CommonScanState *scanstate;
IndexScanState *indexstate;
- ScanKey *scanKeys;
- int numIndices;
- int i;
+ ScanKey *scanKeys;
+ int numIndices;
+ int i;
scanstate = node->scan.scanstate;
indexstate = node->indxstate;
@@ -399,8 +399,8 @@ ExecIndexMarkPos(IndexScan * node)
{
IndexScanState *indexstate;
IndexScanDescPtr indexScanDescs;
- IndexScanDesc scanDesc;
- int indexPtr;
+ IndexScanDesc scanDesc;
+ int indexPtr;
indexstate = node->indxstate;
indexPtr = indexstate->iss_IndexPtr;
@@ -430,8 +430,8 @@ ExecIndexRestrPos(IndexScan * node)
{
IndexScanState *indexstate;
IndexScanDescPtr indexScanDescs;
- IndexScanDesc scanDesc;
- int indexPtr;
+ IndexScanDesc scanDesc;
+ int indexPtr;
indexstate = node->indxstate;
indexPtr = indexstate->iss_IndexPtr;
@@ -465,27 +465,27 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
{
IndexScanState *indexstate;
CommonScanState *scanstate;
- List *indxqual;
- List *indxid;
- int i;
- int numIndices;
- int indexPtr;
- ScanKey *scanKeys;
- int *numScanKeys;
- RelationPtr relationDescs;
+ List *indxqual;
+ List *indxid;
+ int i;
+ int numIndices;
+ int indexPtr;
+ ScanKey *scanKeys;
+ int *numScanKeys;
+ RelationPtr relationDescs;
IndexScanDescPtr scanDescs;
- Pointer *runtimeKeyInfo;
- bool have_runtime_keys;
- List *rangeTable;
- RangeTblEntry *rtentry;
- Index relid;
- Oid reloid;
- TimeQual timeQual;
-
- Relation currentRelation;
- HeapScanDesc currentScanDesc;
- ScanDirection direction;
- int baseid;
+ Pointer *runtimeKeyInfo;
+ bool have_runtime_keys;
+ List *rangeTable;
+ RangeTblEntry *rtentry;
+ Index relid;
+ Oid reloid;
+ TimeQual timeQual;
+
+ Relation currentRelation;
+ HeapScanDesc currentScanDesc;
+ ScanDirection direction;
+ int baseid;
/* ----------------
* assign execution state to node
@@ -600,11 +600,11 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
*/
for (i = 0; i < numIndices; i++)
{
- int j;
- List *qual;
- int n_keys;
- ScanKey scan_keys;
- int *run_keys;
+ int j;
+ List *qual;
+ int n_keys;
+ ScanKey scan_keys;
+ int *run_keys;
qual = nth(i, indxqual);
n_keys = length(qual);
@@ -623,17 +623,16 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
*/
for (j = 0; j < n_keys; j++)
{
- Expr *clause; /* one part of index qual */
- Oper *op; /* operator used in scan.. */
- Node *leftop; /* expr on lhs of operator */
- Node *rightop; /* expr on rhs ... */
- bits16 flags = 0;
-
- int scanvar; /* which var identifies varattno */
- AttrNumber varattno = 0; /* att number used in scan */
- Oid opid; /* operator id used in scan */
- Datum scanvalue = 0; /* value used in scan (if
- * const) */
+ Expr *clause; /* one part of index qual */
+ Oper *op; /* operator used in scan.. */
+ Node *leftop; /* expr on lhs of operator */
+ Node *rightop;/* expr on rhs ... */
+ bits16 flags = 0;
+
+ int scanvar;/* which var identifies varattno */
+ AttrNumber varattno = 0; /* att number used in scan */
+ Oid opid; /* operator id used in scan */
+ Datum scanvalue = 0; /* value used in scan (if const) */
/* ----------------
* extract clause information from the qualification
@@ -702,7 +701,7 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
}
else if (IsA(leftop, Param))
{
- bool isnull;
+ bool isnull;
/* ----------------
* if the leftop is a Param node then it means
@@ -785,7 +784,7 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
}
else if (IsA(rightop, Param))
{
- bool isnull;
+ bool isnull;
/* ----------------
* if the rightop is a Param node then it means
@@ -885,8 +884,8 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
indexstate->iss_RuntimeKeyInfo = NULL;
for (i = 0; i < numIndices; i++)
{
- List *qual;
- int n_keys;
+ List *qual;
+ int n_keys;
qual = nth(i, indxqual);
n_keys = length(qual);
@@ -947,7 +946,7 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
*/
for (i = 0; i < numIndices; i++)
{
- Oid indexOid;
+ Oid indexOid;
indexOid = (Oid) nthi(i, indxid);
diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c
index 49ba73d3bf..6ff8598901 100644
--- a/src/backend/executor/nodeMaterial.c
+++ b/src/backend/executor/nodeMaterial.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.7 1997/09/07 04:41:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.8 1997/09/08 02:22:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,16 +50,16 @@
TupleTableSlot * /* result tuple from subplan */
ExecMaterial(Material * node)
{
- EState *estate;
- MaterialState *matstate;
- Plan *outerNode;
- ScanDirection dir;
- Relation tempRelation;
- Relation currentRelation;
- HeapScanDesc currentScanDesc;
- HeapTuple heapTuple;
+ EState *estate;
+ MaterialState *matstate;
+ Plan *outerNode;
+ ScanDirection dir;
+ Relation tempRelation;
+ Relation currentRelation;
+ HeapScanDesc currentScanDesc;
+ HeapTuple heapTuple;
TupleTableSlot *slot;
- Buffer buffer;
+ Buffer buffer;
/* ----------------
* get state info from node
@@ -190,10 +190,10 @@ ExecMaterial(Material * node)
bool /* initialization status */
ExecInitMaterial(Material * node, EState * estate, Plan * parent)
{
- MaterialState *matstate;
- Plan *outerPlan;
- TupleDesc tupType;
- Relation tempDesc;
+ MaterialState *matstate;
+ Plan *outerPlan;
+ TupleDesc tupType;
+ Relation tempDesc;
/* int len; */
@@ -308,9 +308,9 @@ ExecCountSlotsMaterial(Material * node)
void
ExecEndMaterial(Material * node)
{
- MaterialState *matstate;
- Relation tempRelation;
- Plan *outerPlan;
+ MaterialState *matstate;
+ Relation tempRelation;
+ Plan *outerPlan;
/* ----------------
* get info from the material state
@@ -349,8 +349,8 @@ ExecEndMaterial(Material * node)
List /* nothing of interest */
ExecMaterialMarkPos(Material node)
{
- MaterialState matstate;
- HeapScanDesc sdesc;
+ MaterialState matstate;
+ HeapScanDesc sdesc;
/* ----------------
* if we haven't materialized yet, just return NIL.
@@ -379,8 +379,8 @@ ExecMaterialMarkPos(Material node)
void
ExecMaterialRestrPos(Material node)
{
- MaterialState matstate;
- HeapScanDesc sdesc;
+ MaterialState matstate;
+ HeapScanDesc sdesc;
/* ----------------
* if we haven't materialized yet, just return.
diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c
index 348d3fa1e0..621cfcea90 100644
--- a/src/backend/executor/nodeMergejoin.c
+++ b/src/backend/executor/nodeMergejoin.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.9 1997/09/07 04:41:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.10 1997/09/08 02:22:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -84,7 +84,7 @@
#include "utils/lsyscache.h"
#include "utils/psort.h"
-static bool MergeCompare(List * eqQual, List * compareQual, ExprContext * econtext);
+static bool MergeCompare(List * eqQual, List * compareQual, ExprContext * econtext);
/* ----------------------------------------------------------------
* MarkInnerTuple and RestoreInnerTuple macros
@@ -142,13 +142,13 @@ static bool MergeCompare(List * eqQual, List * compareQual, ExprContext * econt
* by "sortOp".
* ----------------------------------------------------------------
*/
-static List *
+static List *
MJFormOSortopI(List * qualList, Oid sortOp)
{
- List *qualCopy;
- List *qualcdr;
- Expr *qual;
- Oper *op;
+ List *qualCopy;
+ List *qualcdr;
+ Expr *qual;
+ Oper *op;
/* ----------------
* qualList is a list: ((op .. ..) ...)
@@ -206,11 +206,11 @@ MJFormOSortopI(List * qualList, Oid sortOp)
* by "sortOp" and reversing the positions of the keys.
* ----------------------------------------------------------------
*/
-static List *
+static List *
MJFormISortopO(List * qualList, Oid sortOp)
{
- List *ISortopO;
- List *qualcdr;
+ List *ISortopO;
+ List *qualcdr;
/* ----------------
* first generate OSortopI, a list of the form
@@ -226,9 +226,9 @@ MJFormISortopO(List * qualList, Oid sortOp)
*/
foreach(qualcdr, ISortopO)
{
- Expr *qual;
- List *inner;
- List *outer;
+ Expr *qual;
+ List *inner;
+ List *outer;
qual = lfirst(qualcdr);
@@ -257,14 +257,14 @@ MJFormISortopO(List * qualList, Oid sortOp)
* if (key1i > key2i) is true and (key1j = key2j) for 0 < j < i.
* ----------------------------------------------------------------
*/
-static bool
+static bool
MergeCompare(List * eqQual, List * compareQual, ExprContext * econtext)
{
- List *clause;
- List *eqclause;
- Datum const_value;
- bool isNull;
- bool isDone;
+ List *clause;
+ List *eqclause;
+ Datum const_value;
+ bool isNull;
+ bool isDone;
/* ----------------
* if we have no compare qualification, return nil
@@ -394,7 +394,7 @@ CleanUpSort(Plan * plan)
if (plan->type == T_Sort)
{
- Sort *sort = (Sort *) plan;
+ Sort *sort = (Sort *) plan;
psort_end(sort);
}
@@ -451,25 +451,25 @@ CleanUpSort(Plan * plan)
TupleTableSlot *
ExecMergeJoin(MergeJoin * node)
{
- EState *estate;
+ EState *estate;
MergeJoinState *mergestate;
- ScanDirection direction;
- List *innerSkipQual;
- List *outerSkipQual;
- List *mergeclauses;
- List *qual;
- bool qualResult;
- bool compareResult;
-
- Plan *innerPlan;
+ ScanDirection direction;
+ List *innerSkipQual;
+ List *outerSkipQual;
+ List *mergeclauses;
+ List *qual;
+ bool qualResult;
+ bool compareResult;
+
+ Plan *innerPlan;
TupleTableSlot *innerTupleSlot;
- Plan *outerPlan;
+ Plan *outerPlan;
TupleTableSlot *outerTupleSlot;
TupleTableSlot *markedTupleSlot;
- ExprContext *econtext;
+ ExprContext *econtext;
/* ----------------
* get information from node
@@ -503,7 +503,7 @@ ExecMergeJoin(MergeJoin * node)
{
TupleTableSlot *result;
ProjectionInfo *projInfo;
- bool isDone;
+ bool isDone;
projInfo = mergestate->jstate.cs_ProjInfo;
result = ExecProject(projInfo, &isDone);
@@ -523,349 +523,185 @@ ExecMergeJoin(MergeJoin * node)
switch (mergestate->mj_JoinState)
{
- /*
- * ******************************** EXEC_MJ_INITIALIZE means
- * that this is the first time ExecMergeJoin() has been called
- * and so we have to initialize the inner, outer and marked
- * tuples as well as various stuff in the expression context. ********************************
- *
- */
- case EXEC_MJ_INITIALIZE:
- MJ_printf("ExecMergeJoin: EXEC_MJ_INITIALIZE\n");
- /* ----------------
- * Note: at this point, if either of our inner or outer
- * tuples are nil, then the join ends immediately because
- * we know one of the subplans is empty.
- * ----------------
- */
- innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
- if (TupIsNull(innerTupleSlot))
- {
- MJ_printf("ExecMergeJoin: **** inner tuple is nil ****\n");
- return NULL;
- }
+ /*
+ * ******************************** EXEC_MJ_INITIALIZE
+ * means that this is the first time ExecMergeJoin() has
+ * been called and so we have to initialize the inner,
+ * outer and marked tuples as well as various stuff in the
+ * expression context. ********************************
+ *
+ */
+ case EXEC_MJ_INITIALIZE:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_INITIALIZE\n");
+ /* ----------------
+ * Note: at this point, if either of our inner or outer
+ * tuples are nil, then the join ends immediately because
+ * we know one of the subplans is empty.
+ * ----------------
+ */
+ innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
+ if (TupIsNull(innerTupleSlot))
+ {
+ MJ_printf("ExecMergeJoin: **** inner tuple is nil ****\n");
+ return NULL;
+ }
- outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
- if (TupIsNull(outerTupleSlot))
- {
- MJ_printf("ExecMergeJoin: **** outer tuple is nil ****\n");
- return NULL;
- }
-
- /* ----------------
- * store the inner and outer tuple in the merge state
- * ----------------
- */
- econtext->ecxt_innertuple = innerTupleSlot;
- econtext->ecxt_outertuple = outerTupleSlot;
-
- /* ----------------
- * set the marked tuple to nil
- * and initialize its tuple descriptor atttributes.
- * -jeff 10 july 1991
- * ----------------
- */
- ExecClearTuple(mergestate->mj_MarkedTupleSlot);
- mergestate->mj_MarkedTupleSlot->ttc_tupleDescriptor =
- innerTupleSlot->ttc_tupleDescriptor;
+ outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
+ if (TupIsNull(outerTupleSlot))
+ {
+ MJ_printf("ExecMergeJoin: **** outer tuple is nil ****\n");
+ return NULL;
+ }
+
+ /* ----------------
+ * store the inner and outer tuple in the merge state
+ * ----------------
+ */
+ econtext->ecxt_innertuple = innerTupleSlot;
+ econtext->ecxt_outertuple = outerTupleSlot;
+
+ /* ----------------
+ * set the marked tuple to nil
+ * and initialize its tuple descriptor atttributes.
+ * -jeff 10 july 1991
+ * ----------------
+ */
+ ExecClearTuple(mergestate->mj_MarkedTupleSlot);
+ mergestate->mj_MarkedTupleSlot->ttc_tupleDescriptor =
+ innerTupleSlot->ttc_tupleDescriptor;
/*
mergestate->mj_MarkedTupleSlot->ttc_execTupDescriptor =
innerTupleSlot->ttc_execTupDescriptor;
*/
- /* ----------------
- * initialize merge join state to skip inner tuples.
- * ----------------
- */
- mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
- break;
-
- /*
- * ******************************** EXEC_MJ_JOINMARK means we
- * have just found a new outer tuple and a possible matching
- * inner tuple. This is the case after the INITIALIZE,
- * SKIPOUTER or SKIPINNER states. ********************************
- *
- */
- case EXEC_MJ_JOINMARK:
- MJ_printf("ExecMergeJoin: EXEC_MJ_JOINMARK\n");
- ExecMarkPos(innerPlan);
-
- innerTupleSlot = econtext->ecxt_innertuple;
- MarkInnerTuple(innerTupleSlot, mergestate);
-
- mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
- break;
-
- /*
- * ******************************** EXEC_MJ_JOINTEST means we
- * have two tuples which might satisify the merge clause, so
- * we test them.
- *
- * If they do satisify, then we join them and move on to the next
- * inner tuple (EXEC_MJ_JOINTUPLES).
- *
- * If they do not satisify then advance to next outer tuple. ********************************
- *
- */
- case EXEC_MJ_JOINTEST:
- MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTEST\n");
-
- qualResult = ExecQual((List *) mergeclauses, econtext);
- MJ_DEBUG_QUAL(mergeclauses, qualResult);
-
- if (qualResult)
- {
- mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
- }
- else
- {
- mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_JOINTUPLES means
- * we have two tuples which satisified the merge clause so we
- * join them and then proceed to get the next inner tuple
- * (EXEC_NEXT_INNER). ********************************
- *
- */
- case EXEC_MJ_JOINTUPLES:
- MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTUPLES\n");
- mergestate->mj_JoinState = EXEC_MJ_NEXTINNER;
-
- qualResult = ExecQual((List *) qual, econtext);
- MJ_DEBUG_QUAL(qual, qualResult);
-
- if (qualResult)
- {
/* ----------------
- * qualification succeeded. now form the desired
- * projection tuple and return the slot containing it.
+ * initialize merge join state to skip inner tuples.
* ----------------
*/
- ProjectionInfo *projInfo;
- TupleTableSlot *result;
- bool isDone;
-
- MJ_printf("ExecMergeJoin: **** returning tuple ****\n");
-
- projInfo = mergestate->jstate.cs_ProjInfo;
-
- result = ExecProject(projInfo, &isDone);
- mergestate->jstate.cs_TupFromTlist = !isDone;
- return result;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_NEXTINNER means
- * advance the inner scan to the next tuple. If the tuple is
- * not nil, we then proceed to test it against the join
- * qualification. ********************************
- *
- */
- case EXEC_MJ_NEXTINNER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTINNER\n");
-
- /* ----------------
- * now we get the next inner tuple, if any
- * ----------------
- */
- innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
- MJ_DEBUG_PROC_NODE(innerTupleSlot);
- econtext->ecxt_innertuple = innerTupleSlot;
-
- if (TupIsNull(innerTupleSlot))
- {
- mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
- }
- else
- {
- mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_NEXTOUTER means
- *
- * outer inner outer tuple - 5 5 - marked tuple 5 5 6
- * 6 - inner tuple 7 7
- *
- * we know we just bumped into the first inner tuple > current
- * outer tuple so get a new outer tuple and then proceed to
- * test it against the marked tuple (EXEC_MJ_TESTOUTER) ********************************
- *
- */
- case EXEC_MJ_NEXTOUTER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTOUTER\n");
-
- outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
- MJ_DEBUG_PROC_NODE(outerTupleSlot);
- econtext->ecxt_outertuple = outerTupleSlot;
-
- /* ----------------
- * if the outer tuple is null then we know
- * we are done with the join
- * ----------------
- */
- if (TupIsNull(outerTupleSlot))
- {
- MJ_printf("ExecMergeJoin: **** outer tuple is nil ****\n");
- CleanUpSort(node->join.lefttree->lefttree);
- CleanUpSort(node->join.righttree->lefttree);
- return NULL;
- }
-
- mergestate->mj_JoinState = EXEC_MJ_TESTOUTER;
- break;
-
- /*
- * ******************************** EXEC_MJ_TESTOUTER If the
- * new outer tuple and the marked tuple satisify the merge
- * clause then we know we have duplicates in the outer scan so
- * we have to restore the inner scan to the marked tuple and
- * proceed to join the new outer tuples with the inner tuples
- * (EXEC_MJ_JOINTEST)
- *
- * This is the case when
- *
- * outer inner 4 5 - marked tuple outer tuple - 5 5 new
- * outer tuple - 5 5 6 8 - inner tuple 7 12
- *
- * new outer tuple = marked tuple
- *
- * If the outer tuple fails the test, then we know we have to
- * proceed to skip outer tuples until outer >= inner
- * (EXEC_MJ_SKIPOUTER).
- *
- * This is the case when
- *
- * outer inner 5 5 - marked tuple outer tuple - 5 5 new
- * outer tuple - 6 8 - inner tuple 7 12
- *
- * new outer tuple > marked tuple
- *
- ********************************
- *
- */
- case EXEC_MJ_TESTOUTER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_TESTOUTER\n");
-
- /* ----------------
- * here we compare the outer tuple with the marked inner tuple
- * by using the marked tuple in place of the inner tuple.
- * ----------------
- */
- innerTupleSlot = econtext->ecxt_innertuple;
- markedTupleSlot = mergestate->mj_MarkedTupleSlot;
- econtext->ecxt_innertuple = markedTupleSlot;
-
- qualResult = ExecQual((List *) mergeclauses, econtext);
- MJ_DEBUG_QUAL(mergeclauses, qualResult);
-
- if (qualResult)
- {
- /* ----------------
- * the merge clause matched so now we juggle the slots
- * back the way they were and proceed to JOINTEST.
- * ----------------
+ mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
+ break;
+
+ /*
+ * ******************************** EXEC_MJ_JOINMARK means
+ * we have just found a new outer tuple and a possible
+ * matching inner tuple. This is the case after the
+ * INITIALIZE, SKIPOUTER or SKIPINNER states. ********************************
+ *
*/
- econtext->ecxt_innertuple = innerTupleSlot;
+ case EXEC_MJ_JOINMARK:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_JOINMARK\n");
+ ExecMarkPos(innerPlan);
- RestoreInnerTuple(innerTupleSlot, markedTupleSlot);
+ innerTupleSlot = econtext->ecxt_innertuple;
+ MarkInnerTuple(innerTupleSlot, mergestate);
- ExecRestrPos(innerPlan);
mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
+ break;
- }
- else
- {
- /* ----------------
- * if the inner tuple was nil and the new outer
- * tuple didn't match the marked outer tuple then
- * we may have the case:
+ /*
+ * ******************************** EXEC_MJ_JOINTEST means
+ * we have two tuples which might satisify the merge
+ * clause, so we test them.
*
- * outer inner
- * 4 4 - marked tuple
- * new outer - 5 4
- * 6 nil - inner tuple
- * 7
+ * If they do satisify, then we join them and move on to the
+ * next inner tuple (EXEC_MJ_JOINTUPLES).
+ *
+ * If they do not satisify then advance to next outer tuple. ********************************
*
- * which means that all subsequent outer tuples will be
- * larger than our inner tuples.
- * ----------------
*/
- if (TupIsNull(innerTupleSlot))
+ case EXEC_MJ_JOINTEST:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTEST\n");
+
+ qualResult = ExecQual((List *) mergeclauses, econtext);
+ MJ_DEBUG_QUAL(mergeclauses, qualResult);
+
+ if (qualResult)
{
- MJ_printf("ExecMergeJoin: **** wierd case 1 ****\n");
- return NULL;
+ mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ }
+ else
+ {
+ mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
+ }
+ break;
+
+ /*
+ * ******************************** EXEC_MJ_JOINTUPLES
+ * means we have two tuples which satisified the merge
+ * clause so we join them and then proceed to get the next
+ * inner tuple (EXEC_NEXT_INNER). ********************************
+ *
+ */
+ case EXEC_MJ_JOINTUPLES:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTUPLES\n");
+ mergestate->mj_JoinState = EXEC_MJ_NEXTINNER;
+
+ qualResult = ExecQual((List *) qual, econtext);
+ MJ_DEBUG_QUAL(qual, qualResult);
+
+ if (qualResult)
+ {
+ /* ----------------
+ * qualification succeeded. now form the desired
+ * projection tuple and return the slot containing it.
+ * ----------------
+ */
+ ProjectionInfo *projInfo;
+ TupleTableSlot *result;
+ bool isDone;
+
+ MJ_printf("ExecMergeJoin: **** returning tuple ****\n");
+
+ projInfo = mergestate->jstate.cs_ProjInfo;
+
+ result = ExecProject(projInfo, &isDone);
+ mergestate->jstate.cs_TupFromTlist = !isDone;
+ return result;
}
+ break;
+
+ /*
+ * ******************************** EXEC_MJ_NEXTINNER
+ * means advance the inner scan to the next tuple. If the
+ * tuple is not nil, we then proceed to test it against
+ * the join qualification. ********************************
+ *
+ */
+ case EXEC_MJ_NEXTINNER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTINNER\n");
/* ----------------
- * restore the inner tuple and continue on to
- * skip outer tuples.
+ * now we get the next inner tuple, if any
* ----------------
*/
+ innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
+ MJ_DEBUG_PROC_NODE(innerTupleSlot);
econtext->ecxt_innertuple = innerTupleSlot;
- mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_SKIPOUTER means
- * skip over tuples in the outer plan until we find an outer
- * tuple > current inner tuple.
- *
- * For example:
- *
- * outer inner 5 5 5 5 outer tuple - 6 8 - inner
- * tuple 7 12 8 14
- *
- * we have to advance the outer scan until we find the outer 8.
- *
- ********************************
- *
- */
- case EXEC_MJ_SKIPOUTER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPOUTER\n");
- /* ----------------
- * before we advance, make sure the current tuples
- * do not satisify the mergeclauses. If they do, then
- * we update the marked tuple and go join them.
- * ----------------
- */
- qualResult = ExecQual((List *) mergeclauses, econtext);
- MJ_DEBUG_QUAL(mergeclauses, qualResult);
-
- if (qualResult)
- {
- ExecMarkPos(innerPlan);
- innerTupleSlot = econtext->ecxt_innertuple;
- MarkInnerTuple(innerTupleSlot, mergestate);
-
- mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ if (TupIsNull(innerTupleSlot))
+ {
+ mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
+ }
+ else
+ {
+ mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
+ }
break;
- }
-
- /* ----------------
- * ok, now test the skip qualification
- * ----------------
- */
- compareResult = MergeCompare(mergeclauses,
- outerSkipQual,
- econtext);
-
- MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
-
- /* ----------------
- * compareResult is true as long as we should
- * continue skipping tuples.
- * ----------------
- */
- if (compareResult)
- {
+
+ /*
+ * ******************************** EXEC_MJ_NEXTOUTER
+ * means
+ *
+ * outer inner outer tuple - 5 5 - marked tuple 5 5
+ * 6 6 - inner tuple 7 7
+ *
+ * we know we just bumped into the first inner tuple >
+ * current outer tuple so get a new outer tuple and then
+ * proceed to test it against the marked tuple
+ * (EXEC_MJ_TESTOUTER) ********************************
+ *
+ */
+ case EXEC_MJ_NEXTOUTER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTOUTER\n");
outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
MJ_DEBUG_PROC_NODE(outerTupleSlot);
@@ -878,169 +714,342 @@ ExecMergeJoin(MergeJoin * node)
*/
if (TupIsNull(outerTupleSlot))
{
- MJ_printf("ExecMergeJoin: **** outerTuple is nil ****\n");
+ MJ_printf("ExecMergeJoin: **** outer tuple is nil ****\n");
+ CleanUpSort(node->join.lefttree->lefttree);
+ CleanUpSort(node->join.righttree->lefttree);
return NULL;
}
+
+ mergestate->mj_JoinState = EXEC_MJ_TESTOUTER;
+ break;
+
+ /*
+ * ******************************** EXEC_MJ_TESTOUTER If
+ * the new outer tuple and the marked tuple satisify the
+ * merge clause then we know we have duplicates in the
+ * outer scan so we have to restore the inner scan to the
+ * marked tuple and proceed to join the new outer tuples
+ * with the inner tuples (EXEC_MJ_JOINTEST)
+ *
+ * This is the case when
+ *
+ * outer inner 4 5 - marked tuple outer tuple - 5 5
+ * new outer tuple - 5 5 6 8 - inner tuple 7
+ * 12
+ *
+ * new outer tuple = marked tuple
+ *
+ * If the outer tuple fails the test, then we know we have to
+ * proceed to skip outer tuples until outer >= inner
+ * (EXEC_MJ_SKIPOUTER).
+ *
+ * This is the case when
+ *
+ * outer inner 5 5 - marked tuple outer tuple - 5 5
+ * new outer tuple - 6 8 - inner tuple 7 12
+ *
+ * new outer tuple > marked tuple
+ *
+ *******************************
+ *
+ *
+ */
+ case EXEC_MJ_TESTOUTER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_TESTOUTER\n");
+
/* ----------------
- * otherwise test the new tuple against the skip qual.
- * (we remain in the EXEC_MJ_SKIPOUTER state)
+ * here we compare the outer tuple with the marked inner tuple
+ * by using the marked tuple in place of the inner tuple.
* ----------------
*/
- break;
- }
-
- /* ----------------
- * now check the inner skip qual to see if we
- * should now skip inner tuples... if we fail the
- * inner skip qual, then we know we have a new pair
- * of matching tuples.
- * ----------------
- */
- compareResult = MergeCompare(mergeclauses,
- innerSkipQual,
- econtext);
-
- MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
-
- if (compareResult)
- {
- mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
- }
- else
- {
- mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_SKIPINNER means
- * skip over tuples in the inner plan until we find an inner
- * tuple > current outer tuple.
- *
- * For example:
- *
- * outer inner 5 5 5 5 outer tuple - 12 8 - inner
- * tuple 14 10 17 12
- *
- * we have to advance the inner scan until we find the inner 12.
- *
- ********************************
- *
- */
- case EXEC_MJ_SKIPINNER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPINNER\n");
- /* ----------------
- * before we advance, make sure the current tuples
- * do not satisify the mergeclauses. If they do, then
- * we update the marked tuple and go join them.
- * ----------------
- */
- qualResult = ExecQual((List *) mergeclauses, econtext);
- MJ_DEBUG_QUAL(mergeclauses, qualResult);
-
- if (qualResult)
- {
- ExecMarkPos(innerPlan);
innerTupleSlot = econtext->ecxt_innertuple;
+ markedTupleSlot = mergestate->mj_MarkedTupleSlot;
+ econtext->ecxt_innertuple = markedTupleSlot;
- MarkInnerTuple(innerTupleSlot, mergestate);
+ qualResult = ExecQual((List *) mergeclauses, econtext);
+ MJ_DEBUG_QUAL(mergeclauses, qualResult);
+
+ if (qualResult)
+ {
+ /* ----------------
+ * the merge clause matched so now we juggle the slots
+ * back the way they were and proceed to JOINTEST.
+ * ----------------
+ */
+ econtext->ecxt_innertuple = innerTupleSlot;
+
+ RestoreInnerTuple(innerTupleSlot, markedTupleSlot);
- mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ ExecRestrPos(innerPlan);
+ mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
+
+ }
+ else
+ {
+ /* ----------------
+ * if the inner tuple was nil and the new outer
+ * tuple didn't match the marked outer tuple then
+ * we may have the case:
+ *
+ * outer inner
+ * 4 4 - marked tuple
+ * new outer - 5 4
+ * 6 nil - inner tuple
+ * 7
+ *
+ * which means that all subsequent outer tuples will be
+ * larger than our inner tuples.
+ * ----------------
+ */
+ if (TupIsNull(innerTupleSlot))
+ {
+ MJ_printf("ExecMergeJoin: **** wierd case 1 ****\n");
+ return NULL;
+ }
+
+ /* ----------------
+ * restore the inner tuple and continue on to
+ * skip outer tuples.
+ * ----------------
+ */
+ econtext->ecxt_innertuple = innerTupleSlot;
+ mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
+ }
break;
- }
-
- /* ----------------
- * ok, now test the skip qualification
- * ----------------
- */
- compareResult = MergeCompare(mergeclauses,
- innerSkipQual,
- econtext);
-
- MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
-
- /* ----------------
- * compareResult is true as long as we should
- * continue skipping tuples.
- * ----------------
- */
- if (compareResult)
- {
+
+ /*
+ * ******************************** EXEC_MJ_SKIPOUTER
+ * means skip over tuples in the outer plan until we find
+ * an outer tuple > current inner tuple.
+ *
+ * For example:
+ *
+ * outer inner 5 5 5 5 outer tuple - 6 8 -
+ * inner tuple 7 12 8 14
+ *
+ * we have to advance the outer scan until we find the outer
+ * 8.
+ *
+ *******************************
+ *
+ *
+ */
+ case EXEC_MJ_SKIPOUTER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPOUTER\n");
/* ----------------
- * now try and get a new inner tuple
+ * before we advance, make sure the current tuples
+ * do not satisify the mergeclauses. If they do, then
+ * we update the marked tuple and go join them.
* ----------------
*/
- innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
- MJ_DEBUG_PROC_NODE(innerTupleSlot);
- econtext->ecxt_innertuple = innerTupleSlot;
+ qualResult = ExecQual((List *) mergeclauses, econtext);
+ MJ_DEBUG_QUAL(mergeclauses, qualResult);
+
+ if (qualResult)
+ {
+ ExecMarkPos(innerPlan);
+ innerTupleSlot = econtext->ecxt_innertuple;
+
+ MarkInnerTuple(innerTupleSlot, mergestate);
+
+ mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ break;
+ }
/* ----------------
- * if the inner tuple is null then we know
- * we have to restore the inner scan
- * and advance to the next outer tuple
+ * ok, now test the skip qualification
* ----------------
*/
- if (TupIsNull(innerTupleSlot))
+ compareResult = MergeCompare(mergeclauses,
+ outerSkipQual,
+ econtext);
+
+ MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
+
+ /* ----------------
+ * compareResult is true as long as we should
+ * continue skipping tuples.
+ * ----------------
+ */
+ if (compareResult)
{
+
+ outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
+ MJ_DEBUG_PROC_NODE(outerTupleSlot);
+ econtext->ecxt_outertuple = outerTupleSlot;
+
/* ----------------
- * this is an interesting case.. all our
- * inner tuples are smaller then our outer
- * tuples so we never found an inner tuple
- * to mark.
- *
- * outer inner
- * outer tuple - 5 4
- * 5 4
- * 6 nil - inner tuple
- * 7
- *
- * This means the join should end.
+ * if the outer tuple is null then we know
+ * we are done with the join
* ----------------
*/
- MJ_printf("ExecMergeJoin: **** wierd case 2 ****\n");
- return NULL;
+ if (TupIsNull(outerTupleSlot))
+ {
+ MJ_printf("ExecMergeJoin: **** outerTuple is nil ****\n");
+ return NULL;
+ }
+ /* ----------------
+ * otherwise test the new tuple against the skip qual.
+ * (we remain in the EXEC_MJ_SKIPOUTER state)
+ * ----------------
+ */
+ break;
}
/* ----------------
- * otherwise test the new tuple against the skip qual.
- * (we remain in the EXEC_MJ_SKIPINNER state)
+ * now check the inner skip qual to see if we
+ * should now skip inner tuples... if we fail the
+ * inner skip qual, then we know we have a new pair
+ * of matching tuples.
* ----------------
*/
+ compareResult = MergeCompare(mergeclauses,
+ innerSkipQual,
+ econtext);
+
+ MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
+
+ if (compareResult)
+ {
+ mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
+ }
+ else
+ {
+ mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
+ }
break;
- }
-
- /* ----------------
- * compare finally failed and we have stopped skipping
- * inner tuples so now check the outer skip qual
- * to see if we should now skip outer tuples...
- * ----------------
- */
- compareResult = MergeCompare(mergeclauses,
- outerSkipQual,
- econtext);
-
- MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
-
- if (compareResult)
- {
- mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
- }
- else
- {
- mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
- }
-
- break;
-
- /*
- * ******************************** if we get here it means
- * our code is fucked up and so we just end the join
- * prematurely. ********************************
- *
- */
- default:
- elog(NOTICE, "ExecMergeJoin: invalid join state. aborting");
- return NULL;
+
+ /*
+ * ******************************** EXEC_MJ_SKIPINNER
+ * means skip over tuples in the inner plan until we find
+ * an inner tuple > current outer tuple.
+ *
+ * For example:
+ *
+ * outer inner 5 5 5 5 outer tuple - 12 8 - inner
+ * tuple 14 10 17 12
+ *
+ * we have to advance the inner scan until we find the inner
+ * 12.
+ *
+ *******************************
+ *
+ *
+ */
+ case EXEC_MJ_SKIPINNER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPINNER\n");
+ /* ----------------
+ * before we advance, make sure the current tuples
+ * do not satisify the mergeclauses. If they do, then
+ * we update the marked tuple and go join them.
+ * ----------------
+ */
+ qualResult = ExecQual((List *) mergeclauses, econtext);
+ MJ_DEBUG_QUAL(mergeclauses, qualResult);
+
+ if (qualResult)
+ {
+ ExecMarkPos(innerPlan);
+ innerTupleSlot = econtext->ecxt_innertuple;
+
+ MarkInnerTuple(innerTupleSlot, mergestate);
+
+ mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ break;
+ }
+
+ /* ----------------
+ * ok, now test the skip qualification
+ * ----------------
+ */
+ compareResult = MergeCompare(mergeclauses,
+ innerSkipQual,
+ econtext);
+
+ MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
+
+ /* ----------------
+ * compareResult is true as long as we should
+ * continue skipping tuples.
+ * ----------------
+ */
+ if (compareResult)
+ {
+ /* ----------------
+ * now try and get a new inner tuple
+ * ----------------
+ */
+ innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
+ MJ_DEBUG_PROC_NODE(innerTupleSlot);
+ econtext->ecxt_innertuple = innerTupleSlot;
+
+ /* ----------------
+ * if the inner tuple is null then we know
+ * we have to restore the inner scan
+ * and advance to the next outer tuple
+ * ----------------
+ */
+ if (TupIsNull(innerTupleSlot))
+ {
+ /* ----------------
+ * this is an interesting case.. all our
+ * inner tuples are smaller then our outer
+ * tuples so we never found an inner tuple
+ * to mark.
+ *
+ * outer inner
+ * outer tuple - 5 4
+ * 5 4
+ * 6 nil - inner tuple
+ * 7
+ *
+ * This means the join should end.
+ * ----------------
+ */
+ MJ_printf("ExecMergeJoin: **** wierd case 2 ****\n");
+ return NULL;
+ }
+
+ /* ----------------
+ * otherwise test the new tuple against the skip qual.
+ * (we remain in the EXEC_MJ_SKIPINNER state)
+ * ----------------
+ */
+ break;
+ }
+
+ /* ----------------
+ * compare finally failed and we have stopped skipping
+ * inner tuples so now check the outer skip qual
+ * to see if we should now skip outer tuples...
+ * ----------------
+ */
+ compareResult = MergeCompare(mergeclauses,
+ outerSkipQual,
+ econtext);
+
+ MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
+
+ if (compareResult)
+ {
+ mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
+ }
+ else
+ {
+ mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
+ }
+
+ break;
+
+ /*
+ * ******************************** if we get here it
+ * means our code is fucked up and so we just end the join
+ * prematurely. ********************************
+ *
+ */
+ default:
+ elog(NOTICE, "ExecMergeJoin: invalid join state. aborting");
+ return NULL;
}
}
}
@@ -1057,13 +1066,13 @@ bool
ExecInitMergeJoin(MergeJoin * node, EState * estate, Plan * parent)
{
MergeJoinState *mergestate;
- List *joinclauses;
- RegProcedure rightsortop;
- RegProcedure leftsortop;
- RegProcedure sortop;
+ List *joinclauses;
+ RegProcedure rightsortop;
+ RegProcedure leftsortop;
+ RegProcedure sortop;
- List *OSortopI;
- List *ISortopO;
+ List *OSortopI;
+ List *ISortopO;
MJ1_printf("ExecInitMergeJoin: %s\n",
"initializing node");
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index e7cba2e756..d8d5f38d6d 100644
--- a/src/backend/executor/nodeNestloop.c
+++ b/src/backend/executor/nodeNestloop.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.4 1997/09/07 04:41:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.5 1997/09/08 02:22:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,17 +57,17 @@
TupleTableSlot *
ExecNestLoop(NestLoop * node, Plan * parent)
{
- NestLoopState *nlstate;
- Plan *innerPlan;
- Plan *outerPlan;
- bool needNewOuterTuple;
+ NestLoopState *nlstate;
+ Plan *innerPlan;
+ Plan *outerPlan;
+ bool needNewOuterTuple;
TupleTableSlot *outerTupleSlot;
TupleTableSlot *innerTupleSlot;
- List *qual;
- bool qualResult;
- ExprContext *econtext;
+ List *qual;
+ bool qualResult;
+ ExprContext *econtext;
/* ----------------
* get information from the node
@@ -86,7 +86,7 @@ ExecNestLoop(NestLoop * node, Plan * parent)
*/
econtext = nlstate->jstate.cs_ExprContext;
- /* ---------------- * get the current outer tuple
+ /* ---------------- * get the current outer tuple
* ----------------
*/
outerTupleSlot = nlstate->jstate.cs_OuterTupleSlot;
@@ -101,7 +101,7 @@ ExecNestLoop(NestLoop * node, Plan * parent)
if (nlstate->jstate.cs_TupFromTlist)
{
TupleTableSlot *result;
- bool isDone;
+ bool isDone;
result = ExecProject(nlstate->jstate.cs_ProjInfo, &isDone);
if (!isDone)
@@ -238,7 +238,7 @@ ExecNestLoop(NestLoop * node, Plan * parent)
*/
ProjectionInfo *projInfo;
TupleTableSlot *result;
- bool isDone;
+ bool isDone;
ENL1_printf("qualification succeeded, projecting tuple");
@@ -267,7 +267,7 @@ ExecNestLoop(NestLoop * node, Plan * parent)
bool
ExecInitNestLoop(NestLoop * node, EState * estate, Plan * parent)
{
- NestLoopState *nlstate;
+ NestLoopState *nlstate;
NL1_printf("ExecInitNestLoop: %s\n",
"initializing node");
@@ -347,7 +347,7 @@ ExecCountSlotsNestLoop(NestLoop * node)
void
ExecEndNestLoop(NestLoop * node)
{
- NestLoopState *nlstate;
+ NestLoopState *nlstate;
NL1_printf("ExecEndNestLoop: %s\n",
"ending node processing");
diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c
index 743bd73f2b..4e0e62ddfe 100644
--- a/src/backend/executor/nodeResult.c
+++ b/src/backend/executor/nodeResult.c
@@ -27,7 +27,7 @@
* SeqScan (emp.all)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.3 1997/09/07 04:41:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.4 1997/09/08 02:22:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,14 +53,14 @@
TupleTableSlot *
ExecResult(Result * node)
{
- ResultState *resstate;
+ ResultState *resstate;
TupleTableSlot *outerTupleSlot;
TupleTableSlot *resultSlot;
- Plan *outerPlan;
- ExprContext *econtext;
- Node *qual;
- bool qualResult;
- bool isDone;
+ Plan *outerPlan;
+ ExprContext *econtext;
+ Node *qual;
+ bool qualResult;
+ bool isDone;
ProjectionInfo *projInfo;
/* ----------------
@@ -191,7 +191,7 @@ ExecResult(Result * node)
bool
ExecInitResult(Result * node, EState * estate, Plan * parent)
{
- ResultState *resstate;
+ ResultState *resstate;
/* ----------------
* assign execution state to node
@@ -267,7 +267,7 @@ ExecCountSlotsResult(Result * node)
void
ExecEndResult(Result * node)
{
- ResultState *resstate;
+ ResultState *resstate;
resstate = node->resstate;
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c
index d3451f8026..1d04360c9d 100644
--- a/src/backend/executor/nodeSeqscan.c
+++ b/src/backend/executor/nodeSeqscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.5 1997/09/07 04:41:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.6 1997/09/08 02:22:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,13 +49,13 @@ static TupleTableSlot *SeqNext(SeqScan * node);
static TupleTableSlot *
SeqNext(SeqScan * node)
{
- HeapTuple tuple;
- HeapScanDesc scandesc;
+ HeapTuple tuple;
+ HeapScanDesc scandesc;
CommonScanState *scanstate;
- EState *estate;
- ScanDirection direction;
+ EState *estate;
+ ScanDirection direction;
TupleTableSlot *slot;
- Buffer buffer;
+ Buffer buffer;
/* ----------------
* get information from the estate and scan state
@@ -118,7 +118,7 @@ TupleTableSlot *
ExecSeqScan(SeqScan * node)
{
TupleTableSlot *slot;
- Plan *outerPlan;
+ Plan *outerPlan;
S_printf("ExecSeqScan: scanning node: ");
S_nodeDisplay(node);
@@ -150,19 +150,19 @@ ExecSeqScan(SeqScan * node)
* subplans of scans.
* ----------------------------------------------------------------
*/
-static Oid
+static Oid
InitScanRelation(SeqScan * node, EState * estate,
CommonScanState * scanstate, Plan * outerPlan)
{
- Index relid;
- List *rangeTable;
- RangeTblEntry *rtentry;
- Oid reloid;
- TimeQual timeQual;
- ScanDirection direction;
- Relation currentRelation;
- HeapScanDesc currentScanDesc;
- RelationInfo *resultRelationInfo;
+ Index relid;
+ List *rangeTable;
+ RangeTblEntry *rtentry;
+ Oid reloid;
+ TimeQual timeQual;
+ ScanDirection direction;
+ Relation currentRelation;
+ HeapScanDesc currentScanDesc;
+ RelationInfo *resultRelationInfo;
if (outerPlan == NULL)
{
@@ -239,9 +239,9 @@ bool
ExecInitSeqScan(SeqScan * node, EState * estate, Plan * parent)
{
CommonScanState *scanstate;
- Plan *outerPlan;
- Oid reloid;
- HeapScanDesc scandesc;
+ Plan *outerPlan;
+ Oid reloid;
+ HeapScanDesc scandesc;
/* ----------------
* assign the node's execution state
@@ -315,7 +315,7 @@ void
ExecEndSeqScan(SeqScan * node)
{
CommonScanState *scanstate;
- Plan *outerPlan;
+ Plan *outerPlan;
/* ----------------
* get information from node
@@ -369,11 +369,11 @@ void
ExecSeqReScan(SeqScan * node, ExprContext * exprCtxt, Plan * parent)
{
CommonScanState *scanstate;
- EState *estate;
- Plan *outerPlan;
- Relation rdesc;
- HeapScanDesc sdesc;
- ScanDirection direction;
+ EState *estate;
+ Plan *outerPlan;
+ Relation rdesc;
+ HeapScanDesc sdesc;
+ ScanDirection direction;
scanstate = node->scanstate;
estate = node->plan.state;
@@ -406,8 +406,8 @@ void
ExecSeqMarkPos(SeqScan * node)
{
CommonScanState *scanstate;
- Plan *outerPlan;
- HeapScanDesc sdesc;
+ Plan *outerPlan;
+ HeapScanDesc sdesc;
scanstate = node->scanstate;
@@ -445,8 +445,8 @@ void
ExecSeqRestrPos(SeqScan * node)
{
CommonScanState *scanstate;
- Plan *outerPlan;
- HeapScanDesc sdesc;
+ Plan *outerPlan;
+ HeapScanDesc sdesc;
scanstate = node->scanstate;
diff --git a/src/backend/executor/nodeSort.c b/src/backend/executor/nodeSort.c
index eb2e2e7b18..64f56bc99a 100644
--- a/src/backend/executor/nodeSort.c
+++ b/src/backend/executor/nodeSort.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.7 1997/09/07 04:41:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.8 1997/09/08 02:22:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,17 +32,17 @@
* Returns an array of ScanKeyData.
* ----------------------------------------------------------------
*/
-static ScanKey
+static ScanKey
FormSortKeys(Sort * sortnode)
{
- ScanKey sortkeys;
- List *targetList;
- List *tl;
- int keycount;
- Resdom *resdom;
- AttrNumber resno;
- Index reskey;
- Oid reskeyop;
+ ScanKey sortkeys;
+ List *targetList;
+ List *tl;
+ int keycount;
+ Resdom *resdom;
+ AttrNumber resno;
+ Index reskey;
+ Oid reskeyop;
/* ----------------
* get information from the node
@@ -65,7 +65,7 @@ FormSortKeys(Sort * sortnode)
*/
foreach(tl, targetList)
{
- TargetEntry *target = (TargetEntry *) lfirst(tl);
+ TargetEntry *target = (TargetEntry *) lfirst(tl);
resdom = target->resdom;
resno = resdom->resno;
@@ -104,13 +104,13 @@ FormSortKeys(Sort * sortnode)
TupleTableSlot *
ExecSort(Sort * node)
{
- EState *estate;
- SortState *sortstate;
- Plan *outerNode;
- ScanDirection dir;
- int keycount;
- ScanKey sortkeys;
- HeapTuple heapTuple;
+ EState *estate;
+ SortState *sortstate;
+ Plan *outerNode;
+ ScanDirection dir;
+ int keycount;
+ ScanKey sortkeys;
+ HeapTuple heapTuple;
TupleTableSlot *slot;
/* ----------------
@@ -231,9 +231,9 @@ ExecSort(Sort * node)
bool
ExecInitSort(Sort * node, EState * estate, Plan * parent)
{
- SortState *sortstate;
- Plan *outerPlan;
- ScanKey sortkeys;
+ SortState *sortstate;
+ Plan *outerPlan;
+ ScanKey sortkeys;
SO1_printf("ExecInitSort: %s\n",
"initializing sort node");
@@ -330,8 +330,8 @@ ExecCountSlotsSort(Sort * node)
void
ExecEndSort(Sort * node)
{
- SortState *sortstate;
- Plan *outerPlan;
+ SortState *sortstate;
+ Plan *outerPlan;
/* ----------------
* get info from the sort state
@@ -371,7 +371,7 @@ ExecEndSort(Sort * node)
void
ExecSortMarkPos(Sort * node)
{
- SortState *sortstate;
+ SortState *sortstate;
/* ----------------
* if we haven't sorted yet, just return
@@ -395,7 +395,7 @@ ExecSortMarkPos(Sort * node)
void
ExecSortRestrPos(Sort * node)
{
- SortState *sortstate;
+ SortState *sortstate;
/* ----------------
* if we haven't sorted yet, just return.
diff --git a/src/backend/executor/nodeTee.c b/src/backend/executor/nodeTee.c
index 8a1e233125..e3ddfe39d6 100644
--- a/src/backend/executor/nodeTee.c
+++ b/src/backend/executor/nodeTee.c
@@ -15,7 +15,7 @@
* ExecEndTee
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.7 1997/09/07 04:41:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.8 1997/09/08 02:22:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,12 +47,12 @@
bool
ExecInitTee(Tee * node, EState * currentEstate, Plan * parent)
{
- TeeState *teeState;
- Plan *outerPlan;
- int len;
- Relation bufferRel;
- TupleDesc tupType;
- EState *estate;
+ TeeState *teeState;
+ Plan *outerPlan;
+ int len;
+ Relation bufferRel;
+ TupleDesc tupType;
+ EState *estate;
/*
* it is possible that the Tee has already been initialized since it
@@ -154,7 +154,7 @@ ExecInitTee(Tee * node, EState * currentEstate, Plan * parent)
if (node->teeTableName[0] != '\0')
{
- Relation r;
+ Relation r;
teeState->tee_bufferRelname = pstrdup(node->teeTableName);
@@ -168,7 +168,7 @@ ExecInitTee(Tee * node, EState * currentEstate, Plan * parent)
bufferRel = heap_openr(teeState->tee_bufferRelname);
else
bufferRel = heap_open(heap_create(teeState->tee_bufferRelname,
- /*FIX */ NULL,
+ /* FIX */ NULL,
'n',
DEFAULT_SMGR,
tupType));
@@ -232,10 +232,10 @@ ExecCountSlotsTee(Tee * node)
static void
initTeeScanDescs(Tee * node)
{
- TeeState *teeState;
- Relation bufferRel;
- ScanDirection dir;
- MemoryContext orig;
+ TeeState *teeState;
+ Relation bufferRel;
+ ScanDirection dir;
+ MemoryContext orig;
teeState = node->teestate;
if (teeState->tee_leftScanDesc && teeState->tee_rightScanDesc)
@@ -292,20 +292,20 @@ initTeeScanDescs(Tee * node)
TupleTableSlot *
ExecTee(Tee * node, Plan * parent)
{
- EState *estate;
- TeeState *teeState;
- int leftPlace,
- rightPlace,
- lastPlace;
- int branch;
+ EState *estate;
+ TeeState *teeState;
+ int leftPlace,
+ rightPlace,
+ lastPlace;
+ int branch;
TupleTableSlot *result;
TupleTableSlot *slot;
- Plan *childNode;
- ScanDirection dir;
- HeapTuple heapTuple;
- Relation bufferRel;
- HeapScanDesc scanDesc;
- Buffer buffer;
+ Plan *childNode;
+ ScanDirection dir;
+ HeapTuple heapTuple;
+ Relation bufferRel;
+ HeapScanDesc scanDesc;
+ Buffer buffer;
estate = ((Plan *) node)->state;
teeState = node->teestate;
@@ -369,7 +369,7 @@ ExecTee(Tee * node, Plan * parent)
* move the scandesc forward so we don't re-read this
* tuple later
*/
- HeapTuple throwAway;
+ HeapTuple throwAway;
/* Buffer buffer; */
throwAway = heap_getnext(scanDesc,
@@ -446,9 +446,9 @@ void
ExecTeeReScan(Tee * node, ExprContext * exprCtxt, Plan * parent)
{
- EState *estate;
- TeeState *teeState;
- ScanDirection dir;
+ EState *estate;
+ TeeState *teeState;
+ ScanDirection dir;
estate = ((Plan *) node)->state;
teeState = node->teestate;
@@ -492,13 +492,13 @@ ExecTeeReScan(Tee * node, ExprContext * exprCtxt, Plan * parent)
void
ExecEndTee(Tee * node, Plan * parent)
{
- EState *estate;
- TeeState *teeState;
- int leftPlace,
- rightPlace,
- lastPlace;
- Relation bufferRel;
- MemoryContext orig;
+ EState *estate;
+ TeeState *teeState;
+ int leftPlace,
+ rightPlace,
+ lastPlace;
+ Relation bufferRel;
+ MemoryContext orig;
estate = ((Plan *) node)->state;
teeState = node->teestate;
diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c
index 75e40ccad9..5a340b8cf5 100644
--- a/src/backend/executor/nodeUnique.c
+++ b/src/backend/executor/nodeUnique.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.8 1997/09/07 04:41:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.9 1997/09/08 02:22:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,15 +47,15 @@
* same ADT value. -cim
* ----------------------------------------------------------------
*/
-static bool /* true if tuples are identical, false
+static bool /* true if tuples are identical, false
* otherwise */
ExecIdenticalTuples(TupleTableSlot * t1, TupleTableSlot * t2)
{
- HeapTuple h1;
- HeapTuple h2;
- char *d1;
- char *d2;
- int len;
+ HeapTuple h1;
+ HeapTuple h2;
+ char *d1;
+ char *d2;
+ int len;
h1 = t1->val;
h2 = t2->val;
@@ -110,14 +110,14 @@ ExecIdenticalTuples(TupleTableSlot * t1, TupleTableSlot * t2)
TupleTableSlot * /* return: a tuple or NULL */
ExecUnique(Unique * node)
{
- UniqueState *uniquestate;
+ UniqueState *uniquestate;
TupleTableSlot *resultTupleSlot;
TupleTableSlot *slot;
- Plan *outerPlan;
- char *uniqueAttr;
- AttrNumber uniqueAttrNum;
- TupleDesc tupDesc;
- Oid typoutput;
+ Plan *outerPlan;
+ char *uniqueAttr;
+ AttrNumber uniqueAttrNum;
+ TupleDesc tupDesc;
+ Oid typoutput;
/* ----------------
* get information from the node
@@ -180,12 +180,12 @@ ExecUnique(Unique * node)
* to check equality, we check to see if the typoutput of the
* attributes are equal
*/
- bool isNull1,
- isNull2;
- char *attr1,
- *attr2;
- char *val1,
- *val2;
+ bool isNull1,
+ isNull2;
+ char *attr1,
+ *attr2;
+ char *val1,
+ *val2;
attr1 = heap_getattr(slot->val, InvalidBuffer,
uniqueAttrNum, tupDesc, &isNull1);
@@ -245,9 +245,9 @@ ExecUnique(Unique * node)
bool /* return: initialization status */
ExecInitUnique(Unique * node, EState * estate, Plan * parent)
{
- UniqueState *uniquestate;
- Plan *outerPlan;
- char *uniqueAttr;
+ UniqueState *uniquestate;
+ Plan *outerPlan;
+ char *uniqueAttr;
/* ----------------
* assign execution state to node
@@ -299,8 +299,8 @@ ExecInitUnique(Unique * node, EState * estate, Plan * parent)
if (uniqueAttr)
{
- TupleDesc tupDesc;
- int i = 0;
+ TupleDesc tupDesc;
+ int i = 0;
tupDesc = ExecGetResultType(uniquestate);
@@ -340,7 +340,7 @@ ExecCountSlotsUnique(Unique * node)
void
ExecEndUnique(Unique * node)
{
- UniqueState *uniquestate;
+ UniqueState *uniquestate;
uniquestate = node->uniquestate;
ExecEndNode(outerPlan((Plan *) node), (Plan *) node);
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 1d05a752d2..de4915785d 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -11,39 +11,39 @@
typedef struct
{
- QueryTreeList *qtlist; /* malloced */
- uint32 processed; /* by Executor */
- SPITupleTable *tuptable;
- Portal portal; /* portal per procedure */
- MemoryContext savedcxt;
- CommandId savedId;
-} _SPI_connection;
-
-static Portal _SPI_portal = (Portal) NULL;
+ QueryTreeList *qtlist; /* malloced */
+ uint32 processed; /* by Executor */
+ SPITupleTable *tuptable;
+ Portal portal; /* portal per procedure */
+ MemoryContext savedcxt;
+ CommandId savedId;
+} _SPI_connection;
+
+static Portal _SPI_portal = (Portal) NULL;
static _SPI_connection *_SPI_stack = NULL;
static _SPI_connection *_SPI_current = NULL;
-static int _SPI_connected = -1;
-static int _SPI_curid = -1;
+static int _SPI_connected = -1;
+static int _SPI_curid = -1;
-uint32 SPI_processed = 0;
-SPITupleTable *SPI_tuptable;
-int SPI_result;
+uint32 SPI_processed = 0;
+SPITupleTable *SPI_tuptable;
+int SPI_result;
-void spi_printtup(HeapTuple tuple, TupleDesc tupdesc);
+void spi_printtup(HeapTuple tuple, TupleDesc tupdesc);
typedef struct
{
- QueryTreeList *qtlist;
- List *ptlist;
- int nargs;
- Oid *argtypes;
-} _SPI_plan;
+ QueryTreeList *qtlist;
+ List *ptlist;
+ int nargs;
+ Oid *argtypes;
+} _SPI_plan;
-static int _SPI_execute(char *src, int tcount, _SPI_plan * plan);
-static int _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount);
+static int _SPI_execute(char *src, int tcount, _SPI_plan * plan);
+static int _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount);
#if 0
-static void _SPI_fetch(FetchStmt * stmt);
+static void _SPI_fetch(FetchStmt * stmt);
#endif
static int
@@ -52,23 +52,23 @@ _SPI_execute_plan(_SPI_plan * plan,
static _SPI_plan *_SPI_copy_plan(_SPI_plan * plan, bool local);
-static int _SPI_begin_call(bool execmem);
-static int _SPI_end_call(bool procmem);
+static int _SPI_begin_call(bool execmem);
+static int _SPI_end_call(bool procmem);
static MemoryContext _SPI_execmem(void);
static MemoryContext _SPI_procmem(void);
-static bool _SPI_checktuples(bool isRetrieveIntoRelation);
+static bool _SPI_checktuples(bool isRetrieveIntoRelation);
#ifdef SPI_EXECUTOR_STATS
-extern int ShowExecutorStats;
-extern void ResetUsage(void);
-extern void ShowUsage(void);
+extern int ShowExecutorStats;
+extern void ResetUsage(void);
+extern void ShowUsage(void);
#endif
int
SPI_connect()
{
- char pname[64];
+ char pname[64];
PortalVariableMemory pvmem;
/*
@@ -141,7 +141,7 @@ SPI_connect()
int
SPI_finish()
{
- int res;
+ int res;
res = _SPI_begin_call(false); /* live in procedure memory */
if (res < 0)
@@ -179,7 +179,7 @@ SPI_finish()
int
SPI_exec(char *src, int tcount)
{
- int res;
+ int res;
if (src == NULL || tcount < 0)
return (SPI_ERROR_ARGUMENT);
@@ -197,7 +197,7 @@ SPI_exec(char *src, int tcount)
int
SPI_execp(void *plan, char **Values, char *Nulls, int tcount)
{
- int res;
+ int res;
if (plan == NULL || tcount < 0)
return (SPI_ERROR_ARGUMENT);
@@ -216,10 +216,10 @@ SPI_execp(void *plan, char **Values, char *Nulls, int tcount)
return (res);
}
-void *
+void *
SPI_prepare(char *src, int nargs, Oid * argtypes)
{
- _SPI_plan *plan;
+ _SPI_plan *plan;
if (nargs < 0 || (nargs > 0 && argtypes == NULL))
{
@@ -248,10 +248,10 @@ SPI_prepare(char *src, int nargs, Oid * argtypes)
}
-void *
+void *
SPI_saveplan(void *plan)
{
- _SPI_plan *newplan;
+ _SPI_plan *newplan;
if (plan == NULL)
{
@@ -275,7 +275,7 @@ SPI_saveplan(void *plan)
int
SPI_fnumber(TupleDesc tupdesc, char *fname)
{
- int res;
+ int res;
if (_SPI_curid + 1 != _SPI_connected)
return (SPI_ERROR_UNCONNECTED);
@@ -289,12 +289,12 @@ SPI_fnumber(TupleDesc tupdesc, char *fname)
return (SPI_ERROR_NOATTRIBUTE);
}
-char *
+char *
SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
{
- char *val;
- bool isnull;
- Oid foutoid;
+ char *val;
+ bool isnull;
+ Oid foutoid;
SPI_result = 0;
if (_SPI_curid + 1 != _SPI_connected)
@@ -319,10 +319,10 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
return (fmgr(foutoid, val, gettypelem(tupdesc->attrs[fnumber - 1]->atttypid)));
}
-char *
+char *
SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
{
- char *val;
+ char *val;
*isnull = true;
SPI_result = 0;
@@ -340,10 +340,10 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
return (val);
}
-char *
+char *
SPI_gettype(TupleDesc tupdesc, int fnumber)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
SPI_result = 0;
if (_SPI_curid + 1 != _SPI_connected)
@@ -391,7 +391,7 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
return (tupdesc->attrs[fnumber - 1]->atttypid);
}
-char *
+char *
SPI_getrelname(Relation rel)
{
@@ -414,8 +414,8 @@ SPI_getrelname(Relation rel)
void
spi_printtup(HeapTuple tuple, TupleDesc tupdesc)
{
- SPITupleTable *tuptable;
- MemoryContext oldcxt;
+ SPITupleTable *tuptable;
+ MemoryContext oldcxt;
/*
* When called by Executor _SPI_curid expected to be equal to
@@ -459,18 +459,18 @@ spi_printtup(HeapTuple tuple, TupleDesc tupdesc)
static int
_SPI_execute(char *src, int tcount, _SPI_plan * plan)
{
- QueryTreeList *queryTree_list;
- List *planTree_list;
- List *ptlist;
- QueryDesc *qdesc;
- Query *queryTree;
- Plan *planTree;
- EState *state;
- int qlen;
- int nargs = 0;
- Oid *argtypes = NULL;
- int res;
- int i;
+ QueryTreeList *queryTree_list;
+ List *planTree_list;
+ List *ptlist;
+ QueryDesc *qdesc;
+ Query *queryTree;
+ Plan *planTree;
+ EState *state;
+ int qlen;
+ int nargs = 0;
+ Oid *argtypes = NULL;
+ int res;
+ int i;
/* Increment CommandCounter to see changes made by now */
CommandCounterIncrement();
@@ -502,7 +502,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan * plan)
{
if (nodeTag(queryTree->utilityStmt) == T_CopyStmt)
{
- CopyStmt *stmt = (CopyStmt *) (queryTree->utilityStmt);
+ CopyStmt *stmt = (CopyStmt *) (queryTree->utilityStmt);
if (stmt->filename == NULL)
return (SPI_ERROR_COPY);
@@ -556,17 +556,17 @@ _SPI_execute(char *src, int tcount, _SPI_plan * plan)
static int
_SPI_execute_plan(_SPI_plan * plan, char **Values, char *Nulls, int tcount)
{
- QueryTreeList *queryTree_list = plan->qtlist;
- List *planTree_list = plan->ptlist;
- QueryDesc *qdesc;
- Query *queryTree;
- Plan *planTree;
- EState *state;
- int nargs = plan->nargs;
- int qlen = queryTree_list->len;
- int res;
- int i,
- k;
+ QueryTreeList *queryTree_list = plan->qtlist;
+ List *planTree_list = plan->ptlist;
+ QueryDesc *qdesc;
+ Query *queryTree;
+ Plan *planTree;
+ EState *state;
+ int nargs = plan->nargs;
+ int qlen = queryTree_list->len;
+ int res;
+ int i,
+ k;
/* Increment CommandCounter to see changes made by now */
CommandCounterIncrement();
@@ -598,7 +598,7 @@ _SPI_execute_plan(_SPI_plan * plan, char **Values, char *Nulls, int tcount)
state = CreateExecutorState();
if (nargs > 0)
{
- ParamListInfo paramLI = (ParamListInfo) palloc((nargs + 1) *
+ ParamListInfo paramLI = (ParamListInfo) palloc((nargs + 1) *
sizeof(ParamListInfoData));
state->es_param_list_info = paramLI;
@@ -627,14 +627,14 @@ _SPI_execute_plan(_SPI_plan * plan, char **Values, char *Nulls, int tcount)
static int
_SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
{
- Query *parseTree;
- Plan *plan;
- int operation;
- TupleDesc tupdesc;
- bool isRetrieveIntoPortal = false;
- bool isRetrieveIntoRelation = false;
- char *intoName = NULL;
- int res;
+ Query *parseTree;
+ Plan *plan;
+ int operation;
+ TupleDesc tupdesc;
+ bool isRetrieveIntoPortal = false;
+ bool isRetrieveIntoRelation = false;
+ char *intoName = NULL;
+ int res;
parseTree = queryDesc->parsetree;
plan = queryDesc->plantree;
@@ -642,34 +642,34 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
switch (operation)
{
- case CMD_SELECT:
- res = SPI_OK_SELECT;
- if (parseTree->isPortal)
- {
- isRetrieveIntoPortal = true;
- intoName = parseTree->into;
- parseTree->isBinary = false; /* */
+ case CMD_SELECT:
+ res = SPI_OK_SELECT;
+ if (parseTree->isPortal)
+ {
+ isRetrieveIntoPortal = true;
+ intoName = parseTree->into;
+ parseTree->isBinary = false; /* */
- return (SPI_ERROR_CURSOR);
+ return (SPI_ERROR_CURSOR);
- }
- else if (parseTree->into != NULL) /* select into table */
- {
- res = SPI_OK_SELINTO;
- isRetrieveIntoRelation = true;
- }
- break;
- case CMD_INSERT:
- res = SPI_OK_INSERT;
- break;
- case CMD_DELETE:
- res = SPI_OK_DELETE;
- break;
- case CMD_UPDATE:
- res = SPI_OK_UPDATE;
- break;
- default:
- return (SPI_ERROR_OPUNKNOWN);
+ }
+ else if (parseTree->into != NULL) /* select into table */
+ {
+ res = SPI_OK_SELINTO;
+ isRetrieveIntoRelation = true;
+ }
+ break;
+ case CMD_INSERT:
+ res = SPI_OK_INSERT;
+ break;
+ case CMD_DELETE:
+ res = SPI_OK_DELETE;
+ break;
+ case CMD_UPDATE:
+ res = SPI_OK_UPDATE;
+ break;
+ default:
+ return (SPI_ERROR_OPUNKNOWN);
}
if (state == NULL) /* plan preparation */
@@ -725,13 +725,13 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
static void
_SPI_fetch(FetchStmt * stmt)
{
- char *name = stmt->portalname;
- int feature = (stmt->direction == FORWARD) ? EXEC_FOR : EXEC_BACK;
- int count = stmt->howMany;
- Portal portal;
- QueryDesc *queryDesc;
- EState *state;
- MemoryContext context;
+ char *name = stmt->portalname;
+ int feature = (stmt->direction == FORWARD) ? EXEC_FOR : EXEC_BACK;
+ int count = stmt->howMany;
+ Portal portal;
+ QueryDesc *queryDesc;
+ EState *state;
+ MemoryContext context;
if (name == NULL)
elog(FATAL, "SPI_fetch from blank portal unsupported");
@@ -761,10 +761,10 @@ _SPI_fetch(FetchStmt * stmt)
#endif
-static MemoryContext
+static MemoryContext
_SPI_execmem()
{
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
PortalHeapMemory phmem;
phmem = PortalGetHeapMemory(_SPI_current->portal);
@@ -774,10 +774,10 @@ _SPI_execmem()
}
-static MemoryContext
+static MemoryContext
_SPI_procmem()
{
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
PortalVariableMemory pvmem;
pvmem = PortalGetVariableMemory(_SPI_current->portal);
@@ -834,12 +834,12 @@ _SPI_end_call(bool procmem)
return (0);
}
-static bool
+static bool
_SPI_checktuples(bool isRetrieveIntoRelation)
{
- uint32 processed = _SPI_current->processed;
- SPITupleTable *tuptable = _SPI_current->tuptable;
- bool failed = false;
+ uint32 processed = _SPI_current->processed;
+ SPITupleTable *tuptable = _SPI_current->tuptable;
+ bool failed = false;
if (processed == 0)
{
@@ -866,9 +866,9 @@ _SPI_checktuples(bool isRetrieveIntoRelation)
static _SPI_plan *
_SPI_copy_plan(_SPI_plan * plan, bool local)
{
- _SPI_plan *newplan;
- MemoryContext oldcxt;
- int i;
+ _SPI_plan *newplan;
+ MemoryContext oldcxt;
+ int i;
if (local)
oldcxt = MemoryContextSwitchTo((MemoryContext)
diff --git a/src/backend/lib/dllist.c b/src/backend/lib/dllist.c
index 70feee02bb..8790a84440 100644
--- a/src/backend/lib/dllist.c
+++ b/src/backend/lib/dllist.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.6 1997/09/07 04:41:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/dllist.c,v 1.7 1997/09/08 02:22:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,10 +18,10 @@
#include <lib/dllist.h>
-Dllist *
+Dllist *
DLNewList(void)
{
- Dllist *l;
+ Dllist *l;
l = malloc(sizeof(Dllist));
l->dll_head = 0;
@@ -34,7 +34,7 @@ DLNewList(void)
void
DLFreeList(Dllist * l)
{
- Dlelem *curr;
+ Dlelem *curr;
while ((curr = DLRemHead(l)) != 0)
free(curr);
@@ -42,10 +42,10 @@ DLFreeList(Dllist * l)
free(l);
}
-Dlelem *
+Dlelem *
DLNewElem(void *val)
{
- Dlelem *e;
+ Dlelem *e;
e = malloc(sizeof(Dlelem));
e->dle_next = 0;
@@ -61,7 +61,7 @@ DLFreeElem(Dlelem * e)
free(e);
}
-Dlelem *
+Dlelem *
DLGetHead(Dllist * l)
{
return (l ? l->dll_head : 0);
@@ -69,17 +69,17 @@ DLGetHead(Dllist * l)
/* get the value stored in the first element */
#ifdef NOT_USED
-void *
+void *
DLGetHeadVal(Dllist * l)
{
- Dlelem *e = DLGetHead(l);
+ Dlelem *e = DLGetHead(l);
return (e ? e->dle_val : 0);
}
#endif
-Dlelem *
+Dlelem *
DLGetTail(Dllist * l)
{
return (l ? l->dll_tail : 0);
@@ -87,23 +87,23 @@ DLGetTail(Dllist * l)
/* get the value stored in the first element */
#ifdef NOT_USED
-void *
+void *
DLGetTailVal(Dllist * l)
{
- Dlelem *e = DLGetTail(l);
+ Dlelem *e = DLGetTail(l);
return (e ? e->dle_val : 0);
}
#endif
-Dlelem *
+Dlelem *
DLGetPred(Dlelem * e) /* get predecessor */
{
return (e ? e->dle_prev : 0);
}
-Dlelem *
+Dlelem *
DLGetSucc(Dlelem * e) /* get successor */
{
return (e ? e->dle_next : 0);
@@ -112,7 +112,7 @@ DLGetSucc(Dlelem * e) /* get successor */
void
DLRemove(Dlelem * e)
{
- Dllist *l;
+ Dllist *l;
if (e->dle_prev)
e->dle_prev->dle_next = e->dle_next;
@@ -162,11 +162,11 @@ DLAddTail(Dllist * l, Dlelem * e)
l->dll_head = l->dll_tail;
}
-Dlelem *
+Dlelem *
DLRemHead(Dllist * l)
{
/* remove and return the head */
- Dlelem *result;
+ Dlelem *result;
if (l->dll_head == 0)
return 0;
@@ -188,11 +188,11 @@ DLRemHead(Dllist * l)
return result;
}
-Dlelem *
+Dlelem *
DLRemTail(Dllist * l)
{
/* remove and return the tail */
- Dlelem *result;
+ Dlelem *result;
if (l->dll_tail == 0)
return 0;
diff --git a/src/backend/lib/fstack.c b/src/backend/lib/fstack.c
index f97d467fe9..f28f24ae14 100644
--- a/src/backend/lib/fstack.c
+++ b/src/backend/lib/fstack.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/lib/Attic/fstack.c,v 1.5 1997/09/07 04:42:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/Attic/fstack.c,v 1.6 1997/09/08 02:22:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,7 @@ FixedStackInit(FixedStack stack, Offset offset)
Pointer
FixedStackPop(FixedStack stack)
{
- Pointer pointer;
+ Pointer pointer;
AssertArg(FixedStackIsValid(stack));
@@ -75,7 +75,7 @@ FixedStackPop(FixedStack stack)
void
FixedStackPush(FixedStack stack, Pointer pointer)
{
- FixedItem item = FixedStackGetItem(stack, pointer);
+ FixedItem item = FixedStackGetItem(stack, pointer);
AssertArg(FixedStackIsValid(stack));
AssertArg(PointerIsValid(pointer));
@@ -96,11 +96,11 @@ FixedStackPush(FixedStack stack, Pointer pointer)
* BadArg if stack is invalid.
* BadArg if pointer is invalid.
*/
-static bool
+static bool
FixedStackContains(FixedStack stack, Pointer pointer)
{
- FixedItem next;
- FixedItem item;
+ FixedItem next;
+ FixedItem item;
AssertArg(FixedStackIsValid(stack));
AssertArg(PointerIsValid(pointer));
@@ -135,7 +135,7 @@ FixedStackGetTop(FixedStack stack)
Pointer
FixedStackGetNext(FixedStack stack, Pointer pointer)
{
- FixedItem item;
+ FixedItem item;
/* AssertArg(FixedStackIsValid(stack)); */
/* AssertArg(PointerIsValid(pointer)); */
diff --git a/src/backend/lib/hasht.c b/src/backend/lib/hasht.c
index 4e12dcf30e..3ad58e4e0e 100644
--- a/src/backend/lib/hasht.c
+++ b/src/backend/lib/hasht.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/lib/Attic/hasht.c,v 1.5 1997/09/07 04:42:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/Attic/hasht.c,v 1.6 1997/09/08 02:22:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,9 +28,9 @@
void
HashTableWalk(HTAB * hashtable, HashtFunc function, int arg)
{
- long *hashent;
- long *data;
- int keysize;
+ long *hashent;
+ long *data;
+ int keysize;
keysize = hashtable->hctl->keysize;
hash_seq((HTAB *) NULL);
diff --git a/src/backend/lib/lispsort.c b/src/backend/lib/lispsort.c
index bf346ecc1a..41c0e934e7 100644
--- a/src/backend/lib/lispsort.c
+++ b/src/backend/lib/lispsort.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/lib/Attic/lispsort.c,v 1.5 1997/09/07 04:42:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/Attic/lispsort.c,v 1.6 1997/09/08 02:23:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,15 +29,15 @@
** as passed into lisp_qsort(), and returns a new list with
** the nodes sorted. The old list is *not* freed or modified (?)
*/
-List *
+List *
lisp_qsort(List * the_list, /* the list to be sorted */
int (*compare) ()) /* function to compare two nodes */
{
- int i;
- size_t num;
- List **nodearray;
- List *tmp,
- *output;
+ int i;
+ size_t num;
+ List **nodearray;
+ List *tmp,
+ *output;
/* find size of list */
num = length(the_list);
diff --git a/src/backend/lib/qsort.c b/src/backend/lib/qsort.c
index ff2bbfa16d..14ac14c39d 100644
--- a/src/backend/lib/qsort.c
+++ b/src/backend/lib/qsort.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/lib/Attic/qsort.c,v 1.3 1997/09/07 04:42:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/Attic/qsort.c,v 1.4 1997/09/08 02:23:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)qsort.c 5.9 (Berkeley) 2/23/91";
+static char sccsid[] = "@(#)qsort.c 5.9 (Berkeley) 2/23/91";
#endif /* LIBC_SCCS and not lint */
@@ -67,8 +67,8 @@ static char sccsid[] = "@(#)qsort.c 5.9 (Berkeley) 2/23/91";
*/
#define THRESH 4
-static void insertion_sort(char *bot, int nmemb, int size, int (*compar) ());
-static void quick_sort(char *bot, int nmemb, int size, int (*compar) ());
+static void insertion_sort(char *bot, int nmemb, int size, int (*compar) ());
+static void quick_sort(char *bot, int nmemb, int size, int (*compar) ());
void
pg_qsort(void *bot,
@@ -129,15 +129,15 @@ pg_qsort(void *bot,
static void
quick_sort(char *bot, int nmemb, int size, int (*compar) ())
{
- register int cnt;
+ register int cnt;
register u_char ch;
- register char *top,
- *mid,
- *t1,
- *t2;
- register int n1,
- n2;
- char *bsv;
+ register char *top,
+ *mid,
+ *t1,
+ *t2;
+ register int n1,
+ n2;
+ char *bsv;
/* bot and nmemb must already be set. */
partition:
@@ -277,13 +277,13 @@ swap: SWAP(bot, replace);
static void
insertion_sort(char *bot, int nmemb, int size, int (*compar) ())
{
- register int cnt;
+ register int cnt;
register u_char ch;
- register char *s1,
- *s2,
- *t1,
- *t2,
- *top;
+ register char *s1,
+ *s2,
+ *t1,
+ *t2,
+ *top;
/*
* A simple insertion sort (see Knuth, Vol. 3, page 81, Algorithm S).
diff --git a/src/backend/lib/stringinfo.c b/src/backend/lib/stringinfo.c
index 34108c04c7..639af1854f 100644
--- a/src/backend/lib/stringinfo.c
+++ b/src/backend/lib/stringinfo.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/lib/stringinfo.c,v 1.4 1997/09/07 04:42:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/lib/stringinfo.c,v 1.5 1997/09/08 02:23:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,8 +30,8 @@
StringInfo
makeStringInfo()
{
- StringInfo res;
- long size;
+ StringInfo res;
+ long size;
res = (StringInfo) palloc(sizeof(StringInfoData));
if (res == NULL)
@@ -72,9 +72,9 @@ makeStringInfo()
void
appendStringInfo(StringInfo str, char *buffer)
{
- int buflen,
- newlen;
- char *s;
+ int buflen,
+ newlen;
+ char *s;
Assert((str != NULL));
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index ff6711d3b5..f3af7c52cc 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.15 1997/09/07 04:42:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.16 1997/09/08 02:23:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,7 +72,7 @@
#include <libpq/hba.h>
#include <libpq/password.h>
-static int be_getauthsvc(MsgType msgtype);
+static int be_getauthsvc(MsgType msgtype);
/*----------------------------------------------------------------
* common definitions for generic fe/be routines
@@ -81,9 +81,9 @@ static int be_getauthsvc(MsgType msgtype);
struct authsvc
{
- char name[16]; /* service nickname (for command line) */
- MsgType msgtype; /* startup packet header type */
- int allowed; /* initially allowed (before command line
+ char name[16]; /* service nickname (for command line) */
+ MsgType msgtype; /* startup packet header type */
+ int allowed; /* initially allowed (before command line
* option parsing)? */
};
@@ -99,10 +99,10 @@ struct authsvc
*/
#if defined(HBA)
-static int useHostBasedAuth = 1;
+static int useHostBasedAuth = 1;
#else
-static int useHostBasedAuth = 0;
+static int useHostBasedAuth = 0;
#endif
@@ -125,7 +125,7 @@ static struct authsvc authsvcs[] = {
{"password", STARTUP_PASSWORD_MSG, 1}
};
-static n_authsvcs = sizeof(authsvcs) / sizeof(struct authsvc);
+static n_authsvcs = sizeof(authsvcs) / sizeof(struct authsvc);
#ifdef KRB4
/* This has to be ifdef'd out because krb.h does exist. This needs
@@ -157,13 +157,13 @@ pg_krb4_recvauth(int sock,
struct sockaddr_in * raddr,
char *username)
{
- long krbopts = 0;/* one-way authentication */
- KTEXT_ST clttkt;
- char instance[INST_SZ];
- AUTH_DAT auth_data;
- Key_schedule key_sched;
- char version[KRB_SENDAUTH_VLEN];
- int status;
+ long krbopts = 0; /* one-way authentication */
+ KTEXT_ST clttkt;
+ char instance[INST_SZ];
+ AUTH_DAT auth_data;
+ Key_schedule key_sched;
+ char version[KRB_SENDAUTH_VLEN];
+ int status;
strcpy(instance, "*"); /* don't care, but arg gets expanded
* anyway */
@@ -255,10 +255,10 @@ pg_krb4_recvauth(int sock,
* krb5_an_to_ln, except that it punts if multiple components are found,
* and we can't afford to punt.
*/
-static char *
+static char *
pg_an_to_ln(char *aname)
{
- char *p;
+ char *p;
if ((p = strchr(aname, '/')) || (p = strchr(aname, '@')))
*p = '\0';
@@ -297,16 +297,16 @@ pg_krb5_recvauth(int sock,
struct sockaddr_in * raddr,
char *username)
{
- char servbuf[MAXHOSTNAMELEN + 1 +
- sizeof(PG_KRB_SRVNAM)];
- char *hostp,
- *kusername = (char *) NULL;
+ char servbuf[MAXHOSTNAMELEN + 1 +
+ sizeof(PG_KRB_SRVNAM)];
+ char *hostp,
+ *kusername = (char *) NULL;
krb5_error_code code;
- krb5_principal client,
- server;
- krb5_address sender_addr;
+ krb5_principal client,
+ server;
+ krb5_address sender_addr;
krb5_rdreq_key_proc keyproc = (krb5_rdreq_key_proc) NULL;
- krb5_pointer keyprocarg = (krb5_pointer) NULL;
+ krb5_pointer keyprocarg = (krb5_pointer) NULL;
/*
* Set up server side -- since we have no ticket file to make this
@@ -426,9 +426,9 @@ pg_krb5_recvauth(int sock,
static int
pg_password_recvauth(Port * port, char *database, char *DataDir)
{
- PacketBuf buf;
- char *user,
- *password;
+ PacketBuf buf;
+ char *user,
+ *password;
if (PacketReceive(port, &buf, BLOCKING) != STATUS_OK)
{
@@ -451,7 +451,7 @@ pg_password_recvauth(Port * port, char *database, char *DataDir)
int
be_recvauth(MsgType msgtype_arg, Port * port, char *username, StartupInfo * sp)
{
- MsgType msgtype;
+ MsgType msgtype;
/*
* A message type of STARTUP_MSG (which once upon a time was the only
@@ -489,93 +489,93 @@ be_recvauth(MsgType msgtype_arg, Port * port, char *username, StartupInfo * sp)
switch (msgtype)
{
- case STARTUP_KRB4_MSG:
- if (!be_getauthsvc(msgtype))
- {
- sprintf(PQerrormsg,
- "be_recvauth: krb4 authentication disallowed\n");
- fputs(PQerrormsg, stderr);
- pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
- }
- if (pg_krb4_recvauth(port->sock, &port->laddr, &port->raddr,
- username) != STATUS_OK)
- {
- sprintf(PQerrormsg,
- "be_recvauth: krb4 authentication failed\n");
- fputs(PQerrormsg, stderr);
- pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
- }
- break;
- case STARTUP_KRB5_MSG:
- if (!be_getauthsvc(msgtype))
- {
- sprintf(PQerrormsg,
- "be_recvauth: krb5 authentication disallowed\n");
- fputs(PQerrormsg, stderr);
- pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
- }
- if (pg_krb5_recvauth(port->sock, &port->laddr, &port->raddr,
- username) != STATUS_OK)
- {
- sprintf(PQerrormsg,
- "be_recvauth: krb5 authentication failed\n");
- fputs(PQerrormsg, stderr);
- pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
- }
- break;
- case STARTUP_UNAUTH_MSG:
- if (!be_getauthsvc(msgtype))
- {
- sprintf(PQerrormsg,
- "be_recvauth: "
- "unauthenticated connections disallowed\n");
- fputs(PQerrormsg, stderr);
- pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
- }
- break;
- case STARTUP_HBA_MSG:
- if (hba_recvauth(port, sp->database, sp->user, DataDir) != STATUS_OK)
- {
- sprintf(PQerrormsg,
- "be_recvauth: host-based authentication failed\n");
- fputs(PQerrormsg, stderr);
- pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
- }
- break;
- case STARTUP_PASSWORD_MSG:
- if (!be_getauthsvc(msgtype))
- {
+ case STARTUP_KRB4_MSG:
+ if (!be_getauthsvc(msgtype))
+ {
+ sprintf(PQerrormsg,
+ "be_recvauth: krb4 authentication disallowed\n");
+ fputs(PQerrormsg, stderr);
+ pqdebug("%s", PQerrormsg);
+ return (STATUS_ERROR);
+ }
+ if (pg_krb4_recvauth(port->sock, &port->laddr, &port->raddr,
+ username) != STATUS_OK)
+ {
+ sprintf(PQerrormsg,
+ "be_recvauth: krb4 authentication failed\n");
+ fputs(PQerrormsg, stderr);
+ pqdebug("%s", PQerrormsg);
+ return (STATUS_ERROR);
+ }
+ break;
+ case STARTUP_KRB5_MSG:
+ if (!be_getauthsvc(msgtype))
+ {
+ sprintf(PQerrormsg,
+ "be_recvauth: krb5 authentication disallowed\n");
+ fputs(PQerrormsg, stderr);
+ pqdebug("%s", PQerrormsg);
+ return (STATUS_ERROR);
+ }
+ if (pg_krb5_recvauth(port->sock, &port->laddr, &port->raddr,
+ username) != STATUS_OK)
+ {
+ sprintf(PQerrormsg,
+ "be_recvauth: krb5 authentication failed\n");
+ fputs(PQerrormsg, stderr);
+ pqdebug("%s", PQerrormsg);
+ return (STATUS_ERROR);
+ }
+ break;
+ case STARTUP_UNAUTH_MSG:
+ if (!be_getauthsvc(msgtype))
+ {
+ sprintf(PQerrormsg,
+ "be_recvauth: "
+ "unauthenticated connections disallowed\n");
+ fputs(PQerrormsg, stderr);
+ pqdebug("%s", PQerrormsg);
+ return (STATUS_ERROR);
+ }
+ break;
+ case STARTUP_HBA_MSG:
+ if (hba_recvauth(port, sp->database, sp->user, DataDir) != STATUS_OK)
+ {
+ sprintf(PQerrormsg,
+ "be_recvauth: host-based authentication failed\n");
+ fputs(PQerrormsg, stderr);
+ pqdebug("%s", PQerrormsg);
+ return (STATUS_ERROR);
+ }
+ break;
+ case STARTUP_PASSWORD_MSG:
+ if (!be_getauthsvc(msgtype))
+ {
+ sprintf(PQerrormsg,
+ "be_recvauth: "
+ "plaintext password authentication disallowed\n");
+ fputs(PQerrormsg, stderr);
+ pqdebug("%s", PQerrormsg);
+ return (STATUS_ERROR);
+ }
+ if (pg_password_recvauth(port, sp->database, DataDir) != STATUS_OK)
+ {
+
+ /*
+ * pg_password_recvauth or lower-level routines have
+ * already set
+ */
+ /* the error message */
+ return (STATUS_ERROR);
+ }
+ break;
+ default:
sprintf(PQerrormsg,
- "be_recvauth: "
- "plaintext password authentication disallowed\n");
+ "be_recvauth: unrecognized message type: %d\n",
+ msgtype);
fputs(PQerrormsg, stderr);
pqdebug("%s", PQerrormsg);
return (STATUS_ERROR);
- }
- if (pg_password_recvauth(port, sp->database, DataDir) != STATUS_OK)
- {
-
- /*
- * pg_password_recvauth or lower-level routines have already
- * set
- */
- /* the error message */
- return (STATUS_ERROR);
- }
- break;
- default:
- sprintf(PQerrormsg,
- "be_recvauth: unrecognized message type: %d\n",
- msgtype);
- fputs(PQerrormsg, stderr);
- pqdebug("%s", PQerrormsg);
- return (STATUS_ERROR);
}
return (STATUS_OK);
}
@@ -596,9 +596,9 @@ be_recvauth(MsgType msgtype_arg, Port * port, char *username, StartupInfo * sp)
void
be_setauthsvc(char *name)
{
- int i,
- j;
- int turnon = 1;
+ int i,
+ j;
+ int turnon = 1;
if (!name)
return;
@@ -631,7 +631,7 @@ be_setauthsvc(char *name)
static int
be_getauthsvc(MsgType msgtype)
{
- int i;
+ int i;
for (i = 0; i < n_authsvcs; ++i)
if (msgtype == authsvcs[i].msgtype)
diff --git a/src/backend/libpq/be-dumpdata.c b/src/backend/libpq/be-dumpdata.c
index db0a99141d..f2a0a71889 100644
--- a/src/backend/libpq/be-dumpdata.c
+++ b/src/backend/libpq/be-dumpdata.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.6 1997/09/07 04:42:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-dumpdata.c,v 1.7 1997/09/08 02:23:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,7 +51,7 @@
* backend portal stack for recursive PQexec calls
* ----------------
*/
-static Dllist *be_portalstack;
+static Dllist *be_portalstack;
/* ----------------
* be_portalinit - initialize backend portal administration
@@ -84,11 +84,11 @@ be_portalpush(PortalEntry * entry)
* used by PQexec()
* ----------------
*/
-PortalEntry *
+PortalEntry *
be_portalpop(void)
{
- PortalEntry *p;
- Dlelem *elt;
+ PortalEntry *p;
+ Dlelem *elt;
elt = DLRemTail(be_portalstack);
@@ -105,10 +105,10 @@ be_portalpop(void)
* used by be_printtup()
* ----------------
*/
-PortalEntry *
+PortalEntry *
be_currentportal(void)
{
- Dlelem *elt;
+ Dlelem *elt;
elt = DLGetTail(be_portalstack);
return (elt ? (PortalEntry *) DLE_VAL(elt) : NULL);
@@ -126,14 +126,14 @@ be_currentportal(void)
* ----------------
*/
-static Oid be_portaloid;
-static u_int be_portalcnt = 0;
+static Oid be_portaloid;
+static u_int be_portalcnt = 0;
-PortalEntry *
+PortalEntry *
be_newportal(void)
{
- PortalEntry *entry;
- char buf[PortalNameLength];
+ PortalEntry *entry;
+ char buf[PortalNameLength];
/* ----------------
* generate a new name
@@ -170,9 +170,9 @@ be_typeinit(PortalEntry * entry,
TupleDesc tupDesc,
int natts)
{
- PortalBuffer *portal;
- GroupBuffer *group;
- int i;
+ PortalBuffer *portal;
+ GroupBuffer *group;
+ int i;
AttributeTupleForm *attrs = tupDesc->attrs;
/* ----------------
@@ -212,19 +212,19 @@ be_typeinit(PortalEntry * entry,
void
be_printtup(HeapTuple tuple, TupleDesc typeinfo)
{
- int i;
- char *attr;
- bool isnull;
- Oid typoutput;
-
- PortalEntry *entry = NULL;
- PortalBuffer *portal = NULL;
- GroupBuffer *group = NULL;
- TupleBlock *tuples = NULL;
- char **values;
- int *lengths;
-
- MemoryContext savecxt;
+ int i;
+ char *attr;
+ bool isnull;
+ Oid typoutput;
+
+ PortalEntry *entry = NULL;
+ PortalBuffer *portal = NULL;
+ GroupBuffer *group = NULL;
+ TupleBlock *tuples = NULL;
+ char **values;
+ int *lengths;
+
+ MemoryContext savecxt;
/* ----------------
* get the current portal and group
diff --git a/src/backend/libpq/be-fsstubs.c b/src/backend/libpq/be-fsstubs.c
index e3a464b087..da166ae54a 100644
--- a/src/backend/libpq/be-fsstubs.c
+++ b/src/backend/libpq/be-fsstubs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.13 1997/09/07 04:42:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.14 1997/09/08 02:23:10 momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
@@ -49,8 +49,8 @@ static LargeObjectDesc *cookies[MAX_LOBJ_FDS];
static GlobalMemory fscxt = NULL;
-static int newLOfd(LargeObjectDesc * lobjCookie);
-static void deleteLOfd(int fd);
+static int newLOfd(LargeObjectDesc * lobjCookie);
+static void deleteLOfd(int fd);
/*****************************************************************************
@@ -61,8 +61,8 @@ int
lo_open(Oid lobjId, int mode)
{
LargeObjectDesc *lobjDesc;
- int fd;
- MemoryContext currentContext;
+ int fd;
+ MemoryContext currentContext;
#if FSDB
elog(NOTICE, "LOopen(%d,%d)", lobjId, mode);
@@ -96,7 +96,7 @@ lo_open(Oid lobjId, int mode)
int
lo_close(int fd)
{
- MemoryContext currentContext;
+ MemoryContext currentContext;
if (fd >= MAX_LOBJ_FDS)
{
@@ -145,8 +145,8 @@ lo_write(int fd, char *buf, int len)
int
lo_lseek(int fd, int offset, int whence)
{
- MemoryContext currentContext;
- int ret;
+ MemoryContext currentContext;
+ int ret;
if (fd >= MAX_LOBJ_FDS)
{
@@ -167,8 +167,8 @@ Oid
lo_creat(int mode)
{
LargeObjectDesc *lobjDesc;
- MemoryContext currentContext;
- Oid lobjId;
+ MemoryContext currentContext;
+ Oid lobjId;
if (fscxt == NULL)
{
@@ -225,7 +225,7 @@ struct varlena *
loread(int fd, int len)
{
struct varlena *retval;
- int totalread = 0;
+ int totalread = 0;
retval = (struct varlena *) palloc(sizeof(int32) + len);
totalread = lo_read(fd, VARDATA(retval), len);
@@ -237,8 +237,8 @@ loread(int fd, int len)
int
lowrite(int fd, struct varlena * wbuf)
{
- int totalwritten;
- int bytestowrite;
+ int totalwritten;
+ int bytestowrite;
bytestowrite = VARSIZE(wbuf) - sizeof(int32);
totalwritten = lo_write(fd, VARDATA(wbuf), bytestowrite);
@@ -256,15 +256,15 @@ lowrite(int fd, struct varlena * wbuf)
Oid
lo_import(text * filename)
{
- int fd;
- int nbytes,
- tmp;
+ int fd;
+ int nbytes,
+ tmp;
#define BUFSIZE 1024
- char buf[BUFSIZE];
- char fnamebuf[8192];
+ char buf[BUFSIZE];
+ char fnamebuf[8192];
LargeObjectDesc *lobj;
- Oid lobjOid;
+ Oid lobjOid;
/*
* open the file to be read in
@@ -319,15 +319,15 @@ lo_import(text * filename)
int4
lo_export(Oid lobjId, text * filename)
{
- int fd;
- int nbytes,
- tmp;
+ int fd;
+ int nbytes,
+ tmp;
#define BUFSIZE 1024
- char buf[BUFSIZE];
- char fnamebuf[8192];
+ char buf[BUFSIZE];
+ char fnamebuf[8192];
LargeObjectDesc *lobj;
- mode_t oumask;
+ mode_t oumask;
/*
* create an inversion "object"
@@ -379,7 +379,7 @@ lo_export(Oid lobjId, text * filename)
static int
newLOfd(LargeObjectDesc * lobjCookie)
{
- int i;
+ int i;
for (i = 0; i < MAX_LOBJ_FDS; i++)
{
diff --git a/src/backend/libpq/be-pqexec.c b/src/backend/libpq/be-pqexec.c
index 06185e4534..24f2240d10 100644
--- a/src/backend/libpq/be-pqexec.c
+++ b/src/backend/libpq/be-pqexec.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.5 1997/09/07 04:42:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.6 1997/09/08 02:23:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,7 +37,7 @@
#include <string.h>
#endif
-static char *strmake(char *str, int len);
+static char *strmake(char *str, int len);
/* ----------------------------------------------------------------
* PQ interface routines
@@ -58,7 +58,7 @@ static char *strmake(char *str, int len);
* This code scavanged from HandleFunctionRequest() in tcop/fastpath.h
* ----------------
*/
-char *
+char *
PQfn(int fnid,
int *result_buf, /* can't use void, dec compiler barfs */
int result_len,
@@ -66,9 +66,9 @@ PQfn(int fnid,
PQArgBlock * args,
int nargs)
{
- char *retval; /* XXX - should be datum, maybe ? */
- char *arg[8];
- int i;
+ char *retval; /* XXX - should be datum, maybe ? */
+ char *arg[8];
+ int i;
/* ----------------
* fill args[] array
@@ -129,11 +129,11 @@ PQfn(int fnid,
* returns because the system longjmp's back to the main loop.
* ----------------
*/
-char *
+char *
PQexec(char *query)
{
- PortalEntry *entry = NULL;
- char *result = NULL;
+ PortalEntry *entry = NULL;
+ char *result = NULL;
/* ----------------
* create a new portal and put it on top of the portal stack.
@@ -158,7 +158,7 @@ PQexec(char *query)
result = entry->result;
if (result == NULL)
{
- char *PQE = "Cnull PQexec result";
+ char *PQE = "Cnull PQexec result";
result = pstrdup(PQE);
}
@@ -191,9 +191,9 @@ PQexec(char *query)
int
pqtest_PQexec(char *q)
{
- PortalBuffer *a;
- char *res;
- int t;
+ PortalBuffer *a;
+ char *res;
+ int t;
/* ----------------
* execute the postgres query
@@ -208,19 +208,19 @@ pqtest_PQexec(char *q)
t = 0;
switch (res[0])
{
- case 'P':
- a = PQparray(&res[1]);
- if (a == NULL)
- elog(WARN, "pqtest_PQexec: PQparray could not find portal %s",
- res);
-
- t = PQntuples(a);
- break;
- case 'C':
- break;
- default:
- elog(NOTICE, "pqtest_PQexec: PQexec(%s) returns %s", q, res);
- break;
+ case 'P':
+ a = PQparray(&res[1]);
+ if (a == NULL)
+ elog(WARN, "pqtest_PQexec: PQparray could not find portal %s",
+ res);
+
+ t = PQntuples(a);
+ break;
+ case 'C':
+ break;
+ default:
+ elog(NOTICE, "pqtest_PQexec: PQexec(%s) returns %s", q, res);
+ break;
}
return t;
@@ -230,10 +230,10 @@ pqtest_PQexec(char *q)
* utilities for pqtest_PQfn()
* ----------------
*/
-static char *
+static char *
strmake(char *str, int len)
{
- char *newstr;
+ char *newstr;
if (str == NULL)
return NULL;
@@ -249,18 +249,18 @@ strmake(char *str, int len)
#define SKIP 0
#define SCAN 1
-static char spacestr[] = " ";
+static char spacestr[] = " ";
static int
strparse(char *s, char **fields, int *offsets, int maxfields)
{
- int len = strlen(s);
- char *cp = s,
- *end = cp + len,
- *ep;
- int parsed = 0;
- int mode = SKIP,
- i = 0;
+ int len = strlen(s);
+ char *cp = s,
+ *end = cp + len,
+ *ep;
+ int parsed = 0;
+ int mode = SKIP,
+ i = 0;
if (*(end - 1) == '\n')
end--;
@@ -318,16 +318,16 @@ strparse(char *s, char **fields, int *offsets, int maxfields)
int
pqtest_PQfn(char *q)
{
- int k,
- j,
- i,
- v,
- f,
- offsets;
- char *fields[8];
- PQArgBlock pqargs[7];
- int res;
- char *pqres;
+ int k,
+ j,
+ i,
+ v,
+ f,
+ offsets;
+ char *fields[8];
+ PQArgBlock pqargs[7];
+ int res;
+ char *pqres;
/* ----------------
* parse q into fields
@@ -403,7 +403,7 @@ pqtest_PQfn(char *q)
int32
pqtest(struct varlena * vlena)
{
- char *q;
+ char *q;
/* ----------------
* get the query
@@ -415,12 +415,12 @@ pqtest(struct varlena * vlena)
switch (q[0])
{
- case '%':
- return pqtest_PQfn(&q[1]);
- break;
- default:
- return pqtest_PQexec(q);
- break;
+ case '%':
+ return pqtest_PQfn(&q[1]);
+ break;
+ default:
+ return pqtest_PQexec(q);
+ break;
}
return (0);
}
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index 014eca14fa..8e1a0753b2 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.20 1997/09/07 04:42:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.21 1997/09/08 02:23:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,7 @@
/* Some standard C libraries, including GNU, have an isblank() function.
Others, including Solaris, do not. So we have our own.
*/
-static bool
+static bool
isblank(const char c)
{
return (c == ' ' || c == 9 /* tab */ );
@@ -53,8 +53,8 @@ next_token(FILE * fp, char *buf, const int bufsz)
string as *buf and position file to beginning of next line or EOF,
whichever comes first.
--------------------------------------------------------------------------*/
- int c;
- char *eb = buf + (bufsz - 1);
+ int c;
+ char *eb = buf + (bufsz - 1);
/* Move over inital token-delimiting blanks */
while (isblank(c = getc(fp)));
@@ -87,7 +87,7 @@ next_token(FILE * fp, char *buf, const int bufsz)
static void
read_through_eol(FILE * file)
{
- int c;
+ int c;
do
c = getc(file);
@@ -105,9 +105,9 @@ read_hba_entry2(FILE * file, enum Userauth * userauth_p, char usermap_name[],
and return the interpretation of it as *userauth_p, usermap_name, and
*error_p.
---------------------------------------------------------------------------*/
- char buf[MAX_TOKEN];
+ char buf[MAX_TOKEN];
- bool userauth_valid;
+ bool userauth_valid;
/* Get authentication type token. */
next_token(file, buf, sizeof(buf));
@@ -197,7 +197,7 @@ process_hba_record(FILE * file,
return *error_p true, after issuing a message to stderr. If no error,
leave *error_p as it was.
---------------------------------------------------------------------------*/
- char buf[MAX_TOKEN]; /* A token from the record */
+ char buf[MAX_TOKEN]; /* A token from the record */
/* Read the record type field */
next_token(file, buf, sizeof(buf));
@@ -233,14 +233,14 @@ process_hba_record(FILE * file,
*matches_p = false;
else
{
- int valid; /* Field is valid dotted
+ int valid; /* Field is valid dotted
* decimal */
/*
* Remember the IP address field and go get mask
* field
*/
- struct in_addr file_ip_addr; /* IP address field
+ struct in_addr file_ip_addr; /* IP address field
* value */
valid = inet_aton(buf, &file_ip_addr);
@@ -257,7 +257,7 @@ process_hba_record(FILE * file,
*matches_p = false;
else
{
- struct in_addr mask;
+ struct in_addr mask;
/*
* Got mask. Now see if this record is
@@ -320,13 +320,13 @@ process_open_config_file(FILE * file,
This function does the same thing as find_hba_entry, only with
the config file already open on stream descriptor "file".
----------------------------------------------------------------------------*/
- bool found_entry;
+ bool found_entry;
/* We've processed a record that applies to our connection */
- bool error;
+ bool error;
/* Said record has invalid syntax. */
- bool eof; /* We've reached the end of the file we're
+ bool eof; /* We've reached the end of the file we're
* reading */
found_entry = false; /* initial value */
@@ -336,7 +336,7 @@ process_open_config_file(FILE * file,
{
/* Process a line from the config file */
- int c; /* a character read from the file */
+ int c; /* a character read from the file */
c = getc(file);
ungetc(c, file);
@@ -392,11 +392,11 @@ find_hba_entry(const char DataDir[], const struct in_addr ip_addr,
system.
---------------------------------------------------------------------------*/
- int fd;
+ int fd;
- FILE *file; /* The config file we have to read */
+ FILE *file; /* The config file we have to read */
- char *old_conf_file;
+ char *old_conf_file;
/* The name of old config file that better not exist. */
@@ -423,8 +423,8 @@ find_hba_entry(const char DataDir[], const struct in_addr ip_addr,
}
else
{
- char *conf_file; /* The name of the config file we
- * have to read */
+ char *conf_file; /* The name of the config file we have to
+ * read */
/* put together the full pathname to the config file */
conf_file = (char *) malloc((strlen(DataDir) +
@@ -469,7 +469,7 @@ interpret_ident_response(char ident_response[],
*error_p == false and the username as ident_username[]. If it's anything
else, return *error_p == true and ident_username[] undefined.
----------------------------------------------------------------------------*/
- char *cursor; /* Cursor into ident_response[] */
+ char *cursor; /* Cursor into ident_response[] */
cursor = &ident_response[0];
@@ -491,8 +491,8 @@ interpret_ident_response(char ident_response[],
else
{
/* We're positioned to colon before response type field */
- char response_type[80];
- int i; /* Index into response_type[] */
+ char response_type[80];
+ int i; /* Index into response_type[] */
cursor++; /* Go over colon */
while (isblank(*cursor))
@@ -526,8 +526,7 @@ interpret_ident_response(char ident_response[],
*error_p = true;
else
{
- int i; /* Index into
- * ident_username[] */
+ int i; /* Index into ident_username[] */
cursor++; /* Go over colon */
while (isblank(*cursor))
@@ -564,11 +563,11 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
*ident_failed == true (and ident_username[] undefined).
----------------------------------------------------------------------------*/
- int sock_fd;
+ int sock_fd;
/* File descriptor for socket on which we talk to Ident */
- int rc; /* Return code from a locally called
+ int rc; /* Return code from a locally called
* function */
sock_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
@@ -608,7 +607,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
}
else
{
- char ident_query[80];
+ char ident_query[80];
/* The query we send to the Ident server */
sprintf(ident_query, "%d,%d\n",
@@ -628,7 +627,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
}
else
{
- char ident_response[80 + IDENT_USERNAME_MAX];
+ char ident_response[80 + IDENT_USERNAME_MAX];
rc = recv(sock_fd, ident_response, sizeof(ident_response) - 1, 0);
if (rc < 0)
@@ -647,8 +646,7 @@ ident(const struct in_addr remote_ip_addr, const struct in_addr local_ip_addr,
}
else
{
- bool error; /* response from Ident is
- * garbage. */
+ bool error; /* response from Ident is garbage. */
ident_response[rc] = '\0';
interpret_ident_response(ident_response, &error, ident_username);
@@ -674,7 +672,7 @@ parse_map_record(FILE * file,
ones.
---------------------------------------------------------------------------*/
- char buf[MAX_TOKEN];
+ char buf[MAX_TOKEN];
/* A token read from the file */
@@ -714,9 +712,9 @@ verify_against_open_usermap(FILE * file,
This function does the same thing as verify_against_usermap,
only with the config file already open on stream descriptor "file".
---------------------------------------------------------------------------*/
- bool match; /* We found a matching entry in the map
+ bool match; /* We found a matching entry in the map
* file */
- bool eof; /* We've reached the end of the file we're
+ bool eof; /* We've reached the end of the file we're
* reading */
match = false; /* initial value */
@@ -725,7 +723,7 @@ verify_against_open_usermap(FILE * file,
{
/* Process a line from the map file */
- int c; /* a character read from the file */
+ int c; /* a character read from the file */
c = getc(file);
ungetc(c, file);
@@ -738,9 +736,9 @@ verify_against_open_usermap(FILE * file,
else
{
/* The following are fields read from a record of the file */
- char file_map[MAX_TOKEN + 1];
- char file_pguser[MAX_TOKEN + 1];
- char file_iuser[MAX_TOKEN + 1];
+ char file_map[MAX_TOKEN + 1];
+ char file_pguser[MAX_TOKEN + 1];
+ char file_iuser[MAX_TOKEN + 1];
parse_map_record(file, file_map, file_pguser, file_iuser);
if (strcmp(file_map, usermap_name) == 0 &&
@@ -795,10 +793,10 @@ verify_against_usermap(const char DataDir[],
}
else
{
- FILE *file; /* The map file we have to read */
+ FILE *file; /* The map file we have to read */
- char *map_file; /* The name of the map file we
- * have to read */
+ char *map_file; /* The name of the map file we have to
+ * read */
/* put together the full pathname to the map file */
map_file = (char *) malloc((strlen(DataDir) +
@@ -850,10 +848,10 @@ authident(const char DataDir[],
Return *authentic_p true iff yes.
---------------------------------------------------------------------------*/
- bool ident_failed;
+ bool ident_failed;
/* We were unable to get ident to give us a username */
- char ident_username[IDENT_USERNAME_MAX + 1];
+ char ident_username[IDENT_USERNAME_MAX + 1];
/* The username returned by ident */
@@ -865,7 +863,7 @@ authident(const char DataDir[],
*authentic_p = false;
else
{
- bool checks_out;
+ bool checks_out;
verify_against_usermap(DataDir,
postgres_username, ident_username, usermap_name,
@@ -888,25 +886,25 @@ hba_recvauth(const Port * port, const char database[], const char user[],
allowed to act as user "user" and access database "database". Return
STATUS_OK if yes; STATUS_ERROR if not.
----------------------------------------------------------------------------*/
- bool host_ok;
+ bool host_ok;
/*
* There's an entry for this database and remote host in the pg_hba
* file
*/
- char usermap_name[USERMAP_NAME_SIZE + 1];
+ char usermap_name[USERMAP_NAME_SIZE + 1];
/*
* The name of the map pg_hba specifies for this connection (or
* special value "SAMEUSER")
*/
- enum Userauth userauth;
+ enum Userauth userauth;
/*
* The type of user authentication pg_hba specifies for this
* connection
*/
- int retvalue;
+ int retvalue;
/* Our eventual return value */
@@ -922,31 +920,31 @@ hba_recvauth(const Port * port, const char database[], const char user[],
{
switch (userauth)
{
- case Trust:
- retvalue = STATUS_OK;
- break;
- case Ident:
- {
+ case Trust:
+ retvalue = STATUS_OK;
+ break;
+ case Ident:
+ {
- /*
- * Here's where we need to call up ident and authenticate
- * the user
- */
+ /*
+ * Here's where we need to call up ident and
+ * authenticate the user
+ */
- bool authentic; /* He is who he says he
+ bool authentic; /* He is who he says he
* is. */
- authident(DataDir, *port, user, usermap_name, &authentic);
+ authident(DataDir, *port, user, usermap_name, &authentic);
- if (authentic)
- retvalue = STATUS_OK;
- else
- retvalue = STATUS_ERROR;
- }
- break;
- default:
- retvalue = STATUS_ERROR;
- Assert(false);
+ if (authentic)
+ retvalue = STATUS_OK;
+ else
+ retvalue = STATUS_ERROR;
+ }
+ break;
+ default:
+ retvalue = STATUS_ERROR;
+ Assert(false);
}
}
return (retvalue);
diff --git a/src/backend/libpq/password.c b/src/backend/libpq/password.c
index 1efc2e668a..2553878fc5 100644
--- a/src/backend/libpq/password.c
+++ b/src/backend/libpq/password.c
@@ -13,18 +13,18 @@ int
verify_password(char *user, char *password, Port * port,
char *database, char *DataDir)
{
- bool host_ok;
- enum Userauth userauth;
- char pw_file_name[PWFILE_NAME_SIZE + 1];
-
- char *pw_file_fullname;
- FILE *pw_file;
-
- char pw_file_line[255];
- char *p,
- *test_user,
- *test_pw;
- char salt[3];
+ bool host_ok;
+ enum Userauth userauth;
+ char pw_file_name[PWFILE_NAME_SIZE + 1];
+
+ char *pw_file_fullname;
+ FILE *pw_file;
+
+ char pw_file_line[255];
+ char *p,
+ *test_user,
+ *test_pw;
+ char salt[3];
find_hba_entry(DataDir, port->raddr.sin_addr, database,
&host_ok, &userauth, pw_file_name, true);
diff --git a/src/backend/libpq/portal.c b/src/backend/libpq/portal.c
index c3c8fe55e3..2d213a1f24 100644
--- a/src/backend/libpq/portal.c
+++ b/src/backend/libpq/portal.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.7 1997/09/07 04:42:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.8 1997/09/08 02:23:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -111,8 +111,8 @@ valid_pointer(char *msg, void *ptr)
int
PQnportals(int rule_p)
{
- int i,
- n = 0;
+ int i,
+ n = 0;
for (i = 0; i < portals_array_size; ++i)
{
@@ -142,8 +142,8 @@ PQnportals(int rule_p)
void
PQpnames(char **pnames, int rule_p)
{
- int i,
- cur_pname = 0;
+ int i,
+ cur_pname = 0;
if (!valid_pointer("PQpnames: invalid name buffer", pnames))
return;
@@ -165,10 +165,10 @@ PQpnames(char **pnames, int rule_p)
* PQparray - Return the portal buffer given a portal name
* --------------------------------
*/
-PortalBuffer *
+PortalBuffer *
PQparray(char *pname)
{
- int i;
+ int i;
if (!valid_pointer("PQparray: invalid name buffer", pname))
return NULL;
@@ -230,7 +230,7 @@ PQngroups(PortalBuffer * portal)
int
PQntuplesGroup(PortalBuffer * portal, int group_index)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQntuplesGroup: invalid portal pointer", portal) ||
!in_range("PQntuplesGroup: group index",
@@ -256,7 +256,7 @@ PQninstancesGroup(PortalBuffer * portal, int group_index)
int
PQnfieldsGroup(PortalBuffer * portal, int group_index)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQnfieldsGroup: invalid portal pointer", portal) ||
!in_range("PQnfieldsGroup: group index",
@@ -276,7 +276,7 @@ PQnfieldsGroup(PortalBuffer * portal, int group_index)
int
PQfnumberGroup(PortalBuffer * portal, int group_index, char *field_name)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQfnumberGroup: invalid portal pointer", portal) ||
!valid_pointer("PQfnumberGroup: invalid field name pointer",
@@ -295,10 +295,10 @@ PQfnumberGroup(PortalBuffer * portal, int group_index, char *field_name)
* the group index and field index.
* --------------------------------
*/
-char *
+char *
PQfnameGroup(PortalBuffer * portal, int group_index, int field_number)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQfnameGroup: invalid portal pointer", portal) ||
!in_range("PQfnameGroup: group index",
@@ -320,7 +320,7 @@ PQfnameGroup(PortalBuffer * portal, int group_index, int field_number)
int
PQftypeGroup(PortalBuffer * portal, int group_index, int field_number)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQftypeGroup: invalid portal pointer", portal) ||
!in_range("PQftypeGroup: group index",
@@ -341,7 +341,7 @@ PQftypeGroup(PortalBuffer * portal, int group_index, int field_number)
int
PQfsizeGroup(PortalBuffer * portal, int group_index, int field_number)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQfsizeGroup: invalid portal pointer", portal) ||
!in_range("PQfsizeGroup: tuple index",
@@ -359,11 +359,11 @@ PQfsizeGroup(PortalBuffer * portal, int group_index, int field_number)
* PQgroup - Return the tuple group that a particular tuple is in
* --------------------------------
*/
-GroupBuffer *
+GroupBuffer *
PQgroup(PortalBuffer * portal, int tuple_index)
{
- GroupBuffer *gbp;
- int tuple_count = 0;
+ GroupBuffer *gbp;
+ int tuple_count = 0;
if (!valid_pointer("PQgroup: invalid portal pointer", portal) ||
!in_range("PQgroup: tuple index",
@@ -388,9 +388,9 @@ PQgroup(PortalBuffer * portal, int tuple_index)
int
PQgetgroup(PortalBuffer * portal, int tuple_index)
{
- GroupBuffer *gbp;
- int tuple_count = 0,
- group_count = 0;
+ GroupBuffer *gbp;
+ int tuple_count = 0,
+ group_count = 0;
if (!valid_pointer("PQgetgroup: invalid portal pointer", portal) ||
!in_range("PQgetgroup: tuple index",
@@ -414,7 +414,7 @@ PQgetgroup(PortalBuffer * portal, int tuple_index)
int
PQnfields(PortalBuffer * portal, int tuple_index)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQnfields: invalid portal pointer", portal) ||
!in_range("PQnfields: tuple index",
@@ -434,7 +434,7 @@ PQnfields(PortalBuffer * portal, int tuple_index)
int
PQfnumber(PortalBuffer * portal, int tuple_index, char *field_name)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQfnumber: invalid portal pointer", portal) ||
!valid_pointer("PQfnumber: invalid field name pointer", field_name) ||
@@ -451,10 +451,10 @@ PQfnumber(PortalBuffer * portal, int tuple_index, char *field_name)
* PQfname - Return the name of a field
* --------------------------------
*/
-char *
+char *
PQfname(PortalBuffer * portal, int tuple_index, int field_number)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQfname: invalid portal pointer", portal) ||
!in_range("PQfname: tuple index",
@@ -475,7 +475,7 @@ PQfname(PortalBuffer * portal, int tuple_index, int field_number)
int
PQftype(PortalBuffer * portal, int tuple_index, int field_number)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQftype: invalid portal pointer", portal) ||
!in_range("PQfname: tuple index",
@@ -495,7 +495,7 @@ PQftype(PortalBuffer * portal, int tuple_index, int field_number)
int
PQfsize(PortalBuffer * portal, int tuple_index, int field_number)
{
- GroupBuffer *gbp;
+ GroupBuffer *gbp;
if (!valid_pointer("PQfsize: invalid portal pointer", portal) ||
!in_range("PQfsize: tuple index",
@@ -518,8 +518,8 @@ PQfsize(PortalBuffer * portal, int tuple_index, int field_number)
int
PQsametype(PortalBuffer * portal, int tuple_index1, int tuple_index2)
{
- GroupBuffer *gbp1,
- *gbp2;
+ GroupBuffer *gbp1,
+ *gbp2;
if (!valid_pointer("PQsametype: invalid portal pointer", portal) ||
!in_range("PQsametype: tuple index 1",
@@ -540,9 +540,9 @@ PQGetTupleBlock(PortalBuffer * portal,
int tuple_index,
int *tuple_offset)
{
- GroupBuffer *gbp;
- TupleBlock *tbp;
- int tuple_count = 0;
+ GroupBuffer *gbp;
+ TupleBlock *tbp;
+ int tuple_count = 0;
if (!valid_pointer("PQGetTupleBlock: invalid portal pointer", portal) ||
!valid_pointer("PQGetTupleBlock: invalid offset pointer",
@@ -578,13 +578,13 @@ PQGetTupleBlock(PortalBuffer * portal,
* PQgetvalue - Return an attribute (field) value
* --------------------------------
*/
-char *
+char *
PQgetvalue(PortalBuffer * portal,
int tuple_index,
int field_number)
{
- TupleBlock *tbp;
- int tuple_offset;
+ TupleBlock *tbp;
+ int tuple_offset;
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp)
@@ -598,15 +598,15 @@ PQgetvalue(PortalBuffer * portal,
* a copy. The CALLER is responsible for free'ing the data returned.
* --------------------------------
*/
-char *
+char *
PQgetAttr(PortalBuffer * portal,
int tuple_index,
int field_number)
{
- TupleBlock *tbp;
- int tuple_offset;
- int len;
- char *result = NULL;
+ TupleBlock *tbp;
+ int tuple_offset;
+ int len;
+ char *result = NULL;
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp)
@@ -631,8 +631,8 @@ PQgetlength(PortalBuffer * portal,
int tuple_index,
int field_number)
{
- TupleBlock *tbp;
- int tuple_offset;
+ TupleBlock *tbp;
+ int tuple_offset;
tbp = PQGetTupleBlock(portal, tuple_index, &tuple_offset);
if (tbp)
@@ -657,15 +657,15 @@ PQclear(char *pname)
* This is going away with pending rewrite of comm. code...
*/
/* static SLList pqNotifyList;*/
-static Dllist *pqNotifyList = NULL;
+static Dllist *pqNotifyList = NULL;
/* remove invalid notifies before returning */
void
PQcleanNotify()
{
- Dlelem *e,
- *next;
- PQNotifyList *p;
+ Dlelem *e,
+ *next;
+ PQNotifyList *p;
e = DLGetHead(pqNotifyList);
@@ -686,8 +686,8 @@ PQcleanNotify()
void
PQnotifies_init()
{
- Dlelem *e;
- PQNotifyList *p;
+ Dlelem *e;
+ PQNotifyList *p;
if (pqNotifyList == NULL)
{
@@ -705,10 +705,10 @@ PQnotifies_init()
}
}
-PQNotifyList *
+PQNotifyList *
PQnotifies()
{
- Dlelem *e;
+ Dlelem *e;
PQcleanNotify();
e = DLGetHead(pqNotifyList);
@@ -724,7 +724,7 @@ PQremoveNotify(PQNotifyList * nPtr)
void
PQappendNotify(char *relname, int pid)
{
- PQNotifyList *p;
+ PQNotifyList *p;
if (pqNotifyList == NULL)
pqNotifyList = DLNewList();
diff --git a/src/backend/libpq/portalbuf.c b/src/backend/libpq/portalbuf.c
index ed2d5bbe61..71db1d1e76 100644
--- a/src/backend/libpq/portalbuf.c
+++ b/src/backend/libpq/portalbuf.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.5 1997/09/07 04:42:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.6 1997/09/08 02:23:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,8 +55,8 @@
#include <libpq/libpq.h> /* where the declarations go */
#include <utils/exc.h>
-PortalEntry **portals = (PortalEntry **) NULL;
-size_t portals_array_size = 0;
+PortalEntry **portals = (PortalEntry **) NULL;
+size_t portals_array_size = 0;
/* portals array memory is malloc'd instead of using MemoryContexts */
/* since it will be used by both front and backend programs*/
@@ -72,9 +72,9 @@ size_t portals_array_size = 0;
static void
portals_realloc(size_t size)
{
- size_t oldsize;
- int i;
- PortalEntry **newp;
+ size_t oldsize;
+ int i;
+ PortalEntry **newp;
oldsize = portals_array_size;
@@ -106,7 +106,7 @@ portals_realloc(size_t size)
caddr_t
pbuf_alloc(size_t size)
{
- caddr_t addr;
+ caddr_t addr;
if (size <= 0)
libpq_raise(&MemoryError, form("Invalid argument to pbuf_alloc()."));
@@ -139,10 +139,10 @@ pbuf_free(caddr_t pointer)
* pbuf_addPortal - Allocate a new portal buffer
* --------------------------------
*/
-PortalBuffer *
+PortalBuffer *
pbuf_addPortal()
{
- PortalBuffer *portal;
+ PortalBuffer *portal;
portal = (PortalBuffer *)
pbuf_alloc(sizeof(PortalBuffer));
@@ -159,11 +159,11 @@ pbuf_addPortal()
* pbuf_addGroup - Add a new tuple group to the portal
* --------------------------------
*/
-GroupBuffer *
+GroupBuffer *
pbuf_addGroup(PortalBuffer * portal)
{
- GroupBuffer *group,
- *group1;
+ GroupBuffer *group,
+ *group1;
group = (GroupBuffer *)
pbuf_alloc(sizeof(GroupBuffer));
@@ -191,10 +191,10 @@ pbuf_addGroup(PortalBuffer * portal)
* pbuf_addTypes - Allocate n type blocks
* --------------------------------
*/
-TypeBlock *
+TypeBlock *
pbuf_addTypes(int n)
{
- TypeBlock *types;
+ TypeBlock *types;
types = (TypeBlock *)
pbuf_alloc(n * sizeof(TypeBlock));
@@ -206,10 +206,10 @@ pbuf_addTypes(int n)
* pbuf_addTuples - Allocate a tuple block
* --------------------------------
*/
-TupleBlock *
+TupleBlock *
pbuf_addTuples()
{
- TupleBlock *tuples;
+ TupleBlock *tuples;
tuples = (TupleBlock *)
pbuf_alloc(sizeof(TupleBlock));
@@ -224,7 +224,7 @@ pbuf_addTuples()
* pbuf_addTuple - Allocate a tuple of n fields (attributes)
* --------------------------------
*/
-char **
+char **
pbuf_addTuple(int n)
{
return (char **)
@@ -235,7 +235,7 @@ pbuf_addTuple(int n)
* pbuf_addTupleValueLengths - Allocate a tuple of n lengths (attributes)
* --------------------------------
*/
-int *
+int *
pbuf_addTupleValueLengths(int n)
{
return (int *)
@@ -246,7 +246,7 @@ pbuf_addTupleValueLengths(int n)
* pbuf_addValues - Allocate n bytes for a value
* --------------------------------
*/
-char *
+char *
pbuf_addValues(int n)
{
return
@@ -257,7 +257,7 @@ pbuf_addValues(int n)
* pbuf_addEntry - Allocate a portal entry
* --------------------------------
*/
-PortalEntry *
+PortalEntry *
pbuf_addEntry()
{
return (PortalEntry *)
@@ -299,8 +299,8 @@ pbuf_freeTuples(TupleBlock * tuples,
int no_tuples,
int no_fields)
{
- int i,
- j;
+ int i,
+ j;
if (no_tuples > TupleBlockSize)
{
@@ -363,7 +363,7 @@ pbuf_freePortal(PortalBuffer * portal)
int
pbuf_getIndex(char *pname)
{
- int i;
+ int i;
if (portals)
{
@@ -391,10 +391,10 @@ pbuf_setportalinfo(PortalEntry * entry, char *pname)
* pbuf_setup - Set up a portal for dumping data
* --------------------------------
*/
-PortalEntry *
+PortalEntry *
pbuf_setup(char *pname)
{
- int i;
+ int i;
if (!portals) /* the portals array has not been
* allocated yet */
@@ -435,7 +435,7 @@ pbuf_setup(char *pname)
void
pbuf_close(char *pname)
{
- int i;
+ int i;
if ((i = pbuf_getIndex(pname)) == -1)
libpq_raise(&PortalError, form("Portal %s does not exist.", pname));
@@ -448,11 +448,11 @@ pbuf_close(char *pname)
* pbuf_findGroup - Return the group given the group_index
* --------------------------------
*/
-GroupBuffer *
+GroupBuffer *
pbuf_findGroup(PortalBuffer * portal,
int group_index)
{
- GroupBuffer *group;
+ GroupBuffer *group;
group = portal->groups;
while (group_index > 0 && group != NULL)
@@ -476,8 +476,8 @@ int
pbuf_findFnumber(GroupBuffer * group,
char *field_name)
{
- TypeBlock *types;
- int i;
+ TypeBlock *types;
+ int i;
types = group->types;
@@ -510,7 +510,7 @@ pbuf_checkFnumber(GroupBuffer * group,
* pbuf_findFname - Find the field name given the field index
* --------------------------------
*/
-char *
+char *
pbuf_findFname(GroupBuffer * group,
int field_number)
{
diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c
index 6a7df5771a..93e8fa81af 100644
--- a/src/backend/libpq/pqcomm.c
+++ b/src/backend/libpq/pqcomm.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.20 1997/09/07 04:42:25 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.21 1997/09/08 02:23:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,10 +63,10 @@
* declarations
* ----------------
*/
-FILE *Pfout,
- *Pfin;
-FILE *Pfdebug; /* debugging libpq */
-int PQAsyncNotifyWaiting; /* for async. notification */
+FILE *Pfout,
+ *Pfin;
+FILE *Pfdebug; /* debugging libpq */
+int PQAsyncNotifyWaiting; /* for async. notification */
/* --------------------------------
* pq_init - open portal file descriptors
@@ -102,7 +102,7 @@ pq_init(int fd)
static int
pq_getc(FILE * fin)
{
- int c;
+ int c;
c = getc(fin);
if (Pfdebug && c != EOF)
@@ -127,7 +127,7 @@ pq_gettty(char *tp)
int
pq_getport()
{
- char *envport = getenv("PGPORT");
+ char *envport = getenv("PGPORT");
if (envport)
return (atoi(envport));
@@ -174,7 +174,7 @@ pq_flush()
int
pq_getstr(char *s, int maxlen)
{
- int c = '\0';
+ int c = '\0';
if (Pfin == (FILE *) NULL)
{
@@ -268,7 +268,7 @@ pq_getnchar(char *s, int off, int maxlen)
return pqGetNBytes(s + off, maxlen, Pfin);
#if 0
- int c = '\0';
+ int c = '\0';
if (Pfin == (FILE *) NULL)
{
@@ -300,8 +300,8 @@ pq_getnchar(char *s, int off, int maxlen)
int
pq_getint(int b)
{
- int n,
- status = 1;
+ int n,
+ status = 1;
if (!Pfin)
return EOF;
@@ -313,17 +313,17 @@ pq_getint(int b)
switch (b)
{
- case 1:
- status = ((n = fgetc(Pfin)) == EOF);
- break;
- case 2:
- status = pqGetShort(&n, Pfin);
- break;
- case 4:
- status = pqGetLong(&n, Pfin);
- break;
- default:
- fprintf(stderr, "** Unsupported size %d\n", b);
+ case 1:
+ status = ((n = fgetc(Pfin)) == EOF);
+ break;
+ case 2:
+ status = pqGetShort(&n, Pfin);
+ break;
+ case 4:
+ status = pqGetLong(&n, Pfin);
+ break;
+ default:
+ fprintf(stderr, "** Unsupported size %d\n", b);
}
if (status)
@@ -381,7 +381,7 @@ pq_putnchar(char *s, int n)
void
pq_putint(int i, int b)
{
- int status;
+ int status;
if (!Pfout)
return;
@@ -389,17 +389,17 @@ pq_putint(int i, int b)
status = 1;
switch (b)
{
- case 1:
- status = (fputc(i, Pfout) == EOF);
- break;
- case 2:
- status = pqPutShort(i, Pfout);
- break;
- case 4:
- status = pqPutLong(i, Pfout);
- break;
- default:
- fprintf(stderr, "** Unsupported size %d\n", b);
+ case 1:
+ status = (fputc(i, Pfout) == EOF);
+ break;
+ case 2:
+ status = pqPutShort(i, Pfout);
+ break;
+ case 4:
+ status = pqPutLong(i, Pfout);
+ break;
+ default:
+ fprintf(stderr, "** Unsupported size %d\n", b);
}
if (status)
@@ -421,7 +421,7 @@ pq_putint(int i, int b)
int
pq_sendoob(char *msg, int len)
{
- int fd = fileno(Pfout);
+ int fd = fileno(Pfout);
return (send(fd, msg, len, MSG_OOB));
}
@@ -429,8 +429,8 @@ pq_sendoob(char *msg, int len)
int
pq_recvoob(char *msgPtr, int *lenPtr)
{
- int fd = fileno(Pfout);
- int len = 0;
+ int fd = fileno(Pfout);
+ int len = 0;
len = recv(fd, msgPtr + len, *lenPtr, MSG_OOB);
*lenPtr = len;
@@ -510,7 +510,7 @@ pq_getinserv(struct sockaddr_in * sin, char *host, char *serv)
void
pq_regoob(void (*fptr) ())
{
- int fd = fileno(Pfout);
+ int fd = fileno(Pfout);
#if defined(hpux)
ioctl(fd, FIOSSAIOOWN, getpid());
@@ -532,10 +532,10 @@ pq_unregoob()
void
pq_async_notify()
{
- char msg[20];
+ char msg[20];
/* int len = sizeof(msg); */
- int len = 20;
+ int len = 20;
if (pq_recvoob(msg, &len) >= 0)
{
@@ -546,7 +546,7 @@ pq_async_notify()
}
else
{
- extern int errno;
+ extern int errno;
printf("SIGURG but no data: len = %d, err=%d\n", len, errno);
}
@@ -575,8 +575,8 @@ int
StreamServerPort(char *hostName, short portName, int *fdP)
{
struct sockaddr_in sin;
- int fd;
- int one = 1;
+ int fd;
+ int one = 1;
if (!hostName)
@@ -645,7 +645,7 @@ StreamServerPort(char *hostName, short portName, int *fdP)
int
StreamConnection(int server_fd, Port * port)
{
- int addrlen;
+ int addrlen;
/* accept connection (and fill in the client (remote) address) */
addrlen = sizeof(struct sockaddr_in);
@@ -667,7 +667,7 @@ StreamConnection(int server_fd, Port * port)
}
{
struct protoent *pe;
- int on = 1;
+ int on = 1;
pe = getprotobyname("TCP");
if (pe == NULL)
@@ -715,8 +715,8 @@ int
StreamOpen(char *hostName, short portName, Port * port)
{
struct hostent *hp;
- int laddrlen = sizeof(struct sockaddr_in);
- extern int errno;
+ int laddrlen = sizeof(struct sockaddr_in);
+ extern int errno;
if (!hostName)
hostName = "localhost";
@@ -774,7 +774,7 @@ StreamOpen(char *hostName, short portName, Port * port)
return (STATUS_OK);
}
-static char *authentication_type_name[] = {
+static char *authentication_type_name[] = {
0, 0, 0, 0, 0, 0, 0,
"the default authentication type",
0, 0,
@@ -785,10 +785,10 @@ static char *authentication_type_name[] = {
"plaintext password authentication"
};
-char *
+char *
name_of_authentication_type(int type)
{
- char *result = 0;
+ char *result = 0;
if (type >= 1 && type <= LAST_AUTHENTICATION_TYPE)
{
diff --git a/src/backend/libpq/pqcomprim.c b/src/backend/libpq/pqcomprim.c
index 8675205d78..d6bdf6f13b 100644
--- a/src/backend/libpq/pqcomprim.c
+++ b/src/backend/libpq/pqcomprim.c
@@ -48,9 +48,9 @@
int
pqPutShort(int integer, FILE * f)
{
- int retval = 0;
- u_short n,
- s;
+ int retval = 0;
+ u_short n,
+ s;
s = integer;
n = hton_s(s);
@@ -64,8 +64,8 @@ pqPutShort(int integer, FILE * f)
int
pqPutLong(int integer, FILE * f)
{
- int retval = 0;
- u_long n;
+ int retval = 0;
+ u_long n;
n = hton_l(integer);
if (fwrite(&n, sizeof(u_long), 1, f) != 1)
@@ -78,8 +78,8 @@ pqPutLong(int integer, FILE * f)
int
pqGetShort(int *result, FILE * f)
{
- int retval = 0;
- u_short n;
+ int retval = 0;
+ u_short n;
if (fread(&n, sizeof(u_short), 1, f) != 1)
retval = EOF;
@@ -92,8 +92,8 @@ pqGetShort(int *result, FILE * f)
int
pqGetLong(int *result, FILE * f)
{
- int retval = 0;
- u_long n;
+ int retval = 0;
+ u_long n;
if (fread(&n, sizeof(u_long), 1, f) != 1)
retval = EOF;
@@ -109,7 +109,7 @@ pqGetLong(int *result, FILE * f)
int
pqGetNBytes(char *s, size_t len, FILE * f)
{
- int cnt;
+ int cnt;
if (f == NULL)
return EOF;
@@ -138,7 +138,7 @@ pqPutNBytes(const char *s, size_t len, FILE * f)
int
pqGetString(char *s, size_t len, FILE * f)
{
- int c;
+ int c;
if (f == NULL)
return EOF;
diff --git a/src/backend/libpq/pqpacket.c b/src/backend/libpq/pqpacket.c
index 9f56556537..fb1f2fbb48 100644
--- a/src/backend/libpq/pqpacket.c
+++ b/src/backend/libpq/pqpacket.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.6 1997/09/07 04:42:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.7 1997/09/08 02:23:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,14 +61,14 @@ PacketReceive(Port * port, /* receive port */
PacketBuf * buf, /* MAX_PACKET_SIZE-worth of buffer space */
bool nonBlocking) /* NON_BLOCKING or BLOCKING i/o */
{
- PacketLen max_size = sizeof(PacketBuf);
- PacketLen cc; /* character count -- bytes recvd */
- PacketLen packetLen; /* remaining packet chars to read */
- Addr tmp; /* curr recv buf pointer */
- int addrLen = sizeof(struct sockaddr_in);
- int hdrLen;
- int flag;
- int decr;
+ PacketLen max_size = sizeof(PacketBuf);
+ PacketLen cc; /* character count -- bytes recvd */
+ PacketLen packetLen; /* remaining packet chars to read */
+ Addr tmp; /* curr recv buf pointer */
+ int addrLen = sizeof(struct sockaddr_in);
+ int hdrLen;
+ int flag;
+ int decr;
hdrLen = sizeof(buf->len);
@@ -224,8 +224,8 @@ PacketSend(Port * port,
PacketLen len,
bool nonBlocking)
{
- PacketLen totalLen;
- int addrLen = sizeof(struct sockaddr_in);
+ PacketLen totalLen;
+ int addrLen = sizeof(struct sockaddr_in);
Assert(!nonBlocking);
Assert(buf);
diff --git a/src/backend/libpq/pqsignal.c b/src/backend/libpq/pqsignal.c
index 727a2a7207..32abbe0a8e 100644
--- a/src/backend/libpq/pqsignal.c
+++ b/src/backend/libpq/pqsignal.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.6 1997/09/07 04:42:29 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/pqsignal.c,v 1.7 1997/09/08 02:23:19 momjian Exp $
*
* NOTES
* This shouldn't be in libpq, but the monitor and some other
@@ -50,7 +50,7 @@ pqsignal(int signo, pqsigfunc func)
return signal(signo, func);
#else
struct sigaction act,
- oact;
+ oact;
act.sa_handler = func;
sigemptyset(&act.sa_mask);
diff --git a/src/backend/libpq/util.c b/src/backend/libpq/util.c
index f4efec13f3..4d573d89d3 100644
--- a/src/backend/libpq/util.c
+++ b/src/backend/libpq/util.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/util.c,v 1.4 1997/09/07 04:42:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/util.c,v 1.5 1997/09/08 02:23:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,14 +32,14 @@
* exceptions
* ----------------
*/
-Exception MemoryError = {"Memory Allocation Error"};
-Exception PortalError = {"Invalid arguments to portal functions"};
-Exception PostquelError = {"Sql Error"};
-Exception ProtocolError = {"Protocol Error"};
-char PQerrormsg[ERROR_MSG_LENGTH];
+Exception MemoryError = {"Memory Allocation Error"};
+Exception PortalError = {"Invalid arguments to portal functions"};
+Exception PostquelError = {"Sql Error"};
+Exception ProtocolError = {"Protocol Error"};
+char PQerrormsg[ERROR_MSG_LENGTH];
-int PQtracep = 0; /* 1 to print out debugging messages */
-FILE *debug_port = (FILE *) NULL;
+int PQtracep = 0; /* 1 to print out debugging messages */
+FILE *debug_port = (FILE *) NULL;
/* ----------------------------------------------------------------
* PQ utility routines
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index b70be2a08c..2670f2c6ee 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.8 1997/09/07 04:42:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/main/main.c,v 1.9 1997/09/08 02:23:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,7 +34,7 @@ echo \"postmaster -B 256 >/var/log/pglog 2>&1 &\" | su - postgres\n\n"
int
main(int argc, char *argv[])
{
- int len;
+ int len;
#ifdef USE_LOCALE
setlocale(LC_CTYPE, ""); /* take locale information from an
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index caf9e176ef..d710ab711c 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.7 1997/09/07 04:42:39 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.8 1997/09/08 02:23:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,12 +36,12 @@
* this copy function only copies the "lcons-cells" of the list but not
* its contents. (good for list of pointers as well as list of integers).
*/
-List *
+List *
listCopy(List * list)
{
- List *newlist = NIL;
- List *l,
- *nl = NIL;
+ List *newlist = NIL;
+ List *l,
+ *nl = NIL;
foreach(l, list)
{
@@ -94,10 +94,10 @@ CopyPlanFields(Plan * from, Plan * newnode)
* _copyPlan
* ----------------
*/
-static Plan *
+static Plan *
_copyPlan(Plan * from)
{
- Plan *newnode = makeNode(Plan);
+ Plan *newnode = makeNode(Plan);
/* ----------------
* copy the node superclass fields
@@ -116,7 +116,7 @@ _copyPlan(Plan * from)
static Existential *
_copyExistential(Existential * from)
{
- Existential *newnode = makeNode(Existential);
+ Existential *newnode = makeNode(Existential);
/* ----------------
* copy node superclass fields
@@ -131,10 +131,10 @@ _copyExistential(Existential * from)
* _copyResult
* ----------------
*/
-static Result *
+static Result *
_copyResult(Result * from)
{
- Result *newnode = makeNode(Result);
+ Result *newnode = makeNode(Result);
/* ----------------
* copy node superclass fields
@@ -156,10 +156,10 @@ _copyResult(Result * from)
* _copyAppend
* ----------------
*/
-static Append *
+static Append *
_copyAppend(Append * from)
{
- Append *newnode = makeNode(Append);
+ Append *newnode = makeNode(Append);
/* ----------------
* copy node superclass fields
@@ -199,10 +199,10 @@ CopyScanFields(Scan * from, Scan * newnode)
* _copyScan
* ----------------
*/
-static Scan *
+static Scan *
_copyScan(Scan * from)
{
- Scan *newnode = makeNode(Scan);
+ Scan *newnode = makeNode(Scan);
/* ----------------
* copy node superclass fields
@@ -221,7 +221,7 @@ _copyScan(Scan * from)
static SeqScan *
_copySeqScan(SeqScan * from)
{
- SeqScan *newnode = makeNode(SeqScan);
+ SeqScan *newnode = makeNode(SeqScan);
/* ----------------
* copy node superclass fields
@@ -240,7 +240,7 @@ _copySeqScan(SeqScan * from)
static IndexScan *
_copyIndexScan(IndexScan * from)
{
- IndexScan *newnode = makeNode(IndexScan);
+ IndexScan *newnode = makeNode(IndexScan);
/* ----------------
* copy node superclass fields
@@ -279,10 +279,10 @@ CopyJoinFields(Join * from, Join * newnode)
* _copyJoin
* ----------------
*/
-static Join *
+static Join *
_copyJoin(Join * from)
{
- Join *newnode = makeNode(Join);
+ Join *newnode = makeNode(Join);
/* ----------------
* copy node superclass fields
@@ -302,7 +302,7 @@ _copyJoin(Join * from)
static NestLoop *
_copyNestLoop(NestLoop * from)
{
- NestLoop *newnode = makeNode(NestLoop);
+ NestLoop *newnode = makeNode(NestLoop);
/* ----------------
* copy node superclass fields
@@ -328,8 +328,8 @@ _copyNestLoop(NestLoop * from)
static MergeJoin *
_copyMergeJoin(MergeJoin * from)
{
- MergeJoin *newnode = makeNode(MergeJoin);
- List *newlist;
+ MergeJoin *newnode = makeNode(MergeJoin);
+ List *newlist;
/* ----------------
* copy node superclass fields
@@ -367,7 +367,7 @@ _copyMergeJoin(MergeJoin * from)
static HashJoin *
_copyHashJoin(HashJoin * from)
{
- HashJoin *newnode = makeNode(HashJoin);
+ HashJoin *newnode = makeNode(HashJoin);
/* ----------------
* copy node superclass fields
@@ -415,10 +415,10 @@ CopyTempFields(Temp * from, Temp * newnode)
* _copyTemp
* ----------------
*/
-static Temp *
+static Temp *
_copyTemp(Temp * from)
{
- Temp *newnode = makeNode(Temp);
+ Temp *newnode = makeNode(Temp);
/* ----------------
* copy node superclass fields
@@ -437,7 +437,7 @@ _copyTemp(Temp * from)
static Material *
_copyMaterial(Material * from)
{
- Material *newnode = makeNode(Material);
+ Material *newnode = makeNode(Material);
/* ----------------
* copy node superclass fields
@@ -460,10 +460,10 @@ _copyMaterial(Material * from)
* _copySort
* ----------------
*/
-static Sort *
+static Sort *
_copySort(Sort * from)
{
- Sort *newnode = makeNode(Sort);
+ Sort *newnode = makeNode(Sort);
/* ----------------
* copy node superclass fields
@@ -485,11 +485,11 @@ _copySort(Sort * from)
* _copyAgg
* --------------
*/
-static Agg *
+static Agg *
_copyAgg(Agg * from)
{
- Agg *newnode = makeNode(Agg);
- int i;
+ Agg *newnode = makeNode(Agg);
+ int i;
CopyPlanFields((Plan *) from, (Plan *) newnode);
CopyTempFields((Temp *) from, (Temp *) newnode);
@@ -511,10 +511,10 @@ _copyAgg(Agg * from)
* _copyUnique
* ----------------
*/
-static Unique *
+static Unique *
_copyUnique(Unique * from)
{
- Unique *newnode = makeNode(Unique);
+ Unique *newnode = makeNode(Unique);
/* ----------------
* copy node superclass fields
@@ -537,10 +537,10 @@ _copyUnique(Unique * from)
* _copyHash
* ----------------
*/
-static Hash *
+static Hash *
_copyHash(Hash * from)
{
- Hash *newnode = makeNode(Hash);
+ Hash *newnode = makeNode(Hash);
/* ----------------
* copy node superclass fields
@@ -571,10 +571,10 @@ _copyHash(Hash * from)
* _copyResdom
* ----------------
*/
-static Resdom *
+static Resdom *
_copyResdom(Resdom * from)
{
- Resdom *newnode = makeNode(Resdom);
+ Resdom *newnode = makeNode(Resdom);
newnode->resno = from->resno;
newnode->restype = from->restype;
@@ -595,10 +595,10 @@ _copyResdom(Resdom * from)
return newnode;
}
-static Fjoin *
+static Fjoin *
_copyFjoin(Fjoin * from)
{
- Fjoin *newnode = makeNode(Fjoin);
+ Fjoin *newnode = makeNode(Fjoin);
/* ----------------
* copy node superclass fields
@@ -632,10 +632,10 @@ _copyFjoin(Fjoin * from)
* _copyExpr
* ----------------
*/
-static Expr *
+static Expr *
_copyExpr(Expr * from)
{
- Expr *newnode = makeNode(Expr);
+ Expr *newnode = makeNode(Expr);
/* ----------------
* copy node superclass fields
@@ -654,10 +654,10 @@ _copyExpr(Expr * from)
* _copyVar
* ----------------
*/
-static Var *
+static Var *
_copyVar(Var * from)
{
- Var *newnode = makeNode(Var);
+ Var *newnode = makeNode(Var);
/* ----------------
* copy remainder of node
@@ -677,10 +677,10 @@ _copyVar(Var * from)
* _copyOper
* ----------------
*/
-static Oper *
+static Oper *
_copyOper(Oper * from)
{
- Oper *newnode = makeNode(Oper);
+ Oper *newnode = makeNode(Oper);
/* ----------------
* copy remainder of node
@@ -705,13 +705,13 @@ _copyOper(Oper * from)
* _copyConst
* ----------------
*/
-static Const *
+static Const *
_copyConst(Const * from)
{
- static Oid cached_type;
- static bool cached_typbyval;
+ static Oid cached_type;
+ static bool cached_typbyval;
- Const *newnode = makeNode(Const);
+ Const *newnode = makeNode(Const);
/* ----------------
* copy remainder of node
@@ -727,8 +727,8 @@ _copyConst(Const * from)
*/
if (cached_type != from->consttype)
{
- HeapTuple typeTuple;
- TypeTupleForm typeStruct;
+ HeapTuple typeTuple;
+ TypeTupleForm typeStruct;
/* ----------------
* get the type tuple corresponding to the paramList->type,
@@ -793,7 +793,7 @@ _copyConst(Const * from)
* in the first int pointed to by the constval.
* ----------------
*/
- int length;
+ int length;
length = *((int *) from->constvalue);
newnode->constvalue = PointerGetDatum(palloc(length));
@@ -816,10 +816,10 @@ _copyConst(Const * from)
* _copyParam
* ----------------
*/
-static Param *
+static Param *
_copyParam(Param * from)
{
- Param *newnode = makeNode(Param);
+ Param *newnode = makeNode(Param);
/* ----------------
* copy remainder of node
@@ -845,10 +845,10 @@ _copyParam(Param * from)
* _copyFunc
* ----------------
*/
-static Func *
+static Func *
_copyFunc(Func * from)
{
- Func *newnode = makeNode(Func);
+ Func *newnode = makeNode(Func);
/* ----------------
* copy remainder of node
@@ -869,10 +869,10 @@ _copyFunc(Func * from)
* _copyAggreg
* ----------------
*/
-static Aggreg *
+static Aggreg *
_copyAggreg(Aggreg * from)
{
- Aggreg *newnode = makeNode(Aggreg);
+ Aggreg *newnode = makeNode(Aggreg);
/* ----------------
* copy remainder of node
@@ -889,10 +889,10 @@ _copyAggreg(Aggreg * from)
return newnode;
}
-static Array *
+static Array *
_copyArray(Array * from)
{
- Array *newnode = makeNode(Array);
+ Array *newnode = makeNode(Array);
/* ----------------
* copy remainder of node
@@ -912,7 +912,7 @@ _copyArray(Array * from)
static ArrayRef *
_copyArrayRef(ArrayRef * from)
{
- ArrayRef *newnode = makeNode(ArrayRef);
+ ArrayRef *newnode = makeNode(ArrayRef);
/* ----------------
* copy remainder of node
@@ -945,12 +945,12 @@ _copyArrayRef(ArrayRef * from)
** planner/path/xfunc.c accordingly!!!
** -- JMH, 8/2/93
*/
-static Rel *
+static Rel *
_copyRel(Rel * from)
{
- Rel *newnode = makeNode(Rel);
- int i,
- len;
+ Rel *newnode = makeNode(Rel);
+ int i,
+ len;
/* ----------------
* copy remainder of node
@@ -1040,9 +1040,9 @@ CopyPathFields(Path * from, Path * newnode)
newnode->p_ordering.ordtype = from->p_ordering.ordtype;
if (from->p_ordering.ordtype == SORTOP_ORDER)
{
- int len,
- i;
- Oid *ordering = from->p_ordering.ord.sortop;
+ int len,
+ i;
+ Oid *ordering = from->p_ordering.ord.sortop;
if (ordering)
{
@@ -1078,10 +1078,10 @@ CopyPathFields(Path * from, Path * newnode)
* _copyPath
* ----------------
*/
-static Path *
+static Path *
_copyPath(Path * from)
{
- Path *newnode = makeNode(Path);
+ Path *newnode = makeNode(Path);
CopyPathFields(from, newnode);
@@ -1095,7 +1095,7 @@ _copyPath(Path * from)
static IndexPath *
_copyIndexPath(IndexPath * from)
{
- IndexPath *newnode = makeNode(IndexPath);
+ IndexPath *newnode = makeNode(IndexPath);
/* ----------------
* copy the node superclass fields
@@ -1112,8 +1112,8 @@ _copyIndexPath(IndexPath * from)
if (from->indexkeys)
{
- int i,
- len;
+ int i,
+ len;
for (len = 0; from->indexkeys[len] != 0; len++)
;
@@ -1150,7 +1150,7 @@ CopyJoinPathFields(JoinPath * from, JoinPath * newnode)
static JoinPath *
_copyJoinPath(JoinPath * from)
{
- JoinPath *newnode = makeNode(JoinPath);
+ JoinPath *newnode = makeNode(JoinPath);
/* ----------------
* copy the node superclass fields
@@ -1169,7 +1169,7 @@ _copyJoinPath(JoinPath * from)
static MergePath *
_copyMergePath(MergePath * from)
{
- MergePath *newnode = makeNode(MergePath);
+ MergePath *newnode = makeNode(MergePath);
/* ----------------
* copy the node superclass fields
@@ -1196,7 +1196,7 @@ _copyMergePath(MergePath * from)
static HashPath *
_copyHashPath(HashPath * from)
{
- HashPath *newnode = makeNode(HashPath);
+ HashPath *newnode = makeNode(HashPath);
/* ----------------
* copy the node superclass fields
@@ -1223,7 +1223,7 @@ _copyHashPath(HashPath * from)
static OrderKey *
_copyOrderKey(OrderKey * from)
{
- OrderKey *newnode = makeNode(OrderKey);
+ OrderKey *newnode = makeNode(OrderKey);
/* ----------------
* copy remainder of node
@@ -1243,7 +1243,7 @@ _copyOrderKey(OrderKey * from)
static JoinKey *
_copyJoinKey(JoinKey * from)
{
- JoinKey *newnode = makeNode(JoinKey);
+ JoinKey *newnode = makeNode(JoinKey);
/* ----------------
* copy remainder of node
@@ -1262,7 +1262,7 @@ _copyJoinKey(JoinKey * from)
static MergeOrder *
_copyMergeOrder(MergeOrder * from)
{
- MergeOrder *newnode = makeNode(MergeOrder);
+ MergeOrder *newnode = makeNode(MergeOrder);
/* ----------------
* copy remainder of node
@@ -1281,10 +1281,10 @@ _copyMergeOrder(MergeOrder * from)
* _copyCInfo
* ----------------
*/
-static CInfo *
+static CInfo *
_copyCInfo(CInfo * from)
{
- CInfo *newnode = makeNode(CInfo);
+ CInfo *newnode = makeNode(CInfo);
/* ----------------
* copy remainder of node
@@ -1325,7 +1325,7 @@ CopyJoinMethodFields(JoinMethod * from, JoinMethod * newnode)
static JoinMethod *
_copyJoinMethod(JoinMethod * from)
{
- JoinMethod *newnode = makeNode(JoinMethod);
+ JoinMethod *newnode = makeNode(JoinMethod);
CopyJoinMethodFields(from, newnode);
@@ -1336,10 +1336,10 @@ _copyJoinMethod(JoinMethod * from)
* _copyHInfo
* ----------------
*/
-static HInfo *
+static HInfo *
_copyHInfo(HInfo * from)
{
- HInfo *newnode = makeNode(HInfo);
+ HInfo *newnode = makeNode(HInfo);
/* ----------------
* copy remainder of node
@@ -1354,10 +1354,10 @@ _copyHInfo(HInfo * from)
* _copyMInfo
* ----------------
*/
-static MInfo *
+static MInfo *
_copyMInfo(MInfo * from)
{
- MInfo *newnode = makeNode(MInfo);
+ MInfo *newnode = makeNode(MInfo);
/* ----------------
* copy remainder of node
@@ -1372,10 +1372,10 @@ _copyMInfo(MInfo * from)
* _copyJInfo
* ----------------
*/
-static JInfo *
+static JInfo *
_copyJInfo(JInfo * from)
{
- JInfo *newnode = makeNode(JInfo);
+ JInfo *newnode = makeNode(JInfo);
/* ----------------
* copy remainder of node
@@ -1391,10 +1391,10 @@ _copyJInfo(JInfo * from)
return newnode;
}
-static Iter *
+static Iter *
_copyIter(Iter * from)
{
- Iter *newnode = makeNode(Iter);
+ Iter *newnode = makeNode(Iter);
Node_Copy(from, newnode, iterexpr);
newnode->itertype = from->itertype;
@@ -1402,10 +1402,10 @@ _copyIter(Iter * from)
return newnode;
}
-static Stream *
+static Stream *
_copyStream(Stream * from)
{
- Stream *newnode = makeNode(Stream);
+ Stream *newnode = makeNode(Stream);
newnode->pathptr = from->pathptr;
newnode->cinfo = from->cinfo;
@@ -1430,7 +1430,7 @@ _copyStream(Stream * from)
static TargetEntry *
_copyTargetEntry(TargetEntry * from)
{
- TargetEntry *newnode = makeNode(TargetEntry);
+ TargetEntry *newnode = makeNode(TargetEntry);
Node_Copy(from, newnode, resdom);
Node_Copy(from, newnode, fjoin);
@@ -1441,7 +1441,7 @@ _copyTargetEntry(TargetEntry * from)
static RangeTblEntry *
_copyRangeTblEntry(RangeTblEntry * from)
{
- RangeTblEntry *newnode = makeNode(RangeTblEntry);
+ RangeTblEntry *newnode = makeNode(RangeTblEntry);
memcpy(newnode, from, sizeof(RangeTblEntry));
if (from->relname)
@@ -1470,7 +1470,7 @@ _copyRangeTblEntry(RangeTblEntry * from)
static SortClause *
_copySortClause(SortClause * from)
{
- SortClause *newnode = makeNode(SortClause);
+ SortClause *newnode = makeNode(SortClause);
Node_Copy(from, newnode, resdom);
newnode->opoid = from->opoid;
@@ -1481,7 +1481,7 @@ _copySortClause(SortClause * from)
static A_Const *
_copyAConst(A_Const * from)
{
- A_Const *newnode = makeNode(A_Const);
+ A_Const *newnode = makeNode(A_Const);
newnode->val = *((Value *) (copyObject(&(from->val))));
Node_Copy(from, newnode, typename);
@@ -1492,7 +1492,7 @@ _copyAConst(A_Const * from)
static TypeName *
_copyTypeName(TypeName * from)
{
- TypeName *newnode = makeNode(TypeName);
+ TypeName *newnode = makeNode(TypeName);
if (from->name)
{
@@ -1509,10 +1509,10 @@ _copyTypeName(TypeName * from)
return newnode;
}
-static Query *
+static Query *
_copyQuery(Query * from)
{
- Query *newnode = makeNode(Query);
+ Query *newnode = makeNode(Query);
newnode->commandType = from->commandType;
newnode->resultRelation = from->resultRelation;
@@ -1530,9 +1530,9 @@ _copyQuery(Query * from)
Node_Copy(from, newnode, rtable);
if (from->utilityStmt && nodeTag(from->utilityStmt) == T_NotifyStmt)
{
- NotifyStmt *from_notify = (NotifyStmt *) from->utilityStmt;
- NotifyStmt *n = makeNode(NotifyStmt);
- int length = strlen(from_notify->relname);
+ NotifyStmt *from_notify = (NotifyStmt *) from->utilityStmt;
+ NotifyStmt *n = makeNode(NotifyStmt);
+ int length = strlen(from_notify->relname);
n->relname = palloc(length + 1);
strcpy(n->relname, from_notify->relname);
@@ -1563,25 +1563,25 @@ _copyQuery(Query * from)
* ****************************************************************
*/
-static Value *
+static Value *
_copyValue(Value * from)
{
- Value *newnode = makeNode(Value);
+ Value *newnode = makeNode(Value);
newnode->type = from->type;
switch (from->type)
{
- case T_String:
- newnode->val.str = pstrdup(from->val.str);
- break;
- case T_Integer:
- newnode->val.ival = from->val.ival;
- break;
- case T_Float:
- newnode->val.dval = from->val.dval;
- break;
- default:
- break;
+ case T_String:
+ newnode->val.str = pstrdup(from->val.str);
+ break;
+ case T_Integer:
+ newnode->val.ival = from->val.ival;
+ break;
+ case T_Float:
+ newnode->val.dval = from->val.dval;
+ break;
+ default:
+ break;
}
return newnode;
}
@@ -1591,216 +1591,216 @@ _copyValue(Value * from)
* recursively copies its items.
* ----------------
*/
-void *
+void *
copyObject(void *from)
{
- void *retval;
+ void *retval;
if (from == NULL)
return NULL;
switch (nodeTag(from))
{
- /*
- * PLAN NODES
- */
- case T_Plan:
- retval = _copyPlan(from);
- break;
- case T_Existential:
- retval = _copyExistential(from);
- break;
- case T_Result:
- retval = _copyResult(from);
- break;
- case T_Append:
- retval = _copyAppend(from);
- break;
- case T_Scan:
- retval = _copyScan(from);
- break;
- case T_SeqScan:
- retval = _copySeqScan(from);
- break;
- case T_IndexScan:
- retval = _copyIndexScan(from);
- break;
- case T_Join:
- retval = _copyJoin(from);
- break;
- case T_NestLoop:
- retval = _copyNestLoop(from);
- break;
- case T_MergeJoin:
- retval = _copyMergeJoin(from);
- break;
- case T_HashJoin:
- retval = _copyHashJoin(from);
- break;
- case T_Temp:
- retval = _copyTemp(from);
- break;
- case T_Material:
- retval = _copyMaterial(from);
- break;
- case T_Sort:
- retval = _copySort(from);
- break;
- case T_Agg:
- retval = _copyAgg(from);
- break;
- case T_Unique:
- retval = _copyUnique(from);
- break;
- case T_Hash:
- retval = _copyHash(from);
- break;
-
- /*
- * PRIMITIVE NODES
- */
- case T_Resdom:
- retval = _copyResdom(from);
- break;
- case T_Fjoin:
- retval = _copyFjoin(from);
- break;
- case T_Expr:
- retval = _copyExpr(from);
- break;
- case T_Var:
- retval = _copyVar(from);
- break;
- case T_Oper:
- retval = _copyOper(from);
- break;
- case T_Const:
- retval = _copyConst(from);
- break;
- case T_Param:
- retval = _copyParam(from);
- break;
- case T_Func:
- retval = _copyFunc(from);
- break;
- case T_Array:
- retval = _copyArray(from);
- break;
- case T_ArrayRef:
- retval = _copyArrayRef(from);
- break;
- case T_Aggreg:
- retval = _copyAggreg(from);
- break;
-
- /*
- * RELATION NODES
- */
- case T_Rel:
- retval = _copyRel(from);
- break;
- case T_Path:
- retval = _copyPath(from);
- break;
- case T_IndexPath:
- retval = _copyIndexPath(from);
- break;
- case T_JoinPath:
- retval = _copyJoinPath(from);
- break;
- case T_MergePath:
- retval = _copyMergePath(from);
- break;
- case T_HashPath:
- retval = _copyHashPath(from);
- break;
- case T_OrderKey:
- retval = _copyOrderKey(from);
- break;
- case T_JoinKey:
- retval = _copyJoinKey(from);
- break;
- case T_MergeOrder:
- retval = _copyMergeOrder(from);
- break;
- case T_CInfo:
- retval = _copyCInfo(from);
- break;
- case T_JoinMethod:
- retval = _copyJoinMethod(from);
- break;
- case T_HInfo:
- retval = _copyHInfo(from);
- break;
- case T_MInfo:
- retval = _copyMInfo(from);
- break;
- case T_JInfo:
- retval = _copyJInfo(from);
- break;
- case T_Iter:
- retval = _copyIter(from);
- break;
- case T_Stream:
- retval = _copyStream(from);
- break;
-
- /*
- * PARSE NODES
- */
- case T_Query:
- retval = _copyQuery(from);
- break;
- case T_TargetEntry:
- retval = _copyTargetEntry(from);
- break;
- case T_RangeTblEntry:
- retval = _copyRangeTblEntry(from);
- break;
- case T_SortClause:
- retval = _copySortClause(from);
- break;
- case T_A_Const:
- retval = _copyAConst(from);
- break;
- case T_TypeName:
- retval = _copyTypeName(from);
- break;
-
- /*
- * VALUE NODES
- */
- case T_Integer:
- case T_String:
- case T_Float:
- retval = _copyValue(from);
- break;
- case T_List:
- {
- List *list = from,
+ /*
+ * PLAN NODES
+ */
+ case T_Plan:
+ retval = _copyPlan(from);
+ break;
+ case T_Existential:
+ retval = _copyExistential(from);
+ break;
+ case T_Result:
+ retval = _copyResult(from);
+ break;
+ case T_Append:
+ retval = _copyAppend(from);
+ break;
+ case T_Scan:
+ retval = _copyScan(from);
+ break;
+ case T_SeqScan:
+ retval = _copySeqScan(from);
+ break;
+ case T_IndexScan:
+ retval = _copyIndexScan(from);
+ break;
+ case T_Join:
+ retval = _copyJoin(from);
+ break;
+ case T_NestLoop:
+ retval = _copyNestLoop(from);
+ break;
+ case T_MergeJoin:
+ retval = _copyMergeJoin(from);
+ break;
+ case T_HashJoin:
+ retval = _copyHashJoin(from);
+ break;
+ case T_Temp:
+ retval = _copyTemp(from);
+ break;
+ case T_Material:
+ retval = _copyMaterial(from);
+ break;
+ case T_Sort:
+ retval = _copySort(from);
+ break;
+ case T_Agg:
+ retval = _copyAgg(from);
+ break;
+ case T_Unique:
+ retval = _copyUnique(from);
+ break;
+ case T_Hash:
+ retval = _copyHash(from);
+ break;
+
+ /*
+ * PRIMITIVE NODES
+ */
+ case T_Resdom:
+ retval = _copyResdom(from);
+ break;
+ case T_Fjoin:
+ retval = _copyFjoin(from);
+ break;
+ case T_Expr:
+ retval = _copyExpr(from);
+ break;
+ case T_Var:
+ retval = _copyVar(from);
+ break;
+ case T_Oper:
+ retval = _copyOper(from);
+ break;
+ case T_Const:
+ retval = _copyConst(from);
+ break;
+ case T_Param:
+ retval = _copyParam(from);
+ break;
+ case T_Func:
+ retval = _copyFunc(from);
+ break;
+ case T_Array:
+ retval = _copyArray(from);
+ break;
+ case T_ArrayRef:
+ retval = _copyArrayRef(from);
+ break;
+ case T_Aggreg:
+ retval = _copyAggreg(from);
+ break;
+
+ /*
+ * RELATION NODES
+ */
+ case T_Rel:
+ retval = _copyRel(from);
+ break;
+ case T_Path:
+ retval = _copyPath(from);
+ break;
+ case T_IndexPath:
+ retval = _copyIndexPath(from);
+ break;
+ case T_JoinPath:
+ retval = _copyJoinPath(from);
+ break;
+ case T_MergePath:
+ retval = _copyMergePath(from);
+ break;
+ case T_HashPath:
+ retval = _copyHashPath(from);
+ break;
+ case T_OrderKey:
+ retval = _copyOrderKey(from);
+ break;
+ case T_JoinKey:
+ retval = _copyJoinKey(from);
+ break;
+ case T_MergeOrder:
+ retval = _copyMergeOrder(from);
+ break;
+ case T_CInfo:
+ retval = _copyCInfo(from);
+ break;
+ case T_JoinMethod:
+ retval = _copyJoinMethod(from);
+ break;
+ case T_HInfo:
+ retval = _copyHInfo(from);
+ break;
+ case T_MInfo:
+ retval = _copyMInfo(from);
+ break;
+ case T_JInfo:
+ retval = _copyJInfo(from);
+ break;
+ case T_Iter:
+ retval = _copyIter(from);
+ break;
+ case T_Stream:
+ retval = _copyStream(from);
+ break;
+
+ /*
+ * PARSE NODES
+ */
+ case T_Query:
+ retval = _copyQuery(from);
+ break;
+ case T_TargetEntry:
+ retval = _copyTargetEntry(from);
+ break;
+ case T_RangeTblEntry:
+ retval = _copyRangeTblEntry(from);
+ break;
+ case T_SortClause:
+ retval = _copySortClause(from);
+ break;
+ case T_A_Const:
+ retval = _copyAConst(from);
+ break;
+ case T_TypeName:
+ retval = _copyTypeName(from);
+ break;
+
+ /*
+ * VALUE NODES
+ */
+ case T_Integer:
+ case T_String:
+ case T_Float:
+ retval = _copyValue(from);
+ break;
+ case T_List:
+ {
+ List *list = from,
*l;
- List *newlist = NIL,
+ List *newlist = NIL,
*nl = NIL;
- foreach(l, list)
- {
- if (newlist == NIL)
- {
- newlist = nl = lcons(copyObject(lfirst(l)), NIL);
- }
- else
+ foreach(l, list)
{
- lnext(nl) = lcons(copyObject(lfirst(l)), NIL);
- nl = lnext(nl);
+ if (newlist == NIL)
+ {
+ newlist = nl = lcons(copyObject(lfirst(l)), NIL);
+ }
+ else
+ {
+ lnext(nl) = lcons(copyObject(lfirst(l)), NIL);
+ nl = lnext(nl);
+ }
}
+ retval = newlist;
}
- retval = newlist;
- }
- break;
- default:
- elog(NOTICE, "copyObject: don't know how to copy %d", nodeTag(from));
- retval = from;
- break;
+ break;
+ default:
+ elog(NOTICE, "copyObject: don't know how to copy %d", nodeTag(from));
+ retval = from;
+ break;
}
return retval;
}
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 792c8783f9..21958ca293 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.7 1997/09/07 04:42:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.8 1997/09/08 02:23:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,7 +26,7 @@
#include "utils/elog.h"
#include "storage/itemptr.h"
-static bool equali(List * a, List * b);
+static bool equali(List * a, List * b);
/*
* Stuff from primnodes.h
@@ -35,7 +35,7 @@ static bool equali(List * a, List * b);
/*
* Resdom is a subclass of Node.
*/
-static bool
+static bool
_equalResdom(Resdom * a, Resdom * b)
{
if (a->resno != b->resno)
@@ -54,10 +54,10 @@ _equalResdom(Resdom * a, Resdom * b)
return (true);
}
-static bool
+static bool
_equalFjoin(Fjoin * a, Fjoin * b)
{
- int nNodes;
+ int nNodes;
if (a->fj_initialized != b->fj_initialized)
return (false);
@@ -78,7 +78,7 @@ _equalFjoin(Fjoin * a, Fjoin * b)
/*
* Expr is a subclass of Node.
*/
-static bool
+static bool
_equalExpr(Expr * a, Expr * b)
{
if (a->opType != b->opType)
@@ -91,13 +91,13 @@ _equalExpr(Expr * a, Expr * b)
return (true);
}
-static bool
+static bool
_equalIter(Iter * a, Iter * b)
{
return (equal(a->iterexpr, b->iterexpr));
}
-static bool
+static bool
_equalStream(Stream * a, Stream * b)
{
if (a->clausetype != b->clausetype)
@@ -120,7 +120,7 @@ _equalStream(Stream * a, Stream * b)
/*
* Var is a subclass of Expr.
*/
-static bool
+static bool
_equalVar(Var * a, Var * b)
{
if (a->varno != b->varno)
@@ -137,7 +137,7 @@ _equalVar(Var * a, Var * b)
return (true);
}
-static bool
+static bool
_equalArray(Array * a, Array * b)
{
if (a->arrayelemtype != b->arrayelemtype)
@@ -153,7 +153,7 @@ _equalArray(Array * a, Array * b)
return (TRUE);
}
-static bool
+static bool
_equalArrayRef(ArrayRef * a, ArrayRef * b)
{
if (a->refelemtype != b->refelemtype)
@@ -176,7 +176,7 @@ _equalArrayRef(ArrayRef * a, ArrayRef * b)
/*
* Oper is a subclass of Expr.
*/
-static bool
+static bool
_equalOper(Oper * a, Oper * b)
{
if (a->opno != b->opno)
@@ -190,7 +190,7 @@ _equalOper(Oper * a, Oper * b)
/*
* Const is a subclass of Expr.
*/
-static bool
+static bool
_equalConst(Const * a, Const * b)
{
@@ -213,7 +213,7 @@ _equalConst(Const * a, Const * b)
/*
* Param is a subclass of Expr.
*/
-static bool
+static bool
_equalParam(Param * a, Param * b)
{
if (a->paramkind != b->paramkind)
@@ -225,26 +225,26 @@ _equalParam(Param * a, Param * b)
switch (a->paramkind)
{
- case PARAM_NAMED:
- case PARAM_NEW:
- case PARAM_OLD:
- if (strcmp(a->paramname, b->paramname) != 0)
- return (false);
- break;
- case PARAM_NUM:
- if (a->paramid != b->paramid)
- return (false);
- break;
- case PARAM_INVALID:
-
- /*
- * XXX: Hmmm... What are we supposed to return in this case ??
- */
- return (true);
- break;
- default:
- elog(WARN, "_equalParam: Invalid paramkind value: %d",
- a->paramkind);
+ case PARAM_NAMED:
+ case PARAM_NEW:
+ case PARAM_OLD:
+ if (strcmp(a->paramname, b->paramname) != 0)
+ return (false);
+ break;
+ case PARAM_NUM:
+ if (a->paramid != b->paramid)
+ return (false);
+ break;
+ case PARAM_INVALID:
+
+ /*
+ * XXX: Hmmm... What are we supposed to return in this case ??
+ */
+ return (true);
+ break;
+ default:
+ elog(WARN, "_equalParam: Invalid paramkind value: %d",
+ a->paramkind);
}
return (true);
@@ -253,7 +253,7 @@ _equalParam(Param * a, Param * b)
/*
* Func is a subclass of Expr.
*/
-static bool
+static bool
_equalFunc(Func * a, Func * b)
{
if (a->funcid != b->funcid)
@@ -275,7 +275,7 @@ _equalFunc(Func * a, Func * b)
/*
* CInfo is a subclass of Node.
*/
-static bool
+static bool
_equalCInfo(CInfo * a, CInfo * b)
{
Assert(IsA(a, CInfo));
@@ -297,7 +297,7 @@ _equalCInfo(CInfo * a, CInfo * b)
(b->indexids)));
}
-static bool
+static bool
_equalJoinMethod(JoinMethod * a, JoinMethod * b)
{
Assert(IsA(a, JoinMethod));
@@ -312,7 +312,7 @@ _equalJoinMethod(JoinMethod * a, JoinMethod * b)
return (true);
}
-static bool
+static bool
_equalPath(Path * a, Path * b)
{
if (a->pathtype != b->pathtype)
@@ -325,7 +325,7 @@ _equalPath(Path * a, Path * b)
*/
if (a->p_ordering.ordtype == SORTOP_ORDER)
{
- int i = 0;
+ int i = 0;
if (a->p_ordering.ord.sortop == NULL ||
b->p_ordering.ord.sortop == NULL)
@@ -367,7 +367,7 @@ _equalPath(Path * a, Path * b)
return (true);
}
-static bool
+static bool
_equalIndexPath(IndexPath * a, IndexPath * b)
{
if (!_equalPath((Path *) a, (Path *) b))
@@ -379,7 +379,7 @@ _equalIndexPath(IndexPath * a, IndexPath * b)
return (true);
}
-static bool
+static bool
_equalJoinPath(JoinPath * a, JoinPath * b)
{
Assert(IsA_JoinPath(a));
@@ -396,7 +396,7 @@ _equalJoinPath(JoinPath * a, JoinPath * b)
return (true);
}
-static bool
+static bool
_equalMergePath(MergePath * a, MergePath * b)
{
Assert(IsA(a, MergePath));
@@ -413,7 +413,7 @@ _equalMergePath(MergePath * a, MergePath * b)
return (true);
}
-static bool
+static bool
_equalHashPath(HashPath * a, HashPath * b)
{
Assert(IsA(a, HashPath));
@@ -430,7 +430,7 @@ _equalHashPath(HashPath * a, HashPath * b)
return (true);
}
-static bool
+static bool
_equalJoinKey(JoinKey * a, JoinKey * b)
{
Assert(IsA(a, JoinKey));
@@ -443,7 +443,7 @@ _equalJoinKey(JoinKey * a, JoinKey * b)
return (true);
}
-static bool
+static bool
_equalMergeOrder(MergeOrder * a, MergeOrder * b)
{
if (a == (MergeOrder *) NULL && b == (MergeOrder *) NULL)
@@ -464,7 +464,7 @@ _equalMergeOrder(MergeOrder * a, MergeOrder * b)
return (true);
}
-static bool
+static bool
_equalHInfo(HInfo * a, HInfo * b)
{
Assert(IsA(a, HInfo));
@@ -478,7 +478,7 @@ _equalHInfo(HInfo * a, HInfo * b)
/* XXX This equality function is a quick hack, should be
* fixed to compare all fields.
*/
-static bool
+static bool
_equalIndexScan(IndexScan * a, IndexScan * b)
{
Assert(IsA(a, IndexScan));
@@ -499,7 +499,7 @@ _equalIndexScan(IndexScan * a, IndexScan * b)
return (true);
}
-static bool
+static bool
_equalJInfo(JInfo * a, JInfo * b)
{
Assert(IsA(a, JInfo));
@@ -522,7 +522,7 @@ _equalJInfo(JInfo * a, JInfo * b)
/*
* EState is a subclass of Node.
*/
-static bool
+static bool
_equalEState(EState * a, EState * b)
{
if (a->es_direction != b->es_direction)
@@ -537,7 +537,7 @@ _equalEState(EState * a, EState * b)
return (true);
}
-static bool
+static bool
_equalTargetEntry(TargetEntry * a, TargetEntry * b)
{
if (!equal(a->resdom, b->resdom))
@@ -557,7 +557,7 @@ _equalTargetEntry(TargetEntry * a, TargetEntry * b)
* This is a comparison by value. It would be simpler to write it
* to be recursive, but it should run faster if we iterate.
*/
-static bool
+static bool
_equalValue(Value * a, Value * b)
{
if (a->type != b->type)
@@ -565,14 +565,14 @@ _equalValue(Value * a, Value * b)
switch (a->type)
{
- case T_String:
- return strcmp(a->val.str, b->val.str);
- case T_Integer:
- return (a->val.ival == b->val.ival);
- case T_Float:
- return (a->val.dval == b->val.dval);
- default:
- break;
+ case T_String:
+ return strcmp(a->val.str, b->val.str);
+ case T_Integer:
+ return (a->val.ival == b->val.ival);
+ case T_Float:
+ return (a->val.dval == b->val.dval);
+ default:
+ break;
}
return (true);
@@ -585,7 +585,7 @@ _equalValue(Value * a, Value * b)
bool
equal(void *a, void *b)
{
- bool retval = false;
+ bool retval = false;
if (a == b)
return (true);
@@ -604,112 +604,112 @@ equal(void *a, void *b)
switch (nodeTag(a))
{
- case T_Resdom:
- retval = _equalResdom(a, b);
- break;
- case T_Fjoin:
- retval = _equalFjoin(a, b);
- break;
- case T_Expr:
- retval = _equalExpr(a, b);
- break;
- case T_TargetEntry:
- retval = _equalTargetEntry(a, b);
- break;
- case T_Iter:
- retval = _equalIter(a, b);
- break;
- case T_Stream:
- retval = _equalStream(a, b);
- break;
- case T_Var:
- retval = _equalVar(a, b);
- break;
- case T_Array:
- retval = _equalArray(a, b);
- break;
- case T_ArrayRef:
- retval = _equalArrayRef(a, b);
- break;
- case T_Oper:
- retval = _equalOper(a, b);
- break;
- case T_Const:
- retval = _equalConst(a, b);
- break;
- case T_Param:
- retval = _equalParam(a, b);
- break;
- case T_Func:
- retval = _equalFunc(a, b);
- break;
- case T_CInfo:
- retval = _equalCInfo(a, b);
- break;
- case T_JoinMethod:
- retval = _equalJoinMethod(a, b);
- break;
- case T_Path:
- retval = _equalPath(a, b);
- break;
- case T_IndexPath:
- retval = _equalIndexPath(a, b);
- break;
- case T_JoinPath:
- retval = _equalJoinPath(a, b);
- break;
- case T_MergePath:
- retval = _equalMergePath(a, b);
- break;
- case T_HashPath:
- retval = _equalHashPath(a, b);
- break;
- case T_JoinKey:
- retval = _equalJoinKey(a, b);
- break;
- case T_MergeOrder:
- retval = _equalMergeOrder(a, b);
- break;
- case T_HInfo:
- retval = _equalHInfo(a, b);
- break;
- case T_IndexScan:
- retval = _equalIndexScan(a, b);
- break;
- case T_JInfo:
- retval = _equalJInfo(a, b);
- break;
- case T_EState:
- retval = _equalEState(a, b);
- break;
- case T_Integer:
- case T_String:
- case T_Float:
- retval = _equalValue(a, b);
- break;
- case T_List:
- {
- List *la = (List *) a;
- List *lb = (List *) b;
- List *l;
-
- if (a == NULL && b == NULL)
- return (true);
- if (length(a) != length(b))
- return (false);
- foreach(l, la)
+ case T_Resdom:
+ retval = _equalResdom(a, b);
+ break;
+ case T_Fjoin:
+ retval = _equalFjoin(a, b);
+ break;
+ case T_Expr:
+ retval = _equalExpr(a, b);
+ break;
+ case T_TargetEntry:
+ retval = _equalTargetEntry(a, b);
+ break;
+ case T_Iter:
+ retval = _equalIter(a, b);
+ break;
+ case T_Stream:
+ retval = _equalStream(a, b);
+ break;
+ case T_Var:
+ retval = _equalVar(a, b);
+ break;
+ case T_Array:
+ retval = _equalArray(a, b);
+ break;
+ case T_ArrayRef:
+ retval = _equalArrayRef(a, b);
+ break;
+ case T_Oper:
+ retval = _equalOper(a, b);
+ break;
+ case T_Const:
+ retval = _equalConst(a, b);
+ break;
+ case T_Param:
+ retval = _equalParam(a, b);
+ break;
+ case T_Func:
+ retval = _equalFunc(a, b);
+ break;
+ case T_CInfo:
+ retval = _equalCInfo(a, b);
+ break;
+ case T_JoinMethod:
+ retval = _equalJoinMethod(a, b);
+ break;
+ case T_Path:
+ retval = _equalPath(a, b);
+ break;
+ case T_IndexPath:
+ retval = _equalIndexPath(a, b);
+ break;
+ case T_JoinPath:
+ retval = _equalJoinPath(a, b);
+ break;
+ case T_MergePath:
+ retval = _equalMergePath(a, b);
+ break;
+ case T_HashPath:
+ retval = _equalHashPath(a, b);
+ break;
+ case T_JoinKey:
+ retval = _equalJoinKey(a, b);
+ break;
+ case T_MergeOrder:
+ retval = _equalMergeOrder(a, b);
+ break;
+ case T_HInfo:
+ retval = _equalHInfo(a, b);
+ break;
+ case T_IndexScan:
+ retval = _equalIndexScan(a, b);
+ break;
+ case T_JInfo:
+ retval = _equalJInfo(a, b);
+ break;
+ case T_EState:
+ retval = _equalEState(a, b);
+ break;
+ case T_Integer:
+ case T_String:
+ case T_Float:
+ retval = _equalValue(a, b);
+ break;
+ case T_List:
{
- if (!equal(lfirst(l), lfirst(lb)))
+ List *la = (List *) a;
+ List *lb = (List *) b;
+ List *l;
+
+ if (a == NULL && b == NULL)
+ return (true);
+ if (length(a) != length(b))
return (false);
- lb = lnext(lb);
+ foreach(l, la)
+ {
+ if (!equal(lfirst(l), lfirst(lb)))
+ return (false);
+ lb = lnext(lb);
+ }
+ retval = true;
}
- retval = true;
- }
- break;
- default:
- elog(NOTICE, "equal: don't know whether nodes of type %d are equal",
- nodeTag(a));
- break;
+ break;
+ default:
+ elog(NOTICE, "equal: don't know whether nodes of type %d are equal",
+ nodeTag(a));
+ break;
}
return retval;
@@ -721,12 +721,12 @@ equal(void *a, void *b)
*
* XXX temp hack. needs something like T_IntList
*/
-static bool
+static bool
equali(List * a, List * b)
{
- List *la = (List *) a;
- List *lb = (List *) b;
- List *l;
+ List *la = (List *) a;
+ List *lb = (List *) b;
+ List *l;
if (a == NULL && b == NULL)
return (true);
diff --git a/src/backend/nodes/list.c b/src/backend/nodes/list.c
index 334030822f..abba222b81 100644
--- a/src/backend/nodes/list.c
+++ b/src/backend/nodes/list.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.5 1997/09/07 04:42:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.6 1997/09/08 02:23:38 momjian Exp $
*
* NOTES
* XXX a few of the following functions are duplicated to handle
@@ -29,13 +29,13 @@
#include "utils/elog.h"
#include "utils/palloc.h"
-List *
+List *
makeList(void *elem,...)
{
- va_list args;
- List *retval = NIL;
- List *temp = NIL;
- List *tempcons = NIL;
+ va_list args;
+ List *retval = NIL;
+ List *temp = NIL;
+ List *tempcons = NIL;
va_start(args, elem);
@@ -57,62 +57,62 @@ makeList(void *elem,...)
return (retval);
}
-List *
+List *
lcons(void *obj, List * list)
{
- List *l = makeNode(List);
+ List *l = makeNode(List);
lfirst(l) = obj;
lnext(l) = list;
return l;
}
-List *
+List *
lconsi(int datum, List * list)
{
- List *l = makeNode(List);
+ List *l = makeNode(List);
lfirsti(l) = datum;
lnext(l) = list;
return l;
}
-List *
+List *
lappend(List * list, void *obj)
{
return nconc(list, lcons(obj, NIL));
}
-List *
+List *
lappendi(List * list, int datum)
{
return nconc(list, lconsi(datum, NIL));
}
-Value *
+Value *
makeInteger(long i)
{
- Value *v = makeNode(Value);
+ Value *v = makeNode(Value);
v->type = T_Integer;
v->val.ival = i;
return v;
}
-Value *
+Value *
makeFloat(double d)
{
- Value *v = makeNode(Value);
+ Value *v = makeNode(Value);
v->type = T_Float;
v->val.dval = d;
return v;
}
-Value *
+Value *
makeString(char *str)
{
- Value *v = makeNode(Value);
+ Value *v = makeNode(Value);
v->type = T_String;
v->val.str = str;
@@ -120,7 +120,7 @@ makeString(char *str)
}
/* n starts with 0 */
-void *
+void *
nth(int n, List * l)
{
/* XXX assume list is long enough */
@@ -161,7 +161,7 @@ set_nth(List * l, int n, void *elem)
int
length(List * l)
{
- int i = 0;
+ int i = 0;
while (l != NIL)
{
@@ -176,7 +176,7 @@ freeList(List * list)
{
while (list != NIL)
{
- List *l = list;
+ List *l = list;
list = lnext(list);
pfree(l);
@@ -186,12 +186,12 @@ freeList(List * list)
/*
* below are for backwards compatibility
*/
-List *
+List *
append(List * l1, List * l2)
{
- List *newlist,
- *newlist2,
- *p;
+ List *newlist,
+ *newlist2,
+ *p;
if (l1 == NIL)
return copyObject(l2);
@@ -208,12 +208,12 @@ append(List * l1, List * l2)
/*
* below are for backwards compatibility
*/
-List *
+List *
intAppend(List * l1, List * l2)
{
- List *newlist,
- *newlist2,
- *p;
+ List *newlist,
+ *newlist2,
+ *p;
if (l1 == NIL)
return listCopy(l2);
@@ -227,10 +227,10 @@ intAppend(List * l1, List * l2)
return newlist;
}
-List *
+List *
nconc(List * l1, List * l2)
{
- List *temp;
+ List *temp;
if (l1 == NIL)
return l2;
@@ -247,11 +247,11 @@ nconc(List * l1, List * l2)
}
-List *
+List *
nreverse(List * list)
{
- List *rlist = NIL;
- List *p = NIL;
+ List *rlist = NIL;
+ List *p = NIL;
if (list == NULL)
return (NIL);
@@ -280,7 +280,7 @@ nreverse(List * list)
bool
same(List * foo, List * bar)
{
- List *temp = NIL;
+ List *temp = NIL;
if (foo == NULL)
return (bar == NULL);
@@ -299,12 +299,12 @@ same(List * foo, List * bar)
}
-List *
+List *
LispUnion(List * foo, List * bar)
{
- List *retval = NIL;
- List *i = NIL;
- List *j = NIL;
+ List *retval = NIL;
+ List *i = NIL;
+ List *j = NIL;
if (foo == NIL)
return (bar); /* XXX - should be copy of bar */
@@ -331,12 +331,12 @@ LispUnion(List * foo, List * bar)
return (retval);
}
-List *
+List *
LispUnioni(List * foo, List * bar)
{
- List *retval = NIL;
- List *i = NIL;
- List *j = NIL;
+ List *retval = NIL;
+ List *i = NIL;
+ List *j = NIL;
if (foo == NIL)
return (bar); /* XXX - should be copy of bar */
@@ -371,7 +371,7 @@ LispUnioni(List * foo, List * bar)
bool
member(void *foo, List * bar)
{
- List *i;
+ List *i;
foreach(i, bar)
if (equal((Node *) (lfirst(i)), (Node *) foo))
@@ -382,7 +382,7 @@ member(void *foo, List * bar)
bool
intMember(int foo, List * bar)
{
- List *i;
+ List *i;
foreach(i, bar)
if (foo == lfirsti(i))
@@ -394,12 +394,12 @@ intMember(int foo, List * bar)
* lremove -
* only does pointer comparisons. Removes 'elem' from the the linked list.
*/
-List *
+List *
lremove(void *elem, List * list)
{
- List *l;
- List *prev = NIL;
- List *result = list;
+ List *l;
+ List *prev = NIL;
+ List *result = list;
foreach(l, list)
{
@@ -421,11 +421,11 @@ lremove(void *elem, List * list)
return result;
}
-List *
+List *
LispRemove(void *elem, List * list)
{
- List *temp = NIL;
- List *prev = NIL;
+ List *temp = NIL;
+ List *prev = NIL;
if (equal(elem, lfirst(list)))
return lnext(list);
@@ -446,11 +446,11 @@ LispRemove(void *elem, List * list)
}
#ifdef NOT_USED
-List *
+List *
intLispRemove(int elem, List * list)
{
- List *temp = NIL;
- List *prev = NIL;
+ List *temp = NIL;
+ List *prev = NIL;
if (elem == lfirsti(list))
return lnext(list);
@@ -472,11 +472,11 @@ intLispRemove(int elem, List * list)
#endif
-List *
+List *
set_difference(List * list1, List * list2)
{
- List *temp1 = NIL;
- List *result = NIL;
+ List *temp1 = NIL;
+ List *result = NIL;
if (list2 == NIL)
return (list1);
@@ -489,11 +489,11 @@ set_difference(List * list1, List * list2)
return (result);
}
-List *
+List *
set_differencei(List * list1, List * list2)
{
- List *temp1 = NIL;
- List *result = NIL;
+ List *temp1 = NIL;
+ List *result = NIL;
if (list2 == NIL)
return (list1);
diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c
index 7c5a9efc1f..95cce161d6 100644
--- a/src/backend/nodes/makefuncs.c
+++ b/src/backend/nodes/makefuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.3 1997/09/07 04:42:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/makefuncs.c,v 1.4 1997/09/08 02:23:39 momjian Exp $
*
* NOTES
* Creator functions in POSTGRES 4.2 are generated automatically. Most of
@@ -27,14 +27,14 @@
* makeOper -
* creates an Oper node
*/
-Oper *
+Oper *
makeOper(Oid opno,
Oid opid,
Oid opresulttype,
int opsize,
FunctionCachePtr op_fcache)
{
- Oper *oper = makeNode(Oper);
+ Oper *oper = makeNode(Oper);
oper->opno = opno;
oper->opid = opid;
@@ -49,14 +49,14 @@ makeOper(Oid opno,
* creates a Var node
*
*/
-Var *
+Var *
makeVar(Index varno,
AttrNumber varattno,
Oid vartype,
Index varnoold,
AttrNumber varoattno)
{
- Var *var = makeNode(Var);
+ Var *var = makeNode(Var);
var->varno = varno;
var->varattno = varattno;
@@ -71,7 +71,7 @@ makeVar(Index varno,
* makeResdom -
* creates a Resdom (Result Domain) node
*/
-Resdom *
+Resdom *
makeResdom(AttrNumber resno,
Oid restype,
int reslen,
@@ -80,7 +80,7 @@ makeResdom(AttrNumber resno,
Oid reskeyop,
int resjunk)
{
- Resdom *resdom = makeNode(Resdom);
+ Resdom *resdom = makeNode(Resdom);
resdom->resno = resno;
resdom->restype = restype;
@@ -96,7 +96,7 @@ makeResdom(AttrNumber resno,
* makeConst -
* creates a Const node
*/
-Const *
+Const *
makeConst(Oid consttype,
Size constlen,
Datum constvalue,
@@ -105,7 +105,7 @@ makeConst(Oid consttype,
bool constisset,
bool constiscast)
{
- Const *cnst = makeNode(Const);
+ Const *cnst = makeNode(Const);
cnst->consttype = consttype;
cnst->constlen = constlen;
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c
index 081760eaca..9f343ac6c0 100644
--- a/src/backend/nodes/nodeFuncs.c
+++ b/src/backend/nodes/nodeFuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.4 1997/09/07 04:42:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/nodeFuncs.c,v 1.5 1997/09/08 02:23:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,7 +23,7 @@
#include "nodes/nodeFuncs.h"
#include "utils/lsyscache.h"
-static bool var_is_inner(Var * var);
+static bool var_is_inner(Var * var);
/*
* single_node -
@@ -63,7 +63,7 @@ var_is_outer(Var * var)
return ((bool) (var->varno == OUTER));
}
-static bool
+static bool
var_is_inner(Var * var)
{
return ((bool) (var->varno == INNER));
@@ -89,7 +89,7 @@ var_is_rel(Var * var)
* Returns the modified oper node.
*
*/
-Oper *
+Oper *
replace_opid(Oper * oper)
{
oper->opid = get_opcode(oper->opno);
diff --git a/src/backend/nodes/nodes.c b/src/backend/nodes/nodes.c
index 2af057e5a4..1abee00b84 100644
--- a/src/backend/nodes/nodes.c
+++ b/src/backend/nodes/nodes.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/nodes.c,v 1.2 1997/09/07 04:42:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/nodes.c,v 1.3 1997/09/08 02:23:40 momjian Exp $
*
* HISTORY
* Andrew Yu Oct 20, 1994 file creation
@@ -31,10 +31,10 @@
* macro makeNode. eg. to create a Resdom node, use makeNode(Resdom)
*
*/
-Node *
+Node *
newNode(Size size, NodeTag tag)
{
- Node *newNode;
+ Node *newNode;
Assert(size >= 4); /* need the tag, at least */
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index a1574c8734..30c0ff9a6e 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.7 1997/09/07 04:42:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.8 1997/09/08 02:23:41 momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -45,8 +45,8 @@
#include "catalog/pg_type.h"
#include "lib/stringinfo.h"
-static void _outDatum(StringInfo str, Datum value, Oid type);
-static void _outNode(StringInfo str, void *obj);
+static void _outDatum(StringInfo str, Datum value, Oid type);
+static void _outNode(StringInfo str, void *obj);
/*
* _outIntList -
@@ -55,8 +55,8 @@ static void _outNode(StringInfo str, void *obj);
static void
_outIntList(StringInfo str, List * list)
{
- List *l;
- char buf[500];
+ List *l;
+ char buf[500];
appendStringInfo(str, "(");
foreach(l, list)
@@ -70,7 +70,7 @@ _outIntList(StringInfo str, List * list)
static void
_outQuery(StringInfo str, Query * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "QUERY");
appendStringInfo(str, buf);
@@ -112,7 +112,7 @@ _outQuery(StringInfo str, Query * node)
static void
_outPlanInfo(StringInfo str, Plan * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, " :cost %g", node->cost);
appendStringInfo(str, buf);
@@ -144,7 +144,7 @@ _outPlanInfo(StringInfo str, Plan * node)
static void
_outPlan(StringInfo str, Plan * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "PLAN");
appendStringInfo(str, buf);
@@ -155,7 +155,7 @@ _outPlan(StringInfo str, Plan * node)
static void
_outResult(StringInfo str, Result * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "RESULT");
appendStringInfo(str, buf);
@@ -173,7 +173,7 @@ _outResult(StringInfo str, Result * node)
static void
_outExistential(StringInfo str, Existential * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "EXISTENTIAL");
appendStringInfo(str, buf);
@@ -188,7 +188,7 @@ _outExistential(StringInfo str, Existential * node)
static void
_outAppend(StringInfo str, Append * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "APPEND");
appendStringInfo(str, buf);
@@ -213,7 +213,7 @@ _outAppend(StringInfo str, Append * node)
static void
_outJoin(StringInfo str, Join * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "JOIN");
appendStringInfo(str, buf);
@@ -227,7 +227,7 @@ _outJoin(StringInfo str, Join * node)
static void
_outNestLoop(StringInfo str, NestLoop * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "NESTLOOP");
appendStringInfo(str, buf);
@@ -240,7 +240,7 @@ _outNestLoop(StringInfo str, NestLoop * node)
static void
_outMergeJoin(StringInfo str, MergeJoin * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "MERGEJOIN");
appendStringInfo(str, buf);
@@ -266,7 +266,7 @@ _outMergeJoin(StringInfo str, MergeJoin * node)
static void
_outHashJoin(StringInfo str, HashJoin * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "HASHJOIN");
appendStringInfo(str, buf);
@@ -294,7 +294,7 @@ _outHashJoin(StringInfo str, HashJoin * node)
static void
_outScan(StringInfo str, Scan * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "SCAN");
appendStringInfo(str, buf);
@@ -311,7 +311,7 @@ _outScan(StringInfo str, Scan * node)
static void
_outSeqScan(StringInfo str, SeqScan * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "SEQSCAN");
appendStringInfo(str, buf);
@@ -329,7 +329,7 @@ _outSeqScan(StringInfo str, SeqScan * node)
static void
_outIndexScan(StringInfo str, IndexScan * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "INDEXSCAN");
appendStringInfo(str, buf);
@@ -354,7 +354,7 @@ _outIndexScan(StringInfo str, IndexScan * node)
static void
_outTemp(StringInfo str, Temp * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "TEMP");
appendStringInfo(str, buf);
@@ -373,7 +373,7 @@ _outTemp(StringInfo str, Temp * node)
static void
_outSort(StringInfo str, Sort * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "SORT");
appendStringInfo(str, buf);
@@ -389,7 +389,7 @@ _outSort(StringInfo str, Sort * node)
static void
_outAgg(StringInfo str, Agg * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "AGG");
appendStringInfo(str, buf);
@@ -403,7 +403,7 @@ _outAgg(StringInfo str, Agg * node)
static void
_outGroup(StringInfo str, Group * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "GRP");
appendStringInfo(str, buf);
@@ -424,7 +424,7 @@ _outGroup(StringInfo str, Group * node)
static void
_outUnique(StringInfo str, Unique * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "UNIQUE");
appendStringInfo(str, buf);
@@ -444,7 +444,7 @@ _outUnique(StringInfo str, Unique * node)
static void
_outHash(StringInfo str, Hash * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "HASH");
appendStringInfo(str, buf);
@@ -465,7 +465,7 @@ _outHash(StringInfo str, Hash * node)
static void
_outTee(StringInfo str, Tee * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "TEE");
appendStringInfo(str, buf);
@@ -496,7 +496,7 @@ _outTee(StringInfo str, Tee * node)
static void
_outResdom(StringInfo str, Resdom * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "RESDOM");
appendStringInfo(str, buf);
@@ -521,8 +521,8 @@ _outResdom(StringInfo str, Resdom * node)
static void
_outFjoin(StringInfo str, Fjoin * node)
{
- char buf[500];
- int i;
+ char buf[500];
+ int i;
sprintf(buf, "FJOIN");
appendStringInfo(str, buf);
@@ -552,8 +552,8 @@ _outFjoin(StringInfo str, Fjoin * node)
static void
_outExpr(StringInfo str, Expr * node)
{
- char buf[500];
- char *opstr = NULL;
+ char buf[500];
+ char *opstr = NULL;
sprintf(buf, "EXPR");
appendStringInfo(str, buf);
@@ -562,21 +562,21 @@ _outExpr(StringInfo str, Expr * node)
appendStringInfo(str, buf);
switch (node->opType)
{
- case OP_EXPR:
- opstr = "op";
- break;
- case FUNC_EXPR:
- opstr = "func";
- break;
- case OR_EXPR:
- opstr = "or";
- break;
- case AND_EXPR:
- opstr = "and";
- break;
- case NOT_EXPR:
- opstr = "not";
- break;
+ case OP_EXPR:
+ opstr = "op";
+ break;
+ case FUNC_EXPR:
+ opstr = "func";
+ break;
+ case OR_EXPR:
+ opstr = "or";
+ break;
+ case AND_EXPR:
+ opstr = "and";
+ break;
+ case NOT_EXPR:
+ opstr = "not";
+ break;
}
sprintf(buf, " :opType %s", opstr);
appendStringInfo(str, buf);
@@ -594,7 +594,7 @@ _outExpr(StringInfo str, Expr * node)
static void
_outVar(StringInfo str, Var * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "VAR");
appendStringInfo(str, buf);
@@ -616,7 +616,7 @@ _outVar(StringInfo str, Var * node)
static void
_outConst(StringInfo str, Const * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "CONST");
appendStringInfo(str, buf);
@@ -648,7 +648,7 @@ _outConst(StringInfo str, Const * node)
static void
_outAggreg(StringInfo str, Aggreg * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "AGGREG");
appendStringInfo(str, buf);
@@ -672,8 +672,8 @@ _outAggreg(StringInfo str, Aggreg * node)
static void
_outArray(StringInfo str, Array * node)
{
- char buf[500];
- int i;
+ char buf[500];
+ int i;
sprintf(buf, "ARRAY");
appendStringInfo(str, buf);
@@ -709,7 +709,7 @@ _outArray(StringInfo str, Array * node)
static void
_outArrayRef(StringInfo str, ArrayRef * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "ARRAYREF");
appendStringInfo(str, buf);
@@ -745,7 +745,7 @@ _outArrayRef(StringInfo str, ArrayRef * node)
static void
_outFunc(StringInfo str, Func * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "FUNC");
appendStringInfo(str, buf);
@@ -774,7 +774,7 @@ _outFunc(StringInfo str, Func * node)
static void
_outOper(StringInfo str, Oper * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "OPER");
appendStringInfo(str, buf);
@@ -793,7 +793,7 @@ _outOper(StringInfo str, Oper * node)
static void
_outParam(StringInfo str, Param * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "PARAM");
appendStringInfo(str, buf);
@@ -820,7 +820,7 @@ _outParam(StringInfo str, Param * node)
static void
_outEState(StringInfo str, EState * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "ESTATE");
appendStringInfo(str, buf);
@@ -843,7 +843,7 @@ _outEState(StringInfo str, EState * node)
static void
_outRel(StringInfo str, Rel * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "REL");
appendStringInfo(str, buf);
@@ -919,7 +919,7 @@ _outRel(StringInfo str, Rel * node)
static void
_outTargetEntry(StringInfo str, TargetEntry * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "TLE");
appendStringInfo(str, buf);
@@ -942,7 +942,7 @@ _outTargetEntry(StringInfo str, TargetEntry * node)
static void
_outRangeTblEntry(StringInfo str, RangeTblEntry * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "RTE");
appendStringInfo(str, buf);
@@ -968,7 +968,7 @@ _outRangeTblEntry(StringInfo str, RangeTblEntry * node)
static void
_outPath(StringInfo str, Path * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "PATH");
appendStringInfo(str, buf);
@@ -991,7 +991,7 @@ _outPath(StringInfo str, Path * node)
static void
_outIndexPath(StringInfo str, IndexPath * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "INDEXPATH");
appendStringInfo(str, buf);
@@ -1032,7 +1032,7 @@ _outIndexPath(StringInfo str, IndexPath * node)
static void
_outJoinPath(StringInfo str, JoinPath * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "JOINPATH");
appendStringInfo(str, buf);
@@ -1086,7 +1086,7 @@ _outJoinPath(StringInfo str, JoinPath * node)
static void
_outMergePath(StringInfo str, MergePath * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "MERGEPATH");
appendStringInfo(str, buf);
@@ -1142,7 +1142,7 @@ _outMergePath(StringInfo str, MergePath * node)
static void
_outHashPath(StringInfo str, HashPath * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "HASHPATH");
appendStringInfo(str, buf);
@@ -1198,7 +1198,7 @@ _outHashPath(StringInfo str, HashPath * node)
static void
_outOrderKey(StringInfo str, OrderKey * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "ORDERKEY");
appendStringInfo(str, buf);
@@ -1215,7 +1215,7 @@ _outOrderKey(StringInfo str, OrderKey * node)
static void
_outJoinKey(StringInfo str, JoinKey * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "JOINKEY");
appendStringInfo(str, buf);
@@ -1236,7 +1236,7 @@ _outJoinKey(StringInfo str, JoinKey * node)
static void
_outMergeOrder(StringInfo str, MergeOrder * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "MERGEORDER");
appendStringInfo(str, buf);
@@ -1260,7 +1260,7 @@ _outMergeOrder(StringInfo str, MergeOrder * node)
static void
_outCInfo(StringInfo str, CInfo * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "CINFO");
appendStringInfo(str, buf);
@@ -1293,7 +1293,7 @@ _outCInfo(StringInfo str, CInfo * node)
static void
_outJoinMethod(StringInfo str, JoinMethod * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "JOINMETHOD");
appendStringInfo(str, buf);
@@ -1315,7 +1315,7 @@ _outJoinMethod(StringInfo str, JoinMethod * node)
static void
_outHInfo(StringInfo str, HInfo * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "HASHINFO");
appendStringInfo(str, buf);
@@ -1341,7 +1341,7 @@ _outHInfo(StringInfo str, HInfo * node)
static void
_outJInfo(StringInfo str, JInfo * node)
{
- char buf[500];
+ char buf[500];
sprintf(buf, "JINFO");
appendStringInfo(str, buf);
@@ -1369,12 +1369,12 @@ _outJInfo(StringInfo str, JInfo * node)
static void
_outDatum(StringInfo str, Datum value, Oid type)
{
- char buf[500];
- Size length,
- typeLength;
- bool byValue;
- int i;
- char *s;
+ char buf[500];
+ Size length,
+ typeLength;
+ bool byValue;
+ int i;
+ char *s;
/*
* find some information about the type and the "real" length of the
@@ -1442,7 +1442,7 @@ _outIter(StringInfo str, Iter * node)
static void
_outStream(StringInfo str, Stream * node)
{
- char buf[500];
+ char buf[500];
appendStringInfo(str, "STREAM");
@@ -1474,24 +1474,24 @@ _outStream(StringInfo str, Stream * node)
static void
_outValue(StringInfo str, Value * value)
{
- char buf[500];
+ char buf[500];
switch (value->type)
{
- case T_String:
- sprintf(buf, "\"%s\"", value->val.str);
- appendStringInfo(str, buf);
- break;
- case T_Integer:
- sprintf(buf, "%ld", value->val.ival);
- appendStringInfo(str, buf);
- break;
- case T_Float:
- sprintf(buf, "%f", value->val.dval);
- appendStringInfo(str, buf);
- break;
- default:
- break;
+ case T_String:
+ sprintf(buf, "\"%s\"", value->val.str);
+ appendStringInfo(str, buf);
+ break;
+ case T_Integer:
+ sprintf(buf, "%ld", value->val.ival);
+ appendStringInfo(str, buf);
+ break;
+ case T_Float:
+ sprintf(buf, "%f", value->val.dval);
+ appendStringInfo(str, buf);
+ break;
+ default:
+ break;
}
return;
}
@@ -1511,7 +1511,7 @@ _outNode(StringInfo str, void *obj)
if (nodeTag(obj) == T_List)
{
- List *l;
+ List *l;
appendStringInfo(str, "(");
foreach(l, (List *) obj)
@@ -1527,159 +1527,159 @@ _outNode(StringInfo str, void *obj)
appendStringInfo(str, "{");
switch (nodeTag(obj))
{
- case T_Query:
- _outQuery(str, obj);
- break;
- case T_Plan:
- _outPlan(str, obj);
- break;
- case T_Result:
- _outResult(str, obj);
- break;
- case T_Existential:
- _outExistential(str, obj);
- break;
- case T_Append:
- _outAppend(str, obj);
- break;
- case T_Join:
- _outJoin(str, obj);
- break;
- case T_NestLoop:
- _outNestLoop(str, obj);
- break;
- case T_MergeJoin:
- _outMergeJoin(str, obj);
- break;
- case T_HashJoin:
- _outHashJoin(str, obj);
- break;
- case T_Scan:
- _outScan(str, obj);
- break;
- case T_SeqScan:
- _outSeqScan(str, obj);
- break;
- case T_IndexScan:
- _outIndexScan(str, obj);
- break;
- case T_Temp:
- _outTemp(str, obj);
- break;
- case T_Sort:
- _outSort(str, obj);
- break;
- case T_Agg:
- _outAgg(str, obj);
- break;
- case T_Group:
- _outGroup(str, obj);
- break;
- case T_Unique:
- _outUnique(str, obj);
- break;
- case T_Hash:
- _outHash(str, obj);
- break;
- case T_Tee:
- _outTee(str, obj);
- break;
- case T_Resdom:
- _outResdom(str, obj);
- break;
- case T_Fjoin:
- _outFjoin(str, obj);
- break;
- case T_Expr:
- _outExpr(str, obj);
- break;
- case T_Var:
- _outVar(str, obj);
- break;
- case T_Const:
- _outConst(str, obj);
- break;
- case T_Aggreg:
- _outAggreg(str, obj);
- break;
- case T_Array:
- _outArray(str, obj);
- break;
- case T_ArrayRef:
- _outArrayRef(str, obj);
- break;
- case T_Func:
- _outFunc(str, obj);
- break;
- case T_Oper:
- _outOper(str, obj);
- break;
- case T_Param:
- _outParam(str, obj);
- break;
- case T_EState:
- _outEState(str, obj);
- break;
- case T_Rel:
- _outRel(str, obj);
- break;
- case T_TargetEntry:
- _outTargetEntry(str, obj);
- break;
- case T_RangeTblEntry:
- _outRangeTblEntry(str, obj);
- break;
- case T_Path:
- _outPath(str, obj);
- break;
- case T_IndexPath:
- _outIndexPath(str, obj);
- break;
- case T_JoinPath:
- _outJoinPath(str, obj);
- break;
- case T_MergePath:
- _outMergePath(str, obj);
- break;
- case T_HashPath:
- _outHashPath(str, obj);
- break;
- case T_OrderKey:
- _outOrderKey(str, obj);
- break;
- case T_JoinKey:
- _outJoinKey(str, obj);
- break;
- case T_MergeOrder:
- _outMergeOrder(str, obj);
- break;
- case T_CInfo:
- _outCInfo(str, obj);
- break;
- case T_JoinMethod:
- _outJoinMethod(str, obj);
- break;
- case T_HInfo:
- _outHInfo(str, obj);
- break;
- case T_JInfo:
- _outJInfo(str, obj);
- break;
- case T_Iter:
- _outIter(str, obj);
- break;
- case T_Stream:
- _outStream(str, obj);
- break;
- case T_Integer:
- case T_String:
- case T_Float:
- _outValue(str, obj);
- break;
- default:
- elog(NOTICE, "_outNode: don't know how to print type %d",
- nodeTag(obj));
- break;
+ case T_Query:
+ _outQuery(str, obj);
+ break;
+ case T_Plan:
+ _outPlan(str, obj);
+ break;
+ case T_Result:
+ _outResult(str, obj);
+ break;
+ case T_Existential:
+ _outExistential(str, obj);
+ break;
+ case T_Append:
+ _outAppend(str, obj);
+ break;
+ case T_Join:
+ _outJoin(str, obj);
+ break;
+ case T_NestLoop:
+ _outNestLoop(str, obj);
+ break;
+ case T_MergeJoin:
+ _outMergeJoin(str, obj);
+ break;
+ case T_HashJoin:
+ _outHashJoin(str, obj);
+ break;
+ case T_Scan:
+ _outScan(str, obj);
+ break;
+ case T_SeqScan:
+ _outSeqScan(str, obj);
+ break;
+ case T_IndexScan:
+ _outIndexScan(str, obj);
+ break;
+ case T_Temp:
+ _outTemp(str, obj);
+ break;
+ case T_Sort:
+ _outSort(str, obj);
+ break;
+ case T_Agg:
+ _outAgg(str, obj);
+ break;
+ case T_Group:
+ _outGroup(str, obj);
+ break;
+ case T_Unique:
+ _outUnique(str, obj);
+ break;
+ case T_Hash:
+ _outHash(str, obj);
+ break;
+ case T_Tee:
+ _outTee(str, obj);
+ break;
+ case T_Resdom:
+ _outResdom(str, obj);
+ break;
+ case T_Fjoin:
+ _outFjoin(str, obj);
+ break;
+ case T_Expr:
+ _outExpr(str, obj);
+ break;
+ case T_Var:
+ _outVar(str, obj);
+ break;
+ case T_Const:
+ _outConst(str, obj);
+ break;
+ case T_Aggreg:
+ _outAggreg(str, obj);
+ break;
+ case T_Array:
+ _outArray(str, obj);
+ break;
+ case T_ArrayRef:
+ _outArrayRef(str, obj);
+ break;
+ case T_Func:
+ _outFunc(str, obj);
+ break;
+ case T_Oper:
+ _outOper(str, obj);
+ break;
+ case T_Param:
+ _outParam(str, obj);
+ break;
+ case T_EState:
+ _outEState(str, obj);
+ break;
+ case T_Rel:
+ _outRel(str, obj);
+ break;
+ case T_TargetEntry:
+ _outTargetEntry(str, obj);
+ break;
+ case T_RangeTblEntry:
+ _outRangeTblEntry(str, obj);
+ break;
+ case T_Path:
+ _outPath(str, obj);
+ break;
+ case T_IndexPath:
+ _outIndexPath(str, obj);
+ break;
+ case T_JoinPath:
+ _outJoinPath(str, obj);
+ break;
+ case T_MergePath:
+ _outMergePath(str, obj);
+ break;
+ case T_HashPath:
+ _outHashPath(str, obj);
+ break;
+ case T_OrderKey:
+ _outOrderKey(str, obj);
+ break;
+ case T_JoinKey:
+ _outJoinKey(str, obj);
+ break;
+ case T_MergeOrder:
+ _outMergeOrder(str, obj);
+ break;
+ case T_CInfo:
+ _outCInfo(str, obj);
+ break;
+ case T_JoinMethod:
+ _outJoinMethod(str, obj);
+ break;
+ case T_HInfo:
+ _outHInfo(str, obj);
+ break;
+ case T_JInfo:
+ _outJInfo(str, obj);
+ break;
+ case T_Iter:
+ _outIter(str, obj);
+ break;
+ case T_Stream:
+ _outStream(str, obj);
+ break;
+ case T_Integer:
+ case T_String:
+ case T_Float:
+ _outValue(str, obj);
+ break;
+ default:
+ elog(NOTICE, "_outNode: don't know how to print type %d",
+ nodeTag(obj));
+ break;
}
appendStringInfo(str, "}");
}
@@ -1690,11 +1690,11 @@ _outNode(StringInfo str, void *obj)
* nodeToString -
* returns the ascii representation of the Node
*/
-char *
+char *
nodeToString(void *obj)
{
- StringInfo str;
- char *s;
+ StringInfo str;
+ char *s;
if (obj == NULL)
return "";
diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c
index 9fb61ed3ea..dfe9d56345 100644
--- a/src/backend/nodes/print.c
+++ b/src/backend/nodes/print.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.7 1997/09/07 04:42:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.8 1997/09/08 02:23:42 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -33,7 +33,7 @@
#include "nodes/plannodes.h"
#include "optimizer/clauses.h"
-static char *plannode_type(Plan * p);
+static char *plannode_type(Plan * p);
/*
* print--
@@ -42,7 +42,7 @@ static char *plannode_type(Plan * p);
void
print(void *obj)
{
- char *s;
+ char *s;
s = nodeToString(obj);
printf("%s\n", s);
@@ -56,11 +56,11 @@ print(void *obj)
void
pprint(void *obj)
{
- char *s;
- int i;
- char line[80];
- int indentLev;
- int j;
+ char *s;
+ int i;
+ char line[80];
+ int indentLev;
+ int j;
s = nodeToString(obj);
@@ -77,44 +77,44 @@ pprint(void *obj)
line[j] = s[i];
switch (line[j])
{
- case '}':
- if (j != indentLev * 3)
- {
- line[j] = '\0';
- printf("%s\n", line);
- line[indentLev * 3] = '\0';
- printf("%s}\n", line);
- }
- else
- {
- line[j] = '\0';
- printf("%s}\n", line);
- }
- indentLev--;
- j = indentLev * 3 - 1; /* print the line before : and
- * resets */
- break;
- case ')':
- line[j + 1] = '\0';
- printf("%s\n", line);
- j = indentLev * 3 - 1;
- break;
- case '{':
- indentLev++;
- /* !!! FALLS THROUGH */
- case ':':
- if (j != 0)
- {
- line[j] = '\0';
+ case '}':
+ if (j != indentLev * 3)
+ {
+ line[j] = '\0';
+ printf("%s\n", line);
+ line[indentLev * 3] = '\0';
+ printf("%s}\n", line);
+ }
+ else
+ {
+ line[j] = '\0';
+ printf("%s}\n", line);
+ }
+ indentLev--;
+ j = indentLev * 3 - 1; /* print the line before :
+ * and resets */
+ break;
+ case ')':
+ line[j + 1] = '\0';
printf("%s\n", line);
- /* print the line before : and resets */
- for (j = 0; j < indentLev * 3; j++)
+ j = indentLev * 3 - 1;
+ break;
+ case '{':
+ indentLev++;
+ /* !!! FALLS THROUGH */
+ case ':':
+ if (j != 0)
{
- line[j] = ' ';
+ line[j] = '\0';
+ printf("%s\n", line);
+ /* print the line before : and resets */
+ for (j = 0; j < indentLev * 3; j++)
+ {
+ line[j] = ' ';
+ }
}
- }
- line[j] = s[i];
- break;
+ line[j] = s[i];
+ break;
}
}
line[j] = '\0';
@@ -137,14 +137,14 @@ pprint(void *obj)
void
print_rt(List * rtable)
{
- List *l;
- int i = 1;
+ List *l;
+ int i = 1;
printf("resno\trelname(refname)\trelid\tinFromCl\n");
printf("-----\t----------------\t-----\t--------\n");
foreach(l, rtable)
{
- RangeTblEntry *rte = lfirst(l);
+ RangeTblEntry *rte = lfirst(l);
printf("%d\t%s(%s)\t%d\t%d\t%s\n",
i, rte->relname, rte->refname, rte->relid,
@@ -170,44 +170,44 @@ print_expr(Node * expr, List * rtable)
if (IsA(expr, Var))
{
- Var *var = (Var *) expr;
- RangeTblEntry *rt;
- char *relname,
- *attname;
+ Var *var = (Var *) expr;
+ RangeTblEntry *rt;
+ char *relname,
+ *attname;
switch (var->varno)
{
- case INNER:
- relname = "INNER";
- attname = "?";
- break;
- case OUTER:
- relname = "OUTER";
- attname = "?";
- break;
- default:
- {
- Relation r;
-
- rt = rt_fetch(var->varno, rtable);
- relname = rt->relname;
- r = heap_openr(relname);
- if (rt->refname)
- relname = rt->refname; /* table renamed */
- attname = getAttrName(r, var->varattno);
- heap_close(r);
- }
- break;
+ case INNER:
+ relname = "INNER";
+ attname = "?";
+ break;
+ case OUTER:
+ relname = "OUTER";
+ attname = "?";
+ break;
+ default:
+ {
+ Relation r;
+
+ rt = rt_fetch(var->varno, rtable);
+ relname = rt->relname;
+ r = heap_openr(relname);
+ if (rt->refname)
+ relname = rt->refname; /* table renamed */
+ attname = getAttrName(r, var->varattno);
+ heap_close(r);
+ }
+ break;
}
printf("%s.%s", relname, attname);
}
else if (IsA(expr, Expr))
{
- Expr *e = (Expr *) expr;
+ Expr *e = (Expr *) expr;
if (is_opclause(expr))
{
- char *opname;
+ char *opname;
print_expr((Node *) get_leftop(e), rtable);
opname = get_opname(((Oper *) e->oper)->opno);
@@ -232,12 +232,12 @@ print_expr(Node * expr, List * rtable)
void
print_keys(List * keys, List * rtable)
{
- List *k;
+ List *k;
printf("(");
foreach(k, keys)
{
- Node *var = lfirst((List *) lfirst(k));
+ Node *var = lfirst((List *) lfirst(k));
print_expr(var, rtable);
if (lnext(k))
@@ -253,12 +253,12 @@ print_keys(List * keys, List * rtable)
void
print_tl(List * tlist, List * rtable)
{
- List *tl;
+ List *tl;
printf("(\n");
foreach(tl, tlist)
{
- TargetEntry *tle = lfirst(tl);
+ TargetEntry *tle = lfirst(tl);
printf("\t%d %s\t", tle->resdom->resno, tle->resdom->resname);
if (tle->resdom->reskey != 0)
@@ -296,74 +296,74 @@ print_slot(TupleTableSlot * slot)
debugtup(slot->val, slot->ttc_tupleDescriptor);
}
-static char *
+static char *
plannode_type(Plan * p)
{
switch (nodeTag(p))
{
- case T_Plan:
- return "PLAN";
- break;
- case T_Existential:
- return "EXISTENTIAL";
- break;
- case T_Result:
- return "RESULT";
- break;
- case T_Append:
- return "APPEND";
- break;
- case T_Scan:
- return "SCAN";
- break;
- case T_SeqScan:
- return "SEQSCAN";
- break;
- case T_IndexScan:
- return "INDEXSCAN";
- break;
- case T_Join:
- return "JOIN";
- break;
- case T_NestLoop:
- return "NESTLOOP";
- break;
- case T_MergeJoin:
- return "MERGEJOIN";
- break;
- case T_HashJoin:
- return "HASHJOIN";
- break;
- case T_Temp:
- return "TEMP";
- break;
- case T_Material:
- return "MATERIAL";
- break;
- case T_Sort:
- return "SORT";
- break;
- case T_Agg:
- return "AGG";
- break;
- case T_Unique:
- return "UNIQUE";
- break;
- case T_Hash:
- return "HASH";
- break;
- case T_Tee:
- return "TEE";
- break;
- case T_Choose:
- return "CHOOSE";
- break;
- case T_Group:
- return "GROUP";
- break;
- default:
- return "UNKNOWN";
- break;
+ case T_Plan:
+ return "PLAN";
+ break;
+ case T_Existential:
+ return "EXISTENTIAL";
+ break;
+ case T_Result:
+ return "RESULT";
+ break;
+ case T_Append:
+ return "APPEND";
+ break;
+ case T_Scan:
+ return "SCAN";
+ break;
+ case T_SeqScan:
+ return "SEQSCAN";
+ break;
+ case T_IndexScan:
+ return "INDEXSCAN";
+ break;
+ case T_Join:
+ return "JOIN";
+ break;
+ case T_NestLoop:
+ return "NESTLOOP";
+ break;
+ case T_MergeJoin:
+ return "MERGEJOIN";
+ break;
+ case T_HashJoin:
+ return "HASHJOIN";
+ break;
+ case T_Temp:
+ return "TEMP";
+ break;
+ case T_Material:
+ return "MATERIAL";
+ break;
+ case T_Sort:
+ return "SORT";
+ break;
+ case T_Agg:
+ return "AGG";
+ break;
+ case T_Unique:
+ return "UNIQUE";
+ break;
+ case T_Hash:
+ return "HASH";
+ break;
+ case T_Tee:
+ return "TEE";
+ break;
+ case T_Choose:
+ return "CHOOSE";
+ break;
+ case T_Group:
+ return "GROUP";
+ break;
+ default:
+ return "UNKNOWN";
+ break;
}
}
@@ -377,8 +377,8 @@ plannode_type(Plan * p)
void
print_plan_recursive(Plan * p, Query * parsetree, int indentLevel, char *label)
{
- int i;
- char extraInfo[100];
+ int i;
+ char extraInfo[100];
if (!p)
return;
@@ -388,7 +388,7 @@ print_plan_recursive(Plan * p, Query * parsetree, int indentLevel, char *label)
p->cost, p->plan_size, p->plan_width);
if (IsA(p, Scan) || IsA(p, SeqScan))
{
- RangeTblEntry *rte;
+ RangeTblEntry *rte;
rte = rt_fetch(((Scan *) p)->scanrelid, parsetree->rtable);
strNcpy(extraInfo, rte->relname, NAMEDATALEN - 1);
diff --git a/src/backend/nodes/read.c b/src/backend/nodes/read.c
index f0baa4f14d..60b45822eb 100644
--- a/src/backend/nodes/read.c
+++ b/src/backend/nodes/read.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.4 1997/09/07 04:42:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/read.c,v 1.5 1997/09/08 02:23:43 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -28,10 +28,10 @@
* stringToNode -
* returns a Node with a given legal ascii representation
*/
-void *
+void *
stringToNode(char *str)
{
- void *retval;
+ void *retval;
lsptok(str, NULL); /* set the string used in lsptok */
retval = nodeRead(true); /* start reading */
@@ -61,10 +61,10 @@ stringToNode(char *str)
*
* Assumption: the ascii representation is legal
*/
-static NodeTag
+static NodeTag
nodeTokenType(char *token, int length)
{
- NodeTag retval = 0;
+ NodeTag retval = 0;
/*
* Check if the token is a number (decimal or integer, positive or
@@ -116,11 +116,11 @@ nodeTokenType(char *token, int length)
* returning a token by calling lsptok with length == NULL.
*
*/
-char *
+char *
lsptok(char *string, int *length)
{
- static char *local_str;
- char *ret_string;
+ static char *local_str;
+ char *ret_string;
if (string != NULL)
{
@@ -174,16 +174,16 @@ lsptok(char *string, int *length)
* Secrets: He assumes that lsptok already has the string (see below).
* Any callers should set read_car_only to true.
*/
-void *
+void *
nodeRead(bool read_car_only)
{
- char *token;
- NodeTag type;
- Node *this_value = NULL,
- *return_value = NULL;
- int tok_len;
- char tmp;
- bool make_dotted_pair_cell = false;
+ char *token;
+ NodeTag type;
+ Node *this_value = NULL,
+ *return_value = NULL;
+ int tok_len;
+ char tmp;
+ bool make_dotted_pair_cell = false;
token = lsptok(NULL, &tok_len);
@@ -194,93 +194,93 @@ nodeRead(bool read_car_only)
switch (type)
{
- case PLAN_SYM:
- this_value = parsePlanString();
- token = lsptok(NULL, &tok_len);
- if (token[0] != '}')
- return (NULL);
+ case PLAN_SYM:
+ this_value = parsePlanString();
+ token = lsptok(NULL, &tok_len);
+ if (token[0] != '}')
+ return (NULL);
- if (!read_car_only)
- make_dotted_pair_cell = true;
- else
- make_dotted_pair_cell = false;
- break;
- case LEFT_PAREN:
- if (!read_car_only)
- {
- List *l = makeNode(List);
+ if (!read_car_only)
+ make_dotted_pair_cell = true;
+ else
+ make_dotted_pair_cell = false;
+ break;
+ case LEFT_PAREN:
+ if (!read_car_only)
+ {
+ List *l = makeNode(List);
- lfirst(l) = nodeRead(false);
- lnext(l) = nodeRead(false);
- this_value = (Node *) l;
- }
- else
- {
- this_value = nodeRead(false);
- }
- break;
- case RIGHT_PAREN:
- this_value = NULL;
- break;
- case AT_SYMBOL:
- break;
- case ATOM_TOKEN:
- if (!strncmp(token, "nil", 3))
- {
+ lfirst(l) = nodeRead(false);
+ lnext(l) = nodeRead(false);
+ this_value = (Node *) l;
+ }
+ else
+ {
+ this_value = nodeRead(false);
+ }
+ break;
+ case RIGHT_PAREN:
this_value = NULL;
-
- /*
- * It might be "nil" but it is an atom!
- */
- if (read_car_only)
+ break;
+ case AT_SYMBOL:
+ break;
+ case ATOM_TOKEN:
+ if (!strncmp(token, "nil", 3))
{
- make_dotted_pair_cell = false;
+ this_value = NULL;
+
+ /*
+ * It might be "nil" but it is an atom!
+ */
+ if (read_car_only)
+ {
+ make_dotted_pair_cell = false;
+ }
+ else
+ {
+ make_dotted_pair_cell = true;
+ }
}
else
{
+ tmp = token[tok_len];
+ token[tok_len] = '\0';
+ this_value = (Node *) pstrdup(token); /* !attention! not a
+ * Node. use with
+ * caution */
+ token[tok_len] = tmp;
make_dotted_pair_cell = true;
}
- }
- else
- {
+ break;
+ case T_Float:
tmp = token[tok_len];
token[tok_len] = '\0';
- this_value = (Node *) pstrdup(token); /* !attention! not a
- * Node. use with
- * caution */
+ this_value = (Node *) makeFloat(atof(token));
token[tok_len] = tmp;
make_dotted_pair_cell = true;
- }
- break;
- case T_Float:
- tmp = token[tok_len];
- token[tok_len] = '\0';
- this_value = (Node *) makeFloat(atof(token));
- token[tok_len] = tmp;
- make_dotted_pair_cell = true;
- break;
- case T_Integer:
- tmp = token[tok_len];
- token[tok_len] = '\0';
- this_value = (Node *) makeInteger(atoi(token));
- token[tok_len] = tmp;
- make_dotted_pair_cell = true;
- break;
- case T_String:
- tmp = token[tok_len - 1];
- token[tok_len - 1] = '\0';
- token++;
- this_value = (Node *) makeString(token); /* !! not strdup'd */
- token[tok_len - 2] = tmp;
- make_dotted_pair_cell = true;
- break;
- default:
- elog(WARN, "nodeRead: Bad type %d", type);
- break;
+ break;
+ case T_Integer:
+ tmp = token[tok_len];
+ token[tok_len] = '\0';
+ this_value = (Node *) makeInteger(atoi(token));
+ token[tok_len] = tmp;
+ make_dotted_pair_cell = true;
+ break;
+ case T_String:
+ tmp = token[tok_len - 1];
+ token[tok_len - 1] = '\0';
+ token++;
+ this_value = (Node *) makeString(token); /* !! not strdup'd */
+ token[tok_len - 2] = tmp;
+ make_dotted_pair_cell = true;
+ break;
+ default:
+ elog(WARN, "nodeRead: Bad type %d", type);
+ break;
}
if (make_dotted_pair_cell)
{
- List *l = makeNode(List);
+ List *l = makeNode(List);
lfirst(l) = this_value;
if (!read_car_only)
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index f42d5d536e..eca6c480a2 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.7 1997/09/07 04:42:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.8 1997/09/08 02:23:45 momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -51,12 +51,12 @@
* ----------------
*/
-static Datum readDatum(Oid type);
+static Datum readDatum(Oid type);
-static List *
+static List *
toIntList(List * list)
{
- List *l;
+ List *l;
foreach(l, list)
{
@@ -70,12 +70,12 @@ toIntList(List * list)
* _readQuery
* ----------------
*/
-static Query *
+static Query *
_readQuery()
{
- Query *local_node;
- char *token;
- int length;
+ Query *local_node;
+ char *token;
+ int length;
local_node = makeNode(Query);
@@ -89,7 +89,7 @@ _readQuery()
local_node->utilityStmt = NULL;
else
{
- NotifyStmt *n = makeNode(NotifyStmt);
+ NotifyStmt *n = makeNode(NotifyStmt);
n->relname = palloc(length + 1);
strNcpy(n->relname, token, length);
@@ -130,8 +130,8 @@ _readQuery()
static void
_getPlan(Plan * node)
{
- char *token;
- int length;
+ char *token;
+ int length;
token = lsptok(NULL, &length); /* first token is :cost */
token = lsptok(NULL, &length); /* next is the actual cost */
@@ -181,10 +181,10 @@ _getPlan(Plan * node)
* _readPlan
* ----------------
*/
-static Plan *
+static Plan *
_readPlan()
{
- Plan *local_node;
+ Plan *local_node;
local_node = makeNode(Plan);
@@ -200,12 +200,12 @@ _readPlan()
* sizes of things.
* ----------------
*/
-static Result *
+static Result *
_readResult()
{
- Result *local_node;
- char *token;
- int length;
+ Result *local_node;
+ char *token;
+ int length;
local_node = makeNode(Result);
@@ -226,7 +226,7 @@ _readResult()
static Existential *
_readExistential()
{
- Existential *local_node;
+ Existential *local_node;
local_node = makeNode(Existential);
@@ -242,12 +242,12 @@ _readExistential()
* ----------------
*/
-static Append *
+static Append *
_readAppend()
{
- Append *local_node;
- char *token;
- int length;
+ Append *local_node;
+ char *token;
+ int length;
local_node = makeNode(Append);
@@ -285,10 +285,10 @@ _getJoin(Join * node)
* Join is a subclass of Plan
* ----------------
*/
-static Join *
+static Join *
_readJoin()
{
- Join *local_node;
+ Join *local_node;
local_node = makeNode(Join);
@@ -307,7 +307,7 @@ _readJoin()
static NestLoop *
_readNestLoop()
{
- NestLoop *local_node;
+ NestLoop *local_node;
local_node = makeNode(NestLoop);
@@ -325,9 +325,9 @@ _readNestLoop()
static MergeJoin *
_readMergeJoin()
{
- MergeJoin *local_node;
- char *token;
- int length;
+ MergeJoin *local_node;
+ char *token;
+ int length;
local_node = makeNode(MergeJoin);
@@ -351,9 +351,9 @@ _readMergeJoin()
static HashJoin *
_readHashJoin()
{
- HashJoin *local_node;
- char *token;
- int length;
+ HashJoin *local_node;
+ char *token;
+ int length;
local_node = makeNode(HashJoin);
@@ -398,8 +398,8 @@ _readHashJoin()
static void
_getScan(Scan * node)
{
- char *token;
- int length;
+ char *token;
+ int length;
_getPlan((Plan *) node);
@@ -414,10 +414,10 @@ _getScan(Scan * node)
* Scan is a subclass of Plan (Not Node, see above).
* ----------------
*/
-static Scan *
+static Scan *
_readScan()
{
- Scan *local_node;
+ Scan *local_node;
local_node = makeNode(Scan);
@@ -435,7 +435,7 @@ _readScan()
static SeqScan *
_readSeqScan()
{
- SeqScan *local_node;
+ SeqScan *local_node;
local_node = makeNode(SeqScan);
@@ -453,9 +453,9 @@ _readSeqScan()
static IndexScan *
_readIndexScan()
{
- IndexScan *local_node;
- char *token;
- int length;
+ IndexScan *local_node;
+ char *token;
+ int length;
local_node = makeNode(IndexScan);
@@ -477,12 +477,12 @@ _readIndexScan()
* Temp is a subclass of Plan
* ----------------
*/
-static Temp *
+static Temp *
_readTemp()
{
- Temp *local_node;
- char *token;
- int length;
+ Temp *local_node;
+ char *token;
+ int length;
local_node = makeNode(Temp);
@@ -505,12 +505,12 @@ _readTemp()
* Sort is a subclass of Temp
* ----------------
*/
-static Sort *
+static Sort *
_readSort()
{
- Sort *local_node;
- char *token;
- int length;
+ Sort *local_node;
+ char *token;
+ int length;
local_node = makeNode(Sort);
@@ -527,12 +527,12 @@ _readSort()
return (local_node);
}
-static Agg *
+static Agg *
_readAgg()
{
- Agg *local_node;
- char *token;
- int length;
+ Agg *local_node;
+ char *token;
+ int length;
local_node = makeNode(Agg);
_getPlan((Plan *) local_node);
@@ -549,12 +549,12 @@ _readAgg()
*
* For some reason, unique is a subclass of Temp.
*/
-static Unique *
+static Unique *
_readUnique()
{
- Unique *local_node;
- char *token;
- int length;
+ Unique *local_node;
+ char *token;
+ int length;
local_node = makeNode(Unique);
@@ -577,12 +577,12 @@ _readUnique()
* Hash is a subclass of Temp
* ----------------
*/
-static Hash *
+static Hash *
_readHash()
{
- Hash *local_node;
- char *token;
- int length;
+ Hash *local_node;
+ char *token;
+ int length;
local_node = makeNode(Hash);
@@ -616,12 +616,12 @@ _readHash()
* Resdom is a subclass of Node
* ----------------
*/
-static Resdom *
+static Resdom *
_readResdom()
{
- Resdom *local_node;
- char *token;
- int length;
+ Resdom *local_node;
+ char *token;
+ int length;
local_node = makeNode(Resdom);
@@ -680,12 +680,12 @@ _readResdom()
* Expr is a subclass of Node
* ----------------
*/
-static Expr *
+static Expr *
_readExpr()
{
- Expr *local_node;
- char *token;
- int length;
+ Expr *local_node;
+ char *token;
+ int length;
local_node = makeNode(Expr);
@@ -731,12 +731,12 @@ _readExpr()
* Var is a subclass of Expr
* ----------------
*/
-static Var *
+static Var *
_readVar()
{
- Var *local_node;
- char *token;
- int length;
+ Var *local_node;
+ char *token;
+ int length;
local_node = makeNode(Var);
@@ -769,12 +769,12 @@ _readVar()
* Array is a subclass of Expr
* ----------------
*/
-static Array *
+static Array *
_readArray()
{
- Array *local_node;
- char *token;
- int length;
+ Array *local_node;
+ char *token;
+ int length;
local_node = makeNode(Array);
@@ -814,9 +814,9 @@ _readArray()
static ArrayRef *
_readArrayRef()
{
- ArrayRef *local_node;
- char *token;
- int length;
+ ArrayRef *local_node;
+ char *token;
+ int length;
local_node = makeNode(ArrayRef);
@@ -857,12 +857,12 @@ _readArrayRef()
* Const is a subclass of Expr
* ----------------
*/
-static Const *
+static Const *
_readConst()
{
- Const *local_node;
- char *token;
- int length;
+ Const *local_node;
+ char *token;
+ int length;
local_node = makeNode(Const);
@@ -924,12 +924,12 @@ _readConst()
* Func is a subclass of Expr
* ----------------
*/
-static Func *
+static Func *
_readFunc()
{
- Func *local_node;
- char *token;
- int length;
+ Func *local_node;
+ char *token;
+ int length;
local_node = makeNode(Func);
@@ -978,12 +978,12 @@ _readFunc()
* Oper is a subclass of Expr
* ----------------
*/
-static Oper *
+static Oper *
_readOper()
{
- Oper *local_node;
- char *token;
- int length;
+ Oper *local_node;
+ char *token;
+ int length;
local_node = makeNode(Oper);
@@ -1014,12 +1014,12 @@ _readOper()
* Param is a subclass of Expr
* ----------------
*/
-static Param *
+static Param *
_readParam()
{
- Param *local_node;
- char *token;
- int length;
+ Param *local_node;
+ char *token;
+ int length;
local_node = makeNode(Param);
@@ -1055,12 +1055,12 @@ _readParam()
* Aggreg is a subclass of Node
* ----------------
*/
-static Aggreg *
+static Aggreg *
_readAggreg()
{
- Aggreg *local_node;
- char *token;
- int length;
+ Aggreg *local_node;
+ char *token;
+ int length;
local_node = makeNode(Aggreg);
@@ -1097,12 +1097,12 @@ _readAggreg()
* EState is a subclass of Node.
* ----------------
*/
-static EState *
+static EState *
_readEState()
{
- EState *local_node;
- char *token;
- int length;
+ EState *local_node;
+ char *token;
+ int length;
local_node = makeNode(EState);
@@ -1132,12 +1132,12 @@ _readEState()
* _readRel
* ----------------
*/
-static Rel *
+static Rel *
_readRel()
{
- Rel *local_node;
- char *token;
- int length;
+ Rel *local_node;
+ char *token;
+ int length;
local_node = makeNode(Rel);
@@ -1217,9 +1217,9 @@ _readRel()
static TargetEntry *
_readTargetEntry()
{
- TargetEntry *local_node;
- char *token;
- int length;
+ TargetEntry *local_node;
+ char *token;
+ int length;
local_node = makeNode(TargetEntry);
@@ -1239,9 +1239,9 @@ _readTargetEntry()
static RangeTblEntry *
_readRangeTblEntry()
{
- RangeTblEntry *local_node;
- char *token;
- int length;
+ RangeTblEntry *local_node;
+ char *token;
+ int length;
local_node = makeNode(RangeTblEntry);
@@ -1303,12 +1303,12 @@ _readRangeTblEntry()
* Path is a subclass of Node.
* ----------------
*/
-static Path *
+static Path *
_readPath()
{
- Path *local_node;
- char *token;
- int length;
+ Path *local_node;
+ char *token;
+ int length;
local_node = makeNode(Path);
@@ -1341,9 +1341,9 @@ _readPath()
static IndexPath *
_readIndexPath()
{
- IndexPath *local_node;
- char *token;
- int length;
+ IndexPath *local_node;
+ char *token;
+ int length;
local_node = makeNode(IndexPath);
@@ -1382,9 +1382,9 @@ _readIndexPath()
static JoinPath *
_readJoinPath()
{
- JoinPath *local_node;
- char *token;
- int length;
+ JoinPath *local_node;
+ char *token;
+ int length;
local_node = makeNode(JoinPath);
@@ -1449,9 +1449,9 @@ _readJoinPath()
static MergePath *
_readMergePath()
{
- MergePath *local_node;
- char *token;
- int length;
+ MergePath *local_node;
+ char *token;
+ int length;
local_node = makeNode(MergePath);
@@ -1526,9 +1526,9 @@ _readMergePath()
static HashPath *
_readHashPath()
{
- HashPath *local_node;
- char *token;
- int length;
+ HashPath *local_node;
+ char *token;
+ int length;
local_node = makeNode(HashPath);
@@ -1603,9 +1603,9 @@ _readHashPath()
static OrderKey *
_readOrderKey()
{
- OrderKey *local_node;
- char *token;
- int length;
+ OrderKey *local_node;
+ char *token;
+ int length;
local_node = makeNode(OrderKey);
@@ -1631,9 +1631,9 @@ _readOrderKey()
static JoinKey *
_readJoinKey()
{
- JoinKey *local_node;
- char *token;
- int length;
+ JoinKey *local_node;
+ char *token;
+ int length;
local_node = makeNode(JoinKey);
@@ -1655,9 +1655,9 @@ _readJoinKey()
static MergeOrder *
_readMergeOrder()
{
- MergeOrder *local_node;
- char *token;
- int length;
+ MergeOrder *local_node;
+ char *token;
+ int length;
local_node = makeNode(MergeOrder);
token = lsptok(NULL, &length); /* get :join_operator */
@@ -1694,12 +1694,12 @@ _readMergeOrder()
* CInfo is a subclass of Node.
* ----------------
*/
-static CInfo *
+static CInfo *
_readCInfo()
{
- CInfo *local_node;
- char *token;
- int length;
+ CInfo *local_node;
+ char *token;
+ int length;
local_node = makeNode(CInfo);
@@ -1746,9 +1746,9 @@ _readCInfo()
static JoinMethod *
_readJoinMethod()
{
- JoinMethod *local_node;
- char *token;
- int length;
+ JoinMethod *local_node;
+ char *token;
+ int length;
local_node = makeNode(JoinMethod);
@@ -1767,12 +1767,12 @@ _readJoinMethod()
* HInfo is a subclass of JoinMethod.
* ----------------
*/
-static HInfo *
+static HInfo *
_readHInfo()
{
- HInfo *local_node;
- char *token;
- int length;
+ HInfo *local_node;
+ char *token;
+ int length;
local_node = makeNode(HInfo);
@@ -1796,12 +1796,12 @@ _readHInfo()
* JInfo is a subclass of Node.
* ----------------
*/
-static JInfo *
+static JInfo *
_readJInfo()
{
- JInfo *local_node;
- char *token;
- int length;
+ JInfo *local_node;
+ char *token;
+ int length;
local_node = makeNode(JInfo);
@@ -1842,12 +1842,12 @@ _readJInfo()
*
* ----------------
*/
-static Iter *
+static Iter *
_readIter()
{
- Iter *local_node;
- char *token;
- int length;
+ Iter *local_node;
+ char *token;
+ int length;
local_node = makeNode(Iter);
@@ -1867,12 +1867,12 @@ _readIter()
* The string passed to parsePlanString must be null-terminated.
* ----------------
*/
-Node *
+Node *
parsePlanString(void)
{
- char *token;
- int length;
- void *return_value = NULL;
+ char *token;
+ int length;
+ void *return_value = NULL;
token = lsptok(NULL, &length);
@@ -2070,16 +2070,16 @@ parsePlanString(void)
* create the appropriate Datum
* ----------------
*/
-static Datum
+static Datum
readDatum(Oid type)
{
- int length;
- int tokenLength;
- char *token;
- bool byValue;
- Datum res;
- char *s;
- int i;
+ int length;
+ int tokenLength;
+ char *token;
+ bool byValue;
+ Datum res;
+ char *s;
+ int i;
byValue = get_typbyval(type);
diff --git a/src/backend/optimizer/geqo/geqo_copy.c b/src/backend/optimizer/geqo/geqo_copy.c
index 4c35f99f9f..3a61f5d315 100644
--- a/src/backend/optimizer/geqo/geqo_copy.c
+++ b/src/backend/optimizer/geqo/geqo_copy.c
@@ -4,7 +4,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_copy.c,v 1.2 1997/09/07 04:43:01 momjian Exp $
+ * $Id: geqo_copy.c,v 1.3 1997/09/08 02:23:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,7 +58,7 @@
void
geqo_copy(Chromosome * chromo1, Chromosome * chromo2, int string_length)
{
- int i;
+ int i;
for (i = 0; i < string_length; i++)
chromo1->string[i] = chromo2->string[i];
diff --git a/src/backend/optimizer/geqo/geqo_cx.c b/src/backend/optimizer/geqo/geqo_cx.c
index dfde1bdc53..37f49584ca 100644
--- a/src/backend/optimizer/geqo/geqo_cx.c
+++ b/src/backend/optimizer/geqo/geqo_cx.c
@@ -6,7 +6,7 @@
* CX operator according to Oliver et al
* (Proc 2nd Int'l Conf on GA's)
*
-* $Id: geqo_cx.c,v 1.2 1997/09/07 04:43:02 momjian Exp $
+* $Id: geqo_cx.c,v 1.3 1997/09/08 02:23:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,11 +63,11 @@ int
cx(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table)
{
- int i,
- start_pos,
- curr_pos;
- int count = 0;
- int num_diffs = 0;
+ int i,
+ start_pos,
+ curr_pos;
+ int count = 0;
+ int num_diffs = 0;
/* initialize city table */
for (i = 1; i <= num_gene; i++)
diff --git a/src/backend/optimizer/geqo/geqo_erx.c b/src/backend/optimizer/geqo/geqo_erx.c
index 9d0f93efe8..05381cf4da 100644
--- a/src/backend/optimizer/geqo/geqo_erx.c
+++ b/src/backend/optimizer/geqo/geqo_erx.c
@@ -3,7 +3,7 @@
* geqo_erx.c--
* edge recombination crossover [ER]
*
-* $Id: geqo_erx.c,v 1.3 1997/09/07 04:43:04 momjian Exp $
+* $Id: geqo_erx.c,v 1.4 1997/09/08 02:23:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,11 +52,11 @@
#include "optimizer/geqo_random.h"
-static int gimme_edge(Gene gene1, Gene gene2, Edge * edge_table);
-static void remove_gene(Gene gene, Edge edge, Edge * edge_table);
-static Gene gimme_gene(Edge edge, Edge * edge_table);
+static int gimme_edge(Gene gene1, Gene gene2, Edge * edge_table);
+static void remove_gene(Gene gene, Edge edge, Edge * edge_table);
+static Gene gimme_gene(Edge edge, Edge * edge_table);
-static Gene edge_failure(Gene * gene, int index, Edge * edge_table, int num_gene);
+static Gene edge_failure(Gene * gene, int index, Edge * edge_table, int num_gene);
/* alloc_edge_table--
@@ -65,10 +65,10 @@ static Gene edge_failure(Gene * gene, int index, Edge * edge_table, int num_gen
*
*/
-Edge *
+Edge *
alloc_edge_table(int num_gene)
{
- Edge *edge_table;
+ Edge *edge_table;
/*
* palloc one extra location so that nodes numbered 1..n can be
@@ -107,10 +107,10 @@ free_edge_table(Edge * edge_table)
float
gimme_edge_table(Gene * tour1, Gene * tour2, int num_gene, Edge * edge_table)
{
- int i,
- index1,
- index2;
- int edge_total; /* total number of unique edges in two
+ int i,
+ index1,
+ index2;
+ int edge_total; /* total number of unique edges in two
* genes */
/* at first clear the edge table's old data */
@@ -167,10 +167,10 @@ gimme_edge_table(Gene * tour1, Gene * tour2, int num_gene, Edge * edge_table)
static int
gimme_edge(Gene gene1, Gene gene2, Edge * edge_table)
{
- int i;
- int edges;
- int city1 = (int) gene1;
- int city2 = (int) gene2;
+ int i;
+ int edges;
+ int city1 = (int) gene1;
+ int city2 = (int) gene2;
/* check whether edge city1->city2 already exists */
@@ -209,8 +209,8 @@ gimme_edge(Gene gene1, Gene gene2, Edge * edge_table)
int
gimme_tour(Edge * edge_table, Gene * new_gene, int num_gene)
{
- int i;
- int edge_failures = 0;
+ int i;
+ int edge_failures = 0;
new_gene[0] = (Gene) geqo_randint(num_gene, 1); /* choose int between 1
* and num_gene */
@@ -258,10 +258,10 @@ gimme_tour(Edge * edge_table, Gene * new_gene, int num_gene)
static void
remove_gene(Gene gene, Edge edge, Edge * edge_table)
{
- int i,
- j;
- int possess_edge;
- int genes_remaining;
+ int i,
+ j;
+ int possess_edge;
+ int genes_remaining;
/*
* do for every gene known to have an edge to input gene (i.e. in
@@ -297,14 +297,14 @@ remove_gene(Gene gene, Edge edge, Edge * edge_table)
* (i.e. edges which both genes possess)
*
*/
-static Gene
+static Gene
gimme_gene(Edge edge, Edge * edge_table)
{
- int i;
- Gene friend;
- int minimum_edges;
- int minimum_count = -1;
- int rand_decision;
+ int i;
+ Gene friend;
+ int minimum_edges;
+ int minimum_count = -1;
+ int rand_decision;
/*
* no point has edges to more than 4 other points thus, this contrived
@@ -388,14 +388,14 @@ gimme_gene(Edge edge, Edge * edge_table)
* routine for handling edge failure
*
*/
-static Gene
+static Gene
edge_failure(Gene * gene, int index, Edge * edge_table, int num_gene)
{
- int i;
- Gene fail_gene = gene[index];
- int remaining_edges = 0;
- int four_count = 0;
- int rand_decision;
+ int i;
+ Gene fail_gene = gene[index];
+ int remaining_edges = 0;
+ int four_count = 0;
+ int rand_decision;
/*
diff --git a/src/backend/optimizer/geqo/geqo_eval.c b/src/backend/optimizer/geqo/geqo_eval.c
index ba34d8f3e0..731b1c4fcd 100644
--- a/src/backend/optimizer/geqo/geqo_eval.c
+++ b/src/backend/optimizer/geqo/geqo_eval.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_eval.c,v 1.13 1997/09/07 04:43:06 momjian Exp $
+ * $Id: geqo_eval.c,v 1.14 1997/09/08 02:23:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,13 +50,13 @@
#include "optimizer/geqo_paths.h"
-static List *gimme_clause_joins(Query * root, Rel * outer_rel, Rel * inner_rel);
-static Rel *gimme_clauseless_join(Rel * outer_rel, Rel * inner_rel);
-static Rel *init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo);
-static List *new_join_tlist(List * tlist, List * other_relids, int first_resdomno);
-static List *new_joininfo_list(List * joininfo_list, List * join_relids);
-static void geqo_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel);
-static Rel *geqo_nth(int stop, List * rels);
+static List *gimme_clause_joins(Query * root, Rel * outer_rel, Rel * inner_rel);
+static Rel *gimme_clauseless_join(Rel * outer_rel, Rel * inner_rel);
+static Rel *init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo);
+static List *new_join_tlist(List * tlist, List * other_relids, int first_resdomno);
+static List *new_joininfo_list(List * joininfo_list, List * join_relids);
+static void geqo_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel);
+static Rel *geqo_nth(int stop, List * rels);
/*
* geqo_eval--
@@ -66,9 +66,9 @@ static Rel *geqo_nth(int stop, List * rels);
Cost
geqo_eval(Query * root, Gene * tour, int num_gene)
{
- Rel *joinrel;
- Cost fitness;
- List *temp;
+ Rel *joinrel;
+ Cost fitness;
+ List *temp;
/* remember root->join_relation_list_ ... */
@@ -98,14 +98,14 @@ geqo_eval(Query * root, Gene * tour, int num_gene)
*
* Returns a new join relation incorporating all joins in a left-sided tree.
*/
-Rel *
+Rel *
gimme_tree(Query * root, Gene * tour, int rel_count, int num_gene, Rel * outer_rel)
{
- Rel *inner_rel; /* current relation */
- int base_rel_index;
+ Rel *inner_rel; /* current relation */
+ int base_rel_index;
- List *new_rels = NIL;
- Rel *new_rel = NULL;
+ List *new_rels = NIL;
+ Rel *new_rel = NULL;
if (rel_count < num_gene)
{ /* tree not yet finished */
@@ -190,21 +190,21 @@ gimme_tree(Query * root, Gene * tour, int rel_count, int num_gene, Rel * outer_r
* Returns a list of new join relations.
*/
-static List *
+static List *
gimme_clause_joins(Query * root, Rel * outer_rel, Rel * inner_rel)
{
- List *join_list = NIL;
- List *i = NIL;
- List *joininfo_list = (List *) outer_rel->joininfo;
+ List *join_list = NIL;
+ List *i = NIL;
+ List *joininfo_list = (List *) outer_rel->joininfo;
foreach(i, joininfo_list)
{
- JInfo *joininfo = (JInfo *) lfirst(i);
- Rel *rel = NULL;
+ JInfo *joininfo = (JInfo *) lfirst(i);
+ Rel *rel = NULL;
if (!joininfo->inactive)
{
- List *other_rels = (List *) joininfo->otherrels;
+ List *other_rels = (List *) joininfo->otherrels;
if (other_rels != NIL)
{
@@ -243,7 +243,7 @@ gimme_clause_joins(Query * root, Rel * outer_rel, Rel * inner_rel)
* Returns a new join relation.
*/
-static Rel *
+static Rel *
gimme_clauseless_join(Rel * outer_rel, Rel * inner_rel)
{
return (init_join_rel(outer_rel, inner_rel, (JInfo *) NULL));
@@ -260,13 +260,13 @@ gimme_clauseless_join(Rel * outer_rel, Rel * inner_rel)
*
* Returns the new join relation node.
*/
-static Rel *
+static Rel *
init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
{
- Rel *joinrel = makeNode(Rel);
- List *joinrel_joininfo_list = NIL;
- List *new_outer_tlist;
- List *new_inner_tlist;
+ Rel *joinrel = makeNode(Rel);
+ List *joinrel_joininfo_list = NIL;
+ List *new_outer_tlist;
+ List *new_inner_tlist;
/*
* Create a new tlist by removing irrelevant elements from both tlists
@@ -338,18 +338,18 @@ init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
*
* Returns the new target list.
*/
-static List *
+static List *
new_join_tlist(List * tlist,
List * other_relids,
int first_resdomno)
{
- int resdomno = first_resdomno - 1;
- TargetEntry *xtl = NULL;
- List *temp_node = NIL;
- List *t_list = NIL;
- List *i = NIL;
- List *join_list = NIL;
- bool in_final_tlist = false;
+ int resdomno = first_resdomno - 1;
+ TargetEntry *xtl = NULL;
+ List *temp_node = NIL;
+ List *t_list = NIL;
+ List *i = NIL;
+ List *join_list = NIL;
+ bool in_final_tlist = false;
foreach(i, tlist)
@@ -388,18 +388,18 @@ new_join_tlist(List * tlist,
*
* Returns a list of joininfo nodes, new and old.
*/
-static List *
+static List *
new_joininfo_list(List * joininfo_list, List * join_relids)
{
- List *current_joininfo_list = NIL;
- List *new_otherrels = NIL;
- JInfo *other_joininfo = (JInfo *) NULL;
- List *xjoininfo = NIL;
+ List *current_joininfo_list = NIL;
+ List *new_otherrels = NIL;
+ JInfo *other_joininfo = (JInfo *) NULL;
+ List *xjoininfo = NIL;
foreach(xjoininfo, joininfo_list)
{
- List *or;
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ List *or;
+ JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
new_otherrels = joininfo->otherrels;
foreach(or, new_otherrels)
@@ -456,21 +456,21 @@ new_joininfo_list(List * joininfo_list, List * join_relids)
static void
geqo_add_new_joininfos(Query * root, List * joinrels, List * outerrels)
{
- List *xjoinrel = NIL;
- List *xrelid = NIL;
- List *xrel = NIL;
- List *xjoininfo = NIL;
+ List *xjoinrel = NIL;
+ List *xrelid = NIL;
+ List *xrel = NIL;
+ List *xjoininfo = NIL;
- Rel *rel;
- List *relids;
+ Rel *rel;
+ List *relids;
- List *super_rels;
- List *xsuper_rel = NIL;
- JInfo *new_joininfo;
+ List *super_rels;
+ List *xsuper_rel = NIL;
+ JInfo *new_joininfo;
foreach(xjoinrel, joinrels)
{
- Rel *joinrel = (Rel *) lfirst(xjoinrel);
+ Rel *joinrel = (Rel *) lfirst(xjoinrel);
foreach(xrelid, joinrel->relids)
{
@@ -506,15 +506,15 @@ geqo_add_new_joininfos(Query * root, List * joinrels, List * outerrels)
}
foreach(xjoinrel, joinrels)
{
- Rel *joinrel = (Rel *) lfirst(xjoinrel);
+ Rel *joinrel = (Rel *) lfirst(xjoinrel);
foreach(xjoininfo, joinrel->joininfo)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
- List *other_rels = joininfo->otherrels;
- List *clause_info = joininfo->jinfoclauseinfo;
- bool mergesortable = joininfo->mergesortable;
- bool hashjoinable = joininfo->hashjoinable;
+ JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ List *other_rels = joininfo->otherrels;
+ List *clause_info = joininfo->jinfoclauseinfo;
+ bool mergesortable = joininfo->mergesortable;
+ bool hashjoinable = joininfo->hashjoinable;
foreach(xrelid, other_rels)
{
@@ -553,12 +553,12 @@ geqo_add_new_joininfos(Query * root, List * joinrels, List * outerrels)
foreach(xsuper_rel, super_rels)
{
- Rel *super_rel = (Rel *) lfirst(xsuper_rel);
+ Rel *super_rel = (Rel *) lfirst(xsuper_rel);
if (nonoverlap_rels(super_rel, joinrel))
{
- List *new_relids = super_rel->relids;
- JInfo *other_joininfo =
+ List *new_relids = super_rel->relids;
+ JInfo *other_joininfo =
joininfo_member(new_relids,
joinrel->joininfo);
@@ -570,7 +570,7 @@ geqo_add_new_joininfos(Query * root, List * joinrels, List * outerrels)
}
else
{
- JInfo *new_joininfo = makeNode(JInfo);
+ JInfo *new_joininfo = makeNode(JInfo);
new_joininfo->otherrels = new_relids;
new_joininfo->jinfoclauseinfo = clause_info;
@@ -602,12 +602,12 @@ geqo_add_new_joininfos(Query * root, List * joinrels, List * outerrels)
*
* Returns the list of final join relations.
*/
-static List *
+static List *
geqo_final_join_rels(List * join_rel_list)
{
- List *xrel = NIL;
- List *temp = NIL;
- List *t_list = NIL;
+ List *xrel = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
/*
* find the relations that has no further joins, i.e., its joininfos
@@ -615,13 +615,13 @@ geqo_final_join_rels(List * join_rel_list)
*/
foreach(xrel, join_rel_list)
{
- Rel *rel = (Rel *) lfirst(xrel);
- List *xjoininfo = NIL;
- bool final = true;
+ Rel *rel = (Rel *) lfirst(xrel);
+ List *xjoininfo = NIL;
+ bool final = true;
foreach(xjoininfo, rel->joininfo)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
if (joininfo->otherrels != NIL)
{
@@ -663,20 +663,20 @@ add_superrels(Rel * rel, Rel * super_rel)
*
* Returns non-nil if rel1 and rel2 do not overlap.
*/
-static bool
+static bool
nonoverlap_rels(Rel * rel1, Rel * rel2)
{
return (nonoverlap_sets(rel1->relids, rel2->relids));
}
-static bool
+static bool
nonoverlap_sets(List * s1, List * s2)
{
- List *x = NIL;
+ List *x = NIL;
foreach(x, s1)
{
- int e = lfirsti(x);
+ int e = lfirsti(x);
if (intMember(e, s2))
return (false);
@@ -694,8 +694,8 @@ nonoverlap_sets(List * s1, List * s2)
static void
geqo_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel)
{
- Cost temp;
- int ntuples;
+ Cost temp;
+ int ntuples;
temp = (Cost) inner_rel->tuples * (Cost) outer_rel->tuples; /* cartesian product */
@@ -725,11 +725,11 @@ geqo_log(double x, double b)
return (log(x) / log(b));
}
-static Rel *
+static Rel *
geqo_nth(int stop, List * rels)
{
- List *r;
- int i = 1;
+ List *r;
+ int i = 1;
foreach(r, rels)
{
diff --git a/src/backend/optimizer/geqo/geqo_main.c b/src/backend/optimizer/geqo/geqo_main.c
index eab939c03e..cfaa323770 100644
--- a/src/backend/optimizer/geqo/geqo_main.c
+++ b/src/backend/optimizer/geqo/geqo_main.c
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_main.c,v 1.4 1997/09/07 04:43:09 momjian Exp $
+ * $Id: geqo_main.c,v 1.5 1997/09/08 02:23:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,42 +63,42 @@
* similar to a constrained Traveling Salesman Problem (TSP)
*/
-Rel *
+Rel *
geqo(Query * root)
{
- int generation;
- Chromosome *momma;
- Chromosome *daddy;
- Chromosome *kid;
+ int generation;
+ Chromosome *momma;
+ Chromosome *daddy;
+ Chromosome *kid;
#if defined(ERX)
- Edge *edge_table; /* list of edges */
- int edge_failures = 0;
- float difference;
+ Edge *edge_table; /* list of edges */
+ int edge_failures = 0;
+ float difference;
#endif
#if defined(CX) || defined(PX) || defined(OX1) || defined(OX2)
- City *city_table; /* list of cities */
+ City *city_table; /* list of cities */
#endif
#if defined(CX)
- int cycle_diffs = 0;
- int mutations = 0;
+ int cycle_diffs = 0;
+ int mutations = 0;
#endif
- int number_of_rels;
+ int number_of_rels;
- Pool *pool;
- int pool_size,
- number_generations,
- status_interval;
+ Pool *pool;
+ int pool_size,
+ number_generations,
+ status_interval;
- Gene *best_tour;
- Rel *best_rel;
+ Gene *best_tour;
+ Rel *best_rel;
/* Plan *best_plan; */
diff --git a/src/backend/optimizer/geqo/geqo_misc.c b/src/backend/optimizer/geqo/geqo_misc.c
index 67e810d87c..5e72f46ac3 100644
--- a/src/backend/optimizer/geqo/geqo_misc.c
+++ b/src/backend/optimizer/geqo/geqo_misc.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_misc.c,v 1.3 1997/09/07 04:43:10 momjian Exp $
+ * $Id: geqo_misc.c,v 1.4 1997/09/08 02:23:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,7 +41,7 @@
#include "optimizer/geqo_recombination.h"
#include "optimizer/geqo_misc.h"
-static float avg_pool(Pool * pool);
+static float avg_pool(Pool * pool);
/* avg_pool--
*
@@ -49,8 +49,8 @@ static float avg_pool(Pool * pool);
static float
avg_pool(Pool * pool)
{
- int i;
- double cumulative = 0.0;
+ int i;
+ double cumulative = 0.0;
if (pool->size == 0)
elog(WARN, "avg_pool: pool_size of zero");
@@ -66,8 +66,8 @@ avg_pool(Pool * pool)
void
print_pool(FILE * fp, Pool * pool, int start, int stop)
{
- int i,
- j;
+ int i,
+ j;
/* be extra careful that start and stop are valid inputs */
@@ -99,7 +99,7 @@ print_pool(FILE * fp, Pool * pool, int start, int stop)
void
print_gen(FILE * fp, Pool * pool, int generation)
{
- int lowest;
+ int lowest;
/* Get index to lowest ranking gene in poplulation. */
/* Use 2nd to last since last is buffer. */
@@ -118,8 +118,8 @@ print_gen(FILE * fp, Pool * pool, int generation)
void
print_edge_table(FILE * fp, Edge * edge_table, int num_gene)
{
- int i,
- j;
+ int i,
+ j;
fprintf(fp, "\nEDGE TABLE\n");
@@ -141,12 +141,12 @@ print_edge_table(FILE * fp, Edge * edge_table, int num_gene)
void
geqo_print_joinclauses(Query * root, List * clauses)
{
- List *l;
- extern void print_expr(Node * expr, List * rtable); /* in print.c */
+ List *l;
+ extern void print_expr(Node * expr, List * rtable); /* in print.c */
foreach(l, clauses)
{
- CInfo *c = lfirst(l);
+ CInfo *c = lfirst(l);
print_expr((Node *) c->clause, root->rtable);
if (lnext(l))
@@ -157,88 +157,88 @@ geqo_print_joinclauses(Query * root, List * clauses)
void
geqo_print_path(Query * root, Path * path, int indent)
{
- char *ptype = NULL;
- JoinPath *jp;
- bool join = false;
- int i;
+ char *ptype = NULL;
+ JoinPath *jp;
+ bool join = false;
+ int i;
for (i = 0; i < indent; i++)
printf("\t");
switch (nodeTag(path))
{
- case T_Path:
- ptype = "SeqScan";
- join = false;
- break;
- case T_IndexPath:
- ptype = "IdxScan";
- join = false;
- break;
- case T_JoinPath:
- ptype = "Nestloop";
- join = true;
- break;
- case T_MergePath:
- ptype = "MergeJoin";
- join = true;
- break;
- case T_HashPath:
- ptype = "HashJoin";
- join = true;
- break;
- default:
- break;
+ case T_Path:
+ ptype = "SeqScan";
+ join = false;
+ break;
+ case T_IndexPath:
+ ptype = "IdxScan";
+ join = false;
+ break;
+ case T_JoinPath:
+ ptype = "Nestloop";
+ join = true;
+ break;
+ case T_MergePath:
+ ptype = "MergeJoin";
+ join = true;
+ break;
+ case T_HashPath:
+ ptype = "HashJoin";
+ join = true;
+ break;
+ default:
+ break;
}
if (join)
{
- int size = path->parent->size;
+ int size = path->parent->size;
jp = (JoinPath *) path;
printf("%s size=%d cost=%f\n", ptype, size, path->path_cost);
switch (nodeTag(path))
{
- case T_MergePath:
- case T_HashPath:
- for (i = 0; i < indent + 1; i++)
- printf("\t");
- printf(" clauses=(");
- geqo_print_joinclauses(root,
- ((JoinPath *) path)->pathclauseinfo);
- printf(")\n");
-
- if (nodeTag(path) == T_MergePath)
- {
- MergePath *mp = (MergePath *) path;
-
- if (mp->outersortkeys || mp->innersortkeys)
+ case T_MergePath:
+ case T_HashPath:
+ for (i = 0; i < indent + 1; i++)
+ printf("\t");
+ printf(" clauses=(");
+ geqo_print_joinclauses(root,
+ ((JoinPath *) path)->pathclauseinfo);
+ printf(")\n");
+
+ if (nodeTag(path) == T_MergePath)
{
- for (i = 0; i < indent + 1; i++)
- printf("\t");
- printf(" sortouter=%d sortinner=%d\n",
- ((mp->outersortkeys) ? 1 : 0),
- ((mp->innersortkeys) ? 1 : 0));
+ MergePath *mp = (MergePath *) path;
+
+ if (mp->outersortkeys || mp->innersortkeys)
+ {
+ for (i = 0; i < indent + 1; i++)
+ printf("\t");
+ printf(" sortouter=%d sortinner=%d\n",
+ ((mp->outersortkeys) ? 1 : 0),
+ ((mp->innersortkeys) ? 1 : 0));
+ }
}
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
geqo_print_path(root, jp->outerjoinpath, indent + 1);
geqo_print_path(root, jp->innerjoinpath, indent + 1);
}
else
{
- int size = path->parent->size;
- int relid = lfirsti(path->parent->relids);
+ int size = path->parent->size;
+ int relid = lfirsti(path->parent->relids);
printf("%s(%d) size=%d cost=%f",
ptype, relid, size, path->path_cost);
if (nodeTag(path) == T_IndexPath)
{
- List *k,
- *l;
+ List *k,
+ *l;
printf(" keys=");
foreach(k, path->keys)
@@ -246,7 +246,7 @@ geqo_print_path(Query * root, Path * path, int indent)
printf("(");
foreach(l, lfirst(k))
{
- Var *var = lfirst(l);
+ Var *var = lfirst(l);
printf("%d.%d", var->varnoold, var->varoattno);
if (lnext(l))
@@ -264,7 +264,7 @@ geqo_print_path(Query * root, Path * path, int indent)
void
geqo_print_rel(Query * root, Rel * rel)
{
- List *l;
+ List *l;
printf("______________________________\n");
printf("(");
diff --git a/src/backend/optimizer/geqo/geqo_mutation.c b/src/backend/optimizer/geqo/geqo_mutation.c
index a5a43e6e2b..a6078c731a 100644
--- a/src/backend/optimizer/geqo/geqo_mutation.c
+++ b/src/backend/optimizer/geqo/geqo_mutation.c
@@ -4,7 +4,7 @@
*
* TSP mutation routines
*
-* $Id: geqo_mutation.c,v 1.2 1997/09/07 04:43:13 momjian Exp $
+* $Id: geqo_mutation.c,v 1.3 1997/09/08 02:23:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,10 +53,10 @@
void
geqo_mutation(Gene * tour, int num_gene)
{
- int swap1;
- int swap2;
- int num_swaps = geqo_randint(num_gene / 3, 0);
- Gene temp;
+ int swap1;
+ int swap2;
+ int num_swaps = geqo_randint(num_gene / 3, 0);
+ Gene temp;
while (num_swaps > 0)
diff --git a/src/backend/optimizer/geqo/geqo_ox1.c b/src/backend/optimizer/geqo/geqo_ox1.c
index b88b895067..bb3d045010 100644
--- a/src/backend/optimizer/geqo/geqo_ox1.c
+++ b/src/backend/optimizer/geqo/geqo_ox1.c
@@ -6,7 +6,7 @@
* OX1 operator according to Davis
* (Proc Int'l Joint Conf on AI)
*
-* $Id: geqo_ox1.c,v 1.2 1997/09/07 04:43:14 momjian Exp $
+* $Id: geqo_ox1.c,v 1.3 1997/09/08 02:23:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,11 +61,11 @@
void
ox1(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table)
{
- int left,
- right,
- k,
- p,
- temp;
+ int left,
+ right,
+ k,
+ p,
+ temp;
/* initialize city table */
for (k = 1; k <= num_gene; k++)
diff --git a/src/backend/optimizer/geqo/geqo_ox2.c b/src/backend/optimizer/geqo/geqo_ox2.c
index ef09925b4f..2490fb3051 100644
--- a/src/backend/optimizer/geqo/geqo_ox2.c
+++ b/src/backend/optimizer/geqo/geqo_ox2.c
@@ -6,7 +6,7 @@
* OX2 operator according to Syswerda
* (The Genetic Algorithms Handbook, ed L Davis)
*
-* $Id: geqo_ox2.c,v 1.2 1997/09/07 04:43:15 momjian Exp $
+* $Id: geqo_ox2.c,v 1.3 1997/09/08 02:23:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,12 +61,12 @@
void
ox2(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table)
{
- int k,
- j,
- count,
- pos,
- select,
- num_positions;
+ int k,
+ j,
+ count,
+ pos,
+ select,
+ num_positions;
/* initialize city table */
for (k = 1; k <= num_gene; k++)
diff --git a/src/backend/optimizer/geqo/geqo_params.c b/src/backend/optimizer/geqo/geqo_params.c
index 45f7dfd5dd..9ef969a228 100644
--- a/src/backend/optimizer/geqo/geqo_params.c
+++ b/src/backend/optimizer/geqo/geqo_params.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
-* $Id: geqo_params.c,v 1.6 1997/09/07 04:43:16 momjian Exp $
+* $Id: geqo_params.c,v 1.7 1997/09/08 02:24:00 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -58,9 +58,9 @@
#define MAX_TOKEN 80 /* Maximum size of one token in the *
* configuration file */
-static int gimme_pool_size(int string_length);
-static int gimme_number_generations(int pool_size, int effort);
-static int next_token(FILE *, char *, int);
+static int gimme_pool_size(int string_length);
+static int gimme_number_generations(int pool_size, int effort);
+static int next_token(FILE *, char *, int);
/*
* geqo_param--
@@ -69,19 +69,19 @@ static int next_token(FILE *, char *, int);
void
geqo_params(int string_length)
{
- int i;
+ int i;
- char buf[MAX_TOKEN];
- FILE *file;
+ char buf[MAX_TOKEN];
+ FILE *file;
- char *conf_file;
+ char *conf_file;
/* these static variables are used to signal that a value has been set */
- int pool_size = 0;
- int number_trials = 0;
- int random_seed = 0;
- int selection_bias = 0;
- int effort = 0;
+ int pool_size = 0;
+ int number_trials = 0;
+ int random_seed = 0;
+ int selection_bias = 0;
+ int effort = 0;
/* put together the full pathname to the config file */
@@ -272,8 +272,8 @@ geqo_params(int string_length)
static int
next_token(FILE * fp, char *buf, int bufsz)
{
- int c;
- char *eb = buf + (bufsz - 1);
+ int c;
+ char *eb = buf + (bufsz - 1);
/* Discard inital whitespace */
while (isspace(c = getc(fp)));
@@ -309,8 +309,8 @@ next_token(FILE * fp, char *buf, int bufsz)
static int
gimme_pool_size(int string_length)
{
- double exponent;
- double size;
+ double exponent;
+ double size;
exponent = (double) string_length + 1.0;
@@ -335,7 +335,7 @@ gimme_pool_size(int string_length)
static int
gimme_number_generations(int pool_size, int effort)
{
- int number_gens;
+ int number_gens;
number_gens = (int) ceil(geqo_log((double) pool_size, 2.0));
diff --git a/src/backend/optimizer/geqo/geqo_paths.c b/src/backend/optimizer/geqo/geqo_paths.c
index d98855d288..931b38985b 100644
--- a/src/backend/optimizer/geqo/geqo_paths.c
+++ b/src/backend/optimizer/geqo/geqo_paths.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_paths.c,v 1.5 1997/09/07 04:43:17 momjian Exp $
+ * $Id: geqo_paths.c,v 1.6 1997/09/08 02:24:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,8 +28,8 @@
#include "optimizer/geqo_paths.h"
-static List *geqo_prune_rel(Rel * rel, List * other_rels);
-static Path *set_paths(Rel * rel, Path * unorderedpath);
+static List *geqo_prune_rel(Rel * rel, List * other_rels);
+static Path *set_paths(Rel * rel, Path * unorderedpath);
/*
* geqo-prune-rels--
@@ -39,10 +39,10 @@ static Path *set_paths(Rel * rel, Path * unorderedpath);
* Returns the resulting list.
*
*/
-List *
+List *
geqo_prune_rels(List * rel_list)
{
- List *temp_list = NIL;
+ List *temp_list = NIL;
if (rel_list != NIL)
{
@@ -64,13 +64,13 @@ geqo_prune_rels(List * rel_list)
* of 'rel' appropriately.
*
*/
-static List *
+static List *
geqo_prune_rel(Rel * rel, List * other_rels)
{
- List *i = NIL;
- List *t_list = NIL;
- List *temp_node = NIL;
- Rel *other_rel = (Rel *) NULL;
+ List *i = NIL;
+ List *t_list = NIL;
+ List *temp_node = NIL;
+ Rel *other_rel = (Rel *) NULL;
foreach(i, other_rels)
{
@@ -104,9 +104,9 @@ geqo_prune_rel(Rel * rel, List * other_rels)
void
geqo_rel_paths(Rel * rel)
{
- List *y = NIL;
- Path *path = (Path *) NULL;
- JoinPath *cheapest = (JoinPath *) NULL;
+ List *y = NIL;
+ Path *path = (Path *) NULL;
+ JoinPath *cheapest = (JoinPath *) NULL;
rel->size = 0;
foreach(y, rel->pathlist)
@@ -133,10 +133,10 @@ geqo_rel_paths(Rel * rel)
* Returns the cheapest path.
*
*/
-static Path *
+static Path *
set_paths(Rel * rel, Path * unorderedpath)
{
- Path *cheapest = set_cheapest(rel, rel->pathlist);
+ Path *cheapest = set_cheapest(rel, rel->pathlist);
/* don't prune if not pruneable -- JMH, 11/23/92 */
if (unorderedpath != cheapest
diff --git a/src/backend/optimizer/geqo/geqo_pmx.c b/src/backend/optimizer/geqo/geqo_pmx.c
index c9187fec54..af4234a56e 100644
--- a/src/backend/optimizer/geqo/geqo_pmx.c
+++ b/src/backend/optimizer/geqo/geqo_pmx.c
@@ -6,7 +6,7 @@
* PMX operator according to Goldberg & Lingle
* (Proc Int'l Conf on GA's)
*
-* $Id: geqo_pmx.c,v 1.2 1997/09/07 04:43:18 momjian Exp $
+* $Id: geqo_pmx.c,v 1.3 1997/09/08 02:24:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,20 +61,20 @@
void
pmx(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene)
{
- int *failed = (int *) palloc((num_gene + 1) * sizeof(int));
- int *from = (int *) palloc((num_gene + 1) * sizeof(int));
- int *indx = (int *) palloc((num_gene + 1) * sizeof(int));
- int *check_list = (int *) palloc((num_gene + 1) * sizeof(int));
-
- int left,
- right,
- temp,
- i,
- j,
- k;
- int mx_fail,
- found,
- mx_hold;
+ int *failed = (int *) palloc((num_gene + 1) * sizeof(int));
+ int *from = (int *) palloc((num_gene + 1) * sizeof(int));
+ int *indx = (int *) palloc((num_gene + 1) * sizeof(int));
+ int *check_list = (int *) palloc((num_gene + 1) * sizeof(int));
+
+ int left,
+ right,
+ temp,
+ i,
+ j,
+ k;
+ int mx_fail,
+ found,
+ mx_hold;
/* no mutation so start up the pmx replacement algorithm */
diff --git a/src/backend/optimizer/geqo/geqo_pool.c b/src/backend/optimizer/geqo/geqo_pool.c
index 89c945d4ef..5e8a32d42d 100644
--- a/src/backend/optimizer/geqo/geqo_pool.c
+++ b/src/backend/optimizer/geqo/geqo_pool.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_pool.c,v 1.2 1997/09/07 04:43:19 momjian Exp $
+ * $Id: geqo_pool.c,v 1.3 1997/09/08 02:24:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,18 +44,18 @@
#include "optimizer/geqo_recombination.h"
-static int compare(void *arg1, void *arg2);
+static int compare(void *arg1, void *arg2);
/*
* alloc-pool--
* allocates memory for GA pool
*/
-Pool *
+Pool *
alloc_pool(int pool_size, int string_length)
{
- Pool *new_pool;
- Chromosome *chromo;
- int i;
+ Pool *new_pool;
+ Chromosome *chromo;
+ int i;
/* pool */
new_pool = (Pool *) palloc(sizeof(Pool));
@@ -82,8 +82,8 @@ alloc_pool(int pool_size, int string_length)
void
free_pool(Pool * pool)
{
- Chromosome *chromo;
- int i;
+ Chromosome *chromo;
+ int i;
/* all gene */
chromo = (Chromosome *) pool->data; /* vector of all chromos */
@@ -104,14 +104,14 @@ free_pool(Pool * pool)
void
random_init_pool(Query * root, Pool * pool, int strt, int stp)
{
- Chromosome *chromo = (Chromosome *) pool->data;
- int i;
+ Chromosome *chromo = (Chromosome *) pool->data;
+ int i;
for (i = strt; i < stp; i++)
{
init_tour(chromo[i].string, pool->string_length); /* from
* "geqo_recombination.c"
- * */
+ * */
pool->data[i].worth =
geqo_eval(root, chromo[i].string, pool->string_length); /* "from geqo_eval.c" */
@@ -141,8 +141,8 @@ sort_pool(Pool * pool)
static int
compare(void *arg1, void *arg2)
{
- Chromosome chromo1 = *(Chromosome *) arg1;
- Chromosome chromo2 = *(Chromosome *) arg2;
+ Chromosome chromo1 = *(Chromosome *) arg1;
+ Chromosome chromo2 = *(Chromosome *) arg2;
if (chromo1.worth == chromo2.worth)
return (0);
@@ -155,10 +155,10 @@ compare(void *arg1, void *arg2)
/* alloc_chromo--
* allocates a chromosome and string space
*/
-Chromosome *
+Chromosome *
alloc_chromo(int string_length)
{
- Chromosome *chromo;
+ Chromosome *chromo;
chromo = (Chromosome *) palloc(sizeof(Chromosome));
chromo->string = (Gene *) palloc((string_length + 1) * sizeof(Gene));
@@ -183,13 +183,13 @@ free_chromo(Chromosome * chromo)
void
spread_chromo(Chromosome * chromo, Pool * pool)
{
- int top,
- mid,
- bot;
- int i,
- index;
- Chromosome swap_chromo,
- tmp_chromo;
+ int top,
+ mid,
+ bot;
+ int i,
+ index;
+ Chromosome swap_chromo,
+ tmp_chromo;
/* new chromo is so bad we can't use it */
if (chromo->worth > pool->data[pool->size - 1].worth)
diff --git a/src/backend/optimizer/geqo/geqo_px.c b/src/backend/optimizer/geqo/geqo_px.c
index 71aa2415b5..4cd1ad3aec 100644
--- a/src/backend/optimizer/geqo/geqo_px.c
+++ b/src/backend/optimizer/geqo/geqo_px.c
@@ -6,7 +6,7 @@
* PX operator according to Syswerda
* (The Genetic Algorithms Handbook, L Davis, ed)
*
-* $Id: geqo_px.c,v 1.2 1997/09/07 04:43:20 momjian Exp $
+* $Id: geqo_px.c,v 1.3 1997/09/08 02:24:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,11 +62,11 @@ void
px(Gene * tour1, Gene * tour2, Gene * offspring, int num_gene, City * city_table)
{
- int num_positions;
- int i,
- pos,
- tour2_index,
- offspring_index;
+ int num_positions;
+ int i,
+ pos,
+ tour2_index,
+ offspring_index;
/* initialize city table */
for (i = 1; i <= num_gene; i++)
diff --git a/src/backend/optimizer/geqo/geqo_recombination.c b/src/backend/optimizer/geqo/geqo_recombination.c
index 5380307981..400afc50d4 100644
--- a/src/backend/optimizer/geqo/geqo_recombination.c
+++ b/src/backend/optimizer/geqo/geqo_recombination.c
@@ -3,7 +3,7 @@
* geqo_recombination.c--
* misc recombination procedures
*
-* $Id: geqo_recombination.c,v 1.2 1997/09/07 04:43:21 momjian Exp $
+* $Id: geqo_recombination.c,v 1.3 1997/09/08 02:24:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,10 +53,10 @@
void
init_tour(Gene * tour, int num_gene)
{
- Gene *tmp;
- int remainder;
- int next,
- i;
+ Gene *tmp;
+ int remainder;
+ int next,
+ i;
tmp = (Gene *) palloc(num_gene * sizeof(Gene));
@@ -84,10 +84,10 @@ init_tour(Gene * tour, int num_gene)
* allocate memory for city table
*
*/
-City *
+City *
alloc_city_table(int num_gene)
{
- City *city_table;
+ City *city_table;
/*
* palloc one extra location so that nodes numbered 1..n can be
diff --git a/src/backend/optimizer/geqo/geqo_selection.c b/src/backend/optimizer/geqo/geqo_selection.c
index 820de485fe..ed0727cbfb 100644
--- a/src/backend/optimizer/geqo/geqo_selection.c
+++ b/src/backend/optimizer/geqo/geqo_selection.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: geqo_selection.c,v 1.2 1997/09/07 04:43:24 momjian Exp $
+ * $Id: geqo_selection.c,v 1.3 1997/09/08 02:24:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,7 +55,7 @@
#include "optimizer/geqo_copy.h"
#include "optimizer/geqo_random.h"
-static int linear(int max, double bias);
+static int linear(int max, double bias);
/* geqo_selection--
*
@@ -65,8 +65,8 @@ static int linear(int max, double bias);
void
geqo_selection(Chromosome * momma, Chromosome * daddy, Pool * pool, double bias)
{
- int first,
- second;
+ int first,
+ second;
first = (int) linear(pool->size, bias);
second = (int) linear(pool->size, bias);
@@ -94,8 +94,8 @@ static int
linear(int pool_size, double bias) /* bias is y-intercept of linear
* distribution */
{
- double index; /* index between 0 and pop_size */
- double max = (double) pool_size;
+ double index; /* index between 0 and pop_size */
+ double max = (double) pool_size;
index =
max * (bias - sqrt((bias * bias) - 4.0 * (bias - 1.0) * geqo_rand()))
diff --git a/src/backend/optimizer/geqo/minspantree.c b/src/backend/optimizer/geqo/minspantree.c
index 1fcc256947..716e194395 100644
--- a/src/backend/optimizer/geqo/minspantree.c
+++ b/src/backend/optimizer/geqo/minspantree.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
-* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.2 1997/09/07 04:43:25 momjian Exp $
+* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.3 1997/09/08 02:24:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,35 +43,35 @@
void
minspantree(Query * root, List * join_rels, Rel * garel)
{
- int number_of_rels = length(root->base_relation_list_);
- int number_of_joins = length(join_rels);
- int *connectto;
+ int number_of_rels = length(root->base_relation_list_);
+ int number_of_joins = length(join_rels);
+ int *connectto;
/* connectto[i] = 0, if node i is already connected */
/* to the tree, otherwise connectto[i] is the node */
/* nearest to i, which is already connected. */
- Cost *disttoconnect; /* disttoconnect[i]: distance
- * between i and connectto[i] */
+ Cost *disttoconnect; /* disttoconnect[i]: distance between i
+ * and connectto[i] */
- Cost dist, /* temporary */
- mindist; /* minimal distance between connected and
+ Cost dist, /* temporary */
+ mindist; /* minimal distance between connected and
* unconnected node */
- Cost mstlength = 0.0; /* the total length of the minimum
- * spanning tree */
+ Cost mstlength = 0.0;/* the total length of the minimum
+ * spanning tree */
- int count;
- int n, /* newly attached node */
- nextn, /* next node to be attached */
- tempn;
+ int count;
+ int n, /* newly attached node */
+ nextn, /* next node to be attached */
+ tempn;
- int i,
- id1,
- id2;
- List *r = NIL;
- Rel *joinrel = NULL;
- Rel **tmprel_array;
+ int i,
+ id1,
+ id2;
+ List *r = NIL;
+ Rel *joinrel = NULL;
+ Rel **tmprel_array;
/* allocate memory for matrix tmprel_array[x][y] */
@@ -113,9 +113,9 @@ minspantree(Query * root, List * join_rels, Rel * garel)
else if (number_of_joins == 3)
{
- Rel *rel12 = (Rel *) & tmprel_array[1][2];
- Rel *rel13 = (Rel *) & tmprel_array[1][3];
- Rel *rel23 = (Rel *) & tmprel_array[2][3];
+ Rel *rel12 = (Rel *) & tmprel_array[1][2];
+ Rel *rel13 = (Rel *) & tmprel_array[1][3];
+ Rel *rel23 = (Rel *) & tmprel_array[2][3];
if (rel12->cheapestpath->path_cost > rel13->cheapestpath->path_cost)
{
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 7c4576d6f0..ca4485fbd1 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.11 1997/09/07 04:43:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.12 1997/09/08 02:24:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,17 +34,17 @@
#include "optimizer/geqo.h"
#ifdef GEQO
-bool _use_geqo_ = true;
+bool _use_geqo_ = true;
#else
-bool _use_geqo_ = false;
+bool _use_geqo_ = false;
#endif
-int32 _use_geqo_rels_ = GEQO_RELS;
+int32 _use_geqo_rels_ = GEQO_RELS;
-static void find_rel_paths(Query * root, List * rels);
-static List *find_join_paths(Query * root, List * outer_rels, int levels_left);
+static void find_rel_paths(Query * root, List * rels);
+static List *find_join_paths(Query * root, List * outer_rels, int levels_left);
/*
* find-paths--
@@ -53,10 +53,10 @@ static List *find_join_paths(Query * root, List * outer_rels, int levels_left
*
* 'rels' is the list of single relation entries appearing in the query
*/
-List *
+List *
find_paths(Query * root, List * rels)
{
- int levels_left;
+ int levels_left;
/*
* Set the number of join (not nesting) levels yet to be processed.
@@ -104,15 +104,15 @@ find_paths(Query * root, List * rels)
static void
find_rel_paths(Query * root, List * rels)
{
- List *temp;
- Rel *rel;
- List *lastpath;
+ List *temp;
+ Rel *rel;
+ List *lastpath;
foreach(temp, rels)
{
- List *sequential_scan_list;
- List *rel_index_scan_list;
- List *or_index_scan_list;
+ List *sequential_scan_list;
+ List *rel_index_scan_list;
+ List *or_index_scan_list;
rel = (Rel *) lfirst(temp);
sequential_scan_list = lcons(create_seqscan_path(rel),
@@ -171,12 +171,12 @@ find_rel_paths(Query * root, List * rels)
* Returns the final level of join relations, i.e., the relation that is
* the result of joining all the original relations togehter.
*/
-static List *
+static List *
find_join_paths(Query * root, List * outer_rels, int levels_left)
{
- List *x;
- List *new_rels;
- Rel *rel;
+ List *x;
+ List *new_rels;
+ Rel *rel;
/*******************************************
* genetic query optimizer entry point *
@@ -283,12 +283,12 @@ find_join_paths(Query * root, List * outer_rels, int levels_left)
static void
print_joinclauses(Query * root, List * clauses)
{
- List *l;
- extern void print_expr(Node * expr, List * rtable); /* in print.c */
+ List *l;
+ extern void print_expr(Node * expr, List * rtable); /* in print.c */
foreach(l, clauses)
{
- CInfo *c = lfirst(l);
+ CInfo *c = lfirst(l);
print_expr((Node *) c->clause, root->rtable);
if (lnext(l))
@@ -299,88 +299,88 @@ print_joinclauses(Query * root, List * clauses)
static void
print_path(Query * root, Path * path, int indent)
{
- char *ptype = NULL;
- JoinPath *jp;
- bool join = false;
- int i;
+ char *ptype = NULL;
+ JoinPath *jp;
+ bool join = false;
+ int i;
for (i = 0; i < indent; i++)
printf("\t");
switch (nodeTag(path))
{
- case T_Path:
- ptype = "SeqScan";
- join = false;
- break;
- case T_IndexPath:
- ptype = "IdxScan";
- join = false;
- break;
- case T_JoinPath:
- ptype = "Nestloop";
- join = true;
- break;
- case T_MergePath:
- ptype = "MergeJoin";
- join = true;
- break;
- case T_HashPath:
- ptype = "HashJoin";
- join = true;
- break;
- default:
- break;
+ case T_Path:
+ ptype = "SeqScan";
+ join = false;
+ break;
+ case T_IndexPath:
+ ptype = "IdxScan";
+ join = false;
+ break;
+ case T_JoinPath:
+ ptype = "Nestloop";
+ join = true;
+ break;
+ case T_MergePath:
+ ptype = "MergeJoin";
+ join = true;
+ break;
+ case T_HashPath:
+ ptype = "HashJoin";
+ join = true;
+ break;
+ default:
+ break;
}
if (join)
{
- int size = path->parent->size;
+ int size = path->parent->size;
jp = (JoinPath *) path;
printf("%s size=%d cost=%f\n", ptype, size, path->path_cost);
switch (nodeTag(path))
{
- case T_MergePath:
- case T_HashPath:
- for (i = 0; i < indent + 1; i++)
- printf("\t");
- printf(" clauses=(");
- print_joinclauses(root,
- ((JoinPath *) path)->pathclauseinfo);
- printf(")\n");
-
- if (nodeTag(path) == T_MergePath)
- {
- MergePath *mp = (MergePath *) path;
-
- if (mp->outersortkeys || mp->innersortkeys)
+ case T_MergePath:
+ case T_HashPath:
+ for (i = 0; i < indent + 1; i++)
+ printf("\t");
+ printf(" clauses=(");
+ print_joinclauses(root,
+ ((JoinPath *) path)->pathclauseinfo);
+ printf(")\n");
+
+ if (nodeTag(path) == T_MergePath)
{
- for (i = 0; i < indent + 1; i++)
- printf("\t");
- printf(" sortouter=%d sortinner=%d\n",
- ((mp->outersortkeys) ? 1 : 0),
- ((mp->innersortkeys) ? 1 : 0));
+ MergePath *mp = (MergePath *) path;
+
+ if (mp->outersortkeys || mp->innersortkeys)
+ {
+ for (i = 0; i < indent + 1; i++)
+ printf("\t");
+ printf(" sortouter=%d sortinner=%d\n",
+ ((mp->outersortkeys) ? 1 : 0),
+ ((mp->innersortkeys) ? 1 : 0));
+ }
}
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
print_path(root, jp->outerjoinpath, indent + 1);
print_path(root, jp->innerjoinpath, indent + 1);
}
else
{
- int size = path->parent->size;
- int relid = lfirsti(path->parent->relids);
+ int size = path->parent->size;
+ int relid = lfirsti(path->parent->relids);
printf("%s(%d) size=%d cost=%f",
ptype, relid, size, path->path_cost);
if (nodeTag(path) == T_IndexPath)
{
- List *k,
- *l;
+ List *k,
+ *l;
printf(" keys=");
foreach(k, path->keys)
@@ -388,7 +388,7 @@ print_path(Query * root, Path * path, int indent)
printf("(");
foreach(l, lfirst(k))
{
- Var *var = lfirst(l);
+ Var *var = lfirst(l);
printf("%d.%d", var->varnoold, var->varoattno);
if (lnext(l))
@@ -406,7 +406,7 @@ print_path(Query * root, Path * path, int indent)
static void
debug_print_rel(Query * root, Rel * rel)
{
- List *l;
+ List *l;
printf("(");
foreach(l, rel->relids)
diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c
index 0ce580754e..7ae190f7fd 100644
--- a/src/backend/optimizer/path/clausesel.c
+++ b/src/backend/optimizer/path/clausesel.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.2 1997/09/07 04:43:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.3 1997/09/08 02:24:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,7 +31,7 @@
#include "utils/elog.h"
#include "utils/lsyscache.h"
-static Cost compute_selec(Query * root, List * clauses, List * or_selectivities);
+static Cost compute_selec(Query * root, List * clauses, List * or_selectivities);
/****************************************************************************
* ROUTINES TO SET CLAUSE SELECTIVITIES
@@ -49,9 +49,9 @@ static Cost compute_selec(Query * root, List * clauses, List * or_selectivities
void
set_clause_selectivities(List * clauseinfo_list, Cost new_selectivity)
{
- List *temp;
- CInfo *clausenode;
- Cost cost_clause;
+ List *temp;
+ CInfo *clausenode;
+ Cost cost_clause;
foreach(temp, clauseinfo_list)
{
@@ -73,12 +73,12 @@ set_clause_selectivities(List * clauseinfo_list, Cost new_selectivity)
Cost
product_selec(List * clauseinfo_list)
{
- Cost result = 1.0;
+ Cost result = 1.0;
if (clauseinfo_list != NIL)
{
- List *xclausenode = NIL;
- Cost temp;
+ List *xclausenode = NIL;
+ Cost temp;
foreach(xclausenode, clauseinfo_list)
{
@@ -101,8 +101,8 @@ product_selec(List * clauseinfo_list)
void
set_rest_relselec(Query * root, List * rel_list)
{
- Rel *rel;
- List *x;
+ Rel *rel;
+ List *x;
foreach(x, rel_list)
{
@@ -122,9 +122,9 @@ set_rest_relselec(Query * root, List * rel_list)
void
set_rest_selec(Query * root, List * clauseinfo_list)
{
- List *temp = NIL;
- CInfo *clausenode = (CInfo *) NULL;
- Cost cost_clause;
+ List *temp = NIL;
+ CInfo *clausenode = (CInfo *) NULL;
+ Cost cost_clause;
foreach(temp, clauseinfo_list)
{
@@ -222,11 +222,11 @@ compute_clause_selec(Query * root, Node * clause, List * or_selectivities)
* Returns the clause selectivity as a flonum.
*
*/
-static Cost
+static Cost
compute_selec(Query * root, List * clauses, List * or_selectivities)
{
- Cost s1 = 0;
- List *clause = lfirst(clauses);
+ Cost s1 = 0;
+ List *clause = lfirst(clauses);
if (clauses == NULL)
{
@@ -243,8 +243,8 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
}
else if (IsA(clause, Var))
{
- Oid relid = getrelid(((Var *) clause)->varno,
- root->rtable);
+ Oid relid = getrelid(((Var *) clause)->varno,
+ root->rtable);
/*
* we have a bool Var. This is exactly equivalent to the clause:
@@ -264,7 +264,7 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
else if (or_selectivities)
{
/* If s1 has already been assigned by an index, use that value. */
- List *this_sel = lfirst(or_selectivities);
+ List *this_sel = lfirst(or_selectivities);
s1 = floatVal(this_sel);
}
@@ -288,13 +288,13 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
* clause selectivity will be based on the operator selectivity
* and operand values.
*/
- Oid opno = ((Oper *) ((Expr *) clause)->oper)->opno;
- RegProcedure oprrest = get_oprrest(opno);
- Oid relid;
- int relidx;
- AttrNumber attno;
- Datum constval;
- int flag;
+ Oid opno = ((Oper *) ((Expr *) clause)->oper)->opno;
+ RegProcedure oprrest = get_oprrest(opno);
+ Oid relid;
+ int relidx;
+ AttrNumber attno;
+ Datum constval;
+ int flag;
get_relattval((Node *) clause, &relidx, &attno, &constval, &flag);
relid = getrelid(relidx, root->rtable);
@@ -332,12 +332,12 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
* be based on the relations to be scanned and the attributes they
* are to be joined on.
*/
- Oid opno = ((Oper *) ((Expr *) clause)->oper)->opno;
- RegProcedure oprjoin = get_oprjoin(opno);
- int relid1,
- relid2;
- AttrNumber attno1,
- attno2;
+ Oid opno = ((Oper *) ((Expr *) clause)->oper)->opno;
+ RegProcedure oprjoin = get_oprjoin(opno);
+ int relid1,
+ relid2;
+ AttrNumber attno1,
+ attno2;
get_rels_atts((Node *) clause, &relid1, &attno1, &relid2, &attno2);
relid1 = getrelid(relid1, root->rtable);
@@ -372,7 +372,7 @@ compute_selec(Query * root, List * clauses, List * or_selectivities)
{
/* Compute selectivity of the 'or'ed subclauses. */
/* Added check for taking lnext(NIL). -- JMH 3/9/92 */
- Cost s2;
+ Cost s2;
if (or_selectivities != NIL)
s2 = compute_selec(root, lnext(clauses), lnext(or_selectivities));
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 2873e62c48..6badd4780e 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.17 1997/09/07 04:43:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.18 1997/09/08 02:24:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,24 +37,24 @@
#include "storage/bufmgr.h" /* for BLCKSZ */
-extern int NBuffers;
+extern int NBuffers;
-static int compute_attribute_width(TargetEntry * tlistentry);
-static double base_log(double x, double b);
-static int compute_targetlist_width(List * targetlist);
+static int compute_attribute_width(TargetEntry * tlistentry);
+static double base_log(double x, double b);
+static int compute_targetlist_width(List * targetlist);
-int _disable_cost_ = 30000000;
+int _disable_cost_ = 30000000;
-bool _enable_seqscan_ = true;
-bool _enable_indexscan_ = true;
-bool _enable_sort_ = true;
-bool _enable_hash_ = true;
-bool _enable_nestloop_ = true;
-bool _enable_mergesort_ = true;
-bool _enable_hashjoin_ = true;
+bool _enable_seqscan_ = true;
+bool _enable_indexscan_ = true;
+bool _enable_sort_ = true;
+bool _enable_hash_ = true;
+bool _enable_nestloop_ = true;
+bool _enable_mergesort_ = true;
+bool _enable_hashjoin_ = true;
-Cost _cpu_page_wight_ = _CPU_PAGE_WEIGHT_;
-Cost _cpu_index_page_wight_ = _CPU_INDEX_PAGE_WEIGHT_;
+Cost _cpu_page_wight_ = _CPU_PAGE_WEIGHT_;
+Cost _cpu_index_page_wight_ = _CPU_INDEX_PAGE_WEIGHT_;
/*
* cost_seqscan--
@@ -79,7 +79,7 @@ Cost _cpu_index_page_wight_ = _CPU_INDEX_PAGE_WEIGHT_;
Cost
cost_seqscan(int relid, int relpages, int reltuples)
{
- Cost temp = 0;
+ Cost temp = 0;
if (!_enable_seqscan_)
temp += _disable_cost_;
@@ -131,8 +131,8 @@ cost_index(Oid indexid,
int indextuples,
bool is_injoin)
{
- Cost temp;
- double temp2;
+ Cost temp;
+ double temp2;
temp = (Cost) 0;
@@ -179,10 +179,10 @@ cost_index(Oid indexid,
Cost
cost_sort(List * keys, int tuples, int width, bool noread)
{
- Cost temp = 0;
- int npages = page_size(tuples, width);
- Cost pages = (Cost) npages;
- Cost numTuples = tuples;
+ Cost temp = 0;
+ int npages = page_size(tuples, width);
+ Cost pages = (Cost) npages;
+ Cost numTuples = tuples;
if (!_enable_sort_)
temp += _disable_cost_;
@@ -220,7 +220,7 @@ cost_sort(List * keys, int tuples, int width, bool noread)
Cost
cost_result(int tuples, int width)
{
- Cost temp = 0;
+ Cost temp = 0;
temp = temp + page_size(tuples, width);
temp = temp + _cpu_page_wight_ * tuples;
@@ -250,7 +250,7 @@ cost_nestloop(Cost outercost,
int outerpages,
bool is_indexjoin)
{
- Cost temp = 0;
+ Cost temp = 0;
if (!_enable_nestloop_)
temp += _disable_cost_;
@@ -285,7 +285,7 @@ cost_mergesort(Cost outercost,
int outerwidth,
int innerwidth)
{
- Cost temp = 0;
+ Cost temp = 0;
if (!_enable_mergesort_)
temp += _disable_cost_;
@@ -323,10 +323,10 @@ cost_hashjoin(Cost outercost,
int outerwidth,
int innerwidth)
{
- Cost temp = 0;
- int outerpages = page_size(outersize, outerwidth);
- int innerpages = page_size(innersize, innerwidth);
- int nrun = ceil((double) outerpages / (double) NBuffers);
+ Cost temp = 0;
+ int outerpages = page_size(outersize, outerwidth);
+ int innerpages = page_size(innersize, innerwidth);
+ int nrun = ceil((double) outerpages / (double) NBuffers);
if (outerpages < innerpages)
return _disable_cost_;
@@ -365,8 +365,8 @@ cost_hashjoin(Cost outercost,
int
compute_rel_size(Rel * rel)
{
- Cost temp;
- int temp1;
+ Cost temp;
+ int temp1;
temp = rel->tuples * product_selec(rel->clauseinfo);
Assert(temp >= 0);
@@ -404,8 +404,8 @@ compute_rel_width(Rel * rel)
static int
compute_targetlist_width(List * targetlist)
{
- List *temp_tl;
- int tuple_width = 0;
+ List *temp_tl;
+ int tuple_width = 0;
foreach(temp_tl, targetlist)
{
@@ -427,7 +427,7 @@ compute_targetlist_width(List * targetlist)
static int
compute_attribute_width(TargetEntry * tlistentry)
{
- int width = get_typlen(tlistentry->resdom->restype);
+ int width = get_typlen(tlistentry->resdom->restype);
if (width < 0)
return (_DEFAULT_ATTRIBUTE_WIDTH_);
@@ -444,8 +444,8 @@ compute_attribute_width(TargetEntry * tlistentry)
int
compute_joinrel_size(JoinPath * joinpath)
{
- Cost temp = 1.0;
- int temp1 = 0;
+ Cost temp = 1.0;
+ int temp1 = 0;
temp *= ((Path *) joinpath->outerjoinpath)->parent->size;
temp *= ((Path *) joinpath->innerjoinpath)->parent->size;
@@ -477,7 +477,7 @@ compute_joinrel_size(JoinPath * joinpath)
int
page_size(int tuples, int width)
{
- int temp = 0;
+ int temp = 0;
temp = ceil((double) (tuples * (width + sizeof(HeapTupleData)))
/ BLCKSZ);
diff --git a/src/backend/optimizer/path/hashutils.c b/src/backend/optimizer/path/hashutils.c
index 5ec592ad1f..ea6089355a 100644
--- a/src/backend/optimizer/path/hashutils.c
+++ b/src/backend/optimizer/path/hashutils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.2 1997/09/07 04:43:34 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.3 1997/09/08 02:24:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,7 +20,7 @@
#include "optimizer/clauses.h"
-static HInfo *match_hashop_hashinfo(Oid hashop, List * hashinfo_list);
+static HInfo *match_hashop_hashinfo(Oid hashop, List * hashinfo_list);
/*
* group-clauses-by-hashop--
@@ -34,14 +34,14 @@ static HInfo *match_hashop_hashinfo(Oid hashop, List * hashinfo_list);
* Returns the new list of hashinfo nodes.
*
*/
-List *
+List *
group_clauses_by_hashop(List * clauseinfo_list,
int inner_relid)
{
- List *hashinfo_list = NIL;
- CInfo *clauseinfo = (CInfo *) NULL;
- List *i = NIL;
- Oid hashjoinop = 0;
+ List *hashinfo_list = NIL;
+ CInfo *clauseinfo = (CInfo *) NULL;
+ List *i = NIL;
+ Oid hashjoinop = 0;
foreach(i, clauseinfo_list)
{
@@ -54,11 +54,11 @@ group_clauses_by_hashop(List * clauseinfo_list,
*/
if (hashjoinop)
{
- HInfo *xhashinfo = (HInfo *) NULL;
- Expr *clause = clauseinfo->clause;
- Var *leftop = get_leftop(clause);
- Var *rightop = get_rightop(clause);
- JoinKey *keys = (JoinKey *) NULL;
+ HInfo *xhashinfo = (HInfo *) NULL;
+ Expr *clause = clauseinfo->clause;
+ Var *leftop = get_leftop(clause);
+ Var *rightop = get_rightop(clause);
+ JoinKey *keys = (JoinKey *) NULL;
xhashinfo =
match_hashop_hashinfo(hashjoinop, hashinfo_list);
@@ -108,12 +108,12 @@ group_clauses_by_hashop(List * clauseinfo_list,
* Returns the node if it exists.
*
*/
-static HInfo *
+static HInfo *
match_hashop_hashinfo(Oid hashop, List * hashinfo_list)
{
- Oid key = 0;
- HInfo *xhashinfo = (HInfo *) NULL;
- List *i = NIL;
+ Oid key = 0;
+ HInfo *xhashinfo = (HInfo *) NULL;
+ List *i = NIL;
foreach(i, hashinfo_list)
{
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index bd9bc15ace..6018ad775d 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.9 1997/09/07 04:43:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.10 1997/09/08 02:24:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,37 +52,37 @@ match_index_orclauses(Rel * rel, Rel * index, int indexkey,
static bool
match_index_to_operand(int indexkey, Expr * operand,
Rel * rel, Rel * index);
-static List *
+static List *
match_index_orclause(Rel * rel, Rel * index, int indexkey,
int xclass, List * or_clauses, List * other_matching_indices);
-static List *
+static List *
group_clauses_by_indexkey(Rel * rel, Rel * index,
int *indexkeys, Oid * classes, List * clauseinfo_list);
-static List *
+static List *
group_clauses_by_ikey_for_joins(Rel * rel, Rel * index,
int *indexkeys, Oid * classes, List * join_cinfo_list, List * restr_cinfo_list);
-static CInfo *
+static CInfo *
match_clause_to_indexkey(Rel * rel, Rel * index, int indexkey,
int xclass, CInfo * clauseInfo, bool join);
static bool
pred_test(List * predicate_list, List * clauseinfo_list,
List * joininfo_list);
-static bool one_pred_test(Expr * predicate, List * clauseinfo_list);
-static bool one_pred_clause_expr_test(Expr * predicate, Node * clause);
-static bool one_pred_clause_test(Expr * predicate, Node * clause);
-static bool clause_pred_clause_test(Expr * predicate, Node * clause);
-static List *
+static bool one_pred_test(Expr * predicate, List * clauseinfo_list);
+static bool one_pred_clause_expr_test(Expr * predicate, Node * clause);
+static bool one_pred_clause_test(Expr * predicate, Node * clause);
+static bool clause_pred_clause_test(Expr * predicate, Node * clause);
+static List *
indexable_joinclauses(Rel * rel, Rel * index,
List * joininfo_list, List * clauseinfo_list);
-static List *
+static List *
index_innerjoin(Query * root, Rel * rel,
List * clausegroup_list, Rel * index);
-static List *
+static List *
create_index_paths(Query * root, Rel * rel, Rel * index,
List * clausegroup_list, bool join);
-static List *add_index_paths(List * indexpaths, List * new_indexpaths);
-static bool function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index);
-static bool SingleAttributeIndex(Rel * index);
+static List *add_index_paths(List * indexpaths, List * new_indexpaths);
+static bool function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index);
+static bool SingleAttributeIndex(Rel * index);
/* If Spyros can use a constant PRS2_BOOL_TYPEID, I can use this */
#define BOOL_TYPEID ((Oid) 16)
@@ -113,19 +113,19 @@ static bool SingleAttributeIndex(Rel * index);
* Returns a list of index nodes.
*
*/
-List *
+List *
find_index_paths(Query * root,
Rel * rel,
List * indices,
List * clauseinfo_list,
List * joininfo_list)
{
- List *scanclausegroups = NIL;
- List *scanpaths = NIL;
- Rel *index = (Rel *) NULL;
- List *joinclausegroups = NIL;
- List *joinpaths = NIL;
- List *retval = NIL;
+ List *scanclausegroups = NIL;
+ List *scanpaths = NIL;
+ Rel *index = (Rel *) NULL;
+ List *joinclausegroups = NIL;
+ List *joinpaths = NIL;
+ List *retval = NIL;
if (indices == NIL)
return (NULL);
@@ -193,11 +193,11 @@ find_index_paths(Query * root,
if (joinclausegroups != NIL)
{
- List *new_join_paths = create_index_paths(root, rel,
- index,
+ List *new_join_paths = create_index_paths(root, rel,
+ index,
joinclausegroups,
- true);
- List *innerjoin_paths = index_innerjoin(root, rel, joinclausegroups, index);
+ true);
+ List *innerjoin_paths = index_innerjoin(root, rel, joinclausegroups, index);
rel->innerjoin = nconc(rel->innerjoin, innerjoin_paths);
joinpaths = new_join_paths;
@@ -246,8 +246,8 @@ match_index_orclauses(Rel * rel,
int xclass,
List * clauseinfo_list)
{
- CInfo *clauseinfo = (CInfo *) NULL;
- List *i = NIL;
+ CInfo *clauseinfo = (CInfo *) NULL;
+ List *i = NIL;
foreach(i, clauseinfo_list)
{
@@ -275,7 +275,7 @@ match_index_orclauses(Rel * rel,
* and the operand on the rhs of a restriction clause. Now check
* for functional indices as well.
*/
-static bool
+static bool
match_index_to_operand(int indexkey,
Expr * operand,
Rel * rel,
@@ -315,7 +315,7 @@ match_index_to_operand(int indexkey,
* 'or-clauses', d,e,f match the second subclause, no indices
* match the third, g,h match the fourth, etc.
*/
-static List *
+static List *
match_index_orclause(Rel * rel,
Rel * index,
int indexkey,
@@ -323,11 +323,11 @@ match_index_orclause(Rel * rel,
List * or_clauses,
List * other_matching_indices)
{
- Node *clause = NULL;
- List *matched_indices = other_matching_indices;
- List *index_list = NIL;
- List *clist;
- List *ind;
+ Node *clause = NULL;
+ List *matched_indices = other_matching_indices;
+ List *index_list = NIL;
+ List *clist;
+ List *ind;
if (!matched_indices)
matched_indices = lcons(NIL, NIL);
@@ -397,32 +397,32 @@ match_index_orclause(Rel * rel,
* returned for an index with 2 keys.
*
*/
-static List *
+static List *
group_clauses_by_indexkey(Rel * rel,
Rel * index,
int *indexkeys,
Oid * classes,
List * clauseinfo_list)
{
- List *curCinfo = NIL;
- CInfo *matched_clause = (CInfo *) NULL;
- List *clausegroup = NIL;
- int curIndxKey;
- Oid curClass;
+ List *curCinfo = NIL;
+ CInfo *matched_clause = (CInfo *) NULL;
+ List *clausegroup = NIL;
+ int curIndxKey;
+ Oid curClass;
if (clauseinfo_list == NIL)
return NIL;
while (!DoneMatchingIndexKeys(indexkeys, index))
{
- List *tempgroup = NIL;
+ List *tempgroup = NIL;
curIndxKey = indexkeys[0];
curClass = classes[0];
foreach(curCinfo, clauseinfo_list)
{
- CInfo *temp = (CInfo *) lfirst(curCinfo);
+ CInfo *temp = (CInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
@@ -459,7 +459,7 @@ group_clauses_by_indexkey(Rel * rel,
* - vadim 03/18/97
*
*/
-static List *
+static List *
group_clauses_by_ikey_for_joins(Rel * rel,
Rel * index,
int *indexkeys,
@@ -467,26 +467,26 @@ group_clauses_by_ikey_for_joins(Rel * rel,
List * join_cinfo_list,
List * restr_cinfo_list)
{
- List *curCinfo = NIL;
- CInfo *matched_clause = (CInfo *) NULL;
- List *clausegroup = NIL;
- int curIndxKey;
- Oid curClass;
- bool jfound = false;
+ List *curCinfo = NIL;
+ CInfo *matched_clause = (CInfo *) NULL;
+ List *clausegroup = NIL;
+ int curIndxKey;
+ Oid curClass;
+ bool jfound = false;
if (join_cinfo_list == NIL)
return NIL;
while (!DoneMatchingIndexKeys(indexkeys, index))
{
- List *tempgroup = NIL;
+ List *tempgroup = NIL;
curIndxKey = indexkeys[0];
curClass = classes[0];
foreach(curCinfo, join_cinfo_list)
{
- CInfo *temp = (CInfo *) lfirst(curCinfo);
+ CInfo *temp = (CInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
@@ -502,7 +502,7 @@ group_clauses_by_ikey_for_joins(Rel * rel,
}
foreach(curCinfo, restr_cinfo_list)
{
- CInfo *temp = (CInfo *) lfirst(curCinfo);
+ CInfo *temp = (CInfo *) lfirst(curCinfo);
matched_clause = match_clause_to_indexkey(rel,
index,
@@ -582,7 +582,7 @@ group_clauses_by_ikey_for_joins(Rel * rel,
* NOTE: returns nil if clause is an or_clause.
*
*/
-static CInfo *
+static CInfo *
match_clause_to_indexkey(Rel * rel,
Rel * index,
int indexkey,
@@ -590,12 +590,12 @@ match_clause_to_indexkey(Rel * rel,
CInfo * clauseInfo,
bool join)
{
- Expr *clause = clauseInfo->clause;
- Var *leftop,
- *rightop;
- Oid join_op = InvalidOid;
- Oid restrict_op = InvalidOid;
- bool isIndexable = false;
+ Expr *clause = clauseInfo->clause;
+ Var *leftop,
+ *rightop;
+ Oid join_op = InvalidOid;
+ Oid restrict_op = InvalidOid;
+ bool isIndexable = false;
if (or_clause((Node *) clause) ||
not_clause((Node *) clause) || single_node((Node *) clause))
@@ -719,12 +719,12 @@ match_clause_to_indexkey(Rel * rel,
* succeed whenever possible (assuming the predicate has been
* successfully cnfify()-ed). --Nels, Jan '93
*/
-static bool
+static bool
pred_test(List * predicate_list, List * clauseinfo_list, List * joininfo_list)
{
- List *pred,
- *items,
- *item;
+ List *pred,
+ *items,
+ *item;
/*
* Note: if Postgres tried to optimize queries by forming equivalence
@@ -770,11 +770,11 @@ pred_test(List * predicate_list, List * clauseinfo_list, List * joininfo_list)
* Does the "predicate inclusion test" for one conjunct of a predicate
* expression.
*/
-static bool
+static bool
one_pred_test(Expr * predicate, List * clauseinfo_list)
{
- CInfo *clauseinfo;
- List *item;
+ CInfo *clauseinfo;
+ List *item;
Assert(predicate != NULL);
foreach(item, clauseinfo_list)
@@ -793,11 +793,11 @@ one_pred_test(Expr * predicate, List * clauseinfo_list)
* Does the "predicate inclusion test" for a general restriction-clause
* expression.
*/
-static bool
+static bool
one_pred_clause_expr_test(Expr * predicate, Node * clause)
{
- List *items,
- *item;
+ List *items,
+ *item;
if (is_opclause(clause))
return one_pred_clause_test(predicate, clause);
@@ -840,11 +840,11 @@ one_pred_clause_expr_test(Expr * predicate, Node * clause)
* Does the "predicate inclusion test" for one conjunct of a predicate
* expression for a simple restriction clause.
*/
-static bool
+static bool
one_pred_clause_test(Expr * predicate, Node * clause)
{
- List *items,
- *item;
+ List *items,
+ *item;
if (is_opclause((Node *) predicate))
return clause_pred_clause_test(predicate, clause);
@@ -903,7 +903,7 @@ one_pred_clause_test(Expr * predicate, Node * clause)
* this test should always be considered false.
*/
-StrategyNumber BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = {
+StrategyNumber BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = {
{2, 2, 0, 0, 0},
{1, 2, 0, 0, 0},
{1, 2, 3, 4, 5},
@@ -922,29 +922,29 @@ StrategyNumber BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = {
* Eventually, rtree operators could also be handled by defining an
* appropriate "RT_implic_table" array.
*/
-static bool
+static bool
clause_pred_clause_test(Expr * predicate, Node * clause)
{
- Var *pred_var,
- *clause_var;
- Const *pred_const,
- *clause_const;
- Oid pred_op,
- clause_op,
- test_op;
- Oid opclass_id;
- StrategyNumber pred_strategy,
- clause_strategy,
- test_strategy;
- Oper *test_oper;
- Expr *test_expr;
- bool test_result,
- isNull;
- Relation relation;
- HeapScanDesc scan;
- HeapTuple tuple;
- ScanKeyData entry[3];
- Form_pg_amop form;
+ Var *pred_var,
+ *clause_var;
+ Const *pred_const,
+ *clause_const;
+ Oid pred_op,
+ clause_op,
+ test_op;
+ Oid opclass_id;
+ StrategyNumber pred_strategy,
+ clause_strategy,
+ test_strategy;
+ Oper *test_oper;
+ Expr *test_expr;
+ bool test_result,
+ isNull;
+ Relation relation;
+ HeapScanDesc scan;
+ HeapTuple tuple;
+ ScanKeyData entry[3];
+ Form_pg_amop form;
pred_var = (Var *) get_leftop(predicate);
pred_const = (Const *) get_rightop(predicate);
@@ -1120,14 +1120,14 @@ clause_pred_clause_test(Expr * predicate, Node * clause)
* when a key is in both join & restriction clauses. - vadim 03/18/97
*
*/
-static List *
+static List *
indexable_joinclauses(Rel * rel, Rel * index,
List * joininfo_list, List * clauseinfo_list)
{
- JInfo *joininfo = (JInfo *) NULL;
- List *cg_list = NIL;
- List *i = NIL;
- List *clausegroups = NIL;
+ JInfo *joininfo = (JInfo *) NULL;
+ List *cg_list = NIL;
+ List *i = NIL;
+ List *clausegroups = NIL;
foreach(i, joininfo_list)
{
@@ -1145,7 +1145,7 @@ indexable_joinclauses(Rel * rel, Rel * index,
if (clausegroups != NIL)
{
- List *clauses = lfirst(clausegroups);
+ List *clauses = lfirst(clausegroups);
((CInfo *) lfirst(clauses))->cinfojoinid =
joininfo->otherrels;
@@ -1165,15 +1165,15 @@ indexable_joinclauses(Rel * rel, Rel * index,
* This routine returns the restriction clauses only.
*/
#ifdef NOT_USED
-static List *
+static List *
extract_restrict_clauses(List * clausegroup)
{
- List *restrict_cls = NIL;
- List *l;
+ List *restrict_cls = NIL;
+ List *l;
foreach(l, clausegroup)
{
- CInfo *cinfo = lfirst(l);
+ CInfo *cinfo = lfirst(l);
if (!join_clause_p((Node *) cinfo->clause))
{
@@ -1196,21 +1196,21 @@ extract_restrict_clauses(List * clausegroup)
* Returns a list of index pathnodes.
*
*/
-static List *
+static List *
index_innerjoin(Query * root, Rel * rel, List * clausegroup_list, Rel * index)
{
- List *clausegroup = NIL;
- List *cg_list = NIL;
- List *i = NIL;
- IndexPath *pathnode = (IndexPath *) NULL;
- Cost temp_selec;
- float temp_pages;
+ List *clausegroup = NIL;
+ List *cg_list = NIL;
+ List *i = NIL;
+ IndexPath *pathnode = (IndexPath *) NULL;
+ Cost temp_selec;
+ float temp_pages;
foreach(i, clausegroup_list)
{
- List *attnos,
- *values,
- *flags;
+ List *attnos,
+ *values,
+ *flags;
clausegroup = lfirst(i);
pathnode = makeNode(IndexPath);
@@ -1281,24 +1281,24 @@ index_innerjoin(Query * root, Rel * rel, List * clausegroup_list, Rel * index)
* Returns a list of new index path nodes.
*
*/
-static List *
+static List *
create_index_paths(Query * root,
Rel * rel,
Rel * index,
List * clausegroup_list,
bool join)
{
- List *clausegroup = NIL;
- List *ip_list = NIL;
- List *i = NIL;
- List *j = NIL;
- IndexPath *temp_path;
+ List *clausegroup = NIL;
+ List *ip_list = NIL;
+ List *i = NIL;
+ List *j = NIL;
+ IndexPath *temp_path;
foreach(i, clausegroup_list)
{
- CInfo *clauseinfo;
- List *temp_node = NIL;
- bool temp = true;
+ CInfo *clauseinfo;
+ List *temp_node = NIL;
+ bool temp = true;
clausegroup = lfirst(i);
@@ -1324,21 +1324,21 @@ create_index_paths(Query * root,
return (ip_list);
}
-static List *
+static List *
add_index_paths(List * indexpaths, List * new_indexpaths)
{
return append(indexpaths, new_indexpaths);
}
-static bool
+static bool
function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index)
{
- Oid heapRelid = (Oid) lfirsti(rel->relids);
- Func *function;
- List *funcargs;
- int *indexKeys = index->indexkeys;
- List *arg;
- int i;
+ Oid heapRelid = (Oid) lfirsti(rel->relids);
+ Func *function;
+ List *funcargs;
+ int *indexKeys = index->indexkeys;
+ List *arg;
+ int i;
/*
* sanity check, make sure we know what we're dealing with here.
@@ -1390,7 +1390,7 @@ function_index_operand(Expr * funcOpnd, Rel * rel, Rel * index)
return true;
}
-static bool
+static bool
SingleAttributeIndex(Rel * index)
{
diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c
index c20558cf42..fe685aaaf1 100644
--- a/src/backend/optimizer/path/joinpath.c
+++ b/src/backend/optimizer/path/joinpath.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.3 1997/09/07 04:43:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.4 1997/09/08 02:24:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,19 +29,19 @@
#include "optimizer/cost.h" /* for _enable_{hashjoin,
* _enable_mergesort} */
-static Path *best_innerjoin(List * join_paths, List * outer_relid);
-static List *
+static Path *best_innerjoin(List * join_paths, List * outer_relid);
+static List *
sort_inner_and_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
List * mergeinfo_list);
-static List *
+static List *
match_unsorted_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
List * outerpath_list, Path * cheapest_inner, Path * best_innerjoin,
List * mergeinfo_list);
-static List *
+static List *
match_unsorted_inner(Rel * joinrel, Rel * outerrel, Rel * innerrel,
List * innerpath_list, List * mergeinfo_list);
-static bool EnoughMemoryForHashjoin(Rel * hashrel);
-static List *
+static bool EnoughMemoryForHashjoin(Rel * hashrel);
+static List *
hash_inner_and_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
List * hashinfo_list);
@@ -69,20 +69,20 @@ hash_inner_and_outer(Rel * joinrel, Rel * outerrel, Rel * innerrel,
void
find_all_join_paths(Query * root, List * joinrels)
{
- List *mergeinfo_list = NIL;
- List *hashinfo_list = NIL;
- List *temp_list = NIL;
- List *path = NIL;
+ List *mergeinfo_list = NIL;
+ List *hashinfo_list = NIL;
+ List *temp_list = NIL;
+ List *path = NIL;
while (joinrels != NIL)
{
- Rel *joinrel = (Rel *) lfirst(joinrels);
- List *innerrelids;
- List *outerrelids;
- Rel *innerrel;
- Rel *outerrel;
- Path *bestinnerjoin;
- List *pathlist = NIL;
+ Rel *joinrel = (Rel *) lfirst(joinrels);
+ List *innerrelids;
+ List *outerrelids;
+ Rel *innerrel;
+ Rel *outerrel;
+ Path *bestinnerjoin;
+ List *pathlist = NIL;
innerrelids = lsecond(joinrel->relids);
outerrelids = lfirst(joinrel->relids);
@@ -205,15 +205,15 @@ find_all_join_paths(Query * root, List * joinrels)
*
* Returns the pathnode of the selected path.
*/
-static Path *
+static Path *
best_innerjoin(List * join_paths, List * outer_relids)
{
- Path *cheapest = (Path *) NULL;
- List *join_path;
+ Path *cheapest = (Path *) NULL;
+ List *join_path;
foreach(join_path, join_paths)
{
- Path *path = (Path *) lfirst(join_path);
+ Path *path = (Path *) lfirst(join_path);
if (intMember(lfirsti(path->joinid), outer_relids)
&& ((cheapest == NULL ||
@@ -239,19 +239,19 @@ best_innerjoin(List * join_paths, List * outer_relids)
*
* Returns a list of mergesort paths.
*/
-static List *
+static List *
sort_inner_and_outer(Rel * joinrel,
Rel * outerrel,
Rel * innerrel,
List * mergeinfo_list)
{
- List *ms_list = NIL;
- MInfo *xmergeinfo = (MInfo *) NULL;
- MergePath *temp_node = (MergePath *) NULL;
- List *i;
- List *outerkeys = NIL;
- List *innerkeys = NIL;
- List *merge_pathkeys = NIL;
+ List *ms_list = NIL;
+ MInfo *xmergeinfo = (MInfo *) NULL;
+ MergePath *temp_node = (MergePath *) NULL;
+ List *i;
+ List *outerkeys = NIL;
+ List *innerkeys = NIL;
+ List *merge_pathkeys = NIL;
foreach(i, mergeinfo_list)
{
@@ -317,7 +317,7 @@ sort_inner_and_outer(Rel * joinrel,
*
* Returns a list of possible join path nodes.
*/
-static List *
+static List *
match_unsorted_outer(Rel * joinrel,
Rel * outerrel,
Rel * innerrel,
@@ -326,21 +326,21 @@ match_unsorted_outer(Rel * joinrel,
Path * best_innerjoin,
List * mergeinfo_list)
{
- Path *outerpath = (Path *) NULL;
- List *jp_list = NIL;
- List *temp_node = NIL;
- List *merge_pathkeys = NIL;
- Path *nestinnerpath = (Path *) NULL;
- List *paths = NIL;
- List *i = NIL;
- PathOrder *outerpath_ordering = NULL;
+ Path *outerpath = (Path *) NULL;
+ List *jp_list = NIL;
+ List *temp_node = NIL;
+ List *merge_pathkeys = NIL;
+ Path *nestinnerpath = (Path *) NULL;
+ List *paths = NIL;
+ List *i = NIL;
+ PathOrder *outerpath_ordering = NULL;
foreach(i, outerpath_list)
{
- List *clauses = NIL;
- List *matchedJoinKeys = NIL;
- List *matchedJoinClauses = NIL;
- MInfo *xmergeinfo = (MInfo *) NULL;
+ List *clauses = NIL;
+ List *matchedJoinKeys = NIL;
+ List *matchedJoinClauses = NIL;
+ MInfo *xmergeinfo = (MInfo *) NULL;
outerpath = (Path *) lfirst(i);
@@ -360,8 +360,8 @@ match_unsorted_outer(Rel * joinrel,
if (clauses)
{
- List *keys = xmergeinfo->jmethod.jmkeys;
- List *clauses = xmergeinfo->jmethod.clauses;
+ List *keys = xmergeinfo->jmethod.jmkeys;
+ List *clauses = xmergeinfo->jmethod.clauses;
matchedJoinKeys =
match_pathkeys_joinkeys(outerpath->keys,
@@ -397,9 +397,9 @@ match_unsorted_outer(Rel * joinrel,
if (clauses && matchedJoinKeys)
{
- bool path_is_cheaper_than_sort;
- List *varkeys = NIL;
- Path *mergeinnerpath =
+ bool path_is_cheaper_than_sort;
+ List *varkeys = NIL;
+ Path *mergeinnerpath =
match_paths_joinkeys(matchedJoinKeys,
outerpath_ordering,
innerrel->pathlist,
@@ -484,27 +484,27 @@ match_unsorted_outer(Rel * joinrel,
*
* Returns a list of possible merge paths.
*/
-static List *
+static List *
match_unsorted_inner(Rel * joinrel,
Rel * outerrel,
Rel * innerrel,
List * innerpath_list,
List * mergeinfo_list)
{
- Path *innerpath = (Path *) NULL;
- List *mp_list = NIL;
- List *temp_node = NIL;
- PathOrder *innerpath_ordering = NULL;
- Cost temp1 = 0.0;
- bool temp2 = false;
- List *i = NIL;
+ Path *innerpath = (Path *) NULL;
+ List *mp_list = NIL;
+ List *temp_node = NIL;
+ PathOrder *innerpath_ordering = NULL;
+ Cost temp1 = 0.0;
+ bool temp2 = false;
+ List *i = NIL;
foreach(i, innerpath_list)
{
- MInfo *xmergeinfo = (MInfo *) NULL;
- List *clauses = NIL;
- List *matchedJoinKeys = NIL;
- List *matchedJoinClauses = NIL;
+ MInfo *xmergeinfo = (MInfo *) NULL;
+ List *clauses = NIL;
+ List *matchedJoinKeys = NIL;
+ List *matchedJoinClauses = NIL;
innerpath = (Path *) lfirst(i);
@@ -524,8 +524,8 @@ match_unsorted_inner(Rel * joinrel,
if (clauses)
{
- List *keys = xmergeinfo->jmethod.jmkeys;
- List *cls = xmergeinfo->jmethod.clauses;
+ List *keys = xmergeinfo->jmethod.jmkeys;
+ List *cls = xmergeinfo->jmethod.clauses;
matchedJoinKeys =
match_pathkeys_joinkeys(innerpath->keys,
@@ -550,11 +550,11 @@ match_unsorted_inner(Rel * joinrel,
if (temp2)
{
- List *outerkeys =
+ List *outerkeys =
extract_path_keys(matchedJoinKeys,
outerrel->targetlist,
OUTER);
- List *merge_pathkeys =
+ List *merge_pathkeys =
new_join_pathkeys(outerkeys,
joinrel->targetlist,
clauses);
@@ -582,12 +582,12 @@ match_unsorted_inner(Rel * joinrel,
}
-static bool
+static bool
EnoughMemoryForHashjoin(Rel * hashrel)
{
- int ntuples;
- int tupsize;
- int pages;
+ int ntuples;
+ int tupsize;
+ int pages;
ntuples = hashrel->size;
if (ntuples == 0)
@@ -616,19 +616,19 @@ EnoughMemoryForHashjoin(Rel * hashrel)
*
* Returns a list of hashjoin paths.
*/
-static List *
+static List *
hash_inner_and_outer(Rel * joinrel,
Rel * outerrel,
Rel * innerrel,
List * hashinfo_list)
{
- HInfo *xhashinfo = (HInfo *) NULL;
- List *hjoin_list = NIL;
- HashPath *temp_node = (HashPath *) NULL;
- List *i = NIL;
- List *outerkeys = NIL;
- List *innerkeys = NIL;
- List *hash_pathkeys = NIL;
+ HInfo *xhashinfo = (HInfo *) NULL;
+ List *hjoin_list = NIL;
+ HashPath *temp_node = (HashPath *) NULL;
+ List *i = NIL;
+ List *outerkeys = NIL;
+ List *innerkeys = NIL;
+ List *hash_pathkeys = NIL;
foreach(i, hashinfo_list)
{
diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c
index 98762f9800..b1c1f0cb09 100644
--- a/src/backend/optimizer/path/joinrels.c
+++ b/src/backend/optimizer/path/joinrels.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.5 1997/09/07 04:43:40 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.6 1997/09/08 02:24:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,23 +24,23 @@
#include "optimizer/pathnode.h"
#ifdef USE_RIGHT_SIDED_PLANS
-bool _use_right_sided_plans_ = true;
+bool _use_right_sided_plans_ = true;
#else
-bool _use_right_sided_plans_ = false;
+bool _use_right_sided_plans_ = false;
#endif
-static List *find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list);
-static List *find_clauseless_joins(Rel * outer_rel, List * inner_rels);
-static Rel *init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo);
-static List *
+static List *find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list);
+static List *find_clauseless_joins(Rel * outer_rel, List * inner_rels);
+static Rel *init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo);
+static List *
new_join_tlist(List * tlist, List * other_relids,
int first_resdomno);
-static List *new_joininfo_list(List * joininfo_list, List * join_relids);
-static void add_superrels(Rel * rel, Rel * super_rel);
-static bool nonoverlap_rels(Rel * rel1, Rel * rel2);
-static bool nonoverlap_sets(List * s1, List * s2);
+static List *new_joininfo_list(List * joininfo_list, List * join_relids);
+static void add_superrels(Rel * rel, Rel * super_rel);
+static bool nonoverlap_rels(Rel * rel1, Rel * rel2);
+static bool nonoverlap_sets(List * s1, List * s2);
static void
set_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel,
JInfo * jinfo);
@@ -58,16 +58,16 @@ set_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel,
*
* Returns a list of rel nodes corresponding to the new join relations.
*/
-List *
+List *
find_join_rels(Query * root, List * outer_rels)
{
- List *joins = NIL;
- List *join_list = NIL;
- List *r = NIL;
+ List *joins = NIL;
+ List *join_list = NIL;
+ List *r = NIL;
foreach(r, outer_rels)
{
- Rel *outer_rel = (Rel *) lfirst(r);
+ Rel *outer_rel = (Rel *) lfirst(r);
if (!(joins = find_clause_joins(root, outer_rel, outer_rel->joininfo)))
if (BushyPlanFlag)
@@ -96,20 +96,20 @@ find_join_rels(Query * root, List * outer_rels)
*
* Returns a list of new join relations.
*/
-static List *
+static List *
find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list)
{
- List *join_list = NIL;
- List *i = NIL;
+ List *join_list = NIL;
+ List *i = NIL;
foreach(i, joininfo_list)
{
- JInfo *joininfo = (JInfo *) lfirst(i);
- Rel *rel;
+ JInfo *joininfo = (JInfo *) lfirst(i);
+ Rel *rel;
if (!joininfo->inactive)
{
- List *other_rels = joininfo->otherrels;
+ List *other_rels = joininfo->otherrels;
if (other_rels != NIL)
{
@@ -157,13 +157,13 @@ find_clause_joins(Query * root, Rel * outer_rel, List * joininfo_list)
*
* Returns a list of new join relations.
*/
-static List *
+static List *
find_clauseless_joins(Rel * outer_rel, List * inner_rels)
{
- Rel *inner_rel;
- List *t_list = NIL;
- List *temp_node = NIL;
- List *i = NIL;
+ Rel *inner_rel;
+ List *t_list = NIL;
+ List *temp_node = NIL;
+ List *i = NIL;
foreach(i, inner_rels)
{
@@ -192,13 +192,13 @@ find_clauseless_joins(Rel * outer_rel, List * inner_rels)
*
* Returns the new join relation node.
*/
-static Rel *
+static Rel *
init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
{
- Rel *joinrel = makeNode(Rel);
- List *joinrel_joininfo_list = NIL;
- List *new_outer_tlist;
- List *new_inner_tlist;
+ Rel *joinrel = makeNode(Rel);
+ List *joinrel_joininfo_list = NIL;
+ List *new_outer_tlist;
+ List *new_inner_tlist;
/*
* Create a new tlist by removing irrelevant elements from both tlists
@@ -272,18 +272,18 @@ init_join_rel(Rel * outer_rel, Rel * inner_rel, JInfo * joininfo)
*
* Returns the new target list.
*/
-static List *
+static List *
new_join_tlist(List * tlist,
List * other_relids,
int first_resdomno)
{
- int resdomno = first_resdomno - 1;
- TargetEntry *xtl = NULL;
- List *temp_node = NIL;
- List *t_list = NIL;
- List *i = NIL;
- List *join_list = NIL;
- bool in_final_tlist = false;
+ int resdomno = first_resdomno - 1;
+ TargetEntry *xtl = NULL;
+ List *temp_node = NIL;
+ List *t_list = NIL;
+ List *i = NIL;
+ List *join_list = NIL;
+ bool in_final_tlist = false;
foreach(i, tlist)
@@ -322,18 +322,18 @@ new_join_tlist(List * tlist,
*
* Returns a list of joininfo nodes, new and old.
*/
-static List *
+static List *
new_joininfo_list(List * joininfo_list, List * join_relids)
{
- List *current_joininfo_list = NIL;
- List *new_otherrels = NIL;
- JInfo *other_joininfo = (JInfo *) NULL;
- List *xjoininfo = NIL;
+ List *current_joininfo_list = NIL;
+ List *new_otherrels = NIL;
+ JInfo *other_joininfo = (JInfo *) NULL;
+ List *xjoininfo = NIL;
foreach(xjoininfo, joininfo_list)
{
- List *or;
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ List *or;
+ JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
new_otherrels = joininfo->otherrels;
foreach(or, new_otherrels)
@@ -389,42 +389,42 @@ new_joininfo_list(List * joininfo_list, List * join_relids)
void
add_new_joininfos(Query * root, List * joinrels, List * outerrels)
{
- List *xjoinrel = NIL;
- List *xrelid = NIL;
- List *xrel = NIL;
- List *xjoininfo = NIL;
+ List *xjoinrel = NIL;
+ List *xrelid = NIL;
+ List *xrel = NIL;
+ List *xjoininfo = NIL;
foreach(xjoinrel, joinrels)
{
- Rel *joinrel = (Rel *) lfirst(xjoinrel);
+ Rel *joinrel = (Rel *) lfirst(xjoinrel);
foreach(xrelid, joinrel->relids)
{
- Relid relid = (Relid) lfirst(xrelid);
- Rel *rel = get_join_rel(root, relid);
+ Relid relid = (Relid) lfirst(xrelid);
+ Rel *rel = get_join_rel(root, relid);
add_superrels(rel, joinrel);
}
}
foreach(xjoinrel, joinrels)
{
- Rel *joinrel = (Rel *) lfirst(xjoinrel);
+ Rel *joinrel = (Rel *) lfirst(xjoinrel);
foreach(xjoininfo, joinrel->joininfo)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
- List *other_rels = joininfo->otherrels;
- List *clause_info = joininfo->jinfoclauseinfo;
- bool mergesortable = joininfo->mergesortable;
- bool hashjoinable = joininfo->hashjoinable;
+ JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ List *other_rels = joininfo->otherrels;
+ List *clause_info = joininfo->jinfoclauseinfo;
+ bool mergesortable = joininfo->mergesortable;
+ bool hashjoinable = joininfo->hashjoinable;
foreach(xrelid, other_rels)
{
- Relid relid = (Relid) lfirst(xrelid);
- Rel *rel = get_join_rel(root, relid);
- List *super_rels = rel->superrels;
- List *xsuper_rel = NIL;
- JInfo *new_joininfo = makeNode(JInfo);
+ Relid relid = (Relid) lfirst(xrelid);
+ Rel *rel = get_join_rel(root, relid);
+ List *super_rels = rel->superrels;
+ List *xsuper_rel = NIL;
+ JInfo *new_joininfo = makeNode(JInfo);
new_joininfo->otherrels = joinrel->relids;
new_joininfo->jinfoclauseinfo = clause_info;
@@ -436,12 +436,12 @@ add_new_joininfos(Query * root, List * joinrels, List * outerrels)
foreach(xsuper_rel, super_rels)
{
- Rel *super_rel = (Rel *) lfirst(xsuper_rel);
+ Rel *super_rel = (Rel *) lfirst(xsuper_rel);
if (nonoverlap_rels(super_rel, joinrel))
{
- List *new_relids = super_rel->relids;
- JInfo *other_joininfo =
+ List *new_relids = super_rel->relids;
+ JInfo *other_joininfo =
joininfo_member(new_relids,
joinrel->joininfo);
@@ -453,7 +453,7 @@ add_new_joininfos(Query * root, List * joinrels, List * outerrels)
}
else
{
- JInfo *new_joininfo = makeNode(JInfo);
+ JInfo *new_joininfo = makeNode(JInfo);
new_joininfo->otherrels = new_relids;
new_joininfo->jinfoclauseinfo = clause_info;
@@ -471,7 +471,7 @@ add_new_joininfos(Query * root, List * joinrels, List * outerrels)
}
foreach(xrel, outerrels)
{
- Rel *rel = (Rel *) lfirst(xrel);
+ Rel *rel = (Rel *) lfirst(xrel);
rel->superrels = NIL;
}
@@ -486,12 +486,12 @@ add_new_joininfos(Query * root, List * joinrels, List * outerrels)
*
* Returns the list of final join relations.
*/
-List *
+List *
final_join_rels(List * join_rel_list)
{
- List *xrel = NIL;
- List *temp = NIL;
- List *t_list = NIL;
+ List *xrel = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
/*
* find the relations that has no further joins, i.e., its joininfos
@@ -499,13 +499,13 @@ final_join_rels(List * join_rel_list)
*/
foreach(xrel, join_rel_list)
{
- Rel *rel = (Rel *) lfirst(xrel);
- List *xjoininfo = NIL;
- bool final = true;
+ Rel *rel = (Rel *) lfirst(xrel);
+ List *xjoininfo = NIL;
+ bool final = true;
foreach(xjoininfo, rel->joininfo)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
if (joininfo->otherrels != NIL)
{
@@ -547,20 +547,20 @@ add_superrels(Rel * rel, Rel * super_rel)
*
* Returns non-nil if rel1 and rel2 do not overlap.
*/
-static bool
+static bool
nonoverlap_rels(Rel * rel1, Rel * rel2)
{
return (nonoverlap_sets(rel1->relids, rel2->relids));
}
-static bool
+static bool
nonoverlap_sets(List * s1, List * s2)
{
- List *x = NIL;
+ List *x = NIL;
foreach(x, s1)
{
- int e = lfirsti(x);
+ int e = lfirsti(x);
if (intMember(e, s2))
return (false);
@@ -571,8 +571,8 @@ nonoverlap_sets(List * s1, List * s2)
static void
set_joinrel_size(Rel * joinrel, Rel * outer_rel, Rel * inner_rel, JInfo * jinfo)
{
- int ntuples;
- float selec;
+ int ntuples;
+ float selec;
/*
* voodoo magic. but better than a size of 0. I have no idea why we
diff --git a/src/backend/optimizer/path/joinutils.c b/src/backend/optimizer/path/joinutils.c
index c88d3cf19e..1e297eee07 100644
--- a/src/backend/optimizer/path/joinutils.c
+++ b/src/backend/optimizer/path/joinutils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.2 1997/09/07 04:43:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.3 1997/09/08 02:24:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,11 +32,11 @@ match_pathkey_joinkeys(List * pathkey, List * joinkeys,
static bool
every_func(List * joinkeys, List * pathkey,
int which_subkey);
-static List *
+static List *
new_join_pathkey(List * subkeys,
List * considered_subkeys, List * join_rel_tlist,
List * joinclauses);
-static List *
+static List *
new_matching_subkeys(Var * subkey, List * considered_subkeys,
List * join_rel_tlist, List * joinclauses);
@@ -73,18 +73,18 @@ new_matching_subkeys(Var * subkey, List * considered_subkeys,
* Returns a list of matched join keys and a list of matched join clauses
* in matchedJoinClausesPtr. - ay 11/94
*/
-List *
+List *
match_pathkeys_joinkeys(List * pathkeys,
List * joinkeys,
List * joinclauses,
int which_subkey,
List ** matchedJoinClausesPtr)
{
- List *matched_joinkeys = NIL;
- List *matched_joinclauses = NIL;
- List *pathkey = NIL;
- List *i = NIL;
- int matched_joinkey_index = -1;
+ List *matched_joinkeys = NIL;
+ List *matched_joinclauses = NIL;
+ List *pathkey = NIL;
+ List *i = NIL;
+ int matched_joinkey_index = -1;
foreach(i, pathkeys)
{
@@ -94,8 +94,8 @@ match_pathkeys_joinkeys(List * pathkeys,
if (matched_joinkey_index != -1)
{
- List *xjoinkey = nth(matched_joinkey_index, joinkeys);
- List *joinclause = nth(matched_joinkey_index, joinclauses);
+ List *xjoinkey = nth(matched_joinkey_index, joinkeys);
+ List *joinclause = nth(matched_joinkey_index, joinclauses);
/* XXX was "push" function */
matched_joinkeys = lappend(matched_joinkeys, xjoinkey);
@@ -131,11 +131,11 @@ match_pathkey_joinkeys(List * pathkey,
List * joinkeys,
int which_subkey)
{
- Var *path_subkey;
- int pos;
- List *i = NIL;
- List *x = NIL;
- JoinKey *jk;
+ Var *path_subkey;
+ int pos;
+ List *i = NIL;
+ List *x = NIL;
+ JoinKey *jk;
foreach(i, pathkey)
{
@@ -174,15 +174,15 @@ match_pathkey_joinkeys(List * pathkey,
*
* Returns the matching path node if one exists, nil otherwise.
*/
-static bool
+static bool
every_func(List * joinkeys, List * pathkey, int which_subkey)
{
- JoinKey *xjoinkey;
- Var *temp;
- Var *tempkey = NULL;
- bool found = false;
- List *i = NIL;
- List *j = NIL;
+ JoinKey *xjoinkey;
+ Var *temp;
+ Var *tempkey = NULL;
+ bool found = false;
+ List *i = NIL;
+ List *j = NIL;
foreach(i, joinkeys)
{
@@ -211,19 +211,19 @@ every_func(List * joinkeys, List * pathkey, int which_subkey)
* match_paths_joinkeys -
* find the cheapest path that matches the join keys
*/
-Path *
+Path *
match_paths_joinkeys(List * joinkeys,
PathOrder * ordering,
List * paths,
int which_subkey)
{
- Path *matched_path = NULL;
- bool key_match = false;
- List *i = NIL;
+ Path *matched_path = NULL;
+ bool key_match = false;
+ List *i = NIL;
foreach(i, paths)
{
- Path *path = (Path *) lfirst(i);
+ Path *path = (Path *) lfirst(i);
key_match = every_func(joinkeys, path->keys, which_subkey);
@@ -263,20 +263,20 @@ match_paths_joinkeys(List * joinkeys,
* Returns a list of pathkeys: ((tlvar1)(tlvar2)...(tlvarN)).
* [I've no idea why they have to be list of lists. Should be fixed. -ay 12/94]
*/
-List *
+List *
extract_path_keys(List * joinkeys,
List * tlist,
int which_subkey)
{
- List *pathkeys = NIL;
- List *jk;
+ List *pathkeys = NIL;
+ List *jk;
foreach(jk, joinkeys)
{
- JoinKey *jkey = (JoinKey *) lfirst(jk);
- Var *var,
- *key;
- List *p;
+ JoinKey *jkey = (JoinKey *) lfirst(jk);
+ Var *var,
+ *key;
+ List *p;
/*
* find the right Var in the target list for this key
@@ -289,7 +289,7 @@ extract_path_keys(List * joinkeys,
*/
foreach(p, pathkeys)
{
- Var *pkey = lfirst((List *) lfirst(p)); /* XXX fix me */
+ Var *pkey = lfirst((List *) lfirst(p)); /* XXX fix me */
if (key == pkey)
break;
@@ -325,15 +325,15 @@ extract_path_keys(List * joinkeys,
* Returns the list of new path keys.
*
*/
-List *
+List *
new_join_pathkeys(List * outer_pathkeys,
List * join_rel_tlist,
List * joinclauses)
{
- List *outer_pathkey = NIL;
- List *t_list = NIL;
- List *x;
- List *i = NIL;
+ List *outer_pathkey = NIL;
+ List *t_list = NIL;
+ List *x;
+ List *i = NIL;
foreach(i, outer_pathkeys)
{
@@ -365,18 +365,18 @@ new_join_pathkeys(List * outer_pathkeys,
* Returns a new pathkey(list of subkeys).
*
*/
-static List *
+static List *
new_join_pathkey(List * subkeys,
List * considered_subkeys,
List * join_rel_tlist,
List * joinclauses)
{
- List *t_list = NIL;
- Var *subkey;
- List *i = NIL;
- List *matched_subkeys = NIL;
- Expr *tlist_key = (Expr *) NULL;
- List *newly_considered_subkeys = NIL;
+ List *t_list = NIL;
+ Var *subkey;
+ List *i = NIL;
+ List *matched_subkeys = NIL;
+ Expr *tlist_key = (Expr *) NULL;
+ List *newly_considered_subkeys = NIL;
foreach(i, subkeys)
{
@@ -425,17 +425,17 @@ new_join_pathkey(List * subkeys,
* Returns a list of new subkeys.
*
*/
-static List *
+static List *
new_matching_subkeys(Var * subkey,
List * considered_subkeys,
List * join_rel_tlist,
List * joinclauses)
{
- Expr *joinclause = NULL;
- List *t_list = NIL;
- List *temp = NIL;
- List *i = NIL;
- Expr *tlist_other_var = (Expr *) NULL;
+ Expr *joinclause = NULL;
+ List *t_list = NIL;
+ List *temp = NIL;
+ List *i = NIL;
+ Expr *tlist_other_var = (Expr *) NULL;
foreach(i, joinclauses)
{
diff --git a/src/backend/optimizer/path/mergeutils.c b/src/backend/optimizer/path/mergeutils.c
index 93004a6741..be5cc79d8d 100644
--- a/src/backend/optimizer/path/mergeutils.c
+++ b/src/backend/optimizer/path/mergeutils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.2 1997/09/07 04:43:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.3 1997/09/08 02:24:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,17 +33,17 @@
* Returns the new list of mergeinfo nodes.
*
*/
-List *
+List *
group_clauses_by_order(List * clauseinfo_list,
int inner_relid)
{
- List *mergeinfo_list = NIL;
- List *xclauseinfo = NIL;
+ List *mergeinfo_list = NIL;
+ List *xclauseinfo = NIL;
foreach(xclauseinfo, clauseinfo_list)
{
- CInfo *clauseinfo = (CInfo *) lfirst(xclauseinfo);
- MergeOrder *merge_ordering = clauseinfo->mergesortorder;
+ CInfo *clauseinfo = (CInfo *) lfirst(xclauseinfo);
+ MergeOrder *merge_ordering = clauseinfo->mergesortorder;
if (merge_ordering)
{
@@ -52,12 +52,12 @@ group_clauses_by_order(List * clauseinfo_list,
* Create a new mergeinfo node and add it to 'mergeinfo-list'
* if one does not yet exist for this merge ordering.
*/
- PathOrder p_ordering;
- MInfo *xmergeinfo;
- Expr *clause = clauseinfo->clause;
- Var *leftop = get_leftop(clause);
- Var *rightop = get_rightop(clause);
- JoinKey *keys;
+ PathOrder p_ordering;
+ MInfo *xmergeinfo;
+ Expr *clause = clauseinfo->clause;
+ Var *leftop = get_leftop(clause);
+ Var *rightop = get_rightop(clause);
+ JoinKey *keys;
p_ordering.ordtype = MERGE_ORDER;
p_ordering.ord.merge = merge_ordering;
@@ -105,15 +105,15 @@ group_clauses_by_order(List * clauseinfo_list,
* Returns the node if it exists.
*
*/
-MInfo *
+MInfo *
match_order_mergeinfo(PathOrder * ordering, List * mergeinfo_list)
{
- MergeOrder *xmergeorder;
- List *xmergeinfo = NIL;
+ MergeOrder *xmergeorder;
+ List *xmergeinfo = NIL;
foreach(xmergeinfo, mergeinfo_list)
{
- MInfo *mergeinfo = (MInfo *) lfirst(xmergeinfo);
+ MInfo *mergeinfo = (MInfo *) lfirst(xmergeinfo);
xmergeorder = mergeinfo->m_ordering;
diff --git a/src/backend/optimizer/path/orindxpath.c b/src/backend/optimizer/path/orindxpath.c
index 96408b7890..7b2da6c182 100644
--- a/src/backend/optimizer/path/orindxpath.c
+++ b/src/backend/optimizer/path/orindxpath.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.2 1997/09/07 04:43:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.3 1997/09/08 02:24:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,15 +50,15 @@ best_or_subclause_index(Query * root, Rel * rel, Expr * subclause,
* Returns a list of these index path nodes.
*
*/
-List *
+List *
create_or_index_paths(Query * root,
Rel * rel, List * clauses)
{
- List *t_list = NIL;
+ List *t_list = NIL;
if (clauses != NIL)
{
- CInfo *clausenode = (CInfo *) (lfirst(clauses));
+ CInfo *clausenode = (CInfo *) (lfirst(clauses));
/*
* Check to see if this clause is an 'or' clause, and, if so,
@@ -70,9 +70,9 @@ create_or_index_paths(Query * root,
if (valid_or_clause(clausenode) &&
clausenode->indexids)
{
- List *temp = NIL;
- List *index_list = NIL;
- bool index_flag = true;
+ List *temp = NIL;
+ List *index_list = NIL;
+ bool index_flag = true;
index_list = clausenode->indexids;
foreach(temp, index_list)
@@ -82,10 +82,10 @@ create_or_index_paths(Query * root,
}
if (index_flag)
{ /* used to be a lisp every function */
- IndexPath *pathnode = makeNode(IndexPath);
- List *indexids;
- Cost cost;
- List *selecs;
+ IndexPath *pathnode = makeNode(IndexPath);
+ List *indexids;
+ Cost cost;
+ List *selecs;
best_or_subclause_indices(root,
rel,
@@ -177,9 +177,9 @@ best_or_subclause_indices(Query * root,
}
else
{
- int best_indexid;
- Cost best_cost;
- Cost best_selec;
+ int best_indexid;
+ Cost best_cost;
+ Cost best_selec;
best_or_subclause_index(root, rel, lfirst(subclauses), lfirst(indices),
&best_indexid, &best_cost, &best_selec);
@@ -223,18 +223,18 @@ best_or_subclause_index(Query * root,
{
if (indices != NIL)
{
- Datum value;
- int flag = 0;
- Cost subcost;
- Rel *index = (Rel *) lfirst(indices);
- AttrNumber attno = (get_leftop(subclause))->varattno;
- Oid opno = ((Oper *) subclause->oper)->opno;
- bool constant_on_right = non_null((Expr *) get_rightop(subclause));
- float npages,
- selec;
- int subclause_indexid;
- Cost subclause_cost;
- Cost subclause_selec;
+ Datum value;
+ int flag = 0;
+ Cost subcost;
+ Rel *index = (Rel *) lfirst(indices);
+ AttrNumber attno = (get_leftop(subclause))->varattno;
+ Oid opno = ((Oper *) subclause->oper)->opno;
+ bool constant_on_right = non_null((Expr *) get_rightop(subclause));
+ float npages,
+ selec;
+ int subclause_indexid;
+ Cost subclause_cost;
+ Cost subclause_selec;
if (constant_on_right)
{
diff --git a/src/backend/optimizer/path/predmig.c b/src/backend/optimizer/path/predmig.c
index c302af3b58..f1990e13a0 100644
--- a/src/backend/optimizer/path/predmig.c
+++ b/src/backend/optimizer/path/predmig.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.3 1997/09/07 04:43:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.4 1997/09/08 02:24:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,28 +57,28 @@
static void
xfunc_predmig(JoinPath pathnode, Stream streamroot,
Stream laststream, bool * progressp);
-static bool xfunc_series_llel(Stream stream);
-static bool xfunc_llel_chains(Stream root, Stream bottom);
-static Stream xfunc_complete_stream(Stream stream);
+static bool xfunc_series_llel(Stream stream);
+static bool xfunc_llel_chains(Stream root, Stream bottom);
+static Stream xfunc_complete_stream(Stream stream);
static bool
xfunc_prdmig_pullup(Stream origstream, Stream pullme,
JoinPath joinpath);
-static void xfunc_form_groups(Stream root, Stream bottom);
-static void xfunc_free_stream(Stream root);
-static Stream xfunc_add_clauses(Stream current);
-static void xfunc_setup_group(Stream node, Stream bottom);
+static void xfunc_form_groups(Stream root, Stream bottom);
+static void xfunc_free_stream(Stream root);
+static Stream xfunc_add_clauses(Stream current);
+static void xfunc_setup_group(Stream node, Stream bottom);
static Stream
xfunc_streaminsert(CInfo clauseinfo, Stream current,
int clausetype);
-static int xfunc_num_relids(Stream node);
+static int xfunc_num_relids(Stream node);
static StreamPtr xfunc_get_downjoin(Stream node);
static StreamPtr xfunc_get_upjoin(Stream node);
-static Stream xfunc_stream_qsort(Stream root, Stream bottom);
-static int xfunc_stream_compare(void *arg1, void *arg2);
-static bool xfunc_check_stream(Stream node);
-static bool xfunc_in_stream(Stream node, Stream stream);
+static Stream xfunc_stream_qsort(Stream root, Stream bottom);
+static int xfunc_stream_compare(void *arg1, void *arg2);
+static bool xfunc_check_stream(Stream node);
+static bool xfunc_in_stream(Stream node, Stream stream);
-/* ----------------- MAIN FUNCTIONS ------------------------ */
+/* ----------------- MAIN FUNCTIONS ------------------------ */
/*
** xfunc_do_predmig
** wrapper for Predicate Migration. It calls xfunc_predmig until no
@@ -88,8 +88,8 @@ static bool xfunc_in_stream(Stream node, Stream stream);
bool
xfunc_do_predmig(Path root)
{
- bool progress,
- changed = false;
+ bool progress,
+ changed = false;
if (is_join(root))
do
@@ -122,7 +122,7 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */
* and the lowest node created so far */
bool * progressp)
{
- Stream newstream;
+ Stream newstream;
/*
* * traverse the join tree dfs-style, constructing a stream as you
@@ -153,7 +153,7 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */
if (!is_join(pathnode))
{
/* form a fleshed-out copy of the stream */
- Stream fullstream = xfunc_complete_stream(streamroot);
+ Stream fullstream = xfunc_complete_stream(streamroot);
/* sort it via series-llel */
if (xfunc_series_llel(fullstream))
@@ -188,9 +188,9 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */
static bool
xfunc_series_llel(Stream stream)
{
- Stream temp,
- next;
- bool progress = false;
+ Stream temp,
+ next;
+ bool progress = false;
for (temp = stream; temp != (Stream) NULL; temp = next)
{
@@ -219,11 +219,11 @@ xfunc_series_llel(Stream stream)
static bool
xfunc_llel_chains(Stream root, Stream bottom)
{
- bool progress = false;
- Stream origstream;
- Stream tmpstream,
- pathstream;
- Stream rootcopy = root;
+ bool progress = false;
+ Stream origstream;
+ Stream tmpstream,
+ pathstream;
+ Stream rootcopy = root;
Assert(xfunc_check_stream(root));
@@ -282,9 +282,9 @@ xfunc_llel_chains(Stream root, Stream bottom)
static Stream
xfunc_complete_stream(Stream stream)
{
- Stream tmpstream,
- copystream,
- curstream = (Stream) NULL;
+ Stream tmpstream,
+ copystream,
+ curstream = (Stream) NULL;
copystream = (Stream) copyObject((Node) stream);
Assert(xfunc_check_stream(copystream));
@@ -316,15 +316,15 @@ xfunc_complete_stream(Stream stream)
** nodes. We use the original stream to find out what joins are
** above the clause.
*/
-static bool
+static bool
xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
{
- CInfo clauseinfo = get_cinfo(pullme);
- bool progress = false;
- Stream upjoin,
- orignode,
- temp;
- int whichchild;
+ CInfo clauseinfo = get_cinfo(pullme);
+ bool progress = false;
+ Stream upjoin,
+ orignode,
+ temp;
+ int whichchild;
/* find node in origstream that contains clause */
for (orignode = origstream;
@@ -412,12 +412,12 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
static void
xfunc_form_groups(Query * queryInfo, Stream root, Stream bottom)
{
- Stream temp,
- parent;
- int lowest = xfunc_num_relids((Stream) xfunc_get_upjoin(bottom));
- bool progress;
- LispValue primjoin;
- int whichchild;
+ Stream temp,
+ parent;
+ int lowest = xfunc_num_relids((Stream) xfunc_get_upjoin(bottom));
+ bool progress;
+ LispValue primjoin;
+ int whichchild;
if (!lowest)
return; /* no joins in stream, so no groups */
@@ -495,7 +495,7 @@ xfunc_form_groups(Query * queryInfo, Stream root, Stream bottom)
}
-/* ------------------- UTILITY FUNCTIONS ------------------------- */
+/* ------------------- UTILITY FUNCTIONS ------------------------- */
/*
** xfunc_free_stream --
@@ -504,8 +504,8 @@ xfunc_form_groups(Query * queryInfo, Stream root, Stream bottom)
static void
xfunc_free_stream(Stream root)
{
- Stream cur,
- next;
+ Stream cur,
+ next;
Assert(xfunc_check_stream(root));
@@ -525,9 +525,9 @@ xfunc_free_stream(Stream root)
static Stream
xfunc_add_clauses(Stream current)
{
- Stream topnode = current;
- LispValue temp;
- LispValue primjoin;
+ Stream topnode = current;
+ LispValue temp;
+ LispValue primjoin;
/* first add in the local clauses */
foreach(temp, get_locclauseinfo((Path) get_pathptr(current)))
@@ -561,7 +561,7 @@ xfunc_add_clauses(Stream current)
static void
xfunc_setup_group(Stream node, Stream bottom)
{
- Stream temp;
+ Stream temp;
if (node != bottom)
/* traverse downwards */
@@ -598,12 +598,12 @@ xfunc_setup_group(Stream node, Stream bottom)
** Make a new Stream node to hold clause, and insert it above current.
** Return new node.
*/
-static Stream
+static Stream
xfunc_streaminsert(CInfo clauseinfo,
Stream current,
int clausetype) /* XFUNC_LOCPRD or XFUNC_JOINPRD */
{
- Stream newstream = RMakeStream();
+ Stream newstream = RMakeStream();
set_upstream(newstream, get_upstream(current));
if (get_upstream(current))
@@ -640,7 +640,7 @@ xfunc_num_relids(Stream node)
static StreamPtr
xfunc_get_downjoin(Stream node)
{
- Stream temp;
+ Stream temp;
if (!is_clause(node)) /* if this is a join */
node = (Stream) get_downstream(node);
@@ -658,7 +658,7 @@ xfunc_get_downjoin(Stream node)
static StreamPtr
xfunc_get_upjoin(Stream node)
{
- Stream temp;
+ Stream temp;
if (!is_clause(node)) /* if this is a join */
node = (Stream) get_upstream(node);
@@ -677,11 +677,11 @@ xfunc_get_upjoin(Stream node)
static Stream
xfunc_stream_qsort(Stream root, Stream bottom)
{
- int i;
- size_t num;
- Stream *nodearray,
- output;
- Stream tmp;
+ int i;
+ size_t num;
+ Stream *nodearray,
+ output;
+ Stream tmp;
/* find size of list */
for (num = 0, tmp = root; tmp != bottom;
@@ -725,10 +725,10 @@ xfunc_stream_qsort(Stream root, Stream bottom)
static int
xfunc_stream_compare(void *arg1, void *arg2)
{
- Stream stream1 = *(Stream *) arg1;
- Stream stream2 = *(Stream *) arg2;
- Cost rank1,
- rank2;
+ Stream stream1 = *(Stream *) arg1;
+ Stream stream2 = *(Stream *) arg2;
+ Cost rank1,
+ rank2;
rank1 = get_grouprank(stream1);
rank2 = get_grouprank(stream2);
@@ -765,7 +765,7 @@ xfunc_stream_compare(void *arg1, void *arg2)
}
}
-/* ------------------ DEBUGGING ROUTINES ---------------------------- */
+/* ------------------ DEBUGGING ROUTINES ---------------------------- */
/*
** Make sure all pointers in stream make sense. Make sure no joins are
@@ -774,9 +774,9 @@ xfunc_stream_compare(void *arg1, void *arg2)
static bool
xfunc_check_stream(Stream node)
{
- Stream temp;
- int numrelids,
- tmp;
+ Stream temp;
+ int numrelids,
+ tmp;
/* set numrelids higher than max */
if (!is_clause(node))
@@ -814,7 +814,7 @@ xfunc_check_stream(Stream node)
static bool
xfunc_in_stream(Stream node, Stream stream)
{
- Stream temp;
+ Stream temp;
for (temp = stream; temp; temp = (Stream) get_downstream(temp))
if (temp == node)
diff --git a/src/backend/optimizer/path/prune.c b/src/backend/optimizer/path/prune.c
index 4f3ae2d15d..209644c247 100644
--- a/src/backend/optimizer/path/prune.c
+++ b/src/backend/optimizer/path/prune.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.4 1997/09/07 04:43:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.5 1997/09/08 02:24:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
#include "utils/elog.h"
-static List *prune_joinrel(Rel * rel, List * other_rels);
+static List *prune_joinrel(Rel * rel, List * other_rels);
/*
* prune-joinrels--
@@ -34,10 +34,10 @@ static List *prune_joinrel(Rel * rel, List * other_rels);
* Returns the resulting list.
*
*/
-List *
+List *
prune_joinrels(List * rel_list)
{
- List *temp_list = NIL;
+ List *temp_list = NIL;
if (rel_list != NIL)
{
@@ -59,13 +59,13 @@ prune_joinrels(List * rel_list)
* of 'rel' appropriately.
*
*/
-static List *
+static List *
prune_joinrel(Rel * rel, List * other_rels)
{
- List *i = NIL;
- List *t_list = NIL;
- List *temp_node = NIL;
- Rel *other_rel = (Rel *) NULL;
+ List *i = NIL;
+ List *t_list = NIL;
+ List *temp_node = NIL;
+ Rel *other_rel = (Rel *) NULL;
foreach(i, other_rels)
{
@@ -99,11 +99,11 @@ prune_joinrel(Rel * rel, List * other_rels)
void
prune_rel_paths(List * rel_list)
{
- List *x = NIL;
- List *y = NIL;
- Path *path = NULL;
- Rel *rel = (Rel *) NULL;
- JoinPath *cheapest = (JoinPath *) NULL;
+ List *x = NIL;
+ List *y = NIL;
+ Path *path = NULL;
+ Rel *rel = (Rel *) NULL;
+ JoinPath *cheapest = (JoinPath *) NULL;
foreach(x, rel_list)
{
@@ -139,10 +139,10 @@ prune_rel_paths(List * rel_list)
* Returns the cheapest path.
*
*/
-Path *
+Path *
prune_rel_path(Rel * rel, Path * unorderedpath)
{
- Path *cheapest = set_cheapest(rel, rel->pathlist);
+ Path *cheapest = set_cheapest(rel, rel->pathlist);
/* don't prune if not pruneable -- JMH, 11/23/92 */
if (unorderedpath != cheapest
@@ -170,14 +170,14 @@ prune_rel_path(Rel * rel, Path * unorderedpath)
*
* Returns one pruned rel node list
*/
-List *
+List *
merge_joinrels(List * rel_list1, List * rel_list2)
{
- List *xrel = NIL;
+ List *xrel = NIL;
foreach(xrel, rel_list1)
{
- Rel *rel = (Rel *) lfirst(xrel);
+ Rel *rel = (Rel *) lfirst(xrel);
rel_list2 = prune_joinrel(rel, rel_list2);
}
@@ -196,12 +196,12 @@ merge_joinrels(List * rel_list1, List * rel_list2)
*
* Returns a new list of rel nodes
*/
-List *
+List *
prune_oldrels(List * old_rels)
{
- Rel *rel;
- List *joininfo_list,
- *xjoininfo;
+ Rel *rel;
+ List *joininfo_list,
+ *xjoininfo;
if (old_rels == NIL)
return (NIL);
@@ -213,7 +213,7 @@ prune_oldrels(List * old_rels)
foreach(xjoininfo, joininfo_list)
{
- JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
+ JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
if (!joininfo->inactive)
return (lcons(rel, prune_oldrels(lnext(old_rels))));
diff --git a/src/backend/optimizer/path/xfunc.c b/src/backend/optimizer/path/xfunc.c
index 36135d4a82..061a2996c8 100644
--- a/src/backend/optimizer/path/xfunc.c
+++ b/src/backend/optimizer/path/xfunc.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.4 1997/09/07 04:43:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.5 1997/09/08 02:24:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,13 +62,13 @@ xfunc_card_unreferenced(Query * queryInfo,
void
xfunc_trypullup(Rel rel)
{
- LispValue y; /* list ptr */
- CInfo maxcinfo; /* The CInfo to pull up, as calculated by
+ LispValue y; /* list ptr */
+ CInfo maxcinfo; /* The CInfo to pull up, as calculated by
* xfunc_shouldpull() */
- JoinPath curpath; /* current path in list */
- int progress; /* has progress been made this time
+ JoinPath curpath; /* current path in list */
+ int progress; /* has progress been made this time
* through? */
- int clausetype;
+ int clausetype;
do
{
@@ -153,17 +153,16 @@ xfunc_shouldpull(Query * queryInfo,
CInfo * maxcinfopt) /* Out: pointer to clause to
* pullup */
{
- LispValue clauselist,
- tmplist; /* lists of clauses */
- CInfo maxcinfo; /* clause to pullup */
- LispValue primjoinclause /* primary join clause */
+ LispValue clauselist,
+ tmplist; /* lists of clauses */
+ CInfo maxcinfo; /* clause to pullup */
+ LispValue primjoinclause /* primary join clause */
= xfunc_primary_join(parentpath);
- Cost tmprank,
- maxrank = (-1 * MAXFLOAT); /* ranks of clauses */
- Cost joinselec = 0; /* selectivity of the join
- * predicate */
- Cost joincost = 0; /* join cost + primjoinclause cost */
- int retval = XFUNC_LOCPRD;
+ Cost tmprank,
+ maxrank = (-1 * MAXFLOAT); /* ranks of clauses */
+ Cost joinselec = 0; /* selectivity of the join predicate */
+ Cost joincost = 0; /* join cost + primjoinclause cost */
+ int retval = XFUNC_LOCPRD;
clauselist = get_locclauseinfo(childpath);
@@ -275,11 +274,11 @@ xfunc_pullup(Query * queryInfo,
int whichchild, /* whether child is INNER or OUTER of join */
int clausetype) /* whether clause to pull is join or local */
{
- Path newkid;
- Rel newrel;
- Cost pulled_selec;
- Cost cost;
- CInfo newinfo;
+ Path newkid;
+ Rel newrel;
+ Cost pulled_selec;
+ Cost cost;
+ CInfo newinfo;
/* remove clause from childpath */
newkid = (Path) copyObject((Node) childpath);
@@ -363,8 +362,8 @@ xfunc_pullup(Query * queryInfo,
Cost
xfunc_rank(Query * queryInfo, LispValue clause)
{
- Cost selec = compute_clause_selec(queryInfo, clause, LispNil);
- Cost cost = xfunc_expense(queryInfo, clause);
+ Cost selec = compute_clause_selec(queryInfo, clause, LispNil);
+ Cost cost = xfunc_expense(queryInfo, clause);
if (cost == 0)
if (selec > 1)
@@ -381,13 +380,13 @@ xfunc_rank(Query * queryInfo, LispValue clause)
*/
Cost
xfunc_expense(Query * queryInfo, clause)
-LispValue clause;
+LispValue clause;
{
- Cost cost = xfunc_local_expense(clause);
+ Cost cost = xfunc_local_expense(clause);
if (cost)
{
- Count card = xfunc_card_unreferenced(queryInfo, clause, LispNil);
+ Count card = xfunc_card_unreferenced(queryInfo, clause, LispNil);
if (card)
cost /= card;
@@ -403,15 +402,15 @@ LispValue clause;
Cost
xfunc_join_expense(Query * queryInfo, JoinPath path, int whichchild)
{
- LispValue primjoinclause = xfunc_primary_join(path);
+ LispValue primjoinclause = xfunc_primary_join(path);
/*
* * the second argument to xfunc_card_unreferenced reflects all the *
* relations involved in the join clause, i.e. all the relids in the
* Rel * of the join clause
*/
- Count card = 0;
- Cost cost = xfunc_expense_per_tuple(path, whichchild);
+ Count card = 0;
+ Cost cost = xfunc_expense_per_tuple(path, whichchild);
card = xfunc_card_unreferenced(queryInfo,
primjoinclause,
@@ -432,8 +431,8 @@ xfunc_join_expense(Query * queryInfo, JoinPath path, int whichchild)
Cost
xfunc_local_expense(LispValue clause)
{
- Cost cost = 0; /* running expense */
- LispValue tmpclause;
+ Cost cost = 0; /* running expense */
+ LispValue tmpclause;
/* First handle the base case */
if (IsA(clause, Const) || IsA(clause, Var) || IsA(clause, Param))
@@ -484,15 +483,15 @@ xfunc_local_expense(LispValue clause)
Cost
xfunc_func_expense(LispValue node, LispValue args)
{
- HeapTuple tupl; /* the pg_proc tuple for each function */
- Form_pg_proc proc; /* a data structure to hold the pg_proc
+ HeapTuple tupl; /* the pg_proc tuple for each function */
+ Form_pg_proc proc; /* a data structure to hold the pg_proc
* tuple */
- int width = 0; /* byte width of the field referenced by
+ int width = 0; /* byte width of the field referenced by
* each clause */
- RegProcedure funcid; /* ID of function associate with node */
- Cost cost = 0; /* running expense */
- LispValue tmpclause;
- LispValue operand; /* one operand of an operator */
+ RegProcedure funcid; /* ID of function associate with node */
+ Cost cost = 0; /* running expense */
+ LispValue tmpclause;
+ LispValue operand; /* one operand of an operator */
if (IsA(node, Oper))
{
@@ -517,15 +516,15 @@ xfunc_func_expense(LispValue node, LispValue args)
*/
if (proc->prolang == SQLlanguageId)
{
- LispValue tmpplan;
- List planlist;
+ LispValue tmpplan;
+ List planlist;
if (IsA(node, Oper) || get_func_planlist((Func) node) == LispNil)
{
- Oid *argOidVect; /* vector of argtypes */
- char *pq_src; /* text of PQ function */
- int nargs; /* num args to PQ function */
- QueryTreeList *queryTree_list; /* dummy variable */
+ Oid *argOidVect; /* vector of argtypes */
+ char *pq_src; /* text of PQ function */
+ int nargs; /* num args to PQ function */
+ QueryTreeList *queryTree_list; /* dummy variable */
/*
* * plan the function, storing it in the Func node for later *
@@ -599,10 +598,10 @@ xfunc_func_expense(LispValue node, LispValue args)
int
xfunc_width(LispValue clause)
{
- Relation rd; /* Relation Descriptor */
- HeapTuple tupl; /* structure to hold a cached tuple */
- TypeTupleForm type; /* structure to hold a type tuple */
- int retval = 0;
+ Relation rd; /* Relation Descriptor */
+ HeapTuple tupl; /* structure to hold a cached tuple */
+ TypeTupleForm type; /* structure to hold a type tuple */
+ int retval = 0;
if (IsA(clause, Const))
{
@@ -695,7 +694,7 @@ xfunc_width(LispValue clause)
}
else if (fast_is_funcclause(clause))
{
- Func func = (Func) get_function(clause);
+ Func func = (Func) get_function(clause);
if (get_func_tlist(func) != LispNil)
{
@@ -735,13 +734,13 @@ exit:
** User may pass in referenced list, if they know it (useful
** for joins).
*/
-static Count
+static Count
xfunc_card_unreferenced(Query * queryInfo,
LispValue clause, Relid referenced)
{
- Relid unreferenced,
- allrelids = LispNil;
- LispValue temp;
+ Relid unreferenced,
+ allrelids = LispNil;
+ LispValue temp;
/* find all relids of base relations referenced in query */
foreach(temp, queryInfo->base_relation_list_)
@@ -766,11 +765,11 @@ xfunc_card_unreferenced(Query * queryInfo,
Count
xfunc_card_product(Query * queryInfo, Relid relids)
{
- LispValue cinfonode;
- LispValue temp;
- Rel currel;
- Cost tuples;
- Count retval = 0;
+ LispValue cinfonode;
+ LispValue temp;
+ Rel currel;
+ Cost tuples;
+ Count retval = 0;
foreach(temp, relids)
{
@@ -808,8 +807,8 @@ xfunc_card_product(Query * queryInfo, Relid relids)
List
xfunc_find_references(LispValue clause)
{
- List retval = (List) LispNil;
- LispValue tmpclause;
+ List retval = (List) LispNil;
+ LispValue tmpclause;
/* Base cases */
if (IsA(clause, Var))
@@ -870,12 +869,12 @@ xfunc_find_references(LispValue clause)
LispValue
xfunc_primary_join(JoinPath pathnode)
{
- LispValue joinclauselist = get_pathclauseinfo(pathnode);
- CInfo mincinfo;
- LispValue tmplist;
- LispValue minclause = LispNil;
- Cost minrank,
- tmprank;
+ LispValue joinclauselist = get_pathclauseinfo(pathnode);
+ CInfo mincinfo;
+ LispValue tmplist;
+ LispValue minclause = LispNil;
+ Cost minrank,
+ tmprank;
if (IsA(pathnode, MergePath))
{
@@ -932,9 +931,9 @@ xfunc_primary_join(JoinPath pathnode)
Cost
xfunc_get_path_cost(Query * queryInfo, Path pathnode)
{
- Cost cost = 0;
- LispValue tmplist;
- Cost selec = 1.0;
+ Cost cost = 0;
+ LispValue tmplist;
+ Cost selec = 1.0;
/*
* * first add in the expensive local function costs. * We ensure that
@@ -1025,12 +1024,12 @@ xfunc_get_path_cost(Query * queryInfo, Path pathnode)
Cost
xfunc_total_path_cost(JoinPath pathnode)
{
- Cost cost = xfunc_get_path_cost((Path) pathnode);
+ Cost cost = xfunc_get_path_cost((Path) pathnode);
Assert(IsA(pathnode, JoinPath));
if (IsA(pathnode, MergePath))
{
- MergePath mrgnode = (MergePath) pathnode;
+ MergePath mrgnode = (MergePath) pathnode;
cost += cost_mergesort(get_path_cost((Path) get_outerjoinpath(mrgnode)),
get_path_cost((Path) get_innerjoinpath(mrgnode)),
@@ -1049,7 +1048,7 @@ xfunc_total_path_cost(JoinPath pathnode)
}
else if (IsA(pathnode, HashPath))
{
- HashPath hashnode = (HashPath) pathnode;
+ HashPath hashnode = (HashPath) pathnode;
cost += cost_hashjoin(get_path_cost((Path) get_outerjoinpath(hashnode)),
get_path_cost((Path) get_innerjoinpath(hashnode)),
@@ -1105,10 +1104,10 @@ xfunc_total_path_cost(JoinPath pathnode)
Cost
xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
{
- Rel outerrel = get_parent((Path) get_outerjoinpath(joinnode));
- Rel innerrel = get_parent((Path) get_innerjoinpath(joinnode));
- Count outerwidth = get_width(outerrel);
- Count outers_per_page = ceil(BLCKSZ / (outerwidth + sizeof(HeapTupleData)));
+ Rel outerrel = get_parent((Path) get_outerjoinpath(joinnode));
+ Rel innerrel = get_parent((Path) get_innerjoinpath(joinnode));
+ Count outerwidth = get_width(outerrel);
+ Count outers_per_page = ceil(BLCKSZ / (outerwidth + sizeof(HeapTupleData)));
if (IsA(joinnode, HashPath))
{
@@ -1150,8 +1149,8 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
Rel rel, /* rel it's being pulled from */
int varno) /* whether rel is INNER or OUTER of join */
{
- LispValue tmpclause; /* temporary variable */
- TargetEntry *tle; /* tlist member corresponding to var */
+ LispValue tmpclause; /* temporary variable */
+ TargetEntry *tle; /* tlist member corresponding to var */
if (IsA(clause, Const) || IsA(clause, Param))
@@ -1205,11 +1204,11 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
int
xfunc_cinfo_compare(void *arg1, void *arg2)
{
- CInfo info1 = *(CInfo *) arg1;
- CInfo info2 = *(CInfo *) arg2;
+ CInfo info1 = *(CInfo *) arg1;
+ CInfo info2 = *(CInfo *) arg2;
- LispValue clause1 = (LispValue) get_clause(info1),
- clause2 = (LispValue) get_clause(info2);
+ LispValue clause1 = (LispValue) get_clause(info1),
+ clause2 = (LispValue) get_clause(info2);
return (xfunc_clause_compare((void *) &clause1, (void *) &clause2));
}
@@ -1222,10 +1221,10 @@ xfunc_cinfo_compare(void *arg1, void *arg2)
int
xfunc_clause_compare(void *arg1, void *arg2)
{
- LispValue clause1 = *(LispValue *) arg1;
- LispValue clause2 = *(LispValue *) arg2;
- Cost rank1, /* total xfunc rank of clause1 */
- rank2; /* total xfunc rank of clause2 */
+ LispValue clause1 = *(LispValue *) arg1;
+ LispValue clause2 = *(LispValue *) arg2;
+ Cost rank1, /* total xfunc rank of clause1 */
+ rank2; /* total xfunc rank of clause2 */
rank1 = xfunc_rank(clause1);
rank2 = xfunc_rank(clause2);
@@ -1247,7 +1246,7 @@ xfunc_clause_compare(void *arg1, void *arg2)
void
xfunc_disjunct_sort(LispValue clause_list)
{
- LispValue temp;
+ LispValue temp;
foreach(temp, clause_list)
if (or_clause(lfirst(temp)))
@@ -1264,14 +1263,14 @@ xfunc_disjunct_sort(LispValue clause_list)
int
xfunc_disjunct_compare(Query * queryInfo, void *arg1, void *arg2)
{
- LispValue disjunct1 = *(LispValue *) arg1;
- LispValue disjunct2 = *(LispValue *) arg2;
- Cost cost1, /* total cost of disjunct1 */
- cost2, /* total cost of disjunct2 */
- selec1,
- selec2;
- Cost rank1,
- rank2;
+ LispValue disjunct1 = *(LispValue *) arg1;
+ LispValue disjunct2 = *(LispValue *) arg2;
+ Cost cost1, /* total cost of disjunct1 */
+ cost2, /* total cost of disjunct2 */
+ selec1,
+ selec2;
+ Cost rank1,
+ rank2;
cost1 = xfunc_expense(queryInfo, disjunct1);
cost2 = xfunc_expense(queryInfo, disjunct2);
@@ -1310,12 +1309,12 @@ xfunc_disjunct_compare(Query * queryInfo, void *arg1, void *arg2)
int
xfunc_func_width(RegProcedure funcid, LispValue args)
{
- Relation rd; /* Relation Descriptor */
- HeapTuple tupl; /* structure to hold a cached tuple */
- Form_pg_proc proc; /* structure to hold the pg_proc tuple */
- TypeTupleForm type; /* structure to hold the pg_type tuple */
- LispValue tmpclause;
- int retval;
+ Relation rd; /* Relation Descriptor */
+ HeapTuple tupl; /* structure to hold a cached tuple */
+ Form_pg_proc proc; /* structure to hold the pg_proc tuple */
+ TypeTupleForm type; /* structure to hold the pg_type tuple */
+ LispValue tmpclause;
+ int retval;
/* lookup function and find its return type */
Assert(RegProcedureIsValid(funcid));
@@ -1370,9 +1369,9 @@ exit:
int
xfunc_tuple_width(Relation rd)
{
- int i;
- int retval = 0;
- TupleDesc tdesc = RelationGetTupleDescriptor(rd);
+ int i;
+ int retval = 0;
+ TupleDesc tdesc = RelationGetTupleDescriptor(rd);
for (i = 0; i < tdesc->natts; i++)
{
@@ -1392,7 +1391,7 @@ xfunc_tuple_width(Relation rd)
int
xfunc_num_join_clauses(JoinPath path)
{
- int num = length(get_pathclauseinfo(path));
+ int num = length(get_pathclauseinfo(path));
if (IsA(path, MergePath))
return (num + length(get_path_mergeclauses((MergePath) path)));
@@ -1409,9 +1408,9 @@ xfunc_num_join_clauses(JoinPath path)
LispValue
xfunc_LispRemove(LispValue foo, List bar)
{
- LispValue temp = LispNil;
- LispValue result = LispNil;
- int sanity = false;
+ LispValue temp = LispNil;
+ LispValue result = LispNil;
+ int sanity = false;
for (temp = bar; !null(temp); temp = lnext(temp))
if (!equal((Node) (foo), (Node) (lfirst(temp))))
@@ -1439,7 +1438,7 @@ xfunc_LispRemove(LispValue foo, List bar)
bool
xfunc_copyrel(Rel from, Rel * to)
{
- Rel newnode;
+ Rel newnode;
Pointer(*alloc) () = palloc;
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c
index bdceec18be..413389f475 100644
--- a/src/backend/optimizer/plan/createplan.c
+++ b/src/backend/optimizer/plan/createplan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.12 1997/09/07 04:43:57 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.13 1997/09/08 02:24:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,9 +44,9 @@
#define TEMP_SORT 1
#define TEMP_MATERIAL 2
-static List *switch_outer(List * clauses);
-static Scan *create_scan_node(Path * best_path, List * tlist);
-static Join *create_join_node(JoinPath * best_path, List * tlist);
+static List *switch_outer(List * clauses);
+static Scan *create_scan_node(Path * best_path, List * tlist);
+static Join *create_join_node(JoinPath * best_path, List * tlist);
static SeqScan *
create_seqscan_node(Path * best_path, List * tlist,
List * scan_clauses);
@@ -65,8 +65,8 @@ static HashJoin *
create_hashjoin_node(HashPath * best_path, List * tlist,
List * clauses, Plan * outer_node, List * outer_tlist,
Plan * inner_node, List * inner_tlist);
-static Node *fix_indxqual_references(Node * clause, Path * index_path);
-static Temp *
+static Node *fix_indxqual_references(Node * clause, Path * index_path);
+static Temp *
make_temp(List * tlist, List * keys, Oid * operators,
Plan * plan_node, int temptype);
static IndexScan *
@@ -78,7 +78,7 @@ make_nestloop(List * qptlist, List * qpqual, Plan * lefttree,
static HashJoin *
make_hashjoin(List * tlist, List * qpqual,
List * hashclauses, Plan * lefttree, Plan * righttree);
-static Hash *make_hash(List * tlist, Var * hashkey, Plan * lefttree);
+static Hash *make_hash(List * tlist, Var * hashkey, Plan * lefttree);
static MergeJoin *
make_mergesort(List * tlist, List * qpqual,
List * mergeclauses, Oid opcode, Oid * rightorder,
@@ -102,16 +102,16 @@ make_material(List * tlist, Oid tempid, Plan * lefttree,
*
* Returns the optimal(?) access plan.
*/
-Plan *
+Plan *
create_plan(Path * best_path)
{
- List *tlist;
- Plan *plan_node = (Plan *) NULL;
- Rel *parent_rel;
- int size;
- int width;
- int pages;
- int tuples;
+ List *tlist;
+ Plan *plan_node = (Plan *) NULL;
+ Rel *parent_rel;
+ int size;
+ int width;
+ int pages;
+ int tuples;
parent_rel = best_path->parent;
tlist = get_actual_tlist(parent_rel->targetlist);
@@ -122,18 +122,18 @@ create_plan(Path * best_path)
switch (best_path->pathtype)
{
- case T_IndexScan:
- case T_SeqScan:
- plan_node = (Plan *) create_scan_node(best_path, tlist);
- break;
- case T_HashJoin:
- case T_MergeJoin:
- case T_NestLoop:
- plan_node = (Plan *) create_join_node((JoinPath *) best_path, tlist);
- break;
- default:
- /* do nothing */
- break;
+ case T_IndexScan:
+ case T_SeqScan:
+ plan_node = (Plan *) create_scan_node(best_path, tlist);
+ break;
+ case T_HashJoin:
+ case T_MergeJoin:
+ case T_NestLoop:
+ plan_node = (Plan *) create_join_node((JoinPath *) best_path, tlist);
+ break;
+ default:
+ /* do nothing */
+ break;
}
plan_node->plan_size = size;
@@ -166,12 +166,12 @@ create_plan(Path * best_path)
*
* Returns the scan node.
*/
-static Scan *
+static Scan *
create_scan_node(Path * best_path, List * tlist)
{
- Scan *node = NULL;
- List *scan_clauses;
+ Scan *node = NULL;
+ List *scan_clauses;
/*
* Extract the relevant clauses from the parent relation and replace
@@ -186,20 +186,20 @@ create_scan_node(Path * best_path, List * tlist)
switch (best_path->pathtype)
{
- case T_SeqScan:
- node = (Scan *) create_seqscan_node(best_path, tlist, scan_clauses);
- break;
-
- case T_IndexScan:
- node = (Scan *) create_indexscan_node((IndexPath *) best_path,
- tlist,
- scan_clauses);
- break;
-
- default:
- elog(WARN, "create_scan_node: unknown node type",
- best_path->pathtype);
- break;
+ case T_SeqScan:
+ node = (Scan *) create_seqscan_node(best_path, tlist, scan_clauses);
+ break;
+
+ case T_IndexScan:
+ node = (Scan *) create_indexscan_node((IndexPath *) best_path,
+ tlist,
+ scan_clauses);
+ break;
+
+ default:
+ elog(WARN, "create_scan_node: unknown node type",
+ best_path->pathtype);
+ break;
}
return node;
@@ -215,15 +215,15 @@ create_scan_node(Path * best_path, List * tlist)
*
* Returns the join node.
*/
-static Join *
+static Join *
create_join_node(JoinPath * best_path, List * tlist)
{
- Plan *outer_node;
- List *outer_tlist;
- Plan *inner_node;
- List *inner_tlist;
- List *clauses;
- Join *retval = NULL;
+ Plan *outer_node;
+ List *outer_tlist;
+ Plan *inner_node;
+ List *inner_tlist;
+ List *clauses;
+ Join *retval = NULL;
outer_node = create_plan((Path *) best_path->outerjoinpath);
outer_tlist = outer_node->targetlist;
@@ -235,45 +235,45 @@ create_join_node(JoinPath * best_path, List * tlist)
switch (best_path->path.pathtype)
{
- case T_MergeJoin:
- retval = (Join *) create_mergejoin_node((MergePath *) best_path,
- tlist,
- clauses,
- outer_node,
- outer_tlist,
- inner_node,
- inner_tlist);
- break;
- case T_HashJoin:
- retval = (Join *) create_hashjoin_node((HashPath *) best_path,
- tlist,
- clauses,
- outer_node,
- outer_tlist,
- inner_node,
- inner_tlist);
- break;
- case T_NestLoop:
- retval = (Join *) create_nestloop_node((JoinPath *) best_path,
- tlist,
- clauses,
- outer_node,
- outer_tlist,
- inner_node,
- inner_tlist);
- break;
- default:
- /* do nothing */
- elog(WARN, "create_join_node: unknown node type",
- best_path->path.pathtype);
+ case T_MergeJoin:
+ retval = (Join *) create_mergejoin_node((MergePath *) best_path,
+ tlist,
+ clauses,
+ outer_node,
+ outer_tlist,
+ inner_node,
+ inner_tlist);
+ break;
+ case T_HashJoin:
+ retval = (Join *) create_hashjoin_node((HashPath *) best_path,
+ tlist,
+ clauses,
+ outer_node,
+ outer_tlist,
+ inner_node,
+ inner_tlist);
+ break;
+ case T_NestLoop:
+ retval = (Join *) create_nestloop_node((JoinPath *) best_path,
+ tlist,
+ clauses,
+ outer_node,
+ outer_tlist,
+ inner_node,
+ inner_tlist);
+ break;
+ default:
+ /* do nothing */
+ elog(WARN, "create_join_node: unknown node type",
+ best_path->path.pathtype);
}
#if 0
/*
* * Expensive function pullups may have pulled local predicates *
- * into this path node. Put them in the qpqual of the plan node. *
- * -- JMH, 6/15/92
+ * into this path node. Put them in the qpqual of the plan node. * --
+ * JMH, 6/15/92
*/
if (get_locclauseinfo(best_path) != NIL)
set_qpqual((Plan) retval,
@@ -300,9 +300,9 @@ create_join_node(JoinPath * best_path, List * tlist)
static SeqScan *
create_seqscan_node(Path * best_path, List * tlist, List * scan_clauses)
{
- SeqScan *scan_node = (SeqScan *) NULL;
- Index scan_relid = -1;
- List *temp;
+ SeqScan *scan_node = (SeqScan *) NULL;
+ Index scan_relid = -1;
+ List *temp;
temp = best_path->parent->relids;
if (temp == NULL)
@@ -335,15 +335,15 @@ create_indexscan_node(IndexPath * best_path,
* Extract the(first if conjunct, only if disjunct) clause from the
* clauseinfo list.
*/
- Expr *index_clause = (Expr *) NULL;
- List *indxqual = NIL;
- List *qpqual = NIL;
- List *fixed_indxqual = NIL;
- List *ixid;
- IndexScan *scan_node = (IndexScan *) NULL;
- bool lossy = FALSE;
- HeapTuple indexTuple;
- IndexTupleForm index;
+ Expr *index_clause = (Expr *) NULL;
+ List *indxqual = NIL;
+ List *qpqual = NIL;
+ List *fixed_indxqual = NIL;
+ List *ixid;
+ IndexScan *scan_node = (IndexScan *) NULL;
+ bool lossy = FALSE;
+ HeapTuple indexTuple;
+ IndexTupleForm index;
/*
* If an 'or' clause is to be used with this index, the indxqual field
@@ -358,7 +358,7 @@ create_indexscan_node(IndexPath * best_path,
if (or_clause((Node *) index_clause))
{
- List *temp = NIL;
+ List *temp = NIL;
foreach(temp, index_clause->args)
indxqual = lappend(indxqual, lcons(lfirst(temp), NIL));
@@ -438,7 +438,7 @@ create_nestloop_node(JoinPath * best_path,
Plan * inner_node,
List * inner_tlist)
{
- NestLoop *join_node = (NestLoop *) NULL;
+ NestLoop *join_node = (NestLoop *) NULL;
if (IsA(inner_node, IndexScan))
{
@@ -453,9 +453,9 @@ create_nestloop_node(JoinPath * best_path,
* case of multi-column indices. - vadim 03/18/97
*/
- List *inner_indxqual = lfirst(((IndexScan *) inner_node)->indxqual);
- List *inner_qual;
- bool found = false;
+ List *inner_indxqual = lfirst(((IndexScan *) inner_node)->indxqual);
+ List *inner_qual;
+ bool found = false;
foreach(inner_qual, inner_indxqual)
{
@@ -479,7 +479,7 @@ create_nestloop_node(JoinPath * best_path,
*/
if (found)
{
- List *new_inner_qual = NIL;
+ List *new_inner_qual = NIL;
clauses = set_difference(clauses, inner_indxqual); /* XXX */
new_inner_qual =
@@ -520,12 +520,12 @@ create_mergejoin_node(MergePath * best_path,
Plan * inner_node,
List * inner_tlist)
{
- List *qpqual,
- *mergeclauses;
- RegProcedure opcode;
- Oid *outer_order,
- *inner_order;
- MergeJoin *join_node;
+ List *qpqual,
+ *mergeclauses;
+ RegProcedure opcode;
+ Oid *outer_order,
+ *inner_order;
+ MergeJoin *join_node;
/*
@@ -564,11 +564,11 @@ create_mergejoin_node(MergePath * best_path,
*/
if (best_path->outersortkeys)
{
- Temp *sorted_outer_node = make_temp(outer_tlist,
+ Temp *sorted_outer_node = make_temp(outer_tlist,
best_path->outersortkeys,
- outer_order,
- outer_node,
- TEMP_SORT);
+ outer_order,
+ outer_node,
+ TEMP_SORT);
sorted_outer_node->plan.cost = outer_node->cost;
outer_node = (Plan *) sorted_outer_node;
@@ -576,11 +576,11 @@ create_mergejoin_node(MergePath * best_path,
if (best_path->innersortkeys)
{
- Temp *sorted_inner_node = make_temp(inner_tlist,
+ Temp *sorted_inner_node = make_temp(inner_tlist,
best_path->innersortkeys,
- inner_order,
- inner_node,
- TEMP_SORT);
+ inner_order,
+ inner_node,
+ TEMP_SORT);
sorted_inner_node->plan.cost = outer_node->cost;
inner_node = (Plan *) sorted_inner_node;
@@ -617,11 +617,11 @@ create_hashjoin_node(HashPath * best_path,
Plan * inner_node,
List * inner_tlist)
{
- List *qpqual;
- List *hashclauses;
- HashJoin *join_node;
- Hash *hash_node;
- Var *innerhashkey;
+ List *qpqual;
+ List *hashclauses;
+ HashJoin *join_node;
+ Hash *hash_node;
+ Var *innerhashkey;
/*
* Separate the hashclauses from the other join qualification clauses
@@ -662,18 +662,18 @@ create_hashjoin_node(HashPath * best_path,
*
*****************************************************************************/
-static Node *
+static Node *
fix_indxqual_references(Node * clause, Path * index_path)
{
- Node *newclause;
+ Node *newclause;
if (IsA(clause, Var))
{
if (lfirsti(index_path->parent->relids) == ((Var *) clause)->varno)
{
- int pos = 0;
- int varatt = ((Var *) clause)->varattno;
- int *indexkeys = ((IndexPath *) index_path)->indexkeys;
+ int pos = 0;
+ int varatt = ((Var *) clause)->varattno;
+ int *indexkeys = ((IndexPath *) index_path)->indexkeys;
if (indexkeys)
{
@@ -710,7 +710,7 @@ fix_indxqual_references(Node * clause, Path * index_path)
is_funcclause((Node *) get_leftop((Expr *) clause)) &&
((Func *) ((Expr *) get_leftop((Expr *) clause))->oper)->funcisindex)
{
- Var *newvar =
+ Var *newvar =
makeVar((Index) lfirsti(index_path->parent->relids),
1, /* func indices have one key */
((Func *) ((Expr *) clause)->oper)->functype,
@@ -725,10 +725,10 @@ fix_indxqual_references(Node * clause, Path * index_path)
}
else if (IsA(clause, Expr))
{
- Expr *expr = (Expr *) clause;
- List *new_subclauses = NIL;
- Node *subclause = NULL;
- List *i = NIL;
+ Expr *expr = (Expr *) clause;
+ List *new_subclauses = NIL;
+ Node *subclause = NULL;
+ List *i = NIL;
foreach(i, expr->args)
{
@@ -757,10 +757,10 @@ fix_indxqual_references(Node * clause, Path * index_path)
}
else
{
- List *oldclauses = (List *) clause;
- List *new_subclauses = NIL;
- Node *subclause = NULL;
- List *i = NIL;
+ List *oldclauses = (List *) clause;
+ List *new_subclauses = NIL;
+ Node *subclause = NULL;
+ List *i = NIL;
foreach(i, oldclauses)
{
@@ -799,14 +799,14 @@ fix_indxqual_references(Node * clause, Path * index_path)
*
* XXX Shouldn't the operator be commuted?!
*/
-static List *
+static List *
switch_outer(List * clauses)
{
- List *t_list = NIL;
- Expr *temp = NULL;
- List *i = NIL;
- Expr *clause;
- Node *op;
+ List *t_list = NIL;
+ Expr *temp = NULL;
+ List *i = NIL;
+ Expr *clause;
+ Node *op;
foreach(i, clauses)
{
@@ -843,13 +843,13 @@ switch_outer(List * clauses)
*
* Returns the modified target list.
*/
-static List *
+static List *
set_temp_tlist_operators(List * tlist, List * pathkeys, Oid * operators)
{
- Node *keys = NULL;
- int keyno = 1;
- Resdom *resdom = (Resdom *) NULL;
- List *i = NIL;
+ Node *keys = NULL;
+ int keyno = 1;
+ Resdom *resdom = (Resdom *) NULL;
+ List *i = NIL;
foreach(i, pathkeys)
{
@@ -891,15 +891,15 @@ set_temp_tlist_operators(List * tlist, List * pathkeys, Oid * operators)
* 'plan-node' is the node which yields tuples for the sort
* 'temptype' indicates which operation(sort or hash) to perform
*/
-static Temp *
+static Temp *
make_temp(List * tlist,
List * keys,
Oid * operators,
Plan * plan_node,
int temptype)
{
- List *temp_tlist;
- Temp *retval = NULL;
+ List *temp_tlist;
+ Temp *retval = NULL;
/* Create a new target list for the temporary, with keys set. */
temp_tlist = set_temp_tlist_operators(new_unsorted_tlist(tlist),
@@ -907,42 +907,42 @@ make_temp(List * tlist,
operators);
switch (temptype)
{
- case TEMP_SORT:
- retval = (Temp *) make_seqscan(tlist,
- NIL,
- _TEMP_RELATION_ID_,
- (Plan *) make_sort(temp_tlist,
+ case TEMP_SORT:
+ retval = (Temp *) make_seqscan(tlist,
+ NIL,
+ _TEMP_RELATION_ID_,
+ (Plan *) make_sort(temp_tlist,
_TEMP_RELATION_ID_,
- plan_node,
+ plan_node,
length(keys)));
- break;
+ break;
- case TEMP_MATERIAL:
- retval = (Temp *) make_seqscan(tlist,
- NIL,
- _TEMP_RELATION_ID_,
+ case TEMP_MATERIAL:
+ retval = (Temp *) make_seqscan(tlist,
+ NIL,
+ _TEMP_RELATION_ID_,
(Plan *) make_material(temp_tlist,
_TEMP_RELATION_ID_,
plan_node,
length(keys)));
- break;
+ break;
- default:
- elog(WARN, "make_temp: unknown temp type %d", temptype);
+ default:
+ elog(WARN, "make_temp: unknown temp type %d", temptype);
}
return (retval);
}
-SeqScan *
+SeqScan *
make_seqscan(List * qptlist,
List * qpqual,
Index scanrelid,
Plan * lefttree)
{
- SeqScan *node = makeNode(SeqScan);
- Plan *plan = &node->plan;
+ SeqScan *node = makeNode(SeqScan);
+ Plan *plan = &node->plan;
plan->cost = 0.0;
plan->state = (EState *) NULL;
@@ -963,8 +963,8 @@ make_indexscan(List * qptlist,
List * indxid,
List * indxqual)
{
- IndexScan *node = makeNode(IndexScan);
- Plan *plan = &node->scan.plan;
+ IndexScan *node = makeNode(IndexScan);
+ Plan *plan = &node->scan.plan;
plan->cost = 0.0;
plan->state = (EState *) NULL;
@@ -987,8 +987,8 @@ make_nestloop(List * qptlist,
Plan * lefttree,
Plan * righttree)
{
- NestLoop *node = makeNode(NestLoop);
- Plan *plan = &node->join;
+ NestLoop *node = makeNode(NestLoop);
+ Plan *plan = &node->join;
plan->cost = 0.0;
plan->state = (EState *) NULL;
@@ -1008,8 +1008,8 @@ make_hashjoin(List * tlist,
Plan * lefttree,
Plan * righttree)
{
- HashJoin *node = makeNode(HashJoin);
- Plan *plan = &node->join;
+ HashJoin *node = makeNode(HashJoin);
+ Plan *plan = &node->join;
plan->cost = 0.0;
plan->state = (EState *) NULL;
@@ -1026,11 +1026,11 @@ make_hashjoin(List * tlist,
return (node);
}
-static Hash *
+static Hash *
make_hash(List * tlist, Var * hashkey, Plan * lefttree)
{
- Hash *node = makeNode(Hash);
- Plan *plan = &node->plan;
+ Hash *node = makeNode(Hash);
+ Plan *plan = &node->plan;
plan->cost = 0.0;
plan->state = (EState *) NULL;
@@ -1056,8 +1056,8 @@ make_mergesort(List * tlist,
Plan * righttree,
Plan * lefttree)
{
- MergeJoin *node = makeNode(MergeJoin);
- Plan *plan = &node->join;
+ MergeJoin *node = makeNode(MergeJoin);
+ Plan *plan = &node->join;
plan->cost = 0.0;
plan->state = (EState *) NULL;
@@ -1073,11 +1073,11 @@ make_mergesort(List * tlist,
return (node);
}
-Sort *
+Sort *
make_sort(List * tlist, Oid tempid, Plan * lefttree, int keycount)
{
- Sort *node = makeNode(Sort);
- Plan *plan = &node->plan;
+ Sort *node = makeNode(Sort);
+ Plan *plan = &node->plan;
plan->cost = 0.0;
plan->state = (EState *) NULL;
@@ -1097,8 +1097,8 @@ make_material(List * tlist,
Plan * lefttree,
int keycount)
{
- Material *node = makeNode(Material);
- Plan *plan = &node->plan;
+ Material *node = makeNode(Material);
+ Plan *plan = &node->plan;
plan->cost = 0.0;
plan->state = (EState *) NULL;
@@ -1112,10 +1112,10 @@ make_material(List * tlist,
return (node);
}
-Agg *
+Agg *
make_agg(List * tlist, int nagg, Aggreg ** aggs)
{
- Agg *node = makeNode(Agg);
+ Agg *node = makeNode(Agg);
node->plan.cost = 0.0;
node->plan.state = (EState *) NULL;
@@ -1129,14 +1129,14 @@ make_agg(List * tlist, int nagg, Aggreg ** aggs)
return (node);
}
-Group *
+Group *
make_group(List * tlist,
bool tuplePerGroup,
int ngrp,
AttrNumber * grpColIdx,
Sort * lefttree)
{
- Group *node = makeNode(Group);
+ Group *node = makeNode(Group);
node->plan.cost = 0.0;
node->plan.state = (EState *) NULL;
@@ -1159,11 +1159,11 @@ make_group(List * tlist,
* or "*"
*/
-Unique *
+Unique *
make_unique(List * tlist, Plan * lefttree, char *uniqueAttr)
{
- Unique *node = makeNode(Unique);
- Plan *plan = &node->plan;
+ Unique *node = makeNode(Unique);
+ Plan *plan = &node->plan;
plan->cost = 0.0;
plan->state = (EState *) NULL;
@@ -1182,14 +1182,14 @@ make_unique(List * tlist, Plan * lefttree, char *uniqueAttr)
return (node);
}
-List *
+List *
generate_fjoin(List * tlist)
{
#if 0
- List tlistP;
- List newTlist = NIL;
- List fjoinList = NIL;
- int nIters = 0;
+ List tlistP;
+ List newTlist = NIL;
+ List fjoinList = NIL;
+ int nIters = 0;
/*
* Break the target list into elements with Iter nodes, and those
@@ -1197,7 +1197,7 @@ generate_fjoin(List * tlist)
*/
foreach(tlistP, tlist)
{
- List tlistElem;
+ List tlistElem;
tlistElem = lfirst(tlistP);
if (IsA(lsecond(tlistElem), Iter))
@@ -1216,11 +1216,11 @@ generate_fjoin(List * tlist)
*/
if (nIters > 0)
{
- List *inner;
- List *tempList;
- Fjoin *fjoinNode;
- DatumPtr results = (DatumPtr) palloc(nIters * sizeof(Datum));
- BoolPtr alwaysDone = (BoolPtr) palloc(nIters * sizeof(bool));
+ List *inner;
+ List *tempList;
+ Fjoin *fjoinNode;
+ DatumPtr results = (DatumPtr) palloc(nIters * sizeof(Datum));
+ BoolPtr alwaysDone = (BoolPtr) palloc(nIters * sizeof(bool));
inner = lfirst(fjoinList);
fjoinList = lnext(fjoinList);
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index 62ff23f207..ebc2324d7f 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.6 1997/09/07 04:44:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.7 1997/09/08 02:24:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,16 +33,16 @@
#include "optimizer/clauses.h"
#include "optimizer/cost.h"
-extern int Quiet;
+extern int Quiet;
-static void add_clause_to_rels(Query * root, List * clause);
+static void add_clause_to_rels(Query * root, List * clause);
static void
add_join_clause_info_to_rels(Query * root, CInfo * clauseinfo,
List * join_relids);
-static void add_vars_to_rels(Query * root, List * vars, List * join_relids);
+static void add_vars_to_rels(Query * root, List * vars, List * join_relids);
static MergeOrder *mergesortop(Expr * clause);
-static Oid hashjoinop(Expr * clause);
+static Oid hashjoinop(Expr * clause);
/*****************************************************************************
@@ -63,13 +63,13 @@ static Oid hashjoinop(Expr * clause);
void
initialize_base_rels_list(Query * root, List * tlist)
{
- List *tlist_vars = NIL;
- List *l = NIL;
- List *tvar = NIL;
+ List *tlist_vars = NIL;
+ List *l = NIL;
+ List *tvar = NIL;
foreach(l, tlist)
{
- TargetEntry *entry = (TargetEntry *) lfirst(l);
+ TargetEntry *entry = (TargetEntry *) lfirst(l);
tlist_vars = append(tlist_vars, pull_var_clause(entry->expr));
}
@@ -77,9 +77,9 @@ initialize_base_rels_list(Query * root, List * tlist)
/* now, the target list only contains Var nodes */
foreach(tvar, tlist_vars)
{
- Var *var;
- Index varno;
- Rel *result;
+ Var *var;
+ Index varno;
+ Rel *result;
var = (Var *) lfirst(tvar);
varno = var->varno;
@@ -100,16 +100,16 @@ initialize_base_rels_list(Query * root, List * tlist)
void
add_missing_vars_to_base_rels(Query * root, List * tlist)
{
- List *l;
- int varno;
+ List *l;
+ int varno;
varno = 1;
foreach(l, root->rtable)
{
- RangeTblEntry *rte = (RangeTblEntry *) lfirst(l);
- List *relids;
- Rel *result;
- Var *var;
+ RangeTblEntry *rte = (RangeTblEntry *) lfirst(l);
+ List *relids;
+ Rel *result;
+ Var *var;
relids = lconsi(varno, NIL);
if (rte->inFromCl &&
@@ -147,7 +147,7 @@ add_missing_vars_to_base_rels(Query * root, List * tlist)
void
initialize_base_rels_jinfo(Query * root, List * clauses)
{
- List *clause;
+ List *clause;
foreach(clause, clauses)
{
@@ -168,9 +168,9 @@ initialize_base_rels_jinfo(Query * root, List * clauses)
static void
add_clause_to_rels(Query * root, List * clause)
{
- List *relids;
- List *vars;
- CInfo *clauseinfo = makeNode(CInfo);
+ List *relids;
+ List *vars;
+ CInfo *clauseinfo = makeNode(CInfo);
/*
* Retrieve all relids and vars contained within the clause.
@@ -189,7 +189,7 @@ add_clause_to_rels(Query * root, List * clause)
if (length(relids) == 1)
{
- Rel *rel = get_base_rel(root, lfirsti(relids));
+ Rel *rel = get_base_rel(root, lfirsti(relids));
/*
* There is only one relation participating in 'clause', so
@@ -261,13 +261,13 @@ add_clause_to_rels(Query * root, List * clause)
static void
add_join_clause_info_to_rels(Query * root, CInfo * clauseinfo, List * join_relids)
{
- List *join_relid;
+ List *join_relid;
foreach(join_relid, join_relids)
{
- JInfo *joininfo;
- List *other_rels = NIL;
- List *rel;
+ JInfo *joininfo;
+ List *other_rels = NIL;
+ List *rel;
foreach(rel, join_relids)
{
@@ -302,10 +302,10 @@ add_join_clause_info_to_rels(Query * root, CInfo * clauseinfo, List * join_relid
static void
add_vars_to_rels(Query * root, List * vars, List * join_relids)
{
- Var *var;
- List *temp = NIL;
- Rel *rel = (Rel *) NULL;
- TargetEntry *tlistentry;
+ Var *var;
+ List *temp = NIL;
+ Rel *rel = (Rel *) NULL;
+ TargetEntry *tlistentry;
foreach(temp, vars)
{
@@ -336,13 +336,13 @@ add_vars_to_rels(Query * root, List * vars, List * join_relids)
void
initialize_join_clause_info(List * rel_list)
{
- List *x,
- *y,
- *z;
- Rel *rel;
- JInfo *joininfo;
- CInfo *clauseinfo;
- Expr *clause;
+ List *x,
+ *y,
+ *z;
+ Rel *rel;
+ JInfo *joininfo;
+ CInfo *clauseinfo;
+ Expr *clause;
foreach(x, rel_list)
{
@@ -356,8 +356,8 @@ initialize_join_clause_info(List * rel_list)
clause = clauseinfo->clause;
if (join_clause_p((Node *) clause))
{
- MergeOrder *sortop = (MergeOrder *) NULL;
- Oid hashop = (Oid) NULL;
+ MergeOrder *sortop = (MergeOrder *) NULL;
+ Oid hashop = (Oid) NULL;
if (_enable_mergesort_)
sortop = mergesortop(clause);
@@ -389,9 +389,9 @@ initialize_join_clause_info(List * rel_list)
static MergeOrder *
mergesortop(Expr * clause)
{
- Oid leftOp,
- rightOp;
- bool sortable;
+ Oid leftOp,
+ rightOp;
+ bool sortable;
sortable = op_mergesortable(((Oper *) clause->oper)->opno,
(get_leftop(clause))->vartype,
@@ -401,7 +401,7 @@ mergesortop(Expr * clause)
if (sortable)
{
- MergeOrder *morder = makeNode(MergeOrder);
+ MergeOrder *morder = makeNode(MergeOrder);
morder->join_operator = ((Oper *) clause->oper)->opno;
morder->left_operator = leftOp;
@@ -420,7 +420,7 @@ mergesortop(Expr * clause)
* hashjoinable, i.e., both operands are single vars and the operator is
* a hashjoinable operator.
*/
-static Oid
+static Oid
hashjoinop(Expr * clause)
{
return (op_hashjoinable(((Oper *) clause->oper)->opno,
diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c
index 630ed12d2a..029b34a24e 100644
--- a/src/backend/optimizer/plan/planmain.c
+++ b/src/backend/optimizer/plan/planmain.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.5 1997/09/07 04:44:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.6 1997/09/08 02:24:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,10 +38,10 @@
#include "utils/mcxt.h"
#include "utils/lsyscache.h"
-static Plan *subplanner(Query * root, List * flat_tlist, List * qual);
-static Result *make_result(List * tlist, Node * resconstantqual, Plan * subplan);
+static Plan *subplanner(Query * root, List * flat_tlist, List * qual);
+static Result *make_result(List * tlist, Node * resconstantqual, Plan * subplan);
-static Plan *
+static Plan *
make_groupPlan(List ** tlist, bool tuplePerGroup,
List * groupClause, Plan * subplan);
@@ -62,17 +62,17 @@ make_groupPlan(List ** tlist, bool tuplePerGroup,
*
* Returns a query plan.
*/
-Plan *
+Plan *
query_planner(Query * root,
int command_type,
List * tlist,
List * qual)
{
- List *constant_qual = NIL;
- List *flattened_tlist = NIL;
- List *level_tlist = NIL;
- Plan *subplan = (Plan *) NULL;
- Agg *aggplan = NULL;
+ List *constant_qual = NIL;
+ List *flattened_tlist = NIL;
+ List *level_tlist = NIL;
+ Plan *subplan = (Plan *) NULL;
+ Agg *aggplan = NULL;
/*
* A command without a target list or qualification is an error,
@@ -132,36 +132,36 @@ query_planner(Query * root,
switch (command_type)
{
- case CMD_SELECT:
- case CMD_INSERT:
- return ((Plan *) make_result(tlist,
- (Node *) constant_qual,
- (Plan *) NULL));
- break;
-
- case CMD_DELETE:
- case CMD_UPDATE:
- {
- SeqScan *scan = make_seqscan(tlist,
+ case CMD_SELECT:
+ case CMD_INSERT:
+ return ((Plan *) make_result(tlist,
+ (Node *) constant_qual,
+ (Plan *) NULL));
+ break;
+
+ case CMD_DELETE:
+ case CMD_UPDATE:
+ {
+ SeqScan *scan = make_seqscan(tlist,
(List *) NULL,
root->resultRelation,
(Plan *) NULL);
- if (constant_qual != NULL)
- {
- return ((Plan *) make_result(tlist,
- (Node *) constant_qual,
- (Plan *) scan));
+ if (constant_qual != NULL)
+ {
+ return ((Plan *) make_result(tlist,
+ (Node *) constant_qual,
+ (Plan *) scan));
+ }
+ else
+ {
+ return ((Plan *) scan);
+ }
}
- else
- {
- return ((Plan *) scan);
- }
- }
- break;
+ break;
- default:
- return ((Plan *) NULL);
+ default:
+ return ((Plan *) NULL);
}
}
@@ -180,7 +180,7 @@ query_planner(Query * root,
*/
if (root->groupClause != NULL)
{
- bool tuplePerGroup;
+ bool tuplePerGroup;
/*
* decide whether how many tuples per group the Group node needs
@@ -223,7 +223,7 @@ query_planner(Query * root,
*/
if (constant_qual)
{
- Plan *plan;
+ Plan *plan;
plan = (Plan *) make_result(tlist,
(Node *) constant_qual,
@@ -277,13 +277,13 @@ query_planner(Query * root,
* Returns a subplan.
*
*/
-static Plan *
+static Plan *
subplanner(Query * root,
List * flat_tlist,
List * qual)
{
- Rel *final_relation;
- List *final_relation_list;
+ Rel *final_relation;
+ List *final_relation_list;
/*
* Initialize the targetlist and qualification, adding entries to
@@ -323,7 +323,7 @@ subplanner(Query * root,
if (XfuncMode != XFUNC_OFF && XfuncMode != XFUNC_NOPM &&
XfuncMode != XFUNC_NOPULL && !final_relation->pruneable)
{
- List *pathnode;
+ List *pathnode;
foreach(pathnode, final_relation->pathlist)
{
@@ -353,13 +353,13 @@ subplanner(Query * root,
*
*****************************************************************************/
-static Result *
+static Result *
make_result(List * tlist,
Node * resconstantqual,
Plan * subplan)
{
- Result *node = makeNode(Result);
- Plan *plan = &node->plan;
+ Result *node = makeNode(Result);
+ Plan *plan = &node->plan;
tlist = generate_fjoin(tlist);
plan->cost = 0.0;
@@ -377,25 +377,25 @@ make_result(List * tlist,
*
*****************************************************************************/
-static Plan *
+static Plan *
make_groupPlan(List ** tlist,
bool tuplePerGroup,
List * groupClause,
Plan * subplan)
{
- List *sort_tlist;
- List *sl,
- *gl;
- List *glc = listCopy(groupClause);
- List *otles = NIL;/* list of removed non-GroupBy entries */
- List *otlvars = NIL; /* list of var in them */
- int otlvcnt;
- Sort *sortplan;
- Group *grpplan;
- int numCols;
- AttrNumber *grpColIdx;
- int keyno = 1;
- int last_resno = 1;
+ List *sort_tlist;
+ List *sl,
+ *gl;
+ List *glc = listCopy(groupClause);
+ List *otles = NIL; /* list of removed non-GroupBy entries */
+ List *otlvars = NIL; /* list of var in them */
+ int otlvcnt;
+ Sort *sortplan;
+ Group *grpplan;
+ int numCols;
+ AttrNumber *grpColIdx;
+ int keyno = 1;
+ int last_resno = 1;
numCols = length(groupClause);
grpColIdx = (AttrNumber *) palloc(sizeof(AttrNumber) * numCols);
@@ -412,12 +412,12 @@ make_groupPlan(List ** tlist,
*/
foreach(sl, sort_tlist)
{
- Resdom *resdom = NULL;
- TargetEntry *te = (TargetEntry *) lfirst(sl);
+ Resdom *resdom = NULL;
+ TargetEntry *te = (TargetEntry *) lfirst(sl);
foreach(gl, glc)
{
- GroupClause *grpcl = (GroupClause *) lfirst(gl);
+ GroupClause *grpcl = (GroupClause *) lfirst(gl);
if (grpcl->entry->resdom->resno == te->resdom->resno)
{
@@ -463,7 +463,7 @@ make_groupPlan(List ** tlist,
otlvcnt = length(otlvars);
foreach(gl, otlvars)
{
- Var *v = (Var *) lfirst(gl);
+ Var *v = (Var *) lfirst(gl);
if (tlist_member(v, sort_tlist) == NULL)
{
@@ -490,15 +490,15 @@ make_groupPlan(List ** tlist,
*/
foreach(sl, sort_tlist)
{
- TargetEntry *te = (TargetEntry *) lfirst(sl);
- Resdom *resdom = te->resdom;
- Node *expr = te->expr;
+ TargetEntry *te = (TargetEntry *) lfirst(sl);
+ Resdom *resdom = te->resdom;
+ Node *expr = te->expr;
if (IsA(expr, Var))
{
#if 0 /* subplanVar->resdom->resno expected to
* be = te->resdom->resno */
- TargetEntry *subplanVar;
+ TargetEntry *subplanVar;
subplanVar = match_varid((Var *) expr, subplan->targetlist);
((Var *) expr)->varattno = subplanVar->resdom->resno;
@@ -533,12 +533,12 @@ make_groupPlan(List ** tlist,
sort_tlist = NIL; /* to be new parent TL */
foreach(gl, *tlist)
{
- List *temp = NIL;
- TargetEntry *te = (TargetEntry *) lfirst(gl);
+ List *temp = NIL;
+ TargetEntry *te = (TargetEntry *) lfirst(gl);
foreach(temp, otles) /* Is it removed non-GroupBy entry ? */
{
- TargetEntry *ote = (TargetEntry *) lfirst(temp);
+ TargetEntry *ote = (TargetEntry *) lfirst(temp);
if (ote->resdom->resno == te->resdom->resno)
{
@@ -548,7 +548,7 @@ make_groupPlan(List ** tlist,
}
if (temp == NIL) /* It's "our" TLE - we're to return */
{ /* it from Sort/Group plans */
- TargetEntry *my = (TargetEntry *) lfirst(sl); /* get it */
+ TargetEntry *my = (TargetEntry *) lfirst(sl); /* get it */
sl = sl->next; /* prepare for the next "our" */
my = copyObject(my);
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 43441a3b7f..72352646b7 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.7 1997/09/07 04:44:03 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.8 1997/09/08 02:24:38 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,8 +47,8 @@
#include "executor/executor.h"
-static Plan *make_sortplan(List * tlist, List * sortcls, Plan * plannode);
-static Plan *init_query_planner(Query * parse);
+static Plan *make_sortplan(List * tlist, List * sortcls, Plan * plannode);
+static Plan *init_query_planner(Query * parse);
static Existential *make_existential(Plan * left, Plan * right);
/*****************************************************************************
@@ -68,18 +68,18 @@ static Existential *make_existential(Plan * left, Plan * right);
* Returns a query plan.
*
*/
-Plan *
+Plan *
planner(Query * parse)
{
- List *tlist = parse->targetList;
- List *rangetable = parse->rtable;
- char *uniqueflag = parse->uniqueFlag;
- List *sortclause = parse->sortClause;
- Plan *special_plans = (Plan *) NULL;
+ List *tlist = parse->targetList;
+ List *rangetable = parse->rtable;
+ char *uniqueflag = parse->uniqueFlag;
+ List *sortclause = parse->sortClause;
+ Plan *special_plans = (Plan *) NULL;
- Plan *result_plan = (Plan *) NULL;
+ Plan *result_plan = (Plan *) NULL;
- int rt_index;
+ int rt_index;
/*
* plan inheritance
@@ -119,7 +119,7 @@ planner(Query * parse)
if (uniqueflag)
{
- Plan *sortplan = make_sortplan(tlist, sortclause, result_plan);
+ Plan *sortplan = make_sortplan(tlist, sortclause, result_plan);
return ((Plan *) make_unique(tlist, sortplan, uniqueflag));
}
@@ -142,15 +142,15 @@ planner(Query * parse)
* sortkeys: ( resdom1 resdom2 resdom3 ...)
* sortops: (sortop1 sortop2 sortop3 ...)
*/
-static Plan *
+static Plan *
make_sortplan(List * tlist, List * sortcls, Plan * plannode)
{
- Plan *sortplan = (Plan *) NULL;
- List *temp_tlist = NIL;
- List *i = NIL;
- Resdom *resnode = (Resdom *) NULL;
- Resdom *resdom = (Resdom *) NULL;
- int keyno = 1;
+ Plan *sortplan = (Plan *) NULL;
+ List *temp_tlist = NIL;
+ List *i = NIL;
+ Resdom *resnode = (Resdom *) NULL;
+ Resdom *resdom = (Resdom *) NULL;
+ int keyno = 1;
/*
* First make a copy of the tlist so that we don't corrupt the the
@@ -161,7 +161,7 @@ make_sortplan(List * tlist, List * sortcls, Plan * plannode)
foreach(i, sortcls)
{
- SortClause *sortcl = (SortClause *) lfirst(i);
+ SortClause *sortcl = (SortClause *) lfirst(i);
resnode = sortcl->resdom;
resdom = tlist_resdom(temp_tlist, resnode);
@@ -203,13 +203,13 @@ make_sortplan(List * tlist, List * sortcls, Plan * plannode)
* MODIFIES: tlist,qual
*
*/
-static Plan *
+static Plan *
init_query_planner(Query * root)
{
- List *primary_qual;
- List *existential_qual;
- Existential *exist_plan;
- List *tlist = root->targetList;
+ List *primary_qual;
+ List *existential_qual;
+ Existential *exist_plan;
+ List *tlist = root->targetList;
tlist = preprocess_targetlist(tlist,
root->commandType,
@@ -230,8 +230,8 @@ init_query_planner(Query * root)
}
else
{
- int temp = root->commandType;
- Plan *existential_plan;
+ int temp = root->commandType;
+ Plan *existential_plan;
root->commandType = CMD_SELECT;
existential_plan = query_planner(root,
@@ -256,7 +256,7 @@ init_query_planner(Query * root)
static Existential *
make_existential(Plan * left, Plan * right)
{
- Existential *node = makeNode(Existential);
+ Existential *node = makeNode(Existential);
node->lefttree = left;
node->righttree = left;
@@ -275,17 +275,17 @@ make_existential(Plan * left, Plan * right)
void
pg_checkretval(Oid rettype, QueryTreeList * queryTreeList)
{
- Query *parse;
- List *tlist;
- List *rt;
- int cmd;
- Type typ;
- Resdom *resnode;
- Relation reln;
- Oid relid;
- Oid tletype;
- int relnatts;
- int i;
+ Query *parse;
+ List *tlist;
+ List *rt;
+ int cmd;
+ Type typ;
+ Resdom *resnode;
+ Relation reln;
+ Oid relid;
+ Oid tletype;
+ int relnatts;
+ int i;
/* find the final query */
parse = queryTreeList->qtrees[queryTreeList->len - 1];
@@ -383,8 +383,8 @@ pg_checkretval(Oid rettype, QueryTreeList * queryTreeList)
/* expect attributes 1 .. n in order */
for (i = 1; i <= relnatts; i++)
{
- TargetEntry *tle = lfirst(tlist);
- Node *thenode = tle->expr;
+ TargetEntry *tle = lfirst(tlist);
+ Node *thenode = tle->expr;
tlist = lnext(tlist);
tletype = exprType(thenode);
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index 19cee246a5..5a6e4da344 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.5 1997/09/07 04:44:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.6 1997/09/08 02:24:39 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,20 +33,20 @@
#include "optimizer/var.h"
#include "optimizer/tlist.h"
-static void set_join_tlist_references(Join * join);
-static void set_tempscan_tlist_references(SeqScan * tempscan);
-static void set_temp_tlist_references(Temp * temp);
-static List *
+static void set_join_tlist_references(Join * join);
+static void set_tempscan_tlist_references(SeqScan * tempscan);
+static void set_temp_tlist_references(Temp * temp);
+static List *
replace_clause_joinvar_refs(Expr * clause,
List * outer_tlist, List * inner_tlist);
-static List *
+static List *
replace_subclause_joinvar_refs(List * clauses,
List * outer_tlist, List * inner_tlist);
-static Var *replace_joinvar_refs(Var * var, List * outer_tlist, List * inner_tlist);
-static List *tlist_temp_references(Oid tempid, List * tlist);
-static void replace_result_clause(List * clause, List * subplanTargetList);
-static bool OperandIsInner(Node * opnd, int inner_relid);
-static void replace_agg_clause(Node * expr, List * targetlist);
+static Var *replace_joinvar_refs(Var * var, List * outer_tlist, List * inner_tlist);
+static List *tlist_temp_references(Oid tempid, List * tlist);
+static void replace_result_clause(List * clause, List * subplanTargetList);
+static bool OperandIsInner(Node * opnd, int inner_relid);
+static void replace_agg_clause(Node * expr, List * targetlist);
/*****************************************************************************
*
@@ -94,7 +94,7 @@ set_tlist_references(Plan * plan)
}
else if (IsA(plan, Choose))
{
- List *x;
+ List *x;
foreach(x, ((Choose *) plan)->chooseplanlist)
{
@@ -122,19 +122,19 @@ set_tlist_references(Plan * plan)
static void
set_join_tlist_references(Join * join)
{
- Plan *outer = ((Plan *) join)->lefttree;
- Plan *inner = ((Plan *) join)->righttree;
- List *new_join_targetlist = NIL;
- TargetEntry *temp = (TargetEntry *) NULL;
- List *entry = NIL;
- List *inner_tlist = NULL;
- List *outer_tlist = NULL;
- TargetEntry *xtl = (TargetEntry *) NULL;
- List *qptlist = ((Plan *) join)->targetlist;
+ Plan *outer = ((Plan *) join)->lefttree;
+ Plan *inner = ((Plan *) join)->righttree;
+ List *new_join_targetlist = NIL;
+ TargetEntry *temp = (TargetEntry *) NULL;
+ List *entry = NIL;
+ List *inner_tlist = NULL;
+ List *outer_tlist = NULL;
+ TargetEntry *xtl = (TargetEntry *) NULL;
+ List *qptlist = ((Plan *) join)->targetlist;
foreach(entry, qptlist)
{
- List *joinvar;
+ List *joinvar;
xtl = (TargetEntry *) lfirst(entry);
inner_tlist = ((inner == NULL) ? NIL : inner->targetlist);
@@ -167,7 +167,7 @@ set_join_tlist_references(Join * join)
static void
set_tempscan_tlist_references(SeqScan * tempscan)
{
- Temp *temp = (Temp *) ((Plan *) tempscan)->lefttree;
+ Temp *temp = (Temp *) ((Plan *) tempscan)->lefttree;
((Plan *) tempscan)->targetlist =
tlist_temp_references(temp->tempid,
@@ -189,7 +189,7 @@ set_tempscan_tlist_references(SeqScan * tempscan)
static void
set_temp_tlist_references(Temp * temp)
{
- Plan *source = ((Plan *) temp)->lefttree;
+ Plan *source = ((Plan *) temp)->lefttree;
if (source != NULL)
{
@@ -217,7 +217,7 @@ set_temp_tlist_references(Temp * temp)
* Returns the new join clauses.
*
*/
-List *
+List *
join_references(List * clauses,
List * outer_tlist,
List * inner_tlist)
@@ -243,15 +243,15 @@ join_references(List * clauses,
* Returns the new list of clauses.
*
*/
-List *
+List *
index_outerjoin_references(List * inner_indxqual,
List * outer_tlist,
Index inner_relid)
{
- List *t_list = NIL;
- Expr *temp = NULL;
- List *t_clause = NIL;
- Expr *clause = NULL;
+ List *t_list = NIL;
+ Expr *temp = NULL;
+ List *t_clause = NIL;
+ Expr *clause = NULL;
foreach(t_clause, inner_indxqual)
{
@@ -262,7 +262,7 @@ index_outerjoin_references(List * inner_indxqual,
*/
if (OperandIsInner((Node *) get_rightop(clause), inner_relid))
{
- Var *joinvar = (Var *)
+ Var *joinvar = (Var *)
replace_clause_joinvar_refs((Expr *) get_leftop(clause),
outer_tlist,
NIL);
@@ -275,7 +275,7 @@ index_outerjoin_references(List * inner_indxqual,
else
{
/* inner scan on left */
- Var *joinvar = (Var *)
+ Var *joinvar = (Var *)
replace_clause_joinvar_refs((Expr *) get_rightop(clause),
outer_tlist,
NIL);
@@ -306,12 +306,12 @@ index_outerjoin_references(List * inner_indxqual,
* Returns the new join clause.
*
*/
-static List *
+static List *
replace_clause_joinvar_refs(Expr * clause,
List * outer_tlist,
List * inner_tlist)
{
- List *temp = NULL;
+ List *temp = NULL;
if (IsA(clause, Var))
{
@@ -330,7 +330,7 @@ replace_clause_joinvar_refs(Expr * clause,
}
else if (or_clause((Node *) clause))
{
- List *orclause =
+ List *orclause =
replace_subclause_joinvar_refs(((Expr *) clause)->args,
outer_tlist,
inner_tlist);
@@ -339,7 +339,7 @@ replace_clause_joinvar_refs(Expr * clause,
}
else if (IsA(clause, ArrayRef))
{
- ArrayRef *aref = (ArrayRef *) clause;
+ ArrayRef *aref = (ArrayRef *) clause;
temp = replace_subclause_joinvar_refs(aref->refupperindexpr,
outer_tlist,
@@ -365,7 +365,7 @@ replace_clause_joinvar_refs(Expr * clause,
}
else if (is_funcclause((Node *) clause))
{
- List *funcclause =
+ List *funcclause =
replace_subclause_joinvar_refs(((Expr *) clause)->args,
outer_tlist,
inner_tlist);
@@ -375,7 +375,7 @@ replace_clause_joinvar_refs(Expr * clause,
}
else if (not_clause((Node *) clause))
{
- List *notclause =
+ List *notclause =
replace_clause_joinvar_refs(get_notclausearg(clause),
outer_tlist,
inner_tlist);
@@ -384,11 +384,11 @@ replace_clause_joinvar_refs(Expr * clause,
}
else if (is_opclause((Node *) clause))
{
- Var *leftvar =
+ Var *leftvar =
(Var *) replace_clause_joinvar_refs((Expr *) get_leftop(clause),
outer_tlist,
inner_tlist);
- Var *rightvar =
+ Var *rightvar =
(Var *) replace_clause_joinvar_refs((Expr *) get_rightop(clause),
outer_tlist,
inner_tlist);
@@ -401,14 +401,14 @@ replace_clause_joinvar_refs(Expr * clause,
return NULL;
}
-static List *
+static List *
replace_subclause_joinvar_refs(List * clauses,
List * outer_tlist,
List * inner_tlist)
{
- List *t_list = NIL;
- List *temp = NIL;
- List *clause = NIL;
+ List *t_list = NIL;
+ List *temp = NIL;
+ List *clause = NIL;
foreach(clause, clauses)
{
@@ -420,10 +420,10 @@ replace_subclause_joinvar_refs(List * clauses,
return (t_list);
}
-static Var *
+static Var *
replace_joinvar_refs(Var * var, List * outer_tlist, List * inner_tlist)
{
- Resdom *outer_resdom = (Resdom *) NULL;
+ Resdom *outer_resdom = (Resdom *) NULL;
outer_resdom = tlist_member(var, outer_tlist);
@@ -437,7 +437,7 @@ replace_joinvar_refs(Var * var, List * outer_tlist, List * inner_tlist)
}
else
{
- Resdom *inner_resdom;
+ Resdom *inner_resdom;
inner_resdom = tlist_member(var, inner_tlist);
if (inner_resdom != NULL && IsA(inner_resdom, Resdom))
@@ -466,18 +466,18 @@ replace_joinvar_refs(Var * var, List * outer_tlist, List * inner_tlist)
* Returns new target list
*
*/
-static List *
+static List *
tlist_temp_references(Oid tempid,
List * tlist)
{
- List *t_list = NIL;
- TargetEntry *temp = (TargetEntry *) NULL;
- TargetEntry *xtl = NULL;
- List *entry;
+ List *t_list = NIL;
+ TargetEntry *temp = (TargetEntry *) NULL;
+ TargetEntry *xtl = NULL;
+ List *entry;
foreach(entry, tlist)
{
- AttrNumber oattno;
+ AttrNumber oattno;
xtl = lfirst(entry);
if (IsA(get_expr(xtl), Var))
@@ -513,12 +513,12 @@ tlist_temp_references(Oid tempid,
void
set_result_tlist_references(Result * resultNode)
{
- Plan *subplan;
- List *resultTargetList;
- List *subplanTargetList;
- List *t;
- TargetEntry *entry;
- Expr *expr;
+ Plan *subplan;
+ List *resultTargetList;
+ List *subplanTargetList;
+ List *t;
+ TargetEntry *entry;
+ Expr *expr;
resultTargetList = ((Plan *) resultNode)->targetlist;
@@ -564,9 +564,9 @@ replace_result_clause(List * clause,
List * subplanTargetList) /* target list of the
* subplan */
{
- List *t;
- List *subClause;
- TargetEntry *subplanVar;
+ List *t;
+ List *subClause;
+ TargetEntry *subplanVar;
if (IsA(clause, Var))
{
@@ -598,7 +598,7 @@ replace_result_clause(List * clause,
}
else if (IsA(clause, ArrayRef))
{
- ArrayRef *aref = (ArrayRef *) clause;
+ ArrayRef *aref = (ArrayRef *) clause;
/*
* This is an arrayref. Recursively call this routine for its
@@ -646,7 +646,7 @@ replace_result_clause(List * clause,
}
static
-bool
+ bool
OperandIsInner(Node * opnd, int inner_relid)
{
@@ -663,7 +663,7 @@ OperandIsInner(Node * opnd, int inner_relid)
}
if (is_funcclause(opnd))
{
- List *firstArg = lfirst(((Expr *) opnd)->args);
+ List *firstArg = lfirst(((Expr *) opnd)->args);
if (IsA(firstArg, Var) &&
(inner_relid == ((Var *) firstArg)->varno))
@@ -688,16 +688,16 @@ OperandIsInner(Node * opnd, int inner_relid)
void
set_agg_tlist_references(Agg * aggNode)
{
- List *aggTargetList;
- List *subplanTargetList;
- List *tl;
+ List *aggTargetList;
+ List *subplanTargetList;
+ List *tl;
aggTargetList = aggNode->plan.targetlist;
subplanTargetList = aggNode->plan.lefttree->targetlist;
foreach(tl, aggTargetList)
{
- TargetEntry *tle = lfirst(tl);
+ TargetEntry *tle = lfirst(tl);
replace_agg_clause(tle->expr, subplanTargetList);
}
@@ -706,9 +706,9 @@ set_agg_tlist_references(Agg * aggNode)
void
set_agg_agglist_references(Agg * aggNode)
{
- List *subplanTargetList;
- Aggreg **aggs;
- int i;
+ List *subplanTargetList;
+ Aggreg **aggs;
+ int i;
aggs = aggNode->aggs;
subplanTargetList = aggNode->plan.lefttree->targetlist;
@@ -722,8 +722,8 @@ set_agg_agglist_references(Agg * aggNode)
static void
replace_agg_clause(Node * clause, List * subplanTargetList)
{
- List *t;
- TargetEntry *subplanVar;
+ List *t;
+ TargetEntry *subplanVar;
if (IsA(clause, Var))
{
@@ -757,7 +757,7 @@ replace_agg_clause(Node * clause, List * subplanTargetList)
}
else if (IsA(clause, ArrayRef))
{
- ArrayRef *aref = (ArrayRef *) clause;
+ ArrayRef *aref = (ArrayRef *) clause;
/*
* This is an arrayref. Recursively call this routine for its
@@ -781,8 +781,8 @@ replace_agg_clause(Node * clause, List * subplanTargetList)
* This is an operator. Recursively call this routine for both its
* left and right operands
*/
- Node *left = (Node *) get_leftop((Expr *) clause);
- Node *right = (Node *) get_rightop((Expr *) clause);
+ Node *left = (Node *) get_leftop((Expr *) clause);
+ Node *right = (Node *) get_rightop((Expr *) clause);
if (left != (Node *) NULL)
replace_agg_clause(left, subplanTargetList);
diff --git a/src/backend/optimizer/prep/archive.c b/src/backend/optimizer/prep/archive.c
index bbc797234a..64a1b1c84d 100644
--- a/src/backend/optimizer/prep/archive.c
+++ b/src/backend/optimizer/prep/archive.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Attic/archive.c,v 1.2 1997/09/07 04:44:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Attic/archive.c,v 1.3 1997/09/08 02:24:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,11 +28,11 @@
void
plan_archive(List * rt)
{
- List *rtitem;
- RangeTblEntry *rte;
- TimeRange *trange;
- Relation r;
- Oid reloid;
+ List *rtitem;
+ RangeTblEntry *rte;
+ TimeRange *trange;
+ Relation r;
+ Oid reloid;
foreach(rtitem, rt)
{
@@ -55,11 +55,11 @@ plan_archive(List * rt)
* find_archive_rels -- Given a particular relid, find the archive
* relation's relid.
*/
-List *
+List *
find_archive_rels(Oid relid)
{
- Relation arel;
- char *arelName;
+ Relation arel;
+ char *arelName;
arelName = MakeArchiveName(relid);
arel = RelationNameGetRelation(arelName);
diff --git a/src/backend/optimizer/prep/prepqual.c b/src/backend/optimizer/prep/prepqual.c
index eac1eafa44..47a44d0196 100644
--- a/src/backend/optimizer/prep/prepqual.c
+++ b/src/backend/optimizer/prep/prepqual.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.4 1997/09/07 04:44:10 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepqual.c,v 1.5 1997/09/08 02:24:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,17 +24,17 @@
#include "utils/lsyscache.h"
-static Expr *pull_args(Expr * qual);
-static List *pull_ors(List * orlist);
-static List *pull_ands(List * andlist);
-static Expr *find_nots(Expr * qual);
-static Expr *push_nots(Expr * qual);
-static Expr *normalize(Expr * qual);
-static List *or_normalize(List * orlist);
-static List *distribute_args(List * item, List * args);
-static List *qualcleanup(Expr * qual);
-static List *remove_ands(Expr * qual);
-static List *remove_duplicates(List * list);
+static Expr *pull_args(Expr * qual);
+static List *pull_ors(List * orlist);
+static List *pull_ands(List * andlist);
+static Expr *find_nots(Expr * qual);
+static Expr *push_nots(Expr * qual);
+static Expr *normalize(Expr * qual);
+static List *or_normalize(List * orlist);
+static List *distribute_args(List * item, List * args);
+static List *qualcleanup(Expr * qual);
+static List *remove_ands(Expr * qual);
+static List *remove_duplicates(List * list);
/*
* preprocess-qualification--
@@ -47,10 +47,10 @@ static List *remove_duplicates(List * list);
* preprocess-qualification simply converts the qual in conjunctive
* normal form (see cnfify() below )
*/
-List *
+List *
preprocess_qualification(Expr * qual, List * tlist, List ** existentialQualPtr)
{
- List *cnf_qual = cnfify(qual, true);
+ List *cnf_qual = cnfify(qual, true);
/*
List *existential_qual =
@@ -100,10 +100,10 @@ preprocess_qualification(Expr * qual, List * tlist, List ** existentialQualPtr)
* and from the rule manager (removeAndFlag = false).
*
*/
-List *
+List *
cnfify(Expr * qual, bool removeAndFlag)
{
- Expr *newqual = NULL;
+ Expr *newqual = NULL;
if (qual != NULL)
{
@@ -133,7 +133,7 @@ cnfify(Expr * qual, bool removeAndFlag)
* Returns the modified qualification.
*
*/
-static Expr *
+static Expr *
pull_args(Expr * qual)
{
if (qual == NULL)
@@ -148,8 +148,8 @@ pull_args(Expr * qual)
}
else if (and_clause((Node *) qual))
{
- List *temp = NIL;
- List *t_list = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
foreach(temp, qual->args)
t_list = lappend(t_list, pull_args(lfirst(temp)));
@@ -157,8 +157,8 @@ pull_args(Expr * qual)
}
else if (or_clause((Node *) qual))
{
- List *temp = NIL;
- List *t_list = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
foreach(temp, qual->args)
t_list = lappend(t_list, pull_args(lfirst(temp)));
@@ -181,7 +181,7 @@ pull_args(Expr * qual)
*
* Returns the modified list.
*/
-static List *
+static List *
pull_ors(List * orlist)
{
if (orlist == NIL)
@@ -189,7 +189,7 @@ pull_ors(List * orlist)
if (or_clause(lfirst(orlist)))
{
- List *args = ((Expr *) lfirst(orlist))->args;
+ List *args = ((Expr *) lfirst(orlist))->args;
return (pull_ors(nconc(copyObject((Node *) args),
copyObject((Node *) lnext(orlist)))));
@@ -207,7 +207,7 @@ pull_ors(List * orlist)
*
* Returns the modified list.
*/
-static List *
+static List *
pull_ands(List * andlist)
{
if (andlist == NIL)
@@ -215,7 +215,7 @@ pull_ands(List * andlist)
if (and_clause(lfirst(andlist)))
{
- List *args = ((Expr *) lfirst(andlist))->args;
+ List *args = ((Expr *) lfirst(andlist))->args;
return (pull_ands(nconc(copyObject((Node *) args),
copyObject((Node *) lnext(andlist)))));
@@ -236,7 +236,7 @@ pull_ands(List * andlist)
* Returns the modified qualification.
*
*/
-static Expr *
+static Expr *
find_nots(Expr * qual)
{
if (qual == NULL)
@@ -251,8 +251,8 @@ find_nots(Expr * qual)
}
else if (and_clause((Node *) qual))
{
- List *temp = NIL;
- List *t_list = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
foreach(temp, qual->args)
{
@@ -263,8 +263,8 @@ find_nots(Expr * qual)
}
else if (or_clause((Node *) qual))
{
- List *temp = NIL;
- List *t_list = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
foreach(temp, qual->args)
{
@@ -285,7 +285,7 @@ find_nots(Expr * qual)
* Returns the modified qualification.
*
*/
-static Expr *
+static Expr *
push_nots(Expr * qual)
{
if (qual == NULL)
@@ -298,15 +298,15 @@ push_nots(Expr * qual)
*/
if (is_opclause((Node *) qual))
{
- Oper *oper = (Oper *) ((Expr *) qual)->oper;
- Oid negator = get_negator(oper->opno);
+ Oper *oper = (Oper *) ((Expr *) qual)->oper;
+ Oid negator = get_negator(oper->opno);
if (negator)
{
- Oper *op = (Oper *) makeOper(negator,
- InvalidOid,
- oper->opresulttype,
- 0, NULL);
+ Oper *op = (Oper *) makeOper(negator,
+ InvalidOid,
+ oper->opresulttype,
+ 0, NULL);
op->op_fcache = (FunctionCache *) NULL;
return
@@ -325,8 +325,8 @@ push_nots(Expr * qual)
* ("NOT" B)) ("NOT" ("OR" A B)) => ("AND" ("NOT" A) ("NOT" B))
* i.e., continue negating down through the clause's descendants.
*/
- List *temp = NIL;
- List *t_list = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
foreach(temp, qual->args)
{
@@ -336,8 +336,8 @@ push_nots(Expr * qual)
}
else if (or_clause((Node *) qual))
{
- List *temp = NIL;
- List *t_list = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
foreach(temp, qual->args)
{
@@ -372,7 +372,7 @@ push_nots(Expr * qual)
* Returns the modified qualification.
*
*/
-static Expr *
+static Expr *
normalize(Expr * qual)
{
if (qual == NULL)
@@ -380,7 +380,7 @@ normalize(Expr * qual)
if (is_opclause((Node *) qual))
{
- Expr *expr = (Expr *) qual;
+ Expr *expr = (Expr *) qual;
return (make_clause(expr->opType, expr->oper,
lcons(normalize((Expr *) get_leftop(qual)),
@@ -389,8 +389,8 @@ normalize(Expr * qual)
}
else if (and_clause((Node *) qual))
{
- List *temp = NIL;
- List *t_list = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
foreach(temp, qual->args)
{
@@ -401,9 +401,9 @@ normalize(Expr * qual)
else if (or_clause((Node *) qual))
{
/* XXX - let form, maybe incorrect */
- List *orlist = NIL;
- List *temp = NIL;
- bool has_andclause = FALSE;
+ List *orlist = NIL;
+ List *temp = NIL;
+ bool has_andclause = FALSE;
foreach(temp, qual->args)
{
@@ -437,12 +437,12 @@ normalize(Expr * qual)
* Returns the modified list.
*
*/
-static List *
+static List *
or_normalize(List * orlist)
{
- List *distributable = NIL;
- List *new_orlist = NIL;
- List *temp = NIL;
+ List *distributable = NIL;
+ List *new_orlist = NIL;
+ List *temp = NIL;
if (orlist == NIL)
return NIL;
@@ -476,13 +476,13 @@ or_normalize(List * orlist)
* Returns an 'and' clause.
*
*/
-static List *
+static List *
distribute_args(List * item, List * args)
{
- List *or_list = NIL;
- List *n_list = NIL;
- List *temp = NIL;
- List *t_list = NIL;
+ List *or_list = NIL;
+ List *n_list = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
if (args == NULL)
return (item);
@@ -506,7 +506,7 @@ distribute_args(List * item, List * args)
* Returns the modified qualfication.
*
*/
-static List *
+static List *
qualcleanup(Expr * qual)
{
if (qual == NULL)
@@ -521,9 +521,9 @@ qualcleanup(Expr * qual)
}
else if (and_clause((Node *) qual))
{
- List *temp = NIL;
- List *t_list = NIL;
- List *new_and_args = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
+ List *new_and_args = NIL;
foreach(temp, qual->args)
t_list = lappend(t_list, qualcleanup(lfirst(temp)));
@@ -537,9 +537,9 @@ qualcleanup(Expr * qual)
}
else if (or_clause((Node *) qual))
{
- List *temp = NIL;
- List *t_list = NIL;
- List *new_or_args = NIL;
+ List *temp = NIL;
+ List *t_list = NIL;
+ List *new_or_args = NIL;
foreach(temp, qual->args)
t_list = lappend(t_list, qualcleanup(lfirst(temp)));
@@ -567,10 +567,10 @@ qualcleanup(Expr * qual)
* RETURNS : qual
* MODIFIES: qual
*/
-static List *
+static List *
remove_ands(Expr * qual)
{
- List *t_list = NIL;
+ List *t_list = NIL;
if (qual == NULL)
return (NIL);
@@ -583,7 +583,7 @@ remove_ands(Expr * qual)
}
else if (and_clause((Node *) qual))
{
- List *temp = NIL;
+ List *temp = NIL;
foreach(temp, qual->args)
t_list = lappend(t_list, remove_ands(lfirst(temp)));
@@ -591,7 +591,7 @@ remove_ands(Expr * qual)
}
else if (or_clause((Node *) qual))
{
- List *temp = NIL;
+ List *temp = NIL;
foreach(temp, qual->args)
t_list = lappend(t_list, remove_ands(lfirst(temp)));
@@ -620,7 +620,7 @@ remove_ands(Expr * qual)
*
*/
#ifdef NOT_USED
-static List *
+static List *
update_relations(List * tlist)
{
return (NIL);
@@ -634,13 +634,13 @@ update_relations(List * tlist)
*
*****************************************************************************/
-static List *
+static List *
remove_duplicates(List * list)
{
- List *i;
- List *j;
- List *result = NIL;
- bool there_exists_duplicate = false;
+ List *i;
+ List *j;
+ List *result = NIL;
+ bool there_exists_duplicate = false;
if (length(list) == 1)
return (list);
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index 8b94fb4cbb..550dad8f94 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.3 1997/09/07 04:44:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.4 1997/09/08 02:24:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,13 +33,13 @@
#include "optimizer/clauses.h"
#include "optimizer/tlist.h"
-static List *
+static List *
expand_targetlist(List * tlist, Oid relid, int command_type,
Index result_relation);
-static List *
+static List *
replace_matching_resname(List * new_tlist,
List * old_tlist);
-static List *
+static List *
new_relation_targetlist(Oid relid, Index rt_index,
NodeTag node_type);
@@ -54,16 +54,16 @@ new_relation_targetlist(Oid relid, Index rt_index,
*
* Returns the new targetlist.
*/
-List *
+List *
preprocess_targetlist(List * tlist,
int command_type,
Index result_relation,
List * range_table)
{
- List *expanded_tlist = NIL;
- Oid relid = InvalidOid;
- List *t_list = NIL;
- List *temp = NIL;
+ List *expanded_tlist = NIL;
+ Oid relid = InvalidOid;
+ List *t_list = NIL;
+ List *temp = NIL;
if (result_relation >= 1 && command_type != CMD_SELECT)
{
@@ -82,7 +82,7 @@ preprocess_targetlist(List * tlist,
/* was mapCAR */
foreach(temp, expanded_tlist)
{
- TargetEntry *tle = lfirst(temp);
+ TargetEntry *tle = lfirst(temp);
if (tle->expr)
fix_opid(tle->expr);
@@ -101,9 +101,9 @@ preprocess_targetlist(List * tlist,
*/
if (command_type == CMD_UPDATE || command_type == CMD_DELETE)
{
- TargetEntry *ctid;
- Resdom *resdom;
- Var *var;
+ TargetEntry *ctid;
+ Resdom *resdom;
+ Var *var;
resdom = makeResdom(length(t_list) + 1,
27,
@@ -143,29 +143,29 @@ preprocess_targetlist(List * tlist,
*
* Returns the expanded target list, sorted in resno order.
*/
-static List *
+static List *
expand_targetlist(List * tlist,
Oid relid,
int command_type,
Index result_relation)
{
- NodeTag node_type = T_Invalid;
+ NodeTag node_type = T_Invalid;
switch (command_type)
{
- case CMD_INSERT:
- node_type = (NodeTag) T_Const;
- break;
- case CMD_UPDATE:
- node_type = (NodeTag) T_Var;
- break;
+ case CMD_INSERT:
+ node_type = (NodeTag) T_Const;
+ break;
+ case CMD_UPDATE:
+ node_type = (NodeTag) T_Var;
+ break;
}
if (node_type != T_Invalid)
{
- List *ntlist = new_relation_targetlist(relid,
- result_relation,
- node_type);
+ List *ntlist = new_relation_targetlist(relid,
+ result_relation,
+ node_type);
return (replace_matching_resname(ntlist, tlist));
}
@@ -177,21 +177,21 @@ expand_targetlist(List * tlist,
}
-static List *
+static List *
replace_matching_resname(List * new_tlist, List * old_tlist)
{
- List *temp,
- *i;
- List *t_list = NIL;
+ List *temp,
+ *i;
+ List *t_list = NIL;
foreach(i, new_tlist)
{
- TargetEntry *new_tle = (TargetEntry *) lfirst(i);
- TargetEntry *matching_old_tl = NULL;
+ TargetEntry *new_tle = (TargetEntry *) lfirst(i);
+ TargetEntry *matching_old_tl = NULL;
foreach(temp, old_tlist)
{
- TargetEntry *old_tle = (TargetEntry *) lfirst(temp);
+ TargetEntry *old_tle = (TargetEntry *) lfirst(temp);
old_tle = lfirst(temp);
if (!strcmp(old_tle->resdom->resname,
@@ -228,9 +228,9 @@ replace_matching_resname(List * new_tlist, List * old_tlist)
*/
foreach(temp, old_tlist)
{
- TargetEntry *old_tle,
- *new_tl;
- Resdom *newresno;
+ TargetEntry *old_tle,
+ *new_tl;
+ Resdom *newresno;
old_tle = lfirst(temp);
if (old_tle->resdom->resno < 0)
@@ -253,15 +253,15 @@ replace_matching_resname(List * new_tlist, List * old_tlist)
*
* Returns the new targetlist.
*/
-static List *
+static List *
new_relation_targetlist(Oid relid, Index rt_index, NodeTag node_type)
{
- AttrNumber attno;
- List *t_list = NIL;
- char *attname;
- Oid atttype = 0;
- int16 typlen = 0;
- bool attisset = false;
+ AttrNumber attno;
+ List *t_list = NIL;
+ char *attname;
+ Oid atttype = 0;
+ int16 typlen = 0;
+ bool attisset = false;
/* Oid type_id; */
/* type_id = RelationIdGetTypeId(relid); */
@@ -287,59 +287,59 @@ new_relation_targetlist(Oid relid, Index rt_index, NodeTag node_type)
switch (node_type)
{
- case T_Const:
- {
- struct varlena *typedefault = get_typdefault(atttype);
- int temp = 0;
- Const *temp2 = (Const *) NULL;
- TargetEntry *temp3 = (TargetEntry *) NULL;
-
- if (typedefault == NULL)
- temp = 0;
- else
- temp = typlen;
-
- temp2 = makeConst(atttype,
- temp,
- (Datum) typedefault,
+ case T_Const:
+ {
+ struct varlena *typedefault = get_typdefault(atttype);
+ int temp = 0;
+ Const *temp2 = (Const *) NULL;
+ TargetEntry *temp3 = (TargetEntry *) NULL;
+
+ if (typedefault == NULL)
+ temp = 0;
+ else
+ temp = typlen;
+
+ temp2 = makeConst(atttype,
+ temp,
+ (Datum) typedefault,
(typedefault == (struct varlena *) NULL),
- /* XXX this is bullshit */
- false,
- false, /* not a set */
- false);
-
- temp3 = MakeTLE(makeResdom(attno,
- atttype,
- typlen,
- attname,
- 0,
- (Oid) 0,
- 0),
- (Node *) temp2);
- t_list = lappend(t_list, temp3);
- break;
- }
- case T_Var:
- {
- Var *temp_var = (Var *) NULL;
- TargetEntry *temp_list = NULL;
-
- temp_var =
- makeVar(rt_index, attno, atttype, rt_index, attno);
+ /* XXX this is bullshit */
+ false,
+ false, /* not a set */
+ false);
- temp_list = MakeTLE(makeResdom(attno,
+ temp3 = MakeTLE(makeResdom(attno,
atttype,
typlen,
attname,
0,
(Oid) 0,
0),
- (Node *) temp_var);
- t_list = lappend(t_list, temp_list);
+ (Node *) temp2);
+ t_list = lappend(t_list, temp3);
+ break;
+ }
+ case T_Var:
+ {
+ Var *temp_var = (Var *) NULL;
+ TargetEntry *temp_list = NULL;
+
+ temp_var =
+ makeVar(rt_index, attno, atttype, rt_index, attno);
+
+ temp_list = MakeTLE(makeResdom(attno,
+ atttype,
+ typlen,
+ attname,
+ 0,
+ (Oid) 0,
+ 0),
+ (Node *) temp_var);
+ t_list = lappend(t_list, temp_list);
+ break;
+ }
+ default: /* do nothing */
break;
- }
- default: /* do nothing */
- break;
}
}
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 9bf282f8cc..39e539b223 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.4 1997/09/07 04:44:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.5 1997/09/08 02:24:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,20 +34,20 @@
#include "optimizer/planner.h"
#include "optimizer/prep.h"
-static List *
+static List *
plan_union_query(List * relids, Index rt_index,
RangeTblEntry * rt_entry, Query * parse, UnionFlag flag,
List ** union_rtentriesPtr);
static RangeTblEntry *
new_rangetable_entry(Oid new_relid,
RangeTblEntry * old_entry);
-static Query *
+static Query *
subst_rangetable(Query * root, Index index,
RangeTblEntry * new_entry);
static void
fix_parsetree_attnums(Index rt_index, Oid old_relid,
Oid new_relid, Query * parsetree);
-static Append *
+static Append *
make_append(List * unionplans, Index rt_index,
List * union_rt_entries, List * tlist);
@@ -58,20 +58,20 @@ make_append(List * unionplans, Index rt_index,
* attributes from any relations listed in either of the argument relid
* lists.
*/
-List *
+List *
find_all_inheritors(List * unexamined_relids,
List * examined_relids)
{
- List *new_inheritors = NIL;
- List *new_examined_relids = NIL;
- List *new_unexamined_relids = NIL;
+ List *new_inheritors = NIL;
+ List *new_examined_relids = NIL;
+ List *new_unexamined_relids = NIL;
/*
* Find all relations which inherit from members of
* 'unexamined-relids' and store them in 'new-inheritors'.
*/
- List *rels = NIL;
- List *newrels = NIL;
+ List *rels = NIL;
+ List *newrels = NIL;
foreach(rels, unexamined_relids)
{
@@ -105,25 +105,25 @@ find_all_inheritors(List * unexamined_relids,
int
first_matching_rt_entry(List * rangetable, UnionFlag flag)
{
- int count = 0;
- List *temp = NIL;
+ int count = 0;
+ List *temp = NIL;
foreach(temp, rangetable)
{
- RangeTblEntry *rt_entry = lfirst(temp);
+ RangeTblEntry *rt_entry = lfirst(temp);
switch (flag)
{
- case INHERITS_FLAG:
- if (rt_entry->inh)
- return count + 1;
- break;
- case ARCHIVE_FLAG:
- if (rt_entry->archive)
- return count + 1;
- break;
- default:
- break;
+ case INHERITS_FLAG:
+ if (rt_entry->inh)
+ return count + 1;
+ break;
+ case ARCHIVE_FLAG:
+ if (rt_entry->archive)
+ return count + 1;
+ break;
+ default:
+ break;
}
count++;
}
@@ -141,50 +141,50 @@ first_matching_rt_entry(List * rangetable, UnionFlag flag)
* entries to be inserted into an APPEND node.
* XXX - what exactly does this mean, look for make_append
*/
-Append *
+Append *
plan_union_queries(Index rt_index,
Query * parse,
UnionFlag flag)
{
- List *rangetable = parse->rtable;
- RangeTblEntry *rt_entry = rt_fetch(rt_index, rangetable);
- List *union_relids = NIL;
- List *union_plans = NIL;
- List *union_rt_entries = NIL;
+ List *rangetable = parse->rtable;
+ RangeTblEntry *rt_entry = rt_fetch(rt_index, rangetable);
+ List *union_relids = NIL;
+ List *union_plans = NIL;
+ List *union_rt_entries = NIL;
switch (flag)
{
- case INHERITS_FLAG:
- union_relids =
- find_all_inheritors(lconsi(rt_entry->relid,
- NIL),
- NIL);
- break;
+ case INHERITS_FLAG:
+ union_relids =
+ find_all_inheritors(lconsi(rt_entry->relid,
+ NIL),
+ NIL);
+ break;
#if 0
- case UNION_FLAG:
- {
- Index rt_index = 0;
+ case UNION_FLAG:
+ {
+ Index rt_index = 0;
- union_plans = handleunion(root, rangetable, tlist, qual);
- return (make_append(union_plans,
- rt_index, rangetable,
+ union_plans = handleunion(root, rangetable, tlist, qual);
+ return (make_append(union_plans,
+ rt_index, rangetable,
((Plan *) lfirst(union_plans))->targetlist));
- }
- break;
+ }
+ break;
#endif
- case VERSION_FLAG:
- union_relids = VersionGetParents(rt_entry->relid);
- break;
+ case VERSION_FLAG:
+ union_relids = VersionGetParents(rt_entry->relid);
+ break;
- case ARCHIVE_FLAG:
- union_relids = find_archive_rels(rt_entry->relid);
- break;
+ case ARCHIVE_FLAG:
+ union_relids = find_archive_rels(rt_entry->relid);
+ break;
- default:
- /* do nothing */
- break;
+ default:
+ /* do nothing */
+ break;
}
/*
@@ -193,14 +193,14 @@ plan_union_queries(Index rt_index,
*/
switch (flag)
{
- case INHERITS_FLAG:
- rt_fetch(rt_index, rangetable)->inh = false;
- break;
- case ARCHIVE_FLAG:
- rt_fetch(rt_index, rangetable)->archive = false;
- break;
- default:
- break;
+ case INHERITS_FLAG:
+ rt_fetch(rt_index, rangetable)->inh = false;
+ break;
+ case ARCHIVE_FLAG:
+ rt_fetch(rt_index, rangetable)->archive = false;
+ break;
+ default:
+ break;
}
/*
@@ -225,7 +225,7 @@ plan_union_queries(Index rt_index,
* Returns a list of plans for 'relids' and a list of range table entries
* in union_rtentries.
*/
-static List *
+static List *
plan_union_query(List * relids,
Index rt_index,
RangeTblEntry * rt_entry,
@@ -233,18 +233,18 @@ plan_union_query(List * relids,
UnionFlag flag,
List ** union_rtentriesPtr)
{
- List *i;
- List *union_plans = NIL;
- List *union_rtentries = NIL;
+ List *i;
+ List *union_plans = NIL;
+ List *union_rtentries = NIL;
foreach(i, relids)
{
- int relid = lfirsti(i);
- RangeTblEntry *new_rt_entry = new_rangetable_entry(relid,
- rt_entry);
- Query *new_root = subst_rangetable(root,
- rt_index,
- new_rt_entry);
+ int relid = lfirsti(i);
+ RangeTblEntry *new_rt_entry = new_rangetable_entry(relid,
+ rt_entry);
+ Query *new_root = subst_rangetable(root,
+ rt_index,
+ new_rt_entry);
/*
* reset the uniqueflag and sortclause in parse tree root, so that
@@ -288,7 +288,7 @@ plan_union_query(List * relids,
static RangeTblEntry *
new_rangetable_entry(Oid new_relid, RangeTblEntry * old_entry)
{
- RangeTblEntry *new_entry = copyObject(old_entry);
+ RangeTblEntry *new_entry = copyObject(old_entry);
/* ??? someone tell me what the following is doing! - ay 11/94 */
if (!strcmp(new_entry->refname, "*CURRENT*") ||
@@ -307,12 +307,12 @@ new_rangetable_entry(Oid new_relid, RangeTblEntry * old_entry)
*
* Returns a new copy of 'root'.
*/
-static Query *
+static Query *
subst_rangetable(Query * root, Index index, RangeTblEntry * new_entry)
{
- Query *new_root = copyObject(root);
- List *temp = NIL;
- int i = 0;
+ Query *new_root = copyObject(root);
+ List *temp = NIL;
+ int i = 0;
for (temp = new_root->rtable, i = 1; i < index; temp = lnext(temp), i++)
;
@@ -332,54 +332,54 @@ fix_parsetree_attnums_nodes(Index rt_index,
switch (nodeTag(node))
{
- case T_TargetEntry:
- {
- TargetEntry *tle = (TargetEntry *) node;
+ case T_TargetEntry:
+ {
+ TargetEntry *tle = (TargetEntry *) node;
- fix_parsetree_attnums_nodes(rt_index, old_relid, new_relid,
- tle->expr);
- }
- break;
- case T_Expr:
- {
- Expr *expr = (Expr *) node;
+ fix_parsetree_attnums_nodes(rt_index, old_relid, new_relid,
+ tle->expr);
+ }
+ break;
+ case T_Expr:
+ {
+ Expr *expr = (Expr *) node;
- fix_parsetree_attnums_nodes(rt_index, old_relid, new_relid,
- (Node *) expr->args);
- }
- break;
- case T_Var:
- {
- Var *var = (Var *) node;
- Oid old_typeid,
+ fix_parsetree_attnums_nodes(rt_index, old_relid, new_relid,
+ (Node *) expr->args);
+ }
+ break;
+ case T_Var:
+ {
+ Var *var = (Var *) node;
+ Oid old_typeid,
new_typeid;
/* old_typeid = RelationIdGetTypeId(old_relid);*/
/* new_typeid = RelationIdGetTypeId(new_relid);*/
- old_typeid = old_relid;
- new_typeid = new_relid;
-
- if (var->varno == rt_index && var->varattno != 0)
- {
- var->varattno =
- get_attnum(new_typeid,
- get_attname(old_typeid, var->varattno));
+ old_typeid = old_relid;
+ new_typeid = new_relid;
+
+ if (var->varno == rt_index && var->varattno != 0)
+ {
+ var->varattno =
+ get_attnum(new_typeid,
+ get_attname(old_typeid, var->varattno));
+ }
}
- }
- break;
- case T_List:
- {
- List *l;
-
- foreach(l, (List *) node)
+ break;
+ case T_List:
{
- fix_parsetree_attnums_nodes(rt_index, old_relid, new_relid,
- (Node *) lfirst(l));
+ List *l;
+
+ foreach(l, (List *) node)
+ {
+ fix_parsetree_attnums_nodes(rt_index, old_relid, new_relid,
+ (Node *) lfirst(l));
+ }
}
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
}
@@ -407,13 +407,13 @@ fix_parsetree_attnums(Index rt_index,
parsetree->qual);
}
-static Append *
+static Append *
make_append(List * unionplans,
Index rt_index,
List * union_rt_entries,
List * tlist)
{
- Append *node = makeNode(Append);
+ Append *node = makeNode(Append);
node->unionplans = unionplans;
node->unionrelid = rt_index;
diff --git a/src/backend/optimizer/util/clauseinfo.c b/src/backend/optimizer/util/clauseinfo.c
index e5fd2b7e5b..09ea9ae898 100644
--- a/src/backend/optimizer/util/clauseinfo.c
+++ b/src/backend/optimizer/util/clauseinfo.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.4 1997/09/07 04:44:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.5 1997/09/08 02:24:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,12 +44,12 @@ valid_or_clause(CInfo * clauseinfo)
* Returns a list containing the clauses from 'clauseinfo-list'.
*
*/
-List *
+List *
get_actual_clauses(List * clauseinfo_list)
{
- List *temp = NIL;
- List *result = NIL;
- CInfo *clause = (CInfo *) NULL;
+ List *temp = NIL;
+ List *result = NIL;
+ CInfo *clause = (CInfo *) NULL;
foreach(temp, clauseinfo_list)
{
@@ -90,18 +90,18 @@ get_relattvals(List * clauseinfo_list,
List ** values,
List ** flags)
{
- List *result1 = NIL;
- List *result2 = NIL;
- List *result3 = NIL;
- CInfo *temp = (CInfo *) NULL;
- List *i = NIL;
+ List *result1 = NIL;
+ List *result2 = NIL;
+ List *result3 = NIL;
+ CInfo *temp = (CInfo *) NULL;
+ List *i = NIL;
foreach(i, clauseinfo_list)
{
- int dummy;
- AttrNumber attno;
- Datum constval;
- int flag;
+ int dummy;
+ AttrNumber attno;
+ Datum constval;
+ int flag;
temp = (CInfo *) lfirst(i);
get_relattval((Node *) temp->clause, &dummy, &attno, &constval, &flag);
@@ -137,15 +137,15 @@ get_joinvars(Oid relid,
List ** values,
List ** flags)
{
- List *result1 = NIL;
- List *result2 = NIL;
- List *result3 = NIL;
- List *temp;
+ List *result1 = NIL;
+ List *result2 = NIL;
+ List *result3 = NIL;
+ List *temp;
foreach(temp, clauseinfo_list)
{
- CInfo *clauseinfo = lfirst(temp);
- Expr *clause = clauseinfo->clause;
+ CInfo *clauseinfo = lfirst(temp);
+ Expr *clause = clauseinfo->clause;
if (IsA(get_leftop(clause), Var) &&
(relid == (get_leftop(clause))->varno))
@@ -173,12 +173,12 @@ get_joinvars(Oid relid,
* of a list of clauseinfo nodes to be used with an index.
*
*/
-List *
+List *
get_opnos(List * clauseinfo_list)
{
- CInfo *temp = (CInfo *) NULL;
- List *result = NIL;
- List *i = NIL;
+ CInfo *temp = (CInfo *) NULL;
+ List *result = NIL;
+ List *i = NIL;
foreach(i, clauseinfo_list)
{
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 03e0856ef0..17a97a55ee 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.8 1997/09/07 04:44:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.9 1997/09/08 02:24:52 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -34,16 +34,16 @@
#include "optimizer/internal.h"
#include "optimizer/var.h"
-static bool agg_clause(Node * clause);
+static bool agg_clause(Node * clause);
-Expr *
+Expr *
make_clause(int type, Node * oper, List * args)
{
if (type == AND_EXPR || type == OR_EXPR || type == NOT_EXPR ||
type == OP_EXPR || type == FUNC_EXPR)
{
- Expr *expr = makeNode(Expr);
+ Expr *expr = makeNode(Expr);
/*
* assume type checking already done and we don't need the type of
@@ -92,10 +92,10 @@ is_opclause(Node * clause)
* operand (if it is non-null).
*
*/
-Expr *
+Expr *
make_opclause(Oper * op, Var * leftop, Var * rightop)
{
- Expr *expr = makeNode(Expr);
+ Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = OP_EXPR;
@@ -111,7 +111,7 @@ make_opclause(Oper * op, Var * leftop, Var * rightop)
* or (op expr)
* NB: it is assumed (for now) that all expr must be Var nodes
*/
-Var *
+Var *
get_leftop(Expr * clause)
{
if (clause->args != NULL)
@@ -126,7 +126,7 @@ get_leftop(Expr * clause)
* Returns the right operand in a clause of the form (op expr expr).
*
*/
-Var *
+Var *
get_rightop(Expr * clause)
{
if (clause->args != NULL && lnext(clause->args) != NULL)
@@ -139,7 +139,7 @@ get_rightop(Expr * clause)
* AGG clause functions
*****************************************************************************/
-static bool
+static bool
agg_clause(Node * clause)
{
return
@@ -171,10 +171,10 @@ is_funcclause(Node * clause)
* arguments.
*
*/
-Expr *
+Expr *
make_funcclause(Func * func, List * funcargs)
{
- Expr *expr = makeNode(Expr);
+ Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = FUNC_EXPR;
@@ -207,10 +207,10 @@ or_clause(Node * clause)
* Creates an 'or' clause given a list of its subclauses.
*
*/
-Expr *
+Expr *
make_orclause(List * orclauses)
{
- Expr *expr = makeNode(Expr);
+ Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = OR_EXPR;
@@ -243,10 +243,10 @@ not_clause(Node * clause)
* Create a 'not' clause given the expression to be negated.
*
*/
-Expr *
+Expr *
make_notclause(Expr * notclause)
{
- Expr *expr = makeNode(Expr);
+ Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = NOT_EXPR;
@@ -261,7 +261,7 @@ make_notclause(Expr * notclause)
* Retrieve the clause within a 'not' clause
*
*/
-Expr *
+Expr *
get_notclausearg(Expr * notclause)
{
return (lfirst(notclause->args));
@@ -292,10 +292,10 @@ and_clause(Node * clause)
* Create an 'and' clause given its arguments in a list.
*
*/
-Expr *
+Expr *
make_andclause(List * andclauses)
{
- Expr *expr = makeNode(Expr);
+ Expr *expr = makeNode(Expr);
expr->typeOid = InvalidOid; /* assume type checking done */
expr->opType = AND_EXPR;
@@ -320,12 +320,12 @@ make_andclause(List * andclauses)
* quals as the return value.
*
*/
-List *
+List *
pull_constant_clauses(List * quals, List ** constantQual)
{
- List *q;
- List *constqual = NIL;
- List *restqual = NIL;
+ List *q;
+ List *constqual = NIL;
+ List *restqual = NIL;
foreach(q, quals)
{
@@ -358,15 +358,15 @@ pull_constant_clauses(List * quals, List ** constantQual)
void
clause_relids_vars(Node * clause, List ** relids, List ** vars)
{
- List *clvars = pull_var_clause(clause);
- List *var_list = NIL;
- List *varno_list = NIL;
- List *i = NIL;
+ List *clvars = pull_var_clause(clause);
+ List *var_list = NIL;
+ List *varno_list = NIL;
+ List *i = NIL;
foreach(i, clvars)
{
- Var *var = (Var *) lfirst(i);
- List *vi;
+ Var *var = (Var *) lfirst(i);
+ List *vi;
if (!intMember(var->varno, varno_list))
{
@@ -374,7 +374,7 @@ clause_relids_vars(Node * clause, List ** relids, List ** vars)
}
foreach(vi, var_list)
{
- Var *in_list = (Var *) lfirst(vi);
+ Var *in_list = (Var *) lfirst(vi);
if (in_list->varno == var->varno &&
in_list->varattno == var->varattno)
@@ -398,13 +398,13 @@ clause_relids_vars(Node * clause, List ** relids, List ** vars)
int
NumRelids(Node * clause)
{
- List *vars = pull_var_clause(clause);
- List *i = NIL;
- List *var_list = NIL;
+ List *vars = pull_var_clause(clause);
+ List *i = NIL;
+ List *var_list = NIL;
foreach(i, vars)
{
- Var *var = (Var *) lfirst(i);
+ Var *var = (Var *) lfirst(i);
if (!intMember(var->varno, var_list))
{
@@ -433,7 +433,7 @@ contains_not(Node * clause)
if (or_clause(clause))
{
- List *a;
+ List *a;
foreach(a, ((Expr *) clause)->args)
{
@@ -454,8 +454,8 @@ contains_not(Node * clause)
bool
join_clause_p(Node * clause)
{
- Node *leftop,
- *rightop;
+ Node *leftop,
+ *rightop;
if (!is_opclause(clause))
return false;
@@ -528,7 +528,7 @@ fix_opid(Node * clause)
}
else if (IsA(clause, ArrayRef))
{
- ArrayRef *aref = (ArrayRef *) clause;
+ ArrayRef *aref = (ArrayRef *) clause;
fix_opids(aref->refupperindexpr);
fix_opids(aref->reflowerindexpr);
@@ -559,10 +559,10 @@ fix_opid(Node * clause)
* Returns its argument.
*
*/
-List *
+List *
fix_opids(List * clauses)
{
- List *clause;
+ List *clause;
foreach(clause, clauses)
fix_opid(lfirst(clause));
@@ -601,8 +601,8 @@ get_relattval(Node * clause,
Datum * constval,
int *flag)
{
- Var *left = get_leftop((Expr *) clause);
- Var *right = get_rightop((Expr *) clause);
+ Var *left = get_leftop((Expr *) clause);
+ Var *right = get_rightop((Expr *) clause);
if (is_opclause(clause) && IsA(left, Var) &&
IsA(right, Const))
@@ -641,7 +641,7 @@ get_relattval(Node * clause,
is_funcclause((Node *) left) &&
IsA(right, Const))
{
- List *args = ((Expr *) left)->args;
+ List *args = ((Expr *) left)->args;
*relid = ((Var *) lfirst(args))->varno;
@@ -662,7 +662,7 @@ get_relattval(Node * clause,
is_funcclause((Node *) right) &&
IsA(left, Const))
{
- List *args = ((Expr *) right)->args;
+ List *args = ((Expr *) right)->args;
*relid = ((Var *) lfirst(args))->varno;
*attno = InvalidAttrNumber;
@@ -732,13 +732,13 @@ get_rels_atts(Node * clause,
int *relid2,
AttrNumber * attno2)
{
- Var *left = get_leftop((Expr *) clause);
- Var *right = get_rightop((Expr *) clause);
- bool var_left = (IsA(left, Var));
- bool var_right = (IsA(right, Var));
- bool varexpr_left = (bool) ((IsA(left, Func) || IsA(left, Oper)) &&
- contain_var_clause((Node *) left));
- bool varexpr_right = (bool) ((IsA(right, Func) || IsA(right, Oper)) &&
+ Var *left = get_leftop((Expr *) clause);
+ Var *right = get_rightop((Expr *) clause);
+ bool var_left = (IsA(left, Var));
+ bool var_right = (IsA(right, Var));
+ bool varexpr_left = (bool) ((IsA(left, Func) || IsA(left, Oper)) &&
+ contain_var_clause((Node *) left));
+ bool varexpr_right = (bool) ((IsA(right, Func) || IsA(right, Oper)) &&
contain_var_clause((Node *) right));
if (is_opclause(clause))
@@ -782,10 +782,10 @@ get_rels_atts(Node * clause,
void
CommuteClause(Node * clause)
{
- Node *temp;
- Oper *commu;
+ Node *temp;
+ Oper *commu;
OperatorTupleForm commuTup;
- HeapTuple heapTup;
+ HeapTuple heapTup;
if (!is_opclause(clause))
return;
diff --git a/src/backend/optimizer/util/indexnode.c b/src/backend/optimizer/util/indexnode.c
index e6a1902f8b..9714038a8b 100644
--- a/src/backend/optimizer/util/indexnode.c
+++ b/src/backend/optimizer/util/indexnode.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.3 1997/09/07 04:44:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.4 1997/09/08 02:24:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
#include "optimizer/pathnode.h" /* where the decls go */
-static List *find_secondary_index(Query * root, Oid relid);
+static List *find_secondary_index(Query * root, Oid relid);
/*
* find-relation-indices--
@@ -32,7 +32,7 @@ static List *find_secondary_index(Query * root, Oid relid);
* each (secondary) index defined on a relation.
*
*/
-List *
+List *
find_relation_indices(Query * root, Rel * rel)
{
if (rel->indexed)
@@ -56,16 +56,16 @@ find_relation_indices(Query * root, Rel * rel)
* Returns a list of new index nodes.
*
*/
-static List *
+static List *
find_secondary_index(Query * root, Oid relid)
{
- IdxInfoRetval indexinfo;
- List *indexes = NIL;
- bool first = TRUE;
+ IdxInfoRetval indexinfo;
+ List *indexes = NIL;
+ bool first = TRUE;
while (index_info(root, first, relid, &indexinfo))
{
- Rel *indexnode = makeNode(Rel);
+ Rel *indexnode = makeNode(Rel);
indexnode->relids = lconsi(indexinfo.relid, NIL);
indexnode->relam = indexinfo.relam;
diff --git a/src/backend/optimizer/util/internal.c b/src/backend/optimizer/util/internal.c
index d1af2062fc..31fe034dbb 100644
--- a/src/backend/optimizer/util/internal.c
+++ b/src/backend/optimizer/util/internal.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/internal.c,v 1.4 1997/09/07 04:44:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/internal.c,v 1.5 1997/09/08 02:24:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,17 +38,17 @@
/* the following should probably be moved elsewhere -ay */
-TargetEntry *
+TargetEntry *
MakeTLE(Resdom * resdom, Node * expr)
{
- TargetEntry *rt = makeNode(TargetEntry);
+ TargetEntry *rt = makeNode(TargetEntry);
rt->resdom = resdom;
rt->expr = expr;
return rt;
}
-Var *
+Var *
get_expr(TargetEntry * tle)
{
Assert(tle != NULL);
diff --git a/src/backend/optimizer/util/joininfo.c b/src/backend/optimizer/util/joininfo.c
index cf206d8009..3f4f990a76 100644
--- a/src/backend/optimizer/util/joininfo.c
+++ b/src/backend/optimizer/util/joininfo.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.3 1997/09/07 04:44:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.4 1997/09/08 02:24:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,11 +35,11 @@
* exists.
*
*/
-JInfo *
+JInfo *
joininfo_member(List * join_relids, List * joininfo_list)
{
- List *i = NIL;
- List *other_rels = NIL;
+ List *i = NIL;
+ List *other_rels = NIL;
foreach(i, joininfo_list)
{
@@ -61,11 +61,11 @@ joininfo_member(List * join_relids, List * joininfo_list)
* Returns a joininfo node.
*
*/
-JInfo *
+JInfo *
find_joininfo_node(Rel * this_rel, List * join_relids)
{
- JInfo *joininfo = joininfo_member(join_relids,
- this_rel->joininfo);
+ JInfo *joininfo = joininfo_member(join_relids,
+ this_rel->joininfo);
if (joininfo == NULL)
{
@@ -88,12 +88,12 @@ find_joininfo_node(Rel * this_rel, List * join_relids)
* Returns the other var node in the joinclause if it is, nil if not.
*
*/
-Var *
+Var *
other_join_clause_var(Var * var, Expr * clause)
{
- Var *retval;
- Var *l,
- *r;
+ Var *retval;
+ Var *l,
+ *r;
retval = (Var *) NULL;
diff --git a/src/backend/optimizer/util/keys.c b/src/backend/optimizer/util/keys.c
index 0c3a3569eb..82d8c6010b 100644
--- a/src/backend/optimizer/util/keys.c
+++ b/src/backend/optimizer/util/keys.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.3 1997/09/07 04:44:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.4 1997/09/08 02:24:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,8 +22,8 @@
#include "optimizer/tlist.h"
-static Expr *matching2_tlvar(int var, List * tlist, bool(*test) ());
-static bool equal_indexkey_var(int index_key, Var * var);
+static Expr *matching2_tlvar(int var, List * tlist, bool(*test) ());
+static bool equal_indexkey_var(int index_key, Var * var);
/*
* 1. index key
@@ -70,7 +70,7 @@ match_indexkey_operand(int indexkey, Var * operand, Rel * rel)
* fields of var node 'var'.
*
*/
-static bool
+static bool
equal_indexkey_var(int index_key, Var * var)
{
if (index_key == var->varattno)
@@ -85,22 +85,22 @@ equal_indexkey_var(int index_key, Var * var)
* lelation.
*
*/
-Var *
+Var *
extract_subkey(JoinKey * jk, int which_subkey)
{
- Var *retval;
+ Var *retval;
switch (which_subkey)
{
- case OUTER:
- retval = jk->outer;
- break;
- case INNER:
- retval = jk->inner;
- break;
- default: /* do nothing */
- elog(DEBUG, "extract_subkey with neither INNER or OUTER");
- retval = NULL;
+ case OUTER:
+ retval = jk->outer;
+ break;
+ case INNER:
+ retval = jk->inner;
+ break;
+ default: /* do nothing */
+ elog(DEBUG, "extract_subkey with neither INNER or OUTER");
+ retval = NULL;
}
return (retval);
}
@@ -120,9 +120,9 @@ extract_subkey(JoinKey * jk, int which_subkey)
bool
samekeys(List * keys1, List * keys2)
{
- bool allmember = true;
- List *key1,
- *key2;
+ bool allmember = true;
+ List *key1,
+ *key2;
for (key1 = keys1, key2 = keys2; key1 != NIL && key2 != NIL;
key1 = lnext(key1), key2 = lnext(key2))
@@ -152,14 +152,14 @@ samekeys(List * keys1, List * keys2)
/* This function is identical to matching_tlvar and tlistentry_member.
* They should be merged.
*/
-static Expr *
+static Expr *
matching2_tlvar(int var, List * tlist, bool(*test) ())
{
- TargetEntry *tlentry = NULL;
+ TargetEntry *tlentry = NULL;
if (var)
{
- List *temp;
+ List *temp;
foreach(temp, tlist)
{
@@ -178,16 +178,16 @@ matching2_tlvar(int var, List * tlist, bool(*test) ())
}
-List *
+List *
collect_index_pathkeys(int *index_keys, List * tlist)
{
- List *retval = NIL;
+ List *retval = NIL;
Assert(index_keys != NULL);
while (index_keys[0] != 0)
{
- Expr *mvar;
+ Expr *mvar;
mvar = matching2_tlvar(index_keys[0],
tlist,
diff --git a/src/backend/optimizer/util/ordering.c b/src/backend/optimizer/util/ordering.c
index 504d48bdce..f14d376218 100644
--- a/src/backend/optimizer/util/ordering.c
+++ b/src/backend/optimizer/util/ordering.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.4 1997/09/07 04:44:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.5 1997/09/08 02:24:58 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,7 +18,7 @@
#include "optimizer/internal.h"
#include "optimizer/ordering.h"
-static bool equal_sortops_order(Oid * ordering1, Oid * ordering2);
+static bool equal_sortops_order(Oid * ordering1, Oid * ordering2);
/*
* equal-path-path-ordering--
@@ -110,10 +110,10 @@ equal_merge_merge_ordering(MergeOrder * merge_ordering1,
* equal_sort_ops_order -
* Returns true iff the sort operators are in the same order.
*/
-static bool
+static bool
equal_sortops_order(Oid * ordering1, Oid * ordering2)
{
- int i = 0;
+ int i = 0;
if (ordering1 == NULL || ordering2 == NULL)
return (ordering1 == ordering2);
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index 6b37d2f36d..f6242e852a 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.4 1997/09/07 04:44:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.5 1997/09/08 02:24:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,7 +29,7 @@
#include "parser/parsetree.h" /* for getrelid() */
-static Path *better_path(Path * new_path, List * unique_paths, bool * noOther);
+static Path *better_path(Path * new_path, List * unique_paths, bool * noOther);
/*****************************************************************************
@@ -44,8 +44,8 @@ static Path *better_path(Path * new_path, List * unique_paths, bool * noOther
bool
path_is_cheaper(Path * path1, Path * path2)
{
- Cost cost1 = path1->path_cost;
- Cost cost2 = path2->path_cost;
+ Cost cost1 = path1->path_cost;
+ Cost cost2 = path2->path_cost;
return ((bool) (cost1 < cost2));
}
@@ -61,11 +61,11 @@ path_is_cheaper(Path * path1, Path * path2)
* is minimum.
*
*/
-Path *
+Path *
set_cheapest(Rel * parent_rel, List * pathlist)
{
- List *p;
- Path *cheapest_so_far;
+ List *p;
+ Path *cheapest_so_far;
Assert(pathlist != NIL);
Assert(IsA(parent_rel, Rel));
@@ -74,7 +74,7 @@ set_cheapest(Rel * parent_rel, List * pathlist)
foreach(p, lnext(pathlist))
{
- Path *path = (Path *) lfirst(p);
+ Path *path = (Path *) lfirst(p);
if (path_is_cheaper(path, cheapest_so_far))
{
@@ -100,13 +100,13 @@ set_cheapest(Rel * parent_rel, List * pathlist)
* Returns the list of unique pathnodes.
*
*/
-List *
+List *
add_pathlist(Rel * parent_rel, List * unique_paths, List * new_paths)
{
- List *x;
- Path *new_path;
- Path *old_path;
- bool noOther;
+ List *x;
+ Path *new_path;
+ Path *old_path;
+ bool noOther;
foreach(x, new_paths)
{
@@ -153,13 +153,13 @@ add_pathlist(Rel * parent_rel, List * unique_paths, List * new_paths)
* t - if there is no path in the list with the same ordering and keys
*
*/
-static Path *
+static Path *
better_path(Path * new_path, List * unique_paths, bool * noOther)
{
- Path *old_path = (Path *) NULL;
- Path *path = (Path *) NULL;
- List *temp = NIL;
- Path *retval = NULL;
+ Path *old_path = (Path *) NULL;
+ Path *path = (Path *) NULL;
+ List *temp = NIL;
+ Path *retval = NULL;
/*
* XXX - added the following two lines which weren't int the lisp
@@ -207,12 +207,12 @@ better_path(Path * new_path, List * unique_paths, bool * noOther)
* pathnode.
*
*/
-Path *
+Path *
create_seqscan_path(Rel * rel)
{
- int relid = 0;
+ int relid = 0;
- Path *pathnode = makeNode(Path);
+ Path *pathnode = makeNode(Path);
pathnode->pathtype = T_SeqScan;
pathnode->parent = rel;
@@ -257,14 +257,14 @@ create_seqscan_path(Rel * rel)
* Returns the new path node.
*
*/
-IndexPath *
+IndexPath *
create_index_path(Query * root,
Rel * rel,
Rel * index,
List * restriction_clauses,
bool is_join_scan)
{
- IndexPath *pathnode = makeNode(IndexPath);
+ IndexPath *pathnode = makeNode(IndexPath);
pathnode->path.pathtype = T_IndexScan;
pathnode->path.parent = rel;
@@ -344,12 +344,12 @@ create_index_path(Query * root,
* Compute scan cost for the case when 'index' is used with a
* restriction clause.
*/
- List *attnos;
- List *values;
- List *flags;
- float npages;
- float selec;
- Cost clausesel;
+ List *attnos;
+ List *values;
+ List *flags;
+ float npages;
+ float selec;
+ Cost clausesel;
get_relattvals(restriction_clauses,
&attnos,
@@ -417,14 +417,14 @@ create_index_path(Query * root,
* Returns the resulting path node.
*
*/
-JoinPath *
+JoinPath *
create_nestloop_path(Rel * joinrel,
Rel * outer_rel,
Path * outer_path,
Path * inner_path,
List * keys)
{
- JoinPath *pathnode = makeNode(JoinPath);
+ JoinPath *pathnode = makeNode(JoinPath);
pathnode->path.pathtype = T_NestLoop;
pathnode->path.parent = joinrel;
@@ -494,7 +494,7 @@ create_nestloop_path(Rel * joinrel,
* 'innersortkeys' are the sort varkeys for the inner relation
*
*/
-MergePath *
+MergePath *
create_mergesort_path(Rel * joinrel,
int outersize,
int innersize,
@@ -508,7 +508,7 @@ create_mergesort_path(Rel * joinrel,
List * outersortkeys,
List * innersortkeys)
{
- MergePath *pathnode = makeNode(MergePath);
+ MergePath *pathnode = makeNode(MergePath);
pathnode->jpath.path.pathtype = T_MergeJoin;
pathnode->jpath.path.parent = joinrel;
@@ -560,7 +560,7 @@ create_mergesort_path(Rel * joinrel,
* 'innerkeys' are the sort varkeys for the inner relation
*
*/
-HashPath *
+HashPath *
create_hashjoin_path(Rel * joinrel,
int outersize,
int innersize,
@@ -574,7 +574,7 @@ create_hashjoin_path(Rel * joinrel,
List * outerkeys,
List * innerkeys)
{
- HashPath *pathnode = makeNode(HashPath);
+ HashPath *pathnode = makeNode(HashPath);
pathnode->jpath.path.pathtype = T_HashJoin;
pathnode->jpath.path.parent = joinrel;
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index 0e88a72c4e..0957775df0 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.7 1997/09/07 04:44:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.8 1997/09/08 02:25:01 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,9 +59,9 @@ void
relation_info(Query * root, Index relid,
bool * hasindex, int *pages, int *tuples)
{
- HeapTuple relationTuple;
- Form_pg_class relation;
- Oid relationObjectId;
+ HeapTuple relationTuple;
+ Form_pg_class relation;
+ Oid relationObjectId;
relationObjectId = getrelid(relid, root->rtable);
relationTuple = SearchSysCacheTuple(RELOID,
@@ -103,14 +103,14 @@ relation_info(Query * root, Index relid,
bool
index_info(Query * root, bool first, int relid, IdxInfoRetval * info)
{
- register i;
- HeapTuple indexTuple,
- amopTuple;
- IndexTupleForm index;
- Relation indexRelation;
- uint16 amstrategy;
- Oid relam;
- Oid indrelid;
+ register i;
+ HeapTuple indexTuple,
+ amopTuple;
+ IndexTupleForm index;
+ Relation indexRelation;
+ uint16 amstrategy;
+ Oid relam;
+ Oid indrelid;
static Relation relation = (Relation) NULL;
static HeapScanDesc scan = (HeapScanDesc) NULL;
@@ -183,7 +183,7 @@ index_info(Query * root, bool first, int relid, IdxInfoRetval * info)
* which is all within a command, so the automatic pfree at end of
* transaction should be ok.
*/
- char *predString;
+ char *predString;
predString = fmgr(F_TEXTOUT, &index->indpred);
info->indpred = (Node *) stringToNode(predString);
@@ -256,15 +256,15 @@ index_selectivity(Oid indid,
float *idxPages,
float *idxSelec)
{
- Oid *opno_array;
- int *attno_array,
- *flag_array;
- char **value_array;
- int i = 0;
- List *xopno,
- *xattno,
- *value,
- *flag;
+ Oid *opno_array;
+ int *attno_array,
+ *flag_array;
+ char **value_array;
+ int i = 0;
+ List *xopno,
+ *xattno,
+ *value,
+ *flag;
if (length(opnos) != nkeys || length(attnos) != nkeys ||
length(values) != nkeys || length(flags) != nkeys)
@@ -339,7 +339,7 @@ restriction_selectivity(Oid functionObjectId,
char *constValue,
int32 constFlag)
{
- float64 result;
+ float64 result;
result = (float64) fmgr(functionObjectId,
(char *) operatorObjectId,
@@ -378,7 +378,7 @@ join_selectivity(Oid functionObjectId,
Oid relationObjectId2,
AttrNumber attributeNumber2)
{
- float64 result;
+ float64 result;
result = (float64) fmgr(functionObjectId,
(char *) operatorObjectId,
@@ -403,18 +403,18 @@ join_selectivity(Oid functionObjectId,
* Returns a LISP list containing the OIDs of all relations which
* inherits from the relation with OID 'inhparent'.
*/
-List *
+List *
find_inheritance_children(Oid inhparent)
{
static ScanKeyData key[1] = {
{0, Anum_pg_inherits_inhparent, F_OIDEQ}
};
- HeapTuple inheritsTuple;
- Relation relation;
- HeapScanDesc scan;
- List *list = NIL;
- Oid inhrelid;
+ HeapTuple inheritsTuple;
+ Relation relation;
+ HeapScanDesc scan;
+ List *list = NIL;
+ Oid inhrelid;
fmgr_info(F_OIDEQ, &key[0].sk_func, &key[0].sk_nargs);
@@ -439,18 +439,18 @@ find_inheritance_children(Oid inhparent)
* Returns a LISP list containing the OIDs of all relations which are
* base relations of the relation with OID 'verrelid'.
*/
-List *
+List *
VersionGetParents(Oid verrelid)
{
static ScanKeyData key[1] = {
{0, Anum_pg_version_verrelid, F_OIDEQ}
};
- HeapTuple versionTuple;
- Relation relation;
- HeapScanDesc scan;
- Oid verbaseid;
- List *list = NIL;
+ HeapTuple versionTuple;
+ Relation relation;
+ HeapScanDesc scan;
+ Oid verbaseid;
+ List *list = NIL;
fmgr_info(F_OIDEQ, &key[0].sk_func, &key[0].sk_nargs);
relation = heap_openr(VersionRelationName);
@@ -512,21 +512,21 @@ IndexSelectivity(Oid indexrelid,
float *idxPages,
float *idxSelec)
{
- register i,
- n;
- HeapTuple indexTuple,
- amopTuple,
- indRel;
- IndexTupleForm index;
- Form_pg_amop amop;
- Oid indclass;
- float64data npages,
- select;
- float64 amopnpages,
- amopselect;
- Oid relam;
- bool nphack = false;
- float64data fattr_select = 1.0;
+ register i,
+ n;
+ HeapTuple indexTuple,
+ amopTuple,
+ indRel;
+ IndexTupleForm index;
+ Form_pg_amop amop;
+ Oid indclass;
+ float64data npages,
+ select;
+ float64 amopnpages,
+ amopselect;
+ Oid relam;
+ bool nphack = false;
+ float64data fattr_select = 1.0;
indRel = SearchSysCacheTuple(RELOID,
ObjectIdGetDatum(indexrelid),
diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c
index 229dff9809..98f3de9439 100644
--- a/src/backend/optimizer/util/relnode.c
+++ b/src/backend/optimizer/util/relnode.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.2 1997/09/07 04:44:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.3 1997/09/08 02:25:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,11 +27,11 @@
* necessary. This is for base relations.
*
*/
-Rel *
+Rel *
get_base_rel(Query * root, int relid)
{
- List *relids;
- Rel *rel;
+ List *relids;
+ Rel *rel;
relids = lconsi(relid, NIL);
rel = rel_member(relids, root->base_relation_list_);
@@ -77,9 +77,9 @@ get_base_rel(Query * root, int relid)
}
else
{
- bool hasindex;
- int pages,
- tuples;
+ bool hasindex;
+ int pages,
+ tuples;
/*
* Otherwise, retrieve relation characteristics from the
@@ -100,7 +100,7 @@ get_base_rel(Query * root, int relid)
* creating a new one if necessary. This is for join relations.
*
*/
-Rel *
+Rel *
get_join_rel(Query * root, List * relid)
{
return rel_member(relid, root->join_relation_list_);
@@ -114,11 +114,11 @@ get_join_rel(Query * root, List * relid)
* Returns the corresponding entry in 'rels' if it is there.
*
*/
-Rel *
+Rel *
rel_member(List * relid, List * rels)
{
- List *temp = NIL;
- List *temprelid = NIL;
+ List *temp = NIL;
+ List *temprelid = NIL;
if (relid != NIL && rels != NIL)
{
diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c
index 7e8563d31a..d9307e6d5b 100644
--- a/src/backend/optimizer/util/tlist.c
+++ b/src/backend/optimizer/util/tlist.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.5 1997/09/07 04:44:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.6 1997/09/08 02:25:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,7 +28,7 @@
#include "nodes/makefuncs.h"
#include "parser/catalog_utils.h"
-static Node *flatten_tlistentry(Node * tlistentry, List * flat_tlist);
+static Node *flatten_tlistentry(Node * tlistentry, List * flat_tlist);
/*****************************************************************************
* ---------- RELATION node target list routines ----------
@@ -44,12 +44,12 @@ static Node *flatten_tlistentry(Node * tlistentry, List * flat_tlist);
* var = valid var-node
* targetlist = valid sequence
*/
-TargetEntry *
+TargetEntry *
tlistentry_member(Var * var, List * targetlist)
{
if (var)
{
- List *temp = NIL;
+ List *temp = NIL;
foreach(temp, targetlist)
{
@@ -69,10 +69,10 @@ tlistentry_member(Var * var, List * targetlist)
* REQUIRES: "test" operates on lispval unions,
*
*/
-Expr *
+Expr *
matching_tlvar(Var * var, List * targetlist)
{
- TargetEntry *tlentry;
+ TargetEntry *tlentry;
tlentry = tlistentry_member(var, targetlist);
if (tlentry)
@@ -96,7 +96,7 @@ matching_tlvar(Var * var, List * targetlist)
void
add_tl_element(Rel * rel, Var * var)
{
- Expr *oldvar = (Expr *) NULL;
+ Expr *oldvar = (Expr *) NULL;
oldvar = matching_tlvar(var, rel->targetlist);
@@ -105,12 +105,12 @@ add_tl_element(Rel * rel, Var * var)
*/
if (oldvar == NULL)
{
- List *tlist = rel->targetlist;
- Var *newvar = makeVar(var->varno,
- var->varattno,
- var->vartype,
- var->varno,
- var->varoattno);
+ List *tlist = rel->targetlist;
+ Var *newvar = makeVar(var->varno,
+ var->varattno,
+ var->vartype,
+ var->varno,
+ var->varoattno);
rel->targetlist =
lappend(tlist,
@@ -129,10 +129,10 @@ add_tl_element(Rel * rel, Var * var)
* RETURNS: newly created tlist-entry
* CREATES: new targetlist entry (always).
*/
-TargetEntry *
+TargetEntry *
create_tl_element(Var * var, int resdomno)
{
- TargetEntry *tlelement = makeNode(TargetEntry);
+ TargetEntry *tlelement = makeNode(TargetEntry);
tlelement->resdom =
makeResdom(resdomno,
@@ -152,7 +152,7 @@ create_tl_element(Var * var, int resdomno)
* Returns the targetlist elements from a relation tlist.
*
*/
-List *
+List *
get_actual_tlist(List * tlist)
{
@@ -160,8 +160,8 @@ get_actual_tlist(List * tlist)
* this function is not making sense. - ay 10/94
*/
#if 0
- List *element = NIL;
- List *result = NIL;
+ List *element = NIL;
+ List *result = NIL;
if (tlist == NULL)
{
@@ -199,12 +199,12 @@ get_actual_tlist(List * tlist)
* Returns the resdom entry of the matching var node.
*
*/
-Resdom *
+Resdom *
tlist_member(Var * var, List * tlist)
{
- List *i = NIL;
- TargetEntry *temp_tle = (TargetEntry *) NULL;
- TargetEntry *tl_elt = (TargetEntry *) NULL;
+ List *i = NIL;
+ TargetEntry *temp_tle = (TargetEntry *) NULL;
+ TargetEntry *tl_elt = (TargetEntry *) NULL;
if (var)
{
@@ -229,12 +229,12 @@ tlist_member(Var * var, List * tlist)
/*
* Routine to get the resdom out of a targetlist.
*/
-Resdom *
+Resdom *
tlist_resdom(List * tlist, Resdom * resnode)
{
- Resdom *resdom = (Resdom *) NULL;
- List *i = NIL;
- TargetEntry *temp_tle = (TargetEntry *) NULL;
+ Resdom *resdom = (Resdom *) NULL;
+ List *i = NIL;
+ TargetEntry *temp_tle = (TargetEntry *) NULL;
foreach(i, tlist)
{
@@ -264,18 +264,18 @@ tlist_resdom(List * tlist, Resdom * resnode)
* [what used to be varid is now broken up into two fields varnoold and
* varoattno. Also, nested attnos are long gone. - ay 2/95]
*/
-TargetEntry *
+TargetEntry *
match_varid(Var * test_var, List * tlist)
{
- List *tl;
- Oid type_var;
+ List *tl;
+ Oid type_var;
type_var = (Oid) test_var->vartype;
foreach(tl, tlist)
{
- TargetEntry *entry;
- Var *tlvar;
+ TargetEntry *entry;
+ Var *tlvar;
entry = lfirst(tl);
tlvar = get_expr(entry);
@@ -310,15 +310,15 @@ match_varid(Var * test_var, List * tlist)
* Returns the resulting target list.
*
*/
-List *
+List *
new_unsorted_tlist(List * targetlist)
{
- List *new_targetlist = (List *) copyObject((Node *) targetlist);
- List *x = NIL;
+ List *new_targetlist = (List *) copyObject((Node *) targetlist);
+ List *x = NIL;
foreach(x, new_targetlist)
{
- TargetEntry *tle = (TargetEntry *) lfirst(x);
+ TargetEntry *tle = (TargetEntry *) lfirst(x);
tle->resdom->reskey = 0;
tle->resdom->reskeyop = (Oid) 0;
@@ -338,18 +338,18 @@ new_unsorted_tlist(List * targetlist)
* Returns a new target list.
*
*/
-List *
+List *
copy_vars(List * target, List * source)
{
- List *result = NIL;
- List *src = NIL;
- List *dest = NIL;
+ List *result = NIL;
+ List *src = NIL;
+ List *dest = NIL;
for (src = source, dest = target; src != NIL &&
dest != NIL; src = lnext(src), dest = lnext(dest))
{
- TargetEntry *temp = MakeTLE(((TargetEntry *) lfirst(dest))->resdom,
- (Node *) get_expr(lfirst(src)));
+ TargetEntry *temp = MakeTLE(((TargetEntry *) lfirst(dest))->resdom,
+ (Node *) get_expr(lfirst(src)));
result = lappend(result, temp);
}
@@ -366,18 +366,18 @@ copy_vars(List * target, List * source)
* Returns the "flattened" new target list.
*
*/
-List *
+List *
flatten_tlist(List * tlist)
{
- int last_resdomno = 1;
- List *new_tlist = NIL;
- List *tlist_vars = NIL;
- List *temp;
+ int last_resdomno = 1;
+ List *new_tlist = NIL;
+ List *tlist_vars = NIL;
+ List *temp;
foreach(temp, tlist)
{
- TargetEntry *temp_entry = NULL;
- List *vars;
+ TargetEntry *temp_entry = NULL;
+ List *vars;
temp_entry = lfirst(temp);
vars = pull_var_clause((Node *) get_expr(temp_entry));
@@ -389,11 +389,11 @@ flatten_tlist(List * tlist)
foreach(temp, tlist_vars)
{
- Var *var = lfirst(temp);
+ Var *var = lfirst(temp);
if (!(tlist_member(var, new_tlist)))
{
- Resdom *r;
+ Resdom *r;
r = makeResdom(last_resdomno,
var->vartype,
@@ -422,15 +422,15 @@ flatten_tlist(List * tlist)
* Returns the modified actual target list.
*
*/
-List *
+List *
flatten_tlist_vars(List * full_tlist, List * flat_tlist)
{
- List *x = NIL;
- List *result = NIL;
+ List *x = NIL;
+ List *result = NIL;
foreach(x, full_tlist)
{
- TargetEntry *tle = lfirst(x);
+ TargetEntry *tle = lfirst(x);
result =
lappend(result,
@@ -453,7 +453,7 @@ flatten_tlist_vars(List * full_tlist, List * flat_tlist)
* Returns the (modified) target_list entry from the target list.
*
*/
-static Node *
+static Node *
flatten_tlistentry(Node * tlistentry, List * flat_tlist)
{
if (tlistentry == NULL)
@@ -486,9 +486,9 @@ flatten_tlistentry(Node * tlistentry, List * flat_tlist)
}
else if (is_funcclause(tlistentry))
{
- Expr *expr = (Expr *) tlistentry;
- List *temp_result = NIL;
- List *elt = NIL;
+ Expr *expr = (Expr *) tlistentry;
+ List *temp_result = NIL;
+ List *elt = NIL;
foreach(elt, expr->args)
temp_result = lappend(temp_result,
@@ -506,9 +506,9 @@ flatten_tlistentry(Node * tlistentry, List * flat_tlist)
}
else if (IsA(tlistentry, ArrayRef))
{
- ArrayRef *aref = (ArrayRef *) tlistentry;
- List *temp = NIL;
- List *elt = NIL;
+ ArrayRef *aref = (ArrayRef *) tlistentry;
+ List *temp = NIL;
+ List *elt = NIL;
foreach(elt, aref->refupperindexpr)
temp = lappend(temp, flatten_tlistentry(lfirst(elt), flat_tlist));
@@ -529,11 +529,11 @@ flatten_tlistentry(Node * tlistentry, List * flat_tlist)
}
else
{
- Expr *expr = (Expr *) tlistentry;
- Var *left =
+ Expr *expr = (Expr *) tlistentry;
+ Var *left =
(Var *) flatten_tlistentry((Node *) get_leftop(expr),
flat_tlist);
- Var *right =
+ Var *right =
(Var *) flatten_tlistentry((Node *) get_rightop(expr),
flat_tlist);
@@ -543,17 +543,17 @@ flatten_tlistentry(Node * tlistentry, List * flat_tlist)
}
-TargetEntry *
+TargetEntry *
MakeTLE(Resdom * resdom, Node * expr)
{
- TargetEntry *rt = makeNode(TargetEntry);
+ TargetEntry *rt = makeNode(TargetEntry);
rt->resdom = resdom;
rt->expr = expr;
return rt;
}
-Var *
+Var *
get_expr(TargetEntry * tle)
{
Assert(tle != NULL);
@@ -576,17 +576,17 @@ get_expr(TargetEntry * tle)
void
AddGroupAttrToTlist(List * tlist, List * grpCl)
{
- List *gl;
- int last_resdomno = length(tlist) + 1;
+ List *gl;
+ int last_resdomno = length(tlist) + 1;
foreach(gl, grpCl)
{
- GroupClause *gc = (GroupClause *) lfirst(gl);
- Var *var = gc->grpAttr;
+ GroupClause *gc = (GroupClause *) lfirst(gl);
+ Var *var = gc->grpAttr;
if (!(tlist_member(var, tlist)))
{
- Resdom *r;
+ Resdom *r;
r = makeResdom(last_resdomno,
var->vartype,
@@ -608,9 +608,9 @@ AddGroupAttrToTlist(List * tlist, List * grpCl)
int
exec_tlist_length(List * targetlist)
{
- int len;
- List *tl;
- TargetEntry *curTle;
+ int len;
+ List *tl;
+ TargetEntry *curTle;
len = 0;
foreach(tl, targetlist)
diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c
index 40abf5f80c..e01720aa2e 100644
--- a/src/backend/optimizer/util/var.c
+++ b/src/backend/optimizer/util/var.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.4 1997/09/07 04:44:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.5 1997/09/08 02:25:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,35 +34,35 @@
* XXX assumes varno's are always integers, which shouldn't be true...
* (though it currently is, see primnodes.h)
*/
-List *
+List *
pull_varnos(Node * me)
{
- List *i,
- *result = NIL;
+ List *i,
+ *result = NIL;
if (me == NULL)
return (NIL);
switch (nodeTag(me))
{
- case T_List:
- foreach(i, (List *) me)
- {
- result = nconc(result, pull_varnos(lfirst(i)));
- }
- break;
- case T_ArrayRef:
- foreach(i, ((ArrayRef *) me)->refupperindexpr)
- result = nconc(result, pull_varnos(lfirst(i)));
- foreach(i, ((ArrayRef *) me)->reflowerindexpr)
- result = nconc(result, pull_varnos(lfirst(i)));
- result = nconc(result, pull_varnos(((ArrayRef *) me)->refassgnexpr));
- break;
- case T_Var:
- result = lconsi(((Var *) me)->varno, NIL);
- break;
- default:
- break;
+ case T_List:
+ foreach(i, (List *) me)
+ {
+ result = nconc(result, pull_varnos(lfirst(i)));
+ }
+ break;
+ case T_ArrayRef:
+ foreach(i, ((ArrayRef *) me)->refupperindexpr)
+ result = nconc(result, pull_varnos(lfirst(i)));
+ foreach(i, ((ArrayRef *) me)->reflowerindexpr)
+ result = nconc(result, pull_varnos(lfirst(i)));
+ result = nconc(result, pull_varnos(((ArrayRef *) me)->refassgnexpr));
+ break;
+ case T_Var:
+ result = lconsi(((Var *) me)->varno, NIL);
+ break;
+ default:
+ break;
}
return (result);
}
@@ -87,7 +87,7 @@ contain_var_clause(Node * clause)
return FALSE;
else if (or_clause(clause))
{
- List *temp;
+ List *temp;
foreach(temp, ((Expr *) clause)->args)
{
@@ -98,7 +98,7 @@ contain_var_clause(Node * clause)
}
else if (is_funcclause(clause))
{
- List *temp;
+ List *temp;
foreach(temp, ((Expr *) clause)->args)
{
@@ -109,7 +109,7 @@ contain_var_clause(Node * clause)
}
else if (IsA(clause, ArrayRef))
{
- List *temp;
+ List *temp;
foreach(temp, ((ArrayRef *) clause)->refupperindexpr)
{
@@ -143,10 +143,10 @@ contain_var_clause(Node * clause)
*
* Returns list of varnodes found.
*/
-List *
+List *
pull_var_clause(Node * clause)
{
- List *retval = NIL;
+ List *retval = NIL;
if (clause == NULL)
return (NIL);
@@ -158,14 +158,14 @@ pull_var_clause(Node * clause)
retval = NIL;
else if (or_clause(clause))
{
- List *temp;
+ List *temp;
foreach(temp, ((Expr *) clause)->args)
retval = nconc(retval, pull_var_clause(lfirst(temp)));
}
else if (is_funcclause(clause))
{
- List *temp;
+ List *temp;
foreach(temp, ((Expr *) clause)->args)
retval = nconc(retval, pull_var_clause(lfirst(temp)));
@@ -176,7 +176,7 @@ pull_var_clause(Node * clause)
}
else if (IsA(clause, ArrayRef))
{
- List *temp;
+ List *temp;
foreach(temp, ((ArrayRef *) clause)->refupperindexpr)
retval = nconc(retval, pull_var_clause(lfirst(temp)));
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 8f63522812..c796c74b1a 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.39 1997/09/07 04:44:38 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.40 1997/09/08 02:25:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,54 +44,54 @@
#include "port-protos.h" /* strdup() */
/* convert the parse tree into a query tree */
-static Query *transformStmt(ParseState * pstate, Node * stmt);
-
-static Query *transformDeleteStmt(ParseState * pstate, DeleteStmt * stmt);
-static Query *transformInsertStmt(ParseState * pstate, AppendStmt * stmt);
-static Query *transformIndexStmt(ParseState * pstate, IndexStmt * stmt);
-static Query *transformExtendStmt(ParseState * pstate, ExtendStmt * stmt);
-static Query *transformRuleStmt(ParseState * query, RuleStmt * stmt);
-static Query *transformSelectStmt(ParseState * pstate, RetrieveStmt * stmt);
-static Query *transformUpdateStmt(ParseState * pstate, ReplaceStmt * stmt);
-static Query *transformCursorStmt(ParseState * pstate, CursorStmt * stmt);
-static Node *handleNestedDots(ParseState * pstate, Attr * attr, int *curr_resno);
+static Query *transformStmt(ParseState * pstate, Node * stmt);
+
+static Query *transformDeleteStmt(ParseState * pstate, DeleteStmt * stmt);
+static Query *transformInsertStmt(ParseState * pstate, AppendStmt * stmt);
+static Query *transformIndexStmt(ParseState * pstate, IndexStmt * stmt);
+static Query *transformExtendStmt(ParseState * pstate, ExtendStmt * stmt);
+static Query *transformRuleStmt(ParseState * query, RuleStmt * stmt);
+static Query *transformSelectStmt(ParseState * pstate, RetrieveStmt * stmt);
+static Query *transformUpdateStmt(ParseState * pstate, ReplaceStmt * stmt);
+static Query *transformCursorStmt(ParseState * pstate, CursorStmt * stmt);
+static Node *handleNestedDots(ParseState * pstate, Attr * attr, int *curr_resno);
#define EXPR_COLUMN_FIRST 1
#define EXPR_RELATION_FIRST 2
-static Node *transformExpr(ParseState * pstate, Node * expr, int precedence);
-static Node *transformIdent(ParseState * pstate, Node * expr, int precedence);
-
-static void makeRangeTable(ParseState * pstate, char *relname, List * frmList);
-static List *expandAllTables(ParseState * pstate);
-static char *figureColname(Node * expr, Node * resval);
-static List *makeTargetNames(ParseState * pstate, List * cols);
-static List *transformTargetList(ParseState * pstate, List * targetlist);
+static Node *transformExpr(ParseState * pstate, Node * expr, int precedence);
+static Node *transformIdent(ParseState * pstate, Node * expr, int precedence);
+
+static void makeRangeTable(ParseState * pstate, char *relname, List * frmList);
+static List *expandAllTables(ParseState * pstate);
+static char *figureColname(Node * expr, Node * resval);
+static List *makeTargetNames(ParseState * pstate, List * cols);
+static List *transformTargetList(ParseState * pstate, List * targetlist);
static TargetEntry *
make_targetlist_expr(ParseState * pstate,
char *colname, Node * expr,
List * arrayRef);
-static bool inWhereClause = false;
-static Node *transformWhereClause(ParseState * pstate, Node * a_expr);
-static List *
+static bool inWhereClause = false;
+static Node *transformWhereClause(ParseState * pstate, Node * a_expr);
+static List *
transformGroupClause(ParseState * pstate, List * grouplist,
List * targetlist);
-static List *
+static List *
transformSortClause(ParseState * pstate,
List * orderlist, List * targetlist,
char *uniqueFlag);
-static void parseFromClause(ParseState * pstate, List * frmList);
-static Node *
+static void parseFromClause(ParseState * pstate, List * frmList);
+static Node *
ParseFunc(ParseState * pstate, char *funcname,
List * fargs, int *curr_resno);
-static List *setup_tlist(char *attname, Oid relid);
-static List *setup_base_tlist(Oid typeid);
+static List *setup_tlist(char *attname, Oid relid);
+static List *setup_base_tlist(Oid typeid);
static void
make_arguments(int nargs, List * fargs, Oid * input_typeids,
Oid * function_typeids);
-static void AddAggToParseState(ParseState * pstate, Aggreg * aggreg);
-static void finalizeAggregates(ParseState * pstate, Query * qry);
-static void parseCheckAggregates(ParseState * pstate, Query * qry);
+static void AddAggToParseState(ParseState * pstate, Aggreg * aggreg);
+static void finalizeAggregates(ParseState * pstate, Query * qry);
+static void parseCheckAggregates(ParseState * pstate, Query * qry);
static ParseState *makeParseState(void);
/*****************************************************************************
@@ -108,7 +108,7 @@ static ParseState *makeParseState(void);
static ParseState *
makeParseState(void)
{
- ParseState *pstate;
+ ParseState *pstate;
pstate = malloc(sizeof(ParseState));
pstate->p_last_resno = 1;
@@ -134,12 +134,12 @@ makeParseState(void)
*
* CALLER is responsible for freeing the QueryTreeList* returned
*/
-QueryTreeList *
+QueryTreeList *
parse_analyze(List * pl)
{
- QueryTreeList *result;
- ParseState *pstate;
- int i = 0;
+ QueryTreeList *result;
+ ParseState *pstate;
+ int i = 0;
result = malloc(sizeof(QueryTreeList));
result->len = length(pl);
@@ -165,102 +165,103 @@ parse_analyze(List * pl)
* transform a Parse tree. If it is an optimizable statement, turn it
* into a Query tree.
*/
-static Query *
+static Query *
transformStmt(ParseState * pstate, Node * parseTree)
{
- Query *result = NULL;
+ Query *result = NULL;
switch (nodeTag(parseTree))
{
- /*------------------------
- * Non-optimizable statements
- *------------------------
- */
- case T_IndexStmt:
- result = transformIndexStmt(pstate, (IndexStmt *) parseTree);
- break;
+ /*------------------------
+ * Non-optimizable statements
+ *------------------------
+ */
+ case T_IndexStmt:
+ result = transformIndexStmt(pstate, (IndexStmt *) parseTree);
+ break;
- case T_ExtendStmt:
- result = transformExtendStmt(pstate, (ExtendStmt *) parseTree);
- break;
+ case T_ExtendStmt:
+ result = transformExtendStmt(pstate, (ExtendStmt *) parseTree);
+ break;
- case T_RuleStmt:
- result = transformRuleStmt(pstate, (RuleStmt *) parseTree);
- break;
+ case T_RuleStmt:
+ result = transformRuleStmt(pstate, (RuleStmt *) parseTree);
+ break;
- case T_ViewStmt:
- {
- ViewStmt *n = (ViewStmt *) parseTree;
+ case T_ViewStmt:
+ {
+ ViewStmt *n = (ViewStmt *) parseTree;
- n->query = (Query *) transformStmt(pstate, (Node *) n->query);
- result = makeNode(Query);
- result->commandType = CMD_UTILITY;
- result->utilityStmt = (Node *) n;
- }
- break;
+ n->query = (Query *) transformStmt(pstate, (Node *) n->query);
+ result = makeNode(Query);
+ result->commandType = CMD_UTILITY;
+ result->utilityStmt = (Node *) n;
+ }
+ break;
- case T_VacuumStmt:
- {
- MemoryContext oldcontext;
+ case T_VacuumStmt:
+ {
+ MemoryContext oldcontext;
- /*
- * make sure that this Query is allocated in TopMemory context
- * because vacuum spans transactions and we don't want to lose
- * the vacuum Query due to end-of-transaction free'ing
- */
- oldcontext = MemoryContextSwitchTo(TopMemoryContext);
- result = makeNode(Query);
- result->commandType = CMD_UTILITY;
- result->utilityStmt = (Node *) parseTree;
- MemoryContextSwitchTo(oldcontext);
- break;
+ /*
+ * make sure that this Query is allocated in TopMemory
+ * context because vacuum spans transactions and we don't
+ * want to lose the vacuum Query due to end-of-transaction
+ * free'ing
+ */
+ oldcontext = MemoryContextSwitchTo(TopMemoryContext);
+ result = makeNode(Query);
+ result->commandType = CMD_UTILITY;
+ result->utilityStmt = (Node *) parseTree;
+ MemoryContextSwitchTo(oldcontext);
+ break;
- }
- case T_ExplainStmt:
- {
- ExplainStmt *n = (ExplainStmt *) parseTree;
+ }
+ case T_ExplainStmt:
+ {
+ ExplainStmt *n = (ExplainStmt *) parseTree;
- result = makeNode(Query);
- result->commandType = CMD_UTILITY;
- n->query = transformStmt(pstate, (Node *) n->query);
- result->utilityStmt = (Node *) parseTree;
- }
- break;
+ result = makeNode(Query);
+ result->commandType = CMD_UTILITY;
+ n->query = transformStmt(pstate, (Node *) n->query);
+ result->utilityStmt = (Node *) parseTree;
+ }
+ break;
- /*------------------------
- * Optimizable statements
- *------------------------
- */
- case T_AppendStmt:
- result = transformInsertStmt(pstate, (AppendStmt *) parseTree);
- break;
+ /*------------------------
+ * Optimizable statements
+ *------------------------
+ */
+ case T_AppendStmt:
+ result = transformInsertStmt(pstate, (AppendStmt *) parseTree);
+ break;
- case T_DeleteStmt:
- result = transformDeleteStmt(pstate, (DeleteStmt *) parseTree);
- break;
+ case T_DeleteStmt:
+ result = transformDeleteStmt(pstate, (DeleteStmt *) parseTree);
+ break;
- case T_ReplaceStmt:
- result = transformUpdateStmt(pstate, (ReplaceStmt *) parseTree);
- break;
+ case T_ReplaceStmt:
+ result = transformUpdateStmt(pstate, (ReplaceStmt *) parseTree);
+ break;
- case T_CursorStmt:
- result = transformCursorStmt(pstate, (CursorStmt *) parseTree);
- break;
+ case T_CursorStmt:
+ result = transformCursorStmt(pstate, (CursorStmt *) parseTree);
+ break;
- case T_RetrieveStmt:
- result = transformSelectStmt(pstate, (RetrieveStmt *) parseTree);
- break;
+ case T_RetrieveStmt:
+ result = transformSelectStmt(pstate, (RetrieveStmt *) parseTree);
+ break;
- default:
+ default:
- /*
- * other statments don't require any transformation-- just return
- * the original parsetree
- */
- result = makeNode(Query);
- result->commandType = CMD_UTILITY;
- result->utilityStmt = (Node *) parseTree;
- break;
+ /*
+ * other statments don't require any transformation-- just
+ * return the original parsetree
+ */
+ result = makeNode(Query);
+ result->commandType = CMD_UTILITY;
+ result->utilityStmt = (Node *) parseTree;
+ break;
}
return result;
}
@@ -269,10 +270,10 @@ transformStmt(ParseState * pstate, Node * parseTree)
* transformDeleteStmt -
* transforms a Delete Statement
*/
-static Query *
+static Query *
transformDeleteStmt(ParseState * pstate, DeleteStmt * stmt)
{
- Query *qry = makeNode(Query);
+ Query *qry = makeNode(Query);
qry->commandType = CMD_DELETE;
@@ -298,10 +299,10 @@ transformDeleteStmt(ParseState * pstate, DeleteStmt * stmt)
* transformInsertStmt -
* transform an Insert Statement
*/
-static Query *
+static Query *
transformInsertStmt(ParseState * pstate, AppendStmt * stmt)
{
- Query *qry = makeNode(Query); /* make a new query tree */
+ Query *qry = makeNode(Query); /* make a new query tree */
qry->commandType = CMD_INSERT;
pstate->p_is_insert = true;
@@ -333,10 +334,10 @@ transformInsertStmt(ParseState * pstate, AppendStmt * stmt)
* transformIndexStmt -
* transforms the qualification of the index statement
*/
-static Query *
+static Query *
transformIndexStmt(ParseState * pstate, IndexStmt * stmt)
{
- Query *q;
+ Query *q;
q = makeNode(Query);
q->commandType = CMD_UTILITY;
@@ -355,10 +356,10 @@ transformIndexStmt(ParseState * pstate, IndexStmt * stmt)
* transform the qualifications of the Extend Index Statement
*
*/
-static Query *
+static Query *
transformExtendStmt(ParseState * pstate, ExtendStmt * stmt)
{
- Query *q;
+ Query *q;
q = makeNode(Query);
q->commandType = CMD_UTILITY;
@@ -376,11 +377,11 @@ transformExtendStmt(ParseState * pstate, ExtendStmt * stmt)
* transform a Create Rule Statement. The actions is a list of parse
* trees which is transformed into a list of query trees.
*/
-static Query *
+static Query *
transformRuleStmt(ParseState * pstate, RuleStmt * stmt)
{
- Query *q;
- List *actions;
+ Query *q;
+ List *actions;
q = makeNode(Query);
q->commandType = CMD_UTILITY;
@@ -424,10 +425,10 @@ transformRuleStmt(ParseState * pstate, RuleStmt * stmt)
* transforms a Select Statement
*
*/
-static Query *
+static Query *
transformSelectStmt(ParseState * pstate, RetrieveStmt * stmt)
{
- Query *qry = makeNode(Query);
+ Query *qry = makeNode(Query);
qry->commandType = CMD_SELECT;
@@ -476,10 +477,10 @@ transformSelectStmt(ParseState * pstate, RetrieveStmt * stmt)
* transforms an update statement
*
*/
-static Query *
+static Query *
transformUpdateStmt(ParseState * pstate, ReplaceStmt * stmt)
{
- Query *qry = makeNode(Query);
+ Query *qry = makeNode(Query);
qry->commandType = CMD_UPDATE;
pstate->p_is_update = true;
@@ -511,10 +512,10 @@ transformUpdateStmt(ParseState * pstate, ReplaceStmt * stmt)
* transform a Create Cursor Statement
*
*/
-static Query *
+static Query *
transformCursorStmt(ParseState * pstate, CursorStmt * stmt)
{
- Query *qry = makeNode(Query);
+ Query *qry = makeNode(Query);
/*
* in the old days, a cursor statement is a 'retrieve into portal'; If
@@ -569,239 +570,240 @@ transformCursorStmt(ParseState * pstate, CursorStmt * stmt)
* (raw) expressions collected by the parse tree. Hence the transformation
* here.
*/
-static Node *
+static Node *
transformExpr(ParseState * pstate, Node * expr, int precedence)
{
- Node *result = NULL;
+ Node *result = NULL;
if (expr == NULL)
return NULL;
switch (nodeTag(expr))
{
- case T_Attr:
- {
- Attr *att = (Attr *) expr;
- Node *temp;
-
- /* what if att.attrs == "*"?? */
- temp = handleNestedDots(pstate, att, &pstate->p_last_resno);
- if (att->indirection != NIL)
+ case T_Attr:
{
- List *idx = att->indirection;
+ Attr *att = (Attr *) expr;
+ Node *temp;
- while (idx != NIL)
+ /* what if att.attrs == "*"?? */
+ temp = handleNestedDots(pstate, att, &pstate->p_last_resno);
+ if (att->indirection != NIL)
{
- A_Indices *ai = (A_Indices *) lfirst(idx);
- Node *lexpr = NULL,
- *uexpr;
+ List *idx = att->indirection;
- uexpr = transformExpr(pstate, ai->uidx, precedence); /* must exists */
- if (exprType(uexpr) != INT4OID)
- elog(WARN, "array index expressions must be int4's");
- if (ai->lidx != NULL)
+ while (idx != NIL)
{
- lexpr = transformExpr(pstate, ai->lidx, precedence);
- if (exprType(lexpr) != INT4OID)
+ A_Indices *ai = (A_Indices *) lfirst(idx);
+ Node *lexpr = NULL,
+ *uexpr;
+
+ uexpr = transformExpr(pstate, ai->uidx, precedence); /* must exists */
+ if (exprType(uexpr) != INT4OID)
elog(WARN, "array index expressions must be int4's");
- }
+ if (ai->lidx != NULL)
+ {
+ lexpr = transformExpr(pstate, ai->lidx, precedence);
+ if (exprType(lexpr) != INT4OID)
+ elog(WARN, "array index expressions must be int4's");
+ }
#if 0
- pfree(ai->uidx);
- if (ai->lidx != NULL)
- pfree(ai->lidx);
+ pfree(ai->uidx);
+ if (ai->lidx != NULL)
+ pfree(ai->lidx);
#endif
- ai->lidx = lexpr;
- ai->uidx = uexpr;
+ ai->lidx = lexpr;
+ ai->uidx = uexpr;
- /*
- * note we reuse the list of indices, make sure we
- * don't free them! Otherwise, make a new list here
- */
- idx = lnext(idx);
+ /*
+ * note we reuse the list of indices, make sure we
+ * don't free them! Otherwise, make a new list
+ * here
+ */
+ idx = lnext(idx);
+ }
+ result = (Node *) make_array_ref(temp, att->indirection);
+ }
+ else
+ {
+ result = temp;
}
- result = (Node *) make_array_ref(temp, att->indirection);
+ break;
}
- else
+ case T_A_Const:
{
- result = temp;
- }
- break;
- }
- case T_A_Const:
- {
- A_Const *con = (A_Const *) expr;
- Value *val = &con->val;
+ A_Const *con = (A_Const *) expr;
+ Value *val = &con->val;
- if (con->typename != NULL)
- {
- result = parser_typecast(val, con->typename, -1);
+ if (con->typename != NULL)
+ {
+ result = parser_typecast(val, con->typename, -1);
+ }
+ else
+ {
+ result = (Node *) make_const(val);
+ }
+ break;
}
- else
+ case T_ParamNo:
{
- result = (Node *) make_const(val);
+ ParamNo *pno = (ParamNo *) expr;
+ Oid toid;
+ int paramno;
+ Param *param;
+
+ paramno = pno->number;
+ toid = param_type(paramno);
+ if (!OidIsValid(toid))
+ {
+ elog(WARN, "Parameter '$%d' is out of range",
+ paramno);
+ }
+ param = makeNode(Param);
+ param->paramkind = PARAM_NUM;
+ param->paramid = (AttrNumber) paramno;
+ param->paramname = "<unnamed>";
+ param->paramtype = (Oid) toid;
+ param->param_tlist = (List *) NULL;
+
+ result = (Node *) param;
+ break;
}
- break;
- }
- case T_ParamNo:
- {
- ParamNo *pno = (ParamNo *) expr;
- Oid toid;
- int paramno;
- Param *param;
-
- paramno = pno->number;
- toid = param_type(paramno);
- if (!OidIsValid(toid))
+ case T_A_Expr:
{
- elog(WARN, "Parameter '$%d' is out of range",
- paramno);
- }
- param = makeNode(Param);
- param->paramkind = PARAM_NUM;
- param->paramid = (AttrNumber) paramno;
- param->paramname = "<unnamed>";
- param->paramtype = (Oid) toid;
- param->param_tlist = (List *) NULL;
-
- result = (Node *) param;
- break;
- }
- case T_A_Expr:
- {
- A_Expr *a = (A_Expr *) expr;
+ A_Expr *a = (A_Expr *) expr;
- switch (a->oper)
- {
- case OP:
+ switch (a->oper)
{
- Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
- Node *rexpr = transformExpr(pstate, a->rexpr, precedence);
+ case OP:
+ {
+ Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
+ Node *rexpr = transformExpr(pstate, a->rexpr, precedence);
- result = (Node *) make_op(a->opname, lexpr, rexpr);
- }
- break;
- case ISNULL:
- {
- Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
+ result = (Node *) make_op(a->opname, lexpr, rexpr);
+ }
+ break;
+ case ISNULL:
+ {
+ Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
- result = ParseFunc(pstate,
- "nullvalue", lcons(lexpr, NIL),
- &pstate->p_last_resno);
- }
- break;
- case NOTNULL:
- {
- Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
+ result = ParseFunc(pstate,
+ "nullvalue", lcons(lexpr, NIL),
+ &pstate->p_last_resno);
+ }
+ break;
+ case NOTNULL:
+ {
+ Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
- result = ParseFunc(pstate,
+ result = ParseFunc(pstate,
"nonnullvalue", lcons(lexpr, NIL),
- &pstate->p_last_resno);
- }
- break;
- case AND:
- {
- Expr *expr = makeNode(Expr);
- Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
- Node *rexpr = transformExpr(pstate, a->rexpr, precedence);
+ &pstate->p_last_resno);
+ }
+ break;
+ case AND:
+ {
+ Expr *expr = makeNode(Expr);
+ Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
+ Node *rexpr = transformExpr(pstate, a->rexpr, precedence);
- if (exprType(lexpr) != BOOLOID)
- elog(WARN,
- "left-hand side of AND is type '%s', not bool",
- tname(get_id_type(exprType(lexpr))));
- if (exprType(rexpr) != BOOLOID)
- elog(WARN,
- "right-hand side of AND is type '%s', not bool",
- tname(get_id_type(exprType(rexpr))));
- expr->typeOid = BOOLOID;
- expr->opType = AND_EXPR;
- expr->args = makeList(lexpr, rexpr, -1);
- result = (Node *) expr;
- }
- break;
- case OR:
- {
- Expr *expr = makeNode(Expr);
- Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
- Node *rexpr = transformExpr(pstate, a->rexpr, precedence);
+ if (exprType(lexpr) != BOOLOID)
+ elog(WARN,
+ "left-hand side of AND is type '%s', not bool",
+ tname(get_id_type(exprType(lexpr))));
+ if (exprType(rexpr) != BOOLOID)
+ elog(WARN,
+ "right-hand side of AND is type '%s', not bool",
+ tname(get_id_type(exprType(rexpr))));
+ expr->typeOid = BOOLOID;
+ expr->opType = AND_EXPR;
+ expr->args = makeList(lexpr, rexpr, -1);
+ result = (Node *) expr;
+ }
+ break;
+ case OR:
+ {
+ Expr *expr = makeNode(Expr);
+ Node *lexpr = transformExpr(pstate, a->lexpr, precedence);
+ Node *rexpr = transformExpr(pstate, a->rexpr, precedence);
- if (exprType(lexpr) != BOOLOID)
- elog(WARN,
- "left-hand side of OR is type '%s', not bool",
- tname(get_id_type(exprType(lexpr))));
- if (exprType(rexpr) != BOOLOID)
- elog(WARN,
- "right-hand side of OR is type '%s', not bool",
- tname(get_id_type(exprType(rexpr))));
- expr->typeOid = BOOLOID;
- expr->opType = OR_EXPR;
- expr->args = makeList(lexpr, rexpr, -1);
- result = (Node *) expr;
- }
- break;
- case NOT:
- {
- Expr *expr = makeNode(Expr);
- Node *rexpr = transformExpr(pstate, a->rexpr, precedence);
+ if (exprType(lexpr) != BOOLOID)
+ elog(WARN,
+ "left-hand side of OR is type '%s', not bool",
+ tname(get_id_type(exprType(lexpr))));
+ if (exprType(rexpr) != BOOLOID)
+ elog(WARN,
+ "right-hand side of OR is type '%s', not bool",
+ tname(get_id_type(exprType(rexpr))));
+ expr->typeOid = BOOLOID;
+ expr->opType = OR_EXPR;
+ expr->args = makeList(lexpr, rexpr, -1);
+ result = (Node *) expr;
+ }
+ break;
+ case NOT:
+ {
+ Expr *expr = makeNode(Expr);
+ Node *rexpr = transformExpr(pstate, a->rexpr, precedence);
- if (exprType(rexpr) != BOOLOID)
- elog(WARN,
- "argument to NOT is type '%s', not bool",
- tname(get_id_type(exprType(rexpr))));
- expr->typeOid = BOOLOID;
- expr->opType = NOT_EXPR;
- expr->args = makeList(rexpr, -1);
- result = (Node *) expr;
+ if (exprType(rexpr) != BOOLOID)
+ elog(WARN,
+ "argument to NOT is type '%s', not bool",
+ tname(get_id_type(exprType(rexpr))));
+ expr->typeOid = BOOLOID;
+ expr->opType = NOT_EXPR;
+ expr->args = makeList(rexpr, -1);
+ result = (Node *) expr;
+ }
+ break;
}
break;
}
- break;
- }
- case T_Ident:
- {
+ case T_Ident:
+ {
- /*
- * look for a column name or a relation name (the default
- * behavior)
- */
- result = transformIdent(pstate, expr, precedence);
- break;
- }
- case T_FuncCall:
- {
- FuncCall *fn = (FuncCall *) expr;
- List *args;
+ /*
+ * look for a column name or a relation name (the default
+ * behavior)
+ */
+ result = transformIdent(pstate, expr, precedence);
+ break;
+ }
+ case T_FuncCall:
+ {
+ FuncCall *fn = (FuncCall *) expr;
+ List *args;
- /* transform the list of arguments */
- foreach(args, fn->args)
- lfirst(args) = transformExpr(pstate, (Node *) lfirst(args), precedence);
- result = ParseFunc(pstate,
+ /* transform the list of arguments */
+ foreach(args, fn->args)
+ lfirst(args) = transformExpr(pstate, (Node *) lfirst(args), precedence);
+ result = ParseFunc(pstate,
fn->funcname, fn->args, &pstate->p_last_resno);
+ break;
+ }
+ default:
+ /* should not reach here */
+ elog(WARN, "transformExpr: does not know how to transform %d\n",
+ nodeTag(expr));
break;
- }
- default:
- /* should not reach here */
- elog(WARN, "transformExpr: does not know how to transform %d\n",
- nodeTag(expr));
- break;
}
return result;
}
-static Node *
+static Node *
transformIdent(ParseState * pstate, Node * expr, int precedence)
{
- Ident *ident = (Ident *) expr;
- RangeTblEntry *rte;
- Node *column_result,
- *relation_result,
- *result;
+ Ident *ident = (Ident *) expr;
+ RangeTblEntry *rte;
+ Node *column_result,
+ *relation_result,
+ *result;
column_result = relation_result = result = 0;
/* try to find the ident as a column */
if ((rte = colnameRangeTableEntry(pstate, ident->name)) != NULL)
{
- Attr *att = makeNode(Attr);
+ Attr *att = makeNode(Attr);
att->relname = rte->refname;
att->attrs = lcons(makeString(ident->name), NIL);
@@ -856,15 +858,15 @@ transformIdent(ParseState * pstate, Node * expr, int precedence)
static void
parseFromClause(ParseState * pstate, List * frmList)
{
- List *fl;
+ List *fl;
foreach(fl, frmList)
{
- RangeVar *r = lfirst(fl);
- RelExpr *baserel = r->relExpr;
- char *relname = baserel->relname;
- char *refname = r->name;
- RangeTblEntry *rte;
+ RangeVar *r = lfirst(fl);
+ RelExpr *baserel = r->relExpr;
+ char *relname = baserel->relname;
+ char *refname = r->name;
+ RangeTblEntry *rte;
if (refname == NULL)
refname = relname;
@@ -893,7 +895,7 @@ parseFromClause(ParseState * pstate, List * frmList)
static void
makeRangeTable(ParseState * pstate, char *relname, List * frmList)
{
- RangeTblEntry *rte;
+ RangeTblEntry *rte;
parseFromClause(pstate, frmList);
@@ -919,42 +921,42 @@ makeRangeTable(ParseState * pstate, char *relname, List * frmList)
Oid
exprType(Node * expr)
{
- Oid type = (Oid) 0;
+ Oid type = (Oid) 0;
switch (nodeTag(expr))
{
- case T_Func:
- type = ((Func *) expr)->functype;
- break;
- case T_Iter:
- type = ((Iter *) expr)->itertype;
- break;
- case T_Var:
- type = ((Var *) expr)->vartype;
- break;
- case T_Expr:
- type = ((Expr *) expr)->typeOid;
- break;
- case T_Const:
- type = ((Const *) expr)->consttype;
- break;
- case T_ArrayRef:
- type = ((ArrayRef *) expr)->refelemtype;
- break;
- case T_Aggreg:
- type = ((Aggreg *) expr)->aggtype;
- break;
- case T_Param:
- type = ((Param *) expr)->paramtype;
- break;
- case T_Ident:
- /* is this right? */
- type = UNKNOWNOID;
- break;
- default:
- elog(WARN, "exprType: don't know how to get type for %d node",
- nodeTag(expr));
- break;
+ case T_Func:
+ type = ((Func *) expr)->functype;
+ break;
+ case T_Iter:
+ type = ((Iter *) expr)->itertype;
+ break;
+ case T_Var:
+ type = ((Var *) expr)->vartype;
+ break;
+ case T_Expr:
+ type = ((Expr *) expr)->typeOid;
+ break;
+ case T_Const:
+ type = ((Const *) expr)->consttype;
+ break;
+ case T_ArrayRef:
+ type = ((ArrayRef *) expr)->refelemtype;
+ break;
+ case T_Aggreg:
+ type = ((Aggreg *) expr)->aggtype;
+ break;
+ case T_Param:
+ type = ((Param *) expr)->paramtype;
+ break;
+ case T_Ident:
+ /* is this right? */
+ type = UNKNOWNOID;
+ break;
+ default:
+ elog(WARN, "exprType: don't know how to get type for %d node",
+ nodeTag(expr));
+ break;
}
return type;
}
@@ -964,13 +966,13 @@ exprType(Node * expr)
* turns '*' (in the target list) into a list of attributes (of all
* relations in the range table)
*/
-static List *
+static List *
expandAllTables(ParseState * pstate)
{
- List *target = NIL;
- List *legit_rtable = NIL;
- List *rt,
- *rtable;
+ List *target = NIL;
+ List *legit_rtable = NIL;
+ List *rt,
+ *rtable;
rtable = pstate->p_rtable;
if (pstate->p_is_rule)
@@ -992,7 +994,7 @@ expandAllTables(ParseState * pstate)
*/
foreach(rt, rtable)
{
- RangeTblEntry *rte = lfirst(rt);
+ RangeTblEntry *rte = lfirst(rt);
/*
* we only expand those specify in the from clause. (This will
@@ -1006,8 +1008,8 @@ expandAllTables(ParseState * pstate)
foreach(rt, legit_rtable)
{
- RangeTblEntry *rte = lfirst(rt);
- List *temp = target;
+ RangeTblEntry *rte = lfirst(rt);
+ List *temp = target;
if (temp == NIL)
target = expandAll(pstate, rte->relname, rte->refname,
@@ -1030,23 +1032,23 @@ expandAllTables(ParseState * pstate)
* list, we have to guess.
*
*/
-static char *
+static char *
figureColname(Node * expr, Node * resval)
{
switch (nodeTag(expr))
{
- case T_Aggreg:
- return (char *) /* XXX */
- ((Aggreg *) expr)->aggname;
- case T_Expr:
- if (((Expr *) expr)->opType == FUNC_EXPR)
- {
- if (nodeTag(resval) == T_FuncCall)
- return ((FuncCall *) resval)->funcname;
- }
- break;
- default:
- break;
+ case T_Aggreg:
+ return (char *) /* XXX */
+ ((Aggreg *) expr)->aggname;
+ case T_Expr:
+ if (((Expr *) expr)->opType == FUNC_EXPR)
+ {
+ if (nodeTag(resval) == T_FuncCall)
+ return ((FuncCall *) resval)->funcname;
+ }
+ break;
+ default:
+ break;
}
return "?column?";
@@ -1064,23 +1066,23 @@ figureColname(Node * expr, Node * resval)
* test supplied column names to make sure they are in target table
* (used exclusively for inserts)
*/
-static List *
+static List *
makeTargetNames(ParseState * pstate, List * cols)
{
- List *tl = NULL;
+ List *tl = NULL;
/* Generate ResTarget if not supplied */
if (cols == NIL)
{
- int numcol;
- int i;
+ int numcol;
+ int i;
AttributeTupleForm *attr = pstate->p_target_relation->rd_att->attrs;
numcol = pstate->p_target_relation->rd_rel->relnatts;
for (i = 0; i < numcol; i++)
{
- Ident *id = makeNode(Ident);
+ Ident *id = makeNode(Ident);
id->name = palloc(NAMEDATALEN);
strNcpy(id->name, attr[i]->attname.data, NAMEDATALEN - 1);
@@ -1107,264 +1109,269 @@ makeTargetNames(ParseState * pstate, List * cols)
* transformTargetList -
* turns a list of ResTarget's into a list of TargetEntry's
*/
-static List *
+static List *
transformTargetList(ParseState * pstate, List * targetlist)
{
- List *p_target = NIL;
- List *tail_p_target = NIL;
+ List *p_target = NIL;
+ List *tail_p_target = NIL;
while (targetlist != NIL)
{
- ResTarget *res = (ResTarget *) lfirst(targetlist);
- TargetEntry *tent = makeNode(TargetEntry);
+ ResTarget *res = (ResTarget *) lfirst(targetlist);
+ TargetEntry *tent = makeNode(TargetEntry);
switch (nodeTag(res->val))
{
- case T_Ident:
- {
- Node *expr;
- Oid type_id;
- int type_len;
- char *identname;
- char *resname;
+ case T_Ident:
+ {
+ Node *expr;
+ Oid type_id;
+ int type_len;
+ char *identname;
+ char *resname;
- identname = ((Ident *) res->val)->name;
- handleTargetColname(pstate, &res->name, NULL, identname);
+ identname = ((Ident *) res->val)->name;
+ handleTargetColname(pstate, &res->name, NULL, identname);
- /*
- * here we want to look for column names only, not
- * relation
- */
- /* names (even though they can be stored in Ident nodes, */
- /* too) */
- expr = transformIdent(pstate, (Node *) res->val, EXPR_COLUMN_FIRST);
- type_id = exprType(expr);
- type_len = tlen(get_id_type(type_id));
- resname = (res->name) ? res->name : identname;
- tent->resdom = makeResdom((AttrNumber) pstate->p_last_resno++,
- (Oid) type_id,
- (Size) type_len,
- resname,
- (Index) 0,
- (Oid) 0,
- 0);
-
- tent->expr = expr;
- break;
- }
- case T_ParamNo:
- case T_FuncCall:
- case T_A_Const:
- case T_A_Expr:
- {
- Node *expr = transformExpr(pstate, (Node *) res->val, EXPR_COLUMN_FIRST);
+ /*
+ * here we want to look for column names only, not
+ * relation
+ */
- handleTargetColname(pstate, &res->name, NULL, NULL);
- /* note indirection has not been transformed */
- if (pstate->p_is_insert && res->indirection != NIL)
+ /*
+ * names (even though they can be stored in Ident
+ * nodes,
+ */
+ /* too) */
+ expr = transformIdent(pstate, (Node *) res->val, EXPR_COLUMN_FIRST);
+ type_id = exprType(expr);
+ type_len = tlen(get_id_type(type_id));
+ resname = (res->name) ? res->name : identname;
+ tent->resdom = makeResdom((AttrNumber) pstate->p_last_resno++,
+ (Oid) type_id,
+ (Size) type_len,
+ resname,
+ (Index) 0,
+ (Oid) 0,
+ 0);
+
+ tent->expr = expr;
+ break;
+ }
+ case T_ParamNo:
+ case T_FuncCall:
+ case T_A_Const:
+ case T_A_Expr:
{
- /* this is an array assignment */
- char *val;
- char *str,
+ Node *expr = transformExpr(pstate, (Node *) res->val, EXPR_COLUMN_FIRST);
+
+ handleTargetColname(pstate, &res->name, NULL, NULL);
+ /* note indirection has not been transformed */
+ if (pstate->p_is_insert && res->indirection != NIL)
+ {
+ /* this is an array assignment */
+ char *val;
+ char *str,
*save_str;
- List *elt;
- int i = 0,
+ List *elt;
+ int i = 0,
ndims;
- int lindx[MAXDIM],
+ int lindx[MAXDIM],
uindx[MAXDIM];
- int resdomno;
- Relation rd;
- Value *constval;
+ int resdomno;
+ Relation rd;
+ Value *constval;
- if (exprType(expr) != UNKNOWNOID ||
- !IsA(expr, Const))
- elog(WARN, "yyparse: string constant expected");
+ if (exprType(expr) != UNKNOWNOID ||
+ !IsA(expr, Const))
+ elog(WARN, "yyparse: string constant expected");
- val = (char *) textout((struct varlena *)
+ val = (char *) textout((struct varlena *)
((Const *) expr)->constvalue);
- str = save_str = (char *) palloc(strlen(val) + MAXDIM * 25 + 2);
- foreach(elt, res->indirection)
- {
- A_Indices *aind = (A_Indices *) lfirst(elt);
-
- aind->uidx = transformExpr(pstate, aind->uidx, EXPR_COLUMN_FIRST);
- if (!IsA(aind->uidx, Const))
- elog(WARN,
- "Array Index for Append should be a constant");
- uindx[i] = ((Const *) aind->uidx)->constvalue;
- if (aind->lidx != NULL)
+ str = save_str = (char *) palloc(strlen(val) + MAXDIM * 25 + 2);
+ foreach(elt, res->indirection)
{
- aind->lidx = transformExpr(pstate, aind->lidx, EXPR_COLUMN_FIRST);
- if (!IsA(aind->lidx, Const))
+ A_Indices *aind = (A_Indices *) lfirst(elt);
+
+ aind->uidx = transformExpr(pstate, aind->uidx, EXPR_COLUMN_FIRST);
+ if (!IsA(aind->uidx, Const))
elog(WARN,
"Array Index for Append should be a constant");
- lindx[i] = ((Const *) aind->lidx)->constvalue;
+ uindx[i] = ((Const *) aind->uidx)->constvalue;
+ if (aind->lidx != NULL)
+ {
+ aind->lidx = transformExpr(pstate, aind->lidx, EXPR_COLUMN_FIRST);
+ if (!IsA(aind->lidx, Const))
+ elog(WARN,
+ "Array Index for Append should be a constant");
+ lindx[i] = ((Const *) aind->lidx)->constvalue;
+ }
+ else
+ {
+ lindx[i] = 1;
+ }
+ if (lindx[i] > uindx[i])
+ elog(WARN, "yyparse: lower index cannot be greater than upper index");
+ sprintf(str, "[%d:%d]", lindx[i], uindx[i]);
+ str += strlen(str);
+ i++;
}
- else
- {
- lindx[i] = 1;
- }
- if (lindx[i] > uindx[i])
- elog(WARN, "yyparse: lower index cannot be greater than upper index");
- sprintf(str, "[%d:%d]", lindx[i], uindx[i]);
- str += strlen(str);
- i++;
- }
- sprintf(str, "=%s", val);
- rd = pstate->p_target_relation;
- Assert(rd != NULL);
- resdomno = varattno(rd, res->name);
- ndims = att_attnelems(rd, resdomno);
- if (i != ndims)
- elog(WARN, "yyparse: array dimensions do not match");
- constval = makeNode(Value);
- constval->type = T_String;
- constval->val.str = save_str;
- tent = make_targetlist_expr(pstate, res->name,
+ sprintf(str, "=%s", val);
+ rd = pstate->p_target_relation;
+ Assert(rd != NULL);
+ resdomno = varattno(rd, res->name);
+ ndims = att_attnelems(rd, resdomno);
+ if (i != ndims)
+ elog(WARN, "yyparse: array dimensions do not match");
+ constval = makeNode(Value);
+ constval->type = T_String;
+ constval->val.str = save_str;
+ tent = make_targetlist_expr(pstate, res->name,
(Node *) make_const(constval),
- NULL);
- pfree(save_str);
- }
- else
- {
- char *colname = res->name;
-
- /* this is not an array assignment */
- if (colname == NULL)
- {
-
- /*
- * if you're wondering why this is here, look at
- * the yacc grammar for why a name can be missing.
- * -ay
- */
- colname = figureColname(expr, res->val);
+ NULL);
+ pfree(save_str);
}
- if (res->indirection)
+ else
{
- List *ilist = res->indirection;
+ char *colname = res->name;
- while (ilist != NIL)
+ /* this is not an array assignment */
+ if (colname == NULL)
{
- A_Indices *ind = lfirst(ilist);
- ind->lidx = transformExpr(pstate, ind->lidx, EXPR_COLUMN_FIRST);
- ind->uidx = transformExpr(pstate, ind->uidx, EXPR_COLUMN_FIRST);
- ilist = lnext(ilist);
+ /*
+ * if you're wondering why this is here, look
+ * at the yacc grammar for why a name can be
+ * missing. -ay
+ */
+ colname = figureColname(expr, res->val);
}
+ if (res->indirection)
+ {
+ List *ilist = res->indirection;
+
+ while (ilist != NIL)
+ {
+ A_Indices *ind = lfirst(ilist);
+
+ ind->lidx = transformExpr(pstate, ind->lidx, EXPR_COLUMN_FIRST);
+ ind->uidx = transformExpr(pstate, ind->uidx, EXPR_COLUMN_FIRST);
+ ilist = lnext(ilist);
+ }
+ }
+ res->name = colname;
+ tent = make_targetlist_expr(pstate, res->name, expr,
+ res->indirection);
}
- res->name = colname;
- tent = make_targetlist_expr(pstate, res->name, expr,
- res->indirection);
+ break;
}
- break;
- }
- case T_Attr:
- {
- Oid type_id;
- int type_len;
- Attr *att = (Attr *) res->val;
- Node *result;
- char *attrname;
- char *resname;
- Resdom *resnode;
- List *attrs = att->attrs;
-
- /*
- * Target item is a single '*', expand all tables (eg.
- * SELECT * FROM emp)
- */
- if (att->relname != NULL && !strcmp(att->relname, "*"))
+ case T_Attr:
{
- if (tail_p_target == NIL)
- p_target = tail_p_target = expandAllTables(pstate);
- else
- lnext(tail_p_target) = expandAllTables(pstate);
-
- while (lnext(tail_p_target) != NIL)
- /* make sure we point to the last target entry */
- tail_p_target = lnext(tail_p_target);
+ Oid type_id;
+ int type_len;
+ Attr *att = (Attr *) res->val;
+ Node *result;
+ char *attrname;
+ char *resname;
+ Resdom *resnode;
+ List *attrs = att->attrs;
/*
- * skip rest of while loop
+ * Target item is a single '*', expand all tables (eg.
+ * SELECT * FROM emp)
*/
- targetlist = lnext(targetlist);
- continue;
- }
+ if (att->relname != NULL && !strcmp(att->relname, "*"))
+ {
+ if (tail_p_target == NIL)
+ p_target = tail_p_target = expandAllTables(pstate);
+ else
+ lnext(tail_p_target) = expandAllTables(pstate);
- /*
- * Target item is relation.*, expand the table (eg. SELECT
- * emp.*, dname FROM emp, dept)
- */
- attrname = strVal(lfirst(att->attrs));
- if (att->attrs != NIL && !strcmp(attrname, "*"))
- {
+ while (lnext(tail_p_target) != NIL)
+ /* make sure we point to the last target entry */
+ tail_p_target = lnext(tail_p_target);
- /*
- * tail_p_target is the target list we're building in
- * the while loop. Make sure we fix it after appending
- * more nodes.
- */
- if (tail_p_target == NIL)
- p_target = tail_p_target = expandAll(pstate, att->relname,
- att->relname, &pstate->p_last_resno);
- else
- lnext(tail_p_target) =
- expandAll(pstate, att->relname, att->relname,
- &pstate->p_last_resno);
- while (lnext(tail_p_target) != NIL)
- /* make sure we point to the last target entry */
- tail_p_target = lnext(tail_p_target);
+ /*
+ * skip rest of while loop
+ */
+ targetlist = lnext(targetlist);
+ continue;
+ }
/*
- * skip the rest of the while loop
+ * Target item is relation.*, expand the table (eg.
+ * SELECT emp.*, dname FROM emp, dept)
*/
- targetlist = lnext(targetlist);
- continue;
- }
+ attrname = strVal(lfirst(att->attrs));
+ if (att->attrs != NIL && !strcmp(attrname, "*"))
+ {
+ /*
+ * tail_p_target is the target list we're building
+ * in the while loop. Make sure we fix it after
+ * appending more nodes.
+ */
+ if (tail_p_target == NIL)
+ p_target = tail_p_target = expandAll(pstate, att->relname,
+ att->relname, &pstate->p_last_resno);
+ else
+ lnext(tail_p_target) =
+ expandAll(pstate, att->relname, att->relname,
+ &pstate->p_last_resno);
+ while (lnext(tail_p_target) != NIL)
+ /* make sure we point to the last target entry */
+ tail_p_target = lnext(tail_p_target);
+
+ /*
+ * skip the rest of the while loop
+ */
+ targetlist = lnext(targetlist);
+ continue;
+ }
- /*
- * Target item is fully specified: ie. relation.attribute
- */
- result = handleNestedDots(pstate, att, &pstate->p_last_resno);
- handleTargetColname(pstate, &res->name, att->relname, attrname);
- if (att->indirection != NIL)
- {
- List *ilist = att->indirection;
- while (ilist != NIL)
+ /*
+ * Target item is fully specified: ie.
+ * relation.attribute
+ */
+ result = handleNestedDots(pstate, att, &pstate->p_last_resno);
+ handleTargetColname(pstate, &res->name, att->relname, attrname);
+ if (att->indirection != NIL)
{
- A_Indices *ind = lfirst(ilist);
+ List *ilist = att->indirection;
- ind->lidx = transformExpr(pstate, ind->lidx, EXPR_COLUMN_FIRST);
- ind->uidx = transformExpr(pstate, ind->uidx, EXPR_COLUMN_FIRST);
- ilist = lnext(ilist);
+ while (ilist != NIL)
+ {
+ A_Indices *ind = lfirst(ilist);
+
+ ind->lidx = transformExpr(pstate, ind->lidx, EXPR_COLUMN_FIRST);
+ ind->uidx = transformExpr(pstate, ind->uidx, EXPR_COLUMN_FIRST);
+ ilist = lnext(ilist);
+ }
+ result = (Node *) make_array_ref(result, att->indirection);
}
- result = (Node *) make_array_ref(result, att->indirection);
+ type_id = exprType(result);
+ type_len = tlen(get_id_type(type_id));
+ /* move to last entry */
+ while (lnext(attrs) != NIL)
+ attrs = lnext(attrs);
+ resname = (res->name) ? res->name : strVal(lfirst(attrs));
+ resnode = makeResdom((AttrNumber) pstate->p_last_resno++,
+ (Oid) type_id,
+ (Size) type_len,
+ resname,
+ (Index) 0,
+ (Oid) 0,
+ 0);
+ tent->resdom = resnode;
+ tent->expr = result;
+ break;
}
- type_id = exprType(result);
- type_len = tlen(get_id_type(type_id));
- /* move to last entry */
- while (lnext(attrs) != NIL)
- attrs = lnext(attrs);
- resname = (res->name) ? res->name : strVal(lfirst(attrs));
- resnode = makeResdom((AttrNumber) pstate->p_last_resno++,
- (Oid) type_id,
- (Size) type_len,
- resname,
- (Index) 0,
- (Oid) 0,
- 0);
- tent->resdom = resnode;
- tent->expr = result;
+ default:
+ /* internal error */
+ elog(WARN,
+ "internal error: do not know how to transform targetlist");
break;
- }
- default:
- /* internal error */
- elog(WARN,
- "internal error: do not know how to transform targetlist");
- break;
}
if (p_target == NIL)
@@ -1395,15 +1402,15 @@ make_targetlist_expr(ParseState * pstate,
Node * expr,
List * arrayRef)
{
- Oid type_id,
- attrtype;
- int type_len,
- attrlen;
- int resdomno;
- Relation rd;
- bool attrisset;
- TargetEntry *tent;
- Resdom *resnode;
+ Oid type_id,
+ attrtype;
+ int type_len,
+ attrlen;
+ int resdomno;
+ Relation rd;
+ bool attrisset;
+ TargetEntry *tent;
+ Resdom *resnode;
if (expr == NULL)
elog(WARN, "make_targetlist_expr: invalid use of NULL expression");
@@ -1443,7 +1450,7 @@ make_targetlist_expr(ParseState * pstate,
#if 0
if (Input_is_string && Typecast_ok)
{
- Datum val;
+ Datum val;
if (type_id == typeid(type("unknown")))
{
@@ -1505,7 +1512,7 @@ make_targetlist_expr(ParseState * pstate,
if (arrayRef && !(((A_Indices *) lfirst(arrayRef))->lidx))
{
/* updating a single item */
- Oid typelem = get_typelem(attrtype);
+ Oid typelem = get_typelem(attrtype);
expr = (Node *) parser_typecast2(expr,
type_id,
@@ -1530,11 +1537,11 @@ make_targetlist_expr(ParseState * pstate,
if (arrayRef != NIL)
{
- Expr *target_expr;
- Attr *att = makeNode(Attr);
- List *ar = arrayRef;
- List *upperIndexpr = NIL;
- List *lowerIndexpr = NIL;
+ Expr *target_expr;
+ Attr *att = makeNode(Attr);
+ List *ar = arrayRef;
+ List *upperIndexpr = NIL;
+ List *lowerIndexpr = NIL;
att->relname = pstrdup(RelationGetRelationName(rd)->data);
att->attrs = lcons(makeString(colname), NIL);
@@ -1542,7 +1549,7 @@ make_targetlist_expr(ParseState * pstate,
&pstate->p_last_resno);
while (ar != NIL)
{
- A_Indices *ind = lfirst(ar);
+ A_Indices *ind = lfirst(ar);
if (lowerIndexpr || (!upperIndexpr && ind->lidx))
{
@@ -1599,10 +1606,10 @@ make_targetlist_expr(ParseState * pstate,
* transforms the qualification and make sure it is of type Boolean
*
*/
-static Node *
+static Node *
transformWhereClause(ParseState * pstate, Node * a_expr)
{
- Node *qual;
+ Node *qual;
if (a_expr == NULL)
return (Node *) NULL; /* no qualifiers */
@@ -1634,10 +1641,10 @@ transformWhereClause(ParseState * pstate, Node * a_expr)
static TargetEntry *
find_targetlist_entry(ParseState * pstate, SortGroupBy * sortgroupby, List * tlist)
{
- List *i;
- int real_rtable_pos = 0,
- target_pos = 0;
- TargetEntry *target_result = NULL;
+ List *i;
+ int real_rtable_pos = 0,
+ target_pos = 0;
+ TargetEntry *target_result = NULL;
if (sortgroupby->range)
real_rtable_pos = refnameRangeTablePosn(pstate->p_rtable,
@@ -1645,11 +1652,11 @@ find_targetlist_entry(ParseState * pstate, SortGroupBy * sortgroupby, List * tli
foreach(i, tlist)
{
- TargetEntry *target = (TargetEntry *) lfirst(i);
- Resdom *resnode = target->resdom;
- Var *var = (Var *) target->expr;
- char *resname = resnode->resname;
- int test_rtable_pos = var->varno;
+ TargetEntry *target = (TargetEntry *) lfirst(i);
+ Resdom *resnode = target->resdom;
+ Var *var = (Var *) target->expr;
+ char *resname = resnode->resname;
+ int test_rtable_pos = var->varno;
#ifdef PARSEDEBUG
printf("find_targetlist_entry- target name is %s, position %d, resno %d\n",
@@ -1691,11 +1698,11 @@ find_targetlist_entry(ParseState * pstate, SortGroupBy * sortgroupby, List * tli
return target_result;
}
-static Oid
+static Oid
any_ordering_op(int restype)
{
- Operator order_op;
- Oid order_opid;
+ Operator order_op;
+ Oid order_opid;
order_op = oper("<", restype, restype, false);
order_opid = oprid(order_op);
@@ -1708,17 +1715,17 @@ any_ordering_op(int restype)
* transform a Group By clause
*
*/
-static List *
+static List *
transformGroupClause(ParseState * pstate, List * grouplist, List * targetlist)
{
- List *glist = NIL,
- *gl = NIL;
+ List *glist = NIL,
+ *gl = NIL;
while (grouplist != NIL)
{
- GroupClause *grpcl = makeNode(GroupClause);
- TargetEntry *restarget;
- Resdom *resdom;
+ GroupClause *grpcl = makeNode(GroupClause);
+ TargetEntry *restarget;
+ Resdom *resdom;
restarget = find_targetlist_entry(pstate, lfirst(grouplist), targetlist);
@@ -1748,21 +1755,21 @@ transformGroupClause(ParseState * pstate, List * grouplist, List * targetlist)
* transform an Order By clause
*
*/
-static List *
+static List *
transformSortClause(ParseState * pstate,
List * orderlist, List * targetlist,
char *uniqueFlag)
{
- List *sortlist = NIL;
- List *s = NIL,
- *i;
+ List *sortlist = NIL;
+ List *s = NIL,
+ *i;
while (orderlist != NIL)
{
- SortGroupBy *sortby = lfirst(orderlist);
- SortClause *sortcl = makeNode(SortClause);
- TargetEntry *restarget;
- Resdom *resdom;
+ SortGroupBy *sortby = lfirst(orderlist);
+ SortClause *sortcl = makeNode(SortClause);
+ TargetEntry *restarget;
+ Resdom *resdom;
restarget = find_targetlist_entry(pstate, sortby, targetlist);
if (restarget == NULL)
@@ -1795,12 +1802,12 @@ transformSortClause(ParseState * pstate,
*/
foreach(i, targetlist)
{
- TargetEntry *tlelt = (TargetEntry *) lfirst(i);
+ TargetEntry *tlelt = (TargetEntry *) lfirst(i);
s = sortlist;
while (s != NIL)
{
- SortClause *sortcl = lfirst(s);
+ SortClause *sortcl = lfirst(s);
if (sortcl->resdom == tlelt->resdom)
break;
@@ -1809,7 +1816,7 @@ transformSortClause(ParseState * pstate,
if (s == NIL)
{
/* not a member of the sortclauses yet */
- SortClause *sortcl = makeNode(SortClause);
+ SortClause *sortcl = makeNode(SortClause);
sortcl->resdom = tlelt->resdom;
sortcl->opoid = any_ordering_op(tlelt->resdom->restype);
@@ -1820,8 +1827,8 @@ transformSortClause(ParseState * pstate,
}
else
{
- TargetEntry *tlelt = NULL;
- char *uniqueAttrName = uniqueFlag;
+ TargetEntry *tlelt = NULL;
+ char *uniqueAttrName = uniqueFlag;
/* only create sort clause with the specified unique attribute */
foreach(i, targetlist)
@@ -1837,7 +1844,7 @@ transformSortClause(ParseState * pstate,
s = sortlist;
foreach(s, sortlist)
{
- SortClause *sortcl = lfirst(s);
+ SortClause *sortcl = lfirst(s);
if (sortcl->resdom == tlelt->resdom)
break;
@@ -1845,7 +1852,7 @@ transformSortClause(ParseState * pstate,
if (s == NIL)
{
/* not a member of the sortclauses yet */
- SortClause *sortcl = makeNode(SortClause);
+ SortClause *sortcl = makeNode(SortClause);
sortcl->resdom = tlelt->resdom;
sortcl->opoid = any_ordering_op(tlelt->resdom->restype);
@@ -1864,15 +1871,15 @@ transformSortClause(ParseState * pstate,
** Given a nested dot expression (i.e. (relation func ... attr), build up
** a tree with of Iter and Func nodes.
*/
-static Node *
+static Node *
handleNestedDots(ParseState * pstate, Attr * attr, int *curr_resno)
{
- List *mutator_iter;
- Node *retval = NULL;
+ List *mutator_iter;
+ Node *retval = NULL;
if (attr->paramNo != NULL)
{
- Param *param = (Param *) transformExpr(pstate, (Node *) attr->paramNo, EXPR_RELATION_FIRST);
+ Param *param = (Param *) transformExpr(pstate, (Node *) attr->paramNo, EXPR_RELATION_FIRST);
retval =
ParseFunc(pstate, strVal(lfirst(attr->attrs)),
@@ -1881,7 +1888,7 @@ handleNestedDots(ParseState * pstate, Attr * attr, int *curr_resno)
}
else
{
- Ident *ident = makeNode(Ident);
+ Ident *ident = makeNode(Ident);
ident->name = attr->relname;
ident->isRel = TRUE;
@@ -1921,8 +1928,8 @@ make_arguments(int nargs,
* is all we check for.
*/
- List *current_fargs;
- int i;
+ List *current_fargs;
+ int i;
for (i = 0, current_fargs = fargs;
i < nargs;
@@ -1947,14 +1954,14 @@ make_arguments(int nargs,
** on a tuple parameter or return value. Due to a bug in 4.0,
** it's not possible to refer to system attributes in this case.
*/
-static List *
+static List *
setup_tlist(char *attname, Oid relid)
{
- TargetEntry *tle;
- Resdom *resnode;
- Var *varnode;
- Oid typeid;
- int attno;
+ TargetEntry *tle;
+ Resdom *resnode;
+ Var *varnode;
+ Oid typeid;
+ int attno;
attno = get_attnum(relid, attname);
if (attno < 0)
@@ -1981,12 +1988,12 @@ setup_tlist(char *attname, Oid relid)
** Build a tlist that extracts a base type from the tuple
** returned by the executor.
*/
-static List *
+static List *
setup_base_tlist(Oid typeid)
{
- TargetEntry *tle;
- Resdom *resnode;
- Var *varnode;
+ TargetEntry *tle;
+ Resdom *resnode;
+ Var *varnode;
resnode = makeResdom(1,
typeid,
@@ -2008,185 +2015,186 @@ setup_base_tlist(Oid typeid)
* handles function calls with a single argument that is of complex type.
* This routine returns NULL if it can't handle the projection (eg. sets).
*/
-static Node *
+static Node *
ParseComplexProjection(ParseState * pstate,
char *funcname,
Node * first_arg,
bool * attisset)
{
- Oid argtype;
- Oid argrelid;
- Name relname;
- Relation rd;
- Oid relid;
- int attnum;
+ Oid argtype;
+ Oid argrelid;
+ Name relname;
+ Relation rd;
+ Oid relid;
+ int attnum;
switch (nodeTag(first_arg))
{
- case T_Iter:
- {
- Func *func;
- Iter *iter;
-
- iter = (Iter *) first_arg;
- func = (Func *) ((Expr *) iter->iterexpr)->oper;
- argtype = funcid_get_rettype(func->funcid);
- argrelid = typeid_get_relid(argtype);
- if (argrelid &&
- ((attnum = get_attnum(argrelid, funcname))
- != InvalidAttrNumber))
+ case T_Iter:
{
+ Func *func;
+ Iter *iter;
+
+ iter = (Iter *) first_arg;
+ func = (Func *) ((Expr *) iter->iterexpr)->oper;
+ argtype = funcid_get_rettype(func->funcid);
+ argrelid = typeid_get_relid(argtype);
+ if (argrelid &&
+ ((attnum = get_attnum(argrelid, funcname))
+ != InvalidAttrNumber))
+ {
- /*
- * the argument is a function returning a tuple, so
- * funcname may be a projection
- */
+ /*
+ * the argument is a function returning a tuple, so
+ * funcname may be a projection
+ */
- /* add a tlist to the func node and return the Iter */
- rd = heap_openr(tname(get_id_type(argtype)));
- if (RelationIsValid(rd))
- {
- relid = RelationGetRelationId(rd);
- relname = RelationGetRelationName(rd);
- heap_close(rd);
- }
- if (RelationIsValid(rd))
- {
- func->func_tlist =
- setup_tlist(funcname, argrelid);
- iter->itertype = att_typeid(rd, attnum);
- return ((Node *) iter);
+ /* add a tlist to the func node and return the Iter */
+ rd = heap_openr(tname(get_id_type(argtype)));
+ if (RelationIsValid(rd))
+ {
+ relid = RelationGetRelationId(rd);
+ relname = RelationGetRelationName(rd);
+ heap_close(rd);
+ }
+ if (RelationIsValid(rd))
+ {
+ func->func_tlist =
+ setup_tlist(funcname, argrelid);
+ iter->itertype = att_typeid(rd, attnum);
+ return ((Node *) iter);
+ }
+ else
+ {
+ elog(WARN,
+ "Function %s has bad returntype %d",
+ funcname, argtype);
+ }
}
else
{
- elog(WARN,
- "Function %s has bad returntype %d",
- funcname, argtype);
+ /* drop through */
+ ;
}
+ break;
}
- else
+ case T_Var:
{
- /* drop through */
- ;
+
+ /*
+ * The argument is a set, so this is either a projection
+ * or a function call on this set.
+ */
+ *attisset = true;
+ break;
}
- break;
- }
- case T_Var:
- {
+ case T_Expr:
+ {
+ Expr *expr = (Expr *) first_arg;
+ Func *funcnode;
- /*
- * The argument is a set, so this is either a projection or a
- * function call on this set.
- */
- *attisset = true;
- break;
- }
- case T_Expr:
- {
- Expr *expr = (Expr *) first_arg;
- Func *funcnode;
+ if (expr->opType != FUNC_EXPR)
+ break;
- if (expr->opType != FUNC_EXPR)
- break;
+ funcnode = (Func *) expr->oper;
+ argtype = funcid_get_rettype(funcnode->funcid);
+ argrelid = typeid_get_relid(argtype);
- funcnode = (Func *) expr->oper;
- argtype = funcid_get_rettype(funcnode->funcid);
- argrelid = typeid_get_relid(argtype);
+ /*
+ * the argument is a function returning a tuple, so
+ * funcname may be a projection
+ */
+ if (argrelid &&
+ (attnum = get_attnum(argrelid, funcname))
+ != InvalidAttrNumber)
+ {
- /*
- * the argument is a function returning a tuple, so funcname
- * may be a projection
- */
- if (argrelid &&
- (attnum = get_attnum(argrelid, funcname))
- != InvalidAttrNumber)
+ /* add a tlist to the func node */
+ rd = heap_openr(tname(get_id_type(argtype)));
+ if (RelationIsValid(rd))
+ {
+ relid = RelationGetRelationId(rd);
+ relname = RelationGetRelationName(rd);
+ heap_close(rd);
+ }
+ if (RelationIsValid(rd))
+ {
+ Expr *newexpr;
+
+ funcnode->func_tlist =
+ setup_tlist(funcname, argrelid);
+ funcnode->functype = att_typeid(rd, attnum);
+
+ newexpr = makeNode(Expr);
+ newexpr->typeOid = funcnode->functype;
+ newexpr->opType = FUNC_EXPR;
+ newexpr->oper = (Node *) funcnode;
+ newexpr->args = lcons(first_arg, NIL);
+
+ return ((Node *) newexpr);
+ }
+
+ }
+
+ elog(WARN, "Function %s has bad returntype %d",
+ funcname, argtype);
+ break;
+ }
+ case T_Param:
{
+ Param *param = (Param *) first_arg;
- /* add a tlist to the func node */
- rd = heap_openr(tname(get_id_type(argtype)));
+ /*
+ * If the Param is a complex type, this could be a
+ * projection
+ */
+ rd = heap_openr(tname(get_id_type(param->paramtype)));
if (RelationIsValid(rd))
{
relid = RelationGetRelationId(rd);
relname = RelationGetRelationName(rd);
heap_close(rd);
}
- if (RelationIsValid(rd))
+ if (RelationIsValid(rd) &&
+ (attnum = get_attnum(relid, funcname))
+ != InvalidAttrNumber)
{
- Expr *newexpr;
-
- funcnode->func_tlist =
- setup_tlist(funcname, argrelid);
- funcnode->functype = att_typeid(rd, attnum);
-
- newexpr = makeNode(Expr);
- newexpr->typeOid = funcnode->functype;
- newexpr->opType = FUNC_EXPR;
- newexpr->oper = (Node *) funcnode;
- newexpr->args = lcons(first_arg, NIL);
- return ((Node *) newexpr);
+ param->paramtype = att_typeid(rd, attnum);
+ param->param_tlist = setup_tlist(funcname, relid);
+ return ((Node *) param);
}
-
- }
-
- elog(WARN, "Function %s has bad returntype %d",
- funcname, argtype);
- break;
- }
- case T_Param:
- {
- Param *param = (Param *) first_arg;
-
- /*
- * If the Param is a complex type, this could be a projection
- */
- rd = heap_openr(tname(get_id_type(param->paramtype)));
- if (RelationIsValid(rd))
- {
- relid = RelationGetRelationId(rd);
- relname = RelationGetRelationName(rd);
- heap_close(rd);
- }
- if (RelationIsValid(rd) &&
- (attnum = get_attnum(relid, funcname))
- != InvalidAttrNumber)
- {
-
- param->paramtype = att_typeid(rd, attnum);
- param->param_tlist = setup_tlist(funcname, relid);
- return ((Node *) param);
+ break;
}
+ default:
break;
- }
- default:
- break;
}
return NULL;
}
-static Node *
+static Node *
ParseFunc(ParseState * pstate, char *funcname, List * fargs, int *curr_resno)
{
- Oid rettype = (Oid) 0;
- Oid argrelid = (Oid) 0;
- Oid funcid = (Oid) 0;
- List *i = NIL;
- Node *first_arg = NULL;
- char *relname = NULL;
- char *refname = NULL;
- Relation rd;
- Oid relid;
- int nargs;
- Func *funcnode;
- Oid oid_array[8];
- Oid *true_oid_array;
- Node *retval;
- bool retset;
- bool exists;
- bool attisset = false;
- Oid toid = (Oid) 0;
- Expr *expr;
+ Oid rettype = (Oid) 0;
+ Oid argrelid = (Oid) 0;
+ Oid funcid = (Oid) 0;
+ List *i = NIL;
+ Node *first_arg = NULL;
+ char *relname = NULL;
+ char *refname = NULL;
+ Relation rd;
+ Oid relid;
+ int nargs;
+ Func *funcnode;
+ Oid oid_array[8];
+ Oid *true_oid_array;
+ Node *retval;
+ bool retset;
+ bool exists;
+ bool attisset = false;
+ Oid toid = (Oid) 0;
+ Expr *expr;
if (fargs)
{
@@ -2205,8 +2213,8 @@ ParseFunc(ParseState * pstate, char *funcname, List * fargs, int *curr_resno)
if (nodeTag(first_arg) == T_Ident && ((Ident *) first_arg)->isRel)
{
- RangeTblEntry *rte;
- Ident *ident = (Ident *) first_arg;
+ RangeTblEntry *rte;
+ Ident *ident = (Ident *) first_arg;
/*
* first arg is a relation. This could be a projection.
@@ -2226,7 +2234,7 @@ ParseFunc(ParseState * pstate, char *funcname, List * fargs, int *curr_resno)
*/
if (get_attnum(relid, funcname) != InvalidAttrNumber)
{
- Oid dummyTypeId;
+ Oid dummyTypeId;
return
((Node *) make_var(pstate,
@@ -2287,7 +2295,7 @@ ParseFunc(ParseState * pstate, char *funcname, List * fargs, int *curr_resno)
/*
* Parsing aggregates.
*/
- Oid basetype;
+ Oid basetype;
/*
* the aggregate count is a special case, ignore its base
@@ -2302,7 +2310,7 @@ ParseFunc(ParseState * pstate, char *funcname, List * fargs, int *curr_resno)
ObjectIdGetDatum(basetype),
0, 0))
{
- Aggreg *aggreg = ParseAgg(funcname, basetype, lfirst(fargs));
+ Aggreg *aggreg = ParseAgg(funcname, basetype, lfirst(fargs));
AddAggToParseState(pstate, aggreg);
return (Node *) aggreg;
@@ -2322,9 +2330,9 @@ ParseFunc(ParseState * pstate, char *funcname, List * fargs, int *curr_resno)
nargs = 0;
foreach(i, fargs)
{
- int vnum;
- RangeTblEntry *rte;
- Node *pair = lfirst(i);
+ int vnum;
+ RangeTblEntry *rte;
+ Node *pair = lfirst(i);
if (nodeTag(pair) == T_Ident && ((Ident *) pair)->isRel)
{
@@ -2457,9 +2465,9 @@ ParseFunc(ParseState * pstate, char *funcname, List * fargs, int *curr_resno)
if (funcid == SeqNextValueRegProcedure ||
funcid == SeqCurrValueRegProcedure)
{
- Const *seq;
- char *seqrel;
- int32 aclcheck_result = -1;
+ Const *seq;
+ char *seqrel;
+ int32 aclcheck_result = -1;
Assert(length(fargs) == 1);
seq = (Const *) lfirst(fargs);
@@ -2495,7 +2503,7 @@ ParseFunc(ParseState * pstate, char *funcname, List * fargs, int *curr_resno)
if (retset)
{
- Iter *iter = makeNode(Iter);
+ Iter *iter = makeNode(Iter);
iter->itertype = rettype;
iter->iterexpr = retval;
@@ -2518,8 +2526,8 @@ ParseFunc(ParseState * pstate, char *funcname, List * fargs, int *curr_resno)
static void
AddAggToParseState(ParseState * pstate, Aggreg * aggreg)
{
- List *ag;
- int i;
+ List *ag;
+ int i;
/*
* see if we have the aggregate already (we only need to record the
@@ -2528,7 +2536,7 @@ AddAggToParseState(ParseState * pstate, Aggreg * aggreg)
i = 0;
foreach(ag, pstate->p_aggs)
{
- Aggreg *a = lfirst(ag);
+ Aggreg *a = lfirst(ag);
if (!strcmp(a->aggname, aggreg->aggname) &&
equal(a->target, aggreg->target))
@@ -2556,8 +2564,8 @@ AddAggToParseState(ParseState * pstate, Aggreg * aggreg)
static void
finalizeAggregates(ParseState * pstate, Query * qry)
{
- List *l;
- int i;
+ List *l;
+ int i;
parseCheckAggregates(pstate, qry);
@@ -2575,7 +2583,7 @@ finalizeAggregates(ParseState * pstate, Query * qry)
*
* Returns true if any aggregate found.
*/
-static bool
+static bool
contain_agg_clause(Node * clause)
{
if (clause == NULL)
@@ -2588,7 +2596,7 @@ contain_agg_clause(Node * clause)
return FALSE;
else if (or_clause(clause))
{
- List *temp;
+ List *temp;
foreach(temp, ((Expr *) clause)->args)
if (contain_agg_clause(lfirst(temp)))
@@ -2597,7 +2605,7 @@ contain_agg_clause(Node * clause)
}
else if (is_funcclause(clause))
{
- List *temp;
+ List *temp;
foreach(temp, ((Expr *) clause)->args)
if (contain_agg_clause(lfirst(temp)))
@@ -2606,7 +2614,7 @@ contain_agg_clause(Node * clause)
}
else if (IsA(clause, ArrayRef))
{
- List *temp;
+ List *temp;
foreach(temp, ((ArrayRef *) clause)->refupperindexpr)
if (contain_agg_clause(lfirst(temp)))
@@ -2633,10 +2641,10 @@ contain_agg_clause(Node * clause)
* exprIsAggOrGroupCol -
* returns true if the expression does not contain non-group columns.
*/
-static bool
+static bool
exprIsAggOrGroupCol(Node * expr, List * groupClause)
{
- List *gl;
+ List *gl;
if (expr == NULL || IsA(expr, Const) ||
IsA(expr, Param) || IsA(expr, Aggreg))
@@ -2644,7 +2652,7 @@ exprIsAggOrGroupCol(Node * expr, List * groupClause)
foreach(gl, groupClause)
{
- GroupClause *grpcl = lfirst(gl);
+ GroupClause *grpcl = lfirst(gl);
if (equal(expr, grpcl->entry->expr))
return TRUE;
@@ -2652,7 +2660,7 @@ exprIsAggOrGroupCol(Node * expr, List * groupClause)
if (IsA(expr, Expr))
{
- List *temp;
+ List *temp;
foreach(temp, ((Expr *) expr)->args)
if (!exprIsAggOrGroupCol(lfirst(temp), groupClause))
@@ -2667,18 +2675,18 @@ exprIsAggOrGroupCol(Node * expr, List * groupClause)
* tleIsAggOrGroupCol -
* returns true if the TargetEntry is Agg or GroupCol.
*/
-static bool
+static bool
tleIsAggOrGroupCol(TargetEntry * tle, List * groupClause)
{
- Node *expr = tle->expr;
- List *gl;
+ Node *expr = tle->expr;
+ List *gl;
if (expr == NULL || IsA(expr, Const) || IsA(expr, Param))
return TRUE;
foreach(gl, groupClause)
{
- GroupClause *grpcl = lfirst(gl);
+ GroupClause *grpcl = lfirst(gl);
if (tle->resdom->resno == grpcl->entry->resdom->resno)
{
@@ -2693,7 +2701,7 @@ tleIsAggOrGroupCol(TargetEntry * tle, List * groupClause)
if (IsA(expr, Expr))
{
- List *temp;
+ List *temp;
foreach(temp, ((Expr *) expr)->args)
if (!exprIsAggOrGroupCol(lfirst(temp), groupClause))
@@ -2713,7 +2721,7 @@ tleIsAggOrGroupCol(TargetEntry * tle, List * groupClause)
static void
parseCheckAggregates(ParseState * pstate, Query * qry)
{
- List *tl;
+ List *tl;
Assert(pstate->p_numAgg > 0);
@@ -2731,7 +2739,7 @@ parseCheckAggregates(ParseState * pstate, Query * qry)
*/
foreach(tl, qry->targetList)
{
- TargetEntry *tle = lfirst(tl);
+ TargetEntry *tle = lfirst(tl);
if (!tleIsAggOrGroupCol(tle, qry->groupClause))
elog(WARN,
diff --git a/src/backend/parser/catalog_utils.c b/src/backend/parser/catalog_utils.c
index 41e6fffac9..967bf08101 100644
--- a/src/backend/parser/catalog_utils.c
+++ b/src/backend/parser/catalog_utils.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.23 1997/09/07 04:44:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.24 1997/09/08 02:25:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,9 +52,9 @@
struct
{
- char *field;
- int code;
-} special_attr[] =
+ char *field;
+ int code;
+} special_attr[] =
{
{
@@ -94,7 +94,7 @@ struct
#define SPECIALS (sizeof(special_attr)/sizeof(*special_attr))
-static char *attnum_type[SPECIALS] = {
+static char *attnum_type[SPECIALS] = {
"tid",
"oid",
"xid",
@@ -118,10 +118,10 @@ static char *attnum_type[SPECIALS] = {
typedef struct _InhPaths
{
- int nsupers; /* number of superclasses */
- Oid self; /* this class */
- Oid *supervec; /* vector of superclasses */
-} InhPaths;
+ int nsupers; /* number of superclasses */
+ Oid self; /* this class */
+ Oid *supervec; /* vector of superclasses */
+} InhPaths;
/*
* This structure holds a list of possible functions or operators that
@@ -129,16 +129,16 @@ typedef struct _InhPaths
*/
typedef struct _CandidateList
{
- Oid *args;
+ Oid *args;
struct _CandidateList *next;
-} *CandidateList;
+} *CandidateList;
-static Oid **argtype_inherit(int nargs, Oid * oid_array);
-static Oid **genxprod(InhPaths * arginh, int nargs);
-static int findsupers(Oid relid, Oid ** supervec);
-static bool check_typeid(Oid id);
-static char *instr1(TypeTupleForm tp, char *string, int typlen);
-static void op_error(char *op, Oid arg1, Oid arg2);
+static Oid **argtype_inherit(int nargs, Oid * oid_array);
+static Oid **genxprod(InhPaths * arginh, int nargs);
+static int findsupers(Oid relid, Oid ** supervec);
+static bool check_typeid(Oid id);
+static char *instr1(TypeTupleForm tp, char *string, int typlen);
+static void op_error(char *op, Oid arg1, Oid arg2);
/* check to see if a type id is valid,
* returns true if it is. By using this call before calling
@@ -146,7 +146,7 @@ static void op_error(char *op, Oid arg1, Oid arg2);
* can be produced because the caller typically has more context of
* what's going on - jolly
*/
-static bool
+static bool
check_typeid(Oid id)
{
return (SearchSysCacheTuple(TYPOID,
@@ -159,7 +159,7 @@ check_typeid(Oid id)
Type
get_id_type(Oid id)
{
- HeapTuple tup;
+ HeapTuple tup;
if (!(tup = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(id),
0, 0, 0)))
@@ -171,11 +171,11 @@ get_id_type(Oid id)
}
/* return a type name, given a typeid */
-char *
+char *
get_id_typname(Oid id)
{
- HeapTuple tup;
- TypeTupleForm typetuple;
+ HeapTuple tup;
+ TypeTupleForm typetuple;
if (!(tup = SearchSysCacheTuple(TYPOID, ObjectIdGetDatum(id),
0, 0, 0)))
@@ -191,7 +191,7 @@ get_id_typname(Oid id)
Type
type(char *s)
{
- HeapTuple tup;
+ HeapTuple tup;
if (s == NULL)
{
@@ -245,7 +245,7 @@ typeid(Type tp)
int16
tlen(Type t)
{
- TypeTupleForm typ;
+ TypeTupleForm typ;
typ = (TypeTupleForm) GETSTRUCT(t);
return (typ->typlen);
@@ -255,17 +255,17 @@ tlen(Type t)
bool
tbyval(Type t)
{
- TypeTupleForm typ;
+ TypeTupleForm typ;
typ = (TypeTupleForm) GETSTRUCT(t);
return (typ->typbyval);
}
/* given type (as type struct), return the name of type */
-char *
+char *
tname(Type t)
{
- TypeTupleForm typ;
+ TypeTupleForm typ;
typ = (TypeTupleForm) GETSTRUCT(t);
return (typ->typname).data;
@@ -275,7 +275,7 @@ tname(Type t)
int
tbyvalue(Type t)
{
- TypeTupleForm typ;
+ TypeTupleForm typ;
typ = (TypeTupleForm) GETSTRUCT(t);
return (typ->typbyval);
@@ -285,7 +285,7 @@ tbyvalue(Type t)
static char
typetypetype(Type t)
{
- TypeTupleForm typ;
+ TypeTupleForm typ;
typ = (TypeTupleForm) GETSTRUCT(t);
return (typ->typtype);
@@ -310,15 +310,15 @@ binary_oper_get_candidates(char *opname,
Oid rightTypeId,
CandidateList * candidates)
{
- CandidateList current_candidate;
- Relation pg_operator_desc;
- HeapScanDesc pg_operator_scan;
- HeapTuple tup;
+ CandidateList current_candidate;
+ Relation pg_operator_desc;
+ HeapScanDesc pg_operator_scan;
+ HeapTuple tup;
OperatorTupleForm oper;
- Buffer buffer;
- int nkeys;
- int ncandidates = 0;
- ScanKeyData opKey[3];
+ Buffer buffer;
+ int nkeys;
+ int ncandidates = 0;
+ ScanKeyData opKey[3];
*candidates = NULL;
@@ -404,43 +404,43 @@ binary_oper_get_candidates(char *opname,
* the all the candidates operate on the same data types after
* promotion (int2, int4, float4 -> float8).
*/
-static bool
+static bool
equivalentOpersAfterPromotion(CandidateList candidates)
{
- CandidateList result;
- CandidateList promotedCandidates = NULL;
- Oid leftarg,
- rightarg;
+ CandidateList result;
+ CandidateList promotedCandidates = NULL;
+ Oid leftarg,
+ rightarg;
for (result = candidates; result != NULL; result = result->next)
{
- CandidateList c;
+ CandidateList c;
c = (CandidateList) palloc(sizeof(*c));
c->args = (Oid *) palloc(2 * sizeof(Oid));
switch (result->args[0])
{
- case FLOAT4OID:
- case INT4OID:
- case INT2OID:
- case CASHOID:
- c->args[0] = FLOAT8OID;
- break;
- default:
- c->args[0] = result->args[0];
- break;
+ case FLOAT4OID:
+ case INT4OID:
+ case INT2OID:
+ case CASHOID:
+ c->args[0] = FLOAT8OID;
+ break;
+ default:
+ c->args[0] = result->args[0];
+ break;
}
switch (result->args[1])
{
- case FLOAT4OID:
- case INT4OID:
- case INT2OID:
- case CASHOID:
- c->args[1] = FLOAT8OID;
- break;
- default:
- c->args[1] = result->args[1];
- break;
+ case FLOAT4OID:
+ case INT4OID:
+ case INT2OID:
+ case CASHOID:
+ c->args[1] = FLOAT8OID;
+ break;
+ default:
+ c->args[1] = result->args[1];
+ break;
}
c->next = promotedCandidates;
promotedCandidates = c;
@@ -478,12 +478,12 @@ equivalentOpersAfterPromotion(CandidateList candidates)
* given a choice of argument type pairs for a binary operator,
* try to choose a default pair
*/
-static CandidateList
+static CandidateList
binary_oper_select_candidate(Oid arg1,
Oid arg2,
CandidateList candidates)
{
- CandidateList result;
+ CandidateList result;
/*
* if both are "unknown", there is no way to select a candidate
@@ -538,9 +538,9 @@ binary_oper_select_candidate(Oid arg1,
Operator
oper(char *op, Oid arg1, Oid arg2, bool noWarnings)
{
- HeapTuple tup;
- CandidateList candidates;
- int ncandidates;
+ HeapTuple tup;
+ CandidateList candidates;
+ int ncandidates;
if (!arg2)
arg2 = arg1;
@@ -596,8 +596,8 @@ oper(char *op, Oid arg1, Oid arg2, bool noWarnings)
}
else
{
- Type tp1,
- tp2;
+ Type tp1,
+ tp2;
/* we chose none of them */
tp1 = get_id_type(arg1);
@@ -627,13 +627,13 @@ unary_oper_get_candidates(char *op,
CandidateList * candidates,
char rightleft)
{
- CandidateList current_candidate;
- Relation pg_operator_desc;
- HeapScanDesc pg_operator_scan;
- HeapTuple tup;
+ CandidateList current_candidate;
+ Relation pg_operator_desc;
+ HeapScanDesc pg_operator_scan;
+ HeapTuple tup;
OperatorTupleForm oper;
- Buffer buffer;
- int ncandidates = 0;
+ Buffer buffer;
+ int ncandidates = 0;
static ScanKeyData opKey[2] = {
{0, Anum_pg_operator_oprname, NameEqualRegProcedure},
@@ -697,9 +697,9 @@ unary_oper_get_candidates(char *op,
Operator
right_oper(char *op, Oid arg)
{
- HeapTuple tup;
- CandidateList candidates;
- int ncandidates;
+ HeapTuple tup;
+ CandidateList candidates;
+ int ncandidates;
/*
* if (!OpCache) { init_op_cache(); }
@@ -742,9 +742,9 @@ right_oper(char *op, Oid arg)
Operator
left_oper(char *op, Oid arg)
{
- HeapTuple tup;
- CandidateList candidates;
- int ncandidates;
+ HeapTuple tup;
+ CandidateList candidates;
+ int ncandidates;
/*
* if (!OpCache) { init_op_cache(); }
@@ -787,7 +787,7 @@ left_oper(char *op, Oid arg)
int
varattno(Relation rd, char *a)
{
- int i;
+ int i;
for (i = 0; i < rd->rd_rel->relnatts; i++)
{
@@ -817,7 +817,7 @@ varattno(Relation rd, char *a)
bool
varisset(Relation rd, char *name)
{
- int i;
+ int i;
/* First check if this is a system attribute */
for (i = 0; i < SPECIALS; i++)
@@ -834,7 +834,7 @@ varisset(Relation rd, char *name)
int
nf_varattno(Relation rd, char *a)
{
- int i;
+ int i;
for (i = 0; i < rd->rd_rel->relnatts; i++)
{
@@ -856,11 +856,11 @@ nf_varattno(Relation rd, char *a)
/*-------------
* given an attribute number and a relation, return its relation name
*/
-char *
+char *
getAttrName(Relation rd, int attrno)
{
- char *name;
- int i;
+ char *name;
+ int i;
if (attrno < 0)
{
@@ -896,12 +896,12 @@ getAttrName(Relation rd, int attrno)
/* Given a typename and value, returns the ascii form of the value */
#ifdef NOT_USED
-char *
+char *
outstr(char *typename, /* Name of type of value */
char *value) /* Could be of any type */
{
- TypeTupleForm tp;
- Oid op;
+ TypeTupleForm tp;
+ Oid op;
tp = (TypeTupleForm) GETSTRUCT(type(typename));
op = tp->typoutput;
@@ -911,7 +911,7 @@ outstr(char *typename, /* Name of type of value */
#endif
/* Given a Type and a string, return the internal form of that string */
-char *
+char *
instr2(Type tp, char *string, int typlen)
{
return (instr1((TypeTupleForm) GETSTRUCT(tp), string, typlen));
@@ -919,11 +919,11 @@ instr2(Type tp, char *string, int typlen)
/* Given a type structure and a string, returns the internal form of
that string */
-static char *
+static char *
instr1(TypeTupleForm tp, char *string, int typlen)
{
- Oid op;
- Oid typelem;
+ Oid op;
+ Oid typelem;
op = tp->typinput;
typelem = tp->typelem; /* XXX - used for array_in */
@@ -937,8 +937,8 @@ instr1(TypeTupleForm tp, char *string, int typlen)
Oid
GetArrayElementType(Oid typearray)
{
- HeapTuple type_tuple;
- TypeTupleForm type_struct_array;
+ HeapTuple type_tuple;
+ TypeTupleForm type_struct_array;
type_tuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(typearray),
@@ -963,8 +963,8 @@ GetArrayElementType(Oid typearray)
Oid
funcid_get_rettype(Oid funcid)
{
- HeapTuple func_tuple = NULL;
- Oid funcrettype = (Oid) 0;
+ HeapTuple func_tuple = NULL;
+ Oid funcrettype = (Oid) 0;
func_tuple = SearchSysCacheTuple(PROOID, ObjectIdGetDatum(funcid),
0, 0, 0);
@@ -982,21 +982,21 @@ funcid_get_rettype(Oid funcid)
* get a list of all argument type vectors for which a function named
* funcname taking nargs arguments exists
*/
-static CandidateList
+static CandidateList
func_get_candidates(char *funcname, int nargs)
{
- Relation heapRelation;
- Relation idesc;
- ScanKeyData skey;
- HeapTuple tuple;
- IndexScanDesc sd;
+ Relation heapRelation;
+ Relation idesc;
+ ScanKeyData skey;
+ HeapTuple tuple;
+ IndexScanDesc sd;
RetrieveIndexResult indexRes;
- Buffer buffer;
- Form_pg_proc pgProcP;
- bool bufferUsed = FALSE;
- CandidateList candidates = NULL;
- CandidateList current_candidate;
- int i;
+ Buffer buffer;
+ Form_pg_proc pgProcP;
+ bool bufferUsed = FALSE;
+ CandidateList candidates = NULL;
+ CandidateList current_candidate;
+ int i;
heapRelation = heap_openr(ProcedureRelationName);
ScanKeyEntryInitialize(&skey,
@@ -1021,7 +1021,7 @@ func_get_candidates(char *funcname, int nargs)
indexRes = index_getnext(sd, ForwardScanDirection);
if (indexRes)
{
- ItemPointer iptr;
+ ItemPointer iptr;
iptr = &indexRes->heap_iptr;
tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
@@ -1060,11 +1060,11 @@ func_get_candidates(char *funcname, int nargs)
/*
* can input_typeids be coerced to func_typeids?
*/
-static bool
+static bool
can_coerce(int nargs, Oid * input_typeids, Oid * func_typeids)
{
- int i;
- Type tp;
+ int i;
+ Type tp;
/*
* right now, we only coerce "unknown", and we cannot coerce it to a
@@ -1105,10 +1105,10 @@ match_argtypes(int nargs,
CandidateList function_typeids,
CandidateList * candidates) /* return value */
{
- CandidateList current_candidate;
- CandidateList matching_candidate;
- Oid *current_typeids;
- int ncandidates = 0;
+ CandidateList current_candidate;
+ CandidateList matching_candidate;
+ Oid *current_typeids;
+ int ncandidates = 0;
*candidates = NULL;
@@ -1137,7 +1137,7 @@ match_argtypes(int nargs,
* returns the selected argtype array if the conflict can be resolved,
* otherwise returns NULL
*/
-static Oid *
+static Oid *
func_select_candidate(int nargs,
Oid * input_typeids,
CandidateList candidates)
@@ -1155,12 +1155,12 @@ func_get_detail(char *funcname,
bool * retset, /* return value */
Oid ** true_typeids) /* return value */
{
- Oid **input_typeid_vector;
- Oid *current_input_typeids;
- CandidateList function_typeids;
- CandidateList current_function_typeids;
- HeapTuple ftup;
- Form_pg_proc pform;
+ Oid **input_typeid_vector;
+ Oid *current_input_typeids;
+ CandidateList function_typeids;
+ CandidateList current_function_typeids;
+ HeapTuple ftup;
+ Form_pg_proc pform;
/*
* attempt to find named function in the system catalogs with
@@ -1191,7 +1191,7 @@ func_get_detail(char *funcname,
if (function_typeids != NULL)
{
- int ncandidates = 0;
+ int ncandidates = 0;
input_typeid_vector = argtype_inherit(nargs, oid_array);
current_input_typeids = oid_array;
@@ -1244,7 +1244,7 @@ func_get_detail(char *funcname,
if (!HeapTupleIsValid(ftup))
{
- Type tp;
+ Type tp;
if (nargs == 1)
{
@@ -1291,12 +1291,12 @@ func_get_detail(char *funcname,
* not defined. There are lots of these (mostly builtins) in the
* catalogs.
*/
-static Oid **
+static Oid **
argtype_inherit(int nargs, Oid * oid_array)
{
- Oid relid;
- int i;
- InhPaths arginh[MAXFARGS];
+ Oid relid;
+ int i;
+ InhPaths arginh[MAXFARGS];
for (i = 0; i < MAXFARGS; i++)
{
@@ -1327,31 +1327,31 @@ argtype_inherit(int nargs, Oid * oid_array)
typedef struct _SuperQE
{
- Oid sqe_relid;
-} SuperQE;
+ Oid sqe_relid;
+} SuperQE;
static int
findsupers(Oid relid, Oid ** supervec)
{
- Oid *relidvec;
- Relation inhrel;
- HeapScanDesc inhscan;
- ScanKeyData skey;
- HeapTuple inhtup;
- TupleDesc inhtupdesc;
- int nvisited;
- SuperQE *qentry,
- *vnode;
- Dllist *visited,
- *queue;
- Dlelem *qe,
- *elt;
-
- Relation rd;
- Buffer buf;
- Datum d;
- bool newrelid;
- char isNull;
+ Oid *relidvec;
+ Relation inhrel;
+ HeapScanDesc inhscan;
+ ScanKeyData skey;
+ HeapTuple inhtup;
+ TupleDesc inhtupdesc;
+ int nvisited;
+ SuperQE *qentry,
+ *vnode;
+ Dllist *visited,
+ *queue;
+ Dlelem *qe,
+ *elt;
+
+ Relation rd;
+ Buffer buf;
+ Datum d;
+ bool newrelid;
+ char isNull;
nvisited = 0;
queue = DLNewList();
@@ -1451,16 +1451,16 @@ findsupers(Oid relid, Oid ** supervec)
return (nvisited);
}
-static Oid **
+static Oid **
genxprod(InhPaths * arginh, int nargs)
{
- int nanswers;
- Oid **result,
- **iter;
- Oid *oneres;
- int i,
- j;
- int cur[MAXFARGS];
+ int nanswers;
+ Oid **result,
+ **iter;
+ Oid *oneres;
+ int i,
+ j;
+ int cur[MAXFARGS];
nanswers = 1;
for (i = 0; i < nargs; i++)
@@ -1510,9 +1510,9 @@ genxprod(InhPaths * arginh, int nargs)
Oid
typeid_get_retinfunc(Oid type_id)
{
- HeapTuple typeTuple;
- TypeTupleForm type;
- Oid infunc;
+ HeapTuple typeTuple;
+ TypeTupleForm type;
+ Oid infunc;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type_id),
@@ -1531,9 +1531,9 @@ typeid_get_retinfunc(Oid type_id)
Oid
typeid_get_retoutfunc(Oid type_id)
{
- HeapTuple typeTuple;
- TypeTupleForm type;
- Oid outfunc;
+ HeapTuple typeTuple;
+ TypeTupleForm type;
+ Oid outfunc;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type_id),
@@ -1551,9 +1551,9 @@ typeid_get_retoutfunc(Oid type_id)
Oid
typeid_get_relid(Oid type_id)
{
- HeapTuple typeTuple;
- TypeTupleForm type;
- Oid infunc;
+ HeapTuple typeTuple;
+ TypeTupleForm type;
+ Oid infunc;
typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type_id),
@@ -1569,7 +1569,7 @@ typeid_get_relid(Oid type_id)
Oid
get_typrelid(Type typ)
{
- TypeTupleForm typtup;
+ TypeTupleForm typtup;
typtup = (TypeTupleForm) GETSTRUCT(typ);
@@ -1579,8 +1579,8 @@ get_typrelid(Type typ)
Oid
get_typelem(Oid type_id)
{
- HeapTuple typeTuple;
- TypeTupleForm type;
+ HeapTuple typeTuple;
+ TypeTupleForm type;
if (!(typeTuple = SearchSysCacheTuple(TYPOID,
ObjectIdGetDatum(type_id),
@@ -1597,9 +1597,9 @@ get_typelem(Oid type_id)
char
FindDelimiter(char *typename)
{
- char delim;
- HeapTuple typeTuple;
- TypeTupleForm type;
+ char delim;
+ HeapTuple typeTuple;
+ TypeTupleForm type;
if (!(typeTuple = SearchSysCacheTuple(TYPNAME,
@@ -1623,8 +1623,8 @@ FindDelimiter(char *typename)
static void
op_error(char *op, Oid arg1, Oid arg2)
{
- Type tp1 = NULL,
- tp2 = NULL;
+ Type tp1 = NULL,
+ tp2 = NULL;
if (check_typeid(arg1))
{
@@ -1659,9 +1659,9 @@ op_error(char *op, Oid arg1, Oid arg2)
void
func_error(char *caller, char *funcname, int nargs, Oid * argtypes)
{
- char p[(NAMEDATALEN + 2) * MAXFMGRARGS],
- *ptr;
- int i;
+ char p[(NAMEDATALEN + 2) * MAXFMGRARGS],
+ *ptr;
+ int i;
ptr = p;
*ptr = '\0';
diff --git a/src/backend/parser/dbcommands.c b/src/backend/parser/dbcommands.c
index 158e033b6e..e0add78124 100644
--- a/src/backend/parser/dbcommands.c
+++ b/src/backend/parser/dbcommands.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.7 1997/09/07 04:44:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.8 1997/09/08 02:25:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -39,14 +39,14 @@ static void
check_permissions(char *command, char *dbname,
Oid * dbIdP, Oid * userIdP);
static HeapTuple get_pg_dbtup(char *command, char *dbname, Relation dbrel);
-static void stop_vacuum(char *dbname);
+static void stop_vacuum(char *dbname);
void
createdb(char *dbname)
{
- Oid db_id,
- user_id;
- char buf[512];
+ Oid db_id,
+ user_id;
+ char buf[512];
/*
* If this call returns, the database does not exist and we're allowed
@@ -78,9 +78,9 @@ createdb(char *dbname)
void
destroydb(char *dbname)
{
- Oid user_id,
- db_id;
- char buf[512];
+ Oid user_id,
+ db_id;
+ char buf[512];
/*
* If this call returns, the database exists and we're allowed to
@@ -115,14 +115,14 @@ destroydb(char *dbname)
DropBuffers(db_id);
}
-static HeapTuple
+static HeapTuple
get_pg_dbtup(char *command, char *dbname, Relation dbrel)
{
- HeapTuple dbtup;
- HeapTuple tup;
- Buffer buf;
- HeapScanDesc scan;
- ScanKeyData scanKey;
+ HeapTuple dbtup;
+ HeapTuple tup;
+ Buffer buf;
+ HeapScanDesc scan;
+ ScanKeyData scanKey;
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
NameEqualRegProcedure, NameGetDatum(dbname));
@@ -164,14 +164,14 @@ check_permissions(char *command,
Oid * dbIdP,
Oid * userIdP)
{
- Relation dbrel;
- HeapTuple dbtup,
- utup;
- Oid dbowner = (Oid) 0;
- char use_createdb;
- bool dbfound;
- bool use_super;
- char *userName;
+ Relation dbrel;
+ HeapTuple dbtup,
+ utup;
+ Oid dbowner = (Oid) 0;
+ char use_createdb;
+ bool dbfound;
+ bool use_super;
+ char *userName;
userName = GetPgUserName();
utup = SearchSysCacheTuple(USENAME, PointerGetDatum(userName),
@@ -268,9 +268,9 @@ check_permissions(char *command,
static void
stop_vacuum(char *dbname)
{
- char filename[256];
- FILE *fp;
- int pid;
+ char filename[256];
+ FILE *fp;
+ int pid;
sprintf(filename, "%s%cbase%c%s%c%s.vacuum", DataDir, SEP_CHAR, SEP_CHAR,
dbname, SEP_CHAR, dbname);
diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c
index b9f1a27339..8bebcfb0af 100644
--- a/src/backend/parser/keywords.c
+++ b/src/backend/parser/keywords.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.15 1997/09/07 04:44:47 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.16 1997/09/08 02:25:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -180,13 +180,13 @@ static ScanKeyword ScanKeywords[] = {
{"zone", ZONE},
};
-ScanKeyword *
+ScanKeyword *
ScanKeywordLookup(char *text)
{
- ScanKeyword *low = &ScanKeywords[0];
- ScanKeyword *high = endof(ScanKeywords) - 1;
- ScanKeyword *middle;
- int difference;
+ ScanKeyword *low = &ScanKeywords[0];
+ ScanKeyword *high = endof(ScanKeywords) - 1;
+ ScanKeyword *middle;
+ int difference;
while (low <= high)
{
@@ -204,13 +204,13 @@ ScanKeywordLookup(char *text)
}
#ifdef NOT_USED
-char *
+char *
AtomValueGetString(int atomval)
{
- ScanKeyword *low = &ScanKeywords[0];
- ScanKeyword *high = endof(ScanKeywords) - 1;
- int keyword_list_length = (high - low);
- int i;
+ ScanKeyword *low = &ScanKeywords[0];
+ ScanKeyword *high = endof(ScanKeywords) - 1;
+ int keyword_list_length = (high - low);
+ int i;
for (i = 0; i < keyword_list_length; i++)
if (ScanKeywords[i].value == atomval)
diff --git a/src/backend/parser/parse_query.c b/src/backend/parser/parse_query.c
index 5d144660a4..f9670431f3 100644
--- a/src/backend/parser/parse_query.c
+++ b/src/backend/parser/parse_query.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.19 1997/09/07 04:44:48 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.20 1997/09/08 02:25:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,18 +42,18 @@ static void
checkTargetTypes(ParseState * pstate, char *target_colname,
char *refname, char *colname);
-Oid *param_type_info;
-int pfunc_num_args;
+Oid *param_type_info;
+int pfunc_num_args;
/* given refname, return a pointer to the range table entry */
-RangeTblEntry *
+RangeTblEntry *
refnameRangeTableEntry(List * rtable, char *refname)
{
- List *temp;
+ List *temp;
foreach(temp, rtable)
{
- RangeTblEntry *rte = lfirst(temp);
+ RangeTblEntry *rte = lfirst(temp);
if (!strcmp(rte->refname, refname))
return rte;
@@ -65,13 +65,13 @@ refnameRangeTableEntry(List * rtable, char *refname)
int
refnameRangeTablePosn(List * rtable, char *refname)
{
- int index;
- List *temp;
+ int index;
+ List *temp;
index = 1;
foreach(temp, rtable)
{
- RangeTblEntry *rte = lfirst(temp);
+ RangeTblEntry *rte = lfirst(temp);
if (!strcmp(rte->refname, refname))
return index;
@@ -83,12 +83,12 @@ refnameRangeTablePosn(List * rtable, char *refname)
/*
* returns range entry if found, else NULL
*/
-RangeTblEntry *
+RangeTblEntry *
colnameRangeTableEntry(ParseState * pstate, char *colname)
{
- List *et;
- List *rtable;
- RangeTblEntry *rte_result;
+ List *et;
+ List *rtable;
+ RangeTblEntry *rte_result;
if (pstate->p_is_rule)
rtable = lnext(lnext(pstate->p_rtable));
@@ -98,7 +98,7 @@ colnameRangeTableEntry(ParseState * pstate, char *colname)
rte_result = NULL;
foreach(et, rtable)
{
- RangeTblEntry *rte = lfirst(et);
+ RangeTblEntry *rte = lfirst(et);
/* only entries on outer(non-function?) scope */
if (!rte->inFromCl && rte != pstate->p_target_rangetblentry)
@@ -123,15 +123,15 @@ colnameRangeTableEntry(ParseState * pstate, char *colname)
* put new entry in pstate p_rtable structure, or return pointer
* if pstate null
*/
-RangeTblEntry *
+RangeTblEntry *
addRangeTableEntry(ParseState * pstate,
char *relname,
char *refname,
bool inh, bool inFromCl,
TimeRange * timeRange)
{
- Relation relation;
- RangeTblEntry *rte = makeNode(RangeTblEntry);
+ Relation relation;
+ RangeTblEntry *rte = makeNode(RangeTblEntry);
if (pstate != NULL &&
refnameRangeTableEntry(pstate->p_rtable, refname) != NULL)
@@ -179,18 +179,18 @@ addRangeTableEntry(ParseState * pstate,
* makes a list of attributes
* assumes reldesc caching works
*/
-List *
+List *
expandAll(ParseState * pstate, char *relname, char *refname, int *this_resno)
{
- Relation rdesc;
- List *te_tail = NIL,
- *te_head = NIL;
- Var *varnode;
- int varattno,
- maxattrs;
- Oid type_id;
- int type_len;
- RangeTblEntry *rte;
+ Relation rdesc;
+ List *te_tail = NIL,
+ *te_head = NIL;
+ Var *varnode;
+ int varattno,
+ maxattrs;
+ Oid type_id;
+ int type_len;
+ RangeTblEntry *rte;
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
if (rte == NULL)
@@ -208,9 +208,9 @@ expandAll(ParseState * pstate, char *relname, char *refname, int *this_resno)
for (varattno = 0; varattno <= maxattrs - 1; varattno++)
{
- char *attrname;
- char *resname = NULL;
- TargetEntry *te = makeNode(TargetEntry);
+ char *attrname;
+ char *resname = NULL;
+ TargetEntry *te = makeNode(TargetEntry);
attrname = pstrdup((rdesc->rd_att->attrs[varattno]->attname).data);
varnode = (Var *) make_var(pstate, refname, attrname, &type_id);
@@ -248,58 +248,58 @@ makeTimeRange(char *datestring1,
char *datestring2,
int timecode) /* 0 = snapshot , 1 = timerange */
{
- TimeQual qual = NULL;
- AbsoluteTime t1,
- t2;
+ TimeQual qual = NULL;
+ AbsoluteTime t1,
+ t2;
switch (timecode)
{
- case 0:
- if (datestring1 == NULL)
- {
- elog(WARN, "MakeTimeRange: bad snapshot arg");
- }
- t1 = nabstimein(datestring1);
- if (!AbsoluteTimeIsValid(t1))
- {
- elog(WARN, "bad snapshot time: \"%s\"",
- datestring1);
- }
- qual = TimeFormSnapshotTimeQual(t1);
- break;
- case 1:
- if (datestring1 == NULL)
- {
- t1 = NOSTART_ABSTIME;
- }
- else
- {
+ case 0:
+ if (datestring1 == NULL)
+ {
+ elog(WARN, "MakeTimeRange: bad snapshot arg");
+ }
t1 = nabstimein(datestring1);
if (!AbsoluteTimeIsValid(t1))
{
- elog(WARN,
- "bad range start time: \"%s\"",
+ elog(WARN, "bad snapshot time: \"%s\"",
datestring1);
}
- }
- if (datestring2 == NULL)
- {
- t2 = NOEND_ABSTIME;
- }
- else
- {
- t2 = nabstimein(datestring2);
- if (!AbsoluteTimeIsValid(t2))
+ qual = TimeFormSnapshotTimeQual(t1);
+ break;
+ case 1:
+ if (datestring1 == NULL)
{
- elog(WARN,
- "bad range end time: \"%s\"",
- datestring2);
+ t1 = NOSTART_ABSTIME;
}
- }
- qual = TimeFormRangedTimeQual(t1, t2);
- break;
- default:
- elog(WARN, "MakeTimeRange: internal parser error");
+ else
+ {
+ t1 = nabstimein(datestring1);
+ if (!AbsoluteTimeIsValid(t1))
+ {
+ elog(WARN,
+ "bad range start time: \"%s\"",
+ datestring1);
+ }
+ }
+ if (datestring2 == NULL)
+ {
+ t2 = NOEND_ABSTIME;
+ }
+ else
+ {
+ t2 = nabstimein(datestring2);
+ if (!AbsoluteTimeIsValid(t2))
+ {
+ elog(WARN,
+ "bad range end time: \"%s\"",
+ datestring2);
+ }
+ }
+ qual = TimeFormRangedTimeQual(t1, t2);
+ break;
+ default:
+ elog(WARN, "MakeTimeRange: internal parser error");
}
return qual;
}
@@ -319,16 +319,16 @@ disallow_setop(char *op, Type optype, Node * operand)
}
}
-static Node *
+static Node *
make_operand(char *opname,
Node * tree,
Oid orig_typeId,
Oid true_typeId)
{
- Node *result;
- Type true_type;
- Datum val;
- Oid infunc;
+ Node *result;
+ Type true_type;
+ Datum val;
+ Oid infunc;
if (tree != NULL)
{
@@ -337,7 +337,7 @@ make_operand(char *opname,
disallow_setop(opname, true_type, result);
if (true_typeId != orig_typeId)
{ /* must coerce */
- Const *con = (Const *) result;
+ Const *con = (Const *) result;
Assert(nodeTag(result) == T_Const);
val = (Datum) textout((struct varlena *)
@@ -358,7 +358,7 @@ make_operand(char *opname,
}
else
{
- Const *con = makeNode(Const);
+ Const *con = makeNode(Const);
con->consttype = true_typeId;
con->constlen = 0;
@@ -373,17 +373,17 @@ make_operand(char *opname,
}
-Expr *
+Expr *
make_op(char *opname, Node * ltree, Node * rtree)
{
- Oid ltypeId,
- rtypeId;
- Operator temp;
+ Oid ltypeId,
+ rtypeId;
+ Operator temp;
OperatorTupleForm opform;
- Oper *newop;
- Node *left,
- *right;
- Expr *result;
+ Oper *newop;
+ Node *left,
+ *right;
+ Expr *result;
if (rtree == NULL)
{
@@ -409,10 +409,10 @@ make_op(char *opname, Node * ltree, Node * rtree)
}
else
{
- char *outstr;
- Oid infunc,
- outfunc;
- Type newtype;
+ char *outstr;
+ Oid infunc,
+ outfunc;
+ Type newtype;
#define CONVERTABLE_TYPE(t) ( (t) == INT2OID || \
(t) == INT4OID || \
@@ -495,9 +495,9 @@ make_op(char *opname, Node * ltree, Node * rtree)
Oid
find_atttype(Oid relid, char *attrname)
{
- int attid;
- Oid vartype;
- Relation rd;
+ int attid;
+ Oid vartype;
+ Relation rd;
rd = heap_open(relid);
if (!RelationIsValid(rd))
@@ -524,15 +524,15 @@ find_atttype(Oid relid, char *attrname)
}
-Var *
+Var *
make_var(ParseState * pstate, char *refname, char *attrname, Oid * type_id)
{
- Var *varnode;
- int vnum,
- attid;
- Oid vartypeid;
- Relation rd;
- RangeTblEntry *rte;
+ Var *varnode;
+ int vnum,
+ attid;
+ Oid vartypeid;
+ Relation rd;
+ RangeTblEntry *rte;
rte = refnameRangeTableEntry(pstate->p_rtable, refname);
if (rte == NULL)
@@ -567,18 +567,18 @@ make_var(ParseState * pstate, char *refname, char *attrname, Oid * type_id)
*
* indirection is a list of A_Indices
*/
-ArrayRef *
+ArrayRef *
make_array_ref(Node * expr,
List * indirection)
{
- Oid typearray;
- HeapTuple type_tuple;
- TypeTupleForm type_struct_array,
- type_struct_element;
- ArrayRef *aref;
- Oid reftype;
- List *upperIndexpr = NIL;
- List *lowerIndexpr = NIL;
+ Oid typearray;
+ HeapTuple type_tuple;
+ TypeTupleForm type_struct_array,
+ type_struct_element;
+ ArrayRef *aref;
+ Oid reftype;
+ List *upperIndexpr = NIL;
+ List *lowerIndexpr = NIL;
typearray = exprType(expr);
@@ -611,7 +611,7 @@ make_array_ref(Node * expr,
while (indirection != NIL)
{
- A_Indices *ind = lfirst(indirection);
+ A_Indices *ind = lfirst(indirection);
if (ind->lidx)
{
@@ -649,18 +649,18 @@ make_array_ref(Node * expr,
return aref;
}
-ArrayRef *
+ArrayRef *
make_array_set(Expr * target_expr,
List * upperIndexpr,
List * lowerIndexpr,
Expr * expr)
{
- Oid typearray;
- HeapTuple type_tuple;
- TypeTupleForm type_struct_array;
- TypeTupleForm type_struct_element;
- ArrayRef *aref;
- Oid reftype;
+ Oid typearray;
+ HeapTuple type_tuple;
+ TypeTupleForm type_struct_array;
+ TypeTupleForm type_struct_element;
+ ArrayRef *aref;
+ Oid reftype;
typearray = exprType((Node *) target_expr);
@@ -723,48 +723,49 @@ make_array_set(Expr * target_expr,
*
* eventually, produces a "const" lisp-struct as per nodedefs.cl
*/
-Const *
+Const *
make_const(Value * value)
{
- Type tp;
- Datum val;
- Const *con;
+ Type tp;
+ Datum val;
+ Const *con;
switch (nodeTag(value))
{
- case T_Integer:
- tp = type("int4");
- val = Int32GetDatum(intVal(value));
- break;
+ case T_Integer:
+ tp = type("int4");
+ val = Int32GetDatum(intVal(value));
+ break;
- case T_Float:
- {
- float64 dummy;
+ case T_Float:
+ {
+ float64 dummy;
- tp = type("float8");
+ tp = type("float8");
- dummy = (float64) palloc(sizeof(float64data));
- *dummy = floatVal(value);
+ dummy = (float64) palloc(sizeof(float64data));
+ *dummy = floatVal(value);
- val = Float64GetDatum(dummy);
- }
- break;
+ val = Float64GetDatum(dummy);
+ }
+ break;
- case T_String:
- tp = type("unknown"); /* unknown for now, will be type coerced */
- val = PointerGetDatum(textin(strVal(value)));
- break;
+ case T_String:
+ tp = type("unknown"); /* unknown for now, will be type
+ * coerced */
+ val = PointerGetDatum(textin(strVal(value)));
+ break;
- case T_Null:
- default:
- {
- if (nodeTag(value) != T_Null)
- elog(NOTICE, "unknown type : %d\n", nodeTag(value));
+ case T_Null:
+ default:
+ {
+ if (nodeTag(value) != T_Null)
+ elog(NOTICE, "unknown type : %d\n", nodeTag(value));
- /* null const */
- con = makeConst(0, 0, (Datum) NULL, true, false, false, false);
- return con;
- }
+ /* null const */
+ con = makeConst(0, 0, (Datum) NULL, true, false, false, false);
+ return con;
+ }
}
con = makeConst(typeid(tp),
@@ -811,7 +812,7 @@ handleTargetColname(ParseState * pstate, char **resname,
{
if (pstate->p_insert_columns != NIL)
{
- Ident *id = lfirst(pstate->p_insert_columns);
+ Ident *id = lfirst(pstate->p_insert_columns);
*resname = id->name;
pstate->p_insert_columns = lnext(pstate->p_insert_columns);
@@ -831,12 +832,12 @@ static void
checkTargetTypes(ParseState * pstate, char *target_colname,
char *refname, char *colname)
{
- Oid attrtype_id,
- attrtype_target;
- int resdomno_id,
- resdomno_target;
- Relation rd;
- RangeTblEntry *rte;
+ Oid attrtype_id,
+ attrtype_target;
+ int resdomno_id,
+ resdomno_target;
+ Relation rd;
+ RangeTblEntry *rte;
if (target_colname == NULL || colname == NULL)
return;
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index 99c6ce2bfd..3ca419dd6b 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.23 1997/09/07 04:44:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.24 1997/09/08 02:25:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,20 +36,20 @@
#include "access/heapam.h"
#include "optimizer/clauses.h"
-void init_io(); /* from scan.l */
-void parser_init(Oid * typev, int nargs); /* from gram.y */
-int yyparse(); /* from gram.c */
+void init_io(); /* from scan.l */
+void parser_init(Oid * typev, int nargs); /* from gram.y */
+int yyparse(); /* from gram.c */
-char *parseString; /* the char* which holds the string to be
+char *parseString; /* the char* which holds the string to be
* parsed */
-char *parseCh; /* a pointer used during parsing to walk
+char *parseCh; /* a pointer used during parsing to walk
* down ParseString */
-List *parsetree = NIL;
+List *parsetree = NIL;
#ifdef SETS_FIXED
-static void fixupsets();
-static void define_sets();
+static void fixupsets();
+static void define_sets();
#endif
/*
@@ -57,14 +57,14 @@ static void define_sets();
*
* CALLER is responsible for free'ing the list returned
*/
-QueryTreeList *
+QueryTreeList *
parser(char *str, Oid * typev, int nargs)
{
- QueryTreeList *queryList;
- int yyresult;
+ QueryTreeList *queryList;
+ int yyresult;
#if defined(FLEX_SCANNER)
- extern void DeleteBuffer(void);
+ extern void DeleteBuffer(void);
#endif /* FLEX_SCANNER */
@@ -131,11 +131,11 @@ fixupsets(Query * parse)
static void
define_sets(Node * clause)
{
- Oid setoid;
- Type t = type("oid");
- Oid typeoid = typeid(t);
- Size oidsize = tlen(t);
- bool oidbyval = tbyval(t);
+ Oid setoid;
+ Type t = type("oid");
+ Oid typeoid = typeid(t);
+ Size oidsize = tlen(t);
+ bool oidbyval = tbyval(t);
if (clause == NULL)
{
@@ -170,7 +170,7 @@ define_sets(Node * clause)
}
else if (or_clause(clause))
{
- List *temp;
+ List *temp;
/* mapcan */
foreach(temp, ((Expr *) clause)->args)
@@ -180,7 +180,7 @@ define_sets(Node * clause)
}
else if (is_funcclause(clause))
{
- List *temp;
+ List *temp;
/* mapcan */
foreach(temp, ((Expr *) clause)->args)
@@ -209,33 +209,33 @@ define_sets(Node * clause)
#define PSIZE(PTR) (*((int32 *)(PTR) - 1))
*/
-Node *
+Node *
parser_typecast(Value * expr, TypeName * typename, int typlen)
{
/* check for passing non-ints */
- Const *adt;
- Datum lcp;
- Type tp;
- char type_string[16];
- int32 len;
- char *cp = NULL;
- char *const_string = NULL;
- bool string_palloced = false;
+ Const *adt;
+ Datum lcp;
+ Type tp;
+ char type_string[16];
+ int32 len;
+ char *cp = NULL;
+ char *const_string = NULL;
+ bool string_palloced = false;
switch (nodeTag(expr))
{
- case T_String:
- const_string = DatumGetPointer(expr->val.str);
- break;
- case T_Integer:
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%d", expr->val.ival);
- break;
- default:
- elog(WARN,
- "parser_typecast: cannot cast this expression to type \"%s\"",
- typename->name);
+ case T_String:
+ const_string = DatumGetPointer(expr->val.str);
+ break;
+ case T_Integer:
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%d", expr->val.ival);
+ break;
+ default:
+ elog(WARN,
+ "parser_typecast: cannot cast this expression to type \"%s\"",
+ typename->name);
}
if (typename->arrayBounds != NIL)
@@ -253,49 +253,49 @@ parser_typecast(Value * expr, TypeName * typename, int typlen)
#if 0 /* fix me */
switch (CInteger(lfirst(expr)))
{
- case INT4OID: /* int4 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%d", ((Const *) lnext(expr))->constvalue);
- break;
-
- case NAMEOID: /* char16 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%s", ((Const *) lnext(expr))->constvalue);
- break;
-
- case CHAROID: /* char */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%c", ((Const) lnext(expr))->constvalue);
- break;
-
- case FLOAT8OID: /* float8 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%f", ((Const) lnext(expr))->constvalue);
- break;
-
- case CASHOID: /* money */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%d",
- (int) ((Const *) expr)->constvalue);
- break;
-
- case TEXTOID: /* text */
- const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
- const_string = (char *) textout((struct varlena *) const_string);
- break;
-
- case UNKNOWNOID: /* unknown */
- const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
- const_string = (char *) textout((struct varlena *) const_string);
- break;
-
- default:
- elog(WARN, "unknown type %d", CInteger(lfirst(expr)));
+ case INT4OID: /* int4 */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%d", ((Const *) lnext(expr))->constvalue);
+ break;
+
+ case NAMEOID: /* char16 */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%s", ((Const *) lnext(expr))->constvalue);
+ break;
+
+ case CHAROID: /* char */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%c", ((Const) lnext(expr))->constvalue);
+ break;
+
+ case FLOAT8OID: /* float8 */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%f", ((Const) lnext(expr))->constvalue);
+ break;
+
+ case CASHOID: /* money */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%d",
+ (int) ((Const *) expr)->constvalue);
+ break;
+
+ case TEXTOID: /* text */
+ const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
+ const_string = (char *) textout((struct varlena *) const_string);
+ break;
+
+ case UNKNOWNOID: /* unknown */
+ const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
+ const_string = (char *) textout((struct varlena *) const_string);
+ break;
+
+ default:
+ elog(WARN, "unknown type %d", CInteger(lfirst(expr)));
}
#endif
@@ -317,18 +317,18 @@ parser_typecast(Value * expr, TypeName * typename, int typlen)
{
switch (len)
{
- case 1:
- lcp = Int8GetDatum(cp);
- break;
- case 2:
- lcp = Int16GetDatum(cp);
- break;
- case 4:
- lcp = Int32GetDatum(cp);
- break;
- default:
- lcp = PointerGetDatum(cp);
- break;
+ case 1:
+ lcp = Int8GetDatum(cp);
+ break;
+ case 2:
+ lcp = Int16GetDatum(cp);
+ break;
+ case 4:
+ lcp = Int32GetDatum(cp);
+ break;
+ default:
+ lcp = PointerGetDatum(cp);
+ break;
}
}
@@ -346,80 +346,80 @@ parser_typecast(Value * expr, TypeName * typename, int typlen)
return (Node *) adt;
}
-Node *
+Node *
parser_typecast2(Node * expr, Oid exprType, Type tp, int typlen)
{
/* check for passing non-ints */
- Const *adt;
- Datum lcp;
- int32 len = tlen(tp);
- char *cp = NULL;
+ Const *adt;
+ Datum lcp;
+ int32 len = tlen(tp);
+ char *cp = NULL;
- char *const_string = NULL;
- bool string_palloced = false;
+ char *const_string = NULL;
+ bool string_palloced = false;
Assert(IsA(expr, Const));
switch (exprType)
{
- case 0: /* NULL */
- break;
- case INT4OID: /* int4 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%d",
- (int) ((Const *) expr)->constvalue);
- break;
- case NAMEOID: /* char16 */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%s",
- (char *) ((Const *) expr)->constvalue);
- break;
- case CHAROID: /* char */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%c",
- (char) ((Const *) expr)->constvalue);
- break;
- case FLOAT4OID: /* float4 */
- {
- float32 floatVal =
- DatumGetFloat32(((Const *) expr)->constvalue);
-
+ case 0: /* NULL */
+ break;
+ case INT4OID: /* int4 */
const_string = (char *) palloc(256);
string_palloced = true;
- sprintf(const_string, "%f", *floatVal);
+ sprintf(const_string, "%d",
+ (int) ((Const *) expr)->constvalue);
break;
- }
- case FLOAT8OID: /* float8 */
- {
- float64 floatVal =
- DatumGetFloat64(((Const *) expr)->constvalue);
-
+ case NAMEOID: /* char16 */
const_string = (char *) palloc(256);
string_palloced = true;
- sprintf(const_string, "%f", *floatVal);
+ sprintf(const_string, "%s",
+ (char *) ((Const *) expr)->constvalue);
break;
- }
- case CASHOID: /* money */
- const_string = (char *) palloc(256);
- string_palloced = true;
- sprintf(const_string, "%d",
- (long) ((Const *) expr)->constvalue);
- break;
- case TEXTOID: /* text */
- const_string =
- DatumGetPointer(((Const *) expr)->constvalue);
- const_string = (char *) textout((struct varlena *) const_string);
- break;
- case UNKNOWNOID: /* unknown */
- const_string =
- DatumGetPointer(((Const *) expr)->constvalue);
- const_string = (char *) textout((struct varlena *) const_string);
- break;
- default:
- elog(WARN, "unknown type %u ", exprType);
+ case CHAROID: /* char */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%c",
+ (char) ((Const *) expr)->constvalue);
+ break;
+ case FLOAT4OID: /* float4 */
+ {
+ float32 floatVal =
+ DatumGetFloat32(((Const *) expr)->constvalue);
+
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%f", *floatVal);
+ break;
+ }
+ case FLOAT8OID: /* float8 */
+ {
+ float64 floatVal =
+ DatumGetFloat64(((Const *) expr)->constvalue);
+
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%f", *floatVal);
+ break;
+ }
+ case CASHOID: /* money */
+ const_string = (char *) palloc(256);
+ string_palloced = true;
+ sprintf(const_string, "%d",
+ (long) ((Const *) expr)->constvalue);
+ break;
+ case TEXTOID: /* text */
+ const_string =
+ DatumGetPointer(((Const *) expr)->constvalue);
+ const_string = (char *) textout((struct varlena *) const_string);
+ break;
+ case UNKNOWNOID: /* unknown */
+ const_string =
+ DatumGetPointer(((Const *) expr)->constvalue);
+ const_string = (char *) textout((struct varlena *) const_string);
+ break;
+ default:
+ elog(WARN, "unknown type %u ", exprType);
}
if (!exprType)
@@ -453,18 +453,18 @@ parser_typecast2(Node * expr, Oid exprType, Type tp, int typlen)
{
switch (len)
{
- case 1:
- lcp = Int8GetDatum(cp);
- break;
- case 2:
- lcp = Int16GetDatum(cp);
- break;
- case 4:
- lcp = Int32GetDatum(cp);
- break;
- default:
- lcp = PointerGetDatum(cp);
- break;
+ case 1:
+ lcp = Int8GetDatum(cp);
+ break;
+ case 2:
+ lcp = Int16GetDatum(cp);
+ break;
+ case 4:
+ lcp = Int32GetDatum(cp);
+ break;
+ default:
+ lcp = PointerGetDatum(cp);
+ break;
}
}
@@ -485,15 +485,15 @@ parser_typecast2(Node * expr, Oid exprType, Type tp, int typlen)
return ((Node *) adt);
}
-Aggreg *
+Aggreg *
ParseAgg(char *aggname, Oid basetype, Node * target)
{
- Oid fintype;
- Oid vartype;
- Oid xfn1;
+ Oid fintype;
+ Oid vartype;
+ Oid xfn1;
Form_pg_aggregate aggform;
- Aggreg *aggreg;
- HeapTuple theAggTuple;
+ Aggreg *aggreg;
+ HeapTuple theAggTuple;
theAggTuple = SearchSysCacheTuple(AGGNAME, PointerGetDatum(aggname),
ObjectIdGetDatum(basetype),
@@ -521,8 +521,8 @@ ParseAgg(char *aggname, Oid basetype, Node * target)
if (basetype != vartype)
{
- Type tp1,
- tp2;
+ Type tp1,
+ tp2;
tp1 = get_id_type(basetype);
tp2 = get_id_type(vartype);
diff --git a/src/backend/parser/scansup.c b/src/backend/parser/scansup.c
index 0b94452898..dcc66145a5 100644
--- a/src/backend/parser/scansup.c
+++ b/src/backend/parser/scansup.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/scansup.c,v 1.6 1997/09/07 04:44:51 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/scansup.c,v 1.7 1997/09/08 02:25:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,13 +38,13 @@
* ----------------
*/
-char *
+char *
scanstr(char *s)
{
- static char newStr[MAX_PARSE_BUFFER];
- int len,
- i,
- j;
+ static char newStr[MAX_PARSE_BUFFER];
+ int len,
+ i,
+ j;
if (s == NULL || s[0] == '\0')
return s;
@@ -66,60 +66,60 @@ scanstr(char *s)
i = i + 1;
switch (s[i])
{
- case '\\':
- newStr[j] = '\\';
- break;
- case 'b':
- newStr[j] = '\b';
- break;
- case 'f':
- newStr[j] = '\f';
- break;
- case 'n':
- newStr[j] = '\n';
- break;
- case 'r':
- newStr[j] = '\r';
- break;
- case 't':
- newStr[j] = '\t';
- break;
- case '"':
- newStr[j] = '"';
- break;
- case '\'':
- newStr[j] = '\'';
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- char octal[4];
- int k;
- long octVal;
+ case '\\':
+ newStr[j] = '\\';
+ break;
+ case 'b':
+ newStr[j] = '\b';
+ break;
+ case 'f':
+ newStr[j] = '\f';
+ break;
+ case 'n':
+ newStr[j] = '\n';
+ break;
+ case 'r':
+ newStr[j] = '\r';
+ break;
+ case 't':
+ newStr[j] = '\t';
+ break;
+ case '"':
+ newStr[j] = '"';
+ break;
+ case '\'':
+ newStr[j] = '\'';
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ char octal[4];
+ int k;
+ long octVal;
- for (k = 0;
+ for (k = 0;
s[i + k] >= '0' && s[i + k] <= '7' && k < 3;
- k++)
- octal[k] = s[i + k];
- i += k - 1;
- octal[3] = '\0';
+ k++)
+ octal[k] = s[i + k];
+ i += k - 1;
+ octal[3] = '\0';
- octVal = strtol(octal, 0, 8);
+ octVal = strtol(octal, 0, 8);
/* elog (NOTICE, "octal = %s octVal = %d, %od", octal, octVal, octVal);*/
- if (octVal <= 0377)
- {
- newStr[j] = ((char) octVal);
- break;
+ if (octVal <= 0377)
+ {
+ newStr[j] = ((char) octVal);
+ break;
+ }
}
- }
- default:
- newStr[j] = s[i];
+ default:
+ newStr[j] = s[i];
} /* switch */
} /* s[i] == '\\' */
else
diff --git a/src/backend/parser/sysfunc.c b/src/backend/parser/sysfunc.c
index 02d6d6b21a..f65f9b863e 100644
--- a/src/backend/parser/sysfunc.c
+++ b/src/backend/parser/sysfunc.c
@@ -27,12 +27,12 @@
* Can't get much more obvious than this. Might need to replace localtime()
* on older systems...
*/
-static char *
+static char *
Sysfunc_system_date(void)
{
- time_t cur_time_secs;
- struct tm *cur_time_expanded;
- static char buf[12]; /* Just for safety, y'understand... */
+ time_t cur_time_secs;
+ struct tm *cur_time_expanded;
+ static char buf[12]; /* Just for safety, y'understand... */
time(&cur_time_secs);
cur_time_expanded = localtime(&cur_time_secs);
@@ -46,12 +46,12 @@ Sysfunc_system_date(void)
return &buf[0];
}
-static char *
+static char *
Sysfunc_system_time(void)
{
- time_t cur_time_secs;
- struct tm *cur_time_expanded;
- static char buf[10]; /* Just for safety, y'understand... */
+ time_t cur_time_secs;
+ struct tm *cur_time_expanded;
+ static char buf[10]; /* Just for safety, y'understand... */
time(&cur_time_secs);
cur_time_expanded = localtime(&cur_time_secs);
@@ -61,7 +61,7 @@ Sysfunc_system_time(void)
return &buf[0];
}
-char *
+char *
SystemFunctionHandler(char *funct)
{
if (!strcmp(funct, "SYS_DATE"))
diff --git a/src/backend/port/BSD44_derived/dl.c b/src/backend/port/BSD44_derived/dl.c
index 091507204b..42d15d840f 100644
--- a/src/backend/port/BSD44_derived/dl.c
+++ b/src/backend/port/BSD44_derived/dl.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91";
+static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91";
#endif /* LIBC_SCCS and not lint */
@@ -46,26 +46,26 @@ static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91";
#include "port-protos.h"
-static char error_message[BUFSIZ];
+static char error_message[BUFSIZ];
-char *
+char *
BSD44_derived_dlerror(void)
{
- static char ret[BUFSIZ];
+ static char ret[BUFSIZ];
strcpy(ret, error_message);
error_message[0] = 0;
return ((ret[0] == 0) ? (char *) NULL : ret);
}
-void *
+void *
BSD44_derived_dlopen(const char *file, int num)
{
#ifdef __mips__
sprintf(error_message, "dlopen (%s) not supported", file);
return NULL;
#else
- void *vp;
+ void *vp;
if ((vp = dlopen((char *) file, num)) == (void *) NULL)
{
@@ -75,15 +75,15 @@ BSD44_derived_dlopen(const char *file, int num)
#endif
}
-void *
+void *
BSD44_derived_dlsym(void *handle, const char *name)
{
#ifdef __mips__
sprintf(error_message, "dlsym (%s) failed", name);
return NULL;
#else
- void *vp;
- char buf[BUFSIZ];
+ void *vp;
+ char buf[BUFSIZ];
if (*name != '_')
{
diff --git a/src/backend/port/BSD44_derived/port-protos.h b/src/backend/port/BSD44_derived/port-protos.h
index 2452355d29..224058dfea 100644
--- a/src/backend/port/BSD44_derived/port-protos.h
+++ b/src/backend/port/BSD44_derived/port-protos.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: port-protos.h,v 1.7 1997/09/07 04:45:03 momjian Exp $
+ * $Id: port-protos.h,v 1.8 1997/09/08 02:25:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,9 +40,9 @@
#define pg_dlclose BSD44_derived_dlclose
#define pg_dlerror BSD44_derived_dlerror
-char *BSD44_derived_dlerror(void);
-void *BSD44_derived_dlopen(const char *filename, int num);
-void *BSD44_derived_dlsym(void *handle, const char *name);
-void BSD44_derived_dlclose(void *handle);
+char *BSD44_derived_dlerror(void);
+void *BSD44_derived_dlopen(const char *filename, int num);
+void *BSD44_derived_dlsym(void *handle, const char *name);
+void BSD44_derived_dlclose(void *handle);
#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/aix/dlfcn.c b/src/backend/port/aix/dlfcn.c
index 58a3dea3c1..e42b00f247 100644
--- a/src/backend/port/aix/dlfcn.c
+++ b/src/backend/port/aix/dlfcn.c
@@ -24,9 +24,9 @@
typedef struct
{
- char *name; /* the symbols's name */
- void *addr; /* its relocated virtual address */
-} Export, *ExportPtr;
+ char *name; /* the symbols's name */
+ void *addr; /* its relocated virtual address */
+} Export, *ExportPtr;
/*
* xlC uses the following structure to list its constructors and
@@ -34,24 +34,24 @@ typedef struct
*/
typedef struct
{
- void (*init) (void); /* call static constructors */
- void (*term) (void); /* call static destructors */
-} Cdtor, *CdtorPtr;
+ void (*init) (void); /* call static constructors */
+ void (*term) (void); /* call static destructors */
+} Cdtor, *CdtorPtr;
/*
* The void * handle returned from dlopen is actually a ModulePtr.
*/
typedef struct Module
{
- struct Module *next;
- char *name; /* module name for refcounting */
- int refCnt; /* the number of references */
- void *entry; /* entry point from load */
+ struct Module *next;
+ char *name; /* module name for refcounting */
+ int refCnt; /* the number of references */
+ void *entry; /* entry point from load */
struct dl_info *info; /* optional init/terminate functions */
- CdtorPtr cdtors; /* optional C++ constructors */
- int nExports; /* the number of exports found */
- ExportPtr exports; /* the array of exports */
-} Module, *ModulePtr;
+ CdtorPtr cdtors; /* optional C++ constructors */
+ int nExports; /* the number of exports found */
+ ExportPtr exports; /* the array of exports */
+} Module, *ModulePtr;
/*
* We keep a list of all loaded modules to be able to call the fini
@@ -63,20 +63,20 @@ static ModulePtr modList;
* The last error from one of the dl* routines is kept in static
* variables here. Each error is returned only once to the caller.
*/
-static char errbuf[BUFSIZ];
-static int errvalid;
+static char errbuf[BUFSIZ];
+static int errvalid;
-extern char *strdup(const char *);
-static void caterr(char *);
-static int readExports(ModulePtr);
-static void terminate(void);
-static void *findMain(void);
+extern char *strdup(const char *);
+static void caterr(char *);
+static int readExports(ModulePtr);
+static void terminate(void);
+static void *findMain(void);
-void *
+void *
dlopen(const char *path, int mode)
{
register ModulePtr mp;
- static void *mainModule;
+ static void *mainModule;
/*
* Upon the first call register a terminate handler that will close
@@ -134,13 +134,13 @@ dlopen(const char *path, int mode)
*/
if (errno == ENOEXEC)
{
- char *tmp[BUFSIZ / sizeof(char *)];
+ char *tmp[BUFSIZ / sizeof(char *)];
if (loadquery(L_GETMESSAGES, tmp, sizeof(tmp)) == -1)
strcpy(errbuf, strerror(errno));
else
{
- char **p;
+ char **p;
for (p = tmp; *p; p++)
caterr(*p);
@@ -221,46 +221,46 @@ dlopen(const char *path, int mode)
static void
caterr(char *s)
{
- register char *p = s;
+ register char *p = s;
while (*p >= '0' && *p <= '9')
p++;
switch (atoi(s))
{
- case L_ERROR_TOOMANY:
- strcat(errbuf, "to many errors");
- break;
- case L_ERROR_NOLIB:
- strcat(errbuf, "can't load library");
- strcat(errbuf, p);
- break;
- case L_ERROR_UNDEF:
- strcat(errbuf, "can't find symbol");
- strcat(errbuf, p);
- break;
- case L_ERROR_RLDBAD:
- strcat(errbuf, "bad RLD");
- strcat(errbuf, p);
- break;
- case L_ERROR_FORMAT:
- strcat(errbuf, "bad exec format in");
- strcat(errbuf, p);
- break;
- case L_ERROR_ERRNO:
- strcat(errbuf, strerror(atoi(++p)));
- break;
- default:
- strcat(errbuf, s);
- break;
+ case L_ERROR_TOOMANY:
+ strcat(errbuf, "to many errors");
+ break;
+ case L_ERROR_NOLIB:
+ strcat(errbuf, "can't load library");
+ strcat(errbuf, p);
+ break;
+ case L_ERROR_UNDEF:
+ strcat(errbuf, "can't find symbol");
+ strcat(errbuf, p);
+ break;
+ case L_ERROR_RLDBAD:
+ strcat(errbuf, "bad RLD");
+ strcat(errbuf, p);
+ break;
+ case L_ERROR_FORMAT:
+ strcat(errbuf, "bad exec format in");
+ strcat(errbuf, p);
+ break;
+ case L_ERROR_ERRNO:
+ strcat(errbuf, strerror(atoi(++p)));
+ break;
+ default:
+ strcat(errbuf, s);
+ break;
}
}
-void *
+void *
dlsym(void *handle, const char *symbol)
{
register ModulePtr mp = (ModulePtr) handle;
register ExportPtr ep;
- register int i;
+ register int i;
/*
* Could speed up the search, but I assume that one assigns the result
@@ -275,7 +275,7 @@ dlsym(void *handle, const char *symbol)
return NULL;
}
-char *
+char *
dlerror(void)
{
if (errvalid)
@@ -290,7 +290,7 @@ int
dlclose(void *handle)
{
register ModulePtr mp = (ModulePtr) handle;
- int result;
+ int result;
register ModulePtr mp1;
if (--mp->refCnt > 0)
@@ -312,7 +312,7 @@ dlclose(void *handle)
if (mp->exports)
{
register ExportPtr ep;
- register int i;
+ register int i;
for (ep = mp->exports, i = mp->nExports; i; i--, ep++)
if (ep->name)
@@ -348,20 +348,20 @@ terminate(void)
static int
readExports(ModulePtr mp)
{
- LDFILE *ldp = NULL;
- SCNHDR sh,
- shdata;
- LDHDR *lhp;
- char *ldbuf;
- LDSYM *ls;
- int i;
- ExportPtr ep;
+ LDFILE *ldp = NULL;
+ SCNHDR sh,
+ shdata;
+ LDHDR *lhp;
+ char *ldbuf;
+ LDSYM *ls;
+ int i;
+ ExportPtr ep;
if ((ldp = ldopen(mp->name, ldp)) == NULL)
{
struct ld_info *lp;
- char *buf;
- int size = 4 * 1024;
+ char *buf;
+ int size = 4 * 1024;
if (errno != ENOENT)
{
@@ -522,8 +522,8 @@ readExports(ModulePtr mp)
ls = (LDSYM *) (ldbuf + LDHDRSZ);
for (i = lhp->l_nsyms; i; i--, ls++)
{
- char *symname;
- char tmpsym[SYMNMLEN + 1];
+ char *symname;
+ char tmpsym[SYMNMLEN + 1];
if (!LDR_EXPORT(*ls))
continue;
@@ -555,14 +555,14 @@ readExports(ModulePtr mp)
* Find the main modules entry point. This is used as export pointer
* for loadbind() to be able to resolve references to the main part.
*/
-static void *
+static void *
findMain(void)
{
struct ld_info *lp;
- char *buf;
- int size = 4 * 1024;
- int i;
- void *ret;
+ char *buf;
+ int size = 4 * 1024;
+ int i;
+ void *ret;
if ((buf = malloc(size)) == NULL)
{
diff --git a/src/backend/port/aix/dlfcn.h b/src/backend/port/aix/dlfcn.h
index 1e874d9655..0a4f322e9d 100644
--- a/src/backend/port/aix/dlfcn.h
+++ b/src/backend/port/aix/dlfcn.h
@@ -8,7 +8,7 @@
#define __dlfcn_h__
#ifdef __cplusplus
-extern "C"
+extern "C"
{
#endif
@@ -25,20 +25,20 @@ extern "C"
*/
struct dl_info
{
- void (*init) (void);
- void (*fini) (void);
+ void (*init) (void);
+ void (*fini) (void);
};
#if __STDC__ || defined(_IBMR2)
- void *dlopen(const char *path, int mode);
- void *dlsym(void *handle, const char *symbol);
- char *dlerror(void);
- int dlclose(void *handle);
+ void *dlopen(const char *path, int mode);
+ void *dlsym(void *handle, const char *symbol);
+ char *dlerror(void);
+ int dlclose(void *handle);
#else
- void *dlopen();
- void *dlsym();
- char *dlerror();
- int dlclose();
+ void *dlopen();
+ void *dlsym();
+ char *dlerror();
+ int dlclose();
#endif
#ifdef __cplusplus
diff --git a/src/backend/port/alpha/port-protos.h b/src/backend/port/alpha/port-protos.h
index 3b5cb47ade..89c7d42043 100644
--- a/src/backend/port/alpha/port-protos.h
+++ b/src/backend/port/alpha/port-protos.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: port-protos.h,v 1.2 1997/09/07 04:45:20 momjian Exp $
+ * $Id: port-protos.h,v 1.3 1997/09/08 02:25:47 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,6 +34,6 @@
/* port.c */
-extern void init_address_fixup(void);
+extern void init_address_fixup(void);
#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/alpha/port.c b/src/backend/port/alpha/port.c
index 80b03088a4..e01ca93dc8 100644
--- a/src/backend/port/alpha/port.c
+++ b/src/backend/port/alpha/port.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/alpha/Attic/port.c,v 1.2 1997/09/07 04:45:22 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/alpha/Attic/port.c,v 1.3 1997/09/08 02:25:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,11 +21,11 @@ void
init_address_fixup()
{
#ifdef NOFIXADE
- int buffer[] = {SSIN_UACPROC, UAC_SIGBUS};
+ int buffer[] = {SSIN_UACPROC, UAC_SIGBUS};
#endif /* NOFIXADE */
#ifdef NOPRINTADE
- int buffer[] = {SSIN_UACPROC, UAC_NOPRINT};
+ int buffer[] = {SSIN_UACPROC, UAC_NOPRINT};
#endif /* NOPRINTADE */
diff --git a/src/backend/port/bsdi/dynloader.c b/src/backend/port/bsdi/dynloader.c
index cfaeec0c20..9754236a20 100644
--- a/src/backend/port/bsdi/dynloader.c
+++ b/src/backend/port/bsdi/dynloader.c
@@ -22,12 +22,12 @@
#include "utils/elog.h"
#include "fmgr.h"
-extern char pg_pathname[];
+extern char pg_pathname[];
-void *
+void *
pg_dlopen(char *filename)
{
- static int dl_initialized = 0;
+ static int dl_initialized = 0;
/*
* initializes the dynamic loader with the executable's pathname.
@@ -76,8 +76,8 @@ pg_dlopen(char *filename)
}
if (dld_undefined_sym_count > 0)
{
- int count = dld_undefined_sym_count;
- char **list = dld_list_undefined_sym();
+ int count = dld_undefined_sym_count;
+ char **list = dld_list_undefined_sym();
/* list the undefined symbols, if any */
elog(NOTICE, "dld: Undefined:");
@@ -97,7 +97,7 @@ pg_dlopen(char *filename)
return (void *) strdup(filename);
}
-char *
+char *
pg_dlerror()
{
return dld_strerror(dld_errno);
diff --git a/src/backend/port/bsdi/port-protos.h b/src/backend/port/bsdi/port-protos.h
index acd0e85a49..579706d0bb 100644
--- a/src/backend/port/bsdi/port-protos.h
+++ b/src/backend/port/bsdi/port-protos.h
@@ -17,8 +17,8 @@
* Externals in libc that need prototypes (or at least declarations)
*/
-extern char *ecvt(double, int, int *, int *);
-extern char *fcvt(double, int, int *, int *);
+extern char *ecvt(double, int, int *, int *);
+extern char *fcvt(double, int, int *, int *);
#include "fmgr.h" /* for func_ptr */
diff --git a/src/backend/port/dgux/dynloader.c b/src/backend/port/dgux/dynloader.c
index 0f7d38bc09..47834c7486 100644
--- a/src/backend/port/dgux/dynloader.c
+++ b/src/backend/port/dgux/dynloader.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/dgux/Attic/dynloader.c,v 1.2 1997/09/07 04:45:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/dgux/Attic/dynloader.c,v 1.3 1997/09/08 02:26:05 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,12 +19,12 @@
#include "utils/elog.h"
#include "fmgr.h"
-extern char pg_pathname[];
+extern char pg_pathname[];
-void *
+void *
pg_dlopen(char *filename)
{
- static int dl_initialized = 0;
+ static int dl_initialized = 0;
/*
* initializes the dynamic loader with the executable's pathname.
@@ -73,8 +73,8 @@ pg_dlopen(char *filename)
}
if (dld_undefined_sym_count > 0)
{
- int count = dld_undefined_sym_count;
- char **list = dld_list_undefined_sym();
+ int count = dld_undefined_sym_count;
+ char **list = dld_list_undefined_sym();
/* list the undefined symbols, if any */
elog(NOTICE, "dld: Undefined:");
@@ -94,7 +94,7 @@ pg_dlopen(char *filename)
return (void *) strdup(filename);
}
-char *
+char *
pg_dlerror()
{
return dld_strerror(dld_errno);
diff --git a/src/backend/port/hpux/dynloader.c b/src/backend/port/hpux/dynloader.c
index 3c7a8acaa7..972654adb5 100644
--- a/src/backend/port/hpux/dynloader.c
+++ b/src/backend/port/hpux/dynloader.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/hpux/Attic/dynloader.c,v 1.2 1997/09/07 04:45:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/hpux/Attic/dynloader.c,v 1.3 1997/09/08 02:26:15 momjian Exp $
*
* NOTES
* all functions are defined here -- it's impossible to trace the
@@ -24,10 +24,10 @@
#include "utils/dynamic_loader.h"
#include "port-protos.h"
-void *
+void *
pg_dlopen(char *filename)
{
- shl_t handle = shl_load(filename, BIND_DEFERRED, 0);
+ shl_t handle = shl_load(filename, BIND_DEFERRED, 0);
return ((void *) handle);
}
@@ -35,7 +35,7 @@ pg_dlopen(char *filename)
func_ptr
pg_dlsym(void *handle, char *funcname)
{
- func_ptr f;
+ func_ptr f;
if (shl_findsym((shl_t *) & handle, funcname, TYPE_PROCEDURE, &f) == -1)
{
@@ -50,10 +50,10 @@ pg_dlclose(void *handle)
shl_unload((shl_t) handle);
}
-char *
+char *
pg_dlerror()
{
- static char errmsg[] = "shl_load failed";
+ static char errmsg[] = "shl_load failed";
return errmsg;
}
diff --git a/src/backend/port/hpux/fixade.h b/src/backend/port/hpux/fixade.h
index 094cd13ca8..8ed40481ab 100644
--- a/src/backend/port/hpux/fixade.h
+++ b/src/backend/port/hpux/fixade.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: fixade.h,v 1.2 1997/09/07 04:45:48 momjian Exp $
+ * $Id: fixade.h,v 1.3 1997/09/08 02:26:22 momjian Exp $
*
* NOTES
* This must be included in EVERY source file.
@@ -47,11 +47,11 @@
*/
struct HP_WAY_BOGUS
{
- char hpwb_bogus[8192];
+ char hpwb_bogus[8192];
};
struct HP_TOO_BOGUS
{
- int hptb_bogus[8192];
+ int hptb_bogus[8192];
};
#endif /* BROKEN_STRUCT_INIT */
diff --git a/src/backend/port/hpux/port-protos.h b/src/backend/port/hpux/port-protos.h
index 76b336aae2..7b4fad99fa 100644
--- a/src/backend/port/hpux/port-protos.h
+++ b/src/backend/port/hpux/port-protos.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: port-protos.h,v 1.3 1997/09/07 04:45:51 momjian Exp $
+ * $Id: port-protos.h,v 1.4 1997/09/08 02:26:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,11 +24,11 @@
/* port.c */
-extern int init_address_fixup(void);
-extern double rint(double x);
-extern double cbrt(double x);
-extern long random(void);
-extern void srandom(unsigned seed);
-extern int getrusage(int who, struct rusage * ru);
+extern int init_address_fixup(void);
+extern double rint(double x);
+extern double cbrt(double x);
+extern long random(void);
+extern void srandom(unsigned seed);
+extern int getrusage(int who, struct rusage * ru);
#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/hpux/rusagestub.h b/src/backend/port/hpux/rusagestub.h
index 5eda998802..9f32a10cc1 100644
--- a/src/backend/port/hpux/rusagestub.h
+++ b/src/backend/port/hpux/rusagestub.h
@@ -22,10 +22,10 @@
struct rusage
{
- struct timeval ru_utime; /* user time used */
- struct timeval ru_stime; /* system time used */
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
};
-extern int getrusage(int who, struct rusage * rusage);
+extern int getrusage(int who, struct rusage * rusage);
#endif /* RUSAGESTUB_H */
diff --git a/src/backend/port/i386_solaris/port-protos.h b/src/backend/port/i386_solaris/port-protos.h
index 6118a65046..dd5d73418a 100644
--- a/src/backend/port/i386_solaris/port-protos.h
+++ b/src/backend/port/i386_solaris/port-protos.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: port-protos.h,v 1.2 1997/09/07 04:45:56 momjian Exp $
+ * $Id: port-protos.h,v 1.3 1997/09/08 02:26:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,7 +32,7 @@
#define pg_dlerror dlerror
/* port.c */
-extern long random(void);
-extern void srandom(int seed);
+extern long random(void);
+extern void srandom(int seed);
#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/i386_solaris/port.c b/src/backend/port/i386_solaris/port.c
index 119163a186..71e8d9b95d 100644
--- a/src/backend/port/i386_solaris/port.c
+++ b/src/backend/port/i386_solaris/port.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/i386_solaris/Attic/port.c,v 1.2 1997/09/07 04:45:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/i386_solaris/Attic/port.c,v 1.3 1997/09/08 02:26:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,10 +31,10 @@ srandom(int seed)
int
getrusage(int who, struct rusage * rusage)
{
- struct tms tms;
- register int tick_rate = CLK_TCK; /* ticks per second */
- clock_t u,
- s;
+ struct tms tms;
+ register int tick_rate = CLK_TCK; /* ticks per second */
+ clock_t u,
+ s;
if (rusage == (struct rusage *) NULL)
{
@@ -48,17 +48,17 @@ getrusage(int who, struct rusage * rusage)
}
switch (who)
{
- case RUSAGE_SELF:
- u = tms.tms_utime;
- s = tms.tms_stime;
- break;
- case RUSAGE_CHILDREN:
- u = tms.tms_cutime;
- s = tms.tms_cstime;
- break;
- default:
- errno = EINVAL;
- return (-1);
+ case RUSAGE_SELF:
+ u = tms.tms_utime;
+ s = tms.tms_stime;
+ break;
+ case RUSAGE_CHILDREN:
+ u = tms.tms_cutime;
+ s = tms.tms_cstime;
+ break;
+ default:
+ errno = EINVAL;
+ return (-1);
}
#define TICK_TO_SEC(T, RATE) ((T)/(RATE))
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
diff --git a/src/backend/port/i386_solaris/rusagestub.h b/src/backend/port/i386_solaris/rusagestub.h
index c6e2ceae45..1370e509c5 100644
--- a/src/backend/port/i386_solaris/rusagestub.h
+++ b/src/backend/port/i386_solaris/rusagestub.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rusagestub.h,v 1.2 1997/09/07 04:46:04 momjian Exp $
+ * $Id: rusagestub.h,v 1.3 1997/09/08 02:26:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,10 +22,10 @@
struct rusage
{
- struct timeval ru_utime; /* user time used */
- struct timeval ru_stime; /* system time used */
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
};
-extern int getrusage(int who, struct rusage * rusage);
+extern int getrusage(int who, struct rusage * rusage);
#endif /* RUSAGESTUB_H */
diff --git a/src/backend/port/inet_aton.c b/src/backend/port/inet_aton.c
index 122875eda3..f1283e6e6b 100644
--- a/src/backend/port/inet_aton.c
+++ b/src/backend/port/inet_aton.c
@@ -58,10 +58,10 @@ int
inet_aton(const char *cp, struct in_addr * addr)
{
register u_long val;
- register int base,
- n;
- register char c;
- u_int parts[4];
+ register int base,
+ n;
+ register char c;
+ u_int parts[4];
register u_int *pp = parts;
for (;;)
@@ -125,26 +125,26 @@ inet_aton(const char *cp, struct in_addr * addr)
switch (n)
{
- case 1: /* a -- 32 bits */
- break;
+ case 1: /* a -- 32 bits */
+ break;
- case 2: /* a.b -- 8.24 bits */
- if (val > 0xffffff)
- return (0);
- val |= parts[0] << 24;
- break;
+ case 2: /* a.b -- 8.24 bits */
+ if (val > 0xffffff)
+ return (0);
+ val |= parts[0] << 24;
+ break;
- case 3: /* a.b.c -- 8.8.16 bits */
- if (val > 0xffff)
- return (0);
- val |= (parts[0] << 24) | (parts[1] << 16);
- break;
+ case 3: /* a.b.c -- 8.8.16 bits */
+ if (val > 0xffff)
+ return (0);
+ val |= (parts[0] << 24) | (parts[1] << 16);
+ break;
- case 4: /* a.b.c.d -- 8.8.8.8 bits */
- if (val > 0xff)
- return (0);
- val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
- break;
+ case 4: /* a.b.c.d -- 8.8.8.8 bits */
+ if (val > 0xff)
+ return (0);
+ val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
+ break;
}
if (addr)
addr->s_addr = htonl(val);
diff --git a/src/backend/port/inet_aton.h b/src/backend/port/inet_aton.h
index b1df9a8ff3..8d04f544bc 100644
--- a/src/backend/port/inet_aton.h
+++ b/src/backend/port/inet_aton.h
@@ -1,2 +1,2 @@
int
- inet_aton(const char *cp, struct in_addr * addr);
+ inet_aton(const char *cp, struct in_addr * addr);
diff --git a/src/backend/port/irix5/port-protos.h b/src/backend/port/irix5/port-protos.h
index be894ed5b1..2babb773e0 100644
--- a/src/backend/port/irix5/port-protos.h
+++ b/src/backend/port/irix5/port-protos.h
@@ -32,6 +32,6 @@
#define pg_dlerror dlerror
/* port.c */
-extern long random(void);
+extern long random(void);
#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/linux/dynloader.c b/src/backend/port/linux/dynloader.c
index adb13b4019..ee4f17cb9d 100644
--- a/src/backend/port/linux/dynloader.c
+++ b/src/backend/port/linux/dynloader.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/linux/Attic/dynloader.c,v 1.3 1997/09/07 04:46:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/linux/Attic/dynloader.c,v 1.4 1997/09/08 02:26:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,16 +23,16 @@
#include "utils/elog.h"
#include "fmgr.h"
-extern char pg_pathname[];
+extern char pg_pathname[];
-void *
+void *
pg_dlopen(char *filename)
{
#ifndef HAVE_DLD_H
elog(WARN, "dynamic load not supported");
return (NULL);
#else
- static int dl_initialized = 0;
+ static int dl_initialized = 0;
/*
* initializes the dynamic loader with the executable's pathname.
@@ -81,8 +81,8 @@ pg_dlopen(char *filename)
}
if (dld_undefined_sym_count > 0)
{
- int count = dld_undefined_sym_count;
- char **list = dld_list_undefined_sym();
+ int count = dld_undefined_sym_count;
+ char **list = dld_list_undefined_sym();
/* list the undefined symbols, if any */
elog(NOTICE, "dld: Undefined:");
@@ -103,7 +103,7 @@ pg_dlopen(char *filename)
#endif
}
-char *
+char *
pg_dlerror()
{
#ifndef HAVE_DLD_H
diff --git a/src/backend/port/nextstep/dynloader.c b/src/backend/port/nextstep/dynloader.c
index c37508f7f1..649454d48a 100644
--- a/src/backend/port/nextstep/dynloader.c
+++ b/src/backend/port/nextstep/dynloader.c
@@ -2,7 +2,7 @@
#include <streams/streams.h>
#include <stdlib.h>
-static char *lastError = NULL;
+static char *lastError = NULL;
static NXStream *
OpenError()
@@ -20,9 +20,9 @@ CloseError(NXStream * s)
static void
TransferError(NXStream * s)
{
- char *buffer;
- int len,
- maxlen;
+ char *buffer;
+ int len,
+ maxlen;
if (lastError)
free(lastError);
@@ -31,13 +31,13 @@ TransferError(NXStream * s)
strcpy(lastError, buffer);
}
-void *
+void *
next_dlopen(char *name)
{
- int rld_success;
- NXStream *errorStream;
- char *result = NULL;
- char **p;
+ int rld_success;
+ NXStream *errorStream;
+ char *result = NULL;
+ char **p;
errorStream = OpenError();
p = calloc(2, sizeof(void *));
@@ -60,12 +60,12 @@ next_dlclose(void *handle)
return 0;
}
-void *
+void *
next_dlsym(void *handle, char *symbol)
{
- NXStream *errorStream = OpenError();
- char symbuf[1024];
- unsigned long symref = 0;
+ NXStream *errorStream = OpenError();
+ char symbuf[1024];
+ unsigned long symref = 0;
sprintf(symbuf, "_%s", symbol);
if (!rld_lookup(errorStream, symbuf, &symref))
@@ -74,7 +74,7 @@ next_dlsym(void *handle, char *symbol)
return (void *) symref;
}
-char *
+char *
next_dlerror(void)
{
return lastError;
diff --git a/src/backend/port/nextstep/port-protos.h b/src/backend/port/nextstep/port-protos.h
index ce17beb69a..9dfb20a99e 100644
--- a/src/backend/port/nextstep/port-protos.h
+++ b/src/backend/port/nextstep/port-protos.h
@@ -12,10 +12,10 @@
#include "fmgr.h" /* for func_ptr */
#include "utils/dynamic_loader.h"
-void *next_dlopen(char *name);
-int next_dlclose(void *handle);
-void *next_dlsym(void *handle, char *symbol);
-char *next_dlerror(void);
+void *next_dlopen(char *name);
+int next_dlclose(void *handle);
+void *next_dlsym(void *handle, char *symbol);
+char *next_dlerror(void);
#define pg_dlopen(f) next_dlopen
#define pg_dlsym next_dlsym
diff --git a/src/backend/port/nextstep/port.c b/src/backend/port/nextstep/port.c
index baf026d5d1..c71befe015 100644
--- a/src/backend/port/nextstep/port.c
+++ b/src/backend/port/nextstep/port.c
@@ -12,9 +12,9 @@
void
putenv(char *name)
{
- extern char **environ;
- static int was_mallocated = 0;
- int size;
+ extern char **environ;
+ static int was_mallocated = 0;
+ int size;
/* Compute the size of environ array including the final NULL */
for (size = 1; environ[size++];)
@@ -22,8 +22,8 @@ putenv(char *name)
if (!was_mallocated)
{
- char **tmp = environ;
- int i;
+ char **tmp = environ;
+ int i;
was_mallocated = 1;
environ = malloc(size * sizeof(char *));
@@ -36,7 +36,7 @@ putenv(char *name)
environ[size] = NULL;
}
-char *
+char *
strdup(const char *string)
{
return strcpy(malloc(strlen(string) + 1), string);
@@ -56,7 +56,7 @@ sigemptyset(int *set)
return (*set = 0);
}
-char *
+char *
getcwd(char *buf, size_t size)
{
return getwd(buf);
diff --git a/src/backend/port/sco/port.c b/src/backend/port/sco/port.c
index d1c868e842..d7acc97a75 100644
--- a/src/backend/port/sco/port.c
+++ b/src/backend/port/sco/port.c
@@ -21,10 +21,10 @@
int
getrusage(int who, struct rusage * rusage)
{
- struct tms tms;
- register int tick_rate = CLK_TCK; /* ticks per second */
- clock_t u,
- s;
+ struct tms tms;
+ register int tick_rate = CLK_TCK; /* ticks per second */
+ clock_t u,
+ s;
if (rusage == (struct rusage *) NULL)
{
@@ -38,17 +38,17 @@ getrusage(int who, struct rusage * rusage)
}
switch (who)
{
- case RUSAGE_SELF:
- u = tms.tms_utime;
- s = tms.tms_stime;
- break;
- case RUSAGE_CHILDREN:
- u = tms.tms_cutime;
- s = tms.tms_cstime;
- break;
- default:
- errno = EINVAL;
- return (-1);
+ case RUSAGE_SELF:
+ u = tms.tms_utime;
+ s = tms.tms_stime;
+ break;
+ case RUSAGE_CHILDREN:
+ u = tms.tms_cutime;
+ s = tms.tms_cstime;
+ break;
+ default:
+ errno = EINVAL;
+ return (-1);
}
#define TICK_TO_SEC(T, RATE) ((T)/(RATE))
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
diff --git a/src/backend/port/sco/rusagestub.h b/src/backend/port/sco/rusagestub.h
index 5eda998802..9f32a10cc1 100644
--- a/src/backend/port/sco/rusagestub.h
+++ b/src/backend/port/sco/rusagestub.h
@@ -22,10 +22,10 @@
struct rusage
{
- struct timeval ru_utime; /* user time used */
- struct timeval ru_stime; /* system time used */
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
};
-extern int getrusage(int who, struct rusage * rusage);
+extern int getrusage(int who, struct rusage * rusage);
#endif /* RUSAGESTUB_H */
diff --git a/src/backend/port/sparc_solaris/port-protos.h b/src/backend/port/sparc_solaris/port-protos.h
index 9523917346..36a423df67 100644
--- a/src/backend/port/sparc_solaris/port-protos.h
+++ b/src/backend/port/sparc_solaris/port-protos.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: port-protos.h,v 1.5 1997/09/07 04:46:50 momjian Exp $
+ * $Id: port-protos.h,v 1.6 1997/09/08 02:27:06 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,17 +36,17 @@
#define pg_dlerror dlerror
/* port.c */
-extern long random(void);
-extern void srandom(int seed);
+extern long random(void);
+extern void srandom(int seed);
/* inet_aton.c in backend/port directory */
-extern int inet_aton(const char *cp, struct in_addr * addr);
+extern int inet_aton(const char *cp, struct in_addr * addr);
/* In system library, but can't find prototype in system library .h files */
-extern int gethostname(char *name, int namelen);
+extern int gethostname(char *name, int namelen);
/* In system library, but can't find prototype in system library .h files */
#include <sys/resource.h>
-extern int getrusage(int who, struct rusage * rusage);
+extern int getrusage(int who, struct rusage * rusage);
#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/sparc_solaris/port.c b/src/backend/port/sparc_solaris/port.c
index 7f19a1ae23..69980d6ea8 100644
--- a/src/backend/port/sparc_solaris/port.c
+++ b/src/backend/port/sparc_solaris/port.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/sparc_solaris/Attic/port.c,v 1.5 1997/09/07 04:46:53 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/sparc_solaris/Attic/port.c,v 1.6 1997/09/08 02:27:07 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,10 +38,10 @@ srandom(int seed)
int
getrusage(int who, struct rusage * rusage)
{
- struct tms tms;
- register int tick_rate = CLK_TCK; /* ticks per second */
- clock_t u,
- s;
+ struct tms tms;
+ register int tick_rate = CLK_TCK; /* ticks per second */
+ clock_t u,
+ s;
if (rusage == (struct rusage *) NULL)
{
@@ -55,17 +55,17 @@ getrusage(int who, struct rusage * rusage)
}
switch (who)
{
- case RUSAGE_SELF:
- u = tms.tms_utime;
- s = tms.tms_stime;
- break;
- case RUSAGE_CHILDREN:
- u = tms.tms_cutime;
- s = tms.tms_cstime;
- break;
- default:
- errno = EINVAL;
- return (-1);
+ case RUSAGE_SELF:
+ u = tms.tms_utime;
+ s = tms.tms_stime;
+ break;
+ case RUSAGE_CHILDREN:
+ u = tms.tms_cutime;
+ s = tms.tms_cstime;
+ break;
+ default:
+ errno = EINVAL;
+ return (-1);
}
#define TICK_TO_SEC(T, RATE) ((T)/(RATE))
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
diff --git a/src/backend/port/sparc_solaris/rusagestub.h b/src/backend/port/sparc_solaris/rusagestub.h
index 87957a45ea..708cfc9ff1 100644
--- a/src/backend/port/sparc_solaris/rusagestub.h
+++ b/src/backend/port/sparc_solaris/rusagestub.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: rusagestub.h,v 1.2 1997/09/07 04:46:56 momjian Exp $
+ * $Id: rusagestub.h,v 1.3 1997/09/08 02:27:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,10 +22,10 @@
struct rusage
{
- struct timeval ru_utime; /* user time used */
- struct timeval ru_stime; /* system time used */
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
};
-extern int getrusage(int who, struct rusage * rusage);
+extern int getrusage(int who, struct rusage * rusage);
#endif /* RUSAGESTUB_H */
diff --git a/src/backend/port/strerror.c b/src/backend/port/strerror.c
index 5bcd3cb452..2e0511d04d 100644
--- a/src/backend/port/strerror.c
+++ b/src/backend/port/strerror.c
@@ -12,12 +12,12 @@
#include <errno.h>
extern const char *const sys_errlist[];
-extern int sys_nerr;
+extern int sys_nerr;
-const char *
+const char *
strerror(int errnum)
{
- static char buf[24];
+ static char buf[24];
if (errnum < 0 || errnum > sys_nerr)
{
diff --git a/src/backend/port/sunos4/strtol.c b/src/backend/port/sunos4/strtol.c
index c788d94bd5..dcf3e89860 100644
--- a/src/backend/port/sunos4/strtol.c
+++ b/src/backend/port/sunos4/strtol.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91";
+static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91";
#endif /* LIBC_SCCS and not lint */
@@ -51,17 +51,17 @@ static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91";
*/
long
strtol(nptr, endptr, base)
-const char *nptr;
-char **endptr;
-register int base;
+const char *nptr;
+char **endptr;
+register int base;
{
register const char *s = nptr;
register unsigned long acc;
- register int c;
+ register int c;
register unsigned long cutoff;
- register int neg = 0,
- any,
- cutlim;
+ register int neg = 0,
+ any,
+ cutlim;
/*
* Skip white space and pick up leading +/- sign if any. If base is 0,
diff --git a/src/backend/port/svr4/port-protos.h b/src/backend/port/svr4/port-protos.h
index 1baff08876..3926b25342 100644
--- a/src/backend/port/svr4/port-protos.h
+++ b/src/backend/port/svr4/port-protos.h
@@ -32,7 +32,7 @@
#define pg_dlerror dlerror
/* port.c */
-extern long random(void);
-extern void srandom(int seed);
+extern long random(void);
+extern void srandom(int seed);
#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/svr4/port.c b/src/backend/port/svr4/port.c
index 0b38e2c4ac..92acee71ec 100644
--- a/src/backend/port/svr4/port.c
+++ b/src/backend/port/svr4/port.c
@@ -31,10 +31,10 @@ srandom(int seed)
int
getrusage(int who, struct rusage * rusage)
{
- struct tms tms;
- register int tick_rate = CLK_TCK; /* ticks per second */
- clock_t u,
- s;
+ struct tms tms;
+ register int tick_rate = CLK_TCK; /* ticks per second */
+ clock_t u,
+ s;
if (rusage == (struct rusage *) NULL)
{
@@ -48,17 +48,17 @@ getrusage(int who, struct rusage * rusage)
}
switch (who)
{
- case RUSAGE_SELF:
- u = tms.tms_utime;
- s = tms.tms_stime;
- break;
- case RUSAGE_CHILDREN:
- u = tms.tms_cutime;
- s = tms.tms_cstime;
- break;
- default:
- errno = EINVAL;
- return (-1);
+ case RUSAGE_SELF:
+ u = tms.tms_utime;
+ s = tms.tms_stime;
+ break;
+ case RUSAGE_CHILDREN:
+ u = tms.tms_cutime;
+ s = tms.tms_cstime;
+ break;
+ default:
+ errno = EINVAL;
+ return (-1);
}
#define TICK_TO_SEC(T, RATE) ((T)/(RATE))
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
@@ -82,7 +82,7 @@ getrusage(int who, struct rusage * rusage)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
+static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
#endif /* LIBC_SCCS and not lint */
@@ -133,7 +133,7 @@ int
strcasecmp(char *s1, char *s2)
{
register unsigned char u1,
- u2;
+ u2;
for (;;)
{
diff --git a/src/backend/port/svr4/rusagestub.h b/src/backend/port/svr4/rusagestub.h
index 5eda998802..9f32a10cc1 100644
--- a/src/backend/port/svr4/rusagestub.h
+++ b/src/backend/port/svr4/rusagestub.h
@@ -22,10 +22,10 @@
struct rusage
{
- struct timeval ru_utime; /* user time used */
- struct timeval ru_stime; /* system time used */
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
};
-extern int getrusage(int who, struct rusage * rusage);
+extern int getrusage(int who, struct rusage * rusage);
#endif /* RUSAGESTUB_H */
diff --git a/src/backend/port/ultrix4/dl.h b/src/backend/port/ultrix4/dl.h
index 56eab754bf..9014e151a5 100644
--- a/src/backend/port/ultrix4/dl.h
+++ b/src/backend/port/ultrix4/dl.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: dl.h,v 1.4 1997/09/07 04:47:18 momjian Exp $
+ * $Id: dl.h,v 1.5 1997/09/08 02:27:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,73 +42,73 @@
#include <scnhdr.h>
-typedef long CoreAddr;
+typedef long CoreAddr;
typedef struct ScnInfo
{
- CoreAddr addr; /* starting address of the section */
- SCNHDR hdr; /* section header */
- RELOC *relocEntries; /* relocation entries */
-} ScnInfo;
+ CoreAddr addr; /* starting address of the section */
+ SCNHDR hdr; /* section header */
+ RELOC *relocEntries; /* relocation entries */
+} ScnInfo;
typedef enum
{
DL_NEEDRELOC, /* still need relocation */
DL_RELOCATED, /* no relocation necessary */
DL_INPROG /* relocation in progress */
-} dlRStatus;
+} dlRStatus;
typedef struct JmpTbl
{
- char *block; /* the jump table memory block */
- struct JmpTbl *next; /* next block */
-} JmpTbl;
+ char *block; /* the jump table memory block */
+ struct JmpTbl *next; /* next block */
+} JmpTbl;
typedef struct dlFile
{
- char *filename; /* file name of the object file */
+ char *filename; /* file name of the object file */
- int textSize; /* used by mprotect */
- CoreAddr textAddress;/* start addr of text section */
- long textVaddr; /* vaddr of text section in obj file */
- CoreAddr rdataAddress; /* start addr of rdata section */
- long rdataVaddr; /* vaddr of text section in obj file */
- CoreAddr dataAddress;/* start addr of data section */
- long dataVaddr; /* vaddr of text section in obj file */
- CoreAddr bssAddress; /* start addr of bss section */
- long bssVaddr; /* vaddr of text section in obj file */
+ int textSize; /* used by mprotect */
+ CoreAddr textAddress; /* start addr of text section */
+ long textVaddr; /* vaddr of text section in obj file */
+ CoreAddr rdataAddress; /* start addr of rdata section */
+ long rdataVaddr; /* vaddr of text section in obj file */
+ CoreAddr dataAddress; /* start addr of data section */
+ long dataVaddr; /* vaddr of text section in obj file */
+ CoreAddr bssAddress; /* start addr of bss section */
+ long bssVaddr; /* vaddr of text section in obj file */
- int nsect; /* number of sections */
- ScnInfo *sect; /* details of each section (array) */
+ int nsect; /* number of sections */
+ ScnInfo *sect; /* details of each section (array) */
- int issExtMax; /* size of string space */
- char *extss; /* extern sym string space (in core) */
- int iextMax; /* maximum number of Symbols */
- pEXTR extsyms; /* extern syms */
+ int issExtMax; /* size of string space */
+ char *extss; /* extern sym string space (in core) */
+ int iextMax; /* maximum number of Symbols */
+ pEXTR extsyms; /* extern syms */
- dlRStatus relocStatus;/* what relocation needed? */
- int needReloc;
+ dlRStatus relocStatus; /* what relocation needed? */
+ int needReloc;
- JmpTbl *jmptable; /* the jump table for R_JMPADDR */
+ JmpTbl *jmptable; /* the jump table for R_JMPADDR */
- struct dlFile *next; /* next member of the archive */
-} dlFile;
+ struct dlFile *next; /* next member of the archive */
+} dlFile;
typedef struct dlSymbol
{
- char *name; /* name of the symbol */
- long addr; /* address of the symbol */
- dlFile *objFile; /* from which file */
-} dlSymbol;
+ char *name; /* name of the symbol */
+ long addr; /* address of the symbol */
+ dlFile *objFile; /* from which file */
+} dlSymbol;
/*
* prototypes for the dl* interface
*/
-extern void *dl_open( /* char *filename, int mode */ );
-extern void *dl_sym( /* void *handle, char *name */ );
-extern void dl_close( /* void *handle */ );
-extern char *dl_error( /* void */ );
+extern void *dl_open( /* char *filename, int mode */ );
+extern void *dl_sym( /* void *handle, char *name */ );
+extern void dl_close( /* void *handle */ );
+extern char *dl_error( /* void */ );
#define DL_LAZY 0 /* lazy resolution */
#define DL_NOW 1 /* immediate resolution */
@@ -116,8 +116,8 @@ extern char *dl_error( /* void */ );
/*
* Miscellaneous utility routines:
*/
-extern char **dl_undefinedSymbols( /* int *count */ );
-extern void dl_printAllSymbols( /* void *handle */ );
-extern void dl_setLibraries( /* char *libs */ );
+extern char **dl_undefinedSymbols( /* int *count */ );
+extern void dl_printAllSymbols( /* void *handle */ );
+extern void dl_setLibraries( /* char *libs */ );
#endif /* _DL_HEADER_ */
diff --git a/src/backend/port/ultrix4/dynloader.c b/src/backend/port/ultrix4/dynloader.c
index d896eebf90..761289233e 100644
--- a/src/backend/port/ultrix4/dynloader.c
+++ b/src/backend/port/ultrix4/dynloader.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/dynloader.c,v 1.4 1997/09/07 04:47:21 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/dynloader.c,v 1.5 1997/09/08 02:27:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,13 +22,13 @@
#include "port-protos.h"
#include "utils/elog.h"
-extern char pg_pathname[];
+extern char pg_pathname[];
-void *
+void *
pg_dlopen(char *filename)
{
- static int dl_initialized = 0;
- void *handle;
+ static int dl_initialized = 0;
+ void *handle;
/*
* initializes the dynamic loader with the executable's pathname.
@@ -56,8 +56,8 @@ pg_dlopen(char *filename)
*/
if ((handle = dl_open(filename, DL_NOW)) == NULL)
{
- int count;
- char **list = dl_undefinedSymbols(&count);
+ int count;
+ char **list = dl_undefinedSymbols(&count);
/* list the undefined symbols, if any */
if (count)
diff --git a/src/backend/port/ultrix4/port-protos.h b/src/backend/port/ultrix4/port-protos.h
index 25f49db393..091e852841 100644
--- a/src/backend/port/ultrix4/port-protos.h
+++ b/src/backend/port/ultrix4/port-protos.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: port-protos.h,v 1.6 1997/09/07 04:47:24 momjian Exp $
+ * $Id: port-protos.h,v 1.7 1997/09/08 02:27:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,8 +17,8 @@
* Externals in libc that need prototypes (or at least declarations)
*/
-extern char *ecvt(double, int, int *, int *);
-extern char *fcvt(double, int, int *, int *);
+extern char *ecvt(double, int, int *, int *);
+extern char *fcvt(double, int, int *, int *);
/* dynloader.c */
/*
@@ -32,16 +32,16 @@ extern char *fcvt(double, int, int *, int *);
#define pg_dlsym(h, f) ((func_ptr)dl_sym(h, f))
#define pg_dlclose(h) dl_close(h)
#define pg_dlerror() dl_error()
-extern int dl_init(char *);
+extern int dl_init(char *);
/* port.c */
-extern int syscall();
+extern int syscall();
-extern void init_address_fixup(void);
+extern void init_address_fixup(void);
/* strdup.c: strdup() is not part of libc on Ultrix */
-extern char *strdup(char const *);
+extern char *strdup(char const *);
/* inet_aton() is not part of libc on Ultrix. The following is from
backend/port/inet_aton.h
@@ -49,6 +49,6 @@ extern char *strdup(char const *);
struct in_addr;
int
- inet_aton(const char *cp, struct in_addr * addr);
+ inet_aton(const char *cp, struct in_addr * addr);
#endif /* PORT_PORTOS_H */
diff --git a/src/backend/port/ultrix4/strdup.c b/src/backend/port/ultrix4/strdup.c
index a738e1611e..395e544a68 100644
--- a/src/backend/port/ultrix4/strdup.c
+++ b/src/backend/port/ultrix4/strdup.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/strdup.c,v 1.3 1997/09/07 04:47:28 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/strdup.c,v 1.4 1997/09/08 02:27:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,10 +17,10 @@
#include "port-protos.h"
-char *
+char *
strdup(char const * string)
{
- char *nstr;
+ char *nstr;
nstr = strcpy((char *) palloc(strlen(string) + 1), string);
return nstr;
diff --git a/src/backend/port/univel/frontend-port-protos.h b/src/backend/port/univel/frontend-port-protos.h
index 9ca0100cb9..215633b6b7 100644
--- a/src/backend/port/univel/frontend-port-protos.h
+++ b/src/backend/port/univel/frontend-port-protos.h
@@ -14,9 +14,9 @@
#define FPORT_PROTOS_H
/* port.c */
-extern long random(void);
-extern void srandom(int seed);
-extern int strcasecmp(char *s1, char *s2);
-extern int gethostname(char *name, int namelen);
+extern long random(void);
+extern void srandom(int seed);
+extern int strcasecmp(char *s1, char *s2);
+extern int gethostname(char *name, int namelen);
#endif /* FPORT_PROTOS_H */
diff --git a/src/backend/port/univel/port-protos.h b/src/backend/port/univel/port-protos.h
index c181edfc9e..a4af145110 100644
--- a/src/backend/port/univel/port-protos.h
+++ b/src/backend/port/univel/port-protos.h
@@ -32,9 +32,9 @@
#define pg_dlerror dlerror
/* port.c */
-extern long random(void);
-extern void srandom(int seed);
-extern int strcasecmp(char *s1, char *s2);
-extern int gethostname(char *name, int namelen);
+extern long random(void);
+extern void srandom(int seed);
+extern int strcasecmp(char *s1, char *s2);
+extern int gethostname(char *name, int namelen);
#endif /* PORT_PROTOS_H */
diff --git a/src/backend/port/univel/port.c b/src/backend/port/univel/port.c
index d4c7658859..37cefb2221 100644
--- a/src/backend/port/univel/port.c
+++ b/src/backend/port/univel/port.c
@@ -32,10 +32,10 @@ srandom(int seed)
int
getrusage(int who, struct rusage * rusage)
{
- struct tms tms;
- register int tick_rate = CLK_TCK; /* ticks per second */
- clock_t u,
- s;
+ struct tms tms;
+ register int tick_rate = CLK_TCK; /* ticks per second */
+ clock_t u,
+ s;
if (rusage == (struct rusage *) NULL)
{
@@ -49,17 +49,17 @@ getrusage(int who, struct rusage * rusage)
}
switch (who)
{
- case RUSAGE_SELF:
- u = tms.tms_utime;
- s = tms.tms_stime;
- break;
- case RUSAGE_CHILDREN:
- u = tms.tms_cutime;
- s = tms.tms_cstime;
- break;
- default:
- errno = EINVAL;
- return (-1);
+ case RUSAGE_SELF:
+ u = tms.tms_utime;
+ s = tms.tms_stime;
+ break;
+ case RUSAGE_CHILDREN:
+ u = tms.tms_cutime;
+ s = tms.tms_cstime;
+ break;
+ default:
+ errno = EINVAL;
+ return (-1);
}
#define TICK_TO_SEC(T, RATE) ((T)/(RATE))
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
@@ -83,7 +83,7 @@ getrusage(int who, struct rusage * rusage)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
+static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
#endif /* LIBC_SCCS and not lint */
@@ -134,7 +134,7 @@ int
strcasecmp(char *s1, char *s2)
{
register unsigned char u1,
- u2;
+ u2;
for (;;)
{
@@ -157,7 +157,7 @@ int
gethostname(char *name, int namelen)
{
static struct utsname mname;
- static int called = 0;
+ static int called = 0;
if (!called)
{
diff --git a/src/backend/port/univel/rusagestub.h b/src/backend/port/univel/rusagestub.h
index 5eda998802..9f32a10cc1 100644
--- a/src/backend/port/univel/rusagestub.h
+++ b/src/backend/port/univel/rusagestub.h
@@ -22,10 +22,10 @@
struct rusage
{
- struct timeval ru_utime; /* user time used */
- struct timeval ru_stime; /* system time used */
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
};
-extern int getrusage(int who, struct rusage * rusage);
+extern int getrusage(int who, struct rusage * rusage);
#endif /* RUSAGESTUB_H */
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index c9979b7696..998a087d25 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.54 1997/09/07 04:47:43 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.55 1997/09/08 02:27:53 momjian Exp $
*
* NOTES
*
@@ -111,32 +111,32 @@
*/
typedef struct bkend
{
- int pid; /* process id of backend */
-} Backend;
+ int pid; /* process id of backend */
+} Backend;
/* list of active backends. For garbage collection only now. */
-static Dllist *BackendList;
+static Dllist *BackendList;
/* list of ports associated with still open, but incomplete connections */
-static Dllist *PortList;
+static Dllist *PortList;
-static short PostPortName = -1;
-static short ActiveBackends = FALSE;
-static int NextBackendId = MAXINT; /* XXX why? */
-static char *progname = (char *) NULL;
+static short PostPortName = -1;
+static short ActiveBackends = FALSE;
+static int NextBackendId = MAXINT; /* XXX why? */
+static char *progname = (char *) NULL;
/*
* Default Values
*/
-static char Execfile[MAXPATHLEN] = "";
+static char Execfile[MAXPATHLEN] = "";
-static int ServerSock = INVALID_SOCK; /* stream socket server */
+static int ServerSock = INVALID_SOCK; /* stream socket server */
/*
* Set by the -o option
*/
-static char ExtraOptions[ARGV_SIZE] = "";
+static char ExtraOptions[ARGV_SIZE] = "";
/*
* These globals control the behavior of the postmaster in case some
@@ -145,35 +145,35 @@ static char ExtraOptions[ARGV_SIZE] = "";
* the postmaster stop (rather than kill) peers and not reinitialize
* shared data structures.
*/
-static int Reinit = 1;
-static int SendStop = 0;
+static int Reinit = 1;
+static int SendStop = 0;
-static int MultiplexedBackends = 0;
-static int MultiplexedBackendPort;
+static int MultiplexedBackends = 0;
+static int MultiplexedBackendPort;
/*
* postmaster.c - function prototypes
*/
-static void pmdaemonize(void);
+static void pmdaemonize(void);
static void
ConnStartup(Port * port, int *status,
char *errormsg, const int errormsg_len);
-static int ConnCreate(int serverFd, int *newFdP);
-static void reset_shared(short port);
-static void pmdie(SIGNAL_ARGS);
-static void reaper(SIGNAL_ARGS);
-static void dumpstatus(SIGNAL_ARGS);
-static void CleanupProc(int pid, int exitstatus);
-static int DoExec(StartupInfo * packet, int portFd);
-static void ExitPostmaster(int status);
-static void usage(const char *);
-static int ServerLoop(void);
-static int BackendStartup(StartupInfo * packet, Port * port, int *pidPtr);
-static void send_error_reply(Port * port, const char *errormsg);
+static int ConnCreate(int serverFd, int *newFdP);
+static void reset_shared(short port);
+static void pmdie(SIGNAL_ARGS);
+static void reaper(SIGNAL_ARGS);
+static void dumpstatus(SIGNAL_ARGS);
+static void CleanupProc(int pid, int exitstatus);
+static int DoExec(StartupInfo * packet, int portFd);
+static void ExitPostmaster(int status);
+static void usage(const char *);
+static int ServerLoop(void);
+static int BackendStartup(StartupInfo * packet, Port * port, int *pidPtr);
+static void send_error_reply(Port * port, const char *errormsg);
-extern char *optarg;
-extern int optind,
- opterr;
+extern char *optarg;
+extern int optind,
+ opterr;
@@ -191,8 +191,8 @@ checkDataDir(const char *DataDir, bool * DataDirOK)
}
else
{
- char path[MAXPATHLEN];
- FILE *fp;
+ char path[MAXPATHLEN];
+ FILE *fp;
sprintf(path, "%s%cbase%ctemplate1%cpg_class",
DataDir, SEP_CHAR, SEP_CHAR, SEP_CHAR);
@@ -208,7 +208,7 @@ checkDataDir(const char *DataDir, bool * DataDirOK)
}
else
{
- char *reason;
+ char *reason;
/* reason ValidatePgVersion failed. NULL if didn't */
@@ -238,14 +238,14 @@ checkDataDir(const char *DataDir, bool * DataDirOK)
int
PostmasterMain(int argc, char *argv[])
{
- extern int NBuffers; /* from buffer/bufmgr.c */
- extern bool IsPostmaster; /* from smgr/mm.c */
- int opt;
- char *hostName;
- int status;
- int silentflag = 0;
- char hostbuf[MAXHOSTNAMELEN];
- bool DataDirOK; /* We have a usable PGDATA value */
+ extern int NBuffers; /* from buffer/bufmgr.c */
+ extern bool IsPostmaster; /* from smgr/mm.c */
+ int opt;
+ char *hostName;
+ int status;
+ int silentflag = 0;
+ char hostbuf[MAXHOSTNAMELEN];
+ bool DataDirOK; /* We have a usable PGDATA value */
progname = argv[0];
@@ -271,100 +271,103 @@ PostmasterMain(int argc, char *argv[])
{
switch (opt)
{
- case 'a':
- /* Set the authentication system. */
- be_setauthsvc(optarg);
- break;
- case 'B':
+ case 'a':
+ /* Set the authentication system. */
+ be_setauthsvc(optarg);
+ break;
+ case 'B':
- /*
- * The number of buffers to create. Setting this option means
- * we have to start each backend with a -B # to make sure they
- * know how many buffers were allocated.
- */
- NBuffers = atol(optarg);
- strcat(ExtraOptions, " -B ");
- strcat(ExtraOptions, optarg);
- break;
- case 'b':
- /* Set the backend executable file to use. */
- if (!ValidateBackend(optarg))
- strcpy(Execfile, optarg);
- else
- {
- fprintf(stderr, "%s: invalid backend \"%s\"\n",
- progname, optarg);
- exit(2);
- }
- break;
- case 'D':
- /* Set PGDATA from the command line. */
- DataDir = optarg;
- break;
- case 'd':
+ /*
+ * The number of buffers to create. Setting this option
+ * means we have to start each backend with a -B # to make
+ * sure they know how many buffers were allocated.
+ */
+ NBuffers = atol(optarg);
+ strcat(ExtraOptions, " -B ");
+ strcat(ExtraOptions, optarg);
+ break;
+ case 'b':
+ /* Set the backend executable file to use. */
+ if (!ValidateBackend(optarg))
+ strcpy(Execfile, optarg);
+ else
+ {
+ fprintf(stderr, "%s: invalid backend \"%s\"\n",
+ progname, optarg);
+ exit(2);
+ }
+ break;
+ case 'D':
+ /* Set PGDATA from the command line. */
+ DataDir = optarg;
+ break;
+ case 'd':
- /*
- * Turn on debugging for the postmaster and the backend
- * servers descended from it.
- */
- if ((optind < argc) && *argv[optind] != '-')
- {
- DebugLvl = atoi(argv[optind]);
- optind++;
- }
- else
- DebugLvl = 1;
- break;
- case 'm':
- MultiplexedBackends = 1;
- MultiplexedBackendPort = atoi(optarg);
- break;
- case 'M':
+ /*
+ * Turn on debugging for the postmaster and the backend
+ * servers descended from it.
+ */
+ if ((optind < argc) && *argv[optind] != '-')
+ {
+ DebugLvl = atoi(argv[optind]);
+ optind++;
+ }
+ else
+ DebugLvl = 1;
+ break;
+ case 'm':
+ MultiplexedBackends = 1;
+ MultiplexedBackendPort = atoi(optarg);
+ break;
+ case 'M':
- /*
- * ignore this flag. This may be passed in because the
- * program was run as 'postgres -M' instead of 'postmaster'
- */
- break;
- case 'n':
- /* Don't reinit shared mem after abnormal exit */
- Reinit = 0;
- break;
- case 'o':
+ /*
+ * ignore this flag. This may be passed in because the
+ * program was run as 'postgres -M' instead of
+ * 'postmaster'
+ */
+ break;
+ case 'n':
+ /* Don't reinit shared mem after abnormal exit */
+ Reinit = 0;
+ break;
+ case 'o':
- /*
- * Other options to pass to the backend on the command line --
- * useful only for debugging.
- */
- strcat(ExtraOptions, " ");
- strcat(ExtraOptions, optarg);
- break;
- case 'p':
- /* Set PGPORT by hand. */
- PostPortName = (short) atoi(optarg);
- break;
- case 'S':
+ /*
+ * Other options to pass to the backend on the command
+ * line -- useful only for debugging.
+ */
+ strcat(ExtraOptions, " ");
+ strcat(ExtraOptions, optarg);
+ break;
+ case 'p':
+ /* Set PGPORT by hand. */
+ PostPortName = (short) atoi(optarg);
+ break;
+ case 'S':
- /*
- * Start in 'S'ilent mode (disassociate from controlling tty).
- * You may also think of this as 'S'ysV mode since it's most
- * badly needed on SysV-derived systems like SVR4 and HP-UX.
- */
- silentflag = 1;
- break;
- case 's':
+ /*
+ * Start in 'S'ilent mode (disassociate from controlling
+ * tty). You may also think of this as 'S'ysV mode since
+ * it's most badly needed on SysV-derived systems like
+ * SVR4 and HP-UX.
+ */
+ silentflag = 1;
+ break;
+ case 's':
- /*
- * In the event that some backend dumps core, send SIGSTOP,
- * rather than SIGUSR1, to all its peers. This lets the wily
- * post_hacker collect core dumps from everyone.
- */
- SendStop = 1;
- break;
- default:
- /* usage() never returns */
- usage(progname);
- break;
+ /*
+ * In the event that some backend dumps core, send
+ * SIGSTOP, rather than SIGUSR1, to all its peers. This
+ * lets the wily post_hacker collect core dumps from
+ * everyone.
+ */
+ SendStop = 1;
+ break;
+ default:
+ /* usage() never returns */
+ usage(progname);
+ break;
}
}
if (PostPortName == -1)
@@ -425,7 +428,7 @@ PostmasterMain(int argc, char *argv[])
static void
pmdaemonize(void)
{
- int i;
+ int i;
if (fork())
exit(0);
@@ -468,26 +471,26 @@ usage(const char *progname)
static int
ServerLoop(void)
{
- int serverFd = ServerSock;
- fd_set rmask,
- basemask;
- int nSockets,
- nSelected,
- status,
- newFd;
- Dlelem *next,
- *curr;
+ int serverFd = ServerSock;
+ fd_set rmask,
+ basemask;
+ int nSockets,
+ nSelected,
+ status,
+ newFd;
+ Dlelem *next,
+ *curr;
/*
* GH: For !HAVE_SIGPROCMASK (NEXTSTEP), TRH implemented an
* alternative interface.
*/
#ifdef HAVE_SIGPROCMASK
- sigset_t oldsigmask,
- newsigmask;
+ sigset_t oldsigmask,
+ newsigmask;
#else
- int orgsigmask = sigblock(0);
+ int orgsigmask = sigblock(0);
#endif
@@ -568,7 +571,7 @@ ServerLoop(void)
curr = DLGetHead(PortList);
while (curr)
{
- Port *port = DLE_VAL(curr);
+ Port *port = DLE_VAL(curr);
fprintf(stderr, "%s: ServerLoop:\t\tport %d%s pending\n",
progname, port->sock,
@@ -583,8 +586,8 @@ ServerLoop(void)
while (curr)
{
- Port *port = (Port *) DLE_VAL(curr);
- int lastbytes = port->nBytes;
+ Port *port = (Port *) DLE_VAL(curr);
+ int lastbytes = port->nBytes;
if (FD_ISSET(port->sock, &rmask) && port->sock != newFd)
{
@@ -601,59 +604,60 @@ ServerLoop(void)
status = PacketReceive(port, &port->buf, NON_BLOCKING);
switch (status)
{
- case STATUS_OK:
- {
- int CSstatus; /* Completion status of
+ case STATUS_OK:
+ {
+ int CSstatus; /* Completion status of
* ConnStartup */
- char errormsg[200]; /* error msg from
+ char errormsg[200]; /* error msg from
* ConnStartup */
- ConnStartup(port, &CSstatus, errormsg, sizeof(errormsg));
-
- if (CSstatus == STATUS_ERROR)
- send_error_reply(port, errormsg);
- ActiveBackends = TRUE;
- }
- /* FALLTHROUGH */
- case STATUS_INVALID:
- if (DebugLvl)
- fprintf(stderr, "%s: ServerLoop:\t\tdone with %d\n",
- progname, port->sock);
- break;
- case STATUS_BAD_PACKET:
-
- /*
- * This is a bogus client, kill the connection and
- * forget the whole thing.
- */
- if (DebugLvl)
- fprintf(stderr, "%s: ServerLoop:\t\tbad packet format (reported packet size of %d read on port %d\n", progname, port->nBytes, port->sock);
- break;
- case STATUS_NOT_DONE:
- if (DebugLvl)
- fprintf(stderr, "%s: ServerLoop:\t\tpartial packet (%d bytes actually read) on %d\n",
- progname, port->nBytes, port->sock);
-
- /*
- * If we've received at least a PacketHdr's worth of
- * data and we're still receiving data each time we
- * read, we're ok. If the client gives us less than a
- * PacketHdr at the beginning, just kill the
- * connection and forget about the whole thing.
- */
- if (lastbytes < port->nBytes)
- {
+ ConnStartup(port, &CSstatus, errormsg, sizeof(errormsg));
+
+ if (CSstatus == STATUS_ERROR)
+ send_error_reply(port, errormsg);
+ ActiveBackends = TRUE;
+ }
+ /* FALLTHROUGH */
+ case STATUS_INVALID:
if (DebugLvl)
- fprintf(stderr, "%s: ServerLoop:\t\tpartial packet on %d ok\n",
+ fprintf(stderr, "%s: ServerLoop:\t\tdone with %d\n",
progname, port->sock);
- curr = DLGetSucc(curr);
- continue;
- }
- break;
- case STATUS_ERROR: /* system call error - die */
- fprintf(stderr, "%s: ServerLoop:\t\terror receiving packet\n",
- progname);
- return (STATUS_ERROR);
+ break;
+ case STATUS_BAD_PACKET:
+
+ /*
+ * This is a bogus client, kill the connection and
+ * forget the whole thing.
+ */
+ if (DebugLvl)
+ fprintf(stderr, "%s: ServerLoop:\t\tbad packet format (reported packet size of %d read on port %d\n", progname, port->nBytes, port->sock);
+ break;
+ case STATUS_NOT_DONE:
+ if (DebugLvl)
+ fprintf(stderr, "%s: ServerLoop:\t\tpartial packet (%d bytes actually read) on %d\n",
+ progname, port->nBytes, port->sock);
+
+ /*
+ * If we've received at least a PacketHdr's worth
+ * of data and we're still receiving data each
+ * time we read, we're ok. If the client gives us
+ * less than a PacketHdr at the beginning, just
+ * kill the connection and forget about the whole
+ * thing.
+ */
+ if (lastbytes < port->nBytes)
+ {
+ if (DebugLvl)
+ fprintf(stderr, "%s: ServerLoop:\t\tpartial packet on %d ok\n",
+ progname, port->sock);
+ curr = DLGetSucc(curr);
+ continue;
+ }
+ break;
+ case STATUS_ERROR: /* system call error - die */
+ fprintf(stderr, "%s: ServerLoop:\t\terror receiving packet\n",
+ progname);
+ return (STATUS_ERROR);
}
FD_CLR(port->sock, &basemask);
StreamClose(port->sock);
@@ -685,12 +689,12 @@ static void
ConnStartup(Port * port, int *status,
char *errormsg, const int errormsg_len)
{
- MsgType msgType;
- char namebuf[NAMEDATALEN];
- int pid;
- PacketBuf *p;
- StartupInfo sp;
- char *tmp;
+ MsgType msgType;
+ char namebuf[NAMEDATALEN];
+ int pid;
+ PacketBuf *p;
+ StartupInfo sp;
+ char *tmp;
p = &port->buf;
@@ -725,7 +729,7 @@ ConnStartup(Port * port, int *status,
{
if (be_recvauth(msgType, port, namebuf, &sp) != STATUS_OK)
{
- char buffer[200 + sizeof(namebuf)];
+ char buffer[200 + sizeof(namebuf)];
sprintf(buffer,
"Failed to authenticate client as Postgres user '%s' "
@@ -789,8 +793,8 @@ ConnStartup(Port * port, int *status,
static void
send_error_reply(Port * port, const char *errormsg)
{
- int rc; /* return code from sendto */
- char *reply;
+ int rc; /* return code from sendto */
+ char *reply;
/*
* The literal reply string we put into the socket. This is a pointer
@@ -837,8 +841,8 @@ send_error_reply(Port * port, const char *errormsg)
static int
ConnCreate(int serverFd, int *newFdP)
{
- int status;
- Port *port;
+ int status;
+ Port *port;
if (!(port = (Port *) calloc(1, sizeof(Port))))
@@ -868,7 +872,7 @@ ConnCreate(int serverFd, int *newFdP)
static void
reset_shared(short port)
{
- IPCKey key;
+ IPCKey key;
key = SystemPortAddressCreateIPCKey((SystemPortAddress) port);
CreateSharedMemoryAndSemaphores(key);
@@ -892,13 +896,13 @@ reaper(SIGNAL_ARGS)
{
/* GH: replace waitpid for !HAVE_WAITPID. Does this work ? */
#ifdef HAVE_WAITPID
- int status; /* backend exit status */
+ int status; /* backend exit status */
#else
- union wait statusp; /* backend exit status */
+ union wait statusp; /* backend exit status */
#endif
- int pid; /* process id of dead backend */
+ int pid; /* process id of dead backend */
if (DebugLvl)
fprintf(stderr, "%s: reaping dead processes...\n",
@@ -929,10 +933,10 @@ static void
CleanupProc(int pid,
int exitstatus) /* child's exit status. */
{
- Dlelem *prev,
- *curr;
- Backend *bp;
- int sig;
+ Dlelem *prev,
+ *curr;
+ Backend *bp;
+ int sig;
if (DebugLvl)
{
@@ -1040,10 +1044,10 @@ BackendStartup(StartupInfo * packet, /* client's startup packet */
Port * port,
int *pidPtr)
{
- Backend *bn; /* for backend cleanup */
- int pid,
- i;
- static char envEntry[4][2 * ARGV_SIZE];
+ Backend *bn; /* for backend cleanup */
+ int pid,
+ i;
+ static char envEntry[4][2 * ARGV_SIZE];
for (i = 0; i < 4; ++i)
{
@@ -1067,8 +1071,8 @@ BackendStartup(StartupInfo * packet, /* client's startup packet */
}
if (DebugLvl > 2)
{
- char **p;
- extern char **environ;
+ char **p;
+ extern char **environ;
fprintf(stderr, "%s: BackendStartup: environ dump:\n",
progname);
@@ -1140,7 +1144,7 @@ BackendStartup(StartupInfo * packet, /* client's startup packet */
static void
split_opts(char **argv, int *argcp, char *s)
{
- int i = *argcp;
+ int i = *argcp;
while (s && *s)
{
@@ -1171,22 +1175,22 @@ split_opts(char **argv, int *argcp, char *s)
static int
DoExec(StartupInfo * packet, int portFd)
{
- char execbuf[MAXPATHLEN];
- char portbuf[ARGV_SIZE];
- char mbbuf[ARGV_SIZE];
- char debugbuf[ARGV_SIZE];
- char ttybuf[ARGV_SIZE + 1];
- char argbuf[(2 * ARGV_SIZE) + 1];
+ char execbuf[MAXPATHLEN];
+ char portbuf[ARGV_SIZE];
+ char mbbuf[ARGV_SIZE];
+ char debugbuf[ARGV_SIZE];
+ char ttybuf[ARGV_SIZE + 1];
+ char argbuf[(2 * ARGV_SIZE) + 1];
/*
* each argument takes at least three chars, so we can't have more
* than ARGV_SIZE arguments in (2 * ARGV_SIZE) chars (i.e.,
* packet->options plus ExtraOptions)...
*/
- char *av[ARGV_SIZE];
- char dbbuf[ARGV_SIZE + 1];
- int ac = 0;
- int i;
+ char *av[ARGV_SIZE];
+ char dbbuf[ARGV_SIZE + 1];
+ int ac = 0;
+ int i;
strncpy(execbuf, Execfile, MAXPATHLEN - 1);
av[ac++] = execbuf;
@@ -1273,11 +1277,11 @@ ExitPostmaster(int status)
static void
dumpstatus(SIGNAL_ARGS)
{
- Dlelem *curr = DLGetHead(PortList);
+ Dlelem *curr = DLGetHead(PortList);
while (curr)
{
- Port *port = DLE_VAL(curr);
+ Port *port = DLE_VAL(curr);
fprintf(stderr, "%s: dumpstatus:\n", progname);
fprintf(stderr, "\tsock %d: nBytes=%d, laddr=0x%lx, raddr=0x%lx\n",
diff --git a/src/backend/regex/engine.c b/src/backend/regex/engine.c
index 6e0e701214..1d86dcc7bd 100644
--- a/src/backend/regex/engine.c
+++ b/src/backend/regex/engine.c
@@ -71,43 +71,43 @@
struct match
{
struct re_guts *g;
- int eflags;
- regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
- char *offp; /* offsets work from here */
- char *beginp; /* start of string -- virtual NUL precedes */
- char *endp; /* end of string -- virtual NUL here */
- char *coldp; /* can be no match starting before here */
- char **lastpos; /* [nplus+1] */
- STATEVARS;
- states st; /* current states */
- states fresh; /* states for a fresh start */
- states tmp; /* temporary */
- states empty; /* empty set of states */
+ int eflags;
+ regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
+ char *offp; /* offsets work from here */
+ char *beginp; /* start of string -- virtual NUL precedes */
+ char *endp; /* end of string -- virtual NUL here */
+ char *coldp; /* can be no match starting before here */
+ char **lastpos; /* [nplus+1] */
+ STATEVARS;
+ states st; /* current states */
+ states fresh; /* states for a fresh start */
+ states tmp; /* temporary */
+ states empty; /* empty set of states */
};
/* ========= begin header generated by ./mkh ========= */
#ifdef __cplusplus
-extern "C"
+extern "C"
{
#endif
/* === engine.c === */
static int
- matcher(struct re_guts * g, char *string, size_t nmatch,
- regmatch_t pmatch[], int eflags);
- static char *
- dissect(struct match * m, char *start, char *stop,
- sopno startst, sopno stopst);
- static char *
- backref(struct match * m, char *start, char *stop,
+ matcher(struct re_guts * g, char *string, size_t nmatch,
+ regmatch_t pmatch[], int eflags);
+ static char *
+ dissect(struct match * m, char *start, char *stop,
+ sopno startst, sopno stopst);
+ static char *
+ backref(struct match * m, char *start, char *stop,
sopno startst, sopno stopst, sopno lev);
- static char *
- fast(struct match * m, char *start, char *stop,
- sopno startst, sopno stopst);
- static char *
- slow(struct match * m, char *start, char *stop, sopno startst, sopno stopst);
- static states
- step(struct re_guts * g, sopno start,
+ static char *
+ fast(struct match * m, char *start, char *stop,
+ sopno startst, sopno stopst);
+ static char *
+ slow(struct match * m, char *start, char *stop, sopno startst, sopno stopst);
+ static states
+ step(struct re_guts * g, sopno start,
sopno stop, states bef, int ch, states aft);
#define BOL (OUT+1)
#define EOL (BOL+1)
@@ -120,16 +120,16 @@ extern "C"
#define NNONCHAR (CODEMAX-CHAR_MAX)
#ifdef REDEBUG
static void
- print(struct match * m, char *caption, states st, int ch, FILE * d);
+ print(struct match * m, char *caption, states st, int ch, FILE * d);
#endif
#ifdef REDEBUG
static void
- at(struct match * m, char *title, char *start, char *stop,
- sopno startst, sopno stopst);
+ at(struct match * m, char *title, char *start, char *stop,
+ sopno startst, sopno stopst);
#endif
#ifdef REDEBUG
- static char *
- pchar(int ch);
+ static char *
+ pchar(int ch);
#endif
#ifdef __cplusplus
@@ -156,20 +156,20 @@ extern "C"
static int /* 0 success, REG_NOMATCH failure */
matcher(g, string, nmatch, pmatch, eflags)
register struct re_guts *g;
-char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
+char *string;
+size_t nmatch;
+regmatch_t pmatch[];
+int eflags;
{
- register char *endp;
- register int i;
- struct match mv;
+ register char *endp;
+ register int i;
+ struct match mv;
register struct match *m = &mv;
- register char *dp;
+ register char *dp;
register const sopno gf = g->firststate + 1; /* +1 for OEND */
register const sopno gl = g->laststate;
- char *start;
- char *stop;
+ char *start;
+ char *stop;
/* simplify the situation where possible */
if (g->cflags & REG_NOSUB)
@@ -336,27 +336,27 @@ int eflags;
== static char *dissect(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* == stop (success) always */
+static char * /* == stop (success) always */
dissect(m, start, stop, startst, stopst)
register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register sopno es; /* end sop of current subRE */
- register char *sp; /* start of string matched by it */
- register char *stp; /* string matched by it cannot pass here */
- register char *rest; /* start of rest of string */
- register char *tail; /* string unmatched by rest of RE */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *sep; /* end of string matched by subsubRE */
- register char *oldssp; /* previous ssp */
- register char *dp;
+ register int i;
+ register sopno ss; /* start sop of current subRE */
+ register sopno es; /* end sop of current subRE */
+ register char *sp; /* start of string matched by it */
+ register char *stp; /* string matched by it cannot pass here */
+ register char *rest; /* start of rest of string */
+ register char *tail; /* string unmatched by rest of RE */
+ register sopno ssub; /* start sop of subsubRE */
+ register sopno esub; /* end sop of subsubRE */
+ register char *ssp; /* start of string matched by subsubRE */
+ register char *sep; /* end of string matched by subsubRE */
+ register char *oldssp; /* previous ssp */
+ register char *dp;
AT("diss", start, stop, startst, stopst);
sp = start;
@@ -366,164 +366,164 @@ sopno stopst;
es = ss;
switch (OP(m->g->strip[es]))
{
- case OPLUS_:
- case OQUEST_:
- es += OPND(m->g->strip[es]);
- break;
- case OCH_:
- while (OP(m->g->strip[es]) != O_CH)
+ case OPLUS_:
+ case OQUEST_:
es += OPND(m->g->strip[es]);
- break;
+ break;
+ case OCH_:
+ while (OP(m->g->strip[es]) != O_CH)
+ es += OPND(m->g->strip[es]);
+ break;
}
es++;
/* figure out what it matched */
switch (OP(m->g->strip[ss]))
{
- case OEND:
- assert(nope);
- break;
- case OCHAR:
- sp++;
- break;
- case OBOL:
- case OEOL:
- case OBOW:
- case OEOW:
- break;
- case OANY:
- case OANYOF:
- sp++;
- break;
- case OBACK_:
- case O_BACK:
- assert(nope);
- break;
- /* cases where length of match is hard to find */
- case OQUEST_:
- stp = stop;
- for (;;)
- {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- /* did innards match? */
- if (slow(m, sp, rest, ssub, esub) != NULL)
- {
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- }
- else
+ case OEND:
+ assert(nope);
+ break;
+ case OCHAR:
+ sp++;
+ break;
+ case OBOL:
+ case OEOL:
+ case OBOW:
+ case OEOW:
+ break;
+ case OANY:
+ case OANYOF:
+ sp++;
+ break;
+ case OBACK_:
+ case O_BACK:
+ assert(nope);
+ break;
+ /* cases where length of match is hard to find */
+ case OQUEST_:
+ stp = stop;
+ for (;;)
+ {
+ /* how long could this one be? */
+ rest = slow(m, sp, stp, ss, es);
+ assert(rest != NULL); /* it did match */
+ /* could the rest match the rest? */
+ tail = slow(m, rest, stop, es, stopst);
+ if (tail == stop)
+ break; /* yes! */
+ /* no -- try a shorter match for this one */
+ stp = rest - 1;
+ assert(stp >= sp); /* it did work */
+ }
+ ssub = ss + 1;
+ esub = es - 1;
+ /* did innards match? */
+ if (slow(m, sp, rest, ssub, esub) != NULL)
+ {
+ dp = dissect(m, sp, rest, ssub, esub);
+ assert(dp == rest);
+ }
+ else
/* no */
- assert(sp == rest);
- sp = rest;
- break;
- case OPLUS_:
- stp = stop;
- for (;;)
- {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = es - 1;
- ssp = sp;
- oldssp = ssp;
- for (;;)
- { /* find last match of innards */
- sep = slow(m, ssp, rest, ssub, esub);
- if (sep == NULL || sep == ssp)
- break; /* failed or matched null */
- oldssp = ssp; /* on to next try */
- ssp = sep;
- }
- if (sep == NULL)
- {
- /* last successful match */
- sep = ssp;
- ssp = oldssp;
- }
- assert(sep == rest);/* must exhaust substring */
- assert(slow(m, ssp, sep, ssub, esub) == rest);
- dp = dissect(m, ssp, sep, ssub, esub);
- assert(dp == sep);
- sp = rest;
- break;
- case OCH_:
- stp = stop;
- for (;;)
- {
- /* how long could this one be? */
- rest = slow(m, sp, stp, ss, es);
- assert(rest != NULL); /* it did match */
- /* could the rest match the rest? */
- tail = slow(m, rest, stop, es, stopst);
- if (tail == stop)
- break; /* yes! */
- /* no -- try a shorter match for this one */
- stp = rest - 1;
- assert(stp >= sp); /* it did work */
- }
- ssub = ss + 1;
- esub = ss + OPND(m->g->strip[ss]) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;)
- { /* find first matching branch */
- if (slow(m, sp, rest, ssub, esub) == rest)
- break; /* it matched all of it */
- /* that one missed, try next one */
+ assert(sp == rest);
+ sp = rest;
+ break;
+ case OPLUS_:
+ stp = stop;
+ for (;;)
+ {
+ /* how long could this one be? */
+ rest = slow(m, sp, stp, ss, es);
+ assert(rest != NULL); /* it did match */
+ /* could the rest match the rest? */
+ tail = slow(m, rest, stop, es, stopst);
+ if (tail == stop)
+ break; /* yes! */
+ /* no -- try a shorter match for this one */
+ stp = rest - 1;
+ assert(stp >= sp); /* it did work */
+ }
+ ssub = ss + 1;
+ esub = es - 1;
+ ssp = sp;
+ oldssp = ssp;
+ for (;;)
+ { /* find last match of innards */
+ sep = slow(m, ssp, rest, ssub, esub);
+ if (sep == NULL || sep == ssp)
+ break; /* failed or matched null */
+ oldssp = ssp; /* on to next try */
+ ssp = sep;
+ }
+ if (sep == NULL)
+ {
+ /* last successful match */
+ sep = ssp;
+ ssp = oldssp;
+ }
+ assert(sep == rest); /* must exhaust substring */
+ assert(slow(m, ssp, sep, ssub, esub) == rest);
+ dp = dissect(m, ssp, sep, ssub, esub);
+ assert(dp == sep);
+ sp = rest;
+ break;
+ case OCH_:
+ stp = stop;
+ for (;;)
+ {
+ /* how long could this one be? */
+ rest = slow(m, sp, stp, ss, es);
+ assert(rest != NULL); /* it did match */
+ /* could the rest match the rest? */
+ tail = slow(m, rest, stop, es, stopst);
+ if (tail == stop)
+ break; /* yes! */
+ /* no -- try a shorter match for this one */
+ stp = rest - 1;
+ assert(stp >= sp); /* it did work */
+ }
+ ssub = ss + 1;
+ esub = ss + OPND(m->g->strip[ss]) - 1;
assert(OP(m->g->strip[esub]) == OOR1);
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- dp = dissect(m, sp, rest, ssub, esub);
- assert(dp == rest);
- sp = rest;
- break;
- case O_PLUS:
- case O_QUEST:
- case OOR1:
- case OOR2:
- case O_CH:
- assert(nope);
- break;
- case OLPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_so = sp - m->offp;
- break;
- case ORPAREN:
- i = OPND(m->g->strip[ss]);
- assert(0 < i && i <= m->g->nsub);
- m->pmatch[i].rm_eo = sp - m->offp;
- break;
- default: /* uh oh */
- assert(nope);
- break;
+ for (;;)
+ { /* find first matching branch */
+ if (slow(m, sp, rest, ssub, esub) == rest)
+ break; /* it matched all of it */
+ /* that one missed, try next one */
+ assert(OP(m->g->strip[esub]) == OOR1);
+ esub++;
+ assert(OP(m->g->strip[esub]) == OOR2);
+ ssub = esub + 1;
+ esub += OPND(m->g->strip[esub]);
+ if (OP(m->g->strip[esub]) == OOR2)
+ esub--;
+ else
+ assert(OP(m->g->strip[esub]) == O_CH);
+ }
+ dp = dissect(m, sp, rest, ssub, esub);
+ assert(dp == rest);
+ sp = rest;
+ break;
+ case O_PLUS:
+ case O_QUEST:
+ case OOR1:
+ case OOR2:
+ case O_CH:
+ assert(nope);
+ break;
+ case OLPAREN:
+ i = OPND(m->g->strip[ss]);
+ assert(0 < i && i <= m->g->nsub);
+ m->pmatch[i].rm_so = sp - m->offp;
+ break;
+ case ORPAREN:
+ i = OPND(m->g->strip[ss]);
+ assert(0 < i && i <= m->g->nsub);
+ m->pmatch[i].rm_eo = sp - m->offp;
+ break;
+ default: /* uh oh */
+ assert(nope);
+ break;
}
}
@@ -536,27 +536,27 @@ sopno stopst;
== static char *backref(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst, sopno lev);
*/
-static char * /* == stop (success) or NULL (failure) */
+static char * /* == stop (success) or NULL (failure) */
backref(m, start, stop, startst, stopst, lev)
register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-sopno lev; /* PLUS nesting level */
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
+sopno lev; /* PLUS nesting level */
{
- register int i;
- register sopno ss; /* start sop of current subRE */
- register char *sp; /* start of string matched by it */
- register sopno ssub; /* start sop of subsubRE */
- register sopno esub; /* end sop of subsubRE */
- register char *ssp; /* start of string matched by subsubRE */
- register char *dp;
+ register int i;
+ register sopno ss; /* start sop of current subRE */
+ register char *sp; /* start of string matched by it */
+ register sopno ssub; /* start sop of subsubRE */
+ register sopno esub; /* end sop of subsubRE */
+ register char *ssp; /* start of string matched by subsubRE */
+ register char *dp;
register size_t len;
- register int hard;
- register sop s;
+ register int hard;
+ register sop s;
register regoff_t offsave;
- register cset *cs;
+ register cset *cs;
AT("back", start, stop, startst, stopst);
sp = start;
@@ -566,76 +566,76 @@ sopno lev; /* PLUS nesting level */
for (ss = startst; !hard && ss < stopst; ss++)
switch (OP(s = m->g->strip[ss]))
{
- case OCHAR:
- if (sp == stop || *sp++ != (char) OPND(s))
- return (NULL);
- break;
- case OANY:
- if (sp == stop)
- return (NULL);
- sp++;
- break;
- case OANYOF:
- cs = &m->g->sets[OPND(s)];
- if (sp == stop || !CHIN(cs, *sp++))
- return (NULL);
- break;
- case OBOL:
- if ((sp == m->beginp && !(m->eflags & REG_NOTBOL)) ||
- (sp < m->endp && *(sp - 1) == '\n' &&
- (m->g->cflags & REG_NEWLINE)))
- { /* yes */
- }
- else
- return (NULL);
- break;
- case OEOL:
- if ((sp == m->endp && !(m->eflags & REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags & REG_NEWLINE)))
- { /* yes */
- }
- else
- return (NULL);
- break;
- case OBOW:
- if (((sp == m->beginp && !(m->eflags & REG_NOTBOL)) ||
- (sp < m->endp && *(sp - 1) == '\n' &&
- (m->g->cflags & REG_NEWLINE)) ||
- (sp > m->beginp &&
- !ISWORD(*(sp - 1)))) &&
- (sp < m->endp && ISWORD(*sp)))
- { /* yes */
- }
- else
- return (NULL);
- break;
- case OEOW:
- if (((sp == m->endp && !(m->eflags & REG_NOTEOL)) ||
- (sp < m->endp && *sp == '\n' &&
- (m->g->cflags & REG_NEWLINE)) ||
- (sp < m->endp && !ISWORD(*sp))) &&
- (sp > m->beginp && ISWORD(*(sp - 1))))
- { /* yes */
- }
- else
- return (NULL);
- break;
- case O_QUEST:
- break;
- case OOR1: /* matches null but needs to skip */
- ss++;
- s = m->g->strip[ss];
- do
- {
- assert(OP(s) == OOR2);
- ss += OPND(s);
- } while (OP(s = m->g->strip[ss]) != O_CH);
- /* note that the ss++ gets us past the O_CH */
- break;
- default: /* have to make a choice */
- hard = 1;
- break;
+ case OCHAR:
+ if (sp == stop || *sp++ != (char) OPND(s))
+ return (NULL);
+ break;
+ case OANY:
+ if (sp == stop)
+ return (NULL);
+ sp++;
+ break;
+ case OANYOF:
+ cs = &m->g->sets[OPND(s)];
+ if (sp == stop || !CHIN(cs, *sp++))
+ return (NULL);
+ break;
+ case OBOL:
+ if ((sp == m->beginp && !(m->eflags & REG_NOTBOL)) ||
+ (sp < m->endp && *(sp - 1) == '\n' &&
+ (m->g->cflags & REG_NEWLINE)))
+ { /* yes */
+ }
+ else
+ return (NULL);
+ break;
+ case OEOL:
+ if ((sp == m->endp && !(m->eflags & REG_NOTEOL)) ||
+ (sp < m->endp && *sp == '\n' &&
+ (m->g->cflags & REG_NEWLINE)))
+ { /* yes */
+ }
+ else
+ return (NULL);
+ break;
+ case OBOW:
+ if (((sp == m->beginp && !(m->eflags & REG_NOTBOL)) ||
+ (sp < m->endp && *(sp - 1) == '\n' &&
+ (m->g->cflags & REG_NEWLINE)) ||
+ (sp > m->beginp &&
+ !ISWORD(*(sp - 1)))) &&
+ (sp < m->endp && ISWORD(*sp)))
+ { /* yes */
+ }
+ else
+ return (NULL);
+ break;
+ case OEOW:
+ if (((sp == m->endp && !(m->eflags & REG_NOTEOL)) ||
+ (sp < m->endp && *sp == '\n' &&
+ (m->g->cflags & REG_NEWLINE)) ||
+ (sp < m->endp && !ISWORD(*sp))) &&
+ (sp > m->beginp && ISWORD(*(sp - 1))))
+ { /* yes */
+ }
+ else
+ return (NULL);
+ break;
+ case O_QUEST:
+ break;
+ case OOR1: /* matches null but needs to skip */
+ ss++;
+ s = m->g->strip[ss];
+ do
+ {
+ assert(OP(s) == OOR2);
+ ss += OPND(s);
+ } while (OP(s = m->g->strip[ss]) != O_CH);
+ /* note that the ss++ gets us past the O_CH */
+ break;
+ default: /* have to make a choice */
+ hard = 1;
+ break;
}
if (!hard)
{ /* that was it! */
@@ -650,93 +650,93 @@ sopno lev; /* PLUS nesting level */
s = m->g->strip[ss];
switch (OP(s))
{
- case OBACK_: /* the vilest depths */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- if (m->pmatch[i].rm_eo == -1)
- return (NULL);
- assert(m->pmatch[i].rm_so != -1);
- len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
- assert(stop - m->beginp >= len);
- if (sp > stop - len)
- return (NULL); /* not enough left to match */
- ssp = m->offp + m->pmatch[i].rm_so;
- if (memcmp(sp, ssp, len) != 0)
+ case OBACK_: /* the vilest depths */
+ i = OPND(s);
+ assert(0 < i && i <= m->g->nsub);
+ if (m->pmatch[i].rm_eo == -1)
+ return (NULL);
+ assert(m->pmatch[i].rm_so != -1);
+ len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
+ assert(stop - m->beginp >= len);
+ if (sp > stop - len)
+ return (NULL); /* not enough left to match */
+ ssp = m->offp + m->pmatch[i].rm_so;
+ if (memcmp(sp, ssp, len) != 0)
+ return (NULL);
+ while (m->g->strip[ss] != SOP(O_BACK, i))
+ ss++;
+ return (backref(m, sp + len, stop, ss + 1, stopst, lev));
+ break;
+ case OQUEST_: /* to null or not */
+ dp = backref(m, sp, stop, ss + 1, stopst, lev);
+ if (dp != NULL)
+ return (dp); /* not */
+ return (backref(m, sp, stop, ss + OPND(s) + 1, stopst, lev));
+ break;
+ case OPLUS_:
+ assert(m->lastpos != NULL);
+ assert(lev + 1 <= m->g->nplus);
+ m->lastpos[lev + 1] = sp;
+ return (backref(m, sp, stop, ss + 1, stopst, lev + 1));
+ break;
+ case O_PLUS:
+ if (sp == m->lastpos[lev]) /* last pass matched null */
+ return (backref(m, sp, stop, ss + 1, stopst, lev - 1));
+ /* try another pass */
+ m->lastpos[lev] = sp;
+ dp = backref(m, sp, stop, ss - OPND(s) + 1, stopst, lev);
+ if (dp == NULL)
+ return (backref(m, sp, stop, ss + 1, stopst, lev - 1));
+ else
+ return (dp);
+ break;
+ case OCH_: /* find the right one, if any */
+ ssub = ss + 1;
+ esub = ss + OPND(s) - 1;
+ assert(OP(m->g->strip[esub]) == OOR1);
+ for (;;)
+ { /* find first matching branch */
+ dp = backref(m, sp, stop, ssub, esub, lev);
+ if (dp != NULL)
+ return (dp);
+ /* that one missed, try next one */
+ if (OP(m->g->strip[esub]) == O_CH)
+ return (NULL); /* there is none */
+ esub++;
+ assert(OP(m->g->strip[esub]) == OOR2);
+ ssub = esub + 1;
+ esub += OPND(m->g->strip[esub]);
+ if (OP(m->g->strip[esub]) == OOR2)
+ esub--;
+ else
+ assert(OP(m->g->strip[esub]) == O_CH);
+ }
+ break;
+ case OLPAREN: /* must undo assignment if rest fails */
+ i = OPND(s);
+ assert(0 < i && i <= m->g->nsub);
+ offsave = m->pmatch[i].rm_so;
+ m->pmatch[i].rm_so = sp - m->offp;
+ dp = backref(m, sp, stop, ss + 1, stopst, lev);
+ if (dp != NULL)
+ return (dp);
+ m->pmatch[i].rm_so = offsave;
return (NULL);
- while (m->g->strip[ss] != SOP(O_BACK, i))
- ss++;
- return (backref(m, sp + len, stop, ss + 1, stopst, lev));
- break;
- case OQUEST_: /* to null or not */
- dp = backref(m, sp, stop, ss + 1, stopst, lev);
- if (dp != NULL)
- return (dp); /* not */
- return (backref(m, sp, stop, ss + OPND(s) + 1, stopst, lev));
- break;
- case OPLUS_:
- assert(m->lastpos != NULL);
- assert(lev + 1 <= m->g->nplus);
- m->lastpos[lev + 1] = sp;
- return (backref(m, sp, stop, ss + 1, stopst, lev + 1));
- break;
- case O_PLUS:
- if (sp == m->lastpos[lev]) /* last pass matched null */
- return (backref(m, sp, stop, ss + 1, stopst, lev - 1));
- /* try another pass */
- m->lastpos[lev] = sp;
- dp = backref(m, sp, stop, ss - OPND(s) + 1, stopst, lev);
- if (dp == NULL)
- return (backref(m, sp, stop, ss + 1, stopst, lev - 1));
- else
- return (dp);
- break;
- case OCH_: /* find the right one, if any */
- ssub = ss + 1;
- esub = ss + OPND(s) - 1;
- assert(OP(m->g->strip[esub]) == OOR1);
- for (;;)
- { /* find first matching branch */
- dp = backref(m, sp, stop, ssub, esub, lev);
+ break;
+ case ORPAREN: /* must undo assignment if rest fails */
+ i = OPND(s);
+ assert(0 < i && i <= m->g->nsub);
+ offsave = m->pmatch[i].rm_eo;
+ m->pmatch[i].rm_eo = sp - m->offp;
+ dp = backref(m, sp, stop, ss + 1, stopst, lev);
if (dp != NULL)
return (dp);
- /* that one missed, try next one */
- if (OP(m->g->strip[esub]) == O_CH)
- return (NULL); /* there is none */
- esub++;
- assert(OP(m->g->strip[esub]) == OOR2);
- ssub = esub + 1;
- esub += OPND(m->g->strip[esub]);
- if (OP(m->g->strip[esub]) == OOR2)
- esub--;
- else
- assert(OP(m->g->strip[esub]) == O_CH);
- }
- break;
- case OLPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_so;
- m->pmatch[i].rm_so = sp - m->offp;
- dp = backref(m, sp, stop, ss + 1, stopst, lev);
- if (dp != NULL)
- return (dp);
- m->pmatch[i].rm_so = offsave;
- return (NULL);
- break;
- case ORPAREN: /* must undo assignment if rest fails */
- i = OPND(s);
- assert(0 < i && i <= m->g->nsub);
- offsave = m->pmatch[i].rm_eo;
- m->pmatch[i].rm_eo = sp - m->offp;
- dp = backref(m, sp, stop, ss + 1, stopst, lev);
- if (dp != NULL)
- return (dp);
- m->pmatch[i].rm_eo = offsave;
- return (NULL);
- break;
- default: /* uh oh */
- assert(nope);
- break;
+ m->pmatch[i].rm_eo = offsave;
+ return (NULL);
+ break;
+ default: /* uh oh */
+ assert(nope);
+ break;
}
/* "can't happen" */
@@ -750,23 +750,23 @@ sopno lev; /* PLUS nesting level */
== static char *fast(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* where tentative match ended, or NULL */
+static char * /* where tentative match ended, or NULL */
fast(m, start, stop, startst, stopst)
register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
{
register states st = m->st;
register states fresh = m->fresh;
register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start - 1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *coldp; /* last p after which no match was
+ register char *p = start;
+ register int c = (start == m->beginp) ? OUT : *(start - 1);
+ register int lastc; /* previous c */
+ register int flagch;
+ register int i;
+ register char *coldp; /* last p after which no match was
* underway */
CLEAR(st);
@@ -849,23 +849,23 @@ sopno stopst;
== static char *slow(register struct match *m, char *start, \
== char *stop, sopno startst, sopno stopst);
*/
-static char * /* where it ended */
+static char * /* where it ended */
slow(m, start, stop, startst, stopst)
register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
{
register states st = m->st;
register states empty = m->empty;
register states tmp = m->tmp;
- register char *p = start;
- register int c = (start == m->beginp) ? OUT : *(start - 1);
- register int lastc; /* previous c */
- register int flagch;
- register int i;
- register char *matchp; /* last p at which a match ended */
+ register char *p = start;
+ register int c = (start == m->beginp) ? OUT : *(start - 1);
+ register int lastc; /* previous c */
+ register int flagch;
+ register int i;
+ register char *matchp; /* last p at which a match ended */
AT("slow", start, stop, startst, stopst);
CLEAR(st);
@@ -952,119 +952,119 @@ sopno stopst;
== #define NONCHAR(c) ((c) > CHAR_MAX)
== #define NNONCHAR (CODEMAX-CHAR_MAX)
*/
-static states
+static states
step(g, start, stop, bef, ch, aft)
register struct re_guts *g;
-sopno start; /* start state within strip */
-sopno stop; /* state after stop state within strip */
+sopno start; /* start state within strip */
+sopno stop; /* state after stop state within strip */
register states bef; /* states reachable before */
-int ch; /* character or NONCHAR code */
+int ch; /* character or NONCHAR code */
register states aft; /* states already known reachable after */
{
- register cset *cs;
- register sop s;
- register sopno pc;
+ register cset *cs;
+ register sop s;
+ register sopno pc;
register onestate here; /* note, macros know this name */
- register sopno look;
- register int i;
+ register sopno look;
+ register int i;
for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here))
{
s = g->strip[pc];
switch (OP(s))
{
- case OEND:
- assert(pc == stop - 1);
- break;
- case OCHAR:
- /* only characters can match */
- assert(!NONCHAR(ch) || ch != (char) OPND(s));
- if (ch == (char) OPND(s))
- FWD(aft, bef, 1);
- break;
- case OBOL:
- if (ch == BOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OEOL:
- if (ch == EOL || ch == BOLEOL)
- FWD(aft, bef, 1);
- break;
- case OBOW:
- if (ch == BOW)
- FWD(aft, bef, 1);
- break;
- case OEOW:
- if (ch == EOW)
- FWD(aft, bef, 1);
- break;
- case OANY:
- if (!NONCHAR(ch))
- FWD(aft, bef, 1);
- break;
- case OANYOF:
- cs = &g->sets[OPND(s)];
- if (!NONCHAR(ch) && CHIN(cs, ch))
- FWD(aft, bef, 1);
- break;
- case OBACK_: /* ignored here */
- case O_BACK:
- FWD(aft, aft, 1);
- break;
- case OPLUS_: /* forward, this is just an empty */
- FWD(aft, aft, 1);
- break;
- case O_PLUS: /* both forward and back */
- FWD(aft, aft, 1);
- i = ISSETBACK(aft, OPND(s));
- BACK(aft, aft, OPND(s));
- if (!i && ISSETBACK(aft, OPND(s)))
- {
- /* oho, must reconsider loop body */
- pc -= OPND(s) + 1;
- INIT(here, pc);
- }
- break;
- case OQUEST_: /* two branches, both forward */
- FWD(aft, aft, 1);
- FWD(aft, aft, OPND(s));
- break;
- case O_QUEST: /* just an empty */
- FWD(aft, aft, 1);
- break;
- case OLPAREN: /* not significant here */
- case ORPAREN:
- FWD(aft, aft, 1);
- break;
- case OCH_: /* mark the first two branches */
- FWD(aft, aft, 1);
- assert(OP(g->strip[pc + OPND(s)]) == OOR2);
- FWD(aft, aft, OPND(s));
- break;
- case OOR1: /* done a branch, find the O_CH */
- if (ISSTATEIN(aft, here))
- {
- for (look = 1;
- OP(s = g->strip[pc + look]) != O_CH;
- look += OPND(s))
- assert(OP(s) == OOR2);
- FWD(aft, aft, look);
- }
- break;
- case OOR2: /* propagate OCH_'s marking */
- FWD(aft, aft, 1);
- if (OP(g->strip[pc + OPND(s)]) != O_CH)
- {
+ case OEND:
+ assert(pc == stop - 1);
+ break;
+ case OCHAR:
+ /* only characters can match */
+ assert(!NONCHAR(ch) || ch != (char) OPND(s));
+ if (ch == (char) OPND(s))
+ FWD(aft, bef, 1);
+ break;
+ case OBOL:
+ if (ch == BOL || ch == BOLEOL)
+ FWD(aft, bef, 1);
+ break;
+ case OEOL:
+ if (ch == EOL || ch == BOLEOL)
+ FWD(aft, bef, 1);
+ break;
+ case OBOW:
+ if (ch == BOW)
+ FWD(aft, bef, 1);
+ break;
+ case OEOW:
+ if (ch == EOW)
+ FWD(aft, bef, 1);
+ break;
+ case OANY:
+ if (!NONCHAR(ch))
+ FWD(aft, bef, 1);
+ break;
+ case OANYOF:
+ cs = &g->sets[OPND(s)];
+ if (!NONCHAR(ch) && CHIN(cs, ch))
+ FWD(aft, bef, 1);
+ break;
+ case OBACK_: /* ignored here */
+ case O_BACK:
+ FWD(aft, aft, 1);
+ break;
+ case OPLUS_: /* forward, this is just an empty */
+ FWD(aft, aft, 1);
+ break;
+ case O_PLUS: /* both forward and back */
+ FWD(aft, aft, 1);
+ i = ISSETBACK(aft, OPND(s));
+ BACK(aft, aft, OPND(s));
+ if (!i && ISSETBACK(aft, OPND(s)))
+ {
+ /* oho, must reconsider loop body */
+ pc -= OPND(s) + 1;
+ INIT(here, pc);
+ }
+ break;
+ case OQUEST_: /* two branches, both forward */
+ FWD(aft, aft, 1);
+ FWD(aft, aft, OPND(s));
+ break;
+ case O_QUEST: /* just an empty */
+ FWD(aft, aft, 1);
+ break;
+ case OLPAREN: /* not significant here */
+ case ORPAREN:
+ FWD(aft, aft, 1);
+ break;
+ case OCH_: /* mark the first two branches */
+ FWD(aft, aft, 1);
assert(OP(g->strip[pc + OPND(s)]) == OOR2);
FWD(aft, aft, OPND(s));
- }
- break;
- case O_CH: /* just empty */
- FWD(aft, aft, 1);
- break;
- default: /* ooooops... */
- assert(nope);
- break;
+ break;
+ case OOR1: /* done a branch, find the O_CH */
+ if (ISSTATEIN(aft, here))
+ {
+ for (look = 1;
+ OP(s = g->strip[pc + look]) != O_CH;
+ look += OPND(s))
+ assert(OP(s) == OOR2);
+ FWD(aft, aft, look);
+ }
+ break;
+ case OOR2: /* propagate OCH_'s marking */
+ FWD(aft, aft, 1);
+ if (OP(g->strip[pc + OPND(s)]) != O_CH)
+ {
+ assert(OP(g->strip[pc + OPND(s)]) == OOR2);
+ FWD(aft, aft, OPND(s));
+ }
+ break;
+ case O_CH: /* just empty */
+ FWD(aft, aft, 1);
+ break;
+ default: /* ooooops... */
+ assert(nope);
+ break;
}
}
@@ -1081,15 +1081,15 @@ register states aft; /* states already known reachable after */
*/
static void
print(m, caption, st, ch, d)
-struct match *m;
-char *caption;
-states st;
-int ch;
-FILE *d;
+struct match *m;
+char *caption;
+states st;
+int ch;
+FILE *d;
{
register struct re_guts *g = m->g;
- register int i;
- register int first = 1;
+ register int i;
+ register int first = 1;
if (!(m->eflags & REG_TRACE))
return;
@@ -1115,12 +1115,12 @@ FILE *d;
*/
static void
at(m, title, start, stop, startst, stopst)
-struct match *m;
-char *title;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
+struct match *m;
+char *title;
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
{
if (!(m->eflags & REG_TRACE))
return;
@@ -1143,11 +1143,11 @@ sopno stopst;
* a matching debug.o, and this is convenient. It all disappears in
* the non-debug compilation anyway, so it doesn't matter much.
*/
-static char * /* -> representation */
+static char * /* -> representation */
pchar(ch)
-int ch;
+int ch;
{
- static char pbuf[10];
+ static char pbuf[10];
if (isprint(ch) || ch == ' ')
sprintf(pbuf, "%c", ch);
diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c
index dcb95173c0..da4f2020ce 100644
--- a/src/backend/regex/regcomp.c
+++ b/src/backend/regex/regcomp.c
@@ -38,7 +38,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94";
+static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94";
#endif /* LIBC_SCCS and not lint */
@@ -62,64 +62,64 @@ static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94";
*/
struct parse
{
- char *next; /* next character in RE */
- char *end; /* end of string (-> NUL normally) */
- int error; /* has an error been seen? */
- sop *strip; /* malloced strip */
- sopno ssize; /* malloced strip size (allocated) */
- sopno slen; /* malloced strip length (used) */
- int ncsalloc; /* number of csets allocated */
+ char *next; /* next character in RE */
+ char *end; /* end of string (-> NUL normally) */
+ int error; /* has an error been seen? */
+ sop *strip; /* malloced strip */
+ sopno ssize; /* malloced strip size (allocated) */
+ sopno slen; /* malloced strip length (used) */
+ int ncsalloc; /* number of csets allocated */
struct re_guts *g;
#define NPAREN 10 /* we need to remember () 1-9 for back
* refs */
- sopno pbegin[NPAREN]; /* -> ( ([0] unused) */
- sopno pend[NPAREN]; /* -> ) ([0] unused) */
+ sopno pbegin[NPAREN]; /* -> ( ([0] unused) */
+ sopno pend[NPAREN]; /* -> ) ([0] unused) */
};
/* ========= begin header generated by ./mkh ========= */
#ifdef __cplusplus
-extern "C"
+extern "C"
{
#endif
/* === regcomp.c === */
- static void p_ere(struct parse * p, int stop);
- static void p_ere_exp(struct parse * p);
- static void p_str(struct parse * p);
- static void p_bre(struct parse * p, int end1, int end2);
- static int p_simp_re(struct parse * p, int starordinary);
- static int p_count(struct parse * p);
- static void p_bracket(struct parse * p);
- static void p_b_term(struct parse * p, cset * cs);
- static void p_b_cclass(struct parse * p, cset * cs);
- static void p_b_eclass(struct parse * p, cset * cs);
- static char p_b_symbol(struct parse * p);
- static char p_b_coll_elem(struct parse * p, int endc);
- static char othercase(int ch);
- static void bothcases(struct parse * p, int ch);
- static void ordinary(struct parse * p, int ch);
- static void nonnewline(struct parse * p);
- static void repeat(struct parse * p, sopno start, int from, int to);
- static int seterr(struct parse * p, int e);
- static cset *allocset(struct parse * p);
- static void freeset(struct parse * p, cset * cs);
- static int freezeset(struct parse * p, cset * cs);
- static int firstch(struct parse * p, cset * cs);
- static int nch(struct parse * p, cset * cs);
- static void mcadd(struct parse * p, cset * cs, char *cp);
- static void mcinvert(struct parse * p, cset * cs);
- static void mccase(struct parse * p, cset * cs);
- static int isinsets(struct re_guts * g, int c);
- static int samesets(struct re_guts * g, int c1, int c2);
- static void categorize(struct parse * p, struct re_guts * g);
- static sopno dupl(struct parse * p, sopno start, sopno finish);
- static void doemit(struct parse * p, sop op, size_t opnd);
- static void doinsert(struct parse * p, sop op, size_t opnd, sopno pos);
- static void dofwd(struct parse * p, sopno pos, sop value);
- static void enlarge(struct parse * p, sopno size);
- static void stripsnug(struct parse * p, struct re_guts * g);
- static void findmust(struct parse * p, struct re_guts * g);
- static sopno pluscount(struct parse * p, struct re_guts * g);
+ static void p_ere(struct parse * p, int stop);
+ static void p_ere_exp(struct parse * p);
+ static void p_str(struct parse * p);
+ static void p_bre(struct parse * p, int end1, int end2);
+ static int p_simp_re(struct parse * p, int starordinary);
+ static int p_count(struct parse * p);
+ static void p_bracket(struct parse * p);
+ static void p_b_term(struct parse * p, cset * cs);
+ static void p_b_cclass(struct parse * p, cset * cs);
+ static void p_b_eclass(struct parse * p, cset * cs);
+ static char p_b_symbol(struct parse * p);
+ static char p_b_coll_elem(struct parse * p, int endc);
+ static char othercase(int ch);
+ static void bothcases(struct parse * p, int ch);
+ static void ordinary(struct parse * p, int ch);
+ static void nonnewline(struct parse * p);
+ static void repeat(struct parse * p, sopno start, int from, int to);
+ static int seterr(struct parse * p, int e);
+ static cset *allocset(struct parse * p);
+ static void freeset(struct parse * p, cset * cs);
+ static int freezeset(struct parse * p, cset * cs);
+ static int firstch(struct parse * p, cset * cs);
+ static int nch(struct parse * p, cset * cs);
+ static void mcadd(struct parse * p, cset * cs, char *cp);
+ static void mcinvert(struct parse * p, cset * cs);
+ static void mccase(struct parse * p, cset * cs);
+ static int isinsets(struct re_guts * g, int c);
+ static int samesets(struct re_guts * g, int c1, int c2);
+ static void categorize(struct parse * p, struct re_guts * g);
+ static sopno dupl(struct parse * p, sopno start, sopno finish);
+ static void doemit(struct parse * p, sop op, size_t opnd);
+ static void doinsert(struct parse * p, sop op, size_t opnd, sopno pos);
+ static void dofwd(struct parse * p, sopno pos, sop value);
+ static void enlarge(struct parse * p, sopno size);
+ static void stripsnug(struct parse * p, struct re_guts * g);
+ static void findmust(struct parse * p, struct re_guts * g);
+ static sopno pluscount(struct parse * p, struct re_guts * g);
#ifdef __cplusplus
}
@@ -127,7 +127,7 @@ extern "C"
#endif
/* ========= end header generated by ./mkh ========= */
-static char nuls[10]; /* place to point scanner in event of
+static char nuls[10]; /* place to point scanner in event of
* error */
/*
@@ -161,7 +161,7 @@ static char nuls[10]; /* place to point scanner in event of
#define DROP(n) (p->slen -= (n))
#ifndef NDEBUG
-static int never = 0; /* for use in asserts; shuts lint up */
+static int never = 0; /* for use in asserts; shuts lint up */
#else
#define never 0 /* some <assert.h>s have bugs too */
@@ -181,14 +181,14 @@ static int never = 0; /* for use in asserts; shuts lint up */
*/
int /* 0 success, otherwise REG_something */
pg95_regcomp(preg, pattern, cflags)
-regex_t *preg;
-const char *pattern;
-int cflags;
+regex_t *preg;
+const char *pattern;
+int cflags;
{
- struct parse pa;
+ struct parse pa;
register struct re_guts *g;
register struct parse *p = &pa;
- register int i;
+ register int i;
register size_t len;
#ifdef REDEBUG
@@ -292,13 +292,13 @@ int cflags;
static void
p_ere(p, stop)
register struct parse *p;
-int stop; /* character this ERE should end at */
+int stop; /* character this ERE should end at */
{
- register char c;
- register sopno prevback = 0;
- register sopno prevfwd = 0;
- register sopno conc;
- register int first = 1; /* is this the first alternative? */
+ register char c;
+ register sopno prevback = 0;
+ register sopno prevfwd = 0;
+ register sopno conc;
+ register int first = 1; /* is this the first alternative? */
for (;;)
{
@@ -342,12 +342,12 @@ static void
p_ere_exp(p)
register struct parse *p;
{
- register char c;
- register sopno pos;
- register int count;
- register int count2;
- register sopno subno;
- int wascaret = 0;
+ register char c;
+ register sopno pos;
+ register int count;
+ register int count2;
+ register sopno subno;
+ int wascaret = 0;
assert(MORE()); /* caller should have ensured this */
c = GETNEXT();
@@ -355,75 +355,76 @@ register struct parse *p;
pos = HERE();
switch (c)
{
- case '(':
- REQUIRE(MORE(), REG_EPAREN);
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- if (!SEE(')'))
- p_ere(p, ')');
- if (subno < NPAREN)
- {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- MUSTEAT(')', REG_EPAREN);
- break;
+ case '(':
+ REQUIRE(MORE(), REG_EPAREN);
+ p->g->nsub++;
+ subno = p->g->nsub;
+ if (subno < NPAREN)
+ p->pbegin[subno] = HERE();
+ EMIT(OLPAREN, subno);
+ if (!SEE(')'))
+ p_ere(p, ')');
+ if (subno < NPAREN)
+ {
+ p->pend[subno] = HERE();
+ assert(p->pend[subno] != 0);
+ }
+ EMIT(ORPAREN, subno);
+ MUSTEAT(')', REG_EPAREN);
+ break;
#ifndef POSIX_MISTAKE
- case ')': /* happens only if no current unmatched ( */
-
- /*
- * You may ask, why the ifndef? Because I didn't notice this
- * until slightly too late for 1003.2, and none of the other
- * 1003.2 regular-expression reviewers noticed it at all. So an
- * unmatched ) is legal POSIX, at least until we can get it fixed.
- */
- SETERROR(REG_EPAREN);
- break;
+ case ')': /* happens only if no current unmatched ( */
+
+ /*
+ * You may ask, why the ifndef? Because I didn't notice this
+ * until slightly too late for 1003.2, and none of the other
+ * 1003.2 regular-expression reviewers noticed it at all. So
+ * an unmatched ) is legal POSIX, at least until we can get it
+ * fixed.
+ */
+ SETERROR(REG_EPAREN);
+ break;
#endif
- case '^':
- EMIT(OBOL, 0);
- p->g->iflags |= USEBOL;
- p->g->nbol++;
- wascaret = 1;
- break;
- case '$':
- EMIT(OEOL, 0);
- p->g->iflags |= USEEOL;
- p->g->neol++;
- break;
- case '|':
- SETERROR(REG_EMPTY);
- break;
- case '*':
- case '+':
- case '?':
- SETERROR(REG_BADRPT);
- break;
- case '.':
- if (p->g->cflags & REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case '\\':
- REQUIRE(MORE(), REG_EESCAPE);
- c = GETNEXT();
- ordinary(p, c);
- break;
- case '{': /* okay as ordinary except if digit
+ case '^':
+ EMIT(OBOL, 0);
+ p->g->iflags |= USEBOL;
+ p->g->nbol++;
+ wascaret = 1;
+ break;
+ case '$':
+ EMIT(OEOL, 0);
+ p->g->iflags |= USEEOL;
+ p->g->neol++;
+ break;
+ case '|':
+ SETERROR(REG_EMPTY);
+ break;
+ case '*':
+ case '+':
+ case '?':
+ SETERROR(REG_BADRPT);
+ break;
+ case '.':
+ if (p->g->cflags & REG_NEWLINE)
+ nonnewline(p);
+ else
+ EMIT(OANY, 0);
+ break;
+ case '[':
+ p_bracket(p);
+ break;
+ case '\\':
+ REQUIRE(MORE(), REG_EESCAPE);
+ c = GETNEXT();
+ ordinary(p, c);
+ break;
+ case '{': /* okay as ordinary except if digit
* follows */
- REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c);
- break;
+ REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
+ /* FALLTHROUGH */
+ default:
+ ordinary(p, c);
+ break;
}
if (!MORE())
@@ -438,51 +439,51 @@ register struct parse *p;
REQUIRE(!wascaret, REG_BADRPT);
switch (c)
{
- case '*': /* implemented as +? */
- /* this case does not require the (y|) trick, noKLUDGE */
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- INSERT(OQUEST_, pos);
- ASTERN(O_QUEST, pos);
- break;
- case '+':
- INSERT(OPLUS_, pos);
- ASTERN(O_PLUS, pos);
- break;
- case '?':
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, pos); /* offset slightly wrong */
- ASTERN(OOR1, pos); /* this one's right */
- AHEAD(pos); /* fix the OCH_ */
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- break;
- case '{':
- count = p_count(p);
- if (EAT(','))
- {
- if (isdigit(PEEK()))
+ case '*': /* implemented as +? */
+ /* this case does not require the (y|) trick, noKLUDGE */
+ INSERT(OPLUS_, pos);
+ ASTERN(O_PLUS, pos);
+ INSERT(OQUEST_, pos);
+ ASTERN(O_QUEST, pos);
+ break;
+ case '+':
+ INSERT(OPLUS_, pos);
+ ASTERN(O_PLUS, pos);
+ break;
+ case '?':
+ /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
+ INSERT(OCH_, pos); /* offset slightly wrong */
+ ASTERN(OOR1, pos); /* this one's right */
+ AHEAD(pos); /* fix the OCH_ */
+ EMIT(OOR2, 0); /* offset very wrong... */
+ AHEAD(THERE()); /* ...so fix it */
+ ASTERN(O_CH, THERETHERE());
+ break;
+ case '{':
+ count = p_count(p);
+ if (EAT(','))
{
- count2 = p_count(p);
- REQUIRE(count <= count2, REG_BADBR);
+ if (isdigit(PEEK()))
+ {
+ count2 = p_count(p);
+ REQUIRE(count <= count2, REG_BADBR);
+ }
+ else
+/* single number with comma */
+ count2 = INFINITY;
}
else
-/* single number with comma */
- count2 = INFINITY;
- }
- else
/* just a single number */
- count2 = count;
- repeat(p, pos, count, count2);
- if (!EAT('}'))
- { /* error heuristics */
- while (MORE() && PEEK() != '}')
- NEXT();
- REQUIRE(MORE(), REG_EBRACE);
- SETERROR(REG_BADBR);
- }
- break;
+ count2 = count;
+ repeat(p, pos, count, count2);
+ if (!EAT('}'))
+ { /* error heuristics */
+ while (MORE() && PEEK() != '}')
+ NEXT();
+ REQUIRE(MORE(), REG_EBRACE);
+ SETERROR(REG_BADBR);
+ }
+ break;
}
if (!MORE())
@@ -522,12 +523,12 @@ register struct parse *p;
static void
p_bre(p, end1, end2)
register struct parse *p;
-register int end1; /* first terminating character */
-register int end2; /* second terminating character */
+register int end1; /* first terminating character */
+register int end2; /* second terminating character */
{
- register sopno start = HERE();
- register int first = 1; /* first subexpression? */
- register int wasdollar = 0;
+ register sopno start = HERE();
+ register int first = 1; /* first subexpression? */
+ register int wasdollar = 0;
if (EAT('^'))
{
@@ -558,14 +559,14 @@ register int end2; /* second terminating character */
static int /* was the simple RE an unbackslashed $? */
p_simp_re(p, starordinary)
register struct parse *p;
-int starordinary; /* is a leading * an ordinary character? */
+int starordinary; /* is a leading * an ordinary character? */
{
- register int c;
- register int count;
- register int count2;
- register sopno pos;
- register int i;
- register sopno subno;
+ register int c;
+ register int count;
+ register int count2;
+ register sopno pos;
+ register int i;
+ register sopno subno;
#define BACKSL (1<<CHAR_BIT)
@@ -580,70 +581,70 @@ int starordinary; /* is a leading * an ordinary character? */
}
switch (c)
{
- case '.':
- if (p->g->cflags & REG_NEWLINE)
- nonnewline(p);
- else
- EMIT(OANY, 0);
- break;
- case '[':
- p_bracket(p);
- break;
- case BACKSL | '{':
- SETERROR(REG_BADRPT);
- break;
- case BACKSL | '(':
- p->g->nsub++;
- subno = p->g->nsub;
- if (subno < NPAREN)
- p->pbegin[subno] = HERE();
- EMIT(OLPAREN, subno);
- /* the MORE here is an error heuristic */
- if (MORE() && !SEETWO('\\', ')'))
- p_bre(p, '\\', ')');
- if (subno < NPAREN)
- {
- p->pend[subno] = HERE();
- assert(p->pend[subno] != 0);
- }
- EMIT(ORPAREN, subno);
- REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
- break;
- case BACKSL | ')': /* should not get here -- must be user */
- case BACKSL | '}':
- SETERROR(REG_EPAREN);
- break;
- case BACKSL | '1':
- case BACKSL | '2':
- case BACKSL | '3':
- case BACKSL | '4':
- case BACKSL | '5':
- case BACKSL | '6':
- case BACKSL | '7':
- case BACKSL | '8':
- case BACKSL | '9':
- i = (c & ~BACKSL) - '0';
- assert(i < NPAREN);
- if (p->pend[i] != 0)
- {
- assert(i <= p->g->nsub);
- EMIT(OBACK_, i);
- assert(p->pbegin[i] != 0);
- assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
- assert(OP(p->strip[p->pend[i]]) == ORPAREN);
- dupl(p, p->pbegin[i] + 1, p->pend[i]);
- EMIT(O_BACK, i);
- }
- else
- SETERROR(REG_ESUBREG);
- p->g->backrefs = 1;
- break;
- case '*':
- REQUIRE(starordinary, REG_BADRPT);
- /* FALLTHROUGH */
- default:
- ordinary(p, c & ~BACKSL);
- break;
+ case '.':
+ if (p->g->cflags & REG_NEWLINE)
+ nonnewline(p);
+ else
+ EMIT(OANY, 0);
+ break;
+ case '[':
+ p_bracket(p);
+ break;
+ case BACKSL | '{':
+ SETERROR(REG_BADRPT);
+ break;
+ case BACKSL | '(':
+ p->g->nsub++;
+ subno = p->g->nsub;
+ if (subno < NPAREN)
+ p->pbegin[subno] = HERE();
+ EMIT(OLPAREN, subno);
+ /* the MORE here is an error heuristic */
+ if (MORE() && !SEETWO('\\', ')'))
+ p_bre(p, '\\', ')');
+ if (subno < NPAREN)
+ {
+ p->pend[subno] = HERE();
+ assert(p->pend[subno] != 0);
+ }
+ EMIT(ORPAREN, subno);
+ REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
+ break;
+ case BACKSL | ')': /* should not get here -- must be user */
+ case BACKSL | '}':
+ SETERROR(REG_EPAREN);
+ break;
+ case BACKSL | '1':
+ case BACKSL | '2':
+ case BACKSL | '3':
+ case BACKSL | '4':
+ case BACKSL | '5':
+ case BACKSL | '6':
+ case BACKSL | '7':
+ case BACKSL | '8':
+ case BACKSL | '9':
+ i = (c & ~BACKSL) - '0';
+ assert(i < NPAREN);
+ if (p->pend[i] != 0)
+ {
+ assert(i <= p->g->nsub);
+ EMIT(OBACK_, i);
+ assert(p->pbegin[i] != 0);
+ assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
+ assert(OP(p->strip[p->pend[i]]) == ORPAREN);
+ dupl(p, p->pbegin[i] + 1, p->pend[i]);
+ EMIT(O_BACK, i);
+ }
+ else
+ SETERROR(REG_ESUBREG);
+ p->g->backrefs = 1;
+ break;
+ case '*':
+ REQUIRE(starordinary, REG_BADRPT);
+ /* FALLTHROUGH */
+ default:
+ ordinary(p, c & ~BACKSL);
+ break;
}
if (EAT('*'))
@@ -694,8 +695,8 @@ static int /* the value */
p_count(p)
register struct parse *p;
{
- register int count = 0;
- register int ndigits = 0;
+ register int count = 0;
+ register int ndigits = 0;
while (MORE() && isdigit(PEEK()) && count <= DUPMAX)
{
@@ -718,8 +719,8 @@ static void
p_bracket(p)
register struct parse *p;
{
- register cset *cs = allocset(p);
- register int invert = 0;
+ register cset *cs = allocset(p);
+ register int invert = 0;
/* Dept of Truly Sickening Special-Case Kludges */
if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0)
@@ -752,8 +753,8 @@ register struct parse *p;
if (p->g->cflags & REG_ICASE)
{
- register int i;
- register int ci;
+ register int i;
+ register int ci;
for (i = p->g->csetsize - 1; i >= 0; i--)
if (CHIN(cs, i) && isalpha(i))
@@ -767,7 +768,7 @@ register struct parse *p;
}
if (invert)
{
- register int i;
+ register int i;
for (i = p->g->csetsize - 1; i >= 0; i--)
if (CHIN(cs, i))
@@ -798,67 +799,67 @@ register struct parse *p;
static void
p_b_term(p, cs)
register struct parse *p;
-register cset *cs;
+register cset *cs;
{
- register char c;
- register char start,
- finish;
- register int i;
+ register char c;
+ register char start,
+ finish;
+ register int i;
/* classify what we've got */
switch ((MORE()) ? PEEK() : '\0')
{
- case '[':
- c = (MORE2()) ? PEEK2() : '\0';
- break;
- case '-':
- SETERROR(REG_ERANGE);
- return; /* NOTE RETURN */
- break;
- default:
- c = '\0';
- break;
+ case '[':
+ c = (MORE2()) ? PEEK2() : '\0';
+ break;
+ case '-':
+ SETERROR(REG_ERANGE);
+ return; /* NOTE RETURN */
+ break;
+ default:
+ c = '\0';
+ break;
}
switch (c)
{
- case ':': /* character class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECTYPE);
- p_b_cclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
- break;
- case '=': /* equivalence class */
- NEXT2();
- REQUIRE(MORE(), REG_EBRACK);
- c = PEEK();
- REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
- p_b_eclass(p, cs);
- REQUIRE(MORE(), REG_EBRACK);
- REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
- break;
- default: /* symbol, ordinary character, or range */
+ case ':': /* character class */
+ NEXT2();
+ REQUIRE(MORE(), REG_EBRACK);
+ c = PEEK();
+ REQUIRE(c != '-' && c != ']', REG_ECTYPE);
+ p_b_cclass(p, cs);
+ REQUIRE(MORE(), REG_EBRACK);
+ REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
+ break;
+ case '=': /* equivalence class */
+ NEXT2();
+ REQUIRE(MORE(), REG_EBRACK);
+ c = PEEK();
+ REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
+ p_b_eclass(p, cs);
+ REQUIRE(MORE(), REG_EBRACK);
+ REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
+ break;
+ default: /* symbol, ordinary character, or range */
/* xxx revision needed for multichar stuff */
- start = p_b_symbol(p);
- if (SEE('-') && MORE2() && PEEK2() != ']')
- {
- /* range */
- NEXT();
- if (EAT('-'))
- finish = '-';
+ start = p_b_symbol(p);
+ if (SEE('-') && MORE2() && PEEK2() != ']')
+ {
+ /* range */
+ NEXT();
+ if (EAT('-'))
+ finish = '-';
+ else
+ finish = p_b_symbol(p);
+ }
else
- finish = p_b_symbol(p);
- }
- else
- finish = start;
+ finish = start;
/* xxx what about signed chars here... */
- REQUIRE(start <= finish, REG_ERANGE);
- for (i = start; i <= finish; i++)
- CHadd(cs, i);
- break;
+ REQUIRE(start <= finish, REG_ERANGE);
+ for (i = start; i <= finish; i++)
+ CHadd(cs, i);
+ break;
}
}
@@ -869,13 +870,13 @@ register cset *cs;
static void
p_b_cclass(p, cs)
register struct parse *p;
-register cset *cs;
+register cset *cs;
{
- register char *sp = p->next;
+ register char *sp = p->next;
register struct cclass *cp;
register size_t len;
- register char *u;
- register char c;
+ register char *u;
+ register char c;
while (MORE() && isalpha(PEEK()))
NEXT();
@@ -906,9 +907,9 @@ register cset *cs;
static void
p_b_eclass(p, cs)
register struct parse *p;
-register cset *cs;
+register cset *cs;
{
- register char c;
+ register char c;
c = p_b_coll_elem(p, '=');
CHadd(cs, c);
@@ -922,7 +923,7 @@ static char /* value of symbol */
p_b_symbol(p)
register struct parse *p;
{
- register char value;
+ register char value;
REQUIRE(MORE(), REG_EBRACK);
if (!EATTWO('[', '.'))
@@ -941,11 +942,11 @@ register struct parse *p;
static char /* value of collating element */
p_b_coll_elem(p, endc)
register struct parse *p;
-int endc; /* name ended by endc,']' */
+int endc; /* name ended by endc,']' */
{
- register char *sp = p->next;
+ register char *sp = p->next;
register struct cname *cp;
- register int len;
+ register int len;
while (MORE() && !SEETWO(endc, ']'))
NEXT();
@@ -970,7 +971,7 @@ int endc; /* name ended by endc,']' */
*/
static char /* if no counterpart, return ch */
othercase(ch)
-int ch;
+int ch;
{
assert(isalpha(ch));
if (isupper(ch))
@@ -991,11 +992,11 @@ int ch;
static void
bothcases(p, ch)
register struct parse *p;
-int ch;
+int ch;
{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[3];
+ register char *oldnext = p->next;
+ register char *oldend = p->end;
+ char bracket[3];
assert(othercase(ch) != ch);/* p_bracket() would recurse */
p->next = bracket;
@@ -1016,7 +1017,7 @@ int ch;
static void
ordinary(p, ch)
register struct parse *p;
-register int ch;
+register int ch;
{
register cat_t *cap = p->g->categories;
@@ -1040,9 +1041,9 @@ static void
nonnewline(p)
register struct parse *p;
{
- register char *oldnext = p->next;
- register char *oldend = p->end;
- char bracket[4];
+ register char *oldnext = p->next;
+ register char *oldend = p->end;
+ char bracket[4];
p->next = bracket;
p->end = bracket + 3;
@@ -1063,18 +1064,18 @@ register struct parse *p;
static void
repeat(p, start, from, to)
register struct parse *p;
-sopno start; /* operand from here to end of strip */
-int from; /* repeated from this number */
-int to; /* to this number of times (maybe
+sopno start; /* operand from here to end of strip */
+int from; /* repeated from this number */
+int to; /* to this number of times (maybe
* INFINITY) */
{
- register sopno finish = HERE();
+ register sopno finish = HERE();
#define N 2
#define INF 3
#define REP(f, t) ((f)*8 + (t))
#define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
- register sopno copy;
+ register sopno copy;
if (p->error != 0) /* head off possible runaway recursion */
return;
@@ -1083,51 +1084,51 @@ int to; /* to this number of times (maybe
switch (REP(MAP(from), MAP(to)))
{
- case REP(0, 0): /* must be user doing this */
- DROP(finish - start); /* drop the operand */
- break;
- case REP(0, 1): /* as x{1,1}? */
- case REP(0, N): /* as x{1,n}? */
- case REP(0, INF): /* as x{1,}? */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start); /* offset is wrong... */
- repeat(p, start + 1, 1, to);
- ASTERN(OOR1, start);
- AHEAD(start); /* ... fix it */
- EMIT(OOR2, 0);
- AHEAD(THERE());
- ASTERN(O_CH, THERETHERE());
- break;
- case REP(1, 1): /* trivial case */
- /* done */
- break;
- case REP(1, N): /* as x?x{1,n-1} */
- /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
- INSERT(OCH_, start);
- ASTERN(OOR1, start);
- AHEAD(start);
- EMIT(OOR2, 0); /* offset very wrong... */
- AHEAD(THERE()); /* ...so fix it */
- ASTERN(O_CH, THERETHERE());
- copy = dupl(p, start + 1, finish + 1);
- assert(copy == finish + 4);
- repeat(p, copy, 1, to - 1);
- break;
- case REP(1, INF): /* as x+ */
- INSERT(OPLUS_, start);
- ASTERN(O_PLUS, start);
- break;
- case REP(N, N): /* as xx{m-1,n-1} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from - 1, to - 1);
- break;
- case REP(N, INF): /* as xx{n-1,INF} */
- copy = dupl(p, start, finish);
- repeat(p, copy, from - 1, to);
- break;
- default: /* "can't happen" */
- SETERROR(REG_ASSERT); /* just in case */
- break;
+ case REP(0, 0): /* must be user doing this */
+ DROP(finish - start); /* drop the operand */
+ break;
+ case REP(0, 1): /* as x{1,1}? */
+ case REP(0, N): /* as x{1,n}? */
+ case REP(0, INF): /* as x{1,}? */
+ /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
+ INSERT(OCH_, start);/* offset is wrong... */
+ repeat(p, start + 1, 1, to);
+ ASTERN(OOR1, start);
+ AHEAD(start); /* ... fix it */
+ EMIT(OOR2, 0);
+ AHEAD(THERE());
+ ASTERN(O_CH, THERETHERE());
+ break;
+ case REP(1, 1): /* trivial case */
+ /* done */
+ break;
+ case REP(1, N): /* as x?x{1,n-1} */
+ /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
+ INSERT(OCH_, start);
+ ASTERN(OOR1, start);
+ AHEAD(start);
+ EMIT(OOR2, 0); /* offset very wrong... */
+ AHEAD(THERE()); /* ...so fix it */
+ ASTERN(O_CH, THERETHERE());
+ copy = dupl(p, start + 1, finish + 1);
+ assert(copy == finish + 4);
+ repeat(p, copy, 1, to - 1);
+ break;
+ case REP(1, INF): /* as x+ */
+ INSERT(OPLUS_, start);
+ ASTERN(O_PLUS, start);
+ break;
+ case REP(N, N): /* as xx{m-1,n-1} */
+ copy = dupl(p, start, finish);
+ repeat(p, copy, from - 1, to - 1);
+ break;
+ case REP(N, INF): /* as xx{n-1,INF} */
+ copy = dupl(p, start, finish);
+ repeat(p, copy, from - 1, to);
+ break;
+ default: /* "can't happen" */
+ SETERROR(REG_ASSERT); /* just in case */
+ break;
}
}
@@ -1138,7 +1139,7 @@ int to; /* to this number of times (maybe
static int /* useless but makes type checking happy */
seterr(p, e)
register struct parse *p;
-int e;
+int e;
{
if (p->error == 0) /* keep earliest error condition */
p->error = e;
@@ -1151,16 +1152,16 @@ int e;
- allocset - allocate a set of characters for []
== static cset *allocset(register struct parse *p);
*/
-static cset *
+static cset *
allocset(p)
register struct parse *p;
{
- register int no = p->g->ncsets++;
+ register int no = p->g->ncsets++;
register size_t nc;
register size_t nbytes;
- register cset *cs;
+ register cset *cs;
register size_t css = (size_t) p->g->csetsize;
- register int i;
+ register int i;
if (no >= p->ncsalloc)
{ /* need another column of space */
@@ -1212,10 +1213,10 @@ register struct parse *p;
static void
freeset(p, cs)
register struct parse *p;
-register cset *cs;
+register cset *cs;
{
- register int i;
- register cset *top = &p->g->sets[p->g->ncsets];
+ register int i;
+ register cset *top = &p->g->sets[p->g->ncsets];
register size_t css = (size_t) p->g->csetsize;
for (i = 0; i < css; i++)
@@ -1237,12 +1238,12 @@ register cset *cs;
static int /* set number */
freezeset(p, cs)
register struct parse *p;
-register cset *cs;
+register cset *cs;
{
- register uch h = cs->hash;
- register int i;
- register cset *top = &p->g->sets[p->g->ncsets];
- register cset *cs2;
+ register uch h = cs->hash;
+ register int i;
+ register cset *top = &p->g->sets[p->g->ncsets];
+ register cset *cs2;
register size_t css = (size_t) p->g->csetsize;
/* look for an earlier one which is the same */
@@ -1273,9 +1274,9 @@ register cset *cs;
static int /* character; there is no "none" value */
firstch(p, cs)
register struct parse *p;
-register cset *cs;
+register cset *cs;
{
- register int i;
+ register int i;
register size_t css = (size_t) p->g->csetsize;
for (i = 0; i < css; i++)
@@ -1292,11 +1293,11 @@ register cset *cs;
static int
nch(p, cs)
register struct parse *p;
-register cset *cs;
+register cset *cs;
{
- register int i;
+ register int i;
register size_t css = (size_t) p->g->csetsize;
- register int n = 0;
+ register int n = 0;
for (i = 0; i < css; i++)
if (CHIN(cs, i))
@@ -1312,8 +1313,8 @@ register cset *cs;
static void
mcadd(p, cs, cp)
register struct parse *p;
-register cset *cs;
-register char *cp;
+register cset *cs;
+register char *cp;
{
register size_t oldend = cs->smultis;
@@ -1405,7 +1406,7 @@ register char *cp;
static void
mcinvert(p, cs)
register struct parse *p;
-register cset *cs;
+register cset *cs;
{
assert(cs->multis == NULL); /* xxx */
}
@@ -1420,7 +1421,7 @@ register cset *cs;
static void
mccase(p, cs)
register struct parse *p;
-register cset *cs;
+register cset *cs;
{
assert(cs->multis == NULL); /* xxx */
}
@@ -1432,11 +1433,11 @@ register cset *cs;
static int /* predicate */
isinsets(g, c)
register struct re_guts *g;
-int c;
+int c;
{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets + (CHAR_BIT - 1)) / CHAR_BIT;
+ register uch *col;
+ register int i;
+ register int ncols = (g->ncsets + (CHAR_BIT - 1)) / CHAR_BIT;
register unsigned uc = (unsigned char) c;
for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
@@ -1452,12 +1453,12 @@ int c;
static int /* predicate */
samesets(g, c1, c2)
register struct re_guts *g;
-int c1;
-int c2;
+int c1;
+int c2;
{
- register uch *col;
- register int i;
- register int ncols = (g->ncsets + (CHAR_BIT - 1)) / CHAR_BIT;
+ register uch *col;
+ register int i;
+ register int ncols = (g->ncsets + (CHAR_BIT - 1)) / CHAR_BIT;
register unsigned uc1 = (unsigned char) c1;
register unsigned uc2 = (unsigned char) c2;
@@ -1473,13 +1474,13 @@ int c2;
*/
static void
categorize(p, g)
-struct parse *p;
+struct parse *p;
register struct re_guts *g;
{
register cat_t *cats = g->categories;
- register int c;
- register int c2;
- register cat_t cat;
+ register int c;
+ register int c2;
+ register cat_t cat;
/* avoid making error situations worse */
if (p->error != 0)
@@ -1500,14 +1501,14 @@ register struct re_guts *g;
- dupl - emit a duplicate of a bunch of sops
== static sopno dupl(register struct parse *p, sopno start, sopno finish);
*/
-static sopno /* start of duplicate */
+static sopno /* start of duplicate */
dupl(p, start, finish)
register struct parse *p;
-sopno start; /* from here */
-sopno finish; /* to this less one */
+sopno start; /* from here */
+sopno finish; /* to this less one */
{
- register sopno ret = HERE();
- register sopno len = finish - start;
+ register sopno ret = HERE();
+ register sopno len = finish - start;
assert(finish >= start);
if (len == 0)
@@ -1531,8 +1532,8 @@ sopno finish; /* to this less one */
static void
doemit(p, op, opnd)
register struct parse *p;
-sop op;
-size_t opnd;
+sop op;
+size_t opnd;
{
/* avoid making error situations worse */
if (p->error != 0)
@@ -1557,13 +1558,13 @@ size_t opnd;
static void
doinsert(p, op, opnd, pos)
register struct parse *p;
-sop op;
-size_t opnd;
-sopno pos;
+sop op;
+size_t opnd;
+sopno pos;
{
- register sopno sn;
- register sop s;
- register int i;
+ register sopno sn;
+ register sop s;
+ register int i;
/* avoid making error situations worse */
if (p->error != 0)
@@ -1600,8 +1601,8 @@ sopno pos;
static void
dofwd(p, pos, value)
register struct parse *p;
-register sopno pos;
-sop value;
+register sopno pos;
+sop value;
{
/* avoid making error situations worse */
if (p->error != 0)
@@ -1618,9 +1619,9 @@ sop value;
static void
enlarge(p, size)
register struct parse *p;
-register sopno size;
+register sopno size;
{
- register sop *sp;
+ register sop *sp;
if (p->ssize >= size)
return;
@@ -1665,16 +1666,16 @@ register struct re_guts *g;
*/
static void
findmust(p, g)
-struct parse *p;
+struct parse *p;
register struct re_guts *g;
{
- register sop *scan;
- sop *start = 0;
- register sop *newstart = 0;
- register sopno newlen;
- register sop s;
- register char *cp;
- register sopno i;
+ register sop *scan;
+ sop *start = 0;
+ register sop *newstart = 0;
+ register sopno newlen;
+ register sop s;
+ register char *cp;
+ register sopno i;
/* avoid making error situations worse */
if (p->error != 0)
@@ -1688,39 +1689,39 @@ register struct re_guts *g;
s = *scan++;
switch (OP(s))
{
- case OCHAR: /* sequence member */
- if (newlen == 0) /* new sequence */
- newstart = scan - 1;
- newlen++;
- break;
- case OPLUS_: /* things that don't break one */
- case OLPAREN:
- case ORPAREN:
- break;
- case OQUEST_: /* things that must be skipped */
- case OCH_:
- scan--;
- do
- {
- scan += OPND(s);
- s = *scan;
- /* assert() interferes w debug printouts */
- if (OP(s) != O_QUEST && OP(s) != O_CH &&
- OP(s) != OOR2)
+ case OCHAR: /* sequence member */
+ if (newlen == 0)/* new sequence */
+ newstart = scan - 1;
+ newlen++;
+ break;
+ case OPLUS_: /* things that don't break one */
+ case OLPAREN:
+ case ORPAREN:
+ break;
+ case OQUEST_: /* things that must be skipped */
+ case OCH_:
+ scan--;
+ do
{
- g->iflags |= BAD;
- return;
+ scan += OPND(s);
+ s = *scan;
+ /* assert() interferes w debug printouts */
+ if (OP(s) != O_QUEST && OP(s) != O_CH &&
+ OP(s) != OOR2)
+ {
+ g->iflags |= BAD;
+ return;
+ }
+ } while (OP(s) != O_QUEST && OP(s) != O_CH);
+ /* fallthrough */
+ default: /* things that break a sequence */
+ if (newlen > g->mlen)
+ { /* ends one */
+ start = newstart;
+ g->mlen = newlen;
}
- } while (OP(s) != O_QUEST && OP(s) != O_CH);
- /* fallthrough */
- default: /* things that break a sequence */
- if (newlen > g->mlen)
- { /* ends one */
- start = newstart;
- g->mlen = newlen;
- }
- newlen = 0;
- break;
+ newlen = 0;
+ break;
}
} while (OP(s) != OEND);
@@ -1751,15 +1752,15 @@ register struct re_guts *g;
- pluscount - count + nesting
== static sopno pluscount(register struct parse *p, register struct re_guts *g);
*/
-static sopno /* nesting depth */
+static sopno /* nesting depth */
pluscount(p, g)
-struct parse *p;
+struct parse *p;
register struct re_guts *g;
{
- register sop *scan;
- register sop s;
- register sopno plusnest = 0;
- register sopno maxnest = 0;
+ register sop *scan;
+ register sop s;
+ register sopno plusnest = 0;
+ register sopno maxnest = 0;
if (p->error != 0)
return (0); /* there may not be an OEND */
@@ -1770,14 +1771,14 @@ register struct re_guts *g;
s = *scan++;
switch (OP(s))
{
- case OPLUS_:
- plusnest++;
- break;
- case O_PLUS:
- if (plusnest > maxnest)
- maxnest = plusnest;
- plusnest--;
- break;
+ case OPLUS_:
+ plusnest++;
+ break;
+ case O_PLUS:
+ if (plusnest > maxnest)
+ maxnest = plusnest;
+ plusnest--;
+ break;
}
} while (OP(s) != OEND);
if (plusnest != 0)
diff --git a/src/backend/regex/regerror.c b/src/backend/regex/regerror.c
index 9e6e0e0217..d5f9255983 100644
--- a/src/backend/regex/regerror.c
+++ b/src/backend/regex/regerror.c
@@ -38,7 +38,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
+static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
#endif /* LIBC_SCCS and not lint */
@@ -55,12 +55,12 @@ static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
/* ========= begin header generated by ./mkh ========= */
#ifdef __cplusplus
-extern "C"
+extern "C"
{
#endif
/* === regerror.c === */
- static char *regatoi(const regex_t * preg, char *localbuf);
+ static char *regatoi(const regex_t * preg, char *localbuf);
#ifdef __cplusplus
}
@@ -89,10 +89,10 @@ extern "C"
*/
static struct rerr
{
- int code;
- char *name;
- char *explain;
-} rerrs[] =
+ int code;
+ char *name;
+ char *explain;
+} rerrs[] =
{
{
@@ -155,16 +155,16 @@ static struct rerr
/* ARGSUSED */
size_t
pg95_regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t *preg;
-char *errbuf;
-size_t errbuf_size;
+int errcode;
+const regex_t *preg;
+char *errbuf;
+size_t errbuf_size;
{
register struct rerr *r;
register size_t len;
- register int target = errcode & ~REG_ITOA;
- register char *s;
- char convbuf[50];
+ register int target = errcode & ~REG_ITOA;
+ register char *s;
+ char convbuf[50];
if (errcode == REG_ATOI)
s = regatoi(preg, convbuf);
@@ -206,10 +206,10 @@ size_t errbuf_size;
- regatoi - internal routine to implement REG_ATOI
== static char *regatoi(const regex_t *preg, char *localbuf);
*/
-static char *
+static char *
regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
+const regex_t *preg;
+char *localbuf;
{
register struct rerr *r;
diff --git a/src/backend/regex/regexec.c b/src/backend/regex/regexec.c
index 5e0021f429..224856afec 100644
--- a/src/backend/regex/regexec.c
+++ b/src/backend/regex/regexec.c
@@ -38,7 +38,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
+static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
#endif /* LIBC_SCCS and not lint */
@@ -61,7 +61,7 @@ static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
#include <regex/utils.h>
#include <regex/regex2.h>
-static int nope = 0; /* for use in asserts; shuts lint up */
+static int nope = 0; /* for use in asserts; shuts lint up */
/* macros for manipulating states, small version */
#define states long
@@ -156,11 +156,11 @@ static int nope = 0; /* for use in asserts; shuts lint up */
*/
int /* 0 success, REG_NOMATCH failure */
pg95_regexec(preg, string, nmatch, pmatch, eflags)
-const regex_t *preg;
-const char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
+const regex_t *preg;
+const char *string;
+size_t nmatch;
+regmatch_t pmatch[];
+int eflags;
{
register struct re_guts *g = preg->re_g;
diff --git a/src/backend/regex/regfree.c b/src/backend/regex/regfree.c
index 26ca8863ed..15735fa663 100644
--- a/src/backend/regex/regfree.c
+++ b/src/backend/regex/regfree.c
@@ -38,7 +38,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regfree.c 8.3 (Berkeley) 3/20/94";
+static char sccsid[] = "@(#)regfree.c 8.3 (Berkeley) 3/20/94";
#endif /* LIBC_SCCS and not lint */
@@ -56,7 +56,7 @@ static char sccsid[] = "@(#)regfree.c 8.3 (Berkeley) 3/20/94";
*/
void
pg95_regfree(preg)
-regex_t *preg;
+regex_t *preg;
{
register struct re_guts *g;
diff --git a/src/backend/rewrite/locks.c b/src/backend/rewrite/locks.c
index 213fae9b32..6a62e8ddee 100644
--- a/src/backend/rewrite/locks.c
+++ b/src/backend/rewrite/locks.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.3 1997/09/07 04:48:02 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.4 1997/09/08 02:28:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -26,52 +26,52 @@
* if we find at least one such match, we return true
* otherwise, we return false
*/
-static bool
+static bool
nodeThisLockWasTriggered(Node * node, int varno, AttrNumber attnum)
{
if (node == NULL)
return FALSE;
switch (nodeTag(node))
{
- case T_Var:
- {
- Var *var = (Var *) node;
-
- if (varno == var->varno &&
- (attnum == var->varattno || attnum == -1))
- return TRUE;
- }
- break;
- case T_Expr:
- {
- Expr *expr = (Expr *) node;
+ case T_Var:
+ {
+ Var *var = (Var *) node;
- return
- nodeThisLockWasTriggered((Node *) expr->args, varno, attnum);
- }
- break;
- case T_TargetEntry:
- {
- TargetEntry *tle = (TargetEntry *) node;
+ if (varno == var->varno &&
+ (attnum == var->varattno || attnum == -1))
+ return TRUE;
+ }
+ break;
+ case T_Expr:
+ {
+ Expr *expr = (Expr *) node;
- return
- nodeThisLockWasTriggered(tle->expr, varno, attnum);
- }
- break;
- case T_List:
- {
- List *l;
+ return
+ nodeThisLockWasTriggered((Node *) expr->args, varno, attnum);
+ }
+ break;
+ case T_TargetEntry:
+ {
+ TargetEntry *tle = (TargetEntry *) node;
- foreach(l, (List *) node)
+ return
+ nodeThisLockWasTriggered(tle->expr, varno, attnum);
+ }
+ break;
+ case T_List:
{
- if (nodeThisLockWasTriggered(lfirst(l), varno, attnum))
- return TRUE;
+ List *l;
+
+ foreach(l, (List *) node)
+ {
+ if (nodeThisLockWasTriggered(lfirst(l), varno, attnum))
+ return TRUE;
+ }
+ return FALSE;
}
- return FALSE;
- }
- break;
- default:
- break;
+ break;
+ default:
+ break;
}
return (FALSE);
}
@@ -82,7 +82,7 @@ nodeThisLockWasTriggered(Node * node, int varno, AttrNumber attnum)
* against the attnum if we find at least one such match, we return true
* otherwise, we return false
*/
-static bool
+static bool
thisLockWasTriggered(int varno,
AttrNumber attnum,
Query * parsetree)
@@ -97,15 +97,15 @@ thisLockWasTriggered(int varno,
* matchLocks -
* match the list of locks and returns the matching rules
*/
-List *
+List *
matchLocks(CmdType event,
RuleLock * rulelocks,
int varno,
Query * parsetree)
{
- List *real_locks = NIL;
- int nlocks;
- int i;
+ List *real_locks = NIL;
+ int nlocks;
+ int i;
Assert(rulelocks != NULL); /* we get called iff there is some lock */
Assert(parsetree != NULL);
@@ -122,7 +122,7 @@ matchLocks(CmdType event,
for (i = 0; i < nlocks; i++)
{
- RewriteRule *oneLock = rulelocks->rules[i];
+ RewriteRule *oneLock = rulelocks->rules[i];
if (oneLock->event == event)
{
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index 01b05c4cd0..c849d7edab 100644
--- a/src/backend/rewrite/rewriteDefine.c
+++ b/src/backend/rewrite/rewriteDefine.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.4 1997/09/07 04:48:05 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteDefine.c,v 1.5 1997/09/08 02:28:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,7 @@
#include "rewrite/rewriteSupport.h"
#include "tcop/tcopprot.h"
-Oid LastOidProcessed = InvalidOid;
+Oid LastOidProcessed = InvalidOid;
/*
* This is too small for many rule plans, but it'll have to do for now.
@@ -43,8 +43,8 @@ Oid LastOidProcessed = InvalidOid;
static void
strcpyq(char *dest, char *source)
{
- char *current = source,
- *destp = dest;
+ char *current = source,
+ *destp = dest;
for (current = source; *current; current++)
{
@@ -75,7 +75,7 @@ strcpyq(char *dest, char *source)
* evinstead - is an instead rule
* actiontree - parsetree(s) of rule action
*/
-static Oid
+static Oid
InsertRule(char *rulname,
int evtype,
char *evobj,
@@ -84,15 +84,15 @@ InsertRule(char *rulname,
bool evinstead,
char *actiontree)
{
- static char rulebuf[RULE_PLAN_SIZE];
- static char actionbuf[RULE_PLAN_SIZE];
- static char qualbuf[RULE_PLAN_SIZE];
- Oid eventrel_oid = InvalidOid;
- AttrNumber evslot_index = InvalidAttrNumber;
- Relation eventrel = NULL;
- char *is_instead = "f";
- extern void eval_as_new_xact();
- char *template;
+ static char rulebuf[RULE_PLAN_SIZE];
+ static char actionbuf[RULE_PLAN_SIZE];
+ static char qualbuf[RULE_PLAN_SIZE];
+ Oid eventrel_oid = InvalidOid;
+ AttrNumber evslot_index = InvalidAttrNumber;
+ Relation eventrel = NULL;
+ char *is_instead = "f";
+ extern void eval_as_new_xact();
+ char *template;
eventrel = heap_openr(evobj);
if (eventrel == NULL)
@@ -172,7 +172,7 @@ ValidateRule(int event_type,
*/
if (is_instead && !*action && eslot_string && event_type == CMD_SELECT)
{
- char *temp_buffer = (char *) palloc(strlen(template) + 80);
+ char *temp_buffer = (char *) palloc(strlen(template) + 80);
sprintf(temp_buffer, template, event_attype,
get_typlen(event_attype), eslot_string,
@@ -188,19 +188,19 @@ ValidateRule(int event_type,
void
DefineQueryRewrite(RuleStmt * stmt)
{
- CmdType event_type = stmt->event;
- Attr *event_obj = stmt->object;
- Node *event_qual = stmt->whereClause;
- bool is_instead = stmt->instead;
- List *action = stmt->actions;
- Relation event_relation = NULL;
- Oid ruleId;
- Oid ev_relid = 0;
- char *eslot_string = NULL;
- int event_attno = 0;
- Oid event_attype = 0;
- char *actionP,
- *event_qualP;
+ CmdType event_type = stmt->event;
+ Attr *event_obj = stmt->object;
+ Node *event_qual = stmt->whereClause;
+ bool is_instead = stmt->instead;
+ List *action = stmt->actions;
+ Relation event_relation = NULL;
+ Oid ruleId;
+ Oid ev_relid = 0;
+ char *eslot_string = NULL;
+ int event_attno = 0;
+ Oid event_attype = 0;
+ char *actionP,
+ *event_qualP;
if (event_obj->attrs)
eslot_string = strVal(lfirst(event_obj->attrs));
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index 980956a480..af15f6b717 100644
--- a/src/backend/rewrite/rewriteHandler.c
+++ b/src/backend/rewrite/rewriteHandler.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.4 1997/09/07 04:48:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.5 1997/09/08 02:28:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,10 +32,10 @@
static void
ApplyRetrieveRule(Query * parsetree, RewriteRule * rule,
int rt_index, int relation_level, int *modified);
-static List *
+static List *
fireRules(Query * parsetree, int rt_index, CmdType event,
bool * instead_flag, List * locks, List ** qual_products);
-static List *deepRewriteQuery(Query * parsetree);
+static List *deepRewriteQuery(Query * parsetree);
/*
* gatherRewriteMeta -
@@ -51,9 +51,9 @@ gatherRewriteMeta(Query * parsetree,
CmdType event,
bool * instead_flag)
{
- RewriteInfo *info;
- int rt_length;
- int result_reln;
+ RewriteInfo *info;
+ int rt_length;
+ int result_reln;
info = (RewriteInfo *) palloc(sizeof(RewriteInfo));
info->rt_index = rt_index;
@@ -90,18 +90,18 @@ gatherRewriteMeta(Query * parsetree,
*/
if (info->action != CMD_SELECT)
{ /* i.e update XXXXX */
- int new_result_reln = 0;
+ int new_result_reln = 0;
result_reln = info->rule_action->resultRelation;
switch (result_reln)
{
- case PRS2_CURRENT_VARNO:
- new_result_reln = rt_index;
- break;
- case PRS2_NEW_VARNO: /* XXX */
- default:
- new_result_reln = result_reln + rt_length;
- break;
+ case PRS2_CURRENT_VARNO:
+ new_result_reln = rt_index;
+ break;
+ case PRS2_NEW_VARNO: /* XXX */
+ default:
+ new_result_reln = result_reln + rt_length;
+ break;
}
info->rule_action->resultRelation = new_result_reln;
}
@@ -109,16 +109,16 @@ gatherRewriteMeta(Query * parsetree,
return info;
}
-static List *
+static List *
OptimizeRIRRules(List * locks)
{
- List *attr_level = NIL,
- *i;
- List *relation_level = NIL;
+ List *attr_level = NIL,
+ *i;
+ List *relation_level = NIL;
foreach(i, locks)
{
- RewriteRule *rule_lock = lfirst(i);
+ RewriteRule *rule_lock = lfirst(i);
if (rule_lock->attrno == -1)
relation_level = lappend(relation_level, rule_lock);
@@ -132,16 +132,16 @@ OptimizeRIRRules(List * locks)
* idea is to put instead rules before regular rules so that
* excess semantically queasy queries aren't processed
*/
-static List *
+static List *
orderRules(List * locks)
{
- List *regular = NIL,
- *i;
- List *instead_rules = NIL;
+ List *regular = NIL,
+ *i;
+ List *instead_rules = NIL;
foreach(i, locks)
{
- RewriteRule *rule_lock = (RewriteRule *) lfirst(i);
+ RewriteRule *rule_lock = (RewriteRule *) lfirst(i);
if (rule_lock->isInstead)
instead_rules = lappend(instead_rules, rule_lock);
@@ -154,11 +154,11 @@ orderRules(List * locks)
static int
AllRetrieve(List * actions)
{
- List *n;
+ List *n;
foreach(n, actions)
{
- Query *pt = lfirst(n);
+ Query *pt = lfirst(n);
/*
* in the old postgres code, we check whether command_type is a
@@ -171,17 +171,17 @@ AllRetrieve(List * actions)
return true;
}
-static List *
+static List *
FireRetrieveRulesAtQuery(Query * parsetree,
int rt_index,
Relation relation,
bool * instead_flag,
int rule_flag)
{
- List *i,
- *locks;
- RuleLock *rt_entry_locks = NULL;
- List *work = NIL;
+ List *i,
+ *locks;
+ RuleLock *rt_entry_locks = NULL;
+ List *work = NIL;
if ((rt_entry_locks = relation->rd_rules) == NULL)
return NIL;
@@ -191,7 +191,7 @@ FireRetrieveRulesAtQuery(Query * parsetree,
/* find all retrieve instead */
foreach(i, locks)
{
- RewriteRule *rule_lock = (RewriteRule *) lfirst(i);
+ RewriteRule *rule_lock = (RewriteRule *) lfirst(i);
if (!rule_lock->isInstead)
continue;
@@ -202,9 +202,9 @@ FireRetrieveRulesAtQuery(Query * parsetree,
work = OptimizeRIRRules(locks);
foreach(i, work)
{
- RewriteRule *rule_lock = lfirst(i);
- int relation_level;
- int modified = FALSE;
+ RewriteRule *rule_lock = lfirst(i);
+ int relation_level;
+ int modified = FALSE;
relation_level = (rule_lock->attrno == -1);
if (rule_lock->actions == NIL)
@@ -248,13 +248,13 @@ ApplyRetrieveRule(Query * parsetree,
int relation_level,
int *modified)
{
- Query *rule_action = NULL;
- Node *rule_qual;
- List *rtable,
- *rt;
- int nothing,
- rt_length;
- int badsql = FALSE;
+ Query *rule_action = NULL;
+ Node *rule_qual;
+ List *rtable,
+ *rt;
+ int nothing,
+ rt_length;
+ int badsql = FALSE;
rule_qual = rule->qual;
if (rule->actions)
@@ -274,7 +274,7 @@ ApplyRetrieveRule(Query * parsetree,
rtable = copyObject(parsetree->rtable);
foreach(rt, rtable)
{
- RangeTblEntry *rte = lfirst(rt);
+ RangeTblEntry *rte = lfirst(rt);
/*
* this is to prevent add_missing_vars_to_base_rels() from adding
@@ -309,21 +309,21 @@ ApplyRetrieveRule(Query * parsetree,
AddQual(parsetree, rule_action->qual);
}
-static List *
+static List *
ProcessRetrieveQuery(Query * parsetree,
List * rtable,
bool * instead_flag,
bool rule)
{
- List *rt;
- List *product_queries = NIL;
- int rt_index = 0;
+ List *rt;
+ List *product_queries = NIL;
+ int rt_index = 0;
foreach(rt, rtable)
{
- RangeTblEntry *rt_entry = lfirst(rt);
- Relation rt_entry_relation = NULL;
- List *result = NIL;
+ RangeTblEntry *rt_entry = lfirst(rt);
+ Relation rt_entry_relation = NULL;
+ List *result = NIL;
rt_index++;
rt_entry_relation = heap_openr(rt_entry->relname);
@@ -346,12 +346,12 @@ ProcessRetrieveQuery(Query * parsetree,
foreach(rt, rtable)
{
- RangeTblEntry *rt_entry = lfirst(rt);
- Relation rt_entry_relation = NULL;
- RuleLock *rt_entry_locks = NULL;
- List *result = NIL;
- List *locks = NIL;
- List *dummy_products;
+ RangeTblEntry *rt_entry = lfirst(rt);
+ Relation rt_entry_relation = NULL;
+ RuleLock *rt_entry_locks = NULL;
+ List *result = NIL;
+ List *locks = NIL;
+ List *dummy_products;
rt_index++;
rt_entry_relation = heap_openr(rt_entry->relname);
@@ -376,16 +376,16 @@ ProcessRetrieveQuery(Query * parsetree,
return product_queries;
}
-static Query *
+static Query *
CopyAndAddQual(Query * parsetree,
List * actions,
Node * rule_qual,
int rt_index,
CmdType event)
{
- Query *new_tree = (Query *) copyObject(parsetree);
- Node *new_qual = NULL;
- Query *rule_action = NULL;
+ Query *new_tree = (Query *) copyObject(parsetree);
+ Node *new_qual = NULL;
+ Query *rule_action = NULL;
if (actions)
rule_action = lfirst(actions);
@@ -393,8 +393,8 @@ CopyAndAddQual(Query * parsetree,
new_qual = (Node *) copyObject(rule_qual);
if (rule_action != NULL)
{
- List *rtable;
- int rt_length;
+ List *rtable;
+ int rt_length;
rtable = new_tree->rtable;
rt_length = length(rtable);
@@ -418,7 +418,7 @@ CopyAndAddQual(Query * parsetree,
* sensible semantics. remember: reality is for dead birds -- glass
*
*/
-static List *
+static List *
fireRules(Query * parsetree,
int rt_index,
CmdType event,
@@ -426,9 +426,9 @@ fireRules(Query * parsetree,
List * locks,
List ** qual_products)
{
- RewriteInfo *info;
- List *results = NIL;
- List *i;
+ RewriteInfo *info;
+ List *results = NIL;
+ List *i;
/* choose rule to fire from list of rules */
if (locks == NIL)
@@ -445,12 +445,12 @@ fireRules(Query * parsetree,
locks = orderRules(locks); /* instead rules first */
foreach(i, locks)
{
- RewriteRule *rule_lock = (RewriteRule *) lfirst(i);
- Node *qual,
- *event_qual;
- List *actions;
- List *r;
- bool orig_instead_flag = *instead_flag;
+ RewriteRule *rule_lock = (RewriteRule *) lfirst(i);
+ Node *qual,
+ *event_qual;
+ List *actions;
+ List *r;
+ bool orig_instead_flag = *instead_flag;
/* multiple rule action time */
*instead_flag = rule_lock->isInstead;
@@ -463,8 +463,8 @@ fireRules(Query * parsetree,
rt_index, event));
foreach(r, actions)
{
- Query *rule_action = lfirst(r);
- Node *rule_qual = copyObject(event_qual);
+ Query *rule_action = lfirst(r);
+ Node *rule_qual = copyObject(event_qual);
/*--------------------------------------------------
* Step 1:
@@ -535,12 +535,12 @@ fireRules(Query * parsetree,
return results;
}
-static List *
+static List *
RewriteQuery(Query * parsetree, bool * instead_flag, List ** qual_products)
{
- CmdType event;
- List *product_queries = NIL;
- int result_relation = 0;
+ CmdType event;
+ List *product_queries = NIL;
+ int result_relation = 0;
Assert(parsetree != NULL);
@@ -565,9 +565,9 @@ RewriteQuery(Query * parsetree, bool * instead_flag, List ** qual_products)
/*
* the statement is an update, insert or delete
*/
- RangeTblEntry *rt_entry;
- Relation rt_entry_relation = NULL;
- RuleLock *rt_entry_locks = NULL;
+ RangeTblEntry *rt_entry;
+ Relation rt_entry_relation = NULL;
+ RuleLock *rt_entry_locks = NULL;
rt_entry = rt_fetch(result_relation, parsetree->rtable);
rt_entry_relation = heap_openr(rt_entry->relname);
@@ -576,7 +576,7 @@ RewriteQuery(Query * parsetree, bool * instead_flag, List ** qual_products)
if (rt_entry_locks != NULL)
{
- List *locks =
+ List *locks =
matchLocks(event, rt_entry_locks, result_relation, parsetree);
product_queries =
@@ -595,7 +595,7 @@ RewriteQuery(Query * parsetree, bool * instead_flag, List ** qual_products)
/*
* the statement is a select
*/
- Query *other;
+ Query *other;
other = copyObject(parsetree); /* ApplyRetrieveRule changes the
* range table */
@@ -613,14 +613,14 @@ RewriteQuery(Query * parsetree, bool * instead_flag, List ** qual_products)
#define REWRITE_INVOKE_MAX 10
#endif
-static int numQueryRewriteInvoked = 0;
+static int numQueryRewriteInvoked = 0;
/*
* QueryRewrite -
* rewrite one query via QueryRewrite system, possibly returning 0, or many
* queries
*/
-List *
+List *
QueryRewrite(Query * parsetree)
{
numQueryRewriteInvoked = 0;
@@ -635,14 +635,14 @@ QueryRewrite(Query * parsetree)
* deepRewriteQuery -
* rewrites the query and apply the rules again on the queries rewritten
*/
-static List *
+static List *
deepRewriteQuery(Query * parsetree)
{
- List *n;
- List *rewritten = NIL;
- List *result = NIL;
- bool instead;
- List *qual_products = NIL;
+ List *n;
+ List *rewritten = NIL;
+ List *result = NIL;
+ bool instead;
+ List *qual_products = NIL;
if (++numQueryRewriteInvoked > REWRITE_INVOKE_MAX)
{
@@ -657,8 +657,8 @@ deepRewriteQuery(Query * parsetree)
foreach(n, result)
{
- Query *pt = lfirst(n);
- List *newstuff = NIL;
+ Query *pt = lfirst(n);
+ List *newstuff = NIL;
newstuff = deepRewriteQuery(pt);
if (newstuff != NIL)
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c
index b8b39b3328..8e6b7a21ba 100644
--- a/src/backend/rewrite/rewriteManip.c
+++ b/src/backend/rewrite/rewriteManip.c
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.5 1997/09/07 04:48:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.6 1997/09/08 02:28:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,7 +28,7 @@
#include "nodes/plannodes.h"
#include "optimizer/clauses.h"
-static void ResolveNew(RewriteInfo * info, List * targetlist, Node ** node);
+static void ResolveNew(RewriteInfo * info, List * targetlist, Node ** node);
@@ -39,41 +39,41 @@ OffsetVarNodes(Node * node, int offset)
return;
switch (nodeTag(node))
{
- case T_TargetEntry:
- {
- TargetEntry *tle = (TargetEntry *) node;
-
- OffsetVarNodes(tle->expr, offset);
- }
- break;
- case T_Expr:
- {
- Expr *expr = (Expr *) node;
+ case T_TargetEntry:
+ {
+ TargetEntry *tle = (TargetEntry *) node;
- OffsetVarNodes((Node *) expr->args, offset);
- }
- break;
- case T_Var:
- {
- Var *var = (Var *) node;
+ OffsetVarNodes(tle->expr, offset);
+ }
+ break;
+ case T_Expr:
+ {
+ Expr *expr = (Expr *) node;
- var->varno += offset;
- var->varnoold += offset;
- }
- break;
- case T_List:
- {
- List *l;
+ OffsetVarNodes((Node *) expr->args, offset);
+ }
+ break;
+ case T_Var:
+ {
+ Var *var = (Var *) node;
- foreach(l, (List *) node)
+ var->varno += offset;
+ var->varnoold += offset;
+ }
+ break;
+ case T_List:
{
- OffsetVarNodes(lfirst(l), offset);
+ List *l;
+
+ foreach(l, (List *) node)
+ {
+ OffsetVarNodes(lfirst(l), offset);
+ }
}
- }
- break;
- default:
- /* ignore the others */
- break;
+ break;
+ default:
+ /* ignore the others */
+ break;
}
}
@@ -84,52 +84,52 @@ ChangeVarNodes(Node * node, int old_varno, int new_varno)
return;
switch (nodeTag(node))
{
- case T_TargetEntry:
- {
- TargetEntry *tle = (TargetEntry *) node;
-
- ChangeVarNodes(tle->expr, old_varno, new_varno);
- }
- break;
- case T_Expr:
- {
- Expr *expr = (Expr *) node;
-
- ChangeVarNodes((Node *) expr->args, old_varno, new_varno);
- }
- break;
- case T_Var:
- {
- Var *var = (Var *) node;
+ case T_TargetEntry:
+ {
+ TargetEntry *tle = (TargetEntry *) node;
- if (var->varno == old_varno)
+ ChangeVarNodes(tle->expr, old_varno, new_varno);
+ }
+ break;
+ case T_Expr:
{
- var->varno = new_varno;
- var->varnoold = new_varno;
+ Expr *expr = (Expr *) node;
+
+ ChangeVarNodes((Node *) expr->args, old_varno, new_varno);
}
- }
- break;
- case T_List:
- {
- List *l;
+ break;
+ case T_Var:
+ {
+ Var *var = (Var *) node;
- foreach(l, (List *) node)
+ if (var->varno == old_varno)
+ {
+ var->varno = new_varno;
+ var->varnoold = new_varno;
+ }
+ }
+ break;
+ case T_List:
{
- ChangeVarNodes(lfirst(l), old_varno, new_varno);
+ List *l;
+
+ foreach(l, (List *) node)
+ {
+ ChangeVarNodes(lfirst(l), old_varno, new_varno);
+ }
}
- }
- break;
- default:
- /* ignore the others */
- break;
+ break;
+ default:
+ /* ignore the others */
+ break;
}
}
void
AddQual(Query * parsetree, Node * qual)
{
- Node *copy,
- *old;
+ Node *copy,
+ *old;
if (qual == NULL)
return;
@@ -146,7 +146,7 @@ AddQual(Query * parsetree, Node * qual)
void
AddNotQual(Query * parsetree, Node * qual)
{
- Node *copy;
+ Node *copy;
if (qual == NULL)
return;
@@ -156,10 +156,10 @@ AddNotQual(Query * parsetree, Node * qual)
AddQual(parsetree, copy);
}
-static Node *
+static Node *
make_null(Oid type)
{
- Const *c = makeNode(Const);
+ Const *c = makeNode(Const);
c->consttype = type;
c->constlen = get_typlen(type);
@@ -172,15 +172,15 @@ make_null(Oid type)
void
FixResdomTypes(List * tlist)
{
- List *i;
+ List *i;
foreach(i, tlist)
{
- TargetEntry *tle = lfirst(i);
+ TargetEntry *tle = lfirst(i);
if (nodeTag(tle->expr) == T_Var)
{
- Var *var = (Var *) tle->expr;
+ Var *var = (Var *) tle->expr;
tle->resdom->restype = var->vartype;
tle->resdom->reslen = get_typlen(var->vartype);
@@ -188,14 +188,14 @@ FixResdomTypes(List * tlist)
}
}
-static Node *
+static Node *
FindMatchingNew(List * tlist, int attno)
{
- List *i;
+ List *i;
foreach(i, tlist)
{
- TargetEntry *tle = lfirst(i);
+ TargetEntry *tle = lfirst(i);
if (tle->resdom->resno == attno)
{
@@ -205,15 +205,15 @@ FindMatchingNew(List * tlist, int attno)
return NULL;
}
-static Node *
+static Node *
FindMatchingTLEntry(List * tlist, char *e_attname)
{
- List *i;
+ List *i;
foreach(i, tlist)
{
- TargetEntry *tle = lfirst(i);
- char *resname;
+ TargetEntry *tle = lfirst(i);
+ char *resname;
resname = tle->resdom->resname;
if (!strcmp(e_attname, resname))
@@ -225,60 +225,60 @@ FindMatchingTLEntry(List * tlist, char *e_attname)
static void
ResolveNew(RewriteInfo * info, List * targetlist, Node ** nodePtr)
{
- Node *node = *nodePtr;
+ Node *node = *nodePtr;
if (node == NULL)
return;
switch (nodeTag(node))
{
- case T_TargetEntry:
- ResolveNew(info, targetlist, &((TargetEntry *) node)->expr);
- break;
- case T_Expr:
- ResolveNew(info, targetlist, (Node **) (&(((Expr *) node)->args)));
- break;
- case T_Var:
- {
- int this_varno = (int) ((Var *) node)->varno;
- Node *n;
-
- if (this_varno == info->new_varno)
+ case T_TargetEntry:
+ ResolveNew(info, targetlist, &((TargetEntry *) node)->expr);
+ break;
+ case T_Expr:
+ ResolveNew(info, targetlist, (Node **) (&(((Expr *) node)->args)));
+ break;
+ case T_Var:
{
- n = FindMatchingNew(targetlist,
- ((Var *) node)->varattno);
- if (n == NULL)
+ int this_varno = (int) ((Var *) node)->varn